@react-md/core 6.5.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_utils.scss +3 -0
- package/dist/app-bar/AppBar.d.ts +3 -2
- package/dist/app-bar/AppBar.js +3 -4
- package/dist/app-bar/AppBar.js.map +1 -1
- package/dist/app-bar/AppBarTitle.d.ts +3 -1
- package/dist/app-bar/AppBarTitle.js +3 -4
- package/dist/app-bar/AppBarTitle.js.map +1 -1
- package/dist/autocomplete/AutocompleteChip.d.ts +2 -1
- package/dist/autocomplete/AutocompleteChip.js +3 -4
- package/dist/autocomplete/AutocompleteChip.js.map +1 -1
- package/dist/autocomplete/types.d.ts +1 -0
- package/dist/autocomplete/types.js.map +1 -1
- package/dist/autocomplete/utils.d.ts +4 -4
- package/dist/autocomplete/utils.js.map +1 -1
- package/dist/avatar/Avatar.d.ts +3 -2
- package/dist/avatar/Avatar.js +3 -4
- package/dist/avatar/Avatar.js.map +1 -1
- package/dist/badge/Badge.d.ts +3 -2
- package/dist/badge/Badge.js +3 -4
- package/dist/badge/Badge.js.map +1 -1
- package/dist/box/Box.d.ts +3 -2
- package/dist/box/Box.js +3 -4
- package/dist/box/Box.js.map +1 -1
- package/dist/button/AsyncButton.d.ts +3 -2
- package/dist/button/AsyncButton.js +3 -4
- package/dist/button/AsyncButton.js.map +1 -1
- package/dist/button/Button.d.ts +3 -2
- package/dist/button/Button.js +3 -4
- package/dist/button/Button.js.map +1 -1
- package/dist/button/ButtonUnstyled.d.ts +5 -3
- package/dist/button/ButtonUnstyled.js +3 -4
- package/dist/button/ButtonUnstyled.js.map +1 -1
- package/dist/button/FloatingActionButton.d.ts +3 -2
- package/dist/button/FloatingActionButton.js +3 -4
- package/dist/button/FloatingActionButton.js.map +1 -1
- package/dist/button/TooltippedButton.d.ts +3 -2
- package/dist/button/TooltippedButton.js +3 -4
- package/dist/button/TooltippedButton.js.map +1 -1
- package/dist/card/Card.d.ts +3 -2
- package/dist/card/Card.js +3 -4
- package/dist/card/Card.js.map +1 -1
- package/dist/card/CardContent.d.ts +3 -2
- package/dist/card/CardContent.js +3 -4
- package/dist/card/CardContent.js.map +1 -1
- package/dist/card/CardFooter.d.ts +3 -1
- package/dist/card/CardFooter.js +3 -4
- package/dist/card/CardFooter.js.map +1 -1
- package/dist/card/CardHeader.d.ts +3 -2
- package/dist/card/CardHeader.js +3 -4
- package/dist/card/CardHeader.js.map +1 -1
- package/dist/card/CardSubtitle.d.ts +3 -1
- package/dist/card/CardSubtitle.js +3 -4
- package/dist/card/CardSubtitle.js.map +1 -1
- package/dist/card/CardTitle.d.ts +3 -1
- package/dist/card/CardTitle.js +3 -4
- package/dist/card/CardTitle.js.map +1 -1
- package/dist/card/ClickableCard.d.ts +3 -2
- package/dist/card/ClickableCard.js +3 -4
- package/dist/card/ClickableCard.js.map +1 -1
- package/dist/chip/Chip.d.ts +4 -2
- package/dist/chip/Chip.js +4 -4
- package/dist/chip/Chip.js.map +1 -1
- package/dist/datetime/NativeDateField.d.ts +3 -1
- package/dist/datetime/NativeDateField.js +3 -4
- package/dist/datetime/NativeDateField.js.map +1 -1
- package/dist/datetime/NativeTimeField.d.ts +3 -1
- package/dist/datetime/NativeTimeField.js +3 -4
- package/dist/datetime/NativeTimeField.js.map +1 -1
- package/dist/dialog/Dialog.d.ts +3 -2
- package/dist/dialog/Dialog.js +4 -4
- package/dist/dialog/Dialog.js.map +1 -1
- package/dist/dialog/DialogContainer.d.ts +3 -2
- package/dist/dialog/DialogContainer.js +3 -4
- package/dist/dialog/DialogContainer.js.map +1 -1
- package/dist/dialog/DialogContent.d.ts +3 -2
- package/dist/dialog/DialogContent.js +3 -4
- package/dist/dialog/DialogContent.js.map +1 -1
- package/dist/dialog/DialogFooter.d.ts +3 -2
- package/dist/dialog/DialogFooter.js +3 -4
- package/dist/dialog/DialogFooter.js.map +1 -1
- package/dist/dialog/DialogHeader.d.ts +3 -1
- package/dist/dialog/DialogHeader.js +3 -4
- package/dist/dialog/DialogHeader.js.map +1 -1
- package/dist/dialog/DialogTitle.d.ts +3 -1
- package/dist/dialog/DialogTitle.js +3 -4
- package/dist/dialog/DialogTitle.js.map +1 -1
- package/dist/dialog/FixedDialog.d.ts +4 -3
- package/dist/dialog/FixedDialog.js +4 -4
- package/dist/dialog/FixedDialog.js.map +1 -1
- package/dist/divider/Divider.d.ts +3 -2
- package/dist/divider/Divider.js +3 -4
- package/dist/divider/Divider.js.map +1 -1
- package/dist/draggable/useDraggable.d.ts +3 -3
- package/dist/draggable/useDraggable.js.map +1 -1
- package/dist/draggable/utils.d.ts +1 -1
- package/dist/draggable/utils.js.map +1 -1
- package/dist/expansion-panel/ExpansionList.d.ts +3 -2
- package/dist/expansion-panel/ExpansionList.js +3 -4
- package/dist/expansion-panel/ExpansionList.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanel.d.ts +3 -2
- package/dist/expansion-panel/ExpansionPanel.js +3 -4
- package/dist/expansion-panel/ExpansionPanel.js.map +1 -1
- package/dist/expansion-panel/ExpansionPanelHeader.d.ts +3 -2
- package/dist/expansion-panel/ExpansionPanelHeader.js +3 -4
- package/dist/expansion-panel/ExpansionPanelHeader.js.map +1 -1
- package/dist/files/FileInput.d.ts +3 -2
- package/dist/files/FileInput.js +3 -4
- package/dist/files/FileInput.js.map +1 -1
- package/dist/focus/useFocusContainer.d.ts +1 -1
- package/dist/focus/useFocusContainer.js.map +1 -1
- package/dist/form/Checkbox.d.ts +2 -1
- package/dist/form/Checkbox.js +4 -4
- package/dist/form/Checkbox.js.map +1 -1
- package/dist/form/Fieldset.d.ts +3 -2
- package/dist/form/Fieldset.js +3 -4
- package/dist/form/Fieldset.js.map +1 -1
- package/dist/form/Form.d.ts +3 -2
- package/dist/form/Form.js +3 -4
- package/dist/form/Form.js.map +1 -1
- package/dist/form/FormMessage.d.ts +8 -2
- package/dist/form/FormMessage.js +3 -4
- package/dist/form/FormMessage.js.map +1 -1
- package/dist/form/FormMessageContainer.d.ts +5 -4
- package/dist/form/FormMessageContainer.js +3 -4
- package/dist/form/FormMessageContainer.js.map +1 -1
- package/dist/form/FormMessageCounter.d.ts +3 -2
- package/dist/form/FormMessageCounter.js +3 -4
- package/dist/form/FormMessageCounter.js.map +1 -1
- package/dist/form/InputToggle.d.ts +3 -2
- package/dist/form/InputToggle.js +3 -4
- package/dist/form/InputToggle.js.map +1 -1
- package/dist/form/InputToggleIcon.d.ts +3 -2
- package/dist/form/InputToggleIcon.js +3 -4
- package/dist/form/InputToggleIcon.js.map +1 -1
- package/dist/form/Label.d.ts +2 -1
- package/dist/form/Label.js +3 -4
- package/dist/form/Label.js.map +1 -1
- package/dist/form/Legend.d.ts +3 -1
- package/dist/form/Legend.js +3 -4
- package/dist/form/Legend.js.map +1 -1
- package/dist/form/NativeSelect.d.ts +3 -2
- package/dist/form/NativeSelect.js +3 -4
- package/dist/form/NativeSelect.js.map +1 -1
- package/dist/form/OptGroup.d.ts +3 -2
- package/dist/form/OptGroup.js +3 -4
- package/dist/form/OptGroup.js.map +1 -1
- package/dist/form/Option.d.ts +3 -2
- package/dist/form/Option.js +4 -4
- package/dist/form/Option.js.map +1 -1
- package/dist/form/Password.d.ts +2 -2
- package/dist/form/Password.js +3 -4
- package/dist/form/Password.js.map +1 -1
- package/dist/form/Radio.d.ts +2 -1
- package/dist/form/Radio.js +4 -4
- package/dist/form/Radio.js.map +1 -1
- package/dist/form/ResizingTextAreaWrapper.d.ts +3 -2
- package/dist/form/ResizingTextAreaWrapper.js +3 -4
- package/dist/form/ResizingTextAreaWrapper.js.map +1 -1
- package/dist/form/SliderContainer.d.ts +3 -2
- package/dist/form/SliderContainer.js +3 -4
- package/dist/form/SliderContainer.js.map +1 -1
- package/dist/form/SliderThumb.d.ts +3 -2
- package/dist/form/SliderThumb.js +4 -4
- package/dist/form/SliderThumb.js.map +1 -1
- package/dist/form/SliderTrack.d.ts +3 -2
- package/dist/form/SliderTrack.js +3 -4
- package/dist/form/SliderTrack.js.map +1 -1
- package/dist/form/Switch.d.ts +3 -2
- package/dist/form/Switch.js +3 -4
- package/dist/form/Switch.js.map +1 -1
- package/dist/form/SwitchTrack.d.ts +3 -2
- package/dist/form/SwitchTrack.js +3 -4
- package/dist/form/SwitchTrack.js.map +1 -1
- package/dist/form/TextArea.d.ts +3 -2
- package/dist/form/TextArea.js +3 -4
- package/dist/form/TextArea.js.map +1 -1
- package/dist/form/TextField.d.ts +3 -2
- package/dist/form/TextField.js +3 -4
- package/dist/form/TextField.js.map +1 -1
- package/dist/form/TextFieldAddon.d.ts +2 -1
- package/dist/form/TextFieldAddon.js +3 -4
- package/dist/form/TextFieldAddon.js.map +1 -1
- package/dist/form/TextFieldContainer.d.ts +3 -2
- package/dist/form/TextFieldContainer.js +3 -4
- package/dist/form/TextFieldContainer.js.map +1 -1
- package/dist/form/sliderUtils.d.ts +1 -1
- package/dist/form/sliderUtils.js.map +1 -1
- package/dist/form/types.d.ts +11 -5
- package/dist/form/types.js.map +1 -1
- package/dist/form/useCombobox.d.ts +6 -6
- package/dist/form/useCombobox.js.map +1 -1
- package/dist/form/useFormReset.d.ts +1 -1
- package/dist/form/useFormReset.js.map +1 -1
- package/dist/form/useTextField.d.ts +4 -4
- package/dist/form/useTextField.js.map +1 -1
- package/dist/hoverMode/useHoverMode.js +1 -1
- package/dist/hoverMode/useHoverMode.js.map +1 -1
- package/dist/hoverMode/useHoverModeProvider.d.ts +5 -5
- package/dist/hoverMode/useHoverModeProvider.js +1 -1
- package/dist/hoverMode/useHoverModeProvider.js.map +1 -1
- package/dist/icon/FontIcon.d.ts +3 -2
- package/dist/icon/FontIcon.js +3 -4
- package/dist/icon/FontIcon.js.map +1 -1
- package/dist/icon/IconRotator.d.ts +3 -2
- package/dist/icon/IconRotator.js +4 -4
- package/dist/icon/IconRotator.js.map +1 -1
- package/dist/icon/MaterialIcon.d.ts +3 -2
- package/dist/icon/MaterialIcon.js +3 -4
- package/dist/icon/MaterialIcon.js.map +1 -1
- package/dist/icon/MaterialSymbol.d.ts +3 -2
- package/dist/icon/MaterialSymbol.js +3 -4
- package/dist/icon/MaterialSymbol.js.map +1 -1
- package/dist/icon/SVGIcon.d.ts +3 -2
- package/dist/icon/SVGIcon.js +3 -4
- package/dist/icon/SVGIcon.js.map +1 -1
- package/dist/layout/LayoutAppBar.d.ts +3 -1
- package/dist/layout/LayoutAppBar.js +3 -4
- package/dist/layout/LayoutAppBar.js.map +1 -1
- package/dist/layout/LayoutNav.d.ts +3 -2
- package/dist/layout/LayoutNav.js +3 -4
- package/dist/layout/LayoutNav.js.map +1 -1
- package/dist/layout/LayoutWindowSplitter.d.ts +4 -2
- package/dist/layout/LayoutWindowSplitter.js +4 -4
- package/dist/layout/LayoutWindowSplitter.js.map +1 -1
- package/dist/layout/Main.d.ts +4 -3
- package/dist/layout/Main.js +3 -4
- package/dist/layout/Main.js.map +1 -1
- package/dist/link/Link.d.ts +10 -2
- package/dist/link/Link.js +4 -4
- package/dist/link/Link.js.map +1 -1
- package/dist/link/SkipToMainContent.d.ts +3 -2
- package/dist/link/SkipToMainContent.js +4 -4
- package/dist/link/SkipToMainContent.js.map +1 -1
- package/dist/list/List.d.ts +3 -2
- package/dist/list/List.js +3 -4
- package/dist/list/List.js.map +1 -1
- package/dist/list/ListItem.d.ts +3 -2
- package/dist/list/ListItem.js +3 -4
- package/dist/list/ListItem.js.map +1 -1
- package/dist/list/ListItemLink.d.ts +3 -2
- package/dist/list/ListItemLink.js +3 -4
- package/dist/list/ListItemLink.js.map +1 -1
- package/dist/list/ListItemText.d.ts +3 -2
- package/dist/list/ListItemText.js +3 -4
- package/dist/list/ListItemText.js.map +1 -1
- package/dist/list/ListSubheader.d.ts +3 -2
- package/dist/list/ListSubheader.js +3 -4
- package/dist/list/ListSubheader.js.map +1 -1
- package/dist/menu/DropdownMenu.js.map +1 -1
- package/dist/menu/Menu.d.ts +4 -2
- package/dist/menu/Menu.js +5 -4
- package/dist/menu/Menu.js.map +1 -1
- package/dist/menu/MenuBar.d.ts +3 -1
- package/dist/menu/MenuBar.js +3 -4
- package/dist/menu/MenuBar.js.map +1 -1
- package/dist/menu/MenuButton.d.ts +2 -1
- package/dist/menu/MenuButton.js +3 -4
- package/dist/menu/MenuButton.js.map +1 -1
- package/dist/menu/MenuItem.d.ts +3 -1
- package/dist/menu/MenuItem.js +3 -4
- package/dist/menu/MenuItem.js.map +1 -1
- package/dist/menu/MenuItemButton.d.ts +2 -1
- package/dist/menu/MenuItemButton.js +4 -4
- package/dist/menu/MenuItemButton.js.map +1 -1
- package/dist/menu/MenuItemCheckbox.d.ts +2 -1
- package/dist/menu/MenuItemCheckbox.js +4 -4
- package/dist/menu/MenuItemCheckbox.js.map +1 -1
- package/dist/menu/MenuItemCircularProgress.d.ts +3 -2
- package/dist/menu/MenuItemCircularProgress.js +3 -4
- package/dist/menu/MenuItemCircularProgress.js.map +1 -1
- package/dist/menu/MenuItemFileInput.d.ts +2 -2
- package/dist/menu/MenuItemFileInput.js +3 -4
- package/dist/menu/MenuItemFileInput.js.map +1 -1
- package/dist/menu/MenuItemGroup.d.ts +3 -3
- package/dist/menu/MenuItemGroup.js +4 -4
- package/dist/menu/MenuItemGroup.js.map +1 -1
- package/dist/menu/MenuItemInputToggle.d.ts +3 -2
- package/dist/menu/MenuItemInputToggle.js +3 -4
- package/dist/menu/MenuItemInputToggle.js.map +1 -1
- package/dist/menu/MenuItemRadio.d.ts +3 -1
- package/dist/menu/MenuItemRadio.js +4 -4
- package/dist/menu/MenuItemRadio.js.map +1 -1
- package/dist/menu/MenuItemSeparator.d.ts +3 -2
- package/dist/menu/MenuItemSeparator.js +3 -4
- package/dist/menu/MenuItemSeparator.js.map +1 -1
- package/dist/menu/MenuItemSwitch.d.ts +2 -1
- package/dist/menu/MenuItemSwitch.js +4 -4
- package/dist/menu/MenuItemSwitch.js.map +1 -1
- package/dist/menu/MenuItemTextField.d.ts +2 -2
- package/dist/menu/MenuItemTextField.js +3 -4
- package/dist/menu/MenuItemTextField.js.map +1 -1
- package/dist/menu/MenuVisibilityProvider.d.ts +3 -3
- package/dist/menu/MenuVisibilityProvider.js.map +1 -1
- package/dist/menu/MenuWidget.d.ts +4 -4
- package/dist/menu/MenuWidget.js +4 -4
- package/dist/menu/MenuWidget.js.map +1 -1
- package/dist/menu/useContextMenu.d.ts +4 -4
- package/dist/menu/useContextMenu.js.map +1 -1
- package/dist/movement/types.d.ts +5 -5
- package/dist/movement/types.js.map +1 -1
- package/dist/navigation/CollapsibleNavGroup.d.ts +2 -2
- package/dist/navigation/CollapsibleNavGroup.js +3 -4
- package/dist/navigation/CollapsibleNavGroup.js.map +1 -1
- package/dist/navigation/NavGroup.d.ts +3 -2
- package/dist/navigation/NavGroup.js +3 -4
- package/dist/navigation/NavGroup.js.map +1 -1
- package/dist/navigation/NavItem.d.ts +3 -2
- package/dist/navigation/NavItem.js +3 -4
- package/dist/navigation/NavItem.js.map +1 -1
- package/dist/navigation/NavItemButton.d.ts +2 -2
- package/dist/navigation/NavItemButton.js +3 -4
- package/dist/navigation/NavItemButton.js.map +1 -1
- package/dist/navigation/NavItemLink.d.ts +3 -2
- package/dist/navigation/NavItemLink.js +4 -4
- package/dist/navigation/NavItemLink.js.map +1 -1
- package/dist/navigation/NavSubheader.d.ts +2 -1
- package/dist/navigation/NavSubheader.js +3 -4
- 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/types.d.ts +5 -2
- package/dist/navigation/types.js.map +1 -1
- package/dist/navigation/useActiveHeadingId.js +1 -1
- package/dist/navigation/useActiveHeadingId.js.map +1 -1
- package/dist/overlay/Overlay.d.ts +3 -2
- package/dist/overlay/Overlay.js +3 -4
- package/dist/overlay/Overlay.js.map +1 -1
- package/dist/positioning/useFixedPositioning.d.ts +1 -1
- package/dist/positioning/useFixedPositioning.js.map +1 -1
- package/dist/progress/CircularProgress.d.ts +2 -2
- package/dist/progress/CircularProgress.js +4 -4
- package/dist/progress/CircularProgress.js.map +1 -1
- package/dist/progress/LinearProgress.d.ts +2 -2
- package/dist/progress/LinearProgress.js +4 -4
- package/dist/progress/LinearProgress.js.map +1 -1
- package/dist/progress/types.d.ts +2 -0
- package/dist/progress/types.js.map +1 -1
- package/dist/responsive-item/ResponsiveItem.d.ts +3 -2
- package/dist/responsive-item/ResponsiveItem.js +3 -4
- package/dist/responsive-item/ResponsiveItem.js.map +1 -1
- package/dist/responsive-item/ResponsiveItemOverlay.d.ts +3 -2
- package/dist/responsive-item/ResponsiveItemOverlay.js +3 -4
- package/dist/responsive-item/ResponsiveItemOverlay.js.map +1 -1
- package/dist/segmented-button/SegmentedButton.d.ts +3 -2
- package/dist/segmented-button/SegmentedButton.js +3 -4
- package/dist/segmented-button/SegmentedButton.js.map +1 -1
- package/dist/segmented-button/SegmentedButtonContainer.d.ts +4 -3
- package/dist/segmented-button/SegmentedButtonContainer.js +4 -5
- package/dist/segmented-button/SegmentedButtonContainer.js.map +1 -1
- package/dist/sheet/Sheet.d.ts +2 -1
- package/dist/sheet/Sheet.js +3 -4
- package/dist/sheet/Sheet.js.map +1 -1
- package/dist/snackbar/Snackbar.d.ts +3 -2
- package/dist/snackbar/Snackbar.js +3 -4
- package/dist/snackbar/Snackbar.js.map +1 -1
- package/dist/snackbar/Toast.d.ts +3 -2
- package/dist/snackbar/Toast.js +4 -4
- package/dist/snackbar/Toast.js.map +1 -1
- package/dist/snackbar/ToastActionButton.d.ts +2 -1
- package/dist/snackbar/ToastActionButton.js +3 -4
- package/dist/snackbar/ToastActionButton.js.map +1 -1
- package/dist/snackbar/ToastCloseButton.d.ts +2 -1
- package/dist/snackbar/ToastCloseButton.js +3 -4
- package/dist/snackbar/ToastCloseButton.js.map +1 -1
- package/dist/snackbar/ToastContent.d.ts +3 -2
- package/dist/snackbar/ToastContent.js +4 -4
- package/dist/snackbar/ToastContent.js.map +1 -1
- package/dist/spinbutton/SpinButton.d.ts +4 -3
- package/dist/spinbutton/SpinButton.js +3 -4
- package/dist/spinbutton/SpinButton.js.map +1 -1
- package/dist/spinbutton/types.d.ts +1 -1
- package/dist/spinbutton/types.js.map +1 -1
- package/dist/table/StickyTableSection.d.ts +3 -2
- package/dist/table/StickyTableSection.js +3 -4
- package/dist/table/StickyTableSection.js.map +1 -1
- package/dist/table/Table.d.ts +3 -2
- package/dist/table/Table.js +4 -4
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableBody.d.ts +3 -2
- package/dist/table/TableBody.js +4 -4
- package/dist/table/TableBody.js.map +1 -1
- package/dist/table/TableCell.d.ts +3 -2
- package/dist/table/TableCell.js +3 -4
- package/dist/table/TableCell.js.map +1 -1
- package/dist/table/TableCellContent.d.ts +3 -2
- package/dist/table/TableCellContent.js +3 -4
- package/dist/table/TableCellContent.js.map +1 -1
- package/dist/table/TableCheckbox.d.ts +3 -2
- package/dist/table/TableCheckbox.js +3 -4
- package/dist/table/TableCheckbox.js.map +1 -1
- package/dist/table/TableContainer.d.ts +5 -3
- package/dist/table/TableContainer.js +4 -4
- package/dist/table/TableContainer.js.map +1 -1
- package/dist/table/TableContainerProvider.d.ts +1 -1
- package/dist/table/TableContainerProvider.js.map +1 -1
- package/dist/table/TableFooter.d.ts +3 -2
- package/dist/table/TableFooter.js +4 -5
- package/dist/table/TableFooter.js.map +1 -1
- package/dist/table/TableHeader.d.ts +3 -2
- package/dist/table/TableHeader.js +4 -5
- package/dist/table/TableHeader.js.map +1 -1
- package/dist/table/TableRadio.d.ts +3 -2
- package/dist/table/TableRadio.js +3 -4
- package/dist/table/TableRadio.js.map +1 -1
- package/dist/table/TableRow.d.ts +3 -2
- package/dist/table/TableRow.js +3 -4
- package/dist/table/TableRow.js.map +1 -1
- package/dist/tabs/SimpleTabPanel.d.ts +3 -2
- package/dist/tabs/SimpleTabPanel.js +3 -4
- package/dist/tabs/SimpleTabPanel.js.map +1 -1
- package/dist/tabs/SimpleTabPanels.d.ts +3 -2
- package/dist/tabs/SimpleTabPanels.js +3 -4
- package/dist/tabs/SimpleTabPanels.js.map +1 -1
- package/dist/tabs/TabList.d.ts +3 -2
- package/dist/tabs/TabList.js +4 -4
- package/dist/tabs/TabList.js.map +1 -1
- package/dist/tabs/TabListScrollButton.d.ts +3 -2
- package/dist/tabs/TabListScrollButton.js +4 -4
- package/dist/tabs/TabListScrollButton.js.map +1 -1
- package/dist/tabs/useTabList.d.ts +2 -2
- package/dist/tabs/useTabList.js.map +1 -1
- package/dist/theme/useCSSVariables.d.ts +1 -1
- package/dist/theme/useCSSVariables.js.map +1 -1
- package/dist/tooltip/Tooltip.d.ts +3 -2
- package/dist/tooltip/Tooltip.js +3 -4
- package/dist/tooltip/Tooltip.js.map +1 -1
- package/dist/tooltip/useTooltip.d.ts +3 -3
- package/dist/tooltip/useTooltip.js.map +1 -1
- package/dist/transition/SkeletonPlaceholder.d.ts +3 -2
- package/dist/transition/SkeletonPlaceholder.js +3 -4
- package/dist/transition/SkeletonPlaceholder.js.map +1 -1
- package/dist/transition/Slide.d.ts +3 -2
- package/dist/transition/Slide.js +3 -4
- package/dist/transition/Slide.js.map +1 -1
- package/dist/transition/SlideContainer.d.ts +3 -2
- package/dist/transition/SlideContainer.js +3 -4
- package/dist/transition/SlideContainer.js.map +1 -1
- package/dist/tree/TreeGroup.d.ts +2 -2
- package/dist/tree/TreeGroup.js +3 -4
- package/dist/tree/TreeGroup.js.map +1 -1
- package/dist/tree/TreeProvider.d.ts +2 -3
- package/dist/tree/TreeProvider.js.map +1 -1
- package/dist/tree/useTreeMovement.d.ts +6 -7
- package/dist/tree/useTreeMovement.js.map +1 -1
- package/dist/types.d.ts +1 -15
- package/dist/types.js.map +1 -1
- package/dist/typography/Mark.d.ts +3 -2
- package/dist/typography/Mark.js +3 -4
- package/dist/typography/Mark.js.map +1 -1
- package/dist/typography/SrOnly.d.ts +3 -2
- package/dist/typography/SrOnly.js +3 -4
- package/dist/typography/SrOnly.js.map +1 -1
- package/dist/typography/TextContainer.d.ts +3 -2
- package/dist/typography/TextContainer.js +3 -4
- package/dist/typography/TextContainer.js.map +1 -1
- package/dist/typography/Typography.d.ts +3 -2
- package/dist/typography/Typography.js +3 -4
- package/dist/typography/Typography.js.map +1 -1
- package/dist/useAsyncFunction.d.ts +3 -2
- package/dist/useAsyncFunction.js.map +1 -1
- package/dist/useDebouncedFunction.js +1 -1
- package/dist/useDebouncedFunction.js.map +1 -1
- package/dist/useDropzone.js +1 -1
- package/dist/useDropzone.js.map +1 -1
- package/dist/useEnsuredRef.d.ts +3 -3
- package/dist/useEnsuredRef.js +1 -1
- package/dist/useEnsuredRef.js.map +1 -1
- package/dist/useThrottledFunction.js +3 -3
- package/dist/useThrottledFunction.js.map +1 -1
- package/dist/useUnmounted.d.ts +2 -2
- package/dist/useUnmounted.js.map +1 -1
- package/dist/utils/applyRef.d.ts +1 -1
- package/dist/utils/applyRef.js.map +1 -1
- package/dist/window-splitter/WindowSplitter.d.ts +3 -2
- package/dist/window-splitter/WindowSplitter.js +3 -4
- package/dist/window-splitter/WindowSplitter.js.map +1 -1
- package/package.json +9 -9
- package/src/app-bar/AppBar.tsx +54 -54
- package/src/app-bar/AppBarTitle.tsx +29 -27
- package/src/autocomplete/AutocompleteChip.tsx +4 -6
- package/src/autocomplete/types.ts +2 -0
- package/src/autocomplete/utils.ts +4 -4
- package/src/avatar/Avatar.tsx +47 -45
- package/src/badge/Badge.tsx +17 -11
- package/src/box/Box.tsx +51 -50
- package/src/button/AsyncButton.tsx +125 -119
- package/src/button/Button.tsx +74 -73
- package/src/button/ButtonUnstyled.tsx +9 -9
- package/src/button/FloatingActionButton.tsx +9 -7
- package/src/button/TooltippedButton.tsx +6 -6
- package/src/card/Card.tsx +36 -35
- package/src/card/CardContent.tsx +31 -28
- package/src/card/CardFooter.tsx +22 -16
- package/src/card/CardHeader.tsx +36 -30
- package/src/card/CardSubtitle.tsx +8 -6
- package/src/card/CardTitle.tsx +26 -25
- package/src/card/ClickableCard.tsx +57 -54
- package/src/chip/Chip.tsx +122 -120
- package/src/datetime/NativeDateField.tsx +7 -7
- package/src/datetime/NativeTimeField.tsx +7 -7
- package/src/dialog/Dialog.tsx +156 -150
- package/src/dialog/DialogContainer.tsx +35 -29
- package/src/dialog/DialogContent.tsx +26 -19
- package/src/dialog/DialogFooter.tsx +22 -19
- package/src/dialog/DialogHeader.tsx +24 -23
- package/src/dialog/DialogTitle.tsx +27 -26
- package/src/dialog/FixedDialog.tsx +70 -69
- package/src/divider/Divider.tsx +32 -26
- package/src/draggable/useDraggable.ts +3 -6
- package/src/draggable/utils.ts +1 -1
- package/src/expansion-panel/ExpansionList.tsx +24 -19
- package/src/expansion-panel/ExpansionPanel.tsx +11 -6
- package/src/expansion-panel/ExpansionPanelHeader.tsx +9 -6
- package/src/files/FileInput.tsx +79 -79
- package/src/focus/useFocusContainer.ts +1 -1
- package/src/form/Checkbox.tsx +6 -6
- package/src/form/Fieldset.tsx +33 -28
- package/src/form/Form.tsx +26 -25
- package/src/form/FormMessage.tsx +13 -7
- package/src/form/FormMessageContainer.tsx +12 -9
- package/src/form/FormMessageCounter.tsx +8 -7
- package/src/form/InputToggle.tsx +105 -107
- package/src/form/InputToggleIcon.tsx +12 -6
- package/src/form/Label.tsx +40 -41
- package/src/form/Legend.tsx +44 -43
- package/src/form/NativeSelect.tsx +116 -114
- package/src/form/OptGroup.tsx +15 -15
- package/src/form/Option.tsx +123 -122
- package/src/form/Password.tsx +66 -67
- package/src/form/Radio.tsx +6 -6
- package/src/form/ResizingTextAreaWrapper.tsx +7 -6
- package/src/form/SliderContainer.tsx +35 -29
- package/src/form/SliderThumb.tsx +8 -6
- package/src/form/SliderTrack.tsx +80 -80
- package/src/form/Switch.tsx +80 -79
- package/src/form/SwitchTrack.tsx +35 -34
- package/src/form/TextArea.tsx +167 -165
- package/src/form/TextField.tsx +106 -104
- package/src/form/TextFieldAddon.tsx +33 -32
- package/src/form/TextFieldContainer.tsx +8 -6
- package/src/form/sliderUtils.ts +1 -1
- package/src/form/types.ts +15 -5
- package/src/form/useCombobox.ts +6 -10
- package/src/form/useFormReset.ts +1 -1
- package/src/form/useTextField.ts +4 -4
- package/src/hoverMode/useHoverMode.ts +1 -1
- package/src/hoverMode/useHoverModeProvider.ts +13 -8
- package/src/icon/FontIcon.tsx +32 -30
- package/src/icon/IconRotator.tsx +30 -28
- package/src/icon/MaterialIcon.tsx +36 -30
- package/src/icon/MaterialSymbol.tsx +50 -44
- package/src/icon/SVGIcon.tsx +47 -41
- package/src/layout/LayoutAppBar.tsx +23 -28
- package/src/layout/LayoutNav.tsx +68 -62
- package/src/layout/LayoutWindowSplitter.tsx +9 -7
- package/src/layout/Main.tsx +30 -29
- package/src/link/Link.tsx +16 -11
- package/src/link/SkipToMainContent.tsx +6 -6
- package/src/list/List.tsx +31 -29
- package/src/list/ListItem.tsx +126 -125
- package/src/list/ListItemLink.tsx +128 -126
- package/src/list/ListItemText.tsx +42 -37
- package/src/list/ListSubheader.tsx +27 -26
- package/src/menu/DropdownMenu.tsx +2 -2
- package/src/menu/Menu.tsx +327 -326
- package/src/menu/MenuBar.tsx +51 -50
- package/src/menu/MenuButton.tsx +69 -70
- package/src/menu/MenuItem.tsx +37 -37
- package/src/menu/MenuItemButton.tsx +132 -133
- package/src/menu/MenuItemCheckbox.tsx +6 -7
- package/src/menu/MenuItemCircularProgress.tsx +13 -6
- package/src/menu/MenuItemFileInput.tsx +4 -6
- package/src/menu/MenuItemGroup.tsx +18 -18
- package/src/menu/MenuItemInputToggle.tsx +8 -6
- package/src/menu/MenuItemRadio.tsx +6 -6
- package/src/menu/MenuItemSeparator.tsx +7 -7
- package/src/menu/MenuItemSwitch.tsx +6 -6
- package/src/menu/MenuItemTextField.tsx +5 -7
- package/src/menu/MenuVisibilityProvider.tsx +3 -2
- package/src/menu/MenuWidget.tsx +123 -119
- package/src/menu/useContextMenu.ts +7 -4
- package/src/movement/types.ts +5 -9
- package/src/navigation/CollapsibleNavGroup.tsx +10 -6
- package/src/navigation/NavGroup.tsx +18 -19
- package/src/navigation/NavItem.tsx +16 -11
- package/src/navigation/NavItemButton.tsx +69 -66
- package/src/navigation/NavItemLink.tsx +102 -100
- package/src/navigation/NavSubheader.tsx +14 -16
- package/src/navigation/Navigation.tsx +1 -1
- package/src/navigation/types.ts +13 -4
- package/src/navigation/useActiveHeadingId.ts +1 -1
- package/src/overlay/Overlay.tsx +66 -65
- package/src/positioning/useFixedPositioning.ts +1 -1
- package/src/progress/CircularProgress.tsx +6 -6
- package/src/progress/LinearProgress.tsx +6 -6
- package/src/progress/types.ts +4 -0
- package/src/responsive-item/ResponsiveItem.tsx +29 -28
- package/src/responsive-item/ResponsiveItemOverlay.tsx +9 -8
- package/src/segmented-button/SegmentedButton.tsx +11 -6
- package/src/segmented-button/SegmentedButtonContainer.tsx +14 -8
- package/src/sheet/Sheet.tsx +42 -43
- package/src/snackbar/Snackbar.tsx +44 -38
- package/src/snackbar/Toast.tsx +110 -109
- package/src/snackbar/ToastActionButton.tsx +6 -6
- package/src/snackbar/ToastCloseButton.tsx +4 -6
- package/src/snackbar/ToastContent.tsx +56 -49
- package/src/spinbutton/SpinButton.tsx +9 -8
- package/src/spinbutton/types.ts +1 -1
- package/src/table/StickyTableSection.tsx +8 -6
- package/src/table/Table.tsx +47 -41
- package/src/table/TableBody.tsx +46 -42
- package/src/table/TableCell.tsx +83 -81
- package/src/table/TableCellContent.tsx +11 -6
- package/src/table/TableCheckbox.tsx +6 -6
- package/src/table/TableContainer.tsx +31 -26
- package/src/table/TableContainerProvider.ts +1 -1
- package/src/table/TableFooter.tsx +7 -12
- package/src/table/TableHeader.tsx +15 -9
- package/src/table/TableRadio.tsx +59 -58
- package/src/table/TableRow.tsx +34 -33
- package/src/tabs/SimpleTabPanel.tsx +18 -13
- package/src/tabs/SimpleTabPanels.tsx +11 -7
- package/src/tabs/TabList.tsx +106 -105
- package/src/tabs/TabListScrollButton.tsx +9 -6
- package/src/tabs/useTabList.ts +2 -2
- package/src/theme/useCSSVariables.ts +1 -1
- package/src/tooltip/Tooltip.tsx +61 -61
- package/src/tooltip/useTooltip.ts +2 -3
- package/src/transition/SkeletonPlaceholder.tsx +8 -6
- package/src/transition/Slide.tsx +54 -48
- package/src/transition/SlideContainer.tsx +16 -16
- package/src/tree/TreeGroup.tsx +54 -55
- package/src/tree/TreeProvider.tsx +2 -2
- package/src/tree/useTreeMovement.ts +6 -6
- package/src/types.ts +1 -16
- package/src/typography/Mark.tsx +16 -11
- package/src/typography/SrOnly.tsx +41 -35
- package/src/typography/TextContainer.tsx +12 -12
- package/src/typography/Typography.tsx +42 -41
- package/src/useAsyncFunction.ts +3 -3
- package/src/useDebouncedFunction.ts +1 -1
- package/src/useDropzone.ts +1 -1
- package/src/useEnsuredRef.ts +3 -3
- package/src/useThrottledFunction.ts +3 -3
- package/src/useUnmounted.ts +2 -4
- package/src/utils/applyRef.ts +2 -2
- package/src/window-splitter/WindowSplitter.tsx +6 -6
package/dist/_utils.scss
CHANGED
|
@@ -142,6 +142,9 @@ $_swappable-properties: text-align;
|
|
|
142
142
|
/// @returns {String} the name to be used in a `var()`
|
|
143
143
|
@function get-var-name($variables, $name, $group) {
|
|
144
144
|
@if $group == icon {
|
|
145
|
+
@if $name == symbol-fill {
|
|
146
|
+
@return --rmd-symbol-fill;
|
|
147
|
+
}
|
|
145
148
|
@if $name == symbol-grade {
|
|
146
149
|
@return --rmd-symbol-grad;
|
|
147
150
|
}
|
package/dist/app-bar/AppBar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ElementType, type HTMLAttributes, type Ref } from "react";
|
|
1
|
+
import { type ElementType, type HTMLAttributes, type ReactElement, type Ref } from "react";
|
|
2
2
|
import { type AppBarClassNameOptions } from "./styles.js";
|
|
3
3
|
/** @since 6.0.0 */
|
|
4
4
|
export type CustomAppBarComponent = ElementType<HTMLAttributes<HTMLDivElement> & {
|
|
@@ -17,6 +17,7 @@ export type CustomAppBarComponent = ElementType<HTMLAttributes<HTMLDivElement> &
|
|
|
17
17
|
* @since 6.0.0 Added the {@link stacked} and {@link scrollbarOffset} props.
|
|
18
18
|
*/
|
|
19
19
|
export interface AppBarProps extends HTMLAttributes<HTMLDivElement>, AppBarClassNameOptions {
|
|
20
|
+
ref?: Ref<HTMLDivElement>;
|
|
20
21
|
/** @defaultValue `fixed ? "header" : "div"` */
|
|
21
22
|
as?: CustomAppBarComponent;
|
|
22
23
|
}
|
|
@@ -44,4 +45,4 @@ export interface AppBarProps extends HTMLAttributes<HTMLDivElement>, AppBarClass
|
|
|
44
45
|
* @since 6.0.0 The `AppBar` was updated to use `gap` for spacing
|
|
45
46
|
* instead of requiring the `AppBarNav` and `AppBarAction` components.
|
|
46
47
|
*/
|
|
47
|
-
export declare
|
|
48
|
+
export declare function AppBar(props: AppBarProps): ReactElement;
|
package/dist/app-bar/AppBar.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { appBar } from "./styles.js";
|
|
4
3
|
/**
|
|
5
4
|
* @example Simple Example
|
|
@@ -24,8 +23,8 @@ import { appBar } from "./styles.js";
|
|
|
24
23
|
*
|
|
25
24
|
* @since 6.0.0 The `AppBar` was updated to use `gap` for spacing
|
|
26
25
|
* instead of requiring the `AppBarNav` and `AppBarAction` components.
|
|
27
|
-
*/ export
|
|
28
|
-
const { className, theme, stacked, height, align, grid, gridName, justify, reversed, gridColumns, disableWrap, disablePadding, position, pagePosition, surfaceColor, scrollbarOffset, disableElevation, as: Component = position ? "header" : "div", children, ...remaining } = props;
|
|
26
|
+
*/ export function AppBar(props) {
|
|
27
|
+
const { ref, className, theme, stacked, height, align, grid, gridName, justify, reversed, gridColumns, disableWrap, disablePadding, position, pagePosition, surfaceColor, scrollbarOffset, disableElevation, as: Component = position ? "header" : "div", children, ...remaining } = props;
|
|
29
28
|
return /*#__PURE__*/ _jsx(Component, {
|
|
30
29
|
...remaining,
|
|
31
30
|
className: appBar({
|
|
@@ -50,6 +49,6 @@ import { appBar } from "./styles.js";
|
|
|
50
49
|
ref: ref,
|
|
51
50
|
children: children
|
|
52
51
|
});
|
|
53
|
-
}
|
|
52
|
+
}
|
|
54
53
|
|
|
55
54
|
//# sourceMappingURL=AppBar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/app-bar/AppBar.tsx"],"sourcesContent":["import {\n type ElementType,\n type HTMLAttributes,\n type
|
|
1
|
+
{"version":3,"sources":["../../src/app-bar/AppBar.tsx"],"sourcesContent":["import {\n type ElementType,\n type HTMLAttributes,\n type ReactElement,\n type Ref,\n} from \"react\";\n\nimport { type AppBarClassNameOptions, appBar } from \"./styles.js\";\n\n/** @since 6.0.0 */\nexport type CustomAppBarComponent = ElementType<\n HTMLAttributes<HTMLDivElement> & {\n ref?: Ref<HTMLDivElement>;\n className: string;\n }\n>;\n\n/**\n * @since 6.0.0 Renamed the `component` prop to `as` and updated the default\n * value to be a `\"div\"` when `fixed` is `false`.\n * @since 6.0.0 Renamed the `fixedElevation` prop to `disableFixedElevation` to\n * match naming conventions when a feature is enabled by default.\n * @since 6.0.0 Removed the `inheritColor` and `flexWrap` props since they are\n * no longer required.\n * @since 6.0.0 Removed the `fixed` prop in favor of the new `position` prop\n * which enables position `fixed` or `sticky` behavior.\n * @since 6.0.0 Added the {@link stacked} and {@link scrollbarOffset} props.\n */\nexport interface AppBarProps\n extends HTMLAttributes<HTMLDivElement>, AppBarClassNameOptions {\n ref?: Ref<HTMLDivElement>;\n /** @defaultValue `fixed ? \"header\" : \"div\"` */\n as?: CustomAppBarComponent;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { AppBar } from \"@react-md/core/app-bar/AppBar\";\n * import { AppBarTitle } from \"@react-md/core/app-bar/AppBarTitle\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import MenuIcon from \"@react-md/material-icons/MenuIcon\";\n * import MoreVertIcon from \"@react-md/material-icons/MoreVertIcon\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <AppBar>\n * <Button aria-label=\"Navigation\"><MenuIcon /></Button>\n * <AppBarTitle>My Main Title</AppBarTitle>\n * <Button aria-label=\"Options\"><MoreVertIcon /></Button>\n * </AppBar>\n * );\n * }\n * ```\n *\n * @since 6.0.0 The `AppBar` was updated to use `gap` for spacing\n * instead of requiring the `AppBarNav` and `AppBarAction` components.\n */\nexport function AppBar(props: AppBarProps): ReactElement {\n const {\n ref,\n className,\n theme,\n stacked,\n height,\n align,\n grid,\n gridName,\n justify,\n reversed,\n gridColumns,\n disableWrap,\n disablePadding,\n position,\n pagePosition,\n surfaceColor,\n scrollbarOffset,\n disableElevation,\n as: Component = position ? \"header\" : \"div\",\n children,\n ...remaining\n } = props;\n\n return (\n <Component\n {...remaining}\n className={appBar({\n className,\n theme,\n position,\n pagePosition,\n disableElevation,\n scrollbarOffset,\n height,\n grid,\n gridName,\n gridColumns,\n align,\n stacked,\n justify,\n reversed,\n surfaceColor,\n disableWrap,\n disablePadding,\n })}\n ref={ref}\n >\n {children}\n </Component>\n );\n}\n"],"names":["appBar","AppBar","props","ref","className","theme","stacked","height","align","grid","gridName","justify","reversed","gridColumns","disableWrap","disablePadding","position","pagePosition","surfaceColor","scrollbarOffset","disableElevation","as","Component","children","remaining"],"mappings":";AAOA,SAAsCA,MAAM,QAAQ,cAAc;AA4BlE;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASC,OAAOC,KAAkB;IACvC,MAAM,EACJC,GAAG,EACHC,SAAS,EACTC,KAAK,EACLC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,QAAQ,EACRC,OAAO,EACPC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,cAAc,EACdC,QAAQ,EACRC,YAAY,EACZC,YAAY,EACZC,eAAe,EACfC,gBAAgB,EAChBC,IAAIC,YAAYN,WAAW,WAAW,KAAK,EAC3CO,QAAQ,EACR,GAAGC,WACJ,GAAGtB;IAEJ,qBACE,KAACoB;QACE,GAAGE,SAAS;QACbpB,WAAWJ,OAAO;YAChBI;YACAC;YACAW;YACAC;YACAG;YACAD;YACAZ;YACAE;YACAC;YACAG;YACAL;YACAF;YACAK;YACAC;YACAM;YACAJ;YACAC;QACF;QACAZ,KAAKA;kBAEJoB;;AAGP"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactElement, type Ref } from "react";
|
|
1
2
|
import { type TextOverflow } from "../cssUtils.js";
|
|
2
3
|
import { type TypographyProps } from "../typography/Typography.js";
|
|
3
4
|
import { type TypographyType } from "../typography/typographyStyles.js";
|
|
@@ -10,6 +11,7 @@ import { type AppBarTitleClassNameOptions } from "./styles.js";
|
|
|
10
11
|
* will default to `"ellipsis"` which is new as well.
|
|
11
12
|
*/
|
|
12
13
|
export interface AppBarTitleProps extends TypographyProps, AppBarTitleClassNameOptions {
|
|
14
|
+
ref?: Ref<HTMLHeadingElement>;
|
|
13
15
|
/** @defaultValue `"headline-6"` */
|
|
14
16
|
type?: TypographyType;
|
|
15
17
|
/**
|
|
@@ -41,4 +43,4 @@ export interface AppBarTitleProps extends TypographyProps, AppBarTitleClassNameO
|
|
|
41
43
|
* prop inherited through the base `Typography` component. The `textOverflow`
|
|
42
44
|
* will default to `"ellipsis"` which is new as well.
|
|
43
45
|
*/
|
|
44
|
-
export declare
|
|
46
|
+
export declare function AppBarTitle(props: AppBarTitleProps): ReactElement;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { Typography } from "../typography/Typography.js";
|
|
4
3
|
import { appBarTitle } from "./styles.js";
|
|
5
4
|
/**
|
|
@@ -25,8 +24,8 @@ import { appBarTitle } from "./styles.js";
|
|
|
25
24
|
* @since 6.0.0 The `noWrap` prop was removed in favor of the `textOverflow`
|
|
26
25
|
* prop inherited through the base `Typography` component. The `textOverflow`
|
|
27
26
|
* will default to `"ellipsis"` which is new as well.
|
|
28
|
-
*/ export
|
|
29
|
-
const { type = "headline-6", keyline = "small", children, className, textOverflow = "ellipsis", ...remaining } = props;
|
|
27
|
+
*/ export function AppBarTitle(props) {
|
|
28
|
+
const { ref, type = "headline-6", keyline = "small", children, className, textOverflow = "ellipsis", ...remaining } = props;
|
|
30
29
|
return /*#__PURE__*/ _jsx(Typography, {
|
|
31
30
|
...remaining,
|
|
32
31
|
ref: ref,
|
|
@@ -38,6 +37,6 @@ import { appBarTitle } from "./styles.js";
|
|
|
38
37
|
textOverflow: textOverflow,
|
|
39
38
|
children: children
|
|
40
39
|
});
|
|
41
|
-
}
|
|
40
|
+
}
|
|
42
41
|
|
|
43
42
|
//# sourceMappingURL=AppBarTitle.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/app-bar/AppBarTitle.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/app-bar/AppBarTitle.tsx"],"sourcesContent":["import { type ReactElement, type Ref } from \"react\";\n\nimport { type TextOverflow } from \"../cssUtils.js\";\nimport { Typography, type TypographyProps } from \"../typography/Typography.js\";\nimport { type TypographyType } from \"../typography/typographyStyles.js\";\nimport { type AppBarTitleClassNameOptions, appBarTitle } from \"./styles.js\";\n\n/**\n * @since 6.0.0 The `keyline` prop was changed from a boolean to a type\n * union of different keylines: {@link AppBarTitleKeyline}\n * @since 6.0.0 The `noWrap` prop was removed in favor of the `textOverflow`\n * prop inherited through the base `Typography` component. The `textOverflow`\n * will default to `\"ellipsis\"` which is new as well.\n */\nexport interface AppBarTitleProps\n extends TypographyProps, AppBarTitleClassNameOptions {\n ref?: Ref<HTMLHeadingElement>;\n\n /** @defaultValue `\"headline-6\"` */\n type?: TypographyType;\n\n /**\n * @defaultValue `\"ellipsis\"`\n */\n textOverflow?: TextOverflow;\n}\n\n/**\n * @example Updating the Keyline\n * ```tsx\n * import { AppBar } from \"@react-md/core/app-bar/AppBar\";\n * import { AppBarTitle } from \"@react-md/core/app-bar/AppBarTitle\";\n * import type { ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <AppBar>\n * <AppBarTitle keyline=\"nav\">\n * Offset as if there was a nav button to the left\n * </AppBarTitle>\n * </AppBar>\n * );\n * }\n * ```\n *\n * @since 6.0.0 The `keyline` prop was changed from a boolean to a type\n * union of different keylines: {@link AppBarTitleKeyline}\n * @since 6.0.0 The `noWrap` prop was removed in favor of the `textOverflow`\n * prop inherited through the base `Typography` component. The `textOverflow`\n * will default to `\"ellipsis\"` which is new as well.\n */\nexport function AppBarTitle(props: AppBarTitleProps): ReactElement {\n const {\n ref,\n type = \"headline-6\",\n keyline = \"small\",\n children,\n className,\n textOverflow = \"ellipsis\",\n ...remaining\n } = props;\n\n return (\n <Typography\n {...remaining}\n ref={ref}\n type={type}\n className={appBarTitle({\n keyline,\n className,\n })}\n textOverflow={textOverflow}\n >\n {children}\n </Typography>\n );\n}\n"],"names":["Typography","appBarTitle","AppBarTitle","props","ref","type","keyline","children","className","textOverflow","remaining"],"mappings":";AAGA,SAASA,UAAU,QAA8B,8BAA8B;AAE/E,SAA2CC,WAAW,QAAQ,cAAc;AAsB5E;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASC,YAAYC,KAAuB;IACjD,MAAM,EACJC,GAAG,EACHC,OAAO,YAAY,EACnBC,UAAU,OAAO,EACjBC,QAAQ,EACRC,SAAS,EACTC,eAAe,UAAU,EACzB,GAAGC,WACJ,GAAGP;IAEJ,qBACE,KAACH;QACE,GAAGU,SAAS;QACbN,KAAKA;QACLC,MAAMA;QACNG,WAAWP,YAAY;YACrBK;YACAE;QACF;QACAC,cAAcA;kBAEbF;;AAGP"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ReactElement } from "react";
|
|
1
2
|
import { type AutocompleteChipProps } from "./types.js";
|
|
2
3
|
/**
|
|
3
4
|
* A small wrapper around the `Chip` that defaults the `rightAddon` to the
|
|
@@ -6,4 +7,4 @@ import { type AutocompleteChipProps } from "./types.js";
|
|
|
6
7
|
* @see {@link https://react-md.dev/components/autocomplete | Autocomplete Demos}
|
|
7
8
|
* @since 6.0.0
|
|
8
9
|
*/
|
|
9
|
-
export declare
|
|
10
|
+
export declare function AutocompleteChip(props: AutocompleteChipProps): ReactElement;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { Chip } from "../chip/Chip.js";
|
|
4
3
|
import { getIcon } from "../icon/config.js";
|
|
5
4
|
import { autocompleteChip } from "./autocompleteStyles.js";
|
|
@@ -9,8 +8,8 @@ import { autocompleteChip } from "./autocompleteStyles.js";
|
|
|
9
8
|
*
|
|
10
9
|
* @see {@link https://react-md.dev/components/autocomplete | Autocomplete Demos}
|
|
11
10
|
* @since 6.0.0
|
|
12
|
-
*/ export
|
|
13
|
-
const { "aria-description": propAriaDescription, children, className, removeIcon: propRemoveIcon, rightAddon: propRightAddon, ...remaining } = props;
|
|
11
|
+
*/ export function AutocompleteChip(props) {
|
|
12
|
+
const { ref, "aria-description": propAriaDescription, children, className, removeIcon: propRemoveIcon, rightAddon: propRightAddon, ...remaining } = props;
|
|
14
13
|
let rightAddon = propRightAddon;
|
|
15
14
|
let ariaDescription = propAriaDescription;
|
|
16
15
|
const removeIcon = getIcon("remove", propRemoveIcon);
|
|
@@ -30,6 +29,6 @@ import { autocompleteChip } from "./autocompleteStyles.js";
|
|
|
30
29
|
}),
|
|
31
30
|
children: children
|
|
32
31
|
});
|
|
33
|
-
}
|
|
32
|
+
}
|
|
34
33
|
|
|
35
34
|
//# sourceMappingURL=AutocompleteChip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/autocomplete/AutocompleteChip.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/autocomplete/AutocompleteChip.tsx"],"sourcesContent":["import { type ReactElement } from \"react\";\n\nimport { Chip } from \"../chip/Chip.js\";\nimport { getIcon } from \"../icon/config.js\";\nimport { autocompleteChip } from \"./autocompleteStyles.js\";\nimport { type AutocompleteChipProps } from \"./types.js\";\n\n/**\n * A small wrapper around the `Chip` that defaults the `rightAddon` to the\n * remove icon and adds a default `aria-description`.\n *\n * @see {@link https://react-md.dev/components/autocomplete | Autocomplete Demos}\n * @since 6.0.0\n */\nexport function AutocompleteChip(props: AutocompleteChipProps): ReactElement {\n const {\n ref,\n \"aria-description\": propAriaDescription,\n children,\n className,\n removeIcon: propRemoveIcon,\n rightAddon: propRightAddon,\n ...remaining\n } = props;\n\n let rightAddon = propRightAddon;\n let ariaDescription = propAriaDescription;\n const removeIcon = getIcon(\"remove\", propRemoveIcon);\n if (rightAddon === undefined) {\n rightAddon = removeIcon;\n }\n\n if (ariaDescription === undefined && typeof children === \"string\") {\n ariaDescription = `Remove \"${children}\"`;\n }\n\n return (\n <Chip\n {...remaining}\n aria-description={ariaDescription}\n ref={ref}\n rightAddon={rightAddon}\n className={autocompleteChip({ className })}\n >\n {children}\n </Chip>\n );\n}\n"],"names":["Chip","getIcon","autocompleteChip","AutocompleteChip","props","ref","propAriaDescription","children","className","removeIcon","propRemoveIcon","rightAddon","propRightAddon","remaining","ariaDescription","undefined","aria-description"],"mappings":";AAEA,SAASA,IAAI,QAAQ,kBAAkB;AACvC,SAASC,OAAO,QAAQ,oBAAoB;AAC5C,SAASC,gBAAgB,QAAQ,0BAA0B;AAG3D;;;;;;CAMC,GACD,OAAO,SAASC,iBAAiBC,KAA4B;IAC3D,MAAM,EACJC,GAAG,EACH,oBAAoBC,mBAAmB,EACvCC,QAAQ,EACRC,SAAS,EACTC,YAAYC,cAAc,EAC1BC,YAAYC,cAAc,EAC1B,GAAGC,WACJ,GAAGT;IAEJ,IAAIO,aAAaC;IACjB,IAAIE,kBAAkBR;IACtB,MAAMG,aAAaR,QAAQ,UAAUS;IACrC,IAAIC,eAAeI,WAAW;QAC5BJ,aAAaF;IACf;IAEA,IAAIK,oBAAoBC,aAAa,OAAOR,aAAa,UAAU;QACjEO,kBAAkB,CAAC,QAAQ,EAAEP,SAAS,CAAC,CAAC;IAC1C;IAEA,qBACE,KAACP;QACE,GAAGa,SAAS;QACbG,oBAAkBF;QAClBT,KAAKA;QACLM,YAAYA;QACZH,WAAWN,iBAAiB;YAAEM;QAAU;kBAEvCD;;AAGP"}
|
|
@@ -450,6 +450,7 @@ export interface AutocompleteCircularProgressProps extends CircularProgressProps
|
|
|
450
450
|
* @since 6.0.0
|
|
451
451
|
*/
|
|
452
452
|
export interface AutocompleteChipProps extends ChipProps {
|
|
453
|
+
ref?: Ref<HTMLButtonElement>;
|
|
453
454
|
/**
|
|
454
455
|
* @defaultValue `typeof children === "string" ? \`Remove "${children}"\` : undefined`
|
|
455
456
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/autocomplete/types.ts"],"sourcesContent":["import {\n type AriaAttributes,\n type ChangeEventHandler,\n type Dispatch,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { type ButtonProps } from \"../button/Button.js\";\nimport { type ChipProps } from \"../chip/Chip.js\";\nimport {\n type OptionProps,\n type OptionSelectedIconProps,\n} from \"../form/Option.js\";\nimport { type TextFieldProps } from \"../form/TextField.js\";\nimport {\n type ComboboxMenuProps,\n type ComboboxVisibilityOptions,\n type ConfigurableComboboxMenuProps,\n} from \"../form/useCombobox.js\";\nimport {\n type EditableComboboxImplementation,\n type EditableComboboxOptions,\n type EditableComboboxWidgetProps,\n} from \"../form/useEditableCombobox.js\";\nimport { type EditableHTMLElement } from \"../form/utils.js\";\nimport { type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type CircularProgressProps } from \"../progress/CircularProgress.js\";\nimport { type ProgressTheme } from \"../progress/types.js\";\nimport { type BaseSearchOptions } from \"../searching/types.js\";\nimport {\n type AutomaticTextExtraction,\n type PropsWithRef,\n type TextExtractor,\n type UseStateInitializer,\n} from \"../types.js\";\n\n// NOTE: The augmentation appears in this file since both\n// the `Autocomplete` and `autocompleteStyles` import this\n// file. The augmentation only works if a type definition\n// exists in the compiled `*.d.ts`\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-autocomplete-clear-button-size\"?: string;\n \"--rmd-autocomplete-dropdown-button-size\"?: string;\n \"--rmd-autocomplete-circular-progress-size\"?: string;\n \"--rmd-autocomplete-inline-gap\"?: string;\n \"--rmd-autocomplete-inline-min-width\"?: string;\n \"--rmd-autocomplete-addon-gap\"?: string;\n \"--rmd-autocomplete-gap-count\"?: string;\n \"--rmd-autocomplete-addon-spacing\"?: string;\n }\n}\n\n/**\n * If a autocomplete value is one of these types, no additional code is required\n * to display a label in the input/chip for the autocomplete once the value has\n * been selected.\n *\n * - `\"some value\"` -> `\"some value\"`\n * - `{ label: \"Hello, world\", value: 300 }` -> `\"Hello, world!\"`\n * - `{ name: \"Hello, world\", value: 300 }` -> `\"Hello, world!\"`\n *\n * @since 6.0.0\n * @deprecated @since 6.2.0 Use `AutomaticTextExtraction` instead.\n */\nexport type AutocompleteLabeledOption = AutomaticTextExtraction;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteOption = AutomaticTextExtraction | object;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteFilterOptions<Option extends AutocompleteOption> = Pick<\n Required<BaseSearchOptions<Option>>,\n \"list\" | \"query\" | \"extractor\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteFilterFunction<Option extends AutocompleteOption> = (\n options: AutocompleteFilterOptions<Option>\n) => readonly Option[];\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteGetOptionPropsOptions<\n Option extends AutocompleteOption,\n> {\n index: number;\n query: string;\n option: Option;\n selected: boolean;\n extractor: TextExtractor<Option>;\n}\n\n/**\n * @see {@link AutocompleteGetOptionProps.getOptionProps}\n * @since 6.0.0\n */\nexport type AutocompleteGetOptionPropsCallback<\n Option extends AutocompleteOption,\n> = (\n options: AutocompleteGetOptionPropsOptions<Option>\n) => ConfigurableAutocompleteOptionProps | undefined;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteGetOptionProps<Option extends AutocompleteOption> {\n /**\n * This can be used to add additional props to each option.\n *\n * @example Simple Example\n * ```tsx\n * getOptionProps={({ option }) => {\n * return {\n * disabled: option === \"\",\n * className: cnb(option === \"a\" && styles.blue),\n * leftAddon: option === value && <CheckIcon />,\n * };\n * }}\n * ```\n *\n * @see {@link AutocompleteGetOptionPropsOptions}\n * @see {@link AutocompleteGetOptionPropsCallback}\n * @since 6.0.0\n */\n getOptionProps?: AutocompleteGetOptionPropsCallback<Option>;\n}\n\n/**\n * @see {@link AutocompleteBaseProps.getChipProps}\n * @since 6.0.0\n */\nexport type AutocompleteGetChipProps<Option extends AutocompleteOption> = (\n options: Omit<AutocompleteGetOptionPropsOptions<Option>, \"selected\">\n) => Partial<AutocompleteChipProps> | undefined;\n\n/**\n * @see {@link AutocompleteGetOptionLabel}\n * @since 6.0.0\n */\nexport type AutocompleteGetOptionLabelCallback<\n Option extends AutocompleteOption,\n> = (option: Option) => string;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteGetOptionLabel<Option extends AutocompleteOption> {\n /**\n * If the list of options contain an object that doesn't have a\n * `label: string`, this prop must be provided to extract a string to display\n * in the text field once selected.\n *\n * @example No Getter Required\n * ```tsx\n * const options1 = ['a', 'b', 'c', 'd'];\n * const options2 = [{ label: 'a' }, { label: 'b' }, { label: 'c' }, { label: 'd' }];\n *\n * <Autocomplete options={options1} />\n * <Autocomplete options={options2} />\n * ```\n *\n * @example Getter Required\n * ```tsx\n * const options = [\n * {\n * name: \"Alaska\",\n * abbr: \"AK\",\n * },\n * {\n * name: \"Arizona\",\n * abbr: \"AZ\",\n * }\n * ];\n *\n * <Autocomplete options={options} getOptionLabel={(state) => state.name} />\n * ```\n *\n * @defaultValue `defaultAutocompleteExtractor`\n * @since 6.0.0\n */\n getOptionLabel?: AutocompleteGetOptionLabelCallback<Option>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type ConfigurableAutocompleteOptionProps = Partial<\n Omit<OptionProps, \"role\" | \"value\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteControlledValue<T> {\n value: T;\n setValue: Dispatch<T>;\n defaultValue?: never;\n onValueChange?: never;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteUncontrolledValue<T> {\n value?: never;\n setValue?: never;\n defaultValue?: UseStateInitializer<T>;\n\n /**\n * This prop should be used when some action should occur whenever the value\n * changes, but is not required to be stored in state. For all other cases, it\n * is recommended to control the `value` instead of using this prop.\n *\n * @defaultValue `() => {}`\n */\n onValueChange?: (value: T) => void;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteValue<T> =\n | AutocompleteControlledValue<T>\n | AutocompleteUncontrolledValue<T>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteControlledQuery {\n query: string;\n setQuery: Dispatch<string>;\n defaultQuery?: never;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteUncontrolledQuery {\n query?: never;\n setQuery?: never;\n defaultQuery?: UseStateInitializer<string>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteQuery =\n | AutocompleteControlledQuery\n | AutocompleteUncontrolledQuery;\n\n/**\n * This allows the `query` to be updated whenever a new value has been selected.\n *\n * - `\"clear\"` - clears the `query`\n * - `\"selected\"` - sets the \tquery\t to the selected value's label\n * - `\"as-is\"` - doesn't change the `query`\n *\n * @defaultValue `(multiselect || Array.isArray(value ?? defaultValue)) ? \"clear\" : \"selected\"`\n * @since 6.0.0\n */\nexport type AutocompleteUpdateQueryOnSelect = \"clear\" | \"selected\" | \"as-is\";\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteUnknownQueryAndValueOptions<\n Option extends AutocompleteOption,\n> {\n query?: string;\n setQuery?: Dispatch<string>;\n defaultQuery?: UseStateInitializer<string>;\n value?: Option | null | readonly Option[];\n setValue?: Dispatch<Option | null | readonly Option[]>;\n defaultValue?: UseStateInitializer<Option | null | readonly Option[]>;\n onValueChange?: (value: Option | null | readonly Option[]) => void;\n}\n\n/**\n * A utility type that makes the `getOptionLabel` required when an option is not\n * a {@link AutomaticTextExtraction}.\n *\n * @since 6.0.0\n */\nexport type AutocompleteOptionLabelExtractor<\n Option extends AutocompleteOption,\n> = Option extends AutomaticTextExtraction\n ? AutocompleteGetOptionLabel<Option>\n : Required<AutocompleteGetOptionLabel<Option>>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteFilteringOptions<\n Option extends AutocompleteOption,\n> extends AutocompleteGetOptionLabel<Option> {\n /**\n * The list of options that can be shown within the autocomplete and filtered\n * based on the current query.\n */\n options: readonly Option[];\n\n /**\n * The function that filters the {@link options} based on the current query\n * and defaults to a case insensitive search that starts with the query.\n *\n * @example Case Insensitive Anywhere\n * ```tsx\n * import { caseInsensitiveSearch } from \"@react-md/core/searching/caseInsensitive\";\n *\n * <Autocomplete {...props} filter={caseInsensitiveSearch} />\n * ```\n *\n * @example Fuzzy Filtering\n * ```tsx\n * import { fuzzySearch } from \"@react-md/core/searching/fuzzy\";\n *\n * <Autocomplete {...props} filter={fuzzySearch} />\n * ```\n *\n * @example Async Searching\n * ```tsx\n * import { useDebouncedFunction } from \"@react-md/core/useDebouncedFunction\";\n * import { useState } from \"react\";\n *\n * interface State {\n * loading: boolean;\n * options: readonly string[];\n * }\n *\n * function Example() {\n * const [state, setState] = useState<State>({\n * loading: false,\n * options: [],\n * });\n *\n * const search = useDebouncedFunction(async (query: string) => {\n * setState(prev => ({ ...prev, loading: true }));\n *\n * const options = await someAsyncTask(query);\n * setState({ loading: false, options })\n * });\n *\n * return (\n * <Autocomplete\n * {...props}\n * // Setting `type=\"search\"` automatically updates the `filter` prop to\n * // be `noopAutocompleteFilter`\n * type=\"search\"\n * options={options}\n * onChange={(event) => search(event.currentTarget.value)}\n * />\n * );\n * }\n * ```\n *\n * @defaultValue `defaultAutocompleteFilter`\n */\n filter?: AutocompleteFilterFunction<Option>;\n\n /**\n * Set this to `true` to update the filtering behavior to also remove the\n * selected value from the available options. This is mostly for the\n * multiselect behavior.\n *\n * @defaultValue `false`\n */\n filterSelected?: boolean;\n\n /**\n * Set this to `true` to allow any value to be typed into the autocomplete\n * instead of enforcing an empty string or one of the option labels.\n *\n * @defaultValue `filter === noopAutocompleteFilter`\n */\n allowAnyValue?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteFilterAndListboxOptions<\n Option extends AutocompleteOption,\n>\n extends\n AutocompleteFilteringOptions<Option>,\n AutocompleteGetOptionProps<Option>,\n OptionSelectedIconProps {\n /**\n * Set this to `true` when using a multiselect autocomplete to update each\n * option to use checkboxes to show the selection state.\n *\n * @defaultValue `false`\n */\n checkboxes?: boolean;\n\n /**\n * @see {@link OptionSelectedIconProps.disableSelectedIcon}\n * @defaultValue `!checkboxes`\n */\n disableSelectedIcon?: boolean;\n\n /**\n * @see {@link AutocompleteUpdateQueryOnSelect}\n * @defaultValue `multiselect ? \"clear\" : \"selected\"`\n */\n updateQueryOnSelect?: AutocompleteUpdateQueryOnSelect;\n\n /**\n * Set this to `true` to prevent the listbox from closing when an option is\n * selected.\n *\n * @defaultValue `checkboxes`\n */\n disableCloseOnSelect?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteEditableComboboxOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends\n EditableComboboxOptions<ComboboxEl, PopupEl>,\n AutocompleteFilterAndListboxOptions<Option> {\n onBlur?: FocusEventHandler<ComboboxEl>;\n onChange?: ChangeEventHandler<ComboboxEl>;\n\n /**\n * This is a convenience prop for the `onEntering`/`onEntered` transition\n * callbacks that will ensure it is only called once even if the transitions\n * are disabled. A great use-case for this function is to fetch data once the\n * menu is opened.\n */\n onOpen?: () => void;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteQueryAndExtractorOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> = AutocompleteEditableComboboxOptions<Option, ComboboxEl, PopupEl> &\n AutocompleteOptionLabelExtractor<Option> &\n AutocompleteQuery;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteSingleSelectOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> = AutocompleteQueryAndExtractorOptions<Option, ComboboxEl, PopupEl> &\n AutocompleteValue<Option | null>;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteMultiSelectOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> = AutocompleteQueryAndExtractorOptions<Option, ComboboxEl, PopupEl> &\n AutocompleteValue<readonly Option[]>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends\n AutocompleteEditableComboboxOptions<Option, ComboboxEl, PopupEl>,\n AutocompleteUnknownQueryAndValueOptions<Option> {}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteComboboxProps<\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n> extends EditableComboboxWidgetProps<ComboboxEl> {\n \"aria-autocomplete\": NonNullable<AriaAttributes[\"aria-autocomplete\"]>;\n value: string;\n onBlur: FocusEventHandler<ComboboxEl>;\n onChange: ChangeEventHandler<ComboboxEl>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteListboxProps<\n T extends AutocompleteOption = AutocompleteOption,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends Omit<ComboboxMenuProps<PopupEl>, \"ref\">, OptionSelectedIconProps {\n value: T | null | readonly T[];\n setValue: Dispatch<T>;\n onEnter: (appearing: boolean) => void;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableAutocompleteListboxProps\n extends ConfigurableComboboxMenuProps, OptionSelectedIconProps {\n id?: string;\n}\n\n/**\n * - `\"always\"` - the clear button is always visible\n * - `\"active\"` - the clear button will be visible when:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n * - `\"query\"` - the clear button will be visible when:\n * - the input has a value and:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n *\n * @since 6.0.0\n */\nexport type ClearButtonVisibility = \"query\" | \"active\" | \"always\";\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableAutocompleteClearButtonProps extends ButtonProps {\n /** @defaultValue `\"Clear\"` */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"autocomplete-clear-\" + useId()` */\n id?: string;\n\n /** {@inheritDoc ClearButtonVisibility} */\n visibility?: ClearButtonVisibility;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface AutocompleteClearButtonProps extends ConfigurableAutocompleteClearButtonProps {\n onClick: MouseEventHandler<HTMLButtonElement>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableAutocompleteDropdownButtonProps extends ButtonProps {\n /** @defaultValue `AutocompleteProps.listboxLabel` */\n \"aria-label\"?: string;\n /** @defaultValue `AutocompleteProps.listboxLabelledby` */\n \"aria-labelledby\"?: string;\n\n /** @defaultValue `\"autocomplete-dropdown-\" + useId()` */\n id?: string;\n\n /** @defaultValue `getIcon(\"dropdown\")` */\n icon?: ReactNode;\n iconRotatorProps?: Omit<IconRotatorProps, \"rotated\">;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteDropdownButtonProps extends ConfigurableAutocompleteDropdownButtonProps {\n \"aria-controls\": string;\n onClick: MouseEventHandler<HTMLButtonElement>;\n visible: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteCircularProgressProps extends CircularProgressProps {\n /** @defaultValue `\"Loading\"` */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"current-color\"` */\n theme?: ProgressTheme;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteChipProps extends ChipProps {\n /**\n * @defaultValue `typeof children === \"string\" ? \\`Remove \"${children}\"\\` : undefined`\n */\n \"aria-description\"?: string;\n\n /** @defaultValue `getIcon(\"remove\")` */\n removeIcon?: ReactNode;\n children: ReactNode;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteWithQueryImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends\n EditableComboboxImplementation<ComboboxEl, PopupEl>,\n Required<AutocompleteGetOptionProps<Option>>,\n Required<AutocompleteGetOptionLabel<Option>> {\n query: string;\n setQuery: Dispatch<string>;\n comboboxProps: AutocompleteComboboxProps<ComboboxEl>;\n\n /**\n * This is a convenience prop to determine if the autocomplete supports\n * multiselect.\n */\n multiselect: boolean;\n\n /**\n * This is the current list of options that will be filtered based on the\n * current `query`. This should normally be rendered in the\n * `AutocompleteListboxChildren` component\n */\n availableOptions: readonly Option[];\n\n /**\n * Generates the props required for the `Listbox` component and should\n * normally be provided any menu props that might override the default display\n * settings.\n */\n getListboxProps: (\n overrides?: ConfigurableAutocompleteListboxProps\n ) => AutocompleteListboxProps<Option, PopupEl>;\n\n /**\n * Generates the props required for the `AutocompleteClearButton`.\n */\n getClearButtonProps: (\n overrides?: ConfigurableAutocompleteClearButtonProps\n ) => AutocompleteClearButtonProps;\n\n /**\n * Generates the props required for the `AutocompleteDropdownButton`.\n */\n getDropdownButtonProps: (\n overrides?: ConfigurableAutocompleteDropdownButtonProps\n ) => AutocompleteDropdownButtonProps;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteSingleSelectImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> extends AutocompleteWithQueryImplementation<Option, ComboboxEl, PopupEl> {\n value: Option | null;\n setValue: Dispatch<Option | null>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteMultiSelectImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> extends AutocompleteWithQueryImplementation<Option, ComboboxEl, PopupEl> {\n value: readonly Option[];\n setValue: Dispatch<readonly Option[]>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> extends AutocompleteWithQueryImplementation<Option, ComboboxEl, PopupEl> {\n value: Option | null | readonly Option[];\n setValue: Dispatch<Option | null | readonly Option[]>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteBaseProps<Option extends AutocompleteOption>\n extends\n Omit<TextFieldProps, \"value\" | \"defaultValue\">,\n AutocompleteFilterAndListboxOptions<Option>,\n ComboboxVisibilityOptions {\n inputRef?: Ref<HTMLInputElement>;\n\n /**\n * An `aria-label` to pass to the `Listbox` component that describes the list\n * of {@link options}. Either this or the {@link listboxLabelledBy} are\n * required for accessibility.\n */\n listboxLabel?: string;\n\n /**\n * An `aria-labelledby` to pass to the `Listbox` component that describes the\n * list of {@link options}. Either this or the {@link listboxLabel} are\n * required for accessibility.\n */\n listboxLabelledBy?: string;\n\n /**\n * Any additional props that should be passed to the `Listbox` component.\n */\n listboxProps?: PropsWithRef<ConfigurableAutocompleteListboxProps>;\n\n /**\n * This can be used to add any custom styling, change the icon, change the\n * label, etc for the dropdown button.\n *\n * @example Simple Example\n * ```tsx\n * dropdownButtonProps={{\n * \"aria-label\": \"Open\",\n * className: styles.dropdownButton,\n * icon: <MyCustomDropdownIcon />,\n * }}\n * ```\n */\n dropdownButtonProps?: ConfigurableAutocompleteDropdownButtonProps;\n\n /**\n * Set this to `true` to remove the {@link DropdownButton} from being rendered\n * after the input element.\n *\n * @defaultValue `false`\n */\n disableDropdownButton?: boolean;\n\n /**\n * Set this to `true` to disable a `<CircularProgress />` after the input and\n * before the `<DropdownButton />`.\n *\n * @defaultValue `false`\n */\n loading?: boolean;\n\n /**\n * @defaultValue `{ \"aria-label\": \"Loading\", ...loadingProps }`\n */\n loadingProps?: AutocompleteCircularProgressProps;\n\n /**\n * This will do nothing if {@link disableClearButton} is `true`.\n */\n clearButtonProps?: PropsWithRef<ConfigurableAutocompleteClearButtonProps>;\n\n /**\n * Set to `true` to hide the clear button that appears when hovering an\n * `Autocomplete` that has a value. The user will still be able to clear the\n * value quickly using the `Escape` key.\n *\n * @defaultValue `false`\n */\n disableClearButton?: boolean;\n\n /**\n * - `\"always\"` - the clear button is always visible\n * - `\"active\"` - the clear button will be visible when:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n * - `\"query\"` - the clear button will be visible when:\n * - the input has a value and:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n *\n * @defaultValue `\"query\"`\n */\n clearButtonVisibility?: ClearButtonVisibility;\n\n /**\n * This is a convenience prop for the `onEntering`/`onEntered` transition\n * callbacks that will ensure it is only called once even if the transitions\n * are disabled. A great use-case for this function is to fetch data once the\n * menu is opened.\n */\n onOpen?: () => void;\n\n /**\n * The children to display when there are no {@link options} due to the\n * current text box value.\n *\n * @defaultValue `<ListSubheader>No options</ListSubheader`\n */\n noOptionsChildren?: ReactNode;\n\n /**\n * Set this to `true` when using a multiselect autocomplete to prevent the\n * selected values from being rendered inline with the input. This is useful\n * when the selected values should be shown in a different part of the UI\n * instead.\n *\n * @defaultValue `false`\n */\n disableInlineChips?: boolean;\n\n /**\n * This can be used to add additional props to each inline chip for multiselect\n * autocompletes.\n *\n * @example Simple Example\n * ```tsx\n * getChipProps={({ option, index }) => {\n * return {\n * disabled: index < 3,\n * className: cnb(option === \"a\" && styles.blue)<\n * };\n * }}\n * ```\n */\n getChipProps?: AutocompleteGetChipProps<Option>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteListboxLabelProps =\n | { listboxLabel: string }\n | { listboxLabelledBy: string };\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteQueryAndExtractorProps<\n Option extends AutocompleteOption,\n> = AutocompleteBaseProps<Option> &\n AutocompleteOptionLabelExtractor<Option> &\n AutocompleteQuery &\n AutocompleteListboxLabelProps;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteSingleSelectProps<Option extends AutocompleteOption> =\n AutocompleteQueryAndExtractorProps<Option> &\n AutocompleteValue<Option | null> & {\n checkboxes?: never;\n getChipProps?: never;\n disableInlineChips?: never;\n };\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteMultiSelectProps<Option extends AutocompleteOption> =\n AutocompleteQueryAndExtractorProps<Option> &\n AutocompleteValue<readonly Option[]>;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteProps<Option extends AutocompleteOption> =\n AutocompleteBaseProps<Option> &\n AutocompleteUnknownQueryAndValueOptions<Option>;\n"],"names":[],"mappings":"AAy2BA;;CAEC,GACD,WAEoD"}
|
|
1
|
+
{"version":3,"sources":["../../src/autocomplete/types.ts"],"sourcesContent":["import {\n type AriaAttributes,\n type ChangeEventHandler,\n type Dispatch,\n type FocusEventHandler,\n type MouseEventHandler,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { type ButtonProps } from \"../button/Button.js\";\nimport { type ChipProps } from \"../chip/Chip.js\";\nimport {\n type OptionProps,\n type OptionSelectedIconProps,\n} from \"../form/Option.js\";\nimport { type TextFieldProps } from \"../form/TextField.js\";\nimport {\n type ComboboxMenuProps,\n type ComboboxVisibilityOptions,\n type ConfigurableComboboxMenuProps,\n} from \"../form/useCombobox.js\";\nimport {\n type EditableComboboxImplementation,\n type EditableComboboxOptions,\n type EditableComboboxWidgetProps,\n} from \"../form/useEditableCombobox.js\";\nimport { type EditableHTMLElement } from \"../form/utils.js\";\nimport { type IconRotatorProps } from \"../icon/IconRotator.js\";\nimport { type CircularProgressProps } from \"../progress/CircularProgress.js\";\nimport { type ProgressTheme } from \"../progress/types.js\";\nimport { type BaseSearchOptions } from \"../searching/types.js\";\nimport {\n type AutomaticTextExtraction,\n type PropsWithRef,\n type TextExtractor,\n type UseStateInitializer,\n} from \"../types.js\";\n\n// NOTE: The augmentation appears in this file since both\n// the `Autocomplete` and `autocompleteStyles` import this\n// file. The augmentation only works if a type definition\n// exists in the compiled `*.d.ts`\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-autocomplete-clear-button-size\"?: string;\n \"--rmd-autocomplete-dropdown-button-size\"?: string;\n \"--rmd-autocomplete-circular-progress-size\"?: string;\n \"--rmd-autocomplete-inline-gap\"?: string;\n \"--rmd-autocomplete-inline-min-width\"?: string;\n \"--rmd-autocomplete-addon-gap\"?: string;\n \"--rmd-autocomplete-gap-count\"?: string;\n \"--rmd-autocomplete-addon-spacing\"?: string;\n }\n}\n\n/**\n * If a autocomplete value is one of these types, no additional code is required\n * to display a label in the input/chip for the autocomplete once the value has\n * been selected.\n *\n * - `\"some value\"` -> `\"some value\"`\n * - `{ label: \"Hello, world\", value: 300 }` -> `\"Hello, world!\"`\n * - `{ name: \"Hello, world\", value: 300 }` -> `\"Hello, world!\"`\n *\n * @since 6.0.0\n * @deprecated @since 6.2.0 Use `AutomaticTextExtraction` instead.\n */\nexport type AutocompleteLabeledOption = AutomaticTextExtraction;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteOption = AutomaticTextExtraction | object;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteFilterOptions<Option extends AutocompleteOption> = Pick<\n Required<BaseSearchOptions<Option>>,\n \"list\" | \"query\" | \"extractor\"\n>;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteFilterFunction<Option extends AutocompleteOption> = (\n options: AutocompleteFilterOptions<Option>\n) => readonly Option[];\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteGetOptionPropsOptions<\n Option extends AutocompleteOption,\n> {\n index: number;\n query: string;\n option: Option;\n selected: boolean;\n extractor: TextExtractor<Option>;\n}\n\n/**\n * @see {@link AutocompleteGetOptionProps.getOptionProps}\n * @since 6.0.0\n */\nexport type AutocompleteGetOptionPropsCallback<\n Option extends AutocompleteOption,\n> = (\n options: AutocompleteGetOptionPropsOptions<Option>\n) => ConfigurableAutocompleteOptionProps | undefined;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteGetOptionProps<Option extends AutocompleteOption> {\n /**\n * This can be used to add additional props to each option.\n *\n * @example Simple Example\n * ```tsx\n * getOptionProps={({ option }) => {\n * return {\n * disabled: option === \"\",\n * className: cnb(option === \"a\" && styles.blue),\n * leftAddon: option === value && <CheckIcon />,\n * };\n * }}\n * ```\n *\n * @see {@link AutocompleteGetOptionPropsOptions}\n * @see {@link AutocompleteGetOptionPropsCallback}\n * @since 6.0.0\n */\n getOptionProps?: AutocompleteGetOptionPropsCallback<Option>;\n}\n\n/**\n * @see {@link AutocompleteBaseProps.getChipProps}\n * @since 6.0.0\n */\nexport type AutocompleteGetChipProps<Option extends AutocompleteOption> = (\n options: Omit<AutocompleteGetOptionPropsOptions<Option>, \"selected\">\n) => Partial<AutocompleteChipProps> | undefined;\n\n/**\n * @see {@link AutocompleteGetOptionLabel}\n * @since 6.0.0\n */\nexport type AutocompleteGetOptionLabelCallback<\n Option extends AutocompleteOption,\n> = (option: Option) => string;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteGetOptionLabel<Option extends AutocompleteOption> {\n /**\n * If the list of options contain an object that doesn't have a\n * `label: string`, this prop must be provided to extract a string to display\n * in the text field once selected.\n *\n * @example No Getter Required\n * ```tsx\n * const options1 = ['a', 'b', 'c', 'd'];\n * const options2 = [{ label: 'a' }, { label: 'b' }, { label: 'c' }, { label: 'd' }];\n *\n * <Autocomplete options={options1} />\n * <Autocomplete options={options2} />\n * ```\n *\n * @example Getter Required\n * ```tsx\n * const options = [\n * {\n * name: \"Alaska\",\n * abbr: \"AK\",\n * },\n * {\n * name: \"Arizona\",\n * abbr: \"AZ\",\n * }\n * ];\n *\n * <Autocomplete options={options} getOptionLabel={(state) => state.name} />\n * ```\n *\n * @defaultValue `defaultAutocompleteExtractor`\n * @since 6.0.0\n */\n getOptionLabel?: AutocompleteGetOptionLabelCallback<Option>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type ConfigurableAutocompleteOptionProps = Partial<\n Omit<OptionProps, \"role\" | \"value\">\n>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteControlledValue<T> {\n value: T;\n setValue: Dispatch<T>;\n defaultValue?: never;\n onValueChange?: never;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteUncontrolledValue<T> {\n value?: never;\n setValue?: never;\n defaultValue?: UseStateInitializer<T>;\n\n /**\n * This prop should be used when some action should occur whenever the value\n * changes, but is not required to be stored in state. For all other cases, it\n * is recommended to control the `value` instead of using this prop.\n *\n * @defaultValue `() => {}`\n */\n onValueChange?: (value: T) => void;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteValue<T> =\n | AutocompleteControlledValue<T>\n | AutocompleteUncontrolledValue<T>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteControlledQuery {\n query: string;\n setQuery: Dispatch<string>;\n defaultQuery?: never;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteUncontrolledQuery {\n query?: never;\n setQuery?: never;\n defaultQuery?: UseStateInitializer<string>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteQuery =\n | AutocompleteControlledQuery\n | AutocompleteUncontrolledQuery;\n\n/**\n * This allows the `query` to be updated whenever a new value has been selected.\n *\n * - `\"clear\"` - clears the `query`\n * - `\"selected\"` - sets the \tquery\t to the selected value's label\n * - `\"as-is\"` - doesn't change the `query`\n *\n * @defaultValue `(multiselect || Array.isArray(value ?? defaultValue)) ? \"clear\" : \"selected\"`\n * @since 6.0.0\n */\nexport type AutocompleteUpdateQueryOnSelect = \"clear\" | \"selected\" | \"as-is\";\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteUnknownQueryAndValueOptions<\n Option extends AutocompleteOption,\n> {\n query?: string;\n setQuery?: Dispatch<string>;\n defaultQuery?: UseStateInitializer<string>;\n value?: Option | null | readonly Option[];\n setValue?: Dispatch<Option | null | readonly Option[]>;\n defaultValue?: UseStateInitializer<Option | null | readonly Option[]>;\n onValueChange?: (value: Option | null | readonly Option[]) => void;\n}\n\n/**\n * A utility type that makes the `getOptionLabel` required when an option is not\n * a {@link AutomaticTextExtraction}.\n *\n * @since 6.0.0\n */\nexport type AutocompleteOptionLabelExtractor<\n Option extends AutocompleteOption,\n> = Option extends AutomaticTextExtraction\n ? AutocompleteGetOptionLabel<Option>\n : Required<AutocompleteGetOptionLabel<Option>>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteFilteringOptions<\n Option extends AutocompleteOption,\n> extends AutocompleteGetOptionLabel<Option> {\n /**\n * The list of options that can be shown within the autocomplete and filtered\n * based on the current query.\n */\n options: readonly Option[];\n\n /**\n * The function that filters the {@link options} based on the current query\n * and defaults to a case insensitive search that starts with the query.\n *\n * @example Case Insensitive Anywhere\n * ```tsx\n * import { caseInsensitiveSearch } from \"@react-md/core/searching/caseInsensitive\";\n *\n * <Autocomplete {...props} filter={caseInsensitiveSearch} />\n * ```\n *\n * @example Fuzzy Filtering\n * ```tsx\n * import { fuzzySearch } from \"@react-md/core/searching/fuzzy\";\n *\n * <Autocomplete {...props} filter={fuzzySearch} />\n * ```\n *\n * @example Async Searching\n * ```tsx\n * import { useDebouncedFunction } from \"@react-md/core/useDebouncedFunction\";\n * import { useState } from \"react\";\n *\n * interface State {\n * loading: boolean;\n * options: readonly string[];\n * }\n *\n * function Example() {\n * const [state, setState] = useState<State>({\n * loading: false,\n * options: [],\n * });\n *\n * const search = useDebouncedFunction(async (query: string) => {\n * setState(prev => ({ ...prev, loading: true }));\n *\n * const options = await someAsyncTask(query);\n * setState({ loading: false, options })\n * });\n *\n * return (\n * <Autocomplete\n * {...props}\n * // Setting `type=\"search\"` automatically updates the `filter` prop to\n * // be `noopAutocompleteFilter`\n * type=\"search\"\n * options={options}\n * onChange={(event) => search(event.currentTarget.value)}\n * />\n * );\n * }\n * ```\n *\n * @defaultValue `defaultAutocompleteFilter`\n */\n filter?: AutocompleteFilterFunction<Option>;\n\n /**\n * Set this to `true` to update the filtering behavior to also remove the\n * selected value from the available options. This is mostly for the\n * multiselect behavior.\n *\n * @defaultValue `false`\n */\n filterSelected?: boolean;\n\n /**\n * Set this to `true` to allow any value to be typed into the autocomplete\n * instead of enforcing an empty string or one of the option labels.\n *\n * @defaultValue `filter === noopAutocompleteFilter`\n */\n allowAnyValue?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteFilterAndListboxOptions<\n Option extends AutocompleteOption,\n>\n extends\n AutocompleteFilteringOptions<Option>,\n AutocompleteGetOptionProps<Option>,\n OptionSelectedIconProps {\n /**\n * Set this to `true` when using a multiselect autocomplete to update each\n * option to use checkboxes to show the selection state.\n *\n * @defaultValue `false`\n */\n checkboxes?: boolean;\n\n /**\n * @see {@link OptionSelectedIconProps.disableSelectedIcon}\n * @defaultValue `!checkboxes`\n */\n disableSelectedIcon?: boolean;\n\n /**\n * @see {@link AutocompleteUpdateQueryOnSelect}\n * @defaultValue `multiselect ? \"clear\" : \"selected\"`\n */\n updateQueryOnSelect?: AutocompleteUpdateQueryOnSelect;\n\n /**\n * Set this to `true` to prevent the listbox from closing when an option is\n * selected.\n *\n * @defaultValue `checkboxes`\n */\n disableCloseOnSelect?: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteEditableComboboxOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends\n EditableComboboxOptions<ComboboxEl, PopupEl>,\n AutocompleteFilterAndListboxOptions<Option> {\n onBlur?: FocusEventHandler<ComboboxEl>;\n onChange?: ChangeEventHandler<ComboboxEl>;\n\n /**\n * This is a convenience prop for the `onEntering`/`onEntered` transition\n * callbacks that will ensure it is only called once even if the transitions\n * are disabled. A great use-case for this function is to fetch data once the\n * menu is opened.\n */\n onOpen?: () => void;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteQueryAndExtractorOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> = AutocompleteEditableComboboxOptions<Option, ComboboxEl, PopupEl> &\n AutocompleteOptionLabelExtractor<Option> &\n AutocompleteQuery;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteSingleSelectOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> = AutocompleteQueryAndExtractorOptions<Option, ComboboxEl, PopupEl> &\n AutocompleteValue<Option | null>;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteMultiSelectOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> = AutocompleteQueryAndExtractorOptions<Option, ComboboxEl, PopupEl> &\n AutocompleteValue<readonly Option[]>;\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteOptions<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends\n AutocompleteEditableComboboxOptions<Option, ComboboxEl, PopupEl>,\n AutocompleteUnknownQueryAndValueOptions<Option> {}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteComboboxProps<\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n> extends EditableComboboxWidgetProps<ComboboxEl> {\n \"aria-autocomplete\": NonNullable<AriaAttributes[\"aria-autocomplete\"]>;\n value: string;\n onBlur: FocusEventHandler<ComboboxEl>;\n onChange: ChangeEventHandler<ComboboxEl>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteListboxProps<\n T extends AutocompleteOption = AutocompleteOption,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends Omit<ComboboxMenuProps<PopupEl>, \"ref\">, OptionSelectedIconProps {\n value: T | null | readonly T[];\n setValue: Dispatch<T>;\n onEnter: (appearing: boolean) => void;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableAutocompleteListboxProps\n extends ConfigurableComboboxMenuProps, OptionSelectedIconProps {\n id?: string;\n}\n\n/**\n * - `\"always\"` - the clear button is always visible\n * - `\"active\"` - the clear button will be visible when:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n * - `\"query\"` - the clear button will be visible when:\n * - the input has a value and:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n *\n * @since 6.0.0\n */\nexport type ClearButtonVisibility = \"query\" | \"active\" | \"always\";\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableAutocompleteClearButtonProps extends ButtonProps {\n /** @defaultValue `\"Clear\"` */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"autocomplete-clear-\" + useId()` */\n id?: string;\n\n /** {@inheritDoc ClearButtonVisibility} */\n visibility?: ClearButtonVisibility;\n}\n\n/**\n * @internal\n * @since 6.0.0\n */\nexport interface AutocompleteClearButtonProps extends ConfigurableAutocompleteClearButtonProps {\n onClick: MouseEventHandler<HTMLButtonElement>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface ConfigurableAutocompleteDropdownButtonProps extends ButtonProps {\n /** @defaultValue `AutocompleteProps.listboxLabel` */\n \"aria-label\"?: string;\n /** @defaultValue `AutocompleteProps.listboxLabelledby` */\n \"aria-labelledby\"?: string;\n\n /** @defaultValue `\"autocomplete-dropdown-\" + useId()` */\n id?: string;\n\n /** @defaultValue `getIcon(\"dropdown\")` */\n icon?: ReactNode;\n iconRotatorProps?: Omit<IconRotatorProps, \"rotated\">;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteDropdownButtonProps extends ConfigurableAutocompleteDropdownButtonProps {\n \"aria-controls\": string;\n onClick: MouseEventHandler<HTMLButtonElement>;\n visible: boolean;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteCircularProgressProps extends CircularProgressProps {\n /** @defaultValue `\"Loading\"` */\n \"aria-label\"?: string;\n\n /** @defaultValue `\"current-color\"` */\n theme?: ProgressTheme;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteChipProps extends ChipProps {\n ref?: Ref<HTMLButtonElement>;\n\n /**\n * @defaultValue `typeof children === \"string\" ? \\`Remove \"${children}\"\\` : undefined`\n */\n \"aria-description\"?: string;\n\n /** @defaultValue `getIcon(\"remove\")` */\n removeIcon?: ReactNode;\n children: ReactNode;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteWithQueryImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n>\n extends\n EditableComboboxImplementation<ComboboxEl, PopupEl>,\n Required<AutocompleteGetOptionProps<Option>>,\n Required<AutocompleteGetOptionLabel<Option>> {\n query: string;\n setQuery: Dispatch<string>;\n comboboxProps: AutocompleteComboboxProps<ComboboxEl>;\n\n /**\n * This is a convenience prop to determine if the autocomplete supports\n * multiselect.\n */\n multiselect: boolean;\n\n /**\n * This is the current list of options that will be filtered based on the\n * current `query`. This should normally be rendered in the\n * `AutocompleteListboxChildren` component\n */\n availableOptions: readonly Option[];\n\n /**\n * Generates the props required for the `Listbox` component and should\n * normally be provided any menu props that might override the default display\n * settings.\n */\n getListboxProps: (\n overrides?: ConfigurableAutocompleteListboxProps\n ) => AutocompleteListboxProps<Option, PopupEl>;\n\n /**\n * Generates the props required for the `AutocompleteClearButton`.\n */\n getClearButtonProps: (\n overrides?: ConfigurableAutocompleteClearButtonProps\n ) => AutocompleteClearButtonProps;\n\n /**\n * Generates the props required for the `AutocompleteDropdownButton`.\n */\n getDropdownButtonProps: (\n overrides?: ConfigurableAutocompleteDropdownButtonProps\n ) => AutocompleteDropdownButtonProps;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteSingleSelectImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> extends AutocompleteWithQueryImplementation<Option, ComboboxEl, PopupEl> {\n value: Option | null;\n setValue: Dispatch<Option | null>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteMultiSelectImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> extends AutocompleteWithQueryImplementation<Option, ComboboxEl, PopupEl> {\n value: readonly Option[];\n setValue: Dispatch<readonly Option[]>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteImplementation<\n Option extends AutocompleteOption,\n ComboboxEl extends EditableHTMLElement = HTMLInputElement,\n PopupEl extends HTMLElement = HTMLElement,\n> extends AutocompleteWithQueryImplementation<Option, ComboboxEl, PopupEl> {\n value: Option | null | readonly Option[];\n setValue: Dispatch<Option | null | readonly Option[]>;\n}\n\n/**\n * @since 6.0.0\n */\nexport interface AutocompleteBaseProps<Option extends AutocompleteOption>\n extends\n Omit<TextFieldProps, \"value\" | \"defaultValue\">,\n AutocompleteFilterAndListboxOptions<Option>,\n ComboboxVisibilityOptions {\n inputRef?: Ref<HTMLInputElement>;\n\n /**\n * An `aria-label` to pass to the `Listbox` component that describes the list\n * of {@link options}. Either this or the {@link listboxLabelledBy} are\n * required for accessibility.\n */\n listboxLabel?: string;\n\n /**\n * An `aria-labelledby` to pass to the `Listbox` component that describes the\n * list of {@link options}. Either this or the {@link listboxLabel} are\n * required for accessibility.\n */\n listboxLabelledBy?: string;\n\n /**\n * Any additional props that should be passed to the `Listbox` component.\n */\n listboxProps?: PropsWithRef<ConfigurableAutocompleteListboxProps>;\n\n /**\n * This can be used to add any custom styling, change the icon, change the\n * label, etc for the dropdown button.\n *\n * @example Simple Example\n * ```tsx\n * dropdownButtonProps={{\n * \"aria-label\": \"Open\",\n * className: styles.dropdownButton,\n * icon: <MyCustomDropdownIcon />,\n * }}\n * ```\n */\n dropdownButtonProps?: ConfigurableAutocompleteDropdownButtonProps;\n\n /**\n * Set this to `true` to remove the {@link DropdownButton} from being rendered\n * after the input element.\n *\n * @defaultValue `false`\n */\n disableDropdownButton?: boolean;\n\n /**\n * Set this to `true` to disable a `<CircularProgress />` after the input and\n * before the `<DropdownButton />`.\n *\n * @defaultValue `false`\n */\n loading?: boolean;\n\n /**\n * @defaultValue `{ \"aria-label\": \"Loading\", ...loadingProps }`\n */\n loadingProps?: AutocompleteCircularProgressProps;\n\n /**\n * This will do nothing if {@link disableClearButton} is `true`.\n */\n clearButtonProps?: PropsWithRef<ConfigurableAutocompleteClearButtonProps>;\n\n /**\n * Set to `true` to hide the clear button that appears when hovering an\n * `Autocomplete` that has a value. The user will still be able to clear the\n * value quickly using the `Escape` key.\n *\n * @defaultValue `false`\n */\n disableClearButton?: boolean;\n\n /**\n * - `\"always\"` - the clear button is always visible\n * - `\"active\"` - the clear button will be visible when:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n * - `\"query\"` - the clear button will be visible when:\n * - the input has a value and:\n * - the user moves focus within the autocomplete\n * - the user hovers the autocomplete\n *\n * @defaultValue `\"query\"`\n */\n clearButtonVisibility?: ClearButtonVisibility;\n\n /**\n * This is a convenience prop for the `onEntering`/`onEntered` transition\n * callbacks that will ensure it is only called once even if the transitions\n * are disabled. A great use-case for this function is to fetch data once the\n * menu is opened.\n */\n onOpen?: () => void;\n\n /**\n * The children to display when there are no {@link options} due to the\n * current text box value.\n *\n * @defaultValue `<ListSubheader>No options</ListSubheader`\n */\n noOptionsChildren?: ReactNode;\n\n /**\n * Set this to `true` when using a multiselect autocomplete to prevent the\n * selected values from being rendered inline with the input. This is useful\n * when the selected values should be shown in a different part of the UI\n * instead.\n *\n * @defaultValue `false`\n */\n disableInlineChips?: boolean;\n\n /**\n * This can be used to add additional props to each inline chip for multiselect\n * autocompletes.\n *\n * @example Simple Example\n * ```tsx\n * getChipProps={({ option, index }) => {\n * return {\n * disabled: index < 3,\n * className: cnb(option === \"a\" && styles.blue)<\n * };\n * }}\n * ```\n */\n getChipProps?: AutocompleteGetChipProps<Option>;\n}\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteListboxLabelProps =\n | { listboxLabel: string }\n | { listboxLabelledBy: string };\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteQueryAndExtractorProps<\n Option extends AutocompleteOption,\n> = AutocompleteBaseProps<Option> &\n AutocompleteOptionLabelExtractor<Option> &\n AutocompleteQuery &\n AutocompleteListboxLabelProps;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteSingleSelectProps<Option extends AutocompleteOption> =\n AutocompleteQueryAndExtractorProps<Option> &\n AutocompleteValue<Option | null> & {\n checkboxes?: never;\n getChipProps?: never;\n disableInlineChips?: never;\n };\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteMultiSelectProps<Option extends AutocompleteOption> =\n AutocompleteQueryAndExtractorProps<Option> &\n AutocompleteValue<readonly Option[]>;\n\n/**\n * @since 6.0.0\n */\nexport type AutocompleteProps<Option extends AutocompleteOption> =\n AutocompleteBaseProps<Option> &\n AutocompleteUnknownQueryAndValueOptions<Option>;\n"],"names":[],"mappings":"AA22BA;;CAEC,GACD,WAEoD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type RefObject } from "react";
|
|
2
2
|
import { type EditableHTMLElement } from "../form/utils.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type UseStateInitializer } from "../types.js";
|
|
4
4
|
import { type AutocompleteFilterOptions, type AutocompleteGetOptionLabel, type AutocompleteOption } from "./types.js";
|
|
5
5
|
/**
|
|
6
6
|
* @since 6.0.0
|
|
@@ -40,10 +40,10 @@ export interface EnforceSelectedValueOptions<Option extends AutocompleteOption>
|
|
|
40
40
|
value: Option | readonly Option[] | null;
|
|
41
41
|
visible: boolean;
|
|
42
42
|
container: HTMLElement | null;
|
|
43
|
-
popupRef: RefObject<HTMLElement>;
|
|
44
|
-
comboboxRef: RefObject<EditableHTMLElement>;
|
|
43
|
+
popupRef: RefObject<HTMLElement | null>;
|
|
44
|
+
comboboxRef: RefObject<EditableHTMLElement | null>;
|
|
45
45
|
availableOptions: readonly Option[];
|
|
46
|
-
prevAvailableOptions:
|
|
46
|
+
prevAvailableOptions: RefObject<readonly Option[] | null>;
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* This enforces that if the user clicks away, touches somewhere else on the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/autocomplete/utils.ts"],"sourcesContent":["import { type RefObject } from \"react\";\n\nimport {\n type EditableHTMLElement,\n triggerManualChangeEvent,\n} from \"../form/utils.js\";\nimport { type
|
|
1
|
+
{"version":3,"sources":["../../src/autocomplete/utils.ts"],"sourcesContent":["import { type RefObject } from \"react\";\n\nimport {\n type EditableHTMLElement,\n triggerManualChangeEvent,\n} from \"../form/utils.js\";\nimport { type UseStateInitializer } from \"../types.js\";\nimport { noopAutocompleteFilter } from \"./defaults.js\";\nimport {\n type AutocompleteFilterOptions,\n type AutocompleteGetOptionLabel,\n type AutocompleteOption,\n} from \"./types.js\";\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface GetDefaultValueOptions<\n Option extends AutocompleteOption,\n> extends Required<AutocompleteGetOptionLabel<Option>> {\n query: string | undefined;\n multiselect?: boolean;\n defaultQuery: UseStateInitializer<string> | undefined;\n defaultValue:\n | UseStateInitializer<Option | null | readonly Option[]>\n | undefined;\n options: readonly Option[];\n filter: (options: AutocompleteFilterOptions<Option>) => readonly Option[];\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport function getDefaultValue<Option extends AutocompleteOption>(\n options: GetDefaultValueOptions<Option>\n): UseStateInitializer<Option | null | readonly Option[]> {\n const {\n query,\n filter,\n multiselect,\n defaultQuery,\n defaultValue,\n options: values,\n getOptionLabel,\n } = options;\n\n if (defaultValue !== undefined) {\n return defaultValue;\n }\n\n // do not support determining the default value for a multiselect\n // autocomplete if only a query was provided.\n if (multiselect) {\n return [];\n }\n\n // do not support a default value out of the box for this case\n if (filter === noopAutocompleteFilter) {\n return null;\n }\n\n return () => {\n let q = \"\";\n if (query) {\n q = query;\n } else if (defaultQuery) {\n q = typeof defaultQuery === \"function\" ? defaultQuery() : defaultQuery;\n }\n\n if (!q) {\n return null;\n }\n\n const filtered = filter({\n list: values,\n query: q,\n extractor: getOptionLabel,\n });\n\n return filtered[0] ?? null;\n };\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\ninterface GetDefaultQueryOptions<\n Option extends AutocompleteOption,\n> extends Required<AutocompleteGetOptionLabel<Option>> {\n value: Option | null | readonly Option[];\n defaultQuery?: UseStateInitializer<string>;\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport function getDefaultQuery<Option extends AutocompleteOption>(\n options: GetDefaultQueryOptions<Option>\n): UseStateInitializer<string> {\n const { value, getOptionLabel, defaultQuery } = options;\n\n if (defaultQuery) {\n return defaultQuery;\n }\n\n return () => {\n if (typeof value === \"string\") {\n return value;\n }\n\n if (value && typeof value === \"object\" && !(\"length\" in value)) {\n return getOptionLabel(value);\n }\n\n return \"\";\n };\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport interface EnforceSelectedValueOptions<\n Option extends AutocompleteOption,\n> extends Required<AutocompleteGetOptionLabel<Option>> {\n value: Option | readonly Option[] | null;\n visible: boolean;\n container: HTMLElement | null;\n popupRef: RefObject<HTMLElement | null>;\n comboboxRef: RefObject<EditableHTMLElement | null>;\n availableOptions: readonly Option[];\n prevAvailableOptions: RefObject<readonly Option[] | null>;\n}\n\n/**\n * This enforces that if the user clicks away, touches somewhere else on the\n * page, tabs to the next element, or focuses another element programmatically\n * the autocomplete will set the `value` back to the previous selected value if\n * there was one. i.e.\n *\n * Case 1:\n * - User selects \"Apple\"\n * - User hits backspace twice. Input displays \"App\"\n * - User clicks somewhere else on the page\n * - Input now displays \"Apple\" again\n *\n * Case 2:\n * - User selects \"Apple\"\n * - User clears the input\n * - User types \"app\"\n * - User clicks somewhere else on the page\n * - Input now displays \"\" and the value is set to `null`\n *\n * NOTE: This mutates the {@link EnforceSelectedValueOptions.prevAvailableOptions}\n *\n * @since 6.0.0\n * @internal\n */\nexport function enforceSelectedValue<Option extends AutocompleteOption>(\n options: EnforceSelectedValueOptions<Option>\n): void {\n const {\n value,\n visible,\n container,\n popupRef,\n comboboxRef,\n getOptionLabel,\n availableOptions,\n prevAvailableOptions,\n } = options;\n\n if (!container) {\n return;\n }\n\n globalThis.requestAnimationFrame(() => {\n if (\n container.contains(document.activeElement) ||\n popupRef.current?.contains(document.activeElement)\n ) {\n return;\n }\n\n if (visible) {\n // this makes it so that the options are not filtered again while closing\n prevAvailableOptions.current = availableOptions;\n }\n\n let label = \"\";\n if (typeof value === \"string\") {\n label = value;\n } else if (typeof value === \"object\" && value && !(\"length\" in value)) {\n label = getOptionLabel(value);\n }\n\n triggerManualChangeEvent(comboboxRef.current, label);\n });\n}\n\n/**\n * @since 6.0.0\n * @internal\n */\nexport function isMultipleValues<Option extends AutocompleteOption>(\n value: Option | null | readonly Option[]\n): value is readonly Option[] {\n return !!value && typeof value === \"object\" && \"length\" in value;\n}\n"],"names":["triggerManualChangeEvent","noopAutocompleteFilter","getDefaultValue","options","query","filter","multiselect","defaultQuery","defaultValue","values","getOptionLabel","undefined","q","filtered","list","extractor","getDefaultQuery","value","enforceSelectedValue","visible","container","popupRef","comboboxRef","availableOptions","prevAvailableOptions","globalThis","requestAnimationFrame","contains","document","activeElement","current","label","isMultipleValues"],"mappings":"AAEA,SAEEA,wBAAwB,QACnB,mBAAmB;AAE1B,SAASC,sBAAsB,QAAQ,gBAAgB;AAwBvD;;;CAGC,GACD,OAAO,SAASC,gBACdC,OAAuC;IAEvC,MAAM,EACJC,KAAK,EACLC,MAAM,EACNC,WAAW,EACXC,YAAY,EACZC,YAAY,EACZL,SAASM,MAAM,EACfC,cAAc,EACf,GAAGP;IAEJ,IAAIK,iBAAiBG,WAAW;QAC9B,OAAOH;IACT;IAEA,iEAAiE;IACjE,6CAA6C;IAC7C,IAAIF,aAAa;QACf,OAAO,EAAE;IACX;IAEA,8DAA8D;IAC9D,IAAID,WAAWJ,wBAAwB;QACrC,OAAO;IACT;IAEA,OAAO;QACL,IAAIW,IAAI;QACR,IAAIR,OAAO;YACTQ,IAAIR;QACN,OAAO,IAAIG,cAAc;YACvBK,IAAI,OAAOL,iBAAiB,aAAaA,iBAAiBA;QAC5D;QAEA,IAAI,CAACK,GAAG;YACN,OAAO;QACT;QAEA,MAAMC,WAAWR,OAAO;YACtBS,MAAML;YACNL,OAAOQ;YACPG,WAAWL;QACb;QAEA,OAAOG,QAAQ,CAAC,EAAE,IAAI;IACxB;AACF;AAaA;;;CAGC,GACD,OAAO,SAASG,gBACdb,OAAuC;IAEvC,MAAM,EAAEc,KAAK,EAAEP,cAAc,EAAEH,YAAY,EAAE,GAAGJ;IAEhD,IAAII,cAAc;QAChB,OAAOA;IACT;IAEA,OAAO;QACL,IAAI,OAAOU,UAAU,UAAU;YAC7B,OAAOA;QACT;QAEA,IAAIA,SAAS,OAAOA,UAAU,YAAY,CAAE,CAAA,YAAYA,KAAI,GAAI;YAC9D,OAAOP,eAAeO;QACxB;QAEA,OAAO;IACT;AACF;AAkBA;;;;;;;;;;;;;;;;;;;;;;;CAuBC,GACD,OAAO,SAASC,qBACdf,OAA4C;IAE5C,MAAM,EACJc,KAAK,EACLE,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,WAAW,EACXZ,cAAc,EACda,gBAAgB,EAChBC,oBAAoB,EACrB,GAAGrB;IAEJ,IAAI,CAACiB,WAAW;QACd;IACF;IAEAK,WAAWC,qBAAqB,CAAC;QAC/B,IACEN,UAAUO,QAAQ,CAACC,SAASC,aAAa,KACzCR,SAASS,OAAO,EAAEH,SAASC,SAASC,aAAa,GACjD;YACA;QACF;QAEA,IAAIV,SAAS;YACX,yEAAyE;YACzEK,qBAAqBM,OAAO,GAAGP;QACjC;QAEA,IAAIQ,QAAQ;QACZ,IAAI,OAAOd,UAAU,UAAU;YAC7Bc,QAAQd;QACV,OAAO,IAAI,OAAOA,UAAU,YAAYA,SAAS,CAAE,CAAA,YAAYA,KAAI,GAAI;YACrEc,QAAQrB,eAAeO;QACzB;QAEAjB,yBAAyBsB,YAAYQ,OAAO,EAAEC;IAChD;AACF;AAEA;;;CAGC,GACD,OAAO,SAASC,iBACdf,KAAwC;IAExC,OAAO,CAAC,CAACA,SAAS,OAAOA,UAAU,YAAY,YAAYA;AAC7D"}
|
package/dist/avatar/Avatar.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HTMLAttributes, type ImgHTMLAttributes } from "react";
|
|
1
|
+
import { type HTMLAttributes, type ImgHTMLAttributes, type ReactElement, type Ref } from "react";
|
|
2
2
|
import { type PropsWithRef } from "../types.js";
|
|
3
3
|
import { type AvatarClassNameOptions } from "./styles.js";
|
|
4
4
|
export type AvatarImgAttributes = ImgHTMLAttributes<HTMLImageElement>;
|
|
@@ -7,6 +7,7 @@ export type AvatarImgAttributes = ImgHTMLAttributes<HTMLImageElement>;
|
|
|
7
7
|
* the `role="presentation"`.
|
|
8
8
|
*/
|
|
9
9
|
export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, "color">, AvatarClassNameOptions {
|
|
10
|
+
ref?: Ref<HTMLSpanElement>;
|
|
10
11
|
/**
|
|
11
12
|
* Since avatars are normally presentational data, they are hidden from screen
|
|
12
13
|
* readers by default.
|
|
@@ -73,4 +74,4 @@ export interface AvatarProps extends Omit<HTMLAttributes<HTMLSpanElement>, "colo
|
|
|
73
74
|
* @see {@link https://react-md.dev/components/avatar | Avatar Demos}
|
|
74
75
|
* @since 6.0.0 `aria-hidden` is set to `true` by default.
|
|
75
76
|
*/
|
|
76
|
-
export declare
|
|
77
|
+
export declare function Avatar(props: AvatarProps): ReactElement;
|
package/dist/avatar/Avatar.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { avatar, avatarImage } from "./styles.js";
|
|
4
3
|
/**
|
|
5
4
|
* An `Avatar` is generally used to represent objects or people within your app.
|
|
@@ -19,8 +18,8 @@ import { avatar, avatarImage } from "./styles.js";
|
|
|
19
18
|
*
|
|
20
19
|
* @see {@link https://react-md.dev/components/avatar | Avatar Demos}
|
|
21
20
|
* @since 6.0.0 `aria-hidden` is set to `true` by default.
|
|
22
|
-
*/ export
|
|
23
|
-
const { "aria-hidden": ariaHidden = true, className, children, src, alt = "", size = "avatar", color, theme, imgProps, referrerPolicy, ...remaining } = props;
|
|
21
|
+
*/ export function Avatar(props) {
|
|
22
|
+
const { ref, "aria-hidden": ariaHidden = true, className, children, src, alt = "", size = "avatar", color, theme, imgProps, referrerPolicy, ...remaining } = props;
|
|
24
23
|
let img;
|
|
25
24
|
if (src || imgProps) {
|
|
26
25
|
img = /*#__PURE__*/ _jsx("img", {
|
|
@@ -48,6 +47,6 @@ import { avatar, avatarImage } from "./styles.js";
|
|
|
48
47
|
children
|
|
49
48
|
]
|
|
50
49
|
});
|
|
51
|
-
}
|
|
50
|
+
}
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=Avatar.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ImgHTMLAttributes,\n type ReactNode,\n
|
|
1
|
+
{"version":3,"sources":["../../src/avatar/Avatar.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ImgHTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { type PropsWithRef } from \"../types.js\";\nimport { type AvatarClassNameOptions, avatar, avatarImage } from \"./styles.js\";\n\nexport type AvatarImgAttributes = ImgHTMLAttributes<HTMLImageElement>;\n\n/**\n * @since 6.0.0 `aria-hidden` is set to `true` by default and removed\n * the `role=\"presentation\"`.\n */\nexport interface AvatarProps\n extends\n Omit<HTMLAttributes<HTMLSpanElement>, \"color\">,\n AvatarClassNameOptions {\n ref?: Ref<HTMLSpanElement>;\n\n /**\n * Since avatars are normally presentational data, they are hidden from screen\n * readers by default.\n *\n * @defaultValue `true`\n */\n \"aria-hidden\"?: HTMLAttributes<HTMLSpanElement>[\"aria-hidden\"];\n\n /**\n * This should be an image `src` attribute to create an avatar from. When this\n * prop is defined, you should not add any children to the avatar as the\n * positioning will break.\n */\n src?: string;\n\n /**\n * An optional alt tag to display on the `<img>` when the `src` prop is also\n * applied.\n *\n * For accessibility and screen readers, you normally do not want to actually\n * provide this prop. This should only be used if the `Avatar` is not\n * accompanied by some other component or main content as it will be extra\n * noise for screen readers.\n *\n * @defaultValue `\"\"`\n */\n alt?: string;\n\n /**\n * An optional `referrerPolicy` to provide to the `<img>` element if the `src`\n * or `imgProps` props are provided.\n *\n * @see {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attr-referrerpolicy|Referrer Policy}\n *\n * @since 2.2.0\n */\n referrerPolicy?: AvatarImgAttributes[\"referrerPolicy\"];\n\n /**\n * An optional object of image props and ref that can be used to create an\n * image within the `Avatar`. This can be useful to add a custom `style`\n * or`className` to the `<img>` element if that additional customization is\n * needed.\n *\n * Note: The values in this object will override the `src`, `alt`, and\n * `referrerPolicy` root level avatar props if they exist on this object.\n *\n * @since 2.2.0\n */\n imgProps?: PropsWithRef<AvatarImgAttributes>;\n}\n\n/**\n * An `Avatar` is generally used to represent objects or people within your app.\n * The avatar can consist of an image, an icon, or some text to display. When\n * the avatar is not an image, different themes can be applied to make the\n * avatar more unique.\n *\n * @example Simple Example\n * ```tsx\n * import { Avatar } from \"@react-md/core/avatar/Avatar\";\n * import { type ReactElement } from \"react\";\n *\n * export function Example(): ReactElement {\n * return <Avatar src=\"/path-to-img.png\" />;\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/avatar | Avatar Demos}\n * @since 6.0.0 `aria-hidden` is set to `true` by default.\n */\nexport function Avatar(props: AvatarProps): ReactElement {\n const {\n ref,\n \"aria-hidden\": ariaHidden = true,\n className,\n children,\n src,\n alt = \"\",\n size = \"avatar\",\n color,\n theme,\n imgProps,\n referrerPolicy,\n ...remaining\n } = props;\n\n let img: ReactNode;\n if (src || imgProps) {\n img = (\n <img\n src={src}\n alt={alt}\n referrerPolicy={referrerPolicy}\n {...imgProps}\n className={avatarImage({ className: imgProps?.className })}\n />\n );\n }\n\n return (\n <span\n {...remaining}\n aria-hidden={ariaHidden}\n ref={ref}\n className={avatar({\n size,\n color,\n theme,\n className,\n })}\n >\n {img}\n {children}\n </span>\n );\n}\n"],"names":["avatar","avatarImage","Avatar","props","ref","ariaHidden","className","children","src","alt","size","color","theme","imgProps","referrerPolicy","remaining","img","span","aria-hidden"],"mappings":";AASA,SAAsCA,MAAM,EAAEC,WAAW,QAAQ,cAAc;AAkE/E;;;;;;;;;;;;;;;;;;CAkBC,GACD,OAAO,SAASC,OAAOC,KAAkB;IACvC,MAAM,EACJC,GAAG,EACH,eAAeC,aAAa,IAAI,EAChCC,SAAS,EACTC,QAAQ,EACRC,GAAG,EACHC,MAAM,EAAE,EACRC,OAAO,QAAQ,EACfC,KAAK,EACLC,KAAK,EACLC,QAAQ,EACRC,cAAc,EACd,GAAGC,WACJ,GAAGZ;IAEJ,IAAIa;IACJ,IAAIR,OAAOK,UAAU;QACnBG,oBACE,KAACA;YACCR,KAAKA;YACLC,KAAKA;YACLK,gBAAgBA;YACf,GAAGD,QAAQ;YACZP,WAAWL,YAAY;gBAAEK,WAAWO,UAAUP;YAAU;;IAG9D;IAEA,qBACE,MAACW;QACE,GAAGF,SAAS;QACbG,eAAab;QACbD,KAAKA;QACLE,WAAWN,OAAO;YAChBU;YACAC;YACAC;YACAN;QACF;;YAECU;YACAT;;;AAGP"}
|
package/dist/badge/Badge.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HTMLAttributes, type ReactNode } from "react";
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type ReactNode, type Ref } from "react";
|
|
2
2
|
import { type BadgeTheme } from "./styles.js";
|
|
3
3
|
declare module "react" {
|
|
4
4
|
interface CSSProperties {
|
|
@@ -12,6 +12,7 @@ declare module "react" {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
15
|
+
ref?: Ref<HTMLSpanElement>;
|
|
15
16
|
/** @defaultValue `"greyscale"` */
|
|
16
17
|
theme?: BadgeTheme;
|
|
17
18
|
children: ReactNode;
|
|
@@ -57,4 +58,4 @@ export interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {
|
|
|
57
58
|
* @since 6.0.0 Removed the `disableNullOnZero` feature since it's
|
|
58
59
|
* easier just to use condition rendering yourself.
|
|
59
60
|
*/
|
|
60
|
-
export declare
|
|
61
|
+
export declare function Badge(props: BadgeProps): ReactElement;
|
package/dist/badge/Badge.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { badge } from "./styles.js";
|
|
4
3
|
/**
|
|
5
4
|
* @example Simple Example
|
|
@@ -41,8 +40,8 @@ import { badge } from "./styles.js";
|
|
|
41
40
|
* @see {@link https://react-md.dev/components/badge | Badge Demos}
|
|
42
41
|
* @since 6.0.0 Removed the `disableNullOnZero` feature since it's
|
|
43
42
|
* easier just to use condition rendering yourself.
|
|
44
|
-
*/ export
|
|
45
|
-
const { children, className, theme, ...remaining } = props;
|
|
43
|
+
*/ export function Badge(props) {
|
|
44
|
+
const { ref, children, className, theme, ...remaining } = props;
|
|
46
45
|
return /*#__PURE__*/ _jsx("span", {
|
|
47
46
|
...remaining,
|
|
48
47
|
ref: ref,
|
|
@@ -52,6 +51,6 @@ import { badge } from "./styles.js";
|
|
|
52
51
|
}),
|
|
53
52
|
children: children
|
|
54
53
|
});
|
|
55
|
-
}
|
|
54
|
+
}
|
|
56
55
|
|
|
57
56
|
//# sourceMappingURL=Badge.js.map
|
package/dist/badge/Badge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["../../src/badge/Badge.tsx"],"sourcesContent":["import {\n type HTMLAttributes,\n type ReactElement,\n type ReactNode,\n type Ref,\n} from \"react\";\n\nimport { type BadgeTheme, badge } from \"./styles.js\";\n\ndeclare module \"react\" {\n interface CSSProperties {\n \"--rmd-badge-border-radius\"?: string | number;\n \"--rmd-badge-greyscale-background-color\"?: string;\n \"--rmd-badge-greyscale-color\"?: string;\n \"--rmd-badge-size\"?: string | number;\n \"--rmd-badge-offset\"?: string | number;\n \"--rmd-badge-offset-top\"?: string | number;\n \"--rmd-badge-offset-right\"?: string | number;\n }\n}\n\nexport interface BadgeProps extends HTMLAttributes<HTMLSpanElement> {\n ref?: Ref<HTMLSpanElement>;\n\n /** @defaultValue `\"greyscale\"` */\n theme?: BadgeTheme;\n\n children: ReactNode;\n}\n\n/**\n * @example Simple Example\n * ```tsx\n * import { Badge } from \"@react-md/core/badge/Badge\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <>\n * <Badge>3</Badge>\n * <Badge theme=\"primary\">100</Badge>\n * <Badge theme=\"secondary\">23</Badge>\n * <Badge theme=\"greyscale\">18</Badge>\n * <Badge theme=\"clear\">1</Badge>\n * </>\n * );\n * }\n * ```\n *\n * @example Within Buttons Example\n * ```tsx\n * import { Badge } from \"@react-md/core/badge/Badge\";\n * import { Button } from \"@react-md/core/button/Button\";\n * import { MaterialSymbol } from \"@react-md/core/icon/MaterialSymbol\";\n * import { type ReactElement } from \"react\";\n *\n * function Example(): ReactElement {\n * return (\n * <Button aria-label=\"Notifications\" buttonType=\"icon\">\n * <Badge>88</Badge>\n * <MaterialSymbol name=\"notifications\" />\n * </Button>\n * );\n * }\n * ```\n *\n * @see {@link https://react-md.dev/components/badge | Badge Demos}\n * @since 6.0.0 Removed the `disableNullOnZero` feature since it's\n * easier just to use condition rendering yourself.\n */\nexport function Badge(props: BadgeProps): ReactElement {\n const { ref, children, className, theme, ...remaining } = props;\n\n return (\n <span {...remaining} ref={ref} className={badge({ theme, className })}>\n {children}\n </span>\n );\n}\n"],"names":["badge","Badge","props","ref","children","className","theme","remaining","span"],"mappings":";AAOA,SAA0BA,KAAK,QAAQ,cAAc;AAuBrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCC,GACD,OAAO,SAASC,MAAMC,KAAiB;IACrC,MAAM,EAAEC,GAAG,EAAEC,QAAQ,EAAEC,SAAS,EAAEC,KAAK,EAAE,GAAGC,WAAW,GAAGL;IAE1D,qBACE,KAACM;QAAM,GAAGD,SAAS;QAAEJ,KAAKA;QAAKE,WAAWL,MAAM;YAAEM;YAAOD;QAAU;kBAChED;;AAGP"}
|
package/dist/box/Box.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { type HTMLAttributes } from "react";
|
|
1
|
+
import { type HTMLAttributes, type ReactElement, type Ref } from "react";
|
|
2
2
|
import { type BoxOptions } from "./styles.js";
|
|
3
3
|
/**
|
|
4
4
|
* @since 6.0.0
|
|
5
5
|
*/
|
|
6
6
|
export interface BoxProps extends HTMLAttributes<HTMLDivElement>, BoxOptions {
|
|
7
|
+
ref?: Ref<HTMLDivElement>;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
10
|
* The `Box` component is a wrapper around the CSS box model and should solve
|
|
@@ -104,4 +105,4 @@ export interface BoxProps extends HTMLAttributes<HTMLDivElement>, BoxOptions {
|
|
|
104
105
|
* @see {@link https://react-md.dev/components/box | Box Demos}
|
|
105
106
|
* @since 6.0.0
|
|
106
107
|
*/
|
|
107
|
-
export declare const Box:
|
|
108
|
+
export declare const Box: (props: BoxProps) => ReactElement;
|
package/dist/box/Box.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import { boxStyles } from "./styles.js";
|
|
4
3
|
/**
|
|
5
4
|
* The `Box` component is a wrapper around the CSS box model and should solve
|
|
@@ -99,8 +98,8 @@ import { boxStyles } from "./styles.js";
|
|
|
99
98
|
*
|
|
100
99
|
* @see {@link https://react-md.dev/components/box | Box Demos}
|
|
101
100
|
* @since 6.0.0
|
|
102
|
-
*/ export const Box =
|
|
103
|
-
const { style, className, children, align, justify, stacked, reversed, grid, gridName, gridItemSize, gridColumns, gridAutoRows, fullWidth, disableGap, disableWrap, disablePadding, ...remaining } = props;
|
|
101
|
+
*/ export const Box = function Box(props) {
|
|
102
|
+
const { ref, style, className, children, align, justify, stacked, reversed, grid, gridName, gridItemSize, gridColumns, gridAutoRows, fullWidth, disableGap, disableWrap, disablePadding, ...remaining } = props;
|
|
104
103
|
return /*#__PURE__*/ _jsx("div", {
|
|
105
104
|
...remaining,
|
|
106
105
|
ref: ref,
|
|
@@ -123,6 +122,6 @@ import { boxStyles } from "./styles.js";
|
|
|
123
122
|
}),
|
|
124
123
|
children: children
|
|
125
124
|
});
|
|
126
|
-
}
|
|
125
|
+
};
|
|
127
126
|
|
|
128
127
|
//# sourceMappingURL=Box.js.map
|