@qualtrics/ui-react 2.20.0 → 2.21.0

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.
Files changed (97) hide show
  1. package/CHANGELOG.md +10 -38
  2. package/dist/__shared/cjs/{index-579c4690.js → index-0ae99de2.js} +3 -3
  3. package/dist/__shared/cjs/{index-90d4069b.js → index-201e8786.js} +188 -260
  4. package/dist/components/Accordion/Accordion2.js +3 -3
  5. package/dist/components/Button/Button.js +3 -3
  6. package/dist/components/ButtonGroup/ButtonGroup2.js +3 -3
  7. package/dist/components/Checkbox/Checkbox2.js +3 -3
  8. package/dist/components/Checkbox/VisualCheckbox2.js +3 -3
  9. package/dist/components/ColorPicker/Alpha.js +0 -7
  10. package/dist/components/ColorPicker/ColorPicker.js +5 -1
  11. package/dist/components/ColorPicker/ColorPicker2.js +3 -3
  12. package/dist/components/ColorPicker/ColorPickerFlyout.js +9 -4
  13. package/dist/components/ColorPicker/Hue.js +0 -7
  14. package/dist/components/ColorPicker/Palette.js +6 -4
  15. package/dist/components/ColorPicker/Saturation.js +0 -9
  16. package/dist/components/Combobox/Combobox.js +8 -6
  17. package/dist/components/Combobox/Combobox2.js +3 -3
  18. package/dist/components/ConfigPane/ConfigPane2.js +3 -3
  19. package/dist/components/Divider/Divider2.js +3 -3
  20. package/dist/components/Dropdown/Dropdown.js +0 -5
  21. package/dist/components/Dropdown/Dropdown2.js +3 -3
  22. package/dist/components/Dropdown/DropdownOption.js +2 -5
  23. package/dist/components/Dropdown/DropdownSearch.js +2 -5
  24. package/dist/components/FilePicker/FilePicker.js +0 -7
  25. package/dist/components/FilePicker/FilePicker2.js +3 -3
  26. package/dist/components/FormField/Caption.js +3 -3
  27. package/dist/components/FormField/FormField2.js +3 -3
  28. package/dist/components/FullScreenTakeover/FullScreenTakeover2.js +3 -3
  29. package/dist/components/IconButton/IconButton2.js +3 -3
  30. package/dist/components/InlineInput/InlineInput2.js +3 -3
  31. package/dist/components/Input/Input2.js +3 -3
  32. package/dist/components/InputGroup/InputGroup2.js +3 -3
  33. package/dist/components/Label/Label2.js +3 -3
  34. package/dist/components/Link/Link2.js +3 -3
  35. package/dist/components/LoadingSpinner/LoadingSpinner2.js +3 -3
  36. package/dist/components/LogicEditor/LogicEditor2.js +3 -3
  37. package/dist/components/Modal/Modal2.js +3 -3
  38. package/dist/components/NewMenu/NewMenu.js +3 -3
  39. package/dist/components/NewMenu/parts/ArrowNav/ArrowNav.js +9 -8
  40. package/dist/components/NumberStepper/NumberStepper2.js +3 -3
  41. package/dist/components/PageLayout/PageLayout.js +3 -3
  42. package/dist/components/Pagination/Pagination2.js +3 -3
  43. package/dist/components/Popover/Popover2.js +3 -3
  44. package/dist/components/QuickSearch/QuickSearch2.js +3 -3
  45. package/dist/components/Radio/Radio2.js +3 -3
  46. package/dist/components/SearchInput/SearchInput2.js +3 -3
  47. package/dist/components/SidebarNav/SidebarNav2.js +3 -3
  48. package/dist/components/Slider/Slider2.js +3 -3
  49. package/dist/components/Switch/Switch2.js +3 -3
  50. package/dist/components/Table/Table2.js +3 -3
  51. package/dist/components/Tabs/Tabs2.js +3 -3
  52. package/dist/components/Tooltip/Tooltip.js +6 -4
  53. package/dist/components/Tooltip/Tooltip2.js +3 -3
  54. package/dist/components/deprecated_ColorPicker/ColorPicker2.js +3 -3
  55. package/dist/components/deprecated_NumberStepper/NumberStepper2.js +3 -3
  56. package/dist/components/deprecated_Tabs/Tabs2.js +3 -3
  57. package/dist/components/deprecated_Toolbar/Toolbar2.js +3 -3
  58. package/dist/components/deprecated_Toolbar/ToolbarPanels.js +0 -27
  59. package/dist/hooks/useEventListener/useEventListener.js +3 -0
  60. package/dist/hooks/useOverlay/useOverlay.js +5 -2
  61. package/dist/hooks/useOverlay/useOverlay2.js +3 -3
  62. package/dist/hooks/useScreenReaderAnnouncement/useScreenReaderAnnouncement2.js +3 -3
  63. package/dist/icons/Icon.js +3 -3
  64. package/dist/icons/index.js +1 -1
  65. package/dist/index.d.ts +3 -1
  66. package/dist/index.es.js +1 -7
  67. package/dist/index.js +4 -7
  68. package/dist/next/AdvancedTable/AdvancedTable.js +33 -45
  69. package/dist/next/AdvancedTable/AdvancedTable2.js +3 -3
  70. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput.js +1 -2
  71. package/dist/next/CollapsibleSearchInput/CollapsibleSearchInput2.js +3 -3
  72. package/dist/next/Combobox/Combobox2.js +3 -3
  73. package/dist/next/Drawer/Drawer2.js +3 -3
  74. package/dist/next/FilterAnchor/FilterAnchor2.js +3 -3
  75. package/dist/next/Input/Input2.js +3 -3
  76. package/dist/next/Menu/Menu.js +6 -2
  77. package/dist/next/Menu/Menu2.js +3 -3
  78. package/dist/next/Menu/MenuItem.js +10 -4
  79. package/dist/next/Menu/MenuPane.js +55 -37
  80. package/dist/next/Menu/MenuSearch.js +16 -71
  81. package/dist/next/Menu/SubMenu.js +54 -41
  82. package/dist/next/Menu/constants.js +5 -1
  83. package/dist/next/Menu/useMutationObserver.js +17 -0
  84. package/dist/next/Menu/usePaneSearch.js +97 -7
  85. package/dist/next/PhoneNumberInput/PhoneNumberInput2.js +3 -3
  86. package/dist/next/SplitButton/SplitButton2.js +3 -3
  87. package/dist/next/TimePicker/TimePicker2.js +3 -3
  88. package/dist/next/ToggleButton/styles.js +3 -3
  89. package/dist/next/index.d.ts +1 -0
  90. package/dist/next/index.js +374 -284
  91. package/dist/utils/Flyout/Flyout2.js +3 -3
  92. package/dist/utils/index.js +0 -1
  93. package/icons/package.json +1 -0
  94. package/next/package.json +2 -1
  95. package/package.json +3 -3
  96. package/dist/utils/keyboardUser/index.js +0 -1
  97. package/dist/utils/keyboardUser/keyboardUser.js +0 -30
