@fluentui/react-menu 9.0.0-rc.7 → 9.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (337) hide show
  1. package/CHANGELOG.json +559 -1
  2. package/CHANGELOG.md +276 -132
  3. package/dist/{react-menu.d.ts → index.d.ts} +125 -155
  4. package/{lib → dist}/tsdoc-metadata.json +0 -0
  5. package/lib/components/Menu/Menu.js.map +1 -1
  6. package/lib/components/Menu/Menu.types.js.map +1 -1
  7. package/lib/components/Menu/renderMenu.js.map +1 -1
  8. package/lib/components/Menu/useMenu.js +21 -7
  9. package/lib/components/Menu/useMenu.js.map +1 -1
  10. package/lib/components/Menu/useMenuContextValues.js +20 -20
  11. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  12. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  13. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  14. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  15. package/lib/components/MenuDivider/useMenuDividerStyles.js +4 -8
  16. package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  17. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  18. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  19. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  20. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  21. package/lib/components/MenuGroup/useMenuGroupStyles.js +0 -5
  22. package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  23. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  24. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  25. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  26. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +0 -5
  27. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  28. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  29. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  30. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  31. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  32. package/lib/components/MenuItem/useMenuItem.js +4 -2
  33. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  34. package/lib/components/MenuItem/useMenuItemStyles.js +33 -35
  35. package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
  36. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  37. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  38. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  39. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -5
  40. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  41. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  42. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  43. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  44. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -5
  45. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  46. package/lib/components/MenuList/MenuList.js.map +1 -1
  47. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  48. package/lib/components/MenuList/index.js +1 -0
  49. package/lib/components/MenuList/index.js.map +1 -1
  50. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  51. package/lib/components/MenuList/useMenuList.js +2 -2
  52. package/lib/components/MenuList/useMenuList.js.map +1 -1
  53. package/lib/components/MenuList/useMenuListContextValues.js +8 -8
  54. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  55. package/lib/components/MenuList/useMenuListStyles.js +0 -5
  56. package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
  57. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  58. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  59. package/lib/components/MenuPopover/useMenuPopover.js +1 -1
  60. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  61. package/lib/components/MenuPopover/useMenuPopoverStyles.js +0 -5
  62. package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  63. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  64. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  65. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  66. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +1 -1
  67. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  68. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +5 -10
  69. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  70. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  71. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  72. package/lib/components/MenuTrigger/useMenuTrigger.js +1 -1
  73. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  74. package/lib/contexts/menuContext.js.map +1 -1
  75. package/lib/contexts/menuGroupContext.js.map +1 -1
  76. package/lib/contexts/menuListContext.js.map +1 -1
  77. package/lib/index.js +16 -16
  78. package/lib/index.js.map +1 -1
  79. package/lib/selectable/useCheckmarkStyles.js.map +1 -1
  80. package/lib/utils/useIsSubmenu.js.map +1 -1
  81. package/lib/utils/useOnMenuEnter.js.map +1 -1
  82. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  83. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  84. package/lib-commonjs/components/Menu/useMenu.js +19 -5
  85. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  86. package/lib-commonjs/components/Menu/useMenuContextValues.js +20 -20
  87. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  88. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  89. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  90. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  91. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +5 -9
  92. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  93. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  94. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  95. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  96. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  97. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +1 -6
  98. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  99. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  100. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  101. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  102. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +1 -6
  103. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  104. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  105. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  106. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  107. package/lib-commonjs/components/MenuItem/useMenuItem.js +5 -3
  108. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  109. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +35 -36
  110. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
  111. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  112. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  113. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  114. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +1 -6
  115. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  116. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  117. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  118. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  119. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +1 -6
  120. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  121. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  122. package/lib-commonjs/components/MenuList/index.js +2 -0
  123. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  124. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  125. package/lib-commonjs/components/MenuList/useMenuList.js +2 -2
  126. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  127. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +8 -8
  128. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  129. package/lib-commonjs/components/MenuList/useMenuListStyles.js +1 -6
  130. package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
  131. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  132. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  133. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +1 -1
  134. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  135. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +1 -6
  136. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  137. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  138. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  139. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +1 -1
  140. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  141. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +6 -11
  142. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  143. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  144. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  145. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +1 -1
  146. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  147. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  148. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  149. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  150. package/lib-commonjs/index.js +411 -17
  151. package/lib-commonjs/index.js.map +1 -1
  152. package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
  153. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  154. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  155. package/package.json +20 -20
  156. package/lib/Menu.d.ts +0 -1
  157. package/lib/MenuDivider.d.ts +0 -1
  158. package/lib/MenuGroup.d.ts +0 -1
  159. package/lib/MenuGroupHeader.d.ts +0 -1
  160. package/lib/MenuItem.d.ts +0 -1
  161. package/lib/MenuItemCheckbox.d.ts +0 -1
  162. package/lib/MenuItemRadio.d.ts +0 -1
  163. package/lib/MenuList.d.ts +0 -1
  164. package/lib/MenuPopover.d.ts +0 -1
  165. package/lib/MenuSplitGroup.d.ts +0 -1
  166. package/lib/MenuTrigger.d.ts +0 -1
  167. package/lib/components/Menu/Menu.d.ts +0 -6
  168. package/lib/components/Menu/Menu.types.d.ts +0 -113
  169. package/lib/components/Menu/index.d.ts +0 -5
  170. package/lib/components/Menu/renderMenu.d.ts +0 -5
  171. package/lib/components/Menu/useMenu.d.ts +0 -10
  172. package/lib/components/Menu/useMenuContextValues.d.ts +0 -2
  173. package/lib/components/MenuDivider/MenuDivider.d.ts +0 -6
  174. package/lib/components/MenuDivider/MenuDivider.types.d.ts +0 -6
  175. package/lib/components/MenuDivider/index.d.ts +0 -5
  176. package/lib/components/MenuDivider/renderMenuDivider.d.ts +0 -6
  177. package/lib/components/MenuDivider/useMenuDivider.d.ts +0 -6
  178. package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +0 -8
  179. package/lib/components/MenuGroup/MenuGroup.d.ts +0 -6
  180. package/lib/components/MenuGroup/MenuGroup.types.d.ts +0 -15
  181. package/lib/components/MenuGroup/index.d.ts +0 -6
  182. package/lib/components/MenuGroup/renderMenuGroup.d.ts +0 -6
  183. package/lib/components/MenuGroup/useMenuGroup.d.ts +0 -6
  184. package/lib/components/MenuGroup/useMenuGroupContextValues.d.ts +0 -2
  185. package/lib/components/MenuGroup/useMenuGroupStyles.d.ts +0 -8
  186. package/lib/components/MenuGroupHeader/MenuGroupHeader.d.ts +0 -6
  187. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +0 -6
  188. package/lib/components/MenuGroupHeader/index.d.ts +0 -5
  189. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +0 -6
  190. package/lib/components/MenuGroupHeader/useMenuGroupHeader.d.ts +0 -6
  191. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +0 -8
  192. package/lib/components/MenuItem/MenuItem.d.ts +0 -6
  193. package/lib/components/MenuItem/MenuItem.types.d.ts +0 -43
  194. package/lib/components/MenuItem/index.d.ts +0 -5
  195. package/lib/components/MenuItem/renderMenuItem.d.ts +0 -5
  196. package/lib/components/MenuItem/useCharacterSearch.d.ts +0 -3
  197. package/lib/components/MenuItem/useMenuItem.d.ts +0 -6
  198. package/lib/components/MenuItem/useMenuItemStyles.d.ts +0 -9
  199. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +0 -6
  200. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.d.ts +0 -4
  201. package/lib/components/MenuItemCheckbox/index.d.ts +0 -5
  202. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.d.ts +0 -3
  203. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +0 -4
  204. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +0 -9
  205. package/lib/components/MenuItemRadio/MenuItemRadio.d.ts +0 -6
  206. package/lib/components/MenuItemRadio/MenuItemRadio.types.d.ts +0 -4
  207. package/lib/components/MenuItemRadio/index.d.ts +0 -5
  208. package/lib/components/MenuItemRadio/renderMenuItemRadio.d.ts +0 -6
  209. package/lib/components/MenuItemRadio/useMenuItemRadio.d.ts +0 -6
  210. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +0 -9
  211. package/lib/components/MenuList/MenuList.d.ts +0 -6
  212. package/lib/components/MenuList/MenuList.types.d.ts +0 -55
  213. package/lib/components/MenuList/index.d.ts +0 -6
  214. package/lib/components/MenuList/renderMenuList.d.ts +0 -5
  215. package/lib/components/MenuList/useMenuList.d.ts +0 -6
  216. package/lib/components/MenuList/useMenuListContextValues.d.ts +0 -2
  217. package/lib/components/MenuList/useMenuListStyles.d.ts +0 -11
  218. package/lib/components/MenuPopover/MenuPopover.d.ts +0 -6
  219. package/lib/components/MenuPopover/MenuPopover.types.d.ts +0 -18
  220. package/lib/components/MenuPopover/index.d.ts +0 -5
  221. package/lib/components/MenuPopover/renderMenuPopover.d.ts +0 -5
  222. package/lib/components/MenuPopover/useMenuPopover.d.ts +0 -12
  223. package/lib/components/MenuPopover/useMenuPopoverStyles.d.ts +0 -11
  224. package/lib/components/MenuSplitGroup/MenuSplitGroup.d.ts +0 -6
  225. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +0 -14
  226. package/lib/components/MenuSplitGroup/index.d.ts +0 -5
  227. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +0 -5
  228. package/lib/components/MenuSplitGroup/useMenuSplitGroup.d.ts +0 -12
  229. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +0 -11
  230. package/lib/components/MenuTrigger/MenuTrigger.d.ts +0 -8
  231. package/lib/components/MenuTrigger/MenuTrigger.types.d.ts +0 -20
  232. package/lib/components/MenuTrigger/index.d.ts +0 -4
  233. package/lib/components/MenuTrigger/renderMenuTrigger.d.ts +0 -7
  234. package/lib/components/MenuTrigger/useMenuTrigger.d.ts +0 -8
  235. package/lib/components/index.d.ts +0 -2
  236. package/lib/contexts/menuContext.d.ts +0 -16
  237. package/lib/contexts/menuGroupContext.d.ts +0 -13
  238. package/lib/contexts/menuListContext.d.ts +0 -15
  239. package/lib/contexts/menuTriggerContext.d.ts +0 -3
  240. package/lib/index.d.ts +0 -16
  241. package/lib/selectable/index.d.ts +0 -2
  242. package/lib/selectable/types.d.ts +0 -34
  243. package/lib/selectable/useCheckmarkStyles.d.ts +0 -8
  244. package/lib/utils/index.d.ts +0 -1
  245. package/lib/utils/useIsSubmenu.d.ts +0 -9
  246. package/lib/utils/useOnMenuEnter.d.ts +0 -23
  247. package/lib-commonjs/Menu.d.ts +0 -1
  248. package/lib-commonjs/MenuDivider.d.ts +0 -1
  249. package/lib-commonjs/MenuGroup.d.ts +0 -1
  250. package/lib-commonjs/MenuGroupHeader.d.ts +0 -1
  251. package/lib-commonjs/MenuItem.d.ts +0 -1
  252. package/lib-commonjs/MenuItemCheckbox.d.ts +0 -1
  253. package/lib-commonjs/MenuItemRadio.d.ts +0 -1
  254. package/lib-commonjs/MenuList.d.ts +0 -1
  255. package/lib-commonjs/MenuPopover.d.ts +0 -1
  256. package/lib-commonjs/MenuSplitGroup.d.ts +0 -1
  257. package/lib-commonjs/MenuTrigger.d.ts +0 -1
  258. package/lib-commonjs/components/Menu/Menu.d.ts +0 -6
  259. package/lib-commonjs/components/Menu/Menu.types.d.ts +0 -113
  260. package/lib-commonjs/components/Menu/index.d.ts +0 -5
  261. package/lib-commonjs/components/Menu/renderMenu.d.ts +0 -5
  262. package/lib-commonjs/components/Menu/useMenu.d.ts +0 -10
  263. package/lib-commonjs/components/Menu/useMenuContextValues.d.ts +0 -2
  264. package/lib-commonjs/components/MenuDivider/MenuDivider.d.ts +0 -6
  265. package/lib-commonjs/components/MenuDivider/MenuDivider.types.d.ts +0 -6
  266. package/lib-commonjs/components/MenuDivider/index.d.ts +0 -5
  267. package/lib-commonjs/components/MenuDivider/renderMenuDivider.d.ts +0 -6
  268. package/lib-commonjs/components/MenuDivider/useMenuDivider.d.ts +0 -6
  269. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +0 -8
  270. package/lib-commonjs/components/MenuGroup/MenuGroup.d.ts +0 -6
  271. package/lib-commonjs/components/MenuGroup/MenuGroup.types.d.ts +0 -15
  272. package/lib-commonjs/components/MenuGroup/index.d.ts +0 -6
  273. package/lib-commonjs/components/MenuGroup/renderMenuGroup.d.ts +0 -6
  274. package/lib-commonjs/components/MenuGroup/useMenuGroup.d.ts +0 -6
  275. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.d.ts +0 -2
  276. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.d.ts +0 -8
  277. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.d.ts +0 -6
  278. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +0 -6
  279. package/lib-commonjs/components/MenuGroupHeader/index.d.ts +0 -5
  280. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +0 -6
  281. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.d.ts +0 -6
  282. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +0 -8
  283. package/lib-commonjs/components/MenuItem/MenuItem.d.ts +0 -6
  284. package/lib-commonjs/components/MenuItem/MenuItem.types.d.ts +0 -43
  285. package/lib-commonjs/components/MenuItem/index.d.ts +0 -5
  286. package/lib-commonjs/components/MenuItem/renderMenuItem.d.ts +0 -5
  287. package/lib-commonjs/components/MenuItem/useCharacterSearch.d.ts +0 -3
  288. package/lib-commonjs/components/MenuItem/useMenuItem.d.ts +0 -6
  289. package/lib-commonjs/components/MenuItem/useMenuItemStyles.d.ts +0 -9
  290. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +0 -6
  291. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.d.ts +0 -4
  292. package/lib-commonjs/components/MenuItemCheckbox/index.d.ts +0 -5
  293. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.d.ts +0 -3
  294. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +0 -4
  295. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +0 -9
  296. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.d.ts +0 -6
  297. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.d.ts +0 -4
  298. package/lib-commonjs/components/MenuItemRadio/index.d.ts +0 -5
  299. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.d.ts +0 -6
  300. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.d.ts +0 -6
  301. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +0 -9
  302. package/lib-commonjs/components/MenuList/MenuList.d.ts +0 -6
  303. package/lib-commonjs/components/MenuList/MenuList.types.d.ts +0 -55
  304. package/lib-commonjs/components/MenuList/index.d.ts +0 -6
  305. package/lib-commonjs/components/MenuList/renderMenuList.d.ts +0 -5
  306. package/lib-commonjs/components/MenuList/useMenuList.d.ts +0 -6
  307. package/lib-commonjs/components/MenuList/useMenuListContextValues.d.ts +0 -2
  308. package/lib-commonjs/components/MenuList/useMenuListStyles.d.ts +0 -11
  309. package/lib-commonjs/components/MenuPopover/MenuPopover.d.ts +0 -6
  310. package/lib-commonjs/components/MenuPopover/MenuPopover.types.d.ts +0 -18
  311. package/lib-commonjs/components/MenuPopover/index.d.ts +0 -5
  312. package/lib-commonjs/components/MenuPopover/renderMenuPopover.d.ts +0 -5
  313. package/lib-commonjs/components/MenuPopover/useMenuPopover.d.ts +0 -12
  314. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.d.ts +0 -11
  315. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.d.ts +0 -6
  316. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +0 -14
  317. package/lib-commonjs/components/MenuSplitGroup/index.d.ts +0 -5
  318. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +0 -5
  319. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.d.ts +0 -12
  320. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +0 -11
  321. package/lib-commonjs/components/MenuTrigger/MenuTrigger.d.ts +0 -8
  322. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.d.ts +0 -20
  323. package/lib-commonjs/components/MenuTrigger/index.d.ts +0 -4
  324. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.d.ts +0 -7
  325. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.d.ts +0 -8
  326. package/lib-commonjs/components/index.d.ts +0 -2
  327. package/lib-commonjs/contexts/menuContext.d.ts +0 -16
  328. package/lib-commonjs/contexts/menuGroupContext.d.ts +0 -13
  329. package/lib-commonjs/contexts/menuListContext.d.ts +0 -15
  330. package/lib-commonjs/contexts/menuTriggerContext.d.ts +0 -3
  331. package/lib-commonjs/index.d.ts +0 -16
  332. package/lib-commonjs/selectable/index.d.ts +0 -2
  333. package/lib-commonjs/selectable/types.d.ts +0 -34
  334. package/lib-commonjs/selectable/useCheckmarkStyles.d.ts +0 -8
  335. package/lib-commonjs/utils/index.d.ts +0 -1
  336. package/lib-commonjs/utils/useIsSubmenu.d.ts +0 -9
  337. package/lib-commonjs/utils/useOnMenuEnter.d.ts +0 -23
