@react-md/core 1.0.0-next.1 → 1.0.0-next.10

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 (1198) hide show
  1. package/.stylelintrc.json +14 -0
  2. package/.turbo/turbo-build.log +11 -7
  3. package/.turbo/turbo-lint.log +12 -12
  4. package/.turbo/turbo-test.log +5512 -166
  5. package/.turbo/turbo-typecheck.log +4 -4
  6. package/CHANGELOG.md +177 -0
  7. package/README.md +39 -24
  8. package/coverage/clover.xml +2 -2
  9. package/coverage/lcov-report/AutoComplete.tsx.html +283 -0
  10. package/coverage/lcov-report/Avatar.tsx.html +472 -0
  11. package/coverage/lcov-report/DefaultToastRenderer.tsx.html +166 -112
  12. package/coverage/lcov-report/IconRotator.tsx.html +322 -0
  13. package/coverage/lcov-report/ListItem.tsx.html +892 -0
  14. package/coverage/lcov-report/ListItemLink.tsx.html +616 -0
  15. package/coverage/lcov-report/MenuItemCheckbox.tsx.html +223 -0
  16. package/coverage/lcov-report/MenuItemInputToggle.tsx.html +178 -232
  17. package/coverage/lcov-report/MenuItemRadio.tsx.html +436 -0
  18. package/coverage/lcov-report/Portal.tsx.html +223 -0
  19. package/coverage/lcov-report/PortalContainerProvider.tsx.html +367 -0
  20. package/coverage/lcov-report/RootHtml.tsx.html +370 -0
  21. package/coverage/lcov-report/Select.tsx.html +1411 -0
  22. package/coverage/lcov-report/SkeletonPlaceholder.tsx.html +613 -0
  23. package/coverage/lcov-report/Snackbar.tsx.html +360 -402
  24. package/coverage/lcov-report/SrOnly.tsx.html +328 -0
  25. package/coverage/lcov-report/Tab.tsx.html +261 -147
  26. package/coverage/lcov-report/Toast.tsx.html +868 -0
  27. package/coverage/lcov-report/ToastManager.tsx.html +1783 -0
  28. package/coverage/lcov-report/ToastManagerProvider.tsx.html +216 -216
  29. package/coverage/lcov-report/TreeGroup.tsx.html +313 -0
  30. package/coverage/lcov-report/Typography.tsx.html +1027 -0
  31. package/coverage/lcov-report/app-bar/AppBar.tsx.html +178 -28
  32. package/coverage/lcov-report/app-bar/index.html +7 -7
  33. package/coverage/lcov-report/autocomplete/AutoComplete.tsx.html +283 -0
  34. package/coverage/lcov-report/autocomplete/Autocomplete.tsx.html +475 -0
  35. package/coverage/lcov-report/autocomplete/AutocompleteGeneric.tsx.html +304 -0
  36. package/coverage/lcov-report/autocomplete/index.html +221 -0
  37. package/coverage/lcov-report/autocomplete/useAutoComplete.ts.html +775 -0
  38. package/coverage/lcov-report/autocomplete/useAutocomplete.ts.html +1273 -0
  39. package/coverage/lcov-report/autocomplete/useAutocompleteAgain.ts.html +829 -0
  40. package/coverage/lcov-report/autocomplete/useAutocompletev2.ts.html +715 -0
  41. package/coverage/lcov-report/autocomplete/useInlineAutoComplete.ts.html +340 -0
  42. package/coverage/lcov-report/autocomplete/useInlineAutocomplete.ts.html +430 -0
  43. package/coverage/lcov-report/autocomplete/useInlineSelection.ts.html +310 -0
  44. package/coverage/lcov-report/autocomplete/utils.ts.html +196 -0
  45. package/coverage/lcov-report/avatar/Avatar.tsx.html +162 -99
  46. package/coverage/lcov-report/avatar/index.html +19 -34
  47. package/coverage/lcov-report/avatar/styles.ts.html +1 -1
  48. package/coverage/lcov-report/button/Button.tsx.html +85 -85
  49. package/coverage/lcov-report/button/TooltippedButton.tsx.html +445 -0
  50. package/coverage/lcov-report/button/index.html +12 -12
  51. package/coverage/lcov-report/card/Card.tsx.html +349 -0
  52. package/coverage/lcov-report/card/CardContent.tsx.html +223 -0
  53. package/coverage/lcov-report/card/ClickableCard.tsx.html +400 -0
  54. package/coverage/lcov-report/card/index.html +21 -21
  55. package/coverage/lcov-report/card/styles.ts.html +428 -392
  56. package/coverage/lcov-report/cssUtils.ts.html +86 -59
  57. package/coverage/lcov-report/dialog/DialogFooter.tsx.html +36 -36
  58. package/coverage/lcov-report/dialog/DialogHeader.tsx.html +26 -26
  59. package/coverage/lcov-report/dialog/index.html +34 -19
  60. package/coverage/lcov-report/draggable/index.html +21 -36
  61. package/coverage/lcov-report/draggable/useDraggable.ts.html +377 -368
  62. package/coverage/lcov-report/draggable/utils.ts.html +96 -195
  63. package/coverage/lcov-report/expansion-panel/ExpansionList.tsx.html +211 -0
  64. package/coverage/lcov-report/expansion-panel/ExpansionPanel.tsx.html +12 -15
  65. package/coverage/lcov-report/expansion-panel/index.html +34 -19
  66. package/coverage/lcov-report/expansion-panel/useExpansionPanels.ts.html +928 -0
  67. package/coverage/lcov-report/form/AutoComplete.tsx.html +283 -0
  68. package/coverage/lcov-report/form/Form.tsx.html +22 -22
  69. package/coverage/lcov-report/form/Label.tsx.html +442 -0
  70. package/coverage/lcov-report/form/MenuItemInputToggle.tsx.html +2 -2
  71. package/coverage/lcov-report/form/OptGroup.tsx.html +169 -166
  72. package/coverage/lcov-report/form/Option.tsx.html +727 -0
  73. package/coverage/lcov-report/form/ResizingTextArea.tsx.html +442 -0
  74. package/coverage/lcov-report/form/ResizingTextAreaWrapper.tsx.html +310 -0
  75. package/coverage/lcov-report/form/Select.tsx.html +1456 -0
  76. package/coverage/lcov-report/form/SelectOriginal.tsx.html +1630 -0
  77. package/coverage/lcov-report/form/SelectV2.tsx.html +1024 -0
  78. package/coverage/lcov-report/form/SelectedOption.tsx.html +250 -0
  79. package/coverage/lcov-report/form/SimpleTextArea.tsx.html +727 -0
  80. package/coverage/lcov-report/form/Slider.tsx.html +163 -40
  81. package/coverage/lcov-report/form/TextArea.tsx.html +596 -740
  82. package/coverage/lcov-report/form/TextArea2.tsx.html +985 -0
  83. package/coverage/lcov-report/form/TextAreaBackup.tsx.html +1006 -0
  84. package/coverage/lcov-report/form/TextField.tsx.html +156 -234
  85. package/coverage/lcov-report/form/index.html +111 -21
  86. package/coverage/lcov-report/form/selectUtils.ts.html +188 -221
  87. package/coverage/lcov-report/form/textAreaStyles.ts.html +8 -11
  88. package/coverage/lcov-report/form/useAutoComplete.ts.html +787 -0
  89. package/coverage/lcov-report/form/useCombobox.ts.html +454 -460
  90. package/coverage/lcov-report/form/useComboboxList.ts.html +108 -93
  91. package/coverage/lcov-report/form/useFormReset.ts.html +229 -0
  92. package/coverage/lcov-report/form/useInlineAutoComplete.ts.html +379 -0
  93. package/coverage/lcov-report/form/useResizingTextArea.ts.html +631 -0
  94. package/coverage/lcov-report/form/useResizingTextArea2.ts.html +631 -0
  95. package/coverage/lcov-report/form/useSelectCombobox.ts.html +499 -0
  96. package/coverage/lcov-report/form/utils.ts.html +209 -170
  97. package/coverage/lcov-report/getListItemHeight.ts.html +298 -0
  98. package/coverage/lcov-report/icon/FontIcon.tsx.html +64 -64
  99. package/coverage/lcov-report/icon/MaterialIcon.tsx.html +235 -0
  100. package/coverage/lcov-report/icon/index.html +19 -19
  101. package/coverage/lcov-report/index.html +1 -1
  102. package/coverage/lcov-report/interaction/UserInteractionModeProvider.tsx.html +679 -0
  103. package/coverage/lcov-report/interaction/config.ts.html +181 -0
  104. package/coverage/lcov-report/interaction/index.html +33 -18
  105. package/coverage/lcov-report/list/List.tsx.html +490 -0
  106. package/coverage/lcov-report/list/ListItem.tsx.html +886 -0
  107. package/coverage/lcov-report/list/ListItemAddon.tsx.html +286 -0
  108. package/coverage/lcov-report/list/ListItemChildren.tsx.html +445 -0
  109. package/coverage/lcov-report/list/ListItemLink.tsx.html +5 -5
  110. package/coverage/lcov-report/list/index.html +81 -6
  111. package/coverage/lcov-report/list/listItemStyles.ts.html +703 -0
  112. package/coverage/lcov-report/media-queries/appSize.ts.html +1 -1
  113. package/coverage/lcov-report/media-queries/index.html +1 -1
  114. package/coverage/lcov-report/menu/DropdownMenu.tsx.html +188 -188
  115. package/coverage/lcov-report/menu/Menu.tsx.html +276 -252
  116. package/coverage/lcov-report/menu/MenuItem.tsx.html +292 -0
  117. package/coverage/lcov-report/menu/MenuItemCircularProgress.tsx.html +433 -0
  118. package/coverage/lcov-report/menu/MenuVisibilityProvider.tsx.html +48 -33
  119. package/coverage/lcov-report/menu/index.html +14 -44
  120. package/coverage/lcov-report/menu/useContextMenu.ts.html +490 -0
  121. package/coverage/lcov-report/menuItemInputToggleStyles.ts.html +319 -0
  122. package/coverage/lcov-report/movement/index.html +19 -19
  123. package/coverage/lcov-report/movement/useKeyboardMovementProvider.ts.html +422 -383
  124. package/coverage/lcov-report/positioning/constants.ts.html +463 -0
  125. package/coverage/lcov-report/positioning/index.html +30 -30
  126. package/coverage/lcov-report/positioning/useFixedPositioning.ts.html +1321 -0
  127. package/coverage/lcov-report/progress/CircularProgress.tsx.html +184 -184
  128. package/coverage/lcov-report/progress/index.html +19 -34
  129. package/coverage/lcov-report/searching/caseInsensitive.ts.html +685 -0
  130. package/coverage/lcov-report/searching/fuzzy.ts.html +610 -0
  131. package/coverage/lcov-report/searching/index.html +146 -0
  132. package/coverage/lcov-report/searching/toSearchQuery.ts.html +145 -0
  133. package/coverage/lcov-report/searching/useFuzzyMatch.ts.html +211 -0
  134. package/coverage/lcov-report/searching/utils.ts.html +244 -0
  135. package/coverage/lcov-report/sheet/index.html +8 -8
  136. package/coverage/lcov-report/sheet/styles.ts.html +376 -0
  137. package/coverage/lcov-report/skeletonPlaceholderUtils.ts.html +400 -0
  138. package/coverage/lcov-report/snackbar/Snackbar.tsx.html +55 -97
  139. package/coverage/lcov-report/snackbar/Toast.tsx.html +546 -501
  140. package/coverage/lcov-report/snackbar/ToastManager.tsx.html +269 -269
  141. package/coverage/lcov-report/snackbar/ToastManagerProvider.tsx.html +23 -23
  142. package/coverage/lcov-report/snackbar/index.html +59 -14
  143. package/coverage/lcov-report/snackbar/snackbarStyles.ts.html +12 -87
  144. package/coverage/lcov-report/snackbar/toastStyles.ts.html +206 -146
  145. package/coverage/lcov-report/snackbar/useCurrentToastActions.ts.html +226 -0
  146. package/coverage/lcov-report/snackbarStyles.ts.html +46 -121
  147. package/coverage/lcov-report/src/CoreProviders.tsx.html +20 -20
  148. package/coverage/lcov-report/src/NoSsr.tsx.html +1 -1
  149. package/coverage/lcov-report/src/RootHtml.tsx.html +370 -0
  150. package/coverage/lcov-report/src/SsrProvider.tsx.html +10 -10
  151. package/coverage/lcov-report/src/app-bar/AppBar.tsx.html +143 -23
  152. package/coverage/lcov-report/src/app-bar/AppBarTitle.tsx.html +1 -1
  153. package/coverage/lcov-report/src/app-bar/index.html +5 -5
  154. package/coverage/lcov-report/src/autocomplete/Autocomplete.tsx.html +364 -0
  155. package/coverage/lcov-report/src/autocomplete/AutocompleteGeneric.tsx.html +304 -0
  156. package/coverage/lcov-report/src/autocomplete/index.html +221 -0
  157. package/coverage/lcov-report/src/autocomplete/useAutocomplete.ts.html +637 -0
  158. package/coverage/lcov-report/src/autocomplete/useAutocompleteAgain.ts.html +829 -0
  159. package/coverage/lcov-report/src/autocomplete/useAutocompletev2.ts.html +715 -0
  160. package/coverage/lcov-report/src/autocomplete/useInlineAutocomplete.ts.html +430 -0
  161. package/coverage/lcov-report/src/autocomplete/useInlineSelection.ts.html +241 -0
  162. package/coverage/lcov-report/src/autocomplete/utils.ts.html +196 -0
  163. package/coverage/lcov-report/src/avatar/Avatar.tsx.html +2 -2
  164. package/coverage/lcov-report/src/avatar/index.html +1 -1
  165. package/coverage/lcov-report/src/avatar/styles.ts.html +1 -1
  166. package/coverage/lcov-report/src/badge/Badge.tsx.html +1 -1
  167. package/coverage/lcov-report/src/badge/index.html +1 -1
  168. package/coverage/lcov-report/src/box/Box.tsx.html +1 -1
  169. package/coverage/lcov-report/src/box/index.html +23 -8
  170. package/coverage/lcov-report/src/box/styles.ts.html +46 -46
  171. package/coverage/lcov-report/src/button/AsyncButton.tsx.html +1 -1
  172. package/coverage/lcov-report/src/button/Button.tsx.html +87 -87
  173. package/coverage/lcov-report/src/button/ButtonUnstyled.tsx.html +1 -1
  174. package/coverage/lcov-report/src/button/FloatingActionButton.tsx.html +11 -11
  175. package/coverage/lcov-report/src/button/TooltippedButton.tsx.html +445 -0
  176. package/coverage/lcov-report/src/button/buttonStyles.ts.html +52 -52
  177. package/coverage/lcov-report/src/button/buttonUnstyledStyles.ts.html +1 -1
  178. package/coverage/lcov-report/src/button/index.html +8 -23
  179. package/coverage/lcov-report/src/card/Card.tsx.html +37 -31
  180. package/coverage/lcov-report/src/card/CardContent.tsx.html +4 -4
  181. package/coverage/lcov-report/src/card/CardFooter.tsx.html +1 -1
  182. package/coverage/lcov-report/src/card/CardHeader.tsx.html +1 -1
  183. package/coverage/lcov-report/src/card/CardSubtitle.tsx.html +1 -1
  184. package/coverage/lcov-report/src/card/CardTitle.tsx.html +1 -1
  185. package/coverage/lcov-report/src/card/ClickableCard.tsx.html +400 -0
  186. package/coverage/lcov-report/src/card/index.html +24 -9
  187. package/coverage/lcov-report/src/card/styles.ts.html +58 -31
  188. package/coverage/lcov-report/src/chip/Chip.tsx.html +1 -1
  189. package/coverage/lcov-report/src/chip/index.html +7 -7
  190. package/coverage/lcov-report/src/chip/styles.ts.html +9 -12
  191. package/coverage/lcov-report/src/cssUtils.ts.html +53 -53
  192. package/coverage/lcov-report/src/delegateEvent.ts.html +109 -109
  193. package/coverage/lcov-report/src/dialog/Dialog.tsx.html +1 -1
  194. package/coverage/lcov-report/src/dialog/DialogContainer.tsx.html +1 -1
  195. package/coverage/lcov-report/src/dialog/DialogContent.tsx.html +1 -1
  196. package/coverage/lcov-report/src/dialog/DialogFooter.tsx.html +1 -1
  197. package/coverage/lcov-report/src/dialog/DialogHeader.tsx.html +1 -1
  198. package/coverage/lcov-report/src/dialog/DialogTitle.tsx.html +1 -1
  199. package/coverage/lcov-report/src/dialog/FixedDialog.tsx.html +1 -1
  200. package/coverage/lcov-report/src/dialog/NestedDialogProvider.ts.html +1 -1
  201. package/coverage/lcov-report/src/dialog/index.html +129 -9
  202. package/coverage/lcov-report/src/dialog/styles.ts.html +1 -1
  203. package/coverage/lcov-report/src/divider/Divider.tsx.html +4 -7
  204. package/coverage/lcov-report/src/divider/index.html +5 -5
  205. package/coverage/lcov-report/src/divider/styles.ts.html +1 -1
  206. package/coverage/lcov-report/src/draggable/index.html +27 -27
  207. package/coverage/lcov-report/src/draggable/useDraggable.ts.html +47 -44
  208. package/coverage/lcov-report/src/draggable/utils.ts.html +29 -131
  209. package/coverage/lcov-report/src/expansion-panel/ExpansionList.tsx.html +1 -1
  210. package/coverage/lcov-report/src/expansion-panel/ExpansionPanel.tsx.html +1 -1
  211. package/coverage/lcov-report/src/expansion-panel/ExpansionPanelHeader.tsx.html +1 -1
  212. package/coverage/lcov-report/src/expansion-panel/index.html +8 -8
  213. package/coverage/lcov-report/src/expansion-panel/useExpansionList.ts.html +1 -1
  214. package/coverage/lcov-report/src/expansion-panel/useExpansionPanels.ts.html +36 -24
  215. package/coverage/lcov-report/src/focus/index.html +1 -1
  216. package/coverage/lcov-report/src/focus/useFocusContainer.ts.html +1 -1
  217. package/coverage/lcov-report/src/focus/utils.ts.html +1 -1
  218. package/coverage/lcov-report/src/form/AutoComplete.tsx.html +283 -0
  219. package/coverage/lcov-report/src/form/Checkbox.tsx.html +1 -1
  220. package/coverage/lcov-report/src/form/Fieldset.tsx.html +1 -1
  221. package/coverage/lcov-report/src/form/FileInput.tsx.html +1 -1
  222. package/coverage/lcov-report/src/form/Form.tsx.html +11 -8
  223. package/coverage/lcov-report/src/form/FormMessage.tsx.html +1 -1
  224. package/coverage/lcov-report/src/form/FormMessageContainer.tsx.html +5 -5
  225. package/coverage/lcov-report/src/form/FormMessageCounter.tsx.html +1 -1
  226. package/coverage/lcov-report/src/form/InputToggle.tsx.html +110 -110
  227. package/coverage/lcov-report/src/form/InputToggleIcon.tsx.html +63 -63
  228. package/coverage/lcov-report/src/form/Label.tsx.html +98 -98
  229. package/coverage/lcov-report/src/form/Legend.tsx.html +1 -1
  230. package/coverage/lcov-report/src/form/MenuItemCheckbox.tsx.html +3 -3
  231. package/coverage/lcov-report/src/form/MenuItemFileInput.tsx.html +1 -1
  232. package/coverage/lcov-report/src/form/MenuItemInputToggle.tsx.html +178 -232
  233. package/coverage/lcov-report/src/form/MenuItemRadio.tsx.html +3 -3
  234. package/coverage/lcov-report/src/form/MenuItemSwitch.tsx.html +1 -1
  235. package/coverage/lcov-report/src/form/MenuItemTextField.tsx.html +1 -1
  236. package/coverage/lcov-report/src/form/NativeSelect.tsx.html +1 -1
  237. package/coverage/lcov-report/src/form/OptGroup.tsx.html +1 -1
  238. package/coverage/lcov-report/src/form/Option.tsx.html +1 -1
  239. package/coverage/lcov-report/src/form/Password.tsx.html +1 -1
  240. package/coverage/lcov-report/src/form/Radio.tsx.html +3 -3
  241. package/coverage/lcov-report/src/form/ResizingTextArea.tsx.html +988 -0
  242. package/coverage/lcov-report/src/form/ResizingTextAreaWrapper.tsx.html +310 -0
  243. package/coverage/lcov-report/src/form/Select.tsx.html +894 -1122
  244. package/coverage/lcov-report/src/form/SelectValue.tsx.html +1 -1
  245. package/coverage/lcov-report/src/form/SimpleTextArea.tsx.html +694 -0
  246. package/coverage/lcov-report/src/form/Slider.tsx.html +1 -1
  247. package/coverage/lcov-report/src/form/SliderContainer.tsx.html +1 -1
  248. package/coverage/lcov-report/src/form/SliderMark.tsx.html +1 -1
  249. package/coverage/lcov-report/src/form/SliderMarkLabel.tsx.html +1 -1
  250. package/coverage/lcov-report/src/form/SliderThumb.tsx.html +1 -1
  251. package/coverage/lcov-report/src/form/SliderTrack.tsx.html +1 -1
  252. package/coverage/lcov-report/src/form/SliderValueMarks.tsx.html +1 -1
  253. package/coverage/lcov-report/src/form/SliderValueTooltip.tsx.html +1 -1
  254. package/coverage/lcov-report/src/form/Switch.tsx.html +1 -1
  255. package/coverage/lcov-report/src/form/SwitchTrack.tsx.html +1 -1
  256. package/coverage/lcov-report/src/form/TextArea.tsx.html +646 -580
  257. package/coverage/lcov-report/src/form/TextArea2.tsx.html +985 -0
  258. package/coverage/lcov-report/src/form/TextAreaBackup.tsx.html +985 -0
  259. package/coverage/lcov-report/src/form/TextField.tsx.html +3 -3
  260. package/coverage/lcov-report/src/form/TextFieldAddon.tsx.html +1 -1
  261. package/coverage/lcov-report/src/form/TextFieldContainer.tsx.html +1 -1
  262. package/coverage/lcov-report/src/form/TextFieldContainerStyles.ts.html +8 -8
  263. package/coverage/lcov-report/src/form/fileUtils.ts.html +1 -1
  264. package/coverage/lcov-report/src/form/formConfig.ts.html +1 -1
  265. package/coverage/lcov-report/src/form/formMessageStyles.ts.html +1 -1
  266. package/coverage/lcov-report/src/form/index.html +81 -21
  267. package/coverage/lcov-report/src/form/inputToggleStyles.ts.html +30 -30
  268. package/coverage/lcov-report/src/form/menuItemInputToggleStyles.ts.html +319 -0
  269. package/coverage/lcov-report/src/form/nativeSelectStyles.ts.html +1 -1
  270. package/coverage/lcov-report/src/form/optionStyles.ts.html +1 -1
  271. package/coverage/lcov-report/src/form/passwordStyles.ts.html +1 -1
  272. package/coverage/lcov-report/src/form/selectStyles.ts.html +1 -1
  273. package/coverage/lcov-report/src/form/selectUtils.ts.html +1 -1
  274. package/coverage/lcov-report/src/form/sliderUtils.ts.html +1 -1
  275. package/coverage/lcov-report/src/form/switchStyles.ts.html +1 -1
  276. package/coverage/lcov-report/src/form/textAreaStyles.ts.html +3 -3
  277. package/coverage/lcov-report/src/form/textFieldStyles.ts.html +1 -1
  278. package/coverage/lcov-report/src/form/useAutoComplete.ts.html +787 -0
  279. package/coverage/lcov-report/src/form/useCheckboxGroup.ts.html +1 -1
  280. package/coverage/lcov-report/src/form/useCombobox.ts.html +943 -457
  281. package/coverage/lcov-report/src/form/useEditableCombobox.ts.html +502 -0
  282. package/coverage/lcov-report/src/form/useFileUpload.ts.html +1 -1
  283. package/coverage/lcov-report/src/form/useInlineAutoComplete.ts.html +109 -0
  284. package/coverage/lcov-report/src/form/useListboxProvider.ts.html +1 -1
  285. package/coverage/lcov-report/src/form/useNumberField.ts.html +1 -1
  286. package/coverage/lcov-report/src/form/useRadioGroup.ts.html +47 -47
  287. package/coverage/lcov-report/src/form/useRangeSlider.ts.html +1 -1
  288. package/coverage/lcov-report/src/form/useResizingTextArea.ts.html +405 -294
  289. package/coverage/lcov-report/src/form/useSelectCombobox.ts.html +295 -0
  290. package/coverage/lcov-report/src/form/useSlider.ts.html +1 -1
  291. package/coverage/lcov-report/src/form/useTextField.ts.html +1 -1
  292. package/coverage/lcov-report/src/form/utils.ts.html +200 -170
  293. package/coverage/lcov-report/src/form/validation.ts.html +1 -1
  294. package/coverage/lcov-report/src/hoverMode/index.html +1 -1
  295. package/coverage/lcov-report/src/hoverMode/useHoverMode.ts.html +98 -98
  296. package/coverage/lcov-report/src/hoverMode/useHoverModeProvider.ts.html +19 -19
  297. package/coverage/lcov-report/src/icon/FontIcon.tsx.html +28 -28
  298. package/coverage/lcov-report/src/icon/IconRotator.tsx.html +5 -8
  299. package/coverage/lcov-report/src/icon/MaterialIcon.tsx.html +1 -1
  300. package/coverage/lcov-report/src/icon/MaterialSymbol.tsx.html +1 -1
  301. package/coverage/lcov-report/src/icon/SVGIcon.tsx.html +1 -1
  302. package/coverage/lcov-report/src/icon/TextIconSpacing.tsx.html +51 -51
  303. package/coverage/lcov-report/src/icon/iconConfig.tsx.html +10 -10
  304. package/coverage/lcov-report/src/icon/index.html +10 -145
  305. package/coverage/lcov-report/src/icon/material.ts.html +1 -1
  306. package/coverage/lcov-report/src/icon/materialConfig.ts.html +1 -1
  307. package/coverage/lcov-report/src/icon/styles.ts.html +38 -38
  308. package/coverage/lcov-report/src/index.html +10 -10
  309. package/coverage/lcov-report/src/interaction/Ripple.tsx.html +1 -1
  310. package/coverage/lcov-report/src/interaction/RippleContainer.tsx.html +1 -1
  311. package/coverage/lcov-report/src/interaction/UserInteractionModeProvider.tsx.html +87 -87
  312. package/coverage/lcov-report/src/interaction/config.ts.html +7 -7
  313. package/coverage/lcov-report/src/interaction/index.html +1 -1
  314. package/coverage/lcov-report/src/interaction/useElementInteraction.tsx.html +123 -123
  315. package/coverage/lcov-report/src/interaction/useHigherContrastChildren.tsx.html +19 -19
  316. package/coverage/lcov-report/src/interaction/utils.ts.html +1 -1
  317. package/coverage/lcov-report/src/layout/LayoutAppBar.tsx.html +1 -1
  318. package/coverage/lcov-report/src/layout/LayoutNav.tsx.html +60 -60
  319. package/coverage/lcov-report/src/layout/LayoutWindowSplitter.tsx.html +1 -1
  320. package/coverage/lcov-report/src/layout/Main.tsx.html +1 -1
  321. package/coverage/lcov-report/src/layout/index.html +15 -15
  322. package/coverage/lcov-report/src/layout/layoutNavStyles.ts.html +5 -5
  323. package/coverage/lcov-report/src/layout/layoutWindowSplitterStyles.ts.html +1 -1
  324. package/coverage/lcov-report/src/layout/mainStyles.ts.html +1 -1
  325. package/coverage/lcov-report/src/layout/useExpandableLayout.ts.html +1 -1
  326. package/coverage/lcov-report/src/layout/useHorizontalLayoutTransition.ts.html +1 -1
  327. package/coverage/lcov-report/src/layout/useLayoutAppBarHeight.ts.html +20 -32
  328. package/coverage/lcov-report/src/layout/useLayoutTree.ts.html +1 -1
  329. package/coverage/lcov-report/src/layout/useLayoutWindowSplitter.ts.html +1 -1
  330. package/coverage/lcov-report/src/layout/useMainTabIndex.ts.html +1 -1
  331. package/coverage/lcov-report/src/layout/useResizableLayout.ts.html +1 -1
  332. package/coverage/lcov-report/src/layout/useTemporaryLayout.ts.html +1 -1
  333. package/coverage/lcov-report/src/link/Link.tsx.html +1 -1
  334. package/coverage/lcov-report/src/link/SkipToMainContent.tsx.html +1 -1
  335. package/coverage/lcov-report/src/link/index.html +1 -1
  336. package/coverage/lcov-report/src/link/styles.ts.html +1 -1
  337. package/coverage/lcov-report/src/list/List.tsx.html +1 -1
  338. package/coverage/lcov-report/src/list/ListItem.tsx.html +158 -137
  339. package/coverage/lcov-report/src/list/ListItemAddon.tsx.html +45 -39
  340. package/coverage/lcov-report/src/list/ListItemChildren.tsx.html +88 -82
  341. package/coverage/lcov-report/src/list/ListItemLink.tsx.html +5 -5
  342. package/coverage/lcov-report/src/list/ListItemText.tsx.html +35 -35
  343. package/coverage/lcov-report/src/list/ListSubheader.tsx.html +1 -1
  344. package/coverage/lcov-report/src/list/getListItemHeight.ts.html +44 -47
  345. package/coverage/lcov-report/src/list/index.html +13 -13
  346. package/coverage/lcov-report/src/list/listItemStyles.ts.html +102 -72
  347. package/coverage/lcov-report/src/media-queries/AppSizeProvider.tsx.html +54 -54
  348. package/coverage/lcov-report/src/media-queries/appSize.ts.html +1 -1
  349. package/coverage/lcov-report/src/media-queries/index.html +1 -1
  350. package/coverage/lcov-report/src/media-queries/useMediaQuery.ts.html +28 -28
  351. package/coverage/lcov-report/src/menu/DropdownMenu.tsx.html +1 -1
  352. package/coverage/lcov-report/src/menu/Menu.tsx.html +4 -4
  353. package/coverage/lcov-report/src/menu/MenuBar.tsx.html +1 -1
  354. package/coverage/lcov-report/src/menu/MenuButton.tsx.html +1 -1
  355. package/coverage/lcov-report/src/menu/MenuConfigurationProvider.tsx.html +1 -1
  356. package/coverage/lcov-report/src/menu/MenuItem.tsx.html +1 -1
  357. package/coverage/lcov-report/src/menu/MenuItemButton.tsx.html +1 -1
  358. package/coverage/lcov-report/src/menu/MenuItemCircularProgress.tsx.html +433 -0
  359. package/coverage/lcov-report/src/menu/MenuItemGroup.tsx.html +1 -1
  360. package/coverage/lcov-report/src/menu/MenuItemSeparator.tsx.html +1 -1
  361. package/coverage/lcov-report/src/menu/MenuSheet.tsx.html +1 -1
  362. package/coverage/lcov-report/src/menu/MenuVisibilityProvider.tsx.html +1 -1
  363. package/coverage/lcov-report/src/menu/MenuWidget.tsx.html +1 -1
  364. package/coverage/lcov-report/src/menu/MenuWidgetKeyboardProvider.tsx.html +1 -1
  365. package/coverage/lcov-report/src/menu/index.html +13 -238
  366. package/coverage/lcov-report/src/menu/useContextMenu.ts.html +1 -1
  367. package/coverage/lcov-report/src/menu/useMenuBarProvider.ts.html +1 -1
  368. package/coverage/lcov-report/src/menu/utils.ts.html +1 -1
  369. package/coverage/lcov-report/src/movement/constants.ts.html +1 -1
  370. package/coverage/lcov-report/src/movement/findMatchIndex.ts.html +1 -1
  371. package/coverage/lcov-report/src/movement/index.html +17 -62
  372. package/coverage/lcov-report/src/movement/useKeyboardMovementProvider.ts.html +3 -3
  373. package/coverage/lcov-report/src/movement/utils.ts.html +143 -119
  374. package/coverage/lcov-report/src/overlay/Overlay.tsx.html +1 -1
  375. package/coverage/lcov-report/src/overlay/index.html +1 -1
  376. package/coverage/lcov-report/src/overlay/overlayStyles.ts.html +1 -1
  377. package/coverage/lcov-report/src/portal/Portal.tsx.html +7 -7
  378. package/coverage/lcov-report/src/portal/PortalContainerProvider.tsx.html +59 -35
  379. package/coverage/lcov-report/src/portal/index.html +7 -7
  380. package/coverage/lcov-report/src/positioning/constants.ts.html +1 -1
  381. package/coverage/lcov-report/src/positioning/createHorizontalPosition.ts.html +47 -47
  382. package/coverage/lcov-report/src/positioning/createVerticalPosition.ts.html +55 -55
  383. package/coverage/lcov-report/src/positioning/getFixedPosition.ts.html +89 -89
  384. package/coverage/lcov-report/src/positioning/index.html +1 -1
  385. package/coverage/lcov-report/src/positioning/useFixedPositioning.ts.html +193 -193
  386. package/coverage/lcov-report/src/positioning/utils.ts.html +59 -59
  387. package/coverage/lcov-report/src/progress/CircularProgress.tsx.html +83 -83
  388. package/coverage/lcov-report/src/progress/LinearProgress.tsx.html +3 -3
  389. package/coverage/lcov-report/src/progress/getProgressA11y.ts.html +1 -1
  390. package/coverage/lcov-report/src/progress/index.html +20 -5
  391. package/coverage/lcov-report/src/responsive-item/ResponsiveItemContainer.tsx.html +1 -1
  392. package/coverage/lcov-report/src/responsive-item/ResponsiveItemOverlay.tsx.html +1 -1
  393. package/coverage/lcov-report/src/responsive-item/index.html +1 -1
  394. package/coverage/lcov-report/src/responsive-item/styles.ts.html +1 -1
  395. package/coverage/lcov-report/src/scroll/ScrollLock.tsx.html +1 -1
  396. package/coverage/lcov-report/src/scroll/getScrollbarWidth.ts.html +1 -1
  397. package/coverage/lcov-report/src/scroll/index.html +1 -1
  398. package/coverage/lcov-report/src/scroll/useScrollLock.ts.html +1 -1
  399. package/coverage/lcov-report/src/segmented-button/SegmentedButton.tsx.html +1 -1
  400. package/coverage/lcov-report/src/segmented-button/SegmentedButtonContainer.tsx.html +1 -1
  401. package/coverage/lcov-report/src/segmented-button/index.html +1 -1
  402. package/coverage/lcov-report/src/segmented-button/segmentedButtonContainerStyles.ts.html +1 -1
  403. package/coverage/lcov-report/src/segmented-button/segmentedButtonStyles.ts.html +1 -1
  404. package/coverage/lcov-report/src/sheet/Sheet.tsx.html +1 -1
  405. package/coverage/lcov-report/src/sheet/index.html +5 -5
  406. package/coverage/lcov-report/src/sheet/styles.ts.html +45 -48
  407. package/coverage/lcov-report/src/snackbar/DefaultToastRenderer.tsx.html +80 -80
  408. package/coverage/lcov-report/src/snackbar/Snackbar.tsx.html +21 -45
  409. package/coverage/lcov-report/src/snackbar/Toast.tsx.html +108 -93
  410. package/coverage/lcov-report/src/snackbar/ToastActionButton.tsx.html +1 -1
  411. package/coverage/lcov-report/src/snackbar/ToastCloseButton.tsx.html +1 -1
  412. package/coverage/lcov-report/src/snackbar/ToastContent.tsx.html +48 -48
  413. package/coverage/lcov-report/src/snackbar/ToastManager.tsx.html +278 -275
  414. package/coverage/lcov-report/src/snackbar/ToastManagerProvider.tsx.html +6 -6
  415. package/coverage/lcov-report/src/snackbar/index.html +19 -19
  416. package/coverage/lcov-report/src/snackbar/snackbarStyles.ts.html +15 -15
  417. package/coverage/lcov-report/src/snackbar/toastContentStyles.ts.html +14 -14
  418. package/coverage/lcov-report/src/snackbar/toastStyles.ts.html +27 -27
  419. package/coverage/lcov-report/src/snackbar/useCurrentToastActions.ts.html +1 -1
  420. package/coverage/lcov-report/src/suspense/CircularProgressSuspense.tsx.html +142 -142
  421. package/coverage/lcov-report/src/suspense/NullSuspense.tsx.html +88 -88
  422. package/coverage/lcov-report/src/suspense/index.html +36 -21
  423. package/coverage/lcov-report/src/table/Table.tsx.html +45 -114
  424. package/coverage/lcov-report/src/table/TableBody.tsx.html +43 -43
  425. package/coverage/lcov-report/src/table/TableCell.tsx.html +109 -298
  426. package/coverage/lcov-report/src/table/TableCellContent.tsx.html +81 -27
  427. package/coverage/lcov-report/src/table/TableCheckbox.tsx.html +16 -10
  428. package/coverage/lcov-report/src/table/TableConfigurationProvider.tsx.html +20 -20
  429. package/coverage/lcov-report/src/table/TableContainer.tsx.html +7 -28
  430. package/coverage/lcov-report/src/table/TableContainerProvider.tsx.html +1 -1
  431. package/coverage/lcov-report/src/table/TableFooter.tsx.html +64 -43
  432. package/coverage/lcov-report/src/table/TableHeader.tsx.html +41 -92
  433. package/coverage/lcov-report/src/table/TableRadio.tsx.html +676 -0
  434. package/coverage/lcov-report/src/table/TableRow.tsx.html +38 -119
  435. package/coverage/lcov-report/src/table/index.html +151 -46
  436. package/coverage/lcov-report/src/table/tableCellStyles.ts.html +334 -0
  437. package/coverage/lcov-report/src/table/tableContainerStyles.ts.html +142 -0
  438. package/coverage/lcov-report/src/table/tableFooterStyles.ts.html +166 -0
  439. package/coverage/lcov-report/src/table/tableHeaderStyles.ts.html +172 -0
  440. package/coverage/lcov-report/src/table/tableRowStyles.ts.html +169 -0
  441. package/coverage/lcov-report/src/table/tableStyles.ts.html +157 -0
  442. package/coverage/lcov-report/src/tabs/Tab.tsx.html +263 -143
  443. package/coverage/lcov-report/src/tabs/TabList.tsx.html +1 -1
  444. package/coverage/lcov-report/src/tabs/TabListScrollButton.tsx.html +1 -1
  445. package/coverage/lcov-report/src/tabs/index.html +25 -25
  446. package/coverage/lcov-report/src/tabs/tabIndicatorStyles.ts.html +37 -7
  447. package/coverage/lcov-report/src/tabs/tabListScrollButtonStyles.ts.html +1 -1
  448. package/coverage/lcov-report/src/tabs/tabListStyles.ts.html +2 -2
  449. package/coverage/lcov-report/src/tabs/tabStyles.ts.html +64 -28
  450. package/coverage/lcov-report/src/tabs/useTabList.ts.html +44 -38
  451. package/coverage/lcov-report/src/tabs/useTabs.ts.html +1 -1
  452. package/coverage/lcov-report/src/tabs/utils.ts.html +3 -3
  453. package/coverage/lcov-report/src/test-utils/IntersectionObserver.ts.html +1 -1
  454. package/coverage/lcov-report/src/test-utils/ResizeObserver.ts.html +402 -261
  455. package/coverage/lcov-report/src/test-utils/data-testid.ts.html +18 -6
  456. package/coverage/lcov-report/src/test-utils/drag.ts.html +1 -1
  457. package/coverage/lcov-report/src/test-utils/index.html +12 -117
  458. package/coverage/lcov-report/src/test-utils/jest-setup.ts.html +9 -9
  459. package/coverage/lcov-report/src/test-utils/matchMedia.ts.html +55 -55
  460. package/coverage/lcov-report/src/test-utils/polyfills/IntersectionObserver.ts.html +4 -4
  461. package/coverage/lcov-report/src/test-utils/polyfills/ResizeObserver.ts.html +3 -3
  462. package/coverage/lcov-report/src/test-utils/polyfills/TextDecoder.ts.html +106 -0
  463. package/coverage/lcov-report/src/test-utils/polyfills/TextEncoder.ts.html +100 -0
  464. package/coverage/lcov-report/src/test-utils/polyfills/index.html +1 -1
  465. package/coverage/lcov-report/src/test-utils/polyfills/matchMedia.ts.html +6 -6
  466. package/coverage/lcov-report/src/test-utils/polyfills/offsetParent.ts.html +14 -14
  467. package/coverage/lcov-report/src/test-utils/polyfills/scrollIntoView.ts.html +5 -5
  468. package/coverage/lcov-report/src/test-utils/render.tsx.html +21 -21
  469. package/coverage/lcov-report/src/test-utils/root-html-environment.ts.html +85 -0
  470. package/coverage/lcov-report/src/test-utils/timers.ts.html +1 -1
  471. package/coverage/lcov-report/src/theme/LocalStorageColorSchemeProvider.tsx.html +1 -1
  472. package/coverage/lcov-report/src/theme/ThemeProvider.tsx.html +1 -1
  473. package/coverage/lcov-report/src/theme/colors.ts.html +1 -1
  474. package/coverage/lcov-report/src/theme/cssVars.ts.html +1 -1
  475. package/coverage/lcov-report/src/theme/index.html +1 -1
  476. package/coverage/lcov-report/src/theme/useCSSVariables.ts.html +25 -25
  477. package/coverage/lcov-report/src/theme/useColorScheme.ts.html +1 -1
  478. package/coverage/lcov-report/src/theme/useColorSchemeMetaTag.ts.html +1 -1
  479. package/coverage/lcov-report/src/theme/useColorSchemeProvider.ts.html +1 -1
  480. package/coverage/lcov-report/src/theme/usePrefersColorScheme.ts.html +1 -1
  481. package/coverage/lcov-report/src/theme/utils.ts.html +1 -1
  482. package/coverage/lcov-report/src/tooltip/Tooltip.tsx.html +62 -62
  483. package/coverage/lcov-report/src/tooltip/TooltipHoverModeProvider.tsx.html +3 -3
  484. package/coverage/lcov-report/src/tooltip/constants.ts.html +1 -1
  485. package/coverage/lcov-report/src/tooltip/index.html +9 -9
  486. package/coverage/lcov-report/src/tooltip/tooltipStyles.ts.html +12 -12
  487. package/coverage/lcov-report/src/tooltip/useTooltip.ts.html +243 -222
  488. package/coverage/lcov-report/src/tooltip/useTooltipPosition.ts.html +27 -27
  489. package/coverage/lcov-report/src/tooltip/utils.ts.html +22 -22
  490. package/coverage/lcov-report/src/transition/CSSTransition.tsx.html +1 -1
  491. package/coverage/lcov-report/src/transition/Collapse.tsx.html +1 -1
  492. package/coverage/lcov-report/src/transition/CrossFade.tsx.html +1 -1
  493. package/coverage/lcov-report/src/transition/ScaleTransition.tsx.html +1 -1
  494. package/coverage/lcov-report/src/transition/SkeletonPlaceholder.tsx.html +374 -338
  495. package/coverage/lcov-report/src/transition/Slide.tsx.html +1 -1
  496. package/coverage/lcov-report/src/transition/SlideContainer.tsx.html +1 -1
  497. package/coverage/lcov-report/src/transition/collapseStyles.ts.html +1 -1
  498. package/coverage/lcov-report/src/transition/config.ts.html +5 -5
  499. package/coverage/lcov-report/src/transition/index.html +49 -34
  500. package/coverage/lcov-report/src/transition/maxWidthTransition.ts.html +1 -1
  501. package/coverage/lcov-report/src/transition/skeletonPlaceholderUtils.ts.html +400 -0
  502. package/coverage/lcov-report/src/transition/useCSSTransition.ts.html +68 -68
  503. package/coverage/lcov-report/src/transition/useCarousel.ts.html +1 -1
  504. package/coverage/lcov-report/src/transition/useCollapseTransition.ts.html +10 -64
  505. package/coverage/lcov-report/src/transition/useCrossFadeTransition.ts.html +1 -1
  506. package/coverage/lcov-report/src/transition/useMaxWidthTransition.ts.html +1 -1
  507. package/coverage/lcov-report/src/transition/useScaleTransition.ts.html +18 -18
  508. package/coverage/lcov-report/src/transition/useSkeletonPlaceholder.ts.html +607 -562
  509. package/coverage/lcov-report/src/transition/useSlideTransition.ts.html +1 -1
  510. package/coverage/lcov-report/src/transition/useTransition.ts.html +232 -232
  511. package/coverage/lcov-report/src/transition/utils.ts.html +45 -45
  512. package/coverage/lcov-report/src/tree/DefaultTreeItemRenderer.tsx.html +18 -6
  513. package/coverage/lcov-report/src/tree/Tree.tsx.html +20 -8
  514. package/coverage/lcov-report/src/tree/TreeGroup.tsx.html +1 -1
  515. package/coverage/lcov-report/src/tree/TreeItem.tsx.html +7 -10
  516. package/coverage/lcov-report/src/tree/TreeItemExpander.tsx.html +1 -1
  517. package/coverage/lcov-report/src/tree/TreeProvider.tsx.html +1 -1
  518. package/coverage/lcov-report/src/tree/index.html +16 -196
  519. package/coverage/lcov-report/src/tree/styles.ts.html +4 -31
  520. package/coverage/lcov-report/src/tree/useTree.ts.html +1 -1
  521. package/coverage/lcov-report/src/tree/useTreeExpansion.ts.html +1 -1
  522. package/coverage/lcov-report/src/tree/useTreeItems.ts.html +1 -1
  523. package/coverage/lcov-report/src/tree/useTreeMovement.ts.html +87 -87
  524. package/coverage/lcov-report/src/tree/useTreeSelection.ts.html +1 -1
  525. package/coverage/lcov-report/src/tree/utils.ts.html +1 -1
  526. package/coverage/lcov-report/src/typography/SrOnly.tsx.html +12 -12
  527. package/coverage/lcov-report/src/typography/TextContainer.tsx.html +1 -1
  528. package/coverage/lcov-report/src/typography/Typography.tsx.html +94 -94
  529. package/coverage/lcov-report/src/typography/WritingDirectionProvider.tsx.html +1 -1
  530. package/coverage/lcov-report/src/typography/index.html +1 -1
  531. package/coverage/lcov-report/src/useAsyncAction.ts.html +1 -1
  532. package/coverage/lcov-report/src/useDebouncedFunction.ts.html +246 -240
  533. package/coverage/lcov-report/src/useDropzone.ts.html +1 -1
  534. package/coverage/lcov-report/src/useElementSize.ts.html +334 -0
  535. package/coverage/lcov-report/src/useEnsuredId.ts.html +8 -8
  536. package/coverage/lcov-report/src/useEnsuredRef.ts.html +14 -14
  537. package/coverage/lcov-report/src/useEnsuredState.ts.html +16 -16
  538. package/coverage/lcov-report/src/useHtmlClassName.ts.html +1 -1
  539. package/coverage/lcov-report/src/useIntersectionObserver.ts.html +1 -1
  540. package/coverage/lcov-report/src/useIsomorphicLayoutEffect.ts.html +1 -1
  541. package/coverage/lcov-report/src/useLocalStorage.ts.html +1 -1
  542. package/coverage/lcov-report/src/useOrientation.ts.html +30 -30
  543. package/coverage/lcov-report/src/usePageInactive.ts.html +30 -30
  544. package/coverage/lcov-report/src/useResizeListener.ts.html +38 -32
  545. package/coverage/lcov-report/src/useResizeObserver.ts.html +133 -244
  546. package/coverage/lcov-report/src/useThrottledFunction.ts.html +57 -51
  547. package/coverage/lcov-report/src/useToggle.ts.html +1 -1
  548. package/coverage/lcov-report/src/useUnmounted.ts.html +1 -1
  549. package/coverage/lcov-report/src/useWindowSize.ts.html +124 -94
  550. package/coverage/lcov-report/src/utils/RenderRecursively.tsx.html +1 -1
  551. package/coverage/lcov-report/src/utils/alphaNumericSort.ts.html +1 -1
  552. package/coverage/lcov-report/src/utils/applyRef.ts.html +11 -11
  553. package/coverage/lcov-report/src/utils/bem.ts.html +50 -50
  554. package/coverage/lcov-report/src/utils/filters.ts.html +357 -84
  555. package/coverage/lcov-report/src/utils/getClientPosition.ts.html +1 -1
  556. package/coverage/lcov-report/src/utils/getMiddleOfRange.ts.html +163 -0
  557. package/coverage/lcov-report/src/utils/getPercentage.ts.html +9 -9
  558. package/coverage/lcov-report/src/utils/getRangeDefaultValue.ts.html +66 -87
  559. package/coverage/lcov-report/src/utils/getRangeSteps.ts.html +7 -7
  560. package/coverage/lcov-report/src/utils/identity.ts.html +1 -1
  561. package/coverage/lcov-report/src/utils/index.html +13 -253
  562. package/coverage/lcov-report/src/utils/isElementVisible.ts.html +1 -1
  563. package/coverage/lcov-report/src/utils/isValidNumber.ts.html +118 -0
  564. package/coverage/lcov-report/src/utils/loop.ts.html +1 -1
  565. package/coverage/lcov-report/src/utils/nearest.ts.html +21 -21
  566. package/coverage/lcov-report/src/utils/parseCssLengthUnit.ts.html +18 -18
  567. package/coverage/lcov-report/src/utils/randomInt.ts.html +52 -52
  568. package/coverage/lcov-report/src/utils/wait.ts.html +1 -1
  569. package/coverage/lcov-report/src/utils/withinRange.ts.html +1 -1
  570. package/coverage/lcov-report/src/window-splitter/WindowSplitter.tsx.html +1 -1
  571. package/coverage/lcov-report/src/window-splitter/index.html +14 -14
  572. package/coverage/lcov-report/src/window-splitter/useWindowSplitter.ts.html +19 -67
  573. package/coverage/lcov-report/src/window-splitter/useWindowSplitterMaxValue.ts.html +256 -0
  574. package/coverage/lcov-report/suspense/CircularProgressSuspense.tsx.html +283 -0
  575. package/coverage/lcov-report/suspense/NullSuspense.tsx.html +202 -0
  576. package/coverage/lcov-report/suspense/index.html +131 -0
  577. package/coverage/lcov-report/tabIndicatorStyles.ts.html +43 -13
  578. package/coverage/lcov-report/tabListStyles.ts.html +35 -26
  579. package/coverage/lcov-report/tabStyles.ts.html +68 -26
  580. package/coverage/lcov-report/tabs/Tab.tsx.html +233 -143
  581. package/coverage/lcov-report/tabs/TabList.tsx.html +85 -85
  582. package/coverage/lcov-report/tabs/index.html +56 -11
  583. package/coverage/lcov-report/tabs/tabIndicatorStyles.ts.html +187 -0
  584. package/coverage/lcov-report/tabs/tabListStyles.ts.html +241 -0
  585. package/coverage/lcov-report/tabs/tabStyles.ts.html +253 -0
  586. package/coverage/lcov-report/tabs/useTabList.ts.html +736 -0
  587. package/coverage/lcov-report/tabs/useTabs.ts.html +1 -1
  588. package/coverage/lcov-report/tabs/utils.ts.html +1 -1
  589. package/coverage/lcov-report/test-utils/index.html +21 -21
  590. package/coverage/lcov-report/test-utils/use.ts.html +187 -0
  591. package/coverage/lcov-report/tooltip/Tooltip.tsx.html +62 -62
  592. package/coverage/lcov-report/tooltip/index.html +10 -70
  593. package/coverage/lcov-report/tooltip/useTooltip.ts.html +243 -222
  594. package/coverage/lcov-report/transition/SkeletonPlaceholder.tsx.html +595 -0
  595. package/coverage/lcov-report/transition/config.ts.html +5 -5
  596. package/coverage/lcov-report/transition/index.html +1 -1
  597. package/coverage/lcov-report/transition/skeletonPlaceholderUtils.ts.html +400 -0
  598. package/coverage/lcov-report/transition/useScaleTransition.ts.html +535 -0
  599. package/coverage/lcov-report/transition/useSkeletonPlaceholder.ts.html +952 -0
  600. package/coverage/lcov-report/tree/TreeItem.tsx.html +7 -10
  601. package/coverage/lcov-report/tree/index.html +17 -47
  602. package/coverage/lcov-report/tree/styles.ts.html +538 -0
  603. package/coverage/lcov-report/tree/useTreeMovement.ts.html +140 -143
  604. package/coverage/lcov-report/typography/Typography.tsx.html +138 -432
  605. package/coverage/lcov-report/typography/WritingDirectionProvider.tsx.html +75 -75
  606. package/coverage/lcov-report/typography/index.html +18 -18
  607. package/coverage/lcov-report/useAutoComplete.ts.html +787 -0
  608. package/coverage/lcov-report/useCollapseTransition.ts.html +166 -211
  609. package/coverage/lcov-report/useCombobox.ts.html +1513 -0
  610. package/coverage/lcov-report/useInlineAutoComplete.ts.html +379 -0
  611. package/coverage/lcov-report/useSelectCombobox.ts.html +295 -0
  612. package/coverage/lcov-report/useSkeletonPlaceholder.ts.html +952 -0
  613. package/coverage/lcov-report/useTabList.ts.html +142 -136
  614. package/coverage/lcov-report/useWindowSplitter.ts.html +640 -0
  615. package/coverage/lcov-report/useWindowSplitterMaxValue.ts.html +256 -0
  616. package/coverage/lcov-report/utils/alphaNumericSort.ts.html +11 -50
  617. package/coverage/lcov-report/utils/filters.ts.html +1056 -201
  618. package/coverage/lcov-report/utils/index.html +15 -30
  619. package/coverage/lcov-report/utils/isElementVisible.ts.html +14 -14
  620. package/coverage/lcov-report/utils/randomInt.ts.html +148 -0
  621. package/coverage/lcov-report/utils/searching.ts.html +85 -0
  622. package/coverage/lcov-report/utils/wait.ts.html +1 -1
  623. package/coverage/lcov-report/utils.ts.html +109 -277
  624. package/coverage/lcov-report/window-splitter/index.html +21 -36
  625. package/coverage/lcov-report/window-splitter/useWindowSplitter.ts.html +406 -328
  626. package/dist/RootHtml.d.ts +62 -0
  627. package/dist/RootHtml.js +49 -0
  628. package/dist/RootHtml.js.map +1 -0
  629. package/dist/_box-shadows.scss +12 -2
  630. package/dist/_core.scss +207 -253
  631. package/dist/_utils.scss +89 -0
  632. package/dist/app-bar/AppBar.d.ts +4 -9
  633. package/dist/app-bar/AppBar.js +29 -7
  634. package/dist/app-bar/AppBar.js.map +1 -1
  635. package/dist/app-bar/_app-bar.scss +114 -122
  636. package/dist/avatar/Avatar.d.ts +15 -1
  637. package/dist/avatar/Avatar.js +5 -2
  638. package/dist/avatar/Avatar.js.map +1 -1
  639. package/dist/avatar/_avatar.scss +74 -81
  640. package/dist/badge/_badge.scss +97 -59
  641. package/dist/box/_box.scss +72 -81
  642. package/dist/button/TooltippedButton.d.ts +62 -0
  643. package/dist/button/TooltippedButton.js +62 -0
  644. package/dist/button/TooltippedButton.js.map +1 -0
  645. package/dist/button/_button.scss +170 -180
  646. package/dist/card/Card.js +3 -2
  647. package/dist/card/Card.js.map +1 -1
  648. package/dist/card/CardContent.js +1 -1
  649. package/dist/card/CardContent.js.map +1 -1
  650. package/dist/card/ClickableCard.d.ts +42 -0
  651. package/dist/card/ClickableCard.js +73 -0
  652. package/dist/card/ClickableCard.js.map +1 -0
  653. package/dist/card/_card.scss +81 -82
  654. package/dist/card/styles.d.ts +8 -0
  655. package/dist/card/styles.js +6 -3
  656. package/dist/card/styles.js.map +1 -1
  657. package/dist/chip/_chip.scss +137 -148
  658. package/dist/dialog/FixedDialog.d.ts +5 -4
  659. package/dist/dialog/FixedDialog.js +5 -4
  660. package/dist/dialog/FixedDialog.js.map +1 -1
  661. package/dist/dialog/_dialog.scss +179 -162
  662. package/dist/divider/Divider.d.ts +0 -1
  663. package/dist/divider/Divider.js.map +1 -1
  664. package/dist/divider/_divider.scss +61 -70
  665. package/dist/draggable/_draggable.scss +16 -12
  666. package/dist/draggable/useDraggable.d.ts +12 -23
  667. package/dist/draggable/useDraggable.js +15 -6
  668. package/dist/draggable/useDraggable.js.map +1 -1
  669. package/dist/draggable/utils.d.ts +4 -17
  670. package/dist/draggable/utils.js +9 -25
  671. package/dist/draggable/utils.js.map +1 -1
  672. package/dist/expansion-panel/_expansion-panel.scss +76 -50
  673. package/dist/expansion-panel/useExpansionPanels.d.ts +5 -3
  674. package/dist/expansion-panel/useExpansionPanels.js +16 -9
  675. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  676. package/dist/form/Form.d.ts +1 -1
  677. package/dist/form/Form.js +2 -1
  678. package/dist/form/Form.js.map +1 -1
  679. package/dist/form/Label.d.ts +5 -5
  680. package/dist/form/Label.js.map +1 -1
  681. package/dist/form/MenuItemInputToggle.d.ts +2 -15
  682. package/dist/form/MenuItemInputToggle.js +26 -37
  683. package/dist/form/MenuItemInputToggle.js.map +1 -1
  684. package/dist/form/NativeSelect.d.ts +5 -2
  685. package/dist/form/NativeSelect.js.map +1 -1
  686. package/dist/form/Option.js +3 -2
  687. package/dist/form/Option.js.map +1 -1
  688. package/dist/form/ResizingTextAreaWrapper.d.ts +19 -0
  689. package/dist/form/ResizingTextAreaWrapper.js +35 -0
  690. package/dist/form/ResizingTextAreaWrapper.js.map +1 -0
  691. package/dist/form/Select.d.ts +105 -15
  692. package/dist/form/Select.js +160 -244
  693. package/dist/form/Select.js.map +1 -1
  694. package/dist/form/SelectedOption.d.ts +21 -0
  695. package/dist/form/SelectedOption.js +37 -0
  696. package/dist/form/SelectedOption.js.map +1 -0
  697. package/dist/form/TextArea.d.ts +11 -0
  698. package/dist/form/TextArea.js +19 -29
  699. package/dist/form/TextArea.js.map +1 -1
  700. package/dist/form/TextField.d.ts +2 -2
  701. package/dist/form/TextField.js +7 -6
  702. package/dist/form/TextField.js.map +1 -1
  703. package/dist/form/TextFieldContainerStyles.d.ts +7 -7
  704. package/dist/form/TextFieldContainerStyles.js.map +1 -1
  705. package/dist/form/_form.scss +1336 -1260
  706. package/dist/form/menuItemInputToggleStyles.d.ts +39 -0
  707. package/dist/form/menuItemInputToggleStyles.js +31 -0
  708. package/dist/form/menuItemInputToggleStyles.js.map +1 -0
  709. package/dist/form/selectUtils.d.ts +1 -3
  710. package/dist/form/selectUtils.js +2 -10
  711. package/dist/form/selectUtils.js.map +1 -1
  712. package/dist/form/textAreaStyles.d.ts +2 -2
  713. package/dist/form/textAreaStyles.js.map +1 -1
  714. package/dist/form/types.d.ts +6 -8
  715. package/dist/form/types.js.map +1 -1
  716. package/dist/form/useCombobox.d.ts +157 -0
  717. package/dist/form/useCombobox.js +206 -0
  718. package/dist/form/useCombobox.js.map +1 -0
  719. package/dist/form/useEditableCombobox.d.ts +15 -0
  720. package/dist/form/useEditableCombobox.js +101 -0
  721. package/dist/form/useEditableCombobox.js.map +1 -0
  722. package/dist/form/useFormReset.d.ts +16 -0
  723. package/dist/form/useFormReset.js +32 -0
  724. package/dist/form/useFormReset.js.map +1 -0
  725. package/dist/form/useListboxProvider.d.ts +4 -2
  726. package/dist/form/useListboxProvider.js +6 -8
  727. package/dist/form/useListboxProvider.js.map +1 -1
  728. package/dist/form/useResizingTextArea.d.ts +5 -2
  729. package/dist/form/useResizingTextArea.js +52 -21
  730. package/dist/form/useResizingTextArea.js.map +1 -1
  731. package/dist/form/useSelectCombobox.d.ts +17 -0
  732. package/dist/form/useSelectCombobox.js +36 -0
  733. package/dist/form/useSelectCombobox.js.map +1 -0
  734. package/dist/form/utils.d.ts +11 -1
  735. package/dist/form/utils.js +6 -0
  736. package/dist/form/utils.js.map +1 -1
  737. package/dist/icon/IconRotator.js +2 -3
  738. package/dist/icon/IconRotator.js.map +1 -1
  739. package/dist/icon/_icon.scss +105 -112
  740. package/dist/index.d.ts +22 -1
  741. package/dist/index.js +22 -1
  742. package/dist/index.js.map +1 -1
  743. package/dist/interaction/_interaction.scss +144 -135
  744. package/dist/layout/_layout.scss +82 -86
  745. package/dist/layout/useLayoutAppBarHeight.js +5 -9
  746. package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
  747. package/dist/link/_link.scss +74 -66
  748. package/dist/list/ListItem.d.ts +8 -3
  749. package/dist/list/ListItem.js +4 -3
  750. package/dist/list/ListItem.js.map +1 -1
  751. package/dist/list/ListItemAddon.js +2 -1
  752. package/dist/list/ListItemAddon.js.map +1 -1
  753. package/dist/list/ListItemChildren.js +3 -2
  754. package/dist/list/ListItemChildren.js.map +1 -1
  755. package/dist/list/ListItemLink.js +3 -3
  756. package/dist/list/ListItemLink.js.map +1 -1
  757. package/dist/list/_list.scss +187 -184
  758. package/dist/list/getListItemHeight.d.ts +0 -1
  759. package/dist/list/getListItemHeight.js +2 -2
  760. package/dist/list/getListItemHeight.js.map +1 -1
  761. package/dist/list/listItemStyles.d.ts +9 -1
  762. package/dist/list/listItemStyles.js +5 -5
  763. package/dist/list/listItemStyles.js.map +1 -1
  764. package/dist/list/types.d.ts +25 -6
  765. package/dist/list/types.js.map +1 -1
  766. package/dist/menu/Menu.d.ts +1 -1
  767. package/dist/menu/Menu.js +12 -1
  768. package/dist/menu/Menu.js.map +1 -1
  769. package/dist/menu/MenuItemCircularProgress.d.ts +60 -0
  770. package/dist/menu/MenuItemCircularProgress.js +74 -0
  771. package/dist/menu/MenuItemCircularProgress.js.map +1 -0
  772. package/dist/menu/_menu.scss +29 -50
  773. package/dist/menu/useContextMenu.d.ts +3 -3
  774. package/dist/menu/useContextMenu.js +3 -3
  775. package/dist/menu/useContextMenu.js.map +1 -1
  776. package/dist/movement/types.d.ts +40 -21
  777. package/dist/movement/types.js.map +1 -1
  778. package/dist/movement/useKeyboardMovementProvider.js +15 -4
  779. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  780. package/dist/movement/utils.d.ts +7 -2
  781. package/dist/movement/utils.js +10 -0
  782. package/dist/movement/utils.js.map +1 -1
  783. package/dist/overlay/_overlay.scss +39 -42
  784. package/dist/portal/PortalContainerProvider.d.ts +2 -2
  785. package/dist/portal/PortalContainerProvider.js +6 -1
  786. package/dist/portal/PortalContainerProvider.js.map +1 -1
  787. package/dist/positioning/useFixedPositioning.js +0 -8
  788. package/dist/positioning/useFixedPositioning.js.map +1 -1
  789. package/dist/progress/_progress.scss +33 -33
  790. package/dist/responsive-item/_responsive-item.scss +91 -89
  791. package/dist/searching/caseInsensitive.d.ts +150 -0
  792. package/dist/searching/caseInsensitive.js +30 -0
  793. package/dist/searching/caseInsensitive.js.map +1 -0
  794. package/dist/searching/fuzzy.d.ts +128 -0
  795. package/dist/searching/fuzzy.js +54 -0
  796. package/dist/searching/fuzzy.js.map +1 -0
  797. package/dist/searching/toSearchQuery.d.ts +7 -0
  798. package/dist/searching/toSearchQuery.js +15 -0
  799. package/dist/searching/toSearchQuery.js.map +1 -0
  800. package/dist/searching/types.d.ts +28 -0
  801. package/dist/searching/types.js +5 -0
  802. package/dist/searching/types.js.map +1 -0
  803. package/dist/searching/useFuzzyMatch.d.ts +19 -0
  804. package/dist/searching/useFuzzyMatch.js +26 -0
  805. package/dist/searching/useFuzzyMatch.js.map +1 -0
  806. package/dist/searching/utils.d.ts +21 -0
  807. package/dist/searching/utils.js +28 -0
  808. package/dist/searching/utils.js.map +1 -0
  809. package/dist/segmented-button/_segmented-button.scss +86 -92
  810. package/dist/sheet/_sheet.scss +107 -123
  811. package/dist/sheet/styles.d.ts +14 -15
  812. package/dist/sheet/styles.js.map +1 -1
  813. package/dist/snackbar/DefaultToastRenderer.js +1 -1
  814. package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
  815. package/dist/snackbar/Snackbar.d.ts +10 -10
  816. package/dist/snackbar/Snackbar.js +3 -3
  817. package/dist/snackbar/Snackbar.js.map +1 -1
  818. package/dist/snackbar/Toast.d.ts +1 -1
  819. package/dist/snackbar/Toast.js +5 -1
  820. package/dist/snackbar/Toast.js.map +1 -1
  821. package/dist/snackbar/ToastManager.d.ts +2 -1
  822. package/dist/snackbar/ToastManager.js +1 -1
  823. package/dist/snackbar/ToastManager.js.map +1 -1
  824. package/dist/snackbar/_snackbar.scss +148 -144
  825. package/dist/snackbar/snackbarStyles.d.ts +1 -0
  826. package/dist/snackbar/snackbarStyles.js +2 -1
  827. package/dist/snackbar/snackbarStyles.js.map +1 -1
  828. package/dist/table/TableCheckbox.d.ts +3 -2
  829. package/dist/table/TableCheckbox.js +4 -2
  830. package/dist/table/TableCheckbox.js.map +1 -1
  831. package/dist/table/TableRadio.d.ts +3 -2
  832. package/dist/table/TableRadio.js +4 -2
  833. package/dist/table/TableRadio.js.map +1 -1
  834. package/dist/table/_table.scss +214 -227
  835. package/dist/table/tableCellStyles.d.ts +1 -1
  836. package/dist/table/tableCellStyles.js.map +1 -1
  837. package/dist/tabs/Tab.d.ts +24 -3
  838. package/dist/tabs/Tab.js +15 -8
  839. package/dist/tabs/Tab.js.map +1 -1
  840. package/dist/tabs/_tabs.scss +62 -53
  841. package/dist/tabs/tabIndicatorStyles.d.ts +2 -1
  842. package/dist/tabs/tabIndicatorStyles.js +6 -3
  843. package/dist/tabs/tabIndicatorStyles.js.map +1 -1
  844. package/dist/tabs/tabListStyles.js +2 -1
  845. package/dist/tabs/tabListStyles.js.map +1 -1
  846. package/dist/tabs/tabStyles.d.ts +2 -0
  847. package/dist/tabs/tabStyles.js +6 -3
  848. package/dist/tabs/tabStyles.js.map +1 -1
  849. package/dist/tabs/useTabList.d.ts +3 -3
  850. package/dist/tabs/useTabList.js +9 -6
  851. package/dist/tabs/useTabList.js.map +1 -1
  852. package/dist/test-utils/IntersectionObserver.d.ts +12 -0
  853. package/dist/test-utils/ResizeObserver.d.ts +214 -0
  854. package/dist/test-utils/ResizeObserver.js +69 -49
  855. package/dist/test-utils/ResizeObserver.js.map +1 -1
  856. package/dist/test-utils/data-testid.d.ts +7 -0
  857. package/dist/test-utils/data-testid.js +1 -0
  858. package/dist/test-utils/data-testid.js.map +1 -1
  859. package/dist/test-utils/drag.d.ts +26 -0
  860. package/dist/test-utils/index.d.ts +7 -0
  861. package/dist/test-utils/jest-setup.d.ts +1 -0
  862. package/dist/test-utils/matchMedia.d.ts +101 -0
  863. package/dist/test-utils/matchMedia.js +2 -2
  864. package/dist/test-utils/matchMedia.js.map +1 -1
  865. package/dist/test-utils/polyfills/IntersectionObserver.d.ts +1 -0
  866. package/dist/test-utils/polyfills/ResizeObserver.d.ts +1 -0
  867. package/dist/test-utils/polyfills/TextDecoder.d.ts +1 -0
  868. package/dist/test-utils/polyfills/TextDecoder.js +8 -0
  869. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -0
  870. package/dist/test-utils/polyfills/TextEncoder.d.ts +1 -0
  871. package/dist/test-utils/polyfills/TextEncoder.js +6 -0
  872. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -0
  873. package/dist/test-utils/polyfills/index.d.ts +7 -0
  874. package/dist/test-utils/polyfills/index.js +2 -0
  875. package/dist/test-utils/polyfills/index.js.map +1 -1
  876. package/dist/test-utils/polyfills/matchMedia.d.ts +1 -0
  877. package/dist/test-utils/polyfills/offsetParent.d.ts +1 -0
  878. package/dist/test-utils/polyfills/scrollIntoView.d.ts +1 -0
  879. package/dist/test-utils/render.d.ts +13 -0
  880. package/dist/test-utils/timers.d.ts +39 -0
  881. package/dist/theme/_theme.scss +243 -133
  882. package/dist/tooltip/_tooltip.scss +76 -83
  883. package/dist/tooltip/useTooltip.d.ts +14 -14
  884. package/dist/tooltip/useTooltip.js.map +1 -1
  885. package/dist/transition/SkeletonPlaceholder.d.ts +2 -2
  886. package/dist/transition/SkeletonPlaceholder.js +8 -3
  887. package/dist/transition/SkeletonPlaceholder.js.map +1 -1
  888. package/dist/transition/_transition.scss +89 -78
  889. package/dist/transition/skeletonPlaceholderUtils.d.ts +77 -0
  890. package/dist/transition/skeletonPlaceholderUtils.js +38 -0
  891. package/dist/transition/skeletonPlaceholderUtils.js.map +1 -0
  892. package/dist/transition/useCollapseTransition.d.ts +3 -18
  893. package/dist/transition/useCollapseTransition.js +1 -10
  894. package/dist/transition/useCollapseTransition.js.map +1 -1
  895. package/dist/transition/useSkeletonPlaceholder.d.ts +12 -7
  896. package/dist/transition/useSkeletonPlaceholder.js +38 -37
  897. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  898. package/dist/transition/utils.js +7 -2
  899. package/dist/transition/utils.js.map +1 -1
  900. package/dist/tree/DefaultTreeItemRenderer.d.ts +2 -2
  901. package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
  902. package/dist/tree/Tree.d.ts +8 -4
  903. package/dist/tree/Tree.js.map +1 -1
  904. package/dist/tree/TreeItem.js +3 -4
  905. package/dist/tree/TreeItem.js.map +1 -1
  906. package/dist/tree/_tree.scss +111 -109
  907. package/dist/tree/styles.d.ts +0 -6
  908. package/dist/tree/styles.js +1 -2
  909. package/dist/tree/styles.js.map +1 -1
  910. package/dist/tree/useTreeMovement.js +1 -1
  911. package/dist/tree/useTreeMovement.js.map +1 -1
  912. package/dist/types.d.ts +13 -0
  913. package/dist/types.js +1 -2
  914. package/dist/types.js.map +1 -1
  915. package/dist/typography/SrOnly.d.ts +3 -3
  916. package/dist/typography/SrOnly.js +4 -4
  917. package/dist/typography/SrOnly.js.map +1 -1
  918. package/dist/typography/Typography.d.ts +19 -19
  919. package/dist/typography/Typography.js +19 -19
  920. package/dist/typography/Typography.js.map +1 -1
  921. package/dist/typography/WritingDirectionProvider.d.ts +2 -2
  922. package/dist/typography/WritingDirectionProvider.js +2 -2
  923. package/dist/typography/WritingDirectionProvider.js.map +1 -1
  924. package/dist/typography/_typography.scss +141 -87
  925. package/dist/useDebouncedFunction.d.ts +2 -2
  926. package/dist/useDebouncedFunction.js +10 -6
  927. package/dist/useDebouncedFunction.js.map +1 -1
  928. package/dist/useElementSize.d.ts +40 -0
  929. package/dist/useElementSize.js +53 -0
  930. package/dist/useElementSize.js.map +1 -0
  931. package/dist/useEnsuredState.d.ts +1 -1
  932. package/dist/useEnsuredState.js.map +1 -1
  933. package/dist/useResizeListener.d.ts +1 -1
  934. package/dist/useResizeListener.js +1 -0
  935. package/dist/useResizeListener.js.map +1 -1
  936. package/dist/useResizeObserver.d.ts +4 -43
  937. package/dist/useResizeObserver.js +4 -43
  938. package/dist/useResizeObserver.js.map +1 -1
  939. package/dist/useThrottledFunction.d.ts +2 -2
  940. package/dist/useThrottledFunction.js +20 -16
  941. package/dist/useThrottledFunction.js.map +1 -1
  942. package/dist/useWindowSize.d.ts +14 -11
  943. package/dist/useWindowSize.js +12 -7
  944. package/dist/useWindowSize.js.map +1 -1
  945. package/dist/utils/alphaNumericSort.d.ts +1 -1
  946. package/dist/utils/alphaNumericSort.js +2 -10
  947. package/dist/utils/alphaNumericSort.js.map +1 -1
  948. package/dist/utils/getMiddleOfRange.d.ts +13 -0
  949. package/dist/utils/getMiddleOfRange.js +20 -0
  950. package/dist/utils/getMiddleOfRange.js.map +1 -0
  951. package/dist/utils/getRangeDefaultValue.d.ts +3 -5
  952. package/dist/utils/getRangeDefaultValue.js +3 -13
  953. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  954. package/dist/utils/getRangeSteps.d.ts +1 -1
  955. package/dist/utils/getRangeSteps.js +2 -2
  956. package/dist/utils/getRangeSteps.js.map +1 -1
  957. package/dist/utils/nearest.js +1 -1
  958. package/dist/utils/nearest.js.map +1 -1
  959. package/dist/window-splitter/_window-splitter.scss +83 -112
  960. package/dist/window-splitter/useWindowSplitter.d.ts +3 -5
  961. package/dist/window-splitter/useWindowSplitter.js +3 -11
  962. package/dist/window-splitter/useWindowSplitter.js.map +1 -1
  963. package/jest.config.ts +4 -0
  964. package/package.json +35 -40
  965. package/scripts/{copySassFiles.js → copySassFiles.ts} +5 -5
  966. package/scripts/tsconfig.json +18 -0
  967. package/src/RootHtml.tsx +95 -0
  968. package/src/__tests__/RootHtml.node.tsx +46 -0
  969. package/src/__tests__/__snapshots__/RootHtml.node.tsx.snap +19 -0
  970. package/src/__tests__/useDebouncedFunction.tsx +65 -24
  971. package/src/__tests__/useElementSize.tsx +181 -0
  972. package/src/__tests__/useThrottledFunction.tsx +54 -0
  973. package/src/__tests__/useWindowSize.node.tsx +56 -0
  974. package/src/__tests__/useWindowSize.tsx +156 -0
  975. package/src/_box-shadows.scss +12 -2
  976. package/src/_core.scss +207 -253
  977. package/src/_utils.scss +89 -0
  978. package/src/app-bar/AppBar.tsx +59 -19
  979. package/src/app-bar/__tests__/__snapshots__/AppBar.tsx.snap +21 -21
  980. package/src/app-bar/_app-bar.scss +114 -122
  981. package/src/avatar/Avatar.tsx +25 -4
  982. package/src/avatar/__tests__/Avatar.tsx +1 -1
  983. package/src/avatar/__tests__/__snapshots__/Avatar.tsx.snap +6 -6
  984. package/src/avatar/_avatar.scss +74 -81
  985. package/src/badge/_badge.scss +97 -59
  986. package/src/box/_box.scss +72 -81
  987. package/src/button/TooltippedButton.tsx +120 -0
  988. package/src/button/__tests__/TooltippedButton.tsx +60 -0
  989. package/src/button/__tests__/__snapshots__/Button.tsx.snap +1 -1
  990. package/src/button/__tests__/__snapshots__/TooltippedButton.tsx.snap +26 -0
  991. package/src/button/_button.scss +170 -180
  992. package/src/card/Card.tsx +5 -3
  993. package/src/card/CardContent.tsx +3 -3
  994. package/src/card/ClickableCard.tsx +105 -0
  995. package/src/card/__tests__/ClickableCard.tsx +66 -0
  996. package/src/card/__tests__/__snapshots__/CardHeader.tsx.snap +1 -1
  997. package/src/card/__tests__/__snapshots__/CardSubtitle.tsx.snap +2 -2
  998. package/src/card/__tests__/__snapshots__/ClickableCard.tsx.snap +20 -0
  999. package/src/card/__tests__/__snapshots__/styles.ts.snap +1 -1
  1000. package/src/card/_card.scss +81 -82
  1001. package/src/card/styles.ts +19 -10
  1002. package/src/chip/_chip.scss +137 -148
  1003. package/src/dialog/FixedDialog.tsx +5 -4
  1004. package/src/dialog/_dialog.scss +179 -162
  1005. package/src/divider/Divider.tsx +0 -1
  1006. package/src/divider/_divider.scss +61 -70
  1007. package/src/draggable/_draggable.scss +16 -12
  1008. package/src/draggable/useDraggable.ts +26 -25
  1009. package/src/draggable/utils.ts +16 -50
  1010. package/src/expansion-panel/__tests__/ExpansionPanel.tsx +2 -2
  1011. package/src/expansion-panel/_expansion-panel.scss +76 -50
  1012. package/src/expansion-panel/useExpansionPanels.ts +20 -16
  1013. package/src/form/Form.tsx +2 -1
  1014. package/src/form/Label.tsx +5 -5
  1015. package/src/form/MenuItemInputToggle.tsx +46 -64
  1016. package/src/form/NativeSelect.tsx +6 -3
  1017. package/src/form/Option.tsx +8 -2
  1018. package/src/form/ResizingTextAreaWrapper.tsx +75 -0
  1019. package/src/form/Select.tsx +251 -327
  1020. package/src/form/SelectedOption.tsx +55 -0
  1021. package/src/form/TextArea.tsx +40 -32
  1022. package/src/form/TextField.tsx +19 -19
  1023. package/src/form/TextFieldContainerStyles.ts +7 -7
  1024. package/src/form/__tests__/MenuItemCheckbox.tsx +53 -0
  1025. package/src/form/__tests__/MenuItemRadio.tsx +53 -0
  1026. package/src/form/__tests__/Select.tsx +439 -0
  1027. package/src/form/__tests__/TextArea.tsx +433 -0
  1028. package/src/form/__tests__/TextField.tsx +195 -0
  1029. package/src/form/__tests__/__snapshots__/FileInput.tsx.snap +23 -23
  1030. package/src/form/__tests__/__snapshots__/MenuItemCheckbox.tsx.snap +96 -0
  1031. package/src/form/__tests__/__snapshots__/MenuItemRadio.tsx.snap +96 -0
  1032. package/src/form/__tests__/__snapshots__/Select.tsx.snap +492 -0
  1033. package/src/form/__tests__/__snapshots__/TextArea.tsx.snap +548 -0
  1034. package/src/form/__tests__/__snapshots__/TextField.tsx.snap +279 -0
  1035. package/src/form/__tests__/useFormReset.tsx +195 -0
  1036. package/src/form/_form.scss +1336 -1260
  1037. package/src/form/menuItemInputToggleStyles.ts +78 -0
  1038. package/src/form/selectUtils.ts +3 -14
  1039. package/src/form/textAreaStyles.ts +2 -2
  1040. package/src/form/types.ts +6 -8
  1041. package/src/form/useCombobox.ts +523 -0
  1042. package/src/form/useEditableCombobox.ts +139 -0
  1043. package/src/form/useFormReset.ts +48 -0
  1044. package/src/form/useListboxProvider.ts +9 -7
  1045. package/src/form/useResizingTextArea.ts +66 -25
  1046. package/src/form/useSelectCombobox.ts +70 -0
  1047. package/src/form/utils.ts +17 -4
  1048. package/src/icon/IconRotator.tsx +1 -2
  1049. package/src/icon/_icon.scss +105 -112
  1050. package/src/index.ts +22 -1
  1051. package/src/interaction/_interaction.scss +144 -135
  1052. package/src/layout/__tests__/__snapshots__/LayoutAppBar.tsx.snap +4 -4
  1053. package/src/layout/__tests__/__snapshots__/useExpandableLayout.tsx.snap +1 -1
  1054. package/src/layout/__tests__/__snapshots__/useLayoutTree.tsx.snap +18 -18
  1055. package/src/layout/__tests__/__snapshots__/useResizableLayout.tsx.snap +1 -1
  1056. package/src/layout/__tests__/__snapshots__/useTemporaryLayout.tsx.snap +1 -1
  1057. package/src/layout/_layout.scss +82 -86
  1058. package/src/layout/useLayoutAppBarHeight.ts +5 -9
  1059. package/src/link/_link.scss +74 -66
  1060. package/src/list/ListItem.tsx +20 -13
  1061. package/src/list/ListItemAddon.tsx +5 -3
  1062. package/src/list/ListItemChildren.tsx +4 -2
  1063. package/src/list/ListItemLink.tsx +4 -4
  1064. package/src/list/__tests__/ListItem.tsx +1 -1
  1065. package/src/list/__tests__/__snapshots__/ListItem.tsx.snap +1 -1
  1066. package/src/list/__tests__/getListItemHeight.ts +2 -2
  1067. package/src/list/_list.scss +187 -184
  1068. package/src/list/getListItemHeight.ts +2 -3
  1069. package/src/list/listItemStyles.ts +15 -5
  1070. package/src/list/types.ts +28 -6
  1071. package/src/menu/Menu.tsx +10 -2
  1072. package/src/menu/MenuItemCircularProgress.tsx +116 -0
  1073. package/src/menu/__tests__/MenuItemCircularProgress.tsx +39 -0
  1074. package/src/menu/__tests__/__snapshots__/MenuItemCircularProgress.tsx.snap +68 -0
  1075. package/src/menu/__tests__/__snapshots__/useContextMenu.tsx.snap +54 -0
  1076. package/src/menu/__tests__/useContextMenu.tsx +41 -0
  1077. package/src/menu/_menu.scss +29 -50
  1078. package/src/menu/useContextMenu.ts +3 -3
  1079. package/src/movement/types.ts +50 -25
  1080. package/src/movement/useKeyboardMovementProvider.ts +21 -8
  1081. package/src/movement/utils.ts +12 -2
  1082. package/src/overlay/_overlay.scss +39 -42
  1083. package/src/portal/PortalContainerProvider.tsx +10 -2
  1084. package/src/portal/__tests__/PortalContainerProvider.tsx +23 -0
  1085. package/src/positioning/__tests__/__snapshots__/useFixedPositioning.tsx.snap +0 -32
  1086. package/src/positioning/__tests__/useFixedPositioning.tsx +0 -14
  1087. package/src/positioning/useFixedPositioning.ts +0 -6
  1088. package/src/progress/_progress.scss +33 -33
  1089. package/src/responsive-item/_responsive-item.scss +91 -89
  1090. package/src/searching/__tests__/caseInsensitive.ts +165 -0
  1091. package/src/searching/__tests__/fuzzy.ts +169 -0
  1092. package/src/searching/__tests__/toSearchQuery.ts +21 -0
  1093. package/src/searching/__tests__/useFuzzyMatch.tsx +200 -0
  1094. package/src/searching/caseInsensitive.ts +200 -0
  1095. package/src/searching/fuzzy.ts +175 -0
  1096. package/src/searching/toSearchQuery.ts +20 -0
  1097. package/src/searching/types.ts +34 -0
  1098. package/src/searching/useFuzzyMatch.ts +42 -0
  1099. package/src/searching/utils.ts +53 -0
  1100. package/src/segmented-button/_segmented-button.scss +86 -92
  1101. package/src/sheet/_sheet.scss +107 -123
  1102. package/src/sheet/styles.ts +14 -15
  1103. package/src/snackbar/DefaultToastRenderer.tsx +1 -1
  1104. package/src/snackbar/Snackbar.tsx +28 -32
  1105. package/src/snackbar/Toast.tsx +7 -2
  1106. package/src/snackbar/ToastManager.tsx +3 -2
  1107. package/src/snackbar/__tests__/Snackbar.tsx +12 -11
  1108. package/src/snackbar/__tests__/ToastManagerProvider.tsx +20 -42
  1109. package/src/snackbar/__tests__/__snapshots__/Snackbar.tsx.snap +127 -27
  1110. package/src/snackbar/__tests__/__snapshots__/ToastManagerProvider.tsx.snap +23 -8
  1111. package/src/snackbar/_snackbar.scss +148 -144
  1112. package/src/snackbar/snackbarStyles.ts +3 -1
  1113. package/src/suspense/__tests__/CircularProgressSuspense.tsx +90 -0
  1114. package/src/suspense/__tests__/NullSuspense.tsx +46 -0
  1115. package/src/suspense/__tests__/__snapshots__/CircularProgressSuspense.tsx.snap +24 -0
  1116. package/src/table/TableCheckbox.tsx +4 -2
  1117. package/src/table/TableRadio.tsx +4 -2
  1118. package/src/table/_table.scss +214 -227
  1119. package/src/table/tableCellStyles.ts +1 -1
  1120. package/src/tabs/Tab.tsx +110 -70
  1121. package/src/tabs/__tests__/Tab.tsx +25 -2
  1122. package/src/tabs/__tests__/TabList.tsx +4 -4
  1123. package/src/tabs/__tests__/__snapshots__/TabList.tsx.snap +2 -2
  1124. package/src/tabs/_tabs.scss +62 -53
  1125. package/src/tabs/tabIndicatorStyles.ts +13 -3
  1126. package/src/tabs/tabListStyles.ts +1 -1
  1127. package/src/tabs/tabStyles.ts +16 -4
  1128. package/src/tabs/useTabList.ts +10 -8
  1129. package/src/test-utils/ResizeObserver.ts +100 -53
  1130. package/src/test-utils/__tests__/ResizeObserver.ts +1 -1
  1131. package/src/test-utils/data-testid.ts +5 -1
  1132. package/src/test-utils/matchMedia.ts +2 -2
  1133. package/src/test-utils/polyfills/TextDecoder.ts +7 -0
  1134. package/src/test-utils/polyfills/TextEncoder.ts +5 -0
  1135. package/src/test-utils/polyfills/index.ts +2 -0
  1136. package/src/theme/_theme.scss +243 -133
  1137. package/src/tooltip/_tooltip.scss +76 -83
  1138. package/src/tooltip/useTooltip.ts +23 -16
  1139. package/src/transition/SkeletonPlaceholder.tsx +18 -6
  1140. package/src/transition/__tests__/SkeletonPlaceholder.tsx +72 -0
  1141. package/src/transition/__tests__/__snapshots__/SkeletonPlaceholder.tsx.snap +24 -0
  1142. package/src/transition/__tests__/utils.ts +25 -0
  1143. package/src/transition/_transition.scss +89 -78
  1144. package/src/transition/skeletonPlaceholderUtils.ts +105 -0
  1145. package/src/transition/useCollapseTransition.ts +6 -24
  1146. package/src/transition/useSkeletonPlaceholder.ts +62 -47
  1147. package/src/transition/utils.ts +10 -5
  1148. package/src/tree/DefaultTreeItemRenderer.tsx +6 -2
  1149. package/src/tree/Tree.tsx +8 -4
  1150. package/src/tree/TreeItem.tsx +3 -4
  1151. package/src/tree/__tests__/Tree.tsx +1 -1
  1152. package/src/tree/__tests__/__snapshots__/Tree.tsx.snap +124 -124
  1153. package/src/tree/_tree.scss +111 -109
  1154. package/src/tree/styles.ts +0 -9
  1155. package/src/tree/useTreeMovement.ts +1 -1
  1156. package/src/types.ts +13 -0
  1157. package/src/typography/SrOnly.tsx +9 -9
  1158. package/src/typography/Typography.tsx +19 -19
  1159. package/src/typography/WritingDirectionProvider.tsx +4 -2
  1160. package/src/typography/__tests__/__snapshots__/SrOnly.tsx.snap +5 -5
  1161. package/src/typography/_typography.scss +141 -87
  1162. package/src/useDebouncedFunction.ts +12 -10
  1163. package/src/useElementSize.ts +83 -0
  1164. package/src/useEnsuredState.ts +1 -1
  1165. package/src/useResizeListener.ts +3 -1
  1166. package/src/useResizeObserver.ts +8 -45
  1167. package/src/useThrottledFunction.ts +12 -10
  1168. package/src/useWindowSize.ts +29 -19
  1169. package/src/utils/__tests__/getMiddleOfRange.ts +12 -0
  1170. package/src/utils/__tests__/getRangeDefaultValue.ts +47 -0
  1171. package/src/utils/alphaNumericSort.ts +3 -16
  1172. package/src/utils/getMiddleOfRange.ts +26 -0
  1173. package/src/utils/getRangeDefaultValue.ts +8 -15
  1174. package/src/utils/getRangeSteps.ts +2 -2
  1175. package/src/utils/nearest.ts +1 -1
  1176. package/src/window-splitter/_window-splitter.scss +83 -112
  1177. package/src/window-splitter/useWindowSplitter.ts +12 -28
  1178. package/tsconfig.types.json +1 -1
  1179. package/dist/divider/VerticalDivider.d.ts +0 -32
  1180. package/dist/divider/useVerticalDividerHeight.d.ts +0 -37
  1181. package/dist/form/SelectValue.d.ts +0 -17
  1182. package/dist/form/SelectValue.js +0 -32
  1183. package/dist/form/SelectValue.js.map +0 -1
  1184. package/dist/icon/MaterialIconsProvider.d.ts +0 -12
  1185. package/dist/icon/MaterialIconsProvider.js +0 -17
  1186. package/dist/icon/MaterialIconsProvider.js.map +0 -1
  1187. package/dist/icon/MaterialSymbolsProvider.d.ts +0 -145
  1188. package/dist/icon/MaterialSymbolsProvider.js +0 -60
  1189. package/dist/icon/MaterialSymbolsProvider.js.map +0 -1
  1190. package/dist/link/LinkProvider.d.ts +0 -29
  1191. package/dist/menu/menuConfig.d.ts +0 -60
  1192. package/dist/tooltip/useOverflowTooltip.d.ts +0 -61
  1193. package/dist/utils/filters.d.ts +0 -196
  1194. package/dist/utils/filters.js +0 -67
  1195. package/dist/utils/filters.js.map +0 -1
  1196. package/src/form/SelectValue.tsx +0 -39
  1197. package/src/utils/__tests__/filters.ts +0 -279
  1198. package/src/utils/filters.ts +0 -320