@@ -1,8 +1,8 @@
1
1
  import styleInject from './../../__node_modules/style-inject/dist/style-inject.es.js';
2
2
 
3
- var css_248z = "._XWalP{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._XWalP>._TBIBJ{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._XWalP>._TBIBJ:hover:not([aria-disabled=true]){background-color:#f5f5f5}._XWalP>._TBIBJ:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._XWalP>._TBIBJ+._217EJ{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._XWalP>._TBIBJ[data-state=open]+._217EJ{transform:rotate(-180deg) translateY(50%)}._XWalP>._TBIBJ[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._XWalP>._TBIBJ[aria-disabled=true]+._217EJ{fill:#515559;opacity:.4}._OtqSt>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._OtqSt>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._lA5c4{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._lA5c4._09TTD{padding-top:0}._lA5c4._6uOho{margin-left:30px;opacity:0;pointer-events:none}._lA5c4._X3JdL{margin-left:-30px;pointer-events:none}._AMMxy{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._AMMxy._WbYY2{cursor:unset}._AMMxy ._-FGT-{fill:#32363a;margin-right:4px}._AMMxy[data-highlighted]{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._AMMxy[aria-disabled=true]{cursor:not-allowed;opacity:.65}._AMMxy._Fz048{padding-right:32px}._AMMxy._Fz048 ._217EJ{position:absolute;height:100%;right:3px;fill:#515559}._AMMxy._fFAl5{pointer-events:none}._MSrlX{position:sticky;top:0;padding-top:4px;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._MSrlX>._ROoCs{padding:4px 8px 8px;border-radius:4px 4px 0 0}._MSrlX>._ROoCs>._ZjAxE{width:100%}._MSrlX>._ROoCs._fFAl5{pointer-events:none}";
4
- var styles = {"buttonContainer":"_XWalP","button":"_TBIBJ","rightIcon":"_217EJ","maskContainer":"_OtqSt","flyout":"_lA5c4","containsStickyBox":"_09TTD","animatedRight":"_6uOho","animatedLeft":"_X3JdL","menuItem":"_AMMxy","noItems":"_WbYY2","backIcon":"_-FGT-","subMenu":"_Fz048","unresponsive":"_fFAl5","stickyBox":"_MSrlX","searchBox":"_ROoCs","searchInput":"_ZjAxE"};
5
- var stylesheet="._XWalP{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._XWalP>._TBIBJ{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._XWalP>._TBIBJ:hover:not([aria-disabled=true]){background-color:#f5f5f5}._XWalP>._TBIBJ:focus{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._XWalP>._TBIBJ+._217EJ{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._XWalP>._TBIBJ[data-state=open]+._217EJ{transform:rotate(-180deg) translateY(50%)}._XWalP>._TBIBJ[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._XWalP>._TBIBJ[aria-disabled=true]+._217EJ{fill:#515559;opacity:.4}._OtqSt>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._OtqSt>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._lA5c4{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._lA5c4._09TTD{padding-top:0}._lA5c4._6uOho{margin-left:30px;opacity:0;pointer-events:none}._lA5c4._X3JdL{margin-left:-30px;pointer-events:none}._AMMxy{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._AMMxy._WbYY2{cursor:unset}._AMMxy ._-FGT-{fill:#32363a;margin-right:4px}._AMMxy[data-highlighted]{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._AMMxy[aria-disabled=true]{cursor:not-allowed;opacity:.65}._AMMxy._Fz048{padding-right:32px}._AMMxy._Fz048 ._217EJ{position:absolute;height:100%;right:3px;fill:#515559}._AMMxy._fFAl5{pointer-events:none}._MSrlX{position:sticky;top:0;padding-top:4px;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._MSrlX>._ROoCs{padding:4px 8px 8px;border-radius:4px 4px 0 0}._MSrlX>._ROoCs>._ZjAxE{width:100%}._MSrlX>._ROoCs._fFAl5{pointer-events:none}";
3
+ var css_248z = "._pkAUS{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._pkAUS>._5UFlu{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._pkAUS>._5UFlu:hover:not([aria-disabled=true]){background-color:#f5f5f5}._pkAUS>._5UFlu.focus-visible,._pkAUS>._5UFlu:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._pkAUS>._5UFlu+._4UUre{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._pkAUS>._5UFlu[data-state=open]+._4UUre{transform:rotate(-180deg) translateY(50%)}._pkAUS>._5UFlu[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._pkAUS>._5UFlu[aria-disabled=true]+._4UUre{fill:#515559;opacity:.4}._f5BWI>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._f5BWI>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._90IdX{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._90IdX._G3bwe{margin-left:30px;opacity:0}._90IdX._aEjkI{margin-left:-30px}._3juCB{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._3juCB._ecSts{cursor:unset}._3juCB ._HjO31{fill:#32363a;margin-right:4px}._3juCB:focus,._3juCB:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._3juCB[aria-disabled=true]{cursor:not-allowed;opacity:.65}._3juCB._zd1Fh{padding-right:32px}._3juCB._zd1Fh ._4UUre{position:absolute;height:100%;right:3px;fill:#515559}._3juCB._3cWmO{pointer-events:none}._wGUhl{position:sticky;top:0;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._wGUhl._v1Svy{padding-top:49px}._Vx0A5{z-index:1;pointer-events:none;position:fixed;left:0;top:0}._kzTH1{position:absolute;background-color:#fff;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;overflow:hidden;opacity:1;transition:opacity .35s}._kzTH1._aEjkI{opacity:0}._kzTH1._aEjkI>._T91Gm{margin-left:-30px}._kzTH1._G3bwe{opacity:0}._kzTH1._G3bwe>._T91Gm{margin-left:30px}._kzTH1>._T91Gm{transition:margin-left .35s;width:100%}._kzTH1._3cWmO{pointer-events:none}body.keyboard-user ._3juCB:hover:not(:focus){background-color:#fff;box-shadow:none}";
4
+ var styles = {"buttonContainer":"_pkAUS","button":"_5UFlu","rightIcon":"_4UUre","maskContainer":"_f5BWI","flyout":"_90IdX","animatedRight":"_G3bwe","animatedLeft":"_aEjkI","menuItem":"_3juCB","noItems":"_ecSts","backIcon":"_HjO31","subMenu":"_zd1Fh","unresponsive":"_3cWmO","stickyBox":"_wGUhl","isSearchable":"_v1Svy","searchBoxesContainer":"_Vx0A5","searchBox":"_kzTH1","searchInput":"_T91Gm"};
5
+ var stylesheet="._pkAUS{position:relative;display:inline-flex;height:36px;min-width:60px;cursor:pointer}._pkAUS>._5UFlu{cursor:unset;width:100%;height:100%;padding:0 28px 0 12px;border-radius:4px;white-space:nowrap;line-height:20px;font-size:14px;text-align:left;outline:none;border:none;box-shadow:inset 0 0 0 1px #898989;color:#515559;background-color:#fafafa;overflow:hidden;text-overflow:ellipsis}._pkAUS>._5UFlu:hover:not([aria-disabled=true]){background-color:#f5f5f5}._pkAUS>._5UFlu.focus-visible,._pkAUS>._5UFlu:focus-visible{background-color:#fafafa;box-shadow:0 0 0 2px #fff,0 0 0 4px #0a3f88}._pkAUS>._5UFlu+._4UUre{fill:#515559;position:absolute;pointer-events:none;right:4px;top:50%;transform:translateY(-50%)}._pkAUS>._5UFlu[data-state=open]+._4UUre{transform:rotate(-180deg) translateY(50%)}._pkAUS>._5UFlu[aria-disabled=true]{box-shadow:inset 0 0 0 1px #e5e5e5;color:#74777a;cursor:not-allowed}._pkAUS>._5UFlu[aria-disabled=true]+._4UUre{fill:#515559;opacity:.4}._f5BWI>[data-radix-popper-content-wrapper]{overflow:hidden;background-color:#fff;width:var(--radix-dropdown-menu-trigger-width);min-width:200px!important;box-shadow:0 8px 20px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);border-radius:4px;z-index:1!important}._f5BWI>[data-radix-popper-content-wrapper] [data-radix-popper-content-wrapper]{transform:translateZ(0)!important}._90IdX{margin:0;padding:4px 0;background:#fff;transition:.35s;opacity:1;overflow:auto;width:var(--radix-dropdown-menu-trigger-width);min-width:200px;max-height:350px}._90IdX._G3bwe{margin-left:30px;opacity:0}._90IdX._aEjkI{margin-left:-30px}._3juCB{position:relative;padding:10px 12px;min-height:40px;display:flex;flex-direction:row;align-items:center;cursor:pointer;outline:none;word-break:break-word;font-size:14px;color:#32363a;width:100%}._3juCB._ecSts{cursor:unset}._3juCB ._HjO31{fill:#32363a;margin-right:4px}._3juCB:focus,._3juCB:hover{background-color:#efefef;box-shadow:inset 0 0 0 2px #0a3f88,inset 0 0 0 4px #fff;border-radius:6px}._3juCB[aria-disabled=true]{cursor:not-allowed;opacity:.65}._3juCB._zd1Fh{padding-right:32px}._3juCB._zd1Fh ._4UUre{position:absolute;height:100%;right:3px;fill:#515559}._3juCB._3cWmO{pointer-events:none}._wGUhl{position:sticky;top:0;background-color:#fff;z-index:1;border-bottom:1px solid #e8e8e8}._wGUhl._v1Svy{padding-top:49px}._Vx0A5{z-index:1;pointer-events:none;position:fixed;left:0;top:0}._kzTH1{position:absolute;background-color:#fff;padding:8px;border-radius:4px 4px 0 0;pointer-events:auto;overflow:hidden;opacity:1;transition:opacity .35s}._kzTH1._aEjkI{opacity:0}._kzTH1._aEjkI>._T91Gm{margin-left:-30px}._kzTH1._G3bwe{opacity:0}._kzTH1._G3bwe>._T91Gm{margin-left:30px}._kzTH1>._T91Gm{transition:margin-left .35s;width:100%}._kzTH1._3cWmO{pointer-events:none}body.keyboard-user ._3juCB:hover:not(:focus){background-color:#fff;box-shadow:none}";
6
6
  styleInject(css_248z);
