@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
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/movement/utils.ts"],"sourcesContent":["import type { KeyboardEvent } from \"react\";\nimport { loop } from \"../utils/loop.js\";\nimport type { FocusableIndexOptions, TabIndexBehavior } from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const isElementDisabled = (element: HTMLElement): boolean =>\n element.getAttribute(\"disabled\") !== null ||\n element.getAttribute(\"aria-disabled\") === \"true\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const isNotFocusable = (\n element: HTMLElement | undefined,\n includeDisabled: boolean\n): boolean => {\n if (!element) {\n return true;\n }\n\n if (includeDisabled) {\n return false;\n }\n\n return isElementDisabled(element);\n};\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface VirtualFocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getVirtualFocusDefaultIndex = (\n options: VirtualFocusableIndexOptions\n): number => {\n const { focusables, includeDisabled, activeDescendantId } = options;\n if (!focusables.length || (!activeDescendantId && includeDisabled)) {\n return 0;\n }\n\n const activeIndex = focusables.findIndex((element) => {\n if (activeDescendantId) {\n return element.id === activeDescendantId;\n }\n\n return !isElementDisabled(element);\n });\n return Math.max(0, activeIndex);\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getFirstFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let firstIndex = 0;\n while (\n firstIndex < focusables.length - 1 &&\n isNotFocusable(focusables[firstIndex], includeDisabled)\n ) {\n firstIndex += 1;\n }\n\n if (isNotFocusable(focusables[firstIndex], includeDisabled)) {\n return -1;\n }\n\n return firstIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getLastFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let lastIndex = focusables.length - 1;\n while (\n lastIndex > 0 &&\n isNotFocusable(focusables[lastIndex], includeDisabled)\n ) {\n lastIndex -= 1;\n }\n\n if (isNotFocusable(focusables[lastIndex], includeDisabled)) {\n return -1;\n }\n\n return lastIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\ninterface NextFocusableIndexOptions extends FocusableIndexOptions {\n loopable: boolean;\n increment: boolean;\n currentFocusIndex: number;\n}\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getNextFocusableIndex = (\n options: NextFocusableIndexOptions\n): number => {\n const {\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex,\n } = options;\n if (!focusables.length) {\n return currentFocusIndex;\n }\n\n const min = getFirstFocusableIndex({ focusables, includeDisabled });\n const max = getLastFocusableIndex({ focusables, includeDisabled });\n let nextIndex = loop({\n min,\n max,\n value: currentFocusIndex,\n minmax: !loopable,\n increment,\n });\n while (\n isNotFocusable(focusables[nextIndex], includeDisabled) &&\n (loopable || nextIndex !== (increment ? max : min))\n ) {\n nextIndex = loop({\n min,\n max,\n value: nextIndex,\n minmax: !loopable,\n increment,\n });\n }\n\n // Since the `min` and `max` values are \"safely\" set, I don't need to verify\n // the nextIndex is still focusable\n return nextIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function getSearchText(\n element: HTMLElement,\n searchable: boolean\n): string {\n if (!searchable) {\n return \"\";\n }\n\n const cloned = element.cloneNode(true) as HTMLElement;\n cloned\n .querySelectorAll(\n // Note: do not include DISPLAY_NONE_CLASS since it is presentational only\n \".rmd-icon--font,[aria-hidden=true],[hidden],[role=presentation]\"\n )\n .forEach((element) => {\n element.parentNode?.removeChild(element);\n });\n\n // Note: It would be good to use `cloned.innerText` (maybe?) at some point,\n // but it returns `undefined` in jsdom. It also does cause a reflow, so maybe\n // this is fine?\n // https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext\n return (cloned.textContent || \"\")[0].toUpperCase();\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface RecalculateOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n tabIndexBehavior: TabIndexBehavior | undefined;\n activeDescendantId: string;\n}\n\n/**\n * This was added to help with specific widgets that cause focus index to change\n * between renders (i.e. expanding all tree items on the same level with `*`).\n * There might be a better way to handle this in the future.\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function recalculateFocusIndex(options: RecalculateOptions): number {\n const { focusables, includeDisabled, tabIndexBehavior, activeDescendantId } =\n options;\n if (tabIndexBehavior === \"virtual\") {\n return getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n }\n\n const { activeElement } = document;\n return focusables.findIndex((element) => element === activeElement);\n}\n\n/**\n * Checks if a keyboard event can trigger a search through focusable elements\n * by:\n *\n * - checking if the key is a single letter that is not the space key\n * - checking that the alt, ctrl, and meta keys are not being held\n *\n * The shift key **is allowed** because holding shift means \"search from the\n * beginning\" instead of \"search from current location\".\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function isSearchableEvent(event: KeyboardEvent): boolean {\n const { key, altKey, ctrlKey, metaKey } = event;\n\n return (\n key.length === 1 &&\n // can't search with space since it is generally a click event\n key !== \" \" &&\n !altKey &&\n !ctrlKey &&\n !metaKey\n );\n}\n"],"names":["loop","isElementDisabled","element","getAttribute","isNotFocusable","includeDisabled","getVirtualFocusDefaultIndex","options","focusables","activeDescendantId","length","activeIndex","findIndex","id","Math","max","getFirstFocusableIndex","firstIndex","getLastFocusableIndex","lastIndex","getNextFocusableIndex","loopable","increment","currentFocusIndex","min","nextIndex","value","minmax","getSearchText","searchable","cloned","cloneNode","querySelectorAll","forEach","parentNode","removeChild","textContent","toUpperCase","recalculateFocusIndex","tabIndexBehavior","activeElement","document","isSearchableEvent","event","key","altKey","ctrlKey","metaKey"],"mappings":"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"}
1
+ {"version":3,"sources":["../../src/movement/utils.ts"],"sourcesContent":["import { type KeyboardEvent } from \"react\";\nimport { loop } from \"../utils/loop.js\";\nimport { type FocusableIndexOptions, type TabIndexBehavior } from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const isElementDisabled = (element: HTMLElement): boolean =>\n element.getAttribute(\"disabled\") !== null ||\n element.getAttribute(\"aria-disabled\") === \"true\";\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const isNotFocusable = (\n element: HTMLElement | undefined,\n includeDisabled: boolean\n): boolean => {\n if (!element) {\n return true;\n }\n\n if (includeDisabled) {\n return false;\n }\n\n return isElementDisabled(element);\n};\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface VirtualFocusableIndexOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n activeDescendantId: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport const getVirtualFocusDefaultIndex = (\n options: VirtualFocusableIndexOptions\n): number => {\n const { focusables, includeDisabled, activeDescendantId } = options;\n if (!focusables.length || (!activeDescendantId && includeDisabled)) {\n return 0;\n }\n\n const activeIndex = focusables.findIndex((element) => {\n if (activeDescendantId) {\n return element.id === activeDescendantId;\n }\n\n return !isElementDisabled(element);\n });\n return Math.max(0, activeIndex);\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getFirstFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let firstIndex = 0;\n while (\n firstIndex < focusables.length - 1 &&\n isNotFocusable(focusables[firstIndex], includeDisabled)\n ) {\n firstIndex += 1;\n }\n\n if (isNotFocusable(focusables[firstIndex], includeDisabled)) {\n return -1;\n }\n\n return firstIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getLastFocusableIndex = (\n options: FocusableIndexOptions\n): number => {\n const { focusables, includeDisabled } = options;\n\n if (!focusables.length) {\n return -1;\n }\n\n let lastIndex = focusables.length - 1;\n while (\n lastIndex > 0 &&\n isNotFocusable(focusables[lastIndex], includeDisabled)\n ) {\n lastIndex -= 1;\n }\n\n if (isNotFocusable(focusables[lastIndex], includeDisabled)) {\n return -1;\n }\n\n return lastIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\ninterface NextFocusableIndexOptions extends FocusableIndexOptions {\n loopable: boolean;\n increment: boolean;\n currentFocusIndex: number;\n}\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport const getNextFocusableIndex = (\n options: NextFocusableIndexOptions\n): number => {\n const {\n loopable,\n increment,\n focusables,\n includeDisabled,\n currentFocusIndex,\n } = options;\n if (!focusables.length) {\n return currentFocusIndex;\n }\n\n const min = getFirstFocusableIndex({ focusables, includeDisabled });\n const max = getLastFocusableIndex({ focusables, includeDisabled });\n let nextIndex = loop({\n min,\n max,\n value: currentFocusIndex,\n minmax: !loopable,\n increment,\n });\n while (\n isNotFocusable(focusables[nextIndex], includeDisabled) &&\n (loopable || nextIndex !== (increment ? max : min))\n ) {\n nextIndex = loop({\n min,\n max,\n value: nextIndex,\n minmax: !loopable,\n increment,\n });\n }\n\n // Since the `min` and `max` values are \"safely\" set, I don't need to verify\n // the nextIndex is still focusable\n return nextIndex;\n};\n\n/**\n * @remarks \\@since 5.0.0\n * @internal\n */\nexport function getSearchText(\n element: HTMLElement,\n searchable: boolean\n): string {\n if (!searchable) {\n return \"\";\n }\n\n const cloned = element.cloneNode(true) as HTMLElement;\n cloned\n .querySelectorAll(\n // Note: do not include DISPLAY_NONE_CLASS since it is presentational only\n \".rmd-icon--font,[aria-hidden=true],[hidden],[role=presentation]\"\n )\n .forEach((element) => {\n element.parentNode?.removeChild(element);\n });\n\n // Note: It would be good to use `cloned.innerText` (maybe?) at some point,\n // but it returns `undefined` in jsdom. It also does cause a reflow, so maybe\n // this is fine?\n // https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext\n return (cloned.textContent || \"\")[0].toUpperCase();\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport interface RecalculateOptions {\n focusables: readonly HTMLElement[];\n includeDisabled: boolean;\n tabIndexBehavior: TabIndexBehavior | undefined;\n activeDescendantId: string;\n}\n\n/**\n * This was added to help with specific widgets that cause focus index to change\n * between renders (i.e. expanding all tree items on the same level with `*`).\n * There might be a better way to handle this in the future.\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function recalculateFocusIndex(options: RecalculateOptions): number {\n const { focusables, includeDisabled, tabIndexBehavior, activeDescendantId } =\n options;\n if (tabIndexBehavior === \"virtual\") {\n return getVirtualFocusDefaultIndex({\n focusables,\n includeDisabled,\n activeDescendantId,\n });\n }\n\n const { activeElement } = document;\n return focusables.findIndex((element) => element === activeElement);\n}\n\n/**\n * Checks if a keyboard event can trigger a search through focusable elements\n * by:\n *\n * - checking if the key is a single letter that is not the space key\n * - checking that the alt, ctrl, and meta keys are not being held\n *\n * The shift key **is allowed** because holding shift means \"search from the\n * beginning\" instead of \"search from current location\".\n *\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function isSearchableEvent(event: KeyboardEvent): boolean {\n const { key, altKey, ctrlKey, metaKey } = event;\n\n return (\n key.length === 1 &&\n // can't search with space since it is generally a click event\n key !== \" \" &&\n !altKey &&\n !ctrlKey &&\n !metaKey\n );\n}\n\n/**\n * @remarks \\@since 6.0.0\n * @internal\n */\nexport function isTypeEvent(event: KeyboardEvent): boolean {\n return (\n isSearchableEvent(event) || [\"Backspace\", \"Delete\", \" \"].includes(event.key)\n );\n}\n"],"names":["loop","isElementDisabled","element","getAttribute","isNotFocusable","includeDisabled","getVirtualFocusDefaultIndex","options","focusables","activeDescendantId","length","activeIndex","findIndex","id","Math","max","getFirstFocusableIndex","firstIndex","getLastFocusableIndex","lastIndex","getNextFocusableIndex","loopable","increment","currentFocusIndex","min","nextIndex","value","minmax","getSearchText","searchable","cloned","cloneNode","querySelectorAll","forEach","parentNode","removeChild","textContent","toUpperCase","recalculateFocusIndex","tabIndexBehavior","activeElement","document","isSearchableEvent","event","key","altKey","ctrlKey","metaKey","isTypeEvent","includes"],"mappings":"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"}
@@ -199,14 +199,6 @@ const noop = ()=>undefined;
199
199
  ref,
