@destyler/popover 0.0.1-beta.6 → 0.0.1-beta.8

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,1153 +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);
177
169
  },
178
- getSlot("lazy-teleport", this.$slots)
179
- ) : null;
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);
178
+ },
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
- name: {
583
- type: String,
286
+ const destylerPopoverContentProps = {
287
+ ...destylerPopoverContentImplProps,
288
+ forceMount: {
289
+ type: Boolean,
584
290
  required: false,
585
- default: "popover"
586
- },
587
- show: {
588
- type: Boolean
589
- },
590
- trigger: {
591
- type: String
592
- },
593
- delay: {
594
- type: Number
595
- },
596
- duration: {
597
- type: Number
598
- },
599
- displayDirective: {
600
- type: String
601
- },
602
- x: {
603
- type: Number
604
- },
605
- y: {
606
- type: Number
607
- },
608
- flip: {
609
- type: Boolean
610
- },
611
- internalTrapFocus: {
612
- type: Boolean
613
- },
614
- overlap: {
615
- type: Boolean
616
- },
617
- keepAliveOnHover: {
618
- type: Boolean
619
- },
620
- scrollable: {
621
- type: Boolean
622
- },
623
- internalDeactivateImmediately: {
624
- type: Boolean
625
- },
626
- onClickoutside: {
627
- type: Function
291
+ default: false
628
292
  }
629
293
  };
630
- const DestylerPopoverBody = defineComponent({
631
- name: "DestylerPopoverBody",
632
- props: popoverBodyProps,
633
- setup(props, { slots, attrs }) {
634
- const follower = ref(null);
635
- const DestylerPopover = inject("DestylerPopover");
636
- const body = ref(null);
637
- const followerEnabled = ref(props.show);
638
- const displayed = ref(false);
639
- watchEffect(() => {
640
- const { show } = props;
641
- if (show && !isJsdom() && !props.internalDeactivateImmediately)
642
- displayed.value = true;
643
- else
644
- displayed.value = false;
645
- });
646
- onBeforeUnmount(() => {
647
- DestylerPopover.setBodyInstance(null);
648
- });
649
- watch(toRef(props, "show"), (value) => {
650
- if (value)
651
- followerEnabled.value = true;
652
- else
653
- followerEnabled.value = false;
654
- });
655
- function syncPosition() {
656
- follower.value?.syncPosition();
657
- }
658
- DestylerPopover.setBodyInstance({
659
- syncPosition
660
- });
661
- function handleMouseEnter(e) {
662
- if (props.trigger === "hover" && props.keepAliveOnHover && props.show)
663
- DestylerPopover.handleMouseEnter(e);
664
- }
665
- function handleMouseLeave(e) {
666
- if (props.trigger === "hover" && props.keepAliveOnHover)
667
- DestylerPopover.handleMouseLeave(e);
668
- }
669
- function handleMouseMoveOutside(e) {
670
- if (props.trigger === "hover" && !getTriggerElement().contains(getPreciseEventTarget(e)))
671
- DestylerPopover.handleMouseMoveOutside(e);
672
- }
673
- function getTriggerElement() {
674
- return DestylerPopover.getTriggerElement();
675
- }
676
- function handleClickOutside(e) {
677
- if (props.trigger === "click" && !getTriggerElement().contains(
678
- getPreciseEventTarget(e)
679
- ) || props.onClickoutside)
680
- DestylerPopover.handleClickOutside(e);
681
- }
682
- const directives = computed(() => {
683
- const { trigger, onClickoutside } = props;
684
- const directives2 = [];
685
- const {
686
- positionManually: { value: positionManually }
687
- } = DestylerPopover;
688
- if (!positionManually) {
689
- if (trigger === "click" && !onClickoutside) {
690
- directives2.push([
691
- clickoutside,
692
- handleClickOutside,
693
- void 0,
694
- { capture: true }
695
- ]);
696
- }
697
- if (trigger === "hover")
698
- directives2.push([mousemoveoutside, handleMouseMoveOutside]);
699
- }
700
- if (onClickoutside) {
701
- directives2.push([
702
- clickoutside,
703
- handleClickOutside,
704
- void 0,
705
- { capture: true }
706
- ]);
707
- }
708
- if (props.displayDirective === "show" || displayed.value)
709
- directives2.push([vShow, props.show]);
710
- return directives2;
711
- });
712
- function renderContentNode() {
713
- const shouldRenderDom = props.displayDirective === "show" || props.show || displayed.value;
714
- if (!shouldRenderDom)
715
- return null;
716
- let contentNode;
717
- const renderBody = DestylerPopover.internalRenderBody.value;
718
- if (!renderBody) {
719
- const { internalTrapFocus } = props;
720
- const hasHeaderOrFooter = !isSlotEmpty(slots.header) || !isSlotEmpty(slots.footer);
721
- const renderContentInnerNode = () => {
722
- const body2 = hasHeaderOrFooter ? [
723
- resolveWrappedSlot(slots.header, (children) => {
724
- return children ? h("div", null, children) : null;
725
- }),
726
- resolveWrappedSlot(slots.default, (children) => {
727
- return children ? h("div", null, children) : null;
728
- }),
729
- resolveWrappedSlot(slots.footer, (children) => {
730
- return children ? h("div", null, children) : null;
731
- })
732
- ] : h("div", {
733
- destyler: `${props.name}-body-content`
734
- }, slots);
735
- return [body2];
736
- };
737
- contentNode = h("div", mergeProps({
738
- ref: body,
739
- destyler: `${props.name}-body-toggle`,
740
- onMouseenter: handleMouseEnter,
741
- onMouseleave: handleMouseLeave
742
- }, attrs), internalTrapFocus ? h(DestylerFocusTrap, {
743
- active: props.show,
744
- autoFocus: true
745
- }, renderContentInnerNode) : renderContentInnerNode());
746
- } else {
747
- contentNode = renderBody(body, handleMouseEnter, handleMouseLeave);
748
- }
749
- return withDirectives(contentNode, directives.value);
750
- }
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);
751
302
  return {
752
- displayed,
753
- isMounted: DestylerPopover.isMounted,
754
- zIndex: DestylerPopover.zIndex,
755
- follower,
756
- followerEnabled,
757
- renderContentNode
303
+ rootContext,
304
+ forwarded
758
305
  };
759
306
  },
760
307
  render() {
761
- return h(DestylerFollower, {
762
- ref: "follower",
763
- zIndex: this.zIndex,
764
- show: this.$props.show,
765
- enabled: this.followerEnabled,
766
- to: "body",
767
- x: this.$props.x,
768
- y: this.$props.y,
769
- flip: this.$props.flip,
770
- overlap: this.$props.overlap
771
- }, () => 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?.()));
772
318
  }
773
319
  });
