@react-md/core 6.4.0 → 6.5.1

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 (431) hide show
  1. package/dist/_a11y.scss +3 -1
  2. package/dist/_box-shadows.scss +20 -12
  3. package/dist/_core.scss +1 -1
  4. package/dist/_utils.scss +26 -11
  5. package/dist/app-bar/_app-bar.scss +3 -3
  6. package/dist/autocomplete/AutocompleteChip.js +2 -2
  7. package/dist/autocomplete/AutocompleteChip.js.map +1 -1
  8. package/dist/autocomplete/AutocompleteListboxChildren.js +1 -1
  9. package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
  10. package/dist/autocomplete/_autocomplete.scss +20 -16
  11. package/dist/autocomplete/useAutocomplete.js +4 -4
  12. package/dist/autocomplete/useAutocomplete.js.map +1 -1
  13. package/dist/autocomplete/utils.js +3 -3
  14. package/dist/autocomplete/utils.js.map +1 -1
  15. package/dist/avatar/_avatar.scss +2 -1
  16. package/dist/box/styles.js +2 -2
  17. package/dist/box/styles.js.map +1 -1
  18. package/dist/button/AsyncButton.js +1 -1
  19. package/dist/button/AsyncButton.js.map +1 -1
  20. package/dist/button/_button.scss +9 -5
  21. package/dist/card/_card.scss +6 -6
  22. package/dist/chip/Chip.js +1 -1
  23. package/dist/chip/Chip.js.map +1 -1
  24. package/dist/chip/_chip.scss +6 -6
  25. package/dist/cssUtils.d.ts +11 -6
  26. package/dist/cssUtils.js.map +1 -1
  27. package/dist/datetime/useTimeField.js +1 -1
  28. package/dist/datetime/useTimeField.js.map +1 -1
  29. package/dist/delegateEvent.js +9 -9
  30. package/dist/delegateEvent.js.map +1 -1
  31. package/dist/dialog/_dialog.scss +6 -6
  32. package/dist/divider/_divider.scss +6 -2
  33. package/dist/draggable/useDraggable.js +4 -4
  34. package/dist/draggable/useDraggable.js.map +1 -1
  35. package/dist/draggable/utils.js +1 -1
  36. package/dist/draggable/utils.js.map +1 -1
  37. package/dist/expansion-panel/ExpansionPanel.js +1 -1
  38. package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
  39. package/dist/expansion-panel/useExpansionPanels.js +1 -1
  40. package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
  41. package/dist/files/FileInput.js +1 -1
  42. package/dist/files/FileInput.js.map +1 -1
  43. package/dist/files/createAcceptFromExtensions.d.ts +5 -0
  44. package/dist/files/createAcceptFromExtensions.js +15 -0
  45. package/dist/files/createAcceptFromExtensions.js.map +1 -0
  46. package/dist/files/useFileUpload.js +45 -41
  47. package/dist/files/useFileUpload.js.map +1 -1
  48. package/dist/files/utils.js +14 -10
  49. package/dist/files/utils.js.map +1 -1
  50. package/dist/files/validation.js +7 -8
  51. package/dist/files/validation.js.map +1 -1
  52. package/dist/focus/useFocusContainer.js +1 -1
  53. package/dist/focus/useFocusContainer.js.map +1 -1
  54. package/dist/focus/utils.js +12 -7
  55. package/dist/focus/utils.js.map +1 -1
  56. package/dist/form/InputToggleIcon.js +5 -1
  57. package/dist/form/InputToggleIcon.js.map +1 -1
  58. package/dist/form/NativeSelect.js +1 -1
  59. package/dist/form/NativeSelect.js.map +1 -1
  60. package/dist/form/Select.d.ts +24 -0
  61. package/dist/form/Select.js +19 -8
  62. package/dist/form/Select.js.map +1 -1
  63. package/dist/form/SelectedOption.d.ts +1 -2
  64. package/dist/form/SelectedOption.js +2 -2
  65. package/dist/form/SelectedOption.js.map +1 -1
  66. package/dist/form/_input-toggle.scss +6 -5
  67. package/dist/form/_label.scss +2 -2
  68. package/dist/form/_legend.scss +22 -13
  69. package/dist/form/_slider.scss +7 -5
  70. package/dist/form/_switch.scss +7 -5
  71. package/dist/form/_text-field.scss +13 -11
  72. package/dist/form/formConfig.js +1 -1
  73. package/dist/form/formConfig.js.map +1 -1
  74. package/dist/form/inputToggleStyles.js +7 -1
  75. package/dist/form/inputToggleStyles.js.map +1 -1
  76. package/dist/form/legendStyles.d.ts +1 -1
  77. package/dist/form/legendStyles.js.map +1 -1
  78. package/dist/form/selectUtils.js +2 -2
  79. package/dist/form/selectUtils.js.map +1 -1
  80. package/dist/form/useCombobox.js +1 -0
  81. package/dist/form/useCombobox.js.map +1 -1
  82. package/dist/form/useFormReset.js +2 -2
  83. package/dist/form/useFormReset.js.map +1 -1
  84. package/dist/form/useNumberField.js +1 -1
  85. package/dist/form/useNumberField.js.map +1 -1
  86. package/dist/form/useResizingTextArea.js +4 -4
  87. package/dist/form/useResizingTextArea.js.map +1 -1
  88. package/dist/form/useSelectCombobox.js +1 -1
  89. package/dist/form/useSelectCombobox.js.map +1 -1
  90. package/dist/form/validation.js +1 -1
  91. package/dist/form/validation.js.map +1 -1
  92. package/dist/hoverMode/useHoverMode.js +8 -8
  93. package/dist/hoverMode/useHoverMode.js.map +1 -1
  94. package/dist/hoverMode/useHoverModeProvider.js +3 -3
  95. package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
  96. package/dist/icon/config.js +3 -3
  97. package/dist/icon/config.js.map +1 -1
  98. package/dist/icon/materialConfig.js +1 -1
  99. package/dist/icon/materialConfig.js.map +1 -1
  100. package/dist/interaction/UserInteractionModeProvider.js +11 -10
  101. package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
  102. package/dist/interaction/_interaction.scss +5 -3
  103. package/dist/interaction/utils.js +7 -3
  104. package/dist/interaction/utils.js.map +1 -1
  105. package/dist/layout/useExpandableLayout.js +3 -4
  106. package/dist/layout/useExpandableLayout.js.map +1 -1
  107. package/dist/layout/useMainTabIndex.js +1 -1
  108. package/dist/layout/useMainTabIndex.js.map +1 -1
  109. package/dist/list/ListItem.js +1 -1
  110. package/dist/list/ListItem.js.map +1 -1
  111. package/dist/media-queries/AppSizeProvider.js +1 -1
  112. package/dist/media-queries/AppSizeProvider.js.map +1 -1
  113. package/dist/media-queries/config.js +2 -2
  114. package/dist/media-queries/config.js.map +1 -1
  115. package/dist/media-queries/useMediaQuery.js +3 -3
  116. package/dist/media-queries/useMediaQuery.js.map +1 -1
  117. package/dist/menu/Menu.js +4 -4
  118. package/dist/menu/Menu.js.map +1 -1
  119. package/dist/menu/MenuItemButton.js +1 -1
  120. package/dist/menu/MenuItemButton.js.map +1 -1
  121. package/dist/menu/MenuItemFileInput.js +1 -1
  122. package/dist/menu/MenuItemFileInput.js.map +1 -1
  123. package/dist/menu/MenuWidget.js +2 -2
  124. package/dist/menu/MenuWidget.js.map +1 -1
  125. package/dist/movement/findMatchIndex.js +2 -2
  126. package/dist/movement/findMatchIndex.js.map +1 -1
  127. package/dist/movement/useKeyboardMovementProvider.js +2 -2
  128. package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
  129. package/dist/movement/utils.js +12 -10
  130. package/dist/movement/utils.js.map +1 -1
  131. package/dist/navigation/getTableOfContentsHeadings.js +4 -3
  132. package/dist/navigation/getTableOfContentsHeadings.js.map +1 -1
  133. package/dist/navigation/useActiveHeadingId.js +9 -9
  134. package/dist/navigation/useActiveHeadingId.js.map +1 -1
  135. package/dist/navigation/useTableOfContentsHeadings.js +1 -1
  136. package/dist/navigation/useTableOfContentsHeadings.js.map +1 -1
  137. package/dist/navigation/utils.js +6 -5
  138. package/dist/navigation/utils.js.map +1 -1
  139. package/dist/portal/PortalContainerProvider.js +5 -3
  140. package/dist/portal/PortalContainerProvider.js.map +1 -1
  141. package/dist/positioning/getFixedPosition.js +2 -4
  142. package/dist/positioning/getFixedPosition.js.map +1 -1
  143. package/dist/positioning/useFixedPositioning.js +2 -2
  144. package/dist/positioning/useFixedPositioning.js.map +1 -1
  145. package/dist/positioning/utils.js +3 -3
  146. package/dist/positioning/utils.js.map +1 -1
  147. package/dist/scroll/getScrollbarWidth.js +4 -4
  148. package/dist/scroll/getScrollbarWidth.js.map +1 -1
  149. package/dist/searching/fuzzy.js +3 -2
  150. package/dist/searching/fuzzy.js.map +1 -1
  151. package/dist/searching/toSearchQuery.js +1 -1
  152. package/dist/searching/toSearchQuery.js.map +1 -1
  153. package/dist/searching/utils.js +1 -1
  154. package/dist/searching/utils.js.map +1 -1
  155. package/dist/snackbar/Toast.js +1 -1
  156. package/dist/snackbar/Toast.js.map +1 -1
  157. package/dist/snackbar/ToastContent.js +2 -2
  158. package/dist/snackbar/ToastContent.js.map +1 -1
  159. package/dist/snackbar/ToastManager.d.ts +1 -1
  160. package/dist/snackbar/ToastManager.js +11 -11
  161. package/dist/snackbar/ToastManager.js.map +1 -1
  162. package/dist/snackbar/_snackbar.scss +3 -3
  163. package/dist/spinbutton/useSpinButton.js +1 -1
  164. package/dist/spinbutton/useSpinButton.js.map +1 -1
  165. package/dist/spinbutton/utils/deselectNode.js +1 -1
  166. package/dist/spinbutton/utils/deselectNode.js.map +1 -1
  167. package/dist/spinbutton/utils/resolveInputEvent.js +1 -1
  168. package/dist/spinbutton/utils/resolveInputEvent.js.map +1 -1
  169. package/dist/spinbutton/utils/selectNode.js +1 -1
  170. package/dist/spinbutton/utils/selectNode.js.map +1 -1
  171. package/dist/storage/useStorage.js +8 -3
  172. package/dist/storage/useStorage.js.map +1 -1
  173. package/dist/table/useStickyTableSection.js +1 -1
  174. package/dist/table/useStickyTableSection.js.map +1 -1
  175. package/dist/tabs/TabList.js +2 -2
  176. package/dist/tabs/TabList.js.map +1 -1
  177. package/dist/tabs/_tabs.scss +5 -6
  178. package/dist/tabs/useMaxTabPanelHeight.js +4 -3
  179. package/dist/tabs/useMaxTabPanelHeight.js.map +1 -1
  180. package/dist/tabs/useTabList.js +1 -1
  181. package/dist/tabs/useTabList.js.map +1 -1
  182. package/dist/test-utils/jest-globals/match-media.d.ts +1 -1
  183. package/dist/test-utils/jest-globals/match-media.js +1 -1
  184. package/dist/test-utils/jest-globals/match-media.js.map +1 -1
  185. package/dist/test-utils/jest-globals/timers.js +1 -1
  186. package/dist/test-utils/jest-globals/timers.js.map +1 -1
  187. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js +1 -1
  188. package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js.map +1 -1
  189. package/dist/test-utils/mocks/ResizeObserver.js +2 -2
  190. package/dist/test-utils/mocks/ResizeObserver.js.map +1 -1
  191. package/dist/test-utils/polyfills/IntersectionObserver.js +2 -2
  192. package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
  193. package/dist/test-utils/polyfills/ResizeObserver.js +2 -2
  194. package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
  195. package/dist/test-utils/polyfills/TextDecoder.js +2 -2
  196. package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
  197. package/dist/test-utils/polyfills/TextEncoder.js +2 -2
  198. package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
  199. package/dist/test-utils/polyfills/matchMedia.js +2 -2
  200. package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
  201. package/dist/test-utils/polyfills/offsetParent.js +2 -2
  202. package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
  203. package/dist/test-utils/polyfills/scrollIntoView.js +1 -1
  204. package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
  205. package/dist/test-utils/queries/select.js +2 -2
  206. package/dist/test-utils/queries/select.js.map +1 -1
  207. package/dist/test-utils/queries/slider.js +1 -1
  208. package/dist/test-utils/queries/slider.js.map +1 -1
  209. package/dist/test-utils/utils/createFileList.js +2 -0
  210. package/dist/test-utils/utils/createFileList.js.map +1 -1
  211. package/dist/test-utils/utils/createMatchMediaSpy.d.ts +1 -1
  212. package/dist/test-utils/utils/createMatchMediaSpy.js +3 -3
  213. package/dist/test-utils/utils/createMatchMediaSpy.js.map +1 -1
  214. package/dist/test-utils/vitest/match-media.d.ts +1 -1
  215. package/dist/test-utils/vitest/match-media.js +1 -1
  216. package/dist/test-utils/vitest/match-media.js.map +1 -1
  217. package/dist/test-utils/vitest/timers.js +1 -1
  218. package/dist/test-utils/vitest/timers.js.map +1 -1
  219. package/dist/test-utils/vitest/uploadMenuItemFileInput.js +1 -1
  220. package/dist/test-utils/vitest/uploadMenuItemFileInput.js.map +1 -1
  221. package/dist/theme/ThemeProvider.js +2 -2
  222. package/dist/theme/ThemeProvider.js.map +1 -1
  223. package/dist/theme/_a11y.scss +3 -1
  224. package/dist/theme/_theme.scss +16 -12
  225. package/dist/theme/getDerivedTheme.js +1 -1
  226. package/dist/theme/getDerivedTheme.js.map +1 -1
  227. package/dist/theme/useCSSVariables.js +5 -5
  228. package/dist/theme/useCSSVariables.js.map +1 -1
  229. package/dist/theme/useColorSchemeMetaTag.js +2 -2
  230. package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
  231. package/dist/theme/useInlineCSSVariables.js +4 -3
  232. package/dist/theme/useInlineCSSVariables.js.map +1 -1
  233. package/dist/theme/utils.js +8 -8
  234. package/dist/theme/utils.js.map +1 -1
  235. package/dist/tooltip/useTooltip.js +7 -7
  236. package/dist/tooltip/useTooltip.js.map +1 -1
  237. package/dist/tooltip/useTooltipPosition.js +1 -1
  238. package/dist/tooltip/useTooltipPosition.js.map +1 -1
  239. package/dist/transition/useCarousel.js +2 -2
  240. package/dist/transition/useCarousel.js.map +1 -1
  241. package/dist/transition/useCollapseTransition.js +1 -1
  242. package/dist/transition/useCollapseTransition.js.map +1 -1
  243. package/dist/transition/useSkeletonPlaceholder.js +4 -4
  244. package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
  245. package/dist/transition/useTransition.js +2 -2
  246. package/dist/transition/useTransition.js.map +1 -1
  247. package/dist/transition/utils.js +5 -5
  248. package/dist/transition/utils.js.map +1 -1
  249. package/dist/tree/TreeItem.js +1 -1
  250. package/dist/tree/TreeItem.js.map +1 -1
  251. package/dist/tree/useTreeItems.js +7 -5
  252. package/dist/tree/useTreeItems.js.map +1 -1
  253. package/dist/tree/useTreeMovement.js +1 -1
  254. package/dist/tree/useTreeMovement.js.map +1 -1
  255. package/dist/tree/utils.js +6 -9
  256. package/dist/tree/utils.js.map +1 -1
  257. package/dist/typography/HighlightText.js +2 -1
  258. package/dist/typography/HighlightText.js.map +1 -1
  259. package/dist/typography/SrOnly.js +7 -1
  260. package/dist/typography/SrOnly.js.map +1 -1
  261. package/dist/useDebouncedFunction.js +4 -4
  262. package/dist/useDebouncedFunction.js.map +1 -1
  263. package/dist/useDropzone.js +9 -9
  264. package/dist/useDropzone.js.map +1 -1
  265. package/dist/useEnsuredState.js +5 -5
  266. package/dist/useEnsuredState.js.map +1 -1
  267. package/dist/useIntersectionObserver.js +3 -3
  268. package/dist/useIntersectionObserver.js.map +1 -1
  269. package/dist/useIsomorphicLayoutEffect.js +1 -1
  270. package/dist/useIsomorphicLayoutEffect.js.map +1 -1
  271. package/dist/useOrientation.js +1 -1
  272. package/dist/useOrientation.js.map +1 -1
  273. package/dist/useReadonlySet.js +1 -1
  274. package/dist/useReadonlySet.js.map +1 -1
  275. package/dist/useResizeListener.js +2 -2
  276. package/dist/useResizeListener.js.map +1 -1
  277. package/dist/useResizeObserver.js +3 -4
  278. package/dist/useResizeObserver.js.map +1 -1
  279. package/dist/useThrottledFunction.js +3 -3
  280. package/dist/useThrottledFunction.js.map +1 -1
  281. package/dist/useWindowSize.js +1 -1
  282. package/dist/useWindowSize.js.map +1 -1
  283. package/dist/utils/alphaNumericSort.js +3 -1
  284. package/dist/utils/alphaNumericSort.js.map +1 -1
  285. package/dist/utils/bem.js +9 -12
  286. package/dist/utils/bem.js.map +1 -1
  287. package/dist/utils/getNumberOfDigits.js +1 -0
  288. package/dist/utils/getNumberOfDigits.js.map +1 -1
  289. package/dist/utils/getRangeDefaultValue.js +1 -1
  290. package/dist/utils/getRangeDefaultValue.js.map +1 -1
  291. package/dist/utils/nearest.js +2 -2
  292. package/dist/utils/nearest.js.map +1 -1
  293. package/dist/utils/parseCssLengthUnit.js +3 -3
  294. package/dist/utils/parseCssLengthUnit.js.map +1 -1
  295. package/dist/utils/trigonometry.js +1 -1
  296. package/dist/utils/trigonometry.js.map +1 -1
  297. package/dist/window-splitter/_window-splitter.scss +15 -17
  298. package/package.json +9 -7
  299. package/src/autocomplete/AutocompleteChip.tsx +2 -2
  300. package/src/autocomplete/AutocompleteListboxChildren.tsx +1 -1
  301. package/src/autocomplete/useAutocomplete.ts +4 -4
  302. package/src/autocomplete/utils.ts +3 -3
  303. package/src/box/styles.ts +2 -2
  304. package/src/button/AsyncButton.tsx +1 -3
  305. package/src/chip/Chip.tsx +1 -2
  306. package/src/cssUtils.ts +12 -6
  307. package/src/datetime/useTimeField.ts +1 -1
  308. package/src/delegateEvent.ts +9 -9
  309. package/src/draggable/useDraggable.ts +4 -4
  310. package/src/draggable/utils.ts +1 -1
  311. package/src/expansion-panel/ExpansionPanel.tsx +1 -1
  312. package/src/expansion-panel/useExpansionPanels.ts +1 -1
  313. package/src/files/FileInput.tsx +1 -1
  314. package/src/files/createAcceptFromExtensions.ts +18 -0
  315. package/src/files/useFileUpload.ts +36 -37
  316. package/src/files/utils.ts +15 -11
  317. package/src/files/validation.ts +7 -9
  318. package/src/focus/useFocusContainer.ts +1 -1
  319. package/src/focus/utils.ts +11 -6
  320. package/src/form/InputToggleIcon.tsx +5 -5
  321. package/src/form/NativeSelect.tsx +1 -1
  322. package/src/form/Select.tsx +58 -7
  323. package/src/form/SelectedOption.tsx +2 -4
  324. package/src/form/formConfig.ts +1 -1
  325. package/src/form/inputToggleStyles.ts +9 -4
  326. package/src/form/legendStyles.ts +1 -1
  327. package/src/form/selectUtils.ts +2 -2
  328. package/src/form/useCombobox.ts +1 -0
  329. package/src/form/useFormReset.ts +2 -2
  330. package/src/form/useNumberField.ts +1 -1
  331. package/src/form/useResizingTextArea.ts +5 -5
  332. package/src/form/useSelectCombobox.ts +1 -4
  333. package/src/form/validation.ts +1 -1
  334. package/src/hoverMode/useHoverMode.ts +9 -9
  335. package/src/hoverMode/useHoverModeProvider.ts +4 -4
  336. package/src/icon/config.tsx +3 -3
  337. package/src/icon/materialConfig.ts +1 -1
  338. package/src/interaction/UserInteractionModeProvider.tsx +11 -10
  339. package/src/interaction/utils.ts +3 -3
  340. package/src/layout/useExpandableLayout.ts +3 -4
  341. package/src/layout/useMainTabIndex.ts +1 -1
  342. package/src/list/ListItem.tsx +1 -1
  343. package/src/media-queries/AppSizeProvider.tsx +1 -1
  344. package/src/media-queries/config.ts +2 -2
  345. package/src/media-queries/useMediaQuery.ts +3 -3
  346. package/src/menu/Menu.tsx +4 -4
  347. package/src/menu/MenuItemButton.tsx +1 -1
  348. package/src/menu/MenuItemFileInput.tsx +1 -1
  349. package/src/menu/MenuWidget.tsx +6 -4
  350. package/src/movement/findMatchIndex.ts +2 -2
  351. package/src/movement/useKeyboardMovementProvider.ts +2 -2
  352. package/src/movement/utils.ts +15 -14
  353. package/src/navigation/getTableOfContentsHeadings.ts +4 -3
  354. package/src/navigation/useActiveHeadingId.ts +8 -8
  355. package/src/navigation/useTableOfContentsHeadings.ts +1 -1
  356. package/src/navigation/utils.ts +6 -5
  357. package/src/portal/PortalContainerProvider.tsx +5 -3
  358. package/src/positioning/getFixedPosition.ts +9 -6
  359. package/src/positioning/useFixedPositioning.ts +2 -2
  360. package/src/positioning/utils.ts +3 -3
  361. package/src/scroll/getScrollbarWidth.ts +4 -4
  362. package/src/searching/fuzzy.ts +7 -3
  363. package/src/searching/toSearchQuery.ts +1 -1
  364. package/src/searching/utils.ts +1 -1
  365. package/src/snackbar/Toast.tsx +1 -1
  366. package/src/snackbar/ToastContent.tsx +2 -2
  367. package/src/snackbar/ToastManager.ts +11 -12
  368. package/src/spinbutton/useSpinButton.ts +1 -1
  369. package/src/spinbutton/utils/deselectNode.ts +1 -1
  370. package/src/spinbutton/utils/resolveInputEvent.ts +1 -1
  371. package/src/spinbutton/utils/selectNode.ts +1 -1
  372. package/src/storage/useStorage.ts +7 -2
  373. package/src/table/useStickyTableSection.tsx +1 -1
  374. package/src/tabs/TabList.tsx +2 -2
  375. package/src/tabs/useMaxTabPanelHeight.ts +6 -3
  376. package/src/tabs/useTabList.ts +2 -2
  377. package/src/test-utils/jest-globals/match-media.ts +5 -2
  378. package/src/test-utils/jest-globals/timers.ts +1 -1
  379. package/src/test-utils/jest-globals/uploadMenuItemFileInput.ts +1 -1
  380. package/src/test-utils/mocks/ResizeObserver.ts +2 -2
  381. package/src/test-utils/polyfills/IntersectionObserver.ts +2 -2
  382. package/src/test-utils/polyfills/ResizeObserver.ts +2 -2
  383. package/src/test-utils/polyfills/TextDecoder.ts +2 -2
  384. package/src/test-utils/polyfills/TextEncoder.ts +2 -2
  385. package/src/test-utils/polyfills/matchMedia.ts +5 -2
  386. package/src/test-utils/polyfills/offsetParent.ts +2 -2
  387. package/src/test-utils/polyfills/scrollIntoView.ts +1 -1
  388. package/src/test-utils/queries/select.ts +2 -2
  389. package/src/test-utils/queries/slider.ts +1 -1
  390. package/src/test-utils/utils/createFileList.ts +2 -0
  391. package/src/test-utils/utils/createMatchMediaSpy.ts +4 -4
  392. package/src/test-utils/vitest/match-media.ts +2 -2
  393. package/src/test-utils/vitest/timers.ts +1 -1
  394. package/src/test-utils/vitest/uploadMenuItemFileInput.ts +1 -1
  395. package/src/theme/ThemeProvider.tsx +2 -2
  396. package/src/theme/getDerivedTheme.ts +1 -1
  397. package/src/theme/useCSSVariables.ts +5 -5
  398. package/src/theme/useColorSchemeMetaTag.ts +2 -2
  399. package/src/theme/useInlineCSSVariables.ts +6 -7
  400. package/src/theme/utils.ts +8 -8
  401. package/src/tooltip/useTooltip.ts +7 -7
  402. package/src/tooltip/useTooltipPosition.ts +1 -1
  403. package/src/transition/useCarousel.ts +2 -2
  404. package/src/transition/useCollapseTransition.ts +1 -1
  405. package/src/transition/useSkeletonPlaceholder.ts +4 -4
  406. package/src/transition/useTransition.ts +2 -2
  407. package/src/transition/utils.ts +5 -5
  408. package/src/tree/TreeItem.tsx +1 -1
  409. package/src/tree/useTreeItems.ts +5 -5
  410. package/src/tree/useTreeMovement.ts +1 -1
  411. package/src/tree/utils.ts +9 -9
  412. package/src/typography/HighlightText.tsx +4 -3
  413. package/src/typography/SrOnly.tsx +9 -2
  414. package/src/useDebouncedFunction.ts +5 -5
  415. package/src/useDropzone.ts +10 -10
  416. package/src/useEnsuredState.ts +5 -5
  417. package/src/useIntersectionObserver.ts +3 -3
  418. package/src/useIsomorphicLayoutEffect.ts +3 -3
  419. package/src/useOrientation.ts +1 -1
  420. package/src/useReadonlySet.ts +3 -1
  421. package/src/useResizeListener.ts +2 -2
  422. package/src/useResizeObserver.ts +3 -4
  423. package/src/useThrottledFunction.ts +4 -4
  424. package/src/useWindowSize.ts +1 -1
  425. package/src/utils/alphaNumericSort.ts +1 -1
  426. package/src/utils/bem.ts +15 -16
  427. package/src/utils/getNumberOfDigits.ts +1 -0
  428. package/src/utils/getRangeDefaultValue.ts +1 -1
  429. package/src/utils/nearest.ts +5 -2
  430. package/src/utils/parseCssLengthUnit.ts +5 -4
  431. package/src/utils/trigonometry.ts +1 -1