200
200
  updateStyle
201
201
  ]);
202
- useEffect(()=>{
203
- if (!ref.current || !ref.current.hidden) {
204
- updateStyle();
205
- }
206
- }, [
207
- ref,
208
- updateStyle
209
- ]);
210
202
  const callbacks = {
211
203
  onEnter (appearing) {
212
204
  onEnter(appearing);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/positioning/useFixedPositioning.ts"],"sourcesContent":["\"use client\";\nimport type { CSSProperties, Ref, RefCallback, RefObject } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { delegateEvent } from \"../delegateEvent.js\";\nimport type { TransitionCallbacks } from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport { BELOW_CENTER_ANCHOR } from \"./constants.js\";\nimport { getFixedPosition } from \"./getFixedPosition.js\";\nimport type { CalculateFixedPositionOptions } from \"./types.js\";\nimport { isWithinViewport } from \"./utils.js\";\n\nconst noop = (): undefined => undefined;\n\n/**\n * @remarks \\@since 4.0.0\n */\nexport type FixedPositioningTransitionCallbacks = Pick<\n TransitionCallbacks,\n \"onEnter\" | \"onEntering\" | \"onEntered\" | \"onExited\"\n>;\n\n/**\n * This options should be passed to the {@link useCSSTransition} for the styling\n * and positioning to work correctly.\n *\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningTransitionOptions<E extends HTMLElement>\n extends FixedPositioningTransitionCallbacks {\n /** {@inheritDoc TransitionOptions.nodeRef} */\n nodeRef?: Ref<E>;\n}\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningScrollData<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> {\n fixedElement: FixedElement;\n fixedToElement: FixedToElement;\n\n /**\n * Boolean if the {@link fixedToElement} is visible within the viewport.\n */\n visible: boolean;\n}\n\n/**\n * This function is called when the page is scrolled while the fixed element is\n * visible. This is generally used to reposition the fixed element or hide it if\n * it is no longer visible within the viewport.\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @param event - The scroll event\n * @param data - The {@link FixedPositioningScrollData} that can be used for\n * custom scroll behavior.\n * @remarks \\@since 4.0.0\n */\nexport type TransitionScrollCallback<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> = (\n event: Event,\n data: Readonly<FixedPositioningScrollData<FixedToElement, FixedElement>>\n) => void;\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningOptions<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> extends FixedPositioningTransitionOptions<FixedElement>,\n CalculateFixedPositionOptions {\n /**\n * An optional style that will be merged with the fixed positioning required\n * styles.\n *\n * @see {@link FixedPositionStyle}\n */\n style?: CSSProperties;\n\n /**\n * A ref pointing to an element that another element should be fixed to. This\n * **must** be provided for the positioning to work.\n */\n fixedTo: RefObject<FixedToElement>;\n\n /**\n * An optional function that can be used to override positioning options if\n * some options require the element to be in the DOM for specific\n * calculations.\n */\n getFixedPositionOptions?(): CalculateFixedPositionOptions;\n\n /**\n * An optional function to call if the page resizes while the `FixedElement`\n * is visible.\n */\n onResize?: EventListener;\n /** @see {@link TransitionScrollCallback} */\n onScroll?: TransitionScrollCallback<FixedToElement, FixedElement>;\n}\n\n/**\n * @typeParam E - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningHookReturnValue<E extends HTMLElement> {\n /**\n * A ref that should be passed to a component for the fixed positioning\n * behavior to work correctly.\n *\n * This should really only be used if the {@link TransitionOptions} is not\n * being used.\n */\n ref: RefCallback<E>;\n\n /**\n * @see {@link FixedPositionStyle}\n */\n style: CSSProperties;\n\n /**\n * This should really only be used if the {@link transitionOptions} is not\n * being used.\n */\n callbacks: Readonly<Required<FixedPositioningTransitionCallbacks>>;\n\n /**\n * A function that can be called to update the style for the fixed element.\n */\n updateStyle(): void;\n\n /** {@inheritDoc FixedPositioningTransitionOptions} */\n transitionOptions: Readonly<Required<FixedPositioningTransitionOptions<E>>>;\n}\n\n/**\n * This hook is used to attach a temporary (fixed) element to another element\n * within the page. In other words, this is a way to have an element with\n * `position: fixed` as if it were `position: absolute` to a parent element that\n * had `position: relative`.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { ReactElement, useRef, useState } from \"react\";\n * import { Button, useCSSTransition, useFixedPositioning } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const fixedTo = useRef<HTMLButtonElement>(null);\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { style, transitionOptions } = useFixedPositioning({\n * fixedTo,\n * });\n * const { elementProps, rendered } = useCSSTransition({\n * ...transitionOptions,\n * transitionIn,\n * temporary: true,\n * timeout: {\n * enter: 200,\n * exit: 150,\n * },\n * classNames: {\n * enter: \"enter\",\n * enterActive: \"enter--active\",\n * exit: \"exit\",\n * exitActive: \"exit--active\",\n * },\n * });\n *\n * return (\n * <>\n * <Button\n * ref={fixedTo}\n * onClick={() => setTransitionIn(!transitionIn)}\n * >\n * Toggle\n * </Button>\n * {rendered && (\n * <div {...elementProps} style={style}>\n * Fixed Temporary Element\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport function useFixedPositioning<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n>(\n options: FixedPositioningOptions<FixedToElement, FixedElement>\n): FixedPositioningHookReturnValue<FixedElement> {\n const {\n style: propStyle,\n nodeRef,\n fixedTo,\n onEnter = noop,\n onEntering = noop,\n onEntered = noop,\n onExited = noop,\n anchor = BELOW_CENTER_ANCHOR,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions = noop,\n onScroll,\n onResize = noop,\n } = options;\n\n const [active, setActive] = useState(false);\n const [ref, refHandler] = useEnsuredRef(nodeRef);\n const optionsRef = useRef({\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } as const);\n useIsomorphicLayoutEffect(() => {\n optionsRef.current = {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n };\n }, [\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n ]);\n const [style, setStyle] = useState<CSSProperties | undefined>(\n () =>\n getFixedPosition({\n container: ref.current,\n element: fixedTo.current,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n }).style\n );\n\n const updateStyle = useCallback(() => {\n const {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } = optionsRef.current;\n const element = ref.current;\n const container = fixedTo.current;\n const { style } = getFixedPosition({\n container,\n element,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n });\n\n setStyle(style);\n setActive(!!element && !element.hidden);\n\n // Only changing the initialX and initialY should cause the useEffect below\n // to trigger, which is why everything else is set in a ref.\n }, [initialX, initialY]);\n\n useEffect(() => {\n if (!active) {\n return;\n }\n\n const resizeCallback = (event: Event): void => {\n onResize(event);\n updateStyle();\n };\n const scrollCallback = (event: Event): void => {\n const fixedElement = ref.current;\n const fixedToElement = fixedTo.current;\n if (onScroll && fixedElement && fixedToElement) {\n onScroll(event, {\n visible: isWithinViewport({ fixedElement, fixedToElement }),\n fixedElement,\n fixedToElement,\n });\n }\n\n updateStyle();\n };\n\n const resizeHandler = delegateEvent(\"resize\", window, true);\n const scrollHandler = delegateEvent(\"scroll\", window, true, {\n passive: true,\n });\n resizeHandler.add(resizeCallback);\n scrollHandler.add(scrollCallback);\n return () => {\n resizeHandler.remove(resizeCallback);\n scrollHandler.remove(scrollCallback);\n };\n }, [active, fixedTo, onResize, onScroll, ref, updateStyle]);\n\n useEffect(() => {\n if (!ref.current || !ref.current.hidden) {\n updateStyle();\n }\n }, [ref, updateStyle]);\n\n const callbacks: Required<FixedPositioningTransitionCallbacks> = {\n onEnter(appearing) {\n onEnter(appearing);\n updateStyle();\n },\n onEntering(appearing) {\n onEntering(appearing);\n updateStyle();\n },\n onEntered(appearing) {\n onEntered(appearing);\n updateStyle();\n },\n onExited() {\n onExited();\n setActive(false);\n },\n };\n\n return {\n ref: refHandler,\n style: { ...style, ...propStyle },\n callbacks,\n updateStyle,\n transitionOptions: {\n ...callbacks,\n nodeRef: refHandler,\n },\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","delegateEvent","useEnsuredRef","useIsomorphicLayoutEffect","BELOW_CENTER_ANCHOR","getFixedPosition","isWithinViewport","noop","undefined","useFixedPositioning","options","style","propStyle","nodeRef","fixedTo","onEnter","onEntering","onEntered","onExited","anchor","disableSwapping","disableVHBounds","initialX","initialY","preventOverlap","transformOrigin","vhMargin","vwMargin","width","xMargin","yMargin","getFixedPositionOptions","onScroll","onResize","active","setActive","ref","refHandler","optionsRef","current","setStyle","container","element","updateStyle","hidden","resizeCallback","event","scrollCallback","fixedElement","fixedToElement","visible","resizeHandler","window","scrollHandler","passive","add","remove","callbacks","appearing","transitionOptions"],"mappings":"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"}
