@fluentui/react-menu 9.2.1 → 9.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (180) hide show
  1. package/CHANGELOG.json +111 -1
  2. package/CHANGELOG.md +32 -2
  3. package/dist/index.d.ts +2 -6
  4. package/lib/Menu.js.map +1 -1
  5. package/lib/MenuDivider.js.map +1 -1
  6. package/lib/MenuGroup.js.map +1 -1
  7. package/lib/MenuGroupHeader.js.map +1 -1
  8. package/lib/MenuItem.js.map +1 -1
  9. package/lib/MenuItemCheckbox.js.map +1 -1
  10. package/lib/MenuItemRadio.js.map +1 -1
  11. package/lib/MenuList.js.map +1 -1
  12. package/lib/MenuPopover.js.map +1 -1
  13. package/lib/MenuSplitGroup.js.map +1 -1
  14. package/lib/MenuTrigger.js.map +1 -1
  15. package/lib/components/Menu/Menu.js.map +1 -1
  16. package/lib/components/Menu/Menu.types.js.map +1 -1
  17. package/lib/components/Menu/index.js.map +1 -1
  18. package/lib/components/Menu/renderMenu.js.map +1 -1
  19. package/lib/components/Menu/useMenu.js +10 -4
  20. package/lib/components/Menu/useMenu.js.map +1 -1
  21. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  22. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  23. package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
  24. package/lib/components/MenuDivider/index.js.map +1 -1
  25. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  26. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  27. package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  28. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  29. package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
  30. package/lib/components/MenuGroup/index.js.map +1 -1
  31. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  32. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  33. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  34. package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  35. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  36. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  37. package/lib/components/MenuGroupHeader/index.js.map +1 -1
  38. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  39. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  40. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  41. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  42. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  43. package/lib/components/MenuItem/index.js.map +1 -1
  44. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  45. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  46. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  47. package/lib/components/MenuItem/useMenuItemStyles.js +29 -29
  48. package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
  49. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  50. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  51. package/lib/components/MenuItemCheckbox/index.js.map +1 -1
  52. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  53. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  54. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  55. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  56. package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  57. package/lib/components/MenuItemRadio/index.js.map +1 -1
  58. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  59. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  60. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  61. package/lib/components/MenuList/MenuList.js.map +1 -1
  62. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  63. package/lib/components/MenuList/index.js.map +1 -1
  64. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  65. package/lib/components/MenuList/useMenuList.js.map +1 -1
  66. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  67. package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
  68. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  69. package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
  70. package/lib/components/MenuPopover/index.js.map +1 -1
  71. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  72. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  73. package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  74. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  75. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  76. package/lib/components/MenuSplitGroup/index.js.map +1 -1
  77. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  78. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  79. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  80. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  81. package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  82. package/lib/components/MenuTrigger/index.js.map +1 -1
  83. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  84. package/lib/components/MenuTrigger/useMenuTrigger.js +7 -9
  85. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  86. package/lib/components/index.js.map +1 -1
  87. package/lib/contexts/menuContext.js.map +1 -1
  88. package/lib/contexts/menuGroupContext.js.map +1 -1
  89. package/lib/contexts/menuListContext.js.map +1 -1
  90. package/lib/contexts/menuTriggerContext.js.map +1 -1
  91. package/lib/index.js.map +1 -1
  92. package/lib/selectable/index.js.map +1 -1
  93. package/lib/selectable/types.js.map +1 -1
  94. package/lib/selectable/useCheckmarkStyles.js.map +1 -1
  95. package/lib/utils/index.js.map +1 -1
  96. package/lib/utils/useIsSubmenu.js.map +1 -1
  97. package/lib/utils/useOnMenuEnter.js.map +1 -1
  98. package/lib-commonjs/Menu.js.map +1 -1
  99. package/lib-commonjs/MenuDivider.js.map +1 -1
  100. package/lib-commonjs/MenuGroup.js.map +1 -1
  101. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  102. package/lib-commonjs/MenuItem.js.map +1 -1
  103. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  104. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  105. package/lib-commonjs/MenuList.js.map +1 -1
  106. package/lib-commonjs/MenuPopover.js.map +1 -1
  107. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  108. package/lib-commonjs/MenuTrigger.js.map +1 -1
  109. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  110. package/lib-commonjs/components/Menu/index.js.map +1 -1
  111. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  112. package/lib-commonjs/components/Menu/useMenu.js +10 -4
  113. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  114. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  115. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  116. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  117. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  118. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  119. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  120. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  121. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  122. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  123. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  124. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  125. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  126. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  127. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  128. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  129. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  130. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  131. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  132. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  133. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  134. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  135. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  136. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +29 -29
  137. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
  138. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  139. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  140. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  141. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  142. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  143. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  144. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  145. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  146. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  147. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  148. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  149. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  150. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  151. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  152. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  153. package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
  154. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  155. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  156. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  157. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  158. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  159. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  160. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  161. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  162. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  163. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  164. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  165. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  166. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  167. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +7 -9
  168. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  169. package/lib-commonjs/components/index.js.map +1 -1
  170. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  171. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  172. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  173. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  174. package/lib-commonjs/index.js.map +1 -1
  175. package/lib-commonjs/selectable/index.js.map +1 -1
  176. package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
  177. package/lib-commonjs/utils/index.js.map +1 -1
  178. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  179. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  180. package/package.json +11 -12
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useOnMenuEnter';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-menu/src/utils/index.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,kBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './useOnMenuEnter';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/useIsSubmenu.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,YAAhB,GAA4B;EAC1B,MAAM,gBAAgB,GAAG,aAAA,CAAA,uBAAA,CAAwB,OAAO,IAAI,OAAO,CAAC,SAA3C,CAAzB;EACA,MAAM,kBAAkB,GAAG,wBAAA,CAAA,mBAAA,CAAoB,iBAAA,CAAA,eAApB,CAA3B;EAEA,OAAO,gBAAgB,IAAI,kBAA3B;AACD;;AALD,OAAA,CAAA,YAAA,GAAA,YAAA","sourcesContent":["import { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../contexts/menuContext';\nimport { MenuListContext } from '../contexts/menuListContext';\n\n/**\n * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true\n * or whether it is a part of a `MenuList`\n *\n * A simple hook to check box contexts easily\n *\n * @returns whether the component is part of a submenu\n */\nexport function useIsSubmenu() {\n const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);\n const hasMenuListContext = useHasParentContext(MenuListContext);\n\n return menuContextValue || hasMenuListContext;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-menu/src/utils/useIsSubmenu.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,wBAAA,gBAAA,OAAA,CAAA,kCAAA,CAAA;;AACA,MAAA,aAAA,gBAAA,OAAA,CAAA,yBAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,6BAAA,CAAA;AAEA;;;;;;;AAOG;;;AACH,SAAgB,YAAhB,GAA4B;EAC1B,MAAM,gBAAgB,GAAG,aAAA,CAAA,uBAAA,CAAwB,OAAO,IAAI,OAAO,CAAC,SAA3C,CAAzB;EACA,MAAM,kBAAkB,GAAG,wBAAA,CAAA,mBAAA,CAAoB,iBAAA,CAAA,eAApB,CAA3B;EAEA,OAAO,gBAAgB,IAAI,kBAA3B;AACD;;AALD,OAAA,CAAA,YAAA,GAAA,YAAA","sourcesContent":["import { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../contexts/menuContext';\nimport { MenuListContext } from '../contexts/menuListContext';\n\n/**\n * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true\n * or whether it is a part of a `MenuList`\n *\n * A simple hook to check box contexts easily\n *\n * @returns whether the component is part of a submenu\n */\nexport function useIsSubmenu() {\n const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);\n const hasMenuListContext = useHasParentContext(MenuListContext);\n\n return menuContextValue || hasMenuListContext;\n}\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"sources":["utils/useOnMenuEnter.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,gBAAA,GAAmB,cAAnB;AAEb;;;;;;;;;;AAUG;;AACI,MAAM,mBAAmB,GAAI,OAAD,IAA8C;EAC/E,MAAM;IAAE,IAAF;IAAQ,QAAR;IAAkB,OAAlB;IAA2B;EAA3B,IAAwC,OAA9C,CAD+E,CAG/E;;EACA,MAAM,QAAQ,GAAG,iBAAA,CAAA,gBAAA,CAAkB,EAAD,IAAmB;;;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAD,CAAvB;IACA,MAAM,eAAe,GAAG,EAAE,CAAC,MAA3B,CAFmD,CAInD;IACA;IACA;;IACA,MAAM,gBAAgB,GAAG,CAAC,cAAA,CAAA,eAAA,CAAgB,CAAA,EAAA,GAAA,UAAU,CAAC,OAAX,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,IAAtC,EAA4C,eAA5C,CAA1B;;IACA,IAAI,gBAAgB,IAAI,CAAC,QAAzB,EAAmC;MACjC,QAAQ,CAAC,EAAD,CAAR;IACD;EACF,CAXgB,CAAjB;EAaA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB;IACA,IAAI,OAAO,IAAI,IAAf,EAAqB;MACnB;IACD;;IAUD,IAAI,CAAC,QAAL,EAAe;MACb,OAAO,CAAC,gBAAR,CAAyB,OAAA,CAAA,gBAAzB,EAA2C,QAA3C;IACD;;IAED,OAAO,MAAK;MACV,OAAO,CAAC,mBAAR,CAA4B,OAAA,CAAA,gBAA5B,EAA8C,QAA9C;IACD,CAFD;EAGD,CArBD,EAqBG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CArBH;AAsBD,CAvCM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB;AAyCb;;;;AAIG;;AACI,MAAM,sBAAsB,GAAG,CAAC,EAAD,EAAkB,WAAlB,KAA6C;EACjF,EAAE,CAAC,aAAH,CAAiB,IAAI,WAAJ,CAAgB,OAAA,CAAA,gBAAhB,EAAkC;IAAE,OAAO,EAAE,IAAX;IAAiB,MAAM,EAAE;MAAE;IAAF;EAAzB,CAAlC,CAAjB;AACD,CAFM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { UseOnClickOrScrollOutsideOptions } from '@fluentui/react-utilities';\n\n/**\n * Name of the custom event\n */\nexport const MENU_ENTER_EVENT = 'fuimenuenter';\n\n/**\n * This hook works similarly to @see {useOnClickOutside}\n *\n * Problem: Trying to behave the same as system menus:\n * When the mouse leaves a stack of nested menus the stack should not dismiss.\n * However if the mouse leaves a stack of menus and enters a parent menu all its children menu should dismiss.\n *\n * We don't use the native mouseenter event because it would trigger too many times in the document\n * Instead, dispatch custom DOM event from the menu so that it can bubble\n * Each nested menu can use the listener to check if the event is from a child or parent menu\n */\nexport const useOnMenuMouseEnter = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled } = options;\n\n // Keep mouse event here because this is essentially a custom 'mouseenter' event\n const listener = useEventCallback((ev: MouseEvent) => {\n const popoverRef = refs[0];\n const someMenuPopover = ev.target as HTMLElement;\n\n // someMenu is a child -> will always be contained because of vParents\n // someMenu is a parent -> will always not be contained because no vParent\n // someMenu is the current popover -> it will contain itself\n const isOutsidePopover = !elementContains(popoverRef.current ?? null, someMenuPopover);\n if (isOutsidePopover && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // eslint-disable-next-line eqeqeq\n if (element == null) {\n return;\n }\n\n /**\n * Because `addEventListener` type override falls back to 2nd definition (evt name is unknown string literal)\n * evt is being typed as a base class of MouseEvent -> `Event`.\n * This type is used to override `listener` calls to make TS happy\n */\n\n type ListenerOverride = (evt: Event) => void;\n\n if (!disabled) {\n element.addEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n }\n\n return () => {\n element.removeEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n };\n }, [listener, element, disabled]);\n};\n\n/**\n * Dispatches the custom MouseEvent enter event. Similar to calling `el.click()`\n * @param el element for the event target\n * @param nativeEvent the native mouse event this is mapped to\n */\nexport const dispatchMenuEnterEvent = (el: HTMLElement, nativeEvent: MouseEvent) => {\n el.dispatchEvent(new CustomEvent(MENU_ENTER_EVENT, { bubbles: true, detail: { nativeEvent } }));\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["packages/react-components/react-menu/src/utils/useOnMenuEnter.ts"],"names":[],"mappings":";;;;;;;AAAA,MAAA,KAAA,gBAAA,OAAA,CAAA,OAAA,CAAA;;AACA,MAAA,iBAAA,gBAAA,OAAA,CAAA,2BAAA,CAAA;;AACA,MAAA,cAAA,gBAAA,OAAA,CAAA,wBAAA,CAAA;AAGA;;AAEG;;;AACU,OAAA,CAAA,gBAAA,GAAmB,cAAnB;AAEb;;;;;;;;;;AAUG;;AACI,MAAM,mBAAmB,GAAI,OAAD,IAA8C;EAC/E,MAAM;IAAE,IAAF;IAAQ,QAAR;IAAkB,OAAlB;IAA2B;EAA3B,IAAwC,OAA9C,CAD+E,CAG/E;;EACA,MAAM,QAAQ,GAAG,iBAAA,CAAA,gBAAA,CAAkB,EAAD,IAAmB;;;IACnD,MAAM,UAAU,GAAG,IAAI,CAAC,CAAD,CAAvB;IACA,MAAM,eAAe,GAAG,EAAE,CAAC,MAA3B,CAFmD,CAInD;IACA;IACA;;IACA,MAAM,gBAAgB,GAAG,CAAC,cAAA,CAAA,eAAA,CAAgB,CAAA,EAAA,GAAA,UAAU,CAAC,OAAX,MAAkB,IAAlB,IAAkB,EAAA,KAAA,KAAA,CAAlB,GAAkB,EAAlB,GAAsB,IAAtC,EAA4C,eAA5C,CAA1B;;IACA,IAAI,gBAAgB,IAAI,CAAC,QAAzB,EAAmC;MACjC,QAAQ,CAAC,EAAD,CAAR;IACD;EACF,CAXgB,CAAjB;EAaA,KAAK,CAAC,SAAN,CAAgB,MAAK;IACnB;IACA,IAAI,OAAO,IAAI,IAAf,EAAqB;MACnB;IACD;;IAUD,IAAI,CAAC,QAAL,EAAe;MACb,OAAO,CAAC,gBAAR,CAAyB,OAAA,CAAA,gBAAzB,EAA2C,QAA3C;IACD;;IAED,OAAO,MAAK;MACV,OAAO,CAAC,mBAAR,CAA4B,OAAA,CAAA,gBAA5B,EAA8C,QAA9C;IACD,CAFD;EAGD,CArBD,EAqBG,CAAC,QAAD,EAAW,OAAX,EAAoB,QAApB,CArBH;AAsBD,CAvCM;;AAAM,OAAA,CAAA,mBAAA,GAAmB,mBAAnB;AAyCb;;;;AAIG;;AACI,MAAM,sBAAsB,GAAG,CAAC,EAAD,EAAkB,WAAlB,KAA6C;EACjF,EAAE,CAAC,aAAH,CAAiB,IAAI,WAAJ,CAAgB,OAAA,CAAA,gBAAhB,EAAkC;IAAE,OAAO,EAAE,IAAX;IAAiB,MAAM,EAAE;MAAE;IAAF;EAAzB,CAAlC,CAAjB;AACD,CAFM;;AAAM,OAAA,CAAA,sBAAA,GAAsB,sBAAtB","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { UseOnClickOrScrollOutsideOptions } from '@fluentui/react-utilities';\n\n/**\n * Name of the custom event\n */\nexport const MENU_ENTER_EVENT = 'fuimenuenter';\n\n/**\n * This hook works similarly to @see {useOnClickOutside}\n *\n * Problem: Trying to behave the same as system menus:\n * When the mouse leaves a stack of nested menus the stack should not dismiss.\n * However if the mouse leaves a stack of menus and enters a parent menu all its children menu should dismiss.\n *\n * We don't use the native mouseenter event because it would trigger too many times in the document\n * Instead, dispatch custom DOM event from the menu so that it can bubble\n * Each nested menu can use the listener to check if the event is from a child or parent menu\n */\nexport const useOnMenuMouseEnter = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled } = options;\n\n // Keep mouse event here because this is essentially a custom 'mouseenter' event\n const listener = useEventCallback((ev: MouseEvent) => {\n const popoverRef = refs[0];\n const someMenuPopover = ev.target as HTMLElement;\n\n // someMenu is a child -> will always be contained because of vParents\n // someMenu is a parent -> will always not be contained because no vParent\n // someMenu is the current popover -> it will contain itself\n const isOutsidePopover = !elementContains(popoverRef.current ?? null, someMenuPopover);\n if (isOutsidePopover && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // eslint-disable-next-line eqeqeq\n if (element == null) {\n return;\n }\n\n /**\n * Because `addEventListener` type override falls back to 2nd definition (evt name is unknown string literal)\n * evt is being typed as a base class of MouseEvent -> `Event`.\n * This type is used to override `listener` calls to make TS happy\n */\n\n type ListenerOverride = (evt: Event) => void;\n\n if (!disabled) {\n element.addEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n }\n\n return () => {\n element.removeEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n };\n }, [listener, element, disabled]);\n};\n\n/**\n * Dispatches the custom MouseEvent enter event. Similar to calling `el.click()`\n * @param el element for the event target\n * @param nativeEvent the native mouse event this is mapped to\n */\nexport const dispatchMenuEnterEvent = (el: HTMLElement, nativeEvent: MouseEvent) => {\n el.dispatchEvent(new CustomEvent(MENU_ENTER_EVENT, { bubbles: true, detail: { nativeEvent } }));\n};\n"],"sourceRoot":"../src/"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-menu",
3
- "version": "9.2.1",
3
+ "version": "9.2.3",
4
4
  "description": "Fluent UI menu component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -12,8 +12,6 @@
