@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/6107.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { esm_formatErrorMessage } from "./8272.js";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
const ToolbarRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
4
|
+
if ("production" !== process.env.NODE_ENV) ToolbarRootContext.displayName = "ToolbarRootContext";
|
|
5
|
+
function useToolbarRootContext(optional) {
|
|
6
|
+
const context = __rspack_external_react.useContext(ToolbarRootContext);
|
|
7
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : esm_formatErrorMessage(69));
|
|
8
|
+
return context;
|
|
9
|
+
}
|
|
10
|
+
export { ToolbarRootContext, useToolbarRootContext };
|
package/dist/6247.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useIsoLayoutEffect } from "./6499.js";
|
|
2
|
+
import { ownerDocument } from "./9829.js";
|
|
3
|
+
import { useScrollLock } from "./3485.js";
|
|
4
|
+
import * as __rspack_external_react from "react";
|
|
5
|
+
const VIEWPORT_WIDTH_TOLERANCE_PX = 20;
|
|
6
|
+
function useAnchoredPopupScrollLock(enabled, touchOpen, positionerElement, referenceElement) {
|
|
7
|
+
const [touchOpenShouldLockScroll, setTouchOpenShouldLockScroll] = __rspack_external_react.useState(false);
|
|
8
|
+
useIsoLayoutEffect(()=>{
|
|
9
|
+
if (!enabled || !touchOpen || null == positionerElement) return void setTouchOpenShouldLockScroll(false);
|
|
10
|
+
const viewportWidth = ownerDocument(positionerElement).documentElement.clientWidth;
|
|
11
|
+
const popupWidth = positionerElement.offsetWidth;
|
|
12
|
+
setTouchOpenShouldLockScroll(viewportWidth > 0 && popupWidth > 0 && popupWidth >= viewportWidth - VIEWPORT_WIDTH_TOLERANCE_PX);
|
|
13
|
+
}, [
|
|
14
|
+
enabled,
|
|
15
|
+
touchOpen,
|
|
16
|
+
positionerElement
|
|
17
|
+
]);
|
|
18
|
+
useScrollLock(enabled && (!touchOpen || touchOpenShouldLockScroll), referenceElement);
|
|
19
|
+
}
|
|
20
|
+
export { useAnchoredPopupScrollLock };
|
package/dist/6270.js
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { EMPTY_OBJECT, mergeProps, useRenderElement, esm_formatErrorMessage } from "./8272.js";
|
|
3
|
+
import { useButton } from "./9189.js";
|
|
4
|
+
import { createChangeEventDetails } from "./4768.js";
|
|
5
|
+
import { closePress, imperativeAction } from "./2418.js";
|
|
6
|
+
import { useBaseUiId } from "./6046.js";
|
|
7
|
+
import { CLICK_TRIGGER_IDENTIFIER, triggerOpenStateMapping, FloatingPortal_FloatingPortal, popupStateMapping, popupStateMapping_CommonPopupDataAttributes } from "./4388.js";
|
|
8
|
+
import { transitionStatusMapping } from "./880.js";
|
|
9
|
+
import { useTriggerDataForwarding, usePopupInteractionProps, usePopupRootSync, setOpenTriggerState, usePopupStore, useImplicitActiveTrigger, useOnFirstRender, useOpenStateTransitions, FOCUSABLE_POPUP_PROPS } from "./8106.js";
|
|
10
|
+
import { useClick } from "./5864.js";
|
|
11
|
+
import { InternalBackdrop_InternalBackdrop, useOpenMethodTriggerProps, useScrollLock } from "./3485.js";
|
|
12
|
+
import { useDismiss, PopupTriggerMap, createSelector, ReactStore } from "./5992.js";
|
|
13
|
+
import { getTarget, contains } from "./4549.js";
|
|
14
|
+
import { createPopupFloatingRootContext, popupStoreSelectors, createInitialPopupStoreState } from "./6535.js";
|
|
15
|
+
import { inertValue } from "./167.js";
|
|
16
|
+
import * as __rspack_external_react from "react";
|
|
17
|
+
const IsDrawerContext = /*#__PURE__*/ __rspack_external_react.createContext(false);
|
|
18
|
+
if ("production" !== process.env.NODE_ENV) IsDrawerContext.displayName = "IsDrawerContext";
|
|
19
|
+
const DialogRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
20
|
+
if ("production" !== process.env.NODE_ENV) DialogRootContext.displayName = "DialogRootContext";
|
|
21
|
+
function useDialogRootContext(optional) {
|
|
22
|
+
const dialogRootContext = __rspack_external_react.useContext(DialogRootContext);
|
|
23
|
+
if (false === optional && void 0 === dialogRootContext) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.' : esm_formatErrorMessage(27));
|
|
24
|
+
return dialogRootContext;
|
|
25
|
+
}
|
|
26
|
+
const DialogClose_DialogClose = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
27
|
+
const { render, className, style, disabled = false, nativeButton = true, ...elementProps } = componentProps;
|
|
28
|
+
const { store } = useDialogRootContext();
|
|
29
|
+
const open = store.useState('open');
|
|
30
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
31
|
+
disabled,
|
|
32
|
+
native: nativeButton
|
|
33
|
+
});
|
|
34
|
+
const state = {
|
|
35
|
+
disabled
|
|
36
|
+
};
|
|
37
|
+
function handleClick(event) {
|
|
38
|
+
if (open) store.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent));
|
|
39
|
+
}
|
|
40
|
+
return useRenderElement('button', componentProps, {
|
|
41
|
+
state,
|
|
42
|
+
ref: [
|
|
43
|
+
forwardedRef,
|
|
44
|
+
buttonRef
|
|
45
|
+
],
|
|
46
|
+
props: [
|
|
47
|
+
{
|
|
48
|
+
onClick: handleClick
|
|
49
|
+
},
|
|
50
|
+
elementProps,
|
|
51
|
+
getButtonProps
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
if ("production" !== process.env.NODE_ENV) DialogClose_DialogClose.displayName = "DialogClose";
|
|
56
|
+
const DialogDescription_DialogDescription = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
57
|
+
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
58
|
+
const { store } = useDialogRootContext();
|
|
59
|
+
const id = useBaseUiId(idProp);
|
|
60
|
+
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
61
|
+
return useRenderElement('p', componentProps, {
|
|
62
|
+
ref: forwardedRef,
|
|
63
|
+
props: [
|
|
64
|
+
{
|
|
65
|
+
id
|
|
66
|
+
},
|
|
67
|
+
elementProps
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
if ("production" !== process.env.NODE_ENV) DialogDescription_DialogDescription.displayName = "DialogDescription";
|
|
72
|
+
const DialogPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
73
|
+
if ("production" !== process.env.NODE_ENV) DialogPortalContext.displayName = "DialogPortalContext";
|
|
74
|
+
function useDialogPortalContext() {
|
|
75
|
+
const value = __rspack_external_react.useContext(DialogPortalContext);
|
|
76
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Dialog.Portal> is missing.' : esm_formatErrorMessage(26));
|
|
77
|
+
return value;
|
|
78
|
+
}
|
|
79
|
+
const DialogTitle_DialogTitle = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
80
|
+
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
81
|
+
const { store } = useDialogRootContext();
|
|
82
|
+
const id = useBaseUiId(idProp);
|
|
83
|
+
store.useSyncedValueWithCleanup('titleElementId', id);
|
|
84
|
+
return useRenderElement('h2', componentProps, {
|
|
85
|
+
ref: forwardedRef,
|
|
86
|
+
props: [
|
|
87
|
+
{
|
|
88
|
+
id
|
|
89
|
+
},
|
|
90
|
+
elementProps
|
|
91
|
+
]
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
if ("production" !== process.env.NODE_ENV) DialogTitle_DialogTitle.displayName = "DialogTitle";
|
|
95
|
+
let DialogViewportDataAttributes_DialogViewportDataAttributes = function(DialogViewportDataAttributes) {
|
|
96
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["open"] = popupStateMapping_CommonPopupDataAttributes.open] = "open";
|
|
97
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["closed"] = popupStateMapping_CommonPopupDataAttributes.closed] = "closed";
|
|
98
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["startingStyle"] = popupStateMapping_CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
99
|
+
DialogViewportDataAttributes[DialogViewportDataAttributes["endingStyle"] = popupStateMapping_CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
100
|
+
DialogViewportDataAttributes["nested"] = "data-nested";
|
|
101
|
+
DialogViewportDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
|
|
102
|
+
return DialogViewportDataAttributes;
|
|
103
|
+
}({});
|
|
104
|
+
const stateAttributesMapping = {
|
|
105
|
+
...popupStateMapping,
|
|
106
|
+
...transitionStatusMapping,
|
|
107
|
+
nested (value) {
|
|
108
|
+
return value ? {
|
|
109
|
+
[DialogViewportDataAttributes_DialogViewportDataAttributes.nested]: ''
|
|
110
|
+
} : null;
|
|
111
|
+
},
|
|
112
|
+
nestedDialogOpen (value) {
|
|
113
|
+
return value ? {
|
|
114
|
+
[DialogViewportDataAttributes_DialogViewportDataAttributes.nestedDialogOpen]: ''
|
|
115
|
+
} : null;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const DialogViewport_DialogViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
119
|
+
const { render, className, style, children, ...elementProps } = componentProps;
|
|
120
|
+
const keepMounted = useDialogPortalContext();
|
|
121
|
+
const { store } = useDialogRootContext();
|
|
122
|
+
const open = store.useState('open');
|
|
123
|
+
const nested = store.useState('nested');
|
|
124
|
+
const transitionStatus = store.useState('transitionStatus');
|
|
125
|
+
const nestedOpenDialogCount = store.useState('nestedOpenDialogCount');
|
|
126
|
+
const mounted = store.useState('mounted');
|
|
127
|
+
const setViewportElement = store.useStateSetter('viewportElement');
|
|
128
|
+
const nestedDialogOpen = nestedOpenDialogCount > 0;
|
|
129
|
+
const state = {
|
|
130
|
+
open,
|
|
131
|
+
nested,
|
|
132
|
+
transitionStatus,
|
|
133
|
+
nestedDialogOpen
|
|
134
|
+
};
|
|
135
|
+
const shouldRender = keepMounted || mounted;
|
|
136
|
+
return useRenderElement('div', componentProps, {
|
|
137
|
+
enabled: shouldRender,
|
|
138
|
+
state,
|
|
139
|
+
ref: [
|
|
140
|
+
forwardedRef,
|
|
141
|
+
setViewportElement
|
|
142
|
+
],
|
|
143
|
+
stateAttributesMapping: stateAttributesMapping,
|
|
144
|
+
props: [
|
|
145
|
+
{
|
|
146
|
+
role: 'presentation',
|
|
147
|
+
hidden: !mounted,
|
|
148
|
+
style: {
|
|
149
|
+
pointerEvents: open ? void 0 : 'none'
|
|
150
|
+
},
|
|
151
|
+
children
|
|
152
|
+
},
|
|
153
|
+
elementProps
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
if ("production" !== process.env.NODE_ENV) DialogViewport_DialogViewport.displayName = "DialogViewport";
|
|
158
|
+
const DialogTrigger_DialogTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
159
|
+
const { render, className, style, disabled = false, nativeButton = true, id: idProp, payload, handle, ...elementProps } = componentProps;
|
|
160
|
+
const dialogRootContext = useDialogRootContext(true);
|
|
161
|
+
const store = handle?.store ?? dialogRootContext?.store;
|
|
162
|
+
if (!store) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.' : esm_formatErrorMessage(79));
|
|
163
|
+
const thisTriggerId = useBaseUiId(idProp);
|
|
164
|
+
const floatingContext = store.useState('floatingRootContext');
|
|
165
|
+
const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
|
|
166
|
+
const popupId = store.useState('triggerPopupId', thisTriggerId);
|
|
167
|
+
const triggerElementRef = __rspack_external_react.useRef(null);
|
|
168
|
+
const { registerTrigger, isMountedByThisTrigger } = useTriggerDataForwarding(thisTriggerId, triggerElementRef, store, {
|
|
169
|
+
payload
|
|
170
|
+
});
|
|
171
|
+
const { getButtonProps, buttonRef } = useButton({
|
|
172
|
+
disabled,
|
|
173
|
+
native: nativeButton
|
|
174
|
+
});
|
|
175
|
+
const click = useClick(floatingContext, {
|
|
176
|
+
enabled: null != floatingContext
|
|
177
|
+
});
|
|
178
|
+
const interactionTypeProps = useOpenMethodTriggerProps(()=>store.select('open'), (interactionType)=>{
|
|
179
|
+
store.set('openMethod', interactionType);
|
|
180
|
+
});
|
|
181
|
+
const state = {
|
|
182
|
+
disabled,
|
|
183
|
+
open: isOpenedByThisTrigger
|
|
184
|
+
};
|
|
185
|
+
const rootTriggerProps = store.useState('triggerProps', isMountedByThisTrigger);
|
|
186
|
+
return useRenderElement('button', componentProps, {
|
|
187
|
+
state,
|
|
188
|
+
ref: [
|
|
189
|
+
buttonRef,
|
|
190
|
+
forwardedRef,
|
|
191
|
+
registerTrigger,
|
|
192
|
+
triggerElementRef
|
|
193
|
+
],
|
|
194
|
+
props: [
|
|
195
|
+
click.reference,
|
|
196
|
+
rootTriggerProps,
|
|
197
|
+
interactionTypeProps,
|
|
198
|
+
{
|
|
199
|
+
[CLICK_TRIGGER_IDENTIFIER]: '',
|
|
200
|
+
id: thisTriggerId,
|
|
201
|
+
'aria-haspopup': 'dialog',
|
|
202
|
+
'aria-expanded': isOpenedByThisTrigger,
|
|
203
|
+
'aria-controls': popupId
|
|
204
|
+
},
|
|
205
|
+
elementProps,
|
|
206
|
+
getButtonProps
|
|
207
|
+
],
|
|
208
|
+
stateAttributesMapping: triggerOpenStateMapping
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
if ("production" !== process.env.NODE_ENV) DialogTrigger_DialogTrigger.displayName = "DialogTrigger";
|
|
212
|
+
function useDialogRoot(params) {
|
|
213
|
+
const { store, parentContext, actionsRef, isDrawer } = params;
|
|
214
|
+
const open = store.useState('open');
|
|
215
|
+
usePopupRootSync(store, open);
|
|
216
|
+
useImplicitActiveTrigger(store);
|
|
217
|
+
const { forceUnmount } = useOpenStateTransitions(open, store);
|
|
218
|
+
const handleImperativeClose = __rspack_external_react.useCallback(()=>{
|
|
219
|
+
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
220
|
+
}, [
|
|
221
|
+
store
|
|
222
|
+
]);
|
|
223
|
+
__rspack_external_react.useImperativeHandle(actionsRef, ()=>({
|
|
224
|
+
unmount: forceUnmount,
|
|
225
|
+
close: handleImperativeClose
|
|
226
|
+
}), [
|
|
227
|
+
forceUnmount,
|
|
228
|
+
handleImperativeClose
|
|
229
|
+
]);
|
|
230
|
+
return {
|
|
231
|
+
parentContext,
|
|
232
|
+
isDrawer
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
function DialogInteractions({ store, dialogRoot }) {
|
|
236
|
+
const { parentContext, isDrawer } = dialogRoot;
|
|
237
|
+
const open = store.useState('open');
|
|
238
|
+
const disablePointerDismissal = store.useState('disablePointerDismissal');
|
|
239
|
+
const modal = store.useState('modal');
|
|
240
|
+
const popupElement = store.useState('popupElement');
|
|
241
|
+
const floatingRootContext = store.useState('floatingRootContext');
|
|
242
|
+
const [ownNestedOpenDialogs, setOwnNestedOpenDialogs] = __rspack_external_react.useState(0);
|
|
243
|
+
const [ownNestedOpenDrawers, setOwnNestedOpenDrawers] = __rspack_external_react.useState(0);
|
|
244
|
+
const isTopmost = 0 === ownNestedOpenDialogs;
|
|
245
|
+
const dismiss = useDismiss(floatingRootContext, {
|
|
246
|
+
outsidePressEvent () {
|
|
247
|
+
if (store.context.internalBackdropRef.current || store.context.backdropRef.current) return 'intentional';
|
|
248
|
+
return {
|
|
249
|
+
mouse: 'trap-focus' === modal ? 'sloppy' : 'intentional',
|
|
250
|
+
touch: 'sloppy'
|
|
251
|
+
};
|
|
252
|
+
},
|
|
253
|
+
outsidePress (event) {
|
|
254
|
+
if (!store.context.outsidePressEnabledRef.current) return false;
|
|
255
|
+
if ('button' in event && 0 !== event.button) return false;
|
|
256
|
+
if ('touches' in event && 1 !== event.touches.length) return false;
|
|
257
|
+
const target = getTarget(event);
|
|
258
|
+
if (isTopmost && !disablePointerDismissal) {
|
|
259
|
+
const eventTarget = target;
|
|
260
|
+
if (modal) return store.context.internalBackdropRef.current || store.context.backdropRef.current ? store.context.internalBackdropRef.current === eventTarget || store.context.backdropRef.current === eventTarget || contains(eventTarget, popupElement) && !eventTarget?.hasAttribute('data-base-ui-portal') : true;
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
return false;
|
|
264
|
+
},
|
|
265
|
+
escapeKey: isTopmost
|
|
266
|
+
});
|
|
267
|
+
useScrollLock(open && true === modal, popupElement);
|
|
268
|
+
store.useContextCallback('onNestedDialogOpen', (dialogCount, drawerCount)=>{
|
|
269
|
+
setOwnNestedOpenDialogs(dialogCount);
|
|
270
|
+
setOwnNestedOpenDrawers(drawerCount);
|
|
271
|
+
});
|
|
272
|
+
store.useContextCallback('onNestedDialogClose', ()=>{
|
|
273
|
+
setOwnNestedOpenDialogs(0);
|
|
274
|
+
setOwnNestedOpenDrawers(0);
|
|
275
|
+
});
|
|
276
|
+
__rspack_external_react.useEffect(()=>{
|
|
277
|
+
if (parentContext?.onNestedDialogOpen && open) parentContext.onNestedDialogOpen(ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0));
|
|
278
|
+
if (parentContext?.onNestedDialogClose && !open) parentContext.onNestedDialogClose();
|
|
279
|
+
return ()=>{
|
|
280
|
+
if (parentContext?.onNestedDialogClose && open) parentContext.onNestedDialogClose();
|
|
281
|
+
};
|
|
282
|
+
}, [
|
|
283
|
+
isDrawer,
|
|
284
|
+
open,
|
|
285
|
+
ownNestedOpenDialogs,
|
|
286
|
+
ownNestedOpenDrawers,
|
|
287
|
+
parentContext
|
|
288
|
+
]);
|
|
289
|
+
const activeTriggerProps = dismiss.reference ?? EMPTY_OBJECT;
|
|
290
|
+
const inactiveTriggerProps = dismiss.trigger ?? EMPTY_OBJECT;
|
|
291
|
+
const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [
|
|
292
|
+
dismiss.floating
|
|
293
|
+
]);
|
|
294
|
+
usePopupInteractionProps(store, {
|
|
295
|
+
activeTriggerProps,
|
|
296
|
+
inactiveTriggerProps,
|
|
297
|
+
popupProps,
|
|
298
|
+
nestedOpenDialogCount: ownNestedOpenDialogs,
|
|
299
|
+
nestedOpenDrawerCount: ownNestedOpenDrawers
|
|
300
|
+
});
|
|
301
|
+
return null;
|
|
302
|
+
}
|
|
303
|
+
const selectors = {
|
|
304
|
+
...popupStoreSelectors,
|
|
305
|
+
modal: createSelector((state)=>state.modal),
|
|
306
|
+
nested: createSelector((state)=>state.nested),
|
|
307
|
+
nestedOpenDialogCount: createSelector((state)=>state.nestedOpenDialogCount),
|
|
308
|
+
nestedOpenDrawerCount: createSelector((state)=>state.nestedOpenDrawerCount),
|
|
309
|
+
disablePointerDismissal: createSelector((state)=>state.disablePointerDismissal),
|
|
310
|
+
openMethod: createSelector((state)=>state.openMethod),
|
|
311
|
+
descriptionElementId: createSelector((state)=>state.descriptionElementId),
|
|
312
|
+
titleElementId: createSelector((state)=>state.titleElementId),
|
|
313
|
+
viewportElement: createSelector((state)=>state.viewportElement),
|
|
314
|
+
role: createSelector((state)=>state.role)
|
|
315
|
+
};
|
|
316
|
+
class DialogStore extends ReactStore {
|
|
317
|
+
constructor(initialState, floatingId, nested = false){
|
|
318
|
+
const triggerElements = new PopupTriggerMap();
|
|
319
|
+
const state = createInitialState(initialState);
|
|
320
|
+
state.floatingRootContext = createPopupFloatingRootContext(triggerElements, floatingId, nested);
|
|
321
|
+
super(state, {
|
|
322
|
+
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
323
|
+
backdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
324
|
+
internalBackdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
325
|
+
outsidePressEnabledRef: {
|
|
326
|
+
current: true
|
|
327
|
+
},
|
|
328
|
+
triggerElements,
|
|
329
|
+
onOpenChange: void 0,
|
|
330
|
+
onOpenChangeComplete: void 0
|
|
331
|
+
}, selectors);
|
|
332
|
+
}
|
|
333
|
+
setOpen = (nextOpen, eventDetails)=>{
|
|
334
|
+
eventDetails.preventUnmountOnClose = ()=>{
|
|
335
|
+
this.set('preventUnmountingOnClose', true);
|
|
336
|
+
};
|
|
337
|
+
if (!nextOpen && null == eventDetails.trigger && null != this.state.activeTriggerId) eventDetails.trigger = this.state.activeTriggerElement ?? void 0;
|
|
338
|
+
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
339
|
+
if (eventDetails.isCanceled) return;
|
|
340
|
+
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
341
|
+
const updatedState = {
|
|
342
|
+
open: nextOpen
|
|
343
|
+
};
|
|
344
|
+
setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger);
|
|
345
|
+
this.update(updatedState);
|
|
346
|
+
};
|
|
347
|
+
static useStore(externalStore, initialState) {
|
|
348
|
+
const store = usePopupStore(externalStore, (floatingId, nested)=>new DialogStore(initialState, floatingId, nested), true).store;
|
|
349
|
+
return store;
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
function createInitialState(initialState = {}) {
|
|
353
|
+
return {
|
|
354
|
+
...createInitialPopupStoreState(),
|
|
355
|
+
modal: true,
|
|
356
|
+
disablePointerDismissal: false,
|
|
357
|
+
popupElement: null,
|
|
358
|
+
viewportElement: null,
|
|
359
|
+
descriptionElementId: void 0,
|
|
360
|
+
titleElementId: void 0,
|
|
361
|
+
openMethod: null,
|
|
362
|
+
nested: false,
|
|
363
|
+
nestedOpenDialogCount: 0,
|
|
364
|
+
nestedOpenDrawerCount: 0,
|
|
365
|
+
role: 'dialog',
|
|
366
|
+
...initialState
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function useRenderDialogRoot(props, mode = 'dialog') {
|
|
370
|
+
const { children, open: openProp, defaultOpen = false, onOpenChange, onOpenChangeComplete, disablePointerDismissal: disablePointerDismissalProp = false, modal: modalProp = true, actionsRef, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null } = props;
|
|
371
|
+
const isDrawer = 'drawer' === mode;
|
|
372
|
+
const isAlertDialog = 'alert-dialog' === mode;
|
|
373
|
+
const modal = isAlertDialog ? true : modalProp;
|
|
374
|
+
const disablePointerDismissal = isAlertDialog || disablePointerDismissalProp;
|
|
375
|
+
const role = isAlertDialog ? 'alertdialog' : 'dialog';
|
|
376
|
+
const parentDialogRootContext = useDialogRootContext(true);
|
|
377
|
+
const nested = Boolean(parentDialogRootContext);
|
|
378
|
+
const rootState = {
|
|
379
|
+
modal,
|
|
380
|
+
disablePointerDismissal,
|
|
381
|
+
nested,
|
|
382
|
+
role
|
|
383
|
+
};
|
|
384
|
+
const store = DialogStore.useStore(handle?.store, {
|
|
385
|
+
open: defaultOpen,
|
|
386
|
+
openProp,
|
|
387
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
388
|
+
triggerIdProp,
|
|
389
|
+
...rootState
|
|
390
|
+
});
|
|
391
|
+
useOnFirstRender(()=>{
|
|
392
|
+
const nextState = void 0 === openProp && false === store.state.open && true === defaultOpen ? {
|
|
393
|
+
open: true,
|
|
394
|
+
activeTriggerId: defaultTriggerIdProp
|
|
395
|
+
} : null;
|
|
396
|
+
if (isAlertDialog) store.update(nextState ? {
|
|
397
|
+
...rootState,
|
|
398
|
+
...nextState
|
|
399
|
+
} : rootState);
|
|
400
|
+
else if (nextState) store.update(nextState);
|
|
401
|
+
});
|
|
402
|
+
store.useControlledProp('openProp', openProp);
|
|
403
|
+
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
404
|
+
store.useSyncedValues(rootState);
|
|
405
|
+
store.useContextCallback('onOpenChange', onOpenChange);
|
|
406
|
+
store.useContextCallback('onOpenChangeComplete', onOpenChangeComplete);
|
|
407
|
+
const open = store.useState('open');
|
|
408
|
+
const mounted = store.useState('mounted');
|
|
409
|
+
const payload = store.useState('payload');
|
|
410
|
+
const dialogRoot = useDialogRoot({
|
|
411
|
+
store,
|
|
412
|
+
actionsRef,
|
|
413
|
+
parentContext: parentDialogRootContext?.store.context,
|
|
414
|
+
isDrawer
|
|
415
|
+
});
|
|
416
|
+
const shouldRenderInteractions = open || mounted;
|
|
417
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
418
|
+
store
|
|
419
|
+
}), [
|
|
420
|
+
store
|
|
421
|
+
]);
|
|
422
|
+
return /*#__PURE__*/ jsx(IsDrawerContext.Provider, {
|
|
423
|
+
value: false,
|
|
424
|
+
children: /*#__PURE__*/ jsxs(DialogRootContext.Provider, {
|
|
425
|
+
value: contextValue,
|
|
426
|
+
children: [
|
|
427
|
+
shouldRenderInteractions && /*#__PURE__*/ jsx(DialogInteractions, {
|
|
428
|
+
store: store,
|
|
429
|
+
dialogRoot: dialogRoot
|
|
430
|
+
}),
|
|
431
|
+
'function' == typeof children ? children({
|
|
432
|
+
payload
|
|
433
|
+
}) : children
|
|
434
|
+
]
|
|
435
|
+
})
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
const DialogPortal_DialogPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
439
|
+
const { keepMounted = false, ...portalProps } = props;
|
|
440
|
+
const { store } = useDialogRootContext();
|
|
441
|
+
const mounted = store.useState('mounted');
|
|
442
|
+
const modal = store.useState('modal');
|
|
443
|
+
const open = store.useState('open');
|
|
444
|
+
const shouldRender = mounted || keepMounted;
|
|
445
|
+
if (!shouldRender) return null;
|
|
446
|
+
return /*#__PURE__*/ jsx(DialogPortalContext.Provider, {
|
|
447
|
+
value: keepMounted,
|
|
448
|
+
children: /*#__PURE__*/ jsxs(FloatingPortal_FloatingPortal, {
|
|
449
|
+
ref: forwardedRef,
|
|
450
|
+
...portalProps,
|
|
451
|
+
children: [
|
|
452
|
+
mounted && true === modal && /*#__PURE__*/ jsx(InternalBackdrop_InternalBackdrop, {
|
|
453
|
+
ref: store.context.internalBackdropRef,
|
|
454
|
+
inert: inertValue(!open)
|
|
455
|
+
}),
|
|
456
|
+
props.children
|
|
457
|
+
]
|
|
458
|
+
})
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
if ("production" !== process.env.NODE_ENV) DialogPortal_DialogPortal.displayName = "DialogPortal";
|
|
462
|
+
class DialogHandle {
|
|
463
|
+
constructor(store){
|
|
464
|
+
this.store = store ?? new DialogStore();
|
|
465
|
+
}
|
|
466
|
+
open(triggerId) {
|
|
467
|
+
const triggerElement = triggerId ? this.store.context.triggerElements.getById(triggerId) : void 0;
|
|
468
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
469
|
+
if (triggerId && !triggerElement) console.warn(`Base UI: DialogHandle.open: No trigger found with id "${triggerId}". The dialog will open, but the trigger will not be associated with the dialog.`);
|
|
470
|
+
}
|
|
471
|
+
this.store.setOpen(true, createChangeEventDetails(imperativeAction, void 0, triggerElement));
|
|
472
|
+
}
|
|
473
|
+
openWithPayload(payload) {
|
|
474
|
+
this.store.set('payload', payload);
|
|
475
|
+
this.store.setOpen(true, createChangeEventDetails(imperativeAction, void 0, void 0));
|
|
476
|
+
}
|
|
477
|
+
close() {
|
|
478
|
+
this.store.setOpen(false, createChangeEventDetails(imperativeAction, void 0, void 0));
|
|
479
|
+
}
|
|
480
|
+
get isOpen() {
|
|
481
|
+
return this.store.select('open');
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function createDialogHandle() {
|
|
485
|
+
return new DialogHandle();
|
|
486
|
+
}
|
|
487
|
+
export { DialogClose_DialogClose, DialogDescription_DialogDescription, DialogHandle, DialogPortal_DialogPortal, DialogStore, DialogTitle_DialogTitle, DialogTrigger_DialogTrigger, DialogViewport_DialogViewport, IsDrawerContext, createDialogHandle, useDialogPortalContext, useDialogRootContext, useRenderDialogRoot };
|
package/dist/6329.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { clamp } from "./3296.js";
|
|
3
|
+
const DISABLE_SCROLLBAR_CLASS_NAME = 'base-ui-disable-scrollbar';
|
|
4
|
+
const styleDisableScrollbar = {
|
|
5
|
+
className: DISABLE_SCROLLBAR_CLASS_NAME,
|
|
6
|
+
getElement (nonce) {
|
|
7
|
+
return /*#__PURE__*/ jsx("style", {
|
|
8
|
+
nonce: nonce,
|
|
9
|
+
href: DISABLE_SCROLLBAR_CLASS_NAME,
|
|
10
|
+
precedence: "base-ui:low",
|
|
11
|
+
children: `.${DISABLE_SCROLLBAR_CLASS_NAME}{scrollbar-width:none}.${DISABLE_SCROLLBAR_CLASS_NAME}::-webkit-scrollbar{display:none}`
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
if ("production" !== process.env.NODE_ENV) styleDisableScrollbar.getElement.displayName = "styleDisableScrollbar.getElement";
|
|
16
|
+
const SCROLL_EDGE_TOLERANCE_PX = 1;
|
|
17
|
+
function getMaxScrollOffset(scrollSize, clientSize) {
|
|
18
|
+
return Math.max(0, scrollSize - clientSize);
|
|
19
|
+
}
|
|
20
|
+
function normalizeScrollOffset(value, max) {
|
|
21
|
+
if (max <= 0) return 0;
|
|
22
|
+
const clamped = clamp(value, 0, max);
|
|
23
|
+
const startDistance = clamped;
|
|
24
|
+
const endDistance = max - clamped;
|
|
25
|
+
const withinStartTolerance = startDistance <= SCROLL_EDGE_TOLERANCE_PX;
|
|
26
|
+
const withinEndTolerance = endDistance <= SCROLL_EDGE_TOLERANCE_PX;
|
|
27
|
+
if (withinStartTolerance && withinEndTolerance) return startDistance <= endDistance ? 0 : max;
|
|
28
|
+
if (withinStartTolerance) return 0;
|
|
29
|
+
if (withinEndTolerance) return max;
|
|
30
|
+
return clamped;
|
|
31
|
+
}
|
|
32
|
+
export { getMaxScrollOffset, normalizeScrollOffset, styleDisableScrollbar };
|
package/dist/6330.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isAndroid, isJSDOM } from "./8971.js";
|
|
2
|
+
function stopEvent(event) {
|
|
3
|
+
event.preventDefault();
|
|
4
|
+
event.stopPropagation();
|
|
5
|
+
}
|
|
6
|
+
function isReactEvent(event) {
|
|
7
|
+
return 'nativeEvent' in event;
|
|
8
|
+
}
|
|
9
|
+
function isVirtualClick(event) {
|
|
10
|
+
if ('' === event.pointerType && event.isTrusted) return true;
|
|
11
|
+
if (isAndroid && event.pointerType) return 'click' === event.type && 1 === event.buttons;
|
|
12
|
+
return 0 === event.detail && !event.pointerType;
|
|
13
|
+
}
|
|
14
|
+
function isVirtualPointerEvent(event) {
|
|
15
|
+
if (isJSDOM) return false;
|
|
16
|
+
return !isAndroid && 0 === event.width && 0 === event.height || isAndroid && 1 === event.width && 1 === event.height && 0 === event.pressure && 0 === event.detail && 'mouse' === event.pointerType || event.width < 1 && event.height < 1 && 0 === event.pressure && 0 === event.detail && 'touch' === event.pointerType;
|
|
17
|
+
}
|
|
18
|
+
function isMouseLikePointerType(pointerType, strict) {
|
|
19
|
+
const values = [
|
|
20
|
+
'mouse',
|
|
21
|
+
'pen'
|
|
22
|
+
];
|
|
23
|
+
if (!strict) values.push('', void 0);
|
|
24
|
+
return values.includes(pointerType);
|
|
25
|
+
}
|
|
26
|
+
function isClickLikeEvent(event) {
|
|
27
|
+
const type = event.type;
|
|
28
|
+
return 'click' === type || 'mousedown' === type || 'keydown' === type || 'keyup' === type;
|
|
29
|
+
}
|
|
30
|
+
export { isClickLikeEvent, isMouseLikePointerType, isReactEvent, isVirtualClick, isVirtualPointerEvent, stopEvent };
|
package/dist/6499.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as __rspack_external_react from "react";
|
|
2
|
+
const SafeReact = {
|
|
3
|
+
...__rspack_external_react
|
|
4
|
+
};
|
|
5
|
+
const noop = ()=>{};
|
|
6
|
+
const useIsoLayoutEffect = "u" > typeof document ? __rspack_external_react.useLayoutEffect : noop;
|
|
7
|
+
export { SafeReact, useIsoLayoutEffect };
|
package/dist/6535.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { getEmptyRootContext } from "./4922.js";
|
|
2
|
+
import { EMPTY_OBJECT } from "./8272.js";
|
|
3
|
+
import { createSelector, FloatingRootStore } from "./5992.js";
|
|
4
|
+
function createInitialPopupStoreState() {
|
|
5
|
+
return {
|
|
6
|
+
open: false,
|
|
7
|
+
openProp: void 0,
|
|
8
|
+
mounted: false,
|
|
9
|
+
transitionStatus: void 0,
|
|
10
|
+
floatingRootContext: getEmptyRootContext(),
|
|
11
|
+
floatingId: void 0,
|
|
12
|
+
triggerCount: 0,
|
|
13
|
+
preventUnmountingOnClose: false,
|
|
14
|
+
payload: void 0,
|
|
15
|
+
activeTriggerId: null,
|
|
16
|
+
activeTriggerElement: null,
|
|
17
|
+
triggerIdProp: void 0,
|
|
18
|
+
popupElement: null,
|
|
19
|
+
positionerElement: null,
|
|
20
|
+
activeTriggerProps: EMPTY_OBJECT,
|
|
21
|
+
inactiveTriggerProps: EMPTY_OBJECT,
|
|
22
|
+
popupProps: EMPTY_OBJECT
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function createPopupFloatingRootContext(triggerElements, floatingId, nested = false) {
|
|
26
|
+
return new FloatingRootStore({
|
|
27
|
+
open: false,
|
|
28
|
+
transitionStatus: void 0,
|
|
29
|
+
floatingElement: null,
|
|
30
|
+
referenceElement: null,
|
|
31
|
+
triggerElements,
|
|
32
|
+
floatingId,
|
|
33
|
+
syncOnly: true,
|
|
34
|
+
nested,
|
|
35
|
+
onOpenChange: void 0
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
const activeTriggerIdSelector = createSelector((state)=>state.triggerIdProp ?? state.activeTriggerId);
|
|
39
|
+
const openSelector = createSelector((state)=>state.openProp ?? state.open);
|
|
40
|
+
const popupIdSelector = createSelector((state)=>{
|
|
41
|
+
const popupId = state.popupElement?.id ?? state.floatingId;
|
|
42
|
+
return popupId || void 0;
|
|
43
|
+
});
|
|
44
|
+
function triggerOwnsOpenPopup(state, triggerId) {
|
|
45
|
+
return void 0 !== triggerId && openSelector(state) && activeTriggerIdSelector(state) === triggerId;
|
|
46
|
+
}
|
|
47
|
+
function triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) {
|
|
48
|
+
if (triggerOwnsOpenPopup(state, triggerId)) return true;
|
|
49
|
+
return void 0 !== triggerId && openSelector(state) && null == activeTriggerIdSelector(state) && 1 === state.triggerCount;
|
|
50
|
+
}
|
|
51
|
+
const popupStoreSelectors = {
|
|
52
|
+
open: openSelector,
|
|
53
|
+
mounted: createSelector((state)=>state.mounted),
|
|
54
|
+
transitionStatus: createSelector((state)=>state.transitionStatus),
|
|
55
|
+
floatingRootContext: createSelector((state)=>state.floatingRootContext),
|
|
56
|
+
triggerCount: createSelector((state)=>state.triggerCount),
|
|
57
|
+
preventUnmountingOnClose: createSelector((state)=>state.preventUnmountingOnClose),
|
|
58
|
+
payload: createSelector((state)=>state.payload),
|
|
59
|
+
activeTriggerId: activeTriggerIdSelector,
|
|
60
|
+
activeTriggerElement: createSelector((state)=>state.mounted ? state.activeTriggerElement : null),
|
|
61
|
+
popupId: popupIdSelector,
|
|
62
|
+
isTriggerActive: createSelector((state, triggerId)=>void 0 !== triggerId && activeTriggerIdSelector(state) === triggerId),
|
|
63
|
+
isOpenedByTrigger: createSelector((state, triggerId)=>triggerOwnsOpenPopup(state, triggerId)),
|
|
64
|
+
isMountedByTrigger: createSelector((state, triggerId)=>void 0 !== triggerId && activeTriggerIdSelector(state) === triggerId && state.mounted),
|
|
65
|
+
triggerProps: createSelector((state, isActive)=>isActive ? state.activeTriggerProps : state.inactiveTriggerProps),
|
|
66
|
+
triggerPopupId: createSelector((state, triggerId)=>triggerOwnsOpenPopupOrIsOnlyTrigger(state, triggerId) ? popupIdSelector(state) : void 0),
|
|
67
|
+
popupProps: createSelector((state)=>state.popupProps),
|
|
68
|
+
popupElement: createSelector((state)=>state.popupElement),
|
|
69
|
+
positionerElement: createSelector((state)=>state.positionerElement)
|
|
70
|
+
};
|
|
71
|
+
export { createInitialPopupStoreState, createPopupFloatingRootContext, popupStoreSelectors };
|