@fluentui/react-menu 9.5.3 → 9.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (285) hide show
  1. package/CHANGELOG.json +139 -1
  2. package/CHANGELOG.md +37 -2
  3. package/dist/index.d.ts +9 -19
  4. package/lib/components/Menu/Menu.js +0 -1
  5. package/lib/components/Menu/Menu.js.map +1 -1
  6. package/lib/components/Menu/renderMenu.js +0 -1
  7. package/lib/components/Menu/renderMenu.js.map +1 -1
  8. package/lib/components/Menu/useMenu.js +16 -34
  9. package/lib/components/Menu/useMenu.js.map +1 -1
  10. package/lib/components/Menu/useMenuContextValues.js +2 -2
  11. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  12. package/lib/components/MenuDivider/MenuDivider.js +0 -1
  13. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  14. package/lib/components/MenuDivider/renderMenuDivider.js +2 -2
  15. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  16. package/lib/components/MenuDivider/useMenuDivider.js +0 -1
  17. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  18. package/lib/components/MenuDivider/useMenuDividerStyles.js +10 -12
  19. package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  20. package/lib/components/MenuGroup/MenuGroup.js +0 -1
  21. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  22. package/lib/components/MenuGroup/renderMenuGroup.js +2 -2
  23. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  24. package/lib/components/MenuGroup/useMenuGroup.js +0 -1
  25. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  26. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  27. package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  28. package/lib/components/MenuGroupHeader/MenuGroupHeader.js +0 -1
  29. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  30. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -2
  31. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  32. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +0 -1
  33. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  34. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +10 -12
  35. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  36. package/lib/components/MenuItem/MenuItem.js +0 -1
  37. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  38. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  39. package/lib/components/MenuItem/renderMenuItem.js +12 -7
  40. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  41. package/lib/components/MenuItem/useCharacterSearch.js +0 -5
  42. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  43. package/lib/components/MenuItem/useMenuItem.js +34 -47
  44. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  45. package/lib/components/MenuItem/useMenuItemStyles.js +108 -117
  46. package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
  47. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -1
  48. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  49. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +10 -6
  50. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  51. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +2 -4
  52. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  53. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -5
  54. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  55. package/lib/components/MenuItemRadio/MenuItemRadio.js +0 -1
  56. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  57. package/lib/components/MenuItemRadio/renderMenuItemRadio.js +10 -6
  58. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  59. package/lib/components/MenuItemRadio/useMenuItemRadio.js +3 -4
  60. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  61. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -5
  62. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  63. package/lib/components/MenuList/MenuList.js +0 -1
  64. package/lib/components/MenuList/MenuList.js.map +1 -1
  65. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  66. package/lib/components/MenuList/renderMenuList.js +2 -2
  67. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  68. package/lib/components/MenuList/useMenuList.js +13 -29
  69. package/lib/components/MenuList/useMenuList.js.map +1 -1
  70. package/lib/components/MenuList/useMenuListContextValues.js +2 -2
  71. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  72. package/lib/components/MenuList/useMenuListStyles.js +6 -9
  73. package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
  74. package/lib/components/MenuPopover/MenuPopover.js +0 -1
  75. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  76. package/lib/components/MenuPopover/renderMenuPopover.js +4 -5
  77. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  78. package/lib/components/MenuPopover/useMenuPopover.js +6 -13
  79. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  80. package/lib/components/MenuPopover/useMenuPopoverStyles.js +32 -35
  81. package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  82. package/lib/components/MenuSplitGroup/MenuSplitGroup.js +0 -1
  83. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  84. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +2 -2
  85. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  86. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +0 -6
  87. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  88. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +12 -15
  89. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  90. package/lib/components/MenuTrigger/MenuTrigger.js +2 -3
  91. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  92. package/lib/components/MenuTrigger/renderMenuTrigger.js +0 -1
  93. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  94. package/lib/components/MenuTrigger/useMenuTrigger.js +4 -24
  95. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  96. package/lib/contexts/menuContext.js.map +1 -1
  97. package/lib/contexts/menuGroupContext.js +0 -1
  98. package/lib/contexts/menuGroupContext.js.map +1 -1
  99. package/lib/contexts/menuListContext.js.map +1 -1
  100. package/lib/contexts/menuTriggerContext.js +0 -2
  101. package/lib/contexts/menuTriggerContext.js.map +1 -1
  102. package/lib/index.js.map +1 -1
  103. package/lib/selectable/useCheckmarkStyles.js +7 -11
  104. package/lib/selectable/useCheckmarkStyles.js.map +1 -1
  105. package/lib/utils/useIsSubmenu.js +0 -1
  106. package/lib/utils/useIsSubmenu.js.map +1 -1
  107. package/lib/utils/useOnMenuEnter.js +4 -11
  108. package/lib/utils/useOnMenuEnter.js.map +1 -1
  109. package/lib-amd/components/MenuItem/MenuItem.types.js.map +1 -1
  110. package/lib-amd/components/MenuItem/useMenuItem.js +26 -30
  111. package/lib-amd/components/MenuItem/useMenuItem.js.map +1 -1
  112. package/lib-amd/components/MenuList/MenuList.types.js.map +1 -1
  113. package/lib-amd/components/MenuList/useMenuList.js +5 -4
  114. package/lib-amd/components/MenuList/useMenuList.js.map +1 -1
  115. package/lib-commonjs/Menu.js +0 -2
  116. package/lib-commonjs/Menu.js.map +1 -1
  117. package/lib-commonjs/MenuDivider.js +0 -2
  118. package/lib-commonjs/MenuDivider.js.map +1 -1
  119. package/lib-commonjs/MenuGroup.js +0 -2
  120. package/lib-commonjs/MenuGroup.js.map +1 -1
  121. package/lib-commonjs/MenuGroupHeader.js +0 -2
  122. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  123. package/lib-commonjs/MenuItem.js +0 -2
  124. package/lib-commonjs/MenuItem.js.map +1 -1
  125. package/lib-commonjs/MenuItemCheckbox.js +0 -2
  126. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  127. package/lib-commonjs/MenuItemRadio.js +0 -2
  128. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  129. package/lib-commonjs/MenuList.js +0 -2
  130. package/lib-commonjs/MenuList.js.map +1 -1
  131. package/lib-commonjs/MenuPopover.js +0 -2
  132. package/lib-commonjs/MenuPopover.js.map +1 -1
  133. package/lib-commonjs/MenuSplitGroup.js +0 -2
  134. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  135. package/lib-commonjs/MenuTrigger.js +0 -2
  136. package/lib-commonjs/MenuTrigger.js.map +1 -1
  137. package/lib-commonjs/components/Menu/Menu.js +0 -6
  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 +0 -6
  141. package/lib-commonjs/components/Menu/index.js.map +1 -1
  142. package/lib-commonjs/components/Menu/renderMenu.js +0 -5
  143. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  144. package/lib-commonjs/components/Menu/useMenu.js +16 -46
  145. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  146. package/lib-commonjs/components/Menu/useMenuContextValues.js +2 -4
  147. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  148. package/lib-commonjs/components/MenuDivider/MenuDivider.js +0 -6
  149. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  150. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  151. package/lib-commonjs/components/MenuDivider/index.js +0 -6
  152. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  153. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +2 -6
  154. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  155. package/lib-commonjs/components/MenuDivider/useMenuDivider.js +0 -4
  156. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  157. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +10 -16
  158. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  159. package/lib-commonjs/components/MenuGroup/MenuGroup.js +0 -7
  160. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  161. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  162. package/lib-commonjs/components/MenuGroup/index.js +0 -7
  163. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  164. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +2 -7
  165. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  166. package/lib-commonjs/components/MenuGroup/useMenuGroup.js +0 -4
  167. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  168. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +0 -3
  169. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  170. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +0 -4
  171. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  172. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +0 -6
  173. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  174. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  175. package/lib-commonjs/components/MenuGroupHeader/index.js +0 -6
  176. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  177. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -6
  178. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  179. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +0 -5
  180. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  181. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +10 -16
  182. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  183. package/lib-commonjs/components/MenuItem/MenuItem.js +0 -6
  184. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  185. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  186. package/lib-commonjs/components/MenuItem/index.js +0 -6
  187. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  188. package/lib-commonjs/components/MenuItem/renderMenuItem.js +12 -11
  189. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  190. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +0 -8
  191. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  192. package/lib-commonjs/components/MenuItem/useMenuItem.js +33 -58
  193. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  194. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +108 -124
  195. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
  196. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -6
  197. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  198. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  199. package/lib-commonjs/components/MenuItemCheckbox/index.js +0 -6
  200. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  201. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +10 -10
  202. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  203. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +2 -11
  204. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  205. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -11
  206. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  207. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +0 -6
  208. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  209. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  210. package/lib-commonjs/components/MenuItemRadio/index.js +0 -6
  211. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  212. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +10 -10
  213. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  214. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +3 -11
  215. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  216. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -11
  217. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  218. package/lib-commonjs/components/MenuList/MenuList.js +0 -7
  219. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  220. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  221. package/lib-commonjs/components/MenuList/index.js +0 -7
  222. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  223. package/lib-commonjs/components/MenuList/renderMenuList.js +2 -7
  224. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  225. package/lib-commonjs/components/MenuList/useMenuList.js +13 -37
  226. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  227. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +2 -4
  228. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  229. package/lib-commonjs/components/MenuList/useMenuListStyles.js +6 -12
  230. package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
  231. package/lib-commonjs/components/MenuPopover/MenuPopover.js +0 -6
  232. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  233. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  234. package/lib-commonjs/components/MenuPopover/index.js +0 -6
  235. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  236. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +4 -10
  237. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  238. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +6 -22
  239. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  240. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +32 -39
  241. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  242. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +0 -6
  243. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  244. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  245. package/lib-commonjs/components/MenuSplitGroup/index.js +0 -6
  246. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  247. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +2 -6
  248. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  249. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +0 -13
  250. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  251. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +12 -20
  252. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  253. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +2 -7
  254. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  255. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  256. package/lib-commonjs/components/MenuTrigger/index.js +0 -5
  257. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  258. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +0 -5
  259. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  260. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +4 -34
  261. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  262. package/lib-commonjs/components/index.js +0 -3
  263. package/lib-commonjs/components/index.js.map +1 -1
  264. package/lib-commonjs/contexts/menuContext.js +0 -4
  265. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  266. package/lib-commonjs/contexts/menuGroupContext.js +0 -5
  267. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  268. package/lib-commonjs/contexts/menuListContext.js +0 -4
  269. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  270. package/lib-commonjs/contexts/menuTriggerContext.js +0 -6
  271. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  272. package/lib-commonjs/index.js +0 -32
  273. package/lib-commonjs/index.js.map +1 -1
  274. package/lib-commonjs/selectable/index.js +0 -3
  275. package/lib-commonjs/selectable/index.js.map +1 -1
  276. package/lib-commonjs/selectable/types.js.map +1 -1
  277. package/lib-commonjs/selectable/useCheckmarkStyles.js +7 -13
  278. package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
  279. package/lib-commonjs/utils/index.js +0 -2
  280. package/lib-commonjs/utils/index.js.map +1 -1
  281. package/lib-commonjs/utils/useIsSubmenu.js +0 -6
  282. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  283. package/lib-commonjs/utils/useOnMenuEnter.js +4 -17
  284. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  285. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/contexts/menuGroupContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,MAAM,gBAAgB,gBAAG,KAAK,CAAC,aAAN,CACvB,SADuB,CAAzB;AAIA,MAAM,4BAA4B,GAA0B;EAC1D,QAAQ,EAAE;AADgD,CAA5D;AAeA,OAAO,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,QAAlD;AACP,OAAO,MAAM,4BAA4B,GAAG,MAAK;EAAA,IAAA,EAAA;;EAAC,OAAA,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,CAAiB,gBAAjB,CAAA,MAAkC,IAAlC,IAAkC,EAAA,KAAA,KAAA,CAAlC,GAAkC,EAAlC,GAAsC,4BAAtC;AAAkE,CAA7G","sourcesContent":["import * as React from 'react';\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue | undefined>(\n undefined,\n) as React.Context<MenuGroupContextValue>;\n\nconst menuGroupContextDefaultValue: MenuGroupContextValue = {\n headerId: '',\n};\n\n/**\n * Context used to guarantee correct aria-relationship between header\n * and group information\n */\nexport type MenuGroupContextValue = {\n /**\n * Element id applied to the `MenuGroupHeader` component\n */\n headerId: string;\n};\n\nexport const MenuGroupContextProvider = MenuGroupContext.Provider;\nexport const useMenuGroupContext_unstable = () => React.useContext(MenuGroupContext) ?? menuGroupContextDefaultValue;\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B,MAAMC,gBAAgB,gBAAGD,KAAK,CAACE,aAAa,CAC1CC,SAAS,CAC8B;AAEzC,MAAMC,4BAA4B,GAA0B;EAC1DC,QAAQ,EAAE;CACX;AAaD,OAAO,MAAMC,wBAAwB,GAAGL,gBAAgB,CAACM,QAAQ;AACjE,OAAO,MAAMC,4BAA4B,GAAG,MAAK;EAAA;EAAC,kBAAK,CAACC,UAAU,CAACR,gBAAgB,CAAC,mCAAIG,4BAA4B;AAAA","names":["React","MenuGroupContext","createContext","undefined","menuGroupContextDefaultValue","headerId","MenuGroupContextProvider","Provider","useMenuGroupContext_unstable","useContext"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/contexts/menuGroupContext.ts"],"sourcesContent":["import * as React from 'react';\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue | undefined>(\n undefined,\n) as React.Context<MenuGroupContextValue>;\n\nconst menuGroupContextDefaultValue: MenuGroupContextValue = {\n headerId: '',\n};\n\n/**\n * Context used to guarantee correct aria-relationship between header\n * and group information\n */\nexport type MenuGroupContextValue = {\n /**\n * Element id applied to the `MenuGroupHeader` component\n */\n headerId: string;\n};\n\nexport const MenuGroupContextProvider = MenuGroupContext.Provider;\nexport const useMenuGroupContext_unstable = () => React.useContext(MenuGroupContext) ?? menuGroupContextDefaultValue;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,eAAe,gBAAkC,aAAa,CACzE,SADyE,CAApE;AAIP,MAAM,2BAA2B,GAAyB;EACxD,aAAa,EAAE,EADyC;EAExD,wBAAwB,EAAE,MAAM,IAFwB;EAGxD,cAAc,EAAE,MAAM,IAHkC;EAIxD,WAAW,EAAE,MAAM,IAJqC;EAKxD,QAAQ,EAAE,KAL8C;EAMxD,aAAa,EAAE;AANyC,CAA1D;AA4BA,OAAO,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAzC;AAEP,OAAO,MAAM,2BAA2B,GAAQ,QAAL,IACzC,kBAAkB,CAAC,eAAD,EAAkB,CAAC,GAAG,GAAG,2BAAP,KAAuC,QAAQ,CAAC,GAAD,CAAjE,CADb","sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { SelectableHandler } from '../selectable/index';\nimport type { MenuCheckedValueChangeData, MenuCheckedValueChangeEvent, MenuListProps } from '../components/index';\n\nexport const MenuListContext: Context<MenuListContextValue> = createContext<MenuListContextValue | undefined>(\n undefined,\n) as Context<MenuListContextValue>;\n\nconst menuListContextDefaultValue: MenuListContextValue = {\n checkedValues: {},\n setFocusByFirstCharacter: () => null,\n toggleCheckbox: () => null,\n selectRadio: () => null,\n hasIcons: false,\n hasCheckmarks: false,\n};\n\n/**\n * Context shared between MenuList and its children components\n */\nexport type MenuListContextValue = Pick<MenuListProps, 'checkedValues' | 'hasIcons' | 'hasCheckmarks'> & {\n setFocusByFirstCharacter?: (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;\n toggleCheckbox?: SelectableHandler;\n selectRadio?: SelectableHandler;\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n *\n * @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n};\n\nexport const MenuListProvider = MenuListContext.Provider;\n\nexport const useMenuListContext_unstable = <T,>(selector: ContextSelector<MenuListContextValue, T>) =>\n useContextSelector(MenuListContext, (ctx = menuListContextDefaultValue) => selector(ctx));\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AACA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,kCAAkC;AAKpF,OAAO,MAAMC,eAAe,gBAAkCF,aAAa,CACzEG,SAAS,CACuB;AAElC,MAAMC,2BAA2B,GAAyB;EACxDC,aAAa,EAAE,EAAE;EACjBC,wBAAwB,EAAE,MAAM,IAAI;EACpCC,cAAc,EAAE,MAAM,IAAI;EAC1BC,WAAW,EAAE,MAAM,IAAI;EACvBC,QAAQ,EAAE,KAAK;EACfC,aAAa,EAAE;CAChB;AAqBD,OAAO,MAAMC,gBAAgB,GAAGT,eAAe,CAACU,QAAQ;AAExD,OAAO,MAAMC,2BAA2B,GAAQC,QAAkD,IAChGb,kBAAkB,CAACC,eAAe,EAAE,CAACa,GAAG,GAAGX,2BAA2B,KAAKU,QAAQ,CAACC,GAAG,CAAC,CAAC","names":["createContext","useContextSelector","MenuListContext","undefined","menuListContextDefaultValue","checkedValues","setFocusByFirstCharacter","toggleCheckbox","selectRadio","hasIcons","hasCheckmarks","MenuListProvider","Provider","useMenuListContext_unstable","selector","ctx"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/contexts/menuListContext.tsx"],"sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { SelectableHandler } from '../selectable/index';\nimport type { MenuCheckedValueChangeData, MenuCheckedValueChangeEvent, MenuListProps } from '../components/index';\n\nexport const MenuListContext: Context<MenuListContextValue> = createContext<MenuListContextValue | undefined>(\n undefined,\n) as Context<MenuListContextValue>;\n\nconst menuListContextDefaultValue: MenuListContextValue = {\n checkedValues: {},\n setFocusByFirstCharacter: () => null,\n toggleCheckbox: () => null,\n selectRadio: () => null,\n hasIcons: false,\n hasCheckmarks: false,\n};\n\n/**\n * Context shared between MenuList and its children components\n */\nexport type MenuListContextValue = Pick<MenuListProps, 'checkedValues' | 'hasIcons' | 'hasCheckmarks'> & {\n setFocusByFirstCharacter?: (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;\n toggleCheckbox?: SelectableHandler;\n selectRadio?: SelectableHandler;\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n *\n * @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n};\n\nexport const MenuListProvider = MenuListContext.Provider;\n\nexport const useMenuListContext_unstable = <T,>(selector: ContextSelector<MenuListContextValue, T>) =>\n useContextSelector(MenuListContext, (ctx = menuListContextDefaultValue) => selector(ctx));\n"]}
@@ -2,13 +2,11 @@ import * as React from 'react';
2
2
  /**
3
3
  * Context used communicate with a child menu item that it is a trigger for a submenu
4
4
  */
5
-
6
5
  const MenuTriggerContext = /*#__PURE__*/React.createContext(undefined);
7
6
  const menuTriggerContextDefaultValue = false;
8
7
  export const MenuTriggerContextProvider = MenuTriggerContext.Provider;
9
8
  export const useMenuTriggerContext_unstable = () => {
10
9
  var _a;
11
-
12
10
  return (_a = React.useContext(MenuTriggerContext)) !== null && _a !== void 0 ? _a : menuTriggerContextDefaultValue;
13
11
  };
14
12
  //# sourceMappingURL=menuTriggerContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/contexts/menuTriggerContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA;;AAEG;;AACH,MAAM,kBAAkB,gBAAG,KAAK,CAAC,aAAN,CAAyC,SAAzC,CAA3B;AAEA,MAAM,8BAA8B,GAAG,KAAvC;AAEA,OAAO,MAAM,0BAA0B,GAAG,kBAAkB,CAAC,QAAtD;AACP,OAAO,MAAM,8BAA8B,GAAG,MAAK;EAAA,IAAA,EAAA;;EACjD,OAAA,CAAA,EAAA,GAAA,KAAK,CAAC,UAAN,CAAiB,kBAAjB,CAAA,MAAoC,IAApC,IAAoC,EAAA,KAAA,KAAA,CAApC,GAAoC,EAApC,GAAwC,8BAAxC;AAAsE,CADjE","sourcesContent":["import * as React from 'react';\n\n/**\n * Context used communicate with a child menu item that it is a trigger for a submenu\n */\nconst MenuTriggerContext = React.createContext<boolean | undefined>(undefined) as React.Context<boolean>;\n\nconst menuTriggerContextDefaultValue = false;\n\nexport const MenuTriggerContextProvider = MenuTriggerContext.Provider;\nexport const useMenuTriggerContext_unstable = () =>\n React.useContext(MenuTriggerContext) ?? menuTriggerContextDefaultValue;\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAE9B;;;AAGA,MAAMC,kBAAkB,gBAAGD,KAAK,CAACE,aAAa,CAAsBC,SAAS,CAA2B;AAExG,MAAMC,8BAA8B,GAAG,KAAK;AAE5C,OAAO,MAAMC,0BAA0B,GAAGJ,kBAAkB,CAACK,QAAQ;AACrE,OAAO,MAAMC,8BAA8B,GAAG,MAAK;EAAA;EACjD,kBAAK,CAACC,UAAU,CAACP,kBAAkB,CAAC,mCAAIG,8BAA8B;AAAA","names":["React","MenuTriggerContext","createContext","undefined","menuTriggerContextDefaultValue","MenuTriggerContextProvider","Provider","useMenuTriggerContext_unstable","useContext"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/contexts/menuTriggerContext.ts"],"sourcesContent":["import * as React from 'react';\n\n/**\n * Context used communicate with a child menu item that it is a trigger for a submenu\n */\nconst MenuTriggerContext = React.createContext<boolean | undefined>(undefined) as React.Context<boolean>;\n\nconst menuTriggerContextDefaultValue = false;\n\nexport const MenuTriggerContextProvider = MenuTriggerContext.Provider;\nexport const useMenuTriggerContext_unstable = () =>\n React.useContext(MenuTriggerContext) ?? menuTriggerContextDefaultValue;\n"]}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/index.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,EAAuB,uBAAvB,QAAsD,wBAAtD;AAEA,SAAS,0BAAT,EAAqC,8BAArC,QAA2E,+BAA3E;AACA,SAAS,wBAAT,EAAmC,4BAAnC,QAAuE,6BAAvE;AAEA,SAAS,gBAAT,EAA2B,2BAA3B,QAA8D,4BAA9D;AAGA,SAAS,IAAT,EAAe,mBAAf,EAAoC,6BAApC,EAAmE,gBAAnE,QAA2F,QAA3F;AAYA,SACE,WADF,EAEE,qBAFF,EAGE,0BAHF,EAIE,6BAJF,EAKE,uBALF,QAMO,eANP;AAQA,SACE,SADF,EAEE,mBAFF,EAGE,wBAHF,EAIE,kCAJF,EAKE,2BALF,EAME,qBANF,QAOO,aAPP;AASA,SACE,eADF,EAEE,yBAFF,EAGE,8BAHF,EAIE,iCAJF,EAKE,2BALF,QAMO,mBANP;AAQA,SACE,QADF,EAEE,kBAFF,EAGE,uBAHF,EAIE,0BAJF,EAKE,oBALF,QAMO,YANP;AAQA,SACE,gBADF,EAEE,0BAFF,EAGE,+BAHF,EAIE,kCAJF,EAKE,4BALF,QAMO,oBANP;AAQA,SACE,aADF,EAEE,uBAFF,EAGE,4BAHF,EAIE,+BAJF,EAKE,yBALF,QAMO,iBANP;AAQA,SACE,QADF,EAEE,kBAFF,EAGE,uBAHF,EAIE,iCAJF,EAKE,0BALF,EAME,oBANF,QAOO,YAPP;AAmBA,SACE,WADF,EAEE,qBAFF,EAGE,0BAHF,EAIE,6BAJF,EAKE,uBALF,QAMO,eANP;AAQA,SACE,cADF,EAEE,wBAFF,EAGE,6BAHF,EAIE,gCAJF,EAKE,0BALF,QAMO,kBANP;AAQA,SAAS,WAAT,EAAsB,0BAAtB,EAAkD,uBAAlD,QAAiF,eAAjF;AAGA,SAAS,2BAAT,QAA4C,oBAA5C","sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport type { MenuContextValue } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport type { MenuGroupContextValue } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport type { MenuListContextValue } from './contexts/menuListContext';\n\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport type {\n MenuContextValues,\n MenuOpenChangeData,\n MenuOpenEvent,\n // MenuOpenEvents is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n MenuOpenEvents,\n MenuProps,\n MenuSlots,\n MenuState,\n} from './Menu';\nexport {\n MenuDivider,\n menuDividerClassNames,\n renderMenuDivider_unstable,\n useMenuDividerStyles_unstable,\n useMenuDivider_unstable,\n} from './MenuDivider';\nexport type { MenuDividerProps, MenuDividerSlots, MenuDividerState } from './MenuDivider';\nexport {\n MenuGroup,\n menuGroupClassNames,\n renderMenuGroup_unstable,\n useMenuGroupContextValues_unstable,\n useMenuGroupStyles_unstable,\n useMenuGroup_unstable,\n} from './MenuGroup';\nexport type { MenuGroupContextValues, MenuGroupProps, MenuGroupSlots, MenuGroupState } from './MenuGroup';\nexport {\n MenuGroupHeader,\n menuGroupHeaderClassNames,\n renderMenuGroupHeader_unstable,\n useMenuGroupHeaderStyles_unstable,\n useMenuGroupHeader_unstable,\n} from './MenuGroupHeader';\nexport type { MenuGroupHeaderProps, MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader';\nexport {\n MenuItem,\n menuItemClassNames,\n renderMenuItem_unstable,\n useMenuItemStyles_unstable,\n useMenuItem_unstable,\n} from './MenuItem';\nexport type { MenuItemProps, MenuItemSlots, MenuItemState } from './MenuItem';\nexport {\n MenuItemCheckbox,\n menuItemCheckboxClassNames,\n renderMenuItemCheckbox_unstable,\n useMenuItemCheckboxStyles_unstable,\n useMenuItemCheckbox_unstable,\n} from './MenuItemCheckbox';\nexport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox';\nexport {\n MenuItemRadio,\n menuItemRadioClassNames,\n renderMenuItemRadio_unstable,\n useMenuItemRadioStyles_unstable,\n useMenuItemRadio_unstable,\n} from './MenuItemRadio';\nexport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio';\nexport {\n MenuList,\n menuListClassNames,\n renderMenuList_unstable,\n useMenuListContextValues_unstable,\n useMenuListStyles_unstable,\n useMenuList_unstable,\n} from './MenuList';\nexport type {\n MenuCheckedValueChangeData,\n MenuCheckedValueChangeEvent,\n MenuListContextValues,\n MenuListProps,\n MenuListSlots,\n MenuListState,\n // UninitializedMenuListState is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n UninitializedMenuListState,\n} from './MenuList';\nexport {\n MenuPopover,\n menuPopoverClassNames,\n renderMenuPopover_unstable,\n useMenuPopoverStyles_unstable,\n useMenuPopover_unstable,\n} from './MenuPopover';\nexport type { MenuPopoverProps, MenuPopoverSlots, MenuPopoverState } from './MenuPopover';\nexport {\n MenuSplitGroup,\n menuSplitGroupClassNames,\n renderMenuSplitGroup_unstable,\n useMenuSplitGroupStyles_unstable,\n useMenuSplitGroup_unstable,\n} from './MenuSplitGroup';\nexport type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport type { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger';\n\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport type { MenuItemSelectableProps, MenuItemSelectableState, SelectableHandler } from './selectable/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,YAAY,EAAEC,uBAAuB,QAAQ,wBAAwB;AAE9E,SAASC,0BAA0B,EAAEC,8BAA8B,QAAQ,+BAA+B;AAC1G,SAASC,wBAAwB,EAAEC,4BAA4B,QAAQ,6BAA6B;AAEpG,SAASC,gBAAgB,EAAEC,2BAA2B,QAAQ,4BAA4B;AAG1F,SAASC,IAAI,EAAEC,mBAAmB,EAAEC,6BAA6B,EAAEC,gBAAgB,QAAQ,QAAQ;AAYnG,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,QAClB,eAAe;AAEtB,SACEC,SAAS,EACTC,mBAAmB,EACnBC,wBAAwB,EACxBC,kCAAkC,EAClCC,2BAA2B,EAC3BC,qBAAqB,QAChB,aAAa;AAEpB,SACEC,eAAe,EACfC,yBAAyB,EACzBC,8BAA8B,EAC9BC,iCAAiC,EACjCC,2BAA2B,QACtB,mBAAmB;AAE1B,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,0BAA0B,EAC1BC,oBAAoB,QACf,YAAY;AAEnB,SACEC,gBAAgB,EAChBC,0BAA0B,EAC1BC,+BAA+B,EAC/BC,kCAAkC,EAClCC,4BAA4B,QACvB,oBAAoB;AAE3B,SACEC,aAAa,EACbC,uBAAuB,EACvBC,4BAA4B,EAC5BC,+BAA+B,EAC/BC,yBAAyB,QACpB,iBAAiB;AAExB,SACEC,QAAQ,EACRC,kBAAkB,EAClBC,uBAAuB,EACvBC,iCAAiC,EACjCC,0BAA0B,EAC1BC,oBAAoB,QACf,YAAY;AAYnB,SACEC,WAAW,EACXC,qBAAqB,EACrBC,0BAA0B,EAC1BC,6BAA6B,EAC7BC,uBAAuB,QAClB,eAAe;AAEtB,SACEC,cAAc,EACdC,wBAAwB,EACxBC,6BAA6B,EAC7BC,gCAAgC,EAChCC,0BAA0B,QACrB,kBAAkB;AAEzB,SAASC,WAAW,EAAEC,0BAA0B,EAAEC,uBAAuB,QAAQ,eAAe;AAGhG,SAASC,2BAA2B,QAAQ,oBAAoB","names":["MenuProvider","useMenuContext_unstable","MenuTriggerContextProvider","useMenuTriggerContext_unstable","MenuGroupContextProvider","useMenuGroupContext_unstable","MenuListProvider","useMenuListContext_unstable","Menu","renderMenu_unstable","useMenuContextValues_unstable","useMenu_unstable","MenuDivider","menuDividerClassNames","renderMenuDivider_unstable","useMenuDividerStyles_unstable","useMenuDivider_unstable","MenuGroup","menuGroupClassNames","renderMenuGroup_unstable","useMenuGroupContextValues_unstable","useMenuGroupStyles_unstable","useMenuGroup_unstable","MenuGroupHeader","menuGroupHeaderClassNames","renderMenuGroupHeader_unstable","useMenuGroupHeaderStyles_unstable","useMenuGroupHeader_unstable","MenuItem","menuItemClassNames","renderMenuItem_unstable","useMenuItemStyles_unstable","useMenuItem_unstable","MenuItemCheckbox","menuItemCheckboxClassNames","renderMenuItemCheckbox_unstable","useMenuItemCheckboxStyles_unstable","useMenuItemCheckbox_unstable","MenuItemRadio","menuItemRadioClassNames","renderMenuItemRadio_unstable","useMenuItemRadioStyles_unstable","useMenuItemRadio_unstable","MenuList","menuListClassNames","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","useMenuList_unstable","MenuPopover","menuPopoverClassNames","renderMenuPopover_unstable","useMenuPopoverStyles_unstable","useMenuPopover_unstable","MenuSplitGroup","menuSplitGroupClassNames","renderMenuSplitGroup_unstable","useMenuSplitGroupStyles_unstable","useMenuSplitGroup_unstable","MenuTrigger","renderMenuTrigger_unstable","useMenuTrigger_unstable","useCheckmarkStyles_unstable"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/index.ts"],"sourcesContent":["export { MenuProvider, useMenuContext_unstable } from './contexts/menuContext';\nexport type { MenuContextValue } from './contexts/menuContext';\nexport { MenuTriggerContextProvider, useMenuTriggerContext_unstable } from './contexts/menuTriggerContext';\nexport { MenuGroupContextProvider, useMenuGroupContext_unstable } from './contexts/menuGroupContext';\nexport type { MenuGroupContextValue } from './contexts/menuGroupContext';\nexport { MenuListProvider, useMenuListContext_unstable } from './contexts/menuListContext';\nexport type { MenuListContextValue } from './contexts/menuListContext';\n\nexport { Menu, renderMenu_unstable, useMenuContextValues_unstable, useMenu_unstable } from './Menu';\nexport type {\n MenuContextValues,\n MenuOpenChangeData,\n MenuOpenEvent,\n // MenuOpenEvents is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n MenuOpenEvents,\n MenuProps,\n MenuSlots,\n MenuState,\n} from './Menu';\nexport {\n MenuDivider,\n menuDividerClassNames,\n renderMenuDivider_unstable,\n useMenuDividerStyles_unstable,\n useMenuDivider_unstable,\n} from './MenuDivider';\nexport type { MenuDividerProps, MenuDividerSlots, MenuDividerState } from './MenuDivider';\nexport {\n MenuGroup,\n menuGroupClassNames,\n renderMenuGroup_unstable,\n useMenuGroupContextValues_unstable,\n useMenuGroupStyles_unstable,\n useMenuGroup_unstable,\n} from './MenuGroup';\nexport type { MenuGroupContextValues, MenuGroupProps, MenuGroupSlots, MenuGroupState } from './MenuGroup';\nexport {\n MenuGroupHeader,\n menuGroupHeaderClassNames,\n renderMenuGroupHeader_unstable,\n useMenuGroupHeaderStyles_unstable,\n useMenuGroupHeader_unstable,\n} from './MenuGroupHeader';\nexport type { MenuGroupHeaderProps, MenuGroupHeaderSlots, MenuGroupHeaderState } from './MenuGroupHeader';\nexport {\n MenuItem,\n menuItemClassNames,\n renderMenuItem_unstable,\n useMenuItemStyles_unstable,\n useMenuItem_unstable,\n} from './MenuItem';\nexport type { MenuItemProps, MenuItemSlots, MenuItemState } from './MenuItem';\nexport {\n MenuItemCheckbox,\n menuItemCheckboxClassNames,\n renderMenuItemCheckbox_unstable,\n useMenuItemCheckboxStyles_unstable,\n useMenuItemCheckbox_unstable,\n} from './MenuItemCheckbox';\nexport type { MenuItemCheckboxProps, MenuItemCheckboxState } from './MenuItemCheckbox';\nexport {\n MenuItemRadio,\n menuItemRadioClassNames,\n renderMenuItemRadio_unstable,\n useMenuItemRadioStyles_unstable,\n useMenuItemRadio_unstable,\n} from './MenuItemRadio';\nexport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio';\nexport {\n MenuList,\n menuListClassNames,\n renderMenuList_unstable,\n useMenuListContextValues_unstable,\n useMenuListStyles_unstable,\n useMenuList_unstable,\n} from './MenuList';\nexport type {\n MenuCheckedValueChangeData,\n MenuCheckedValueChangeEvent,\n MenuListContextValues,\n MenuListProps,\n MenuListSlots,\n MenuListState,\n // UninitializedMenuListState is deprecated but removing it would be a breaking change\n // eslint-disable-next-line deprecation/deprecation\n UninitializedMenuListState,\n} from './MenuList';\nexport {\n MenuPopover,\n menuPopoverClassNames,\n renderMenuPopover_unstable,\n useMenuPopoverStyles_unstable,\n useMenuPopover_unstable,\n} from './MenuPopover';\nexport type { MenuPopoverProps, MenuPopoverSlots, MenuPopoverState } from './MenuPopover';\nexport {\n MenuSplitGroup,\n menuSplitGroupClassNames,\n renderMenuSplitGroup_unstable,\n useMenuSplitGroupStyles_unstable,\n useMenuSplitGroup_unstable,\n} from './MenuSplitGroup';\nexport type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup';\nexport { MenuTrigger, renderMenuTrigger_unstable, useMenuTrigger_unstable } from './MenuTrigger';\nexport type { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger';\n\nexport { useCheckmarkStyles_unstable } from './selectable/index';\nexport type { MenuItemSelectableProps, MenuItemSelectableState, SelectableHandler } from './selectable/index';\n"]}
@@ -1,27 +1,23 @@
1
1
  import { mergeClasses, __styles } from '@griffel/react';
2
-
3
2
  const useStyles = /*#__PURE__*/__styles({
4
- "root": {
5
- "a9b677": "fjw5fx7",
6
- "Bqenvij": "fd461yt",
7
- "Bcdw1i0": "fd7fpy0"
3
+ root: {
4
+ a9b677: "fjw5fx7",
5
+ Bqenvij: "fd461yt",
6
+ Bcdw1i0: "fd7fpy0"
8
7
  },
9
- "rootChecked": {
10
- "Bcdw1i0": "f1022m68"
8
+ rootChecked: {
9
+ Bcdw1i0: "f1022m68"
11
10
  }
12
11
  }, {
13
- "d": [".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".fd7fpy0{visibility:hidden;}", ".f1022m68{visibility:visible;}"]
12
+ d: [".fjw5fx7{width:16px;}", ".fd461yt{height:16px;}", ".fd7fpy0{visibility:hidden;}", ".f1022m68{visibility:visible;}"]
14
13
  });
15
14
  /**
16
15
  * Applies styles to a checkmark slot for selectable menu items
17
16
  *
18
17
  * @param state - should contain a `checkmark` slot
19
18
  */
20
-
21
-
22
19
  export const useCheckmarkStyles_unstable = state => {
23
20
  const styles = useStyles();
24
-
25
21
  if (state.checkmark) {
26
22
  state.checkmark.className = mergeClasses(styles.root, state.checked && styles.rootChecked, state.checkmark.className);
27
23
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/selectable/useCheckmarkStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,kBAAyC,gBAAzC;;AAIA,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAWA;;;;AAIG;;;AACH,OAAO,MAAM,2BAA2B,GAAI,KAAD,IAAsE;EAC/G,MAAM,MAAM,GAAG,SAAS,EAAxB;;EACA,IAAI,KAAK,CAAC,SAAV,EAAqB;IACnB,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,YAAY,CACtC,MAAM,CAAC,IAD+B,EAEtC,KAAK,CAAC,OAAN,IAAiB,MAAM,CAAC,WAFc,EAGtC,KAAK,CAAC,SAAN,CAAgB,SAHsB,CAAxC;EAKD;AACF,CATM","sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport type { MenuItemSelectableState } from './types';\nimport type { MenuItemState } from '../components/MenuItem/MenuItem.types';\n\nconst useStyles = makeStyles({\n root: {\n width: '16px',\n height: '16px',\n visibility: 'hidden',\n },\n rootChecked: {\n visibility: 'visible',\n },\n});\n\n/**\n * Applies styles to a checkmark slot for selectable menu items\n *\n * @param state - should contain a `checkmark` slot\n */\nexport const useCheckmarkStyles_unstable = (state: MenuItemSelectableState & Pick<MenuItemState, 'checkmark'>) => {\n const styles = useStyles();\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(\n styles.root,\n state.checked && styles.rootChecked,\n state.checkmark.className,\n );\n }\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,YAAY,kBAAoB,gBAAgB;AAIzD,MAAMC,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;EAAA;EAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAShB;AAEF;;;;;AAKA,OAAO,MAAMC,2BAA2B,GAAIC,KAAiE,IAAI;EAC/G,MAAMC,MAAM,GAAGH,SAAS,EAAE;EAC1B,IAAIE,KAAK,CAACE,SAAS,EAAE;IACnBF,KAAK,CAACE,SAAS,CAACC,SAAS,GAAGN,YAAY,CACtCI,MAAM,CAACG,IAAI,EACXJ,KAAK,CAACK,OAAO,IAAIJ,MAAM,CAACK,WAAW,EACnCN,KAAK,CAACE,SAAS,CAACC,SAAS,CAC1B;;AAEL,CAAC","names":["mergeClasses","useStyles","useCheckmarkStyles_unstable","state","styles","checkmark","className","root","checked","rootChecked"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/selectable/useCheckmarkStyles.ts"],"sourcesContent":["import { mergeClasses, makeStyles } from '@griffel/react';\nimport type { MenuItemSelectableState } from './types';\nimport type { MenuItemState } from '../components/MenuItem/MenuItem.types';\n\nconst useStyles = makeStyles({\n root: {\n width: '16px',\n height: '16px',\n visibility: 'hidden',\n },\n rootChecked: {\n visibility: 'visible',\n },\n});\n\n/**\n * Applies styles to a checkmark slot for selectable menu items\n *\n * @param state - should contain a `checkmark` slot\n */\nexport const useCheckmarkStyles_unstable = (state: MenuItemSelectableState & Pick<MenuItemState, 'checkmark'>) => {\n const styles = useStyles();\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(\n styles.root,\n state.checked && styles.rootChecked,\n state.checkmark.className,\n );\n }\n};\n"]}
@@ -9,7 +9,6 @@ import { MenuListContext } from '../contexts/menuListContext';
9
9
  *
10
10
  * @returns whether the component is part of a submenu
11
11
  */
12
-
13
12
  export function useIsSubmenu() {
14
13
  const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);
15
14
  const hasMenuListContext = useHasParentContext(MenuListContext);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/utils/useIsSubmenu.ts"],"names":[],"mappings":"AAAA,SAAS,mBAAT,QAAoC,kCAApC;AACA,SAAS,uBAAT,QAAwC,yBAAxC;AACA,SAAS,eAAT,QAAgC,6BAAhC;AAEA;;;;;;;AAOG;;AACH,OAAM,SAAU,YAAV,GAAsB;EAC1B,MAAM,gBAAgB,GAAG,uBAAuB,CAAC,OAAO,IAAI,OAAO,CAAC,SAApB,CAAhD;EACA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,eAAD,CAA9C;EAEA,OAAO,gBAAgB,IAAI,kBAA3B;AACD","sourcesContent":["import { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../contexts/menuContext';\nimport { MenuListContext } from '../contexts/menuListContext';\n\n/**\n * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true\n * or whether it is a part of a `MenuList`\n *\n * A simple hook to check box contexts easily\n *\n * @returns whether the component is part of a submenu\n */\nexport function useIsSubmenu() {\n const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);\n const hasMenuListContext = useHasParentContext(MenuListContext);\n\n return menuContextValue || hasMenuListContext;\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,eAAe,QAAQ,6BAA6B;AAE7D;;;;;;;;AAQA,OAAM,SAAUC,YAAY;EAC1B,MAAMC,gBAAgB,GAAGH,uBAAuB,CAACI,OAAO,IAAIA,OAAO,CAACC,SAAS,CAAC;EAC9E,MAAMC,kBAAkB,GAAGP,mBAAmB,CAACE,eAAe,CAAC;EAE/D,OAAOE,gBAAgB,IAAIG,kBAAkB;AAC/C","names":["useHasParentContext","useMenuContext_unstable","MenuListContext","useIsSubmenu","menuContextValue","context","isSubmenu","hasMenuListContext"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/utils/useIsSubmenu.ts"],"sourcesContent":["import { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../contexts/menuContext';\nimport { MenuListContext } from '../contexts/menuListContext';\n\n/**\n * A component can be a part of a submenu whether its menu context `isSubmenu` flag is true\n * or whether it is a part of a `MenuList`\n *\n * A simple hook to check box contexts easily\n *\n * @returns whether the component is part of a submenu\n */\nexport function useIsSubmenu() {\n const menuContextValue = useMenuContext_unstable(context => context.isSubmenu);\n const hasMenuListContext = useHasParentContext(MenuListContext);\n\n return menuContextValue || hasMenuListContext;\n}\n"]}
@@ -4,7 +4,6 @@ import { elementContains } from '@fluentui/react-portal';
4
4
  /**
5
5
  * Name of the custom event
6
6
  */
7
-
8
7
  export const MENU_ENTER_EVENT = 'fuimenuenter';
9
8
  /**
10
9
  * This hook works similarly to @see {useOnClickOutside}
@@ -17,25 +16,22 @@ export const MENU_ENTER_EVENT = 'fuimenuenter';
17
16
  * Instead, dispatch custom DOM event from the menu so that it can bubble
18
17
  * Each nested menu can use the listener to check if the event is from a child or parent menu
19
18
  */
20
-
21
19
  export const useOnMenuMouseEnter = options => {
22
20
  const {
23
21
  refs,
24
22
  callback,
25
23
  element,
26
24
  disabled
27
- } = options; // Keep mouse event here because this is essentially a custom 'mouseenter' event
28
-
25
+ } = options;
26
+ // Keep mouse event here because this is essentially a custom 'mouseenter' event
29
27
  const listener = useEventCallback(ev => {
30
28
  var _a;
31
-
32
29
  const popoverRef = refs[0];
33
- const someMenuPopover = ev.target; // someMenu is a child -> will always be contained because of vParents
30
+ const someMenuPopover = ev.target;
31
+ // someMenu is a child -> will always be contained because of vParents
34
32
  // someMenu is a parent -> will always not be contained because no vParent
35
33
  // someMenu is the current popover -> it will contain itself
36
-
37
34
  const isOutsidePopover = !elementContains((_a = popoverRef.current) !== null && _a !== void 0 ? _a : null, someMenuPopover);
38
-
39
35
  if (isOutsidePopover && !disabled) {
40
36
  callback(ev);
41
37
  }
@@ -45,11 +41,9 @@ export const useOnMenuMouseEnter = options => {
45
41
  if (element == null) {
46
42
  return;
47
43
  }
48
-
49
44
  if (!disabled) {
50
45
  element.addEventListener(MENU_ENTER_EVENT, listener);
51
46
  }
52
-
53
47
  return () => {
54
48
  element.removeEventListener(MENU_ENTER_EVENT, listener);
55
49
  };
@@ -60,7 +54,6 @@ export const useOnMenuMouseEnter = options => {
60
54
  * @param el element for the event target
61
55
  * @param nativeEvent the native mouse event this is mapped to
62
56
  */
63
-
64
57
  export const dispatchMenuEnterEvent = (el, nativeEvent) => {
65
58
  el.dispatchEvent(new CustomEvent(MENU_ENTER_EVENT, {
66
59
  bubbles: true,
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/utils/useOnMenuEnter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KA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AhB,EAAkC;IAAE,OAAO,EAAE,IAAX;IAAiB,MAAM,EAAE;MAAE;IAAF;EAAzB,CAAlC,CAAjB;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { UseOnClickOrScrollOutsideOptions } from '@fluentui/react-utilities';\n\n/**\n * Name of the custom event\n */\nexport const MENU_ENTER_EVENT = 'fuimenuenter';\n\n/**\n * This hook works similarly to @see {useOnClickOutside}\n *\n * Problem: Trying to behave the same as system menus:\n * When the mouse leaves a stack of nested menus the stack should not dismiss.\n * However if the mouse leaves a stack of menus and enters a parent menu all its children menu should dismiss.\n *\n * We don't use the native mouseenter event because it would trigger too many times in the document\n * Instead, dispatch custom DOM event from the menu so that it can bubble\n * Each nested menu can use the listener to check if the event is from a child or parent menu\n */\nexport const useOnMenuMouseEnter = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled } = options;\n\n // Keep mouse event here because this is essentially a custom 'mouseenter' event\n const listener = useEventCallback((ev: MouseEvent) => {\n const popoverRef = refs[0];\n const someMenuPopover = ev.target as HTMLElement;\n\n // someMenu is a child -> will always be contained because of vParents\n // someMenu is a parent -> will always not be contained because no vParent\n // someMenu is the current popover -> it will contain itself\n const isOutsidePopover = !elementContains(popoverRef.current ?? null, someMenuPopover);\n if (isOutsidePopover && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // eslint-disable-next-line eqeqeq\n if (element == null) {\n return;\n }\n\n /**\n * Because `addEventListener` type override falls back to 2nd definition (evt name is unknown string literal)\n * evt is being typed as a base class of MouseEvent -> `Event`.\n * This type is used to override `listener` calls to make TS happy\n */\n\n type ListenerOverride = (evt: Event) => void;\n\n if (!disabled) {\n element.addEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n }\n\n return () => {\n element.removeEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n };\n }, [listener, element, disabled]);\n};\n\n/**\n * Dispatches the custom MouseEvent enter event. Similar to calling `el.click()`\n * @param el element for the event target\n * @param nativeEvent the native mouse event this is mapped to\n */\nexport const dispatchMenuEnterEvent = (el: HTMLElement, nativeEvent: MouseEvent) => {\n el.dispatchEvent(new CustomEvent(MENU_ENTER_EVENT, { bubbles: true, detail: { nativeEvent } }));\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,eAAe,QAAQ,wBAAwB;AAGxD;;;AAGA,OAAO,MAAMC,gBAAgB,GAAG,cAAc;AAE9C;;;;;;;;;;;AAWA,OAAO,MAAMC,mBAAmB,GAAIC,OAAyC,IAAI;EAC/E,MAAM;IAAEC,IAAI;IAAEC,QAAQ;IAAEC,OAAO;IAAEC;EAAQ,CAAE,GAAGJ,OAAO;EAErD;EACA,MAAMK,QAAQ,GAAGT,gBAAgB,CAAEU,EAAc,IAAI;;IACnD,MAAMC,UAAU,GAAGN,IAAI,CAAC,CAAC,CAAC;IAC1B,MAAMO,eAAe,GAAGF,EAAE,CAACG,MAAqB;IAEhD;IACA;IACA;IACA,MAAMC,gBAAgB,GAAG,CAACb,eAAe,CAAC,gBAAU,CAACc,OAAO,mCAAI,IAAI,EAAEH,eAAe,CAAC;IACtF,IAAIE,gBAAgB,IAAI,CAACN,QAAQ,EAAE;MACjCF,QAAQ,CAACI,EAAE,CAAC;;EAEhB,CAAC,CAAC;EAEFX,KAAK,CAACiB,SAAS,CAAC,MAAK;IACnB;IACA,IAAIT,OAAO,IAAI,IAAI,EAAE;MACnB;;IAWF,IAAI,CAACC,QAAQ,EAAE;MACbD,OAAO,CAACU,gBAAgB,CAACf,gBAAgB,EAAEO,QAA4B,CAAC;;IAG1E,OAAO,MAAK;MACVF,OAAO,CAACW,mBAAmB,CAAChB,gBAAgB,EAAEO,QAA4B,CAAC;IAC7E,CAAC;EACH,CAAC,EAAE,CAACA,QAAQ,EAAEF,OAAO,EAAEC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED;;;;;AAKA,OAAO,MAAMW,sBAAsB,GAAG,CAACC,EAAe,EAAEC,WAAuB,KAAI;EACjFD,EAAE,CAACE,aAAa,CAAC,IAAIC,WAAW,CAACrB,gBAAgB,EAAE;IAAEsB,OAAO,EAAE,IAAI;IAAEC,MAAM,EAAE;MAAEJ;IAAW;EAAE,CAAE,CAAC,CAAC;AACjG,CAAC","names":["React","useEventCallback","elementContains","MENU_ENTER_EVENT","useOnMenuMouseEnter","options","refs","callback","element","disabled","listener","ev","popoverRef","someMenuPopover","target","isOutsidePopover","current","useEffect","addEventListener","removeEventListener","dispatchMenuEnterEvent","el","nativeEvent","dispatchEvent","CustomEvent","bubbles","detail"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/utils/useOnMenuEnter.ts"],"sourcesContent":["import * as React from 'react';\nimport { useEventCallback } from '@fluentui/react-utilities';\nimport { elementContains } from '@fluentui/react-portal';\nimport type { UseOnClickOrScrollOutsideOptions } from '@fluentui/react-utilities';\n\n/**\n * Name of the custom event\n */\nexport const MENU_ENTER_EVENT = 'fuimenuenter';\n\n/**\n * This hook works similarly to @see {useOnClickOutside}\n *\n * Problem: Trying to behave the same as system menus:\n * When the mouse leaves a stack of nested menus the stack should not dismiss.\n * However if the mouse leaves a stack of menus and enters a parent menu all its children menu should dismiss.\n *\n * We don't use the native mouseenter event because it would trigger too many times in the document\n * Instead, dispatch custom DOM event from the menu so that it can bubble\n * Each nested menu can use the listener to check if the event is from a child or parent menu\n */\nexport const useOnMenuMouseEnter = (options: UseOnClickOrScrollOutsideOptions) => {\n const { refs, callback, element, disabled } = options;\n\n // Keep mouse event here because this is essentially a custom 'mouseenter' event\n const listener = useEventCallback((ev: MouseEvent) => {\n const popoverRef = refs[0];\n const someMenuPopover = ev.target as HTMLElement;\n\n // someMenu is a child -> will always be contained because of vParents\n // someMenu is a parent -> will always not be contained because no vParent\n // someMenu is the current popover -> it will contain itself\n const isOutsidePopover = !elementContains(popoverRef.current ?? null, someMenuPopover);\n if (isOutsidePopover && !disabled) {\n callback(ev);\n }\n });\n\n React.useEffect(() => {\n // eslint-disable-next-line eqeqeq\n if (element == null) {\n return;\n }\n\n /**\n * Because `addEventListener` type override falls back to 2nd definition (evt name is unknown string literal)\n * evt is being typed as a base class of MouseEvent -> `Event`.\n * This type is used to override `listener` calls to make TS happy\n */\n\n type ListenerOverride = (evt: Event) => void;\n\n if (!disabled) {\n element.addEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n }\n\n return () => {\n element.removeEventListener(MENU_ENTER_EVENT, listener as ListenerOverride);\n };\n }, [listener, element, disabled]);\n};\n\n/**\n * Dispatches the custom MouseEvent enter event. Similar to calling `el.click()`\n * @param el element for the event target\n * @param nativeEvent the native mouse event this is mapped to\n */\nexport const dispatchMenuEnterEvent = (el: HTMLElement, nativeEvent: MouseEvent) => {\n el.dispatchEvent(new CustomEvent(MENU_ENTER_EVENT, { bubbles: true, detail: { nativeEvent } }));\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuItem/MenuItem.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuItemSlots = {\n root: Slot<ARIAButtonSlotProps<'div'>>;\n\n /**\n * Icon slot rendered before children content\n */\n icon?: Slot<'span'>;\n\n /**\n * A helper slot for alignment when a menu item is used with selectable menuitems\n * Avoid using this slot as a replacement for MenuItemCheckbox and MenuItemRadio components\n */\n checkmark?: Slot<'span'>;\n\n /**\n * Icon slot that shows the indicator for a submenu\n */\n submenuIndicator?: Slot<'span'>;\n\n /**\n * Component children are placed in this slot\n * Avoid using the `children` property in this slot in favour of Component children whenever possible\n */\n content?: Slot<'span'>;\n\n /**\n * Secondary content rendered opposite the primary content (e.g Shortcut text)\n */\n secondaryContent?: Slot<'span'>;\n};\n\nexport type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & {\n /**\n * If the menu item is a trigger for a submenu\n *\n * @default false\n */\n hasSubmenu?: boolean;\n\n /**\n * Clicking on the menu item will not dismiss an open menu\n *\n * @default false\n */\n persistOnClick?: boolean;\n};\n\nexport type MenuItemState = ComponentState<MenuItemSlots> &\n Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>> & {\n isNativeButton: boolean;\n };\n"]}
1
+ {"version":3,"file":"MenuItem.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuItem/MenuItem.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuItemSlots = {\n root: Slot<'div', 'button'>;\n\n /**\n * Icon slot rendered before children content\n */\n icon?: Slot<'span'>;\n\n /**\n * A helper slot for alignment when a menu item is used with selectable menuitems\n * Avoid using this slot as a replacement for MenuItemCheckbox and MenuItemRadio components\n */\n checkmark?: Slot<'span'>;\n\n /**\n * Icon slot that shows the indicator for a submenu\n */\n submenuIndicator?: Slot<'span'>;\n\n /**\n * Component children are placed in this slot\n * Avoid using the `children` property in this slot in favour of Component children whenever possible\n */\n content?: Slot<'span'>;\n\n /**\n * Secondary content rendered opposite the primary content (e.g Shortcut text)\n */\n secondaryContent?: Slot<'span'>;\n};\n\nexport type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & {\n /**\n * If the menu item is a trigger for a submenu\n *\n * @default false\n */\n hasSubmenu?: boolean;\n\n /**\n * Clicking on the menu item will not dismiss an open menu\n *\n * @default false\n */\n persistOnClick?: boolean;\n\n disabled?: boolean;\n /**\n * @deprecated this property does nothing.\n * disabled focusable is by default by simply using `disabled` property\n */\n disabledFocusable?: boolean;\n};\n\nexport type MenuItemState = ComponentState<MenuItemSlots> &\n Required<Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>> & {\n isNativeButton: boolean;\n };\n"]}
@@ -10,17 +10,16 @@ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@f
10
10
  var useMenuItem_unstable = function (props, ref) {
11
11
  var isSubmenuTrigger = menuTriggerContext_1.useMenuTriggerContext_unstable();
12
12
  var persistOnClickContext = menuContext_1.useMenuContext_unstable(function (context) { return context.persistOnItemClick; });
13
- var _a = props.as, as = _a === void 0 ? 'div' : _a, disabled = props.disabled, disabledFocusable = props.disabledFocusable, _b = props.hasSubmenu, hasSubmenu = _b === void 0 ? isSubmenuTrigger : _b, _c = props.persistOnClick, persistOnClick = _c === void 0 ? persistOnClickContext : _c;
13
+ var _a = props.as, as = _a === void 0 ? 'div' : _a, _b = props.disabled, disabled = _b === void 0 ? false : _b, _c = props.hasSubmenu, hasSubmenu = _c === void 0 ? isSubmenuTrigger : _c, _d = props.persistOnClick, persistOnClick = _d === void 0 ? persistOnClickContext : _d;
14
14
  var hasIcons = menuListContext_1.useMenuListContext_unstable(function (context) { return context.hasIcons; });
15
15
  var hasCheckmarks = menuListContext_1.useMenuListContext_unstable(function (context) { return context.hasCheckmarks; });
16
16
  var setOpen = menuContext_1.useMenuContext_unstable(function (context) { return context.setOpen; });
17
17
  var dir = react_shared_contexts_1.useFluent_unstable().dir;
18
18
  var innerRef = React.useRef(null);
19
19
  var dismissedWithKeyboardRef = React.useRef(false);
20
- var isDisabled = Boolean(disabled || disabledFocusable);
21
20
  var state = {
22
21
  hasSubmenu: hasSubmenu,
23
- disabled: isDisabled,
22
+ disabled: disabled,
24
23
  persistOnClick: persistOnClick,
25
24
  components: {
26
25
  root: 'div',
@@ -31,33 +30,30 @@ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@f
31
30
  secondaryContent: 'span',
32
31
  },
33
32
  isNativeButton: as === 'button',
34
- root: react_utilities_1.getNativeElementProps(as, react_aria_1.useARIAButtonShorthand({ disabled: false, disabledFocusable: isDisabled, as: as }, {
35
- required: true,
36
- defaultProps: tslib_1.__assign(tslib_1.__assign({ role: 'menuitem' }, props), { ref: react_utilities_1.useMergedRefs(ref, innerRef), onKeyDown: react_utilities_1.useEventCallback(function (event) {
37
- var _a;
38
- (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, event);
39
- if (!event.isDefaultPrevented() && (event.key === keyboard_keys_1.Space || event.key === keyboard_keys_1.Enter)) {
40
- dismissedWithKeyboardRef.current = true;
41
- }
42
- }), onMouseEnter: react_utilities_1.useEventCallback(function (event) {
43
- var _a, _b;
44
- (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
45
- (_b = props.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(props, event);
46
- }), onClick: react_utilities_1.useEventCallback(function (event) {
47
- var _a;
48
- if (!hasSubmenu && !persistOnClick) {
49
- setOpen(event, {
50
- open: false,
51
- keyboard: dismissedWithKeyboardRef.current,
52
- bubble: true,
53
- type: 'menuItemClick',
54
- event: event,
55
- });
56
- dismissedWithKeyboardRef.current = false;
57
- }
58
- (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, event);
59
- }) }),
60
- })),
33
+ root: react_utilities_1.getNativeElementProps(as, react_aria_1.useARIAButtonProps(as, tslib_1.__assign(tslib_1.__assign({ role: 'menuitem' }, props), { disabled: false, disabledFocusable: disabled, ref: react_utilities_1.useMergedRefs(ref, innerRef), onKeyDown: react_utilities_1.useEventCallback(function (event) {
34
+ var _a;
35
+ (_a = props.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(props, event);
36
+ if (!event.isDefaultPrevented() && (event.key === keyboard_keys_1.Space || event.key === keyboard_keys_1.Enter)) {
37
+ dismissedWithKeyboardRef.current = true;
38
+ }
39
+ }), onMouseEnter: react_utilities_1.useEventCallback(function (event) {
40
+ var _a, _b;
41
+ (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
42
+ (_b = props.onMouseEnter) === null || _b === void 0 ? void 0 : _b.call(props, event);
43
+ }), onClick: react_utilities_1.useEventCallback(function (event) {
44
+ var _a;
45
+ if (!hasSubmenu && !persistOnClick) {
46
+ setOpen(event, {
47
+ open: false,
48
+ keyboard: dismissedWithKeyboardRef.current,
49
+ bubble: true,
50
+ type: 'menuItemClick',
51
+ event: event,
52
+ });
53
+ dismissedWithKeyboardRef.current = false;
54
+ }
55
+ (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props, event);
56
+ }) }))),
61
57
  icon: react_utilities_1.resolveShorthand(props.icon, { required: hasIcons }),
62
58
  checkmark: react_utilities_1.resolveShorthand(props.checkmark, { required: hasCheckmarks }),
63
59
  submenuIndicator: react_utilities_1.resolveShorthand(props.submenuIndicator, {
@@ -1 +1 @@
1
- {"version":3,"file":"useMenuItem.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuItem/useMenuItem.tsx"],"names":[],"mappings":";;;;IAmBA,IAAM,gBAAgB,GAAG,wBAAU,CAAC,gCAAkB,EAAE,iCAAmB,CAAC,CAAC;IAC7E,IAAM,eAAe,GAAG,wBAAU,CAAC,+BAAiB,EAAE,gCAAkB,CAAC,CAAC;IAE1E;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAAoB,EAAE,GAAwC;QACjG,IAAM,gBAAgB,GAAG,mDAA8B,EAAE,CAAC;QAC1D,IAAM,qBAAqB,GAAG,qCAAuB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,kBAAkB,EAA1B,CAA0B,CAAC,CAAC;QAE3F,IAAA,KAKE,KAAK,GALG,EAAV,EAAE,mBAAG,KAAK,KAAA,EACV,QAAQ,GAIN,KAAK,SAJC,EACR,iBAAiB,GAGf,KAAK,kBAHU,EACjB,KAEE,KAAK,WAFsB,EAA7B,UAAU,mBAAG,gBAAgB,KAAA,EAC7B,KACE,KAAK,eAD+B,EAAtC,cAAc,mBAAG,qBAAqB,KAAA,CAC9B;QACV,IAAM,QAAQ,GAAG,6CAA2B,CAAC,U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oBAAC,eAAe,OAAG;iBACrE;aACF,CAAC;YACF,OAAO,EAAE,kCAAgB,CAAC,KAAK,CAAC,OAAO,EAAE;gBACvC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ;gBAC1B,YAAY,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE;aAC3C,CAAC;YACF,gBAAgB,EAAE,kCAAgB,CAAC,KAAK,CAAC,gBAAgB,CAAC;SAC3D,CAAC;QACF,uCAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QACpC,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAxFW,QAAA,oBAAoB,wBAwF/B","sourcesContent":["import * as React from 'react';\nimport { useEventCallback, resolveShorthand, useMergedRefs, getNativeElementProps } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useCharacterSearch } from './useCharacterSearch';\nimport { useMenuTriggerContext_unstable } from '../../contexts/menuTriggerContext';\nimport {\n ChevronRightFilled,\n ChevronRightRegular,\n ChevronLeftFilled,\n ChevronLeftRegular,\n bundleIcon,\n} from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport type { MenuItemProps, MenuItemState } from './MenuItem.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection, ARIAButtonSlotProps } from '@fluentui/react-aria';\nimport { useARIAButtonShorthand } from '@fluentui/react-aria';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\n\nconst ChevronRightIcon = bundleIcon(ChevronRightFilled, ChevronRightRegular);\nconst ChevronLeftIcon = bundleIcon(ChevronLeftFilled, ChevronLeftRegular);\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuItem_unstable = (props: MenuItemProps, ref: React.Ref<ARIAButtonElement<'div'>>): MenuItemState => {\n const isSubmenuTrigger = useMenuTriggerContext_unstable();\n const persistOnClickContext = useMenuContext_unstable(context => context.persistOnItemClick);\n const {\n as = 'div',\n disabled,\n disabledFocusable,\n hasSubmenu = isSubmenuTrigger,\n persistOnClick = persistOnClickContext,\n } = props;\n const hasIcons = useMenuListContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuListContext_unstable(context => context.hasCheckmarks);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n\n const { dir } = useFluent();\n const innerRef = React.useRef<ARIAButtonElementIntersection<'div'>>(null);\n const dismissedWithKeyboardRef = React.useRef(false);\n\n const isDisabled = Boolean(disabled || disabledFocusable);\n\n const state: MenuItemState = {\n hasSubmenu,\n disabled: isDisabled,\n persistOnClick,\n components: {\n root: 'div',\n icon: 'span',\n checkmark: 'span',\n submenuIndicator: 'span',\n content: 'span',\n secondaryContent: 'span',\n },\n isNativeButton: as === 'button',\n root: getNativeElementProps(\n as,\n useARIAButtonShorthand<ARIAButtonSlotProps<'div'>>(\n { disabled: false, disabledFocusable: isDisabled, as },\n {\n required: true,\n defaultProps: {\n role: 'menuitem',\n ...props,\n ref: useMergedRefs(ref, innerRef) as React.Ref<ARIAButtonElementIntersection<'div'>>,\n onKeyDown: useEventCallback(event => {\n props.onKeyDown?.(event);\n if (!event.isDefaultPrevented() && (event.key === Space || event.key === Enter)) {\n dismissedWithKeyboardRef.current = true;\n }\n }),\n onMouseEnter: useEventCallback(event => {\n innerRef.current?.focus();\n\n props.onMouseEnter?.(event);\n }),\n onClick: useEventCallback(event => {\n if (!hasSubmenu && !persistOnClick) {\n setOpen(event, {\n open: false,\n keyboard: dismissedWithKeyboardRef.current,\n bubble: true,\n type: 'menuItemClick',\n event,\n });\n dismissedWithKeyboardRef.current = false;\n }\n\n props.onClick?.(event);\n }),\n },\n },\n ),\n ),\n icon: resolveShorthand(props.icon, { required: hasIcons }),\n checkmark: resolveShorthand(props.checkmark, { required: hasCheckmarks }),\n submenuIndicator: resolveShorthand(props.submenuIndicator, {\n required: hasSubmenu,\n defaultProps: {\n children: dir === 'ltr' ? <ChevronRightIcon /> : <ChevronLeftIcon />,\n },\n }),\n content: resolveShorthand(props.content, {\n required: !!props.children,\n defaultProps: { children: props.children },\n }),\n secondaryContent: resolveShorthand(props.secondaryContent),\n };\n useCharacterSearch(state, innerRef);\n return state;\n};\n"]}
1
+ {"version":3,"file":"useMenuItem.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuItem/useMenuItem.tsx"],"names":[],"mappings":";;;;IAkBA,IAAM,gBAAgB,GAAG,wBAAU,CAAC,gCAAkB,EAAE,iCAAmB,CAAC,CAAC;IAC7E,IAAM,eAAe,GAAG,wBAAU,CAAC,+BAAiB,EAAE,gCAAkB,CAAC,CAAC;IAE1E;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAAoB,EAAE,GAAwC;QACjG,IAAM,gBAAgB,GAAG,mDAA8B,EAAE,CAAC;QAC1D,IAAM,qBAAqB,GAAG,qCAAuB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,kBAAkB,EAA1B,CAA0B,CAAC,CAAC;QACrF,IAAA,KAAwG,KAAK,GAAnG,EAAV,EAAE,mBAAG,KAAK,KAAA,EAAE,KAA4F,KAAK,SAAjF,EAAhB,QAAQ,mBAAG,KAAK,KAAA,EAAE,KAA0E,KAAK,WAAlD,EAA7B,UAAU,mBAAG,gBAAgB,KAAA,EAAE,KAA2C,KAAK,eAAV,EAAtC,cAAc,mBAAG,qBAAqB,KAAA,CAAW;QACtH,IAAM,QAAQ,GAAG,6CAA2B,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,QAAQ,EAAhB,CAAgB,CAAC,CAAC;QAC1E,IAAM,aAAa,GAAG,6CAA2B,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,aAAa,EAArB,CAAqB,CAAC,CAAC;QACpF,IAAM,OAAO,GAAG,qCAAuB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,OAAO,EAAf,CAAe,CAAC,CAAC;QAE5D,IAAA,GA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port { useEventCallback, resolveShorthand, useMergedRefs, getNativeElementProps } from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useCharacterSearch } from './useCharacterSearch';\nimport { useMenuTriggerContext_unstable } from '../../contexts/menuTriggerContext';\nimport {\n ChevronRightFilled,\n ChevronRightRegular,\n ChevronLeftFilled,\n ChevronLeftRegular,\n bundleIcon,\n} from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport type { MenuItemProps, MenuItemState } from './MenuItem.types';\nimport { ARIAButtonElement, ARIAButtonElementIntersection, useARIAButtonProps } from '@fluentui/react-aria';\nimport { Enter, Space } from '@fluentui/keyboard-keys';\n\nconst ChevronRightIcon = bundleIcon(ChevronRightFilled, ChevronRightRegular);\nconst ChevronLeftIcon = bundleIcon(ChevronLeftFilled, ChevronLeftRegular);\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuItem_unstable = (props: MenuItemProps, ref: React.Ref<ARIAButtonElement<'div'>>): MenuItemState => {\n const isSubmenuTrigger = useMenuTriggerContext_unstable();\n const persistOnClickContext = useMenuContext_unstable(context => context.persistOnItemClick);\n const { as = 'div', disabled = false, hasSubmenu = isSubmenuTrigger, persistOnClick = persistOnClickContext } = props;\n const hasIcons = useMenuListContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuListContext_unstable(context => context.hasCheckmarks);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n\n const { dir } = useFluent();\n const innerRef = React.useRef<ARIAButtonElementIntersection<'div'>>(null);\n const dismissedWithKeyboardRef = React.useRef(false);\n\n const state: MenuItemState = {\n hasSubmenu,\n disabled,\n persistOnClick,\n components: {\n root: 'div',\n icon: 'span',\n checkmark: 'span',\n submenuIndicator: 'span',\n content: 'span',\n secondaryContent: 'span',\n },\n isNativeButton: as === 'button',\n root: getNativeElementProps(\n as,\n useARIAButtonProps(as, {\n role: 'menuitem',\n ...props,\n disabled: false,\n disabledFocusable: disabled,\n ref: useMergedRefs(ref, innerRef) as React.Ref<ARIAButtonElementIntersection<'div'>>,\n onKeyDown: useEventCallback(event => {\n props.onKeyDown?.(event);\n if (!event.isDefaultPrevented() && (event.key === Space || event.key === Enter)) {\n dismissedWithKeyboardRef.current = true;\n }\n }),\n onMouseEnter: useEventCallback(event => {\n innerRef.current?.focus();\n\n props.onMouseEnter?.(event);\n }),\n onClick: useEventCallback(event => {\n if (!hasSubmenu && !persistOnClick) {\n setOpen(event, {\n open: false,\n keyboard: dismissedWithKeyboardRef.current,\n bubble: true,\n type: 'menuItemClick',\n event,\n });\n dismissedWithKeyboardRef.current = false;\n }\n\n props.onClick?.(event);\n }),\n }),\n ),\n icon: resolveShorthand(props.icon, { required: hasIcons }),\n checkmark: resolveShorthand(props.checkmark, { required: hasCheckmarks }),\n submenuIndicator: resolveShorthand(props.submenuIndicator, {\n required: hasSubmenu,\n defaultProps: {\n children: dir === 'ltr' ? <ChevronRightIcon /> : <ChevronLeftIcon />,\n },\n }),\n content: resolveShorthand(props.content, {\n required: !!props.children,\n defaultProps: { children: props.children },\n }),\n secondaryContent: resolveShorthand(props.secondaryContent),\n };\n useCharacterSearch(state, innerRef);\n return state;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"MenuList.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuList/MenuList.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { MenuListContextValue } from '../../contexts/menuListContext';\nimport type { SelectableHandler } from '../../selectable/index';\n\nexport type MenuCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\nexport type MenuCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type MenuListSlots = {\n root: Slot<'div'>;\n};\n\nexport type MenuListProps = ComponentProps<MenuListSlots> & {\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * States that menu items can contain selectable items and reserve slots for item alignment\n */\n hasCheckmarks?: boolean;\n\n /**\n * States that menu items can contain icons and reserve slots for item alignment\n */\n hasIcons?: boolean;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n};\n\nexport type MenuListState = ComponentState<MenuListSlots> &\n Required<Pick<MenuListProps, 'checkedValues' | 'hasCheckmarks' | 'hasIcons'>> & {\n /**\n * Selects a radio item, will de-select the currently selected ratio item\n */\n selectRadio: SelectableHandler;\n\n /**\n * Callback to set focus on the next menu item by first character\n */\n setFocusByFirstCharacter: NonNullable<MenuListContextValue['setFocusByFirstCharacter']>;\n\n /*\n * Toggles the state of a checkbox item\n */\n toggleCheckbox: SelectableHandler;\n\n /**\n * Default values to be checked on mount\n * @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n defaultCheckedValues?: Record<string, string[]>;\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n * @deprecated this property is not used internally anymore,\n * the signature remains just to avoid breaking changes\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n };\n\nexport type MenuListContextValues = {\n menuList: MenuListContextValue;\n};\n\n/**\n * @deprecated this type is not being used internally anymore\n */\nexport type UninitializedMenuListState = Omit<\n MenuListState,\n 'checkedValues' | 'selectRadio' | 'setFocusByFirstCharacter' | 'toggleCheckbox'\n> &\n Partial<Pick<MenuListState, 'checkedValues'>>;\n"]}
1
+ {"version":3,"file":"MenuList.types.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuList/MenuList.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\nimport type { MenuListContextValue } from '../../contexts/menuListContext';\nimport type { SelectableHandler } from '../../selectable/index';\n\nexport type MenuCheckedValueChangeEvent = React.MouseEvent | React.KeyboardEvent;\n\nexport type MenuCheckedValueChangeData = {\n /** The items for this value that are checked */\n checkedItems: string[];\n /** The name of the value */\n name: string;\n};\n\nexport type MenuListSlots = {\n root: Slot<'div'>;\n};\n\nexport type MenuListProps = ComponentProps<MenuListSlots> & {\n /**\n * Map of all checked values\n */\n checkedValues?: Record<string, string[]>;\n\n /**\n * Default values to be checked on mount\n */\n defaultCheckedValues?: Record<string, string[]>;\n\n /**\n * States that menu items can contain selectable items and reserve slots for item alignment\n */\n hasCheckmarks?: boolean;\n\n /**\n * States that menu items can contain icons and reserve slots for item alignment\n */\n hasIcons?: boolean;\n\n /**\n * Callback when checked items change for value with a name\n *\n * @param event - React's original SyntheticEvent\n * @param data - A data object with relevant information\n */\n onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;\n};\n\nexport type MenuListState = ComponentState<MenuListSlots> &\n Required<Pick<MenuListProps, 'checkedValues' | 'hasCheckmarks' | 'hasIcons'>> &\n Pick<MenuListProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & {\n /**\n * Selects a radio item, will de-select the currently selected ratio item\n */\n selectRadio: SelectableHandler;\n\n /**\n * Callback to set focus on the next menu item by first character\n */\n setFocusByFirstCharacter: NonNullable<MenuListContextValue['setFocusByFirstCharacter']>;\n\n /*\n * Toggles the state of a checkbox item\n */\n toggleCheckbox: SelectableHandler;\n };\n\nexport type MenuListContextValues = {\n menuList: MenuListContextValue;\n};\n\n/**\n * @deprecated this type is not being used internally anymore\n */\nexport type UninitializedMenuListState = Omit<\n MenuListState,\n 'checkedValues' | 'selectRadio' | 'setFocusByFirstCharacter' | 'toggleCheckbox'\n> &\n Partial<Pick<MenuListState, 'checkedValues'>>;\n"]}
@@ -6,6 +6,7 @@ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@f
6
6
  * Returns the props and state required to render the component
7
7
  */
8
8
  var useMenuList_unstable = function (props, ref) {
9
+ var _a, _b;
9
10
  var focusAttributes = react_tabster_1.useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: true } });
10
11
  var findAllFocusable = react_tabster_1.useFocusFinders().findAllFocusable;
11
12
  var menuContext = useMenuContextSelectors();
@@ -48,12 +49,12 @@ define(["require", "exports", "tslib", "react", "@fluentui/react-utilities", "@f
48
49
  menuItems[index].focus();
49
50
  }
50
51
  }, [findAllFocusable]);
51
- var _a = react_utilities_1.useControllableState({
52
- state: hasMenuContext ? menuContext.checkedValues : props.checkedValues,
52
+ var _c = react_utilities_1.useControllableState({
53
+ state: (_a = props.checkedValues) !== null && _a !== void 0 ? _a : (hasMenuContext ? menuContext.checkedValues : undefined),
53
54
  defaultState: props.defaultCheckedValues,
54
55
  initialState: {},
55
- }), checkedValues = _a[0], setCheckedValues = _a[1];
56
- var handleCheckedValueChange = hasMenuContext ? menuContext.onCheckedValueChange : props.onCheckedValueChange;
56
+ }), checkedValues = _c[0], setCheckedValues = _c[1];
57
+ var handleCheckedValueChange = (_b = props.onCheckedValueChange) !== null && _b !== void 0 ? _b : (hasMenuContext ? menuContext.onCheckedValueChange : undefined);
57
58
  var toggleCheckbox = react_utilities_1.useEventCallback(function (e, name, value, checked) {
58
59
  var checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
59
60
  var newCheckedItems = tslib_1.__spreadArray([], checkedItems);
@@ -1 +1 @@
1
- {"version":3,"file":"useMenuList.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuList/useMenuList.ts"],"names":[],"mappings":";;;;IAaA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAAoB,EAAE,GAA2B;QACpF,IAAM,eAAe,GAAG,uCAAu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,sBAAsB,CAAC;IAClD,CAAC,CAAC","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 focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: true } });\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\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: hasMenuContext ? menuContext.checkedValues : props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange = hasMenuContext ? menuContext.onCheckedValueChange : props.onCheckedValueChange;\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"]}
1
+ {"version":3,"file":"useMenuList.js","sourceRoot":"","sources":["../../../../../../../../../packages/react-components/react-menu/src/components/MenuList/useMenuList.ts"],"names":[],"mappings":";;;;IAaA;;OAEG;IACI,IAAM,oBAAoB,GAAG,UAAC,KAAoB,EAAE,GAA2B;;QACpF,IAAM,eAAe,GAAG,uCAAuB,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,oBAAoB,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;QACjG,IAAA,gBAAgB,GAAK,+BAAe,EAAE,iBAAtB,CAAuB;QAC/C,IAAM,WAAW,GAAG,uBAAuB,EAAE,CAAC;QAC9C,IAAM,cAAc,GAAG,4CAAmB,CAAC,yBAAW,CAAC,CAAC;QAExD,IAAI,wBAAwB,CAAC,KAAK,EAAE,WAAW,EAAE,cAAc,CAAC,EAAE;YAChE,4CAA4C;YAC5C,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;SAC/G;QAED,IAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAc,IAAI,CAAC,CAAC;QAEjD,IAAM,wBAAwB,GAAG,KAAK,CAAC,WAAW,CAChD,UAAC,CAAmC,EAAE,MAAmB;YACvD,gFAAgF;YAChF,IAAM,aAAa,GAAG,CAAC,UAAU,E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O,IAAI,OAAA,OAAO,CAAC,SAAS,EAAjB,CAAiB,CAAC,CAAC;QACxE,IAAM,QAAQ,GAAG,qCAAuB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,QAAQ,EAAhB,CAAgB,CAAC,CAAC;QACtE,IAAM,aAAa,GAAG,qCAAuB,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,CAAC,aAAa,EAArB,CAAqB,CAAC,CAAC;QAEhF,OAAO;YACL,aAAa,eAAA;YACb,oBAAoB,sBAAA;YACpB,SAAS,WAAA;YACT,QAAQ,UAAA;YACR,aAAa,eAAA;SACd,CAAC;IACJ,CAAC,CAAC;IAEF;;OAEG;IACH,IAAM,wBAAwB,GAAG,UAC/B,KAAoB,EACpB,YAAwD,EACxD,cAAuB;QAEvB,IAAI,sBAAsB,GAAG,KAAK,CAAC;QACnC,KAAK,IAAM,GAAG,IAAI,YAAY,EAAE;YAC9B,IAAI,KAAK,CAAC,GAA+F,CAAC,EAAE;gBAC1G,sBAAsB,GAAG,IAAI,CAAC;aAC/B;SACF;QAED,OAAO,cAAc,IAAI,sBAAsB,CAAC;IAClD,CAAC,CAAC","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 focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: true } });\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\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"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/Menu/index"), exports);
10
8
  //# sourceMappingURL=Menu.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/Menu.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,yBAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/Menu/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/Menu.ts"],"sourcesContent":["export * from './components/Menu/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/MenuDivider/index"), exports);
10
8
  //# sourceMappingURL=MenuDivider.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/MenuDivider.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,gCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/MenuDivider/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/MenuDivider.ts"],"sourcesContent":["export * from './components/MenuDivider/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/MenuGroup/index"), exports);
10
8
  //# sourceMappingURL=MenuGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/MenuGroup.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,8BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/MenuGroup/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/MenuGroup.ts"],"sourcesContent":["export * from './components/MenuGroup/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/MenuGroupHeader/index"), exports);
10
8
  //# sourceMappingURL=MenuGroupHeader.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/MenuGroupHeader.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,oCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/MenuGroupHeader/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/MenuGroupHeader.ts"],"sourcesContent":["export * from './components/MenuGroupHeader/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/MenuItem/index"), exports);
10
8
  //# sourceMappingURL=MenuItem.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/MenuItem.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,6BAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/MenuItem/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/MenuItem.ts"],"sourcesContent":["export * from './components/MenuItem/index';\n"]}
@@ -3,8 +3,6 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
-
7
6
  const tslib_1 = /*#__PURE__*/require("tslib");
8
-
9
7
  tslib_1.__exportStar(require("./components/MenuItemCheckbox/index"), exports);
10
8
  //# sourceMappingURL=MenuItemCheckbox.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/MenuItemCheckbox.ts"],"names":[],"mappings":";;;;;;;;AAAA,OAAA,CAAA,YAAA,CAAA,OAAA,CAAA,qCAAA,CAAA,EAAA,OAAA","sourcesContent":["export * from './components/MenuItemCheckbox/index';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":";;;;;;AAAAA","names":["tslib_1"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/MenuItemCheckbox.ts"],"sourcesContent":["export * from './components/MenuItemCheckbox/index';\n"]}