@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.
- package/dist/_utils.scss +5 -1
- package/dist/autocomplete/AutocompleteChip.js +2 -2
- package/dist/autocomplete/AutocompleteChip.js.map +1 -1
- package/dist/autocomplete/AutocompleteListboxChildren.js +1 -1
- package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
- package/dist/autocomplete/useAutocomplete.js +4 -4
- package/dist/autocomplete/useAutocomplete.js.map +1 -1
- package/dist/autocomplete/utils.js +3 -3
- package/dist/autocomplete/utils.js.map +1 -1
- package/dist/box/styles.js +2 -2
- package/dist/box/styles.js.map +1 -1
- package/dist/button/AsyncButton.js +1 -1
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/chip/Chip.js +1 -1
- package/dist/chip/Chip.js.map +1 -1
- package/dist/cssUtils.d.ts +11 -6
- package/dist/cssUtils.js.map +1 -1
- package/dist/datetime/useTimeField.js +1 -1
- package/dist/datetime/useTimeField.js.map +1 -1
- package/dist/delegateEvent.js +9 -9
- package/dist/delegateEvent.js.map +1 -1
- package/dist/draggable/useDraggable.js +4 -4
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/draggable/utils.js +1 -1
- package/dist/draggable/utils.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanel.js +1 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/useExpansionPanels.js +1 -1
- package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
- package/dist/files/FileInput.js +1 -1
- package/dist/files/FileInput.js.map +1 -1
- package/dist/files/createAcceptFromExtensions.d.ts +5 -0
- package/dist/files/createAcceptFromExtensions.js +15 -0
- package/dist/files/createAcceptFromExtensions.js.map +1 -0
- package/dist/files/useFileUpload.js +45 -41
- package/dist/files/useFileUpload.js.map +1 -1
- package/dist/files/utils.js +14 -10
- package/dist/files/utils.js.map +1 -1
- package/dist/files/validation.js +7 -8
- package/dist/files/validation.js.map +1 -1
- package/dist/focus/useFocusContainer.js +1 -1
- package/dist/focus/useFocusContainer.js.map +1 -1
- package/dist/focus/utils.js +12 -7
- package/dist/focus/utils.js.map +1 -1
- package/dist/form/InputToggleIcon.js +5 -1
- package/dist/form/InputToggleIcon.js.map +1 -1
- package/dist/form/NativeSelect.js +1 -1
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/Select.js +5 -5
- package/dist/form/Select.js.map +1 -1
- package/dist/form/formConfig.js +1 -1
- package/dist/form/formConfig.js.map +1 -1
- package/dist/form/inputToggleStyles.js +7 -1
- package/dist/form/inputToggleStyles.js.map +1 -1
- package/dist/form/selectUtils.js +2 -2
- package/dist/form/selectUtils.js.map +1 -1
- package/dist/form/useCombobox.js +1 -0
- package/dist/form/useCombobox.js.map +1 -1
- package/dist/form/useFormReset.js +2 -2
- package/dist/form/useFormReset.js.map +1 -1
- package/dist/form/useNumberField.js +1 -1
- package/dist/form/useNumberField.js.map +1 -1
- package/dist/form/useResizingTextArea.js +4 -4
- package/dist/form/useResizingTextArea.js.map +1 -1
- package/dist/form/useSelectCombobox.js +1 -1
- package/dist/form/useSelectCombobox.js.map +1 -1
- package/dist/form/validation.js +1 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hoverMode/useHoverMode.js +8 -8
- package/dist/hoverMode/useHoverMode.js.map +1 -1
- package/dist/hoverMode/useHoverModeProvider.js +3 -3
- package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
- package/dist/icon/config.js +3 -3
- package/dist/icon/config.js.map +1 -1
- package/dist/icon/materialConfig.js +1 -1
- package/dist/icon/materialConfig.js.map +1 -1
- package/dist/interaction/UserInteractionModeProvider.js +11 -10
- package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
- package/dist/interaction/utils.js +7 -3
- package/dist/interaction/utils.js.map +1 -1
- package/dist/layout/useExpandableLayout.js +3 -4
- package/dist/layout/useExpandableLayout.js.map +1 -1
- package/dist/layout/useMainTabIndex.js +1 -1
- package/dist/layout/useMainTabIndex.js.map +1 -1
- package/dist/list/ListItem.js +1 -1
- package/dist/list/ListItem.js.map +1 -1
- package/dist/media-queries/AppSizeProvider.js +1 -1
- package/dist/media-queries/AppSizeProvider.js.map +1 -1
- package/dist/media-queries/config.js +2 -2
- package/dist/media-queries/config.js.map +1 -1
- package/dist/media-queries/useMediaQuery.js +3 -3
- package/dist/media-queries/useMediaQuery.js.map +1 -1
- package/dist/menu/Menu.js +4 -4
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuItemButton.js +1 -1
- package/dist/menu/MenuItemButton.js.map +1 -1
- package/dist/menu/MenuItemFileInput.js +1 -1
- package/dist/menu/MenuItemFileInput.js.map +1 -1
- package/dist/menu/MenuWidget.js +2 -2
- package/dist/menu/MenuWidget.js.map +1 -1
- package/dist/movement/findMatchIndex.js +2 -2
- package/dist/movement/findMatchIndex.js.map +1 -1
- package/dist/movement/useKeyboardMovementProvider.js +2 -2
- package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
- package/dist/movement/utils.js +12 -10
- package/dist/movement/utils.js.map +1 -1
- package/dist/navigation/getTableOfContentsHeadings.js +4 -3
- package/dist/navigation/getTableOfContentsHeadings.js.map +1 -1
- package/dist/navigation/useActiveHeadingId.js +9 -9
- package/dist/navigation/useActiveHeadingId.js.map +1 -1
- package/dist/navigation/useTableOfContentsHeadings.js +1 -1
- package/dist/navigation/useTableOfContentsHeadings.js.map +1 -1
- package/dist/navigation/utils.js +6 -5
- package/dist/navigation/utils.js.map +1 -1
- package/dist/portal/PortalContainerProvider.js +5 -3
- package/dist/portal/PortalContainerProvider.js.map +1 -1
- package/dist/positioning/getFixedPosition.js +2 -4
- package/dist/positioning/getFixedPosition.js.map +1 -1
- package/dist/positioning/useFixedPositioning.js +2 -2
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/positioning/utils.js +3 -3
- package/dist/positioning/utils.js.map +1 -1
- package/dist/scroll/getScrollbarWidth.js +4 -4
- package/dist/scroll/getScrollbarWidth.js.map +1 -1
- package/dist/searching/fuzzy.js +3 -2
- package/dist/searching/fuzzy.js.map +1 -1
- package/dist/searching/toSearchQuery.js +1 -1
- package/dist/searching/toSearchQuery.js.map +1 -1
- package/dist/searching/utils.js +1 -1
- package/dist/searching/utils.js.map +1 -1
- package/dist/snackbar/Toast.js +1 -1
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/ToastContent.js +2 -2
- package/dist/snackbar/ToastContent.js.map +1 -1
- package/dist/snackbar/ToastManager.d.ts +1 -1
- package/dist/snackbar/ToastManager.js +11 -11
- package/dist/snackbar/ToastManager.js.map +1 -1
- package/dist/spinbutton/useSpinButton.js +1 -1
- package/dist/spinbutton/useSpinButton.js.map +1 -1
- package/dist/spinbutton/utils/deselectNode.js +1 -1
- package/dist/spinbutton/utils/deselectNode.js.map +1 -1
- package/dist/spinbutton/utils/resolveInputEvent.js +1 -1
- package/dist/spinbutton/utils/resolveInputEvent.js.map +1 -1
- package/dist/spinbutton/utils/selectNode.js +1 -1
- package/dist/spinbutton/utils/selectNode.js.map +1 -1
- package/dist/storage/useStorage.js +8 -3
- package/dist/storage/useStorage.js.map +1 -1
- package/dist/table/useStickyTableSection.js +1 -1
- package/dist/table/useStickyTableSection.js.map +1 -1
- package/dist/tabs/TabList.js +2 -2
- package/dist/tabs/TabList.js.map +1 -1
- package/dist/tabs/useMaxTabPanelHeight.js +4 -3
- package/dist/tabs/useMaxTabPanelHeight.js.map +1 -1
- package/dist/tabs/useTabList.js +1 -1
- package/dist/tabs/useTabList.js.map +1 -1
- package/dist/test-utils/jest-globals/match-media.d.ts +1 -1
- package/dist/test-utils/jest-globals/match-media.js +1 -1
- package/dist/test-utils/jest-globals/match-media.js.map +1 -1
- package/dist/test-utils/jest-globals/timers.js +1 -1
- package/dist/test-utils/jest-globals/timers.js.map +1 -1
- package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js +1 -1
- package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js.map +1 -1
- package/dist/test-utils/mocks/ResizeObserver.js +2 -2
- package/dist/test-utils/mocks/ResizeObserver.js.map +1 -1
- package/dist/test-utils/polyfills/IntersectionObserver.js +2 -2
- package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
- package/dist/test-utils/polyfills/ResizeObserver.js +2 -2
- package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
- package/dist/test-utils/polyfills/TextDecoder.js +2 -2
- package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
- package/dist/test-utils/polyfills/TextEncoder.js +2 -2
- package/dist/test-utils/polyfills/TextEncoder.js.map +1 -1
- package/dist/test-utils/polyfills/matchMedia.js +2 -2
- package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
- package/dist/test-utils/polyfills/offsetParent.js +2 -2
- package/dist/test-utils/polyfills/offsetParent.js.map +1 -1
- package/dist/test-utils/polyfills/scrollIntoView.js +1 -1
- package/dist/test-utils/polyfills/scrollIntoView.js.map +1 -1
- package/dist/test-utils/queries/select.js +2 -2
- package/dist/test-utils/queries/select.js.map +1 -1
- package/dist/test-utils/queries/slider.js +1 -1
- package/dist/test-utils/queries/slider.js.map +1 -1
- package/dist/test-utils/utils/createFileList.js +2 -0
- package/dist/test-utils/utils/createFileList.js.map +1 -1
- package/dist/test-utils/utils/createMatchMediaSpy.d.ts +1 -1
- package/dist/test-utils/utils/createMatchMediaSpy.js +3 -3
- package/dist/test-utils/utils/createMatchMediaSpy.js.map +1 -1
- package/dist/test-utils/vitest/match-media.d.ts +1 -1
- package/dist/test-utils/vitest/match-media.js +1 -1
- package/dist/test-utils/vitest/match-media.js.map +1 -1
- package/dist/test-utils/vitest/timers.js +1 -1
- package/dist/test-utils/vitest/timers.js.map +1 -1
- package/dist/test-utils/vitest/uploadMenuItemFileInput.js +1 -1
- package/dist/test-utils/vitest/uploadMenuItemFileInput.js.map +1 -1
- package/dist/theme/ThemeProvider.js +2 -2
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/getDerivedTheme.js +1 -1
- package/dist/theme/getDerivedTheme.js.map +1 -1
- package/dist/theme/useCSSVariables.js +5 -5
- package/dist/theme/useCSSVariables.js.map +1 -1
- package/dist/theme/useColorSchemeMetaTag.js +2 -2
- package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
- package/dist/theme/useInlineCSSVariables.js +4 -3
- package/dist/theme/useInlineCSSVariables.js.map +1 -1
- package/dist/theme/utils.js +8 -8
- package/dist/theme/utils.js.map +1 -1
- package/dist/tooltip/useTooltip.js +7 -7
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/tooltip/useTooltipPosition.js +1 -1
- package/dist/tooltip/useTooltipPosition.js.map +1 -1
- package/dist/transition/useCarousel.js +2 -2
- package/dist/transition/useCarousel.js.map +1 -1
- package/dist/transition/useCollapseTransition.js +1 -1
- package/dist/transition/useCollapseTransition.js.map +1 -1
- package/dist/transition/useSkeletonPlaceholder.js +4 -4
- package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
- package/dist/transition/useTransition.js +2 -2
- package/dist/transition/useTransition.js.map +1 -1
- package/dist/transition/utils.js +5 -5
- package/dist/transition/utils.js.map +1 -1
- package/dist/tree/TreeItem.js +1 -1
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/useTreeItems.js +7 -5
- package/dist/tree/useTreeItems.js.map +1 -1
- package/dist/tree/useTreeMovement.js +1 -1
- package/dist/tree/useTreeMovement.js.map +1 -1
- package/dist/tree/utils.js +6 -9
- package/dist/tree/utils.js.map +1 -1
- package/dist/typography/HighlightText.js +2 -1
- package/dist/typography/HighlightText.js.map +1 -1
- package/dist/typography/SrOnly.js +7 -1
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/useDebouncedFunction.js +4 -4
- package/dist/useDebouncedFunction.js.map +1 -1
- package/dist/useDropzone.js +9 -9
- package/dist/useDropzone.js.map +1 -1
- package/dist/useEnsuredState.js +5 -5
- package/dist/useEnsuredState.js.map +1 -1
- package/dist/useIntersectionObserver.js +3 -3
- package/dist/useIntersectionObserver.js.map +1 -1
- package/dist/useIsomorphicLayoutEffect.js +1 -1
- package/dist/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/useOrientation.js +1 -1
- package/dist/useOrientation.js.map +1 -1
- package/dist/useReadonlySet.js +1 -1
- package/dist/useReadonlySet.js.map +1 -1
- package/dist/useResizeListener.js +2 -2
- package/dist/useResizeListener.js.map +1 -1
- package/dist/useResizeObserver.js +3 -4
- package/dist/useResizeObserver.js.map +1 -1
- package/dist/useThrottledFunction.js +3 -3
- package/dist/useThrottledFunction.js.map +1 -1
- package/dist/useWindowSize.js +1 -1
- package/dist/useWindowSize.js.map +1 -1
- package/dist/utils/alphaNumericSort.js +3 -1
- package/dist/utils/alphaNumericSort.js.map +1 -1
- package/dist/utils/bem.js +9 -12
- package/dist/utils/bem.js.map +1 -1
- package/dist/utils/getNumberOfDigits.js +1 -0
- package/dist/utils/getNumberOfDigits.js.map +1 -1
- package/dist/utils/getRangeDefaultValue.js +1 -1
- package/dist/utils/getRangeDefaultValue.js.map +1 -1
- package/dist/utils/nearest.js +2 -2
- package/dist/utils/nearest.js.map +1 -1
- package/dist/utils/parseCssLengthUnit.js +3 -3
- package/dist/utils/parseCssLengthUnit.js.map +1 -1
- package/dist/utils/trigonometry.js +1 -1
- package/dist/utils/trigonometry.js.map +1 -1
- package/package.json +3 -1
- package/src/autocomplete/AutocompleteChip.tsx +2 -2
- package/src/autocomplete/AutocompleteListboxChildren.tsx +1 -1
- package/src/autocomplete/useAutocomplete.ts +4 -4
- package/src/autocomplete/utils.ts +3 -3
- package/src/box/styles.ts +2 -2
- package/src/button/AsyncButton.tsx +1 -3
- package/src/chip/Chip.tsx +1 -2
- package/src/cssUtils.ts +12 -6
- package/src/datetime/useTimeField.ts +1 -1
- package/src/delegateEvent.ts +9 -9
- package/src/draggable/useDraggable.ts +4 -4
- package/src/draggable/utils.ts +1 -1
- package/src/expansion-panel/ExpansionPanel.tsx +1 -1
- package/src/expansion-panel/useExpansionPanels.ts +1 -1
- package/src/files/FileInput.tsx +1 -1
- package/src/files/createAcceptFromExtensions.ts +18 -0
- package/src/files/useFileUpload.ts +36 -37
- package/src/files/utils.ts +15 -11
- package/src/files/validation.ts +7 -9
- package/src/focus/useFocusContainer.ts +1 -1
- package/src/focus/utils.ts +11 -6
- package/src/form/InputToggleIcon.tsx +5 -5
- package/src/form/NativeSelect.tsx +1 -1
- package/src/form/Select.tsx +5 -5
- package/src/form/formConfig.ts +1 -1
- package/src/form/inputToggleStyles.ts +9 -4
- package/src/form/selectUtils.ts +2 -2
- package/src/form/useCombobox.ts +1 -0
- package/src/form/useFormReset.ts +2 -2
- package/src/form/useNumberField.ts +1 -1
- package/src/form/useResizingTextArea.ts +5 -5
- package/src/form/useSelectCombobox.ts +1 -4
- package/src/form/validation.ts +1 -1
- package/src/hoverMode/useHoverMode.ts +9 -9
- package/src/hoverMode/useHoverModeProvider.ts +4 -4
- package/src/icon/config.tsx +3 -3
- package/src/icon/materialConfig.ts +1 -1
- package/src/interaction/UserInteractionModeProvider.tsx +11 -10
- package/src/interaction/utils.ts +3 -3
- package/src/layout/useExpandableLayout.ts +3 -4
- package/src/layout/useMainTabIndex.ts +1 -1
- package/src/list/ListItem.tsx +1 -1
- package/src/media-queries/AppSizeProvider.tsx +1 -1
- package/src/media-queries/config.ts +2 -2
- package/src/media-queries/useMediaQuery.ts +3 -3
- package/src/menu/Menu.tsx +4 -4
- package/src/menu/MenuItemButton.tsx +1 -1
- package/src/menu/MenuItemFileInput.tsx +1 -1
- package/src/menu/MenuWidget.tsx +6 -4
- package/src/movement/findMatchIndex.ts +2 -2
- package/src/movement/useKeyboardMovementProvider.ts +2 -2
- package/src/movement/utils.ts +15 -14
- package/src/navigation/getTableOfContentsHeadings.ts +4 -3
- package/src/navigation/useActiveHeadingId.ts +8 -8
- package/src/navigation/useTableOfContentsHeadings.ts +1 -1
- package/src/navigation/utils.ts +6 -5
- package/src/portal/PortalContainerProvider.tsx +5 -3
- package/src/positioning/getFixedPosition.ts +9 -6
- package/src/positioning/useFixedPositioning.ts +2 -2
- package/src/positioning/utils.ts +3 -3
- package/src/scroll/getScrollbarWidth.ts +4 -4
- package/src/searching/fuzzy.ts +7 -3
- package/src/searching/toSearchQuery.ts +1 -1
- package/src/searching/utils.ts +1 -1
- package/src/snackbar/Toast.tsx +1 -1
- package/src/snackbar/ToastContent.tsx +2 -2
- package/src/snackbar/ToastManager.ts +11 -12
- package/src/spinbutton/useSpinButton.ts +1 -1
- package/src/spinbutton/utils/deselectNode.ts +1 -1
- package/src/spinbutton/utils/resolveInputEvent.ts +1 -1
- package/src/spinbutton/utils/selectNode.ts +1 -1
- package/src/storage/useStorage.ts +7 -2
- package/src/table/useStickyTableSection.tsx +1 -1
- package/src/tabs/TabList.tsx +2 -2
- package/src/tabs/useMaxTabPanelHeight.ts +6 -3
- package/src/tabs/useTabList.ts +2 -2
- package/src/test-utils/jest-globals/match-media.ts +5 -2
- package/src/test-utils/jest-globals/timers.ts +1 -1
- package/src/test-utils/jest-globals/uploadMenuItemFileInput.ts +1 -1
- package/src/test-utils/mocks/ResizeObserver.ts +2 -2
- package/src/test-utils/polyfills/IntersectionObserver.ts +2 -2
- package/src/test-utils/polyfills/ResizeObserver.ts +2 -2
- package/src/test-utils/polyfills/TextDecoder.ts +2 -2
- package/src/test-utils/polyfills/TextEncoder.ts +2 -2
- package/src/test-utils/polyfills/matchMedia.ts +5 -2
- package/src/test-utils/polyfills/offsetParent.ts +2 -2
- package/src/test-utils/polyfills/scrollIntoView.ts +1 -1
- package/src/test-utils/queries/select.ts +2 -2
- package/src/test-utils/queries/slider.ts +1 -1
- package/src/test-utils/utils/createFileList.ts +2 -0
- package/src/test-utils/utils/createMatchMediaSpy.ts +4 -4
- package/src/test-utils/vitest/match-media.ts +2 -2
- package/src/test-utils/vitest/timers.ts +1 -1
- package/src/test-utils/vitest/uploadMenuItemFileInput.ts +1 -1
- package/src/theme/ThemeProvider.tsx +2 -2
- package/src/theme/getDerivedTheme.ts +1 -1
- package/src/theme/useCSSVariables.ts +5 -5
- package/src/theme/useColorSchemeMetaTag.ts +2 -2
- package/src/theme/useInlineCSSVariables.ts +6 -7
- package/src/theme/utils.ts +8 -8
- package/src/tooltip/useTooltip.ts +7 -7
- package/src/tooltip/useTooltipPosition.ts +1 -1
- package/src/transition/useCarousel.ts +2 -2
- package/src/transition/useCollapseTransition.ts +1 -1
- package/src/transition/useSkeletonPlaceholder.ts +4 -4
- package/src/transition/useTransition.ts +2 -2
- package/src/transition/utils.ts +5 -5
- package/src/tree/TreeItem.tsx +1 -1
- package/src/tree/useTreeItems.ts +5 -5
- package/src/tree/useTreeMovement.ts +1 -1
- package/src/tree/utils.ts +9 -9
- package/src/typography/HighlightText.tsx +4 -3
- package/src/typography/SrOnly.tsx +9 -2
- package/src/useDebouncedFunction.ts +5 -5
- package/src/useDropzone.ts +10 -10
- package/src/useEnsuredState.ts +5 -5
- package/src/useIntersectionObserver.ts +3 -3
- package/src/useIsomorphicLayoutEffect.ts +3 -3
- package/src/useOrientation.ts +1 -1
- package/src/useReadonlySet.ts +3 -1
- package/src/useResizeListener.ts +2 -2
- package/src/useResizeObserver.ts +3 -4
- package/src/useThrottledFunction.ts +4 -4
- package/src/useWindowSize.ts +1 -1
- package/src/utils/alphaNumericSort.ts +1 -1
- package/src/utils/bem.ts +15 -16
- package/src/utils/getNumberOfDigits.ts +1 -0
- package/src/utils/getRangeDefaultValue.ts +1 -1
- package/src/utils/nearest.ts +5 -2
- package/src/utils/parseCssLengthUnit.ts +5 -4
- package/src/utils/trigonometry.ts +1 -1
- package/dist/form/defaultGetSelectedOptionChildren.d.ts +0 -1
- 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 =
|
|
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?:
|
|
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
|
|
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
|
-
|
|
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 =
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
524
|
-
|
|
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 (
|
|
73
|
+
if (propValue !== undefined && options.onValueChange) {
|
|
74
74
|
propSetValue = noop;
|
|
75
75
|
}
|
|
76
76
|
|
|
@@ -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
|
}
|
|
@@ -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
|
-
|
|
271
|
+
globalThis.addEventListener("storage", callback);
|
|
267
272
|
return () => {
|
|
268
|
-
|
|
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(
|
|
98
|
+
const top = Number.parseFloat(globalThis.getComputedStyle(section).top);
|
|
99
99
|
topOffset = Number.isNaN(top) ? 1 : top + 1;
|
|
100
100
|
}
|
|
101
101
|
|
package/src/tabs/TabList.tsx
CHANGED
|
@@ -176,12 +176,12 @@ export const TabList = forwardRef<HTMLDivElement, TabListProps>(
|
|
|
176
176
|
}
|
|
177
177
|
|
|
178
178
|
setAnimate(true);
|
|
179
|
-
const timeout =
|
|
179
|
+
const timeout = globalThis.setTimeout(() => {
|
|
180
180
|
setAnimate(false);
|
|
181
181
|
}, transitionDuration);
|
|
182
182
|
|
|
183
183
|
return () => {
|
|
184
|
-
|
|
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
|
-
|
|
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
|
-
|
|
123
|
-
}
|
|
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
|
package/src/tabs/useTabList.ts
CHANGED
|
@@ -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.
|
|
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
|
|
41
|
-
return createMatchMediaSpy(
|
|
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(
|
|
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
|
-
|
|
257
|
-
manager.frame =
|
|
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
|
-
|
|
4
|
+
globalThis.window !== undefined &&
|
|
5
5
|
typeof IntersectionObserver === "undefined"
|
|
6
6
|
) {
|
|
7
|
-
|
|
7
|
+
globalThis.IntersectionObserver = IntersectionObserverMock;
|
|
8
8
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ResizeObserverMock } from "../mocks/ResizeObserver.js";
|
|
2
2
|
|
|
3
|
-
if (
|
|
4
|
-
|
|
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 (
|
|
3
|
+
if (globalThis.TextDecoder === undefined) {
|
|
4
4
|
// @ts-expect-error browser TextDecoder does not support `null` while `node:util` does
|
|
5
|
-
|
|
5
|
+
globalThis.TextDecoder = TextDecoder;
|
|
6
6
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { BASE_MEDIA_QUERY_LIST, matchDesktop } from "../mocks/match-media.js";
|
|
2
2
|
|
|
3
|
-
if (
|
|
4
|
-
window
|
|
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 (
|
|
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 &&
|
|
@@ -75,7 +75,7 @@ export function getSelectTestElements(
|
|
|
75
75
|
});
|
|
76
76
|
const selectedOption = select.firstElementChild;
|
|
77
77
|
if (!(selectedOption instanceof HTMLDivElement)) {
|
|
78
|
-
throw new
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
87
|
+
globalThis.dispatchEvent(new Event("resize"));
|
|
88
88
|
|
|
89
89
|
const event = new Event("change");
|
|
90
|
-
listeners.
|
|
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
|
|
41
|
-
return createMatchMediaSpy(vi.spyOn(
|
|
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(
|
|
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 =
|
|
200
|
+
const frame = globalThis.requestAnimationFrame(() => {
|
|
201
201
|
setDerivedTheme(getDerivedTheme(document.documentElement));
|
|
202
202
|
});
|
|
203
203
|
|
|
204
204
|
return () => {
|
|
205
|
-
|
|
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 =
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
62
|
+
document.head.append(meta);
|
|
63
63
|
|
|
64
64
|
return () => {
|
|
65
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
}
|
package/src/theme/utils.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
540
|
+
globalThis.addEventListener("keydown", handleKeyDown);
|
|
541
541
|
window.addEventListener("scroll", hideTooltip, true);
|
|
542
|
-
|
|
542
|
+
globalThis.addEventListener("touchend", hideTooltip, true);
|
|
543
543
|
return () => {
|
|
544
|
-
|
|
544
|
+
globalThis.removeEventListener("keydown", handleKeyDown);
|
|
545
545
|
window.removeEventListener("scroll", hideTooltip, true);
|
|
546
|
-
|
|
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 =
|
|
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 =
|
|
688
|
+
const selection = globalThis.getSelection();
|
|
689
689
|
const node = selection?.anchorNode?.parentElement;
|
|
690
690
|
if (node && event.currentTarget.contains(node)) {
|
|
691
691
|
selection.empty();
|
|
@@ -224,7 +224,7 @@ export function useCarousel(options: CarouselOptions): CarouselImplementation {
|
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
const timeout =
|
|
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
|
-
|
|
241
|
+
globalThis.clearTimeout(timeout);
|
|
242
242
|
};
|
|
243
243
|
}, [paused, duration, activeIndex, total]);
|
|
244
244
|
|