@react-aria/menu 3.14.1-nightly.4624 → 3.14.1
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/useMenu.main.js +4 -4
- package/dist/useMenu.mjs +4 -4
- package/dist/useMenu.module.js +4 -4
- package/dist/useMenuItem.main.js +23 -23
- package/dist/useMenuItem.mjs +23 -23
- package/dist/useMenuItem.module.js +23 -23
- package/dist/useMenuSection.main.js +6 -6
- package/dist/useMenuSection.mjs +6 -6
- package/dist/useMenuSection.module.js +6 -6
- package/dist/useMenuTrigger.main.js +21 -21
- package/dist/useMenuTrigger.mjs +21 -21
- package/dist/useMenuTrigger.module.js +21 -21
- package/dist/useSafelyMouseToSubmenu.main.js +10 -10
- package/dist/useSafelyMouseToSubmenu.mjs +10 -10
- package/dist/useSafelyMouseToSubmenu.module.js +10 -10
- package/dist/useSubmenuTrigger.main.js +23 -23
- package/dist/useSubmenuTrigger.mjs +23 -23
- package/dist/useSubmenuTrigger.module.js +23 -23
- package/package.json +14 -14
|
@@ -18,7 +18,7 @@ import {useLocale as $dXlYe$useLocale} from "@react-aria/i18n";
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) {
|
|
21
|
-
let { parentMenuRef: parentMenuRef, submenuRef: submenuRef, type: type =
|
|
21
|
+
let { parentMenuRef: parentMenuRef, submenuRef: submenuRef, type: type = 'menu', isDisabled: isDisabled, node: node, delay: delay = 200 } = props;
|
|
22
22
|
let submenuTriggerId = (0, $dXlYe$useId)();
|
|
23
23
|
let overlayId = (0, $dXlYe$useId)();
|
|
24
24
|
let { direction: direction } = (0, $dXlYe$useLocale)();
|
|
@@ -48,21 +48,21 @@ function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) {
|
|
|
48
48
|
]);
|
|
49
49
|
let submenuKeyDown = (e)=>{
|
|
50
50
|
switch(e.key){
|
|
51
|
-
case
|
|
52
|
-
if (direction ===
|
|
51
|
+
case 'ArrowLeft':
|
|
52
|
+
if (direction === 'ltr' && e.currentTarget.contains(e.target)) {
|
|
53
53
|
e.stopPropagation();
|
|
54
54
|
onSubmenuClose();
|
|
55
55
|
ref.current.focus();
|
|
56
56
|
}
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
59
|
-
if (direction ===
|
|
58
|
+
case 'ArrowRight':
|
|
59
|
+
if (direction === 'rtl' && e.currentTarget.contains(e.target)) {
|
|
60
60
|
e.stopPropagation();
|
|
61
61
|
onSubmenuClose();
|
|
62
62
|
ref.current.focus();
|
|
63
63
|
}
|
|
64
64
|
break;
|
|
65
|
-
case
|
|
65
|
+
case 'Escape':
|
|
66
66
|
e.stopPropagation();
|
|
67
67
|
state.closeAll();
|
|
68
68
|
break;
|
|
@@ -70,9 +70,9 @@ function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) {
|
|
|
70
70
|
};
|
|
71
71
|
let submenuProps = {
|
|
72
72
|
id: overlayId,
|
|
73
|
-
|
|
73
|
+
'aria-label': node.textValue,
|
|
74
74
|
submenuLevel: state.submenuLevel,
|
|
75
|
-
...type ===
|
|
75
|
+
...type === 'menu' && {
|
|
76
76
|
onClose: state.closeAll,
|
|
77
77
|
autoFocus: state.focusStrategy,
|
|
78
78
|
onKeyDown: submenuKeyDown
|
|
@@ -80,25 +80,25 @@ function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) {
|
|
|
80
80
|
};
|
|
81
81
|
let submenuTriggerKeyDown = (e)=>{
|
|
82
82
|
switch(e.key){
|
|
83
|
-
case
|
|
83
|
+
case 'ArrowRight':
|
|
84
84
|
if (!isDisabled) {
|
|
85
|
-
if (direction ===
|
|
86
|
-
if (!state.isOpen) onSubmenuOpen(
|
|
87
|
-
if (type ===
|
|
85
|
+
if (direction === 'ltr') {
|
|
86
|
+
if (!state.isOpen) onSubmenuOpen('first');
|
|
87
|
+
if (type === 'menu' && !!(submenuRef === null || submenuRef === void 0 ? void 0 : submenuRef.current) && document.activeElement === (ref === null || ref === void 0 ? void 0 : ref.current)) submenuRef.current.focus();
|
|
88
88
|
} else if (state.isOpen) onSubmenuClose();
|
|
89
89
|
else e.continuePropagation();
|
|
90
90
|
}
|
|
91
91
|
break;
|
|
92
|
-
case
|
|
92
|
+
case 'ArrowLeft':
|
|
93
93
|
if (!isDisabled) {
|
|
94
|
-
if (direction ===
|
|
95
|
-
if (!state.isOpen) onSubmenuOpen(
|
|
96
|
-
if (type ===
|
|
94
|
+
if (direction === 'rtl') {
|
|
95
|
+
if (!state.isOpen) onSubmenuOpen('first');
|
|
96
|
+
if (type === 'menu' && !!(submenuRef === null || submenuRef === void 0 ? void 0 : submenuRef.current) && document.activeElement === (ref === null || ref === void 0 ? void 0 : ref.current)) submenuRef.current.focus();
|
|
97
97
|
} else if (state.isOpen) onSubmenuClose();
|
|
98
98
|
else e.continuePropagation();
|
|
99
99
|
}
|
|
100
100
|
break;
|
|
101
|
-
case
|
|
101
|
+
case 'Escape':
|
|
102
102
|
state.closeAll();
|
|
103
103
|
break;
|
|
104
104
|
default:
|
|
@@ -107,11 +107,11 @@ function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) {
|
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
109
|
let onPressStart = (e)=>{
|
|
110
|
-
if (!isDisabled && (e.pointerType ===
|
|
111
|
-
onSubmenuOpen(
|
|
110
|
+
if (!isDisabled && (e.pointerType === 'virtual' || e.pointerType === 'keyboard')) // If opened with a screen reader or keyboard, auto focus the first submenu item.
|
|
111
|
+
onSubmenuOpen('first');
|
|
112
112
|
};
|
|
113
113
|
let onPress = (e)=>{
|
|
114
|
-
if (!isDisabled && (e.pointerType ===
|
|
114
|
+
if (!isDisabled && (e.pointerType === 'touch' || e.pointerType === 'mouse')) // For touch or on a desktop device with a small screen open on press up to possible problems with
|
|
115
115
|
// press up happening on the newly opened tray items
|
|
116
116
|
onSubmenuOpen();
|
|
117
117
|
};
|
|
@@ -140,9 +140,9 @@ function $0065b146e7192841$export$7138b0d059a6e743(props, state, ref) {
|
|
|
140
140
|
return {
|
|
141
141
|
submenuTriggerProps: {
|
|
142
142
|
id: submenuTriggerId,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
'aria-controls': state.isOpen ? overlayId : undefined,
|
|
144
|
+
'aria-haspopup': !isDisabled ? type : undefined,
|
|
145
|
+
'aria-expanded': state.isOpen ? 'true' : 'false',
|
|
146
146
|
onPressStart: onPressStart,
|
|
147
147
|
onPress: onPress,
|
|
148
148
|
onHoverChange: onHoverChange,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/menu",
|
|
3
|
-
"version": "3.14.1
|
|
3
|
+
"version": "3.14.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@react-aria/focus": "3.
|
|
26
|
-
"@react-aria/i18n": "3.
|
|
27
|
-
"@react-aria/interactions": "3.
|
|
28
|
-
"@react-aria/overlays": "3.
|
|
29
|
-
"@react-aria/selection": "3.
|
|
30
|
-
"@react-aria/utils": "3.
|
|
31
|
-
"@react-stately/collections": "3.
|
|
32
|
-
"@react-stately/menu": "3.7.1
|
|
33
|
-
"@react-stately/tree": "3.
|
|
34
|
-
"@react-types/button": "3.9.4
|
|
35
|
-
"@react-types/menu": "3.9.9
|
|
36
|
-
"@react-types/shared": "3.
|
|
25
|
+
"@react-aria/focus": "^3.17.1",
|
|
26
|
+
"@react-aria/i18n": "^3.11.1",
|
|
27
|
+
"@react-aria/interactions": "^3.21.3",
|
|
28
|
+
"@react-aria/overlays": "^3.22.1",
|
|
29
|
+
"@react-aria/selection": "^3.18.1",
|
|
30
|
+
"@react-aria/utils": "^3.24.1",
|
|
31
|
+
"@react-stately/collections": "^3.10.7",
|
|
32
|
+
"@react-stately/menu": "^3.7.1",
|
|
33
|
+
"@react-stately/tree": "^3.8.1",
|
|
34
|
+
"@react-types/button": "^3.9.4",
|
|
35
|
+
"@react-types/menu": "^3.9.9",
|
|
36
|
+
"@react-types/shared": "^3.23.1",
|
|
37
37
|
"@swc/helpers": "^0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "b77d7d594dff4dcfb5359bffbcfd18142b146433"
|
|
47
47
|
}
|