@destyler/popover 0.0.1-beta.5 → 0.0.1-beta.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,1142 +1,372 @@
1
- import { defineComponent, provide, getCurrentInstance, inject, ref, onBeforeUnmount, withDirectives, toRef, computed, h, Teleport, onMounted, watch, Fragment, watchEffect, vShow, mergeProps, cloneVNode } from 'vue';
2
- import { off, getSlot, on, beforeNextFrameOnce, getFirstVNode, createId, resolveTo, getPreciseEventTarget, isJsdom, isSlotEmpty, resolveWrappedSlot, getFirstSlotVNode, keep, call } from '@destyler/shared';
3
- import { zindexable, clickoutside, mousemoveoutside } from '@destyler/directives';
4
- import { useFalseUntilTruthy, useMemo, useIsMounted, useMergedState } from '@destyler/composition';
1
+ import { defineComponent, toRef, ref, h, onBeforeMount, onUnmounted, mergeProps, withDirectives, onMounted } from 'vue';
2
+ import { DestylerPopperRoot, destylerPopperArrowProps, DestylerPopperAnchor, DestylerPopperArrow, destylerPopperContentProps, DestylerPopperContent } from '@destyler/popper';
3
+ import { createContext } from '@destyler/shared';
4
+ import { useVModel, useId, useForwardProps, useFocusGuards, useForwardPropsEmits, useCustomElement, useHideOthers } from '@destyler/composition';
5
+ import { destylerPrimitiveProp, DestylerPrimitive } from '@destyler/primitive';
6
+ import { DestylerPresence } from '@destyler/presence';
7
+ import { destylerDismissableLayerProps, DestylerDismissableLayer } from '@destyler/dismissable-layer';
8
+ import { DestylerFocusScope } from '@destyler/focus-scope';
9
+ import { BindOnceDirective } from '@destyler/directives';
10
+ import { destylerTeleportProps, DestylerTeleport } from '@destyler/teleport';
5
11
 
