@fluentui/react-menu 9.7.3 → 9.7.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (491) hide show
  1. package/.swcrc +30 -0
  2. package/CHANGELOG.json +139 -1
  3. package/CHANGELOG.md +38 -2
  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 +1 -0
  16. package/lib/components/Menu/Menu.js.map +1 -1
  17. package/lib/components/Menu/Menu.types.js +1 -1
  18. package/lib/components/Menu/Menu.types.js.map +1 -1
  19. package/lib/components/Menu/index.js.map +1 -1
  20. package/lib/components/Menu/renderMenu.js.map +1 -1
  21. package/lib/components/Menu/useMenu.js +9 -8
  22. package/lib/components/Menu/useMenu.js.map +1 -1
  23. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  24. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  25. package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
  26. package/lib/components/MenuDivider/index.js.map +1 -1
  27. package/lib/components/MenuDivider/renderMenuDivider.js +1 -3
  28. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  29. package/lib/components/MenuDivider/useMenuDivider.js +1 -0
  30. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  31. package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  32. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  33. package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
  34. package/lib/components/MenuGroup/index.js.map +1 -1
  35. package/lib/components/MenuGroup/renderMenuGroup.js +1 -3
  36. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  37. package/lib/components/MenuGroup/useMenuGroup.js +1 -0
  38. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  39. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  40. package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  41. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  42. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  43. package/lib/components/MenuGroupHeader/index.js.map +1 -1
  44. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +1 -3
  45. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  46. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +1 -0
  47. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  48. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  49. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  50. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  51. package/lib/components/MenuItem/index.js.map +1 -1
  52. package/lib/components/MenuItem/renderMenuItem.js +1 -13
  53. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  54. package/lib/components/MenuItem/useCharacterSearch.js +3 -2
  55. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  56. package/lib/components/MenuItem/useMenuItem.js +7 -7
  57. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  58. package/lib/components/MenuItem/useMenuItemStyles.js +15 -2
  59. package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
  60. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  61. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  62. package/lib/components/MenuItemCheckbox/index.js.map +1 -1
  63. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +1 -11
  64. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  65. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +4 -4
  66. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  67. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  68. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  69. package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  70. package/lib/components/MenuItemRadio/index.js.map +1 -1
  71. package/lib/components/MenuItemRadio/renderMenuItemRadio.js +1 -11
  72. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  73. package/lib/components/MenuItemRadio/useMenuItemRadio.js +4 -4
  74. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  75. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  76. package/lib/components/MenuList/MenuList.js.map +1 -1
  77. package/lib/components/MenuList/MenuList.types.js +1 -1
  78. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  79. package/lib/components/MenuList/index.js.map +1 -1
  80. package/lib/components/MenuList/renderMenuList.js +1 -3
  81. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  82. package/lib/components/MenuList/useMenuList.js +6 -5
  83. package/lib/components/MenuList/useMenuList.js.map +1 -1
  84. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  85. package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
  86. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  87. package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
  88. package/lib/components/MenuPopover/index.js.map +1 -1
  89. package/lib/components/MenuPopover/renderMenuPopover.js +2 -6
  90. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  91. package/lib/components/MenuPopover/useMenuPopover.js +4 -4
  92. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  93. package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  94. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  95. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  96. package/lib/components/MenuSplitGroup/index.js.map +1 -1
  97. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +1 -3
  98. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  99. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +2 -2
  100. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  101. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  102. package/lib/components/MenuTrigger/MenuTrigger.js +1 -0
  103. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  104. package/lib/components/MenuTrigger/MenuTrigger.types.js +1 -1
  105. package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  106. package/lib/components/MenuTrigger/index.js.map +1 -1
  107. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  108. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  109. package/lib/components/index.js.map +1 -1
  110. package/lib/contexts/menuContext.js +1 -0
  111. package/lib/contexts/menuContext.js.map +1 -1
  112. package/lib/contexts/menuGroupContext.js +2 -4
  113. package/lib/contexts/menuGroupContext.js.map +1 -1
  114. package/lib/contexts/menuListContext.js +1 -0
  115. package/lib/contexts/menuListContext.js.map +1 -1
  116. package/lib/contexts/menuTriggerContext.js +2 -4
  117. package/lib/contexts/menuTriggerContext.js.map +1 -1
  118. package/lib/index.js.map +1 -1
  119. package/lib/selectable/index.js.map +1 -1
  120. package/lib/selectable/types.js +1 -1
  121. package/lib/selectable/types.js.map +1 -1
  122. package/lib/selectable/useCheckmarkStyles.js.map +1 -1
  123. package/lib/utils/index.js.map +1 -1
  124. package/lib/utils/useIsSubmenu.js.map +1 -1
  125. package/lib/utils/useOnMenuEnter.js +2 -2
  126. package/lib/utils/useOnMenuEnter.js.map +1 -1
  127. package/lib-commonjs/Menu.js +5 -4
  128. package/lib-commonjs/Menu.js.map +1 -1
  129. package/lib-commonjs/MenuDivider.js +5 -4
  130. package/lib-commonjs/MenuDivider.js.map +1 -1
  131. package/lib-commonjs/MenuGroup.js +5 -4
  132. package/lib-commonjs/MenuGroup.js.map +1 -1
  133. package/lib-commonjs/MenuGroupHeader.js +5 -4
  134. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  135. package/lib-commonjs/MenuItem.js +5 -4
  136. package/lib-commonjs/MenuItem.js.map +1 -1
  137. package/lib-commonjs/MenuItemCheckbox.js +5 -4
  138. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  139. package/lib-commonjs/MenuItemRadio.js +5 -4
  140. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  141. package/lib-commonjs/MenuList.js +5 -4
  142. package/lib-commonjs/MenuList.js.map +1 -1
  143. package/lib-commonjs/MenuPopover.js +5 -4
  144. package/lib-commonjs/MenuPopover.js.map +1 -1
  145. package/lib-commonjs/MenuSplitGroup.js +5 -4
  146. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  147. package/lib-commonjs/MenuTrigger.js +5 -4
  148. package/lib-commonjs/MenuTrigger.js.map +1 -1
  149. package/lib-commonjs/components/Menu/Menu.js +16 -15
  150. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  151. package/lib-commonjs/components/Menu/Menu.types.js +5 -2
  152. package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
  153. package/lib-commonjs/components/Menu/index.js +9 -8
  154. package/lib-commonjs/components/Menu/index.js.map +1 -1
  155. package/lib-commonjs/components/Menu/renderMenu.js +14 -14
  156. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  157. package/lib-commonjs/components/Menu/useMenu.js +258 -256
  158. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  159. package/lib-commonjs/components/Menu/useMenuContextValues.js +29 -43
  160. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  161. package/lib-commonjs/components/MenuDivider/MenuDivider.js +19 -20
  162. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  163. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js +3 -2
  164. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  165. package/lib-commonjs/components/MenuDivider/index.js +9 -8
  166. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  167. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +13 -19
  168. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  169. package/lib-commonjs/components/MenuDivider/useMenuDivider.js +22 -21
  170. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  171. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +47 -25
  172. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  173. package/lib-commonjs/components/MenuGroup/MenuGroup.js +21 -22
  174. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  175. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js +3 -2
  176. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  177. package/lib-commonjs/components/MenuGroup/index.js +10 -9
  178. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  179. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +16 -22
  180. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  181. package/lib-commonjs/components/MenuGroup/useMenuGroup.js +23 -22
  182. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  183. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +18 -15
  184. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  185. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +19 -11
  186. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  187. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +19 -20
  188. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  189. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js +3 -2
  190. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  191. package/lib-commonjs/components/MenuGroupHeader/index.js +9 -8
  192. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  193. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +13 -19
  194. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  195. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +22 -23
  196. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  197. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +47 -25
  198. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  199. package/lib-commonjs/components/MenuItem/MenuItem.js +19 -20
  200. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  201. package/lib-commonjs/components/MenuItem/MenuItem.types.js +3 -2
  202. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  203. package/lib-commonjs/components/MenuItem/index.js +9 -8
  204. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  205. package/lib-commonjs/components/MenuItem/renderMenuItem.js +13 -28
  206. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  207. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +24 -22
  208. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  209. package/lib-commonjs/components/MenuItem/useMenuItem.js +97 -104
  210. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  211. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +318 -137
  212. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
  213. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +19 -20
  214. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  215. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js +3 -2
  216. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  217. package/lib-commonjs/components/MenuItemCheckbox/index.js +9 -8
  218. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  219. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +13 -24
  220. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  221. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +44 -45
  222. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  223. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +38 -30
  224. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  225. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +19 -20
  226. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  227. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js +3 -2
  228. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  229. package/lib-commonjs/components/MenuItemRadio/index.js +9 -8
  230. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  231. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +13 -27
  232. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  233. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +42 -45
  234. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  235. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +38 -30
  236. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  237. package/lib-commonjs/components/MenuList/MenuList.js +21 -22
  238. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  239. package/lib-commonjs/components/MenuList/MenuList.types.js +5 -2
  240. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  241. package/lib-commonjs/components/MenuList/index.js +10 -9
  242. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  243. package/lib-commonjs/components/MenuList/renderMenuList.js +16 -21
  244. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  245. package/lib-commonjs/components/MenuList/useMenuList.js +143 -137
  246. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  247. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +20 -25
  248. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  249. package/lib-commonjs/components/MenuList/useMenuListStyles.js +33 -23
  250. package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
  251. package/lib-commonjs/components/MenuPopover/MenuPopover.js +19 -20
  252. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  253. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +3 -2
  254. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  255. package/lib-commonjs/components/MenuPopover/index.js +9 -8
  256. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  257. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +19 -26
  258. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  259. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +102 -110
  260. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  261. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +121 -50
  262. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  263. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +19 -20
  264. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  265. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +3 -2
  266. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  267. package/lib-commonjs/components/MenuSplitGroup/index.js +9 -8
  268. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  269. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +13 -18
  270. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  271. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +58 -64
  272. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  273. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +61 -32
  274. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  275. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +15 -15
  276. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  277. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js +5 -2
  278. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  279. package/lib-commonjs/components/MenuTrigger/index.js +8 -7
  280. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  281. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +14 -16
  282. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  283. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +163 -170
  284. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  285. package/lib-commonjs/components/index.js +6 -5
  286. package/lib-commonjs/components/index.js.map +1 -1
  287. package/lib-commonjs/contexts/menuContext.js +38 -27
  288. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  289. package/lib-commonjs/contexts/menuGroupContext.js +19 -12
  290. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  291. package/lib-commonjs/contexts/menuListContext.js +25 -14
  292. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  293. package/lib-commonjs/contexts/menuTriggerContext.js +18 -12
  294. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  295. package/lib-commonjs/index.js +91 -399
  296. package/lib-commonjs/index.js.map +1 -1
  297. package/lib-commonjs/selectable/index.js +6 -5
  298. package/lib-commonjs/selectable/index.js.map +1 -1
  299. package/lib-commonjs/selectable/types.js +5 -2
  300. package/lib-commonjs/selectable/types.js.map +1 -1
  301. package/lib-commonjs/selectable/useCheckmarkStyles.js +28 -26
  302. package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
  303. package/lib-commonjs/utils/index.js +5 -4
  304. package/lib-commonjs/utils/index.js.map +1 -1
  305. package/lib-commonjs/utils/useIsSubmenu.js +13 -19
  306. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  307. package/lib-commonjs/utils/useOnMenuEnter.js +57 -68
  308. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  309. package/package.json +15 -14
  310. package/lib-amd/Menu.js +0 -6
  311. package/lib-amd/Menu.js.map +0 -1
  312. package/lib-amd/MenuDivider.js +0 -6
  313. package/lib-amd/MenuDivider.js.map +0 -1
  314. package/lib-amd/MenuGroup.js +0 -6
  315. package/lib-amd/MenuGroup.js.map +0 -1
  316. package/lib-amd/MenuGroupHeader.js +0 -6
  317. package/lib-amd/MenuGroupHeader.js.map +0 -1
  318. package/lib-amd/MenuItem.js +0 -6
  319. package/lib-amd/MenuItem.js.map +0 -1
  320. package/lib-amd/MenuItemCheckbox.js +0 -6
  321. package/lib-amd/MenuItemCheckbox.js.map +0 -1
  322. package/lib-amd/MenuItemRadio.js +0 -6
  323. package/lib-amd/MenuItemRadio.js.map +0 -1
  324. package/lib-amd/MenuList.js +0 -6
  325. package/lib-amd/MenuList.js.map +0 -1
  326. package/lib-amd/MenuPopover.js +0 -6
  327. package/lib-amd/MenuPopover.js.map +0 -1
  328. package/lib-amd/MenuSplitGroup.js +0 -6
  329. package/lib-amd/MenuSplitGroup.js.map +0 -1
  330. package/lib-amd/MenuTrigger.js +0 -6
  331. package/lib-amd/MenuTrigger.js.map +0 -1
  332. package/lib-amd/components/Menu/Menu.js +0 -16
  333. package/lib-amd/components/Menu/Menu.js.map +0 -1
  334. package/lib-amd/components/Menu/Menu.types.js +0 -5
  335. package/lib-amd/components/Menu/Menu.types.js.map +0 -1
  336. package/lib-amd/components/Menu/index.js +0 -10
  337. package/lib-amd/components/Menu/index.js.map +0 -1
  338. package/lib-amd/components/Menu/renderMenu.js +0 -15
  339. package/lib-amd/components/Menu/renderMenu.js.map +0 -1
  340. package/lib-amd/components/Menu/useMenu.js +0 -224
  341. package/lib-amd/components/Menu/useMenu.js.map +0 -1
  342. package/lib-amd/components/Menu/useMenuContextValues.js +0 -29
  343. package/lib-amd/components/Menu/useMenuContextValues.js.map +0 -1
  344. package/lib-amd/components/MenuDivider/MenuDivider.js +0 -17
  345. package/lib-amd/components/MenuDivider/MenuDivider.js.map +0 -1
  346. package/lib-amd/components/MenuDivider/MenuDivider.types.js +0 -5
  347. package/lib-amd/components/MenuDivider/MenuDivider.types.js.map +0 -1
  348. package/lib-amd/components/MenuDivider/index.js +0 -10
  349. package/lib-amd/components/MenuDivider/index.js.map +0 -1
  350. package/lib-amd/components/MenuDivider/renderMenuDivider.js +0 -15
  351. package/lib-amd/components/MenuDivider/renderMenuDivider.js.map +0 -1
  352. package/lib-amd/components/MenuDivider/useMenuDivider.js +0 -18
  353. package/lib-amd/components/MenuDivider/useMenuDivider.js.map +0 -1
  354. package/lib-amd/components/MenuDivider/useMenuDividerStyles.js +0 -18
  355. package/lib-amd/components/MenuDivider/useMenuDividerStyles.js.map +0 -1
  356. package/lib-amd/components/MenuGroup/MenuGroup.js +0 -18
  357. package/lib-amd/components/MenuGroup/MenuGroup.js.map +0 -1
  358. package/lib-amd/components/MenuGroup/MenuGroup.types.js +0 -5
  359. package/lib-amd/components/MenuGroup/MenuGroup.types.js.map +0 -1
  360. package/lib-amd/components/MenuGroup/index.js +0 -11
  361. package/lib-amd/components/MenuGroup/index.js.map +0 -1
  362. package/lib-amd/components/MenuGroup/renderMenuGroup.js +0 -16
  363. package/lib-amd/components/MenuGroup/renderMenuGroup.js.map +0 -1
  364. package/lib-amd/components/MenuGroup/useMenuGroup.js +0 -20
  365. package/lib-amd/components/MenuGroup/useMenuGroup.js.map +0 -1
  366. package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js +0 -12
  367. package/lib-amd/components/MenuGroup/useMenuGroupContextValues.js.map +0 -1
  368. package/lib-amd/components/MenuGroup/useMenuGroupStyles.js +0 -14
  369. package/lib-amd/components/MenuGroup/useMenuGroupStyles.js.map +0 -1
  370. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js +0 -17
  371. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.js.map +0 -1
  372. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js +0 -5
  373. package/lib-amd/components/MenuGroupHeader/MenuGroupHeader.types.js.map +0 -1
  374. package/lib-amd/components/MenuGroupHeader/index.js +0 -10
  375. package/lib-amd/components/MenuGroupHeader/index.js.map +0 -1
  376. package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js +0 -15
  377. package/lib-amd/components/MenuGroupHeader/renderMenuGroupHeader.js.map +0 -1
  378. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js +0 -19
  379. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeader.js.map +0 -1
  380. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +0 -27
  381. package/lib-amd/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +0 -1
  382. package/lib-amd/components/MenuItem/MenuItem.js +0 -17
  383. package/lib-amd/components/MenuItem/MenuItem.js.map +0 -1
  384. package/lib-amd/components/MenuItem/MenuItem.types.js +0 -5
  385. package/lib-amd/components/MenuItem/MenuItem.types.js.map +0 -1
  386. package/lib-amd/components/MenuItem/index.js +0 -10
  387. package/lib-amd/components/MenuItem/index.js.map +0 -1
  388. package/lib-amd/components/MenuItem/renderMenuItem.js +0 -19
  389. package/lib-amd/components/MenuItem/renderMenuItem.js.map +0 -1
  390. package/lib-amd/components/MenuItem/useCharacterSearch.js +0 -22
  391. package/lib-amd/components/MenuItem/useCharacterSearch.js.map +0 -1
  392. package/lib-amd/components/MenuItem/useMenuItem.js +0 -75
  393. package/lib-amd/components/MenuItem/useMenuItem.js.map +0 -1
  394. package/lib-amd/components/MenuItem/useMenuItemStyles.js +0 -109
  395. package/lib-amd/components/MenuItem/useMenuItemStyles.js.map +0 -1
  396. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -17
  397. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.js.map +0 -1
  398. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js +0 -5
  399. package/lib-amd/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +0 -1
  400. package/lib-amd/components/MenuItemCheckbox/index.js +0 -10
  401. package/lib-amd/components/MenuItemCheckbox/index.js.map +0 -1
  402. package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js +0 -16
  403. package/lib-amd/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +0 -1
  404. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js +0 -26
  405. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +0 -1
  406. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -31
  407. package/lib-amd/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +0 -1
  408. package/lib-amd/components/MenuItemRadio/MenuItemRadio.js +0 -17
  409. package/lib-amd/components/MenuItemRadio/MenuItemRadio.js.map +0 -1
  410. package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js +0 -5
  411. package/lib-amd/components/MenuItemRadio/MenuItemRadio.types.js.map +0 -1
  412. package/lib-amd/components/MenuItemRadio/index.js +0 -10
  413. package/lib-amd/components/MenuItemRadio/index.js.map +0 -1
  414. package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js +0 -19
  415. package/lib-amd/components/MenuItemRadio/renderMenuItemRadio.js.map +0 -1
  416. package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js +0 -27
  417. package/lib-amd/components/MenuItemRadio/useMenuItemRadio.js.map +0 -1
  418. package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -31
  419. package/lib-amd/components/MenuItemRadio/useMenuItemRadioStyles.js.map +0 -1
  420. package/lib-amd/components/MenuList/MenuList.js +0 -18
  421. package/lib-amd/components/MenuList/MenuList.js.map +0 -1
  422. package/lib-amd/components/MenuList/MenuList.types.js +0 -5
  423. package/lib-amd/components/MenuList/MenuList.types.js.map +0 -1
  424. package/lib-amd/components/MenuList/index.js +0 -11
  425. package/lib-amd/components/MenuList/index.js.map +0 -1
  426. package/lib-amd/components/MenuList/renderMenuList.js +0 -15
  427. package/lib-amd/components/MenuList/renderMenuList.js.map +0 -1
  428. package/lib-amd/components/MenuList/useMenuList.js +0 -125
  429. package/lib-amd/components/MenuList/useMenuList.js.map +0 -1
  430. package/lib-amd/components/MenuList/useMenuListContextValues.js +0 -20
  431. package/lib-amd/components/MenuList/useMenuListContextValues.js.map +0 -1
  432. package/lib-amd/components/MenuList/useMenuListStyles.js +0 -21
  433. package/lib-amd/components/MenuList/useMenuListStyles.js.map +0 -1
  434. package/lib-amd/components/MenuPopover/MenuPopover.js +0 -17
  435. package/lib-amd/components/MenuPopover/MenuPopover.js.map +0 -1
  436. package/lib-amd/components/MenuPopover/MenuPopover.types.js +0 -5
  437. package/lib-amd/components/MenuPopover/MenuPopover.types.js.map +0 -1
  438. package/lib-amd/components/MenuPopover/index.js +0 -10
  439. package/lib-amd/components/MenuPopover/index.js.map +0 -1
  440. package/lib-amd/components/MenuPopover/renderMenuPopover.js +0 -18
  441. package/lib-amd/components/MenuPopover/renderMenuPopover.js.map +0 -1
  442. package/lib-amd/components/MenuPopover/useMenuPopover.js +0 -83
  443. package/lib-amd/components/MenuPopover/useMenuPopover.js.map +0 -1
  444. package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js +0 -21
  445. package/lib-amd/components/MenuPopover/useMenuPopoverStyles.js.map +0 -1
  446. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js +0 -17
  447. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.js.map +0 -1
  448. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js +0 -5
  449. package/lib-amd/components/MenuSplitGroup/MenuSplitGroup.types.js.map +0 -1
  450. package/lib-amd/components/MenuSplitGroup/index.js +0 -10
  451. package/lib-amd/components/MenuSplitGroup/index.js.map +0 -1
  452. package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js +0 -14
  453. package/lib-amd/components/MenuSplitGroup/renderMenuSplitGroup.js.map +0 -1
  454. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js +0 -47
  455. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroup.js.map +0 -1
  456. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js +0 -43
  457. package/lib-amd/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +0 -1
  458. package/lib-amd/components/MenuTrigger/MenuTrigger.js +0 -18
  459. package/lib-amd/components/MenuTrigger/MenuTrigger.js.map +0 -1
  460. package/lib-amd/components/MenuTrigger/MenuTrigger.types.js +0 -5
  461. package/lib-amd/components/MenuTrigger/MenuTrigger.types.js.map +0 -1
  462. package/lib-amd/components/MenuTrigger/index.js +0 -9
  463. package/lib-amd/components/MenuTrigger/index.js.map +0 -1
  464. package/lib-amd/components/MenuTrigger/renderMenuTrigger.js +0 -15
  465. package/lib-amd/components/MenuTrigger/renderMenuTrigger.js.map +0 -1
  466. package/lib-amd/components/MenuTrigger/useMenuTrigger.js +0 -112
  467. package/lib-amd/components/MenuTrigger/useMenuTrigger.js.map +0 -1
  468. package/lib-amd/components/index.js +0 -7
  469. package/lib-amd/components/index.js.map +0 -1
  470. package/lib-amd/contexts/menuContext.js +0 -32
  471. package/lib-amd/contexts/menuContext.js.map +0 -1
  472. package/lib-amd/contexts/menuGroupContext.js +0 -13
  473. package/lib-amd/contexts/menuGroupContext.js.map +0 -1
  474. package/lib-amd/contexts/menuListContext.js +0 -23
  475. package/lib-amd/contexts/menuListContext.js.map +0 -1
  476. package/lib-amd/contexts/menuTriggerContext.js +0 -14
  477. package/lib-amd/contexts/menuTriggerContext.js.map +0 -1
  478. package/lib-amd/index.js +0 -69
  479. package/lib-amd/index.js.map +0 -1
  480. package/lib-amd/selectable/index.js +0 -7
  481. package/lib-amd/selectable/index.js.map +0 -1
  482. package/lib-amd/selectable/types.js +0 -5
  483. package/lib-amd/selectable/types.js.map +0 -1
  484. package/lib-amd/selectable/useCheckmarkStyles.js +0 -28
  485. package/lib-amd/selectable/useCheckmarkStyles.js.map +0 -1
  486. package/lib-amd/utils/index.js +0 -6
  487. package/lib-amd/utils/index.js.map +0 -1
  488. package/lib-amd/utils/useIsSubmenu.js +0 -20
  489. package/lib-amd/utils/useIsSubmenu.js.map +0 -1
  490. package/lib-amd/utils/useOnMenuEnter.js +0 -59
  491. package/lib-amd/utils/useOnMenuEnter.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","react_utilities_1","react_tabster_1","react_context_selector_1","menuContext_1","menuContext_2","useMenuList_unstable","props","ref","findAllFocusable","useFocusFinders","menuContext","useMenuContextSelectors","hasMenuContext","useHasParentContext","MenuContext","focusAttributes","useArrowNavigationGroup","circular","ignoreDefaultKeydown","Tab","usingPropsAndMenuContext","console","warn","innerRef","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","_a","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","checkedValues","setCheckedValues","useControllableState","state","undefined","defaultState","defaultCheckedValues","initialState","handleCheckedValueChange","_b","onCheckedValueChange","toggleCheckbox","useEventCallback","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","getNativeElementProps","useMergedRefs","role","triggerId","hasIcons","hasCheckmarks","exports","useMenuContext_unstable","context","contextValue","isUsingPropsAndContext","val"],"sources":["../src/packages/react-components/react-menu/src/components/MenuList/useMenuList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: hasMenuContext } });\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? menuContext.checkedValues : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? menuContext.onCheckedValueChange : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAMA,MAAAE,eAAA,gBAAAF,OAAA;AACA,MAAAG,wBAAA,gBAAAH,OAAA;AACA,MAAAI,aAAA,gBAAAJ,OAAA;AACA,MAAAK,aAAA,gBAAAL,OAAA;AAGA;;;AAGO,MAAMM,oBAAoB,GAAGA,CAACC,KAAoB,EAAEC,GAA2B,KAAmB;;EACvG,MAAM;IAAEC;EAAgB,CAAE,GAAGP,eAAA,CAAAQ,eAAe,EAAE;EAC9C,MAAMC,WAAW,GAAGC,uBAAuB,EAAE;EAC7C,MAAMC,cAAc,GAAGV,wBAAA,CAAAW,mBAAmB,CAACT,aAAA,CAAAU,WAAW,CAAC;EACvD,MAAMC,eAAe,GAAGd,eAAA,CAAAe,uBAAuB,CAAC;IAAEC,QAAQ,EAAE,IAAI;IAAEC,oBAAoB,EAAE;MAAEC,GAAG,EAAEP;IAAc;EAAE,CAAE,CAAC;EAElH,IAAIQ,wBAAwB,CA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AAA9E,oBAAoB,GAAAA,oBAAA;AA8GjC;;;AAGA,MAAMM,uBAAuB,GAAGA,CAAA,KAAK;EACnC,MAAM0C,aAAa,GAAGlD,aAAA,CAAAiF,uBAAuB,CAACC,OAAO,IAAIA,OAAO,CAAChC,aAAa,CAAC;EAC/E,MAAMU,oBAAoB,GAAG5D,aAAA,CAAAiF,uBAAuB,CAACC,OAAO,IAAIA,OAAO,CAACtB,oBAAoB,CAAC;EAC7F,MAAMiB,SAAS,GAAG7E,aAAA,CAAAiF,uBAAuB,CAACC,OAAO,IAAIA,OAAO,CAACL,SAAS,CAAC;EACvE,MAAMC,QAAQ,GAAG9E,aAAA,CAAAiF,uBAAuB,CAACC,OAAO,IAAIA,OAAO,CAACJ,QAAQ,CAAC;EACrE,MAAMC,aAAa,GAAG/E,aAAA,CAAAiF,uBAAuB,CAACC,OAAO,IAAIA,OAAO,CAACH,aAAa,CAAC;EAE/E,OAAO;IACL7B,aAAa;IACbU,oBAAoB;IACpBiB,SAAS;IACTC,QAAQ;IACRC;GACD;AACH,CAAC;AAED;;;AAGA,MAAM9D,wBAAwB,GAAGA,CAC/Bd,KAAoB,EACpBgF,YAAwD,EACxD1E,cAAuB,KACrB;EACF,IAAI2E,sBAAsB,GAAG,KAAK;EAClC,KAAK,MAAMC,GAAG,IAAIF,YAAY,EAAE;IAC9B,IAAIhF,KAAK,CAACkF,GAA+F,CAAC,EAAE;MAC1GD,sBAAsB,GAAG,IAAI;;;EAIjC,OAAO3E,cAAc,IAAI2E,sBAAsB;AACjD,CAAC"}