7
7
 
8
8
  export { styles as default, stylesheet };
@@ -3,12 +3,12 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
3
3
  import React__default, { useRef, useMemo } from 'react';
4
4
  import { Item } from '@radix-ui/react-dropdown-menu';
5
5
  import classNames from 'classnames';
6
+ import { useFocusVisible } from '@react-aria/interactions';
6
7
  import styles from './Menu2.js';
7
8
  import { usePaneContext } from './MenuContext.js';
8
9
  import '../../utils/index.js';
9
10
  import { DATA_TESTID_SUFFIXES, KEYS } from './constants.js';
10
11
  import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
11
- import { getIsKeyboardUser } from '../../utils/keyboardUser/keyboardUser.js';
12
12
  import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
13
13
 
14
14
  const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
@@ -29,16 +29,22 @@ const MenuItem = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
29
29
  isSearchFilteringDisabled,
30
30
  isInteractive,
31
31
  closeSubmenu,
32
- flyoutRef
32
+ flyoutRef,
33
+ stickyBoxRef
33
34
  } = usePaneContext(itemRef);
35
+ const {
36
+ isFocusVisible
37
+ } = useFocusVisible({
38
+ isTextInput: true
39
+ });
34
40
  const dataTestId = getSubDataTestId(menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM), String(index));
