@fluentui/react-menu 9.14.8 → 9.14.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (250) hide show
  1. package/CHANGELOG.md +36 -2
  2. package/lib/Menu.js.map +1 -1
  3. package/lib/MenuDivider.js.map +1 -1
  4. package/lib/MenuGroup.js.map +1 -1
  5. package/lib/MenuGroupHeader.js.map +1 -1
  6. package/lib/MenuItem.js.map +1 -1
  7. package/lib/MenuItemCheckbox.js.map +1 -1
  8. package/lib/MenuItemLink.js.map +1 -1
  9. package/lib/MenuItemRadio.js.map +1 -1
  10. package/lib/MenuItemSwitch.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.map +1 -1
  20. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  21. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  22. package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
  23. package/lib/components/MenuDivider/index.js.map +1 -1
  24. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  25. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  26. package/lib/components/MenuDivider/useMenuDividerStyles.styles.js +2 -0
  27. package/lib/components/MenuDivider/useMenuDividerStyles.styles.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.styles.js +2 -0
  35. package/lib/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
  36. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  37. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  38. package/lib/components/MenuGroupHeader/index.js.map +1 -1
  39. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  40. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  41. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js +2 -0
  42. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
  43. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  44. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  45. package/lib/components/MenuItem/index.js.map +1 -1
  46. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  47. package/lib/components/MenuItem/useCharacterSearch.js +1 -0
  48. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  49. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  50. package/lib/components/MenuItem/useMenuItemStyles.styles.js +2 -0
  51. package/lib/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  52. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  53. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  54. package/lib/components/MenuItemCheckbox/index.js.map +1 -1
  55. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  56. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  57. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js +2 -0
  58. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
  59. package/lib/components/MenuItemLink/MenuItemLink.js.map +1 -1
  60. package/lib/components/MenuItemLink/MenuItemLink.types.js +3 -1
  61. package/lib/components/MenuItemLink/MenuItemLink.types.js.map +1 -1
  62. package/lib/components/MenuItemLink/index.js.map +1 -1
  63. package/lib/components/MenuItemLink/renderMenuItemLink.js.map +1 -1
  64. package/lib/components/MenuItemLink/useMenuItemLink.js.map +1 -1
  65. package/lib/components/MenuItemLink/useMenuItemLinkStyles.styles.js +2 -0
  66. package/lib/components/MenuItemLink/useMenuItemLinkStyles.styles.js.map +1 -1
  67. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  68. package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  69. package/lib/components/MenuItemRadio/index.js.map +1 -1
  70. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  71. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  72. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.styles.js +2 -0
  73. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
  74. package/lib/components/MenuItemSwitch/MenuItemSwitch.js.map +1 -1
  75. package/lib/components/MenuItemSwitch/MenuItemSwitch.types.js +3 -1
  76. package/lib/components/MenuItemSwitch/MenuItemSwitch.types.js.map +1 -1
  77. package/lib/components/MenuItemSwitch/index.js.map +1 -1
  78. package/lib/components/MenuItemSwitch/renderMenuItemSwitch.js.map +1 -1
  79. package/lib/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -1
  80. package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js +2 -0
  81. package/lib/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js.map +1 -1
  82. package/lib/components/MenuList/MenuList.js.map +1 -1
  83. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  84. package/lib/components/MenuList/index.js.map +1 -1
  85. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  86. package/lib/components/MenuList/useMenuList.js.map +1 -1
  87. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  88. package/lib/components/MenuList/useMenuListStyles.styles.js +2 -0
  89. package/lib/components/MenuList/useMenuListStyles.styles.js.map +1 -1
  90. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  91. package/lib/components/MenuPopover/MenuPopover.types.js +3 -1
  92. package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
  93. package/lib/components/MenuPopover/index.js.map +1 -1
  94. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  95. package/lib/components/MenuPopover/useMenuPopover.js +1 -0
  96. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  97. package/lib/components/MenuPopover/useMenuPopoverStyles.styles.js +2 -0
  98. package/lib/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
  99. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  100. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -1
  101. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  102. package/lib/components/MenuSplitGroup/index.js.map +1 -1
  103. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  104. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  105. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js +2 -0
  106. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
  107. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  108. package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  109. package/lib/components/MenuTrigger/index.js.map +1 -1
  110. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  111. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  112. package/lib/components/index.js.map +1 -1
  113. package/lib/contexts/menuContext.js.map +1 -1
  114. package/lib/contexts/menuGroupContext.js.map +1 -1
  115. package/lib/contexts/menuListContext.js.map +1 -1
  116. package/lib/contexts/menuTriggerContext.js.map +1 -1
  117. package/lib/index.js.map +1 -1
  118. package/lib/selectable/index.js.map +1 -1
  119. package/lib/selectable/types.js.map +1 -1
  120. package/lib/selectable/useCheckmarkStyles.styles.js +2 -0
  121. package/lib/selectable/useCheckmarkStyles.styles.js.map +1 -1
  122. package/lib/utils/index.js.map +1 -1
  123. package/lib/utils/useIsSubmenu.js.map +1 -1
  124. package/lib/utils/useOnMenuEnter.js.map +1 -1
  125. package/lib-commonjs/Menu.js.map +1 -1
  126. package/lib-commonjs/MenuDivider.js.map +1 -1
  127. package/lib-commonjs/MenuGroup.js.map +1 -1
  128. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  129. package/lib-commonjs/MenuItem.js.map +1 -1
  130. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  131. package/lib-commonjs/MenuItemLink.js.map +1 -1
  132. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  133. package/lib-commonjs/MenuItemSwitch.js.map +1 -1
  134. package/lib-commonjs/MenuList.js.map +1 -1
  135. package/lib-commonjs/MenuPopover.js.map +1 -1
  136. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  137. package/lib-commonjs/MenuTrigger.js.map +1 -1
  138. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  139. package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
  140. package/lib-commonjs/components/Menu/index.js.map +1 -1
  141. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  142. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  143. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  144. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  145. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  146. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  147. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  148. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  149. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js +1 -0
  150. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js.map +1 -1
  151. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  152. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  153. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  154. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  155. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  156. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  157. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js +1 -0
  158. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
  159. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  160. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  161. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  162. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  163. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  164. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js +1 -0
  165. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
  166. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  167. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  168. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  169. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  170. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +1 -0
  171. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  172. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  173. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js +1 -0
  174. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  175. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  176. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  177. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  178. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  179. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  180. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js +1 -0
  181. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
  182. package/lib-commonjs/components/MenuItemLink/MenuItemLink.js.map +1 -1
  183. package/lib-commonjs/components/MenuItemLink/MenuItemLink.types.js +3 -1
  184. package/lib-commonjs/components/MenuItemLink/MenuItemLink.types.js.map +1 -1
  185. package/lib-commonjs/components/MenuItemLink/index.js.map +1 -1
  186. package/lib-commonjs/components/MenuItemLink/renderMenuItemLink.js.map +1 -1
  187. package/lib-commonjs/components/MenuItemLink/useMenuItemLink.js.map +1 -1
  188. package/lib-commonjs/components/MenuItemLink/useMenuItemLinkStyles.styles.js +1 -0
  189. package/lib-commonjs/components/MenuItemLink/useMenuItemLinkStyles.styles.js.map +1 -1
  190. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  191. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  192. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  193. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  194. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  195. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js +1 -0
  196. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
  197. package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.js.map +1 -1
  198. package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.types.js +3 -1
  199. package/lib-commonjs/components/MenuItemSwitch/MenuItemSwitch.types.js.map +1 -1
  200. package/lib-commonjs/components/MenuItemSwitch/index.js.map +1 -1
  201. package/lib-commonjs/components/MenuItemSwitch/renderMenuItemSwitch.js.map +1 -1
  202. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitch.js.map +1 -1
  203. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js +4 -3
  204. package/lib-commonjs/components/MenuItemSwitch/useMenuItemSwitchStyles.styles.js.map +1 -1
  205. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  206. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  207. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  208. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  209. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  210. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  211. package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js +1 -0
  212. package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js.map +1 -1
  213. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  214. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +3 -1
  215. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  216. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  217. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  218. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +1 -0
  219. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  220. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js +1 -0
  221. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
  222. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  223. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -1
  224. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  225. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  226. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  227. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  228. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js +1 -0
  229. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
  230. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  231. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  232. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  233. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  234. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  235. package/lib-commonjs/components/index.js.map +1 -1
  236. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  237. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  238. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  239. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  240. package/lib-commonjs/index.js +136 -136
  241. package/lib-commonjs/index.js.map +1 -1
  242. package/lib-commonjs/selectable/index.js.map +1 -1
  243. package/lib-commonjs/selectable/types.js.map +1 -1
  244. package/lib-commonjs/selectable/useCheckmarkStyles.styles.js +1 -0
  245. package/lib-commonjs/selectable/useCheckmarkStyles.styles.js.map +1 -1
  246. package/lib-commonjs/utils/index.js.map +1 -1
  247. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  248. package/lib-commonjs/utils/useOnMenuEnter.js +3 -3
  249. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  250. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["useOnMenuEnter.js"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, elementContains } from '@fluentui/react-utilities';\n/**\n * Name of the custom event\n */ export const MENU_ENTER_EVENT = 'fuimenuenter';\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 */ export const useOnMenuMouseEnter = (options)=>{\n const { refs, callback, element, disabled } = options;\n // Keep mouse event here because this is essentially a custom 'mouseenter' event\n const listener = useEventCallback((ev)=>{\n const popoverRef = refs[0];\n const someMenuPopover = ev.target;\n var _popoverRef_current;\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 = popoverRef.current) !== null && _popoverRef_current !== void 0 ? _popoverRef_current : null, someMenuPopover);\n if (isOutsidePopover && !disabled) {\n callback(ev);\n }\n });\n React.useEffect(()=>{\n // eslint-disable-next-line eqeqeq\n if (element == null) {\n return;\n }\n if (!disabled) {\n element.addEventListener(MENU_ENTER_EVENT, listener);\n }\n return ()=>{\n element.removeEventListener(MENU_ENTER_EVENT, listener);\n };\n }, [\n listener,\n element,\n 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 */ export const dispatchMenuEnterEvent = (el, nativeEvent)=>{\n el.dispatchEvent(new CustomEvent(MENU_ENTER_EVENT, {\n bubbles: true,\n detail: {\n nativeEvent\n }\n }));\n};\n"],"names":["MENU_ENTER_EVENT","useOnMenuMouseEnter","dispatchMenuEnterEvent","options","refs","callback","element","disabled","listener","useEventCallback","ev","popoverRef","someMenuPopover","target","_popoverRef_current","isOutsidePopover","elementContains","current","React","useEffect","addEventListener","removeEventListener","el","nativeEvent","dispatchEvent","CustomEvent","bubbles","detail"],"mappings":";;;;;;;;;;;IAIiBA,gBAAgB;eAAhBA;;IAWAC,mBAAmB;eAAnBA;;IAoCAC,sBAAsB;eAAtBA;;;;iEAnDM;gCAC2B;AAGvC,MAAMF,mBAAmB;AAWzB,MAAMC,sBAAsB,CAACE;IACpC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAC9C,gFAAgF;IAChF,MAAMK,WAAWC,IAAAA,gCAAgB,EAAC,CAACC;QAC/B,MAAMC,aAAaP,IAAI,CAAC,EAAE;QAC1B,MAAMQ,kBAAkBF,GAAGG,MAAM;QACjC,IAAIC;QACJ,sEAAsE;QACtE,0EAA0E;QAC1E,4DAA4D;QAC5D,MAAMC,mBAAmB,CAACC,IAAAA,+BAAe,EAAC,AAACF,CAAAA,sBAAsBH,WAAWM,OAAO,AAAD,MAAO,QAAQH,wBAAwB,KAAK,IAAIA,sBAAsB,MAAMF;QAC9J,IAAIG,oBAAoB,CAACR,UAAU;YAC/BF,SAASK;QACb;IACJ;IACAQ,OAAMC,SAAS,CAAC;QACZ,kCAAkC;QAClC,IAAIb,WAAW,MAAM;YACjB;QACJ;QACA,IAAI,CAACC,UAAU;YACXD,QAAQc,gBAAgB,CAACpB,kBAAkBQ;QAC/C;QACA,OAAO;YACHF,QAAQe,mBAAmB,CAACrB,kBAAkBQ;QAClD;IACJ,GAAG;QACCA;QACAF;QACAC;KACH;AACL;AAKW,MAAML,yBAAyB,CAACoB,IAAIC;IAC3CD,GAAGE,aAAa,CAAC,IAAIC,YAAYzB,kBAAkB;QAC/C0B,SAAS;QACTC,QAAQ;YACJJ;QACJ;IACJ;AACJ"}
1
+ {"version":3,"sources":["useOnMenuEnter.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback, elementContains } from '@fluentui/react-utilities';\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"],"names":["MENU_ENTER_EVENT","dispatchMenuEnterEvent","useOnMenuMouseEnter","options","refs","callback","element","disabled","listener","useEventCallback","ev","popoverRef","someMenuPopover","target","isOutsidePopover","elementContains","current","React","useEffect","addEventListener","removeEventListener","el","nativeEvent","dispatchEvent","CustomEvent","bubbles","detail"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";;;;;;;;;;;IAOaA,gBAAAA;eAAAA;;IA2DAC,sBAAAA;eAAAA;;IA9CAC,mBAAAA;eAAAA;;;;iEApBU;gCAC2B;AAM3C,MAAMF,mBAAmB;AAazB,MAAME,sBAAsB,CAACC;IAClC,MAAM,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGJ;IAE9C,gFAAgF;IAChF,MAAMK,WAAWC,IAAAA,gCAAAA,EAAiB,CAACC;QACjC,MAAMC,aAAaP,IAAI,CAAC,EAAE;QAC1B,MAAMQ,kBAAkBF,GAAGG,MAAM;YAKSF;QAH1C,sEAAsE;QACtE,0EAA0E;QAC1E,4DAA4D;QAC5D,MAAMG,mBAAmB,CAACC,IAAAA,+BAAAA,EAAgBJ,CAAAA,sBAAAA,WAAWK,OAAO,AAAPA,MAAO,QAAlBL,wBAAAA,KAAAA,IAAAA,sBAAsB,MAAMC;QACtE,IAAIE,oBAAoB,CAACP,UAAU;YACjCF,SAASK;QACX;IACF;IAEAO,OAAMC,SAAS,CAAC;QACd,kCAAkC;QAClC,IAAIZ,WAAW,MAAM;YACnB;QACF;QAUA,IAAI,CAACC,UAAU;YACbD,QAAQa,gBAAgB,CAACnB,kBAAkBQ;QAC7C;QAEA,OAAO;YACLF,QAAQc,mBAAmB,CAACpB,kBAAkBQ;QAChD;IACF,GAAG;QAACA;QAAUF;QAASC;KAAS;AAClC;AAOO,MAAMN,yBAAyB,CAACoB,IAAiBC;IACtDD,GAAGE,aAAa,CAAC,IAAIC,YAAYxB,kBAAkB;QAAEyB,SAAS;QAAMC,QAAQ;YAAEJ;QAAY;IAAE;AAC9F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluentui/react-menu",
3
- "version": "9.14.8",
3
+ "version": "9.14.10",
4
4
  "description": "Fluent UI menu component",
5
5
  "main": "lib-commonjs/index.js",
6
6
  "module": "lib/index.js",
@@ -37,16 +37,16 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@fluentui/keyboard-keys": "^9.0.7",
40
- "@fluentui/react-aria": "^9.12.1",
41
- "@fluentui/react-context-selector": "^9.1.62",
42
- "@fluentui/react-icons": "^2.0.239",
43
- "@fluentui/react-portal": "^9.4.28",
44
- "@fluentui/react-positioning": "^9.15.3",
45
- "@fluentui/react-shared-contexts": "^9.19.0",
46
- "@fluentui/react-tabster": "^9.22.0",
40
+ "@fluentui/react-aria": "^9.13.1",
41
+ "@fluentui/react-context-selector": "^9.1.64",
42
+ "@fluentui/react-icons": "^2.0.245",
43
+ "@fluentui/react-portal": "^9.4.30",
44
+ "@fluentui/react-positioning": "^9.15.5",
45
+ "@fluentui/react-shared-contexts": "^9.19.1",
46
+ "@fluentui/react-tabster": "^9.22.2",
47
47
  "@fluentui/react-theme": "^9.1.19",
48
- "@fluentui/react-utilities": "^9.18.10",
49
- "@fluentui/react-jsx-runtime": "^9.0.39",
48
+ "@fluentui/react-utilities": "^9.18.12",
49
+ "@fluentui/react-jsx-runtime": "^9.0.41",
50
50
  "@griffel/react": "^1.5.22",
51
51
  "@swc/helpers": "^0.5.1"
52
52
  },