@wix/site-ui 1.347.0 → 1.348.0
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/{6706.js → 1093.js} +3 -3
- package/dist/{8724.js → 1219.js} +2 -2
- package/dist/{7373.js → 1288.js} +8 -2
- package/dist/{5299.js → 1381.js} +98 -127
- package/dist/{3056.js → 1607.js} +32 -34
- package/dist/1629.js +2 -0
- package/dist/1669.js +75 -0
- package/dist/1718.js +26 -0
- package/dist/{1477.js → 201.js} +17 -26
- package/dist/2221.js +9 -0
- package/dist/{2445.js → 226.js} +12 -48
- package/dist/2387.js +7 -0
- package/dist/2580.js +6 -0
- package/dist/{1500.js → 2859.js} +10 -34
- package/dist/3014.js +178 -0
- package/dist/{6247.js → 3054.js} +3 -3
- package/dist/{7642.js → 3093.js} +1 -1
- package/dist/3189.js +5 -0
- package/dist/{7564.js → 331.js} +2 -2
- package/dist/3357.js +7 -0
- package/dist/{487.js → 3398.js} +38 -39
- package/dist/3502.js +224 -0
- package/dist/3695.js +50 -0
- package/dist/3829.js +1 -1
- package/dist/{6588.js → 3859.js} +115 -92
- package/dist/{3670.js → 3910.js} +28 -21
- package/dist/392.js +7 -0
- package/dist/{4549.js → 4155.js} +11 -3
- package/dist/4226.js +7 -0
- package/dist/{6329.js → 4229.js} +1 -1
- package/dist/4293.js +3 -0
- package/dist/4346.js +853 -2
- package/dist/{285.js → 4472.js} +3 -3
- package/dist/4605.js +207 -0
- package/dist/{7366.js → 488.js} +60 -7
- package/dist/{8750.js → 497.js} +190 -375
- package/dist/4989.js +35 -0
- package/dist/{6270.js → 510.js} +157 -196
- package/dist/5258.js +26 -0
- package/dist/{5036.js → 5275.js} +0 -3
- package/dist/{8171.js → 5298.js} +90 -102
- package/dist/5473.js +11 -0
- package/dist/{4745.js → 5490.js} +3 -1
- package/dist/{6089.js → 5561.js} +869 -786
- package/dist/{8996.js → 5595.js} +4 -3
- package/dist/5890.js +25 -0
- package/dist/{6046.js → 5969.js} +1 -1
- package/dist/5984.js +38 -0
- package/dist/{8527.js → 6006.js} +3 -3
- package/dist/6040.js +97 -0
- package/dist/{8758.js → 6137.js} +10 -8
- package/dist/{4281.js → 6140.js} +18 -10
- package/dist/{8960.js → 6191.js} +2 -2
- package/dist/6240.js +121 -0
- package/dist/{4490.js → 6373.js} +7 -5
- package/dist/{904.js → 6487.js} +19 -17
- package/dist/{9635.js → 6498.js} +1 -1
- package/dist/6499.js +4 -7
- package/dist/6508.js +7 -0
- package/dist/{8225.js → 6540.js} +1 -0
- package/dist/6551.js +46 -0
- package/dist/{9369.js → 6620.js} +35 -34
- package/dist/{4143.js → 6838.js} +19 -10
- package/dist/6902.js +48 -0
- package/dist/6904.js +51 -0
- package/dist/70.js +24 -0
- package/dist/7024.js +39 -0
- package/dist/{6882.js → 721.js} +737 -362
- package/dist/{951.js → 7270.js} +4 -4
- package/dist/{3485.js → 7323.js} +143 -111
- package/dist/{7541.js → 7488.js} +2 -2
- package/dist/{4863.js → 7542.js} +7 -6
- package/dist/7551.js +28 -0
- package/dist/{7021.js → 7640.js} +1 -1
- package/dist/{353.js → 7692.js} +3 -7
- package/dist/{4707.js → 7930.js} +2 -2
- package/dist/{8052.js → 8.js} +80 -64
- package/dist/{6914.js → 8129.js} +3 -15
- package/dist/{3319.js → 8358.js} +62 -63
- package/dist/{5864.js → 8407.js} +13 -13
- package/dist/8488.js +15 -0
- package/dist/{4768.js → 8495.js} +1 -1
- package/dist/8734.js +171 -0
- package/dist/{1763.js → 9018.js} +205 -331
- package/dist/9053.js +29 -0
- package/dist/9067.js +41 -0
- package/dist/{2861.js → 9120.js} +2 -2
- package/dist/{42.js → 9197.js} +2 -2
- package/dist/{9189.js → 9248.js} +36 -17
- package/dist/{2801.js → 9252.js} +4 -9
- package/dist/9295.js +7 -0
- package/dist/9303.js +8 -0
- package/dist/{167.js → 9374.js} +1 -1
- package/dist/{9352.js → 9540.js} +17 -47
- package/dist/9576.js +51 -0
- package/dist/{8272.js → 9591.js} +36 -46
- package/dist/{6107.js → 9770.js} +2 -2
- package/dist/{5085.js → 9880.js} +6 -3
- package/dist/Accordion/index.d.ts +207 -41
- package/dist/Accordion/index.js +75 -177
- package/dist/AlertDialog/index.d.ts +440 -140
- package/dist/AlertDialog/index.js +3 -13
- package/dist/Autocomplete/index.d.ts +722 -150
- package/dist/Autocomplete/index.js +16 -29
- package/dist/Avatar/index.d.ts +38 -3
- package/dist/Avatar/index.js +82 -28
- package/dist/Breadcrumbs/index.d.ts +63 -91
- package/dist/Breadcrumbs/index.js +1 -1
- package/dist/Button/index.d.ts +11 -0
- package/dist/Button/index.js +2 -2
- package/dist/Checkbox/index.d.ts +206 -36
- package/dist/Checkbox/index.js +293 -8
- package/dist/CheckboxField/index.css +1 -1
- package/dist/CheckboxField/index.d.ts +40 -36
- package/dist/CheckboxGroup/index.d.ts +50 -36
- package/dist/CheckboxGroup/index.js +87 -58
- package/dist/CheckboxGroupField/index.css +1 -1
- package/dist/Collapsible/index.d.ts +128 -36
- package/dist/Collapsible/index.js +21 -25
- package/dist/Combobox/index.d.ts +801 -158
- package/dist/Combobox/index.js +70 -114
- package/dist/ContextMenu/index.d.ts +1162 -195
- package/dist/ContextMenu/index.js +46 -36
- package/dist/Dialog/index.d.ts +425 -133
- package/dist/Dialog/index.js +8 -4
- package/dist/Drawer/index.d.ts +589 -144
- package/dist/Drawer/index.js +482 -562
- package/dist/Field/index.css +1 -1
- package/dist/Field/index.d.ts +341 -42
- package/dist/Field/index.js +123 -273
- package/dist/Fieldset/index.d.ts +11 -0
- package/dist/Fieldset/index.js +10 -17
- package/dist/Form/index.d.ts +43 -39
- package/dist/Form/index.js +58 -50
- package/dist/Input/index.css +1 -1
- package/dist/Input/index.d.ts +94 -42
- package/dist/Input/index.js +1 -1
- package/dist/Menu/index.d.ts +1140 -175
- package/dist/Menu/index.js +51 -67
- package/dist/Menubar/index.d.ts +651 -173
- package/dist/Menubar/index.js +12 -16
- package/dist/Meter/index.js +21 -18
- package/dist/NavigationMenu/index.d.ts +370 -86
- package/dist/NavigationMenu/index.js +144 -178
- package/dist/NumberField/index.css +1 -1
- package/dist/NumberField/index.d.ts +507 -47
- package/dist/NumberField/index.js +434 -718
- package/dist/Popover/index.d.ts +561 -142
- package/dist/Popover/index.js +181 -252
- package/dist/PreviewCard/index.d.ts +507 -143
- package/dist/PreviewCard/index.js +97 -151
- package/dist/Progress/index.d.ts +117 -3
- package/dist/Progress/index.js +37 -36
- package/dist/Radio/index.d.ts +177 -7
- package/dist/Radio/index.js +54 -70
- package/dist/RadioField/index.css +1 -1
- package/dist/RadioField/index.d.ts +23 -7
- package/dist/RadioGroup/index.d.ts +51 -37
- package/dist/RadioGroup/index.js +60 -51
- package/dist/RadioGroupField/index.css +1 -1
- package/dist/RadioGroupField/index.d.ts +40 -37
- package/dist/ScrollArea/index.d.ts +295 -1
- package/dist/ScrollArea/index.js +256 -324
- package/dist/Select/index.d.ts +516 -123
- package/dist/Select/index.js +513 -635
- package/dist/SelectField/index.css +1 -1
- package/dist/SelectField/index.d.ts +109 -134
- package/dist/SelectField/index.js +5 -1
- package/dist/Separator/index.d.ts +12 -0
- package/dist/Separator/index.js +1 -1
- package/dist/Slider/index.d.ts +383 -64
- package/dist/Slider/index.js +298 -374
- package/dist/Switch/index.d.ts +184 -37
- package/dist/Switch/index.js +44 -58
- package/dist/Tabs/index.d.ts +220 -35
- package/dist/Tabs/index.js +199 -193
- package/dist/Toast/index.d.ts +280 -64
- package/dist/Toast/index.js +299 -374
- package/dist/Toggle/index.d.ts +55 -35
- package/dist/Toggle/index.js +19 -13
- package/dist/ToggleGroup/index.d.ts +62 -35
- package/dist/ToggleGroup/index.js +13 -31
- package/dist/Toolbar/index.d.ts +117 -2
- package/dist/Toolbar/index.js +31 -43
- package/dist/Tooltip/index.d.ts +507 -150
- package/dist/Tooltip/index.js +163 -213
- package/dist/index.d.ts +12912 -5382
- package/package.json +3 -3
- package/dist/2205.js +0 -26
- package/dist/2274.js +0 -34
- package/dist/2287.js +0 -17
- package/dist/3020.js +0 -7
- package/dist/3021.js +0 -72
- package/dist/3140.js +0 -4
- package/dist/3248.js +0 -307
- package/dist/4026.js +0 -12
- package/dist/4922.js +0 -15
- package/dist/5659.js +0 -4
- package/dist/5992.js +0 -447
- package/dist/6330.js +0 -30
- package/dist/6535.js +0 -72
- package/dist/6917.js +0 -55
- package/dist/7725.js +0 -10
- package/dist/7871.js +0 -38
- package/dist/8106.js +0 -239
- package/dist/8685.js +0 -102
- package/dist/8935.js +0 -8
- package/dist/8971.js +0 -40
- package/dist/8979.js +0 -10
- package/dist/9048.js +0 -52
- package/dist/9087.js +0 -256
- package/dist/9255.js +0 -136
- /package/dist/{1457.js → 1068.js} +0 -0
- /package/dist/{6003.js → 1234.js} +0 -0
- /package/dist/{4723.js → 1282.js} +0 -0
- /package/dist/{6825.js → 1876.js} +0 -0
- /package/dist/{5778.js → 1885.js} +0 -0
- /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
- /package/dist/{1279.js → 3278.js} +0 -0
- /package/dist/{3296.js → 5568.js} +0 -0
- /package/dist/{8685.css → 6240.css} +0 -0
- /package/dist/{9829.js → 6488.js} +0 -0
- /package/dist/{9863.js → 6534.js} +0 -0
- /package/dist/{4495.js → 7718.js} +0 -0
- /package/dist/{3395.js → 8866.js} +0 -0
- /package/dist/{2418.js → 9837.js} +0 -0
package/dist/Popover/index.js
CHANGED
|
@@ -1,58 +1,60 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { FocusGuard_FocusGuard, CLICK_TRIGGER_IDENTIFIER, FloatingPortal_FloatingPortal, POPUP_COLLISION_AVOIDANCE } from "../
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { useAnchoredPopupScrollLock } from "../
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { useHoverFloatingInteraction } from "../
|
|
16
|
-
import { useTriggerDataForwarding,
|
|
17
|
-
import {
|
|
2
|
+
import { utils_formatErrorMessage } from "../5473.js";
|
|
3
|
+
import { FocusGuard_FocusGuard, CLICK_TRIGGER_IDENTIFIER, FloatingPortal_FloatingPortal, POPUP_COLLISION_AVOIDANCE } from "../3398.js";
|
|
4
|
+
import { useFloatingNodeId, FloatingNode, FloatingTree } from "../4472.js";
|
|
5
|
+
import { usePositioner, useAnchorPositioning, getDisabledMountTransitionStyles } from "../497.js";
|
|
6
|
+
import { useTriggerSwitchTransition } from "../7024.js";
|
|
7
|
+
import { imperativeAction, focusOut, closePress, triggerHover, triggerPress, escapeKey } from "../9837.js";
|
|
8
|
+
import { useAnchoredPopupScrollLock } from "../3054.js";
|
|
9
|
+
import { useOpenMethodTriggerProps, FloatingFocusManager, InternalBackdrop_InternalBackdrop } from "../7323.js";
|
|
10
|
+
import { inertValue } from "../9374.js";
|
|
11
|
+
import { useStableCallback } from "../7488.js";
|
|
12
|
+
import { useIsoLayoutEffect } from "../3357.js";
|
|
13
|
+
import { useToolbarRootContext } from "../9770.js";
|
|
14
|
+
import { useOpenChangeComplete } from "../6620.js";
|
|
15
|
+
import { useHoverFloatingInteraction } from "../1607.js";
|
|
16
|
+
import { useTriggerDataForwarding, createDefaultInitialFocus, attachPreventUnmountOnClose, usePopupRootSync, usePopupInteractionProps, PopupTriggerMap, useDismiss, PopupHandleAttachment, useImplicitActiveTrigger, useOpenStateTransitions, usePopupRootStore, FOCUSABLE_POPUP_PROPS, createPopupOpenState } from "../4346.js";
|
|
17
|
+
import { useRenderElement, NOOP } from "../9591.js";
|
|
18
|
+
import { COMPOSITE_KEYS } from "../2859.js";
|
|
19
|
+
import { popupStateMapping, triggerOpenStateMapping, pressableTriggerOpenStateMapping, popupTransitionStateMapping } from "../6904.js";
|
|
18
20
|
import { isHTMLElement } from "../3829.js";
|
|
19
|
-
import { useBaseUiId } from "../
|
|
20
|
-
import { useButton } from "../
|
|
21
|
-
import { createChangeEventDetails } from "../
|
|
22
|
-
import { usePopupViewport } from "../
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { Timeout } from "../
|
|
21
|
+
import { useBaseUiId } from "../5969.js";
|
|
22
|
+
import { useButton } from "../9248.js";
|
|
23
|
+
import { createChangeEventDetails } from "../8495.js";
|
|
24
|
+
import { usePopupViewport, popupViewportStateMapping } from "../5298.js";
|
|
25
|
+
import { fastComponent, fastComponentRef, ReactStore } from "../226.js";
|
|
26
|
+
import { usePopupHandleStore, BasePopupHandle } from "../6040.js";
|
|
27
|
+
import { safePolygon, useHoverReferenceInteraction } from "../3910.js";
|
|
28
|
+
import { useClick } from "../8407.js";
|
|
29
|
+
import { useTriggerFocusGuards } from "../1718.js";
|
|
30
|
+
import { NullStore, popupStoreSelectors, createInitialPopupStoreState } from "../1669.js";
|
|
31
|
+
import { Timeout } from "../9197.js";
|
|
30
32
|
import * as __rspack_external_react from "react";
|
|
31
33
|
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
32
34
|
const PopoverRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
33
35
|
if ("production" !== process.env.NODE_ENV) PopoverRootContext.displayName = "PopoverRootContext";
|
|
34
36
|
function usePopoverRootContext(optional) {
|
|
35
37
|
const context = __rspack_external_react.useContext(PopoverRootContext);
|
|
36
|
-
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.' :
|
|
38
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: PopoverRootContext is missing. Popover parts must be placed within <Popover.Root>.' : utils_formatErrorMessage(47));
|
|
37
39
|
return context;
|
|
38
40
|
}
|
|
39
41
|
const PopoverPositionerContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
40
42
|
if ("production" !== process.env.NODE_ENV) PopoverPositionerContext.displayName = "PopoverPositionerContext";
|
|
41
43
|
function usePopoverPositionerContext() {
|
|
42
44
|
const context = __rspack_external_react.useContext(PopoverPositionerContext);
|
|
43
|
-
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.' :
|
|
45
|
+
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.' : utils_formatErrorMessage(46));
|
|
44
46
|
return context;
|
|
45
47
|
}
|
|
46
48
|
const PopoverPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
47
49
|
if ("production" !== process.env.NODE_ENV) PopoverPortalContext.displayName = "PopoverPortalContext";
|
|
48
50
|
function usePopoverPortalContext() {
|
|
49
51
|
const value = __rspack_external_react.useContext(PopoverPortalContext);
|
|
50
|
-
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Popover.Portal> is missing.' :
|
|
52
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Popover.Portal> is missing.' : utils_formatErrorMessage(45));
|
|
51
53
|
return value;
|
|
52
54
|
}
|
|
53
55
|
const PopoverPositioner_PopoverPositioner = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
54
|
-
const { render, className, style, anchor, positionMethod
|
|
55
|
-
const
|
|
56
|
+
const { render, className, style, anchor, positionMethod, side, align, sideOffset, alignOffset, collisionBoundary = 'clipping-ancestors', collisionPadding, arrowPadding, sticky, disableAnchorTracking = false, collisionAvoidance = POPUP_COLLISION_AVOIDANCE, ...elementProps } = componentProps;
|
|
57
|
+
const store = usePopoverRootContext();
|
|
56
58
|
const keepMounted = usePopoverPortalContext();
|
|
57
59
|
const nodeId = useFloatingNodeId();
|
|
58
60
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
@@ -65,9 +67,7 @@ const PopoverPositioner_PopoverPositioner = /*#__PURE__*/ __rspack_external_reac
|
|
|
65
67
|
const positionerElement = store.useState('positionerElement');
|
|
66
68
|
const instantType = store.useState('instantType');
|
|
67
69
|
const transitionStatus = store.useState('transitionStatus');
|
|
68
|
-
const
|
|
69
|
-
const prevTriggerElementRef = __rspack_external_react.useRef(null);
|
|
70
|
-
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement, false, false);
|
|
70
|
+
const adaptiveOrigin = store.useState('adaptiveOrigin');
|
|
71
71
|
const positioning = useAnchorPositioning({
|
|
72
72
|
anchor,
|
|
73
73
|
floatingRootContext,
|
|
@@ -85,34 +85,18 @@ const PopoverPositioner_PopoverPositioner = /*#__PURE__*/ __rspack_external_reac
|
|
|
85
85
|
keepMounted,
|
|
86
86
|
nodeId,
|
|
87
87
|
collisionAvoidance,
|
|
88
|
-
adaptiveOrigin
|
|
88
|
+
adaptiveOrigin
|
|
89
89
|
});
|
|
90
90
|
const domReference = floatingRootContext.useState('domReferenceElement');
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const prevTriggerElement = prevTriggerElementRef.current;
|
|
94
|
-
if (currentTriggerElement) prevTriggerElementRef.current = currentTriggerElement;
|
|
95
|
-
if (prevTriggerElement && currentTriggerElement && currentTriggerElement !== prevTriggerElement) {
|
|
96
|
-
store.set('instantType', void 0);
|
|
97
|
-
const ac = new AbortController();
|
|
98
|
-
runOnceAnimationsFinish(()=>{
|
|
99
|
-
store.set('instantType', 'trigger-change');
|
|
100
|
-
}, ac.signal);
|
|
101
|
-
return ()=>{
|
|
102
|
-
ac.abort();
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}, [
|
|
91
|
+
useTriggerSwitchTransition({
|
|
92
|
+
store,
|
|
106
93
|
domReference,
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}, [
|
|
114
|
-
store
|
|
115
|
-
]);
|
|
94
|
+
positionerElement,
|
|
95
|
+
open
|
|
96
|
+
});
|
|
97
|
+
const trueModalNonHover = true === modal && openReason !== triggerHover;
|
|
98
|
+
useAnchoredPopupScrollLock(open && trueModalNonHover, 'touch' === openMethod, positionerElement, triggerElement);
|
|
99
|
+
const setPositionerElement = store.useStateSetter('positionerElement');
|
|
116
100
|
const state = {
|
|
117
101
|
open,
|
|
118
102
|
side: positioning.side,
|
|
@@ -134,8 +118,7 @@ const PopoverPositioner_PopoverPositioner = /*#__PURE__*/ __rspack_external_reac
|
|
|
134
118
|
return /*#__PURE__*/ jsxs(PopoverPositionerContext.Provider, {
|
|
135
119
|
value: positioning,
|
|
136
120
|
children: [
|
|
137
|
-
mounted &&
|
|
138
|
-
ref: store.context.internalBackdropRef,
|
|
121
|
+
mounted && trueModalNonHover && /*#__PURE__*/ jsx(InternalBackdrop_InternalBackdrop, {
|
|
139
122
|
inert: inertValue(!open),
|
|
140
123
|
cutout: triggerElement
|
|
141
124
|
}),
|
|
@@ -167,26 +150,15 @@ function useClosePartCount() {
|
|
|
167
150
|
hasClosePart: closePartCount > 0
|
|
168
151
|
};
|
|
169
152
|
}
|
|
170
|
-
function ClosePartProvider(props) {
|
|
171
|
-
const { value, children } = props;
|
|
172
|
-
return /*#__PURE__*/ jsx(ClosePartContext.Provider, {
|
|
173
|
-
value: value,
|
|
174
|
-
children: children
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
153
|
function useClosePartRegistration() {
|
|
178
154
|
const context = __rspack_external_react.useContext(ClosePartContext);
|
|
179
155
|
useIsoLayoutEffect(()=>context?.register(), [
|
|
180
156
|
context
|
|
181
157
|
]);
|
|
182
158
|
}
|
|
183
|
-
const PopoverPopup_stateAttributesMapping = {
|
|
184
|
-
...popupStateMapping,
|
|
185
|
-
...transitionStatusMapping
|
|
186
|
-
};
|
|
187
159
|
const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
188
160
|
const { render, className, style, initialFocus, finalFocus, ...elementProps } = componentProps;
|
|
189
|
-
const
|
|
161
|
+
const store = usePopoverRootContext();
|
|
190
162
|
const positioner = usePopoverPositionerContext();
|
|
191
163
|
const insideToolbar = null != useToolbarRootContext(true);
|
|
192
164
|
const { context: closePartContext, hasClosePart } = useClosePartCount();
|
|
@@ -206,7 +178,6 @@ const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
206
178
|
const disabled = store.useState('disabled');
|
|
207
179
|
const openOnHover = store.useState('openOnHover');
|
|
208
180
|
const closeDelay = store.useState('closeDelay');
|
|
209
|
-
const popupId = elementProps.id ?? floatingId;
|
|
210
181
|
useOpenChangeComplete({
|
|
211
182
|
open,
|
|
212
183
|
ref: store.context.popupRef,
|
|
@@ -218,18 +189,10 @@ const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
218
189
|
enabled: openOnHover && !disabled,
|
|
219
190
|
closeDelay
|
|
220
191
|
});
|
|
221
|
-
|
|
222
|
-
if ('touch' === interactionType) return store.context.popupRef.current;
|
|
223
|
-
return true;
|
|
224
|
-
}
|
|
225
|
-
const resolvedInitialFocus = void 0 === initialFocus ? defaultInitialFocus : initialFocus;
|
|
192
|
+
const resolvedInitialFocus = void 0 === initialFocus ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;
|
|
226
193
|
const focusManagerModal = false !== modal && hasClosePart;
|
|
227
194
|
store.useSyncedValue('focusManagerModal', focusManagerModal);
|
|
228
|
-
const setPopupElement =
|
|
229
|
-
store.set('popupElement', element);
|
|
230
|
-
}, [
|
|
231
|
-
store
|
|
232
|
-
]);
|
|
195
|
+
const setPopupElement = store.useStateSetter('popupElement');
|
|
233
196
|
const state = {
|
|
234
197
|
open,
|
|
235
198
|
side: positioner.side,
|
|
@@ -247,7 +210,7 @@ const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
247
210
|
props: [
|
|
248
211
|
popupProps,
|
|
249
212
|
{
|
|
250
|
-
id:
|
|
213
|
+
id: floatingId,
|
|
251
214
|
role: 'dialog',
|
|
252
215
|
...FOCUSABLE_POPUP_PROPS,
|
|
253
216
|
'aria-labelledby': titleId,
|
|
@@ -259,7 +222,7 @@ const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
259
222
|
getDisabledMountTransitionStyles(transitionStatus),
|
|
260
223
|
elementProps
|
|
261
224
|
],
|
|
262
|
-
stateAttributesMapping:
|
|
225
|
+
stateAttributesMapping: popupTransitionStateMapping
|
|
263
226
|
});
|
|
264
227
|
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
265
228
|
context: floatingContext,
|
|
@@ -269,10 +232,13 @@ const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
269
232
|
initialFocus: resolvedInitialFocus,
|
|
270
233
|
returnFocus: finalFocus,
|
|
271
234
|
restoreFocus: "popup",
|
|
235
|
+
getInsideElements: ()=>[
|
|
236
|
+
store.context.beforeTriggerFocusGuardRef.current
|
|
237
|
+
],
|
|
272
238
|
previousFocusableElement: isHTMLElement(activeTriggerElement) ? activeTriggerElement : void 0,
|
|
273
239
|
nextFocusableElement: store.context.triggerFocusTargetRef,
|
|
274
240
|
beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,
|
|
275
|
-
children: /*#__PURE__*/ jsx(
|
|
241
|
+
children: /*#__PURE__*/ jsx(ClosePartContext.Provider, {
|
|
276
242
|
value: closePartContext,
|
|
277
243
|
children: element
|
|
278
244
|
})
|
|
@@ -281,7 +247,7 @@ const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
281
247
|
if ("production" !== process.env.NODE_ENV) PopoverPopup_PopoverPopup.displayName = "PopoverPopup";
|
|
282
248
|
const PopoverArrow_PopoverArrow = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
283
249
|
const { render, className, style, ...elementProps } = componentProps;
|
|
284
|
-
const
|
|
250
|
+
const store = usePopoverRootContext();
|
|
285
251
|
const open = store.useState('open');
|
|
286
252
|
const { arrowRef, side, align, arrowUncentered, arrowStyles } = usePopoverPositionerContext();
|
|
287
253
|
const state = {
|
|
@@ -308,13 +274,9 @@ const PopoverArrow_PopoverArrow = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
308
274
|
return element;
|
|
309
275
|
});
|
|
310
276
|
if ("production" !== process.env.NODE_ENV) PopoverArrow_PopoverArrow.displayName = "PopoverArrow";
|
|
311
|
-
const PopoverBackdrop_stateAttributesMapping = {
|
|
312
|
-
...popupStateMapping,
|
|
313
|
-
...transitionStatusMapping
|
|
314
|
-
};
|
|
315
277
|
const PopoverBackdrop_PopoverBackdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
316
278
|
const { render, className, style, ...elementProps } = props;
|
|
317
|
-
const
|
|
279
|
+
const store = usePopoverRootContext();
|
|
318
280
|
const open = store.useState('open');
|
|
319
281
|
const mounted = store.useState('mounted');
|
|
320
282
|
const transitionStatus = store.useState('transitionStatus');
|
|
@@ -325,10 +287,7 @@ const PopoverBackdrop_PopoverBackdrop = /*#__PURE__*/ __rspack_external_react.fo
|
|
|
325
287
|
};
|
|
326
288
|
const element = useRenderElement('div', props, {
|
|
327
289
|
state,
|
|
328
|
-
ref:
|
|
329
|
-
store.context.backdropRef,
|
|
330
|
-
forwardedRef
|
|
331
|
-
],
|
|
290
|
+
ref: forwardedRef,
|
|
332
291
|
props: [
|
|
333
292
|
{
|
|
334
293
|
role: 'presentation',
|
|
@@ -341,14 +300,14 @@ const PopoverBackdrop_PopoverBackdrop = /*#__PURE__*/ __rspack_external_react.fo
|
|
|
341
300
|
},
|
|
342
301
|
elementProps
|
|
343
302
|
],
|
|
344
|
-
stateAttributesMapping:
|
|
303
|
+
stateAttributesMapping: popupTransitionStateMapping
|
|
345
304
|
});
|
|
346
305
|
return element;
|
|
347
306
|
});
|
|
348
307
|
if ("production" !== process.env.NODE_ENV) PopoverBackdrop_PopoverBackdrop.displayName = "PopoverBackdrop";
|
|
349
308
|
const PopoverTitle_PopoverTitle = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
350
309
|
const { render, className, style, ...elementProps } = componentProps;
|
|
351
|
-
const
|
|
310
|
+
const store = usePopoverRootContext();
|
|
352
311
|
const id = useBaseUiId(elementProps.id);
|
|
353
312
|
store.useSyncedValueWithCleanup('titleElementId', id);
|
|
354
313
|
const element = useRenderElement('h2', componentProps, {
|
|
@@ -365,7 +324,7 @@ const PopoverTitle_PopoverTitle = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
365
324
|
if ("production" !== process.env.NODE_ENV) PopoverTitle_PopoverTitle.displayName = "PopoverTitle";
|
|
366
325
|
const PopoverDescription_PopoverDescription = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
367
326
|
const { render, className, style, ...elementProps } = componentProps;
|
|
368
|
-
const
|
|
327
|
+
const store = usePopoverRootContext();
|
|
369
328
|
const id = useBaseUiId(elementProps.id);
|
|
370
329
|
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
371
330
|
const element = useRenderElement('p', componentProps, {
|
|
@@ -387,7 +346,7 @@ const PopoverClose_PopoverClose = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
387
346
|
focusableWhenDisabled: false,
|
|
388
347
|
native: nativeButton
|
|
389
348
|
});
|
|
390
|
-
const
|
|
349
|
+
const store = usePopoverRootContext();
|
|
391
350
|
useClosePartRegistration();
|
|
392
351
|
const element = useRenderElement('button', componentProps, {
|
|
393
352
|
ref: [
|
|
@@ -407,25 +366,14 @@ const PopoverClose_PopoverClose = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
407
366
|
return element;
|
|
408
367
|
});
|
|
409
368
|
if ("production" !== process.env.NODE_ENV) PopoverClose_PopoverClose.displayName = "PopoverClose";
|
|
410
|
-
let PopoverViewportCssVars_PopoverViewportCssVars = /*#__PURE__*/ function(PopoverViewportCssVars) {
|
|
411
|
-
PopoverViewportCssVars["popupWidth"] = "--popup-width";
|
|
412
|
-
PopoverViewportCssVars["popupHeight"] = "--popup-height";
|
|
413
|
-
return PopoverViewportCssVars;
|
|
414
|
-
}({});
|
|
415
|
-
const PopoverViewport_stateAttributesMapping = {
|
|
416
|
-
activationDirection: (value)=>value ? {
|
|
417
|
-
'data-activation-direction': value
|
|
418
|
-
} : null
|
|
419
|
-
};
|
|
420
369
|
const PopoverViewport_PopoverViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
421
370
|
const { render, className, style, children, ...elementProps } = componentProps;
|
|
422
|
-
const
|
|
371
|
+
const store = usePopoverRootContext();
|
|
423
372
|
const { side } = usePopoverPositionerContext();
|
|
424
373
|
const instantType = store.useState('instantType');
|
|
425
374
|
const { children: childrenToRender, state: viewportState } = usePopupViewport({
|
|
426
375
|
store,
|
|
427
376
|
side,
|
|
428
|
-
cssVars: PopoverViewportCssVars_PopoverViewportCssVars,
|
|
429
377
|
children
|
|
430
378
|
});
|
|
431
379
|
const state = {
|
|
@@ -442,15 +390,16 @@ const PopoverViewport_PopoverViewport = /*#__PURE__*/ __rspack_external_react.fo
|
|
|
442
390
|
children: childrenToRender
|
|
443
391
|
}
|
|
444
392
|
],
|
|
445
|
-
stateAttributesMapping:
|
|
393
|
+
stateAttributesMapping: popupViewportStateMapping
|
|
446
394
|
});
|
|
447
395
|
});
|
|
448
396
|
if ("production" !== process.env.NODE_ENV) PopoverViewport_PopoverViewport.displayName = "PopoverViewport";
|
|
449
|
-
const PopoverTrigger_PopoverTrigger =
|
|
397
|
+
const PopoverTrigger_PopoverTrigger = fastComponentRef(function(componentProps, forwardedRef) {
|
|
450
398
|
const { render, className, style, disabled = false, nativeButton = true, handle, payload, openOnHover = false, delay = 300, closeDelay = 0, id: idProp, ...elementProps } = componentProps;
|
|
451
|
-
const
|
|
452
|
-
const
|
|
453
|
-
|
|
399
|
+
const rootStore = usePopoverRootContext(true);
|
|
400
|
+
const handleStore = usePopupHandleStore(handle);
|
|
401
|
+
const store = handleStore ?? rootStore;
|
|
402
|
+
if (!store) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Popover.Trigger> must be either used within a <Popover.Root> component or provided with a handle.' : utils_formatErrorMessage(74));
|
|
454
403
|
const thisTriggerId = useBaseUiId(idProp);
|
|
455
404
|
const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);
|
|
456
405
|
const floatingContext = store.useState('floatingRootContext');
|
|
@@ -463,12 +412,11 @@ const PopoverTrigger_PopoverTrigger = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
463
412
|
openOnHover,
|
|
464
413
|
closeDelay
|
|
465
414
|
});
|
|
466
|
-
const
|
|
467
|
-
const
|
|
468
|
-
const
|
|
469
|
-
const focusManagerModal = store.useState('focusManagerModal');
|
|
415
|
+
const isPressOpenedByThisTrigger = store.useState('isPressOpenedByTrigger', thisTriggerId);
|
|
416
|
+
const isTouchPressOpen = store.useState('isTouchPressOpen', openOnHover);
|
|
417
|
+
const hasFocusGuards = store.useState('hasTriggerFocusGuards', thisTriggerId);
|
|
470
418
|
const hoverProps = useHoverReferenceInteraction(floatingContext, {
|
|
471
|
-
enabled:
|
|
419
|
+
enabled: !disabled && openOnHover && !isTouchPressOpen,
|
|
472
420
|
mouseOnly: true,
|
|
473
421
|
move: false,
|
|
474
422
|
handleClose: safePolygon(),
|
|
@@ -480,9 +428,9 @@ const PopoverTrigger_PopoverTrigger = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
480
428
|
isActiveTrigger: isTriggerActive,
|
|
481
429
|
isClosing: ()=>'ending' === store.select('transitionStatus')
|
|
482
430
|
});
|
|
431
|
+
const getStickIfOpen = useStableCallback(()=>store.context.stickIfOpen);
|
|
483
432
|
const click = useClick(floatingContext, {
|
|
484
|
-
|
|
485
|
-
stickIfOpen
|
|
433
|
+
stickIfOpen: getStickIfOpen
|
|
486
434
|
});
|
|
487
435
|
const interactionTypeProps = useOpenMethodTriggerProps(()=>store.select('open'), (interactionType)=>{
|
|
488
436
|
store.set('openMethod', interactionType);
|
|
@@ -494,11 +442,11 @@ const PopoverTrigger_PopoverTrigger = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
494
442
|
});
|
|
495
443
|
const stateAttributesMapping = {
|
|
496
444
|
open (value) {
|
|
497
|
-
if (
|
|
445
|
+
if (isPressOpenedByThisTrigger) return pressableTriggerOpenStateMapping.open(value);
|
|
498
446
|
return triggerOpenStateMapping.open(value);
|
|
499
447
|
}
|
|
500
448
|
};
|
|
501
|
-
const {
|
|
449
|
+
const { handlePreFocusGuardFocus, handleFocusTargetFocus } = useTriggerFocusGuards(store, triggerElementRef);
|
|
502
450
|
const state = {
|
|
503
451
|
disabled,
|
|
504
452
|
open: isOpenedByThisTrigger
|
|
@@ -528,154 +476,138 @@ const PopoverTrigger_PopoverTrigger = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
528
476
|
],
|
|
529
477
|
stateAttributesMapping
|
|
530
478
|
});
|
|
531
|
-
|
|
479
|
+
const keyedElement = /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
480
|
+
children: element
|
|
481
|
+
}, thisTriggerId);
|
|
482
|
+
if (hasFocusGuards) return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
532
483
|
children: [
|
|
533
484
|
/*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
534
|
-
ref:
|
|
485
|
+
ref: store.context.beforeTriggerFocusGuardRef,
|
|
535
486
|
onFocus: handlePreFocusGuardFocus
|
|
536
487
|
}),
|
|
537
|
-
|
|
538
|
-
children: element
|
|
539
|
-
}, thisTriggerId),
|
|
488
|
+
keyedElement,
|
|
540
489
|
/*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
541
490
|
ref: store.context.triggerFocusTargetRef,
|
|
542
491
|
onFocus: handleFocusTargetFocus
|
|
543
492
|
})
|
|
544
493
|
]
|
|
545
494
|
});
|
|
546
|
-
return
|
|
547
|
-
children: element
|
|
548
|
-
}, thisTriggerId);
|
|
495
|
+
return keyedElement;
|
|
549
496
|
});
|
|
550
497
|
if ("production" !== process.env.NODE_ENV) PopoverTrigger_PopoverTrigger.displayName = "PopoverTrigger";
|
|
551
|
-
function createInitialState() {
|
|
552
|
-
return {
|
|
553
|
-
...createInitialPopupStoreState(),
|
|
554
|
-
disabled: false,
|
|
555
|
-
modal: false,
|
|
556
|
-
focusManagerModal: false,
|
|
557
|
-
instantType: void 0,
|
|
558
|
-
openMethod: null,
|
|
559
|
-
openChangeReason: null,
|
|
560
|
-
titleElementId: void 0,
|
|
561
|
-
descriptionElementId: void 0,
|
|
562
|
-
stickIfOpen: true,
|
|
563
|
-
nested: false,
|
|
564
|
-
openOnHover: false,
|
|
565
|
-
closeDelay: 0,
|
|
566
|
-
hasViewport: false
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
498
|
const selectors = {
|
|
570
499
|
...popupStoreSelectors,
|
|
571
|
-
disabled:
|
|
572
|
-
instantType:
|
|
573
|
-
openMethod:
|
|
574
|
-
openChangeReason:
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
500
|
+
disabled: (state)=>state.disabled,
|
|
501
|
+
instantType: (state)=>'trigger-change' !== state.instantType || popupStoreSelectors.open(state) ? state.instantType : void 0,
|
|
502
|
+
openMethod: (state)=>state.openMethod,
|
|
503
|
+
openChangeReason: (state)=>state.openChangeReason,
|
|
504
|
+
isPressOpenedByTrigger: (state, triggerId)=>state.openChangeReason === triggerPress && popupStoreSelectors.isOpenedByTrigger(state, triggerId),
|
|
505
|
+
isTouchPressOpen: (state, openOnHover)=>openOnHover && 'touch' === state.openMethod && state.openChangeReason === triggerPress,
|
|
506
|
+
hasTriggerFocusGuards: (state, triggerId)=>popupStoreSelectors.isOpenedByTrigger(state, triggerId) && !state.focusManagerModal,
|
|
507
|
+
modal: (state)=>state.modal,
|
|
508
|
+
titleElementId: (state)=>state.titleElementId,
|
|
509
|
+
descriptionElementId: (state)=>state.descriptionElementId,
|
|
510
|
+
openOnHover: (state)=>state.openOnHover,
|
|
511
|
+
closeDelay: (state)=>state.closeDelay,
|
|
512
|
+
adaptiveOrigin: (state)=>state.adaptiveOrigin
|
|
583
513
|
};
|
|
584
514
|
class PopoverStore extends ReactStore {
|
|
585
|
-
constructor(initialState, floatingId, nested
|
|
586
|
-
const initial = {
|
|
587
|
-
...createInitialState(),
|
|
588
|
-
...initialState
|
|
589
|
-
};
|
|
515
|
+
constructor(initialState, floatingId, nested){
|
|
590
516
|
const triggerElements = new PopupTriggerMap();
|
|
591
|
-
|
|
592
|
-
initial.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
|
|
593
|
-
super(initial, {
|
|
594
|
-
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
595
|
-
backdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
596
|
-
internalBackdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
597
|
-
onOpenChange: void 0,
|
|
598
|
-
onOpenChangeComplete: void 0,
|
|
599
|
-
triggerFocusTargetRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
600
|
-
beforeContentFocusGuardRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
601
|
-
stickIfOpenTimeout: new Timeout(),
|
|
602
|
-
triggerElements
|
|
603
|
-
}, selectors);
|
|
517
|
+
super(createInitialState(initialState, triggerElements, floatingId, nested), createInitialContext(triggerElements), selectors);
|
|
604
518
|
}
|
|
605
519
|
setOpen = (nextOpen, eventDetails)=>{
|
|
606
520
|
const isHover = eventDetails.reason === triggerHover;
|
|
607
521
|
const isKeyboardClick = eventDetails.reason === triggerPress && 0 === eventDetails.event.detail;
|
|
608
522
|
const isDismissClose = !nextOpen && (eventDetails.reason === escapeKey || null == eventDetails.reason);
|
|
609
|
-
|
|
610
|
-
this.set('preventUnmountingOnClose', true);
|
|
611
|
-
};
|
|
523
|
+
const shouldPreventUnmountOnClose = attachPreventUnmountOnClose(eventDetails);
|
|
612
524
|
const activeTriggerId = this.select('activeTriggerId');
|
|
613
525
|
if (!nextOpen && eventDetails.reason === closePress && null == eventDetails.trigger && null != activeTriggerId) eventDetails.trigger = this.context.triggerElements.getById(activeTriggerId) ?? this.select('activeTriggerElement') ?? void 0;
|
|
614
526
|
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
615
527
|
if (eventDetails.isCanceled) return;
|
|
616
528
|
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
617
529
|
const changeState = ()=>{
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
};
|
|
622
|
-
setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger);
|
|
623
|
-
this.update(updatedState);
|
|
530
|
+
const popupOpenState = createPopupOpenState(this.state, nextOpen, eventDetails.trigger, shouldPreventUnmountOnClose());
|
|
531
|
+
popupOpenState.openChangeReason = eventDetails.reason;
|
|
532
|
+
this.update(popupOpenState);
|
|
624
533
|
};
|
|
625
534
|
if (isHover) {
|
|
626
|
-
this.
|
|
535
|
+
this.context.stickIfOpen = true;
|
|
627
536
|
this.context.stickIfOpenTimeout.start(500, ()=>{
|
|
628
|
-
this.
|
|
537
|
+
this.context.stickIfOpen = false;
|
|
629
538
|
});
|
|
630
539
|
__rspack_external_react_dom_7136dc57.flushSync(changeState);
|
|
631
540
|
} else changeState();
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
else
|
|
541
|
+
let instantType;
|
|
542
|
+
if (isKeyboardClick) instantType = 'click';
|
|
543
|
+
else if (isDismissClose) instantType = 'dismiss';
|
|
544
|
+
else if (eventDetails.reason === focusOut) instantType = 'focus';
|
|
545
|
+
this.set('instantType', instantType);
|
|
635
546
|
};
|
|
636
|
-
static useStore(externalStore, initialState) {
|
|
637
|
-
const { store, internalStore } = usePopupStore(externalStore, (floatingId, nested)=>new PopoverStore(initialState, floatingId, nested));
|
|
638
|
-
__rspack_external_react.useEffect(()=>internalStore?.disposeEffect(), [
|
|
639
|
-
internalStore
|
|
640
|
-
]);
|
|
641
|
-
return store;
|
|
642
|
-
}
|
|
643
|
-
disposeEffect = ()=>this.context.stickIfOpenTimeout.disposeEffect();
|
|
644
547
|
}
|
|
645
|
-
function
|
|
548
|
+
function createNullPopoverStore() {
|
|
549
|
+
const triggerElements = new PopupTriggerMap();
|
|
550
|
+
const store = new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);
|
|
551
|
+
return Object.assign(store, {
|
|
552
|
+
setOpen: NOOP
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
function createInitialState(initialState, triggerElements, floatingId, nested = false) {
|
|
556
|
+
const state = {
|
|
557
|
+
...createInitialPopupStoreState(triggerElements, floatingId, nested),
|
|
558
|
+
disabled: false,
|
|
559
|
+
modal: false,
|
|
560
|
+
focusManagerModal: false,
|
|
561
|
+
instantType: void 0,
|
|
562
|
+
openMethod: null,
|
|
563
|
+
openChangeReason: null,
|
|
564
|
+
titleElementId: void 0,
|
|
565
|
+
descriptionElementId: void 0,
|
|
566
|
+
openOnHover: false,
|
|
567
|
+
closeDelay: 0,
|
|
568
|
+
adaptiveOrigin: void 0,
|
|
569
|
+
...initialState
|
|
570
|
+
};
|
|
571
|
+
if (state.open && initialState?.mounted === void 0) state.mounted = true;
|
|
572
|
+
return state;
|
|
573
|
+
}
|
|
574
|
+
function createInitialContext(triggerElements) {
|
|
575
|
+
return {
|
|
576
|
+
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
577
|
+
onOpenChange: void 0,
|
|
578
|
+
onOpenChangeComplete: void 0,
|
|
579
|
+
triggerFocusTargetRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
580
|
+
beforeTriggerFocusGuardRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
581
|
+
beforeContentFocusGuardRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
582
|
+
stickIfOpenTimeout: new Timeout(),
|
|
583
|
+
stickIfOpen: true,
|
|
584
|
+
triggerElements
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
const PopoverRoot_PopoverRootComponent = fastComponent(function({ props }) {
|
|
646
588
|
const { children, open: openProp, defaultOpen = false, onOpenChange, onOpenChangeComplete, modal = false, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null } = props;
|
|
647
|
-
const store =
|
|
589
|
+
const store = usePopoverRootStore(handle, {
|
|
648
590
|
modal,
|
|
649
591
|
open: defaultOpen,
|
|
650
592
|
openProp,
|
|
651
593
|
activeTriggerId: defaultTriggerIdProp,
|
|
652
594
|
triggerIdProp
|
|
653
595
|
});
|
|
654
|
-
useOnFirstRender(()=>{
|
|
655
|
-
if (void 0 === openProp && false === store.state.open && true === defaultOpen) store.update({
|
|
656
|
-
open: true,
|
|
657
|
-
activeTriggerId: defaultTriggerIdProp
|
|
658
|
-
});
|
|
659
|
-
});
|
|
660
596
|
store.useControlledProp('openProp', openProp);
|
|
661
597
|
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
662
598
|
const open = store.useState('open');
|
|
663
599
|
const mounted = store.useState('mounted');
|
|
664
600
|
const payload = store.useState('payload');
|
|
665
|
-
const nested = null != useFloatingParentNodeId();
|
|
666
601
|
store.useContextCallback('onOpenChange', onOpenChange);
|
|
667
602
|
store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);
|
|
668
603
|
usePopupRootSync(store, open);
|
|
669
604
|
useImplicitActiveTrigger(store);
|
|
670
605
|
const { forceUnmount } = useOpenStateTransitions(open, store, ()=>{
|
|
671
|
-
store.
|
|
672
|
-
|
|
673
|
-
openChangeReason: null
|
|
674
|
-
});
|
|
606
|
+
store.context.stickIfOpen = true;
|
|
607
|
+
store.set('openChangeReason', null);
|
|
675
608
|
});
|
|
676
609
|
store.useSyncedValues({
|
|
677
|
-
modal
|
|
678
|
-
nested
|
|
610
|
+
modal
|
|
679
611
|
});
|
|
680
612
|
__rspack_external_react.useEffect(()=>{
|
|
681
613
|
if (!open) store.context.stickIfOpenTimeout.clear();
|
|
@@ -683,27 +615,21 @@ function PopoverRootComponent({ props }) {
|
|
|
683
615
|
store,
|
|
684
616
|
open
|
|
685
617
|
]);
|
|
686
|
-
const handleImperativeClose = __rspack_external_react.useCallback(()=>{
|
|
687
|
-
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
688
|
-
}, [
|
|
689
|
-
store
|
|
690
|
-
]);
|
|
691
618
|
__rspack_external_react.useImperativeHandle(props.actionsRef, ()=>({
|
|
692
619
|
unmount: forceUnmount,
|
|
693
|
-
close:
|
|
620
|
+
close: ()=>store.setOpen(false, createChangeEventDetails(imperativeAction))
|
|
694
621
|
}), [
|
|
695
622
|
forceUnmount,
|
|
696
|
-
handleImperativeClose
|
|
697
|
-
]);
|
|
698
|
-
const shouldRenderInteractions = open || mounted;
|
|
699
|
-
const popoverContext = __rspack_external_react.useMemo(()=>({
|
|
700
|
-
store
|
|
701
|
-
}), [
|
|
702
623
|
store
|
|
703
624
|
]);
|
|
625
|
+
const shouldRenderInteractions = open || mounted || null != handle;
|
|
704
626
|
return /*#__PURE__*/ jsxs(PopoverRootContext.Provider, {
|
|
705
|
-
value:
|
|
627
|
+
value: store,
|
|
706
628
|
children: [
|
|
629
|
+
handle && /*#__PURE__*/ jsx(PopupHandleAttachment, {
|
|
630
|
+
handle: handle,
|
|
631
|
+
store: store
|
|
632
|
+
}),
|
|
707
633
|
shouldRenderInteractions && /*#__PURE__*/ jsx(PopoverInteractions, {
|
|
708
634
|
store: store,
|
|
709
635
|
modal: modal
|
|
@@ -713,17 +639,25 @@ function PopoverRootComponent({ props }) {
|
|
|
713
639
|
}) : children
|
|
714
640
|
]
|
|
715
641
|
});
|
|
716
|
-
}
|
|
642
|
+
});
|
|
643
|
+
if ("production" !== process.env.NODE_ENV) PopoverRoot_PopoverRootComponent.displayName = "PopoverRootComponent";
|
|
717
644
|
function PopoverRoot(props) {
|
|
718
|
-
if (usePopoverRootContext(true)) return /*#__PURE__*/ jsx(
|
|
645
|
+
if (usePopoverRootContext(true)) return /*#__PURE__*/ jsx(PopoverRoot_PopoverRootComponent, {
|
|
719
646
|
props: props
|
|
720
647
|
});
|
|
721
648
|
return /*#__PURE__*/ jsx(FloatingTree, {
|
|
722
|
-
children: /*#__PURE__*/ jsx(
|
|
649
|
+
children: /*#__PURE__*/ jsx(PopoverRoot_PopoverRootComponent, {
|
|
723
650
|
props: props
|
|
724
651
|
})
|
|
725
652
|
});
|
|
726
653
|
}
|
|
654
|
+
function usePopoverRootStore(handle, initialState) {
|
|
655
|
+
const store = usePopupRootStore((floatingId, nested)=>new PopoverStore(initialState, floatingId, nested));
|
|
656
|
+
__rspack_external_react.useEffect(()=>store.context.stickIfOpenTimeout.disposeEffect(), [
|
|
657
|
+
store
|
|
658
|
+
]);
|
|
659
|
+
return store;
|
|
660
|
+
}
|
|
727
661
|
function PopoverInteractions({ store, modal }) {
|
|
728
662
|
const floatingRootContext = store.useState('floatingRootContext');
|
|
729
663
|
const dismiss = useDismiss(floatingRootContext, {
|
|
@@ -732,21 +666,18 @@ function PopoverInteractions({ store, modal }) {
|
|
|
732
666
|
touch: 'sloppy'
|
|
733
667
|
}
|
|
734
668
|
});
|
|
735
|
-
const
|
|
736
|
-
const
|
|
737
|
-
const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [
|
|
738
|
-
dismiss.floating
|
|
739
|
-
]);
|
|
669
|
+
const triggerProps = dismiss.reference;
|
|
670
|
+
const popupProps = dismiss.floating;
|
|
740
671
|
usePopupInteractionProps(store, {
|
|
741
|
-
activeTriggerProps,
|
|
742
|
-
inactiveTriggerProps,
|
|
672
|
+
activeTriggerProps: triggerProps,
|
|
673
|
+
inactiveTriggerProps: triggerProps,
|
|
743
674
|
popupProps
|
|
744
675
|
});
|
|
745
676
|
return null;
|
|
746
677
|
}
|
|
747
678
|
const PopoverPortal_PopoverPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
748
679
|
const { keepMounted = false, ...portalProps } = props;
|
|
749
|
-
const
|
|
680
|
+
const store = usePopoverRootContext();
|
|
750
681
|
const mounted = store.useState('mounted');
|
|
751
682
|
const shouldRender = mounted || keepMounted;
|
|
752
683
|
if (!shouldRender) return null;
|
|
@@ -759,20 +690,18 @@ const PopoverPortal_PopoverPortal = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
759
690
|
});
|
|
760
691
|
});
|
|
761
692
|
if ("production" !== process.env.NODE_ENV) PopoverPortal_PopoverPortal.displayName = "PopoverPortal";
|
|
762
|
-
class PopoverHandle {
|
|
693
|
+
class PopoverHandle extends BasePopupHandle {
|
|
763
694
|
constructor(){
|
|
764
|
-
|
|
695
|
+
super(createNullPopoverStore(), 'Popover');
|
|
765
696
|
}
|
|
766
697
|
open(triggerId) {
|
|
767
|
-
|
|
768
|
-
if (triggerId && !triggerElement) throw new Error("production" !== process.env.NODE_ENV ? `Base UI: PopoverHandle.open: No trigger found with id "${triggerId}".` : esm_formatErrorMessage(80, triggerId));
|
|
769
|
-
this.store.setOpen(true, createChangeEventDetails(imperativeAction, void 0, triggerElement));
|
|
698
|
+
this.openByTrigger(triggerId);
|
|
770
699
|
}
|
|
771
700
|
close() {
|
|
772
|
-
this.
|
|
701
|
+
this.closePopup();
|
|
773
702
|
}
|
|
774
703
|
get isOpen() {
|
|
775
|
-
return this.
|
|
704
|
+
return this.attachedStore?.select('open') ?? false;
|
|
776
705
|
}
|
|
777
706
|
}
|
|
778
707
|
function createPopoverHandle() {
|