@react-md/core 6.0.0 → 6.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CoreProviders.d.ts +1 -1
- package/dist/CoreProviders.js +1 -1
- package/dist/CoreProviders.js.map +1 -1
- package/dist/SsrProvider.d.ts +1 -1
- package/dist/SsrProvider.js +1 -1
- package/dist/SsrProvider.js.map +1 -1
- package/dist/autocomplete/Autocomplete.d.ts +2 -2
- package/dist/autocomplete/Autocomplete.js +1 -1
- package/dist/autocomplete/Autocomplete.js.map +1 -1
- package/dist/autocomplete/AutocompleteChip.d.ts +1 -1
- package/dist/autocomplete/AutocompleteChip.js +1 -1
- package/dist/autocomplete/AutocompleteChip.js.map +1 -1
- package/dist/autocomplete/AutocompleteCircularProgress.d.ts +1 -1
- package/dist/autocomplete/AutocompleteCircularProgress.js +1 -1
- package/dist/autocomplete/AutocompleteCircularProgress.js.map +1 -1
- package/dist/autocomplete/AutocompleteClearButton.d.ts +1 -1
- package/dist/autocomplete/AutocompleteClearButton.js +1 -1
- package/dist/autocomplete/AutocompleteClearButton.js.map +1 -1
- package/dist/autocomplete/AutocompleteDropdownButton.d.ts +1 -1
- package/dist/autocomplete/AutocompleteDropdownButton.js +1 -1
- package/dist/autocomplete/AutocompleteDropdownButton.js.map +1 -1
- package/dist/autocomplete/_autocomplete.scss +8 -5
- package/dist/autocomplete/useAutocomplete.d.ts +3 -3
- package/dist/autocomplete/useAutocomplete.js +2 -1
- package/dist/autocomplete/useAutocomplete.js.map +1 -1
- package/dist/avatar/Avatar.d.ts +1 -1
- package/dist/avatar/Avatar.js +1 -1
- package/dist/avatar/Avatar.js.map +1 -1
- package/dist/badge/Badge.d.ts +1 -1
- package/dist/badge/Badge.js +1 -1
- package/dist/badge/Badge.js.map +1 -1
- package/dist/box/Box.d.ts +1 -1
- package/dist/box/Box.js +1 -1
- package/dist/box/Box.js.map +1 -1
- package/dist/box/_box.scss +1 -1
- package/dist/button/AsyncButton.d.ts +1 -1
- package/dist/button/AsyncButton.js +1 -1
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/button/Button.d.ts +1 -1
- package/dist/button/Button.js +1 -1
- package/dist/button/Button.js.map +1 -1
- package/dist/button/ButtonUnstyled.d.ts +1 -1
- package/dist/button/ButtonUnstyled.js +1 -1
- package/dist/button/ButtonUnstyled.js.map +1 -1
- package/dist/button/TooltippedButton.d.ts +1 -1
- package/dist/button/TooltippedButton.js +1 -1
- package/dist/button/TooltippedButton.js.map +1 -1
- package/dist/card/Card.d.ts +1 -1
- package/dist/card/Card.js +1 -1
- package/dist/card/Card.js.map +1 -1
- package/dist/card/CardContent.d.ts +1 -1
- package/dist/card/CardContent.js +1 -1
- package/dist/card/CardContent.js.map +1 -1
- package/dist/card/CardFooter.d.ts +1 -1
- package/dist/card/CardFooter.js +1 -1
- package/dist/card/CardFooter.js.map +1 -1
- package/dist/card/CardHeader.d.ts +1 -1
- package/dist/card/CardHeader.js +1 -1
- package/dist/card/CardHeader.js.map +1 -1
- package/dist/card/CardSubtitle.d.ts +1 -1
- package/dist/card/CardSubtitle.js +1 -1
- package/dist/card/CardSubtitle.js.map +1 -1
- package/dist/card/CardTitle.d.ts +1 -1
- package/dist/card/CardTitle.js +1 -1
- package/dist/card/CardTitle.js.map +1 -1
- package/dist/card/ClickableCard.d.ts +1 -1
- package/dist/card/ClickableCard.js +1 -1
- package/dist/card/ClickableCard.js.map +1 -1
- package/dist/chip/Chip.d.ts +1 -1
- package/dist/chip/Chip.js +1 -1
- package/dist/chip/Chip.js.map +1 -1
- package/dist/dialog/Dialog.d.ts +1 -1
- package/dist/dialog/Dialog.js +1 -1
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/DialogContent.d.ts +1 -1
- package/dist/dialog/DialogContent.js +1 -1
- package/dist/dialog/DialogContent.js.map +1 -1
- package/dist/dialog/DialogFooter.d.ts +1 -1
- package/dist/dialog/DialogFooter.js +1 -1
- package/dist/dialog/DialogFooter.js.map +1 -1
- package/dist/dialog/DialogHeader.d.ts +1 -1
- package/dist/dialog/DialogHeader.js +1 -1
- package/dist/dialog/DialogHeader.js.map +1 -1
- package/dist/dialog/DialogTitle.d.ts +1 -1
- package/dist/dialog/DialogTitle.js +1 -1
- package/dist/dialog/DialogTitle.js.map +1 -1
- package/dist/dialog/FixedDialog.d.ts +1 -1
- package/dist/dialog/FixedDialog.js +1 -1
- package/dist/dialog/FixedDialog.js.map +1 -1
- package/dist/divider/Divider.d.ts +1 -1
- package/dist/divider/Divider.js +1 -1
- package/dist/divider/Divider.js.map +1 -1
- package/dist/draggable/useDraggable.d.ts +1 -1
- package/dist/draggable/useDraggable.js +1 -1
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/expansion-panel/ExpansionList.d.ts +1 -1
- package/dist/expansion-panel/ExpansionList.js +1 -1
- package/dist/expansion-panel/ExpansionList.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanel.d.ts +1 -1
- package/dist/expansion-panel/ExpansionPanel.js +1 -1
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.d.ts +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
- package/dist/expansion-panel/useExpansionList.d.ts +1 -1
- package/dist/expansion-panel/useExpansionList.js +1 -1
- package/dist/expansion-panel/useExpansionList.js.map +1 -1
- package/dist/expansion-panel/useExpansionPanels.d.ts +1 -1
- package/dist/expansion-panel/useExpansionPanels.js +1 -1
- package/dist/expansion-panel/useExpansionPanels.js.map +1 -1
- package/dist/files/FileInput.d.ts +1 -1
- package/dist/files/FileInput.js +1 -1
- package/dist/files/FileInput.js.map +1 -1
- package/dist/files/useFileUpload.d.ts +2 -2
- package/dist/files/useFileUpload.js +2 -2
- package/dist/files/useFileUpload.js.map +1 -1
- package/dist/form/Checkbox.d.ts +1 -1
- package/dist/form/Checkbox.js +1 -1
- package/dist/form/Checkbox.js.map +1 -1
- package/dist/form/Fieldset.d.ts +1 -1
- package/dist/form/Fieldset.js +1 -1
- package/dist/form/Fieldset.js.map +1 -1
- package/dist/form/Form.d.ts +1 -1
- package/dist/form/Form.js +1 -1
- package/dist/form/Form.js.map +1 -1
- package/dist/form/FormMessage.d.ts +1 -1
- package/dist/form/FormMessage.js +1 -1
- package/dist/form/FormMessage.js.map +1 -1
- package/dist/form/FormMessageContainer.d.ts +1 -1
- package/dist/form/FormMessageContainer.js +1 -1
- package/dist/form/FormMessageContainer.js.map +1 -1
- package/dist/form/FormMessageCounter.d.ts +2 -2
- package/dist/form/FormMessageCounter.js +2 -2
- package/dist/form/FormMessageCounter.js.map +1 -1
- package/dist/form/InputToggle.d.ts +2 -2
- package/dist/form/InputToggle.js +2 -2
- package/dist/form/InputToggle.js.map +1 -1
- package/dist/form/Label.d.ts +3 -3
- package/dist/form/Label.js +3 -3
- package/dist/form/Label.js.map +1 -1
- package/dist/form/Legend.d.ts +1 -1
- package/dist/form/Legend.js +1 -1
- package/dist/form/Legend.js.map +1 -1
- package/dist/form/NativeSelect.d.ts +1 -1
- package/dist/form/NativeSelect.js +1 -1
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/OptGroup.d.ts +1 -1
- package/dist/form/OptGroup.js +1 -1
- package/dist/form/OptGroup.js.map +1 -1
- package/dist/form/Option.d.ts +1 -1
- package/dist/form/Option.js +1 -1
- package/dist/form/Option.js.map +1 -1
- package/dist/form/Password.d.ts +1 -1
- package/dist/form/Password.js +1 -1
- package/dist/form/Password.js.map +1 -1
- package/dist/form/Radio.d.ts +1 -1
- package/dist/form/Radio.js +1 -1
- package/dist/form/Radio.js.map +1 -1
- package/dist/form/Select.d.ts +1 -1
- package/dist/form/Select.js +1 -1
- package/dist/form/Select.js.map +1 -1
- package/dist/form/Slider.d.ts +1 -1
- package/dist/form/Slider.js.map +1 -1
- package/dist/form/Switch.d.ts +1 -1
- package/dist/form/Switch.js +1 -1
- package/dist/form/Switch.js.map +1 -1
- package/dist/form/TextArea.d.ts +1 -1
- package/dist/form/TextArea.js +1 -1
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.d.ts +1 -1
- package/dist/form/TextField.js +1 -1
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/useCheckboxGroup.d.ts +8 -8
- package/dist/form/useCheckboxGroup.js +2 -2
- package/dist/form/useCheckboxGroup.js.map +1 -1
- package/dist/form/useCombobox.js +1 -0
- package/dist/form/useCombobox.js.map +1 -1
- package/dist/form/useNumberField.d.ts +2 -2
- package/dist/form/useNumberField.js +2 -2
- package/dist/form/useNumberField.js.map +1 -1
- package/dist/form/useRadioGroup.d.ts +4 -4
- package/dist/form/useRadioGroup.js +2 -2
- package/dist/form/useRadioGroup.js.map +1 -1
- package/dist/form/useRangeSlider.d.ts +1 -1
- package/dist/form/useRangeSlider.js +1 -1
- package/dist/form/useRangeSlider.js.map +1 -1
- package/dist/form/useSlider.d.ts +1 -1
- package/dist/form/useSlider.js +1 -1
- package/dist/form/useSlider.js.map +1 -1
- package/dist/form/useTextField.d.ts +4 -4
- package/dist/form/useTextField.js +2 -2
- package/dist/form/useTextField.js.map +1 -1
- package/dist/icon/FontIcon.d.ts +1 -1
- package/dist/icon/FontIcon.js +1 -1
- package/dist/icon/FontIcon.js.map +1 -1
- package/dist/icon/IconRotator.d.ts +1 -1
- package/dist/icon/IconRotator.js +1 -1
- package/dist/icon/IconRotator.js.map +1 -1
- package/dist/icon/MaterialIcon.d.ts +2 -2
- package/dist/icon/MaterialIcon.js +2 -2
- package/dist/icon/MaterialIcon.js.map +1 -1
- package/dist/icon/MaterialSymbol.d.ts +2 -2
- package/dist/icon/MaterialSymbol.js +2 -2
- package/dist/icon/MaterialSymbol.js.map +1 -1
- package/dist/icon/SVGIcon.d.ts +1 -1
- package/dist/icon/SVGIcon.js +1 -1
- package/dist/icon/SVGIcon.js.map +1 -1
- package/dist/icon/TextIconSpacing.d.ts +1 -1
- package/dist/icon/TextIconSpacing.js +1 -1
- package/dist/icon/TextIconSpacing.js.map +1 -1
- package/dist/layout/LayoutAppBar.d.ts +1 -1
- package/dist/layout/LayoutAppBar.js +1 -1
- package/dist/layout/LayoutAppBar.js.map +1 -1
- package/dist/layout/LayoutNav.d.ts +1 -1
- package/dist/layout/LayoutNav.js +1 -1
- package/dist/layout/LayoutNav.js.map +1 -1
- package/dist/layout/LayoutWindowSplitter.d.ts +1 -1
- package/dist/layout/LayoutWindowSplitter.js +1 -1
- package/dist/layout/LayoutWindowSplitter.js.map +1 -1
- package/dist/layout/Main.d.ts +1 -1
- package/dist/layout/Main.js +1 -1
- package/dist/layout/Main.js.map +1 -1
- package/dist/layout/useExpandableLayout.d.ts +1 -1
- package/dist/layout/useExpandableLayout.js +1 -1
- package/dist/layout/useExpandableLayout.js.map +1 -1
- package/dist/layout/useHorizontalLayoutTransition.d.ts +1 -1
- package/dist/layout/useHorizontalLayoutTransition.js +1 -1
- package/dist/layout/useHorizontalLayoutTransition.js.map +1 -1
- package/dist/layout/useLayoutAppBarHeight.d.ts +1 -1
- package/dist/layout/useLayoutAppBarHeight.js +1 -1
- package/dist/layout/useLayoutAppBarHeight.js.map +1 -1
- package/dist/layout/useLayoutTree.d.ts +3 -3
- package/dist/layout/useLayoutTree.js +3 -3
- package/dist/layout/useLayoutTree.js.map +1 -1
- package/dist/layout/useLayoutWindowSplitter.d.ts +1 -1
- package/dist/layout/useLayoutWindowSplitter.js +1 -1
- package/dist/layout/useLayoutWindowSplitter.js.map +1 -1
- package/dist/layout/useResizableLayout.d.ts +1 -1
- package/dist/layout/useResizableLayout.js +1 -1
- package/dist/layout/useResizableLayout.js.map +1 -1
- package/dist/layout/useTemporaryLayout.d.ts +1 -1
- package/dist/layout/useTemporaryLayout.js +1 -1
- package/dist/layout/useTemporaryLayout.js.map +1 -1
- package/dist/link/Link.d.ts +1 -1
- package/dist/link/Link.js +1 -1
- package/dist/link/Link.js.map +1 -1
- package/dist/link/SkipToMainContent.d.ts +1 -1
- package/dist/link/SkipToMainContent.js +1 -1
- package/dist/link/SkipToMainContent.js.map +1 -1
- package/dist/list/List.d.ts +1 -1
- package/dist/list/List.js +1 -1
- package/dist/list/List.js.map +1 -1
- package/dist/list/ListItem.d.ts +1 -1
- package/dist/list/ListItem.js +1 -1
- package/dist/list/ListItem.js.map +1 -1
- package/dist/list/ListItemChildren.d.ts +1 -1
- package/dist/list/ListItemChildren.js +1 -1
- package/dist/list/ListItemChildren.js.map +1 -1
- package/dist/list/ListItemLink.d.ts +1 -1
- package/dist/list/ListItemLink.js +1 -1
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/ListSubheader.d.ts +1 -1
- package/dist/list/ListSubheader.js +1 -1
- package/dist/list/ListSubheader.js.map +1 -1
- package/dist/media-queries/AppSizeProvider.d.ts +2 -2
- package/dist/media-queries/AppSizeProvider.js +2 -2
- package/dist/media-queries/AppSizeProvider.js.map +1 -1
- package/dist/media-queries/useMediaQuery.d.ts +2 -2
- package/dist/media-queries/useMediaQuery.js +2 -2
- package/dist/media-queries/useMediaQuery.js.map +1 -1
- package/dist/menu/DropdownMenu.d.ts +1 -1
- package/dist/menu/DropdownMenu.js +2 -1
- package/dist/menu/DropdownMenu.js.map +1 -1
- package/dist/menu/Menu.d.ts +1 -1
- package/dist/menu/Menu.js +1 -1
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuBar.d.ts +1 -1
- package/dist/menu/MenuBar.js +1 -1
- package/dist/menu/MenuBar.js.map +1 -1
- package/dist/menu/MenuButton.d.ts +1 -1
- package/dist/menu/MenuButton.js +1 -1
- package/dist/menu/MenuButton.js.map +1 -1
- package/dist/menu/MenuItem.d.ts +1 -1
- package/dist/menu/MenuItem.js +1 -1
- package/dist/menu/MenuItem.js.map +1 -1
- package/dist/menu/MenuItemCheckbox.d.ts +1 -1
- package/dist/menu/MenuItemCheckbox.js +1 -1
- package/dist/menu/MenuItemCheckbox.js.map +1 -1
- package/dist/menu/MenuItemFileInput.d.ts +1 -1
- package/dist/menu/MenuItemFileInput.js +1 -1
- package/dist/menu/MenuItemFileInput.js.map +1 -1
- package/dist/menu/MenuItemGroup.d.ts +1 -1
- package/dist/menu/MenuItemGroup.js +1 -1
- package/dist/menu/MenuItemGroup.js.map +1 -1
- package/dist/menu/MenuItemInputToggle.d.ts +1 -1
- package/dist/menu/MenuItemInputToggle.js +1 -1
- package/dist/menu/MenuItemInputToggle.js.map +1 -1
- package/dist/menu/MenuItemRadio.d.ts +1 -1
- package/dist/menu/MenuItemRadio.js +1 -1
- package/dist/menu/MenuItemRadio.js.map +1 -1
- package/dist/menu/MenuItemSeparator.d.ts +1 -1
- package/dist/menu/MenuItemSeparator.js +1 -1
- package/dist/menu/MenuItemSeparator.js.map +1 -1
- package/dist/menu/MenuItemSwitch.d.ts +1 -1
- package/dist/menu/MenuItemSwitch.js +1 -1
- package/dist/menu/MenuItemSwitch.js.map +1 -1
- package/dist/menu/MenuItemTextField.d.ts +1 -1
- package/dist/menu/MenuItemTextField.js +1 -1
- package/dist/menu/MenuItemTextField.js.map +1 -1
- package/dist/menu/useContextMenu.d.ts +1 -1
- package/dist/menu/useContextMenu.js +1 -1
- package/dist/menu/useContextMenu.js.map +1 -1
- package/dist/navigation/CollapsibleNavGroup.d.ts +1 -1
- package/dist/navigation/CollapsibleNavGroup.js +1 -1
- package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
- package/dist/navigation/DefaultNavigationRenderer.d.ts +1 -1
- package/dist/navigation/DefaultNavigationRenderer.js +1 -1
- package/dist/navigation/DefaultNavigationRenderer.js.map +1 -1
- package/dist/navigation/NavGroup.d.ts +1 -1
- package/dist/navigation/NavGroup.js +1 -1
- package/dist/navigation/NavGroup.js.map +1 -1
- package/dist/navigation/NavItem.d.ts +1 -1
- package/dist/navigation/NavItem.js +1 -1
- package/dist/navigation/NavItem.js.map +1 -1
- package/dist/navigation/NavItemButton.d.ts +1 -1
- package/dist/navigation/NavItemButton.js +1 -1
- package/dist/navigation/NavItemButton.js.map +1 -1
- package/dist/navigation/NavItemLink.d.ts +1 -1
- package/dist/navigation/NavItemLink.js +1 -1
- package/dist/navigation/NavItemLink.js.map +1 -1
- package/dist/navigation/NavSubheader.d.ts +1 -1
- package/dist/navigation/NavSubheader.js +1 -1
- package/dist/navigation/NavSubheader.js.map +1 -1
- package/dist/navigation/Navigation.d.ts +1 -1
- package/dist/navigation/Navigation.js +1 -1
- package/dist/navigation/Navigation.js.map +1 -1
- package/dist/navigation/useActiveHeadingId.d.ts +1 -1
- package/dist/navigation/useActiveHeadingId.js +1 -1
- package/dist/navigation/useActiveHeadingId.js.map +1 -1
- package/dist/navigation/useNavigationExpansion.d.ts +2 -2
- package/dist/navigation/useNavigationExpansion.js +2 -2
- package/dist/navigation/useNavigationExpansion.js.map +1 -1
- package/dist/navigation/useTableOfContentsHeadings.d.ts +1 -1
- package/dist/navigation/useTableOfContentsHeadings.js +1 -1
- package/dist/navigation/useTableOfContentsHeadings.js.map +1 -1
- package/dist/overlay/Overlay.d.ts +1 -1
- package/dist/overlay/Overlay.js +1 -1
- package/dist/overlay/Overlay.js.map +1 -1
- package/dist/portal/Portal.d.ts +1 -1
- package/dist/portal/Portal.js +1 -1
- package/dist/portal/Portal.js.map +1 -1
- package/dist/portal/PortalContainerProvider.d.ts +1 -1
- package/dist/portal/PortalContainerProvider.js +1 -1
- package/dist/portal/PortalContainerProvider.js.map +1 -1
- package/dist/positioning/useFixedPositioning.d.ts +1 -1
- package/dist/positioning/useFixedPositioning.js +1 -1
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/progress/CircularProgress.d.ts +1 -1
- package/dist/progress/CircularProgress.js +1 -1
- package/dist/progress/CircularProgress.js.map +1 -1
- package/dist/progress/LinearProgress.d.ts +1 -1
- package/dist/progress/LinearProgress.js +1 -1
- package/dist/progress/LinearProgress.js.map +1 -1
- package/dist/responsive-item/ResponsiveItem.d.ts +1 -1
- package/dist/responsive-item/ResponsiveItem.js +1 -1
- package/dist/responsive-item/ResponsiveItem.js.map +1 -1
- package/dist/responsive-item/ResponsiveItemOverlay.d.ts +1 -1
- package/dist/responsive-item/ResponsiveItemOverlay.js +1 -1
- package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
- package/dist/scroll/useScrollLock.d.ts +1 -1
- package/dist/scroll/useScrollLock.js +1 -1
- package/dist/scroll/useScrollLock.js.map +1 -1
- package/dist/segmented-button/SegmentedButton.d.ts +1 -1
- package/dist/segmented-button/SegmentedButton.js +1 -1
- package/dist/segmented-button/SegmentedButton.js.map +1 -1
- package/dist/segmented-button/SegmentedButtonContainer.d.ts +1 -1
- package/dist/segmented-button/SegmentedButtonContainer.js +1 -1
- package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
- package/dist/sheet/Sheet.d.ts +1 -1
- package/dist/sheet/Sheet.js +1 -1
- package/dist/sheet/Sheet.js.map +1 -1
- package/dist/snackbar/DefaultToastRenderer.d.ts +1 -1
- package/dist/snackbar/DefaultToastRenderer.js +1 -1
- package/dist/snackbar/DefaultToastRenderer.js.map +1 -1
- package/dist/snackbar/Snackbar.d.ts +1 -1
- package/dist/snackbar/Snackbar.js +1 -1
- package/dist/snackbar/Snackbar.js.map +1 -1
- package/dist/snackbar/Toast.d.ts +1 -1
- package/dist/snackbar/Toast.js +1 -1
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/ToastActionButton.d.ts +1 -1
- package/dist/snackbar/ToastActionButton.js +1 -1
- package/dist/snackbar/ToastActionButton.js.map +1 -1
- package/dist/snackbar/ToastCloseButton.d.ts +1 -1
- package/dist/snackbar/ToastCloseButton.js +1 -1
- package/dist/snackbar/ToastCloseButton.js.map +1 -1
- package/dist/snackbar/ToastContent.d.ts +1 -1
- package/dist/snackbar/ToastContent.js +1 -1
- package/dist/snackbar/ToastContent.js.map +1 -1
- package/dist/snackbar/ToastManager.d.ts +1 -1
- package/dist/snackbar/ToastManager.js +1 -1
- package/dist/snackbar/ToastManager.js.map +1 -1
- package/dist/snackbar/ToastManagerProvider.d.ts +1 -1
- package/dist/snackbar/ToastManagerProvider.js +1 -1
- package/dist/snackbar/ToastManagerProvider.js.map +1 -1
- package/dist/snackbar/useCurrentToastActions.d.ts +1 -1
- package/dist/snackbar/useCurrentToastActions.js +1 -1
- package/dist/snackbar/useCurrentToastActions.js.map +1 -1
- package/dist/storage/useStorage.d.ts +1 -1
- package/dist/storage/useStorage.js +1 -1
- package/dist/storage/useStorage.js.map +1 -1
- package/dist/suspense/CircularProgressSuspense.d.ts +1 -1
- package/dist/suspense/CircularProgressSuspense.js +1 -1
- package/dist/suspense/CircularProgressSuspense.js.map +1 -1
- package/dist/suspense/NullSuspense.d.ts +1 -1
- package/dist/suspense/NullSuspense.js +1 -1
- package/dist/suspense/NullSuspense.js.map +1 -1
- package/dist/table/StickyTableSection.d.ts +2 -2
- package/dist/table/StickyTableSection.js +2 -2
- package/dist/table/StickyTableSection.js.map +1 -1
- package/dist/table/Table.d.ts +1 -1
- package/dist/table/Table.js +1 -1
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableBody.d.ts +1 -1
- package/dist/table/TableBody.js +1 -1
- package/dist/table/TableBody.js.map +1 -1
- package/dist/table/TableCell.d.ts +1 -1
- package/dist/table/TableCell.js +1 -1
- package/dist/table/TableCell.js.map +1 -1
- package/dist/table/TableCheckbox.d.ts +1 -1
- package/dist/table/TableCheckbox.js +1 -1
- package/dist/table/TableCheckbox.js.map +1 -1
- package/dist/table/TableContainer.d.ts +1 -1
- package/dist/table/TableContainer.js +1 -1
- package/dist/table/TableContainer.js.map +1 -1
- package/dist/table/TableFooter.d.ts +1 -1
- package/dist/table/TableFooter.js +1 -1
- package/dist/table/TableFooter.js.map +1 -1
- package/dist/table/TableHeader.d.ts +1 -1
- package/dist/table/TableHeader.js +1 -1
- package/dist/table/TableHeader.js.map +1 -1
- package/dist/table/TableRadio.d.ts +1 -1
- package/dist/table/TableRadio.js +1 -1
- package/dist/table/TableRadio.js.map +1 -1
- package/dist/table/TableRow.d.ts +1 -1
- package/dist/table/TableRow.js +1 -1
- package/dist/table/TableRow.js.map +1 -1
- package/dist/tabs/SimpleTabPanel.d.ts +2 -2
- package/dist/tabs/SimpleTabPanel.js +2 -2
- package/dist/tabs/SimpleTabPanel.js.map +1 -1
- package/dist/tabs/SimpleTabPanels.d.ts +2 -2
- package/dist/tabs/SimpleTabPanels.js +2 -2
- package/dist/tabs/SimpleTabPanels.js.map +1 -1
- package/dist/tabs/Tab.d.ts +1 -1
- package/dist/tabs/Tab.js +1 -1
- package/dist/tabs/Tab.js.map +1 -1
- package/dist/tabs/TabList.d.ts +1 -1
- package/dist/tabs/TabList.js +1 -1
- package/dist/tabs/TabList.js.map +1 -1
- package/dist/tabs/useTabs.d.ts +4 -4
- package/dist/tabs/useTabs.js +2 -1
- package/dist/tabs/useTabs.js.map +1 -1
- package/dist/theme/LocalStorageColorSchemeProvider.d.ts +2 -2
- package/dist/theme/LocalStorageColorSchemeProvider.js +2 -2
- package/dist/theme/LocalStorageColorSchemeProvider.js.map +1 -1
- package/dist/theme/ThemeProvider.d.ts +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/useColorSchemeProvider.js +1 -0
- package/dist/theme/useColorSchemeProvider.js.map +1 -1
- package/dist/tooltip/Tooltip.d.ts +1 -1
- package/dist/tooltip/Tooltip.js +1 -1
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/TooltipHoverModeProvider.d.ts +1 -1
- package/dist/tooltip/TooltipHoverModeProvider.js +1 -1
- package/dist/tooltip/TooltipHoverModeProvider.js.map +1 -1
- package/dist/tooltip/useTooltip.d.ts +1 -1
- package/dist/tooltip/useTooltip.js +1 -1
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/transition/CSSTransition.d.ts +1 -1
- package/dist/transition/CSSTransition.js +1 -1
- package/dist/transition/CSSTransition.js.map +1 -1
- package/dist/transition/Collapse.d.ts +1 -1
- package/dist/transition/Collapse.js +1 -1
- package/dist/transition/Collapse.js.map +1 -1
- package/dist/transition/CrossFade.d.ts +1 -1
- package/dist/transition/CrossFade.js +1 -1
- package/dist/transition/CrossFade.js.map +1 -1
- package/dist/transition/ScaleTransition.d.ts +1 -1
- package/dist/transition/ScaleTransition.js +1 -1
- package/dist/transition/ScaleTransition.js.map +1 -1
- package/dist/transition/SkeletonPlaceholder.d.ts +1 -1
- package/dist/transition/SkeletonPlaceholder.js +1 -1
- package/dist/transition/SkeletonPlaceholder.js.map +1 -1
- package/dist/transition/Slide.d.ts +1 -1
- package/dist/transition/Slide.js +1 -1
- package/dist/transition/Slide.js.map +1 -1
- package/dist/transition/SlideContainer.d.ts +1 -1
- package/dist/transition/SlideContainer.js +1 -1
- package/dist/transition/SlideContainer.js.map +1 -1
- package/dist/transition/useCSSTransition.d.ts +2 -2
- package/dist/transition/useCSSTransition.js +2 -2
- package/dist/transition/useCSSTransition.js.map +1 -1
- package/dist/transition/useCarousel.d.ts +1 -1
- package/dist/transition/useCarousel.js +1 -1
- package/dist/transition/useCarousel.js.map +1 -1
- package/dist/transition/useCollapseTransition.d.ts +2 -2
- package/dist/transition/useCollapseTransition.js +2 -2
- package/dist/transition/useCollapseTransition.js.map +1 -1
- package/dist/transition/useCrossFadeTransition.d.ts +2 -2
- package/dist/transition/useCrossFadeTransition.js +2 -2
- package/dist/transition/useCrossFadeTransition.js.map +1 -1
- package/dist/transition/useScaleTransition.d.ts +2 -2
- package/dist/transition/useScaleTransition.js +2 -2
- package/dist/transition/useScaleTransition.js.map +1 -1
- package/dist/transition/useSkeletonPlaceholder.d.ts +2 -2
- package/dist/transition/useSkeletonPlaceholder.js +2 -2
- package/dist/transition/useSkeletonPlaceholder.js.map +1 -1
- package/dist/transition/useSlideTransition.d.ts +1 -1
- package/dist/transition/useSlideTransition.js +1 -1
- package/dist/transition/useSlideTransition.js.map +1 -1
- package/dist/transition/useTransition.d.ts +1 -1
- package/dist/transition/useTransition.js +1 -1
- package/dist/transition/useTransition.js.map +1 -1
- package/dist/tree/DefaultTreeItemRenderer.d.ts +1 -1
- package/dist/tree/DefaultTreeItemRenderer.js +1 -1
- package/dist/tree/DefaultTreeItemRenderer.js.map +1 -1
- package/dist/tree/Tree.d.ts +1 -1
- package/dist/tree/Tree.js +1 -1
- package/dist/tree/Tree.js.map +1 -1
- package/dist/tree/TreeItem.d.ts +1 -1
- package/dist/tree/TreeItem.js +1 -1
- package/dist/tree/TreeItem.js.map +1 -1
- package/dist/tree/useTree.d.ts +1 -1
- package/dist/tree/useTree.js +1 -1
- package/dist/tree/useTree.js.map +1 -1
- package/dist/tree/useTreeExpansion.d.ts +1 -1
- package/dist/tree/useTreeExpansion.js +1 -1
- package/dist/tree/useTreeExpansion.js.map +1 -1
- package/dist/tree/useTreeItems.d.ts +1 -1
- package/dist/tree/useTreeItems.js +1 -1
- package/dist/tree/useTreeItems.js.map +1 -1
- package/dist/tree/useTreeSelection.d.ts +1 -1
- package/dist/tree/useTreeSelection.js +1 -1
- package/dist/tree/useTreeSelection.js.map +1 -1
- package/dist/typography/HighlightText.d.ts +1 -1
- package/dist/typography/HighlightText.js +1 -1
- package/dist/typography/HighlightText.js.map +1 -1
- package/dist/typography/Mark.d.ts +1 -1
- package/dist/typography/Mark.js +1 -1
- package/dist/typography/Mark.js.map +1 -1
- package/dist/typography/SrOnly.d.ts +1 -1
- package/dist/typography/SrOnly.js +1 -1
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/TextContainer.d.ts +1 -1
- package/dist/typography/TextContainer.js +1 -1
- package/dist/typography/TextContainer.js.map +1 -1
- package/dist/typography/Typography.d.ts +1 -1
- package/dist/typography/Typography.js +1 -1
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/WritingDirectionProvider.d.ts +1 -1
- package/dist/typography/WritingDirectionProvider.js +1 -1
- package/dist/typography/WritingDirectionProvider.js.map +1 -1
- package/dist/useEnsuredState.d.ts +1 -0
- package/dist/useEnsuredState.js +5 -3
- package/dist/useEnsuredState.js.map +1 -1
- package/dist/utils/RenderRecursively.d.ts +1 -1
- package/dist/utils/RenderRecursively.js +1 -1
- package/dist/utils/RenderRecursively.js.map +1 -1
- package/dist/window-splitter/WindowSplitter.d.ts +1 -1
- package/dist/window-splitter/WindowSplitter.js +1 -1
- package/dist/window-splitter/WindowSplitter.js.map +1 -1
- package/package.json +1 -1
- package/src/CoreProviders.tsx +1 -1
- package/src/SsrProvider.tsx +1 -1
- package/src/autocomplete/Autocomplete.tsx +3 -3
- package/src/autocomplete/AutocompleteChip.tsx +1 -1
- package/src/autocomplete/AutocompleteCircularProgress.tsx +1 -1
- package/src/autocomplete/AutocompleteClearButton.tsx +1 -1
- package/src/autocomplete/AutocompleteDropdownButton.tsx +1 -1
- package/src/autocomplete/useAutocomplete.ts +5 -4
- package/src/avatar/Avatar.tsx +1 -1
- package/src/badge/Badge.tsx +1 -1
- package/src/box/Box.tsx +1 -1
- package/src/button/AsyncButton.tsx +1 -1
- package/src/button/Button.tsx +1 -1
- package/src/button/ButtonUnstyled.tsx +1 -1
- package/src/button/TooltippedButton.tsx +1 -1
- package/src/card/Card.tsx +1 -1
- package/src/card/CardContent.tsx +1 -1
- package/src/card/CardFooter.tsx +1 -1
- package/src/card/CardHeader.tsx +1 -1
- package/src/card/CardSubtitle.tsx +1 -1
- package/src/card/CardTitle.tsx +1 -1
- package/src/card/ClickableCard.tsx +1 -1
- package/src/chip/Chip.tsx +1 -1
- package/src/dialog/Dialog.tsx +1 -1
- package/src/dialog/DialogContent.tsx +1 -1
- package/src/dialog/DialogFooter.tsx +1 -1
- package/src/dialog/DialogHeader.tsx +1 -1
- package/src/dialog/DialogTitle.tsx +1 -1
- package/src/dialog/FixedDialog.tsx +1 -1
- package/src/divider/Divider.tsx +1 -1
- package/src/draggable/useDraggable.ts +1 -1
- package/src/expansion-panel/ExpansionList.tsx +1 -1
- package/src/expansion-panel/ExpansionPanel.tsx +1 -1
- package/src/expansion-panel/ExpansionPanelHeader.tsx +1 -1
- package/src/expansion-panel/useExpansionList.ts +1 -1
- package/src/expansion-panel/useExpansionPanels.ts +1 -1
- package/src/files/FileInput.tsx +1 -1
- package/src/files/useFileUpload.ts +2 -2
- package/src/form/Checkbox.tsx +1 -1
- package/src/form/Fieldset.tsx +1 -1
- package/src/form/Form.tsx +1 -1
- package/src/form/FormMessage.tsx +1 -1
- package/src/form/FormMessageContainer.tsx +1 -1
- package/src/form/FormMessageCounter.tsx +2 -2
- package/src/form/InputToggle.tsx +2 -2
- package/src/form/Label.tsx +3 -3
- package/src/form/Legend.tsx +1 -1
- package/src/form/NativeSelect.tsx +1 -1
- package/src/form/OptGroup.tsx +1 -1
- package/src/form/Option.tsx +1 -1
- package/src/form/Password.tsx +1 -1
- package/src/form/Radio.tsx +1 -1
- package/src/form/Select.tsx +1 -1
- package/src/form/Slider.tsx +1 -1
- package/src/form/Switch.tsx +1 -1
- package/src/form/TextArea.tsx +1 -1
- package/src/form/TextField.tsx +1 -1
- package/src/form/useCheckboxGroup.ts +10 -10
- package/src/form/useCombobox.ts +1 -0
- package/src/form/useNumberField.ts +4 -4
- package/src/form/useRadioGroup.ts +6 -6
- package/src/form/useRangeSlider.ts +1 -1
- package/src/form/useSlider.ts +1 -1
- package/src/form/useTextField.ts +6 -6
- package/src/icon/FontIcon.tsx +1 -1
- package/src/icon/IconRotator.tsx +1 -1
- package/src/icon/MaterialIcon.tsx +2 -2
- package/src/icon/MaterialSymbol.tsx +2 -2
- package/src/icon/SVGIcon.tsx +1 -1
- package/src/icon/TextIconSpacing.tsx +1 -1
- package/src/layout/LayoutAppBar.tsx +1 -1
- package/src/layout/LayoutNav.tsx +1 -1
- package/src/layout/LayoutWindowSplitter.tsx +1 -1
- package/src/layout/Main.tsx +1 -1
- package/src/layout/useExpandableLayout.ts +1 -1
- package/src/layout/useHorizontalLayoutTransition.ts +1 -1
- package/src/layout/useLayoutAppBarHeight.ts +1 -1
- package/src/layout/useLayoutTree.ts +3 -3
- package/src/layout/useLayoutWindowSplitter.ts +1 -1
- package/src/layout/useResizableLayout.ts +1 -1
- package/src/layout/useTemporaryLayout.ts +1 -1
- package/src/link/Link.tsx +1 -1
- package/src/link/SkipToMainContent.tsx +1 -1
- package/src/list/List.tsx +1 -1
- package/src/list/ListItem.tsx +1 -1
- package/src/list/ListItemChildren.tsx +1 -1
- package/src/list/ListItemLink.tsx +1 -1
- package/src/list/ListSubheader.tsx +1 -1
- package/src/media-queries/AppSizeProvider.tsx +2 -2
- package/src/media-queries/useMediaQuery.ts +2 -2
- package/src/menu/DropdownMenu.tsx +2 -1
- package/src/menu/Menu.tsx +1 -1
- package/src/menu/MenuBar.tsx +1 -1
- package/src/menu/MenuButton.tsx +1 -1
- package/src/menu/MenuItem.tsx +1 -1
- package/src/menu/MenuItemCheckbox.tsx +1 -1
- package/src/menu/MenuItemFileInput.tsx +1 -1
- package/src/menu/MenuItemGroup.tsx +1 -1
- package/src/menu/MenuItemInputToggle.tsx +1 -1
- package/src/menu/MenuItemRadio.tsx +1 -1
- package/src/menu/MenuItemSeparator.tsx +1 -1
- package/src/menu/MenuItemSwitch.tsx +1 -1
- package/src/menu/MenuItemTextField.tsx +1 -1
- package/src/menu/useContextMenu.ts +1 -1
- package/src/navigation/CollapsibleNavGroup.tsx +1 -1
- package/src/navigation/DefaultNavigationRenderer.tsx +1 -1
- package/src/navigation/NavGroup.tsx +1 -1
- package/src/navigation/NavItem.tsx +1 -1
- package/src/navigation/NavItemButton.tsx +1 -1
- package/src/navigation/NavItemLink.tsx +1 -1
- package/src/navigation/NavSubheader.tsx +1 -1
- package/src/navigation/Navigation.tsx +1 -1
- package/src/navigation/useActiveHeadingId.ts +1 -1
- package/src/navigation/useNavigationExpansion.ts +2 -2
- package/src/navigation/useTableOfContentsHeadings.ts +1 -1
- package/src/overlay/Overlay.tsx +1 -1
- package/src/portal/Portal.tsx +1 -1
- package/src/portal/PortalContainerProvider.tsx +1 -1
- package/src/positioning/useFixedPositioning.ts +1 -1
- package/src/progress/CircularProgress.tsx +1 -1
- package/src/progress/LinearProgress.tsx +1 -1
- package/src/responsive-item/ResponsiveItem.tsx +1 -1
- package/src/responsive-item/ResponsiveItemOverlay.tsx +1 -1
- package/src/scroll/useScrollLock.ts +1 -1
- package/src/segmented-button/SegmentedButton.tsx +1 -1
- package/src/segmented-button/SegmentedButtonContainer.tsx +1 -1
- package/src/sheet/Sheet.tsx +1 -1
- package/src/snackbar/DefaultToastRenderer.tsx +1 -1
- package/src/snackbar/Snackbar.tsx +1 -1
- package/src/snackbar/Toast.tsx +1 -1
- package/src/snackbar/ToastActionButton.tsx +1 -1
- package/src/snackbar/ToastCloseButton.tsx +1 -1
- package/src/snackbar/ToastContent.tsx +1 -1
- package/src/snackbar/ToastManager.ts +1 -1
- package/src/snackbar/ToastManagerProvider.tsx +1 -1
- package/src/snackbar/useCurrentToastActions.ts +1 -1
- package/src/storage/useStorage.ts +1 -1
- package/src/suspense/CircularProgressSuspense.tsx +1 -1
- package/src/suspense/NullSuspense.tsx +1 -1
- package/src/table/StickyTableSection.tsx +2 -2
- package/src/table/Table.tsx +1 -1
- package/src/table/TableBody.tsx +1 -1
- package/src/table/TableCell.tsx +1 -1
- package/src/table/TableCheckbox.tsx +1 -1
- package/src/table/TableContainer.tsx +1 -1
- package/src/table/TableFooter.tsx +1 -1
- package/src/table/TableHeader.tsx +1 -1
- package/src/table/TableRadio.tsx +1 -1
- package/src/table/TableRow.tsx +1 -1
- package/src/tabs/SimpleTabPanel.tsx +2 -2
- package/src/tabs/SimpleTabPanels.tsx +2 -2
- package/src/tabs/Tab.tsx +1 -1
- package/src/tabs/TabList.tsx +1 -1
- package/src/tabs/useTabs.ts +6 -5
- package/src/theme/LocalStorageColorSchemeProvider.tsx +2 -2
- package/src/theme/ThemeProvider.tsx +1 -1
- package/src/theme/useColorSchemeProvider.ts +1 -0
- package/src/tooltip/Tooltip.tsx +1 -1
- package/src/tooltip/TooltipHoverModeProvider.tsx +1 -1
- package/src/tooltip/useTooltip.ts +1 -1
- package/src/transition/CSSTransition.tsx +1 -1
- package/src/transition/Collapse.tsx +1 -1
- package/src/transition/CrossFade.tsx +1 -1
- package/src/transition/ScaleTransition.tsx +1 -1
- package/src/transition/SkeletonPlaceholder.tsx +1 -1
- package/src/transition/Slide.tsx +1 -1
- package/src/transition/SlideContainer.tsx +1 -1
- package/src/transition/useCSSTransition.ts +2 -2
- package/src/transition/useCarousel.ts +1 -1
- package/src/transition/useCollapseTransition.ts +2 -2
- package/src/transition/useCrossFadeTransition.ts +2 -2
- package/src/transition/useScaleTransition.ts +2 -2
- package/src/transition/useSkeletonPlaceholder.ts +2 -2
- package/src/transition/useSlideTransition.ts +1 -1
- package/src/transition/useTransition.ts +1 -1
- package/src/tree/DefaultTreeItemRenderer.tsx +1 -1
- package/src/tree/Tree.tsx +1 -1
- package/src/tree/TreeItem.tsx +1 -1
- package/src/tree/useTree.ts +1 -1
- package/src/tree/useTreeExpansion.ts +1 -1
- package/src/tree/useTreeItems.ts +1 -1
- package/src/tree/useTreeSelection.ts +1 -1
- package/src/typography/HighlightText.tsx +1 -1
- package/src/typography/Mark.tsx +1 -1
- package/src/typography/SrOnly.tsx +1 -1
- package/src/typography/TextContainer.tsx +1 -1
- package/src/typography/Typography.tsx +1 -1
- package/src/typography/WritingDirectionProvider.tsx +1 -1
- package/src/useEnsuredState.ts +6 -3
- package/src/utils/RenderRecursively.tsx +1 -1
- package/src/window-splitter/WindowSplitter.tsx +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/list/ListItemLink.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n forwardRef,\n} from \"react\";\n\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 { type ListItemClassNameOptions, listItem } 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`, `Menu`,\n * or `DropdownMenu` components.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/list\";\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n *\n * function Example() {\n * return (\n * <List>\n * <ListItemLink href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @example In Menus\n * ```tsx\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Hello\">\n * <ListItemLink role=\"menuitem\" href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/list/ListItemLink.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type AnchorHTMLAttributes,\n type HTMLAttributes,\n forwardRef,\n} from \"react\";\n\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 { type ListItemClassNameOptions, listItem } 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`, `Menu`,\n * or `DropdownMenu` components.\n *\n * @example Simple Example\n * ```tsx\n * import { List } from \"@react-md/core/list/list\";\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n *\n * function Example() {\n * return (\n * <List>\n * <ListItemLink href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @example In Menus\n * ```tsx\n * import { ListItemLink } from \"@react-md/core/list/ListItemLink\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Hello\">\n * <ListItemLink role=\"menuitem\" href=\"#\">Some Link</ListItemLink>\n * </List>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\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;;AAEA,SAGEA,UAAU,QACL,QAAQ;AAGf,SAASC,qBAAqB,QAAQ,0CAA0C;AAChF,SAASC,yBAAyB,QAAQ,8CAA8C;AAGxF,SAASC,gBAAgB,QAAQ,wBAAwB;AACzD,SAASC,iBAAiB,QAAQ,yBAAyB;AAC3D,SAAwCC,QAAQ,QAAQ,sBAAsB;AAkC9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmCC,GACD,OAAO,MAAMC,6BAAeN,WAC1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,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"}
|
|
@@ -32,6 +32,6 @@ export interface ListSubheaderProps extends HTMLAttributes<HTMLLIElement>, ListS
|
|
|
32
32
|
* The `ListSubheader` is a wrapper for the `<li>` element to apply subheader
|
|
33
33
|
* typography styles and {@link ListItemText} layout.
|
|
34
34
|
*
|
|
35
|
-
* @see {@link https://
|
|
35
|
+
* @see {@link https://react-md.dev/components/list | List Demos}
|
|
36
36
|
*/
|
|
37
37
|
export declare const ListSubheader: import("react").ForwardRefExoticComponent<ListSubheaderProps & import("react").RefAttributes<HTMLLIElement>>;
|
|
@@ -16,7 +16,7 @@ const styles = bem("rmd-list-subheader");
|
|
|
16
16
|
* The `ListSubheader` is a wrapper for the `<li>` element to apply subheader
|
|
17
17
|
* typography styles and {@link ListItemText} layout.
|
|
18
18
|
*
|
|
19
|
-
* @see {@link https://
|
|
19
|
+
* @see {@link https://react-md.dev/components/list | List Demos}
|
|
20
20
|
*/ export const ListSubheader = /*#__PURE__*/ forwardRef(function ListSubheader(props, ref) {
|
|
21
21
|
const { role = "presentation", inset = false, className, children, textProps, ...remaining } = props;
|
|
22
22
|
return /*#__PURE__*/ _jsx("li", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/list/ListSubheader.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { ListItemText } from \"./ListItemText.js\";\n\nconst styles = bem(\"rmd-list-subheader\");\n\n/** @since 6.0.0 */\nexport interface ListSubheaderClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the subheader should be inset to match the `ListItem` text\n * keyline.\n *\n * @defaultValue `false`\n */\n inset?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listSubheader(\n options: ListSubheaderClassNameOptions = {}\n): string {\n const { inset = false, className } = options;\n\n return cnb(styles({ inset }), className);\n}\n\n/**\n * @since 6.0.0 The `role` prop defaults to `\"presentation\"`\n */\nexport interface ListSubheaderProps\n extends HTMLAttributes<HTMLLIElement>,\n ListSubheaderClassNameOptions {\n /**\n * @defaultValue `\"presentation\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @since 6.0.0\n */\n textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;\n}\n\n/**\n * The `ListSubheader` is a wrapper for the `<li>` element to apply subheader\n * typography styles and {@link ListItemText} layout.\n *\n * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/list/ListSubheader.tsx"],"sourcesContent":["import { cnb } from \"cnbuilder\";\nimport { type HTMLAttributes, forwardRef } from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { bem } from \"../utils/bem.js\";\nimport { ListItemText } from \"./ListItemText.js\";\n\nconst styles = bem(\"rmd-list-subheader\");\n\n/** @since 6.0.0 */\nexport interface ListSubheaderClassNameOptions {\n className?: string;\n\n /**\n * Boolean if the subheader should be inset to match the `ListItem` text\n * keyline.\n *\n * @defaultValue `false`\n */\n inset?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport function listSubheader(\n options: ListSubheaderClassNameOptions = {}\n): string {\n const { inset = false, className } = options;\n\n return cnb(styles({ inset }), className);\n}\n\n/**\n * @since 6.0.0 The `role` prop defaults to `\"presentation\"`\n */\nexport interface ListSubheaderProps\n extends HTMLAttributes<HTMLLIElement>,\n ListSubheaderClassNameOptions {\n /**\n * @defaultValue `\"presentation\"`\n */\n role?: HTMLAttributes<HTMLLIElement>[\"role\"];\n\n /**\n * @since 6.0.0\n */\n textProps?: PropsWithRef<HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>;\n}\n\n/**\n * The `ListSubheader` is a wrapper for the `<li>` element to apply subheader\n * typography styles and {@link ListItemText} layout.\n *\n * @see {@link https://react-md.dev/components/list | List Demos}\n */\nexport const ListSubheader = forwardRef<HTMLLIElement, ListSubheaderProps>(\n function ListSubheader(props, ref) {\n const {\n role = \"presentation\",\n inset = false,\n className,\n children,\n textProps,\n ...remaining\n } = props;\n\n return (\n <li\n {...remaining}\n ref={ref}\n role={role}\n className={listSubheader({\n inset,\n className,\n })}\n >\n <ListItemText {...textProps}>{children}</ListItemText>\n </li>\n );\n }\n);\n"],"names":["cnb","forwardRef","bem","ListItemText","styles","listSubheader","options","inset","className","ListSubheader","props","ref","role","children","textProps","remaining","li"],"mappings":";AAAA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAA8BC,UAAU,QAAQ,QAAQ;AAGxD,SAASC,GAAG,QAAQ,kBAAkB;AACtC,SAASC,YAAY,QAAQ,oBAAoB;AAEjD,MAAMC,SAASF,IAAI;AAenB;;CAEC,GACD,OAAO,SAASG,cACdC,UAAyC,CAAC,CAAC;IAE3C,MAAM,EAAEC,QAAQ,KAAK,EAAEC,SAAS,EAAE,GAAGF;IAErC,OAAON,IAAII,OAAO;QAAEG;IAAM,IAAIC;AAChC;AAmBA;;;;;CAKC,GACD,OAAO,MAAMC,8BAAgBR,WAC3B,SAASQ,cAAcC,KAAK,EAAEC,GAAG;IAC/B,MAAM,EACJC,OAAO,cAAc,EACrBL,QAAQ,KAAK,EACbC,SAAS,EACTK,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGL;IAEJ,qBACE,KAACM;QACE,GAAGD,SAAS;QACbJ,KAAKA;QACLC,MAAMA;QACNJ,WAAWH,cAAc;YACvBE;YACAC;QACF;kBAEA,cAAA,KAACL;YAAc,GAAGW,SAAS;sBAAGD;;;AAGpC,GACA"}
|
|
@@ -41,8 +41,8 @@ export interface AppSizeProviderProps extends AppSizeQueries {
|
|
|
41
41
|
* This component should be mounted near the root of your app to determine the
|
|
42
42
|
* current app size based on different media queries.
|
|
43
43
|
*
|
|
44
|
-
* @see {@link https://
|
|
45
|
-
* @see {@link https://
|
|
44
|
+
* @see {@link https://react-md.dev/components/core-providers | CoreProviders Demos}
|
|
45
|
+
* @see {@link https://react-md.dev/components/app-size-provider | AppSizeProvider Demos}
|
|
46
46
|
* @since 6.0.0 Renamed from `AppSizeListener`
|
|
47
47
|
*/
|
|
48
48
|
export declare function AppSizeProvider(props: AppSizeProviderProps): ReactElement;
|
|
@@ -47,8 +47,8 @@ const { Provider } = context;
|
|
|
47
47
|
* This component should be mounted near the root of your app to determine the
|
|
48
48
|
* current app size based on different media queries.
|
|
49
49
|
*
|
|
50
|
-
* @see {@link https://
|
|
51
|
-
* @see {@link https://
|
|
50
|
+
* @see {@link https://react-md.dev/components/core-providers | CoreProviders Demos}
|
|
51
|
+
* @see {@link https://react-md.dev/components/app-size-provider | AppSizeProvider Demos}
|
|
52
52
|
* @since 6.0.0 Renamed from `AppSizeListener`
|
|
53
53
|
*/ export function AppSizeProvider(props) {
|
|
54
54
|
const { ssrSize = DEFAULT_APP_SIZE, phoneMaxWidth = DEFAULT_PHONE_MAX_WIDTH, tabletMinWidth = DEFAULT_TABLET_MIN_WIDTH, tabletMaxWidth = DEFAULT_TABLET_MAX_WIDTH, desktopMinWidth = DEFAULT_DESKTOP_MIN_WIDTH, desktopLargeMinWidth = DEFAULT_DESKTOP_LARGE_MIN_WIDTH, children } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/media-queries/AppSizeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n} from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { useOrientation } from \"../useOrientation.js\";\nimport {\n type AppSize,\n type AppSizeQueries,\n DEFAULT_APP_SIZE,\n DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n DEFAULT_DESKTOP_MIN_WIDTH,\n DEFAULT_PHONE_MAX_WIDTH,\n DEFAULT_TABLET_MAX_WIDTH,\n DEFAULT_TABLET_MIN_WIDTH,\n} from \"./appSize.js\";\nimport { useMediaQuery } from \"./useMediaQuery.js\";\n\n/** @internal */\ninterface AppSizeContext extends AppSize {\n __root: boolean;\n}\n\nconst context = createContext<AppSizeContext>({\n __root: false,\n isPhone: false,\n isTablet: false,\n isDesktop: true,\n isLargeDesktop: false,\n isLandscape: true,\n});\ncontext.displayName = \"AppSize\";\nconst { Provider } = context;\n\n/**\n * **Note**: The app size object returned by this hook will **not** be equal\n * between renders.\n *\n * @example Simple Example\n * ```tsx\n * import { useAppSize } from \"@react-md/core/media-queries/AppSizeProvider\";\n *\n * function Example() {\n * const { isPhone, isTablet, isDesktop, isLargeDesktop, isLandscape } =\n * useAppSize()\n *\n * // do something based on the app size\n * return null;\n * }\n * ```\n *\n * @returns the current app size.\n * @throws \"The `AppSizeProvider` has not been mounted.\"\n */\nexport function useAppSize(): Readonly<AppSize> {\n const { __root, ...appSize } = useContext(context);\n if (!__root) {\n throw new Error(\"The `AppSizeProvider` has not been mounted.\");\n }\n\n return appSize;\n}\n\n/**\n * @since 6.0.0 Renamed from `AppSizeListenerProps`.\n * @since 6.0.0 Removed the `onChange` prop\n * @since 6.0.0 Renamed `defaultSize` to `ssrSize`\n */\nexport interface AppSizeProviderProps extends AppSizeQueries {\n /**\n * @defaultValue `DEFAULT_APP_SIZE`\n * @see {@link DEFAULT_APP_SIZE}\n * @since 6.0.0\n */\n ssrSize?: Readonly<AppSize>;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component should be mounted near the root of your app to determine the\n * current app size based on different media queries.\n *\n * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/media-queries/AppSizeProvider.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n createContext,\n useContext,\n useMemo,\n} from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\nimport { useOrientation } from \"../useOrientation.js\";\nimport {\n type AppSize,\n type AppSizeQueries,\n DEFAULT_APP_SIZE,\n DEFAULT_DESKTOP_LARGE_MIN_WIDTH,\n DEFAULT_DESKTOP_MIN_WIDTH,\n DEFAULT_PHONE_MAX_WIDTH,\n DEFAULT_TABLET_MAX_WIDTH,\n DEFAULT_TABLET_MIN_WIDTH,\n} from \"./appSize.js\";\nimport { useMediaQuery } from \"./useMediaQuery.js\";\n\n/** @internal */\ninterface AppSizeContext extends AppSize {\n __root: boolean;\n}\n\nconst context = createContext<AppSizeContext>({\n __root: false,\n isPhone: false,\n isTablet: false,\n isDesktop: true,\n isLargeDesktop: false,\n isLandscape: true,\n});\ncontext.displayName = \"AppSize\";\nconst { Provider } = context;\n\n/**\n * **Note**: The app size object returned by this hook will **not** be equal\n * between renders.\n *\n * @example Simple Example\n * ```tsx\n * import { useAppSize } from \"@react-md/core/media-queries/AppSizeProvider\";\n *\n * function Example() {\n * const { isPhone, isTablet, isDesktop, isLargeDesktop, isLandscape } =\n * useAppSize()\n *\n * // do something based on the app size\n * return null;\n * }\n * ```\n *\n * @returns the current app size.\n * @throws \"The `AppSizeProvider` has not been mounted.\"\n */\nexport function useAppSize(): Readonly<AppSize> {\n const { __root, ...appSize } = useContext(context);\n if (!__root) {\n throw new Error(\"The `AppSizeProvider` has not been mounted.\");\n }\n\n return appSize;\n}\n\n/**\n * @since 6.0.0 Renamed from `AppSizeListenerProps`.\n * @since 6.0.0 Removed the `onChange` prop\n * @since 6.0.0 Renamed `defaultSize` to `ssrSize`\n */\nexport interface AppSizeProviderProps extends AppSizeQueries {\n /**\n * @defaultValue `DEFAULT_APP_SIZE`\n * @see {@link DEFAULT_APP_SIZE}\n * @since 6.0.0\n */\n ssrSize?: Readonly<AppSize>;\n children: ReactNode;\n}\n\n/**\n * **Client Component**\n *\n * This component should be mounted near the root of your app to determine the\n * current app size based on different media queries.\n *\n * @see {@link https://react-md.dev/components/core-providers | CoreProviders Demos}\n * @see {@link https://react-md.dev/components/app-size-provider | AppSizeProvider Demos}\n * @since 6.0.0 Renamed from `AppSizeListener`\n */\nexport function AppSizeProvider(props: AppSizeProviderProps): ReactElement {\n const {\n ssrSize = DEFAULT_APP_SIZE,\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 children,\n } = props;\n const { __root } = useContext(context);\n if (__root) {\n throw new Error(\"The `AppSizeProvider` cannot be mounted multiple times.\");\n }\n\n const ssr = useSsr();\n const matchesDesktop = useMediaQuery(\n `screen and (min-width: ${desktopMinWidth})`\n );\n const matchesLargeDesktop = useMediaQuery(\n `screen and (min-width: ${desktopLargeMinWidth})`\n );\n const matchesTablet = useMediaQuery(\n `screen and (min-width: ${tabletMinWidth}) and (max-width: ${tabletMaxWidth})`\n );\n const matchesPhone = useMediaQuery(\n `screen and (max-width: ${phoneMaxWidth})`\n );\n const isDesktop = matchesDesktop;\n const isTablet = !matchesDesktop && matchesTablet;\n const isPhone = !isTablet && !isDesktop && matchesPhone;\n const isLandscape = useOrientation().includes(\"landscape\");\n const isLargeDesktop = matchesLargeDesktop;\n\n const appSize = useMemo<AppSizeContext>(\n () => ({\n __root: true,\n isPhone,\n isTablet,\n isDesktop,\n isLargeDesktop,\n isLandscape,\n }),\n [isDesktop, isLandscape, isLargeDesktop, isPhone, isTablet]\n );\n\n let value = appSize;\n if (ssr || typeof window === \"undefined\") {\n value = {\n __root: true,\n ...ssrSize,\n };\n }\n\n return <Provider value={value}>{children}</Provider>;\n}\n"],"names":["createContext","useContext","useMemo","useSsr","useOrientation","DEFAULT_APP_SIZE","DEFAULT_DESKTOP_LARGE_MIN_WIDTH","DEFAULT_DESKTOP_MIN_WIDTH","DEFAULT_PHONE_MAX_WIDTH","DEFAULT_TABLET_MAX_WIDTH","DEFAULT_TABLET_MIN_WIDTH","useMediaQuery","context","__root","isPhone","isTablet","isDesktop","isLargeDesktop","isLandscape","displayName","Provider","useAppSize","appSize","Error","AppSizeProvider","props","ssrSize","phoneMaxWidth","tabletMinWidth","tabletMaxWidth","desktopMinWidth","desktopLargeMinWidth","children","ssr","matchesDesktop","matchesLargeDesktop","matchesTablet","matchesPhone","includes","value","window"],"mappings":"AAAA;;AAEA,SAGEA,aAAa,EACbC,UAAU,EACVC,OAAO,QACF,QAAQ;AAEf,SAASC,MAAM,QAAQ,oBAAoB;AAC3C,SAASC,cAAc,QAAQ,uBAAuB;AACtD,SAGEC,gBAAgB,EAChBC,+BAA+B,EAC/BC,yBAAyB,EACzBC,uBAAuB,EACvBC,wBAAwB,EACxBC,wBAAwB,QACnB,eAAe;AACtB,SAASC,aAAa,QAAQ,qBAAqB;AAOnD,MAAMC,wBAAUZ,cAA8B;IAC5Ca,QAAQ;IACRC,SAAS;IACTC,UAAU;IACVC,WAAW;IACXC,gBAAgB;IAChBC,aAAa;AACf;AACAN,QAAQO,WAAW,GAAG;AACtB,MAAM,EAAEC,QAAQ,EAAE,GAAGR;AAErB;;;;;;;;;;;;;;;;;;;CAmBC,GACD,OAAO,SAASS;IACd,MAAM,EAAER,MAAM,EAAE,GAAGS,SAAS,GAAGrB,WAAWW;IAC1C,IAAI,CAACC,QAAQ;QACX,MA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
@@ -11,8 +11,8 @@
|
|
|
11
11
|
* }
|
|
12
12
|
* ```
|
|
13
13
|
*
|
|
14
|
-
* @see {@link https://
|
|
15
|
-
* @see {@link https://
|
|
14
|
+
* @see {@link https://react-md.dev/hooks/use-media-query | useMediaQuery Demos}
|
|
15
|
+
* @see {@link https://react-md.dev/components/app-size-provider | AppSizeProvider Demos}
|
|
16
16
|
* @param query - The media query to use
|
|
17
17
|
* @param disabled - When `true`, the `window.matchMedia` API will not be
|
|
18
18
|
* activated and the hook will return the last cached value.
|
|
@@ -14,8 +14,8 @@ import { useSsr } from "../SsrProvider.js";
|
|
|
14
14
|
* }
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
-
* @see {@link https://
|
|
18
|
-
* @see {@link https://
|
|
17
|
+
* @see {@link https://react-md.dev/hooks/use-media-query | useMediaQuery Demos}
|
|
18
|
+
* @see {@link https://react-md.dev/components/app-size-provider | AppSizeProvider Demos}
|
|
19
19
|
* @param query - The media query to use
|
|
20
20
|
* @param disabled - When `true`, the `window.matchMedia` API will not be
|
|
21
21
|
* activated and the hook will return the last cached value.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/media-queries/useMediaQuery.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\n\n/**\n * @example Simple Example\n * ```tsx\n * import { useMediaQuery } from \"@react-md/core/media-queries/useMediaQuery\";\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 * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/media-queries/useMediaQuery.ts"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\n\nimport { useSsr } from \"../SsrProvider.js\";\n\n/**\n * @example Simple Example\n * ```tsx\n * import { useMediaQuery } from \"@react-md/core/media-queries/useMediaQuery\";\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 * @see {@link https://react-md.dev/hooks/use-media-query | useMediaQuery Demos}\n * @see {@link https://react-md.dev/components/app-size-provider | AppSizeProvider Demos}\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 return the last cached value.\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;AAEA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAQ;AAE5C,SAASC,MAAM,QAAQ,oBAAoB;AAE3C;;;;;;;;;;;;;;;;;;;;CAoBC,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"}
|
|
@@ -80,7 +80,7 @@ export type DropdownMenuProps = DropdownMenuButtonProps & DropdownMenuItemButton
|
|
|
80
80
|
* }
|
|
81
81
|
* ```
|
|
82
82
|
*
|
|
83
|
-
* @see {@link https://
|
|
83
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
84
84
|
* @since 5.0.0
|
|
85
85
|
* @since 6.0.0 Updated to use the latest menu API.
|
|
86
86
|
*/
|
|
@@ -62,7 +62,7 @@ import { useMenuBarContext } from "./useMenuBarProvider.js";
|
|
|
62
62
|
* }
|
|
63
63
|
* ```
|
|
64
64
|
*
|
|
65
|
-
* @see {@link https://
|
|
65
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
66
66
|
* @since 5.0.0
|
|
67
67
|
* @since 6.0.0 Updated to use the latest menu API.
|
|
68
68
|
*/ export function DropdownMenu(props) {
|
|
@@ -70,6 +70,7 @@ import { useMenuBarContext } from "./useMenuBarProvider.js";
|
|
|
70
70
|
const fixedTo = useRef(null);
|
|
71
71
|
const defaultFocusIndex = useRef(0);
|
|
72
72
|
const [visible, setVisible] = useEnsuredState({
|
|
73
|
+
name: "visible",
|
|
73
74
|
value: propVisible,
|
|
74
75
|
setValue: propSetVisible,
|
|
75
76
|
defaultValue: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menu/DropdownMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useRef,\n} from \"react\";\n\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { getLastFocusableIndex } from \"../movement/utils.js\";\nimport { type UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredState } from \"../useEnsuredState.js\";\nimport {\n Menu,\n type MenuConvenienceProps,\n type MenuListConvenienceProps,\n} from \"./Menu.js\";\nimport { MenuButton, type MenuButtonProps } from \"./MenuButton.js\";\nimport {\n type MenuConfiguration,\n MenuConfigurationProvider,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuItemButton, type MenuItemButtonProps } from \"./MenuItemButton.js\";\nimport { type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuVisibilityProvider } from \"./MenuVisibilityProvider.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\n\nexport interface BaseDropdownMenuProps\n extends MenuConfiguration,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps,\n MenuConvenienceProps {\n buttonChildren: ReactNode;\n}\n\nexport interface DropdownMenuButtonProps\n extends MenuButtonProps,\n BaseDropdownMenuProps {}\n\nexport interface DropdownMenuItemButtonProps\n extends MenuItemButtonProps,\n BaseDropdownMenuProps {}\n\n/**\n * @since 6.0.0\n */\nexport interface DropdownMenuStateProps {\n visible: boolean;\n setVisible: UseStateSetter<boolean>;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use an `&` instead of `|` to allow autocompletion to\n * work better by default. It's up to the user to make sure they don't provide\n * incorrect props.\n */\nexport type DropdownMenuProps = DropdownMenuButtonProps &\n DropdownMenuItemButtonProps &\n (DropdownMenuStateProps | { visible?: never; setVisible?: never });\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @example Nested Dropdown Menus\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * <DropdownMenu buttonChildren=\"Nested Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Nested Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Nested Item 2\n * </MenuItem>\n * </DropdownMenu>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @see {@link https://next.react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest menu API.\n */\nexport function DropdownMenu(props: DropdownMenuProps): ReactElement {\n const {\n id: propId,\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n buttonChildren,\n iconRotatorProps: propIconRotatorProps,\n disableTransition: propDisableTransition,\n floating,\n anchor,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n initialX,\n initialY,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n preventScroll,\n closeOnResize,\n closeOnScroll,\n getFixedPositionOptions,\n children,\n temporary,\n disablePortal,\n disableElevation,\n menuProps,\n menuStyle,\n menuClassName,\n sheetProps,\n sheetStyle,\n sheetClassName,\n visible: propVisible,\n setVisible: propSetVisible,\n ...remaining\n } = props;\n\n const fixedTo = useRef<HTMLElement | HTMLButtonElement>(null);\n const defaultFocusIndex = useRef(0);\n const [visible, setVisible] = useEnsuredState({\n value: propVisible,\n setValue: propSetVisible,\n defaultValue: false,\n });\n const { menubar, menuitem, activeIdRef, animatedOnceRef } =\n useMenuBarContext();\n const id = useEnsuredId(propId, `menu${menuitem ? \"item\" : \"button\"}`);\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n const keyboard = mode === \"keyboard\";\n const disableTransition =\n propDisableTransition ??\n (animatedOnceRef.current &&\n menubar &&\n !!activeIdRef.current &&\n (mouse || keyboard));\n\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, [setVisible]);\n\n let iconRotatorProps = propIconRotatorProps;\n if (disableTransition) {\n iconRotatorProps = {\n disableTransition,\n ...propIconRotatorProps,\n };\n }\n\n let toggle: ReactElement;\n if (menuitem) {\n toggle = (\n <MenuItemButton\n {...(remaining as DropdownMenuItemButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLLIElement>}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuItemButton>\n );\n } else {\n toggle = (\n <MenuButton\n {...(remaining as DropdownMenuButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLButtonElement>}\n floating={floating}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuButton>\n );\n }\n\n return (\n <MenuVisibilityProvider\n visible={visible}\n setVisible={setVisible}\n defaultFocusIndex={defaultFocusIndex}\n >\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n {toggle}\n </MenuConfigurationProvider>\n <Menu\n aria-labelledby={(menuProps?.[\"aria-label\"] ? undefined : id) as string}\n style={menuStyle}\n className={menuClassName}\n sheetProps={sheetProps}\n sheetStyle={sheetStyle}\n sheetClassName={sheetClassName}\n temporary={temporary}\n disablePortal={disablePortal}\n disableElevation={disableElevation}\n disableTransition={disableTransition}\n floating={floating}\n anchor={anchor}\n vwMargin={vwMargin}\n vhMargin={vhMargin}\n xMargin={xMargin}\n yMargin={yMargin}\n initialX={initialX}\n initialY={initialY}\n width={width}\n transformOrigin={transformOrigin}\n preventOverlap={preventOverlap}\n disableSwapping={disableSwapping}\n disableVHBounds={disableVHBounds}\n preventScroll={preventScroll}\n closeOnResize={closeOnResize}\n closeOnScroll={closeOnScroll}\n getFixedPositionOptions={getFixedPositionOptions}\n horizontal={horizontal}\n sheetHeader={sheetHeader}\n sheetFooter={sheetFooter}\n renderAsSheet={renderAsSheet}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n {...menuProps}\n fixedTo={fixedTo}\n visible={visible}\n getDefaultFocusedIndex={(options) => {\n const defaultIndex = defaultFocusIndex.current;\n if (defaultIndex < 0) {\n return getLastFocusableIndex(options);\n }\n\n return defaultIndex;\n }}\n onRequestClose={onRequestClose}\n onEntered={(appearing) => {\n menuProps?.onEntered?.(appearing);\n // this will be called before `getDefaultFocusedIndex`\n if (disableTransition) {\n return;\n }\n\n defaultFocusIndex.current = 0;\n }}\n >\n {children}\n </Menu>\n </MenuVisibilityProvider>\n );\n}\n"],"names":["useCallback","useRef","useUserInteractionMode","getLastFocusableIndex","useEnsuredId","useEnsuredState","Menu","MenuButton","MenuConfigurationProvider","MenuItemButton","MenuVisibilityProvider","useMenuBarContext","DropdownMenu","props","id","propId","horizontal","sheetHeader","sheetFooter","renderAsSheet","sheetPosition","sheetVerticalSize","buttonChildren","iconRotatorProps","propIconRotatorProps","disableTransition","propDisableTransition","floating","anchor","vwMargin","vhMargin","xMargin","yMargin","initialX","initialY","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","preventScroll","closeOnResize","closeOnScroll","getFixedPositionOptions","children","temporary","disablePortal","disableElevation","menuProps","menuStyle","menuClassName","sheetProps","sheetStyle","sheetClassName","visible","propVisible","setVisible","propSetVisible","remaining","fixedTo","defaultFocusIndex","value","setValue","defaultValue","menubar","menuitem","activeIdRef","animatedOnceRef","mode","mouse","keyboard","current","onRequestClose","toggle","ref","aria-labelledby","undefined","style","className","getDefaultFocusedIndex","options","defaultIndex","onEntered","appearing"],"mappings":"AAAA;;AAEA,SAIEA,WAAW,EACXC,MAAM,QACD,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,qBAAqB,QAAQ,uBAAuB;AAE7D,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,eAAe,QAAQ,wBAAwB;AACxD,SACEC,IAAI,QAGC,YAAY;AACnB,SAASC,UAAU,QAA8B,kBAAkB;AACnE,SAEEC,yBAAyB,QACpB,iCAAiC;AACxC,SAASC,cAAc,QAAkC,sBAAsB;AAE/E,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,iBAAiB,QAAQ,0BAA0B;AAoC5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsDC,GACD,OAAO,SAASC,aAAaC,KAAwB;IACnD,MAAM,EACJC,IAAIC,MAAM,EACVC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXC,aAAa,EACbC,aAAa,EACbC,iBAAiB,EACjBC,cAAc,EACdC,kBAAkBC,oBAAoB,EACtCC,mBAAmBC,qBAAqB,EACxCC,QAAQ,EACRC,MAAM,EACNC,QAAQ,EACRC,QAAQ,EACRC,OAAO,EACPC,OAAO,EACPC,QAAQ,EACRC,QAAQ,EACRC,KAAK,EACLC,eAAe,EACfC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,aAAa,EACbC,aAAa,EACbC,aAAa,EACbC,uBAAuB,EACvBC,QAAQ,EACRC,SAAS,EACTC,aAAa,EACbC,gBAAgB,EAChBC,SAAS,EACTC,SAAS,EACTC,aAAa,EACbC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,SAASC,WAAW,EACpBC,YAAYC,cAAc,EAC1B,GAAGC,WACJ,GAAG7C;IAEJ,MAAM8C,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BACZC,gBAAgBA;gBAChBR,WAAWA;gBACXC,eAAeA;gBACfC,kBAAkBA;gBAClBtB,mBAAmBA;gBACnBE,UAAUA;gBACVC,QAAQA;gBACRC,UAAUA;gBACVC,UAAUA;gBACVC,SAASA;gBACTC,SAASA;gBACTC,UAAUA;gBACVC,UAAUA;gBACVC,OAAOA;gBACPC,iBAAiBA;gBACjBC,gBAAgBA;gBAChBC,iBAAiBA;gBACjBC,iBAAiBA;gBACjBC,eAAeA;gBACfC,eAAeA;gBACfC,eAAeA;gBACfC,yBAAyBA;gBACzB3B,YAAYA;gBACZC,aAAaA;gBACbC,aAAaA;gBACbC,eAAeA;gBACfC,eAAeA;gBACfC,mBAAmBA;gBAClB,GAAG2B,SAAS;gBACbW,SAASA;gBACTL,SAASA;gBACTyB,wBAAwB,CAACC;oBACvB,MAAMC,eAAerB,kBAAkBW,OAAO;oBAC9C,IAAIU,eAAe,GAAG;wBACpB,OAAO9E,sBAAsB6E;oBAC/B;oBAEA,OAAOC;gBACT;gBACAT,gBAAgBA;gBAChBU,WAAW,CAACC;oBACVnC,WAAWkC,YAAYC;oBACvB,sDAAsD;oBACtD,IAAI1D,mBAAmB;wBACrB;oBACF;oBAEAmC,kBAAkBW,OAAO,GAAG;gBAC9B;0BAEC3B;;;;AAIT"}
|
|
1
|
+
{"version":3,"sources":["../../src/menu/DropdownMenu.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ReactElement,\n type ReactNode,\n type RefObject,\n useCallback,\n useRef,\n} from \"react\";\n\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { getLastFocusableIndex } from \"../movement/utils.js\";\nimport { type UseStateSetter } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useEnsuredState } from \"../useEnsuredState.js\";\nimport {\n Menu,\n type MenuConvenienceProps,\n type MenuListConvenienceProps,\n} from \"./Menu.js\";\nimport { MenuButton, type MenuButtonProps } from \"./MenuButton.js\";\nimport {\n type MenuConfiguration,\n MenuConfigurationProvider,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuItemButton, type MenuItemButtonProps } from \"./MenuItemButton.js\";\nimport { type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuVisibilityProvider } from \"./MenuVisibilityProvider.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\n\nexport interface BaseDropdownMenuProps\n extends MenuConfiguration,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps,\n MenuConvenienceProps {\n buttonChildren: ReactNode;\n}\n\nexport interface DropdownMenuButtonProps\n extends MenuButtonProps,\n BaseDropdownMenuProps {}\n\nexport interface DropdownMenuItemButtonProps\n extends MenuItemButtonProps,\n BaseDropdownMenuProps {}\n\n/**\n * @since 6.0.0\n */\nexport interface DropdownMenuStateProps {\n visible: boolean;\n setVisible: UseStateSetter<boolean>;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use an `&` instead of `|` to allow autocompletion to\n * work better by default. It's up to the user to make sure they don't provide\n * incorrect props.\n */\nexport type DropdownMenuProps = DropdownMenuButtonProps &\n DropdownMenuItemButtonProps &\n (DropdownMenuStateProps | { visible?: never; setVisible?: never });\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @example Nested Dropdown Menus\n * ```tsx\n * import type { ReactElement } from \"react\";\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\n *\n * function Example() {\n * return (\n * <DropdownMenu buttonChildren=\"Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Item 2\n * </MenuItem>\n * <DropdownMenu buttonChildren=\"Nested Dropdown\">\n * <MenuItem onClick={() => console.log('Clicked Item 1')}>\n * Nested Item 1\n * </MenuItem>\n * <MenuItem onClick={() => console.log('Clicked Item 2')}>\n * Nested Item 2\n * </MenuItem>\n * </DropdownMenu>\n * </DropdownMenu>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest menu API.\n */\nexport function DropdownMenu(props: DropdownMenuProps): ReactElement {\n const {\n id: propId,\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n buttonChildren,\n iconRotatorProps: propIconRotatorProps,\n disableTransition: propDisableTransition,\n floating,\n anchor,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n initialX,\n initialY,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n preventScroll,\n closeOnResize,\n closeOnScroll,\n getFixedPositionOptions,\n children,\n temporary,\n disablePortal,\n disableElevation,\n menuProps,\n menuStyle,\n menuClassName,\n sheetProps,\n sheetStyle,\n sheetClassName,\n visible: propVisible,\n setVisible: propSetVisible,\n ...remaining\n } = props;\n\n const fixedTo = useRef<HTMLElement | HTMLButtonElement>(null);\n const defaultFocusIndex = useRef(0);\n const [visible, setVisible] = useEnsuredState({\n name: \"visible\",\n value: propVisible,\n setValue: propSetVisible,\n defaultValue: false,\n });\n const { menubar, menuitem, activeIdRef, animatedOnceRef } =\n useMenuBarContext();\n const id = useEnsuredId(propId, `menu${menuitem ? \"item\" : \"button\"}`);\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n const keyboard = mode === \"keyboard\";\n const disableTransition =\n propDisableTransition ??\n (animatedOnceRef.current &&\n menubar &&\n !!activeIdRef.current &&\n (mouse || keyboard));\n\n const onRequestClose = useCallback(() => {\n setVisible(false);\n }, [setVisible]);\n\n let iconRotatorProps = propIconRotatorProps;\n if (disableTransition) {\n iconRotatorProps = {\n disableTransition,\n ...propIconRotatorProps,\n };\n }\n\n let toggle: ReactElement;\n if (menuitem) {\n toggle = (\n <MenuItemButton\n {...(remaining as DropdownMenuItemButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLLIElement>}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuItemButton>\n );\n } else {\n toggle = (\n <MenuButton\n {...(remaining as DropdownMenuButtonProps)}\n id={id}\n ref={fixedTo as RefObject<HTMLButtonElement>}\n floating={floating}\n iconRotatorProps={iconRotatorProps}\n >\n {buttonChildren}\n </MenuButton>\n );\n }\n\n return (\n <MenuVisibilityProvider\n visible={visible}\n setVisible={setVisible}\n defaultFocusIndex={defaultFocusIndex}\n >\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n {toggle}\n </MenuConfigurationProvider>\n <Menu\n aria-labelledby={(menuProps?.[\"aria-label\"] ? undefined : id) as string}\n style={menuStyle}\n className={menuClassName}\n sheetProps={sheetProps}\n sheetStyle={sheetStyle}\n sheetClassName={sheetClassName}\n temporary={temporary}\n disablePortal={disablePortal}\n disableElevation={disableElevation}\n disableTransition={disableTransition}\n floating={floating}\n anchor={anchor}\n vwMargin={vwMargin}\n vhMargin={vhMargin}\n xMargin={xMargin}\n yMargin={yMargin}\n initialX={initialX}\n initialY={initialY}\n width={width}\n transformOrigin={transformOrigin}\n preventOverlap={preventOverlap}\n disableSwapping={disableSwapping}\n disableVHBounds={disableVHBounds}\n preventScroll={preventScroll}\n closeOnResize={closeOnResize}\n closeOnScroll={closeOnScroll}\n getFixedPositionOptions={getFixedPositionOptions}\n horizontal={horizontal}\n sheetHeader={sheetHeader}\n sheetFooter={sheetFooter}\n renderAsSheet={renderAsSheet}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n {...menuProps}\n fixedTo={fixedTo}\n visible={visible}\n getDefaultFocusedIndex={(options) => {\n const defaultIndex = defaultFocusIndex.current;\n if (defaultIndex < 0) {\n return getLastFocusableIndex(options);\n }\n\n return defaultIndex;\n }}\n onRequestClose={onRequestClose}\n onEntered={(appearing) => {\n menuProps?.onEntered?.(appearing);\n // this will be called before `getDefaultFocusedIndex`\n if (disableTransition) {\n return;\n }\n\n defaultFocusIndex.current = 0;\n }}\n >\n {children}\n </Menu>\n </MenuVisibilityProvider>\n );\n}\n"],"names":["useCallback","useRef","useUserInteractionMode","getLastFocusableIndex","useEnsuredId","useEnsuredState","Menu","MenuButton","MenuConfigurationProvider","MenuItemButton","MenuVisibilityProvider","useMenuBarContext","DropdownMenu","props","id","propId","horizontal","sheetHeader","sheetFooter","renderAsSheet","sheetPosition","sheetVerticalSize","buttonChildren","iconRotatorProps","propIconRotatorProps","disableTransition","propDisableTransition","floating","anchor","vwMargin","vhMargin","xMargin","yMargin","initialX","initialY","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","preventScroll","closeOnResize","closeOnScroll","getFixedPositionOptions","children","temporary","disablePortal","disableElevation","menuProps","menuStyle","menuClassName","sheetProps","sheetStyle","sheetClassName","visible","propVisible","setVisible","propSetVisible","remaining","fixedTo","defaultFocusIndex","name","value","setValue","defaultValue","menubar","menuitem","activeIdRef","animatedOnceRef","mode","mouse","keyboard","current","onRequestClose","toggle","ref","aria-labelledby","undefined","style","className","getDefaultFocusedIndex","options","defaultIndex","onEntered","appearing"],"mappings":"AAAA;;AAEA,SAIEA,WAAW,EACXC,MAAM,QACD,QAAQ;AAEf,SAASC,sBAAsB,QAAQ,gDAAgD;AACvF,SAASC,qBAAqB,QAAQ,uBAAuB;AAE7D,SAASC,YAAY,QAAQ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A;gBACjBC,iBAAiBA;gBACjBC,eAAeA;gBACfC,eAAeA;gBACfC,eAAeA;gBACfC,yBAAyBA;gBACzB3B,YAAYA;gBACZC,aAAaA;gBACbC,aAAaA;gBACbC,eAAeA;gBACfC,eAAeA;gBACfC,mBAAmBA;gBAClB,GAAG2B,SAAS;gBACbW,SAASA;gBACTL,SAASA;gBACT0B,wBAAwB,CAACC;oBACvB,MAAMC,eAAetB,kBAAkBY,OAAO;oBAC9C,IAAIU,eAAe,GAAG;wBACpB,OAAO/E,sBAAsB8E;oBAC/B;oBAEA,OAAOC;gBACT;gBACAT,gBAAgBA;gBAChBU,WAAW,CAACC;oBACVpC,WAAWmC,YAAYC;oBACvB,sDAAsD;oBACtD,IAAI3D,mBAAmB;wBACrB;oBACF;oBAEAmC,kBAAkBY,OAAO,GAAG;gBAC9B;0BAEC5B;;;;AAIT"}
|
package/dist/menu/Menu.d.ts
CHANGED
|
@@ -182,7 +182,7 @@ export interface MenuProps extends HTMLAttributes<HTMLDivElement>, MenuConfigura
|
|
|
182
182
|
*
|
|
183
183
|
* @see The `useContextMenu` hook for an example.
|
|
184
184
|
*
|
|
185
|
-
* @see {@link https://
|
|
185
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
186
186
|
* @since 5.0.0
|
|
187
187
|
* @since 6.0.0 Updated this component to implement all the `Menu`
|
|
188
188
|
* functionality instead of requiring the `useMenu` hook and `MenuWidget`
|
package/dist/menu/Menu.js
CHANGED
|
@@ -28,7 +28,7 @@ const noop = ()=>{
|
|
|
28
28
|
*
|
|
29
29
|
* @see The `useContextMenu` hook for an example.
|
|
30
30
|
*
|
|
31
|
-
* @see {@link https://
|
|
31
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
32
32
|
* @since 5.0.0
|
|
33
33
|
* @since 6.0.0 Updated this component to implement all the `Menu`
|
|
34
34
|
* functionality instead of requiring the `useMenu` hook and `MenuWidget`
|
package/dist/menu/Menu.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\n\nimport { type FloatingActionButtonPosition } from \"../button/FloatingActionButton.js\";\nimport { useFocusContainer } from \"../focus/useFocusContainer.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type ListElement, type ListProps } from \"../list/List.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { type CalculateFixedPositionOptions } from \"../positioning/types.js\";\nimport {\n type FixedPositioningOptions,\n useFixedPositioning,\n} from \"../positioning/useFixedPositioning.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n type ScaleTransitionHookOptions,\n useScaleTransition,\n} from \"../transition/useScaleTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n type MenuConfiguration,\n MenuConfigurationProvider,\n type MenuOrientationProps,\n useMenuConfiguration,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuSheet, type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuWidget } from \"./MenuWidget.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\nimport { getDefaultAnchor } from \"./utils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-menu-background-color\"?: string;\n \"--rmd-menu-color\"?: string;\n \"--rmd-menu-min-width\"?: string | number;\n \"--rmd-menu-spacing\"?: string | number;\n }\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuTransitionProps = Omit<\n ScaleTransitionHookOptions<HTMLDivElement>,\n \"transitionIn\" | \"vertical\" | \"nodeRef\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConfigurationProps extends CalculateFixedPositionOptions {\n /**\n * @see {@link ScaleTransitionHookOptions.temporary}\n * @defaultValue `true`\n */\n temporary?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Boolean if the menu should not gain the elevation styles and should only be\n * set to `true` when rendering within a `Sheet`.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @see {@link FixedPositioningOptions.transformOrigin}\n * @defaultValue `true`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the menu should close if the page is scrolled. The default\n * behavior is to just update the position of the menu relative to the menu\n * button until it can no longer be visible within the viewport.\n *\n * @defaultValue `false`\n */\n closeOnScroll?: boolean;\n\n /**\n * Boolean if the page should no longer be scrollable while the menu is\n * visible.\n *\n * @defaultValue `false`\n */\n preventScroll?: boolean;\n\n /**\n * Boolean if the menu should close instead of repositioning itself if the\n * browser window is resized.\n *\n * @defaultValue `false`\n */\n closeOnResize?: boolean;\n\n /** @see {@link FixedPositioningOptions.getFixedPositionOptions} */\n getFixedPositionOptions?: () => CalculateFixedPositionOptions;\n\n /**\n * @defaultValue `false`\n * @see {@link FixedPositioningOptions.disabled}\n */\n disableFixedPositioning?: boolean;\n}\n\n/**\n * @since 5.1.0\n * @since 6.0.0 Renamed from `MenuListProps` to `MenuListConvenienceProps`\n */\nexport interface MenuListConvenienceProps {\n /**\n * An optional style to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listStyle?: CSSProperties;\n\n /**\n * An optional className to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listClassName?: string;\n\n /**\n * Any additional props to pass to the `List` component that surrounds the\n * `Menu`'s `MenuItem`s.\n */\n listProps?: PropsWithRef<Omit<ListProps, \"horizontal\">, ListElement>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConvenienceProps extends MenuConfigurationProps {\n /**\n * This can be used to apply additional props to the `Menu` component.\n *\n * Note: You can override the `style` and `className` using\n * {@link menuStyle} and {@link menuClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <DropdownMenu\n * {...props}\n * menuProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * getFixedPositionOptions: () => ({\n * preventOverlap: true,\n * }),\n * }}\n * />\n * ```\n */\n menuProps?: PropsWithRef<\n Omit<\n MenuProps,\n | \"children\"\n | \"fixedTo\"\n | \"visible\"\n | \"onRequestClose\"\n | \"getDefaultFocusedIndex\"\n >,\n HTMLDivElement\n >;\n\n /**\n * Convenience prop to apply custom style to the `Menu` component.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Menu` component.\n */\n menuClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport type MenuFixedPositioningOptions = Omit<\n FixedPositioningOptions<HTMLElement, HTMLDivElement>,\n \"onScroll\" | \"onResize\" | \"nodeRef\" | \"disabled\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest Menu, Transition, and Portal API.\n */\nexport interface MenuProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuConfiguration,\n MenuConfigurationProps,\n MenuFixedPositioningOptions,\n MenuOrientationProps,\n MenuTransitionProps,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps {\n visible: boolean;\n onRequestClose: () => void;\n\n /**\n * @defaultValue `\"menu-\" + useId()`\n */\n id?: string;\n\n /**\n * This is used to set the default focus index when the menu is visible.\n *\n * @internal\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * Custom style that should be applied to the menu only while not rendered\n * within a sheet since the {@link style} would be applied to both versions.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Custom class name that should be applied only while not rendered within a\n * sheet.\n */\n menuClassName?: string;\n\n /**\n * @internal\n *\n * This is only used to update the default anchor when the DropdownMenu's\n * toggle is a floating action button.\n */\n floating?: FloatingActionButtonPosition;\n}\n\n/**\n * **Client Component**\n *\n * This component should generally only be used to implement context menus with\n * the `useContextMenu` hook. Otherwise, the `DropdownMenu` component should be\n * used.\n *\n * @see The `useContextMenu` hook for an example.\n *\n * @see {@link https://next.react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n * @since 6.0.0 Updated this component to implement all the `Menu`\n * functionality instead of requiring the `useMenu` hook and `MenuWidget`\n * component. In addition, the `renderAsSheet` behavior has been moved into this\n * implementation so that the `MenuRenderer` is no longer required and context\n * menus can appear as a `Sheet`.\n */\nexport const Menu = forwardRef<HTMLDivElement, LabelRequiredForA11y<MenuProps>>(\n function Menu(props, propRef) {\n const {\n id: propId,\n style: propStyle,\n role = \"menu\",\n children,\n horizontal: _horizontal,\n sheetHeader: _sheetHeader,\n sheetFooter: _sheetFooter,\n renderAsSheet: _renderAsSheet,\n sheetPosition: _sheetPosition,\n sheetVerticalSize: _sheetVerticalSize,\n sheetProps,\n sheetStyle,\n sheetClassName,\n menuStyle,\n menuClassName,\n disableElevation = false,\n temporary = true,\n tabIndex = -1,\n fixedTo,\n className,\n classNames,\n timeout,\n appear,\n enter,\n exit,\n onEnter,\n onEntering = noop,\n onEntered = noop,\n onExit,\n onExiting,\n onExited = noop,\n onKeyDown = noop,\n listProps,\n listStyle,\n listClassName,\n visible,\n onRequestClose,\n floating,\n anchor,\n closeOnResize = false,\n closeOnScroll = false,\n preventScroll = false,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin = true,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n disableFixedPositioning,\n getFixedPositionOptions,\n disablePortal: propDisablePortal,\n disableTransition,\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } =\n props;\n\n const id = useEnsuredId(propId, \"menu\");\n const {\n root,\n menubar,\n menuitem,\n activeId,\n animatedOnceRef,\n hoverTimeoutRef,\n disableHoverMode,\n } = useMenuBarContext();\n const {\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(props);\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const entered = useRef(false);\n const cancelUnmountFocus = useRef(false);\n const hideWithoutRefocus = (): void => {\n cancelUnmountFocus.current = true;\n onRequestClose();\n };\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: propRef,\n activate: visible,\n onKeyDown(event) {\n onKeyDown(event);\n\n // when a menu is within a sheet, it should not trigger the custom\n // keyboard behavior\n if (isSheet) {\n return;\n }\n\n switch (event.key) {\n case \"Escape\":\n // prevent parent components that have an \"Escape\" keypress event\n // from being triggered as well\n event.stopPropagation();\n disableHoverMode();\n onRequestClose();\n break;\n case \"Tab\":\n // since menus are portalled, tab index is kinda broke so just close\n // the menu instead of doing default tab behavior\n event.preventDefault();\n\n if (!menuitem) {\n // pressing the tab key should still cascade close all menus\n event.stopPropagation();\n }\n disableHoverMode();\n onRequestClose();\n break;\n case \"ArrowUp\":\n if (!root && menuitem && horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n case \"ArrowLeft\":\n if (!root && menuitem && !horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n }\n },\n onEntering(appearing) {\n onEntering(appearing);\n entered.current = true;\n },\n onEntered(appearing) {\n onEntered(appearing);\n entered.current = true;\n cancelUnmountFocus.current = false;\n animatedOnceRef.current = true;\n },\n onExited() {\n onExited();\n entered.current = false;\n },\n onExiting,\n disableTransition,\n isFocusTypeDisabled(type) {\n if (role === \"listbox\") {\n return !isSheet;\n }\n\n if (type === \"keyboard\") {\n return isSheet;\n }\n\n const isHoverDisabled = mouse && hoverTimeoutRef.current === 0;\n if (type === \"mount\") {\n return isHoverDisabled;\n }\n\n return (\n isHoverDisabled ||\n cancelUnmountFocus.current ||\n (root && !!activeId && id !== activeId)\n );\n },\n });\n\n const { ref, style, callbacks, updateStyle } = useFixedPositioning({\n ...transitionOptions,\n disabled: disableFixedPositioning,\n onEnter,\n style: isSheet ? propStyle : menuStyle,\n fixedTo,\n anchor: getDefaultAnchor({\n anchor,\n menubar,\n floating,\n menuitem: !root && menuitem,\n horizontal,\n }),\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n onResize: closeOnResize ? hideWithoutRefocus : undefined,\n onScroll(_event, data) {\n if (!data.visible || closeOnScroll) {\n hideWithoutRefocus();\n }\n },\n });\n const { rendered, disablePortal, elementProps } = useScaleTransition({\n nodeRef: ref,\n className: cnb(!isSheet && menuClassName, className),\n transitionIn: visible,\n vertical: !horizontal,\n temporary,\n timeout: isSheet || disableTransition ? 0 : timeout,\n classNames,\n appear,\n enter,\n exit,\n onExit,\n onExiting: transitionOptions.onExiting,\n exitedHidden: true,\n ...callbacks,\n });\n useScrollLock(visible && preventScroll);\n\n // need to make sure that the useEffect does not refire for hiding on click\n // events because of the `window.requestAnimationFrame`. It'll make it so\n // that menu items that update state are unable to close when clicked\n const hide = useRef(onRequestClose);\n useEffect(() => {\n hide.current = onRequestClose;\n });\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const callback = (event: globalThis.MouseEvent): void => {\n // this is required for when the transition is disabled\n if (!entered.current) {\n return;\n }\n\n // if the user clicks outside of the menu to close it, the toggle button\n // should not be focused. instead the nearest focusable element from the\n // click event should be focused when Tab or Shift + tab is pressed\n cancelUnmountFocus.current =\n !(event.target instanceof HTMLElement) ||\n !event.target.closest(`[role=\"${role}\"]`);\n\n // this won't be called if `event.stopPropagation()` is called\n hide.current();\n disableHoverMode();\n };\n\n // wait an animation frame so the initial click event that caused the menu\n // to become visible does not immediately close the menu\n const frame = window.requestAnimationFrame(() => {\n window.addEventListener(\"click\", callback);\n });\n\n return () => {\n window.cancelAnimationFrame(frame);\n window.removeEventListener(\"click\", callback);\n };\n }, [disableHoverMode, role, visible]);\n useIsomorphicLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n updateStyle();\n }, [updateStyle, children, visible]);\n\n return (\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n <MenuSheet\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy as string}\n header={sheetHeader}\n footer={sheetFooter}\n position={sheetPosition}\n verticalSize={sheetVerticalSize}\n visible={visible}\n enabled={isSheet}\n onRequestClose={onRequestClose}\n style={sheetStyle}\n className={sheetClassName}\n disablePortal={propDisablePortal}\n temporary={temporary}\n disableTransition={disableTransition}\n {...sheetProps}\n >\n <Portal disabled={isSheet || (propDisablePortal ?? disablePortal)}>\n {(rendered || isSheet) && (\n <MenuWidget\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n style={isSheet ? propStyle : style}\n isSheet={isSheet}\n tabIndex={tabIndex}\n horizontal={horizontal}\n listProps={listProps}\n listStyle={listStyle}\n listClassName={listClassName}\n disableElevation={disableElevation}\n cancelUnmountFocus={cancelUnmountFocus}\n >\n {children}\n </MenuWidget>\n )}\n </Portal>\n </MenuSheet>\n </MenuConfigurationProvider>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEffect","useRef","useFocusContainer","useUserInteractionMode","useAppSize","Portal","useFixedPositioning","useScrollLock","useScaleTransition","useEnsuredId","useIsomorphicLayoutEffect","MenuConfigurationProvider","useMenuConfiguration","MenuSheet","MenuWidget","useMenuBarContext","getDefaultAnchor","noop","Menu","props","propRef","id","propId","style","propStyle","role","children","horizontal","_horizontal","sheetHeader","_sheetHeader","sheetFooter","_sheetFooter","renderAsSheet","_renderAsSheet","sheetPosition","_sheetPosition","sheetVerticalSize","_sheetVerticalSize","sheetProps","sheetStyle","sheetClassName","menuStyle","menuClassName","disableElevation","temporary","tabIndex","fixedTo","className","classNames","timeout","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","listProps","listStyle","listClassName","visible","onRequestClose","floating","anchor","closeOnResize","closeOnScroll","preventScroll","vwMargin","vhMargin","xMargin","yMargin","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","initialX","initialY","disableFixedPositioning","getFixedPositionOptions","disablePortal","propDisablePortal","disableTransition","remaining","ariaLabel","ariaLabelledBy","root","menubar","menuitem","activeId","animatedOnceRef","hoverTimeoutRef","disableHoverMode","isPhone","isSheet","entered","cancelUnmountFocus","hideWithoutRefocus","current","mode","mouse","eventHandlers","transitionOptions","nodeRef","activate","event","key","stopPropagation","preventDefault","appearing","isFocusTypeDisabled","type","isHoverDisabled","ref","callbacks","updateStyle","disabled","onResize","undefined","onScroll","_event","data","rendered","elementProps","transitionIn","vertical","exitedHidden","hide","callback","target","HTMLElement","closest","frame","window","requestAnimationFrame","addEventListener","cancelAnimationFrame","removeEventListener","aria-label","aria-labelledby","header","footer","position","verticalSize","enabled"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAGEC,UAAU,EACVC,SAAS,EACTC,MAAM,QACD,QAAQ;AAGf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAEEC,mBAAmB,QACd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAEEC,kBAAkB,QACb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAEEC,yBAAyB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nB,cAAA,KAACxB;YACCiI,cAAYtD;YACZuD,mBAAiBtD;YACjBuD,QAAQnH;YACRoH,QAAQlH;YACRmH,UAAU/G;YACVgH,cAAc9G;YACd2B,SAASA;YACToF,SAASlD;YACTjC,gBAAgBA;YAChB1C,OAAOiB;YACPQ,WAAWP;YACX2C,eAAeC;YACfxC,WAAWA;YACXyC,mBAAmBA;YAClB,GAAG/C,UAAU;sBAEd,cAAA,KAAClC;gBAAOmH,UAAUtB,WAAYb,CAAAA,qBAAqBD,aAAY;0BAC5D,AAAC0C,CAAAA,YAAY5B,OAAM,mBAClB,KAACpF;oBACE,GAAGyE,SAAS;oBACZ,GAAGwC,YAAY;oBACf,GAAGtB,aAAa;oBACjBpF,IAAIA;oBACJI,MAAMA;oBACNF,OAAO2E,UAAU1E,YAAYD;oBAC7B2E,SAASA;oBACTpD,UAAUA;oBACVnB,YAAYA;oBACZkC,WAAWA;oBACXC,WAAWA;oBACXC,eAAeA;oBACfnB,kBAAkBA;oBAClBwD,oBAAoBA;8BAEnB1E;;;;;AAOf,GACA"}
|
|
1
|
+
{"version":3,"sources":["../../src/menu/Menu.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport {\n type CSSProperties,\n type HTMLAttributes,\n forwardRef,\n useEffect,\n useRef,\n} from \"react\";\n\nimport { type FloatingActionButtonPosition } from \"../button/FloatingActionButton.js\";\nimport { useFocusContainer } from \"../focus/useFocusContainer.js\";\nimport { useUserInteractionMode } from \"../interaction/UserInteractionModeProvider.js\";\nimport { type ListElement, type ListProps } from \"../list/List.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { type GetDefaultFocusedIndex } from \"../movement/types.js\";\nimport { Portal } from \"../portal/Portal.js\";\nimport { type CalculateFixedPositionOptions } from \"../positioning/types.js\";\nimport {\n type FixedPositioningOptions,\n useFixedPositioning,\n} from \"../positioning/useFixedPositioning.js\";\nimport { useScrollLock } from \"../scroll/useScrollLock.js\";\nimport {\n type ScaleTransitionHookOptions,\n useScaleTransition,\n} from \"../transition/useScaleTransition.js\";\nimport { type LabelRequiredForA11y, type PropsWithRef } from \"../types.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useIsomorphicLayoutEffect } from \"../useIsomorphicLayoutEffect.js\";\nimport {\n type MenuConfiguration,\n MenuConfigurationProvider,\n type MenuOrientationProps,\n useMenuConfiguration,\n} from \"./MenuConfigurationProvider.js\";\nimport { MenuSheet, type MenuSheetConvenienceProps } from \"./MenuSheet.js\";\nimport { MenuWidget } from \"./MenuWidget.js\";\nimport { useMenuBarContext } from \"./useMenuBarProvider.js\";\nimport { getDefaultAnchor } from \"./utils.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-menu-background-color\"?: string;\n \"--rmd-menu-color\"?: string;\n \"--rmd-menu-min-width\"?: string | number;\n \"--rmd-menu-spacing\"?: string | number;\n }\n}\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuTransitionProps = Omit<\n ScaleTransitionHookOptions<HTMLDivElement>,\n \"transitionIn\" | \"vertical\" | \"nodeRef\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConfigurationProps extends CalculateFixedPositionOptions {\n /**\n * @see {@link ScaleTransitionHookOptions.temporary}\n * @defaultValue `true`\n */\n temporary?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disablePortal?: boolean;\n\n /**\n * Boolean if the menu should not gain the elevation styles and should only be\n * set to `true` when rendering within a `Sheet`.\n *\n * @defaultValue `false`\n */\n disableElevation?: boolean;\n\n /**\n * @defaultValue `false`\n */\n disableTransition?: boolean;\n\n /**\n * @see {@link FixedPositioningOptions.transformOrigin}\n * @defaultValue `true`\n */\n transformOrigin?: boolean;\n\n /**\n * Boolean if the menu should close if the page is scrolled. The default\n * behavior is to just update the position of the menu relative to the menu\n * button until it can no longer be visible within the viewport.\n *\n * @defaultValue `false`\n */\n closeOnScroll?: boolean;\n\n /**\n * Boolean if the page should no longer be scrollable while the menu is\n * visible.\n *\n * @defaultValue `false`\n */\n preventScroll?: boolean;\n\n /**\n * Boolean if the menu should close instead of repositioning itself if the\n * browser window is resized.\n *\n * @defaultValue `false`\n */\n closeOnResize?: boolean;\n\n /** @see {@link FixedPositioningOptions.getFixedPositionOptions} */\n getFixedPositionOptions?: () => CalculateFixedPositionOptions;\n\n /**\n * @defaultValue `false`\n * @see {@link FixedPositioningOptions.disabled}\n */\n disableFixedPositioning?: boolean;\n}\n\n/**\n * @since 5.1.0\n * @since 6.0.0 Renamed from `MenuListProps` to `MenuListConvenienceProps`\n */\nexport interface MenuListConvenienceProps {\n /**\n * An optional style to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listStyle?: CSSProperties;\n\n /**\n * An optional className to provide to the `List` component that surrounds the\n * `MenuItem` within a `Menu`.\n */\n listClassName?: string;\n\n /**\n * Any additional props to pass to the `List` component that surrounds the\n * `Menu`'s `MenuItem`s.\n */\n listProps?: PropsWithRef<Omit<ListProps, \"horizontal\">, ListElement>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface MenuConvenienceProps extends MenuConfigurationProps {\n /**\n * This can be used to apply additional props to the `Menu` component.\n *\n * Note: You can override the `style` and `className` using\n * {@link menuStyle} and {@link menuClassName} instead for convenience.\n *\n * @example\n * ```tsx\n * <DropdownMenu\n * {...props}\n * menuProps={{\n * style: {\n * // custom inline style\n * },\n * className: \"come-class-name\",\n * getFixedPositionOptions: () => ({\n * preventOverlap: true,\n * }),\n * }}\n * />\n * ```\n */\n menuProps?: PropsWithRef<\n Omit<\n MenuProps,\n | \"children\"\n | \"fixedTo\"\n | \"visible\"\n | \"onRequestClose\"\n | \"getDefaultFocusedIndex\"\n >,\n HTMLDivElement\n >;\n\n /**\n * Convenience prop to apply custom style to the `Menu` component.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Convenience prop to apply custom class name to the `Menu` component.\n */\n menuClassName?: string;\n}\n\n/**\n * @since 6.0.0\n */\nexport type MenuFixedPositioningOptions = Omit<\n FixedPositioningOptions<HTMLElement, HTMLDivElement>,\n \"onScroll\" | \"onResize\" | \"nodeRef\" | \"disabled\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 Updated to use the latest Menu, Transition, and Portal API.\n */\nexport interface MenuProps\n extends HTMLAttributes<HTMLDivElement>,\n MenuConfiguration,\n MenuConfigurationProps,\n MenuFixedPositioningOptions,\n MenuOrientationProps,\n MenuTransitionProps,\n MenuListConvenienceProps,\n MenuSheetConvenienceProps {\n visible: boolean;\n onRequestClose: () => void;\n\n /**\n * @defaultValue `\"menu-\" + useId()`\n */\n id?: string;\n\n /**\n * This is used to set the default focus index when the menu is visible.\n *\n * @internal\n */\n getDefaultFocusedIndex?: GetDefaultFocusedIndex;\n\n /**\n * Custom style that should be applied to the menu only while not rendered\n * within a sheet since the {@link style} would be applied to both versions.\n */\n menuStyle?: CSSProperties;\n\n /**\n * Custom class name that should be applied only while not rendered within a\n * sheet.\n */\n menuClassName?: string;\n\n /**\n * @internal\n *\n * This is only used to update the default anchor when the DropdownMenu's\n * toggle is a floating action button.\n */\n floating?: FloatingActionButtonPosition;\n}\n\n/**\n * **Client Component**\n *\n * This component should generally only be used to implement context menus with\n * the `useContextMenu` hook. Otherwise, the `DropdownMenu` component should be\n * used.\n *\n * @see The `useContextMenu` hook for an example.\n *\n * @see {@link https://react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n * @since 6.0.0 Updated this component to implement all the `Menu`\n * functionality instead of requiring the `useMenu` hook and `MenuWidget`\n * component. In addition, the `renderAsSheet` behavior has been moved into this\n * implementation so that the `MenuRenderer` is no longer required and context\n * menus can appear as a `Sheet`.\n */\nexport const Menu = forwardRef<HTMLDivElement, LabelRequiredForA11y<MenuProps>>(\n function Menu(props, propRef) {\n const {\n id: propId,\n style: propStyle,\n role = \"menu\",\n children,\n horizontal: _horizontal,\n sheetHeader: _sheetHeader,\n sheetFooter: _sheetFooter,\n renderAsSheet: _renderAsSheet,\n sheetPosition: _sheetPosition,\n sheetVerticalSize: _sheetVerticalSize,\n sheetProps,\n sheetStyle,\n sheetClassName,\n menuStyle,\n menuClassName,\n disableElevation = false,\n temporary = true,\n tabIndex = -1,\n fixedTo,\n className,\n classNames,\n timeout,\n appear,\n enter,\n exit,\n onEnter,\n onEntering = noop,\n onEntered = noop,\n onExit,\n onExiting,\n onExited = noop,\n onKeyDown = noop,\n listProps,\n listStyle,\n listClassName,\n visible,\n onRequestClose,\n floating,\n anchor,\n closeOnResize = false,\n closeOnScroll = false,\n preventScroll = false,\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin = true,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n disableFixedPositioning,\n getFixedPositionOptions,\n disablePortal: propDisablePortal,\n disableTransition,\n ...remaining\n } = props;\n const { \"aria-label\": ariaLabel, \"aria-labelledby\": ariaLabelledBy } =\n props;\n\n const id = useEnsuredId(propId, \"menu\");\n const {\n root,\n menubar,\n menuitem,\n activeId,\n animatedOnceRef,\n hoverTimeoutRef,\n disableHoverMode,\n } = useMenuBarContext();\n const {\n horizontal,\n sheetHeader,\n sheetFooter,\n renderAsSheet,\n sheetPosition,\n sheetVerticalSize,\n } = useMenuConfiguration(props);\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const entered = useRef(false);\n const cancelUnmountFocus = useRef(false);\n const hideWithoutRefocus = (): void => {\n cancelUnmountFocus.current = true;\n onRequestClose();\n };\n const mode = useUserInteractionMode();\n const mouse = mode === \"mouse\";\n\n const { eventHandlers, transitionOptions } = useFocusContainer({\n nodeRef: propRef,\n activate: visible,\n onKeyDown(event) {\n onKeyDown(event);\n\n // when a menu is within a sheet, it should not trigger the custom\n // keyboard behavior\n if (isSheet) {\n return;\n }\n\n switch (event.key) {\n case \"Escape\":\n // prevent parent components that have an \"Escape\" keypress event\n // from being triggered as well\n event.stopPropagation();\n disableHoverMode();\n onRequestClose();\n break;\n case \"Tab\":\n // since menus are portalled, tab index is kinda broke so just close\n // the menu instead of doing default tab behavior\n event.preventDefault();\n\n if (!menuitem) {\n // pressing the tab key should still cascade close all menus\n event.stopPropagation();\n }\n disableHoverMode();\n onRequestClose();\n break;\n case \"ArrowUp\":\n if (!root && menuitem && horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n case \"ArrowLeft\":\n if (!root && menuitem && !horizontal) {\n event.stopPropagation();\n event.preventDefault();\n onRequestClose();\n }\n break;\n }\n },\n onEntering(appearing) {\n onEntering(appearing);\n entered.current = true;\n },\n onEntered(appearing) {\n onEntered(appearing);\n entered.current = true;\n cancelUnmountFocus.current = false;\n animatedOnceRef.current = true;\n },\n onExited() {\n onExited();\n entered.current = false;\n },\n onExiting,\n disableTransition,\n isFocusTypeDisabled(type) {\n if (role === \"listbox\") {\n return !isSheet;\n }\n\n if (type === \"keyboard\") {\n return isSheet;\n }\n\n const isHoverDisabled = mouse && hoverTimeoutRef.current === 0;\n if (type === \"mount\") {\n return isHoverDisabled;\n }\n\n return (\n isHoverDisabled ||\n cancelUnmountFocus.current ||\n (root && !!activeId && id !== activeId)\n );\n },\n });\n\n const { ref, style, callbacks, updateStyle } = useFixedPositioning({\n ...transitionOptions,\n disabled: disableFixedPositioning,\n onEnter,\n style: isSheet ? propStyle : menuStyle,\n fixedTo,\n anchor: getDefaultAnchor({\n anchor,\n menubar,\n floating,\n menuitem: !root && menuitem,\n horizontal,\n }),\n vwMargin,\n vhMargin,\n xMargin,\n yMargin,\n width,\n transformOrigin,\n preventOverlap,\n disableSwapping,\n disableVHBounds,\n initialX,\n initialY,\n getFixedPositionOptions,\n onResize: closeOnResize ? hideWithoutRefocus : undefined,\n onScroll(_event, data) {\n if (!data.visible || closeOnScroll) {\n hideWithoutRefocus();\n }\n },\n });\n const { rendered, disablePortal, elementProps } = useScaleTransition({\n nodeRef: ref,\n className: cnb(!isSheet && menuClassName, className),\n transitionIn: visible,\n vertical: !horizontal,\n temporary,\n timeout: isSheet || disableTransition ? 0 : timeout,\n classNames,\n appear,\n enter,\n exit,\n onExit,\n onExiting: transitionOptions.onExiting,\n exitedHidden: true,\n ...callbacks,\n });\n useScrollLock(visible && preventScroll);\n\n // need to make sure that the useEffect does not refire for hiding on click\n // events because of the `window.requestAnimationFrame`. It'll make it so\n // that menu items that update state are unable to close when clicked\n const hide = useRef(onRequestClose);\n useEffect(() => {\n hide.current = onRequestClose;\n });\n useEffect(() => {\n if (!visible) {\n return;\n }\n\n const callback = (event: globalThis.MouseEvent): void => {\n // this is required for when the transition is disabled\n if (!entered.current) {\n return;\n }\n\n // if the user clicks outside of the menu to close it, the toggle button\n // should not be focused. instead the nearest focusable element from the\n // click event should be focused when Tab or Shift + tab is pressed\n cancelUnmountFocus.current =\n !(event.target instanceof HTMLElement) ||\n !event.target.closest(`[role=\"${role}\"]`);\n\n // this won't be called if `event.stopPropagation()` is called\n hide.current();\n disableHoverMode();\n };\n\n // wait an animation frame so the initial click event that caused the menu\n // to become visible does not immediately close the menu\n const frame = window.requestAnimationFrame(() => {\n window.addEventListener(\"click\", callback);\n });\n\n return () => {\n window.cancelAnimationFrame(frame);\n window.removeEventListener(\"click\", callback);\n };\n }, [disableHoverMode, role, visible]);\n useIsomorphicLayoutEffect(() => {\n if (!visible) {\n return;\n }\n\n updateStyle();\n }, [updateStyle, children, visible]);\n\n return (\n <MenuConfigurationProvider\n horizontal={horizontal}\n renderAsSheet={renderAsSheet}\n sheetFooter={sheetFooter}\n sheetHeader={sheetHeader}\n sheetPosition={sheetPosition}\n sheetVerticalSize={sheetVerticalSize}\n >\n <MenuSheet\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy as string}\n header={sheetHeader}\n footer={sheetFooter}\n position={sheetPosition}\n verticalSize={sheetVerticalSize}\n visible={visible}\n enabled={isSheet}\n onRequestClose={onRequestClose}\n style={sheetStyle}\n className={sheetClassName}\n disablePortal={propDisablePortal}\n temporary={temporary}\n disableTransition={disableTransition}\n {...sheetProps}\n >\n <Portal disabled={isSheet || (propDisablePortal ?? disablePortal)}>\n {(rendered || isSheet) && (\n <MenuWidget\n {...remaining}\n {...elementProps}\n {...eventHandlers}\n id={id}\n role={role}\n style={isSheet ? propStyle : style}\n isSheet={isSheet}\n tabIndex={tabIndex}\n horizontal={horizontal}\n listProps={listProps}\n listStyle={listStyle}\n listClassName={listClassName}\n disableElevation={disableElevation}\n cancelUnmountFocus={cancelUnmountFocus}\n >\n {children}\n </MenuWidget>\n )}\n </Portal>\n </MenuSheet>\n </MenuConfigurationProvider>\n );\n }\n);\n"],"names":["cnb","forwardRef","useEffect","useRef","useFocusContainer","useUserInteractionMode","useAppSize","Portal","useFixedPositioning","useScrollLock","useScaleTransition","useEnsuredId","useIsomorphicLayoutEffect","MenuConfigurationProvider","useMenuConfiguration","MenuSheet","MenuWidget","useMenuBarContext","getDefaultAnchor","noop","Menu","props","propRef","id","propId","style","propStyle","role","children","horizontal","_horizontal","sheetHeader","_sheetHeader","sheetFooter","_sheetFooter","renderAsSheet","_renderAsSheet","sheetPosition","_sheetPosition","sheetVerticalSize","_sheetVerticalSize","sheetProps","sheetStyle","sheetClassName","menuStyle","menuClassName","disableElevation","temporary","tabIndex","fixedTo","className","classNames","timeout","appear","enter","exit","onEnter","onEntering","onEntered","onExit","onExiting","onExited","onKeyDown","listProps","listStyle","listClassName","visible","onRequestClose","floating","anchor","closeOnResize","closeOnScroll","preventScroll","vwMargin","vhMargin","xMargin","yMargin","width","transformOrigin","preventOverlap","disableSwapping","disableVHBounds","initialX","initialY","disableFixedPositioning","getFixedPositionOptions","disablePortal","propDisablePortal","disableTransition","remaining","ariaLabel","ariaLabelledBy","root","menubar","menuitem","activeId","animatedOnceRef","hoverTimeoutRef","disableHoverMode","isPhone","isSheet","entered","cancelUnmountFocus","hideWithoutRefocus","current","mode","mouse","eventHandlers","transitionOptions","nodeRef","activate","event","key","stopPropagation","preventDefault","appearing","isFocusTypeDisabled","type","isHoverDisabled","ref","callbacks","updateStyle","disabled","onResize","undefined","onScroll","_event","data","rendered","elementProps","transitionIn","vertical","exitedHidden","hide","callback","target","HTMLElement","closest","frame","window","requestAnimationFrame","addEventListener","cancelAnimationFrame","removeEventListener","aria-label","aria-labelledby","header","footer","position","verticalSize","enabled"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAGEC,UAAU,EACVC,SAAS,EACTC,MAAM,QACD,QAAQ;AAGf,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,sBAAsB,QAAQ,gDAAgD;AAEvF,SAASC,UAAU,QAAQ,sCAAsC;AAEjE,SAASC,MAAM,QAAQ,sBAAsB;AAE7C,SAEEC,mBAAmB,QACd,wCAAwC;AAC/C,SAASC,aAAa,QAAQ,6BAA6B;AAC3D,SAEEC,kBAAkB,QACb,sCAAsC;AAE7C,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,yBAAyB,QAAQ,kCAAkC;AAC5E,SAEEC,yBAAyB,EAEzBC,oBAAoB,QACf,iCAAiC;AACxC,SAASC,SAAS,QAAwC,iBAAiB;AAC3E,SAASC,UAAU,QAAQ,kBAAkB;AAC7C,SAASC,iBAAiB,QAAQ,0BAA0B;AAC5D,SAASC,gBAAgB,QAAQ,aAAa;AAW9C,MAAMC,OAAO;AACX,aAAa;AACf;AA+MA;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,qBAAOnB,WAClB,SAASmB,KAAKC,KAAK,EAAEC,OAAO;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAOC,SAAS,EAChBC,OAAO,MAAM,EACbC,QAAQ,EACRC,YAAYC,WAAW,EACvBC,aAAaC,YAAY,EACzBC,aAAaC,YAAY,EACzBC,eAAeC,cAAc,EAC7BC,eAAeC,cAAc,EAC7BC,mBAAmBC,kBAAkB,EACrCC,UAAU,EACVC,UAAU,EACVC,cAAc,EACdC,SAAS,EACTC,aAAa,EAC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C,eAAeA;oBACfnB,kBAAkBA;oBAClBwD,oBAAoBA;8BAEnB1E;;;;;AAOf,GACA"}
|
package/dist/menu/MenuBar.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export interface MenuBarProps extends Omit<ListProps, "role"> {
|
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*
|
|
58
|
-
* @see {@link https://
|
|
58
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
59
59
|
* @since 5.0.0
|
|
60
60
|
* @since 6.0.0 Combined with the previous `MenuBarWidget`
|
|
61
61
|
*/
|
package/dist/menu/MenuBar.js
CHANGED
|
@@ -37,7 +37,7 @@ import { MenuBarProvider, useMenuBarProvider } from "./useMenuBarProvider.js";
|
|
|
37
37
|
* }
|
|
38
38
|
* ```
|
|
39
39
|
*
|
|
40
|
-
* @see {@link https://
|
|
40
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
41
41
|
* @since 5.0.0
|
|
42
42
|
* @since 6.0.0 Combined with the previous `MenuBarWidget`
|
|
43
43
|
*/ export const MenuBar = /*#__PURE__*/ forwardRef(function MenuBar(props, ref) {
|
package/dist/menu/MenuBar.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menu/MenuBar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { List, type ListProps } from \"../list/List.js\";\nimport {\n KeyboardMovementProvider,\n useKeyboardMovementProvider,\n} from \"../movement/useKeyboardMovementProvider.js\";\nimport { MenuBarProvider, useMenuBarProvider } from \"./useMenuBarProvider.js\";\n\nexport interface MenuBarProps extends Omit<ListProps, \"role\"> {\n /**\n * @defaultValue `true`\n */\n horizontal?: boolean;\n\n /**\n * Set this to a number greater than 0 to allow opening dropdown menus within\n * the menubar after hovering for the duration in milliseconds. Once a menu\n * becomes visible within the menubar, all subsequent menus will become\n * visible immediately on hover as well until the hover mode is ended.\n *\n * For example:\n *\n * - `0` - the dropdown menus become visible immediately on hover\n * - `1000` - the first dropdown menu becomes visible after hovering for 1\n * second\n * - `undefined` - the hover mode can only be activate after a click with\n * mouse, touch, or keyboard\n *\n * @defaultValue `undefined`\n */\n hoverTimeout?: number;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuBar } from \"@react-md/core/menu/MenuBar\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\n * import type { ReactElement } from \"react\";\n *\n * export function SimpleExample(): ReactElement {\n * return (\n * <MenuBar>\n * <DropdownMenu buttonChildren=\"Item 1\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 2\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 3\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 4</MenuItem>\n * </DropdownMenu>\n * </MenuBar>\n * );\n * }\n * ```\n *\n * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/menu/MenuBar.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { List, type ListProps } from \"../list/List.js\";\nimport {\n KeyboardMovementProvider,\n useKeyboardMovementProvider,\n} from \"../movement/useKeyboardMovementProvider.js\";\nimport { MenuBarProvider, useMenuBarProvider } from \"./useMenuBarProvider.js\";\n\nexport interface MenuBarProps extends Omit<ListProps, \"role\"> {\n /**\n * @defaultValue `true`\n */\n horizontal?: boolean;\n\n /**\n * Set this to a number greater than 0 to allow opening dropdown menus within\n * the menubar after hovering for the duration in milliseconds. Once a menu\n * becomes visible within the menubar, all subsequent menus will become\n * visible immediately on hover as well until the hover mode is ended.\n *\n * For example:\n *\n * - `0` - the dropdown menus become visible immediately on hover\n * - `1000` - the first dropdown menu becomes visible after hovering for 1\n * second\n * - `undefined` - the hover mode can only be activate after a click with\n * mouse, touch, or keyboard\n *\n * @defaultValue `undefined`\n */\n hoverTimeout?: number;\n}\n\n/**\n * **Client Component**\n *\n * @example Simple Example\n * ```tsx\n * import { DropdownMenu } from \"@react-md/core/menu/DropdownMenu\";\n * import { MenuBar } from \"@react-md/core/menu/MenuBar\";\n * import { MenuItem } from \"@react-md/core/menu/MenuItem\";\n * import type { ReactElement } from \"react\";\n *\n * export function SimpleExample(): ReactElement {\n * return (\n * <MenuBar>\n * <DropdownMenu buttonChildren=\"Item 1\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 2\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 3</MenuItem>\n * </DropdownMenu>\n * <DropdownMenu buttonChildren=\"Item 3\">\n * <MenuItem>Menu Item 1</MenuItem>\n * <MenuItem>Menu Item 2</MenuItem>\n * <MenuItem>Menu Item 4</MenuItem>\n * </DropdownMenu>\n * </MenuBar>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n * @since 6.0.0 Combined with the previous `MenuBarWidget`\n */\nexport const MenuBar = forwardRef<HTMLUListElement, MenuBarProps>(\n function MenuBar(props, ref) {\n const {\n onClick,\n onFocus,\n onKeyDown,\n horizontal = true,\n hoverTimeout,\n children,\n ...remaining\n } = props;\n const menuBarContext = useMenuBarProvider({\n root: true,\n menubar: true,\n hoverTimeout,\n });\n const { activeId, enableHoverMode } = menuBarContext;\n const { movementProps, movementContext } = useKeyboardMovementProvider({\n onClick,\n onFocus,\n onKeyDown,\n loopable: true,\n searchable: true,\n horizontal,\n includeDisabled: true,\n tabIndexBehavior: \"roving\",\n onFocusChange(event) {\n if (activeId) {\n enableHoverMode(event.element.id);\n }\n },\n });\n\n return (\n <KeyboardMovementProvider value={movementContext}>\n <MenuBarProvider value={menuBarContext}>\n <List\n {...remaining}\n {...movementProps}\n ref={ref}\n role=\"menubar\"\n horizontal={horizontal}\n >\n {children}\n </List>\n </MenuBarProvider>\n </KeyboardMovementProvider>\n );\n }\n);\n"],"names":["forwardRef","List","KeyboardMovementProvider","useKeyboardMovementProvider","MenuBarProvider","useMenuBarProvider","MenuBar","props","ref","onClick","onFocus","onKeyDown","horizontal","hoverTimeout","children","remaining","menuBarContext","root","menubar","activeId","enableHoverMode","movementProps","movementContext","loopable","searchable","includeDisabled","tabIndexBehavior","onFocusChange","event","element","id","value","role"],"mappings":"AAAA;;AAEA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,IAAI,QAAwB,kBAAkB;AACvD,SACEC,wBAAwB,EACxBC,2BAA2B,QACtB,6CAA6C;AACpD,SAASC,eAAe,EAAEC,kBAAkB,QAAQ,0BAA0B;AA2B9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCC,GACD,OAAO,MAAMC,wBAAUN,WACrB,SAASM,QAAQC,KAAK,EAAEC,GAAG;IACzB,MAAM,EACJC,OAAO,EACPC,OAAO,EACPC,SAAS,EACTC,aAAa,IAAI,EACjBC,YAAY,EACZC,QAAQ,EACR,GAAGC,WACJ,GAAGR;IACJ,MAAMS,iBAAiBX,mBAAmB;QACxCY,MAAM;QACNC,SAAS;QACTL;IACF;IACA,MAAM,EAAEM,QAAQ,EAAEC,eAAe,EAAE,GAAGJ;IACtC,MAAM,EAAEK,aAAa,EAAEC,eAAe,EAAE,GAAGnB,4BAA4B;QACrEM;QACAC;QACAC;QACAY,UAAU;QACVC,YAAY;QACZZ;QACAa,iBAAiB;QACjBC,kBAAkB;QAClBC,eAAcC,KAAK;YACjB,IAAIT,UAAU;gBACZC,gBAAgBQ,MAAMC,OAAO,CAACC,EAAE;YAClC;QACF;IACF;IAEA,qBACE,KAAC5B;QAAyB6B,OAAOT;kBAC/B,cAAA,KAAClB;YAAgB2B,OAAOf;sBACtB,cAAA,KAACf;gBACE,GAAGc,SAAS;gBACZ,GAAGM,aAAa;gBACjBb,KAAKA;gBACLwB,MAAK;gBACLpB,YAAYA;0BAEXE;;;;AAKX,GACA"}
|
|
@@ -35,7 +35,7 @@ export interface MenuButtonProps extends ButtonProps, BaseMenuButtonProps {
|
|
|
35
35
|
* An internal component that handles rendering a button for the `DropdownMenu`
|
|
36
36
|
* while implementing the correct accessibility and keyboard movement.
|
|
37
37
|
*
|
|
38
|
-
* @see {@link https://
|
|
38
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
39
39
|
* @since 5.0.0
|
|
40
40
|
* @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.
|
|
41
41
|
*/
|
package/dist/menu/MenuButton.js
CHANGED
|
@@ -17,7 +17,7 @@ const noop = ()=>{
|
|
|
17
17
|
* An internal component that handles rendering a button for the `DropdownMenu`
|
|
18
18
|
* while implementing the correct accessibility and keyboard movement.
|
|
19
19
|
*
|
|
20
|
-
* @see {@link https://
|
|
20
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
21
21
|
* @since 5.0.0
|
|
22
22
|
* @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.
|
|
23
23
|
*/ export const MenuButton = /*#__PURE__*/ forwardRef(function MenuButton(props, ref) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menu/MenuButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/Button.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type TextIconSpacingProps } from \"../icon/TextIconSpacing.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\nimport { useMenuVisibility } from \"./MenuVisibilityProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuButtonTextIconSpacingProps = Pick<\n TextIconSpacingProps,\n \"icon\" | \"iconAfter\"\n>;\n\n/** @since 5.0.0 */\nexport type MenuButtonIconRotatorProps = Omit<\n IconRotatorProps,\n \"children\" | \"rotated\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 No longer extends the {@link ButtonProps}, no longer\n * requires an `id`, and no longer supports `textIconSpacingProps`.\n */\nexport interface BaseMenuButtonProps extends MenuButtonTextIconSpacingProps {\n /**\n * Any additional props to pass to the {@link IconRotator} component that\n * surrounds the {@link buttonChildren}\n */\n iconRotatorProps?: Readonly<MenuButtonIconRotatorProps>;\n\n /**\n * Boolean if the dropdown icon should be included with the button children.\n *\n * @defaultValue `buttonType === \"icon\"`\n */\n disableDropdownIcon?: boolean;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport interface MenuButtonProps extends ButtonProps, BaseMenuButtonProps {}\n\n/**\n * **Client Component**\n *\n * An internal component that handles rendering a button for the `DropdownMenu`\n * while implementing the correct accessibility and keyboard movement.\n *\n * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/menu/MenuButton.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef } from \"react\";\n\nimport { Button, type ButtonProps } from \"../button/Button.js\";\nimport { IconRotator, type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type TextIconSpacingProps } from \"../icon/TextIconSpacing.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { useAppSize } from \"../media-queries/AppSizeProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\nimport { useMenuConfiguration } from \"./MenuConfigurationProvider.js\";\nimport { useMenuVisibility } from \"./MenuVisibilityProvider.js\";\n\nconst noop = (): void => {\n // do nothing\n};\n\n/** @since 5.0.0 */\nexport type MenuButtonTextIconSpacingProps = Pick<\n TextIconSpacingProps,\n \"icon\" | \"iconAfter\"\n>;\n\n/** @since 5.0.0 */\nexport type MenuButtonIconRotatorProps = Omit<\n IconRotatorProps,\n \"children\" | \"rotated\"\n>;\n\n/**\n * @since 5.0.0\n * @since 6.0.0 No longer extends the {@link ButtonProps}, no longer\n * requires an `id`, and no longer supports `textIconSpacingProps`.\n */\nexport interface BaseMenuButtonProps extends MenuButtonTextIconSpacingProps {\n /**\n * Any additional props to pass to the {@link IconRotator} component that\n * surrounds the {@link buttonChildren}\n */\n iconRotatorProps?: Readonly<MenuButtonIconRotatorProps>;\n\n /**\n * Boolean if the dropdown icon should be included with the button children.\n *\n * @defaultValue `buttonType === \"icon\"`\n */\n disableDropdownIcon?: boolean;\n}\n\n/**\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport interface MenuButtonProps extends ButtonProps, BaseMenuButtonProps {}\n\n/**\n * **Client Component**\n *\n * An internal component that handles rendering a button for the `DropdownMenu`\n * while implementing the correct accessibility and keyboard movement.\n *\n * @see {@link https://react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n * @since 6.0.0 See {@link BaseMenuButtonProps} for breaking changes.\n */\nexport const MenuButton = forwardRef<HTMLButtonElement, MenuButtonProps>(\n function MenuButton(props, ref) {\n const {\n id: propId,\n onClick = noop,\n onKeyDown = noop,\n icon: propIcon,\n iconAfter = true,\n iconRotatorProps,\n floating,\n buttonType = floating ? \"icon\" : \"text\",\n disableDropdownIcon = buttonType === \"icon\",\n children,\n ...remaining\n } = props;\n const id = useEnsuredId(propId, \"menubutton\");\n const { visible, setVisible, defaultFocusIndex } = useMenuVisibility();\n const { renderAsSheet } = useMenuConfiguration();\n const { isPhone } = useAppSize();\n const isSheet =\n renderAsSheet === true || (renderAsSheet === \"phone\" && isPhone);\n\n const dropdownIcon = getIcon(\"dropdown\", propIcon);\n let icon = propIcon;\n if (!disableDropdownIcon) {\n icon = (\n <IconRotator {...iconRotatorProps} rotated={visible}>\n {dropdownIcon}\n </IconRotator>\n );\n }\n\n return (\n <Button\n {...remaining}\n aria-haspopup={isSheet ? \"dialog\" : \"menu\"}\n aria-expanded={visible || undefined}\n id={id}\n ref={ref}\n floating={floating}\n buttonType={buttonType}\n onClick={(event) => {\n onClick(event);\n\n defaultFocusIndex.current = 0;\n setVisible((prevVisible) => !prevVisible);\n }}\n onKeyDown={(event) => {\n onKeyDown(event);\n\n switch (event.key) {\n case \"ArrowDown\":\n event.preventDefault();\n event.stopPropagation();\n defaultFocusIndex.current = 0;\n setVisible(true);\n break;\n case \"ArrowUp\":\n event.preventDefault();\n event.stopPropagation();\n defaultFocusIndex.current = -1;\n setVisible(true);\n break;\n }\n }}\n >\n {!iconAfter && icon}\n {children}\n {iconAfter && icon}\n </Button>\n );\n }\n);\n"],"names":["forwardRef","Button","IconRotator","getIcon","useAppSize","useEnsuredId","useMenuConfiguration","useMenuVisibility","noop","MenuButton","props","ref","id","propId","onClick","onKeyDown","icon","propIcon","iconAfter","iconRotatorProps","floating","buttonType","disableDropdownIcon","children","remaining","visible","setVisible","defaultFocusIndex","renderAsSheet","isPhone","isSheet","dropdownIcon","rotated","aria-haspopup","aria-expanded","undefined","event","current","prevVisible","key","preventDefault","stopPropagation"],"mappings":"AAAA;;AAEA,SAASA,UAAU,QAAQ,QAAQ;AAEnC,SAASC,MAAM,QAA0B,sBAAsB;AAC/D,SAASC,WAAW,QAA+B,yBAAyB;AAE5E,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,UAAU,QAAQ,sCAAsC;AACjE,SAASC,YAAY,QAAQ,qBAAqB;AAClD,SAASC,oBAAoB,QAAQ,iCAAiC;AACtE,SAASC,iBAAiB,QAAQ,8BAA8B;AAEhE,MAAMC,OAAO;AACX,aAAa;AACf;AAwCA;;;;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;oBACX;YACJ;QACF;;YAEC,CAACR,aAAaF;YACdO;YACAL,aAAaF;;;AAGpB,GACA"}
|
package/dist/menu/MenuItem.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export interface MenuItemProps extends Omit<ListItemProps, "role"> {
|
|
|
19
19
|
* implements some keyboard focus behavior. This component should generally have
|
|
20
20
|
* an `onClick` event handler.
|
|
21
21
|
*
|
|
22
|
-
* @see {@link https://
|
|
22
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
23
23
|
* @since 5.0.0
|
|
24
24
|
*/
|
|
25
25
|
export declare const MenuItem: import("react").ForwardRefExoticComponent<MenuItemProps & import("react").RefAttributes<HTMLLIElement>>;
|
package/dist/menu/MenuItem.js
CHANGED
|
@@ -12,7 +12,7 @@ import { useEnsuredId } from "../useEnsuredId.js";
|
|
|
12
12
|
* implements some keyboard focus behavior. This component should generally have
|
|
13
13
|
* an `onClick` event handler.
|
|
14
14
|
*
|
|
15
|
-
* @see {@link https://
|
|
15
|
+
* @see {@link https://react-md.dev/components/menu | Menu Demos}
|
|
16
16
|
* @since 5.0.0
|
|
17
17
|
*/ export const MenuItem = /*#__PURE__*/ forwardRef(function MenuItem(props, ref) {
|
|
18
18
|
const { id: propId, role = "menuitem", tabIndex: propTabIndex, children, className, ...remaining } = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/menu/MenuItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\n\nimport { ListItem, type ListItemProps } from \"../list/ListItem.js\";\nimport { useKeyboardMovementContext } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\n\n/**\n * @since 5.0.0\n */\nexport interface MenuItemProps extends Omit<ListItemProps, \"role\"> {\n /**\n * @defaultValue `\"menuitem\"`\n */\n role?: string;\n\n /**\n * @defaultValue `-1`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * This component is used as an \"action\" within a `Menu`/`DropdownMenu` that\n * implements some keyboard focus behavior. This component should generally have\n * an `onClick` event handler.\n *\n * @see {@link https://
|
|
1
|
+
{"version":3,"sources":["../../src/menu/MenuItem.tsx"],"sourcesContent":["\"use client\";\n\nimport { cnb } from \"cnbuilder\";\nimport { forwardRef } from \"react\";\n\nimport { ListItem, type ListItemProps } from \"../list/ListItem.js\";\nimport { useKeyboardMovementContext } from \"../movement/useKeyboardMovementProvider.js\";\nimport { useEnsuredId } from \"../useEnsuredId.js\";\n\n/**\n * @since 5.0.0\n */\nexport interface MenuItemProps extends Omit<ListItemProps, \"role\"> {\n /**\n * @defaultValue `\"menuitem\"`\n */\n role?: string;\n\n /**\n * @defaultValue `-1`\n */\n tabIndex?: number;\n}\n\n/**\n * **Client Component**\n *\n * This component is used as an \"action\" within a `Menu`/`DropdownMenu` that\n * implements some keyboard focus behavior. This component should generally have\n * an `onClick` event handler.\n *\n * @see {@link https://react-md.dev/components/menu | Menu Demos}\n * @since 5.0.0\n */\nexport const MenuItem = forwardRef<HTMLLIElement, MenuItemProps>(\n function MenuItem(props, ref) {\n const {\n id: propId,\n role = \"menuitem\",\n tabIndex: propTabIndex,\n children,\n className,\n ...remaining\n } = props;\n\n const id = useEnsuredId(propId, \"menuitem\");\n const { tabIndexBehavior, activeDescendantId } =\n useKeyboardMovementContext();\n const focused = id === activeDescendantId;\n let tabIndex = propTabIndex ?? -1;\n if (tabIndexBehavior === \"roving\" && focused) {\n tabIndex = 0;\n }\n\n return (\n <ListItem\n {...remaining}\n id={id}\n ref={ref}\n role={role}\n tabIndex={tabIndex}\n className={cnb(\n \"rmd-menu-item\",\n tabIndexBehavior === \"virtual\" && focused && \"rmd-menu-item--focused\",\n className\n )}\n >\n {children}\n </ListItem>\n );\n }\n);\n"],"names":["cnb","forwardRef","ListItem","useKeyboardMovementContext","useEnsuredId","MenuItem","props","ref","id","propId","role","tabIndex","propTabIndex","children","className","remaining","tabIndexBehavior","activeDescendantId","focused"],"mappings":"AAAA;;AAEA,SAASA,GAAG,QAAQ,YAAY;AAChC,SAASC,UAAU,QAAQ,QAAQ;AAEnC,SAASC,QAAQ,QAA4B,sBAAsB;AACnE,SAASC,0BAA0B,QAAQ,6CAA6C;AACxF,SAASC,YAAY,QAAQ,qBAAqB;AAiBlD;;;;;;;;;CASC,GACD,OAAO,MAAMC,yBAAWJ,WACtB,SAASI,SAASC,KAAK,EAAEC,GAAG;IAC1B,MAAM,EACJC,IAAIC,MAAM,EACVC,OAAO,UAAU,EACjBC,UAAUC,YAAY,EACtBC,QAAQ,EACRC,SAAS,EACT,GAAGC,WACJ,GAAGT;IAEJ,MAAME,KAAKJ,aAAaK,QAAQ;IAChC,MAAM,EAAEO,gBAAgB,EAAEC,kBAAkB,EAAE,GAC5Cd;IACF,MAAMe,UAAUV,OAAOS;IACvB,IAAIN,WAAWC,gBAAgB,CAAC;IAChC,IAAII,qBAAqB,YAAYE,SAAS;QAC5CP,WAAW;IACb;IAEA,qBACE,KAACT;QACE,GAAGa,SAAS;QACbP,IAAIA;QACJD,KAAKA;QACLG,MAAMA;QACNC,UAAUA;QACVG,WAAWd,IACT,iBACAgB,qBAAqB,aAAaE,WAAW,0BAC7CJ;kBAGDD;;AAGP,GACA"}
|