Line data Source code
1 16 : <template>
2 : <div class="flex flex-col gap-1">
3 : <Button
4 : class="w-full border-0 bg-input p-2 text-foreground"
5 : :aria-label="widget.label"
6 : size="sm"
7 : variant="textonly"
8 : v-bind="filteredProps"
9 : @click="handleClick"
10 : >
11 : {{ widget.label ?? widget.name }}
12 : <i v-if="widget.options?.iconClass" :class="widget.options.iconClass" />
13 : </Button>
14 : </div>
15 : </template>
16 :
17 : <script setup lang="ts">
18 : import { computed } from 'vue'
19 :
20 : import Button from '@comfyorg/design-system/button/Button'
21 : import type { SimplifiedWidget } from '@/types/simplifiedWidget'
22 : import {
23 : BADGE_EXCLUDED_PROPS,
24 : filterWidgetProps
25 : } from '@/utils/widgetPropFilter'
26 :
27 : // Button widgets don't have a v-model value, they trigger actions
28 132 : const props = defineProps<{
29 : widget: SimplifiedWidget<undefined>
30 : }>()
31 :
32 : // Button specific excluded props
33 132 : const BUTTON_EXCLUDED_PROPS = [...BADGE_EXCLUDED_PROPS, 'iconClass'] as const
34 :
35 132 : const filteredProps = computed(() =>
36 : filterWidgetProps(props.widget.options, BUTTON_EXCLUDED_PROPS)
37 : )
38 :
39 132 : const handleClick = () => {
40 39 : props.widget.callback?.(undefined)
41 : }
42 : </script>
|