@@ -0,0 +1,53 @@
1
+ "use client";
2
+ import { useCallback, useState } from "react";
3
+ import { useResizeObserver } from "./useResizeObserver.js";
4
+ /**
5
+ * A small wrapper around the {@link useResizeObserver} hook to calculate the
6
+ * element's size.
7
+ *
8
+ * @example
9
+ * Simple Example
10
+ * ```tsx
11
+ * import { useElementSize } from "@react-md/core";
12
+ * import { type ReactElement } from "react";
13
+ *
14
+ * function Example(): ReactElement {
15
+ * const { height, width, elementRef } = useElementSize();
16
+ *
17
+ * return (
18
+ * <div ref={elementRef}>
19
+ * {`height: ${height}, width: ${width}`}
20
+ * </div>
21
+ * );
22
+ * }
23
+ * ```
24
+ *
25
+ * @remarks \@since 6.0.0
26
+ */ export function useElementSize(options = {}) {
27
+ const { defaultValue } = options;
28
+ const [size, setSize] = useState(()=>{
29
+ if (typeof defaultValue === "function") {
30
+ return defaultValue();
31
+ }
32
+ return defaultValue ?? {
33
+ height: 0,
34
+ width: 0
35
+ };
36
+ });
37
+ const elementRef = useResizeObserver({
38
+ ...options,
39
+ onUpdate: useCallback((entry)=>{
40
+ const size = entry.borderBoxSize[0];
41
+ setSize({
42
+ height: size.blockSize,
43
+ width: size.inlineSize
44
+ });
45
+ }, [])
46
+ });
47
+ return {
48
+ ...size,
49
+ elementRef
50
+ };
51
+ }
52
+
53
+ //# sourceMappingURL=useElementSize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/useElementSize.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState, type RefCallback } from \"react\";\nimport { type ElementSize, type UseStateInitializer } from \"./types.js\";\nimport {\n useResizeObserver,\n type ResizeObserverHookOptions,\n} from \"./useResizeObserver.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ElementSizeOptions<E extends HTMLElement>\n extends Omit<ResizeObserverHookOptions<E>, \"onUpdate\"> {\n /** @defaultValue `{ height: 0, width: 0 }` */\n defaultValue?: UseStateInitializer<ElementSize>;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface ElementSizeImplementation<E extends HTMLElement>\n extends ElementSize {\n elementRef: RefCallback<E>;\n}\n\n/**\n * A small wrapper around the {@link useResizeObserver} hook to calculate the\n * element's size.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { useElementSize } from \"@react-md/core\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const { height, width, elementRef } = useElementSize();\n *\n * return (\n * <div ref={elementRef}>\n * {`height: ${height}, width: ${width}`}\n * </div>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useElementSize<E extends HTMLElement>(\n options: ElementSizeOptions<E> = {}\n): ElementSizeImplementation<E> {\n const { defaultValue } = options;\n\n const [size, setSize] = useState<ElementSize>(() => {\n if (typeof defaultValue === \"function\") {\n return defaultValue();\n }\n\n return (\n defaultValue ?? {\n height: 0,\n width: 0,\n }\n );\n });\n\n const elementRef = useResizeObserver({\n ...options,\n onUpdate: useCallback((entry) => {\n const size = entry.borderBoxSize[0];\n\n setSize({\n height: size.blockSize,\n width: size.inlineSize,\n });\n }, []),\n });\n\n return {\n ...size,\n elementRef,\n };\n}\n"],"names":["useCallback","useState","useResizeObserver","useElementSize","options","defaultValue","size","setSize","height","width","elementRef","onUpdate","entry","borderBoxSize","blockSize","inlineSize"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,QAAQ,QAA0B,QAAQ;AAEhE,SACEC,iBAAiB,QAEZ,yBAAyB;AAmBhC;;;;;;;;;;;;;;;;;;;;;;CAsBC,GACD,OAAO,SAASC,eACdC,UAAiC,CAAC,CAAC;IAEnC,MAAM,EAAEC,YAAY,EAAE,GAAGD;IAEzB,MAAM,CAACE,MAAMC,QAAQ,GAAGN,SAAsB;QAC5C,IAAI,OAAOI,iBAAiB,YAAY;YACtC,OAAOA;QACT;QAEA,OACEA,gBAAgB;YACdG,QAAQ;YACRC,OAAO;QACT;IAEJ;IAEA,MAAMC,aAAaR,kBAAkB;QACnC,GAAGE,OAAO;QACVO,UAAUX,YAAY,CAACY;YACrB,MAAMN,OAAOM,MAAMC,aAAa,CAAC,EAAE;YAEnCN,QAAQ;gBACNC,QAAQF,KAAKQ,SAAS;gBACtBL,OAAOH,KAAKS,UAAU;YACxB;QACF,GAAG,EAAE;IACP;IAEA,OAAO;QACL,GAAGT,IAAI;QACPI;IACF;AACF"}
@@ -4,7 +4,7 @@ import type { UseStateInitializer, UseStateSetter } from "./types.js";
4
4
  * @internal
