import { defineComponent, ref, createBlock, openBlock, mergeProps, unref, withCtx, renderSlot } from 'vue'; import { _ as _sfc_main$1 } from './PopoverContentImpl.js'; import { u as useForwardPropsEmits } from '../shared/useForwardPropsEmits.js'; import { i as injectPopoverRootContext } from './PopoverRoot.js'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "PopoverContentNonModal", props: { side: {}, sideOffset: {}, align: {}, alignOffset: {}, avoidCollisions: { type: Boolean }, collisionBoundary: {}, collisionPadding: {}, arrowPadding: {}, sticky: {}, hideWhenDetached: { type: Boolean }, positionStrategy: {}, updatePositionStrategy: {}, disableUpdateOnLayoutShift: { type: Boolean }, prioritizePosition: { type: Boolean }, reference: {}, asChild: { type: Boolean }, as: {}, disableOutsidePointerEvents: { type: Boolean } }, emits: ["escapeKeyDown", "pointerDownOutside", "focusOutside", "interactOutside", "openAutoFocus", "closeAutoFocus"], setup(__props, { emit: __emit }) { const props = __props; const emits = __emit; const rootContext = injectPopoverRootContext(); const hasInteractedOutsideRef = ref(false); const hasPointerDownOutsideRef = ref(false); const forwarded = useForwardPropsEmits(props, emits); return (_ctx, _cache) => { return openBlock(), createBlock(_sfc_main$1, mergeProps(unref(forwarded), { "trap-focus": false, "disable-outside-pointer-events": false, onCloseAutoFocus: _cache[0] || (_cache[0] = (event) => { emits("closeAutoFocus", event); if (!event.defaultPrevented) { if (!hasInteractedOutsideRef.value) unref(rootContext).triggerElement.value?.focus(); event.preventDefault(); } hasInteractedOutsideRef.value = false; hasPointerDownOutsideRef.value = false; }), onInteractOutside: _cache[1] || (_cache[1] = async (event) => { emits("interactOutside", event); if (!event.defaultPrevented) { hasInteractedOutsideRef.value = true; if (event.detail.originalEvent.type === "pointerdown") { hasPointerDownOutsideRef.value = true; } } const target = event.target; const targetIsTrigger = unref(rootContext).triggerElement.value?.contains(target); if (targetIsTrigger) event.preventDefault(); if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.value) { event.preventDefault(); } }) }), { default: withCtx(() => [ renderSlot(_ctx.$slots, "default") ]), _: 3 }, 16); }; } }); export { _sfc_main as _ }; //# sourceMappingURL=PopoverContentNonModal.js.map