@wix/site-ui 1.347.0 → 1.349.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/{9369.js → 6620.js}
RENAMED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useAnimationFrame } from "./
|
|
2
|
-
import { useStableCallback } from "./
|
|
1
|
+
import { useAnimationFrame } from "./5595.js";
|
|
2
|
+
import { useStableCallback } from "./7488.js";
|
|
3
|
+
import { getFiniteAnimations } from "./9295.js";
|
|
4
|
+
import { NOOP } from "./9591.js";
|
|
3
5
|
import * as __rspack_external_react from "react";
|
|
4
6
|
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
TransitionStatusDataAttributes["endingStyle"] = "data-ending-style";
|
|
8
|
-
return TransitionStatusDataAttributes;
|
|
9
|
-
}({});
|
|
10
|
-
const STARTING_HOOK = {
|
|
11
|
-
[stateAttributesMapping_TransitionStatusDataAttributes.startingStyle]: ''
|
|
12
|
-
};
|
|
13
|
-
const ENDING_HOOK = {
|
|
14
|
-
[stateAttributesMapping_TransitionStatusDataAttributes.endingStyle]: ''
|
|
15
|
-
};
|
|
16
|
-
const transitionStatusMapping = {
|
|
17
|
-
transitionStatus (value) {
|
|
18
|
-
if ('starting' === value) return STARTING_HOOK;
|
|
19
|
-
if ('ending' === value) return ENDING_HOOK;
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
};
|
|
7
|
+
const startingStyle = 'data-starting-style';
|
|
8
|
+
const endingStyle = 'data-ending-style';
|
|
23
9
|
function resolveRef(maybeRef) {
|
|
24
10
|
if (null == maybeRef) return maybeRef;
|
|
25
11
|
return 'current' in maybeRef ? maybeRef.current : maybeRef;
|
|
26
12
|
}
|
|
27
|
-
|
|
13
|
+
let pendingCallbacks = null;
|
|
14
|
+
function flushBeforePaint(fn) {
|
|
15
|
+
if (!pendingCallbacks) {
|
|
16
|
+
const callbacks = [];
|
|
17
|
+
pendingCallbacks = callbacks;
|
|
18
|
+
queueMicrotask(()=>{
|
|
19
|
+
pendingCallbacks = null;
|
|
20
|
+
__rspack_external_react_dom_7136dc57.flushSync(()=>{
|
|
21
|
+
for (const callback of callbacks)callback();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
pendingCallbacks.push(fn);
|
|
26
|
+
}
|
|
27
|
+
function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false, batch = false) {
|
|
28
28
|
const frame = useAnimationFrame();
|
|
29
29
|
return useStableCallback((fnToExecute, signal = null)=>{
|
|
30
30
|
frame.cancel();
|
|
@@ -32,23 +32,24 @@ function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false
|
|
|
32
32
|
if (null == element) return;
|
|
33
33
|
const resolvedElement = element;
|
|
34
34
|
const done = ()=>{
|
|
35
|
-
__rspack_external_react_dom_7136dc57.flushSync(fnToExecute);
|
|
35
|
+
if (!batch) return void __rspack_external_react_dom_7136dc57.flushSync(fnToExecute);
|
|
36
|
+
flushBeforePaint(()=>{
|
|
37
|
+
if (!signal?.aborted) fnToExecute();
|
|
38
|
+
});
|
|
36
39
|
};
|
|
37
40
|
if ('function' != typeof resolvedElement.getAnimations || globalThis.BASE_UI_ANIMATIONS_DISABLED) return void fnToExecute();
|
|
38
41
|
function exec() {
|
|
39
|
-
Promise.all(resolvedElement
|
|
42
|
+
Promise.all(getFiniteAnimations(resolvedElement).map((animation)=>animation.finished.then(NOOP))).then(()=>{
|
|
40
43
|
if (!signal?.aborted) done();
|
|
41
|
-
}
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const currentAnimations = resolvedElement.getAnimations();
|
|
47
|
-
if (!signal?.aborted && currentAnimations.length > 0 && currentAnimations.some((animation)=>animation.pending || 'finished' !== animation.playState)) exec();
|
|
44
|
+
}, ()=>{
|
|
45
|
+
if (signal?.aborted) return;
|
|
46
|
+
const currentAnimations = getFiniteAnimations(resolvedElement);
|
|
47
|
+
if (currentAnimations.some((animation)=>animation.pending || 'finished' !== animation.playState)) return void exec();
|
|
48
|
+
done();
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
if (waitForStartingStyleRemoved) {
|
|
51
|
-
const startingStyleAttribute =
|
|
52
|
+
const startingStyleAttribute = startingStyle;
|
|
52
53
|
if (!resolvedElement.hasAttribute(startingStyleAttribute)) return void frame.request(exec);
|
|
53
54
|
const attributeObserver = new MutationObserver(()=>{
|
|
54
55
|
if (!resolvedElement.hasAttribute(startingStyleAttribute)) {
|
|
@@ -71,9 +72,9 @@ function useAnimationsFinished(elementOrRef, waitForStartingStyleRemoved = false
|
|
|
71
72
|
});
|
|
72
73
|
}
|
|
73
74
|
function useOpenChangeComplete(parameters) {
|
|
74
|
-
const { enabled = true, open, ref, onComplete: onCompleteParam } = parameters;
|
|
75
|
+
const { enabled = true, open, ref, batch = false, onComplete: onCompleteParam } = parameters;
|
|
75
76
|
const onComplete = useStableCallback(onCompleteParam);
|
|
76
|
-
const runOnceAnimationsFinish = useAnimationsFinished(ref, open,
|
|
77
|
+
const runOnceAnimationsFinish = useAnimationsFinished(ref, open, batch);
|
|
77
78
|
__rspack_external_react.useEffect(()=>{
|
|
78
79
|
if (!enabled) return;
|
|
79
80
|
const abortController = new AbortController();
|
|
@@ -88,4 +89,4 @@ function useOpenChangeComplete(parameters) {
|
|
|
88
89
|
runOnceAnimationsFinish
|
|
89
90
|
]);
|
|
90
91
|
}
|
|
91
|
-
export {
|
|
92
|
+
export { endingStyle, resolveRef, startingStyle, useAnimationsFinished, useOpenChangeComplete };
|
package/dist/{4143.js → 6838.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useLabelableContext } from "./
|
|
2
|
-
import { useStableCallback } from "./
|
|
3
|
-
import { useRegisteredLabelId } from "./
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { useLabelableContext } from "./201.js";
|
|
2
|
+
import { useStableCallback } from "./7488.js";
|
|
3
|
+
import { useRegisteredLabelId } from "./1093.js";
|
|
4
|
+
import { isShadowRoot, isHTMLElement } from "./3829.js";
|
|
5
|
+
import { getTarget, closest } from "./4155.js";
|
|
6
|
+
import { ownerDocument } from "./6488.js";
|
|
7
7
|
function useLabel(params = {}) {
|
|
8
8
|
const { id: idProp, fallbackControlId, native = false, setLabelId: setLabelIdProp, focusControl: focusControlProp } = params;
|
|
9
9
|
const { controlId: contextControlId, setLabelId: setContextLabelId } = useLabelableContext();
|
|
@@ -16,19 +16,19 @@ function useLabel(params = {}) {
|
|
|
16
16
|
function focusControl(event) {
|
|
17
17
|
if (focusControlProp) return void focusControlProp(event, resolvedControlId);
|
|
18
18
|
if (!resolvedControlId) return;
|
|
19
|
-
const controlElement =
|
|
19
|
+
const controlElement = getControlById(event.currentTarget, resolvedControlId);
|
|
20
20
|
if (isHTMLElement(controlElement)) focusElementWithVisible(controlElement);
|
|
21
21
|
}
|
|
22
22
|
function handleInteraction(event) {
|
|
23
23
|
const target = getTarget(event.nativeEvent);
|
|
24
|
-
if (
|
|
24
|
+
if (closest(target, 'button,input,select,textarea')) return;
|
|
25
25
|
if (!event.defaultPrevented && event.detail > 1) event.preventDefault();
|
|
26
26
|
if (native) return;
|
|
27
27
|
focusControl(event);
|
|
28
28
|
}
|
|
29
29
|
return native ? {
|
|
30
30
|
id,
|
|
31
|
-
htmlFor: resolvedControlId
|
|
31
|
+
htmlFor: resolvedControlId,
|
|
32
32
|
onMouseDown: handleInteraction
|
|
33
33
|
} : {
|
|
34
34
|
id,
|
|
@@ -38,9 +38,18 @@ function useLabel(params = {}) {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
+
function getControlById(label, id) {
|
|
42
|
+
let root = label.getRootNode();
|
|
43
|
+
while(isShadowRoot(root)){
|
|
44
|
+
const element = root.getElementById(id);
|
|
45
|
+
if (element) return element;
|
|
46
|
+
root = root.host.getRootNode();
|
|
47
|
+
}
|
|
48
|
+
return ownerDocument(label).getElementById(id);
|
|
49
|
+
}
|
|
41
50
|
function focusElementWithVisible(element) {
|
|
42
51
|
element.focus({
|
|
43
52
|
focusVisible: true
|
|
44
53
|
});
|
|
45
54
|
}
|
|
46
|
-
export { focusElementWithVisible, useLabel };
|
|
55
|
+
export { focusElementWithVisible, getControlById, useLabel };
|
package/dist/6902.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useId } from "./4989.js";
|
|
2
|
+
import { useFloatingParentNodeId } from "./4472.js";
|
|
3
|
+
import { isElement } from "./3829.js";
|
|
4
|
+
import { useRefWithInit } from "./9591.js";
|
|
5
|
+
import { PopupTriggerMap, FloatingRootStore } from "./4346.js";
|
|
6
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
7
|
+
function useFloatingRootContext(options) {
|
|
8
|
+
const { open = false, onOpenChange, elements = {} } = options;
|
|
9
|
+
const floatingId = useId();
|
|
10
|
+
const nested = null != useFloatingParentNodeId();
|
|
11
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
12
|
+
const optionDomReference = elements.reference;
|
|
13
|
+
if (optionDomReference && !isElement(optionDomReference)) console.error('Cannot pass a virtual element to the `elements.reference` option,', 'as it must be a real DOM element. Use `context.setPositionReference()`', 'instead.');
|
|
14
|
+
}
|
|
15
|
+
const store = useRefWithInit(()=>new FloatingRootStore({
|
|
16
|
+
open,
|
|
17
|
+
transitionStatus: void 0,
|
|
18
|
+
onOpenChange,
|
|
19
|
+
referenceElement: elements.reference ?? null,
|
|
20
|
+
floatingElement: elements.floating ?? null,
|
|
21
|
+
triggerElements: new PopupTriggerMap(),
|
|
22
|
+
floatingId,
|
|
23
|
+
syncOnly: false,
|
|
24
|
+
nested
|
|
25
|
+
})).current;
|
|
26
|
+
useIsoLayoutEffect(()=>{
|
|
27
|
+
const valuesToSync = {
|
|
28
|
+
open,
|
|
29
|
+
floatingId
|
|
30
|
+
};
|
|
31
|
+
if (void 0 !== elements.reference) {
|
|
32
|
+
valuesToSync.referenceElement = elements.reference;
|
|
33
|
+
valuesToSync.domReferenceElement = isElement(elements.reference) ? elements.reference : null;
|
|
34
|
+
}
|
|
35
|
+
if (void 0 !== elements.floating) valuesToSync.floatingElement = elements.floating;
|
|
36
|
+
store.update(valuesToSync);
|
|
37
|
+
}, [
|
|
38
|
+
open,
|
|
39
|
+
floatingId,
|
|
40
|
+
elements.reference,
|
|
41
|
+
elements.floating,
|
|
42
|
+
store
|
|
43
|
+
]);
|
|
44
|
+
store.context.onOpenChange = onOpenChange;
|
|
45
|
+
store.context.nested = nested;
|
|
46
|
+
return store;
|
|
47
|
+
}
|
|
48
|
+
export { useFloatingRootContext };
|
package/dist/6904.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { endingStyle as TransitionStatusDataAttributes_endingStyle, startingStyle as TransitionStatusDataAttributes_startingStyle } from "./6620.js";
|
|
2
|
+
import { pressed, popupOpen } from "./6137.js";
|
|
3
|
+
import { transitionStatusMapping } from "./8488.js";
|
|
4
|
+
const CommonPopupDataAttributes_open = 'data-open';
|
|
5
|
+
const CommonPopupDataAttributes_closed = 'data-closed';
|
|
6
|
+
const startingStyle = TransitionStatusDataAttributes_startingStyle;
|
|
7
|
+
const endingStyle = TransitionStatusDataAttributes_endingStyle;
|
|
8
|
+
const anchorHidden = 'data-anchor-hidden';
|
|
9
|
+
const TRIGGER_HOOK = {
|
|
10
|
+
[popupOpen]: ''
|
|
11
|
+
};
|
|
12
|
+
const PRESSABLE_TRIGGER_HOOK = {
|
|
13
|
+
[popupOpen]: '',
|
|
14
|
+
[pressed]: ''
|
|
15
|
+
};
|
|
16
|
+
const POPUP_OPEN_HOOK = {
|
|
17
|
+
[CommonPopupDataAttributes_open]: ''
|
|
18
|
+
};
|
|
19
|
+
const POPUP_CLOSED_HOOK = {
|
|
20
|
+
[CommonPopupDataAttributes_closed]: ''
|
|
21
|
+
};
|
|
22
|
+
const ANCHOR_HIDDEN_HOOK = {
|
|
23
|
+
[anchorHidden]: ''
|
|
24
|
+
};
|
|
25
|
+
const triggerOpenStateMapping = {
|
|
26
|
+
open (value) {
|
|
27
|
+
if (value) return TRIGGER_HOOK;
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const pressableTriggerOpenStateMapping = {
|
|
32
|
+
open (value) {
|
|
33
|
+
if (value) return PRESSABLE_TRIGGER_HOOK;
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const popupStateMapping = {
|
|
38
|
+
open (value) {
|
|
39
|
+
if (value) return POPUP_OPEN_HOOK;
|
|
40
|
+
return POPUP_CLOSED_HOOK;
|
|
41
|
+
},
|
|
42
|
+
anchorHidden (value) {
|
|
43
|
+
if (value) return ANCHOR_HIDDEN_HOOK;
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
const popupTransitionStateMapping = {
|
|
48
|
+
...popupStateMapping,
|
|
49
|
+
...transitionStatusMapping
|
|
50
|
+
};
|
|
51
|
+
export { CommonPopupDataAttributes_closed, CommonPopupDataAttributes_open, endingStyle, popupStateMapping, popupTransitionStateMapping, pressableTriggerOpenStateMapping, startingStyle, triggerOpenStateMapping };
|
package/dist/70.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function readRawData() {
|
|
2
|
+
if ("u" < typeof navigator) return {
|
|
3
|
+
userAgent: '',
|
|
4
|
+
platform: '',
|
|
5
|
+
maxTouchPoints: 0
|
|
6
|
+
};
|
|
7
|
+
if ('production' !== process.env.NODE_ENV) {
|
|
8
|
+
const uaData = navigator.userAgentData;
|
|
9
|
+
if (uaData && Array.isArray(uaData.brands)) return {
|
|
10
|
+
userAgent: uaData.brands.map(({ brand, version })=>`${brand}/${version}`).join(' '),
|
|
11
|
+
platform: uaData.platform ?? navigator.platform ?? '',
|
|
12
|
+
maxTouchPoints: navigator.maxTouchPoints ?? 0
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
userAgent: navigator.userAgent,
|
|
17
|
+
platform: navigator.platform ?? '',
|
|
18
|
+
maxTouchPoints: navigator.maxTouchPoints ?? 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const { userAgent: userAgent, platform: platform, maxTouchPoints: maxTouchPoints } = readRawData();
|
|
22
|
+
const lowerUserAgent = userAgent.toLowerCase();
|
|
23
|
+
const lowerPlatform = platform.toLowerCase();
|
|
24
|
+
export { lowerPlatform, lowerUserAgent, maxTouchPoints };
|
package/dist/7024.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { useAnimationsFinished } from "./6620.js";
|
|
2
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
3
|
+
import * as __rspack_external_react from "react";
|
|
4
|
+
function useTriggerSwitchTransition(parameters) {
|
|
5
|
+
const { store, domReference, positionerElement, open } = parameters;
|
|
6
|
+
const previousTriggerRef = __rspack_external_react.useRef(null);
|
|
7
|
+
const pendingSwitchRef = __rspack_external_react.useRef(null);
|
|
8
|
+
const runOnceAnimationsFinish = useAnimationsFinished(positionerElement);
|
|
9
|
+
useIsoLayoutEffect(()=>{
|
|
10
|
+
if (open) return;
|
|
11
|
+
pendingSwitchRef.current?.abort();
|
|
12
|
+
pendingSwitchRef.current = null;
|
|
13
|
+
if ('trigger-change' === store.state.instantType) store.set('instantType', void 0);
|
|
14
|
+
}, [
|
|
15
|
+
open,
|
|
16
|
+
store
|
|
17
|
+
]);
|
|
18
|
+
useIsoLayoutEffect(()=>{
|
|
19
|
+
const currentTrigger = domReference;
|
|
20
|
+
const previousTrigger = previousTriggerRef.current;
|
|
21
|
+
if (currentTrigger) previousTriggerRef.current = currentTrigger;
|
|
22
|
+
if (!previousTrigger || !currentTrigger || currentTrigger === previousTrigger) return;
|
|
23
|
+
if (!store.select('open')) return;
|
|
24
|
+
store.set('instantType', void 0);
|
|
25
|
+
const abortController = new AbortController();
|
|
26
|
+
pendingSwitchRef.current = abortController;
|
|
27
|
+
runOnceAnimationsFinish(()=>{
|
|
28
|
+
if (store.select('open')) store.set('instantType', 'trigger-change');
|
|
29
|
+
}, abortController.signal);
|
|
30
|
+
return ()=>{
|
|
31
|
+
abortController.abort();
|
|
32
|
+
};
|
|
33
|
+
}, [
|
|
34
|
+
domReference,
|
|
35
|
+
runOnceAnimationsFinish,
|
|
36
|
+
store
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
export { useTriggerSwitchTransition };
|