1
+ {"version":3,"sources":["../../../lib/components/MenuList/useMenuList.js"],"sourcesContent":["import * as React from 'react';\nimport { useMergedRefs, useEventCallback, useControllableState, getNativeElementProps } from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props, ref) => {\n const {\n findAllFocusable\n } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n const focusAttributes = useArrowNavigationGroup({\n circular: true,\n ignoreDefaultKeydown: {\n Tab: hasMenuContext\n }\n });\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n const innerRef = React.useRef(null);\n const setFocusByFirstCharacter = React.useCallback((e, itemEl) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n const menuItems = findAllFocusable(innerRef.current, el => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')) !== -1);\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n const firstChars = menuItems.map(menuItem => {\n var _menuItem_textContent;\n return (_menuItem_textContent = menuItem.textContent) === null || _menuItem_textContent === void 0 ? void 0 : _menuItem_textContent.charAt(0).toLowerCase();\n });\n const char = e.key.toLowerCase();\n const getIndexFirstChars = (start, firstChar) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n }, [findAllFocusable]);\n var _props_checkedValues;\n const [checkedValues, setCheckedValues] = useControllableState({\n state: (_props_checkedValues = props.checkedValues) !== null && _props_checkedValues !== void 0 ? _props_checkedValues : hasMenuContext ? menuContext.checkedValues : undefined,\n defaultState: props.defaultCheckedValues,\n initialState: {}\n });\n var _props_onCheckedValueChange;\n const handleCheckedValueChange = (_props_onCheckedValueChange = props.onCheckedValueChange) !== null && _props_onCheckedValueChange !== void 0 ? _props_onCheckedValueChange : hasMenuContext ? menuContext.onCheckedValueChange : undefined;\n const toggleCheckbox = useEventCallback((e, name, value, checked) => {\n const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {\n name,\n checkedItems: newCheckedItems\n });\n setCheckedValues(s => ({\n ...s,\n [name]: newCheckedItems\n }));\n });\n const selectRadio = useEventCallback((e, name, value) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({\n ...s,\n [name]: newCheckedItems\n }));\n handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {\n name,\n checkedItems: newCheckedItems\n });\n });\n return {\n components: {\n root: 'div'\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox\n };\n};\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks\n };\n};\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (props, contextValue, hasMenuContext) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val]) {\n isUsingPropsAndContext = true;\n }\n }\n return hasMenuContext && isUsingPropsAndContext;\n};\n//# sourceMappingURL=useMenuList.js.map"],"names":["useMenuList_unstable","props","ref","findAllFocusable","useFocusFinders","menuContext","useMenuContextSelectors","hasMenuContext","useHasParentContext","MenuContext","focusAttributes","useArrowNavigationGroup","circular","ignoreDefaultKeydown","Tab","usingPropsAndMenuContext","console","warn","innerRef","React","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","_menuItem_textContent","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","_props_checkedValues","checkedValues","setCheckedValues","useControllableState","state","undefined","defaultState","defaultCheckedValues","initialState","_props_onCheckedValueChange","handleCheckedValueChange","onCheckedValueChange","toggleCheckbox","useEventCallback","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","getNativeElementProps","useMergedRefs","role","triggerId","hasIcons","hasCheckmarks","useMenuContext_unstable","context","contextValue","isUsingPropsAndContext","val"],"mappings":";;;;+BASaA;;aAAAA;;;6DATU;gCACsE;8BACpC;sCACrB;6BACI;AAKjC,MAAMA,uBAAuB,CAACC,OAAOC,MAAQ;IAClD,MAAM,EACJC,iBAAgB,EACjB,GAAGC,IAAAA,6BAAe;IACnB,MAAMC,cAAcC;IACpB,MAAMC,iBAAiBC,IAAAA,yCAAmB,EAACC,wBAAW;IACtD,MAAMC,kBAAkBC,IAAAA,qCAAuB,EAAC;QAC9CC,UAAU,IAAI;QACdC,sBAAsB;YACpBC,KAAKP;QACP;IACF;IACA,IAAIQ,yBAAyBd,OAAOI,aAAaE,iBAAiB;QAChE,4CAA4C;QAC5C,sCAAsC;QACtCS,QAAQC,IAAI,CAAC;IACf,CAAC;IACD,MAAMC,WAAWC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3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useMenuListContextValues_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useMenuListContextValues_unstable
5
8
  });