@@ -1,14 +1,15 @@
1
- import { ComponentProps } from '@fluentui/react-utilities';
2
- import { ComponentState } from '@fluentui/react-utilities';
3
- import type { Context } from '@fluentui/react-context-selector';
1
+ /// <reference types="react" />
2
+
3
+ import type { ComponentProps } from '@fluentui/react-utilities';
4
+ import type { ComponentState } from '@fluentui/react-utilities';
4
5
  import type { ContextSelector } from '@fluentui/react-context-selector';
5
6
  import type { FluentTriggerComponent } from '@fluentui/react-utilities';
6
7
  import type { ForwardRefComponent } from '@fluentui/react-utilities';
7
- import { PositioningShorthand } from '@fluentui/react-positioning';
8
+ import type { PositioningShorthand } from '@fluentui/react-positioning';
8
9
  import * as React_2 from 'react';
9
10
  import type { Slot } from '@fluentui/react-utilities';
10
11
  import type { SlotClassNames } from '@fluentui/react-utilities';
11
- import { usePopperMouseTarget } from '@fluentui/react-positioning';
12
+ import { usePositioningMouseTarget } from '@fluentui/react-positioning';
12
13
 
13
14
  /**
14
15
  * Wrapper component that manages state for a popup MenuList and a MenuTrigger
@@ -16,50 +17,14 @@ import { usePopperMouseTarget } from '@fluentui/react-positioning';
16
17
  export declare const Menu: React_2.FC<MenuProps>;
17
18
 
18
19
  export declare type MenuCheckedValueChangeData = {
19
- /** The name of the value */
20
- name: string;
21
20
  /** The items for this value that are checked */
