@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/{487.js → 3398.js}
RENAMED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { apple } from "./2221.js";
|
|
3
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
4
|
+
import { webkit } from "./3189.js";
|
|
5
|
+
import { visuallyHidden } from "./6540.js";
|
|
5
6
|
import { isNode, getComputedStyle, getNodeName, isShadowRoot, isHTMLElement } from "./3829.js";
|
|
6
|
-
import { contains, activeElement } from "./
|
|
7
|
-
import { isElementVisible } from "./
|
|
8
|
-
import { ownerDocument } from "./
|
|
9
|
-
import { createAttribute } from "./
|
|
10
|
-
import { useRenderElement, EMPTY_OBJECT } from "./
|
|
11
|
-
import { useId } from "./
|
|
12
|
-
import { useStableCallback } from "./
|
|
13
|
-
import { mergeCleanups } from "./
|
|
14
|
-
import { addEventListener } from "./
|
|
15
|
-
import { createChangeEventDetails } from "./
|
|
16
|
-
import { focusOut } from "./
|
|
7
|
+
import { contains, activeElement } from "./4155.js";
|
|
8
|
+
import { isElementVisible } from "./8358.js";
|
|
9
|
+
import { ownerDocument } from "./6488.js";
|
|
10
|
+
import { createAttribute } from "./226.js";
|
|
11
|
+
import { useRenderElement, EMPTY_OBJECT } from "./9591.js";
|
|
12
|
+
import { useId } from "./4989.js";
|
|
13
|
+
import { useStableCallback } from "./7488.js";
|
|
14
|
+
import { mergeCleanups } from "./7718.js";
|
|
15
|
+
import { addEventListener } from "./1282.js";
|
|
16
|
+
import { createChangeEventDetails } from "./8495.js";
|
|
17
|
+
import { focusOut } from "./9837.js";
|
|
17
18
|
import * as __rspack_external_react from "react";
|
|
18
19
|
import * as __rspack_external_react_dom_7136dc57 from "react-dom";
|
|
20
|
+
const voiceOver = apple;
|
|
19
21
|
const FocusGuard_FocusGuard = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, ref) {
|
|
20
22
|
const [role, setRole] = __rspack_external_react.useState();
|
|
21
23
|
useIsoLayoutEffect(()=>{
|
|
22
|
-
if (
|
|
24
|
+
if (voiceOver && webkit) setRole('button');
|
|
23
25
|
}, []);
|
|
24
26
|
const restProps = {
|
|
25
27
|
tabIndex: 0,
|
|
@@ -145,21 +147,18 @@ function getNextTabbable(referenceElement) {
|
|
|
145
147
|
function getPreviousTabbable(referenceElement) {
|
|
146
148
|
return getTabbableIn(ownerDocument(referenceElement).body, -1) || referenceElement;
|
|
147
149
|
}
|
|
148
|
-
function getTabbableNearElement(referenceElement,
|
|
150
|
+
function getTabbableNearElement(referenceElement, direction, exclude) {
|
|
149
151
|
if (!referenceElement) return null;
|
|
150
|
-
const list =
|
|
151
|
-
|
|
152
|
-
if (0 === elementCount) return null;
|
|
152
|
+
const list = [];
|
|
153
|
+
appendCandidates(ownerDocument(referenceElement).body, list);
|
|
153
154
|
const index = list.indexOf(referenceElement);
|
|
154
155
|
if (-1 === index) return null;
|
|
155
|
-
const
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
function getTabbableBeforeElement(referenceElement) {
|
|
162
|
-
return getTabbableNearElement(referenceElement, -1);
|
|
156
|
+
const candidates = list.filter(isFocusableElement);
|
|
157
|
+
for(let offset = 1; offset < list.length; offset += 1){
|
|
158
|
+
const element = list[(index + direction * offset + list.length) % list.length];
|
|
159
|
+
if (!contains(exclude, element) && isTabbable(element) && isTabbableRadio(element, candidates)) return element;
|
|
160
|
+
}
|
|
161
|
+
return list[index];
|
|
163
162
|
}
|
|
164
163
|
function isOutsideEvent(event, container) {
|
|
165
164
|
const containerElement = container || event.currentTarget;
|
|
@@ -229,7 +228,6 @@ function useFloatingPortalNode(props = {}) {
|
|
|
229
228
|
}
|
|
230
229
|
return;
|
|
231
230
|
}
|
|
232
|
-
if (null == uniqueId) return;
|
|
233
231
|
const resolvedContainer = (containerProp && (isNode(containerProp) ? containerProp : containerProp.current)) ?? parentPortalNode ?? document.body;
|
|
234
232
|
if (null == resolvedContainer) {
|
|
235
233
|
if (containerRef.current) {
|
|
@@ -246,8 +244,7 @@ function useFloatingPortalNode(props = {}) {
|
|
|
246
244
|
}
|
|
247
245
|
}, [
|
|
248
246
|
containerProp,
|
|
249
|
-
parentPortalNode
|
|
250
|
-
uniqueId
|
|
247
|
+
parentPortalNode
|
|
251
248
|
]);
|
|
252
249
|
const portalElement = useRenderElement('div', componentProps, {
|
|
253
250
|
ref: [
|
|
@@ -264,13 +261,14 @@ function useFloatingPortalNode(props = {}) {
|
|
|
264
261
|
});
|
|
265
262
|
const portalSubtree = containerElement && portalElement ? /*#__PURE__*/ __rspack_external_react_dom_7136dc57.createPortal(portalElement, containerElement) : null;
|
|
266
263
|
return {
|
|
267
|
-
portalNode,
|
|
268
|
-
|
|
264
|
+
node: portalNode,
|
|
265
|
+
nodeId: /*#__PURE__*/ __rspack_external_react.isValidElement(portalElement) ? portalElement.props.id : void 0,
|
|
266
|
+
subtree: portalSubtree
|
|
269
267
|
};
|
|
270
268
|
}
|
|
271
269
|
const FloatingPortal_FloatingPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
272
|
-
const { render, className, style, children, container,
|
|
273
|
-
const { portalNode, portalSubtree } = useFloatingPortalNode({
|
|
270
|
+
const { render, className, style, children, container, portalOwnerRole, ...elementProps } = componentProps;
|
|
271
|
+
const { node: portalNode, nodeId: portalNodeId, subtree: portalSubtree } = useFloatingPortalNode({
|
|
274
272
|
container,
|
|
275
273
|
ref: forwardedRef,
|
|
276
274
|
componentProps,
|
|
@@ -284,7 +282,7 @@ const FloatingPortal_FloatingPortal = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
284
282
|
const focusInsideDisabledRef = __rspack_external_react.useRef(false);
|
|
285
283
|
const modal = focusManagerState?.modal;
|
|
286
284
|
const open = focusManagerState?.open;
|
|
287
|
-
const shouldRenderGuards =
|
|
285
|
+
const shouldRenderGuards = !!focusManagerState && !focusManagerState.modal && focusManagerState.open && !!portalNode;
|
|
288
286
|
__rspack_external_react.useEffect(()=>{
|
|
289
287
|
if (!portalNode || modal) return;
|
|
290
288
|
function onFocus(event) {
|
|
@@ -303,8 +301,8 @@ const FloatingPortal_FloatingPortal = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
303
301
|
portalNode,
|
|
304
302
|
modal
|
|
305
303
|
]);
|
|
306
|
-
|
|
307
|
-
if (!portalNode ||
|
|
304
|
+
useIsoLayoutEffect(()=>{
|
|
305
|
+
if (!portalNode || true !== open || !focusInsideDisabledRef.current) return;
|
|
308
306
|
enableFocusInside(portalNode);
|
|
309
307
|
focusInsideDisabledRef.current = false;
|
|
310
308
|
}, [
|
|
@@ -340,7 +338,8 @@ const FloatingPortal_FloatingPortal = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
340
338
|
}
|
|
341
339
|
}),
|
|
342
340
|
shouldRenderGuards && portalNode && /*#__PURE__*/ jsx("span", {
|
|
343
|
-
|
|
341
|
+
role: portalOwnerRole,
|
|
342
|
+
"aria-owns": portalNodeId,
|
|
344
343
|
style: ownerVisuallyHidden
|
|
345
344
|
}),
|
|
346
345
|
portalNode && /*#__PURE__*/ __rspack_external_react_dom_7136dc57.createPortal(children, portalNode),
|
|
@@ -363,4 +362,4 @@ const FloatingPortal_FloatingPortal = /*#__PURE__*/ __rspack_external_react.forw
|
|
|
363
362
|
});
|
|
364
363
|
});
|
|
365
364
|
if ("production" !== process.env.NODE_ENV) FloatingPortal_FloatingPortal.displayName = "FloatingPortal";
|
|
366
|
-
export { BASE_UI_SWIPE_IGNORE_SELECTOR, CLICK_TRIGGER_IDENTIFIER, DISABLED_TRANSITIONS_STYLE, DROPDOWN_COLLISION_AVOIDANCE, FloatingPortal_FloatingPortal, FocusGuard_FocusGuard, LEGACY_SWIPE_IGNORE_SELECTOR, POPUP_COLLISION_AVOIDANCE, disableFocusInside, enableFocusInside, focusable, getNextTabbable, getPreviousTabbable,
|
|
365
|
+
export { BASE_UI_SWIPE_IGNORE_ATTRIBUTE, BASE_UI_SWIPE_IGNORE_SELECTOR, CLICK_TRIGGER_IDENTIFIER, DISABLED_TRANSITIONS_STYLE, DROPDOWN_COLLISION_AVOIDANCE, FloatingPortal_FloatingPortal, FocusGuard_FocusGuard, LEGACY_SWIPE_IGNORE_SELECTOR, POPUP_COLLISION_AVOIDANCE, disableFocusInside, enableFocusInside, focusable, getNextTabbable, getPreviousTabbable, getTabbableNearElement, isOutsideEvent, isTabbable, ownerVisuallyHidden, tabbable, useFloatingPortalNode, usePortalContext, voiceOver };
|
package/dist/3502.js
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { EMPTY_OBJECT, EMPTY_ARRAY, useMergedRefs, useRenderElement } from "./9591.js";
|
|
3
|
+
import { useStableCallback } from "./7488.js";
|
|
4
|
+
import { ARROW_LEFT, scrollIntoViewIfNeeded, ARROW_UP, COMPOSITE_KEYS, ARROW_DOWN, MODIFIER_KEYS, ARROW_RIGHT, isNativeInput } from "./2859.js";
|
|
5
|
+
import { isIndexOutOfListBounds, getMinListIndex, getMaxListIndex, findNonDisabledListIndex, isListIndexDisabled } from "./8358.js";
|
|
6
|
+
import { ACTIVE_COMPOSITE_ITEM } from "./1629.js";
|
|
7
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
8
|
+
import { getTarget } from "./4155.js";
|
|
9
|
+
import { isElementDisabled } from "./6499.js";
|
|
10
|
+
import { useDirection } from "./6534.js";
|
|
11
|
+
import { CompositeRootContext } from "./1219.js";
|
|
12
|
+
import { CompositeList } from "./3014.js";
|
|
13
|
+
import * as __rspack_external_react from "react";
|
|
14
|
+
function useCompositeRoot(params) {
|
|
15
|
+
const { loopFocus = true, orientation = 'both', grid, onLoop, direction, highlightedIndex: externalHighlightedIndex, onHighlightedIndexChange: externalSetHighlightedIndex, rootRef: externalRef, enableHomeAndEndKeys = false, stopEventPropagation, disabledIndices, modifierKeys = EMPTY_ARRAY } = params;
|
|
16
|
+
const [internalHighlightedIndex, internalSetHighlightedIndex] = __rspack_external_react.useState(0);
|
|
17
|
+
const isGrid = null != grid;
|
|
18
|
+
const rootRef = __rspack_external_react.useRef(null);
|
|
19
|
+
const mergedRef = useMergedRefs(rootRef, externalRef);
|
|
20
|
+
const elementsRef = __rspack_external_react.useRef([]);
|
|
21
|
+
const hasSetDefaultIndexRef = __rspack_external_react.useRef(false);
|
|
22
|
+
const highlightedElementRef = __rspack_external_react.useRef(null);
|
|
23
|
+
const highlightedIndex = externalHighlightedIndex ?? internalHighlightedIndex;
|
|
24
|
+
const onHighlightedIndexChange = useStableCallback((index, shouldScrollIntoView = false)=>{
|
|
25
|
+
highlightedElementRef.current = elementsRef.current[index] ?? null;
|
|
26
|
+
(externalSetHighlightedIndex ?? internalSetHighlightedIndex)(index);
|
|
27
|
+
if (shouldScrollIntoView) {
|
|
28
|
+
const newActiveItem = elementsRef.current[index];
|
|
29
|
+
scrollIntoViewIfNeeded(rootRef.current, newActiveItem, direction, orientation);
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const onMapChange = useStableCallback((map)=>{
|
|
33
|
+
if (0 === map.size) return;
|
|
34
|
+
if (hasSetDefaultIndexRef.current) {
|
|
35
|
+
const elements = elementsRef.current;
|
|
36
|
+
const nextIndex = elements.indexOf(highlightedElementRef.current);
|
|
37
|
+
if (-1 === nextIndex) {
|
|
38
|
+
const replacement = elements[highlightedIndex];
|
|
39
|
+
if (!replacement || isListIndexDisabled(elements, highlightedIndex, disabledIndices)) onHighlightedIndexChange(getFallbackIndex(elements, disabledIndices));
|
|
40
|
+
else highlightedElementRef.current = replacement;
|
|
41
|
+
} else if (nextIndex !== highlightedIndex) onHighlightedIndexChange(nextIndex);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
hasSetDefaultIndexRef.current = true;
|
|
45
|
+
const sortedElements = Array.from(map.keys());
|
|
46
|
+
const activeItem = sortedElements.find((compositeElement)=>compositeElement?.hasAttribute(ACTIVE_COMPOSITE_ITEM)) ?? null;
|
|
47
|
+
const activeIndex = activeItem ? map.get(activeItem)?.index ?? -1 : -1;
|
|
48
|
+
if (-1 !== activeIndex) onHighlightedIndexChange(activeIndex);
|
|
49
|
+
else if (isListIndexDisabled(sortedElements, highlightedIndex, disabledIndices)) {
|
|
50
|
+
const firstEnabledIndex = findNonDisabledListIndex(sortedElements, {
|
|
51
|
+
disabledIndices
|
|
52
|
+
});
|
|
53
|
+
if (!isIndexOutOfListBounds(sortedElements, firstEnabledIndex)) onHighlightedIndexChange(firstEnabledIndex);
|
|
54
|
+
}
|
|
55
|
+
scrollIntoViewIfNeeded(rootRef.current, activeItem, direction, orientation);
|
|
56
|
+
});
|
|
57
|
+
useIsoLayoutEffect(()=>{
|
|
58
|
+
if (null == disabledIndices || null != externalHighlightedIndex || !hasSetDefaultIndexRef.current) return;
|
|
59
|
+
const elements = elementsRef.current;
|
|
60
|
+
if (isListIndexDisabled(elements, highlightedIndex, disabledIndices)) {
|
|
61
|
+
const firstEnabledIndex = findNonDisabledListIndex(elements, {
|
|
62
|
+
disabledIndices
|
|
63
|
+
});
|
|
64
|
+
if (!isIndexOutOfListBounds(elements, firstEnabledIndex)) onHighlightedIndexChange(firstEnabledIndex);
|
|
65
|
+
}
|
|
66
|
+
}, [
|
|
67
|
+
disabledIndices,
|
|
68
|
+
externalHighlightedIndex,
|
|
69
|
+
highlightedIndex,
|
|
70
|
+
elementsRef,
|
|
71
|
+
onHighlightedIndexChange
|
|
72
|
+
]);
|
|
73
|
+
const wrappedOnLoop = useStableCallback((event, prevIndex, nextIndex)=>{
|
|
74
|
+
if (!onLoop) return nextIndex;
|
|
75
|
+
return onLoop(event, prevIndex, nextIndex, elementsRef);
|
|
76
|
+
});
|
|
77
|
+
const onKeyDown = useStableCallback((event)=>{
|
|
78
|
+
const isHomeOrEnd = "Home" === event.key || "End" === event.key;
|
|
79
|
+
if (!COMPOSITE_KEYS.has(event.key) || !enableHomeAndEndKeys && isHomeOrEnd) return;
|
|
80
|
+
if (isModifierKeySet(event, modifierKeys)) return;
|
|
81
|
+
const element = rootRef.current;
|
|
82
|
+
if (!element) return;
|
|
83
|
+
const isRtl = 'rtl' === direction;
|
|
84
|
+
const horizontalForwardKey = isRtl ? ARROW_LEFT : ARROW_RIGHT;
|
|
85
|
+
const horizontalBackwardKey = isRtl ? ARROW_RIGHT : ARROW_LEFT;
|
|
86
|
+
const forwardKey = 'vertical' === orientation ? ARROW_DOWN : horizontalForwardKey;
|
|
87
|
+
const backwardKey = 'vertical' === orientation ? ARROW_UP : horizontalBackwardKey;
|
|
88
|
+
const target = getTarget(event.nativeEvent);
|
|
89
|
+
if (null != target && isNativeInput(target) && !isElementDisabled(target)) {
|
|
90
|
+
const selectionStart = target.selectionStart;
|
|
91
|
+
const selectionEnd = target.selectionEnd;
|
|
92
|
+
const textContent = target.value;
|
|
93
|
+
if (null == selectionStart || event.shiftKey || selectionStart !== selectionEnd) return;
|
|
94
|
+
if (event.key !== backwardKey && selectionStart < textContent.length) return;
|
|
95
|
+
if (event.key !== forwardKey && selectionStart > 0) return;
|
|
96
|
+
}
|
|
97
|
+
let nextIndex = highlightedIndex;
|
|
98
|
+
const minIndex = getMinListIndex(elementsRef, disabledIndices);
|
|
99
|
+
const maxIndex = getMaxListIndex(elementsRef, disabledIndices);
|
|
100
|
+
if (null != grid) nextIndex = grid({
|
|
101
|
+
disabledIndices,
|
|
102
|
+
elementsRef,
|
|
103
|
+
event,
|
|
104
|
+
highlightedIndex,
|
|
105
|
+
loopFocus,
|
|
106
|
+
maxIndex,
|
|
107
|
+
minIndex,
|
|
108
|
+
onLoop: wrappedOnLoop,
|
|
109
|
+
orientation,
|
|
110
|
+
rtl: isRtl
|
|
111
|
+
});
|
|
112
|
+
const isForwardKey = 'vertical' !== orientation && event.key === horizontalForwardKey || 'horizontal' !== orientation && event.key === ARROW_DOWN;
|
|
113
|
+
const isBackwardKey = 'vertical' !== orientation && event.key === horizontalBackwardKey || 'horizontal' !== orientation && event.key === ARROW_UP;
|
|
114
|
+
if (enableHomeAndEndKeys) {
|
|
115
|
+
if ("Home" === event.key) nextIndex = minIndex;
|
|
116
|
+
else if ("End" === event.key) nextIndex = maxIndex;
|
|
117
|
+
}
|
|
118
|
+
if (nextIndex === highlightedIndex && (isForwardKey || isBackwardKey)) if (loopFocus && nextIndex === maxIndex && isForwardKey) {
|
|
119
|
+
nextIndex = minIndex;
|
|
120
|
+
if (onLoop) nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
|
|
121
|
+
} else if (loopFocus && nextIndex === minIndex && isBackwardKey) {
|
|
122
|
+
nextIndex = maxIndex;
|
|
123
|
+
if (onLoop) nextIndex = onLoop(event, highlightedIndex, nextIndex, elementsRef);
|
|
124
|
+
} else nextIndex = findNonDisabledListIndex(elementsRef.current, {
|
|
125
|
+
startingIndex: nextIndex,
|
|
126
|
+
decrement: isBackwardKey,
|
|
127
|
+
disabledIndices
|
|
128
|
+
});
|
|
129
|
+
if (nextIndex !== highlightedIndex && !isIndexOutOfListBounds(elementsRef.current, nextIndex)) {
|
|
130
|
+
if (stopEventPropagation) event.stopPropagation();
|
|
131
|
+
if (isGrid || isHomeOrEnd || isForwardKey || isBackwardKey) event.preventDefault();
|
|
132
|
+
onHighlightedIndexChange(nextIndex, true);
|
|
133
|
+
queueMicrotask(()=>{
|
|
134
|
+
elementsRef.current[nextIndex]?.focus();
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
const props = {
|
|
139
|
+
ref: mergedRef,
|
|
140
|
+
onFocus (event) {
|
|
141
|
+
const element = rootRef.current;
|
|
142
|
+
const target = getTarget(event.nativeEvent);
|
|
143
|
+
if (!element || null == target || !isNativeInput(target)) return;
|
|
144
|
+
target.setSelectionRange(0, target.value.length);
|
|
145
|
+
},
|
|
146
|
+
onKeyDown
|
|
147
|
+
};
|
|
148
|
+
return {
|
|
149
|
+
props,
|
|
150
|
+
highlightedIndex,
|
|
151
|
+
onHighlightedIndexChange,
|
|
152
|
+
elementsRef,
|
|
153
|
+
onMapChange,
|
|
154
|
+
relayKeyboardEvent: onKeyDown
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
function getFallbackIndex(elements, disabledIndices) {
|
|
158
|
+
let fallbackIndex = -1;
|
|
159
|
+
for(let index = 0; index < elements.length; index += 1){
|
|
160
|
+
const element = elements[index];
|
|
161
|
+
if (!(!element || isListIndexDisabled(elements, index, disabledIndices))) {
|
|
162
|
+
if (element.hasAttribute(ACTIVE_COMPOSITE_ITEM)) return index;
|
|
163
|
+
if (-1 === fallbackIndex) fallbackIndex = index;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return Math.max(fallbackIndex, 0);
|
|
167
|
+
}
|
|
168
|
+
function isModifierKeySet(event, ignoredModifierKeys) {
|
|
169
|
+
for (const key of MODIFIER_KEYS)if (!ignoredModifierKeys.includes(key)) {
|
|
170
|
+
if (event.getModifierState(key)) return true;
|
|
171
|
+
}
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
function CompositeRoot(componentProps) {
|
|
175
|
+
const { render, className, style, refs = EMPTY_ARRAY, props = EMPTY_ARRAY, state = EMPTY_OBJECT, stateAttributesMapping, highlightedIndex: highlightedIndexProp, onHighlightedIndexChange: onHighlightedIndexChangeProp, orientation, grid, loopFocus, onLoop, enableHomeAndEndKeys, onMapChange: onMapChangeProp, stopEventPropagation = true, rootRef, disabledIndices, modifierKeys, highlightItemOnHover = false, tag = 'div', ...elementProps } = componentProps;
|
|
176
|
+
const direction = useDirection();
|
|
177
|
+
const { props: defaultProps, highlightedIndex, onHighlightedIndexChange, elementsRef, onMapChange: onMapChangeUnwrapped, relayKeyboardEvent } = useCompositeRoot({
|
|
178
|
+
grid,
|
|
179
|
+
loopFocus,
|
|
180
|
+
onLoop,
|
|
181
|
+
orientation,
|
|
182
|
+
highlightedIndex: highlightedIndexProp,
|
|
183
|
+
onHighlightedIndexChange: onHighlightedIndexChangeProp,
|
|
184
|
+
rootRef,
|
|
185
|
+
stopEventPropagation,
|
|
186
|
+
enableHomeAndEndKeys,
|
|
187
|
+
direction,
|
|
188
|
+
disabledIndices,
|
|
189
|
+
modifierKeys
|
|
190
|
+
});
|
|
191
|
+
const element = useRenderElement(tag, componentProps, {
|
|
192
|
+
state,
|
|
193
|
+
ref: refs,
|
|
194
|
+
props: [
|
|
195
|
+
defaultProps,
|
|
196
|
+
...props,
|
|
197
|
+
elementProps
|
|
198
|
+
],
|
|
199
|
+
stateAttributesMapping
|
|
200
|
+
});
|
|
201
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
202
|
+
highlightedIndex,
|
|
203
|
+
onHighlightedIndexChange,
|
|
204
|
+
highlightItemOnHover,
|
|
205
|
+
relayKeyboardEvent
|
|
206
|
+
}), [
|
|
207
|
+
highlightedIndex,
|
|
208
|
+
onHighlightedIndexChange,
|
|
209
|
+
highlightItemOnHover,
|
|
210
|
+
relayKeyboardEvent
|
|
211
|
+
]);
|
|
212
|
+
return /*#__PURE__*/ jsx(CompositeRootContext.Provider, {
|
|
213
|
+
value: contextValue,
|
|
214
|
+
children: /*#__PURE__*/ jsx(CompositeList, {
|
|
215
|
+
elementsRef: elementsRef,
|
|
216
|
+
onMapChange: (newMap)=>{
|
|
217
|
+
onMapChangeProp?.(newMap);
|
|
218
|
+
onMapChangeUnwrapped(newMap);
|
|
219
|
+
},
|
|
220
|
+
children: element
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
export { CompositeRoot };
|
package/dist/3695.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { getWindow } from "./3829.js";
|
|
2
|
+
import { DEFAULT_SIDES } from "./497.js";
|
|
3
|
+
import { ownerDocument } from "./6488.js";
|
|
4
|
+
import { getSide } from "./8358.js";
|
|
5
|
+
const adaptiveOrigin = {
|
|
6
|
+
name: 'adaptiveOrigin',
|
|
7
|
+
async fn (state) {
|
|
8
|
+
const { x: rawX, y: rawY, rects: { floating: floatRect }, elements: { floating }, platform, strategy, placement } = state;
|
|
9
|
+
const win = getWindow(floating);
|
|
10
|
+
const styles = win.getComputedStyle(floating);
|
|
11
|
+
const hasTransition = '0s' !== styles.transitionDuration && '' !== styles.transitionDuration;
|
|
12
|
+
if (!hasTransition) return {
|
|
13
|
+
x: rawX,
|
|
14
|
+
y: rawY,
|
|
15
|
+
data: DEFAULT_SIDES
|
|
16
|
+
};
|
|
17
|
+
const offsetParent = await platform.getOffsetParent?.(floating);
|
|
18
|
+
let offsetDimensions = {
|
|
19
|
+
width: 0,
|
|
20
|
+
height: 0
|
|
21
|
+
};
|
|
22
|
+
if ('fixed' === strategy && win?.visualViewport) offsetDimensions = {
|
|
23
|
+
width: win.visualViewport.width,
|
|
24
|
+
height: win.visualViewport.height
|
|
25
|
+
};
|
|
26
|
+
else if (offsetParent === win) {
|
|
27
|
+
const doc = ownerDocument(floating);
|
|
28
|
+
offsetDimensions = {
|
|
29
|
+
width: doc.documentElement.clientWidth,
|
|
30
|
+
height: doc.documentElement.clientHeight
|
|
31
|
+
};
|
|
32
|
+
} else if (await platform.isElement?.(offsetParent)) offsetDimensions = await platform.getDimensions(offsetParent);
|
|
33
|
+
const currentSide = getSide(placement);
|
|
34
|
+
let x = rawX;
|
|
35
|
+
let y = rawY;
|
|
36
|
+
if ('left' === currentSide) x = offsetDimensions.width - (rawX + floatRect.width);
|
|
37
|
+
if ('top' === currentSide) y = offsetDimensions.height - (rawY + floatRect.height);
|
|
38
|
+
const sideX = 'left' === currentSide ? 'right' : DEFAULT_SIDES.sideX;
|
|
39
|
+
const sideY = 'top' === currentSide ? 'bottom' : DEFAULT_SIDES.sideY;
|
|
40
|
+
return {
|
|
41
|
+
x,
|
|
42
|
+
y,
|
|
43
|
+
data: {
|
|
44
|
+
sideX,
|
|
45
|
+
sideY
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
export { adaptiveOrigin };
|
package/dist/3829.js
CHANGED
|
@@ -90,7 +90,7 @@ function getParentNode(node) {
|
|
|
90
90
|
}
|
|
91
91
|
function getNearestOverflowAncestor(node) {
|
|
92
92
|
const parentNode = getParentNode(node);
|
|
93
|
-
if (isLastTraversableNode(parentNode)) return node.ownerDocument
|
|
93
|
+
if (isLastTraversableNode(parentNode)) return (node.ownerDocument || node).body;
|
|
94
94
|
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
|
|
95
95
|
return getNearestOverflowAncestor(parentNode);
|
|
96
96
|
}
|