@react-md/core 1.0.0-next.7 → 1.0.0-next.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (713) hide show
  1. package/.stylelintrc.json +14 -0
  2. package/.turbo/turbo-build.log +6 -6
  3. package/.turbo/turbo-lint.log +13 -12
  4. package/CHANGELOG.md +15 -0
  5. package/README.md +39 -24
  6. package/coverage/clover.xml +1013 -529
  7. package/coverage/coverage-final.json +9 -3
  8. package/coverage/lcov-report/AutoComplete.tsx.html +283 -0
  9. package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
  10. package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
  11. package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
  12. package/coverage/lcov-report/RootHtml.tsx.html +370 -0
  13. package/coverage/lcov-report/Select.tsx.html +1411 -0
  14. package/coverage/lcov-report/SrOnly.tsx.html +328 -0
  15. package/coverage/lcov-report/Typography.tsx.html +1027 -0
  16. package/coverage/lcov-report/autocomplete/AutoComplete.tsx.html +283 -0
  17. package/coverage/lcov-report/autocomplete/Autocomplete.tsx.html +283 -0
  18. package/coverage/lcov-report/autocomplete/index.html +161 -0
  19. package/coverage/lcov-report/autocomplete/useAutoComplete.ts.html +775 -0
  20. package/coverage/lcov-report/autocomplete/useAutocomplete.ts.html +775 -0
  21. package/coverage/lcov-report/autocomplete/useInlineAutoComplete.ts.html +340 -0
  22. package/coverage/lcov-report/autocomplete/useInlineAutocomplete.ts.html +346 -0
  23. package/coverage/lcov-report/autocomplete/utils.ts.html +106 -0
  24. package/coverage/lcov-report/avatar/Avatar.tsx.html +162 -99
  25. package/coverage/lcov-report/avatar/index.html +19 -34
  26. package/coverage/lcov-report/avatar/styles.ts.html +1 -1
  27. package/coverage/lcov-report/button/Button.tsx.html +85 -85
  28. package/coverage/lcov-report/button/index.html +12 -12
  29. package/coverage/lcov-report/dialog/DialogFooter.tsx.html +36 -36
  30. package/coverage/lcov-report/dialog/DialogHeader.tsx.html +26 -26
  31. package/coverage/lcov-report/dialog/index.html +34 -19
  32. package/coverage/lcov-report/form/AutoComplete.tsx.html +283 -0
  33. package/coverage/lcov-report/form/Form.tsx.html +22 -22
  34. package/coverage/lcov-report/form/OptGroup.tsx.html +169 -166
  35. package/coverage/lcov-report/form/Option.tsx.html +727 -0
  36. package/coverage/lcov-report/form/Select.tsx.html +962 -1112
  37. package/coverage/lcov-report/form/SelectOriginal.tsx.html +1630 -0
  38. package/coverage/lcov-report/form/SelectV2.tsx.html +1024 -0
  39. package/coverage/lcov-report/form/SelectedOption.tsx.html +250 -0
  40. package/coverage/lcov-report/form/index.html +57 -12
  41. package/coverage/lcov-report/form/selectUtils.ts.html +188 -221
  42. package/coverage/lcov-report/form/useAutoComplete.ts.html +787 -0
  43. package/coverage/lcov-report/form/useCombobox.ts.html +454 -460
  44. package/coverage/lcov-report/form/useComboboxList.ts.html +108 -93
  45. package/coverage/lcov-report/form/useFormReset.ts.html +229 -0
  46. package/coverage/lcov-report/form/useInlineAutoComplete.ts.html +379 -0
  47. package/coverage/lcov-report/form/useSelectCombobox.ts.html +499 -0
  48. package/coverage/lcov-report/form/utils.ts.html +209 -170
  49. package/coverage/lcov-report/icon/FontIcon.tsx.html +28 -28
  50. package/coverage/lcov-report/icon/MaterialIcon.tsx.html +235 -0
  51. package/coverage/lcov-report/icon/index.html +1 -1
  52. package/coverage/lcov-report/index.html +32 -32
  53. package/coverage/lcov-report/media-queries/appSize.ts.html +1 -1
  54. package/coverage/lcov-report/media-queries/index.html +1 -1
  55. package/coverage/lcov-report/menu/DropdownMenu.tsx.html +188 -188
  56. package/coverage/lcov-report/menu/Menu.tsx.html +271 -265
  57. package/coverage/lcov-report/menu/MenuItem.tsx.html +292 -0
  58. package/coverage/lcov-report/menu/MenuVisibilityProvider.tsx.html +48 -33
  59. package/coverage/lcov-report/menu/index.html +45 -15
  60. package/coverage/lcov-report/menu/useContextMenu.ts.html +490 -0
  61. package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
  62. package/coverage/lcov-report/movement/index.html +19 -19
  63. package/coverage/lcov-report/movement/useKeyboardMovementProvider.ts.html +422 -383
  64. package/coverage/lcov-report/positioning/constants.ts.html +463 -0
  65. package/coverage/lcov-report/positioning/index.html +30 -30
  66. package/coverage/lcov-report/positioning/useFixedPositioning.ts.html +1321 -0
  67. package/coverage/lcov-report/progress/CircularProgress.tsx.html +184 -184
  68. package/coverage/lcov-report/progress/index.html +19 -34
  69. package/coverage/lcov-report/searching/caseInsensitive.ts.html +685 -0
  70. package/coverage/lcov-report/searching/fuzzy.ts.html +610 -0
  71. package/coverage/lcov-report/searching/index.html +161 -0
  72. package/coverage/lcov-report/searching/toSearchQuery.ts.html +139 -0
  73. package/coverage/lcov-report/searching/utils.ts.html +247 -0
  74. package/coverage/lcov-report/src/CoreProviders.tsx.html +20 -20
  75. package/coverage/lcov-report/src/NoSsr.tsx.html +1 -1
  76. package/coverage/lcov-report/src/RootHtml.tsx.html +370 -0
  77. package/coverage/lcov-report/src/SsrProvider.tsx.html +10 -10
  78. package/coverage/lcov-report/src/app-bar/AppBar.tsx.html +1 -1
  79. package/coverage/lcov-report/src/app-bar/AppBarTitle.tsx.html +1 -1
  80. package/coverage/lcov-report/src/app-bar/index.html +1 -1
  81. package/coverage/lcov-report/src/avatar/Avatar.tsx.html +1 -1
  82. package/coverage/lcov-report/src/avatar/index.html +1 -1
  83. package/coverage/lcov-report/src/avatar/styles.ts.html +1 -1
  84. package/coverage/lcov-report/src/badge/Badge.tsx.html +1 -1
  85. package/coverage/lcov-report/src/badge/index.html +1 -1
  86. package/coverage/lcov-report/src/box/Box.tsx.html +1 -1
  87. package/coverage/lcov-report/src/box/index.html +1 -1
  88. package/coverage/lcov-report/src/box/styles.ts.html +1 -1
  89. package/coverage/lcov-report/src/button/AsyncButton.tsx.html +1 -1
  90. package/coverage/lcov-report/src/button/Button.tsx.html +1 -1
  91. package/coverage/lcov-report/src/button/ButtonUnstyled.tsx.html +1 -1
  92. package/coverage/lcov-report/src/button/FloatingActionButton.tsx.html +1 -1
  93. package/coverage/lcov-report/src/button/TooltippedButton.tsx.html +1 -1
  94. package/coverage/lcov-report/src/button/buttonStyles.ts.html +1 -1
  95. package/coverage/lcov-report/src/button/buttonUnstyledStyles.ts.html +1 -1
  96. package/coverage/lcov-report/src/button/index.html +1 -1
  97. package/coverage/lcov-report/src/card/Card.tsx.html +1 -1
  98. package/coverage/lcov-report/src/card/CardContent.tsx.html +1 -1
  99. package/coverage/lcov-report/src/card/CardFooter.tsx.html +1 -1
  100. package/coverage/lcov-report/src/card/CardHeader.tsx.html +1 -1
  101. package/coverage/lcov-report/src/card/CardSubtitle.tsx.html +1 -1
  102. package/coverage/lcov-report/src/card/CardTitle.tsx.html +1 -1
  103. package/coverage/lcov-report/src/card/ClickableCard.tsx.html +1 -1
  104. package/coverage/lcov-report/src/card/index.html +1 -1
  105. package/coverage/lcov-report/src/card/styles.ts.html +1 -1
  106. package/coverage/lcov-report/src/chip/Chip.tsx.html +1 -1
  107. package/coverage/lcov-report/src/chip/index.html +1 -1
  108. package/coverage/lcov-report/src/chip/styles.ts.html +1 -1
  109. package/coverage/lcov-report/src/cssUtils.ts.html +53 -53
  110. package/coverage/lcov-report/src/delegateEvent.ts.html +1 -1
  111. package/coverage/lcov-report/src/dialog/Dialog.tsx.html +1 -1
  112. package/coverage/lcov-report/src/dialog/DialogContainer.tsx.html +1 -1
  113. package/coverage/lcov-report/src/dialog/DialogContent.tsx.html +1 -1
  114. package/coverage/lcov-report/src/dialog/DialogFooter.tsx.html +1 -1
  115. package/coverage/lcov-report/src/dialog/DialogHeader.tsx.html +1 -1
  116. package/coverage/lcov-report/src/dialog/DialogTitle.tsx.html +1 -1
  117. package/coverage/lcov-report/src/dialog/FixedDialog.tsx.html +1 -1
  118. package/coverage/lcov-report/src/dialog/NestedDialogProvider.ts.html +1 -1
  119. package/coverage/lcov-report/src/dialog/index.html +1 -1
  120. package/coverage/lcov-report/src/dialog/styles.ts.html +1 -1
  121. package/coverage/lcov-report/src/divider/Divider.tsx.html +1 -1
  122. package/coverage/lcov-report/src/divider/index.html +1 -1
  123. package/coverage/lcov-report/src/divider/styles.ts.html +1 -1
  124. package/coverage/lcov-report/src/draggable/index.html +1 -1
  125. package/coverage/lcov-report/src/draggable/useDraggable.ts.html +1 -1
  126. package/coverage/lcov-report/src/draggable/utils.ts.html +1 -1
  127. package/coverage/lcov-report/src/expansion-panel/ExpansionList.tsx.html +1 -1
  128. package/coverage/lcov-report/src/expansion-panel/ExpansionPanel.tsx.html +1 -1
  129. package/coverage/lcov-report/src/expansion-panel/ExpansionPanelHeader.tsx.html +1 -1
  130. package/coverage/lcov-report/src/expansion-panel/index.html +1 -1
  131. package/coverage/lcov-report/src/expansion-panel/useExpansionList.ts.html +1 -1
  132. package/coverage/lcov-report/src/expansion-panel/useExpansionPanels.ts.html +1 -1
  133. package/coverage/lcov-report/src/focus/index.html +1 -1
  134. package/coverage/lcov-report/src/focus/useFocusContainer.ts.html +1 -1
  135. package/coverage/lcov-report/src/focus/utils.ts.html +1 -1
  136. package/coverage/lcov-report/src/form/AutoComplete.tsx.html +283 -0
  137. package/coverage/lcov-report/src/form/Checkbox.tsx.html +1 -1
  138. package/coverage/lcov-report/src/form/Fieldset.tsx.html +1 -1
  139. package/coverage/lcov-report/src/form/FileInput.tsx.html +1 -1
  140. package/coverage/lcov-report/src/form/Form.tsx.html +11 -8
  141. package/coverage/lcov-report/src/form/FormMessage.tsx.html +1 -1
  142. package/coverage/lcov-report/src/form/FormMessageContainer.tsx.html +1 -1
  143. package/coverage/lcov-report/src/form/FormMessageCounter.tsx.html +1 -1
  144. package/coverage/lcov-report/src/form/InputToggle.tsx.html +1 -1
  145. package/coverage/lcov-report/src/form/InputToggleIcon.tsx.html +56 -56
  146. package/coverage/lcov-report/src/form/Label.tsx.html +1 -1
  147. package/coverage/lcov-report/src/form/Legend.tsx.html +1 -1
  148. package/coverage/lcov-report/src/form/MenuItemCheckbox.tsx.html +3 -3
  149. package/coverage/lcov-report/src/form/MenuItemFileInput.tsx.html +1 -1
  150. package/coverage/lcov-report/src/form/MenuItemInputToggle.tsx.html +178 -232
  151. package/coverage/lcov-report/src/form/MenuItemRadio.tsx.html +3 -3
  152. package/coverage/lcov-report/src/form/MenuItemSwitch.tsx.html +1 -1
  153. package/coverage/lcov-report/src/form/MenuItemTextField.tsx.html +1 -1
  154. package/coverage/lcov-report/src/form/NativeSelect.tsx.html +1 -1
  155. package/coverage/lcov-report/src/form/OptGroup.tsx.html +1 -1
  156. package/coverage/lcov-report/src/form/Option.tsx.html +1 -1
  157. package/coverage/lcov-report/src/form/Password.tsx.html +1 -1
  158. package/coverage/lcov-report/src/form/Radio.tsx.html +1 -1
  159. package/coverage/lcov-report/src/form/Select.tsx.html +894 -1146
  160. package/coverage/lcov-report/src/form/SelectValue.tsx.html +1 -1
  161. package/coverage/lcov-report/src/form/Slider.tsx.html +1 -1
  162. package/coverage/lcov-report/src/form/SliderContainer.tsx.html +1 -1
  163. package/coverage/lcov-report/src/form/SliderMark.tsx.html +1 -1
  164. package/coverage/lcov-report/src/form/SliderMarkLabel.tsx.html +1 -1
  165. package/coverage/lcov-report/src/form/SliderThumb.tsx.html +1 -1
  166. package/coverage/lcov-report/src/form/SliderTrack.tsx.html +1 -1
  167. package/coverage/lcov-report/src/form/SliderValueMarks.tsx.html +1 -1
  168. package/coverage/lcov-report/src/form/SliderValueTooltip.tsx.html +1 -1
  169. package/coverage/lcov-report/src/form/Switch.tsx.html +1 -1
  170. package/coverage/lcov-report/src/form/SwitchTrack.tsx.html +1 -1
  171. package/coverage/lcov-report/src/form/TextArea.tsx.html +1 -1
  172. package/coverage/lcov-report/src/form/TextField.tsx.html +1 -1
  173. package/coverage/lcov-report/src/form/TextFieldAddon.tsx.html +1 -1
  174. package/coverage/lcov-report/src/form/TextFieldContainer.tsx.html +1 -1
  175. package/coverage/lcov-report/src/form/TextFieldContainerStyles.ts.html +1 -1
  176. package/coverage/lcov-report/src/form/fileUtils.ts.html +1 -1
  177. package/coverage/lcov-report/src/form/formConfig.ts.html +1 -1
  178. package/coverage/lcov-report/src/form/formMessageStyles.ts.html +1 -1
  179. package/coverage/lcov-report/src/form/index.html +30 -900
  180. package/coverage/lcov-report/src/form/inputToggleStyles.ts.html +30 -30
  181. package/coverage/lcov-report/src/form/menuItemInputToggleStyles.ts.html +319 -0
  182. package/coverage/lcov-report/src/form/nativeSelectStyles.ts.html +1 -1
  183. package/coverage/lcov-report/src/form/optionStyles.ts.html +1 -1
  184. package/coverage/lcov-report/src/form/passwordStyles.ts.html +1 -1
  185. package/coverage/lcov-report/src/form/selectStyles.ts.html +1 -1
  186. package/coverage/lcov-report/src/form/selectUtils.ts.html +1 -1
  187. package/coverage/lcov-report/src/form/sliderUtils.ts.html +1 -1
  188. package/coverage/lcov-report/src/form/switchStyles.ts.html +1 -1
  189. package/coverage/lcov-report/src/form/textAreaStyles.ts.html +1 -1
  190. package/coverage/lcov-report/src/form/textFieldStyles.ts.html +1 -1
  191. package/coverage/lcov-report/src/form/useAutoComplete.ts.html +787 -0
  192. package/coverage/lcov-report/src/form/useCheckboxGroup.ts.html +1 -1
  193. package/coverage/lcov-report/src/form/useCombobox.ts.html +943 -457
  194. package/coverage/lcov-report/src/form/useEditableCombobox.ts.html +502 -0
  195. package/coverage/lcov-report/src/form/useFileUpload.ts.html +1 -1
  196. package/coverage/lcov-report/src/form/useInlineAutoComplete.ts.html +109 -0
  197. package/coverage/lcov-report/src/form/useListboxProvider.ts.html +1 -1
  198. package/coverage/lcov-report/src/form/useNumberField.ts.html +1 -1
  199. package/coverage/lcov-report/src/form/useRadioGroup.ts.html +1 -1
  200. package/coverage/lcov-report/src/form/useRangeSlider.ts.html +1 -1
  201. package/coverage/lcov-report/src/form/useResizingTextArea.ts.html +1 -1
  202. package/coverage/lcov-report/src/form/useSelectCombobox.ts.html +295 -0
  203. package/coverage/lcov-report/src/form/useSlider.ts.html +1 -1
  204. package/coverage/lcov-report/src/form/useTextField.ts.html +1 -1
  205. package/coverage/lcov-report/src/form/utils.ts.html +200 -170
  206. package/coverage/lcov-report/src/form/validation.ts.html +1 -1
  207. package/coverage/lcov-report/src/hoverMode/index.html +1 -1
  208. package/coverage/lcov-report/src/hoverMode/useHoverMode.ts.html +1 -1
  209. package/coverage/lcov-report/src/hoverMode/useHoverModeProvider.ts.html +1 -1
  210. package/coverage/lcov-report/src/icon/FontIcon.tsx.html +28 -28
  211. package/coverage/lcov-report/src/icon/IconRotator.tsx.html +1 -1
  212. package/coverage/lcov-report/src/icon/MaterialIcon.tsx.html +1 -1
  213. package/coverage/lcov-report/src/icon/MaterialSymbol.tsx.html +1 -1
  214. package/coverage/lcov-report/src/icon/SVGIcon.tsx.html +1 -1
  215. package/coverage/lcov-report/src/icon/TextIconSpacing.tsx.html +51 -51
  216. package/coverage/lcov-report/src/icon/iconConfig.tsx.html +10 -10
  217. package/coverage/lcov-report/src/icon/index.html +1 -1
  218. package/coverage/lcov-report/src/icon/material.ts.html +1 -1
  219. package/coverage/lcov-report/src/icon/materialConfig.ts.html +1 -1
  220. package/coverage/lcov-report/src/icon/styles.ts.html +38 -38
  221. package/coverage/lcov-report/src/index.html +9 -354
  222. package/coverage/lcov-report/src/interaction/Ripple.tsx.html +1 -1
  223. package/coverage/lcov-report/src/interaction/RippleContainer.tsx.html +1 -1
  224. package/coverage/lcov-report/src/interaction/UserInteractionModeProvider.tsx.html +87 -87
  225. package/coverage/lcov-report/src/interaction/config.ts.html +7 -7
  226. package/coverage/lcov-report/src/interaction/index.html +1 -1
  227. package/coverage/lcov-report/src/interaction/useElementInteraction.tsx.html +83 -83
  228. package/coverage/lcov-report/src/interaction/useHigherContrastChildren.tsx.html +7 -7
  229. package/coverage/lcov-report/src/interaction/utils.ts.html +1 -1
  230. package/coverage/lcov-report/src/layout/LayoutAppBar.tsx.html +1 -1
  231. package/coverage/lcov-report/src/layout/LayoutNav.tsx.html +1 -1
  232. package/coverage/lcov-report/src/layout/LayoutWindowSplitter.tsx.html +1 -1
  233. package/coverage/lcov-report/src/layout/Main.tsx.html +1 -1
  234. package/coverage/lcov-report/src/layout/index.html +1 -1
  235. package/coverage/lcov-report/src/layout/layoutNavStyles.ts.html +1 -1
  236. package/coverage/lcov-report/src/layout/layoutWindowSplitterStyles.ts.html +1 -1
  237. package/coverage/lcov-report/src/layout/mainStyles.ts.html +1 -1
  238. package/coverage/lcov-report/src/layout/useExpandableLayout.ts.html +1 -1
  239. package/coverage/lcov-report/src/layout/useHorizontalLayoutTransition.ts.html +1 -1
  240. package/coverage/lcov-report/src/layout/useLayoutAppBarHeight.ts.html +1 -1
  241. package/coverage/lcov-report/src/layout/useLayoutTree.ts.html +1 -1
  242. package/coverage/lcov-report/src/layout/useLayoutWindowSplitter.ts.html +1 -1
  243. package/coverage/lcov-report/src/layout/useMainTabIndex.ts.html +1 -1
  244. package/coverage/lcov-report/src/layout/useResizableLayout.ts.html +1 -1
  245. package/coverage/lcov-report/src/layout/useTemporaryLayout.ts.html +1 -1
  246. package/coverage/lcov-report/src/link/Link.tsx.html +1 -1
  247. package/coverage/lcov-report/src/link/SkipToMainContent.tsx.html +1 -1
  248. package/coverage/lcov-report/src/link/index.html +1 -1
  249. package/coverage/lcov-report/src/link/styles.ts.html +1 -1
  250. package/coverage/lcov-report/src/list/List.tsx.html +30 -30
  251. package/coverage/lcov-report/src/list/ListItem.tsx.html +124 -124
  252. package/coverage/lcov-report/src/list/ListItemAddon.tsx.html +35 -35
  253. package/coverage/lcov-report/src/list/ListItemChildren.tsx.html +79 -79
  254. package/coverage/lcov-report/src/list/ListItemLink.tsx.html +2 -2
  255. package/coverage/lcov-report/src/list/ListItemText.tsx.html +35 -35
  256. package/coverage/lcov-report/src/list/ListSubheader.tsx.html +1 -1
  257. package/coverage/lcov-report/src/list/getListItemHeight.ts.html +44 -47
  258. package/coverage/lcov-report/src/list/index.html +5 -5
  259. package/coverage/lcov-report/src/list/listItemStyles.ts.html +65 -65
  260. package/coverage/lcov-report/src/media-queries/AppSizeProvider.tsx.html +49 -49
  261. package/coverage/lcov-report/src/media-queries/appSize.ts.html +1 -1
  262. package/coverage/lcov-report/src/media-queries/index.html +1 -1
  263. package/coverage/lcov-report/src/media-queries/useMediaQuery.ts.html +24 -24
  264. package/coverage/lcov-report/src/menu/DropdownMenu.tsx.html +1 -1
  265. package/coverage/lcov-report/src/menu/Menu.tsx.html +3 -3
  266. package/coverage/lcov-report/src/menu/MenuBar.tsx.html +1 -1
  267. package/coverage/lcov-report/src/menu/MenuButton.tsx.html +1 -1
  268. package/coverage/lcov-report/src/menu/MenuConfigurationProvider.tsx.html +1 -1
  269. package/coverage/lcov-report/src/menu/MenuItem.tsx.html +1 -1
  270. package/coverage/lcov-report/src/menu/MenuItemButton.tsx.html +1 -1
  271. package/coverage/lcov-report/src/menu/MenuItemGroup.tsx.html +1 -1
  272. package/coverage/lcov-report/src/menu/MenuItemSeparator.tsx.html +1 -1
  273. package/coverage/lcov-report/src/menu/MenuSheet.tsx.html +1 -1
  274. package/coverage/lcov-report/src/menu/MenuVisibilityProvider.tsx.html +1 -1
  275. package/coverage/lcov-report/src/menu/MenuWidget.tsx.html +1 -1
  276. package/coverage/lcov-report/src/menu/MenuWidgetKeyboardProvider.tsx.html +1 -1
  277. package/coverage/lcov-report/src/menu/index.html +1 -1
  278. package/coverage/lcov-report/src/menu/useContextMenu.ts.html +1 -1
  279. package/coverage/lcov-report/src/menu/useMenuBarProvider.ts.html +1 -1
  280. package/coverage/lcov-report/src/menu/utils.ts.html +1 -1
  281. package/coverage/lcov-report/src/movement/constants.ts.html +1 -1
  282. package/coverage/lcov-report/src/movement/findMatchIndex.ts.html +1 -1
  283. package/coverage/lcov-report/src/movement/index.html +17 -62
  284. package/coverage/lcov-report/src/movement/useKeyboardMovementProvider.ts.html +1 -1
  285. package/coverage/lcov-report/src/movement/utils.ts.html +143 -119
  286. package/coverage/lcov-report/src/overlay/Overlay.tsx.html +1 -1
  287. package/coverage/lcov-report/src/overlay/index.html +1 -1
  288. package/coverage/lcov-report/src/overlay/overlayStyles.ts.html +1 -1
  289. package/coverage/lcov-report/src/portal/Portal.tsx.html +1 -1
  290. package/coverage/lcov-report/src/portal/PortalContainerProvider.tsx.html +36 -36
  291. package/coverage/lcov-report/src/portal/index.html +1 -1
  292. package/coverage/lcov-report/src/positioning/constants.ts.html +1 -1
  293. package/coverage/lcov-report/src/positioning/createHorizontalPosition.ts.html +1 -1
  294. package/coverage/lcov-report/src/positioning/createVerticalPosition.ts.html +1 -1
  295. package/coverage/lcov-report/src/positioning/getFixedPosition.ts.html +1 -1
  296. package/coverage/lcov-report/src/positioning/index.html +1 -1
  297. package/coverage/lcov-report/src/positioning/useFixedPositioning.ts.html +1 -1
  298. package/coverage/lcov-report/src/positioning/utils.ts.html +1 -1
  299. package/coverage/lcov-report/src/progress/CircularProgress.tsx.html +81 -81
  300. package/coverage/lcov-report/src/progress/LinearProgress.tsx.html +1 -1
  301. package/coverage/lcov-report/src/progress/getProgressA11y.ts.html +1 -1
  302. package/coverage/lcov-report/src/progress/index.html +1 -1
  303. package/coverage/lcov-report/src/responsive-item/ResponsiveItemContainer.tsx.html +1 -1
  304. package/coverage/lcov-report/src/responsive-item/ResponsiveItemOverlay.tsx.html +1 -1
  305. package/coverage/lcov-report/src/responsive-item/index.html +1 -1
  306. package/coverage/lcov-report/src/responsive-item/styles.ts.html +1 -1
  307. package/coverage/lcov-report/src/scroll/ScrollLock.tsx.html +1 -1
  308. package/coverage/lcov-report/src/scroll/getScrollbarWidth.ts.html +1 -1
  309. package/coverage/lcov-report/src/scroll/index.html +1 -1
  310. package/coverage/lcov-report/src/scroll/useScrollLock.ts.html +1 -1
  311. package/coverage/lcov-report/src/segmented-button/SegmentedButton.tsx.html +1 -1
  312. package/coverage/lcov-report/src/segmented-button/SegmentedButtonContainer.tsx.html +1 -1
  313. package/coverage/lcov-report/src/segmented-button/index.html +1 -1
  314. package/coverage/lcov-report/src/segmented-button/segmentedButtonContainerStyles.ts.html +1 -1
  315. package/coverage/lcov-report/src/segmented-button/segmentedButtonStyles.ts.html +1 -1
  316. package/coverage/lcov-report/src/sheet/Sheet.tsx.html +1 -1
  317. package/coverage/lcov-report/src/sheet/index.html +1 -1
  318. package/coverage/lcov-report/src/sheet/styles.ts.html +1 -1
  319. package/coverage/lcov-report/src/snackbar/DefaultToastRenderer.tsx.html +1 -1
  320. package/coverage/lcov-report/src/snackbar/Snackbar.tsx.html +1 -1
  321. package/coverage/lcov-report/src/snackbar/Toast.tsx.html +1 -1
  322. package/coverage/lcov-report/src/snackbar/ToastActionButton.tsx.html +1 -1
  323. package/coverage/lcov-report/src/snackbar/ToastCloseButton.tsx.html +1 -1
  324. package/coverage/lcov-report/src/snackbar/ToastContent.tsx.html +1 -1
  325. package/coverage/lcov-report/src/snackbar/ToastManager.tsx.html +1 -1
  326. package/coverage/lcov-report/src/snackbar/ToastManagerProvider.tsx.html +1 -1
  327. package/coverage/lcov-report/src/snackbar/index.html +1 -1
  328. package/coverage/lcov-report/src/snackbar/snackbarStyles.ts.html +1 -1
  329. package/coverage/lcov-report/src/snackbar/toastContentStyles.ts.html +1 -1
  330. package/coverage/lcov-report/src/snackbar/toastStyles.ts.html +1 -1
  331. package/coverage/lcov-report/src/snackbar/useCurrentToastActions.ts.html +1 -1
  332. package/coverage/lcov-report/src/suspense/CircularProgressSuspense.tsx.html +142 -142
  333. package/coverage/lcov-report/src/suspense/NullSuspense.tsx.html +88 -88
  334. package/coverage/lcov-report/src/suspense/index.html +32 -32
  335. package/coverage/lcov-report/src/table/Table.tsx.html +1 -1
  336. package/coverage/lcov-report/src/table/TableBody.tsx.html +1 -1
  337. package/coverage/lcov-report/src/table/TableCell.tsx.html +1 -1
  338. package/coverage/lcov-report/src/table/TableCellContent.tsx.html +1 -1
  339. package/coverage/lcov-report/src/table/TableCheckbox.tsx.html +1 -1
  340. package/coverage/lcov-report/src/table/TableConfigurationProvider.tsx.html +1 -1
  341. package/coverage/lcov-report/src/table/TableContainer.tsx.html +1 -1
  342. package/coverage/lcov-report/src/table/TableContainerProvider.tsx.html +1 -1
  343. package/coverage/lcov-report/src/table/TableFooter.tsx.html +1 -1
  344. package/coverage/lcov-report/src/table/TableHeader.tsx.html +1 -1
  345. package/coverage/lcov-report/src/table/TableRadio.tsx.html +1 -1
  346. package/coverage/lcov-report/src/table/TableRow.tsx.html +1 -1
  347. package/coverage/lcov-report/src/table/index.html +1 -1
  348. package/coverage/lcov-report/src/table/tableCellStyles.ts.html +1 -1
  349. package/coverage/lcov-report/src/table/tableContainerStyles.ts.html +1 -1
  350. package/coverage/lcov-report/src/table/tableFooterStyles.ts.html +1 -1
  351. package/coverage/lcov-report/src/table/tableHeaderStyles.ts.html +1 -1
  352. package/coverage/lcov-report/src/table/tableRowStyles.ts.html +1 -1
  353. package/coverage/lcov-report/src/table/tableStyles.ts.html +1 -1
  354. package/coverage/lcov-report/src/tabs/Tab.tsx.html +1 -1
  355. package/coverage/lcov-report/src/tabs/TabList.tsx.html +1 -1
  356. package/coverage/lcov-report/src/tabs/TabListScrollButton.tsx.html +1 -1
  357. package/coverage/lcov-report/src/tabs/index.html +1 -1
  358. package/coverage/lcov-report/src/tabs/tabIndicatorStyles.ts.html +1 -1
  359. package/coverage/lcov-report/src/tabs/tabListScrollButtonStyles.ts.html +1 -1
  360. package/coverage/lcov-report/src/tabs/tabListStyles.ts.html +1 -1
  361. package/coverage/lcov-report/src/tabs/tabStyles.ts.html +1 -1
  362. package/coverage/lcov-report/src/tabs/useTabList.ts.html +1 -1
  363. package/coverage/lcov-report/src/tabs/useTabs.ts.html +1 -1
  364. package/coverage/lcov-report/src/tabs/utils.ts.html +1 -1
  365. package/coverage/lcov-report/src/test-utils/IntersectionObserver.ts.html +1 -1
  366. package/coverage/lcov-report/src/test-utils/ResizeObserver.ts.html +1 -1
  367. package/coverage/lcov-report/src/test-utils/data-testid.ts.html +18 -6
  368. package/coverage/lcov-report/src/test-utils/drag.ts.html +1 -1
  369. package/coverage/lcov-report/src/test-utils/index.html +7 -7
  370. package/coverage/lcov-report/src/test-utils/jest-setup.ts.html +9 -9
  371. package/coverage/lcov-report/src/test-utils/matchMedia.ts.html +4 -4
  372. package/coverage/lcov-report/src/test-utils/polyfills/IntersectionObserver.ts.html +4 -4
  373. package/coverage/lcov-report/src/test-utils/polyfills/ResizeObserver.ts.html +3 -3
  374. package/coverage/lcov-report/src/test-utils/polyfills/TextDecoder.ts.html +106 -0
  375. package/coverage/lcov-report/src/test-utils/polyfills/TextEncoder.ts.html +100 -0
  376. package/coverage/lcov-report/src/test-utils/polyfills/index.html +1 -1
  377. package/coverage/lcov-report/src/test-utils/polyfills/matchMedia.ts.html +6 -6
  378. package/coverage/lcov-report/src/test-utils/polyfills/offsetParent.ts.html +14 -14
  379. package/coverage/lcov-report/src/test-utils/polyfills/scrollIntoView.ts.html +5 -5
  380. package/coverage/lcov-report/src/test-utils/render.tsx.html +21 -21
  381. package/coverage/lcov-report/src/test-utils/root-html-environment.ts.html +85 -0
  382. package/coverage/lcov-report/src/test-utils/timers.ts.html +1 -1
  383. package/coverage/lcov-report/src/theme/LocalStorageColorSchemeProvider.tsx.html +1 -1
  384. package/coverage/lcov-report/src/theme/ThemeProvider.tsx.html +1 -1
  385. package/coverage/lcov-report/src/theme/colors.ts.html +1 -1
  386. package/coverage/lcov-report/src/theme/cssVars.ts.html +1 -1
  387. package/coverage/lcov-report/src/theme/index.html +1 -1
  388. package/coverage/lcov-report/src/theme/useCSSVariables.ts.html +1 -1
  389. package/coverage/lcov-report/src/theme/useColorScheme.ts.html +1 -1
  390. package/coverage/lcov-report/src/theme/useColorSchemeMetaTag.ts.html +1 -1
  391. package/coverage/lcov-report/src/theme/useColorSchemeProvider.ts.html +1 -1
  392. package/coverage/lcov-report/src/theme/usePrefersColorScheme.ts.html +1 -1
  393. package/coverage/lcov-report/src/theme/utils.ts.html +1 -1
  394. package/coverage/lcov-report/src/tooltip/Tooltip.tsx.html +1 -1
  395. package/coverage/lcov-report/src/tooltip/TooltipHoverModeProvider.tsx.html +1 -1
  396. package/coverage/lcov-report/src/tooltip/constants.ts.html +1 -1
  397. package/coverage/lcov-report/src/tooltip/index.html +1 -1
  398. package/coverage/lcov-report/src/tooltip/tooltipStyles.ts.html +1 -1
  399. package/coverage/lcov-report/src/tooltip/useTooltip.ts.html +1 -1
  400. package/coverage/lcov-report/src/tooltip/useTooltipPosition.ts.html +1 -1
  401. package/coverage/lcov-report/src/tooltip/utils.ts.html +1 -1
  402. package/coverage/lcov-report/src/transition/CSSTransition.tsx.html +1 -1
  403. package/coverage/lcov-report/src/transition/Collapse.tsx.html +1 -1
  404. package/coverage/lcov-report/src/transition/CrossFade.tsx.html +1 -1
  405. package/coverage/lcov-report/src/transition/ScaleTransition.tsx.html +1 -1
  406. package/coverage/lcov-report/src/transition/SkeletonPlaceholder.tsx.html +1 -1
  407. package/coverage/lcov-report/src/transition/Slide.tsx.html +1 -1
  408. package/coverage/lcov-report/src/transition/SlideContainer.tsx.html +1 -1
  409. package/coverage/lcov-report/src/transition/collapseStyles.ts.html +13 -13
  410. package/coverage/lcov-report/src/transition/config.ts.html +3 -3
  411. package/coverage/lcov-report/src/transition/index.html +7 -7
  412. package/coverage/lcov-report/src/transition/maxWidthTransition.ts.html +1 -1
  413. package/coverage/lcov-report/src/transition/skeletonPlaceholderUtils.ts.html +1 -1
  414. package/coverage/lcov-report/src/transition/useCSSTransition.ts.html +1 -1
  415. package/coverage/lcov-report/src/transition/useCarousel.ts.html +1 -1
  416. package/coverage/lcov-report/src/transition/useCollapseTransition.ts.html +96 -150
  417. package/coverage/lcov-report/src/transition/useCrossFadeTransition.ts.html +1 -1
  418. package/coverage/lcov-report/src/transition/useMaxWidthTransition.ts.html +1 -1
  419. package/coverage/lcov-report/src/transition/useScaleTransition.ts.html +1 -1
  420. package/coverage/lcov-report/src/transition/useSkeletonPlaceholder.ts.html +1 -1
  421. package/coverage/lcov-report/src/transition/useSlideTransition.ts.html +1 -1
  422. package/coverage/lcov-report/src/transition/useTransition.ts.html +152 -152
  423. package/coverage/lcov-report/src/transition/utils.ts.html +14 -14
  424. package/coverage/lcov-report/src/tree/DefaultTreeItemRenderer.tsx.html +1 -1
  425. package/coverage/lcov-report/src/tree/Tree.tsx.html +1 -1
  426. package/coverage/lcov-report/src/tree/TreeGroup.tsx.html +45 -45
  427. package/coverage/lcov-report/src/tree/TreeItem.tsx.html +1 -1
  428. package/coverage/lcov-report/src/tree/TreeItemExpander.tsx.html +1 -1
  429. package/coverage/lcov-report/src/tree/TreeProvider.tsx.html +8 -8
  430. package/coverage/lcov-report/src/tree/index.html +1 -1
  431. package/coverage/lcov-report/src/tree/styles.ts.html +5 -5
  432. package/coverage/lcov-report/src/tree/useTree.ts.html +1 -1
  433. package/coverage/lcov-report/src/tree/useTreeExpansion.ts.html +1 -1
  434. package/coverage/lcov-report/src/tree/useTreeItems.ts.html +1 -1
  435. package/coverage/lcov-report/src/tree/useTreeMovement.ts.html +1 -1
  436. package/coverage/lcov-report/src/tree/useTreeSelection.ts.html +1 -1
  437. package/coverage/lcov-report/src/tree/utils.ts.html +1 -1
  438. package/coverage/lcov-report/src/typography/SrOnly.tsx.html +12 -12
  439. package/coverage/lcov-report/src/typography/TextContainer.tsx.html +1 -1
  440. package/coverage/lcov-report/src/typography/Typography.tsx.html +94 -94
  441. package/coverage/lcov-report/src/typography/WritingDirectionProvider.tsx.html +1 -1
  442. package/coverage/lcov-report/src/typography/index.html +1 -1
  443. package/coverage/lcov-report/src/useAsyncAction.ts.html +1 -1
  444. package/coverage/lcov-report/src/useDebouncedFunction.ts.html +1 -1
  445. package/coverage/lcov-report/src/useDropzone.ts.html +1 -1
  446. package/coverage/lcov-report/src/useElementSize.ts.html +1 -1
  447. package/coverage/lcov-report/src/useEnsuredId.ts.html +8 -8
  448. package/coverage/lcov-report/src/useEnsuredRef.ts.html +11 -11
  449. package/coverage/lcov-report/src/useEnsuredState.ts.html +16 -16
  450. package/coverage/lcov-report/src/useHtmlClassName.ts.html +1 -1
  451. package/coverage/lcov-report/src/useIntersectionObserver.ts.html +1 -1
  452. package/coverage/lcov-report/src/useIsomorphicLayoutEffect.ts.html +1 -1
  453. package/coverage/lcov-report/src/useLocalStorage.ts.html +1 -1
  454. package/coverage/lcov-report/src/useOrientation.ts.html +32 -32
  455. package/coverage/lcov-report/src/usePageInactive.ts.html +1 -1
  456. package/coverage/lcov-report/src/useResizeListener.ts.html +1 -1
  457. package/coverage/lcov-report/src/useResizeObserver.ts.html +23 -23
  458. package/coverage/lcov-report/src/useThrottledFunction.ts.html +1 -1
  459. package/coverage/lcov-report/src/useToggle.ts.html +1 -1
  460. package/coverage/lcov-report/src/useUnmounted.ts.html +1 -1
  461. package/coverage/lcov-report/src/useWindowSize.ts.html +1 -1
  462. package/coverage/lcov-report/src/utils/RenderRecursively.tsx.html +1 -1
  463. package/coverage/lcov-report/src/utils/alphaNumericSort.ts.html +1 -1
  464. package/coverage/lcov-report/src/utils/applyRef.ts.html +1 -1
  465. package/coverage/lcov-report/src/utils/bem.ts.html +50 -50
  466. package/coverage/lcov-report/src/utils/filters.ts.html +357 -84
  467. package/coverage/lcov-report/src/utils/getClientPosition.ts.html +1 -1
  468. package/coverage/lcov-report/src/utils/getMiddleOfRange.ts.html +1 -1
  469. package/coverage/lcov-report/src/utils/getPercentage.ts.html +1 -1
  470. package/coverage/lcov-report/src/utils/getRangeDefaultValue.ts.html +1 -1
  471. package/coverage/lcov-report/src/utils/getRangeSteps.ts.html +1 -1
  472. package/coverage/lcov-report/src/utils/identity.ts.html +1 -1
  473. package/coverage/lcov-report/src/utils/index.html +13 -268
  474. package/coverage/lcov-report/src/utils/isElementVisible.ts.html +1 -1
  475. package/coverage/lcov-report/src/utils/loop.ts.html +1 -1
  476. package/coverage/lcov-report/src/utils/nearest.ts.html +1 -1
  477. package/coverage/lcov-report/src/utils/parseCssLengthUnit.ts.html +1 -1
  478. package/coverage/lcov-report/src/utils/randomInt.ts.html +1 -1
  479. package/coverage/lcov-report/src/utils/wait.ts.html +1 -1
  480. package/coverage/lcov-report/src/utils/withinRange.ts.html +1 -1
  481. package/coverage/lcov-report/src/window-splitter/WindowSplitter.tsx.html +1 -1
  482. package/coverage/lcov-report/src/window-splitter/index.html +1 -1
  483. package/coverage/lcov-report/src/window-splitter/useWindowSplitter.ts.html +1 -1
  484. package/coverage/lcov-report/transition/config.ts.html +5 -5
  485. package/coverage/lcov-report/transition/index.html +1 -1
  486. package/coverage/lcov-report/transition/useScaleTransition.ts.html +535 -0
  487. package/coverage/lcov-report/useAutoComplete.ts.html +787 -0
  488. package/coverage/lcov-report/useCollapseTransition.ts.html +166 -211
  489. package/coverage/lcov-report/useCombobox.ts.html +1513 -0
  490. package/coverage/lcov-report/useInlineAutoComplete.ts.html +379 -0
  491. package/coverage/lcov-report/useSelectCombobox.ts.html +295 -0
  492. package/coverage/lcov-report/utils/alphaNumericSort.ts.html +11 -50
  493. package/coverage/lcov-report/utils/filters.ts.html +1056 -201
  494. package/coverage/lcov-report/utils/index.html +10 -10
  495. package/coverage/lcov-report/utils/searching.ts.html +85 -0
  496. package/coverage/lcov-report/utils.ts.html +109 -277
  497. package/coverage/lcov.info +900 -363
  498. package/dist/RootHtml.d.ts +62 -0
  499. package/dist/RootHtml.js +49 -0
  500. package/dist/RootHtml.js.map +1 -0
  501. package/dist/_core.scss +49 -43
  502. package/dist/avatar/Avatar.d.ts +14 -0
  503. package/dist/avatar/Avatar.js +5 -2
  504. package/dist/avatar/Avatar.js.map +1 -1
  505. package/dist/badge/_badge.scss +23 -19
  506. package/dist/dialog/FixedDialog.d.ts +5 -4
  507. package/dist/dialog/FixedDialog.js +5 -4
  508. package/dist/dialog/FixedDialog.js.map +1 -1
  509. package/dist/form/MenuItemInputToggle.d.ts +2 -15
  510. package/dist/form/MenuItemInputToggle.js +26 -37
  511. package/dist/form/MenuItemInputToggle.js.map +1 -1
  512. package/dist/form/NativeSelect.d.ts +5 -2
  513. package/dist/form/NativeSelect.js.map +1 -1
  514. package/dist/form/Option.js +3 -2
  515. package/dist/form/Option.js.map +1 -1
  516. package/dist/form/Select.d.ts +105 -15
  517. package/dist/form/Select.js +160 -249
  518. package/dist/form/Select.js.map +1 -1
  519. package/dist/form/SelectedOption.d.ts +21 -0
  520. package/dist/form/SelectedOption.js +37 -0
  521. package/dist/form/SelectedOption.js.map +1 -0
  522. package/dist/form/TextField.d.ts +2 -2
  523. package/dist/form/TextField.js.map +1 -1
  524. package/dist/form/_form.scss +47 -29
  525. package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
  526. package/dist/form/menuItemInputToggleStyles.js +31 -0
  527. package/dist/form/menuItemInputToggleStyles.js.map +1 -0
  528. package/dist/form/selectUtils.d.ts +1 -3
  529. package/dist/form/selectUtils.js +2 -10
  530. package/dist/form/selectUtils.js.map +1 -1
  531. package/dist/form/types.d.ts +6 -6
  532. package/dist/form/types.js.map +1 -1
  533. package/dist/form/useCombobox.d.ts +157 -0
  534. package/dist/form/useCombobox.js +206 -0
  535. package/dist/form/useCombobox.js.map +1 -0
  536. package/dist/form/useEditableCombobox.d.ts +15 -0
  537. package/dist/form/useEditableCombobox.js +101 -0
  538. package/dist/form/useEditableCombobox.js.map +1 -0
  539. package/dist/form/useFormReset.d.ts +16 -0
  540. package/dist/form/useFormReset.js +32 -0
  541. package/dist/form/useFormReset.js.map +1 -0
  542. package/dist/form/useListboxProvider.d.ts +1 -0
  543. package/dist/form/useListboxProvider.js +1 -0
  544. package/dist/form/useListboxProvider.js.map +1 -1
  545. package/dist/form/useSelectCombobox.d.ts +17 -0
  546. package/dist/form/useSelectCombobox.js +36 -0
  547. package/dist/form/useSelectCombobox.js.map +1 -0
  548. package/dist/form/utils.d.ts +11 -1
  549. package/dist/form/utils.js +6 -0
  550. package/dist/form/utils.js.map +1 -1
  551. package/dist/icon/_icon.scss +7 -5
  552. package/dist/index.d.ts +15 -1
  553. package/dist/index.js +15 -1
  554. package/dist/index.js.map +1 -1
  555. package/dist/interaction/_interaction.scss +56 -44
  556. package/dist/list/types.d.ts +10 -1
  557. package/dist/list/types.js.map +1 -1
  558. package/dist/menu/Menu.js +12 -1
  559. package/dist/menu/Menu.js.map +1 -1
  560. package/dist/menu/_menu.scss +1 -0
  561. package/dist/menu/useContextMenu.d.ts +3 -3
  562. package/dist/menu/useContextMenu.js +3 -3
  563. package/dist/menu/useContextMenu.js.map +1 -1
  564. package/dist/movement/types.d.ts +40 -21
  565. package/dist/movement/types.js.map +1 -1
  566. package/dist/movement/useKeyboardMovementProvider.js +15 -4
  567. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  568. package/dist/movement/utils.d.ts +7 -2
  569. package/dist/movement/utils.js +10 -0
  570. package/dist/movement/utils.js.map +1 -1
  571. package/dist/positioning/useFixedPositioning.js +0 -8
  572. package/dist/positioning/useFixedPositioning.js.map +1 -1
  573. package/dist/searching/caseInsensitive.d.ts +150 -0
  574. package/dist/searching/caseInsensitive.js +30 -0
  575. package/dist/searching/caseInsensitive.js.map +1 -0
  576. package/dist/searching/fuzzy.d.ts +128 -0
  577. package/dist/searching/fuzzy.js +54 -0
  578. package/dist/searching/fuzzy.js.map +1 -0
  579. package/dist/searching/toSearchQuery.d.ts +5 -0
  580. package/dist/searching/toSearchQuery.js +13 -0
  581. package/dist/searching/toSearchQuery.js.map +1 -0
  582. package/dist/searching/types.d.ts +28 -0
  583. package/dist/searching/types.js +5 -0
  584. package/dist/searching/types.js.map +1 -0
  585. package/dist/searching/utils.d.ts +21 -0
  586. package/dist/searching/utils.js +28 -0
  587. package/dist/searching/utils.js.map +1 -0
  588. package/dist/test-utils/IntersectionObserver.d.ts +12 -0
  589. package/dist/test-utils/ResizeObserver.d.ts +172 -0
  590. package/dist/test-utils/data-testid.d.ts +7 -0
  591. package/dist/test-utils/data-testid.js +1 -0
  592. package/dist/test-utils/data-testid.js.map +1 -1
  593. package/dist/test-utils/drag.d.ts +26 -0
  594. package/dist/test-utils/index.d.ts +7 -0
  595. package/dist/test-utils/jest-setup.d.ts +1 -0
  596. package/dist/test-utils/matchMedia.d.ts +101 -0
  597. package/dist/test-utils/polyfills/IntersectionObserver.d.ts +1 -0
  598. package/dist/test-utils/polyfills/ResizeObserver.d.ts +1 -0
  599. package/dist/test-utils/polyfills/TextDecoder.d.ts +1 -0
  600. package/dist/test-utils/polyfills/TextDecoder.js +8 -0
  601. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -0
  602. package/dist/test-utils/polyfills/TextEncoder.d.ts +1 -0
  603. package/dist/test-utils/polyfills/TextEncoder.js +6 -0
  604. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -0
  605. package/dist/test-utils/polyfills/index.d.ts +7 -0
  606. package/dist/test-utils/polyfills/index.js +2 -0
  607. package/dist/test-utils/polyfills/index.js.map +1 -1
  608. package/dist/test-utils/polyfills/matchMedia.d.ts +1 -0
  609. package/dist/test-utils/polyfills/offsetParent.d.ts +1 -0
  610. package/dist/test-utils/polyfills/scrollIntoView.d.ts +1 -0
  611. package/dist/test-utils/render.d.ts +13 -0
  612. package/dist/test-utils/timers.d.ts +39 -0
  613. package/dist/theme/_theme.scss +192 -34
  614. package/dist/transition/useCollapseTransition.d.ts +3 -18
  615. package/dist/transition/useCollapseTransition.js +1 -10
  616. package/dist/transition/useCollapseTransition.js.map +1 -1
  617. package/dist/transition/utils.js +7 -2
  618. package/dist/transition/utils.js.map +1 -1
  619. package/dist/typography/SrOnly.d.ts +3 -3
  620. package/dist/typography/SrOnly.js +4 -4
  621. package/dist/typography/SrOnly.js.map +1 -1
  622. package/dist/typography/Typography.d.ts +19 -19
  623. package/dist/typography/Typography.js +19 -19
  624. package/dist/typography/Typography.js.map +1 -1
  625. package/dist/typography/_typography.scss +65 -25
  626. package/dist/useEnsuredState.d.ts +1 -1
  627. package/dist/useEnsuredState.js.map +1 -1
  628. package/dist/utils/alphaNumericSort.d.ts +1 -1
  629. package/dist/utils/alphaNumericSort.js +2 -10
  630. package/dist/utils/alphaNumericSort.js.map +1 -1
  631. package/jest.config.ts +4 -0
  632. package/package.json +21 -20
  633. package/src/RootHtml.tsx +95 -0
  634. package/src/__tests__/RootHtml.node.tsx +46 -0
  635. package/src/__tests__/__snapshots__/RootHtml.node.tsx.snap +19 -0
  636. package/src/_core.scss +49 -43
  637. package/src/avatar/Avatar.tsx +24 -3
  638. package/src/avatar/__tests__/Avatar.tsx +1 -1
  639. package/src/avatar/__tests__/__snapshots__/Avatar.tsx.snap +6 -6
  640. package/src/badge/_badge.scss +23 -19
  641. package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
  642. package/src/dialog/FixedDialog.tsx +5 -4
  643. package/src/form/MenuItemInputToggle.tsx +46 -64
  644. package/src/form/NativeSelect.tsx +6 -3
  645. package/src/form/Option.tsx +8 -2
  646. package/src/form/Select.tsx +251 -335
  647. package/src/form/SelectedOption.tsx +55 -0
  648. package/src/form/TextField.tsx +2 -2
  649. package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
  650. package/src/form/__tests__/MenuItemRadio.tsx +53 -0
  651. package/src/form/__tests__/Select.tsx +439 -0
  652. package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
  653. package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
  654. package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
  655. package/src/form/__tests__/__snapshots__/Select.tsx.snap +492 -0
  656. package/src/form/__tests__/useFormReset.tsx +195 -0
  657. package/src/form/_form.scss +47 -29
  658. package/src/form/menuItemInputToggleStyles.ts +78 -0
  659. package/src/form/selectUtils.ts +3 -14
  660. package/src/form/types.ts +6 -6
  661. package/src/form/useCombobox.ts +523 -0
  662. package/src/form/useEditableCombobox.ts +139 -0
  663. package/src/form/useFormReset.ts +48 -0
  664. package/src/form/useListboxProvider.ts +2 -0
  665. package/src/form/useSelectCombobox.ts +70 -0
  666. package/src/form/utils.ts +17 -4
  667. package/src/icon/_icon.scss +7 -5
  668. package/src/index.ts +15 -1
  669. package/src/interaction/_interaction.scss +56 -44
  670. package/src/list/types.ts +12 -1
  671. package/src/menu/Menu.tsx +9 -1
  672. package/src/menu/__tests__/__snapshots__/useContextMenu.tsx.snap +54 -0
  673. package/src/menu/__tests__/useContextMenu.tsx +41 -0
  674. package/src/menu/_menu.scss +1 -0
  675. package/src/menu/useContextMenu.ts +3 -3
  676. package/src/movement/types.ts +50 -25
  677. package/src/movement/useKeyboardMovementProvider.ts +21 -8
  678. package/src/movement/utils.ts +12 -2
  679. package/src/positioning/__tests__/__snapshots__/useFixedPositioning.tsx.snap +0 -32
  680. package/src/positioning/__tests__/useFixedPositioning.tsx +0 -14
  681. package/src/positioning/useFixedPositioning.ts +0 -6
  682. package/src/searching/__tests__/caseInsensitive.ts +165 -0
  683. package/src/searching/__tests__/fuzzy.ts +169 -0
  684. package/src/searching/__tests__/toSearchQuery.ts +21 -0
  685. package/src/searching/caseInsensitive.ts +200 -0
  686. package/src/searching/fuzzy.ts +175 -0
  687. package/src/searching/toSearchQuery.ts +18 -0
  688. package/src/searching/types.ts +34 -0
  689. package/src/searching/utils.ts +54 -0
  690. package/src/test-utils/data-testid.ts +5 -1
  691. package/src/test-utils/polyfills/TextDecoder.ts +7 -0
  692. package/src/test-utils/polyfills/TextEncoder.ts +5 -0
  693. package/src/test-utils/polyfills/index.ts +2 -0
  694. package/src/theme/_theme.scss +192 -34
  695. package/src/transition/__tests__/utils.ts +25 -0
  696. package/src/transition/useCollapseTransition.ts +6 -24
  697. package/src/transition/utils.ts +10 -5
  698. package/src/typography/SrOnly.tsx +9 -9
  699. package/src/typography/Typography.tsx +19 -19
  700. package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
  701. package/src/typography/_typography.scss +65 -25
  702. package/src/useEnsuredState.ts +1 -1
  703. package/src/utils/alphaNumericSort.ts +3 -16
  704. package/tsconfig.json +2 -2
  705. package/tsconfig.types.json +1 -1
  706. package/dist/form/SelectValue.d.ts +0 -17
  707. package/dist/form/SelectValue.js +0 -32
  708. package/dist/form/SelectValue.js.map +0 -1
  709. package/dist/utils/filters.d.ts +0 -196
  710. package/dist/utils/filters.js +0 -67
  711. package/dist/utils/filters.js.map +0 -1
  712. package/src/form/SelectValue.tsx +0 -39
  713. package/src/utils/filters.ts +0 -320
