mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-25 09:14:25 +00:00
47 lines
1.2 KiB
Vue
47 lines
1.2 KiB
Vue
<script setup lang="ts">
|
|
/* eslint-disable vue/no-unused-properties */
|
|
import { reactiveOmit } from '@vueuse/core'
|
|
import type { VariantProps } from 'cva'
|
|
import type { ToggleGroupItemProps } from 'reka-ui'
|
|
import { ToggleGroupItem, useForwardProps } from 'reka-ui'
|
|
import type { HTMLAttributes } from 'vue'
|
|
import { inject } from 'vue'
|
|
|
|
import { toggleVariants } from '@/components/ui/toggle'
|
|
import { cn } from '@/utils/tailwindUtil'
|
|
|
|
type ToggleGroupVariants = VariantProps<typeof toggleVariants>
|
|
|
|
const props = defineProps<
|
|
ToggleGroupItemProps & {
|
|
class?: HTMLAttributes['class']
|
|
variant?: ToggleGroupVariants['variant']
|
|
size?: ToggleGroupVariants['size']
|
|
}
|
|
>()
|
|
|
|
const context = inject<ToggleGroupVariants>('toggleGroup')
|
|
|
|
const delegatedProps = reactiveOmit(props, 'class', 'size', 'variant')
|
|
|
|
const forwardedProps = useForwardProps(delegatedProps)
|
|
</script>
|
|
|
|
<template>
|
|
<ToggleGroupItem
|
|
v-slot="slotProps"
|
|
v-bind="forwardedProps"
|
|
:class="
|
|
cn(
|
|
toggleVariants({
|
|
variant: context?.variant || variant,
|
|
size: context?.size || size
|
|
}),
|
|
props.class
|
|
)
|
|
"
|
|
>
|
|
<slot v-bind="slotProps" />
|
|
</ToggleGroupItem>
|
|
</template>
|