2024-06-13 17:36:43 +02:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { buttonVariants } from "$lib/components/ui/button/index.js";
|
|
|
|
|
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(
|
|
|
|
|
buttonVariants({ variant: "ghost" }),
|
2025-06-08 16:32:41 +02:00
|
|
|
"size-9 p-0 font-normal",
|
2024-06-13 17:36:43 +02:00
|
|
|
"[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground",
|
|
|
|
|
// Selected
|
2025-06-08 16:32:41 +02:00
|
|
|
"data-[selected]:bg-primary data-[selected]:text-primary-foreground data-[selected]:hover:bg-primary data-[selected]:hover:text-primary-foreground data-[selected]:focus:bg-primary data-[selected]:focus:text-primary-foreground data-[selected]:opacity-100",
|
2024-06-13 17:36:43 +02:00
|
|
|
// Disabled
|
|
|
|
|
"data-[disabled]:text-muted-foreground data-[disabled]:opacity-50",
|
|
|
|
|
// Unavailable
|
|
|
|
|
"data-[unavailable]:text-destructive-foreground data-[unavailable]:line-through",
|
|
|
|
|
// Outside months
|
2025-06-08 16:32:41 +02:00
|
|
|
"data-[outside-month]:text-muted-foreground [&[data-outside-month][data-selected]]:bg-accent/50 [&[data-outside-month][data-selected]]:text-muted-foreground data-[outside-month]:pointer-events-none data-[outside-month]:opacity-50 [&[data-outside-month][data-selected]]:opacity-30",
|
2024-06-13 17:36:43 +02:00
|
|
|
className
|
|
|
|
|
)}
|
2025-06-08 16:32:41 +02:00
|
|
|
{...restProps}
|
|
|
|
|
/>
|