6
- function getParentNode(node) {
7
- if (node.nodeType === 9)
8
- return null;
9
- return node.parentNode;
10
- }
11
- function getScrollParent(node) {
12
- if (node === null)
13
- return null;
14
- const parentNode = getParentNode(node);
15
- if (parentNode === null)
16
- return null;
17
- if (parentNode.nodeType === 9)
18
- return document;
19
- if (parentNode.nodeType === 1) {
20
- const { overflow, overflowX, overflowY } = getComputedStyle(
21
- parentNode
22
- );
23
- if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX))
24
- return parentNode;
25
- }
26
- return getScrollParent(parentNode);
27
- }
28
-
29
- const DestylerBinder = defineComponent({
30
- name: "DestylerBinder",
31
- props: {
32
- syncTargetWithParent: {
33
- type: Boolean
34
- },
35
- syncTarget: {
36
- type: Boolean,
37
- default: true
38
- }
12
+ const [injectPopoverRootContext, providePopoverRootContext] = createContext("DestylerPopoverRoot");
13
+ const destylerPopoverRootProps = {
14
+ defaultOpen: {
15
+ type: Boolean,
16
+ required: false,
17
+ default: false
39
18
  },
40
- setup(props) {
41
- provide("DestylerBinder", getCurrentInstance()?.proxy);
42
- const DestylerBinder2 = inject("DestylerBinder", null);
43
- const targetRef = ref(null);
44
- const followerResizeListeners = /* @__PURE__ */ new Set();
45
- const followerScrollListeners = /* @__PURE__ */ new Set();
46
- const onScrollRaf = () => {
47
- followerScrollListeners.forEach((listener) => listener());
48
- };
49
- const onScroll = () => {
50
- beforeNextFrameOnce(onScrollRaf);
51
- };
52
- const onResize = () => {
53
- followerResizeListeners.forEach((listener) => listener());
54
- };
55
- const setTargetRef = (el) => {
56
- targetRef.value = el;
57
- if (DestylerBinder2 && props.syncTargetWithParent)
58
- DestylerBinder2.setTargetRef(el);
59
- };
60
- let scrollableNodes = [];
61
- const ensureScrollListener = () => {
62
- let cursor = targetRef.value;
63
- while (true) {
64
- cursor = getScrollParent(cursor);
65
- if (cursor === null)
66
- break;
67
- scrollableNodes.push(cursor);
68
- }
69
- for (const el of scrollableNodes)
70
- on("scroll", el, onScroll, true);
71
- };
72
- const removeScrollListeners = () => {
73
- for (const el of scrollableNodes)
74
- off("scroll", el, onScroll, true);
75
- scrollableNodes = [];
76
- };
77
- const addScrollListener = (listener) => {
78
- if (followerScrollListeners.size === 0)
79
- ensureScrollListener();
80
- if (!followerScrollListeners.has(listener))
81
- followerScrollListeners.add(listener);
82
- };
83
- const removeScrollListener = (listener) => {
84
- if (followerScrollListeners.has(listener))
85
- followerScrollListeners.delete(listener);
86
- if (followerScrollListeners.size === 0)
87
- removeScrollListeners();
88
- };
89
- const addResizeListener = (listener) => {
90
- if (followerResizeListeners.size === 0)
91
- on("resize", window, onResize);
92
- if (!followerResizeListeners.has(listener))
93
- followerResizeListeners.add(listener);
94
- };
95
- const removeResizeListener = (listener) => {
96
- if (followerResizeListeners.has(listener))
97
- followerResizeListeners.delete(listener);
98
- if (followerResizeListeners.size === 0)
99
- off("resize", window, onResize);
100
- };
101
- onBeforeUnmount(() => {
102
- off("resize", window, onResize);
103
- removeScrollListeners();
19
+ open: {
20
+ type: Boolean,
21
+ required: false,
22
+ default: void 0
23
+ },
24
+ modal: {
25
+ type: Boolean,
26
+ required: false,
27
+ default: false
28
+ }
29
+ };
30
+ const DestylerPopoverRoot = defineComponent({
31
+ name: "DestylerPopoverRoot",
32
+ props: destylerPopoverRootProps,
33
+ emits: ["update:open"],
34
+ setup(props, { emit }) {
35
+ const modalRef = toRef(props.modal);
36
+ const openRef = useVModel(props, "open", emit, {
37
+ defaultValue: props.defaultOpen,
38
+ passive: props.open === void 0
39
+ });
40
+ const triggerElement = ref();
41
+ const hasCustomAnchor = ref(false);
42
+ function handleUpdateOpen(value) {
43
+ openRef.value = value;
44
+ }
45
+ providePopoverRootContext({
46
+ contentId: useId(),
47
+ modal: modalRef,
48
+ open: openRef,
49
+ onOpenChange: (value) => {
50
+ handleUpdateOpen(value);
51
+ },
52
+ onOpenToggle: () => {
53
+ handleUpdateOpen(!openRef.value);
54
+ },
55
+ triggerElement,
56
+ hasCustomAnchor
104
57
  });
105
58
  return {
106
- targetRef,
107
- setTargetRef,
108
- addScrollListener,
109
- removeScrollListener,
110
- addResizeListener,
111
- removeResizeListener
59
+ openRef,
60
+ modalRef,
61
+ triggerElement,
62
+ hasCustomAnchor
112
63
  };
113
64
  },
114
65
  render() {
115
- return getSlot("binder", this.$slots);
66
+ return h(DestylerPopperRoot, this.$slots.default?.());
116
67
  }
117
68
  });
118
69
 
119
- const DestylerTarget = defineComponent({
120
- name: "DestylerTarget",
70
+ const destylerPopoverAnchorProps = {
71
+ ...destylerPopperArrowProps
72
+ };
73
+ const DestylerPopoverAnchor = defineComponent({
74
+ name: "DestylerPopoverAnchor",
75
+ props: destylerPopoverAnchorProps,
121
76
  setup() {
122
- const { setTargetRef, syncTarget } = inject("DestylerBinder");
123
- const setTargetDirective = {
124
- mounted(el) {
125
- setTargetRef(el);
126
- },
127
- updated(el) {
128
- setTargetRef(el);
129
- }
130
- };
77
+ const rootContext = injectPopoverRootContext();
78
+ onBeforeMount(() => {
79
+ rootContext.hasCustomAnchor.value = true;
80
+ });
81
+ onUnmounted(() => {
82
+ rootContext.hasCustomAnchor.value = false;
83
+ });
84
+ },
85
+ render() {
86
+ return h(DestylerPopperAnchor, mergeProps(this.$props, {}), this.$slots.default?.());
87
+ }
88
+ });
89
+
90
+ const destylerPopoverArrowProps = {
91
+ ...destylerPopperArrowProps
92
+ };
93
+ const DestylerPopoverArrow = defineComponent({
94
+ name: "DestylerPopoverArrow",
95
+ props: destylerPopoverArrowProps,
96
+ render() {
97
+ return h(DestylerPopperArrow, mergeProps(this.$props, {}), this.$slots.default?.());
98
+ }
99
+ });
100
+
101
+ const destylerPopoverCloseProps = {
102
+ ...destylerPrimitiveProp,
103
+ as: {
104
+ type: [String, Object],
105
+ required: false,
106
+ default: "button"
107
+ }
108
+ };
109
+ const DestylerPopoverClose = defineComponent({
110
+ name: "DestylerPopoverClose",
111
+ props: destylerPopoverCloseProps,
112
+ setup() {
113
+ const rootContext = injectPopoverRootContext();
131
114
  return {
132
- syncTarget,
133
- setTargetDirective
115
+ rootContext
134
116
  };
135
117
  },
136
118
  render() {
137
- const { syncTarget, setTargetDirective } = this;
138
- if (syncTarget) {
139
- return withDirectives(getFirstVNode("follower", this.$slots), [
140
- [setTargetDirective]
141
- ]);
142
- }
143
- return getFirstVNode("follower", this.$slots);
119
+ return h(DestylerPrimitive, {
120
+ as: this.$props.as,
121
+ asChild: this.$props.asChild,
122
+ type: this.$props.as === "button" ? "button" : void 0,
123
+ onClick: () => {
124
+ this.rootContext.onOpenChange(false);
125
+ }
126
+ }, this.$slots.default?.());
144
127
  }
145
128
  });
146
129
 
147
- const DestylerLazyTeleport = defineComponent({
148
- name: "DestylerLazyTeleport",
149
- props: {
150
- to: {
151
- type: [String, Object],
152
- default: "body"
153
- },
154
- disabled: {
155
- type: Boolean
156
- },
157
- show: {
158
- type: Boolean,
159
- required: true
160
- }
161
- },
130
+ const destylerPopoverContentImplProps = {
131
+ ...destylerPopperContentProps,
132
+ ...destylerDismissableLayerProps,
133
+ trapFocus: {
134
+ type: Boolean,
135
+ required: false,
136
+ default: false
137
+ }
138
+ };
139
+ const destylerPopoverContentImplEmits = ["escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "dismiss", "openAutoFocus", "closeAutoFocus"];
140
+ const DestylerPopoverContentImpl = defineComponent({
141
+ name: "DestylerPopoverContentImpl",
142
+ props: destylerPopoverContentImplProps,
143
+ emits: destylerPopoverContentImplEmits,
162
144
  setup(props) {
145
+ const forwarded = useForwardProps(props);
146
+ const rootContext = injectPopoverRootContext();
147
+ useFocusGuards();
163
148
  return {
164
- showTeleport: useFalseUntilTruthy(toRef(props, "show")),
165
- mergedTo: computed(() => {
166
- const { to } = props;
167
- return to ?? "body";
168
- })
149
+ rootContext,
150
+ forwarded
169
151
  };
170
152
  },
171
153
  render() {
172
- return this.showTeleport ? this.disabled ? getSlot("lazy-teleport", this.$slots) : h(
173
- Teleport,
174
- {
175
- disabled: this.disabled,
176
- to: this.mergedTo
154
+ return h(DestylerFocusScope, {
155
+ asChild: this.$props.asChild,
156
+ loop: true,
157
+ trapped: this.$props.trapFocus,
158
+ onMountAutoFocus: (event) => {
159
+ this.$emit("openAutoFocus", event);
160
+ },
161
+ onUnmountAutoFocus: (event) => {
162
+ this.$emit("closeAutoFocus", event);
163
+ }
164
+ }, h(DestylerDismissableLayer, {
165
+ asChild: this.$props.asChild,
166
+ disableOutsidePointerEvents: this.$props.disableOutsidePointerEvents,
167
+ onPointerDownOutside: (event) => {
168
+ this.$emit("pointerDownOutside", event);
169
+ },
170
+ onInteractOutside: (event) => {
171
+ this.$emit("interactOutside", event);
172
+ },
173
+ onEscapeKeyDown: (event) => {
174
+ this.$emit("escapeKeyDown", event);
175
+ },
176
+ onFocusOutside: (event) => {
177
+ this.$emit("focusOutside", event);
177
178
  },
178
- getSlot("lazy-teleport", this.$slots)
179
- ) : null;
179
+ onDismiss: () => {
180
+ this.rootContext.onOpenChange(false);
181
+ }
182
+ }, withDirectives(h(DestylerPopperContent, mergeProps(this.forwarded, {
183
+ "data-state": this.rootContext.open.value ? "open" : "closed",
184
+ "role": "dialog",
185
+ "style": {
186
+ "--destyler_popover_content_transform_origin": "var(--destyler_popper_transform_origin)",
187
+ "--destyler_popover_content_available_width": "var(--destyler_popper_available_width)",
188
+ "--destyler_popover_content_available_height": "var(--destyler_popper_available_height)",
189
+ "--destyler_popover_trigger_width": "var(--destyler_popper_anchor_width)",
190
+ "--destyler_popover_trigger_height": "var(--destyler_popper_anchor_height)"
191
+ }
192
+ }), this.$slots.default?.()), [
193
+ [BindOnceDirective, { id: this.rootContext.contentId }]
194
+ ])));
180
195
  }
181
196
  });
182
197
 
183
- const DestylerFollower = defineComponent({
184
- name: "DestylerFollower",
185
- inheritAttrs: true,
186
- props: {
187
- show: {
188
- type: Boolean,
189
- default: false
190
- },
191
- enabled: {
192
- type: Boolean,
193
- default: void 0
194
- },
195
- to: {
196
- type: [String, Object],
197
- default: "body"
198
- },
199
- flip: {
200
- type: Boolean,
201
- default: true
202
- },
203
- internalShift: {
204
- type: Boolean
205
- },
206
- x: {
207
- type: Number
208
- },
209
- y: {
210
- type: Number
211
- },
212
- width: {
213
- type: String
214
- },
215
- minWidth: {
216
- type: String
217
- },
218
- containerClass: {
219
- type: String
220
- },
221
- teleportDisabled: {
222
- type: Boolean
223
- },
224
- zindexable: {
225
- type: Boolean,
226
- default: true
227
- },
228
- zIndex: {
229
- type: Number
230
- },
231
- overlap: {
232
- type: Boolean
233
- }
234
- },
235
- setup(props) {
236
- const DestylerBinder = inject("DestylerBinder");
237
- const mergedEnabled = useMemo(() => {
238
- return props.enabled !== void 0 ? props.enabled : props.show;
239
- });
240
- const follower = ref(null);
241
- const offsetContainer = ref(null);
242
- const isMounted = useIsMounted();
243
- const mergedTo = useMemo(
244
- () => {
245
- const { to } = props;
246
- if (to !== void 0)
247
- return to;
248
- if (isMounted.value) {
249
- return void 0;
250
- }
251
- return void 0;
252
- }
253
- );
254
- function getElementBounding() {
255
- if (DestylerBinder.targetRef === null) {
256
- return {
257
- x: 0,
258
- y: 0,
259
- width: 0,
260
- height: 0
261
- };
262
- } else {
263
- const rect = DestylerBinder.targetRef.getBoundingClientRect();
264
- return {
265
- x: rect.x,
266
- y: rect.y,
267
- width: rect.width,
268
- height: rect.height
269
- };
270
- }
271
- }
198
+ const DestylerPopoverContentModal = defineComponent({
199
+ name: "DestylerPopoverContentModal",
200
+ props: destylerPopoverContentImplProps,
201
+ emits: destylerPopoverContentImplEmits,
202
+ setup(props, { emit }) {
203
+ const rootContext = injectPopoverRootContext();
204
+ const isRightClickOutsideRef = ref(false);
205
+ const forwarded = useForwardPropsEmits(props, emit);
206
+ const { customElement, currentElement } = useCustomElement();
207
+ useHideOthers(currentElement);
272
208
  return {
273
- mergedEnabled,
274
- follower,
275
- offsetContainer,
276
- mergedTo,
277
- getElementBounding
209
+ rootContext,
210
+ forwarded,
211
+ isRightClickOutsideRef,
212
+ customElement
278
213
  };
279
214
  },
280
215
  render() {
281
- return h(DestylerLazyTeleport, {
282
- to: this.mergedTo,
283
- disabled: this.$props.teleportDisabled,
284
- show: this.$props.show
285
- }, {
286
- default: () => {
287
- const vNode = h("div", {
288
- ref: "offsetContainer",
289
- destyler: "offset-container"
290
- }, [
291
- h("div", {
292
- ref: "follower",
293
- destyler: "follower",
294
- style: `
295
- --destyler-follower-x:${this.getElementBounding().x}px;
296
- --destyler-follower-y:${this.getElementBounding().y}px;
297
- --destyler-follower-width:${this.getElementBounding().width}px;
298
- --destyler-follower-height:${this.getElementBounding().height}px;
299
- `
300
- }, this.$slots.default?.())
301
- ]);
302
- if (this.$props.zindexable) {
303
- return withDirectives(vNode, [
304
- [
305
- zindexable,
306
- {
307
- enabled: this.mergedEnabled,
308
- zIndex: this.$props.zIndex
309
- }
310
- ]
311
- ]);
312
- }
313
- return vNode;
216
+ return h(DestylerPopoverContentImpl, {
217
+ "ref": "customElement",
218
+ ...mergeProps(this.forwarded),
219
+ "trapFocus": this.rootContext.open.value,
220
+ "disable-outside-pointer-events": "",
221
+ "onCloseAutoFocusPrevent": (event) => {
222
+ this.$emit("closeAutoFocus", event);
223
+ if (!this.isRightClickOutsideRef)
224
+ this.rootContext.triggerElement.value?.focus();
225
+ },
226
+ "onPointerDownOutside": (event) => {
227
+ this.$emit("pointerDownOutside", event);
228
+ const originalEvent = event.detail.originalEvent;
229
+ const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
230
+ const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
231
+ this.isRightClickOutsideRef = isRightClick;
314
232
  }
315
- });
233
+ }, this.$slots.default?.());
316
234
  }
317
235
  });
318
236
 
319
- function isHTMLElement(node) {
320
- return node instanceof HTMLElement;
321
- }
322
- function focusFirstDescendant(node) {
323
- for (let i = 0; i < node.childNodes.length; i++) {
324
- const child = node.childNodes[i];
325
- if (isHTMLElement(child)) {
326
- if (attemptFocus(child) || focusFirstDescendant(child))
327
- return true;
328
- }
329
- }
330
- return false;
331
- }
332
- function focusLastDescendant(element) {
333
- for (let i = element.childNodes.length - 1; i >= 0; i--) {
334
- const child = element.childNodes[i];
335
- if (isHTMLElement(child)) {
336
- if (attemptFocus(child) || focusLastDescendant(child))
337
- return true;
338
- }
339
- }
340
- return false;
341
- }
342
- function attemptFocus(element) {
343
- if (!isFocusable(element))
344
- return false;
345
- try {
346
- element.focus({ preventScroll: true });
347
- } catch (e) {
348
- }
349
- return document.activeElement === element;
350
- }
351
- function isFocusable(element) {
352
- if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null)
353
- return true;
354
- if (element.getAttribute("disabled"))
355
- return false;
356
- switch (element.nodeName) {
357
- case "A":
358
- return !!element.href && element.rel !== "ignore";
359
- case "INPUT":
360
- return element.type !== "hidden" && element.type !== "file";
361
- case "BUTTON":
362
- case "SELECT":
363
- case "TEXTAREA":
364
- return true;
365
- default:
366
- return false;
367
- }
368
- }
369
-
370
- let stack = [];
371
- const DestylerFocusTrap = defineComponent({
372
- name: "DestylerFocusTrap",
373
- props: {
374
- disabled: {
375
- type: Boolean
376
- },
377
- active: {
378
- type: Boolean
379
- },
380
- autoFocus: {
381
- type: Boolean,
382
- default: true
383
- },
384
- onEsc: {
385
- type: Function
386
- },
387
- initialFocusTo: {
388
- type: String
389
- },
390
- finalFocusTo: {
391
- type: String
392
- },
393
- returnFocusOnDeactivated: {
394
- type: Boolean,
395
- default: true
396
- }
397
- },
398
- setup(props) {
399
- const id = createId();
400
- const focusableStartRef = ref(null);
401
- const focusableEndRef = ref(null);
402
- let activated = false;
403
- let ignoreInternalFocusChange = false;
404
- const lastFocusedElement = typeof document === "undefined" ? null : document.activeElement;
405
- function isCurrentActive() {
406
- const currentActiveId = stack[stack.length - 1];
407
- return currentActiveId === id;
408
- }
409
- function handleDocumentKeydown(e) {
410
- if (e.code === "Escape") {
411
- if (isCurrentActive())
412
- props.onEsc?.(e);
413
- }
414
- }
415
- onMounted(() => {
416
- watch(
417
- () => props.active,
418
- (value) => {
419
- if (value) {
420
- activate();
421
- on("keydown", document, handleDocumentKeydown);
422
- } else {
423
- off("keydown", document, handleDocumentKeydown);
424
- if (activated)
425
- deactivate();
426
- }
427
- },
428
- {
429
- immediate: true
430
- }
431
- );
432
- });
433
- onBeforeUnmount(() => {
434
- off("keydown", document, handleDocumentKeydown);
435
- if (activated)
436
- deactivate();
437
- });
438
- function handleDocumentFocus(e) {
439
- if (ignoreInternalFocusChange)
440
- return;
441
- if (isCurrentActive()) {
442
- const mainEl = getMainEl();
443
- if (mainEl === null)
444
- return;
445
- if (mainEl.contains(getPreciseEventTarget(e)))
446
- return;
447
- resetFocusTo("first");
448
- }
449
- }
450
- function getMainEl() {
451
- const focusableStartEl = focusableStartRef.value;
452
- if (focusableStartEl === null)
453
- return null;
454
- let mainEl = focusableStartEl;
455
- while (true) {
456
- mainEl = mainEl.nextSibling;
457
- if (mainEl === null)
458
- break;
459
- if (mainEl instanceof Element && mainEl.tagName === "DIV")
460
- break;
461
- }
462
- return mainEl;
463
- }
464
- function activate() {
465
- if (props.disabled)
466
- return;
467
- stack.push(id);
468
- if (props.autoFocus) {
469
- const { initialFocusTo } = props;
470
- if (initialFocusTo === void 0)
471
- resetFocusTo("first");
472
- else
473
- resolveTo(initialFocusTo)?.focus({ preventScroll: true });
474
- }
475
- activated = true;
476
- document.addEventListener("focus", handleDocumentFocus, true);
477
- }
478
- function deactivate() {
479
- if (props.disabled)
480
- return;
481
- document.removeEventListener("focus", handleDocumentFocus, true);
482
- stack = stack.filter((idInStack) => idInStack !== id);
483
- if (isCurrentActive())
484
- return;
485
- const { finalFocusTo } = props;
486
- if (finalFocusTo !== void 0) {
487
- resolveTo(finalFocusTo)?.focus({ preventScroll: true });
488
- } else if (props.returnFocusOnDeactivated) {
489
- if (lastFocusedElement instanceof HTMLElement) {
490
- ignoreInternalFocusChange = true;
491
- lastFocusedElement.focus({ preventScroll: true });
492
- ignoreInternalFocusChange = false;
493
- }
494
- }
495
- }
496
- function resetFocusTo(target) {
497
- if (!isCurrentActive())
498
- return;
499
- if (props.active) {
500
- const focusableStartEl = focusableStartRef.value;
501
- const focusableEndEl = focusableEndRef.value;
502
- if (focusableStartEl !== null && focusableEndEl !== null) {
503
- const mainEl = getMainEl();
504
- if (mainEl == null || mainEl === focusableEndEl) {
505
- ignoreInternalFocusChange = true;
506
- focusableStartEl.focus({ preventScroll: true });
507
- ignoreInternalFocusChange = false;
508
- return;
509
- }
510
- ignoreInternalFocusChange = true;
511
- const focused = target === "first" ? focusFirstDescendant(mainEl) : focusLastDescendant(mainEl);
512
- ignoreInternalFocusChange = false;
513
- if (!focused) {
514
- ignoreInternalFocusChange = true;
515
- focusableStartEl.focus({ preventScroll: true });
516
- ignoreInternalFocusChange = false;
517
- }
518
- }
519
- }
520
- }
521
- function handleStartFocus(e) {
522
- if (ignoreInternalFocusChange)
523
- return;
524
- const mainEl = getMainEl();
525
- if (mainEl === null)
526
- return;
527
- if (e.relatedTarget !== null && mainEl.contains(e.relatedTarget)) {
528
- resetFocusTo("last");
529
- } else {
530
- resetFocusTo("first");
531
- }
532
- }
533
- function handleEndFocus(e) {
534
- if (ignoreInternalFocusChange)
535
- return;
536
- if (e.relatedTarget !== null && e.relatedTarget === focusableStartRef.value) {
537
- resetFocusTo("last");
538
- } else {
539
- resetFocusTo("first");
540
- }
541
- }
237
+ const DestylerPopoverContentNonModal = defineComponent({
238
+ name: "DestylerPopoverContentNonModal",
239
+ props: destylerPopoverContentImplProps,
240
+ emits: destylerPopoverContentImplEmits,
241
+ setup(props, { emit }) {
242
+ const rootContext = injectPopoverRootContext();
243
+ const hasInteractedOutsideRef = ref(false);
244
+ const hasPointerDownOutsideRef = ref(false);
245
+ const forwarded = useForwardPropsEmits(props, emit);
542
246
  return {
543
- focusableStartRef,
544
- focusableEndRef,
545
- focusableStyle: "position: absolute; height: 0; width: 0;",
546
- handleStartFocus,
547
- handleEndFocus
247
+ forwarded,
248
+ rootContext,
249
+ hasInteractedOutsideRef,
250
+ hasPointerDownOutsideRef
548
251
  };
549
252
  },
550
253
  render() {
551
- const { default: defaultSlot } = this.$slots;
552
- if (defaultSlot === void 0)
553
- return null;
554
- if (this.disabled)
555
- return defaultSlot();
556
- const { active, focusableStyle } = this;
557
- return h(Fragment, null, [
558
- h("div", {
559
- "destyler": "focusable-start",
560
- "aria-hidden": "true",
561
- "tabindex": active ? "0" : "-1",
562
- "ref": "focusableStartRef",
563
- "style": focusableStyle,
564
- "onFocus": this.handleStartFocus
565
- }),
566
- h("div", {
567
- destyler: "focusable-content"
568
- }, defaultSlot()),
569
- h("div", {
570
- "destyler": "focusable-end",
571
- "aria-hidden": "true",
572
- "style": focusableStyle,
573
- "ref": "focusableEndRef",
574
- "tabindex": active ? "0" : "-1",
575
- "onFocus": this.handleEndFocus
576
- })
577
- ]);
254
+ return h(DestylerPopoverContentImpl, {
255
+ ...mergeProps(this.forwarded),
256
+ trapFocus: false,
257
+ disableOutsidePointerEvents: false,
258
+ onCloseAutoFocus: (event) => {
259
+ this.$emit("closeAutoFocus", event);
260
+ if (!event.defaultPrevented) {
261
+ if (!this.hasInteractedOutsideRef)
262
+ this.rootContext.triggerElement.value?.focus();
263
+ event.preventDefault();
264
+ }
265
+ this.hasInteractedOutsideRef = false;
266
+ this.hasPointerDownOutsideRef = false;
267
+ },
268
+ onInteractOutside: async (event) => {
269
+ this.$emit("interactOutside", event);
270
+ if (!event.defaultPrevented) {
271
+ this.hasInteractedOutsideRef = true;
272
+ if (event.detail.originalEvent.type === "pointerdown")
273
+ this.hasPointerDownOutsideRef = true;
274
+ }
275
+ const target = event.target;
276
+ const targetIsTrigger = this.rootContext.triggerElement.value?.contains(target);
277
+ if (targetIsTrigger)
278
+ event.preventDefault();
279
+ if (event.detail.originalEvent.type === "focusin" && this.hasPointerDownOutsideRef)
280
+ event.preventDefault();
281
+ }
282
+ }, this.$slots.default?.());
578
283
  }
579
284
  });
580
285
 
581
- const popoverBodyProps = {
582
- show: {
583
- type: Boolean
584
- },
585
- trigger: {
586
- type: String
587
- },
588
- delay: {
589
- type: Number
590
- },
591
- duration: {
592
- type: Number
593
- },
594
- displayDirective: {
595
- type: String
596
- },
597
- x: {
598
- type: Number
599
- },
600
- y: {
601
- type: Number
602
- },
603
- flip: {
604
- type: Boolean
605
- },
606
- internalTrapFocus: {
607
- type: Boolean
608
- },
609
- overlap: {
610
- type: Boolean
611
- },
612
- keepAliveOnHover: {
613
- type: Boolean
614
- },
615
- scrollable: {
616
- type: Boolean
617
- },
618
- internalDeactivateImmediately: {
619
- type: Boolean
620
- },
621
- onClickoutside: {
622
- type: Function
286
+ const destylerPopoverContentProps = {
287
+ ...destylerPopoverContentImplProps,
288
+ forceMount: {
289
+ type: Boolean,
290
+ required: false,
291
+ default: false
623
292
  }
624
293
  };
625
- const DestylerPopoverBody = defineComponent({
626
- name: "DestylerPopoverBody",
627
- props: popoverBodyProps,
628
- setup(props, { slots, attrs }) {
629
- const follower = ref(null);
630
- const DestylerPopover = inject("DestylerPopover");
631
- const body = ref(null);
632
- const followerEnabled = ref(props.show);
633
- const displayed = ref(false);
634
- watchEffect(() => {
635
- const { show } = props;
636
- if (show && !isJsdom() && !props.internalDeactivateImmediately)
637
- displayed.value = true;
638
- else
639
- displayed.value = false;
640
- });
641
- onBeforeUnmount(() => {
642
- DestylerPopover.setBodyInstance(null);
643
- });
644
- watch(toRef(props, "show"), (value) => {
645
- if (value)
646
- followerEnabled.value = true;
647
- else
648
- followerEnabled.value = false;
649
- });
650
- function syncPosition() {
651
- follower.value?.syncPosition();
652
- }
653
- DestylerPopover.setBodyInstance({
654
- syncPosition
655
- });
656
- function handleMouseEnter(e) {
657
- if (props.trigger === "hover" && props.keepAliveOnHover && props.show)
658
- DestylerPopover.handleMouseEnter(e);
659
- }
660
- function handleMouseLeave(e) {
661
- if (props.trigger === "hover" && props.keepAliveOnHover)
662
- DestylerPopover.handleMouseLeave(e);
663
- }
664
- function handleMouseMoveOutside(e) {
665
- if (props.trigger === "hover" && !getTriggerElement().contains(getPreciseEventTarget(e)))
666
- DestylerPopover.handleMouseMoveOutside(e);
667
- }
668
- function getTriggerElement() {
669
- return DestylerPopover.getTriggerElement();
670
- }
671
- function handleClickOutside(e) {
672
- if (props.trigger === "click" && !getTriggerElement().contains(
673
- getPreciseEventTarget(e)
674
- ) || props.onClickoutside)
675
- DestylerPopover.handleClickOutside(e);
676
- }
677
- const directives = computed(() => {
678
- const { trigger, onClickoutside } = props;
679
- const directives2 = [];
680
- const {
681
- positionManually: { value: positionManually }
682
- } = DestylerPopover;
683
- if (!positionManually) {
684
- if (trigger === "click" && !onClickoutside) {
685
- directives2.push([
686
- clickoutside,
687
- handleClickOutside,
688
- void 0,
689
- { capture: true }
690
- ]);
691
- }
692
- if (trigger === "hover")
693
- directives2.push([mousemoveoutside, handleMouseMoveOutside]);
694
- }
695
- if (onClickoutside) {
696
- directives2.push([
697
- clickoutside,
698
- handleClickOutside,
699
- void 0,
700
- { capture: true }
701
- ]);
702
- }
703
- if (props.displayDirective === "show" || displayed.value)
704
- directives2.push([vShow, props.show]);
705
- return directives2;
706
- });
707
- function renderContentNode() {
708
- const shouldRenderDom = props.displayDirective === "show" || props.show || displayed.value;
709
- if (!shouldRenderDom)
710
- return null;
711
- let contentNode;
712
- const renderBody = DestylerPopover.internalRenderBody.value;
713
- if (!renderBody) {
714
- const { internalTrapFocus } = props;
715
- const hasHeaderOrFooter = !isSlotEmpty(slots.header) || !isSlotEmpty(slots.footer);
716
- const renderContentInnerNode = () => {
717
- const body2 = hasHeaderOrFooter ? [
718
- resolveWrappedSlot(slots.header, (children) => {
719
- return children ? h("div", null, children) : null;
720
- }),
721
- resolveWrappedSlot(slots.default, (children) => {
722
- return children ? h("div", null, children) : null;
723
- }),
724
- resolveWrappedSlot(slots.footer, (children) => {
725
- return children ? h("div", null, children) : null;
726
- })
727
- ] : h("div", {
728
- destyler: "popover-body-content"
729
- }, slots);
730
- return [body2];
731
- };
732
- contentNode = h("div", mergeProps({
733
- ref: body,
734
- destyler: "popover-body-toggle",
735
- onMouseenter: handleMouseEnter,
736
- onMouseleave: handleMouseLeave
737
- }, attrs), internalTrapFocus ? h(DestylerFocusTrap, {
738
- active: props.show,
739
- autoFocus: true
740
- }, renderContentInnerNode) : renderContentInnerNode());
741
- } else {
742
- contentNode = renderBody(body, handleMouseEnter, handleMouseLeave);
743
- }
744
- return withDirectives(contentNode, directives.value);
745
- }
294
+ const destylerPopoverContentEmits = [...destylerPopoverContentImplEmits];
295
+ const DestylerPopoverContent = defineComponent({
296
+ name: "DestylerPopoverContent",
297
+ props: destylerPopoverContentProps,
298
+ emits: destylerPopoverContentEmits,
299
+ setup(props, { emit }) {
300
+ const rootContext = injectPopoverRootContext();
301
+ const forwarded = useForwardPropsEmits(props, emit);
746
302
  return {
747
- displayed,
748
- isMounted: DestylerPopover.isMounted,
749
- zIndex: DestylerPopover.zIndex,
750
- follower,
751
- followerEnabled,
752
- renderContentNode
303
+ rootContext,
304
+ forwarded
753
305
  };
754
306
  },
755
307
  render() {
756
- return h(DestylerFollower, {
757
- ref: "follower",
758
- zIndex: this.zIndex,
759
- show: this.$props.show,
760
- enabled: this.followerEnabled,
761
- to: "body",
762
- x: this.$props.x,
763
- y: this.$props.y,
764
- flip: this.$props.flip,
765
- overlap: this.$props.overlap
766
- }, () => this.renderContentNode());
308
+ const useVShow = this.rootContext.modal.value;
309
+ return h(DestylerPresence, {
310
+ present: this.forceMount || this.rootContext.open.value
311
+ }, useVShow ? h(DestylerPopoverContentModal, {
312
+ ...this.forwarded,
313
+ ...mergeProps(this.$attrs)
314
+ }, this.$slots.default?.()) : h(DestylerPopoverContentNonModal, {
315
+ ...this.forwarded,
316
+ ...mergeProps(this.$attrs)
317
+ }, this.$slots.default?.()));
767
318
  }
768
319
  });
769
320
 
770
- const bodyPropKeys = Object.keys(popoverBodyProps);
771
- const triggerEventMap = {
772
- focus: ["onFocus", "onBlur"],
773
- click: ["onClick"],
774
- hover: ["onMouseenter", "onMouseleave"],
775
- manual: [],
776
- nested: ["onFocus", "onBlur", "onMouseenter", "onMouseleave", "onClick"]
321
+ const destylerPopoverPortalProps = {
322
+ ...destylerTeleportProps
777
323
  };
778
- function appendEvents(vNode, trigger, events) {
779
- triggerEventMap[trigger].forEach((eventName) => {
780
- if (!vNode.props)
781
- vNode.props = {};
782
- else
783
- vNode.props = Object.assign({}, vNode.props);
784
- const originalHandler = vNode.props[eventName];
785
- const handler = events[eventName];
786
- if (!originalHandler) {
787
- vNode.props[eventName] = handler;
788
- } else {
789
- vNode.props[eventName] = (...args) => {
790
- originalHandler(...args);
791
- handler(...args);
792
- };
793
- }
794
- });
795
- }
796
- const destylerPopoverProps = {
797
- "show": {
798
- type: Boolean,
799
- default: void 0
800
- },
801
- "defaultShow": {
802
- type: Boolean
803
- },
804
- "trigger": {
805
- type: String,
806
- default: "hover"
807
- },
808
- "delay": {
809
- type: Number,
810
- default: 100
811
- },
812
- "duration": {
813
- type: Number,
814
- default: 100
815
- },
816
- "x": {
817
- type: Number
818
- },
819
- "y": {
820
- type: Number
821
- },
822
- "disabled": {
823
- type: Boolean
824
- },
825
- "getDisabled": {
826
- type: Function
827
- },
828
- "displayDirective": {
829
- type: String,
830
- default: "if"
831
- },
832
- "zIndex": {
833
- type: Number
834
- },
835
- "internalSyncTargetWithParent": {
836
- type: Boolean
837
- },
838
- "internalInheritedEventHandlers": {
839
- type: Array,
840
- default: () => []
841
- },
842
- "internalTrapFocus": {
843
- type: Boolean
844
- },
845
- "onClickoutside": {
846
- type: Function
847
- },
848
- "onUpdate:show": {
849
- type: [Function, Array]
850
- },
851
- "onUpdateShow": {
852
- type: [Function, Array]
853
- },
854
- "onShow": {
855
- type: [Function, Array]
856
- },
857
- "onHide": {
858
- type: [Function, Array]
859
- },
860
- "internalRenderBody": {
861
- type: Function
324
+ const DestylerPopoverPortal = defineComponent({
325
+ name: "DestylerPopoverPortal",
326
+ props: destylerPopoverPortalProps,
327
+ render() {
328
+ return h(DestylerTeleport, mergeProps(this.$props), this.$slots.default?.());
329
+ }
330
+ });
331
+
332
+ const destylerPopoverTriggerProps = {
333
+ ...destylerPrimitiveProp,
334
+ as: {
335
+ type: [String, Object],
336
+ required: false,
337
+ default: "button"
862
338
  }
863
339
  };
864
- const DestylerPopover = defineComponent({
865
- name: "DestylerPopover",
866
- inheritAttrs: false,
867
- props: destylerPopoverProps,
868
- __popover__: true,
869
- setup(props) {
870
- const isMounted = useIsMounted();
871
- const binderInst = ref(null);
872
- const controlledShow = computed(() => props.show);
873
- const uncontrolledShow = ref(props.defaultShow);
874
- const mergedShowWithoutDisabled = useMergedState(
875
- controlledShow,
876
- uncontrolledShow
877
- );
878
- const mergedShowConsideringDisabledProp = useMemo(() => {
879
- if (props.disabled)
880
- return false;
881
- return mergedShowWithoutDisabled.value;
882
- });
883
- const getMergedDisabled = () => {
884
- if (props.disabled)
885
- return true;
886
- const { getDisabled } = props;
887
- if (getDisabled?.())
888
- return true;
889
- return false;
890
- };
891
- const getMergedShow = () => {
892
- if (getMergedDisabled())
893
- return false;
894
- return mergedShowWithoutDisabled.value;
895
- };
896
- const showTimerId = ref(null);
897
- const hideTimerId = ref(null);
898
- const positionManually = useMemo(() => {
899
- return props.x !== void 0 && props.y !== void 0;
900
- });
901
- function doUpdateShow(value) {
902
- const {
903
- "onUpdate:show": _onUpdateShow,
904
- onUpdateShow,
905
- onShow,
906
- onHide
907
- } = props;
908
- uncontrolledShow.value = value;
909
- if (_onUpdateShow)
910
- call(_onUpdateShow, value);
911
- if (onUpdateShow)
912
- call(onUpdateShow, value);
913
- if (value && onShow)
914
- call(onShow, true);
915
- if (value && onHide)
916
- call(onHide, false);
917
- }
918
- function clearShowTimer() {
919
- if (showTimerId.value) {
920
- window.clearTimeout(showTimerId.value);
921
- showTimerId.value = null;
922
- }
923
- }
924
- function clearHideTimer() {
925
- if (hideTimerId.value) {
926
- window.clearTimeout(hideTimerId.value);
927
- hideTimerId.value = null;
928
- }
929
- }
930
- function handleFocus() {
931
- const mergedDisabled = getMergedDisabled();
932
- if (props.trigger === "focus" && !mergedDisabled) {
933
- if (getMergedShow())
934
- return;
935
- doUpdateShow(true);
936
- }
937
- }
938
- function handleBlur() {
939
- const mergedDisabled = getMergedDisabled();
940
- if (props.trigger === "focus" && !mergedDisabled) {
941
- if (!getMergedShow())
942
- return;
943
- doUpdateShow(false);
944
- }
945
- }
946
- function handleMouseEnter() {
947
- const mergedDisabled = getMergedDisabled();
948
- if (props.trigger === "hover" && !mergedDisabled) {
949
- clearHideTimer();
950
- if (showTimerId.value !== null)
951
- return;
952
- if (getMergedShow())
953
- return;
954
- const delayCallback = () => {
955
- doUpdateShow(true);
956
- showTimerId.value = null;
957
- };
958
- const { delay } = props;
959
- if (delay === 0)
960
- delayCallback();
961
- else
962
- showTimerId.value = window.setTimeout(delayCallback, delay);
963
- }
964
- }
965
- function handleMouseLeave() {
966
- const mergedDisabled = getMergedDisabled();
967
- if (props.trigger === "hover" && !mergedDisabled) {
968
- clearShowTimer();
969
- if (hideTimerId.value !== null)
970
- return;
971
- if (!getMergedShow())
972
- return;
973
- const delayedCallback = () => {
974
- doUpdateShow(false);
975
- hideTimerId.value = null;
976
- };
977
- const { duration } = props;
978
- if (duration === 0)
979
- delayedCallback();
980
- else
981
- hideTimerId.value = window.setTimeout(delayedCallback, duration);
982
- }
983
- }
984
- function handleMouseMoveOutside() {
985
- handleMouseLeave();
986
- }
987
- function handleClickOutside(e) {
988
- if (!getMergedShow())
989
- return;
990
- if (props.trigger === "click") {
991
- clearShowTimer();
992
- clearHideTimer();
993
- doUpdateShow(false);
994
- }
995
- props.onClickoutside?.(e);
996
- }
997
- function handleClick() {
998
- if (props.trigger === "click" && !getMergedDisabled()) {
999
- clearShowTimer();
1000
- clearHideTimer();
1001
- const nextShow = !getMergedShow();
1002
- doUpdateShow(nextShow);
1003
- }
1004
- }
1005
- function getTriggerElement() {
1006
- return binderInst.value?.targetRef;
1007
- }
1008
- function setBodyInstance(value) {
1009
- }
1010
- provide("DestylerPopover", {
1011
- getTriggerElement,
1012
- handleMouseEnter,
1013
- handleMouseLeave,
1014
- handleClickOutside,
1015
- handleMouseMoveOutside,
1016
- setBodyInstance,
1017
- positionManually,
1018
- isMounted,
1019
- zIndex: toRef(props, "zIndex"),
1020
- internalRenderBody: toRef(props, "internalRenderBody")
1021
- });
1022
- watchEffect(() => {
1023
- if (mergedShowWithoutDisabled.value && getMergedDisabled())
1024
- doUpdateShow(false);
340
+ const DestylerPopoverTrigger = defineComponent({
341
+ name: "DestylerPopoverTrigger",
342
+ props: destylerPopoverTriggerProps,
343
+ setup() {
344
+ const rootContext = injectPopoverRootContext();
345
+ const { customElement, currentElement: triggerElement } = useCustomElement();
346
+ onMounted(() => {
347
+ rootContext.triggerElement.value = triggerElement.value;
1025
348
  });
1026
- function setShow(value) {
1027
- uncontrolledShow.value = value;
1028
- }
1029
349
  return {
1030
- binderInst,
1031
- positionManually,
1032
- mergedShowConsideringDisabledProp,
1033
- // if to show popover body
1034
- uncontrolledShow,
1035
- setShow,
1036
- getMergedShow,
1037
- handleClick,
1038
- handleMouseEnter,
1039
- handleMouseLeave,
1040
- handleFocus,
1041
- handleBlur
350
+ rootContext,
351
+ customElement
1042
352
  };
1043
353
  },
1044
354
  render() {
1045
- let triggerVNode;
1046
- let popoverInside = false;
1047
- if (!this.positionManually) {
1048
- if (this.$slots.activator)
1049
- triggerVNode = getFirstSlotVNode(this.$slots, "activator");
1050
- else
1051
- triggerVNode = getFirstSlotVNode(this.$slots, "trigger");
1052
- if (triggerVNode) {
1053
- triggerVNode = cloneVNode(triggerVNode);
1054
- triggerVNode = triggerVNode.type === Text ? h("span", [triggerVNode]) : triggerVNode;
1055
- const handlers = {
1056
- onClick: this.handleClick,
1057
- onMouseenter: this.handleMouseEnter,
1058
- onMouseleave: this.handleMouseLeave,
1059
- onFocus: this.handleFocus,
1060
- onBlur: this.handleBlur
1061
- };
1062
- if (triggerVNode.type?.__popover__) {
1063
- popoverInside = true;
1064
- if (!triggerVNode.props) {
1065
- triggerVNode.props = {
1066
- internalSyncTargetWithParent: true,
1067
- internalInheritedEventHandlers: []
1068
- };
1069
- }
1070
- triggerVNode.props.internalSyncTargetWithParent = true;
1071
- if (!triggerVNode.props.internalInheritedEventHandlers) {
1072
- triggerVNode.props.internalInheritedEventHandlers = [handlers];
1073
- } else {
1074
- triggerVNode.props.internalInheritedEventHandlers = [
1075
- handlers,
1076
- ...triggerVNode.props.internalInheritedEventHandlers
1077
- ];
1078
- }
1079
- } else {
1080
- const { internalInheritedEventHandlers } = this.$props;
1081
- const ascendantAndCurrentHandlers = [
1082
- handlers,
1083
- ...internalInheritedEventHandlers
1084
- ];
1085
- const mergedHandlers = {
1086
- onBlur: (e) => {
1087
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1088
- _handlers.onBlur(e);
1089
- });
1090
- },
1091
- onFocus: (e) => {
1092
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1093
- _handlers.onFocus(e);
1094
- });
1095
- },
1096
- onClick: (e) => {
1097
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1098
- _handlers.onClick(e);
1099
- });
1100
- },
1101
- onMouseenter: (e) => {
1102
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1103
- _handlers.onMouseenter(e);
1104
- });
1105
- },
1106
- onMouseleave: (e) => {
1107
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1108
- _handlers.onMouseleave(e);
1109
- });
1110
- }
1111
- };
1112
- appendEvents(
1113
- triggerVNode,
1114
- internalInheritedEventHandlers ? "nested" : this.positionManually ? "manual" : this.$props.trigger,
1115
- mergedHandlers
1116
- );
1117
- }
355
+ return h(this.rootContext.hasCustomAnchor.value ? DestylerPrimitive : DestylerPopperAnchor, {
356
+ asChild: true
357
+ }, h(DestylerPrimitive, {
358
+ "ref": "customElement",
359
+ "type": this.$props.as === "button" ? "button" : void 0,
360
+ "as": this.$props.as,
361
+ "aria-haspopup": "dialog",
362
+ "asChild": this.$props.asChild,
363
+ "aria-expanded": this.rootContext.open.value,
364
+ "aria-controls": this.rootContext.contentId,
365
+ "data-state": this.rootContext.open.value ? "open" : "closed",
366
+ "onClick": () => {
367
+ this.rootContext.onOpenToggle();
1118
368
  }
1119
- }
1120
- return h(DestylerBinder, {
1121
- ref: "binderInst",
1122
- syncTarget: !popoverInside,
1123
- syncTargetWithParent: this.$props.internalSyncTargetWithParent
1124
- }, () => {
1125
- return [
1126
- this.$props.internalTrapFocus && this.getMergedShow() ? withDirectives(h("div"), [[zindexable, { enabled: this.getMergedShow(), zIndex: this.$props.zIndex }]]) : null,
1127
- this.positionManually ? null : h(DestylerTarget, null, {
1128
- default: () => triggerVNode
1129
- }),
1130
- h(DestylerPopoverBody, keep(this.$props, bodyPropKeys, {
1131
- ...this.$attrs,
1132
- show: this.getMergedShow()
1133
- }), {
1134
- default: () => this.$slots.default?.(),
1135
- header: () => this.$slots.header?.(),
1136
- footer: () => this.$slots.footer?.()
1137
- })
1138
- ];
1139
- });
369
+ }, this.$slots.default?.()));
1140
370
  }
1141
371
  });
1142
372
 
@@ -1153,4 +383,4 @@ function DestylerPopoverResolver() {
1153
383
  };
1154
384
  }
1155
385
 
1156
- export { DestylerPopover, DestylerPopoverBody, DestylerPopoverResolver, destylerPopoverProps, popoverBodyProps };
386
+ export { DestylerPopoverAnchor, DestylerPopoverArrow, DestylerPopoverClose, DestylerPopoverContent, DestylerPopoverContentImpl, DestylerPopoverContentModal, DestylerPopoverContentNonModal, DestylerPopoverPortal, DestylerPopoverResolver, DestylerPopoverRoot, DestylerPopoverTrigger, destylerPopoverAnchorProps, destylerPopoverArrowProps, destylerPopoverCloseProps, destylerPopoverContentEmits, destylerPopoverContentImplEmits, destylerPopoverContentImplProps, destylerPopoverContentProps, destylerPopoverPortalProps, destylerPopoverRootProps, destylerPopoverTriggerProps, injectPopoverRootContext, providePopoverRootContext };