Line data Source code
1 : <template>
2 144 : <section :class="cn('group flex min-w-0 flex-col py-2', className)">
3 : <div class="flex min-h-8 w-full items-center gap-2 px-3">
4 : <button
5 : type="button"
6 : class="flex min-w-0 flex-1 cursor-pointer items-center gap-2 rounded-sm border-0 bg-transparent p-0 text-left outline-none focus-visible:ring-1 focus-visible:ring-ring"
7 : :aria-expanded="!collapse"
8 : :aria-controls="bodyId"
9 : @click="collapse = !collapse"
10 : >
11 : <span
12 : data-testid="error-section-count-badge"
13 : :data-severity="severity"
14 : :class="
15 : cn(
16 : 'flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full px-1 text-2xs/none font-semibold tabular-nums',
17 : severity === 'error'
18 : ? 'bg-destructive/90 text-white'
19 : : 'bg-warning text-warning-foreground'
20 : )
21 : "
22 : >
23 : {{ count }}
24 : </span>
25 : <span class="min-w-0 truncate text-sm">
26 : {{ title }}
27 : </span>
28 : <slot name="title-badge" />
29 : </button>
30 : <slot name="actions" />
31 : <button
32 : type="button"
33 : class="flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-sm border-0 bg-transparent p-0 outline-none focus-visible:ring-1 focus-visible:ring-ring"
34 : :aria-expanded="!collapse"
35 : :aria-controls="bodyId"
36 : :aria-label="
37 : collapse ? t('rightSidePanel.expand') : t('rightSidePanel.collapse')
38 : "
39 : @click="collapse = !collapse"
40 : >
41 : <i
42 : aria-hidden="true"
43 : :class="
44 : cn(
45 : 'icon-[lucide--chevron-up] text-muted-foreground transition-transform group-hover:text-foreground',
46 : collapse && '-rotate-180'
47 : )
48 : "
49 : />
50 : </button>
51 : </div>
52 : <TransitionCollapse>
53 : <div v-if="!collapse" :id="bodyId">
54 : <slot />
55 : </div>
56 : </TransitionCollapse>
57 : </section>
58 : </template>
59 :
60 : <script setup lang="ts">
61 : import { useId } from 'vue'
62 : import { useI18n } from 'vue-i18n'
63 : import { cn } from '@comfyorg/tailwind-utils'
64 :
65 : import TransitionCollapse from '@comfyorg/design-system/transition/TransitionCollapse'
66 : import type { ErrorGroupSeverity } from '@/platform/workflowErrors/panel/types'
67 :
68 : const {
69 : title,
70 : count,
71 : severity,
72 : class: className
73 : } = defineProps<{
74 : title: string
75 : count: number
76 : severity: ErrorGroupSeverity
77 : class?: string
78 : }>()
79 :
80 90 : const collapse = defineModel<boolean>('collapse', { default: false })
81 :
82 90 : const bodyId = useId()
83 90 : const { t } = useI18n()
84 : </script>
|