Skip to content

Commit 82f29ac

Browse files
fix: [HoverCardRoot] remove PopoverRoot
1 parent cf49faa commit 82f29ac

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

packages/vue-primitives/src/hover-card/HoverCardRoot.vue

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
2-
import { onBeforeUnmount } from 'vue'
2+
import { onBeforeUnmount, shallowRef } from 'vue'
33
import { useControllableState, useRef } from '../hooks/index.ts'
4-
import { PopoverRoot } from '../popover/index.ts'
4+
import { type Measurable, providePopperContext } from '../popper/PopperRoot.ts'
55
import { type HoverCardRootEmits, type HoverCardRootProps, provideHoverCardContext } from './HoverCardRoot.ts'
66
77
defineOptions({
@@ -24,6 +24,7 @@ let closeTimerRef = 0
2424
const hasSelectionRef = useRef(false)
2525
const isPointerDownOnContentRef = useRef(false)
2626
27+
// cleanup any queued state updates on unmount
2728
onBeforeUnmount(() => {
2829
clearTimeout(openTimerRef)
2930
clearTimeout(closeTimerRef)
@@ -56,10 +57,20 @@ provideHoverCardContext({
5657
hasSelectionRef,
5758
isPointerDownOnContentRef,
5859
})
60+
61+
// COMP::PopperRoot
62+
63+
const anchor = shallowRef<Measurable>()
64+
65+
providePopperContext({
66+
content: shallowRef(),
67+
anchor,
68+
onAnchorChange(newAnchor) {
69+
anchor.value = newAnchor
70+
},
71+
})
5972
</script>
6073

6174
<template>
62-
<PopoverRoot>
63-
<slot />
64-
</PopoverRoot>
75+
<slot />
6576
</template>

0 commit comments

Comments
 (0)