Dev cleaning (#106)

This commit is contained in:
Munawwirul Jamal
2025-10-08 00:03:36 +07:00
committed by GitHub
parent 7fdd5c61f0
commit 3eb9dde21d
892 changed files with 51326 additions and 1 deletions
+39
View File
@@ -0,0 +1,39 @@
<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>
+28
View File
@@ -0,0 +1,28 @@
import type { VariantProps } from 'class-variance-authority'
import { cva } from 'class-variance-authority'
export { default as Toggle } from './Toggle.vue'
export const toggleVariants = cva(
'inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground',
{
variants: {
variant: {
default: 'bg-transparent',
outline:
'border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground',
},
size: {
default: 'h-9 px-3',
sm: 'h-8 px-2',
lg: 'h-10 px-3',
},
},
defaultVariants: {
variant: 'default',
size: 'default',
},
},
)
export type ToggleVariants = VariantProps<typeof toggleVariants>