@fluentui/react-menu 0.0.0-nightlyf8be6a7c6520220106.1 → 0.0.0-nightlyff78d1e27a20220217.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (412) hide show
  1. package/CHANGELOG.json +204 -33
  2. package/CHANGELOG.md +47 -16
  3. package/dist/react-menu.d.ts +73 -80
  4. package/lib/Menu.js.map +1 -1
  5. package/lib/MenuDivider.js.map +1 -1
  6. package/lib/MenuGroup.js.map +1 -1
  7. package/lib/MenuGroupHeader.js.map +1 -1
  8. package/lib/MenuItem.js.map +1 -1
  9. package/lib/MenuItemCheckbox.js.map +1 -1
  10. package/lib/MenuItemRadio.js.map +1 -1
  11. package/lib/MenuList.js.map +1 -1
  12. package/lib/MenuPopover.js.map +1 -1
  13. package/lib/MenuSplitGroup.js.map +1 -1
  14. package/lib/MenuTrigger.js.map +1 -1
  15. package/lib/components/Menu/Menu.js +6 -6
  16. package/lib/components/Menu/Menu.js.map +1 -1
  17. package/lib/components/Menu/Menu.types.d.ts +1 -1
  18. package/lib/components/Menu/Menu.types.js.map +1 -1
  19. package/lib/components/Menu/index.js.map +1 -1
  20. package/lib/components/Menu/renderMenu.d.ts +1 -1
  21. package/lib/components/Menu/renderMenu.js +1 -1
  22. package/lib/components/Menu/renderMenu.js.map +1 -1
  23. package/lib/components/Menu/useMenu.d.ts +2 -2
  24. package/lib/components/Menu/useMenu.js +6 -5
  25. package/lib/components/Menu/useMenu.js.map +1 -1
  26. package/lib/components/Menu/useMenuContextValues.d.ts +1 -1
  27. package/lib/components/Menu/useMenuContextValues.js +1 -1
  28. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  29. package/lib/components/MenuDivider/MenuDivider.d.ts +1 -1
  30. package/lib/components/MenuDivider/MenuDivider.js +7 -7
  31. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  32. package/lib/components/MenuDivider/MenuDivider.types.d.ts +2 -2
  33. package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
  34. package/lib/components/MenuDivider/index.js.map +1 -1
  35. package/lib/components/MenuDivider/renderMenuDivider.d.ts +1 -1
  36. package/lib/components/MenuDivider/renderMenuDivider.js +1 -1
  37. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  38. package/lib/components/MenuDivider/useMenuDivider.d.ts +1 -1
  39. package/lib/components/MenuDivider/useMenuDivider.js +4 -1
  40. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  41. package/lib/components/MenuDivider/useMenuDividerStyles.d.ts +1 -1
  42. package/lib/components/MenuDivider/useMenuDividerStyles.js +3 -2
  43. package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  44. package/lib/components/MenuGroup/MenuGroup.d.ts +1 -1
  45. package/lib/components/MenuGroup/MenuGroup.js +9 -9
  46. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  47. package/lib/components/MenuGroup/MenuGroup.types.d.ts +3 -3
  48. package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
  49. package/lib/components/MenuGroup/index.js.map +1 -1
  50. package/lib/components/MenuGroup/renderMenuGroup.d.ts +1 -1
  51. package/lib/components/MenuGroup/renderMenuGroup.js +1 -1
  52. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  53. package/lib/components/MenuGroup/useMenuGroup.d.ts +1 -1
  54. package/lib/components/MenuGroup/useMenuGroup.js +4 -1
  55. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  56. package/lib/components/MenuGroup/useMenuGroupContextValues.d.ts +1 -1
  57. package/lib/components/MenuGroup/useMenuGroupContextValues.js +1 -1
  58. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  59. package/lib/components/MenuGroup/useMenuGroupStyles.d.ts +1 -1
  60. package/lib/components/MenuGroup/useMenuGroupStyles.js +2 -2
  61. package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  62. package/lib/components/MenuGroupHeader/MenuGroupHeader.d.ts +1 -1
  63. package/lib/components/MenuGroupHeader/MenuGroupHeader.js +7 -7
  64. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  65. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +2 -2
  66. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  67. package/lib/components/MenuGroupHeader/index.js.map +1 -1
  68. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +1 -1
  69. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +1 -1
  70. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  71. package/lib/components/MenuGroupHeader/useMenuGroupHeader.d.ts +1 -1
  72. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +6 -3
  73. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  74. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -1
  75. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +3 -2
  76. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  77. package/lib/components/MenuItem/MenuItem.d.ts +1 -1
  78. package/lib/components/MenuItem/MenuItem.js +7 -7
  79. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  80. package/lib/components/MenuItem/MenuItem.types.d.ts +7 -7
  81. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  82. package/lib/components/MenuItem/index.js.map +1 -1
  83. package/lib/components/MenuItem/renderMenuItem.d.ts +1 -1
  84. package/lib/components/MenuItem/renderMenuItem.js +7 -8
  85. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  86. package/lib/components/MenuItem/useCharacterSearch.js +2 -2
  87. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  88. package/lib/components/MenuItem/useMenuItem.d.ts +2 -6
  89. package/lib/components/MenuItem/useMenuItem.js +10 -15
  90. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  91. package/lib/components/MenuItem/useMenuItemStyles.d.ts +1 -1
  92. package/lib/components/MenuItem/useMenuItemStyles.js +12 -7
  93. package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
  94. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +1 -1
  95. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +7 -7
  96. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  97. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  98. package/lib/components/MenuItemCheckbox/index.js.map +1 -1
  99. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.d.ts +1 -1
  100. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +6 -7
  101. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  102. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +1 -1
  103. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +6 -6
  104. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  105. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +1 -1
  106. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +6 -6
  107. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  108. package/lib/components/MenuItemRadio/MenuItemRadio.d.ts +1 -1
  109. package/lib/components/MenuItemRadio/MenuItemRadio.js +7 -7
  110. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  111. package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  112. package/lib/components/MenuItemRadio/index.js.map +1 -1
  113. package/lib/components/MenuItemRadio/renderMenuItemRadio.d.ts +1 -1
  114. package/lib/components/MenuItemRadio/renderMenuItemRadio.js +6 -7
  115. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  116. package/lib/components/MenuItemRadio/useMenuItemRadio.d.ts +1 -1
  117. package/lib/components/MenuItemRadio/useMenuItemRadio.js +6 -6
  118. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  119. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +1 -1
  120. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js +6 -6
  121. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  122. package/lib/components/MenuList/MenuList.d.ts +1 -1
  123. package/lib/components/MenuList/MenuList.js +9 -9
  124. package/lib/components/MenuList/MenuList.js.map +1 -1
  125. package/lib/components/MenuList/MenuList.types.d.ts +4 -4
  126. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  127. package/lib/components/MenuList/index.d.ts +1 -1
  128. package/lib/components/MenuList/index.js +0 -1
  129. package/lib/components/MenuList/index.js.map +1 -1
  130. package/lib/components/MenuList/renderMenuList.d.ts +1 -1
  131. package/lib/components/MenuList/renderMenuList.js +1 -1
  132. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  133. package/lib/components/MenuList/useMenuList.d.ts +1 -1
  134. package/lib/components/MenuList/useMenuList.js +11 -8
  135. package/lib/components/MenuList/useMenuList.js.map +1 -1
  136. package/lib/components/MenuList/useMenuListContextValues.d.ts +1 -1
  137. package/lib/components/MenuList/useMenuListContextValues.js +1 -1
  138. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  139. package/lib/components/MenuList/useMenuListStyles.d.ts +1 -1
  140. package/lib/components/MenuList/useMenuListStyles.js +2 -2
  141. package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
  142. package/lib/components/MenuPopover/MenuPopover.js +6 -6
  143. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  144. package/lib/components/MenuPopover/MenuPopover.types.d.ts +2 -2
  145. package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
  146. package/lib/components/MenuPopover/index.js.map +1 -1
  147. package/lib/components/MenuPopover/renderMenuPopover.d.ts +1 -1
  148. package/lib/components/MenuPopover/renderMenuPopover.js +1 -1
  149. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  150. package/lib/components/MenuPopover/useMenuPopover.d.ts +3 -3
  151. package/lib/components/MenuPopover/useMenuPopover.js +11 -8
  152. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  153. package/lib/components/MenuPopover/useMenuPopoverStyles.d.ts +1 -1
  154. package/lib/components/MenuPopover/useMenuPopoverStyles.js +3 -2
  155. package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  156. package/lib/components/MenuSplitGroup/MenuSplitGroup.js +6 -6
  157. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  158. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +4 -3
  159. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  160. package/lib/components/MenuSplitGroup/index.js.map +1 -1
  161. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +1 -1
  162. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +2 -3
  163. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  164. package/lib/components/MenuSplitGroup/useMenuSplitGroup.d.ts +4 -8
  165. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +3 -8
  166. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  167. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +1 -1
  168. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +3 -2
  169. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  170. package/lib/components/MenuTrigger/MenuTrigger.d.ts +2 -1
  171. package/lib/components/MenuTrigger/MenuTrigger.js +5 -4
  172. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  173. package/lib/components/MenuTrigger/MenuTrigger.types.d.ts +5 -3
  174. package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  175. package/lib/components/MenuTrigger/index.js.map +1 -1
  176. package/lib/components/MenuTrigger/renderMenuTrigger.d.ts +1 -1
  177. package/lib/components/MenuTrigger/renderMenuTrigger.js +1 -1
  178. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  179. package/lib/components/MenuTrigger/useMenuTrigger.d.ts +2 -2
  180. package/lib/components/MenuTrigger/useMenuTrigger.js +167 -5
  181. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  182. package/lib/components/index.js.map +1 -1
  183. package/lib/contexts/menuContext.d.ts +1 -1
  184. package/lib/contexts/menuContext.js +1 -1
  185. package/lib/contexts/menuContext.js.map +1 -1
  186. package/lib/contexts/menuGroupContext.d.ts +1 -1
  187. package/lib/contexts/menuGroupContext.js +1 -1
  188. package/lib/contexts/menuGroupContext.js.map +1 -1
  189. package/lib/contexts/menuListContext.d.ts +1 -1
  190. package/lib/contexts/menuListContext.js +1 -1
  191. package/lib/contexts/menuListContext.js.map +1 -1
  192. package/lib/contexts/menuTriggerContext.d.ts +1 -1
  193. package/lib/contexts/menuTriggerContext.js +1 -1
  194. package/lib/contexts/menuTriggerContext.js.map +1 -1
  195. package/lib/index.js.map +1 -1
  196. package/lib/selectable/index.js.map +1 -1
  197. package/lib/selectable/types.js.map +1 -1
  198. package/lib/selectable/useCheckmarkStyles.d.ts +2 -2
  199. package/lib/selectable/useCheckmarkStyles.js +2 -2
  200. package/lib/selectable/useCheckmarkStyles.js.map +1 -1
  201. package/lib/utils/index.js.map +1 -1
  202. package/lib/utils/useIsSubmenu.js +2 -2
  203. package/lib/utils/useIsSubmenu.js.map +1 -1
  204. package/lib/utils/useOnMenuEnter.js.map +1 -1
  205. package/lib-commonjs/Menu.js.map +1 -1
  206. package/lib-commonjs/MenuDivider.js.map +1 -1
  207. package/lib-commonjs/MenuGroup.js.map +1 -1
  208. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  209. package/lib-commonjs/MenuItem.js.map +1 -1
  210. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  211. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  212. package/lib-commonjs/MenuList.js.map +1 -1
  213. package/lib-commonjs/MenuPopover.js.map +1 -1
  214. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  215. package/lib-commonjs/MenuTrigger.js.map +1 -1
  216. package/lib-commonjs/components/Menu/Menu.js +3 -3
  217. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  218. package/lib-commonjs/components/Menu/Menu.types.d.ts +1 -1
  219. package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
  220. package/lib-commonjs/components/Menu/index.js.map +1 -1
  221. package/lib-commonjs/components/Menu/renderMenu.d.ts +1 -1
  222. package/lib-commonjs/components/Menu/renderMenu.js +3 -3
  223. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  224. package/lib-commonjs/components/Menu/useMenu.d.ts +2 -2
  225. package/lib-commonjs/components/Menu/useMenu.js +7 -6
  226. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  227. package/lib-commonjs/components/Menu/useMenuContextValues.d.ts +1 -1
  228. package/lib-commonjs/components/Menu/useMenuContextValues.js +3 -3
  229. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  230. package/lib-commonjs/components/MenuDivider/MenuDivider.d.ts +1 -1
  231. package/lib-commonjs/components/MenuDivider/MenuDivider.js +4 -4
  232. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  233. package/lib-commonjs/components/MenuDivider/MenuDivider.types.d.ts +2 -2
  234. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  235. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  236. package/lib-commonjs/components/MenuDivider/renderMenuDivider.d.ts +1 -1
  237. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +3 -3
  238. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  239. package/lib-commonjs/components/MenuDivider/useMenuDivider.d.ts +1 -1
  240. package/lib-commonjs/components/MenuDivider/useMenuDivider.js +6 -3
  241. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  242. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.d.ts +1 -1
  243. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +8 -6
  244. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  245. package/lib-commonjs/components/MenuGroup/MenuGroup.d.ts +1 -1
  246. package/lib-commonjs/components/MenuGroup/MenuGroup.js +5 -5
  247. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  248. package/lib-commonjs/components/MenuGroup/MenuGroup.types.d.ts +3 -3
  249. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  250. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  251. package/lib-commonjs/components/MenuGroup/renderMenuGroup.d.ts +1 -1
  252. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +3 -3
  253. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  254. package/lib-commonjs/components/MenuGroup/useMenuGroup.d.ts +1 -1
  255. package/lib-commonjs/components/MenuGroup/useMenuGroup.js +6 -3
  256. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  257. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.d.ts +1 -1
  258. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +3 -3
  259. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  260. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.d.ts +1 -1
  261. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +5 -5
  262. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  263. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.d.ts +1 -1
  264. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +4 -4
  265. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  266. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.d.ts +2 -2
  267. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  268. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  269. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.d.ts +1 -1
  270. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +3 -3
  271. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  272. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.d.ts +1 -1
  273. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +7 -4
  274. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  275. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.d.ts +1 -1
  276. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +8 -6
  277. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  278. package/lib-commonjs/components/MenuItem/MenuItem.d.ts +1 -1
  279. package/lib-commonjs/components/MenuItem/MenuItem.js +4 -4
  280. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  281. package/lib-commonjs/components/MenuItem/MenuItem.types.d.ts +7 -7
  282. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  283. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  284. package/lib-commonjs/components/MenuItem/renderMenuItem.d.ts +1 -1
  285. package/lib-commonjs/components/MenuItem/renderMenuItem.js +9 -11
  286. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  287. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +1 -1
  288. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  289. package/lib-commonjs/components/MenuItem/useMenuItem.d.ts +2 -6
  290. package/lib-commonjs/components/MenuItem/useMenuItem.js +10 -15
  291. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  292. package/lib-commonjs/components/MenuItem/useMenuItemStyles.d.ts +1 -1
  293. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +20 -14
  294. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
  295. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.d.ts +1 -1
  296. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +4 -4
  297. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  298. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  299. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  300. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.d.ts +1 -1
  301. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +8 -10
  302. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  303. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.d.ts +1 -1
  304. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +6 -6
  305. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  306. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.d.ts +1 -1
  307. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +7 -7
  308. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  309. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.d.ts +1 -1
  310. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +4 -4
  311. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  312. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  313. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  314. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.d.ts +1 -1
  315. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +8 -10
  316. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  317. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.d.ts +1 -1
  318. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +6 -6
  319. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  320. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.d.ts +1 -1
  321. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +7 -7
  322. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  323. package/lib-commonjs/components/MenuList/MenuList.d.ts +1 -1
  324. package/lib-commonjs/components/MenuList/MenuList.js +5 -5
  325. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  326. package/lib-commonjs/components/MenuList/MenuList.types.d.ts +4 -4
  327. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  328. package/lib-commonjs/components/MenuList/index.d.ts +1 -1
  329. package/lib-commonjs/components/MenuList/index.js +0 -2
  330. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  331. package/lib-commonjs/components/MenuList/renderMenuList.d.ts +1 -1
  332. package/lib-commonjs/components/MenuList/renderMenuList.js +3 -3
  333. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  334. package/lib-commonjs/components/MenuList/useMenuList.d.ts +1 -1
  335. package/lib-commonjs/components/MenuList/useMenuList.js +12 -9
  336. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  337. package/lib-commonjs/components/MenuList/useMenuListContextValues.d.ts +1 -1
  338. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +3 -3
  339. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  340. package/lib-commonjs/components/MenuList/useMenuListStyles.d.ts +1 -1
  341. package/lib-commonjs/components/MenuList/useMenuListStyles.js +6 -6
  342. package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
  343. package/lib-commonjs/components/MenuPopover/MenuPopover.js +3 -3
  344. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  345. package/lib-commonjs/components/MenuPopover/MenuPopover.types.d.ts +2 -2
  346. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  347. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  348. package/lib-commonjs/components/MenuPopover/renderMenuPopover.d.ts +1 -1
  349. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +3 -3
  350. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  351. package/lib-commonjs/components/MenuPopover/useMenuPopover.d.ts +3 -3
  352. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +12 -9
  353. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  354. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.d.ts +1 -1
  355. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +8 -6
  356. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  357. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +3 -3
  358. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  359. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.d.ts +4 -3
  360. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  361. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  362. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.d.ts +1 -1
  363. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +4 -6
  364. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  365. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.d.ts +4 -8
  366. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +6 -11
  367. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  368. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.d.ts +1 -1
  369. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +8 -6
  370. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  371. package/lib-commonjs/components/MenuTrigger/MenuTrigger.d.ts +2 -1
  372. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +3 -2
  373. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  374. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.d.ts +5 -3
  375. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  376. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  377. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.d.ts +1 -1
  378. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +3 -3
  379. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  380. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.d.ts +2 -2
  381. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +176 -7
  382. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  383. package/lib-commonjs/components/index.js.map +1 -1
  384. package/lib-commonjs/contexts/menuContext.d.ts +1 -1
  385. package/lib-commonjs/contexts/menuContext.js +3 -3
  386. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  387. package/lib-commonjs/contexts/menuGroupContext.d.ts +1 -1
  388. package/lib-commonjs/contexts/menuGroupContext.js +3 -3
  389. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  390. package/lib-commonjs/contexts/menuListContext.d.ts +1 -1
  391. package/lib-commonjs/contexts/menuListContext.js +3 -3
  392. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  393. package/lib-commonjs/contexts/menuTriggerContext.d.ts +1 -1
  394. package/lib-commonjs/contexts/menuTriggerContext.js +3 -3
  395. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  396. package/lib-commonjs/index.js.map +1 -1
  397. package/lib-commonjs/selectable/index.js.map +1 -1
  398. package/lib-commonjs/selectable/types.js.map +1 -1
  399. package/lib-commonjs/selectable/useCheckmarkStyles.d.ts +2 -2
  400. package/lib-commonjs/selectable/useCheckmarkStyles.js +6 -6
  401. package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
  402. package/lib-commonjs/utils/index.js.map +1 -1
  403. package/lib-commonjs/utils/useIsSubmenu.js +1 -1
  404. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  405. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  406. package/package.json +13 -15
  407. package/lib/components/MenuTrigger/useTriggerElement.d.ts +0 -5
  408. package/lib/components/MenuTrigger/useTriggerElement.js +0 -166
  409. package/lib/components/MenuTrigger/useTriggerElement.js.map +0 -1
  410. package/lib-commonjs/components/MenuTrigger/useTriggerElement.d.ts +0 -5
  411. package/lib-commonjs/components/MenuTrigger/useTriggerElement.js +0 -181
  412. package/lib-commonjs/components/MenuTrigger/useTriggerElement.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuPopover/useMenuPopoverStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,6BAArD;AAGA,OAAO,MAAM,oBAAoB,GAAG,iBAA7B;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAaA;;AAEG;;;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAA8C;AAChF,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAD,EAAuB,MAAM,CAAC,IAA9B,EAAoC,KAAK,CAAC,IAAN,CAAW,SAA/C,CAAnC;AACA,SAAO,KAAP;AACD,CAJM","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuPopover/useMenuPopoverStyles.ts"],"names":[],"mappings":"AAAA,SAAS,UAAT,EAAqB,YAArB,kBAAqD,gBAArD;AACA,SAAS,MAAT,QAAuB,uBAAvB;AAGA,OAAO,MAAM,oBAAoB,GAAG,iBAA7B;;AAEP,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAaA;;AAEG;;;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA8C;AACzF,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,oBAAD,EAAuB,MAAM,CAAC,IAA9B,EAAoC,KAAK,CAAC,IAAN,CAAW,SAA/C,CAAnC;AACA,SAAO,KAAP;AACD,CAJM","sourcesContent":["import { shorthands, mergeClasses, makeStyles } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport type { MenuPopoverState } from './MenuPopover.types';\n\nexport const menuPopoverClassName = 'fui-MenuPopover';\n\nconst useStyles = makeStyles({\n root: {\n ...shorthands.borderRadius(tokens.borderRadiusMedium),\n backgroundColor: tokens.colorNeutralBackground1,\n minWidth: '128px',\n maxWidth: '300px',\n width: 'max-content',\n boxShadow: `${tokens.shadow16}`,\n ...shorthands.padding('4px'),\n ...shorthands.border('1px', 'solid', tokens.colorTransparentStroke),\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuPopoverStyles_unstable = (state: MenuPopoverState): MenuPopoverState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuPopoverClassName, styles.root, state.root.className);\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,15 +1,15 @@
1
1
  import * as React from 'react';
2
- import { useMenuSplitGroup } from './useMenuSplitGroup';
3
- import { renderMenuSplitGroup } from './renderMenuSplitGroup';
4
- import { useMenuSplitGroupStyles } from './useMenuSplitGroupStyles';
2
+ import { useMenuSplitGroup_unstable } from './useMenuSplitGroup';
3
+ import { renderMenuSplitGroup_unstable } from './renderMenuSplitGroup';
4
+ import { useMenuSplitGroupStyles_unstable } from './useMenuSplitGroupStyles';
5
5
  /**
6
6
  * Layout wrapper that provides extra keyboard navigation behavior for two `MenuItem` components.
7
7
  */
8
8
 
9
9
  export const MenuSplitGroup = /*#__PURE__*/React.forwardRef((props, ref) => {
10
- const state = useMenuSplitGroup(props, ref);
11
- useMenuSplitGroupStyles(state);
12
- return renderMenuSplitGroup(state);
10
+ const state = useMenuSplitGroup_unstable(props, ref);
11
+ useMenuSplitGroupStyles_unstable(state);
12
+ return renderMenuSplitGroup_unstable(state);
13
13
  });
14
14
  MenuSplitGroup.displayName = 'MenuSplitGroup';
15
15
  //# sourceMappingURL=MenuSplitGroup.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuSplitGroup/MenuSplitGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AACA,SAAS,oBAAT,QAAqC,wBAArC;AACA,SAAS,uBAAT,QAAwC,2BAAxC;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,iBAAiB,CAAC,KAAD,EAAQ,GAAR,CAA/B;AAEA,EAAA,uBAAuB,CAAC,KAAD,CAAvB;AACA,SAAO,oBAAoB,CAAC,KAAD,CAA3B;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuSplitGroup/MenuSplitGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,gCAAT,QAAiD,2BAAjD;AAIA;;AAEG;;AACH,OAAO,MAAM,cAAc,gBAA6C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AACtG,QAAM,KAAK,GAAG,0BAA0B,CAAC,KAAD,EAAQ,GAAR,CAAxC;AAEA,EAAA,gCAAgC,CAAC,KAAD,CAAhC;AACA,SAAO,6BAA6B,CAAC,KAAD,CAApC;AACD,CALuE,CAAjE;AAOP,cAAc,CAAC,WAAf,GAA6B,gBAA7B","sourcesContent":["import * as React from 'react';\nimport { useMenuSplitGroup_unstable } from './useMenuSplitGroup';\nimport { renderMenuSplitGroup_unstable } from './renderMenuSplitGroup';\nimport { useMenuSplitGroupStyles_unstable } from './useMenuSplitGroupStyles';\nimport type { MenuSplitGroupProps } from './MenuSplitGroup.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Layout wrapper that provides extra keyboard navigation behavior for two `MenuItem` components.\n */\nexport const MenuSplitGroup: ForwardRefComponent<MenuSplitGroupProps> = React.forwardRef((props, ref) => {\n const state = useMenuSplitGroup_unstable(props, ref);\n\n useMenuSplitGroupStyles_unstable(state);\n return renderMenuSplitGroup_unstable(state);\n});\n\nMenuSplitGroup.displayName = 'MenuSplitGroup';\n"],"sourceRoot":"../src/"}
@@ -1,8 +1,8 @@
1
- import type { ComponentProps, ComponentState, IntrinsicShorthandProps } from '@fluentui/react-utilities';
1
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
2
2
  export declare type MenuSplitGroupSlots = {
3
- root: IntrinsicShorthandProps<'div'>;
3
+ root: Slot<'div'>;
4
4
  };
5
- export declare type MenuSplitGroupCommons = {};
5
+ declare type MenuSplitGroupCommons = {};
6
6
  /**
7
7
  * MenuSplitGroup Props
8
8
  */
@@ -11,3 +11,4 @@ export declare type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots> &
11
11
  * State used in rendering MenuSplitGroup
12
12
  */
13
13
  export declare type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots> & MenuSplitGroupCommons;
14
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"MenuSplitGroup.types.js","sourceRoot":"","sources":["../../../src/components/MenuSplitGroup/MenuSplitGroup.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"MenuSplitGroup.types.js","sourceRoot":"../src/","sources":["components/MenuSplitGroup/MenuSplitGroup.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type MenuSplitGroupSlots = {\n root: Slot<'div'>;\n};\n\ntype MenuSplitGroupCommons = {};\n\n/**\n * MenuSplitGroup Props\n */\nexport type MenuSplitGroupProps = ComponentProps<MenuSplitGroupSlots> & MenuSplitGroupCommons;\n\n/**\n * State used in rendering MenuSplitGroup\n */\nexport type MenuSplitGroupState = ComponentState<MenuSplitGroupSlots> & MenuSplitGroupCommons;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MenuSplitGroup/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/MenuSplitGroup/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,2BAA2B,CAAC","sourcesContent":["export * from './MenuSplitGroup';\nexport * from './MenuSplitGroup.types';\nexport * from './renderMenuSplitGroup';\nexport * from './useMenuSplitGroup';\nexport * from './useMenuSplitGroupStyles';\n"]}
@@ -2,4 +2,4 @@ import type { MenuSplitGroupState } from './MenuSplitGroup.types';
2
2
  /**
3
3
  * Render the final JSX of MenuSplitGroup
4
4
  */
5
- export declare const renderMenuSplitGroup: (state: MenuSplitGroupState) => JSX.Element;
5
+ export declare const renderMenuSplitGroup_unstable: (state: MenuSplitGroupState) => JSX.Element;
@@ -1,15 +1,14 @@
1
1
  import * as React from 'react';
2
2
  import { getSlots } from '@fluentui/react-utilities';
3
- import { menuSplitGroupShorthandProps } from './useMenuSplitGroup';
4
3
  /**
5
4
  * Render the final JSX of MenuSplitGroup
6
5
  */
7
6
 
8
- export const renderMenuSplitGroup = state => {
7
+ export const renderMenuSplitGroup_unstable = state => {
9
8
  const {
10
9
  slots,
11
10
  slotProps
12
- } = getSlots(state, menuSplitGroupShorthandProps);
11
+ } = getSlots(state);
13
12
  return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
14
13
  });
15
14
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuSplitGroup/renderMenuSplitGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AACA,SAAS,4BAAT,QAA6C,qBAA7C;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,GAAI,KAAD,IAA+B;AACjE,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,EAA6B,4BAA7B,CAArC;AAEA,sBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAAP;AACD,CAJM","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuSplitGroup/renderMenuSplitGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,6BAA6B,GAAI,KAAD,IAA+B;AAC1E,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAsB,KAAtB,CAArC;AAEA,sBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,CAAP;AACD,CAJM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { MenuSplitGroupState, MenuSplitGroupSlots } from './MenuSplitGroup.types';\n\n/**\n * Render the final JSX of MenuSplitGroup\n */\nexport const renderMenuSplitGroup_unstable = (state: MenuSplitGroupState) => {\n const { slots, slotProps } = getSlots<MenuSplitGroupSlots>(state);\n\n return <slots.root {...slotProps.root} />;\n};\n"],"sourceRoot":"../src/"}
@@ -1,16 +1,12 @@
1
1
  import * as React from 'react';
2
- import type { MenuSplitGroupProps, MenuSplitGroupSlots, MenuSplitGroupState } from './MenuSplitGroup.types';
3
- /**
4
- * Array of all shorthand properties listed in MenuSplitGroupSlots
5
- */
6
- export declare const menuSplitGroupShorthandProps: (keyof MenuSplitGroupSlots)[];
2
+ import type { MenuSplitGroupProps, MenuSplitGroupState } from './MenuSplitGroup.types';
7
3
  /**
8
4
  * Create the state required to render MenuSplitGroup.
9
5
  *
10
- * The returned state can be modified with hooks such as useMenuSplitGroupStyles,
11
- * before being passed to renderMenuSplitGroup.
6
+ * The returned state can be modified with hooks such as useMenuSplitGroupStyles_unstable,
7
+ * before being passed to renderMenuSplitGroup_unstable.
12
8
  *
13
9
  * @param props - props from this instance of MenuSplitGroup
14
10
  * @param ref - reference to root HTMLElement of MenuSplitGroup
15
11
  */
16
- export declare const useMenuSplitGroup: (props: MenuSplitGroupProps, ref: React.Ref<HTMLElement>) => MenuSplitGroupState;
12
+ export declare const useMenuSplitGroup_unstable: (props: MenuSplitGroupProps, ref: React.Ref<HTMLElement>) => MenuSplitGroupState;
@@ -3,22 +3,17 @@ import { getNativeElementProps, getRTLSafeKey, useMergedRefs } from '@fluentui/r
3
3
  import { useFocusFinders } from '@fluentui/react-tabster';
4
4
  import { useFluent } from '@fluentui/react-shared-contexts';
5
5
  import { ArrowRight, ArrowLeft } from '@fluentui/keyboard-keys';
6
- /**
7
- * Array of all shorthand properties listed in MenuSplitGroupSlots
8
- */
9
-
10
- export const menuSplitGroupShorthandProps = ['root'];
11
6
  /**
12
7
  * Create the state required to render MenuSplitGroup.
13
8
  *
14
- * The returned state can be modified with hooks such as useMenuSplitGroupStyles,
15
- * before being passed to renderMenuSplitGroup.
9
+ * The returned state can be modified with hooks such as useMenuSplitGroupStyles_unstable,
10
+ * before being passed to renderMenuSplitGroup_unstable.
16
11
  *
17
12
  * @param props - props from this instance of MenuSplitGroup
18
13
  * @param ref - reference to root HTMLElement of MenuSplitGroup
19
14
  */
20
15
 
21
- export const useMenuSplitGroup = (props, ref) => {
16
+ export const useMenuSplitGroup_unstable = (props, ref) => {
22
17
  const innerRef = React.useRef();
23
18
  const {
24
19
  dir,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuSplitGroup/useMenuSplitGroup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,qBAAT,EAAgC,aAAhC,EAA+C,aAA/C,QAAoE,2BAApE;AACA,SAAS,eAAT,QAAgC,yBAAhC;AACA,SAAS,SAAT,QAA0B,iCAA1B;AAEA,SAAS,UAAT,EAAqB,SAArB,QAAsC,yBAAtC;AAEA;;AAEG;;AACH,OAAO,MAAM,4BAA4B,GAAkC,CAAC,MAAD,CAApE;AAEP;;;;;;;;AAQG;;AACH,OAAO,MAAM,iBAAiB,GAAG,CAAC,KAAD,EAA6B,GAA7B,KAAiF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GAAP;AAWD,CA/CM","sourcesContent":["import * as React from 'react';\nimport { getNativeElementProps, getRTLSafeKey, useMergedRefs } from '@fluentui/react-utilities';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport type { MenuSplitGroupProps, MenuSplitGroupState } from './MenuSplitGroup.types';\nimport { ArrowRight, ArrowLeft } from '@fluentui/keyboard-keys';\n\n/**\n * Create the state required to render MenuSplitGroup.\n *\n * The returned state can be modified with hooks such as useMenuSplitGroupStyles_unstable,\n * before being passed to renderMenuSplitGroup_unstable.\n *\n * @param props - props from this instance of MenuSplitGroup\n * @param ref - reference to root HTMLElement of MenuSplitGroup\n */\nexport const useMenuSplitGroup_unstable = (\n props: MenuSplitGroupProps,\n ref: React.Ref<HTMLElement>,\n): MenuSplitGroupState => {\n const innerRef = React.useRef<HTMLElement>();\n const { dir, targetDocument } = useFluent();\n\n const nextArrowKey = getRTLSafeKey(ArrowRight, dir);\n const prevArrowKey = getRTLSafeKey(ArrowLeft, dir);\n\n const { findNextFocusable, findPrevFocusable } = useFocusFinders();\n\n const onKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>) => {\n const activeElement = targetDocument?.activeElement;\n if (!activeElement) {\n return;\n }\n\n if (!innerRef.current?.contains(activeElement)) {\n return;\n }\n\n if (e.key === nextArrowKey) {\n const next = findNextFocusable(activeElement as HTMLElement, { container: innerRef.current });\n next?.focus();\n }\n\n if (e.key === prevArrowKey) {\n const prev = findPrevFocusable(activeElement as HTMLElement, { container: innerRef.current });\n prev?.focus();\n }\n },\n [findNextFocusable, findPrevFocusable, targetDocument, nextArrowKey, prevArrowKey],\n );\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n role: 'group',\n ref: useMergedRefs(ref, innerRef),\n onKeyDown,\n ...props,\n }),\n };\n};\n"],"sourceRoot":"../src/"}
