Files
gpx.studio/website/src/lib/components/ui/calendar/calendar-day.svelte

34 lines
1.4 KiB
Svelte
Raw Normal View History

2024-06-13 17:36:43 +02:00
<script lang="ts">
import { cn } from "$lib/utils.js";
2025-06-08 16:32:41 +02:00
import { Calendar as CalendarPrimitive } from "bits-ui";
2024-06-13 17:36:43 +02:00
2025-06-08 16:32:41 +02:00
let {
ref = $bindable(null),
class: className,
...restProps
}: CalendarPrimitive.DayProps = $props();
2024-06-13 17:36:43 +02:00
</script>
<CalendarPrimitive.Day
2025-06-08 16:32:41 +02:00
bind:ref
2024-06-13 17:36:43 +02:00
class={cn(
2026-04-06 18:22:01 +02:00
"flex size-(--cell-size) flex-col items-center justify-center gap-1 rounded-(--cell-radius) p-0 leading-none font-normal whitespace-nowrap select-none",
"[&:last-child[data-selected=true]_button]:rounded-r-(--cell-radius)",
"not-data-selected:hover:bg-accent/50 not-data-selected:hover:text-accent-foreground",
2025-06-21 21:07:36 +02:00
"[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground [&[data-today][data-disabled]]:text-muted-foreground",
2026-04-06 18:22:01 +02:00
"data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:hover:text-foreground",
2025-06-21 21:07:36 +02:00
// Outside months
"[&[data-outside-month]:not([data-selected])]:text-muted-foreground [&[data-outside-month]:not([data-selected])]:hover:text-accent-foreground",
2024-06-13 17:36:43 +02:00
// Disabled
2025-06-21 21:07:36 +02:00
"data-[disabled]:text-muted-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
2024-06-13 17:36:43 +02:00
// Unavailable
2025-06-21 21:07:36 +02:00
"data-[unavailable]:text-muted-foreground data-[unavailable]:line-through",
// focus
"focus:border-ring focus:ring-ring/50 focus:relative",
// inner spans
"[&>span]:text-xs [&>span]:opacity-70",
2024-06-13 17:36:43 +02:00
className
)}
2025-06-08 16:32:41 +02:00
{...restProps}
/>