@react-aria/menu 3.5.2-nightly.3353 → 3.5.2-nightly.3358
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/main.js +30 -37
- package/dist/main.js.map +1 -1
- package/dist/module.js +25 -20
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +48 -28
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/index.ts +4 -4
- package/src/useMenu.ts +14 -2
- package/src/useMenuItem.ts +42 -12
- package/src/useMenuTrigger.ts +10 -8
package/dist/main.js
CHANGED
|
@@ -5,31 +5,17 @@ var $fHYTQ$reactariaoverlays = require("@react-aria/overlays");
|
|
|
5
5
|
var $fHYTQ$reactariaselection = require("@react-aria/selection");
|
|
6
6
|
var $fHYTQ$reactstatelycollections = require("@react-stately/collections");
|
|
7
7
|
|
|
8
|
-
function $parcel$
|
|
9
|
-
Object.
|
|
10
|
-
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
Object.defineProperty(dest, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function get() {
|
|
17
|
-
return source[key];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return dest;
|
|
8
|
+
function $parcel$export(e, n, v, s) {
|
|
9
|
+
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
23
10
|
}
|
|
24
11
|
function $parcel$interopDefault(a) {
|
|
25
12
|
return a && a.__esModule ? a.default : a;
|
|
26
13
|
}
|
|
27
|
-
function $parcel$export(e, n, v, s) {
|
|
28
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
29
|
-
}
|
|
30
|
-
var $7211ab9328763fb9$exports = {};
|
|
31
14
|
|
|
32
|
-
$parcel$export(
|
|
15
|
+
$parcel$export(module.exports, "useMenuTrigger", () => $7211ab9328763fb9$export$dc9c12ed27dd1b49);
|
|
16
|
+
$parcel$export(module.exports, "useMenu", () => $a3815f0132802737$export$38eaa17faae8f579);
|
|
17
|
+
$parcel$export(module.exports, "useMenuItem", () => $38191ed02615ec07$export$9d32628fc2aea7da);
|
|
18
|
+
$parcel$export(module.exports, "useMenuSection", () => $63008655e23408c5$export$73f7a44322579622);
|
|
33
19
|
var $5128c2fd7e261f09$exports = {};
|
|
34
20
|
var $429891642bf97c51$exports = {};
|
|
35
21
|
$429891642bf97c51$exports = JSON.parse("{\"longPressMessage\":\"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة\"}");
|
|
@@ -258,26 +244,26 @@ function $7211ab9328763fb9$export$dc9c12ed27dd1b49(props, state, ref) {
|
|
|
258
244
|
if (e.pointerType === 'touch' && !isDisabled) state.toggle();
|
|
259
245
|
}
|
|
260
246
|
};
|
|
261
|
-
triggerProps = $fHYTQ$reactariautils.mergeProps(triggerProps, trigger === 'press' ? pressProps : longPressProps);
|
|
262
247
|
return {
|
|
263
248
|
menuTriggerProps: {
|
|
264
249
|
...triggerProps,
|
|
250
|
+
...trigger === 'press' ? pressProps : longPressProps,
|
|
265
251
|
id: menuTriggerId,
|
|
266
252
|
onKeyDown: onKeyDown
|
|
267
253
|
},
|
|
268
254
|
menuProps: {
|
|
269
255
|
...overlayProps,
|
|
270
|
-
'aria-labelledby': menuTriggerId
|
|
256
|
+
'aria-labelledby': menuTriggerId,
|
|
257
|
+
autoFocus: state.focusStrategy,
|
|
258
|
+
onClose: state.close
|
|
271
259
|
}
|
|
272
260
|
};
|
|
273
261
|
}
|
|
274
262
|
|
|
275
263
|
|
|
276
|
-
var $a3815f0132802737$exports = {};
|
|
277
|
-
|
|
278
|
-
$parcel$export($a3815f0132802737$exports, "useMenu", () => $a3815f0132802737$export$38eaa17faae8f579);
|
|
279
264
|
|
|
280
265
|
|
|
266
|
+
const $a3815f0132802737$export$6f49b4016bfc8d56 = new WeakMap();
|
|
281
267
|
function $a3815f0132802737$export$38eaa17faae8f579(props, state, ref) {
|
|
282
268
|
let { shouldFocusWrap: shouldFocusWrap = true , ...otherProps } = props;
|
|
283
269
|
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
|
|
@@ -292,6 +278,10 @@ function $a3815f0132802737$export$38eaa17faae8f579(props, state, ref) {
|
|
|
292
278
|
disabledKeys: state.disabledKeys,
|
|
293
279
|
shouldFocusWrap: shouldFocusWrap
|
|
294
280
|
});
|
|
281
|
+
$a3815f0132802737$export$6f49b4016bfc8d56.set(state, {
|
|
282
|
+
onClose: props.onClose,
|
|
283
|
+
onAction: props.onAction
|
|
284
|
+
});
|
|
295
285
|
return {
|
|
296
286
|
menuProps: $fHYTQ$reactariautils.mergeProps(domProps, {
|
|
297
287
|
role: 'menu',
|
|
@@ -301,15 +291,21 @@ function $a3815f0132802737$export$38eaa17faae8f579(props, state, ref) {
|
|
|
301
291
|
}
|
|
302
292
|
|
|
303
293
|
|
|
304
|
-
var $38191ed02615ec07$exports = {};
|
|
305
294
|
|
|
306
|
-
$parcel$export($38191ed02615ec07$exports, "useMenuItem", () => $38191ed02615ec07$export$9d32628fc2aea7da);
|
|
307
295
|
|
|
308
296
|
|
|
309
297
|
|
|
310
298
|
|
|
311
299
|
function $38191ed02615ec07$export$9d32628fc2aea7da(props, state, ref) {
|
|
312
|
-
let {
|
|
300
|
+
let { key: key , closeOnSelect: closeOnSelect , isVirtualized: isVirtualized } = props;
|
|
301
|
+
var _isDisabled;
|
|
302
|
+
let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
|
|
303
|
+
var _isSelected;
|
|
304
|
+
let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
|
|
305
|
+
let isFocused = state.selectionManager.focusedKey === key;
|
|
306
|
+
let data = $a3815f0132802737$export$6f49b4016bfc8d56.get(state);
|
|
307
|
+
let onClose = props.onClose || data.onClose;
|
|
308
|
+
let onAction = props.onAction || data.onAction;
|
|
313
309
|
let role = 'menuitem';
|
|
314
310
|
if (state.selectionManager.selectionMode === 'single') role = 'menuitemradio';
|
|
315
311
|
else if (state.selectionManager.selectionMode === 'multiple') role = 'menuitemcheckbox';
|
|
@@ -363,7 +359,7 @@ function $38191ed02615ec07$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
363
359
|
shouldSelectOnPressUp: true,
|
|
364
360
|
allowsDifferentPressOrigin: true
|
|
365
361
|
});
|
|
366
|
-
let { pressProps: pressProps } = $fHYTQ$reactariainteractions.usePress({
|
|
362
|
+
let { pressProps: pressProps , isPressed: isPressed } = $fHYTQ$reactariainteractions.usePress({
|
|
367
363
|
onPressStart: onPressStart,
|
|
368
364
|
onPressUp: onPressUp,
|
|
369
365
|
isDisabled: isDisabled
|
|
@@ -392,14 +388,15 @@ function $38191ed02615ec07$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
392
388
|
},
|
|
393
389
|
keyboardShortcutProps: {
|
|
394
390
|
id: keyboardId
|
|
395
|
-
}
|
|
391
|
+
},
|
|
392
|
+
isFocused: isFocused,
|
|
393
|
+
isSelected: isSelected,
|
|
394
|
+
isPressed: isPressed,
|
|
395
|
+
isDisabled: isDisabled
|
|
396
396
|
};
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
|
|
400
|
-
var $63008655e23408c5$exports = {};
|
|
401
|
-
|
|
402
|
-
$parcel$export($63008655e23408c5$exports, "useMenuSection", () => $63008655e23408c5$export$73f7a44322579622);
|
|
403
400
|
|
|
404
401
|
function $63008655e23408c5$export$73f7a44322579622(props) {
|
|
405
402
|
let { heading: heading , 'aria-label': ariaLabel } = props;
|
|
@@ -425,10 +422,6 @@ function $63008655e23408c5$export$73f7a44322579622(props) {
|
|
|
425
422
|
}
|
|
426
423
|
|
|
427
424
|
|
|
428
|
-
$parcel$exportWildcard(module.exports, $7211ab9328763fb9$exports);
|
|
429
|
-
$parcel$exportWildcard(module.exports, $a3815f0132802737$exports);
|
|
430
|
-
$parcel$exportWildcard(module.exports, $38191ed02615ec07$exports);
|
|
431
|
-
$parcel$exportWildcard(module.exports, $63008655e23408c5$exports);
|
|
432
425
|
|
|
433
426
|
|
|
434
427
|
//# sourceMappingURL=main.js.map
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGAA,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAmF;;;;ACA/G,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6G;;;;ACAzI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAsF;;;;ACAlH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAuG;;;;ACAnI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAoG;;;;ACAhI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6E;;;;ACAzG,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA2F;;;;ACAvH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA+F;;;;ACA3H,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAsH;;;;ACAlJ,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAuF;;;;ACAnH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6G;;;;ACAzI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAiH;;;;ACA7I,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA2F;;;;ACAvH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqD;;;;ACAjF,yBAAc,GAAG,IAAI,CAAC,K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,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI;gBACtC,KAAK,CAAC,gBAAgB,CAAC,aAAa,CAAC,GAAG;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,CAAC,CAAC;QACN,aAAa,EAAE,CAAC;eACX,SAAS;eACT,gCAAU,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;2BAAA,SAAS;YAAA,CAAC;QAC9D,CAAC;QACD,UAAU,EAAE,CAAC;YACX,EAAE,EAAE,OAAO;QACb,CAAC;QACD,gBAAgB,EAAE,CAAC;YACjB,EAAE,EAAE,aAAa;QACnB,CAAC;QACD,qBAAqB,EAAE,CAAC;YACtB,EAAE,EAAE,UAAU;QAChB,CAAC;IACH,CAAC;AACH,CAAC;;;;;;;SClJe,yCAAc,CAAC,KAA2B,EAAmB,CAAC;IAC5E,GAAG,CAAC,CAAC,UAAA,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG,KAAK;IAC9C,GAAG,CAAC,SAAS,GAAG,2BAAK;IAErB,MAAM,CAAC,CAAC;QACN,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,CAAc;QACtB,CAAC;QACD,YAAY,EAAE,OAAO,GAAG,CAAC;YACvB,EAAgE,AAAhE,8DAAgE;YAChE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/menu/src/index.ts","packages/@react-aria/menu/src/useMenuTrigger.ts","packages/@react-aria/menu/intl/*.js","packages/@react-aria/menu/intl/ar-AE.json","packages/@react-aria/menu/intl/bg-BG.json","packages/@react-aria/menu/intl/cs-CZ.json","packages/@react-aria/menu/intl/da-DK.json","packages/@react-aria/menu/intl/de-DE.json","packages/@react-aria/menu/intl/el-GR.json","packages/@react-aria/menu/intl/en-US.json","packages/@react-aria/menu/intl/es-ES.json","packages/@react-aria/menu/intl/et-EE.json","packages/@react-aria/menu/intl/fi-FI.json","packages/@react-aria/menu/intl/fr-FR.json","packages/@react-aria/menu/intl/he-IL.json","packages/@react-aria/menu/intl/hr-HR.json","packages/@react-aria/menu/intl/hu-HU.json","packages/@react-aria/menu/intl/it-IT.json","packages/@react-aria/menu/intl/ja-JP.json","packages/@react-aria/menu/intl/ko-KR.json","packages/@react-aria/menu/intl/lt-LT.json","packages/@react-aria/menu/intl/lv-LV.json","packages/@react-aria/menu/intl/nb-NO.json","packages/@react-aria/menu/intl/nl-NL.json","packages/@react-aria/menu/intl/pl-PL.json","packages/@react-aria/menu/intl/pt-BR.json","packages/@react-aria/menu/intl/pt-PT.json","packages/@react-aria/menu/intl/ro-RO.json","packages/@react-aria/menu/intl/ru-RU.json","packages/@react-aria/menu/intl/sk-SK.json","packages/@react-aria/menu/intl/sl-SI.json","packages/@react-aria/menu/intl/sr-SP.json","packages/@react-aria/menu/intl/sv-SE.json","packages/@react-aria/menu/intl/tr-TR.json","packages/@react-aria/menu/intl/uk-UA.json","packages/@react-aria/menu/intl/zh-CN.json","packages/@react-aria/menu/intl/zh-TW.json","packages/@react-aria/menu/src/useMenu.ts","packages/@react-aria/menu/src/useMenuItem.ts","packages/@react-aria/menu/src/useMenuSection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useMenuTrigger';\nexport * from './useMenu';\nexport * from './useMenuItem';\nexport * from './useMenuSection';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {HTMLAttributes, RefObject} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {MenuTriggerState} from '@react-stately/menu';\nimport {MenuTriggerType} from '@react-types/menu';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useLongPress} from '@react-aria/interactions';\nimport {useMessageFormatter} from '@react-aria/i18n';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\ninterface MenuTriggerAriaProps {\n /** The type of menu that the menu trigger opens. */\n type?: 'menu' | 'listbox',\n /** Whether menu trigger is disabled. */\n isDisabled?: boolean,\n /** How menu is triggered. */\n trigger?: MenuTriggerType\n}\n\ninterface MenuTriggerAria {\n /** Props for the menu trigger element. */\n menuTriggerProps: AriaButtonProps,\n\n /** Props for the menu. */\n menuProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n * @param props - Props for the menu trigger.\n * @param state - State for the menu trigger.\n */\nexport function useMenuTrigger(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria {\n let {\n type = 'menu' as MenuTriggerAriaProps['type'],\n isDisabled,\n trigger = 'press'\n } = props;\n\n let menuTriggerId = useId();\n let {triggerProps, overlayProps} = useOverlayTrigger({type}, state, ref);\n\n let onKeyDown = (e) => {\n if (isDisabled) {\n return;\n }\n\n if (trigger === 'longPress' && !e.altKey) {\n return;\n }\n\n if (ref && ref.current) {\n switch (e.key) {\n case 'Enter':\n case ' ':\n if (trigger === 'longPress') {\n return;\n }\n // fallthrough\n case 'ArrowDown':\n // Stop propagation, unless it would already be handled by useKeyboard.\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('first');\n break;\n case 'ArrowUp':\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('last');\n break;\n }\n }\n };\n\n let formatMessage = useMessageFormatter(intlMessages);\n let {longPressProps} = useLongPress({\n isDisabled: isDisabled || trigger !== 'longPress',\n accessibilityDescription: formatMessage('longPressMessage'),\n onLongPressStart() {\n state.close();\n },\n onLongPress() {\n state.open('first');\n }\n });\n\n let pressProps = {\n onPressStart(e) {\n // For consistency with native, open the menu on mouse/key down, but touch up.\n if (e.pointerType !== 'touch' && e.pointerType !== 'keyboard' && !isDisabled) {\n // If opened with a screen reader, auto focus the first item.\n // Otherwise, the menu itself will be focused.\n state.toggle(e.pointerType === 'virtual' ? 'first' : null);\n }\n },\n onPress(e) {\n if (e.pointerType === 'touch' && !isDisabled) {\n state.toggle();\n }\n }\n };\n\n triggerProps = mergeProps(triggerProps, trigger === 'press' ? pressProps : longPressProps);\n\n return {\n menuTriggerProps: {\n ...triggerProps,\n id: menuTriggerId,\n onKeyDown\n },\n menuProps: {\n ...overlayProps,\n 'aria-labelledby': menuTriggerId\n }\n };\n}\n","const _temp0 = require(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"longPressMessage\": \"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة\"\n}\n","{\n \"longPressMessage\": \"Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто\"\n}\n","{\n \"longPressMessage\": \"Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku\"\n}\n","{\n \"longPressMessage\": \"Langt tryk eller tryk på Alt + pil ned for at åbne menuen\"\n}\n","{\n \"longPressMessage\": \"Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen\"\n}\n","{\n \"longPressMessage\": \"Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού\"\n}\n","{\n \"longPressMessage\": \"Long press or press Alt + ArrowDown to open menu\"\n}\n","{\n \"longPressMessage\": \"Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú\"\n}\n","{\n \"longPressMessage\": \"Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool\"\n}\n","{\n \"longPressMessage\": \"Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli\"\n}\n","{\n \"longPressMessage\": \"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.\"\n}\n","{\n \"longPressMessage\": \"לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika\"\n}\n","{\n \"longPressMessage\": \"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához\"\n}\n","{\n \"longPressMessage\": \"Premere a lungo o premere Alt + Freccia giù per aprire il menu\"\n}\n","{\n \"longPressMessage\": \"長押しまたは Alt+下矢印キーでメニューを開く\"\n}\n","{\n \"longPressMessage\": \"길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기\"\n}\n","{\n \"longPressMessage\": \"Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.\"\n}\n","{\n \"longPressMessage\": \"Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa\"\n}\n","{\n \"longPressMessage\": \"Langt trykk eller trykk Alt + PilNed for å åpne menyen\"\n}\n","{\n \"longPressMessage\": \"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen\"\n}\n","{\n \"longPressMessage\": \"Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu\"\n}\n","{\n \"longPressMessage\": \"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul\"\n}\n","{\n \"longPressMessage\": \"Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню\"\n}\n","{\n \"longPressMessage\": \"Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol\"\n}\n","{\n \"longPressMessage\": \"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni\"\n}\n","{\n \"longPressMessage\": \"Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn\"\n}\n","{\n \"longPressMessage\": \"Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın\"\n}\n","{\n \"longPressMessage\": \"Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню\"\n}\n","{\n \"longPressMessage\": \"长按或按 Alt + 向下方向键以打开菜单\"\n}\n","{\n \"longPressMessage\": \"長按或按 Alt+向下鍵以開啟功能表\"\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps} from '@react-types/menu';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface MenuAria {\n /** Props for the menu element. */\n menuProps: HTMLAttributes<HTMLElement>\n}\n\ninterface AriaMenuOptions<T> extends AriaMenuProps<T> {\n /** Whether the menu uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n * @param props - Props for the menu.\n * @param state - State for the menu, as returned by `useListState`.\n */\nexport function useMenu<T>(props: AriaMenuOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuAria {\n let {\n shouldFocusWrap = true,\n ...otherProps\n } = props;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...otherProps,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n shouldFocusWrap\n });\n\n return {\n menuProps: mergeProps(domProps, {\n role: 'menu',\n ...listProps\n })\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover, usePress} from '@react-aria/interactions';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\nimport {PressEvent} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface MenuItemAria {\n /** Props for the menu item element. */\n menuItemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the menu item. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the menu item, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the keyboard shortcut text element inside the item, if any. */\n keyboardShortcutProps: HTMLAttributes<HTMLElement>\n}\n\ninterface AriaMenuItemProps {\n /** Whether the menu item is disabled. */\n isDisabled?: boolean,\n\n /** Whether the menu item is selected. */\n isSelected?: boolean,\n\n /** A screen reader only label for the menu item. */\n 'aria-label'?: string,\n\n /** The unique key for the menu item. */\n key?: Key,\n\n /** Handler that is called when the menu should close after selecting an item. */\n onClose?: () => void,\n\n /**\n * Whether the menu should close when the menu item is selected.\n * @default true\n */\n closeOnSelect?: boolean,\n\n /** Whether the menu item is contained in a virtual scrolling menu. */\n isVirtualized?: boolean,\n\n /** Handler that is called when the user activates the item. */\n onAction?: (key: Key) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for an item in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the item.\n * @param state - State for the menu, as returned by `useTreeState`.\n */\nexport function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuItemAria {\n let {\n isSelected,\n isDisabled,\n key,\n onClose,\n closeOnSelect,\n isVirtualized,\n onAction\n } = props;\n\n let role = 'menuitem';\n if (state.selectionManager.selectionMode === 'single') {\n role = 'menuitemradio';\n } else if (state.selectionManager.selectionMode === 'multiple') {\n role = 'menuitemcheckbox';\n }\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n let keyboardId = useSlotId();\n\n let ariaProps = {\n 'aria-disabled': isDisabled,\n role,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': labelId,\n 'aria-describedby': [descriptionId, keyboardId].filter(Boolean).join(' ') || undefined\n };\n\n if (state.selectionManager.selectionMode !== 'none') {\n ariaProps['aria-checked'] = isSelected;\n }\n\n if (isVirtualized) {\n ariaProps['aria-posinset'] = state.collection.getItem(key).index;\n ariaProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Ignore repeating events, which may have started on the menu trigger before moving\n // focus to the menu item. We want to wait for a second complete key press sequence.\n if (e.repeat) {\n return;\n }\n\n switch (e.key) {\n case ' ':\n if (!isDisabled && state.selectionManager.selectionMode === 'none' && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n case 'Enter':\n // The Enter key should always close on select, except if overridden.\n if (!isDisabled && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType === 'keyboard' && onAction) {\n onAction(key);\n }\n };\n\n let onPressUp = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard') {\n if (onAction) {\n onAction(key);\n }\n\n // Pressing a menu item should close by default in single selection mode but not multiple\n // selection mode, except if overridden by the closeOnSelect prop.\n if (onClose && (closeOnSelect ?? state.selectionManager.selectionMode !== 'multiple')) {\n onClose();\n }\n }\n };\n\n let {itemProps} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp: true,\n allowsDifferentPressOrigin: true\n });\n\n let {pressProps} = usePress({onPressStart, onPressUp, isDisabled});\n let {hoverProps} = useHover({\n isDisabled,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n menuItemProps: {\n ...ariaProps,\n ...mergeProps(itemProps, pressProps, hoverProps, {onKeyDown})\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n keyboardShortcutProps: {\n id: keyboardId\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaMenuSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface MenuSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the section.\n */\nexport function useMenuSection(props: AriaMenuSectionProps): MenuSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, menus cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;AGAA,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAmF;;;;ACA/G,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6G;;;;ACAzI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAsF;;;;ACAlH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAuG;;;;ACAnI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAoG;;;;ACAhI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6E;;;;ACAzG,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA2F;;;;ACAvH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA+F;;;;ACA3H,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAsH;;;;ACAlJ,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAuF;;;;ACAnH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6G;;;;ACAzI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAiH;;;;ACA7I,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA2F;;;;ACAvH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqD;;;;ACAjF,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA4D;;;;ACAxF,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA+G;;;;ACA3I,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAgI;;;;ACA5J,yBA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5E,GAAG,CAAC,CAAC,UAAA,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG,KAAK;IAC9C,GAAG,CAAC,SAAS,GAAG,2BAAK;IAErB,MAAM,CAAC,CAAC;QACN,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,CAAc;QACtB,CAAC;QACD,YAAY,EAAE,OAAO,GAAG,CAAC;YACvB,EAAgE,AAAhE,8DAAgE;YAChE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/menu/src/index.ts","packages/@react-aria/menu/src/useMenuTrigger.ts","packages/@react-aria/menu/intl/*.js","packages/@react-aria/menu/intl/ar-AE.json","packages/@react-aria/menu/intl/bg-BG.json","packages/@react-aria/menu/intl/cs-CZ.json","packages/@react-aria/menu/intl/da-DK.json","packages/@react-aria/menu/intl/de-DE.json","packages/@react-aria/menu/intl/el-GR.json","packages/@react-aria/menu/intl/en-US.json","packages/@react-aria/menu/intl/es-ES.json","packages/@react-aria/menu/intl/et-EE.json","packages/@react-aria/menu/intl/fi-FI.json","packages/@react-aria/menu/intl/fr-FR.json","packages/@react-aria/menu/intl/he-IL.json","packages/@react-aria/menu/intl/hr-HR.json","packages/@react-aria/menu/intl/hu-HU.json","packages/@react-aria/menu/intl/it-IT.json","packages/@react-aria/menu/intl/ja-JP.json","packages/@react-aria/menu/intl/ko-KR.json","packages/@react-aria/menu/intl/lt-LT.json","packages/@react-aria/menu/intl/lv-LV.json","packages/@react-aria/menu/intl/nb-NO.json","packages/@react-aria/menu/intl/nl-NL.json","packages/@react-aria/menu/intl/pl-PL.json","packages/@react-aria/menu/intl/pt-BR.json","packages/@react-aria/menu/intl/pt-PT.json","packages/@react-aria/menu/intl/ro-RO.json","packages/@react-aria/menu/intl/ru-RU.json","packages/@react-aria/menu/intl/sk-SK.json","packages/@react-aria/menu/intl/sl-SI.json","packages/@react-aria/menu/intl/sr-SP.json","packages/@react-aria/menu/intl/sv-SE.json","packages/@react-aria/menu/intl/tr-TR.json","packages/@react-aria/menu/intl/uk-UA.json","packages/@react-aria/menu/intl/zh-CN.json","packages/@react-aria/menu/intl/zh-TW.json","packages/@react-aria/menu/src/useMenu.ts","packages/@react-aria/menu/src/useMenuItem.ts","packages/@react-aria/menu/src/useMenuSection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useMenuTrigger} from './useMenuTrigger';\nexport {useMenu} from './useMenu';\nexport {useMenuItem} from './useMenuItem';\nexport {useMenuSection} from './useMenuSection';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaMenuOptions} from './useMenu';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {MenuTriggerState} from '@react-stately/menu';\nimport {MenuTriggerType} from '@react-types/menu';\nimport {RefObject} from 'react';\nimport {useId} from '@react-aria/utils';\nimport {useLongPress} from '@react-aria/interactions';\nimport {useMessageFormatter} from '@react-aria/i18n';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\ninterface MenuTriggerAriaProps {\n /** The type of menu that the menu trigger opens. */\n type?: 'menu' | 'listbox',\n /** Whether menu trigger is disabled. */\n isDisabled?: boolean,\n /** How menu is triggered. */\n trigger?: MenuTriggerType\n}\n\ninterface MenuTriggerAria<T> {\n /** Props for the menu trigger element. */\n menuTriggerProps: AriaButtonProps,\n\n /** Props for the menu. */\n menuProps: AriaMenuOptions<T>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n * @param props - Props for the menu trigger.\n * @param state - State for the menu trigger.\n */\nexport function useMenuTrigger<T>(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria<T> {\n let {\n type = 'menu' as MenuTriggerAriaProps['type'],\n isDisabled,\n trigger = 'press'\n } = props;\n\n let menuTriggerId = useId();\n let {triggerProps, overlayProps} = useOverlayTrigger({type}, state, ref);\n\n let onKeyDown = (e) => {\n if (isDisabled) {\n return;\n }\n\n if (trigger === 'longPress' && !e.altKey) {\n return;\n }\n\n if (ref && ref.current) {\n switch (e.key) {\n case 'Enter':\n case ' ':\n if (trigger === 'longPress') {\n return;\n }\n // fallthrough\n case 'ArrowDown':\n // Stop propagation, unless it would already be handled by useKeyboard.\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('first');\n break;\n case 'ArrowUp':\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('last');\n break;\n }\n }\n };\n\n let formatMessage = useMessageFormatter(intlMessages);\n let {longPressProps} = useLongPress({\n isDisabled: isDisabled || trigger !== 'longPress',\n accessibilityDescription: formatMessage('longPressMessage'),\n onLongPressStart() {\n state.close();\n },\n onLongPress() {\n state.open('first');\n }\n });\n\n let pressProps = {\n onPressStart(e) {\n // For consistency with native, open the menu on mouse/key down, but touch up.\n if (e.pointerType !== 'touch' && e.pointerType !== 'keyboard' && !isDisabled) {\n // If opened with a screen reader, auto focus the first item.\n // Otherwise, the menu itself will be focused.\n state.toggle(e.pointerType === 'virtual' ? 'first' : null);\n }\n },\n onPress(e) {\n if (e.pointerType === 'touch' && !isDisabled) {\n state.toggle();\n }\n }\n };\n\n return {\n menuTriggerProps: {\n ...triggerProps,\n ...(trigger === 'press' ? pressProps : longPressProps),\n id: menuTriggerId,\n onKeyDown\n },\n menuProps: {\n ...overlayProps,\n 'aria-labelledby': menuTriggerId,\n autoFocus: state.focusStrategy,\n onClose: state.close\n }\n };\n}\n","const _temp0 = require(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"longPressMessage\": \"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة\"\n}\n","{\n \"longPressMessage\": \"Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто\"\n}\n","{\n \"longPressMessage\": \"Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku\"\n}\n","{\n \"longPressMessage\": \"Langt tryk eller tryk på Alt + pil ned for at åbne menuen\"\n}\n","{\n \"longPressMessage\": \"Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen\"\n}\n","{\n \"longPressMessage\": \"Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού\"\n}\n","{\n \"longPressMessage\": \"Long press or press Alt + ArrowDown to open menu\"\n}\n","{\n \"longPressMessage\": \"Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú\"\n}\n","{\n \"longPressMessage\": \"Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool\"\n}\n","{\n \"longPressMessage\": \"Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli\"\n}\n","{\n \"longPressMessage\": \"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.\"\n}\n","{\n \"longPressMessage\": \"לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika\"\n}\n","{\n \"longPressMessage\": \"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához\"\n}\n","{\n \"longPressMessage\": \"Premere a lungo o premere Alt + Freccia giù per aprire il menu\"\n}\n","{\n \"longPressMessage\": \"長押しまたは Alt+下矢印キーでメニューを開く\"\n}\n","{\n \"longPressMessage\": \"길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기\"\n}\n","{\n \"longPressMessage\": \"Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.\"\n}\n","{\n \"longPressMessage\": \"Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa\"\n}\n","{\n \"longPressMessage\": \"Langt trykk eller trykk Alt + PilNed for å åpne menyen\"\n}\n","{\n \"longPressMessage\": \"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen\"\n}\n","{\n \"longPressMessage\": \"Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu\"\n}\n","{\n \"longPressMessage\": \"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul\"\n}\n","{\n \"longPressMessage\": \"Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню\"\n}\n","{\n \"longPressMessage\": \"Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol\"\n}\n","{\n \"longPressMessage\": \"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni\"\n}\n","{\n \"longPressMessage\": \"Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn\"\n}\n","{\n \"longPressMessage\": \"Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın\"\n}\n","{\n \"longPressMessage\": \"Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню\"\n}\n","{\n \"longPressMessage\": \"长按或按 Alt + 向下方向键以打开菜单\"\n}\n","{\n \"longPressMessage\": \"長按或按 Alt+向下鍵以開啟功能表\"\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps} from '@react-types/menu';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface MenuAria {\n /** Props for the menu element. */\n menuProps: HTMLAttributes<HTMLElement>\n}\n\nexport interface AriaMenuOptions<T> extends Omit<AriaMenuProps<T>, 'children'> {\n /** Whether the menu uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate\n}\n\ninterface MenuData {\n onClose?: () => void,\n onAction?: (key: Key) => void\n}\n\nexport const menuData = new WeakMap<TreeState<unknown>, MenuData>();\n\n/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n * @param props - Props for the menu.\n * @param state - State for the menu, as returned by `useListState`.\n */\nexport function useMenu<T>(props: AriaMenuOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuAria {\n let {\n shouldFocusWrap = true,\n ...otherProps\n } = props;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...otherProps,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n shouldFocusWrap\n });\n\n menuData.set(state, {\n onClose: props.onClose,\n onAction: props.onAction\n });\n\n return {\n menuProps: mergeProps(domProps, {\n role: 'menu',\n ...listProps\n })\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover, usePress} from '@react-aria/interactions';\nimport {menuData} from './useMenu';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\nimport {PressEvent} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface MenuItemAria {\n /** Props for the menu item element. */\n menuItemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the menu item. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the menu item, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the keyboard shortcut text element inside the item, if any. */\n keyboardShortcutProps: HTMLAttributes<HTMLElement>,\n\n /** Whether the item is currently focused. */\n isFocused: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is disabled. */\n isDisabled: boolean\n}\n\ninterface AriaMenuItemProps {\n /**\n * Whether the menu item is disabled.\n * @deprecated - pass disabledKeys to useTreeState instead.\n */\n isDisabled?: boolean,\n\n /**\n * Whether the menu item is selected.\n * @deprecated - pass selectedKeys to useTreeState instead.\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the menu item. */\n 'aria-label'?: string,\n\n /** The unique key for the menu item. */\n key?: Key,\n\n /**\n * Handler that is called when the menu should close after selecting an item.\n * @deprecated - pass to the menu instead.\n */\n onClose?: () => void,\n\n /**\n * Whether the menu should close when the menu item is selected.\n * @default true\n */\n closeOnSelect?: boolean,\n\n /** Whether the menu item is contained in a virtual scrolling menu. */\n isVirtualized?: boolean,\n\n /**\n * Handler that is called when the user activates the item.\n * @deprecated - pass to the menu instead.\n */\n onAction?: (key: Key) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for an item in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the item.\n * @param state - State for the menu, as returned by `useTreeState`.\n */\nexport function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuItemAria {\n let {\n key,\n closeOnSelect,\n isVirtualized\n } = props;\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n\n let data = menuData.get(state);\n let onClose = props.onClose || data.onClose;\n let onAction = props.onAction || data.onAction;\n\n let role = 'menuitem';\n if (state.selectionManager.selectionMode === 'single') {\n role = 'menuitemradio';\n } else if (state.selectionManager.selectionMode === 'multiple') {\n role = 'menuitemcheckbox';\n }\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n let keyboardId = useSlotId();\n\n let ariaProps = {\n 'aria-disabled': isDisabled,\n role,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': labelId,\n 'aria-describedby': [descriptionId, keyboardId].filter(Boolean).join(' ') || undefined\n };\n\n if (state.selectionManager.selectionMode !== 'none') {\n ariaProps['aria-checked'] = isSelected;\n }\n\n if (isVirtualized) {\n ariaProps['aria-posinset'] = state.collection.getItem(key).index;\n ariaProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Ignore repeating events, which may have started on the menu trigger before moving\n // focus to the menu item. We want to wait for a second complete key press sequence.\n if (e.repeat) {\n return;\n }\n\n switch (e.key) {\n case ' ':\n if (!isDisabled && state.selectionManager.selectionMode === 'none' && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n case 'Enter':\n // The Enter key should always close on select, except if overridden.\n if (!isDisabled && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType === 'keyboard' && onAction) {\n onAction(key);\n }\n };\n\n let onPressUp = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard') {\n if (onAction) {\n onAction(key);\n }\n\n // Pressing a menu item should close by default in single selection mode but not multiple\n // selection mode, except if overridden by the closeOnSelect prop.\n if (onClose && (closeOnSelect ?? state.selectionManager.selectionMode !== 'multiple')) {\n onClose();\n }\n }\n };\n\n let {itemProps} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp: true,\n allowsDifferentPressOrigin: true\n });\n\n let {pressProps, isPressed} = usePress({onPressStart, onPressUp, isDisabled});\n let {hoverProps} = useHover({\n isDisabled,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n menuItemProps: {\n ...ariaProps,\n ...mergeProps(itemProps, pressProps, hoverProps, {onKeyDown})\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n keyboardShortcutProps: {\n id: keyboardId\n },\n isFocused,\n isSelected,\n isPressed,\n isDisabled\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaMenuSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface MenuSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the section.\n */\nexport function useMenuSection(props: AriaMenuSectionProps): MenuSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, menus cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useId as $1Hnir$useId,
|
|
1
|
+
import {useId as $1Hnir$useId, filterDOMProps as $1Hnir$filterDOMProps, mergeProps as $1Hnir$mergeProps, useSlotId as $1Hnir$useSlotId} from "@react-aria/utils";
|
|
2
2
|
import {useLongPress as $1Hnir$useLongPress, usePress as $1Hnir$usePress, useHover as $1Hnir$useHover, isFocusVisible as $1Hnir$isFocusVisible} from "@react-aria/interactions";
|
|
3
3
|
import {useMessageFormatter as $1Hnir$useMessageFormatter} from "@react-aria/i18n";
|
|
4
4
|
import {useOverlayTrigger as $1Hnir$useOverlayTrigger} from "@react-aria/overlays";
|
|
@@ -8,12 +8,6 @@ import {getItemCount as $1Hnir$getItemCount} from "@react-stately/collections";
|
|
|
8
8
|
function $parcel$interopDefault(a) {
|
|
9
9
|
return a && a.__esModule ? a.default : a;
|
|
10
10
|
}
|
|
11
|
-
function $parcel$export(e, n, v, s) {
|
|
12
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
13
|
-
}
|
|
14
|
-
var $168583247155ddda$exports = {};
|
|
15
|
-
|
|
16
|
-
$parcel$export($168583247155ddda$exports, "useMenuTrigger", () => $168583247155ddda$export$dc9c12ed27dd1b49);
|
|
17
11
|
var $9bdd31893c9700c3$exports = {};
|
|
18
12
|
var $c0398ad35c3639b7$exports = {};
|
|
19
13
|
$c0398ad35c3639b7$exports = JSON.parse("{\"longPressMessage\":\"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة\"}");
|
|
@@ -242,26 +236,26 @@ function $168583247155ddda$export$dc9c12ed27dd1b49(props, state, ref) {
|
|
|
242
236
|
if (e.pointerType === 'touch' && !isDisabled) state.toggle();
|
|
243
237
|
}
|
|
244
238
|
};
|
|
245
|
-
triggerProps = $1Hnir$mergeProps(triggerProps, trigger === 'press' ? pressProps : longPressProps);
|
|
246
239
|
return {
|
|
247
240
|
menuTriggerProps: {
|
|
248
241
|
...triggerProps,
|
|
242
|
+
...trigger === 'press' ? pressProps : longPressProps,
|
|
249
243
|
id: menuTriggerId,
|
|
250
244
|
onKeyDown: onKeyDown
|
|
251
245
|
},
|
|
252
246
|
menuProps: {
|
|
253
247
|
...overlayProps,
|
|
254
|
-
'aria-labelledby': menuTriggerId
|
|
248
|
+
'aria-labelledby': menuTriggerId,
|
|
249
|
+
autoFocus: state.focusStrategy,
|
|
250
|
+
onClose: state.close
|
|
255
251
|
}
|
|
256
252
|
};
|
|
257
253
|
}
|
|
258
254
|
|
|
259
255
|
|
|
260
|
-
var $d5336fe17ce95402$exports = {};
|
|
261
|
-
|
|
262
|
-
$parcel$export($d5336fe17ce95402$exports, "useMenu", () => $d5336fe17ce95402$export$38eaa17faae8f579);
|
|
263
256
|
|
|
264
257
|
|
|
258
|
+
const $d5336fe17ce95402$export$6f49b4016bfc8d56 = new WeakMap();
|
|
265
259
|
function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
|
|
266
260
|
let { shouldFocusWrap: shouldFocusWrap = true , ...otherProps } = props;
|
|
267
261
|
if (!props['aria-label'] && !props['aria-labelledby']) console.warn('An aria-label or aria-labelledby prop is required for accessibility.');
|
|
@@ -276,6 +270,10 @@ function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
|
|
|
276
270
|
disabledKeys: state.disabledKeys,
|
|
277
271
|
shouldFocusWrap: shouldFocusWrap
|
|
278
272
|
});
|
|
273
|
+
$d5336fe17ce95402$export$6f49b4016bfc8d56.set(state, {
|
|
274
|
+
onClose: props.onClose,
|
|
275
|
+
onAction: props.onAction
|
|
276
|
+
});
|
|
279
277
|
return {
|
|
280
278
|
menuProps: $1Hnir$mergeProps(domProps, {
|
|
281
279
|
role: 'menu',
|
|
@@ -285,15 +283,21 @@ function $d5336fe17ce95402$export$38eaa17faae8f579(props, state, ref) {
|
|
|
285
283
|
}
|
|
286
284
|
|
|
287
285
|
|
|
288
|
-
var $a2e5df62f93c7633$exports = {};
|
|
289
286
|
|
|
290
|
-
$parcel$export($a2e5df62f93c7633$exports, "useMenuItem", () => $a2e5df62f93c7633$export$9d32628fc2aea7da);
|
|
291
287
|
|
|
292
288
|
|
|
293
289
|
|
|
294
290
|
|
|
295
291
|
function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
296
|
-
let {
|
|
292
|
+
let { key: key , closeOnSelect: closeOnSelect , isVirtualized: isVirtualized } = props;
|
|
293
|
+
var _isDisabled;
|
|
294
|
+
let isDisabled = (_isDisabled = props.isDisabled) !== null && _isDisabled !== void 0 ? _isDisabled : state.disabledKeys.has(key);
|
|
295
|
+
var _isSelected;
|
|
296
|
+
let isSelected = (_isSelected = props.isSelected) !== null && _isSelected !== void 0 ? _isSelected : state.selectionManager.isSelected(key);
|
|
297
|
+
let isFocused = state.selectionManager.focusedKey === key;
|
|
298
|
+
let data = $d5336fe17ce95402$export$6f49b4016bfc8d56.get(state);
|
|
299
|
+
let onClose = props.onClose || data.onClose;
|
|
300
|
+
let onAction = props.onAction || data.onAction;
|
|
297
301
|
let role = 'menuitem';
|
|
298
302
|
if (state.selectionManager.selectionMode === 'single') role = 'menuitemradio';
|
|
299
303
|
else if (state.selectionManager.selectionMode === 'multiple') role = 'menuitemcheckbox';
|
|
@@ -347,7 +351,7 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
347
351
|
shouldSelectOnPressUp: true,
|
|
348
352
|
allowsDifferentPressOrigin: true
|
|
349
353
|
});
|
|
350
|
-
let { pressProps: pressProps } = $1Hnir$usePress({
|
|
354
|
+
let { pressProps: pressProps , isPressed: isPressed } = $1Hnir$usePress({
|
|
351
355
|
onPressStart: onPressStart,
|
|
352
356
|
onPressUp: onPressUp,
|
|
353
357
|
isDisabled: isDisabled
|
|
@@ -376,14 +380,15 @@ function $a2e5df62f93c7633$export$9d32628fc2aea7da(props, state, ref) {
|
|
|
376
380
|
},
|
|
377
381
|
keyboardShortcutProps: {
|
|
378
382
|
id: keyboardId
|
|
379
|
-
}
|
|
383
|
+
},
|
|
384
|
+
isFocused: isFocused,
|
|
385
|
+
isSelected: isSelected,
|
|
386
|
+
isPressed: isPressed,
|
|
387
|
+
isDisabled: isDisabled
|
|
380
388
|
};
|
|
381
389
|
}
|
|
382
390
|
|
|
383
391
|
|
|
384
|
-
var $3e5eb2498db5b506$exports = {};
|
|
385
|
-
|
|
386
|
-
$parcel$export($3e5eb2498db5b506$exports, "useMenuSection", () => $3e5eb2498db5b506$export$73f7a44322579622);
|
|
387
392
|
|
|
388
393
|
function $3e5eb2498db5b506$export$73f7a44322579622(props) {
|
|
389
394
|
let { heading: heading , 'aria-label': ariaLabel } = props;
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;AGAA,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAmF;;;;ACA/G,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6G;;;;ACAzI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAsF;;;;ACAlH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAuG;;;;ACAnI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAoG;;;;ACAhI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6E;;;;ACAzG,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA2F;;;;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AO,GAAG,CAAC;YACvB,EAAgE,AAAhE,8DAAgE;YAChE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/menu/src/index.ts","packages/@react-aria/menu/src/useMenuTrigger.ts","packages/@react-aria/menu/intl/*.js","packages/@react-aria/menu/intl/ar-AE.json","packages/@react-aria/menu/intl/bg-BG.json","packages/@react-aria/menu/intl/cs-CZ.json","packages/@react-aria/menu/intl/da-DK.json","packages/@react-aria/menu/intl/de-DE.json","packages/@react-aria/menu/intl/el-GR.json","packages/@react-aria/menu/intl/en-US.json","packages/@react-aria/menu/intl/es-ES.json","packages/@react-aria/menu/intl/et-EE.json","packages/@react-aria/menu/intl/fi-FI.json","packages/@react-aria/menu/intl/fr-FR.json","packages/@react-aria/menu/intl/he-IL.json","packages/@react-aria/menu/intl/hr-HR.json","packages/@react-aria/menu/intl/hu-HU.json","packages/@react-aria/menu/intl/it-IT.json","packages/@react-aria/menu/intl/ja-JP.json","packages/@react-aria/menu/intl/ko-KR.json","packages/@react-aria/menu/intl/lt-LT.json","packages/@react-aria/menu/intl/lv-LV.json","packages/@react-aria/menu/intl/nb-NO.json","packages/@react-aria/menu/intl/nl-NL.json","packages/@react-aria/menu/intl/pl-PL.json","packages/@react-aria/menu/intl/pt-BR.json","packages/@react-aria/menu/intl/pt-PT.json","packages/@react-aria/menu/intl/ro-RO.json","packages/@react-aria/menu/intl/ru-RU.json","packages/@react-aria/menu/intl/sk-SK.json","packages/@react-aria/menu/intl/sl-SI.json","packages/@react-aria/menu/intl/sr-SP.json","packages/@react-aria/menu/intl/sv-SE.json","packages/@react-aria/menu/intl/tr-TR.json","packages/@react-aria/menu/intl/uk-UA.json","packages/@react-aria/menu/intl/zh-CN.json","packages/@react-aria/menu/intl/zh-TW.json","packages/@react-aria/menu/src/useMenu.ts","packages/@react-aria/menu/src/useMenuItem.ts","packages/@react-aria/menu/src/useMenuSection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './useMenuTrigger';\nexport * from './useMenu';\nexport * from './useMenuItem';\nexport * from './useMenuSection';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {HTMLAttributes, RefObject} from 'react';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {MenuTriggerState} from '@react-stately/menu';\nimport {MenuTriggerType} from '@react-types/menu';\nimport {mergeProps, useId} from '@react-aria/utils';\nimport {useLongPress} from '@react-aria/interactions';\nimport {useMessageFormatter} from '@react-aria/i18n';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\ninterface MenuTriggerAriaProps {\n /** The type of menu that the menu trigger opens. */\n type?: 'menu' | 'listbox',\n /** Whether menu trigger is disabled. */\n isDisabled?: boolean,\n /** How menu is triggered. */\n trigger?: MenuTriggerType\n}\n\ninterface MenuTriggerAria {\n /** Props for the menu trigger element. */\n menuTriggerProps: AriaButtonProps,\n\n /** Props for the menu. */\n menuProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n * @param props - Props for the menu trigger.\n * @param state - State for the menu trigger.\n */\nexport function useMenuTrigger(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria {\n let {\n type = 'menu' as MenuTriggerAriaProps['type'],\n isDisabled,\n trigger = 'press'\n } = props;\n\n let menuTriggerId = useId();\n let {triggerProps, overlayProps} = useOverlayTrigger({type}, state, ref);\n\n let onKeyDown = (e) => {\n if (isDisabled) {\n return;\n }\n\n if (trigger === 'longPress' && !e.altKey) {\n return;\n }\n\n if (ref && ref.current) {\n switch (e.key) {\n case 'Enter':\n case ' ':\n if (trigger === 'longPress') {\n return;\n }\n // fallthrough\n case 'ArrowDown':\n // Stop propagation, unless it would already be handled by useKeyboard.\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('first');\n break;\n case 'ArrowUp':\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('last');\n break;\n }\n }\n };\n\n let formatMessage = useMessageFormatter(intlMessages);\n let {longPressProps} = useLongPress({\n isDisabled: isDisabled || trigger !== 'longPress',\n accessibilityDescription: formatMessage('longPressMessage'),\n onLongPressStart() {\n state.close();\n },\n onLongPress() {\n state.open('first');\n }\n });\n\n let pressProps = {\n onPressStart(e) {\n // For consistency with native, open the menu on mouse/key down, but touch up.\n if (e.pointerType !== 'touch' && e.pointerType !== 'keyboard' && !isDisabled) {\n // If opened with a screen reader, auto focus the first item.\n // Otherwise, the menu itself will be focused.\n state.toggle(e.pointerType === 'virtual' ? 'first' : null);\n }\n },\n onPress(e) {\n if (e.pointerType === 'touch' && !isDisabled) {\n state.toggle();\n }\n }\n };\n\n triggerProps = mergeProps(triggerProps, trigger === 'press' ? pressProps : longPressProps);\n\n return {\n menuTriggerProps: {\n ...triggerProps,\n id: menuTriggerId,\n onKeyDown\n },\n menuProps: {\n ...overlayProps,\n 'aria-labelledby': menuTriggerId\n }\n };\n}\n","const _temp0 = require(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"longPressMessage\": \"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة\"\n}\n","{\n \"longPressMessage\": \"Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто\"\n}\n","{\n \"longPressMessage\": \"Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku\"\n}\n","{\n \"longPressMessage\": \"Langt tryk eller tryk på Alt + pil ned for at åbne menuen\"\n}\n","{\n \"longPressMessage\": \"Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen\"\n}\n","{\n \"longPressMessage\": \"Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού\"\n}\n","{\n \"longPressMessage\": \"Long press or press Alt + ArrowDown to open menu\"\n}\n","{\n \"longPressMessage\": \"Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú\"\n}\n","{\n \"longPressMessage\": \"Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool\"\n}\n","{\n \"longPressMessage\": \"Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli\"\n}\n","{\n \"longPressMessage\": \"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.\"\n}\n","{\n \"longPressMessage\": \"לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika\"\n}\n","{\n \"longPressMessage\": \"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához\"\n}\n","{\n \"longPressMessage\": \"Premere a lungo o premere Alt + Freccia giù per aprire il menu\"\n}\n","{\n \"longPressMessage\": \"長押しまたは Alt+下矢印キーでメニューを開く\"\n}\n","{\n \"longPressMessage\": \"길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기\"\n}\n","{\n \"longPressMessage\": \"Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.\"\n}\n","{\n \"longPressMessage\": \"Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa\"\n}\n","{\n \"longPressMessage\": \"Langt trykk eller trykk Alt + PilNed for å åpne menyen\"\n}\n","{\n \"longPressMessage\": \"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen\"\n}\n","{\n \"longPressMessage\": \"Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu\"\n}\n","{\n \"longPressMessage\": \"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul\"\n}\n","{\n \"longPressMessage\": \"Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню\"\n}\n","{\n \"longPressMessage\": \"Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol\"\n}\n","{\n \"longPressMessage\": \"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni\"\n}\n","{\n \"longPressMessage\": \"Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn\"\n}\n","{\n \"longPressMessage\": \"Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın\"\n}\n","{\n \"longPressMessage\": \"Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню\"\n}\n","{\n \"longPressMessage\": \"长按或按 Alt + 向下方向键以打开菜单\"\n}\n","{\n \"longPressMessage\": \"長按或按 Alt+向下鍵以開啟功能表\"\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps} from '@react-types/menu';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface MenuAria {\n /** Props for the menu element. */\n menuProps: HTMLAttributes<HTMLElement>\n}\n\ninterface AriaMenuOptions<T> extends AriaMenuProps<T> {\n /** Whether the menu uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n * @param props - Props for the menu.\n * @param state - State for the menu, as returned by `useListState`.\n */\nexport function useMenu<T>(props: AriaMenuOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuAria {\n let {\n shouldFocusWrap = true,\n ...otherProps\n } = props;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...otherProps,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n shouldFocusWrap\n });\n\n return {\n menuProps: mergeProps(domProps, {\n role: 'menu',\n ...listProps\n })\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover, usePress} from '@react-aria/interactions';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\nimport {PressEvent} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface MenuItemAria {\n /** Props for the menu item element. */\n menuItemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the menu item. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the menu item, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the keyboard shortcut text element inside the item, if any. */\n keyboardShortcutProps: HTMLAttributes<HTMLElement>\n}\n\ninterface AriaMenuItemProps {\n /** Whether the menu item is disabled. */\n isDisabled?: boolean,\n\n /** Whether the menu item is selected. */\n isSelected?: boolean,\n\n /** A screen reader only label for the menu item. */\n 'aria-label'?: string,\n\n /** The unique key for the menu item. */\n key?: Key,\n\n /** Handler that is called when the menu should close after selecting an item. */\n onClose?: () => void,\n\n /**\n * Whether the menu should close when the menu item is selected.\n * @default true\n */\n closeOnSelect?: boolean,\n\n /** Whether the menu item is contained in a virtual scrolling menu. */\n isVirtualized?: boolean,\n\n /** Handler that is called when the user activates the item. */\n onAction?: (key: Key) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for an item in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the item.\n * @param state - State for the menu, as returned by `useTreeState`.\n */\nexport function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuItemAria {\n let {\n isSelected,\n isDisabled,\n key,\n onClose,\n closeOnSelect,\n isVirtualized,\n onAction\n } = props;\n\n let role = 'menuitem';\n if (state.selectionManager.selectionMode === 'single') {\n role = 'menuitemradio';\n } else if (state.selectionManager.selectionMode === 'multiple') {\n role = 'menuitemcheckbox';\n }\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n let keyboardId = useSlotId();\n\n let ariaProps = {\n 'aria-disabled': isDisabled,\n role,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': labelId,\n 'aria-describedby': [descriptionId, keyboardId].filter(Boolean).join(' ') || undefined\n };\n\n if (state.selectionManager.selectionMode !== 'none') {\n ariaProps['aria-checked'] = isSelected;\n }\n\n if (isVirtualized) {\n ariaProps['aria-posinset'] = state.collection.getItem(key).index;\n ariaProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Ignore repeating events, which may have started on the menu trigger before moving\n // focus to the menu item. We want to wait for a second complete key press sequence.\n if (e.repeat) {\n return;\n }\n\n switch (e.key) {\n case ' ':\n if (!isDisabled && state.selectionManager.selectionMode === 'none' && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n case 'Enter':\n // The Enter key should always close on select, except if overridden.\n if (!isDisabled && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType === 'keyboard' && onAction) {\n onAction(key);\n }\n };\n\n let onPressUp = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard') {\n if (onAction) {\n onAction(key);\n }\n\n // Pressing a menu item should close by default in single selection mode but not multiple\n // selection mode, except if overridden by the closeOnSelect prop.\n if (onClose && (closeOnSelect ?? state.selectionManager.selectionMode !== 'multiple')) {\n onClose();\n }\n }\n };\n\n let {itemProps} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp: true,\n allowsDifferentPressOrigin: true\n });\n\n let {pressProps} = usePress({onPressStart, onPressUp, isDisabled});\n let {hoverProps} = useHover({\n isDisabled,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n menuItemProps: {\n ...ariaProps,\n ...mergeProps(itemProps, pressProps, hoverProps, {onKeyDown})\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n keyboardShortcutProps: {\n id: keyboardId\n }\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaMenuSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface MenuSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the section.\n */\nexport function useMenuSection(props: AriaMenuSectionProps): MenuSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, menus cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;AGAA,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAmF;;;;ACA/G,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6G;;;;ACAzI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAsF;;;;ACAlH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAuG;;;;ACAnI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAoG;;;;ACAhI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA6E;;;;ACAzG,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA2F;;;;ACAvH,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA+F;;;;ACA3H,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAAqG;;;;ACAjI,yBAAc,GAAG,IAAI,CAAC,KAAK,CAAC,CAA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CAAC;IAED,MAAM,CAAC,CAAC;QACN,aAAa,EAAE,CAAC;eACX,SAAS;eACT,iBAAU,CAAC,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC;2BAAA,SAAS;YAAA,CAAC;QAC9D,CAAC;QACD,UAAU,EAAE,CAAC;YACX,EAAE,EAAE,OAAO;QACb,CAAC;QACD,gBAAgB,EAAE,CAAC;YACjB,EAAE,EAAE,aAAa;QACnB,CAAC;QACD,qBAAqB,EAAE,CAAC;YACtB,EAAE,EAAE,UAAU;QAChB,CAAC;mBACD,SAAS;oBACT,UAAU;mBACV,SAAS;oBACT,UAAU;IACZ,CAAC;AACH,CAAC;;;;SChLe,yCAAc,CAAC,KAA2B,EAAmB,CAAC;IAC5E,GAAG,CAAC,CAAC,UAAA,OAAO,GAAE,CAAY,aAAE,SAAS,EAAA,CAAC,GAAG,KAAK;IAC9C,GAAG,CAAC,SAAS,GAAG,YAAK;IAErB,MAAM,CAAC,CAAC;QACN,SAAS,EAAE,CAAC;YACV,IAAI,EAAE,CAAc;QACtB,CAAC;QACD,YAAY,EAAE,OAAO,GAAG,CAAC;YACvB,EAAgE,AAAhE,8DAAgE;YAChE,EAAiE,AAAjE,+DAAiE;YACjE,EAAmC,AAAnC,iCAAmC;YACnC,EAAE,EAAE,SAAS;YACb,CAAa,cAAE,IAAI;QACrB,CAAC,GAAG,CAAC;QAAA,CAAC;QACN,UAAU,EAAE,CAAC;YACX,IAAI,EAAE,CAAO;YACb,CAAY,aAAE,SAAS;YACvB,CAAiB,kBAAE,OAAO,GAAG,SAAS,GAAG,SAAS;QACpD,CAAC;IACH,CAAC;AACH,CAAC;;","sources":["packages/@react-aria/menu/src/index.ts","packages/@react-aria/menu/src/useMenuTrigger.ts","packages/@react-aria/menu/intl/*.js","packages/@react-aria/menu/intl/ar-AE.json","packages/@react-aria/menu/intl/bg-BG.json","packages/@react-aria/menu/intl/cs-CZ.json","packages/@react-aria/menu/intl/da-DK.json","packages/@react-aria/menu/intl/de-DE.json","packages/@react-aria/menu/intl/el-GR.json","packages/@react-aria/menu/intl/en-US.json","packages/@react-aria/menu/intl/es-ES.json","packages/@react-aria/menu/intl/et-EE.json","packages/@react-aria/menu/intl/fi-FI.json","packages/@react-aria/menu/intl/fr-FR.json","packages/@react-aria/menu/intl/he-IL.json","packages/@react-aria/menu/intl/hr-HR.json","packages/@react-aria/menu/intl/hu-HU.json","packages/@react-aria/menu/intl/it-IT.json","packages/@react-aria/menu/intl/ja-JP.json","packages/@react-aria/menu/intl/ko-KR.json","packages/@react-aria/menu/intl/lt-LT.json","packages/@react-aria/menu/intl/lv-LV.json","packages/@react-aria/menu/intl/nb-NO.json","packages/@react-aria/menu/intl/nl-NL.json","packages/@react-aria/menu/intl/pl-PL.json","packages/@react-aria/menu/intl/pt-BR.json","packages/@react-aria/menu/intl/pt-PT.json","packages/@react-aria/menu/intl/ro-RO.json","packages/@react-aria/menu/intl/ru-RU.json","packages/@react-aria/menu/intl/sk-SK.json","packages/@react-aria/menu/intl/sl-SI.json","packages/@react-aria/menu/intl/sr-SP.json","packages/@react-aria/menu/intl/sv-SE.json","packages/@react-aria/menu/intl/tr-TR.json","packages/@react-aria/menu/intl/uk-UA.json","packages/@react-aria/menu/intl/zh-CN.json","packages/@react-aria/menu/intl/zh-TW.json","packages/@react-aria/menu/src/useMenu.ts","packages/@react-aria/menu/src/useMenuItem.ts","packages/@react-aria/menu/src/useMenuSection.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useMenuTrigger} from './useMenuTrigger';\nexport {useMenu} from './useMenu';\nexport {useMenuItem} from './useMenuItem';\nexport {useMenuSection} from './useMenuSection';\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaButtonProps} from '@react-types/button';\nimport {AriaMenuOptions} from './useMenu';\n// @ts-ignore\nimport intlMessages from '../intl/*.json';\nimport {MenuTriggerState} from '@react-stately/menu';\nimport {MenuTriggerType} from '@react-types/menu';\nimport {RefObject} from 'react';\nimport {useId} from '@react-aria/utils';\nimport {useLongPress} from '@react-aria/interactions';\nimport {useMessageFormatter} from '@react-aria/i18n';\nimport {useOverlayTrigger} from '@react-aria/overlays';\n\ninterface MenuTriggerAriaProps {\n /** The type of menu that the menu trigger opens. */\n type?: 'menu' | 'listbox',\n /** Whether menu trigger is disabled. */\n isDisabled?: boolean,\n /** How menu is triggered. */\n trigger?: MenuTriggerType\n}\n\ninterface MenuTriggerAria<T> {\n /** Props for the menu trigger element. */\n menuTriggerProps: AriaButtonProps,\n\n /** Props for the menu. */\n menuProps: AriaMenuOptions<T>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a menu trigger.\n * @param props - Props for the menu trigger.\n * @param state - State for the menu trigger.\n */\nexport function useMenuTrigger<T>(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria<T> {\n let {\n type = 'menu' as MenuTriggerAriaProps['type'],\n isDisabled,\n trigger = 'press'\n } = props;\n\n let menuTriggerId = useId();\n let {triggerProps, overlayProps} = useOverlayTrigger({type}, state, ref);\n\n let onKeyDown = (e) => {\n if (isDisabled) {\n return;\n }\n\n if (trigger === 'longPress' && !e.altKey) {\n return;\n }\n\n if (ref && ref.current) {\n switch (e.key) {\n case 'Enter':\n case ' ':\n if (trigger === 'longPress') {\n return;\n }\n // fallthrough\n case 'ArrowDown':\n // Stop propagation, unless it would already be handled by useKeyboard.\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('first');\n break;\n case 'ArrowUp':\n if (!('continuePropagation' in e)) {\n e.stopPropagation();\n }\n e.preventDefault();\n state.toggle('last');\n break;\n }\n }\n };\n\n let formatMessage = useMessageFormatter(intlMessages);\n let {longPressProps} = useLongPress({\n isDisabled: isDisabled || trigger !== 'longPress',\n accessibilityDescription: formatMessage('longPressMessage'),\n onLongPressStart() {\n state.close();\n },\n onLongPress() {\n state.open('first');\n }\n });\n\n let pressProps = {\n onPressStart(e) {\n // For consistency with native, open the menu on mouse/key down, but touch up.\n if (e.pointerType !== 'touch' && e.pointerType !== 'keyboard' && !isDisabled) {\n // If opened with a screen reader, auto focus the first item.\n // Otherwise, the menu itself will be focused.\n state.toggle(e.pointerType === 'virtual' ? 'first' : null);\n }\n },\n onPress(e) {\n if (e.pointerType === 'touch' && !isDisabled) {\n state.toggle();\n }\n }\n };\n\n return {\n menuTriggerProps: {\n ...triggerProps,\n ...(trigger === 'press' ? pressProps : longPressProps),\n id: menuTriggerId,\n onKeyDown\n },\n menuProps: {\n ...overlayProps,\n 'aria-labelledby': menuTriggerId,\n autoFocus: state.focusStrategy,\n onClose: state.close\n }\n };\n}\n","const _temp0 = require(\"./ar-AE.json\");\nconst _temp1 = require(\"./bg-BG.json\");\nconst _temp2 = require(\"./cs-CZ.json\");\nconst _temp3 = require(\"./da-DK.json\");\nconst _temp4 = require(\"./de-DE.json\");\nconst _temp5 = require(\"./el-GR.json\");\nconst _temp6 = require(\"./en-US.json\");\nconst _temp7 = require(\"./es-ES.json\");\nconst _temp8 = require(\"./et-EE.json\");\nconst _temp9 = require(\"./fi-FI.json\");\nconst _temp10 = require(\"./fr-FR.json\");\nconst _temp11 = require(\"./he-IL.json\");\nconst _temp12 = require(\"./hr-HR.json\");\nconst _temp13 = require(\"./hu-HU.json\");\nconst _temp14 = require(\"./it-IT.json\");\nconst _temp15 = require(\"./ja-JP.json\");\nconst _temp16 = require(\"./ko-KR.json\");\nconst _temp17 = require(\"./lt-LT.json\");\nconst _temp18 = require(\"./lv-LV.json\");\nconst _temp19 = require(\"./nb-NO.json\");\nconst _temp20 = require(\"./nl-NL.json\");\nconst _temp21 = require(\"./pl-PL.json\");\nconst _temp22 = require(\"./pt-BR.json\");\nconst _temp23 = require(\"./pt-PT.json\");\nconst _temp24 = require(\"./ro-RO.json\");\nconst _temp25 = require(\"./ru-RU.json\");\nconst _temp26 = require(\"./sk-SK.json\");\nconst _temp27 = require(\"./sl-SI.json\");\nconst _temp28 = require(\"./sr-SP.json\");\nconst _temp29 = require(\"./sv-SE.json\");\nconst _temp30 = require(\"./tr-TR.json\");\nconst _temp31 = require(\"./uk-UA.json\");\nconst _temp32 = require(\"./zh-CN.json\");\nconst _temp33 = require(\"./zh-TW.json\");\nmodule.exports = {\n \"ar-AE\": _temp0,\n \"bg-BG\": _temp1,\n \"cs-CZ\": _temp2,\n \"da-DK\": _temp3,\n \"de-DE\": _temp4,\n \"el-GR\": _temp5,\n \"en-US\": _temp6,\n \"es-ES\": _temp7,\n \"et-EE\": _temp8,\n \"fi-FI\": _temp9,\n \"fr-FR\": _temp10,\n \"he-IL\": _temp11,\n \"hr-HR\": _temp12,\n \"hu-HU\": _temp13,\n \"it-IT\": _temp14,\n \"ja-JP\": _temp15,\n \"ko-KR\": _temp16,\n \"lt-LT\": _temp17,\n \"lv-LV\": _temp18,\n \"nb-NO\": _temp19,\n \"nl-NL\": _temp20,\n \"pl-PL\": _temp21,\n \"pt-BR\": _temp22,\n \"pt-PT\": _temp23,\n \"ro-RO\": _temp24,\n \"ru-RU\": _temp25,\n \"sk-SK\": _temp26,\n \"sl-SI\": _temp27,\n \"sr-SP\": _temp28,\n \"sv-SE\": _temp29,\n \"tr-TR\": _temp30,\n \"uk-UA\": _temp31,\n \"zh-CN\": _temp32,\n \"zh-TW\": _temp33\n}","{\n \"longPressMessage\": \"اضغط مطولاً أو اضغط على Alt + السهم لأسفل لفتح القائمة\"\n}\n","{\n \"longPressMessage\": \"Натиснете продължително или натиснете Alt+ стрелка надолу, за да отворите менюто\"\n}\n","{\n \"longPressMessage\": \"Dlouhým stiskem nebo stisknutím kláves Alt + šipka dolů otevřete nabídku\"\n}\n","{\n \"longPressMessage\": \"Langt tryk eller tryk på Alt + pil ned for at åbne menuen\"\n}\n","{\n \"longPressMessage\": \"Drücken Sie lange oder drücken Sie Alt + Nach-unten, um das Menü zu öffnen\"\n}\n","{\n \"longPressMessage\": \"Πιέστε παρατεταμένα ή πατήστε Alt + κάτω βέλος για να ανοίξετε το μενού\"\n}\n","{\n \"longPressMessage\": \"Long press or press Alt + ArrowDown to open menu\"\n}\n","{\n \"longPressMessage\": \"Mantenga pulsado o pulse Alt + flecha abajo para abrir el menú\"\n}\n","{\n \"longPressMessage\": \"Menüü avamiseks vajutage pikalt või vajutage klahve Alt + allanool\"\n}\n","{\n \"longPressMessage\": \"Avaa valikko painamalla pohjassa tai näppäinyhdistelmällä Alt + Alanuoli\"\n}\n","{\n \"longPressMessage\": \"Appuyez de manière prolongée ou appuyez sur Alt + Flèche vers le bas pour ouvrir le menu.\"\n}\n","{\n \"longPressMessage\": \"לחץ לחיצה ארוכה או הקש Alt + ArrowDown כדי לפתוח את התפריט\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dolje za otvaranje izbornika\"\n}\n","{\n \"longPressMessage\": \"Nyomja meg hosszan, vagy nyomja meg az Alt + lefele nyíl gombot a menü megnyitásához\"\n}\n","{\n \"longPressMessage\": \"Premere a lungo o premere Alt + Freccia giù per aprire il menu\"\n}\n","{\n \"longPressMessage\": \"長押しまたは Alt+下矢印キーでメニューを開く\"\n}\n","{\n \"longPressMessage\": \"길게 누르거나 Alt + 아래쪽 화살표를 눌러 메뉴 열기\"\n}\n","{\n \"longPressMessage\": \"Norėdami atidaryti meniu, nuspaudę palaikykite arba paspauskite „Alt + ArrowDown“.\"\n}\n","{\n \"longPressMessage\": \"Lai atvērtu izvēlni, turiet nospiestu vai nospiediet taustiņu kombināciju Alt + lejupvērstā bultiņa\"\n}\n","{\n \"longPressMessage\": \"Langt trykk eller trykk Alt + PilNed for å åpne menyen\"\n}\n","{\n \"longPressMessage\": \"Druk lang op Alt + pijl-omlaag of druk op Alt om het menu te openen\"\n}\n","{\n \"longPressMessage\": \"Naciśnij i przytrzymaj lub naciśnij klawisze Alt + Strzałka w dół, aby otworzyć menu\"\n}\n","{\n \"longPressMessage\": \"Pressione e segure ou pressione Alt + Seta para baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Prima continuamente ou prima Alt + Seta Para Baixo para abrir o menu\"\n}\n","{\n \"longPressMessage\": \"Apăsați lung sau apăsați pe Alt + săgeată în jos pentru a deschide meniul\"\n}\n","{\n \"longPressMessage\": \"Нажмите и удерживайте или нажмите Alt + Стрелка вниз, чтобы открыть меню\"\n}\n","{\n \"longPressMessage\": \"Ponuku otvoríte dlhým stlačením alebo stlačením klávesu Alt + klávesu so šípkou nadol\"\n}\n","{\n \"longPressMessage\": \"Za odprtje menija pritisnite in držite gumb ali pritisnite Alt+puščica navzdol\"\n}\n","{\n \"longPressMessage\": \"Dugo pritisnite ili pritisnite Alt + strelicu prema dole da otvorite meni\"\n}\n","{\n \"longPressMessage\": \"Håll nedtryckt eller tryck på Alt + pil nedåt för att öppna menyn\"\n}\n","{\n \"longPressMessage\": \"Menüyü açmak için uzun basın veya Alt + Aşağı Ok tuşuna basın\"\n}\n","{\n \"longPressMessage\": \"Довго або звичайно натисніть комбінацію клавіш Alt і стрілка вниз, щоб відкрити меню\"\n}\n","{\n \"longPressMessage\": \"长按或按 Alt + 向下方向键以打开菜单\"\n}\n","{\n \"longPressMessage\": \"長按或按 Alt+向下鍵以開啟功能表\"\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {AriaMenuProps} from '@react-types/menu';\nimport {filterDOMProps, mergeProps} from '@react-aria/utils';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {KeyboardDelegate} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableList} from '@react-aria/selection';\n\ninterface MenuAria {\n /** Props for the menu element. */\n menuProps: HTMLAttributes<HTMLElement>\n}\n\nexport interface AriaMenuOptions<T> extends Omit<AriaMenuProps<T>, 'children'> {\n /** Whether the menu uses virtual scrolling. */\n isVirtualized?: boolean,\n\n /**\n * An optional keyboard delegate implementation for type to select,\n * to override the default.\n */\n keyboardDelegate?: KeyboardDelegate\n}\n\ninterface MenuData {\n onClose?: () => void,\n onAction?: (key: Key) => void\n}\n\nexport const menuData = new WeakMap<TreeState<unknown>, MenuData>();\n\n/**\n * Provides the behavior and accessibility implementation for a menu component.\n * A menu displays a list of actions or options that a user can choose.\n * @param props - Props for the menu.\n * @param state - State for the menu, as returned by `useListState`.\n */\nexport function useMenu<T>(props: AriaMenuOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuAria {\n let {\n shouldFocusWrap = true,\n ...otherProps\n } = props;\n\n if (!props['aria-label'] && !props['aria-labelledby']) {\n console.warn('An aria-label or aria-labelledby prop is required for accessibility.');\n }\n\n let domProps = filterDOMProps(props, {labelable: true});\n let {listProps} = useSelectableList({\n ...otherProps,\n ref,\n selectionManager: state.selectionManager,\n collection: state.collection,\n disabledKeys: state.disabledKeys,\n shouldFocusWrap\n });\n\n menuData.set(state, {\n onClose: props.onClose,\n onAction: props.onAction\n });\n\n return {\n menuProps: mergeProps(domProps, {\n role: 'menu',\n ...listProps\n })\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {getItemCount} from '@react-stately/collections';\nimport {HTMLAttributes, Key, RefObject} from 'react';\nimport {isFocusVisible, useHover, usePress} from '@react-aria/interactions';\nimport {menuData} from './useMenu';\nimport {mergeProps, useSlotId} from '@react-aria/utils';\nimport {PressEvent} from '@react-types/shared';\nimport {TreeState} from '@react-stately/tree';\nimport {useSelectableItem} from '@react-aria/selection';\n\ninterface MenuItemAria {\n /** Props for the menu item element. */\n menuItemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the main text element inside the menu item. */\n labelProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the description text element inside the menu item, if any. */\n descriptionProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the keyboard shortcut text element inside the item, if any. */\n keyboardShortcutProps: HTMLAttributes<HTMLElement>,\n\n /** Whether the item is currently focused. */\n isFocused: boolean,\n /** Whether the item is currently selected. */\n isSelected: boolean,\n /** Whether the item is currently in a pressed state. */\n isPressed: boolean,\n /** Whether the item is disabled. */\n isDisabled: boolean\n}\n\ninterface AriaMenuItemProps {\n /**\n * Whether the menu item is disabled.\n * @deprecated - pass disabledKeys to useTreeState instead.\n */\n isDisabled?: boolean,\n\n /**\n * Whether the menu item is selected.\n * @deprecated - pass selectedKeys to useTreeState instead.\n */\n isSelected?: boolean,\n\n /** A screen reader only label for the menu item. */\n 'aria-label'?: string,\n\n /** The unique key for the menu item. */\n key?: Key,\n\n /**\n * Handler that is called when the menu should close after selecting an item.\n * @deprecated - pass to the menu instead.\n */\n onClose?: () => void,\n\n /**\n * Whether the menu should close when the menu item is selected.\n * @default true\n */\n closeOnSelect?: boolean,\n\n /** Whether the menu item is contained in a virtual scrolling menu. */\n isVirtualized?: boolean,\n\n /**\n * Handler that is called when the user activates the item.\n * @deprecated - pass to the menu instead.\n */\n onAction?: (key: Key) => void\n}\n\n/**\n * Provides the behavior and accessibility implementation for an item in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the item.\n * @param state - State for the menu, as returned by `useTreeState`.\n */\nexport function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuItemAria {\n let {\n key,\n closeOnSelect,\n isVirtualized\n } = props;\n\n let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);\n let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);\n let isFocused = state.selectionManager.focusedKey === key;\n\n let data = menuData.get(state);\n let onClose = props.onClose || data.onClose;\n let onAction = props.onAction || data.onAction;\n\n let role = 'menuitem';\n if (state.selectionManager.selectionMode === 'single') {\n role = 'menuitemradio';\n } else if (state.selectionManager.selectionMode === 'multiple') {\n role = 'menuitemcheckbox';\n }\n\n let labelId = useSlotId();\n let descriptionId = useSlotId();\n let keyboardId = useSlotId();\n\n let ariaProps = {\n 'aria-disabled': isDisabled,\n role,\n 'aria-label': props['aria-label'],\n 'aria-labelledby': labelId,\n 'aria-describedby': [descriptionId, keyboardId].filter(Boolean).join(' ') || undefined\n };\n\n if (state.selectionManager.selectionMode !== 'none') {\n ariaProps['aria-checked'] = isSelected;\n }\n\n if (isVirtualized) {\n ariaProps['aria-posinset'] = state.collection.getItem(key).index;\n ariaProps['aria-setsize'] = getItemCount(state.collection);\n }\n\n let onKeyDown = (e: KeyboardEvent) => {\n // Ignore repeating events, which may have started on the menu trigger before moving\n // focus to the menu item. We want to wait for a second complete key press sequence.\n if (e.repeat) {\n return;\n }\n\n switch (e.key) {\n case ' ':\n if (!isDisabled && state.selectionManager.selectionMode === 'none' && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n case 'Enter':\n // The Enter key should always close on select, except if overridden.\n if (!isDisabled && closeOnSelect !== false && onClose) {\n onClose();\n }\n break;\n }\n };\n\n let onPressStart = (e: PressEvent) => {\n if (e.pointerType === 'keyboard' && onAction) {\n onAction(key);\n }\n };\n\n let onPressUp = (e: PressEvent) => {\n if (e.pointerType !== 'keyboard') {\n if (onAction) {\n onAction(key);\n }\n\n // Pressing a menu item should close by default in single selection mode but not multiple\n // selection mode, except if overridden by the closeOnSelect prop.\n if (onClose && (closeOnSelect ?? state.selectionManager.selectionMode !== 'multiple')) {\n onClose();\n }\n }\n };\n\n let {itemProps} = useSelectableItem({\n selectionManager: state.selectionManager,\n key,\n ref,\n shouldSelectOnPressUp: true,\n allowsDifferentPressOrigin: true\n });\n\n let {pressProps, isPressed} = usePress({onPressStart, onPressUp, isDisabled});\n let {hoverProps} = useHover({\n isDisabled,\n onHoverStart() {\n if (!isFocusVisible()) {\n state.selectionManager.setFocused(true);\n state.selectionManager.setFocusedKey(key);\n }\n }\n });\n\n return {\n menuItemProps: {\n ...ariaProps,\n ...mergeProps(itemProps, pressProps, hoverProps, {onKeyDown})\n },\n labelProps: {\n id: labelId\n },\n descriptionProps: {\n id: descriptionId\n },\n keyboardShortcutProps: {\n id: keyboardId\n },\n isFocused,\n isSelected,\n isPressed,\n isDisabled\n };\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {HTMLAttributes, ReactNode} from 'react';\nimport {useId} from '@react-aria/utils';\n\ninterface AriaMenuSectionProps {\n /** The heading for the section. */\n heading?: ReactNode,\n /** An accessibility label for the section. Required if `heading` is not present. */\n 'aria-label'?: string\n}\n\ninterface MenuSectionAria {\n /** Props for the wrapper list item. */\n itemProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the heading element, if any. */\n headingProps: HTMLAttributes<HTMLElement>,\n\n /** Props for the group element. */\n groupProps: HTMLAttributes<HTMLElement>\n}\n\n/**\n * Provides the behavior and accessibility implementation for a section in a menu.\n * See `useMenu` for more details about menus.\n * @param props - Props for the section.\n */\nexport function useMenuSection(props: AriaMenuSectionProps): MenuSectionAria {\n let {heading, 'aria-label': ariaLabel} = props;\n let headingId = useId();\n\n return {\n itemProps: {\n role: 'presentation'\n },\n headingProps: heading ? {\n // Techincally, menus cannot contain headings according to ARIA.\n // We hide the heading from assistive technology, and only use it\n // as a label for the nested group.\n id: headingId,\n 'aria-hidden': true\n } : {},\n groupProps: {\n role: 'group',\n 'aria-label': ariaLabel,\n 'aria-labelledby': heading ? headingId : undefined\n }\n };\n}\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AriaMenuProps, MenuTriggerType } from "@react-types/menu";
|
|
2
2
|
import { HTMLAttributes, RefObject, Key, ReactNode } from "react";
|
|
3
|
-
import { MenuTriggerState } from "@react-stately/menu";
|
|
4
|
-
import { MenuTriggerType, AriaMenuProps } from "@react-types/menu";
|
|
5
3
|
import { KeyboardDelegate } from "@react-types/shared";
|
|
6
4
|
import { TreeState } from "@react-stately/tree";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type?: 'menu' | 'listbox';
|
|
10
|
-
/** Whether menu trigger is disabled. */
|
|
11
|
-
isDisabled?: boolean;
|
|
12
|
-
/** How menu is triggered. */
|
|
13
|
-
trigger?: MenuTriggerType;
|
|
14
|
-
}
|
|
15
|
-
interface MenuTriggerAria {
|
|
16
|
-
/** Props for the menu trigger element. */
|
|
17
|
-
menuTriggerProps: AriaButtonProps;
|
|
18
|
-
/** Props for the menu. */
|
|
19
|
-
menuProps: HTMLAttributes<HTMLElement>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Provides the behavior and accessibility implementation for a menu trigger.
|
|
23
|
-
* @param props - Props for the menu trigger.
|
|
24
|
-
* @param state - State for the menu trigger.
|
|
25
|
-
*/
|
|
26
|
-
export function useMenuTrigger(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria;
|
|
5
|
+
import { AriaButtonProps } from "@react-types/button";
|
|
6
|
+
import { MenuTriggerState } from "@react-stately/menu";
|
|
27
7
|
interface MenuAria {
|
|
28
8
|
/** Props for the menu element. */
|
|
29
9
|
menuProps: HTMLAttributes<HTMLElement>;
|
|
30
10
|
}
|
|
31
|
-
interface AriaMenuOptions<T> extends AriaMenuProps<T> {
|
|
11
|
+
interface AriaMenuOptions<T> extends Omit<AriaMenuProps<T>, 'children'> {
|
|
32
12
|
/** Whether the menu uses virtual scrolling. */
|
|
33
13
|
isVirtualized?: boolean;
|
|
34
14
|
/**
|
|
@@ -44,6 +24,26 @@ interface AriaMenuOptions<T> extends AriaMenuProps<T> {
|
|
|
44
24
|
* @param state - State for the menu, as returned by `useListState`.
|
|
45
25
|
*/
|
|
46
26
|
export function useMenu<T>(props: AriaMenuOptions<T>, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuAria;
|
|
27
|
+
interface MenuTriggerAriaProps {
|
|
28
|
+
/** The type of menu that the menu trigger opens. */
|
|
29
|
+
type?: 'menu' | 'listbox';
|
|
30
|
+
/** Whether menu trigger is disabled. */
|
|
31
|
+
isDisabled?: boolean;
|
|
32
|
+
/** How menu is triggered. */
|
|
33
|
+
trigger?: MenuTriggerType;
|
|
34
|
+
}
|
|
35
|
+
interface MenuTriggerAria<T> {
|
|
36
|
+
/** Props for the menu trigger element. */
|
|
37
|
+
menuTriggerProps: AriaButtonProps;
|
|
38
|
+
/** Props for the menu. */
|
|
39
|
+
menuProps: AriaMenuOptions<T>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Provides the behavior and accessibility implementation for a menu trigger.
|
|
43
|
+
* @param props - Props for the menu trigger.
|
|
44
|
+
* @param state - State for the menu trigger.
|
|
45
|
+
*/
|
|
46
|
+
export function useMenuTrigger<T>(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria<T>;
|
|
47
47
|
interface MenuItemAria {
|
|
48
48
|
/** Props for the menu item element. */
|
|
49
49
|
menuItemProps: HTMLAttributes<HTMLElement>;
|
|
@@ -53,17 +53,34 @@ interface MenuItemAria {
|
|
|
53
53
|
descriptionProps: HTMLAttributes<HTMLElement>;
|
|
54
54
|
/** Props for the keyboard shortcut text element inside the item, if any. */
|
|
55
55
|
keyboardShortcutProps: HTMLAttributes<HTMLElement>;
|
|
56
|
+
/** Whether the item is currently focused. */
|
|
57
|
+
isFocused: boolean;
|
|
58
|
+
/** Whether the item is currently selected. */
|
|
59
|
+
isSelected: boolean;
|
|
60
|
+
/** Whether the item is currently in a pressed state. */
|
|
61
|
+
isPressed: boolean;
|
|
62
|
+
/** Whether the item is disabled. */
|
|
63
|
+
isDisabled: boolean;
|
|
56
64
|
}
|
|
57
65
|
interface AriaMenuItemProps {
|
|
58
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Whether the menu item is disabled.
|
|
68
|
+
* @deprecated - pass disabledKeys to useTreeState instead.
|
|
69
|
+
*/
|
|
59
70
|
isDisabled?: boolean;
|
|
60
|
-
/**
|
|
71
|
+
/**
|
|
72
|
+
* Whether the menu item is selected.
|
|
73
|
+
* @deprecated - pass selectedKeys to useTreeState instead.
|
|
74
|
+
*/
|
|
61
75
|
isSelected?: boolean;
|
|
62
76
|
/** A screen reader only label for the menu item. */
|
|
63
77
|
'aria-label'?: string;
|
|
64
78
|
/** The unique key for the menu item. */
|
|
65
79
|
key?: Key;
|
|
66
|
-
/**
|
|
80
|
+
/**
|
|
81
|
+
* Handler that is called when the menu should close after selecting an item.
|
|
82
|
+
* @deprecated - pass to the menu instead.
|
|
83
|
+
*/
|
|
67
84
|
onClose?: () => void;
|
|
68
85
|
/**
|
|
69
86
|
* Whether the menu should close when the menu item is selected.
|
|
@@ -72,7 +89,10 @@ interface AriaMenuItemProps {
|
|
|
72
89
|
closeOnSelect?: boolean;
|
|
73
90
|
/** Whether the menu item is contained in a virtual scrolling menu. */
|
|
74
91
|
isVirtualized?: boolean;
|
|
75
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Handler that is called when the user activates the item.
|
|
94
|
+
* @deprecated - pass to the menu instead.
|
|
95
|
+
*/
|
|
76
96
|
onAction?: (key: Key) => void;
|
|
77
97
|
}
|
|
78
98
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;
|
|
1
|
+
{"mappings":";;;;;;AAmBA;IACE,kCAAkC;IAClC,SAAS,EAAE,eAAe,WAAW,CAAC,CAAA;CACvC;AAED,0BAAiC,CAAC,CAAE,SAAQ,IAAI,CAAC,cAAc,CAAC,CAAC,EAAE,UAAU,CAAC;IAC5E,+CAA+C;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;CACpC;AASD;;;;;GAKG;AACH,wBAAwB,CAAC,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,QAAQ,CA+BhH;ACvDD;IACE,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,wCAAwC;IACxC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,OAA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,CAAC,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,UAAU,WAAW,CAAC,GAAG,YAAY,CA2HvH;ACvMD;IACE,mCAAmC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,oFAAoF;IACpF,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;IACE,uCAAuC;IACvC,SAAS,EAAE,eAAe,WAAW,CAAC,CAAC;IAEvC,6CAA6C;IAC7C,YAAY,EAAE,eAAe,WAAW,CAAC,CAAC;IAE1C,mCAAmC;IACnC,UAAU,EAAE,eAAe,WAAW,CAAC,CAAA;CACxC;AAED;;;;GAIG;AACH,+BAA+B,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAqB3E","sources":["packages/@react-aria/menu/src/packages/@react-aria/menu/src/useMenu.ts","packages/@react-aria/menu/src/packages/@react-aria/menu/src/useMenuTrigger.ts","packages/@react-aria/menu/src/packages/@react-aria/menu/src/useMenuItem.ts","packages/@react-aria/menu/src/packages/@react-aria/menu/src/useMenuSection.ts","packages/@react-aria/menu/src/packages/@react-aria/menu/src/index.ts","packages/@react-aria/menu/src/index.ts"],"sourcesContent":[null,null,null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {useMenuTrigger} from './useMenuTrigger';\nexport {useMenu} from './useMenu';\nexport {useMenuItem} from './useMenuItem';\nexport {useMenuSection} from './useMenuSection';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/menu",
|
|
3
|
-
"version": "3.5.2-nightly.
|
|
3
|
+
"version": "3.5.2-nightly.3358+a5a9d95db",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -18,17 +18,17 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/runtime": "^7.6.2",
|
|
21
|
-
"@react-aria/i18n": "3.0.0-nightly.
|
|
22
|
-
"@react-aria/interactions": "3.0.0-nightly.
|
|
23
|
-
"@react-aria/overlays": "3.0.0-nightly.
|
|
24
|
-
"@react-aria/selection": "3.0.0-nightly.
|
|
25
|
-
"@react-aria/utils": "3.0.0-nightly.
|
|
26
|
-
"@react-stately/collections": "3.0.0-nightly.
|
|
27
|
-
"@react-stately/menu": "3.3.2-nightly.
|
|
28
|
-
"@react-stately/tree": "3.0.0-nightly.
|
|
29
|
-
"@react-types/button": "3.5.2-nightly.
|
|
30
|
-
"@react-types/menu": "3.6.2-nightly.
|
|
31
|
-
"@react-types/shared": "3.0.0-nightly.
|
|
21
|
+
"@react-aria/i18n": "3.0.0-nightly.1658+a5a9d95db",
|
|
22
|
+
"@react-aria/interactions": "3.0.0-nightly.1658+a5a9d95db",
|
|
23
|
+
"@react-aria/overlays": "3.0.0-nightly.1658+a5a9d95db",
|
|
24
|
+
"@react-aria/selection": "3.0.0-nightly.1658+a5a9d95db",
|
|
25
|
+
"@react-aria/utils": "3.0.0-nightly.1658+a5a9d95db",
|
|
26
|
+
"@react-stately/collections": "3.0.0-nightly.1658+a5a9d95db",
|
|
27
|
+
"@react-stately/menu": "3.3.2-nightly.3358+a5a9d95db",
|
|
28
|
+
"@react-stately/tree": "3.0.0-nightly.1658+a5a9d95db",
|
|
29
|
+
"@react-types/button": "3.5.2-nightly.3358+a5a9d95db",
|
|
30
|
+
"@react-types/menu": "3.6.2-nightly.3358+a5a9d95db",
|
|
31
|
+
"@react-types/shared": "3.0.0-nightly.1658+a5a9d95db"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0",
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"publishConfig": {
|
|
38
38
|
"access": "public"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "a5a9d95db94da277dca6267cca8bbe55dd6ccc69"
|
|
41
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
13
|
+
export {useMenuTrigger} from './useMenuTrigger';
|
|
14
|
+
export {useMenu} from './useMenu';
|
|
15
|
+
export {useMenuItem} from './useMenuItem';
|
|
16
|
+
export {useMenuSection} from './useMenuSection';
|
package/src/useMenu.ts
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import {AriaMenuProps} from '@react-types/menu';
|
|
14
14
|
import {filterDOMProps, mergeProps} from '@react-aria/utils';
|
|
15
|
-
import {HTMLAttributes, RefObject} from 'react';
|
|
15
|
+
import {HTMLAttributes, Key, RefObject} from 'react';
|
|
16
16
|
import {KeyboardDelegate} from '@react-types/shared';
|
|
17
17
|
import {TreeState} from '@react-stately/tree';
|
|
18
18
|
import {useSelectableList} from '@react-aria/selection';
|
|
@@ -22,7 +22,7 @@ interface MenuAria {
|
|
|
22
22
|
menuProps: HTMLAttributes<HTMLElement>
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
interface AriaMenuOptions<T> extends AriaMenuProps<T> {
|
|
25
|
+
export interface AriaMenuOptions<T> extends Omit<AriaMenuProps<T>, 'children'> {
|
|
26
26
|
/** Whether the menu uses virtual scrolling. */
|
|
27
27
|
isVirtualized?: boolean,
|
|
28
28
|
|
|
@@ -33,6 +33,13 @@ interface AriaMenuOptions<T> extends AriaMenuProps<T> {
|
|
|
33
33
|
keyboardDelegate?: KeyboardDelegate
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
interface MenuData {
|
|
37
|
+
onClose?: () => void,
|
|
38
|
+
onAction?: (key: Key) => void
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const menuData = new WeakMap<TreeState<unknown>, MenuData>();
|
|
42
|
+
|
|
36
43
|
/**
|
|
37
44
|
* Provides the behavior and accessibility implementation for a menu component.
|
|
38
45
|
* A menu displays a list of actions or options that a user can choose.
|
|
@@ -59,6 +66,11 @@ export function useMenu<T>(props: AriaMenuOptions<T>, state: TreeState<T>, ref:
|
|
|
59
66
|
shouldFocusWrap
|
|
60
67
|
});
|
|
61
68
|
|
|
69
|
+
menuData.set(state, {
|
|
70
|
+
onClose: props.onClose,
|
|
71
|
+
onAction: props.onAction
|
|
72
|
+
});
|
|
73
|
+
|
|
62
74
|
return {
|
|
63
75
|
menuProps: mergeProps(domProps, {
|
|
64
76
|
role: 'menu',
|
package/src/useMenuItem.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import {getItemCount} from '@react-stately/collections';
|
|
14
14
|
import {HTMLAttributes, Key, RefObject} from 'react';
|
|
15
15
|
import {isFocusVisible, useHover, usePress} from '@react-aria/interactions';
|
|
16
|
+
import {menuData} from './useMenu';
|
|
16
17
|
import {mergeProps, useSlotId} from '@react-aria/utils';
|
|
17
18
|
import {PressEvent} from '@react-types/shared';
|
|
18
19
|
import {TreeState} from '@react-stately/tree';
|
|
@@ -29,14 +30,29 @@ interface MenuItemAria {
|
|
|
29
30
|
descriptionProps: HTMLAttributes<HTMLElement>,
|
|
30
31
|
|
|
31
32
|
/** Props for the keyboard shortcut text element inside the item, if any. */
|
|
32
|
-
keyboardShortcutProps: HTMLAttributes<HTMLElement
|
|
33
|
+
keyboardShortcutProps: HTMLAttributes<HTMLElement>,
|
|
34
|
+
|
|
35
|
+
/** Whether the item is currently focused. */
|
|
36
|
+
isFocused: boolean,
|
|
37
|
+
/** Whether the item is currently selected. */
|
|
38
|
+
isSelected: boolean,
|
|
39
|
+
/** Whether the item is currently in a pressed state. */
|
|
40
|
+
isPressed: boolean,
|
|
41
|
+
/** Whether the item is disabled. */
|
|
42
|
+
isDisabled: boolean
|
|
33
43
|
}
|
|
34
44
|
|
|
35
45
|
interface AriaMenuItemProps {
|
|
36
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* Whether the menu item is disabled.
|
|
48
|
+
* @deprecated - pass disabledKeys to useTreeState instead.
|
|
49
|
+
*/
|
|
37
50
|
isDisabled?: boolean,
|
|
38
51
|
|
|
39
|
-
/**
|
|
52
|
+
/**
|
|
53
|
+
* Whether the menu item is selected.
|
|
54
|
+
* @deprecated - pass selectedKeys to useTreeState instead.
|
|
55
|
+
*/
|
|
40
56
|
isSelected?: boolean,
|
|
41
57
|
|
|
42
58
|
/** A screen reader only label for the menu item. */
|
|
@@ -45,7 +61,10 @@ interface AriaMenuItemProps {
|
|
|
45
61
|
/** The unique key for the menu item. */
|
|
46
62
|
key?: Key,
|
|
47
63
|
|
|
48
|
-
/**
|
|
64
|
+
/**
|
|
65
|
+
* Handler that is called when the menu should close after selecting an item.
|
|
66
|
+
* @deprecated - pass to the menu instead.
|
|
67
|
+
*/
|
|
49
68
|
onClose?: () => void,
|
|
50
69
|
|
|
51
70
|
/**
|
|
@@ -57,7 +76,10 @@ interface AriaMenuItemProps {
|
|
|
57
76
|
/** Whether the menu item is contained in a virtual scrolling menu. */
|
|
58
77
|
isVirtualized?: boolean,
|
|
59
78
|
|
|
60
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Handler that is called when the user activates the item.
|
|
81
|
+
* @deprecated - pass to the menu instead.
|
|
82
|
+
*/
|
|
61
83
|
onAction?: (key: Key) => void
|
|
62
84
|
}
|
|
63
85
|
|
|
@@ -69,15 +91,19 @@ interface AriaMenuItemProps {
|
|
|
69
91
|
*/
|
|
70
92
|
export function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, ref: RefObject<HTMLElement>): MenuItemAria {
|
|
71
93
|
let {
|
|
72
|
-
isSelected,
|
|
73
|
-
isDisabled,
|
|
74
94
|
key,
|
|
75
|
-
onClose,
|
|
76
95
|
closeOnSelect,
|
|
77
|
-
isVirtualized
|
|
78
|
-
onAction
|
|
96
|
+
isVirtualized
|
|
79
97
|
} = props;
|
|
80
98
|
|
|
99
|
+
let isDisabled = props.isDisabled ?? state.disabledKeys.has(key);
|
|
100
|
+
let isSelected = props.isSelected ?? state.selectionManager.isSelected(key);
|
|
101
|
+
let isFocused = state.selectionManager.focusedKey === key;
|
|
102
|
+
|
|
103
|
+
let data = menuData.get(state);
|
|
104
|
+
let onClose = props.onClose || data.onClose;
|
|
105
|
+
let onAction = props.onAction || data.onAction;
|
|
106
|
+
|
|
81
107
|
let role = 'menuitem';
|
|
82
108
|
if (state.selectionManager.selectionMode === 'single') {
|
|
83
109
|
role = 'menuitemradio';
|
|
@@ -156,7 +182,7 @@ export function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, re
|
|
|
156
182
|
allowsDifferentPressOrigin: true
|
|
157
183
|
});
|
|
158
184
|
|
|
159
|
-
let {pressProps} = usePress({onPressStart, onPressUp, isDisabled});
|
|
185
|
+
let {pressProps, isPressed} = usePress({onPressStart, onPressUp, isDisabled});
|
|
160
186
|
let {hoverProps} = useHover({
|
|
161
187
|
isDisabled,
|
|
162
188
|
onHoverStart() {
|
|
@@ -180,6 +206,10 @@ export function useMenuItem<T>(props: AriaMenuItemProps, state: TreeState<T>, re
|
|
|
180
206
|
},
|
|
181
207
|
keyboardShortcutProps: {
|
|
182
208
|
id: keyboardId
|
|
183
|
-
}
|
|
209
|
+
},
|
|
210
|
+
isFocused,
|
|
211
|
+
isSelected,
|
|
212
|
+
isPressed,
|
|
213
|
+
isDisabled
|
|
184
214
|
};
|
|
185
215
|
}
|
package/src/useMenuTrigger.ts
CHANGED
|
@@ -11,12 +11,13 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {AriaButtonProps} from '@react-types/button';
|
|
14
|
-
import {
|
|
14
|
+
import {AriaMenuOptions} from './useMenu';
|
|
15
15
|
// @ts-ignore
|
|
16
16
|
import intlMessages from '../intl/*.json';
|
|
17
17
|
import {MenuTriggerState} from '@react-stately/menu';
|
|
18
18
|
import {MenuTriggerType} from '@react-types/menu';
|
|
19
|
-
import {
|
|
19
|
+
import {RefObject} from 'react';
|
|
20
|
+
import {useId} from '@react-aria/utils';
|
|
20
21
|
import {useLongPress} from '@react-aria/interactions';
|
|
21
22
|
import {useMessageFormatter} from '@react-aria/i18n';
|
|
22
23
|
import {useOverlayTrigger} from '@react-aria/overlays';
|
|
@@ -30,12 +31,12 @@ interface MenuTriggerAriaProps {
|
|
|
30
31
|
trigger?: MenuTriggerType
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
interface MenuTriggerAria {
|
|
34
|
+
interface MenuTriggerAria<T> {
|
|
34
35
|
/** Props for the menu trigger element. */
|
|
35
36
|
menuTriggerProps: AriaButtonProps,
|
|
36
37
|
|
|
37
38
|
/** Props for the menu. */
|
|
38
|
-
menuProps:
|
|
39
|
+
menuProps: AriaMenuOptions<T>
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
/**
|
|
@@ -43,7 +44,7 @@ interface MenuTriggerAria {
|
|
|
43
44
|
* @param props - Props for the menu trigger.
|
|
44
45
|
* @param state - State for the menu trigger.
|
|
45
46
|
*/
|
|
46
|
-
export function useMenuTrigger(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria {
|
|
47
|
+
export function useMenuTrigger<T>(props: MenuTriggerAriaProps, state: MenuTriggerState, ref: RefObject<HTMLElement>): MenuTriggerAria<T> {
|
|
47
48
|
let {
|
|
48
49
|
type = 'menu' as MenuTriggerAriaProps['type'],
|
|
49
50
|
isDisabled,
|
|
@@ -117,17 +118,18 @@ export function useMenuTrigger(props: MenuTriggerAriaProps, state: MenuTriggerSt
|
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
|
|
120
|
-
triggerProps = mergeProps(triggerProps, trigger === 'press' ? pressProps : longPressProps);
|
|
121
|
-
|
|
122
121
|
return {
|
|
123
122
|
menuTriggerProps: {
|
|
124
123
|
...triggerProps,
|
|
124
|
+
...(trigger === 'press' ? pressProps : longPressProps),
|
|
125
125
|
id: menuTriggerId,
|
|
126
126
|
onKeyDown
|
|
127
127
|
},
|
|
128
128
|
menuProps: {
|
|
129
129
|
...overlayProps,
|
|
130
|
-
'aria-labelledby': menuTriggerId
|
|
130
|
+
'aria-labelledby': menuTriggerId,
|
|
131
|
+
autoFocus: state.focusStrategy,
|
|
132
|
+
onClose: state.close
|
|
131
133
|
}
|
|
132
134
|
};
|
|
133
135
|
}
|