6
- exports.useMenuListContextValues_unstable = void 0;
7
9
  function useMenuListContextValues_unstable(state) {
8
- const {
9
- checkedValues,
10
- hasCheckmarks,
11
- hasIcons,
12
- selectRadio,
13
- setFocusByFirstCharacter,
14
- toggleCheckbox
15
- } = state;
16
- // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
17
- const menuList = {
18
- checkedValues,
19
- hasCheckmarks,
20
- hasIcons,
21
- selectRadio,
22
- setFocusByFirstCharacter,
23
- toggleCheckbox
24
- };
25
- return {
26
- menuList
27
- };
28
- }
29
- exports.useMenuListContextValues_unstable = useMenuListContextValues_unstable;
10
+ const { checkedValues , hasCheckmarks , hasIcons , selectRadio , setFocusByFirstCharacter , toggleCheckbox } = state;
11
+ // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
12
+ const menuList = {
13
+ checkedValues,
14
+ hasCheckmarks,
15
+ hasIcons,
16
+ selectRadio,
17
+ setFocusByFirstCharacter,
18
+ toggleCheckbox
19
+ };
20
+ return {
21
+ menuList
22
+ };
23
+ } //# sourceMappingURL=useMenuListContextValues.js.map
24
+
30
25
  //# sourceMappingURL=useMenuListContextValues.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList","exports"],"sources":["../src/packages/react-components/react-menu/src/components/MenuList/useMenuListContextValues.ts"],"sourcesContent":["import type { MenuListContextValues, MenuListState } from './MenuList.types';\n\nexport function useMenuListContextValues_unstable(state: MenuListState): MenuListContextValues {\n const { checkedValues, hasCheckmarks, hasIcons, selectRadio, setFocusByFirstCharacter, toggleCheckbox } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox,\n };\n\n return { menuList };\n}\n"],"mappings":";;;;;;AAEA,SAAgBA,iCAAiCA,CAACC,KAAoB;EACpE,MAAM;IAAEC,aAAa;IAAEC,aAAa;IAAEC,QAAQ;IAAEC,WAAW;IAAEC,wBAAwB;IAAEC;EAAc,CAAE,GAAGN,KAAK;EAE/G;EACA,MAAMO,QAAQ,GAAG;IACfN,aAAa;IACbC,aAAa;IACbC,QAAQ;IACRC,WAAW;IACXC,wBAAwB;IACxBC;GACD;EAED,OAAO;IAAEC;EAAQ,CAAE;AACrB;AAdAC,OAAA,CAAAT,iCAAA,GAAAA,iCAAA"}
