@react-spectrum/menu 3.11.1-nightly.3856 → 3.11.1-nightly.3864
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/import.mjs +319 -185
- package/dist/main.css +1 -1
- package/dist/main.js +316 -181
- package/dist/main.js.map +1 -1
- package/dist/module.js +319 -185
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +29 -28
- package/src/Menu.tsx +40 -35
- package/src/MenuDialogTrigger.tsx +79 -0
- package/src/MenuItem.tsx +47 -17
- package/src/MenuTrigger.tsx +1 -0
- package/src/context.ts +26 -1
- package/src/index.ts +1 -0
package/dist/module.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import "./main.css";
|
|
2
2
|
import {Item as $5ae296f2d6923e14$re_export$Item, Section as $5ae296f2d6923e14$re_export$Section, getChildNodes as $9SHwR$getChildNodes} from "@react-stately/collections";
|
|
3
3
|
import {useDOMRef as $9SHwR$useDOMRef, useIsMobileDevice as $9SHwR$useIsMobileDevice, classNames as $9SHwR$classNames, SlotProvider as $9SHwR$SlotProvider, useStyleProps as $9SHwR$useStyleProps, ClearSlots as $9SHwR$ClearSlots, useSlotProps as $9SHwR$useSlotProps} from "@react-spectrum/utils";
|
|
4
|
-
import {Tray as $9SHwR$Tray, Popover as $9SHwR$Popover} from "@react-spectrum/overlays";
|
|
5
|
-
import {PressResponder as $9SHwR$PressResponder
|
|
4
|
+
import {Tray as $9SHwR$Tray, Popover as $9SHwR$Popover, Modal as $9SHwR$Modal} from "@react-spectrum/overlays";
|
|
5
|
+
import {PressResponder as $9SHwR$PressResponder} from "@react-aria/interactions";
|
|
6
6
|
import $9SHwR$react, {useRef as $9SHwR$useRef, Fragment as $9SHwR$Fragment, forwardRef as $9SHwR$forwardRef, useContext as $9SHwR$useContext} from "react";
|
|
7
7
|
import {useMenuTrigger as $9SHwR$useMenuTrigger, useMenu as $9SHwR$useMenu, useMenuItem as $9SHwR$useMenuItem, useMenuSection as $9SHwR$useMenuSection} from "@react-aria/menu";
|
|
8
8
|
import {useMenuTriggerState as $9SHwR$useMenuTriggerState} from "@react-stately/menu";
|
|
9
|
-
import {
|
|
9
|
+
import {FocusScope as $9SHwR$FocusScope, FocusRing as $9SHwR$FocusRing} from "@react-aria/focus";
|
|
10
|
+
import {mergeProps as $9SHwR$mergeProps, useSyncRef as $9SHwR$useSyncRef, useSlotId as $9SHwR$useSlotId, filterDOMProps as $9SHwR$filterDOMProps} from "@react-aria/utils";
|
|
10
11
|
import {useTreeState as $9SHwR$useTreeState} from "@react-stately/tree";
|
|
11
12
|
import $9SHwR$spectrumiconsuiCheckmarkMedium from "@spectrum-icons/ui/CheckmarkMedium";
|
|
12
|
-
import {FocusRing as $9SHwR$FocusRing} from "@react-aria/focus";
|
|
13
13
|
import {Grid as $9SHwR$Grid} from "@react-spectrum/layout";
|
|
14
|
+
import $9SHwR$spectrumiconsworkflowInfoOutline from "@spectrum-icons/workflow/InfoOutline";
|
|
14
15
|
import {Text as $9SHwR$Text} from "@react-spectrum/text";
|
|
16
|
+
import {useLocalizedStringFormatter as $9SHwR$useLocalizedStringFormatter} from "@react-aria/i18n";
|
|
15
17
|
import {useSeparator as $9SHwR$useSeparator} from "@react-aria/separator";
|
|
16
18
|
import {ActionButton as $9SHwR$ActionButton} from "@react-spectrum/button";
|
|
17
19
|
import $9SHwR$spectrumiconsworkflowMore from "@spectrum-icons/workflow/More";
|
|
18
|
-
import {
|
|
20
|
+
import {useOverlayTriggerState as $9SHwR$useOverlayTriggerState} from "@react-stately/overlays";
|
|
19
21
|
|
|
20
22
|
function $parcel$interopDefault(a) {
|
|
21
23
|
return a && a.__esModule ? a.default : a;
|
|
@@ -60,6 +62,14 @@ const $d94604d52c3e3feb$export$c7e742effb1c51e2 = (0, $9SHwR$react).createContex
|
|
|
60
62
|
function $d94604d52c3e3feb$export$21c7ab35b39f78ec() {
|
|
61
63
|
return (0, $9SHwR$useContext)($d94604d52c3e3feb$export$c7e742effb1c51e2);
|
|
62
64
|
}
|
|
65
|
+
const $d94604d52c3e3feb$export$e239f1ef5b7afe1a = (0, $9SHwR$react).createContext(undefined);
|
|
66
|
+
function $d94604d52c3e3feb$export$4bbcd0ebecc48abd() {
|
|
67
|
+
return (0, $9SHwR$useContext)($d94604d52c3e3feb$export$e239f1ef5b7afe1a);
|
|
68
|
+
}
|
|
69
|
+
const $d94604d52c3e3feb$export$24aad8519b95b41b = (0, $9SHwR$react).createContext({});
|
|
70
|
+
function $d94604d52c3e3feb$export$efa3856fc0e85e7f() {
|
|
71
|
+
return (0, $9SHwR$useContext)($d94604d52c3e3feb$export$24aad8519b95b41b);
|
|
72
|
+
}
|
|
63
73
|
|
|
64
74
|
|
|
65
75
|
|
|
@@ -170,6 +180,7 @@ function $aa0b855f135b86e3$var$MenuTrigger(props, ref) {
|
|
|
170
180
|
let isMobile = (0, $9SHwR$useIsMobileDevice)();
|
|
171
181
|
let menuContext = {
|
|
172
182
|
...menuProps,
|
|
183
|
+
state: state,
|
|
173
184
|
ref: menuRef,
|
|
174
185
|
onClose: state.close,
|
|
175
186
|
closeOnSelect: closeOnSelect,
|
|
@@ -227,90 +238,6 @@ function $aa0b855f135b86e3$var$MenuTrigger(props, ref) {
|
|
|
227
238
|
* governing permissions and limitations under the License.
|
|
228
239
|
*/
|
|
229
240
|
|
|
230
|
-
/*
|
|
231
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
232
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
233
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
234
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
235
|
-
*
|
|
236
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
237
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
238
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
239
|
-
* governing permissions and limitations under the License.
|
|
240
|
-
*/
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
function $48fb8f5e1202c980$export$2ce376c2cc3355c8(props) {
|
|
252
|
-
let { item: item , state: state , isVirtualized: isVirtualized , onAction: onAction } = props;
|
|
253
|
-
let { onClose: onClose , closeOnSelect: closeOnSelect } = (0, $d94604d52c3e3feb$export$21c7ab35b39f78ec)();
|
|
254
|
-
let { rendered: rendered , key: key } = item;
|
|
255
|
-
let isSelected = state.selectionManager.isSelected(key);
|
|
256
|
-
let isDisabled = state.disabledKeys.has(key);
|
|
257
|
-
let ref = (0, $9SHwR$useRef)();
|
|
258
|
-
let { menuItemProps: menuItemProps , labelProps: labelProps , descriptionProps: descriptionProps , keyboardShortcutProps: keyboardShortcutProps } = (0, $9SHwR$useMenuItem)({
|
|
259
|
-
isSelected: isSelected,
|
|
260
|
-
isDisabled: isDisabled,
|
|
261
|
-
"aria-label": item["aria-label"],
|
|
262
|
-
key: key,
|
|
263
|
-
onClose: onClose,
|
|
264
|
-
closeOnSelect: closeOnSelect,
|
|
265
|
-
isVirtualized: isVirtualized,
|
|
266
|
-
onAction: onAction
|
|
267
|
-
}, state, ref);
|
|
268
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $9SHwR$useHover)({
|
|
269
|
-
isDisabled: isDisabled
|
|
270
|
-
});
|
|
271
|
-
let contents = typeof rendered === "string" ? /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Text), null, rendered) : rendered;
|
|
272
|
-
return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$FocusRing), {
|
|
273
|
-
focusRingClass: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "focus-ring")
|
|
274
|
-
}, /*#__PURE__*/ (0, $9SHwR$react).createElement("li", {
|
|
275
|
-
...(0, $9SHwR$mergeProps)(menuItemProps, hoverProps),
|
|
276
|
-
ref: ref,
|
|
277
|
-
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-item", {
|
|
278
|
-
"is-disabled": isDisabled,
|
|
279
|
-
"is-selected": isSelected,
|
|
280
|
-
"is-selectable": state.selectionManager.selectionMode !== "none",
|
|
281
|
-
"is-hovered": isHovered
|
|
282
|
-
})
|
|
283
|
-
}, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Grid), {
|
|
284
|
-
UNSAFE_className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-itemGrid")
|
|
285
|
-
}, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$ClearSlots), null, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$SlotProvider), {
|
|
286
|
-
slots: {
|
|
287
|
-
text: {
|
|
288
|
-
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-itemLabel"],
|
|
289
|
-
...labelProps
|
|
290
|
-
},
|
|
291
|
-
end: {
|
|
292
|
-
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-end"],
|
|
293
|
-
...descriptionProps
|
|
294
|
-
},
|
|
295
|
-
icon: {
|
|
296
|
-
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-icon"],
|
|
297
|
-
size: "S"
|
|
298
|
-
},
|
|
299
|
-
description: {
|
|
300
|
-
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-description"],
|
|
301
|
-
...descriptionProps
|
|
302
|
-
},
|
|
303
|
-
keyboard: {
|
|
304
|
-
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-keyboard"],
|
|
305
|
-
...keyboardShortcutProps
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}, contents, isSelected && /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$spectrumiconsuiCheckmarkMedium), {
|
|
309
|
-
slot: "checkmark",
|
|
310
|
-
UNSAFE_className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-checkmark")
|
|
311
|
-
}))))));
|
|
312
|
-
}
|
|
313
|
-
|
|
314
241
|
|
|
315
242
|
/*
|
|
316
243
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -327,103 +254,11 @@ function $48fb8f5e1202c980$export$2ce376c2cc3355c8(props) {
|
|
|
327
254
|
|
|
328
255
|
|
|
329
256
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
function $b966e606890cc5ca$export$4b1545b4f2016d26(props) {
|
|
333
|
-
let { item: item , state: state , onAction: onAction } = props;
|
|
334
|
-
let { itemProps: itemProps , headingProps: headingProps , groupProps: groupProps } = (0, $9SHwR$useMenuSection)({
|
|
335
|
-
heading: item.rendered,
|
|
336
|
-
"aria-label": item["aria-label"]
|
|
337
|
-
});
|
|
338
|
-
let { separatorProps: separatorProps } = (0, $9SHwR$useSeparator)({
|
|
339
|
-
elementType: "li"
|
|
340
|
-
});
|
|
341
|
-
return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Fragment), null, item.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, $9SHwR$react).createElement("li", {
|
|
342
|
-
...separatorProps,
|
|
343
|
-
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-divider")
|
|
344
|
-
}), /*#__PURE__*/ (0, $9SHwR$react).createElement("li", itemProps, item.rendered && /*#__PURE__*/ (0, $9SHwR$react).createElement("span", {
|
|
345
|
-
...headingProps,
|
|
346
|
-
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-sectionHeading")
|
|
347
|
-
}, item.rendered), /*#__PURE__*/ (0, $9SHwR$react).createElement("ul", {
|
|
348
|
-
...groupProps,
|
|
349
|
-
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu")
|
|
350
|
-
}, [
|
|
351
|
-
...(0, $9SHwR$getChildNodes)(item, state.collection)
|
|
352
|
-
].map((node)=>{
|
|
353
|
-
let item = /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $48fb8f5e1202c980$export$2ce376c2cc3355c8), {
|
|
354
|
-
key: node.key,
|
|
355
|
-
item: node,
|
|
356
|
-
state: state,
|
|
357
|
-
onAction: onAction
|
|
358
|
-
});
|
|
359
|
-
if (node.wrapper) item = node.wrapper(item);
|
|
360
|
-
return item;
|
|
361
|
-
}))));
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
function $49b26f4b606348f6$var$Menu(props, ref) {
|
|
371
|
-
let contextProps = (0, $9SHwR$useContext)((0, $d94604d52c3e3feb$export$c7e742effb1c51e2));
|
|
372
|
-
let completeProps = {
|
|
373
|
-
...(0, $9SHwR$mergeProps)(contextProps, props)
|
|
374
|
-
};
|
|
375
|
-
let domRef = (0, $9SHwR$useDOMRef)(ref);
|
|
376
|
-
let state = (0, $9SHwR$useTreeState)(completeProps);
|
|
377
|
-
let { menuProps: menuProps } = (0, $9SHwR$useMenu)(completeProps, state, domRef);
|
|
378
|
-
let { styleProps: styleProps } = (0, $9SHwR$useStyleProps)(completeProps);
|
|
379
|
-
(0, $9SHwR$useSyncRef)(contextProps, domRef);
|
|
380
|
-
return /*#__PURE__*/ (0, $9SHwR$react).createElement("ul", {
|
|
381
|
-
...menuProps,
|
|
382
|
-
...styleProps,
|
|
383
|
-
ref: domRef,
|
|
384
|
-
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu", styleProps.className)
|
|
385
|
-
}, [
|
|
386
|
-
...state.collection
|
|
387
|
-
].map((item)=>{
|
|
388
|
-
if (item.type === "section") return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $b966e606890cc5ca$export$4b1545b4f2016d26), {
|
|
389
|
-
key: item.key,
|
|
390
|
-
item: item,
|
|
391
|
-
state: state,
|
|
392
|
-
onAction: completeProps.onAction
|
|
393
|
-
});
|
|
394
|
-
let menuItem = /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $48fb8f5e1202c980$export$2ce376c2cc3355c8), {
|
|
395
|
-
key: item.key,
|
|
396
|
-
item: item,
|
|
397
|
-
state: state,
|
|
398
|
-
onAction: completeProps.onAction
|
|
399
|
-
});
|
|
400
|
-
if (item.wrapper) menuItem = item.wrapper(menuItem);
|
|
401
|
-
return menuItem;
|
|
402
|
-
}));
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* Menus display a list of actions or options that a user can choose.
|
|
406
|
-
*/ // forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
407
|
-
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
408
|
-
const $49b26f4b606348f6$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $9SHwR$react).forwardRef($49b26f4b606348f6$var$Menu);
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
/*
|
|
412
|
-
* Copyright 2021 Adobe. All rights reserved.
|
|
413
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
414
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
415
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
416
|
-
*
|
|
417
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
418
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
419
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
420
|
-
* governing permissions and limitations under the License.
|
|
421
|
-
*/
|
|
422
|
-
|
|
423
257
|
var $d01b612f05eb8a1a$exports = {};
|
|
424
258
|
var $9c47fa309a7d4d43$exports = {};
|
|
425
259
|
$9c47fa309a7d4d43$exports = {
|
|
426
|
-
"moreActions": `المزيد من
|
|
260
|
+
"moreActions": `المزيد من الإجراءات`,
|
|
261
|
+
"unavailable": `Unavailable`
|
|
427
262
|
};
|
|
428
263
|
|
|
429
264
|
|
|
@@ -459,7 +294,8 @@ $055104befa589c0a$exports = {
|
|
|
459
294
|
|
|
460
295
|
var $de5da9cdd5bee12a$exports = {};
|
|
461
296
|
$de5da9cdd5bee12a$exports = {
|
|
462
|
-
"moreActions": `More actions
|
|
297
|
+
"moreActions": `More actions`,
|
|
298
|
+
"unavailable": `Unavailable`
|
|
463
299
|
};
|
|
464
300
|
|
|
465
301
|
|
|
@@ -669,6 +505,208 @@ $d01b612f05eb8a1a$exports = {
|
|
|
669
505
|
|
|
670
506
|
|
|
671
507
|
|
|
508
|
+
|
|
509
|
+
function $48fb8f5e1202c980$export$2ce376c2cc3355c8(props) {
|
|
510
|
+
let { item: item , state: state , isVirtualized: isVirtualized , onAction: onAction } = props;
|
|
511
|
+
let stringFormatter = (0, $9SHwR$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($d01b612f05eb8a1a$exports))));
|
|
512
|
+
let menuDialogContext = (0, $d94604d52c3e3feb$export$4bbcd0ebecc48abd)();
|
|
513
|
+
let { triggerRef: triggerRef } = menuDialogContext || {};
|
|
514
|
+
let isMenuDialogTrigger = !!menuDialogContext;
|
|
515
|
+
let isUnavailable = false;
|
|
516
|
+
if (isMenuDialogTrigger) isUnavailable = menuDialogContext.isUnavailable;
|
|
517
|
+
let { onClose: onClose , closeOnSelect: closeOnSelect } = (0, $d94604d52c3e3feb$export$21c7ab35b39f78ec)();
|
|
518
|
+
let { rendered: rendered , key: key } = item;
|
|
519
|
+
let isSelected = state.selectionManager.isSelected(key);
|
|
520
|
+
let isDisabled = state.disabledKeys.has(key);
|
|
521
|
+
let ref = (0, $9SHwR$useRef)(null);
|
|
522
|
+
if (triggerRef) ref = triggerRef;
|
|
523
|
+
let { menuItemProps: menuItemProps , labelProps: labelProps , descriptionProps: descriptionProps , keyboardShortcutProps: keyboardShortcutProps } = (0, $9SHwR$useMenuItem)({
|
|
524
|
+
isSelected: isSelected,
|
|
525
|
+
isDisabled: isDisabled,
|
|
526
|
+
"aria-label": item["aria-label"],
|
|
527
|
+
key: key,
|
|
528
|
+
onClose: onClose,
|
|
529
|
+
closeOnSelect: closeOnSelect,
|
|
530
|
+
isVirtualized: isVirtualized,
|
|
531
|
+
onAction: onAction,
|
|
532
|
+
"aria-haspopup": isMenuDialogTrigger ? "dialog" : undefined
|
|
533
|
+
}, state, ref);
|
|
534
|
+
let endId = (0, $9SHwR$useSlotId)();
|
|
535
|
+
let endProps = {};
|
|
536
|
+
if (endId) {
|
|
537
|
+
endProps.id = endId;
|
|
538
|
+
menuItemProps["aria-describedby"] = menuItemProps["aria-describedby"] + " " + endId;
|
|
539
|
+
}
|
|
540
|
+
let contents = typeof rendered === "string" ? /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Text), null, rendered) : rendered;
|
|
541
|
+
return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$FocusRing), {
|
|
542
|
+
focusRingClass: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "focus-ring")
|
|
543
|
+
}, /*#__PURE__*/ (0, $9SHwR$react).createElement("li", {
|
|
544
|
+
...(0, $9SHwR$mergeProps)(menuItemProps),
|
|
545
|
+
ref: ref,
|
|
546
|
+
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-item", {
|
|
547
|
+
"is-disabled": isDisabled,
|
|
548
|
+
"is-selected": isSelected,
|
|
549
|
+
"is-selectable": state.selectionManager.selectionMode !== "none",
|
|
550
|
+
"is-open": state.expandedKeys.has(key)
|
|
551
|
+
})
|
|
552
|
+
}, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Grid), {
|
|
553
|
+
UNSAFE_className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-itemGrid")
|
|
554
|
+
}, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$ClearSlots), null, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$SlotProvider), {
|
|
555
|
+
slots: {
|
|
556
|
+
text: {
|
|
557
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-itemLabel"],
|
|
558
|
+
...labelProps
|
|
559
|
+
},
|
|
560
|
+
end: {
|
|
561
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-end"],
|
|
562
|
+
...endProps
|
|
563
|
+
},
|
|
564
|
+
icon: {
|
|
565
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-icon"],
|
|
566
|
+
size: "S"
|
|
567
|
+
},
|
|
568
|
+
description: {
|
|
569
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-description"],
|
|
570
|
+
...descriptionProps
|
|
571
|
+
},
|
|
572
|
+
keyboard: {
|
|
573
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports)))["spectrum-Menu-keyboard"],
|
|
574
|
+
...keyboardShortcutProps
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}, contents, isSelected && /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$spectrumiconsuiCheckmarkMedium), {
|
|
578
|
+
slot: "checkmark",
|
|
579
|
+
UNSAFE_className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-checkmark")
|
|
580
|
+
}), isUnavailable && /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$spectrumiconsworkflowInfoOutline), {
|
|
581
|
+
slot: "end",
|
|
582
|
+
size: "XS",
|
|
583
|
+
alignSelf: "center",
|
|
584
|
+
"aria-label": stringFormatter.format("unavailable")
|
|
585
|
+
}))))));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
/*
|
|
590
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
591
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
592
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
593
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
594
|
+
*
|
|
595
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
596
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
597
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
598
|
+
* governing permissions and limitations under the License.
|
|
599
|
+
*/
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
function $b966e606890cc5ca$export$4b1545b4f2016d26(props) {
|
|
607
|
+
let { item: item , state: state , onAction: onAction } = props;
|
|
608
|
+
let { itemProps: itemProps , headingProps: headingProps , groupProps: groupProps } = (0, $9SHwR$useMenuSection)({
|
|
609
|
+
heading: item.rendered,
|
|
610
|
+
"aria-label": item["aria-label"]
|
|
611
|
+
});
|
|
612
|
+
let { separatorProps: separatorProps } = (0, $9SHwR$useSeparator)({
|
|
613
|
+
elementType: "li"
|
|
614
|
+
});
|
|
615
|
+
return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Fragment), null, item.key !== state.collection.getFirstKey() && /*#__PURE__*/ (0, $9SHwR$react).createElement("li", {
|
|
616
|
+
...separatorProps,
|
|
617
|
+
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-divider")
|
|
618
|
+
}), /*#__PURE__*/ (0, $9SHwR$react).createElement("li", itemProps, item.rendered && /*#__PURE__*/ (0, $9SHwR$react).createElement("span", {
|
|
619
|
+
...headingProps,
|
|
620
|
+
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu-sectionHeading")
|
|
621
|
+
}, item.rendered), /*#__PURE__*/ (0, $9SHwR$react).createElement("ul", {
|
|
622
|
+
...groupProps,
|
|
623
|
+
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu")
|
|
624
|
+
}, [
|
|
625
|
+
...(0, $9SHwR$getChildNodes)(item, state.collection)
|
|
626
|
+
].map((node)=>{
|
|
627
|
+
let item = /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $48fb8f5e1202c980$export$2ce376c2cc3355c8), {
|
|
628
|
+
key: node.key,
|
|
629
|
+
item: node,
|
|
630
|
+
state: state,
|
|
631
|
+
onAction: onAction
|
|
632
|
+
});
|
|
633
|
+
if (node.wrapper) item = node.wrapper(item);
|
|
634
|
+
return item;
|
|
635
|
+
}))));
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
function $49b26f4b606348f6$var$Menu(props, ref) {
|
|
645
|
+
let contextProps = (0, $9SHwR$useContext)((0, $d94604d52c3e3feb$export$c7e742effb1c51e2));
|
|
646
|
+
let completeProps = {
|
|
647
|
+
...(0, $9SHwR$mergeProps)(contextProps, props)
|
|
648
|
+
};
|
|
649
|
+
let domRef = (0, $9SHwR$useDOMRef)(ref);
|
|
650
|
+
let state = (0, $9SHwR$useTreeState)(completeProps);
|
|
651
|
+
let { menuProps: menuProps } = (0, $9SHwR$useMenu)(completeProps, state, domRef);
|
|
652
|
+
let { styleProps: styleProps } = (0, $9SHwR$useStyleProps)(completeProps);
|
|
653
|
+
(0, $9SHwR$useSyncRef)(contextProps, domRef);
|
|
654
|
+
return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $d94604d52c3e3feb$export$24aad8519b95b41b).Provider, {
|
|
655
|
+
value: {
|
|
656
|
+
state: state
|
|
657
|
+
}
|
|
658
|
+
}, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$FocusScope), {
|
|
659
|
+
contain: state.expandedKeys.size > 0
|
|
660
|
+
}, /*#__PURE__*/ (0, $9SHwR$react).createElement("ul", {
|
|
661
|
+
...menuProps,
|
|
662
|
+
...styleProps,
|
|
663
|
+
ref: domRef,
|
|
664
|
+
className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($286d1cb34bb7dc84$exports))), "spectrum-Menu", styleProps.className)
|
|
665
|
+
}, [
|
|
666
|
+
...state.collection
|
|
667
|
+
].map((item)=>{
|
|
668
|
+
if (item.type === "section") return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $b966e606890cc5ca$export$4b1545b4f2016d26), {
|
|
669
|
+
key: item.key,
|
|
670
|
+
item: item,
|
|
671
|
+
state: state,
|
|
672
|
+
onAction: completeProps.onAction
|
|
673
|
+
});
|
|
674
|
+
let menuItem = /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $48fb8f5e1202c980$export$2ce376c2cc3355c8), {
|
|
675
|
+
key: item.key,
|
|
676
|
+
item: item,
|
|
677
|
+
state: state,
|
|
678
|
+
onAction: completeProps.onAction
|
|
679
|
+
});
|
|
680
|
+
if (item.wrapper) menuItem = item.wrapper(menuItem);
|
|
681
|
+
return menuItem;
|
|
682
|
+
}))));
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Menus display a list of actions or options that a user can choose.
|
|
686
|
+
*/ // forwardRef doesn't support generic parameters, so cast the result to the correct type
|
|
687
|
+
// https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref
|
|
688
|
+
const $49b26f4b606348f6$export$d9b273488cd8ce6f = /*#__PURE__*/ (0, $9SHwR$react).forwardRef($49b26f4b606348f6$var$Menu);
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
/*
|
|
692
|
+
* Copyright 2021 Adobe. All rights reserved.
|
|
693
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
694
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
695
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
696
|
+
*
|
|
697
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
698
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
699
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
700
|
+
* governing permissions and limitations under the License.
|
|
701
|
+
*/
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
|
|
672
710
|
function $43fa9949e6af393d$var$ActionMenu(props, ref) {
|
|
673
711
|
props = (0, $9SHwR$useSlotProps)(props, "actionMenu");
|
|
674
712
|
let stringFormatter = (0, $9SHwR$useLocalizedStringFormatter)((0, (/*@__PURE__*/$parcel$interopDefault($d01b612f05eb8a1a$exports))));
|
|
@@ -699,8 +737,104 @@ function $43fa9949e6af393d$var$ActionMenu(props, ref) {
|
|
|
699
737
|
*/ const $43fa9949e6af393d$export$ed57a210b9d13bb6 = /*#__PURE__*/ (0, $9SHwR$forwardRef)($43fa9949e6af393d$var$ActionMenu);
|
|
700
738
|
|
|
701
739
|
|
|
740
|
+
/*
|
|
741
|
+
* Copyright 2023 Adobe. All rights reserved.
|
|
742
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
743
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
744
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
745
|
+
*
|
|
746
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
747
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
748
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
749
|
+
* governing permissions and limitations under the License.
|
|
750
|
+
*/
|
|
751
|
+
var $c487b1d738ebeac2$exports = {};
|
|
752
|
+
|
|
753
|
+
$parcel$export($c487b1d738ebeac2$exports, "react-spectrum-ContextualHelp-button", () => $c487b1d738ebeac2$export$20d9583c9f1529c1, (v) => $c487b1d738ebeac2$export$20d9583c9f1529c1 = v);
|
|
754
|
+
$parcel$export($c487b1d738ebeac2$exports, "react-spectrum-ContextualHelp-dialog", () => $c487b1d738ebeac2$export$ab2d873674d20d28, (v) => $c487b1d738ebeac2$export$ab2d873674d20d28 = v);
|
|
755
|
+
$parcel$export($c487b1d738ebeac2$exports, "react-spectrum-ContextualHelp-content", () => $c487b1d738ebeac2$export$a1f805890cf58c4, (v) => $c487b1d738ebeac2$export$a1f805890cf58c4 = v);
|
|
756
|
+
$parcel$export($c487b1d738ebeac2$exports, "react-spectrum-ContextualHelp-footer", () => $c487b1d738ebeac2$export$d901bc3fa82b87a6, (v) => $c487b1d738ebeac2$export$d901bc3fa82b87a6 = v);
|
|
757
|
+
var $c487b1d738ebeac2$export$20d9583c9f1529c1;
|
|
758
|
+
var $c487b1d738ebeac2$export$ab2d873674d20d28;
|
|
759
|
+
var $c487b1d738ebeac2$export$a1f805890cf58c4;
|
|
760
|
+
var $c487b1d738ebeac2$export$d901bc3fa82b87a6;
|
|
761
|
+
$c487b1d738ebeac2$export$20d9583c9f1529c1 = "react-spectrum-ContextualHelp-button_0cd31c";
|
|
762
|
+
$c487b1d738ebeac2$export$ab2d873674d20d28 = "react-spectrum-ContextualHelp-dialog_0cd31c";
|
|
763
|
+
$c487b1d738ebeac2$export$a1f805890cf58c4 = "react-spectrum-ContextualHelp-content_0cd31c";
|
|
764
|
+
$c487b1d738ebeac2$export$d901bc3fa82b87a6 = "react-spectrum-ContextualHelp-footer_0cd31c";
|
|
765
|
+
|
|
766
|
+
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
|
|
771
|
+
function $81987f5f2bef0e97$var$MenuDialogTrigger(props) {
|
|
772
|
+
let { isUnavailable: isUnavailable } = props;
|
|
773
|
+
let { state: menuState } = (0, $d94604d52c3e3feb$export$efa3856fc0e85e7f)();
|
|
774
|
+
let state = (0, $9SHwR$useOverlayTriggerState)({
|
|
775
|
+
isOpen: menuState.expandedKeys.has(props.targetKey),
|
|
776
|
+
onOpenChange: (val)=>{
|
|
777
|
+
if (!val) {
|
|
778
|
+
if (menuState.expandedKeys.has(props.targetKey)) menuState.toggleKey(props.targetKey);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
let slots = {};
|
|
783
|
+
if (isUnavailable) slots = {
|
|
784
|
+
dialog: {
|
|
785
|
+
UNSAFE_className: (0, $9SHwR$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($c487b1d738ebeac2$exports))), "react-spectrum-ContextualHelp-dialog")
|
|
786
|
+
},
|
|
787
|
+
content: {
|
|
788
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($c487b1d738ebeac2$exports)))["react-spectrum-ContextualHelp-content"]
|
|
789
|
+
},
|
|
790
|
+
footer: {
|
|
791
|
+
UNSAFE_className: (0, (/*@__PURE__*/$parcel$interopDefault($c487b1d738ebeac2$exports)))["react-spectrum-ContextualHelp-footer"]
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
let [trigger] = (0, $9SHwR$react).Children.toArray(props.children);
|
|
795
|
+
let [, content] = props.children;
|
|
796
|
+
let isMobile = (0, $9SHwR$useIsMobileDevice)();
|
|
797
|
+
let triggerRef = (0, $9SHwR$useRef)(null);
|
|
798
|
+
return /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$react).Fragment, null, /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $d94604d52c3e3feb$export$e239f1ef5b7afe1a).Provider, {
|
|
799
|
+
value: {
|
|
800
|
+
isUnavailable: isUnavailable,
|
|
801
|
+
triggerRef: triggerRef
|
|
802
|
+
}
|
|
803
|
+
}, trigger), /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$SlotProvider), {
|
|
804
|
+
slots: slots
|
|
805
|
+
}, isMobile ? /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Modal), {
|
|
806
|
+
state: state,
|
|
807
|
+
isDismissable: true
|
|
808
|
+
}, content) : /*#__PURE__*/ (0, $9SHwR$react).createElement((0, $9SHwR$Popover), {
|
|
809
|
+
state: state,
|
|
810
|
+
triggerRef: triggerRef,
|
|
811
|
+
placement: "end top",
|
|
812
|
+
hideArrow: true,
|
|
813
|
+
offset: -10,
|
|
814
|
+
isNonModal: true,
|
|
815
|
+
shouldContainFocus: false
|
|
816
|
+
}, content)));
|
|
817
|
+
}
|
|
818
|
+
$81987f5f2bef0e97$var$MenuDialogTrigger.getCollectionNode = function* getCollectionNode(props) {
|
|
819
|
+
let [trigger] = (0, $9SHwR$react).Children.toArray(props.children);
|
|
820
|
+
let [, content] = props.children;
|
|
821
|
+
yield {
|
|
822
|
+
element: /*#__PURE__*/ (0, $9SHwR$react).cloneElement(trigger, {
|
|
823
|
+
...trigger.props,
|
|
824
|
+
hasChildItems: true
|
|
825
|
+
}),
|
|
826
|
+
wrapper: (element)=>/*#__PURE__*/ (0, $9SHwR$react).createElement($81987f5f2bef0e97$var$MenuDialogTrigger, {
|
|
827
|
+
key: element.key,
|
|
828
|
+
targetKey: element.key,
|
|
829
|
+
...props
|
|
830
|
+
}, element, content)
|
|
831
|
+
};
|
|
832
|
+
};
|
|
833
|
+
let $81987f5f2bef0e97$export$5e604e335994e1d1 = $81987f5f2bef0e97$var$MenuDialogTrigger;
|
|
834
|
+
|
|
835
|
+
|
|
702
836
|
|
|
703
837
|
|
|
704
838
|
|
|
705
|
-
export {$aa0b855f135b86e3$export$27d2ad3c5815583e as MenuTrigger, $49b26f4b606348f6$export$d9b273488cd8ce6f as Menu, $43fa9949e6af393d$export$ed57a210b9d13bb6 as ActionMenu, $5ae296f2d6923e14$re_export$Item as Item, $5ae296f2d6923e14$re_export$Section as Section};
|
|
839
|
+
export {$aa0b855f135b86e3$export$27d2ad3c5815583e as MenuTrigger, $49b26f4b606348f6$export$d9b273488cd8ce6f as Menu, $43fa9949e6af393d$export$ed57a210b9d13bb6 as ActionMenu, $81987f5f2bef0e97$export$5e604e335994e1d1 as MenuDialogTrigger, $5ae296f2d6923e14$re_export$Item as Item, $5ae296f2d6923e14$re_export$Section as Section};
|
|
706
840
|
//# sourceMappingURL=module.js.map
|