Line data Source code
1 16 : <script setup lang="ts">
2 : import {
3 : HoverCardContent,
4 : injectHoverCardRootContext,
5 : useForwardProps,
6 : HoverCardPortal
7 : } from 'reka-ui'
8 : import type { HoverCardContentProps } from 'reka-ui'
9 : import { computed } from 'vue'
10 : import type { HTMLAttributes } from 'vue'
11 :
12 : import { cn } from '@comfyorg/tailwind-utils'
13 :
14 2355 : const {
15 : class: className,
16 : side = 'bottom',
17 : sideOffset = 8,
18 : ...rest
19 : } = defineProps<HoverCardContentProps & { class?: HTMLAttributes['class'] }>()
20 :
21 6 : const forwarded = useForwardProps(computed(() => rest))
22 :
23 6 : const { open } = injectHoverCardRootContext()
24 6 : </script>
25 :
26 : <template>
27 10 : <HoverCardPortal :key="Number(rest.forceMount || open)">
28 : <HoverCardContent
29 : v-bind="forwarded"
30 : :side
31 : :side-offset
32 : :class="
33 : cn(
34 : 'z-overlay rounded-lg border border-border/50 bg-secondary p-2.5 shadow-md outline-none',
35 : className
36 : )
37 : "
38 : >
39 : <slot />
40 : </HoverCardContent>
41 : </HoverCardPortal>
42 : </template>
|