@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/{6706.js → 1093.js}
RENAMED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { useBaseUiId } from "./
|
|
2
|
-
import { useIsoLayoutEffect } from "./
|
|
1
|
+
import { useBaseUiId } from "./5969.js";
|
|
2
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
3
3
|
function useRegisteredLabelId(idProp, setLabelId) {
|
|
4
4
|
const id = useBaseUiId(idProp);
|
|
5
5
|
useIsoLayoutEffect(()=>{
|
|
6
6
|
setLabelId(id);
|
|
7
7
|
return ()=>{
|
|
8
|
-
setLabelId(void 0);
|
|
8
|
+
setLabelId((currentId)=>currentId === id ? void 0 : currentId);
|
|
9
9
|
};
|
|
10
10
|
}, [
|
|
11
11
|
id,
|
package/dist/{8724.js → 1219.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { utils_formatErrorMessage } from "./5473.js";
|
|
2
2
|
import * as __rspack_external_react from "react";
|
|
3
3
|
const CompositeRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
|
|
4
4
|
if ("production" !== process.env.NODE_ENV) CompositeRootContext.displayName = "CompositeRootContext";
|
|
5
5
|
function useCompositeRootContext(optional = false) {
|
|
6
6
|
const context = __rspack_external_react.useContext(CompositeRootContext);
|
|
7
|
-
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' :
|
|
7
|
+
if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.' : utils_formatErrorMessage(16));
|
|
8
8
|
return context;
|
|
9
9
|
}
|
|
10
10
|
export { CompositeRootContext, useCompositeRootContext };
|
package/dist/{7373.js → 1288.js}
RENAMED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { getWindow } from "./3829.js";
|
|
2
|
+
import { jsdom } from "./5490.js";
|
|
3
|
+
const BOUNDARY_OFFSET = 5;
|
|
4
|
+
function isMouseWithinBounds(event, element) {
|
|
5
|
+
const bounds = getPseudoElementBounds(element);
|
|
6
|
+
return event.clientX >= bounds.left - BOUNDARY_OFFSET && event.clientX <= bounds.right + BOUNDARY_OFFSET && event.clientY >= bounds.top - BOUNDARY_OFFSET && event.clientY <= bounds.bottom + BOUNDARY_OFFSET;
|
|
7
|
+
}
|
|
2
8
|
function getPseudoElementBounds(element) {
|
|
3
9
|
const elementRect = element.getBoundingClientRect();
|
|
4
|
-
if ('production' !== process.env.NODE_ENV) return elementRect;
|
|
5
10
|
const win = getWindow(element);
|
|
11
|
+
if (jsdom) return elementRect;
|
|
6
12
|
const beforeStyles = win.getComputedStyle(element, '::before');
|
|
7
13
|
const afterStyles = win.getComputedStyle(element, '::after');
|
|
8
14
|
const hasPseudoElements = 'none' !== beforeStyles.content || 'none' !== afterStyles.content;
|
|
@@ -22,4 +28,4 @@ function getPseudoElementBounds(element) {
|
|
|
22
28
|
bottom: elementRect.bottom + heightDiff / 2
|
|
23
29
|
};
|
|
24
30
|
}
|
|
25
|
-
export {
|
|
31
|
+
export { isMouseWithinBounds };
|
package/dist/{5299.js → 1381.js}
RENAMED
|
@@ -1,41 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { isListIndexDisabled,
|
|
4
|
-
import {
|
|
5
|
-
import { getTarget, contains, activeElement } from "./
|
|
6
|
-
import { useIsoLayoutEffect } from "./
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
1
|
+
import { useStableCallback } from "./7488.js";
|
|
2
|
+
import { useTimeout } from "./9197.js";
|
|
3
|
+
import { isListIndexDisabled, isVirtualClick, isVirtualPointerEvent, getNextListIndex, getMinListIndex, stopEvent, isElementVisible, isIndexOutOfListBounds, getMaxListIndex } from "./8358.js";
|
|
4
|
+
import { EMPTY_ARRAY } from "./9591.js";
|
|
5
|
+
import { getTarget, contains, activeElement } from "./4155.js";
|
|
6
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
7
|
+
import { webkit } from "./3189.js";
|
|
8
|
+
import { ARROW_LEFT, ARROW_UP, ARROW_DOWN, ARROW_RIGHT } from "./5490.js";
|
|
9
|
+
import { getFloatingFocusElement, isTypeableCombobox, isTypeableElement } from "./6137.js";
|
|
10
|
+
import { useValueAsRef } from "./7930.js";
|
|
11
|
+
import { useFloatingParentNodeId, useFloatingTree } from "./4472.js";
|
|
12
|
+
import { useAnimationFrame } from "./5595.js";
|
|
13
|
+
import { enqueueFocus } from "./7323.js";
|
|
14
|
+
import { ownerDocument } from "./6488.js";
|
|
15
|
+
import { createChangeEventDetails } from "./8495.js";
|
|
16
|
+
import { listNavigation, focusOut } from "./9837.js";
|
|
16
17
|
import { isHTMLElement } from "./3829.js";
|
|
17
18
|
import * as __rspack_external_react from "react";
|
|
18
|
-
function useTypeahead(
|
|
19
|
-
const { listRef, elementsRef, activeIndex, onMatch: onMatchProp, onTyping, enabled = true, resetMs = 750, selectedIndex = null } = props;
|
|
20
|
-
const
|
|
19
|
+
function useTypeahead(store, props) {
|
|
20
|
+
const { listRef, elementsRef, activeIndex, onMatch: onMatchProp, disabledIndices, onTyping: onTypingProp, enabled = true, resetMs = 750, selectedIndex = null } = props;
|
|
21
|
+
const onTyping = useStableCallback(onTypingProp);
|
|
21
22
|
const open = store.useState('open');
|
|
22
23
|
const timeout = useTimeout();
|
|
23
24
|
const stringRef = __rspack_external_react.useRef('');
|
|
24
25
|
const prevIndexRef = __rspack_external_react.useRef(selectedIndex ?? activeIndex ?? -1);
|
|
25
26
|
const matchIndexRef = __rspack_external_react.useRef(null);
|
|
26
27
|
const onKeyDown = useStableCallback((event)=>{
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
function getElement(index) {
|
|
29
|
+
return elementsRef?.current[index];
|
|
30
|
+
}
|
|
31
|
+
function isItemAvailable(index) {
|
|
32
|
+
const element = getElement(index);
|
|
33
|
+
if (element && !isElementVisible(element) || element?.matches(':disabled')) return false;
|
|
34
|
+
return null == disabledIndices || !isListIndexDisabled(EMPTY_ARRAY, index, disabledIndices);
|
|
30
35
|
}
|
|
31
36
|
function getMatchingIndex(list, string, startIndex = 0) {
|
|
32
37
|
if (0 === list.length) return -1;
|
|
33
38
|
const normalizedStartIndex = (startIndex % list.length + list.length) % list.length;
|
|
34
|
-
const lowerString = string.
|
|
39
|
+
const lowerString = string.toLowerCase();
|
|
35
40
|
for(let offset = 0; offset < list.length; offset += 1){
|
|
36
41
|
const index = (normalizedStartIndex + offset) % list.length;
|
|
37
42
|
const text = list[index];
|
|
38
|
-
if (text?.
|
|
43
|
+
if (text?.toLowerCase().startsWith(lowerString) && isItemAvailable(index)) return index;
|
|
39
44
|
}
|
|
40
45
|
return -1;
|
|
41
46
|
}
|
|
@@ -54,7 +59,7 @@ function useTypeahead(context, props) {
|
|
|
54
59
|
}
|
|
55
60
|
const isNewSession = '' === stringRef.current;
|
|
56
61
|
if (isNewSession) prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
|
|
57
|
-
const allowRapidSuccessionOfFirstLetter = listContent.every((text)=>text ? text[0]?.
|
|
62
|
+
const allowRapidSuccessionOfFirstLetter = listContent.every((text, index)=>text && isItemAvailable(index) ? text[0]?.toLowerCase() !== text[1]?.toLowerCase() : true);
|
|
58
63
|
if (allowRapidSuccessionOfFirstLetter && stringRef.current === event.key) {
|
|
59
64
|
stringRef.current = '';
|
|
60
65
|
prevIndexRef.current = matchIndexRef.current;
|
|
@@ -69,7 +74,7 @@ function useTypeahead(context, props) {
|
|
|
69
74
|
const startIndex = (prevIndex ?? 0) + 1;
|
|
70
75
|
const index = getMatchingIndex(listContent, stringRef.current, startIndex);
|
|
71
76
|
if (-1 !== index) {
|
|
72
|
-
onMatchProp?.(index);
|
|
77
|
+
onMatchProp?.(index, event);
|
|
73
78
|
matchIndexRef.current = index;
|
|
74
79
|
} else if (' ' !== event.key) {
|
|
75
80
|
stringRef.current = '';
|
|
@@ -91,18 +96,15 @@ function useTypeahead(context, props) {
|
|
|
91
96
|
if (!open && null !== selectedIndex) return;
|
|
92
97
|
timeout.clear();
|
|
93
98
|
matchIndexRef.current = null;
|
|
94
|
-
if ('' !== stringRef.current)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
timeout
|
|
99
|
-
]);
|
|
100
|
-
useIsoLayoutEffect(()=>{
|
|
101
|
-
if (open && '' === stringRef.current) prevIndexRef.current = selectedIndex ?? activeIndex ?? -1;
|
|
99
|
+
if ('' !== stringRef.current) {
|
|
100
|
+
stringRef.current = '';
|
|
101
|
+
onTyping?.(false);
|
|
102
|
+
}
|
|
102
103
|
}, [
|
|
103
104
|
open,
|
|
104
105
|
selectedIndex,
|
|
105
|
-
|
|
106
|
+
timeout,
|
|
107
|
+
onTyping
|
|
106
108
|
]);
|
|
107
109
|
const sharedProps = __rspack_external_react.useMemo(()=>({
|
|
108
110
|
onKeyDown,
|
|
@@ -119,7 +121,9 @@ function useTypeahead(context, props) {
|
|
|
119
121
|
sharedProps
|
|
120
122
|
]);
|
|
121
123
|
}
|
|
122
|
-
|
|
124
|
+
function isStationaryWebKitPointer(event) {
|
|
125
|
+
return webkit && 0 === event.movementX && 0 === event.movementY;
|
|
126
|
+
}
|
|
123
127
|
function doSwitch(orientation, vertical, horizontal) {
|
|
124
128
|
switch(orientation){
|
|
125
129
|
case 'vertical':
|
|
@@ -145,22 +149,22 @@ function isCrossOrientationOpenKey(key, orientation, rtl) {
|
|
|
145
149
|
const horizontal = key === ARROW_DOWN;
|
|
146
150
|
return doSwitch(orientation, vertical, horizontal);
|
|
147
151
|
}
|
|
148
|
-
function isCrossOrientationCloseKey(key, orientation, rtl,
|
|
152
|
+
function isCrossOrientationCloseKey(key, orientation, rtl, grid) {
|
|
149
153
|
const vertical = rtl ? key === ARROW_RIGHT : key === ARROW_LEFT;
|
|
150
154
|
const horizontal = key === ARROW_UP;
|
|
151
|
-
if ('both' === orientation || 'horizontal' === orientation &&
|
|
155
|
+
if ('both' === orientation || 'horizontal' === orientation && grid) return 'Escape' === key;
|
|
152
156
|
return doSwitch(orientation, vertical, horizontal);
|
|
153
157
|
}
|
|
154
|
-
function useListNavigation(
|
|
155
|
-
const { listRef, activeIndex, onNavigate: onNavigateProp = ()=>{}, enabled = true, selectedIndex = null, allowEscape = false, loopFocus = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = 'auto', focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices, orientation = 'vertical',
|
|
158
|
+
function useListNavigation(store, props) {
|
|
159
|
+
const { listRef, activeIndex, onNavigate: onNavigateProp = ()=>{}, enabled = true, selectedIndex = null, allowEscape = false, loopFocus = false, nested = false, rtl = false, virtual = false, focusItemOnOpen = 'auto', focusItemOnHover = true, openOnArrowKeyDown = true, disabledIndices, orientation = 'vertical', triggerOrientation = orientation, parentOrientation, id, resetOnPointerLeave = true, externalTree, nestedReturnFocusRef, grid: navigateGrid } = props;
|
|
160
|
+
const isGrid = null != navigateGrid;
|
|
156
161
|
if ('production' !== process.env.NODE_ENV) {
|
|
157
162
|
if (allowEscape) {
|
|
158
163
|
if (!loopFocus) console.warn('`useListNavigation` looping must be enabled to allow escaping.');
|
|
159
164
|
if (!virtual) console.warn('`useListNavigation` must be virtual to allow escaping.');
|
|
160
165
|
}
|
|
161
|
-
if ('vertical' === orientation &&
|
|
166
|
+
if ('vertical' === orientation && isGrid) console.warn('In grid list navigation mode, the `orientation` should', 'be either "horizontal" or "both".');
|
|
162
167
|
}
|
|
163
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
164
168
|
const open = store.useState('open');
|
|
165
169
|
const floatingElement = store.useState('floatingElement');
|
|
166
170
|
const domReferenceElement = store.useState('domReferenceElement');
|
|
@@ -177,7 +181,6 @@ function useListNavigation(context, props) {
|
|
|
177
181
|
const onNavigate = useStableCallback((event)=>{
|
|
178
182
|
onNavigateProp(-1 === indexRef.current ? null : indexRef.current, event);
|
|
179
183
|
});
|
|
180
|
-
const previousOnNavigateRef = __rspack_external_react.useRef(onNavigate);
|
|
181
184
|
const previousMountedRef = __rspack_external_react.useRef(!!floatingElement);
|
|
182
185
|
const previousOpenRef = __rspack_external_react.useRef(open);
|
|
183
186
|
const forceSyncFocusRef = __rspack_external_react.useRef(false);
|
|
@@ -190,9 +193,9 @@ function useListNavigation(context, props) {
|
|
|
190
193
|
const focusFrame = useAnimationFrame();
|
|
191
194
|
const waitForListPopulatedFrame = useAnimationFrame();
|
|
192
195
|
const focusItem = useStableCallback(()=>{
|
|
196
|
+
focusFrame.cancel();
|
|
193
197
|
function runFocus(item) {
|
|
194
|
-
if (virtual)
|
|
195
|
-
else cancelQueuedFocusRef.current = enqueueFocus(item, {
|
|
198
|
+
if (!virtual) cancelQueuedFocusRef.current = enqueueFocus(item, {
|
|
196
199
|
sync: forceSyncFocusRef.current,
|
|
197
200
|
preventScroll: true
|
|
198
201
|
});
|
|
@@ -218,6 +221,13 @@ function useListNavigation(context, props) {
|
|
|
218
221
|
dataRef,
|
|
219
222
|
orientation
|
|
220
223
|
]);
|
|
224
|
+
useIsoLayoutEffect(()=>{
|
|
225
|
+
if (!open) keyRef.current = null;
|
|
226
|
+
if (!open || 'auto' !== focusItemOnOpen) focusItemOnOpenRef.current = focusItemOnOpen;
|
|
227
|
+
}, [
|
|
228
|
+
open,
|
|
229
|
+
focusItemOnOpen
|
|
230
|
+
]);
|
|
221
231
|
useIsoLayoutEffect(()=>{
|
|
222
232
|
if (!enabled) return;
|
|
223
233
|
if (open && floatingElement) {
|
|
@@ -228,7 +238,7 @@ function useListNavigation(context, props) {
|
|
|
228
238
|
}
|
|
229
239
|
} else if (previousMountedRef.current) {
|
|
230
240
|
indexRef.current = -1;
|
|
231
|
-
|
|
241
|
+
onNavigate();
|
|
232
242
|
}
|
|
233
243
|
}, [
|
|
234
244
|
enabled,
|
|
@@ -261,7 +271,7 @@ function useListNavigation(context, props) {
|
|
|
261
271
|
}
|
|
262
272
|
runs += 1;
|
|
263
273
|
} else {
|
|
264
|
-
indexRef.current = null == keyRef.current || isMainOrientationToEndKey(keyRef.current,
|
|
274
|
+
indexRef.current = null == keyRef.current || isMainOrientationToEndKey(keyRef.current, triggerOrientation, rtl) || nested ? getMinListIndex(listRef) : getMaxListIndex(listRef);
|
|
265
275
|
keyRef.current = null;
|
|
266
276
|
onNavigate();
|
|
267
277
|
}
|
|
@@ -281,7 +291,7 @@ function useListNavigation(context, props) {
|
|
|
281
291
|
selectedIndexRef,
|
|
282
292
|
nested,
|
|
283
293
|
listRef,
|
|
284
|
-
|
|
294
|
+
triggerOrientation,
|
|
285
295
|
rtl,
|
|
286
296
|
onNavigate,
|
|
287
297
|
focusItem,
|
|
@@ -291,7 +301,7 @@ function useListNavigation(context, props) {
|
|
|
291
301
|
if (!enabled || floatingElement || !tree || virtual || !previousMountedRef.current) return;
|
|
292
302
|
const nodes = tree.nodesRef.current;
|
|
293
303
|
const parent = nodes.find((node)=>node.id === parentId)?.context?.elements.floating;
|
|
294
|
-
const activeEl = activeElement(ownerDocument(
|
|
304
|
+
const activeEl = activeElement(ownerDocument(domReferenceElement ?? parent ?? null));
|
|
295
305
|
const treeContainsActiveEl = nodes.some((node)=>node.context && contains(node.context.elements.floating, activeEl));
|
|
296
306
|
if (parent && !treeContainsActiveEl && isPointerModalityRef.current) parent.focus({
|
|
297
307
|
preventScroll: true
|
|
@@ -299,24 +309,15 @@ function useListNavigation(context, props) {
|
|
|
299
309
|
}, [
|
|
300
310
|
enabled,
|
|
301
311
|
floatingElement,
|
|
312
|
+
domReferenceElement,
|
|
302
313
|
tree,
|
|
303
314
|
parentId,
|
|
304
315
|
virtual
|
|
305
316
|
]);
|
|
306
317
|
useIsoLayoutEffect(()=>{
|
|
307
|
-
previousOnNavigateRef.current = onNavigate;
|
|
308
318
|
previousOpenRef.current = open;
|
|
309
319
|
previousMountedRef.current = !!floatingElement;
|
|
310
320
|
});
|
|
311
|
-
useIsoLayoutEffect(()=>{
|
|
312
|
-
if (!open) {
|
|
313
|
-
keyRef.current = null;
|
|
314
|
-
focusItemOnOpenRef.current = focusItemOnOpen;
|
|
315
|
-
}
|
|
316
|
-
}, [
|
|
317
|
-
open,
|
|
318
|
-
focusItemOnOpen
|
|
319
|
-
]);
|
|
320
321
|
const hasActiveIndex = null != activeIndex;
|
|
321
322
|
const syncCurrentTarget = useStableCallback((event)=>{
|
|
322
323
|
if (!latestOpenRef.current) return;
|
|
@@ -333,13 +334,14 @@ function useListNavigation(context, props) {
|
|
|
333
334
|
forceSyncFocusRef.current = true;
|
|
334
335
|
if (229 === event.which) return;
|
|
335
336
|
if (!latestOpenRef.current && event.currentTarget === floatingFocusElementRef.current) return;
|
|
336
|
-
if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl,
|
|
337
|
+
if (nested && isCrossOrientationCloseKey(event.key, orientation, rtl, isGrid)) {
|
|
337
338
|
if (!isMainOrientationKey(event.key, getParentOrientation())) stopEvent(event);
|
|
338
339
|
store.setOpen(false, createChangeEventDetails(listNavigation, event.nativeEvent));
|
|
339
|
-
|
|
340
|
-
|
|
340
|
+
const returnElement = nestedReturnFocusRef?.current ?? domReferenceElement;
|
|
341
|
+
if (isHTMLElement(returnElement)) returnElement.focus();
|
|
341
342
|
return;
|
|
342
343
|
}
|
|
344
|
+
if (null != activeIndex && activeIndex !== indexRef.current && !isIndexOutOfListBounds(listRef.current, activeIndex)) indexRef.current = activeIndex;
|
|
343
345
|
const currentIndex = indexRef.current;
|
|
344
346
|
const minIndex = getMinListIndex(listRef, disabledIndices);
|
|
345
347
|
const maxIndex = getMaxListIndex(listRef, disabledIndices);
|
|
@@ -355,32 +357,9 @@ function useListNavigation(context, props) {
|
|
|
355
357
|
onNavigate(event);
|
|
356
358
|
}
|
|
357
359
|
}
|
|
358
|
-
if (
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
}, ()=>({
|
|
362
|
-
width: 1,
|
|
363
|
-
height: 1
|
|
364
|
-
}));
|
|
365
|
-
const cellMap = createGridCellMap(sizes, cols, false);
|
|
366
|
-
const minGridIndex = cellMap.findIndex((index)=>null != index && !isListIndexDisabled(listRef.current, index, disabledIndices));
|
|
367
|
-
const maxGridIndex = cellMap.reduce((foundIndex, index, cellIndex)=>null == index || isListIndexDisabled(listRef.current, index, disabledIndices) ? foundIndex : cellIndex, -1);
|
|
368
|
-
const index = cellMap[getGridNavigatedIndex(cellMap.map((itemIndex)=>null != itemIndex ? listRef.current[itemIndex] : null), {
|
|
369
|
-
event,
|
|
370
|
-
orientation,
|
|
371
|
-
loopFocus,
|
|
372
|
-
rtl,
|
|
373
|
-
cols,
|
|
374
|
-
disabledIndices: getGridCellIndices([
|
|
375
|
-
...('function' != typeof disabledIndices ? disabledIndices : null) || listRef.current.map((_, listIndex)=>isListIndexDisabled(listRef.current, listIndex, disabledIndices) ? listIndex : void 0),
|
|
376
|
-
void 0
|
|
377
|
-
], cellMap),
|
|
378
|
-
minIndex: minGridIndex,
|
|
379
|
-
maxIndex: maxGridIndex,
|
|
380
|
-
prevIndex: getGridCellIndexOfCorner(indexRef.current > maxIndex ? minIndex : indexRef.current, sizes, cellMap, cols, event.key === ARROW_DOWN ? 'bl' : event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT) ? 'tr' : 'tl'),
|
|
381
|
-
stopEvent: true
|
|
382
|
-
})];
|
|
383
|
-
if (null != index) {
|
|
360
|
+
if (null != navigateGrid) {
|
|
361
|
+
const index = navigateGrid(event, indexRef.current, listRef, orientation, loopFocus, rtl, disabledIndices, minIndex, maxIndex);
|
|
362
|
+
if (null != index && index !== indexRef.current) {
|
|
384
363
|
indexRef.current = index;
|
|
385
364
|
onNavigate(event);
|
|
386
365
|
}
|
|
@@ -388,40 +367,23 @@ function useListNavigation(context, props) {
|
|
|
388
367
|
}
|
|
389
368
|
if (isMainOrientationKey(event.key, orientation)) {
|
|
390
369
|
stopEvent(event);
|
|
391
|
-
|
|
370
|
+
const focusedElement = activeElement(event.currentTarget.ownerDocument);
|
|
371
|
+
if (open && !virtual && contains(event.currentTarget, focusedElement) && !listRef.current.some((item)=>null != item && contains(item, focusedElement))) {
|
|
392
372
|
indexRef.current = isMainOrientationToEndKey(event.key, orientation, rtl) ? minIndex : maxIndex;
|
|
393
373
|
onNavigate(event);
|
|
374
|
+
if (activeIndex === indexRef.current) focusItem();
|
|
394
375
|
return;
|
|
395
376
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
disabledIndices
|
|
404
|
-
});
|
|
405
|
-
else indexRef.current = Math.min(maxIndex, findNonDisabledListIndex(listRef.current, {
|
|
406
|
-
startingIndex: currentIndex,
|
|
407
|
-
disabledIndices
|
|
408
|
-
}));
|
|
409
|
-
else if (loopFocus) if (currentIndex <= minIndex) if (allowEscape && -1 !== currentIndex) indexRef.current = listRef.current.length;
|
|
410
|
-
else {
|
|
411
|
-
forceSyncFocusRef.current = false;
|
|
412
|
-
indexRef.current = maxIndex;
|
|
413
|
-
}
|
|
414
|
-
else indexRef.current = findNonDisabledListIndex(listRef.current, {
|
|
415
|
-
startingIndex: currentIndex,
|
|
416
|
-
decrement: true,
|
|
417
|
-
disabledIndices
|
|
377
|
+
const { index, wrapped } = getNextListIndex(listRef.current, currentIndex, {
|
|
378
|
+
decrement: !isMainOrientationToEndKey(event.key, orientation, rtl),
|
|
379
|
+
loopFocus,
|
|
380
|
+
allowEscape,
|
|
381
|
+
disabledIndices,
|
|
382
|
+
minIndex,
|
|
383
|
+
maxIndex
|
|
418
384
|
});
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
decrement: true,
|
|
422
|
-
disabledIndices
|
|
423
|
-
}));
|
|
424
|
-
if (isIndexOutOfListBounds(listRef.current, indexRef.current)) indexRef.current = -1;
|
|
385
|
+
if (wrapped) forceSyncFocusRef.current = false;
|
|
386
|
+
indexRef.current = index;
|
|
425
387
|
onNavigate(event);
|
|
426
388
|
}
|
|
427
389
|
});
|
|
@@ -431,10 +393,13 @@ function useListNavigation(context, props) {
|
|
|
431
393
|
forceSyncFocusRef.current = true;
|
|
432
394
|
syncCurrentTarget(event);
|
|
433
395
|
},
|
|
434
|
-
onClick
|
|
396
|
+
onClick ({ currentTarget }) {
|
|
397
|
+
if (!virtual) currentTarget.focus({
|
|
435
398
|
preventScroll: true
|
|
436
|
-
})
|
|
399
|
+
});
|
|
400
|
+
},
|
|
437
401
|
onMouseMove (event) {
|
|
402
|
+
if (isStationaryWebKitPointer(event)) return;
|
|
438
403
|
forceSyncFocusRef.current = true;
|
|
439
404
|
forceScrollIntoViewRef.current = false;
|
|
440
405
|
if (focusItemOnHover) syncCurrentTarget(event);
|
|
@@ -479,32 +444,34 @@ function useListNavigation(context, props) {
|
|
|
479
444
|
activeIndex
|
|
480
445
|
]);
|
|
481
446
|
const floating = __rspack_external_react.useMemo(()=>({
|
|
482
|
-
'aria-orientation': 'both' === orientation ? void 0 : orientation,
|
|
483
447
|
...!typeableComboboxReference ? ariaActiveDescendantProp : {},
|
|
484
448
|
onKeyDown (event) {
|
|
485
449
|
if ('Tab' === event.key && event.shiftKey && open && !virtual) {
|
|
486
450
|
const target = getTarget(event.nativeEvent);
|
|
487
451
|
if (target && !contains(floatingFocusElementRef.current, target)) return;
|
|
488
452
|
stopEvent(event);
|
|
489
|
-
|
|
490
|
-
|
|
453
|
+
const details = createChangeEventDetails(focusOut, event.nativeEvent);
|
|
454
|
+
store.setOpen(false, details);
|
|
455
|
+
const returnElement = nestedReturnFocusRef?.current ?? domReferenceElement;
|
|
456
|
+
if (!details.isCanceled && isHTMLElement(returnElement)) returnElement.focus();
|
|
491
457
|
return;
|
|
492
458
|
}
|
|
493
459
|
commonOnKeyDown(event);
|
|
494
460
|
},
|
|
495
|
-
onPointerMove () {
|
|
461
|
+
onPointerMove (event) {
|
|
462
|
+
if (isStationaryWebKitPointer(event)) return;
|
|
496
463
|
isPointerModalityRef.current = true;
|
|
497
464
|
}
|
|
498
465
|
}), [
|
|
499
466
|
ariaActiveDescendantProp,
|
|
500
467
|
commonOnKeyDown,
|
|
501
468
|
floatingFocusElementRef,
|
|
502
|
-
orientation,
|
|
503
469
|
typeableComboboxReference,
|
|
504
470
|
store,
|
|
505
471
|
open,
|
|
506
472
|
virtual,
|
|
507
|
-
domReferenceElement
|
|
473
|
+
domReferenceElement,
|
|
474
|
+
nestedReturnFocusRef
|
|
508
475
|
]);
|
|
509
476
|
const trigger = __rspack_external_react.useMemo(()=>{
|
|
510
477
|
function openOnNavigationKeyDown(event) {
|
|
@@ -523,9 +490,9 @@ function useListNavigation(context, props) {
|
|
|
523
490
|
isPointerModalityRef.current = false;
|
|
524
491
|
const isArrowKey = event.key.startsWith('Arrow');
|
|
525
492
|
const isParentCrossOpenKey = isCrossOrientationOpenKey(event.key, getParentOrientation(), rtl);
|
|
526
|
-
const isMainKey = isMainOrientationKey(event.key, orientation);
|
|
493
|
+
const isMainKey = isMainOrientationKey(event.key, currentOpen ? orientation : triggerOrientation);
|
|
527
494
|
const isNavigationKey = (nested ? isParentCrossOpenKey : isMainKey) || 'Enter' === event.key || '' === event.key.trim();
|
|
528
|
-
if (virtual && currentOpen) return commonOnKeyDown(event);
|
|
495
|
+
if (virtual && currentOpen && (!nested || isTypeableElement(event.currentTarget))) return commonOnKeyDown(event);
|
|
529
496
|
if (!currentOpen && !openOnArrowKeyDown && isArrowKey) return;
|
|
530
497
|
if (isNavigationKey) {
|
|
531
498
|
const isParentMainKey = isMainOrientationKey(event.key, getParentOrientation());
|
|
@@ -537,6 +504,7 @@ function useListNavigation(context, props) {
|
|
|
537
504
|
if (currentOpen) {
|
|
538
505
|
indexRef.current = getMinEnabledIndex();
|
|
539
506
|
onNavigate(event);
|
|
507
|
+
if (virtual) floatingFocusElementRef.current?.focus();
|
|
540
508
|
} else openOnNavigationKeyDown(event);
|
|
541
509
|
}
|
|
542
510
|
return;
|
|
@@ -550,6 +518,7 @@ function useListNavigation(context, props) {
|
|
|
550
518
|
}
|
|
551
519
|
},
|
|
552
520
|
onFocus (event) {
|
|
521
|
+
if (event.target !== event.currentTarget) return;
|
|
553
522
|
if (store.select('open') && !virtual) {
|
|
554
523
|
indexRef.current = -1;
|
|
555
524
|
onNavigate(event);
|
|
@@ -569,10 +538,12 @@ function useListNavigation(context, props) {
|
|
|
569
538
|
store,
|
|
570
539
|
openOnArrowKeyDown,
|
|
571
540
|
orientation,
|
|
541
|
+
triggerOrientation,
|
|
572
542
|
getParentOrientation,
|
|
573
543
|
rtl,
|
|
574
544
|
selectedIndexRef,
|
|
575
|
-
virtual
|
|
545
|
+
virtual,
|
|
546
|
+
floatingFocusElementRef
|
|
576
547
|
]);
|
|
577
548
|
const reference = __rspack_external_react.useMemo(()=>({
|
|
578
549
|
...ariaActiveDescendantProp,
|
package/dist/{3056.js → 1607.js}
RENAMED
|
@@ -1,35 +1,33 @@
|
|
|
1
|
-
import { Timeout, useTimeout } from "./
|
|
2
|
-
import { useRefWithInit } from "./
|
|
3
|
-
import { useOnMount } from "./
|
|
4
|
-
import { isMouseLikePointerType } from "./
|
|
5
|
-
import { useFloatingTree, useFloatingParentNodeId } from "./
|
|
6
|
-
import { useStableCallback } from "./
|
|
7
|
-
import { useIsoLayoutEffect } from "./
|
|
1
|
+
import { Timeout, useTimeout } from "./9197.js";
|
|
2
|
+
import { useRefWithInit } from "./9591.js";
|
|
3
|
+
import { useOnMount } from "./9120.js";
|
|
4
|
+
import { isMouseLikePointerType } from "./8358.js";
|
|
5
|
+
import { useFloatingTree, useFloatingParentNodeId } from "./4472.js";
|
|
6
|
+
import { useStableCallback } from "./7488.js";
|
|
7
|
+
import { useIsoLayoutEffect } from "./3357.js";
|
|
8
8
|
import { isElement } from "./3829.js";
|
|
9
|
-
import { ownerDocument } from "./
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { isTargetInsideEnabledTrigger, isInteractiveElement } from "./
|
|
15
|
-
import { mergeCleanups } from "./
|
|
16
|
-
import { addEventListener } from "./
|
|
9
|
+
import { ownerDocument } from "./6488.js";
|
|
10
|
+
import { closest, getTarget, contains } from "./4155.js";
|
|
11
|
+
import { getNodeChildren } from "./4346.js";
|
|
12
|
+
import { createChangeEventDetails } from "./8495.js";
|
|
13
|
+
import { triggerHover } from "./9837.js";
|
|
14
|
+
import { isTargetInsideEnabledTrigger, isInteractiveElement } from "./6137.js";
|
|
15
|
+
import { mergeCleanups } from "./7718.js";
|
|
16
|
+
import { addEventListener } from "./1282.js";
|
|
17
17
|
import * as __rspack_external_react from "react";
|
|
18
18
|
class HoverInteraction {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
this.handleCloseOptions = void 0;
|
|
32
|
-
}
|
|
19
|
+
pointerType = void 0;
|
|
20
|
+
interactedInside = false;
|
|
21
|
+
handler = void 0;
|
|
22
|
+
blockMouseMove = true;
|
|
23
|
+
performedPointerEventsMutation = false;
|
|
24
|
+
pointerEventsScopeElement = null;
|
|
25
|
+
pointerEventsReferenceElement = null;
|
|
26
|
+
pointerEventsFloatingElement = null;
|
|
27
|
+
restTimeoutPending = false;
|
|
28
|
+
openChangeTimeout = new Timeout();
|
|
29
|
+
restTimeout = new Timeout();
|
|
30
|
+
handleCloseOptions = void 0;
|
|
33
31
|
static create() {
|
|
34
32
|
return new HoverInteraction();
|
|
35
33
|
}
|
|
@@ -95,9 +93,8 @@ function useHoverShared_isClickLikeOpenEvent(openEventType, interactedInside) {
|
|
|
95
93
|
function isHoverOpenEvent(openEventType) {
|
|
96
94
|
return openEventType?.includes('mouse') && 'mousedown' !== openEventType;
|
|
97
95
|
}
|
|
98
|
-
function useHoverFloatingInteraction(
|
|
96
|
+
function useHoverFloatingInteraction(store, parameters = {}) {
|
|
99
97
|
const { enabled = true, closeDelay: closeDelayProp = 0, nodeId: nodeIdProp } = parameters;
|
|
100
|
-
const store = 'rootStore' in context ? context.rootStore : context;
|
|
101
98
|
const open = store.useState('open');
|
|
102
99
|
const floatingElement = store.useState('floatingElement');
|
|
103
100
|
const domReferenceElement = store.useState('domReferenceElement');
|
|
@@ -136,7 +133,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
|
|
|
136
133
|
if (parentFloating) parentFloating.style.pointerEvents = '';
|
|
137
134
|
const cachedScopeElement = instance.pointerEventsScopeElement !== floatingEl ? instance.pointerEventsScopeElement : null;
|
|
138
135
|
const parentScopeElement = parentFloating !== floatingEl ? parentFloating : null;
|
|
139
|
-
const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ??
|
|
136
|
+
const scopeElement = instance.handleCloseOptions?.getScope?.() ?? cachedScopeElement ?? parentScopeElement ?? closest(ref, '[data-rootownerid]') ?? doc.body;
|
|
140
137
|
applySafePolygonPointerEventsMutation(instance, {
|
|
141
138
|
scopeElement,
|
|
142
139
|
referenceElement: ref,
|
|
@@ -180,7 +177,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
|
|
|
180
177
|
instance.interactedInside = false;
|
|
181
178
|
return;
|
|
182
179
|
}
|
|
183
|
-
instance.interactedInside =
|
|
180
|
+
instance.interactedInside = null != closest(target, '[aria-haspopup]');
|
|
184
181
|
}
|
|
185
182
|
function onFloatingMouseEnter() {
|
|
186
183
|
instance.openChangeTimeout.clear();
|
|
@@ -197,7 +194,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
|
|
|
197
194
|
if (isMovingIntoDescendantFloating) return;
|
|
198
195
|
if (instance.handler) return void instance.handler(event);
|
|
199
196
|
clearPointerEvents();
|
|
200
|
-
if (!isClickLikeOpenEvent()) closeWithDelay(event);
|
|
197
|
+
if (isHoverOpen() && !isClickLikeOpenEvent()) closeWithDelay(event);
|
|
201
198
|
}
|
|
202
199
|
function onNodeClosed(event) {
|
|
203
200
|
if (!tree || !parentId || hasParentChildren()) return;
|
|
@@ -218,6 +215,7 @@ function useHoverFloatingInteraction(context, parameters = {}) {
|
|
|
218
215
|
dataRef,
|
|
219
216
|
closeDelayProp,
|
|
220
217
|
nodeIdProp,
|
|
218
|
+
isHoverOpen,
|
|
221
219
|
isClickLikeOpenEvent,
|
|
222
220
|
clearPointerEvents,
|
|
223
221
|
instance,
|
package/dist/1629.js
ADDED