@@ -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
 
@@ -314,7 +314,7 @@ export function useCollapseTransition<E extends HTMLElement>(
314
314
  const [nodeRef, refCallback] = useEnsuredRef(propNodeRef);
315
315
  const [style, setStyle] = useState<CSSProperties | undefined>(() => {
316
316
  if (transitionIn) {
317
- return undefined;
317
+ return;
318
318
  }
319
319
 
320
320
  return {
@@ -238,10 +238,10 @@ export function useSkeletonPlaceholder(
238
238
  } = options;
239
239
  const ssr = useSsr();
240
240
 
241
- const isDefinedWidth = typeof propWidth !== "undefined";
242
- const isDefinedDelay = typeof propDelay !== "undefined";
241
+ const isDefinedWidth = propWidth !== undefined;
242
+ const isDefinedDelay = propDelay !== undefined;
243
243
  const [randomStyles, setRandomStyles] = useState<CSSProperties>(() => {
244
- if (typeof window === "undefined" || ssr || disabled) {
244
+ if (globalThis.window === undefined || ssr || disabled) {
245
245
  return {};
246
246
  }
247
247
 
@@ -289,7 +289,7 @@ export function useSkeletonPlaceholder(
289
289
  }
290
290
 
291
291
  let style: CSSProperties | undefined = propStyle;
292
- if (!!width || !!animationDelay || typeof height !== "undefined") {
292
+ if (!!width || !!animationDelay || height !== undefined) {
293
293
  style = {
294
294
  ...style,
295
295
  height: height ?? style?.height,
@@ -271,12 +271,12 @@ export function useTransition<E extends HTMLElement>(
271
271
  return;
272
272
  }
273
273
 
274
- const timer = window.setTimeout(() => {
274
+ const timer = globalThis.setTimeout(() => {
275
275
  dispatch(dispatchStage);
276
276
  }, duration);
277
277
 
278
278
  return () => {
279
- window.clearTimeout(timer);
279
+ globalThis.clearTimeout(timer);
280
280
  };
281
281
  }, [appearing, ref, ssr, stage, temporary, transitionIn]);
282
282
 
@@ -71,24 +71,24 @@ export function getElementSizing(element: HTMLElement | null): CollapseSizing {
71
71
  cloned.style.visibility = "hidden";
72
72
 
73
73
  const container = element.parentElement || document.body;
74
- container.appendChild(cloned);
74
+ container.append(cloned);
75
75
  maxHeight = cloned.scrollHeight;
76
- const style = window.getComputedStyle(cloned);
76
+ const style = globalThis.getComputedStyle(cloned);
77
77
  const isContentBox = style.boxSizing === "content-box";
78
78
  if (style.paddingTop) {
79
- paddingTop = parseFloat(style.paddingTop);
79
+ paddingTop = Number.parseFloat(style.paddingTop);
80
80
  if (isContentBox) {
81
81
  maxHeight += paddingTop;
82
82
  }
83
83
  }
84
84
 
85
85
  if (style.paddingBottom) {
86
- paddingBottom = parseFloat(style.paddingBottom);
86
+ paddingBottom = Number.parseFloat(style.paddingBottom);
87
87
  if (isContentBox) {
88
88
  maxHeight += paddingBottom;
89
89
  }
90
90
  }
91
- container.removeChild(cloned);
91
+ cloned.remove();
92
92
  }
93
93
 
94
94
  return { maxHeight, paddingTop, paddingBottom };
@@ -225,7 +225,7 @@ export function TreeItem(props: TreeItemProps): ReactElement {
225
225
  const leftAddonType =
226
226
  (propLeftAddonType ?? (expanderLeft && leftAddon)) ? "media" : undefined;
227
227
  const isMediaLeftAddon =
228
- typeof propLeftAddonType === "undefined" && leftAddonType === "media";
228
+ propLeftAddonType === undefined && leftAddonType === "media";
229
229
  const disableLeftAddonCenteredMedia =
230
230
  propDisableLeftAddonCenteredMedia ?? isMediaLeftAddon;
231
231