@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/{8171.js → 5298.js}
RENAMED
|
@@ -1,130 +1,82 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useAnimationsFinished } from "./
|
|
3
|
-
import { useAnimationFrame } from "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { getCssDimensions } from "./
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
2
|
+
import { useAnimationsFinished } from "./6620.js";
|
|
3
|
+
import { useAnimationFrame } from "./5595.js";
|
|
4
|
+
import { useStableCallback } from "./7488.js";
|
|
5
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
6
|
+
import { CommonPositionerCssVars_availableWidth, positionerWidth, CommonPositionerCssVars_availableHeight, positionerHeight } from "./497.js";
|
|
7
|
+
import { getCssDimensions } from "./3093.js";
|
|
8
|
+
import { EMPTY_OBJECT, NOOP } from "./9591.js";
|
|
9
|
+
import { useDirection } from "./6534.js";
|
|
10
|
+
import { usePreviousValue } from "./7640.js";
|
|
11
|
+
import { adaptiveOrigin } from "./3695.js";
|
|
12
|
+
import { ownerDocument } from "./6488.js";
|
|
13
|
+
import { inertValue } from "./9374.js";
|
|
12
14
|
import * as __rspack_external_react from "react";
|
|
13
15
|
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
14
|
-
const
|
|
16
|
+
const popupWidth = '--popup-width';
|
|
17
|
+
const popupHeight = '--popup-height';
|
|
15
18
|
function usePopupAutoResize(parameters) {
|
|
16
|
-
const { popupElement, positionerElement, content, mounted,
|
|
17
|
-
const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true
|
|
19
|
+
const { popupElement, positionerElement, content, mounted, onMeasureLayout: onMeasureLayoutParam, onMeasureLayoutComplete: onMeasureLayoutCompleteParam, side, direction } = parameters;
|
|
20
|
+
const runOnceAnimationsFinish = useAnimationsFinished(popupElement, true);
|
|
18
21
|
const animationFrame = useAnimationFrame();
|
|
19
22
|
const committedDimensionsRef = __rspack_external_react.useRef(null);
|
|
20
|
-
const liveDimensionsRef = __rspack_external_react.useRef(null);
|
|
21
|
-
const isInitialRenderRef = __rspack_external_react.useRef(true);
|
|
22
|
-
const restoreAnchoringStylesRef = __rspack_external_react.useRef(NOOP);
|
|
23
23
|
const onMeasureLayout = useStableCallback(onMeasureLayoutParam);
|
|
24
24
|
const onMeasureLayoutComplete = useStableCallback(onMeasureLayoutCompleteParam);
|
|
25
|
-
const anchoringStyles = __rspack_external_react.useMemo(()=>
|
|
26
|
-
let isOriginSide = 'top' === side;
|
|
27
|
-
let isPhysicalLeft = 'left' === side;
|
|
28
|
-
if ('rtl' === direction) {
|
|
29
|
-
isOriginSide = isOriginSide || 'inline-end' === side;
|
|
30
|
-
isPhysicalLeft = isPhysicalLeft || 'inline-end' === side;
|
|
31
|
-
} else {
|
|
32
|
-
isOriginSide = isOriginSide || 'inline-start' === side;
|
|
33
|
-
isPhysicalLeft = isPhysicalLeft || 'inline-start' === side;
|
|
34
|
-
}
|
|
35
|
-
return isOriginSide ? {
|
|
36
|
-
position: 'absolute',
|
|
37
|
-
['top' === side ? 'bottom' : 'top']: '0',
|
|
38
|
-
[isPhysicalLeft ? 'right' : 'left']: '0'
|
|
39
|
-
} : EMPTY_OBJECT;
|
|
40
|
-
}, [
|
|
25
|
+
const anchoringStyles = __rspack_external_react.useMemo(()=>getPopupAnchoringStyles(side, direction), [
|
|
41
26
|
side,
|
|
42
27
|
direction
|
|
43
28
|
]);
|
|
44
29
|
useIsoLayoutEffect(()=>{
|
|
45
|
-
if (!mounted
|
|
46
|
-
restoreAnchoringStylesRef.current = NOOP;
|
|
47
|
-
isInitialRenderRef.current = true;
|
|
30
|
+
if (!mounted) {
|
|
48
31
|
committedDimensionsRef.current = null;
|
|
49
|
-
liveDimensionsRef.current = null;
|
|
50
32
|
return;
|
|
51
33
|
}
|
|
52
34
|
if (!popupElement || !positionerElement) return;
|
|
53
|
-
|
|
54
|
-
const observer = new ResizeObserver((entries)=>{
|
|
55
|
-
const entry = entries[0];
|
|
56
|
-
if (entry) liveDimensionsRef.current = {
|
|
57
|
-
width: Math.ceil(entry.borderBoxSize[0].inlineSize),
|
|
58
|
-
height: Math.ceil(entry.borderBoxSize[0].blockSize)
|
|
59
|
-
};
|
|
60
|
-
});
|
|
61
|
-
observer.observe(popupElement);
|
|
35
|
+
const restoreAnchoringStyles = applyElementStyles(popupElement, anchoringStyles);
|
|
62
36
|
setPopupCssSize(popupElement, 'auto');
|
|
63
37
|
const restorePopupPosition = overrideElementStyle(popupElement, 'position', 'static');
|
|
64
38
|
const restorePopupTransform = overrideElementStyle(popupElement, 'transform', 'none');
|
|
65
39
|
const restorePopupScale = overrideElementStyle(popupElement, 'scale', '1');
|
|
66
40
|
const restorePositionerAvailableSize = applyElementStyles(positionerElement, {
|
|
67
|
-
|
|
68
|
-
|
|
41
|
+
[CommonPositionerCssVars_availableWidth]: 'max-content',
|
|
42
|
+
[CommonPositionerCssVars_availableHeight]: 'max-content'
|
|
69
43
|
});
|
|
70
44
|
function restoreMeasurementOverrides() {
|
|
71
45
|
restorePopupPosition();
|
|
72
46
|
restorePopupTransform();
|
|
73
47
|
restorePositionerAvailableSize();
|
|
74
|
-
}
|
|
75
|
-
function restoreMeasurementOverridesIncludingScale() {
|
|
76
|
-
restoreMeasurementOverrides();
|
|
77
48
|
restorePopupScale();
|
|
78
49
|
}
|
|
79
50
|
onMeasureLayout?.();
|
|
80
|
-
if (
|
|
51
|
+
if (null === committedDimensionsRef.current) {
|
|
81
52
|
setPositionerCssSize(positionerElement, 'max-content');
|
|
82
53
|
const dimensions = getCssDimensions(popupElement);
|
|
83
54
|
committedDimensionsRef.current = dimensions;
|
|
84
55
|
setPositionerCssSize(positionerElement, dimensions);
|
|
85
|
-
|
|
56
|
+
restoreMeasurementOverrides();
|
|
86
57
|
onMeasureLayoutComplete?.(null, dimensions);
|
|
87
|
-
|
|
88
|
-
return ()=>{
|
|
89
|
-
observer.disconnect();
|
|
90
|
-
restoreAnchoringStylesRef.current();
|
|
91
|
-
restoreAnchoringStylesRef.current = NOOP;
|
|
92
|
-
};
|
|
58
|
+
return restoreAnchoringStyles;
|
|
93
59
|
}
|
|
94
|
-
setPopupCssSize(popupElement, 'auto');
|
|
95
60
|
setPositionerCssSize(positionerElement, 'max-content');
|
|
96
|
-
const previousDimensions = committedDimensionsRef.current
|
|
61
|
+
const previousDimensions = committedDimensionsRef.current;
|
|
97
62
|
const newDimensions = getCssDimensions(popupElement);
|
|
98
63
|
committedDimensionsRef.current = newDimensions;
|
|
99
|
-
if (!previousDimensions) {
|
|
100
|
-
setPositionerCssSize(positionerElement, newDimensions);
|
|
101
|
-
restoreMeasurementOverridesIncludingScale();
|
|
102
|
-
onMeasureLayoutComplete?.(null, newDimensions);
|
|
103
|
-
return ()=>{
|
|
104
|
-
observer.disconnect();
|
|
105
|
-
animationFrame.cancel();
|
|
106
|
-
restoreAnchoringStylesRef.current();
|
|
107
|
-
restoreAnchoringStylesRef.current = NOOP;
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
64
|
setPopupCssSize(popupElement, previousDimensions);
|
|
111
|
-
|
|
65
|
+
restoreMeasurementOverrides();
|
|
112
66
|
onMeasureLayoutComplete?.(previousDimensions, newDimensions);
|
|
113
67
|
setPositionerCssSize(positionerElement, newDimensions);
|
|
114
68
|
const abortController = new AbortController();
|
|
115
69
|
animationFrame.request(()=>{
|
|
116
70
|
setPopupCssSize(popupElement, newDimensions);
|
|
117
71
|
runOnceAnimationsFinish(()=>{
|
|
118
|
-
popupElement.style.setProperty(
|
|
119
|
-
popupElement.style.setProperty(
|
|
72
|
+
popupElement.style.setProperty(popupWidth, 'auto');
|
|
73
|
+
popupElement.style.setProperty(popupHeight, 'auto');
|
|
120
74
|
}, abortController.signal);
|
|
121
75
|
});
|
|
122
76
|
return ()=>{
|
|
123
|
-
observer.disconnect();
|
|
124
77
|
abortController.abort();
|
|
125
78
|
animationFrame.cancel();
|
|
126
|
-
|
|
127
|
-
restoreAnchoringStylesRef.current = NOOP;
|
|
79
|
+
restoreAnchoringStyles();
|
|
128
80
|
};
|
|
129
81
|
}, [
|
|
130
82
|
content,
|
|
@@ -132,13 +84,22 @@ function usePopupAutoResize(parameters) {
|
|
|
132
84
|
positionerElement,
|
|
133
85
|
runOnceAnimationsFinish,
|
|
134
86
|
animationFrame,
|
|
135
|
-
enabled,
|
|
136
87
|
mounted,
|
|
137
88
|
onMeasureLayout,
|
|
138
89
|
onMeasureLayoutComplete,
|
|
139
90
|
anchoringStyles
|
|
140
91
|
]);
|
|
141
92
|
}
|
|
93
|
+
function getPopupAnchoringStyles(side, direction) {
|
|
94
|
+
const isPhysicalTop = 'top' === side;
|
|
95
|
+
const isPhysicalLeft = 'left' === side || side === ('rtl' === direction ? 'inline-end' : 'inline-start');
|
|
96
|
+
if (!isPhysicalTop && !isPhysicalLeft) return EMPTY_OBJECT;
|
|
97
|
+
return {
|
|
98
|
+
position: 'absolute',
|
|
99
|
+
[isPhysicalTop ? 'bottom' : 'top']: '0',
|
|
100
|
+
[isPhysicalLeft ? 'right' : 'left']: '0'
|
|
101
|
+
};
|
|
102
|
+
}
|
|
142
103
|
function overrideElementStyle(element, property, value) {
|
|
143
104
|
const originalValue = element.style.getPropertyValue(property);
|
|
144
105
|
element.style.setProperty(property, value);
|
|
@@ -156,17 +117,23 @@ function applyElementStyles(element, styles) {
|
|
|
156
117
|
function setPopupCssSize(popupElement, size) {
|
|
157
118
|
const width = 'auto' === size ? 'auto' : `${size.width}px`;
|
|
158
119
|
const height = 'auto' === size ? 'auto' : `${size.height}px`;
|
|
159
|
-
popupElement.style.setProperty(
|
|
160
|
-
popupElement.style.setProperty(
|
|
120
|
+
popupElement.style.setProperty(popupWidth, width);
|
|
121
|
+
popupElement.style.setProperty(popupHeight, height);
|
|
161
122
|
}
|
|
162
123
|
function setPositionerCssSize(positionerElement, size) {
|
|
163
124
|
const width = 'max-content' === size ? 'max-content' : `${size.width}px`;
|
|
164
125
|
const height = 'max-content' === size ? 'max-content' : `${size.height}px`;
|
|
165
|
-
positionerElement.style.setProperty(
|
|
166
|
-
positionerElement.style.setProperty(
|
|
126
|
+
positionerElement.style.setProperty(positionerWidth, width);
|
|
127
|
+
positionerElement.style.setProperty(positionerHeight, height);
|
|
167
128
|
}
|
|
129
|
+
const activationDirection = 'data-activation-direction';
|
|
130
|
+
const popupViewportStateMapping = {
|
|
131
|
+
activationDirection: (value)=>value ? {
|
|
132
|
+
[activationDirection]: value
|
|
133
|
+
} : null
|
|
134
|
+
};
|
|
168
135
|
function usePopupViewport(parameters) {
|
|
169
|
-
const { store, side,
|
|
136
|
+
const { store, side, children } = parameters;
|
|
170
137
|
const direction = useDirection();
|
|
171
138
|
const activeTrigger = store.useState('activeTriggerElement');
|
|
172
139
|
const activeTriggerId = store.useState('activeTriggerId');
|
|
@@ -182,14 +149,15 @@ function usePopupViewport(parameters) {
|
|
|
182
149
|
const [newTriggerOffset, setNewTriggerOffset] = __rspack_external_react.useState(null);
|
|
183
150
|
const currentContainerRef = __rspack_external_react.useRef(null);
|
|
184
151
|
const previousContainerRef = __rspack_external_react.useRef(null);
|
|
185
|
-
const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true
|
|
152
|
+
const onAnimationsFinished = useAnimationsFinished(currentContainerRef, true);
|
|
186
153
|
const cleanupFrame = useAnimationFrame();
|
|
154
|
+
const cleanupControllerRef = __rspack_external_react.useRef(null);
|
|
187
155
|
const [previousContentDimensions, setPreviousContentDimensions] = __rspack_external_react.useState(null);
|
|
188
156
|
const [showStartingStyleAttribute, setShowStartingStyleAttribute] = __rspack_external_react.useState(false);
|
|
189
157
|
useIsoLayoutEffect(()=>{
|
|
190
|
-
store.set('
|
|
158
|
+
store.set('adaptiveOrigin', adaptiveOrigin);
|
|
191
159
|
return ()=>{
|
|
192
|
-
store.set('
|
|
160
|
+
store.set('adaptiveOrigin', void 0);
|
|
193
161
|
};
|
|
194
162
|
}, [
|
|
195
163
|
store
|
|
@@ -205,30 +173,50 @@ function usePopupViewport(parameters) {
|
|
|
205
173
|
previousContainerRef.current?.style.removeProperty('display');
|
|
206
174
|
if (previousDimensions) setPreviousContentDimensions(previousDimensions);
|
|
207
175
|
});
|
|
176
|
+
const armViewportCleanup = useStableCallback(()=>{
|
|
177
|
+
cleanupControllerRef.current?.abort();
|
|
178
|
+
const controller = new AbortController();
|
|
179
|
+
cleanupControllerRef.current = controller;
|
|
180
|
+
onAnimationsFinished(()=>{
|
|
181
|
+
setPreviousContentNode(null);
|
|
182
|
+
setPreviousContentDimensions(null);
|
|
183
|
+
capturedNodeRef.current = null;
|
|
184
|
+
}, controller.signal);
|
|
185
|
+
});
|
|
208
186
|
const lastHandledTriggerRef = __rspack_external_react.useRef(null);
|
|
209
187
|
useIsoLayoutEffect(()=>{
|
|
210
|
-
if (
|
|
188
|
+
if (!open || !mounted) lastHandledTriggerRef.current = null;
|
|
189
|
+
}, [
|
|
190
|
+
open,
|
|
191
|
+
mounted
|
|
192
|
+
]);
|
|
193
|
+
useIsoLayoutEffect(()=>{
|
|
194
|
+
if (open && activeTrigger && previousActiveTrigger && activeTrigger !== previousActiveTrigger && lastHandledTriggerRef.current !== activeTrigger && capturedNodeRef.current) {
|
|
211
195
|
setPreviousContentNode(capturedNodeRef.current);
|
|
212
196
|
setShowStartingStyleAttribute(true);
|
|
213
197
|
const offset = calculateRelativePosition(previousActiveTrigger, activeTrigger);
|
|
214
198
|
setNewTriggerOffset(offset);
|
|
215
|
-
cleanupFrame.request(()=>{
|
|
216
|
-
__rspack_external_react_dom_7136dc57.flushSync(()=>{
|
|
217
|
-
setShowStartingStyleAttribute(false);
|
|
218
|
-
});
|
|
219
|
-
onAnimationsFinished(()=>{
|
|
220
|
-
setPreviousContentNode(null);
|
|
221
|
-
setPreviousContentDimensions(null);
|
|
222
|
-
capturedNodeRef.current = null;
|
|
223
|
-
});
|
|
224
|
-
});
|
|
225
199
|
lastHandledTriggerRef.current = activeTrigger;
|
|
226
200
|
}
|
|
227
201
|
}, [
|
|
202
|
+
open,
|
|
228
203
|
activeTrigger,
|
|
229
|
-
previousActiveTrigger
|
|
204
|
+
previousActiveTrigger
|
|
205
|
+
]);
|
|
206
|
+
useIsoLayoutEffect(()=>{
|
|
207
|
+
if (null == previousContentNode) return;
|
|
208
|
+
cleanupControllerRef.current?.abort();
|
|
209
|
+
setShowStartingStyleAttribute(true);
|
|
210
|
+
cleanupFrame.request(()=>{
|
|
211
|
+
__rspack_external_react_dom_7136dc57.flushSync(()=>{
|
|
212
|
+
setShowStartingStyleAttribute(false);
|
|
213
|
+
});
|
|
214
|
+
armViewportCleanup();
|
|
215
|
+
});
|
|
216
|
+
}, [
|
|
217
|
+
currentContentKey,
|
|
230
218
|
previousContentNode,
|
|
231
|
-
|
|
219
|
+
armViewportCleanup,
|
|
232
220
|
cleanupFrame
|
|
233
221
|
]);
|
|
234
222
|
useIsoLayoutEffect(()=>{
|
|
@@ -248,8 +236,8 @@ function usePopupViewport(parameters) {
|
|
|
248
236
|
ref: previousContainerRef,
|
|
249
237
|
style: {
|
|
250
238
|
...previousContentDimensions ? {
|
|
251
|
-
[
|
|
252
|
-
[
|
|
239
|
+
[popupWidth]: `${previousContentDimensions.width}px`,
|
|
240
|
+
[popupHeight]: `${previousContentDimensions.height}px`
|
|
253
241
|
} : null,
|
|
254
242
|
position: 'absolute'
|
|
255
243
|
},
|
|
@@ -343,4 +331,4 @@ function usePopupContentKey(activeTriggerId, payload) {
|
|
|
343
331
|
]);
|
|
344
332
|
return `${activeTriggerId ?? 'current'}-${contentKey}`;
|
|
345
333
|
}
|
|
346
|
-
export { usePopupViewport };
|
|
334
|
+
export { popupViewportStateMapping, usePopupViewport };
|
package/dist/5473.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function createFormatErrorMessage(baseUrl, prefix) {
|
|
2
|
+
return function(code, ...args) {
|
|
3
|
+
const url = new URL(baseUrl);
|
|
4
|
+
url.searchParams.set('code', code.toString());
|
|
5
|
+
args.forEach((arg)=>url.searchParams.append('args[]', arg));
|
|
6
|
+
return `${prefix} error #${code}; visit ${url} for the full message.`;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
const formatErrorMessage_formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');
|
|
10
|
+
const utils_formatErrorMessage = formatErrorMessage_formatErrorMessage;
|
|
11
|
+
export { utils_formatErrorMessage };
|
package/dist/{4745.js → 5490.js}
RENAMED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { lowerUserAgent } from "./70.js";
|
|
2
|
+
const jsdom = /jsdom|happydom/.test(lowerUserAgent);
|
|
1
3
|
const FOCUSABLE_ATTRIBUTE = 'data-base-ui-focusable';
|
|
2
4
|
const TYPEABLE_SELECTOR = "input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";
|
|
3
5
|
const ARROW_LEFT = 'ArrowLeft';
|
|
4
6
|
const ARROW_RIGHT = 'ArrowRight';
|
|
5
7
|
const ARROW_UP = 'ArrowUp';
|
|
6
8
|
const ARROW_DOWN = 'ArrowDown';
|
|
7
|
-
export { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR };
|
|
9
|
+
export { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, FOCUSABLE_ATTRIBUTE, TYPEABLE_SELECTOR, jsdom };
|