@contentful/f36-menu 4.0.1-beta.2543 → 4.0.1-beta.2590

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  var $6ZrLO$react = require("react");
2
2
  var $6ZrLO$contentfulf36core = require("@contentful/f36-core");
3
- var $6ZrLO$contentfulf36utils = require("@contentful/f36-utils");
4
3
  var $6ZrLO$contentfulf36popover = require("@contentful/f36-popover");
4
+ var $6ZrLO$reactjsxruntime = require("react/jsx-runtime");
5
5
  var $6ZrLO$emotion = require("emotion");
6
6
  var $6ZrLO$contentfulf36tokens = require("@contentful/f36-tokens");
7
7
  var $6ZrLO$contentfulf36typography = require("@contentful/f36-typography");
@@ -26,6 +26,60 @@ $parcel$export(module.exports, "SubmenuTrigger", () => $68e427819b978177$export$
26
26
 
27
27
 
28
28
 
29
+ const $9abfe5cafeb7e9d3$var$ARROW_KEY_TYPES = {
30
+ vertical: {
31
+ prev: 'ArrowUp',
32
+ next: 'ArrowDown'
33
+ },
34
+ horizontal: {
35
+ prev: 'ArrowLeft',
36
+ next: 'ArrowRight'
37
+ }
38
+ };
39
+ const $9abfe5cafeb7e9d3$export$e8d01079a7f85a7 = ({ itemsContainerRef: itemsContainerRef , itemsSelector: itemsSelector , keyType: keyType = 'vertical' })=>{
40
+ const [focusedIndex, setFocusedIndex] = $6ZrLO$react.useState(0);
41
+ const handleArrowsKeyDown = $6ZrLO$react.useCallback((event)=>{
42
+ const container = itemsContainerRef.current;
43
+ if (!container) return;
44
+ const items = container.querySelectorAll(itemsSelector);
45
+ if (items.length === 0) return;
46
+ const lastItemIndex = items.length - 1;
47
+ const focusFirstItem = ()=>setFocusedIndex(0)
48
+ ;
49
+ const focusLastItem = ()=>setFocusedIndex(lastItemIndex)
50
+ ;
51
+ const focusNextItem = ()=>{
52
+ if (focusedIndex === lastItemIndex) focusFirstItem();
53
+ else setFocusedIndex(focusedIndex + 1);
54
+ };
55
+ const focusPrevItem = ()=>{
56
+ if (focusedIndex === 0) focusLastItem();
57
+ else setFocusedIndex(focusedIndex - 1);
58
+ };
59
+ const keyToFnMap = {
60
+ [$9abfe5cafeb7e9d3$var$ARROW_KEY_TYPES[keyType].next]: focusNextItem,
61
+ [$9abfe5cafeb7e9d3$var$ARROW_KEY_TYPES[keyType].prev]: focusPrevItem
62
+ };
63
+ const fn = keyToFnMap[event.key];
64
+ if (fn) {
65
+ event.preventDefault();
66
+ fn();
67
+ }
68
+ }, [
69
+ focusedIndex,
70
+ itemsSelector,
71
+ itemsContainerRef,
72
+ keyType
73
+ ]);
74
+ return {
75
+ focusedIndex: focusedIndex,
76
+ handleArrowsKeyDown: handleArrowsKeyDown,
77
+ setFocusedIndex: setFocusedIndex
78
+ };
79
+ };
80
+
81
+
82
+
29
83
 
30
84
  const $31bc1b2a74a830dc$var$MenuContext = $parcel$interopDefault($6ZrLO$react).createContext(undefined);
31
85
  const $31bc1b2a74a830dc$export$21c7ab35b39f78ec = ()=>{
@@ -43,7 +97,7 @@ function $453ff7c40e833219$export$d9b273488cd8ce6f(props) {
43
97
  const triggerRef = $6ZrLO$react.useRef(null);
44
98
  const menuListRef = $6ZrLO$react.useRef(null);
45
99
  const menuId = $6ZrLO$contentfulf36core.useId(null, 'menu');
46
- const { focusedIndex: focusedIndex , handleArrowsKeyDown: handleArrowsKeyDown , setFocusedIndex: setFocusedIndex } = $6ZrLO$contentfulf36utils.useArrowKeyNavigation({
100
+ const { focusedIndex: focusedIndex , handleArrowsKeyDown: handleArrowsKeyDown , setFocusedIndex: setFocusedIndex } = $9abfe5cafeb7e9d3$export$e8d01079a7f85a7({
47
101
  itemsContainerRef: menuListRef,
48
102
  itemsSelector: $453ff7c40e833219$var$MENU_ITEMS_SELECTOR
49
103
  });
@@ -177,17 +231,19 @@ function $453ff7c40e833219$export$d9b273488cd8ce6f(props) {
177
231
  isControlled,
178
232
  onOpen
179
233
  ]);
180
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($31bc1b2a74a830dc$export$2cad3fd48ac06579, {
181
- value: contextValue
182
- }, /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($6ZrLO$contentfulf36popover.Popover, {
183
- ...otherProps,
184
- isOpen: isOpen,
185
- onClose: handleClose,
186
- id: menuId,
187
- closeOnEsc: closeOnEsc,
188
- autoFocus: false,
189
- closeOnBlur: false
190
- }, children)));
234
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($31bc1b2a74a830dc$export$2cad3fd48ac06579, {
235
+ value: contextValue,
236
+ children: /*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($6ZrLO$contentfulf36popover.Popover, {
237
+ ...otherProps,
238
+ isOpen: isOpen,
239
+ onClose: handleClose,
240
+ id: menuId,
241
+ closeOnEsc: closeOnEsc,
242
+ autoFocus: false,
243
+ closeOnBlur: false,
244
+ children: children
245
+ })
246
+ }));
191
247
  }
192
248
  const $453ff7c40e833219$var$useMenuOpenState = (props)=>{
193
249
  const { isOpen: isOpen , defaultIsOpen: defaultIsOpen , onOpen: onOpen , onClose: onClose } = props;
@@ -221,6 +277,7 @@ const $453ff7c40e833219$var$useMenuOpenState = (props)=>{
221
277
 
222
278
 
223
279
 
280
+
224
281
  const $62b35dc82bb7def8$var$SubmenuContext = $parcel$interopDefault($6ZrLO$react).createContext(undefined);
225
282
  const $62b35dc82bb7def8$export$958673a266cbe049 = ()=>{
226
283
  const context = $parcel$interopDefault($6ZrLO$react).useContext($62b35dc82bb7def8$var$SubmenuContext);
@@ -269,14 +326,16 @@ const $ce9788dc1cd48a1b$export$10ce7613b0465b57 = (props)=>({
269
326
 
270
327
 
271
328
 
329
+
272
330
  const $77fa76994469c42b$export$77451990ddb9d17c = (props)=>{
273
331
  const { children: children , testId: testId = 'cf-ui-menu-list-header' , className: className , ...otherProps } = props;
274
332
  const styles = $ce9788dc1cd48a1b$export$396ce14bde1b7929();
275
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement("div", {
333
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx("div", {
276
334
  "data-test-id": testId,
277
335
  className: $6ZrLO$emotion.cx(styles, className),
278
- ...otherProps
279
- }, children));
336
+ ...otherProps,
337
+ children: children
338
+ }));
280
339
  };
281
340
  $77fa76994469c42b$export$77451990ddb9d17c.displayName = 'MenuListHeader';
282
341
 
@@ -284,14 +343,16 @@ $77fa76994469c42b$export$77451990ddb9d17c.displayName = 'MenuListHeader';
284
343
 
285
344
 
286
345
 
346
+
287
347
  const $56409107038e75ac$export$3e8a81e7ad0650f4 = (props)=>{
288
348
  const { children: children , testId: testId = 'cf-ui-menu-list-footer' , className: className , ...otherProps } = props;
289
349
  const styles = $ce9788dc1cd48a1b$export$fd3dbc8a890448f();
290
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement("div", {
350
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx("div", {
291
351
  "data-test-id": testId,
292
352
  className: $6ZrLO$emotion.cx(styles, className),
293
- ...otherProps
294
- }, children));
353
+ ...otherProps,
354
+ children: children
355
+ }));
295
356
  };
296
357
  $56409107038e75ac$export$3e8a81e7ad0650f4.displayName = 'MenuListFooter';
297
358
 
@@ -325,13 +386,18 @@ const $c5bfee6901fd5b47$var$_MenuList = (props, ref)=>{
325
386
  hasStickyFooter: Boolean(footer)
326
387
  });
327
388
  const extendedOtherProps = submenuContext ? submenuContext.getSubmenuListProps(otherProps) : otherProps;
328
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($6ZrLO$contentfulf36popover.Popover.Content, {
389
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsxs($6ZrLO$contentfulf36popover.Popover.Content, {
329
390
  role: "menu",
330
391
  ...extendedOtherProps,
331
392
  ...getMenuListProps(extendedOtherProps, ref),
332
393
  className: $6ZrLO$emotion.cx(styles.container, className),
333
- testId: testId
334
- }, header, items, footer));
394
+ testId: testId,
395
+ children: [
396
+ header,
397
+ items,
398
+ footer
399
+ ]
400
+ }));
335
401
  };
336
402
  const $c5bfee6901fd5b47$export$d4c4e98c5044dc8 = /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).forwardRef($c5bfee6901fd5b47$var$_MenuList);
337
403
 
@@ -345,6 +411,7 @@ const $c5bfee6901fd5b47$export$d4c4e98c5044dc8 = /*#__PURE__*/ $parcel$interopDe
345
411
 
346
412
 
347
413
 
414
+
348
415
  const $f099c69f76c1082f$export$adaad53e003c74d0 = ()=>{
349
416
  return {
350
417
  root: /*#__PURE__*/ $6ZrLO$emotion.css({
@@ -397,15 +464,16 @@ function $01d29448a29c05b3$var$_MenuItem(props, ref) {
397
464
  focusMenuItem
398
465
  ]);
399
466
  const Element = as !== null && as !== void 0 ? as : $01d29448a29c05b3$var$MENU_ITEM_DEFAULT_TAG;
400
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement(Element, {
467
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx(Element, {
401
468
  role: "menuitem",
402
469
  ...otherProps,
403
470
  ...getMenuItemProps(otherProps),
404
471
  className: $6ZrLO$emotion.cx(styles.root, className),
405
472
  "data-test-id": itemTestId,
406
473
  ref: $6ZrLO$contentfulf36core.mergeRefs(itemRef, ref),
407
- tabIndex: -1
408
- }, props.children));
474
+ tabIndex: -1,
475
+ children: props.children
476
+ }));
409
477
  }
410
478
  const $01d29448a29c05b3$export$2ce376c2cc3355c8 = /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).forwardRef($01d29448a29c05b3$var$_MenuItem);
411
479
 
@@ -413,13 +481,16 @@ const $01d29448a29c05b3$export$2ce376c2cc3355c8 = /*#__PURE__*/ $parcel$interopD
413
481
 
414
482
 
415
483
 
484
+
416
485
  const $57a0b88402c05a1e$export$27d2ad3c5815583e = (props)=>{
417
486
  const child = $parcel$interopDefault($6ZrLO$react).Children.only(props.children);
418
487
  const { getTriggerProps: getTriggerProps } = $31bc1b2a74a830dc$export$21c7ab35b39f78ec();
419
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($6ZrLO$contentfulf36popover.Popover.Trigger, null, /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).cloneElement(child, {
420
- ...getTriggerProps(child.props, child.ref),
421
- ['aria-haspopup']: 'menu'
422
- })));
488
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($6ZrLO$contentfulf36popover.Popover.Trigger, {
489
+ children: /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).cloneElement(child, {
490
+ ...getTriggerProps(child.props, child.ref),
491
+ ['aria-haspopup']: 'menu'
492
+ })
493
+ }));
423
494
  };