35
41
  const isVisible = useMemo(() => {
36
42
  const searchMatcher = label ?? (typeof children === 'string' ? children : undefined);
37
43
  return isSearchFilteringDisabled || !searchValue || searchMatcher?.toLowerCase().includes(searchValue.toLowerCase());
38
44
  }, [children, searchValue, label, isSearchFilteringDisabled]);
39
45
  const handleFocus = () => {
40
- if (itemRef.current && flyoutRef.current && getIsKeyboardUser()) {
41
- const stickyBoxHeight = 93;
46
+ if (itemRef.current && flyoutRef.current && isFocusVisible) {
47
+ const stickyBoxHeight = stickyBoxRef.current?.clientHeight ?? 0;
42
48
 
43
49
  // if the top of the focused menu item is beneath the sticky box
44
50
  if (itemRef.current.offsetTop < flyoutRef.current.scrollTop + stickyBoxHeight) {
@@ -1,5 +1,4 @@
1
1
  import _extends from '@babel/runtime-corejs3/helpers/extends';
2
- import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
3
2
  import React__default, { useState, useRef, useMemo } from 'react';
4
3
  import { Portal, Content } from '@radix-ui/react-dropdown-menu';
5
4
  import classNames from 'classnames';
@@ -7,14 +6,15 @@ import styles from './Menu2.js';
7
6
  import { usePortalTarget } from '../../components/UIProvider/PortalTargetContext.js';
8
7
  import { useMenuContext, PaneContextProvider } from './MenuContext.js';
9
8
  import '../../utils/index.js';
10
- import { DATA_TESTID_SUFFIXES, KEYS } from './constants.js';
9
+ import { DATA_TESTID_SUFFIXES } from './constants.js';
11
10
  import MenuSearch from './MenuSearch.js';
12
11
  import usePaneSearch from './usePaneSearch.js';
13
12
  import '../../hooks/index.js';
14
- import { useDidUpdate } from '../../hooks/useDidUpdate/useDidUpdate.js';
13
+ import useMutationObserver from './useMutationObserver.js';
14
+ import useOverlay from '../../hooks/useOverlay/useOverlay.js';
15
15
  import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
16
- import useEventListener from '../../hooks/useEventListener/useEventListener.js';
17
- import { setIsKeyboardUser } from '../../utils/keyboardUser/keyboardUser.js';
16
+ import useId from '../../hooks/useId/useId.js';
17
+ import { useDidUpdate } from '../../hooks/useDidUpdate/useDidUpdate.js';
18
18
  import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
19
19
 
20
20
  const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
@@ -31,12 +31,7 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
31
31
  } = _ref;
32
32
  const [items, setItems] = useState([]);
33
33
  const flyoutRef = useRef(null);
34
- const {
35
- internalSearchValue,
36
- setSearchValue,
37
- zeroSearchResults,
38
- noMatchesText
39
- } = usePaneSearch(externalSearchValue, onSearchValueChange, items);
34
+ const stickyBoxRef = useRef(null);
40
35
  const portalTarget = usePortalTarget();
41
36
  const [side, align] = useMemo(() => placement?.split?.('-') ?? [], [placement]);
42
37
  const {
@@ -45,14 +40,29 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
45
40
  setMaskHeight,
46
41
  maskHeight,
47
42
  open,
48
- triggerRef
43
+ triggerRef,
44
+ searchBarConfigs
49
45
  } = useMenuContext();
46
+ const thisPanesDepth = 1;
47
+ const maskContainerId = 'maskContainer';
48
+ useOverlay({
49
+ isVisible: open,
50
+ ignoreIds: [maskContainerId],
51
+ opacity: 0
52
+ });
53
+ const animatedLeft = useMemo(() => openPaneDepth > thisPanesDepth, [openPaneDepth]);
54
+ const dataTestId = getSubDataTestId(rootDataTestId, DATA_TESTID_SUFFIXES.MENU_PANE);
55
+ const {
56
+ internalSearchValue,
57
+ noSearchResultsNode,
58
+ onInteractOutside
59
+ } = usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, false, dataTestId, useId(), flyoutRef);
50
60
 
51
61
  // In order to preseve the css animation for vertical resizing, we cannot set the height of this pane to `auto`. It must be a pixel value.
52
62
  // We cache the pixel value here, to use it later if the user returns to this pane from a submenu.
53
63
  const initialHeightOfThisPane = useRef(null);
54
64
  useDidUpdate(() => {
55
- if (openPaneDepth === 1) {
65
+ if (openPaneDepth === thisPanesDepth) {
56
66
  if (initialHeightOfThisPane.current === null) {
57
67
  window.requestAnimationFrame(() => {
58
68
  initialHeightOfThisPane.current = flyoutRef.current?.clientHeight ?? null;
@@ -63,17 +73,6 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
63
73
  }
64
74
  }
65
75
  }, [openPaneDepth]);
66
- const dataTestId = getSubDataTestId(rootDataTestId, DATA_TESTID_SUFFIXES.MENU_PANE);
67
- const animatedLeft = useMemo(() => openPaneDepth > 1, [openPaneDepth]);
68
- useEventListener(flyoutRef, 'keydown', e => {
69
- var _context;
70
- return _includesInstanceProperty(_context = Object.values(KEYS).flat()).call(_context, e.key) && setIsKeyboardUser(true);
71
- }, {
72
- additionalDependencies: [openPaneDepth]
73
- });
74
- useEventListener(flyoutRef, 'pointerenter', () => setIsKeyboardUser(false), {
75
- additionalDependencies: [openPaneDepth]
76
- });
77
76
  const defaultSide = useMemo(() => {
78
77
  const rect = triggerRef?.current?.getBoundingClientRect();
79
78
  if (!rect) {
@@ -98,6 +97,12 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
98
97
  }
99
98
  return 'bottom';
100
99
  }, [open, triggerRef]);
100
+ const [transform, setTransform] = useState('');
101
+ const target = flyoutRef.current?.parentNode ?? undefined;
102
+ useMutationObserver(target, {
103
+ attributes: true,
104
+ attributeFilter: ['style']
105
+ }, () => setTransform(target?.style?.transform ?? ''));
101
106
  return /*#__PURE__*/React__default.createElement(PaneContextProvider, {
102
107
  items: items,
103
108
  setItems: setItems,
@@ -106,35 +111,48 @@ const MenuPane = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
106
111
  searchValue: internalSearchValue,
107
112
  isSearchFilteringDisabled,
108
113
  isInteractive: !animatedLeft,
109
- flyoutRef
114
+ flyoutRef,
115
+ stickyBoxRef
110
116
  }
111
117
  }, /*#__PURE__*/React__default.createElement(Portal, {
112
118
  container: portalTarget || undefined
113
119
  }, /*#__PURE__*/React__default.createElement("div", {
114
- className: styles.maskContainer
120
+ className: styles.maskContainer,
121
+ id: maskContainerId
115
122
  }, /*#__PURE__*/React__default.createElement(Content, _extends({}, rest, {
123
+ onCloseAutoFocus: () => triggerRef?.current?.focus(),
116
124
  sideOffset: 6,
117
- loop: true,
125
+ loop: !isSearchable,
118
126
  side: side || defaultSide,
119
127
  align: align || 'start',
120
128
  ref: mergeRefs(ref, flyoutRef),
121
129
  "data-testid": dataTestId,
122
130
  className: classNames(className, {
123
- [styles.animatedLeft]: animatedLeft,
124
- [styles.containsStickyBox]: isSearchable
131
+ [styles.animatedLeft]: animatedLeft
125
132
  }, styles.flyout),
133
+ onInteractOutside: onInteractOutside,
126
134
  style: {
127
135
  ...style,
128
- height: internalSearchValue && openPaneDepth === 1 ? undefined : maskHeight ?? undefined
136
+ height: internalSearchValue && openPaneDepth === thisPanesDepth ? undefined : maskHeight ?? undefined
129
137
  }
130
138
  }), isSearchable && /*#__PURE__*/React__default.createElement("div", {
131
- className: styles.stickyBox
132
- }, /*#__PURE__*/React__default.createElement(MenuSearch, {
133
- setSearchValue: setSearchValue
134
- })), zeroSearchResults && /*#__PURE__*/React__default.createElement("div", {
135
- className: classNames(styles.menuItem, styles.noItems),
136
- "aria-live": "assertive"
137
- }, noMatchesText), children))));
139
+ className: classNames(styles.stickyBox, styles.isSearchable),
140
+ ref: stickyBoxRef
141
+ }), noSearchResultsNode, children), /*#__PURE__*/React__default.createElement("div", {
142
+ className: styles.searchBoxesContainer,
143
+ style: {
144
+ transform,
145
+ width: flyoutRef.current?.clientWidth
146
+ }
147
+ }, searchBarConfigs.length ? searchBarConfigs.map(_ref2 => {
148
+ let {
149
+ id,
150
+ ...config
151
+ } = _ref2;
152
+ return /*#__PURE__*/React__default.createElement(MenuSearch, _extends({
153
+ key: id
154
+ }, config));
155
+ }) : null))));
138
156
  });