@@ -3,4 +3,4 @@ export declare const menuSplitGroupClassName = "fui-MenuSplitGroup";
3
3
  /**
4
4
  * Apply styling to the MenuSplitGroup slots based on the state
5
5
  */
6
- export declare const useMenuSplitGroupStyles: (state: MenuSplitGroupState) => MenuSplitGroupState;
6
+ export declare const useMenuSplitGroupStyles_unstable: (state: MenuSplitGroupState) => MenuSplitGroupState;
@@ -1,4 +1,5 @@
1
- import { __styles, mergeClasses } from '@fluentui/react-make-styles';
1
+ import { __styles, mergeClasses } from '@griffel/react';
2
+ import { tokens } from '@fluentui/react-theme';
2
3
  import { menuItemClassName } from '../MenuItem/useMenuItemStyles';
3
4
  export const menuSplitGroupClassName = 'fui-MenuSplitGroup';
4
5
  /**
@@ -26,7 +27,7 @@ const useStyles = /*#__PURE__*/__styles({
26
27
  */
27
28
 
28
29
 
29
- export const useMenuSplitGroupStyles = state => {
30
+ export const useMenuSplitGroupStyles_unstable = state => {
30
31
  const styles = useStyles();
31
32
  state.root.className = mergeClasses(menuSplitGroupClassName, styles.root, state.root.className);
32
33
  return state;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuSplitGroup/useMenuSplitGroupStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,6BAAzC;AACA,SAAS,iBAAT,QAAkC,+BAAlC;AAGA,OAAO,MAAM,uBAAuB,GAAG,oBAAhC;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAqBA;;AAEG;;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAoD;AACzF,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,uBAAD,EAA0B,MAAM,CAAC,IAAjC,EAAuC,KAAK,CAAC,IAAN,CAAW,SAAlD,CAAnC;AACA,SAAO,KAAP;AACD,CAJM","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuSplitGroup/useMenuSplitGroupStyles.ts"],"names":[],"mappings":"AAAA,mBAAqB,YAArB,QAAyC,gBAAzC;AACA,SAAS,MAAT,QAAuB,uBAAvB;AACA,SAAS,iBAAT,QAAkC,+BAAlC;AAGA,OAAO,MAAM,uBAAuB,GAAG,oBAAhC;AAEP;;AAEG;;AACH,MAAM,SAAS,gBAAG;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAlB;AAqBA;;AAEG;;;AACH,OAAO,MAAM,gCAAgC,GAAI,KAAD,IAAoD;AAClG,QAAM,MAAM,GAAG,SAAS,EAAxB;AACA,EAAA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,uBAAD,EAA0B,MAAM,CAAC,IAAjC,EAAuC,KAAK,CAAC,IAAN,CAAW,SAAlD,CAAnC;AACA,SAAO,KAAP;AACD,CAJM","sourcesContent":["import { makeStyles, mergeClasses } from '@griffel/react';\nimport { tokens } from '@fluentui/react-theme';\nimport { menuItemClassName } from '../MenuItem/useMenuItemStyles';\nimport type { MenuSplitGroupState } from './MenuSplitGroup.types';\n\nexport const menuSplitGroupClassName = 'fui-MenuSplitGroup';\n\n/**\n * Styles for the root slot\n */\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n [`& > .${menuItemClassName}:nth-child(1)`]: {\n width: '100%',\n },\n [`& > .${menuItemClassName}:nth-child(2)`]: {\n borderTopLeftRadius: 0,\n borderBottomLeftRadius: 0,\n paddingLeft: 0,\n marginLeft: 'auto',\n ':before': {\n content: '\"\"',\n width: tokens.strokeWidthThin,\n height: '24px',\n backgroundColor: tokens.colorNeutralStroke1,\n },\n },\n },\n});\n\n/**\n * Apply styling to the MenuSplitGroup slots based on the state\n */\nexport const useMenuSplitGroupStyles_unstable = (state: MenuSplitGroupState): MenuSplitGroupState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuSplitGroupClassName, styles.root, state.root.className);\n return state;\n};\n"],"sourceRoot":"../src/"}
