Line data Source code
1 : <script setup lang="ts">
2 : import { cn } from '@comfyorg/tailwind-utils'
3 :
4 : const { visible, announcement = '' } = defineProps<{
5 : visible: boolean
6 : announcement?: string
7 : }>()
8 :
9 7065 : const isExpanded = defineModel<boolean>('expanded', { default: false })
10 :
11 6 : function toggle() {
12 6 : isExpanded.value = !isExpanded.value
13 : }
14 7065 : </script>
15 :
16 : <template>
17 : <div role="status" aria-atomic="true" class="sr-only">
18 : <template v-if="visible">{{ announcement }}</template>
19 : </div>
20 : <Transition
21 : enter-active-class="transition-all duration-300 ease-out"
22 : enter-from-class="translate-y-full opacity-0"
23 : leave-active-class="transition-all duration-200 ease-in"
24 : leave-to-class="translate-y-full opacity-0"
25 : >
26 : <div
27 : v-if="visible"
28 : data-testid="toast-panel"
29 : :class="
30 : cn(
31 : 'w-full max-w-3xl overflow-hidden rounded-lg border bg-background shadow-lg transition-all duration-300',
32 : isExpanded ? 'sm:w-[max(400px,40vw)]' : 'sm:w-fit'
33 : )
34 : "
35 : >
36 : <div
37 : :class="
38 : cn(
39 : 'max-w-full min-w-0 overflow-hidden transition-all duration-300',
40 : isExpanded ? 'max-h-100 w-full' : 'max-h-0 w-0'
41 : )
42 : "
43 : >
44 : <slot />
45 : </div>
46 :
47 : <slot name="footer" :toggle />
48 : </div>
49 : </Transition>
50 : </template>
|