1
+ {"version":3,"sources":["../../src/positioning/useFixedPositioning.ts"],"sourcesContent":["\"use client\";\nimport type { CSSProperties, Ref, RefCallback, RefObject } from \"react\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { delegateEvent } from \"../delegateEvent.js\";\nimport type { TransitionCallbacks } from \"../transition/types.js\";\nimport { useEnsuredRef } from \"../useEnsuredRef.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport { BELOW_CENTER_ANCHOR } from \"./constants.js\";\nimport { getFixedPosition } from \"./getFixedPosition.js\";\nimport type { CalculateFixedPositionOptions } from \"./types.js\";\nimport { isWithinViewport } from \"./utils.js\";\n\nconst noop = (): undefined => undefined;\n\n/**\n * @remarks \\@since 4.0.0\n */\nexport type FixedPositioningTransitionCallbacks = Pick<\n TransitionCallbacks,\n \"onEnter\" | \"onEntering\" | \"onEntered\" | \"onExited\"\n>;\n\n/**\n * This options should be passed to the {@link useCSSTransition} for the styling\n * and positioning to work correctly.\n *\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningTransitionOptions<E extends HTMLElement>\n extends FixedPositioningTransitionCallbacks {\n /** {@inheritDoc TransitionOptions.nodeRef} */\n nodeRef?: Ref<E>;\n}\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningScrollData<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> {\n fixedElement: FixedElement;\n fixedToElement: FixedToElement;\n\n /**\n * Boolean if the {@link fixedToElement} is visible within the viewport.\n */\n visible: boolean;\n}\n\n/**\n * This function is called when the page is scrolled while the fixed element is\n * visible. This is generally used to reposition the fixed element or hide it if\n * it is no longer visible within the viewport.\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @param event - The scroll event\n * @param data - The {@link FixedPositioningScrollData} that can be used for\n * custom scroll behavior.\n * @remarks \\@since 4.0.0\n */\nexport type TransitionScrollCallback<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> = (\n event: Event,\n data: Readonly<FixedPositioningScrollData<FixedToElement, FixedElement>>\n) => void;\n\n/**\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningOptions<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n> extends FixedPositioningTransitionOptions<FixedElement>,\n CalculateFixedPositionOptions {\n /**\n * An optional style that will be merged with the fixed positioning required\n * styles.\n *\n * @see {@link FixedPositionStyle}\n */\n style?: CSSProperties;\n\n /**\n * A ref pointing to an element that another element should be fixed to. This\n * **must** be provided for the positioning to work.\n */\n fixedTo: RefObject<FixedToElement>;\n\n /**\n * An optional function that can be used to override positioning options if\n * some options require the element to be in the DOM for specific\n * calculations.\n */\n getFixedPositionOptions?(): CalculateFixedPositionOptions;\n\n /**\n * An optional function to call if the page resizes while the `FixedElement`\n * is visible.\n */\n onResize?: EventListener;\n /** @see {@link TransitionScrollCallback} */\n onScroll?: TransitionScrollCallback<FixedToElement, FixedElement>;\n}\n\n/**\n * @typeParam E - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport interface FixedPositioningHookReturnValue<E extends HTMLElement> {\n /**\n * A ref that should be passed to a component for the fixed positioning\n * behavior to work correctly.\n *\n * This should really only be used if the {@link TransitionOptions} is not\n * being used.\n */\n ref: RefCallback<E>;\n\n /**\n * @see {@link FixedPositionStyle}\n */\n style: CSSProperties;\n\n /**\n * This should really only be used if the {@link transitionOptions} is not\n * being used.\n */\n callbacks: Readonly<Required<FixedPositioningTransitionCallbacks>>;\n\n /**\n * A function that can be called to update the style for the fixed element.\n */\n updateStyle(): void;\n\n /** {@inheritDoc FixedPositioningTransitionOptions} */\n transitionOptions: Readonly<Required<FixedPositioningTransitionOptions<E>>>;\n}\n\n/**\n * This hook is used to attach a temporary (fixed) element to another element\n * within the page. In other words, this is a way to have an element with\n * `position: fixed` as if it were `position: absolute` to a parent element that\n * had `position: relative`.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { ReactElement, useRef, useState } from \"react\";\n * import { Button, useCSSTransition, useFixedPositioning } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const fixedTo = useRef<HTMLButtonElement>(null);\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { style, transitionOptions } = useFixedPositioning({\n * fixedTo,\n * });\n * const { elementProps, rendered } = useCSSTransition({\n * ...transitionOptions,\n * transitionIn,\n * temporary: true,\n * timeout: {\n * enter: 200,\n * exit: 150,\n * },\n * classNames: {\n * enter: \"enter\",\n * enterActive: \"enter--active\",\n * exit: \"exit\",\n * exitActive: \"exit--active\",\n * },\n * });\n *\n * return (\n * <>\n * <Button\n * ref={fixedTo}\n * onClick={() => setTransitionIn(!transitionIn)}\n * >\n * Toggle\n * </Button>\n * {rendered && (\n * <div {...elementProps} style={style}>\n * Fixed Temporary Element\n * </div>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @typeParam FixedToElement - An HTMLElement type for the static element.\n * @typeParam FixedElement - An HTMLElement type for the fixed element.\n * @remarks \\@since 4.0.0\n */\nexport function useFixedPositioning<\n FixedToElement extends HTMLElement,\n FixedElement extends HTMLElement,\n>(\n options: FixedPositioningOptions<FixedToElement, FixedElement>\n): FixedPositioningHookReturnValue<FixedElement> {\n const {\n style: propStyle,\n nodeRef,\n fixedTo,\n onEnter = noop,\n onEntering = noop,\n onEntered = noop,\n onExited = noop,\n anchor = BELOW_CENTER_ANCHOR,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions = noop,\n onScroll,\n onResize = noop,\n } = options;\n\n const [active, setActive] = useState(false);\n const [ref, refHandler] = useEnsuredRef(nodeRef);\n const optionsRef = useRef({\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } as const);\n useIsomorphicLayoutEffect(() => {\n optionsRef.current = {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n };\n }, [\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n ]);\n const [style, setStyle] = useState<CSSProperties | undefined>(\n () =>\n getFixedPosition({\n container: ref.current,\n element: fixedTo.current,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n }).style\n );\n\n const updateStyle = useCallback(() => {\n const {\n ref,\n fixedTo,\n anchor,\n disableSwapping,\n disableVHBounds,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n getFixedPositionOptions,\n } = optionsRef.current;\n const element = ref.current;\n const container = fixedTo.current;\n const { style } = getFixedPosition({\n container,\n element,\n anchor,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n preventOverlap,\n transformOrigin,\n vhMargin,\n vwMargin,\n width,\n xMargin,\n yMargin,\n ...getFixedPositionOptions(),\n });\n\n setStyle(style);\n setActive(!!element && !element.hidden);\n\n // Only changing the initialX and initialY should cause the useEffect below\n // to trigger, which is why everything else is set in a ref.\n }, [initialX, initialY]);\n\n useEffect(() => {\n if (!active) {\n return;\n }\n\n const resizeCallback = (event: Event): void => {\n onResize(event);\n updateStyle();\n };\n const scrollCallback = (event: Event): void => {\n const fixedElement = ref.current;\n const fixedToElement = fixedTo.current;\n if (onScroll && fixedElement && fixedToElement) {\n onScroll(event, {\n visible: isWithinViewport({ fixedElement, fixedToElement }),\n fixedElement,\n fixedToElement,\n });\n }\n\n updateStyle();\n };\n\n const resizeHandler = delegateEvent(\"resize\", window, true);\n const scrollHandler = delegateEvent(\"scroll\", window, true, {\n passive: true,\n });\n resizeHandler.add(resizeCallback);\n scrollHandler.add(scrollCallback);\n return () => {\n resizeHandler.remove(resizeCallback);\n scrollHandler.remove(scrollCallback);\n };\n }, [active, fixedTo, onResize, onScroll, ref, updateStyle]);\n\n const callbacks: Required<FixedPositioningTransitionCallbacks> = {\n onEnter(appearing) {\n onEnter(appearing);\n updateStyle();\n },\n onEntering(appearing) {\n onEntering(appearing);\n updateStyle();\n },\n onEntered(appearing) {\n onEntered(appearing);\n updateStyle();\n },\n onExited() {\n onExited();\n setActive(false);\n },\n };\n\n return {\n ref: refHandler,\n style: { ...style, ...propStyle },\n callbacks,\n updateStyle,\n transitionOptions: {\n ...callbacks,\n nodeRef: refHandler,\n },\n };\n}\n"],"names":["useCallback","useEffect","useRef","useState","delegateEvent","useEnsuredRef","useIsomorphicLayoutEffect","BELOW_CENTER_ANCHOR","getFixedPosition","isWithinViewport","noop","undefined","useFixedPositioning","options","style","propStyle","nodeRef","fixedTo","onEnter","onEntering","onEntered","onExited","anchor","disableSwapping","disableVHBounds","initialX","initialY","preventOverlap","transformOrigin","vhMargin","vwMargin","width","xMargin","yMargin","getFixedPositionOptions","onScroll","onResize","active","setActive","ref","refHandler","optionsRef","current","setStyle","container","element","updateStyle","hidden","resizeCallback","event","scrollCallback","fixedElement","fixedToElement","visible","resizeHandler","window","scrollHandler","passive","add","remove","callbacks","appearing","transitionOptions"],"mappings":"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"}
@@ -0,0 +1,150 @@
1
+ import { type TextExtractor } from "../types.js";
2
+ import { type BaseSearchOptions } from "./types.js";
3
+ /**
4
+ * @remarks \@since 6.0.0
5
+ */
6
+ export interface CaseInsensitiveStartsWithOptions {
7
+ /**
8
+ * Set this to `true` if the item in the list must start with the query
9
+ * instead of only including it.
10
+ *
11
+ * @example
12
+ * Search Example
13
+ * ```ts
14
+ * const fruits = ["Banana", "Grape", "Apple", "Orange"];
15
+ *
16
+ * caseInsensitiveSearch({
17
+ * list: fruits,
18
+ * query: "ap",
19
+ * type: "search",
20
+ * });
21
+ * // "Grape"
22
+ *
23
+ * caseInsensitiveSearch({
24
+ * list: fruits,
25
+ * query: "ap",
26
+ * type: "search",
27
+ * startsWith: true,
28
+ * });
29
+ * // "Apple"
30
+ * ```
31
+ *
32
+ * @example
33
+ * Filter Example
34
+ * ```ts
35
+ * const fruits = ["Apple", "Banana", "Grape", "Orange"];
36
+ *
37
+ * caseInsensitiveSearch({
38
+ * list: fruits,
39
+ * query: "ap",
40
+ * });
41
+ * // ["Apple", "Grape"]
42
+ *
43
+ * caseInsensitiveSearch({
44
+ * list: fruits,
45
+ * query: "ap",
46
+ * startsWith: true,
47
+ * });
48
+ * // ["Apple"]
49
+ * ```
50
+ *
51
+ * @defaultValue `false`
52
+ */
53
+ startsWith?: boolean;
54
+ }
55
+ /**
56
+ * @remarks \@since 6.0.0
57
+ */
58
+ export interface IsCaseInsensitiveMatchOptions extends CaseInsensitiveStartsWithOptions {
59
+ /**
60
+ * The current search query.
61
+ */
62
+ query: string;
63
+ /**
64
+ * The current value to compare against.
65
+ */
66
+ value: string;
67
+ }
68
+ /**
69
+ * @remarks \@since 6.0.0
70
+ */
71
+ export declare function isCaseInsensitiveMatch(options: IsCaseInsensitiveMatchOptions): boolean;
72
+ /**
73
+ * @remarks \@since 6.0.0
74
+ */
75
+ export interface CaseInsensitiveOptions<T> extends BaseSearchOptions<T>, CaseInsensitiveStartsWithOptions {
76
+ }
77
+ /**
78
+ * @example
79
+ * String list
80
+ * ```ts
81
+ * const fruits = ["Apple", "Banana", "Grape", "Orange"];
82
+ *
83
+ * caseInsensitiveSearch({
84
+ * list: fruits,
85
+ * query: "ap",
86
+ * });
87
+ * // ["Apple", "Grape"]
88
+ *
89
+ * caseInsensitiveSearch({
90
+ * list: fruits,
91
+ * query: "ap",
92
+ * startsWith: true,
93
+ * });
94
+ * // ["Apple"]
95
+ *
96
+ * caseInsensitiveSearch({
97
+ * list: fruits,
98
+ * query: " a p",
99
+ * });
100
+ * // []
101
+ *
102
+ * caseInsensitiveSearch({
103
+ * list: fruits,
104
+ * query: " a p",
105
+ * whitespace: "ignore",
106
+ * });
107
+ * // ["Apple", "Grape"]
108
+ *
109
+ * caseInsensitiveSearch({
110
+ * list: fruits,
111
+ * query: " ap ",
112
+ * whitespace: "trim",
113
+ * });
114
+ * // ["Apple", "Grape"]
115
+ * ```
116
+ *
117
+ * @example
118
+ * Objects
119
+ * ```ts
120
+ * const fruits = [
121
+ * { name: "Apple", value: 0 },
122
+ * { name: "Banana", value: 1 },
123
+ * { name: "Grape", value: 2 },
124
+ * { name: "Orange", value: 3 },
125
+ * ];
126
+ *
127
+ * caseInsensitiveSearch({
128
+ * list: fruits,
129
+ * query: "ap",
130
+ * extractor: (item) => item.name,
131
+ * });
132
+ * // [{ name: "Apple", value: 0 }, { name: "Grape", value: 2 }]
133
+ * ```
134
+ *
135
+ * @remarks \@since 6.0.0
136
+ */
137
+ export declare function caseInsensitiveSearch<T extends string>(options: Omit<CaseInsensitiveOptions<T>, "extractor"> & {
138
+ type?: "filter";
139
+ }): readonly T[];
140
+ export declare function caseInsensitiveSearch<T extends string>(options: Omit<CaseInsensitiveOptions<T>, "extractor"> & {
141
+ type: "search";
142
+ }): T | undefined;
143
+ export declare function caseInsensitiveSearch<T>(options: CaseInsensitiveOptions<T> & {
144
+ extractor: TextExtractor<T>;
145
+ type?: "filter";
146
+ }): readonly T[];
147
+ export declare function caseInsensitiveSearch<T>(options: CaseInsensitiveOptions<T> & {
148
+ extractor: TextExtractor<T>;
149
+ type: "search";
150
+ }): T | undefined;
@@ -0,0 +1,30 @@
1
+ import { defaultExtractor, search } from "./utils.js";
2
+ /**
3
+ * @remarks \@since 6.0.0
4
+ */ export function isCaseInsensitiveMatch(options) {
5
+ const { query, value, startsWith } = options;
6
+ const matchIndex = value.indexOf(query);
7
+ if (startsWith) {
8
+ return matchIndex === 0;
9
+ }
10
+ return matchIndex !== -1;
11
+ }
12
+ export function caseInsensitiveSearch(options) {
13
+ const { list, type = "filter", query, extractor = defaultExtractor("caseInsensitiveSearch"), startsWith, whitespace } = options;
14
+ return search({
15
+ type,
16
+ list,
17
+ query,
18
+ extractor,
19
+ whitespace,
20
+ filter (q, value) {
21
+ return isCaseInsensitiveMatch({
22
+ query: q,
23
+ value,
24
+ startsWith
25
+ });
26
+ }
27
+ });
28
+ }
29
+
30
+ //# sourceMappingURL=caseInsensitive.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/searching/caseInsensitive.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\nimport { defaultExtractor, search } from \"./utils.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface CaseInsensitiveStartsWithOptions {\n /**\n * Set this to `true` if the item in the list must start with the query\n * instead of only including it.\n *\n * @example\n * Search Example\n * ```ts\n * const fruits = [\"Banana\", \"Grape\", \"Apple\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * type: \"search\",\n * });\n * // \"Grape\"\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * type: \"search\",\n * startsWith: true,\n * });\n * // \"Apple\"\n * ```\n *\n * @example\n * Filter Example\n * ```ts\n * const fruits = [\"Apple\", \"Banana\", \"Grape\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * startsWith: true,\n * });\n * // [\"Apple\"]\n * ```\n *\n * @defaultValue `false`\n */\n startsWith?: boolean;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface IsCaseInsensitiveMatchOptions\n extends CaseInsensitiveStartsWithOptions {\n /**\n * The current search query.\n */\n query: string;\n\n /**\n * The current value to compare against.\n */\n value: string;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function isCaseInsensitiveMatch(\n options: IsCaseInsensitiveMatchOptions\n): boolean {\n const { query, value, startsWith } = options;\n const matchIndex = value.indexOf(query);\n if (startsWith) {\n return matchIndex === 0;\n }\n\n return matchIndex !== -1;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface CaseInsensitiveOptions<T>\n extends BaseSearchOptions<T>,\n CaseInsensitiveStartsWithOptions {}\n\n/**\n * @example\n * String list\n * ```ts\n * const fruits = [\"Apple\", \"Banana\", \"Grape\", \"Orange\"];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * startsWith: true,\n * });\n * // [\"Apple\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" a p\",\n * });\n * // []\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" a p\",\n * whitespace: \"ignore\",\n * });\n * // [\"Apple\", \"Grape\"]\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \" ap \",\n * whitespace: \"trim\",\n * });\n * // [\"Apple\", \"Grape\"]\n * ```\n *\n * @example\n * Objects\n * ```ts\n * const fruits = [\n * { name: \"Apple\", value: 0 },\n * { name: \"Banana\", value: 1 },\n * { name: \"Grape\", value: 2 },\n * { name: \"Orange\", value: 3 },\n * ];\n *\n * caseInsensitiveSearch({\n * list: fruits,\n * query: \"ap\",\n * extractor: (item) => item.name,\n * });\n * // [{ name: \"Apple\", value: 0 }, { name: \"Grape\", value: 2 }]\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function caseInsensitiveSearch<T extends string>(\n options: Omit<CaseInsensitiveOptions<T>, \"extractor\"> & { type?: \"filter\" }\n): readonly T[];\nexport function caseInsensitiveSearch<T extends string>(\n options: Omit<CaseInsensitiveOptions<T>, \"extractor\"> & { type: \"search\" }\n): T | undefined;\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"filter\";\n }\n): readonly T[];\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T> & {\n extractor: TextExtractor<T>;\n type: \"search\";\n }\n): T | undefined;\nexport function caseInsensitiveSearch<T>(\n options: CaseInsensitiveOptions<T>\n): readonly T[] | T | undefined {\n const {\n list,\n type = \"filter\",\n query,\n extractor = defaultExtractor(\"caseInsensitiveSearch\"),\n startsWith,\n whitespace,\n } = options;\n\n return search({\n type,\n list,\n query,\n extractor,\n whitespace,\n filter(q, value) {\n return isCaseInsensitiveMatch({\n query: q,\n value,\n startsWith,\n });\n },\n });\n}\n"],"names":["defaultExtractor","search","isCaseInsensitiveMatch","options","query","value","startsWith","matchIndex","indexOf","caseInsensitiveSearch","list","type","extractor","whitespace","filter","q"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,MAAM,QAAQ,aAAa;AAuEtD;;CAEC,GACD,OAAO,SAASC,uBACdC,OAAsC;IAEtC,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,UAAU,EAAE,GAAGH;IACrC,MAAMI,aAAaF,MAAMG,OAAO,CAACJ;IACjC,IAAIE,YAAY;QACd,OAAOC,eAAe;IACxB;IAEA,OAAOA,eAAe,CAAC;AACzB;AAuFA,OAAO,SAASE,sBACdN,OAAkC;IAElC,MAAM,EACJO,IAAI,EACJC,OAAO,QAAQ,EACfP,KAAK,EACLQ,YAAYZ,iBAAiB,wBAAwB,EACrDM,UAAU,EACVO,UAAU,EACX,GAAGV;IAEJ,OAAOF,OAAO;QACZU;QACAD;QACAN;QACAQ;QACAC;QACAC,QAAOC,CAAC,EAAEV,KAAK;YACb,OAAOH,uBAAuB;gBAC5BE,OAAOW;gBACPV;gBACAC;YACF;QACF;IACF;AACF"}
@@ -0,0 +1,128 @@
1
+ import { type TextExtractor } from "../types.js";
2
+ import { type BaseSearchOptions } from "./types.js";
3
+ /**
4
+ * @example
5
+ * ```tsx
6
+ * import { createFuzzyRegExp, toSearchQuery } from "@react-md/core":
7
+ * import { useDeferredValue, useMemo, useState, type ReactElement } from "react";
8
+ *
9
+ * function Example(): ReactElement {
10
+ * const [value, setValue] = useState("");
11
+ * const deferredValue = useDeferredValue(value)
12
+ *
13
+ * const match = useMemo(() => {
14
+ * const query = toSearchQuery(deferredValue);
15
+ * if (!query) {
16
+ * return;
17
+ * }
18
+ *
19
+ * const fuzzyRegExp = createFuzzyRegExp(query);
20
+ * return options.find(option => fuzzyRegExp.test(option.label)):
21
+ * }, [options])
22
+ *
23
+ * if (match) {
24
+ * // do something
25
+ * }
26
+ * }
27
+ *
28
+ * ```
29
+ *
30
+ * @remarks \@since 6.0.0
31
+ * @see {@link fuzzySearch}
32
+ */
33
+ export declare function createFuzzyRegExp(query: string): RegExp;
34
+ /**
35
+ * @remarks \@since 6.0.0
36
+ */
37
+ export type FuzzySearchOptions<T> = BaseSearchOptions<T>;
38
+ /**
39
+ * Filters a list by making sure that all the letters appear in order ignoring
40
+ * case, punctuation, whitespace, and special characters. This is kind of the
41
+ * same filtering that appears in text editors.
42
+ *
43
+ * @example
44
+ * Simple Example
45
+ * ```ts
46
+ * const list = [
47
+ * "at",
48
+ * "charAt",
49
+ * "charCodeAt",
50
+ * "codePointAt",
51
+ * "concat",
52
+ * "constructor",
53
+ * "endsWith",
54
+ * "includes",
55
+ * "indexOf",
56
+ * "lastIndexOf",
57
+ * "length",
58
+ * "localeCompare",
59
+ * "match",
60
+ * "matchAll",
61
+ * "normalize",
62
+ * "padEnd",
63
+ * "padStart",
64
+ * "repeat",
65
+ * "replace",
66
+ * "replaceAll",
67
+ * "search",
68
+ * "slice",
69
+ * "split",
70
+ * "startsWith",
71
+ * "substring",
72
+ * "toLocaleLowerCase",
73
+ * "toLocaleUpperCase",
74
+ * "toLowerCase",
75
+ * "toString",
76
+ * "toUpperCase",
77
+ * "trim",
78
+ * "trimEnd",
79
+ * "trimStart",
80
+ * "valueOf",
81
+ * ];
82
+ *
83
+ * fuzzySearch({
84
+ * list,
85
+ * query: "la",
86
+ * });
87
+ * // [
88
+ * // "lastIndexOf",
89
+ * // ^^
90
+ * // "localeCompare",
91
+ * // ^ ^
92
+ * // "replace",
93
+ * // ^^
94
+ * // "replaceAll",
95
+ * // ^^
96
+ * // "toLocaleLowerCase",
97
+ * // ^ ^
98
+ * // "toLocaleUpperCase",
99
+ * // ^ ^
100
+ * // "toLowerCase",
101
+ * // ^ ^
102
+ * // ]
103
+ *
104
+ * fuzzySearch({
105
+ * list,
106
+ * query: "ad",
107
+ * type: "search",
108
+ * });
109
+ * // "charCodeAt"
110
+ * // ^ ^
111
+ * ```
112
+ *
113
+ * @remarks \@since 6.0.0
114
+ */
115
+ export declare function fuzzySearch<T extends string>(options: Omit<FuzzySearchOptions<T>, "extractor"> & {
116
+ type?: "filter";
117
+ }): readonly T[];
118
+ export declare function fuzzySearch<T extends string>(options: Omit<FuzzySearchOptions<T>, "extractor"> & {
119
+ type?: "search";
120
+ }): T | undefined;
121
+ export declare function fuzzySearch<T>(option: FuzzySearchOptions<T> & {
122
+ extractor: TextExtractor<T>;
123
+ type?: "filter";
124
+ }): readonly T[];
125
+ export declare function fuzzySearch<T>(option: FuzzySearchOptions<T> & {
126
+ extractor: TextExtractor<T>;
127
+ type?: "search";
128
+ }): T | undefined;
@@ -0,0 +1,54 @@
1
+ import { defaultExtractor, search } from "./utils.js";
2
+ /**
3
+ * @example
4
+ * ```tsx
5
+ * import { createFuzzyRegExp, toSearchQuery } from "@react-md/core":
6
+ * import { useDeferredValue, useMemo, useState, type ReactElement } from "react";
7
+ *
8
+ * function Example(): ReactElement {
9
+ * const [value, setValue] = useState("");
10
+ * const deferredValue = useDeferredValue(value)
11
+ *
12
+ * const match = useMemo(() => {
13
+ * const query = toSearchQuery(deferredValue);
14
+ * if (!query) {
15
+ * return;
16
+ * }
17
+ *
18
+ * const fuzzyRegExp = createFuzzyRegExp(query);
19
+ * return options.find(option => fuzzyRegExp.test(option.label)):
20
+ * }, [options])
21
+ *
22
+ * if (match) {
23
+ * // do something
24
+ * }
25
+ * }
26
+ *
27
+ * ```
28
+ *
29
+ * @remarks \@since 6.0.0
30
+ * @see {@link fuzzySearch}
31
+ */ export function createFuzzyRegExp(query) {
32
+ return new RegExp(query.split("").join("\\w*").replace(/(\(|\||\)|\\(?!w\*)|\[|\|-|\.|\^|\+|\$|\?|^(?!w)\*)/g, "\\$1")// Couldn't get the matching of two '*' working, so replace them here..
33
+ .replace(/\*\*/g, "*\\*"), "i");
34
+ }
35
+ export function fuzzySearch(options) {
36
+ const { list, type = "filter", query, extractor = defaultExtractor("fuzzySearch"), whitespace } = options;
37
+ // lazy initialize the RegExp since the base `filter` function will modify the
38
+ // query and never call the filter function if:
39
+ // - there is no query
40
+ // - the list is empty
41
+ let regexp;
42
+ return search({
43
+ type,
44
+ list,
45
+ query,
46
+ extractor,
47
+ whitespace,
48
+ filter (query, value) {
49
+ return value.length > 0 && (regexp ??= createFuzzyRegExp(query)).test(value);
50
+ }
51
+ });
52
+ }
53
+
54
+ //# sourceMappingURL=fuzzy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/searching/fuzzy.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\nimport { type BaseSearchOptions } from \"./types.js\";\nimport { defaultExtractor, search } from \"./utils.js\";\n\n/**\n * @example\n * ```tsx\n * import { createFuzzyRegExp, toSearchQuery } from \"@react-md/core\":\n * import { useDeferredValue, useMemo, useState, type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const [value, setValue] = useState(\"\");\n * const deferredValue = useDeferredValue(value)\n *\n * const match = useMemo(() => {\n * const query = toSearchQuery(deferredValue);\n * if (!query) {\n * return;\n * }\n *\n * const fuzzyRegExp = createFuzzyRegExp(query);\n * return options.find(option => fuzzyRegExp.test(option.label)):\n * }, [options])\n *\n * if (match) {\n * // do something\n * }\n * }\n *\n * ```\n *\n * @remarks \\@since 6.0.0\n * @see {@link fuzzySearch}\n */\nexport function createFuzzyRegExp(query: string): RegExp {\n return new RegExp(\n query\n .split(\"\")\n .join(\"\\\\w*\")\n .replace(/(\\(|\\||\\)|\\\\(?!w\\*)|\\[|\\|-|\\.|\\^|\\+|\\$|\\?|^(?!w)\\*)/g, \"\\\\$1\")\n // Couldn't get the matching of two '*' working, so replace them here..\n .replace(/\\*\\*/g, \"*\\\\*\"),\n \"i\"\n );\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type FuzzySearchOptions<T> = BaseSearchOptions<T>;\n\n/**\n * Filters a list by making sure that all the letters appear in order ignoring\n * case, punctuation, whitespace, and special characters. This is kind of the\n * same filtering that appears in text editors.\n *\n * @example\n * Simple Example\n * ```ts\n * const list = [\n * \"at\",\n * \"charAt\",\n * \"charCodeAt\",\n * \"codePointAt\",\n * \"concat\",\n * \"constructor\",\n * \"endsWith\",\n * \"includes\",\n * \"indexOf\",\n * \"lastIndexOf\",\n * \"length\",\n * \"localeCompare\",\n * \"match\",\n * \"matchAll\",\n * \"normalize\",\n * \"padEnd\",\n * \"padStart\",\n * \"repeat\",\n * \"replace\",\n * \"replaceAll\",\n * \"search\",\n * \"slice\",\n * \"split\",\n * \"startsWith\",\n * \"substring\",\n * \"toLocaleLowerCase\",\n * \"toLocaleUpperCase\",\n * \"toLowerCase\",\n * \"toString\",\n * \"toUpperCase\",\n * \"trim\",\n * \"trimEnd\",\n * \"trimStart\",\n * \"valueOf\",\n * ];\n *\n * fuzzySearch({\n * list,\n * query: \"la\",\n * });\n * // [\n * // \"lastIndexOf\",\n * // ^^\n * // \"localeCompare\",\n * // ^ ^\n * // \"replace\",\n * // ^^\n * // \"replaceAll\",\n * // ^^\n * // \"toLocaleLowerCase\",\n * // ^ ^\n * // \"toLocaleUpperCase\",\n * // ^ ^\n * // \"toLowerCase\",\n * // ^ ^\n * // ]\n *\n * fuzzySearch({\n * list,\n * query: \"ad\",\n * type: \"search\",\n * });\n * // \"charCodeAt\"\n * // ^ ^\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function fuzzySearch<T extends string>(\n options: Omit<FuzzySearchOptions<T>, \"extractor\"> & { type?: \"filter\" }\n): readonly T[];\nexport function fuzzySearch<T extends string>(\n options: Omit<FuzzySearchOptions<T>, \"extractor\"> & { type?: \"search\" }\n): T | undefined;\nexport function fuzzySearch<T>(\n option: FuzzySearchOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"filter\";\n }\n): readonly T[];\nexport function fuzzySearch<T>(\n option: FuzzySearchOptions<T> & {\n extractor: TextExtractor<T>;\n type?: \"search\";\n }\n): T | undefined;\nexport function fuzzySearch<T>(\n options: FuzzySearchOptions<T>\n): readonly T[] | T | undefined {\n const {\n list,\n type = \"filter\",\n query,\n extractor = defaultExtractor(\"fuzzySearch\"),\n whitespace,\n } = options;\n\n // lazy initialize the RegExp since the base `filter` function will modify the\n // query and never call the filter function if:\n // - there is no query\n // - the list is empty\n let regexp: RegExp;\n return search({\n type,\n list,\n query,\n extractor,\n whitespace,\n filter(query, value) {\n return (\n value.length > 0 && (regexp ??= createFuzzyRegExp(query)).test(value)\n );\n },\n });\n}\n"],"names":["defaultExtractor","search","createFuzzyRegExp","query","RegExp","split","join","replace","fuzzySearch","options","list","type","extractor","whitespace","regexp","filter","value","length","test"],"mappings":"AAEA,SAASA,gBAAgB,EAAEC,MAAM,QAAQ,aAAa;AAEtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BC,GACD,OAAO,SAASC,kBAAkBC,KAAa;IAC7C,OAAO,IAAIC,OACTD,MACGE,KAAK,CAAC,IACNC,IAAI,CAAC,QACLC,OAAO,CAAC,wDAAwD,OACjE,uEAAuE;KACtEA,OAAO,CAAC,SAAS,SACpB;AAEJ;AAsGA,OAAO,SAASC,YACdC,OAA8B;IAE9B,MAAM,EACJC,IAAI,EACJC,OAAO,QAAQ,EACfR,KAAK,EACLS,YAAYZ,iBAAiB,cAAc,EAC3Ca,UAAU,EACX,GAAGJ;IAEJ,8EAA8E;IAC9E,+CAA+C;IAC/C,sBAAsB;IACtB,sBAAsB;IACtB,IAAIK;IACJ,OAAOb,OAAO;QACZU;QACAD;QACAP;QACAS;QACAC;QACAE,QAAOZ,KAAK,EAAEa,KAAK;YACjB,OACEA,MAAMC,MAAM,GAAG,KAAK,AAACH,CAAAA,WAAWZ,kBAAkBC,MAAK,EAAGe,IAAI,CAACF;QAEnE;IACF;AACF"}
@@ -0,0 +1,5 @@
1
+ import { type WhitespaceFilter } from "./types.js";
2
+ /**
3
+ * @remarks \@since 6.0.0
4
+ */
5
+ export declare function toSearchQuery(s: string, whitespace?: WhitespaceFilter): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @remarks \@since 6.0.0
3
+ */ export function toSearchQuery(s, whitespace = "keep") {
4
+ let q = s.toLowerCase();
5
+ if (whitespace === "ignore") {
6
+ q = q.replace(/\s/g, "");
7
+ } else if (whitespace === "trim") {
8
+ q = q.trim();
9
+ }
10
+ return q;
11
+ }
12
+
13
+ //# sourceMappingURL=toSearchQuery.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/searching/toSearchQuery.ts"],"sourcesContent":["import { type WhitespaceFilter } from \"./types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport function toSearchQuery(\n s: string,\n whitespace: WhitespaceFilter = \"keep\"\n): string {\n let q = s.toLowerCase();\n if (whitespace === \"ignore\") {\n q = q.replace(/\\s/g, \"\");\n } else if (whitespace === \"trim\") {\n q = q.trim();\n }\n\n return q;\n}\n"],"names":["toSearchQuery","s","whitespace","q","toLowerCase","replace","trim"],"mappings":"AAEA;;CAEC,GACD,OAAO,SAASA,cACdC,CAAS,EACTC,aAA+B,MAAM;IAErC,IAAIC,IAAIF,EAAEG,WAAW;IACrB,IAAIF,eAAe,UAAU;QAC3BC,IAAIA,EAAEE,OAAO,CAAC,OAAO;IACvB,OAAO,IAAIH,eAAe,QAAQ;QAChCC,IAAIA,EAAEG,IAAI;IACZ;IAEA,OAAOH;AACT"}
@@ -0,0 +1,28 @@
1
+ import { type TextExtractor } from "../types.js";
2
+ /**
3
+ * @remarks \@since 6.0.0
4
+ */
5
+ export type WhitespaceFilter = "ignore" | "trim" | "keep";
6
+ /**
7
+ * @remarks \@since 6.0.0
8
+ */
9
+ export interface BaseSearchOptions<T> {
10
+ list: readonly T[];
11
+ /**
12
+ * @defaultValue `"filter"`
13
+ */
14
+ type?: "search" | "filter";
15
+ /**
16
+ * The current query string. i.e. `"SeArch"`
17
+ */
18
+ query: string;
19
+ /**
20
+ * This is required if the list includes anything other than strings.
21
+ * @see {@link TextExtractor}
22
+ */
23
+ extractor?: TextExtractor<T>;
24
+ /**
25
+ * @defaultValue `"keep"`
26
+ */
27
+ whitespace?: WhitespaceFilter;
28
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * @remarks \@since 6.0.0
3
+ */ export { };
4
+
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/searching/types.ts"],"sourcesContent":["import { type TextExtractor } from \"../types.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type WhitespaceFilter = \"ignore\" | \"trim\" | \"keep\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface BaseSearchOptions<T> {\n list: readonly T[];\n\n /**\n * @defaultValue `\"filter\"`\n */\n type?: \"search\" | \"filter\";\n\n /**\n * The current query string. i.e. `\"SeArch\"`\n */\n query: string;\n\n /**\n * This is required if the list includes anything other than strings.\n * @see {@link TextExtractor}\n */\n extractor?: TextExtractor<T>;\n\n /**\n * @defaultValue `\"keep\"`\n */\n whitespace?: WhitespaceFilter;\n}\n"],"names":[],"mappings":"AAOA;;CAEC,GACD,WAuBC"}
@@ -0,0 +1,21 @@
1
+ import { type TextExtractor } from "../types.js";
2
+ import { type BaseSearchOptions } from "./types.js";
3
+ /**
4
+ * @remarks \@since 6.0.0
5
+ * @internal
6
+ */
7
+ export declare const defaultExtractor: <T>(name: string) => (item: T) => string;
8
+ /**
9
+ * @internal
10
+ * @remarks \@since 6.0.0
11
+ */
12
+ export interface SearchOptions<T> extends BaseSearchOptions<T> {
13
+ type: "search" | "filter";
14
+ filter(query: string, value: string): boolean;
15
+ extractor: TextExtractor<T>;
16
+ }
17
+ /**
18
+ * @internal
19
+ * @remarks \@since 6.0.0
20
+ */
21
+ export declare function search<T>(options: SearchOptions<T>): readonly T[] | T | undefined;