@wix/site-ui 1.346.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/4989.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { SafeReact } from "./3357.js";
|
|
2
|
+
import * as __rspack_external_react from "react";
|
|
3
|
+
function useForcedRerendering() {
|
|
4
|
+
const [, setState] = __rspack_external_react.useState({});
|
|
5
|
+
return __rspack_external_react.useCallback(()=>{
|
|
6
|
+
setState({});
|
|
7
|
+
}, []);
|
|
8
|
+
}
|
|
9
|
+
let globalId = 0;
|
|
10
|
+
function useGlobalId(idOverride, prefix = 'mui') {
|
|
11
|
+
const defaultId = __rspack_external_react.useRef(void 0);
|
|
12
|
+
const forceRerender = useForcedRerendering();
|
|
13
|
+
const id = idOverride ?? defaultId.current;
|
|
14
|
+
__rspack_external_react.useEffect(()=>{
|
|
15
|
+
if (null == defaultId.current) {
|
|
16
|
+
globalId += 1;
|
|
17
|
+
defaultId.current = `${prefix}-${globalId}`;
|
|
18
|
+
if (null == idOverride) forceRerender();
|
|
19
|
+
}
|
|
20
|
+
}, [
|
|
21
|
+
idOverride,
|
|
22
|
+
prefix,
|
|
23
|
+
forceRerender
|
|
24
|
+
]);
|
|
25
|
+
return id;
|
|
26
|
+
}
|
|
27
|
+
const maybeReactUseId = SafeReact.useId;
|
|
28
|
+
function useId(idOverride, prefix) {
|
|
29
|
+
if (void 0 !== maybeReactUseId) {
|
|
30
|
+
const reactId = maybeReactUseId();
|
|
31
|
+
return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
|
|
32
|
+
}
|
|
33
|
+
return useGlobalId(idOverride, prefix);
|
|
34
|
+
}
|
|
35
|
+
export { useForcedRerendering, useId };
|
package/dist/{6270.js → 510.js}
RENAMED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useButton } from "./
|
|
4
|
-
import { createChangeEventDetails } from "./
|
|
5
|
-
import { closePress, imperativeAction } from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
2
|
+
import { utils_formatErrorMessage } from "./5473.js";
|
|
3
|
+
import { useButton } from "./9248.js";
|
|
4
|
+
import { createChangeEventDetails } from "./8495.js";
|
|
5
|
+
import { closePress, imperativeAction } from "./9837.js";
|
|
6
|
+
import { useRenderElement } from "./9591.js";
|
|
7
|
+
import { useBaseUiId } from "./5969.js";
|
|
8
|
+
import { popupStateMapping, triggerOpenStateMapping } from "./6904.js";
|
|
9
|
+
import { transitionStatusMapping } from "./8488.js";
|
|
10
|
+
import { fastComponentRef, ReactStore } from "./226.js";
|
|
11
|
+
import { usePopupHandleStore, BasePopupHandle } from "./6040.js";
|
|
12
|
+
import { useTriggerDataForwarding, PopupTriggerMap, usePopupRootSync, usePopupInteractionProps, PopupHandleAttachment, useImplicitActiveTrigger, useOpenStateTransitions, createPopupOpenState, usePopupRootStore, useDismiss } from "./4346.js";
|
|
13
|
+
import { useClick } from "./8407.js";
|
|
14
|
+
import { InternalBackdrop_InternalBackdrop, useOpenMethodTriggerProps, useScrollLock } from "./7323.js";
|
|
15
|
+
import { FloatingPortal_FloatingPortal, CLICK_TRIGGER_IDENTIFIER } from "./3398.js";
|
|
16
|
+
import { getTarget, contains } from "./4155.js";
|
|
17
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
18
|
+
import { NullStore, popupStoreSelectors, createInitialPopupStoreState } from "./1669.js";
|
|
19
|
+
import { inertValue } from "./9374.js";
|
|
18
20
|
import * as __rspack_external_react from "react";
|
|
19
|
-
const IsDrawerContext = /*#__PURE__*/ __rspack_external_react.createContext(false);
|
|
20
|
-
if ("production" !== process.env.NODE_ENV) IsDrawerContext.displayName = "IsDrawerContext";
|
|
21
21
|
const DialogRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
22
22
|
if ("production" !== process.env.NODE_ENV) DialogRootContext.displayName = "DialogRootContext";
|
|
23
23
|
function useDialogRootContext(optional) {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
26
|
-
return
|
|
24
|
+
const store = __rspack_external_react.useContext(DialogRootContext);
|
|
25
|
+
if (!optional && void 0 === store) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.' : utils_formatErrorMessage(27));
|
|
26
|
+
return store;
|
|
27
27
|
}
|
|
28
28
|
const DialogClose_DialogClose = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
29
29
|
const { render, className, style, disabled = false, nativeButton = true, ...elementProps } = componentProps;
|
|
30
|
-
const
|
|
30
|
+
const store = useDialogRootContext();
|
|
31
31
|
const open = store.useState('open');
|
|
32
32
|
const { getButtonProps, buttonRef } = useButton({
|
|
33
33
|
disabled,
|
|
@@ -57,7 +57,7 @@ const DialogClose_DialogClose = /*#__PURE__*/ __rspack_external_react.forwardRef
|
|
|
57
57
|
if ("production" !== process.env.NODE_ENV) DialogClose_DialogClose.displayName = "DialogClose";
|
|
58
58
|
const DialogDescription_DialogDescription = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
59
59
|
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
60
|
-
const
|
|
60
|
+
const store = useDialogRootContext();
|
|
61
61
|
const id = useBaseUiId(idProp);
|
|
62
62
|
store.useSyncedValueWithCleanup("descriptionElementId", id);
|
|
63
63
|
return useRenderElement('p', componentProps, {
|
|
@@ -75,12 +75,22 @@ const DialogPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(
|
|
|
75
75
|
if ("production" !== process.env.NODE_ENV) DialogPortalContext.displayName = "DialogPortalContext";
|
|
76
76
|
function useDialogPortalContext() {
|
|
77
77
|
const value = __rspack_external_react.useContext(DialogPortalContext);
|
|
78
|
-
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Dialog.Portal> is missing.' :
|
|
78
|
+
if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <Dialog.Portal> is missing.' : utils_formatErrorMessage(26));
|
|
79
79
|
return value;
|
|
80
80
|
}
|
|
81
|
+
const DialogPopupDataAttributes_nestedDialogOpen = 'data-nested-dialog-open';
|
|
82
|
+
const dialogStateAttributesMapping = {
|
|
83
|
+
...popupStateMapping,
|
|
84
|
+
...transitionStatusMapping,
|
|
85
|
+
nestedDialogOpen (value) {
|
|
86
|
+
return value ? {
|
|
87
|
+
[DialogPopupDataAttributes_nestedDialogOpen]: ''
|
|
88
|
+
} : null;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
81
91
|
const DialogTitle_DialogTitle = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
82
92
|
const { render, className, style, id: idProp, ...elementProps } = componentProps;
|
|
83
|
-
const
|
|
93
|
+
const store = useDialogRootContext();
|
|
84
94
|
const id = useBaseUiId(idProp);
|
|
85
95
|
store.useSyncedValueWithCleanup('titleElementId', id);
|
|
86
96
|
return useRenderElement('h2', componentProps, {
|
|
@@ -94,33 +104,10 @@ const DialogTitle_DialogTitle = /*#__PURE__*/ __rspack_external_react.forwardRef
|
|
|
94
104
|
});
|
|
95
105
|
});
|
|
96
106
|
if ("production" !== process.env.NODE_ENV) DialogTitle_DialogTitle.displayName = "DialogTitle";
|
|
97
|
-
let DialogViewportDataAttributes_DialogViewportDataAttributes = function(DialogViewportDataAttributes) {
|
|
98
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["open"] = popupStateMapping_CommonPopupDataAttributes.open] = "open";
|
|
99
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["closed"] = popupStateMapping_CommonPopupDataAttributes.closed] = "closed";
|
|
100
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["startingStyle"] = popupStateMapping_CommonPopupDataAttributes.startingStyle] = "startingStyle";
|
|
101
|
-
DialogViewportDataAttributes[DialogViewportDataAttributes["endingStyle"] = popupStateMapping_CommonPopupDataAttributes.endingStyle] = "endingStyle";
|
|
102
|
-
DialogViewportDataAttributes["nested"] = "data-nested";
|
|
103
|
-
DialogViewportDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
|
|
104
|
-
return DialogViewportDataAttributes;
|
|
105
|
-
}({});
|
|
106
|
-
const stateAttributesMapping = {
|
|
107
|
-
...popupStateMapping,
|
|
108
|
-
...transitionStatusMapping,
|
|
109
|
-
nested (value) {
|
|
110
|
-
return value ? {
|
|
111
|
-
[DialogViewportDataAttributes_DialogViewportDataAttributes.nested]: ''
|
|
112
|
-
} : null;
|
|
113
|
-
},
|
|
114
|
-
nestedDialogOpen (value) {
|
|
115
|
-
return value ? {
|
|
116
|
-
[DialogViewportDataAttributes_DialogViewportDataAttributes.nestedDialogOpen]: ''
|
|
117
|
-
} : null;
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
107
|
const DialogViewport_DialogViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
121
108
|
const { render, className, style, children, ...elementProps } = componentProps;
|
|
122
109
|
const keepMounted = useDialogPortalContext();
|
|
123
|
-
const
|
|
110
|
+
const store = useDialogRootContext();
|
|
124
111
|
const open = store.useState('open');
|
|
125
112
|
const nested = store.useState('nested');
|
|
126
113
|
const transitionStatus = store.useState('transitionStatus');
|
|
@@ -142,7 +129,7 @@ const DialogViewport_DialogViewport = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
142
129
|
forwardedRef,
|
|
143
130
|
setViewportElement
|
|
144
131
|
],
|
|
145
|
-
stateAttributesMapping:
|
|
132
|
+
stateAttributesMapping: dialogStateAttributesMapping,
|
|
146
133
|
props: [
|
|
147
134
|
{
|
|
148
135
|
role: 'presentation',
|
|
@@ -157,11 +144,12 @@ const DialogViewport_DialogViewport = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
157
144
|
});
|
|
158
145
|
});
|
|
159
146
|
if ("production" !== process.env.NODE_ENV) DialogViewport_DialogViewport.displayName = "DialogViewport";
|
|
160
|
-
const DialogTrigger_DialogTrigger =
|
|
147
|
+
const DialogTrigger_DialogTrigger = fastComponentRef(function(componentProps, forwardedRef) {
|
|
161
148
|
const { render, className, style, disabled = false, nativeButton = true, id: idProp, payload, handle, ...elementProps } = componentProps;
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
|
|
149
|
+
const dialogRootStore = useDialogRootContext(true);
|
|
150
|
+
const handleStore = usePopupHandleStore(handle);
|
|
151
|
+
const store = handleStore ?? dialogRootStore;
|
|
152
|
+
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.' : utils_formatErrorMessage(79));
|
|
165
153
|
const thisTriggerId = useBaseUiId(idProp);
|
|
166
154
|
const floatingContext = store.useState('floatingRootContext');
|
|
167
155
|
const isOpenedByThisTrigger = store.useState('isOpenedByTrigger', thisTriggerId);
|
|
@@ -174,9 +162,7 @@ const DialogTrigger_DialogTrigger = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
174
162
|
disabled,
|
|
175
163
|
native: nativeButton
|
|
176
164
|
});
|
|
177
|
-
const click = useClick(floatingContext
|
|
178
|
-
enabled: null != floatingContext
|
|
179
|
-
});
|
|
165
|
+
const click = useClick(floatingContext);
|
|
180
166
|
const interactionTypeProps = useOpenMethodTriggerProps(()=>store.select('open'), (interactionType)=>{
|
|
181
167
|
store.set('openMethod', interactionType);
|
|
182
168
|
});
|
|
@@ -211,32 +197,9 @@ const DialogTrigger_DialogTrigger = /*#__PURE__*/ __rspack_external_react.forwar
|
|
|
211
197
|
});
|
|
212
198
|
});
|
|
213
199
|
if ("production" !== process.env.NODE_ENV) DialogTrigger_DialogTrigger.displayName = "DialogTrigger";
|
|
214
|
-
function
|
|
215
|
-
const { store, parentContext, actionsRef, isDrawer } = params;
|
|
216
|
-
const open = store.useState('open');
|
|
217
|
-
usePopupRootSync(store, open);
|
|
218
|
-
useImplicitActiveTrigger(store);
|
|
219
|
-
const { forceUnmount } = useOpenStateTransitions(open, store);
|
|
220
|
-
const handleImperativeClose = __rspack_external_react.useCallback(()=>{
|
|
221
|
-
store.setOpen(false, createChangeEventDetails(imperativeAction));
|
|
222
|
-
}, [
|
|
223
|
-
store
|
|
224
|
-
]);
|
|
225
|
-
__rspack_external_react.useImperativeHandle(actionsRef, ()=>({
|
|
226
|
-
unmount: forceUnmount,
|
|
227
|
-
close: handleImperativeClose
|
|
228
|
-
}), [
|
|
229
|
-
forceUnmount,
|
|
230
|
-
handleImperativeClose
|
|
231
|
-
]);
|
|
232
|
-
return {
|
|
233
|
-
parentContext,
|
|
234
|
-
isDrawer
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
function DialogInteractions({ store, dialogRoot }) {
|
|
238
|
-
const { parentContext, isDrawer } = dialogRoot;
|
|
200
|
+
function DialogInteractions({ store, parentContext, isDrawer }) {
|
|
239
201
|
const open = store.useState('open');
|
|
202
|
+
const mounted = store.useState('mounted');
|
|
240
203
|
const disablePointerDismissal = store.useState('disablePointerDismissal');
|
|
241
204
|
const modal = store.useState('modal');
|
|
242
205
|
const popupElement = store.useState('popupElement');
|
|
@@ -255,11 +218,18 @@ function DialogInteractions({ store, dialogRoot }) {
|
|
|
255
218
|
outsidePress (event) {
|
|
256
219
|
if (!store.context.outsidePressEnabledRef.current) return false;
|
|
257
220
|
if ('button' in event && 0 !== event.button) return false;
|
|
258
|
-
if ('touches' in event
|
|
221
|
+
if ('touches' in event) {
|
|
222
|
+
if ('touchend' === event.type) {
|
|
223
|
+
if (1 !== event.changedTouches.length || 0 !== event.touches.length) return false;
|
|
224
|
+
} else if (1 !== event.touches.length) return false;
|
|
225
|
+
}
|
|
259
226
|
const target = getTarget(event);
|
|
260
227
|
if (isTopmost && !disablePointerDismissal) {
|
|
261
|
-
|
|
262
|
-
|
|
228
|
+
if (modal) {
|
|
229
|
+
const internalBackdrop = store.context.internalBackdropRef.current;
|
|
230
|
+
const backdrop = store.context.backdropRef.current;
|
|
231
|
+
return internalBackdrop || backdrop ? internalBackdrop === target || backdrop === target || contains(target, popupElement) && !target?.hasAttribute('data-base-ui-portal') : true;
|
|
232
|
+
}
|
|
263
233
|
return true;
|
|
264
234
|
}
|
|
265
235
|
return false;
|
|
@@ -268,18 +238,25 @@ function DialogInteractions({ store, dialogRoot }) {
|
|
|
268
238
|
});
|
|
269
239
|
useScrollLock(open && true === modal, popupElement);
|
|
270
240
|
store.useContextCallback('onNestedDialogOpen', (dialogCount, drawerCount)=>{
|
|
241
|
+
if (!store.select('open') && !store.select('mounted')) return;
|
|
271
242
|
setOwnNestedOpenDialogs(dialogCount);
|
|
272
243
|
setOwnNestedOpenDrawers(drawerCount);
|
|
273
244
|
});
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
245
|
+
useIsoLayoutEffect(()=>{
|
|
246
|
+
if (!open && !mounted) {
|
|
247
|
+
setOwnNestedOpenDialogs(0);
|
|
248
|
+
setOwnNestedOpenDrawers(0);
|
|
249
|
+
}
|
|
250
|
+
}, [
|
|
251
|
+
open,
|
|
252
|
+
mounted
|
|
253
|
+
]);
|
|
254
|
+
useIsoLayoutEffect(()=>{
|
|
255
|
+
if (parentContext?.onNestedDialogOpen) {
|
|
256
|
+
if (open) parentContext.onNestedDialogOpen(ownNestedOpenDialogs + 1, ownNestedOpenDrawers + (isDrawer ? 1 : 0));
|
|
257
|
+
}
|
|
281
258
|
return ()=>{
|
|
282
|
-
if (parentContext?.
|
|
259
|
+
if (parentContext?.onNestedDialogOpen && open) parentContext.onNestedDialogOpen(0, 0);
|
|
283
260
|
};
|
|
284
261
|
}, [
|
|
285
262
|
isDrawer,
|
|
@@ -288,15 +265,10 @@ function DialogInteractions({ store, dialogRoot }) {
|
|
|
288
265
|
ownNestedOpenDrawers,
|
|
289
266
|
parentContext
|
|
290
267
|
]);
|
|
291
|
-
const activeTriggerProps = dismiss.reference ?? EMPTY_OBJECT;
|
|
292
|
-
const inactiveTriggerProps = dismiss.trigger ?? EMPTY_OBJECT;
|
|
293
|
-
const popupProps = __rspack_external_react.useMemo(()=>mergeProps(FOCUSABLE_POPUP_PROPS, dismiss.floating), [
|
|
294
|
-
dismiss.floating
|
|
295
|
-
]);
|
|
296
268
|
usePopupInteractionProps(store, {
|
|
297
|
-
activeTriggerProps,
|
|
298
|
-
inactiveTriggerProps,
|
|
299
|
-
popupProps,
|
|
269
|
+
activeTriggerProps: dismiss.reference,
|
|
270
|
+
inactiveTriggerProps: dismiss.trigger,
|
|
271
|
+
popupProps: dismiss.floating,
|
|
300
272
|
nestedOpenDialogCount: ownNestedOpenDialogs,
|
|
301
273
|
nestedOpenDrawerCount: ownNestedOpenDrawers
|
|
302
274
|
});
|
|
@@ -304,33 +276,22 @@ function DialogInteractions({ store, dialogRoot }) {
|
|
|
304
276
|
}
|
|
305
277
|
const selectors = {
|
|
306
278
|
...popupStoreSelectors,
|
|
307
|
-
modal:
|
|
308
|
-
nested:
|
|
309
|
-
nestedOpenDialogCount:
|
|
310
|
-
nestedOpenDrawerCount:
|
|
311
|
-
disablePointerDismissal:
|
|
312
|
-
openMethod:
|
|
313
|
-
descriptionElementId:
|
|
314
|
-
titleElementId:
|
|
315
|
-
viewportElement:
|
|
316
|
-
role:
|
|
279
|
+
modal: (state)=>state.modal,
|
|
280
|
+
nested: (state)=>state.nested,
|
|
281
|
+
nestedOpenDialogCount: (state)=>state.nestedOpenDialogCount,
|
|
282
|
+
nestedOpenDrawerCount: (state)=>state.nestedOpenDrawerCount,
|
|
283
|
+
disablePointerDismissal: (state)=>state.disablePointerDismissal,
|
|
284
|
+
openMethod: (state)=>state.openMethod,
|
|
285
|
+
descriptionElementId: (state)=>state.descriptionElementId,
|
|
286
|
+
titleElementId: (state)=>state.titleElementId,
|
|
287
|
+
viewportElement: (state)=>state.viewportElement,
|
|
288
|
+
role: (state)=>state.role
|
|
317
289
|
};
|
|
318
290
|
class DialogStore extends ReactStore {
|
|
319
|
-
constructor(initialState, floatingId, nested
|
|
291
|
+
constructor(initialState, floatingId, nested){
|
|
320
292
|
const triggerElements = new PopupTriggerMap();
|
|
321
|
-
const state = createInitialState(initialState);
|
|
322
|
-
state
|
|
323
|
-
super(state, {
|
|
324
|
-
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
325
|
-
backdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
326
|
-
internalBackdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
327
|
-
outsidePressEnabledRef: {
|
|
328
|
-
current: true
|
|
329
|
-
},
|
|
330
|
-
triggerElements,
|
|
331
|
-
onOpenChange: void 0,
|
|
332
|
-
onOpenChangeComplete: void 0
|
|
333
|
-
}, selectors);
|
|
293
|
+
const state = createInitialState(initialState, triggerElements, floatingId, nested);
|
|
294
|
+
super(state, createInitialContext(triggerElements), selectors);
|
|
334
295
|
}
|
|
335
296
|
setOpen = (nextOpen, eventDetails)=>{
|
|
336
297
|
eventDetails.preventUnmountOnClose = ()=>{
|
|
@@ -340,23 +301,18 @@ class DialogStore extends ReactStore {
|
|
|
340
301
|
this.context.onOpenChange?.(nextOpen, eventDetails);
|
|
341
302
|
if (eventDetails.isCanceled) return;
|
|
342
303
|
this.state.floatingRootContext.dispatchOpenChange(nextOpen, eventDetails);
|
|
343
|
-
|
|
344
|
-
open: nextOpen
|
|
345
|
-
};
|
|
346
|
-
setOpenTriggerState(updatedState, nextOpen, eventDetails.trigger);
|
|
347
|
-
this.update(updatedState);
|
|
304
|
+
this.update(createPopupOpenState(this.state, nextOpen, eventDetails.trigger));
|
|
348
305
|
};
|
|
349
|
-
static useStore(externalStore, initialState) {
|
|
350
|
-
const store = usePopupStore(externalStore, (floatingId, nested)=>new DialogStore(initialState, floatingId, nested), true).store;
|
|
351
|
-
return store;
|
|
352
|
-
}
|
|
353
306
|
}
|
|
354
|
-
function
|
|
355
|
-
|
|
356
|
-
|
|
307
|
+
function createNullDialogStore() {
|
|
308
|
+
const triggerElements = new PopupTriggerMap();
|
|
309
|
+
return new NullStore(Object.freeze(createInitialState(void 0, triggerElements)), Object.freeze(createInitialContext(triggerElements)), selectors);
|
|
310
|
+
}
|
|
311
|
+
function createInitialState(initialState, triggerElements, floatingId, nested = false) {
|
|
312
|
+
const state = {
|
|
313
|
+
...createInitialPopupStoreState(triggerElements, floatingId, nested),
|
|
357
314
|
modal: true,
|
|
358
315
|
disablePointerDismissal: false,
|
|
359
|
-
popupElement: null,
|
|
360
316
|
viewportElement: null,
|
|
361
317
|
descriptionElementId: void 0,
|
|
362
318
|
titleElementId: void 0,
|
|
@@ -367,40 +323,43 @@ function createInitialState(initialState = {}) {
|
|
|
367
323
|
role: 'dialog',
|
|
368
324
|
...initialState
|
|
369
325
|
};
|
|
326
|
+
return state;
|
|
327
|
+
}
|
|
328
|
+
function createInitialContext(triggerElements) {
|
|
329
|
+
return {
|
|
330
|
+
popupRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
331
|
+
backdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
332
|
+
internalBackdropRef: /*#__PURE__*/ __rspack_external_react.createRef(),
|
|
333
|
+
outsidePressEnabledRef: {
|
|
334
|
+
current: true
|
|
335
|
+
},
|
|
336
|
+
triggerElements,
|
|
337
|
+
onOpenChange: void 0,
|
|
338
|
+
onOpenChangeComplete: void 0
|
|
339
|
+
};
|
|
370
340
|
}
|
|
371
|
-
function useRenderDialogRoot(
|
|
341
|
+
function useRenderDialogRoot(mode, props) {
|
|
372
342
|
const { children, open: openProp, defaultOpen = false, onOpenChange, onOpenChangeComplete, disablePointerDismissal: disablePointerDismissalProp = false, modal: modalProp = true, actionsRef, handle, triggerId: triggerIdProp, defaultTriggerId: defaultTriggerIdProp = null } = props;
|
|
373
343
|
const isDrawer = 'drawer' === mode;
|
|
374
344
|
const isAlertDialog = 'alert-dialog' === mode;
|
|
375
345
|
const modal = isAlertDialog ? true : modalProp;
|
|
376
346
|
const disablePointerDismissal = isAlertDialog || disablePointerDismissalProp;
|
|
377
347
|
const role = isAlertDialog ? 'alertdialog' : 'dialog';
|
|
378
|
-
const
|
|
379
|
-
const nested =
|
|
348
|
+
const parentStore = useDialogRootContext(true);
|
|
349
|
+
const nested = null != parentStore;
|
|
380
350
|
const rootState = {
|
|
381
351
|
modal,
|
|
382
352
|
disablePointerDismissal,
|
|
383
353
|
nested,
|
|
384
354
|
role
|
|
385
355
|
};
|
|
386
|
-
const store =
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
useOnFirstRender(()=>{
|
|
394
|
-
const nextState = void 0 === openProp && false === store.state.open && true === defaultOpen ? {
|
|
395
|
-
open: true,
|
|
396
|
-
activeTriggerId: defaultTriggerIdProp
|
|
397
|
-
} : null;
|
|
398
|
-
if (isAlertDialog) store.update(nextState ? {
|
|
399
|
-
...rootState,
|
|
400
|
-
...nextState
|
|
401
|
-
} : rootState);
|
|
402
|
-
else if (nextState) store.update(nextState);
|
|
403
|
-
});
|
|
356
|
+
const store = usePopupRootStore((floatingId, floatingNested)=>new DialogStore({
|
|
357
|
+
open: defaultOpen,
|
|
358
|
+
openProp,
|
|
359
|
+
activeTriggerId: defaultTriggerIdProp,
|
|
360
|
+
triggerIdProp,
|
|
361
|
+
...rootState
|
|
362
|
+
}, floatingId, floatingNested), true);
|
|
404
363
|
store.useControlledProp('openProp', openProp);
|
|
405
364
|
store.useControlledProp('triggerIdProp', triggerIdProp);
|
|
406
365
|
store.useSyncedValues(rootState);
|
|
@@ -409,37 +368,38 @@ function useRenderDialogRoot(props, mode = 'dialog') {
|
|
|
409
368
|
const open = store.useState('open');
|
|
410
369
|
const mounted = store.useState('mounted');
|
|
411
370
|
const payload = store.useState('payload');
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
const shouldRenderInteractions = open || mounted;
|
|
419
|
-
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
420
|
-
store
|
|
371
|
+
usePopupRootSync(store, open);
|
|
372
|
+
useImplicitActiveTrigger(store);
|
|
373
|
+
const { forceUnmount } = useOpenStateTransitions(open, store);
|
|
374
|
+
__rspack_external_react.useImperativeHandle(actionsRef, ()=>({
|
|
375
|
+
unmount: forceUnmount,
|
|
376
|
+
close: ()=>store.setOpen(false, createChangeEventDetails(imperativeAction))
|
|
421
377
|
}), [
|
|
378
|
+
forceUnmount,
|
|
422
379
|
store
|
|
423
380
|
]);
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
381
|
+
const shouldRenderInteractions = open || mounted || null != handle;
|
|
382
|
+
return /*#__PURE__*/ jsxs(DialogRootContext.Provider, {
|
|
383
|
+
value: store,
|
|
384
|
+
children: [
|
|
385
|
+
handle && /*#__PURE__*/ jsx(PopupHandleAttachment, {
|
|
386
|
+
handle: handle,
|
|
387
|
+
store: store
|
|
388
|
+
}),
|
|
389
|
+
shouldRenderInteractions && /*#__PURE__*/ jsx(DialogInteractions, {
|
|
390
|
+
store: store,
|
|
391
|
+
parentContext: parentStore?.context,
|
|
392
|
+
isDrawer: isDrawer
|
|
393
|
+
}),
|
|
394
|
+
'function' == typeof children ? children({
|
|
395
|
+
payload
|
|
396
|
+
}) : children
|
|
397
|
+
]
|
|
438
398
|
});
|
|
439
399
|
}
|
|
440
400
|
const DialogPortal_DialogPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
|
|
441
401
|
const { keepMounted = false, ...portalProps } = props;
|
|
442
|
-
const
|
|
402
|
+
const store = useDialogRootContext();
|
|
443
403
|
const mounted = store.useState('mounted');
|
|
444
404
|
const modal = store.useState('modal');
|
|
445
405
|
const open = store.useState('open');
|
|
@@ -461,29 +421,30 @@ const DialogPortal_DialogPortal = /*#__PURE__*/ __rspack_external_react.forwardR
|
|
|
461
421
|
});
|
|
462
422
|
});
|
|
463
423
|
if ("production" !== process.env.NODE_ENV) DialogPortal_DialogPortal.displayName = "DialogPortal";
|
|
464
|
-
class DialogHandle {
|
|
465
|
-
constructor(
|
|
466
|
-
|
|
424
|
+
class DialogHandle extends BasePopupHandle {
|
|
425
|
+
constructor(){
|
|
426
|
+
super(createNullDialogStore(), 'Dialog', false);
|
|
467
427
|
}
|
|
468
428
|
open(triggerId) {
|
|
469
|
-
|
|
470
|
-
if ('production' !== process.env.NODE_ENV) {
|
|
471
|
-
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.`);
|
|
472
|
-
}
|
|
473
|
-
this.store.setOpen(true, createChangeEventDetails(imperativeAction, void 0, triggerElement));
|
|
429
|
+
this.openByTrigger(triggerId);
|
|
474
430
|
}
|
|
475
431
|
openWithPayload(payload) {
|
|
476
|
-
this.
|
|
477
|
-
|
|
432
|
+
const attachedStore = this.attachedStore;
|
|
433
|
+
if (null === attachedStore) {
|
|
434
|
+
if ('production' !== process.env.NODE_ENV) console.warn("Base UI: DialogHandle.openWithPayload() was called while no root using this handle is mounted. The call and its payload were ignored; mount a root with this handle before opening it imperatively.");
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
attachedStore.set('payload', payload);
|
|
438
|
+
attachedStore.setOpen(true, createChangeEventDetails(imperativeAction));
|
|
478
439
|
}
|
|
479
440
|
close() {
|
|
480
|
-
this.
|
|
441
|
+
this.closePopup();
|
|
481
442
|
}
|
|
482
443
|
get isOpen() {
|
|
483
|
-
return this.
|
|
444
|
+
return this.attachedStore?.select('open') ?? false;
|
|
484
445
|
}
|
|
485
446
|
}
|
|
486
447
|
function createDialogHandle() {
|
|
487
448
|
return new DialogHandle();
|
|
488
449
|
}
|
|
489
|
-
export { DialogClose_DialogClose, DialogDescription_DialogDescription, DialogHandle, DialogPortal_DialogPortal,
|
|
450
|
+
export { DialogClose_DialogClose, DialogDescription_DialogDescription, DialogHandle, DialogPortal_DialogPortal, DialogTitle_DialogTitle, DialogTrigger_DialogTrigger, DialogViewport_DialogViewport, createDialogHandle, dialogStateAttributesMapping, useDialogPortalContext, useDialogRootContext, useRenderDialogRoot };
|
package/dist/5258.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isElement, getComputedStyle, isLastTraversableNode, isHTMLElement, getParentNode } from "./3829.js";
|
|
2
|
+
function isScrollableY(element, allowOverflowIntent = false) {
|
|
3
|
+
const { overflowY } = getComputedStyle(element);
|
|
4
|
+
if ('auto' !== overflowY && 'scroll' !== overflowY) return false;
|
|
5
|
+
return allowOverflowIntent ? element.clientHeight > 0 : element.scrollHeight > element.clientHeight;
|
|
6
|
+
}
|
|
7
|
+
function isScrollableX(element, allowOverflowIntent = false) {
|
|
8
|
+
const { overflowX } = getComputedStyle(element);
|
|
9
|
+
if ('auto' !== overflowX && 'scroll' !== overflowX) return false;
|
|
10
|
+
return allowOverflowIntent ? element.clientWidth > 0 : element.scrollWidth > element.clientWidth;
|
|
11
|
+
}
|
|
12
|
+
function isScrollable(element, axis, allowOverflowIntent = false) {
|
|
13
|
+
return 'vertical' === axis ? isScrollableY(element, allowOverflowIntent) : isScrollableX(element, allowOverflowIntent);
|
|
14
|
+
}
|
|
15
|
+
function findScrollableAncestor(target, root, axis, allowOverflowIntent = false) {
|
|
16
|
+
let node = target;
|
|
17
|
+
while(isElement(node) && node !== root && !isLastTraversableNode(node)){
|
|
18
|
+
if (isHTMLElement(node) && isScrollable(node, axis, allowOverflowIntent)) return node;
|
|
19
|
+
node = getParentNode(node);
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
function findScrollableTouchTarget(target, root, axis = 'vertical', allowOverflowIntent = false) {
|
|
24
|
+
return findScrollableAncestor(target, root, axis, allowOverflowIntent) ?? (isScrollable(root, axis, allowOverflowIntent) ? root : null);
|
|
25
|
+
}
|
|
26
|
+
export { findScrollableAncestor, findScrollableTouchTarget, isScrollableY };
|
package/dist/{5036.js → 5275.js}
RENAMED