@fluentui/react-menu 9.7.15 → 9.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. package/CHANGELOG.json +147 -1
  2. package/CHANGELOG.md +42 -2
  3. package/lib/Menu.js +0 -1
  4. package/lib/Menu.js.map +1 -1
  5. package/lib/MenuDivider.js +0 -1
  6. package/lib/MenuDivider.js.map +1 -1
  7. package/lib/MenuGroup.js +0 -1
  8. package/lib/MenuGroup.js.map +1 -1
  9. package/lib/MenuGroupHeader.js +0 -1
  10. package/lib/MenuGroupHeader.js.map +1 -1
  11. package/lib/MenuItem.js +0 -1
  12. package/lib/MenuItem.js.map +1 -1
  13. package/lib/MenuItemCheckbox.js +0 -1
  14. package/lib/MenuItemCheckbox.js.map +1 -1
  15. package/lib/MenuItemRadio.js +0 -1
  16. package/lib/MenuItemRadio.js.map +1 -1
  17. package/lib/MenuList.js +0 -1
  18. package/lib/MenuList.js.map +1 -1
  19. package/lib/MenuPopover.js +0 -1
  20. package/lib/MenuPopover.js.map +1 -1
  21. package/lib/MenuSplitGroup.js +0 -1
  22. package/lib/MenuSplitGroup.js.map +1 -1
  23. package/lib/MenuTrigger.js +0 -1
  24. package/lib/MenuTrigger.js.map +1 -1
  25. package/lib/components/Menu/Menu.js +4 -6
  26. package/lib/components/Menu/Menu.js.map +1 -1
  27. package/lib/components/Menu/Menu.types.js +0 -1
  28. package/lib/components/Menu/Menu.types.js.map +1 -1
  29. package/lib/components/Menu/index.js +0 -1
  30. package/lib/components/Menu/index.js.map +1 -1
  31. package/lib/components/Menu/renderMenu.js +4 -6
  32. package/lib/components/Menu/renderMenu.js.map +1 -1
  33. package/lib/components/Menu/useMenu.js +242 -236
  34. package/lib/components/Menu/useMenu.js.map +1 -1
  35. package/lib/components/Menu/useMenuContextValues.js +22 -39
  36. package/lib/components/Menu/useMenuContextValues.js.map +1 -1
  37. package/lib/components/MenuDivider/MenuDivider.js +5 -7
  38. package/lib/components/MenuDivider/MenuDivider.js.map +1 -1
  39. package/lib/components/MenuDivider/MenuDivider.types.js +1 -2
  40. package/lib/components/MenuDivider/MenuDivider.types.js.map +1 -1
  41. package/lib/components/MenuDivider/index.js +0 -1
  42. package/lib/components/MenuDivider/index.js.map +1 -1
  43. package/lib/components/MenuDivider/renderMenuDivider.js +4 -9
  44. package/lib/components/MenuDivider/renderMenuDivider.js.map +1 -1
  45. package/lib/components/MenuDivider/useMenuDivider.js +12 -14
  46. package/lib/components/MenuDivider/useMenuDivider.js.map +1 -1
  47. package/lib/components/MenuDivider/useMenuDividerStyles.styles.js.map +1 -1
  48. package/lib/components/MenuGroup/MenuGroup.js +6 -8
  49. package/lib/components/MenuGroup/MenuGroup.js.map +1 -1
  50. package/lib/components/MenuGroup/MenuGroup.types.js +1 -2
  51. package/lib/components/MenuGroup/MenuGroup.types.js.map +1 -1
  52. package/lib/components/MenuGroup/index.js +0 -1
  53. package/lib/components/MenuGroup/index.js.map +1 -1
  54. package/lib/components/MenuGroup/renderMenuGroup.js +6 -11
  55. package/lib/components/MenuGroup/renderMenuGroup.js.map +1 -1
  56. package/lib/components/MenuGroup/useMenuGroup.js +14 -16
  57. package/lib/components/MenuGroup/useMenuGroup.js.map +1 -1
  58. package/lib/components/MenuGroup/useMenuGroupContextValues.js +9 -10
  59. package/lib/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  60. package/lib/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
  61. package/lib/components/MenuGroupHeader/MenuGroupHeader.js +5 -7
  62. package/lib/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  63. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js +1 -2
  64. package/lib/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  65. package/lib/components/MenuGroupHeader/index.js +0 -1
  66. package/lib/components/MenuGroupHeader/index.js.map +1 -1
  67. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js +4 -9
  68. package/lib/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  69. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js +12 -16
  70. package/lib/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  71. package/lib/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
  72. package/lib/components/MenuItem/MenuItem.js +5 -7
  73. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  74. package/lib/components/MenuItem/MenuItem.types.js +1 -2
  75. package/lib/components/MenuItem/MenuItem.types.js.map +1 -1
  76. package/lib/components/MenuItem/index.js +0 -1
  77. package/lib/components/MenuItem/index.js.map +1 -1
  78. package/lib/components/MenuItem/renderMenuItem.js +4 -9
  79. package/lib/components/MenuItem/renderMenuItem.js.map +1 -1
  80. package/lib/components/MenuItem/useCharacterSearch.js +14 -17
  81. package/lib/components/MenuItem/useCharacterSearch.js.map +1 -1
  82. package/lib/components/MenuItem/useMenuItem.js +79 -88
  83. package/lib/components/MenuItem/useMenuItem.js.map +1 -1
  84. package/lib/components/MenuItem/useMenuItemStyles.styles.js +5 -5
  85. package/lib/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  86. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js +5 -7
  87. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  88. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js +1 -2
  89. package/lib/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  90. package/lib/components/MenuItemCheckbox/index.js +0 -1
  91. package/lib/components/MenuItemCheckbox/index.js.map +1 -1
  92. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js +4 -9
  93. package/lib/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  94. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js +31 -36
  95. package/lib/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  96. package/lib/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
  97. package/lib/components/MenuItemRadio/MenuItemRadio.js +5 -7
  98. package/lib/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  99. package/lib/components/MenuItemRadio/MenuItemRadio.types.js +1 -2
  100. package/lib/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  101. package/lib/components/MenuItemRadio/index.js +0 -1
  102. package/lib/components/MenuItemRadio/index.js.map +1 -1
  103. package/lib/components/MenuItemRadio/renderMenuItemRadio.js +4 -9
  104. package/lib/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  105. package/lib/components/MenuItemRadio/useMenuItemRadio.js +29 -34
  106. package/lib/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  107. package/lib/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
  108. package/lib/components/MenuList/MenuList.js +6 -8
  109. package/lib/components/MenuList/MenuList.js.map +1 -1
  110. package/lib/components/MenuList/MenuList.types.js +0 -1
  111. package/lib/components/MenuList/MenuList.types.js.map +1 -1
  112. package/lib/components/MenuList/index.js +0 -1
  113. package/lib/components/MenuList/index.js.map +1 -1
  114. package/lib/components/MenuList/renderMenuList.js +6 -11
  115. package/lib/components/MenuList/renderMenuList.js.map +1 -1
  116. package/lib/components/MenuList/useMenuList.js +130 -126
  117. package/lib/components/MenuList/useMenuList.js.map +1 -1
  118. package/lib/components/MenuList/useMenuListContextValues.js +13 -21
  119. package/lib/components/MenuList/useMenuListContextValues.js.map +1 -1
  120. package/lib/components/MenuList/useMenuListStyles.styles.js.map +1 -1
  121. package/lib/components/MenuPopover/MenuPopover.js +5 -7
  122. package/lib/components/MenuPopover/MenuPopover.js.map +1 -1
  123. package/lib/components/MenuPopover/MenuPopover.types.js +1 -2
  124. package/lib/components/MenuPopover/MenuPopover.types.js.map +1 -1
  125. package/lib/components/MenuPopover/index.js +0 -1
  126. package/lib/components/MenuPopover/index.js.map +1 -1
  127. package/lib/components/MenuPopover/renderMenuPopover.js +9 -14
  128. package/lib/components/MenuPopover/renderMenuPopover.js.map +1 -1
  129. package/lib/components/MenuPopover/useMenuPopover.js +87 -91
  130. package/lib/components/MenuPopover/useMenuPopover.js.map +1 -1
  131. package/lib/components/MenuPopover/useMenuPopoverStyles.styles.js +25 -2
  132. package/lib/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
  133. package/lib/components/MenuSplitGroup/MenuSplitGroup.js +5 -7
  134. package/lib/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  135. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js +1 -2
  136. package/lib/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  137. package/lib/components/MenuSplitGroup/index.js +0 -1
  138. package/lib/components/MenuSplitGroup/index.js.map +1 -1
  139. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js +4 -9
  140. package/lib/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  141. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js +45 -47
  142. package/lib/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  143. package/lib/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
  144. package/lib/components/MenuTrigger/MenuTrigger.js +3 -5
  145. package/lib/components/MenuTrigger/MenuTrigger.js.map +1 -1
  146. package/lib/components/MenuTrigger/MenuTrigger.types.js +0 -1
  147. package/lib/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  148. package/lib/components/MenuTrigger/index.js +0 -1
  149. package/lib/components/MenuTrigger/index.js.map +1 -1
  150. package/lib/components/MenuTrigger/renderMenuTrigger.js +4 -6
  151. package/lib/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  152. package/lib/components/MenuTrigger/useMenuTrigger.styles.js.map +1 -1
  153. package/lib/components/index.js +0 -1
  154. package/lib/components/index.js.map +1 -1
  155. package/lib/contexts/menuContext.js +21 -22
  156. package/lib/contexts/menuContext.js.map +1 -1
  157. package/lib/contexts/menuGroupContext.js +3 -4
  158. package/lib/contexts/menuGroupContext.js.map +1 -1
  159. package/lib/contexts/menuListContext.js +8 -9
  160. package/lib/contexts/menuListContext.js.map +1 -1
  161. package/lib/contexts/menuTriggerContext.js +2 -4
  162. package/lib/contexts/menuTriggerContext.js.map +1 -1
  163. package/lib/index.js +0 -1
  164. package/lib/index.js.map +1 -1
  165. package/lib/selectable/index.js +0 -1
  166. package/lib/selectable/index.js.map +1 -1
  167. package/lib/selectable/types.js +0 -1
  168. package/lib/selectable/types.js.map +1 -1
  169. package/lib/selectable/useCheckmarkStyles.styles.js.map +1 -1
  170. package/lib/utils/index.js +0 -1
  171. package/lib/utils/index.js.map +1 -1
  172. package/lib/utils/useIsSubmenu.js +4 -6
  173. package/lib/utils/useIsSubmenu.js.map +1 -1
  174. package/lib/utils/useOnMenuEnter.js +39 -44
  175. package/lib/utils/useOnMenuEnter.js.map +1 -1
  176. package/lib-commonjs/Menu.js +0 -3
  177. package/lib-commonjs/Menu.js.map +1 -1
  178. package/lib-commonjs/MenuDivider.js +0 -3
  179. package/lib-commonjs/MenuDivider.js.map +1 -1
  180. package/lib-commonjs/MenuGroup.js +0 -3
  181. package/lib-commonjs/MenuGroup.js.map +1 -1
  182. package/lib-commonjs/MenuGroupHeader.js +0 -3
  183. package/lib-commonjs/MenuGroupHeader.js.map +1 -1
  184. package/lib-commonjs/MenuItem.js +0 -3
  185. package/lib-commonjs/MenuItem.js.map +1 -1
  186. package/lib-commonjs/MenuItemCheckbox.js +0 -3
  187. package/lib-commonjs/MenuItemCheckbox.js.map +1 -1
  188. package/lib-commonjs/MenuItemRadio.js +0 -3
  189. package/lib-commonjs/MenuItemRadio.js.map +1 -1
  190. package/lib-commonjs/MenuList.js +0 -3
  191. package/lib-commonjs/MenuList.js.map +1 -1
  192. package/lib-commonjs/MenuPopover.js +0 -3
  193. package/lib-commonjs/MenuPopover.js.map +1 -1
  194. package/lib-commonjs/MenuSplitGroup.js +0 -3
  195. package/lib-commonjs/MenuSplitGroup.js.map +1 -1
  196. package/lib-commonjs/MenuTrigger.js +0 -3
  197. package/lib-commonjs/MenuTrigger.js.map +1 -1
  198. package/lib-commonjs/components/Menu/Menu.js +1 -3
  199. package/lib-commonjs/components/Menu/Menu.js.map +1 -1
  200. package/lib-commonjs/components/Menu/Menu.types.js +0 -3
  201. package/lib-commonjs/components/Menu/Menu.types.js.map +1 -1
  202. package/lib-commonjs/components/Menu/index.js +0 -3
  203. package/lib-commonjs/components/Menu/index.js.map +1 -1
  204. package/lib-commonjs/components/Menu/renderMenu.js +1 -3
  205. package/lib-commonjs/components/Menu/renderMenu.js.map +1 -1
  206. package/lib-commonjs/components/Menu/useMenu.js +2 -5
  207. package/lib-commonjs/components/Menu/useMenu.js.map +1 -1
  208. package/lib-commonjs/components/Menu/useMenuContextValues.js +1 -3
  209. package/lib-commonjs/components/Menu/useMenuContextValues.js.map +1 -1
  210. package/lib-commonjs/components/MenuDivider/MenuDivider.js +1 -3
  211. package/lib-commonjs/components/MenuDivider/MenuDivider.js.map +1 -1
  212. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js +0 -3
  213. package/lib-commonjs/components/MenuDivider/MenuDivider.types.js.map +1 -1
  214. package/lib-commonjs/components/MenuDivider/index.js +0 -3
  215. package/lib-commonjs/components/MenuDivider/index.js.map +1 -1
  216. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js +1 -3
  217. package/lib-commonjs/components/MenuDivider/renderMenuDivider.js.map +1 -1
  218. package/lib-commonjs/components/MenuDivider/useMenuDivider.js +1 -3
  219. package/lib-commonjs/components/MenuDivider/useMenuDivider.js.map +1 -1
  220. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js +0 -2
  221. package/lib-commonjs/components/MenuDivider/useMenuDividerStyles.styles.js.map +1 -1
  222. package/lib-commonjs/components/MenuGroup/MenuGroup.js +1 -3
  223. package/lib-commonjs/components/MenuGroup/MenuGroup.js.map +1 -1
  224. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js +0 -3
  225. package/lib-commonjs/components/MenuGroup/MenuGroup.types.js.map +1 -1
  226. package/lib-commonjs/components/MenuGroup/index.js +0 -3
  227. package/lib-commonjs/components/MenuGroup/index.js.map +1 -1
  228. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js +1 -3
  229. package/lib-commonjs/components/MenuGroup/renderMenuGroup.js.map +1 -1
  230. package/lib-commonjs/components/MenuGroup/useMenuGroup.js +1 -3
  231. package/lib-commonjs/components/MenuGroup/useMenuGroup.js.map +1 -1
  232. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js +1 -3
  233. package/lib-commonjs/components/MenuGroup/useMenuGroupContextValues.js.map +1 -1
  234. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js +0 -2
  235. package/lib-commonjs/components/MenuGroup/useMenuGroupStyles.styles.js.map +1 -1
  236. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js +1 -3
  237. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.js.map +1 -1
  238. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js +0 -3
  239. package/lib-commonjs/components/MenuGroupHeader/MenuGroupHeader.types.js.map +1 -1
  240. package/lib-commonjs/components/MenuGroupHeader/index.js +0 -3
  241. package/lib-commonjs/components/MenuGroupHeader/index.js.map +1 -1
  242. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js +1 -3
  243. package/lib-commonjs/components/MenuGroupHeader/renderMenuGroupHeader.js.map +1 -1
  244. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js +1 -3
  245. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeader.js.map +1 -1
  246. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js +0 -2
  247. package/lib-commonjs/components/MenuGroupHeader/useMenuGroupHeaderStyles.styles.js.map +1 -1
  248. package/lib-commonjs/components/MenuItem/MenuItem.js +1 -3
  249. package/lib-commonjs/components/MenuItem/MenuItem.js.map +1 -1
  250. package/lib-commonjs/components/MenuItem/MenuItem.types.js +0 -3
  251. package/lib-commonjs/components/MenuItem/MenuItem.types.js.map +1 -1
  252. package/lib-commonjs/components/MenuItem/index.js +0 -3
  253. package/lib-commonjs/components/MenuItem/index.js.map +1 -1
  254. package/lib-commonjs/components/MenuItem/renderMenuItem.js +1 -3
  255. package/lib-commonjs/components/MenuItem/renderMenuItem.js.map +1 -1
  256. package/lib-commonjs/components/MenuItem/useCharacterSearch.js +1 -3
  257. package/lib-commonjs/components/MenuItem/useCharacterSearch.js.map +1 -1
  258. package/lib-commonjs/components/MenuItem/useMenuItem.js +3 -5
  259. package/lib-commonjs/components/MenuItem/useMenuItem.js.map +1 -1
  260. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js +12 -14
  261. package/lib-commonjs/components/MenuItem/useMenuItemStyles.styles.js.map +1 -1
  262. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js +1 -3
  263. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.js.map +1 -1
  264. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js +0 -3
  265. package/lib-commonjs/components/MenuItemCheckbox/MenuItemCheckbox.types.js.map +1 -1
  266. package/lib-commonjs/components/MenuItemCheckbox/index.js +0 -3
  267. package/lib-commonjs/components/MenuItemCheckbox/index.js.map +1 -1
  268. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js +1 -3
  269. package/lib-commonjs/components/MenuItemCheckbox/renderMenuItemCheckbox.js.map +1 -1
  270. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js +1 -3
  271. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckbox.js.map +1 -1
  272. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js +0 -2
  273. package/lib-commonjs/components/MenuItemCheckbox/useMenuItemCheckboxStyles.styles.js.map +1 -1
  274. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js +1 -3
  275. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.js.map +1 -1
  276. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js +0 -3
  277. package/lib-commonjs/components/MenuItemRadio/MenuItemRadio.types.js.map +1 -1
  278. package/lib-commonjs/components/MenuItemRadio/index.js +0 -3
  279. package/lib-commonjs/components/MenuItemRadio/index.js.map +1 -1
  280. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js +1 -3
  281. package/lib-commonjs/components/MenuItemRadio/renderMenuItemRadio.js.map +1 -1
  282. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js +1 -3
  283. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadio.js.map +1 -1
  284. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js +0 -2
  285. package/lib-commonjs/components/MenuItemRadio/useMenuItemRadioStyles.styles.js.map +1 -1
  286. package/lib-commonjs/components/MenuList/MenuList.js +1 -3
  287. package/lib-commonjs/components/MenuList/MenuList.js.map +1 -1
  288. package/lib-commonjs/components/MenuList/MenuList.types.js +0 -3
  289. package/lib-commonjs/components/MenuList/MenuList.types.js.map +1 -1
  290. package/lib-commonjs/components/MenuList/index.js +0 -3
  291. package/lib-commonjs/components/MenuList/index.js.map +1 -1
  292. package/lib-commonjs/components/MenuList/renderMenuList.js +1 -3
  293. package/lib-commonjs/components/MenuList/renderMenuList.js.map +1 -1
  294. package/lib-commonjs/components/MenuList/useMenuList.js +1 -3
  295. package/lib-commonjs/components/MenuList/useMenuList.js.map +1 -1
  296. package/lib-commonjs/components/MenuList/useMenuListContextValues.js +1 -3
  297. package/lib-commonjs/components/MenuList/useMenuListContextValues.js.map +1 -1
  298. package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js +0 -2
  299. package/lib-commonjs/components/MenuList/useMenuListStyles.styles.js.map +1 -1
  300. package/lib-commonjs/components/MenuPopover/MenuPopover.js +1 -3
  301. package/lib-commonjs/components/MenuPopover/MenuPopover.js.map +1 -1
  302. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js +0 -3
  303. package/lib-commonjs/components/MenuPopover/MenuPopover.types.js.map +1 -1
  304. package/lib-commonjs/components/MenuPopover/index.js +0 -3
  305. package/lib-commonjs/components/MenuPopover/index.js.map +1 -1
  306. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js +1 -3
  307. package/lib-commonjs/components/MenuPopover/renderMenuPopover.js.map +1 -1
  308. package/lib-commonjs/components/MenuPopover/useMenuPopover.js +1 -3
  309. package/lib-commonjs/components/MenuPopover/useMenuPopover.js.map +1 -1
  310. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js +52 -4
  311. package/lib-commonjs/components/MenuPopover/useMenuPopoverStyles.styles.js.map +1 -1
  312. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js +1 -3
  313. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.js.map +1 -1
  314. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js +0 -3
  315. package/lib-commonjs/components/MenuSplitGroup/MenuSplitGroup.types.js.map +1 -1
  316. package/lib-commonjs/components/MenuSplitGroup/index.js +0 -3
  317. package/lib-commonjs/components/MenuSplitGroup/index.js.map +1 -1
  318. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js +1 -3
  319. package/lib-commonjs/components/MenuSplitGroup/renderMenuSplitGroup.js.map +1 -1
  320. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js +1 -3
  321. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroup.js.map +1 -1
  322. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js +0 -2
  323. package/lib-commonjs/components/MenuSplitGroup/useMenuSplitGroupStyles.styles.js.map +1 -1
  324. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js +1 -3
  325. package/lib-commonjs/components/MenuTrigger/MenuTrigger.js.map +1 -1
  326. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js +0 -3
  327. package/lib-commonjs/components/MenuTrigger/MenuTrigger.types.js.map +1 -1
  328. package/lib-commonjs/components/MenuTrigger/index.js +0 -3
  329. package/lib-commonjs/components/MenuTrigger/index.js.map +1 -1
  330. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js +1 -3
  331. package/lib-commonjs/components/MenuTrigger/renderMenuTrigger.js.map +1 -1
  332. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.styles.js +0 -2
  333. package/lib-commonjs/components/MenuTrigger/useMenuTrigger.styles.js.map +1 -1
  334. package/lib-commonjs/components/index.js +0 -3
  335. package/lib-commonjs/components/index.js.map +1 -1
  336. package/lib-commonjs/contexts/menuContext.js +2 -4
  337. package/lib-commonjs/contexts/menuContext.js.map +1 -1
  338. package/lib-commonjs/contexts/menuGroupContext.js +1 -3
  339. package/lib-commonjs/contexts/menuGroupContext.js.map +1 -1
  340. package/lib-commonjs/contexts/menuListContext.js +2 -4
  341. package/lib-commonjs/contexts/menuListContext.js.map +1 -1
  342. package/lib-commonjs/contexts/menuTriggerContext.js +1 -3
  343. package/lib-commonjs/contexts/menuTriggerContext.js.map +1 -1
  344. package/lib-commonjs/index.js +0 -3
  345. package/lib-commonjs/index.js.map +1 -1
  346. package/lib-commonjs/selectable/index.js +0 -3
  347. package/lib-commonjs/selectable/index.js.map +1 -1
  348. package/lib-commonjs/selectable/types.js +0 -3
  349. package/lib-commonjs/selectable/types.js.map +1 -1
  350. package/lib-commonjs/selectable/useCheckmarkStyles.styles.js +0 -2
  351. package/lib-commonjs/selectable/useCheckmarkStyles.styles.js.map +1 -1
  352. package/lib-commonjs/utils/index.js +0 -3
  353. package/lib-commonjs/utils/index.js.map +1 -1
  354. package/lib-commonjs/utils/useIsSubmenu.js +1 -3
  355. package/lib-commonjs/utils/useIsSubmenu.js.map +1 -1
  356. package/lib-commonjs/utils/useOnMenuEnter.js +1 -3
  357. package/lib-commonjs/utils/useOnMenuEnter.js.map +1 -1
  358. package/package.json +13 -13
