@fluentui/react-menu 9.5.3 → 9.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (276) hide show
  1. package/CHANGELOG.json +72 -1
  2. package/CHANGELOG.md +18 -2
  3. package/lib/components/Menu/Menu.js +0 -1
  4. package/lib/components/Menu/Menu.js.map +1 -1
  5. package/lib/components/Menu/renderMenu.js +0 -1
  6. package/lib/components/Menu/renderMenu.js.map +1 -1
  7. package/lib/components/Menu/useMenu.js +16 -34
  8. package/lib/components/Menu/useMenu.js.map +1 -1
  9. package/lib/components/Menu/useMenuContextValues.js +2 -2
  10. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  11. package/lib/components/MenuDivider/MenuDivider.js +0 -1
  12. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  13. package/lib/components/MenuDivider/renderMenuDivider.js +2 -2
  14. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  15. package/lib/components/MenuDivider/useMenuDivider.js +0 -1
  16. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  17. package/lib/components/MenuDivider/useMenuDividerStyles.js +10 -12
  18. package/lib/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  19. package/lib/components/MenuGroup/MenuGroup.js +0 -1
  20. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  21. package/lib/components/MenuGroup/renderMenuGroup.js +2 -2
  22. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  23. package/lib/components/MenuGroup/useMenuGroup.js +0 -1
  24. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  25. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  26. package/lib/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  27. package/lib/components/MenuGroupHeader/MenuGroupHeader.js +0 -1
  28. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  29. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -2
  30. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  31. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +0 -1
  32. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  33. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +10 -12
  34. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  35. package/lib/components/MenuItem/MenuItem.js +0 -1
  36. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  37. package/lib/components/MenuItem/renderMenuItem.js +12 -7
  38. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  39. package/lib/components/MenuItem/useCharacterSearch.js +0 -5
  40. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  41. package/lib/components/MenuItem/useMenuItem.js +0 -6
  42. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  43. package/lib/components/MenuItem/useMenuItemStyles.js +108 -117
  44. package/lib/components/MenuItem/useMenuItemStyles.js.map +1 -1
  45. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -1
  46. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  47. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +10 -6
  48. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  49. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +2 -4
  50. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  51. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -5
  52. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  53. package/lib/components/MenuItemRadio/MenuItemRadio.js +0 -1
  54. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  55. package/lib/components/MenuItemRadio/renderMenuItemRadio.js +10 -6
  56. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  57. package/lib/components/MenuItemRadio/useMenuItemRadio.js +3 -4
  58. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  59. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -5
  60. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  61. package/lib/components/MenuList/MenuList.js +0 -1
  62. package/lib/components/MenuList/MenuList.js.map +1 -1
  63. package/lib/components/MenuList/renderMenuList.js +2 -2
  64. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  65. package/lib/components/MenuList/useMenuList.js +10 -27
  66. package/lib/components/MenuList/useMenuList.js.map +1 -1
  67. package/lib/components/MenuList/useMenuListContextValues.js +2 -2
  68. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  69. package/lib/components/MenuList/useMenuListStyles.js +6 -9
  70. package/lib/components/MenuList/useMenuListStyles.js.map +1 -1
  71. package/lib/components/MenuPopover/MenuPopover.js +0 -1
  72. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  73. package/lib/components/MenuPopover/renderMenuPopover.js +4 -5
  74. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  75. package/lib/components/MenuPopover/useMenuPopover.js +6 -13
  76. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  77. package/lib/components/MenuPopover/useMenuPopoverStyles.js +32 -35
  78. package/lib/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  79. package/lib/components/MenuSplitGroup/MenuSplitGroup.js +0 -1
  80. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  81. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +2 -2
  82. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  83. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +0 -6
  84. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  85. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js +12 -15
  86. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  87. package/lib/components/MenuTrigger/MenuTrigger.js +2 -3
  88. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  89. package/lib/components/MenuTrigger/renderMenuTrigger.js +0 -1
  90. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  91. package/lib/components/MenuTrigger/useMenuTrigger.js +4 -24
  92. package/lib/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  93. package/lib/contexts/menuContext.js.map +1 -1
  94. package/lib/contexts/menuGroupContext.js +0 -1
  95. package/lib/contexts/menuGroupContext.js.map +1 -1
  96. package/lib/contexts/menuListContext.js.map +1 -1
  97. package/lib/contexts/menuTriggerContext.js +0 -2
  98. package/lib/contexts/menuTriggerContext.js.map +1 -1
  99. package/lib/index.js.map +1 -1
  100. package/lib/selectable/useCheckmarkStyles.js +7 -11
  101. package/lib/selectable/useCheckmarkStyles.js.map +1 -1
  102. package/lib/utils/useIsSubmenu.js +0 -1
  103. package/lib/utils/useIsSubmenu.js.map +1 -1
  104. package/lib/utils/useOnMenuEnter.js +4 -11
  105. package/lib/utils/useOnMenuEnter.js.map +1 -1
  106. package/lib-commonjs/Menu.js +0 -2
  107. package/lib-commonjs/Menu.js.map +1 -1
  108. package/lib-commonjs/MenuDivider.js +0 -2
  109. package/lib-commonjs/MenuDivider.js.map +1 -1
  110. package/lib-commonjs/MenuGroup.js +0 -2
  111. package/lib-commonjs/MenuGroup.js.map +1 -1
  112. package/lib-commonjs/MenuGroupHeader.js +0 -2
  113. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  114. package/lib-commonjs/MenuItem.js +0 -2
  115. package/lib-commonjs/MenuItem.js.map +1 -1
  116. package/lib-commonjs/MenuItemCheckbox.js +0 -2
  117. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  118. package/lib-commonjs/MenuItemRadio.js +0 -2
  119. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  120. package/lib-commonjs/MenuList.js +0 -2
  121. package/lib-commonjs/MenuList.js.map +1 -1
  122. package/lib-commonjs/MenuPopover.js +0 -2
  123. package/lib-commonjs/MenuPopover.js.map +1 -1
  124. package/lib-commonjs/MenuSplitGroup.js +0 -2
  125. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  126. package/lib-commonjs/MenuTrigger.js +0 -2
  127. package/lib-commonjs/MenuTrigger.js.map +1 -1
  128. package/lib-commonjs/components/Menu/Menu.js +0 -6
  129. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  130. package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
  131. package/lib-commonjs/components/Menu/index.js +0 -6
  132. package/lib-commonjs/components/Menu/index.js.map +1 -1
  133. package/lib-commonjs/components/Menu/renderMenu.js +0 -5
  134. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  135. package/lib-commonjs/components/Menu/useMenu.js +16 -46
  136. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  137. package/lib-commonjs/components/Menu/useMenuContextValues.js +2 -4
  138. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  139. package/lib-commonjs/components/MenuDivider/MenuDivider.js +0 -6
  140. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  141. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  142. package/lib-commonjs/components/MenuDivider/index.js +0 -6
  143. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  144. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +2 -6
  145. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  146. package/lib-commonjs/components/MenuDivider/useMenuDivider.js +0 -4
  147. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  148. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js +10 -16
  149. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.js.map +1 -1
  150. package/lib-commonjs/components/MenuGroup/MenuGroup.js +0 -7
  151. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  152. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  153. package/lib-commonjs/components/MenuGroup/index.js +0 -7
  154. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  155. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +2 -7
  156. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  157. package/lib-commonjs/components/MenuGroup/useMenuGroup.js +0 -4
  158. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  159. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +0 -3
  160. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  161. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js +0 -4
  162. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.js.map +1 -1
  163. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +0 -6
  164. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  165. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  166. package/lib-commonjs/components/MenuGroupHeader/index.js +0 -6
  167. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  168. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +2 -6
  169. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  170. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +0 -5
  171. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  172. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js +10 -16
  173. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.js.map +1 -1
  174. package/lib-commonjs/components/MenuItem/MenuItem.js +0 -6
  175. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  176. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  177. package/lib-commonjs/components/MenuItem/index.js +0 -6
  178. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  179. package/lib-commonjs/components/MenuItem/renderMenuItem.js +12 -11
  180. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  181. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +0 -8
  182. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  183. package/lib-commonjs/components/MenuItem/useMenuItem.js +0 -18
  184. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  185. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js +108 -124
  186. package/lib-commonjs/components/MenuItem/useMenuItemStyles.js.map +1 -1
  187. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +0 -6
  188. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  189. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  190. package/lib-commonjs/components/MenuItemCheckbox/index.js +0 -6
  191. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  192. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +10 -10
  193. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  194. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +2 -11
  195. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  196. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js +0 -11
  197. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.js.map +1 -1
  198. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +0 -6
  199. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  200. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  201. package/lib-commonjs/components/MenuItemRadio/index.js +0 -6
  202. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  203. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +10 -10
  204. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  205. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +3 -11
  206. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  207. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js +0 -11
  208. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.js.map +1 -1
  209. package/lib-commonjs/components/MenuList/MenuList.js +0 -7
  210. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  211. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  212. package/lib-commonjs/components/MenuList/index.js +0 -7
  213. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  214. package/lib-commonjs/components/MenuList/renderMenuList.js +2 -7
  215. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  216. package/lib-commonjs/components/MenuList/useMenuList.js +10 -35
  217. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  218. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +2 -4
  219. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  220. package/lib-commonjs/components/MenuList/useMenuListStyles.js +6 -12
  221. package/lib-commonjs/components/MenuList/useMenuListStyles.js.map +1 -1
  222. package/lib-commonjs/components/MenuPopover/MenuPopover.js +0 -6
  223. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  224. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  225. package/lib-commonjs/components/MenuPopover/index.js +0 -6
  226. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  227. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +4 -10
  228. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  229. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +6 -22
  230. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  231. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js +32 -39
  232. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.js.map +1 -1
  233. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +0 -6
  234. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  235. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  236. package/lib-commonjs/components/MenuSplitGroup/index.js +0 -6
  237. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  238. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +2 -6
  239. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  240. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +0 -13
  241. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  242. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js +12 -20
  243. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.js.map +1 -1
  244. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +2 -7
  245. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  246. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  247. package/lib-commonjs/components/MenuTrigger/index.js +0 -5
  248. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  249. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +0 -5
  250. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  251. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js +4 -34
  252. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.js.map +1 -1
  253. package/lib-commonjs/components/index.js +0 -3
  254. package/lib-commonjs/components/index.js.map +1 -1
  255. package/lib-commonjs/contexts/menuContext.js +0 -4
  256. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  257. package/lib-commonjs/contexts/menuGroupContext.js +0 -5
  258. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  259. package/lib-commonjs/contexts/menuListContext.js +0 -4
  260. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  261. package/lib-commonjs/contexts/menuTriggerContext.js +0 -6
  262. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  263. package/lib-commonjs/index.js +0 -32
  264. package/lib-commonjs/index.js.map +1 -1
  265. package/lib-commonjs/selectable/index.js +0 -3
  266. package/lib-commonjs/selectable/index.js.map +1 -1
  267. package/lib-commonjs/selectable/types.js.map +1 -1
  268. package/lib-commonjs/selectable/useCheckmarkStyles.js +7 -13
  269. package/lib-commonjs/selectable/useCheckmarkStyles.js.map +1 -1
  270. package/lib-commonjs/utils/index.js +0 -2
  271. package/lib-commonjs/utils/index.js.map +1 -1
  272. package/lib-commonjs/utils/useIsSubmenu.js +0 -6
  273. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  274. package/lib-commonjs/utils/useOnMenuEnter.js +4 -17
  275. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  276. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuItemRadio/useMenuItemRadio.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,gBAAT,QAAiC,2BAAjC;AACA,SAAS,iBAAT,QAAkC,uBAAlC;AACA,SAAS,2BAAT,QAA4C,gCAA5C;AACA,SAAS,oBAAT,QAAqC,yBAArC;AAIA;;AAEG;;AACH,OAAO,MAAM,yBAAyB,GAAG,CACvC,KADuC,EAEvC,GAFuC,KAGjB;EACtB,MAAM;IAAE,IAAF;IAAQ;EAAR,IAAkB,KAAxB;EAEA,MAAM,OAAO,GAAG,2BAA2B,CAAC,OAAO,IAAG;;;IACpD,MAAM,YAAY,GAAG,CAAA,CAAA,EAAA,GAAA,OAAO,CAAC,aAAR,MAAqB,IAArB,IAAqB,EAAA,KAAA,KAAA,CAArB,GAAqB,KAAA,CAArB,GAAqB,EAAA,CAAG,IAAH,CAArB,KAAiC,EAAtD;IACA,OAAO,YAAY,CAAC,OAAb,CAAqB,KAArB,MAAgC,CAAC,CAAxC;EACD,CAH0C,CAA3C;EAKA,MAAM,WAAW,GAAG,2BAA2B,CAAC,OAAO,IAAI,OAAO,CAAC,WAApB,CAA/C;EAEA,OAAO,EACL,GAAG,oBAAoB,CACrB,EACE,GAAG,KADL;MAEE,IAAI,EAAE,eAFR;MAGE,gBAAgB,OAHlB;MAIE,SAAS,EAAE,gBAAgB,CAAC,KAAK,CAAC,SAAP,EAAkB;QAC3C,YAAY,EAAE;UAAE,QAAQ,eAAE,KAAA,CAAA,aAAA,CAAC,iBAAD,EAAkB,IAAlB;QAAZ,CAD6B;QAE3C,QAAQ,EAAE;MAFiC,CAAlB,CAJ7B;MAQE,OAAO,EAAG,CAAD,IAA8D;;;QACrE,WAAW,KAAA,IAAX,IAAA,WAAW,KAAA,KAAA,CAAX,GAAW,KAAA,CAAX,GAAA,WAAW,CAAG,CAAH,EAAM,IAAN,EAAY,KAAZ,EAAmB,OAAnB,CAAX;QACA,CAAA,EAAA,GAAA,KAAK,CAAC,OAAN,MAAa,IAAb,IAAa,EAAA,KAAA,KAAA,CAAb,GAAa,KAAA,CAAb,GAAa,EAAA,CAAA,IAAA,CAAb,KAAa,EAAG,CAAH,CAAb;MACD;IAXH,CADqB,EAcrB,GAdqB,CADlB;IAiBL,OAjBK;IAkBL,IAlBK;IAmBL;EAnBK,CAAP;AAqBD,CAlCM","sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItem_unstable } from '../MenuItem/useMenuItem';\nimport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/**\n * Given user props, returns state and render function for a MenuItemRadio.\n */\nexport const useMenuItemRadio_unstable = (\n props: MenuItemRadioProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioState => {\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const selectRadio = useMenuListContext_unstable(context => context.selectRadio);\n\n return {\n ...useMenuItem_unstable(\n {\n ...props,\n role: 'menuitemradio',\n 'aria-checked': checked,\n checkmark: resolveShorthand(props.checkmark, {\n defaultProps: { children: <Checkmark16Filled /> },\n required: true,\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n selectRadio?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n checked,\n name,\n value,\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,gBAAgB,QAAQ,2BAA2B;AAC5D,SAASC,iBAAiB,QAAQ,uBAAuB;AACzD,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5E,SAASC,oBAAoB,QAAQ,yBAAyB;AAI9D;;;AAGA,OAAO,MAAMC,yBAAyB,GAAG,CACvCC,KAAyB,EACzBC,GAAwC,KAClB;EACtB,MAAM;IAAEC,IAAI;IAAEC;EAAK,CAAE,GAAGH,KAAK;EAE7B,MAAMI,OAAO,GAAGP,2BAA2B,CAACQ,OAAO,IAAG;;IACpD,MAAMC,YAAY,GAAG,cAAO,CAACC,aAAa,0CAAGL,IAAI,CAAC,KAAI,EAAE;IACxD,OAAOI,YAAY,CAACE,OAAO,CAACL,KAAK,CAAC,KAAK,CAAC,CAAC;EAC3C,CAAC,CAAC;EAEF,MAAMM,WAAW,GAAGZ,2BAA2B,CAACQ,OAAO,IAAIA,OAAO,CAACI,WAAW,CAAC;EAE/E,OAAO;IACL,GAAGX,oBAAoB,CACrB;MACE,GAAGE,KAAK;MACRU,IAAI,EAAE,eAAe;MACrB,cAAc,EAAEN,OAAO;MACvBO,SAAS,EAAEhB,gBAAgB,CAACK,KAAK,CAACW,SAAS,EAAE;QAC3CC,YAAY,EAAE;UAAEC,QAAQ,eAAEnB,oBAACE,iBAAiB;QAAG,CAAE;QACjDkB,QAAQ,EAAE;OACX,CAAC;MACFC,OAAO,EAAGC,CAAyD,IAAI;;QACrEP,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAGO,CAAC,EAAEd,IAAI,EAAEC,KAAK,EAAEC,OAAO,CAAC;QACtC,WAAK,CAACW,OAAO,+CAAbf,KAAK,EAAWgB,CAAC,CAAC;MACpB;KACD,EACDf,GAAG,CACJ;IACDG,OAAO;IACPF,IAAI;IACJC;GACD;AACH,CAAC","names":["React","resolveShorthand","Checkmark16Filled","useMenuListContext_unstable","useMenuItem_unstable","useMenuItemRadio_unstable","props","ref","name","value","checked","context","checkedItems","checkedValues","indexOf","selectRadio","role","checkmark","defaultProps","children","required","onClick","e"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuItemRadio/useMenuItemRadio.tsx"],"sourcesContent":["import * as React from 'react';\nimport { resolveShorthand } from '@fluentui/react-utilities';\nimport { Checkmark16Filled } from '@fluentui/react-icons';\nimport { useMenuListContext_unstable } from '../../contexts/menuListContext';\nimport { useMenuItem_unstable } from '../MenuItem/useMenuItem';\nimport type { MenuItemRadioProps, MenuItemRadioState } from './MenuItemRadio.types';\nimport type { ARIAButtonElement, ARIAButtonElementIntersection } from '@fluentui/react-aria';\n\n/**\n * Given user props, returns state and render function for a MenuItemRadio.\n */\nexport const useMenuItemRadio_unstable = (\n props: MenuItemRadioProps,\n ref: React.Ref<ARIAButtonElement<'div'>>,\n): MenuItemRadioState => {\n const { name, value } = props;\n\n const checked = useMenuListContext_unstable(context => {\n const checkedItems = context.checkedValues?.[name] || [];\n return checkedItems.indexOf(value) !== -1;\n });\n\n const selectRadio = useMenuListContext_unstable(context => context.selectRadio);\n\n return {\n ...useMenuItem_unstable(\n {\n ...props,\n role: 'menuitemradio',\n 'aria-checked': checked,\n checkmark: resolveShorthand(props.checkmark, {\n defaultProps: { children: <Checkmark16Filled /> },\n required: true,\n }),\n onClick: (e: React.MouseEvent<ARIAButtonElementIntersection<'div'>>) => {\n selectRadio?.(e, name, value, checked);\n props.onClick?.(e);\n },\n },\n ref,\n ),\n checked,\n name,\n value,\n };\n};\n"]}
@@ -10,23 +10,18 @@ export const menuItemRadioClassNames = {
10
10
  };
11
11
  export const useMenuItemRadioStyles_unstable = state => {
12
12
  state.root.className = mergeClasses(menuItemRadioClassNames.root, state.root.className);
13
-
14
13
  if (state.content) {
15
14
  state.content.className = mergeClasses(menuItemRadioClassNames.content, state.content.className);
16
15
  }
17
-
18
16
  if (state.secondaryContent) {
19
17
  state.secondaryContent.className = mergeClasses(menuItemRadioClassNames.secondaryContent, state.secondaryContent.className);
20
18
  }
21
-
22
19
  if (state.icon) {
23
20
  state.icon.className = mergeClasses(menuItemRadioClassNames.icon, state.icon.className);
24
21
  }
25
-
26
22
  if (state.checkmark) {
27
23
  state.checkmark.className = mergeClasses(menuItemRadioClassNames.checkmark, state.checkmark.className);
28
24
  }
29
-
30
25
  useMenuItemStyles_unstable(state);
31
26
  useCheckmarkStyles_unstable(state);
32
27
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuItemRadio/useMenuItemRadioStyles.ts"],"names":[],"mappings":"AAAA,SAAS,YAAT,QAA6B,gBAA7B;AACA,SAAS,2BAAT,QAA4C,wBAA5C;AACA,SAAS,0BAAT,QAA2C,+BAA3C;AAKA,OAAO,MAAM,uBAAuB,GAA4D;EAC9F,IAAI,EAAE,mBADwF;EAE9F,IAAI,EAAE,yBAFwF;EAG9F,SAAS,EAAE,8BAHmF;EAI9F,OAAO,EAAE,4BAJqF;EAK9F,gBAAgB,EAAE;AAL4E,CAAzF;AAQP,OAAO,MAAM,+BAA+B,GAAI,KAAD,IAA8B;EAC3E,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,uBAAuB,CAAC,IAAzB,EAA+B,KAAK,CAAC,IAAN,CAAW,SAA1C,CAAnC;;EAEA,IAAI,KAAK,CAAC,OAAV,EAAmB;IACjB,KAAK,CAAC,OAAN,CAAc,SAAd,GAA0B,YAAY,CAAC,uBAAuB,CAAC,OAAzB,EAAkC,KAAK,CAAC,OAAN,CAAc,SAAhD,CAAtC;EACD;;EAED,IAAI,KAAK,CAAC,gBAAV,EAA4B;IAC1B,KAAK,CAAC,gBAAN,CAAuB,SAAvB,GAAmC,YAAY,CAC7C,uBAAuB,CAAC,gBADqB,EAE7C,KAAK,CAAC,gBAAN,CAAuB,SAFsB,CAA/C;EAID;;EAED,IAAI,KAAK,CAAC,IAAV,EAAgB;IACd,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,uBAAuB,CAAC,IAAzB,EAA+B,KAAK,CAAC,IAAN,CAAW,SAA1C,CAAnC;EACD;;EAED,IAAI,KAAK,CAAC,SAAV,EAAqB;IACnB,KAAK,CAAC,SAAN,CAAgB,SAAhB,GAA4B,YAAY,CAAC,uBAAuB,CAAC,SAAzB,EAAoC,KAAK,CAAC,SAAN,CAAgB,SAApD,CAAxC;EACD;;EAED,0BAA0B,CAAC,KAAD,CAA1B;EACA,2BAA2B,CAAC,KAAD,CAA3B;AACD,CAxBM","sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport { useCheckmarkStyles_unstable } from '../../selectable/index';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuItemSlots } from '../index';\nimport type { MenuItemRadioState } from './MenuItemRadio.types';\n\nexport const menuItemRadioClassNames: SlotClassNames<Omit<MenuItemSlots, 'submenuIndicator'>> = {\n root: 'fui-MenuItemRadio',\n icon: 'fui-MenuItemRadio__icon',\n checkmark: 'fui-MenuItemRadio__checkmark',\n content: 'fui-MenuItemRadio__content',\n secondaryContent: 'fui-MenuItemRadio__secondaryContent',\n};\n\nexport const useMenuItemRadioStyles_unstable = (state: MenuItemRadioState) => {\n state.root.className = mergeClasses(menuItemRadioClassNames.root, state.root.className);\n\n if (state.content) {\n state.content.className = mergeClasses(menuItemRadioClassNames.content, state.content.className);\n }\n\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(\n menuItemRadioClassNames.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(menuItemRadioClassNames.icon, state.icon.className);\n }\n\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(menuItemRadioClassNames.checkmark, state.checkmark.className);\n }\n\n useMenuItemStyles_unstable(state);\n useCheckmarkStyles_unstable(state);\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,SAASA,YAAY,QAAQ,gBAAgB;AAC7C,SAASC,2BAA2B,QAAQ,wBAAwB;AACpE,SAASC,0BAA0B,QAAQ,+BAA+B;AAK1E,OAAO,MAAMC,uBAAuB,GAA4D;EAC9FC,IAAI,EAAE,mBAAmB;EACzBC,IAAI,EAAE,yBAAyB;EAC/BC,SAAS,EAAE,8BAA8B;EACzCC,OAAO,EAAE,4BAA4B;EACrCC,gBAAgB,EAAE;CACnB;AAED,OAAO,MAAMC,+BAA+B,GAAIC,KAAyB,IAAI;EAC3EA,KAAK,CAACN,IAAI,CAACO,SAAS,GAAGX,YAAY,CAACG,uBAAuB,CAACC,IAAI,EAAEM,KAAK,CAACN,IAAI,CAACO,SAAS,CAAC;EAEvF,IAAID,KAAK,CAACH,OAAO,EAAE;IACjBG,KAAK,CAACH,OAAO,CAACI,SAAS,GAAGX,YAAY,CAACG,uBAAuB,CAACI,OAAO,EAAEG,KAAK,CAACH,OAAO,CAACI,SAAS,CAAC;;EAGlG,IAAID,KAAK,CAACF,gBAAgB,EAAE;IAC1BE,KAAK,CAACF,gBAAgB,CAACG,SAAS,GAAGX,YAAY,CAC7CG,uBAAuB,CAACK,gBAAgB,EACxCE,KAAK,CAACF,gBAAgB,CAACG,SAAS,CACjC;;EAGH,IAAID,KAAK,CAACL,IAAI,EAAE;IACdK,KAAK,CAACL,IAAI,CAACM,SAAS,GAAGX,YAAY,CAACG,uBAAuB,CAACE,IAAI,EAAEK,KAAK,CAACL,IAAI,CAACM,SAAS,CAAC;;EAGzF,IAAID,KAAK,CAACJ,SAAS,EAAE;IACnBI,KAAK,CAACJ,SAAS,CAACK,SAAS,GAAGX,YAAY,CAACG,uBAAuB,CAACG,SAAS,EAAEI,KAAK,CAACJ,SAAS,CAACK,SAAS,CAAC;;EAGxGT,0BAA0B,CAACQ,KAAK,CAAC;EACjCT,2BAA2B,CAACS,KAAK,CAAC;AACpC,CAAC","names":["mergeClasses","useCheckmarkStyles_unstable","useMenuItemStyles_unstable","menuItemRadioClassNames","root","icon","checkmark","content","secondaryContent","useMenuItemRadioStyles_unstable","state","className"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuItemRadio/useMenuItemRadioStyles.ts"],"sourcesContent":["import { mergeClasses } from '@griffel/react';\nimport { useCheckmarkStyles_unstable } from '../../selectable/index';\nimport { useMenuItemStyles_unstable } from '../MenuItem/useMenuItemStyles';\nimport type { SlotClassNames } from '@fluentui/react-utilities';\nimport type { MenuItemSlots } from '../index';\nimport type { MenuItemRadioState } from './MenuItemRadio.types';\n\nexport const menuItemRadioClassNames: SlotClassNames<Omit<MenuItemSlots, 'submenuIndicator'>> = {\n root: 'fui-MenuItemRadio',\n icon: 'fui-MenuItemRadio__icon',\n checkmark: 'fui-MenuItemRadio__checkmark',\n content: 'fui-MenuItemRadio__content',\n secondaryContent: 'fui-MenuItemRadio__secondaryContent',\n};\n\nexport const useMenuItemRadioStyles_unstable = (state: MenuItemRadioState) => {\n state.root.className = mergeClasses(menuItemRadioClassNames.root, state.root.className);\n\n if (state.content) {\n state.content.className = mergeClasses(menuItemRadioClassNames.content, state.content.className);\n }\n\n if (state.secondaryContent) {\n state.secondaryContent.className = mergeClasses(\n menuItemRadioClassNames.secondaryContent,\n state.secondaryContent.className,\n );\n }\n\n if (state.icon) {\n state.icon.className = mergeClasses(menuItemRadioClassNames.icon, state.icon.className);\n }\n\n if (state.checkmark) {\n state.checkmark.className = mergeClasses(menuItemRadioClassNames.checkmark, state.checkmark.className);\n }\n\n useMenuItemStyles_unstable(state);\n useCheckmarkStyles_unstable(state);\n};\n"]}
@@ -6,7 +6,6 @@ import { useMenuListStyles_unstable } from './useMenuListStyles';
6
6
  /**
7
7
  * Define a styled MenuList, using the `useMenuList_unstable` hook.
8
8
  */
9
-
10
9
  export const MenuList = /*#__PURE__*/React.forwardRef((props, ref) => {
11
10
  const state = useMenuList_unstable(props, ref);
12
11
  const contextValues = useMenuListContextValues_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuList/MenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,oBAAT,QAAqC,eAArC;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,iCAAT,QAAkD,4BAAlD;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAIA;;AAEG;;AACH,OAAO,MAAM,QAAQ,gBAAuC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAC1F,MAAM,KAAK,GAAG,oBAAoB,CAAC,KAAD,EAAQ,GAAR,CAAlC;EACA,MAAM,aAAa,GAAG,iCAAiC,CAAC,KAAD,CAAvD;EACA,0BAA0B,CAAC,KAAD,CAA1B;EAEA,OAAO,uBAAuB,CAAC,KAAD,EAAQ,aAAR,CAA9B;AACD,CAN2D,CAArD;AAQP,QAAQ,CAAC,WAAT,GAAuB,UAAvB","sourcesContent":["import * as React from 'react';\nimport { useMenuList_unstable } from './useMenuList';\nimport { renderMenuList_unstable } from './renderMenuList';\nimport { useMenuListContextValues_unstable } from './useMenuListContextValues';\nimport { useMenuListStyles_unstable } from './useMenuListStyles';\nimport type { MenuListProps } from './MenuList.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled MenuList, using the `useMenuList_unstable` hook.\n */\nexport const MenuList: ForwardRefComponent<MenuListProps> = React.forwardRef((props, ref) => {\n const state = useMenuList_unstable(props, ref);\n const contextValues = useMenuListContextValues_unstable(state);\n useMenuListStyles_unstable(state);\n\n return renderMenuList_unstable(state, contextValues);\n});\n\nMenuList.displayName = 'MenuList';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,oBAAoB,QAAQ,eAAe;AACpD,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,SAASC,iCAAiC,QAAQ,4BAA4B;AAC9E,SAASC,0BAA0B,QAAQ,qBAAqB;AAIhE;;;AAGA,OAAO,MAAMC,QAAQ,gBAAuCL,KAAK,CAACM,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAC1F,MAAMC,KAAK,GAAGR,oBAAoB,CAACM,KAAK,EAAEC,GAAG,CAAC;EAC9C,MAAME,aAAa,GAAGP,iCAAiC,CAACM,KAAK,CAAC;EAC9DL,0BAA0B,CAACK,KAAK,CAAC;EAEjC,OAAOP,uBAAuB,CAACO,KAAK,EAAEC,aAAa,CAAC;AACtD,CAAC,CAAC;AAEFL,QAAQ,CAACM,WAAW,GAAG,UAAU","names":["React","useMenuList_unstable","renderMenuList_unstable","useMenuListContextValues_unstable","useMenuListStyles_unstable","MenuList","forwardRef","props","ref","state","contextValues","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuList/MenuList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuList_unstable } from './useMenuList';\nimport { renderMenuList_unstable } from './renderMenuList';\nimport { useMenuListContextValues_unstable } from './useMenuListContextValues';\nimport { useMenuListStyles_unstable } from './useMenuListStyles';\nimport type { MenuListProps } from './MenuList.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Define a styled MenuList, using the `useMenuList_unstable` hook.\n */\nexport const MenuList: ForwardRefComponent<MenuListProps> = React.forwardRef((props, ref) => {\n const state = useMenuList_unstable(props, ref);\n const contextValues = useMenuListContextValues_unstable(state);\n useMenuListStyles_unstable(state);\n\n return renderMenuList_unstable(state, contextValues);\n});\n\nMenuList.displayName = 'MenuList';\n"]}
@@ -4,7 +4,6 @@ import { MenuListProvider } from '../../contexts/menuListContext';
4
4
  /**
5
5
  * Function that renders the final JSX of the component
6
6
  */
7
-
8
7
  export const renderMenuList_unstable = (state, contextValues) => {
9
8
  const {
10
9
  slots,
@@ -12,7 +11,8 @@ export const renderMenuList_unstable = (state, contextValues) => {
12
11
  } = getSlots(state);
13
12
  return /*#__PURE__*/React.createElement(MenuListProvider, {
14
13
  value: contextValues.menuList
15
- }, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
14
+ }, /*#__PURE__*/React.createElement(slots.root, {
15
+ ...slotProps.root
16
16
  }));
17
17
  };
18
18
  //# sourceMappingURL=renderMenuList.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuList/renderMenuList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,gBAAT,QAAiC,gCAAjC;AAEA;;AAEG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAAuB,aAAvB,KAA+D;EACpG,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAgB,KAAhB,CAArC;EAEA,oBACE,KAAA,CAAA,aAAA,CAAC,gBAAD,EAAiB;IAAC,KAAK,EAAE,aAAa,CAAC;EAAtB,CAAjB,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuListContextValues, MenuListSlots, MenuListState } from './MenuList.types';\nimport { MenuListProvider } from '../../contexts/menuListContext';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderMenuList_unstable = (state: MenuListState, contextValues: MenuListContextValues) => {\n const { slots, slotProps } = getSlots<MenuListSlots>(state);\n\n return (\n <MenuListProvider value={contextValues.menuList}>\n <slots.root {...slotProps.root} />\n </MenuListProvider>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE;;;AAGA,OAAO,MAAMC,uBAAuB,GAAG,CAACC,KAAoB,EAAEC,aAAoC,KAAI;EACpG,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGN,QAAQ,CAAgBG,KAAK,CAAC;EAE3D,oBACEJ,oBAACE,gBAAgB;IAACM,KAAK,EAAEH,aAAa,CAACI;EAAQ,gBAC7CT,oBAACM,KAAK,CAACI,IAAI;IAAA,GAAKH,SAAS,CAACG;EAAI,EAAI,CACjB;AAEvB,CAAC","names":["React","getSlots","MenuListProvider","renderMenuList_unstable","state","contextValues","slots","slotProps","value","menuList","root"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuList/renderMenuList.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuListContextValues, MenuListSlots, MenuListState } from './MenuList.types';\nimport { MenuListProvider } from '../../contexts/menuListContext';\n\n/**\n * Function that renders the final JSX of the component\n */\nexport const renderMenuList_unstable = (state: MenuListState, contextValues: MenuListContextValues) => {\n const { slots, slotProps } = getSlots<MenuListSlots>(state);\n\n return (\n <MenuListProvider value={contextValues.menuList}>\n <slots.root {...slotProps.root} />\n </MenuListProvider>\n );\n};\n"]}
@@ -7,7 +7,6 @@ import { MenuContext } from '../../contexts/menuContext';
7
7
  /**
8
8
  * Returns the props and state required to render the component
9
9
  */
10
-
11
10
  export const useMenuList_unstable = (props, ref) => {
12
11
  const focusAttributes = useArrowNavigationGroup({
13
12
  circular: true,
@@ -20,54 +19,43 @@ export const useMenuList_unstable = (props, ref) => {
20
19
  } = useFocusFinders();
21
20
  const menuContext = useMenuContextSelectors();
22
21
  const hasMenuContext = useHasParentContext(MenuContext);
23
-
24
22
  if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {
25
23
  // TODO throw warnings in development safely
26
24
  // eslint-disable-next-line no-console
27
25
  console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');
28
26
  }
29
-
30
27
  const innerRef = React.useRef(null);
31
28
  const setFocusByFirstCharacter = React.useCallback((e, itemEl) => {
32
29
  // TODO use some kind of children registration to reduce dependency on DOM roles
33
30
  const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];
34
-
35
31
  if (!innerRef.current) {
36
32
  return;
37
33
  }
38
-
39
34
  const menuItems = findAllFocusable(innerRef.current, el => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')) !== -1);
40
35
  let startIndex = menuItems.indexOf(itemEl) + 1;
41
-
42
36
  if (startIndex === menuItems.length) {
43
37
  startIndex = 0;
44
38
  }
45
-
46
39
  const firstChars = menuItems.map(menuItem => {
47
40
  var _a;
48
-
49
41
  return (_a = menuItem.textContent) === null || _a === void 0 ? void 0 : _a.charAt(0).toLowerCase();
50
42
  });
51
43
  const char = e.key.toLowerCase();
52
-
53
44
  const getIndexFirstChars = (start, firstChar) => {
54
45
  for (let i = start; i < firstChars.length; i++) {
55
46
  if (char === firstChars[i]) {
56
47
  return i;
57
48
  }
58
49
  }
59
-
60
50
  return -1;
61
- }; // Check remaining slots in the menu
62
-
63
-
64
- let index = getIndexFirstChars(startIndex, char); // If not found in remaining slots, check from beginning
65
-
51
+ };
52
+ // Check remaining slots in the menu
53
+ let index = getIndexFirstChars(startIndex, char);
54
+ // If not found in remaining slots, check from beginning
66
55
  if (index === -1) {
67
56
  index = getIndexFirstChars(0, char);
68
- } // If match was found...
69
-
70
-
57
+ }
58
+ // If match was found...
71
59
  if (index > -1) {
72
60
  menuItems[index].focus();
73
61
  }
@@ -81,24 +69,24 @@ export const useMenuList_unstable = (props, ref) => {
81
69
  const toggleCheckbox = useEventCallback((e, name, value, checked) => {
82
70
  const checkedItems = (checkedValues === null || checkedValues === void 0 ? void 0 : checkedValues[name]) || [];
83
71
  const newCheckedItems = [...checkedItems];
84
-
85
72
  if (checked) {
86
73
  newCheckedItems.splice(newCheckedItems.indexOf(value), 1);
87
74
  } else {
88
75
  newCheckedItems.push(value);
89
76
  }
90
-
91
77
  handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
92
78
  name,
93
79
  checkedItems: newCheckedItems
94
80
  });
95
- setCheckedValues(s => ({ ...s,
81
+ setCheckedValues(s => ({
82
+ ...s,
96
83
  [name]: newCheckedItems
97
84
  }));
98
85
  });
99
86
  const selectRadio = useEventCallback((e, name, value) => {
100
87
  const newCheckedItems = [value];
101
- setCheckedValues(s => ({ ...s,
88
+ setCheckedValues(s => ({
89
+ ...s,
102
90
  [name]: newCheckedItems
103
91
  }));
104
92
  handleCheckedValueChange === null || handleCheckedValueChange === void 0 ? void 0 : handleCheckedValueChange(e, {
@@ -128,7 +116,6 @@ export const useMenuList_unstable = (props, ref) => {
128
116
  /**
129
117
  * Adds some sugar to fetching multiple context selector values
130
118
  */
131
-
132
119
  const useMenuContextSelectors = () => {
133
120
  const checkedValues = useMenuContext_unstable(context => context.checkedValues);
134
121
  const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);
@@ -146,17 +133,13 @@ const useMenuContextSelectors = () => {
146
133
  /**
147
134
  * Helper function to detect if props and MenuContext values are both used
148
135
  */
149
-
150
-
151
136
  const usingPropsAndMenuContext = (props, contextValue, hasMenuContext) => {
152
137
  let isUsingPropsAndContext = false;
153
-
154
138
  for (const val in contextValue) {
155
139
  if (props[val]) {
156
140
  isUsingPropsAndContext = true;
157
141
  }
158
142
  }
159
-
160
143
  return hasMenuContext && isUsingPropsAndContext;
161
144
  };
162
145
  //# sourceMappingURL=useMenuList.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuList/useMenuList.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SACE,aADF,EAEE,gBAFF,EAGE,oBAHF,EAIE,qBAJF,QAKO,2BALP;AAMA,SAAS,uBAAT,EAAkC,eAAlC,QAAyD,yBAAzD;AACA,SAAS,mBAAT,QAAoC,kCAApC;AACA,SAAS,uBAAT,QAAwC,4BAAxC;AACA,SAAS,WAAT,QAA4B,4BAA5B;AAGA;;AAEG;;AACH,OAAO,MAAM,oBAAoB,GAAG,CAAC,KAAD,EAAuB,GAAvB,KAAqE;EACvG,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAAE,QAAQ,EAAE,IAAZ;IAAkB,oBAAoB,EAAE;MAAE,GAAG,EAAE;IAAP;EAAxC,CAAD,CAA/C;EACA,MAAM;IAAE;EAAF,IAAuB,eAAe,EAA5C;EACA,MAAM,WAAW,GAAG,uBAAuB,EAA3C;EACA,MAAM,cAAc,GAAG,mBAAmB,CAAC,WAAD,CAA1C;;EAEA,IAAI,wBAAwB,CAAC,KAAD,EAAQ,WAAR,EAAqB,cAArB,CAA5B,EAAkE;IAChE;IACA;IACA,OAAO,CAAC,IAAR,CAAa,+FAAb;EACD;;EAED,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAN,CAA0B,IAA1B,CAAjB;EAEA,MAAM,wBAAwB,GAAG,KAAK,CAAC,WAAN,CAC/B,CAAC,CAAD,EAAsC,MAAtC,KAA6D;IAC3D;IACA,MAAM,aAAa,GAAG,CAAC,UAAD,EA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ACA,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,IAAI,OAAO,CAAC,aAApB,CAA7C;EAEA,OAAO;IACL,aADK;IAEL,oBAFK;IAGL,SAHK;IAIL,QAJK;IAKL;EALK,CAAP;AAOD,CAdD;AAgBA;;AAEG;;;AACH,MAAM,wBAAwB,GAAG,CAC/B,KAD+B,EAE/B,YAF+B,EAG/B,cAH+B,KAI7B;EACF,IAAI,sBAAsB,GAAG,KAA7B;;EACA,KAAK,MAAM,GAAX,IAAkB,YAAlB,EAAgC;IAC9B,IAAI,KAAK,CAAC,GAAD,CAAT,EAA4G;MAC1G,sBAAsB,GAAG,IAAzB;IACD;EACF;;EAED,OAAO,cAAc,IAAI,sBAAzB;AACD,CAbD","sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: true } });\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: hasMenuContext ? menuContext.checkedValues : props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange = hasMenuContext ? menuContext.onCheckedValueChange : props.onCheckedValueChange;\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SACEC,aAAa,EACbC,gBAAgB,EAChBC,oBAAoB,EACpBC,qBAAqB,QAChB,2BAA2B;AAClC,SAASC,uBAAuB,EAAEC,eAAe,QAAQ,yBAAyB;AAClF,SAASC,mBAAmB,QAAQ,kCAAkC;AACtE,SAASC,uBAAuB,QAAQ,4BAA4B;AACpE,SAASC,WAAW,QAAQ,4BAA4B;AAGxD;;;AAGA,OAAO,MAAMC,oBAAoB,GAAG,CAACC,KAAoB,EAAEC,GAA2B,KAAmB;EACvG,MA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GACD;AACH,CAAC;AAED;;;AAGA,MAAM1C,uBAAuB,GAAG,MAAK;EACnC,MAAMkC,aAAa,GAAG7C,uBAAuB,CAACqE,OAAO,IAAIA,OAAO,CAACxB,aAAa,CAAC;EAC/E,MAAMO,oBAAoB,GAAGpD,uBAAuB,CAACqE,OAAO,IAAIA,OAAO,CAACjB,oBAAoB,CAAC;EAC7F,MAAMc,SAAS,GAAGlE,uBAAuB,CAACqE,OAAO,IAAIA,OAAO,CAACH,SAAS,CAAC;EACvE,MAAMC,QAAQ,GAAGnE,uBAAuB,CAACqE,OAAO,IAAIA,OAAO,CAACF,QAAQ,CAAC;EACrE,MAAMC,aAAa,GAAGpE,uBAAuB,CAACqE,OAAO,IAAIA,OAAO,CAACD,aAAa,CAAC;EAE/E,OAAO;IACLvB,aAAa;IACbO,oBAAoB;IACpBc,SAAS;IACTC,QAAQ;IACRC;GACD;AACH,CAAC;AAED;;;AAGA,MAAMvD,wBAAwB,GAAG,CAC/BV,KAAoB,EACpBmE,YAAwD,EACxD1D,cAAuB,KACrB;EACF,IAAI2D,sBAAsB,GAAG,KAAK;EAClC,KAAK,MAAMC,GAAG,IAAIF,YAAY,EAAE;IAC9B,IAAInE,KAAK,CAACqE,GAA+F,CAAC,EAAE;MAC1GD,sBAAsB,GAAG,IAAI;;;EAIjC,OAAO3D,cAAc,IAAI2D,sBAAsB;AACjD,CAAC","names":["React","useMergedRefs","useEventCallback","useControllableState","getNativeElementProps","useArrowNavigationGroup","useFocusFinders","useHasParentContext","useMenuContext_unstable","MenuContext","useMenuList_unstable","props","ref","focusAttributes","circular","ignoreDefaultKeydown","Tab","findAllFocusable","menuContext","useMenuContextSelectors","hasMenuContext","usingPropsAndMenuContext","console","warn","innerRef","useRef","setFocusByFirstCharacter","useCallback","e","itemEl","acceptedRoles","current","menuItems","el","hasAttribute","indexOf","getAttribute","startIndex","length","firstChars","map","menuItem","textContent","charAt","toLowerCase","char","key","getIndexFirstChars","start","firstChar","i","index","focus","checkedValues","setCheckedValues","state","defaultState","defaultCheckedValues","initialState","handleCheckedValueChange","onCheckedValueChange","toggleCheckbox","name","value","checked","checkedItems","newCheckedItems","splice","push","s","selectRadio","components","root","role","triggerId","hasIcons","hasCheckmarks","context","contextValue","isUsingPropsAndContext","val"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuList/useMenuList.ts"],"sourcesContent":["import * as React from 'react';\nimport {\n useMergedRefs,\n useEventCallback,\n useControllableState,\n getNativeElementProps,\n} from '@fluentui/react-utilities';\nimport { useArrowNavigationGroup, useFocusFinders } from '@fluentui/react-tabster';\nimport { useHasParentContext } from '@fluentui/react-context-selector';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MenuContext } from '../../contexts/menuContext';\nimport type { MenuListProps, MenuListState } from './MenuList.types';\n\n/**\n * Returns the props and state required to render the component\n */\nexport const useMenuList_unstable = (props: MenuListProps, ref: React.Ref<HTMLElement>): MenuListState => {\n const focusAttributes = useArrowNavigationGroup({ circular: true, ignoreDefaultKeydown: { Tab: true } });\n const { findAllFocusable } = useFocusFinders();\n const menuContext = useMenuContextSelectors();\n const hasMenuContext = useHasParentContext(MenuContext);\n\n if (usingPropsAndMenuContext(props, menuContext, hasMenuContext)) {\n // TODO throw warnings in development safely\n // eslint-disable-next-line no-console\n console.warn('You are using both MenuList and Menu props, we recommend you to use Menu props when available');\n }\n\n const innerRef = React.useRef<HTMLElement>(null);\n\n const setFocusByFirstCharacter = React.useCallback(\n (e: React.KeyboardEvent<HTMLElement>, itemEl: HTMLElement) => {\n // TODO use some kind of children registration to reduce dependency on DOM roles\n const acceptedRoles = ['menuitem', 'menuitemcheckbox', 'menuitemradio'];\n if (!innerRef.current) {\n return;\n }\n\n const menuItems = findAllFocusable(\n innerRef.current,\n (el: HTMLElement) => el.hasAttribute('role') && acceptedRoles.indexOf(el.getAttribute('role')!) !== -1,\n );\n\n let startIndex = menuItems.indexOf(itemEl) + 1;\n if (startIndex === menuItems.length) {\n startIndex = 0;\n }\n\n const firstChars = menuItems.map(menuItem => menuItem.textContent?.charAt(0).toLowerCase());\n const char = e.key.toLowerCase();\n\n const getIndexFirstChars = (start: number, firstChar: string) => {\n for (let i = start; i < firstChars.length; i++) {\n if (char === firstChars[i]) {\n return i;\n }\n }\n return -1;\n };\n\n // Check remaining slots in the menu\n let index = getIndexFirstChars(startIndex, char);\n\n // If not found in remaining slots, check from beginning\n if (index === -1) {\n index = getIndexFirstChars(0, char);\n }\n\n // If match was found...\n if (index > -1) {\n menuItems[index].focus();\n }\n },\n [findAllFocusable],\n );\n\n const [checkedValues, setCheckedValues] = useControllableState({\n state: hasMenuContext ? menuContext.checkedValues : props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n\n const handleCheckedValueChange = hasMenuContext ? menuContext.onCheckedValueChange : props.onCheckedValueChange;\n\n const toggleCheckbox = useEventCallback(\n (e: React.MouseEvent | React.KeyboardEvent, name: string, value: string, checked: boolean) => {\n const checkedItems = checkedValues?.[name] || [];\n const newCheckedItems = [...checkedItems];\n if (checked) {\n newCheckedItems.splice(newCheckedItems.indexOf(value), 1);\n } else {\n newCheckedItems.push(value);\n }\n\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n },\n );\n\n const selectRadio = useEventCallback((e: React.MouseEvent | React.KeyboardEvent, name: string, value: string) => {\n const newCheckedItems = [value];\n setCheckedValues(s => ({ ...s, [name]: newCheckedItems }));\n handleCheckedValueChange?.(e, { name, checkedItems: newCheckedItems });\n });\n\n return {\n components: {\n root: 'div',\n },\n root: getNativeElementProps('div', {\n ref: useMergedRefs(ref, innerRef),\n role: 'menu',\n 'aria-labelledby': menuContext.triggerId,\n ...focusAttributes,\n ...props,\n }),\n hasIcons: menuContext.hasIcons || false,\n hasCheckmarks: menuContext.hasCheckmarks || false,\n checkedValues,\n setFocusByFirstCharacter,\n selectRadio,\n toggleCheckbox,\n };\n};\n\n/**\n * Adds some sugar to fetching multiple context selector values\n */\nconst useMenuContextSelectors = () => {\n const checkedValues = useMenuContext_unstable(context => context.checkedValues);\n const onCheckedValueChange = useMenuContext_unstable(context => context.onCheckedValueChange);\n const triggerId = useMenuContext_unstable(context => context.triggerId);\n const hasIcons = useMenuContext_unstable(context => context.hasIcons);\n const hasCheckmarks = useMenuContext_unstable(context => context.hasCheckmarks);\n\n return {\n checkedValues,\n onCheckedValueChange,\n triggerId,\n hasIcons,\n hasCheckmarks,\n };\n};\n\n/**\n * Helper function to detect if props and MenuContext values are both used\n */\nconst usingPropsAndMenuContext = (\n props: MenuListProps,\n contextValue: ReturnType<typeof useMenuContextSelectors>,\n hasMenuContext: boolean,\n) => {\n let isUsingPropsAndContext = false;\n for (const val in contextValue) {\n if (props[val as keyof Omit<typeof contextValue, 'hasMenuContext' | 'onCheckedValueChange' | 'triggerId'>]) {\n isUsingPropsAndContext = true;\n }\n }\n\n return hasMenuContext && isUsingPropsAndContext;\n};\n"]}
@@ -6,8 +6,8 @@ export function useMenuListContextValues_unstable(state) {
6
6
  selectRadio,
7
7
  setFocusByFirstCharacter,
8
8
  toggleCheckbox
9
- } = state; // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
10
-
9
+ } = state;
10
+ // This context is created with "@fluentui/react-context-selector", these is no sense to memoize it
11
11
  const menuList = {
12
12
  checkedValues,
13
13
  hasCheckmarks,
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuList/useMenuListContextValues.ts"],"names":[],"mappings":"AAEA,OAAM,SAAU,iCAAV,CAA4C,KAA5C,EAAgE;EACpE,MAAM;IAAE,aAAF;IAAiB,aAAjB;IAAgC,QAAhC;IAA0C,WAA1C;IAAuD,wBAAvD;IAAiF;EAAjF,IAAoG,KAA1G,CADoE,CAGpE;;EACA,MAAM,QAAQ,GAAG;IACf,aADe;IAEf,aAFe;IAGf,QAHe;IAIf,WAJe;IAKf,wBALe;IAMf;EANe,CAAjB;EASA,OAAO;IAAE;EAAF,CAAP;AACD","sourcesContent":["import type { MenuListContextValues, MenuListState } from './MenuList.types';\n\nexport function useMenuListContextValues_unstable(state: MenuListState): MenuListContextValues {\n const { checkedValues, hasCheckmarks, hasIcons, selectRadio, setFocusByFirstCharacter, toggleCheckbox } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox,\n };\n\n return { menuList };\n}\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAEA,OAAM,SAAUA,iCAAiC,CAACC,KAAoB;EACpE,MAAM;IAAEC,aAAa;IAAEC,aAAa;IAAEC,QAAQ;IAAEC,WAAW;IAAEC,wBAAwB;IAAEC;EAAc,CAAE,GAAGN,KAAK;EAE/G;EACA,MAAMO,QAAQ,GAAG;IACfN,aAAa;IACbC,aAAa;IACbC,QAAQ;IACRC,WAAW;IACXC,wBAAwB;IACxBC;GACD;EAED,OAAO;IAAEC;EAAQ,CAAE;AACrB","names":["useMenuListContextValues_unstable","state","checkedValues","hasCheckmarks","hasIcons","selectRadio","setFocusByFirstCharacter","toggleCheckbox","menuList"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuList/useMenuListContextValues.ts"],"sourcesContent":["import type { MenuListContextValues, MenuListState } from './MenuList.types';\n\nexport function useMenuListContextValues_unstable(state: MenuListState): MenuListContextValues {\n const { checkedValues, hasCheckmarks, hasIcons, selectRadio, setFocusByFirstCharacter, toggleCheckbox } = state;\n\n // This context is created with \"@fluentui/react-context-selector\", these is no sense to memoize it\n const menuList = {\n checkedValues,\n hasCheckmarks,\n hasIcons,\n selectRadio,\n setFocusByFirstCharacter,\n toggleCheckbox,\n };\n\n return { menuList };\n}\n"]}
@@ -2,22 +2,19 @@ import { mergeClasses, __styles, shorthands } from '@griffel/react';
2
2
  export const menuListClassNames = {
3
3
  root: 'fui-MenuList'
4
4
  };
5
-
6
5
  const useStyles = /*#__PURE__*/__styles({
7
- "root": {
8
- "mc9l5x": "f22iagw",
9
- "Beiy3e4": "f1vx9l62",
10
- "i8kkvl": "f16mnhsx",
11
- "Belr9w4": "fbi42co"
6
+ root: {
7
+ mc9l5x: "f22iagw",
8
+ Beiy3e4: "f1vx9l62",
9
+ i8kkvl: "f16mnhsx",
10
+ Belr9w4: "fbi42co"
12
11
  }
13
12
  }, {
14
- "d": [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f16mnhsx{-webkit-column-gap:2px;column-gap:2px;}", ".fbi42co{row-gap:2px;}"]
13
+ d: [".f22iagw{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", ".f1vx9l62{-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}", ".f16mnhsx{-webkit-column-gap:2px;column-gap:2px;}", ".fbi42co{row-gap:2px;}"]
15
14
  });
16
15
  /**
17
16
  * Apply styling to the Menu slots based on the state
18
17
  */
19
-
20
-
21
18
  export const useMenuListStyles_unstable = state => {
22
19
  const styles = useStyles();
23
20
  state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuList/useMenuListStyles.ts"],"names":[],"mappings":"AACA,SAAS,YAAT,YAAmC,UAAnC,QAAqD,gBAArD;AAGA,OAAO,MAAM,kBAAkB,GAAkC;EAC/D,IAAI,EAAE;AADyD,CAA1D;;AAIP,MAAM,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAAlB;AAQA;;AAEG;;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAAwC;EAChF,MAAM,MAAM,GAAG,SAAS,EAAxB;EACA,KAAK,CAAC,IAAN,CAAW,SAAX,GAAuB,YAAY,CAAC,kBAAkB,CAAC,IAApB,EAA0B,MAAM,CAAC,IAAjC,EAAuC,KAAK,CAAC,IAAN,CAAW,SAAlD,CAAnC;EACA,OAAO,KAAP;AACD,CAJM","sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport type { MenuListSlots, MenuListState } from './MenuList.types';\n\nexport const menuListClassNames: SlotClassNames<MenuListSlots> = {\n root: 'fui-MenuList',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.gap('2px'),\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuListStyles_unstable = (state: MenuListState): MenuListState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AACA,SAASA,YAAY,YAAcC,UAAU,QAAQ,gBAAgB;AAGrE,OAAO,MAAMC,kBAAkB,GAAkC;EAC/DC,IAAI,EAAE;CACP;AAED,MAAMC,SAAS,gBAAG;EAAA;IAAA;IAAA;IAAA;IAAA;EAAA;AAAA;EAAA;AAAA,EAMhB;AAEF;;;AAGA,OAAO,MAAMC,0BAA0B,GAAIC,KAAoB,IAAmB;EAChF,MAAMC,MAAM,GAAGH,SAAS,EAAE;EAC1BE,KAAK,CAACH,IAAI,CAACK,SAAS,GAAGR,YAAY,CAACE,kBAAkB,CAACC,IAAI,EAAEI,MAAM,CAACJ,IAAI,EAAEG,KAAK,CAACH,IAAI,CAACK,SAAS,CAAC;EAC/F,OAAOF,KAAK;AACd,CAAC","names":["mergeClasses","shorthands","menuListClassNames","root","useStyles","useMenuListStyles_unstable","state","styles","className"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuList/useMenuListStyles.ts"],"sourcesContent":["import type { SlotClassNames } from '@fluentui/react-utilities';\nimport { mergeClasses, makeStyles, shorthands } from '@griffel/react';\nimport type { MenuListSlots, MenuListState } from './MenuList.types';\n\nexport const menuListClassNames: SlotClassNames<MenuListSlots> = {\n root: 'fui-MenuList',\n};\n\nconst useStyles = makeStyles({\n root: {\n display: 'flex',\n flexDirection: 'column',\n ...shorthands.gap('2px'),\n },\n});\n\n/**\n * Apply styling to the Menu slots based on the state\n */\nexport const useMenuListStyles_unstable = (state: MenuListState): MenuListState => {\n const styles = useStyles();\n state.root.className = mergeClasses(menuListClassNames.root, styles.root, state.root.className);\n return state;\n};\n"]}
@@ -5,7 +5,6 @@ import { renderMenuPopover_unstable } from './renderMenuPopover';
5
5
  /**
6
6
  * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus
7
7
  */
8
-
9
8
  export const MenuPopover = /*#__PURE__*/React.forwardRef((props, ref) => {
10
9
  const state = useMenuPopover_unstable(props, ref);
11
10
  useMenuPopoverStyles_unstable(state);
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuPopover/MenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,6BAAT,QAA8C,wBAA9C;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAIA;;AAEG;;AACH,OAAO,MAAM,WAAW,gBAA0C,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;EAChG,MAAM,KAAK,GAAG,uBAAuB,CAAC,KAAD,EAAQ,GAAR,CAArC;EAEA,6BAA6B,CAAC,KAAD,CAA7B;EACA,OAAO,0BAA0B,CAAC,KAAD,CAAjC;AACD,CALiE,CAA3D;AAOP,WAAW,CAAC,WAAZ,GAA0B,aAA1B","sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport type { MenuPopoverProps } from './MenuPopover.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover: ForwardRefComponent<MenuPopoverProps> = React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n\n useMenuPopoverStyles_unstable(state);\n return renderMenuPopover_unstable(state);\n});\n\nMenuPopover.displayName = 'MenuPopover';\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,uBAAuB,QAAQ,kBAAkB;AAC1D,SAASC,6BAA6B,QAAQ,wBAAwB;AACtE,SAASC,0BAA0B,QAAQ,qBAAqB;AAIhE;;;AAGA,OAAO,MAAMC,WAAW,gBAA0CJ,KAAK,CAACK,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAI;EAChG,MAAMC,KAAK,GAAGP,uBAAuB,CAACK,KAAK,EAAEC,GAAG,CAAC;EAEjDL,6BAA6B,CAACM,KAAK,CAAC;EACpC,OAAOL,0BAA0B,CAACK,KAAK,CAAC;AAC1C,CAAC,CAAC;AAEFJ,WAAW,CAACK,WAAW,GAAG,aAAa","names":["React","useMenuPopover_unstable","useMenuPopoverStyles_unstable","renderMenuPopover_unstable","MenuPopover","forwardRef","props","ref","state","displayName"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuPopover/MenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { useMenuPopover_unstable } from './useMenuPopover';\nimport { useMenuPopoverStyles_unstable } from './useMenuPopoverStyles';\nimport { renderMenuPopover_unstable } from './renderMenuPopover';\nimport type { MenuPopoverProps } from './MenuPopover.types';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\n\n/**\n * Popover intended to wrap `MenuList` and adds styling and interaction support specific to menus\n */\nexport const MenuPopover: ForwardRefComponent<MenuPopoverProps> = React.forwardRef((props, ref) => {\n const state = useMenuPopover_unstable(props, ref);\n\n useMenuPopoverStyles_unstable(state);\n return renderMenuPopover_unstable(state);\n});\n\nMenuPopover.displayName = 'MenuPopover';\n"]}
@@ -4,19 +4,18 @@ import { Portal } from '@fluentui/react-portal';
4
4
  /**
5
5
  * Render the final JSX of MenuPopover
6
6
  */
7
-
8
7
  export const renderMenuPopover_unstable = state => {
9
8
  const {
10
9
  slots,
11
10
  slotProps
12
11
  } = getSlots(state);
13
-
14
12
  if (state.inline) {
15
- return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
13
+ return /*#__PURE__*/React.createElement(slots.root, {
14
+ ...slotProps.root
16
15
  });
17
16
  }
18
-
19
- return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
17
+ return /*#__PURE__*/React.createElement(Portal, null, /*#__PURE__*/React.createElement(slots.root, {
18
+ ...slotProps.root
20
19
  }));
21
20
  };
22
21
  //# sourceMappingURL=renderMenuPopover.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuPopover/renderMenuPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAEA,SAAS,MAAT,QAAuB,wBAAvB;AAEA;;AAEG;;AACH,OAAO,MAAM,0BAA0B,GAAI,KAAD,IAA4B;EACpE,MAAM;IAAE,KAAF;IAAS;EAAT,IAAuB,QAAQ,CAAmB,KAAnB,CAArC;;EAEA,IAAI,KAAK,CAAC,MAAV,EAAkB;IAChB,oBAAO,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;IAAf,CAAX,CAAP;EACD;;EAED,oBACE,KAAA,CAAA,aAAA,CAAC,MAAD,EAAO,IAAP,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;EAAf,CAAX,CADF,CADF;AAKD,CAZM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = (state: MenuPopoverState) => {\n const { slots, slotProps } = getSlots<MenuPopoverSlots>(state);\n\n if (state.inline) {\n return <slots.root {...slotProps.root} />;\n }\n\n return (\n <Portal>\n <slots.root {...slotProps.root} />\n </Portal>\n );\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,QAAQ,QAAQ,2BAA2B;AAEpD,SAASC,MAAM,QAAQ,wBAAwB;AAE/C;;;AAGA,OAAO,MAAMC,0BAA0B,GAAIC,KAAuB,IAAI;EACpE,MAAM;IAAEC,KAAK;IAAEC;EAAS,CAAE,GAAGL,QAAQ,CAAmBG,KAAK,CAAC;EAE9D,IAAIA,KAAK,CAACG,MAAM,EAAE;IAChB,oBAAOP,oBAACK,KAAK,CAACG,IAAI;MAAA,GAAKF,SAAS,CAACE;IAAI,EAAI;;EAG3C,oBACER,oBAACE,MAAM,qBACLF,oBAACK,KAAK,CAACG,IAAI;IAAA,GAAKF,SAAS,CAACE;EAAI,EAAI,CAC3B;AAEb,CAAC","names":["React","getSlots","Portal","renderMenuPopover_unstable","state","slots","slotProps","inline","root"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuPopover/renderMenuPopover.tsx"],"sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport { MenuPopoverSlots, MenuPopoverState } from './MenuPopover.types';\nimport { Portal } from '@fluentui/react-portal';\n\n/**\n * Render the final JSX of MenuPopover\n */\nexport const renderMenuPopover_unstable = (state: MenuPopoverState) => {\n const { slots, slotProps } = getSlots<MenuPopoverSlots>(state);\n\n if (state.inline) {\n return <slots.root {...slotProps.root} />;\n }\n\n return (\n <Portal>\n <slots.root {...slotProps.root} />\n </Portal>\n );\n};\n"]}
@@ -14,10 +14,8 @@ import { useIsSubmenu } from '../../utils/useIsSubmenu';
14
14
  * @param props - props from this instance of MenuPopover
15
15
  * @param ref - reference to root HTMLElement of MenuPopover
16
16
  */
17
-
18
17
  export const useMenuPopover_unstable = (props, ref) => {
19
18
  var _a;
20
-
21
19
  const popoverRef = useMenuContext_unstable(context => context.menuPopoverRef);
22
20
  const setOpen = useMenuContext_unstable(context => context.setOpen);
23
21
  const open = useMenuContext_unstable(context => context.open);
@@ -28,9 +26,9 @@ export const useMenuPopover_unstable = (props, ref) => {
28
26
  const {
29
27
  dir
30
28
  } = useFluent();
31
- const CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight; // use DOM listener since react events propagate up the react tree
29
+ const CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight;
30
+ // use DOM listener since react events propagate up the react tree
32
31
  // no need to do `contains` logic as menus are all positioned in different portals
33
-
34
32
  const mouseOverListenerCallbackRef = React.useCallback(node => {
35
33
  if (node) {
36
34
  // Dispatches the custom menu mouse enter event with throttling
@@ -39,9 +37,9 @@ export const useMenuPopover_unstable = (props, ref) => {
39
37
  node.addEventListener('mouseover', e => {
40
38
  if (canDispatchCustomEventRef.current) {
41
39
  canDispatchCustomEventRef.current = false;
42
- dispatchMenuEnterEvent(popoverRef.current, e); // eslint-disable-next-line @typescript-eslint/ban-ts-comment
40
+ dispatchMenuEnterEvent(popoverRef.current, e);
41
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
43
42
  // @ts-ignore #16889 Node setTimeout type leaking
44
-
45
43
  throttleDispatchTimerRef.current = setTimeout(() => canDispatchCustomEventRef.current = true, 250);
46
44
  }
47
45
  });
@@ -69,14 +67,11 @@ export const useMenuPopover_unstable = (props, ref) => {
69
67
  event
70
68
  });
71
69
  }
72
-
73
70
  onMouseEnterOriginal === null || onMouseEnterOriginal === void 0 ? void 0 : onMouseEnterOriginal(event);
74
71
  });
75
72
  rootProps.onKeyDown = useEventCallback(event => {
76
73
  var _a;
77
-
78
74
  const key = event.key;
79
-
80
75
  if (key === Escape || isSubmenu && key === CloseArrowKey) {
81
76
  if (open && ((_a = popoverRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target))) {
82
77
  setOpen(event, {
@@ -84,13 +79,12 @@ export const useMenuPopover_unstable = (props, ref) => {
84
79
  keyboard: true,
85
80
  type: 'menuPopoverKeyDown',
86
81
  event
87
- }); // stop propagation to avoid conflicting with other elements that listen for `Escape`
82
+ });
83
+ // stop propagation to avoid conflicting with other elements that listen for `Escape`
88
84
  // e,g: Dialog, Popover and Tooltip
89
-
90
85
  event.stopPropagation();
91
86
  }
92
87
  }
93
-
94
88
  if (key === Tab) {
95
89
  setOpen(event, {
96
90
  open: false,
@@ -100,7 +94,6 @@ export const useMenuPopover_unstable = (props, ref) => {
100
94
  });
101
95
  event.preventDefault();
102
96
  }
103
-
104
97
  onKeyDownOriginal === null || onKeyDownOriginal === void 0 ? void 0 : onKeyDownOriginal(event);
105
98
  });
106
99
  return {
@@ -1 +1 @@
1
- {"version":3,"sources":["packages/react-components/react-menu/src/components/MenuPopover/useMenuPopover.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,SAAT,EAAoB,GAApB,EAAyB,UAAzB,EAAqC,MAArC,QAAmD,yBAAnD;AACA,SAAS,qBAAT,EAAgC,gBAAhC,EAAkD,aAAlD,QAAuE,2BAAvE;AAEA,SAAS,uBAAT,QAAwC,4BAAxC;AACA,SAAS,sBAAT,QAAuC,mBAAvC;AACA,SAAS,kBAAkB,IAAI,SAA/B,QAAgD,iCAAhD;AACA,SAAS,YAAT,QAA6B,0BAA7B;AAEA;;;;;;;;AAQG;;AACH,OAAO,MAAM,uBAAuB,GAAG,CAAC,KAAD,EAA0B,GAA1B,KAA2E;;;EAChH,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,IAAI,OAAO,CAAC,cAApB,CAA1C;EACA,MAAM,OAAO,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;MACD;IACF;;IAED,IAAI,GAAG,KAAK,GAAZ,EAAiB;MACf,OAAO,CAAC,KAAD,EAAQ;QAAE,IAAI,EAAE,KAAR;QAAe,QAAQ,EAAE,IAAzB;QAA+B,IAAI,EAAE,oBAArC;QAA2D;MAA3D,CAAR,CAAP;MACA,KAAK,CAAC,cAAN;IACD;;IAED,iBAAiB,KAAA,IAAjB,IAAA,iBAAiB,KAAA,KAAA,CAAjB,GAAiB,KAAA,CAAjB,GAAA,iBAAiB,CAAG,KAAH,CAAjB;EACD,CAlBqC,CAAtC;EAoBA,OAAO;IACL,MADK;IAEL,UAAU,EAAE;MACV,IAAI,EAAE;IADI,CAFP;IAKL,IAAI,EAAE;EALD,CAAP;AAOD,CAlFM","sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, Tab, ArrowRight, Escape } from '@fluentui/keyboard-keys';\nimport { getNativeElementProps, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { MenuPopoverProps, MenuPopoverState } from './MenuPopover.types';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { dispatchMenuEnterEvent } from '../../utils/index';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\n\n/**\n * Create the state required to render MenuPopover.\n *\n * The returned state can be modified with hooks such as useMenuPopoverStyles_unstable,\n * before being passed to renderMenuPopover_unstable.\n *\n * @param props - props from this instance of MenuPopover\n * @param ref - reference to root HTMLElement of MenuPopover\n */\nexport const useMenuPopover_unstable = (props: MenuPopoverProps, ref: React.Ref<HTMLElement>): MenuPopoverState => {\n const popoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const isSubmenu = useIsSubmenu();\n const canDispatchCustomEventRef = React.useRef(true);\n const throttleDispatchTimerRef = React.useRef(0);\n\n const { dir } = useFluent();\n const CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight;\n\n // use DOM listener since react events propagate up the react tree\n // no need to do `contains` logic as menus are all positioned in different portals\n const mouseOverListenerCallbackRef = React.useCallback(\n (node: HTMLElement) => {\n if (node) {\n // Dispatches the custom menu mouse enter event with throttling\n // Needs to trigger on mouseover to support keyboard + mouse together\n // i.e. keyboard opens submenus while cursor is still on the parent\n node.addEventListener('mouseover', e => {\n if (canDispatchCustomEventRef.current) {\n canDispatchCustomEventRef.current = false;\n dispatchMenuEnterEvent(popoverRef.current as HTMLElement, e);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore #16889 Node setTimeout type leaking\n throttleDispatchTimerRef.current = setTimeout(() => (canDispatchCustomEventRef.current = true), 250);\n }\n });\n }\n },\n [popoverRef, throttleDispatchTimerRef],\n );\n\n React.useEffect(() => {\n () => clearTimeout(throttleDispatchTimerRef.current);\n }, []);\n\n const inline = useMenuContext_unstable(context => context.inline) ?? false;\n const rootProps = getNativeElementProps('div', {\n role: 'presentation',\n ...props,\n ref: useMergedRefs(ref, popoverRef, mouseOverListenerCallbackRef),\n });\n\n const { onMouseEnter: onMouseEnterOriginal, onKeyDown: onKeyDownOriginal } = rootProps;\n\n rootProps.onMouseEnter = useEventCallback((event: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(event, { open: true, keyboard: false, type: 'menuPopoverMouseEnter', event });\n }\n\n onMouseEnterOriginal?.(event);\n });\n\n rootProps.onKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLElement>) => {\n const key = event.key;\n\n if (key === Escape || (isSubmenu && key === CloseArrowKey)) {\n if (open && popoverRef.current?.contains(event.target as HTMLElement)) {\n setOpen(event, { open: false, keyboard: true, type: 'menuPopoverKeyDown', event });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover and Tooltip\n event.stopPropagation();\n }\n }\n\n if (key === Tab) {\n setOpen(event, { open: false, keyboard: true, type: 'menuPopoverKeyDown', event });\n event.preventDefault();\n }\n\n onKeyDownOriginal?.(event);\n });\n\n return {\n inline,\n components: {\n root: 'div',\n },\n root: rootProps,\n };\n};\n"],"sourceRoot":"../src/"}
1
+ {"version":3,"mappings":"AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,SAASC,SAAS,EAAEC,GAAG,EAAEC,UAAU,EAAEC,MAAM,QAAQ,yBAAyB;AAC5E,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,aAAa,QAAQ,2BAA2B;AAElG,SAASC,uBAAuB,QAAQ,4BAA4B;AACpE,SAASC,sBAAsB,QAAQ,mBAAmB;AAC1D,SAASC,kBAAkB,IAAIC,SAAS,QAAQ,iCAAiC;AACjF,SAASC,YAAY,QAAQ,0BAA0B;AAEvD;;;;;;;;;AASA,OAAO,MAAMC,uBAAuB,GAAG,CAACC,KAAuB,EAAEC,GAA2B,KAAsB;;EAChH,MAAMC,UAAU,GAAGR,uBAAuB,CAACS,OAAO,IAAIA,OAAO,CAACC,cAAc,CAAC;EAC7E,MAAMC,OAAO,GAAGX,uBAAuB,CAACS,OAAO,IAAIA,OAAO,CAACE,OAAO,CAAC;EACnE,MAAMC,IAAI,GAAGZ,uBAAuB,CAACS,OAAO,IAAIA,OAAO,CAACG,IAAI,CAAC;EAC7D,MAAMC,WAAW,GAAGb,uBAAuB,CAACS,OAAO,IAAIA,OAAO,CAACI,WAAW,CAAC;EAC3E,MAAMC,SAAS,GAAGV,YAAY,EAAE;EAChC,MAAMW,yBAAyB,GAAGvB,KAAK,CAACwB,MAAM,CAAC,IAAI,CAAC;EACpD,MAAMC,wBAAwB,GAAGzB,KAAK,CAACwB,MAAM,CAAC,CAAC,CAAC;EAEhD,MAAM;IAAEE;EAAG,CAAE,GAAGf,SAAS,EAAE;EAC3B,MAAMgB,aAAa,GAAGD,GAAG,KAAK,KAAK,GAAGzB,SAAS,GAAGE,UAAU;EAE5D;EACA;EACA,MAAMyB,4BAA4B,GAAG5B,KAA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,CAAGG,KAAK,CAAC;EAC/B,CAAC,CAAC;EAEFN,SAAS,CAACI,SAAS,GAAGpC,gBAAgB,CAAEsC,KAAuC,IAAI;;IACjF,MAAMG,GAAG,GAAGH,KAAK,CAACG,GAAG;IAErB,IAAIA,GAAG,KAAK3C,MAAM,IAAKkB,SAAS,IAAIyB,GAAG,KAAKpB,aAAc,EAAE;MAC1D,IAAIP,IAAI,KAAI,gBAAU,CAACa,OAAO,0CAAEe,QAAQ,CAACJ,KAAK,CAACK,MAAqB,CAAC,GAAE;QACrE9B,OAAO,CAACyB,KAAK,EAAE;UAAExB,IAAI,EAAE,KAAK;UAAEyB,QAAQ,EAAE,IAAI;UAAEC,IAAI,EAAE,oBAAoB;UAAEF;QAAK,CAAE,CAAC;QAClF;QACA;QACAA,KAAK,CAACM,eAAe,EAAE;;;IAI3B,IAAIH,GAAG,KAAK7C,GAAG,EAAE;MACfiB,OAAO,CAACyB,KAAK,EAAE;QAAExB,IAAI,EAAE,KAAK;QAAEyB,QAAQ,EAAE,IAAI;QAAEC,IAAI,EAAE,oBAAoB;QAAEF;MAAK,CAAE,CAAC;MAClFA,KAAK,CAACO,cAAc,EAAE;;IAGxBR,iBAAiB,aAAjBA,iBAAiB,uBAAjBA,iBAAiB,CAAGC,KAAK,CAAC;EAC5B,CAAC,CAAC;EAEF,OAAO;IACLP,MAAM;IACNe,UAAU,EAAE;MACVC,IAAI,EAAE;KACP;IACDA,IAAI,EAAEf;GACP;AACH,CAAC","names":["React","ArrowLeft","Tab","ArrowRight","Escape","getNativeElementProps","useEventCallback","useMergedRefs","useMenuContext_unstable","dispatchMenuEnterEvent","useFluent_unstable","useFluent","useIsSubmenu","useMenuPopover_unstable","props","ref","popoverRef","context","menuPopoverRef","setOpen","open","openOnHover","isSubmenu","canDispatchCustomEventRef","useRef","throttleDispatchTimerRef","dir","CloseArrowKey","mouseOverListenerCallbackRef","useCallback","node","addEventListener","e","current","setTimeout","useEffect","clearTimeout","inline","rootProps","role","onMouseEnter","onMouseEnterOriginal","onKeyDown","onKeyDownOriginal","event","keyboard","type","key","contains","target","stopPropagation","preventDefault","components","root"],"sourceRoot":"../src/","sources":["packages/react-components/react-menu/src/components/MenuPopover/useMenuPopover.ts"],"sourcesContent":["import * as React from 'react';\nimport { ArrowLeft, Tab, ArrowRight, Escape } from '@fluentui/keyboard-keys';\nimport { getNativeElementProps, useEventCallback, useMergedRefs } from '@fluentui/react-utilities';\nimport { MenuPopoverProps, MenuPopoverState } from './MenuPopover.types';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { dispatchMenuEnterEvent } from '../../utils/index';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\n\n/**\n * Create the state required to render MenuPopover.\n *\n * The returned state can be modified with hooks such as useMenuPopoverStyles_unstable,\n * before being passed to renderMenuPopover_unstable.\n *\n * @param props - props from this instance of MenuPopover\n * @param ref - reference to root HTMLElement of MenuPopover\n */\nexport const useMenuPopover_unstable = (props: MenuPopoverProps, ref: React.Ref<HTMLElement>): MenuPopoverState => {\n const popoverRef = useMenuContext_unstable(context => context.menuPopoverRef);\n const setOpen = useMenuContext_unstable(context => context.setOpen);\n const open = useMenuContext_unstable(context => context.open);\n const openOnHover = useMenuContext_unstable(context => context.openOnHover);\n const isSubmenu = useIsSubmenu();\n const canDispatchCustomEventRef = React.useRef(true);\n const throttleDispatchTimerRef = React.useRef(0);\n\n const { dir } = useFluent();\n const CloseArrowKey = dir === 'ltr' ? ArrowLeft : ArrowRight;\n\n // use DOM listener since react events propagate up the react tree\n // no need to do `contains` logic as menus are all positioned in different portals\n const mouseOverListenerCallbackRef = React.useCallback(\n (node: HTMLElement) => {\n if (node) {\n // Dispatches the custom menu mouse enter event with throttling\n // Needs to trigger on mouseover to support keyboard + mouse together\n // i.e. keyboard opens submenus while cursor is still on the parent\n node.addEventListener('mouseover', e => {\n if (canDispatchCustomEventRef.current) {\n canDispatchCustomEventRef.current = false;\n dispatchMenuEnterEvent(popoverRef.current as HTMLElement, e);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore #16889 Node setTimeout type leaking\n throttleDispatchTimerRef.current = setTimeout(() => (canDispatchCustomEventRef.current = true), 250);\n }\n });\n }\n },\n [popoverRef, throttleDispatchTimerRef],\n );\n\n React.useEffect(() => {\n () => clearTimeout(throttleDispatchTimerRef.current);\n }, []);\n\n const inline = useMenuContext_unstable(context => context.inline) ?? false;\n const rootProps = getNativeElementProps('div', {\n role: 'presentation',\n ...props,\n ref: useMergedRefs(ref, popoverRef, mouseOverListenerCallbackRef),\n });\n\n const { onMouseEnter: onMouseEnterOriginal, onKeyDown: onKeyDownOriginal } = rootProps;\n\n rootProps.onMouseEnter = useEventCallback((event: React.MouseEvent<HTMLElement>) => {\n if (openOnHover) {\n setOpen(event, { open: true, keyboard: false, type: 'menuPopoverMouseEnter', event });\n }\n\n onMouseEnterOriginal?.(event);\n });\n\n rootProps.onKeyDown = useEventCallback((event: React.KeyboardEvent<HTMLElement>) => {\n const key = event.key;\n\n if (key === Escape || (isSubmenu && key === CloseArrowKey)) {\n if (open && popoverRef.current?.contains(event.target as HTMLElement)) {\n setOpen(event, { open: false, keyboard: true, type: 'menuPopoverKeyDown', event });\n // stop propagation to avoid conflicting with other elements that listen for `Escape`\n // e,g: Dialog, Popover and Tooltip\n event.stopPropagation();\n }\n }\n\n if (key === Tab) {\n setOpen(event, { open: false, keyboard: true, type: 'menuPopoverKeyDown', event });\n event.preventDefault();\n }\n\n onKeyDownOriginal?.(event);\n });\n\n return {\n inline,\n components: {\n root: 'div',\n },\n root: rootProps,\n };\n};\n"]}