139
157
 
140
158
  export { MenuPane as default };
@@ -1,92 +1,37 @@
1
- import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/includes';
2
- import React__default, { useRef, useEffect, useState } from 'react';
3
- import { Item } from '@radix-ui/react-dropdown-menu';
1
+ import React__default from 'react';
4
2
  import classNames from 'classnames';
5
3
  import styles from './Menu2.js';
6
4
  import '../Input/index.js';
7
5
  import '../../icons/index.es.js';
8
- import '../../utils/index.js';
9
- import { usePaneContext } from './MenuContext.js';
10
- import { DATA_TESTID_SUFFIXES, KEYS } from './constants.js';
11
- import '../../hooks/index.js';
12
- import useTranslation from '../../utils/Translation/useTranslation.js';
13
- import useEventListener from '../../hooks/useEventListener/useEventListener.js';
14
- import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
15
6
  import Input from '../Input/Input.js';
16
7
  import SearchIcon from '../../icons/components/SearchIcon.js';
17
8
 
18
9
  const MenuSearch = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
19
10
  let {
20
- setSearchValue
21
- } = _ref;
22
- const itemRef = useRef(null);
23
- const inputRef = useRef(null);
24
- const {
25
- translate
26
- } = useTranslation();
27
- const searchText = translate('searchText');
28
- const {
29
- dataTestId: menuParentDataTestId,
11
+ setSearchValue,
12
+ animatedLeft,
13
+ animatedRight,
14
+ dataTestId,
30
15
  searchValue = '',
31
- isInteractive,
32
- closeSubmenu,
33
- flyoutRef
34
- } = usePaneContext();
35
- const dataTestId = menuParentDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_SEARCH);
36
- useEffect(() => () => setSearchValue(''), [setSearchValue]);
37
- const [previouslyFocusedElement, setPreviouslyFocusedElement] = useState();
38
-
39
- // hack to keep focus on search input on mouse leave
40
- useEventListener(flyoutRef, 'focus', e => {
41
- if (e.target === e.currentTarget && previouslyFocusedElement === itemRef.current && isInteractive) {
42
- inputRef.current?.focus();
43
- }
44
- setPreviouslyFocusedElement(e.target);
45
- }, {
46
- isCaptureEvent: true
47
- });
48
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Item, {
16
+ isInteractive = false,
17
+ searchPlaceholder
18
+ } = _ref;
19
+ return /*#__PURE__*/React__default.createElement("div", {
49
20
  className: classNames(styles.searchBox, {
50
- [styles.unresponsive]: !isInteractive
51
- })
52
- // prevents dropdown from closing
53
- ,
54
- onSelect: e => e.preventDefault(),
55
- onFocus: () => inputRef.current?.focus(),
56
- role: undefined,
57
- ref: mergeRefs(itemRef, ref)
21
+ [styles.unresponsive]: !isInteractive,
22
+ [styles.animatedLeft]: animatedLeft,
23
+ [styles.animatedRight]: animatedRight
24
+ }),
25
+ ref: ref
58
26
  }, /*#__PURE__*/React__default.createElement(Input, {
59
27
  "data-testid": dataTestId,
60
28
  role: "searchbox",
61
29
  value: searchValue,
62
30
  onChange: e => setSearchValue(e.target.value),
63
- placeholder: searchText,
64
- onKeyDown: e => {
65
- var _context, _context2;
66
- // stop propagation to prevent typeAhead
67
- e.stopPropagation();
68
-
69
- // allow caret movement through text entry, but close searchable submenu if on the very left
70
- if (e.target?.selectionStart === 0 && _includesInstanceProperty(_context = KEYS.CLOSE_SUBMENU).call(_context, e.key)) {
71
- closeSubmenu?.(e);
72
- return;
73
- }
74
-
75
- // forward keypress directly to `Item` to let Radix handle keyboard navigation
76
- if (_includesInstanceProperty(_context2 = KEYS.IGNORED_BY_SEARCH_INPUT).call(_context2, e.key)) {
77
- // `view` types are incompatible
78
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
79
- const {
80
- view,
81
- ...eventClone
82
- } = e;
83
- itemRef?.current?.dispatchEvent(new KeyboardEvent('keydown', eventClone));
84
- }
85
- },
31
+ placeholder: searchPlaceholder,
86
32
  leftAddOn: /*#__PURE__*/React__default.createElement(SearchIcon, null),
87
- ref: inputRef,
88
33
  className: styles.searchInput
89
- })));
34
+ }));
90
35
  });