22
21
  checkedItems: string[];
22
+ /** The name of the value */
23
+ name: string;
23
24
  };
24
25
 
25
26
  export declare type MenuCheckedValueChangeEvent = React_2.MouseEvent | React_2.KeyboardEvent;
26
27
 
27
- declare type MenuCommons = MenuListCommons & {
28
- /**
29
- * Whether the popup is open
30
- */
31
- open: boolean;
32
- /**
33
- * Call back when the component requests to change value
34
- * The `open` value is used as a hint when directly controlling the component
35
- */
36
- onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
37
- /**
38
- * Whether the popup is open by default
39
- */
40
- defaultOpen?: boolean;
41
- openOnHover: boolean;
42
- /**
43
- * Opens the menu on right click (context menu), removes all other menu open interactions
44
- */
45
- openOnContext?: boolean;
46
- /**
47
- * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order
48
- * This option is disregarded for submenus
49
- */
50
- inline?: boolean;
51
- /**
52
- * Do not dismiss the menu when a menu item is clicked
53
- */
54
- persistOnItemClick?: boolean;
55
- /**
56
- * Sets the delay for mouse open/close for the popover one mouse enter/leave
57
- */
58
- hoverDelay?: number;
59
- };
60
-
61
- export declare const MenuContext: Context<MenuContextValue>;
62
-
63
28
  /**
64
29
  * Context shared between Menu and its children components
65
30
  *
@@ -79,11 +44,6 @@ export declare type MenuContextValues = {
79
44
  */