774
320
 
775
- const bodyPropKeys = Object.keys(popoverBodyProps);
776
- const triggerEventMap = {
777
- focus: ["onFocus", "onBlur"],
778
- click: ["onClick"],
779
- hover: ["onMouseenter", "onMouseleave"],
780
- manual: [],
781
- nested: ["onFocus", "onBlur", "onMouseenter", "onMouseleave", "onClick"]
321
+ const destylerPopoverPortalProps = {
322
+ ...destylerTeleportProps
782
323
  };
783
- function appendEvents(vNode, trigger, events) {
784
- triggerEventMap[trigger].forEach((eventName) => {
785
- if (!vNode.props)
786
- vNode.props = {};
787
- else
788
- vNode.props = Object.assign({}, vNode.props);
789
- const originalHandler = vNode.props[eventName];
790
- const handler = events[eventName];
791
- if (!originalHandler) {
792
- vNode.props[eventName] = handler;
793
- } else {
794
- vNode.props[eventName] = (...args) => {
795
- originalHandler(...args);
796
- handler(...args);
797
- };
798
- }
799
- });
800
- }
801
- const destylerPopoverProps = {
802
- "name": {
803
- type: String,
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],
804
336
  required: false,
805
- default: "popover"
806
- },
807
- "show": {
808
- type: Boolean,
809
- default: void 0
810
- },
811
- "defaultShow": {
812
- type: Boolean
813
- },
814
- "trigger": {
815
- type: String,
816
- default: "hover"
817
- },
818
- "delay": {
819
- type: Number,
820
- default: 100
821
- },
822
- "duration": {
823
- type: Number,
824
- default: 100
825
- },
826
- "x": {
827
- type: Number
828
- },
829
- "y": {
830
- type: Number
831
- },
832
- "disabled": {
833
- type: Boolean
834
- },
835
- "getDisabled": {
836
- type: Function
837
- },
838
- "displayDirective": {
839
- type: String,
840
- default: "if"
841
- },
842
- "zIndex": {
843
- type: Number
844
- },
845
- "internalSyncTargetWithParent": {
846
- type: Boolean
847
- },
848
- "internalInheritedEventHandlers": {
849
- type: Array,
850
- default: () => []
851
- },
852
- "internalTrapFocus": {
853
- type: Boolean
854
- },
855
- "onClickoutside": {
856
- type: Function
857
- },
858
- "onUpdate:show": {
859
- type: [Function, Array]
860
- },
861
- "onUpdateShow": {
862
- type: [Function, Array]
863
- },
864
- "onShow": {
865
- type: [Function, Array]
866
- },
867
- "onHide": {
868
- type: [Function, Array]
869
- },
870
- "internalRenderBody": {
871
- type: Function
337
+ default: "button"
872
338
  }
873
339
  };