5
5
  * @remarks \@since 6.0.0
6
6
  */
7
- export interface EnsuredStateOptions<V, Setter extends Dispatch<V> | UseStateSetter<V>> {
7
+ export interface EnsuredStateOptions<V, Setter extends Dispatch<V> | UseStateSetter<V> = UseStateSetter<V>> {
8
8
  value?: V;
9
9
  setValue?: Setter;
10
10
  defaultValue?: UseStateInitializer<V>;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useEnsuredState.ts"],"sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\nimport type { Dispatch } from \"react\";\nimport { useState } from \"react\";\nimport type { UseStateInitializer, UseStateSetter } from \"./types.js\";\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport interface EnsuredStateOptions<\n V,\n Setter extends Dispatch<V> | UseStateSetter<V>,\n> {\n value?: V;\n setValue?: Setter;\n defaultValue?: UseStateInitializer<V>;\n}\n\n/**\n * This is used to dynamically allow controlling hooks by providing a `value` +\n * `setValue` or defaulting to uncontrolled behavior with local state.\n *\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function useEnsuredState<\n V,\n Setter extends Dispatch<V> | UseStateSetter<V>,\n>(\n options: EnsuredStateOptions<V, Setter>\n): readonly [value: V, setValue: Setter] {\n const { value, setValue, defaultValue } = options;\n if (typeof value !== \"undefined\" && typeof setValue !== \"undefined\") {\n return [value, setValue];\n }\n\n if (typeof value !== \"undefined\" || typeof setValue !== \"undefined\") {\n throw new Error(\n \"Both a `value` and `setValue` must be defined for controlled components.\"\n );\n }\n\n if (typeof defaultValue === \"undefined\") {\n throw new Error(\n \"A `defaultValue` must be defined for uncontrolled components.\"\n );\n }\n\n return useState(defaultValue) as [value: V, setValue: Setter];\n}\n"],"names":["useState","useEnsuredState","options","value","setValue","defaultValue","Error"],"mappings":"AAAA,6CAA6C,GAE7C,SAASA,QAAQ,QAAQ,QAAQ;AAgBjC;;;;;;CAMC,GACD,OAAO,SAASC,gBAIdC,OAAuC;IAEvC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGH;IAC1C,IAAI,OAAOC,UAAU,eAAe,OAAOC,aAAa,aAAa;QACnE,OAAO;YAACD;YAAOC;SAAS;IAC1B;IAEA,IAAI,OAAOD,UAAU,eAAe,OAAOC,aAAa,aAAa;QACnE,MAAM,IAAIE,MACR;IAEJ;IAEA,IAAI,OAAOD,iBAAiB,aAAa;QACvC,MAAM,IAAIC,MACR;IAEJ;IAEA,OAAON,SAASK;AAClB"}
