Standardize import paths across UI components to use ~/lib/utils alias instead of @/lib/utils for better consistency and maintainability.
44 lines
2.0 KiB
Vue
44 lines
2.0 KiB
Vue
<script lang="ts" setup>
|
|
import type { RangeCalendarCellTriggerProps } from 'radix-vue'
|
|
import type { HTMLAttributes } from 'vue'
|
|
import { RangeCalendarCellTrigger, useForwardProps } from 'radix-vue'
|
|
import { computed } from 'vue'
|
|
import { cn } from '~/lib/utils'
|
|
|
|
import { buttonVariants } from '../button'
|
|
|
|
const props = defineProps<RangeCalendarCellTriggerProps & { class?: HTMLAttributes['class'] }>()
|
|
|
|
const delegatedProps = computed(() => {
|
|
const { class: _, ...delegated } = props
|
|
|
|
return delegated
|
|
})
|
|
|
|
const forwardedProps = useForwardProps(delegatedProps)
|
|
</script>
|
|
|
|
<template>
|
|
<RangeCalendarCellTrigger
|
|
:class="cn(
|
|
buttonVariants({ variant: 'ghost' }),
|
|
'h-9 w-9 p-0 font-normal data-[selected]:opacity-100',
|
|
'[&[data-today]:not([data-selected])]:bg-accent [&[data-today]:not([data-selected])]:text-accent-foreground',
|
|
// Selection Start
|
|
'data-[selection-start]:bg-primary data-[selection-start]:text-primary-foreground data-[selection-start]:hover:bg-primary data-[selection-start]:hover:text-primary-foreground data-[selection-start]:focus:bg-primary data-[selection-start]:focus:text-primary-foreground',
|
|
// Selection End
|
|
'data-[selection-end]:bg-primary data-[selection-end]:text-primary-foreground data-[selection-end]:hover:bg-primary data-[selection-end]:hover:text-primary-foreground data-[selection-end]:focus:bg-primary data-[selection-end]:focus:text-primary-foreground',
|
|
// Outside months
|
|
'data-[outside-month]:pointer-events-none data-[outside-month]:text-muted-foreground data-[outside-month]:opacity-50 [&[data-outside-month][data-selected]]:bg-accent/50 [&[data-outside-month][data-selected]]:text-muted-foreground [&[data-outside-month][data-selected]]:opacity-30',
|
|
// Disabled
|
|
'data-[disabled]:text-muted-foreground data-[disabled]:opacity-50',
|
|
// Unavailable
|
|
'data-[unavailable]:text-destructive-foreground data-[unavailable]:line-through',
|
|
props.class,
|
|
)"
|
|
v-bind="forwardedProps"
|
|
>
|
|
<slot />
|
|
</RangeCalendarCellTrigger>
|
|
</template>
|