@@ -1,7 +1,8 @@
1
1
  import * as React from 'react';
2
2
  import type { MenuTriggerProps } from './MenuTrigger.types';
3
+ import type { FluentTriggerComponent } from '@fluentui/react-utilities';
3
4
  /**
4
5
  * Wraps a trigger element as an only child
5
6
  * and adds the necessary event handling to open a popup menu
6
7
  */
7
- export declare const MenuTrigger: React.FC<MenuTriggerProps>;
8
+ export declare const MenuTrigger: React.FC<MenuTriggerProps> & FluentTriggerComponent;
@@ -1,13 +1,14 @@
1
- import { useMenuTrigger } from './useMenuTrigger';
2
- import { renderMenuTrigger } from './renderMenuTrigger';
1
+ import { useMenuTrigger_unstable } from './useMenuTrigger';
2
+ import { renderMenuTrigger_unstable } from './renderMenuTrigger';
3
3
  /**
4
4
  * Wraps a trigger element as an only child
5
5
  * and adds the necessary event handling to open a popup menu
6
6
  */
7
7
 
8
8
  export const MenuTrigger = props => {
9
- const state = useMenuTrigger(props);
10
- return renderMenuTrigger(state);
9
+ const state = useMenuTrigger_unstable(props);
10
+ return renderMenuTrigger_unstable(state);
11
11
  };