1
+ {"version":3,"sources":["../src/useEnsuredState.ts"],"sourcesContent":["/* eslint-disable react-hooks/rules-of-hooks */\nimport type { Dispatch } from \"react\";\nimport { useState } from \"react\";\nimport type { UseStateInitializer, UseStateSetter } from \"./types.js\";\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport interface EnsuredStateOptions<\n V,\n Setter extends Dispatch<V> | UseStateSetter<V> = UseStateSetter<V>,\n> {\n value?: V;\n setValue?: Setter;\n defaultValue?: UseStateInitializer<V>;\n}\n\n/**\n * This is used to dynamically allow controlling hooks by providing a `value` +\n * `setValue` or defaulting to uncontrolled behavior with local state.\n *\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function useEnsuredState<\n V,\n Setter extends Dispatch<V> | UseStateSetter<V>,\n>(\n options: EnsuredStateOptions<V, Setter>\n): readonly [value: V, setValue: Setter] {\n const { value, setValue, defaultValue } = options;\n if (typeof value !== \"undefined\" && typeof setValue !== \"undefined\") {\n return [value, setValue];\n }\n\n if (typeof value !== \"undefined\" || typeof setValue !== \"undefined\") {\n throw new Error(\n \"Both a `value` and `setValue` must be defined for controlled components.\"\n );\n }\n\n if (typeof defaultValue === \"undefined\") {\n throw new Error(\n \"A `defaultValue` must be defined for uncontrolled components.\"\n );\n }\n\n return useState(defaultValue) as [value: V, setValue: Setter];\n}\n"],"names":["useState","useEnsuredState","options","value","setValue","defaultValue","Error"],"mappings":"AAAA,6CAA6C,GAE7C,SAASA,QAAQ,QAAQ,QAAQ;AAgBjC;;;;;;CAMC,GACD,OAAO,SAASC,gBAIdC,OAAuC;IAEvC,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,EAAE,GAAGH;IAC1C,IAAI,OAAOC,UAAU,eAAe,OAAOC,aAAa,aAAa;QACnE,OAAO;YAACD;YAAOC;SAAS;IAC1B;IAEA,IAAI,OAAOD,UAAU,eAAe,OAAOC,aAAa,aAAa;QACnE,MAAM,IAAIE,MACR;IAEJ;IAEA,IAAI,OAAOD,iBAAiB,aAAa;QACvC,MAAM,IAAIC,MACR;IAEJ;IAEA,OAAON,SAASK;AAClB"}
@@ -17,7 +17,7 @@ export interface ResizeListenerOptions extends AddEventListenerOptions {
17
17
  disabled?: boolean;
18
18
  /**
19
19
  * This function will be called whenever the resize event is fired on the
20
- * `window`.
20
+ * `window`. This should be wrapped in `useCallback`.
21
21
  */
22
22
  onUpdate(event: Event): void;
23
23
  }
