mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 12:27:44 +00:00
65 lines
1.8 KiB
Vue
65 lines
1.8 KiB
Vue
<script lang="ts" setup>
|
|
import { type HTMLAttributes, computed } from "vue";
|
|
import {
|
|
type RangeCalendarRootEmits,
|
|
type RangeCalendarRootProps,
|
|
useForwardPropsEmits,
|
|
} from "radix-vue";
|
|
|
|
const props = defineProps<
|
|
RangeCalendarRootProps & { class?: HTMLAttributes["class"] }
|
|
>();
|
|
|
|
const emits = defineEmits<RangeCalendarRootEmits>();
|
|
|
|
const delegatedProps = computed(() => {
|
|
const { class: _, ...delegated } = props;
|
|
|
|
return delegated;
|
|
});
|
|
|
|
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
</script>
|
|
|
|
<template>
|
|
<RangeCalendarRoot
|
|
v-slot="{ grid, weekDays }"
|
|
:class="cn('p-3', props.class)"
|
|
v-bind="forwarded"
|
|
>
|
|
<RangeCalendarHeader>
|
|
<RangeCalendarPrevButton />
|
|
<RangeCalendarHeading />
|
|
<RangeCalendarNextButton />
|
|
</RangeCalendarHeader>
|
|
|
|
<div class="flex flex-col gap-y-4 mt-4 sm:flex-row sm:gap-x-4 sm:gap-y-0">
|
|
<RangeCalendarGrid v-for="month in grid" :key="month.value.toString()">
|
|
<RangeCalendarGridHead>
|
|
<RangeCalendarGridRow>
|
|
<RangeCalendarHeadCell
|
|
v-for="day in weekDays" :key="day"
|
|
>
|
|
{{ day }}
|
|
</RangeCalendarHeadCell>
|
|
</RangeCalendarGridRow>
|
|
</RangeCalendarGridHead>
|
|
<RangeCalendarGridBody>
|
|
<RangeCalendarGridRow v-for="(weekDates, index) in month.rows" :key="`weekDate-${index}`" class="mt-2 w-full">
|
|
<RangeCalendarCell
|
|
v-for="weekDate in weekDates"
|
|
:key="weekDate.toString()"
|
|
:date="weekDate"
|
|
>
|
|
<RangeCalendarCellTrigger
|
|
:day="weekDate"
|
|
:month="month.value"
|
|
/>
|
|
</RangeCalendarCell>
|
|
</RangeCalendarGridRow>
|
|
</RangeCalendarGridBody>
|
|
</RangeCalendarGrid>
|
|
</div>
|
|
</RangeCalendarRoot>
|
|
</template>
|