@fluentui/react-menu 9.7.14 → 9.7.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (357) hide show
  1. package/CHANGELOG.json +115 -1
  2. package/CHANGELOG.md +34 -2
  3. package/lib/Menu.js +0 -1
  4. package/lib/Menu.js.map +1 -1
  5. package/lib/MenuDivider.js +0 -1
  6. package/lib/MenuDivider.js.map +1 -1
  7. package/lib/MenuGroup.js +0 -1
  8. package/lib/MenuGroup.js.map +1 -1
  9. package/lib/MenuGroupHeader.js +0 -1
  10. package/lib/MenuGroupHeader.js.map +1 -1
  11. package/lib/MenuItem.js +0 -1
  12. package/lib/MenuItem.js.map +1 -1
  13. package/lib/MenuItemCheckbox.js +0 -1
  14. package/lib/MenuItemCheckbox.js.map +1 -1
  15. package/lib/MenuItemRadio.js +0 -1
  16. package/lib/MenuItemRadio.js.map +1 -1
  17. package/lib/MenuList.js +0 -1
  18. package/lib/MenuList.js.map +1 -1
  19. package/lib/MenuPopover.js +0 -1
  20. package/lib/MenuPopover.js.map +1 -1
  21. package/lib/MenuSplitGroup.js +0 -1
  22. package/lib/MenuSplitGroup.js.map +1 -1
  23. package/lib/MenuTrigger.js +0 -1
  24. package/lib/MenuTrigger.js.map +1 -1
  25. package/lib/components/Menu/Menu.js +4 -6
  26. package/lib/components/Menu/Menu.js.map +1 -1
  27. package/lib/components/Menu/Menu.types.js +0 -1
  28. package/lib/components/Menu/Menu.types.js.map +1 -1
  29. package/lib/components/Menu/index.js +0 -1
  30. package/lib/components/Menu/index.js.map +1 -1
  31. package/lib/components/Menu/renderMenu.js +4 -6
  32. package/lib/components/Menu/renderMenu.js.map +1 -1
  33. package/lib/components/Menu/useMenu.js +242 -236
  34. package/lib/components/Menu/useMenu.js.map +1 -1
  35. package/lib/components/Menu/useMenuContextValues.js +22 -39
  36. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  37. package/lib/components/MenuDivider/MenuDivider.js +5 -7
  38. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  39. package/lib/components/MenuDivider/MenuDivider.types.js +1 -2
  40. package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
  41. package/lib/components/MenuDivider/index.js +0 -1
  42. package/lib/components/MenuDivider/index.js.map +1 -1
  43. package/lib/components/MenuDivider/renderMenuDivider.js +4 -9
  44. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  45. package/lib/components/MenuDivider/useMenuDivider.js +12 -14
  46. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  47. package/lib/components/MenuDivider/useMenuDividerStyles.styles.js.map +1 -1
  48. package/lib/components/MenuGroup/MenuGroup.js +6 -8
  49. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  50. package/lib/components/MenuGroup/MenuGroup.types.js +1 -2
  51. package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
  52. package/lib/components/MenuGroup/index.js +0 -1
  53. package/lib/components/MenuGroup/index.js.map +1 -1
  54. package/lib/components/MenuGroup/renderMenuGroup.js +6 -11
  55. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  56. package/lib/components/MenuGroup/useMenuGroup.js +14 -16
  57. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  58. package/lib/components/MenuGroup/useMenuGroupContextValues.js +9 -10
  59. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  60. package/lib/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
  61. package/lib/components/MenuGroupHeader/MenuGroupHeader.js +5 -7
  62. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  63. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js +1 -2
  64. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  65. package/lib/components/MenuGroupHeader/index.js +0 -1
  66. package/lib/components/MenuGroupHeader/index.js.map +1 -1
  67. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +4 -9
  68. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  69. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +12 -16
  70. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  71. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
  72. package/lib/components/MenuItem/MenuItem.js +5 -7
  73. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  74. package/lib/components/MenuItem/MenuItem.types.js +1 -2
  75. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  76. package/lib/components/MenuItem/index.js +0 -1
  77. package/lib/components/MenuItem/index.js.map +1 -1
  78. package/lib/components/MenuItem/renderMenuItem.js +4 -9
  79. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  80. package/lib/components/MenuItem/useCharacterSearch.js +14 -17
  81. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  82. package/lib/components/MenuItem/useMenuItem.js +79 -88
  83. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  84. package/lib/components/MenuItem/useMenuItemStyles.styles.js +5 -5
  85. package/lib/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  86. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +5 -7
  87. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  88. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js +1 -2
  89. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  90. package/lib/components/MenuItemCheckbox/index.js +0 -1
  91. package/lib/components/MenuItemCheckbox/index.js.map +1 -1
  92. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +4 -9
  93. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  94. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +31 -36
  95. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  96. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
  97. package/lib/components/MenuItemRadio/MenuItemRadio.js +5 -7
  98. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  99. package/lib/components/MenuItemRadio/MenuItemRadio.types.js +1 -2
  100. package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  101. package/lib/components/MenuItemRadio/index.js +0 -1
  102. package/lib/components/MenuItemRadio/index.js.map +1 -1
  103. package/lib/components/MenuItemRadio/renderMenuItemRadio.js +4 -9
  104. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  105. package/lib/components/MenuItemRadio/useMenuItemRadio.js +29 -34
  106. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  107. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
  108. package/lib/components/MenuList/MenuList.js +6 -8
  109. package/lib/components/MenuList/MenuList.js.map +1 -1
  110. package/lib/components/MenuList/MenuList.types.js +0 -1
  111. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  112. package/lib/components/MenuList/index.js +0 -1
  113. package/lib/components/MenuList/index.js.map +1 -1
  114. package/lib/components/MenuList/renderMenuList.js +6 -11
  115. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  116. package/lib/components/MenuList/useMenuList.js +130 -126
  117. package/lib/components/MenuList/useMenuList.js.map +1 -1
  118. package/lib/components/MenuList/useMenuListContextValues.js +13 -21
  119. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  120. package/lib/components/MenuList/useMenuListStyles.styles.js.map +1 -1
  121. package/lib/components/MenuPopover/MenuPopover.js +5 -7
  122. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  123. package/lib/components/MenuPopover/MenuPopover.types.js +1 -2
  124. package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
  125. package/lib/components/MenuPopover/index.js +0 -1
  126. package/lib/components/MenuPopover/index.js.map +1 -1
  127. package/lib/components/MenuPopover/renderMenuPopover.js +9 -14
  128. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  129. package/lib/components/MenuPopover/useMenuPopover.js +87 -91
  130. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  131. package/lib/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
  132. package/lib/components/MenuSplitGroup/MenuSplitGroup.js +5 -7
  133. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  134. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +1 -2
  135. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  136. package/lib/components/MenuSplitGroup/index.js +0 -1
  137. package/lib/components/MenuSplitGroup/index.js.map +1 -1
  138. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +4 -9
  139. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  140. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +45 -47
  141. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  142. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
  143. package/lib/components/MenuTrigger/MenuTrigger.js +3 -5
  144. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  145. package/lib/components/MenuTrigger/MenuTrigger.types.js +0 -1
  146. package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  147. package/lib/components/MenuTrigger/index.js +0 -1
  148. package/lib/components/MenuTrigger/index.js.map +1 -1
  149. package/lib/components/MenuTrigger/renderMenuTrigger.js +4 -6
  150. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  151. package/lib/components/MenuTrigger/useMenuTrigger.styles.js.map +1 -1
  152. package/lib/components/index.js +0 -1
  153. package/lib/components/index.js.map +1 -1
  154. package/lib/contexts/menuContext.js +21 -22
  155. package/lib/contexts/menuContext.js.map +1 -1
  156. package/lib/contexts/menuGroupContext.js +3 -4
  157. package/lib/contexts/menuGroupContext.js.map +1 -1
  158. package/lib/contexts/menuListContext.js +8 -9
  159. package/lib/contexts/menuListContext.js.map +1 -1
  160. package/lib/contexts/menuTriggerContext.js +2 -4
  161. package/lib/contexts/menuTriggerContext.js.map +1 -1
  162. package/lib/index.js +0 -1
  163. package/lib/index.js.map +1 -1
  164. package/lib/selectable/index.js +0 -1
  165. package/lib/selectable/index.js.map +1 -1
  166. package/lib/selectable/types.js +0 -1
  167. package/lib/selectable/types.js.map +1 -1
  168. package/lib/selectable/useCheckmarkStyles.styles.js.map +1 -1
  169. package/lib/utils/index.js +0 -1
  170. package/lib/utils/index.js.map +1 -1
  171. package/lib/utils/useIsSubmenu.js +4 -6
  172. package/lib/utils/useIsSubmenu.js.map +1 -1
  173. package/lib/utils/useOnMenuEnter.js +39 -44
  174. package/lib/utils/useOnMenuEnter.js.map +1 -1
  175. package/lib-commonjs/Menu.js +0 -3
  176. package/lib-commonjs/Menu.js.map +1 -1
  177. package/lib-commonjs/MenuDivider.js +0 -3
  178. package/lib-commonjs/MenuDivider.js.map +1 -1
  179. package/lib-commonjs/MenuGroup.js +0 -3
  180. package/lib-commonjs/MenuGroup.js.map +1 -1
  181. package/lib-commonjs/MenuGroupHeader.js +0 -3
  182. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  183. package/lib-commonjs/MenuItem.js +0 -3
  184. package/lib-commonjs/MenuItem.js.map +1 -1
  185. package/lib-commonjs/MenuItemCheckbox.js +0 -3
  186. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  187. package/lib-commonjs/MenuItemRadio.js +0 -3
  188. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  189. package/lib-commonjs/MenuList.js +0 -3
  190. package/lib-commonjs/MenuList.js.map +1 -1
  191. package/lib-commonjs/MenuPopover.js +0 -3
  192. package/lib-commonjs/MenuPopover.js.map +1 -1
  193. package/lib-commonjs/MenuSplitGroup.js +0 -3
  194. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  195. package/lib-commonjs/MenuTrigger.js +0 -3
  196. package/lib-commonjs/MenuTrigger.js.map +1 -1
  197. package/lib-commonjs/components/Menu/Menu.js +1 -3
  198. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  199. package/lib-commonjs/components/Menu/Menu.types.js +0 -3
  200. package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
  201. package/lib-commonjs/components/Menu/index.js +0 -3
  202. package/lib-commonjs/components/Menu/index.js.map +1 -1
  203. package/lib-commonjs/components/Menu/renderMenu.js +1 -3
  204. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  205. package/lib-commonjs/components/Menu/useMenu.js +2 -5
  206. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  207. package/lib-commonjs/components/Menu/useMenuContextValues.js +1 -3
  208. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  209. package/lib-commonjs/components/MenuDivider/MenuDivider.js +1 -3
  210. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  211. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js +0 -3
  212. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  213. package/lib-commonjs/components/MenuDivider/index.js +0 -3
  214. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  215. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +1 -3
  216. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  217. package/lib-commonjs/components/MenuDivider/useMenuDivider.js +1 -3
  218. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  219. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js +0 -2
  220. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js.map +1 -1
  221. package/lib-commonjs/components/MenuGroup/MenuGroup.js +1 -3
  222. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  223. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js +0 -3
  224. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  225. package/lib-commonjs/components/MenuGroup/index.js +0 -3
  226. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  227. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +1 -3
  228. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  229. package/lib-commonjs/components/MenuGroup/useMenuGroup.js +1 -3
  230. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  231. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +1 -3
  232. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  233. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js +0 -2
  234. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
  235. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +1 -3
  236. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  237. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js +0 -3
  238. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  239. package/lib-commonjs/components/MenuGroupHeader/index.js +0 -3
  240. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  241. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +1 -3
  242. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  243. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +1 -3
  244. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  245. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js +0 -2
  246. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
  247. package/lib-commonjs/components/MenuItem/MenuItem.js +1 -3
  248. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  249. package/lib-commonjs/components/MenuItem/MenuItem.types.js +0 -3
  250. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  251. package/lib-commonjs/components/MenuItem/index.js +0 -3
  252. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  253. package/lib-commonjs/components/MenuItem/renderMenuItem.js +1 -3
  254. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  255. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +1 -3
  256. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  257. package/lib-commonjs/components/MenuItem/useMenuItem.js +3 -5
  258. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  259. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js +12 -14
  260. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  261. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +1 -3
  262. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  263. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js +0 -3
  264. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  265. package/lib-commonjs/components/MenuItemCheckbox/index.js +0 -3
  266. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  267. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +1 -3
  268. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  269. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +1 -3
  270. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  271. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js +0 -2
  272. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
  273. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +1 -3
  274. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  275. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js +0 -3
  276. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  277. package/lib-commonjs/components/MenuItemRadio/index.js +0 -3
  278. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  279. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +1 -3
  280. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  281. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +1 -3
  282. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  283. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js +0 -2
  284. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
  285. package/lib-commonjs/components/MenuList/MenuList.js +1 -3
  286. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  287. package/lib-commonjs/components/MenuList/MenuList.types.js +0 -3
  288. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  289. package/lib-commonjs/components/MenuList/index.js +0 -3
  290. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  291. package/lib-commonjs/components/MenuList/renderMenuList.js +1 -3
  292. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  293. package/lib-commonjs/components/MenuList/useMenuList.js +1 -3
  294. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  295. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +1 -3
  296. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  297. package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js +0 -2
  298. package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js.map +1 -1
  299. package/lib-commonjs/components/MenuPopover/MenuPopover.js +1 -3
  300. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  301. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +0 -3
  302. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  303. package/lib-commonjs/components/MenuPopover/index.js +0 -3
  304. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  305. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +1 -3
  306. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  307. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +1 -3
  308. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  309. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js +0 -2
  310. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
  311. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +1 -3
  312. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  313. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +0 -3
  314. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  315. package/lib-commonjs/components/MenuSplitGroup/index.js +0 -3
  316. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  317. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +1 -3
  318. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  319. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +1 -3
  320. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  321. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js +0 -2
  322. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
  323. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +1 -3
  324. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  325. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js +0 -3
  326. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  327. package/lib-commonjs/components/MenuTrigger/index.js +0 -3
  328. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  329. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +1 -3
  330. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  331. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.styles.js +0 -2
  332. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.styles.js.map +1 -1
  333. package/lib-commonjs/components/index.js +0 -3
  334. package/lib-commonjs/components/index.js.map +1 -1
  335. package/lib-commonjs/contexts/menuContext.js +2 -4
  336. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  337. package/lib-commonjs/contexts/menuGroupContext.js +1 -3
  338. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  339. package/lib-commonjs/contexts/menuListContext.js +2 -4
  340. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  341. package/lib-commonjs/contexts/menuTriggerContext.js +1 -3
  342. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  343. package/lib-commonjs/index.js +0 -3
  344. package/lib-commonjs/index.js.map +1 -1
  345. package/lib-commonjs/selectable/index.js +0 -3
  346. package/lib-commonjs/selectable/index.js.map +1 -1
  347. package/lib-commonjs/selectable/types.js +0 -3
  348. package/lib-commonjs/selectable/types.js.map +1 -1
  349. package/lib-commonjs/selectable/useCheckmarkStyles.styles.js +0 -2
  350. package/lib-commonjs/selectable/useCheckmarkStyles.styles.js.map +1 -1
  351. package/lib-commonjs/utils/index.js +0 -3
  352. package/lib-commonjs/utils/index.js.map +1 -1
  353. package/lib-commonjs/utils/useIsSubmenu.js +1 -3
  354. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  355. package/lib-commonjs/utils/useOnMenuEnter.js +1 -3
  356. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  357. package/package.json +10 -10