12
12
  MenuTrigger.displayName = 'MenuTrigger';
13
+ MenuTrigger.isFluentTriggerComponent = true;
13
14
  //# sourceMappingURL=MenuTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,cAAT,QAA+B,kBAA/B;AACA,SAAS,iBAAT,QAAkC,qBAAlC;AAGA;;;AAGG;;AACH,OAAO,MAAM,WAAW,GAA+B,KAAK,IAAG;AAC7D,QAAM,KAAK,GAAG,cAAc,CAAC,KAAD,CAA5B;AAEA,SAAO,iBAAiB,CAAC,KAAD,CAAxB;AACD,CAJM;AAMP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuTrigger/MenuTrigger.tsx"],"names":[],"mappings":"AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAIA;;;AAGG;;AACH,OAAO,MAAM,WAAW,GAAwD,KAAK,IAAG;AACtF,QAAM,KAAK,GAAG,uBAAuB,CAAC,KAAD,CAArC;AAEA,SAAO,0BAA0B,CAAC,KAAD,CAAjC;AACD,CAJM;AAMP,WAAW,CAAC,WAAZ,GAA0B,aAA1B;AACA,WAAW,CAAC,wBAAZ,GAAuC,IAAvC","sourcesContent":["import * as React from 'react';\nimport { useMenuTrigger_unstable } from './useMenuTrigger';\nimport { renderMenuTrigger_unstable } from './renderMenuTrigger';\nimport type { MenuTriggerProps } from './MenuTrigger.types';\nimport type { FluentTriggerComponent } from '@fluentui/react-utilities';\n\n/**\n * Wraps a trigger element as an only child\n * and adds the necessary event handling to open a popup menu\n */\nexport const MenuTrigger: React.FC<MenuTriggerProps> & FluentTriggerComponent = props => {\n const state = useMenuTrigger_unstable(props);\n\n return renderMenuTrigger_unstable(state);\n};\n\nMenuTrigger.displayName = 'MenuTrigger';\nMenuTrigger.isFluentTriggerComponent = true;\n"],"sourceRoot":"../src/"}