@@ -9,7 +9,14 @@ import { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';
9
9
  import { useIsSubmenu } from '../../utils/useIsSubmenu';
10
10
  // If it's not possible to position the submenu in smaller viewports, try
11
11
  // and fallback to this order of positions
12
- const submenuFallbackPositions = ['after', 'after-bottom', 'before-top', 'before', 'before-bottom', 'above'];
12
+ const submenuFallbackPositions = [
13
+ 'after',
14
+ 'after-bottom',
15
+ 'before-top',
16
+ 'before',
17
+ 'before-bottom',
18
+ 'above'
19
+ ];
13
20
  /**
14
21
  * Create the state required to render Menu.
15
22
  *
@@ -17,252 +24,251 @@ const submenuFallbackPositions = ['after', 'after-bottom', 'before-top', 'before
17
24
  * before being passed to renderMenu_unstable.
18
25
  *
19
26
  * @param props - props from this instance of Menu
20
- */
21
- export const useMenu_unstable = props => {
22
- const isSubmenu = useIsSubmenu();
23
- const {
24
- hoverDelay = 500,
25
- inline = false,
26
- hasCheckmarks = false,
27
- hasIcons = false,
28
- closeOnScroll = false,
29
- openOnContext = false,
30
- persistOnItemClick = false,
31
- openOnHover = isSubmenu,
32
- defaultCheckedValues,
33
- mountNode = null
34
- } = props;
35
- const triggerId = useId('menu');
36
- const [contextTarget, setContextTarget] = usePositioningMouseTarget();
37
- const positioningState = {
38
- position: isSubmenu ? 'after' : 'below',
39
- align: isSubmenu ? 'top' : 'start',
40
- target: props.openOnContext ? contextTarget : undefined,
41
- fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,
42
- ...resolvePositioningShorthand(props.positioning)
43
- };
44
- const children = React.Children.toArray(props.children);
45
- if (process.env.NODE_ENV !== 'production') {
46
- if (children.length === 0) {
47
- // eslint-disable-next-line no-console
48
- console.warn('Menu must contain at least one child');
27
+ */ export const useMenu_unstable = (props)=>{
28
+ const isSubmenu = useIsSubmenu();
29
+ const { hoverDelay =500 , inline =false , hasCheckmarks =false , hasIcons =false , closeOnScroll =false , openOnContext =false , persistOnItemClick =false , openOnHover =isSubmenu , defaultCheckedValues , mountNode =null } = props;
30
+ const triggerId = useId('menu');
31
+ const [contextTarget, setContextTarget] = usePositioningMouseTarget();
32
+ const positioningState = {
33
+ position: isSubmenu ? 'after' : 'below',
34
+ align: isSubmenu ? 'top' : 'start',
35
+ target: props.openOnContext ? contextTarget : undefined,
36
+ fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,
37
+ ...resolvePositioningShorthand(props.positioning)
38
+ };
39
+ const children = React.Children.toArray(props.children);
40
+ if (process.env.NODE_ENV !== 'production') {
41
+ if (children.length === 0) {
42
+ // eslint-disable-next-line no-console
43
+ console.warn('Menu must contain at least one child');
44
+ }
45
+ if (children.length > 2) {
46
+ // eslint-disable-next-line no-console
47
+ console.warn('Menu must contain at most two children');
48
+ }
49
49
  }
50
- if (children.length > 2) {
51
- // eslint-disable-next-line no-console
52
- console.warn('Menu must contain at most two children');
50
+ let menuTrigger = undefined;
51
+ let menuPopover = undefined;
52
+ if (children.length === 2) {
53
+ menuTrigger = children[0];
54
+ menuPopover = children[1];
55
+ } else if (children.length === 1) {
56
+ menuPopover = children[0];
53
57
  }
54
- }
55
- let menuTrigger = undefined;
56
- let menuPopover = undefined;
57
- if (children.length === 2) {
58
- menuTrigger = children[0];
59
- menuPopover = children[1];
60
- } else if (children.length === 1) {
61
- menuPopover = children[0];
62
- }
63
- const {
64
- targetRef: triggerRef,
65
- containerRef: menuPopoverRef
66
- } = usePositioning(positioningState);
67
- // TODO Better way to narrow types ?
68
- const [open, setOpen] = useMenuOpenState({
69
- hoverDelay,
70
- isSubmenu,
71
- setContextTarget,
72
- closeOnScroll,
73
- menuPopoverRef,
74
- triggerRef,
75
- open: props.open,
76
- defaultOpen: props.defaultOpen,
77
- onOpenChange: props.onOpenChange,
78
- openOnContext
79
- });
80
- const [checkedValues, onCheckedValueChange] = useMenuSelectableState({
81
- checkedValues: props.checkedValues,
82
- defaultCheckedValues,
83
- onCheckedValueChange: props.onCheckedValueChange
84
- });
85
- return {
86
- inline,
87
- hoverDelay,
88
- triggerId,
89
- isSubmenu,
90
- openOnHover,
91
- contextTarget,
92
- setContextTarget,
93
- hasCheckmarks,
94
- hasIcons,
95
- closeOnScroll,
96
- menuTrigger,
97
- menuPopover,
98
- mountNode,
99
- triggerRef,
100
- menuPopoverRef,
101
- components: {},
102
- openOnContext,
103
- open,
104
- setOpen,
105
- checkedValues,
106
- onCheckedValueChange,
107
- persistOnItemClick
108
- };
58
+ const { targetRef: triggerRef , containerRef: menuPopoverRef } = usePositioning(positioningState);
59
+ // TODO Better way to narrow types ?
60
+ const [open, setOpen] = useMenuOpenState({
61
+ hoverDelay,
62
+ isSubmenu,
63
+ setContextTarget,
64
+ closeOnScroll,
65
+ menuPopoverRef,
66
+ triggerRef,
67
+ open: props.open,
68
+ defaultOpen: props.defaultOpen,
69
+ onOpenChange: props.onOpenChange,
70
+ openOnContext
71
+ });
72
+ const [checkedValues, onCheckedValueChange] = useMenuSelectableState({
73
+ checkedValues: props.checkedValues,
74
+ defaultCheckedValues,
75
+ onCheckedValueChange: props.onCheckedValueChange
76
+ });
77
+ return {
78
+ inline,
79
+ hoverDelay,
80
+ triggerId,
81
+ isSubmenu,
82
+ openOnHover,
83
+ contextTarget,
84
+ setContextTarget,
85
+ hasCheckmarks,
86
+ hasIcons,
87
+ closeOnScroll,
88
+ menuTrigger,
89
+ menuPopover,
90
+ mountNode,
91
+ triggerRef,
92
+ menuPopoverRef,
93
+ components: {},
94
+ openOnContext,
95
+ open,
96
+ setOpen,
97
+ checkedValues,
98
+ onCheckedValueChange,
99
+ persistOnItemClick
100
+ };
109
101
  };
110
102
  /**
111
103
  * Adds appropriate state values and handlers for selectable items
112
104
  * i.e checkboxes and radios
113
- */
114
- const useMenuSelectableState = props => {
115
- const [checkedValues, setCheckedValues] = useControllableState({
116
- state: props.checkedValues,
117
- defaultState: props.defaultCheckedValues,
118
- initialState: {}
119
- });
120
- const onCheckedValueChange = useEventCallback((e, {
121
- name,
122
- checkedItems
123
- }) => {
124
- var _props_onCheckedValueChange;
125
- (_props_onCheckedValueChange = props.onCheckedValueChange) === null || _props_onCheckedValueChange === void 0 ? void 0 : _props_onCheckedValueChange.call(props, e, {
126
- name,
127
- checkedItems
105
+ */ const useMenuSelectableState = (props)=>{
106
+ const [checkedValues, setCheckedValues] = useControllableState({
107
+ state: props.checkedValues,
108
+ defaultState: props.defaultCheckedValues,
109
+ initialState: {}
128
110
  });
129
- setCheckedValues(currentValue => ({
130
- ...currentValue,
131
- [name]: checkedItems
132
- }));
133
- });
134
- return [checkedValues, onCheckedValueChange];
111
+ const onCheckedValueChange = useEventCallback((e, { name , checkedItems })=>{
112
+ var _props_onCheckedValueChange;
113
+ (_props_onCheckedValueChange = props.onCheckedValueChange) === null || _props_onCheckedValueChange === void 0 ? void 0 : _props_onCheckedValueChange.call(props, e, {
114
+ name,
115
+ checkedItems
116
+ });
117
+ setCheckedValues((currentValue)=>({
118
+ ...currentValue,
119
+ [name]: checkedItems
120
+ }));
121
+ });
122
+ return [
123
+ checkedValues,
124
+ onCheckedValueChange
125
+ ];
135
126
  };
136
- const useMenuOpenState = state => {
137
- const {
138
- targetDocument
139
- } = useFluent();
140
- const parentSetOpen = useMenuContext_unstable(context => context.setOpen);
141
- const onOpenChange = useEventCallback((e, data) => {
142
- var _state_onOpenChange;
143
- return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);
144
- });
145
- const setOpenTimeout = React.useRef(0);
146
- const enteringTriggerRef = React.useRef(false);
147
- const [open, setOpenState] = useControllableState({
148
- state: state.open,
149
- defaultState: state.defaultOpen,
150
- initialState: false
151
- });
152
- const trySetOpen = useEventCallback((e, data) => {
153
- const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;
154
- onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, {
155
- ...data
127
+ const useMenuOpenState = (state)=>{
128
+ const { targetDocument } = useFluent();
129
+ const parentSetOpen = useMenuContext_unstable((context)=>context.setOpen);
130
+ const onOpenChange = useEventCallback((e, data)=>{
131
+ var _state_onOpenChange;
132
+ return (_state_onOpenChange = state.onOpenChange) === null || _state_onOpenChange === void 0 ? void 0 : _state_onOpenChange.call(state, e, data);
156
133
  });
157
- if (data.open && e.type === 'contextmenu') {
158
- state.setContextTarget(e);
159
- }
160
- if (!data.open) {
161
- state.setContextTarget(undefined);
162
- }
163
- if (data.bubble) {
164
- parentSetOpen(e, {
165
- ...data
166
- });
167
- }
168
- setOpenState(data.open);
169
- });
170
- const setOpen = useEventCallback((e, data) => {
171
- clearTimeout(setOpenTimeout.current);
172
- if (!(e instanceof Event) && e.persist) {
173
- // < React 17 still uses pooled synthetic events
174
- e.persist();
175
- }
176
- if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {
177
- var _state_triggerRef_current;
178
- if ((_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.contains(e.target)) {
179
- enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
180
- }
181
- // FIXME leaking Node timeout type
182
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
183
- // @ts-ignore
184
- setOpenTimeout.current = setTimeout(() => trySetOpen(e, data), state.hoverDelay);
185
- } else {
186
- trySetOpen(e, data);
187
- }
188
- });
189
- useOnClickOutside({
190
- contains: elementContains,
191
- disabled: !open,
192
- element: targetDocument,
193
- refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
194
- callback: event => setOpen(event, {
195
- open: false,
196
- type: 'clickOutside',
197
- event
198
- })
199
- });
200
- // only close on scroll for context, or when closeOnScroll is specified
201
- const closeOnScroll = state.openOnContext || state.closeOnScroll;
202
- useOnScrollOutside({
203
- contains: elementContains,
204
- element: targetDocument,
205
- callback: event => setOpen(event, {
206
- open: false,
207
- type: 'scrollOutside',
208
- event
209
- }),
210
- refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(Boolean),
211
- disabled: !open || !closeOnScroll
212
- });
213
- useOnMenuMouseEnter({
214
- element: targetDocument,
215
- callback: event => {
216
- // When moving from a menu directly back to its trigger, this handler can close the menu
217
- // Explicitly check a flag to see if this situation happens
218
- if (!enteringTriggerRef.current) {
219
- setOpen(event, {
220
- open: false,
221
- type: 'menuMouseEnter',
222
- event
134
+ const setOpenTimeout = React.useRef(0);
135
+ const enteringTriggerRef = React.useRef(false);
136
+ const [open, setOpenState] = useControllableState({
137
+ state: state.open,
138
+ defaultState: state.defaultOpen,
139
+ initialState: false
140
+ });
141
+ const trySetOpen = useEventCallback((e, data)=>{
142
+ const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;
143
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(event, {
144
+ ...data
223
145
  });
224
- }
225
- },
226
- disabled: !open,
227
- refs: [state.menuPopoverRef]
228
- });
229
- // Clear timeout on unmount
230
- // Setting state after a component unmounts can cause memory leaks
231
- React.useEffect(() => {
232
- return () => {
233
- clearTimeout(setOpenTimeout.current);
234
- };
235
- }, []);
236
- // Manage focus for open state
237
- const {
238
- findFirstFocusable
239
- } = useFocusFinders();
240
- const focusFirst = React.useCallback(() => {
241
- const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);
242
- firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
243
- }, [findFirstFocusable, state.menuPopoverRef]);
244
- const firstMount = useFirstMount();
245
- React.useEffect(() => {
246
- if (open) {
247
- focusFirst();
248
- } else {
249
- if (!firstMount) {
250
- if ((targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body)) {
251
- var
252
- // We know that React effects are sync so we focus the trigger here
253
- // after any event handler (event handlers will update state and re-render).
254
- // Since the browser only performs the default behaviour for the Tab key once
255
- // keyboard events have fully bubbled up the window, the browser will move
256
- // focus to the next tabbable element before/after the trigger if needed.
257
- // If the Tab key was not pressed, focus will remain on the trigger as expected.
258
- _state_triggerRef_current;
259
- (_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.focus();
146
+ if (data.open && e.type === 'contextmenu') {
147
+ state.setContextTarget(e);
148
+ }
149
+ if (!data.open) {
150
+ state.setContextTarget(undefined);
151
+ }
152
+ if (data.bubble) {
153
+ parentSetOpen(e, {
154
+ ...data
155
+ });
156
+ }
157
+ setOpenState(data.open);
158
+ });
159
+ const setOpen = useEventCallback((e, data)=>{
160
+ clearTimeout(setOpenTimeout.current);
161
+ if (!(e instanceof Event) && e.persist) {
162
+ // < React 17 still uses pooled synthetic events
163
+ e.persist();
164
+ }
165
+ if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {
166
+ var _state_triggerRef_current;
167
+ if ((_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.contains(e.target)) {
168
+ enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';
169
+ }
170
+ // FIXME leaking Node timeout type
171
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
172
+ // @ts-ignore
173
+ setOpenTimeout.current = setTimeout(()=>trySetOpen(e, data), state.hoverDelay);
174
+ } else {
175
+ trySetOpen(e, data);
176
+ }
177
+ });
178
+ useOnClickOutside({
179
+ contains: elementContains,
180
+ disabled: !open,
181
+ element: targetDocument,
182
+ refs: [
183
+ state.menuPopoverRef,
184
+ !state.openOnContext && state.triggerRef
185
+ ].filter(Boolean),
186
+ callback: (event)=>setOpen(event, {
187
+ open: false,
188
+ type: 'clickOutside',
189
+ event
190
+ })
191
+ });
192
+ // only close on scroll for context, or when closeOnScroll is specified
193
+ const closeOnScroll = state.openOnContext || state.closeOnScroll;
194
+ useOnScrollOutside({
195
+ contains: elementContains,
196
+ element: targetDocument,
197
+ callback: (event)=>setOpen(event, {
198
+ open: false,
199
+ type: 'scrollOutside',
200
+ event
201
+ }),
202
+ refs: [
203
+ state.menuPopoverRef,
204
+ !state.openOnContext && state.triggerRef
205
+ ].filter(Boolean),
206
+ disabled: !open || !closeOnScroll
207
+ });
208
+ useOnMenuMouseEnter({
209
+ element: targetDocument,
210
+ callback: (event)=>{
211
+ // When moving from a menu directly back to its trigger, this handler can close the menu
212
+ // Explicitly check a flag to see if this situation happens
213
+ if (!enteringTriggerRef.current) {
214
+ setOpen(event, {
215
+ open: false,
216
+ type: 'menuMouseEnter',
217
+ event
218
+ });
219
+ }
220
+ },
221
+ disabled: !open,
222
+ refs: [
223
+ state.menuPopoverRef
224
+ ]
225
+ });
226
+ // Clear timeout on unmount
227
+ // Setting state after a component unmounts can cause memory leaks
228
+ React.useEffect(()=>{
229
+ return ()=>{
230
+ clearTimeout(setOpenTimeout.current);
231
+ };
232
+ }, []);
233
+ // Manage focus for open state
234
+ const { findFirstFocusable } = useFocusFinders();
235
+ const focusFirst = React.useCallback(()=>{
236
+ const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);
237
+ firstFocusable === null || firstFocusable === void 0 ? void 0 : firstFocusable.focus();
238
+ }, [
239
+ findFirstFocusable,
240
+ state.menuPopoverRef
241
+ ]);
242
+ const firstMount = useFirstMount();
243
+ React.useEffect(()=>{
244
+ if (open) {
245
+ focusFirst();
246
+ } else {
247
+ if (!firstMount) {
248
+ if ((targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.activeElement) === (targetDocument === null || targetDocument === void 0 ? void 0 : targetDocument.body)) {
249
+ var // We know that React effects are sync so we focus the trigger here
250
+ // after any event handler (event handlers will update state and re-render).
251
+ // Since the browser only performs the default behaviour for the Tab key once
252
+ // keyboard events have fully bubbled up the window, the browser will move
253
+ // focus to the next tabbable element before/after the trigger if needed.
254
+ // If the Tab key was not pressed, focus will remain on the trigger as expected.
255
+ _state_triggerRef_current;
256
+ (_state_triggerRef_current = state.triggerRef.current) === null || _state_triggerRef_current === void 0 ? void 0 : _state_triggerRef_current.focus();
257
+ }
258
+ }
260
259
  }
261
- }
262
- }
263
260
  // firstMount change should not re-run this effect
264
261
  // eslint-disable-next-line react-hooks/exhaustive-deps
265
- }, [state.triggerRef, state.isSubmenu, open, focusFirst, targetDocument, state.menuPopoverRef]);
266
- return [open, setOpen];
262
+ }, [
263
+ state.triggerRef,
264
+ state.isSubmenu,
265
+ open,
266
+ focusFirst,
267
+ targetDocument,
268
+ state.menuPopoverRef
269
+ ]);
270
+ return [
271
+ open,
272
+ setOpen
273
+ ];
267
274
  };
268
- //# sourceMappingURL=useMenu.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","usePositioningMouseTarget","usePositioning","resolvePositioningShorthand","useControllableState","useId","useOnClickOutside","useEventCallback","useOnScrollOutside","useFirstMount","useFluent_unstable","useFluent","elementContains","useFocusFinders","useMenuContext_unstable","MENU_ENTER_EVENT","useOnMenuMouseEnter","useIsSubmenu","submenuFallbackPositions","useMenu_unstable","props","isSubmenu","hoverDelay","inline","hasCheckmarks","hasIcons","closeOnScroll","openOnContext","persistOnItemClick","openOnHover","defaultCheckedValues","mountNode","triggerId","contextTarget","setContextTarget","positioningState","position","align","target","undefined","fallbackPositions","positioning","children","Children","toArray","process","env","NODE_ENV","length","console","warn","menuTrigger","menuPopover","targetRef","triggerRef","containerRef","menuPopoverRef","open","setOpen","useMenuOpenState","defaultOpen","onOpenChange","checkedValues","onCheckedValueChange","useMenuSelectableState","components","setCheckedValues","state","defaultState","initialState","e","name","checkedItems","_props_onCheckedValueChange","call","currentValue","targetDocument","parentSetOpen","context","data","_state_onOpenChange","setOpenTimeout","useRef","enteringTriggerRef","setOpenState","trySetOpen","event","CustomEvent","type","detail","nativeEvent","bubble","clearTimeout","current","Event","persist","_state_triggerRef_current","contains","setTimeout","disabled","element","refs","filter","Boolean","callback","useEffect","findFirstFocusable","focusFirst","useCallback","firstFocusable","focus","firstMount","activeElement","body"],"sources":["../../../src/components/Menu/useMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n usePositioningMouseTarget,\n usePositioning,\n resolvePositioningShorthand,\n PositioningShorthandValue,\n} from '@fluentui/react-positioning';\nimport {\n useControllableState,\n useId,\n useOnClickOutside,\n useEventCallback,\n useOnScrollOutside,\n useFirstMount,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport type { MenuOpenChangeData, MenuOpenEvent, MenuProps, MenuState } from './Menu.types';\n\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions: PositioningShorthandValue[] = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above',\n];\n\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */\nexport const useMenu_unstable = (props: MenuProps): MenuState => {\n const isSubmenu = useIsSubmenu();\n const {\n hoverDelay = 500,\n inline = false,\n hasCheckmarks = false,\n hasIcons = false,\n closeOnScroll = false,\n openOnContext = false,\n persistOnItemClick = false,\n openOnHover = isSubmenu,\n defaultCheckedValues,\n mountNode = null,\n } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning),\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n\n let menuTrigger: React.ReactElement | undefined = undefined;\n let menuPopover: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext,\n });\n\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick,\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useMenuSelectableState = (\n props: Pick<MenuProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n const onCheckedValueChange: MenuState['onCheckedValueChange'] = useEventCallback((e, { name, checkedItems }) => {\n props.onCheckedValueChange?.(e, { name, checkedItems });\n\n setCheckedValues(currentValue => ({\n ...currentValue,\n [name]: checkedItems,\n }));\n });\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\nconst useMenuOpenState = (\n state: Pick<\n MenuState,\n | 'isSubmenu'\n | 'menuPopoverRef'\n | 'setContextTarget'\n | 'triggerRef'\n | 'openOnContext'\n | 'closeOnScroll'\n | 'hoverDelay'\n > &\n Pick<MenuProps, 'open' | 'defaultOpen' | 'onOpenChange'>,\n) => {\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable(context => context.setOpen);\n const onOpenChange: MenuProps['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const setOpenTimeout = React.useRef(0);\n const enteringTriggerRef = React.useRef(false);\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n\n const trySetOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange?.(event, { ...data });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e as React.MouseEvent);\n }\n\n if (!data.open) {\n state.setContextTarget(undefined);\n }\n\n if (data.bubble) {\n parentSetOpen(e, { ...data });\n }\n\n setOpenState(data.open);\n });\n\n const setOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n clearTimeout(setOpenTimeout.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n if (state.triggerRef.current?.contains(e.target as HTMLElement)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeout.current = setTimeout(() => trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n callback: event => setOpen(event, { open: false, type: 'clickOutside', event }),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: event => setOpen(event, { open: false, type: 'scrollOutside', event }),\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n disabled: !open || !closeOnScroll,\n });\n\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: event => {\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, { open: false, type: 'menuMouseEnter', event });\n }\n },\n disabled: !open,\n refs: [state.menuPopoverRef],\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeout.current);\n };\n }, []);\n\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, state.menuPopoverRef]);\n\n const firstMount = useFirstMount();\n React.useEffect(() => {\n if (open) {\n focusFirst();\n } else {\n if (!firstMount) {\n if (targetDocument?.activeElement === targetDocument?.body) {\n // We know that React effects are sync so we focus the trigger here\n // after any event handler (event handlers will update state and re-render).\n // Since the browser only performs the default behaviour for the Tab key once\n // keyboard events have fully bubbled up the window, the browser will move\n // focus to the next tabbable element before/after the trigger if needed.\n // If the Tab key was not pressed, focus will remain on the trigger as expected.\n state.triggerRef.current?.focus();\n }\n }\n }\n // firstMount change should not re-run this effect\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.triggerRef, state.isSubmenu, open, focusFirst, targetDocument, state.menuPopoverRef]);\n\n return [open, setOpen] as const;\n};\n"],"mappings":"AAAA,YAAYA,KAAA,MAAW;AACvB,S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oC,aAAa,OAAKpC,cAAA,aAAAA,cAAA,uBAAAA,cAAA,CAAgBqC,IAAI,CAAD,EAAG;;UAC1D;UACA;UACA;UACA;UACA;UACA;UACAjB,yBAAA;UAAA,CAAAA,yBAAA,GAAA7B,KAAA,CAAMb,UAAU,CAACuC,OAAO,cAAxBG,yBAAA,uBAAAA,yBAAA,CAA0Bc,KAAA;QAC5B;MACF;IACF;IACA;IACA;EACF,GAAG,CAAC3C,KAAA,CAAMb,UAAU,EAAEa,KAAA,CAAM9C,SAAS,EAAEoC,IAAA,EAAMkD,UAAA,EAAY/B,cAAA,EAAgBT,KAAA,CAAMX,cAAc,CAAC;EAE9F,OAAO,CAACC,IAAA,EAAMC,OAAA,CAAQ;AACxB"}
1
+ {"version":3,"sources":["useMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport {\n usePositioningMouseTarget,\n usePositioning,\n resolvePositioningShorthand,\n PositioningShorthandValue,\n} from '@fluentui/react-positioning';\nimport {\n useControllableState,\n useId,\n useOnClickOutside,\n useEventCallback,\n useOnScrollOutside,\n useFirstMount,\n} from '@fluentui/react-utilities';\nimport { useFluent_unstable as useFluent } from '@fluentui/react-shared-contexts';\nimport { elementContains } from '@fluentui/react-portal';\nimport { useFocusFinders } from '@fluentui/react-tabster';\nimport { useMenuContext_unstable } from '../../contexts/menuContext';\nimport { MENU_ENTER_EVENT, useOnMenuMouseEnter } from '../../utils/index';\nimport { useIsSubmenu } from '../../utils/useIsSubmenu';\nimport type { MenuOpenChangeData, MenuOpenEvent, MenuProps, MenuState } from './Menu.types';\n\n// If it's not possible to position the submenu in smaller viewports, try\n// and fallback to this order of positions\nconst submenuFallbackPositions: PositioningShorthandValue[] = [\n 'after',\n 'after-bottom',\n 'before-top',\n 'before',\n 'before-bottom',\n 'above',\n];\n\n/**\n * Create the state required to render Menu.\n *\n * The returned state can be modified with hooks such as useMenuStyles,\n * before being passed to renderMenu_unstable.\n *\n * @param props - props from this instance of Menu\n */\nexport const useMenu_unstable = (props: MenuProps): MenuState => {\n const isSubmenu = useIsSubmenu();\n const {\n hoverDelay = 500,\n inline = false,\n hasCheckmarks = false,\n hasIcons = false,\n closeOnScroll = false,\n openOnContext = false,\n persistOnItemClick = false,\n openOnHover = isSubmenu,\n defaultCheckedValues,\n mountNode = null,\n } = props;\n const triggerId = useId('menu');\n const [contextTarget, setContextTarget] = usePositioningMouseTarget();\n\n const positioningState = {\n position: isSubmenu ? 'after' : 'below',\n align: isSubmenu ? 'top' : 'start',\n target: props.openOnContext ? contextTarget : undefined,\n fallbackPositions: isSubmenu ? submenuFallbackPositions : undefined,\n ...resolvePositioningShorthand(props.positioning),\n } as const;\n\n const children = React.Children.toArray(props.children) as React.ReactElement[];\n\n if (process.env.NODE_ENV !== 'production') {\n if (children.length === 0) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at least one child');\n }\n\n if (children.length > 2) {\n // eslint-disable-next-line no-console\n console.warn('Menu must contain at most two children');\n }\n }\n\n let menuTrigger: React.ReactElement | undefined = undefined;\n let menuPopover: React.ReactElement | undefined = undefined;\n if (children.length === 2) {\n menuTrigger = children[0];\n menuPopover = children[1];\n } else if (children.length === 1) {\n menuPopover = children[0];\n }\n\n const { targetRef: triggerRef, containerRef: menuPopoverRef } = usePositioning(positioningState);\n\n // TODO Better way to narrow types ?\n const [open, setOpen] = useMenuOpenState({\n hoverDelay,\n isSubmenu,\n setContextTarget,\n closeOnScroll,\n menuPopoverRef,\n triggerRef,\n open: props.open,\n defaultOpen: props.defaultOpen,\n onOpenChange: props.onOpenChange,\n openOnContext,\n });\n\n const [checkedValues, onCheckedValueChange] = useMenuSelectableState({\n checkedValues: props.checkedValues,\n defaultCheckedValues,\n onCheckedValueChange: props.onCheckedValueChange,\n });\n\n return {\n inline,\n hoverDelay,\n triggerId,\n isSubmenu,\n openOnHover,\n contextTarget,\n setContextTarget,\n hasCheckmarks,\n hasIcons,\n closeOnScroll,\n menuTrigger,\n menuPopover,\n mountNode,\n triggerRef,\n menuPopoverRef,\n components: {},\n openOnContext,\n open,\n setOpen,\n checkedValues,\n onCheckedValueChange,\n persistOnItemClick,\n };\n};\n\n/**\n * Adds appropriate state values and handlers for selectable items\n * i.e checkboxes and radios\n */\nconst useMenuSelectableState = (\n props: Pick<MenuProps, 'checkedValues' | 'defaultCheckedValues' | 'onCheckedValueChange'>,\n) => {\n const [checkedValues, setCheckedValues] = useControllableState({\n state: props.checkedValues,\n defaultState: props.defaultCheckedValues,\n initialState: {},\n });\n const onCheckedValueChange: MenuState['onCheckedValueChange'] = useEventCallback((e, { name, checkedItems }) => {\n props.onCheckedValueChange?.(e, { name, checkedItems });\n\n setCheckedValues(currentValue => ({\n ...currentValue,\n [name]: checkedItems,\n }));\n });\n\n return [checkedValues, onCheckedValueChange] as const;\n};\n\nconst useMenuOpenState = (\n state: Pick<\n MenuState,\n | 'isSubmenu'\n | 'menuPopoverRef'\n | 'setContextTarget'\n | 'triggerRef'\n | 'openOnContext'\n | 'closeOnScroll'\n | 'hoverDelay'\n > &\n Pick<MenuProps, 'open' | 'defaultOpen' | 'onOpenChange'>,\n) => {\n const { targetDocument } = useFluent();\n const parentSetOpen = useMenuContext_unstable(context => context.setOpen);\n const onOpenChange: MenuProps['onOpenChange'] = useEventCallback((e, data) => state.onOpenChange?.(e, data));\n\n const setOpenTimeout = React.useRef(0);\n const enteringTriggerRef = React.useRef(false);\n\n const [open, setOpenState] = useControllableState({\n state: state.open,\n defaultState: state.defaultOpen,\n initialState: false,\n });\n\n const trySetOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n const event = e instanceof CustomEvent && e.type === MENU_ENTER_EVENT ? e.detail.nativeEvent : e;\n onOpenChange?.(event, { ...data });\n if (data.open && e.type === 'contextmenu') {\n state.setContextTarget(e as React.MouseEvent);\n }\n\n if (!data.open) {\n state.setContextTarget(undefined);\n }\n\n if (data.bubble) {\n parentSetOpen(e, { ...data });\n }\n\n setOpenState(data.open);\n });\n\n const setOpen = useEventCallback((e: MenuOpenEvent, data: MenuOpenChangeData) => {\n clearTimeout(setOpenTimeout.current);\n if (!(e instanceof Event) && e.persist) {\n // < React 17 still uses pooled synthetic events\n e.persist();\n }\n\n if (e.type === 'mouseleave' || e.type === 'mouseenter' || e.type === 'mousemove' || e.type === MENU_ENTER_EVENT) {\n if (state.triggerRef.current?.contains(e.target as HTMLElement)) {\n enteringTriggerRef.current = e.type === 'mouseenter' || e.type === 'mousemove';\n }\n\n // FIXME leaking Node timeout type\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n setOpenTimeout.current = setTimeout(() => trySetOpen(e, data), state.hoverDelay);\n } else {\n trySetOpen(e, data);\n }\n });\n\n useOnClickOutside({\n contains: elementContains,\n disabled: !open,\n element: targetDocument,\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n callback: event => setOpen(event, { open: false, type: 'clickOutside', event }),\n });\n\n // only close on scroll for context, or when closeOnScroll is specified\n const closeOnScroll = state.openOnContext || state.closeOnScroll;\n useOnScrollOutside({\n contains: elementContains,\n element: targetDocument,\n callback: event => setOpen(event, { open: false, type: 'scrollOutside', event }),\n refs: [state.menuPopoverRef, !state.openOnContext && state.triggerRef].filter(\n Boolean,\n ) as React.MutableRefObject<HTMLElement>[],\n disabled: !open || !closeOnScroll,\n });\n\n useOnMenuMouseEnter({\n element: targetDocument,\n callback: event => {\n // When moving from a menu directly back to its trigger, this handler can close the menu\n // Explicitly check a flag to see if this situation happens\n if (!enteringTriggerRef.current) {\n setOpen(event, { open: false, type: 'menuMouseEnter', event });\n }\n },\n disabled: !open,\n refs: [state.menuPopoverRef],\n });\n\n // Clear timeout on unmount\n // Setting state after a component unmounts can cause memory leaks\n React.useEffect(() => {\n return () => {\n clearTimeout(setOpenTimeout.current);\n };\n }, []);\n\n // Manage focus for open state\n const { findFirstFocusable } = useFocusFinders();\n const focusFirst = React.useCallback(() => {\n const firstFocusable = findFirstFocusable(state.menuPopoverRef.current);\n firstFocusable?.focus();\n }, [findFirstFocusable, state.menuPopoverRef]);\n\n const firstMount = useFirstMount();\n React.useEffect(() => {\n if (open) {\n focusFirst();\n } else {\n if (!firstMount) {\n if (targetDocument?.activeElement === targetDocument?.body) {\n // We know that React effects are sync so we focus the trigger here\n // after any event handler (event handlers will update state and re-render).\n // Since the browser only performs the default behaviour for the Tab key once\n // keyboard events have fully bubbled up the window, the browser will move\n // focus to the next tabbable element before/after the trigger if needed.\n // If the Tab key was not pressed, focus will remain on the trigger as expected.\n state.triggerRef.current?.focus();\n }\n }\n }\n // firstMount change should not re-run this effect\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [state.triggerRef, state.isSubmenu, open, focusFirst, targetDocument, state.menuPopoverRef]);\n\n return [open, setOpen] as const;\n};\n"],"names":["React","usePositioningMouseTarget","usePositioning","resolvePositioningShorthand","useControllableState","useId","useOnClickOutside","useEventCallback","useOnScrollOutside","useFirstMount","useFluent_unstable","useFluent","elementContains","useFocusFinders","useMenuContext_unstable","MENU_ENTER_EVENT","useOnMenuMouseEnter","useIsSubmenu","submenuFallbackPositions","useMenu_unstable","props","isSubmenu","hoverDelay","inline","hasCheckmarks","hasIcons","closeOnScroll","openOnContext","persistOnItemClick","openOnHover","defaultCheckedValues","mountNode","triggerId","contextTarget","setContextTarget","positioningState","position","align","target","undefined","fallbackPositions","positioning","children","Children","toArray","process","env","NODE_ENV","length","console","warn","menuTrigger","menuPopover","targetRef","triggerRef","containerRef","menuPopoverRef","open","setOpen","useMenuOpenState","defaultOpen","onOpenChange","checkedValues","onCheckedValueChange","useMenuSelectableState","components","setCheckedValues","state","defaultState","initialState","e","name","checkedItems","currentValue","targetDocument","parentSetOpen","context","data","setOpenTimeout","useRef","enteringTriggerRef","setOpenState","trySetOpen","event","CustomEvent","type","detail","nativeEvent","bubble","clearTimeout","current","Event","persist","contains","setTimeout","disabled","element","refs","filter","Boolean","callback","useEffect","findFirstFocusable","focusFirst","useCallback","firstFocus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