refactor: update default

This commit is contained in:
Sadegh Barati 2024-01-19 02:15:56 +03:30
parent 8f3f52b99f
commit e994656db0
97 changed files with 483 additions and 380 deletions

View File

@ -15,14 +15,9 @@ const delegatedProps = computed(() => {
<template>
<AccordionContent
v-bind="delegatedProps"
:class="
cn(
'overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down',
props.class,
)
"
class="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
>
<div class="pb-4 pt-0">
<div :class="cn('pb-4 pt-0', props.class)">
<slot />
</div>
</AccordionContent>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { AccordionItem, type AccordionItemProps } from 'radix-vue'
import { AccordionItem, type AccordionItemProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<AccordionItemProps & { class?: HTMLAttributes['class'] }>()
@ -10,11 +10,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<AccordionItem
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="cn('border-b', props.class)"
>
<slot />

View File

@ -18,20 +18,22 @@ const delegatedProps = computed(() => {
</script>
<template>
<AccordionHeader class="flex" as="div">
<AccordionHeader class="flex">
<AccordionTrigger
v-bind="delegatedProps"
:class="
cn(
'flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
'flex flex-1 items-center justify-between py-4 text-sm font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180',
props.class,
)
"
>
<slot />
<slot name="icon">
<ChevronDown
class="h-4 w-4 shrink-0 transition-transform duration-200"
/>
</slot>
</AccordionTrigger>
</AccordionHeader>
</template>

View File

@ -6,7 +6,7 @@ import {
type AlertDialogContentProps,
AlertDialogOverlay,
AlertDialogPortal,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -18,18 +18,20 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<AlertDialogPortal>
<AlertDialogOverlay
class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
/>
<AlertDialogContent
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
:class="
cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full',
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
props.class,
)
"

View File

@ -18,7 +18,7 @@ const delegatedProps = computed(() => {
<template>
<AlertDialogDescription
v-bind="delegatedProps"
:class="cn('text-muted-foreground text-sm', props.class)"
:class="cn('text-sm text-muted-foreground', props.class)"
>
<slot />
</AlertDialogDescription>

View File

@ -11,7 +11,7 @@ const props = defineProps<{
<div
:class="
cn(
'flex flex-col space-y-2 sm:space-y-0 mt-3.5 sm:flex-row sm:justify-end sm:space-x-2',
'flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-x-2',
props.class,
)
"

View File

@ -9,7 +9,7 @@ const props = defineProps<{
<template>
<div
:class="cn('flex flex-col space-y-2 text-center sm:text-left', props.class)"
:class="cn('flex flex-col gap-y-2 text-center sm:text-left', props.class)"
>
<slot />
</div>

View File

@ -15,7 +15,7 @@ const delegatedProps = computed(() => {
<template>
<AlertDialogTitle
v-bind="delegatedProps"
:class="cn('text-lg text-foreground font-semibold', props.class)"
:class="cn('text-lg font-semibold', props.class)"
>
<slot />
</AlertDialogTitle>

View File

@ -10,7 +10,7 @@ const props = defineProps<{
</script>
<template>
<div :class="cn(alertVariants({ variant }), props.class)">
<div :class="cn(alertVariants({ variant }), props.class)" role="alert">
<slot />
</div>
</template>

View File

@ -8,11 +8,11 @@ export const badgeVariants = cva(
variants: {
variant: {
default:
'border-transparent bg-primary text-primary-foreground hover:bg-primary/80',
'border-transparent bg-primary text-primary-foreground shadow hover:bg-primary/80',
secondary:
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
'border-transparent bg-destructive text-destructive-foreground shadow hover:bg-destructive/80',
outline: 'text-foreground',
},
},

View File

@ -3,25 +3,25 @@ import { type VariantProps, cva } from 'class-variance-authority'
export { default as Button } from './Button.vue'
export const buttonVariants = cva(
'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
{
variants: {
variant: {
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
default: 'bg-primary text-primary-foreground shadow hover:bg-primary/90',
destructive:
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
'bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90',
outline:
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
'border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground',
secondary:
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
'bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80',
ghost: 'hover:bg-accent hover:text-accent-foreground',
link: 'text-primary underline-offset-4 hover:underline',
},
size: {
default: 'h-10 px-4 py-2',
sm: 'h-9 rounded-md px-3',
lg: 'h-11 rounded-md px-8',
icon: 'h-10 w-10',
default: 'h-9 px-4 py-2',
sm: 'h-8 rounded-md px-3 text-xs',
lg: 'h-10 rounded-md px-8',
icon: 'h-9 w-9',
},
},
defaultVariants: {

View File

@ -28,7 +28,6 @@ interface SimpleDateParts {
defineOptions({
inheritAttrs: false,
})
const props = withDefaults(defineProps< {
modelValue?: string | number | Date | DatePickerModel
modelModifiers?: object
@ -79,8 +78,8 @@ onMounted(async () => {
<DatePicker
ref="datePicker"
v-model="modelValue"
v-bind="$attrs"
v-model="modelValue"
:model-modifiers="modelModifiers"
class="calendar"
trim-weeks
@ -110,7 +109,7 @@ onMounted(async () => {
@apply flex;
}
.calendar .vc-weekday {
@apply text-muted-foreground rounded-md w-9 font-normal text-[0.8rem];
@apply text-muted-foreground rounded-md w-8 font-normal text-[0.8rem];
}
.calendar .vc-weeks {
@apply w-full space-y-2 flex flex-col [&>_div]:grid [&>_div]:grid-cols-7;
@ -131,7 +130,7 @@ onMounted(async () => {
@apply rounded-md;
}
.calendar .vc-day-content {
@apply text-center text-sm p-0 relative focus-within:relative focus-within:z-20 inline-flex items-center justify-center ring-offset-background hover:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 hover:bg-accent hover:text-accent-foreground h-9 w-9 font-normal aria-selected:opacity-100 select-none;
@apply text-center text-sm p-0 relative focus-within:relative focus-within:z-20 inline-flex items-center justify-center ring-offset-background hover:transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 hover:bg-accent hover:text-accent-foreground h-8 w-8 font-normal aria-selected:opacity-100 select-none;
}
.calendar .vc-day-content:not(.vc-highlight-content-light) {
@apply rounded-md;
@ -157,6 +156,7 @@ onMounted(async () => {
--vc-slide-duration: 0.15s;
--vc-slide-timing: ease;
}
.calendar .vc-fade-enter-active,
.calendar .vc-fade-leave-active,
.calendar .vc-slide-left-enter-active,
@ -183,6 +183,7 @@ onMounted(async () => {
backface-visibility: hidden;
pointer-events: none;
}
.calendar .vc-none-leave-active,
.calendar .vc-fade-leave-active,
.calendar .vc-slide-left-leave-active,
@ -192,6 +193,7 @@ onMounted(async () => {
position: absolute !important;
width: 100%;
}
.calendar .vc-none-enter-from,
.calendar .vc-none-leave-to,
.calendar .vc-fade-enter-from,
@ -208,6 +210,7 @@ onMounted(async () => {
.calendar .vc-slide-fade-leave-to {
opacity: 0;
}
.calendar .vc-slide-left-enter-from,
.calendar .vc-slide-right-leave-to,
.calendar .vc-slide-fade-enter-from.direction-left,
@ -215,6 +218,7 @@ onMounted(async () => {
-webkit-transform: translateX(var(--vc-slide-translate));
transform: translateX(var(--vc-slide-translate));
}
.calendar .vc-slide-right-enter-from,
.calendar .vc-slide-left-leave-to,
.calendar .vc-slide-fade-enter-from.direction-right,
@ -222,6 +226,7 @@ onMounted(async () => {
-webkit-transform: translateX(calc(-1 * var(--vc-slide-translate)));
transform: translateX(calc(-1 * var(--vc-slide-translate)));
}
.calendar .vc-slide-up-enter-from,
.calendar .vc-slide-down-leave-to,
.calendar .vc-slide-fade-enter-from.direction-top,
@ -229,6 +234,7 @@ onMounted(async () => {
-webkit-transform: translateY(var(--vc-slide-translate));
transform: translateY(var(--vc-slide-translate));
}
.calendar .vc-slide-down-enter-from,
.calendar .vc-slide-up-leave-to,
.calendar .vc-slide-fade-enter-from.direction-bottom,

View File

@ -8,7 +8,7 @@ const props = defineProps<{
</script>
<template>
<div :class="cn('p-6 pt-0', props.class)">
<div :class="cn('flex items-center p-6 pt-0', props.class)">
<slot />
</div>
</template>

View File

@ -8,7 +8,7 @@ const props = defineProps<{
</script>
<template>
<div :class="cn('flex flex-col space-y-1.5 p-6', props.class)">
<div :class="cn('flex flex-col gap-y-1.5 p-6', props.class)">
<slot />
</div>
</template>

View File

@ -10,7 +10,7 @@ const props = defineProps<{
<template>
<h3
:class="
cn('text-2xl font-semibold leading-none tracking-tighter', props.class)
cn('font-semibold leading-none tracking-tight', props.class)
"
>
<slot />

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { WithClassAsProps } from './interface'
import { useCarousel } from './useCarousel'
import type { WithClassAsProps } from './interface'
import { cn } from '@/lib/utils'
defineOptions({

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import type { WithClassAsProps } from './interface'
import { useCarousel } from './useCarousel'
import type { WithClassAsProps } from './interface'
import { cn } from '@/lib/utils'
const props = defineProps<WithClassAsProps>()

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ChevronRight } from 'lucide-vue-next'
import { ArrowRight } from 'lucide-vue-next'
import { useCarousel } from './useCarousel'
import type { WithClassAsProps } from './interface'
import { cn } from '@/lib/utils'
@ -24,7 +24,7 @@ const { orientation, canScrollNext, scrollNext } = useCarousel()
@click="scrollNext"
>
<slot>
<ChevronRight class="h-4 w-4 text-current" />
<ArrowRight class="h-4 w-4 text-current" />
</slot>
</Button>
</template>

View File

@ -1,5 +1,5 @@
<script setup lang="ts">
import { ChevronLeft } from 'lucide-vue-next'
import { ArrowLeft } from 'lucide-vue-next'
import { useCarousel } from './useCarousel'
import type { WithClassAsProps } from './interface'
import { cn } from '@/lib/utils'
@ -24,7 +24,7 @@ const { orientation, canScrollPrev, scrollPrev } = useCarousel()
@click="scrollPrev"
>
<slot>
<ChevronLeft class="h-4 w-4 text-current" />
<ArrowLeft class="h-4 w-4 text-current" />
</slot>
</Button>
</template>

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import type { CheckboxRootEmits, CheckboxRootProps } from 'radix-vue'
import { CheckboxIndicator, CheckboxRoot, useEmitAsProps } from 'radix-vue'
import { CheckboxIndicator, CheckboxRoot, useForwardPropsEmits } from 'radix-vue'
import { Check } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -13,20 +13,21 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<CheckboxRoot
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="
cn('peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground',
props.class)"
>
<CheckboxIndicator class="flex h-full w-full items-center justify-center text-current">
<slot>
<Check class="h-4 w-4" />
</slot>
</CheckboxIndicator>
</CheckboxRoot>
</template>

View File

@ -1,13 +1,14 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import type { ComboboxRootEmits, ComboboxRootProps } from 'radix-vue'
import { ComboboxRoot, useEmitAsProps } from 'radix-vue'
import { ComboboxRoot, useForwardPropsEmits } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = withDefaults(defineProps<ComboboxRootProps & { class?: HTMLAttributes['class'] }>(), {
open: true,
modelValue: '',
})
const emits = defineEmits<ComboboxRootEmits>()
const delegatedProps = computed(() => {
@ -15,14 +16,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ComboboxRoot
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="cn('flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground', props.class)"
>
<slot />

View File

@ -12,7 +12,7 @@ const forwarded = useForwardPropsEmits(props, emits)
<template>
<Dialog v-bind="forwarded">
<DialogContent class="p-0 overflow-hidden shadow-lg">
<DialogContent class="overflow-hidden p-0 shadow-lg">
<Command class="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
<slot />
</Command>

View File

@ -19,7 +19,7 @@ const delegatedProps = computed(() => {
<template>
<ComboboxGroup
v-bind="delegatedProps"
:class="cn('overflow-hidden p-1 text-foreground', props.class)"
:class="cn('overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground', props.class)"
>
<ComboboxLabel v-if="heading" class="px-2 py-1.5 text-xs font-medium text-muted-foreground">
{{ heading }}

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { Search } from 'lucide-vue-next'
import { ComboboxInput, type ComboboxInputProps } from 'radix-vue'
import { ComboboxInput, type ComboboxInputProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
defineOptions({
@ -17,13 +17,15 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<div class="flex items-center border-b px-3" cmdk-input-wrapper>
<Search class="mr-2 h-4 w-4 shrink-0 opacity-50" />
<ComboboxInput
v-bind="{ ...delegatedProps, ...$attrs }"
v-bind="{ ...forwardedProps, ...$attrs }"
auto-focus
:class="cn('flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50', props.class)"
/>

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import type { ComboboxItemEmits, ComboboxItemProps } from 'radix-vue'
import { ComboboxItem, useEmitAsProps } from 'radix-vue'
import { ComboboxItem, useForwardPropsEmits } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<ComboboxItemProps & { class?: HTMLAttributes['class'] }>()
@ -12,12 +12,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ComboboxItem
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
:class="cn('relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', props.class)"
v-bind="forwarded"
:class="cn('relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50', props.class)"
@select.prevent
>
<slot />

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import type { ComboboxContentEmits, ComboboxContentProps } from 'radix-vue'
import { ComboboxContent, useEmitAsProps } from 'radix-vue'
import { ComboboxContent, useForwardPropsEmits } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<ComboboxContentProps & { class?: HTMLAttributes['class'] }>()
@ -12,10 +12,12 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ComboboxContent v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }" :class="cn('max-h-[300px] overflow-y-auto overflow-x-hidden', props.class)">
<ComboboxContent v-bind="forwarded" :class="cn('max-h-[300px] overflow-y-auto overflow-x-hidden', props.class)">
<div role="presentation">
<slot />
</div>

View File

@ -5,7 +5,7 @@ import {
type ContextMenuCheckboxItemEmits,
type ContextMenuCheckboxItemProps,
ContextMenuItemIndicator,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { Check } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -18,23 +18,21 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ContextMenuCheckboxItem
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
:class="[
cn(
v-bind="forwarded"
:class="cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
props.class,
),
]"
)"
>
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<ContextMenuItemIndicator
class="absolute left-1.5 inline-flex w-4 h-4 items-center justify-center"
>
<Check class="h-4 h-w" />
<ContextMenuItemIndicator>
<Check class="h-4 w-4" />
</ContextMenuItemIndicator>
</span>
<slot />

View File

@ -5,7 +5,7 @@ import {
type ContextMenuContentEmits,
type ContextMenuContentProps,
ContextMenuPortal,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -17,15 +17,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ContextMenuPortal>
<ContextMenuContent
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="[
cn(
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md animate-in fade-in-80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',

View File

@ -4,7 +4,7 @@ import {
ContextMenuItem,
type ContextMenuItemEmits,
type ContextMenuItemProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -16,11 +16,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ContextMenuItem
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
:class="[
cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',

View File

@ -5,7 +5,7 @@ import {
ContextMenuRadioItem,
type ContextMenuRadioItemEmits,
type ContextMenuRadioItemProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { Circle } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -18,14 +18,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ContextMenuRadioItem
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="[
cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',

View File

@ -4,7 +4,7 @@ import {
ContextMenuSubContent,
type DropdownMenuSubContentEmits,
type DropdownMenuSubContentProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -16,14 +16,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ContextMenuSubContent
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="
cn(
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',

View File

@ -3,6 +3,7 @@ import { type HTMLAttributes, computed } from 'vue'
import {
ContextMenuSubTrigger,
type ContextMenuSubTriggerProps,
useForwardProps,
} from 'radix-vue'
import { ChevronRight } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -14,11 +15,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<ContextMenuSubTrigger
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="[
cn(
'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',

View File

@ -1,11 +1,13 @@
<script setup lang="ts">
import { ContextMenuTrigger, type ContextMenuTriggerProps } from 'radix-vue'
import { ContextMenuTrigger, type ContextMenuTriggerProps, useForwardProps } from 'radix-vue'
const props = defineProps<ContextMenuTriggerProps>()
const forwardedProps = useForwardProps(props)
</script>
<template>
<ContextMenuTrigger v-bind="props">
<ContextMenuTrigger v-bind="forwardedProps">
<slot />
</ContextMenuTrigger>
</template>

View File

@ -7,7 +7,7 @@ import {
type DialogContentProps,
DialogOverlay,
DialogPortal,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { X } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -20,25 +20,27 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<DialogPortal>
<DialogOverlay
class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
/>
<DialogContent
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
:class="
cn(
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full',
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
props.class,
)"
>
<slot />
<DialogClose
class="absolute top-3 right-3 p-0.5 transition-colors rounded-md hover:bg-secondary"
class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"
>
<X class="w-4 h-4" />
<span class="sr-only">Close</span>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { DialogDescription, type DialogDescriptionProps } from 'radix-vue'
import { DialogDescription, type DialogDescriptionProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<DialogDescriptionProps & { class?: HTMLAttributes['class'] }>()
@ -10,12 +10,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<DialogDescription
v-bind="delegatedProps"
:class="cn('text-muted-foreground text-sm', props.class)"
v-bind="forwardedProps"
:class="cn('text-sm text-muted-foreground', props.class)"
>
<slot />
</DialogDescription>

View File

@ -9,7 +9,7 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>()
<div
:class="
cn(
'flex flex-col space-y-2 sm:space-y-0 mt-1.5 sm:flex-row sm:justify-end sm:space-x-2',
'flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-x-2',
props.class,
)
"

View File

@ -9,7 +9,7 @@ const props = defineProps<{
<template>
<div
:class="cn('flex flex-col space-y-2 text-center sm:text-left', props.class)"
:class="cn('flex flex-col gap-y-1.5 text-center sm:text-left', props.class)"
>
<slot />
</div>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { DialogTitle, type DialogTitleProps } from 'radix-vue'
import { DialogTitle, type DialogTitleProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<DialogTitleProps & { class?: HTMLAttributes['class'] }>()
@ -10,14 +10,16 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<DialogTitle
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'text-lg text-foreground font-semibold leading-none tracking-tight',
'text-lg font-semibold leading-none tracking-tight',
props.class,
)
"

View File

@ -5,7 +5,7 @@ import {
type DropdownMenuCheckboxItemEmits,
type DropdownMenuCheckboxItemProps,
DropdownMenuItemIndicator,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { Check } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -18,11 +18,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<DropdownMenuCheckboxItem
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
:class=" cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
props.class,

View File

@ -5,7 +5,7 @@ import {
type DropdownMenuContentEmits,
type DropdownMenuContentProps,
DropdownMenuPortal,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -22,21 +22,15 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<DropdownMenuPortal>
<DropdownMenuContent
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
:class="[
cn(
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
props.class,
),
]"
v-bind="forwarded"
:class="cn('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', props.class)"
>
<slot />
</DropdownMenuContent>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { DropdownMenuItem, type DropdownMenuItemProps } from 'radix-vue'
import { DropdownMenuItem, type DropdownMenuItemProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<DropdownMenuItemProps & { class?: HTMLAttributes['class']; inset?: boolean }>()
@ -10,11 +10,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<DropdownMenuItem
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="[
cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { DropdownMenuLabel, type DropdownMenuLabelProps } from 'radix-vue'
import { DropdownMenuLabel, type DropdownMenuLabelProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<DropdownMenuLabelProps & { class?: HTMLAttributes['class']; inset?: boolean }>()
@ -10,11 +10,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<DropdownMenuLabel
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="cn('px-2 py-1.5 text-sm font-semibold', inset && 'pl-8', props.class)"
>
<slot />

View File

@ -5,7 +5,7 @@ import {
DropdownMenuRadioItem,
type DropdownMenuRadioItemEmits,
type DropdownMenuRadioItemProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { Circle } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -19,18 +19,19 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<DropdownMenuRadioItem
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
:class="cn(
'flex relative items-center rounded-md transition-colors data-[disabled]:opacity-50 data-[disabled]:pointer-events-none data-[highlighted]:bg-outline-hover pl-7 py-1.5 text-sm outline-none select-none cursor-default',
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
props.class,
)"
>
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<DropdownMenuItemIndicator>
<Circle class="h-2 w-2 fill-current" />
</DropdownMenuItemIndicator>

View File

@ -1,12 +1,22 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import {
DropdownMenuSeparator,
type DropdownMenuSeparatorProps,
} from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<DropdownMenuSeparatorProps>()
const props = defineProps<DropdownMenuSeparatorProps & {
class?: HTMLAttributes['class']
}>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
return delegated
})
</script>
<template>
<DropdownMenuSeparator v-bind="props" class="-mx-1 my-1 h-px bg-muted" />
<DropdownMenuSeparator v-bind="delegatedProps" :class="cn('-mx-1 my-1 h-px bg-muted', props.class)" />
</template>

View File

@ -4,7 +4,7 @@ import {
DropdownMenuSubContent,
type DropdownMenuSubContentEmits,
type DropdownMenuSubContentProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -16,14 +16,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<DropdownMenuSubContent
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="cn('z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', props.class)"
>
<slot />

View File

@ -3,6 +3,7 @@ import { type HTMLAttributes, computed } from 'vue'
import {
DropdownMenuSubTrigger,
type DropdownMenuSubTriggerProps,
useForwardProps,
} from 'radix-vue'
import { ChevronRight } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -14,11 +15,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<DropdownMenuSubTrigger
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="[
cn(
'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent',

View File

@ -1,11 +1,13 @@
<script setup lang="ts">
import { DropdownMenuTrigger, type DropdownMenuTriggerProps } from 'radix-vue'
import { DropdownMenuTrigger, type DropdownMenuTriggerProps, useForwardProps } from 'radix-vue'
const props = defineProps<DropdownMenuTriggerProps>()
const forwardedProps = useForwardProps(props)
</script>
<template>
<DropdownMenuTrigger class="outline-none" v-bind="props">
<DropdownMenuTrigger class="outline-none" v-bind="forwardedProps">
<slot />
</DropdownMenuTrigger>
</template>

View File

@ -1,12 +1,10 @@
<script lang="ts" setup>
import type { HTMLAttributes } from 'vue'
import { Label, type LabelProps } from 'radix-vue'
import type { LabelProps } from 'radix-vue'
import { useFormField } from './useFormField'
import { cn } from '@/lib/utils'
import { Label } from '@/lib/registry/default/ui/label'
defineOptions({
inheritAttrs: false,
})
const props = defineProps<LabelProps & { class?: HTMLAttributes['class'] }>()
const { error, formItemId } = useFormField()
@ -15,7 +13,6 @@ const { error, formItemId } = useFormField()
<template>
<Label
:class="cn(
'block text-sm tracking-tight font-medium text-foreground text-left',
error && 'text-destructive',
props.class,
)"

View File

@ -2,11 +2,12 @@
import { HoverCardRoot, type HoverCardRootProps, useForwardProps } from 'radix-vue'
const props = defineProps<HoverCardRootProps>()
const forwarded = useForwardProps(props)
const forwardedProps = useForwardProps(props)
</script>
<template>
<HoverCardRoot v-bind="forwarded">
<HoverCardRoot v-bind="forwardedProps">
<slot />
</HoverCardRoot>
</template>

View File

@ -4,6 +4,7 @@ import {
HoverCardContent,
type HoverCardContentProps,
HoverCardPortal,
useForwardProps,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -19,15 +20,17 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<HoverCardPortal>
<HoverCardContent
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'z-50 w-64 rounded-md bg-background border border-border p-4 text-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
'z-50 w-64 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
props.class,
)
"

View File

@ -17,7 +17,7 @@ const delegatedProps = computed(() => {
v-bind="delegatedProps"
:class="
cn(
'block text-sm tracking-tight font-medium text-foreground text-left',
'text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70',
props.class,
)
"

View File

@ -4,7 +4,7 @@ import {
MenubarRoot,
type MenubarRootEmits,
type MenubarRootProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -16,17 +16,16 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<MenubarRoot
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="
cn(
'flex h-10 items-center space-x-1 rounded-md border border-border p-1',
'flex h-10 items-center gap-x-1 rounded-md border bg-background p-1',
props.class,
)
"

View File

@ -5,13 +5,12 @@ import {
type MenubarCheckboxItemEmits,
type MenubarCheckboxItemProps,
MenubarItemIndicator,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { Check } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
const props = defineProps<MenubarCheckboxItemProps & { class?: HTMLAttributes['class'] }>()
const emits = defineEmits<MenubarCheckboxItemEmits>()
const delegatedProps = computed(() => {
@ -19,26 +18,23 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<MenubarCheckboxItem
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
:class="[
cn(
v-bind="forwarded"
:class="cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
props.class,
),
]"
>
<MenubarItemIndicator
class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"
)"
>
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<MenubarItemIndicator>
<Check class="w-4 h-4" />
</MenubarItemIndicator>
</span>
<slot />
</MenubarCheckboxItem>
</template>

View File

@ -4,6 +4,7 @@ import {
MenubarContent,
type MenubarContentProps,
MenubarPortal,
useForwardProps,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -21,12 +22,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<MenubarPortal>
<MenubarContent
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'z-50 min-w-[12rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',

View File

@ -4,7 +4,7 @@ import {
MenubarItem,
type MenubarItemEmits,
type MenubarItemProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -17,14 +17,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<MenubarItem
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="[
cn(
'relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',

View File

@ -5,7 +5,7 @@ import {
MenubarRadioItem,
type MenubarRadioItemEmits,
type MenubarRadioItemProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { Circle } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -18,27 +18,23 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<MenubarRadioItem
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
:class="[
cn(
v-bind="forwarded"
:class="cn(
'relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',
props.class,
),
]"
>
<MenubarItemIndicator
class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center"
)"
>
<span class="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<MenubarItemIndicator>
<Circle class="h-2 w-2 fill-curren" />
</MenubarItemIndicator>
</span>
<slot />
</MenubarRadioItem>
</template>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { MenubarSeparator, type MenubarSeparatorProps } from 'radix-vue'
import { MenubarSeparator, type MenubarSeparatorProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<MenubarSeparatorProps & { class?: HTMLAttributes['class'] }>()
@ -10,8 +10,10 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<MenubarSeparator :class=" cn('-mx-1 my-1 h-px bg-secondary', props.class)" v-bind="delegatedProps" />
<MenubarSeparator :class=" cn('-mx-1 my-1 h-px bg-muted', props.class)" v-bind="forwardedProps" />
</template>

View File

@ -8,7 +8,7 @@ const props = defineProps<{
</script>
<template>
<span :class="cn('text-xxs ml-auto tracking-widest opacity-50', props.class)">
<span :class="cn('ml-auto text-xs tracking-widest text-muted-foreground', props.class)">
<slot />
</span>
</template>

View File

@ -5,7 +5,7 @@ import {
MenubarSubContent,
type MenubarSubContentEmits,
type MenubarSubContentProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -24,15 +24,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<MenubarPortal>
<MenubarSubContent
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="
cn(
'z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { MenubarSubTrigger, type MenubarSubTriggerProps } from 'radix-vue'
import { MenubarSubTrigger, type MenubarSubTriggerProps, useForwardProps } from 'radix-vue'
import { ChevronRight } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -11,11 +11,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<MenubarSubTrigger
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="[
cn(
'flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { MenubarTrigger, type MenubarTriggerProps } from 'radix-vue'
import { MenubarTrigger, type MenubarTriggerProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<MenubarTriggerProps & { class?: HTMLAttributes['class'] }>()
@ -10,11 +10,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<MenubarTrigger
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'flex cursor-default select-none items-center rounded-sm px-3 py-1.5 text-sm font-medium outline-none focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground',

View File

@ -4,7 +4,7 @@ import {
NavigationMenuRoot,
type NavigationMenuRootEmits,
type NavigationMenuRootProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import NavigationMenuViewport from './NavigationMenuViewport.vue'
import { cn } from '@/lib/utils'
@ -18,14 +18,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<NavigationMenuRoot
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="cn('relative z-10 flex max-w-max flex-1 items-center justify-center', props.class)"
>
<slot />

View File

@ -4,7 +4,7 @@ import {
NavigationMenuContent,
type NavigationMenuContentEmits,
type NavigationMenuContentProps,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -17,17 +17,17 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<NavigationMenuContent
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
:class="
cn(
v-bind="forwarded"
:class="cn(
'left-0 top-0 w-full data-[motion^=from-]:animate-in data-[motion^=to-]:animate-out data-[motion^=from-]:fade-in data-[motion^=to-]:fade-out data-[motion=from-end]:slide-in-from-right-52 data-[motion=from-start]:slide-in-from-left-52 data-[motion=to-end]:slide-out-to-right-52 data-[motion=to-start]:slide-out-to-left-52 md:absolute md:w-auto',
props.class,
)
"
)"
>
<slot />
</NavigationMenuContent>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { NavigationMenuIndicator, type NavigationMenuIndicatorProps } from 'radix-vue'
import { NavigationMenuIndicator, type NavigationMenuIndicatorProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<NavigationMenuIndicatorProps & { class?: HTMLAttributes['class'] }>()
@ -10,11 +10,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<NavigationMenuIndicator
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="cn('top-full z-[1] flex h-1.5 items-end justify-center overflow-hidden data-[state=visible]:animate-in data-[state=hidden]:animate-out data-[state=hidden]:fade-out data-[state=visible]:fade-in', props.class)"
>
<div class="relative top-[60%] h-2 w-2 rotate-45 rounded-tl-sm bg-border shadow-md" />

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { NavigationMenuList, type NavigationMenuListProps } from 'radix-vue'
import { NavigationMenuList, type NavigationMenuListProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<NavigationMenuListProps & { class?: HTMLAttributes['class'] }>()
@ -10,14 +10,16 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<NavigationMenuList
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'group flex flex-1 list-none items-center justify-center space-x-1',
'group flex flex-1 list-none items-center justify-center gap-x-1',
props.class,
)
"

View File

@ -3,6 +3,7 @@ import { type HTMLAttributes, computed } from 'vue'
import {
NavigationMenuTrigger,
type NavigationMenuTriggerProps,
useForwardProps,
} from 'radix-vue'
import { ChevronDown } from 'lucide-vue-next'
import { navigationMenuTriggerStyle } from '.'
@ -15,16 +16,18 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<NavigationMenuTrigger
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="cn(navigationMenuTriggerStyle(), 'group', props.class)"
>
<slot />
<ChevronDown
class="relative top-[1px] ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
class="relative top-px ml-1 h-3 w-3 transition duration-200 group-data-[state=open]:rotate-180"
aria-hidden="true"
/>
</NavigationMenuTrigger>

View File

@ -3,6 +3,7 @@ import { type HTMLAttributes, computed } from 'vue'
import {
NavigationMenuViewport,
type NavigationMenuViewportProps,
useForwardProps,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -13,12 +14,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<div class="absolute left-0 top-full flex justify-center">
<NavigationMenuViewport
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'origin-top-center relative mt-1.5 h-[var(--radix-navigation-menu-viewport-height)] w-full overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-90 md:w-[var(--radix-navigation-menu-viewport-width)]',

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { PaginationLast, type PaginationLastProps, useForwardProps } from 'radix-vue'
import { PaginationLast, type PaginationLastProps } from 'radix-vue'
import { ChevronsRight } from 'lucide-vue-next'
import {
Button,

View File

@ -5,7 +5,7 @@ import {
type PopoverContentEmits,
type PopoverContentProps,
PopoverPortal,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
@ -16,6 +16,7 @@ defineOptions({
const props = withDefaults(
defineProps<PopoverContentProps & { class?: HTMLAttributes['class'] }>(),
{
align: 'center',
sideOffset: 4,
},
)
@ -26,12 +27,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<PopoverPortal>
<PopoverContent
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits), ...$attrs }"
v-bind="{ ...forwarded, ...$attrs }"
:class="
cn(
'z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',

View File

@ -10,7 +10,6 @@ import { cn } from '@/lib/utils'
const props = withDefaults(
defineProps<ProgressRootProps & { class?: HTMLAttributes['class'] }>(),
{
class: '',
modelValue: 0,
},
)
@ -33,7 +32,7 @@ const delegatedProps = computed(() => {
"
>
<ProgressIndicator
class="h-full w-full flex-1 duration-300 bg-foreground transition-all"
class="h-full w-full flex-1 bg-primary transition-all"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0)}%);`"
/>
</ProgressRoot>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { RadioGroupRoot, type RadioGroupRootEmits, type RadioGroupRootProps, useEmitAsProps } from 'radix-vue'
import { RadioGroupRoot, type RadioGroupRootEmits, type RadioGroupRootProps, useForwardPropsEmits } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<RadioGroupRootProps & { class?: HTMLAttributes['class'] }>()
@ -11,15 +11,14 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<RadioGroupRoot
:class="cn('grid gap-2', props.class)"
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
>
<slot />
</RadioGroupRoot>

View File

@ -4,6 +4,7 @@ import {
RadioGroupIndicator,
RadioGroupItem,
type RadioGroupItemProps,
useForwardProps,
} from 'radix-vue'
import { Circle } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -15,14 +16,16 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<RadioGroupItem
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'aspect-square h-4 w-4 rounded-full cursor-pointer flex justify-center items-center border border-primary disabled:cursor-not-allowed disabled:opacity-50',
'aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
props.class,
)
"
@ -30,7 +33,7 @@ const delegatedProps = computed(() => {
<RadioGroupIndicator
class="flex items-center justify-center"
>
<Circle class="w-2.5 h-2.5 text-foreground" />
<Circle class="h-2.5 w-2.5 fill-current text-current" />
</RadioGroupIndicator>
</RadioGroupItem>
</template>

View File

@ -6,8 +6,9 @@ import {
type SelectContentProps,
SelectPortal,
SelectViewport,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { SelectScrollDownButton, SelectScrollUpButton } from '.'
import { cn } from '@/lib/utils'
defineOptions({
@ -27,26 +28,26 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<SelectPortal>
<SelectContent
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits), ...$attrs }" :class="cn(
'relative z-50 min-w-[10rem] overflow-hidden rounded-md bg-background border border-border text-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
v-bind="{ ...forwarded, ...$attrs }" :class="cn(
'relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2',
position === 'popper'
&& 'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1',
props.class,
)
"
>
<SelectViewport
:class="cn('p-1',
position === 'popper'
&& 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]')"
>
<SelectScrollUpButton />
<SelectViewport :class="cn('p-1', position === 'popper' && 'h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]')">
<slot />
</SelectViewport>
<SelectScrollDownButton />
</SelectContent>
</SelectPortal>
</template>

View File

@ -5,6 +5,7 @@ import {
SelectItemIndicator,
type SelectItemProps,
SelectItemText,
useForwardProps,
} from 'radix-vue'
import { Check } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
@ -16,11 +17,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<SelectItem
v-bind="delegatedProps"
v-bind="forwardedProps"
:class="
cn(
'relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50',

View File

@ -0,0 +1,24 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { SelectScrollDownButton, type SelectScrollDownButtonProps, useForwardProps } from 'radix-vue'
import { ChevronDown } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
const props = defineProps<SelectScrollDownButtonProps & { class?: HTMLAttributes['class'] }>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<SelectScrollDownButton v-bind="forwardedProps" :class="cn('flex cursor-default items-center justify-center py-1', props.class)">
<slot>
<ChevronDown class="h-4 w-4" />
</slot>
</SelectScrollDownButton>
</template>

View File

@ -0,0 +1,24 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { SelectScrollUpButton, type SelectScrollUpButtonProps, useForwardProps } from 'radix-vue'
import { ChevronUp } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
const props = defineProps<SelectScrollUpButtonProps & { class?: HTMLAttributes['class'] }>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<SelectScrollUpButton v-bind="forwardedProps" :class="cn('flex cursor-default items-center justify-center py-1', props.class)">
<slot>
<ChevronUp class="h-4 w-4" />
</slot>
</SelectScrollUpButton>
</template>

View File

@ -1,36 +1,27 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { SelectIcon, SelectTrigger, type SelectTriggerProps } from 'radix-vue'
import { SelectIcon, SelectTrigger, type SelectTriggerProps, useForwardProps } from 'radix-vue'
import { ChevronDown } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
const props = withDefaults(
defineProps<SelectTriggerProps & { class?: HTMLAttributes['class']; invalid?: boolean }>(),
{
class: '',
invalid: false,
},
)
const props = defineProps<SelectTriggerProps & { class?: HTMLAttributes['class'] }>()
const delegatedProps = computed(() => {
const { class: _, invalid, ...delegated } = props
const { class: _, ...delegated } = props
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<SelectTrigger
v-bind="delegatedProps"
:class="[
cn(
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50',
v-bind="forwardedProps"
:class="cn(
'flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1',
props.class,
),
props.invalid
? '!ring-destructive ring-2 placeholder:!text-destructive'
: '',
]"
)"
>
<slot />
<SelectIcon as-child>

View File

@ -7,3 +7,5 @@ export { default as SelectItem } from './SelectItem.vue'
export { default as SelectItemText } from './SelectItemText.vue'
export { default as SelectLabel } from './SelectLabel.vue'
export { default as SelectSeparator } from './SelectSeparator.vue'
export { default as SelectScrollUpButton } from './SelectScrollUpButton.vue'
export { default as SelectScrollDownButton } from './SelectScrollDownButton.vue'

View File

@ -1,13 +1,20 @@
<script setup lang="ts">
import type { HTMLAttributes } from 'vue'
import { type HTMLAttributes, computed } from 'vue'
import { Separator, type SeparatorProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>()
const delegatedProps = computed(() => {
const { class: _, ...delegated } = props
return delegated
})
</script>
<template>
<Separator
v-bind="delegatedProps"
:class="[
cn('shrink-0 bg-secondary', props.class),
props.orientation === 'vertical' ? 'w-px h-full' : 'h-px w-full',

View File

@ -7,59 +7,47 @@ import {
type DialogContentProps,
DialogOverlay,
DialogPortal,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { X } from 'lucide-vue-next'
import { cva } from 'class-variance-authority'
import { type SheetVariants, sheetVariants } from '.'
import { cn } from '@/lib/utils'
interface SheetContentProps extends DialogContentProps {
side?: 'left' | 'right' | 'top' | 'bottom'
class?: HTMLAttributes['class']
side?: SheetVariants['side']
}
const props = defineProps<SheetContentProps>()
const emits = defineEmits<DialogContentEmits>()
defineOptions({
inheritAttrs: false,
})
const sheetVariants = cva(
'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
{
variants: {
side: {
top: 'inset-x-0 top-0 border-b border-border data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
bottom:
'inset-x-0 bottom-0 border-t border-border data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
left: 'inset-y-0 left-0 h-full w-3/4 border-r border-border data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
right:
'inset-y-0 right-0 h-full w-3/4 border-l border-border data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
},
},
defaultVariants: {
side: 'right',
},
},
)
const props = defineProps<SheetContentProps>()
const emits = defineEmits<DialogContentEmits>()
const delegatedProps = computed(() => {
const { class: _, side, ...delegated } = props
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<DialogPortal>
<DialogOverlay
class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
class="fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
/>
<DialogContent
:class="cn(sheetVariants({ side }), props.class)"
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="{ ...forwarded, ...$attrs }"
>
<slot />
<DialogClose
class="absolute top-4 right-4 p-0.5 transition-colors rounded-md hover:bg-secondary"
class="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"
>
<X class="w-4 h-4 text-muted-foreground" />
</DialogClose>

View File

@ -9,7 +9,7 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>()
<div
:class="
cn(
'flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2',
'flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-x-2',
props.class,
)
"

View File

@ -8,7 +8,7 @@ const props = defineProps<{ class?: HTMLAttributes['class'] }>()
<template>
<div
:class="
cn('flex flex-col space-y-2 text-center sm:text-left', props.class)
cn('flex flex-col gap-y-2 text-center sm:text-left', props.class)
"
>
<slot />

View File

@ -1,3 +1,5 @@
import { type VariantProps, cva } from 'class-variance-authority'
export { default as Sheet } from './Sheet.vue'
export { default as SheetTrigger } from './SheetTrigger.vue'
export { default as SheetClose } from './SheetClose.vue'
@ -6,3 +8,24 @@ export { default as SheetHeader } from './SheetHeader.vue'
export { default as SheetTitle } from './SheetTitle.vue'
export { default as SheetDescription } from './SheetDescription.vue'
export { default as SheetFooter } from './SheetFooter.vue'
export const sheetVariants = cva(
'fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500',
{
variants: {
side: {
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
bottom:
'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
left: 'inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
right:
'inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
},
},
defaultVariants: {
side: 'right',
},
},
)
export type SheetVariants = VariantProps<typeof sheetVariants>

View File

@ -10,5 +10,5 @@ const props = defineProps<SkeletonProps>()
</script>
<template>
<div :class="cn('animate-pulse rounded-md bg-secondary', props.class)" />
<div :class="cn('animate-pulse rounded-md bg-muted', props.class)" />
</template>

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import type { SliderRootEmits, SliderRootProps } from 'radix-vue'
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useEmitAsProps } from 'radix-vue'
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<SliderRootProps & { class?: HTMLAttributes['class'] }>()
@ -12,6 +12,8 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
@ -20,7 +22,7 @@ const delegatedProps = computed(() => {
'relative flex w-full touch-none select-none items-center',
props.class,
)"
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
>
<SliderTrack class="relative h-2 w-full grow overflow-hidden rounded-full bg-secondary">
<SliderRange class="absolute h-full bg-primary" />

View File

@ -5,11 +5,12 @@ import {
type SwitchRootEmits,
type SwitchRootProps,
SwitchThumb,
useEmitAsProps,
useForwardPropsEmits,
} from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<SwitchRootProps & { class?: HTMLAttributes['class'] }>()
const emits = defineEmits<SwitchRootEmits>()
const delegatedProps = computed(() => {
@ -17,27 +18,20 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<SwitchRoot
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
:class="
cn(
'peer inline-flex h-[24px] w-[44px] shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
v-bind="forwarded"
:class="cn(
'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',
props.class,
)
"
)"
>
<SwitchThumb
:class="
cn(
'pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',
)
"
:class="cn('pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0')"
/>
</SwitchRoot>
</template>

View File

@ -8,7 +8,7 @@ const props = defineProps<{
</script>
<template>
<div class="w-full overflow-auto">
<div class="relative w-full overflow-auto">
<table :class="cn('w-full caption-bottom text-sm', props.class)">
<slot />
</table>

View File

@ -8,7 +8,7 @@ const props = defineProps<{
</script>
<template>
<tfoot :class="cn('bg-primary font-medium text-primary-foreground', props.class)">
<tfoot :class="cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', props.class)">
<slot />
</tfoot>
</template>

View File

@ -15,12 +15,10 @@ const delegatedProps = computed(() => {
<template>
<TabsList
v-bind="delegatedProps"
:class="
cn(
:class="cn(
'inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground',
props.class,
)
"
)"
>
<slot />
</TabsList>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { TabsTrigger, type TabsTriggerProps } from 'radix-vue'
import { TabsTrigger, type TabsTriggerProps, useForwardProps } from 'radix-vue'
import { cn } from '@/lib/utils'
const props = defineProps<TabsTriggerProps & { class?: HTMLAttributes['class'] }>()
@ -10,17 +10,17 @@ const delegatedProps = computed(() => {
return delegated
})
const forwardedProps = useForwardProps(delegatedProps.value)
</script>
<template>
<TabsTrigger
v-bind="delegatedProps"
:class="
cn(
v-bind="forwardedProps"
:class="cn(
'inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm',
props.class,
)
"
)"
>
<slot />
</TabsTrigger>

View File

@ -1,24 +1,11 @@
<script lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import type { ToastRootEmits, ToastRootProps } from 'radix-vue'
import type { VariantProps } from 'class-variance-authority'
interface ToastVariantProps extends VariantProps<typeof toastVariants> {}
export interface ToastProps extends ToastRootProps {
class?: HTMLAttributes['class']
variant?: ToastVariantProps['variant']
'onOpenChange'?: ((value: boolean) => void) | undefined
};
</script>
<script setup lang="ts">
import { ToastRoot, useEmitAsProps } from 'radix-vue'
import { toastVariants } from '.'
import { computed } from 'vue'
import { ToastRoot, type ToastRootEmits, useForwardPropsEmits } from 'radix-vue'
import { type ToastProps, toastVariants } from '.'
import { cn } from '@/lib/utils'
const props = defineProps<ToastProps>()
const emits = defineEmits<ToastRootEmits>()
const delegatedProps = computed(() => {
@ -26,11 +13,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<ToastRoot
v-bind="{ ...delegatedProps, ...useEmitAsProps(emits) }"
v-bind="forwarded"
:class="cn(toastVariants({ variant }), props.class)"
@update:open="onOpenChange"
>

View File

@ -1,7 +1,7 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { ToastClose, type ToastCloseProps } from 'radix-vue'
import { XIcon } from 'lucide-vue-next'
import { X } from 'lucide-vue-next'
import { cn } from '@/lib/utils'
const props = defineProps<ToastCloseProps & {
@ -17,6 +17,6 @@ const delegatedProps = computed(() => {
<template>
<ToastClose v-bind="delegatedProps" :class="cn('absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600', props.class)">
<XIcon class="h-4 w-4" />
<X class="h-4 w-4" />
</ToastClose>
</template>

View File

@ -1,3 +1,6 @@
import type { ToastRootProps } from 'radix-vue'
import type { HTMLAttributes } from 'vue'
export { default as Toaster } from './Toaster.vue'
export { default as Toast } from './Toast.vue'
export { default as ToastViewport } from './ToastViewport.vue'
@ -8,7 +11,7 @@ export { default as ToastDescription } from './ToastDescription.vue'
export { default as ToastProvider } from './ToastProvider.vue'
export { toast, useToast } from './use-toast'
import { cva } from 'class-variance-authority'
import { type VariantProps, cva } from 'class-variance-authority'
export const toastVariants = cva(
'group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full',
@ -25,3 +28,11 @@ export const toastVariants = cva(
},
},
)
type ToastVariants = VariantProps<typeof toastVariants>
export interface ToastProps extends ToastRootProps {
class?: HTMLAttributes['class']
variant?: ToastVariants['variant']
'onOpenChange'?: ((value: boolean) => void) | undefined
}

View File

@ -1,6 +1,6 @@
import { computed, ref } from 'vue'
import type { Component, VNode } from 'vue'
import type { ToastProps } from './Toast.vue'
import type { ToastProps } from '.'
const TOAST_LIMIT = 1
const TOAST_REMOVE_DELAY = 1000000

View File

@ -1,25 +1,19 @@
<script setup lang="ts">
import type { ToggleEmits, ToggleProps } from 'radix-vue'
import { Toggle, useEmitAsProps } from 'radix-vue'
import type { VariantProps } from 'class-variance-authority'
import { type HTMLAttributes, computed } from 'vue'
import { toggleVariants } from '.'
import { Toggle, type ToggleEmits, type ToggleProps, useForwardPropsEmits } from 'radix-vue'
import { type ToggleVariants, toggleVariants } from '.'
import { cn } from '@/lib/utils'
interface ToggleVariantProps extends VariantProps<typeof toggleVariants> {}
interface Props extends ToggleProps {
const props = withDefaults(defineProps<ToggleProps & {
class?: HTMLAttributes['class']
variant?: ToggleVariantProps['variant']
size?: ToggleVariantProps['size']
disabled?: boolean
}
const props = withDefaults(defineProps<Props>(), {
variant?: ToggleVariants['variant']
size?: ToggleVariants['size']
}>(), {
variant: 'default',
size: 'default',
disabled: false,
})
const emits = defineEmits<ToggleEmits>()
const delegatedProps = computed(() => {
@ -27,14 +21,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<Toggle
v-bind="{
...delegatedProps,
...useEmitAsProps(emits),
}"
v-bind="forwarded"
:class="cn(toggleVariants({ variant, size }), props.class)"
>
<slot />

View File

@ -1,4 +1,4 @@
import { cva } from 'class-variance-authority'
import { type VariantProps, cva } from 'class-variance-authority'
export { default as Toggle } from './Toggle.vue'
@ -23,3 +23,5 @@ export const toggleVariants = cva(
},
},
)
export type ToggleVariants = VariantProps<typeof toggleVariants>

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { type HTMLAttributes, computed } from 'vue'
import { TooltipContent, type TooltipContentEmits, type TooltipContentProps, TooltipPortal, useEmitAsProps } from 'radix-vue'
import { TooltipContent, type TooltipContentEmits, type TooltipContentProps, TooltipPortal, useForwardPropsEmits } from 'radix-vue'
import { cn } from '@/lib/utils'
defineOptions({
@ -18,11 +18,13 @@ const delegatedProps = computed(() => {
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps.value, emits)
</script>
<template>
<TooltipPortal>
<TooltipContent v-bind="{ ...delegatedProps, ...useEmitAsProps(emits), ...$attrs }" :class="cn('z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', props.class)">
<TooltipContent v-bind="{ ...forwarded, ...$attrs }" :class="cn('z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', props.class)">
<slot />
</TooltipContent>
</TooltipPortal>