@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/module.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import $eBAEH$react, {useRef as $eBAEH$useRef, useEffect as $eBAEH$useEffect, useCallback as $eBAEH$useCallback, useMemo as $eBAEH$useMemo, useState as $eBAEH$useState} from "react";
2
2
  import {useId as $eBAEH$useId, mergeRefs as $eBAEH$mergeRefs} from "@contentful/f36-core";
3
- import {useArrowKeyNavigation as $eBAEH$useArrowKeyNavigation} from "@contentful/f36-utils";
4
3
  import {Popover as $eBAEH$Popover} from "@contentful/f36-popover";
4
+ import {jsx as $eBAEH$jsx, jsxs as $eBAEH$jsxs} from "react/jsx-runtime";
5
5
  import {cx as $eBAEH$cx, css as $eBAEH$css} from "emotion";
6
6
  import $eBAEH$contentfulf36tokens from "@contentful/f36-tokens";
7
7
  import {SectionHeading as $eBAEH$SectionHeading} from "@contentful/f36-typography";
@@ -11,6 +11,60 @@ import {ChevronRightIcon as $eBAEH$ChevronRightIcon} from "@contentful/f36-icons
11
11
 
12
12
 
13
13
 
14
+ const $d3c8cb97d16f8911$var$ARROW_KEY_TYPES = {
15
+ vertical: {
16
+ prev: 'ArrowUp',
17
+ next: 'ArrowDown'
18
+ },
19
+ horizontal: {
20
+ prev: 'ArrowLeft',
21
+ next: 'ArrowRight'
22
+ }
23
+ };
24
+ const $d3c8cb97d16f8911$export$e8d01079a7f85a7 = ({ itemsContainerRef: itemsContainerRef , itemsSelector: itemsSelector , keyType: keyType = 'vertical' })=>{
25
+ const [focusedIndex, setFocusedIndex] = $eBAEH$useState(0);
26
+ const handleArrowsKeyDown = $eBAEH$useCallback((event)=>{
27
+ const container = itemsContainerRef.current;
28
+ if (!container) return;
29
+ const items = container.querySelectorAll(itemsSelector);
30
+ if (items.length === 0) return;
31
+ const lastItemIndex = items.length - 1;
32
+ const focusFirstItem = ()=>setFocusedIndex(0)
33
+ ;
34
+ const focusLastItem = ()=>setFocusedIndex(lastItemIndex)
35
+ ;
36
+ const focusNextItem = ()=>{
37
+ if (focusedIndex === lastItemIndex) focusFirstItem();
38
+ else setFocusedIndex(focusedIndex + 1);
39
+ };
40
+ const focusPrevItem = ()=>{
41
+ if (focusedIndex === 0) focusLastItem();
42
+ else setFocusedIndex(focusedIndex - 1);
43
+ };
44
+ const keyToFnMap = {
45
+ [$d3c8cb97d16f8911$var$ARROW_KEY_TYPES[keyType].next]: focusNextItem,
46
+ [$d3c8cb97d16f8911$var$ARROW_KEY_TYPES[keyType].prev]: focusPrevItem
47
+ };
48
+ const fn = keyToFnMap[event.key];
49
+ if (fn) {
50
+ event.preventDefault();
51
+ fn();
52
+ }
53
+ }, [
54
+ focusedIndex,
55
+ itemsSelector,
56
+ itemsContainerRef,
57
+ keyType
58
+ ]);
59
+ return {
60
+ focusedIndex: focusedIndex,
61
+ handleArrowsKeyDown: handleArrowsKeyDown,
62
+ setFocusedIndex: setFocusedIndex
63
+ };
64
+ };
65
+
66
+
67
+
14
68
 
15
69
  const $c66e4ce1999d7489$var$MenuContext = $eBAEH$react.createContext(undefined);
