@wix/site-ui 1.30.0 → 1.31.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/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12749 -652
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
package/dist/Popover/index.js
CHANGED
|
@@ -1,7 +1,782 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Popover } from "@base-ui/react/popover";
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { EMPTY_OBJECT, mergeProps, useRenderElement, esm_formatErrorMessage } from "../8272.js";
|
|
4
|
+
import { CLICK_TRIGGER_IDENTIFIER, pressableTriggerOpenStateMapping, FocusGuard_FocusGuard, triggerOpenStateMapping, FloatingPortal_FloatingPortal, popupStateMapping, POPUP_COLLISION_AVOIDANCE } from "../4388.js";
|
|
5
|
+
import { useFloatingParentNodeId, FloatingNode, FloatingTree, useFloatingNodeId } from "../285.js";
|
|
6
|
+
import { transitionStatusMapping, useAnimationsFinished, useOpenChangeComplete } from "../880.js";
|
|
7
|
+
import { usePositioner, adaptiveOriginMiddleware_adaptiveOrigin, useAnchorPositioning, getDisabledMountTransitionStyles } from "../8750.js";
|
|
8
|
+
import { useIsoLayoutEffect } from "../6499.js";
|
|
9
|
+
import { useAnchoredPopupScrollLock } from "../6247.js";
|
|
10
|
+
import { imperativeAction, focusOut, closePress, triggerHover, triggerPress, escapeKey } from "../2418.js";
|
|
11
|
+
import { useOpenMethodTriggerProps, FloatingFocusManager, InternalBackdrop_InternalBackdrop } from "../3485.js";
|
|
12
|
+
import { inertValue } from "../167.js";
|
|
13
|
+
import { useStableCallback } from "../7541.js";
|
|
14
|
+
import { useToolbarRootContext } from "../6107.js";
|
|
15
|
+
import { useHoverFloatingInteraction } from "../3056.js";
|
|
16
|
+
import { useTriggerDataForwarding, usePopupInteractionProps, usePopupRootSync, setOpenTriggerState, usePopupStore, useImplicitActiveTrigger, useOnFirstRender, useOpenStateTransitions, FOCUSABLE_POPUP_PROPS } from "../8106.js";
|
|
17
|
+
import { COMPOSITE_KEYS } from "../1500.js";
|
|
18
|
+
import { isHTMLElement } from "../3829.js";
|
|
19
|
+
import { useBaseUiId } from "../6046.js";
|
|
20
|
+
import { useButton } from "../9189.js";
|
|
21
|
+
import { createChangeEventDetails } from "../4768.js";
|
|
22
|
+
import { usePopupViewport } from "../8171.js";
|
|
23
|
+
import { safePolygon, useHoverReferenceInteraction } from "../3670.js";
|
|
24
|
+
import { useClick } from "../5864.js";
|
|
25
|
+
import { useTriggerFocusGuards } from "../7871.js";
|
|
26
|
+
import { createPopupFloatingRootContext, createInitialPopupStoreState, popupStoreSelectors } from "../6535.js";
|
|
27
|
+
import { useDismiss, PopupTriggerMap, createSelector, ReactStore } from "../5992.js";
|
|
28
|
+
import { Timeout } from "../42.js";
|
|
4
29
|
import * as __rspack_external_react from "react";
|
|
30
|
+
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
31
|
+
const PopoverRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
32
|
+
if ("production" !== process.env.NODE_ENV) PopoverRootContext.displayName = "PopoverRootContext";
|
|
33
|
+
function usePopoverRootContext(optional) {
|
|
34
|
+
const context = __rspack_external_react.useContext(PopoverRootContext);
|
|
35
|
+
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>.' : esm_formatErrorMessage(47));
|
|
36
|
+
return context;
|
|
37
|
+
}
|
|
38
|
+
const PopoverPositionerContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
39
|
+
if ("production" !== process.env.NODE_ENV) PopoverPositionerContext.displayName = "PopoverPositionerContext";
|
|
40
|
+
function usePopoverPositionerContext() {
|
|
41
|
+
const context = __rspack_external_react.useContext(PopoverPositionerContext);
|
|
42
|
+
if (!context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: PopoverPositionerContext is missing. PopoverPositioner parts must be placed within <Popover.Positioner>.' : esm_formatErrorMessage(46));
|
|
43
|
+
return context;
|
|
44
|
+
}
|
|
45
|
+
const PopoverPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
46
|
+
if ("production" !== process.env.NODE_ENV) PopoverPortalContext.displayName = "PopoverPortalContext";
|
|
47
|
+
function usePopoverPortalContext() {
|
|
48
|
+
const value = __rspack_external_react.useContext(PopoverPortalContext);
|
|
49
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Popover.Portal> is missing.' : esm_formatErrorMessage(45));
|
|
50
|
+
return value;
|
|
51
|
+
}
|
|
52
|
+
const PopoverPositioner_PopoverPositioner = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
53
|
+
const { render, className, style, anchor, positionMethod = 'absolute', side = 'bottom', align = 'center', sideOffset = 0, alignOffset = 0, collisionBoundary = 'clipping-ancestors', collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance = POPUP_COLLISION_AVOIDANCE, ...elementProps } = componentProps;
|
|
54
|
+
const { store } = usePopoverRootContext();
|
|
55
|
+
const keepMounted = usePopoverPortalContext();
|
|
56
|
+
const nodeId = useFloatingNodeId();
|
|
57
|
+
const floatingRootContext = store.useState('floatingRootContext');
|
|
58
|
+
const mounted = store.useState('mounted');
|
|
59
|
+
const open = store.useState('open');
|
|
60
|
+
const openReason = store.useState('openChangeReason');
|
|
61
|
+
const triggerElement = store.useState('activeTriggerElement');
|
|
62
|
+
const modal = store.useState('modal');
|
|
63
|
+
const openMethod = store.useState('openMethod');
|
|
64
|
+
const positionerElement = store.useState('positionerElement');
|
|
65
|
+
const instantType = store.useState('instantType');
|
|
66
|
+
const transitionStatus = store.useState('transitionStatus');
|
|
67
|
+
const hasViewport = store.useState('hasViewport');
|
|
68
|
+
const prevTriggerElementRef = __rspack_external_react.useRef(null);
|
|
69
|
+
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement, false, false);
|
|
70
|
+
const positioning = useAnchorPositioning({
|
|
71
|
+
anchor,
|
|
72
|
+
floatingRootContext,
|
|
73
|
+
positionMethod,
|
|
74
|
+
mounted,
|
|
75
|
+
side,
|
|
76
|
+
sideOffset,
|
|
77
|
+
align,
|
|
78
|
+
alignOffset,
|
|
79
|
+
arrowPadding,
|
|
80
|
+
collisionBoundary,
|
|
81
|
+
collisionPadding,
|
|
82
|
+
sticky,
|
|
83
|
+
disableAnchorTracking,
|
|
84
|
+
keepMounted,
|
|
85
|
+
nodeId,
|
|
86
|
+
collisionAvoidance,
|
|
87
|
+
adaptiveOrigin: hasViewport ? adaptiveOriginMiddleware_adaptiveOrigin : void 0
|
|
88
|
+
});
|
|
89
|
+
const domReference = floatingRootContext.useState('domReferenceElement');
|
|
90
|
+
useIsoLayoutEffect(()=>{
|
|
91
|
+
const currentTriggerElement = domReference;
|
|
92
|
+
const prevTriggerElement = prevTriggerElementRef.current;
|
|
93
|
+
if (currentTriggerElement) prevTriggerElementRef.current = currentTriggerElement;
|
|
94
|
+
if (prevTriggerElement && currentTriggerElement && currentTriggerElement !== prevTriggerElement) {
|
|
95
|
+
store.set('instantType', void 0);
|
|
96
|
+
const ac = new AbortController();
|
|
97
|
+
runOnceAnimationsFinish(()=>{
|
|
98
|
+
store.set('instantType', 'trigger-change');
|
|
99
|
+
}, ac.signal);
|
|
100
|
+
return ()=>{
|
|
101
|
+
ac.abort();
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
}, [
|
|
105
|
+
domReference,
|
|
106
|
+
runOnceAnimationsFinish,
|
|
107
|
+
store
|
|
108
|
+
]);
|
|
109
|
+
useAnchoredPopupScrollLock(open && true === modal && openReason !== triggerHover, 'touch' === openMethod, positionerElement, triggerElement);
|
|
110
|
+
const setPositionerElement = __rspack_external_react.useCallback((element)=>{
|
|
111
|
+
store.set('positionerElement', element);
|
|
112
|
+
}, [
|
|
113
|
+
store
|
|
114
|
+
]);
|
|
115
|
+
const state = {
|
|
116
|
+
open,
|
|
117
|
+
side: positioning.side,
|
|
118
|
+
align: positioning.align,
|
|
119
|
+
anchorHidden: positioning.anchorHidden,
|
|
120
|
+
instant: instantType
|
|
121
|
+
};
|
|
122
|
+
const element = usePositioner(componentProps, state, {
|
|
123
|
+
styles: positioning.positionerStyles,
|
|
124
|
+
transitionStatus,
|
|
125
|
+
props: elementProps,
|
|
126
|
+
refs: [
|
|
127
|
+
forwardedRef,
|
|
128
|
+
setPositionerElement
|
|
129
|
+
],
|
|
130
|
+
hidden: !mounted,
|
|
131
|
+
inert: !open
|
|
132
|
+
});
|
|
133
|
+
return /*#__PURE__*/ jsxs(PopoverPositionerContext.Provider, {
|
|
134
|
+
value: positioning,
|
|
135
|
+
children: [
|
|
136
|
+
mounted && true === modal && openReason !== triggerHover && /*#__PURE__*/ jsx(InternalBackdrop_InternalBackdrop, {
|
|
137
|
+
ref: store.context.internalBackdropRef,
|
|
138
|
+
inert: inertValue(!open),
|
|
139
|
+
cutout: triggerElement
|
|
140
|
+
}),
|
|
141
|
+
/*#__PURE__*/ jsx(FloatingNode, {
|
|
142
|
+
id: nodeId,
|
|
143
|
+
children: element
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
if ("production" !== process.env.NODE_ENV) PopoverPositioner_PopoverPositioner.displayName = "PopoverPositioner";
|
|
149
|
+
const ClosePartContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
150
|
+
if ("production" !== process.env.NODE_ENV) ClosePartContext.displayName = "ClosePartContext";
|
|
151
|
+
function useClosePartCount() {
|
|
152
|
+
const [closePartCount, setClosePartCount] = __rspack_external_react.useState(0);
|
|
153
|
+
const register = useStableCallback(()=>{
|
|
154
|
+
setClosePartCount((count)=>count + 1);
|
|
155
|
+
return ()=>{
|
|
156
|
+
setClosePartCount((count)=>Math.max(0, count - 1));
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
const context = __rspack_external_react.useMemo(()=>({
|
|
160
|
+
register
|
|
161
|
+
}), [
|
|
162
|
+
register
|
|
163
|
+
]);
|
|
164
|
+
return {
|
|
165
|
+
context,
|
|
166
|
+
hasClosePart: closePartCount > 0
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function ClosePartProvider(props) {
|
|
170
|
+
const { value, children } = props;
|
|
171
|
+
return /*#__PURE__*/ jsx(ClosePartContext.Provider, {
|
|
172
|
+
value: value,
|
|
173
|
+
children: children
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
function useClosePartRegistration() {
|
|
177
|
+
const context = __rspack_external_react.useContext(ClosePartContext);
|
|
178
|
+
useIsoLayoutEffect(()=>context?.register(), [
|
|
179
|
+
context
|
|
180
|
+
]);
|
|
181
|
+
}
|
|
182
|
+
const PopoverPopup_stateAttributesMapping = {
|
|
183
|
+
...popupStateMapping,
|
|
184
|
+
...transitionStatusMapping
|
|
185
|
+
};
|
|
186
|
+
const PopoverPopup_PopoverPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
187
|
+
const { render, className, style, initialFocus, finalFocus, ...elementProps } = componentProps;
|
|
188
|
+
const { store } = usePopoverRootContext();
|
|
189
|
+
const positioner = usePopoverPositionerContext();
|
|
190
|
+
const insideToolbar = null != useToolbarRootContext(true);
|
|
191
|
+
const { context: closePartContext, hasClosePart } = useClosePartCount();
|
|
192
|
+
const open = store.useState('open');
|
|
193
|
+
const openMethod = store.useState('openMethod');
|
|
194
|
+
const instantType = store.useState('instantType');
|
|
195
|
+
const transitionStatus = store.useState('transitionStatus');
|
|
196
|
+
const popupProps = store.useState('popupProps');
|
|
197
|
+
const titleId = store.useState('titleElementId');
|
|
198
|
+
const descriptionId = store.useState("descriptionElementId");
|
|
199
|
+
const modal = store.useState('modal');
|
|
200
|
+
const mounted = store.useState('mounted');
|
|
201
|
+
const openReason = store.useState('openChangeReason');
|
|
202
|
+
const activeTriggerElement = store.useState('activeTriggerElement');
|
|
203
|
+
const floatingContext = store.useState('floatingRootContext');
|
|
204
|
+
const floatingId = floatingContext.useState('floatingId');
|
|
205
|
+
const disabled = store.useState('disabled');
|
|
206
|
+
const openOnHover = store.useState('openOnHover');
|
|
207
|
+
const closeDelay = store.useState('closeDelay');
|
|
208
|
+
const popupId = elementProps.id ?? floatingId;
|
|
209
|
+
useOpenChangeComplete({
|
|
210
|
+
open,
|
|
211
|
+
ref: store.context.popupRef,
|
|
212
|
+
onComplete () {
|
|
213
|
+
if (open) store.context.onOpenChangeComplete?.(true);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
useHoverFloatingInteraction(floatingContext, {
|
|
217
|
+
enabled: openOnHover && !disabled,
|
|
218
|
+
closeDelay
|
|
219
|
+
});
|
|
220
|
+
function defaultInitialFocus(interactionType) {
|
|
221
|
+
if ('touch' === interactionType) return store.context.popupRef.current;
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
const resolvedInitialFocus = void 0 === initialFocus ? defaultInitialFocus : initialFocus;
|
|
225
|
+
const focusManagerModal = false !== modal && hasClosePart;
|
|
226
|
+
store.useSyncedValue('focusManagerModal', focusManagerModal);
|
|
227
|
+
const setPopupElement = __rspack_external_react.useCallback((element)=>{
|
|
228
|
+
store.set('popupElement', element);
|
|
229
|
+
}, [
|
|
230
|
+
store
|
|
231
|
+
]);
|
|
232
|
+
const state = {
|
|
233
|
+
open,
|
|
234
|
+
side: positioner.side,
|
|
235
|
+
align: positioner.align,
|
|
236
|
+
instant: instantType,
|
|
237
|
+
transitionStatus
|
|
238
|
+
};
|
|
239
|
+
const element = useRenderElement('div', componentProps, {
|
|
240
|
+
state,
|
|
241
|
+
ref: [
|
|
242
|
+
forwardedRef,
|
|
243
|
+
store.context.popupRef,
|
|
244
|
+
setPopupElement
|
|
245
|
+
],
|
|
246
|
+
props: [
|
|
247
|
+
popupProps,
|
|
248
|
+
{
|
|
249
|
+
id: popupId,
|
|
250
|
+
role: 'dialog',
|
|
251
|
+
...FOCUSABLE_POPUP_PROPS,
|
|
252
|
+
'aria-labelledby': titleId,
|
|
253
|
+
'aria-describedby': descriptionId,
|
|
254
|
+
onKeyDown (event) {
|
|
255
|
+
if (insideToolbar && COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
getDisabledMountTransitionStyles(transitionStatus),
|
|
259
|
+
elementProps
|
|
260
|
+
],
|
|
261
|
+
stateAttributesMapping: PopoverPopup_stateAttributesMapping
|
|
262
|
+
});
|
|
263
|
+
return /*#__PURE__*/ jsx(FloatingFocusManager, {
|
|
264
|
+
context: floatingContext,
|
|
265
|
+
openInteractionType: openMethod,
|
|
266
|
+
modal: focusManagerModal,
|
|
267
|
+
disabled: !mounted || openReason === triggerHover,
|
|
268
|
+
initialFocus: resolvedInitialFocus,
|
|
269
|
+
returnFocus: finalFocus,
|
|
270
|
+
restoreFocus: "popup",
|
|
271
|
+
previousFocusableElement: isHTMLElement(activeTriggerElement) ? activeTriggerElement : void 0,
|
|
272
|
+
nextFocusableElement: store.context.triggerFocusTargetRef,
|
|
273
|
+
beforeContentFocusGuardRef: store.context.beforeContentFocusGuardRef,
|
|
274
|
+
children: /*#__PURE__*/ jsx(ClosePartProvider, {
|
|
275
|
+
value: closePartContext,
|
|
276
|
+
children: element
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
if ("production" !== process.env.NODE_ENV) PopoverPopup_PopoverPopup.displayName = "PopoverPopup";
|
|
281
|
+
const PopoverArrow_PopoverArrow = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
282
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
283
|
+
const { store } = usePopoverRootContext();
|
|
284
|
+
const open = store.useState('open');
|
|
285
|
+
const { arrowRef, side, align, arrowUncentered, arrowStyles } = usePopoverPositionerContext();
|
|
286
|
+
const state = {
|
|
287
|
+
open,
|
|
288
|
+
side,
|
|
289
|
+
align,
|
|
290
|
+
uncentered: arrowUncentered
|
|
291
|
+
};
|
|
292
|
+
const element = useRenderElement('div', componentProps, {
|
|
293
|
+
state,
|
|
294
|
+
ref: [
|
|
295
|
+
forwardedRef,
|
|
296
|
+
arrowRef
|
|
297
|
+
],
|
|
298
|
+
props: [
|
|
299
|
+
{
|
|
300
|
+
style: arrowStyles,
|
|
301
|
+
'aria-hidden': true
|
|
302
|
+
},
|
|
303
|
+
elementProps
|
|
304
|
+
],
|
|
305
|
+
stateAttributesMapping: popupStateMapping
|
|
306
|
+
});
|
|
307
|
+
return element;
|
|
308
|
+
});
|
|
309
|
+
if ("production" !== process.env.NODE_ENV) PopoverArrow_PopoverArrow.displayName = "PopoverArrow";
|
|
310
|
+
const PopoverBackdrop_stateAttributesMapping = {
|
|
311
|
+
...popupStateMapping,
|
|
312
|
+
...transitionStatusMapping
|
|
313
|
+
};
|
|
314
|
+
const PopoverBackdrop_PopoverBackdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
315
|
+
const { render, className, style, ...elementProps } = props;
|
|
316
|
+
const { store } = usePopoverRootContext();
|
|
317
|
+
const open = store.useState('open');
|
|
318
|
+
const mounted = store.useState('mounted');
|
|
319
|
+
const transitionStatus = store.useState('transitionStatus');
|
|
320
|
+
const openReason = store.useState('openChangeReason');
|
|
321
|
+
const state = {
|
|
322
|
+
open,
|
|
323
|
+
transitionStatus
|
|
324
|
+
};
|
|
325
|
+
const element = useRenderElement('div', props, {
|
|
326
|
+
state,
|
|
327
|
+
ref: [
|
|
328
|
+
store.context.backdropRef,
|
|
329
|
+
forwardedRef
|
|
330
|
+
],
|
|
331
|
+
props: [
|
|
332
|
+
{
|
|
333
|
+
role: 'presentation',
|
|
334
|
+
hidden: !mounted,
|
|
335
|
+
style: {
|
|
336
|
+
pointerEvents: openReason === triggerHover ? 'none' : void 0,
|
|
337
|
+
userSelect: 'none',
|
|
338
|
+
WebkitUserSelect: 'none'
|
|
339
|
+
}
|
|
340
|
+
},
|
|
341
|
+
elementProps
|
|
342
|
+
],
|
|
343
|
+
stateAttributesMapping: PopoverBackdrop_stateAttributesMapping
|
|
344
|
+
});
|
|
345
|
+
return element;
|
|
346
|
+
});
|
|
347
|
+
if ("production" !== process.env.NODE_ENV) PopoverBackdrop_PopoverBackdrop.displayName = "PopoverBackdrop";
|
|
348
|
+
const PopoverTitle_PopoverTitle = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
349
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
350
|
+
const { store } = usePopoverRootContext();
|
|
351
|
+
const id = useBaseUiId(elementProps.id);
|
|
352
|
+
store.useSyncedValueWithCleanup('titleElementId', id);
|
|
353
|
+
const element = useRenderElement('h2', componentProps, {
|
|
354
|
+
ref: forwardedRef,
|
|
355
|
+
props: [
|
|
356
|
+
{
|
|
357
|
+
id
|
|
358
|
+
},
|
|
359
|
+
elementProps
|
|
360
|
+
]
|
|
361
|
+
});
|
|
362
|
+
return element;
|
|
363
|
+
});
|
|
364
|
+
if ("production" !== process.env.NODE_ENV) PopoverTitle_PopoverTitle.displayName = "PopoverTitle";
|
|
365
|
+
const PopoverDescription_PopoverDescription = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
366
|
+
const { render, className, style, ...elementProps } = componentProps;
|
|
367
|
+
const { store } = usePopoverRootContext();
|
|
368
|
+
const id = useBaseUiId(elementProps.id);
|
|
369
|
+
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
370
|
+
const element = useRenderElement('p', componentProps, {
|
|
371
|
+
ref: forwardedRef,
|
|
372
|
+
props: [
|
|
373
|
+
{
|
|
374
|
+
id
|
|
375
|
+
},
|
|
376
|
+
elementProps
|
|
377
|
+
]
|
|
378
|
+
});
|
|
379
|
+
return element;
|
|
380
|
+
});
|
|
381
|
+
if ("production" !== process.env.NODE_ENV) PopoverDescription_PopoverDescription.displayName = "PopoverDescription";
|
|
382
|
+
const PopoverClose_PopoverClose = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
383
|
+
const { render, className, style, disabled = false, nativeButton = true, ...elementProps } = componentProps;
|
|
384
|
+
const { buttonRef, getButtonProps } = useButton({
|
|
385
|
+
disabled,
|
|
386
|
+
focusableWhenDisabled: false,
|
|
387
|
+
native: nativeButton
|
|
388
|
+
});
|
|
389
|
+
const { store } = usePopoverRootContext();
|
|
390
|
+
useClosePartRegistration();
|
|
391
|
+
const element = useRenderElement('button', componentProps, {
|
|
392
|
+
ref: [
|
|
393
|
+
forwardedRef,
|
|
394
|
+
buttonRef
|
|
395
|
+
],
|
|
396
|
+
props: [
|
|
397
|
+
{
|
|
398
|
+
onClick (event) {
|
|
399
|
+
store.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent));
|
|
400
|
+
}
|
|
401
|
+
},
|
|
402
|
+
elementProps,
|
|
403
|
+
getButtonProps
|
|
404
|
+
]
|
|
405
|
+
});
|
|
406
|
+
return element;
|
|
407
|
+
});
|
|
408
|
+
if ("production" !== process.env.NODE_ENV) PopoverClose_PopoverClose.displayName = "PopoverClose";
|
|
409
|
+
let PopoverViewportCssVars_PopoverViewportCssVars = /*#__PURE__*/ function(PopoverViewportCssVars) {
|
|
410
|
+
PopoverViewportCssVars["popupWidth"] = "--popup-width";
|
|
411
|
+
PopoverViewportCssVars["popupHeight"] = "--popup-height";
|
|
412
|
+
return PopoverViewportCssVars;
|
|
413
|
+
}({});
|
|
414
|
+
const PopoverViewport_stateAttributesMapping = {
|
|
415
|
+
activationDirection: (value)=>value ? {
|
|
416
|
+
'data-activation-direction': value
|
|
417
|
+
} : null
|
|
418
|
+
};
|
|
419
|
+
const PopoverViewport_PopoverViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
420
|
+
const { render, className, style, children, ...elementProps } = componentProps;
|
|
421
|
+
const { store } = usePopoverRootContext();
|
|
422
|
+
const { side } = usePopoverPositionerContext();
|
|
423
|
+
const instantType = store.useState('instantType');
|
|
424
|
+
const { children: childrenToRender, state: viewportState } = usePopupViewport({
|
|
425
|
+
store,
|
|
426
|
+
side,
|
|
427
|
+
cssVars: PopoverViewportCssVars_PopoverViewportCssVars,
|
|
428
|
+
children
|
|
429
|
+
});
|
|
430
|
+
const state = {
|
|
431
|
+
activationDirection: viewportState.activationDirection,
|
|
432
|
+
transitioning: viewportState.transitioning,
|
|
433
|
+
instant: instantType
|
|
434
|
+
};
|
|
435
|
+
return useRenderElement('div', componentProps, {
|
|
436
|
+
state,
|
|
437
|
+
ref: forwardedRef,
|
|
438
|
+
props: [
|
|
439
|
+
elementProps,
|
|
440
|
+
{
|
|
441
|
+
children: childrenToRender
|
|
442
|
+
}
|
|
443
|
+
],
|
|
444
|
+
stateAttributesMapping: PopoverViewport_stateAttributesMapping
|
|
445
|
+
});
|
|
446
|
+
});
|
|
447
|
+
if ("production" !== process.env.NODE_ENV) PopoverViewport_PopoverViewport.displayName = "PopoverViewport";
|
|
448
|
+
const PopoverTrigger_PopoverTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
449
|
+
const { render, className, style, disabled = false, nativeButton = true, handle, payload, openOnHover = false, delay = 300, closeDelay = 0, id: idProp, ...elementProps } = componentProps;
|
|
450
|
+
const rootContext = usePopoverRootContext(true);
|
|
451
|
+
const store = handle?.store ?? rootContext?.store;
|
|
452
|
+
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.' : esm_formatErrorMessage(74));
|
|
453
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
454
|
+
const isTriggerActive = store.useState('isTriggerActive', thisTriggerId);
|
|
455
|
+
const floatingContext = store.useState('floatingRootContext');
|
|
456
|
+
const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
|
|
457
|
+
const popupId = store.useState('triggerPopupId', thisTriggerId);
|
|
458
|
+
const triggerElementRef = __rspack_external_react.useRef(null);
|
|
459
|
+
const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
460
|
+
payload,
|
|
461
|
+
disabled,
|
|
462
|
+
openOnHover,
|
|
463
|
+
closeDelay
|
|
464
|
+
});
|
|
465
|
+
const openReason = store.useState('openChangeReason');
|
|
466
|
+
const stickIfOpen = store.useState('stickIfOpen');
|
|
467
|
+
const openMethod = store.useState('openMethod');
|
|
468
|
+
const focusManagerModal = store.useState('focusManagerModal');
|
|
469
|
+
const hoverProps = useHoverReferenceInteraction(floatingContext, {
|
|
470
|
+
enabled: null != floatingContext && openOnHover && ('touch' !== openMethod || openReason !== triggerPress),
|
|
471
|
+
mouseOnly: true,
|
|
472
|
+
move: false,
|
|
473
|
+
handleClose: safePolygon(),
|
|
474
|
+
restMs: delay,
|
|
475
|
+
delay: {
|
|
476
|
+
close: closeDelay
|
|
477
|
+
},
|
|
478
|
+
triggerElementRef,
|
|
479
|
+
isActiveTrigger: isTriggerActive,
|
|
480
|
+
isClosing: ()=>'ending' === store.select('transitionStatus')
|
|
481
|
+
});
|
|
482
|
+
const click = useClick(floatingContext, {
|
|
483
|
+
enabled: null != floatingContext,
|
|
484
|
+
stickIfOpen
|
|
485
|
+
});
|
|
486
|
+
const interactionTypeProps = useOpenMethodTriggerProps(()=>store.select('open'), (interactionType)=>{
|
|
487
|
+
store.set('openMethod', interactionType);
|
|
488
|
+
});
|
|
489
|
+
const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);
|
|
490
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
491
|
+
disabled,
|
|
492
|
+
native: nativeButton
|
|
493
|
+
});
|
|
494
|
+
const stateAttributesMapping = {
|
|
495
|
+
open (value) {
|
|
496
|
+
if (value && openReason === triggerPress) return pressableTriggerOpenStateMapping.open(value);
|
|
497
|
+
return triggerOpenStateMapping.open(value);
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
const { preFocusGuardRef, handlePreFocusGuardFocus, handleFocusTargetFocus } = useTriggerFocusGuards(store, triggerElementRef);
|
|
501
|
+
const state = {
|
|
502
|
+
disabled,
|
|
503
|
+
open: isOpenedByThisTrigger
|
|
504
|
+
};
|
|
505
|
+
const element = useRenderElement('button', componentProps, {
|
|
506
|
+
state,
|
|
507
|
+
ref: [
|
|
508
|
+
buttonRef,
|
|
509
|
+
forwardedRef,
|
|
510
|
+
registerTrigger,
|
|
511
|
+
triggerElementRef
|
|
512
|
+
],
|
|
513
|
+
props: [
|
|
514
|
+
click.reference,
|
|
515
|
+
hoverProps,
|
|
516
|
+
rootTriggerProps,
|
|
517
|
+
interactionTypeProps,
|
|
518
|
+
{
|
|
519
|
+
[CLICK_TRIGGER_IDENTIFIER]: '',
|
|
520
|
+
id: thisTriggerId,
|
|
521
|
+
'aria-haspopup': 'dialog',
|
|
522
|
+
'aria-expanded': isOpenedByThisTrigger,
|
|
523
|
+
'aria-controls': popupId
|
|
524
|
+
},
|
|
525
|
+
elementProps,
|
|
526
|
+
getButtonProps
|
|
527
|
+
],
|
|
528
|
+
stateAttributesMapping
|
|
529
|
+
});
|
|
530
|
+
if (isMountedByThisTrigger && !focusManagerModal) return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
531
|
+
children: [
|
|
532
|
+
/*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
533
|
+
ref: preFocusGuardRef,
|
|
534
|
+
onFocus: handlePreFocusGuardFocus
|
|
535
|
+
}),
|
|
536
|
+
/*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
537
|
+
children: element
|
|
538
|
+
}, thisTriggerId),
|
|
539
|
+
/*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
|
|
540
|
+
ref: store.context.triggerFocusTargetRef,
|
|
541
|
+
onFocus: handleFocusTargetFocus
|
|
542
|
+
})
|
|
543
|
+
]
|
|
544
|
+
});
|
|
545
|
+
return /*#__PURE__*/ jsx(__rspack_external_react.Fragment, {
|
|
546
|
+
children: element
|
|
547
|
+
}, thisTriggerId);
|
|
548
|
+
});
|
|
549
|
+
if ("production" !== process.env.NODE_ENV) PopoverTrigger_PopoverTrigger.displayName = "PopoverTrigger";
|
|
550
|
+
function createInitialState() {
|
|
551
|
+
return {
|
|
552
|
+
...createInitialPopupStoreState(),
|
|
553
|
+
disabled: false,
|
|
554
|
+
modal: false,
|
|
555
|
+
focusManagerModal: false,
|
|
556
|
+
instantType: void 0,
|
|
557
|
+
openMethod: null,
|
|
558
|
+
openChangeReason: null,
|
|
559
|
+
titleElementId: void 0,
|
|
560
|
+
descriptionElementId: void 0,
|
|
561
|
+
stickIfOpen: true,
|
|
562
|
+
nested: false,
|
|
563
|
+
openOnHover: false,
|
|
564
|
+
closeDelay: 0,
|
|
565
|
+
hasViewport: false
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
const selectors = {
|
|
569
|
+
...popupStoreSelectors,
|
|
570
|
+
disabled: createSelector((state)=>state.disabled),
|
|
571
|
+
instantType: createSelector((state)=>state.instantType),
|
|
572
|
+
openMethod: createSelector((state)=>state.openMethod),
|
|
573
|
+
openChangeReason: createSelector((state)=>state.openChangeReason),
|
|
574
|
+
modal: createSelector((state)=>state.modal),
|
|
575
|
+
focusManagerModal: createSelector((state)=>state.focusManagerModal),
|
|
576
|
+
stickIfOpen: createSelector((state)=>state.stickIfOpen),
|
|
577
|
+
titleElementId: createSelector((state)=>state.titleElementId),
|
|
578
|
+
descriptionElementId: createSelector((state)=>state.descriptionElementId),
|
|
579
|
+
openOnHover: createSelector((state)=>state.openOnHover),
|
|
580
|
+
closeDelay: createSelector((state)=>state.closeDelay),
|
|
581
|
+
hasViewport: createSelector((state)=>state.hasViewport)
|
|
582
|
+
};
|
|
583
|
+
class PopoverStore extends ReactStore {
|
|
584
|
+
constructor(initialState, floatingId, nested = false){
|
|
585
|
+
const initial = {
|
|
586
|
+
...createInitialState(),
|
|
587
|
+
...initialState
|
|
588
|
+
};
|
|
589
|
+
const triggerElements = new PopupTriggerMap();
|
|
590
|
+
if (initial.open && initialState?.mounted === void 0) initial.mounted = true;
|
|
591
|
+
initial.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
|
|
592
|
+
super(initial, {
|
|
593
|
+
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
594
|
+
backdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
595
|
+
internalBackdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
596
|
+
onOpenChange: void 0,
|
|
597
|
+
onOpenChangeComplete: void 0,
|
|
598
|
+
triggerFocusTargetRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
599
|
+
beforeContentFocusGuardRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
600
|
+
stickIfOpenTimeout: new Timeout(),
|
|
601
|
+
triggerElements
|
|
602
|
+
}, selectors);
|
|
603
|
+
}
|
|
604
|
+
setOpen = (nextOpen, eventDetails)=>{
|
|
605
|
+
const isHover = eventDetails.reason === triggerHover;
|
|
606
|
+
const isKeyboardClick = eventDetails.reason === triggerPress && 0 === eventDetails.event.detail;
|
|
607
|
+
const isDismissClose = !nextOpen && (eventDetails.reason === escapeKey || null == eventDetails.reason);
|
|
608
|
+
eventDetails.preventUnmountOnClose = ()=>{
|
|
609
|
+
this.set('preventUnmountingOnClose', true);
|
|
610
|
+
};
|
|
611
|
+
const activeTriggerId = this.select('activeTriggerId');
|
|
612
|
+
if (!nextOpen && eventDetails.reason === closePress && null == eventDetails.trigger && null != activeTriggerId) eventDetails.trigger = this.context.triggerElements.getById(activeTriggerId) ?? this.select('activeTriggerElement') ?? void 0;
|
|
613
|
+
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
614
|
+
if (eventDetails.isCanceled) return;
|
|
615
|
+
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
616
|
+
const changeState = ()=>{
|
|
617
|
+
const updatedState = {
|
|
618
|
+
open: nextOpen,
|
|
619
|
+
openChangeReason: eventDetails.reason
|
|
620
|
+
};
|
|
621
|
+
setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger);
|
|
622
|
+
this.update(updatedState);
|
|
623
|
+
};
|
|
624
|
+
if (isHover) {
|
|
625
|
+
this.set('stickIfOpen', true);
|
|
626
|
+
this.context.stickIfOpenTimeout.start(500, ()=>{
|
|
627
|
+
this.set('stickIfOpen', false);
|
|
628
|
+
});
|
|
629
|
+
__rspack_external_react_dom_7136dc57.flushSync(changeState);
|
|
630
|
+
} else changeState();
|
|
631
|
+
if (isKeyboardClick || isDismissClose) this.set('instantType', isKeyboardClick ? 'click' : 'dismiss');
|
|
632
|
+
else if (eventDetails.reason === focusOut) this.set('instantType', 'focus');
|
|
633
|
+
else this.set('instantType', void 0);
|
|
634
|
+
};
|
|
635
|
+
static useStore(externalStore, initialState) {
|
|
636
|
+
const { store, internalStore } = usePopupStore(externalStore, (floatingId, nested)=>new PopoverStore(initialState, floatingId, nested));
|
|
637
|
+
__rspack_external_react.useEffect(()=>internalStore?.disposeEffect(), [
|
|
638
|
+
internalStore
|
|
639
|
+
]);
|
|
640
|
+
return store;
|
|
641
|
+
}
|
|
642
|
+
disposeEffect = ()=>this.context.stickIfOpenTimeout.disposeEffect();
|
|
643
|
+
}
|
|
644
|
+
function PopoverRootComponent({ props }) {
|
|
645
|
+
const { children, open: openProp, defaultOpen = false, onOpenChange, onOpenChangeComplete, modal = false, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null } = props;
|
|
646
|
+
const store = PopoverStore.useStore(handle?.store, {
|
|
647
|
+
modal,
|
|
648
|
+
open: defaultOpen,
|
|
649
|
+
openProp,
|
|
650
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
651
|
+
triggerIdProp
|
|
652
|
+
});
|
|
653
|
+
useOnFirstRender(()=>{
|
|
654
|
+
if (void 0 === openProp && false === store.state.open && true === defaultOpen) store.update({
|
|
655
|
+
open: true,
|
|
656
|
+
activeTriggerId: defaultTriggerIdProp
|
|
657
|
+
});
|
|
658
|
+
});
|
|
659
|
+
store.useControlledProp('openProp', openProp);
|
|
660
|
+
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
661
|
+
const open = store.useState('open');
|
|
662
|
+
const mounted = store.useState('mounted');
|
|
663
|
+
const payload = store.useState('payload');
|
|
664
|
+
const nested = null != useFloatingParentNodeId();
|
|
665
|
+
store.useContextCallback('onOpenChange', onOpenChange);
|
|
666
|
+
store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);
|
|
667
|
+
usePopupRootSync(store, open);
|
|
668
|
+
useImplicitActiveTrigger(store);
|
|
669
|
+
const { forceUnmount } = useOpenStateTransitions(open, store, ()=>{
|
|
670
|
+
store.update({
|
|
671
|
+
stickIfOpen: true,
|
|
672
|
+
openChangeReason: null
|
|
673
|
+
});
|
|
674
|
+
});
|
|
675
|
+
store.useSyncedValues({
|
|
676
|
+
modal,
|
|
677
|
+
nested
|
|
678
|
+
});
|
|
679
|
+
__rspack_external_react.useEffect(()=>{
|
|
680
|
+
if (!open) store.context.stickIfOpenTimeout.clear();
|
|
681
|
+
}, [
|
|
682
|
+
store,
|
|
683
|
+
open
|
|
684
|
+
]);
|
|
685
|
+
const handleImperativeClose = __rspack_external_react.useCallback(()=>{
|
|
686
|
+
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
687
|
+
}, [
|
|
688
|
+
store
|
|
689
|
+
]);
|
|
690
|
+
__rspack_external_react.useImperativeHandle(props.actionsRef, ()=>({
|
|
691
|
+
unmount: forceUnmount,
|
|
692
|
+
close: handleImperativeClose
|
|
693
|
+
}), [
|
|
694
|
+
forceUnmount,
|
|
695
|
+
handleImperativeClose
|
|
696
|
+
]);
|
|
697
|
+
const shouldRenderInteractions = open || mounted;
|
|
698
|
+
const popoverContext = __rspack_external_react.useMemo(()=>({
|
|
699
|
+
store
|
|
700
|
+
}), [
|
|
701
|
+
store
|
|
702
|
+
]);
|
|
703
|
+
return /*#__PURE__*/ jsxs(PopoverRootContext.Provider, {
|
|
704
|
+
value: popoverContext,
|
|
705
|
+
children: [
|
|
706
|
+
shouldRenderInteractions && /*#__PURE__*/ jsx(PopoverInteractions, {
|
|
707
|
+
store: store,
|
|
708
|
+
modal: modal
|
|
709
|
+
}),
|
|
710
|
+
'function' == typeof children ? children({
|
|
711
|
+
payload
|
|
712
|
+
}) : children
|
|
713
|
+
]
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
function PopoverRoot(props) {
|
|
717
|
+
if (usePopoverRootContext(true)) return /*#__PURE__*/ jsx(PopoverRootComponent, {
|
|
718
|
+
props: props
|
|
719
|
+
});
|
|
720
|
+
return /*#__PURE__*/ jsx(FloatingTree, {
|
|
721
|
+
children: /*#__PURE__*/ jsx(PopoverRootComponent, {
|
|
722
|
+
props: props
|
|
723
|
+
})
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
function PopoverInteractions({ store, modal }) {
|
|
727
|
+
const floatingRootContext = store.useState('floatingRootContext');
|
|
728
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
729
|
+
outsidePressEvent: {
|
|
730
|
+
mouse: 'trap-focus' === modal ? 'sloppy' : 'intentional',
|
|
731
|
+
touch: 'sloppy'
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
const activeTriggerProps = dismiss.reference ?? EMPTY_OBJECT;
|
|
735
|
+
const inactiveTriggerProps = dismiss.trigger ?? EMPTY_OBJECT;
|
|
736
|
+
const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [
|
|
737
|
+
dismiss.floating
|
|
738
|
+
]);
|
|
739
|
+
usePopupInteractionProps(store, {
|
|
740
|
+
activeTriggerProps,
|
|
741
|
+
inactiveTriggerProps,
|
|
742
|
+
popupProps
|
|
743
|
+
});
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
const PopoverPortal_PopoverPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
747
|
+
const { keepMounted = false, ...portalProps } = props;
|
|
748
|
+
const { store } = usePopoverRootContext();
|
|
749
|
+
const mounted = store.useState('mounted');
|
|
750
|
+
const shouldRender = mounted || keepMounted;
|
|
751
|
+
if (!shouldRender) return null;
|
|
752
|
+
return /*#__PURE__*/ jsx(PopoverPortalContext.Provider, {
|
|
753
|
+
value: keepMounted,
|
|
754
|
+
children: /*#__PURE__*/ jsx(FloatingPortal_FloatingPortal, {
|
|
755
|
+
ref: forwardedRef,
|
|
756
|
+
...portalProps
|
|
757
|
+
})
|
|
758
|
+
});
|
|
759
|
+
});
|
|
760
|
+
if ("production" !== process.env.NODE_ENV) PopoverPortal_PopoverPortal.displayName = "PopoverPortal";
|
|
761
|
+
class PopoverHandle {
|
|
762
|
+
constructor(){
|
|
763
|
+
this.store = new PopoverStore();
|
|
764
|
+
}
|
|
765
|
+
open(triggerId) {
|
|
766
|
+
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) ?? void 0 : void 0;
|
|
767
|
+
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));
|
|
768
|
+
this.store.setOpen(true, createChangeEventDetails(imperativeAction, void 0, triggerElement));
|
|
769
|
+
}
|
|
770
|
+
close() {
|
|
771
|
+
this.store.setOpen(false, createChangeEventDetails(imperativeAction, void 0, void 0));
|
|
772
|
+
}
|
|
773
|
+
get isOpen() {
|
|
774
|
+
return this.store.select('open');
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
function createPopoverHandle() {
|
|
778
|
+
return new PopoverHandle();
|
|
779
|
+
}
|
|
5
780
|
const Popover_module = {
|
|
6
781
|
popup: "popup-Wrjs4v",
|
|
7
782
|
arrow: "arrow-FmdRXW",
|
|
@@ -9,53 +784,53 @@ const Popover_module = {
|
|
|
9
784
|
title: "title-kQ490g",
|
|
10
785
|
description: "description-IgC4Ak"
|
|
11
786
|
};
|
|
12
|
-
const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
787
|
+
const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverPositioner_PopoverPositioner, {
|
|
13
788
|
ref: ref,
|
|
14
789
|
className: clsx(Popover_module.positioner, className),
|
|
15
790
|
...props
|
|
16
791
|
}));
|
|
17
|
-
const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
792
|
+
const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverPopup_PopoverPopup, {
|
|
18
793
|
ref: ref,
|
|
19
794
|
className: clsx(Popover_module.popup, className),
|
|
20
795
|
...props
|
|
21
796
|
}));
|
|
22
|
-
const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
797
|
+
const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverArrow_PopoverArrow, {
|
|
23
798
|
ref: ref,
|
|
24
799
|
className: clsx(Popover_module.arrow, className),
|
|
25
800
|
...props
|
|
26
801
|
}));
|
|
27
|
-
const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
802
|
+
const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverBackdrop_PopoverBackdrop, {
|
|
28
803
|
ref: ref,
|
|
29
804
|
className: clsx(Popover_module.backdrop, className),
|
|
30
805
|
...props
|
|
31
806
|
}));
|
|
32
|
-
const Title = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
807
|
+
const Title = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverTitle_PopoverTitle, {
|
|
33
808
|
ref: ref,
|
|
34
809
|
className: clsx(Popover_module.title, className),
|
|
35
810
|
...props
|
|
36
811
|
}));
|
|
37
|
-
const Description = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
812
|
+
const Description = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverDescription_PopoverDescription, {
|
|
38
813
|
ref: ref,
|
|
39
814
|
className: clsx(Popover_module.description, className),
|
|
40
815
|
...props
|
|
41
816
|
}));
|
|
42
|
-
const Close = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
817
|
+
const Close = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverClose_PopoverClose, {
|
|
43
818
|
ref: ref,
|
|
44
819
|
className: clsx(Popover_module.close, className),
|
|
45
820
|
...props
|
|
46
821
|
}));
|
|
47
|
-
const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(
|
|
822
|
+
const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(PopoverViewport_PopoverViewport, {
|
|
48
823
|
ref: ref,
|
|
49
824
|
className: clsx(Popover_module.viewport, className),
|
|
50
825
|
...props
|
|
51
826
|
}));
|
|
52
827
|
function Trigger({ className, ...props }) {
|
|
53
|
-
return /*#__PURE__*/ jsx(
|
|
828
|
+
return /*#__PURE__*/ jsx(PopoverTrigger_PopoverTrigger, {
|
|
54
829
|
...props,
|
|
55
830
|
className: clsx(Popover_module.trigger, className)
|
|
56
831
|
});
|
|
57
832
|
}
|
|
58
|
-
const
|
|
833
|
+
const Popover = {
|
|
59
834
|
Positioner: Positioner,
|
|
60
835
|
Popup: Popup,
|
|
61
836
|
Arrow: Arrow,
|
|
@@ -64,10 +839,10 @@ const Popover_Popover = {
|
|
|
64
839
|
Description: Description,
|
|
65
840
|
Close: Close,
|
|
66
841
|
Viewport: Viewport,
|
|
67
|
-
Root:
|
|
842
|
+
Root: PopoverRoot,
|
|
68
843
|
Trigger: Trigger,
|
|
69
|
-
Portal:
|
|
70
|
-
Handle:
|
|
71
|
-
createHandle:
|
|
844
|
+
Portal: PopoverPortal_PopoverPortal,
|
|
845
|
+
Handle: PopoverHandle,
|
|
846
|
+
createHandle: createPopoverHandle
|
|
72
847
|
};
|
|
73
|
-
export {
|
|
848
|
+
export { Popover };
|