@react-md/core 6.5.0 → 6.5.2

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 (402) hide show
  1. package/dist/_utils.scss +5 -1
  2. package/dist/autocomplete/AutocompleteChip.js +2 -2
  3. package/dist/autocomplete/AutocompleteChip.js.map +1 -1
  4. package/dist/autocomplete/AutocompleteListboxChildren.js +1 -1
  5. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
  6. package/dist/autocomplete/useAutocomplete.js +4 -4
  7. package/dist/autocomplete/useAutocomplete.js.map +1 -1
  8. package/dist/autocomplete/utils.js +3 -3
  9. package/dist/autocomplete/utils.js.map +1 -1
  10. package/dist/box/styles.js +2 -2
  11. package/dist/box/styles.js.map +1 -1
  12. package/dist/button/AsyncButton.js +1 -1
  13. package/dist/button/AsyncButton.js.map +1 -1
  14. package/dist/chip/Chip.js +1 -1
  15. package/dist/chip/Chip.js.map +1 -1
  16. package/dist/cssUtils.d.ts +11 -6
  17. package/dist/cssUtils.js.map +1 -1
  18. package/dist/datetime/useTimeField.js +1 -1
  19. package/dist/datetime/useTimeField.js.map +1 -1
  20. package/dist/delegateEvent.js +9 -9
  21. package/dist/delegateEvent.js.map +1 -1
  22. package/dist/draggable/useDraggable.js +4 -4
  23. package/dist/draggable/useDraggable.js.map +1 -1
  24. package/dist/draggable/utils.js +1 -1
  25. package/dist/draggable/utils.js.map +1 -1
  26. package/dist/expansion-panel/ExpansionPanel.js +1 -1
  27. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  28. package/dist/expansion-panel/useExpansionPanels.js +1 -1
  29. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  30. package/dist/files/FileInput.js +1 -1
  31. package/dist/files/FileInput.js.map +1 -1
  32. package/dist/files/createAcceptFromExtensions.d.ts +5 -0
  33. package/dist/files/createAcceptFromExtensions.js +15 -0
  34. package/dist/files/createAcceptFromExtensions.js.map +1 -0
  35. package/dist/files/useFileUpload.js +45 -41
  36. package/dist/files/useFileUpload.js.map +1 -1
  37. package/dist/files/utils.js +14 -10
  38. package/dist/files/utils.js.map +1 -1
  39. package/dist/files/validation.js +7 -8
  40. package/dist/files/validation.js.map +1 -1
  41. package/dist/focus/useFocusContainer.js +1 -1
  42. package/dist/focus/useFocusContainer.js.map +1 -1
  43. package/dist/focus/utils.js +12 -7
  44. package/dist/focus/utils.js.map +1 -1
  45. package/dist/form/InputToggleIcon.js +5 -1
  46. package/dist/form/InputToggleIcon.js.map +1 -1
  47. package/dist/form/NativeSelect.js +1 -1
  48. package/dist/form/NativeSelect.js.map +1 -1
  49. package/dist/form/Select.js +5 -5
  50. package/dist/form/Select.js.map +1 -1
  51. package/dist/form/formConfig.js +1 -1
  52. package/dist/form/formConfig.js.map +1 -1
  53. package/dist/form/inputToggleStyles.js +7 -1
  54. package/dist/form/inputToggleStyles.js.map +1 -1
  55. package/dist/form/selectUtils.js +2 -2
  56. package/dist/form/selectUtils.js.map +1 -1
  57. package/dist/form/useCombobox.js +1 -0
  58. package/dist/form/useCombobox.js.map +1 -1
  59. package/dist/form/useFormReset.js +2 -2
  60. package/dist/form/useFormReset.js.map +1 -1
  61. package/dist/form/useNumberField.js +1 -1
  62. package/dist/form/useNumberField.js.map +1 -1
  63. package/dist/form/useResizingTextArea.js +4 -4
  64. package/dist/form/useResizingTextArea.js.map +1 -1
  65. package/dist/form/useSelectCombobox.js +1 -1
  66. package/dist/form/useSelectCombobox.js.map +1 -1
  67. package/dist/form/validation.js +1 -1
  68. package/dist/form/validation.js.map +1 -1
  69. package/dist/hoverMode/useHoverMode.js +8 -8
  70. package/dist/hoverMode/useHoverMode.js.map +1 -1
  71. package/dist/hoverMode/useHoverModeProvider.js +3 -3
  72. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  73. package/dist/icon/config.js +3 -3
  74. package/dist/icon/config.js.map +1 -1
  75. package/dist/icon/materialConfig.js +1 -1
  76. package/dist/icon/materialConfig.js.map +1 -1
  77. package/dist/interaction/UserInteractionModeProvider.js +11 -10
  78. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  79. package/dist/interaction/utils.js +7 -3
  80. package/dist/interaction/utils.js.map +1 -1
  81. package/dist/layout/useExpandableLayout.js +3 -4
  82. package/dist/layout/useExpandableLayout.js.map +1 -1
  83. package/dist/layout/useMainTabIndex.js +1 -1
  84. package/dist/layout/useMainTabIndex.js.map +1 -1
  85. package/dist/list/ListItem.js +1 -1
  86. package/dist/list/ListItem.js.map +1 -1
  87. package/dist/media-queries/AppSizeProvider.js +1 -1
  88. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  89. package/dist/media-queries/config.js +2 -2
  90. package/dist/media-queries/config.js.map +1 -1
  91. package/dist/media-queries/useMediaQuery.js +3 -3
  92. package/dist/media-queries/useMediaQuery.js.map +1 -1
  93. package/dist/menu/Menu.js +4 -4
  94. package/dist/menu/Menu.js.map +1 -1
  95. package/dist/menu/MenuItemButton.js +1 -1
  96. package/dist/menu/MenuItemButton.js.map +1 -1
  97. package/dist/menu/MenuItemFileInput.js +1 -1
  98. package/dist/menu/MenuItemFileInput.js.map +1 -1
  99. package/dist/menu/MenuWidget.js +2 -2
  100. package/dist/menu/MenuWidget.js.map +1 -1
  101. package/dist/movement/findMatchIndex.js +2 -2
  102. package/dist/movement/findMatchIndex.js.map +1 -1
  103. package/dist/movement/useKeyboardMovementProvider.js +2 -2
  104. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  105. package/dist/movement/utils.js +12 -10
  106. package/dist/movement/utils.js.map +1 -1
  107. package/dist/navigation/getTableOfContentsHeadings.js +4 -3
  108. package/dist/navigation/getTableOfContentsHeadings.js.map +1 -1
  109. package/dist/navigation/useActiveHeadingId.js +9 -9
  110. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  111. package/dist/navigation/useTableOfContentsHeadings.js +1 -1
  112. package/dist/navigation/useTableOfContentsHeadings.js.map +1 -1
  113. package/dist/navigation/utils.js +6 -5
  114. package/dist/navigation/utils.js.map +1 -1
  115. package/dist/portal/PortalContainerProvider.js +5 -3
  116. package/dist/portal/PortalContainerProvider.js.map +1 -1
  117. package/dist/positioning/getFixedPosition.js +2 -4
  118. package/dist/positioning/getFixedPosition.js.map +1 -1
  119. package/dist/positioning/useFixedPositioning.js +2 -2
  120. package/dist/positioning/useFixedPositioning.js.map +1 -1
  121. package/dist/positioning/utils.js +3 -3
  122. package/dist/positioning/utils.js.map +1 -1
  123. package/dist/scroll/getScrollbarWidth.js +4 -4
  124. package/dist/scroll/getScrollbarWidth.js.map +1 -1
  125. package/dist/searching/fuzzy.js +3 -2
  126. package/dist/searching/fuzzy.js.map +1 -1
  127. package/dist/searching/toSearchQuery.js +1 -1
  128. package/dist/searching/toSearchQuery.js.map +1 -1
  129. package/dist/searching/utils.js +1 -1
  130. package/dist/searching/utils.js.map +1 -1
  131. package/dist/snackbar/Toast.js +1 -1
  132. package/dist/snackbar/Toast.js.map +1 -1
  133. package/dist/snackbar/ToastContent.js +2 -2
  134. package/dist/snackbar/ToastContent.js.map +1 -1
  135. package/dist/snackbar/ToastManager.d.ts +1 -1
  136. package/dist/snackbar/ToastManager.js +11 -11
  137. package/dist/snackbar/ToastManager.js.map +1 -1
  138. package/dist/spinbutton/useSpinButton.js +1 -1
  139. package/dist/spinbutton/useSpinButton.js.map +1 -1
  140. package/dist/spinbutton/utils/deselectNode.js +1 -1
  141. package/dist/spinbutton/utils/deselectNode.js.map +1 -1
  142. package/dist/spinbutton/utils/resolveInputEvent.js +1 -1
  143. package/dist/spinbutton/utils/resolveInputEvent.js.map +1 -1
  144. package/dist/spinbutton/utils/selectNode.js +1 -1
  145. package/dist/spinbutton/utils/selectNode.js.map +1 -1
  146. package/dist/storage/useStorage.js +8 -3
  147. package/dist/storage/useStorage.js.map +1 -1
  148. package/dist/table/useStickyTableSection.js +1 -1
  149. package/dist/table/useStickyTableSection.js.map +1 -1
  150. package/dist/tabs/TabList.js +2 -2
  151. package/dist/tabs/TabList.js.map +1 -1
  152. package/dist/tabs/useMaxTabPanelHeight.js +4 -3
  153. package/dist/tabs/useMaxTabPanelHeight.js.map +1 -1
  154. package/dist/tabs/useTabList.js +1 -1
  155. package/dist/tabs/useTabList.js.map +1 -1
  156. package/dist/test-utils/jest-globals/match-media.d.ts +1 -1
  157. package/dist/test-utils/jest-globals/match-media.js +1 -1
  158. package/dist/test-utils/jest-globals/match-media.js.map +1 -1
  159. package/dist/test-utils/jest-globals/timers.js +1 -1
  160. package/dist/test-utils/jest-globals/timers.js.map +1 -1
  161. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js +1 -1
  162. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js.map +1 -1
  163. package/dist/test-utils/mocks/ResizeObserver.js +2 -2
  164. package/dist/test-utils/mocks/ResizeObserver.js.map +1 -1
  165. package/dist/test-utils/polyfills/IntersectionObserver.js +2 -2
  166. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  167. package/dist/test-utils/polyfills/ResizeObserver.js +2 -2
  168. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  169. package/dist/test-utils/polyfills/TextDecoder.js +2 -2
  170. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  171. package/dist/test-utils/polyfills/TextEncoder.js +2 -2
  172. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
  173. package/dist/test-utils/polyfills/matchMedia.js +2 -2
  174. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  175. package/dist/test-utils/polyfills/offsetParent.js +2 -2
  176. package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
  177. package/dist/test-utils/polyfills/scrollIntoView.js +1 -1
  178. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
  179. package/dist/test-utils/queries/select.js +2 -2
  180. package/dist/test-utils/queries/select.js.map +1 -1
  181. package/dist/test-utils/queries/slider.js +1 -1
  182. package/dist/test-utils/queries/slider.js.map +1 -1
  183. package/dist/test-utils/utils/createFileList.js +2 -0
  184. package/dist/test-utils/utils/createFileList.js.map +1 -1
  185. package/dist/test-utils/utils/createMatchMediaSpy.d.ts +1 -1
  186. package/dist/test-utils/utils/createMatchMediaSpy.js +3 -3
  187. package/dist/test-utils/utils/createMatchMediaSpy.js.map +1 -1
  188. package/dist/test-utils/vitest/match-media.d.ts +1 -1
  189. package/dist/test-utils/vitest/match-media.js +1 -1
  190. package/dist/test-utils/vitest/match-media.js.map +1 -1
  191. package/dist/test-utils/vitest/timers.js +1 -1
  192. package/dist/test-utils/vitest/timers.js.map +1 -1
  193. package/dist/test-utils/vitest/uploadMenuItemFileInput.js +1 -1
  194. package/dist/test-utils/vitest/uploadMenuItemFileInput.js.map +1 -1
  195. package/dist/theme/ThemeProvider.js +2 -2
  196. package/dist/theme/ThemeProvider.js.map +1 -1
  197. package/dist/theme/getDerivedTheme.js +1 -1
  198. package/dist/theme/getDerivedTheme.js.map +1 -1
  199. package/dist/theme/useCSSVariables.js +5 -5
  200. package/dist/theme/useCSSVariables.js.map +1 -1
  201. package/dist/theme/useColorSchemeMetaTag.js +2 -2
  202. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  203. package/dist/theme/useInlineCSSVariables.js +4 -3
  204. package/dist/theme/useInlineCSSVariables.js.map +1 -1
  205. package/dist/theme/utils.js +8 -8
  206. package/dist/theme/utils.js.map +1 -1
  207. package/dist/tooltip/useTooltip.js +7 -7
  208. package/dist/tooltip/useTooltip.js.map +1 -1
  209. package/dist/tooltip/useTooltipPosition.js +1 -1
  210. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  211. package/dist/transition/useCarousel.js +2 -2
  212. package/dist/transition/useCarousel.js.map +1 -1
  213. package/dist/transition/useCollapseTransition.js +1 -1
  214. package/dist/transition/useCollapseTransition.js.map +1 -1
  215. package/dist/transition/useSkeletonPlaceholder.js +4 -4
  216. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  217. package/dist/transition/useTransition.js +2 -2
  218. package/dist/transition/useTransition.js.map +1 -1
  219. package/dist/transition/utils.js +5 -5
  220. package/dist/transition/utils.js.map +1 -1
  221. package/dist/tree/TreeItem.js +1 -1
  222. package/dist/tree/TreeItem.js.map +1 -1
  223. package/dist/tree/useTreeItems.js +7 -5
  224. package/dist/tree/useTreeItems.js.map +1 -1
  225. package/dist/tree/useTreeMovement.js +1 -1
  226. package/dist/tree/useTreeMovement.js.map +1 -1
  227. package/dist/tree/utils.js +6 -9
  228. package/dist/tree/utils.js.map +1 -1
  229. package/dist/typography/HighlightText.js +2 -1
  230. package/dist/typography/HighlightText.js.map +1 -1
  231. package/dist/typography/SrOnly.js +7 -1
  232. package/dist/typography/SrOnly.js.map +1 -1
  233. package/dist/useDebouncedFunction.js +4 -4
  234. package/dist/useDebouncedFunction.js.map +1 -1
  235. package/dist/useDropzone.js +9 -9
  236. package/dist/useDropzone.js.map +1 -1
  237. package/dist/useEnsuredState.js +5 -5
  238. package/dist/useEnsuredState.js.map +1 -1
  239. package/dist/useIntersectionObserver.js +3 -3
  240. package/dist/useIntersectionObserver.js.map +1 -1
  241. package/dist/useIsomorphicLayoutEffect.js +1 -1
  242. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  243. package/dist/useOrientation.js +1 -1
  244. package/dist/useOrientation.js.map +1 -1
  245. package/dist/useReadonlySet.js +1 -1
  246. package/dist/useReadonlySet.js.map +1 -1
  247. package/dist/useResizeListener.js +2 -2
  248. package/dist/useResizeListener.js.map +1 -1
  249. package/dist/useResizeObserver.js +3 -4
  250. package/dist/useResizeObserver.js.map +1 -1
  251. package/dist/useThrottledFunction.js +3 -3
  252. package/dist/useThrottledFunction.js.map +1 -1
  253. package/dist/useWindowSize.js +1 -1
  254. package/dist/useWindowSize.js.map +1 -1
  255. package/dist/utils/alphaNumericSort.js +3 -1
  256. package/dist/utils/alphaNumericSort.js.map +1 -1
  257. package/dist/utils/bem.js +9 -12
  258. package/dist/utils/bem.js.map +1 -1
  259. package/dist/utils/getNumberOfDigits.js +1 -0
  260. package/dist/utils/getNumberOfDigits.js.map +1 -1
  261. package/dist/utils/getRangeDefaultValue.js +1 -1
  262. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  263. package/dist/utils/nearest.js +2 -2
  264. package/dist/utils/nearest.js.map +1 -1
  265. package/dist/utils/parseCssLengthUnit.js +3 -3
  266. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  267. package/dist/utils/trigonometry.js +1 -1
  268. package/dist/utils/trigonometry.js.map +1 -1
  269. package/package.json +3 -1
  270. package/src/autocomplete/AutocompleteChip.tsx +2 -2
  271. package/src/autocomplete/AutocompleteListboxChildren.tsx +1 -1
  272. package/src/autocomplete/useAutocomplete.ts +4 -4
  273. package/src/autocomplete/utils.ts +3 -3
  274. package/src/box/styles.ts +2 -2
  275. package/src/button/AsyncButton.tsx +1 -3
  276. package/src/chip/Chip.tsx +1 -2
  277. package/src/cssUtils.ts +12 -6
  278. package/src/datetime/useTimeField.ts +1 -1
  279. package/src/delegateEvent.ts +9 -9
  280. package/src/draggable/useDraggable.ts +4 -4
  281. package/src/draggable/utils.ts +1 -1
  282. package/src/expansion-panel/ExpansionPanel.tsx +1 -1
  283. package/src/expansion-panel/useExpansionPanels.ts +1 -1
  284. package/src/files/FileInput.tsx +1 -1
  285. package/src/files/createAcceptFromExtensions.ts +18 -0
  286. package/src/files/useFileUpload.ts +36 -37
  287. package/src/files/utils.ts +15 -11
  288. package/src/files/validation.ts +7 -9
  289. package/src/focus/useFocusContainer.ts +1 -1
  290. package/src/focus/utils.ts +11 -6
  291. package/src/form/InputToggleIcon.tsx +5 -5
  292. package/src/form/NativeSelect.tsx +1 -1
  293. package/src/form/Select.tsx +5 -5
  294. package/src/form/formConfig.ts +1 -1
  295. package/src/form/inputToggleStyles.ts +9 -4
  296. package/src/form/selectUtils.ts +2 -2
  297. package/src/form/useCombobox.ts +1 -0
  298. package/src/form/useFormReset.ts +2 -2
  299. package/src/form/useNumberField.ts +1 -1
  300. package/src/form/useResizingTextArea.ts +5 -5
  301. package/src/form/useSelectCombobox.ts +1 -4
  302. package/src/form/validation.ts +1 -1
  303. package/src/hoverMode/useHoverMode.ts +9 -9
  304. package/src/hoverMode/useHoverModeProvider.ts +4 -4
  305. package/src/icon/config.tsx +3 -3
  306. package/src/icon/materialConfig.ts +1 -1
  307. package/src/interaction/UserInteractionModeProvider.tsx +11 -10
  308. package/src/interaction/utils.ts +3 -3
  309. package/src/layout/useExpandableLayout.ts +3 -4
  310. package/src/layout/useMainTabIndex.ts +1 -1
  311. package/src/list/ListItem.tsx +1 -1
  312. package/src/media-queries/AppSizeProvider.tsx +1 -1
  313. package/src/media-queries/config.ts +2 -2
  314. package/src/media-queries/useMediaQuery.ts +3 -3
  315. package/src/menu/Menu.tsx +4 -4
  316. package/src/menu/MenuItemButton.tsx +1 -1
  317. package/src/menu/MenuItemFileInput.tsx +1 -1
  318. package/src/menu/MenuWidget.tsx +6 -4
  319. package/src/movement/findMatchIndex.ts +2 -2
  320. package/src/movement/useKeyboardMovementProvider.ts +2 -2
  321. package/src/movement/utils.ts +15 -14
  322. package/src/navigation/getTableOfContentsHeadings.ts +4 -3
  323. package/src/navigation/useActiveHeadingId.ts +8 -8
  324. package/src/navigation/useTableOfContentsHeadings.ts +1 -1
  325. package/src/navigation/utils.ts +6 -5
  326. package/src/portal/PortalContainerProvider.tsx +5 -3
  327. package/src/positioning/getFixedPosition.ts +9 -6
  328. package/src/positioning/useFixedPositioning.ts +2 -2
  329. package/src/positioning/utils.ts +3 -3
  330. package/src/scroll/getScrollbarWidth.ts +4 -4
  331. package/src/searching/fuzzy.ts +7 -3
  332. package/src/searching/toSearchQuery.ts +1 -1
  333. package/src/searching/utils.ts +1 -1
  334. package/src/snackbar/Toast.tsx +1 -1
  335. package/src/snackbar/ToastContent.tsx +2 -2
  336. package/src/snackbar/ToastManager.ts +11 -12
  337. package/src/spinbutton/useSpinButton.ts +1 -1
  338. package/src/spinbutton/utils/deselectNode.ts +1 -1
  339. package/src/spinbutton/utils/resolveInputEvent.ts +1 -1
  340. package/src/spinbutton/utils/selectNode.ts +1 -1
  341. package/src/storage/useStorage.ts +7 -2
  342. package/src/table/useStickyTableSection.tsx +1 -1
  343. package/src/tabs/TabList.tsx +2 -2
  344. package/src/tabs/useMaxTabPanelHeight.ts +6 -3
  345. package/src/tabs/useTabList.ts +2 -2
  346. package/src/test-utils/jest-globals/match-media.ts +5 -2
  347. package/src/test-utils/jest-globals/timers.ts +1 -1
  348. package/src/test-utils/jest-globals/uploadMenuItemFileInput.ts +1 -1
  349. package/src/test-utils/mocks/ResizeObserver.ts +2 -2
  350. package/src/test-utils/polyfills/IntersectionObserver.ts +2 -2
  351. package/src/test-utils/polyfills/ResizeObserver.ts +2 -2
  352. package/src/test-utils/polyfills/TextDecoder.ts +2 -2
  353. package/src/test-utils/polyfills/TextEncoder.ts +2 -2
  354. package/src/test-utils/polyfills/matchMedia.ts +5 -2
  355. package/src/test-utils/polyfills/offsetParent.ts +2 -2
  356. package/src/test-utils/polyfills/scrollIntoView.ts +1 -1
  357. package/src/test-utils/queries/select.ts +2 -2
  358. package/src/test-utils/queries/slider.ts +1 -1
  359. package/src/test-utils/utils/createFileList.ts +2 -0
  360. package/src/test-utils/utils/createMatchMediaSpy.ts +4 -4
  361. package/src/test-utils/vitest/match-media.ts +2 -2
  362. package/src/test-utils/vitest/timers.ts +1 -1
  363. package/src/test-utils/vitest/uploadMenuItemFileInput.ts +1 -1
  364. package/src/theme/ThemeProvider.tsx +2 -2
  365. package/src/theme/getDerivedTheme.ts +1 -1
  366. package/src/theme/useCSSVariables.ts +5 -5
  367. package/src/theme/useColorSchemeMetaTag.ts +2 -2
  368. package/src/theme/useInlineCSSVariables.ts +6 -7
  369. package/src/theme/utils.ts +8 -8
  370. package/src/tooltip/useTooltip.ts +7 -7
  371. package/src/tooltip/useTooltipPosition.ts +1 -1
  372. package/src/transition/useCarousel.ts +2 -2
  373. package/src/transition/useCollapseTransition.ts +1 -1
  374. package/src/transition/useSkeletonPlaceholder.ts +4 -4
  375. package/src/transition/useTransition.ts +2 -2
  376. package/src/transition/utils.ts +5 -5
  377. package/src/tree/TreeItem.tsx +1 -1
  378. package/src/tree/useTreeItems.ts +5 -5
  379. package/src/tree/useTreeMovement.ts +1 -1
  380. package/src/tree/utils.ts +9 -9
  381. package/src/typography/HighlightText.tsx +4 -3
  382. package/src/typography/SrOnly.tsx +9 -2
  383. package/src/useDebouncedFunction.ts +5 -5
  384. package/src/useDropzone.ts +10 -10
  385. package/src/useEnsuredState.ts +5 -5
  386. package/src/useIntersectionObserver.ts +3 -3
  387. package/src/useIsomorphicLayoutEffect.ts +3 -3
  388. package/src/useOrientation.ts +1 -1
  389. package/src/useReadonlySet.ts +3 -1
  390. package/src/useResizeListener.ts +2 -2
  391. package/src/useResizeObserver.ts +3 -4
  392. package/src/useThrottledFunction.ts +4 -4
  393. package/src/useWindowSize.ts +1 -1
  394. package/src/utils/alphaNumericSort.ts +1 -1
  395. package/src/utils/bem.ts +15 -16
  396. package/src/utils/getNumberOfDigits.ts +1 -0
  397. package/src/utils/getRangeDefaultValue.ts +1 -1
  398. package/src/utils/nearest.ts +5 -2
  399. package/src/utils/parseCssLengthUnit.ts +5 -4
  400. package/src/utils/trigonometry.ts +1 -1
  401. package/dist/form/defaultGetSelectedOptionChildren.d.ts +0 -1
  402. package/dist/form/getSelectedOptionChildren.d.ts +0 -1
