@tamagui/popover 3.0.0-beta.924.1 → 3.0.1
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/cjs/Popover.cjs +19 -4
- package/dist/cjs/Popover.native.cjs +21 -4
- package/dist/cjs/Popover.native.js +21 -4
- package/dist/cjs/Popover.native.js.map +1 -1
- package/dist/cjs/useFloatingContext.cjs +17 -5
- package/dist/esm/Popover.mjs +20 -5
- package/dist/esm/Popover.mjs.map +1 -1
- package/dist/esm/Popover.native.js +22 -5
- package/dist/esm/Popover.native.js.map +1 -1
- package/dist/esm/useFloatingContext.mjs +17 -5
- package/dist/esm/useFloatingContext.mjs.map +1 -1
- package/dist/jsx/Popover.mjs +20 -5
- package/dist/jsx/Popover.mjs.map +1 -1
- package/dist/jsx/Popover.native.cjs +21 -4
- package/dist/jsx/Popover.native.js +21 -4
- package/dist/jsx/Popover.native.js.map +1 -1
- package/dist/jsx/useFloatingContext.mjs +17 -5
- package/dist/jsx/useFloatingContext.mjs.map +1 -1
- package/package.json +25 -23
- package/src/Popover.tsx +43 -11
- package/src/useFloatingContext.tsx +15 -7
- package/types/Popover.d.ts +17 -14
- package/types/Popover.d.ts.map +1 -1
- package/types/useFloatingContext.d.ts +5 -2
- package/types/useFloatingContext.d.ts.map +1 -1
package/dist/esm/Popover.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { Dismissable, DismissableBranch } from "@tamagui/dismissable";
|
|
|
8
8
|
import { FloatingOverrideContext } from "@tamagui/floating";
|
|
9
9
|
import { FocusScope, FocusScopeController } from "@tamagui/focus-scope";
|
|
10
10
|
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
11
|
-
import { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext } from "@tamagui/popper";
|
|
11
|
+
import { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext, usePopperContextSlow } from "@tamagui/popper";
|
|
12
12
|
import { Portal, needsPortalRepropagation } from "@tamagui/portal";
|
|
13
13
|
import { RemoveScroll } from "@tamagui/remove-scroll";
|
|
14
14
|
import { ScrollView } from "@tamagui/scroll-view";
|
|
@@ -77,7 +77,7 @@ function usePopoverTriggerSetup(open) {
|
|
|
77
77
|
unregisterTrigger
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
|
-
const PopoverContextProvider = React.memo(({ scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = "", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable }) => {
|
|
80
|
+
const PopoverContextProvider = React.memo(({ scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = "", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable, closeReasonRef }) => {
|
|
81
81
|
const [branches] = React.useState(() => /* @__PURE__ */ new Set());
|
|
82
82
|
const { setActiveTrigger, registerTrigger, unregisterTrigger } = usePopoverTriggerSetup(open);
|
|
83
83
|
return /* @__PURE__ */ jsx(PopoverContext.Provider, {
|
|
@@ -99,6 +99,7 @@ const PopoverContextProvider = React.memo(({ scope, children, open, onOpenChange
|
|
|
99
99
|
keepChildrenMounted,
|
|
100
100
|
disableDismissable,
|
|
101
101
|
hoverable,
|
|
102
|
+
closeReasonRef,
|
|
102
103
|
children: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {
|
|
103
104
|
scope,
|
|
104
105
|
triggerRef,
|
|
@@ -130,6 +131,7 @@ const PopoverAnchor = React.memo(createRefComponent(function PopoverAnchor2(prop
|
|
|
130
131
|
const PopoverTrigger = React.memo(createRefComponent(function PopoverTrigger2(props, forwardedRef) {
|
|
131
132
|
const { scope, disablePressTrigger, ...rest } = props;
|
|
132
133
|
const triggerContext = usePopoverTriggerContext(scope);
|
|
134
|
+
const popperContext = usePopperContextSlow(scope);
|
|
133
135
|
const triggerId = React.useId();
|
|
134
136
|
const [open, setOpen] = React.useState(false);
|
|
135
137
|
const anchorTo = triggerContext.anchorTo;
|
|
@@ -164,7 +166,13 @@ const PopoverTrigger = React.memo(createRefComponent(function PopoverTrigger2(pr
|
|
|
164
166
|
}),
|
|
165
167
|
onMouseEnter: composeEventHandlers(rest.onMouseEnter, activateSelf),
|
|
166
168
|
onPressIn: composeEventHandlers(rest.onPressIn, activateSelf),
|
|
167
|
-
onFocus: composeEventHandlers(rest.onFocus,
|
|
169
|
+
onFocus: composeEventHandlers(rest.onFocus, (event) => {
|
|
170
|
+
activateSelf();
|
|
171
|
+
popperContext.getReferenceProps?.({ ref: triggerElRef }).onFocus?.(event);
|
|
172
|
+
}),
|
|
173
|
+
onBlur: composeEventHandlers(rest.onBlur, (event) => {
|
|
174
|
+
popperContext.getReferenceProps?.({ ref: triggerElRef }).onBlur?.(event);
|
|
175
|
+
})
|
|
168
176
|
});
|
|
169
177
|
const virtualRef = React.useMemo(() => {
|
|
170
178
|
if (!anchorTo) return null;
|
|
@@ -329,7 +337,8 @@ const PopoverContentImpl = createRefComponent(function PopoverContentImpl2(props
|
|
|
329
337
|
disable: context.breakpointActive,
|
|
330
338
|
children
|
|
331
339
|
});
|
|
332
|
-
const handleDismiss = React.useCallback(() => {
|
|
340
|
+
const handleDismiss = React.useCallback((details) => {
|
|
341
|
+
if (context.closeReasonRef) context.closeReasonRef.current = details.reason === "escape-key" ? "escape-key" : "dismiss";
|
|
333
342
|
context.onOpenChange(false, "press");
|
|
334
343
|
}, [context]);
|
|
335
344
|
if (!context.breakpointActive) {
|
|
@@ -413,6 +422,7 @@ const Popover = withStaticProperties(createRefComponent(function Popover2({ scop
|
|
|
413
422
|
const adaptScope = `PopoverAdapt${scope}`;
|
|
414
423
|
const { open: openProp, defaultOpen, onOpenChange } = props;
|
|
415
424
|
const viaRef = React.useRef(void 0);
|
|
425
|
+
const closeReasonRef = React.useRef(void 0);
|
|
416
426
|
const [open, setOpen] = useControllableState({
|
|
417
427
|
prop: openProp,
|
|
418
428
|
defaultProp: defaultOpen || false,
|
|
@@ -433,6 +443,7 @@ const Popover = withStaticProperties(createRefComponent(function Popover2({ scop
|
|
|
433
443
|
}, [open, setOpen]);
|
|
434
444
|
return /* @__PURE__ */ jsx(AdaptParent, {
|
|
435
445
|
scope: adaptScope,
|
|
446
|
+
adaptChildren: props.children,
|
|
436
447
|
open,
|
|
437
448
|
onOpenChange: setOpen,
|
|
438
449
|
children: /* @__PURE__ */ jsx(PopoverInner, {
|
|
@@ -443,6 +454,7 @@ const Popover = withStaticProperties(createRefComponent(function Popover2({ scop
|
|
|
443
454
|
open,
|
|
444
455
|
setOpen,
|
|
445
456
|
handleOpenChange,
|
|
457
|
+
closeReasonRef,
|
|
446
458
|
...props
|
|
447
459
|
})
|
|
448
460
|
});
|
|
@@ -457,7 +469,7 @@ const Popover = withStaticProperties(createRefComponent(function Popover2({ scop
|
|
|
457
469
|
FocusScope: FocusScopeController
|
|
458
470
|
});
|
|
459
471
|
const PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef) {
|
|
460
|
-
const { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, ...restProps } = props;
|
|
472
|
+
const { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus = !hoverable, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, closeReasonRef, ...restProps } = props;
|
|
461
473
|
const triggerRef = React.useRef(null);
|
|
462
474
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
463
475
|
const [keepChildrenMounted] = useControllableState({
|
|
@@ -469,6 +481,7 @@ const PopoverInner = createRefComponent(function PopoverInner2(props, forwardedR
|
|
|
469
481
|
const floatingContext = useFloatingContext({
|
|
470
482
|
open,
|
|
471
483
|
setOpen: handleOpenChange,
|
|
484
|
+
closeReasonRef,
|
|
472
485
|
disable: isAdapted,
|
|
473
486
|
hoverable,
|
|
474
487
|
disableFocus
|
|
@@ -485,6 +498,7 @@ const PopoverInner = createRefComponent(function PopoverInner2(props, forwardedR
|
|
|
485
498
|
const contentId = React.useId();
|
|
486
499
|
const onOpenToggle = useEvent(() => {
|
|
487
500
|
if (open && isAdapted) return;
|
|
501
|
+
closeReasonRef.current = open ? "reference-press" : void 0;
|
|
488
502
|
setOpen(!open);
|
|
489
503
|
});
|
|
490
504
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
@@ -512,6 +526,7 @@ const PopoverInner = createRefComponent(function PopoverInner2(props, forwardedR
|
|
|
512
526
|
keepChildrenMounted,
|
|
513
527
|
disableDismissable,
|
|
514
528
|
hoverable,
|
|
529
|
+
closeReasonRef,
|
|
515
530
|
children
|
|
516
531
|
})
|
|
517
532
|
});
|
package/dist/esm/Popover.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","names":[],"sources":["esm/Popover.js"],"sourcesContent":["\nimport { Adapt, AdaptParent, AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { Animate } from \"@tamagui/animate\";\nimport { ResetPresence } from \"@tamagui/animate-presence\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledContext, createStyledHOC, useCreateShallowSetState, useEvent } from \"@tamagui/core\";\nimport { Dismissable, DismissableBranch } from \"@tamagui/dismissable\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\nimport { FocusScope, FocusScopeController } from \"@tamagui/focus-scope\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext } from \"@tamagui/popper\";\nimport { Portal, needsPortalRepropagation } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { useFloatingContext } from \"./useFloatingContext\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n\nconst needsRepropagation = needsPortalRepropagation();\nconst openPopovers = /* @__PURE__ */ new Set();\nconst hasOpenPopovers = () => {\n\treturn openPopovers.size > 0;\n};\nconst closeOpenPopovers = () => {\n\tif (openPopovers.size === 0) return false;\n\topenPopovers.forEach((setOpen) => setOpen(false));\n\treturn true;\n};\nconst closeLastOpenedPopover = () => {\n\tif (openPopovers.size === 0) return false;\n\tconst last = Array.from(openPopovers).pop();\n\tif (last) {\n\t\tlast(false);\n\t\treturn true;\n\t}\n\treturn false;\n};\nconst PopoverContext = createStyledContext({}, \"Popover__\");\nconst PopoverZIndexContext = React.createContext(void 0);\nconst PopoverTriggerContext = createStyledContext({}, \"PopoverTrigger__\");\nconst usePopoverContext = PopoverContext.useStyledContext;\nconst usePopoverTriggerContext = PopoverTriggerContext.useStyledContext;\nfunction usePopoverOpen(scope) {\n\treturn usePopoverContext(scope).open;\n}\nfunction usePopoverTriggerSetup(open) {\n\tconst triggerStateSettersRef = React.useRef(/* @__PURE__ */ new Map());\n\tconst activeTriggerIdRef = React.useRef(null);\n\tconst setActiveTrigger = useEvent((id) => {\n\t\tconst prevId = activeTriggerIdRef.current;\n\t\tif (prevId === id) return;\n\t\tif (prevId) triggerStateSettersRef.current.get(prevId)?.(false);\n\t\tactiveTriggerIdRef.current = id;\n\t\tif (id && open) triggerStateSettersRef.current.get(id)?.(true);\n\t});\n\tconst registerTrigger = useEvent((id, setOpenState) => {\n\t\ttriggerStateSettersRef.current.set(id, setOpenState);\n\t\tsetOpenState(activeTriggerIdRef.current === id && open);\n\t});\n\tconst unregisterTrigger = useEvent((id) => {\n\t\ttriggerStateSettersRef.current.delete(id);\n\t\tif (activeTriggerIdRef.current === id) activeTriggerIdRef.current = null;\n\t});\n\tReact.useEffect(() => {\n\t\tif (!open) {\n\t\t\tsetActiveTrigger(null);\n\t\t\treturn;\n\t\t}\n\t\tconst activeId = activeTriggerIdRef.current;\n\t\tif (activeId) triggerStateSettersRef.current.get(activeId)?.(true);\n\t}, [open, setActiveTrigger]);\n\treturn {\n\t\tsetActiveTrigger,\n\t\tregisterTrigger,\n\t\tunregisterTrigger\n\t};\n}\nconst PopoverContextProvider = React.memo(({ scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = \"\", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable }) => {\n\tconst [branches] = React.useState(() => /* @__PURE__ */ new Set());\n\tconst { setActiveTrigger, registerTrigger, unregisterTrigger } = usePopoverTriggerSetup(open);\n\treturn /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\tscope,\n\t\tpopoverScope: scope,\n\t\tadaptScope,\n\t\tid,\n\t\tcontentId,\n\t\ttriggerRef,\n\t\topen,\n\t\tonOpenChange,\n\t\tonOpenToggle,\n\t\thasCustomAnchor,\n\t\tonCustomAnchorAdd,\n\t\tonCustomAnchorRemove,\n\t\tanchorTo,\n\t\tbranches,\n\t\tbreakpointActive,\n\t\tkeepChildrenMounted,\n\t\tdisableDismissable,\n\t\thoverable,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\tscope,\n\t\t\ttriggerRef,\n\t\t\thasCustomAnchor,\n\t\t\tanchorTo,\n\t\t\tbranches,\n\t\t\tonOpenToggle,\n\t\t\tsetActiveTrigger,\n\t\t\tregisterTrigger,\n\t\t\tunregisterTrigger,\n\t\t\tchildren\n\t\t})\n\t});\n});\nconst voidFn = () => {};\nconst PopoverAnchor = React.memo(createRefComponent(function PopoverAnchor2(props, forwardedRef) {\n\tconst { scope, ...rest } = props;\n\tconst { onCustomAnchorAdd, onCustomAnchorRemove } = usePopoverContext(scope) || {};\n\tReact.useEffect(() => {\n\t\tonCustomAnchorAdd();\n\t\treturn () => onCustomAnchorRemove();\n\t}, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\treturn /* @__PURE__ */ jsx(PopperAnchor, {\n\t\tscope,\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n}));\nconst PopoverTrigger = React.memo(createRefComponent(function PopoverTrigger2(props, forwardedRef) {\n\tconst { scope, disablePressTrigger, ...rest } = props;\n\tconst triggerContext = usePopoverTriggerContext(scope);\n\tconst triggerId = React.useId();\n\tconst [open, setOpen] = React.useState(false);\n\tconst anchorTo = triggerContext.anchorTo;\n\tconst triggerElRef = React.useRef(null);\n\tconst composedTriggerRef = useComposedRefs(forwardedRef, triggerElRef);\n\tconst { registerTrigger, unregisterTrigger } = triggerContext;\n\tReact.useEffect(() => {\n\t\tregisterTrigger(triggerId, setOpen);\n\t\treturn () => {\n\t\t\tunregisterTrigger(triggerId);\n\t\t};\n\t}, [\n\t\tregisterTrigger,\n\t\tunregisterTrigger,\n\t\ttriggerId\n\t]);\n\tif (!rest.children) return null;\n\tconst activateSelf = () => {\n\t\ttriggerContext.setActiveTrigger(triggerId);\n\t\tconst el = triggerElRef.current;\n\t\tif (el) triggerContext.triggerRef.current = el;\n\t};\n\tconst trigger = /* @__PURE__ */ jsx(View, {\n\t\t\"aria-expanded\": open,\n\t\t\"data-state\": getState(open),\n\t\t...rest,\n\t\tref: composedTriggerRef,\n\t\tonPress: composeEventHandlers(rest.onPress, () => {\n\t\t\tif (disablePressTrigger) return;\n\t\t\ttriggerContext.setActiveTrigger(open ? null : triggerId);\n\t\t\ttriggerContext.onOpenToggle();\n\t\t}),\n\t\tonMouseEnter: composeEventHandlers(rest.onMouseEnter, activateSelf),\n\t\tonPressIn: composeEventHandlers(rest.onPressIn, activateSelf),\n\t\tonFocus: composeEventHandlers(rest.onFocus, activateSelf)\n\t});\n\tconst virtualRef = React.useMemo(() => {\n\t\tif (!anchorTo) return null;\n\t\treturn { current: {\n\t\t\tgetBoundingClientRect: () => isWeb ? DOMRect.fromRect(anchorTo) : anchorTo,\n\t\t\t...!isWeb && {\n\t\t\t\tmeasure: (c) => c(anchorTo?.x, anchorTo?.y, anchorTo?.width, anchorTo?.height),\n\t\t\t\tmeasureInWindow: (c) => c(anchorTo?.x, anchorTo?.y, anchorTo?.width, anchorTo?.height)\n\t\t\t}\n\t\t} };\n\t}, [\n\t\ttriggerContext.anchorTo,\n\t\tanchorTo?.x,\n\t\tanchorTo?.y,\n\t\tanchorTo?.height,\n\t\tanchorTo?.width\n\t]);\n\tconst wrappedTrigger = isWeb ? /* @__PURE__ */ jsx(DismissableBranch, {\n\t\tbranches: triggerContext.branches,\n\t\tchildren: trigger\n\t}) : trigger;\n\treturn triggerContext.hasCustomAnchor ? wrappedTrigger : /* @__PURE__ */ jsx(PopperAnchor, {\n\t\t...virtualRef && { virtualRef },\n\t\tscope,\n\t\tasChild: true,\n\t\tchildren: wrappedTrigger\n\t});\n}));\nconst PopoverContent = createStyledHOC(PopperContentFrame, function PopoverContent2(props, forwardedRef) {\n\tconst { trapFocus, enableRemoveScroll = false, zIndex: zIndexProp, scope, forceMount, ...contentImplProps } = props;\n\tconst context = usePopoverContext(scope);\n\tconst adaptContext = useAdaptContext(context.adaptScope);\n\tconst zIndexFromContext = React.useContext(PopoverZIndexContext);\n\tconst zIndex = zIndexProp ?? zIndexFromContext;\n\tconst open = usePopoverOpen(scope);\n\tconst composedRefs = useComposedRefs(forwardedRef, React.useRef(null));\n\tconst isRightClickOutsideRef = React.useRef(false);\n\tconst [isFullyHidden, setIsFullyHidden] = React.useState(!open);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (open && isFullyHidden) setIsFullyHidden(false);\n\t}, [open, isFullyHidden]);\n\tif (!forceMount && !context.keepChildrenMounted) {\n\t\tif (context.breakpointActive) {\n\t\t\tif (!open && adaptContext.targetFullyHidden) return null;\n\t\t} else if (isFullyHidden && !open) return null;\n\t}\n\treturn /* @__PURE__ */ jsx(PopoverPortal, {\n\t\tpassThrough: context.breakpointActive,\n\t\tcontext,\n\t\topen,\n\t\tvisuallyActive: open || !isFullyHidden,\n\t\tzIndex,\n\t\tchildren: /* @__PURE__ */ jsx(View, {\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\tpointerEvents: open ? contentImplProps.pointerEvents ?? \"auto\" : \"none\",\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverContentImpl, {\n\t\t\t\t...contentImplProps,\n\t\t\t\tcontext,\n\t\t\t\topen,\n\t\t\t\tforceMount,\n\t\t\t\tenableRemoveScroll,\n\t\t\t\tref: composedRefs,\n\t\t\t\tsetIsFullyHidden,\n\t\t\t\tscope,\n\t\t\t\ttrapFocus: trapFocus ?? open,\n\t\t\t\tdisableOutsidePointerEvents: true,\n\t\t\t\tonCloseAutoFocus: props.onCloseAutoFocus === false ? void 0 : composeEventHandlers(props.onCloseAutoFocus, (event) => {\n\t\t\t\t\tif (event.isCanceled) return;\n\t\t\t\t\tevent.cancel();\n\t\t\t\t\tif (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n\t\t\t\t}),\n\t\t\t\tonPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {\n\t\t\t\t\tconst originalEvent = event.event;\n\t\t\t\t\tif (!originalEvent) return;\n\t\t\t\t\tconst ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n\t\t\t\t\tisRightClickOutsideRef.current = originalEvent.button === 2 || ctrlLeftClick;\n\t\t\t\t}, { checkDefaultPrevented: false }),\n\t\t\t\tonFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {\n\t\t\t\t\tif (trapFocus ?? open) event.cancel();\n\t\t\t\t}, { checkDefaultPrevented: false })\n\t\t\t})\n\t\t})\n\t});\n}, { staticConfig: { inlineProps: /* @__PURE__ */ new Set([\n\t...PopperContentFrame.staticConfig.inlineProps || [],\n\t\"zIndex\",\n\t\"opacity\",\n\t\"y\"\n]) } });\nconst useParentContexts = (scope) => {\n\tconst context = usePopoverContext(scope);\n\tconst triggerContext = usePopoverTriggerContext(scope);\n\treturn {\n\t\tpopperContext: usePopperContext(scope),\n\t\tadaptContext: useAdaptContext(context.adaptScope),\n\t\tcontext,\n\t\ttriggerContext\n\t};\n};\nfunction RepropagateParentContexts({ adaptContext, children, context, triggerContext, popperContext }) {\n\treturn /* @__PURE__ */ jsx(PopperProvider, {\n\t\tscope: context.popoverScope,\n\t\t...popperContext,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\t\tscope: context.popoverScope,\n\t\t\t...context,\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\t\tscope: context.popoverScope,\n\t\t\t\t...triggerContext,\n\t\t\t\tchildren: /* @__PURE__ */ jsx(ProvideAdaptContext, {\n\t\t\t\t\t...adaptContext,\n\t\t\t\t\tchildren\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t});\n}\nconst PortalAdaptSafe = ({ children, context }) => {\n\t\"use no memo\";\n\tif (needsRepropagation) {\n\t\tconst parentContexts = useParentContexts(context.popoverScope);\n\t\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\t\tscope: context.adaptScope,\n\t\t\tchildren: /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t\t\t...parentContexts,\n\t\t\t\tchildren\n\t\t\t})\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\tscope: context.adaptScope,\n\t\tchildren\n\t});\n};\nfunction PopoverPortal({ context, open, visuallyActive, zIndex, passThrough, children, onPress }) {\n\t\"use no memo\";\n\tlet content = children;\n\tif (needsRepropagation) content = /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t...useParentContexts(context.popoverScope),\n\t\tchildren: content\n\t});\n\treturn /* @__PURE__ */ jsxs(Portal, {\n\t\tpassThrough,\n\t\tstackZIndex: true,\n\t\tzIndex,\n\t\thidden: !visuallyActive,\n\t\tchildren: [!!open && !context.breakpointActive && !context.hoverable && /* @__PURE__ */ jsx(YStack, {\n\t\t\tposition: \"absolute\",\n\t\t\tinset: 0,\n\t\t\tonPress: composeEventHandlers(onPress, context.onOpenToggle)\n\t\t}), content]\n\t});\n}\nconst PopoverContentImpl = createRefComponent(function PopoverContentImpl2(props, forwardedRef) {\n\tconst { trapFocus, scope, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, disableFocusScope, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, children, enableRemoveScroll, freezeContentsWhenHidden, setIsFullyHidden, lazyMount, forceUnmount, forceMount, context, open, alwaysDisable, ...contentProps } = props;\n\tconst { disableDismissable } = context;\n\tconst keepChildrenMounted = context.keepChildrenMounted || forceMount;\n\tconst handleExitComplete = React.useCallback(() => {\n\t\tsetIsFullyHidden?.(true);\n\t}, [setIsFullyHidden]);\n\tlet contents = /* @__PURE__ */ jsx(ResetPresence, {\n\t\tdisable: context.breakpointActive,\n\t\tchildren\n\t});\n\tconst handleDismiss = React.useCallback(() => {\n\t\tcontext.onOpenChange(false, \"press\");\n\t}, [context]);\n\tif (!context.breakpointActive) {\n\t\tif (!alwaysDisable || !alwaysDisable.focus) contents = /* @__PURE__ */ jsx(FocusScope, {\n\t\t\tloop: trapFocus !== false,\n\t\t\tenabled: context.breakpointActive ? false : disableFocusScope ? false : open,\n\t\t\ttrapped: context.breakpointActive ? false : trapFocus,\n\t\t\tonMountAutoFocus: onOpenAutoFocus,\n\t\t\tonUnmountAutoFocus: onCloseAutoFocus === false ? void 0 : onCloseAutoFocus,\n\t\t\tchildren: contents\n\t\t});\n\t\tif (!alwaysDisable || !alwaysDisable[\"remove-scroll\"]) contents = /* @__PURE__ */ jsx(RemoveScroll, {\n\t\t\tenabled: context.breakpointActive ? false : enableRemoveScroll ? open : false,\n\t\t\tchildren: contents\n\t\t});\n\t\tif (!alwaysDisable || !alwaysDisable.dismiss) contents = /* @__PURE__ */ jsx(Dismissable, {\n\t\t\tbranches: context.branches,\n\t\t\tforceUnmount: disableDismissable || (forceUnmount ?? !open),\n\t\t\tonEscapeKeyDown,\n\t\t\tonPointerDownOutside,\n\t\t\tonFocusOutside,\n\t\t\tonInteractOutside,\n\t\t\tonDismiss: handleDismiss,\n\t\t\tchildren: contents\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(Animate, {\n\t\ttype: \"presence\",\n\t\tpresent: Boolean(open),\n\t\tkeepChildrenMounted: Boolean(keepChildrenMounted),\n\t\tonExitComplete: handleExitComplete,\n\t\tlazyMount,\n\t\tpassThrough: context.breakpointActive,\n\t\tchildren: /* @__PURE__ */ jsx(PopperContent, {\n\t\t\tscope,\n\t\t\t\"data-state\": getState(open),\n\t\t\tid: context.contentId,\n\t\t\tref: forwardedRef,\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\t...contentProps,\n\t\t\tchildren: /* @__PURE__ */ jsx(PortalAdaptSafe, {\n\t\t\t\tcontext,\n\t\t\t\tchildren: contents\n\t\t\t})\n\t\t}, context.contentId)\n\t});\n});\nconst PopoverClose = createRefComponent(function PopoverClose2(props, forwardedRef) {\n\tconst { scope, className, ...rest } = props;\n\tconst context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(YStack, {\n\t\t...rest,\n\t\tref: forwardedRef,\n\t\tclassName: `is_PopoverClose ${className || \"\"}`.trim(),\n\t\tonPress: composeEventHandlers(props.onPress, () => context?.onOpenChange?.(false, \"press\"))\n\t});\n});\nconst PopoverArrow = createStyledHOC(PopperArrowFrame, function PopoverArrow2(props, forwardedRef) {\n\tconst { scope, className, ...rest } = props;\n\tif (useAdaptIsActive(usePopoverContext(scope).adaptScope)) return null;\n\treturn /* @__PURE__ */ jsx(PopperArrow, {\n\t\tscope,\n\t\tclassName: `is_PopoverArrow ${className || \"\"}`.trim(),\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n});\nconst PopoverScrollView = createRefComponent(({ scope, ...props }, ref) => {\n\tconst context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(ScrollView, {\n\t\tref,\n\t\tpointerEvents: context.breakpointActive ? \"none\" : void 0,\n\t\tscrollEnabled: !context.breakpointActive,\n\t\tpassThrough: context.breakpointActive,\n\t\t...props\n\t});\n});\nconst DEFAULT_SCOPE = \"\";\nconst Popover = withStaticProperties(createRefComponent(function Popover2({ scope = DEFAULT_SCOPE, ...props }, ref) {\n\tconst id = React.useId();\n\tconst adaptScope = `PopoverAdapt${scope}`;\n\tconst { open: openProp, defaultOpen, onOpenChange } = props;\n\tconst viaRef = React.useRef(void 0);\n\tconst [open, setOpen] = useControllableState({\n\t\tprop: openProp,\n\t\tdefaultProp: defaultOpen || false,\n\t\tonChange: (val) => {\n\t\t\tonOpenChange?.(val, viaRef.current);\n\t\t}\n\t});\n\tconst handleOpenChange = useEvent((val, via) => {\n\t\tviaRef.current = via;\n\t\tsetOpen(val);\n\t});\n\tReact.useEffect(() => {\n\t\tif (!open) return;\n\t\topenPopovers.add(setOpen);\n\t\treturn () => {\n\t\t\topenPopovers.delete(setOpen);\n\t\t};\n\t}, [open, setOpen]);\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverInner, {\n\t\t\tadaptScope,\n\t\t\tref,\n\t\t\tid,\n\t\t\tscope,\n\t\t\topen,\n\t\t\tsetOpen,\n\t\t\thandleOpenChange,\n\t\t\t...props\n\t\t})\n\t});\n}), {\n\tAnchor: PopoverAnchor,\n\tArrow: PopoverArrow,\n\tTrigger: PopoverTrigger,\n\tContent: PopoverContent,\n\tClose: PopoverClose,\n\tAdapt,\n\tScrollView: PopoverScrollView,\n\tFocusScope: FocusScopeController\n});\nconst PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef) {\n\tconst { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, ...restProps } = props;\n\tconst triggerRef = React.useRef(null);\n\tconst [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n\tconst [keepChildrenMounted] = useControllableState({\n\t\tprop: keepChildrenMountedProp,\n\t\tdefaultProp: false,\n\t\ttransition: keepChildrenMountedProp === \"lazy\"\n\t});\n\tconst isAdapted = useAdaptIsActive(adaptScope);\n\tconst floatingContext = useFloatingContext({\n\t\topen,\n\t\tsetOpen: handleOpenChange,\n\t\tdisable: isAdapted,\n\t\thoverable,\n\t\tdisableFocus\n\t});\n\tconst [anchorTo, setAnchorToRaw] = React.useState();\n\tconst setAnchorTo = useCreateShallowSetState(setAnchorToRaw);\n\tReact.useImperativeHandle(forwardedRef, () => ({\n\t\tanchorTo: setAnchorTo,\n\t\ttoggle: () => setOpen((prev) => !prev),\n\t\topen: () => setOpen(true),\n\t\tclose: () => setOpen(false),\n\t\tsetOpen\n\t}));\n\tconst contentId = React.useId();\n\tconst onOpenToggle = useEvent(() => {\n\t\tif (open && isAdapted) return;\n\t\tsetOpen(!open);\n\t});\n\tconst onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);\n\tconst onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);\n\tconst contents = /* @__PURE__ */ jsx(Popper, {\n\t\topen,\n\t\tpassThrough: isAdapted,\n\t\tscope,\n\t\tstayInFrame: true,\n\t\t...restProps,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContextProvider, {\n\t\t\tscope,\n\t\t\topen,\n\t\t\tonOpenChange: handleOpenChange,\n\t\t\tonOpenToggle,\n\t\t\ttriggerRef,\n\t\t\tid,\n\t\t\tcontentId,\n\t\t\thasCustomAnchor,\n\t\t\tonCustomAnchorAdd,\n\t\t\tonCustomAnchorRemove,\n\t\t\tanchorTo,\n\t\t\tadaptScope,\n\t\t\tbreakpointActive: isAdapted,\n\t\t\tkeepChildrenMounted,\n\t\t\tdisableDismissable,\n\t\t\thoverable,\n\t\t\tchildren\n\t\t})\n\t});\n\tlet result = /* @__PURE__ */ jsx(Fragment, { children: isWeb ? /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, {\n\t\tvalue: floatingContext,\n\t\tchildren: contents\n\t}) : contents });\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(PopoverZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: result\n\t});\n\treturn result;\n});\nfunction getState(open) {\n\treturn open ? \"open\" : \"closed\";\n}\n\nexport { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverContext, PopoverContextProvider, PopoverTrigger, PopoverTriggerContext, PopoverZIndexContext, closeLastOpenedPopover, closeOpenPopovers, hasOpenPopovers, usePopoverContext, usePopoverOpen, usePopoverTriggerContext, usePopoverTriggerSetup };"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,qBAAqB,yBAAyB;AACpD,MAAM,+BAA+B,IAAI,IAAI;AAC7C,MAAM,wBAAwB;CAC7B,OAAO,aAAa,OAAO;AAC5B;AACA,MAAM,0BAA0B;CAC/B,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,aAAa,SAAS,YAAY,QAAQ,KAAK,CAAC;CAChD,OAAO;AACR;AACA,MAAM,+BAA+B;CACpC,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,MAAM,OAAO,MAAM,KAAK,YAAY,CAAC,CAAC,IAAI;CAC1C,IAAI,MAAM;EACT,KAAK,KAAK;EACV,OAAO;CACR;CACA,OAAO;AACR;AACA,MAAM,iBAAiB,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AU;CACX,CAAC,IAAI,SAAS,CAAC;CACf,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,qBAAqB,UAAU;EAChF,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR,CAAC;AACD,SAAS,SAAS,MAAM;CACvB,OAAO,OAAO,SAAS;AACxB"}
|
|
1
|
+
{"version":3,"file":"Popover.js","names":[],"sources":["esm/Popover.js"],"sourcesContent":["\nimport { Adapt, AdaptParent, AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { Animate } from \"@tamagui/animate\";\nimport { ResetPresence } from \"@tamagui/animate-presence\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledContext, createStyledHOC, useCreateShallowSetState, useEvent } from \"@tamagui/core\";\nimport { Dismissable, DismissableBranch } from \"@tamagui/dismissable\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\nimport { FocusScope, FocusScopeController } from \"@tamagui/focus-scope\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext, usePopperContextSlow } from \"@tamagui/popper\";\nimport { Portal, needsPortalRepropagation } from \"@tamagui/portal\";\nimport { RemoveScroll } from \"@tamagui/remove-scroll\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { useFloatingContext } from \"./useFloatingContext\";\nimport { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n\nconst needsRepropagation = needsPortalRepropagation();\nconst openPopovers = /* @__PURE__ */ new Set();\nconst hasOpenPopovers = () => {\n\treturn openPopovers.size > 0;\n};\nconst closeOpenPopovers = () => {\n\tif (openPopovers.size === 0) return false;\n\topenPopovers.forEach((setOpen) => setOpen(false));\n\treturn true;\n};\nconst closeLastOpenedPopover = () => {\n\tif (openPopovers.size === 0) return false;\n\tconst last = Array.from(openPopovers).pop();\n\tif (last) {\n\t\tlast(false);\n\t\treturn true;\n\t}\n\treturn false;\n};\nconst PopoverContext = createStyledContext({}, \"Popover__\");\nconst PopoverZIndexContext = React.createContext(void 0);\nconst PopoverTriggerContext = createStyledContext({}, \"PopoverTrigger__\");\nconst usePopoverContext = PopoverContext.useStyledContext;\nconst usePopoverTriggerContext = PopoverTriggerContext.useStyledContext;\nfunction usePopoverOpen(scope) {\n\treturn usePopoverContext(scope).open;\n}\nfunction usePopoverTriggerSetup(open) {\n\tconst triggerStateSettersRef = React.useRef(/* @__PURE__ */ new Map());\n\tconst activeTriggerIdRef = React.useRef(null);\n\tconst setActiveTrigger = useEvent((id) => {\n\t\tconst prevId = activeTriggerIdRef.current;\n\t\tif (prevId === id) return;\n\t\tif (prevId) triggerStateSettersRef.current.get(prevId)?.(false);\n\t\tactiveTriggerIdRef.current = id;\n\t\tif (id && open) triggerStateSettersRef.current.get(id)?.(true);\n\t});\n\tconst registerTrigger = useEvent((id, setOpenState) => {\n\t\ttriggerStateSettersRef.current.set(id, setOpenState);\n\t\tsetOpenState(activeTriggerIdRef.current === id && open);\n\t});\n\tconst unregisterTrigger = useEvent((id) => {\n\t\ttriggerStateSettersRef.current.delete(id);\n\t\tif (activeTriggerIdRef.current === id) activeTriggerIdRef.current = null;\n\t});\n\tReact.useEffect(() => {\n\t\tif (!open) {\n\t\t\tsetActiveTrigger(null);\n\t\t\treturn;\n\t\t}\n\t\tconst activeId = activeTriggerIdRef.current;\n\t\tif (activeId) triggerStateSettersRef.current.get(activeId)?.(true);\n\t}, [open, setActiveTrigger]);\n\treturn {\n\t\tsetActiveTrigger,\n\t\tregisterTrigger,\n\t\tunregisterTrigger\n\t};\n}\nconst PopoverContextProvider = React.memo(({ scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = \"\", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable, closeReasonRef }) => {\n\tconst [branches] = React.useState(() => /* @__PURE__ */ new Set());\n\tconst { setActiveTrigger, registerTrigger, unregisterTrigger } = usePopoverTriggerSetup(open);\n\treturn /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\tscope,\n\t\tpopoverScope: scope,\n\t\tadaptScope,\n\t\tid,\n\t\tcontentId,\n\t\ttriggerRef,\n\t\topen,\n\t\tonOpenChange,\n\t\tonOpenToggle,\n\t\thasCustomAnchor,\n\t\tonCustomAnchorAdd,\n\t\tonCustomAnchorRemove,\n\t\tanchorTo,\n\t\tbranches,\n\t\tbreakpointActive,\n\t\tkeepChildrenMounted,\n\t\tdisableDismissable,\n\t\thoverable,\n\t\tcloseReasonRef,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\tscope,\n\t\t\ttriggerRef,\n\t\t\thasCustomAnchor,\n\t\t\tanchorTo,\n\t\t\tbranches,\n\t\t\tonOpenToggle,\n\t\t\tsetActiveTrigger,\n\t\t\tregisterTrigger,\n\t\t\tunregisterTrigger,\n\t\t\tchildren\n\t\t})\n\t});\n});\nconst voidFn = () => {};\nconst PopoverAnchor = React.memo(createRefComponent(function PopoverAnchor2(props, forwardedRef) {\n\tconst { scope, ...rest } = props;\n\tconst { onCustomAnchorAdd, onCustomAnchorRemove } = usePopoverContext(scope) || {};\n\tReact.useEffect(() => {\n\t\tonCustomAnchorAdd();\n\t\treturn () => onCustomAnchorRemove();\n\t}, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\treturn /* @__PURE__ */ jsx(PopperAnchor, {\n\t\tscope,\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n}));\nconst PopoverTrigger = React.memo(createRefComponent(function PopoverTrigger2(props, forwardedRef) {\n\tconst { scope, disablePressTrigger, ...rest } = props;\n\tconst triggerContext = usePopoverTriggerContext(scope);\n\tconst popperContext = usePopperContextSlow(scope);\n\tconst triggerId = React.useId();\n\tconst [open, setOpen] = React.useState(false);\n\tconst anchorTo = triggerContext.anchorTo;\n\tconst triggerElRef = React.useRef(null);\n\tconst composedTriggerRef = useComposedRefs(forwardedRef, triggerElRef);\n\tconst { registerTrigger, unregisterTrigger } = triggerContext;\n\tReact.useEffect(() => {\n\t\tregisterTrigger(triggerId, setOpen);\n\t\treturn () => {\n\t\t\tunregisterTrigger(triggerId);\n\t\t};\n\t}, [\n\t\tregisterTrigger,\n\t\tunregisterTrigger,\n\t\ttriggerId\n\t]);\n\tif (!rest.children) return null;\n\tconst activateSelf = () => {\n\t\ttriggerContext.setActiveTrigger(triggerId);\n\t\tconst el = triggerElRef.current;\n\t\tif (el) triggerContext.triggerRef.current = el;\n\t};\n\tconst trigger = /* @__PURE__ */ jsx(View, {\n\t\t\"aria-expanded\": open,\n\t\t\"data-state\": getState(open),\n\t\t...rest,\n\t\tref: composedTriggerRef,\n\t\tonPress: composeEventHandlers(rest.onPress, () => {\n\t\t\tif (disablePressTrigger) return;\n\t\t\ttriggerContext.setActiveTrigger(open ? null : triggerId);\n\t\t\ttriggerContext.onOpenToggle();\n\t\t}),\n\t\tonMouseEnter: composeEventHandlers(rest.onMouseEnter, activateSelf),\n\t\tonPressIn: composeEventHandlers(rest.onPressIn, activateSelf),\n\t\tonFocus: composeEventHandlers(rest.onFocus, (event) => {\n\t\t\tactivateSelf();\n\t\t\tpopperContext.getReferenceProps?.({ ref: triggerElRef }).onFocus?.(event);\n\t\t}),\n\t\tonBlur: composeEventHandlers(rest.onBlur, (event) => {\n\t\t\tpopperContext.getReferenceProps?.({ ref: triggerElRef }).onBlur?.(event);\n\t\t})\n\t});\n\tconst virtualRef = React.useMemo(() => {\n\t\tif (!anchorTo) return null;\n\t\treturn { current: {\n\t\t\tgetBoundingClientRect: () => isWeb ? DOMRect.fromRect(anchorTo) : anchorTo,\n\t\t\t...!isWeb && {\n\t\t\t\tmeasure: (c) => c(anchorTo?.x, anchorTo?.y, anchorTo?.width, anchorTo?.height),\n\t\t\t\tmeasureInWindow: (c) => c(anchorTo?.x, anchorTo?.y, anchorTo?.width, anchorTo?.height)\n\t\t\t}\n\t\t} };\n\t}, [\n\t\ttriggerContext.anchorTo,\n\t\tanchorTo?.x,\n\t\tanchorTo?.y,\n\t\tanchorTo?.height,\n\t\tanchorTo?.width\n\t]);\n\tconst wrappedTrigger = isWeb ? /* @__PURE__ */ jsx(DismissableBranch, {\n\t\tbranches: triggerContext.branches,\n\t\tchildren: trigger\n\t}) : trigger;\n\treturn triggerContext.hasCustomAnchor ? wrappedTrigger : /* @__PURE__ */ jsx(PopperAnchor, {\n\t\t...virtualRef && { virtualRef },\n\t\tscope,\n\t\tasChild: true,\n\t\tchildren: wrappedTrigger\n\t});\n}));\nconst PopoverContent = createStyledHOC(PopperContentFrame, function PopoverContent2(props, forwardedRef) {\n\tconst { trapFocus, enableRemoveScroll = false, zIndex: zIndexProp, scope, forceMount, ...contentImplProps } = props;\n\tconst context = usePopoverContext(scope);\n\tconst adaptContext = useAdaptContext(context.adaptScope);\n\tconst zIndexFromContext = React.useContext(PopoverZIndexContext);\n\tconst zIndex = zIndexProp ?? zIndexFromContext;\n\tconst open = usePopoverOpen(scope);\n\tconst composedRefs = useComposedRefs(forwardedRef, React.useRef(null));\n\tconst isRightClickOutsideRef = React.useRef(false);\n\tconst [isFullyHidden, setIsFullyHidden] = React.useState(!open);\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (open && isFullyHidden) setIsFullyHidden(false);\n\t}, [open, isFullyHidden]);\n\tif (!forceMount && !context.keepChildrenMounted) {\n\t\tif (context.breakpointActive) {\n\t\t\tif (!open && adaptContext.targetFullyHidden) return null;\n\t\t} else if (isFullyHidden && !open) return null;\n\t}\n\treturn /* @__PURE__ */ jsx(PopoverPortal, {\n\t\tpassThrough: context.breakpointActive,\n\t\tcontext,\n\t\topen,\n\t\tvisuallyActive: open || !isFullyHidden,\n\t\tzIndex,\n\t\tchildren: /* @__PURE__ */ jsx(View, {\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\tpointerEvents: open ? contentImplProps.pointerEvents ?? \"auto\" : \"none\",\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverContentImpl, {\n\t\t\t\t...contentImplProps,\n\t\t\t\tcontext,\n\t\t\t\topen,\n\t\t\t\tforceMount,\n\t\t\t\tenableRemoveScroll,\n\t\t\t\tref: composedRefs,\n\t\t\t\tsetIsFullyHidden,\n\t\t\t\tscope,\n\t\t\t\ttrapFocus: trapFocus ?? open,\n\t\t\t\tdisableOutsidePointerEvents: true,\n\t\t\t\tonCloseAutoFocus: props.onCloseAutoFocus === false ? void 0 : composeEventHandlers(props.onCloseAutoFocus, (event) => {\n\t\t\t\t\tif (event.isCanceled) return;\n\t\t\t\t\tevent.cancel();\n\t\t\t\t\tif (!isRightClickOutsideRef.current) context.triggerRef.current?.focus();\n\t\t\t\t}),\n\t\t\t\tonPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {\n\t\t\t\t\tconst originalEvent = event.event;\n\t\t\t\t\tif (!originalEvent) return;\n\t\t\t\t\tconst ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n\t\t\t\t\tisRightClickOutsideRef.current = originalEvent.button === 2 || ctrlLeftClick;\n\t\t\t\t}, { checkDefaultPrevented: false }),\n\t\t\t\tonFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => {\n\t\t\t\t\tif (trapFocus ?? open) event.cancel();\n\t\t\t\t}, { checkDefaultPrevented: false })\n\t\t\t})\n\t\t})\n\t});\n}, { staticConfig: { inlineProps: /* @__PURE__ */ new Set([\n\t...PopperContentFrame.staticConfig.inlineProps || [],\n\t\"zIndex\",\n\t\"opacity\",\n\t\"y\"\n]) } });\nconst useParentContexts = (scope) => {\n\tconst context = usePopoverContext(scope);\n\tconst triggerContext = usePopoverTriggerContext(scope);\n\treturn {\n\t\tpopperContext: usePopperContext(scope),\n\t\tadaptContext: useAdaptContext(context.adaptScope),\n\t\tcontext,\n\t\ttriggerContext\n\t};\n};\nfunction RepropagateParentContexts({ adaptContext, children, context, triggerContext, popperContext }) {\n\treturn /* @__PURE__ */ jsx(PopperProvider, {\n\t\tscope: context.popoverScope,\n\t\t...popperContext,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\t\tscope: context.popoverScope,\n\t\t\t...context,\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\t\tscope: context.popoverScope,\n\t\t\t\t...triggerContext,\n\t\t\t\tchildren: /* @__PURE__ */ jsx(ProvideAdaptContext, {\n\t\t\t\t\t...adaptContext,\n\t\t\t\t\tchildren\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t});\n}\nconst PortalAdaptSafe = ({ children, context }) => {\n\t\"use no memo\";\n\tif (needsRepropagation) {\n\t\tconst parentContexts = useParentContexts(context.popoverScope);\n\t\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\t\tscope: context.adaptScope,\n\t\t\tchildren: /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t\t\t...parentContexts,\n\t\t\t\tchildren\n\t\t\t})\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\tscope: context.adaptScope,\n\t\tchildren\n\t});\n};\nfunction PopoverPortal({ context, open, visuallyActive, zIndex, passThrough, children, onPress }) {\n\t\"use no memo\";\n\tlet content = children;\n\tif (needsRepropagation) content = /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t...useParentContexts(context.popoverScope),\n\t\tchildren: content\n\t});\n\treturn /* @__PURE__ */ jsxs(Portal, {\n\t\tpassThrough,\n\t\tstackZIndex: true,\n\t\tzIndex,\n\t\thidden: !visuallyActive,\n\t\tchildren: [!!open && !context.breakpointActive && !context.hoverable && /* @__PURE__ */ jsx(YStack, {\n\t\t\tposition: \"absolute\",\n\t\t\tinset: 0,\n\t\t\tonPress: composeEventHandlers(onPress, context.onOpenToggle)\n\t\t}), content]\n\t});\n}\nconst PopoverContentImpl = createRefComponent(function PopoverContentImpl2(props, forwardedRef) {\n\tconst { trapFocus, scope, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, disableFocusScope, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, children, enableRemoveScroll, freezeContentsWhenHidden, setIsFullyHidden, lazyMount, forceUnmount, forceMount, context, open, alwaysDisable, ...contentProps } = props;\n\tconst { disableDismissable } = context;\n\tconst keepChildrenMounted = context.keepChildrenMounted || forceMount;\n\tconst handleExitComplete = React.useCallback(() => {\n\t\tsetIsFullyHidden?.(true);\n\t}, [setIsFullyHidden]);\n\tlet contents = /* @__PURE__ */ jsx(ResetPresence, {\n\t\tdisable: context.breakpointActive,\n\t\tchildren\n\t});\n\tconst handleDismiss = React.useCallback((details) => {\n\t\tif (context.closeReasonRef) context.closeReasonRef.current = details.reason === \"escape-key\" ? \"escape-key\" : \"dismiss\";\n\t\tcontext.onOpenChange(false, \"press\");\n\t}, [context]);\n\tif (!context.breakpointActive) {\n\t\tif (!alwaysDisable || !alwaysDisable.focus) contents = /* @__PURE__ */ jsx(FocusScope, {\n\t\t\tloop: trapFocus !== false,\n\t\t\tenabled: context.breakpointActive ? false : disableFocusScope ? false : open,\n\t\t\ttrapped: context.breakpointActive ? false : trapFocus,\n\t\t\tonMountAutoFocus: onOpenAutoFocus,\n\t\t\tonUnmountAutoFocus: onCloseAutoFocus === false ? void 0 : onCloseAutoFocus,\n\t\t\tchildren: contents\n\t\t});\n\t\tif (!alwaysDisable || !alwaysDisable[\"remove-scroll\"]) contents = /* @__PURE__ */ jsx(RemoveScroll, {\n\t\t\tenabled: context.breakpointActive ? false : enableRemoveScroll ? open : false,\n\t\t\tchildren: contents\n\t\t});\n\t\tif (!alwaysDisable || !alwaysDisable.dismiss) contents = /* @__PURE__ */ jsx(Dismissable, {\n\t\t\tbranches: context.branches,\n\t\t\tforceUnmount: disableDismissable || (forceUnmount ?? !open),\n\t\t\tonEscapeKeyDown,\n\t\t\tonPointerDownOutside,\n\t\t\tonFocusOutside,\n\t\t\tonInteractOutside,\n\t\t\tonDismiss: handleDismiss,\n\t\t\tchildren: contents\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(Animate, {\n\t\ttype: \"presence\",\n\t\tpresent: Boolean(open),\n\t\tkeepChildrenMounted: Boolean(keepChildrenMounted),\n\t\tonExitComplete: handleExitComplete,\n\t\tlazyMount,\n\t\tpassThrough: context.breakpointActive,\n\t\tchildren: /* @__PURE__ */ jsx(PopperContent, {\n\t\t\tscope,\n\t\t\t\"data-state\": getState(open),\n\t\t\tid: context.contentId,\n\t\t\tref: forwardedRef,\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\t...contentProps,\n\t\t\tchildren: /* @__PURE__ */ jsx(PortalAdaptSafe, {\n\t\t\t\tcontext,\n\t\t\t\tchildren: contents\n\t\t\t})\n\t\t}, context.contentId)\n\t});\n});\nconst PopoverClose = createRefComponent(function PopoverClose2(props, forwardedRef) {\n\tconst { scope, className, ...rest } = props;\n\tconst context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(YStack, {\n\t\t...rest,\n\t\tref: forwardedRef,\n\t\tclassName: `is_PopoverClose ${className || \"\"}`.trim(),\n\t\tonPress: composeEventHandlers(props.onPress, () => context?.onOpenChange?.(false, \"press\"))\n\t});\n});\nconst PopoverArrow = createStyledHOC(PopperArrowFrame, function PopoverArrow2(props, forwardedRef) {\n\tconst { scope, className, ...rest } = props;\n\tif (useAdaptIsActive(usePopoverContext(scope).adaptScope)) return null;\n\treturn /* @__PURE__ */ jsx(PopperArrow, {\n\t\tscope,\n\t\tclassName: `is_PopoverArrow ${className || \"\"}`.trim(),\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n});\nconst PopoverScrollView = createRefComponent(({ scope, ...props }, ref) => {\n\tconst context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(ScrollView, {\n\t\tref,\n\t\tpointerEvents: context.breakpointActive ? \"none\" : void 0,\n\t\tscrollEnabled: !context.breakpointActive,\n\t\tpassThrough: context.breakpointActive,\n\t\t...props\n\t});\n});\nconst DEFAULT_SCOPE = \"\";\nconst Popover = withStaticProperties(createRefComponent(function Popover2({ scope = DEFAULT_SCOPE, ...props }, ref) {\n\tconst id = React.useId();\n\tconst adaptScope = `PopoverAdapt${scope}`;\n\tconst { open: openProp, defaultOpen, onOpenChange } = props;\n\tconst viaRef = React.useRef(void 0);\n\tconst closeReasonRef = React.useRef(void 0);\n\tconst [open, setOpen] = useControllableState({\n\t\tprop: openProp,\n\t\tdefaultProp: defaultOpen || false,\n\t\tonChange: (val) => {\n\t\t\tonOpenChange?.(val, viaRef.current);\n\t\t}\n\t});\n\tconst handleOpenChange = useEvent((val, via) => {\n\t\tviaRef.current = via;\n\t\tsetOpen(val);\n\t});\n\tReact.useEffect(() => {\n\t\tif (!open) return;\n\t\topenPopovers.add(setOpen);\n\t\treturn () => {\n\t\t\topenPopovers.delete(setOpen);\n\t\t};\n\t}, [open, setOpen]);\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\tadaptChildren: props.children,\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverInner, {\n\t\t\tadaptScope,\n\t\t\tref,\n\t\t\tid,\n\t\t\tscope,\n\t\t\topen,\n\t\t\tsetOpen,\n\t\t\thandleOpenChange,\n\t\t\tcloseReasonRef,\n\t\t\t...props\n\t\t})\n\t});\n}), {\n\tAnchor: PopoverAnchor,\n\tArrow: PopoverArrow,\n\tTrigger: PopoverTrigger,\n\tContent: PopoverContent,\n\tClose: PopoverClose,\n\tAdapt,\n\tScrollView: PopoverScrollView,\n\tFocusScope: FocusScopeController\n});\nconst PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef) {\n\tconst { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus = !hoverable, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, closeReasonRef, ...restProps } = props;\n\tconst triggerRef = React.useRef(null);\n\tconst [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n\tconst [keepChildrenMounted] = useControllableState({\n\t\tprop: keepChildrenMountedProp,\n\t\tdefaultProp: false,\n\t\ttransition: keepChildrenMountedProp === \"lazy\"\n\t});\n\tconst isAdapted = useAdaptIsActive(adaptScope);\n\tconst floatingContext = useFloatingContext({\n\t\topen,\n\t\tsetOpen: handleOpenChange,\n\t\tcloseReasonRef,\n\t\tdisable: isAdapted,\n\t\thoverable,\n\t\tdisableFocus\n\t});\n\tconst [anchorTo, setAnchorToRaw] = React.useState();\n\tconst setAnchorTo = useCreateShallowSetState(setAnchorToRaw);\n\tReact.useImperativeHandle(forwardedRef, () => ({\n\t\tanchorTo: setAnchorTo,\n\t\ttoggle: () => setOpen((prev) => !prev),\n\t\topen: () => setOpen(true),\n\t\tclose: () => setOpen(false),\n\t\tsetOpen\n\t}));\n\tconst contentId = React.useId();\n\tconst onOpenToggle = useEvent(() => {\n\t\tif (open && isAdapted) return;\n\t\tcloseReasonRef.current = open ? \"reference-press\" : void 0;\n\t\tsetOpen(!open);\n\t});\n\tconst onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);\n\tconst onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);\n\tconst contents = /* @__PURE__ */ jsx(Popper, {\n\t\topen,\n\t\tpassThrough: isAdapted,\n\t\tscope,\n\t\tstayInFrame: true,\n\t\t...restProps,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContextProvider, {\n\t\t\tscope,\n\t\t\topen,\n\t\t\tonOpenChange: handleOpenChange,\n\t\t\tonOpenToggle,\n\t\t\ttriggerRef,\n\t\t\tid,\n\t\t\tcontentId,\n\t\t\thasCustomAnchor,\n\t\t\tonCustomAnchorAdd,\n\t\t\tonCustomAnchorRemove,\n\t\t\tanchorTo,\n\t\t\tadaptScope,\n\t\t\tbreakpointActive: isAdapted,\n\t\t\tkeepChildrenMounted,\n\t\t\tdisableDismissable,\n\t\t\thoverable,\n\t\t\tcloseReasonRef,\n\t\t\tchildren\n\t\t})\n\t});\n\tlet result = /* @__PURE__ */ jsx(Fragment, { children: isWeb ? /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, {\n\t\tvalue: floatingContext,\n\t\tchildren: contents\n\t}) : contents });\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(PopoverZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: result\n\t});\n\treturn result;\n});\nfunction getState(open) {\n\treturn open ? \"open\" : \"closed\";\n}\n\nexport { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverContext, PopoverContextProvider, PopoverTrigger, PopoverTriggerContext, PopoverZIndexContext, closeLastOpenedPopover, closeOpenPopovers, hasOpenPopovers, usePopoverContext, usePopoverOpen, usePopoverTriggerContext, usePopoverTriggerSetup };"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAM,qBAAqB,yBAAyB;AACpD,MAAM,+BAA+B,IAAI,IAAI;AAC7C,MAAM,wBAAwB;CAC7B,OAAO,aAAa,OAAO;AAC5B;AACA,MAAM,0BAA0B;CAC/B,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,aAAa,SAAS,YAAY,QAAQ,KAAK,CAAC;CAChD,OAAO;AACR;AACA,MAAM,+BAA+B;CACpC,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,MAAM,OAAO,MAAM,KAAK,YAAY,CAAC,CAAC,IAAI;CAC1C,IAAI,MAAM;EACT,KAAK,KAAK;EACV,OAAO;CACR;CACA,OAAO;AACR;AACA,MAAM,iBAAiB,oBAAoB,CAAC,GAAG,WAAW;AAC1D,MAAM,uBAAuB,MAAM,cAAc,KAAK,CAA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,CAAC;CAC9E,MAAM,uBAAuB,MAAM,kBAAkB,mBAAmB,KAAK,GAAG,CAAC,CAAC;CAClF,MAAM,WAA2B,oBAAI,QAAQ;EAC5C;EACA,aAAa;EACb;EACA,aAAa;EACb,GAAG;EACH,UAA0B,oBAAI,wBAAwB;GACrD;GACA;GACA,cAAc;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;EACD,CAAC;CACF,CAAC;CACD,IAAI,SAAyB,oBAAI,UAAU,EAAE,UAAU,QAAwB,oBAAI,wBAAwB,UAAU;EACpH,OAAO;EACP,UAAU;CACX,CAAC,IAAI,SAAS,CAAC;CACf,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,qBAAqB,UAAU;EAChF,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR,CAAC;AACD,SAAS,SAAS,MAAM;CACvB,OAAO,OAAO,SAAS;AACxB"}
|
|
@@ -9,7 +9,7 @@ import { DismissableBranch } from "@tamagui/dismissable";
|
|
|
9
9
|
import { FloatingOverrideContext } from "@tamagui/floating";
|
|
10
10
|
import { FocusScopeController } from "@tamagui/focus-scope";
|
|
11
11
|
import { composeEventHandlers, withStaticProperties } from "@tamagui/helpers";
|
|
12
|
-
import { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext } from "@tamagui/popper";
|
|
12
|
+
import { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext, usePopperContextSlow } from "@tamagui/popper";
|
|
13
13
|
import { Portal, needsPortalRepropagation } from "@tamagui/portal";
|
|
14
14
|
import { ScrollView } from "@tamagui/scroll-view";
|
|
15
15
|
import { YStack } from "@tamagui/stacks";
|
|
@@ -88,7 +88,7 @@ function usePopoverTriggerSetup(open) {
|
|
|
88
88
|
};
|
|
89
89
|
}
|
|
90
90
|
var PopoverContextProvider = /* @__PURE__ */ React.memo(function(param) {
|
|
91
|
-
var { scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = "", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable } = param;
|
|
91
|
+
var { scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = "", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable, closeReasonRef } = param;
|
|
92
92
|
var [branches] = React.useState(function() {
|
|
93
93
|
return /* @__PURE__ */ new Set();
|
|
94
94
|
});
|
|
@@ -112,6 +112,7 @@ var PopoverContextProvider = /* @__PURE__ */ React.memo(function(param) {
|
|
|
112
112
|
keepChildrenMounted,
|
|
113
113
|
disableDismissable,
|
|
114
114
|
hoverable,
|
|
115
|
+
closeReasonRef,
|
|
115
116
|
children: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {
|
|
116
117
|
scope,
|
|
117
118
|
triggerRef,
|
|
@@ -145,6 +146,7 @@ var PopoverAnchor = /* @__PURE__ */ React.memo(createRefComponent(function Popov
|
|
|
145
146
|
var PopoverTrigger = /* @__PURE__ */ React.memo(createRefComponent(function PopoverTrigger2(props, forwardedRef) {
|
|
146
147
|
var { scope, disablePressTrigger, ...rest } = props;
|
|
147
148
|
var triggerContext = usePopoverTriggerContext(scope);
|
|
149
|
+
var popperContext = usePopperContextSlow(scope);
|
|
148
150
|
var triggerId = React.useId();
|
|
149
151
|
var [open, setOpen] = React.useState(false);
|
|
150
152
|
var anchorTo = triggerContext.anchorTo;
|
|
@@ -179,7 +181,15 @@ var PopoverTrigger = /* @__PURE__ */ React.memo(createRefComponent(function Popo
|
|
|
179
181
|
}),
|
|
180
182
|
onMouseEnter: composeEventHandlers(rest.onMouseEnter, activateSelf),
|
|
181
183
|
onPressIn: composeEventHandlers(rest.onPressIn, activateSelf),
|
|
182
|
-
onFocus: composeEventHandlers(rest.onFocus,
|
|
184
|
+
onFocus: composeEventHandlers(rest.onFocus, function(event) {
|
|
185
|
+
var _popperContext_getReferenceProps_onFocus, _popperContext_getReferenceProps, _popperContext_getReferenceProps_call;
|
|
186
|
+
activateSelf();
|
|
187
|
+
(_popperContext_getReferenceProps = popperContext.getReferenceProps) === null || _popperContext_getReferenceProps === void 0 || (_popperContext_getReferenceProps_onFocus = (_popperContext_getReferenceProps_call = _popperContext_getReferenceProps.call(popperContext, { ref: triggerElRef })).onFocus) == null || _popperContext_getReferenceProps_onFocus.call(_popperContext_getReferenceProps_call, event);
|
|
188
|
+
}),
|
|
189
|
+
onBlur: composeEventHandlers(rest.onBlur, function(event) {
|
|
190
|
+
var _popperContext_getReferenceProps_onBlur, _popperContext_getReferenceProps, _popperContext_getReferenceProps_call;
|
|
191
|
+
(_popperContext_getReferenceProps = popperContext.getReferenceProps) === null || _popperContext_getReferenceProps === void 0 || (_popperContext_getReferenceProps_onBlur = (_popperContext_getReferenceProps_call = _popperContext_getReferenceProps.call(popperContext, { ref: triggerElRef })).onBlur) == null || _popperContext_getReferenceProps_onBlur.call(_popperContext_getReferenceProps_call, event);
|
|
192
|
+
})
|
|
183
193
|
});
|
|
184
194
|
var virtualRef = React.useMemo(function() {
|
|
185
195
|
if (!anchorTo) return null;
|
|
@@ -355,7 +365,8 @@ var PopoverContentImpl = createRefComponent(function PopoverContentImpl2(props,
|
|
|
355
365
|
disable: context.breakpointActive,
|
|
356
366
|
children
|
|
357
367
|
});
|
|
358
|
-
React.useCallback(function() {
|
|
368
|
+
React.useCallback(function(details) {
|
|
369
|
+
if (context.closeReasonRef) context.closeReasonRef.current = details.reason === "escape-key" ? "escape-key" : "dismiss";
|
|
359
370
|
context.onOpenChange(false, "press");
|
|
360
371
|
}, [context]);
|
|
361
372
|
if (!context.breakpointActive) {}
|
|
@@ -421,6 +432,7 @@ var Popover = withStaticProperties(createRefComponent(function Popover2(param, r
|
|
|
421
432
|
var adaptScope = `PopoverAdapt${scope}`;
|
|
422
433
|
var { open: openProp, defaultOpen, onOpenChange } = props;
|
|
423
434
|
var viaRef = React.useRef(void 0);
|
|
435
|
+
var closeReasonRef = React.useRef(void 0);
|
|
424
436
|
var [open, setOpen] = useControllableState({
|
|
425
437
|
prop: openProp,
|
|
426
438
|
defaultProp: defaultOpen || false,
|
|
@@ -441,6 +453,7 @@ var Popover = withStaticProperties(createRefComponent(function Popover2(param, r
|
|
|
441
453
|
}, [open, setOpen]);
|
|
442
454
|
return /* @__PURE__ */ jsx(AdaptParent, {
|
|
443
455
|
scope: adaptScope,
|
|
456
|
+
adaptChildren: props.children,
|
|
444
457
|
open,
|
|
445
458
|
onOpenChange: setOpen,
|
|
446
459
|
children: /* @__PURE__ */ jsx(PopoverInner, {
|
|
@@ -451,6 +464,7 @@ var Popover = withStaticProperties(createRefComponent(function Popover2(param, r
|
|
|
451
464
|
open,
|
|
452
465
|
setOpen,
|
|
453
466
|
handleOpenChange,
|
|
467
|
+
closeReasonRef,
|
|
454
468
|
...props
|
|
455
469
|
})
|
|
456
470
|
});
|
|
@@ -465,7 +479,7 @@ var Popover = withStaticProperties(createRefComponent(function Popover2(param, r
|
|
|
465
479
|
FocusScope: FocusScopeController
|
|
466
480
|
});
|
|
467
481
|
var PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef) {
|
|
468
|
-
var { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, ...restProps } = props;
|
|
482
|
+
var { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus = !hoverable, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, closeReasonRef, ...restProps } = props;
|
|
469
483
|
var triggerRef = React.useRef(null);
|
|
470
484
|
var [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
471
485
|
var [keepChildrenMounted] = useControllableState({
|
|
@@ -477,6 +491,7 @@ var PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef
|
|
|
477
491
|
var floatingContext = useFloatingContext({
|
|
478
492
|
open,
|
|
479
493
|
setOpen: handleOpenChange,
|
|
494
|
+
closeReasonRef,
|
|
480
495
|
disable: isAdapted,
|
|
481
496
|
hoverable,
|
|
482
497
|
disableFocus
|
|
@@ -503,6 +518,7 @@ var PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef
|
|
|
503
518
|
var contentId = React.useId();
|
|
504
519
|
var onOpenToggle = useEvent(function() {
|
|
505
520
|
if (open && isAdapted) return;
|
|
521
|
+
closeReasonRef.current = open ? "reference-press" : void 0;
|
|
506
522
|
setOpen(!open);
|
|
507
523
|
});
|
|
508
524
|
var onCustomAnchorAdd = React.useCallback(function() {
|
|
@@ -534,6 +550,7 @@ var PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef
|
|
|
534
550
|
keepChildrenMounted,
|
|
535
551
|
disableDismissable,
|
|
536
552
|
hoverable,
|
|
553
|
+
closeReasonRef,
|
|
537
554
|
children
|
|
538
555
|
})
|
|
539
556
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.native.js","names":[],"sources":["esm/Popover.native.js"],"sourcesContent":["import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n\nimport { Adapt, AdaptParent, AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { Animate } from \"@tamagui/animate\";\nimport { ResetPresence } from \"@tamagui/animate-presence\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledContext, createStyledHOC, useCreateShallowSetState, useEvent } from \"@tamagui/core\";\nimport { DismissableBranch } from \"@tamagui/dismissable\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\nimport { FocusScopeController } from \"@tamagui/focus-scope\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext } from \"@tamagui/popper\";\nimport { Portal, needsPortalRepropagation } from \"@tamagui/portal\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { useFloatingContext } from \"./useFloatingContext\";\n\nvar needsRepropagation = needsPortalRepropagation();\nvar openPopovers = /* @__PURE__ */ new Set();\nvar hasOpenPopovers = function() {\n\treturn openPopovers.size > 0;\n};\nvar closeOpenPopovers = function() {\n\tif (openPopovers.size === 0) return false;\n\topenPopovers.forEach(function(setOpen) {\n\t\treturn setOpen(false);\n\t});\n\treturn true;\n};\nvar closeLastOpenedPopover = function() {\n\tif (openPopovers.size === 0) return false;\n\tvar last = Array.from(openPopovers).pop();\n\tif (last) {\n\t\tlast(false);\n\t\treturn true;\n\t}\n\treturn false;\n};\nvar PopoverContext = createStyledContext({}, \"Popover__\");\nvar PopoverZIndexContext = /* @__PURE__ */ React.createContext(void 0);\nvar PopoverTriggerContext = createStyledContext({}, \"PopoverTrigger__\");\nvar usePopoverContext = PopoverContext.useStyledContext;\nvar usePopoverTriggerContext = PopoverTriggerContext.useStyledContext;\nfunction usePopoverOpen(scope) {\n\treturn usePopoverContext(scope).open;\n}\nfunction usePopoverTriggerSetup(open) {\n\tvar triggerStateSettersRef = React.useRef(/* @__PURE__ */ new Map());\n\tvar activeTriggerIdRef = React.useRef(null);\n\tvar setActiveTrigger = useEvent(function(id) {\n\t\tvar prevId = activeTriggerIdRef.current;\n\t\tif (prevId === id) return;\n\t\tif (prevId) {\n\t\t\tvar _triggerStateSettersRef_current_get;\n\t\t\t(_triggerStateSettersRef_current_get = triggerStateSettersRef.current.get(prevId)) === null || _triggerStateSettersRef_current_get === void 0 || _triggerStateSettersRef_current_get(false);\n\t\t}\n\t\tactiveTriggerIdRef.current = id;\n\t\tif (id && open) {\n\t\t\tvar _triggerStateSettersRef_current_get1;\n\t\t\t(_triggerStateSettersRef_current_get1 = triggerStateSettersRef.current.get(id)) === null || _triggerStateSettersRef_current_get1 === void 0 || _triggerStateSettersRef_current_get1(true);\n\t\t}\n\t});\n\tvar registerTrigger = useEvent(function(id, setOpenState) {\n\t\ttriggerStateSettersRef.current.set(id, setOpenState);\n\t\tsetOpenState(activeTriggerIdRef.current === id && open);\n\t});\n\tvar unregisterTrigger = useEvent(function(id) {\n\t\ttriggerStateSettersRef.current.delete(id);\n\t\tif (activeTriggerIdRef.current === id) activeTriggerIdRef.current = null;\n\t});\n\tReact.useEffect(function() {\n\t\tif (!open) {\n\t\t\tsetActiveTrigger(null);\n\t\t\treturn;\n\t\t}\n\t\tvar activeId = activeTriggerIdRef.current;\n\t\tif (activeId) {\n\t\t\tvar _triggerStateSettersRef_current_get;\n\t\t\t(_triggerStateSettersRef_current_get = triggerStateSettersRef.current.get(activeId)) === null || _triggerStateSettersRef_current_get === void 0 || _triggerStateSettersRef_current_get(true);\n\t\t}\n\t}, [open, setActiveTrigger]);\n\treturn {\n\t\tsetActiveTrigger,\n\t\tregisterTrigger,\n\t\tunregisterTrigger\n\t};\n}\nvar PopoverContextProvider = /* @__PURE__ */ React.memo(function(param) {\n\tvar { scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = \"\", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable } = param;\n\tvar [branches] = React.useState(function() {\n\t\treturn /* @__PURE__ */ new Set();\n\t});\n\tvar { setActiveTrigger, registerTrigger, unregisterTrigger } = usePopoverTriggerSetup(open);\n\treturn /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\tscope,\n\t\tpopoverScope: scope,\n\t\tadaptScope,\n\t\tid,\n\t\tcontentId,\n\t\ttriggerRef,\n\t\topen,\n\t\tonOpenChange,\n\t\tonOpenToggle,\n\t\thasCustomAnchor,\n\t\tonCustomAnchorAdd,\n\t\tonCustomAnchorRemove,\n\t\tanchorTo,\n\t\tbranches,\n\t\tbreakpointActive,\n\t\tkeepChildrenMounted,\n\t\tdisableDismissable,\n\t\thoverable,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\tscope,\n\t\t\ttriggerRef,\n\t\t\thasCustomAnchor,\n\t\t\tanchorTo,\n\t\t\tbranches,\n\t\t\tonOpenToggle,\n\t\t\tsetActiveTrigger,\n\t\t\tregisterTrigger,\n\t\t\tunregisterTrigger,\n\t\t\tchildren\n\t\t})\n\t});\n});\nvar voidFn = function() {};\nvar PopoverAnchor = /* @__PURE__ */ React.memo(createRefComponent(function PopoverAnchor2(props, forwardedRef) {\n\tvar { scope, ...rest } = props;\n\tvar { onCustomAnchorAdd, onCustomAnchorRemove } = usePopoverContext(scope) || {};\n\tReact.useEffect(function() {\n\t\tonCustomAnchorAdd();\n\t\treturn function() {\n\t\t\treturn onCustomAnchorRemove();\n\t\t};\n\t}, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\treturn /* @__PURE__ */ jsx(PopperAnchor, {\n\t\tscope,\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n}));\nvar PopoverTrigger = /* @__PURE__ */ React.memo(createRefComponent(function PopoverTrigger2(props, forwardedRef) {\n\tvar { scope, disablePressTrigger, ...rest } = props;\n\tvar triggerContext = usePopoverTriggerContext(scope);\n\tvar triggerId = React.useId();\n\tvar [open, setOpen] = React.useState(false);\n\tvar anchorTo = triggerContext.anchorTo;\n\tvar triggerElRef = React.useRef(null);\n\tvar composedTriggerRef = useComposedRefs(forwardedRef, triggerElRef);\n\tvar { registerTrigger, unregisterTrigger } = triggerContext;\n\tReact.useEffect(function() {\n\t\tregisterTrigger(triggerId, setOpen);\n\t\treturn function() {\n\t\t\tunregisterTrigger(triggerId);\n\t\t};\n\t}, [\n\t\tregisterTrigger,\n\t\tunregisterTrigger,\n\t\ttriggerId\n\t]);\n\tif (!rest.children) return null;\n\tvar activateSelf = function() {\n\t\ttriggerContext.setActiveTrigger(triggerId);\n\t\tvar el = triggerElRef.current;\n\t\tif (el) triggerContext.triggerRef.current = el;\n\t};\n\tvar trigger = /* @__PURE__ */ jsx(View, {\n\t\t\"aria-expanded\": open,\n\t\t\"data-state\": getState(open),\n\t\t...rest,\n\t\tref: composedTriggerRef,\n\t\tonPress: composeEventHandlers(rest.onPress, function() {\n\t\t\tif (disablePressTrigger) return;\n\t\t\ttriggerContext.setActiveTrigger(open ? null : triggerId);\n\t\t\ttriggerContext.onOpenToggle();\n\t\t}),\n\t\tonMouseEnter: composeEventHandlers(rest.onMouseEnter, activateSelf),\n\t\tonPressIn: composeEventHandlers(rest.onPressIn, activateSelf),\n\t\tonFocus: composeEventHandlers(rest.onFocus, activateSelf)\n\t});\n\tvar virtualRef = React.useMemo(function() {\n\t\tif (!anchorTo) return null;\n\t\treturn { current: {\n\t\t\tgetBoundingClientRect: function() {\n\t\t\t\treturn isWeb ? DOMRect.fromRect(anchorTo) : anchorTo;\n\t\t\t},\n\t\t\t...!isWeb && {\n\t\t\t\tmeasure: function(c) {\n\t\t\t\t\treturn c(anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.x, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.y, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.width, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.height);\n\t\t\t\t},\n\t\t\t\tmeasureInWindow: function(c) {\n\t\t\t\t\treturn c(anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.x, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.y, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.width, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.height);\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}, [\n\t\ttriggerContext.anchorTo,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.x,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.y,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.height,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.width\n\t]);\n\tvar wrappedTrigger = isWeb ? /* @__PURE__ */ jsx(DismissableBranch, {\n\t\tbranches: triggerContext.branches,\n\t\tchildren: trigger\n\t}) : trigger;\n\treturn triggerContext.hasCustomAnchor ? wrappedTrigger : /* @__PURE__ */ jsx(PopperAnchor, {\n\t\t...virtualRef && { virtualRef },\n\t\tscope,\n\t\tasChild: true,\n\t\tchildren: wrappedTrigger\n\t});\n}));\nvar PopoverContent = createStyledHOC(PopperContentFrame, function PopoverContent2(props, forwardedRef) {\n\tvar { trapFocus, enableRemoveScroll = false, zIndex: zIndexProp, scope, forceMount, ...contentImplProps } = props;\n\tvar context = usePopoverContext(scope);\n\tvar adaptContext = useAdaptContext(context.adaptScope);\n\tvar zIndexFromContext = React.useContext(PopoverZIndexContext);\n\tvar zIndex = zIndexProp !== null && zIndexProp !== void 0 ? zIndexProp : zIndexFromContext;\n\tvar open = usePopoverOpen(scope);\n\tvar composedRefs = useComposedRefs(forwardedRef, React.useRef(null));\n\tvar isRightClickOutsideRef = React.useRef(false);\n\tvar [isFullyHidden, setIsFullyHidden] = React.useState(!open);\n\tuseIsomorphicLayoutEffect(function() {\n\t\tif (open && isFullyHidden) setIsFullyHidden(false);\n\t}, [open, isFullyHidden]);\n\tif (!forceMount && !context.keepChildrenMounted) {\n\t\tif (context.breakpointActive) {\n\t\t\tif (!open && adaptContext.targetFullyHidden) return null;\n\t\t} else if (isFullyHidden && !open) return null;\n\t}\n\tvar _contentImplProps_pointerEvents;\n\treturn /* @__PURE__ */ jsx(PopoverPortal, {\n\t\tpassThrough: context.breakpointActive,\n\t\tcontext,\n\t\topen,\n\t\tvisuallyActive: open || !isFullyHidden,\n\t\tzIndex,\n\t\tchildren: /* @__PURE__ */ jsx(View, {\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\tpointerEvents: open ? (_contentImplProps_pointerEvents = contentImplProps.pointerEvents) !== null && _contentImplProps_pointerEvents !== void 0 ? _contentImplProps_pointerEvents : \"auto\" : \"none\",\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverContentImpl, {\n\t\t\t\t...contentImplProps,\n\t\t\t\tcontext,\n\t\t\t\topen,\n\t\t\t\tforceMount,\n\t\t\t\tenableRemoveScroll,\n\t\t\t\tref: composedRefs,\n\t\t\t\tsetIsFullyHidden,\n\t\t\t\tscope,\n\t\t\t\ttrapFocus: trapFocus !== null && trapFocus !== void 0 ? trapFocus : open,\n\t\t\t\tdisableOutsidePointerEvents: true,\n\t\t\t\tonCloseAutoFocus: props.onCloseAutoFocus === false ? void 0 : composeEventHandlers(props.onCloseAutoFocus, function(event) {\n\t\t\t\t\tvar _context_triggerRef_current;\n\t\t\t\t\tif (event.isCanceled) return;\n\t\t\t\t\tevent.cancel();\n\t\t\t\t\tif (!isRightClickOutsideRef.current) (_context_triggerRef_current = context.triggerRef.current) === null || _context_triggerRef_current === void 0 || _context_triggerRef_current.focus();\n\t\t\t\t}),\n\t\t\t\tonPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, function(event) {\n\t\t\t\t\tvar originalEvent = event.event;\n\t\t\t\t\tif (!originalEvent) return;\n\t\t\t\t\tvar ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n\t\t\t\t\tisRightClickOutsideRef.current = originalEvent.button === 2 || ctrlLeftClick;\n\t\t\t\t}, { checkDefaultPrevented: false }),\n\t\t\t\tonFocusOutside: composeEventHandlers(props.onFocusOutside, function(event) {\n\t\t\t\t\tif (trapFocus !== null && trapFocus !== void 0 ? trapFocus : open) event.cancel();\n\t\t\t\t}, { checkDefaultPrevented: false })\n\t\t\t})\n\t\t})\n\t});\n}, { staticConfig: { inlineProps: /* @__PURE__ */ new Set([\n\t...PopperContentFrame.staticConfig.inlineProps || [],\n\t\"zIndex\",\n\t\"opacity\",\n\t\"y\"\n]) } });\nvar useParentContexts = function(scope) {\n\tvar context = usePopoverContext(scope);\n\tvar triggerContext = usePopoverTriggerContext(scope);\n\treturn {\n\t\tpopperContext: usePopperContext(scope),\n\t\tadaptContext: useAdaptContext(context.adaptScope),\n\t\tcontext,\n\t\ttriggerContext\n\t};\n};\nfunction RepropagateParentContexts(param) {\n\tvar { adaptContext, children, context, triggerContext, popperContext } = param;\n\treturn /* @__PURE__ */ jsx(PopperProvider, {\n\t\tscope: context.popoverScope,\n\t\t...popperContext,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\t\tscope: context.popoverScope,\n\t\t\t...context,\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\t\tscope: context.popoverScope,\n\t\t\t\t...triggerContext,\n\t\t\t\tchildren: /* @__PURE__ */ jsx(ProvideAdaptContext, {\n\t\t\t\t\t...adaptContext,\n\t\t\t\t\tchildren\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t});\n}\nvar PortalAdaptSafe = function(param) {\n\t\"use no memo\";\n\tvar { children, context } = param;\n\tif (needsRepropagation) {\n\t\tvar parentContexts = useParentContexts(context.popoverScope);\n\t\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\t\tscope: context.adaptScope,\n\t\t\tchildren: /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t\t\t...parentContexts,\n\t\t\t\tchildren\n\t\t\t})\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\tscope: context.adaptScope,\n\t\tchildren\n\t});\n};\nfunction PopoverPortal(param) {\n\t\"use no memo\";\n\tvar { context, open, visuallyActive, zIndex, passThrough, children, onPress } = param;\n\tvar content = children;\n\tif (needsRepropagation) content = /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t...useParentContexts(context.popoverScope),\n\t\tchildren: content\n\t});\n\treturn /* @__PURE__ */ jsxs(Portal, {\n\t\tpassThrough,\n\t\tstackZIndex: true,\n\t\tzIndex,\n\t\thidden: !visuallyActive,\n\t\tchildren: [!!open && !context.breakpointActive && !context.hoverable && /* @__PURE__ */ jsx(YStack, {\n\t\t\tposition: \"absolute\",\n\t\t\tinset: 0,\n\t\t\tonPress: composeEventHandlers(onPress, context.onOpenToggle)\n\t\t}), content]\n\t});\n}\nvar PopoverContentImpl = createRefComponent(function PopoverContentImpl2(props, forwardedRef) {\n\tvar { trapFocus, scope, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, disableFocusScope, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, children, enableRemoveScroll, freezeContentsWhenHidden, setIsFullyHidden, lazyMount, forceUnmount, forceMount, context, open, alwaysDisable, ...contentProps } = props;\n\tvar { disableDismissable } = context;\n\tvar keepChildrenMounted = context.keepChildrenMounted || forceMount;\n\tvar handleExitComplete = React.useCallback(function() {\n\t\tsetIsFullyHidden === null || setIsFullyHidden === void 0 || setIsFullyHidden(true);\n\t}, [setIsFullyHidden]);\n\tvar contents = /* @__PURE__ */ jsx(ResetPresence, {\n\t\tdisable: context.breakpointActive,\n\t\tchildren\n\t});\n\tReact.useCallback(function() {\n\t\tcontext.onOpenChange(false, \"press\");\n\t}, [context]);\n\tif (!context.breakpointActive) {}\n\treturn /* @__PURE__ */ jsx(Animate, {\n\t\ttype: \"presence\",\n\t\tpresent: Boolean(open),\n\t\tkeepChildrenMounted: Boolean(keepChildrenMounted),\n\t\tonExitComplete: handleExitComplete,\n\t\tlazyMount,\n\t\tpassThrough: context.breakpointActive,\n\t\tchildren: /* @__PURE__ */ jsx(PopperContent, {\n\t\t\tscope,\n\t\t\t\"data-state\": getState(open),\n\t\t\tid: context.contentId,\n\t\t\tref: forwardedRef,\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\t...contentProps,\n\t\t\tchildren: /* @__PURE__ */ jsx(PortalAdaptSafe, {\n\t\t\t\tcontext,\n\t\t\t\tchildren: contents\n\t\t\t})\n\t\t}, context.contentId)\n\t});\n});\nvar PopoverClose = createRefComponent(function PopoverClose2(props, forwardedRef) {\n\tvar { scope, className, ...rest } = props;\n\tvar context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(YStack, {\n\t\t...rest,\n\t\tref: forwardedRef,\n\t\tclassName: `is_PopoverClose ${className || \"\"}`.trim(),\n\t\tonPress: composeEventHandlers(props.onPress, function() {\n\t\t\tvar _context_onOpenChange;\n\t\t\treturn context === null || context === void 0 ? void 0 : (_context_onOpenChange = context.onOpenChange) === null || _context_onOpenChange === void 0 ? void 0 : _context_onOpenChange.call(context, false, \"press\");\n\t\t})\n\t});\n});\nvar PopoverArrow = createStyledHOC(PopperArrowFrame, function PopoverArrow2(props, forwardedRef) {\n\tvar { scope, className, ...rest } = props;\n\tif (useAdaptIsActive(usePopoverContext(scope).adaptScope)) return null;\n\treturn /* @__PURE__ */ jsx(PopperArrow, {\n\t\tscope,\n\t\tclassName: `is_PopoverArrow ${className || \"\"}`.trim(),\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n});\nvar PopoverScrollView = createRefComponent(function(param, ref) {\n\tvar { scope, ...props } = param;\n\tvar context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(ScrollView, {\n\t\tref,\n\t\tpointerEvents: context.breakpointActive ? \"none\" : void 0,\n\t\tscrollEnabled: !context.breakpointActive,\n\t\tpassThrough: context.breakpointActive,\n\t\t...props\n\t});\n});\nvar DEFAULT_SCOPE = \"\";\nvar Popover = withStaticProperties(createRefComponent(function Popover2(param, ref) {\n\tvar { scope = DEFAULT_SCOPE, ...props } = param;\n\tvar id = React.useId();\n\tvar adaptScope = `PopoverAdapt${scope}`;\n\tvar { open: openProp, defaultOpen, onOpenChange } = props;\n\tvar viaRef = React.useRef(void 0);\n\tvar [open, setOpen] = useControllableState({\n\t\tprop: openProp,\n\t\tdefaultProp: defaultOpen || false,\n\t\tonChange: function(val) {\n\t\t\tonOpenChange === null || onOpenChange === void 0 || onOpenChange(val, viaRef.current);\n\t\t}\n\t});\n\tvar handleOpenChange = useEvent(function(val, via) {\n\t\tviaRef.current = via;\n\t\tsetOpen(val);\n\t});\n\tReact.useEffect(function() {\n\t\tif (!open) return;\n\t\topenPopovers.add(setOpen);\n\t\treturn function() {\n\t\t\topenPopovers.delete(setOpen);\n\t\t};\n\t}, [open, setOpen]);\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverInner, {\n\t\t\tadaptScope,\n\t\t\tref,\n\t\t\tid,\n\t\t\tscope,\n\t\t\topen,\n\t\t\tsetOpen,\n\t\t\thandleOpenChange,\n\t\t\t...props\n\t\t})\n\t});\n}), {\n\tAnchor: PopoverAnchor,\n\tArrow: PopoverArrow,\n\tTrigger: PopoverTrigger,\n\tContent: PopoverContent,\n\tClose: PopoverClose,\n\tAdapt,\n\tScrollView: PopoverScrollView,\n\tFocusScope: FocusScopeController\n});\nvar PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef) {\n\tvar { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, ...restProps } = props;\n\tvar triggerRef = React.useRef(null);\n\tvar [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n\tvar [keepChildrenMounted] = useControllableState({\n\t\tprop: keepChildrenMountedProp,\n\t\tdefaultProp: false,\n\t\ttransition: keepChildrenMountedProp === \"lazy\"\n\t});\n\tvar isAdapted = useAdaptIsActive(adaptScope);\n\tvar floatingContext = useFloatingContext({\n\t\topen,\n\t\tsetOpen: handleOpenChange,\n\t\tdisable: isAdapted,\n\t\thoverable,\n\t\tdisableFocus\n\t});\n\tvar [anchorTo, setAnchorToRaw] = React.useState();\n\tvar setAnchorTo = useCreateShallowSetState(setAnchorToRaw);\n\tReact.useImperativeHandle(forwardedRef, function() {\n\t\treturn {\n\t\t\tanchorTo: setAnchorTo,\n\t\t\ttoggle: function() {\n\t\t\t\treturn setOpen(function(prev) {\n\t\t\t\t\treturn !prev;\n\t\t\t\t});\n\t\t\t},\n\t\t\topen: function() {\n\t\t\t\treturn setOpen(true);\n\t\t\t},\n\t\t\tclose: function() {\n\t\t\t\treturn setOpen(false);\n\t\t\t},\n\t\t\tsetOpen\n\t\t};\n\t});\n\tvar contentId = React.useId();\n\tvar onOpenToggle = useEvent(function() {\n\t\tif (open && isAdapted) return;\n\t\tsetOpen(!open);\n\t});\n\tvar onCustomAnchorAdd = React.useCallback(function() {\n\t\treturn setHasCustomAnchor(true);\n\t}, []);\n\tvar onCustomAnchorRemove = React.useCallback(function() {\n\t\treturn setHasCustomAnchor(false);\n\t}, []);\n\tvar contents = /* @__PURE__ */ jsx(Popper, {\n\t\topen,\n\t\tpassThrough: isAdapted,\n\t\tscope,\n\t\tstayInFrame: true,\n\t\t...restProps,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContextProvider, {\n\t\t\tscope,\n\t\t\topen,\n\t\t\tonOpenChange: handleOpenChange,\n\t\t\tonOpenToggle,\n\t\t\ttriggerRef,\n\t\t\tid,\n\t\t\tcontentId,\n\t\t\thasCustomAnchor,\n\t\t\tonCustomAnchorAdd,\n\t\t\tonCustomAnchorRemove,\n\t\t\tanchorTo,\n\t\t\tadaptScope,\n\t\t\tbreakpointActive: isAdapted,\n\t\t\tkeepChildrenMounted,\n\t\t\tdisableDismissable,\n\t\t\thoverable,\n\t\t\tchildren\n\t\t})\n\t});\n\tvar result = /* @__PURE__ */ jsx(Fragment, { children: isWeb ? /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, {\n\t\tvalue: floatingContext,\n\t\tchildren: contents\n\t}) : contents });\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(PopoverZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: result\n\t});\n\treturn result;\n});\nfunction getState(open) {\n\treturn open ? \"open\" : \"closed\";\n}\n\nexport { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverContext, PopoverContextProvider, PopoverTrigger, PopoverTriggerContext, PopoverZIndexContext, closeLastOpenedPopover, closeOpenPopovers, hasOpenPopovers, usePopoverContext, usePopoverOpen, usePopoverTriggerContext, usePopoverTriggerSetup };"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAI,qBAAqB,yBAAyB;AAClD,IAAI,+BAA+B,IAAI,IAAI;AAC3C,IAAI,kBAAkB,WAAW;CAChC,OAAO,aAAa,OAAO;AAC5B;AACA,IAAI,oBAAoB,WAAW;CAClC,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,aAAa,QAAQ,SAAS,SAAS;EACtC,OAAO,QAAQ,KAAK;CACrB,CAAC;CACD,OAAO;AACR;AACA,IAAI,yBAAyB,WAAW;CACvC,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,IAAI,OAAO,MAAM,KAAK,YAAY,CAAC,CAAC,IAAI;CACxC,IAAI,MAAM;EACT,KAAK,KAAK;EACV,OAAO;CACR;CACA,OAAO;AACR;AACA,IAAI,iBAAiB,oBAAoB,CAAC,GAAG,WAAW;AACxD,IAAI,uBAAuC,sBAAM,cAAc,KAAK,CAAC;AACrE,IAAI,wBAAwB,oBAAoB,CAAC,GAAG,kBAAkB;AACtE,IAAI,oBAAoB,eAAe;AACvC,IAAI,2BAA2B,sBAAsB;AACrD,SAAS,eAAe,OAAO;CAC9B,OAAO,kBAAkB,KAAK,CAAC,CAAC;AACjC;AACA,SAAS,uBAAuB,MAAM;CACrC,IAAI,yBAAyB,MAAM,uBAAuB,IAAI,IAAI,CAAC;CAC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,OAAO,QAAQ,SAAS,MAAM;KAC7B,OAAO,CAAC;IACT,CAAC;GACF;GACA,MAAM,WAAW;IAChB,OAAO,QAAQ,IAAI;GACpB;GACA,OAAO,WAAW;IACjB,OAAO,QAAQ,KAAK;GACrB;GACA;EACD;CACD,CAAC;CACD,IAAI,YAAY,MAAM,MAAM;CAC5B,IAAI,eAAe,SAAS,WAAW;EACtC,IAAI,QAAQ,WAAW;EACvB,QAAQ,CAAC,IAAI;CACd,CAAC;CACD,IAAI,oBAAoB,MAAM,YAAY,WAAW;EACpD,OAAO,mBAAmB,IAAI;CAC/B,GAAG,CAAC,CAAC;CACL,IAAI,uBAAuB,MAAM,YAAY,WAAW;EACvD,OAAO,mBAAmB,KAAK;CAChC,GAAG,CAAC,CAAC;CACL,IAAI,WAA2B,oBAAI,QAAQ;EAC1C;EACA,aAAa;EACb;EACA,aAAa;EACb,GAAG;EACH,UAA0B,oBAAI,wBAAwB;GACrD;GACA;GACA,cAAc;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;EACD,CAAC;CACF,CAAC;CACD,IAAI,SAAyB,oBAAI,UAAU,EAAE,UAAU,QAAwB,oBAAI,wBAAwB,UAAU;EACpH,OAAO;EACP,UAAU;CACX,CAAC,IAAI,SAAS,CAAC;CACf,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,qBAAqB,UAAU;EAChF,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR,CAAC;AACD,SAAS,SAAS,MAAM;CACvB,OAAO,OAAO,SAAS;AACxB"}
|
|
1
|
+
{"version":3,"file":"Popover.native.js","names":[],"sources":["esm/Popover.native.js"],"sourcesContent":["import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\n\nimport { Adapt, AdaptParent, AdaptPortalContents, ProvideAdaptContext, useAdaptContext, useAdaptIsActive } from \"@tamagui/adapt\";\nimport { Animate } from \"@tamagui/animate\";\nimport { ResetPresence } from \"@tamagui/animate-presence\";\nimport { useComposedRefs } from \"@tamagui/compose-refs\";\nimport { isWeb, useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { View, createRefComponent, createStyledContext, createStyledHOC, useCreateShallowSetState, useEvent } from \"@tamagui/core\";\nimport { DismissableBranch } from \"@tamagui/dismissable\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\nimport { FocusScopeController } from \"@tamagui/focus-scope\";\nimport { composeEventHandlers, withStaticProperties } from \"@tamagui/helpers\";\nimport { Popper, PopperAnchor, PopperArrow, PopperArrowFrame, PopperContent, PopperContentFrame, PopperProvider, usePopperContext, usePopperContextSlow } from \"@tamagui/popper\";\nimport { Portal, needsPortalRepropagation } from \"@tamagui/portal\";\nimport { ScrollView } from \"@tamagui/scroll-view\";\nimport { YStack } from \"@tamagui/stacks\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { useFloatingContext } from \"./useFloatingContext\";\n\nvar needsRepropagation = needsPortalRepropagation();\nvar openPopovers = /* @__PURE__ */ new Set();\nvar hasOpenPopovers = function() {\n\treturn openPopovers.size > 0;\n};\nvar closeOpenPopovers = function() {\n\tif (openPopovers.size === 0) return false;\n\topenPopovers.forEach(function(setOpen) {\n\t\treturn setOpen(false);\n\t});\n\treturn true;\n};\nvar closeLastOpenedPopover = function() {\n\tif (openPopovers.size === 0) return false;\n\tvar last = Array.from(openPopovers).pop();\n\tif (last) {\n\t\tlast(false);\n\t\treturn true;\n\t}\n\treturn false;\n};\nvar PopoverContext = createStyledContext({}, \"Popover__\");\nvar PopoverZIndexContext = /* @__PURE__ */ React.createContext(void 0);\nvar PopoverTriggerContext = createStyledContext({}, \"PopoverTrigger__\");\nvar usePopoverContext = PopoverContext.useStyledContext;\nvar usePopoverTriggerContext = PopoverTriggerContext.useStyledContext;\nfunction usePopoverOpen(scope) {\n\treturn usePopoverContext(scope).open;\n}\nfunction usePopoverTriggerSetup(open) {\n\tvar triggerStateSettersRef = React.useRef(/* @__PURE__ */ new Map());\n\tvar activeTriggerIdRef = React.useRef(null);\n\tvar setActiveTrigger = useEvent(function(id) {\n\t\tvar prevId = activeTriggerIdRef.current;\n\t\tif (prevId === id) return;\n\t\tif (prevId) {\n\t\t\tvar _triggerStateSettersRef_current_get;\n\t\t\t(_triggerStateSettersRef_current_get = triggerStateSettersRef.current.get(prevId)) === null || _triggerStateSettersRef_current_get === void 0 || _triggerStateSettersRef_current_get(false);\n\t\t}\n\t\tactiveTriggerIdRef.current = id;\n\t\tif (id && open) {\n\t\t\tvar _triggerStateSettersRef_current_get1;\n\t\t\t(_triggerStateSettersRef_current_get1 = triggerStateSettersRef.current.get(id)) === null || _triggerStateSettersRef_current_get1 === void 0 || _triggerStateSettersRef_current_get1(true);\n\t\t}\n\t});\n\tvar registerTrigger = useEvent(function(id, setOpenState) {\n\t\ttriggerStateSettersRef.current.set(id, setOpenState);\n\t\tsetOpenState(activeTriggerIdRef.current === id && open);\n\t});\n\tvar unregisterTrigger = useEvent(function(id) {\n\t\ttriggerStateSettersRef.current.delete(id);\n\t\tif (activeTriggerIdRef.current === id) activeTriggerIdRef.current = null;\n\t});\n\tReact.useEffect(function() {\n\t\tif (!open) {\n\t\t\tsetActiveTrigger(null);\n\t\t\treturn;\n\t\t}\n\t\tvar activeId = activeTriggerIdRef.current;\n\t\tif (activeId) {\n\t\t\tvar _triggerStateSettersRef_current_get;\n\t\t\t(_triggerStateSettersRef_current_get = triggerStateSettersRef.current.get(activeId)) === null || _triggerStateSettersRef_current_get === void 0 || _triggerStateSettersRef_current_get(true);\n\t\t}\n\t}, [open, setActiveTrigger]);\n\treturn {\n\t\tsetActiveTrigger,\n\t\tregisterTrigger,\n\t\tunregisterTrigger\n\t};\n}\nvar PopoverContextProvider = /* @__PURE__ */ React.memo(function(param) {\n\tvar { scope, children, open, onOpenChange, onOpenToggle, triggerRef, id = \"\", contentId, hasCustomAnchor = false, onCustomAnchorAdd = voidFn, onCustomAnchorRemove = voidFn, anchorTo, adaptScope, breakpointActive, keepChildrenMounted, disableDismissable, hoverable, closeReasonRef } = param;\n\tvar [branches] = React.useState(function() {\n\t\treturn /* @__PURE__ */ new Set();\n\t});\n\tvar { setActiveTrigger, registerTrigger, unregisterTrigger } = usePopoverTriggerSetup(open);\n\treturn /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\tscope,\n\t\tpopoverScope: scope,\n\t\tadaptScope,\n\t\tid,\n\t\tcontentId,\n\t\ttriggerRef,\n\t\topen,\n\t\tonOpenChange,\n\t\tonOpenToggle,\n\t\thasCustomAnchor,\n\t\tonCustomAnchorAdd,\n\t\tonCustomAnchorRemove,\n\t\tanchorTo,\n\t\tbranches,\n\t\tbreakpointActive,\n\t\tkeepChildrenMounted,\n\t\tdisableDismissable,\n\t\thoverable,\n\t\tcloseReasonRef,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\tscope,\n\t\t\ttriggerRef,\n\t\t\thasCustomAnchor,\n\t\t\tanchorTo,\n\t\t\tbranches,\n\t\t\tonOpenToggle,\n\t\t\tsetActiveTrigger,\n\t\t\tregisterTrigger,\n\t\t\tunregisterTrigger,\n\t\t\tchildren\n\t\t})\n\t});\n});\nvar voidFn = function() {};\nvar PopoverAnchor = /* @__PURE__ */ React.memo(createRefComponent(function PopoverAnchor2(props, forwardedRef) {\n\tvar { scope, ...rest } = props;\n\tvar { onCustomAnchorAdd, onCustomAnchorRemove } = usePopoverContext(scope) || {};\n\tReact.useEffect(function() {\n\t\tonCustomAnchorAdd();\n\t\treturn function() {\n\t\t\treturn onCustomAnchorRemove();\n\t\t};\n\t}, [onCustomAnchorAdd, onCustomAnchorRemove]);\n\treturn /* @__PURE__ */ jsx(PopperAnchor, {\n\t\tscope,\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n}));\nvar PopoverTrigger = /* @__PURE__ */ React.memo(createRefComponent(function PopoverTrigger2(props, forwardedRef) {\n\tvar { scope, disablePressTrigger, ...rest } = props;\n\tvar triggerContext = usePopoverTriggerContext(scope);\n\tvar popperContext = usePopperContextSlow(scope);\n\tvar triggerId = React.useId();\n\tvar [open, setOpen] = React.useState(false);\n\tvar anchorTo = triggerContext.anchorTo;\n\tvar triggerElRef = React.useRef(null);\n\tvar composedTriggerRef = useComposedRefs(forwardedRef, triggerElRef);\n\tvar { registerTrigger, unregisterTrigger } = triggerContext;\n\tReact.useEffect(function() {\n\t\tregisterTrigger(triggerId, setOpen);\n\t\treturn function() {\n\t\t\tunregisterTrigger(triggerId);\n\t\t};\n\t}, [\n\t\tregisterTrigger,\n\t\tunregisterTrigger,\n\t\ttriggerId\n\t]);\n\tif (!rest.children) return null;\n\tvar activateSelf = function() {\n\t\ttriggerContext.setActiveTrigger(triggerId);\n\t\tvar el = triggerElRef.current;\n\t\tif (el) triggerContext.triggerRef.current = el;\n\t};\n\tvar trigger = /* @__PURE__ */ jsx(View, {\n\t\t\"aria-expanded\": open,\n\t\t\"data-state\": getState(open),\n\t\t...rest,\n\t\tref: composedTriggerRef,\n\t\tonPress: composeEventHandlers(rest.onPress, function() {\n\t\t\tif (disablePressTrigger) return;\n\t\t\ttriggerContext.setActiveTrigger(open ? null : triggerId);\n\t\t\ttriggerContext.onOpenToggle();\n\t\t}),\n\t\tonMouseEnter: composeEventHandlers(rest.onMouseEnter, activateSelf),\n\t\tonPressIn: composeEventHandlers(rest.onPressIn, activateSelf),\n\t\tonFocus: composeEventHandlers(rest.onFocus, function(event) {\n\t\t\tvar _popperContext_getReferenceProps_onFocus, _popperContext_getReferenceProps, _popperContext_getReferenceProps_call;\n\t\t\tactivateSelf();\n\t\t\t(_popperContext_getReferenceProps = popperContext.getReferenceProps) === null || _popperContext_getReferenceProps === void 0 || (_popperContext_getReferenceProps_onFocus = (_popperContext_getReferenceProps_call = _popperContext_getReferenceProps.call(popperContext, { ref: triggerElRef })).onFocus) == null || _popperContext_getReferenceProps_onFocus.call(_popperContext_getReferenceProps_call, event);\n\t\t}),\n\t\tonBlur: composeEventHandlers(rest.onBlur, function(event) {\n\t\t\tvar _popperContext_getReferenceProps_onBlur, _popperContext_getReferenceProps, _popperContext_getReferenceProps_call;\n\t\t\t(_popperContext_getReferenceProps = popperContext.getReferenceProps) === null || _popperContext_getReferenceProps === void 0 || (_popperContext_getReferenceProps_onBlur = (_popperContext_getReferenceProps_call = _popperContext_getReferenceProps.call(popperContext, { ref: triggerElRef })).onBlur) == null || _popperContext_getReferenceProps_onBlur.call(_popperContext_getReferenceProps_call, event);\n\t\t})\n\t});\n\tvar virtualRef = React.useMemo(function() {\n\t\tif (!anchorTo) return null;\n\t\treturn { current: {\n\t\t\tgetBoundingClientRect: function() {\n\t\t\t\treturn isWeb ? DOMRect.fromRect(anchorTo) : anchorTo;\n\t\t\t},\n\t\t\t...!isWeb && {\n\t\t\t\tmeasure: function(c) {\n\t\t\t\t\treturn c(anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.x, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.y, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.width, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.height);\n\t\t\t\t},\n\t\t\t\tmeasureInWindow: function(c) {\n\t\t\t\t\treturn c(anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.x, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.y, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.width, anchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.height);\n\t\t\t\t}\n\t\t\t}\n\t\t} };\n\t}, [\n\t\ttriggerContext.anchorTo,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.x,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.y,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.height,\n\t\tanchorTo === null || anchorTo === void 0 ? void 0 : anchorTo.width\n\t]);\n\tvar wrappedTrigger = isWeb ? /* @__PURE__ */ jsx(DismissableBranch, {\n\t\tbranches: triggerContext.branches,\n\t\tchildren: trigger\n\t}) : trigger;\n\treturn triggerContext.hasCustomAnchor ? wrappedTrigger : /* @__PURE__ */ jsx(PopperAnchor, {\n\t\t...virtualRef && { virtualRef },\n\t\tscope,\n\t\tasChild: true,\n\t\tchildren: wrappedTrigger\n\t});\n}));\nvar PopoverContent = createStyledHOC(PopperContentFrame, function PopoverContent2(props, forwardedRef) {\n\tvar { trapFocus, enableRemoveScroll = false, zIndex: zIndexProp, scope, forceMount, ...contentImplProps } = props;\n\tvar context = usePopoverContext(scope);\n\tvar adaptContext = useAdaptContext(context.adaptScope);\n\tvar zIndexFromContext = React.useContext(PopoverZIndexContext);\n\tvar zIndex = zIndexProp !== null && zIndexProp !== void 0 ? zIndexProp : zIndexFromContext;\n\tvar open = usePopoverOpen(scope);\n\tvar composedRefs = useComposedRefs(forwardedRef, React.useRef(null));\n\tvar isRightClickOutsideRef = React.useRef(false);\n\tvar [isFullyHidden, setIsFullyHidden] = React.useState(!open);\n\tuseIsomorphicLayoutEffect(function() {\n\t\tif (open && isFullyHidden) setIsFullyHidden(false);\n\t}, [open, isFullyHidden]);\n\tif (!forceMount && !context.keepChildrenMounted) {\n\t\tif (context.breakpointActive) {\n\t\t\tif (!open && adaptContext.targetFullyHidden) return null;\n\t\t} else if (isFullyHidden && !open) return null;\n\t}\n\tvar _contentImplProps_pointerEvents;\n\treturn /* @__PURE__ */ jsx(PopoverPortal, {\n\t\tpassThrough: context.breakpointActive,\n\t\tcontext,\n\t\topen,\n\t\tvisuallyActive: open || !isFullyHidden,\n\t\tzIndex,\n\t\tchildren: /* @__PURE__ */ jsx(View, {\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\tpointerEvents: open ? (_contentImplProps_pointerEvents = contentImplProps.pointerEvents) !== null && _contentImplProps_pointerEvents !== void 0 ? _contentImplProps_pointerEvents : \"auto\" : \"none\",\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverContentImpl, {\n\t\t\t\t...contentImplProps,\n\t\t\t\tcontext,\n\t\t\t\topen,\n\t\t\t\tforceMount,\n\t\t\t\tenableRemoveScroll,\n\t\t\t\tref: composedRefs,\n\t\t\t\tsetIsFullyHidden,\n\t\t\t\tscope,\n\t\t\t\ttrapFocus: trapFocus !== null && trapFocus !== void 0 ? trapFocus : open,\n\t\t\t\tdisableOutsidePointerEvents: true,\n\t\t\t\tonCloseAutoFocus: props.onCloseAutoFocus === false ? void 0 : composeEventHandlers(props.onCloseAutoFocus, function(event) {\n\t\t\t\t\tvar _context_triggerRef_current;\n\t\t\t\t\tif (event.isCanceled) return;\n\t\t\t\t\tevent.cancel();\n\t\t\t\t\tif (!isRightClickOutsideRef.current) (_context_triggerRef_current = context.triggerRef.current) === null || _context_triggerRef_current === void 0 || _context_triggerRef_current.focus();\n\t\t\t\t}),\n\t\t\t\tonPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, function(event) {\n\t\t\t\t\tvar originalEvent = event.event;\n\t\t\t\t\tif (!originalEvent) return;\n\t\t\t\t\tvar ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;\n\t\t\t\t\tisRightClickOutsideRef.current = originalEvent.button === 2 || ctrlLeftClick;\n\t\t\t\t}, { checkDefaultPrevented: false }),\n\t\t\t\tonFocusOutside: composeEventHandlers(props.onFocusOutside, function(event) {\n\t\t\t\t\tif (trapFocus !== null && trapFocus !== void 0 ? trapFocus : open) event.cancel();\n\t\t\t\t}, { checkDefaultPrevented: false })\n\t\t\t})\n\t\t})\n\t});\n}, { staticConfig: { inlineProps: /* @__PURE__ */ new Set([\n\t...PopperContentFrame.staticConfig.inlineProps || [],\n\t\"zIndex\",\n\t\"opacity\",\n\t\"y\"\n]) } });\nvar useParentContexts = function(scope) {\n\tvar context = usePopoverContext(scope);\n\tvar triggerContext = usePopoverTriggerContext(scope);\n\treturn {\n\t\tpopperContext: usePopperContext(scope),\n\t\tadaptContext: useAdaptContext(context.adaptScope),\n\t\tcontext,\n\t\ttriggerContext\n\t};\n};\nfunction RepropagateParentContexts(param) {\n\tvar { adaptContext, children, context, triggerContext, popperContext } = param;\n\treturn /* @__PURE__ */ jsx(PopperProvider, {\n\t\tscope: context.popoverScope,\n\t\t...popperContext,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContext.Provider, {\n\t\t\tscope: context.popoverScope,\n\t\t\t...context,\n\t\t\tchildren: /* @__PURE__ */ jsx(PopoverTriggerContext.Provider, {\n\t\t\t\tscope: context.popoverScope,\n\t\t\t\t...triggerContext,\n\t\t\t\tchildren: /* @__PURE__ */ jsx(ProvideAdaptContext, {\n\t\t\t\t\t...adaptContext,\n\t\t\t\t\tchildren\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t});\n}\nvar PortalAdaptSafe = function(param) {\n\t\"use no memo\";\n\tvar { children, context } = param;\n\tif (needsRepropagation) {\n\t\tvar parentContexts = useParentContexts(context.popoverScope);\n\t\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\t\tscope: context.adaptScope,\n\t\t\tchildren: /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t\t\t...parentContexts,\n\t\t\t\tchildren\n\t\t\t})\n\t\t});\n\t}\n\treturn /* @__PURE__ */ jsx(AdaptPortalContents, {\n\t\tscope: context.adaptScope,\n\t\tchildren\n\t});\n};\nfunction PopoverPortal(param) {\n\t\"use no memo\";\n\tvar { context, open, visuallyActive, zIndex, passThrough, children, onPress } = param;\n\tvar content = children;\n\tif (needsRepropagation) content = /* @__PURE__ */ jsx(RepropagateParentContexts, {\n\t\t...useParentContexts(context.popoverScope),\n\t\tchildren: content\n\t});\n\treturn /* @__PURE__ */ jsxs(Portal, {\n\t\tpassThrough,\n\t\tstackZIndex: true,\n\t\tzIndex,\n\t\thidden: !visuallyActive,\n\t\tchildren: [!!open && !context.breakpointActive && !context.hoverable && /* @__PURE__ */ jsx(YStack, {\n\t\t\tposition: \"absolute\",\n\t\t\tinset: 0,\n\t\t\tonPress: composeEventHandlers(onPress, context.onOpenToggle)\n\t\t}), content]\n\t});\n}\nvar PopoverContentImpl = createRefComponent(function PopoverContentImpl2(props, forwardedRef) {\n\tvar { trapFocus, scope, onOpenAutoFocus, onCloseAutoFocus, disableOutsidePointerEvents, disableFocusScope, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, children, enableRemoveScroll, freezeContentsWhenHidden, setIsFullyHidden, lazyMount, forceUnmount, forceMount, context, open, alwaysDisable, ...contentProps } = props;\n\tvar { disableDismissable } = context;\n\tvar keepChildrenMounted = context.keepChildrenMounted || forceMount;\n\tvar handleExitComplete = React.useCallback(function() {\n\t\tsetIsFullyHidden === null || setIsFullyHidden === void 0 || setIsFullyHidden(true);\n\t}, [setIsFullyHidden]);\n\tvar contents = /* @__PURE__ */ jsx(ResetPresence, {\n\t\tdisable: context.breakpointActive,\n\t\tchildren\n\t});\n\tReact.useCallback(function(details) {\n\t\tif (context.closeReasonRef) context.closeReasonRef.current = details.reason === \"escape-key\" ? \"escape-key\" : \"dismiss\";\n\t\tcontext.onOpenChange(false, \"press\");\n\t}, [context]);\n\tif (!context.breakpointActive) {}\n\treturn /* @__PURE__ */ jsx(Animate, {\n\t\ttype: \"presence\",\n\t\tpresent: Boolean(open),\n\t\tkeepChildrenMounted: Boolean(keepChildrenMounted),\n\t\tonExitComplete: handleExitComplete,\n\t\tlazyMount,\n\t\tpassThrough: context.breakpointActive,\n\t\tchildren: /* @__PURE__ */ jsx(PopperContent, {\n\t\t\tscope,\n\t\t\t\"data-state\": getState(open),\n\t\t\tid: context.contentId,\n\t\t\tref: forwardedRef,\n\t\t\tpassThrough: context.breakpointActive,\n\t\t\t...contentProps,\n\t\t\tchildren: /* @__PURE__ */ jsx(PortalAdaptSafe, {\n\t\t\t\tcontext,\n\t\t\t\tchildren: contents\n\t\t\t})\n\t\t}, context.contentId)\n\t});\n});\nvar PopoverClose = createRefComponent(function PopoverClose2(props, forwardedRef) {\n\tvar { scope, className, ...rest } = props;\n\tvar context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(YStack, {\n\t\t...rest,\n\t\tref: forwardedRef,\n\t\tclassName: `is_PopoverClose ${className || \"\"}`.trim(),\n\t\tonPress: composeEventHandlers(props.onPress, function() {\n\t\t\tvar _context_onOpenChange;\n\t\t\treturn context === null || context === void 0 ? void 0 : (_context_onOpenChange = context.onOpenChange) === null || _context_onOpenChange === void 0 ? void 0 : _context_onOpenChange.call(context, false, \"press\");\n\t\t})\n\t});\n});\nvar PopoverArrow = createStyledHOC(PopperArrowFrame, function PopoverArrow2(props, forwardedRef) {\n\tvar { scope, className, ...rest } = props;\n\tif (useAdaptIsActive(usePopoverContext(scope).adaptScope)) return null;\n\treturn /* @__PURE__ */ jsx(PopperArrow, {\n\t\tscope,\n\t\tclassName: `is_PopoverArrow ${className || \"\"}`.trim(),\n\t\t...rest,\n\t\tref: forwardedRef\n\t});\n});\nvar PopoverScrollView = createRefComponent(function(param, ref) {\n\tvar { scope, ...props } = param;\n\tvar context = usePopoverContext(scope);\n\treturn /* @__PURE__ */ jsx(ScrollView, {\n\t\tref,\n\t\tpointerEvents: context.breakpointActive ? \"none\" : void 0,\n\t\tscrollEnabled: !context.breakpointActive,\n\t\tpassThrough: context.breakpointActive,\n\t\t...props\n\t});\n});\nvar DEFAULT_SCOPE = \"\";\nvar Popover = withStaticProperties(createRefComponent(function Popover2(param, ref) {\n\tvar { scope = DEFAULT_SCOPE, ...props } = param;\n\tvar id = React.useId();\n\tvar adaptScope = `PopoverAdapt${scope}`;\n\tvar { open: openProp, defaultOpen, onOpenChange } = props;\n\tvar viaRef = React.useRef(void 0);\n\tvar closeReasonRef = React.useRef(void 0);\n\tvar [open, setOpen] = useControllableState({\n\t\tprop: openProp,\n\t\tdefaultProp: defaultOpen || false,\n\t\tonChange: function(val) {\n\t\t\tonOpenChange === null || onOpenChange === void 0 || onOpenChange(val, viaRef.current);\n\t\t}\n\t});\n\tvar handleOpenChange = useEvent(function(val, via) {\n\t\tviaRef.current = via;\n\t\tsetOpen(val);\n\t});\n\tReact.useEffect(function() {\n\t\tif (!open) return;\n\t\topenPopovers.add(setOpen);\n\t\treturn function() {\n\t\t\topenPopovers.delete(setOpen);\n\t\t};\n\t}, [open, setOpen]);\n\treturn /* @__PURE__ */ jsx(AdaptParent, {\n\t\tscope: adaptScope,\n\t\tadaptChildren: props.children,\n\t\topen,\n\t\tonOpenChange: setOpen,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverInner, {\n\t\t\tadaptScope,\n\t\t\tref,\n\t\t\tid,\n\t\t\tscope,\n\t\t\topen,\n\t\t\tsetOpen,\n\t\t\thandleOpenChange,\n\t\t\tcloseReasonRef,\n\t\t\t...props\n\t\t})\n\t});\n}), {\n\tAnchor: PopoverAnchor,\n\tArrow: PopoverArrow,\n\tTrigger: PopoverTrigger,\n\tContent: PopoverContent,\n\tClose: PopoverClose,\n\tAdapt,\n\tScrollView: PopoverScrollView,\n\tFocusScope: FocusScopeController\n});\nvar PopoverInner = createRefComponent(function PopoverInner2(props, forwardedRef) {\n\tvar { children, open: _openProp, defaultOpen: _defaultOpen, onOpenChange: _onOpenChange, scope = DEFAULT_SCOPE, keepChildrenMounted: keepChildrenMountedProp, hoverable, disableFocus = !hoverable, disableDismissable, zIndex, id, adaptScope, open, setOpen, handleOpenChange, closeReasonRef, ...restProps } = props;\n\tvar triggerRef = React.useRef(null);\n\tvar [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n\tvar [keepChildrenMounted] = useControllableState({\n\t\tprop: keepChildrenMountedProp,\n\t\tdefaultProp: false,\n\t\ttransition: keepChildrenMountedProp === \"lazy\"\n\t});\n\tvar isAdapted = useAdaptIsActive(adaptScope);\n\tvar floatingContext = useFloatingContext({\n\t\topen,\n\t\tsetOpen: handleOpenChange,\n\t\tcloseReasonRef,\n\t\tdisable: isAdapted,\n\t\thoverable,\n\t\tdisableFocus\n\t});\n\tvar [anchorTo, setAnchorToRaw] = React.useState();\n\tvar setAnchorTo = useCreateShallowSetState(setAnchorToRaw);\n\tReact.useImperativeHandle(forwardedRef, function() {\n\t\treturn {\n\t\t\tanchorTo: setAnchorTo,\n\t\t\ttoggle: function() {\n\t\t\t\treturn setOpen(function(prev) {\n\t\t\t\t\treturn !prev;\n\t\t\t\t});\n\t\t\t},\n\t\t\topen: function() {\n\t\t\t\treturn setOpen(true);\n\t\t\t},\n\t\t\tclose: function() {\n\t\t\t\treturn setOpen(false);\n\t\t\t},\n\t\t\tsetOpen\n\t\t};\n\t});\n\tvar contentId = React.useId();\n\tvar onOpenToggle = useEvent(function() {\n\t\tif (open && isAdapted) return;\n\t\tcloseReasonRef.current = open ? \"reference-press\" : void 0;\n\t\tsetOpen(!open);\n\t});\n\tvar onCustomAnchorAdd = React.useCallback(function() {\n\t\treturn setHasCustomAnchor(true);\n\t}, []);\n\tvar onCustomAnchorRemove = React.useCallback(function() {\n\t\treturn setHasCustomAnchor(false);\n\t}, []);\n\tvar contents = /* @__PURE__ */ jsx(Popper, {\n\t\topen,\n\t\tpassThrough: isAdapted,\n\t\tscope,\n\t\tstayInFrame: true,\n\t\t...restProps,\n\t\tchildren: /* @__PURE__ */ jsx(PopoverContextProvider, {\n\t\t\tscope,\n\t\t\topen,\n\t\t\tonOpenChange: handleOpenChange,\n\t\t\tonOpenToggle,\n\t\t\ttriggerRef,\n\t\t\tid,\n\t\t\tcontentId,\n\t\t\thasCustomAnchor,\n\t\t\tonCustomAnchorAdd,\n\t\t\tonCustomAnchorRemove,\n\t\t\tanchorTo,\n\t\t\tadaptScope,\n\t\t\tbreakpointActive: isAdapted,\n\t\t\tkeepChildrenMounted,\n\t\t\tdisableDismissable,\n\t\t\thoverable,\n\t\t\tcloseReasonRef,\n\t\t\tchildren\n\t\t})\n\t});\n\tvar result = /* @__PURE__ */ jsx(Fragment, { children: isWeb ? /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, {\n\t\tvalue: floatingContext,\n\t\tchildren: contents\n\t}) : contents });\n\tif (zIndex !== void 0) return /* @__PURE__ */ jsx(PopoverZIndexContext.Provider, {\n\t\tvalue: zIndex,\n\t\tchildren: result\n\t});\n\treturn result;\n});\nfunction getState(open) {\n\treturn open ? \"open\" : \"closed\";\n}\n\nexport { Popover, PopoverAnchor, PopoverArrow, PopoverClose, PopoverContent, PopoverContext, PopoverContextProvider, PopoverTrigger, PopoverTriggerContext, PopoverZIndexContext, closeLastOpenedPopover, closeOpenPopovers, hasOpenPopovers, usePopoverContext, usePopoverOpen, usePopoverTriggerContext, usePopoverTriggerSetup };"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,IAAI,qBAAqB,yBAAyB;AAClD,IAAI,+BAA+B,IAAI,IAAI;AAC3C,IAAI,kBAAkB,WAAW;CAChC,OAAO,aAAa,OAAO;AAC5B;AACA,IAAI,oBAAoB,WAAW;CAClC,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,aAAa,QAAQ,SAAS,SAAS;EACtC,OAAO,QAAQ,KAAK;CACrB,CAAC;CACD,OAAO;AACR;AACA,IAAI,yBAAyB,WAAW;CACvC,IAAI,aAAa,SAAS,GAAG,OAAO;CACpC,IAAI,OAAO,MAAM,KAAK,YAAY,CAAC,CAAC,IAAI;CACxC,IAAI,MAAM;EACT,KAAK,KAAK;EACV,OAAO;CACR;CACA,OAAO;AACR;AACA,IAAI,iBAAiB,oBAAoB,CAAC,GAAG,WAAW;AACxD,IAAI,uBAAuC,sBAAM,cAAc,KAAK,CAAC;AACrE,IAAI,wBAAwB,oBAAoB,CAAC,GAAG,kBAAkB;AACtE,IAAI,oBAAoB,eAAe;AACvC,IAAI,2BAA2B,sBAAsB;AACrD,SAAS,eAAe,OAAO;CAC9B,OAAO,kBAAkB,KAAK,CAAC,CAAC;AACjC;AACA,SAAS,uBAAuB,MAAM;CACrC,IAAI,yBAAyB,MAAM,uBAAuB,IAAI,IAAI,CAAC;CACnE,IAAI,qBAAqB,MAAM,OAAO,IAAI;CAC1C,IAAI,mBAAmB,SAAS,SAAS,IAAI;EAC5C,IAAI,SAAS,mBAAmB;EAChC,IAA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ACrD;GACA;GACA,cAAc;GACd;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA,kBAAkB;GAClB;GACA;GACA;GACA;GACA;EACD,CAAC;CACF,CAAC;CACD,IAAI,SAAyB,oBAAI,UAAU,EAAE,UAAU,QAAwB,oBAAI,wBAAwB,UAAU;EACpH,OAAO;EACP,UAAU;CACX,CAAC,IAAI,SAAS,CAAC;CACf,IAAI,WAAW,KAAK,GAAG,OAAuB,oBAAI,qBAAqB,UAAU;EAChF,OAAO;EACP,UAAU;CACX,CAAC;CACD,OAAO;AACR,CAAC;AACD,SAAS,SAAS,MAAM;CACvB,OAAO,OAAO,SAAS;AACxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PopupTriggerMap, createFloatingEvents, safePolygon, useDelayGroup, useFloatingRaw, useFocus, useHover, useInteractions, useRole } from "@tamagui/floating";
|
|
3
3
|
|
|
4
|
-
const useFloatingContext = ({ open, setOpen, disable, disableFocus, hoverable, role: roleProp = "dialog", focus: focusProp, groupId, delay: delayProp, restMs: restMsProp }) => {
|
|
4
|
+
const useFloatingContext = ({ open, setOpen, disable, disableFocus, hoverable, role: roleProp = "dialog", focus: focusProp, groupId, delay: delayProp, restMs: restMsProp, closeReasonRef }) => {
|
|
5
5
|
"use no memo";
|
|
6
6
|
const openRef = React.useRef(open);
|
|
7
7
|
openRef.current = open;
|
|
@@ -24,8 +24,19 @@ const useFloatingContext = ({ open, setOpen, disable, disableFocus, hoverable, r
|
|
|
24
24
|
const events = React.useMemo(() => createFloatingEvents(), []);
|
|
25
25
|
const triggerElements = React.useMemo(() => new PopupTriggerMap(), []);
|
|
26
26
|
React.useEffect(() => {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const reason = closeReasonRef?.current;
|
|
28
|
+
if (closeReasonRef) {
|
|
29
|
+
closeReasonRef.current = void 0;
|
|
30
|
+
}
|
|
31
|
+
events.emit("openchange", {
|
|
32
|
+
open,
|
|
33
|
+
reason: open ? void 0 : reason
|
|
34
|
+
});
|
|
35
|
+
}, [
|
|
36
|
+
open,
|
|
37
|
+
events,
|
|
38
|
+
closeReasonRef
|
|
39
|
+
]);
|
|
29
40
|
return React.useCallback((props) => {
|
|
30
41
|
const onTriggerRef = React.useRef(false);
|
|
31
42
|
const restTimerRef = React.useRef(void 0);
|
|
@@ -39,7 +50,7 @@ const useFloatingContext = ({ open, setOpen, disable, disableFocus, hoverable, r
|
|
|
39
50
|
clearTimeout(graceRef.current);
|
|
40
51
|
};
|
|
41
52
|
}, []);
|
|
42
|
-
const onOpenChange = (val, event) => {
|
|
53
|
+
const onOpenChange = (val, event, reason) => {
|
|
43
54
|
if (val && event?.type === "mouseenter") {
|
|
44
55
|
return;
|
|
45
56
|
}
|
|
@@ -48,6 +59,7 @@ const useFloatingContext = ({ open, setOpen, disable, disableFocus, hoverable, r
|
|
|
48
59
|
return;
|
|
49
60
|
}
|
|
50
61
|
const type = event?.type === "mousemove" || event?.type === "mouseenter" || event?.type === "mouseleave" ? "hover" : "press";
|
|
62
|
+
if (closeReasonRef) closeReasonRef.current = reason;
|
|
51
63
|
setOpen(val, type);
|
|
52
64
|
};
|
|
53
65
|
const floating = useFloatingRaw({
|
|
@@ -184,7 +196,7 @@ const useFloatingContext = ({ open, setOpen, disable, disableFocus, hoverable, r
|
|
|
184
196
|
}, 40);
|
|
185
197
|
} : void 0
|
|
186
198
|
};
|
|
187
|
-
}, [setOpen]);
|
|
199
|
+
}, [setOpen, closeReasonRef]);
|
|
188
200
|
};
|
|
189
201
|
|
|
190
202
|
export { useFloatingContext };
|