80
45
  export declare const MenuDivider: ForwardRefComponent<MenuDividerProps>;
81
46
 
82
- /**
83
- * @deprecated Use `menuDividerClassNames.root` instead.
84
- */
85
- export declare const menuDividerClassName = "fui-MenuDivider";
86
-
87
47
  export declare const menuDividerClassNames: SlotClassNames<MenuDividerSlots>;
88
48
 
89
49
  export declare type MenuDividerProps = ComponentProps<MenuDividerSlots>;
@@ -99,11 +59,6 @@ export declare type MenuDividerState = ComponentState<MenuDividerSlots>;
99
59
  */
100
60
  export declare const MenuGroup: ForwardRefComponent<MenuGroupProps>;
101
61
 
102
- /**
103
- * @deprecated Use `menuGroupClassNames.root` instead.
104
- */
105
- export declare const menuGroupClassName = "fui-MenuGroup";
106
-
107
62
  export declare const menuGroupClassNames: SlotClassNames<MenuGroupSlots>;
108
63
 
109
64
  export declare const MenuGroupContextProvider: React_2.Provider<MenuGroupContextValue>;
@@ -128,11 +83,6 @@ export declare type MenuGroupContextValues = {
128
83
  */
129
84
  export declare const MenuGroupHeader: ForwardRefComponent<MenuGroupHeaderProps>;
130
85
 
131
- /**
132
- * @deprecated Use `menuGroupHeaderClassNames.root` instead.
133
- */
134
- export declare const menuGroupHeaderClassName = "fui-MenuGroupHeader";
135
-
136
86
  export declare const menuGroupHeaderClassNames: SlotClassNames<MenuGroupHeaderSlots>;
137
87
 
138
88
  export declare type MenuGroupHeaderProps = ComponentProps<MenuGroupHeaderSlots>;
@@ -166,51 +116,40 @@ export declare const MenuItem: ForwardRefComponent<MenuItemProps>;
166
116
  */
167
117
  export declare const MenuItemCheckbox: ForwardRefComponent<MenuItemCheckboxProps>;
168
118
 
169
- /**
170
- * @deprecated Use `menuItemCheckboxClassNames.root` instead.
171
- */
172
- export declare const menuItemCheckboxClassName = "fui-MenuItemCheckbox";
173
-
174
119
  export declare const menuItemCheckboxClassNames: SlotClassNames<Omit<MenuItemSlots, 'submenuIndicator'>>;
175
120
 
176
121
  export declare type MenuItemCheckboxProps = MenuItemProps & MenuItemSelectableProps;
177
122
 
178
123
  export declare type MenuItemCheckboxState = MenuItemState & MenuItemSelectableState;
179
124
 
180
- /**
181
- * @deprecated Use `menuItemClassNames.root` instead.
182
- */
183
- export declare const menuItemClassName = "fui-MenuItem";
184
-
185
125
  export declare const menuItemClassNames: SlotClassNames<MenuItemSlots>;
186
126
 
187
- declare type MenuItemCommons = {
188
- /**
189
- * If the menu item is a trigger for a submenu
190
- */
191
- hasSubmenu?: boolean;
127
+ export declare type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & {
192
128
  /**
193
129
  * Applies disabled styles to menu item but remains focusable
130
+ *
131
+ * @default false
194
132
  */
195
133
  disabled?: boolean;
134
+ /**
135
+ * If the menu item is a trigger for a submenu
136
+ *
137
+ * @default false
138
+ */
139
+ hasSubmenu?: boolean;
196
140
  /**
197
141
  * Clicking on the menu item will not dismiss an open menu
142
+ *
143
+ * @default false
198
144
  */
199
145
  persistOnClick?: boolean;
200
146
  };
201
147
 
202
- export declare type MenuItemProps = ComponentProps<Partial<MenuItemSlots>> & MenuItemCommons;
203
-
204
148
  /**
205
149
  * Define a styled MenuItemRadio, using the `useMenuItemRadio_unstable` hook.
206
150
  */
207
151
  export declare const MenuItemRadio: ForwardRefComponent<MenuItemRadioProps>;
208
152
 
209
- /**
210
- * @deprecated Use `menuItemRadioClassNames.root` instead.
211
- */
212
- export declare const menuItemRadioClassName = "fui-MenuItemRadio";
213
-
214
153
  export declare const menuItemRadioClassNames: SlotClassNames<Omit<MenuItemSlots, 'submenuIndicator'>>;
215
154
 
216
155
  export declare type MenuItemRadioProps = MenuItemProps & MenuItemSelectableProps;
@@ -277,111 +216,97 @@ export declare type MenuItemSlots = {
277
216
  secondaryContent?: Slot<'span'>;
278
217
  };
279
218
 
280
- export declare type MenuItemState = ComponentState<MenuItemSlots> & MenuItemCommons;
219
+ export declare type MenuItemState = ComponentState<MenuItemSlots> & Pick<MenuItemProps, 'disabled' | 'hasSubmenu' | 'persistOnClick'>;
281
220
 
282
221
  /**
283
222
  * Define a styled MenuList, using the `useMenuList_unstable` hook.
284
223
  */
285
224
  export declare const MenuList: ForwardRefComponent<MenuListProps>;
286
225
 
226
+ export declare const menuListClassNames: SlotClassNames<MenuListSlots>;
227
+
287
228
  /**
288
- * @deprecated Use `menuListClassNames.root` instead.
229
+ * Context shared between MenuList and its children components
289
230
  */
290
- export declare const menuListClassName = "fui-MenuList";
231
+ export declare type MenuListContextValue = Pick<MenuListProps, 'checkedValues' | 'onCheckedValueChange' | 'hasIcons' | 'hasCheckmarks'> & {
232
+ setFocusByFirstCharacter?: (e: React_2.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;
233
+ toggleCheckbox?: SelectableHandler;
234
+ selectRadio?: SelectableHandler;
235
+ };
291
236
 
292
- export declare const menuListClassNames: SlotClassNames<MenuListSlots>;
237
+ export declare type MenuListContextValues = {
238
+ menuList: MenuListContextValue;
239
+ };
293
240
 
294
- declare type MenuListCommons = {
295
- /**
296
- * Callback when checked items change for value with a name
297
- *
298
- * @param event - React's original SyntheticEvent
299
- * @param data - A data object with relevant information
300
- */
301
- onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;
241
+ export declare type MenuListProps = ComponentProps<MenuListSlots> & {
302
242
  /**
303
243
  * Map of all checked values
304
244
  */
305
- checkedValues: Record<string, string[]>;
245
+ checkedValues?: Record<string, string[]>;
306
246
  /**
307
247
  * Default values to be checked on mount
308
248
  */
309
249
  defaultCheckedValues?: Record<string, string[]>;
250
+ /**
251
+ * States that menu items can contain selectable items and reserve slots for item alignment
252
+ */
253
+ hasCheckmarks?: boolean;
310
254
  /**
311
255
  * States that menu items can contain icons and reserve slots for item alignment
312
256
  */
313
257
  hasIcons?: boolean;
314
258
  /**
315
- * States that menu items can contain selectable items and reserve slots for item alignment
259
+ * Callback when checked items change for value with a name
260
+ *
261
+ * @param event - React's original SyntheticEvent
262
+ * @param data - A data object with relevant information
316
263
  */
317
- hasCheckmarks?: boolean;
318
- };
319
-
320
- export declare const MenuListContext: Context<MenuListContextValue>;
321
-
322
- /**
323
- * Context shared between MenuList and its children components
324
- */
325
- export declare type MenuListContextValue = Pick<MenuListProps, 'checkedValues' | 'onCheckedValueChange' | 'hasIcons' | 'hasCheckmarks'> & {
326
- setFocusByFirstCharacter?: (e: React_2.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;
327
- toggleCheckbox?: SelectableHandler;
328
- selectRadio?: SelectableHandler;
329
- };
330
-
331
- export declare type MenuListContextValues = {
332
- menuList: MenuListContextValue;
264
+ onCheckedValueChange?: (e: MenuCheckedValueChangeEvent, data: MenuCheckedValueChangeData) => void;
333
265
  };
334
266
 
335
- export declare type MenuListProps = ComponentProps<MenuListSlots> & Partial<MenuListCommons>;
336
-
337
267
  export declare const MenuListProvider: React_2.Provider<MenuListContextValue> & React_2.FC<React_2.ProviderProps<MenuListContextValue>>;
338
268
 
339
269
  export declare type MenuListSlots = {
340
270
  root: Slot<'div'>;
341
271
  };
342
272
 
343
- export declare type MenuListState = ComponentState<MenuListSlots> & MenuListCommons & {
273
+ export declare type MenuListState = ComponentState<MenuListSlots> & Pick<MenuListProps, 'defaultCheckedValues' | 'onCheckedValueChange'> & Required<Pick<MenuListProps, 'checkedValues' | 'hasCheckmarks' | 'hasIcons'>> & {
274
+ /**
275
+ * Selects a radio item, will de-select the currently selected ratio item
276
+ */
277
+ selectRadio: SelectableHandler;
344
278
  /**
345
279
  * Callback to set focus on the next menu item by first character
346
280
  */
347
281
  setFocusByFirstCharacter: NonNullable<MenuListContextValue['setFocusByFirstCharacter']>;
348
282
  toggleCheckbox: SelectableHandler;
349
- /**
350
- * Selects a radio item, will de-select the currently selected ratio item
351
- */
352
- selectRadio: SelectableHandler;
353
283
  };
354
284
 
355
285
  /**
356
286
  * Data attached to open/close events
357
287
  */
358
288
  export declare type MenuOpenChangeData = {
359
- open: boolean;
360
- /**
361
- * Indicates whether the change of state was a keyboard interaction
362
- */
363
- keyboard?: boolean;
364
289
  /**
365
290
  * indicates whether the request for the open state was bubbled from a nested menu
366
291
  */
367
292
  bubble?: boolean;
293
+ /**
294
+ * Indicates whether the change of state was a keyboard interaction
295
+ */
296
+ keyboard?: boolean;
297
+ open: boolean;
368
298
  };
369
299
 
370
300
  /**
371
301
  * The supported events that will trigger open/close of the menu
372
302
  */
373
- export declare type MenuOpenEvents = MouseEvent | TouchEvent | React_2.MouseEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.FocusEvent<HTMLElement>;
303
+ export declare type MenuOpenEvents = MouseEvent | TouchEvent | React_2.FocusEvent<HTMLElement> | React_2.KeyboardEvent<HTMLElement> | React_2.MouseEvent<HTMLElement>;
374
304
 
375
305
  /**
376
306
  * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus
377
307
  */
378
308
  export declare const MenuPopover: ForwardRefComponent<MenuPopoverProps>;
379
309
 
380
- /**
381
- * @deprecated Use `menuPopoverClassNames.root` instead.
382
- */
383
- export declare const menuPopoverClassName = "fui-MenuPopover";
384
-
385
310
  export declare const menuPopoverClassNames: SlotClassNames<MenuPopoverSlots>;
386
311
 
387
312
  /**
@@ -407,16 +332,68 @@ export declare type MenuPopoverState = ComponentState<MenuPopoverSlots> & {
407
332
  /**
408
333
  * Extends and drills down Menulist props to simplify API
409
334
  */
410
- export declare type MenuProps = Partial<MenuCommons> & ComponentProps<MenuSlots> & {
335
+ export declare type MenuProps = ComponentProps<MenuSlots> & Pick<MenuListProps, 'checkedValues' | 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'onCheckedValueChange'> & {
411
336
  /**
412
337
  * Can contain two children including {@link MenuTrigger} and {@link MenuPopover}.
413
338
  * Alternatively can only contain {@link MenuPopover} if using a custom `target`.
414
339
  */
415
340
  children: [JSX.Element, JSX.Element] | JSX.Element;
341
+ /**
342
+ * Whether the popup is open by default
343
+ *
344
+ * @default false
345
+ */
346
+ defaultOpen?: boolean;
347
+ /**
348
+ * Sets the delay for mouse open/close for the popover one mouse enter/leave
349
+ */
350
+ hoverDelay?: number;
351
+ /**
352
+ * Root menus are rendered out of DOM order on `document.body`, use this to render the menu in DOM order
353
+ * This option is disregarded for submenus
354
+ *
355
+ * @default false
356
+ */
357
+ inline?: boolean;
358
+ /**
359
+ * Call back when the component requests to change value
360
+ * The `open` value is used as a hint when directly controlling the component
361
+ */
362
+ onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
363
+ /**
364
+ * Whether the popup is open
365
+ *
366
+ * @default false
367
+ */
368
+ open?: boolean;
369
+ /**
370
+ * Opens the menu on right click (context menu), removes all other menu open interactions
371
+ *
372
+ * @default false
373
+ */
374
+ openOnContext?: boolean;
375
+ /**
376
+ * Opens the menu on hover
377
+ *
378
+ * @default false
379
+ */
380
+ openOnHover?: boolean;
381
+ /**
382
+ * Do not dismiss the menu when a menu item is clicked
383
+ *
384
+ * @default false
385
+ */
386
+ persistOnItemClick?: boolean;
416
387
  /**
417
388
  * Configures the positioned menu
418
389
  */
419
390
  positioning?: PositioningShorthand;
391
+ /**
392
+ * Close when scroll outside of it
393
+ *
394
+ * @default false
395
+ */
396
+ closeOnScroll?: boolean;
420
397
  };
421
398
 
422
399
  export declare const MenuProvider: React_2.Provider<MenuContextValue> & React_2.FC<React_2.ProviderProps<MenuContextValue>>;
@@ -428,19 +405,12 @@ export declare type MenuSlots = {};
428
405
  */
429
406
  export declare const MenuSplitGroup: ForwardRefComponent<MenuSplitGroupProps>;
430
407
 
431
- /**
432
- * @deprecated Use `menuSplitGroupClassNames.root` instead.
433
- */
434
- export declare const menuSplitGroupClassName = "fui-MenuSplitGroup";
435
-
436
408
  export declare const menuSplitGroupClassNames: SlotClassNames<MenuSplitGroupSlots>;
437
409
 
438
- declare type MenuSplitGroupCommons = {};
439
-
440
410
  /**
441
411
  * MenuSplitGroup Props
442
412
  */
443
- export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots> & MenuSplitGroupCommons;
413
+ export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots>;
444
414
 
445
415
  export declare type MenuSplitGroupSlots = {
446
416
  root: Slot<'div'>;
@@ -449,45 +419,45 @@ export declare type MenuSplitGroupSlots = {
449
419
  /**
450
420
  * State used in rendering MenuSplitGroup
451
421
  */
452
- export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots> & MenuSplitGroupCommons;
422
+ export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots>;
453
423
 
454
- export declare type MenuState = MenuCommons & ComponentState<MenuSlots> & {
424
+ export declare type MenuState = ComponentState<MenuSlots> & Pick<MenuProps, 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'inline' | 'onOpenChange' | 'openOnContext' | 'persistOnItemClick'> & Required<Pick<MenuProps, 'checkedValues' | 'onCheckedValueChange' | 'open' | 'openOnHover' | 'closeOnScroll'>> & {
455
425
  /**
456
- * Callback to open/close the popup
426
+ * Anchors the popper to the mouse click for context events
457
427
  */
458
- setOpen: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
428
+ contextTarget: ReturnType<typeof usePositioningMouseTarget>[0];
459
429
  /**
460
- * Internal react node that just simplifies handling children
430
+ * Whether this menu is a submenu
461
431
  */
462
- menuPopover: React_2.ReactNode;
432
+ isSubmenu: boolean;
463
433
  /**
464
434
  * Internal react node that just simplifies handling children
465
435
  */
466
- menuTrigger: React_2.ReactNode;
436
+ menuPopover: React_2.ReactNode;
467
437
  /**
468
438
  * The ref for the popup
469
439
  */
470
440
  menuPopoverRef: React_2.MutableRefObject<HTMLElement>;
471
441
  /**
472
- * The ref for the MenuTrigger, used for popup positioning
442
+ * Internal react node that just simplifies handling children
473
443
  */
474
- triggerRef: React_2.MutableRefObject<HTMLElement>;
444
+ menuTrigger: React_2.ReactNode;
475
445
  /**
476
- * Id for the MenuTrigger element for aria relationship
446
+ * A callback to set the target of the popper to the mouse click for context events
477
447
  */
478
- triggerId: string;
448
+ setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];
479
449
  /**
480
- * Whether this menu is a submenu
450
+ * Callback to open/close the popup
481
451
  */
482
- isSubmenu: boolean;
452
+ setOpen: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;
483
453
  /**
484
- * Anchors the popper to the mouse click for context events
454
+ * Id for the MenuTrigger element for aria relationship
485
455
  */
486
- contextTarget: ReturnType<typeof usePopperMouseTarget>[0];
456
+ triggerId: string;
487
457
  /**
488
- * A callback to set the target of the popper to the mouse click for context events
458
+ * The ref for the MenuTrigger, used for popup positioning
489
459
  */
490
- setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];
460
+ triggerRef: React_2.MutableRefObject<HTMLElement>;
491
461
  };
492
462
 
493
463
  /**
@@ -581,7 +551,7 @@ export declare const renderMenuTrigger_unstable: (state: MenuTriggerState) => JS
581
551
 
582
552
  export declare type SelectableHandler = (e: React_2.MouseEvent | React_2.KeyboardEvent, name: string, value: string, checked: boolean) => void;
583
553
 
584
- export declare type UninitializedMenuListState = Omit<MenuListState, 'setFocusByFirstCharacter' | 'toggleCheckbox' | 'selectRadio' | 'checkedValues'> & Partial<Pick<MenuListState, 'checkedValues'>>;
554
+ export declare type UninitializedMenuListState = Omit<MenuListState, 'checkedValues' | 'selectRadio' | 'setFocusByFirstCharacter' | 'toggleCheckbox'> & Partial<Pick<MenuListState, 'checkedValues'>>;
585
555
 
586
556
  /**
587
557
  * Applies styles to a checkmark slot for selectable menu items
File without changes
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Menu/Menu.tsx"],"names":[],"mappings":"AACA,SAAS,gBAAT,QAAiC,WAAjC;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,mBAAT,QAAoC,cAApC;AAGA;;AAEG;;AACH,OAAO,MAAM,IAAI,GAAwB,KAAK,IAAG;AAC/C,QAAM,KAAK,GAAG,gBAAgB,CAAC,KAAD,CAA9B;AACA,QAAM,aAAa,GAAG,6BAA6B,CAAC,KAAD,CAAnD;AAEA,SAAO,mBAAmB,CAAC,KAAD,EAAQ,aAAR,CAA1B;AACD,CALM;AAOP,IAAI,CAAC,WAAL,GAAmB,MAAnB","sourcesContent":["import * as React from 'react';\nimport { useMenu_unstable } from './useMenu';\nimport { useMenuContextValues_unstable } from './useMenuContextValues';\nimport { renderMenu_unstable } from './renderMenu';\nimport type { MenuProps } from './Menu.types';\n\n/**\n * Wrapper component that manages state for a popup MenuList and a MenuTrigger\n */\nexport const Menu: React.FC<MenuProps> = props => {\n const state = useMenu_unstable(props);\n const contextValues = useMenuContextValues_unstable(state);\n\n return renderMenu_unstable(state, contextValues);\n};\n\nMenu.displayName = 'Menu';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Menu/Menu.tsx"],"names":[],"mappings":"AACA,SAAS,gBAAT,QAAiC,WAAjC;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,mBAAT,QAAoC,cAApC;AAGA;;AAEG;;AACH,OAAO,MAAM,IAAI,GAAwB,KAAK,IAAG;EAC/C,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAD,CAA9B;EACA,MAAM,aAAa,GAAG,6BAA6B,CAAC,KAAD,CAAnD;EAEA,OAAO,mBAAmB,CAAC,KAAD,EAAQ,aAAR,CAA1B;AACD,CALM;AAOP,IAAI,CAAC,WAAL,GAAmB,MAAnB","sourcesContent":["import * as React from 'react';\nimport { useMenu_unstable } from './useMenu';\nimport { useMenuContextValues_unstable } from './useMenuContextValues';\nimport { renderMenu_unstable } from './renderMenu';\nimport type { MenuProps } from './Menu.types';\n\n/**\n * Wrapper component that manages state for a popup MenuList and a MenuTrigger\n */\nexport const Menu: React.FC<MenuProps> = props => {\n const state = useMenu_unstable(props);\n const contextValues = useMenuContextValues_unstable(state);\n\n return renderMenu_unstable(state, contextValues);\n};\n\nMenu.displayName = 'Menu';\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.types.js","sourceRoot":"../src/","sources":["components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport { usePopperMouseTarget, PositioningShorthand } from '@fluentui/react-positioning';\nimport { MenuListCommons } from '../MenuList/MenuList.types';\nimport { MenuContextValue } from '../../contexts/menuContext';\n\ntype MenuCommons = MenuListCommons & {\n /**\n * Whether the popup is open\n */\n open: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;\n\n /**\n * Whether the popup is open by default\n */\n defaultOpen?: boolean;\n\n /*\n * Opens the menu on hover\n */\n openOnHover: boolean;\n\n /**\n * Opens the menu on right click (context menu), removes all other menu open interactions\n */\n openOnContext?: boolean;\n\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 /**\n * Do not dismiss the menu when a menu item is clicked\n */\n persistOnItemClick?: boolean;\n\n /**\n * Sets the delay for mouse open/close for the popover one mouse enter/leave\n */\n hoverDelay?: number;\n};\n\nexport type MenuSlots = {};\n\n/**\n * Extends and drills down Menulist props to simplify API\n */\nexport type MenuProps = Partial<MenuCommons> &\n ComponentProps<MenuSlots> & {\n /**\n * Can contain two children including {@link MenuTrigger} and {@link MenuPopover}.\n * Alternatively can only contain {@link MenuPopover} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Configures the positioned menu\n */\n positioning?: PositioningShorthand;\n };\n\nexport type MenuState = MenuCommons &\n ComponentState<MenuSlots> & {\n /**\n * Callback to open/close the popup\n */\n setOpen: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuPopover: React.ReactNode;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuTrigger: React.ReactNode;\n\n /**\n * The ref for the popup\n */\n menuPopoverRef: React.MutableRefObject<HTMLElement>;\n\n /**\n * The ref for the MenuTrigger, used for popup positioning\n */\n triggerRef: React.MutableRefObject<HTMLElement>;\n\n /**\n * Id for the MenuTrigger element for aria relationship\n */\n triggerId: string;\n\n /**\n * Whether this menu is a submenu\n */\n isSubmenu: boolean;\n\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: ReturnType<typeof usePopperMouseTarget>[0];\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePopperMouseTarget>[1];\n };\n\n/**\n * Data attached to open/close events\n */\nexport type MenuOpenChangeData = {\n open: boolean;\n /**\n * Indicates whether the change of state was a keyboard interaction\n */\n keyboard?: boolean;\n /**\n * indicates whether the request for the open state was bubbled from a nested menu\n */\n bubble?: boolean;\n};\n\nexport type MenuContextValues = {\n menu: MenuContextValue;\n};\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type MenuOpenEvents =\n | MouseEvent\n | TouchEvent\n | React.MouseEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.FocusEvent<HTMLElement>;\n"]}
1
+ {"version":3,"file":"Menu.types.js","sourceRoot":"../src/","sources":["components/Menu/Menu.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport { usePositioningMouseTarget } from '@fluentui/react-positioning';\nimport type { PositioningShorthand } from '@fluentui/react-positioning';\nimport type { ComponentProps, ComponentState } from '@fluentui/react-utilities';\nimport type { MenuContextValue } from '../../contexts/menuContext';\nimport type { MenuListProps } from '../MenuList/MenuList.types';\n\nexport type MenuSlots = {};\n\n/**\n * Extends and drills down Menulist props to simplify API\n */\nexport type MenuProps = ComponentProps<MenuSlots> &\n Pick<\n MenuListProps,\n 'checkedValues' | 'defaultCheckedValues' | 'hasCheckmarks' | 'hasIcons' | 'onCheckedValueChange'\n > & {\n /**\n * Can contain two children including {@link MenuTrigger} and {@link MenuPopover}.\n * Alternatively can only contain {@link MenuPopover} if using a custom `target`.\n */\n children: [JSX.Element, JSX.Element] | JSX.Element;\n\n /**\n * Whether the popup is open by default\n *\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * Sets the delay for mouse open/close for the popover one mouse enter/leave\n */\n hoverDelay?: number;\n\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 * @default false\n */\n inline?: boolean;\n\n /**\n * Call back when the component requests to change value\n * The `open` value is used as a hint when directly controlling the component\n */\n onOpenChange?: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;\n\n /**\n * Whether the popup is open\n *\n * @default false\n */\n open?: boolean;\n\n /**\n * Opens the menu on right click (context menu), removes all other menu open interactions\n *\n * @default false\n */\n openOnContext?: boolean;\n\n /**\n * Opens the menu on hover\n *\n * @default false\n */\n openOnHover?: boolean;\n\n /**\n * Do not dismiss the menu when a menu item is clicked\n *\n * @default false\n */\n persistOnItemClick?: boolean;\n\n /**\n * Configures the positioned menu\n */\n positioning?: PositioningShorthand;\n\n /**\n * Close when scroll outside of it\n *\n * @default false\n */\n closeOnScroll?: boolean;\n };\n\nexport type MenuState = ComponentState<MenuSlots> &\n Pick<\n MenuProps,\n | 'defaultCheckedValues'\n | 'hasCheckmarks'\n | 'hasIcons'\n | 'inline'\n | 'onOpenChange'\n | 'openOnContext'\n | 'persistOnItemClick'\n > &\n Required<Pick<MenuProps, 'checkedValues' | 'onCheckedValueChange' | 'open' | 'openOnHover' | 'closeOnScroll'>> & {\n /**\n * Anchors the popper to the mouse click for context events\n */\n contextTarget: ReturnType<typeof usePositioningMouseTarget>[0];\n\n /**\n * Whether this menu is a submenu\n */\n isSubmenu: boolean;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuPopover: React.ReactNode;\n\n /**\n * The ref for the popup\n */\n menuPopoverRef: React.MutableRefObject<HTMLElement>;\n\n /**\n * Internal react node that just simplifies handling children\n */\n menuTrigger: React.ReactNode;\n\n /**\n * A callback to set the target of the popper to the mouse click for context events\n */\n setContextTarget: ReturnType<typeof usePositioningMouseTarget>[1];\n\n /**\n * Callback to open/close the popup\n */\n setOpen: (e: MenuOpenEvents, data: MenuOpenChangeData) => void;\n\n /**\n * Id for the MenuTrigger element for aria relationship\n */\n triggerId: string;\n\n /**\n * The ref for the MenuTrigger, used for popup positioning\n */\n triggerRef: React.MutableRefObject<HTMLElement>;\n };\n\n/**\n * Data attached to open/close events\n */\nexport type MenuOpenChangeData = {\n /**\n * indicates whether the request for the open state was bubbled from a nested menu\n */\n bubble?: boolean;\n /**\n * Indicates whether the change of state was a keyboard interaction\n */\n keyboard?: boolean;\n open: boolean;\n};\n\nexport type MenuContextValues = {\n menu: MenuContextValue;\n};\n\n/**\n * The supported events that will trigger open/close of the menu\n */\nexport type MenuOpenEvents =\n | MouseEvent\n | TouchEvent\n | React.FocusEvent<HTMLElement>\n | React.KeyboardEvent<HTMLElement>\n | React.MouseEvent<HTMLElement>;\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["components/Menu/renderMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,4BAA7B;AAGA;;AAEG;;AACH,OAAO,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAmB,aAAnB,KAAuD;AACxF,sBACE,KAAA,CAAA,aAAA,CAAC,YAAD,EAAa;AAAC,IAAA,KAAK,EAAE,aAAa,CAAC;AAAtB,GAAb,EACG,KAAK,CAAC,WADT,EAEG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,WAFvB,CADF;AAMD,CAPM","sourcesContent":["import * as React from 'react';\nimport { MenuProvider } from '../../contexts/menuContext';\nimport type { MenuContextValues, MenuState } from './Menu.types';\n\n/**\n * Render the final JSX of Menu\n */\nexport const renderMenu_unstable = (state: MenuState, contextValues: MenuContextValues) => {\n return (\n <MenuProvider value={contextValues.menu}>\n {state.menuTrigger}\n {state.open && state.menuPopover}\n </MenuProvider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"sources":["components/Menu/renderMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,YAAT,QAA6B,4BAA7B;AAGA;;AAEG;;AACH,OAAO,MAAM,mBAAmB,GAAG,CAAC,KAAD,EAAmB,aAAnB,KAAuD;EACxF,oBACE,KAAA,CAAA,aAAA,CAAC,YAAD,EAAa;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAb,EACG,KAAK,CAAC,WADT,EAEG,KAAK,CAAC,IAAN,IAAc,KAAK,CAAC,WAFvB,CADF;AAMD,CAPM","sourcesContent":["import * as React from 'react';\nimport { MenuProvider } from '../../contexts/menuContext';\nimport type { MenuContextValues, MenuState } from './Menu.types';\n\n/**\n * Render the final JSX of Menu\n */\nexport const renderMenu_unstable = (state: MenuState, contextValues: MenuContextValues) => {\n return (\n <MenuProvider value={contextValues.menu}>\n {state.menuTrigger}\n {state.open && state.menuPopover}\n </MenuProvider>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { usePopperMouseTarget, usePopper, resolvePositioningShorthand } from '@fluentui/react-positioning';
3
- import { useControllableState, useId, useOnClickOutside, useEventCallback } from '@fluentui/react-utilities';
4
- import { useFluent } from '@fluentui/react-shared-contexts';
2
+ import { usePositioningMouseTarget, usePositioning, resolvePositioningShorthand } from '@fluentui/react-positioning';
3
+ import { useControllableState, useId, useOnClickOutside, useEventCallback, useOnScrollOutside } from '@fluentui/react-utilities';
4
+ import { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';
5
5
  import { elementContains } from '@fluentui/react-portal';
6
6
  import { useFocusFinders } from '@fluentui/react-tabster';
7
7
  import { useMenuContext_unstable } from '../../contexts/menuContext';
@@ -17,10 +17,12 @@ import { useIsSubmenu } from '../../utils/useIsSubmenu';
17
17
  */
18
18
 
19
19
  export const useMenu_unstable = props => {
20
+ var _a;
21
+
20
22
  const triggerId = useId('menu');
21
23
  const isSubmenu = useIsSubmenu();
22
- const [contextTarget, setContextTarget] = usePopperMouseTarget();
23
- const popperState = {
24
+ const [contextTarget, setContextTarget] = usePositioningMouseTarget();
25
+ const positioningState = {
24
26
  position: isSubmenu ? 'after' : 'below',
25
27
  align: isSubmenu ? 'top' : 'start',
26
28
  target: props.openOnContext ? contextTarget : undefined,
@@ -53,7 +55,7 @@ export const useMenu_unstable = props => {
53
55
  const {
54
56
  targetRef: triggerRef,
55
57
  containerRef: menuPopoverRef
56
- } = usePopper(popperState);
58
+ } = usePositioning(positioningState);
57
59
  const initialState = {
58
60
  hoverDelay: 500,
59
61
  triggerId,
@@ -62,6 +64,7 @@ export const useMenu_unstable = props => {
62
64
  contextTarget,
63
65
  setContextTarget,
64
66
  ...props,
67
+ closeOnScroll: (_a = props.closeOnScroll) !== null && _a !== void 0 ? _a : false,
65
68
  menuTrigger,
66
69
  menuPopover,
67
70
  triggerRef,
@@ -187,10 +190,21 @@ const useMenuOpenState = state => {
187
190
  contains: elementContains,
188
191
  disabled: !open,
189
192
  element: targetDocument,
190
- refs: [state.menuPopoverRef, state.triggerRef],
193
+ refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
191
194
  callback: e => setOpen(e, {
192
195
  open: false
193
196
  })
197
+ }); // only close on scroll for context, or when closeOnScroll is specified
198
+
199
+ const closeOnScroll = state.openOnContext || state.closeOnScroll;
200
+ useOnScrollOutside({
201
+ contains: elementContains,
202
+ element: targetDocument,
203
+ callback: ev => setOpen(ev, {
204
+ open: false
205
+ }),
206
+ refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
207
+ disabled: !open || !closeOnScroll
194
208
  });
195
209
  useOnMenuMouseEnter({
196
210
  element: targetDocument,