package/dist/menu/Menu.js CHANGED
@@ -10,6 +10,7 @@ import { useFixedPositioning } from "../positioning/useFixedPositioning.js";
10
10
  import { useScrollLock } from "../scroll/useScrollLock.js";
11
11
  import { useScaleTransition } from "../transition/useScaleTransition.js";
12
12
  import { useEnsuredId } from "../useEnsuredId.js";
13
+ import { useIsomorphicLayoutEffect } from "../useIsomorphicLayoutEffect.js";
13
14
  import { MenuConfigurationProvider, useMenuConfiguration } from "./MenuConfigurationProvider.js";
14
15
  import { MenuSheet } from "./MenuSheet.js";
15
16
  import { MenuWidget } from "./MenuWidget.js";
@@ -125,7 +126,7 @@ const noop = ()=>{
125
126
  return isHoverDisabled || cancelUnmountFocus.current || root && !!activeId && id !== activeId;
126
127
  }
127
128
  });
128
- const { ref, style, callbacks } = useFixedPositioning({
129
+ const { ref, style, callbacks, updateStyle } = useFixedPositioning({
129
130
  ...transitionOptions,
130
131
  onEnter,
131
132
  style: isSheet ? propStyle : menuStyle,
@@ -211,6 +212,16 @@ const noop = ()=>{
211
212
  role,
212
213
  visible
213
214
  ]);
215
+ useIsomorphicLayoutEffect(()=>{
216
+ if (!visible) {
217
+ return;
218
+ }
219
+ updateStyle();
220
+ }, [
221
+ updateStyle,
222
+ children,
223
+ visible
224
+ ]);
214
225
  return /*#__PURE__*/ _jsx(MenuConfigurationProvider, {
215
226
  horizontal: horizontal,
216
227
  renderAsSheet: renderAsSheet,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { type FloatingActionButtonPosition } from \"../button/FloatingActionButton.js\";\nimport { useFocusContainer } from \"../focus/useFocusContainer.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type ListElement, type ListProps } from \"../list/List.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { type CalculateFixedPositionOptions } from \"../positioning/types.js\";\nimport {\n useFixedPositioning,\n type FixedPositioningOptions,\n} from \"../positioning/useFixedPositioning.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n useScaleTransition,\n type ScaleTransitionHookOptions,\n} from \"../transition/useScaleTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport {\n MenuConfigurationProvider,\n useMenuConfiguration,\n type MenuConfiguration,\n type MenuOrientationProps,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuSheet, type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuWidget } from \"./MenuWidget.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\nimport { getDefaultAnchor } from \"./utils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-menu-background-color\"?: string;\n \"--rmd-menu-color\"?: string;\n \"--rmd-menu-min-width\"?: string | number;\n \"--rmd-menu-spacing\"?: string | number;\n }\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @remarks \\@since 5.0.0 */\nexport type MenuTransitionProps = Omit<\n ScaleTransitionHookOptions<HTMLDivElement>,\n \"transitionIn\" | \"vertical\" | \"nodeRef\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface MenuConfigurationProps extends CalculateFixedPositionOptions {\n /**\n * @see {@link ScaleTransitionHookOptions.temporary}\n * @defaultValue `true`\n */\n temporary?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Boolean if the menu should not gain the elevation styles and should only be\n * set to `true` when rendering within a `Sheet`.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @see {@link FixedPositioningOptions.transformOrigin}\n * @defaultValue `true`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the menu should close if the page is scrolled. The default\n * behavior is to just update the position of the menu relative to the menu\n * button until it can no longer be visible within the viewport.\n *\n * @defaultValue `false`\n */\n closeOnScroll?: boolean;\n\n /**\n * Boolean if the page should no longer be scrollable while the menu is\n * visible.\n *\n * @defaultValue `false`\n */\n preventScroll?: boolean;\n\n /**\n * Boolean if the menu should close instead of repositioning itself if the\n * browser window is resized.\n *\n * @defaultValue `false`\n */\n closeOnResize?: boolean;\n\n /** @see {@link FixedPositioningOptions.getFixedPositionOptions} */\n getFixedPositionOptions?(): CalculateFixedPositionOptions;\n}\n\n/**\n * @remarks\n * \\@since 5.1.0\n * \\@since 6.0.0 Renamed from `MenuListProps` to `MenuListConvenienceProps`\n */\nexport interface MenuListConvenienceProps {\n /**\n * An optional style to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listStyle?: CSSProperties;\n\n /**\n * An optional className to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listClassName?: string;\n\n /**\n * Any additional props to pass to the `List` component that surrounds the\n * `Menu`'s `MenuItem`s.\n */\n listProps?: PropsWithRef<Omit<ListProps, \"horizontal\">, ListElement>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface MenuConvenienceProps extends MenuConfigurationProps {\n /**\n * This can be used to apply additional props to the `Menu` component.\n *\n * Note: You can override the `style` and `className` using\n * {@link menuStyle} and {@link menuClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <DropdownMenu\n * {...props}\n * menuProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * getFixedPositionOptions: () => ({\n * preventOverlap: true,\n * }),\n * }}\n * />\n * ```\n */\n menuProps?: PropsWithRef<\n Omit<\n MenuProps,\n | \"children\"\n | \"fixedTo\"\n | \"visible\"\n | \"onRequestClose\"\n | \"getDefaultFocusedIndex\"\n >,\n HTMLDivElement\n >;\n\n /**\n * Convenience prop to apply custom style to the `Menu` component.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Menu` component.\n */\n menuClassName?: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type MenuFixedPositioningOptions = Omit<\n FixedPositioningOptions<HTMLElement, HTMLDivElement>,\n \"onScroll\" | \"onResize\"\n>;\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Updated to use the latest Menu, Transition, and Portal API.\n */\nexport interface MenuProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuConfiguration,\n MenuConfigurationProps,\n MenuFixedPositioningOptions,\n MenuOrientationProps,\n MenuTransitionProps,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps {\n visible: boolean;\n onRequestClose(): void;\n\n /**\n * @defaultValue `\"menu-\" + useId()`\n */\n id?: string;\n\n /**\n * This is used to set the default focus index when the menu is visible.\n *\n * @internal\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * Custom style that should be applied to the menu only while not rendered\n * within a sheet since the {@link style} would be applied to both versions.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Custom class name that should be applied only while not rendered within a\n * sheet.\n */\n menuClassName?: string;\n\n /**\n * @internal\n *\n * This is only used to update the default anchor when the DropdownMenu's\n * toggle is a floating action button.\n */\n floating?: FloatingActionButtonPosition;\n}\n\n/**\n * **Client Component**\n *\n * This component should generally only be used to implement context menus with\n * the `useContextMenu` hook. Otherwise, the `DropdownMenu` component should be\n * used.\n *\n * @see The `useContextMenu` hook for an example.\n *\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Updated this component to implement all the `Menu`\n * functionality instead of requiring the `useMenu` hook and `MenuWidget`\n * component. In addition, the `renderAsSheet` behavior has been moved into this\n * implementation so that the `MenuRenderer` is no longer required and context\n * menus can appear as a `Sheet`.\n */\nexport const Menu = forwardRef<HTMLDivElement, LabelRequiredForA11y<MenuProps>>(\n function Menu(props, propRef) {\n const {\n id: propId,\n style: propStyle,\n role = \"menu\",\n children,\n horizontal: _horizontal,\n sheetHeader: _sheetHeader,\n sheetFooter: _sheetFooter,\n renderAsSheet: _renderAsSheet,\n sheetPosition: _sheetPosition,\n sheetVerticalSize: _sheetVerticalSize,\n sheetProps,\n sheetStyle,\n sheetClassName,\n menuStyle,\n menuClassName,\n disableElevation = false,\n temporary = true,\n tabIndex = -1,\n fixedTo,\n className,\n classNames,\n timeout,\n appear,\n enter,\n exit,\n onEnter,\n onEntering = noop,\n onEntered = noop,\n onExit,\n onExiting,\n onExited = noop,\n onKeyDown = noop,\n listProps,\n listStyle,\n listClassName,\n visible,\n onRequestClose,\n floating,\n anchor,\n closeOnResize = false,\n closeOnScroll = false,\n preventScroll = false,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin = true,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n disablePortal: propDisablePortal,\n disableTransition,\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } =\n props;\n\n const id = useEnsuredId(propId, \"menu\");\n const {\n root,\n menubar,\n menuitem,\n activeId,\n animatedOnceRef,\n hoverTimeoutRef,\n disableHoverMode,\n } = useMenuBarContext();\n const {\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(props);\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const entered = useRef(false);\n const cancelUnmountFocus = useRef(false);\n const hideWithoutRefocus = (): void => {\n cancelUnmountFocus.current = true;\n onRequestClose();\n };\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: propRef,\n activate: visible,\n onKeyDown(event) {\n onKeyDown(event);\n\n // when a menu is within a sheet, it should not trigger the custom\n // keyboard behavior\n if (isSheet) {\n return;\n }\n\n switch (event.key) {\n case \"Escape\":\n // prevent parent components that have an \"Escape\" keypress event\n // from being triggered as well\n event.stopPropagation();\n disableHoverMode();\n onRequestClose();\n break;\n case \"Tab\":\n // since menus are portalled, tab index is kinda broke so just close\n // the menu instead of doing default tab behavior\n event.preventDefault();\n\n if (!menuitem) {\n // pressing the tab key should still cascade close all menus\n event.stopPropagation();\n }\n disableHoverMode();\n onRequestClose();\n break;\n case \"ArrowUp\":\n if (!root && menuitem && horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n case \"ArrowLeft\":\n if (!root && menuitem && !horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n }\n },\n onEntering(appearing) {\n onEntering(appearing);\n entered.current = true;\n },\n onEntered(appearing) {\n onEntered(appearing);\n entered.current = true;\n cancelUnmountFocus.current = false;\n animatedOnceRef.current = true;\n },\n onExited() {\n onExited();\n entered.current = false;\n },\n onExiting,\n disableTransition,\n isFocusTypeDisabled(type) {\n if (role === \"listbox\") {\n return !isSheet;\n }\n\n if (type === \"keyboard\") {\n return isSheet;\n }\n\n const isHoverDisabled = mouse && hoverTimeoutRef.current === 0;\n if (type === \"mount\") {\n return isHoverDisabled;\n }\n\n return (\n isHoverDisabled ||\n cancelUnmountFocus.current ||\n (root && !!activeId && id !== activeId)\n );\n },\n });\n\n const { ref, style, callbacks } = useFixedPositioning({\n ...transitionOptions,\n onEnter,\n style: isSheet ? propStyle : menuStyle,\n fixedTo,\n anchor: getDefaultAnchor({\n anchor,\n menubar,\n floating,\n menuitem: !root && menuitem,\n horizontal,\n }),\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n onResize: closeOnResize ? hideWithoutRefocus : undefined,\n onScroll(_event, data) {\n if (!data.visible || closeOnScroll) {\n hideWithoutRefocus();\n }\n },\n });\n const { rendered, disablePortal, elementProps } = useScaleTransition({\n nodeRef: ref,\n className: cnb(!isSheet && menuClassName, className),\n transitionIn: visible,\n vertical: !horizontal,\n temporary,\n timeout: isSheet || disableTransition ? 0 : timeout,\n classNames,\n appear,\n enter,\n exit,\n onExit,\n onExiting: transitionOptions.onExiting,\n exitedHidden: true,\n ...callbacks,\n });\n useScrollLock(visible && preventScroll);\n\n // need to make sure that the useEffect does not refire for hiding on click\n // events because of the `window.requestAnimationFrame`. It'll make it so\n // that menu items that update state are unable to close when clicked\n const hide = useRef(onRequestClose);\n useEffect(() => {\n hide.current = onRequestClose;\n });\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const callback = (event: globalThis.MouseEvent): void => {\n // this is required for when the transition is disabled\n if (!entered.current) {\n return;\n }\n\n // if the user clicks outside of the menu to close it, the toggle button\n // should not be focused. instead the nearest focusable element from the\n // click event should be focused when Tab or Shift + tab is pressed\n cancelUnmountFocus.current =\n !(event.target instanceof HTMLElement) ||\n !event.target.closest(`[role=\"${role}\"]`);\n\n // this won't be called if `event.stopPropagation()` is called\n hide.current();\n disableHoverMode();\n };\n\n // wait an animation frame so the initial click event that caused the menu\n // to become visible does not immediately close the menu\n const frame = window.requestAnimationFrame(() => {\n window.addEventListener(\"click\", callback);\n });\n\n return () => {\n window.cancelAnimationFrame(frame);\n window.removeEventListener(\"click\", callback);\n };\n }, [disableHoverMode, role, visible]);\n\n return (\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n <MenuSheet\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy as string}\n header={sheetHeader}\n footer={sheetFooter}\n position={sheetPosition}\n verticalSize={sheetVerticalSize}\n visible={visible}\n enabled={isSheet}\n onRequestClose={onRequestClose}\n style={sheetStyle}\n className={sheetClassName}\n disablePortal={propDisablePortal}\n temporary={temporary}\n disableTransition={disableTransition}\n {...sheetProps}\n >\n <Portal disabled={isSheet || (propDisablePortal ?? disablePortal)}>\n {(rendered || isSheet) && (\n <MenuWidget\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n style={isSheet ? propStyle : style}\n isSheet={isSheet}\n tabIndex={tabIndex}\n horizontal={horizontal}\n listProps={listProps}\n listStyle={listStyle}\n listClassName={listClassName}\n disableElevation={disableElevation}\n cancelUnmountFocus={cancelUnmountFocus}\n >\n {children}\n </MenuWidget>\n )}\n </Portal>\n </MenuSheet>\n </MenuConfigurationProvider>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEffect","useRef","useFocusContainer","useUserInteractionMode","useAppSize","Portal","useFixedPositioning","useScrollLock","useScaleTransition","useEnsuredId","MenuConfigurationProvider","useMenuConfiguration","MenuSheet","MenuWidget","useMenuBarContext","getDefaultAnchor","noop","Menu","props","propRef","id","propId","style","propStyle","role","children","horizontal","_horizontal","sheetHeader","_sheetHeader","sheetFooter","_sheetFooter","renderAsSheet","_renderAsSheet","sheetPosition","_sheetPosition","sheetVerticalSize","_sheetVerticalSize","sheetProps","sheetStyle","sheetClassName","menuStyle","menuClassName","disableElevation","temporary","tabIndex","fixedTo","className","classNames","timeout","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","listProps","listStyle","listClassName","visible","onRequestClose","floating","anchor","closeOnResize","closeOnScroll","preventScroll","vwMargin","vhMargin","xMargin","yMargin","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","initialX","initialY","getFixedPositionOptions","disablePortal","propDisablePortal","disableTransition","remaining","ariaLabel","ariaLabelledBy","root","menubar","menuitem","activeId","animatedOnceRef","hoverTimeoutRef","disableHoverMode","isPhone","isSheet","entered","cancelUnmountFocus","hideWithoutRefocus","current","mode","mouse","eventHandlers","transitionOptions","nodeRef","activate","event","key","stopPropagation","preventDefault","appearing","isFocusTypeDisabled","type","isHoverDisabled","ref","callbacks","onResize","undefined","onScroll","_event","data","rendered","elementProps","transitionIn","vertical","exitedHidden","hide","callback","target","HTMLElement","closest","frame","window","requestAnimationFrame","addEventListener","cancelAnimationFrame","removeEventListener","aria-label","aria-labelledby","header","footer","position","verticalSize","enabled","disabled"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,SAAS,EACTC,MAAM,QAGD,QAAQ;AAEf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SACEC,mBAAmB,QAEd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SACEC,kBAAkB,QAEb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SACEC,yBAAyB,EACzBC,oBAAoB,QAGf,iCAAiC;AACxC,SAASC,SAAS,QAAwC,iBAAiB;AAC3E,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,gBAAgB,QAAQ,aAAa;AAW9C,MAAMC,OAAO;AACX,aAAa;AACf;AA2MA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,qBAAOlB,WAClB,SAASkB,KAAKC,KAAK,EAAEC,OAAO;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAOC,SAAS,EAChBC,OAAO,MAAM,EACbC,QAAQ,EACRC,YAAYC,WAAW,EACvBC,aAAaC,YAAY,EACzBC,aAAaC,YAAY,EACzBC,eAAeC,cAAc,EAC7BC,eAAeC,cAAc,EAC7BC,mBAAmBC,kBAAkB,EACrCC,UAAU,EACVC,UAAU,EAC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],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport {\n forwardRef,\n useEffect,\n useRef,\n type CSSProperties,\n type HTMLAttributes,\n} from \"react\";\nimport { type FloatingActionButtonPosition } from \"../button/FloatingActionButton.js\";\nimport { useFocusContainer } from \"../focus/useFocusContainer.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type ListElement, type ListProps } from \"../list/List.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { type CalculateFixedPositionOptions } from \"../positioning/types.js\";\nimport {\n useFixedPositioning,\n type FixedPositioningOptions,\n} from \"../positioning/useFixedPositioning.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n useScaleTransition,\n type ScaleTransitionHookOptions,\n} from \"../transition/useScaleTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n MenuConfigurationProvider,\n useMenuConfiguration,\n type MenuConfiguration,\n type MenuOrientationProps,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuSheet, type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuWidget } from \"./MenuWidget.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\nimport { getDefaultAnchor } from \"./utils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-menu-background-color\"?: string;\n \"--rmd-menu-color\"?: string;\n \"--rmd-menu-min-width\"?: string | number;\n \"--rmd-menu-spacing\"?: string | number;\n }\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @remarks \\@since 5.0.0 */\nexport type MenuTransitionProps = Omit<\n ScaleTransitionHookOptions<HTMLDivElement>,\n \"transitionIn\" | \"vertical\" | \"nodeRef\"\n>;\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface MenuConfigurationProps extends CalculateFixedPositionOptions {\n /**\n * @see {@link ScaleTransitionHookOptions.temporary}\n * @defaultValue `true`\n */\n temporary?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Boolean if the menu should not gain the elevation styles and should only be\n * set to `true` when rendering within a `Sheet`.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @see {@link FixedPositioningOptions.transformOrigin}\n * @defaultValue `true`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the menu should close if the page is scrolled. The default\n * behavior is to just update the position of the menu relative to the menu\n * button until it can no longer be visible within the viewport.\n *\n * @defaultValue `false`\n */\n closeOnScroll?: boolean;\n\n /**\n * Boolean if the page should no longer be scrollable while the menu is\n * visible.\n *\n * @defaultValue `false`\n */\n preventScroll?: boolean;\n\n /**\n * Boolean if the menu should close instead of repositioning itself if the\n * browser window is resized.\n *\n * @defaultValue `false`\n */\n closeOnResize?: boolean;\n\n /** @see {@link FixedPositioningOptions.getFixedPositionOptions} */\n getFixedPositionOptions?(): CalculateFixedPositionOptions;\n}\n\n/**\n * @remarks\n * \\@since 5.1.0\n * \\@since 6.0.0 Renamed from `MenuListProps` to `MenuListConvenienceProps`\n */\nexport interface MenuListConvenienceProps {\n /**\n * An optional style to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listStyle?: CSSProperties;\n\n /**\n * An optional className to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listClassName?: string;\n\n /**\n * Any additional props to pass to the `List` component that surrounds the\n * `Menu`'s `MenuItem`s.\n */\n listProps?: PropsWithRef<Omit<ListProps, \"horizontal\">, ListElement>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface MenuConvenienceProps extends MenuConfigurationProps {\n /**\n * This can be used to apply additional props to the `Menu` component.\n *\n * Note: You can override the `style` and `className` using\n * {@link menuStyle} and {@link menuClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <DropdownMenu\n * {...props}\n * menuProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * getFixedPositionOptions: () => ({\n * preventOverlap: true,\n * }),\n * }}\n * />\n * ```\n */\n menuProps?: PropsWithRef<\n Omit<\n MenuProps,\n | \"children\"\n | \"fixedTo\"\n | \"visible\"\n | \"onRequestClose\"\n | \"getDefaultFocusedIndex\"\n >,\n HTMLDivElement\n >;\n\n /**\n * Convenience prop to apply custom style to the `Menu` component.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Menu` component.\n */\n menuClassName?: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type MenuFixedPositioningOptions = Omit<\n FixedPositioningOptions<HTMLElement, HTMLDivElement>,\n \"onScroll\" | \"onResize\"\n>;\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Updated to use the latest Menu, Transition, and Portal API.\n */\nexport interface MenuProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuConfiguration,\n MenuConfigurationProps,\n MenuFixedPositioningOptions,\n MenuOrientationProps,\n MenuTransitionProps,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps {\n visible: boolean;\n onRequestClose(): void;\n\n /**\n * @defaultValue `\"menu-\" + useId()`\n */\n id?: string;\n\n /**\n * This is used to set the default focus index when the menu is visible.\n *\n * @internal\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * Custom style that should be applied to the menu only while not rendered\n * within a sheet since the {@link style} would be applied to both versions.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Custom class name that should be applied only while not rendered within a\n * sheet.\n */\n menuClassName?: string;\n\n /**\n * @internal\n *\n * This is only used to update the default anchor when the DropdownMenu's\n * toggle is a floating action button.\n */\n floating?: FloatingActionButtonPosition;\n}\n\n/**\n * **Client Component**\n *\n * This component should generally only be used to implement context menus with\n * the `useContextMenu` hook. Otherwise, the `DropdownMenu` component should be\n * used.\n *\n * @see The `useContextMenu` hook for an example.\n *\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Updated this component to implement all the `Menu`\n * functionality instead of requiring the `useMenu` hook and `MenuWidget`\n * component. In addition, the `renderAsSheet` behavior has been moved into this\n * implementation so that the `MenuRenderer` is no longer required and context\n * menus can appear as a `Sheet`.\n */\nexport const Menu = forwardRef<HTMLDivElement, LabelRequiredForA11y<MenuProps>>(\n function Menu(props, propRef) {\n const {\n id: propId,\n style: propStyle,\n role = \"menu\",\n children,\n horizontal: _horizontal,\n sheetHeader: _sheetHeader,\n sheetFooter: _sheetFooter,\n renderAsSheet: _renderAsSheet,\n sheetPosition: _sheetPosition,\n sheetVerticalSize: _sheetVerticalSize,\n sheetProps,\n sheetStyle,\n sheetClassName,\n menuStyle,\n menuClassName,\n disableElevation = false,\n temporary = true,\n tabIndex = -1,\n fixedTo,\n className,\n classNames,\n timeout,\n appear,\n enter,\n exit,\n onEnter,\n onEntering = noop,\n onEntered = noop,\n onExit,\n onExiting,\n onExited = noop,\n onKeyDown = noop,\n listProps,\n listStyle,\n listClassName,\n visible,\n onRequestClose,\n floating,\n anchor,\n closeOnResize = false,\n closeOnScroll = false,\n preventScroll = false,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin = true,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n disablePortal: propDisablePortal,\n disableTransition,\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } =\n props;\n\n const id = useEnsuredId(propId, \"menu\");\n const {\n root,\n menubar,\n menuitem,\n activeId,\n animatedOnceRef,\n hoverTimeoutRef,\n disableHoverMode,\n } = useMenuBarContext();\n const {\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(props);\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const entered = useRef(false);\n const cancelUnmountFocus = useRef(false);\n const hideWithoutRefocus = (): void => {\n cancelUnmountFocus.current = true;\n onRequestClose();\n };\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: propRef,\n activate: visible,\n onKeyDown(event) {\n onKeyDown(event);\n\n // when a menu is within a sheet, it should not trigger the custom\n // keyboard behavior\n if (isSheet) {\n return;\n }\n\n switch (event.key) {\n case \"Escape\":\n // prevent parent components that have an \"Escape\" keypress event\n // from being triggered as well\n event.stopPropagation();\n disableHoverMode();\n onRequestClose();\n break;\n case \"Tab\":\n // since menus are portalled, tab index is kinda broke so just close\n // the menu instead of doing default tab behavior\n event.preventDefault();\n\n if (!menuitem) {\n // pressing the tab key should still cascade close all menus\n event.stopPropagation();\n }\n disableHoverMode();\n onRequestClose();\n break;\n case \"ArrowUp\":\n if (!root && menuitem && horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n case \"ArrowLeft\":\n if (!root && menuitem && !horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n }\n },\n onEntering(appearing) {\n onEntering(appearing);\n entered.current = true;\n },\n onEntered(appearing) {\n onEntered(appearing);\n entered.current = true;\n cancelUnmountFocus.current = false;\n animatedOnceRef.current = true;\n },\n onExited() {\n onExited();\n entered.current = false;\n },\n onExiting,\n disableTransition,\n isFocusTypeDisabled(type) {\n if (role === \"listbox\") {\n return !isSheet;\n }\n\n if (type === \"keyboard\") {\n return isSheet;\n }\n\n const isHoverDisabled = mouse && hoverTimeoutRef.current === 0;\n if (type === \"mount\") {\n return isHoverDisabled;\n }\n\n return (\n isHoverDisabled ||\n cancelUnmountFocus.current ||\n (root && !!activeId && id !== activeId)\n );\n },\n });\n\n const { ref, style, callbacks, updateStyle } = useFixedPositioning({\n ...transitionOptions,\n onEnter,\n style: isSheet ? propStyle : menuStyle,\n fixedTo,\n anchor: getDefaultAnchor({\n anchor,\n menubar,\n floating,\n menuitem: !root && menuitem,\n horizontal,\n }),\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n onResize: closeOnResize ? hideWithoutRefocus : undefined,\n onScroll(_event, data) {\n if (!data.visible || closeOnScroll) {\n hideWithoutRefocus();\n }\n },\n });\n const { rendered, disablePortal, elementProps } = useScaleTransition({\n nodeRef: ref,\n className: cnb(!isSheet && menuClassName, className),\n transitionIn: visible,\n vertical: !horizontal,\n temporary,\n timeout: isSheet || disableTransition ? 0 : timeout,\n classNames,\n appear,\n enter,\n exit,\n onExit,\n onExiting: transitionOptions.onExiting,\n exitedHidden: true,\n ...callbacks,\n });\n useScrollLock(visible && preventScroll);\n\n // need to make sure that the useEffect does not refire for hiding on click\n // events because of the `window.requestAnimationFrame`. It'll make it so\n // that menu items that update state are unable to close when clicked\n const hide = useRef(onRequestClose);\n useEffect(() => {\n hide.current = onRequestClose;\n });\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const callback = (event: globalThis.MouseEvent): void => {\n // this is required for when the transition is disabled\n if (!entered.current) {\n return;\n }\n\n // if the user clicks outside of the menu to close it, the toggle button\n // should not be focused. instead the nearest focusable element from the\n // click event should be focused when Tab or Shift + tab is pressed\n cancelUnmountFocus.current =\n !(event.target instanceof HTMLElement) ||\n !event.target.closest(`[role=\"${role}\"]`);\n\n // this won't be called if `event.stopPropagation()` is called\n hide.current();\n disableHoverMode();\n };\n\n // wait an animation frame so the initial click event that caused the menu\n // to become visible does not immediately close the menu\n const frame = window.requestAnimationFrame(() => {\n window.addEventListener(\"click\", callback);\n });\n\n return () => {\n window.cancelAnimationFrame(frame);\n window.removeEventListener(\"click\", callback);\n };\n }, [disableHoverMode, role, visible]);\n useIsomorphicLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n updateStyle();\n }, [updateStyle, children, visible]);\n\n return (\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n <MenuSheet\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy as string}\n header={sheetHeader}\n footer={sheetFooter}\n position={sheetPosition}\n verticalSize={sheetVerticalSize}\n visible={visible}\n enabled={isSheet}\n onRequestClose={onRequestClose}\n style={sheetStyle}\n className={sheetClassName}\n disablePortal={propDisablePortal}\n temporary={temporary}\n disableTransition={disableTransition}\n {...sheetProps}\n >\n <Portal disabled={isSheet || (propDisablePortal ?? disablePortal)}>\n {(rendered || isSheet) && (\n <MenuWidget\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n style={isSheet ? propStyle : style}\n isSheet={isSheet}\n tabIndex={tabIndex}\n horizontal={horizontal}\n listProps={listProps}\n listStyle={listStyle}\n listClassName={listClassName}\n disableElevation={disableElevation}\n cancelUnmountFocus={cancelUnmountFocus}\n >\n {children}\n </MenuWidget>\n )}\n </Portal>\n </MenuSheet>\n </MenuConfigurationProvider>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEffect","useRef","useFocusContainer","useUserInteractionMode","useAppSize","Portal","useFixedPositioning","useScrollLock","useScaleTransition","useEnsuredId","useIsomorphicLayoutEffect","MenuConfigurationProvider","useMenuConfiguration","MenuSheet","MenuWidget","useMenuBarContext","getDefaultAnchor","noop","Menu","props","propRef","id","propId","style","propStyle","role","children","horizontal","_horizontal","sheetHeader","_sheetHeader","sheetFooter","_sheetFooter","renderAsSheet","_renderAsSheet","sheetPosition","_sheetPosition","sheetVerticalSize","_sheetVerticalSize","sheetProps","sheetStyle","sheetClassName","menuStyle","menuClassName","disableElevation","temporary","tabIndex","fixedTo","className","classNames","timeout","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","listProps","listStyle","listClassName","visible","onRequestClose","floating","anchor","closeOnResize","closeOnScroll","preventScroll","vwMargin","vhMargin","xMargin","yMargin","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","initialX","initialY","getFixedPositionOptions","disablePortal","propDisablePortal","disableTransition","remaining","ariaLabel","ariaLabelledBy","root","menubar","menuitem","activeId","animatedOnceRef","hoverTimeoutRef","disableHoverMode","isPhone","isSheet","entered","cancelUnmountFocus","hideWithoutRefocus","current","mode","mouse","eventHandlers","transitionOptions","nodeRef","activate","event","key","stopPropagation","preventDefault","appearing","isFocusTypeDisabled","type","isHoverDisabled","ref","callbacks","updateStyle","onResize","undefined","onScroll","_event","data","rendered","elementProps","transitionIn","vertical","exitedHidden","hide","callback","target","HTMLElement","closest","frame","window","requestAnimationFrame","addEventListener","cancelAnimationFrame","removeEventListener","aria-label","aria-labelledby","header","footer","position","verticalSize","enabled","disabled"],"mappings":"AAAA;;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SACEC,UAAU,EACVC,SAAS,EACTC,MAAM,QAGD,QAAQ;AAEf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SACEC,mBAAmB,QAEd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SACEC,kBAAkB,QAEb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SACEC,yBAAyB,EACzBC,oBAAoB,QAGf,iCAAiC;AACxC,SAASC,SAAS,QAAwC,iBAAiB;AAC3E,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,gBAAgB,QAAQ,aAAa;A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ACfvC,WAAWA;YACXwC,mBAAmBA;YAClB,GAAG9C,UAAU;sBAEd,cAAA,KAAClC;gBAAO8I,UAAUlD,WAAYb,CAAAA,qBAAqBD,aAAY;0BAC5D,AAACyC,CAAAA,YAAY3B,OAAM,mBAClB,KAACnF;oBACE,GAAGwE,SAAS;oBACZ,GAAGuC,YAAY;oBACf,GAAGrB,aAAa;oBACjBnF,IAAIA;oBACJI,MAAMA;oBACNF,OAAO0E,UAAUzE,YAAYD;oBAC7B0E,SAASA;oBACTnD,UAAUA;oBACVnB,YAAYA;oBACZkC,WAAWA;oBACXC,WAAWA;oBACXC,eAAeA;oBACfnB,kBAAkBA;oBAClBuD,oBAAoBA;8BAEnBzE;;;;;AAOf,GACA"}
@@ -44,6 +44,7 @@ $variables: (background-color, color, min-width, spacing);
44
44
  .rmd-menu {
45
45
  outline: none;
46
46
  overflow: auto;
47
+ overflow-wrap: anywhere;
47
48
 
48
49
  &--elevated {
49
50
  @include box-shadows.box-shadow(
@@ -57,15 +57,15 @@ export interface ContextMenuImplementation extends UseStateObject<"visible", boo
57
57
  * const { menuProps, onContextMenu } = useContextMenu();
58
58
  *
59
59
  * return (
60
- * <div onContextMenu={onContextMenu}>
61
- * <textarea />
60
+ * <>
61
+ * <textarea onContextMenu={onContextMenu} />
62
62
  * <Menu {...menuProps}>
63
63
  * <MenuItem>Cut</MenuItem>
64
64
  * <MenuItem>Copy</MenuItem>
65
65
  * <MenuItem>Paste</MenuItem>
66
66
  * <MenuItem>Undo</MenuItem>
67
67
  * </Menu>
68
- * </div>
68
+ * </>
69
69
  * );
70
70
  * }
71
71
  * ```
@@ -17,15 +17,15 @@ const noop = ()=>{
17
17
  * const { menuProps, onContextMenu } = useContextMenu();
18
18
  *
19
19
  * return (
20
- * <div onContextMenu={onContextMenu}>
21
- * <textarea />
20
+ * <>
21
+ * <textarea onContextMenu={onContextMenu} />
22
22
  * <Menu {...menuProps}>
23
23
  * <MenuItem>Cut</MenuItem>
24
24
  * <MenuItem>Copy</MenuItem>
25
25
  * <MenuItem>Paste</MenuItem>
26
26
  * <MenuItem>Undo</MenuItem>
27
27
  * </Menu>
28
- * </div>
28
+ * </>
29
29
  * );
30
30
  * }
31
31
  * ```
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/menu/useContextMenu.ts"],"sourcesContent":["\"use client\";\nimport type { MouseEvent, RefObject } from \"react\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { BELOW_INNER_LEFT_ANCHOR } from \"../positioning/constants.js\";\nimport type { InitialCoords, PositionAnchor } from \"../positioning/types.js\";\nimport type { UseStateObject } from \"../types.js\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface ContextMenuProps extends InitialCoords {\n \"aria-label\": string;\n anchor: PositionAnchor;\n fixedTo: RefObject<HTMLElement>;\n visible: boolean;\n preventScroll: boolean;\n onRequestClose(): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Dropped most options since they are no longer required for the\n * context menu to work. Apply any `Menu` props directly to the `Menu` component\n * instead.\n */\nexport interface ContextMenuHookOptions {\n /**\n * @defaultValue `BELOW_INNER_LEFT_ANCHOR`\n * @see {@link BELOW_INNER_LEFT_ANCHOR}\n */\n anchor?: PositionAnchor;\n\n /**\n * @defaultValue `\"Context Menu\"`\n */\n menuLabel?: string;\n\n /**\n * @defaultValue `true`\n */\n preventScroll?: boolean;\n onContextMenu?<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Renamed from `ContextMenuHookReturnValue` to\n * `ContextMenuImplementation` and dropped the `menuRef` and `menuNodeRef`\n * fields.\n */\nexport interface ContextMenuImplementation\n extends UseStateObject<\"visible\", boolean> {\n menuProps: ContextMenuProps;\n onContextMenu<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * This hook controls the visibility and positioning for a context menu.\n *\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import [ Menu, MenuItem, useContextMenu ] from \"@react-md/core\":\n *\n * function Example(): ReactElement {\n * const { menuProps, onContextMenu } = useContextMenu();\n *\n * return (\n * <div onContextMenu={onContextMenu}>\n * <textarea />\n * <Menu {...menuProps}>\n * <MenuItem>Cut</MenuItem>\n * <MenuItem>Copy</MenuItem>\n * <MenuItem>Paste</MenuItem>\n * <MenuItem>Undo</MenuItem>\n * </Menu>\n * </div>\n * );\n * }\n * ```\n *\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 No longer supports overriding most of the `Menu` props. The\n * props must be passed to the `Menu` component manually.\n */\nexport function useContextMenu(\n options: ContextMenuHookOptions = {}\n): ContextMenuImplementation {\n const {\n anchor = BELOW_INNER_LEFT_ANCHOR,\n menuLabel = \"Context Menu\",\n onContextMenu = noop,\n preventScroll = true,\n } = options;\n const [coords, setCoords] = useState<InitialCoords>({});\n const [visible, setVisible] = useState(false);\n const fixedTo = useRef<HTMLElement>(null);\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, []);\n\n return {\n visible,\n setVisible,\n menuProps: {\n \"aria-label\": menuLabel,\n anchor,\n ...coords,\n fixedTo,\n visible,\n onRequestClose,\n preventScroll,\n },\n onContextMenu(event) {\n onContextMenu(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n setCoords({\n initialX: event.clientX,\n initialY: event.clientY,\n });\n setVisible(true);\n },\n };\n}\n"],"names":["useCallback","useRef","useState","BELOW_INNER_LEFT_ANCHOR","noop","useContextMenu","options","anchor","menuLabel","onContextMenu","preventScroll","coords","setCoords","visible","setVisible","fixedTo","onRequestClose","menuProps","event","isPropagationStopped","preventDefault","stopPropagation","initialX","clientX","initialY","clientY"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACtD,SAASC,uBAAuB,QAAQ,8BAA8B;AAqDtE,MAAMC,OAAO;AACX,aAAa;AACf;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GACD,OAAO,SAASC,eACdC,UAAkC,CAAC,CAAC;IAEpC,MAAM,EACJC,SAASJ,uBAAuB,EAChCK,YAAY,cAAc,EAC1BC,gBAAgBL,IAAI,EACpBM,gBAAgB,IAAI,EACrB,GAAGJ;IACJ,MAAM,CAACK,QAAQC,UAAU,GAAGV,SAAwB,CAAC;IACrD,MAAM,CAACW,SAASC,WAAW,GAAGZ,SAAS;IACvC,MAAMa,UAAUd,OAAoB;IACpC,MAAMe,iBAAiBhB,YAAY;QACjCc,WAAW;IACb,GAAG,EAAE;IAEL,OAAO;QACLD;QACAC;QACAG,WAAW;YACT,cAAcT;YACdD;YACA,GAAGI,MAAM;YACTI;YACAF;YACAG;YACAN;QACF;QACAD,eAAcS,KAAK;YACjBT,cAAcS;YACd,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAD,MAAME,cAAc;YACpBF,MAAMG,eAAe;YACrBT,UAAU;gBACRU,UAAUJ,MAAMK,OAAO;gBACvBC,UAAUN,MAAMO,OAAO;YACzB;YACAX,WAAW;QACb;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/menu/useContextMenu.ts"],"sourcesContent":["\"use client\";\nimport type { MouseEvent, RefObject } from \"react\";\nimport { useCallback, useRef, useState } from \"react\";\nimport { BELOW_INNER_LEFT_ANCHOR } from \"../positioning/constants.js\";\nimport type { InitialCoords, PositionAnchor } from \"../positioning/types.js\";\nimport type { UseStateObject } from \"../types.js\";\n\n/** @remarks \\@since 6.0.0 */\nexport interface ContextMenuProps extends InitialCoords {\n \"aria-label\": string;\n anchor: PositionAnchor;\n fixedTo: RefObject<HTMLElement>;\n visible: boolean;\n preventScroll: boolean;\n onRequestClose(): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Dropped most options since they are no longer required for the\n * context menu to work. Apply any `Menu` props directly to the `Menu` component\n * instead.\n */\nexport interface ContextMenuHookOptions {\n /**\n * @defaultValue `BELOW_INNER_LEFT_ANCHOR`\n * @see {@link BELOW_INNER_LEFT_ANCHOR}\n */\n anchor?: PositionAnchor;\n\n /**\n * @defaultValue `\"Context Menu\"`\n */\n menuLabel?: string;\n\n /**\n * @defaultValue `true`\n */\n preventScroll?: boolean;\n onContextMenu?<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Renamed from `ContextMenuHookReturnValue` to\n * `ContextMenuImplementation` and dropped the `menuRef` and `menuNodeRef`\n * fields.\n */\nexport interface ContextMenuImplementation\n extends UseStateObject<\"visible\", boolean> {\n menuProps: ContextMenuProps;\n onContextMenu<E extends HTMLElement>(event: MouseEvent<E>): void;\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/**\n * This hook controls the visibility and positioning for a context menu.\n *\n * @example\n * Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import [ Menu, MenuItem, useContextMenu ] from \"@react-md/core\":\n *\n * function Example(): ReactElement {\n * const { menuProps, onContextMenu } = useContextMenu();\n *\n * return (\n * <>\n * <textarea onContextMenu={onContextMenu} />\n * <Menu {...menuProps}>\n * <MenuItem>Cut</MenuItem>\n * <MenuItem>Copy</MenuItem>\n * <MenuItem>Paste</MenuItem>\n * <MenuItem>Undo</MenuItem>\n * </Menu>\n * </>\n * );\n * }\n * ```\n *\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 No longer supports overriding most of the `Menu` props. The\n * props must be passed to the `Menu` component manually.\n */\nexport function useContextMenu(\n options: ContextMenuHookOptions = {}\n): ContextMenuImplementation {\n const {\n anchor = BELOW_INNER_LEFT_ANCHOR,\n menuLabel = \"Context Menu\",\n onContextMenu = noop,\n preventScroll = true,\n } = options;\n const [coords, setCoords] = useState<InitialCoords>({});\n const [visible, setVisible] = useState(false);\n const fixedTo = useRef<HTMLElement>(null);\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, []);\n\n return {\n visible,\n setVisible,\n menuProps: {\n \"aria-label\": menuLabel,\n anchor,\n ...coords,\n fixedTo,\n visible,\n onRequestClose,\n preventScroll,\n },\n onContextMenu(event) {\n onContextMenu(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n setCoords({\n initialX: event.clientX,\n initialY: event.clientY,\n });\n setVisible(true);\n },\n };\n}\n"],"names":["useCallback","useRef","useState","BELOW_INNER_LEFT_ANCHOR","noop","useContextMenu","options","anchor","menuLabel","onContextMenu","preventScroll","coords","setCoords","visible","setVisible","fixedTo","onRequestClose","menuProps","event","isPropagationStopped","preventDefault","stopPropagation","initialX","clientX","initialY","clientY"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AACtD,SAASC,uBAAuB,QAAQ,8BAA8B;AAqDtE,MAAMC,OAAO;AACX,aAAa;AACf;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8BC,GACD,OAAO,SAASC,eACdC,UAAkC,CAAC,CAAC;IAEpC,MAAM,EACJC,SAASJ,uBAAuB,EAChCK,YAAY,cAAc,EAC1BC,gBAAgBL,IAAI,EACpBM,gBAAgB,IAAI,EACrB,GAAGJ;IACJ,MAAM,CAACK,QAAQC,UAAU,GAAGV,SAAwB,CAAC;IACrD,MAAM,CAACW,SAASC,WAAW,GAAGZ,SAAS;IACvC,MAAMa,UAAUd,OAAoB;IACpC,MAAMe,iBAAiBhB,YAAY;QACjCc,WAAW;IACb,GAAG,EAAE;IAEL,OAAO;QACLD;QACAC;QACAG,WAAW;YACT,cAAcT;YACdD;YACA,GAAGI,MAAM;YACTI;YACAF;YACAG;YACAN;QACF;QACAD,eAAcS,KAAK;YACjBT,cAAcS;YACd,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAD,MAAME,cAAc;YACpBF,MAAMG,eAAe;YACrBT,UAAU;gBACRU,UAAUJ,MAAMK,OAAO;gBACvBC,UAAUN,MAAMO,OAAO;YACzB;YACAX,WAAW;QACb;IACF;AACF"}
@@ -17,6 +17,23 @@ import type { NonNullMutableRef, NonNullRef, UseStateSetter } from "../types.js"
17
17
  * @remarks \@since 6.0.0
18
18
  */
19
19
  export type TabIndexBehavior = "roving" | "virtual";
20
+ /**
21
+ * This should be used for specific widgets that should not include all
22
+ * focusable elements and instead only specific elements.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const getExpansionPanelsOnly: GetFocusableElements = (container) =>
27
+ * [...container.querySelectorAll(".rmd-expansion-panel__button")];
28
+ *
29
+ * const getTreeItemsOnly: GetFocusableElements = (container) =>
30
+ * [...container.querySelectorAll("[role='treeitem']")];
31
+ * ```
32
+ *
33
+ * @defaultValue `getFocusableElements`
34
+ * @see the default `getFocusableElements` function.
35
+ */
36
+ export type GetFocusableElements = (container: HTMLElement, programmatic: boolean) => readonly HTMLElement[];
20
37
  /**
21
38
  * @remarks \@since 5.0.0
22
39
  */
@@ -126,7 +143,12 @@ export type GetDefaultFocusedIndex = (options: FocusableIndexOptions) => number;
126
143
  * @remarks \@since 6.0.0
127
144
  * @internal
128
145
  */
129
- export interface FocusChangeEvent {
146
+ export type ExtendKeyDown<E extends HTMLElement> = (movementData: KeyboardMovementExtensionData<E>) => void;
147
+ /**
148
+ * @remarks \@since 6.0.0
149
+ * @internal
150
+ */
151
+ export interface KeyboardMovementFocusChangeEvent {
130
152
  index: number;
131
153
  element: HTMLElement;
132
154
  }
@@ -134,7 +156,7 @@ export interface FocusChangeEvent {
134
156
  * @remarks \@since 6.0.0
135
157
  * @internal
136
158
  */
137
- export type KeyboardMovementFocusChangeEvent = (event: FocusChangeEvent) => void;
159
+ export type KeyboardMovementFocusChangeEventHandler = (event: KeyboardMovementFocusChangeEvent) => void;
138
160
  /**
139
161
  * @remarks \@since 6.0.0
140
162
  * @internal
@@ -155,14 +177,16 @@ export interface KeyboardMovementProviderOptions<E extends HTMLElement> extends
155
177
  onClick?(event: MouseEvent<E>): void;
156
178
  onFocus?(event: FocusEvent<E>): void;
157
179
  onKeyDown?(event: KeyboardEvent<E>): void;
180
+ /** @defaultValue `false` */
181
+ disabled?: boolean;
158
182
  /**
159
183
  * This is used to implement custom keyboard movement for the `keydown` event.
160
184
  */
161
- extendKeyDown?(movementData: KeyboardMovementExtensionData<E>): void;
185
+ extendKeyDown?: ExtendKeyDown<E>;
162
186
  /**
163
187
  * Triggered whenever the focus changes.
164
188
  */
165
- onFocusChange?: KeyboardMovementFocusChangeEvent;
189
+ onFocusChange?: KeyboardMovementFocusChangeEventHandler;
166
190
  /**
167
191
  * From what I've understood so far, programmatically focusable elements
168
192
  * should only be included when disabled elements via `aria-disabled` are
@@ -171,28 +195,22 @@ export interface KeyboardMovementProviderOptions<E extends HTMLElement> extends
171
195
  * @defaultValue `includeDisabled`
172
196
  */
173
197
  programmatic?: boolean;
174
- /**
175
- * This should be used for specific widgets that should not include all
176
- * focusable elements and instead only specific elements.
177
- *
178
- * @example
179
- * ```ts
180
- * const getExpansionPanelsOnly = (container: HTMLElement): readonly HTMLElement[] =>
181
- * container.querySelectorAll(".rmd-expansion-panel__button");
182
- *
183
- * const getTreeItemsOnly = (container: HTMLElement): readonly HTMLElement[] =>
184
- * container.querySelectorAll("[role='treeitem']");
185
- * ```
186
- *
187
- * @defaultValue `getFocusableElements`
188
- * @see the default `getFocusableElements` function.
189
- */
190
- getFocusableElements?(container: HTMLElement, programmatic: boolean): readonly HTMLElement[];
198
+ /** @see {@link GetFocusableElements} */
199
+ getFocusableElements?: GetFocusableElements;
191
200
  /**
192
201
  * This can be used to set the initial focus index whenever the container
193
202
  * element is first focused or the focus index is `-1` on other focus events.
194
203
  */
195
204
  getDefaultFocusedIndex?: GetDefaultFocusedIndex;
205
+ /**
206
+ * This was added to support editable combobox behavior. As the user types or
207
+ * uses native input keyboard behavior, the focus index should be reset to
208
+ * `-1` so that the next "ArrowDown" event focuses the first option again
209
+ * instead of the last selected one.
210
+ *
211
+ * @defaultValue `false`
212
+ */
213
+ isNegativeOneAllowed?: boolean;
196
214
  }
197
215
  /**
198
216
  * @remarks \@since 6.0.0
@@ -226,5 +244,6 @@ export interface KeyboardMovementProviderImplementation<E extends HTMLElement> {
226
244
  movementProps: Readonly<KeyboardMovementProps<E>>;
227
245
  movementContext: Readonly<KeyboardMovementContext>;
228
246
  currentFocusIndex: NonNullMutableRef<number>;
247
+ activeDescendantId: string;
229
248
  setActiveDescendantId: UseStateSetter<string>;
230
249
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/movement/types.ts"],"sourcesContent":["import type {\n FocusEvent,\n FocusEventHandler,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n} from \"react\";\nimport type {\n NonNullMutableRef,\n NonNullRef,\n UseStateSetter,\n} from \"../types.js\";\n\n/**\n * Set this to `\"roving\"` when:\n * - there are a group of focusable elements that have a `tabIndex={-1}`\n * - the container element defaults to having a `tabIndex={0}`\n * - if the container is focused, it should no longer be included in the normal\n * tab flow. Instead, the current focused element should be included instead\n * by changing its `tabIndex` from `-1` to `0`\n *\n * Set this to `\"virtual\"` when:\n * - the container element should never lose focus\n * - the \"focused\" element only gains focus styles instead of being focused\n * - the container element specifies an `aria-activedescendant` pointing to one\n * of the ids for the child \"focusable\" elements\n *\n * @remarks \\@since 6.0.0\n */\nexport type TabIndexBehavior = \"roving\" | \"virtual\";\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementConfiguration {\n /**\n * A list of keys that will attempt to increment the focus index by 1.\n *\n * @defaultValue `[\"ArrowDown\"]`\n */\n incrementKeys?: readonly string[];\n\n /**\n * A list of keys that will attempt to decrement the focus index by 1.\n *\n * @defaultValue `[\"ArrowUp\"]`\n */\n decrementKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to `0`.\n *\n * @defaultValue `[\"Home\"]`\n */\n jumpToFirstKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to the last focusable index.\n *\n * @defaultValue `[\"End\"]`\n */\n jumpToLastKeys?: readonly string[];\n}\n\n/**\n * The defined {@link KeyboardMovementConfiguration} that should be used for\n * custom keyboard focus behavior.\n *\n * @remarks \\@since 5.0.0\n */\nexport type KeyboardMovementConfig = Required<KeyboardMovementConfiguration>;\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementBehavior {\n /**\n * Boolean if pressing a letter will focus the next item in the\n * {@link KeyboardMovementProvider} that starts with the same letter.\n *\n * @defaultValue `false`\n */\n searchable?: boolean;\n\n /**\n * Boolean if the {@link KeyboardMovementProvider} should allow the focus behavior\n * to loop from the first to last or last to first item instead of preventing\n * any new focus behavior. In other words... if the last item is focused and\n * the user presses a key that should advance the focus to the next focusable\n * element, should the focus stay on the current element or loop back and\n * focus the first focusable item.\n *\n * @defaultValue `false`\n */\n loopable?: boolean;\n\n /**\n * Boolean if elements that are `aria-disabled` or `disabled` should still be\n * able to gain focus.\n *\n * @defaultValue `false`\n */\n includeDisabled?: boolean;\n\n /**\n * Boolean if the keyboard movement is horizontal instead of vertical. This\n * updates the default keyboard config to use `ArrowRight` and `ArrowLeft`\n * instead of `ArrowDown` and `ArrowUp`,\n *\n * @remarks \\@since 5.1.2\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Removed `attach`, `detach` and `watching`\n * @internal\n */\nexport interface KeyboardMovementContext\n extends Required<KeyboardMovementBehavior> {\n /** {@inheritDoc KeyboardMovementConfig} */\n config: NonNullRef<KeyboardMovementConfig>;\n\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior: TabIndexBehavior | undefined;\n\n /**\n * Note: This will only update if the {@link KeyboardMovementProviderOptions.tabIndexBehavior}\n * has been set to `\"roving\"` or `\"virtual\"`.\n */\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface FocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type GetDefaultFocusedIndex = (options: FocusableIndexOptions) => number;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface FocusChangeEvent {\n index: number;\n element: HTMLElement;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type KeyboardMovementFocusChangeEvent = (\n event: FocusChangeEvent\n) => void;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementExtensionData<E extends HTMLElement>\n extends KeyboardMovementContext {\n event: KeyboardEvent<E>;\n currentFocusIndex: NonNullMutableRef<number>;\n setFocusIndex(index: number, focusables: readonly HTMLElement[]): void;\n setActiveDescendantId(id: string): void;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProviderOptions<E extends HTMLElement>\n extends KeyboardMovementBehavior,\n KeyboardMovementConfiguration {\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior?: TabIndexBehavior;\n\n onClick?(event: MouseEvent<E>): void;\n onFocus?(event: FocusEvent<E>): void;\n onKeyDown?(event: KeyboardEvent<E>): void;\n\n /**\n * This is used to implement custom keyboard movement for the `keydown` event.\n */\n extendKeyDown?(movementData: KeyboardMovementExtensionData<E>): void;\n\n /**\n * Triggered whenever the focus changes.\n */\n onFocusChange?: KeyboardMovementFocusChangeEvent;\n\n /**\n * From what I've understood so far, programmatically focusable elements\n * should only be included when disabled elements via `aria-disabled` are\n * allowed.\n *\n * @defaultValue `includeDisabled`\n */\n programmatic?: boolean;\n\n /**\n * This should be used for specific widgets that should not include all\n * focusable elements and instead only specific elements.\n *\n * @example\n * ```ts\n * const getExpansionPanelsOnly = (container: HTMLElement): readonly HTMLElement[] =>\n * container.querySelectorAll(\".rmd-expansion-panel__button\");\n *\n * const getTreeItemsOnly = (container: HTMLElement): readonly HTMLElement[] =>\n * container.querySelectorAll(\"[role='treeitem']\");\n * ```\n *\n * @defaultValue `getFocusableElements`\n * @see the default `getFocusableElements` function.\n */\n getFocusableElements?(\n container: HTMLElement,\n programmatic: boolean\n ): readonly HTMLElement[];\n\n /**\n * This can be used to set the initial focus index whenever the container\n * element is first focused or the focus index is `-1` on other focus events.\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProps<E extends HTMLElement> {\n /**\n * This will only be provided if the {@link KeyboardMovementContext.tabIndexBehavior}\n * is set to `\"virtual\"`.\n */\n \"aria-activedescendant\"?: string;\n\n /**\n * This will not be provided if the {@link KeyboardMovementContext.tabIndexBehavior}\n * is `undefined`. Otherwise:\n * - `0` when `\"virtual\"`\n * - `0` when `\"roving\"` and the container element has not been focused at\n * least once\n * - `-1` when `\"roving\"` and the container has been focused at least once\n * - a child element **should** have a `tabIndex={0}` instead\n */\n tabIndex?: number;\n onClick: MouseEventHandler<E>;\n onFocus: FocusEventHandler<E>;\n onKeyDown: KeyboardEventHandler<E>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProviderImplementation<E extends HTMLElement> {\n movementProps: Readonly<KeyboardMovementProps<E>>;\n movementContext: Readonly<KeyboardMovementContext>;\n currentFocusIndex: NonNullMutableRef<number>;\n setActiveDescendantId: UseStateSetter<string>;\n}\n"],"names":[],"mappings":"AA4QA;;;CAGC,GACD,WAKC"}
1
+ {"version":3,"sources":["../../src/movement/types.ts"],"sourcesContent":["import type {\n FocusEvent,\n FocusEventHandler,\n KeyboardEvent,\n KeyboardEventHandler,\n MouseEvent,\n MouseEventHandler,\n} from \"react\";\nimport type {\n NonNullMutableRef,\n NonNullRef,\n UseStateSetter,\n} from \"../types.js\";\n\n/**\n * Set this to `\"roving\"` when:\n * - there are a group of focusable elements that have a `tabIndex={-1}`\n * - the container element defaults to having a `tabIndex={0}`\n * - if the container is focused, it should no longer be included in the normal\n * tab flow. Instead, the current focused element should be included instead\n * by changing its `tabIndex` from `-1` to `0`\n *\n * Set this to `\"virtual\"` when:\n * - the container element should never lose focus\n * - the \"focused\" element only gains focus styles instead of being focused\n * - the container element specifies an `aria-activedescendant` pointing to one\n * of the ids for the child \"focusable\" elements\n *\n * @remarks \\@since 6.0.0\n */\nexport type TabIndexBehavior = \"roving\" | \"virtual\";\n\n/**\n * This should be used for specific widgets that should not include all\n * focusable elements and instead only specific elements.\n *\n * @example\n * ```ts\n * const getExpansionPanelsOnly: GetFocusableElements = (container) =>\n * [...container.querySelectorAll(\".rmd-expansion-panel__button\")];\n *\n * const getTreeItemsOnly: GetFocusableElements = (container) =>\n * [...container.querySelectorAll(\"[role='treeitem']\")];\n * ```\n *\n * @defaultValue `getFocusableElements`\n * @see the default `getFocusableElements` function.\n */\nexport type GetFocusableElements = (\n container: HTMLElement,\n programmatic: boolean\n) => readonly HTMLElement[];\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementConfiguration {\n /**\n * A list of keys that will attempt to increment the focus index by 1.\n *\n * @defaultValue `[\"ArrowDown\"]`\n */\n incrementKeys?: readonly string[];\n\n /**\n * A list of keys that will attempt to decrement the focus index by 1.\n *\n * @defaultValue `[\"ArrowUp\"]`\n */\n decrementKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to `0`.\n *\n * @defaultValue `[\"Home\"]`\n */\n jumpToFirstKeys?: readonly string[];\n\n /**\n * A list of keys that will set the focus index to the last focusable index.\n *\n * @defaultValue `[\"End\"]`\n */\n jumpToLastKeys?: readonly string[];\n}\n\n/**\n * The defined {@link KeyboardMovementConfiguration} that should be used for\n * custom keyboard focus behavior.\n *\n * @remarks \\@since 5.0.0\n */\nexport type KeyboardMovementConfig = Required<KeyboardMovementConfiguration>;\n\n/**\n * @remarks \\@since 5.0.0\n */\nexport interface KeyboardMovementBehavior {\n /**\n * Boolean if pressing a letter will focus the next item in the\n * {@link KeyboardMovementProvider} that starts with the same letter.\n *\n * @defaultValue `false`\n */\n searchable?: boolean;\n\n /**\n * Boolean if the {@link KeyboardMovementProvider} should allow the focus behavior\n * to loop from the first to last or last to first item instead of preventing\n * any new focus behavior. In other words... if the last item is focused and\n * the user presses a key that should advance the focus to the next focusable\n * element, should the focus stay on the current element or loop back and\n * focus the first focusable item.\n *\n * @defaultValue `false`\n */\n loopable?: boolean;\n\n /**\n * Boolean if elements that are `aria-disabled` or `disabled` should still be\n * able to gain focus.\n *\n * @defaultValue `false`\n */\n includeDisabled?: boolean;\n\n /**\n * Boolean if the keyboard movement is horizontal instead of vertical. This\n * updates the default keyboard config to use `ArrowRight` and `ArrowLeft`\n * instead of `ArrowDown` and `ArrowUp`,\n *\n * @remarks \\@since 5.1.2\n * @defaultValue `false`\n */\n horizontal?: boolean;\n}\n\n/**\n * @remarks\n * \\@since 5.0.0\n * \\@since 6.0.0 Removed `attach`, `detach` and `watching`\n * @internal\n */\nexport interface KeyboardMovementContext\n extends Required<KeyboardMovementBehavior> {\n /** {@inheritDoc KeyboardMovementConfig} */\n config: NonNullRef<KeyboardMovementConfig>;\n\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior: TabIndexBehavior | undefined;\n\n /**\n * Note: This will only update if the {@link KeyboardMovementProviderOptions.tabIndexBehavior}\n * has been set to `\"roving\"` or `\"virtual\"`.\n */\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface FocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type GetDefaultFocusedIndex = (options: FocusableIndexOptions) => number;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type ExtendKeyDown<E extends HTMLElement> = (\n movementData: KeyboardMovementExtensionData<E>\n) => void;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementFocusChangeEvent {\n index: number;\n element: HTMLElement;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport type KeyboardMovementFocusChangeEventHandler = (\n event: KeyboardMovementFocusChangeEvent\n) => void;\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementExtensionData<E extends HTMLElement>\n extends KeyboardMovementContext {\n event: KeyboardEvent<E>;\n currentFocusIndex: NonNullMutableRef<number>;\n setFocusIndex(index: number, focusables: readonly HTMLElement[]): void;\n setActiveDescendantId(id: string): void;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProviderOptions<E extends HTMLElement>\n extends KeyboardMovementBehavior,\n KeyboardMovementConfiguration {\n /** @see {@link TabIndexBehavior} */\n tabIndexBehavior?: TabIndexBehavior;\n\n onClick?(event: MouseEvent<E>): void;\n onFocus?(event: FocusEvent<E>): void;\n onKeyDown?(event: KeyboardEvent<E>): void;\n\n /** @defaultValue `false` */\n disabled?: boolean;\n\n /**\n * This is used to implement custom keyboard movement for the `keydown` event.\n */\n extendKeyDown?: ExtendKeyDown<E>;\n\n /**\n * Triggered whenever the focus changes.\n */\n onFocusChange?: KeyboardMovementFocusChangeEventHandler;\n\n /**\n * From what I've understood so far, programmatically focusable elements\n * should only be included when disabled elements via `aria-disabled` are\n * allowed.\n *\n * @defaultValue `includeDisabled`\n */\n programmatic?: boolean;\n\n /** @see {@link GetFocusableElements} */\n getFocusableElements?: GetFocusableElements;\n\n /**\n * This can be used to set the initial focus index whenever the container\n * element is first focused or the focus index is `-1` on other focus events.\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * This was added to support editable combobox behavior. As the user types or\n * uses native input keyboard behavior, the focus index should be reset to\n * `-1` so that the next \"ArrowDown\" event focuses the first option again\n * instead of the last selected one.\n *\n * @defaultValue `false`\n */\n isNegativeOneAllowed?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProps<E extends HTMLElement> {\n /**\n * This will only be provided if the {@link KeyboardMovementContext.tabIndexBehavior}\n * is set to `\"virtual\"`.\n */\n \"aria-activedescendant\"?: string;\n\n /**\n * This will not be provided if the {@link KeyboardMovementContext.tabIndexBehavior}\n * is `undefined`. Otherwise:\n * - `0` when `\"virtual\"`\n * - `0` when `\"roving\"` and the container element has not been focused at\n * least once\n * - `-1` when `\"roving\"` and the container has been focused at least once\n * - a child element **should** have a `tabIndex={0}` instead\n */\n tabIndex?: number;\n onClick: MouseEventHandler<E>;\n onFocus: FocusEventHandler<E>;\n onKeyDown: KeyboardEventHandler<E>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface KeyboardMovementProviderImplementation<E extends HTMLElement> {\n movementProps: Readonly<KeyboardMovementProps<E>>;\n movementContext: Readonly<KeyboardMovementContext>;\n currentFocusIndex: NonNullMutableRef<number>;\n activeDescendantId: string;\n setActiveDescendantId: UseStateSetter<string>;\n}\n"],"names":[],"mappings":"AAoSA;;;CAGC,GACD,WAMC"}
@@ -157,7 +157,7 @@ const returnNegative1 = ()=>-1;
157
157
  * @remarks \@since 6.0.0
158
158
  * @internal
159
159
  */ export function useKeyboardMovementProvider(options = {}) {
160
- const { onClick = noop, onFocus = noop, onKeyDown = noop, loopable = false, searchable = false, horizontal = false, includeDisabled = false, tabIndexBehavior, extendKeyDown = noop, onFocusChange = noop, programmatic = includeDisabled, incrementKeys: propIncrementKeys, decrementKeys: propDecrementKeys, jumpToFirstKeys: propJumpToFirstKeys, jumpToLastKeys: propJumpToLastKeys, getFocusableElements = defaultGetFocusableElements, getDefaultFocusedIndex = returnNegative1 } = options;
160
+ const { onClick = noop, onFocus = noop, onKeyDown = noop, loopable = false, disabled, searchable = false, horizontal = false, includeDisabled = false, tabIndexBehavior, extendKeyDown = noop, onFocusChange = noop, programmatic = includeDisabled, incrementKeys: propIncrementKeys, decrementKeys: propDecrementKeys, jumpToFirstKeys: propJumpToFirstKeys, jumpToLastKeys: propJumpToLastKeys, getFocusableElements = defaultGetFocusableElements, getDefaultFocusedIndex = returnNegative1, isNegativeOneAllowed = false } = options;
161
161
  const isRTL = useDir().dir === "rtl";
162
162
  let defaults;
163
163
  if (horizontal) {
@@ -208,14 +208,21 @@ const returnNegative1 = ()=>-1;
208
208
  };
209
209
  }, []);
210
210
  }
211
+ let tabIndex;
212
+ if (tabIndexBehavior) {
213
+ tabIndex = disabled || tabIndexBehavior === "roving" && activeDescendantId ? -1 : 0;
214
+ }
211
215
  return {
212
216
  movementProps: {
213
217
  "aria-activedescendant": tabIndexBehavior === "virtual" ? activeDescendantId : undefined,
214
- tabIndex: tabIndexBehavior === "roving" ? activeDescendantId ? -1 : 0 : undefined,
218
+ tabIndex,
215
219
  // Note: This used to be on the `onFocus` event, but this causes issues in
216
220
  // Chromium browsers for drag and drop behavior
217
221
  onClick (event) {
218
222
  onClick(event);
223
+ if (disabled) {
224
+ return;
225
+ }
219
226
  // This makes it so you can click an element with a mouse and then
220
227
  // keyboard navigate from that element instead of the last keyboard focus
221
228
  // element
@@ -264,7 +271,7 @@ const returnNegative1 = ()=>-1;
264
271
  // This allows my custom `getDefaultFocusedIndex` implementations to
265
272
  // have a nice fallback without having to re-implement the "focus
266
273
  // first" behavior
267
- if (defaultFocusIndex === -1) {
274
+ if (!isNegativeOneAllowed && defaultFocusIndex === -1) {
268
275
  if (tabIndexBehavior === "virtual") {
269
276
  // virtual keyboard navigation **must** always focus at least one element
270
277
  defaultFocusIndex = getVirtualFocusDefaultIndex({
@@ -301,6 +308,9 @@ const returnNegative1 = ()=>-1;
301
308
  },
302
309
  onKeyDown (event) {
303
310
  onKeyDown(event);
311
+ if (disabled) {
312
+ return;
313
+ }
304
314
  const { currentTarget } = event;
305
315
  const setFocusIndex = (index, focusables)=>{
306
316
  event.preventDefault();
@@ -338,7 +348,7 @@ const returnNegative1 = ()=>-1;
338
348
  // TODO: Figure this part out. This is currently required for the tree
339
349
  // movement when the asterisk key is pressed. There might be other cases
340
350
  // as well.
341
- if (currentFocusIndex.current === -1) {
351
+ if (!isNegativeOneAllowed && currentFocusIndex.current === -1) {
342
352
  currentFocusIndex.current = recalculateFocusIndex({
343
353
  focusables: getFocusableElements(currentTarget, programmatic),
344
354
  includeDisabled,
@@ -403,6 +413,7 @@ const returnNegative1 = ()=>-1;
403
413
  },
404
414
  movementContext,
405
415
  currentFocusIndex,
416
+ activeDescendantId,
406
417
  setActiveDescendantId
407
418
  };
408
419
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/movement/useKeyboardMovementProvider.ts"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { getFocusableElements as defaultGetFocusableElements } from \"../focus/utils.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useDir } from \"../typography/WritingDirectionProvider.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n DEFAULT_KEYBOARD_MOVEMENT,\n DEFAULT_LTR_KEYBOARD_MOVEMENT,\n DEFAULT_RTL_KEYBOARD_MOVEMENT,\n} from \"./constants.js\";\nimport { findMatchIndex } from \"./findMatchIndex.js\";\nimport type {\n KeyboardMovementConfig,\n KeyboardMovementConfiguration,\n KeyboardMovementContext,\n KeyboardMovementProviderImplementation,\n KeyboardMovementProviderOptions,\n} from \"./types.js\";\nimport {\n getFirstFocusableIndex,\n getLastFocusableIndex,\n getNextFocusableIndex,\n getSearchText,\n getVirtualFocusDefaultIndex,\n isElementDisabled,\n isNotFocusable,\n isSearchableEvent,\n recalculateFocusIndex,\n} from \"./utils.js\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nconst context = createContext<KeyboardMovementContext>({\n config: { current: DEFAULT_KEYBOARD_MOVEMENT },\n loopable: false,\n searchable: false,\n horizontal: false,\n includeDisabled: false,\n tabIndexBehavior: undefined,\n activeDescendantId: \"\",\n});\ncontext.displayName = \"KeyboardMovement\";\nexport const { Provider: KeyboardMovementProvider } = context;\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function useKeyboardMovementContext(): Readonly<KeyboardMovementContext> {\n return useContext(context);\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst returnNegative1 = (): number => -1;\n\n/**\n * Implements the custom keyboard movement behavior throughout react-md. Using\n * the \"Find References\" will be the best way to see example usage.\n *\n * @example\n * Default Keyboard Movement for any Focusable Element\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider();\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * {children}\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Active Descendant Movement\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * className={cnb(id === activeDescendantId && \"focused-class-name\")}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"virtual\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Roving Tab Index\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * tabIndex={id === activeDescendantId ? 0 : -1}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"roving\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function useKeyboardMovementProvider<E extends HTMLElement>(\n options: KeyboardMovementProviderOptions<E> = {}\n): KeyboardMovementProviderImplementation<E> {\n const {\n onClick = noop,\n onFocus = noop,\n onKeyDown = noop,\n loopable = false,\n searchable = false,\n horizontal = false,\n includeDisabled = false,\n tabIndexBehavior,\n extendKeyDown = noop,\n onFocusChange = noop,\n programmatic = includeDisabled,\n incrementKeys: propIncrementKeys,\n decrementKeys: propDecrementKeys,\n jumpToFirstKeys: propJumpToFirstKeys,\n jumpToLastKeys: propJumpToLastKeys,\n getFocusableElements = defaultGetFocusableElements,\n getDefaultFocusedIndex = returnNegative1,\n } = options;\n\n const isRTL = useDir().dir === \"rtl\";\n let defaults: Readonly<Required<KeyboardMovementConfiguration>>;\n if (horizontal) {\n defaults = isRTL\n ? DEFAULT_RTL_KEYBOARD_MOVEMENT\n : DEFAULT_LTR_KEYBOARD_MOVEMENT;\n } else {\n defaults = DEFAULT_KEYBOARD_MOVEMENT;\n }\n\n const incrementKeys = propIncrementKeys || defaults.incrementKeys;\n const decrementKeys = propDecrementKeys || defaults.decrementKeys;\n const jumpToFirstKeys = propJumpToFirstKeys || defaults.jumpToFirstKeys;\n const jumpToLastKeys = propJumpToLastKeys || defaults.jumpToLastKeys;\n\n const configuration: KeyboardMovementConfig = {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n };\n const config = useRef(configuration);\n useIsomorphicLayoutEffect(() => {\n config.current = configuration;\n });\n\n const [activeDescendantId, setActiveDescendantId] = useState(\"\");\n const movementContext = useMemo<KeyboardMovementContext>(\n () => ({\n config,\n loopable,\n searchable,\n horizontal,\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n }),\n [\n activeDescendantId,\n horizontal,\n includeDisabled,\n loopable,\n searchable,\n tabIndexBehavior,\n ]\n );\n const currentFocusIndex = useRef(-1);\n const mode = useUserInteractionMode();\n const refocus = useRef(false);\n\n if (process.env.NODE_ENV !== \"production\") {\n // this fixes issues during hot reloading and using the `useId()` hook\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n return () => {\n setActiveDescendantId(\"\");\n };\n }, []);\n }\n\n return {\n movementProps: {\n \"aria-activedescendant\":\n tabIndexBehavior === \"virtual\" ? activeDescendantId : undefined,\n tabIndex:\n tabIndexBehavior === \"roving\"\n ? activeDescendantId\n ? -1\n : 0\n : undefined,\n\n // Note: This used to be on the `onFocus` event, but this causes issues in\n // Chromium browsers for drag and drop behavior\n onClick(event) {\n onClick(event);\n\n // This makes it so you can click an element with a mouse and then\n // keyboard navigate from that element instead of the last keyboard focus\n // element\n const { currentTarget, target } = event;\n if (target === currentTarget || !(target instanceof HTMLElement)) {\n return;\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const focusedIndex = focusables.findIndex(\n (element) => element === target || element.contains(target)\n );\n if (focusedIndex === -1 || !focusables.length) {\n return;\n }\n\n currentFocusIndex.current = focusedIndex;\n const focused = focusables[focusedIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n // need to force focus back to the container element when using\n // aria activedescendant\n if (tabIndexBehavior === \"virtual\") {\n refocus.current = true;\n currentTarget.focus();\n }\n\n onFocusChange({\n index: focusedIndex,\n element: focused,\n });\n },\n onFocus(event) {\n onFocus(event);\n if (event.isPropagationStopped() || refocus.current) {\n refocus.current = false;\n return;\n }\n\n if (\n (mode !== \"keyboard\" && tabIndexBehavior !== \"virtual\") ||\n event.target !== event.currentTarget\n ) {\n return;\n }\n\n const focusables = getFocusableElements(\n event.currentTarget,\n programmatic\n );\n if (!focusables.length) {\n return;\n }\n\n let defaultFocusIndex = getDefaultFocusedIndex({\n focusables,\n includeDisabled,\n });\n\n // This allows my custom `getDefaultFocusedIndex` implementations to\n // have a nice fallback without having to re-implement the \"focus\n // first\" behavior\n if (defaultFocusIndex === -1) {\n if (tabIndexBehavior === \"virtual\") {\n // virtual keyboard navigation **must** always focus at least one element\n defaultFocusIndex = getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n } else {\n defaultFocusIndex = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n }\n }\n\n if (defaultFocusIndex === -1) {\n return;\n }\n\n currentFocusIndex.current = defaultFocusIndex;\n const focused = focusables[defaultFocusIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n } else {\n focused.scrollIntoView({ block: \"nearest\" });\n }\n\n onFocusChange({\n index: defaultFocusIndex,\n element: focused,\n });\n },\n onKeyDown(event) {\n onKeyDown(event);\n const { currentTarget } = event;\n\n const setFocusIndex = (\n index: number,\n focusables: readonly HTMLElement[]\n ): void => {\n event.preventDefault();\n event.stopPropagation();\n if (currentFocusIndex.current === index || index === -1) {\n return;\n }\n\n currentFocusIndex.current = index;\n const focused = focusables[index];\n if (tabIndexBehavior) {\n focused.scrollIntoView({\n block: \"nearest\",\n inline: \"nearest\",\n });\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n }\n\n onFocusChange({\n index,\n element: focused,\n });\n };\n\n extendKeyDown({\n event,\n setFocusIndex,\n currentFocusIndex,\n setActiveDescendantId,\n ...movementContext,\n });\n\n if (event.isPropagationStopped()) {\n return;\n }\n\n // TODO: Figure this part out. This is currently required for the tree\n // movement when the asterisk key is pressed. There might be other cases\n // as well.\n if (currentFocusIndex.current === -1) {\n currentFocusIndex.current = recalculateFocusIndex({\n focusables: getFocusableElements(currentTarget, programmatic),\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n });\n }\n\n const { key, shiftKey } = event;\n if (\n tabIndexBehavior === \"virtual\" &&\n activeDescendantId &&\n (key === \" \" || key === \"Enter\")\n ) {\n if (key === \" \") {\n event.preventDefault();\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const activeElement = focusables[currentFocusIndex.current];\n if (!activeElement || isElementDisabled(activeElement)) {\n return;\n }\n\n activeElement.click();\n return;\n }\n\n const {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n } = config.current;\n\n if (searchable && isSearchableEvent(event)) {\n const focusables = getFocusableElements(currentTarget, programmatic);\n const index = findMatchIndex({\n value: key,\n values: focusables.map((element) =>\n getSearchText(element, !isNotFocusable(element, includeDisabled))\n ),\n startIndex: shiftKey ? -1 : currentFocusIndex.current,\n });\n setFocusIndex(index, focusables);\n return;\n }\n\n const jumpToFirst = jumpToFirstKeys.includes(key);\n const jumpToLast = !jumpToFirst && jumpToLastKeys.includes(key);\n const increment =\n !jumpToFirst && !jumpToLast && incrementKeys.includes(key);\n const decrement =\n !jumpToFirst &&\n !jumpToLast &&\n !increment &&\n decrementKeys.includes(key);\n\n if (!jumpToFirst && !jumpToLast && !increment && !decrement) {\n return;\n }\n const focusables = getFocusableElements(currentTarget, programmatic);\n\n let index: number;\n if (jumpToFirst) {\n index = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else if (jumpToLast) {\n index = getLastFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else {\n index = getNextFocusableIndex({\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex: currentFocusIndex.current,\n });\n }\n\n setFocusIndex(index, focusables);\n },\n },\n movementContext,\n currentFocusIndex,\n setActiveDescendantId,\n };\n}\n"],"names":["createContext","useContext","useEffect","useMemo","useRef","useState","getFocusableElements","defaultGetFocusableElements","useUserInteractionMode","useDir","useIsomorphicLayoutEffect","DEFAULT_KEYBOARD_MOVEMENT","DEFAULT_LTR_KEYBOARD_MOVEMENT","DEFAULT_RTL_KEYBOARD_MOVEMENT","findMatchIndex","getFirstFocusableIndex","getLastFocusableIndex","getNextFocusableIndex","getSearchText","getVirtualFocusDefaultIndex","isElementDisabled","isNotFocusable","isSearchableEvent","recalculateFocusIndex","context","config","current","loopable","searchable","horizontal","includeDisabled","tabIndexBehavior","undefined","activeDescendantId","displayName","Provider","KeyboardMovementProvider","useKeyboardMovementContext","noop","returnNegative1","useKeyboardMovementProvider","options","onClick","onFocus","onKeyDown","extendKeyDown","onFocusChange","programmatic","incrementKeys","propIncrementKeys","decrementKeys","propDecrementKeys","jumpToFirstKeys","propJumpToFirstKeys","jumpToLastKeys","propJumpToLastKeys","getDefaultFocusedIndex","isRTL","dir","defaults","configuration","setActiveDescendantId","movementContext","currentFocusIndex","mode","refocus","process","env","NODE_ENV","movementProps","tabIndex","event","currentTarget","target","HTMLElement","focusables","focusedIndex","findIndex","element","contains","length","focused","id","focus","index","isPropagationStopped","defaultFocusIndex","scrollIntoView","block","setFocusIndex","preventDefault","stopPropagation","inline","key","shiftKey","activeElement","click","value","values","map","startIndex","jumpToFirst","includes","jumpToLast","increment","decrement"],"mappings":"AAAA;AACA,SACEA,aAAa,EACbC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,QAAQ;AACf,SAASC,wBAAwBC,2BAA2B,QAAQ,oBAAoB;AACxF,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,MAAM,QAAQ,4CAA4C;AACnE,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SACEC,y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E,uBAAuB;wBAC7B4D;wBACA7C;oBACF;gBACF,OAAO,IAAIyE,YAAY;oBACrBnB,QAAQpE,sBAAsB;wBAC5B2D;wBACA7C;oBACF;gBACF,OAAO;oBACLsD,QAAQnE,sBAAsB;wBAC5BU;wBACA6E;wBACA7B;wBACA7C;wBACAiC,mBAAmBA,kBAAkBrC,OAAO;oBAC9C;gBACF;gBAEA+D,cAAcL,OAAOT;YACvB;QACF;QACAb;QACAC;QACAF;IACF;AACF"}
1
+ {"version":3,"sources":["../../src/movement/useKeyboardMovementProvider.ts"],"sourcesContent":["\"use client\";\nimport {\n createContext,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { getFocusableElements as defaultGetFocusableElements } from \"../focus/utils.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { useDir } from \"../typography/WritingDirectionProvider.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n DEFAULT_KEYBOARD_MOVEMENT,\n DEFAULT_LTR_KEYBOARD_MOVEMENT,\n DEFAULT_RTL_KEYBOARD_MOVEMENT,\n} from \"./constants.js\";\nimport { findMatchIndex } from \"./findMatchIndex.js\";\nimport type {\n KeyboardMovementConfig,\n KeyboardMovementConfiguration,\n KeyboardMovementContext,\n KeyboardMovementProviderImplementation,\n KeyboardMovementProviderOptions,\n} from \"./types.js\";\nimport {\n getFirstFocusableIndex,\n getLastFocusableIndex,\n getNextFocusableIndex,\n getSearchText,\n getVirtualFocusDefaultIndex,\n isElementDisabled,\n isNotFocusable,\n isSearchableEvent,\n recalculateFocusIndex,\n} from \"./utils.js\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nconst context = createContext<KeyboardMovementContext>({\n config: { current: DEFAULT_KEYBOARD_MOVEMENT },\n loopable: false,\n searchable: false,\n horizontal: false,\n includeDisabled: false,\n tabIndexBehavior: undefined,\n activeDescendantId: \"\",\n});\ncontext.displayName = \"KeyboardMovement\";\nexport const { Provider: KeyboardMovementProvider } = context;\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function useKeyboardMovementContext(): Readonly<KeyboardMovementContext> {\n return useContext(context);\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst returnNegative1 = (): number => -1;\n\n/**\n * Implements the custom keyboard movement behavior throughout react-md. Using\n * the \"Find References\" will be the best way to see example usage.\n *\n * @example\n * Default Keyboard Movement for any Focusable Element\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider();\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * {children}\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Active Descendant Movement\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * className={cnb(id === activeDescendantId && \"focused-class-name\")}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"virtual\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n *\n * @example\n * Roving Tab Index\n * ```tsx\n * import {\n * KeyboardMovementProvider,\n * useKeyboardMovementContext,\n * useKeyboardMovementProvider,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useId } from \"react\";\n *\n * function Child(): ReactElement {\n * const id = useId()\n * const { activeDescendantId } = useKeyboardMovementContext();\n *\n * return (\n * <div\n * {...props}\n * id={id}\n * tabIndex={id === activeDescendantId ? 0 : -1}\n * >\n * Some Content\n * </div>\n * );\n * }\n *\n * function Example({ children }: { children: ReactNode }): ReactElement {\n * const { movementContext, movementProps } = useKeyboardMovementProvider({\n * loopable: true,\n * searchable: true,\n * tabIndexBehavior: \"roving\",\n * });\n *\n * // any focusable element child can be focused with the arrow , home, and\n * // end keys\n * return (\n * <KeyboardMovementProvider value={movementContext}>\n * <div {...movementProps}>\n * <Child />\n * <Child />\n * <Child />\n * </div>\n * </KeyboardMovementProvider>\n * );\n * }\n * ```\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function useKeyboardMovementProvider<E extends HTMLElement>(\n options: KeyboardMovementProviderOptions<E> = {}\n): KeyboardMovementProviderImplementation<E> {\n const {\n onClick = noop,\n onFocus = noop,\n onKeyDown = noop,\n loopable = false,\n disabled,\n searchable = false,\n horizontal = false,\n includeDisabled = false,\n tabIndexBehavior,\n extendKeyDown = noop,\n onFocusChange = noop,\n programmatic = includeDisabled,\n incrementKeys: propIncrementKeys,\n decrementKeys: propDecrementKeys,\n jumpToFirstKeys: propJumpToFirstKeys,\n jumpToLastKeys: propJumpToLastKeys,\n getFocusableElements = defaultGetFocusableElements,\n getDefaultFocusedIndex = returnNegative1,\n isNegativeOneAllowed = false,\n } = options;\n\n const isRTL = useDir().dir === \"rtl\";\n let defaults: Readonly<Required<KeyboardMovementConfiguration>>;\n if (horizontal) {\n defaults = isRTL\n ? DEFAULT_RTL_KEYBOARD_MOVEMENT\n : DEFAULT_LTR_KEYBOARD_MOVEMENT;\n } else {\n defaults = DEFAULT_KEYBOARD_MOVEMENT;\n }\n\n const incrementKeys = propIncrementKeys || defaults.incrementKeys;\n const decrementKeys = propDecrementKeys || defaults.decrementKeys;\n const jumpToFirstKeys = propJumpToFirstKeys || defaults.jumpToFirstKeys;\n const jumpToLastKeys = propJumpToLastKeys || defaults.jumpToLastKeys;\n\n const configuration: KeyboardMovementConfig = {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n };\n const config = useRef(configuration);\n useIsomorphicLayoutEffect(() => {\n config.current = configuration;\n });\n\n const [activeDescendantId, setActiveDescendantId] = useState(\"\");\n const movementContext = useMemo<KeyboardMovementContext>(\n () => ({\n config,\n loopable,\n searchable,\n horizontal,\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n }),\n [\n activeDescendantId,\n horizontal,\n includeDisabled,\n loopable,\n searchable,\n tabIndexBehavior,\n ]\n );\n const currentFocusIndex = useRef(-1);\n const mode = useUserInteractionMode();\n const refocus = useRef(false);\n\n if (process.env.NODE_ENV !== \"production\") {\n // this fixes issues during hot reloading and using the `useId()` hook\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n return () => {\n setActiveDescendantId(\"\");\n };\n }, []);\n }\n\n let tabIndex: number | undefined;\n if (tabIndexBehavior) {\n tabIndex =\n disabled || (tabIndexBehavior === \"roving\" && activeDescendantId)\n ? -1\n : 0;\n }\n\n return {\n movementProps: {\n \"aria-activedescendant\":\n tabIndexBehavior === \"virtual\" ? activeDescendantId : undefined,\n tabIndex,\n\n // Note: This used to be on the `onFocus` event, but this causes issues in\n // Chromium browsers for drag and drop behavior\n onClick(event) {\n onClick(event);\n if (disabled) {\n return;\n }\n\n // This makes it so you can click an element with a mouse and then\n // keyboard navigate from that element instead of the last keyboard focus\n // element\n const { currentTarget, target } = event;\n if (target === currentTarget || !(target instanceof HTMLElement)) {\n return;\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const focusedIndex = focusables.findIndex(\n (element) => element === target || element.contains(target)\n );\n if (focusedIndex === -1 || !focusables.length) {\n return;\n }\n\n currentFocusIndex.current = focusedIndex;\n const focused = focusables[focusedIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n // need to force focus back to the container element when using\n // aria activedescendant\n if (tabIndexBehavior === \"virtual\") {\n refocus.current = true;\n currentTarget.focus();\n }\n\n onFocusChange({\n index: focusedIndex,\n element: focused,\n });\n },\n onFocus(event) {\n onFocus(event);\n if (event.isPropagationStopped() || refocus.current) {\n refocus.current = false;\n return;\n }\n\n if (\n (mode !== \"keyboard\" && tabIndexBehavior !== \"virtual\") ||\n event.target !== event.currentTarget\n ) {\n return;\n }\n\n const focusables = getFocusableElements(\n event.currentTarget,\n programmatic\n );\n if (!focusables.length) {\n return;\n }\n\n let defaultFocusIndex = getDefaultFocusedIndex({\n focusables,\n includeDisabled,\n });\n\n // This allows my custom `getDefaultFocusedIndex` implementations to\n // have a nice fallback without having to re-implement the \"focus\n // first\" behavior\n if (!isNegativeOneAllowed && defaultFocusIndex === -1) {\n if (tabIndexBehavior === \"virtual\") {\n // virtual keyboard navigation **must** always focus at least one element\n defaultFocusIndex = getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n } else {\n defaultFocusIndex = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n }\n }\n\n if (defaultFocusIndex === -1) {\n return;\n }\n\n currentFocusIndex.current = defaultFocusIndex;\n const focused = focusables[defaultFocusIndex];\n if (tabIndexBehavior) {\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n } else {\n focused.scrollIntoView({ block: \"nearest\" });\n }\n\n onFocusChange({\n index: defaultFocusIndex,\n element: focused,\n });\n },\n onKeyDown(event) {\n onKeyDown(event);\n if (disabled) {\n return;\n }\n\n const { currentTarget } = event;\n\n const setFocusIndex = (\n index: number,\n focusables: readonly HTMLElement[]\n ): void => {\n event.preventDefault();\n event.stopPropagation();\n if (currentFocusIndex.current === index || index === -1) {\n return;\n }\n\n currentFocusIndex.current = index;\n const focused = focusables[index];\n if (tabIndexBehavior) {\n focused.scrollIntoView({\n block: \"nearest\",\n inline: \"nearest\",\n });\n setActiveDescendantId(focused.id);\n }\n\n if (tabIndexBehavior !== \"virtual\") {\n focused.focus();\n }\n\n onFocusChange({\n index,\n element: focused,\n });\n };\n\n extendKeyDown({\n event,\n setFocusIndex,\n currentFocusIndex,\n setActiveDescendantId,\n ...movementContext,\n });\n\n if (event.isPropagationStopped()) {\n return;\n }\n\n // TODO: Figure this part out. This is currently required for the tree\n // movement when the asterisk key is pressed. There might be other cases\n // as well.\n if (!isNegativeOneAllowed && currentFocusIndex.current === -1) {\n currentFocusIndex.current = recalculateFocusIndex({\n focusables: getFocusableElements(currentTarget, programmatic),\n includeDisabled,\n tabIndexBehavior,\n activeDescendantId,\n });\n }\n\n const { key, shiftKey } = event;\n if (\n tabIndexBehavior === \"virtual\" &&\n activeDescendantId &&\n (key === \" \" || key === \"Enter\")\n ) {\n if (key === \" \") {\n event.preventDefault();\n }\n\n const focusables = getFocusableElements(currentTarget, programmatic);\n const activeElement = focusables[currentFocusIndex.current];\n if (!activeElement || isElementDisabled(activeElement)) {\n return;\n }\n\n activeElement.click();\n return;\n }\n\n const {\n incrementKeys,\n decrementKeys,\n jumpToFirstKeys,\n jumpToLastKeys,\n } = config.current;\n\n if (searchable && isSearchableEvent(event)) {\n const focusables = getFocusableElements(currentTarget, programmatic);\n const index = findMatchIndex({\n value: key,\n values: focusables.map((element) =>\n getSearchText(element, !isNotFocusable(element, includeDisabled))\n ),\n startIndex: shiftKey ? -1 : currentFocusIndex.current,\n });\n setFocusIndex(index, focusables);\n return;\n }\n\n const jumpToFirst = jumpToFirstKeys.includes(key);\n const jumpToLast = !jumpToFirst && jumpToLastKeys.includes(key);\n const increment =\n !jumpToFirst && !jumpToLast && incrementKeys.includes(key);\n const decrement =\n !jumpToFirst &&\n !jumpToLast &&\n !increment &&\n decrementKeys.includes(key);\n\n if (!jumpToFirst && !jumpToLast && !increment && !decrement) {\n return;\n }\n const focusables = getFocusableElements(currentTarget, programmatic);\n\n let index: number;\n if (jumpToFirst) {\n index = getFirstFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else if (jumpToLast) {\n index = getLastFocusableIndex({\n focusables,\n includeDisabled,\n });\n } else {\n index = getNextFocusableIndex({\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex: currentFocusIndex.current,\n });\n }\n\n setFocusIndex(index, focusables);\n },\n },\n movementContext,\n currentFocusIndex,\n activeDescendantId,\n setActiveDescendantId,\n };\n}\n"],"names":["createContext","useContext","useEffect","useMemo","useRef","useState","getFocusableElements","defaultGetFocusableElements","useUserInteractionMode","useDir","useIsomorphicLayoutEffect","DEFAULT_KEYBOARD_MOVEMENT","DEFAULT_LTR_KEYBOARD_MOVEMENT","DEFAULT_RTL_KEYBOARD_MOVEMENT","findMatchIndex","getFirstFocusableIndex","getLastFocusableIndex","getNextFocusableIndex","getSearchText","getVirtualFocusDefaultIndex","isElementDisabled","isNotFocusable","isSearchableEvent","recalculateFocusIndex","context","config","current","loopable","searchable","horizontal","includeDisabled","tabIndexBehavior","undefined","activeDescendantId","displayName","Provider","KeyboardMovementProvider","useKeyboardMovementContext","noop","returnNegative1","useKeyboardMovementProvider","options","onClick","onFocus","onKeyDown","disabled","extendKeyDown","onFocusChange","programmatic","incrementKeys","propIncrementKeys","decrementKeys","propDecrementKeys","jumpToFirstKeys","propJumpToFirstKeys","jumpToLastKeys","propJumpToLastKeys","getDefaultFocusedIndex","isNegativeOneAllowed","isRTL","dir","defaults","configuration","setActiveDescendantId","movementContext","currentFocusIndex","mode","refocus","process","env","NODE_ENV","tabIndex","movementProps","event","currentTarget","target","HTMLElement","focusables","focusedIndex","findIndex","element","contains","length","focused","id","focus","index","isPropagationStopped","defaultFocusIndex","scrollIntoView","block","setFocusIndex","preventDefault","stopPropagation","inline","key","shiftKey","activeElement","click","value","values","map","startIndex","jumpToFirst","includes","jumpToLast","increment","decrement"],"mappings":"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,OAAO;oBACvD;oBACAiE,cAAcL,OAAOT;oBACrB;gBACF;gBAEA,MAAM0B,cAAclD,gBAAgBmD,QAAQ,CAACT;gBAC7C,MAAMU,aAAa,CAACF,eAAehD,eAAeiD,QAAQ,CAACT;gBAC3D,MAAMW,YACJ,CAACH,eAAe,CAACE,cAAcxD,cAAcuD,QAAQ,CAACT;gBACxD,MAAMY,YACJ,CAACJ,eACD,CAACE,cACD,CAACC,aACDvD,cAAcqD,QAAQ,CAACT;gBAEzB,IAAI,CAACQ,eAAe,CAACE,cAAc,CAACC,aAAa,CAACC,WAAW;oBAC3D;gBACF;gBACA,MAAM9B,aAAavE,qBAAqBoE,eAAe1B;gBAEvD,IAAIsC;gBACJ,IAAIiB,aAAa;oBACfjB,QAAQvE,uBAAuB;wBAC7B8D;wBACA/C;oBACF;gBACF,OAAO,IAAI2E,YAAY;oBACrBnB,QAAQtE,sBAAsB;wBAC5B6D;wBACA/C;oBACF;gBACF,OAAO;oBACLwD,QAAQrE,sBAAsB;wBAC5BU;wBACA+E;wBACA7B;wBACA/C;wBACAmC,mBAAmBA,kBAAkBvC,OAAO;oBAC9C;gBACF;gBAEAiE,cAAcL,OAAOT;YACvB;QACF;QACAb;QACAC;QACAhC;QACA8B;IACF;AACF"}
@@ -1,5 +1,5 @@
1
- import type { KeyboardEvent } from "react";
2
- import type { FocusableIndexOptions, TabIndexBehavior } from "./types.js";
1
+ import { type KeyboardEvent } from "react";
2
+ import { type FocusableIndexOptions, type TabIndexBehavior } from "./types.js";
3
3
  /**
4
4
  * @remarks \@since 6.0.0
5
5
  * @internal
@@ -86,4 +86,9 @@ export declare function recalculateFocusIndex(options: RecalculateOptions): numb
86
86
  * @internal
87
87
  */
88
88
  export declare function isSearchableEvent(event: KeyboardEvent): boolean;
89
+ /**
90
+ * @remarks \@since 6.0.0
91
+ * @internal
92
+ */
93
+ export declare function isTypeEvent(event: KeyboardEvent): boolean;
89
94
  export {};
@@ -155,5 +155,15 @@ import { loop } from "../utils/loop.js";
155
155
  return key.length === 1 && // can't search with space since it is generally a click event
156
156
  key !== " " && !altKey && !ctrlKey && !metaKey;
157
157
  }
158
+ /**
159
+ * @remarks \@since 6.0.0
160
+ * @internal
161
+ */ export function isTypeEvent(event) {
162
+ return isSearchableEvent(event) || [
163
+ "Backspace",
164
+ "Delete",
165
+ " "
166
+ ].includes(event.key);
167
+ }
158
168
 
159
169
  //# sourceMappingURL=utils.js.map