91
36
 
92
37
  export { MenuSearch as default };
@@ -3,18 +3,17 @@ import _includesInstanceProperty from '@babel/runtime-corejs3/core-js-stable/ins
3
3
  import React__default, { useState, useRef, useMemo, useEffect } from 'react';
4
4
  import { Sub, SubTrigger, SubContent, Item } from '@radix-ui/react-dropdown-menu';
5
5
  import classNames from 'classnames';
6
+ import { useFocusVisible } from '@react-aria/interactions';
6
7
  import styles from './Menu2.js';
7
8
  import '../../icons/index.es.js';
8
9
  import { usePaneContext, useMenuContext, PaneContextProvider } from './MenuContext.js';
9
10
  import '../../utils/index.js';
10
11
  import { DATA_TESTID_SUFFIXES, KEYS } from './constants.js';
11
- import MenuSearch from './MenuSearch.js';
12
12
  import '../../hooks/index.js';
13
13
  import usePaneSearch from './usePaneSearch.js';
14
14
  import useId from '../../hooks/useId/useId.js';
15
15
  import getSubDataTestId from '../../utils/getSubDataTestId/getSubDataTestId.js';
16
16
  import { useDidUpdate } from '../../hooks/useDidUpdate/useDidUpdate.js';
17
- import { getIsKeyboardUser } from '../../utils/keyboardUser/keyboardUser.js';
18
17
  import ChevronRightIcon from '../../icons/components/ChevronRightIcon.js';