16
70
  const $c66e4ce1999d7489$export$21c7ab35b39f78ec = ()=>{
@@ -28,7 +82,7 @@ function $815624c5c2e33d2d$export$d9b273488cd8ce6f(props) {
28
82
  const triggerRef = $eBAEH$useRef(null);
29
83
  const menuListRef = $eBAEH$useRef(null);
30
84
  const menuId = $eBAEH$useId(null, 'menu');
31
- const { focusedIndex: focusedIndex , handleArrowsKeyDown: handleArrowsKeyDown , setFocusedIndex: setFocusedIndex } = $eBAEH$useArrowKeyNavigation({
85
+ const { focusedIndex: focusedIndex , handleArrowsKeyDown: handleArrowsKeyDown , setFocusedIndex: setFocusedIndex } = $d3c8cb97d16f8911$export$e8d01079a7f85a7({
32
86
  itemsContainerRef: menuListRef,
33
87
  itemsSelector: $815624c5c2e33d2d$var$MENU_ITEMS_SELECTOR
34
88
  });
@@ -162,17 +216,19 @@ function $815624c5c2e33d2d$export$d9b273488cd8ce6f(props) {
162
216
  isControlled,
163
217
  onOpen
164
218
  ]);
165
- return(/*#__PURE__*/ $eBAEH$react.createElement($c66e4ce1999d7489$export$2cad3fd48ac06579, {
166
- value: contextValue
167
- }, /*#__PURE__*/ $eBAEH$react.createElement($eBAEH$Popover, {
168
- ...otherProps,
169
- isOpen: isOpen,
170
- onClose: handleClose,
171
- id: menuId,
172
- closeOnEsc: closeOnEsc,
173
- autoFocus: false,
174
- closeOnBlur: false
175
- }, children)));
219
+ return(/*#__PURE__*/ $eBAEH$jsx($c66e4ce1999d7489$export$2cad3fd48ac06579, {
220
+ value: contextValue,
221
+ children: /*#__PURE__*/ $eBAEH$jsx($eBAEH$Popover, {
222
+ ...otherProps,
223
+ isOpen: isOpen,
224
+ onClose: handleClose,
225
+ id: menuId,
226
+ closeOnEsc: closeOnEsc,
227
+ autoFocus: false,
228
+ closeOnBlur: false,
229
+ children: children
230
+ })
231
+ }));
176
232
  }
177
233
  const $815624c5c2e33d2d$var$useMenuOpenState = (props)=>{
178
234
  const { isOpen: isOpen , defaultIsOpen: defaultIsOpen , onOpen: onOpen , onClose: onClose } = props;
@@ -206,6 +262,7 @@ const $815624c5c2e33d2d$var$useMenuOpenState = (props)=>{
206
262
 
207
263
 
208
264
 
265
+
209
266
  const $5f642d41e782730b$var$SubmenuContext = $eBAEH$react.createContext(undefined);
210
267
  const $5f642d41e782730b$export$958673a266cbe049 = ()=>{
211
268
  const context = $eBAEH$react.useContext($5f642d41e782730b$var$SubmenuContext);
@@ -254,14 +311,16 @@ const $e1ca220e91193b42$export$10ce7613b0465b57 = (props)=>({
254
311
 
255
312
 
256
313
 
314
+
257
315
  const $042de7e263db0945$export$77451990ddb9d17c = (props)=>{
258
316
  const { children: children , testId: testId = 'cf-ui-menu-list-header' , className: className , ...otherProps } = props;
259
317
  const styles = $e1ca220e91193b42$export$396ce14bde1b7929();
260
- return(/*#__PURE__*/ $eBAEH$react.createElement("div", {
318
+ return(/*#__PURE__*/ $eBAEH$jsx("div", {
261
319
  "data-test-id": testId,
262
320
  className: $eBAEH$cx(styles, className),
263
- ...otherProps
264
- }, children));
321
+ ...otherProps,
322
+ children: children
323
+ }));
265
324
  };
266
325
  $042de7e263db0945$export$77451990ddb9d17c.displayName = 'MenuListHeader';
267
326
 
@@ -269,14 +328,16 @@ $042de7e263db0945$export$77451990ddb9d17c.displayName = 'MenuListHeader';
269
328
 
270
329
 
271
330
 
331
+
272
332
  const $5a5dcb1ec14dca9d$export$3e8a81e7ad0650f4 = (props)=>{
273
333
  const { children: children , testId: testId = 'cf-ui-menu-list-footer' , className: className , ...otherProps } = props;
274
334
  const styles = $e1ca220e91193b42$export$fd3dbc8a890448f();
275
- return(/*#__PURE__*/ $eBAEH$react.createElement("div", {
335
+ return(/*#__PURE__*/ $eBAEH$jsx("div", {
276
336
  "data-test-id": testId,
277
337
  className: $eBAEH$cx(styles, className),
278
- ...otherProps
279
- }, children));
338
+ ...otherProps,
339
+ children: children
340
+ }));
280
341
  };
281
342
  $5a5dcb1ec14dca9d$export$3e8a81e7ad0650f4.displayName = 'MenuListFooter';
282
343
 
@@ -310,13 +371,18 @@ const $511d273ec51beeae$var$_MenuList = (props, ref)=>{
310
371
  hasStickyFooter: Boolean(footer)
311
372
  });
312
373
  const extendedOtherProps = submenuContext ? submenuContext.getSubmenuListProps(otherProps) : otherProps;
313
- return(/*#__PURE__*/ $eBAEH$react.createElement($eBAEH$Popover.Content, {
374
+ return(/*#__PURE__*/ $eBAEH$jsxs($eBAEH$Popover.Content, {
314
375
  role: "menu",
315
376
  ...extendedOtherProps,
316
377
  ...getMenuListProps(extendedOtherProps, ref),
317
378
  className: $eBAEH$cx(styles.container, className),
318
- testId: testId
319
- }, header, items, footer));
379
+ testId: testId,
380
+ children: [
381
+ header,
382
+ items,
383
+ footer
384
+ ]
385
+ }));
320
386
  };
321
387
  const $511d273ec51beeae$export$d4c4e98c5044dc8 = /*#__PURE__*/ $eBAEH$react.forwardRef($511d273ec51beeae$var$_MenuList);
322
388
 
@@ -330,6 +396,7 @@ const $511d273ec51beeae$export$d4c4e98c5044dc8 = /*#__PURE__*/ $eBAEH$react.forw
330
396
 
331
397
 
332
398
 
399
+
333
400
  const $0cc53a77e90ceec6$export$adaad53e003c74d0 = ()=>{
334
401
  return {
335
402
  root: /*#__PURE__*/ $eBAEH$css({
@@ -382,15 +449,16 @@ function $ea346231d142cd67$var$_MenuItem(props, ref) {
382
449
  focusMenuItem
383
450
  ]);
384
451
  const Element = as !== null && as !== void 0 ? as : $ea346231d142cd67$var$MENU_ITEM_DEFAULT_TAG;
385
- return(/*#__PURE__*/ $eBAEH$react.createElement(Element, {
452
+ return(/*#__PURE__*/ $eBAEH$jsx(Element, {
386
453
  role: "menuitem",
387
454
  ...otherProps,
388
455
  ...getMenuItemProps(otherProps),
389
456
  className: $eBAEH$cx(styles.root, className),
390
457
  "data-test-id": itemTestId,
391
458
  ref: $eBAEH$mergeRefs(itemRef, ref),
392
- tabIndex: -1
393
- }, props.children));
459
+ tabIndex: -1,
460
+ children: props.children
461
+ }));
394
462
  }
395
463
  const $ea346231d142cd67$export$2ce376c2cc3355c8 = /*#__PURE__*/ $eBAEH$react.forwardRef($ea346231d142cd67$var$_MenuItem);
396
464
 
@@ -398,13 +466,16 @@ const $ea346231d142cd67$export$2ce376c2cc3355c8 = /*#__PURE__*/ $eBAEH$react.for
398
466
 
399
467
 
400
468
 
469
+
401
470
  const $94016b6f927b504d$export$27d2ad3c5815583e = (props)=>{
402
471
  const child = $eBAEH$react.Children.only(props.children);
403
472
  const { getTriggerProps: getTriggerProps } = $c66e4ce1999d7489$export$21c7ab35b39f78ec();
404
- return(/*#__PURE__*/ $eBAEH$react.createElement($eBAEH$Popover.Trigger, null, /*#__PURE__*/ $eBAEH$react.cloneElement(child, {
405
- ...getTriggerProps(child.props, child.ref),
406
- ['aria-haspopup']: 'menu'
407
- })));
473
+ return(/*#__PURE__*/ $eBAEH$jsx($eBAEH$Popover.Trigger, {
474
+ children: /*#__PURE__*/ $eBAEH$react.cloneElement(child, {
475
+ ...getTriggerProps(child.props, child.ref),
476
+ ['aria-haspopup']: 'menu'
477
+ })
478
+ }));
408
479
  };
409
480
 
410
481
 
@@ -412,6 +483,7 @@ const $94016b6f927b504d$export$27d2ad3c5815583e = (props)=>{
412
483
 
413
484
 
414
485
 
486
+
415
487
  const $90fd1006b83bc4dd$export$4605da6f9a8ef405 = ()=>/*#__PURE__*/ $eBAEH$css({
416
488
  border: 'none',
417
489
  width: '100%',
@@ -425,7 +497,7 @@ const $90fd1006b83bc4dd$export$4605da6f9a8ef405 = ()=>/*#__PURE__*/ $eBAEH$css({
425
497
  const $a6a319b65dbbd900$export$acb07b4664ac227c = (props)=>{
426
498
  const { children: children , testId: testId = 'cf-ui-menu-divider' , className: className , ...otherProps } = props;
427
499
  const styles = $90fd1006b83bc4dd$export$4605da6f9a8ef405();
428
- return(/*#__PURE__*/ $eBAEH$react.createElement("hr", {
500
+ return(/*#__PURE__*/ $eBAEH$jsx("hr", {
429
501
  "aria-orientation": "horizontal",
430
502
  "data-test-id": testId,
431
503
  className: $eBAEH$cx(styles, className),
@@ -438,6 +510,7 @@ const $a6a319b65dbbd900$export$acb07b4664ac227c = (props)=>{
438
510
 
439
511
 
440
512
 
513
+
441
514
  const $7f43fb9a4d140447$export$2698fa8b3a0a79e6 = ()=>/*#__PURE__*/ $eBAEH$css({
442
515
  textAlign: 'left',
443
516
  padding: `${$eBAEH$contentfulf36tokens.spacingXs} ${$eBAEH$contentfulf36tokens.spacingM}`,
@@ -453,7 +526,7 @@ const $7f43fb9a4d140447$export$2698fa8b3a0a79e6 = ()=>/*#__PURE__*/ $eBAEH$css({
453
526
  const $7c6385c774644580$export$5d1e6c648985631e = (props)=>{
454
527
  const { children: children , testId: testId = 'cf-ui-menu-section-title' , className: className , ...otherProps } = props;
455
528
  const styles = $7f43fb9a4d140447$export$2698fa8b3a0a79e6();
456
- return(/*#__PURE__*/ $eBAEH$react.createElement($eBAEH$SectionHeading // Techincally, menus cannot contain headings according to ARIA.
529
+ return(/*#__PURE__*/ $eBAEH$jsx($eBAEH$SectionHeading // Techincally, menus cannot contain headings according to ARIA.
457
530
  , {
458
531
  // We hide the heading from assistive technology, and only use it
459
532
  // as a label
@@ -461,8 +534,9 @@ const $7c6385c774644580$export$5d1e6c648985631e = (props)=>{
461
534
  testId: testId,
462
535
  className: $eBAEH$cx(styles, className),
463
536
  marginBottom: "none",
464
- ...otherProps
465
- }, children));
537
+ ...otherProps,
538
+ children: children
539
+ }));
466
540
  };
467
541
 
468
542
 
@@ -471,6 +545,7 @@ const $7c6385c774644580$export$5d1e6c648985631e = (props)=>{
471
545
 
472
546
 
473
547
 
548
+
474
549
  const $407bba9f98210b35$var$SUBMENU_OFFSET = [
475
550
  -8,
476
551
  2
@@ -558,18 +633,19 @@ const $407bba9f98210b35$export$49229ebf838c159b = (props)=>{
558
633
  handleOpen,
559
634
  closeAndFocusTrigger
560
635
  ]);
561
- return(/*#__PURE__*/ $eBAEH$react.createElement($5f642d41e782730b$export$81b3dbd1f003f0c7, {
562
- value: contextValue
563
- }, /*#__PURE__*/ $eBAEH$react.createElement($815624c5c2e33d2d$export$d9b273488cd8ce6f, {
564
- ...propsToPropagateToSubmenus,
565
- ...otherProps,
566
- isOpen: isOpen,
567
- onClose: handleClose,
568
- onOpen: handleOpen,
569
- placement: "right-start",
570
- offset: $407bba9f98210b35$var$SUBMENU_OFFSET,
571
- isAutoalignmentEnabled: false
572
- })));
636
+ return(/*#__PURE__*/ $eBAEH$jsx($5f642d41e782730b$export$81b3dbd1f003f0c7, {
637
+ value: contextValue,
638
+ children: /*#__PURE__*/ $eBAEH$jsx($815624c5c2e33d2d$export$d9b273488cd8ce6f, {
639
+ ...propsToPropagateToSubmenus,
640
+ ...otherProps,
641
+ isOpen: isOpen,
642
+ onClose: handleClose,
643
+ onOpen: handleOpen,
644
+ placement: "right-start",
645
+ offset: $407bba9f98210b35$var$SUBMENU_OFFSET,
646
+ isAutoalignmentEnabled: false
647
+ })
648
+ }));
573
649
  };
574
650
 
575
651
 
@@ -581,6 +657,7 @@ const $407bba9f98210b35$export$49229ebf838c159b = (props)=>{
581
657
 
582
658
 
583
659
 
660
+
584
661
  const $f5b15ecf1bfa860d$export$ce276565acbba1c9 = ()=>{
585
662
  return {
586
663
  root: ({ isActive: isActive })=>/*#__PURE__*/ $eBAEH$css({
@@ -608,17 +685,24 @@ const $423d6b42721d64f8$var$_SubmenuTrigger = (props, ref)=>{
608
685
  const { className: className , children: children } = props;
609
686
  const { getSubmenuTriggerProps: getSubmenuTriggerProps , isOpen: isOpen } = $5f642d41e782730b$export$958673a266cbe049();
610
687
  const styles = $f5b15ecf1bfa860d$export$ce276565acbba1c9();
611
- return(/*#__PURE__*/ $eBAEH$react.createElement($94016b6f927b504d$export$27d2ad3c5815583e, null, /*#__PURE__*/ $eBAEH$react.createElement($ea346231d142cd67$export$2ce376c2cc3355c8, {
612
- ...props,
613
- ...getSubmenuTriggerProps(props, ref),
614
- className: $eBAEH$cx(styles.root({
615
- isActive: isOpen
616
- }), className)
617
- }, /*#__PURE__*/ $eBAEH$react.createElement("span", {
618
- className: styles.content
619
- }, children), /*#__PURE__*/ $eBAEH$react.createElement($eBAEH$ChevronRightIcon, {
620
- className: styles.icon
621
- }))));
688
+ return(/*#__PURE__*/ $eBAEH$jsx($94016b6f927b504d$export$27d2ad3c5815583e, {
689
+ children: /*#__PURE__*/ $eBAEH$jsxs($ea346231d142cd67$export$2ce376c2cc3355c8, {
690
+ ...props,
691
+ ...getSubmenuTriggerProps(props, ref),
692
+ className: $eBAEH$cx(styles.root({
693
+ isActive: isOpen
694
+ }), className),
695
+ children: [
696
+ /*#__PURE__*/ $eBAEH$jsx("span", {
697
+ className: styles.content,
698
+ children: children
699
+ }),
700
+ /*#__PURE__*/ $eBAEH$jsx($eBAEH$ChevronRightIcon, {
701
+ className: styles.icon
702
+ })
703
+ ]
704
+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AAM,CAAC6F,IAAR;;AAInC,CArBD;AAuBO,KAAA,CAAMnO,yCAAc,iBAAGa,YAAK,CAAC+H,UAAN,CAAiBoF,qCAAjB;;;AhBbvB,KAAA,CAAM9O,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/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":"module.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,CAANA;IAFU,CAAA;AALU,CAAxB;AAWO,KAAA,CAAMzF,wCAAqB,IAAI,CAAtC,oBACE6B,iBADoC,kBAEpCC,aAFoC,YAGpCsD,OAAO,GAAG,CAAVA,WACCF,CAJkC,GAIH,CAJI;IAKpC,KAAA,EAAOxD,YAAD,EAAeE,eAAf,IAAkCnC,eAAQ,CAAS,CAAT;IAEhD,KAAA,CAAMkC,mBAAmB,GAAGjC,kBAAW,EACpCoD,KAAD,GAAgC,CADlC;QAEI,KAAA,CAAM6C,SAAS,GAAG9D,iBAAiB,CAACE,OAApC;QACA,EAAA,GAAK4D,SAAL,EAAgB,MAAhB;QAEA,KAAA,CAAMC,KAAK,GAAGD,SAAS,CAAC1D,gBAAV,CAA2BH,aAA3B;QACd,EAAA,EAAI8D,KAAK,CAAC1D,MAAN,KAAiB,CAArB,EAAwB,MAAxB;QAEA,KAAA,CAAM2D,aAAa,GAAGD,KAAK,CAAC1D,MAAN,GAAe,CAArC;QAEA,KAAA,CAAM4D,cAAc,OAASlE,eAAe,CAAC,CAAD;;QAC5C,KAAA,CAAMmE,aAAa,OAASnE,eAAe,CAACiE,aAAD;;QAC3C,KAAA,CAAMG,aAAa,OAAS,CAA5B;YACE,EAAA,EAAItE,Y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e,IACnB9M,KADsB,EAEtB2C,GAFsB,GAGnB,CAHL;IAIE,KAAA,CAAM,CAAN,YAAQiE,SAAF,aAAa3G,QAAAA,EAAb,CAAA,GAA0BD,KAAhC;IACA,KAAA,CAAM,CAAN,yBAAQ6H,sBAAF,WAA0BpI,MAAAA,EAA1B,CAAA,GAAqCyG,yCAAiB;IAE5D,KAAA,CAAMmB,MAAM,GAAGwF,yCAAuB;IAEtC,MAAA,0BACG,yCAAD;4CACG,yCAAD;eACM7M,KAAJ;eACI6H,sBAAsB,CAAC7H,KAAD,EAAQ2C,GAAR;YAC1B,SAAA,EAAW,SAAA,CAAG0E,MAAM,CAAC8C,IAAP,CAAY,CAHlC;gBAGoC4C,QAAQ,EAAEtN,MAAVsN;YAAF,CAAZ,GAAmCnG,SAAtC;;yCAEV,CAAD;oBAAM,SAAA,EAAWS,MAAM,CAAC2F,OAAR;8BAAkB/M,QAAD;;yCAChC,uBAAD;oBAAkB,SAAA,EAAWoH,MAAM,CAAC4F,IAAR;;;;;AAInC,CArBD;AAuBO,KAAA,CAAMpP,yCAAc,iBAAGa,YAAK,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":"module.js.map"}