forked from BRETT/BRETT
45 lines
1.4 KiB
Vue
45 lines
1.4 KiB
Vue
<script setup lang="ts">
|
|
import type { HoverCardContentProps } from 'reka-ui'
|
|
import type { HTMLAttributes } from 'vue'
|
|
import { reactiveOmit } from '@vueuse/core'
|
|
import {
|
|
HoverCardContent,
|
|
HoverCardPortal,
|
|
useForwardProps,
|
|
} from 'reka-ui'
|
|
import { cn } from '@/lib/utils'
|
|
|
|
defineOptions({
|
|
inheritAttrs: false,
|
|
})
|
|
|
|
const props = withDefaults(
|
|
defineProps<HoverCardContentProps & { class?: HTMLAttributes['class'] }>(),
|
|
{
|
|
align: 'center',
|
|
sideOffset: 4,
|
|
},
|
|
)
|
|
|
|
const delegatedProps = reactiveOmit(props, 'class')
|
|
|
|
const forwardedProps = useForwardProps(delegatedProps)
|
|
</script>
|
|
|
|
<template>
|
|
<HoverCardPortal>
|
|
<HoverCardContent
|
|
data-slot="hover-card-content"
|
|
v-bind="{ ...$attrs, ...forwardedProps }"
|
|
:class="
|
|
cn(
|
|
'data-open:animate-in data-closed:animate-out data-closed:fade-out-0 data-open:fade-in-0 data-closed:zoom-out-95 data-open:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 ring-foreground/5 dark:ring-foreground/10 bg-popover text-popover-foreground w-72 rounded-3xl p-4 text-sm shadow-lg ring-1 duration-100 z-50 origin-(--reka-hover-card-content-transform-origin) outline-hidden',
|
|
props.class,
|
|
)
|
|
"
|
|
>
|
|
<slot />
|
|
</HoverCardContent>
|
|
</HoverCardPortal>
|
|
</template>
|