19
18
  import mergeRefs from '../../utils/mergeRefs/mergeRefs.js';
20
19
  import ArrowLeftIcon from '../../icons/components/ArrowLeftIcon.js';
@@ -30,19 +29,14 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
30
29
  isSearchFilteringDisabled: isSearchFilteringDisabledForChildren = false,
31
30
  className,
32
31
  style,
32
+ onIsOpenChange,
33
33
  ...rest
34
34
  } = _ref;
35
35
  const [items, setItems] = useState([]);
36
- const {
37
- internalSearchValue,
38
- setSearchValue,
39
- zeroSearchResults,
40
- noMatchesText
41
- } = usePaneSearch(externalSearchValue, onSearchValueChange, items);
42
36
  const internalId = useId();
43
37
  const triggerRef = useRef(null);
44
38
  const flyoutRef = useRef(null);
45
- const searchItemRef = useRef(null);
39
+ const stickyBoxRef = useRef(null);
46
40
  const backButtonRef = useRef(null);
47
41
  const {
48
42
  dataTestId: paneContainingTriggerDataTestId,
@@ -57,17 +51,32 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
57
51
  registerSubmenu,
58
52
  setMaskHeight
59
53
  } = useMenuContext();
54
+ const {
55
+ isFocusVisible
56
+ } = useFocusVisible();
60
57
  const thisPanesDepth = useRef(totalOpenPaneDepth + 1).current;
58
+ const [isPaneInDOM, setIsPaneInDOM] = useState(false);
59
+ const [isFrameAfterPaneAddedToDOM, setIsFrameAfterPaneAddedToDOM] = useState(false);
60
+ const [isTransitioningFromRight, setIsTransitioningFromRight] = useState(false);
61
+ const animatedLeft = useMemo(() => thisPanesDepth < totalOpenPaneDepth, [totalOpenPaneDepth, thisPanesDepth]);
62
+ const animatedRight = useMemo(() => thisPanesDepth > totalOpenPaneDepth || isFrameAfterPaneAddedToDOM, [totalOpenPaneDepth, isFrameAfterPaneAddedToDOM, thisPanesDepth]);
61
63
  const paneDataTestId = getSubDataTestId(paneContainingTriggerDataTestId, String(triggerIndex));
64
+ const closeThisSubmenu = e => {
65
+ // prevent closing the entire menu, and Radix keyboard navigation
66
+ e.preventDefault();
67
+ registerSubmenu(internalId, false);
68
+ };
69
+ const {
70
+ internalSearchValue,
71
+ noSearchResultsNode,
72
+ onInteractOutside
73
+ } = usePaneSearch(isSearchable, externalSearchValue, onSearchValueChange, items, animatedLeft, animatedRight, paneDataTestId, internalId, flyoutRef, backButtonRef, closeThisSubmenu);
62
74
  const backButtonDataTestId = paneDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_BACK);
63
75
  const triggerDataTestId = paneDataTestId?.replace(DATA_TESTID_SUFFIXES.MENU_PANE, DATA_TESTID_SUFFIXES.MENU_ITEM);
64
76
  const triggerIsVisible = useMemo(() => {
65
77
  var _context;
66
78
  return isSearchFilteringDisabledForPaneContainingTrigger || !paneContainingTriggerSearchValue || typeof label === 'string' && _includesInstanceProperty(_context = label.toLowerCase()).call(_context, paneContainingTriggerSearchValue.toLowerCase());
67
79
  }, [paneContainingTriggerSearchValue, label, isSearchFilteringDisabledForPaneContainingTrigger]);
68
- const [isPaneInDOM, setIsPaneInDOM] = useState(false);
69
- const [isFrameAfterPaneAddedToDOM, setIsFrameAfterPaneAddedToDOM] = useState(false);
70
- const [isTransitioningFromRight, setIsTransitioningFromRight] = useState(false);
71
80
  useDidUpdate(() => {
72
81
  if (isPaneInDOM) {
73
82
  setIsTransitioningFromRight(true);
@@ -76,13 +85,19 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
76
85
  window.requestAnimationFrame(() => setIsFrameAfterPaneAddedToDOM(false));
77
86
  }
78
87
  registerSubmenu(internalId, isPaneInDOM);
88
+ onIsOpenChange?.(isPaneInDOM);
79
89
  }, [isPaneInDOM]);
90
+
91
+ // Omitted dependencies because this should only run on unmount
92
+ // eslint-disable-next-line react-hooks/exhaustive-deps
80
93
  useEffect(() => () => registerSubmenu(internalId, false), []);
81
- const closeThisSubmenu = e => {
82
- // prevent closing the entire menu, and Radix keyboard navigation
83
- e.preventDefault();
84
- registerSubmenu(internalId, false);
85
- };
94
+ useDidUpdate(() => {
95
+ if (thisPanesDepth === totalOpenPaneDepth) {
96
+ setMaskHeight(flyoutRef.current?.clientHeight ?? null);
97
+ }
98
+ },
99
+ // ignoring other dependencies because this should only run when the children change
100
+ [children]);
86
101
  useDidUpdate(() => {
87
102
  if (thisPanesDepth === totalOpenPaneDepth) {
88
103
  window.requestAnimationFrame(() => {
@@ -90,28 +105,27 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
90
105
  });
91
106
  }
92
107
  }, [totalOpenPaneDepth, internalSearchValue]);