@@ -6,142 +6,146 @@ import { useMenuContext_unstable } from '../../contexts/menuContext';
6
6
  import { MenuContext } from '../../contexts/menuContext';
7
7
  /**
8
8
  * Returns the props and state required to render the component
9
- */
10
- export const useMenuList_unstable = (props, ref) => {
11
- const {
12
- findAllFocusable
13
- } = useFocusFinders();
14
- const menuContext = useMenuContextSelectors();
15
- const hasMenuContext = useHasParentContext(MenuContext);
16
- const focusAttributes = useArrowNavigationGroup({
17
- circular: true,
18
- ignoreDefaultKeydown: {
19
- Tab: hasMenuContext
20
- }
21
- });
22
- if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {
23
- // TODO throw warnings in development safely
24
- // eslint-disable-next-line no-console
25
- console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');
26
- }
27
- const innerRef = React.useRef(null);
28
- const setFocusByFirstCharacter = React.useCallback((e, itemEl) => {
29
- // TODO use some kind of children registration to reduce dependency on DOM roles
30
- const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];
31
- if (!innerRef.current) {
32
- return;
33
- }
34
- const menuItems = findAllFocusable(innerRef.current, el => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')) !== -1);
35
- let startIndex = menuItems.indexOf(itemEl) + 1;
36
- if (startIndex === menuItems.length) {
37
- startIndex = 0;
9
+ */ export const useMenuList_unstable = (props, ref)=>{
10
+ const { findAllFocusable } = useFocusFinders();
11
+ const menuContext = useMenuContextSelectors();
12
+ const hasMenuContext = useHasParentContext(MenuContext);
13
+ const focusAttributes = useArrowNavigationGroup({
14
+ circular: true,
15
+ ignoreDefaultKeydown: {
16
+ Tab: hasMenuContext
17
+ }
18
+ });
19
+ if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {
20
+ // TODO throw warnings in development safely
21
+ // eslint-disable-next-line no-console
22
+ console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');
38
23
  }
39
- const firstChars = menuItems.map(menuItem => {
40
- var _menuItem_textContent;
41
- return (_menuItem_textContent = menuItem.textContent) === null || _menuItem_textContent === void 0 ? void 0 : _menuItem_textContent.charAt(0).toLowerCase();
24
+ const innerRef = React.useRef(null);
25
+ const setFocusByFirstCharacter = React.useCallback((e, itemEl)=>{
26
+ // TODO use some kind of children registration to reduce dependency on DOM roles
27
+ const acceptedRoles = [
28
+ 'menuitem',
29
+ 'menuitemcheckbox',
30
+ 'menuitemradio'
31
+ ];
32
+ if (!innerRef.current) {
33
+ return;
34
+ }
35
+ const menuItems = findAllFocusable(innerRef.current, (el)=>el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')) !== -1);
36
+ let startIndex = menuItems.indexOf(itemEl) + 1;
37
+ if (startIndex === menuItems.length) {
38
+ startIndex = 0;
39
+ }
40
+ const firstChars = menuItems.map((menuItem)=>{
41
+ var _menuItem_textContent;
42
+ return (_menuItem_textContent = menuItem.textContent) === null || _menuItem_textContent === void 0 ? void 0 : _menuItem_textContent.charAt(0).toLowerCase();
43
+ });
44
+ const char = e.key.toLowerCase();
45
+ const getIndexFirstChars = (start, firstChar)=>{
46
+ for(let i = start; i < firstChars.length; i++){
47
+ if (char === firstChars[i]) {
48
+ return i;
49
+ }
50
+ }
51
+ return -1;
52
+ };
53
+ // Check remaining slots in the menu
54
+ let index = getIndexFirstChars(startIndex, char);
55
+ // If not found in remaining slots, check from beginning
56
+ if (index === -1) {
57
+ index = getIndexFirstChars(0, char);
58
+ }
59
+ // If match was found...
60
+ if (index > -1) {
61
+ menuItems[index].focus();
62
+ }
63
+ }, [
64
+ findAllFocusable
65
+ ]);
66
+ var _props_checkedValues;
67
+ const [checkedValues, setCheckedValues] = useControllableState({
68
+ state: (_props_checkedValues = props.checkedValues) !== null && _props_checkedValues !== void 0 ? _props_checkedValues : hasMenuContext ? menuContext.checkedValues : undefined,
69
+ defaultState: props.defaultCheckedValues,
70
+ initialState: {}
42
71
  });
43
- const char = e.key.toLowerCase();
44
- const getIndexFirstChars = (start, firstChar) => {
45
- for (let i = start; i < firstChars.length; i++) {
46
- if (char === firstChars[i]) {
47
- return i;
72
+ var _props_onCheckedValueChange;
73
+ const handleCheckedValueChange = (_props_onCheckedValueChange = props.onCheckedValueChange) !== null && _props_onCheckedValueChange !== void 0 ? _props_onCheckedValueChange : hasMenuContext ? menuContext.onCheckedValueChange : undefined;
74
+ const toggleCheckbox = useEventCallback((e, name, value, checked)=>{
75
+ const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
76
+ const newCheckedItems = [
77
+ ...checkedItems
78
+ ];
79
+ if (checked) {
80
+ newCheckedItems.splice(newCheckedItems.indexOf(value), 1);
81
+ } else {
82
+ newCheckedItems.push(value);
48
83
  }
49
- }
50
- return -1;
51
- };
52
- // Check remaining slots in the menu
53
- let index = getIndexFirstChars(startIndex, char);
54
- // If not found in remaining slots, check from beginning
55
- if (index === -1) {
56
- index = getIndexFirstChars(0, char);
57
- }
58
- // If match was found...
59
- if (index > -1) {
60
- menuItems[index].focus();
61
- }
62
- }, [findAllFocusable]);
63
- var _props_checkedValues;
64
- const [checkedValues, setCheckedValues] = useControllableState({
65
- state: (_props_checkedValues = props.checkedValues) !== null && _props_checkedValues !== void 0 ? _props_checkedValues : hasMenuContext ? menuContext.checkedValues : undefined,
66
- defaultState: props.defaultCheckedValues,
67
- initialState: {}
68
- });
69
- var _props_onCheckedValueChange;
70
- const handleCheckedValueChange = (_props_onCheckedValueChange = props.onCheckedValueChange) !== null && _props_onCheckedValueChange !== void 0 ? _props_onCheckedValueChange : hasMenuContext ? menuContext.onCheckedValueChange : undefined;
71
- const toggleCheckbox = useEventCallback((e, name, value, checked) => {
72
- const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
73
- const newCheckedItems = [...checkedItems];
74
- if (checked) {
75
- newCheckedItems.splice(newCheckedItems.indexOf(value), 1);
76
- } else {
77
- newCheckedItems.push(value);
78
- }
79
- handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
80
- name,
81
- checkedItems: newCheckedItems
84
+ handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
85
+ name,
86
+ checkedItems: newCheckedItems
87
+ });
88
+ setCheckedValues((s)=>({
89
+ ...s,
90
+ [name]: newCheckedItems
91
+ }));
82
92
  });
83
- setCheckedValues(s => ({
84
- ...s,
85
- [name]: newCheckedItems
86
- }));
87
- });
88
- const selectRadio = useEventCallback((e, name, value) => {
89
- const newCheckedItems = [value];
90
- setCheckedValues(s => ({
91
- ...s,
92
- [name]: newCheckedItems
93
- }));
94
- handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
95
- name,
96
- checkedItems: newCheckedItems
93
+ const selectRadio = useEventCallback((e, name, value)=>{
94
+ const newCheckedItems = [
95
+ value
96
+ ];
97
+ setCheckedValues((s)=>({
98
+ ...s,
99
+ [name]: newCheckedItems
100
+ }));
101
+ handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
102
+ name,
103
+ checkedItems: newCheckedItems
104
+ });
97
105
  });
98
- });
99
- return {
100
- components: {
101
- root: 'div'
102
- },
103
- root: getNativeElementProps('div', {
104
- ref: useMergedRefs(ref, innerRef),
105
- role: 'menu',
106
- 'aria-labelledby': menuContext.triggerId,
107
- ...focusAttributes,
108
- ...props
109
- }),
110
- hasIcons: menuContext.hasIcons || false,
111
- hasCheckmarks: menuContext.hasCheckmarks || false,
112
- checkedValues,
113
- setFocusByFirstCharacter,
114
- selectRadio,
115
- toggleCheckbox
116
- };
106
+ return {
107
+ components: {
108
+ root: 'div'
109
+ },
110
+ root: getNativeElementProps('div', {
111
+ ref: useMergedRefs(ref, innerRef),
112
+ role: 'menu',
113
+ 'aria-labelledby': menuContext.triggerId,
114
+ ...focusAttributes,
115
+ ...props
116
+ }),
117
+ hasIcons: menuContext.hasIcons || false,
118
+ hasCheckmarks: menuContext.hasCheckmarks || false,
119
+ checkedValues,
120
+ setFocusByFirstCharacter,
121
+ selectRadio,
122
+ toggleCheckbox
123
+ };
117
124
  };
118
125
  /**
119
126
  * Adds some sugar to fetching multiple context selector values
120
- */
121
- const useMenuContextSelectors = () => {
122
- const checkedValues = useMenuContext_unstable(context => context.checkedValues);
123
- const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);
124
- const triggerId = useMenuContext_unstable(context => context.triggerId);
125
- const hasIcons = useMenuContext_unstable(context => context.hasIcons);
126
- const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);
127
- return {
128
- checkedValues,
129
- onCheckedValueChange,
130
- triggerId,
131
- hasIcons,
132
- hasCheckmarks
133
- };
127
+ */ const useMenuContextSelectors = ()=>{
128
+ const checkedValues = useMenuContext_unstable((context)=>context.checkedValues);
129
+ const onCheckedValueChange = useMenuContext_unstable((context)=>context.onCheckedValueChange);
130
+ const triggerId = useMenuContext_unstable((context)=>context.triggerId);
131
+ const hasIcons = useMenuContext_unstable((context)=>context.hasIcons);
132
+ const hasCheckmarks = useMenuContext_unstable((context)=>context.hasCheckmarks);
133
+ return {
134
+ checkedValues,
135
+ onCheckedValueChange,
136
+ triggerId,
137
+ hasIcons,
138
+ hasCheckmarks
139
+ };
134
140
  };
135
141
  /**
136
142
  * Helper function to detect if props and MenuContext values are both used
137
- */
138
- const usingPropsAndMenuContext = (props, contextValue, hasMenuContext) => {
139
- let isUsingPropsAndContext = false;
140
- for (const val in contextValue) {
141
- if (props[val]) {
142
- isUsingPropsAndContext = true;
143
+ */ const usingPropsAndMenuContext = (props, contextValue, hasMenuContext)=>{
144
+ let isUsingPropsAndContext = false;
145
+ for(const val in contextValue){
146
+ if (props[val]) {
147
+ isUsingPropsAndContext = true;
148
+ }
143
149
  }
144
- }
145
- return hasMenuContext && isUsingPropsAndContext;
150
+ return hasMenuContext && isUsingPropsAndContext;
146
151
  };
147
- //# sourceMappingURL=useMenuList.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMergedRefs","useEventCallback","useControllableState","getNativeElementProps","useArrowNavigationGroup","useFocusFinders","useHasParentContext","useMenuContext_unstable","MenuContext","useMenuList_unstable","props","ref","findAllFocusable","menuContext","useMenuContextSelectors","hasMenuContext","focusAttributes","circular","ignoreDefaultKeydown","Tab","usingPropsAndMenuContext","console","warn","innerRef","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","_menuItem_textContent","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","_props_checkedValues","checkedValues","setCheckedValues","state","undefined","defaultState","defaultCheckedValues","initialState","_props_onCheckedValueChange","handleCheckedValueChange","onCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","role","triggerId","hasIcons","hasCheckmarks","context","contextValue","isUsingPropsAndContext","val"],"sources":["../../../src/components/MenuList/useMenuList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: hasMenuContext } });\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? menuContext.checkedValues : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? menuContext.onCheckedValueChange : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB;AACP,SAASC,uBAAuB,EAAEC,eAAe,QAAQ;AACzD,SAASC,mBAAmB,QAAQ;AACpC,SAASC,uBAAuB,QAAQ;AACxC,SAASC,WAAW,QAAQ;AAG5B;;;AAGA,OAAO,MAAMC,oBAAA,GAAuBA,CAACC,KAAA,EAAsBC,GAAA,KAA+C;EACxG,MAAM;IAAEC;EAAgB,CAAE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,OAAA,CAAQ1B,aAAa;EAC9E,MAAMS,oBAAA,GAAuBxD,uBAAA,CAAwByE,OAAA,IAAWA,OAAA,CAAQjB,oBAAoB;EAC5F,MAAMc,SAAA,GAAYtE,uBAAA,CAAwByE,OAAA,IAAWA,OAAA,CAAQH,SAAS;EACtE,MAAMC,QAAA,GAAWvE,uBAAA,CAAwByE,OAAA,IAAWA,OAAA,CAAQF,QAAQ;EACpE,MAAMC,aAAA,GAAgBxE,uBAAA,CAAwByE,OAAA,IAAWA,OAAA,CAAQD,aAAa;EAE9E,OAAO;IACLzB,aAAA;IACAS,oBAAA;IACAc,SAAA;IACAC,QAAA;IACAC;EACF;AACF;AAEA;;;AAGA,MAAM3D,wBAAA,GAA2BA,CAC/BV,KAAA,EACAuE,YAAA,EACAlE,cAAA,KACG;EACH,IAAImE,sBAAA,GAAyB,KAAK;EAClC,KAAK,MAAMC,GAAA,IAAOF,YAAA,EAAc;IAC9B,IAAIvE,KAAK,CAACyE,GAAA,CAAgG,EAAE;MAC1GD,sBAAA,GAAyB,IAAI;IAC/B;EACF;EAEA,OAAOnE,cAAA,IAAkBmE,sBAAA;AAC3B"}
1
+ {"version":3,"sources":["useMenuList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: hasMenuContext } });\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues ?? (hasMenuContext ? menuContext.checkedValues : undefined),\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange =\n props.onCheckedValueChange ?? (hasMenuContext ? menuContext.onCheckedValueChange : undefined);\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"names":["React","useMergedRefs","useEventCallback","useControllableState","getNativeElementProps","useArrowNavigationGroup","useFocusFinders","useHasParentContext","useMenuContext_unstable","MenuContext","useMenuList_unstable","props","ref","findAllFocusable","menuContext","useMenuContextSelectors","hasMenuContext","focusAttributes","circular","ignoreDefaultKeydown","Tab","usingPropsAndMenuContext","console","warn","innerRef","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","checkedValues","setCheckedValues","state","undefined","defaultState","defaultCheckedValues","initialState","handleCheckedValueChange","onCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","role","triggerId","hasIcons","hasCheckmarks","context","contextValue","isUsingPropsAndContext","val"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB,4BAA4B;AACnC,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,0BAA0B;AACnF,SAASC,mBAAmB,QAAQ,mCAAmC;AACvE,SAASC,uBAAuB,QAAQ,6BAA6B;AACrE,SAASC,WAAW,QAAQ,6BAA6B;AAGzD;;CAEC,GACD,OAAO,MAAMC,uBAAuB,CAACC,OAAsBC,MAA+C;IACxG,MAAM,EAAEC,iBAAgB,EAAE,GAAGP;IAC7B,MAAMQ,cAAcC;IACpB,MAAMC,iBAAiBT,oBAAoBE;IAC3C,MAAMQ,kBAAkBZ,wBAAwB;QAAEa,UAAU,IAAI;QAAEC,sBAAsB;YAAEC,KAAKJ;QAAe;IAAE;IAEhH,IAAIK,yBAAyBV,OAAOG,aAAaE,iBAAiB;QAChE,4CAA4C;QAC5C,sCAAsC;QACtCM,QAAQC,IAAI,CAAC;IACf,CAAC;IAED,MAAMC,WAAWxB,MAAMyB,MAAM,CAAc,IAAI;IAE/C,MAAMC,2BAA2B1B,MAAM2B,WAAW,CAChD,CAACC,GAAqCC,SAAwB;QAC5D,gFAAgF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eAAe/D,YAAY+D,aAAa,IAAI,KAAK;QACjDxB;QACA3B;QACA6C;QACAT;IACF;AACF,EAAE;AAEF;;CAEC,GACD,MAAM/C,0BAA0B,IAAM;IACpC,MAAMsC,gBAAgB7C,wBAAwBsE,CAAAA,UAAWA,QAAQzB,aAAa;IAC9E,MAAMQ,uBAAuBrD,wBAAwBsE,CAAAA,UAAWA,QAAQjB,oBAAoB;IAC5F,MAAMc,YAAYnE,wBAAwBsE,CAAAA,UAAWA,QAAQH,SAAS;IACtE,MAAMC,WAAWpE,wBAAwBsE,CAAAA,UAAWA,QAAQF,QAAQ;IACpE,MAAMC,gBAAgBrE,wBAAwBsE,CAAAA,UAAWA,QAAQD,aAAa;IAE9E,OAAO;QACLxB;QACAQ;QACAc;QACAC;QACAC;IACF;AACF;AAEA;;CAEC,GACD,MAAMxD,2BAA2B,CAC/BV,OACAoE,cACA/D,iBACG;IACH,IAAIgE,yBAAyB,KAAK;IAClC,IAAK,MAAMC,OAAOF,aAAc;QAC9B,IAAIpE,KAAK,CAACsE,IAAgG,EAAE;YAC1GD,yBAAyB,IAAI;QAC/B,CAAC;IACH;IAEA,OAAOhE,kBAAkBgE;AAC3B"}
@@ -1,23 +1,15 @@
1
1
  export function useMenuListContextValues_unstable(state) {
2
- const {
3
- checkedValues,
4
- hasCheckmarks,
5
- hasIcons,
6
- selectRadio,
7
- setFocusByFirstCharacter,
8
- toggleCheckbox
9
- } = state;
10
- // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
11
- const menuList = {
12
- checkedValues,
13
- hasCheckmarks,
14
- hasIcons,
15
- selectRadio,
16
- setFocusByFirstCharacter,
17
- toggleCheckbox
18
- };
19
- return {
20
- menuList
21
- };
2
+ const { checkedValues , hasCheckmarks , hasIcons , selectRadio , setFocusByFirstCharacter , toggleCheckbox } = state;
3
+ // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
4
+ const menuList = {
5
+ checkedValues,
6
+ hasCheckmarks,
7
+ hasIcons,
8
+ selectRadio,
9
+ setFocusByFirstCharacter,
10
+ toggleCheckbox
11
+ };
12
+ return {
13
+ menuList
14
+ };
22
15
  }
23
- //# sourceMappingURL=useMenuListContextValues.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList"],"sources":["../../../src/components/MenuList/useMenuListContextValues.ts"],"sourcesContent":["import type { MenuListContextValues, MenuListState } from './MenuList.types';\n\nexport function useMenuListContextValues_unstable(state: MenuListState): MenuListContextValues {\n const { checkedValues, hasCheckmarks, hasIcons, selectRadio, setFocusByFirstCharacter, toggleCheckbox } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox,\n };\n\n return { menuList };\n}\n"],"mappings":"AAEA,OAAO,SAASA,kCAAkCC,KAAoB,EAAyB;EAC7F,MAAM;IAAEC,aAAA;IAAeC,aAAA;IAAeC,QAAA;IAAUC,WAAA;IAAaC,wBAAA;IAA0BC;EAAc,CAAE,GAAGN,KAAA;EAE1G;EACA,MAAMO,QAAA,GAAW;IACfN,aAAA;IACAC,aAAA;IACAC,QAAA;IACAC,WAAA;IACAC,wBAAA;IACAC;EACF;EAEA,OAAO;IAAEC;EAAS;AACpB"}
1
+ {"version":3,"sources":["useMenuListContextValues.ts"],"sourcesContent":["import type { MenuListContextValues, MenuListState } from './MenuList.types';\n\nexport function useMenuListContextValues_unstable(state: MenuListState): MenuListContextValues {\n const { checkedValues, hasCheckmarks, hasIcons, selectRadio, setFocusByFirstCharacter, toggleCheckbox } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox,\n };\n\n return { menuList };\n}\n"],"names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList"],"mappings":"AAEA,OAAO,SAASA,kCAAkCC,KAAoB,EAAyB;IAC7F,MAAM,EAAEC,cAAa,EAAEC,cAAa,EAAEC,SAAQ,EAAEC,YAAW,EAAEC,yBAAwB,EAAEC,eAAc,EAAE,GAAGN;IAE1G,mGAAmG;IACnG,MAAMO,WAAW;QACfN;QACAC;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,OAAO;QAAEC;IAAS;AACpB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"names":["mergeClasses","__styles","shorthands","menuListClassNames","root","useStyles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","d","useMenuListStyles_unstable","state","styles","className"],"sources":["../../../src/components/MenuList/useMenuListStyles.styles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport type { MenuListSlots, MenuListState } from './MenuList.types';\n\nexport const menuListClassNames: SlotClassNames<MenuListSlots> = {\n root: 'fui-MenuList',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.gap('2px'),\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuListStyles_unstable = (state: MenuListState): MenuListState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":"AACA,SAASA,YAAY,EAAAC,QAAA,EAAcC,UAAU,QAAQ;AAGrD,OAAO,MAAMC,kBAAA,GAAoD;EAC/DC,IAAA,EAAM;AACR;AAEA,MAAMC,SAAA,gBAAYJ,QAAA;EAAAG,IAAA;IAAAE,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,EAMlB;AAEA;;;AAGA,OAAO,MAAMC,0BAAA,GAA8BC,KAAA,IAAwC;EACjF,MAAMC,MAAA,GAASR,SAAA;EACfO,KAAA,CAAMR,IAAI,CAACU,SAAS,GAAGd,YAAA,CAAaG,kBAAA,CAAmBC,IAAI,EAAES,MAAA,CAAOT,IAAI,EAAEQ,KAAA,CAAMR,IAAI,CAACU,SAAS;EAC9F,OAAOF,KAAA;AACT"}
1
+ {"version":3,"names":["mergeClasses","__styles","shorthands","menuListClassNames","root","useStyles","mc9l5x","Beiy3e4","i8kkvl","Belr9w4","d","useMenuListStyles_unstable","state","styles","className"],"sources":["useMenuListStyles.styles.js"],"sourcesContent":["import { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nexport const menuListClassNames = {\n root: 'fui-MenuList'\n};\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.gap('2px')\n }\n});\n/**\n * Apply styling to the Menu slots based on the state\n */ export const useMenuListStyles_unstable = (state)=>{\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"mappings":"AAAA,SAASA,YAAY,EAAAC,QAAA,EAAcC,UAAU,QAAQ,gBAAgB;AACrE,OAAO,MAAMC,kBAAkB,GAAG;EAC9BC,IAAI,EAAE;AACV,CAAC;AACD,MAAMC,SAAS,gBAAGJ,QAAA;EAAAG,IAAA;IAAAE,MAAA;IAAAC,OAAA;IAAAC,MAAA;IAAAC,OAAA;EAAA;AAAA;EAAAC,CAAA;AAAA,CAMjB,CAAC;AACF;AACA;AACA;AAAI,OAAO,MAAMC,0BAA0B,GAAIC,KAAK,IAAG;EACnD,MAAMC,MAAM,GAAGR,SAAS,CAAC,CAAC;EAC1BO,KAAK,CAACR,IAAI,CAACU,SAAS,GAAGd,YAAY,CAACG,kBAAkB,CAACC,IAAI,EAAES,MAAM,CAACT,IAAI,EAAEQ,KAAK,CAACR,IAAI,CAACU,SAAS,CAAC;EAC/F,OAAOF,KAAK;AAChB,CAAC"}
@@ -5,12 +5,10 @@ import { renderMenuPopover_unstable } from './renderMenuPopover';
5
5
  import { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';
6
6
  /**
7
7
  * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus
8
- */
9
- export const MenuPopover = /*#__PURE__*/React.forwardRef((props, ref) => {
10
- const state = useMenuPopover_unstable(props, ref);
11
- useMenuPopoverStyles_unstable(state);
12
- useCustomStyleHook_unstable('useMenuPopoverStyles_unstable')(state);
13
- return renderMenuPopover_unstable(state);
8
+ */ export const MenuPopover = /*#__PURE__*/ React.forwardRef((props, ref)=>{
9
+ const state = useMenuPopover_unstable(props, ref);
10
+ useMenuPopoverStyles_unstable(state);
11
+ useCustomStyleHook_unstable('useMenuPopoverStyles_unstable')(state);
12
+ return renderMenuPopover_unstable(state);
14
13
  });
15
14
  MenuPopover.displayName = 'MenuPopover';
16
- //# sourceMappingURL=MenuPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","useMenuPopover_unstable","useMenuPopoverStyles_unstable","renderMenuPopover_unstable","useCustomStyleHook_unstable","MenuPopover","forwardRef","props","ref","state","displayName"],"sources":["../../../src/components/MenuPopover/MenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles.styles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport type { MenuPopoverProps } from './MenuPopover.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover: ForwardRefComponent<MenuPopoverProps> = React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n\n useMenuPopoverStyles_unstable(state);\n\n useCustomStyleHook_unstable('useMenuPopoverStyles_unstable')(state);\n\n return renderMenuPopover_unstable(state);\n});\n\nMenuPopover.displayName = 'MenuPopover';\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,SAASC,uBAAuB,QAAQ;AACxC,SAASC,6BAA6B,QAAQ;AAC9C,SAASC,0BAA0B,QAAQ;AAG3C,SAASC,2BAA2B,QAAQ;AAE5C;;;AAGA,OAAO,MAAMC,WAAA,gBAAqDL,KAAA,CAAMM,UAAU,CAAC,CAACC,KAAA,EAAOC,GAAA,KAAQ;EACjG,MAAMC,KAAA,GAAQR,uBAAA,CAAwBM,KAAA,EAAOC,GAAA;EAE7CN,6BAAA,CAA8BO,KAAA;EAE9BL,2BAAA,CAA4B,iCAAiCK,KAAA;EAE7D,OAAON,0BAAA,CAA2BM,KAAA;AACpC;AAEAJ,WAAA,CAAYK,WAAW,GAAG"}
1
+ {"version":3,"sources":["MenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles.styles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport type { MenuPopoverProps } from './MenuPopover.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport { useCustomStyleHook_unstable } from '@fluentui/react-shared-contexts';\n\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover: ForwardRefComponent<MenuPopoverProps> = React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n\n useMenuPopoverStyles_unstable(state);\n\n useCustomStyleHook_unstable('useMenuPopoverStyles_unstable')(state);\n\n return renderMenuPopover_unstable(state);\n});\n\nMenuPopover.displayName = 'MenuPopover';\n"],"names":["React","useMenuPopover_unstable","useMenuPopoverStyles_unstable","renderMenuPopover_unstable","useCustomStyleHook_unstable","MenuPopover","forwardRef","props","ref","state","displayName"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,uBAAuB,QAAQ,mBAAmB;AAC3D,SAASC,6BAA6B,QAAQ,gCAAgC;AAC9E,SAASC,0BAA0B,QAAQ,sBAAsB;AAGjE,SAASC,2BAA2B,QAAQ,kCAAkC;AAE9E;;CAEC,GACD,OAAO,MAAMC,4BAAqDL,MAAMM,UAAU,CAAC,CAACC,OAAOC,MAAQ;IACjG,MAAMC,QAAQR,wBAAwBM,OAAOC;IAE7CN,8BAA8BO;IAE9BL,4BAA4B,iCAAiCK;IAE7D,OAAON,2BAA2BM;AACpC,GAAG;AAEHJ,YAAYK,WAAW,GAAG"}
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=MenuPopover.types.js.map
1
+ export { };
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/components/MenuPopover/MenuPopover.types.ts"],"sourcesContent":["import type { PortalProps } from '@fluentui/react-portal';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuPopoverSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * MenuPopover Props\n */\nexport type MenuPopoverProps = ComponentProps<MenuPopoverSlots>;\n\n/**\n * State used in rendering MenuPopover\n */\nexport type MenuPopoverState = ComponentState<MenuPopoverSlots> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order\n * This option is disregarded for submenus\n */\n inline: boolean;\n };\n"],"mappings":"AAAA"}
1
+ {"version":3,"sources":["MenuPopover.types.ts"],"sourcesContent":["import type { PortalProps } from '@fluentui/react-portal';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuPopoverSlots = {\n root: Slot<'div'>;\n};\n\n/**\n * MenuPopover Props\n */\nexport type MenuPopoverProps = ComponentProps<MenuPopoverSlots>;\n\n/**\n * State used in rendering MenuPopover\n */\nexport type MenuPopoverState = ComponentState<MenuPopoverSlots> &\n Pick<PortalProps, 'mountNode'> & {\n /**\n * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order\n * This option is disregarded for submenus\n */\n inline: boolean;\n };\n"],"names":[],"mappings":"AAAA,WAsBI"}
@@ -3,4 +3,3 @@ export * from './MenuPopover.types';
3
3
  export * from './renderMenuPopover';
4
4
  export * from './useMenuPopover';
5
5
  export * from './useMenuPopoverStyles.styles';
6
- //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../../src/components/MenuPopover/index.ts"],"sourcesContent":["export * from './MenuPopover';\nexport * from './MenuPopover.types';\nexport * from './renderMenuPopover';\nexport * from './useMenuPopover';\nexport * from './useMenuPopoverStyles.styles';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc"}
1
+ {"version":3,"sources":["index.ts"],"sourcesContent":["export * from './MenuPopover';\nexport * from './MenuPopover.types';\nexport * from './renderMenuPopover';\nexport * from './useMenuPopover';\nexport * from './useMenuPopoverStyles.styles';\n"],"names":[],"mappings":"AAAA,cAAc,gBAAgB;AAC9B,cAAc,sBAAsB;AACpC,cAAc,sBAAsB;AACpC,cAAc,mBAAmB;AACjC,cAAc,gCAAgC"}
@@ -1,19 +1,14 @@
1
- /** @jsxRuntime classic */ /** @jsx createElement */import { createElement } from '@fluentui/react-jsx-runtime';
1
+ /** @jsxRuntime classic */ /** @jsx createElement */ import { createElement } from '@fluentui/react-jsx-runtime';
2
2
  import { getSlotsNext } from '@fluentui/react-utilities';
3
3
  import { Portal } from '@fluentui/react-portal';
4
4
  /**
5
5
  * Render the final JSX of MenuPopover
6
- */
7
- export const renderMenuPopover_unstable = state => {
8
- const {
9
- slots,
10
- slotProps
11
- } = getSlotsNext(state);
12
- if (state.inline) {
13
- return /*#__PURE__*/createElement(slots.root, slotProps.root);
14
- }
15
- return /*#__PURE__*/createElement(Portal, {
16
- mountNode: state.mountNode
17
- }, /*#__PURE__*/createElement(slots.root, slotProps.root));
6
+ */ export const renderMenuPopover_unstable = (state)=>{
7
+ const { slots , slotProps } = getSlotsNext(state);
8
+ if (state.inline) {
9
+ return /*#__PURE__*/ createElement(slots.root, slotProps.root);
10
+ }
11
+ return /*#__PURE__*/ createElement(Portal, {
12
+ mountNode: state.mountNode
13
+ }, /*#__PURE__*/ createElement(slots.root, slotProps.root));
18
14
  };
19
- //# sourceMappingURL=renderMenuPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createElement","getSlotsNext","Portal","renderMenuPopover_unstable","state","slots","slotProps","inline","root","mountNode"],"sources":["../../../src/components/MenuPopover/renderMenuPopover.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = (state: MenuPopoverState) => {\n const { slots, slotProps } = getSlotsNext<MenuPopoverSlots>(state);\n\n if (state.inline) {\n return <slots.root {...slotProps.root} />;\n }\n\n return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root} />\n </Portal>\n );\n};\n"],"mappings":"AAAA,2BACA,yBAEA,SAASA,aAAa,QAAQ;AAC9B,SAASC,YAAY,QAAQ;AAE7B,SAASC,MAAM,QAAQ;AAEvB;;;AAGA,OAAO,MAAMC,0BAAA,GAA8BC,KAAA,IAA4B;EACrE,MAAM;IAAEC,KAAA;IAAOC;EAAS,CAAE,GAAGL,YAAA,CAA+BG,KAAA;EAE5D,IAAIA,KAAA,CAAMG,MAAM,EAAE;IAChB,oBAAOP,aAdX,CAcYK,KAAA,CAAMG,IAAI,EAAKF,SAAA,CAAUE,IAAI;EACvC;EAEA,oBACER,aAlBJ,CAkBKE,MAAA;IAAOO,SAAA,EAAWL,KAAA,CAAMK;kBACvBT,aAnBN,CAmBOK,KAAA,CAAMG,IAAI,EAAKF,SAAA,CAAUE,IAAI;AAGpC"}
1
+ {"version":3,"sources":["renderMenuPopover.tsx"],"sourcesContent":["/** @jsxRuntime classic */\n/** @jsx createElement */\n\nimport { createElement } from '@fluentui/react-jsx-runtime';\nimport { getSlotsNext } from '@fluentui/react-utilities';\nimport { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = (state: MenuPopoverState) => {\n const { slots, slotProps } = getSlotsNext<MenuPopoverSlots>(state);\n\n if (state.inline) {\n return <slots.root {...slotProps.root} />;\n }\n\n return (\n <Portal mountNode={state.mountNode}>\n <slots.root {...slotProps.root} />\n </Portal>\n );\n};\n"],"names":["createElement","getSlotsNext","Portal","renderMenuPopover_unstable","state","slots","slotProps","inline","root","mountNode"],"mappings":"AAAA,wBAAwB,GACxB,uBAAuB,GAEvB,SAASA,aAAa,QAAQ,8BAA8B;AAC5D,SAASC,YAAY,QAAQ,4BAA4B;AAEzD,SAASC,MAAM,QAAQ,yBAAyB;AAEhD;;CAEC,GACD,OAAO,MAAMC,6BAA6B,CAACC,QAA4B;IACrE,MAAM,EAAEC,MAAK,EAAEC,UAAS,EAAE,GAAGL,aAA+BG;IAE5D,IAAIA,MAAMG,MAAM,EAAE;QAChB,qBAAO,AAdX,cAcYF,MAAMG,IAAI,EAAKF,UAAUE,IAAI;IACvC,CAAC;IAED,qBACE,AAlBJ,cAkBKN;QAAOO,WAAWL,MAAMK,SAAS;qBAChC,AAnBN,cAmBOJ,MAAMG,IAAI,EAAKF,UAAUE,IAAI;AAGpC,EAAE"}