1
+ {"version":3,"sources":["../../../lib/components/MenuList/useMenuListContextValues.js"],"sourcesContent":["export function useMenuListContextValues_unstable(state) {\n const {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox\n } = state;\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox\n };\n return {\n menuList\n };\n}\n//# sourceMappingURL=useMenuListContextValues.js.map"],"names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList"],"mappings":";;;;+BAAgBA;;aAAAA;;AAAT,SAASA,kCAAkCC,KAAK,EAAE;IACvD,MAAM,EACJC,cAAa,EACbC,cAAa,EACbC,SAAQ,EACRC,YAAW,EACXC,yBAAwB,EACxBC,eAAc,EACf,GAAGN;IACJ,mGAAmG;IACnG,MAAMO,WAAW;QACfN;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IACA,OAAO;QACLC;IACF;AACF,EACA,oDAAoD"}
@@ -1,30 +1,40 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ function _export(target, all) {
6
+ for(var name in all)Object.defineProperty(target, name, {
7
+ enumerable: true,
8
+ get: all[name]
9
+ });
10
+ }
11
+ _export(exports, {
12
+ menuListClassNames: ()=>menuListClassNames,
13
+ useMenuListStyles_unstable: ()=>useMenuListStyles_unstable
5
14
  });
6
- exports.useMenuListStyles_unstable = exports.menuListClassNames = void 0;
7
- const react_1 = /*#__PURE__*/require("@griffel/react");
8
- exports.menuListClassNames = {
9
- root: 'fui-MenuList'
15
+ const _react = require("@griffel/react");
16
+ const menuListClassNames = {
17
+ root: 'fui-MenuList'
10
18
  };
11
- const useStyles = /*#__PURE__*/react_1.__styles({
12
- root: {
13
- mc9l5x: "f22iagw",
14
- Beiy3e4: "f1vx9l62",
15
- i8kkvl: "f16mnhsx",
16
- Belr9w4: "fbi42co"
17
- }
19
+ const useStyles = /*#__PURE__*/ (0, _react["__styles"])({
20
+ root: {
21
+ mc9l5x: "f22iagw",
22
+ Beiy3e4: "f1vx9l62",
23
+ i8kkvl: "f16mnhsx",
24
+ Belr9w4: "fbi42co"
25
+ }
18
26
  }, {
19
- d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f16mnhsx{-webkit-column-gap:2px;column-gap:2px;}", ".fbi42co{row-gap:2px;}"]
27
+ d: [
28
+ ".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}",
29
+ ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}",
30
+ ".f16mnhsx{-webkit-column-gap:2px;column-gap:2px;}",
31
+ ".fbi42co{row-gap:2px;}"
32
+ ]
20
33
  });
21
- /**
22
- * Apply styling to the Menu slots based on the state
23
- */
24
- const useMenuListStyles_unstable = state => {
25
- const styles = useStyles();
26
- state.root.className = react_1.mergeClasses(exports.menuListClassNames.root, styles.root, state.root.className);
27
- return state;
28
- };
29
- exports.useMenuListStyles_unstable = useMenuListStyles_unstable;
34
+ const useMenuListStyles_unstable = (state)=>{
35
+ const styles = useStyles();
36
+ state.root.className = (0, _react.mergeClasses)(menuListClassNames.root, styles.root, state.root.className);
37
+ return state;
38
+ }; //# sourceMappingURL=useMenuListStyles.js.map
39
+
30
40
  //# sourceMappingURL=useMenuListStyles.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["react_1","require","exports","menuListClassNames","root","useStyles","__styles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","d","useMenuListStyles_unstable","state","styles","className","mergeClasses"],"sources":["../src/packages/react-components/react-menu/src/components/MenuList/useMenuListStyles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport type { MenuListSlots, MenuListState } from './MenuList.types';\n\nexport const menuListClassNames: SlotClassNames<MenuListSlots> = {\n root: 'fui-MenuList',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.gap('2px'),\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuListStyles_unstable = (state: MenuListState): MenuListState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":";;;;;;AACA,MAAAA,OAAA,gBAAAC,OAAA;AAGaC,OAAA,CAAAC,kBAAkB,GAAkC;EAC/DC,IAAI,EAAE;CACP;AAED,MAAMC,SAAS,gBAAGL,OAAA,CAAAM,QAAU;EAAAF,IAAA;IAAAG,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAM1B;AAEF;;;AAGO,MAAMC,0BAA0B,GAAIC,KAAoB,IAAmB;EAChF,MAAMC,MAAM,GAAGT,SAAS,EAAE;EAC1BQ,KAAK,CAACT,IAAI,CAACW,SAAS,GAAGf,OAAA,CAAAgB,YAAY,CAACd,OAAA,CAAAC,kBAAkB,CAACC,IAAI,EAAEU,MAAM,CAACV,IAAI,EAAES,KAAK,CAACT,IAAI,CAACW,SAAS,CAAC;EAC/F,OAAOF,KAAK;AACd,CAAC;AAJYX,OAAA,CAAAU,0BAA0B,GAAAA,0BAAA"}
1
+ {"version":3,"sources":["../../../lib/components/MenuList/useMenuListStyles.js"],"sourcesContent":["import { mergeClasses, __styles, shorthands } from '@griffel/react';\nexport const menuListClassNames = {\n root: 'fui-MenuList'\n};\nconst useStyles = /*#__PURE__*/__styles({\n root: {\n mc9l5x: \"f22iagw\",\n Beiy3e4: \"f1vx9l62\",\n i8kkvl: \"f16mnhsx\",\n Belr9w4: \"fbi42co\"\n }\n}, {\n d: [\".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}\", \".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}\", \".f16mnhsx{-webkit-column-gap:2px;column-gap:2px;}\", \".fbi42co{row-gap:2px;}\"]\n});\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuListStyles_unstable = state => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n//# sourceMappingURL=useMenuListStyles.js.map"],"names":["menuListClassNames","useMenuListStyles_unstable","root","useStyles","__styles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","d","state","styles","className","mergeClasses"],"mappings":";;;;;;;;;;;IACaA,kBAAkB,MAAlBA;IAgBAC,0BAA0B,MAA1BA;;uBAjBsC;AAC5C,MAAMD,qBAAqB;IAChCE,MAAM;AACR;AACA,MAAMC,YAAY,WAAW,GAAEC,IAAAA,kBAAQ,EAAC;IACtCF,MAAM;QACJG,QAAQ;QACRC,SAAS;QACTC,QAAQ;QACRC,SAAS;IACX;AACF,GAAG;IACDC,GAAG;QAAC;QAAwF;QAA6F;QAAqD;KAAyB;AACzQ;AAIO,MAAMR,6BAA6BS,CAAAA,QAAS;IACjD,MAAMC,SAASR;IACfO,MAAMR,IAAI,CAACU,SAAS,GAAGC,IAAAA,mBAAY,EAACb,mBAAmBE,IAAI,EAAES,OAAOT,IAAI,EAAEQ,MAAMR,IAAI,CAACU,SAAS;IAC9F,OAAOF;AACT,GACA,6CAA6C"}
@@ -1,25 +1,24 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "MenuPopover", {
6
+ enumerable: true,
7
+ get: ()=>MenuPopover
5
8
  });
6
- exports.MenuPopover = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const useMenuPopover_1 = /*#__PURE__*/require("./useMenuPopover");
9
- const useMenuPopoverStyles_1 = /*#__PURE__*/require("./useMenuPopoverStyles");
10
- const renderMenuPopover_1 = /*#__PURE__*/require("./renderMenuPopover");
11
- const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
12
- /**
13
- * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus
14
- */
15
- exports.MenuPopover = /*#__PURE__*/React.forwardRef((props, ref) => {
16
- const state = useMenuPopover_1.useMenuPopover_unstable(props, ref);
17
- useMenuPopoverStyles_1.useMenuPopoverStyles_unstable(state);
18
- const {
19
- useMenuPopoverStyles_unstable: useCustomStyles
20
- } = react_shared_contexts_1.useCustomStyleHooks_unstable();
21
- useCustomStyles(state);
22
- return renderMenuPopover_1.renderMenuPopover_unstable(state);
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _useMenuPopover = require("./useMenuPopover");
12
+ const _useMenuPopoverStyles = require("./useMenuPopoverStyles");
13
+ const _renderMenuPopover = require("./renderMenuPopover");
14
+ const _reactSharedContexts = require("@fluentui/react-shared-contexts");
15
+ const MenuPopover = /*#__PURE__*/ _react.forwardRef((props, ref)=>{
16
+ const state = (0, _useMenuPopover.useMenuPopover_unstable)(props, ref);
17
+ (0, _useMenuPopoverStyles.useMenuPopoverStyles_unstable)(state);
18
+ const { useMenuPopoverStyles_unstable: useCustomStyles } = (0, _reactSharedContexts.useCustomStyleHooks_unstable)();
19
+ useCustomStyles(state);
20
+ return (0, _renderMenuPopover.renderMenuPopover_unstable)(state);
23
21
  });
24
- exports.MenuPopover.displayName = 'MenuPopover';
22
+ MenuPopover.displayName = 'MenuPopover'; //# sourceMappingURL=MenuPopover.js.map
23
+
25
24
  //# sourceMappingURL=MenuPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","useMenuPopover_1","useMenuPopoverStyles_1","renderMenuPopover_1","react_shared_contexts_1","exports","MenuPopover","forwardRef","props","ref","state","useMenuPopover_unstable","useMenuPopoverStyles_unstable","useCustomStyles","useCustomStyleHooks_unstable","renderMenuPopover_unstable","displayName"],"sources":["../src/packages/react-components/react-menu/src/components/MenuPopover/MenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport type { MenuPopoverProps } from './MenuPopover.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover: ForwardRefComponent<MenuPopoverProps> = React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n\n useMenuPopoverStyles_unstable(state);\n\n const { useMenuPopoverStyles_unstable: useCustomStyles } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n\n return renderMenuPopover_unstable(state);\n});\n\nMenuPopover.displayName = 'MenuPopover';\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,gBAAA,gBAAAD,OAAA;AACA,MAAAE,sBAAA,gBAAAF,OAAA;AACA,MAAAG,mBAAA,gBAAAH,OAAA;AAGA,MAAAI,uBAAA,gBAAAJ,OAAA;AAEA;;;AAGaK,OAAA,CAAAC,WAAW,gBAA0CP,KAAK,CAACQ,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAChG,MAAMC,KAAK,GAAGT,gBAAA,CAAAU,uBAAuB,CAACH,KAAK,EAAEC,GAAG,CAAC;EAEjDP,sBAAA,CAAAU,6BAA6B,CAACF,KAAK,CAAC;EAEpC,MAAM;IAAEE,6BAA6B,EAAEC;EAAe,CAAE,GAAGT,uBAAA,CAAAU,4BAA4B,EAAE;EACzFD,eAAe,CAACH,KAAK,CAAC;EAEtB,OAAOP,mBAAA,CAAAY,0BAA0B,CAACL,KAAK,CAAC;AAC1C,CAAC,CAAC;AAEFL,OAAA,CAAAC,WAAW,CAACU,WAAW,GAAG,aAAa"}
1
+ {"version":3,"sources":["../../../lib/components/MenuPopover/MenuPopover.js"],"sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport { useCustomStyleHooks_unstable } from '@fluentui/react-shared-contexts';\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover = /*#__PURE__*/React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n useMenuPopoverStyles_unstable(state);\n const {\n useMenuPopoverStyles_unstable: useCustomStyles\n } = useCustomStyleHooks_unstable();\n useCustomStyles(state);\n return renderMenuPopover_unstable(state);\n});\nMenuPopover.displayName = 'MenuPopover';\n//# sourceMappingURL=MenuPopover.js.map"],"names":["MenuPopover","React","forwardRef","props","ref","state","useMenuPopover_unstable","useMenuPopoverStyles_unstable","useCustomStyles","useCustomStyleHooks_unstable","renderMenuPopover_unstable","displayName"],"mappings":";;;;+BAQaA;;aAAAA;;;6DARU;gCACiB;sCACM;mCACH;qCACE;AAItC,MAAMA,cAAc,WAAW,GAAEC,OAAMC,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACvE,MAAMC,QAAQC,IAAAA,uCAAuB,EAACH,OAAOC;IAC7CG,IAAAA,mDAA6B,EAACF;IAC9B,MAAM,EACJE,+BAA+BC,gBAAe,EAC/C,GAAGC,IAAAA,iDAA4B;IAChCD,gBAAgBH;IAChB,OAAOK,IAAAA,6CAA0B,EAACL;AACpC;AACAL,YAAYW,WAAW,GAAG,eAC1B,uCAAuC"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
5
+ //# sourceMappingURL=MenuPopover.types.js.map
6
+
6
7
  //# sourceMappingURL=MenuPopover.types.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../src/packages/react-components/react-menu/src/components/MenuPopover/MenuPopover.types.ts"],"sourcesContent":["import type { PortalProps } from '@fluentui/react-portal';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuPopoverSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * MenuPopover Props\n */\nexport type MenuPopoverProps = ComponentProps<MenuPopoverSlots>;\n\n/**\n * State used in rendering MenuPopover\n */\nexport type MenuPopoverState = ComponentState<MenuPopoverSlots> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order\n * This option is disregarded for submenus\n */\n inline: boolean;\n };\n"],"mappings":""}
1
+ {"version":3,"sources":["../../../lib/components/MenuPopover/MenuPopover.types.js"],"sourcesContent":["export {};\n//# sourceMappingURL=MenuPopover.types.js.map"],"names":[],"mappings":";;;;CACA,6CAA6C"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
5
4
  });
6
- const tslib_1 = /*#__PURE__*/require("tslib");
7
- tslib_1.__exportStar(require("./MenuPopover"), exports);
8
- tslib_1.__exportStar(require("./MenuPopover.types"), exports);
9
- tslib_1.__exportStar(require("./renderMenuPopover"), exports);
10
- tslib_1.__exportStar(require("./useMenuPopover"), exports);
11
- tslib_1.__exportStar(require("./useMenuPopoverStyles"), exports);
5
+ const _exportStar = require("@swc/helpers/lib/_export_star.js").default;
6
+ _exportStar(require("./MenuPopover"), exports);
7
+ _exportStar(require("./MenuPopover.types"), exports);
8
+ _exportStar(require("./renderMenuPopover"), exports);
9
+ _exportStar(require("./useMenuPopover"), exports);
10
+ _exportStar(require("./useMenuPopoverStyles"), exports);
11
+ //# sourceMappingURL=index.js.map
12
+
12
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["tslib_1","__exportStar","require","exports"],"sources":["../src/packages/react-components/react-menu/src/components/MenuPopover/index.ts"],"sourcesContent":["export * from './MenuPopover';\nexport * from './MenuPopover.types';\nexport * from './renderMenuPopover';\nexport * from './useMenuPopover';\nexport * from './useMenuPopoverStyles';\n"],"mappings":";;;;;;AAAAA,OAAA,CAAAC,YAAA,CAAAC,OAAA,mBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,yBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,sBAAAC,OAAA;AACAH,OAAA,CAAAC,YAAA,CAAAC,OAAA,4BAAAC,OAAA"}
1
+ {"version":3,"sources":["../../../lib/components/MenuPopover/index.js"],"sourcesContent":["export * from './MenuPopover';\nexport * from './MenuPopover.types';\nexport * from './renderMenuPopover';\nexport * from './useMenuPopover';\nexport * from './useMenuPopoverStyles';\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";;;;;oBAAc;oBACA;oBACA;oBACA;oBACA;CACd,iCAAiC"}
@@ -1,30 +1,23 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "renderMenuPopover_unstable", {
6
+ enumerable: true,
7
+ get: ()=>renderMenuPopover_unstable
5
8
  });
6
- exports.renderMenuPopover_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
9
- const react_portal_1 = /*#__PURE__*/require("@fluentui/react-portal");
10
- /**
11
- * Render the final JSX of MenuPopover
12
- */
13
- const renderMenuPopover_unstable = state => {
14
- const {
15
- slots,
16
- slotProps
17
- } = react_utilities_1.getSlots(state);
18
- if (state.inline) {
19
- return React.createElement(slots.root, {
20
- ...slotProps.root
21
- });
22
- }
23
- return React.createElement(react_portal_1.Portal, {
24
- mountNode: state.mountNode
25
- }, React.createElement(slots.root, {
26
- ...slotProps.root
27
- }));
28
- };
29
- exports.renderMenuPopover_unstable = renderMenuPopover_unstable;
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _reactUtilities = require("@fluentui/react-utilities");
12
+ const _reactPortal = require("@fluentui/react-portal");
13
+ const renderMenuPopover_unstable = (state)=>{
14
+ const { slots , slotProps } = (0, _reactUtilities.getSlots)(state);
15
+ if (state.inline) {
16
+ return /*#__PURE__*/ _react.createElement(slots.root, slotProps.root);
17
+ }
18
+ return /*#__PURE__*/ _react.createElement(_reactPortal.Portal, {
19
+ mountNode: state.mountNode
20
+ }, /*#__PURE__*/ _react.createElement(slots.root, slotProps.root));
21
+ }; //# sourceMappingURL=renderMenuPopover.js.map
22
+
30
23
  //# sourceMappingURL=renderMenuPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","require","react_utilities_1","react_portal_1","renderMenuPopover_unstable","state","slots","slotProps","getSlots","inline","createElement","root","Portal","mountNode","exports"],"sources":["../src/packages/react-components/react-menu/src/components/MenuPopover/renderMenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = (state: MenuPopoverState) => {\n const { slots, slotProps } = getSlots<MenuPopoverSlots>(state);\n\n if (state.inline) {\n return <slots.root {...slotProps.root} />;\n }\n\n return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root} />\n </Portal>\n );\n};\n"],"mappings":";;;;;;AAAA,MAAAA,KAAA,gBAAAC,OAAA;AACA,MAAAC,iBAAA,gBAAAD,OAAA;AAEA,MAAAE,cAAA,gBAAAF,OAAA;AAEA;;;AAGO,MAAMG,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGL,iBAAA,CAAAM,QAAQ,CAAmBH,KAAK,CAAC;EAE9D,IAAIA,KAAK,CAACI,MAAM,EAAE;IAChB,OAAOT,KAAA,CAAAU,aAAA,CAACJ,KAAK,CAACK,IAAI;MAAA,GAAKJ,SAAS,CAACI;IAAI,EAAI;;EAG3C,OACEX,KAAA,CAAAU,aAAA,CAACP,cAAA,CAAAS,MAAM;IAACC,SAAS,EAAER,KAAK,CAACQ;EAAS,GAChCb,KAAA,CAAAU,aAAA,CAACJ,KAAK,CAACK,IAAI;IAAA,GAAKJ,SAAS,CAACI;EAAI,EAAI,CAC3B;AAEb,CAAC;AAZYG,OAAA,CAAAV,0BAA0B,GAAAA,0BAAA"}
1
+ {"version":3,"sources":["../../../lib/components/MenuPopover/renderMenuPopover.js"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { Portal } from '@fluentui/react-portal';\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = state => {\n const {\n slots,\n slotProps\n } = getSlots(state);\n if (state.inline) {\n return /*#__PURE__*/React.createElement(slots.root, slotProps.root);\n }\n return /*#__PURE__*/React.createElement(Portal, {\n mountNode: state.mountNode\n }, /*#__PURE__*/React.createElement(slots.root, slotProps.root));\n};\n//# sourceMappingURL=renderMenuPopover.js.map"],"names":["renderMenuPopover_unstable","state","slots","slotProps","getSlots","inline","React","createElement","root","Portal","mountNode"],"mappings":";;;;+BAMaA;;aAAAA;;;6DANU;gCACE;6BACF;AAIhB,MAAMA,6BAA6BC,CAAAA,QAAS;IACjD,MAAM,EACJC,MAAK,EACLC,UAAS,EACV,GAAGC,IAAAA,wBAAQ,EAACH;IACb,IAAIA,MAAMI,MAAM,EAAE;QAChB,OAAO,WAAW,GAAEC,OAAMC,aAAa,CAACL,MAAMM,IAAI,EAAEL,UAAUK,IAAI;IACpE,CAAC;IACD,OAAO,WAAW,GAAEF,OAAMC,aAAa,CAACE,mBAAM,EAAE;QAC9CC,WAAWT,MAAMS,SAAS;IAC5B,GAAG,WAAW,GAAEJ,OAAMC,aAAa,CAACL,MAAMM,IAAI,EAAEL,UAAUK,IAAI;AAChE,GACA,6CAA6C"}
@@ -1,115 +1,107 @@
1
1
  "use strict";
2
-
3
2
  Object.defineProperty(exports, "__esModule", {
4
- value: true
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "useMenuPopover_unstable", {
6
+ enumerable: true,
7
+ get: ()=>useMenuPopover_unstable
5
8
  });
6
- exports.useMenuPopover_unstable = void 0;
7
- const React = /*#__PURE__*/require("react");
8
- const keyboard_keys_1 = /*#__PURE__*/require("@fluentui/keyboard-keys");
9
- const react_utilities_1 = /*#__PURE__*/require("@fluentui/react-utilities");
10
- const menuContext_1 = /*#__PURE__*/require("../../contexts/menuContext");
11
- const index_1 = /*#__PURE__*/require("../../utils/index");
12
- const react_shared_contexts_1 = /*#__PURE__*/require("@fluentui/react-shared-contexts");
13
- const useIsSubmenu_1 = /*#__PURE__*/require("../../utils/useIsSubmenu");
14
- /**
15
- * Create the state required to render MenuPopover.
16
- *
17
- * The returned state can be modified with hooks such as useMenuPopoverStyles_unstable,
18
- * before being passed to renderMenuPopover_unstable.
19
- *
20
- * @param props - props from this instance of MenuPopover
21
- * @param ref - reference to root HTMLElement of MenuPopover
22
- */
23
- const useMenuPopover_unstable = (props, ref) => {
24
- var _a;
25
- const popoverRef = menuContext_1.useMenuContext_unstable(context => context.menuPopoverRef);
26
- const setOpen = menuContext_1.useMenuContext_unstable(context => context.setOpen);
27
- const open = menuContext_1.useMenuContext_unstable(context => context.open);
28
- const openOnHover = menuContext_1.useMenuContext_unstable(context => context.openOnHover);
29
- const isSubmenu = useIsSubmenu_1.useIsSubmenu();
30
- const canDispatchCustomEventRef = React.useRef(true);
31
- const throttleDispatchTimerRef = React.useRef(0);
32
- const {
33
- dir
34
- } = react_shared_contexts_1.useFluent_unstable();
35
- const CloseArrowKey = dir === 'ltr' ? keyboard_keys_1.ArrowLeft : keyboard_keys_1.ArrowRight;
36
- // use DOM listener since react events propagate up the react tree
37
- // no need to do `contains` logic as menus are all positioned in different portals
38
- const mouseOverListenerCallbackRef = React.useCallback(node => {
39
- if (node) {
40
- // Dispatches the custom menu mouse enter event with throttling
41
- // Needs to trigger on mouseover to support keyboard + mouse together
42
- // i.e. keyboard opens submenus while cursor is still on the parent
43
- node.addEventListener('mouseover', e => {
44
- if (canDispatchCustomEventRef.current) {
45
- canDispatchCustomEventRef.current = false;
46
- index_1.dispatchMenuEnterEvent(popoverRef.current, e);
47
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
48
- // @ts-ignore #16889 Node setTimeout type leaking
49
- throttleDispatchTimerRef.current = setTimeout(() => canDispatchCustomEventRef.current = true, 250);
9
+ const _interopRequireWildcard = require("@swc/helpers/lib/_interop_require_wildcard.js").default;
10
+ const _react = /*#__PURE__*/ _interopRequireWildcard(require("react"));
11
+ const _keyboardKeys = require("@fluentui/keyboard-keys");
12
+ const _reactUtilities = require("@fluentui/react-utilities");
13
+ const _menuContext = require("../../contexts/menuContext");
14
+ const _index = require("../../utils/index");
15
+ const _reactSharedContexts = require("@fluentui/react-shared-contexts");
16
+ const _useIsSubmenu = require("../../utils/useIsSubmenu");
17
+ const useMenuPopover_unstable = (props, ref)=>{
18
+ const popoverRef = (0, _menuContext.useMenuContext_unstable)((context)=>context.menuPopoverRef);
19
+ const setOpen = (0, _menuContext.useMenuContext_unstable)((context)=>context.setOpen);
20
+ const open = (0, _menuContext.useMenuContext_unstable)((context)=>context.open);
21
+ const openOnHover = (0, _menuContext.useMenuContext_unstable)((context)=>context.openOnHover);
22
+ const isSubmenu = (0, _useIsSubmenu.useIsSubmenu)();
23
+ const canDispatchCustomEventRef = _react.useRef(true);
24
+ const throttleDispatchTimerRef = _react.useRef(0);
25
+ const { dir } = (0, _reactSharedContexts.useFluent_unstable)();
26
+ const CloseArrowKey = dir === 'ltr' ? _keyboardKeys.ArrowLeft : _keyboardKeys.ArrowRight;
27
+ // use DOM listener since react events propagate up the react tree
28
+ // no need to do `contains` logic as menus are all positioned in different portals
29
+ const mouseOverListenerCallbackRef = _react.useCallback((node)=>{
30
+ if (node) {
31
+ // Dispatches the custom menu mouse enter event with throttling
32
+ // Needs to trigger on mouseover to support keyboard + mouse together
33
+ // i.e. keyboard opens submenus while cursor is still on the parent
34
+ node.addEventListener('mouseover', (e)=>{
35
+ if (canDispatchCustomEventRef.current) {
36
+ canDispatchCustomEventRef.current = false;
37
+ (0, _index.dispatchMenuEnterEvent)(popoverRef.current, e);
38
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
+ // @ts-ignore #16889 Node setTimeout type leaking
40
+ throttleDispatchTimerRef.current = setTimeout(()=>canDispatchCustomEventRef.current = true, 250);
41
+ }
42
+ });
43
+ }
44
+ }, [
45
+ popoverRef,
46
+ throttleDispatchTimerRef
47
+ ]);
48
+ _react.useEffect(()=>{
49
+ ()=>clearTimeout(throttleDispatchTimerRef.current);
50
+ }, []);
51
+ var _useMenuContext_unstable;
52
+ const inline = (_useMenuContext_unstable = (0, _menuContext.useMenuContext_unstable)((context)=>context.inline)) !== null && _useMenuContext_unstable !== void 0 ? _useMenuContext_unstable : false;
53
+ const mountNode = (0, _menuContext.useMenuContext_unstable)((context)=>context.mountNode);
54
+ const rootProps = (0, _reactUtilities.getNativeElementProps)('div', {
55
+ role: 'presentation',
56
+ ...props,
57
+ ref: (0, _reactUtilities.useMergedRefs)(ref, popoverRef, mouseOverListenerCallbackRef)
58
+ });
59
+ const { onMouseEnter: onMouseEnterOriginal , onKeyDown: onKeyDownOriginal } = rootProps;
60
+ rootProps.onMouseEnter = (0, _reactUtilities.useEventCallback)((event)=>{
61
+ if (openOnHover) {
62
+ setOpen(event, {
63
+ open: true,
64
+ keyboard: false,
65
+ type: 'menuPopoverMouseEnter',
66
+ event
67
+ });
50
68
  }
51
- });
52
- }
53
- }, [popoverRef, throttleDispatchTimerRef]);
54
- React.useEffect(() => {
55
- () => clearTimeout(throttleDispatchTimerRef.current);
56
- }, []);
57
- const inline = (_a = menuContext_1.useMenuContext_unstable(context => context.inline)) !== null && _a !== void 0 ? _a : false;
58
- const mountNode = menuContext_1.useMenuContext_unstable(context => context.mountNode);
59
- const rootProps = react_utilities_1.getNativeElementProps('div', {
60
- role: 'presentation',
61
- ...props,
62
- ref: react_utilities_1.useMergedRefs(ref, popoverRef, mouseOverListenerCallbackRef)
63
- });
64
- const {
65
- onMouseEnter: onMouseEnterOriginal,
66
- onKeyDown: onKeyDownOriginal
67
- } = rootProps;
68
- rootProps.onMouseEnter = react_utilities_1.useEventCallback(event => {
69
- if (openOnHover) {
70
- setOpen(event, {
71
- open: true,
72
- keyboard: false,
73
- type: 'menuPopoverMouseEnter',
74
- event
75
- });
76
- }
77
- onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(event);
78
- });
79
- rootProps.onKeyDown = react_utilities_1.useEventCallback(event => {
80
- var _a;
81
- const key = event.key;
82
- if (key === keyboard_keys_1.Escape || isSubmenu && key === CloseArrowKey) {
83
- if (open && ((_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
84
- setOpen(event, {
85
- open: false,
86
- keyboard: true,
87
- type: 'menuPopoverKeyDown',
88
- event
89
- });
90
- // stop propagation to avoid conflicting with other elements that listen for `Escape`
91
- // e,g: Dialog, Popover and Tooltip
92
- event.stopPropagation();
93
- }
94
- }
95
- if (key === keyboard_keys_1.Tab) {
96
- setOpen(event, {
97
- open: false,
98
- keyboard: true,
99
- type: 'menuPopoverKeyDown',
100
- event
101
- });
102
- }
103
- onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(event);
104
- });
105
- return {
106
- inline,
107
- mountNode,
108
- components: {
109
- root: 'div'
110
- },
111
- root: rootProps
112
- };
113
- };
114
- exports.useMenuPopover_unstable = useMenuPopover_unstable;
69
+ onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(event);
70
+ });
71
+ rootProps.onKeyDown = (0, _reactUtilities.useEventCallback)((event)=>{
72
+ const key = event.key;
73
+ if (key === _keyboardKeys.Escape || isSubmenu && key === CloseArrowKey) {
74
+ var _popoverRef_current;
75
+ if (open && ((_popoverRef_current = popoverRef.current) === null || _popoverRef_current === void 0 ? void 0 : _popoverRef_current.contains(event.target))) {
76
+ setOpen(event, {
77
+ open: false,
78
+ keyboard: true,
79
+ type: 'menuPopoverKeyDown',
80
+ event
81
+ });
82
+ // stop propagation to avoid conflicting with other elements that listen for `Escape`
83
+ // e,g: Dialog, Popover and Tooltip
84
+ event.stopPropagation();
85
+ }
86
+ }
87
+ if (key === _keyboardKeys.Tab) {
88
+ setOpen(event, {
89
+ open: false,
90
+ keyboard: true,
91
+ type: 'menuPopoverKeyDown',
92
+ event
93
+ });
94
+ }
95
+ onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(event);
96
+ });
97
+ return {
98
+ inline,
99
+ mountNode,
100
+ components: {
101
+ root: 'div'
102
+ },
103
+ root: rootProps
104
+ };
105
+ }; //# sourceMappingURL=useMenuPopover.js.map
106
+
115
107
  //# sourceMappingURL=useMenuPopover.js.map