@@ -53,6 +53,7 @@ import { delegateEvent } from "./delegateEvent.js";
53
53
  passive
54
54
  });
55
55
  eventHandler.add(onUpdate);
56
+ window.dispatchEvent(new Event("resize"));
56
57
  return ()=>{
57
58
  eventHandler.remove(onUpdate);
58
59
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useResizeListener.ts"],"sourcesContent":["\"use client\";\nimport { useEffect } from \"react\";\nimport { delegateEvent } from \"./delegateEvent.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { useResizeObserver } from \"./useResizeObserver.js\";\n\n/**\n * @remarks \\@since 6.0.0 Updated the API\n */\nexport interface ResizeListenerOptions extends AddEventListenerOptions {\n /**\n * Set this to `false` to disable throttling with\n * `window.requestAnimationFrame`.\n *\n * @defaultValue `true`\n */\n throttle?: boolean;\n\n /**\n * Set this to `true` to disable attaching the resize event handler.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * This function will be called whenever the resize event is fired on the\n * `window`.\n */\n onUpdate(event: Event): void;\n}\n\n/**\n * This hook can be used to listen to the entire window resizing. If you need to\n * observe specific elements resizing, check out the {@link useResizeObserver}\n * hook instead.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { useResizeListener } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [size, setSize] = useState({\n * height: window.innerHeight,\n * width: window.innerWidth,\n * }):\n *\n * useResizeListener({\n * onUpdate(event) {\n * setSize({\n * height: window.innerHeight,\n * width: window.innerWidth,\n * });\n * },\n * });\n *\n * return (\n * <>\n * The current window size:\n * <pre><code>{JSON.stringify(size, null, 2)}</code></pre>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0 Updated the API to match the `useResizeObserver` and\n * `useIntersectionObserver` hooks by having an `onUpdate` callback and include\n * the `AddEventListenerOptions` as part of the hook options.\n */\nexport function useResizeListener(options: ResizeListenerOptions): void {\n const {\n once,\n signal,\n capture,\n passive,\n throttle = true,\n disabled = false,\n onUpdate,\n } = options;\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n const eventHandler = delegateEvent(\"resize\", window, throttle, {\n once,\n signal,\n capture,\n passive,\n });\n eventHandler.add(onUpdate);\n return () => {\n eventHandler.remove(onUpdate);\n };\n }, [capture, disabled, onUpdate, once, passive, signal, throttle]);\n}\n"],"names":["useEffect","delegateEvent","useResizeListener","options","once","signal","capture","passive","throttle","disabled","onUpdate","eventHandler","window","add","remove"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,aAAa,QAAQ,qBAAqB;AA8BnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,SAASC,kBAAkBC,OAA8B;IAC9D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,WAAW,IAAI,EACfC,WAAW,KAAK,EAChBC,QAAQ,EACT,GAAGP;IAEJH,UAAU;QACR,IAAIS,UAAU;YACZ;QACF;QAEA,MAAME,eAAeV,cAAc,UAAUW,QAAQJ,UAAU;YAC7DJ;YACAC;YACAC;YACAC;QACF;QACAI,aAAaE,GAAG,CAACH;QACjB,OAAO;YACLC,aAAaG,MAAM,CAACJ;QACtB;IACF,GAAG;QAACJ;QAASG;QAAUC;QAAUN;QAAMG;QAASF;QAAQG;KAAS;AACnE"}
1
+ {"version":3,"sources":["../src/useResizeListener.ts"],"sourcesContent":["\"use client\";\nimport { useEffect } from \"react\";\nimport { delegateEvent } from \"./delegateEvent.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { useResizeObserver } from \"./useResizeObserver.js\";\n\n/**\n * @remarks \\@since 6.0.0 Updated the API\n */\nexport interface ResizeListenerOptions extends AddEventListenerOptions {\n /**\n * Set this to `false` to disable throttling with\n * `window.requestAnimationFrame`.\n *\n * @defaultValue `true`\n */\n throttle?: boolean;\n\n /**\n * Set this to `true` to disable attaching the resize event handler.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * This function will be called whenever the resize event is fired on the\n * `window`. This should be wrapped in `useCallback`.\n */\n onUpdate(event: Event): void;\n}\n\n/**\n * This hook can be used to listen to the entire window resizing. If you need to\n * observe specific elements resizing, check out the {@link useResizeObserver}\n * hook instead.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { useResizeListener } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const [size, setSize] = useState({\n * height: window.innerHeight,\n * width: window.innerWidth,\n * }):\n *\n * useResizeListener({\n * onUpdate(event) {\n * setSize({\n * height: window.innerHeight,\n * width: window.innerWidth,\n * });\n * },\n * });\n *\n * return (\n * <>\n * The current window size:\n * <pre><code>{JSON.stringify(size, null, 2)}</code></pre>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0 Updated the API to match the `useResizeObserver` and\n * `useIntersectionObserver` hooks by having an `onUpdate` callback and include\n * the `AddEventListenerOptions` as part of the hook options.\n */\nexport function useResizeListener(options: ResizeListenerOptions): void {\n const {\n once,\n signal,\n capture,\n passive,\n throttle = true,\n disabled = false,\n onUpdate,\n } = options;\n\n useEffect(() => {\n if (disabled) {\n return;\n }\n\n const eventHandler = delegateEvent(\"resize\", window, throttle, {\n once,\n signal,\n capture,\n passive,\n });\n eventHandler.add(onUpdate);\n\n window.dispatchEvent(new Event(\"resize\"));\n return () => {\n eventHandler.remove(onUpdate);\n };\n }, [capture, disabled, onUpdate, once, passive, signal, throttle]);\n}\n"],"names":["useEffect","delegateEvent","useResizeListener","options","once","signal","capture","passive","throttle","disabled","onUpdate","eventHandler","window","add","dispatchEvent","Event","remove"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,aAAa,QAAQ,qBAAqB;AA8BnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCC,GACD,OAAO,SAASC,kBAAkBC,OAA8B;IAC9D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,WAAW,IAAI,EACfC,WAAW,KAAK,EAChBC,QAAQ,EACT,GAAGP;IAEJH,UAAU;QACR,IAAIS,UAAU;YACZ;QACF;QAEA,MAAME,eAAeV,cAAc,UAAUW,QAAQJ,UAAU;YAC7DJ;YACAC;YACAC;YACAC;QACF;QACAI,aAAaE,GAAG,CAACH;QAEjBE,OAAOE,aAAa,CAAC,IAAIC,MAAM;QAC/B,OAAO;YACLJ,aAAaK,MAAM,CAACN;QACtB;IACF,GAAG;QAACJ;QAASG;QAAUC;QAAUN;QAAMG;QAASF;QAAQG;KAAS;AACnE"}
@@ -1,4 +1,4 @@
1
- import type { Ref, RefCallback } from "react";
1
+ import { type Ref, type RefCallback } from "react";
2
2
  /**
3
3
  * @remarks \@since 6.0.0
4
4
  */
@@ -98,48 +98,9 @@ export interface ResizeObserverHookOptions<E extends HTMLElement> {
98
98
  disableWidth?: boolean;
99
99
  }
100
100
  /**
101
- * @example
102
- * Simple Example
103
- * ```tsx
104
- * import { useResizeObserver } from "@react-md/core";
105
- * import type { ReactElement } from "react";
106
- * import { useState } from "react";
107
- *
108
- * interface Size {
109
- * height: number;
110
- * width: number;
111
- * }
112
- *
113
- * function Example(): ReactElement {
114
- * const [{ height, width }, setSize] = useState<Size>({
115
- * height: 0,
116
- * width: 0,
117
- * });
118
- * const targetRef = useResizeObserver({
119
- * onResize: useCallback((entry) => {
120
- * const { height, width } = entry.borderBox;
121
- * setSize({ height, width });
122
- * }, []),
123
- * });
124
- *
125
- * return (
126
- * <div ref={targetRef}>
127
- * <table>
128
- * <tbody>
129
- * <tr>
130
- * <th scope="col">Height:</th>
131
- * <td>{height}</td>
132
- * </tr>
133
- * <tr>
134
- * <th scope="col">Width:</th>
135
- * <td>{width}</td>
136
- * </tr>
137
- * </tbody>
138
- * </table>
139
- * </div>
140
- * );
141
- * }
142
- * ```
101
+ * The resize observer is used to track the size changes of a specific element.
102
+ * For most cases you can use the {@link useElementSize} instead, but this hook
103
+ * can be used for more complex behavior with the {@link ResizeObserverEntry}.
143
104
  *
144
105
  * @remarks
145
106
  * \@since 2.3.0
@@ -67,7 +67,7 @@ import { useEnsuredRef } from "./useEnsuredRef.js";
67
67
  /* c8 ignore start */ if (!targetSubscriptions) {
68
68
  continue;
69
69
  }
70
- /* c8 ignore end */ const entries = targetSubscriptions.values();
70
+ /* c8 ignore stop */ const entries = targetSubscriptions.values();
71
71
  for (const subscription of entries){
72
72
  const { height, width } = entry.contentRect;
73
73
  const { scrollHeight, scrollWidth } = entry.target;
@@ -95,48 +95,9 @@ import { useEnsuredRef } from "./useEnsuredRef.js";
95
95
  * @remarks \@since 6.0.0
96
96
  */ export const resizeObserverManager = new ResizeObserverManager();
97
97
  /**
98
- * @example
99
- * Simple Example
100
- * ```tsx
101
- * import { useResizeObserver } from "@react-md/core";
102
- * import type { ReactElement } from "react";
103
- * import { useState } from "react";
104
- *
105
- * interface Size {
106
- * height: number;
107
- * width: number;
108
- * }
109
- *
110
- * function Example(): ReactElement {
111
- * const [{ height, width }, setSize] = useState<Size>({
112
- * height: 0,
113
- * width: 0,
114
- * });
115
- * const targetRef = useResizeObserver({
116
- * onResize: useCallback((entry) => {
117
- * const { height, width } = entry.borderBox;
118
- * setSize({ height, width });
119
- * }, []),
120
- * });
121
- *
122
- * return (
123
- * <div ref={targetRef}>
124
- * <table>
125
- * <tbody>
126
- * <tr>
127
- * <th scope="col">Height:</th>
128
- * <td>{height}</td>
129
- * </tr>
130
- * <tr>
131
- * <th scope="col">Width:</th>
132
- * <td>{width}</td>
133
- * </tr>
134
- * </tbody>
135
- * </table>
136
- * </div>
137
- * );
138
- * }
139
- * ```
98
+ * The resize observer is used to track the size changes of a specific element.
99
+ * For most cases you can use the {@link useElementSize} instead, but this hook
100
+ * can be used for more complex behavior with the {@link ResizeObserverEntry}.
140
101
  *
141
102
  * @remarks
142
103
  * \@since 2.3.0
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useResizeObserver.ts"],"sourcesContent":["\"use client\";\nimport type { Ref, RefCallback } from \"react\";\nimport { useEffect } from \"react\";\nimport { useEnsuredRef } from \"./useEnsuredRef.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type ResizeObserverEntryCallback = (entry: ResizeObserverEntry) => void;\n\n/** @internal */\ntype Unsubscribe = () => void;\n\n/** @internal */\ninterface TargetSize {\n height: number;\n width: number;\n scrollHeight: number;\n scrollWidth: number;\n}\n\n/** @internal */\ninterface TargetSubscription {\n readonly onUpdate: ResizeObserverEntryCallback;\n readonly disableHeight: boolean;\n readonly disableWidth: boolean;\n\n size?: TargetSize;\n}\n\n/** @internal */\ninterface SubscribeOptions {\n element: Element;\n onUpdate: ResizeObserverEntryCallback;\n disableHeight: boolean;\n disableWidth: boolean;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0 This was added to help with testing. The\n * `subscriptions` and `sharedObserver` used to be module-level variables but\n * moving to a class makes it easier to mock. Checkout the\n * `src/tests-utils/ResizeObserver.ts`\n */\nexport class ResizeObserverManager {\n frame: number;\n subscriptions: Map<Element, Set<TargetSubscription>>;\n\n /**\n * Why is there a single shared observer instead of multiple and a\n * \"subscription\" model?\n *\n * Note: Probably a bit of a premature optimization right now...\n *\n * @see https://github.com/WICG/resize-observer/issues/59\n * @internal\n */\n sharedObserver: ResizeObserver | undefined;\n\n constructor() {\n this.frame = 0;\n this.subscriptions = new Map();\n }\n\n subscribe = (options: SubscribeOptions): Unsubscribe => {\n const { element, onUpdate, disableHeight, disableWidth } = options;\n\n // lazy initialize the observer\n const observer =\n this.sharedObserver ||\n new ResizeObserver((entries) => {\n // this prevents the `ResizeObserver loop limit exceeded`\n window.cancelAnimationFrame(this.frame);\n this.frame = window.requestAnimationFrame(() => {\n this.handleResizeEntries(entries);\n });\n });\n this.sharedObserver = observer;\n\n const updates = this.subscriptions.get(element) || new Set();\n const subscription: TargetSubscription = {\n onUpdate,\n disableHeight,\n disableWidth,\n };\n updates.add(subscription);\n if (!this.subscriptions.has(element)) {\n this.subscriptions.set(element, updates);\n }\n\n observer.observe(element);\n\n return () => {\n observer.unobserve(element);\n updates.delete(subscription);\n };\n };\n\n handleResizeEntries = (entries: ResizeObserverEntry[]): void => {\n for (const entry of entries) {\n const targetSubscriptions = this.subscriptions.get(entry.target);\n // shouldn't really happen\n /* c8 ignore start */\n if (!targetSubscriptions) {\n continue;\n }\n /* c8 ignore end */\n\n const entries = targetSubscriptions.values();\n for (const subscription of entries) {\n const { height, width } = entry.contentRect;\n const { scrollHeight, scrollWidth } = entry.target;\n const { onUpdate, size, disableHeight, disableWidth } = subscription;\n const isHeightChange =\n !disableHeight &&\n (!size ||\n size.height !== height ||\n size.scrollHeight !== scrollHeight);\n const isWidthChange =\n !disableWidth &&\n (!size || size.width !== width || size.scrollWidth !== scrollWidth);\n\n subscription.size = {\n height,\n width,\n scrollHeight,\n scrollWidth,\n };\n if (isHeightChange || isWidthChange) {\n onUpdate(entry);\n }\n }\n }\n };\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport const resizeObserverManager = new ResizeObserverManager();\n\n/**\n * @remarks\n * \\@since 2.3.0\n * \\@since 6.0.0 Renamed from `UseResizeObserverOptions` and added\n * `onUpdate`/`disabled` options.\n */\nexport interface ResizeObserverHookOptions<E extends HTMLElement> {\n /**\n * An optional ref to merge with the ref returned by this hook.\n */\n ref?: Ref<E>;\n\n /**\n * **Must be wrapped in `useCallback` to prevent re-creating the\n * ResizeObserver each render.**\n *\n * This function will be called whenever the target element resizes.\n *\n * @see {@link useResizeObserver} for an example.\n */\n onUpdate: ResizeObserverEntryCallback;\n\n /**\n * Set this to `true` to prevent observing the element's size changes. THis is\n * equivalent to not attaching the returned ref to any element.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Set this to `true` if the {@link onUpdate} should not be fired for height\n * changes.\n *\n * @defaultValue `false`\n */\n disableHeight?: boolean;\n\n /**\n * Set this to `true` if the {@link onUpdate} should not be fired for width\n * changes.\n *\n * @defaultValue `false`\n */\n disableWidth?: boolean;\n}\n\n/**\n * @example\n * Simple Example\n * ```tsx\n * import { useResizeObserver } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * interface Size {\n * height: number;\n * width: number;\n * }\n *\n * function Example(): ReactElement {\n * const [{ height, width }, setSize] = useState<Size>({\n * height: 0,\n * width: 0,\n * });\n * const targetRef = useResizeObserver({\n * onResize: useCallback((entry) => {\n * const { height, width } = entry.borderBox;\n * setSize({ height, width });\n * }, []),\n * });\n *\n * return (\n * <div ref={targetRef}>\n * <table>\n * <tbody>\n * <tr>\n * <th scope=\"col\">Height:</th>\n * <td>{height}</td>\n * </tr>\n * <tr>\n * <th scope=\"col\">Width:</th>\n * <td>{width}</td>\n * </tr>\n * </tbody>\n * </table>\n * </div>\n * );\n * }\n * ```\n *\n * @remarks\n * \\@since 2.3.0\n * \\@since 6.0.0 The API was updated to match the `useIntersectionObserver`\n * implementation -- accepts only a single object parameter and returns a\n * {@link RefCallback} instead of `[nodeRef, refCallback]`\n */\nexport function useResizeObserver<E extends HTMLElement>(\n options: ResizeObserverHookOptions<E>\n): RefCallback<E> {\n const {\n ref,\n onUpdate,\n disabled,\n disableHeight = false,\n disableWidth = false,\n } = options;\n\n const [targetNodeRef, refCallback] = useEnsuredRef(ref);\n useEffect(() => {\n const element = targetNodeRef.current;\n if (disabled || (disableHeight && disableWidth) || !element) {\n return;\n }\n\n const unsubscribe = resizeObserverManager.subscribe({\n element,\n onUpdate,\n disableHeight,\n disableWidth,\n });\n\n return () => {\n unsubscribe();\n };\n }, [disableHeight, disableWidth, disabled, onUpdate, targetNodeRef]);\n\n return refCallback;\n}\n"],"names":["useEffect","useEnsuredRef","ResizeObserverManager","constructor","frame","subscriptions","sharedObserver","subscribe","options","element","onUpdate","disableHeight","disableWidth","observer","ResizeObserver","entries","window","cancelAnimationFrame","requestAnimationFrame","handleResizeEntries","updates","get","Set","subscription","add","has","set","observe","unobserve","delete","entry","targetSubscriptions","target","values","height","width","contentRect","scrollHeight","scrollWidth","size","isHeightChange","isWidthChange","Map","resizeObserverManager","useResizeObserver","ref","disabled","targetNodeRef","refCallback","current","unsubscribe"],"mappings":"AAAA;;;;;;;;;;;;;;AAEA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,aAAa,QAAQ,qBAAqB;AAmCnD;;;;;;CAMC,GACD,OAAO,MAAMC;IAeXC,aAAc;QAddC,uBAAAA,SAAAA,KAAAA;QACAC,uBAAAA,iBAAAA,KAAAA;QAEA;;;;;;;;GAQC,GACDC,uBAAAA,kBAAAA,KAAAA;QAOAC,uBAAAA,aAAY,CAACC;YACX,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,YAAY,EAAE,GAAGJ;YAE3D,+BAA+B;YAC/B,MAAMK,WACJ,IAAI,CAACP,cAAc,IACnB,IAAIQ,eAAe,CAACC;gBAClB,yDAAyD;gBACzDC,OAAOC,oBAAoB,CAAC,IAAI,CAACb,KAAK;gBACtC,IAAI,CAACA,KAAK,GAAGY,OAAOE,qBAAqB,CAAC;oBACxC,IAAI,CAACC,mBAAmB,CAACJ;gBAC3B;YACF;YACF,IAAI,CAACT,cAAc,GAAGO;YAEtB,MAAMO,UAAU,IAAI,CAACf,aAAa,CAACgB,GAAG,CAACZ,YAAY,IAAIa;YACvD,MAAMC,eAAmC;gBACvCb;gBACAC;gBACAC;YACF;YACAQ,QAAQI,GAAG,CAACD;YACZ,IAAI,CAAC,IAAI,CAAClB,aAAa,CAACoB,GAAG,CAAChB,UAAU;gBACpC,IAAI,CAACJ,aAAa,CAACqB,GAAG,CAACjB,SAASW;YAClC;YAEAP,SAASc,OAAO,CAAClB;YAEjB,OAAO;gBACLI,SAASe,SAAS,CAACnB;gBACnBW,QAAQS,MAAM,CAACN;YACjB;QACF;QAEAJ,uBAAAA,uBAAsB,CAACJ;YACrB,KAAK,MAAMe,SAASf,QAAS;gBAC3B,MAAMgB,sBAAsB,IAAI,CAAC1B,aAAa,CAACgB,GAAG,CAACS,MAAME,MAAM;gBAC/D,0BAA0B;gBAC1B,mBAAmB,GACnB,IAAI,CAACD,qBAAqB;oBACxB;gBACF;gBACA,iBAAiB,GAEjB,MAAMhB,UAAUgB,oBAAoBE,MAAM;gBAC1C,KAAK,MAAMV,gBAAgBR,QAAS;oBAClC,MAAM,EAAEmB,MAAM,EAAEC,KAAK,EAAE,GAAGL,MAAMM,WAAW;oBAC3C,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGR,MAAME,MAAM;oBAClD,MAAM,EAAEtB,QAAQ,EAAE6B,IAAI,EAAE5B,aAAa,EAAEC,YAAY,EAAE,GAAGW;oBACxD,MAAMiB,iBACJ,CAAC7B,iBACA,CAAA,CAAC4B,QACAA,KAAKL,MAAM,KAAKA,UAChBK,KAAKF,YAAY,KAAKA,YAAW;oBACrC,MAAMI,gBACJ,CAAC7B,gBACA,CAAA,CAAC2B,QAAQA,KAAKJ,KAAK,KAAKA,SAASI,KAAKD,WAAW,KAAKA,WAAU;oBAEnEf,aAAagB,IAAI,GAAG;wBAClBL;wBACAC;wBACAE;wBACAC;oBACF;oBACA,IAAIE,kBAAkBC,eAAe;wBACnC/B,SAASoB;oBACX;gBACF;YACF;QACF;QAzEE,IAAI,CAAC1B,KAAK,GAAG;QACb,IAAI,CAACC,aAAa,GAAG,IAAIqC;IAC3B;AAwEF;AAEA;;;CAGC,GACD,OAAO,MAAMC,wBAAwB,IAAIzC,wBAAwB;AAiDjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiDC,GACD,OAAO,SAAS0C,kBACdpC,OAAqC;IAErC,MAAM,EACJqC,GAAG,EACHnC,QAAQ,EACRoC,QAAQ,EACRnC,gBAAgB,KAAK,EACrBC,eAAe,KAAK,EACrB,GAAGJ;IAEJ,MAAM,CAACuC,eAAeC,YAAY,GAAG/C,cAAc4C;IACnD7C,UAAU;QACR,MAAMS,UAAUsC,cAAcE,OAAO;QACrC,IAAIH,YAAanC,iBAAiBC,gBAAiB,CAACH,SAAS;YAC3D;QACF;QAEA,MAAMyC,cAAcP,sBAAsBpC,SAAS,CAAC;YAClDE;YACAC;YACAC;YACAC;QACF;QAEA,OAAO;YACLsC;QACF;IACF,GAAG;QAACvC;QAAeC;QAAckC;QAAUpC;QAAUqC;KAAc;IAEnE,OAAOC;AACT"}
1
+ {"version":3,"sources":["../src/useResizeObserver.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, type Ref, type RefCallback } from \"react\";\nimport { useEnsuredRef } from \"./useEnsuredRef.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useElementSize } from \"./useElementSize.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type ResizeObserverEntryCallback = (entry: ResizeObserverEntry) => void;\n\n/** @internal */\ntype Unsubscribe = () => void;\n\n/** @internal */\ninterface TargetSize {\n height: number;\n width: number;\n scrollHeight: number;\n scrollWidth: number;\n}\n\n/** @internal */\ninterface TargetSubscription {\n readonly onUpdate: ResizeObserverEntryCallback;\n readonly disableHeight: boolean;\n readonly disableWidth: boolean;\n\n size?: TargetSize;\n}\n\n/** @internal */\ninterface SubscribeOptions {\n element: Element;\n onUpdate: ResizeObserverEntryCallback;\n disableHeight: boolean;\n disableWidth: boolean;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0 This was added to help with testing. The\n * `subscriptions` and `sharedObserver` used to be module-level variables but\n * moving to a class makes it easier to mock. Checkout the\n * `src/tests-utils/ResizeObserver.ts`\n */\nexport class ResizeObserverManager {\n frame: number;\n subscriptions: Map<Element, Set<TargetSubscription>>;\n\n /**\n * Why is there a single shared observer instead of multiple and a\n * \"subscription\" model?\n *\n * Note: Probably a bit of a premature optimization right now...\n *\n * @see https://github.com/WICG/resize-observer/issues/59\n * @internal\n */\n sharedObserver: ResizeObserver | undefined;\n\n constructor() {\n this.frame = 0;\n this.subscriptions = new Map();\n }\n\n subscribe = (options: SubscribeOptions): Unsubscribe => {\n const { element, onUpdate, disableHeight, disableWidth } = options;\n\n // lazy initialize the observer\n const observer =\n this.sharedObserver ||\n new ResizeObserver((entries) => {\n // this prevents the `ResizeObserver loop limit exceeded`\n window.cancelAnimationFrame(this.frame);\n this.frame = window.requestAnimationFrame(() => {\n this.handleResizeEntries(entries);\n });\n });\n this.sharedObserver = observer;\n\n const updates = this.subscriptions.get(element) || new Set();\n const subscription: TargetSubscription = {\n onUpdate,\n disableHeight,\n disableWidth,\n };\n updates.add(subscription);\n if (!this.subscriptions.has(element)) {\n this.subscriptions.set(element, updates);\n }\n\n observer.observe(element);\n\n return () => {\n observer.unobserve(element);\n updates.delete(subscription);\n };\n };\n\n handleResizeEntries = (entries: ResizeObserverEntry[]): void => {\n for (const entry of entries) {\n const targetSubscriptions = this.subscriptions.get(entry.target);\n // shouldn't really happen\n /* c8 ignore start */\n if (!targetSubscriptions) {\n continue;\n }\n /* c8 ignore stop */\n\n const entries = targetSubscriptions.values();\n for (const subscription of entries) {\n const { height, width } = entry.contentRect;\n const { scrollHeight, scrollWidth } = entry.target;\n const { onUpdate, size, disableHeight, disableWidth } = subscription;\n const isHeightChange =\n !disableHeight &&\n (!size ||\n size.height !== height ||\n size.scrollHeight !== scrollHeight);\n const isWidthChange =\n !disableWidth &&\n (!size || size.width !== width || size.scrollWidth !== scrollWidth);\n\n subscription.size = {\n height,\n width,\n scrollHeight,\n scrollWidth,\n };\n if (isHeightChange || isWidthChange) {\n onUpdate(entry);\n }\n }\n }\n };\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport const resizeObserverManager = new ResizeObserverManager();\n\n/**\n * @remarks\n * \\@since 2.3.0\n * \\@since 6.0.0 Renamed from `UseResizeObserverOptions` and added\n * `onUpdate`/`disabled` options.\n */\nexport interface ResizeObserverHookOptions<E extends HTMLElement> {\n /**\n * An optional ref to merge with the ref returned by this hook.\n */\n ref?: Ref<E>;\n\n /**\n * **Must be wrapped in `useCallback` to prevent re-creating the\n * ResizeObserver each render.**\n *\n * This function will be called whenever the target element resizes.\n *\n * @see {@link useResizeObserver} for an example.\n */\n onUpdate: ResizeObserverEntryCallback;\n\n /**\n * Set this to `true` to prevent observing the element's size changes. THis is\n * equivalent to not attaching the returned ref to any element.\n *\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Set this to `true` if the {@link onUpdate} should not be fired for height\n * changes.\n *\n * @defaultValue `false`\n */\n disableHeight?: boolean;\n\n /**\n * Set this to `true` if the {@link onUpdate} should not be fired for width\n * changes.\n *\n * @defaultValue `false`\n */\n disableWidth?: boolean;\n}\n\n/**\n * The resize observer is used to track the size changes of a specific element.\n * For most cases you can use the {@link useElementSize} instead, but this hook\n * can be used for more complex behavior with the {@link ResizeObserverEntry}.\n *\n * @remarks\n * \\@since 2.3.0\n * \\@since 6.0.0 The API was updated to match the `useIntersectionObserver`\n * implementation -- accepts only a single object parameter and returns a\n * {@link RefCallback} instead of `[nodeRef, refCallback]`\n */\nexport function useResizeObserver<E extends HTMLElement>(\n options: ResizeObserverHookOptions<E>\n): RefCallback<E> {\n const {\n ref,\n onUpdate,\n disabled,\n disableHeight = false,\n disableWidth = false,\n } = options;\n\n const [targetNodeRef, refCallback] = useEnsuredRef(ref);\n useEffect(() => {\n const element = targetNodeRef.current;\n if (disabled || (disableHeight && disableWidth) || !element) {\n return;\n }\n\n const unsubscribe = resizeObserverManager.subscribe({\n element,\n onUpdate,\n disableHeight,\n disableWidth,\n });\n\n return () => {\n unsubscribe();\n };\n }, [disableHeight, disableWidth, disabled, onUpdate, targetNodeRef]);\n\n return refCallback;\n}\n"],"names":["useEffect","useEnsuredRef","ResizeObserverManager","constructor","frame","subscriptions","sharedObserver","subscribe","options","element","onUpdate","disableHeight","disableWidth","observer","ResizeObserver","entries","window","cancelAnimationFrame","requestAnimationFrame","handleResizeEntries","updates","get","Set","subscription","add","has","set","observe","unobserve","delete","entry","targetSubscriptions","target","values","height","width","contentRect","scrollHeight","scrollWidth","size","isHeightChange","isWidthChange","Map","resizeObserverManager","useResizeObserver","ref","disabled","targetNodeRef","refCallback","current","unsubscribe"],"mappings":"AAAA;;;;;;;;;;;;;;AACA,SAASA,SAAS,QAAoC,QAAQ;AAC9D,SAASC,aAAa,QAAQ,qBAAqB;AAsCnD;;;;;;CAMC,GACD,OAAO,MAAMC;IAeXC,aAAc;QAddC,uBAAAA,SAAAA,KAAAA;QACAC,uBAAAA,iBAAAA,KAAAA;QAEA;;;;;;;;GAQC,GACDC,uBAAAA,kBAAAA,KAAAA;QAOAC,uBAAAA,aAAY,CAACC;YACX,MAAM,EAAEC,OAAO,EAAEC,QAAQ,EAAEC,aAAa,EAAEC,YAAY,EAAE,GAAGJ;YAE3D,+BAA+B;YAC/B,MAAMK,WACJ,IAAI,CAACP,cAAc,IACnB,IAAIQ,eAAe,CAACC;gBAClB,yDAAyD;gBACzDC,OAAOC,oBAAoB,CAAC,IAAI,CAACb,KAAK;gBACtC,IAAI,CAACA,KAAK,GAAGY,OAAOE,qBAAqB,CAAC;oBACxC,IAAI,CAACC,mBAAmB,CAACJ;gBAC3B;YACF;YACF,IAAI,CAACT,cAAc,GAAGO;YAEtB,MAAMO,UAAU,IAAI,CAACf,aAAa,CAACgB,GAAG,CAACZ,YAAY,IAAIa;YACvD,MAAMC,eAAmC;gBACvCb;gBACAC;gBACAC;YACF;YACAQ,QAAQI,GAAG,CAACD;YACZ,IAAI,CAAC,IAAI,CAAClB,aAAa,CAACoB,GAAG,CAAChB,UAAU;gBACpC,IAAI,CAACJ,aAAa,CAACqB,GAAG,CAACjB,SAASW;YAClC;YAEAP,SAASc,OAAO,CAAClB;YAEjB,OAAO;gBACLI,SAASe,SAAS,CAACnB;gBACnBW,QAAQS,MAAM,CAACN;YACjB;QACF;QAEAJ,uBAAAA,uBAAsB,CAACJ;YACrB,KAAK,MAAMe,SAASf,QAAS;gBAC3B,MAAMgB,sBAAsB,IAAI,CAAC1B,aAAa,CAACgB,GAAG,CAACS,MAAME,MAAM;gBAC/D,0BAA0B;gBAC1B,mBAAmB,GACnB,IAAI,CAACD,qBAAqB;oBACxB;gBACF;gBACA,kBAAkB,GAElB,MAAMhB,UAAUgB,oBAAoBE,MAAM;gBAC1C,KAAK,MAAMV,gBAAgBR,QAAS;oBAClC,MAAM,EAAEmB,MAAM,EAAEC,KAAK,EAAE,GAAGL,MAAMM,WAAW;oBAC3C,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAE,GAAGR,MAAME,MAAM;oBAClD,MAAM,EAAEtB,QAAQ,EAAE6B,IAAI,EAAE5B,aAAa,EAAEC,YAAY,EAAE,GAAGW;oBACxD,MAAMiB,iBACJ,CAAC7B,iBACA,CAAA,CAAC4B,QACAA,KAAKL,MAAM,KAAKA,UAChBK,KAAKF,YAAY,KAAKA,YAAW;oBACrC,MAAMI,gBACJ,CAAC7B,gBACA,CAAA,CAAC2B,QAAQA,KAAKJ,KAAK,KAAKA,SAASI,KAAKD,WAAW,KAAKA,WAAU;oBAEnEf,aAAagB,IAAI,GAAG;wBAClBL;wBACAC;wBACAE;wBACAC;oBACF;oBACA,IAAIE,kBAAkBC,eAAe;wBACnC/B,SAASoB;oBACX;gBACF;YACF;QACF;QAzEE,IAAI,CAAC1B,KAAK,GAAG;QACb,IAAI,CAACC,aAAa,GAAG,IAAIqC;IAC3B;AAwEF;AAEA;;;CAGC,GACD,OAAO,MAAMC,wBAAwB,IAAIzC,wBAAwB;AAiDjE;;;;;;;;;;CAUC,GACD,OAAO,SAAS0C,kBACdpC,OAAqC;IAErC,MAAM,EACJqC,GAAG,EACHnC,QAAQ,EACRoC,QAAQ,EACRnC,gBAAgB,KAAK,EACrBC,eAAe,KAAK,EACrB,GAAGJ;IAEJ,MAAM,CAACuC,eAAeC,YAAY,GAAG/C,cAAc4C;IACnD7C,UAAU;QACR,MAAMS,UAAUsC,cAAcE,OAAO;QACrC,IAAIH,YAAanC,iBAAiBC,gBAAiB,CAACH,SAAS;YAC3D;QACF;QAEA,MAAMyC,cAAcP,sBAAsBpC,SAAS,CAAC;YAClDE;YACAC;YACAC;YACAC;QACF;QAEA,OAAO;YACLsC;QACF;IACF,GAAG;QAACvC;QAAeC;QAAckC;QAAUpC;QAAUqC;KAAc;IAEnE,OAAOC;AACT"}
@@ -1,8 +1,8 @@
1
- import type { AnyFunction } from "./types.js";
1
+ import { type AnyFunction, type CancelableFunction } from "./types.js";
2
2
  /**
3
3
  * @remarks \@since 6.0.0
4
4
  */
5
- export type ThrottledFunction<F extends AnyFunction> = (...args: Parameters<F>) => ReturnType<F>;
5
+ export type ThrottledFunction<F extends AnyFunction> = CancelableFunction<(...args: Parameters<F>) => ReturnType<F>>;
6
6
  /**
7
7
  * Creates a function that will only be called once every X milliseconds.
8
8
  *
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { useCallback, useEffect, useRef } from "react";
2
+ import { useEffect, useMemo, useRef } from "react";
3
3
  import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
4
4
  /**
5
5
  * Creates a function that will only be called once every X milliseconds.
@@ -90,22 +90,26 @@ import { useIsomorphicLayoutEffect } from "./useIsomorphicLayoutEffect.js";
90
90
  window.clearTimeout(timeout.current);
91
91
  };
92
92
  }, []);
93
- return useCallback((...nextArgs)=>{
94
- args.current = nextArgs;
95
- const now = Date.now();
96
- const remaining = wait - (now - lastCalledTime.current);
97
- if (remaining <= 0 || remaining > wait) {
98
- lastCalledTime.current = now;
99
- result.current = funcRef.current(...args.current);
100
- } else if (!timeout.current) {
101
- timeout.current = window.setTimeout(()=>{
102
- lastCalledTime.current = Date.now();
103
- timeout.current = undefined;
104
- // should exist by this time
93
+ return useMemo(()=>{
94
+ const throttled = (...nextArgs)=>{
95
+ args.current = nextArgs;
96
+ const now = Date.now();
97
+ const remaining = wait - (now - lastCalledTime.current);
98
+ if (remaining <= 0 || remaining > wait) {
99
+ lastCalledTime.current = now;
105
100
  result.current = funcRef.current(...args.current);
106
- }, remaining);
107
- }
108
- return result.current;
101
+ } else if (!timeout.current) {
102
+ timeout.current = window.setTimeout(()=>{
103
+ lastCalledTime.current = Date.now();
104
+ timeout.current = undefined;
105
+ // should exist by this time
106
+ result.current = funcRef.current(...args.current);
107
+ }, remaining);
108
+ }
109
+ return result.current;
110
+ };
111
+ throttled.cancel = ()=>window.clearTimeout(timeout.current);
112
+ return throttled;
109
113
  }, [
110
114
  wait
111
115
  ]);
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useThrottledFunction.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport type { AnyFunction } from \"./types.js\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type ThrottledFunction<F extends AnyFunction> = (\n ...args: Parameters<F>\n) => ReturnType<F>;\n\n/**\n * Creates a function that will only be called once every X milliseconds.\n *\n * @example\n * Throttling Search API Requests\n * ```tsx\n * import { TextField, useThrottledFunction, useUnmounted } from \"@react-md/core\";\n * import { useState } from \"react\";\n * import type { ReactElement } from \"react\";\n *\n * interface State {\n * error?: unknown\n * loading: boolean;\n * results?: {\n * // pretend some search results\n * id: string;\n * name: string;\n * }[];\n * }\n *\n * function Example(): ReactElement {\n * const [state, setState] = useState<State>({\n * loading: false,\n * });\n * // this is only required for async actions\n * const unmounted = useUnmounted();\n *\n * // A new search request will be fired once every 500ms as the user types.\n * // can't use the event here since React uses synthetic events\n * const search = useThrottledFunction(async (q: string) => {\n * setState({\n * loading: true,\n * error: undefined,\n * results: undefined,\n * });\n *\n * try {\n * const response = await fetch('/search', {\n * method: 'POST',\n * headers: {\n * 'Content-Type': 'application/json',\n * },\n * body: JSON.stringify({ q }),\n * });\n * const json = await response.json();\n *\n * if (!unmounted.current) {\n * setState({\n * loading: false,\n * results: json,\n * });\n * }\n * } catch (error) {\n * if (!unmounted.current) {\n * setState({\n * error,\n * loading: false,\n * });\n * }\n * }\n * }, 500);\n *\n * return (\n * <TextField\n * type=\"search\"\n * label=\"Search\"\n * onChange={(event) => search(event.currentTarget.value)}\n * />\n * );\n * }\n * ```\n *\n * @see `useDebouncedFunction` for debounce behavior instead. (Call a\n * function only if it has not been called again for X milliseconds).\n * @remarks \\@since 6.0.0\n */\nexport function useThrottledFunction<F extends AnyFunction>(\n func: F,\n wait: number\n): ThrottledFunction<F> {\n const args = useRef<Parameters<F>>();\n const result = useRef<ReturnType<F>>();\n const timeout = useRef<number | undefined>();\n const funcRef = useRef(func);\n const lastCalledTime = useRef(0);\n\n useIsomorphicLayoutEffect(() => {\n funcRef.current = func;\n });\n\n useEffect(() => {\n return () => {\n window.clearTimeout(timeout.current);\n };\n }, []);\n\n return useCallback(\n (...nextArgs) => {\n args.current = nextArgs;\n\n const now = Date.now();\n const remaining = wait - (now - lastCalledTime.current);\n if (remaining <= 0 || remaining > wait) {\n lastCalledTime.current = now;\n result.current = funcRef.current(...args.current);\n } else if (!timeout.current) {\n timeout.current = window.setTimeout(() => {\n lastCalledTime.current = Date.now();\n timeout.current = undefined;\n // should exist by this time\n result.current = funcRef.current(...(args.current as Parameters<F>));\n }, remaining);\n }\n\n return result.current as ReturnType<F>;\n },\n [wait]\n );\n}\n"],"names":["useCallback","useEffect","useRef","useIsomorphicLayoutEffect","useThrottledFunction","func","wait","args","result","timeout","funcRef","lastCalledTime","current","window","clearTimeout","nextArgs","now","Date","remaining","setTimeout","undefined"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ,QAAQ;AAEvD,SAASC,yBAAyB,QAAQ,iCAAiC;AAS3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EC,GACD,OAAO,SAASC,qBACdC,IAAO,EACPC,IAAY;IAEZ,MAAMC,OAAOL;IACb,MAAMM,SAASN;IACf,MAAMO,UAAUP;IAChB,MAAMQ,UAAUR,OAAOG;IACvB,MAAMM,iBAAiBT,OAAO;IAE9BC,0BAA0B;QACxBO,QAAQE,OAAO,GAAGP;IACpB;IAEAJ,UAAU;QACR,OAAO;YACLY,OAAOC,YAAY,CAACL,QAAQG,OAAO;QACrC;IACF,GAAG,EAAE;IAEL,OAAOZ,YACL,CAAC,GAAGe;QACFR,KAAKK,OAAO,GAAGG;QAEf,MAAMC,MAAMC,KAAKD,GAAG;QACpB,MAAME,YAAYZ,OAAQU,CAAAA,MAAML,eAAeC,OAAO,AAAD;QACrD,IAAIM,aAAa,KAAKA,YAAYZ,MAAM;YACtCK,eAAeC,OAAO,GAAGI;YACzBR,OAAOI,OAAO,GAAGF,QAAQE,OAAO,IAAIL,KAAKK,OAAO;QAClD,OAAO,IAAI,CAACH,QAAQG,OAAO,EAAE;YAC3BH,QAAQG,OAAO,GAAGC,OAAOM,UAAU,CAAC;gBAClCR,eAAeC,OAAO,GAAGK,KAAKD,GAAG;gBACjCP,QAAQG,OAAO,GAAGQ;gBAClB,4BAA4B;gBAC5BZ,OAAOI,OAAO,GAAGF,QAAQE,OAAO,IAAKL,KAAKK,OAAO;YACnD,GAAGM;QACL;QAEA,OAAOV,OAAOI,OAAO;IACvB,GACA;QAACN;KAAK;AAEV"}
1
+ {"version":3,"sources":["../src/useThrottledFunction.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useMemo, useRef } from \"react\";\nimport { type AnyFunction, type CancelableFunction } from \"./types.js\";\nimport { useIsomorphicLayoutEffect } from \"./useIsomorphicLayoutEffect.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport type ThrottledFunction<F extends AnyFunction> = CancelableFunction<\n (...args: Parameters<F>) => ReturnType<F>\n>;\n\n/**\n * Creates a function that will only be called once every X milliseconds.\n *\n * @example\n * Throttling Search API Requests\n * ```tsx\n * import { TextField, useThrottledFunction, useUnmounted } from \"@react-md/core\";\n * import { useState } from \"react\";\n * import type { ReactElement } from \"react\";\n *\n * interface State {\n * error?: unknown\n * loading: boolean;\n * results?: {\n * // pretend some search results\n * id: string;\n * name: string;\n * }[];\n * }\n *\n * function Example(): ReactElement {\n * const [state, setState] = useState<State>({\n * loading: false,\n * });\n * // this is only required for async actions\n * const unmounted = useUnmounted();\n *\n * // A new search request will be fired once every 500ms as the user types.\n * // can't use the event here since React uses synthetic events\n * const search = useThrottledFunction(async (q: string) => {\n * setState({\n * loading: true,\n * error: undefined,\n * results: undefined,\n * });\n *\n * try {\n * const response = await fetch('/search', {\n * method: 'POST',\n * headers: {\n * 'Content-Type': 'application/json',\n * },\n * body: JSON.stringify({ q }),\n * });\n * const json = await response.json();\n *\n * if (!unmounted.current) {\n * setState({\n * loading: false,\n * results: json,\n * });\n * }\n * } catch (error) {\n * if (!unmounted.current) {\n * setState({\n * error,\n * loading: false,\n * });\n * }\n * }\n * }, 500);\n *\n * return (\n * <TextField\n * type=\"search\"\n * label=\"Search\"\n * onChange={(event) => search(event.currentTarget.value)}\n * />\n * );\n * }\n * ```\n *\n * @see `useDebouncedFunction` for debounce behavior instead. (Call a\n * function only if it has not been called again for X milliseconds).\n * @remarks \\@since 6.0.0\n */\nexport function useThrottledFunction<F extends AnyFunction>(\n func: F,\n wait: number\n): ThrottledFunction<F> {\n const args = useRef<Parameters<F>>();\n const result = useRef<ReturnType<F>>();\n const timeout = useRef<number | undefined>();\n const funcRef = useRef(func);\n const lastCalledTime = useRef(0);\n\n useIsomorphicLayoutEffect(() => {\n funcRef.current = func;\n });\n\n useEffect(() => {\n return () => {\n window.clearTimeout(timeout.current);\n };\n }, []);\n\n return useMemo(() => {\n const throttled: ThrottledFunction<F> = (...nextArgs) => {\n args.current = nextArgs;\n\n const now = Date.now();\n const remaining = wait - (now - lastCalledTime.current);\n if (remaining <= 0 || remaining > wait) {\n lastCalledTime.current = now;\n result.current = funcRef.current(...args.current);\n } else if (!timeout.current) {\n timeout.current = window.setTimeout(() => {\n lastCalledTime.current = Date.now();\n timeout.current = undefined;\n // should exist by this time\n result.current = funcRef.current(...(args.current as Parameters<F>));\n }, remaining);\n }\n\n return result.current as ReturnType<F>;\n };\n throttled.cancel = () => window.clearTimeout(timeout.current);\n\n return throttled;\n }, [wait]);\n}\n"],"names":["useEffect","useMemo","useRef","useIsomorphicLayoutEffect","useThrottledFunction","func","wait","args","result","timeout","funcRef","lastCalledTime","current","window","clearTimeout","throttled","nextArgs","now","Date","remaining","setTimeout","undefined","cancel"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,QAAQ;AAEnD,SAASC,yBAAyB,QAAQ,iCAAiC;AAS3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2EC,GACD,OAAO,SAASC,qBACdC,IAAO,EACPC,IAAY;IAEZ,MAAMC,OAAOL;IACb,MAAMM,SAASN;IACf,MAAMO,UAAUP;IAChB,MAAMQ,UAAUR,OAAOG;IACvB,MAAMM,iBAAiBT,OAAO;IAE9BC,0BAA0B;QACxBO,QAAQE,OAAO,GAAGP;IACpB;IAEAL,UAAU;QACR,OAAO;YACLa,OAAOC,YAAY,CAACL,QAAQG,OAAO;QACrC;IACF,GAAG,EAAE;IAEL,OAAOX,QAAQ;QACb,MAAMc,YAAkC,CAAC,GAAGC;YAC1CT,KAAKK,OAAO,GAAGI;YAEf,MAAMC,MAAMC,KAAKD,GAAG;YACpB,MAAME,YAAYb,OAAQW,CAAAA,MAAMN,eAAeC,OAAO,AAAD;YACrD,IAAIO,aAAa,KAAKA,YAAYb,MAAM;gBACtCK,eAAeC,OAAO,GAAGK;gBACzBT,OAAOI,OAAO,GAAGF,QAAQE,OAAO,IAAIL,KAAKK,OAAO;YAClD,OAAO,IAAI,CAACH,QAAQG,OAAO,EAAE;gBAC3BH,QAAQG,OAAO,GAAGC,OAAOO,UAAU,CAAC;oBAClCT,eAAeC,OAAO,GAAGM,KAAKD,GAAG;oBACjCR,QAAQG,OAAO,GAAGS;oBAClB,4BAA4B;oBAC5Bb,OAAOI,OAAO,GAAGF,QAAQE,OAAO,IAAKL,KAAKK,OAAO;gBACnD,GAAGO;YACL;YAEA,OAAOX,OAAOI,OAAO;QACvB;QACAG,UAAUO,MAAM,GAAG,IAAMT,OAAOC,YAAY,CAACL,QAAQG,OAAO;QAE5D,OAAOG;IACT,GAAG;QAACT;KAAK;AACX"}
@@ -1,18 +1,21 @@
1
+ import { type ElementSize } from "./types.js";
2
+ import { type ResizeListenerOptions } from "./useResizeListener.js";
1
3
  /**
2
4
  * @remarks \@since 6.0.0
3
5
  */
4
- export interface WindowSize {
5
- height: number;
6
- width: number;
7
- }
8
- /**
9
- * @remarks \@since 6.0.0
10
- */
11
- export interface WindowSizeOptions extends AddEventListenerOptions {
6
+ export interface WindowSizeOptions extends Omit<ResizeListenerOptions, "disabled" | "onUpdate"> {
12
7
  /**
13
- * @defaultValue `true`
8
+ * The default value to use in SSR environments for the window's height.
9
+ *
10
+ * @defaultValue `0`
11
+ */
12
+ ssrHeight?: number;
13
+ /**
14
+ * The default value to use in SSR environments for the window's width.
15
+ *
16
+ * @defaultValue `0`
14
17
  */
15
- throttle?: boolean;
18
+ ssrWidth?: number;
16
19
  /**
17
20
  * Set this to `true` to ignore resize events that only updated the height.
18
21
  * The hook can be disabled by setting this and {@link disableWidth} to
@@ -54,4 +57,4 @@ export interface WindowSizeOptions extends AddEventListenerOptions {
54
57
  *
55
58
  * @remarks \@since 6.0.0
56
59
  */
57
- export declare function useWindowSize(options?: WindowSizeOptions): WindowSize;
60
+ export declare function useWindowSize(options?: WindowSizeOptions): ElementSize;
@@ -1,5 +1,6 @@
1
1
  "use client";
2
- import { useState } from "react";
2
+ import { useCallback, useState } from "react";
3
+ import { useSsr } from "./SsrProvider.js";
3
4
  import { useResizeListener } from "./useResizeListener.js";
4
5
  /**
5
6
  * This is just a convenience wrapper around the {@link useResizeListener}.
@@ -25,12 +26,13 @@ import { useResizeListener } from "./useResizeListener.js";
25
26
  *
26
27
  * @remarks \@since 6.0.0
27
28
  */ export function useWindowSize(options = {}) {
28
- const { once, signal, capture, passive, throttle, disableWidth, disableHeight } = options;
29
+ const { once, signal, capture, passive, throttle, ssrHeight = 0, ssrWidth = 0, disableWidth, disableHeight } = options;
30
+ const ssr = useSsr();
29
31
  const [size, setSize] = useState(()=>{
30
- if (typeof window === "undefined") {
32
+ if (typeof window === "undefined" || ssr) {
31
33
  return {
32
- height: 0,
33
- width: 0
34
+ height: ssrHeight,
35
+ width: ssrWidth
34
36
  };
35
37
  }
36
38
  return {
@@ -45,7 +47,7 @@ import { useResizeListener } from "./useResizeListener.js";
45
47
  passive,
46
48
  throttle,
47
49
  disabled: disableHeight && disableWidth,
48
- onUpdate () {
50
+ onUpdate: useCallback(()=>{
49
51
  setSize((prevSize)=>{
50
52
  const nextSize = {
51
53
  height: window.innerHeight,
@@ -55,7 +57,10 @@ import { useResizeListener } from "./useResizeListener.js";
55
57
  const isWidthChange = !disableWidth && prevSize.width !== nextSize.width;
56
58
  return isHeightChange || isWidthChange ? nextSize : prevSize;
57
59
  });
58
- }
60
+ }, [
61
+ disableHeight,
62
+ disableWidth
63
+ ])
59
64
  });
60
65
  return size;
61
66
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/useWindowSize.ts"],"sourcesContent":["\"use client\";\nimport { useState } from \"react\";\nimport { useResizeListener } from \"./useResizeListener.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface WindowSize {\n height: number;\n width: number;\n}\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface WindowSizeOptions extends AddEventListenerOptions {\n /**\n * @defaultValue `true`\n */\n throttle?: boolean;\n\n /**\n * Set this to `true` to ignore resize events that only updated the height.\n * The hook can be disabled by setting this and {@link disableWidth} to\n * `true`.\n *\n * @defaultValue `false`\n */\n disableHeight?: boolean;\n\n /**\n * Set this to `true` to ignore resize events that only updated the width.\n * The hook can be disabled by setting this and {@link disableHeight} to\n * `true`.\n *\n * @defaultValue `false`\n */\n disableWidth?: boolean;\n}\n\n/**\n * This is just a convenience wrapper around the {@link useResizeListener}.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { useWindowSize } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const { height, width } = useWindowSize();\n *\n * return (\n * <>\n * The current window size:\n * <pre><code>{JSON.stringify(size, null, 2)}</code></pre>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useWindowSize(options: WindowSizeOptions = {}): WindowSize {\n const {\n once,\n signal,\n capture,\n passive,\n throttle,\n disableWidth,\n disableHeight,\n } = options;\n\n const [size, setSize] = useState(() => {\n if (typeof window === \"undefined\") {\n return {\n height: 0,\n width: 0,\n };\n }\n\n return {\n height: window.innerHeight,\n width: window.innerWidth,\n };\n });\n\n useResizeListener({\n once,\n signal,\n capture,\n passive,\n throttle,\n disabled: disableHeight && disableWidth,\n onUpdate() {\n setSize((prevSize) => {\n const nextSize: WindowSize = {\n height: window.innerHeight,\n width: window.innerWidth,\n };\n\n const isHeightChange =\n !disableHeight && prevSize.height !== nextSize.height;\n const isWidthChange =\n !disableWidth && prevSize.width !== nextSize.width;\n\n return isHeightChange || isWidthChange ? nextSize : prevSize;\n });\n },\n });\n\n return size;\n}\n"],"names":["useState","useResizeListener","useWindowSize","options","once","signal","capture","passive","throttle","disableWidth","disableHeight","size","setSize","window","height","width","innerHeight","innerWidth","disabled","onUpdate","prevSize","nextSize","isHeightChange","isWidthChange"],"mappings":"AAAA;AACA,SAASA,QAAQ,QAAQ,QAAQ;AACjC,SAASC,iBAAiB,QAAQ,yBAAyB;AAsC3D;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASC,cAAcC,UAA6B,CAAC,CAAC;IAC3D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,YAAY,EACZC,aAAa,EACd,GAAGP;IAEJ,MAAM,CAACQ,MAAMC,QAAQ,GAAGZ,SAAS;QAC/B,IAAI,OAAOa,WAAW,aAAa;YACjC,OAAO;gBACLC,QAAQ;gBACRC,OAAO;YACT;QACF;QAEA,OAAO;YACLD,QAAQD,OAAOG,WAAW;YAC1BD,OAAOF,OAAOI,UAAU;QAC1B;IACF;IAEAhB,kBAAkB;QAChBG;QACAC;QACAC;QACAC;QACAC;QACAU,UAAUR,iBAAiBD;QAC3BU;YACEP,QAAQ,CAACQ;gBACP,MAAMC,WAAuB;oBAC3BP,QAAQD,OAAOG,WAAW;oBAC1BD,OAAOF,OAAOI,UAAU;gBAC1B;gBAEA,MAAMK,iBACJ,CAACZ,iBAAiBU,SAASN,MAAM,KAAKO,SAASP,MAAM;gBACvD,MAAMS,gBACJ,CAACd,gBAAgBW,SAASL,KAAK,KAAKM,SAASN,KAAK;gBAEpD,OAAOO,kBAAkBC,gBAAgBF,WAAWD;YACtD;QACF;IACF;IAEA,OAAOT;AACT"}
1
+ {"version":3,"sources":["../src/useWindowSize.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useState } from \"react\";\nimport { useSsr } from \"./SsrProvider.js\";\nimport { type ElementSize } from \"./types.js\";\nimport {\n useResizeListener,\n type ResizeListenerOptions,\n} from \"./useResizeListener.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface WindowSizeOptions\n extends Omit<ResizeListenerOptions, \"disabled\" | \"onUpdate\"> {\n /**\n * The default value to use in SSR environments for the window's height.\n *\n * @defaultValue `0`\n */\n ssrHeight?: number;\n\n /**\n * The default value to use in SSR environments for the window's width.\n *\n * @defaultValue `0`\n */\n ssrWidth?: number;\n\n /**\n * Set this to `true` to ignore resize events that only updated the height.\n * The hook can be disabled by setting this and {@link disableWidth} to\n * `true`.\n *\n * @defaultValue `false`\n */\n disableHeight?: boolean;\n\n /**\n * Set this to `true` to ignore resize events that only updated the width.\n * The hook can be disabled by setting this and {@link disableHeight} to\n * `true`.\n *\n * @defaultValue `false`\n */\n disableWidth?: boolean;\n}\n\n/**\n * This is just a convenience wrapper around the {@link useResizeListener}.\n *\n * @example\n * Simple Example\n * ```tsx\n * import { useWindowSize } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n * import { useState } from \"react\";\n *\n * function Example(): ReactElement {\n * const { height, width } = useWindowSize();\n *\n * return (\n * <>\n * The current window size:\n * <pre><code>{JSON.stringify(size, null, 2)}</code></pre>\n * </>\n * );\n * }\n * ```\n *\n * @remarks \\@since 6.0.0\n */\nexport function useWindowSize(options: WindowSizeOptions = {}): ElementSize {\n const {\n once,\n signal,\n capture,\n passive,\n throttle,\n ssrHeight = 0,\n ssrWidth = 0,\n disableWidth,\n disableHeight,\n } = options;\n\n const ssr = useSsr();\n const [size, setSize] = useState(() => {\n if (typeof window === \"undefined\" || ssr) {\n return {\n height: ssrHeight,\n width: ssrWidth,\n };\n }\n\n return {\n height: window.innerHeight,\n width: window.innerWidth,\n };\n });\n\n useResizeListener({\n once,\n signal,\n capture,\n passive,\n throttle,\n disabled: disableHeight && disableWidth,\n onUpdate: useCallback(() => {\n setSize((prevSize) => {\n const nextSize: ElementSize = {\n height: window.innerHeight,\n width: window.innerWidth,\n };\n\n const isHeightChange =\n !disableHeight && prevSize.height !== nextSize.height;\n const isWidthChange =\n !disableWidth && prevSize.width !== nextSize.width;\n\n return isHeightChange || isWidthChange ? nextSize : prevSize;\n });\n }, [disableHeight, disableWidth]),\n });\n\n return size;\n}\n"],"names":["useCallback","useState","useSsr","useResizeListener","useWindowSize","options","once","signal","capture","passive","throttle","ssrHeight","ssrWidth","disableWidth","disableHeight","ssr","size","setSize","window","height","width","innerHeight","innerWidth","disabled","onUpdate","prevSize","nextSize","isHeightChange","isWidthChange"],"mappings":"AAAA;AACA,SAASA,WAAW,EAAEC,QAAQ,QAAQ,QAAQ;AAC9C,SAASC,MAAM,QAAQ,mBAAmB;AAE1C,SACEC,iBAAiB,QAEZ,yBAAyB;AAwChC;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASC,cAAcC,UAA6B,CAAC,CAAC;IAC3D,MAAM,EACJC,IAAI,EACJC,MAAM,EACNC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,YAAY,CAAC,EACbC,WAAW,CAAC,EACZC,YAAY,EACZC,aAAa,EACd,GAAGT;IAEJ,MAAMU,MAAMb;IACZ,MAAM,CAACc,MAAMC,QAAQ,GAAGhB,SAAS;QAC/B,IAAI,OAAOiB,WAAW,eAAeH,KAAK;YACxC,OAAO;gBACLI,QAAQR;gBACRS,OAAOR;YACT;QACF;QAEA,OAAO;YACLO,QAAQD,OAAOG,WAAW;YAC1BD,OAAOF,OAAOI,UAAU;QAC1B;IACF;IAEAnB,kBAAkB;QAChBG;QACAC;QACAC;QACAC;QACAC;QACAa,UAAUT,iBAAiBD;QAC3BW,UAAUxB,YAAY;YACpBiB,QAAQ,CAACQ;gBACP,MAAMC,WAAwB;oBAC5BP,QAAQD,OAAOG,WAAW;oBAC1BD,OAAOF,OAAOI,UAAU;gBAC1B;gBAEA,MAAMK,iBACJ,CAACb,iBAAiBW,SAASN,MAAM,KAAKO,SAASP,MAAM;gBACvD,MAAMS,gBACJ,CAACf,gBAAgBY,SAASL,KAAK,KAAKM,SAASN,KAAK;gBAEpD,OAAOO,kBAAkBC,gBAAgBF,WAAWD;YACtD;QACF,GAAG;YAACX;YAAeD;SAAa;IAClC;IAEA,OAAOG;AACT"}
@@ -1,4 +1,4 @@
1
- import type { TextExtractor } from "../types.js";
1
+ import { type TextExtractor } from "../types.js";
2
2
  /**
3
3
  * The default `Intl.Collator` that should be used for sorting large lists.
4
4
  *
@@ -1,12 +1,4 @@
1
- const identity = (item)=>{
2
- if (typeof item === "string") {
3
- return item;
4
- }
5
- if (process.env.NODE_ENV !== "production") {
6
- throw new Error("A `TextExtractor` must be provided to `alphaNumericSort` for lists that do not contain strings");
7
- }
8
- return "";
9
- };
1
+ import { defaultExtractor } from "../searching/utils.js";
10
2
  /**
11
3
  * The default `Intl.Collator` that should be used for sorting large lists.
12
4
  *
@@ -17,7 +9,7 @@ const identity = (item)=>{
17
9
  caseFirst: "upper"
18
10
  });
19
11
  export function alphaNumericSort(list, options = {}) {
20
- const { compare = DEFAULT_COLLATOR.compare, extractor = identity, descending = false } = options;
12
+ const { compare = DEFAULT_COLLATOR.compare, extractor = defaultExtractor("alphaNumericSort"), descending = false } = options;
21
13
  const sorted = list.slice();
22
14
  sorted.sort((a, b)=>{
23
15
  const aValue = extractor(a);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/utils/alphaNumericSort.ts"],"sourcesContent":["import type { TextExtractor } from \"../types.js\";\n\nconst identity = <T>(item: T): string => {\n if (typeof item === \"string\") {\n return item;\n }\n\n if (process.env.NODE_ENV !== \"production\") {\n throw new Error(\n \"A `TextExtractor` must be provided to `alphaNumericSort` for lists that do not contain strings\"\n );\n }\n\n return \"\";\n};\n\n/**\n * The default `Intl.Collator` that should be used for sorting large lists.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#performance\n * @remarks \\@since 6.0.0\n */\nexport const DEFAULT_COLLATOR = new Intl.Collator(\"en-US\", {\n numeric: true,\n caseFirst: \"upper\",\n});\n\n/** @remarks \\@since 6.0.0 */\nexport interface AlphaNumericSortOptions<T> {\n /**\n * The extractor is only required when the list of items are not strings.\n *\n * @example\n * Simple Example\n * ```ts\n * interface Item {\n * name: string;\n * }\n *\n * const items: Item[] = [{ name: 'Hello' }, { name: 'World' }];\n *\n * `alphaNumericSort(items, {\n * extractor: item => item.name,\n * })`\n * ```\n *\n * @remarks\n * For javascript developers, this will throw an error in dev mode if an\n * extractor is not provided for non-string lists.\n *\n * @defaultValue `typeof item === \"string\" ? item : \"\"`\n */\n extractor?: TextExtractor<T>;\n\n /**\n * A custom compare function for sorting the list. This should really only be\n * provided if the language for your app is not `\"en-US\"` or you'd like to\n * provide some custom sorting options.\n *\n * @example\n * Custom Compare using Intl.Collator\n * ```ts\n * const collator = new Intl.Collator(\"en-US\", {\n * numeric: false,\n * caseFirst: \"lower\",\n * usage: \"search\",\n * });\n *\n * alphaNumericSort(items, {\n * compare: collator.compare,\n * })\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator\n * @defaultValue `new Intl.Collator(\"en-US\", { numeric: true, caseFirst: \"upper\" }).compare`\n */\n compare?(a: string, b: string): number;\n\n /**\n * Setting this to `true` will return the list in descending order instead of\n * ascending.\n *\n * @defaultValue `false`\n */\n descending?: boolean;\n}\n\n/**\n * @example\n * Simple Example\n * ```ts\n * const items = [\"World\", \"Hello\"];\n *\n * const sorted = alphaNumericSort(items);\n * // sorted == [\"Hello\", \"World\"]\n * ```\n *\n * @param list - The list of strings to sort\n * @returns a new sorted list\n */\nexport function alphaNumericSort<T extends string>(\n list: readonly T[],\n options?: Omit<AlphaNumericSortOptions<T>, \"extractor\">\n): readonly T[];\n/**\n * @example\n * Simple Example\n * ```ts\n * interface Item {\n * name: string;\n * }\n *\n * const items: Item[] = [{ name: \"World\" }, { name: \"Hello\" }];\n *\n * const sorted = alphaNumericSort(items, {\n * extractor: item => item.name,\n * });\n * // sorted == [{ name: \"Hello\" }, { name: \"World\" }]\n * ```\n *\n * @param list - The list of items to sort\n * @returns a new sorted list\n */\nexport function alphaNumericSort<T>(\n list: readonly T[],\n options: AlphaNumericSortOptions<T> & { extractor: TextExtractor<T> }\n): readonly T[];\nexport function alphaNumericSort<T>(\n list: readonly T[],\n options: AlphaNumericSortOptions<T> = {}\n): readonly T[] {\n const {\n compare = DEFAULT_COLLATOR.compare,\n extractor = identity,\n descending = false,\n } = options;\n\n const sorted = list.slice();\n sorted.sort((a, b) => {\n const aValue = extractor(a);\n const bValue = extractor(b);\n\n const value1 = descending ? bValue : aValue;\n const value2 = descending ? aValue : bValue;\n\n return compare(value1, value2);\n });\n\n return sorted;\n}\n"],"names":["identity","item","process","env","NODE_ENV","Error","DEFAULT_COLLATOR","Intl","Collator","numeric","caseFirst","alphaNumericSort","list","options","compare","extractor","descending","sorted","slice","sort","a","b","aValue","bValue","value1","value2"],"mappings":"AAEA,MAAMA,WAAW,CAAIC;IACnB,IAAI,OAAOA,SAAS,UAAU;QAC5B,OAAOA;IACT;IAEA,IAAIC,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,MAAM,IAAIC,MACR;IAEJ;IAEA,OAAO;AACT;AAEA;;;;;CAKC,GACD,OAAO,MAAMC,mBAAmB,IAAIC,KAAKC,QAAQ,CAAC,SAAS;IACzDC,SAAS;IACTC,WAAW;AACb,GAAG;AAsGH,OAAO,SAASC,iBACdC,IAAkB,EAClBC,UAAsC,CAAC,CAAC;IAExC,MAAM,EACJC,UAAUR,iBAAiBQ,OAAO,EAClCC,YAAYf,QAAQ,EACpBgB,aAAa,KAAK,EACnB,GAAGH;IAEJ,MAAMI,SAASL,KAAKM,KAAK;IACzBD,OAAOE,IAAI,CAAC,CAACC,GAAGC;QACd,MAAMC,SAASP,UAAUK;QACzB,MAAMG,SAASR,UAAUM;QAEzB,MAAMG,SAASR,aAAaO,SAASD;QACrC,MAAMG,SAAST,aAAaM,SAASC;QAErC,OAAOT,QAAQU,QAAQC;IACzB;IAEA,OAAOR;AACT"}
1
+ {"version":3,"sources":["../../src/utils/alphaNumericSort.ts"],"sourcesContent":["import { defaultExtractor } from \"../searching/utils.js\";\nimport { type TextExtractor } from \"../types.js\";\n\n/**\n * The default `Intl.Collator` that should be used for sorting large lists.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare#performance\n * @remarks \\@since 6.0.0\n */\nexport const DEFAULT_COLLATOR = new Intl.Collator(\"en-US\", {\n numeric: true,\n caseFirst: \"upper\",\n});\n\n/** @remarks \\@since 6.0.0 */\nexport interface AlphaNumericSortOptions<T> {\n /**\n * The extractor is only required when the list of items are not strings.\n *\n * @example\n * Simple Example\n * ```ts\n * interface Item {\n * name: string;\n * }\n *\n * const items: Item[] = [{ name: 'Hello' }, { name: 'World' }];\n *\n * `alphaNumericSort(items, {\n * extractor: item => item.name,\n * })`\n * ```\n *\n * @remarks\n * For javascript developers, this will throw an error in dev mode if an\n * extractor is not provided for non-string lists.\n *\n * @defaultValue `typeof item === \"string\" ? item : \"\"`\n */\n extractor?: TextExtractor<T>;\n\n /**\n * A custom compare function for sorting the list. This should really only be\n * provided if the language for your app is not `\"en-US\"` or you'd like to\n * provide some custom sorting options.\n *\n * @example\n * Custom Compare using Intl.Collator\n * ```ts\n * const collator = new Intl.Collator(\"en-US\", {\n * numeric: false,\n * caseFirst: \"lower\",\n * usage: \"search\",\n * });\n *\n * alphaNumericSort(items, {\n * compare: collator.compare,\n * })\n * ```\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Collator/Collator\n * @defaultValue `new Intl.Collator(\"en-US\", { numeric: true, caseFirst: \"upper\" }).compare`\n */\n compare?(a: string, b: string): number;\n\n /**\n * Setting this to `true` will return the list in descending order instead of\n * ascending.\n *\n * @defaultValue `false`\n */\n descending?: boolean;\n}\n\n/**\n * @example\n * Simple Example\n * ```ts\n * const items = [\"World\", \"Hello\"];\n *\n * const sorted = alphaNumericSort(items);\n * // sorted == [\"Hello\", \"World\"]\n * ```\n *\n * @param list - The list of strings to sort\n * @returns a new sorted list\n */\nexport function alphaNumericSort<T extends string>(\n list: readonly T[],\n options?: Omit<AlphaNumericSortOptions<T>, \"extractor\">\n): readonly T[];\n/**\n * @example\n * Simple Example\n * ```ts\n * interface Item {\n * name: string;\n * }\n *\n * const items: Item[] = [{ name: \"World\" }, { name: \"Hello\" }];\n *\n * const sorted = alphaNumericSort(items, {\n * extractor: item => item.name,\n * });\n * // sorted == [{ name: \"Hello\" }, { name: \"World\" }]\n * ```\n *\n * @param list - The list of items to sort\n * @returns a new sorted list\n */\nexport function alphaNumericSort<T>(\n list: readonly T[],\n options: AlphaNumericSortOptions<T> & { extractor: TextExtractor<T> }\n): readonly T[];\nexport function alphaNumericSort<T>(\n list: readonly T[],\n options: AlphaNumericSortOptions<T> = {}\n): readonly T[] {\n const {\n compare = DEFAULT_COLLATOR.compare,\n extractor = defaultExtractor(\"alphaNumericSort\"),\n descending = false,\n } = options;\n\n const sorted = list.slice();\n sorted.sort((a, b) => {\n const aValue = extractor(a);\n const bValue = extractor(b);\n\n const value1 = descending ? bValue : aValue;\n const value2 = descending ? aValue : bValue;\n\n return compare(value1, value2);\n });\n\n return sorted;\n}\n"],"names":["defaultExtractor","DEFAULT_COLLATOR","Intl","Collator","numeric","caseFirst","alphaNumericSort","list","options","compare","extractor","descending","sorted","slice","sort","a","b","aValue","bValue","value1","value2"],"mappings":"AAAA,SAASA,gBAAgB,QAAQ,wBAAwB;AAGzD;;;;;CAKC,GACD,OAAO,MAAMC,mBAAmB,IAAIC,KAAKC,QAAQ,CAAC,SAAS;IACzDC,SAAS;IACTC,WAAW;AACb,GAAG;AAsGH,OAAO,SAASC,iBACdC,IAAkB,EAClBC,UAAsC,CAAC,CAAC;IAExC,MAAM,EACJC,UAAUR,iBAAiBQ,OAAO,EAClCC,YAAYV,iBAAiB,mBAAmB,EAChDW,aAAa,KAAK,EACnB,GAAGH;IAEJ,MAAMI,SAASL,KAAKM,KAAK;IACzBD,OAAOE,IAAI,CAAC,CAACC,GAAGC;QACd,MAAMC,SAASP,UAAUK;QACzB,MAAMG,SAASR,UAAUM;QAEzB,MAAMG,SAASR,aAAaO,SAASD;QACrC,MAAMG,SAAST,aAAaM,SAASC;QAErC,OAAOT,QAAQU,QAAQC;IACzB;IAEA,OAAOR;AACT"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @remarks \@since 6.0.0
3
+ */
4
+ export interface GetMiddleOfRangeOptions {
5
+ min: number;
6
+ max: number;
7
+ step: number;
8
+ }
9
+ /**
10
+ * @internal
11
+ * @remarks \@since 6.0.0
12
+ */
13
+ export declare function getMiddleOfRange(options: GetMiddleOfRangeOptions): number;
@@ -0,0 +1,20 @@
1
+ import { getRangeSteps } from "./getRangeSteps.js";
2
+ import { nearest } from "./nearest.js";
3
+ /**
4
+ * @internal
5
+ * @remarks \@since 6.0.0
6
+ */ export function getMiddleOfRange(options) {
7
+ const { min, max, step } = options;
8
+ return nearest({
9
+ min,
10
+ max,
11
+ steps: getRangeSteps({
12
+ min,
13
+ max,
14
+ step
15
+ }),
16
+ value: (max - min) / 2 + min
17
+ });
18
+ }
19
+
20
+ //# sourceMappingURL=getMiddleOfRange.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/getMiddleOfRange.ts"],"sourcesContent":["import { getRangeSteps } from \"./getRangeSteps.js\";\nimport { nearest } from \"./nearest.js\";\n\n/**\n * @remarks \\@since 6.0.0\n */\nexport interface GetMiddleOfRangeOptions {\n min: number;\n max: number;\n step: number;\n}\n\n/**\n * @internal\n * @remarks \\@since 6.0.0\n */\nexport function getMiddleOfRange(options: GetMiddleOfRangeOptions): number {\n const { min, max, step } = options;\n\n return nearest({\n min,\n max,\n steps: getRangeSteps({ min, max, step }),\n value: (max - min) / 2 + min,\n });\n}\n"],"names":["getRangeSteps","nearest","getMiddleOfRange","options","min","max","step","steps","value"],"mappings":"AAAA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,OAAO,QAAQ,eAAe;AAWvC;;;CAGC,GACD,OAAO,SAASC,iBAAiBC,OAAgC;IAC/D,MAAM,EAAEC,GAAG,EAAEC,GAAG,EAAEC,IAAI,EAAE,GAAGH;IAE3B,OAAOF,QAAQ;QACbG;QACAC;QACAE,OAAOP,cAAc;YAAEI;YAAKC;YAAKC;QAAK;QACtCE,OAAO,AAACH,CAAAA,MAAMD,GAAE,IAAK,IAAIA;IAC3B;AACF"}
@@ -1,12 +1,10 @@
1
- import type { UseStateInitializer } from "../types.js";
1
+ import { type UseStateInitializer } from "../types.js";
2
+ import { type GetMiddleOfRangeOptions } from "./getMiddleOfRange.js";
2
3
  /**
3
4
  * @internal
4
5
  * @remarks \@since 6.0.0
5
6
  */
6
- export interface RangeDefaultValueOptions {
7
- min: number;
8
- max: number;
9
- step: number;
7
+ export interface RangeDefaultValueOptions extends GetMiddleOfRangeOptions {
10
8
  defaultValue?: UseStateInitializer<number>;
11
9
  }
12
10
  /**