93
- const animatedLeft = useMemo(() => thisPanesDepth < totalOpenPaneDepth, [totalOpenPaneDepth]);
94
- const animatedRight = useMemo(() => thisPanesDepth > totalOpenPaneDepth || isFrameAfterPaneAddedToDOM, [totalOpenPaneDepth, isFrameAfterPaneAddedToDOM]);
95
108
  const handlePaneTransitionEnd = () => {
96
109
  if (animatedLeft) {
97
110
  return;
98
111
  }
99
112
  if (animatedRight) {
100
113
  setIsPaneInDOM(false);
101
- if (getIsKeyboardUser()) {
114
+ if (isFocusVisible) {
102
115
  triggerRef.current?.focus();
103
116
  }
104
- } else {
105
- // if the newly closed submenu doesn't place the focus on its trigger
106
- if (!flyoutRef.current?.contains(document.activeElement) && getIsKeyboardUser()) {
107
- if (searchItemRef.current) {
108
- searchItemRef.current.focus();
109
- } else if (backButtonRef.current) {
110
- backButtonRef.current.focus();
111
- }
117
+ return;
118
+ }
119
+
120
+ // if the newly closed submenu doesn't place the focus on its trigger due to mouse events
121
+ if (!flyoutRef.current?.contains(document.activeElement) && isFocusVisible) {
122
+ if (triggerRef.current && paneContainingTriggerIsInteractive) {
123
+ triggerRef.current.focus();
124
+ } else if (backButtonRef.current) {
125
+ backButtonRef.current.focus();
112
126
  }
113
- setIsTransitioningFromRight(false);
114
127
  }
128
+ setIsTransitioningFromRight(false);
115
129
  };
116
130
  return triggerIsVisible ? /*#__PURE__*/React__default.createElement(Sub, {
117
131
  open: isPaneInDOM
@@ -146,13 +160,15 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
146
160
  isSearchFilteringDisabled: isSearchFilteringDisabledForChildren,
147
161
  isInteractive: !isTransitioningFromRight && !animatedLeft && !animatedRight,
148
162
  closeSubmenu: closeThisSubmenu,
149
- flyoutRef
163
+ flyoutRef,
164
+ stickyBoxRef
150
165
  }
151
166
  }, /*#__PURE__*/React__default.createElement(SubContent, _extends({}, rest, {
152
- loop: true,
167
+ loop: !isSearchable,
153
168
  "data-testid": paneDataTestId,
154
169
  ref: mergeRefs(ref, flyoutRef),
155
- className: classNames(className, styles.flyout, styles.containsStickyBox, {
170
+ onInteractOutside: onInteractOutside,
171
+ className: classNames(className, styles.flyout, {
156
172
  [styles.animatedRight]: animatedRight,
157
173
  [styles.animatedLeft]: animatedLeft
158
174
  }),
@@ -162,11 +178,11 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
162
178
  zIndex: thisPanesDepth
163
179
  }
164
180
  }), /*#__PURE__*/React__default.createElement("div", {
165
- className: styles.stickyBox
166
- }, isSearchable && /*#__PURE__*/React__default.createElement(MenuSearch, {
167
- setSearchValue: setSearchValue,
168
- ref: searchItemRef
169
- }), /*#__PURE__*/React__default.createElement(Item, {
181
+ className: classNames(styles.stickyBox, {
182
+ [styles.isSearchable]: isSearchable
183
+ }),
184
+ ref: stickyBoxRef
185
+ }, /*#__PURE__*/React__default.createElement(Item, {
170
186
  className: classNames(styles.menuItem, {
171
187
  [styles.unresponsive]: isTransitioningFromRight || animatedLeft || animatedRight
172
188
  }),
@@ -182,10 +198,7 @@ const SubMenu = /*#__PURE__*/React__default.forwardRef((_ref, ref) => {
182
198
  }, /*#__PURE__*/React__default.createElement(ArrowLeftIcon, {
183
199
  size: "small",
184
200
  className: styles.backIcon
185
- }), label)), zeroSearchResults && /*#__PURE__*/React__default.createElement("div", {
186
- className: classNames(styles.menuItem, styles.noItems),
187
- "aria-live": "assertive"
188
- }, noMatchesText), children))) : null;
201
+ }), label)), noSearchResultsNode, children))) : null;
189
202
  });
190
203
 
191
204
  export { SubMenu as default };
@@ -9,7 +9,11 @@ const DATA_TESTID_SUFFIXES = {
9
9
  const KEYS = {
10
10
  OPEN_SUBMENU: ['ArrowRight', 'Enter', ' '],
11
11
  CLOSE_SUBMENU: ['ArrowLeft'],
12
- IGNORED_BY_SEARCH_INPUT: ['Escape', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown', 'Home', 'End']
12
+ NAVIGATE_UP: ['ArrowUp'],
13
+ NAVIGATE_DOWN: ['ArrowDown'],
14
+ NAVIGATE_TOP: ['Home'],
15
+ NAVIIGATE_BOTTOM: ['End'],
16
+ IGNORED_BY_SEARCH_INPUT: ['Tab']
13
17
  };
14
18
 
15
19
  export { DATA_TESTID_SUFFIXES, KEYS };
@@ -0,0 +1,17 @@
1
+ import { useEffect } from 'react';
2
+
3
+ const useMutationObserver = (target, options, onMutate) => useEffect(() => {
4
+ if (!target) {
5
+ return undefined;
6
+ }
7
+ const observer = new MutationObserver(function () {
8
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
9
+ args[_key] = arguments[_key];
10
+ }
11
+ onMutate?.(...args);
12
+ });
13
+ observer.observe(target, options);
14
+ return () => observer.disconnect();
15
+ }, [target, options, onMutate]);
16
+
17
+ export { useMutationObserver as default };