@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/{951.js → 7270.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EMPTY_ARRAY, useRenderElement, EMPTY_OBJECT } from "./
|
|
2
|
-
import { useCompositeItem } from "./
|
|
1
|
+
import { EMPTY_ARRAY, useRenderElement, EMPTY_OBJECT } from "./9591.js";
|
|
2
|
+
import { useCompositeItem } from "./9053.js";
|
|
3
3
|
function CompositeItem(componentProps) {
|
|
4
4
|
const { render, className, style, state = EMPTY_OBJECT, props = EMPTY_ARRAY, refs = EMPTY_ARRAY, metadata, stateAttributesMapping, tag = 'div', ...elementProps } = componentProps;
|
|
5
5
|
const { compositeProps, compositeRef } = useCompositeItem({
|
|
@@ -8,8 +8,8 @@ function CompositeItem(componentProps) {
|
|
|
8
8
|
return useRenderElement(tag, componentProps, {
|
|
9
9
|
state,
|
|
10
10
|
ref: [
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
compositeRef,
|
|
12
|
+
...refs
|
|
13
13
|
],
|
|
14
14
|
props: [
|
|
15
15
|
compositeProps,
|
package/dist/{3485.js → 7323.js}
RENAMED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useMergedRefs, NOOP } from "./
|
|
2
|
+
import { useMergedRefs, NOOP } from "./9591.js";
|
|
3
3
|
import { getWindow, isOverflowElement, getNodeName, isShadowRoot, isHTMLElement } from "./3829.js";
|
|
4
|
-
import { ownerDocument } from "./
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { addEventListener } from "./
|
|
15
|
-
import { mergeCleanups } from "./
|
|
16
|
-
import { createAttribute } from "./
|
|
17
|
-
import { resolveRef } from "./
|
|
18
|
-
import { getNodeChildren, getNodeAncestors } from "./
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { useValueChanged } from "./
|
|
4
|
+
import { ownerDocument } from "./6488.js";
|
|
5
|
+
import { contains, activeElement, getTarget, closest } from "./4155.js";
|
|
6
|
+
import { stopEvent, isVirtualPointerEvent, isElementVisible, isVirtualClick } from "./8358.js";
|
|
7
|
+
import { CLICK_TRIGGER_IDENTIFIER, FocusGuard_FocusGuard, focusable, getPreviousTabbable, isTabbable, isOutsideEvent, tabbable, usePortalContext, getNextTabbable } from "./3398.js";
|
|
8
|
+
import { useStableCallback } from "./7488.js";
|
|
9
|
+
import { getFloatingFocusElement, isTypeableCombobox, isTypeableElement } from "./6137.js";
|
|
10
|
+
import { useValueAsRef } from "./7930.js";
|
|
11
|
+
import { useFloatingTree } from "./4472.js";
|
|
12
|
+
import { Timeout, useTimeout } from "./9197.js";
|
|
13
|
+
import { useAnimationFrame, AnimationFrame } from "./5595.js";
|
|
14
|
+
import { addEventListener } from "./1282.js";
|
|
15
|
+
import { mergeCleanups } from "./7718.js";
|
|
16
|
+
import { createAttribute } from "./226.js";
|
|
17
|
+
import { resolveRef } from "./6620.js";
|
|
18
|
+
import { getNodeChildren, getNodeAncestors } from "./4346.js";
|
|
19
|
+
import { createChangeEventDetails } from "./8495.js";
|
|
20
|
+
import { focusOut, triggerHover, outsidePress } from "./9837.js";
|
|
21
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
22
|
+
import { webkit } from "./3189.js";
|
|
23
|
+
import { ios } from "./2221.js";
|
|
24
|
+
import { useValueChanged } from "./9252.js";
|
|
25
25
|
import * as __rspack_external_react from "react";
|
|
26
26
|
let rafId = 0;
|
|
27
27
|
function enqueueFocus(el, options = {}) {
|
|
@@ -46,20 +46,11 @@ function enqueueFocus(el, options = {}) {
|
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
const counters = {
|
|
50
|
-
inert: new WeakMap(),
|
|
51
|
-
'aria-hidden': new WeakMap()
|
|
52
|
-
};
|
|
53
49
|
const markerName = 'data-base-ui-inert';
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
'aria-hidden': new WeakSet()
|
|
57
|
-
};
|
|
50
|
+
let ariaHiddenCounterMap = new WeakMap();
|
|
51
|
+
let uncontrolledElementsSet = new WeakSet();
|
|
58
52
|
let markerCounterMap = new WeakMap();
|
|
59
53
|
let lockCount = 0;
|
|
60
|
-
function getUncontrolledElementsSet(controlAttribute) {
|
|
61
|
-
return uncontrolledElementsSets[controlAttribute];
|
|
62
|
-
}
|
|
63
54
|
function unwrapHost(node) {
|
|
64
55
|
if (!node) return null;
|
|
65
56
|
return isShadowRoot(node) ? node.host : unwrapHost(node.parentNode);
|
|
@@ -94,32 +85,23 @@ const collectOutsideElements = (root, keepElements, stopElements)=>{
|
|
|
94
85
|
walk(root);
|
|
95
86
|
return outside;
|
|
96
87
|
};
|
|
97
|
-
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden,
|
|
98
|
-
const controlAttribute = inert ? 'inert' : ariaHidden ? 'aria-hidden' : null;
|
|
99
|
-
let counterMap = null;
|
|
100
|
-
let uncontrolledElementsSet = null;
|
|
88
|
+
function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, { mark = true }) {
|
|
101
89
|
const avoidElements = correctElements(body, uncorrectedAvoidElements);
|
|
102
|
-
const
|
|
103
|
-
const markerIgnoreSet = new Set(markerIgnoreTargets);
|
|
104
|
-
const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)).filter((target)=>!markerIgnoreSet.has(target)) : [];
|
|
90
|
+
const markerTargets = mark ? collectOutsideElements(body, buildKeepSet(avoidElements), new Set(avoidElements)) : [];
|
|
105
91
|
const hiddenElements = [];
|
|
106
92
|
const markedElements = [];
|
|
107
|
-
if (
|
|
108
|
-
const map = counters[controlAttribute];
|
|
109
|
-
const currentUncontrolledElementsSet = getUncontrolledElementsSet(controlAttribute);
|
|
110
|
-
uncontrolledElementsSet = currentUncontrolledElementsSet;
|
|
111
|
-
counterMap = map;
|
|
93
|
+
if (ariaHidden) {
|
|
112
94
|
const ariaLiveElements = correctElements(body, Array.from(body.querySelectorAll('[aria-live]')));
|
|
113
95
|
const controlElements = avoidElements.concat(ariaLiveElements);
|
|
114
96
|
const controlTargets = collectOutsideElements(body, buildKeepSet(controlElements), new Set(controlElements));
|
|
115
97
|
controlTargets.forEach((node)=>{
|
|
116
|
-
const attr = node.getAttribute(
|
|
98
|
+
const attr = node.getAttribute('aria-hidden');
|
|
117
99
|
const alreadyHidden = null !== attr && 'false' !== attr;
|
|
118
|
-
const counterValue = (
|
|
119
|
-
|
|
100
|
+
const counterValue = (ariaHiddenCounterMap.get(node) || 0) + 1;
|
|
101
|
+
ariaHiddenCounterMap.set(node, counterValue);
|
|
120
102
|
hiddenElements.push(node);
|
|
121
|
-
if (1 === counterValue && alreadyHidden)
|
|
122
|
-
if (!alreadyHidden) node.setAttribute(
|
|
103
|
+
if (1 === counterValue && alreadyHidden) uncontrolledElementsSet.add(node);
|
|
104
|
+
if (!alreadyHidden) node.setAttribute('aria-hidden', 'true');
|
|
123
105
|
});
|
|
124
106
|
}
|
|
125
107
|
if (mark) markerTargets.forEach((node)=>{
|
|
@@ -130,13 +112,12 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner
|
|
|
130
112
|
});
|
|
131
113
|
lockCount += 1;
|
|
132
114
|
return ()=>{
|
|
133
|
-
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
-
counterMap.set(element, counterValue);
|
|
115
|
+
hiddenElements.forEach((element)=>{
|
|
116
|
+
const counterValue = (ariaHiddenCounterMap.get(element) || 0) - 1;
|
|
117
|
+
ariaHiddenCounterMap.set(element, counterValue);
|
|
137
118
|
if (!counterValue) {
|
|
138
|
-
if (!uncontrolledElementsSet
|
|
139
|
-
uncontrolledElementsSet
|
|
119
|
+
if (!uncontrolledElementsSet.has(element)) element.removeAttribute('aria-hidden');
|
|
120
|
+
uncontrolledElementsSet.delete(element);
|
|
140
121
|
}
|
|
141
122
|
});
|
|
142
123
|
if (mark) markedElements.forEach((element)=>{
|
|
@@ -146,27 +127,24 @@ function applyAttributeToOthers(uncorrectedAvoidElements, body, ariaHidden, iner
|
|
|
146
127
|
});
|
|
147
128
|
lockCount -= 1;
|
|
148
129
|
if (!lockCount) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
uncontrolledElementsSets.inert = new WeakSet();
|
|
152
|
-
uncontrolledElementsSets['aria-hidden'] = new WeakSet();
|
|
130
|
+
ariaHiddenCounterMap = new WeakMap();
|
|
131
|
+
uncontrolledElementsSet = new WeakSet();
|
|
153
132
|
markerCounterMap = new WeakMap();
|
|
154
133
|
}
|
|
155
134
|
};
|
|
156
135
|
}
|
|
157
136
|
function markOthers(avoidElements, options = {}) {
|
|
158
|
-
const { ariaHidden = false,
|
|
137
|
+
const { ariaHidden = false, mark = true } = options;
|
|
159
138
|
const body = ownerDocument(avoidElements[0]).body;
|
|
160
|
-
return applyAttributeToOthers(avoidElements, body, ariaHidden,
|
|
161
|
-
mark
|
|
162
|
-
markerIgnoreElements
|
|
139
|
+
return applyAttributeToOthers(avoidElements, body, ariaHidden, {
|
|
140
|
+
mark
|
|
163
141
|
});
|
|
164
142
|
}
|
|
165
143
|
function getEventType(event, lastInteractionType) {
|
|
166
144
|
const win = getWindow(getTarget(event));
|
|
167
145
|
if (event instanceof win.KeyboardEvent) return 'keyboard';
|
|
168
146
|
if (event instanceof win.FocusEvent) return lastInteractionType || 'keyboard';
|
|
169
|
-
if ('pointerType' in event) return event.pointerType || 'keyboard';
|
|
147
|
+
if ('pointerType' in event) return event.pointerType || (isVirtualClick(event) ? 'keyboard' : lastInteractionType || 'mouse');
|
|
170
148
|
if ('touches' in event) return 'touch';
|
|
171
149
|
if (event instanceof win.MouseEvent) return lastInteractionType || (0 === event.detail ? 'keyboard' : 'mouse');
|
|
172
150
|
return '';
|
|
@@ -192,25 +170,27 @@ function getFirstTabbableElement(container) {
|
|
|
192
170
|
if (isTabbable(container)) return container;
|
|
193
171
|
return tabbable(container)[0] || container;
|
|
194
172
|
}
|
|
195
|
-
function handleTabIndex(floatingFocusElement
|
|
173
|
+
function handleTabIndex(floatingFocusElement) {
|
|
196
174
|
if (floatingFocusElement.hasAttribute('tabindex') && !floatingFocusElement.hasAttribute('data-tabindex')) return;
|
|
197
|
-
if (!
|
|
175
|
+
if (!floatingFocusElement.getAttribute('role')?.includes('dialog')) return;
|
|
198
176
|
const focusableElements = focusable(floatingFocusElement);
|
|
199
177
|
const tabbableContent = focusableElements.filter((element)=>{
|
|
200
178
|
const dataTabIndex = element.getAttribute('data-tabindex') || '';
|
|
201
179
|
return isTabbable(element) || element.hasAttribute('data-tabindex') && !dataTabIndex.startsWith('-');
|
|
202
180
|
});
|
|
203
181
|
const tabIndex = floatingFocusElement.getAttribute('tabindex');
|
|
204
|
-
if (
|
|
205
|
-
if ('0' !== tabIndex)
|
|
182
|
+
if (0 === tabbableContent.length) {
|
|
183
|
+
if ('0' !== tabIndex) {
|
|
184
|
+
floatingFocusElement.setAttribute('tabindex', '0');
|
|
185
|
+
floatingFocusElement.setAttribute('data-tabindex', '0');
|
|
186
|
+
}
|
|
206
187
|
} else if ('-1' !== tabIndex || floatingFocusElement.hasAttribute('data-tabindex') && '-1' !== floatingFocusElement.getAttribute('data-tabindex')) {
|
|
207
188
|
floatingFocusElement.setAttribute('tabindex', '-1');
|
|
208
189
|
floatingFocusElement.setAttribute('data-tabindex', '-1');
|
|
209
190
|
}
|
|
210
191
|
}
|
|
211
192
|
function FloatingFocusManager(props) {
|
|
212
|
-
const { context, children, disabled = false, initialFocus = true, returnFocus = true, restoreFocus = false, modal = true, closeOnFocusOut = true, openInteractionType = '', nextFocusableElement, previousFocusableElement, beforeContentFocusGuardRef, externalTree, getInsideElements } = props;
|
|
213
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
193
|
+
const { context: store, children, disabled = false, initialFocus = true, returnFocus = true, explicitReturnFocus, restoreFocus = false, modal = true, closeOnFocusOut = true, openInteractionType = '', nextFocusableElement, previousFocusableElement, beforeContentFocusGuardRef, externalTree, getInsideElements } = props;
|
|
214
194
|
const open = store.useState('open');
|
|
215
195
|
const domReference = store.useState('domReferenceElement');
|
|
216
196
|
const floating = store.useState('floatingElement');
|
|
@@ -218,12 +198,11 @@ function FloatingFocusManager(props) {
|
|
|
218
198
|
const getNodeId = useStableCallback(()=>dataRef.current.floatingContext?.nodeId);
|
|
219
199
|
const ignoreInitialFocus = false === initialFocus;
|
|
220
200
|
const isUntrappedTypeableCombobox = isTypeableCombobox(domReference) && ignoreInitialFocus;
|
|
221
|
-
const orderRef = __rspack_external_react.useRef([
|
|
222
|
-
'content'
|
|
223
|
-
]);
|
|
224
201
|
const initialFocusRef = useValueAsRef(initialFocus);
|
|
225
202
|
const returnFocusRef = useValueAsRef(returnFocus);
|
|
203
|
+
const explicitReturnFocusRef = useValueAsRef(explicitReturnFocus);
|
|
226
204
|
const openInteractionTypeRef = useValueAsRef(openInteractionType);
|
|
205
|
+
const openRef = useValueAsRef(open);
|
|
227
206
|
const tree = useFloatingTree(externalTree);
|
|
228
207
|
const portalContext = usePortalContext();
|
|
229
208
|
const preventReturnFocusRef = __rspack_external_react.useRef(false);
|
|
@@ -271,12 +250,17 @@ function FloatingFocusManager(props) {
|
|
|
271
250
|
const pointerTargetInside = contains(floating, target) || contains(domReference, target) || contains(portalContext?.portalNode, target) || insideElements.some((element)=>element === target || contains(element, target));
|
|
272
251
|
pointerDownOutsideRef.current = !pointerTargetInside;
|
|
273
252
|
lastInteractionTypeRef.current = event.pointerType || 'keyboard';
|
|
274
|
-
if (
|
|
253
|
+
if (closest(target, `[${CLICK_TRIGGER_IDENTIFIER}]`)) {
|
|
254
|
+
isPointerDownRef.current = true;
|
|
255
|
+
pointerDownTimeout.start(0, ()=>{
|
|
256
|
+
isPointerDownRef.current = false;
|
|
257
|
+
});
|
|
258
|
+
}
|
|
275
259
|
}
|
|
276
260
|
function onKeyDown() {
|
|
277
261
|
lastInteractionTypeRef.current = 'keyboard';
|
|
278
262
|
}
|
|
279
|
-
return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true));
|
|
263
|
+
return mergeCleanups(addEventListener(doc, 'pointerdown', onPointerDown, true), addEventListener(doc, 'pointerup', clearPointerDownOutside, true), addEventListener(doc, 'pointercancel', clearPointerDownOutside, true), addEventListener(doc, 'keydown', onKeyDown, true), clearPointerDownOutside);
|
|
280
264
|
}, [
|
|
281
265
|
disabled,
|
|
282
266
|
floating,
|
|
@@ -284,6 +268,7 @@ function FloatingFocusManager(props) {
|
|
|
284
268
|
floatingFocusElement,
|
|
285
269
|
open,
|
|
286
270
|
portalContext,
|
|
271
|
+
pointerDownTimeout,
|
|
287
272
|
getResolvedInsideElements
|
|
288
273
|
]);
|
|
289
274
|
__rspack_external_react.useEffect(()=>{
|
|
@@ -303,6 +288,7 @@ function FloatingFocusManager(props) {
|
|
|
303
288
|
const relatedTarget = event.relatedTarget;
|
|
304
289
|
const currentTarget = event.currentTarget;
|
|
305
290
|
const target = getTarget(event);
|
|
291
|
+
if (modal && null == relatedTarget && null != target && contains(floating, target)) addPreviouslyFocusedElement(target);
|
|
306
292
|
queueMicrotask(()=>{
|
|
307
293
|
const nodeId = getNodeId();
|
|
308
294
|
const triggers = store.context.triggerElements;
|
|
@@ -317,11 +303,11 @@ function FloatingFocusManager(props) {
|
|
|
317
303
|
resolveRef(previousFocusableElement),
|
|
318
304
|
resolveRef(nextFocusableElement)
|
|
319
305
|
].includes(relatedTarget);
|
|
320
|
-
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element)=>element === relatedTarget || contains(element, relatedTarget)) ||
|
|
306
|
+
const movedToUnrelatedNode = !(contains(domReference, relatedTarget) || contains(floating, relatedTarget) || contains(relatedTarget, floating) || contains(portalContext?.portalNode, relatedTarget) || insideElements.some((element)=>element === relatedTarget || contains(element, relatedTarget)) || triggers.hasMatchingElement((trigger)=>contains(trigger, relatedTarget)) || isRelatedFocusGuard || tree && (getNodeChildren(tree.nodesRef.current, nodeId).find((node)=>contains(node.context?.elements.floating, relatedTarget) || contains(node.context?.elements.domReference, relatedTarget)) || getNodeAncestors(tree.nodesRef.current, nodeId).find((node)=>[
|
|
321
307
|
node.context?.elements.floating,
|
|
322
308
|
getFloatingFocusElement(node.context?.elements.floating)
|
|
323
309
|
].includes(relatedTarget) || node.context?.elements.domReference === relatedTarget)));
|
|
324
|
-
if (currentTarget === domReference && floatingFocusElement) handleTabIndex(floatingFocusElement
|
|
310
|
+
if (currentTarget === domReference && floatingFocusElement) handleTabIndex(floatingFocusElement);
|
|
325
311
|
if (restoreFocus && currentTarget !== domReference && !isElementVisible(target) && activeElement(doc) === doc.body) {
|
|
326
312
|
if (isHTMLElement(floatingFocusElement)) {
|
|
327
313
|
floatingFocusElement.focus();
|
|
@@ -368,7 +354,6 @@ function FloatingFocusManager(props) {
|
|
|
368
354
|
getTabbableContent,
|
|
369
355
|
isUntrappedTypeableCombobox,
|
|
370
356
|
getNodeId,
|
|
371
|
-
orderRef,
|
|
372
357
|
dataRef,
|
|
373
358
|
blurTimeout,
|
|
374
359
|
pointerDownTimeout,
|
|
@@ -427,6 +412,8 @@ function FloatingFocusManager(props) {
|
|
|
427
412
|
]);
|
|
428
413
|
useIsoLayoutEffect(()=>{
|
|
429
414
|
if (!open || disabled || !isHTMLElement(floatingFocusElement)) return;
|
|
415
|
+
closeTypeRef.current = '';
|
|
416
|
+
lastInteractionTypeRef.current = '';
|
|
430
417
|
const doc = ownerDocument(floatingFocusElement);
|
|
431
418
|
const previouslyFocusedElement = activeElement(doc);
|
|
432
419
|
queueMicrotask(()=>{
|
|
@@ -444,9 +431,13 @@ function FloatingFocusManager(props) {
|
|
|
444
431
|
elToFocus = true === resolvedInitialFocus || null === resolvedInitialFocus ? getDefaultFocusElement() : resolveRef(resolvedInitialFocus);
|
|
445
432
|
elToFocus = elToFocus || getDefaultFocusElement();
|
|
446
433
|
const hadFocusInside = contains(floatingFocusElement, activeElement(doc));
|
|
434
|
+
const openEvent = dataRef.current.openEvent;
|
|
435
|
+
const openedByVirtualPress = openEvent?.type === 'mousedown' && isVirtualClick(openEvent);
|
|
447
436
|
enqueueFocus(elToFocus, {
|
|
437
|
+
sync: openedByVirtualPress,
|
|
448
438
|
preventScroll: elToFocus === floatingFocusElement,
|
|
449
439
|
shouldFocus () {
|
|
440
|
+
if (!openRef.current) return false;
|
|
450
441
|
if (hadFocusInside) return true;
|
|
451
442
|
const currentActiveElement = activeElement(doc);
|
|
452
443
|
const focusMovedInside = currentActiveElement !== elToFocus && contains(floatingFocusElement, currentActiveElement);
|
|
@@ -460,16 +451,27 @@ function FloatingFocusManager(props) {
|
|
|
460
451
|
floatingFocusElement,
|
|
461
452
|
getTabbableContent,
|
|
462
453
|
initialFocusRef,
|
|
463
|
-
openInteractionTypeRef
|
|
454
|
+
openInteractionTypeRef,
|
|
455
|
+
openRef,
|
|
456
|
+
dataRef
|
|
464
457
|
]);
|
|
458
|
+
const pendingReturnFocusRef = __rspack_external_react.useRef(null);
|
|
465
459
|
useIsoLayoutEffect(()=>{
|
|
466
|
-
if (disabled || !floatingFocusElement)
|
|
460
|
+
if (disabled || !floatingFocusElement) {
|
|
461
|
+
pendingReturnFocusRef.current = null;
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
if (pendingReturnFocusRef.current) {
|
|
465
|
+
pendingReturnFocusRef.current.cancelled = true;
|
|
466
|
+
pendingReturnFocusRef.current = null;
|
|
467
|
+
}
|
|
467
468
|
const doc = ownerDocument(floatingFocusElement);
|
|
468
|
-
const
|
|
469
|
-
|
|
469
|
+
const elementFocusedBeforeOpen = activeElement(doc);
|
|
470
|
+
const preferPreviousFocus = null == openInteractionTypeRef.current;
|
|
471
|
+
addPreviouslyFocusedElement(elementFocusedBeforeOpen);
|
|
470
472
|
function onOpenChangeLocal(details) {
|
|
471
473
|
if (!details.open) closeTypeRef.current = getEventType(details.nativeEvent, lastInteractionTypeRef.current);
|
|
472
|
-
if (details.reason === triggerHover && 'mouseleave' === details.nativeEvent.type) preventReturnFocusRef.current = true;
|
|
474
|
+
if (details.reason === focusOut && details.triggerElement?.hasAttribute(createAttribute('focus-guard')) || details.reason === triggerHover && 'mouseleave' === details.nativeEvent.type) preventReturnFocusRef.current = true;
|
|
473
475
|
if (details.reason !== outsidePress) return;
|
|
474
476
|
if (details.nested) preventReturnFocusRef.current = false;
|
|
475
477
|
else if (isVirtualClick(details.nativeEvent) || isVirtualPointerEvent(details.nativeEvent)) preventReturnFocusRef.current = false;
|
|
@@ -486,17 +488,17 @@ function FloatingFocusManager(props) {
|
|
|
486
488
|
}
|
|
487
489
|
}
|
|
488
490
|
events.on('openchange', onOpenChangeLocal);
|
|
489
|
-
function getReturnElement() {
|
|
491
|
+
function getReturnElement(closeType) {
|
|
490
492
|
const returnFocusValueOrFn = returnFocusRef.current;
|
|
491
|
-
let resolvedReturnFocusValue = 'function' == typeof returnFocusValueOrFn ? returnFocusValueOrFn(
|
|
493
|
+
let resolvedReturnFocusValue = 'function' == typeof returnFocusValueOrFn ? returnFocusValueOrFn(closeType) : returnFocusValueOrFn;
|
|
492
494
|
if (void 0 === resolvedReturnFocusValue || false === resolvedReturnFocusValue) return null;
|
|
493
495
|
if (null === resolvedReturnFocusValue) resolvedReturnFocusValue = true;
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
return resolveRef(resolvedReturnFocusValue) ||
|
|
496
|
+
const referenceReturnElement = domReference?.isConnected ? domReference : null;
|
|
497
|
+
const previousReturnElement = elementFocusedBeforeOpen?.isConnected && 'body' !== getNodeName(elementFocusedBeforeOpen) ? elementFocusedBeforeOpen : null;
|
|
498
|
+
let defaultReturnElement = preferPreviousFocus ? previousReturnElement || referenceReturnElement : referenceReturnElement || previousReturnElement;
|
|
499
|
+
if (!defaultReturnElement) defaultReturnElement = getPreviouslyFocusedElement() || null;
|
|
500
|
+
if ('boolean' == typeof resolvedReturnFocusValue) return defaultReturnElement;
|
|
501
|
+
return resolveRef(resolvedReturnFocusValue) || defaultReturnElement || null;
|
|
500
502
|
}
|
|
501
503
|
return ()=>{
|
|
502
504
|
events.off('openchange', onOpenChangeLocal);
|
|
@@ -504,13 +506,23 @@ function FloatingFocusManager(props) {
|
|
|
504
506
|
const insideElements = getResolvedInsideElements();
|
|
505
507
|
const isFocusInsideFloatingTree = contains(floating, activeEl) || insideElements.some((element)=>element === activeEl || contains(element, activeEl)) || tree && getNodeChildren(tree.nodesRef.current, getNodeId(), false).some((node)=>contains(node.context?.elements.floating, activeEl));
|
|
506
508
|
const returnFocusValueOrFn = returnFocusRef.current;
|
|
507
|
-
const
|
|
509
|
+
const closeType = closeTypeRef.current;
|
|
510
|
+
const returnElement = getReturnElement(closeType);
|
|
511
|
+
const job = {
|
|
512
|
+
cancelled: false
|
|
513
|
+
};
|
|
514
|
+
pendingReturnFocusRef.current = job;
|
|
508
515
|
queueMicrotask(()=>{
|
|
516
|
+
if (pendingReturnFocusRef.current === job) pendingReturnFocusRef.current = null;
|
|
509
517
|
const tabbableReturnElement = getFirstTabbableElement(returnElement);
|
|
510
|
-
const hasExplicitReturnFocus = 'boolean' != typeof returnFocusValueOrFn;
|
|
511
|
-
if (returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (hasExplicitReturnFocus || tabbableReturnElement === activeEl || activeEl === doc.body ? true : isFocusInsideFloatingTree))
|
|
512
|
-
|
|
513
|
-
|
|
518
|
+
const hasExplicitReturnFocus = explicitReturnFocusRef.current ?? 'boolean' != typeof returnFocusValueOrFn;
|
|
519
|
+
if (!job.cancelled && returnFocusValueOrFn && !preventReturnFocusRef.current && isHTMLElement(tabbableReturnElement) && (hasExplicitReturnFocus || tabbableReturnElement === activeEl || activeEl === doc.body ? true : isFocusInsideFloatingTree)) {
|
|
520
|
+
const focusOptions = {
|
|
521
|
+
preventScroll: true
|
|
522
|
+
};
|
|
523
|
+
if ('keyboard' === closeType) focusOptions.focusVisible = true;
|
|
524
|
+
tabbableReturnElement.focus(focusOptions);
|
|
525
|
+
}
|
|
514
526
|
preventReturnFocusRef.current = false;
|
|
515
527
|
});
|
|
516
528
|
};
|
|
@@ -519,6 +531,8 @@ function FloatingFocusManager(props) {
|
|
|
519
531
|
floating,
|
|
520
532
|
floatingFocusElement,
|
|
521
533
|
returnFocusRef,
|
|
534
|
+
explicitReturnFocusRef,
|
|
535
|
+
openInteractionTypeRef,
|
|
522
536
|
events,
|
|
523
537
|
tree,
|
|
524
538
|
domReference,
|
|
@@ -526,7 +540,7 @@ function FloatingFocusManager(props) {
|
|
|
526
540
|
getResolvedInsideElements
|
|
527
541
|
]);
|
|
528
542
|
useIsoLayoutEffect(()=>{
|
|
529
|
-
if (!
|
|
543
|
+
if (!webkit || open || !floating) return;
|
|
530
544
|
const activeEl = activeElement(ownerDocument(floating));
|
|
531
545
|
if (!isHTMLElement(activeEl) || !isTypeableElement(activeEl)) return;
|
|
532
546
|
if (contains(floating, activeEl)) activeEl.blur();
|
|
@@ -557,14 +571,13 @@ function FloatingFocusManager(props) {
|
|
|
557
571
|
]);
|
|
558
572
|
useIsoLayoutEffect(()=>{
|
|
559
573
|
if (disabled || !floatingFocusElement) return;
|
|
560
|
-
handleTabIndex(floatingFocusElement
|
|
574
|
+
handleTabIndex(floatingFocusElement);
|
|
561
575
|
return ()=>{
|
|
562
576
|
queueMicrotask(clearDisconnectedPreviouslyFocusedElements);
|
|
563
577
|
};
|
|
564
578
|
}, [
|
|
565
579
|
disabled,
|
|
566
|
-
floatingFocusElement
|
|
567
|
-
orderRef
|
|
580
|
+
floatingFocusElement
|
|
568
581
|
]);
|
|
569
582
|
const shouldRenderGuards = !disabled && (modal ? !isUntrappedTypeableCombobox : true) && (isInsidePortal || modal);
|
|
570
583
|
return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
|
|
@@ -627,7 +640,7 @@ function useEnhancedClickHandler(handler) {
|
|
|
627
640
|
function useOpenMethodTriggerProps(open, setOpenMethod) {
|
|
628
641
|
const handleTriggerClick = useStableCallback((_, interactionType)=>{
|
|
629
642
|
const isOpen = 'function' == typeof open ? open() : open;
|
|
630
|
-
if (!isOpen) setOpenMethod(interactionType || (
|
|
643
|
+
if (!isOpen) setOpenMethod(interactionType || (ios ? 'touch' : ''));
|
|
631
644
|
});
|
|
632
645
|
const { onClick, onPointerDown } = useEnhancedClickHandler(handleTriggerClick);
|
|
633
646
|
return __rspack_external_react.useMemo(()=>({
|
|
@@ -655,6 +668,12 @@ function useOpenInteractionType(open) {
|
|
|
655
668
|
let originalHtmlStyles = {};
|
|
656
669
|
let originalBodyStyles = {};
|
|
657
670
|
let originalHtmlScrollBehavior = '';
|
|
671
|
+
function getViewportScroller(html, body) {
|
|
672
|
+
return isOverflowElement(html) ? html : body;
|
|
673
|
+
}
|
|
674
|
+
function isPageScrollLocked(win, html, body) {
|
|
675
|
+
return /hidden|clip/.test(win.getComputedStyle(getViewportScroller(html, body)).overflowY);
|
|
676
|
+
}
|
|
658
677
|
function hasInsetScrollbars(referenceElement) {
|
|
659
678
|
if ("u" < typeof document) return false;
|
|
660
679
|
const doc = ownerDocument(referenceElement);
|
|
@@ -667,7 +686,7 @@ function supportsStableScrollbarGutter(referenceElement) {
|
|
|
667
686
|
const doc = ownerDocument(referenceElement);
|
|
668
687
|
const html = doc.documentElement;
|
|
669
688
|
const body = doc.body;
|
|
670
|
-
const scrollContainer =
|
|
689
|
+
const scrollContainer = getViewportScroller(html, body);
|
|
671
690
|
const originalScrollContainerOverflowY = scrollContainer.style.overflowY;
|
|
672
691
|
const originalHtmlStyleGutter = html.style.scrollbarGutter;
|
|
673
692
|
html.style.scrollbarGutter = 'stable';
|
|
@@ -683,7 +702,7 @@ function preventScrollOverlayScrollbars(referenceElement) {
|
|
|
683
702
|
const doc = ownerDocument(referenceElement);
|
|
684
703
|
const html = doc.documentElement;
|
|
685
704
|
const body = doc.body;
|
|
686
|
-
const elementToLock =
|
|
705
|
+
const elementToLock = getViewportScroller(html, body);
|
|
687
706
|
const originalElementToLockStyles = {
|
|
688
707
|
overflowY: elementToLock.style.overflowY,
|
|
689
708
|
overflowX: elementToLock.style.overflowX
|
|
@@ -705,7 +724,7 @@ function preventScrollInsetScrollbars(referenceElement) {
|
|
|
705
724
|
let scrollLeft = 0;
|
|
706
725
|
let updateGutterOnly = false;
|
|
707
726
|
const resizeFrame = AnimationFrame.create();
|
|
708
|
-
if (
|
|
727
|
+
if (webkit && (win.visualViewport?.scale ?? 1) !== 1) return ()=>{};
|
|
709
728
|
function lockScroll() {
|
|
710
729
|
const htmlStyles = win.getComputedStyle(html);
|
|
711
730
|
const bodyStyles = win.getComputedStyle(body);
|
|
@@ -737,7 +756,7 @@ function preventScrollInsetScrollbars(referenceElement) {
|
|
|
737
756
|
const scrollbarHeight = Math.max(0, win.innerHeight - body.clientHeight);
|
|
738
757
|
const marginY = parseFloat(bodyStyles.marginTop) + parseFloat(bodyStyles.marginBottom);
|
|
739
758
|
const marginX = parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight);
|
|
740
|
-
const elementToLock =
|
|
759
|
+
const elementToLock = getViewportScroller(html, body);
|
|
741
760
|
updateGutterOnly = supportsStableScrollbarGutter(referenceElement);
|
|
742
761
|
if (updateGutterOnly) {
|
|
743
762
|
html.style.scrollbarGutter = scrollbarGutterValue;
|
|
@@ -757,7 +776,8 @@ function preventScrollInsetScrollbars(referenceElement) {
|
|
|
757
776
|
height: marginY || scrollbarHeight ? `calc(100dvh - ${marginY + scrollbarHeight}px)` : '100dvh',
|
|
758
777
|
width: marginX || scrollbarWidth ? `calc(100vw - ${marginX + scrollbarWidth}px)` : '100vw',
|
|
759
778
|
boxSizing: 'border-box',
|
|
760
|
-
|
|
779
|
+
overflowY: 'hidden',
|
|
780
|
+
overflowX: 'hidden',
|
|
761
781
|
scrollBehavior: 'unset'
|
|
762
782
|
});
|
|
763
783
|
body.scrollTop = scrollTop;
|
|
@@ -811,12 +831,24 @@ class ScrollLocker {
|
|
|
811
831
|
if (0 === this.lockCount || null !== this.restore) return;
|
|
812
832
|
const doc = ownerDocument(referenceElement);
|
|
813
833
|
const html = doc.documentElement;
|
|
814
|
-
const
|
|
815
|
-
|
|
816
|
-
|
|
834
|
+
const body = doc.body;
|
|
835
|
+
const win = getWindow(html);
|
|
836
|
+
if (isPageScrollLocked(win, html, body)) {
|
|
837
|
+
const observer = new win.MutationObserver(()=>{
|
|
838
|
+
if (isPageScrollLocked(win, html, body)) return;
|
|
839
|
+
observer.disconnect();
|
|
840
|
+
this.restore = null;
|
|
841
|
+
this.lock(referenceElement);
|
|
842
|
+
});
|
|
843
|
+
const options = {
|
|
844
|
+
attributes: true
|
|
845
|
+
};
|
|
846
|
+
observer.observe(html, options);
|
|
847
|
+
observer.observe(body, options);
|
|
848
|
+
this.restore = ()=>observer.disconnect();
|
|
817
849
|
return;
|
|
818
850
|
}
|
|
819
|
-
const hasOverlayScrollbars =
|
|
851
|
+
const hasOverlayScrollbars = ios || !hasInsetScrollbars(referenceElement);
|
|
820
852
|
this.restore = hasOverlayScrollbars ? preventScrollOverlayScrollbars(referenceElement) : preventScrollInsetScrollbars(referenceElement);
|
|
821
853
|
}
|
|
822
854
|
}
|
package/dist/{7541.js → 7488.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SafeReact } from "./
|
|
2
|
-
import { useRefWithInit } from "./
|
|
1
|
+
import { SafeReact } from "./3357.js";
|
|
2
|
+
import { useRefWithInit } from "./9591.js";
|
|
3
3
|
const useInsertionEffect = SafeReact.useInsertionEffect;
|
|
4
4
|
const useSafeInsertionEffect = useInsertionEffect && useInsertionEffect !== SafeReact.useLayoutEffect ? useInsertionEffect : (fn)=>fn();
|
|
5
5
|
function useStableCallback(callback) {
|
package/dist/{4863.js → 7542.js}
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { useIsoLayoutEffect } from "./
|
|
2
|
-
import { AnimationFrame } from "./
|
|
1
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
2
|
+
import { AnimationFrame } from "./5595.js";
|
|
3
3
|
import * as __rspack_external_react from "react";
|
|
4
|
-
function useTransitionStatus(open, enableIdleState = false, deferEndingState = false) {
|
|
4
|
+
function useTransitionStatus(open, enableIdleState = false, deferEndingState = false, animateInitialOpen = false) {
|
|
5
5
|
const [transitionStatus, setTransitionStatus] = __rspack_external_react.useState(open && enableIdleState ? 'idle' : void 0);
|
|
6
|
-
const [mounted, setMounted] = __rspack_external_react.useState(open);
|
|
6
|
+
const [mounted, setMounted] = __rspack_external_react.useState(open && !animateInitialOpen);
|
|
7
7
|
if (open && !mounted) {
|
|
8
8
|
setMounted(true);
|
|
9
9
|
setTransitionStatus('starting');
|
|
@@ -26,7 +26,7 @@ function useTransitionStatus(open, enableIdleState = false, deferEndingState = f
|
|
|
26
26
|
deferEndingState
|
|
27
27
|
]);
|
|
28
28
|
useIsoLayoutEffect(()=>{
|
|
29
|
-
if (!open || enableIdleState) return;
|
|
29
|
+
if (!open || enableIdleState || void 0 === transitionStatus) return;
|
|
30
30
|
const frame = AnimationFrame.request(()=>{
|
|
31
31
|
setTransitionStatus(void 0);
|
|
32
32
|
});
|
|
@@ -35,7 +35,8 @@ function useTransitionStatus(open, enableIdleState = false, deferEndingState = f
|
|
|
35
35
|
};
|
|
36
36
|
}, [
|
|
37
37
|
enableIdleState,
|
|
38
|
-
open
|
|
38
|
+
open,
|
|
39
|
+
transitionStatus
|
|
39
40
|
]);
|
|
40
41
|
useIsoLayoutEffect(()=>{
|
|
41
42
|
if (!open || !enableIdleState) return;
|
package/dist/7551.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { getWindow } from "./3829.js";
|
|
2
|
+
function getElementTransform(element, computedStyle) {
|
|
3
|
+
const transform = (computedStyle ?? getWindow(element).getComputedStyle(element)).transform;
|
|
4
|
+
let translateX = 0;
|
|
5
|
+
let translateY = 0;
|
|
6
|
+
let scale = 1;
|
|
7
|
+
if (transform && 'none' !== transform) {
|
|
8
|
+
const matrix = transform.match(/matrix(?:3d)?\(([^)]+)\)/);
|
|
9
|
+
if (matrix) {
|
|
10
|
+
const values = matrix[1].split(', ').map(parseFloat);
|
|
11
|
+
if (6 === values.length) {
|
|
12
|
+
translateX = values[4];
|
|
13
|
+
translateY = values[5];
|
|
14
|
+
scale = Math.sqrt(values[0] * values[0] + values[1] * values[1]);
|
|
15
|
+
} else if (16 === values.length) {
|
|
16
|
+
translateX = values[12];
|
|
17
|
+
translateY = values[13];
|
|
18
|
+
scale = values[0];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
x: translateX,
|
|
24
|
+
y: translateY,
|
|
25
|
+
scale
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export { getElementTransform };
|
package/dist/{7021.js → 7640.js}
RENAMED
package/dist/{353.js → 7692.js}
RENAMED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { utils_formatErrorMessage } from "./5473.js";
|
|
2
2
|
import * as __rspack_external_react from "react";
|
|
3
|
-
const FieldsetRootContext = /*#__PURE__*/ __rspack_external_react.createContext(
|
|
4
|
-
legendId: void 0,
|
|
5
|
-
setLegendId: ()=>{},
|
|
6
|
-
disabled: void 0
|
|
7
|
-
});
|
|
3
|
+
const FieldsetRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
8
4
|
if ("production" !== process.env.NODE_ENV) FieldsetRootContext.displayName = "FieldsetRootContext";
|
|
9
5
|
function useFieldsetRootContext(optional = false) {
|
|
10
6
|
const context = __rspack_external_react.useContext(FieldsetRootContext);
|
|
11
|
-
if (!context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.' :
|
|
7
|
+
if (!context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: FieldsetRootContext is missing. Fieldset parts must be placed within <Fieldset.Root>.' : utils_formatErrorMessage(86));
|
|
12
8
|
return context;
|
|
13
9
|
}
|
|
14
10
|
export { FieldsetRootContext, useFieldsetRootContext };
|
package/dist/{4707.js → 7930.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useRefWithInit } from "./
|
|
2
|
-
import { useIsoLayoutEffect } from "./
|
|
1
|
+
import { useRefWithInit } from "./9591.js";
|
|
2
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
3
3
|
function useValueAsRef(value) {
|
|
4
4
|
const latest = useRefWithInit(createLatestRef, value).current;
|
|
5
5
|
latest.next = value;
|