Line data Source code
1 : <template>
2 52 : <PopoverRoot>
3 : <PopoverTrigger as-child>
4 : <slot />
5 : </PopoverTrigger>
6 : <PopoverContent
7 : align="end"
8 : :side-offset="18"
9 : data-testid="builder-connect-output-popover"
10 : class="w-80 rounded-xl p-0"
11 : >
12 : <div class="flex h-12 items-center justify-between px-4">
13 : <h3 class="text-sm font-medium">
14 : {{ t('builderToolbar.connectOutput') }}
15 : </h3>
16 : <PopoverClose
17 : :aria-label="t('g.close')"
18 : class="flex cursor-pointer appearance-none items-center justify-center border-none bg-transparent p-0 text-muted-foreground hover:text-foreground"
19 : >
20 : <i class="icon-[lucide--x]" />
21 : </PopoverClose>
22 : </div>
23 : <div class="border-t" />
24 : <p class="mt-3 px-4 text-xs/relaxed text-muted-foreground">
25 : {{ t('builderToolbar.connectOutputBody1') }}
26 : </p>
27 : <p
28 : v-if="!isSelectActive"
29 : class="mt-2 px-4 text-xs/relaxed text-muted-foreground"
30 : >
31 : {{ t('builderToolbar.connectOutputBody2') }}
32 : </p>
33 : <div class="mt-4 flex items-center justify-end gap-2 px-4 pb-4">
34 : <template v-if="isSelectActive">
35 : <PopoverClose as-child>
36 : <Button variant="secondary" size="md">
37 : {{ t('g.ok') }}
38 : </Button>
39 : </PopoverClose>
40 : </template>
41 : <template v-else>
42 : <PopoverClose as-child>
43 : <Button variant="muted-textonly" size="md">
44 : {{ t('g.cancel') }}
45 : </Button>
46 : </PopoverClose>
47 : <PopoverClose as-child>
48 : <Button
49 : variant="secondary"
50 : size="md"
51 : data-testid="builder-connect-output-switch"
52 : @click="emit('switch')"
53 : >
54 : {{ t('builderToolbar.switchToOutputs') }}
55 : </Button>
56 : </PopoverClose>
57 : </template>
58 : </div>
59 : </PopoverContent>
60 : </PopoverRoot>
61 : </template>
62 :
63 : <script setup lang="ts">
64 : import { PopoverClose, PopoverRoot, PopoverTrigger } from 'reka-ui'
65 : import { useI18n } from 'vue-i18n'
66 :
67 : import Button from '@comfyorg/design-system/button/Button'
68 : import PopoverContent from '@comfyorg/design-system/popover/PopoverContent'
69 :
70 : const { isSelectActive = false } = defineProps<{
71 : isSelectActive?: boolean
72 : }>()
73 :
74 48 : const { t } = useI18n()
75 :
76 48 : const emit = defineEmits<{
77 : switch: []
78 : }>()
79 : </script>
|