@@ -5,13 +5,15 @@ export declare type MenuTriggerProps = {
5
5
  */
6
6
  children: (React.ReactElement & {
7
7
  ref?: React.Ref<unknown>;
8
- }) | ((props: MenuTriggerChildProps) => React.ReactNode);
8
+ }) | ((props: MenuTriggerChildProps) => React.ReactElement | null);
9
9
  };
10
10
  /**
11
11
  * Props that are passed to the child of the MenuTrigger when cloned to ensure correct behaviour for the Menu
12
12
  */
13
- export declare type MenuTriggerChildProps = Required<Pick<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onContextMenu' | 'onKeyDown' | 'aria-haspopup' | 'id'>> & {
13
+ export declare type MenuTriggerChildProps = Required<Pick<React.HTMLAttributes<HTMLElement>, 'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onContextMenu' | 'onKeyDown' | 'aria-haspopup' | 'id'>> & {
14
14
  ref?: React.Ref<never>;
15
15
  'aria-expanded': boolean | undefined;
16
16
  };
17
- export declare type MenuTriggerState = MenuTriggerProps;
17
+ export declare type MenuTriggerState = {
18
+ children: React.ReactElement | null;
19
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"MenuTrigger.types.js","sourceRoot":"","sources":["../../../src/components/MenuTrigger/MenuTrigger.types.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"MenuTrigger.types.js","sourceRoot":"../src/","sources":["components/MenuTrigger/MenuTrigger.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\n\nexport type MenuTriggerProps = {\n /**\n * Explicitly require single child or render function\n */\n children:\n | (React.ReactElement & { ref?: React.Ref<unknown> })\n | ((props: MenuTriggerChildProps) => React.ReactElement | null);\n};\n\n/**\n * Props that are passed to the child of the MenuTrigger when cloned to ensure correct behaviour for the Menu\n */\nexport type MenuTriggerChildProps = Required<\n Pick<\n React.HTMLAttributes<HTMLElement>,\n 'onClick' | 'onMouseEnter' | 'onMouseLeave' | 'onMouseMove' | 'onContextMenu' | 'onKeyDown' | 'aria-haspopup' | 'id'\n >\n> & {\n ref?: React.Ref<never>;\n // aria-expanded should only be present when the menu when it is not a submenu\n 'aria-expanded': boolean | undefined;\n};\n\nexport type MenuTriggerState = {\n children: React.ReactElement | null;\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/MenuTrigger/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/MenuTrigger/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './MenuTrigger';\nexport * from './MenuTrigger.types';\nexport * from './renderMenuTrigger';\nexport * from './useMenuTrigger';\n"]}
@@ -4,4 +4,4 @@ import type { MenuTriggerState } from './MenuTrigger.types';
4
4
  *
5
5
  * Only renders children
6
6
  */
7
- export declare const renderMenuTrigger: (state: MenuTriggerState) => JSX.Element;
7
+ export declare const renderMenuTrigger_unstable: (state: MenuTriggerState) => JSX.Element;
@@ -6,7 +6,7 @@ import { MenuTriggerContextProvider } from '../../contexts/menuTriggerContext';
6
6
  * Only renders children
7
7
  */
8
8
 
9
- export const renderMenuTrigger = state => {
9
+ export const renderMenuTrigger_unstable = state => {
10
10
  return /*#__PURE__*/React.createElement(MenuTriggerContextProvider, {
11
11
  value: true
12
12
  }, state.children);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuTrigger/renderMenuTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,mCAA3C;AAGA;;;;AAIG;;AACH,OAAO,MAAM,iBAAiB,GAAI,KAAD,IAA4B;AAC3D,sBAAO,KAAA,CAAA,aAAA,CAAC,0BAAD,EAA2B;AAAC,IAAA,KAAK,EAAE;AAAR,GAA3B,EAA0C,KAAK,CAAC,QAAhD,CAAP;AACD,CAFM","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuTrigger/renderMenuTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,0BAAT,QAA2C,mCAA3C;AAGA;;;;AAIG;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAA4B;AACpE,sBAAO,KAAA,CAAA,aAAA,CAAC,0BAAD,EAA2B;AAAC,IAAA,KAAK,EAAE;AAAR,GAA3B,EAA0C,KAAK,CAAC,QAAhD,CAAP;AACD,CAFM","sourcesContent":["import * as React from 'react';\nimport { MenuTriggerContextProvider } from '../../contexts/menuTriggerContext';\nimport type { MenuTriggerState } from './MenuTrigger.types';\n\n/**\n * Render the final JSX of MenuTrigger\n *\n * Only renders children\n */\nexport const renderMenuTrigger_unstable = (state: MenuTriggerState) => {\n return <MenuTriggerContextProvider value={true}>{state.children}</MenuTriggerContextProvider>;\n};\n"],"sourceRoot":"../src/"}
@@ -1,8 +1,8 @@
1
- import type { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';
1
+ import { MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';
2
2
  /**
3
3
  * Create the state required to render MenuTrigger.
4
4
  * Clones the only child component and adds necessary event handling behaviours to open a popup menu
5
5
  *
6
6
  * @param props - props from this instance of MenuTrigger
7
7
  */
8
- export declare const useMenuTrigger: (props: MenuTriggerProps) => MenuTriggerState;
8
+ export declare const useMenuTrigger_unstable: (props: MenuTriggerProps) => MenuTriggerState;
@@ -1,4 +1,11 @@
1
- import { useTriggerElement } from './useTriggerElement';
1
+ import * as React from 'react';
2
+ import { useMenuContext_unstable } from '../../contexts/menuContext';
3
+ import { useIsSubmenu } from '../../utils/useIsSubmenu';
4
+ import { useFocusFinders } from '@fluentui/react-tabster';
5
+ import { useFluent } from '@fluentui/react-shared-contexts';
6
+ import { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';
7
+ import { applyTriggerPropsToChildren, getTriggerChild, useMergedEventCallbacks, useMergedRefs } from '@fluentui/react-utilities';
8
+ import { shouldPreventDefaultOnKeyDown } from '@fluentui/react-utilities';
2
9
  /**
3
10
  * Create the state required to render MenuTrigger.
4
11
  * Clones the only child component and adds necessary event handling behaviours to open a popup menu
@@ -6,10 +13,165 @@ import { useTriggerElement } from './useTriggerElement';
6
13
  * @param props - props from this instance of MenuTrigger
7
14
  */
8
15
 
9
- export const useMenuTrigger = props => {
10
- const state = { ...props
11
- }; // TODO just move the contents of this hook here
16
+ export const useMenuTrigger_unstable = props => {
17
+ var _a, _b, _c, _d, _e, _f;
12
18
 
13
- return useTriggerElement(state);
19
+ const {
20
+ children
21
+ } = props;
22
+ const triggerRef = useMenuContext_unstable(context => context.triggerRef);
23
+ const menuPopoverRef = useMenuContext_unstable(context => context.menuPopoverRef);
24
+ const setOpen = useMenuContext_unstable(context => context.setOpen);
25
+ const open = useMenuContext_unstable(context => context.open);
26
+ const triggerId = useMenuContext_unstable(context => context.triggerId);
27
+ const openOnHover = useMenuContext_unstable(context => context.openOnHover);
28
+ const openOnContext = useMenuContext_unstable(context => context.openOnContext);
29
+ const isSubmenu = useIsSubmenu();
30
+ const {
31
+ findFirstFocusable
32
+ } = useFocusFinders();
33
+ const focusFirst = React.useCallback(() => {
34
+ const firstFocusable = findFirstFocusable(menuPopoverRef.current);
35
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
36
+ }, [findFirstFocusable, menuPopoverRef]);
37
+ const openedWithKeyboardRef = React.useRef(false);
38
+ const hasMouseMoved = React.useRef(false);
39
+ const {
40
+ dir
41
+ } = useFluent();
42
+ const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;
43
+ const child = /*#__PURE__*/React.isValidElement(children) ? getTriggerChild(children) : undefined;
44
+
45
+ const onContextMenu = e => {
46
+ if (isTargetDisabled(e)) {
47
+ return;
48
+ }
49
+
50
+ if (openOnContext) {
51
+ e.preventDefault();
52
+ setOpen(e, {
53
+ open: true,
54
+ keyboard: false
55
+ });
56
+ }
57
+ };
58
+
59
+ const onClick = e => {
60
+ if (isTargetDisabled(e)) {
61
+ return;
62
+ }
63
+
64
+ if (!openOnContext) {
65
+ setOpen(e, {
66
+ open: !open,
67
+ keyboard: openedWithKeyboardRef.current
68
+ });
69
+ openedWithKeyboardRef.current = false;
70
+ }
71
+ };
72
+
73
+ const onKeyDown = e => {
74
+ var _a;
75
+
76
+ if (isTargetDisabled(e)) {
77
+ return;
78
+ }
79
+
80
+ if (shouldPreventDefaultOnKeyDown(e)) {
81
+ e.preventDefault();
82
+ openedWithKeyboardRef.current = true;
83
+ (_a = e.target) === null || _a === void 0 ? void 0 : _a.click();
84
+ }
85
+
86
+ const key = e.key;
87
+
88
+ if (!openOnContext && (isSubmenu && key === OpenArrowKey || !isSubmenu && key === ArrowDown)) {
89
+ setOpen(e, {
90
+ open: true,
91
+ keyboard: true
92
+ });
93
+ }
94
+
95
+ if (key === Escape && !isSubmenu) {
96
+ setOpen(e, {
97
+ open: false,
98
+ keyboard: true
99
+ });
100
+ } // if menu is already open, can't rely on effects to focus
101
+
102
+
103
+ if (open && key === OpenArrowKey && isSubmenu) {
104
+ focusFirst();
105
+ }
106
+ };
107
+
108
+ const onMouseEnter = e => {
109
+ if (isTargetDisabled(e)) {
110
+ return;
111
+ }
112
+
113
+ if (openOnHover && hasMouseMoved.current) {
114
+ setOpen(e, {
115
+ open: true,
116
+ keyboard: false
117
+ });
118
+ }
119
+ }; // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience
120
+ // First time open the mouse using mousemove and then continue with mouseenter
121
+ // Only use once to determine that the user is using the mouse since it is an expensive event to handle
122
+
123
+
124
+ const onMouseMove = e => {
125
+ if (isTargetDisabled(e)) {
126
+ return;
127
+ }
128
+
129
+ if (openOnHover && !hasMouseMoved.current) {
130
+ setOpen(e, {
131
+ open: true,
132
+ keyboard: false
133
+ });
134
+ hasMouseMoved.current = true;
135
+ }
136
+ };
137
+
138
+ const onMouseLeave = e => {
139
+ if (isTargetDisabled(e)) {
140
+ return;
141
+ }
142
+
143
+ if (openOnHover) {
144
+ setOpen(e, {
145
+ open: false,
146
+ keyboard: false
147
+ });
148
+ }
149
+ };
150
+
151
+ return {
152
+ children: applyTriggerPropsToChildren(children, {
153
+ 'aria-haspopup': 'menu',
154
+ 'aria-expanded': !open && !isSubmenu ? undefined : open,
155
+ id: triggerId,
156
+ ...(child === null || child === void 0 ? void 0 : child.props),
157
+ ref: useMergedRefs(triggerRef, child === null || child === void 0 ? void 0 : child.ref),
158
+ onClick: useMergedEventCallbacks((_a = child === null || child === void 0 ? void 0 : child.props) === null || _a === void 0 ? void 0 : _a.onClick, onClick),
159
+ onMouseEnter: useMergedEventCallbacks((_b = child === null || child === void 0 ? void 0 : child.props) === null || _b === void 0 ? void 0 : _b.onMouseEnter, onMouseEnter),
160
+ onMouseLeave: useMergedEventCallbacks((_c = child === null || child === void 0 ? void 0 : child.props) === null || _c === void 0 ? void 0 : _c.onMouseLeave, onMouseLeave),
161
+ onKeyDown: useMergedEventCallbacks((_d = child === null || child === void 0 ? void 0 : child.props) === null || _d === void 0 ? void 0 : _d.onKeyDown, onKeyDown),
162
+ onContextMenu: useMergedEventCallbacks((_e = child === null || child === void 0 ? void 0 : child.props) === null || _e === void 0 ? void 0 : _e.onContextMenu, onContextMenu),
163
+ onMouseMove: useMergedEventCallbacks((_f = child === null || child === void 0 ? void 0 : child.props) === null || _f === void 0 ? void 0 : _f.onMouseMove, onMouseMove)
164
+ })
165
+ };
166
+ };
167
+
168
+ const isTargetDisabled = e => {
169
+ const isDisabled = el => el.hasAttribute('disabled') || el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true';
170
+
171
+ if (e.target instanceof HTMLElement && isDisabled(e.target)) {
172
+ return true;
173
+ }
174
+
175
+ return e.currentTarget instanceof HTMLElement && isDisabled(e.currentTarget);
14
176
  };
15
177
  //# sourceMappingURL=useMenuTrigger.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/MenuTrigger/useMenuTrigger.ts"],"names":[],"mappings":"AAAA,SAAS,iBAAT,QAAkC,qBAAlC;AAGA;;;;;AAKG;;AACH,OAAO,MAAM,cAAc,GAAI,KAAD,IAA8C;AAC1E,QAAM,KAAK,GAAG,EAAE,GAAG;AAAL,GAAd,CAD0E,CAG1E;;AACA,SAAO,iBAAiB,CAAC,KAAD,CAAxB;AACD,CALM","sourceRoot":""}
1
+ {"version":3,"sources":["components/MenuTrigger/useMenuTrigger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,SAAS,uBAAT,QAAwC,4BAAxC;AACA,SAAS,YAAT,QAA6B,0BAA7B;AACA,SAAS,eAAT,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AAoC,EAAE,CAAC,YAAH,CAAgB,eAAhB,MAAqC,MAD3G;;AAEA,MAAI,CAAC,CAAC,MAAF,YAAoB,WAApB,IAAmC,UAAU,CAAC,CAAC,CAAC,MAAH,CAAjD,EAA6D;AAC3D,WAAO,IAAP;AACD;;AAED,SAAO,CAAC,CAAC,aAAF,YAA2B,WAA3B,IAA0C,UAAU,CAAC,CAAC,CAAC,aAAH,CAA3D;AACD,CARD","sourcesContent":["import * as React from 'react';\nimport { MenuTriggerChildProps, MenuTriggerProps, MenuTriggerState } from './MenuTrigger.types';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useFluent } from '@fluentui/react-shared-contexts';\nimport { ArrowRight, ArrowLeft, Escape, ArrowDown } from '@fluentui/keyboard-keys';\nimport {\n applyTriggerPropsToChildren,\n getTriggerChild,\n useMergedEventCallbacks,\n useMergedRefs,\n} from '@fluentui/react-utilities';\nimport { shouldPreventDefaultOnKeyDown } from '@fluentui/react-utilities';\n\n/**\n * Create the state required to render MenuTrigger.\n * Clones the only child component and adds necessary event handling behaviours to open a popup menu\n *\n * @param props - props from this instance of MenuTrigger\n */\nexport const useMenuTrigger_unstable = (props: MenuTriggerProps): MenuTriggerState => {\n const { children } = props;\n\n const triggerRef = useMenuContext_unstable(context => context.triggerRef);\n const menuPopoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const openOnContext = useMenuContext_unstable(context => context.openOnContext);\n\n const isSubmenu = useIsSubmenu();\n\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, menuPopoverRef]);\n\n const openedWithKeyboardRef = React.useRef(false);\n const hasMouseMoved = React.useRef(false);\n\n const { dir } = useFluent();\n const OpenArrowKey = dir === 'ltr' ? ArrowRight : ArrowLeft;\n\n const child = React.isValidElement(children) ? getTriggerChild(children) : undefined;\n\n const onContextMenu = (e: React.MouseEvent<HTMLElement>) => {\n if (isTargetDisabled(e)) {\n return;\n }\n\n if (openOnContext) {\n e.preventDefault();\n setOpen(e, { open: true, keyboard: false });\n }\n };\n\n const onClick = (e: React.MouseEvent<HTMLElement>) => {\n if (isTargetDisabled(e)) {\n return;\n }\n\n if (!openOnContext) {\n setOpen(e, { open: !open, keyboard: openedWithKeyboardRef.current });\n openedWithKeyboardRef.current = false;\n }\n };\n\n const onKeyDown = (e: React.KeyboardEvent<HTMLElement>) => {\n if (isTargetDisabled(e)) {\n return;\n }\n\n if (shouldPreventDefaultOnKeyDown(e)) {\n e.preventDefault();\n openedWithKeyboardRef.current = true;\n (e.target as HTMLElement)?.click();\n }\n\n const key = e.key;\n\n if (!openOnContext && ((isSubmenu && key === OpenArrowKey) || (!isSubmenu && key === ArrowDown))) {\n setOpen(e, { open: true, keyboard: true });\n }\n\n if (key === Escape && !isSubmenu) {\n setOpen(e, { open: false, keyboard: true });\n }\n\n // if menu is already open, can't rely on effects to focus\n if (open && key === OpenArrowKey && isSubmenu) {\n focusFirst();\n }\n };\n\n const onMouseEnter = (e: React.MouseEvent<HTMLElement>) => {\n if (isTargetDisabled(e)) {\n return;\n }\n if (openOnHover && hasMouseMoved.current) {\n setOpen(e, { open: true, keyboard: false });\n }\n };\n\n // Opening a menu when a mouse hasn't moved and just entering the trigger is a bad a11y experience\n // First time open the mouse using mousemove and then continue with mouseenter\n // Only use once to determine that the user is using the mouse since it is an expensive event to handle\n const onMouseMove = (e: React.MouseEvent<HTMLElement>) => {\n if (isTargetDisabled(e)) {\n return;\n }\n if (openOnHover && !hasMouseMoved.current) {\n setOpen(e, { open: true, keyboard: false });\n hasMouseMoved.current = true;\n }\n };\n\n const onMouseLeave = (e: React.MouseEvent<HTMLElement>) => {\n if (isTargetDisabled(e)) {\n return;\n }\n if (openOnHover) {\n setOpen(e, { open: false, keyboard: false });\n }\n };\n\n return {\n children: applyTriggerPropsToChildren<MenuTriggerChildProps>(children, {\n 'aria-haspopup': 'menu',\n 'aria-expanded': !open && !isSubmenu ? undefined : open,\n id: triggerId,\n ...child?.props,\n ref: useMergedRefs(triggerRef, child?.ref),\n onClick: useMergedEventCallbacks(child?.props?.onClick, onClick),\n onMouseEnter: useMergedEventCallbacks(child?.props?.onMouseEnter, onMouseEnter),\n onMouseLeave: useMergedEventCallbacks(child?.props?.onMouseLeave, onMouseLeave),\n onKeyDown: useMergedEventCallbacks(child?.props?.onKeyDown, onKeyDown),\n onContextMenu: useMergedEventCallbacks(child?.props?.onContextMenu, onContextMenu),\n onMouseMove: useMergedEventCallbacks(child?.props?.onMouseMove, onMouseMove),\n }),\n };\n};\n\nconst isTargetDisabled = (e: React.SyntheticEvent | Event) => {\n const isDisabled = (el: HTMLElement) =>\n el.hasAttribute('disabled') || (el.hasAttribute('aria-disabled') && el.getAttribute('aria-disabled') === 'true');\n if (e.target instanceof HTMLElement && isDisabled(e.target)) {\n return true;\n }\n\n return e.currentTarget instanceof HTMLElement && isDisabled(e.currentTarget);\n};\n"],"sourceRoot":"../src/"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC","sourcesContent":["export * from './MenuItem/index';\nexport * from './MenuList/index';\n"]}
@@ -13,4 +13,4 @@ export declare type MenuContextValue = MenuListProps & Pick<MenuState, 'openOnHo
13
13
  triggerId: string;
14
14
  };
15
15
  export declare const MenuProvider: React.Provider<MenuContextValue> & React.FC<React.ProviderProps<MenuContextValue>>;
16
- export declare const useMenuContext: <T>(selector: ContextSelector<MenuContextValue, T>) => T;
16
+ export declare const useMenuContext_unstable: <T>(selector: ContextSelector<MenuContextValue, T>) => T;
@@ -19,5 +19,5 @@ export const MenuContext = /*#__PURE__*/createContext({
19
19
  hasCheckmarks: false
20
20
  });
21
21
  export const MenuProvider = MenuContext.Provider;
22
- export const useMenuContext = selector => useContextSelector(MenuContext, selector);
22
+ export const useMenuContext_unstable = selector => useContextSelector(MenuContext, selector);
23
23
  //# sourceMappingURL=menuContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/contexts/menuContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,WAAW,gBAA8B,aAAa,CAAmB;AACpF,EAAA,IAAI,EAAE,KAD8E;AAEpF,EAAA,OAAO,EAAE,MAAM,KAFqE;AAGpF,EAAA,aAAa,EAAE,EAHqE;AAIpF,EAAA,oBAAoB,EAAE,MAAM,IAJwD;AAKpF,EAAA,oBAAoB,EAAE,EAL8D;AAMpF,EAAA,SAAS,EAAE,KANyE;AAOpF,EAAA,UAAU,EAAG;AAAE,IAAA,OAAO,EAAE;AAAX,GAPuE;AAQpF,EAAA,cAAc,EAAG;AAAE,IAAA,OAAO,EAAE;AAAX,GARmE;AASpF,EAAA,SAAS,EAAE,EATyE;AAUpF,EAAA,aAAa,EAAE,KAVqE;AAWpF,EAAA,WAAW,EAAE,KAXuE;AAYpF,EAAA,QAAQ,EAAE,KAZ0E;AAapF,EAAA,aAAa,EAAE;AAbqE,CAAnB,CAA5D;AAwCP,OAAO,MAAM,YAAY,GAAG,WAAW,CAAC,QAAjC;AAEP,OAAO,MAAM,cAAc,GAAO,QAAJ,IAC5B,kBAAkB,CAAC,WAAD,EAAc,QAAd,CADb","sourceRoot":""}
1
+ {"version":3,"sources":["contexts/menuContext.ts"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,WAAW,gBAA8B,aAAa,CAAmB;AACpF,EAAA,IAAI,EAAE,KAD8E;AAEpF,EAAA,OAAO,EAAE,MAAM,KAFqE;AAGpF,EAAA,aAAa,EAAE,EAHqE;AAIpF,EAAA,oBAAoB,EAAE,MAAM,IAJwD;AAKpF,EAAA,oBAAoB,EAAE,EAL8D;AAMpF,EAAA,SAAS,EAAE,KANyE;AAOpF,EAAA,UAAU,EAAG;AAAE,IAAA,OAAO,EAAE;AAAX,GAPuE;AAQpF,EAAA,cAAc,EAAG;AAAE,IAAA,OAAO,EAAE;AAAX,GARmE;AASpF,EAAA,SAAS,EAAE,EATyE;AAUpF,EAAA,aAAa,EAAE,KAVqE;AAWpF,EAAA,WAAW,EAAE,KAXuE;AAYpF,EAAA,QAAQ,EAAE,KAZ0E;AAapF,EAAA,aAAa,EAAE;AAbqE,CAAnB,CAA5D;AAwCP,OAAO,MAAM,YAAY,GAAG,WAAW,CAAC,QAAjC;AAEP,OAAO,MAAM,uBAAuB,GAAO,QAAJ,IACrC,kBAAkB,CAAC,WAAD,EAAc,QAAd,CADb","sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { MenuListProps } from '../components/index';\nimport type { MenuState } from '../components/Menu/index';\n\nexport const MenuContext: Context<MenuContextValue> = createContext<MenuContextValue>({\n open: false,\n setOpen: () => false,\n checkedValues: {},\n onCheckedValueChange: () => null,\n defaultCheckedValues: {},\n isSubmenu: false,\n triggerRef: ({ current: null } as unknown) as React.MutableRefObject<HTMLElement>,\n menuPopoverRef: ({ current: null } as unknown) as React.MutableRefObject<HTMLElement>,\n triggerId: '',\n openOnContext: false,\n openOnHover: false,\n hasIcons: false,\n hasCheckmarks: false,\n});\n\n/**\n * Context shared between Menu and its children components\n *\n * Extends and drills down MenuList props to simplify API\n */\nexport type MenuContextValue = MenuListProps &\n Pick<\n MenuState,\n | 'openOnHover'\n | 'openOnContext'\n | 'triggerRef'\n | 'menuPopoverRef'\n | 'setOpen'\n | 'isSubmenu'\n | 'triggerId'\n | 'hasIcons'\n | 'hasCheckmarks'\n | 'persistOnItemClick'\n | 'inline'\n > & {\n open: boolean;\n triggerId: string;\n };\n\nexport const MenuProvider = MenuContext.Provider;\n\nexport const useMenuContext_unstable = <T>(selector: ContextSelector<MenuContextValue, T>) =>\n useContextSelector(MenuContext, selector);\n"],"sourceRoot":"../src/"}
@@ -10,4 +10,4 @@ export declare type MenuGroupContextValue = {
10
10
  headerId: string;
11
11
  };
12
12
  export declare const MenuGroupContextProvider: React.Provider<MenuGroupContextValue>;
13
- export declare const useMenuGroupContext: () => MenuGroupContextValue;
13
+ export declare const useMenuGroupContext_unstable: () => MenuGroupContextValue;
@@ -3,5 +3,5 @@ const MenuGroupContext = /*#__PURE__*/React.createContext({
3
3
  headerId: ''
4
4
  });
5
5
  export const MenuGroupContextProvider = MenuGroupContext.Provider;
6
- export const useMenuGroupContext = () => React.useContext(MenuGroupContext);
6
+ export const useMenuGroupContext_unstable = () => React.useContext(MenuGroupContext);
7
7
  //# sourceMappingURL=menuGroupContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/contexts/menuGroupContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,MAAM,gBAAgB,gBAAG,KAAK,CAAC,aAAN,CAA2C;AAAE,EAAA,QAAQ,EAAE;AAAZ,CAA3C,CAAzB;AAaA,OAAO,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,QAAlD;AACP,OAAO,MAAM,mBAAmB,GAAG,MAAM,KAAK,CAAC,UAAN,CAAiB,gBAAjB,CAAlC","sourceRoot":""}
1
+ {"version":3,"sources":["contexts/menuGroupContext.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AAEA,MAAM,gBAAgB,gBAAG,KAAK,CAAC,aAAN,CAA2C;AAAE,EAAA,QAAQ,EAAE;AAAZ,CAA3C,CAAzB;AAaA,OAAO,MAAM,wBAAwB,GAAG,gBAAgB,CAAC,QAAlD;AACP,OAAO,MAAM,4BAA4B,GAAG,MAAM,KAAK,CAAC,UAAN,CAAiB,gBAAjB,CAA3C","sourcesContent":["import * as React from 'react';\n\nconst MenuGroupContext = React.createContext<MenuGroupContextValue>({ headerId: '' });\n\n/**\n * Context used to guarantee correct aria-relationship between header\n * and group information\n */\nexport type MenuGroupContextValue = {\n /**\n * Element id applied to the `MenuGroupHeader` component\n */\n headerId: string;\n};\n\nexport const MenuGroupContextProvider = MenuGroupContext.Provider;\nexport const useMenuGroupContext_unstable = () => React.useContext(MenuGroupContext);\n"],"sourceRoot":"../src/"}
@@ -12,4 +12,4 @@ export declare type MenuListContextValue = Pick<MenuListProps, 'checkedValues' |
12
12
  selectRadio?: SelectableHandler;
13
13
  };
14
14
  export declare const MenuListProvider: React.Provider<MenuListContextValue> & React.FC<React.ProviderProps<MenuListContextValue>>;
15
- export declare const useMenuListContext: <T>(selector: ContextSelector<MenuListContextValue, T>) => T;
15
+ export declare const useMenuListContext_unstable: <T>(selector: ContextSelector<MenuListContextValue, T>) => T;
@@ -9,5 +9,5 @@ export const MenuListContext = /*#__PURE__*/createContext({
9
9
  hasCheckmarks: false
10
10
  });
11
11
  export const MenuListProvider = MenuListContext.Provider;
12
- export const useMenuListContext = selector => useContextSelector(MenuListContext, selector);
12
+ export const useMenuListContext_unstable = selector => useContextSelector(MenuListContext, selector);
13
13
  //# sourceMappingURL=menuListContext.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,eAAe,gBAAkC,aAAa,CAAuB;AAChG,EAAA,aAAa,EAAE,EADiF;AAEhG,EAAA,oBAAoB,EAAE,MAAM,IAFoE;AAGhG,EAAA,wBAAwB,EAAE,MAAM,IAHgE;AAIhG,EAAA,cAAc,EAAE,MAAM,IAJ0E;AAKhG,EAAA,WAAW,EAAE,MAAM,IAL6E;AAMhG,EAAA,QAAQ,EAAE,KANsF;AAOhG,EAAA,aAAa,EAAE;AAPiF,CAAvB,CAApE;AAsBP,OAAO,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAzC;AAEP,OAAO,MAAM,kBAAkB,GAAQ,QAAL,IAChC,kBAAkB,CAAC,eAAD,EAAkB,QAAlB,CADb","sourceRoot":""}
1
+ {"version":3,"sources":["contexts/menuListContext.tsx"],"names":[],"mappings":"AACA,SAAS,aAAT,EAAwB,kBAAxB,QAAkD,kCAAlD;AAKA,OAAO,MAAM,eAAe,gBAAkC,aAAa,CAAuB;AAChG,EAAA,aAAa,EAAE,EADiF;AAEhG,EAAA,oBAAoB,EAAE,MAAM,IAFoE;AAGhG,EAAA,wBAAwB,EAAE,MAAM,IAHgE;AAIhG,EAAA,cAAc,EAAE,MAAM,IAJ0E;AAKhG,EAAA,WAAW,EAAE,MAAM,IAL6E;AAMhG,EAAA,QAAQ,EAAE,KANsF;AAOhG,EAAA,aAAa,EAAE;AAPiF,CAAvB,CAApE;AAsBP,OAAO,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAzC;AAEP,OAAO,MAAM,2BAA2B,GAAQ,QAAL,IACzC,kBAAkB,CAAC,eAAD,EAAkB,QAAlB,CADb","sourcesContent":["import * as React from 'react';\nimport { createContext, useContextSelector } from '@fluentui/react-context-selector';\nimport type { ContextSelector, Context } from '@fluentui/react-context-selector';\nimport type { SelectableHandler } from '../selectable/index';\nimport type { MenuListProps } from '../components/index';\n\nexport const MenuListContext: Context<MenuListContextValue> = createContext<MenuListContextValue>({\n checkedValues: {},\n onCheckedValueChange: () => null,\n setFocusByFirstCharacter: () => null,\n toggleCheckbox: () => null,\n selectRadio: () => null,\n hasIcons: false,\n hasCheckmarks: false,\n});\n\n/**\n * Context shared between MenuList and its children components\n */\nexport type MenuListContextValue = Pick<\n MenuListProps,\n 'checkedValues' | 'onCheckedValueChange' | 'hasIcons' | 'hasCheckmarks'\n> & {\n setFocusByFirstCharacter?: (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => void;\n toggleCheckbox?: SelectableHandler;\n selectRadio?: SelectableHandler;\n};\n\nexport const MenuListProvider = MenuListContext.Provider;\n\nexport const useMenuListContext_unstable = <T,>(selector: ContextSelector<MenuListContextValue, T>) =>\n useContextSelector(MenuListContext, selector);\n"],"sourceRoot":"../src/"}
@@ -1,3 +1,3 @@
1
1
  import * as React from 'react';
2
2
  export declare const MenuTriggerContextProvider: React.Provider<boolean>;
3
- export declare const useMenuTriggerContext: () => boolean;
3
+ export declare const useMenuTriggerContext_unstable: () => boolean;