Files
simrsx-fe/app/components/pub/ui/toggle/Toggle.vue
Khafid Prayoga ae0acf84d0 refactor(ui): update import paths from @/lib/utils to ~/lib/utils
Standardize import paths across UI components to use ~/lib/utils alias instead of @/lib/utils for better consistency and maintainability.
2025-08-22 11:18:06 +07:00

40 lines
940 B
Vue

<script setup lang="ts">
import type { ToggleEmits, ToggleProps } from 'radix-vue'
import type { HTMLAttributes } from 'vue'
import type { ToggleVariants } from '.'
import { Toggle, useForwardPropsEmits } from 'radix-vue'
import { computed } from 'vue'
import { cn } from '~/lib/utils'
import { toggleVariants } from '.'
const props = withDefaults(defineProps<ToggleProps & {
class?: HTMLAttributes['class']
variant?: ToggleVariants['variant']
size?: ToggleVariants['size']
}>(), {
variant: 'default',
size: 'default',
disabled: false,
})
const emits = defineEmits<ToggleEmits>()
const delegatedProps = computed(() => {
const { class: _, size, variant, ...delegated } = props
return delegated
})
const forwarded = useForwardPropsEmits(delegatedProps, emits)
</script>
<template>
<Toggle
v-bind="forwarded"
:class="cn(toggleVariants({ variant, size }), props.class)"
>
<slot />
</Toggle>
</template>