@react-md/core 1.0.0-next.19 → 1.0.0-next.20
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/CoreProviders.js.map +1 -1
- package/dist/NoSsr.js.map +1 -1
- package/dist/RootHtml.js.map +1 -1
- package/dist/SsrProvider.js.map +1 -1
- package/dist/_core.scss +10 -9
- package/dist/app-bar/AppBar.js.map +1 -1
- package/dist/app-bar/AppBarTitle.js.map +1 -1
- package/dist/app-bar/_app-bar.scss +0 -4
- package/dist/app-bar/styles.js.map +1 -1
- package/dist/autocomplete/Autocomplete.js.map +1 -1
- package/dist/autocomplete/AutocompleteChip.js +1 -1
- package/dist/autocomplete/AutocompleteChip.js.map +1 -1
- package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
- package/dist/autocomplete/AutocompleteClearButton.js +1 -1
- package/dist/autocomplete/AutocompleteClearButton.js.map +1 -1
- package/dist/autocomplete/AutocompleteDropdownButton.js +1 -1
- package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
- package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -1
- package/dist/autocomplete/_autocomplete.scss +15 -13
- package/dist/autocomplete/autocompleteStyles.js.map +1 -1
- package/dist/autocomplete/types.js.map +1 -1
- package/dist/autocomplete/useAutocomplete.js +1 -1
- package/dist/autocomplete/useAutocomplete.js.map +1 -1
- package/dist/autocomplete/utils.js.map +1 -1
- package/dist/avatar/Avatar.js.map +1 -1
- package/dist/avatar/styles.js.map +1 -1
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/styles.js.map +1 -1
- package/dist/box/Box.js +2 -1
- package/dist/box/Box.js.map +1 -1
- package/dist/box/_box.scss +24 -1
- package/dist/box/styles.d.ts +11 -0
- package/dist/box/styles.js +4 -3
- package/dist/box/styles.js.map +1 -1
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/button/Button.js.map +1 -1
- package/dist/button/ButtonUnstyled.js.map +1 -1
- package/dist/button/FloatingActionButton.js.map +1 -1
- package/dist/button/TooltippedButton.js.map +1 -1
- package/dist/button/buttonStyles.js.map +1 -1
- package/dist/card/Card.d.ts +4 -13
- package/dist/card/Card.js +3 -3
- package/dist/card/Card.js.map +1 -1
- package/dist/card/CardContent.js.map +1 -1
- package/dist/card/CardFooter.js.map +1 -1
- package/dist/card/CardHeader.js.map +1 -1
- package/dist/card/CardSubtitle.js.map +1 -1
- package/dist/card/CardTitle.js.map +1 -1
- package/dist/card/ClickableCard.js.map +1 -1
- package/dist/card/_card.scss +5 -0
- package/dist/card/styles.js.map +1 -1
- package/dist/chip/Chip.js +1 -1
- package/dist/chip/Chip.js.map +1 -1
- package/dist/chip/styles.js.map +1 -1
- package/dist/dialog/Dialog.d.ts +4 -4
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/DialogContent.js.map +1 -1
- package/dist/dialog/DialogFooter.js.map +1 -1
- package/dist/dialog/DialogHeader.js.map +1 -1
- package/dist/dialog/DialogTitle.js.map +1 -1
- package/dist/dialog/FixedDialog.js +8 -5
- package/dist/dialog/FixedDialog.js.map +1 -1
- package/dist/dialog/NestedDialogProvider.js.map +1 -1
- package/dist/dialog/styles.d.ts +12 -3
- package/dist/dialog/styles.js.map +1 -1
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/styles.js.map +1 -1
- package/dist/draggable/useDraggable.d.ts +3 -0
- package/dist/draggable/useDraggable.js +20 -5
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/draggable/utils.js.map +1 -1
- package/dist/expansion-panel/ExpansionList.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
- package/dist/expansion-panel/expansionPanelStyles.js.map +1 -1
- package/dist/expansion-panel/useExpansionList.js.map +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/styles.js.map +1 -1
- package/dist/files/useFileUpload.js.map +1 -1
- package/dist/files/utils.d.ts +31 -1
- package/dist/files/utils.js +30 -0
- package/dist/files/utils.js.map +1 -1
- package/dist/focus/useFocusContainer.d.ts +5 -7
- package/dist/focus/useFocusContainer.js +5 -7
- package/dist/focus/useFocusContainer.js.map +1 -1
- package/dist/form/Checkbox.js.map +1 -1
- package/dist/form/Fieldset.js.map +1 -1
- package/dist/form/Form.js.map +1 -1
- package/dist/form/FormMessage.js.map +1 -1
- package/dist/form/FormMessageContainer.js.map +1 -1
- package/dist/form/FormMessageCounter.js.map +1 -1
- package/dist/form/InputToggle.js.map +1 -1
- package/dist/form/InputToggleIcon.js +1 -1
- package/dist/form/InputToggleIcon.js.map +1 -1
- package/dist/form/Label.js.map +1 -1
- package/dist/form/Legend.js.map +1 -1
- package/dist/form/Listbox.js.map +1 -1
- package/dist/form/ListboxProvider.js.map +1 -1
- package/dist/form/MenuItemCheckbox.js.map +1 -1
- package/dist/form/MenuItemFileInput.d.ts +1 -4
- package/dist/form/MenuItemFileInput.js +15 -6
- package/dist/form/MenuItemFileInput.js.map +1 -1
- package/dist/form/MenuItemInputToggle.js.map +1 -1
- package/dist/form/MenuItemRadio.js.map +1 -1
- package/dist/form/MenuItemSwitch.js.map +1 -1
- package/dist/form/MenuItemTextField.js.map +1 -1
- package/dist/form/NativeSelect.js +1 -1
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/OptGroup.js.map +1 -1
- package/dist/form/Option.js +4 -4
- package/dist/form/Option.js.map +1 -1
- package/dist/form/Password.js +2 -2
- package/dist/form/Password.js.map +1 -1
- package/dist/form/Radio.js.map +1 -1
- package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
- package/dist/form/Select.js +1 -1
- package/dist/form/Select.js.map +1 -1
- package/dist/form/SelectedOption.js.map +1 -1
- package/dist/form/Slider.js +9 -62
- package/dist/form/Slider.js.map +1 -1
- package/dist/form/SliderContainer.js.map +1 -1
- package/dist/form/SliderMark.js.map +1 -1
- package/dist/form/SliderMarkLabel.js.map +1 -1
- package/dist/form/SliderThumb.js +1 -0
- package/dist/form/SliderThumb.js.map +1 -1
- package/dist/form/SliderTrack.js.map +1 -1
- package/dist/form/SliderValueMarks.js.map +1 -1
- package/dist/form/SliderValueTooltip.js.map +1 -1
- package/dist/form/Switch.js.map +1 -1
- package/dist/form/SwitchTrack.js.map +1 -1
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/TextFieldAddon.js.map +1 -1
- package/dist/form/TextFieldContainer.js.map +1 -1
- package/dist/form/_form.scss +313 -269
- package/dist/form/formMessageContainerStyles.js.map +1 -1
- package/dist/form/formMessageStyles.js.map +1 -1
- package/dist/form/inputToggleStyles.js.map +1 -1
- package/dist/form/menuItemInputToggleStyles.js.map +1 -1
- package/dist/form/nativeSelectStyles.js.map +1 -1
- package/dist/form/optionStyles.js.map +1 -1
- package/dist/form/passwordStyles.js.map +1 -1
- package/dist/form/selectStyles.js.map +1 -1
- package/dist/form/selectUtils.js.map +1 -1
- package/dist/form/sliderUtils.d.ts +2 -7
- package/dist/form/sliderUtils.js +5 -5
- package/dist/form/sliderUtils.js.map +1 -1
- package/dist/form/switchStyles.js.map +1 -1
- package/dist/form/textAreaStyles.js.map +1 -1
- package/dist/form/textFieldContainerStyles.js.map +1 -1
- package/dist/form/textFieldStyles.js.map +1 -1
- package/dist/form/types.js.map +1 -1
- package/dist/form/useCheckboxGroup.d.ts +2 -2
- package/dist/form/useCheckboxGroup.js.map +1 -1
- package/dist/form/useCombobox.js.map +1 -1
- package/dist/form/useEditableCombobox.js.map +1 -1
- package/dist/form/useFormReset.js.map +1 -1
- package/dist/form/useNumberField.js.map +1 -1
- package/dist/form/useRadioGroup.d.ts +1 -1
- package/dist/form/useRadioGroup.js.map +1 -1
- package/dist/form/useRangeSlider.d.ts +1 -0
- package/dist/form/useRangeSlider.js.map +1 -1
- package/dist/form/useResizingTextArea.js.map +1 -1
- package/dist/form/useSelectCombobox.js.map +1 -1
- package/dist/form/useSlider.d.ts +1 -3
- package/dist/form/useSlider.js.map +1 -1
- package/dist/form/useSliderDraggable.d.ts +9 -0
- package/dist/form/useSliderDraggable.js +44 -0
- package/dist/form/useSliderDraggable.js.map +1 -0
- package/dist/form/useTextField.d.ts +24 -14
- package/dist/form/useTextField.js +7 -5
- package/dist/form/useTextField.js.map +1 -1
- package/dist/form/useTextFieldContainerAddons.js.map +1 -1
- package/dist/form/validation.js +2 -0
- package/dist/form/validation.js.map +1 -1
- package/dist/hoverMode/useHoverMode.d.ts +64 -3
- package/dist/hoverMode/useHoverMode.js.map +1 -1
- package/dist/hoverMode/useHoverModeProvider.d.ts +22 -12
- package/dist/hoverMode/useHoverModeProvider.js +21 -11
- package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
- package/dist/icon/FontIcon.js.map +1 -1
- package/dist/icon/IconRotator.js.map +1 -1
- package/dist/icon/MaterialIcon.js.map +1 -1
- package/dist/icon/MaterialSymbol.js.map +1 -1
- package/dist/icon/SVGIcon.js.map +1 -1
- package/dist/icon/TextIconSpacing.js.map +1 -1
- package/dist/icon/{iconConfig.js → config.js} +1 -1
- package/dist/icon/config.js.map +1 -0
- package/dist/icon/materialConfig.js.map +1 -1
- package/dist/icon/styles.js.map +1 -1
- package/dist/interaction/Ripple.js.map +1 -1
- package/dist/interaction/RippleContainer.js.map +1 -1
- package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
- package/dist/interaction/_interaction.scss +2 -2
- package/dist/interaction/useElementInteraction.d.ts +24 -25
- package/dist/interaction/useElementInteraction.js +20 -21
- package/dist/interaction/useElementInteraction.js.map +1 -1
- package/dist/interaction/useHigherContrastChildren.d.ts +8 -6
- package/dist/interaction/useHigherContrastChildren.js +10 -8
- package/dist/interaction/useHigherContrastChildren.js.map +1 -1
- package/dist/interaction/utils.js.map +1 -1
- package/dist/layout/LayoutAppBar.js.map +1 -1
- package/dist/layout/LayoutNav.js.map +1 -1
- package/dist/layout/LayoutWindowSplitter.js.map +1 -1
- package/dist/layout/Main.js.map +1 -1
- package/dist/layout/_layout.scss +4 -0
- package/dist/layout/layoutNavStyles.js.map +1 -1
- package/dist/layout/layoutWindowSplitterStyles.js.map +1 -1
- package/dist/layout/mainStyles.js.map +1 -1
- package/dist/layout/useExpandableLayout.d.ts +12 -14
- package/dist/layout/useExpandableLayout.js +13 -15
- package/dist/layout/useExpandableLayout.js.map +1 -1
- package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
- package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
- package/dist/layout/useLayoutTree.d.ts +4 -3
- package/dist/layout/useLayoutTree.js +4 -3
- package/dist/layout/useLayoutTree.js.map +1 -1
- package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
- package/dist/layout/useMainTabIndex.js.map +1 -1
- package/dist/layout/useResizableLayout.d.ts +13 -16
- package/dist/layout/useResizableLayout.js +13 -16
- package/dist/layout/useResizableLayout.js.map +1 -1
- package/dist/layout/useTemporaryLayout.d.ts +14 -9
- package/dist/layout/useTemporaryLayout.js +12 -10
- package/dist/layout/useTemporaryLayout.js.map +1 -1
- package/dist/link/Link.js.map +1 -1
- package/dist/link/SkipToMainContent.js.map +1 -1
- package/dist/link/styles.js.map +1 -1
- package/dist/list/List.js.map +1 -1
- package/dist/list/ListItem.js +1 -1
- package/dist/list/ListItem.js.map +1 -1
- package/dist/list/ListItemAddon.js.map +1 -1
- package/dist/list/ListItemChildren.js.map +1 -1
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/ListItemText.js.map +1 -1
- package/dist/list/ListSubheader.js.map +1 -1
- package/dist/list/listItemStyles.js.map +1 -1
- package/dist/list/listStyles.js.map +1 -1
- package/dist/list/types.js.map +1 -1
- package/dist/media-queries/AppSizeProvider.d.ts +1 -1
- package/dist/media-queries/AppSizeProvider.js +1 -1
- package/dist/media-queries/AppSizeProvider.js.map +1 -1
- package/dist/media-queries/useMediaQuery.d.ts +3 -3
- package/dist/media-queries/useMediaQuery.js +3 -3
- package/dist/media-queries/useMediaQuery.js.map +1 -1
- package/dist/menu/DropdownMenu.js.map +1 -1
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuBar.js.map +1 -1
- package/dist/menu/MenuButton.js +1 -1
- package/dist/menu/MenuButton.js.map +1 -1
- package/dist/menu/MenuConfigurationProvider.js.map +1 -1
- package/dist/menu/MenuItem.js.map +1 -1
- package/dist/menu/MenuItemButton.js +1 -1
- package/dist/menu/MenuItemButton.js.map +1 -1
- package/dist/menu/MenuItemCircularProgress.js.map +1 -1
- package/dist/menu/MenuItemGroup.js.map +1 -1
- package/dist/menu/MenuItemSeparator.js.map +1 -1
- package/dist/menu/MenuSheet.js.map +1 -1
- package/dist/menu/MenuVisibilityProvider.js.map +1 -1
- package/dist/menu/MenuWidget.js.map +1 -1
- package/dist/menu/MenuWidgetKeyboardProvider.js.map +1 -1
- package/dist/menu/useContextMenu.js.map +1 -1
- package/dist/menu/useMenuBarProvider.js.map +1 -1
- package/dist/movement/types.js.map +1 -1
- package/dist/movement/useKeyboardMovementProvider.js.map +1 -1
- package/dist/movement/utils.js.map +1 -1
- package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
- package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
- package/dist/navigation/NavGroup.js.map +1 -1
- package/dist/navigation/NavItem.js.map +1 -1
- package/dist/navigation/NavItemButton.js +1 -1
- package/dist/navigation/NavItemButton.js.map +1 -1
- package/dist/navigation/NavItemLink.js.map +1 -1
- package/dist/navigation/NavSubheader.d.ts +1 -1
- package/dist/navigation/NavSubheader.js +1 -1
- package/dist/navigation/NavSubheader.js.map +1 -1
- package/dist/navigation/Navigation.js.map +1 -1
- package/dist/navigation/navGroupStyles.js.map +1 -1
- package/dist/navigation/navItemStyles.js.map +1 -1
- package/dist/navigation/types.js.map +1 -1
- package/dist/navigation/useActiveHeadingId.d.ts +1 -1
- package/dist/navigation/useActiveHeadingId.js +4 -4
- package/dist/navigation/useActiveHeadingId.js.map +1 -1
- package/dist/navigation/useNavigationExpansion.js.map +1 -1
- package/dist/navigation/useTableOfContentsHeadings.d.ts +75 -0
- package/dist/navigation/useTableOfContentsHeadings.js +91 -0
- package/dist/navigation/useTableOfContentsHeadings.js.map +1 -0
- package/dist/objectFit.js.map +1 -1
- package/dist/overlay/Overlay.js +1 -1
- package/dist/overlay/Overlay.js.map +1 -1
- package/dist/overlay/overlayStyles.d.ts +7 -3
- package/dist/overlay/overlayStyles.js.map +1 -1
- package/dist/portal/Portal.js.map +1 -1
- package/dist/portal/PortalContainerProvider.js.map +1 -1
- package/dist/positioning/createHorizontalPosition.js.map +1 -1
- package/dist/positioning/createVerticalPosition.js.map +1 -1
- package/dist/positioning/useFixedPositioning.d.ts +11 -8
- package/dist/positioning/useFixedPositioning.js +7 -6
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/progress/CircularProgress.js.map +1 -1
- package/dist/progress/LinearProgress.js.map +1 -1
- package/dist/progress/_progress.scss +2 -1
- package/dist/responsive-item/ResponsiveItem.js.map +1 -1
- package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
- package/dist/responsive-item/responsiveItemOverlayStyles.js.map +1 -1
- package/dist/responsive-item/responsiveItemStyles.js.map +1 -1
- package/dist/scroll/ScrollLock.js.map +1 -1
- package/dist/scroll/useScrollLock.d.ts +1 -1
- package/dist/scroll/useScrollLock.js +1 -1
- package/dist/scroll/useScrollLock.js.map +1 -1
- package/dist/searching/fuzzy.d.ts +1 -1
- package/dist/searching/fuzzy.js.map +1 -1
- package/dist/searching/useFuzzyMatch.js.map +1 -1
- package/dist/segmented-button/SegmentedButton.js +1 -1
- package/dist/segmented-button/SegmentedButton.js.map +1 -1
- package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
- package/dist/segmented-button/_segmented-button.scss +40 -0
- package/dist/segmented-button/segmentedButtonContainerStyles.js.map +1 -1
- package/dist/segmented-button/segmentedButtonStyles.js.map +1 -1
- package/dist/sheet/Sheet.js.map +1 -1
- package/dist/sheet/styles.js.map +1 -1
- package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
- package/dist/snackbar/Snackbar.js.map +1 -1
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/ToastActionButton.js.map +1 -1
- package/dist/snackbar/ToastCloseButton.js +1 -1
- package/dist/snackbar/ToastCloseButton.js.map +1 -1
- package/dist/snackbar/ToastContent.js.map +1 -1
- package/dist/snackbar/ToastManager.js.map +1 -1
- package/dist/snackbar/ToastManagerProvider.js.map +1 -1
- package/dist/snackbar/snackbarStyles.js.map +1 -1
- package/dist/snackbar/toastContentStyles.js.map +1 -1
- package/dist/snackbar/toastStyles.js.map +1 -1
- package/dist/snackbar/useCurrentToastActions.js.map +1 -1
- package/dist/storage/internalUtils.d.ts +19 -0
- package/dist/storage/internalUtils.js +22 -0
- package/dist/storage/internalUtils.js.map +1 -0
- package/dist/storage/types.d.ts +75 -0
- package/dist/storage/types.js +3 -0
- package/dist/storage/types.js.map +1 -0
- package/dist/storage/useStorage.d.ts +113 -0
- package/dist/storage/useStorage.js +247 -0
- package/dist/storage/useStorage.js.map +1 -0
- package/dist/storage/utils.d.ts +94 -0
- package/dist/storage/utils.js +106 -0
- package/dist/storage/utils.js.map +1 -0
- package/dist/suspense/CircularProgressSuspense.js.map +1 -1
- package/dist/suspense/NullSuspense.js.map +1 -1
- package/dist/table/StickyTableSection.js.map +1 -1
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableBody.js.map +1 -1
- package/dist/table/TableCell.js +1 -1
- package/dist/table/TableCell.js.map +1 -1
- package/dist/table/TableCellContent.js.map +1 -1
- package/dist/table/TableCheckbox.js.map +1 -1
- package/dist/table/TableConfigurationProvider.js.map +1 -1
- package/dist/table/TableContainer.js.map +1 -1
- package/dist/table/TableContainerProvider.js.map +1 -1
- package/dist/table/TableFooter.js.map +1 -1
- package/dist/table/TableHeader.js.map +1 -1
- package/dist/table/TableRadio.js.map +1 -1
- package/dist/table/TableRow.js.map +1 -1
- package/dist/table/_table.scss +0 -1
- package/dist/table/tableCellStyles.js.map +1 -1
- package/dist/table/tableFooterStyles.js.map +1 -1
- package/dist/table/tableHeaderStyles.js.map +1 -1
- package/dist/table/tableRowStyles.js.map +1 -1
- package/dist/table/tableStyles.js.map +1 -1
- package/dist/table/useStickyTableSection.js.map +1 -1
- package/dist/table/useTableSectionConfig.js.map +1 -1
- package/dist/tabs/SimpleTabPanel.d.ts +17 -0
- package/dist/tabs/SimpleTabPanel.js +21 -0
- package/dist/tabs/SimpleTabPanel.js.map +1 -0
- package/dist/tabs/SimpleTabPanels.d.ts +17 -0
- package/dist/tabs/SimpleTabPanels.js +18 -0
- package/dist/tabs/SimpleTabPanels.js.map +1 -0
- package/dist/tabs/Tab.js.map +1 -1
- package/dist/tabs/TabList.d.ts +8 -25
- package/dist/tabs/TabList.js +4 -6
- package/dist/tabs/TabList.js.map +1 -1
- package/dist/tabs/TabListScrollButton.js +2 -1
- package/dist/tabs/TabListScrollButton.js.map +1 -1
- package/dist/tabs/_tabs.scss +50 -14
- package/dist/tabs/tabIndicatorStyles.js.map +1 -1
- package/dist/tabs/tabListScrollButtonStyles.js.map +1 -1
- package/dist/tabs/tabListStyles.d.ts +9 -0
- package/dist/tabs/tabListStyles.js +2 -1
- package/dist/tabs/tabListStyles.js.map +1 -1
- package/dist/tabs/tabStyles.d.ts +7 -0
- package/dist/tabs/tabStyles.js.map +1 -1
- package/dist/tabs/types.d.ts +25 -0
- package/dist/tabs/types.js +24 -0
- package/dist/tabs/types.js.map +1 -0
- package/dist/tabs/useMaxTabPanelHeight.d.ts +82 -0
- package/dist/tabs/useMaxTabPanelHeight.js +95 -0
- package/dist/tabs/useMaxTabPanelHeight.js.map +1 -0
- package/dist/tabs/useTabList.d.ts +4 -2
- package/dist/tabs/useTabList.js +24 -6
- package/dist/tabs/useTabList.js.map +1 -1
- package/dist/tabs/useTabs.d.ts +53 -68
- package/dist/tabs/useTabs.js +6 -2
- package/dist/tabs/useTabs.js.map +1 -1
- package/dist/tabs/utils.d.ts +4 -0
- package/dist/tabs/utils.js +5 -0
- package/dist/tabs/utils.js.map +1 -1
- package/dist/test-utils/drag.d.ts +1 -0
- package/dist/test-utils/index.d.ts +6 -4
- package/dist/test-utils/index.js +6 -4
- package/dist/test-utils/index.js.map +1 -1
- package/dist/test-utils/jest-globals/index.d.ts +4 -0
- package/dist/test-utils/jest-globals/index.js +6 -0
- package/dist/test-utils/jest-globals/index.js.map +1 -0
- package/dist/test-utils/jest-globals/match-media.d.ts +32 -0
- package/dist/test-utils/jest-globals/match-media.js +35 -0
- package/dist/test-utils/jest-globals/match-media.js.map +1 -0
- package/dist/test-utils/jest-globals/resize-observer.d.ts +5 -0
- package/dist/test-utils/jest-globals/resize-observer.js +10 -0
- package/dist/test-utils/jest-globals/resize-observer.js.map +1 -0
- package/dist/test-utils/jest-globals/setup.d.ts +1 -0
- package/dist/test-utils/{jest-setup.js → jest-globals/setup.js} +4 -3
- package/dist/test-utils/jest-globals/setup.js.map +1 -0
- package/dist/test-utils/{timers.d.ts → jest-globals/timers.d.ts} +2 -2
- package/dist/test-utils/{timers.js → jest-globals/timers.js} +2 -2
- package/dist/test-utils/jest-globals/timers.js.map +1 -0
- package/dist/test-utils/jest-globals/uploadMenuItemFileInput.d.ts +32 -0
- package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js +39 -0
- package/dist/test-utils/jest-globals/uploadMenuItemFileInput.js.map +1 -0
- package/dist/test-utils/mocks/IntersectionObserver.js.map +1 -0
- package/dist/test-utils/{ResizeObserver.d.ts → mocks/ResizeObserver.d.ts} +16 -23
- package/dist/test-utils/{ResizeObserver.js → mocks/ResizeObserver.js} +17 -38
- package/dist/test-utils/mocks/ResizeObserver.js.map +1 -0
- package/dist/test-utils/mocks/match-media-implementation.d.ts +42 -0
- package/dist/test-utils/mocks/match-media-implementation.js +46 -0
- package/dist/test-utils/mocks/match-media-implementation.js.map +1 -0
- package/dist/test-utils/mocks/match-media.d.ts +32 -0
- package/dist/test-utils/mocks/match-media.js +39 -0
- package/dist/test-utils/mocks/match-media.js.map +1 -0
- package/dist/test-utils/polyfills/IntersectionObserver.js +1 -1
- package/dist/test-utils/polyfills/IntersectionObserver.js.map +1 -1
- package/dist/test-utils/polyfills/ResizeObserver.js +1 -1
- package/dist/test-utils/polyfills/ResizeObserver.js.map +1 -1
- package/dist/test-utils/polyfills/matchMedia.js +1 -1
- package/dist/test-utils/polyfills/matchMedia.js.map +1 -1
- package/dist/test-utils/queries/index.d.ts +2 -0
- package/dist/test-utils/queries/index.js +4 -0
- package/dist/test-utils/queries/index.js.map +1 -0
- package/dist/test-utils/queries/select.d.ts +67 -0
- package/dist/test-utils/queries/select.js +69 -0
- package/dist/test-utils/queries/select.js.map +1 -0
- package/dist/test-utils/queries/slider.d.ts +126 -0
- package/dist/test-utils/queries/slider.js +136 -0
- package/dist/test-utils/queries/slider.js.map +1 -0
- package/dist/test-utils/queries/types.d.ts +8 -0
- package/dist/test-utils/queries/types.js +5 -0
- package/dist/test-utils/queries/types.js.map +1 -0
- package/dist/test-utils/render.js.map +1 -1
- package/dist/test-utils/utils/createFileList.d.ts +4 -0
- package/dist/test-utils/utils/createFileList.js +27 -0
- package/dist/test-utils/utils/createFileList.js.map +1 -0
- package/dist/test-utils/utils/createResizeObserverEntry.d.ts +18 -0
- package/dist/test-utils/utils/createResizeObserverEntry.js +33 -0
- package/dist/test-utils/utils/createResizeObserverEntry.js.map +1 -0
- package/dist/test-utils/vitest/index.d.ts +4 -0
- package/dist/test-utils/vitest/index.js +6 -0
- package/dist/test-utils/vitest/index.js.map +1 -0
- package/dist/test-utils/vitest/match-media.d.ts +32 -0
- package/dist/test-utils/vitest/match-media.js +35 -0
- package/dist/test-utils/vitest/match-media.js.map +1 -0
- package/dist/test-utils/vitest/resize-observer.d.ts +5 -0
- package/dist/test-utils/vitest/resize-observer.js +10 -0
- package/dist/test-utils/vitest/resize-observer.js.map +1 -0
- package/dist/test-utils/vitest/setup.d.ts +1 -0
- package/dist/test-utils/vitest/setup.js +14 -0
- package/dist/test-utils/vitest/setup.js.map +1 -0
- package/dist/test-utils/vitest/timers.d.ts +42 -0
- package/dist/test-utils/vitest/timers.js +42 -0
- package/dist/test-utils/vitest/timers.js.map +1 -0
- package/dist/test-utils/vitest/uploadMenuItemFileInput.d.ts +32 -0
- package/dist/test-utils/vitest/uploadMenuItemFileInput.js +39 -0
- package/dist/test-utils/vitest/uploadMenuItemFileInput.js.map +1 -0
- package/dist/theme/LocalStorageColorSchemeProvider.d.ts +17 -17
- package/dist/theme/LocalStorageColorSchemeProvider.js +19 -19
- package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
- package/dist/theme/ThemeProvider.d.ts +2 -2
- package/dist/theme/ThemeProvider.js +4 -4
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/_theme.scss +0 -4
- package/dist/theme/isColorScheme.d.ts +5 -5
- package/dist/theme/isColorScheme.js +5 -5
- package/dist/theme/isColorScheme.js.map +1 -1
- package/dist/theme/types.d.ts +10 -22
- package/dist/theme/types.js.map +1 -1
- package/dist/theme/useCSSVariables.d.ts +8 -15
- package/dist/theme/useCSSVariables.js.map +1 -1
- package/dist/theme/useColorScheme.d.ts +15 -13
- package/dist/theme/useColorScheme.js +17 -15
- package/dist/theme/useColorScheme.js.map +1 -1
- package/dist/theme/useColorSchemeMetaTag.d.ts +15 -2
- package/dist/theme/useColorSchemeMetaTag.js +13 -0
- package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
- package/dist/theme/useColorSchemeProvider.d.ts +18 -20
- package/dist/theme/useColorSchemeProvider.js +13 -13
- package/dist/theme/useColorSchemeProvider.js.map +1 -1
- package/dist/theme/{usePrefersDarkScheme.js → usePrefersDarkTheme.js} +1 -1
- package/dist/theme/usePrefersDarkTheme.js.map +1 -0
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
- package/dist/tooltip/tooltipStyles.js.map +1 -1
- package/dist/tooltip/useTooltip.d.ts +5 -2
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/tooltip/useTooltipPosition.js.map +1 -1
- package/dist/transition/CSSTransition.js.map +1 -1
- package/dist/transition/Collapse.js.map +1 -1
- package/dist/transition/CrossFade.d.ts +1 -1
- package/dist/transition/CrossFade.js +1 -1
- package/dist/transition/CrossFade.js.map +1 -1
- package/dist/transition/ScaleTransition.js.map +1 -1
- package/dist/transition/SkeletonPlaceholder.js.map +1 -1
- package/dist/transition/Slide.js.map +1 -1
- package/dist/transition/SlideContainer.js.map +1 -1
- package/dist/transition/collapseStyles.js.map +1 -1
- package/dist/transition/config.d.ts +4 -1
- package/dist/transition/config.js.map +1 -1
- package/dist/transition/maxWidthTransition.d.ts +6 -0
- package/dist/transition/maxWidthTransition.js +3 -1
- package/dist/transition/maxWidthTransition.js.map +1 -1
- package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
- package/dist/transition/types.d.ts +0 -1
- package/dist/transition/types.js.map +1 -1
- package/dist/transition/useCSSTransition.d.ts +8 -4
- package/dist/transition/useCSSTransition.js +8 -4
- package/dist/transition/useCSSTransition.js.map +1 -1
- package/dist/transition/useCarousel.js.map +1 -1
- package/dist/transition/useCollapseTransition.d.ts +13 -8
- package/dist/transition/useCollapseTransition.js +11 -6
- package/dist/transition/useCollapseTransition.js.map +1 -1
- package/dist/transition/useCrossFadeTransition.js.map +1 -1
- package/dist/transition/useMaxWidthTransition.d.ts +9 -0
- package/dist/transition/useMaxWidthTransition.js +9 -0
- package/dist/transition/useMaxWidthTransition.js.map +1 -1
- package/dist/transition/useScaleTransition.d.ts +27 -6
- package/dist/transition/useScaleTransition.js +4 -2
- package/dist/transition/useScaleTransition.js.map +1 -1
- package/dist/transition/useSkeletonPlaceholder.d.ts +16 -0
- package/dist/transition/useSkeletonPlaceholder.js +13 -1
- package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
- package/dist/transition/useSlideTransition.d.ts +12 -16
- package/dist/transition/useSlideTransition.js +12 -16
- package/dist/transition/useSlideTransition.js.map +1 -1
- package/dist/transition/useTransition.js +1 -1
- package/dist/transition/useTransition.js.map +1 -1
- package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
- package/dist/tree/Tree.js.map +1 -1
- package/dist/tree/TreeGroup.js.map +1 -1
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/TreeItemExpander.js +1 -1
- package/dist/tree/TreeItemExpander.js.map +1 -1
- package/dist/tree/TreeProvider.js.map +1 -1
- package/dist/tree/_tree.scss +0 -1
- package/dist/tree/styles.js.map +1 -1
- package/dist/tree/types.js.map +1 -1
- package/dist/tree/useTree.js.map +1 -1
- package/dist/tree/useTreeExpansion.js.map +1 -1
- package/dist/tree/useTreeItems.d.ts +1 -1
- package/dist/tree/useTreeItems.js.map +1 -1
- package/dist/tree/useTreeMovement.js.map +1 -1
- package/dist/tree/useTreeSelection.js.map +1 -1
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/TextContainer.js.map +1 -1
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/WritingDirectionProvider.js.map +1 -1
- package/dist/typography/textContainerStyles.js.map +1 -1
- package/dist/typography/typographyStyles.js.map +1 -1
- package/dist/useAsyncFunction.d.ts +20 -0
- package/dist/useAsyncFunction.js.map +1 -1
- package/dist/useDebouncedFunction.js.map +1 -1
- package/dist/useDropzone.d.ts +18 -11
- package/dist/useDropzone.js +27 -23
- package/dist/useDropzone.js.map +1 -1
- package/dist/useElementSize.d.ts +3 -3
- package/dist/useElementSize.js +1 -1
- package/dist/useElementSize.js.map +1 -1
- package/dist/useEnsuredId.d.ts +1 -1
- package/dist/useEnsuredId.js +1 -1
- package/dist/useEnsuredId.js.map +1 -1
- package/dist/useEnsuredRef.d.ts +1 -1
- package/dist/useEnsuredRef.js +1 -1
- package/dist/useEnsuredRef.js.map +1 -1
- package/dist/useEnsuredState.js.map +1 -1
- package/dist/useHtmlClassName.d.ts +11 -0
- package/dist/useHtmlClassName.js +11 -0
- package/dist/useHtmlClassName.js.map +1 -1
- package/dist/useIntersectionObserver.d.ts +3 -3
- package/dist/useIntersectionObserver.js +2 -2
- package/dist/useIntersectionObserver.js.map +1 -1
- package/dist/useIsomorphicLayoutEffect.js.map +1 -1
- package/dist/useMutationObserver.d.ts +3 -3
- package/dist/useMutationObserver.js +4 -4
- package/dist/useMutationObserver.js.map +1 -1
- package/dist/useOrientation.d.ts +0 -1
- package/dist/useOrientation.js +0 -1
- package/dist/useOrientation.js.map +1 -1
- package/dist/usePageInactive.d.ts +7 -2
- package/dist/usePageInactive.js +7 -2
- package/dist/usePageInactive.js.map +1 -1
- package/dist/useReadonlySet.d.ts +5 -4
- package/dist/useReadonlySet.js +4 -3
- package/dist/useReadonlySet.js.map +1 -1
- package/dist/useResizeListener.d.ts +6 -4
- package/dist/useResizeListener.js +6 -4
- package/dist/useResizeListener.js.map +1 -1
- package/dist/useResizeObserver.d.ts +1 -1
- package/dist/useResizeObserver.js +1 -1
- package/dist/useResizeObserver.js.map +1 -1
- package/dist/useThrottledFunction.js.map +1 -1
- package/dist/useToggle.d.ts +3 -3
- package/dist/useToggle.js +3 -3
- package/dist/useToggle.js.map +1 -1
- package/dist/useUnmounted.js.map +1 -1
- package/dist/useWindowSize.d.ts +1 -1
- package/dist/useWindowSize.js +1 -1
- package/dist/useWindowSize.js.map +1 -1
- package/dist/utils/RenderRecursively.d.ts +88 -32
- package/dist/utils/RenderRecursively.js +88 -32
- package/dist/utils/RenderRecursively.js.map +1 -1
- package/dist/utils/alphaNumericSort.d.ts +5 -0
- package/dist/utils/alphaNumericSort.js +5 -4
- package/dist/utils/alphaNumericSort.js.map +1 -1
- package/dist/utils/bem.d.ts +49 -6
- package/dist/utils/bem.js +5 -14
- package/dist/utils/bem.js.map +1 -1
- package/dist/utils/getRangeDefaultValue.js.map +1 -1
- package/dist/utils/isElementVisible.d.ts +1 -1
- package/dist/utils/isElementVisible.js +1 -1
- package/dist/utils/isElementVisible.js.map +1 -1
- package/dist/utils/loop.d.ts +2 -0
- package/dist/utils/loop.js.map +1 -1
- package/dist/utils/parseCssLengthUnit.d.ts +1 -1
- package/dist/utils/parseCssLengthUnit.js.map +1 -1
- package/dist/utils/wait.d.ts +4 -4
- package/dist/utils/wait.js +6 -4
- package/dist/utils/wait.js.map +1 -1
- package/dist/window-splitter/WindowSplitter.js.map +1 -1
- package/dist/window-splitter/styles.js.map +1 -1
- package/dist/window-splitter/useWindowSplitter.d.ts +4 -1
- package/dist/window-splitter/useWindowSplitter.js +4 -1
- package/dist/window-splitter/useWindowSplitter.js.map +1 -1
- package/package.json +26 -22
- package/src/CoreProviders.tsx +8 -6
- package/src/NoSsr.tsx +3 -1
- package/src/RootHtml.tsx +1 -0
- package/src/SsrProvider.tsx +3 -2
- package/src/app-bar/AppBar.tsx +3 -2
- package/src/app-bar/AppBarTitle.tsx +1 -0
- package/src/app-bar/styles.ts +1 -0
- package/src/autocomplete/Autocomplete.tsx +2 -0
- package/src/autocomplete/AutocompleteChip.tsx +2 -1
- package/src/autocomplete/AutocompleteCircularProgress.tsx +1 -0
- package/src/autocomplete/AutocompleteClearButton.tsx +3 -1
- package/src/autocomplete/AutocompleteDropdownButton.tsx +3 -1
- package/src/autocomplete/AutocompleteListboxChildren.tsx +2 -0
- package/src/autocomplete/autocompleteStyles.ts +1 -0
- package/src/autocomplete/types.ts +1 -0
- package/src/autocomplete/useAutocomplete.ts +4 -2
- package/src/autocomplete/utils.ts +1 -0
- package/src/avatar/Avatar.tsx +3 -2
- package/src/avatar/styles.ts +2 -1
- package/src/badge/Badge.tsx +3 -2
- package/src/badge/styles.ts +1 -0
- package/src/box/Box.tsx +5 -2
- package/src/box/styles.ts +17 -2
- package/src/button/AsyncButton.tsx +3 -1
- package/src/button/Button.tsx +4 -2
- package/src/button/ButtonUnstyled.tsx +2 -1
- package/src/button/FloatingActionButton.tsx +2 -1
- package/src/button/TooltippedButton.tsx +4 -2
- package/src/button/buttonStyles.ts +2 -1
- package/src/card/Card.tsx +10 -23
- package/src/card/CardContent.tsx +3 -2
- package/src/card/CardFooter.tsx +1 -0
- package/src/card/CardHeader.tsx +2 -1
- package/src/card/CardSubtitle.tsx +1 -0
- package/src/card/CardTitle.tsx +1 -0
- package/src/card/ClickableCard.tsx +3 -1
- package/src/card/styles.ts +1 -0
- package/src/chip/Chip.tsx +4 -2
- package/src/chip/styles.ts +1 -0
- package/src/dialog/Dialog.tsx +10 -6
- package/src/dialog/DialogContent.tsx +3 -2
- package/src/dialog/DialogFooter.tsx +3 -2
- package/src/dialog/DialogHeader.tsx +2 -1
- package/src/dialog/DialogTitle.tsx +2 -1
- package/src/dialog/FixedDialog.tsx +14 -9
- package/src/dialog/NestedDialogProvider.ts +1 -0
- package/src/dialog/styles.ts +5 -4
- package/src/divider/Divider.tsx +3 -2
- package/src/divider/styles.ts +1 -0
- package/src/draggable/useDraggable.ts +25 -12
- package/src/draggable/utils.ts +2 -1
- package/src/expansion-panel/ExpansionList.tsx +3 -1
- package/src/expansion-panel/ExpansionPanel.tsx +3 -1
- package/src/expansion-panel/ExpansionPanelHeader.tsx +3 -2
- package/src/expansion-panel/expansionPanelStyles.ts +1 -0
- package/src/expansion-panel/useExpansionList.ts +2 -0
- package/src/expansion-panel/useExpansionPanels.ts +1 -0
- package/src/files/FileInput.tsx +4 -2
- package/src/files/styles.ts +1 -0
- package/src/files/useFileUpload.ts +7 -5
- package/src/files/utils.ts +31 -1
- package/src/focus/useFocusContainer.ts +10 -10
- package/src/form/Checkbox.tsx +2 -1
- package/src/form/Fieldset.tsx +2 -1
- package/src/form/Form.tsx +2 -1
- package/src/form/FormMessage.tsx +1 -0
- package/src/form/FormMessageContainer.tsx +2 -1
- package/src/form/FormMessageCounter.tsx +1 -0
- package/src/form/InputToggle.tsx +3 -1
- package/src/form/InputToggleIcon.tsx +4 -3
- package/src/form/Label.tsx +1 -0
- package/src/form/Legend.tsx +1 -0
- package/src/form/Listbox.tsx +1 -0
- package/src/form/ListboxProvider.ts +2 -0
- package/src/form/MenuItemCheckbox.tsx +5 -3
- package/src/form/MenuItemFileInput.tsx +25 -13
- package/src/form/MenuItemInputToggle.tsx +3 -1
- package/src/form/MenuItemRadio.tsx +4 -2
- package/src/form/MenuItemSwitch.tsx +2 -0
- package/src/form/MenuItemTextField.tsx +3 -1
- package/src/form/NativeSelect.tsx +3 -2
- package/src/form/OptGroup.tsx +3 -1
- package/src/form/Option.tsx +6 -4
- package/src/form/Password.tsx +5 -3
- package/src/form/Radio.tsx +2 -0
- package/src/form/ResizingTextAreaWrapper.tsx +2 -1
- package/src/form/Select.tsx +6 -4
- package/src/form/SelectedOption.tsx +1 -0
- package/src/form/Slider.tsx +13 -71
- package/src/form/SliderContainer.tsx +2 -1
- package/src/form/SliderMark.tsx +1 -0
- package/src/form/SliderMarkLabel.tsx +2 -1
- package/src/form/SliderThumb.tsx +6 -3
- package/src/form/SliderTrack.tsx +4 -3
- package/src/form/SliderValueMarks.tsx +3 -2
- package/src/form/SliderValueTooltip.tsx +2 -0
- package/src/form/Switch.tsx +2 -1
- package/src/form/SwitchTrack.tsx +2 -1
- package/src/form/TextArea.tsx +4 -2
- package/src/form/TextField.tsx +2 -1
- package/src/form/TextFieldAddon.tsx +1 -0
- package/src/form/TextFieldContainer.tsx +3 -1
- package/src/form/formMessageContainerStyles.ts +1 -0
- package/src/form/formMessageStyles.ts +1 -0
- package/src/form/inputToggleStyles.ts +1 -0
- package/src/form/menuItemInputToggleStyles.ts +1 -0
- package/src/form/nativeSelectStyles.ts +1 -0
- package/src/form/optionStyles.ts +1 -0
- package/src/form/passwordStyles.ts +1 -0
- package/src/form/selectStyles.ts +1 -0
- package/src/form/selectUtils.ts +2 -1
- package/src/form/sliderUtils.ts +8 -7
- package/src/form/switchStyles.ts +1 -0
- package/src/form/textAreaStyles.ts +2 -1
- package/src/form/textFieldContainerStyles.ts +2 -1
- package/src/form/textFieldStyles.ts +1 -0
- package/src/form/types.ts +1 -0
- package/src/form/useCheckboxGroup.ts +4 -2
- package/src/form/useCombobox.ts +4 -2
- package/src/form/useEditableCombobox.ts +2 -0
- package/src/form/useFormReset.ts +4 -2
- package/src/form/useNumberField.ts +3 -1
- package/src/form/useRadioGroup.ts +5 -3
- package/src/form/useRangeSlider.ts +3 -0
- package/src/form/useResizingTextArea.ts +5 -3
- package/src/form/useSelectCombobox.ts +2 -1
- package/src/form/useSlider.ts +3 -3
- package/src/form/useSliderDraggable.ts +71 -0
- package/src/form/useTextField.ts +40 -26
- package/src/form/useTextFieldContainerAddons.ts +4 -2
- package/src/form/validation.ts +2 -0
- package/src/hoverMode/useHoverMode.ts +76 -4
- package/src/hoverMode/useHoverModeProvider.ts +24 -12
- package/src/icon/FontIcon.tsx +3 -2
- package/src/icon/IconRotator.tsx +5 -4
- package/src/icon/MaterialIcon.tsx +3 -2
- package/src/icon/MaterialSymbol.tsx +4 -3
- package/src/icon/SVGIcon.tsx +3 -2
- package/src/icon/TextIconSpacing.tsx +2 -2
- package/src/icon/{iconConfig.tsx → config.tsx} +1 -0
- package/src/icon/materialConfig.ts +1 -0
- package/src/icon/styles.ts +2 -1
- package/src/interaction/Ripple.tsx +2 -0
- package/src/interaction/RippleContainer.tsx +1 -0
- package/src/interaction/UserInteractionModeProvider.tsx +3 -2
- package/src/interaction/useElementInteraction.tsx +39 -36
- package/src/interaction/useHigherContrastChildren.tsx +11 -8
- package/src/interaction/utils.ts +1 -0
- package/src/layout/LayoutAppBar.tsx +2 -0
- package/src/layout/LayoutNav.tsx +4 -2
- package/src/layout/LayoutWindowSplitter.tsx +4 -2
- package/src/layout/Main.tsx +4 -2
- package/src/layout/layoutNavStyles.ts +1 -0
- package/src/layout/layoutWindowSplitterStyles.ts +1 -0
- package/src/layout/mainStyles.ts +1 -0
- package/src/layout/useExpandableLayout.ts +17 -17
- package/src/layout/useHorizontalLayoutTransition.ts +2 -0
- package/src/layout/useLayoutAppBarHeight.ts +3 -1
- package/src/layout/useLayoutTree.ts +6 -3
- package/src/layout/useLayoutWindowSplitter.ts +2 -1
- package/src/layout/useMainTabIndex.ts +1 -0
- package/src/layout/useResizableLayout.ts +14 -17
- package/src/layout/useTemporaryLayout.ts +18 -11
- package/src/link/Link.tsx +3 -2
- package/src/link/SkipToMainContent.tsx +4 -2
- package/src/link/styles.ts +1 -0
- package/src/list/List.tsx +2 -1
- package/src/list/ListItem.tsx +4 -2
- package/src/list/ListItemAddon.tsx +2 -1
- package/src/list/ListItemChildren.tsx +1 -0
- package/src/list/ListItemLink.tsx +4 -2
- package/src/list/ListItemText.tsx +2 -1
- package/src/list/ListSubheader.tsx +2 -1
- package/src/list/listItemStyles.ts +1 -0
- package/src/list/listStyles.ts +1 -0
- package/src/list/types.ts +1 -0
- package/src/media-queries/AppSizeProvider.tsx +7 -5
- package/src/media-queries/useMediaQuery.ts +5 -3
- package/src/menu/DropdownMenu.tsx +5 -3
- package/src/menu/Menu.tsx +8 -6
- package/src/menu/MenuBar.tsx +2 -0
- package/src/menu/MenuButton.tsx +3 -1
- package/src/menu/MenuConfigurationProvider.tsx +4 -2
- package/src/menu/MenuItem.tsx +2 -0
- package/src/menu/MenuItemButton.tsx +3 -1
- package/src/menu/MenuItemCircularProgress.tsx +2 -1
- package/src/menu/MenuItemGroup.tsx +3 -1
- package/src/menu/MenuItemSeparator.tsx +3 -1
- package/src/menu/MenuSheet.tsx +3 -1
- package/src/menu/MenuVisibilityProvider.tsx +4 -2
- package/src/menu/MenuWidget.tsx +3 -1
- package/src/menu/MenuWidgetKeyboardProvider.tsx +2 -0
- package/src/menu/useContextMenu.ts +2 -0
- package/src/menu/useMenuBarProvider.ts +2 -0
- package/src/movement/types.ts +1 -0
- package/src/movement/useKeyboardMovementProvider.ts +2 -0
- package/src/movement/utils.ts +1 -0
- package/src/navigation/CollapsibleNavGroup.tsx +3 -1
- package/src/navigation/DefaultNavigationRenderer.tsx +1 -0
- package/src/navigation/NavGroup.tsx +2 -1
- package/src/navigation/NavItem.tsx +2 -1
- package/src/navigation/NavItemButton.tsx +4 -2
- package/src/navigation/NavItemLink.tsx +4 -2
- package/src/navigation/NavSubheader.tsx +2 -1
- package/src/navigation/Navigation.tsx +3 -2
- package/src/navigation/navGroupStyles.ts +1 -0
- package/src/navigation/navItemStyles.ts +1 -0
- package/src/navigation/types.ts +1 -0
- package/src/navigation/useActiveHeadingId.ts +8 -6
- package/src/navigation/useNavigationExpansion.ts +2 -0
- package/src/navigation/useTableOfContentsHeadings.ts +150 -0
- package/src/objectFit.ts +1 -0
- package/src/overlay/Overlay.tsx +4 -2
- package/src/overlay/overlayStyles.ts +10 -10
- package/src/portal/Portal.tsx +1 -0
- package/src/portal/PortalContainerProvider.tsx +4 -3
- package/src/positioning/createHorizontalPosition.ts +1 -1
- package/src/positioning/createVerticalPosition.ts +1 -1
- package/src/positioning/useFixedPositioning.ts +17 -12
- package/src/progress/CircularProgress.tsx +3 -2
- package/src/progress/LinearProgress.tsx +3 -2
- package/src/responsive-item/ResponsiveItem.tsx +3 -2
- package/src/responsive-item/ResponsiveItemOverlay.tsx +3 -2
- package/src/responsive-item/responsiveItemOverlayStyles.ts +1 -0
- package/src/responsive-item/responsiveItemStyles.ts +1 -0
- package/src/scroll/ScrollLock.tsx +1 -0
- package/src/scroll/useScrollLock.ts +3 -1
- package/src/searching/fuzzy.ts +1 -1
- package/src/searching/useFuzzyMatch.ts +2 -0
- package/src/segmented-button/SegmentedButton.tsx +4 -2
- package/src/segmented-button/SegmentedButtonContainer.tsx +3 -2
- package/src/segmented-button/segmentedButtonContainerStyles.ts +1 -0
- package/src/segmented-button/segmentedButtonStyles.ts +1 -0
- package/src/sheet/Sheet.tsx +4 -2
- package/src/sheet/styles.ts +3 -3
- package/src/snackbar/DefaultToastRenderer.tsx +5 -3
- package/src/snackbar/Snackbar.tsx +4 -2
- package/src/snackbar/Toast.tsx +4 -2
- package/src/snackbar/ToastActionButton.tsx +2 -0
- package/src/snackbar/ToastCloseButton.tsx +3 -1
- package/src/snackbar/ToastContent.tsx +3 -1
- package/src/snackbar/ToastManager.tsx +1 -0
- package/src/snackbar/ToastManagerProvider.tsx +4 -3
- package/src/snackbar/snackbarStyles.ts +1 -0
- package/src/snackbar/toastContentStyles.ts +1 -0
- package/src/snackbar/toastStyles.ts +2 -1
- package/src/snackbar/useCurrentToastActions.ts +1 -0
- package/src/storage/internalUtils.ts +43 -0
- package/src/storage/types.ts +88 -0
- package/src/storage/useStorage.ts +277 -0
- package/src/storage/utils.ts +156 -0
- package/src/suspense/CircularProgressSuspense.tsx +2 -1
- package/src/suspense/NullSuspense.tsx +1 -1
- package/src/table/StickyTableSection.tsx +3 -1
- package/src/table/Table.tsx +3 -1
- package/src/table/TableBody.tsx +3 -1
- package/src/table/TableCell.tsx +4 -2
- package/src/table/TableCellContent.tsx +2 -1
- package/src/table/TableCheckbox.tsx +3 -1
- package/src/table/TableConfigurationProvider.tsx +2 -0
- package/src/table/TableContainer.tsx +4 -2
- package/src/table/TableContainerProvider.tsx +2 -1
- package/src/table/TableFooter.tsx +3 -1
- package/src/table/TableHeader.tsx +3 -1
- package/src/table/TableRadio.tsx +3 -1
- package/src/table/TableRow.tsx +3 -1
- package/src/table/tableCellStyles.ts +1 -0
- package/src/table/tableFooterStyles.ts +1 -0
- package/src/table/tableHeaderStyles.ts +1 -0
- package/src/table/tableRowStyles.ts +1 -0
- package/src/table/tableStyles.ts +1 -0
- package/src/table/useStickyTableSection.tsx +4 -2
- package/src/table/useTableSectionConfig.ts +2 -0
- package/src/tabs/SimpleTabPanel.tsx +35 -0
- package/src/tabs/SimpleTabPanels.tsx +28 -0
- package/src/tabs/Tab.tsx +4 -3
- package/src/tabs/TabList.tsx +38 -51
- package/src/tabs/TabListScrollButton.tsx +6 -3
- package/src/tabs/tabIndicatorStyles.ts +1 -0
- package/src/tabs/tabListScrollButtonStyles.ts +1 -0
- package/src/tabs/tabListStyles.ts +22 -2
- package/src/tabs/tabStyles.ts +8 -0
- package/src/tabs/types.ts +30 -0
- package/src/tabs/useMaxTabPanelHeight.ts +138 -0
- package/src/tabs/useTabList.ts +45 -8
- package/src/tabs/useTabs.ts +64 -79
- package/src/tabs/utils.ts +9 -0
- package/src/test-utils/drag.ts +10 -2
- package/src/test-utils/index.ts +6 -5
- package/src/test-utils/jest-globals/index.ts +4 -0
- package/src/test-utils/jest-globals/match-media.ts +41 -0
- package/src/test-utils/jest-globals/resize-observer.ts +11 -0
- package/src/test-utils/{jest-setup.ts → jest-globals/setup.ts} +4 -2
- package/src/test-utils/{timers.ts → jest-globals/timers.ts} +2 -2
- package/src/test-utils/jest-globals/uploadMenuItemFileInput.ts +52 -0
- package/src/test-utils/{ResizeObserver.ts → mocks/ResizeObserver.ts} +25 -59
- package/src/test-utils/mocks/match-media-implementation.ts +111 -0
- package/src/test-utils/mocks/match-media.ts +63 -0
- package/src/test-utils/polyfills/IntersectionObserver.ts +1 -1
- package/src/test-utils/polyfills/ResizeObserver.ts +1 -1
- package/src/test-utils/polyfills/matchMedia.ts +1 -1
- package/src/test-utils/queries/index.ts +2 -0
- package/src/test-utils/queries/select.ts +116 -0
- package/src/test-utils/queries/slider.ts +247 -0
- package/src/test-utils/queries/types.ts +13 -0
- package/src/test-utils/render.tsx +2 -1
- package/src/test-utils/utils/createFileList.ts +27 -0
- package/src/test-utils/utils/createResizeObserverEntry.ts +47 -0
- package/src/test-utils/vitest/index.ts +4 -0
- package/src/test-utils/vitest/match-media.ts +41 -0
- package/src/test-utils/vitest/resize-observer.ts +11 -0
- package/src/test-utils/vitest/setup.ts +15 -0
- package/src/test-utils/vitest/timers.ts +48 -0
- package/src/test-utils/vitest/uploadMenuItemFileInput.ts +52 -0
- package/src/theme/LocalStorageColorSchemeProvider.tsx +30 -30
- package/src/theme/ThemeProvider.tsx +9 -7
- package/src/theme/isColorScheme.ts +8 -6
- package/src/theme/types.ts +11 -23
- package/src/theme/useCSSVariables.ts +10 -15
- package/src/theme/useColorScheme.ts +19 -15
- package/src/theme/useColorSchemeMetaTag.ts +17 -2
- package/src/theme/useColorSchemeProvider.ts +36 -37
- package/src/theme/{usePrefersDarkScheme.ts → usePrefersDarkTheme.ts} +1 -0
- package/src/tooltip/Tooltip.tsx +3 -1
- package/src/tooltip/TooltipHoverModeProvider.tsx +6 -4
- package/src/tooltip/tooltipStyles.ts +2 -1
- package/src/tooltip/useTooltip.ts +15 -10
- package/src/tooltip/useTooltipPosition.ts +2 -0
- package/src/transition/CSSTransition.tsx +3 -1
- package/src/transition/Collapse.tsx +4 -2
- package/src/transition/CrossFade.tsx +5 -3
- package/src/transition/ScaleTransition.tsx +4 -2
- package/src/transition/SkeletonPlaceholder.tsx +4 -2
- package/src/transition/Slide.tsx +3 -1
- package/src/transition/SlideContainer.tsx +2 -1
- package/src/transition/collapseStyles.ts +1 -0
- package/src/transition/config.ts +4 -1
- package/src/transition/maxWidthTransition.ts +7 -0
- package/src/transition/skeletonPlaceholderUtils.ts +1 -0
- package/src/transition/types.ts +0 -2
- package/src/transition/useCSSTransition.ts +10 -4
- package/src/transition/useCarousel.ts +2 -0
- package/src/transition/useCollapseTransition.ts +20 -14
- package/src/transition/useCrossFadeTransition.ts +1 -0
- package/src/transition/useMaxWidthTransition.ts +11 -0
- package/src/transition/useScaleTransition.ts +12 -10
- package/src/transition/useSkeletonPlaceholder.ts +20 -2
- package/src/transition/useSlideTransition.ts +14 -16
- package/src/transition/useTransition.ts +3 -1
- package/src/tree/DefaultTreeItemRenderer.tsx +1 -0
- package/src/tree/Tree.tsx +3 -1
- package/src/tree/TreeGroup.tsx +3 -1
- package/src/tree/TreeItem.tsx +4 -2
- package/src/tree/TreeItemExpander.tsx +5 -3
- package/src/tree/TreeProvider.tsx +4 -2
- package/src/tree/styles.ts +1 -0
- package/src/tree/types.ts +1 -0
- package/src/tree/useTree.ts +3 -2
- package/src/tree/useTreeExpansion.ts +1 -0
- package/src/tree/useTreeItems.ts +4 -3
- package/src/tree/useTreeMovement.ts +2 -0
- package/src/tree/useTreeSelection.ts +1 -0
- package/src/typography/SrOnly.tsx +2 -1
- package/src/typography/TextContainer.tsx +3 -2
- package/src/typography/Typography.tsx +3 -2
- package/src/typography/WritingDirectionProvider.tsx +4 -2
- package/src/typography/textContainerStyles.ts +1 -0
- package/src/typography/typographyStyles.ts +2 -1
- package/src/useAsyncFunction.ts +23 -0
- package/src/useDebouncedFunction.ts +2 -0
- package/src/useDropzone.ts +50 -34
- package/src/useElementSize.ts +7 -5
- package/src/useEnsuredId.ts +1 -1
- package/src/useEnsuredRef.ts +3 -1
- package/src/useEnsuredState.ts +1 -0
- package/src/useHtmlClassName.ts +12 -0
- package/src/useIntersectionObserver.ts +5 -3
- package/src/useIsomorphicLayoutEffect.ts +1 -0
- package/src/useMutationObserver.ts +7 -6
- package/src/useOrientation.ts +1 -1
- package/src/usePageInactive.ts +8 -2
- package/src/useReadonlySet.ts +7 -4
- package/src/useResizeListener.ts +8 -4
- package/src/useResizeObserver.ts +4 -3
- package/src/useThrottledFunction.ts +2 -0
- package/src/useToggle.ts +5 -3
- package/src/useUnmounted.ts +2 -0
- package/src/useWindowSize.ts +4 -2
- package/src/utils/RenderRecursively.tsx +88 -32
- package/src/utils/alphaNumericSort.ts +10 -4
- package/src/utils/bem.ts +58 -26
- package/src/utils/getRangeDefaultValue.ts +1 -1
- package/src/utils/isElementVisible.ts +1 -1
- package/src/utils/loop.ts +2 -0
- package/src/utils/parseCssLengthUnit.ts +1 -1
- package/src/utils/wait.ts +6 -5
- package/src/window-splitter/WindowSplitter.tsx +2 -2
- package/src/window-splitter/styles.ts +1 -0
- package/src/window-splitter/useWindowSplitter.ts +7 -2
- package/dist/icon/iconConfig.js.map +0 -1
- package/dist/test-utils/IntersectionObserver.js.map +0 -1
- package/dist/test-utils/ResizeObserver.js.map +0 -1
- package/dist/test-utils/jest-setup.d.ts +0 -1
- package/dist/test-utils/jest-setup.js.map +0 -1
- package/dist/test-utils/matchMedia.d.ts +0 -97
- package/dist/test-utils/matchMedia.js +0 -112
- package/dist/test-utils/matchMedia.js.map +0 -1
- package/dist/test-utils/timers.js.map +0 -1
- package/dist/theme/usePrefersDarkScheme.js.map +0 -1
- package/dist/useLocalStorage.d.ts +0 -368
- package/dist/useLocalStorage.js +0 -377
- package/dist/useLocalStorage.js.map +0 -1
- package/src/test-utils/README.md +0 -150
- package/src/test-utils/matchMedia.ts +0 -194
- package/src/useLocalStorage.ts +0 -584
- /package/dist/icon/{iconConfig.d.ts → config.d.ts} +0 -0
- /package/dist/test-utils/{IntersectionObserver.d.ts → mocks/IntersectionObserver.d.ts} +0 -0
- /package/dist/test-utils/{IntersectionObserver.js → mocks/IntersectionObserver.js} +0 -0
- /package/dist/theme/{usePrefersDarkScheme.d.ts → usePrefersDarkTheme.d.ts} +0 -0
- /package/src/test-utils/{IntersectionObserver.ts → mocks/IntersectionObserver.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/Collapse.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { Children,
|
|
1
|
+
{"version":3,"sources":["../../src/transition/Collapse.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { Children, type ReactElement, cloneElement } from \"react\";\n\nimport {\n type CollapseElementProps,\n type CollapseTransitionHookOptions,\n useCollapseTransition,\n} from \"./useCollapseTransition.js\";\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n *\n * @since 2.0.0\n * @since 4.0.0 Updated for the new CSS Transition API.\n */\nexport interface CollapseProps<E extends HTMLElement>\n extends Omit<CollapseTransitionHookOptions<E>, \"transitionIn\"> {\n /**\n * The child element that should have a `ref` and the `style`/`className`\n * props cloned into using the `cloneElement` API. If the child is a custom\n * component, you **must** use `React.forwardRef` and pass the `ref` and the\n * other props for the transition to work correctly.\n */\n children: ReactElement<CollapseElementProps<E>>;\n\n /**\n * Boolean if the element should be collapsed.\n *\n * @see {@link CollapseTransitionHookOptions.transitionIn}\n */\n collapsed: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This is a component implementation of the {@link useCollapseTransition} hook\n * that implements the `temporary` behavior. Since this component uses the\n * `React.cloneElement` to inject the `ref` and `className` into the `children`,\n * it is recommended to use the hook instead.\n *\n * @example Simple Example\n * ```tsx\n * function Example(): ReactElement {\n * const [collapsed, setCollapsed] = useState(true);\n *\n * return (\n * <>\n * <Button onClick={() => setCollapsed(!collapsed)}>\n * Toggle\n * </Button>\n * <Collapse collapsed={collapsed}>\n * <div>\n * Some content that should only be visible while not collapsed.\n * </div>\n * </Collapse>\n * </>\n * );\n * }\n * ```\n *\n * @see {@link useCollapseTransition} for additional examples\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 2.0.0\n * @since 4.0.0 Updated for the new CSS Transition API.\n */\nexport function Collapse<E extends HTMLElement>(\n props: CollapseProps<E>\n): ReactElement {\n const { children, collapsed, className, ...options } = props;\n const child = Children.only(children);\n const { elementProps, rendered } = useCollapseTransition({\n ...options,\n className: cnb(child.props.className, className),\n transitionIn: !collapsed,\n });\n\n return <>{rendered && cloneElement(children, elementProps)}</>;\n}\n"],"names":["cnb","Children","cloneElement","useCollapseTransition","Collapse","props","children","collapsed","className","options","child","only","elementProps","rendered","transitionIn"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,EAAqBC,YAAY,QAAQ,QAAQ;AAElE,SAGEC,qBAAqB,QAChB,6BAA6B;AA2BpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCC,GACD,OAAO,SAASC,SACdC,KAAuB;IAEvB,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGC,SAAS,GAAGJ;IACvD,MAAMK,QAAQT,SAASU,IAAI,CAACL;IAC5B,MAAM,EAAEM,YAAY,EAAEC,QAAQ,EAAE,GAAGV,sBAAsB;QACvD,GAAGM,OAAO;QACVD,WAAWR,IAAIU,MAAML,KAAK,CAACG,SAAS,EAAEA;QACtCM,cAAc,CAACP;IACjB;IAEA,qBAAO;kBAAGM,0BAAYX,aAAaI,UAAUM;;AAC/C"}
|
|
@@ -25,7 +25,7 @@ export interface CrossFadeProps<E extends HTMLElement> extends CrossFadeTransiti
|
|
|
25
25
|
* `React.cloneElement` to inject the `ref` and `className` into the `children`,
|
|
26
26
|
* it is recommended to use the hook instead.
|
|
27
27
|
*
|
|
28
|
-
* @example Appear transitions with a React
|
|
28
|
+
* @example Appear transitions with a React key
|
|
29
29
|
* ```tsx
|
|
30
30
|
* import { ReactElement, useState } from "react";
|
|
31
31
|
* import { CrossFade } from "@react-md/transition";
|
|
@@ -11,7 +11,7 @@ import { useCrossFadeTransition } from "./useCrossFadeTransition.js";
|
|
|
11
11
|
* `React.cloneElement` to inject the `ref` and `className` into the `children`,
|
|
12
12
|
* it is recommended to use the hook instead.
|
|
13
13
|
*
|
|
14
|
-
* @example Appear transitions with a React
|
|
14
|
+
* @example Appear transitions with a React key
|
|
15
15
|
* ```tsx
|
|
16
16
|
* import { ReactElement, useState } from "react";
|
|
17
17
|
* import { CrossFade } from "@react-md/transition";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/CrossFade.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { Children,
|
|
1
|
+
{"version":3,"sources":["../../src/transition/CrossFade.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { Children, type ReactElement, cloneElement } from \"react\";\n\nimport { type CSSTransitionComponentImplementation } from \"./types.js\";\nimport {\n type CrossFadeTransitionHookOptions,\n useCrossFadeTransition,\n} from \"./useCrossFadeTransition.js\";\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 2.0.0\n * @since 4.0.0 Updated for the new CSS Transition API\n */\nexport interface CrossFadeProps<E extends HTMLElement>\n extends CrossFadeTransitionHookOptions<E>,\n CSSTransitionComponentImplementation<E> {\n /**\n * Unlike the {@link useCrossFadeTransition}, the `appear` value is defaulted\n * to `true` so that the transition can occur when the `key` changes.\n *\n * @see {@link CrossFadeTransitionHookOptions.appear}\n * @defaultValue `true`\n */\n appear?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * This is a component implementation of the {@link useCrossFadeTransition} hook\n * that implements the `temporary` behavior. Since this component uses the\n * `React.cloneElement` to inject the `ref` and `className` into the `children`,\n * it is recommended to use the hook instead.\n *\n * @example Appear transitions with a React key\n * ```tsx\n * import { ReactElement, useState } from \"react\";\n * import { CrossFade } from \"@react-md/transition\";\n *\n * import Page1 from \"./Page1\";\n * import Page2 from \"./Page2\";\n * import Page3 from \"./Page3\";\n *\n * function Example(): ReactElement {\n * const [page, setPage] = useState(0):\n *\n * let content: ReactNode;\n * switch (page) {\n * case 0:\n * content = <Page1 />\n * break:\n * case 1:\n * content = <Page2 />\n * break;\n * case 2:\n * content = <Page3 />\n * break;\n * default:\n * content = null;\n * }\n *\n * return (\n * <>\n * <Button\n * onClick={() => {\n * setPage(prevPage => {\n * const nextPage = prevPage + 1;\n * if (nextPage > 2) {\n * return 0;\n * }\n *\n * return nextPage;\n * })\n * }}\n * >\n * Change Page\n * </Button>\n * <CrossFade key={page}>\n * <div>{content}</div>\n * </CrossFade>\n * </>\n * );\n * }\n * ```\n *\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 2.0.0\n * @since 4.0.0 Updated for the new CSS Transition API and no longer supports\n * wrapping children in a `<div>`.\n */\nexport function CrossFade<E extends HTMLElement>(\n props: CrossFadeProps<E>\n): ReactElement {\n const { appear = true, children, className, ...options } = props;\n\n const child = Children.only(children);\n const { elementProps, rendered } = useCrossFadeTransition({\n ...options,\n appear,\n className: cnb(child.props.className, className),\n });\n\n return <>{rendered && cloneElement(children, elementProps)}</>;\n}\n"],"names":["cnb","Children","cloneElement","useCrossFadeTransition","CrossFade","props","appear","children","className","options","child","only","elementProps","rendered"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,EAAqBC,YAAY,QAAQ,QAAQ;AAGlE,SAEEC,sBAAsB,QACjB,8BAA8B;AAqBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgEC,GACD,OAAO,SAASC,UACdC,KAAwB;IAExB,MAAM,EAAEC,SAAS,IAAI,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,SAAS,GAAGJ;IAE3D,MAAMK,QAAQT,SAASU,IAAI,CAACJ;IAC5B,MAAM,EAAEK,YAAY,EAAEC,QAAQ,EAAE,GAAGV,uBAAuB;QACxD,GAAGM,OAAO;QACVH;QACAE,WAAWR,IAAIU,MAAML,KAAK,CAACG,SAAS,EAAEA;IACxC;IAEA,qBAAO;kBAAGK,0BAAYX,aAAaK,UAAUK;;AAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/ScaleTransition.tsx"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { Children,
|
|
1
|
+
{"version":3,"sources":["../../src/transition/ScaleTransition.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { Children, type ReactElement, cloneElement } from \"react\";\n\nimport { type CSSTransitionComponentImplementation } from \"./types.js\";\nimport {\n type ScaleTransitionHookOptions,\n useScaleTransition,\n} from \"./useScaleTransition.js\";\n\n/**\n * @typeParam E - The HTMLElement type used or the ref required for the\n * transition.\n * @since 2.0.0\n * @since 4.0.0 The typeParam was added\n * @since 6.0.0 Removed portal props\n */\nexport interface ScaleTransitionProps<E extends HTMLElement>\n extends CSSTransitionComponentImplementation<E>,\n ScaleTransitionHookOptions<E> {}\n\n/**\n * **Client Component**\n *\n * A component implementation of the {@link useScaleTransition} hook that just\n * has some reasonable defaults and supports portalling the children. Since this\n * component uses the `React.cloneElement` to inject the `ref` and `className`\n * into the `children`, it is recommended to use the hook instead.\n *\n * @example Dropdown Menu Example\n * ```tsx\n * import { ReactElement, useRef, useState } from \"react\";\n * import { Button, useFixedPositioning, useScaleTransition } from \"@react-md/core\";\n *\n * function Example(): ReactElement {\n * const buttonRef = useRef<HTMLButtonElement>(null);\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { style, transitionOptions } = useFixedPositioning({\n * fixedTo: buttonRef,\n * });\n *\n * return (\n * <>\n * <Button ref={buttonRef} onClick={() => setTransitionIn(!transitionIn)}>\n * Toggle\n * </Button>\n * <ScaleTransition\n * {...transitionOptions}\n * vertical\n * transitionIn={transitionIn}\n * >\n * <div style={style}>\n * Some content within a menu\n * </div>\n * </ScaleTransition>\n * </>\n * );\n * }\n * ```\n *\n * @typeParam E - The HTMLElement type used or the ref required for the\n * transition.\n * @since 2.0.0\n * @since 4.0.0 The typeParam was added and the API was updated.\n * @since 6.0.0 Removed the built-in support for portalling.\n */\nexport function ScaleTransition<E extends HTMLElement>(\n props: ScaleTransitionProps<E>\n): ReactElement {\n const { children, className, ...options } = props;\n const child = Children.only(children);\n\n const { elementProps, rendered } = useScaleTransition({\n ...options,\n className: cnb(child.props.className, className),\n });\n\n return <>{rendered && cloneElement(children, elementProps)}</>;\n}\n"],"names":["cnb","Children","cloneElement","useScaleTransition","ScaleTransition","props","children","className","options","child","only","elementProps","rendered"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,QAAQ,EAAqBC,YAAY,QAAQ,QAAQ;AAGlE,SAEEC,kBAAkB,QACb,0BAA0B;AAajC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4CC,GACD,OAAO,SAASC,gBACdC,KAA8B;IAE9B,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAE,GAAGC,SAAS,GAAGH;IAC5C,MAAMI,QAAQR,SAASS,IAAI,CAACJ;IAE5B,MAAM,EAAEK,YAAY,EAAEC,QAAQ,EAAE,GAAGT,mBAAmB;QACpD,GAAGK,OAAO;QACVD,WAAWP,IAAIS,MAAMJ,KAAK,CAACE,SAAS,EAAEA;IACxC;IAEA,qBAAO;kBAAGK,0BAAYV,aAAaI,UAAUK;;AAC/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/SkeletonPlaceholder.tsx"],"sourcesContent":["\"use client\";\nimport {\n
|
|
1
|
+
{"version":3,"sources":["../../src/transition/SkeletonPlaceholder.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n forwardRef,\n} from \"react\";\n\nimport {\n type SkeletonPlaceholderOptions,\n useSkeletonPlaceholder,\n} from \"./useSkeletonPlaceholder.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-skeleton-placeholder-background-color\"?: string;\n \"--rmd-skeleton-placeholder-height\"?: string | number;\n \"--rmd-skeleton-placeholder-width\"?: string | number;\n }\n}\n\n/** @since 6.0.0 */\nexport interface SkeletonPlaceholderProps\n extends HTMLAttributes<HTMLDivElement>,\n SkeletonPlaceholderOptions {\n /**\n * @defaultValue `!!children`\n * @see {@link SkeletonPlaceholderOptions.disabled}\n */\n disabled?: boolean;\n\n /** @see {@link SkeletonPlaceholderOptions.disabled} for an example */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"@react\";\n * import { SkeletonPlaceholder } from \"@react-md/core\";\n *\n * interface ExampleProps {\n * loading: boolean;\n * children: ReactNode;\n * }\n *\n * export default function Example({ loading, children }: ExampleProps): ReactElement {\n * if (loading) {\n * return <SkeletonPlaceholder />;\n * }\n *\n * return <>{children}</>;\n * }\n * ```\n *\n * @example Pre-rendered Layout\n * ```tsx\n * import type { ReactElement } from \"@react\";\n * import { SkeletonPlaceholder } from \"@react-md/core\";\n *\n * interface Data {\n * id: string;\n * name: string;\n * createdBy: string\n * createdOn: string;\n * modifiedBy: string;\n * modifiedOn: string;\n * }\n *\n * function ShowData({\n * id,\n * name,\n * createdBy,\n * createdOn,\n * modifiedBy,\n * modifiedOn,\n * }: Partial<Data>:: ReactElement {\n * const loading =\n * !name &&\n * !createdBy &&\n * !createdOn &&\n * !modifiedBy &&\n * !modifiedOn;\n *\n * return (\n * <Box grid gridName=\"custom-class-name\">\n * <SkeletonPlaceholder disabled={!loading}>\n * {id}\n * </SkeletonPlaceholder>\n * <SkeletonPlaceholder disabled={!loading}>\n * {name}\n * </SkeletonPlaceholder>\n * <SkeletonPlaceholder disabled={!loading}>\n * {createdOn}\n * </SkeletonPlaceholder>\n * <SkeletonPlaceholder disabled={!loading}>\n * {createdBy}\n * </SkeletonPlaceholder>\n * <SkeletonPlaceholder disabled={!loading}>\n * {modifiedOn}\n * </SkeletonPlaceholder>\n * <SkeletonPlaceholder disabled={!loading}>\n * {modifiedBy}\n * </SkeletonPlaceholder>\n * </Box>\n * );\n * }\n *\n * export function Example(): ReactElement {\n * const { data } = useLoadSomeDataQuery();\n *\n * const items = useMemo(() => {\n * // if the data has been fetched, just return the data\n * if (data) {\n * return data;\n * }\n *\n * // if the data does not exist, set up a skeleton of your layout by\n * // rendering a random number of items.\n * //\n * // NOTE: This is memoized so you don't create a random length each\n * // render\n * const length = randomInt({ min: 3, max: 10 })\n * return Array.from({ length }, (_, i) => ({ id: `placeholder-${i}` }));\n * }, [data])\n *\n * return (\n * <List>\n * {items.map((item) => <ShowData {...item} />)}\n * </List>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const SkeletonPlaceholder = forwardRef<\n HTMLDivElement,\n SkeletonPlaceholderProps\n>(function SkeletonPlaceholder(props, ref): ReactElement {\n const {\n style,\n className,\n height,\n width,\n children,\n disabled = !!children,\n delay,\n minDelay,\n maxDelay,\n minPercentage,\n maxPercentage,\n ...remaining\n } = props;\n const skeleton = useSkeletonPlaceholder({\n disabled,\n style,\n className,\n height,\n width,\n delay,\n minDelay,\n maxDelay,\n minPercentage,\n maxPercentage,\n });\n\n return (\n <div {...remaining} ref={ref} {...skeleton}>\n {children}\n </div>\n );\n});\n"],"names":["forwardRef","useSkeletonPlaceholder","SkeletonPlaceholder","props","ref","style","className","height","width","children","disabled","delay","minDelay","maxDelay","minPercentage","maxPercentage","remaining","skeleton","div"],"mappings":"AAAA;;AAEA,SAIEA,UAAU,QACL,QAAQ;AAEf,SAEEC,sBAAsB,QACjB,8BAA8B;AAwBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsGC,GACD,OAAO,MAAMC,oCAAsBF,WAGjC,SAASE,oBAAoBC,KAAK,EAAEC,GAAG;IACvC,MAAM,EACJC,KAAK,EACLC,SAAS,EACTC,MAAM,EACNC,KAAK,EACLC,QAAQ,EACRC,WAAW,CAAC,CAACD,QAAQ,EACrBE,KAAK,EACLC,QAAQ,EACRC,QAAQ,EACRC,aAAa,EACbC,aAAa,EACb,GAAGC,WACJ,GAAGb;IACJ,MAAMc,WAAWhB,uBAAuB;QACtCS;QACAL;QACAC;QACAC;QACAC;QACAG;QACAC;QACAC;QACAC;QACAC;IACF;IAEA,qBACE,KAACG;QAAK,GAAGF,SAAS;QAAEZ,KAAKA;QAAM,GAAGa,QAAQ;kBACvCR;;AAGP,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/Slide.tsx"],"sourcesContent":["\"use client\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/transition/Slide.tsx"],"sourcesContent":["\"use client\";\n\nimport { type HTMLAttributes, type ReactNode, forwardRef } from \"react\";\n\nimport {\n type CSSTransitionComponentProps,\n type TransitionActions,\n type TransitionTimeout,\n} from \"./types.js\";\nimport {\n DEFAULT_SLIDE_TRANSITION_TIMEOUT,\n useSlideTransition,\n} from \"./useSlideTransition.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-slide-duration\"?: string | number;\n }\n}\n\n/** @since 6.0.0 */\nexport interface SlideProps\n extends HTMLAttributes<HTMLDivElement>,\n CSSTransitionComponentProps,\n TransitionActions {\n /**\n * Set this to `true` to animate this slide into view within a\n * `SlideContainer`. When this switches from `true` to `false`, it will\n * animate out.\n */\n active: boolean;\n\n /** @defaultValue {@link DEFAULT_SLIDE_TRANSITION_DURATION} */\n timeout?: TransitionTimeout;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * A reasonable default for handling a slide transition using\n * {@link useSlideTransition}.\n *\n * @see {@link SlideContainer} for example usage.\n * @since 6.0.0\n */\nexport const Slide = forwardRef<HTMLDivElement, SlideProps>(\n function Slide(props, nodeRef) {\n const {\n active,\n appear,\n enter,\n exit,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n className,\n children,\n timeout = DEFAULT_SLIDE_TRANSITION_TIMEOUT,\n temporary = false,\n exitedHidden = true,\n ...remaining\n } = props;\n\n const { rendered, elementProps } = useSlideTransition({\n nodeRef,\n appear,\n enter,\n exit,\n onEnter,\n onEntering,\n onEntered,\n onExit,\n onExiting,\n onExited,\n className,\n timeout,\n temporary,\n transitionIn: active,\n exitedHidden,\n });\n\n if (!rendered) {\n return null;\n }\n\n return (\n <div {...remaining} {...elementProps}>\n {children}\n </div>\n );\n }\n);\n"],"names":["forwardRef","DEFAULT_SLIDE_TRANSITION_TIMEOUT","useSlideTransition","Slide","props","nodeRef","active","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","className","children","timeout","temporary","exitedHidden","remaining","rendered","elementProps","transitionIn","div"],"mappings":"AAAA;;AAEA,SAA8CA,UAAU,QAAQ,QAAQ;AAOxE,SACEC,gCAAgC,EAChCC,kBAAkB,QACb,0BAA0B;AAyBjC;;;;;;;;CAQC,GACD,OAAO,MAAMC,sBAAQH,WACnB,SAASG,MAAMC,KAAK,EAAEC,OAAO;IAC3B,MAAM,EACJC,MAAM,EACNC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,OAAO,EACPC,UAAU,EACVC,SAAS,EACTC,MAAM,EACNC,SAAS,EACTC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,UAAUjB,gCAAgC,EAC1CkB,YAAY,KAAK,EACjBC,eAAe,IAAI,EACnB,GAAGC,WACJ,GAAGjB;IAEJ,MAAM,EAAEkB,QAAQ,EAAEC,YAAY,EAAE,GAAGrB,mBAAmB;QACpDG;QACAE;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAE;QACAC;QACAK,cAAclB;QACdc;IACF;IAEA,IAAI,CAACE,UAAU;QACb,OAAO;IACT;IAEA,qBACE,KAACG;QAAK,GAAGJ,SAAS;QAAG,GAAGE,YAAY;kBACjCN;;AAGP,GACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/SlideContainer.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport {
|
|
1
|
+
{"version":3,"sources":["../../src/transition/SlideContainer.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { bem } from \"../utils/bem.js\";\n\nconst styles = bem(\"rmd-slide-container\");\n\n/**\n * @example Direction \"left\"\n * ```\n * -------------\n * | |\n * | Slide 1 | Slide 2\n * | |\n * -------------\n * -------------\n * | |\n * Slide 1 Slide 2\n * | |\n * -------------\n * -------------\n * | |\n * Slide 1 | Slide 2 |\n * | |\n * -------------\n * ```\n *\n * @example Direction \"right\"\n * ```\n * -------------\n * | |\n * Slide 1 | Slide 2 |\n * | |\n * -------------\n * -------------\n * | |\n * Slide 1 Slide 2\n * | |\n * -------------\n * -------------\n * | |\n * | Slide 1 | Slide 2\n * | |\n * -------------\n * ```\n *\n * @since 6.0.0\n */\nexport type SlideDirection = \"left\" | \"right\";\n\n/** @since 6.0.0 */\nexport interface SlideContainerClassNameOptions {\n className?: string;\n\n /** @see {@link SlideDirection} */\n direction: SlideDirection;\n}\n\n/**\n * @see {@link useSlideTransition} for an example\n * @since 6.0.0\n */\nexport function slideContainer(\n options: SlideContainerClassNameOptions\n): string {\n const { className, direction } = options;\n\n return cnb(styles({ [direction]: true }), className);\n}\n\n/** @since 6.0.0 */\nexport interface SlideContainerProps\n extends HTMLAttributes<HTMLDivElement>,\n SlideContainerClassNameOptions {}\n\n/**\n * The `SlideContainer` is used to enable a slide transition when child `Slide`\n * components change.\n *\n * @example Simple Example\n * ```tsx\n * import { SlideContainer, Slide } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n * import { useState } from \"react\";\n *\n * interface State {\n * direction: SlideDirection;\n * activeIndex: number;\n * }\n *\n * function Example(): ReactElement {\n * const [state, setState] = useState<State>({\n * direction: \"left\",\n * activeIndex: 0,\n * });\n * const { direction, activeIndex } = state;\n *\n * // when changing a slide, `direction` should be set to \"left\" if the\n * // previous `activeIndex` is less than the next index\n * //\n * // i.e.\n * // setState((prevState) => ({\n * // direction: prevState.activeIndex < index ? \"left\" : \"right\",\n * // activeIndex: index,\n * // }))\n *\n * return (\n * <SlideContainer direction={direction}>\n * <Slide active={activeIndex === 0}>\n * Slide 1\n * </Slide>\n * <Slide active={activeIndex === 1}>\n * Slide 2\n * </Slide>\n * <Slide active={activeIndex === 2}>\n * Slide 3\n * </Slide>\n * </SlideContainer>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const SlideContainer = forwardRef<HTMLDivElement, SlideContainerProps>(\n function SlideContainer(props, ref) {\n const { className, direction, children, ...remaining } = props;\n\n return (\n <div\n {...remaining}\n ref={ref}\n className={slideContainer({ className, direction })}\n >\n {children}\n </div>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","styles","slideContainer","options","className","direction","SlideContainer","props","ref","children","remaining","div"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8BC,UAAU,QAAQ,QAAQ;AAExD,SAASC,GAAG,QAAQ,kBAAkB;AAEtC,MAAMC,SAASD,IAAI;AAqDnB;;;CAGC,GACD,OAAO,SAASE,eACdC,OAAuC;IAEvC,MAAM,EAAEC,SAAS,EAAEC,SAAS,EAAE,GAAGF;IAEjC,OAAOL,IAAIG,OAAO;QAAE,CAACI,UAAU,EAAE;IAAK,IAAID;AAC5C;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgDC,GACD,OAAO,MAAME,+BAAiBP,WAC5B,SAASO,eAAeC,KAAK,EAAEC,GAAG;IAChC,MAAM,EAAEJ,SAAS,EAAEC,SAAS,EAAEI,QAAQ,EAAE,GAAGC,WAAW,GAAGH;IAEzD,qBACE,KAACI;QACE,GAAGD,SAAS;QACbF,KAAKA;QACLJ,WAAWF,eAAe;YAAEE;YAAWC;QAAU;kBAEhDI;;AAGP,GACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/collapseStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\n\nconst styles = bem(\"rmd-collapse\");\n\n/**\n * @since 6.0.0\n */\nexport interface CollapseClassNameOptions {\n className?: string;\n enter?: boolean;\n leave?: boolean;\n exited?: boolean;\n disableOverflow?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function collapse(options: CollapseClassNameOptions = {}): string {\n const { enter, leave, exited, disableOverflow, className } = options;\n\n return cnb(\n styles({\n enter,\n leave,\n \"no-overflow\": disableOverflow,\n }),\n exited && DISPLAY_NONE_CLASS,\n className\n );\n}\n"],"names":["cnb","bem","DISPLAY_NONE_CLASS","styles","collapse","options","enter","leave","exited","disableOverflow","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;
|
|
1
|
+
{"version":3,"sources":["../../src/transition/collapseStyles.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { bem } from \"../utils/bem.js\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\n\nconst styles = bem(\"rmd-collapse\");\n\n/**\n * @since 6.0.0\n */\nexport interface CollapseClassNameOptions {\n className?: string;\n enter?: boolean;\n leave?: boolean;\n exited?: boolean;\n disableOverflow?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function collapse(options: CollapseClassNameOptions = {}): string {\n const { enter, leave, exited, disableOverflow, className } = options;\n\n return cnb(\n styles({\n enter,\n leave,\n \"no-overflow\": disableOverflow,\n }),\n exited && DISPLAY_NONE_CLASS,\n className\n );\n}\n"],"names":["cnb","bem","DISPLAY_NONE_CLASS","styles","collapse","options","enter","leave","exited","disableOverflow","className"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE,MAAMC,SAASF,IAAI;AAanB;;CAEC,GACD,OAAO,SAASG,SAASC,UAAoC,CAAC,CAAC;IAC7D,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,MAAM,EAAEC,eAAe,EAAEC,SAAS,EAAE,GAAGL;IAE7D,OAAOL,IACLG,OAAO;QACLG;QACAC;QACA,eAAeE;IACjB,IACAD,UAAUN,oBACVQ;AAEJ"}
|
|
@@ -9,7 +9,10 @@ export interface TransitionConfig {
|
|
|
9
9
|
* simple and will automatically be set when using:
|
|
10
10
|
*
|
|
11
11
|
* ```ts
|
|
12
|
-
* import "@react-md/core/test-utils/jest-setup
|
|
12
|
+
* import "@react-md/core/test-utils/jest-globals/setup";
|
|
13
|
+
*
|
|
14
|
+
* // or
|
|
15
|
+
* import "@react-md/core/test-utils/vitest/setup";
|
|
13
16
|
* ```
|
|
14
17
|
*
|
|
15
18
|
* @defaultValue `false`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/config.ts"],"sourcesContent":["/**\n * @since 6.0.0\n */\nexport interface TransitionConfig {\n /**\n * Set this to `true` to disable all transitions from `react-md`.\n *\n * Note: It is recommended to set this to `true` in testing to keep things\n * simple and will automatically be set when using:\n *\n * ```ts\n * import \"@react-md/core/test-utils/jest-setup
|
|
1
|
+
{"version":3,"sources":["../../src/transition/config.ts"],"sourcesContent":["/**\n * @since 6.0.0\n */\nexport interface TransitionConfig {\n /**\n * Set this to `true` to disable all transitions from `react-md`.\n *\n * Note: It is recommended to set this to `true` in testing to keep things\n * simple and will automatically be set when using:\n *\n * ```ts\n * import \"@react-md/core/test-utils/jest-globals/setup\";\n *\n * // or\n * import \"@react-md/core/test-utils/vitest/setup\";\n * ```\n *\n * @defaultValue `false`\n */\n disabled: boolean;\n}\n\n// NOTE: Uses get/set for test mocking\n\nlet disabled = false;\n\n/**\n * @since 6.0.0\n */\nexport const TRANSITION_CONFIG: TransitionConfig = {\n get disabled() {\n return disabled;\n },\n set disabled(nextDisabled: boolean) {\n disabled = nextDisabled;\n },\n};\n"],"names":["disabled","TRANSITION_CONFIG","nextDisabled"],"mappings":"AAAA;;CAEC,GAoBD,sCAAsC;AAEtC,IAAIA,WAAW;AAEf;;CAEC,GACD,OAAO,MAAMC,oBAAsC;IACjD,IAAID,YAAW;QACb,OAAOA;IACT;IACA,IAAIA,UAASE,aAAuB;QAClCF,WAAWE;IACb;AACF,EAAE"}
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 6.0.0
|
|
3
|
+
*/
|
|
1
4
|
export interface MaxWidthTransitionClassNameOptions {
|
|
2
5
|
className?: string;
|
|
3
6
|
disabled?: boolean;
|
|
4
7
|
transitionIn: boolean;
|
|
5
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @since 6.0.0
|
|
11
|
+
*/
|
|
6
12
|
export declare function maxWidthTransition(options: MaxWidthTransitionClassNameOptions): string;
|
|
@@ -2,7 +2,9 @@ import { cnb } from "cnbuilder";
|
|
|
2
2
|
import { bem } from "../utils/bem.js";
|
|
3
3
|
import { DISPLAY_NONE_CLASS } from "../utils/isElementVisible.js";
|
|
4
4
|
const styles = bem("rmd-max-width-transition");
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* @since 6.0.0
|
|
7
|
+
*/ export function maxWidthTransition(options) {
|
|
6
8
|
const { disabled, className, transitionIn } = options;
|
|
7
9
|
return cnb(!disabled && styles({
|
|
8
10
|
visible: transitionIn
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/maxWidthTransition.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { bem } from \"../utils/bem.js\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\n\nconst styles = bem(\"rmd-max-width-transition\");\n\nexport interface MaxWidthTransitionClassNameOptions {\n className?: string;\n\n disabled?: boolean;\n transitionIn: boolean;\n}\n\nexport function maxWidthTransition(\n options: MaxWidthTransitionClassNameOptions\n): string {\n const { disabled, className, transitionIn } = options;\n\n return cnb(\n !disabled && styles({ visible: transitionIn }),\n disabled && !transitionIn && DISPLAY_NONE_CLASS,\n className\n );\n}\n"],"names":["cnb","bem","DISPLAY_NONE_CLASS","styles","maxWidthTransition","options","disabled","className","transitionIn","visible"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;
|
|
1
|
+
{"version":3,"sources":["../../src/transition/maxWidthTransition.ts"],"sourcesContent":["import { cnb } from \"cnbuilder\";\n\nimport { bem } from \"../utils/bem.js\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\n\nconst styles = bem(\"rmd-max-width-transition\");\n\n/**\n * @since 6.0.0\n */\nexport interface MaxWidthTransitionClassNameOptions {\n className?: string;\n\n disabled?: boolean;\n transitionIn: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function maxWidthTransition(\n options: MaxWidthTransitionClassNameOptions\n): string {\n const { disabled, className, transitionIn } = options;\n\n return cnb(\n !disabled && styles({ visible: transitionIn }),\n disabled && !transitionIn && DISPLAY_NONE_CLASS,\n className\n );\n}\n"],"names":["cnb","bem","DISPLAY_NONE_CLASS","styles","maxWidthTransition","options","disabled","className","transitionIn","visible"],"mappings":"AAAA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE,MAAMC,SAASF,IAAI;AAYnB;;CAEC,GACD,OAAO,SAASG,mBACdC,OAA2C;IAE3C,MAAM,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,YAAY,EAAE,GAAGH;IAE9C,OAAOL,IACL,CAACM,YAAYH,OAAO;QAAEM,SAASD;IAAa,IAC5CF,YAAY,CAACE,gBAAgBN,oBAC7BK;AAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/skeletonPlaceholderUtils.ts"],"sourcesContent":["import { type CSSProperties } from \"react\";\nimport { bem } from \"../utils/bem.js\";\nimport { randomInt } from \"../utils/randomInt.js\";\n\n/**\n * @since 6.0.0\n */\nexport const skeletonPlaceholder = bem(\"rmd-skeleton-placeholder\");\n\n/**\n * @since 6.0.0\n */\nexport interface SkeletonPlaceholderRandomOptions {\n /**\n * The minimum `animation-delay` milliseconds allowed in the random generator.\n * This value should be: `0 <= minDelay < maxDelay`.\n *\n * The `animation-delay` will be generated by:\n * ```ts\n * const delay = randomInt({\n * min: minDelay,\n * max: maxDelay,\n * });\n *\n * return {\n * animationDelay: `-${delay}ms`,\n * };\n * ```\n *\n * @defaultValue `0`\n */\n minDelay?: number;\n\n /**\n * @see {@link minDelay}\n * @defaultValue `400`\n */\n maxDelay?: number;\n\n /**\n * The minimum width percentage allowed in the random generator. This value\n * should be: `0 >= minPercentage < maxPercentage`.\n *\n * The `width` will be generated by:\n * ```ts\n * const width = randomInt({\n * min: minPercentage,\n * max: maxPercentage,\n * });\n *\n * return {\n * width: `${width}%`,\n * };\n * ```\n * @defaultValue `40`\n */\n minPercentage?: number;\n\n /**\n * @see {@link minPercentage}\n * @defaultValue `85`\n */\n maxPercentage?: number;\n}\n\n/**\n * A server-only safe util to generate a random skeleton placeholder.\n *\n * @example\n * ```tsx\n * import { skeletonPlaceholder, randomSkeletonPlaceholder } from \"@react-md/core\";\n * import \"server-only\";\n *\n * export function RandomSkeletonPlaceholder(): ReactElement {\n * return\n * <div\n * style={randomSkeletonPlaceholder()}\n * className={skeletonPlaceholder()}\n * />\n * );\n * }\n * ```\n * @since 6.0.0\n */\nexport function randomSkeletonPlaceholder(\n options: SkeletonPlaceholderRandomOptions = {}\n): CSSProperties {\n const {\n minDelay = 0,\n maxDelay = 400,\n minPercentage = 40,\n maxPercentage = 85,\n } = options;\n\n return {\n animationDelay: `-${randomInt({\n min: minDelay,\n max: maxDelay,\n })}ms`,\n width: `${randomInt({\n min: minPercentage,\n max: maxPercentage,\n })}%`,\n };\n}\n"],"names":["bem","randomInt","skeletonPlaceholder","randomSkeletonPlaceholder","options","minDelay","maxDelay","minPercentage","maxPercentage","animationDelay","min","max","width"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/transition/skeletonPlaceholderUtils.ts"],"sourcesContent":["import { type CSSProperties } from \"react\";\n\nimport { bem } from \"../utils/bem.js\";\nimport { randomInt } from \"../utils/randomInt.js\";\n\n/**\n * @since 6.0.0\n */\nexport const skeletonPlaceholder = bem(\"rmd-skeleton-placeholder\");\n\n/**\n * @since 6.0.0\n */\nexport interface SkeletonPlaceholderRandomOptions {\n /**\n * The minimum `animation-delay` milliseconds allowed in the random generator.\n * This value should be: `0 <= minDelay < maxDelay`.\n *\n * The `animation-delay` will be generated by:\n * ```ts\n * const delay = randomInt({\n * min: minDelay,\n * max: maxDelay,\n * });\n *\n * return {\n * animationDelay: `-${delay}ms`,\n * };\n * ```\n *\n * @defaultValue `0`\n */\n minDelay?: number;\n\n /**\n * @see {@link minDelay}\n * @defaultValue `400`\n */\n maxDelay?: number;\n\n /**\n * The minimum width percentage allowed in the random generator. This value\n * should be: `0 >= minPercentage < maxPercentage`.\n *\n * The `width` will be generated by:\n * ```ts\n * const width = randomInt({\n * min: minPercentage,\n * max: maxPercentage,\n * });\n *\n * return {\n * width: `${width}%`,\n * };\n * ```\n * @defaultValue `40`\n */\n minPercentage?: number;\n\n /**\n * @see {@link minPercentage}\n * @defaultValue `85`\n */\n maxPercentage?: number;\n}\n\n/**\n * A server-only safe util to generate a random skeleton placeholder.\n *\n * @example\n * ```tsx\n * import { skeletonPlaceholder, randomSkeletonPlaceholder } from \"@react-md/core\";\n * import \"server-only\";\n *\n * export function RandomSkeletonPlaceholder(): ReactElement {\n * return\n * <div\n * style={randomSkeletonPlaceholder()}\n * className={skeletonPlaceholder()}\n * />\n * );\n * }\n * ```\n * @since 6.0.0\n */\nexport function randomSkeletonPlaceholder(\n options: SkeletonPlaceholderRandomOptions = {}\n): CSSProperties {\n const {\n minDelay = 0,\n maxDelay = 400,\n minPercentage = 40,\n maxPercentage = 85,\n } = options;\n\n return {\n animationDelay: `-${randomInt({\n min: minDelay,\n max: maxDelay,\n })}ms`,\n width: `${randomInt({\n min: minPercentage,\n max: maxPercentage,\n })}%`,\n };\n}\n"],"names":["bem","randomInt","skeletonPlaceholder","randomSkeletonPlaceholder","options","minDelay","maxDelay","minPercentage","maxPercentage","animationDelay","min","max","width"],"mappings":"AAEA,SAASA,GAAG,QAAQ,kBAAkB;AACtC,SAASC,SAAS,QAAQ,wBAAwB;AAElD;;CAEC,GACD,OAAO,MAAMC,sBAAsBF,IAAI,4BAA4B;AA0DnE;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASG,0BACdC,UAA4C,CAAC,CAAC;IAE9C,MAAM,EACJC,WAAW,CAAC,EACZC,WAAW,GAAG,EACdC,gBAAgB,EAAE,EAClBC,gBAAgB,EAAE,EACnB,GAAGJ;IAEJ,OAAO;QACLK,gBAAgB,CAAC,CAAC,EAAER,UAAU;YAC5BS,KAAKL;YACLM,KAAKL;QACP,GAAG,EAAE,CAAC;QACNM,OAAO,GAAGX,UAAU;YAClBS,KAAKH;YACLI,KAAKH;QACP,GAAG,CAAC,CAAC;IACP;AACF"}
|
|
@@ -41,7 +41,6 @@ export type TransitionTimeoutObject = {
|
|
|
41
41
|
* Either a single timeout duration in milliseconds to use for each of the
|
|
42
42
|
* {@link TransitionActions} stages, or an object of transition durations.
|
|
43
43
|
*
|
|
44
|
-
* @see {@link TransitionTimeout}
|
|
45
44
|
* @since 4.0.0
|
|
46
45
|
*/
|
|
47
46
|
export type TransitionTimeout = number | Readonly<TransitionTimeoutObject>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/types.ts"],"sourcesContent":["// This is pretty much `react-transition-group` since I liked the API wanted a\n// hook implementation. I also had to redo most of the types for v4.0.0 due to\n// the new `nodeRef` stuff, so it made it easier to create the types and hooks\n// here.\n\nimport type { ReactElement, Ref, RefCallback } from \"react\";\n\n/**\n * @since 4.0.0\n */\nexport interface TransitionActions {\n /**\n * Boolean if the transition should occur immediately once the component\n * mounts if the {@link TransitionOptions.transitionIn} is `true`\n *\n * @defaultValue `false`\n */\n appear?: boolean;\n\n /**\n * Boolean if the transition should occur whenever the\n * {@link TransitionOptions.transitionIn} is switch to `true` after the\n * component has been rendered in the DOM.\n *\n * @defaultValue `true`\n */\n enter?: boolean;\n\n /**\n * Boolean if the transition should occur whenever the\n * {@link TransitionOptions.transitionIn} is switch to `false` after the\n * component has been rendered in the DOM.\n *\n * @defaultValue `true`\n */\n exit?: boolean;\n}\n\n/**\n * An object timeout values that would be used for each\n * {@link TransitionActions}. If a value is set to `0` or `undefined`, the\n * transition will not occur.\n *\n * @since 4.0.0\n */\nexport type TransitionTimeoutObject = {\n [action in keyof TransitionActions]?: number;\n};\n\n/**\n * Either a single timeout duration in milliseconds to use for each of the\n * {@link TransitionActions} stages, or an object of transition durations.\n *\n * @see {@link TransitionTimeout}\n * @since 4.0.0\n */\nexport type TransitionTimeout = number | Readonly<TransitionTimeoutObject>;\n\n/**\n * The way the transition works is by flowing through the different stages and\n * assigning waiting for a timeout to occur. Setting the `stage` to `enter` will\n * begin the enter transition going from `enter -> entering -> entered` while\n * setting the stage to `exit` will transition from `exit -> exiting -> exited`.\n *\n * @since 4.0.0\n */\nexport type TransitionStage =\n | \"enter\"\n | \"entering\"\n | \"entered\"\n | \"exit\"\n | \"exiting\"\n | \"exited\";\n\n/**\n * This function is called at each `\"enter\"` {@link TransitionStage}. If a\n * {@link TransitionOptions.nodeRef} was provided, the DOM node should be\n * available in `nodeRef.current` by this point if the transition requires DOM\n * calculations.\n *\n * @param appearing - Boolean if this is the initial `appear` flow.\n * @since 4.0.0\n */\nexport type TransitionEnterHandler = (appearing: boolean) => void;\n\n/**\n * This function is called at each `\"exit\"` {@link TransitionStage}. If a\n * {@link TransitionOptions.nodeRef} was provided, the DOM node should be\n * available in `nodeRef.current` by this point if the transition requires DOM\n * calculations.\n *\n * @since 4.0.0\n */\nexport type TransitionExitHandler = () => void;\n\n/**\n * @since 4.0.0\n */\nexport interface TransitionCallbacks {\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"enter\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onEnter?: TransitionEnterHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"enter\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onEntering?: TransitionEnterHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"entering\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onEntered?: TransitionEnterHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"entered\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onExit?: TransitionExitHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"exiting\"`.\n *\n * @see {@link TransitionExitHandler}\n */\n onExiting?: TransitionExitHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"exited\"`.\n *\n * @see {@link TransitionExitHandler}\n */\n onExited?: TransitionExitHandler;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredTransitionInDefaultedOptions<\n E extends HTMLElement,\n> extends TransitionActions,\n TransitionCallbacks {\n /**\n * An optional ref that will be merged with the\n * {@link TransitionHookReturnValue.ref}\n */\n nodeRef?: Ref<E>;\n\n /**\n * Boolean if the element should mount and unmount based on the\n * {@link PreconfiguredTransitionInDefaultedOptions.transitionIn} value.\n *\n * @defaultValue `false`\n */\n temporary?: boolean;\n\n /**\n * This boolean controls the transition by activating flowing through the\n * {@link TransitionStage}.\n *\n * @see {@link TransitionActions} for a description around the transitions.\n */\n transitionIn?: boolean;\n\n /** {@inheritDoc TransitionTimeout} */\n timeout?: TransitionTimeout;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredTransitionOptions<E extends HTMLElement>\n extends PreconfiguredTransitionInDefaultedOptions<E> {\n /** {@inheritDoc PreconfiguredTransitionInDefaultedOptions.transitionIn} */\n transitionIn: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface TransitionOptions<E extends HTMLElement>\n extends PreconfiguredTransitionOptions<E> {\n /** {@inheritDoc TransitionTimeout} */\n timeout: TransitionTimeout;\n}\n\n/**\n * An object of classnames that will be applied based on the\n * {@link TransitionStage} where all the classes in the previous stages will\n * also be applied.\n *\n * @example Explaining className application\n * ```ts\n * const { ref, className, stage, appearing } = useCSSTransition({\n * appear: true,\n * enter: true,\n * exit: true,\n * timeout: 300,\n * classNames: {\n * appear: \"appear\",\n * appearEnter: \"appear--enter\",\n * appearDone: \"appear--done appear--complete\",\n * enter: \"enter\",\n * enterEnter: \"\",\n * enterDone: \"enter--done enter--complete\",\n * exit: \"\",\n * exitEnter: \"\",\n * exitDone: \"exit--done exit--complete\",\n * }\n * });\n *\n * // stage === \"enter\" && appearing\n * // className === \"appear\"\n * //\n * // stage === \"entering\" && appearing\n * // className === \"appear appear--enter\"\n * //\n * // stage === \"entered\" && appearing\n * // className === \"appear--done appear--complete\"\n * //\n * //\n * // stage === \"enter\" && !appearing\n * // className === \"enter\"\n * //\n * // stage === \"entering\" && !appearing\n * // className === \"enter\"\n * //\n * // stage === \"entered\" && !appearing\n * // className === \"enter--done enter--complete\"\n * //\n * //\n * // stage === \"exit\"\n * // className === \"\"\n * //\n * // stage === \"exiting\"\n * // className === \"\"\n * //\n * // stage === \"exited\"\n * // className === \"exit--done exit--complete\"\n * ```\n *\n * @since 4.0.0\n */\nexport interface CSSTransitionClassNamesObject {\n /**\n * The class name to apply starting at the `\"enter\"` {@link TransitionStage}\n * while {@link TransitionState.appearing}.\n *\n * @defaultValue `\"\"`\n */\n appear?: string;\n\n /**\n * The class name to apply starting at the `\"entering\"` {@link TransitionStage}\n * while {@link TransitionState.appearing}.\n *\n * @defaultValue `\"\"`\n */\n appearActive?: string;\n\n /**\n * The class name to apply starting at the `\"entered\"` {@link TransitionStage}\n * while {@link TransitionState.appearing}.\n *\n * @defaultValue `\"\"`\n */\n appearDone?: string;\n\n /**\n * The class name to apply starting at the `\"enter\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n enter?: string;\n\n /**\n * The class name to apply starting at the `\"entering\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n enterActive?: string;\n\n /**\n * The class name to apply starting at the `\"entered\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n enterDone?: string;\n\n /**\n * The class name to apply starting at the `\"exit\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n exit?: string;\n\n /**\n * The class name to apply starting at the `\"exiting\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n exitActive?: string;\n\n /**\n * The class name to apply starting at the `\"exited\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n exitDone?: string;\n}\n\n/**\n * @since 4.0.0\n */\nexport type CSSTransitionClassNames =\n | string\n | Readonly<CSSTransitionClassNamesObject>;\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredCSSTransitionInDefaultedOptions<\n E extends HTMLElement,\n> extends PreconfiguredTransitionInDefaultedOptions<E> {\n /**\n * An optional className to be merged with the transition classes.\n */\n className?: string;\n\n /**\n * When this is `true` and the {@link temporary} option is `false`, the\n * element will gain a class name to hide it with `display: none` instead of\n * conditionally rendering the element.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n exitedHidden?: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredCSSTransitionOptions<E extends HTMLElement>\n extends PreconfiguredCSSTransitionInDefaultedOptions<E> {\n /** {@inheritDoc PreconfiguredTransitionInDefaultedOptions.transitionIn} */\n transitionIn: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface SSRTransitionOptions {\n /**\n * This is mostly used internally to make it so that you can render portalled\n * elements inline with content if SSR is enabled in your app. To enable this\n * feature, the {@link CoreProvidersProps.ssr} must be set to `true`.\n *\n * This value will be `true` if a portalled element was rendered by default\n * from the server and remain true until it unmounts from the DOM.\n *\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface TransitionHookOptions<E extends HTMLElement>\n extends TransitionOptions<E>,\n SSRTransitionOptions {\n /**\n * Boolean if the DOM should forcefully be reflow each time a transition\n * change occurs. This is generally required for any CSS transition and is\n * set to `true` for the {@link useCSSTransition} hook.\n *\n * @defaultValue `false`\n */\n reflow?: boolean;\n}\n\n/**\n * @since 4.0.0\n */\nexport interface TransitionState {\n /** {@inheritDoc TransitionStage} */\n stage: TransitionStage;\n\n /**\n * Boolean if the element should be rendered or not. This will always be\n * `true` if the {@link TransitionOptions.temporary} is `false`. Otherwise, it\n * will be `true` when not the `\"exited\"` {@link TransitionStage}.\n */\n rendered: boolean;\n\n /**\n * Boolean if this is the first {@link TransitionActions.appear} transition.\n * This will be `true` during the first transition if\n * {@link TransitionActions.appear} was also `true`. Otherwise it will be\n * `false`.\n */\n appearing: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface TransitionHookReturnValue<E extends HTMLElement>\n extends TransitionState,\n Required<SSRTransitionOptions> {\n /**\n * A ref that is required for the transition to occur and should be passed to\n * the element affected by the transition.\n */\n ref: RefCallback<E>;\n\n /**\n * A function that can be used to specifically set the transition to a\n * specific stage. This shouldn't really be used too much and is really just\n * useful for \"appear only transitions\" that do not unmount the child\n * elements.\n *\n * @example Simple Example\n * ```tsx\n * import { ReactElement, useEffect, useRef } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n * import { useRouter } from \"react-router-dom\";\n *\n * function Example(): ReactElement {\n * const { pathname } = useRouter();\n * const { elementProps, transitionTo } = useCSSTransition({\n * transitionIn: true,\n * timeout: 1000,\n * classNames: \"some-enter-transition\",\n * });\n *\n * useEffect(() => {\n * // Do not trigger transition on first load.\n * if (prevPathname.current === pathname) {\n * return;\n * }\n *\n * prevPathname.current = pathname;\n * transitionTo(\"enter\");\n * }, [pathname, transitionTo]);\n *\n * return <div {...elementProps}>{content}</div>;\n * }\n * ```\n *\n * @param stage - The {@link TransitionStage} to set to\n */\n transitionTo: (stage: TransitionStage) => void;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionHookOptions<E extends HTMLElement>\n extends PreconfiguredCSSTransitionOptions<E>,\n SSRTransitionOptions {\n /** {@inheritDoc TransitionTimeout} */\n timeout: TransitionTimeout;\n /** {@inheritDoc CSSTransitionClassNames} */\n classNames: CSSTransitionClassNames;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionElementProps<E extends HTMLElement> {\n /** @see {@link TransitionHookReturnValue.ref} */\n ref: RefCallback<E>;\n\n /**\n * The current transition class name or `undefined`.\n */\n className: string | undefined;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionHookReturnValue<E extends HTMLElement>\n extends TransitionHookReturnValue<E>,\n CSSTransitionElementProps<E> {\n /**\n * This can be used so that you don't need to destructure multiple props from\n * the hook return value to pass to the transitioning component.\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n *\n * interface ExampleProps {\n * transitionIn: boolean;\n * children: ReactNode;\n * }\n *\n * function Example({ transitionIn, children }: ExampleProps): ReactElement | null {\n * const { elementProps, rendered } = useCSSTransition({\n * timeout: 150,\n * classNames: \"example\",\n * transitionIn,\n * });\n *\n * if (!rendered) {\n * return null;\n * }\n *\n * return <div {...elementProps}>{children}</div>\n * }\n * ```\n *\n * @example Verbose Version\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n *\n * interface ExampleProps {\n * transitionIn: boolean;\n * children: ReactNode;\n * }\n *\n * function Example({ transitionIn, children }: ExampleProps): ReactElement | null {\n * const { ref, className, rendered } = useCSSTransition({\n * timeout: 150,\n * classNames: \"example\",\n * transitionIn,\n * });\n *\n * if (!rendered) {\n * return null;\n * }\n *\n * return <div ref={ref} className={className}>{children}</div>\n * }\n * ```\n */\n elementProps: CSSTransitionElementProps<E>;\n}\n\n/**\n * This is mostly an internal type that can be used to help with transitionable\n * components.\n *\n * @since 4.0.0\n */\nexport interface CSSTransitionComponentProps extends TransitionCallbacks {\n /** @see {@link CSSTransitionHookOptions.temporary} */\n temporary?: boolean;\n /** @see {@link TransitionTimeout} */\n timeout?: TransitionTimeout;\n /** @see {@link CSSTransitionClassNames} */\n classNames?: CSSTransitionClassNames;\n /** @see {@link CSSTransitionHookOptions.exitedHidden} */\n exitedHidden?: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionComponentImplementation<E extends HTMLElement> {\n /**\n * The child element that should have a `ref` and `className` cloned into\n * using the `cloneElement` API. If the child is a custom component, you\n * **must** use `React.forwardRef` and pass both of these to a DOM element for\n * the transition to work.\n */\n children: ReactElement<{ ref: Ref<E>; className: string | undefined }>;\n}\n"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,QAAQ;AA+kBR;;;;CAIC,GACD,WAQC"}
|
|
1
|
+
{"version":3,"sources":["../../src/transition/types.ts"],"sourcesContent":["// This is pretty much `react-transition-group` since I liked the API wanted a\n// hook implementation. I also had to redo most of the types for v4.0.0 due to\n// the new `nodeRef` stuff, so it made it easier to create the types and hooks\n// here.\nimport type { ReactElement, Ref, RefCallback } from \"react\";\n\n/**\n * @since 4.0.0\n */\nexport interface TransitionActions {\n /**\n * Boolean if the transition should occur immediately once the component\n * mounts if the {@link TransitionOptions.transitionIn} is `true`\n *\n * @defaultValue `false`\n */\n appear?: boolean;\n\n /**\n * Boolean if the transition should occur whenever the\n * {@link TransitionOptions.transitionIn} is switch to `true` after the\n * component has been rendered in the DOM.\n *\n * @defaultValue `true`\n */\n enter?: boolean;\n\n /**\n * Boolean if the transition should occur whenever the\n * {@link TransitionOptions.transitionIn} is switch to `false` after the\n * component has been rendered in the DOM.\n *\n * @defaultValue `true`\n */\n exit?: boolean;\n}\n\n/**\n * An object timeout values that would be used for each\n * {@link TransitionActions}. If a value is set to `0` or `undefined`, the\n * transition will not occur.\n *\n * @since 4.0.0\n */\nexport type TransitionTimeoutObject = {\n [action in keyof TransitionActions]?: number;\n};\n\n/**\n * Either a single timeout duration in milliseconds to use for each of the\n * {@link TransitionActions} stages, or an object of transition durations.\n *\n * @since 4.0.0\n */\nexport type TransitionTimeout = number | Readonly<TransitionTimeoutObject>;\n\n/**\n * The way the transition works is by flowing through the different stages and\n * assigning waiting for a timeout to occur. Setting the `stage` to `enter` will\n * begin the enter transition going from `enter -> entering -> entered` while\n * setting the stage to `exit` will transition from `exit -> exiting -> exited`.\n *\n * @since 4.0.0\n */\nexport type TransitionStage =\n | \"enter\"\n | \"entering\"\n | \"entered\"\n | \"exit\"\n | \"exiting\"\n | \"exited\";\n\n/**\n * This function is called at each `\"enter\"` {@link TransitionStage}. If a\n * {@link TransitionOptions.nodeRef} was provided, the DOM node should be\n * available in `nodeRef.current` by this point if the transition requires DOM\n * calculations.\n *\n * @param appearing - Boolean if this is the initial `appear` flow.\n * @since 4.0.0\n */\nexport type TransitionEnterHandler = (appearing: boolean) => void;\n\n/**\n * This function is called at each `\"exit\"` {@link TransitionStage}. If a\n * {@link TransitionOptions.nodeRef} was provided, the DOM node should be\n * available in `nodeRef.current` by this point if the transition requires DOM\n * calculations.\n *\n * @since 4.0.0\n */\nexport type TransitionExitHandler = () => void;\n\n/**\n * @since 4.0.0\n */\nexport interface TransitionCallbacks {\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"enter\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onEnter?: TransitionEnterHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"enter\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onEntering?: TransitionEnterHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"entering\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onEntered?: TransitionEnterHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"entered\"`.\n *\n * @see {@link TransitionEnterHandler}\n */\n onExit?: TransitionExitHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"exiting\"`.\n *\n * @see {@link TransitionExitHandler}\n */\n onExiting?: TransitionExitHandler;\n\n /**\n * This function will be called once the {@link TransitionStage} has been set\n * to `\"exited\"`.\n *\n * @see {@link TransitionExitHandler}\n */\n onExited?: TransitionExitHandler;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredTransitionInDefaultedOptions<\n E extends HTMLElement,\n> extends TransitionActions,\n TransitionCallbacks {\n /**\n * An optional ref that will be merged with the\n * {@link TransitionHookReturnValue.ref}\n */\n nodeRef?: Ref<E>;\n\n /**\n * Boolean if the element should mount and unmount based on the\n * {@link PreconfiguredTransitionInDefaultedOptions.transitionIn} value.\n *\n * @defaultValue `false`\n */\n temporary?: boolean;\n\n /**\n * This boolean controls the transition by activating flowing through the\n * {@link TransitionStage}.\n *\n * @see {@link TransitionActions} for a description around the transitions.\n */\n transitionIn?: boolean;\n\n /** {@inheritDoc TransitionTimeout} */\n timeout?: TransitionTimeout;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredTransitionOptions<E extends HTMLElement>\n extends PreconfiguredTransitionInDefaultedOptions<E> {\n /** {@inheritDoc PreconfiguredTransitionInDefaultedOptions.transitionIn} */\n transitionIn: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface TransitionOptions<E extends HTMLElement>\n extends PreconfiguredTransitionOptions<E> {\n /** {@inheritDoc TransitionTimeout} */\n timeout: TransitionTimeout;\n}\n\n/**\n * An object of classnames that will be applied based on the\n * {@link TransitionStage} where all the classes in the previous stages will\n * also be applied.\n *\n * @example Explaining className application\n * ```ts\n * const { ref, className, stage, appearing } = useCSSTransition({\n * appear: true,\n * enter: true,\n * exit: true,\n * timeout: 300,\n * classNames: {\n * appear: \"appear\",\n * appearEnter: \"appear--enter\",\n * appearDone: \"appear--done appear--complete\",\n * enter: \"enter\",\n * enterEnter: \"\",\n * enterDone: \"enter--done enter--complete\",\n * exit: \"\",\n * exitEnter: \"\",\n * exitDone: \"exit--done exit--complete\",\n * }\n * });\n *\n * // stage === \"enter\" && appearing\n * // className === \"appear\"\n * //\n * // stage === \"entering\" && appearing\n * // className === \"appear appear--enter\"\n * //\n * // stage === \"entered\" && appearing\n * // className === \"appear--done appear--complete\"\n * //\n * //\n * // stage === \"enter\" && !appearing\n * // className === \"enter\"\n * //\n * // stage === \"entering\" && !appearing\n * // className === \"enter\"\n * //\n * // stage === \"entered\" && !appearing\n * // className === \"enter--done enter--complete\"\n * //\n * //\n * // stage === \"exit\"\n * // className === \"\"\n * //\n * // stage === \"exiting\"\n * // className === \"\"\n * //\n * // stage === \"exited\"\n * // className === \"exit--done exit--complete\"\n * ```\n *\n * @since 4.0.0\n */\nexport interface CSSTransitionClassNamesObject {\n /**\n * The class name to apply starting at the `\"enter\"` {@link TransitionStage}\n * while {@link TransitionState.appearing}.\n *\n * @defaultValue `\"\"`\n */\n appear?: string;\n\n /**\n * The class name to apply starting at the `\"entering\"` {@link TransitionStage}\n * while {@link TransitionState.appearing}.\n *\n * @defaultValue `\"\"`\n */\n appearActive?: string;\n\n /**\n * The class name to apply starting at the `\"entered\"` {@link TransitionStage}\n * while {@link TransitionState.appearing}.\n *\n * @defaultValue `\"\"`\n */\n appearDone?: string;\n\n /**\n * The class name to apply starting at the `\"enter\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n enter?: string;\n\n /**\n * The class name to apply starting at the `\"entering\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n enterActive?: string;\n\n /**\n * The class name to apply starting at the `\"entered\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n enterDone?: string;\n\n /**\n * The class name to apply starting at the `\"exit\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n exit?: string;\n\n /**\n * The class name to apply starting at the `\"exiting\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n exitActive?: string;\n\n /**\n * The class name to apply starting at the `\"exited\"` {@link TransitionStage}\n *\n * @defaultValue `\"\"`\n */\n exitDone?: string;\n}\n\n/**\n * @since 4.0.0\n */\nexport type CSSTransitionClassNames =\n | string\n | Readonly<CSSTransitionClassNamesObject>;\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredCSSTransitionInDefaultedOptions<\n E extends HTMLElement,\n> extends PreconfiguredTransitionInDefaultedOptions<E> {\n /**\n * An optional className to be merged with the transition classes.\n */\n className?: string;\n\n /**\n * When this is `true` and the {@link temporary} option is `false`, the\n * element will gain a class name to hide it with `display: none` instead of\n * conditionally rendering the element.\n *\n * @defaultValue `false`\n * @since 6.0.0\n */\n exitedHidden?: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface PreconfiguredCSSTransitionOptions<E extends HTMLElement>\n extends PreconfiguredCSSTransitionInDefaultedOptions<E> {\n /** {@inheritDoc PreconfiguredTransitionInDefaultedOptions.transitionIn} */\n transitionIn: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface SSRTransitionOptions {\n /**\n * This is mostly used internally to make it so that you can render portalled\n * elements inline with content if SSR is enabled in your app. To enable this\n * feature, the {@link CoreProvidersProps.ssr} must be set to `true`.\n *\n * This value will be `true` if a portalled element was rendered by default\n * from the server and remain true until it unmounts from the DOM.\n *\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface TransitionHookOptions<E extends HTMLElement>\n extends TransitionOptions<E>,\n SSRTransitionOptions {\n /**\n * Boolean if the DOM should forcefully be reflow each time a transition\n * change occurs. This is generally required for any CSS transition and is\n * set to `true` for the {@link useCSSTransition} hook.\n *\n * @defaultValue `false`\n */\n reflow?: boolean;\n}\n\n/**\n * @since 4.0.0\n */\nexport interface TransitionState {\n /** {@inheritDoc TransitionStage} */\n stage: TransitionStage;\n\n /**\n * Boolean if the element should be rendered or not. This will always be\n * `true` if the {@link TransitionOptions.temporary} is `false`. Otherwise, it\n * will be `true` when not the `\"exited\"` {@link TransitionStage}.\n */\n rendered: boolean;\n\n /**\n * Boolean if this is the first {@link TransitionActions.appear} transition.\n * This will be `true` during the first transition if\n * {@link TransitionActions.appear} was also `true`. Otherwise it will be\n * `false`.\n */\n appearing: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface TransitionHookReturnValue<E extends HTMLElement>\n extends TransitionState,\n Required<SSRTransitionOptions> {\n /**\n * A ref that is required for the transition to occur and should be passed to\n * the element affected by the transition.\n */\n ref: RefCallback<E>;\n\n /**\n * A function that can be used to specifically set the transition to a\n * specific stage. This shouldn't really be used too much and is really just\n * useful for \"appear only transitions\" that do not unmount the child\n * elements.\n *\n * @example Simple Example\n * ```tsx\n * import { ReactElement, useEffect, useRef } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n * import { useRouter } from \"react-router-dom\";\n *\n * function Example(): ReactElement {\n * const { pathname } = useRouter();\n * const { elementProps, transitionTo } = useCSSTransition({\n * transitionIn: true,\n * timeout: 1000,\n * classNames: \"some-enter-transition\",\n * });\n *\n * useEffect(() => {\n * // Do not trigger transition on first load.\n * if (prevPathname.current === pathname) {\n * return;\n * }\n *\n * prevPathname.current = pathname;\n * transitionTo(\"enter\");\n * }, [pathname, transitionTo]);\n *\n * return <div {...elementProps}>{content}</div>;\n * }\n * ```\n *\n * @param stage - The {@link TransitionStage} to set to\n */\n transitionTo: (stage: TransitionStage) => void;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionHookOptions<E extends HTMLElement>\n extends PreconfiguredCSSTransitionOptions<E>,\n SSRTransitionOptions {\n /** {@inheritDoc TransitionTimeout} */\n timeout: TransitionTimeout;\n /** {@inheritDoc CSSTransitionClassNames} */\n classNames: CSSTransitionClassNames;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionElementProps<E extends HTMLElement> {\n /** @see {@link TransitionHookReturnValue.ref} */\n ref: RefCallback<E>;\n\n /**\n * The current transition class name or `undefined`.\n */\n className: string | undefined;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionHookReturnValue<E extends HTMLElement>\n extends TransitionHookReturnValue<E>,\n CSSTransitionElementProps<E> {\n /**\n * This can be used so that you don't need to destructure multiple props from\n * the hook return value to pass to the transitioning component.\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n *\n * interface ExampleProps {\n * transitionIn: boolean;\n * children: ReactNode;\n * }\n *\n * function Example({ transitionIn, children }: ExampleProps): ReactElement | null {\n * const { elementProps, rendered } = useCSSTransition({\n * timeout: 150,\n * classNames: \"example\",\n * transitionIn,\n * });\n *\n * if (!rendered) {\n * return null;\n * }\n *\n * return <div {...elementProps}>{children}</div>\n * }\n * ```\n *\n * @example Verbose Version\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n *\n * interface ExampleProps {\n * transitionIn: boolean;\n * children: ReactNode;\n * }\n *\n * function Example({ transitionIn, children }: ExampleProps): ReactElement | null {\n * const { ref, className, rendered } = useCSSTransition({\n * timeout: 150,\n * classNames: \"example\",\n * transitionIn,\n * });\n *\n * if (!rendered) {\n * return null;\n * }\n *\n * return <div ref={ref} className={className}>{children}</div>\n * }\n * ```\n */\n elementProps: CSSTransitionElementProps<E>;\n}\n\n/**\n * This is mostly an internal type that can be used to help with transitionable\n * components.\n *\n * @since 4.0.0\n */\nexport interface CSSTransitionComponentProps extends TransitionCallbacks {\n /** @see {@link CSSTransitionHookOptions.temporary} */\n temporary?: boolean;\n /** @see {@link TransitionTimeout} */\n timeout?: TransitionTimeout;\n /** @see {@link CSSTransitionClassNames} */\n classNames?: CSSTransitionClassNames;\n /** @see {@link CSSTransitionHookOptions.exitedHidden} */\n exitedHidden?: boolean;\n}\n\n/**\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport interface CSSTransitionComponentImplementation<E extends HTMLElement> {\n /**\n * The child element that should have a `ref` and `className` cloned into\n * using the `cloneElement` API. If the child is a custom component, you\n * **must** use `React.forwardRef` and pass both of these to a DOM element for\n * the transition to work.\n */\n children: ReactElement<{ ref: Ref<E>; className: string | undefined }>;\n}\n"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,8EAA8E;AAC9E,8EAA8E;AAC9E,QAAQ;AA6kBR;;;;CAIC,GACD,WAQC"}
|
|
@@ -5,8 +5,10 @@ import type { CSSTransitionHookOptions, CSSTransitionHookReturnValue } from "./t
|
|
|
5
5
|
*
|
|
6
6
|
* @example Simple Transition
|
|
7
7
|
* ```tsx
|
|
8
|
-
* import {
|
|
9
|
-
* import {
|
|
8
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
9
|
+
* import { useCSSTransition } from "@react-md/core/transition/useCSSTransition";
|
|
10
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
11
|
+
* import { type ReactElement, useState } from "react";
|
|
10
12
|
*
|
|
11
13
|
* // Pretend styles
|
|
12
14
|
* // .enter {
|
|
@@ -55,8 +57,10 @@ import type { CSSTransitionHookOptions, CSSTransitionHookReturnValue } from "./t
|
|
|
55
57
|
*
|
|
56
58
|
* @example Visibility Transition
|
|
57
59
|
* ```tsx
|
|
58
|
-
* import {
|
|
59
|
-
* import {
|
|
60
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
61
|
+
* import { useCSSTransition } from "@react-md/core/transition/useCSSTransition";
|
|
62
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
63
|
+
* import { type ReactElement, useState } from "react";
|
|
60
64
|
*
|
|
61
65
|
* // Pretend styles
|
|
62
66
|
* // .enter {
|
|
@@ -9,8 +9,10 @@ import { getTransitionClassNames } from "./utils.js";
|
|
|
9
9
|
*
|
|
10
10
|
* @example Simple Transition
|
|
11
11
|
* ```tsx
|
|
12
|
-
* import {
|
|
13
|
-
* import {
|
|
12
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
13
|
+
* import { useCSSTransition } from "@react-md/core/transition/useCSSTransition";
|
|
14
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
15
|
+
* import { type ReactElement, useState } from "react";
|
|
14
16
|
*
|
|
15
17
|
* // Pretend styles
|
|
16
18
|
* // .enter {
|
|
@@ -59,8 +61,10 @@ import { getTransitionClassNames } from "./utils.js";
|
|
|
59
61
|
*
|
|
60
62
|
* @example Visibility Transition
|
|
61
63
|
* ```tsx
|
|
62
|
-
* import {
|
|
63
|
-
* import {
|
|
64
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
65
|
+
* import { useCSSTransition } from "@react-md/core/transition/useCSSTransition";
|
|
66
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
67
|
+
* import { type ReactElement, useState } from "react";
|
|
64
68
|
*
|
|
65
69
|
* // Pretend styles
|
|
66
70
|
* // .enter {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/useCSSTransition.ts"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\nimport type {\n CSSTransitionElementProps,\n CSSTransitionHookOptions,\n CSSTransitionHookReturnValue,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TransitionHookOptions,\n} from \"./types.js\";\nimport { useTransition } from \"./useTransition.js\";\nimport { getTransitionClassNames } from \"./utils.js\";\n\n/**\n * This hook is used to create CSS transitions for different components whenever\n * a {@link TransitionHookOptions.transitionIn} flag is changed.\n *\n * @example Simple Transition\n * ```tsx\n * import {
|
|
1
|
+
{"version":3,"sources":["../../src/transition/useCSSTransition.ts"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\n\nimport { DISPLAY_NONE_CLASS } from \"../utils/isElementVisible.js\";\nimport type {\n CSSTransitionElementProps,\n CSSTransitionHookOptions,\n CSSTransitionHookReturnValue,\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n TransitionHookOptions,\n} from \"./types.js\";\nimport { useTransition } from \"./useTransition.js\";\nimport { getTransitionClassNames } from \"./utils.js\";\n\n/**\n * This hook is used to create CSS transitions for different components whenever\n * a {@link TransitionHookOptions.transitionIn} flag is changed.\n *\n * @example Simple Transition\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import { useCSSTransition } from \"@react-md/core/transition/useCSSTransition\";\n * import { Typography } from \"@react-md/core/typography/Typography\";\n * import { type ReactElement, useState } from \"react\";\n *\n * // Pretend styles\n * // .enter {\n * // opacity: 0.5;\n * // transition: opacity .15s;\n * // }\n * //\n * // .enter--active {\n * // opacity: 1;\n * // }\n * //\n * // .exit {\n * // opacity: 1;\n * // transition: opacity .15s;\n * // }\n * //\n * // .exit--active {\n * // opacity: 0.5;\n * // }\n *\n * function Example(): ReactElement {\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { elementProps } = useCSSTransition({\n * timeout: 150,\n * classNames: {\n * enter: \"enter\",\n * enterActive: \"enter--active\",\n * exit: \"exit\",\n * exitActive: \"exit--active\",\n * },\n * transitionIn,\n * });\n *\n * return (\n * <>\n * <Button onClick={() => setTransitionIn(!transitionIn)}>\n * Toggle\n * </Button>\n * <Typography {...elementProps}>\n * Some Opacity Changing Text\n * </Typography>\n * </>\n * );\n * }\n * ```\n *\n * @example Visibility Transition\n * ```tsx\n * import { Button } from \"@react-md/core/button/Button\";\n * import { useCSSTransition } from \"@react-md/core/transition/useCSSTransition\";\n * import { Typography } from \"@react-md/core/typography/Typography\";\n * import { type ReactElement, useState } from \"react\";\n *\n * // Pretend styles\n * // .enter {\n * // opacity: 0;\n * // transition: opacity .2s;\n * // }\n * //\n * // .enter--active {\n * // opacity: 1;\n * // }\n * //\n * // .exit {\n * // opacity: 1;\n * // transition: opacity .15s;\n * // }\n * //\n * // .exit--active {\n * // opacity: 0;\n * // }\n *\n * function Example(): ReactElement {\n * const [transitionIn, setTransitionIn] = useState(false);\n * const { elementProps, rendered } = useCSSTransition({\n * timeout: {\n * enter: 200,\n * exit: 150,\n * },\n * classNames: {\n * enter: \"enter\",\n * enterActive: \"enter--active\",\n * exit: \"exit\",\n * exitActive: \"exit--active\",\n * },\n * transitionIn,\n * temporary: true,\n * });\n *\n * return (\n * <>\n * <Button onClick={() => setTransitionIn(!transitionIn)}>\n * Toggle\n * </Button>\n * {rendered && (\n * <Typography {...elementProps}>\n * Some Opacity Changing Text\n * </Typography>\n * )}\n * </>\n * );\n * }\n * ```\n *\n * @example Mount Transition\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { useCSSTransition } from \"@react-md/transition\";\n *\n * // Pretend styles\n * // .opacity {\n * // opacity: 0;\n * // transition: opacity .3s;\n * // }\n * //\n * // .opacity--active {\n * // opacity: 1;\n * // }\n * //\n *\n * function Example(): ReactElement {\n * const { elementProps } = useCSSTransition({\n * appear: true,\n * transitionIn: true,\n * timeout: 300,\n * classNames: \"opacity\",\n * })\n *\n * return <div {...elementProps}>Some Content!</div>;\n * }\n * ```\n *\n * @typeParam E - An HTMLElement type used for the ref required for the\n * transition.\n * @since 4.0.0\n */\nexport function useCSSTransition<E extends HTMLElement>(\n options: CSSTransitionHookOptions<E>\n): CSSTransitionHookReturnValue<E> {\n const {\n className,\n classNames,\n appear = false,\n enter = true,\n exit = true,\n timeout,\n temporary = false,\n exitedHidden = false,\n ...transitionOptions\n } = options;\n\n const { ref, stage, rendered, appearing, transitionTo, disablePortal } =\n useTransition({\n ...transitionOptions,\n appear,\n enter,\n exit,\n timeout,\n reflow: true,\n temporary,\n });\n const isEntering = stage === \"entering\";\n const isEnter = isEntering || stage === \"enter\";\n const isEntered = stage === \"entered\";\n const isExiting = stage === \"exiting\";\n const isExit = isExiting || stage === \"exit\";\n const isExited = stage === \"exited\";\n const transitionClassNames = getTransitionClassNames({\n timeout,\n appear,\n enter,\n exit,\n classNames,\n });\n\n const elementProps: CSSTransitionElementProps<E> = {\n ref,\n className:\n cnb(\n // always apply the provided className first since it makes snapshot\n // tests easier to parse if dynamic classes come afterwards\n className,\n !temporary && exitedHidden && stage === \"exited\" && DISPLAY_NONE_CLASS,\n appearing && isEnter && transitionClassNames.appear,\n appearing && isEntering && transitionClassNames.appearActive,\n appearing && isEntered && transitionClassNames.appearDone,\n !appearing && isEnter && transitionClassNames.enter,\n !appearing && isEntering && transitionClassNames.enterActive,\n !appearing && isEntered && transitionClassNames.enterDone,\n isExit && transitionClassNames.exit,\n isExiting && transitionClassNames.exitActive,\n isExited && transitionClassNames.exitDone\n ) || undefined,\n };\n\n return {\n ...elementProps,\n stage,\n rendered,\n appearing,\n elementProps,\n transitionTo,\n disablePortal,\n };\n}\n"],"names":["cnb","DISPLAY_NONE_CLASS","useTransition","getTransitionClassNames","useCSSTransition","options","className","classNames","appear","enter","exit","timeout","temporary","exitedHidden","transitionOptions","ref","stage","rendered","appearing","transitionTo","disablePortal","reflow","isEntering","isEnter","isEntered","isExiting","isExit","isExited","transitionClassNames","elementProps","appearActive","appearDone","enterActive","enterDone","exitActive","exitDone","undefined"],"mappings":"AAAA;AAEA,SAASA,GAAG,QAAQ,YAAY;AAEhC,SAASC,kBAAkB,QAAQ,+BAA+B;AAQlE,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,uBAAuB,QAAQ,aAAa;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiJC,GACD,OAAO,SAASC,iBACdC,OAAoC;IAEpC,MAAM,EACJC,SAAS,EACTC,UAAU,EACVC,SAAS,KAAK,EACdC,QAAQ,IAAI,EACZC,OAAO,IAAI,EACXC,OAAO,EACPC,YAAY,KAAK,EACjBC,eAAe,KAAK,EACpB,GAAGC,mBACJ,GAAGT;IAEJ,MAAM,EAAEU,GAAG,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,YAAY,EAAEC,aAAa,EAAE,GACpElB,cAAc;QACZ,GAAGY,iBAAiB;QACpBN;QACAC;QACAC;QACAC;QACAU,QAAQ;QACRT;IACF;IACF,MAAMU,aAAaN,UAAU;IAC7B,MAAMO,UAAUD,cAAcN,UAAU;IACxC,MAAMQ,YAAYR,UAAU;IAC5B,MAAMS,YAAYT,UAAU;IAC5B,MAAMU,SAASD,aAAaT,UAAU;IACtC,MAAMW,WAAWX,UAAU;IAC3B,MAAMY,uBAAuBzB,wBAAwB;QACnDQ;QACAH;QACAC;QACAC;QACAH;IACF;IAEA,MAAMsB,eAA6C;QACjDd;QACAT,WACEN,IACE,oEAAoE;QACpE,2DAA2D;QAC3DM,WACA,CAACM,aAAaC,gBAAgBG,UAAU,YAAYf,oBACpDiB,aAAaK,WAAWK,qBAAqBpB,MAAM,EACnDU,aAAaI,cAAcM,qBAAqBE,YAAY,EAC5DZ,aAAaM,aAAaI,qBAAqBG,UAAU,EACzD,CAACb,aAAaK,WAAWK,qBAAqBnB,KAAK,EACnD,CAACS,aAAaI,cAAcM,qBAAqBI,WAAW,EAC5D,CAACd,aAAaM,aAAaI,qBAAqBK,SAAS,EACzDP,UAAUE,qBAAqBlB,IAAI,EACnCe,aAAaG,qBAAqBM,UAAU,EAC5CP,YAAYC,qBAAqBO,QAAQ,KACtCC;IACT;IAEA,OAAO;QACL,GAAGP,YAAY;QACfb;QACAC;QACAC;QACAW;QACAV;QACAC;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/transition/useCarousel.ts"],"sourcesContent":["\"use client\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport type { UseStateSetter } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { loop } from \"../utils/loop.js\";\nimport type { SlideDirection } from \"./SlideContainer.js\";\n\n/** @since 6.0.0 */\nexport interface CarouselSlideState {\n direction: SlideDirection;\n activeIndex: number;\n}\n\n/** @since 6.0.0 */\nexport interface CarouselState extends CarouselSlideState {\n paused: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface CarouselImplementation extends CarouselState {\n /**\n * Increments the carousel slide active index by 1 ensuring it does not\n * advance past the {@link CarouselOptions.totalSlides} index.\n */\n increment: () => void;\n\n /**\n * Decrements the carousel slide active index by 1 and prevents decrementing\n * past 0.\n */\n decrement: () => void;\n\n /**\n * This can be used to manually control the {@link paused} state.\n */\n setPaused: UseStateSetter<boolean>;\n\n /**\n * Toggles the {@link paused} state.\n */\n togglePaused: () => void;\n\n /**\n * A convenience wrapper for the {@link setCarouselSlideState} that will\n * ensure the {@link CarouselSlideState.direction} is correct based on the\n * current active index and next active index.\n */\n setActiveIndex: UseStateSetter<number>;\n\n /**\n * This can be used if the provided carousel actions do not solve your use\n * case.\n */\n setCarouselSlideState: UseStateSetter<CarouselSlideState>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface CarouselOptions {\n /**\n * The amount of time in milliseconds each slide should be visible before\n * advancing to the next slide.\n *\n * @defaultValue `8000`\n */\n duration?: number;\n\n /**\n * The total number of slides within your carousel so that you can safely loop\n * through all slides.\n */\n totalSlides: number;\n}\n\n/**\n * @example Accessible Carousel Example\n * ```tsx\n * import { Button, SlideContainer, Slide, useCarousel } from \"@react-md/core\";\n * import ChevronLeftIcon from \"@react-md/material-icons/ChevronLeftIcon\";\n * import ChevronRightIcon from \"@react-md/material-icons/ChevronRightIcon\";\n * import PauseIcon from \"@react-md/material-icons/PauseIcon\";\n * import PlayArrowIcon from \"@react-md/material-icons/PlayArrowIcon\";\n * import type { ReactElement } from \"react\";\n *\n * const slides = [\n * { title: \"Slide 1\" },\n * { title: \"Slide 2\" },\n * { title: \"Slide 3\" },\n * ] as const;\n *\n * function Example(): ReactElement {\n * const {\n * paused,\n * direction,\n * activeIndex,\n * togglePaused,\n * setActiveIndex,\n * increment,\n * decrement,\n * } = useCarousel({\n * duration: 5000,\n * totalSlides: slides.length,\n * });\n *\n * const slideId = useId();\n *\n * return (\n * <div\n * aria-roledescription=\"carousel\"\n * aria-label=\"Carousel\"\n * id={useId()}\n * role=\"region\"\n * >\n * <SlideContainer aria-live=\"off\" direction={direction}>\n * {slides.map(({ title }, index) => (\n * <Slide\n * key={title}\n * aria-label={`Slide ${index + 1} of ${slides.length - 1}`}\n * aria-roledescription=\"slide\"\n * id={`${slideId}-${index}`}\n * role=\"group\"\n * active={activeIndex === index}\n * >\n * {title}\n * </Slide>\n * ))}\n * </SlideContainer>\n * <Button\n * aria-label=\"Pause\"\n * aria-pressed={paused}\n * button=\"icon\"\n * onClick={togglePaused}\n * >\n * {paused ? <PlayArrowIcon /> : <PauseIcon />}\n * </Button>\n * {slides.map(({ title }, index) => (\n * <Button\n * key={title}\n * aria-label={`Slide ${index + 1}`}\n * aria-selected={activeIndex === index}\n * aria-controls={`${slideId}-${index}`}\n * role=\"tab\"\n * onClick={() => setActiveIndex(index))}\n * />\n * ))}\n * <Button\n * aria-label=\"Previous Slide\"\n * onClick={decrement}\n * disabled={activeIndex === 0}\n * buttonType=\"icon\"\n * >\n * <ChevronLeftIcon />\n * </Button>\n * <Button\n * aria-label=\"Next Slide\"\n * onClick={increment}\n * disabled={activeIndex === slides.length - 1}\n * buttonType=\"icon\"\n * >\n * <ChevronRightIcon />\n * </Button>\n * </div>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/carousel/}\n * @see {@link https://www.w3.org/WAI/ARIA/apg/example-index/carousel/carousel-2-tablist.html}\n */\nexport function useCarousel(options: CarouselOptions): CarouselImplementation {\n const { duration = 8000, totalSlides } = options;\n const total = totalSlides - 1;\n\n const [state, setCarouselSlideState] = useState<CarouselSlideState>({\n direction: \"left\",\n activeIndex: 0,\n });\n const {\n toggled: paused,\n toggle: togglePaused,\n setToggled: setPaused,\n } = useToggle(false);\n const setActiveIndex = useCallback<UseStateSetter<number>>(\n (activeIndexOrGetter) => {\n setCarouselSlideState((prevState) => {\n const prevActiveIndex = prevState.activeIndex;\n const nextActiveIndex =\n typeof activeIndexOrGetter === \"function\"\n ? activeIndexOrGetter(prevActiveIndex)\n : activeIndexOrGetter;\n\n return {\n direction: prevActiveIndex < nextActiveIndex ? \"left\" : \"right\",\n activeIndex: nextActiveIndex,\n };\n });\n },\n []\n );\n const increment = useCallback(() => {\n setCarouselSlideState((prevState) => ({\n direction: \"left\",\n activeIndex: Math.min(total, prevState.activeIndex + 1),\n }));\n }, [total]);\n const decrement = useCallback(() => {\n setCarouselSlideState((prevState) => ({\n direction: \"right\",\n activeIndex: Math.max(0, prevState.activeIndex - 1),\n }));\n }, []);\n\n const { activeIndex } = state;\n useEffect(() => {\n if (paused) {\n return;\n }\n\n const timeout = window.setTimeout(() => {\n const nextActiveIndex = loop({\n min: 0,\n max: total,\n value: activeIndex,\n increment: true,\n });\n setCarouselSlideState({\n direction: activeIndex < nextActiveIndex ? \"left\" : \"right\",\n activeIndex: nextActiveIndex,\n });\n }, duration);\n\n return () => {\n window.clearTimeout(timeout);\n };\n }, [paused, duration, activeIndex, total]);\n\n return {\n ...state,\n increment,\n decrement,\n paused,\n setPaused,\n togglePaused,\n setActiveIndex,\n setCarouselSlideState,\n };\n}\n"],"names":["useCallback","useEffect","useState","useToggle","loop","useCarousel","options","duration","totalSlides","total","state","setCarouselSlideState","direction","activeIndex","toggled","paused","toggle","togglePaused","setToggled","setPaused","setActiveIndex","activeIndexOrGetter","prevState","prevActiveIndex","nextActiveIndex","increment","Math","min","decrement","max","timeout","window","setTimeout","value","clearTimeout"],"mappings":"AAAA;
|
|
1
|
+
{"version":3,"sources":["../../src/transition/useCarousel.ts"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useState } from \"react\";\n\nimport type { UseStateSetter } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { loop } from \"../utils/loop.js\";\nimport type { SlideDirection } from \"./SlideContainer.js\";\n\n/** @since 6.0.0 */\nexport interface CarouselSlideState {\n direction: SlideDirection;\n activeIndex: number;\n}\n\n/** @since 6.0.0 */\nexport interface CarouselState extends CarouselSlideState {\n paused: boolean;\n}\n\n/** @since 6.0.0 */\nexport interface CarouselImplementation extends CarouselState {\n /**\n * Increments the carousel slide active index by 1 ensuring it does not\n * advance past the {@link CarouselOptions.totalSlides} index.\n */\n increment: () => void;\n\n /**\n * Decrements the carousel slide active index by 1 and prevents decrementing\n * past 0.\n */\n decrement: () => void;\n\n /**\n * This can be used to manually control the {@link paused} state.\n */\n setPaused: UseStateSetter<boolean>;\n\n /**\n * Toggles the {@link paused} state.\n */\n togglePaused: () => void;\n\n /**\n * A convenience wrapper for the {@link setCarouselSlideState} that will\n * ensure the {@link CarouselSlideState.direction} is correct based on the\n * current active index and next active index.\n */\n setActiveIndex: UseStateSetter<number>;\n\n /**\n * This can be used if the provided carousel actions do not solve your use\n * case.\n */\n setCarouselSlideState: UseStateSetter<CarouselSlideState>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface CarouselOptions {\n /**\n * The amount of time in milliseconds each slide should be visible before\n * advancing to the next slide.\n *\n * @defaultValue `8000`\n */\n duration?: number;\n\n /**\n * The total number of slides within your carousel so that you can safely loop\n * through all slides.\n */\n totalSlides: number;\n}\n\n/**\n * @example Accessible Carousel Example\n * ```tsx\n * import { Button, SlideContainer, Slide, useCarousel } from \"@react-md/core\";\n * import ChevronLeftIcon from \"@react-md/material-icons/ChevronLeftIcon\";\n * import ChevronRightIcon from \"@react-md/material-icons/ChevronRightIcon\";\n * import PauseIcon from \"@react-md/material-icons/PauseIcon\";\n * import PlayArrowIcon from \"@react-md/material-icons/PlayArrowIcon\";\n * import type { ReactElement } from \"react\";\n *\n * const slides = [\n * { title: \"Slide 1\" },\n * { title: \"Slide 2\" },\n * { title: \"Slide 3\" },\n * ] as const;\n *\n * function Example(): ReactElement {\n * const {\n * paused,\n * direction,\n * activeIndex,\n * togglePaused,\n * setActiveIndex,\n * increment,\n * decrement,\n * } = useCarousel({\n * duration: 5000,\n * totalSlides: slides.length,\n * });\n *\n * const slideId = useId();\n *\n * return (\n * <div\n * aria-roledescription=\"carousel\"\n * aria-label=\"Carousel\"\n * id={useId()}\n * role=\"region\"\n * >\n * <SlideContainer aria-live=\"off\" direction={direction}>\n * {slides.map(({ title }, index) => (\n * <Slide\n * key={title}\n * aria-label={`Slide ${index + 1} of ${slides.length - 1}`}\n * aria-roledescription=\"slide\"\n * id={`${slideId}-${index}`}\n * role=\"group\"\n * active={activeIndex === index}\n * >\n * {title}\n * </Slide>\n * ))}\n * </SlideContainer>\n * <Button\n * aria-label=\"Pause\"\n * aria-pressed={paused}\n * button=\"icon\"\n * onClick={togglePaused}\n * >\n * {paused ? <PlayArrowIcon /> : <PauseIcon />}\n * </Button>\n * {slides.map(({ title }, index) => (\n * <Button\n * key={title}\n * aria-label={`Slide ${index + 1}`}\n * aria-selected={activeIndex === index}\n * aria-controls={`${slideId}-${index}`}\n * role=\"tab\"\n * onClick={() => setActiveIndex(index))}\n * />\n * ))}\n * <Button\n * aria-label=\"Previous Slide\"\n * onClick={decrement}\n * disabled={activeIndex === 0}\n * buttonType=\"icon\"\n * >\n * <ChevronLeftIcon />\n * </Button>\n * <Button\n * aria-label=\"Next Slide\"\n * onClick={increment}\n * disabled={activeIndex === slides.length - 1}\n * buttonType=\"icon\"\n * >\n * <ChevronRightIcon />\n * </Button>\n * </div>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n * @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/carousel/}\n * @see {@link https://www.w3.org/WAI/ARIA/apg/example-index/carousel/carousel-2-tablist.html}\n */\nexport function useCarousel(options: CarouselOptions): CarouselImplementation {\n const { duration = 8000, totalSlides } = options;\n const total = totalSlides - 1;\n\n const [state, setCarouselSlideState] = useState<CarouselSlideState>({\n direction: \"left\",\n activeIndex: 0,\n });\n const {\n toggled: paused,\n toggle: togglePaused,\n setToggled: setPaused,\n } = useToggle(false);\n const setActiveIndex = useCallback<UseStateSetter<number>>(\n (activeIndexOrGetter) => {\n setCarouselSlideState((prevState) => {\n const prevActiveIndex = prevState.activeIndex;\n const nextActiveIndex =\n typeof activeIndexOrGetter === \"function\"\n ? activeIndexOrGetter(prevActiveIndex)\n : activeIndexOrGetter;\n\n return {\n direction: prevActiveIndex < nextActiveIndex ? \"left\" : \"right\",\n activeIndex: nextActiveIndex,\n };\n });\n },\n []\n );\n const increment = useCallback(() => {\n setCarouselSlideState((prevState) => ({\n direction: \"left\",\n activeIndex: Math.min(total, prevState.activeIndex + 1),\n }));\n }, [total]);\n const decrement = useCallback(() => {\n setCarouselSlideState((prevState) => ({\n direction: \"right\",\n activeIndex: Math.max(0, prevState.activeIndex - 1),\n }));\n }, []);\n\n const { activeIndex } = state;\n useEffect(() => {\n if (paused) {\n return;\n }\n\n const timeout = window.setTimeout(() => {\n const nextActiveIndex = loop({\n min: 0,\n max: total,\n value: activeIndex,\n increment: true,\n });\n setCarouselSlideState({\n direction: activeIndex < nextActiveIndex ? \"left\" : \"right\",\n activeIndex: nextActiveIndex,\n });\n }, duration);\n\n return () => {\n window.clearTimeout(timeout);\n };\n }, [paused, duration, activeIndex, total]);\n\n return {\n ...state,\n increment,\n decrement,\n paused,\n setPaused,\n togglePaused,\n setActiveIndex,\n setCarouselSlideState,\n };\n}\n"],"names":["useCallback","useEffect","useState","useToggle","loop","useCarousel","options","duration","totalSlides","total","state","setCarouselSlideState","direction","activeIndex","toggled","paused","toggle","togglePaused","setToggled","setPaused","setActiveIndex","activeIndexOrGetter","prevState","prevActiveIndex","nextActiveIndex","increment","Math","min","decrement","max","timeout","window","setTimeout","value","clearTimeout"],"mappings":"AAAA;AAEA,SAASA,WAAW,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAGzD,SAASC,SAAS,QAAQ,kBAAkB;AAC5C,SAASC,IAAI,QAAQ,mBAAmB;AAuExC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+FC,GACD,OAAO,SAASC,YAAYC,OAAwB;IAClD,MAAM,EAAEC,WAAW,IAAI,EAAEC,WAAW,EAAE,GAAGF;IACzC,MAAMG,QAAQD,cAAc;IAE5B,MAAM,CAACE,OAAOC,sBAAsB,GAAGT,SAA6B;QAClEU,WAAW;QACXC,aAAa;IACf;IACA,MAAM,EACJC,SAASC,MAAM,EACfC,QAAQC,YAAY,EACpBC,YAAYC,SAAS,EACtB,GAAGhB,UAAU;IACd,MAAMiB,iBAAiBpB,YACrB,CAACqB;QACCV,sBAAsB,CAACW;YACrB,MAAMC,kBAAkBD,UAAUT,WAAW;YAC7C,MAAMW,kBACJ,OAAOH,wBAAwB,aAC3BA,oBAAoBE,mBACpBF;YAEN,OAAO;gBACLT,WAAWW,kBAAkBC,kBAAkB,SAAS;gBACxDX,aAAaW;YACf;QACF;IACF,GACA,EAAE;IAEJ,MAAMC,YAAYzB,YAAY;QAC5BW,sBAAsB,CAACW,YAAe,CAAA;gBACpCV,WAAW;gBACXC,aAAaa,KAAKC,GAAG,CAAClB,OAAOa,UAAUT,WAAW,GAAG;YACvD,CAAA;IACF,GAAG;QAACJ;KAAM;IACV,MAAMmB,YAAY5B,YAAY;QAC5BW,sBAAsB,CAACW,YAAe,CAAA;gBACpCV,WAAW;gBACXC,aAAaa,KAAKG,GAAG,CAAC,GAAGP,UAAUT,WAAW,GAAG;YACnD,CAAA;IACF,GAAG,EAAE;IAEL,MAAM,EAAEA,WAAW,EAAE,GAAGH;IACxBT,UAAU;QACR,IAAIc,QAAQ;YACV;QACF;QAEA,MAAMe,UAAUC,OAAOC,UAAU,CAAC;YAChC,MAAMR,kBAAkBpB,KAAK;gBAC3BuB,KAAK;gBACLE,KAAKpB;gBACLwB,OAAOpB;gBACPY,WAAW;YACb;YACAd,sBAAsB;gBACpBC,WAAWC,cAAcW,kBAAkB,SAAS;gBACpDX,aAAaW;YACf;QACF,GAAGjB;QAEH,OAAO;YACLwB,OAAOG,YAAY,CAACJ;QACtB;IACF,GAAG;QAACf;QAAQR;QAAUM;QAAaJ;KAAM;IAEzC,OAAO;QACL,GAAGC,KAAK;QACRe;QACAG;QACAb;QACAI;QACAF;QACAG;QACAT;IACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type
|
|
1
|
+
import { type CSSProperties } from "react";
|
|
2
|
+
import { type CSSTransitionElementProps, type CSSTransitionHookReturnValue, type PreconfiguredCSSTransitionOptions, type TransitionTimeout, type TransitionTimeoutObject } from "./types.js";
|
|
3
3
|
/**
|
|
4
4
|
* @since 2.0.0
|
|
5
5
|
*/
|
|
@@ -157,8 +157,10 @@ export interface CollapseTransitionHookReturnValue<E extends HTMLElement> extend
|
|
|
157
157
|
*
|
|
158
158
|
* @example Simple Example
|
|
159
159
|
* ```tsx
|
|
160
|
-
* import {
|
|
161
|
-
* import {
|
|
160
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
161
|
+
* import { useCollapseTransition } from "@react-md/core/transition/useCollapseTransition";
|
|
162
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
163
|
+
* import { type ReactElement, useState } from "react";
|
|
162
164
|
*
|
|
163
165
|
* function Example(): ReactElement {
|
|
164
166
|
* const [collapsed, setCollapsed] = useState(true);
|
|
@@ -188,9 +190,12 @@ export interface CollapseTransitionHookReturnValue<E extends HTMLElement> extend
|
|
|
188
190
|
*
|
|
189
191
|
* @example See More Example
|
|
190
192
|
* ```tsx
|
|
191
|
-
* import {
|
|
192
|
-
* import {
|
|
193
|
-
* import
|
|
193
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
194
|
+
* import { IconRotator } from "@react-md/core/icon/IconRotator";
|
|
195
|
+
* import KeyboardArrowDownIcon from "@react-md/material-icons/KeyboardArrowDownIcon"
|
|
196
|
+
* import { useCollapseTransition } from "@react-md/core/transition/useCollapseTransition";
|
|
197
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
198
|
+
* import { type ReactElement, useState } from "react";
|
|
194
199
|
*
|
|
195
200
|
* import styles from "./Example.module.scss";
|
|
196
201
|
* // pretend styles:
|
|
@@ -227,7 +232,7 @@ export interface CollapseTransitionHookReturnValue<E extends HTMLElement> extend
|
|
|
227
232
|
* className={styles.button}
|
|
228
233
|
* >
|
|
229
234
|
* <IconRotator rotated={!collapsed}>
|
|
230
|
-
* <
|
|
235
|
+
* <KeyboardArrowDownIcon />
|
|
231
236
|
* </IconRotator>
|
|
232
237
|
* </Button>
|
|
233
238
|
* <SomeComponentWithALotOfContent />
|
|
@@ -25,8 +25,10 @@ const noop = ()=>{
|
|
|
25
25
|
*
|
|
26
26
|
* @example Simple Example
|
|
27
27
|
* ```tsx
|
|
28
|
-
* import {
|
|
29
|
-
* import {
|
|
28
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
29
|
+
* import { useCollapseTransition } from "@react-md/core/transition/useCollapseTransition";
|
|
30
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
31
|
+
* import { type ReactElement, useState } from "react";
|
|
30
32
|
*
|
|
31
33
|
* function Example(): ReactElement {
|
|
32
34
|
* const [collapsed, setCollapsed] = useState(true);
|
|
@@ -56,9 +58,12 @@ const noop = ()=>{
|
|
|
56
58
|
*
|
|
57
59
|
* @example See More Example
|
|
58
60
|
* ```tsx
|
|
59
|
-
* import {
|
|
60
|
-
* import {
|
|
61
|
-
* import
|
|
61
|
+
* import { Button } from "@react-md/core/button/Button";
|
|
62
|
+
* import { IconRotator } from "@react-md/core/icon/IconRotator";
|
|
63
|
+
* import KeyboardArrowDownIcon from "@react-md/material-icons/KeyboardArrowDownIcon"
|
|
64
|
+
* import { useCollapseTransition } from "@react-md/core/transition/useCollapseTransition";
|
|
65
|
+
* import { Typography } from "@react-md/core/typography/Typography";
|
|
66
|
+
* import { type ReactElement, useState } from "react";
|
|
62
67
|
*
|
|
63
68
|
* import styles from "./Example.module.scss";
|
|
64
69
|
* // pretend styles:
|
|
@@ -95,7 +100,7 @@ const noop = ()=>{
|
|
|
95
100
|
* className={styles.button}
|
|
96
101
|
* >
|
|
97
102
|
* <IconRotator rotated={!collapsed}>
|
|
98
|
-
* <
|
|
103
|
+
* <KeyboardArrowDownIcon />
|
|
99
104
|
* </IconRotator>
|
|
100
105
|
* </Button>
|
|
101
106
|
* <SomeComponentWithALotOfContent />
|