@react-md/core 1.0.0-next.16 → 1.0.0-next.18
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/_box-shadows.scss +76 -0
- package/dist/_colors.scss +279 -277
- package/dist/_core.scss +107 -16
- package/dist/_object-fit.scss +86 -0
- package/dist/_utils.scss +246 -72
- package/dist/app-bar/AppBar.d.ts +1 -90
- package/dist/app-bar/AppBar.js +1 -40
- package/dist/app-bar/AppBar.js.map +1 -1
- package/dist/app-bar/AppBarTitle.d.ts +1 -27
- package/dist/app-bar/AppBarTitle.js +1 -15
- package/dist/app-bar/AppBarTitle.js.map +1 -1
- package/dist/app-bar/_app-bar.scss +156 -25
- package/dist/app-bar/styles.d.ts +117 -0
- package/dist/app-bar/styles.js +55 -0
- package/dist/app-bar/styles.js.map +1 -0
- package/dist/autocomplete/Autocomplete.d.ts +8 -79
- package/dist/autocomplete/Autocomplete.js +112 -83
- package/dist/autocomplete/Autocomplete.js.map +1 -1
- package/dist/autocomplete/AutocompleteChip.d.ts +8 -0
- package/dist/autocomplete/AutocompleteChip.js +34 -0
- package/dist/autocomplete/AutocompleteChip.js.map +1 -0
- package/dist/autocomplete/AutocompleteCircularProgress.d.ts +5 -11
- package/dist/autocomplete/AutocompleteCircularProgress.js +4 -0
- package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
- package/dist/autocomplete/AutocompleteClearButton.d.ts +9 -0
- package/dist/autocomplete/AutocompleteClearButton.js +29 -0
- package/dist/autocomplete/AutocompleteClearButton.js.map +1 -0
- package/dist/autocomplete/AutocompleteDropdownButton.d.ts +4 -26
- package/dist/autocomplete/AutocompleteDropdownButton.js +5 -1
- package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
- package/dist/autocomplete/AutocompleteListboxChildren.d.ts +22 -0
- package/dist/autocomplete/AutocompleteListboxChildren.js +37 -0
- package/dist/autocomplete/AutocompleteListboxChildren.js.map +1 -0
- package/dist/autocomplete/_autocomplete.scss +362 -34
- package/dist/autocomplete/autocompleteStyles.d.ts +22 -0
- package/dist/autocomplete/autocompleteStyles.js +17 -8
- package/dist/autocomplete/autocompleteStyles.js.map +1 -1
- package/dist/autocomplete/defaults.d.ts +9 -9
- package/dist/autocomplete/defaults.js +13 -13
- package/dist/autocomplete/defaults.js.map +1 -1
- package/dist/autocomplete/types.d.ts +554 -56
- package/dist/autocomplete/types.js.map +1 -1
- package/dist/autocomplete/useAutocomplete.d.ts +22 -0
- package/dist/autocomplete/useAutocomplete.js +281 -0
- package/dist/autocomplete/useAutocomplete.js.map +1 -0
- package/dist/autocomplete/utils.d.ts +81 -0
- package/dist/autocomplete/utils.js +108 -0
- package/dist/autocomplete/utils.js.map +1 -0
- package/dist/avatar/_avatar.scss +93 -2
- package/dist/badge/Badge.d.ts +1 -20
- package/dist/badge/Badge.js +1 -14
- package/dist/badge/Badge.js.map +1 -1
- package/dist/badge/_badge.scss +90 -3
- package/dist/badge/styles.d.ts +26 -0
- package/dist/badge/styles.js +18 -0
- package/dist/badge/styles.js.map +1 -0
- package/dist/box/Box.js +2 -1
- package/dist/box/Box.js.map +1 -1
- package/dist/box/_box.scss +130 -17
- package/dist/box/styles.d.ts +6 -0
- package/dist/box/styles.js +2 -1
- package/dist/box/styles.js.map +1 -1
- package/dist/button/AsyncButton.d.ts +1 -1
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/button/Button.d.ts +2 -1
- package/dist/button/Button.js +2 -1
- package/dist/button/Button.js.map +1 -1
- package/dist/button/_button.scss +157 -25
- package/dist/card/Card.d.ts +16 -0
- package/dist/card/Card.js +11 -3
- package/dist/card/Card.js.map +1 -1
- package/dist/card/ClickableCard.d.ts +2 -1
- package/dist/card/ClickableCard.js +5 -2
- package/dist/card/ClickableCard.js.map +1 -1
- package/dist/card/_card.scss +90 -19
- package/dist/card/styles.d.ts +0 -7
- package/dist/card/styles.js +2 -3
- package/dist/card/styles.js.map +1 -1
- package/dist/chip/Chip.d.ts +2 -1
- package/dist/chip/Chip.js +2 -1
- package/dist/chip/Chip.js.map +1 -1
- package/dist/chip/_chip.scss +45 -22
- package/dist/chip/styles.d.ts +12 -10
- package/dist/chip/styles.js.map +1 -1
- package/dist/cssUtils.js.map +1 -1
- package/dist/delegateEvent.d.ts +2 -2
- package/dist/delegateEvent.js.map +1 -1
- package/dist/dialog/Dialog.d.ts +8 -21
- package/dist/dialog/Dialog.js +27 -27
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/FixedDialog.d.ts +1 -3
- package/dist/dialog/FixedDialog.js +0 -8
- package/dist/dialog/FixedDialog.js.map +1 -1
- package/dist/dialog/_dialog.scss +67 -13
- package/dist/dialog/styles.d.ts +56 -0
- package/dist/dialog/styles.js +29 -2
- package/dist/dialog/styles.js.map +1 -1
- package/dist/divider/Divider.d.ts +0 -11
- package/dist/divider/Divider.js.map +1 -1
- package/dist/divider/_divider.scss +7 -1
- package/dist/divider/styles.d.ts +11 -0
- package/dist/divider/styles.js.map +1 -1
- package/dist/draggable/useDraggable.d.ts +6 -6
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/draggable/utils.d.ts +3 -3
- package/dist/draggable/utils.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanel.d.ts +1 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/_expansion-panel.scss +5 -1
- package/dist/expansion-panel/useExpansionPanels.js +12 -24
- package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
- package/dist/{form → files}/FileInput.d.ts +3 -6
- package/dist/{form → files}/FileInput.js +3 -6
- package/dist/files/FileInput.js.map +1 -0
- package/dist/files/_files.scss +22 -0
- package/dist/files/styles.d.ts +5 -0
- package/dist/files/styles.js +7 -0
- package/dist/files/styles.js.map +1 -0
- package/dist/{form → files}/useFileUpload.d.ts +7 -9
- package/dist/{form → files}/useFileUpload.js +5 -7
- package/dist/files/useFileUpload.js.map +1 -0
- package/dist/files/utils.d.ts +169 -0
- package/dist/files/utils.js +114 -0
- package/dist/files/utils.js.map +1 -0
- package/dist/{form/fileUtils.d.ts → files/validation.d.ts} +11 -176
- package/dist/{form/fileUtils.js → files/validation.js} +10 -135
- package/dist/files/validation.js.map +1 -0
- package/dist/focus/useFocusContainer.d.ts +2 -2
- package/dist/focus/useFocusContainer.js.map +1 -1
- package/dist/focus/utils.js.map +1 -1
- package/dist/form/FormMessage.js.map +1 -1
- package/dist/form/FormMessageContainer.js +4 -2
- package/dist/form/FormMessageContainer.js.map +1 -1
- package/dist/form/InputToggle.d.ts +2 -1
- package/dist/form/InputToggle.js +2 -1
- package/dist/form/InputToggle.js.map +1 -1
- package/dist/form/InputToggleIcon.js.map +1 -1
- package/dist/form/Label.js +2 -2
- package/dist/form/Label.js.map +1 -1
- package/dist/form/Listbox.d.ts +24 -0
- package/dist/form/Listbox.js +46 -0
- package/dist/form/Listbox.js.map +1 -0
- package/dist/form/ListboxProvider.d.ts +21 -0
- package/dist/form/{useListboxProvider.js → ListboxProvider.js} +1 -1
- package/dist/form/ListboxProvider.js.map +1 -0
- package/dist/form/MenuItemTextField.js +1 -2
- package/dist/form/MenuItemTextField.js.map +1 -1
- package/dist/form/NativeSelect.js +7 -4
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/Option.d.ts +49 -10
- package/dist/form/Option.js +11 -9
- package/dist/form/Option.js.map +1 -1
- package/dist/form/Password.js.map +1 -1
- package/dist/form/Select.d.ts +2 -2
- package/dist/form/Select.js +81 -85
- package/dist/form/Select.js.map +1 -1
- package/dist/form/SelectedOption.js +2 -1
- package/dist/form/SelectedOption.js.map +1 -1
- package/dist/form/Slider.d.ts +4 -4
- package/dist/form/Slider.js +6 -2
- package/dist/form/Slider.js.map +1 -1
- package/dist/form/SliderThumb.d.ts +3 -3
- package/dist/form/SliderThumb.js.map +1 -1
- package/dist/form/SliderValueMarks.d.ts +2 -2
- package/dist/form/SliderValueMarks.js.map +1 -1
- package/dist/form/SliderValueTooltip.js.map +1 -1
- package/dist/form/TextArea.js +1 -2
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.js +1 -2
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/TextFieldContainer.js +1 -2
- package/dist/form/TextFieldContainer.js.map +1 -1
- package/dist/form/_form.scss +193 -124
- package/dist/form/formMessageContainerStyles.d.ts +10 -0
- package/dist/form/formMessageContainerStyles.js +11 -0
- package/dist/form/formMessageContainerStyles.js.map +1 -0
- package/dist/form/inputToggleStyles.js.map +1 -1
- package/dist/form/optionStyles.d.ts +1 -0
- package/dist/form/optionStyles.js +2 -2
- package/dist/form/optionStyles.js.map +1 -1
- package/dist/form/selectUtils.js.map +1 -1
- package/dist/form/sliderUtils.d.ts +1 -1
- package/dist/form/sliderUtils.js.map +1 -1
- package/dist/form/textFieldContainerStyles.d.ts +0 -2
- package/dist/form/textFieldContainerStyles.js +1 -2
- package/dist/form/textFieldContainerStyles.js.map +1 -1
- package/dist/form/types.d.ts +3 -10
- package/dist/form/types.js.map +1 -1
- package/dist/form/useCheckboxGroup.d.ts +17 -17
- package/dist/form/useCheckboxGroup.js +9 -17
- package/dist/form/useCheckboxGroup.js.map +1 -1
- package/dist/form/useCombobox.d.ts +56 -21
- package/dist/form/useCombobox.js +19 -4
- package/dist/form/useCombobox.js.map +1 -1
- package/dist/form/useEditableCombobox.d.ts +24 -4
- package/dist/form/useEditableCombobox.js +5 -0
- package/dist/form/useEditableCombobox.js.map +1 -1
- package/dist/form/useNumberField.js.map +1 -1
- package/dist/form/useRadioGroup.d.ts +6 -6
- package/dist/form/useRadioGroup.js.map +1 -1
- package/dist/form/useResizingTextArea.js.map +1 -1
- package/dist/form/useSelectCombobox.d.ts +3 -4
- package/dist/form/useSelectCombobox.js.map +1 -1
- package/dist/form/useTextField.d.ts +1 -1
- package/dist/form/useTextField.js.map +1 -1
- package/dist/form/useTextFieldContainerAddons.js.map +1 -1
- package/dist/hoverMode/useHoverMode.d.ts +3 -3
- package/dist/hoverMode/useHoverMode.js.map +1 -1
- package/dist/hoverMode/useHoverModeProvider.d.ts +4 -4
- package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
- package/dist/icon/FontIcon.d.ts +4 -2
- package/dist/icon/FontIcon.js.map +1 -1
- package/dist/icon/TextIconSpacing.d.ts +3 -1
- package/dist/icon/TextIconSpacing.js.map +1 -1
- package/dist/icon/_icon.scss +151 -2
- package/dist/icon/iconConfig.d.ts +10 -0
- package/dist/icon/iconConfig.js +7 -0
- package/dist/icon/iconConfig.js.map +1 -1
- package/dist/icon/materialConfig.js.map +1 -1
- package/dist/icon/styles.js.map +1 -1
- package/dist/interaction/UserInteractionModeProvider.d.ts +5 -5
- package/dist/interaction/UserInteractionModeProvider.js +12 -8
- package/dist/interaction/UserInteractionModeProvider.js.map +1 -1
- package/dist/interaction/types.d.ts +20 -2
- package/dist/interaction/types.js.map +1 -1
- package/dist/interaction/useElementInteraction.d.ts +7 -1
- package/dist/interaction/useElementInteraction.js +1 -2
- package/dist/interaction/useElementInteraction.js.map +1 -1
- package/dist/interaction/utils.d.ts +2 -2
- package/dist/interaction/utils.js +2 -2
- package/dist/interaction/utils.js.map +1 -1
- package/dist/layout/LayoutWindowSplitter.js.map +1 -1
- package/dist/layout/_layout.scss +23 -10
- package/dist/layout/useExpandableLayout.d.ts +3 -3
- package/dist/layout/useExpandableLayout.js.map +1 -1
- package/dist/layout/useLayoutAppBarHeight.d.ts +2 -3
- package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
- package/dist/layout/useTemporaryLayout.d.ts +2 -2
- package/dist/layout/useTemporaryLayout.js.map +1 -1
- package/dist/link/SkipToMainContent.js.map +1 -1
- package/dist/list/ListItem.d.ts +2 -1
- package/dist/list/ListItem.js +2 -1
- package/dist/list/ListItem.js.map +1 -1
- package/dist/list/ListItemChildren.js.map +1 -1
- package/dist/list/ListItemLink.d.ts +2 -1
- package/dist/list/ListItemLink.js +2 -1
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/_list.scss +6 -5
- package/dist/media-queries/_media-queries.scss +12 -0
- package/dist/media-queries/appSize.js.map +1 -1
- package/dist/media-queries/useMediaQuery.js +3 -1
- package/dist/media-queries/useMediaQuery.js.map +1 -1
- package/dist/menu/DropdownMenu.js.map +1 -1
- package/dist/menu/Menu.d.ts +8 -3
- package/dist/menu/Menu.js +2 -1
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuItemButton.js +6 -2
- package/dist/menu/MenuItemButton.js.map +1 -1
- package/dist/menu/useContextMenu.d.ts +3 -3
- package/dist/menu/useContextMenu.js.map +1 -1
- package/dist/movement/types.d.ts +5 -5
- package/dist/movement/types.js.map +1 -1
- package/dist/navigation/CollapsibleNavGroup.d.ts +5 -3
- package/dist/navigation/CollapsibleNavGroup.js +3 -4
- package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
- package/dist/navigation/DefaultNavigationRenderer.d.ts +1 -2
- package/dist/navigation/DefaultNavigationRenderer.js +6 -2
- package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
- package/dist/navigation/NavItemButton.d.ts +1 -1
- package/dist/navigation/NavItemButton.js +1 -0
- package/dist/navigation/NavItemButton.js.map +1 -1
- package/dist/navigation/NavItemLink.d.ts +3 -2
- package/dist/navigation/NavItemLink.js +6 -2
- package/dist/navigation/NavItemLink.js.map +1 -1
- package/dist/navigation/NavSubheader.d.ts +2 -3
- package/dist/navigation/NavSubheader.js.map +1 -1
- package/dist/navigation/Navigation.d.ts +1 -1
- package/dist/navigation/Navigation.js.map +1 -1
- package/dist/navigation/_navigation.scss +6 -5
- package/dist/navigation/types.d.ts +54 -6
- package/dist/navigation/types.js.map +1 -1
- package/dist/navigation/useActiveHeadingId.d.ts +1 -1
- package/dist/navigation/useActiveHeadingId.js.map +1 -1
- package/dist/navigation/useNavigationExpansion.d.ts +104 -0
- package/dist/navigation/useNavigationExpansion.js +77 -0
- package/dist/navigation/useNavigationExpansion.js.map +1 -0
- package/dist/navigation/utils.d.ts +13 -0
- package/dist/navigation/utils.js +36 -0
- package/dist/navigation/utils.js.map +1 -0
- package/dist/objectFit.d.ts +69 -0
- package/dist/objectFit.js +52 -0
- package/dist/objectFit.js.map +1 -0
- package/dist/overlay/_overlay.scss +2 -1
- package/dist/positioning/useFixedPositioning.d.ts +17 -4
- package/dist/positioning/useFixedPositioning.js +10 -5
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/positioning/utils.js.map +1 -1
- package/dist/progress/LinearProgress.js.map +1 -1
- package/dist/progress/_progress.scss +20 -14
- package/dist/responsive-item/ResponsiveItem.d.ts +64 -0
- package/dist/responsive-item/ResponsiveItem.js +68 -0
- package/dist/responsive-item/ResponsiveItem.js.map +1 -0
- package/dist/responsive-item/ResponsiveItemOverlay.d.ts +1 -19
- package/dist/responsive-item/ResponsiveItemOverlay.js +1 -12
- package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
- package/dist/responsive-item/_responsive-item.scss +110 -133
- package/dist/responsive-item/responsiveItemOverlayStyles.d.ts +19 -0
- package/dist/responsive-item/responsiveItemOverlayStyles.js +14 -0
- package/dist/responsive-item/responsiveItemOverlayStyles.js.map +1 -0
- package/dist/responsive-item/responsiveItemStyles.d.ts +52 -0
- package/dist/responsive-item/responsiveItemStyles.js +15 -0
- package/dist/responsive-item/responsiveItemStyles.js.map +1 -0
- package/dist/scroll/useScrollLock.d.ts +5 -0
- package/dist/scroll/useScrollLock.js.map +1 -1
- package/dist/searching/utils.d.ts +2 -2
- package/dist/searching/utils.js.map +1 -1
- package/dist/segmented-button/SegmentedButton.d.ts +2 -1
- package/dist/segmented-button/SegmentedButton.js +2 -1
- package/dist/segmented-button/SegmentedButton.js.map +1 -1
- package/dist/segmented-button/_segmented-button.scss +6 -6
- package/dist/sheet/_sheet.scss +18 -6
- package/dist/snackbar/ToastManager.js +15 -5
- package/dist/snackbar/ToastManager.js.map +1 -1
- package/dist/snackbar/_snackbar.scss +30 -17
- package/dist/snackbar/useCurrentToastActions.d.ts +5 -5
- package/dist/snackbar/useCurrentToastActions.js.map +1 -1
- package/dist/table/_table.scss +15 -3
- package/dist/table/tableCellStyles.d.ts +7 -3
- package/dist/table/tableCellStyles.js +2 -2
- package/dist/table/tableCellStyles.js.map +1 -1
- package/dist/tabs/Tab.d.ts +2 -1
- package/dist/tabs/Tab.js +2 -1
- package/dist/tabs/Tab.js.map +1 -1
- package/dist/tabs/TabList.d.ts +2 -2
- package/dist/tabs/TabList.js.map +1 -1
- package/dist/tabs/TabListScrollButton.d.ts +1 -1
- package/dist/tabs/TabListScrollButton.js +1 -1
- package/dist/tabs/TabListScrollButton.js.map +1 -1
- package/dist/tabs/_tabs.scss +30 -9
- package/dist/tabs/getTabListScrollToOptions.d.ts +18 -0
- package/dist/tabs/getTabListScrollToOptions.js +19 -0
- package/dist/tabs/getTabListScrollToOptions.js.map +1 -0
- package/dist/tabs/tabStyles.d.ts +3 -0
- package/dist/tabs/tabStyles.js.map +1 -1
- package/dist/tabs/useTabList.d.ts +1 -8
- package/dist/tabs/useTabList.js +1 -0
- package/dist/tabs/useTabList.js.map +1 -1
- package/dist/tabs/useTabs.d.ts +6 -6
- package/dist/tabs/useTabs.js.map +1 -1
- package/dist/tabs/utils.d.ts +0 -18
- package/dist/tabs/utils.js +0 -15
- package/dist/tabs/utils.js.map +1 -1
- package/dist/test-utils/ResizeObserver.d.ts +11 -12
- package/dist/test-utils/ResizeObserver.js +11 -12
- package/dist/test-utils/ResizeObserver.js.map +1 -1
- package/dist/test-utils/matchMedia.d.ts +3 -3
- package/dist/test-utils/matchMedia.js +6 -6
- package/dist/test-utils/matchMedia.js.map +1 -1
- package/dist/test-utils/polyfills/TextDecoder.js +0 -1
- package/dist/test-utils/polyfills/TextDecoder.js.map +1 -1
- package/dist/test-utils/timers.d.ts +9 -5
- package/dist/test-utils/timers.js +5 -5
- package/dist/test-utils/timers.js.map +1 -1
- package/dist/theme/LocalStorageColorSchemeProvider.d.ts +1 -1
- package/dist/theme/LocalStorageColorSchemeProvider.js +2 -1
- package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
- package/dist/theme/ThemeProvider.js +3 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/_a11y.scss +86 -13
- package/dist/theme/_colors.scss +279 -277
- package/dist/theme/_theme.scss +308 -37
- package/dist/theme/isColorScheme.d.ts +16 -0
- package/dist/theme/isColorScheme.js +19 -0
- package/dist/theme/isColorScheme.js.map +1 -0
- package/dist/theme/types.d.ts +53 -1
- package/dist/theme/types.js +1 -23
- package/dist/theme/types.js.map +1 -1
- package/dist/theme/useCSSVariables.d.ts +2 -19
- package/dist/theme/useCSSVariables.js.map +1 -1
- package/dist/theme/useColorScheme.d.ts +1 -35
- package/dist/theme/useColorScheme.js.map +1 -1
- package/dist/theme/useColorSchemeMetaTag.d.ts +1 -1
- package/dist/theme/useColorSchemeMetaTag.js.map +1 -1
- package/dist/theme/useColorSchemeProvider.d.ts +1 -1
- package/dist/theme/useColorSchemeProvider.js +1 -1
- package/dist/theme/useColorSchemeProvider.js.map +1 -1
- package/dist/theme/{usePrefersColorScheme.js → usePrefersDarkScheme.js} +1 -1
- package/dist/theme/usePrefersDarkScheme.js.map +1 -0
- package/dist/theme/utils.js.map +1 -1
- package/dist/tooltip/useTooltip.d.ts +14 -9
- package/dist/tooltip/useTooltip.js +2 -1
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/transition/_transition.scss +16 -9
- package/dist/transition/skeletonPlaceholderUtils.js.map +1 -1
- package/dist/transition/types.d.ts +1 -1
- package/dist/transition/types.js.map +1 -1
- package/dist/transition/useCarousel.d.ts +3 -3
- package/dist/transition/useCarousel.js.map +1 -1
- package/dist/transition/useCollapseTransition.js.map +1 -1
- package/dist/transition/useTransition.js +1 -0
- package/dist/transition/useTransition.js.map +1 -1
- package/dist/transition/utils.js.map +1 -1
- package/dist/tree/TreeItem.d.ts +2 -1
- package/dist/tree/TreeItem.js +4 -3
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/TreeItemExpander.js.map +1 -1
- package/dist/tree/_tree.scss +8 -6
- package/dist/tree/useTreeExpansion.d.ts +1 -1
- package/dist/tree/useTreeExpansion.js +6 -18
- package/dist/tree/useTreeExpansion.js.map +1 -1
- package/dist/tree/useTreeSelection.d.ts +1 -1
- package/dist/tree/useTreeSelection.js +7 -25
- package/dist/tree/useTreeSelection.js.map +1 -1
- package/dist/tree/utils.d.ts +1 -1
- package/dist/tree/utils.js.map +1 -1
- package/dist/types.d.ts +12 -4
- package/dist/types.js.map +1 -1
- package/dist/typography/WritingDirectionProvider.d.ts +1 -1
- package/dist/typography/WritingDirectionProvider.js.map +1 -1
- package/dist/typography/_typography.scss +94 -37
- package/dist/typography/typographyStyles.js.map +1 -1
- package/dist/useDebouncedFunction.d.ts +1 -5
- package/dist/useDebouncedFunction.js +3 -1
- package/dist/useDebouncedFunction.js.map +1 -1
- package/dist/useDropzone.d.ts +4 -4
- package/dist/useDropzone.js.map +1 -1
- package/dist/useEnsuredId.js.map +1 -1
- package/dist/useIntersectionObserver.d.ts +5 -5
- package/dist/useIntersectionObserver.js.map +1 -1
- package/dist/useLocalStorage.d.ts +3 -3
- package/dist/useLocalStorage.js +1 -1
- package/dist/useLocalStorage.js.map +1 -1
- package/dist/useMutationObserver.d.ts +1 -1
- package/dist/useMutationObserver.js.map +1 -1
- package/dist/useOrientation.js +3 -1
- package/dist/useOrientation.js.map +1 -1
- package/dist/usePageInactive.d.ts +2 -2
- package/dist/usePageInactive.js.map +1 -1
- package/dist/useReadonlySet.d.ts +76 -0
- package/dist/useReadonlySet.js +72 -0
- package/dist/useReadonlySet.js.map +1 -0
- package/dist/useResizeListener.d.ts +1 -1
- package/dist/useResizeListener.js.map +1 -1
- package/dist/useResizeObserver.d.ts +19 -0
- package/dist/useResizeObserver.js +19 -0
- package/dist/useResizeObserver.js.map +1 -1
- package/dist/useThrottledFunction.d.ts +1 -5
- package/dist/useThrottledFunction.js +3 -1
- package/dist/useThrottledFunction.js.map +1 -1
- package/dist/useToggle.d.ts +3 -3
- package/dist/useToggle.js.map +1 -1
- package/dist/utils/RenderRecursively.d.ts +2 -2
- package/dist/utils/RenderRecursively.js.map +1 -1
- package/dist/utils/alphaNumericSort.d.ts +5 -5
- package/dist/utils/alphaNumericSort.js.map +1 -1
- package/dist/utils/bem.d.ts +1 -1
- package/dist/utils/bem.js +1 -1
- package/dist/utils/bem.js.map +1 -1
- package/dist/utils/debounce.d.ts +5 -0
- package/dist/utils/debounce.js +17 -0
- package/dist/utils/debounce.js.map +1 -0
- package/dist/utils/nearest.js.map +1 -1
- package/dist/utils/parseCssLengthUnit.js.map +1 -1
- package/dist/utils/throttle.d.ts +5 -0
- package/dist/utils/throttle.js +30 -0
- package/dist/utils/throttle.js.map +1 -0
- package/dist/utils/wait.js +3 -1
- package/dist/utils/wait.js.map +1 -1
- package/dist/window-splitter/WindowSplitter.d.ts +37 -15
- package/dist/window-splitter/WindowSplitter.js +38 -17
- package/dist/window-splitter/WindowSplitter.js.map +1 -1
- package/dist/window-splitter/_window-splitter.scss +32 -14
- package/dist/window-splitter/styles.d.ts +14 -0
- package/dist/window-splitter/styles.js +18 -0
- package/dist/window-splitter/styles.js.map +1 -0
- package/package.json +25 -24
- package/src/app-bar/AppBar.tsx +1 -170
- package/src/app-bar/AppBarTitle.tsx +1 -44
- package/src/app-bar/styles.ts +206 -0
- package/src/autocomplete/Autocomplete.tsx +194 -211
- package/src/autocomplete/AutocompleteChip.tsx +48 -0
- package/src/autocomplete/AutocompleteCircularProgress.tsx +6 -17
- package/src/autocomplete/AutocompleteClearButton.tsx +44 -0
- package/src/autocomplete/AutocompleteDropdownButton.tsx +16 -37
- package/src/autocomplete/AutocompleteListboxChildren.tsx +68 -0
- package/src/autocomplete/autocompleteStyles.ts +48 -9
- package/src/autocomplete/defaults.ts +26 -17
- package/src/autocomplete/types.ts +744 -61
- package/src/autocomplete/useAutocomplete.ts +428 -0
- package/src/autocomplete/utils.ts +211 -0
- package/src/badge/Badge.tsx +1 -39
- package/src/badge/styles.ts +45 -0
- package/src/box/Box.tsx +11 -9
- package/src/box/styles.ts +14 -5
- package/src/button/AsyncButton.tsx +1 -1
- package/src/button/Button.tsx +5 -1
- package/src/card/Card.tsx +35 -4
- package/src/card/ClickableCard.tsx +9 -2
- package/src/card/styles.ts +1 -10
- package/src/chip/Chip.tsx +6 -1
- package/src/chip/styles.ts +12 -10
- package/src/delegateEvent.ts +5 -5
- package/src/dialog/Dialog.tsx +48 -61
- package/src/dialog/FixedDialog.tsx +1 -11
- package/src/dialog/styles.ts +97 -0
- package/src/divider/Divider.tsx +0 -12
- package/src/divider/styles.ts +12 -0
- package/src/draggable/useDraggable.ts +17 -10
- package/src/draggable/utils.ts +3 -3
- package/src/expansion-panel/ExpansionPanel.tsx +1 -1
- package/src/expansion-panel/useExpansionPanels.ts +18 -27
- package/src/{form → files}/FileInput.tsx +7 -15
- package/src/files/styles.ts +10 -0
- package/src/{form → files}/useFileUpload.ts +30 -34
- package/src/files/utils.ts +234 -0
- package/src/{form/fileUtils.ts → files/validation.ts} +15 -244
- package/src/focus/useFocusContainer.ts +16 -8
- package/src/form/FormMessageContainer.tsx +2 -2
- package/src/form/InputToggle.tsx +5 -1
- package/src/form/Label.tsx +18 -18
- package/src/form/Listbox.tsx +87 -0
- package/src/form/ListboxProvider.ts +37 -0
- package/src/form/MenuItemTextField.tsx +1 -2
- package/src/form/NativeSelect.tsx +14 -10
- package/src/form/Option.tsx +74 -22
- package/src/form/Select.tsx +89 -85
- package/src/form/SelectedOption.tsx +2 -0
- package/src/form/Slider.tsx +14 -11
- package/src/form/SliderThumb.tsx +4 -4
- package/src/form/SliderValueMarks.tsx +4 -4
- package/src/form/TextArea.tsx +6 -8
- package/src/form/TextField.tsx +0 -2
- package/src/form/TextFieldContainer.tsx +9 -11
- package/src/form/formMessageContainerStyles.ts +22 -0
- package/src/form/optionStyles.ts +7 -2
- package/src/form/sliderUtils.ts +1 -1
- package/src/form/textFieldContainerStyles.ts +9 -14
- package/src/form/types.ts +3 -11
- package/src/form/useCheckboxGroup.ts +28 -36
- package/src/form/useCombobox.ts +86 -38
- package/src/form/useEditableCombobox.ts +43 -8
- package/src/form/useRadioGroup.ts +6 -6
- package/src/form/useSelectCombobox.ts +4 -4
- package/src/form/useTextField.ts +1 -1
- package/src/hoverMode/useHoverMode.ts +3 -3
- package/src/hoverMode/useHoverModeProvider.ts +4 -4
- package/src/icon/FontIcon.tsx +4 -2
- package/src/icon/TextIconSpacing.tsx +1 -1
- package/src/icon/iconConfig.tsx +12 -0
- package/src/interaction/UserInteractionModeProvider.tsx +12 -8
- package/src/interaction/types.ts +21 -2
- package/src/interaction/useElementInteraction.tsx +9 -2
- package/src/interaction/utils.ts +7 -7
- package/src/layout/useExpandableLayout.ts +3 -3
- package/src/layout/useLayoutAppBarHeight.ts +3 -4
- package/src/layout/useTemporaryLayout.ts +2 -2
- package/src/list/ListItem.tsx +5 -1
- package/src/list/ListItemLink.tsx +5 -1
- package/src/media-queries/useMediaQuery.ts +2 -1
- package/src/menu/Menu.tsx +11 -3
- package/src/menu/MenuItemButton.tsx +7 -1
- package/src/menu/useContextMenu.ts +3 -3
- package/src/movement/types.ts +5 -5
- package/src/navigation/CollapsibleNavGroup.tsx +16 -8
- package/src/navigation/DefaultNavigationRenderer.tsx +8 -6
- package/src/navigation/NavItemButton.tsx +2 -1
- package/src/navigation/NavItemLink.tsx +11 -3
- package/src/navigation/NavSubheader.tsx +1 -1
- package/src/navigation/Navigation.tsx +1 -1
- package/src/navigation/types.ts +60 -10
- package/src/navigation/useActiveHeadingId.ts +1 -1
- package/src/navigation/useNavigationExpansion.ts +170 -0
- package/src/navigation/utils.ts +47 -0
- package/src/objectFit.ts +88 -0
- package/src/positioning/useFixedPositioning.ts +34 -11
- package/src/responsive-item/ResponsiveItem.tsx +96 -0
- package/src/responsive-item/ResponsiveItemOverlay.tsx +6 -46
- package/src/responsive-item/responsiveItemOverlayStyles.ts +46 -0
- package/src/responsive-item/responsiveItemStyles.ts +81 -0
- package/src/scroll/useScrollLock.ts +6 -0
- package/src/searching/utils.ts +3 -3
- package/src/segmented-button/SegmentedButton.tsx +5 -1
- package/src/snackbar/ToastManager.tsx +16 -5
- package/src/snackbar/useCurrentToastActions.ts +5 -5
- package/src/table/tableCellStyles.ts +10 -6
- package/src/tabs/Tab.tsx +4 -1
- package/src/tabs/TabList.tsx +2 -2
- package/src/tabs/TabListScrollButton.tsx +4 -4
- package/src/tabs/getTabListScrollToOptions.ts +37 -0
- package/src/tabs/tabStyles.ts +4 -0
- package/src/tabs/useTabList.ts +2 -9
- package/src/tabs/useTabs.ts +6 -6
- package/src/tabs/utils.ts +0 -38
- package/src/test-utils/ResizeObserver.ts +11 -12
- package/src/test-utils/matchMedia.ts +7 -7
- package/src/test-utils/polyfills/TextDecoder.ts +0 -1
- package/src/test-utils/timers.ts +10 -7
- package/src/theme/LocalStorageColorSchemeProvider.tsx +4 -4
- package/src/theme/ThemeProvider.tsx +3 -3
- package/src/theme/isColorScheme.ts +22 -0
- package/src/theme/types.ts +67 -1
- package/src/theme/useCSSVariables.ts +7 -30
- package/src/theme/useColorScheme.ts +1 -40
- package/src/theme/useColorSchemeMetaTag.ts +1 -1
- package/src/theme/useColorSchemeProvider.ts +2 -2
- package/src/tooltip/useTooltip.ts +17 -9
- package/src/transition/types.ts +1 -1
- package/src/transition/useCarousel.ts +3 -3
- package/src/transition/useTransition.ts +1 -0
- package/src/tree/TreeItem.tsx +7 -1
- package/src/tree/TreeItemExpander.tsx +1 -1
- package/src/tree/useTreeExpansion.ts +7 -25
- package/src/tree/useTreeSelection.ts +8 -32
- package/src/tree/utils.ts +6 -2
- package/src/types.ts +20 -4
- package/src/typography/WritingDirectionProvider.tsx +1 -1
- package/src/useDebouncedFunction.ts +4 -9
- package/src/useDropzone.ts +4 -4
- package/src/useIntersectionObserver.ts +5 -5
- package/src/useLocalStorage.ts +6 -6
- package/src/useMutationObserver.ts +1 -1
- package/src/useOrientation.ts +3 -1
- package/src/usePageInactive.ts +2 -2
- package/src/useReadonlySet.ts +122 -0
- package/src/useResizeListener.ts +1 -1
- package/src/useResizeObserver.ts +19 -0
- package/src/useThrottledFunction.ts +6 -9
- package/src/useToggle.ts +3 -3
- package/src/utils/RenderRecursively.tsx +2 -2
- package/src/utils/alphaNumericSort.ts +5 -5
- package/src/utils/bem.ts +1 -1
- package/src/utils/debounce.ts +22 -0
- package/src/utils/throttle.ts +38 -0
- package/src/utils/wait.ts +5 -1
- package/src/window-splitter/WindowSplitter.tsx +38 -43
- package/src/window-splitter/styles.ts +42 -0
- package/dist/autocomplete/FilterAutocompleteOptions.d.ts +0 -8
- package/dist/autocomplete/FilterAutocompleteOptions.js +0 -57
- package/dist/autocomplete/FilterAutocompleteOptions.js.map +0 -1
- package/dist/dialog/DialogContainer.d.ts +0 -14
- package/dist/dialog/DialogContainer.js +0 -20
- package/dist/dialog/DialogContainer.js.map +0 -1
- package/dist/form/FileInput.js.map +0 -1
- package/dist/form/fileUtils.js.map +0 -1
- package/dist/form/useFileUpload.js.map +0 -1
- package/dist/form/useListboxProvider.d.ts +0 -31
- package/dist/form/useListboxProvider.js.map +0 -1
- package/dist/navigation/getHrefFromParents.d.ts +0 -5
- package/dist/navigation/getHrefFromParents.js +0 -13
- package/dist/navigation/getHrefFromParents.js.map +0 -1
- package/dist/responsive-item/ResponsiveItemContainer.d.ts +0 -115
- package/dist/responsive-item/ResponsiveItemContainer.js +0 -80
- package/dist/responsive-item/ResponsiveItemContainer.js.map +0 -1
- package/dist/responsive-item/styles.d.ts +0 -34
- package/dist/responsive-item/styles.js +0 -17
- package/dist/responsive-item/styles.js.map +0 -1
- package/dist/theme/usePrefersColorScheme.js.map +0 -1
- package/src/autocomplete/FilterAutocompleteOptions.tsx +0 -86
- package/src/dialog/DialogContainer.tsx +0 -28
- package/src/form/useListboxProvider.ts +0 -45
- package/src/navigation/getHrefFromParents.ts +0 -15
- package/src/responsive-item/ResponsiveItemContainer.tsx +0 -174
- package/src/responsive-item/styles.ts +0 -58
- /package/dist/theme/{usePrefersColorScheme.d.ts → usePrefersDarkScheme.d.ts} +0 -0
- /package/src/theme/{usePrefersColorScheme.ts → usePrefersDarkScheme.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/layout/LayoutWindowSplitter.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useMemo } from \"react\";\nimport { type DefinedCSSVariableName } from \"../theme/types.js\";\nimport { useCSSVariables } from \"../theme/useCSSVariables.js\";\nimport {\n WindowSplitter,\n type BaseWindowSplitterProps,\n} from \"../window-splitter/WindowSplitter.js\";\nimport { type WindowSplitterWidgetProps } from \"../window-splitter/useWindowSplitter.js\";\nimport {\n layoutWindowSplitter,\n type LayoutWindowSplitterClassNameOptions,\n} from \"./layoutWindowSplitterStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutWindowSplitterProps\n extends WindowSplitterWidgetProps<HTMLButtonElement>,\n Omit<\n BaseWindowSplitterProps,\n keyof WindowSplitterWidgetProps<HTMLButtonElement>\n >,\n LayoutWindowSplitterClassNameOptions {\n /** @defaultValue `\"Resize Navigation\"` */\n \"aria-label\"?: string;\n\n /**\n * The current navigation width (in px).\n */\n navWidth: number;\n}\n\n/**\n * **Client Component**\n *\n * This component is used to resize the `LayoutNav` component.\n *\n * @see {@link useResizableExpandableLayout} for a default implementation for\n * this component.\n *\n * @example Dynamic Resizing\n * ```tsx\n * import {\n * LayoutNav,\n * LayoutWindowSplitter,\n * Main,\n * NoSsr,\n * useWindowSize,\n * useWindowSplitter,\n * } from \"@react-md/core\";\n * import type { ReactElement, PropsWithChildren } from \"react\"\n *\n * function MyWindowSplitter(): ReactElement {\n * const { width } = useWindowSize({ disableHeight: true });\n * const min = 96;\n * const max = Math.max(600, width * .7);\n *\n * const { value, splitterProps } = useWindowSplitter({\n * min,\n * max,\n * defaultValue: 256,\n * });\n *\n * return (\n * <LayoutWindowSplitter\n * aria-controls=\"layout-nav-id\"\n * {...splitterProps}\n * value={value}\n * />\n * );\n * }\n *\n * function Layout({ children }: PropsWithChildren): ReactElement {\n * return (\n * <>\n * <LayoutNav id=\"layout-nav\" {...otherProps}>\n * <YourNavigation />\n * </LayoutNav>\n * // only required when using SSR\n * <NoSsr>\n * <MyWindowSplitter />\n * </NoSsr>\n * <Main navOffset>\n * {children}\n * </Main>\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const LayoutWindowSplitter = forwardRef<\n HTMLButtonElement,\n LayoutWindowSplitterProps\n>(function LayoutWindowSplitter(props, ref) {\n const {\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel = ariaLabelledBy ? undefined : \"Resize Navigation\",\n appBarOffset,\n disableResponsive,\n className,\n navWidth,\n ...remaining\n } = props;\n\n useCSSVariables<DefinedCSSVariableName>(\n useMemo(\n () => [{ name: \"--rmd-layout-size\", value: `${navWidth}px` }],\n [navWidth]\n )\n );\n\n return (\n <WindowSplitter\n {...remaining}\n ref={ref}\n aria-label={ariaLabel as string}\n aria-labelledby={ariaLabelledBy}\n className={layoutWindowSplitter({\n appBarOffset,\n disableResponsive,\n className,\n })}\n />\n );\n});\n"],"names":["forwardRef","useMemo","useCSSVariables","WindowSplitter","layoutWindowSplitter","LayoutWindowSplitter","props","ref","ariaLabelledBy","ariaLabel","undefined","appBarOffset","disableResponsive","className","navWidth","remaining","name","value","aria-label","aria-labelledby"],"mappings":"AAAA;;AACA,SAASA,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAE5C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SACEC,cAAc,QAET,uCAAuC;AAE9C,SACEC,oBAAoB,QAEf,kCAAkC;AAqBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DC,GACD,OAAO,MAAMC,qCAAuBL,WAGlC,SAASK,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EACJ,mBAAmBC,cAAc,EACjC,cAAcC,YAAYD,iBAAiBE,YAAY,mBAAmB,EAC1EC,YAAY,EACZC,iBAAiB,EACjBC,SAAS,EACTC,QAAQ,EACR,GAAGC,WACJ,GAAGT;IAEJJ,gBACED,QACE,IAAM;YAAC;gBAAEe,MAAM;gBAAqBC,OAAO,
|
|
1
|
+
{"version":3,"sources":["../../src/layout/LayoutWindowSplitter.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useMemo } from \"react\";\nimport { type DefinedCSSVariableName } from \"../theme/types.js\";\nimport { useCSSVariables } from \"../theme/useCSSVariables.js\";\nimport {\n WindowSplitter,\n type BaseWindowSplitterProps,\n} from \"../window-splitter/WindowSplitter.js\";\nimport { type WindowSplitterWidgetProps } from \"../window-splitter/useWindowSplitter.js\";\nimport {\n layoutWindowSplitter,\n type LayoutWindowSplitterClassNameOptions,\n} from \"./layoutWindowSplitterStyles.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutWindowSplitterProps\n extends WindowSplitterWidgetProps<HTMLButtonElement>,\n Omit<\n BaseWindowSplitterProps,\n keyof WindowSplitterWidgetProps<HTMLButtonElement>\n >,\n LayoutWindowSplitterClassNameOptions {\n /** @defaultValue `\"Resize Navigation\"` */\n \"aria-label\"?: string;\n\n /**\n * The current navigation width (in px).\n */\n navWidth: number;\n}\n\n/**\n * **Client Component**\n *\n * This component is used to resize the `LayoutNav` component.\n *\n * @see {@link useResizableExpandableLayout} for a default implementation for\n * this component.\n *\n * @example Dynamic Resizing\n * ```tsx\n * import {\n * LayoutNav,\n * LayoutWindowSplitter,\n * Main,\n * NoSsr,\n * useWindowSize,\n * useWindowSplitter,\n * } from \"@react-md/core\";\n * import type { ReactElement, PropsWithChildren } from \"react\"\n *\n * function MyWindowSplitter(): ReactElement {\n * const { width } = useWindowSize({ disableHeight: true });\n * const min = 96;\n * const max = Math.max(600, width * .7);\n *\n * const { value, splitterProps } = useWindowSplitter({\n * min,\n * max,\n * defaultValue: 256,\n * });\n *\n * return (\n * <LayoutWindowSplitter\n * aria-controls=\"layout-nav-id\"\n * {...splitterProps}\n * value={value}\n * />\n * );\n * }\n *\n * function Layout({ children }: PropsWithChildren): ReactElement {\n * return (\n * <>\n * <LayoutNav id=\"layout-nav\" {...otherProps}>\n * <YourNavigation />\n * </LayoutNav>\n * // only required when using SSR\n * <NoSsr>\n * <MyWindowSplitter />\n * </NoSsr>\n * <Main navOffset>\n * {children}\n * </Main>\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport const LayoutWindowSplitter = forwardRef<\n HTMLButtonElement,\n LayoutWindowSplitterProps\n>(function LayoutWindowSplitter(props, ref) {\n const {\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel = ariaLabelledBy ? undefined : \"Resize Navigation\",\n appBarOffset,\n disableResponsive,\n className,\n navWidth,\n ...remaining\n } = props;\n\n useCSSVariables<DefinedCSSVariableName>(\n useMemo(\n () => [{ name: \"--rmd-layout-size\", value: `${navWidth}px` }],\n [navWidth]\n )\n );\n\n return (\n <WindowSplitter\n {...remaining}\n ref={ref}\n aria-label={ariaLabel as string}\n aria-labelledby={ariaLabelledBy}\n className={layoutWindowSplitter({\n appBarOffset,\n disableResponsive,\n className,\n })}\n />\n );\n});\n"],"names":["forwardRef","useMemo","useCSSVariables","WindowSplitter","layoutWindowSplitter","LayoutWindowSplitter","props","ref","ariaLabelledBy","ariaLabel","undefined","appBarOffset","disableResponsive","className","navWidth","remaining","name","value","aria-label","aria-labelledby"],"mappings":"AAAA;;AACA,SAASA,UAAU,EAAEC,OAAO,QAAQ,QAAQ;AAE5C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SACEC,cAAc,QAET,uCAAuC;AAE9C,SACEC,oBAAoB,QAEf,kCAAkC;AAqBzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2DC,GACD,OAAO,MAAMC,qCAAuBL,WAGlC,SAASK,qBAAqBC,KAAK,EAAEC,GAAG;IACxC,MAAM,EACJ,mBAAmBC,cAAc,EACjC,cAAcC,YAAYD,iBAAiBE,YAAY,mBAAmB,EAC1EC,YAAY,EACZC,iBAAiB,EACjBC,SAAS,EACTC,QAAQ,EACR,GAAGC,WACJ,GAAGT;IAEJJ,gBACED,QACE,IAAM;YAAC;gBAAEe,MAAM;gBAAqBC,OAAO,GAAGH,SAAS,EAAE,CAAC;YAAC;SAAE,EAC7D;QAACA;KAAS;IAId,qBACE,KAACX;QACE,GAAGY,SAAS;QACbR,KAAKA;QACLW,cAAYT;QACZU,mBAAiBX;QACjBK,WAAWT,qBAAqB;YAC9BO;YACAC;YACAC;QACF;;AAGN,GAAG"}
|
package/dist/layout/_layout.scss
CHANGED
|
@@ -93,12 +93,6 @@ $variables: (size, header-height);
|
|
|
93
93
|
/// between layout types as you resize the browser.
|
|
94
94
|
.rmd-layout-nav {
|
|
95
95
|
@include sheet.set-var(width, get-var(size));
|
|
96
|
-
@include media-queries.media($navigation-breakpoint) {
|
|
97
|
-
// Why did I want grid? flex seems easier atm
|
|
98
|
-
// use grid so that you can easily have a header + tree that fills the remaining space
|
|
99
|
-
display: flex;
|
|
100
|
-
flex-direction: column;
|
|
101
|
-
}
|
|
102
96
|
|
|
103
97
|
container: $navigation-container-name;
|
|
104
98
|
display: none;
|
|
@@ -107,6 +101,13 @@ $variables: (size, header-height);
|
|
|
107
101
|
&--offset-v {
|
|
108
102
|
@include use-var(top, header-height);
|
|
109
103
|
}
|
|
104
|
+
|
|
105
|
+
@include media-queries.media($navigation-breakpoint) {
|
|
106
|
+
// Why did I want grid? flex seems easier atm
|
|
107
|
+
// use grid so that you can easily have a header + tree that fills the remaining space
|
|
108
|
+
display: flex;
|
|
109
|
+
flex-direction: column;
|
|
110
|
+
}
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
@if not $disable-full-height-navigation {
|
|
@@ -124,10 +125,22 @@ $variables: (size, header-height);
|
|
|
124
125
|
|
|
125
126
|
&--active {
|
|
126
127
|
@include media-queries.media($navigation-breakpoint) {
|
|
127
|
-
@include
|
|
128
|
+
@include use-var(margin-left, size);
|
|
128
129
|
|
|
129
130
|
&::before {
|
|
130
|
-
@include
|
|
131
|
+
@include use-var(left, size);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@include utils.rtl {
|
|
135
|
+
@include use-var(margin-right, size);
|
|
136
|
+
|
|
137
|
+
margin-left: 0;
|
|
138
|
+
|
|
139
|
+
&::before {
|
|
140
|
+
@include use-var(right, size);
|
|
141
|
+
|
|
142
|
+
left: auto;
|
|
143
|
+
}
|
|
131
144
|
}
|
|
132
145
|
}
|
|
133
146
|
}
|
|
@@ -150,11 +163,11 @@ $variables: (size, header-height);
|
|
|
150
163
|
}
|
|
151
164
|
|
|
152
165
|
&--responsive {
|
|
166
|
+
display: none;
|
|
167
|
+
|
|
153
168
|
@include media-queries.media($navigation-breakpoint) {
|
|
154
169
|
display: inline-block;
|
|
155
170
|
}
|
|
156
|
-
|
|
157
|
-
display: none;
|
|
158
171
|
}
|
|
159
172
|
}
|
|
160
173
|
}
|
|
@@ -60,9 +60,9 @@ export interface ExpandableLayoutImplementation extends TemporaryLayoutImplement
|
|
|
60
60
|
temporary: boolean;
|
|
61
61
|
persistent: boolean;
|
|
62
62
|
expanded: boolean;
|
|
63
|
-
expandNavigation()
|
|
64
|
-
collapseNavigation()
|
|
65
|
-
toggleNavigation()
|
|
63
|
+
expandNavigation: () => void;
|
|
64
|
+
collapseNavigation: () => void;
|
|
65
|
+
toggleNavigation: () => void;
|
|
66
66
|
appBarProps: ProvidedLayoutAppBarProps;
|
|
67
67
|
mainProps: ProvidedLayoutMainProps;
|
|
68
68
|
navToggleProps: ProvidedExpandableLayoutNavToggleProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/layout/useExpandableLayout.ts"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type CSSTransitionElementProps } from \"../transition/types.js\";\nimport { type CssPosition, type UseStateInitializer } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { type LayoutNavProps } from \"./LayoutNav.js\";\nimport {\n useHorizontalLayoutTransition,\n type HorizontalLayoutTransitionOptions,\n} from \"./useHorizontalLayoutTransition.js\";\nimport { useSsr } from \"../SsrProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useResizableLayout } from \"./useResizableLayout.js\";\nimport {\n useTemporaryLayout,\n type ProvidedLayoutNavToggleProps,\n type ProvidedTemporaryLayoutAppBarProps,\n type ProvidedTemporaryLayoutMainProps,\n type TemporaryLayoutImplementation,\n type TemporaryLayoutOptions,\n} from \"./useTemporaryLayout.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutOptions extends TemporaryLayoutOptions {\n /** @defaultValue `\"fixed\"` */\n appBarPosition?: CssPosition;\n\n /** @defaultValue `false` */\n defaultExpanded?: UseStateInitializer<boolean>;\n\n /**\n * Set this to `true` if the expandable navigation should be the full height\n * of the screen. This will also update the app bar so that it is not covered\n * by the navigation. The default behavior is to place the navigation below\n * the fixed header.\n *\n * Set this to `\"static\"` to make the navigation span the full height of the\n * screen and hide the button until the screen shrinks to the temporary\n * layout type.\n *\n * @defaultValue `false`\n */\n fullHeightNav?: boolean | \"static\";\n\n /** @see {@link HorizontalLayoutTransitionOptions} */\n transitionProps?: Omit<HorizontalLayoutTransitionOptions, \"transitionIn\">;\n\n /**\n * Set this to `\"desktop\"` if you want to use the temporary navigation until\n * the viewport is at least desktop width instead of tablet.\n *\n * @defaultValue `\"tablet\"`\n */\n temporaryUntil?: \"tablet\" | \"desktop\";\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedLayoutMainProps\n extends ProvidedTemporaryLayoutMainProps,\n CSSTransitionElementProps<HTMLElement> {}\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutNavProps = Pick<\n LayoutNavProps,\n \"expanded\" | \"appBarOffset\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutAppBarProps = ProvidedTemporaryLayoutAppBarProps &\n Partial<CSSTransitionElementProps<HTMLElement>>;\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedExpandableLayoutNavToggleProps\n extends ProvidedLayoutNavToggleProps {\n className: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutImplementation\n extends TemporaryLayoutImplementation {\n temporary: boolean;\n persistent: boolean;\n expanded: boolean;\n expandNavigation()
|
|
1
|
+
{"version":3,"sources":["../../src/layout/useExpandableLayout.ts"],"sourcesContent":["\"use client\";\nimport { cnb } from \"cnbuilder\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type CSSTransitionElementProps } from \"../transition/types.js\";\nimport { type CssPosition, type UseStateInitializer } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { type LayoutNavProps } from \"./LayoutNav.js\";\nimport {\n useHorizontalLayoutTransition,\n type HorizontalLayoutTransitionOptions,\n} from \"./useHorizontalLayoutTransition.js\";\nimport { useSsr } from \"../SsrProvider.js\";\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport { type useResizableLayout } from \"./useResizableLayout.js\";\nimport {\n useTemporaryLayout,\n type ProvidedLayoutNavToggleProps,\n type ProvidedTemporaryLayoutAppBarProps,\n type ProvidedTemporaryLayoutMainProps,\n type TemporaryLayoutImplementation,\n type TemporaryLayoutOptions,\n} from \"./useTemporaryLayout.js\";\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutOptions extends TemporaryLayoutOptions {\n /** @defaultValue `\"fixed\"` */\n appBarPosition?: CssPosition;\n\n /** @defaultValue `false` */\n defaultExpanded?: UseStateInitializer<boolean>;\n\n /**\n * Set this to `true` if the expandable navigation should be the full height\n * of the screen. This will also update the app bar so that it is not covered\n * by the navigation. The default behavior is to place the navigation below\n * the fixed header.\n *\n * Set this to `\"static\"` to make the navigation span the full height of the\n * screen and hide the button until the screen shrinks to the temporary\n * layout type.\n *\n * @defaultValue `false`\n */\n fullHeightNav?: boolean | \"static\";\n\n /** @see {@link HorizontalLayoutTransitionOptions} */\n transitionProps?: Omit<HorizontalLayoutTransitionOptions, \"transitionIn\">;\n\n /**\n * Set this to `\"desktop\"` if you want to use the temporary navigation until\n * the viewport is at least desktop width instead of tablet.\n *\n * @defaultValue `\"tablet\"`\n */\n temporaryUntil?: \"tablet\" | \"desktop\";\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedLayoutMainProps\n extends ProvidedTemporaryLayoutMainProps,\n CSSTransitionElementProps<HTMLElement> {}\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutNavProps = Pick<\n LayoutNavProps,\n \"expanded\" | \"appBarOffset\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutAppBarProps = ProvidedTemporaryLayoutAppBarProps &\n Partial<CSSTransitionElementProps<HTMLElement>>;\n\n/**\n * @since 6.0.0\n */\nexport interface ProvidedExpandableLayoutNavToggleProps\n extends ProvidedLayoutNavToggleProps {\n className: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ExpandableLayoutImplementation\n extends TemporaryLayoutImplementation {\n temporary: boolean;\n persistent: boolean;\n expanded: boolean;\n expandNavigation: () => void;\n collapseNavigation: () => void;\n toggleNavigation: () => void;\n appBarProps: ProvidedLayoutAppBarProps;\n mainProps: ProvidedLayoutMainProps;\n navToggleProps: ProvidedExpandableLayoutNavToggleProps;\n expandableNavProps: ProvidedLayoutNavProps;\n}\n\n/**\n * @example Main Usage\n * ```tsx\n * import {\n * AppBarTitle,\n * Button,\n * LayoutAppBar,\n * LayoutNav,\n * Main,\n * Sheet,\n * useExpandableLayout,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * import { CustomNavigation } from \"./CustomNavigation\";\n *\n * export interface LayoutProps {\n * children: ReactNode;\n * }\n *\n * export function Layout(props: LayoutProps): ReactElement {\n * const { children } = props;\n *\n * // choose whichever one for your app\n * // nextjs app dir\n * const pathname = usePathname();\n * // nextjs pages\n * const { pathname } = useRouter();\n * // react router\n * const { pathname } = useHistory();\n *\n * const {\n * temporary,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useExpandableLayout({ pathname });\n *\n * return {\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * <LayoutNav {...expandableNavProps}>\n * <CustomNavigation />\n * </LayoutNav>\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * }\n * }\n * ```\n *\n * If you have a large navigation panel, you can conditionally render the\n * `LayoutNav` with the `persistent` boolean returned by the hook which will\n * ensure that the DOM has rehydrated before unmounting to prevent SSR errors.\n *\n * @example Safely Conditionally Rendering\n * ```diff\n * const {\n * temporary,\n * + persistent,\n * appBarProps,\n * expandableNavProps,\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * windowSplitterProps,\n * } = useExpandableLayout({ pathname });\n *\n * return {\n * <>\n * <LayoutAppBar {...appBarProps}>\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </LayoutAppBar>\n * - <LayoutNav {...expandableNavProps}>\n * - <CustomNavigation />\n * - </LayoutNav>\n * + {persistent && (\n * + <LayoutNav {...expandableNavProps}>\n * + <CustomNavigation />\n * + </LayoutNav>\n * + )}\n * {temporary && (\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * )}\n * <Main {...mainProps}>{children}</Main>\n * </>\n * }\n * ```\n *\n * @since 6.0.0\n * @see {@link useResizableLayout}\n */\nexport function useExpandableLayout(\n options: ExpandableLayoutOptions\n): ExpandableLayoutImplementation {\n const {\n fullHeightNav = false,\n temporaryUntil = \"tablet\",\n transitionProps,\n defaultExpanded = fullHeightNav === \"static\",\n ...temporaryOptions\n } = options;\n\n const ssr = useSsr();\n const {\n appBarProps,\n mainProps,\n navToggleProps,\n temporaryNavProps,\n hideTemporaryNav,\n showTemporaryNav,\n visible,\n } = useTemporaryLayout(temporaryOptions);\n\n const {\n toggled: expanded,\n enable: expandNavigation,\n disable: collapseNavigation,\n toggle: toggleNavigation,\n } = useToggle(defaultExpanded);\n const { elementProps } = useHorizontalLayoutTransition({\n ...transitionProps,\n transitionIn: expanded,\n });\n const { isPhone, isDesktop } = useAppSize();\n const temporary = isPhone || (temporaryUntil === \"desktop\" && !isDesktop);\n\n return {\n visible,\n temporary,\n persistent: ssr || !temporary,\n hideTemporaryNav,\n showTemporaryNav,\n expanded,\n expandNavigation,\n collapseNavigation,\n toggleNavigation,\n appBarProps: {\n ...appBarProps,\n ...(fullHeightNav ? elementProps : {}),\n },\n mainProps: {\n ...mainProps,\n ...elementProps,\n },\n temporaryNavProps,\n expandableNavProps: {\n expanded,\n appBarOffset: !fullHeightNav,\n },\n navToggleProps: {\n ...navToggleProps,\n onClick() {\n if (temporary) {\n showTemporaryNav();\n } else {\n toggleNavigation();\n }\n },\n className: cnb(fullHeightNav === \"static\" && \"rmd-layout-nav-toggle\"),\n },\n };\n}\n"],"names":["cnb","useAppSize","useToggle","useHorizontalLayoutTransition","useSsr","useTemporaryLayout","useExpandableLayout","options","fullHeightNav","temporaryUntil","transitionProps","defaultExpanded","temporaryOptions","ssr","appBarProps","mainProps","navToggleProps","temporaryNavProps","hideTemporaryNav","showTemporaryNav","visible","toggled","expanded","enable","expandNavigation","disable","collapseNavigation","toggle","toggleNavigation","elementProps","transitionIn","isPhone","isDesktop","temporary","persistent","expandableNavProps","appBarOffset","onClick","className"],"mappings":"AAAA;AACA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,sCAAsC;AAGjE,SAASC,SAAS,QAAQ,kBAAkB;AAE5C,SACEC,6BAA6B,QAExB,qCAAqC;AAC5C,SAASC,MAAM,QAAQ,oBAAoB;AAG3C,SACEC,kBAAkB,QAMb,0BAA0B;AAoFjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwGC,GACD,OAAO,SAASC,oBACdC,OAAgC;IAEhC,MAAM,EACJC,gBAAgB,KAAK,EACrBC,iBAAiB,QAAQ,EACzBC,eAAe,EACfC,kBAAkBH,kBAAkB,QAAQ,EAC5C,GAAGI,kBACJ,GAAGL;IAEJ,MAAMM,MAAMT;IACZ,MAAM,EACJU,WAAW,EACXC,SAAS,EACTC,cAAc,EACdC,iBAAiB,EACjBC,gBAAgB,EAChBC,gBAAgB,EAChBC,OAAO,EACR,GAAGf,mBAAmBO;IAEvB,MAAM,EACJS,SAASC,QAAQ,EACjBC,QAAQC,gBAAgB,EACxBC,SAASC,kBAAkB,EAC3BC,QAAQC,gBAAgB,EACzB,GAAG1B,UAAUS;IACd,MAAM,EAAEkB,YAAY,EAAE,GAAG1B,8BAA8B;QACrD,GAAGO,eAAe;QAClBoB,cAAcR;IAChB;IACA,MAAM,EAAES,OAAO,EAAEC,SAAS,EAAE,GAAG/B;IAC/B,MAAMgC,YAAYF,WAAYtB,mBAAmB,aAAa,CAACuB;IAE/D,OAAO;QACLZ;QACAa;QACAC,YAAYrB,OAAO,CAACoB;QACpBf;QACAC;QACAG;QACAE;QACAE;QACAE;QACAd,aAAa;YACX,GAAGA,WAAW;YACd,GAAIN,gBAAgBqB,eAAe,CAAC,CAAC;QACvC;QACAd,WAAW;YACT,GAAGA,SAAS;YACZ,GAAGc,YAAY;QACjB;QACAZ;QACAkB,oBAAoB;YAClBb;YACAc,cAAc,CAAC5B;QACjB;QACAQ,gBAAgB;YACd,GAAGA,cAAc;YACjBqB;gBACE,IAAIJ,WAAW;oBACbd;gBACF,OAAO;oBACLS;gBACF;YACF;YACAU,WAAWtC,IAAIQ,kBAAkB,YAAY;QAC/C;IACF;AACF"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type Ref, type RefCallback } from "react";
|
|
2
|
-
import { type
|
|
3
|
-
import { type CSSVariable } from "../theme/useCSSVariables.js";
|
|
2
|
+
import { type CSSVariable } from "../theme/types.js";
|
|
4
3
|
declare module "react" {
|
|
5
4
|
interface CSSProperties {
|
|
6
5
|
"--rmd-layout-size"?: string;
|
|
@@ -12,7 +11,7 @@ declare module "react" {
|
|
|
12
11
|
*/
|
|
13
12
|
export interface LayoutAppBarHeightResult {
|
|
14
13
|
height: number | undefined;
|
|
15
|
-
variables: readonly CSSVariable
|
|
14
|
+
variables: readonly CSSVariable[];
|
|
16
15
|
appBarRef: RefCallback<HTMLDivElement>;
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/layout/useLayoutAppBarHeight.ts"],"sourcesContent":["\"use client\";\nimport { useMemo, type Ref, type RefCallback } from \"react\";\nimport { type
|
|
1
|
+
{"version":3,"sources":["../../src/layout/useLayoutAppBarHeight.ts"],"sourcesContent":["\"use client\";\nimport { useMemo, type Ref, type RefCallback } from \"react\";\nimport { type CSSVariable } from \"../theme/types.js\";\nimport { useElementSize } from \"../useElementSize.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-layout-size\"?: string;\n \"--rmd-layout-header-height\"?: string;\n }\n}\n\n/**\n * @since 6.0.0\n */\nexport interface LayoutAppBarHeightResult {\n height: number | undefined;\n variables: readonly CSSVariable[];\n appBarRef: RefCallback<HTMLDivElement>;\n}\n\n/**\n * @example Main Usage\n * ```tsx\n * import type { PropsWithChildren, ReactElement } from \"react\";\n * import {\n * AppBar,\n * useCSSVariables,\n * useLayoutAppBarHeight\n * } from \"@react-md/core\";\n *\n * export function LayoutHeader({ children }: PropsWithChildren): ReactElement {\n * const { appBarRef, variables } = useLayoutAppBarHeight();\n * useCSSVariables(variables);\n *\n * return (\n * <AppBar ref={appBarRef} {...customProps}>\n * <CustomChildren />\n * </AppBar>\n * );\n * };\n * ```\n *\n * @example Inline Variables\n * ```tsx\n * import type { PropsWithChildren, ReactElement } from \"react\";\n * import {\n * AppBar,\n * useCSSVariables,\n * useLayoutAppBarHeight\n * } from \"@react-md/core\";\n *\n * export function Layout({ children }: PropsWithChildren): ReactElement {\n * const { appBarRef, variables } = useLayoutAppBarHeight();\n * const inlineStyle = useCSSVariables(variables, true);\n *\n * return (\n * <div style={inlineStyle}>\n * <AppBar ref={appBarRef} {...customProps}>\n * <CustomChildren />\n * </AppBar>\n * {children}\n * </div>\n * );\n * };\n * ```\n *\n * @since 6.0.0\n */\nexport function useLayoutAppBarHeight(\n ref?: Ref<HTMLDivElement>\n): LayoutAppBarHeightResult {\n const { height, elementRef, observedOnce } = useElementSize({\n ref,\n disableWidth: true,\n });\n const variables = useMemo<CSSVariable[]>(() => {\n if (Number.isNaN(height) || !observedOnce) {\n return [];\n }\n\n return [{ name: \"--rmd-layout-header-height\", value: `${height}px` }];\n }, [height, observedOnce]);\n\n return {\n height,\n variables,\n appBarRef: elementRef,\n };\n}\n"],"names":["useMemo","useElementSize","useLayoutAppBarHeight","ref","height","elementRef","observedOnce","disableWidth","variables","Number","isNaN","name","value","appBarRef"],"mappings":"AAAA;AACA,SAASA,OAAO,QAAoC,QAAQ;AAE5D,SAASC,cAAc,QAAQ,uBAAuB;AAkBtD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CC,GACD,OAAO,SAASC,sBACdC,GAAyB;IAEzB,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,YAAY,EAAE,GAAGL,eAAe;QAC1DE;QACAI,cAAc;IAChB;IACA,MAAMC,YAAYR,QAAuB;QACvC,IAAIS,OAAOC,KAAK,CAACN,WAAW,CAACE,cAAc;YACzC,OAAO,EAAE;QACX;QAEA,OAAO;YAAC;gBAAEK,MAAM;gBAA8BC,OAAO,GAAGR,OAAO,EAAE,CAAC;YAAC;SAAE;IACvE,GAAG;QAACA;QAAQE;KAAa;IAEzB,OAAO;QACLF;QACAI;QACAK,WAAWR;IACb;AACF"}
|
|
@@ -36,8 +36,8 @@ export type ProvidedTemporaryLayoutAppBarProps = Required<Pick<AppBarProps, "pos
|
|
|
36
36
|
*/
|
|
37
37
|
export interface TemporaryLayoutImplementation {
|
|
38
38
|
visible: boolean;
|
|
39
|
-
showTemporaryNav()
|
|
40
|
-
hideTemporaryNav()
|
|
39
|
+
showTemporaryNav: () => void;
|
|
40
|
+
hideTemporaryNav: () => void;
|
|
41
41
|
appBarProps: ProvidedTemporaryLayoutAppBarProps;
|
|
42
42
|
mainProps: ProvidedTemporaryLayoutMainProps;
|
|
43
43
|
navToggleProps: ProvidedLayoutNavToggleProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/layout/useTemporaryLayout.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, type PropsWithChildren } from \"react\";\nimport { type AppBarProps } from \"../app-bar/AppBar.js\";\nimport { type ButtonProps } from \"../button/Button.js\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { type SheetProps } from \"../sheet/Sheet.js\";\nimport { type CssPosition, type UseStateInitializer } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { type MainProps } from \"./Main.js\";\n\nexport interface TemporaryLayoutOptions {\n /**\n * This is used to automatically hide the temporary navigation whenever the\n * route changes. Set this to `null` if you want to handle closing yourself.\n */\n pathname: string | null;\n\n /** @defaultValue `\"fixed\"` */\n appBarPosition?: CssPosition;\n\n /** @defaultValue `false` */\n defaultVisible?: UseStateInitializer<boolean>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutNavToggleProps = PropsWithChildren<\n Pick<Required<ButtonProps>, \"aria-label\" | \"buttonType\" | \"onClick\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedTemporaryLayoutNavProps = Pick<\n Required<SheetProps>,\n \"aria-label\" | \"visible\" | \"onRequestClose\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedTemporaryLayoutMainProps = Required<\n Pick<MainProps, \"appBarOffset\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedTemporaryLayoutAppBarProps = Required<\n Pick<AppBarProps, \"position\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface TemporaryLayoutImplementation {\n visible: boolean;\n showTemporaryNav()
|
|
1
|
+
{"version":3,"sources":["../../src/layout/useTemporaryLayout.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, type PropsWithChildren } from \"react\";\nimport { type AppBarProps } from \"../app-bar/AppBar.js\";\nimport { type ButtonProps } from \"../button/Button.js\";\nimport { getIcon } from \"../icon/iconConfig.js\";\nimport { type SheetProps } from \"../sheet/Sheet.js\";\nimport { type CssPosition, type UseStateInitializer } from \"../types.js\";\nimport { useToggle } from \"../useToggle.js\";\nimport { type MainProps } from \"./Main.js\";\n\nexport interface TemporaryLayoutOptions {\n /**\n * This is used to automatically hide the temporary navigation whenever the\n * route changes. Set this to `null` if you want to handle closing yourself.\n */\n pathname: string | null;\n\n /** @defaultValue `\"fixed\"` */\n appBarPosition?: CssPosition;\n\n /** @defaultValue `false` */\n defaultVisible?: UseStateInitializer<boolean>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedLayoutNavToggleProps = PropsWithChildren<\n Pick<Required<ButtonProps>, \"aria-label\" | \"buttonType\" | \"onClick\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedTemporaryLayoutNavProps = Pick<\n Required<SheetProps>,\n \"aria-label\" | \"visible\" | \"onRequestClose\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedTemporaryLayoutMainProps = Required<\n Pick<MainProps, \"appBarOffset\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport type ProvidedTemporaryLayoutAppBarProps = Required<\n Pick<AppBarProps, \"position\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface TemporaryLayoutImplementation {\n visible: boolean;\n showTemporaryNav: () => void;\n hideTemporaryNav: () => void;\n appBarProps: ProvidedTemporaryLayoutAppBarProps;\n mainProps: ProvidedTemporaryLayoutMainProps;\n navToggleProps: ProvidedLayoutNavToggleProps;\n temporaryNavProps: ProvidedTemporaryLayoutNavProps;\n}\n\n/**\n * @example\n * ```tsx\n * import {\n * AppBar,\n * AppBarTitle,\n * Button,\n * Main,\n * Sheet,\n * useTemporaryLayout,\n * } from \"@react-md/core\";\n * import type { ReactElement, ReactNode } from \"react\";\n *\n * import { CustomNavigation } from \"./CustomNavigation.jsx\";\n *\n * export interface LayoutProps {\n * children: ReactNode;\n * }\n *\n * export function Layout(props: LayoutProps): ReactElement {\n * const { children } = props;\n *\n * // choose whichever one for your app\n * // nextjs app dir\n * const pathname = usePathname();\n * // nextjs pages\n * const { pathname } = useRouter();\n * // react router\n * const { pathname } = useHistory();\n *\n * const {\n * mainProps,\n * navToggleProps,\n * temporaryNavProps,\n * } = useTemporaryLayout({ pathname });\n *\n * return (\n * <>\n * <AppBar position=\"fixed\">\n * <Button {...navToggleProps} />\n * <AppBarTitle>Hello, world!</AppBarTitle>\n * </AppBar>\n * <Main {...mainProps}>{children}</Main>\n * <Sheet {...temporaryNavProps}>\n * <CustomNavigation />\n * </Sheet>\n * </>\n * );\n * }\n * ```\n *\n * @since 6.0.0\n */\nexport function useTemporaryLayout(\n options: TemporaryLayoutOptions\n): TemporaryLayoutImplementation {\n const {\n pathname,\n defaultVisible = false,\n appBarPosition = \"fixed\",\n } = options;\n\n const menuIcon = getIcon(\"menu\");\n const {\n toggled: visible,\n enable: showTemporaryNav,\n disable: hideTemporaryNav,\n } = useToggle(defaultVisible);\n\n // hide the temporary nav whenever the route changes\n useEffect(() => {\n if (pathname !== null) {\n hideTemporaryNav();\n }\n }, [hideTemporaryNav, pathname]);\n\n return {\n visible,\n showTemporaryNav,\n hideTemporaryNav,\n appBarProps: {\n position: appBarPosition,\n },\n mainProps: {\n appBarOffset: appBarPosition !== \"static\",\n },\n temporaryNavProps: {\n \"aria-label\": \"Navigation\",\n visible,\n onRequestClose: hideTemporaryNav,\n },\n navToggleProps: {\n \"aria-label\": \"Navigation\",\n buttonType: \"icon\",\n children: menuIcon,\n onClick() {\n showTemporaryNav();\n },\n },\n };\n}\n"],"names":["useEffect","getIcon","useToggle","useTemporaryLayout","options","pathname","defaultVisible","appBarPosition","menuIcon","toggled","visible","enable","showTemporaryNav","disable","hideTemporaryNav","appBarProps","position","mainProps","appBarOffset","temporaryNavProps","onRequestClose","navToggleProps","buttonType","children","onClick"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAgC,QAAQ;AAG1D,SAASC,OAAO,QAAQ,wBAAwB;AAGhD,SAASC,SAAS,QAAQ,kBAAkB;AA2D5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDC,GACD,OAAO,SAASC,mBACdC,OAA+B;IAE/B,MAAM,EACJC,QAAQ,EACRC,iBAAiB,KAAK,EACtBC,iBAAiB,OAAO,EACzB,GAAGH;IAEJ,MAAMI,WAAWP,QAAQ;IACzB,MAAM,EACJQ,SAASC,OAAO,EAChBC,QAAQC,gBAAgB,EACxBC,SAASC,gBAAgB,EAC1B,GAAGZ,UAAUI;IAEd,oDAAoD;IACpDN,UAAU;QACR,IAAIK,aAAa,MAAM;YACrBS;QACF;IACF,GAAG;QAACA;QAAkBT;KAAS;IAE/B,OAAO;QACLK;QACAE;QACAE;QACAC,aAAa;YACXC,UAAUT;QACZ;QACAU,WAAW;YACTC,cAAcX,mBAAmB;QACnC;QACAY,mBAAmB;YACjB,cAAc;YACdT;YACAU,gBAAgBN;QAClB;QACAO,gBAAgB;YACd,cAAc;YACdC,YAAY;YACZC,UAAUf;YACVgB;gBACEZ;YACF;QACF;IACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/link/SkipToMainContent.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useEffect, useRef, type ReactNode } from \"react\";\nimport { Link, type LinkProps } from \"./Link.js\";\nimport {\n skipToMainContent,\n type SkipToMainContentClassNameOptions,\n} from \"./styles.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst getMainElement = (mainId: string): HTMLElement | null =>\n mainId\n ? document.getElementById(mainId)\n : document.querySelector<HTMLElement>('main,[role=\"main\"]');\n\n/**\n * @since 6.0.0 The `mainId` is optional\n */\nexport interface SkipToMainContentProps\n extends Omit<LinkProps, \"href\">,\n SkipToMainContentClassNameOptions {\n /**\n * @since 6.0.0 Changed default value from `\"skip-to-main-content\"`\n * @defaultValue `\"skip-to-main\"`\n */\n id?: string;\n\n /**\n * An optional id for the main element. When this is not provided, the main\n * element will be found by:\n *\n * ```ts\n * document.querySelector('main,[role=\"main\"]');\n * ```\n */\n mainId?: string;\n\n /**\n * @defaultValue `\"Skip to main content\"`\n */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @since 6.0.0 Changed the default `id` from `\"skip-to-main-content\"` to\n * `\"skip-to-main\"`.\n * @since 6.0.0 The `mainId` prop is optional\n * @since 6.0.0 Throws an error after rendering if no main element can be found\n * with the provided `mainId` in development mode. The previous behavior would\n * only log an error after being clicked.\n */\nexport const SkipToMainContent = forwardRef<\n HTMLAnchorElement,\n SkipToMainContentProps\n>(function SkipToMainContent(props, ref) {\n const {\n id = \"skip-to-main\",\n className,\n children = \"Skip to main content\",\n mainId = \"\",\n onClick = noop,\n unstyled,\n ...remaining\n } = props;\n\n const mainNodeRef = useRef<HTMLElement | null>(null);\n // want to warn the developer about missing main element in development\n // immediately to help prevent errors, but in production this can be lazy\n // initialized only once a keyboard user focuses and clicks this element\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n mainNodeRef.current = getMainElement(mainId);\n\n if (!mainNodeRef.current) {\n const foundMainId = document.querySelector('main,[role=\"main\"]')?.id;\n let message = `Unable to find a main element to focus`;\n if (mainId) {\n message += ` with an id of \"${mainId}\"`;\n\n if (foundMainId) {\n message += ` but a main element was found with an id of \"${foundMainId}\".`;\n }\n }\n if (!foundMainId) {\n message +=\n '. There should be at least one <main> element or an element with role=\"main\" on the page for accessibility.';\n }\n\n throw new Error(message);\n }\n }, [mainId]);\n }\n\n return (\n <Link\n {...remaining}\n id={id}\n ref={ref}\n href={`#${mainId}`}\n onClick={(event) => {\n onClick(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n // see comment above useEffect\n mainNodeRef.current ||= getMainElement(mainId);\n mainNodeRef.current?.focus();\n }}\n className={skipToMainContent({\n unstyled,\n className,\n })}\n >\n {children}\n </Link>\n );\n});\n"],"names":["forwardRef","useEffect","useRef","Link","skipToMainContent","noop","getMainElement","mainId","document","getElementById","querySelector","SkipToMainContent","props","ref","id","className","children","onClick","unstyled","remaining","mainNodeRef","process","env","NODE_ENV","current","foundMainId","message","Error","href","event","isPropagationStopped","preventDefault","stopPropagation","focus"],"mappings":"AAAA;;AACA,SAASA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAwB,QAAQ;AACtE,SAASC,IAAI,QAAwB,YAAY;AACjD,SACEC,iBAAiB,QAEZ,cAAc;AAErB,MAAMC,OAAO;AACX,aAAa;AACf;AAEA,MAAMC,iBAAiB,CAACC,SACtBA,SACIC,SAASC,cAAc,CAACF,UACxBC,SAASE,aAAa,CAAc;AA8B1C;;;;;;;;;CASC,GACD,OAAO,MAAMC,kCAAoBX,WAG/B,SAASW,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EACJC,KAAK,cAAc,EACnBC,SAAS,EACTC,WAAW,sBAAsB,EACjCT,SAAS,EAAE,EACXU,UAAUZ,IAAI,EACda,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,cAAclB,OAA2B;IAC/C,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxE,IAAImB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sDAAsD;QACtDtB,UAAU;YACRmB,YAAYI,OAAO,GAAGlB,eAAeC;YAErC,IAAI,CAACa,YAAYI,OAAO,EAAE;gBACxB,MAAMC,cAAcjB,SAASE,aAAa,CAAC,uBAAuBI;gBAClE,IAAIY,UAAU,CAAC,sCAAsC,CAAC;gBACtD,IAAInB,QAAQ;oBACVmB,WAAW,CAAC,gBAAgB,EAAEnB,OAAO,CAAC,CAAC;oBAEvC,IAAIkB,aAAa;wBACfC,WAAW,CAAC,6CAA6C,EAAED,YAAY,EAAE,CAAC;oBAC5E;gBACF;gBACA,IAAI,CAACA,aAAa;oBAChBC,WACE;gBACJ;gBAEA,MAAM,IAAIC,MAAMD;YAClB;QACF,GAAG;YAACnB;SAAO;IACb;IAEA,qBACE,KAACJ;QACE,GAAGgB,SAAS;QACbL,IAAIA;QACJD,KAAKA;QACLe,MAAM,CAAC,CAAC,EAAErB,
|
|
1
|
+
{"version":3,"sources":["../../src/link/SkipToMainContent.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, useEffect, useRef, type ReactNode } from \"react\";\nimport { Link, type LinkProps } from \"./Link.js\";\nimport {\n skipToMainContent,\n type SkipToMainContentClassNameOptions,\n} from \"./styles.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\nconst getMainElement = (mainId: string): HTMLElement | null =>\n mainId\n ? document.getElementById(mainId)\n : document.querySelector<HTMLElement>('main,[role=\"main\"]');\n\n/**\n * @since 6.0.0 The `mainId` is optional\n */\nexport interface SkipToMainContentProps\n extends Omit<LinkProps, \"href\">,\n SkipToMainContentClassNameOptions {\n /**\n * @since 6.0.0 Changed default value from `\"skip-to-main-content\"`\n * @defaultValue `\"skip-to-main\"`\n */\n id?: string;\n\n /**\n * An optional id for the main element. When this is not provided, the main\n * element will be found by:\n *\n * ```ts\n * document.querySelector('main,[role=\"main\"]');\n * ```\n */\n mainId?: string;\n\n /**\n * @defaultValue `\"Skip to main content\"`\n */\n children?: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * @since 6.0.0 Changed the default `id` from `\"skip-to-main-content\"` to\n * `\"skip-to-main\"`.\n * @since 6.0.0 The `mainId` prop is optional\n * @since 6.0.0 Throws an error after rendering if no main element can be found\n * with the provided `mainId` in development mode. The previous behavior would\n * only log an error after being clicked.\n */\nexport const SkipToMainContent = forwardRef<\n HTMLAnchorElement,\n SkipToMainContentProps\n>(function SkipToMainContent(props, ref) {\n const {\n id = \"skip-to-main\",\n className,\n children = \"Skip to main content\",\n mainId = \"\",\n onClick = noop,\n unstyled,\n ...remaining\n } = props;\n\n const mainNodeRef = useRef<HTMLElement | null>(null);\n // want to warn the developer about missing main element in development\n // immediately to help prevent errors, but in production this can be lazy\n // initialized only once a keyboard user focuses and clicks this element\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n useEffect(() => {\n mainNodeRef.current = getMainElement(mainId);\n\n if (!mainNodeRef.current) {\n const foundMainId = document.querySelector('main,[role=\"main\"]')?.id;\n let message = `Unable to find a main element to focus`;\n if (mainId) {\n message += ` with an id of \"${mainId}\"`;\n\n if (foundMainId) {\n message += ` but a main element was found with an id of \"${foundMainId}\".`;\n }\n }\n if (!foundMainId) {\n message +=\n '. There should be at least one <main> element or an element with role=\"main\" on the page for accessibility.';\n }\n\n throw new Error(message);\n }\n }, [mainId]);\n }\n\n return (\n <Link\n {...remaining}\n id={id}\n ref={ref}\n href={`#${mainId}`}\n onClick={(event) => {\n onClick(event);\n if (event.isPropagationStopped()) {\n return;\n }\n\n event.preventDefault();\n event.stopPropagation();\n\n // see comment above useEffect\n mainNodeRef.current ||= getMainElement(mainId);\n mainNodeRef.current?.focus();\n }}\n className={skipToMainContent({\n unstyled,\n className,\n })}\n >\n {children}\n </Link>\n );\n});\n"],"names":["forwardRef","useEffect","useRef","Link","skipToMainContent","noop","getMainElement","mainId","document","getElementById","querySelector","SkipToMainContent","props","ref","id","className","children","onClick","unstyled","remaining","mainNodeRef","process","env","NODE_ENV","current","foundMainId","message","Error","href","event","isPropagationStopped","preventDefault","stopPropagation","focus"],"mappings":"AAAA;;AACA,SAASA,UAAU,EAAEC,SAAS,EAAEC,MAAM,QAAwB,QAAQ;AACtE,SAASC,IAAI,QAAwB,YAAY;AACjD,SACEC,iBAAiB,QAEZ,cAAc;AAErB,MAAMC,OAAO;AACX,aAAa;AACf;AAEA,MAAMC,iBAAiB,CAACC,SACtBA,SACIC,SAASC,cAAc,CAACF,UACxBC,SAASE,aAAa,CAAc;AA8B1C;;;;;;;;;CASC,GACD,OAAO,MAAMC,kCAAoBX,WAG/B,SAASW,kBAAkBC,KAAK,EAAEC,GAAG;IACrC,MAAM,EACJC,KAAK,cAAc,EACnBC,SAAS,EACTC,WAAW,sBAAsB,EACjCT,SAAS,EAAE,EACXU,UAAUZ,IAAI,EACda,QAAQ,EACR,GAAGC,WACJ,GAAGP;IAEJ,MAAMQ,cAAclB,OAA2B;IAC/C,uEAAuE;IACvE,yEAAyE;IACzE,wEAAwE;IACxE,IAAImB,QAAQC,GAAG,CAACC,QAAQ,KAAK,cAAc;QACzC,sDAAsD;QACtDtB,UAAU;YACRmB,YAAYI,OAAO,GAAGlB,eAAeC;YAErC,IAAI,CAACa,YAAYI,OAAO,EAAE;gBACxB,MAAMC,cAAcjB,SAASE,aAAa,CAAC,uBAAuBI;gBAClE,IAAIY,UAAU,CAAC,sCAAsC,CAAC;gBACtD,IAAInB,QAAQ;oBACVmB,WAAW,CAAC,gBAAgB,EAAEnB,OAAO,CAAC,CAAC;oBAEvC,IAAIkB,aAAa;wBACfC,WAAW,CAAC,6CAA6C,EAAED,YAAY,EAAE,CAAC;oBAC5E;gBACF;gBACA,IAAI,CAACA,aAAa;oBAChBC,WACE;gBACJ;gBAEA,MAAM,IAAIC,MAAMD;YAClB;QACF,GAAG;YAACnB;SAAO;IACb;IAEA,qBACE,KAACJ;QACE,GAAGgB,SAAS;QACbL,IAAIA;QACJD,KAAKA;QACLe,MAAM,CAAC,CAAC,EAAErB,QAAQ;QAClBU,SAAS,CAACY;YACRZ,QAAQY;YACR,IAAIA,MAAMC,oBAAoB,IAAI;gBAChC;YACF;YAEAD,MAAME,cAAc;YACpBF,MAAMG,eAAe;YAErB,8BAA8B;YAC9BZ,YAAYI,OAAO,KAAKlB,eAAeC;YACvCa,YAAYI,OAAO,EAAES;QACvB;QACAlB,WAAWX,kBAAkB;YAC3Bc;YACAH;QACF;kBAECC;;AAGP,GAAG"}
|
package/dist/list/ListItem.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { type HTMLAttributes } from "react";
|
|
2
|
+
import { type ComponentWithRippleProps } from "../interaction/types.js";
|
|
2
3
|
import { type ListItemChildrenProps, type ListItemHeight } from "./types.js";
|
|
3
4
|
/**
|
|
4
5
|
* @since 6.0.0 Renamed `threeLines` to `multiline` since it can
|
|
5
6
|
* support more than three lines of text.
|
|
6
7
|
*/
|
|
7
|
-
export interface ListItemProps extends HTMLAttributes<HTMLLIElement>, ListItemChildrenProps {
|
|
8
|
+
export interface ListItemProps extends HTMLAttributes<HTMLLIElement>, ListItemChildrenProps, ComponentWithRippleProps {
|
|
8
9
|
/**
|
|
9
10
|
* @defaultValue `"button"`
|
|
10
11
|
*/
|
package/dist/list/ListItem.js
CHANGED
|
@@ -69,12 +69,13 @@ import { listItem } from "./listItemStyles.js";
|
|
|
69
69
|
* }
|
|
70
70
|
* ```
|
|
71
71
|
*/ export const ListItem = /*#__PURE__*/ forwardRef(function ListItem(props, ref) {
|
|
72
|
-
const { className, textProps, textClassName, secondaryTextClassName, primaryText, secondaryText, secondaryTextProps, disableTextChildren = false, height: propHeight, leftAddon, leftAddonType, leftAddonPosition, leftAddonClassName, leftAddonForceWrap, rightAddon, rightAddonType, rightAddonPosition, rightAddonClassName, rightAddonForceWrap, disableLeftAddonSpacing, disableLeftAddonCenteredMedia, disableRightAddonCenteredMedia, multiline = false, disabled = false, disabledOpacity = false, role = "button", onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseUp, onMouseLeave, onDragStart, onTouchStart, onTouchEnd, onTouchMove, tabIndex: propTabIndex, children: propChildren, presentational = role === "presentation", ...remaining } = props;
|
|
72
|
+
const { className, textProps, textClassName, secondaryTextClassName, primaryText, secondaryText, secondaryTextProps, disableTextChildren = false, height: propHeight, leftAddon, leftAddonType, leftAddonPosition, leftAddonClassName, leftAddonForceWrap, rightAddon, rightAddonType, rightAddonPosition, rightAddonClassName, rightAddonForceWrap, disableLeftAddonSpacing, disableLeftAddonCenteredMedia, disableRightAddonCenteredMedia, multiline = false, disabled = false, disableRipple, disabledOpacity = false, role = "button", onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseUp, onMouseLeave, onDragStart, onTouchStart, onTouchEnd, onTouchMove, tabIndex: propTabIndex, children: propChildren, presentational = role === "presentation", ...remaining } = props;
|
|
73
73
|
let tabIndex = propTabIndex;
|
|
74
74
|
if (!presentational && typeof tabIndex === "undefined") {
|
|
75
75
|
tabIndex = disabled ? -1 : 0;
|
|
76
76
|
}
|
|
77
77
|
const { pressedClassName, ripples, handlers } = useElementInteraction({
|
|
78
|
+
mode: disableRipple ? "none" : undefined,
|
|
78
79
|
onBlur,
|
|
79
80
|
onClick,
|
|
80
81
|
onKeyDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/list/ListItem.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { listItem } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps, type ListItemHeight } from \"./types.js\";\n\n/**\n * @since 6.0.0 Renamed `threeLines` to `multiline` since it can\n * support more than three lines of text.\n */\nexport interface ListItemProps\n extends HTMLAttributes<HTMLLIElement>,\n ListItemChildrenProps {\n /**\n * @defaultValue `\"button\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @defaultValue `disabled ? -1 : 0`\n */\n tabIndex?: number;\n\n /**\n * @see {@link ListItemHeight}\n * @defaultValue `\"auto\"`\n */\n height?: ListItemHeight;\n\n /**\n * @defaultValue `false`\n */\n multiline?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Note: This does nothing if the `disabled` prop is not enabled.\n *\n * @defaultValue `false`\n * @since 2.4.3\n */\n disabledOpacity?: boolean;\n\n /**\n * Set this to `false` if the list item should not gain the interaction\n * states: hover, focus, press, etc. This is kind of like being disabled\n * without the disabled styles being applied.\n *\n * @defaultValue `role === \"presentation\"`\n */\n presentational?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItem` is used to create a clickable/focusable button within a\n * `List` and removes the normal `<li>` styles.\n *\n * @example Simple Example\n * ```tsx\n * import { List, ListItem } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 1\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * secondaryText={<span>Some <strong>additional</strong> content.</span>}\n * >\n * Item 2\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n *\n * @example Applying Addons Example\n * ```tsx\n * import { List, ListItem } from \"@react-md/core\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem leftAddon={<FavoriteIcon />}>\n * Item 1\n * </ListItem>\n * <ListItem rightAddon={<FavoriteIcon />}>\n * Item 2\n * </ListItem>\n * <ListItem\n * leftAddon={<FavoriteIcon />}\n * rightAddon={<img alt=\"\" src=\"/some-image.png\" />}\n * rightAddonType=\"media\"\n * >\n * Item 3\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n */\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(\n function ListItem(props, ref) {\n const {\n className,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType,\n leftAddonPosition,\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType,\n rightAddonPosition,\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonSpacing,\n disableLeftAddonCenteredMedia,\n disableRightAddonCenteredMedia,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n role = \"button\",\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n tabIndex: propTabIndex,\n children: propChildren,\n presentational = role === \"presentation\",\n ...remaining\n } = props;\n\n let tabIndex = propTabIndex;\n if (!presentational && typeof tabIndex === \"undefined\") {\n tabIndex = disabled ? -1 : 0;\n }\n\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled: disabled || presentational,\n });\n const children = useHigherContrastChildren(\n propChildren,\n !disableTextChildren\n );\n\n const height = getListItemHeight({\n height: propHeight,\n leftAddon,\n leftAddonType,\n rightAddon,\n rightAddonType,\n secondaryText,\n });\n\n return (\n <li\n {...remaining}\n {...handlers}\n aria-disabled={disabled || undefined}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={listItem({\n className,\n height,\n disabled,\n disabledOpacity,\n multiline,\n clickable: !presentational,\n pressedClassName,\n })}\n >\n <ListItemChildren\n multiline={multiline}\n textClassName={textClassName}\n secondaryTextClassName={secondaryTextClassName}\n disableTextChildren={disableTextChildren}\n primaryText={primaryText}\n textProps={textProps}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n leftAddon={leftAddon}\n leftAddonType={leftAddonType}\n leftAddonPosition={leftAddonPosition}\n leftAddonClassName={leftAddonClassName}\n leftAddonForceWrap={leftAddonForceWrap}\n rightAddon={rightAddon}\n rightAddonType={rightAddonType}\n rightAddonPosition={rightAddonPosition}\n rightAddonClassName={rightAddonClassName}\n rightAddonForceWrap={rightAddonForceWrap}\n disableLeftAddonSpacing={disableLeftAddonSpacing}\n disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","getListItemHeight","ListItemChildren","listItem","ListItem","props","ref","className","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonSpacing","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disabledOpacity","role","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","tabIndex","propTabIndex","children","propChildren","presentational","remaining","pressedClassName","ripples","handlers","li","aria-disabled","
|
|
1
|
+
{"version":3,"sources":["../../src/list/ListItem.tsx"],"sourcesContent":["\"use client\";\nimport { forwardRef, type HTMLAttributes } from \"react\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { listItem } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps, type ListItemHeight } from \"./types.js\";\n\n/**\n * @since 6.0.0 Renamed `threeLines` to `multiline` since it can\n * support more than three lines of text.\n */\nexport interface ListItemProps\n extends HTMLAttributes<HTMLLIElement>,\n ListItemChildrenProps,\n ComponentWithRippleProps {\n /**\n * @defaultValue `\"button\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @defaultValue `disabled ? -1 : 0`\n */\n tabIndex?: number;\n\n /**\n * @see {@link ListItemHeight}\n * @defaultValue `\"auto\"`\n */\n height?: ListItemHeight;\n\n /**\n * @defaultValue `false`\n */\n multiline?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disabled?: boolean;\n\n /**\n * Note: This does nothing if the `disabled` prop is not enabled.\n *\n * @defaultValue `false`\n * @since 2.4.3\n */\n disabledOpacity?: boolean;\n\n /**\n * Set this to `false` if the list item should not gain the interaction\n * states: hover, focus, press, etc. This is kind of like being disabled\n * without the disabled styles being applied.\n *\n * @defaultValue `role === \"presentation\"`\n */\n presentational?: boolean;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItem` is used to create a clickable/focusable button within a\n * `List` and removes the normal `<li>` styles.\n *\n * @example Simple Example\n * ```tsx\n * import { List, ListItem } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * >\n * Item 1\n * </ListItem>\n * <ListItem\n * onClick={() => {\n * // do something\n * }}\n * secondaryText={<span>Some <strong>additional</strong> content.</span>}\n * >\n * Item 2\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n *\n * @example Applying Addons Example\n * ```tsx\n * import { List, ListItem } from \"@react-md/core\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <List>\n * <ListItem leftAddon={<FavoriteIcon />}>\n * Item 1\n * </ListItem>\n * <ListItem rightAddon={<FavoriteIcon />}>\n * Item 2\n * </ListItem>\n * <ListItem\n * leftAddon={<FavoriteIcon />}\n * rightAddon={<img alt=\"\" src=\"/some-image.png\" />}\n * rightAddonType=\"media\"\n * >\n * Item 3\n * </ListItem>\n * </List>\n * );\n * );\n * }\n * ```\n */\nexport const ListItem = forwardRef<HTMLLIElement, ListItemProps>(\n function ListItem(props, ref) {\n const {\n className,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType,\n leftAddonPosition,\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType,\n rightAddonPosition,\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonSpacing,\n disableLeftAddonCenteredMedia,\n disableRightAddonCenteredMedia,\n multiline = false,\n disabled = false,\n disableRipple,\n disabledOpacity = false,\n role = \"button\",\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n tabIndex: propTabIndex,\n children: propChildren,\n presentational = role === \"presentation\",\n ...remaining\n } = props;\n\n let tabIndex = propTabIndex;\n if (!presentational && typeof tabIndex === \"undefined\") {\n tabIndex = disabled ? -1 : 0;\n }\n\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled: disabled || presentational,\n });\n const children = useHigherContrastChildren(\n propChildren,\n !disableTextChildren\n );\n\n const height = getListItemHeight({\n height: propHeight,\n leftAddon,\n leftAddonType,\n rightAddon,\n rightAddonType,\n secondaryText,\n });\n\n return (\n <li\n {...remaining}\n {...handlers}\n aria-disabled={disabled || undefined}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={listItem({\n className,\n height,\n disabled,\n disabledOpacity,\n multiline,\n clickable: !presentational,\n pressedClassName,\n })}\n >\n <ListItemChildren\n multiline={multiline}\n textClassName={textClassName}\n secondaryTextClassName={secondaryTextClassName}\n disableTextChildren={disableTextChildren}\n primaryText={primaryText}\n textProps={textProps}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n leftAddon={leftAddon}\n leftAddonType={leftAddonType}\n leftAddonPosition={leftAddonPosition}\n leftAddonClassName={leftAddonClassName}\n leftAddonForceWrap={leftAddonForceWrap}\n rightAddon={rightAddon}\n rightAddonType={rightAddonType}\n rightAddonPosition={rightAddonPosition}\n rightAddonClassName={rightAddonClassName}\n rightAddonForceWrap={rightAddonForceWrap}\n disableLeftAddonSpacing={disableLeftAddonSpacing}\n disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","getListItemHeight","ListItemChildren","listItem","ListItem","props","ref","className","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonSpacing","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disableRipple","disabledOpacity","role","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","tabIndex","propTabIndex","children","propChildren","presentational","remaining","pressedClassName","ripples","handlers","mode","undefined","li","aria-disabled","clickable"],"mappings":"AAAA;;AACA,SAASA,UAAU,QAA6B,QAAQ;AAExD,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AACxF,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,QAAQ,QAAQ,sBAAsB;AAuD/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8DC,GACD,OAAO,MAAMC,yBAAWN,WACtB,SAASM,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,sBAAsB,KAAK,EAC3BC,QAAQC,UAAU,EAClBC,SAAS,EACTC,aAAa,EACbC,iBAAiB,EACjBC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,cAAc,EACdC,kBAAkB,EAClBC,mBAAmB,EACnBC,mBAAmB,EACnBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,8BAA8B,EAC9BC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,aAAa,EACbC,kBAAkB,KAAK,EACvBC,OAAO,QAAQ,EACfC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,UAAUC,YAAY,EACtBC,UAAUC,YAAY,EACtBC,iBAAiBhB,SAAS,cAAc,EACxC,GAAGiB,WACJ,GAAG9C;IAEJ,IAAIyC,WAAWC;IACf,IAAI,CAACG,kBAAkB,OAAOJ,aAAa,aAAa;QACtDA,WAAWf,WAAW,CAAC,IAAI;IAC7B;IAEA,MAAM,EAAEqB,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAGvD,sBAAsB;QACpEwD,MAAMvB,gBAAgB,SAASwB;QAC/BrB;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAd,UAAUA,YAAYmB;IACxB;IACA,MAAMF,WAAWhD,0BACfiD,cACA,CAACnC;IAGH,MAAMC,SAASd,kBAAkB;QAC/Bc,QAAQC;QACRC;QACAC;QACAI;QACAC;QACAX;IACF;IAEA,qBACE,MAAC6C;QACE,GAAGN,SAAS;QACZ,GAAGG,QAAQ;QACZI,iBAAe3B,YAAYyB;QAC3BlD,KAAKA;QACL4B,MAAMA;QACNY,UAAUA;QACVvC,WAAWJ,SAAS;YAClBI;YACAQ;YACAgB;YACAE;YACAH;YACA6B,WAAW,CAACT;YACZE;QACF;;0BAEA,KAAClD;gBACC4B,WAAWA;gBACXrB,eAAeA;gBACfC,wBAAwBA;gBACxBI,qBAAqBA;gBACrBH,aAAaA;gBACbH,WAAWA;gBACXI,eAAeA;gBACfC,oBAAoBA;gBACpBI,WAAWA;gBACXC,eAAeA;gBACfC,mBAAmBA;gBACnBC,oBAAoBA;gBACpBC,oBAAoBA;gBACpBC,YAAYA;gBACZC,gBAAgBA;gBAChBC,oBAAoBA;gBACpBC,qBAAqBA;gBACrBC,qBAAqBA;gBACrBC,yBAAyBA;gBACzBC,+BAA+BA;gBAC/BC,gCAAgCA;0BAE/BmB;;YAEFK;;;AAGP,GACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/list/ListItemChildren.tsx"],"sourcesContent":["import { type ReactElement } from \"react\";\nimport { ListItemAddon } from \"./ListItemAddon.js\";\nimport { ListItemText } from \"./ListItemText.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\n/**\n * The `ListItemChildren` component is used to create a styled list item that\n * can have optional addons to the left or right of the children in the form of\n * icons, avatars, or media. The `children` can be replaced by the `primaryText`\n * and `secondaryText` props to create stacked text spanning two or more lines\n * with the default behavior of using `line-clamp` at three lines.\n *\n * Note: This will return a `React.Fragment` of the children and does not wrap\n * in a DOM node for styling. The parent component should normally have\n * `display: flex` for the styling to work.\n *\n * @example Custom Component Usage\n * ```tsx\n * import { ListItemChildren } from \"@react-md/core\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <div style={{ display: \"flex\" }}>\n * <ListItemChildren\n * leftAddon={<FavoriteIcon />}\n * rightAddon={<img alt=\"\" src=\"/some-image.png\" />}\n * rightAddonType=\"media\"\n * secondaryText={<span>Some <strong>additional</strong> content.</span>}\n * >\n * Content\n * </ListItemChildren>\n * </div>\n * );\n * }\n * ```\n */\nexport function ListItemChildren(props: ListItemChildrenProps): ReactElement {\n const {\n multiline,\n textProps,\n textClassName,\n secondaryTextClassName,\n disableTextChildren,\n primaryText,\n secondaryText,\n secondaryTextProps,\n leftAddon,\n leftAddonType = \"icon\",\n leftAddonPosition = \"middle\",\n leftAddonClassName,\n leftAddonForceWrap,\n disableLeftAddonSpacing,\n disableLeftAddonCenteredMedia,\n rightAddon,\n rightAddonType = \"icon\",\n rightAddonPosition = \"middle\",\n rightAddonClassName,\n rightAddonForceWrap,\n disableRightAddonCenteredMedia,\n children: propChildren,\n } = props;\n\n const stringifiedChildren =\n typeof propChildren === \"number\" ? `${propChildren}` : propChildren;\n\n let children = stringifiedChildren;\n if (primaryText || secondaryText || !disableTextChildren) {\n children = (\n <ListItemText\n {...textProps}\n className={textClassName}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n secondaryTextClamped={multiline}\n secondaryTextClassName={secondaryTextClassName}\n >\n {(!disableTextChildren && children) || primaryText}\n </ListItemText>\n );\n }\n\n children = (\n <ListItemAddon\n addon={leftAddon}\n type={leftAddonType}\n position={leftAddonPosition}\n className={leftAddonClassName}\n forceAddonWrap={leftAddonForceWrap}\n disableBeforeSpacing={disableLeftAddonSpacing}\n disableCenteredMedia={disableLeftAddonCenteredMedia}\n >\n {children}\n </ListItemAddon>\n );\n children = (\n <ListItemAddon\n addon={rightAddon}\n addonAfter\n type={rightAddonType}\n position={rightAddonPosition}\n className={rightAddonClassName}\n forceAddonWrap={rightAddonForceWrap}\n disableCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemAddon>\n );\n\n return (\n <>\n {children}\n {(primaryText && stringifiedChildren) || null}\n </>\n );\n}\n"],"names":["ListItemAddon","ListItemText","ListItemChildren","props","multiline","textProps","textClassName","secondaryTextClassName","disableTextChildren","primaryText","secondaryText","secondaryTextProps","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","disableLeftAddonSpacing","disableLeftAddonCenteredMedia","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableRightAddonCenteredMedia","children","propChildren","stringifiedChildren","className","secondaryTextClamped","addon","type","position","forceAddonWrap","disableBeforeSpacing","disableCenteredMedia","addonAfter"],"mappings":";AACA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,YAAY,QAAQ,oBAAoB;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,oBAAoB,QAAQ,EAC5BC,kBAAkB,EAClBC,kBAAkB,EAClBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,qBAAqB,QAAQ,EAC7BC,mBAAmB,EACnBC,mBAAmB,EACnBC,8BAA8B,EAC9BC,UAAUC,YAAY,EACvB,GAAGvB;IAEJ,MAAMwB,sBACJ,OAAOD,iBAAiB,WAAW,
|
|
1
|
+
{"version":3,"sources":["../../src/list/ListItemChildren.tsx"],"sourcesContent":["import { type ReactElement } from \"react\";\nimport { ListItemAddon } from \"./ListItemAddon.js\";\nimport { ListItemText } from \"./ListItemText.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\n/**\n * The `ListItemChildren` component is used to create a styled list item that\n * can have optional addons to the left or right of the children in the form of\n * icons, avatars, or media. The `children` can be replaced by the `primaryText`\n * and `secondaryText` props to create stacked text spanning two or more lines\n * with the default behavior of using `line-clamp` at three lines.\n *\n * Note: This will return a `React.Fragment` of the children and does not wrap\n * in a DOM node for styling. The parent component should normally have\n * `display: flex` for the styling to work.\n *\n * @example Custom Component Usage\n * ```tsx\n * import { ListItemChildren } from \"@react-md/core\";\n * import FavoriteIcon from \"@react-md/material-icons/FavoriteIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <div style={{ display: \"flex\" }}>\n * <ListItemChildren\n * leftAddon={<FavoriteIcon />}\n * rightAddon={<img alt=\"\" src=\"/some-image.png\" />}\n * rightAddonType=\"media\"\n * secondaryText={<span>Some <strong>additional</strong> content.</span>}\n * >\n * Content\n * </ListItemChildren>\n * </div>\n * );\n * }\n * ```\n */\nexport function ListItemChildren(props: ListItemChildrenProps): ReactElement {\n const {\n multiline,\n textProps,\n textClassName,\n secondaryTextClassName,\n disableTextChildren,\n primaryText,\n secondaryText,\n secondaryTextProps,\n leftAddon,\n leftAddonType = \"icon\",\n leftAddonPosition = \"middle\",\n leftAddonClassName,\n leftAddonForceWrap,\n disableLeftAddonSpacing,\n disableLeftAddonCenteredMedia,\n rightAddon,\n rightAddonType = \"icon\",\n rightAddonPosition = \"middle\",\n rightAddonClassName,\n rightAddonForceWrap,\n disableRightAddonCenteredMedia,\n children: propChildren,\n } = props;\n\n const stringifiedChildren =\n typeof propChildren === \"number\" ? `${propChildren}` : propChildren;\n\n let children = stringifiedChildren;\n if (primaryText || secondaryText || !disableTextChildren) {\n children = (\n <ListItemText\n {...textProps}\n className={textClassName}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n secondaryTextClamped={multiline}\n secondaryTextClassName={secondaryTextClassName}\n >\n {(!disableTextChildren && children) || primaryText}\n </ListItemText>\n );\n }\n\n children = (\n <ListItemAddon\n addon={leftAddon}\n type={leftAddonType}\n position={leftAddonPosition}\n className={leftAddonClassName}\n forceAddonWrap={leftAddonForceWrap}\n disableBeforeSpacing={disableLeftAddonSpacing}\n disableCenteredMedia={disableLeftAddonCenteredMedia}\n >\n {children}\n </ListItemAddon>\n );\n children = (\n <ListItemAddon\n addon={rightAddon}\n addonAfter\n type={rightAddonType}\n position={rightAddonPosition}\n className={rightAddonClassName}\n forceAddonWrap={rightAddonForceWrap}\n disableCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemAddon>\n );\n\n return (\n <>\n {children}\n {(primaryText && stringifiedChildren) || null}\n </>\n );\n}\n"],"names":["ListItemAddon","ListItemText","ListItemChildren","props","multiline","textProps","textClassName","secondaryTextClassName","disableTextChildren","primaryText","secondaryText","secondaryTextProps","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","disableLeftAddonSpacing","disableLeftAddonCenteredMedia","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableRightAddonCenteredMedia","children","propChildren","stringifiedChildren","className","secondaryTextClamped","addon","type","position","forceAddonWrap","disableBeforeSpacing","disableCenteredMedia","addonAfter"],"mappings":";AACA,SAASA,aAAa,QAAQ,qBAAqB;AACnD,SAASC,YAAY,QAAQ,oBAAoB;AAGjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgCC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EACJC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,mBAAmB,EACnBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,oBAAoB,QAAQ,EAC5BC,kBAAkB,EAClBC,kBAAkB,EAClBC,uBAAuB,EACvBC,6BAA6B,EAC7BC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,qBAAqB,QAAQ,EAC7BC,mBAAmB,EACnBC,mBAAmB,EACnBC,8BAA8B,EAC9BC,UAAUC,YAAY,EACvB,GAAGvB;IAEJ,MAAMwB,sBACJ,OAAOD,iBAAiB,WAAW,GAAGA,cAAc,GAAGA;IAEzD,IAAID,WAAWE;IACf,IAAIlB,eAAeC,iBAAiB,CAACF,qBAAqB;QACxDiB,yBACE,KAACxB;YACE,GAAGI,SAAS;YACbuB,WAAWtB;YACXI,eAAeA;YACfC,oBAAoBA;YACpBkB,sBAAsBzB;YACtBG,wBAAwBA;sBAEvB,AAAC,CAACC,uBAAuBiB,YAAahB;;IAG7C;IAEAgB,yBACE,KAACzB;QACC8B,OAAOlB;QACPmB,MAAMlB;QACNmB,UAAUlB;QACVc,WAAWb;QACXkB,gBAAgBjB;QAChBkB,sBAAsBjB;QACtBkB,sBAAsBjB;kBAErBO;;IAGLA,yBACE,KAACzB;QACC8B,OAAOX;QACPiB,UAAU;QACVL,MAAMX;QACNY,UAAUX;QACVO,WAAWN;QACXW,gBAAgBV;QAChBY,sBAAsBX;kBAErBC;;IAIL,qBACE;;YACGA;YACChB,eAAekB,uBAAwB;;;AAG/C"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { type AnchorHTMLAttributes, type HTMLAttributes } from "react";
|
|
2
|
+
import { type ComponentWithRippleProps } from "../interaction/types.js";
|
|
2
3
|
import { type CustomLinkComponent } from "../link/Link.js";
|
|
3
4
|
import { type PropsWithRef } from "../types.js";
|
|
4
5
|
import { type ListItemClassNameOptions } from "./listItemStyles.js";
|
|
5
6
|
import { type ListItemChildrenProps } from "./types.js";
|
|
6
|
-
export interface ListItemLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>, ListItemClassNameOptions, ListItemChildrenProps {
|
|
7
|
+
export interface ListItemLinkProps extends AnchorHTMLAttributes<HTMLAnchorElement>, ListItemClassNameOptions, ListItemChildrenProps, ComponentWithRippleProps {
|
|
7
8
|
/** @defaultValue `"a"` */
|
|
8
9
|
as?: CustomLinkComponent;
|
|
9
10
|
/**
|
|
@@ -11,8 +11,9 @@ import { listItem } from "./listItemStyles.js";
|
|
|
11
11
|
*
|
|
12
12
|
* The `ListItemLink` should be used to render links within the `List` component.
|
|
13
13
|
*/ export const ListItemLink = /*#__PURE__*/ forwardRef(function ListItemLink(props, ref) {
|
|
14
|
-
const { as: Link = "a", to, href, className, liProps, textProps, textClassName, secondaryTextClassName, primaryText, secondaryText, secondaryTextProps, disableTextChildren = false, height: propHeight, leftAddon, leftAddonType = "icon", leftAddonPosition = "middle", leftAddonClassName, leftAddonForceWrap, rightAddon, rightAddonType = "icon", rightAddonPosition = "middle", rightAddonClassName, rightAddonForceWrap, disableLeftAddonCenteredMedia = false, disableRightAddonCenteredMedia = false, multiline = false, disabled = false, disabledOpacity = false, onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseUp, onMouseLeave, onDragStart, onTouchStart, onTouchEnd, onTouchMove, role, tabIndex = disabled || role === "menuitem" ? -1 : undefined, children: propChildren, ...remaining } = props;
|
|
14
|
+
const { as: Link = "a", to, href, className, liProps, textProps, textClassName, secondaryTextClassName, primaryText, secondaryText, secondaryTextProps, disableTextChildren = false, height: propHeight, leftAddon, leftAddonType = "icon", leftAddonPosition = "middle", leftAddonClassName, leftAddonForceWrap, rightAddon, rightAddonType = "icon", rightAddonPosition = "middle", rightAddonClassName, rightAddonForceWrap, disableLeftAddonCenteredMedia = false, disableRightAddonCenteredMedia = false, multiline = false, disabled = false, disabledOpacity = false, onBlur, onClick, onKeyDown, onKeyUp, onMouseDown, onMouseUp, onMouseLeave, onDragStart, onTouchStart, onTouchEnd, onTouchMove, role, tabIndex = disabled || role === "menuitem" ? -1 : undefined, children: propChildren, disableRipple, ...remaining } = props;
|
|
15
15
|
const { pressedClassName, ripples, handlers } = useElementInteraction({
|
|
16
|
+
mode: disableRipple ? "none" : undefined,
|
|
16
17
|
onBlur,
|
|
17
18
|
onClick,
|
|
18
19
|
onKeyDown,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/list/ListItemLink.tsx"],"sourcesContent":["\"use client\";\nimport {\n forwardRef,\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n} from \"react\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type CustomLinkComponent } from \"../link/Link.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { listItem, type ListItemClassNameOptions } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\nexport interface ListItemLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement>,\n ListItemClassNameOptions,\n ListItemChildrenProps {\n /** @defaultValue `\"a\"` */\n as?: CustomLinkComponent;\n\n /**\n * This should only be used if the {@link as} {@link CustomLinkComponent}\n * accepts a `to` prop instead of {@link href}.\n */\n to?: string;\n\n /**\n * The link's href. Either this or the {@link to} prop **should** be provided.\n */\n href?: string;\n\n /**\n * Any additional props to provide the wrapping `<li>` element such as\n * `style`, `className`, and `ref`.\n */\n liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>, HTMLLIElement>;\n\n /**\n * @defaultValue `disabled ? -1 : undefined`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItemLink` should be used to render links within the `List` component.\n */\nexport const ListItemLink = forwardRef<HTMLAnchorElement, ListItemLinkProps>(\n function ListItemLink(props, ref) {\n const {\n as: Link = \"a\",\n to,\n href,\n className,\n liProps,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType = \"icon\",\n leftAddonPosition = \"middle\",\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType = \"icon\",\n rightAddonPosition = \"middle\",\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonCenteredMedia = false,\n disableRightAddonCenteredMedia = false,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n role,\n tabIndex = disabled || role === \"menuitem\" ? -1 : undefined,\n children: propChildren,\n ...remaining\n } = props;\n\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n });\n const children = useHigherContrastChildren(\n propChildren,\n !disableTextChildren\n );\n\n const height = getListItemHeight({\n height: propHeight,\n leftAddon,\n leftAddonType,\n rightAddon,\n rightAddonType,\n secondaryText,\n });\n\n return (\n <li {...liProps} role=\"none\">\n <Link\n ref={ref}\n {...remaining}\n {...handlers}\n role={role}\n className={listItem({\n className,\n link: true,\n height,\n disabled,\n disabledOpacity,\n multiline,\n pressedClassName,\n })}\n // TODO: Figure out a better type for the CustomLinkComponent to fix this\n to={to as string}\n href={href as string}\n tabIndex={tabIndex}\n >\n <ListItemChildren\n multiline={multiline}\n textClassName={textClassName}\n secondaryTextClassName={secondaryTextClassName}\n disableTextChildren={disableTextChildren}\n primaryText={primaryText}\n textProps={textProps}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n leftAddon={leftAddon}\n leftAddonType={leftAddonType}\n leftAddonPosition={leftAddonPosition}\n leftAddonClassName={leftAddonClassName}\n leftAddonForceWrap={leftAddonForceWrap}\n rightAddon={rightAddon}\n rightAddonType={rightAddonType}\n rightAddonPosition={rightAddonPosition}\n rightAddonClassName={rightAddonClassName}\n rightAddonForceWrap={rightAddonForceWrap}\n disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </Link>\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","ListItemChildren","getListItemHeight","listItem","ListItemLink","props","ref","as","Link","to","href","className","liProps","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disabledOpacity","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","role","tabIndex","undefined","children","propChildren","remaining","pressedClassName","ripples","handlers","li","link"],"mappings":"AAAA;;AACA,SACEA,UAAU,QAGL,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../src/list/ListItemLink.tsx"],"sourcesContent":["\"use client\";\nimport {\n forwardRef,\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n} from \"react\";\nimport { type ComponentWithRippleProps } from \"../interaction/types.js\";\nimport { useElementInteraction } from \"../interaction/useElementInteraction.js\";\nimport { useHigherContrastChildren } from \"../interaction/useHigherContrastChildren.js\";\nimport { type CustomLinkComponent } from \"../link/Link.js\";\nimport { type PropsWithRef } from \"../types.js\";\nimport { ListItemChildren } from \"./ListItemChildren.js\";\nimport { getListItemHeight } from \"./getListItemHeight.js\";\nimport { listItem, type ListItemClassNameOptions } from \"./listItemStyles.js\";\nimport { type ListItemChildrenProps } from \"./types.js\";\n\nexport interface ListItemLinkProps\n extends AnchorHTMLAttributes<HTMLAnchorElement>,\n ListItemClassNameOptions,\n ListItemChildrenProps,\n ComponentWithRippleProps {\n /** @defaultValue `\"a\"` */\n as?: CustomLinkComponent;\n\n /**\n * This should only be used if the {@link as} {@link CustomLinkComponent}\n * accepts a `to` prop instead of {@link href}.\n */\n to?: string;\n\n /**\n * The link's href. Either this or the {@link to} prop **should** be provided.\n */\n href?: string;\n\n /**\n * Any additional props to provide the wrapping `<li>` element such as\n * `style`, `className`, and `ref`.\n */\n liProps?: PropsWithRef<HTMLAttributes<HTMLLIElement>, HTMLLIElement>;\n\n /**\n * @defaultValue `disabled ? -1 : undefined`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * The `ListItemLink` should be used to render links within the `List` component.\n */\nexport const ListItemLink = forwardRef<HTMLAnchorElement, ListItemLinkProps>(\n function ListItemLink(props, ref) {\n const {\n as: Link = \"a\",\n to,\n href,\n className,\n liProps,\n textProps,\n textClassName,\n secondaryTextClassName,\n primaryText,\n secondaryText,\n secondaryTextProps,\n disableTextChildren = false,\n height: propHeight,\n leftAddon,\n leftAddonType = \"icon\",\n leftAddonPosition = \"middle\",\n leftAddonClassName,\n leftAddonForceWrap,\n rightAddon,\n rightAddonType = \"icon\",\n rightAddonPosition = \"middle\",\n rightAddonClassName,\n rightAddonForceWrap,\n disableLeftAddonCenteredMedia = false,\n disableRightAddonCenteredMedia = false,\n multiline = false,\n disabled = false,\n disabledOpacity = false,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n role,\n tabIndex = disabled || role === \"menuitem\" ? -1 : undefined,\n children: propChildren,\n disableRipple,\n ...remaining\n } = props;\n\n const { pressedClassName, ripples, handlers } = useElementInteraction({\n mode: disableRipple ? \"none\" : undefined,\n onBlur,\n onClick,\n onKeyDown,\n onKeyUp,\n onMouseDown,\n onMouseUp,\n onMouseLeave,\n onDragStart,\n onTouchStart,\n onTouchEnd,\n onTouchMove,\n disabled,\n });\n const children = useHigherContrastChildren(\n propChildren,\n !disableTextChildren\n );\n\n const height = getListItemHeight({\n height: propHeight,\n leftAddon,\n leftAddonType,\n rightAddon,\n rightAddonType,\n secondaryText,\n });\n\n return (\n <li {...liProps} role=\"none\">\n <Link\n ref={ref}\n {...remaining}\n {...handlers}\n role={role}\n className={listItem({\n className,\n link: true,\n height,\n disabled,\n disabledOpacity,\n multiline,\n pressedClassName,\n })}\n // TODO: Figure out a better type for the CustomLinkComponent to fix this\n to={to as string}\n href={href as string}\n tabIndex={tabIndex}\n >\n <ListItemChildren\n multiline={multiline}\n textClassName={textClassName}\n secondaryTextClassName={secondaryTextClassName}\n disableTextChildren={disableTextChildren}\n primaryText={primaryText}\n textProps={textProps}\n secondaryText={secondaryText}\n secondaryTextProps={secondaryTextProps}\n leftAddon={leftAddon}\n leftAddonType={leftAddonType}\n leftAddonPosition={leftAddonPosition}\n leftAddonClassName={leftAddonClassName}\n leftAddonForceWrap={leftAddonForceWrap}\n rightAddon={rightAddon}\n rightAddonType={rightAddonType}\n rightAddonPosition={rightAddonPosition}\n rightAddonClassName={rightAddonClassName}\n rightAddonForceWrap={rightAddonForceWrap}\n disableLeftAddonCenteredMedia={disableLeftAddonCenteredMedia}\n disableRightAddonCenteredMedia={disableRightAddonCenteredMedia}\n >\n {children}\n </ListItemChildren>\n {ripples}\n </Link>\n </li>\n );\n }\n);\n"],"names":["forwardRef","useElementInteraction","useHigherContrastChildren","ListItemChildren","getListItemHeight","listItem","ListItemLink","props","ref","as","Link","to","href","className","liProps","textProps","textClassName","secondaryTextClassName","primaryText","secondaryText","secondaryTextProps","disableTextChildren","height","propHeight","leftAddon","leftAddonType","leftAddonPosition","leftAddonClassName","leftAddonForceWrap","rightAddon","rightAddonType","rightAddonPosition","rightAddonClassName","rightAddonForceWrap","disableLeftAddonCenteredMedia","disableRightAddonCenteredMedia","multiline","disabled","disabledOpacity","onBlur","onClick","onKeyDown","onKeyUp","onMouseDown","onMouseUp","onMouseLeave","onDragStart","onTouchStart","onTouchEnd","onTouchMove","role","tabIndex","undefined","children","propChildren","disableRipple","remaining","pressedClassName","ripples","handlers","mode","li","link"],"mappings":"AAAA;;AACA,SACEA,UAAU,QAGL,QAAQ;AAEf,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAGxF,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAASC,QAAQ,QAAuC,sBAAsB;AAkC9E;;;;CAIC,GACD,OAAO,MAAMC,6BAAeN,WAC1B,SAASM,aAAaC,KAAK,EAAEC,GAAG;IAC9B,MAAM,EACJC,IAAIC,OAAO,GAAG,EACdC,EAAE,EACFC,IAAI,EACJC,SAAS,EACTC,OAAO,EACPC,SAAS,EACTC,aAAa,EACbC,sBAAsB,EACtBC,WAAW,EACXC,aAAa,EACbC,kBAAkB,EAClBC,sBAAsB,KAAK,EAC3BC,QAAQC,UAAU,EAClBC,SAAS,EACTC,gBAAgB,MAAM,EACtBC,oBAAoB,QAAQ,EAC5BC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,EACVC,iBAAiB,MAAM,EACvBC,qBAAqB,QAAQ,EAC7BC,mBAAmB,EACnBC,mBAAmB,EACnBC,gCAAgC,KAAK,EACrCC,iCAAiC,KAAK,EACtCC,YAAY,KAAK,EACjBC,WAAW,KAAK,EAChBC,kBAAkB,KAAK,EACvBC,MAAM,EACNC,OAAO,EACPC,SAAS,EACTC,OAAO,EACPC,WAAW,EACXC,SAAS,EACTC,YAAY,EACZC,WAAW,EACXC,YAAY,EACZC,UAAU,EACVC,WAAW,EACXC,IAAI,EACJC,WAAWd,YAAYa,SAAS,aAAa,CAAC,IAAIE,SAAS,EAC3DC,UAAUC,YAAY,EACtBC,aAAa,EACb,GAAGC,WACJ,GAAGjD;IAEJ,MAAM,EAAEkD,gBAAgB,EAAEC,OAAO,EAAEC,QAAQ,EAAE,GAAG1D,sBAAsB;QACpE2D,MAAML,gBAAgB,SAASH;QAC/Bb;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAC;QACAZ;IACF;IACA,MAAMgB,WAAWnD,0BACfoD,cACA,CAACjC;IAGH,MAAMC,SAASlB,kBAAkB;QAC/BkB,QAAQC;QACRC;QACAC;QACAI;QACAC;QACAX;IACF;IAEA,qBACE,KAAC0C;QAAI,GAAG/C,OAAO;QAAEoC,MAAK;kBACpB,cAAA,MAACxC;YACCF,KAAKA;YACJ,GAAGgD,SAAS;YACZ,GAAGG,QAAQ;YACZT,MAAMA;YACNrC,WAAWR,SAAS;gBAClBQ;gBACAiD,MAAM;gBACNxC;gBACAe;gBACAC;gBACAF;gBACAqB;YACF;YACA,yEAAyE;YACzE9C,IAAIA;YACJC,MAAMA;YACNuC,UAAUA;;8BAEV,KAAChD;oBACCiC,WAAWA;oBACXpB,eAAeA;oBACfC,wBAAwBA;oBACxBI,qBAAqBA;oBACrBH,aAAaA;oBACbH,WAAWA;oBACXI,eAAeA;oBACfC,oBAAoBA;oBACpBI,WAAWA;oBACXC,eAAeA;oBACfC,mBAAmBA;oBACnBC,oBAAoBA;oBACpBC,oBAAoBA;oBACpBC,YAAYA;oBACZC,gBAAgBA;oBAChBC,oBAAoBA;oBACpBC,qBAAqBA;oBACrBC,qBAAqBA;oBACrBC,+BAA+BA;oBAC/BC,gCAAgCA;8BAE/BkB;;gBAEFK;;;;AAIT,GACA"}
|
package/dist/list/_list.scss
CHANGED
|
@@ -228,9 +228,6 @@ $variables: (
|
|
|
228
228
|
|
|
229
229
|
&__text {
|
|
230
230
|
@include typography.text-overflow;
|
|
231
|
-
@include utils.rtl {
|
|
232
|
-
margin-left: auto;
|
|
233
|
-
}
|
|
234
231
|
|
|
235
232
|
display: block;
|
|
236
233
|
flex-grow: 1;
|
|
@@ -250,6 +247,10 @@ $variables: (
|
|
|
250
247
|
white-space: normal;
|
|
251
248
|
}
|
|
252
249
|
}
|
|
250
|
+
|
|
251
|
+
@include utils.rtl {
|
|
252
|
+
margin-left: auto;
|
|
253
|
+
}
|
|
253
254
|
}
|
|
254
255
|
|
|
255
256
|
&__addon {
|
|
@@ -307,12 +308,12 @@ $variables: (
|
|
|
307
308
|
|
|
308
309
|
@if not $disable-subheader-inset {
|
|
309
310
|
&--inset {
|
|
311
|
+
@include use-var(padding-left, item-keyline);
|
|
312
|
+
|
|
310
313
|
@include utils.rtl {
|
|
311
314
|
@include use-var(padding-left, item-horizontal-padding);
|
|
312
315
|
@include use-var(padding-right, item-keyline);
|
|
313
316
|
}
|
|
314
|
-
|
|
315
|
-
@include use-var(padding-left, item-keyline);
|
|
316
317
|
}
|
|
317
318
|
}
|
|
318
319
|
}
|
|
@@ -4,30 +4,40 @@ $tablet-max-width: 64em !default;
|
|
|
4
4
|
$desktop-min-width: 64.0625em !default;
|
|
5
5
|
$large-desktop-min-width: 80em !default;
|
|
6
6
|
|
|
7
|
+
/// Note: This will need to be included at the end of a block with the new Sass
|
|
8
|
+
/// rules or prefix styles with `& {}`
|
|
7
9
|
@mixin phone-media {
|
|
8
10
|
@media screen and (max-width: #{$phone-max-width}) {
|
|
9
11
|
@content;
|
|
10
12
|
}
|
|
11
13
|
}
|
|
12
14
|
|
|
15
|
+
/// Note: This will need to be included at the end of a block with the new Sass
|
|
16
|
+
/// rules or prefix styles with `& {}`
|
|
13
17
|
@mixin tablet-media {
|
|
14
18
|
@media screen and (min-width: #{$tablet-min-width}) {
|
|
15
19
|
@content;
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
|
|
23
|
+
/// Note: This will need to be included at the end of a block with the new Sass
|
|
24
|
+
/// rules or prefix styles with `& {}`
|
|
19
25
|
@mixin tablet-only-media {
|
|
20
26
|
@media screen and (min-width: #{$tablet-min-width}) and (max-width: #{$tablet-max-width}) {
|
|
21
27
|
@content;
|
|
22
28
|
}
|
|
23
29
|
}
|
|
24
30
|
|
|
31
|
+
/// Note: This will need to be included at the end of a block with the new Sass
|
|
32
|
+
/// rules or prefix styles with `& {}`
|
|
25
33
|
@mixin desktop-media {
|
|
26
34
|
@media screen and (min-width: #{$desktop-min-width}) {
|
|
27
35
|
@content;
|
|
28
36
|
}
|
|
29
37
|
}
|
|
30
38
|
|
|
39
|
+
/// Note: This will need to be included at the end of a block with the new Sass
|
|
40
|
+
/// rules or prefix styles with `& {}`
|
|
31
41
|
/// Creates a media query so that screen sizes matching at least the min width
|
|
32
42
|
/// for a large desktop will gain these styles.
|
|
33
43
|
@mixin large-desktop-media {
|
|
@@ -36,6 +46,8 @@ $large-desktop-min-width: 80em !default;
|
|
|
36
46
|
}
|
|
37
47
|
}
|
|
38
48
|
|
|
49
|
+
/// Note: This will need to be included at the end of a block with the new Sass
|
|
50
|
+
/// rules or prefix styles with `& {}`
|
|
39
51
|
@mixin media($type) {
|
|
40
52
|
@if $type == phone {
|
|
41
53
|
@include phone-media {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/media-queries/appSize.ts"],"sourcesContent":["export type QuerySize = number | `${number}${string}`;\n\n/** @defaultValue `47.9375em` */\nexport const DEFAULT_PHONE_MAX_WIDTH = `${767 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `48em` */\nexport const DEFAULT_TABLET_MIN_WIDTH = `${768 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `64em` */\nexport const DEFAULT_TABLET_MAX_WIDTH = `${1024 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `64.0625em` */\nexport const DEFAULT_DESKTOP_MIN_WIDTH = `${1025 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `80em` */\nexport const DEFAULT_DESKTOP_LARGE_MIN_WIDTH = `${\n 1280 / 16\n}em` satisfies QuerySize;\n\nexport interface AppSizeQueries {\n /**\n * The max width to use for phones. This one is a max width unlike the others\n * since everything from 0 to this value will be considered a phone.\n *\n * @defaultValue `47.9375em`\n * @see {@link DEFAULT_PHONE_MAX_WIDTH}\n */\n phoneMaxWidth?: QuerySize;\n\n /**\n * The min width for a tablet device.\n *\n * @defaultValue `48em`\n * @see {@link DEFAULT_TABLET_MIN_WIDTH}\n */\n tabletMinWidth?: QuerySize;\n\n /**\n * The max width for a tablet device. This should normally be `1px` less than\n * the `desktopMinWidth`, but it can be any value if needed. The tablet has a\n * range of min to max so that you can have a bit more control.\n *\n * @defaultValue `64em`\n * @see {@link DEFAULT_TABLET_MAX_WIDTH}\n */\n tabletMaxWidth?: QuerySize;\n\n /**\n * The min width for a desktop screen.\n *\n * @defaultValue `64.0625em`\n * @see {@link DEFAULT_DESKTOP_MIN_WIDTH}\n */\n desktopMinWidth?: QuerySize;\n\n /**\n * The min width for a large (1440p, 4k, etc) desktop screen.\n *\n * @defaultValue `80em`\n * @see {@link DEFAULT_DESKTOP_LARGE_MIN_WIDTH}\n */\n desktopLargeMinWidth?: QuerySize;\n}\n\nexport const DEFAULT_APP_SIZE_QUERIES: Readonly<AppSizeQueries> = {\n phoneMaxWidth: DEFAULT_PHONE_MAX_WIDTH,\n tabletMinWidth: DEFAULT_TABLET_MIN_WIDTH,\n tabletMaxWidth: DEFAULT_TABLET_MAX_WIDTH,\n desktopMinWidth: DEFAULT_DESKTOP_MIN_WIDTH,\n desktopLargeMinWidth: DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n};\n\n/**\n * The current size for your application. This should work both server side and\n * client side, but you will have much better results client side.\n */\nexport interface AppSize {\n /**\n * Boolean if currently matching a phone by comparing the max width of the\n * device.\n */\n isPhone: boolean;\n\n /**\n * Boolean if currently matching a tablet by comparing the max width of the\n * device.\n */\n isTablet: boolean;\n\n /**\n * Boolean if currently matching a desktop screen by comparing the max width\n * of the device.\n */\n isDesktop: boolean;\n\n /**\n * Boolean if currently matching a large desktop screen by comparing the max\n * width of the device.\n */\n isLargeDesktop: boolean;\n\n /**\n * Boolean if the app is considered to be in landscape mode. This will just\n * verify that the window width is greater than the window height.\n *\n * NOTE: This might not be super accurate on Android devices since the soft\n * keyboard will change the dimensions of the viewport when it appears. It is\n * recommended to use the `useOrientation` hook as well if you'd like to get\n * the current orientation type.\n */\n isLandscape: boolean;\n}\n\nexport const DEFAULT_APP_SIZE: AppSize = {\n isPhone: false,\n isTablet: false,\n isDesktop: true,\n isLargeDesktop: false,\n isLandscape: true,\n};\n"],"names":["DEFAULT_PHONE_MAX_WIDTH","DEFAULT_TABLET_MIN_WIDTH","DEFAULT_TABLET_MAX_WIDTH","DEFAULT_DESKTOP_MIN_WIDTH","DEFAULT_DESKTOP_LARGE_MIN_WIDTH","DEFAULT_APP_SIZE_QUERIES","phoneMaxWidth","tabletMinWidth","tabletMaxWidth","desktopMinWidth","desktopLargeMinWidth","DEFAULT_APP_SIZE","isPhone","isTablet","isDesktop","isLargeDesktop","isLandscape"],"mappings":"AAEA,8BAA8B,GAC9B,OAAO,MAAMA,0BAA0B,
|
|
1
|
+
{"version":3,"sources":["../../src/media-queries/appSize.ts"],"sourcesContent":["export type QuerySize = number | `${number}${string}`;\n\n/** @defaultValue `47.9375em` */\nexport const DEFAULT_PHONE_MAX_WIDTH = `${767 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `48em` */\nexport const DEFAULT_TABLET_MIN_WIDTH = `${768 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `64em` */\nexport const DEFAULT_TABLET_MAX_WIDTH = `${1024 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `64.0625em` */\nexport const DEFAULT_DESKTOP_MIN_WIDTH = `${1025 / 16}em` satisfies QuerySize;\n\n/** @defaultValue `80em` */\nexport const DEFAULT_DESKTOP_LARGE_MIN_WIDTH = `${\n 1280 / 16\n}em` satisfies QuerySize;\n\nexport interface AppSizeQueries {\n /**\n * The max width to use for phones. This one is a max width unlike the others\n * since everything from 0 to this value will be considered a phone.\n *\n * @defaultValue `47.9375em`\n * @see {@link DEFAULT_PHONE_MAX_WIDTH}\n */\n phoneMaxWidth?: QuerySize;\n\n /**\n * The min width for a tablet device.\n *\n * @defaultValue `48em`\n * @see {@link DEFAULT_TABLET_MIN_WIDTH}\n */\n tabletMinWidth?: QuerySize;\n\n /**\n * The max width for a tablet device. This should normally be `1px` less than\n * the `desktopMinWidth`, but it can be any value if needed. The tablet has a\n * range of min to max so that you can have a bit more control.\n *\n * @defaultValue `64em`\n * @see {@link DEFAULT_TABLET_MAX_WIDTH}\n */\n tabletMaxWidth?: QuerySize;\n\n /**\n * The min width for a desktop screen.\n *\n * @defaultValue `64.0625em`\n * @see {@link DEFAULT_DESKTOP_MIN_WIDTH}\n */\n desktopMinWidth?: QuerySize;\n\n /**\n * The min width for a large (1440p, 4k, etc) desktop screen.\n *\n * @defaultValue `80em`\n * @see {@link DEFAULT_DESKTOP_LARGE_MIN_WIDTH}\n */\n desktopLargeMinWidth?: QuerySize;\n}\n\nexport const DEFAULT_APP_SIZE_QUERIES: Readonly<AppSizeQueries> = {\n phoneMaxWidth: DEFAULT_PHONE_MAX_WIDTH,\n tabletMinWidth: DEFAULT_TABLET_MIN_WIDTH,\n tabletMaxWidth: DEFAULT_TABLET_MAX_WIDTH,\n desktopMinWidth: DEFAULT_DESKTOP_MIN_WIDTH,\n desktopLargeMinWidth: DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n};\n\n/**\n * The current size for your application. This should work both server side and\n * client side, but you will have much better results client side.\n */\nexport interface AppSize {\n /**\n * Boolean if currently matching a phone by comparing the max width of the\n * device.\n */\n isPhone: boolean;\n\n /**\n * Boolean if currently matching a tablet by comparing the max width of the\n * device.\n */\n isTablet: boolean;\n\n /**\n * Boolean if currently matching a desktop screen by comparing the max width\n * of the device.\n */\n isDesktop: boolean;\n\n /**\n * Boolean if currently matching a large desktop screen by comparing the max\n * width of the device.\n */\n isLargeDesktop: boolean;\n\n /**\n * Boolean if the app is considered to be in landscape mode. This will just\n * verify that the window width is greater than the window height.\n *\n * NOTE: This might not be super accurate on Android devices since the soft\n * keyboard will change the dimensions of the viewport when it appears. It is\n * recommended to use the `useOrientation` hook as well if you'd like to get\n * the current orientation type.\n */\n isLandscape: boolean;\n}\n\nexport const DEFAULT_APP_SIZE: AppSize = {\n isPhone: false,\n isTablet: false,\n isDesktop: true,\n isLargeDesktop: false,\n isLandscape: true,\n};\n"],"names":["DEFAULT_PHONE_MAX_WIDTH","DEFAULT_TABLET_MIN_WIDTH","DEFAULT_TABLET_MAX_WIDTH","DEFAULT_DESKTOP_MIN_WIDTH","DEFAULT_DESKTOP_LARGE_MIN_WIDTH","DEFAULT_APP_SIZE_QUERIES","phoneMaxWidth","tabletMinWidth","tabletMaxWidth","desktopMinWidth","desktopLargeMinWidth","DEFAULT_APP_SIZE","isPhone","isTablet","isDesktop","isLargeDesktop","isLandscape"],"mappings":"AAEA,8BAA8B,GAC9B,OAAO,MAAMA,0BAA0B,GAAG,MAAM,GAAG,EAAE,CAAC,CAAqB;AAE3E,yBAAyB,GACzB,OAAO,MAAMC,2BAA2B,GAAG,MAAM,GAAG,EAAE,CAAC,CAAqB;AAE5E,yBAAyB,GACzB,OAAO,MAAMC,2BAA2B,GAAG,OAAO,GAAG,EAAE,CAAC,CAAqB;AAE7E,8BAA8B,GAC9B,OAAO,MAAMC,4BAA4B,GAAG,OAAO,GAAG,EAAE,CAAC,CAAqB;AAE9E,yBAAyB,GACzB,OAAO,MAAMC,kCAAkC,GAC7C,OAAO,GACR,EAAE,CAAC,CAAqB;AA+CzB,OAAO,MAAMC,2BAAqD;IAChEC,eAAeN;IACfO,gBAAgBN;IAChBO,gBAAgBN;IAChBO,iBAAiBN;IACjBO,sBAAsBN;AACxB,EAAE;AA2CF,OAAO,MAAMO,mBAA4B;IACvCC,SAAS;IACTC,UAAU;IACVC,WAAW;IACXC,gBAAgB;IAChBC,aAAa;AACf,EAAE"}
|
|
@@ -33,7 +33,9 @@ import { useSsr } from "../SsrProvider.js";
|
|
|
33
33
|
}
|
|
34
34
|
const result = window.matchMedia(query);
|
|
35
35
|
setMatches(result.matches);
|
|
36
|
-
const updater = ({ matches })=>
|
|
36
|
+
const updater = ({ matches })=>{
|
|
37
|
+
setMatches(matches);
|
|
38
|
+
};
|
|
37
39
|
result.addEventListener("change", updater);
|
|
38
40
|
return ()=>{
|
|
39
41
|
result.removeEventListener("change", updater);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/media-queries/useMediaQuery.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { useSsr } from \"../SsrProvider.js\";\n\n/**\n * @example Simple Example\n * ```tsx\n * import { useMediaQuery } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const matches = useMediaQuery(\"screen and (min-width: 768px)\");\n *\n * return <>{matches ? \"Matches\" : \"Doesn't\"}</>;\n * }\n * ```\n *\n * @param query - The media query to use\n * @param disabled - When `true`, the `window.matchMedia` API will not be\n * activated and the hook will always return `false`.\n * @returns `true` if the media query matches\n * @since 6.0.0 Removed the `defaultValue` and `checkImmediately` options.\n */\nexport function useMediaQuery(query: string, disabled = false): boolean {\n const ssr = useSsr();\n const [matches, setMatches] = useState(() => {\n if (typeof window === \"undefined\" || disabled || ssr) {\n return false;\n }\n\n return window.matchMedia(query).matches;\n });\n\n useEffect(() => {\n if (disabled || ssr) {\n return;\n }\n\n const result = window.matchMedia(query);\n setMatches(result.matches);\n\n const updater = ({ matches }: MediaQueryListEvent): void
|
|
1
|
+
{"version":3,"sources":["../../src/media-queries/useMediaQuery.ts"],"sourcesContent":["\"use client\";\nimport { useEffect, useState } from \"react\";\nimport { useSsr } from \"../SsrProvider.js\";\n\n/**\n * @example Simple Example\n * ```tsx\n * import { useMediaQuery } from \"@react-md/core\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * const matches = useMediaQuery(\"screen and (min-width: 768px)\");\n *\n * return <>{matches ? \"Matches\" : \"Doesn't\"}</>;\n * }\n * ```\n *\n * @param query - The media query to use\n * @param disabled - When `true`, the `window.matchMedia` API will not be\n * activated and the hook will always return `false`.\n * @returns `true` if the media query matches\n * @since 6.0.0 Removed the `defaultValue` and `checkImmediately` options.\n */\nexport function useMediaQuery(query: string, disabled = false): boolean {\n const ssr = useSsr();\n const [matches, setMatches] = useState(() => {\n if (typeof window === \"undefined\" || disabled || ssr) {\n return false;\n }\n\n return window.matchMedia(query).matches;\n });\n\n useEffect(() => {\n if (disabled || ssr) {\n return;\n }\n\n const result = window.matchMedia(query);\n setMatches(result.matches);\n\n const updater = ({ matches }: MediaQueryListEvent): void => {\n setMatches(matches);\n };\n\n result.addEventListener(\"change\", updater);\n return () => {\n result.removeEventListener(\"change\", updater);\n };\n }, [disabled, query, ssr]);\n\n return matches;\n}\n"],"names":["useEffect","useState","useSsr","useMediaQuery","query","disabled","ssr","matches","setMatches","window","matchMedia","result","updater","addEventListener","removeEventListener"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAC5C,SAASC,MAAM,QAAQ,oBAAoB;AAE3C;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,cAAcC,KAAa,EAAEC,WAAW,KAAK;IAC3D,MAAMC,MAAMJ;IACZ,MAAM,CAACK,SAASC,WAAW,GAAGP,SAAS;QACrC,IAAI,OAAOQ,WAAW,eAAeJ,YAAYC,KAAK;YACpD,OAAO;QACT;QAEA,OAAOG,OAAOC,UAAU,CAACN,OAAOG,OAAO;IACzC;IAEAP,UAAU;QACR,IAAIK,YAAYC,KAAK;YACnB;QACF;QAEA,MAAMK,SAASF,OAAOC,UAAU,CAACN;QACjCI,WAAWG,OAAOJ,OAAO;QAEzB,MAAMK,UAAU,CAAC,EAAEL,OAAO,EAAuB;YAC/CC,WAAWD;QACb;QAEAI,OAAOE,gBAAgB,CAAC,UAAUD;QAClC,OAAO;YACLD,OAAOG,mBAAmB,CAAC,UAAUF;QACvC;IACF,GAAG;QAACP;QAAUD;QAAOE;KAAI;IAEzB,OAAOC;AACT"}
|