12
12
  },
13
13
  "license": "MIT",
14
14
  "scripts": {
15
- "docs": "api-extractor run --config=config/api-extractor.local.json --local",
16
- "build:local": "tsc -p ./tsconfig.lib.json --module esnext --emitDeclarationOnly && node ../../../scripts/typescript/normalize-import --output ./dist/types/packages/react-components/react-menu/src && yarn docs",
17
15
  "build": "just-scripts build",
18
16
  "bundle-size": "bundle-size measure",
19
17
  "clean": "just-scripts clean",
@@ -25,26 +23,27 @@
25
23
  "start": "yarn storybook",
26
24
  "storybook": "start-storybook",
27
25
  "test": "jest --passWithNoTests",
28
- "type-check": "tsc -b tsconfig.json"
26
+ "type-check": "tsc -b tsconfig.json",
27
+ "generate-api": "tsc -p ./tsconfig.lib.json --emitDeclarationOnly && just-scripts api-extractor"
29
28
  },
30
29
  "devDependencies": {
31
30
  "@fluentui/eslint-plugin": "*",
32
31
  "@fluentui/react-conformance": "*",
33
- "@fluentui/react-conformance-griffel": "9.0.0-beta.14",
32
+ "@fluentui/react-conformance-griffel": "9.0.0-beta.15",
34
33
  "@fluentui/scripts": "^1.0.0"
35
34
  },
36
35
  "dependencies": {
37
- "@fluentui/react-aria": "^9.2.0",
36
+ "@fluentui/react-aria": "^9.2.2",
38
37
  "@fluentui/keyboard-keys": "^9.0.0",
39
- "@fluentui/react-context-selector": "^9.0.3",
38
+ "@fluentui/react-context-selector": "^9.0.4",
40
39
  "@fluentui/react-icons": "^2.0.175",
41
- "@fluentui/react-portal": "^9.0.5",
42
- "@fluentui/react-positioning": "^9.2.0",
40
+ "@fluentui/react-portal": "^9.0.7",
41
+ "@fluentui/react-positioning": "^9.2.1",
43
42
  "@fluentui/react-shared-contexts": "^9.0.1",
44
- "@fluentui/react-tabster": "^9.1.1",
43
+ "@fluentui/react-tabster": "^9.1.3",
45
44
  "@fluentui/react-theme": "^9.1.0",
46
- "@fluentui/react-utilities": "^9.1.0",
47
- "@griffel/react": "^1.3.0",
45
+ "@fluentui/react-utilities": "^9.1.1",
46
+ "@griffel/react": "^1.4.0",
48
47
  "tslib": "^2.1.0"
49
48
  },
50
49
  "peerDependencies": {