424
495
 
425
496
 
@@ -427,6 +498,7 @@ const $57a0b88402c05a1e$export$27d2ad3c5815583e = (props)=>{
427
498
 
428
499
 
429
500
 
501
+
430
502
  const $f85a558bae23a8bd$export$4605da6f9a8ef405 = ()=>/*#__PURE__*/ $6ZrLO$emotion.css({
431
503
  border: 'none',
432
504
  width: '100%',
@@ -440,7 +512,7 @@ const $f85a558bae23a8bd$export$4605da6f9a8ef405 = ()=>/*#__PURE__*/ $6ZrLO$emoti
440
512
  const $a8d7f8a94ad9b120$export$acb07b4664ac227c = (props)=>{
441
513
  const { children: children , testId: testId = 'cf-ui-menu-divider' , className: className , ...otherProps } = props;
442
514
  const styles = $f85a558bae23a8bd$export$4605da6f9a8ef405();
443
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement("hr", {
515
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx("hr", {
444
516
  "aria-orientation": "horizontal",
445
517
  "data-test-id": testId,
446
518
  className: $6ZrLO$emotion.cx(styles, className),
@@ -453,6 +525,7 @@ const $a8d7f8a94ad9b120$export$acb07b4664ac227c = (props)=>{
453
525
 
454
526
 
455
527
 
528
+
456
529
  const $80d81cb0da14b65a$export$2698fa8b3a0a79e6 = ()=>/*#__PURE__*/ $6ZrLO$emotion.css({
457
530
  textAlign: 'left',
458
531
  padding: `${$parcel$interopDefault($6ZrLO$contentfulf36tokens).spacingXs} ${$parcel$interopDefault($6ZrLO$contentfulf36tokens).spacingM}`,
@@ -468,7 +541,7 @@ const $80d81cb0da14b65a$export$2698fa8b3a0a79e6 = ()=>/*#__PURE__*/ $6ZrLO$emoti
468
541
  const $a9e47e1a6fcc6dbc$export$5d1e6c648985631e = (props)=>{
469
542
  const { children: children , testId: testId = 'cf-ui-menu-section-title' , className: className , ...otherProps } = props;
470
543
  const styles = $80d81cb0da14b65a$export$2698fa8b3a0a79e6();
471
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($6ZrLO$contentfulf36typography.SectionHeading // Techincally, menus cannot contain headings according to ARIA.
544
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($6ZrLO$contentfulf36typography.SectionHeading // Techincally, menus cannot contain headings according to ARIA.
472
545
  , {
473
546
  // We hide the heading from assistive technology, and only use it
474
547
  // as a label
@@ -476,8 +549,9 @@ const $a9e47e1a6fcc6dbc$export$5d1e6c648985631e = (props)=>{
476
549
  testId: testId,
477
550
  className: $6ZrLO$emotion.cx(styles, className),
478
551
  marginBottom: "none",
479
- ...otherProps
480
- }, children));
552
+ ...otherProps,
553
+ children: children
554
+ }));
481
555
  };
482
556
 
483
557
 
@@ -486,6 +560,7 @@ const $a9e47e1a6fcc6dbc$export$5d1e6c648985631e = (props)=>{
486
560
 
487
561
 
488
562
 
563
+
489
564
  const $d1c454a08dd2b04a$var$SUBMENU_OFFSET = [
490
565
  -8,
491
566
  2
@@ -573,18 +648,19 @@ const $d1c454a08dd2b04a$export$49229ebf838c159b = (props)=>{
573
648
  handleOpen,
574
649
  closeAndFocusTrigger
575
650
  ]);
576
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($62b35dc82bb7def8$export$81b3dbd1f003f0c7, {
577
- value: contextValue
578
- }, /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($453ff7c40e833219$export$d9b273488cd8ce6f, {
579
- ...propsToPropagateToSubmenus,
580
- ...otherProps,
581
- isOpen: isOpen,
582
- onClose: handleClose,
583
- onOpen: handleOpen,
584
- placement: "right-start",
585
- offset: $d1c454a08dd2b04a$var$SUBMENU_OFFSET,
586
- isAutoalignmentEnabled: false
587
- })));
651
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($62b35dc82bb7def8$export$81b3dbd1f003f0c7, {
652
+ value: contextValue,
653
+ children: /*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($453ff7c40e833219$export$d9b273488cd8ce6f, {
654
+ ...propsToPropagateToSubmenus,
655
+ ...otherProps,
656
+ isOpen: isOpen,
657
+ onClose: handleClose,
658
+ onOpen: handleOpen,
659
+ placement: "right-start",
660
+ offset: $d1c454a08dd2b04a$var$SUBMENU_OFFSET,
661
+ isAutoalignmentEnabled: false
662
+ })
663
+ }));
588
664
  };
589
665
 
590
666
 
@@ -596,6 +672,7 @@ const $d1c454a08dd2b04a$export$49229ebf838c159b = (props)=>{
596
672
 
597
673
 
598
674
 
675
+
599
676
  const $440a5860c5fbe4e7$export$ce276565acbba1c9 = ()=>{
600
677
  return {
601
678
  root: ({ isActive: isActive })=>/*#__PURE__*/ $6ZrLO$emotion.css({
@@ -623,17 +700,24 @@ const $68e427819b978177$var$_SubmenuTrigger = (props, ref)=>{
623
700
  const { className: className , children: children } = props;
624
701
  const { getSubmenuTriggerProps: getSubmenuTriggerProps , isOpen: isOpen } = $62b35dc82bb7def8$export$958673a266cbe049();
625
702
  const styles = $440a5860c5fbe4e7$export$ce276565acbba1c9();
626
- return(/*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($57a0b88402c05a1e$export$27d2ad3c5815583e, null, /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($01d29448a29c05b3$export$2ce376c2cc3355c8, {
627
- ...props,
628
- ...getSubmenuTriggerProps(props, ref),
629
- className: $6ZrLO$emotion.cx(styles.root({
630
- isActive: isOpen
631
- }), className)
632
- }, /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement("span", {
633
- className: styles.content
634
- }, children), /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).createElement($6ZrLO$contentfulf36icons.ChevronRightIcon, {
635
- className: styles.icon
636
- }))));
703
+ return(/*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($57a0b88402c05a1e$export$27d2ad3c5815583e, {
704
+ children: /*#__PURE__*/ $6ZrLO$reactjsxruntime.jsxs($01d29448a29c05b3$export$2ce376c2cc3355c8, {
705
+ ...props,
706
+ ...getSubmenuTriggerProps(props, ref),
707
+ className: $6ZrLO$emotion.cx(styles.root({
708
+ isActive: isOpen
709
+ }), className),
710
+ children: [
711
+ /*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx("span", {
712
+ className: styles.content,
713
+ children: children
714
+ }),
715
+ /*#__PURE__*/ $6ZrLO$reactjsxruntime.jsx($6ZrLO$contentfulf36icons.ChevronRightIcon, {
716
+ className: styles.icon
717
+ })
718
+ ]
719
+ })
720
+ }));
637
721
  };
638
722
  const $68e427819b978177$export$ecabc99eeffab7ca = /*#__PURE__*/ $parcel$interopDefault($6ZrLO$react).forwardRef($68e427819b978177$var$_SubmenuTrigger);
639
723
 
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGwBA,KAAA,CAAMuH,iCAAW,GAAG5F,oCAAK,CAAC6F,aAAa,CAA8BL,SAAjD;AAEb,KAAA,CAAMM,yCAAc,OAAS,CAApC;IACE,KAAA,CAAMC,OAAO,GAAG/F,oCAAK,CAACgG,UAAN,CAAiBJ,iCAAjB;IAEhB,EAAA,EAAIG,OAAO,KAAKP,SAAhB,EACE,KAAA,CAAM,GAAA,CAAIS,KAAJ,CAAU,CAAV;IAGR,MAAA,CAAOF,OAAP;AACD,CARM;AAUA,KAAA,CAAMpF,yCAAmB,GAAGiF,iCAAW,CAACM,Q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AAL,GAAeA,yCAAf;AACAZ,yCAAI,CAACc,cAAL,GAAsBA,yCAAtB","sources":["packages/components/menu/src/index.ts","packages/components/menu/src/CompoundMenu.tsx","packages/components/menu/src/Menu.tsx","packages/components/menu/src/MenuContext.ts","packages/components/menu/src/MenuList/MenuList.tsx","packages/components/menu/src/SubmenuContext.ts","packages/components/menu/src/MenuList/MenuList.styles.ts","packages/components/menu/src/MenuList/MenuListHeader.tsx","packages/components/menu/src/MenuList/MenuListFooter.tsx","packages/components/menu/src/MenuItem/MenuItem.tsx","packages/components/menu/src/MenuItem/MenuItem.styles.ts","packages/components/menu/src/MenuTrigger/MenuTrigger.tsx","packages/components/menu/src/MenuDivider/MenuDivider.tsx","packages/components/menu/src/MenuDivider/MenuDivider.styles.ts","packages/components/menu/src/MenuSectionTitle/MenuSectionTitle.tsx","packages/components/menu/src/MenuSectionTitle/MenuSectionTitle.styles.ts","packages/components/menu/src/Submenu/Submenu.tsx","packages/components/menu/src/SubmenuTrigger/SubmenuTrigger.tsx","packages/components/menu/src/SubmenuTrigger/SubmenuTrigger.styles.ts"],"sourcesContent":["export { Menu } from './CompoundMenu';\nexport type { MenuProps } from './Menu';\nexport { MenuList } from './MenuList/MenuList';\nexport type { MenuListProps } from './MenuList/MenuList';\nexport { MenuItem } from './MenuItem/MenuItem';\nexport type { MenuItemProps } from './MenuItem/MenuItem';\nexport { MenuTrigger } from './MenuTrigger/MenuTrigger';\nexport type { MenuTriggerProps } from './MenuTrigger/MenuTrigger';\nexport { MenuDivider } from './MenuDivider/MenuDivider';\nexport type { MenuDividerProps } from './MenuDivider/MenuDivider';\nexport { MenuSectionTitle } from './MenuSectionTitle/MenuSectionTitle';\nexport type { MenuSectionTitleProps } from './MenuSectionTitle/MenuSectionTitle';\nexport { Submenu } from './Submenu/Submenu';\nexport type { SubmenuProps } from './Submenu/Submenu';\nexport { SubmenuTrigger } from './SubmenuTrigger/SubmenuTrigger';\nexport type { SubmenuTriggerProps } from './SubmenuTrigger/SubmenuTrigger';\n","import { Menu as OriginalMenu } from './Menu';\nimport { MenuList } from './MenuList/MenuList';\nimport { MenuListHeader } from './MenuList/MenuListHeader';\nimport { MenuListFooter } from './MenuList/MenuListFooter';\nimport { MenuItem } from './MenuItem/MenuItem';\nimport { MenuTrigger } from './MenuTrigger/MenuTrigger';\nimport { MenuDivider } from './MenuDivider/MenuDivider';\nimport { MenuSectionTitle } from './MenuSectionTitle/MenuSectionTitle';\nimport { Submenu } from './Submenu/Submenu';\nimport { SubmenuTrigger } from './SubmenuTrigger/SubmenuTrigger';\n\ntype CompoundMenu = typeof OriginalMenu & {\n List: typeof MenuList;\n ListHeader: typeof MenuListHeader;\n ListFooter: typeof MenuListFooter;\n Item: typeof MenuItem;\n Trigger: typeof MenuTrigger;\n Divider: typeof MenuDivider;\n SectionTitle: typeof MenuSectionTitle;\n Submenu: typeof Submenu;\n SubmenuTrigger: typeof SubmenuTrigger;\n};\n\nexport const Menu = OriginalMenu as CompoundMenu;\nMenu.List = MenuList;\nMenu.ListHeader = MenuListHeader;\nMenu.ListFooter = MenuListFooter;\nMenu.Item = MenuItem;\nMenu.Trigger = MenuTrigger;\nMenu.Divider = MenuDivider;\nMenu.SectionTitle = MenuSectionTitle;\nMenu.Submenu = Submenu;\nMenu.SubmenuTrigger = SubmenuTrigger;\n","import React, {\n useState,\n useCallback,\n useMemo,\n useRef,\n useEffect,\n} from 'react';\nimport { mergeRefs, useId } from '@contentful/f36-core';\nimport { useArrowKeyNavigation } from '@contentful/f36-utils';\nimport { Popover, PopoverProps } from '@contentful/f36-popover';\nimport { MenuContextProvider, MenuContextType } from './MenuContext';\n\nconst MENU_ITEMS_SELECTOR = '[role=\"menuitem\"]:not(:disabled)';\n\nexport interface MenuProps\n extends Omit<PopoverProps, 'autoFocus' | 'id' | 'closeOnBlur'> {\n /**\n * If `true`, the Menu will be opened in controlled mode.\n * By default the Menu is uncontrolled\n */\n isOpen?: boolean;\n\n /**\n * If `true`, the Menu will be initially opened.\n */\n defaultIsOpen?: boolean;\n\n /**\n * Callback fired when the Menu opens\n */\n onOpen?: () => void;\n\n /**\n * Callback fired when the Menu closes\n */\n onClose?: () => void;\n\n /**\n * If `true`, the Menu will close when a menu item is\n * clicked\n *\n * Note: This prop will be propagated to all submenus,\n * unless you will override it with props on submenu itself\n *\n * @default true\n */\n closeOnSelect?: boolean;\n\n /**\n * If true, the menu will close when you blur out it by clicking outside\n *\n * Note: This prop will be propagated to all submenus,\n * unless you will override it with props on submenu itself\n *\n * @default true\n */\n closeOnBlur?: boolean;\n\n /**\n * If true, the menu will close when you hit the Esc key\n *\n * Note: This prop will be propagated to all submenus,\n * unless you will override it with props on submenu itself\n *\n * @default true\n */\n closeOnEsc?: boolean;\n}\n\nexport function Menu(props: MenuProps) {\n const {\n closeOnSelect = true,\n closeOnBlur = true,\n closeOnEsc = true,\n children,\n onOpen,\n ...otherProps\n } = props;\n const { isOpen, handleOpen, handleClose, isControlled } = useMenuOpenState(\n props,\n );\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuListRef = useRef<HTMLDivElement>(null);\n\n const menuId = useId(null, 'menu');\n\n const {\n focusedIndex,\n handleArrowsKeyDown,\n setFocusedIndex,\n } = useArrowKeyNavigation({\n itemsContainerRef: menuListRef,\n itemsSelector: MENU_ITEMS_SELECTOR,\n });\n\n useEffect(() => {\n if (isOpen && menuListRef.current) {\n const menuItems = menuListRef.current.querySelectorAll(\n MENU_ITEMS_SELECTOR,\n );\n\n if (menuItems.length > 0 && focusedIndex < menuItems.length) {\n // timeout trick to prevent scroll from jumping\n // when the popover is not positioned correctly yet in the opening phase\n setTimeout(() => {\n (menuItems[focusedIndex] as HTMLElement).focus({\n preventScroll: false,\n });\n }, 0);\n }\n }\n }, [isOpen, focusedIndex]);\n\n const focusMenuItem = useCallback(\n (item: HTMLElement) => {\n const menuItems = menuListRef.current.querySelectorAll(\n MENU_ITEMS_SELECTOR,\n );\n\n const itemIndex = [...menuItems].findIndex(\n (menuItem) => item === menuItem,\n );\n\n if (itemIndex !== -1) {\n setFocusedIndex(itemIndex);\n }\n },\n [setFocusedIndex],\n );\n\n const closeAndFocusTrigger = useCallback(() => {\n handleClose();\n triggerRef.current?.focus({ preventScroll: true });\n }, [handleClose]);\n\n const handleMenuListKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n closeAndFocusTrigger();\n return;\n }\n\n // we don't want to propagate other keydown events except `Tab`\n event.stopPropagation();\n\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n closeAndFocusTrigger();\n return;\n }\n\n handleArrowsKeyDown(event);\n },\n [closeAndFocusTrigger, handleArrowsKeyDown],\n );\n\n const contextValue: MenuContextType = useMemo(\n () => ({\n isOpen,\n menuId,\n focusMenuItem,\n getTriggerProps: (_props = {}, _ref = null) => ({\n onClick: (event) => {\n // if the user made component controlled by providing isOpen prop\n // but onOpen callback is not provided, we won't add toggle logic\n // to the trigger component. So they can make any toggle logic on their own.\n const isFullyControlled = isControlled && !onOpen;\n\n if (!isFullyControlled) {\n if (isOpen) {\n handleClose();\n } else {\n handleOpen();\n }\n }\n\n _props.onClick?.(event);\n },\n ref: mergeRefs(triggerRef, _ref),\n }),\n getMenuListProps: (_props = {}, _ref = null) => ({\n ref: mergeRefs(menuListRef, _ref),\n onKeyDown: (event) => {\n handleMenuListKeyDown(event);\n _props.onKeyDown?.(event);\n },\n onBlur: (event) => {\n _props.onBlur?.(event);\n\n if (!closeOnBlur) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as Node;\n\n const targetIsMenu =\n menuListRef.current === relatedTarget ||\n menuListRef.current?.contains(relatedTarget);\n const targetIsTrigger =\n triggerRef.current === relatedTarget ||\n triggerRef.current?.contains(relatedTarget);\n const targetIsSubmenu =\n relatedTarget?.parentElement?.dataset.parentMenu === menuId;\n\n if (targetIsMenu || targetIsTrigger || targetIsSubmenu) {\n event.stopPropagation();\n return;\n }\n\n handleClose();\n },\n }),\n getMenuItemProps: (_props = {}) => ({\n onClick: (event) => {\n _props.onClick?.(event);\n\n const isSubmenuTrigger = Boolean(\n (event.target as HTMLElement).getAttribute('aria-haspopup'),\n );\n if (closeOnSelect && !isSubmenuTrigger) {\n closeAndFocusTrigger();\n }\n },\n }),\n propsToPropagateToSubmenus: {\n closeOnSelect,\n closeOnBlur,\n closeOnEsc,\n },\n }),\n [\n menuId,\n isOpen,\n handleMenuListKeyDown,\n closeOnSelect,\n handleClose,\n handleOpen,\n focusMenuItem,\n closeOnBlur,\n closeOnEsc,\n closeAndFocusTrigger,\n isControlled,\n onOpen,\n ],\n );\n\n return (\n <MenuContextProvider value={contextValue}>\n <Popover\n {...otherProps}\n isOpen={isOpen}\n onClose={handleClose}\n id={menuId}\n closeOnEsc={closeOnEsc}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={false}\n closeOnBlur={false}\n >\n {children}\n </Popover>\n </MenuContextProvider>\n );\n}\n\ntype UseMenuOpenStateProps = Pick<\n MenuProps,\n 'isOpen' | 'defaultIsOpen' | 'onOpen' | 'onClose'\n>;\n\nconst useMenuOpenState = (props: UseMenuOpenStateProps) => {\n const { isOpen, defaultIsOpen, onOpen, onClose } = props;\n const [isOpenState, setIsOpen] = useState(defaultIsOpen || false);\n\n const isControlled = isOpen !== undefined;\n const isOpenValue = isControlled ? isOpen : isOpenState;\n\n const handleClose = useCallback(() => {\n if (!isControlled) {\n setIsOpen(false);\n }\n onClose?.();\n }, [isControlled, onClose]);\n\n const handleOpen = useCallback(() => {\n if (!isControlled) {\n setIsOpen(true);\n }\n onOpen?.();\n }, [isControlled, onOpen]);\n\n return { isOpen: isOpenValue, isControlled, handleClose, handleOpen };\n};\n","import React, { ComponentPropsWithRef } from 'react';\nimport { MenuProps } from '.';\n\nexport type MenuContextType = {\n isOpen: boolean;\n menuId: string;\n focusMenuItem: (item: HTMLElement) => void;\n getTriggerProps: (\n _props: ComponentPropsWithRef<'button'>,\n _ref: React.Ref<HTMLButtonElement>,\n ) => ComponentPropsWithRef<'button'>;\n getMenuListProps: (\n _props: ComponentPropsWithRef<'div'>,\n _ref: React.Ref<HTMLDivElement>,\n ) => ComponentPropsWithRef<'div'>;\n getMenuItemProps: (\n _props: ComponentPropsWithRef<'button'>,\n ) => ComponentPropsWithRef<'button'>;\n propsToPropagateToSubmenus: Pick<\n MenuProps,\n 'closeOnBlur' | 'closeOnEsc' | 'closeOnSelect'\n >;\n};\n\nconst MenuContext = React.createContext<MenuContextType | undefined>(undefined);\n\nexport const useMenuContext = () => {\n const context = React.useContext(MenuContext);\n\n if (context === undefined) {\n throw new Error('useMenuContext must be used within a MenuContextProvider');\n }\n\n return context;\n};\n\nexport const MenuContextProvider = MenuContext.Provider;\n","import React from 'react';\nimport { CommonProps, PropsWithHTMLElement } from '@contentful/f36-core';\nimport { useMenuContext } from '../MenuContext';\nimport { useSubmenuContext } from '../SubmenuContext';\nimport { Popover } from '@contentful/f36-popover';\nimport { cx } from 'emotion';\nimport { getMenuListStyles } from './MenuList.styles';\nimport { MenuListHeader } from './MenuListHeader';\nimport { MenuListFooter } from './MenuListFooter';\n\ninterface MenuListInternalProps extends CommonProps {\n children?: React.ReactNode;\n}\n\nfunction assertChild(child: any): child is { type: { displayName: string } } {\n return Boolean(child?.type?.displayName);\n}\n\nexport type MenuListProps = PropsWithHTMLElement<MenuListInternalProps, 'div'>;\n\nconst _MenuList = (props: MenuListProps, ref: React.Ref<HTMLDivElement>) => {\n const {\n children,\n testId = 'cf-ui-menu-list',\n className,\n ...otherProps\n } = props;\n\n const { getMenuListProps } = useMenuContext();\n const submenuContext = useSubmenuContext();\n\n let header: React.ReactElement | null = null;\n let footer: React.ReactElement | null = null;\n const items: React.ReactElement[] = [];\n\n React.Children.forEach(children, (child) => {\n let appendChild = true;\n if (assertChild(child)) {\n if (child.type.displayName === MenuListHeader.displayName) {\n header = (child as unknown) as React.ReactElement;\n appendChild = false;\n } else if (child.type.displayName === MenuListFooter.displayName) {\n footer = (child as unknown) as React.ReactElement;\n appendChild = false;\n }\n }\n if (appendChild) {\n items.push((child as unknown) as React.ReactElement);\n }\n });\n\n const styles = getMenuListStyles({\n hasStickyHeader: Boolean(header),\n hasStickyFooter: Boolean(footer),\n });\n\n const extendedOtherProps = submenuContext\n ? submenuContext.getSubmenuListProps(otherProps)\n : otherProps;\n\n return (\n <Popover.Content\n role=\"menu\"\n {...extendedOtherProps}\n {...getMenuListProps(extendedOtherProps, ref)}\n className={cx(styles.container, className)}\n testId={testId}\n >\n {header}\n {items}\n {footer}\n </Popover.Content>\n );\n};\n\nexport const MenuList = React.forwardRef(_MenuList);\n","import React, { ComponentPropsWithRef, ComponentPropsWithoutRef } from 'react';\n\nexport type SubmenuContextType = {\n isOpen: boolean;\n getSubmenuListProps: (\n _props: ComponentPropsWithRef<'div'>,\n ) => { 'data-parent-menu': string } & ComponentPropsWithoutRef<'div'>;\n getSubmenuTriggerProps: (\n _props: ComponentPropsWithRef<'button'>,\n _ref: React.Ref<HTMLButtonElement>,\n ) => ComponentPropsWithRef<'button'>;\n};\n\nconst SubmenuContext = React.createContext<SubmenuContextType | undefined>(\n undefined,\n);\n\nexport const useSubmenuContext = () => {\n const context = React.useContext(SubmenuContext);\n return context;\n};\n\nexport const SubmenuContextProvider = SubmenuContext.Provider;\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuHeaderStyles = () => {\n return css({\n position: 'sticky',\n top: 0,\n left: 0,\n backgroundColor: tokens.colorWhite,\n borderBottom: `1px solid ${tokens.gray300}`,\n padding: `${tokens.spacingXs} 0`,\n zIndex: 1001,\n });\n};\n\nexport const getMenuFooterStyles = () => {\n return css({\n position: 'sticky',\n bottom: 0,\n left: 0,\n backgroundColor: tokens.colorWhite,\n borderTop: `1px solid ${tokens.gray300}`,\n padding: `${tokens.spacingXs} 0`,\n zIndex: 1001,\n });\n};\n\nexport const getMenuListStyles = (props: {\n hasStickyFooter?: boolean;\n hasStickyHeader?: boolean;\n}) => ({\n container: css({\n overflowY: 'auto',\n position: 'relative',\n padding: 0,\n paddingTop: props.hasStickyHeader ? 0 : tokens.spacingXs,\n paddingBottom: props.hasStickyFooter ? 0 : tokens.spacingXs,\n }),\n});\n","import React from 'react';\nimport { cx } from 'emotion';\nimport type { CommonProps, PropsWithHTMLElement } from '@contentful/f36-core';\n\nimport { getMenuHeaderStyles } from './MenuList.styles';\n\nexport type MenuListHeaderProps = PropsWithHTMLElement<CommonProps, 'div'>;\n\nexport const MenuListHeader: React.FC<MenuListHeaderProps> = (props) => {\n const {\n children,\n testId = 'cf-ui-menu-list-header',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuHeaderStyles();\n\n return (\n <div\n data-test-id={testId}\n className={cx(styles, className)}\n {...otherProps}\n >\n {children}\n </div>\n );\n};\n\nMenuListHeader.displayName = 'MenuListHeader';\n","import React from 'react';\nimport { cx } from 'emotion';\nimport type { CommonProps, PropsWithHTMLElement } from '@contentful/f36-core';\n\nimport { getMenuFooterStyles } from './MenuList.styles';\n\nexport type MenuListFooterProps = PropsWithHTMLElement<CommonProps, 'div'>;\n\nexport const MenuListFooter: React.FC<MenuListFooterProps> = (props) => {\n const {\n children,\n testId = 'cf-ui-menu-list-footer',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuFooterStyles();\n\n return (\n <div\n data-test-id={testId}\n className={cx(styles, className)}\n {...otherProps}\n >\n {children}\n </div>\n );\n};\n\nMenuListFooter.displayName = 'MenuListFooter';\n","import React, { useEffect, useRef } from 'react';\nimport { cx } from 'emotion';\nimport {\n CommonProps,\n mergeRefs,\n PolymorphicComponent,\n PolymorphicProps,\n} from '@contentful/f36-core';\nimport { useMenuContext } from '../MenuContext';\nimport { useId } from '@contentful/f36-core';\nimport { getMenuItemStyles } from './MenuItem.styles';\n\nconst MENU_ITEM_DEFAULT_TAG = 'button';\n\ninterface MenuItemInternalProps extends CommonProps {\n children?: React.ReactNode;\n as?: 'a' | 'button';\n\n /**\n * Sets focus on item\n */\n isInitiallyFocused?: boolean;\n}\n\nexport type MenuItemProps<\n E extends React.ElementType = typeof MENU_ITEM_DEFAULT_TAG\n> = PolymorphicProps<MenuItemInternalProps, E>;\n\nfunction _MenuItem<E extends React.ElementType = typeof MENU_ITEM_DEFAULT_TAG>(\n props: MenuItemProps<E>,\n ref: React.Ref<any>,\n) {\n const { testId, className, as, isInitiallyFocused, ...otherProps } = props;\n\n const id = useId(null, 'menu-item');\n const itemTestId = testId || `cf-ui-${id}`;\n const styles = getMenuItemStyles();\n\n const { getMenuItemProps, focusMenuItem } = useMenuContext();\n\n const itemRef = useRef<HTMLElement>(null);\n useEffect(() => {\n if (isInitiallyFocused && itemRef.current) {\n focusMenuItem(itemRef.current);\n }\n }, [isInitiallyFocused, focusMenuItem]);\n\n const Element = (as ?? MENU_ITEM_DEFAULT_TAG) as React.ElementType;\n\n return (\n <Element\n role=\"menuitem\"\n {...otherProps}\n {...getMenuItemProps(otherProps)}\n className={cx(styles.root, className)}\n data-test-id={itemTestId}\n ref={mergeRefs(itemRef, ref)}\n tabIndex={-1}\n >\n {props.children}\n </Element>\n );\n}\n\nexport const MenuItem: PolymorphicComponent<\n MenuItemInternalProps,\n typeof MENU_ITEM_DEFAULT_TAG\n> = React.forwardRef(_MenuItem);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuItemStyles = () => {\n return {\n root: css({\n display: 'block',\n width: '100%',\n background: 'none',\n border: 0,\n margin: 0,\n outline: 'none',\n fontSize: tokens.fontSizeM,\n lineHeight: tokens.lineHeightM,\n fontWeight: tokens.fontWeightNormal,\n position: 'relative',\n textAlign: 'left',\n padding: `${tokens.spacingXs} ${tokens.spacingM}`,\n wordBreak: 'break-word',\n whiteSpace: 'break-spaces',\n cursor: 'pointer',\n hyphens: 'auto',\n minWidth: '150px',\n textDecoration: 'none',\n color: tokens.gray800,\n\n '&:focus, &:hover': {\n backgroundColor: tokens.gray100,\n },\n '&:active': {\n backgroundColor: tokens.gray200,\n },\n '&:disabled': {\n opacity: 0.5,\n cursor: 'auto',\n },\n }),\n };\n};\n","import React from 'react';\nimport { Popover } from '@contentful/f36-popover';\nimport { useMenuContext } from '../MenuContext';\n\nexport interface MenuTriggerProps {\n children: React.ReactNode;\n}\n\nexport const MenuTrigger = (props: MenuTriggerProps) => {\n const child = React.Children.only(props.children) as any;\n const { getTriggerProps } = useMenuContext();\n\n return (\n <Popover.Trigger>\n {React.cloneElement(child, {\n ...getTriggerProps(child.props, child.ref),\n ['aria-haspopup']: 'menu',\n })}\n </Popover.Trigger>\n );\n};\n","import React from 'react';\nimport { CommonProps, PropsWithHTMLElement } from '@contentful/f36-core';\nimport { cx } from 'emotion';\nimport { getMenuDividerStyles } from './MenuDivider.styles';\n\nexport type MenuDividerProps = PropsWithHTMLElement<CommonProps, 'hr'>;\n\nexport const MenuDivider = (props: MenuDividerProps) => {\n const {\n children,\n testId = 'cf-ui-menu-divider',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuDividerStyles();\n\n return (\n <hr\n aria-orientation=\"horizontal\"\n data-test-id={testId}\n className={cx(styles, className)}\n {...otherProps}\n />\n );\n};\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuDividerStyles = () =>\n css({\n border: 'none',\n width: '100%',\n height: '1px',\n background: tokens.gray300,\n margin: `${tokens.spacingXs} 0`,\n });\n","import React from 'react';\nimport { cx } from 'emotion';\nimport { getMenuSectionTitleStyles } from './MenuSectionTitle.styles';\nimport {\n SectionHeading,\n SectionHeadingProps,\n} from '@contentful/f36-typography';\n\nexport type MenuSectionTitleProps = SectionHeadingProps;\n\nexport const MenuSectionTitle = (props: MenuSectionTitleProps) => {\n const {\n children,\n testId = 'cf-ui-menu-section-title',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuSectionTitleStyles();\n\n return (\n <SectionHeading\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\n aria-hidden=\"true\"\n testId={testId}\n className={cx(styles, className)}\n marginBottom=\"none\"\n {...otherProps}\n >\n {children}\n </SectionHeading>\n );\n};\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuSectionTitleStyles = () =>\n css({\n textAlign: 'left',\n padding: `${tokens.spacingXs} ${tokens.spacingM}`,\n lineHeight: tokens.lineHeightM,\n\n 'hr + &': {\n marginTop: '-8px',\n },\n });\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Menu, MenuProps } from '../Menu';\nimport { useMenuContext } from '../MenuContext';\nimport { SubmenuContextProvider, SubmenuContextType } from '../SubmenuContext';\nimport { mergeRefs } from '@contentful/f36-core';\n\nconst SUBMENU_OFFSET: [number, number] = [-8, 2];\n\nexport type SubmenuProps = Omit<\n MenuProps,\n | 'placement'\n | 'offset'\n | 'usePortal'\n | 'isOpen'\n | 'isAutoalignmentEnabled'\n | 'defaultIsOpen'\n>;\n\nexport const Submenu = (props: SubmenuProps) => {\n const { onClose, onOpen, ...otherProps } = props;\n\n const {\n isOpen: isParentMenuOpen,\n menuId,\n propsToPropagateToSubmenus,\n } = useMenuContext();\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const mouseLeaveTimerRef = useRef(null);\n\n const [isOpen, setIsOpen] = useState(false);\n const handleOpen = useCallback(() => {\n setIsOpen(true);\n window.clearTimeout(mouseLeaveTimerRef.current);\n\n onOpen?.();\n }, [onOpen]);\n const handleClose = useCallback(() => {\n setIsOpen(false);\n window.clearTimeout(mouseLeaveTimerRef.current);\n\n onClose?.();\n }, [onClose]);\n const closeAndFocusTrigger = useCallback(() => {\n handleClose();\n triggerRef.current?.focus({ preventScroll: true });\n }, [handleClose]);\n\n useEffect(() => {\n // close when parent menu closed\n if (isParentMenuOpen === false) {\n setIsOpen(false);\n }\n }, [isParentMenuOpen]);\n\n const contextValue: SubmenuContextType = useMemo(\n () => ({\n isOpen,\n getSubmenuListProps: (_props) => ({\n 'data-parent-menu': menuId,\n onMouseOver: (event) => {\n handleOpen();\n\n _props.onMouseOver?.(event);\n },\n onMouseLeave: (event) => {\n closeAndFocusTrigger();\n\n _props.onMouseLeave?.(event);\n },\n }),\n getSubmenuTriggerProps: (_props, _ref) => ({\n ref: mergeRefs(triggerRef, _ref),\n onKeyDown: (event) => {\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n handleOpen();\n }\n\n _props.onKeyDown?.(event);\n },\n onMouseOver: (event) => {\n handleOpen();\n\n _props.onMouseOver?.(event);\n },\n onMouseLeave: (event) => {\n mouseLeaveTimerRef.current = window.setTimeout(\n closeAndFocusTrigger,\n 300,\n );\n\n _props.onMouseLeave?.(event);\n },\n }),\n }),\n [isOpen, menuId, handleOpen, closeAndFocusTrigger],\n );\n\n return (\n <SubmenuContextProvider value={contextValue}>\n <Menu\n {...propsToPropagateToSubmenus}\n {...otherProps}\n isOpen={isOpen}\n onClose={handleClose}\n onOpen={handleOpen}\n placement=\"right-start\"\n offset={SUBMENU_OFFSET}\n isAutoalignmentEnabled={false}\n />\n </SubmenuContextProvider>\n );\n};\n","import React from 'react';\nimport { MenuTrigger } from '../MenuTrigger/MenuTrigger';\nimport { MenuItem, MenuItemProps } from '../MenuItem/MenuItem';\nimport { useSubmenuContext } from '../SubmenuContext';\nimport { ChevronRightIcon } from '@contentful/f36-icons';\nimport { cx } from 'emotion';\nimport { getSubmenuTriggerStyles } from './SubmenuTrigger.styles';\n\nexport type SubmenuTriggerProps = Omit<\n MenuItemProps<'button'>,\n 'isInitiallyFocused' | 'as'\n>;\n\nconst _SubmenuTrigger = (\n props: SubmenuTriggerProps,\n ref: React.Ref<HTMLButtonElement>,\n) => {\n const { className, children } = props;\n const { getSubmenuTriggerProps, isOpen } = useSubmenuContext();\n\n const styles = getSubmenuTriggerStyles();\n\n return (\n <MenuTrigger>\n <MenuItem\n {...props}\n {...getSubmenuTriggerProps(props, ref)}\n className={cx(styles.root({ isActive: isOpen }), className)}\n >\n <span className={styles.content}>{children}</span>\n <ChevronRightIcon className={styles.icon} />\n </MenuItem>\n </MenuTrigger>\n );\n};\n\nexport const SubmenuTrigger = React.forwardRef(_SubmenuTrigger);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getSubmenuTriggerStyles = () => {\n return {\n root: ({ isActive }) =>\n css({\n display: 'flex',\n alignItems: 'center',\n paddingRight: tokens.spacingXs,\n ...(isActive\n ? {\n backgroundColor: tokens.gray100,\n }\n : {}),\n }),\n content: css({\n marginRight: tokens.spacingM,\n }),\n icon: css({\n marginLeft: 'auto',\n fill: 'currentColor',\n }),\n };\n};\n"],"names":["Menu","MenuProps","MenuList","MenuListProps","MenuItem","MenuItemProps","MenuTrigger","MenuTriggerProps","MenuDivider","MenuDividerProps","MenuSectionTitle","MenuSectionTitleProps","Submenu","SubmenuProps","SubmenuTrigger","SubmenuTriggerProps","OriginalMenu","MenuListHeader","MenuListFooter","CompoundMenu","List","ListHeader","ListFooter","Item","Trigger","Divider","SectionTitle","React","useState","useCallback","useMemo","useRef","useEffect","mergeRefs","useId","useArrowKeyNavigation","Popover","PopoverProps","MenuContextProvider","MenuContextType","MENU_ITEMS_SELECTOR","Omit","isOpen","defaultIsOpen","onOpen","onClose","closeOnSelect","closeOnBlur","closeOnEsc","props","children","otherProps","handleOpen","handleClose","isControlled","useMenuOpenState","triggerRef","HTMLButtonElement","menuListRef","HTMLDivElement","menuId","focusedIndex","handleArrowsKeyDown","setFocusedIndex","itemsContainerRef","itemsSelector","current","menuItems","querySelectorAll","length","setTimeout","HTMLElement","focus","preventScroll","focusMenuItem","item","itemIndex","findIndex","menuItem","closeAndFocusTrigger","handleMenuListKeyDown","event","KeyboardEvent","key","preventDefault","stopPropagation","contextValue","getTriggerProps","_props","_ref","onClick","isFullyControlled","ref","getMenuListProps","onKeyDown","onBlur","relatedTarget","Node","targetIsMenu","contains","targetIsTrigger","targetIsSubmenu","parentElement","dataset","parentMenu","getMenuItemProps","isSubmenuTrigger","Boolean","target","getAttribute","propsToPropagateToSubmenus","UseMenuOpenStateProps","Pick","isOpenState","setIsOpen","undefined","isOpenValue","ComponentPropsWithRef","Ref","MenuContext","createContext","useMenuContext","context","useContext","Error","Provider","CommonProps","PropsWithHTMLElement","useSubmenuContext","getMenuListStyles","MenuListInternalProps","ReactNode","assertChild","child","type","displayName","_MenuList","testId","className","submenuContext","header","ReactElement","footer","items","Children","forEach","appendChild","push","styles","hasStickyHeader","hasStickyFooter","extendedOtherProps","getSubmenuListProps","container","forwardRef","ComponentPropsWithoutRef","SubmenuContextType","getSubmenuTriggerProps","SubmenuContext","SubmenuContextProvider","tokens","getMenuHeaderStyles","position","top","left","backgroundColor","colorWhite","borderBottom","gray300","padding","spacingXs","zIndex","getMenuFooterStyles","bottom","borderTop","overflowY","paddingTop","paddingBottom","MenuListHeaderProps","FC","MenuListFooterProps","PolymorphicComponent","PolymorphicProps","getMenuItemStyles","MENU_ITEM_DEFAULT_TAG","MenuItemInternalProps","as","isInitiallyFocused","ElementType","E","_MenuItem","id","itemTestId","itemRef","Element","root","display","width","background","border","margin","outline","fontSize","fontSizeM","lineHeight","lineHeightM","fontWeight","fontWeightNormal","textAlign","spacingM","wordBreak","whiteSpace","cursor","hyphens","minWidth","textDecoration","color","gray800","gray100","gray200","opacity","only","cloneElement","getMenuDividerStyles","height","getMenuSectionTitleStyles","SectionHeading","SectionHeadingProps","marginTop","SUBMENU_OFFSET","isParentMenuOpen","mouseLeaveTimerRef","window","clearTimeout","onMouseOver","onMouseLeave","ChevronRightIcon","getSubmenuTriggerStyles","_SubmenuTrigger","isActive","content","icon","alignItems","paddingRight","marginRight"],"version":3,"file":"main.js.map"}
1
+ {"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AGSA,KAAA,CAAMyH,qCAAe,GAAG,CAAxB;IACEC,QAAQ,EAAE,CAAVA;QACEC,IAAI,EAAE,CADE;QAERC,IAAI,EAAE,CAANA;IAFQ,CADY;IAKtBC,UAAU,EAAE,CAAZA;QACEF,IAAI,EAAE,CADI;QAEVC,IAAI,EAAE,C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AAY,CAHlC;gBAGoC4C,QAAQ,EAAEtN,MAAVsN;YAAF,CAAZ,GAAmCnG,SAAtC;;yDAEV,CAAD;oBAAM,SAAA,EAAWS,MAAM,CAAC2F,OAAR;8BAAkB/M,QAAD;;yDAChC,0CAAD;oBAAkB,SAAA,EAAWoH,MAAM,CAAC4F,IAAR;;;;;AAInC,CArBD;AAuBO,KAAA,CAAMpP,yCAAc,iBAAGa,oCAAK,CAACgJ,UAAN,CAAiBoF,qCAAjB;;;AjBdvB,KAAA,CAAM/P,yCAAI,GAAGgB,yCAAY;AAChChB,yCAAI,CAACoB,IAAL,GAAYlB,wCAAZ;AACAF,yCAAI,CAACqB,UAAL,GAAkBJ,yCAAlB;AACAjB,yCAAI,CAACsB,UAAL,GAAkBJ,yCAAlB;AACAlB,yCAAI,CAACuB,IAAL,GAAYnB,yCAAZ;AACAJ,yCAAI,CAACwB,OAAL,GAAelB,yCAAf;AACAN,yCAAI,CAACyB,OAAL,GAAejB,yCAAf;AACAR,yCAAI,CAAC0B,YAAL,GAAoBhB,yCAApB;AACAV,yCAAI,CAACY,OAAL,GAAeA,yCAAf;AACAZ,yCAAI,CAACc,cAAL,GAAsBA,yCAAtB","sources":["packages/components/menu/src/index.ts","packages/components/menu/src/CompoundMenu.tsx","packages/components/menu/src/Menu.tsx","packages/components/menu/src/useArrowKeyNavigation.ts","packages/components/menu/src/MenuContext.ts","packages/components/menu/src/MenuList/MenuList.tsx","packages/components/menu/src/SubmenuContext.ts","packages/components/menu/src/MenuList/MenuList.styles.ts","packages/components/menu/src/MenuList/MenuListHeader.tsx","packages/components/menu/src/MenuList/MenuListFooter.tsx","packages/components/menu/src/MenuItem/MenuItem.tsx","packages/components/menu/src/MenuItem/MenuItem.styles.ts","packages/components/menu/src/MenuTrigger/MenuTrigger.tsx","packages/components/menu/src/MenuDivider/MenuDivider.tsx","packages/components/menu/src/MenuDivider/MenuDivider.styles.ts","packages/components/menu/src/MenuSectionTitle/MenuSectionTitle.tsx","packages/components/menu/src/MenuSectionTitle/MenuSectionTitle.styles.ts","packages/components/menu/src/Submenu/Submenu.tsx","packages/components/menu/src/SubmenuTrigger/SubmenuTrigger.tsx","packages/components/menu/src/SubmenuTrigger/SubmenuTrigger.styles.ts"],"sourcesContent":["export { Menu } from './CompoundMenu';\nexport type { MenuProps } from './Menu';\nexport { MenuList } from './MenuList/MenuList';\nexport type { MenuListProps } from './MenuList/MenuList';\nexport { MenuItem } from './MenuItem/MenuItem';\nexport type { MenuItemProps } from './MenuItem/MenuItem';\nexport { MenuTrigger } from './MenuTrigger/MenuTrigger';\nexport type { MenuTriggerProps } from './MenuTrigger/MenuTrigger';\nexport { MenuDivider } from './MenuDivider/MenuDivider';\nexport type { MenuDividerProps } from './MenuDivider/MenuDivider';\nexport { MenuSectionTitle } from './MenuSectionTitle/MenuSectionTitle';\nexport type { MenuSectionTitleProps } from './MenuSectionTitle/MenuSectionTitle';\nexport { Submenu } from './Submenu/Submenu';\nexport type { SubmenuProps } from './Submenu/Submenu';\nexport { SubmenuTrigger } from './SubmenuTrigger/SubmenuTrigger';\nexport type { SubmenuTriggerProps } from './SubmenuTrigger/SubmenuTrigger';\n","import { Menu as OriginalMenu } from './Menu';\nimport { MenuList } from './MenuList/MenuList';\nimport { MenuListHeader } from './MenuList/MenuListHeader';\nimport { MenuListFooter } from './MenuList/MenuListFooter';\nimport { MenuItem } from './MenuItem/MenuItem';\nimport { MenuTrigger } from './MenuTrigger/MenuTrigger';\nimport { MenuDivider } from './MenuDivider/MenuDivider';\nimport { MenuSectionTitle } from './MenuSectionTitle/MenuSectionTitle';\nimport { Submenu } from './Submenu/Submenu';\nimport { SubmenuTrigger } from './SubmenuTrigger/SubmenuTrigger';\n\ntype CompoundMenu = typeof OriginalMenu & {\n List: typeof MenuList;\n ListHeader: typeof MenuListHeader;\n ListFooter: typeof MenuListFooter;\n Item: typeof MenuItem;\n Trigger: typeof MenuTrigger;\n Divider: typeof MenuDivider;\n SectionTitle: typeof MenuSectionTitle;\n Submenu: typeof Submenu;\n SubmenuTrigger: typeof SubmenuTrigger;\n};\n\nexport const Menu = OriginalMenu as CompoundMenu;\nMenu.List = MenuList;\nMenu.ListHeader = MenuListHeader;\nMenu.ListFooter = MenuListFooter;\nMenu.Item = MenuItem;\nMenu.Trigger = MenuTrigger;\nMenu.Divider = MenuDivider;\nMenu.SectionTitle = MenuSectionTitle;\nMenu.Submenu = Submenu;\nMenu.SubmenuTrigger = SubmenuTrigger;\n","import React, {\n useState,\n useCallback,\n useMemo,\n useRef,\n useEffect,\n} from 'react';\nimport { mergeRefs, useId } from '@contentful/f36-core';\nimport { useArrowKeyNavigation } from './useArrowKeyNavigation';\nimport { Popover, PopoverProps } from '@contentful/f36-popover';\nimport { MenuContextProvider, MenuContextType } from './MenuContext';\n\nconst MENU_ITEMS_SELECTOR = '[role=\"menuitem\"]:not(:disabled)';\n\nexport interface MenuProps\n extends Omit<PopoverProps, 'autoFocus' | 'id' | 'closeOnBlur'> {\n /**\n * If `true`, the Menu will be opened in controlled mode.\n * By default the Menu is uncontrolled\n */\n isOpen?: boolean;\n\n /**\n * If `true`, the Menu will be initially opened.\n */\n defaultIsOpen?: boolean;\n\n /**\n * Callback fired when the Menu opens\n */\n onOpen?: () => void;\n\n /**\n * Callback fired when the Menu closes\n */\n onClose?: () => void;\n\n /**\n * If `true`, the Menu will close when a menu item is\n * clicked\n *\n * Note: This prop will be propagated to all submenus,\n * unless you will override it with props on submenu itself\n *\n * @default true\n */\n closeOnSelect?: boolean;\n\n /**\n * If true, the menu will close when you blur out it by clicking outside\n *\n * Note: This prop will be propagated to all submenus,\n * unless you will override it with props on submenu itself\n *\n * @default true\n */\n closeOnBlur?: boolean;\n\n /**\n * If true, the menu will close when you hit the Esc key\n *\n * Note: This prop will be propagated to all submenus,\n * unless you will override it with props on submenu itself\n *\n * @default true\n */\n closeOnEsc?: boolean;\n}\n\nexport function Menu(props: MenuProps) {\n const {\n closeOnSelect = true,\n closeOnBlur = true,\n closeOnEsc = true,\n children,\n onOpen,\n ...otherProps\n } = props;\n const { isOpen, handleOpen, handleClose, isControlled } = useMenuOpenState(\n props,\n );\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const menuListRef = useRef<HTMLDivElement>(null);\n\n const menuId = useId(null, 'menu');\n\n const {\n focusedIndex,\n handleArrowsKeyDown,\n setFocusedIndex,\n } = useArrowKeyNavigation({\n itemsContainerRef: menuListRef,\n itemsSelector: MENU_ITEMS_SELECTOR,\n });\n\n useEffect(() => {\n if (isOpen && menuListRef.current) {\n const menuItems = menuListRef.current.querySelectorAll(\n MENU_ITEMS_SELECTOR,\n );\n\n if (menuItems.length > 0 && focusedIndex < menuItems.length) {\n // timeout trick to prevent scroll from jumping\n // when the popover is not positioned correctly yet in the opening phase\n setTimeout(() => {\n (menuItems[focusedIndex] as HTMLElement).focus({\n preventScroll: false,\n });\n }, 0);\n }\n }\n }, [isOpen, focusedIndex]);\n\n const focusMenuItem = useCallback(\n (item: HTMLElement) => {\n const menuItems = menuListRef.current.querySelectorAll(\n MENU_ITEMS_SELECTOR,\n );\n\n const itemIndex = [...menuItems].findIndex(\n (menuItem) => item === menuItem,\n );\n\n if (itemIndex !== -1) {\n setFocusedIndex(itemIndex);\n }\n },\n [setFocusedIndex],\n );\n\n const closeAndFocusTrigger = useCallback(() => {\n handleClose();\n triggerRef.current?.focus({ preventScroll: true });\n }, [handleClose]);\n\n const handleMenuListKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n if (event.key === 'Tab') {\n event.preventDefault();\n closeAndFocusTrigger();\n return;\n }\n\n // we don't want to propagate other keydown events except `Tab`\n event.stopPropagation();\n\n if (event.key === 'ArrowLeft') {\n event.preventDefault();\n closeAndFocusTrigger();\n return;\n }\n\n handleArrowsKeyDown(event);\n },\n [closeAndFocusTrigger, handleArrowsKeyDown],\n );\n\n const contextValue: MenuContextType = useMemo(\n () => ({\n isOpen,\n menuId,\n focusMenuItem,\n getTriggerProps: (_props = {}, _ref = null) => ({\n onClick: (event) => {\n // if the user made component controlled by providing isOpen prop\n // but onOpen callback is not provided, we won't add toggle logic\n // to the trigger component. So they can make any toggle logic on their own.\n const isFullyControlled = isControlled && !onOpen;\n\n if (!isFullyControlled) {\n if (isOpen) {\n handleClose();\n } else {\n handleOpen();\n }\n }\n\n _props.onClick?.(event);\n },\n ref: mergeRefs(triggerRef, _ref),\n }),\n getMenuListProps: (_props = {}, _ref = null) => ({\n ref: mergeRefs(menuListRef, _ref),\n onKeyDown: (event) => {\n handleMenuListKeyDown(event);\n _props.onKeyDown?.(event);\n },\n onBlur: (event) => {\n _props.onBlur?.(event);\n\n if (!closeOnBlur) {\n return;\n }\n\n const relatedTarget = event.relatedTarget as Node;\n\n const targetIsMenu =\n menuListRef.current === relatedTarget ||\n menuListRef.current?.contains(relatedTarget);\n const targetIsTrigger =\n triggerRef.current === relatedTarget ||\n triggerRef.current?.contains(relatedTarget);\n const targetIsSubmenu =\n relatedTarget?.parentElement?.dataset.parentMenu === menuId;\n\n if (targetIsMenu || targetIsTrigger || targetIsSubmenu) {\n event.stopPropagation();\n return;\n }\n\n handleClose();\n },\n }),\n getMenuItemProps: (_props = {}) => ({\n onClick: (event) => {\n _props.onClick?.(event);\n\n const isSubmenuTrigger = Boolean(\n (event.target as HTMLElement).getAttribute('aria-haspopup'),\n );\n if (closeOnSelect && !isSubmenuTrigger) {\n closeAndFocusTrigger();\n }\n },\n }),\n propsToPropagateToSubmenus: {\n closeOnSelect,\n closeOnBlur,\n closeOnEsc,\n },\n }),\n [\n menuId,\n isOpen,\n handleMenuListKeyDown,\n closeOnSelect,\n handleClose,\n handleOpen,\n focusMenuItem,\n closeOnBlur,\n closeOnEsc,\n closeAndFocusTrigger,\n isControlled,\n onOpen,\n ],\n );\n\n return (\n <MenuContextProvider value={contextValue}>\n <Popover\n {...otherProps}\n isOpen={isOpen}\n onClose={handleClose}\n id={menuId}\n closeOnEsc={closeOnEsc}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={false}\n closeOnBlur={false}\n >\n {children}\n </Popover>\n </MenuContextProvider>\n );\n}\n\ntype UseMenuOpenStateProps = Pick<\n MenuProps,\n 'isOpen' | 'defaultIsOpen' | 'onOpen' | 'onClose'\n>;\n\nconst useMenuOpenState = (props: UseMenuOpenStateProps) => {\n const { isOpen, defaultIsOpen, onOpen, onClose } = props;\n const [isOpenState, setIsOpen] = useState(defaultIsOpen || false);\n\n const isControlled = isOpen !== undefined;\n const isOpenValue = isControlled ? isOpen : isOpenState;\n\n const handleClose = useCallback(() => {\n if (!isControlled) {\n setIsOpen(false);\n }\n onClose?.();\n }, [isControlled, onClose]);\n\n const handleOpen = useCallback(() => {\n if (!isControlled) {\n setIsOpen(true);\n }\n onOpen?.();\n }, [isControlled, onOpen]);\n\n return { isOpen: isOpenValue, isControlled, handleClose, handleOpen };\n};\n","import { useState, useCallback } from 'react';\n\ninterface UseArrowKeyNavigationProps {\n itemsContainerRef: React.MutableRefObject<HTMLElement>;\n itemsSelector: string;\n keyType?: 'vertical' | 'horizontal';\n initialFocusedIndex?: number;\n}\n\nconst ARROW_KEY_TYPES = {\n vertical: {\n prev: 'ArrowUp',\n next: 'ArrowDown',\n },\n horizontal: {\n prev: 'ArrowLeft',\n next: 'ArrowRight',\n },\n};\n\nexport const useArrowKeyNavigation = ({\n itemsContainerRef,\n itemsSelector,\n keyType = 'vertical',\n}: UseArrowKeyNavigationProps) => {\n const [focusedIndex, setFocusedIndex] = useState<number>(0);\n\n const handleArrowsKeyDown = useCallback(\n (event: React.KeyboardEvent) => {\n const container = itemsContainerRef.current;\n if (!container) return;\n\n const items = container.querySelectorAll(itemsSelector);\n if (items.length === 0) return;\n\n const lastItemIndex = items.length - 1;\n\n const focusFirstItem = () => setFocusedIndex(0);\n const focusLastItem = () => setFocusedIndex(lastItemIndex);\n const focusNextItem = () => {\n if (focusedIndex === lastItemIndex) {\n focusFirstItem();\n } else {\n setFocusedIndex(focusedIndex + 1);\n }\n };\n const focusPrevItem = () => {\n if (focusedIndex === 0) {\n focusLastItem();\n } else {\n setFocusedIndex(focusedIndex - 1);\n }\n };\n\n const keyToFnMap = {\n [ARROW_KEY_TYPES[keyType].next]: focusNextItem,\n [ARROW_KEY_TYPES[keyType].prev]: focusPrevItem,\n };\n\n const fn = keyToFnMap[event.key];\n if (fn) {\n event.preventDefault();\n fn();\n }\n },\n [focusedIndex, itemsSelector, itemsContainerRef, keyType],\n );\n\n return { focusedIndex, handleArrowsKeyDown, setFocusedIndex };\n};\n","import React, { ComponentPropsWithRef } from 'react';\nimport { MenuProps } from '.';\n\nexport type MenuContextType = {\n isOpen: boolean;\n menuId: string;\n focusMenuItem: (item: HTMLElement) => void;\n getTriggerProps: (\n _props: ComponentPropsWithRef<'button'>,\n _ref: React.Ref<HTMLButtonElement>,\n ) => ComponentPropsWithRef<'button'>;\n getMenuListProps: (\n _props: ComponentPropsWithRef<'div'>,\n _ref: React.Ref<HTMLDivElement>,\n ) => ComponentPropsWithRef<'div'>;\n getMenuItemProps: (\n _props: ComponentPropsWithRef<'button'>,\n ) => ComponentPropsWithRef<'button'>;\n propsToPropagateToSubmenus: Pick<\n MenuProps,\n 'closeOnBlur' | 'closeOnEsc' | 'closeOnSelect'\n >;\n};\n\nconst MenuContext = React.createContext<MenuContextType | undefined>(undefined);\n\nexport const useMenuContext = () => {\n const context = React.useContext(MenuContext);\n\n if (context === undefined) {\n throw new Error('useMenuContext must be used within a MenuContextProvider');\n }\n\n return context;\n};\n\nexport const MenuContextProvider = MenuContext.Provider;\n","import React from 'react';\nimport {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { useMenuContext } from '../MenuContext';\nimport { useSubmenuContext } from '../SubmenuContext';\nimport { Popover } from '@contentful/f36-popover';\nimport { cx } from 'emotion';\nimport { getMenuListStyles } from './MenuList.styles';\nimport { MenuListHeader } from './MenuListHeader';\nimport { MenuListFooter } from './MenuListFooter';\n\ninterface MenuListInternalProps extends CommonProps {\n children?: React.ReactNode;\n}\n\nfunction assertChild(child: any): child is { type: { displayName: string } } {\n return Boolean(child?.type?.displayName);\n}\n\nexport type MenuListProps = PropsWithHTMLElement<MenuListInternalProps, 'div'>;\n\nconst _MenuList = (\n props: ExpandProps<MenuListProps>,\n ref: React.Ref<HTMLDivElement>,\n) => {\n const {\n children,\n testId = 'cf-ui-menu-list',\n className,\n ...otherProps\n } = props;\n\n const { getMenuListProps } = useMenuContext();\n const submenuContext = useSubmenuContext();\n\n let header: React.ReactElement | null = null;\n let footer: React.ReactElement | null = null;\n const items: React.ReactElement[] = [];\n\n React.Children.forEach(children, (child) => {\n let appendChild = true;\n if (assertChild(child)) {\n if (child.type.displayName === MenuListHeader.displayName) {\n header = (child as unknown) as React.ReactElement;\n appendChild = false;\n } else if (child.type.displayName === MenuListFooter.displayName) {\n footer = (child as unknown) as React.ReactElement;\n appendChild = false;\n }\n }\n if (appendChild) {\n items.push((child as unknown) as React.ReactElement);\n }\n });\n\n const styles = getMenuListStyles({\n hasStickyHeader: Boolean(header),\n hasStickyFooter: Boolean(footer),\n });\n\n const extendedOtherProps = submenuContext\n ? submenuContext.getSubmenuListProps(otherProps)\n : otherProps;\n\n return (\n <Popover.Content\n role=\"menu\"\n {...extendedOtherProps}\n {...getMenuListProps(extendedOtherProps, ref)}\n className={cx(styles.container, className)}\n testId={testId}\n >\n {header}\n {items}\n {footer}\n </Popover.Content>\n );\n};\n\nexport const MenuList = React.forwardRef(_MenuList);\n","import React, { ComponentPropsWithRef, ComponentPropsWithoutRef } from 'react';\n\nexport type SubmenuContextType = {\n isOpen: boolean;\n getSubmenuListProps: (\n _props: ComponentPropsWithRef<'div'>,\n ) => { 'data-parent-menu': string } & ComponentPropsWithoutRef<'div'>;\n getSubmenuTriggerProps: (\n _props: ComponentPropsWithRef<'button'>,\n _ref: React.Ref<HTMLButtonElement>,\n ) => ComponentPropsWithRef<'button'>;\n};\n\nconst SubmenuContext = React.createContext<SubmenuContextType | undefined>(\n undefined,\n);\n\nexport const useSubmenuContext = () => {\n const context = React.useContext(SubmenuContext);\n return context;\n};\n\nexport const SubmenuContextProvider = SubmenuContext.Provider;\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuHeaderStyles = () => {\n return css({\n position: 'sticky',\n top: 0,\n left: 0,\n backgroundColor: tokens.colorWhite,\n borderBottom: `1px solid ${tokens.gray300}`,\n padding: `${tokens.spacingXs} 0`,\n zIndex: 1001,\n });\n};\n\nexport const getMenuFooterStyles = () => {\n return css({\n position: 'sticky',\n bottom: 0,\n left: 0,\n backgroundColor: tokens.colorWhite,\n borderTop: `1px solid ${tokens.gray300}`,\n padding: `${tokens.spacingXs} 0`,\n zIndex: 1001,\n });\n};\n\nexport const getMenuListStyles = (props: {\n hasStickyFooter?: boolean;\n hasStickyHeader?: boolean;\n}) => ({\n container: css({\n overflowY: 'auto',\n position: 'relative',\n padding: 0,\n paddingTop: props.hasStickyHeader ? 0 : tokens.spacingXs,\n paddingBottom: props.hasStickyFooter ? 0 : tokens.spacingXs,\n }),\n});\n","import React from 'react';\nimport { cx } from 'emotion';\nimport type {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\n\nimport { getMenuHeaderStyles } from './MenuList.styles';\n\nexport type MenuListHeaderProps = PropsWithHTMLElement<CommonProps, 'div'>;\n\nexport const MenuListHeader: React.FC<ExpandProps<MenuListHeaderProps>> = (\n props,\n) => {\n const {\n children,\n testId = 'cf-ui-menu-list-header',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuHeaderStyles();\n\n return (\n <div\n data-test-id={testId}\n className={cx(styles, className)}\n {...otherProps}\n >\n {children}\n </div>\n );\n};\n\nMenuListHeader.displayName = 'MenuListHeader';\n","import React from 'react';\nimport { cx } from 'emotion';\nimport type {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\n\nimport { getMenuFooterStyles } from './MenuList.styles';\n\nexport type MenuListFooterProps = PropsWithHTMLElement<CommonProps, 'div'>;\n\nexport const MenuListFooter: React.FC<ExpandProps<MenuListFooterProps>> = (\n props,\n) => {\n const {\n children,\n testId = 'cf-ui-menu-list-footer',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuFooterStyles();\n\n return (\n <div\n data-test-id={testId}\n className={cx(styles, className)}\n {...otherProps}\n >\n {children}\n </div>\n );\n};\n\nMenuListFooter.displayName = 'MenuListFooter';\n","import React, { useEffect, useRef } from 'react';\nimport { cx } from 'emotion';\nimport {\n CommonProps,\n mergeRefs,\n PolymorphicComponent,\n PolymorphicProps,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { useMenuContext } from '../MenuContext';\nimport { useId } from '@contentful/f36-core';\nimport { getMenuItemStyles } from './MenuItem.styles';\n\nconst MENU_ITEM_DEFAULT_TAG = 'button';\n\ninterface MenuItemInternalProps extends CommonProps {\n children?: React.ReactNode;\n as?: 'a' | 'button';\n\n /**\n * Sets focus on item\n */\n isInitiallyFocused?: boolean;\n}\n\nexport type MenuItemProps<\n E extends React.ElementType = typeof MENU_ITEM_DEFAULT_TAG\n> = PolymorphicProps<MenuItemInternalProps, E>;\n\nfunction _MenuItem<E extends React.ElementType = typeof MENU_ITEM_DEFAULT_TAG>(\n props: MenuItemProps<E>,\n ref: React.Ref<any>,\n) {\n const { testId, className, as, isInitiallyFocused, ...otherProps } = props;\n\n const id = useId(null, 'menu-item');\n const itemTestId = testId || `cf-ui-${id}`;\n const styles = getMenuItemStyles();\n\n const { getMenuItemProps, focusMenuItem } = useMenuContext();\n\n const itemRef = useRef<HTMLElement>(null);\n useEffect(() => {\n if (isInitiallyFocused && itemRef.current) {\n focusMenuItem(itemRef.current);\n }\n }, [isInitiallyFocused, focusMenuItem]);\n\n const Element = (as ?? MENU_ITEM_DEFAULT_TAG) as React.ElementType;\n\n return (\n <Element\n role=\"menuitem\"\n {...otherProps}\n {...getMenuItemProps(otherProps)}\n className={cx(styles.root, className)}\n data-test-id={itemTestId}\n ref={mergeRefs(itemRef, ref)}\n tabIndex={-1}\n >\n {props.children}\n </Element>\n );\n}\n\nexport const MenuItem: PolymorphicComponent<\n ExpandProps<MenuItemInternalProps>,\n typeof MENU_ITEM_DEFAULT_TAG\n> = React.forwardRef(_MenuItem);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuItemStyles = () => {\n return {\n root: css({\n display: 'block',\n width: '100%',\n background: 'none',\n border: 0,\n margin: 0,\n outline: 'none',\n fontSize: tokens.fontSizeM,\n lineHeight: tokens.lineHeightM,\n fontWeight: tokens.fontWeightNormal,\n position: 'relative',\n textAlign: 'left',\n padding: `${tokens.spacingXs} ${tokens.spacingM}`,\n wordBreak: 'break-word',\n whiteSpace: 'break-spaces',\n cursor: 'pointer',\n hyphens: 'auto',\n minWidth: '150px',\n textDecoration: 'none',\n color: tokens.gray800,\n\n '&:focus, &:hover': {\n backgroundColor: tokens.gray100,\n },\n '&:active': {\n backgroundColor: tokens.gray200,\n },\n '&:disabled': {\n opacity: 0.5,\n cursor: 'auto',\n },\n }),\n };\n};\n","import React from 'react';\nimport { Popover } from '@contentful/f36-popover';\nimport { useMenuContext } from '../MenuContext';\nimport { ExpandProps } from '@contentful/f36-core';\n\nexport interface MenuTriggerProps {\n children: React.ReactNode;\n}\n\nexport const MenuTrigger = (props: ExpandProps<MenuTriggerProps>) => {\n const child = React.Children.only(props.children) as any;\n const { getTriggerProps } = useMenuContext();\n\n return (\n <Popover.Trigger>\n {React.cloneElement(child, {\n ...getTriggerProps(child.props, child.ref),\n ['aria-haspopup']: 'menu',\n })}\n </Popover.Trigger>\n );\n};\n","import React from 'react';\nimport {\n CommonProps,\n PropsWithHTMLElement,\n ExpandProps,\n} from '@contentful/f36-core';\nimport { cx } from 'emotion';\nimport { getMenuDividerStyles } from './MenuDivider.styles';\n\nexport type MenuDividerProps = PropsWithHTMLElement<CommonProps, 'hr'>;\n\nexport const MenuDivider = (props: ExpandProps<MenuDividerProps>) => {\n const {\n children,\n testId = 'cf-ui-menu-divider',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuDividerStyles();\n\n return (\n <hr\n aria-orientation=\"horizontal\"\n data-test-id={testId}\n className={cx(styles, className)}\n {...otherProps}\n />\n );\n};\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuDividerStyles = () =>\n css({\n border: 'none',\n width: '100%',\n height: '1px',\n background: tokens.gray300,\n margin: `${tokens.spacingXs} 0`,\n });\n","import React from 'react';\nimport { cx } from 'emotion';\nimport { getMenuSectionTitleStyles } from './MenuSectionTitle.styles';\nimport {\n SectionHeading,\n SectionHeadingProps,\n} from '@contentful/f36-typography';\nimport { ExpandProps } from '@contentful/f36-core';\n\nexport type MenuSectionTitleProps = SectionHeadingProps;\n\nexport const MenuSectionTitle = (props: ExpandProps<MenuSectionTitleProps>) => {\n const {\n children,\n testId = 'cf-ui-menu-section-title',\n className,\n ...otherProps\n } = props;\n\n const styles = getMenuSectionTitleStyles();\n\n return (\n <SectionHeading\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\n aria-hidden=\"true\"\n testId={testId}\n className={cx(styles, className)}\n marginBottom=\"none\"\n {...otherProps}\n >\n {children}\n </SectionHeading>\n );\n};\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getMenuSectionTitleStyles = () =>\n css({\n textAlign: 'left',\n padding: `${tokens.spacingXs} ${tokens.spacingM}`,\n lineHeight: tokens.lineHeightM,\n\n 'hr + &': {\n marginTop: '-8px',\n },\n });\n","import React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { Menu, MenuProps } from '../Menu';\nimport { useMenuContext } from '../MenuContext';\nimport { SubmenuContextProvider, SubmenuContextType } from '../SubmenuContext';\nimport { mergeRefs } from '@contentful/f36-core';\n\nconst SUBMENU_OFFSET: [number, number] = [-8, 2];\n\nexport type SubmenuProps = Omit<\n MenuProps,\n | 'placement'\n | 'offset'\n | 'usePortal'\n | 'isOpen'\n | 'isAutoalignmentEnabled'\n | 'defaultIsOpen'\n>;\n\nexport const Submenu = (props: SubmenuProps) => {\n const { onClose, onOpen, ...otherProps } = props;\n\n const {\n isOpen: isParentMenuOpen,\n menuId,\n propsToPropagateToSubmenus,\n } = useMenuContext();\n\n const triggerRef = useRef<HTMLButtonElement>(null);\n const mouseLeaveTimerRef = useRef(null);\n\n const [isOpen, setIsOpen] = useState(false);\n const handleOpen = useCallback(() => {\n setIsOpen(true);\n window.clearTimeout(mouseLeaveTimerRef.current);\n\n onOpen?.();\n }, [onOpen]);\n const handleClose = useCallback(() => {\n setIsOpen(false);\n window.clearTimeout(mouseLeaveTimerRef.current);\n\n onClose?.();\n }, [onClose]);\n const closeAndFocusTrigger = useCallback(() => {\n handleClose();\n triggerRef.current?.focus({ preventScroll: true });\n }, [handleClose]);\n\n useEffect(() => {\n // close when parent menu closed\n if (isParentMenuOpen === false) {\n setIsOpen(false);\n }\n }, [isParentMenuOpen]);\n\n const contextValue: SubmenuContextType = useMemo(\n () => ({\n isOpen,\n getSubmenuListProps: (_props) => ({\n 'data-parent-menu': menuId,\n onMouseOver: (event) => {\n handleOpen();\n\n _props.onMouseOver?.(event);\n },\n onMouseLeave: (event) => {\n closeAndFocusTrigger();\n\n _props.onMouseLeave?.(event);\n },\n }),\n getSubmenuTriggerProps: (_props, _ref) => ({\n ref: mergeRefs(triggerRef, _ref),\n onKeyDown: (event) => {\n if (event.key === 'ArrowRight') {\n event.preventDefault();\n handleOpen();\n }\n\n _props.onKeyDown?.(event);\n },\n onMouseOver: (event) => {\n handleOpen();\n\n _props.onMouseOver?.(event);\n },\n onMouseLeave: (event) => {\n mouseLeaveTimerRef.current = window.setTimeout(\n closeAndFocusTrigger,\n 300,\n );\n\n _props.onMouseLeave?.(event);\n },\n }),\n }),\n [isOpen, menuId, handleOpen, closeAndFocusTrigger],\n );\n\n return (\n <SubmenuContextProvider value={contextValue}>\n <Menu\n {...propsToPropagateToSubmenus}\n {...otherProps}\n isOpen={isOpen}\n onClose={handleClose}\n onOpen={handleOpen}\n placement=\"right-start\"\n offset={SUBMENU_OFFSET}\n isAutoalignmentEnabled={false}\n />\n </SubmenuContextProvider>\n );\n};\n","import React from 'react';\nimport { MenuTrigger } from '../MenuTrigger/MenuTrigger';\nimport { MenuItem, MenuItemProps } from '../MenuItem/MenuItem';\nimport { useSubmenuContext } from '../SubmenuContext';\nimport { ChevronRightIcon } from '@contentful/f36-icons';\nimport { ExpandProps } from '@contentful/f36-core';\nimport { cx } from 'emotion';\nimport { getSubmenuTriggerStyles } from './SubmenuTrigger.styles';\n\nexport type SubmenuTriggerProps = Omit<\n MenuItemProps<'button'>,\n 'isInitiallyFocused' | 'as'\n>;\n\nconst _SubmenuTrigger = (\n props: ExpandProps<SubmenuTriggerProps>,\n ref: React.Ref<HTMLButtonElement>,\n) => {\n const { className, children } = props;\n const { getSubmenuTriggerProps, isOpen } = useSubmenuContext();\n\n const styles = getSubmenuTriggerStyles();\n\n return (\n <MenuTrigger>\n <MenuItem\n {...props}\n {...getSubmenuTriggerProps(props, ref)}\n className={cx(styles.root({ isActive: isOpen }), className)}\n >\n <span className={styles.content}>{children}</span>\n <ChevronRightIcon className={styles.icon} />\n </MenuItem>\n </MenuTrigger>\n );\n};\n\nexport const SubmenuTrigger = React.forwardRef(_SubmenuTrigger);\n","import { css } from 'emotion';\nimport tokens from '@contentful/f36-tokens';\n\nexport const getSubmenuTriggerStyles = () => {\n return {\n root: ({ isActive }) =>\n css({\n display: 'flex',\n alignItems: 'center',\n paddingRight: tokens.spacingXs,\n ...(isActive\n ? {\n backgroundColor: tokens.gray100,\n }\n : {}),\n }),\n content: css({\n marginRight: tokens.spacingM,\n }),\n icon: css({\n marginLeft: 'auto',\n fill: 'currentColor',\n }),\n };\n};\n"],"names":["Menu","MenuProps","MenuList","MenuListProps","MenuItem","MenuItemProps","MenuTrigger","MenuTriggerProps","MenuDivider","MenuDividerProps","MenuSectionTitle","MenuSectionTitleProps","Submenu","SubmenuProps","SubmenuTrigger","SubmenuTriggerProps","OriginalMenu","MenuListHeader","MenuListFooter","CompoundMenu","List","ListHeader","ListFooter","Item","Trigger","Divider","SectionTitle","React","useState","useCallback","useMemo","useRef","useEffect","mergeRefs","useId","useArrowKeyNavigation","Popover","PopoverProps","MenuContextProvider","MenuContextType","MENU_ITEMS_SELECTOR","Omit","isOpen","defaultIsOpen","onOpen","onClose","closeOnSelect","closeOnBlur","closeOnEsc","props","children","otherProps","handleOpen","handleClose","isControlled","useMenuOpenState","triggerRef","HTMLButtonElement","menuListRef","HTMLDivElement","menuId","focusedIndex","handleArrowsKeyDown","setFocusedIndex","itemsContainerRef","itemsSelector","current","menuItems","querySelectorAll","length","setTimeout","HTMLElement","focus","preventScroll","focusMenuItem","item","itemIndex","findIndex","menuItem","closeAndFocusTrigger","handleMenuListKeyDown","event","KeyboardEvent","key","preventDefault","stopPropagation","contextValue","getTriggerProps","_props","_ref","onClick","isFullyControlled","ref","getMenuListProps","onKeyDown","onBlur","relatedTarget","Node","targetIsMenu","contains","targetIsTrigger","targetIsSubmenu","parentElement","dataset","parentMenu","getMenuItemProps","isSubmenuTrigger","Boolean","target","getAttribute","propsToPropagateToSubmenus","UseMenuOpenStateProps","Pick","isOpenState","setIsOpen","undefined","isOpenValue","UseArrowKeyNavigationProps","MutableRefObject","keyType","initialFocusedIndex","ARROW_KEY_TYPES","vertical","prev","next","horizontal","container","items","lastItemIndex","focusFirstItem","focusLastItem","focusNextItem","focusPrevItem","keyToFnMap","fn","ComponentPropsWithRef","Ref","MenuContext","createContext","useMenuContext","context","useContext","Error","Provider","CommonProps","PropsWithHTMLElement","ExpandProps","useSubmenuContext","getMenuListStyles","MenuListInternalProps","ReactNode","assertChild","child","type","displayName","_MenuList","testId","className","submenuContext","header","ReactElement","footer","Children","forEach","appendChild","push","styles","hasStickyHeader","hasStickyFooter","extendedOtherProps","getSubmenuListProps","forwardRef","ComponentPropsWithoutRef","SubmenuContextType","getSubmenuTriggerProps","SubmenuContext","SubmenuContextProvider","tokens","getMenuHeaderStyles","position","top","left","backgroundColor","colorWhite","borderBottom","gray300","padding","spacingXs","zIndex","getMenuFooterStyles","bottom","borderTop","overflowY","paddingTop","paddingBottom","MenuListHeaderProps","FC","MenuListFooterProps","PolymorphicComponent","PolymorphicProps","getMenuItemStyles","MENU_ITEM_DEFAULT_TAG","MenuItemInternalProps","as","isInitiallyFocused","ElementType","E","_MenuItem","id","itemTestId","itemRef","Element","root","display","width","background","border","margin","outline","fontSize","fontSizeM","lineHeight","lineHeightM","fontWeight","fontWeightNormal","textAlign","spacingM","wordBreak","whiteSpace","cursor","hyphens","minWidth","textDecoration","color","gray800","gray100","gray200","opacity","only","cloneElement","getMenuDividerStyles","height","getMenuSectionTitleStyles","SectionHeading","SectionHeadingProps","marginTop","SUBMENU_OFFSET","isParentMenuOpen","mouseLeaveTimerRef","window","clearTimeout","onMouseOver","onMouseLeave","ChevronRightIcon","getSubmenuTriggerStyles","_SubmenuTrigger","isActive","content","icon","alignItems","paddingRight","marginRight"],"version":3,"file":"main.js.map"}