874
- const DestylerPopover = defineComponent({
875
- name: "DestylerPopover",
876
- inheritAttrs: false,
877
- props: destylerPopoverProps,
878
- __popover__: true,
879
- setup(props) {
880
- const isMounted = useIsMounted();
881
- const binderInst = ref(null);
882
- const controlledShow = computed(() => props.show);
883
- const uncontrolledShow = ref(props.defaultShow);
884
- const mergedShowWithoutDisabled = useMergedState(
885
- controlledShow,
886
- uncontrolledShow
887
- );
888
- const mergedShowConsideringDisabledProp = useMemo(() => {
889
- if (props.disabled)
890
- return false;
891
- return mergedShowWithoutDisabled.value;
892
- });
893
- const getMergedDisabled = () => {
894
- if (props.disabled)
895
- return true;
896
- const { getDisabled } = props;
897
- if (getDisabled?.())
898
- return true;
899
- return false;
900
- };
901
- const getMergedShow = () => {
902
- if (getMergedDisabled())
903
- return false;
904
- return mergedShowWithoutDisabled.value;
905
- };
906
- const showTimerId = ref(null);
907
- const hideTimerId = ref(null);
908
- const positionManually = useMemo(() => {
909
- return props.x !== void 0 && props.y !== void 0;
910
- });
911
- function doUpdateShow(value) {
912
- const {
913
- "onUpdate:show": _onUpdateShow,
914
- onUpdateShow,
915
- onShow,
916
- onHide
917
- } = props;
918
- uncontrolledShow.value = value;
919
- if (_onUpdateShow)
920
- call(_onUpdateShow, value);
921
- if (onUpdateShow)
922
- call(onUpdateShow, value);
923
- if (value && onShow)
924
- call(onShow, true);
925
- if (value && onHide)
926
- call(onHide, false);
927
- }
928
- function clearShowTimer() {
929
- if (showTimerId.value) {
930
- window.clearTimeout(showTimerId.value);
931
- showTimerId.value = null;
932
- }
933
- }
934
- function clearHideTimer() {
935
- if (hideTimerId.value) {
936
- window.clearTimeout(hideTimerId.value);
937
- hideTimerId.value = null;
938
- }
939
- }
940
- function handleFocus() {
941
- const mergedDisabled = getMergedDisabled();
942
- if (props.trigger === "focus" && !mergedDisabled) {
943
- if (getMergedShow())
944
- return;
945
- doUpdateShow(true);
946
- }
947
- }
948
- function handleBlur() {
949
- const mergedDisabled = getMergedDisabled();
950
- if (props.trigger === "focus" && !mergedDisabled) {
951
- if (!getMergedShow())
952
- return;
953
- doUpdateShow(false);
954
- }
955
- }
956
- function handleMouseEnter() {
957
- const mergedDisabled = getMergedDisabled();
958
- if (props.trigger === "hover" && !mergedDisabled) {
959
- clearHideTimer();
960
- if (showTimerId.value !== null)
961
- return;
962
- if (getMergedShow())
963
- return;
964
- const delayCallback = () => {
965
- doUpdateShow(true);
966
- showTimerId.value = null;
967
- };
968
- const { delay } = props;
969
- if (delay === 0)
970
- delayCallback();
971
- else
972
- showTimerId.value = window.setTimeout(delayCallback, delay);
973
- }
974
- }
975
- function handleMouseLeave() {
976
- const mergedDisabled = getMergedDisabled();
977
- if (props.trigger === "hover" && !mergedDisabled) {
978
- clearShowTimer();
979
- if (hideTimerId.value !== null)
980
- return;
981
- if (!getMergedShow())
982
- return;
983
- const delayedCallback = () => {
984
- doUpdateShow(false);
985
- hideTimerId.value = null;
986
- };
987
- const { duration } = props;
988
- if (duration === 0)
989
- delayedCallback();
990
- else
991
- hideTimerId.value = window.setTimeout(delayedCallback, duration);
992
- }
993
- }
994
- function handleMouseMoveOutside() {
995
- handleMouseLeave();
996
- }
997
- function handleClickOutside(e) {
998
- if (!getMergedShow())
999
- return;
1000
- if (props.trigger === "click") {
1001
- clearShowTimer();
1002
- clearHideTimer();
1003
- doUpdateShow(false);
1004
- }
1005
- props.onClickoutside?.(e);
1006
- }
1007
- function handleClick() {
1008
- if (props.trigger === "click" && !getMergedDisabled()) {
1009
- clearShowTimer();
1010
- clearHideTimer();
1011
- const nextShow = !getMergedShow();
1012
- doUpdateShow(nextShow);
1013
- }
1014
- }
1015
- function getTriggerElement() {
1016
- return binderInst.value?.targetRef;
1017
- }
1018
- function setBodyInstance(value) {
1019
- }
1020
- provide("DestylerPopover", {
1021
- getTriggerElement,
1022
- handleMouseEnter,
1023
- handleMouseLeave,
1024
- handleClickOutside,
1025
- handleMouseMoveOutside,
1026
- setBodyInstance,
1027
- positionManually,
1028
- isMounted,
1029
- zIndex: toRef(props, "zIndex"),
1030
- internalRenderBody: toRef(props, "internalRenderBody")
1031
- });
1032
- watchEffect(() => {
1033
- if (mergedShowWithoutDisabled.value && getMergedDisabled())
1034
- 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;
1035
348
  });
1036
- function setShow(value) {
1037
- uncontrolledShow.value = value;
1038
- }
1039
349
  return {
1040
- binderInst,
1041
- positionManually,
1042
- mergedShowConsideringDisabledProp,
1043
- // if to show popover body
1044
- uncontrolledShow,
1045
- setShow,
1046
- getMergedShow,
1047
- handleClick,
1048
- handleMouseEnter,
1049
- handleMouseLeave,
1050
- handleFocus,
1051
- handleBlur
350
+ rootContext,
351
+ customElement
1052
352
  };
1053
353
  },
1054
354
  render() {
1055
- let triggerVNode;
1056
- let popoverInside = false;
1057
- if (!this.positionManually) {
1058
- if (this.$slots.activator)
1059
- triggerVNode = getFirstSlotVNode(this.$slots, "activator");
1060
- else
1061
- triggerVNode = getFirstSlotVNode(this.$slots, "trigger");
1062
- if (triggerVNode) {
1063
- triggerVNode = cloneVNode(triggerVNode);
1064
- triggerVNode = triggerVNode.type === Text ? h("span", [triggerVNode]) : triggerVNode;
1065
- const handlers = {
1066
- onClick: this.handleClick,
1067
- onMouseenter: this.handleMouseEnter,
1068
- onMouseleave: this.handleMouseLeave,
1069
- onFocus: this.handleFocus,
1070
- onBlur: this.handleBlur
1071
- };
1072
- if (triggerVNode.type?.__popover__) {
1073
- popoverInside = true;
1074
- if (!triggerVNode.props) {
1075
- triggerVNode.props = {
1076
- internalSyncTargetWithParent: true,
1077
- internalInheritedEventHandlers: []
1078
- };
1079
- }
1080
- triggerVNode.props.internalSyncTargetWithParent = true;
1081
- if (!triggerVNode.props.internalInheritedEventHandlers) {
1082
- triggerVNode.props.internalInheritedEventHandlers = [handlers];
1083
- } else {
1084
- triggerVNode.props.internalInheritedEventHandlers = [
1085
- handlers,
1086
- ...triggerVNode.props.internalInheritedEventHandlers
1087
- ];
1088
- }
1089
- } else {
1090
- const { internalInheritedEventHandlers } = this.$props;
1091
- const ascendantAndCurrentHandlers = [
1092
- handlers,
1093
- ...internalInheritedEventHandlers
1094
- ];
1095
- const mergedHandlers = {
1096
- onBlur: (e) => {
1097
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1098
- _handlers.onBlur(e);
1099
- });
1100
- },
1101
- onFocus: (e) => {
1102
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1103
- _handlers.onFocus(e);
1104
- });
1105
- },
1106
- onClick: (e) => {
1107
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1108
- _handlers.onClick(e);
1109
- });
1110
- },
1111
- onMouseenter: (e) => {
1112
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1113
- _handlers.onMouseenter(e);
1114
- });
1115
- },
1116
- onMouseleave: (e) => {
1117
- ascendantAndCurrentHandlers.forEach((_handlers) => {
1118
- _handlers.onMouseleave(e);
1119
- });
1120
- }
1121
- };
1122
- appendEvents(
1123
- triggerVNode,
1124
- internalInheritedEventHandlers ? "nested" : this.positionManually ? "manual" : this.$props.trigger,
1125
- mergedHandlers
1126
- );
1127
- }
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();
1128
368
  }
1129
- }
1130
- return h(DestylerBinder, {
1131
- ref: "binderInst",
1132
- syncTarget: !popoverInside,
1133
- syncTargetWithParent: this.$props.internalSyncTargetWithParent
1134
- }, () => {
1135
- return [
1136
- this.$props.internalTrapFocus && this.getMergedShow() ? withDirectives(h("div"), [[zindexable, { enabled: this.getMergedShow(), zIndex: this.$props.zIndex }]]) : null,
1137
- this.positionManually ? null : h(DestylerTarget, null, {
1138
- default: () => triggerVNode
1139
- }),
1140
- h(DestylerPopoverBody, keep(this.$props, bodyPropKeys, {
1141
- ...this.$attrs,
1142
- name: this.$props.name,
1143
- show: this.getMergedShow()
1144
- }), {
1145
- default: () => this.$slots.default?.(),
1146
- header: () => this.$slots.header?.(),
1147
- footer: () => this.$slots.footer?.()
1148
- })
1149
- ];
1150
- });
369
+ }, this.$slots.default?.()));
1151
370
  }
1152
371
  });
1153
372
 
@@ -1164,4 +383,4 @@ function DestylerPopoverResolver() {
1164
383
  };
1165
384
  }
1166
385
 
1167
- 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 };