@@ -62,8 +62,8 @@ export const ToastContent = forwardRef<HTMLDivElement, ToastContentProps>(
62
62
  disableWidth: true,
63
63
  onUpdate: useCallback((entry) => {
64
64
  const element = entry.target;
65
- const style = window.getComputedStyle(element);
66
- const lineHeight = parseFloat(style.lineHeight);
65
+ const style = globalThis.getComputedStyle(element);
66
+ const lineHeight = Number.parseFloat(style.lineHeight);
67
67
  if (Number.isNaN(lineHeight)) {
68
68
  return;
69
69
  }
@@ -121,7 +121,7 @@ export interface ToastVisibilityTimers {
121
121
  inactive: boolean;
122
122
  startTime: number;
123
123
  elapsedTime: number;
124
- exitTimeout?: number;
124
+ exitTimeout?: NodeJS.Timeout;
125
125
  }
126
126
 
127
127
  /**
@@ -154,9 +154,9 @@ export class ToastManager {
154
154
  #emit = (): void => {
155
155
  // shallow clone to ensure react updates
156
156
  this.#queue = [...this.#queue];
157
- this.#listeners.forEach((callback) => {
157
+ for (const callback of this.#listeners) {
158
158
  callback(this.#queue);
159
- });
159
+ }
160
160
  };
161
161
 
162
162
  #getToastIndex = (toastId: string | undefined): number => {
@@ -404,7 +404,7 @@ export class ToastManager {
404
404
  startTime: Date.now(),
405
405
  elapsedTime: 0,
406
406
  };
407
- window.clearTimeout(timers.exitTimeout);
407
+ globalThis.clearTimeout(timers.exitTimeout);
408
408
 
409
409
  let duration = visibleTime;
410
410
  if (timers.elapsedTime) {
@@ -412,7 +412,7 @@ export class ToastManager {
412
412
  }
413
413
 
414
414
  timers.inactive = false;
415
- timers.exitTimeout = window.setTimeout(() => {
415
+ timers.exitTimeout = globalThis.setTimeout(() => {
416
416
  this.removeToast(toastId, true);
417
417
  }, duration);
418
418
  this.#timers.set(toastId, timers);
@@ -431,9 +431,8 @@ export class ToastManager {
431
431
  return;
432
432
  }
433
433
 
434
- window.clearTimeout(cached.exitTimeout);
435
- const timers = { ...cached };
436
- timers.inactive = true;
434
+ globalThis.clearTimeout(cached.exitTimeout);
435
+ const timers = { ...cached, inactive: true };
437
436
  timers.elapsedTime = Date.now() - timers.startTime + timers.elapsedTime;
438
437
  this.#timers.set(toastId, timers);
439
438
  this.#updateToast(toastId, { paused: true });
@@ -499,7 +498,7 @@ export class ToastManager {
499
498
  */
500
499
  clearTimer = (toastId: string): void => {
501
500
  const timer = this.#timers.get(toastId);
502
- window.clearTimeout(timer?.exitTimeout);
501
+ globalThis.clearTimeout(timer?.exitTimeout);
503
502
  this.#timers.delete(toastId);
504
503
  };
505
504
 
@@ -520,9 +519,9 @@ export class ToastManager {
520
519
  */
521
520
  clearToasts = (disableEmit = false): void => {
522
521
  this.#queue = [];
523
- this.#timers.forEach((meta) => {
524
- window.clearTimeout(meta.exitTimeout);
525
- });
522
+ for (const [, meta] of this.#timers) {
523
+ globalThis.clearTimeout(meta.exitTimeout);
524
+ }
526
525
  this.#timers.clear();
527
526
  if (!disableEmit) {
528
527
  this.#emit();
@@ -70,7 +70,7 @@ export function useSpinButton<E extends HTMLElement = HTMLDivElement>(
70
70
  // trigger a noop setValue when `value` and `onValueChange` are provided
71
71
  // since `onValueChange is always called with `setValue
72
72
  let propSetValue: Dispatch<SpinButtonValue> | undefined;
73
- if (typeof propValue !== "undefined" && options.onValueChange) {
73
+ if (propValue !== undefined && options.onValueChange) {
74
74
  propSetValue = noop;
75
75
  }
76
76
 
@@ -3,7 +3,7 @@
3
3
  * @internal
4
4
  */
5
5
  export function deselectNode(node: Node): void {
6
- const selection = window.getSelection();
6
+ const selection = globalThis.getSelection();
7
7
  if (!selection) {
8
8
  return;
9
9
  }
@@ -86,7 +86,7 @@ export function resolveInputEvent(
86
86
  }
87
87
 
88
88
  let reason: SpinButtonResolvedInputReason = "type";
89
- let nextValue: SpinButtonValue = parseInt(prevText + text, 10);
89
+ let nextValue: SpinButtonValue = Number.parseInt(prevText + text, 10);
90
90
  if (typeof minDigits === "number" && typedCount + 1 < minDigits) {
91
91
  reason = "placeholder-digit";
92
92
  }
@@ -3,7 +3,7 @@
3
3
  * @internal
4
4
  */
5
5
  export function selectNode(node: Node): void {
6
- const selection = window.getSelection();
6
+ const selection = globalThis.getSelection();
7
7
  if (!selection) {
8
8
  return;
9
9
  }
@@ -187,6 +187,11 @@ export function useStorage<T>(
187
187
 
188
188
  setStoredValue((prevValue) => {
189
189
  const nextValue =
190
+ // this has to still use `instanceof` because of the T generic. Using
191
+ // `T extends ...` restricts the types too much if providing a
192
+ // `defaultValue`
193
+ //
194
+ // eslint-disable-next-line unicorn/no-instanceof-builtins
190
195
  valueOrDispatcher instanceof Function
191
196
  ? valueOrDispatcher(prevValue)
192
197
  : valueOrDispatcher;
@@ -263,9 +268,9 @@ export function useStorage<T>(
263
268
  }
264
269
  };
265
270
 
266
- window.addEventListener("storage", callback);
271
+ globalThis.addEventListener("storage", callback);
267
272
  return () => {
268
- window.removeEventListener("storage", callback);
273
+ globalThis.removeEventListener("storage", callback);
269
274
  };
270
275
  }, [key]);
271
276
 
@@ -95,7 +95,7 @@ export function useStickyTableSection(
95
95
  if (exists) {
96
96
  topOffset = section.offsetHeight - 1;
97
97
  } else {
98
- const top = parseFloat(window.getComputedStyle(section).top);
98
+ const top = Number.parseFloat(globalThis.getComputedStyle(section).top);
99
99
  topOffset = Number.isNaN(top) ? 1 : top + 1;
100
100
  }
101
101
 
@@ -176,12 +176,12 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
176
176
  }
177
177
 
178
178
  setAnimate(true);
179
- const timeout = window.setTimeout(() => {
179
+ const timeout = globalThis.setTimeout(() => {
180
180
  setAnimate(false);
181
181
  }, transitionDuration);
182
182
 
183
183
  return () => {
184
- window.clearTimeout(timeout);
184
+ globalThis.clearTimeout(timeout);
185
185
  };
186
186
  }, [activeIndex, disableTransition, transitionDuration]);
187
187
 
@@ -111,7 +111,9 @@ export function useMaxTabPanelHeight<E extends HTMLElement = HTMLDivElement>(
111
111
  const { height } = element.style;
112
112
  element.style.height = "";
113
113
  const panels = getTabPanelRoleOnly(element);
114
- const maxHeight = panels.reduce((maxHeight, panel) => {
114
+
115
+ let maxHeight = 0;
116
+ for (const panel of panels) {
115
117
  let { scrollHeight } = panel;
116
118
  if (panel.classList.contains(DISPLAY_NONE_CLASS)) {
117
119
  panel.classList.toggle(DISPLAY_NONE_CLASS);
@@ -119,8 +121,9 @@ export function useMaxTabPanelHeight<E extends HTMLElement = HTMLDivElement>(
119
121
  panel.classList.toggle(DISPLAY_NONE_CLASS);
120
122
  }
121
123
 
122
- return Math.max(maxHeight, scrollHeight);
123
- }, 0);
124
+ maxHeight = Math.max(maxHeight, scrollHeight);
125
+ }
126
+
124
127
  element.style.height = height;
125
128
 
126
129
  // don't set the height to 0 since it usually means a calculation issue
@@ -183,9 +183,9 @@ export function useTabList(
183
183
  return;
184
184
  }
185
185
 
186
- const clickedTab = event.target.closest("[role='tab']");
186
+ const clickedTab = event.target.closest<HTMLElement>("[role='tab']");
187
187
  const tabs = getTabRoleOnly(event.currentTarget);
188
- const i = tabs.findIndex((tab) => tab === clickedTab);
188
+ const i = clickedTab ? tabs.indexOf(clickedTab) : -1;
189
189
  if (i !== -1) {
190
190
  setActiveIndex(i);
191
191
  }
@@ -37,6 +37,9 @@ import { createMatchMediaSpy } from "../utils/createMatchMediaSpy.js";
37
37
  */
38
38
  export function spyOnMatchMedia(
39
39
  defaultMatch: MatchMediaMatcher = matchDesktop
40
- ): jest.SpiedFunction<typeof window.matchMedia> & MatchMediaChangeViewport {
41
- return createMatchMediaSpy(jest.spyOn(window, "matchMedia"), defaultMatch);
40
+ ): jest.SpiedFunction<typeof globalThis.matchMedia> & MatchMediaChangeViewport {
41
+ return createMatchMediaSpy(
42
+ jest.spyOn(globalThis, "matchMedia"),
43
+ defaultMatch
44
+ );
42
45
  }
@@ -42,7 +42,7 @@ export type RafSpy = jest.SpiedFunction<typeof requestAnimationFrame>;
42
42
  * @since 6.0.0
43
43
  */
44
44
  export const testImmediateRaf = (): RafSpy =>
45
- jest.spyOn(window, "requestAnimationFrame").mockImplementation((cb) => {
45
+ jest.spyOn(globalThis, "requestAnimationFrame").mockImplementation((cb) => {
46
46
  cb(0);
47
47
  return 0;
48
48
  });
@@ -44,7 +44,7 @@ export async function uploadMenuItemFileUpload(
44
44
  jest.spyOn(document, "createElement").mockReturnValueOnce(input);
45
45
  jest.spyOn(input, "click").mockImplementationOnce(() => {
46
46
  fireEvent.change(input, {
47
- target: { files: createFileList(window, files) },
47
+ target: { files: createFileList(globalThis.window, files) },
48
48
  });
49
49
  });
50
50
 
@@ -253,8 +253,8 @@ export function setupResizeObserverMock(
253
253
 
254
254
  const resizeObserver = new ResizeObserverMock((entries) => {
255
255
  if (raf) {
256
- window.cancelAnimationFrame(manager.frame);
257
- manager.frame = window.requestAnimationFrame(() => {
256
+ globalThis.cancelAnimationFrame(manager.frame);
257
+ manager.frame = globalThis.requestAnimationFrame(() => {
258
258
  manager.handleResizeEntries(entries);
259
259
  });
260
260
  } else {
@@ -1,8 +1,8 @@
1
1
  import { IntersectionObserverMock } from "../mocks/IntersectionObserver.js";
2
2
 
3
3
  if (
4
- typeof window !== "undefined" &&
4
+ globalThis.window !== undefined &&
5
5
  typeof IntersectionObserver === "undefined"
6
6
  ) {
7
- window.IntersectionObserver = IntersectionObserverMock;
7
+ globalThis.IntersectionObserver = IntersectionObserverMock;
8
8
  }
@@ -1,5 +1,5 @@
1
1
  import { ResizeObserverMock } from "../mocks/ResizeObserver.js";
2
2
 
3
- if (typeof window !== "undefined" && typeof ResizeObserver === "undefined") {
4
- window.ResizeObserver = ResizeObserverMock;
3
+ if (globalThis.window !== undefined && typeof ResizeObserver === "undefined") {
4
+ globalThis.ResizeObserver = ResizeObserverMock;
5
5
  }
@@ -1,6 +1,6 @@
1
1
  import { TextDecoder } from "node:util";
2
2
 
3
- if (typeof global.TextDecoder === "undefined") {
3
+ if (globalThis.TextDecoder === undefined) {
4
4
  // @ts-expect-error browser TextDecoder does not support `null` while `node:util` does
5
- global.TextDecoder = TextDecoder;
5
+ globalThis.TextDecoder = TextDecoder;
6
6
  }
@@ -1,5 +1,5 @@
1
1
  import { TextEncoder } from "node:util";
2
2
 
3
- if (typeof global.TextEncoder === "undefined") {
4
- global.TextEncoder = TextEncoder;
3
+ if (globalThis.TextEncoder === undefined) {
4
+ globalThis.TextEncoder = TextEncoder;
5
5
  }
@@ -1,7 +1,10 @@
1
1
  import { BASE_MEDIA_QUERY_LIST, matchDesktop } from "../mocks/match-media.js";
2
2
 
3
- if (typeof window !== "undefined" && typeof window.matchMedia !== "function") {
4
- window.matchMedia = (query) => ({
3
+ if (
4
+ globalThis.window !== undefined &&
5
+ typeof globalThis.matchMedia !== "function"
6
+ ) {
7
+ globalThis.matchMedia = (query) => ({
5
8
  ...BASE_MEDIA_QUERY_LIST,
6
9
  matches: matchDesktop(query),
7
10
  });
@@ -1,5 +1,5 @@
1
1
  // this polyfill was added to support the tree keyboard movement behavior
2
- if (typeof window !== "undefined") {
2
+ if (globalThis.window !== undefined) {
3
3
  // Based off of https://github.com/jsdom/jsdom/issues/1261#issuecomment-512217225
4
4
  //
5
5
  // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
@@ -11,7 +11,7 @@ if (typeof window !== "undefined") {
11
11
  // - The element is <body> or <html>.
12
12
  Object.defineProperty(HTMLElement.prototype, "offsetParent", {
13
13
  get(this: HTMLElement) {
14
- // eslint-disable-next-line @typescript-eslint/no-this-alias
14
+ // eslint-disable-next-line @typescript-eslint/no-this-alias, unicorn/no-this-assignment
15
15
  let element: ParentNode | null = this;
16
16
  while (
17
17
  element &&
@@ -1,5 +1,5 @@
1
1
  if (
2
- typeof window !== "undefined" &&
2
+ globalThis.window !== undefined &&
3
3
  typeof HTMLElement.prototype.scrollIntoView !== "function"
4
4
  ) {
5
5
  // this is required for keyboard movement behavior
@@ -75,7 +75,7 @@ export function getSelectTestElements(
75
75
  });
76
76
  const selectedOption = select.firstElementChild;
77
77
  if (!(selectedOption instanceof HTMLDivElement)) {
78
- throw new Error("Unable to find the `Select` selected option element");
78
+ throw new TypeError("Unable to find the `Select` selected option element");
79
79
  }
80
80
 
81
81
  return {
@@ -105,7 +105,7 @@ export async function findSelectTestElements(
105
105
  );
106
106
  const selectedOption = select.firstElementChild;
107
107
  if (!(selectedOption instanceof HTMLDivElement)) {
108
- throw new Error("Unable to find the `Select` selected option element");
108
+ throw new TypeError("Unable to find the `Select` selected option element");
109
109
  }
110
110
 
111
111
  return {
@@ -14,7 +14,7 @@ function getElements(slider: HTMLSpanElement): Elements {
14
14
  const sliderTrack = slider.parentElement;
15
15
  const sliderContainer = sliderTrack?.parentElement;
16
16
  if (!(sliderInput instanceof HTMLInputElement)) {
17
- throw new Error("Unable to find the `Slider` input element");
17
+ throw new TypeError("Unable to find the `Slider` input element");
18
18
  }
19
19
  if (
20
20
  !(sliderTrack instanceof HTMLSpanElement) ||
@@ -13,11 +13,13 @@ export function createFileList(
13
13
  // needs to be `any` to match the FileList definition
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
15
  [Symbol.iterator]: function* nextFile(): Generator<File, any, any> {
16
+ // eslint-disable-next-line unicorn/no-for-loop
16
17
  for (let i = 0; i < fileList.length; i++) {
17
18
  yield fileList[i];
18
19
  }
19
20
  },
20
21
  };
22
+ // eslint-disable-next-line unicorn/no-immediate-mutation
21
23
  fileList.constructor = window.FileList;
22
24
  if (window.FileList) {
23
25
  Object.setPrototypeOf(fileList, window.FileList.prototype);
@@ -11,7 +11,7 @@ import {
11
11
  * @since 6.0.0
12
12
  */
13
13
  export interface MatchMediaMockFunction {
14
- mockImplementation(fn: typeof window.matchMedia): this;
14
+ mockImplementation(fn: typeof globalThis.matchMedia): this;
15
15
  }
16
16
 
17
17
  /**
@@ -84,16 +84,16 @@ export function createMatchMediaSpy<SpyFunction extends MatchMediaMockFunction>(
84
84
  disableAct = false
85
85
  ): void => {
86
86
  const update = (): void => {
87
- window.dispatchEvent(new Event("resize"));
87
+ globalThis.dispatchEvent(new Event("resize"));
88
88
 
89
89
  const event = new Event("change");
90
- listeners.forEach((listener, query) => {
90
+ for (const [query, listener] of listeners.entries()) {
91
91
  listener({
92
92
  ...event,
93
93
  media: "",
94
94
  matches: matcher(query),
95
95
  });
96
- });
96
+ }
97
97
  };
98
98
  if (disableAct) {
99
99
  update();
@@ -37,6 +37,6 @@ import { createMatchMediaSpy } from "../utils/createMatchMediaSpy.js";
37
37
  */
38
38
  export function spyOnMatchMedia(
39
39
  defaultMatch: MatchMediaMatcher = matchDesktop
40
- ): MockInstance<typeof window.matchMedia> & MatchMediaChangeViewport {
41
- return createMatchMediaSpy(vi.spyOn(window, "matchMedia"), defaultMatch);
40
+ ): MockInstance<typeof globalThis.matchMedia> & MatchMediaChangeViewport {
41
+ return createMatchMediaSpy(vi.spyOn(globalThis, "matchMedia"), defaultMatch);
42
42
  }
@@ -42,7 +42,7 @@ export type RafSpy = MockInstance<typeof requestAnimationFrame>;
42
42
  * @since 6.0.0
43
43
  */
44
44
  export const testImmediateRaf = (): RafSpy =>
45
- vi.spyOn(window, "requestAnimationFrame").mockImplementation((cb) => {
45
+ vi.spyOn(globalThis, "requestAnimationFrame").mockImplementation((cb) => {
46
46
  cb(0);
47
47
  return 0;
48
48
  });
@@ -44,7 +44,7 @@ export async function uploadMenuItemFileUpload(
44
44
  vitest.spyOn(document, "createElement").mockReturnValueOnce(input);
45
45
  vitest.spyOn(input, "click").mockImplementationOnce(() => {
46
46
  fireEvent.change(input, {
47
- target: { files: createFileList(window, files) },
47
+ target: { files: createFileList(globalThis.window, files) },
48
48
  });
49
49
  });
50
50
 
@@ -197,12 +197,12 @@ export function ThemeProvider(props: ThemeProviderProps): ReactElement {
197
197
  // NOTE: This will not be correct the first time a new theme is lazy-loaded
198
198
  // and applied. It might be good to have a way to manually force this flow
199
199
  // again?
200
- const frame = window.requestAnimationFrame(() => {
200
+ const frame = globalThis.requestAnimationFrame(() => {
201
201
  setDerivedTheme(getDerivedTheme(document.documentElement));
202
202
  });
203
203
 
204
204
  return () => {
205
- window.cancelAnimationFrame(frame);
205
+ globalThis.cancelAnimationFrame(frame);
206
206
  };
207
207
  }, [theme, currentColor, colorScheme]);
208
208
 
@@ -21,7 +21,7 @@ import { type ConfigurableThemeColors } from "./types.js";
21
21
  export const getDerivedTheme = (
22
22
  container: Element = document.documentElement
23
23
  ): Readonly<ConfigurableThemeColors> => {
24
- const rootStyles = window.getComputedStyle(container);
24
+ const rootStyles = globalThis.getComputedStyle(container);
25
25
  const backgroundColor = rootStyles.getPropertyValue(backgroundColorVar);
26
26
  const primaryColor = rootStyles.getPropertyValue(primaryColorVar);
27
27
  const onPrimaryColor = rootStyles.getPropertyValue(onPrimaryColorVar);
@@ -39,7 +39,7 @@ export function useCSSVariables<Name extends CSSVariableName>(
39
39
  rootNode?: RefObject<HTMLElement> | HTMLElement
40
40
  ): void {
41
41
  useEffect(() => {
42
- if (!variables.length) {
42
+ if (variables.length === 0) {
43
43
  return;
44
44
  }
45
45
 
@@ -62,7 +62,7 @@ export function useCSSVariables<Name extends CSSVariableName>(
62
62
  }
63
63
 
64
64
  // const root = document.documentElement;
65
- variables.forEach(({ name, value }) => {
65
+ for (const { name, value } of variables) {
66
66
  if (
67
67
  process.env.NODE_ENV !== "production" &&
68
68
  root.style.getPropertyValue(name)
@@ -80,11 +80,11 @@ export function useCSSVariables<Name extends CSSVariableName>(
80
80
  }
81
81
 
82
82
  root.style.setProperty(name, `${value}`);
83
- });
83
+ }
84
84
  return () => {
85
- variables.forEach(({ name }) => {
85
+ for (const { name } of variables) {
86
86
  root.style.removeProperty(name);
87
- });
87
+ }
88
88
  };
89
89
  }, [variables, rootNode]);
90
90
  }
@@ -59,10 +59,10 @@ export function useColorSchemeMetaTag(
59
59
  const meta = document.createElement("meta");
60
60
  meta.name = "color-scheme";
61
61
  meta.content = colorScheme;
62
- document.head.appendChild(meta);
62
+ document.head.append(meta);
63
63
 
64
64
  return () => {
65
- document.head.removeChild(meta);
65
+ meta.remove();
66
66
  };
67
67
  }, [disabled, colorScheme]);
68
68
  }
@@ -40,12 +40,11 @@ export function useInlineCSSVariables<Name extends CSSVariableName>(
40
40
  variables: ReadonlyCSSVariableList<Name>
41
41
  ): CSSProperties {
42
42
  return useMemo(() => {
43
- return variables.reduce<CSSVariablesProperties<Name>>(
44
- (style, { name, value }) => {
45
- style[name] = value;
46
- return style;
47
- },
48
- {}
49
- );
43
+ const style: CSSVariablesProperties<Name> = {};
44
+ for (const { name, value } of variables) {
45
+ style[name] = value;
46
+ }
47
+
48
+ return style;
50
49
  }, [variables]);
51
50
  }
@@ -29,9 +29,9 @@ export function hexToRGB(hex: string): RGB {
29
29
  );
30
30
 
31
31
  const result = hex.match(VERBOSE_REGEX) || [];
32
- const r = parseInt(result[1] || "", 16) || 0;
33
- const g = parseInt(result[2] || "", 16) || 0;
34
- const b = parseInt(result[3] || "", 16) || 0;
32
+ const r = Number.parseInt(result[1] || "", 16) || 0;
33
+ const g = Number.parseInt(result[2] || "", 16) || 0;
34
+ const b = Number.parseInt(result[3] || "", 16) || 0;
35
35
 
36
36
  return [r, g, b];
37
37
  }
@@ -39,12 +39,12 @@ export function hexToRGB(hex: string): RGB {
39
39
  export function getRGB(color: string): RGB {
40
40
  // chrome 102.0.50005.63 apparently has whitespace when calling `window.getComputedStyle(element)`
41
41
  // remove whitespace to make it easy for supporting rgb or hex
42
- color = color.replace(/\s/g, "");
42
+ color = color.replaceAll(/\s/g, "");
43
43
  const rgbMatches = color.match(RGB_REGEX);
44
44
  if (rgbMatches) {
45
- const r = parseInt(rgbMatches[1] || "", 16) || 0;
46
- const g = parseInt(rgbMatches[2] || "", 16) || 0;
47
- const b = parseInt(rgbMatches[3] || "", 16) || 0;
45
+ const r = Number.parseInt(rgbMatches[1] || "", 16) || 0;
46
+ const g = Number.parseInt(rgbMatches[2] || "", 16) || 0;
47
+ const b = Number.parseInt(rgbMatches[3] || "", 16) || 0;
48
48
 
49
49
  return [r, g, b];
50
50
  }
@@ -66,7 +66,7 @@ const BLUE_MULTIPLIER = 0.0722;
66
66
  function get8BitColor(color: number): number {
67
67
  color /= 255;
68
68
 
69
- if (color <= 0.03928) {
69
+ if (color <= 0.039_28) {
70
70
  return color / 12.92;
71
71
  }
72
72
 
@@ -483,7 +483,7 @@ export function useTooltip<
483
483
  const tooltip = tooltipRef.current;
484
484
  if (!disableAutoSpacing && tooltip) {
485
485
  tooltipSpacing =
486
- window
486
+ globalThis
487
487
  .getComputedStyle(tooltip)
488
488
  .getPropertyValue(TOOLTIP_SPACING_VAR) || spacing;
489
489
  }
@@ -537,13 +537,13 @@ export function useTooltip<
537
537
  }
538
538
  };
539
539
 
540
- window.addEventListener("keydown", handleKeyDown);
540
+ globalThis.addEventListener("keydown", handleKeyDown);
541
541
  window.addEventListener("scroll", hideTooltip, true);
542
- window.addEventListener("touchend", hideTooltip, true);
542
+ globalThis.addEventListener("touchend", hideTooltip, true);
543
543
  return () => {
544
- window.removeEventListener("keydown", handleKeyDown);
544
+ globalThis.removeEventListener("keydown", handleKeyDown);
545
545
  window.removeEventListener("scroll", hideTooltip, true);
546
- window.removeEventListener("touchend", hideTooltip, true);
546
+ globalThis.removeEventListener("touchend", hideTooltip, true);
547
547
  };
548
548
  }, [hideTooltip, visible]);
549
549
 
@@ -554,7 +554,7 @@ export function useTooltip<
554
554
  onDisabledCleanup: hideTooltip,
555
555
  onChange(active) {
556
556
  if (active) {
557
- refocusFrame.current = window.requestAnimationFrame(() => {
557
+ refocusFrame.current = globalThis.requestAnimationFrame(() => {
558
558
  pageInactive.current = false;
559
559
  });
560
560
  return;
@@ -685,7 +685,7 @@ export function useTooltip<
685
685
  }
686
686
 
687
687
  event.preventDefault();
688
- const selection = window.getSelection();
688
+ const selection = globalThis.getSelection();
689
689
  const node = selection?.anchorNode?.parentElement;
690
690
  if (node && event.currentTarget.contains(node)) {
691
691
  selection.empty();
@@ -93,7 +93,7 @@ export function useTooltipPosition(
93
93
  [defaultPosition, threshold]
94
94
  );
95
95
 
96
- if (typeof determinedPosition !== "undefined") {
96
+ if (determinedPosition !== undefined) {
97
97
  return [determinedPosition, noop];
98
98
  }
99
99
 
@@ -224,7 +224,7 @@ export function useCarousel(options: CarouselOptions): CarouselImplementation {
224
224
  return;
225
225
  }
226
226
 
227
- const timeout = window.setTimeout(() => {
227
+ const timeout = globalThis.setTimeout(() => {
228
228
  const nextActiveIndex = loop({
229
229
  min: 0,
230
230
  max: total,
@@ -238,7 +238,7 @@ export function useCarousel(options: CarouselOptions): CarouselImplementation {
238
238
  }, duration);
239
239
 
240
240
  return () => {
241
- window.clearTimeout(timeout);
241
+ globalThis.clearTimeout(timeout);
242
242
  };
243
243
  }, [paused, duration, activeIndex, total]);
244
244