@react-aria/menu 3.7.2-nightly.3696 → 3.7.2-nightly.3705
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/import.mjs +539 -0
- package/package.json +18 -13
package/dist/import.mjs
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
import {useId as $1Hnir$useId, filterDOMProps as $1Hnir$filterDOMProps, mergeProps as $1Hnir$mergeProps, useSlotId as $1Hnir$useSlotId} from "@react-aria/utils";
|
|
2
|
+
import {useLocalizedStringFormatter as $1Hnir$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
3
|
+
import {useLongPress as $1Hnir$useLongPress, usePress as $1Hnir$usePress, useHover as $1Hnir$useHover, isFocusVisible as $1Hnir$isFocusVisible} from "@react-aria/interactions";
|
|
4
|
+
import {useOverlayTrigger as $1Hnir$useOverlayTrigger} from "@react-aria/overlays";
|
|
5
|
+
import {useSelectableList as $1Hnir$useSelectableList, useSelectableItem as $1Hnir$useSelectableItem} from "@react-aria/selection";
|
|
6
|
+
import {getItemCount as $1Hnir$getItemCount} from "@react-stately/collections";
|
|
7
|
+
|
|
8
|
+
function $parcel$interopDefault(a) {
|
|
9
|
+
return a && a.__esModule ? a.default : a;
|
|
10
|
+
}
|
|
11
|
+
/*
|
|
12
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
13
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
14
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
15
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
*
|
|
17
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
18
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
19
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
20
|
+
* governing permissions and limitations under the License.
|
|
21
|
+
*/ /*
|
|
22
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
23
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
24
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
25
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
26
|
+
*
|
|
27
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
28
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
29
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
30
|
+
* governing permissions and limitations under the License.
|
|
31
|
+
*/ var $9bdd31893c9700c3$exports = {};
|
|
32
|
+
var $c0398ad35c3639b7$exports = {};
|
|
33
|
+
$c0398ad35c3639b7$exports = {
|
|
34
|
+
"longPressMessage": `اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة`
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
var $7af657c4165927c3$exports = {};
|
|
39
|
+
$7af657c4165927c3$exports = {
|
|
40
|
+
"longPressMessage": `Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто`
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
var $d95d4da6d531ab81$exports = {};
|
|
45
|
+
$d95d4da6d531ab81$exports = {
|
|
46
|
+
"longPressMessage": `Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku`
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
var $24ebda9c775dca17$exports = {};
|
|
51
|
+
$24ebda9c775dca17$exports = {
|
|
52
|
+
"longPressMessage": `Langt tryk eller tryk på Alt + pil ned for at åbne menuen`
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
var $743e0dfca6cab1e9$exports = {};
|
|
57
|
+
$743e0dfca6cab1e9$exports = {
|
|
58
|
+
"longPressMessage": `Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen`
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
var $a2f41026e05f1c84$exports = {};
|
|
63
|
+
$a2f41026e05f1c84$exports = {
|
|
64
|
+
"longPressMessage": `Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού`
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var $43b800e97c901737$exports = {};
|
|
69
|
+
$43b800e97c901737$exports = {
|
|
70
|
+
"longPressMessage": `Long press or press Alt + ArrowDown to open menu`
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
var $442f5f6ac211e29f$exports = {};
|
|
75
|
+
$442f5f6ac211e29f$exports = {
|
|
76
|
+
"longPressMessage": `Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú`
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
var $dff280acfeb2d8ac$exports = {};
|
|
81
|
+
$dff280acfeb2d8ac$exports = {
|
|
82
|
+
"longPressMessage": `Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool`
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
var $51608325613944d7$exports = {};
|
|
87
|
+
$51608325613944d7$exports = {
|
|
88
|
+
"longPressMessage": `Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli`
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
var $c4a1b1eabeaa87be$exports = {};
|
|
93
|
+
$c4a1b1eabeaa87be$exports = {
|
|
94
|
+
"longPressMessage": `Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.`
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
var $8c74815cdee18d1b$exports = {};
|
|
99
|
+
$8c74815cdee18d1b$exports = {
|
|
100
|
+
"longPressMessage": `לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט`
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
var $fd0e9ef6a7fe0ec9$exports = {};
|
|
105
|
+
$fd0e9ef6a7fe0ec9$exports = {
|
|
106
|
+
"longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika`
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
var $a89a74a39eba465a$exports = {};
|
|
111
|
+
$a89a74a39eba465a$exports = {
|
|
112
|
+
"longPressMessage": `Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához`
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
var $edc7c66594a0ae8a$exports = {};
|
|
117
|
+
$edc7c66594a0ae8a$exports = {
|
|
118
|
+
"longPressMessage": `Premere a lungo o premere Alt + Freccia giù per aprire il menu`
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
var $f1ab51510712db52$exports = {};
|
|
123
|
+
$f1ab51510712db52$exports = {
|
|
124
|
+
"longPressMessage": `長押しまたは Alt+下矢印キーでメニューを開く`
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
var $f9b672d9b82fa3d6$exports = {};
|
|
129
|
+
$f9b672d9b82fa3d6$exports = {
|
|
130
|
+
"longPressMessage": `길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기`
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
var $a385f3910feda499$exports = {};
|
|
135
|
+
$a385f3910feda499$exports = {
|
|
136
|
+
"longPressMessage": `Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.`
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
var $4f1bde932c441789$exports = {};
|
|
141
|
+
$4f1bde932c441789$exports = {
|
|
142
|
+
"longPressMessage": `Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa`
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
var $914a51a8a594d5be$exports = {};
|
|
147
|
+
$914a51a8a594d5be$exports = {
|
|
148
|
+
"longPressMessage": `Langt trykk eller trykk Alt + PilNed for å åpne menyen`
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
var $89aaf803103bb500$exports = {};
|
|
153
|
+
$89aaf803103bb500$exports = {
|
|
154
|
+
"longPressMessage": `Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen`
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
var $c685891476dbaaca$exports = {};
|
|
159
|
+
$c685891476dbaaca$exports = {
|
|
160
|
+
"longPressMessage": `Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu`
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
var $885879b9b10c2959$exports = {};
|
|
165
|
+
$885879b9b10c2959$exports = {
|
|
166
|
+
"longPressMessage": `Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu`
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
var $6b39616688a51692$exports = {};
|
|
171
|
+
$6b39616688a51692$exports = {
|
|
172
|
+
"longPressMessage": `Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu`
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
var $f26362aed63f47e2$exports = {};
|
|
177
|
+
$f26362aed63f47e2$exports = {
|
|
178
|
+
"longPressMessage": `Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul`
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
var $06cbade644558bf0$exports = {};
|
|
183
|
+
$06cbade644558bf0$exports = {
|
|
184
|
+
"longPressMessage": `Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню`
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
var $0a391ff68f9d59b1$exports = {};
|
|
189
|
+
$0a391ff68f9d59b1$exports = {
|
|
190
|
+
"longPressMessage": `Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol`
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
var $8193cf0e649c7928$exports = {};
|
|
195
|
+
$8193cf0e649c7928$exports = {
|
|
196
|
+
"longPressMessage": `Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol`
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
var $f398debcce5a5c55$exports = {};
|
|
201
|
+
$f398debcce5a5c55$exports = {
|
|
202
|
+
"longPressMessage": `Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni`
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
var $9e9fef000aa4c013$exports = {};
|
|
207
|
+
$9e9fef000aa4c013$exports = {
|
|
208
|
+
"longPressMessage": `Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn`
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
var $c016c8183bbe3d68$exports = {};
|
|
213
|
+
$c016c8183bbe3d68$exports = {
|
|
214
|
+
"longPressMessage": `Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın`
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
var $ca4f6c8462244e62$exports = {};
|
|
219
|
+
$ca4f6c8462244e62$exports = {
|
|
220
|
+
"longPressMessage": `Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню`
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
var $2d9960c02ccac927$exports = {};
|
|
225
|
+
$2d9960c02ccac927$exports = {
|
|
226
|
+
"longPressMessage": `长按或按 Alt + 向下方向键以打开菜单`
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
var $f1b682a4c8c5631c$exports = {};
|
|
231
|
+
$f1b682a4c8c5631c$exports = {
|
|
232
|
+
"longPressMessage": `長按或按 Alt+向下鍵以開啟功能表`
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
$9bdd31893c9700c3$exports = {
|
|
237
|
+
"ar-AE": $c0398ad35c3639b7$exports,
|
|
238
|
+
"bg-BG": $7af657c4165927c3$exports,
|
|
239
|
+
"cs-CZ": $d95d4da6d531ab81$exports,
|
|
240
|
+
"da-DK": $24ebda9c775dca17$exports,
|
|
241
|
+
"de-DE": $743e0dfca6cab1e9$exports,
|
|
242
|
+
"el-GR": $a2f41026e05f1c84$exports,
|
|
243
|
+
"en-US": $43b800e97c901737$exports,
|
|
244
|
+
"es-ES": $442f5f6ac211e29f$exports,
|
|
245
|
+
"et-EE": $dff280acfeb2d8ac$exports,
|
|
246
|
+
"fi-FI": $51608325613944d7$exports,
|
|
247
|
+
"fr-FR": $c4a1b1eabeaa87be$exports,
|
|
248
|
+
"he-IL": $8c74815cdee18d1b$exports,
|
|
249
|
+
"hr-HR": $fd0e9ef6a7fe0ec9$exports,
|
|
250
|
+
"hu-HU": $a89a74a39eba465a$exports,
|
|
251
|
+
"it-IT": $edc7c66594a0ae8a$exports,
|
|
252
|
+
"ja-JP": $f1ab51510712db52$exports,
|
|
253
|
+
"ko-KR": $f9b672d9b82fa3d6$exports,
|
|
254
|
+
"lt-LT": $a385f3910feda499$exports,
|
|
255
|
+
"lv-LV": $4f1bde932c441789$exports,
|
|
256
|
+
"nb-NO": $914a51a8a594d5be$exports,
|
|
257
|
+
"nl-NL": $89aaf803103bb500$exports,
|
|
258
|
+
"pl-PL": $c685891476dbaaca$exports,
|
|
259
|
+
"pt-BR": $885879b9b10c2959$exports,
|
|
260
|
+
"pt-PT": $6b39616688a51692$exports,
|
|
261
|
+
"ro-RO": $f26362aed63f47e2$exports,
|
|
262
|
+
"ru-RU": $06cbade644558bf0$exports,
|
|
263
|
+
"sk-SK": $0a391ff68f9d59b1$exports,
|
|
264
|
+
"sl-SI": $8193cf0e649c7928$exports,
|
|
265
|
+
"sr-SP": $f398debcce5a5c55$exports,
|
|
266
|
+
"sv-SE": $9e9fef000aa4c013$exports,
|
|
267
|
+
"tr-TR": $c016c8183bbe3d68$exports,
|
|
268
|
+
"uk-UA": $ca4f6c8462244e62$exports,
|
|
269
|
+
"zh-CN": $2d9960c02ccac927$exports,
|
|
270
|
+
"zh-TW": $f1b682a4c8c5631c$exports
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
|
|
279
|
+
let { type: type = "menu" , isDisabled: isDisabled , trigger: trigger = "press" } = props;
|
|
280
|
+
let menuTriggerId = (0, $1Hnir$useId)();
|
|
281
|
+
let { triggerProps: triggerProps , overlayProps: overlayProps } = (0, $1Hnir$useOverlayTrigger)({
|
|
282
|
+
type: type
|
|
283
|
+
}, state, ref);
|
|
284
|
+
let onKeyDown = (e)=>{
|
|
285
|
+
if (isDisabled) return;
|
|
286
|
+
if (trigger === "longPress" && !e.altKey) return;
|
|
287
|
+
if (ref && ref.current) switch(e.key){
|
|
288
|
+
case "Enter":
|
|
289
|
+
case " ":
|
|
290
|
+
if (trigger === "longPress") return;
|
|
291
|
+
// fallthrough
|
|
292
|
+
case "ArrowDown":
|
|
293
|
+
// Stop propagation, unless it would already be handled by useKeyboard.
|
|
294
|
+
if (!("continuePropagation" in e)) e.stopPropagation();
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
state.toggle("first");
|
|
297
|
+
break;
|
|
298
|
+
case "ArrowUp":
|
|
299
|
+
if (!("continuePropagation" in e)) e.stopPropagation();
|
|
300
|
+
e.preventDefault();
|
|
301
|
+
state.toggle("last");
|
|
302
|
+
break;
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
let stringFormatter = (0, $1Hnir$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($9bdd31893c9700c3$exports))));
|
|
306
|
+
let { longPressProps: longPressProps } = (0, $1Hnir$useLongPress)({
|
|
307
|
+
isDisabled: isDisabled || trigger !== "longPress",
|
|
308
|
+
accessibilityDescription: stringFormatter.format("longPressMessage"),
|
|
309
|
+
onLongPressStart () {
|
|
310
|
+
state.close();
|
|
311
|
+
},
|
|
312
|
+
onLongPress () {
|
|
313
|
+
state.open("first");
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
let pressProps = {
|
|
317
|
+
onPressStart (e) {
|
|
318
|
+
// For consistency with native, open the menu on mouse/key down, but touch up.
|
|
319
|
+
if (e.pointerType !== "touch" && e.pointerType !== "keyboard" && !isDisabled) // If opened with a screen reader, auto focus the first item.
|
|
320
|
+
// Otherwise, the menu itself will be focused.
|
|
321
|
+
state.toggle(e.pointerType === "virtual" ? "first" : null);
|
|
322
|
+
},
|
|
323
|
+
onPress (e) {
|
|
324
|
+
if (e.pointerType === "touch" && !isDisabled) state.toggle();
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
// omit onPress from triggerProps since we override it above.
|
|
328
|
+
delete triggerProps.onPress;
|
|
329
|
+
return {
|
|
330
|
+
menuTriggerProps: {
|
|
331
|
+
...triggerProps,
|
|
332
|
+
...trigger === "press" ? pressProps : longPressProps,
|
|
333
|
+
id: menuTriggerId,
|
|
334
|
+
onKeyDown: onKeyDown
|
|
335
|
+
},
|
|
336
|
+
menuProps: {
|
|
337
|
+
...overlayProps,
|
|
338
|
+
"aria-labelledby": menuTriggerId,
|
|
339
|
+
autoFocus: state.focusStrategy || true,
|
|
340
|
+
onClose: state.close
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
/*
|
|
347
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
348
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
349
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
350
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
351
|
+
*
|
|
352
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
353
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
354
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
355
|
+
* governing permissions and limitations under the License.
|
|
356
|
+
*/
|
|
357
|
+
|
|
358
|
+
const $d5336fe17ce95402$export$6f49b4016bfc8d56 = new WeakMap();
|
|
359
|
+
function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
|
|
360
|
+
let { shouldFocusWrap: shouldFocusWrap = true , ...otherProps } = props;
|
|
361
|
+
if (!props["aria-label"] && !props["aria-labelledby"]) console.warn("An aria-label or aria-labelledby prop is required for accessibility.");
|
|
362
|
+
let domProps = (0, $1Hnir$filterDOMProps)(props, {
|
|
363
|
+
labelable: true
|
|
364
|
+
});
|
|
365
|
+
let { listProps: listProps } = (0, $1Hnir$useSelectableList)({
|
|
366
|
+
...otherProps,
|
|
367
|
+
ref: ref,
|
|
368
|
+
selectionManager: state.selectionManager,
|
|
369
|
+
collection: state.collection,
|
|
370
|
+
disabledKeys: state.disabledKeys,
|
|
371
|
+
shouldFocusWrap: shouldFocusWrap
|
|
372
|
+
});
|
|
373
|
+
$d5336fe17ce95402$export$6f49b4016bfc8d56.set(state, {
|
|
374
|
+
onClose: props.onClose,
|
|
375
|
+
onAction: props.onAction
|
|
376
|
+
});
|
|
377
|
+
return {
|
|
378
|
+
menuProps: (0, $1Hnir$mergeProps)(domProps, {
|
|
379
|
+
role: "menu",
|
|
380
|
+
...listProps
|
|
381
|
+
})
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
/*
|
|
387
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
388
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
389
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
390
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
391
|
+
*
|
|
392
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
393
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
394
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
395
|
+
* governing permissions and limitations under the License.
|
|
396
|
+
*/
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
402
|
+
let { key: key , closeOnSelect: closeOnSelect , isVirtualized: isVirtualized } = props;
|
|
403
|
+
var _props_isDisabled;
|
|
404
|
+
let isDisabled = (_props_isDisabled = props.isDisabled) !== null && _props_isDisabled !== void 0 ? _props_isDisabled : state.disabledKeys.has(key);
|
|
405
|
+
var _props_isSelected;
|
|
406
|
+
let isSelected = (_props_isSelected = props.isSelected) !== null && _props_isSelected !== void 0 ? _props_isSelected : state.selectionManager.isSelected(key);
|
|
407
|
+
let isFocused = state.selectionManager.focusedKey === key;
|
|
408
|
+
let data = (0, $d5336fe17ce95402$export$6f49b4016bfc8d56).get(state);
|
|
409
|
+
let onClose = props.onClose || data.onClose;
|
|
410
|
+
let onAction = props.onAction || data.onAction;
|
|
411
|
+
let role = "menuitem";
|
|
412
|
+
if (state.selectionManager.selectionMode === "single") role = "menuitemradio";
|
|
413
|
+
else if (state.selectionManager.selectionMode === "multiple") role = "menuitemcheckbox";
|
|
414
|
+
let labelId = (0, $1Hnir$useSlotId)();
|
|
415
|
+
let descriptionId = (0, $1Hnir$useSlotId)();
|
|
416
|
+
let keyboardId = (0, $1Hnir$useSlotId)();
|
|
417
|
+
let ariaProps = {
|
|
418
|
+
"aria-disabled": isDisabled,
|
|
419
|
+
role: role,
|
|
420
|
+
"aria-label": props["aria-label"],
|
|
421
|
+
"aria-labelledby": labelId,
|
|
422
|
+
"aria-describedby": [
|
|
423
|
+
descriptionId,
|
|
424
|
+
keyboardId
|
|
425
|
+
].filter(Boolean).join(" ") || undefined
|
|
426
|
+
};
|
|
427
|
+
if (state.selectionManager.selectionMode !== "none") ariaProps["aria-checked"] = isSelected;
|
|
428
|
+
if (isVirtualized) {
|
|
429
|
+
ariaProps["aria-posinset"] = state.collection.getItem(key).index;
|
|
430
|
+
ariaProps["aria-setsize"] = (0, $1Hnir$getItemCount)(state.collection);
|
|
431
|
+
}
|
|
432
|
+
let onKeyDown = (e)=>{
|
|
433
|
+
// Ignore repeating events, which may have started on the menu trigger before moving
|
|
434
|
+
// focus to the menu item. We want to wait for a second complete key press sequence.
|
|
435
|
+
if (e.repeat) return;
|
|
436
|
+
switch(e.key){
|
|
437
|
+
case " ":
|
|
438
|
+
if (!isDisabled && state.selectionManager.selectionMode === "none" && closeOnSelect !== false && onClose) onClose();
|
|
439
|
+
break;
|
|
440
|
+
case "Enter":
|
|
441
|
+
// The Enter key should always close on select, except if overridden.
|
|
442
|
+
if (!isDisabled && closeOnSelect !== false && onClose) onClose();
|
|
443
|
+
break;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
let onPressStart = (e)=>{
|
|
447
|
+
if (e.pointerType === "keyboard" && onAction) onAction(key);
|
|
448
|
+
};
|
|
449
|
+
let onPressUp = (e)=>{
|
|
450
|
+
if (e.pointerType !== "keyboard") {
|
|
451
|
+
if (onAction) onAction(key);
|
|
452
|
+
// Pressing a menu item should close by default in single selection mode but not multiple
|
|
453
|
+
// selection mode, except if overridden by the closeOnSelect prop.
|
|
454
|
+
if (onClose && (closeOnSelect !== null && closeOnSelect !== void 0 ? closeOnSelect : state.selectionManager.selectionMode !== "multiple")) onClose();
|
|
455
|
+
}
|
|
456
|
+
};
|
|
457
|
+
let { itemProps: itemProps } = (0, $1Hnir$useSelectableItem)({
|
|
458
|
+
selectionManager: state.selectionManager,
|
|
459
|
+
key: key,
|
|
460
|
+
ref: ref,
|
|
461
|
+
shouldSelectOnPressUp: true,
|
|
462
|
+
allowsDifferentPressOrigin: true
|
|
463
|
+
});
|
|
464
|
+
let { pressProps: pressProps , isPressed: isPressed } = (0, $1Hnir$usePress)({
|
|
465
|
+
onPressStart: onPressStart,
|
|
466
|
+
onPressUp: onPressUp,
|
|
467
|
+
isDisabled: isDisabled
|
|
468
|
+
});
|
|
469
|
+
let { hoverProps: hoverProps } = (0, $1Hnir$useHover)({
|
|
470
|
+
isDisabled: isDisabled,
|
|
471
|
+
onHoverStart () {
|
|
472
|
+
if (!(0, $1Hnir$isFocusVisible)()) {
|
|
473
|
+
state.selectionManager.setFocused(true);
|
|
474
|
+
state.selectionManager.setFocusedKey(key);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
return {
|
|
479
|
+
menuItemProps: {
|
|
480
|
+
...ariaProps,
|
|
481
|
+
...(0, $1Hnir$mergeProps)(itemProps, pressProps, hoverProps, {
|
|
482
|
+
onKeyDown: onKeyDown
|
|
483
|
+
})
|
|
484
|
+
},
|
|
485
|
+
labelProps: {
|
|
486
|
+
id: labelId
|
|
487
|
+
},
|
|
488
|
+
descriptionProps: {
|
|
489
|
+
id: descriptionId
|
|
490
|
+
},
|
|
491
|
+
keyboardShortcutProps: {
|
|
492
|
+
id: keyboardId
|
|
493
|
+
},
|
|
494
|
+
isFocused: isFocused,
|
|
495
|
+
isSelected: isSelected,
|
|
496
|
+
isPressed: isPressed,
|
|
497
|
+
isDisabled: isDisabled
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
/*
|
|
503
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
504
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
505
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
506
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
507
|
+
*
|
|
508
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
509
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
510
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
511
|
+
* governing permissions and limitations under the License.
|
|
512
|
+
*/
|
|
513
|
+
function $3e5eb2498db5b506$export$73f7a44322579622(props) {
|
|
514
|
+
let { heading: heading , "aria-label": ariaLabel } = props;
|
|
515
|
+
let headingId = (0, $1Hnir$useId)();
|
|
516
|
+
return {
|
|
517
|
+
itemProps: {
|
|
518
|
+
role: "presentation"
|
|
519
|
+
},
|
|
520
|
+
headingProps: heading ? {
|
|
521
|
+
// Techincally, menus cannot contain headings according to ARIA.
|
|
522
|
+
// We hide the heading from assistive technology, and only use it
|
|
523
|
+
// as a label for the nested group.
|
|
524
|
+
id: headingId,
|
|
525
|
+
"aria-hidden": true
|
|
526
|
+
} : {},
|
|
527
|
+
groupProps: {
|
|
528
|
+
role: "group",
|
|
529
|
+
"aria-label": ariaLabel,
|
|
530
|
+
"aria-labelledby": heading ? headingId : undefined
|
|
531
|
+
}
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
export {$168583247155ddda$export$dc9c12ed27dd1b49 as useMenuTrigger, $d5336fe17ce95402$export$38eaa17faae8f579 as useMenu, $a2e5df62f93c7633$export$9d32628fc2aea7da as useMenuItem, $3e5eb2498db5b506$export$73f7a44322579622 as useMenuSection};
|
|
539
|
+
//# sourceMappingURL=module.js.map
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/menu",
|
|
3
|
-
"version": "3.7.2-nightly.
|
|
3
|
+
"version": "3.7.2-nightly.3705+93b3c951e",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
7
7
|
"module": "dist/module.js",
|
|
8
|
+
"exports": {
|
|
9
|
+
"types": "./dist/types.d.ts",
|
|
10
|
+
"import": "./dist/import.mjs",
|
|
11
|
+
"require": "./dist/main.js"
|
|
12
|
+
},
|
|
8
13
|
"types": "dist/types.d.ts",
|
|
9
14
|
"source": "src/index.ts",
|
|
10
15
|
"files": [
|
|
@@ -17,17 +22,17 @@
|
|
|
17
22
|
"url": "https://github.com/adobe/react-spectrum"
|
|
18
23
|
},
|
|
19
24
|
"dependencies": {
|
|
20
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
21
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
22
|
-
"@react-aria/overlays": "3.0.0-nightly.
|
|
23
|
-
"@react-aria/selection": "3.0.0-nightly.
|
|
24
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
25
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
26
|
-
"@react-stately/menu": "3.4.5-nightly.
|
|
27
|
-
"@react-stately/tree": "3.0.0-nightly.
|
|
28
|
-
"@react-types/button": "3.7.1-nightly.
|
|
29
|
-
"@react-types/menu": "3.7.4-nightly.
|
|
30
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
25
|
+
"@react-aria/i18n": "3.0.0-nightly.2005+93b3c951e",
|
|
26
|
+
"@react-aria/interactions": "3.0.0-nightly.2005+93b3c951e",
|
|
27
|
+
"@react-aria/overlays": "3.0.0-nightly.2005+93b3c951e",
|
|
28
|
+
"@react-aria/selection": "3.0.0-nightly.2005+93b3c951e",
|
|
29
|
+
"@react-aria/utils": "3.0.0-nightly.2005+93b3c951e",
|
|
30
|
+
"@react-stately/collections": "3.0.0-nightly.2005+93b3c951e",
|
|
31
|
+
"@react-stately/menu": "3.4.5-nightly.3705+93b3c951e",
|
|
32
|
+
"@react-stately/tree": "3.0.0-nightly.2005+93b3c951e",
|
|
33
|
+
"@react-types/button": "3.7.1-nightly.3705+93b3c951e",
|
|
34
|
+
"@react-types/menu": "3.7.4-nightly.3705+93b3c951e",
|
|
35
|
+
"@react-types/shared": "3.0.0-nightly.2005+93b3c951e",
|
|
31
36
|
"@swc/helpers": "^0.4.14"
|
|
32
37
|
},
|
|
33
38
|
"peerDependencies": {
|
|
@@ -37,5 +42,5 @@
|
|
|
37
42
|
"publishConfig": {
|
|
38
43
|
"access": "public"
|
|
39
44
|
},
|
|
40
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "93b3c951eb784b14183f9988f2d188b34de8f42d"
|
|
41
46
|
}
|