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