@mui/material 5.15.10 → 5.15.12
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/Accordion/Accordion.d.ts +1 -1
- package/Accordion/Accordion.js +3 -4
- package/AccordionActions/AccordionActions.js +1 -1
- package/AccordionDetails/AccordionDetails.js +1 -1
- package/AccordionSummary/AccordionSummary.js +1 -1
- package/AccordionSummary/accordionSummaryClasses.d.ts +1 -1
- package/Alert/Alert.d.ts +27 -28
- package/Alert/Alert.js +78 -56
- package/Alert/alertClasses.d.ts +68 -12
- package/Alert/alertClasses.js +1 -1
- package/AlertTitle/AlertTitle.js +3 -3
- package/AppBar/AppBar.js +1 -1
- package/Autocomplete/Autocomplete.js +7 -4
- package/Avatar/Avatar.js +3 -3
- package/AvatarGroup/AvatarGroup.js +2 -2
- package/Backdrop/Backdrop.js +1 -1
- package/Badge/Badge.js +3 -3
- package/BottomNavigation/BottomNavigation.js +1 -1
- package/BottomNavigationAction/BottomNavigationAction.js +1 -1
- package/Breadcrumbs/BreadcrumbCollapsed.js +1 -1
- package/Breadcrumbs/Breadcrumbs.js +3 -2
- package/Button/Button.js +6 -6
- package/Button/buttonClasses.d.ts +113 -33
- package/Button/buttonClasses.js +1 -1
- package/ButtonBase/ButtonBase.js +3 -2
- package/ButtonBase/Ripple.js +0 -1
- package/ButtonBase/TouchRipple.js +1 -2
- package/ButtonGroup/ButtonGroup.js +3 -3
- package/CHANGELOG.md +331 -140
- package/Card/Card.js +2 -2
- package/CardActionArea/CardActionArea.js +1 -1
- package/CardActions/CardActions.js +1 -1
- package/CardContent/CardContent.js +1 -1
- package/CardHeader/CardHeader.js +1 -1
- package/CardMedia/CardMedia.js +2 -2
- package/Checkbox/Checkbox.d.ts +1 -1
- package/Checkbox/Checkbox.js +3 -3
- package/Chip/Chip.js +2 -2
- package/Chip/chipClasses.d.ts +78 -26
- package/CircularProgress/CircularProgress.js +2 -2
- package/Collapse/Collapse.d.ts +1 -1
- package/Collapse/Collapse.js +7 -4
- package/Dialog/Dialog.d.ts +1 -1
- package/Dialog/Dialog.js +3 -3
- package/DialogActions/DialogActions.js +1 -1
- package/DialogContent/DialogContent.js +1 -1
- package/DialogContentText/DialogContentText.js +1 -1
- package/DialogTitle/DialogTitle.js +1 -1
- package/Divider/Divider.js +2 -2
- package/Drawer/Drawer.js +2 -2
- package/Fab/Fab.js +1 -1
- package/Fade/Fade.d.ts +1 -1
- package/Fade/Fade.js +1 -1
- package/FilledInput/FilledInput.js +3 -2
- package/FormControl/FormControl.js +1 -1
- package/FormControlLabel/FormControlLabel.js +2 -2
- package/FormGroup/FormGroup.js +1 -1
- package/FormHelperText/FormHelperText.js +1 -1
- package/FormLabel/FormLabel.js +1 -1
- package/Grid/Grid.js +3 -2
- package/Grow/Grow.d.ts +1 -1
- package/Grow/Grow.js +2 -1
- package/Hidden/HiddenCss.js +1 -1
- package/Hidden/HiddenJs.js +1 -1
- package/Hidden/withWidth.js +2 -2
- package/Icon/Icon.js +1 -1
- package/IconButton/IconButton.js +5 -5
- package/ImageList/ImageList.js +2 -2
- package/ImageListItem/ImageListItem.js +2 -2
- package/ImageListItemBar/ImageListItemBar.js +1 -1
- package/Input/Input.js +3 -2
- package/InputAdornment/InputAdornment.js +1 -1
- package/InputBase/InputBase.js +5 -2
- package/InputLabel/InputLabel.js +1 -1
- package/LinearProgress/LinearProgress.js +3 -2
- package/Link/Link.js +2 -2
- package/Link/getTextDecoration.js +2 -1
- package/List/List.js +1 -1
- package/ListItem/ListItem.js +5 -3
- package/ListItemAvatar/ListItemAvatar.js +1 -1
- package/ListItemButton/ListItemButton.js +2 -2
- package/ListItemIcon/ListItemIcon.js +1 -1
- package/ListItemSecondaryAction/ListItemSecondaryAction.js +1 -1
- package/ListItemText/ListItemText.js +1 -1
- package/ListSubheader/ListSubheader.js +1 -1
- package/Menu/Menu.d.ts +1 -1
- package/Menu/Menu.js +3 -3
- package/MenuItem/MenuItem.js +2 -2
- package/MobileStepper/MobileStepper.js +2 -2
- package/Modal/Modal.js +4 -3
- package/NativeSelect/NativeSelect.js +1 -1
- package/NativeSelect/NativeSelectInput.js +2 -3
- package/OutlinedInput/NotchedOutline.js +0 -1
- package/OutlinedInput/OutlinedInput.js +2 -2
- package/Pagination/Pagination.js +2 -2
- package/PaginationItem/PaginationItem.js +2 -2
- package/PaginationItem/paginationItemClasses.d.ts +4 -8
- package/Paper/Paper.js +4 -3
- package/Popover/Popover.d.ts +1 -1
- package/Popover/Popover.js +8 -3
- package/Popper/Popper.js +3 -2
- package/README.md +1 -1
- package/Radio/Radio.js +3 -3
- package/Radio/RadioButtonIcon.js +0 -1
- package/Rating/Rating.js +4 -2
- package/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/Select/Select.d.ts +50 -7
- package/Select/Select.js +1 -1
- package/Select/SelectInput.js +3 -3
- package/Skeleton/Skeleton.js +1 -1
- package/Slide/Slide.d.ts +1 -1
- package/Slide/Slide.js +3 -1
- package/Slider/Slider.d.ts +2 -4
- package/Slider/Slider.js +6 -7
- package/Snackbar/Snackbar.d.ts +1 -1
- package/Snackbar/Snackbar.js +3 -2
- package/SnackbarContent/SnackbarContent.js +2 -2
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/SpeedDial/SpeedDial.js +4 -3
- package/SpeedDialAction/SpeedDialAction.js +2 -2
- package/SpeedDialIcon/SpeedDialIcon.js +1 -1
- package/Step/Step.js +2 -2
- package/StepButton/StepButton.js +1 -1
- package/StepConnector/StepConnector.js +1 -1
- package/StepContent/StepContent.d.ts +1 -1
- package/StepContent/StepContent.js +2 -2
- package/StepIcon/StepIcon.js +1 -1
- package/StepLabel/StepLabel.d.ts +1 -1
- package/StepLabel/StepLabel.js +1 -1
- package/Stepper/Stepper.js +2 -2
- package/SvgIcon/SvgIcon.js +1 -1
- package/SwipeableDrawer/SwipeableDrawer.js +2 -2
- package/Switch/Switch.js +3 -3
- package/Tab/Tab.js +1 -1
- package/TabScrollButton/TabScrollButton.js +2 -1
- package/Table/Table.js +1 -1
- package/TableBody/TableBody.js +1 -1
- package/TableCell/TableCell.js +2 -2
- package/TableContainer/TableContainer.js +1 -1
- package/TableFooter/TableFooter.js +1 -1
- package/TableHead/TableHead.js +1 -1
- package/TablePagination/TablePagination.js +4 -2
- package/TableRow/TableRow.js +2 -2
- package/TableSortLabel/TableSortLabel.js +1 -1
- package/Tabs/Tabs.js +3 -2
- package/TextField/TextField.js +3 -2
- package/ToggleButton/ToggleButton.js +2 -2
- package/ToggleButtonGroup/ToggleButtonGroup.js +2 -2
- package/Toolbar/Toolbar.js +1 -1
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +11 -11
- package/Typography/Typography.js +2 -2
- package/Zoom/Zoom.d.ts +1 -1
- package/Zoom/Zoom.js +1 -1
- package/index.js +1 -1
- package/internal/SwitchBase.js +2 -3
- package/legacy/Accordion/Accordion.js +3 -4
- package/legacy/AccordionActions/AccordionActions.js +1 -1
- package/legacy/AccordionDetails/AccordionDetails.js +1 -1
- package/legacy/AccordionSummary/AccordionSummary.js +1 -1
- package/legacy/Alert/Alert.js +108 -54
- package/legacy/Alert/alertClasses.js +1 -1
- package/legacy/AlertTitle/AlertTitle.js +3 -3
- package/legacy/AppBar/AppBar.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +7 -4
- package/legacy/Avatar/Avatar.js +3 -3
- package/legacy/AvatarGroup/AvatarGroup.js +2 -2
- package/legacy/Backdrop/Backdrop.js +1 -1
- package/legacy/Badge/Badge.js +3 -3
- package/legacy/BottomNavigation/BottomNavigation.js +1 -1
- package/legacy/BottomNavigationAction/BottomNavigationAction.js +1 -1
- package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -1
- package/legacy/Breadcrumbs/Breadcrumbs.js +3 -2
- package/legacy/Button/Button.js +6 -6
- package/legacy/Button/buttonClasses.js +1 -1
- package/legacy/ButtonBase/ButtonBase.js +3 -2
- package/legacy/ButtonBase/Ripple.js +0 -1
- package/legacy/ButtonBase/TouchRipple.js +1 -2
- package/legacy/ButtonGroup/ButtonGroup.js +3 -3
- package/legacy/Card/Card.js +2 -2
- package/legacy/CardActionArea/CardActionArea.js +1 -1
- package/legacy/CardActions/CardActions.js +1 -1
- package/legacy/CardContent/CardContent.js +1 -1
- package/legacy/CardHeader/CardHeader.js +1 -1
- package/legacy/CardMedia/CardMedia.js +2 -2
- package/legacy/Checkbox/Checkbox.js +3 -3
- package/legacy/Chip/Chip.js +2 -2
- package/legacy/CircularProgress/CircularProgress.js +2 -2
- package/legacy/Collapse/Collapse.js +7 -4
- package/legacy/Dialog/Dialog.js +3 -3
- package/legacy/DialogActions/DialogActions.js +1 -1
- package/legacy/DialogContent/DialogContent.js +1 -1
- package/legacy/DialogContentText/DialogContentText.js +1 -1
- package/legacy/DialogTitle/DialogTitle.js +1 -1
- package/legacy/Divider/Divider.js +2 -2
- package/legacy/Drawer/Drawer.js +2 -2
- package/legacy/Fab/Fab.js +1 -1
- package/legacy/Fade/Fade.js +1 -1
- package/legacy/FilledInput/FilledInput.js +3 -2
- package/legacy/FormControl/FormControl.js +1 -1
- package/legacy/FormControlLabel/FormControlLabel.js +2 -2
- package/legacy/FormGroup/FormGroup.js +1 -1
- package/legacy/FormHelperText/FormHelperText.js +1 -1
- package/legacy/FormLabel/FormLabel.js +1 -1
- package/legacy/Grid/Grid.js +3 -2
- package/legacy/Grow/Grow.js +2 -1
- package/legacy/Hidden/HiddenCss.js +1 -1
- package/legacy/Hidden/HiddenJs.js +1 -1
- package/legacy/Hidden/withWidth.js +2 -2
- package/legacy/Icon/Icon.js +1 -1
- package/legacy/IconButton/IconButton.js +5 -5
- package/legacy/ImageList/ImageList.js +2 -2
- package/legacy/ImageListItem/ImageListItem.js +2 -2
- package/legacy/ImageListItemBar/ImageListItemBar.js +1 -1
- package/legacy/Input/Input.js +3 -2
- package/legacy/InputAdornment/InputAdornment.js +1 -1
- package/legacy/InputBase/InputBase.js +5 -2
- package/legacy/InputLabel/InputLabel.js +1 -1
- package/legacy/LinearProgress/LinearProgress.js +3 -2
- package/legacy/Link/Link.js +2 -2
- package/legacy/Link/getTextDecoration.js +2 -1
- package/legacy/List/List.js +1 -1
- package/legacy/ListItem/ListItem.js +5 -3
- package/legacy/ListItemAvatar/ListItemAvatar.js +1 -1
- package/legacy/ListItemButton/ListItemButton.js +2 -2
- package/legacy/ListItemIcon/ListItemIcon.js +1 -1
- package/legacy/ListItemSecondaryAction/ListItemSecondaryAction.js +1 -1
- package/legacy/ListItemText/ListItemText.js +1 -1
- package/legacy/ListSubheader/ListSubheader.js +1 -1
- package/legacy/Menu/Menu.js +3 -3
- package/legacy/MenuItem/MenuItem.js +2 -2
- package/legacy/MobileStepper/MobileStepper.js +2 -2
- package/legacy/Modal/Modal.js +4 -3
- package/legacy/NativeSelect/NativeSelect.js +1 -1
- package/legacy/NativeSelect/NativeSelectInput.js +2 -3
- package/legacy/OutlinedInput/NotchedOutline.js +0 -1
- package/legacy/OutlinedInput/OutlinedInput.js +2 -2
- package/legacy/Pagination/Pagination.js +2 -2
- package/legacy/PaginationItem/PaginationItem.js +2 -2
- package/legacy/Paper/Paper.js +4 -3
- package/legacy/Popover/Popover.js +8 -3
- package/legacy/Popper/Popper.js +3 -2
- package/legacy/Radio/Radio.js +3 -3
- package/legacy/Radio/RadioButtonIcon.js +0 -1
- package/legacy/Rating/Rating.js +4 -2
- package/legacy/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/legacy/Select/Select.js +1 -1
- package/legacy/Select/SelectInput.js +3 -3
- package/legacy/Skeleton/Skeleton.js +1 -1
- package/legacy/Slide/Slide.js +3 -1
- package/legacy/Slider/Slider.js +6 -7
- package/legacy/Snackbar/Snackbar.js +3 -2
- package/legacy/SnackbarContent/SnackbarContent.js +2 -2
- package/legacy/SpeedDial/SpeedDial.js +4 -3
- package/legacy/SpeedDialAction/SpeedDialAction.js +2 -2
- package/legacy/SpeedDialIcon/SpeedDialIcon.js +1 -1
- package/legacy/Step/Step.js +2 -2
- package/legacy/StepButton/StepButton.js +1 -1
- package/legacy/StepConnector/StepConnector.js +1 -1
- package/legacy/StepContent/StepContent.js +2 -2
- package/legacy/StepIcon/StepIcon.js +1 -1
- package/legacy/StepLabel/StepLabel.js +1 -1
- package/legacy/Stepper/Stepper.js +2 -2
- package/legacy/SvgIcon/SvgIcon.js +1 -1
- package/legacy/SwipeableDrawer/SwipeableDrawer.js +2 -2
- package/legacy/Switch/Switch.js +3 -3
- package/legacy/Tab/Tab.js +1 -1
- package/legacy/TabScrollButton/TabScrollButton.js +2 -1
- package/legacy/Table/Table.js +1 -1
- package/legacy/TableBody/TableBody.js +1 -1
- package/legacy/TableCell/TableCell.js +2 -2
- package/legacy/TableContainer/TableContainer.js +1 -1
- package/legacy/TableFooter/TableFooter.js +1 -1
- package/legacy/TableHead/TableHead.js +1 -1
- package/legacy/TablePagination/TablePagination.js +4 -2
- package/legacy/TableRow/TableRow.js +2 -2
- package/legacy/TableSortLabel/TableSortLabel.js +1 -1
- package/legacy/Tabs/Tabs.js +3 -2
- package/legacy/TextField/TextField.js +3 -2
- package/legacy/ToggleButton/ToggleButton.js +2 -2
- package/legacy/ToggleButtonGroup/ToggleButtonGroup.js +2 -2
- package/legacy/Toolbar/Toolbar.js +1 -1
- package/legacy/Tooltip/Tooltip.js +11 -11
- package/legacy/Typography/Typography.js +2 -2
- package/legacy/Zoom/Zoom.js +1 -1
- package/legacy/index.js +1 -1
- package/legacy/internal/SwitchBase.js +2 -3
- package/legacy/styles/CssVarsProvider.js +2 -1
- package/legacy/styles/createMuiStrictModeTheme.js +1 -1
- package/legacy/styles/createPalette.js +2 -2
- package/legacy/styles/createTheme.js +3 -2
- package/legacy/styles/createTypography.js +1 -1
- package/legacy/styles/experimental_extendTheme.js +4 -2
- package/legacy/styles/styled.js +1 -1
- package/legacy/styles/useThemeProps.js +1 -1
- package/legacy/useMediaQuery/index.js +1 -3
- package/legacy/useMediaQuery/useMediaQueryTheme.js +1 -1
- package/legacy/usePagination/usePagination.js +1 -1
- package/legacy/utils/capitalize.js +1 -1
- package/legacy/utils/createChainedFunction.js +1 -1
- package/legacy/utils/debounce.js +1 -1
- package/legacy/utils/deprecatedPropType.js +1 -1
- package/legacy/utils/getScrollbarSize.js +1 -1
- package/legacy/utils/isMuiElement.js +1 -1
- package/legacy/utils/ownerDocument.js +1 -1
- package/legacy/utils/ownerWindow.js +1 -1
- package/legacy/utils/requirePropFactory.js +1 -1
- package/legacy/utils/setRef.js +1 -1
- package/legacy/utils/shouldSpreadAdditionalProps.js +1 -1
- package/legacy/utils/unsupportedProp.js +1 -1
- package/legacy/utils/useControlled.js +1 -1
- package/legacy/utils/useEnhancedEffect.js +1 -1
- package/legacy/utils/useEventCallback.js +1 -1
- package/legacy/utils/useForkRef.js +1 -1
- package/legacy/utils/useId.js +1 -1
- package/legacy/utils/useIsFocusVisible.js +1 -1
- package/legacy/utils/useSlot.js +1 -1
- package/modern/Accordion/Accordion.js +3 -4
- package/modern/AccordionActions/AccordionActions.js +1 -1
- package/modern/AccordionDetails/AccordionDetails.js +1 -1
- package/modern/AccordionSummary/AccordionSummary.js +1 -1
- package/modern/Alert/Alert.js +78 -55
- package/modern/Alert/alertClasses.js +1 -1
- package/modern/AlertTitle/AlertTitle.js +3 -3
- package/modern/AppBar/AppBar.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +7 -4
- package/modern/Avatar/Avatar.js +3 -3
- package/modern/AvatarGroup/AvatarGroup.js +2 -2
- package/modern/Backdrop/Backdrop.js +1 -1
- package/modern/Badge/Badge.js +3 -3
- package/modern/BottomNavigation/BottomNavigation.js +1 -1
- package/modern/BottomNavigationAction/BottomNavigationAction.js +1 -1
- package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -1
- package/modern/Breadcrumbs/Breadcrumbs.js +3 -2
- package/modern/Button/Button.js +6 -6
- package/modern/Button/buttonClasses.js +1 -1
- package/modern/ButtonBase/ButtonBase.js +3 -2
- package/modern/ButtonBase/Ripple.js +0 -1
- package/modern/ButtonBase/TouchRipple.js +1 -2
- package/modern/ButtonGroup/ButtonGroup.js +3 -3
- package/modern/Card/Card.js +2 -2
- package/modern/CardActionArea/CardActionArea.js +1 -1
- package/modern/CardActions/CardActions.js +1 -1
- package/modern/CardContent/CardContent.js +1 -1
- package/modern/CardHeader/CardHeader.js +1 -1
- package/modern/CardMedia/CardMedia.js +2 -2
- package/modern/Checkbox/Checkbox.js +3 -3
- package/modern/Chip/Chip.js +2 -2
- package/modern/CircularProgress/CircularProgress.js +2 -2
- package/modern/Collapse/Collapse.js +7 -4
- package/modern/Dialog/Dialog.js +3 -3
- package/modern/DialogActions/DialogActions.js +1 -1
- package/modern/DialogContent/DialogContent.js +1 -1
- package/modern/DialogContentText/DialogContentText.js +1 -1
- package/modern/DialogTitle/DialogTitle.js +1 -1
- package/modern/Divider/Divider.js +2 -2
- package/modern/Drawer/Drawer.js +2 -2
- package/modern/Fab/Fab.js +1 -1
- package/modern/Fade/Fade.js +1 -1
- package/modern/FilledInput/FilledInput.js +3 -2
- package/modern/FormControl/FormControl.js +1 -1
- package/modern/FormControlLabel/FormControlLabel.js +2 -2
- package/modern/FormGroup/FormGroup.js +1 -1
- package/modern/FormHelperText/FormHelperText.js +1 -1
- package/modern/FormLabel/FormLabel.js +1 -1
- package/modern/Grid/Grid.js +3 -2
- package/modern/Grow/Grow.js +2 -1
- package/modern/Hidden/HiddenCss.js +1 -1
- package/modern/Hidden/HiddenJs.js +1 -1
- package/modern/Hidden/withWidth.js +2 -2
- package/modern/Icon/Icon.js +1 -1
- package/modern/IconButton/IconButton.js +5 -5
- package/modern/ImageList/ImageList.js +2 -2
- package/modern/ImageListItem/ImageListItem.js +2 -2
- package/modern/ImageListItemBar/ImageListItemBar.js +1 -1
- package/modern/Input/Input.js +3 -2
- package/modern/InputAdornment/InputAdornment.js +1 -1
- package/modern/InputBase/InputBase.js +5 -2
- package/modern/InputLabel/InputLabel.js +1 -1
- package/modern/LinearProgress/LinearProgress.js +3 -2
- package/modern/Link/Link.js +2 -2
- package/modern/Link/getTextDecoration.js +2 -1
- package/modern/List/List.js +1 -1
- package/modern/ListItem/ListItem.js +5 -3
- package/modern/ListItemAvatar/ListItemAvatar.js +1 -1
- package/modern/ListItemButton/ListItemButton.js +2 -2
- package/modern/ListItemIcon/ListItemIcon.js +1 -1
- package/modern/ListItemSecondaryAction/ListItemSecondaryAction.js +1 -1
- package/modern/ListItemText/ListItemText.js +1 -1
- package/modern/ListSubheader/ListSubheader.js +1 -1
- package/modern/Menu/Menu.js +3 -3
- package/modern/MenuItem/MenuItem.js +2 -2
- package/modern/MobileStepper/MobileStepper.js +2 -2
- package/modern/Modal/Modal.js +4 -3
- package/modern/NativeSelect/NativeSelect.js +1 -1
- package/modern/NativeSelect/NativeSelectInput.js +2 -3
- package/modern/OutlinedInput/NotchedOutline.js +0 -1
- package/modern/OutlinedInput/OutlinedInput.js +2 -2
- package/modern/Pagination/Pagination.js +2 -2
- package/modern/PaginationItem/PaginationItem.js +2 -2
- package/modern/Paper/Paper.js +4 -3
- package/modern/Popover/Popover.js +8 -3
- package/modern/Popper/Popper.js +3 -2
- package/modern/Radio/Radio.js +3 -3
- package/modern/Radio/RadioButtonIcon.js +0 -1
- package/modern/Rating/Rating.js +4 -2
- package/modern/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
- package/modern/Select/Select.js +1 -1
- package/modern/Select/SelectInput.js +3 -3
- package/modern/Skeleton/Skeleton.js +1 -1
- package/modern/Slide/Slide.js +3 -1
- package/modern/Slider/Slider.js +6 -7
- package/modern/Snackbar/Snackbar.js +3 -2
- package/modern/SnackbarContent/SnackbarContent.js +2 -2
- package/modern/SpeedDial/SpeedDial.js +4 -3
- package/modern/SpeedDialAction/SpeedDialAction.js +2 -2
- package/modern/SpeedDialIcon/SpeedDialIcon.js +1 -1
- package/modern/Step/Step.js +2 -2
- package/modern/StepButton/StepButton.js +1 -1
- package/modern/StepConnector/StepConnector.js +1 -1
- package/modern/StepContent/StepContent.js +2 -2
- package/modern/StepIcon/StepIcon.js +1 -1
- package/modern/StepLabel/StepLabel.js +1 -1
- package/modern/Stepper/Stepper.js +2 -2
- package/modern/SvgIcon/SvgIcon.js +1 -1
- package/modern/SwipeableDrawer/SwipeableDrawer.js +2 -2
- package/modern/Switch/Switch.js +3 -3
- package/modern/Tab/Tab.js +1 -1
- package/modern/TabScrollButton/TabScrollButton.js +2 -1
- package/modern/Table/Table.js +1 -1
- package/modern/TableBody/TableBody.js +1 -1
- package/modern/TableCell/TableCell.js +2 -2
- package/modern/TableContainer/TableContainer.js +1 -1
- package/modern/TableFooter/TableFooter.js +1 -1
- package/modern/TableHead/TableHead.js +1 -1
- package/modern/TablePagination/TablePagination.js +4 -2
- package/modern/TableRow/TableRow.js +2 -2
- package/modern/TableSortLabel/TableSortLabel.js +1 -1
- package/modern/Tabs/Tabs.js +3 -2
- package/modern/TextField/TextField.js +3 -2
- package/modern/ToggleButton/ToggleButton.js +2 -2
- package/modern/ToggleButtonGroup/ToggleButtonGroup.js +2 -2
- package/modern/Toolbar/Toolbar.js +1 -1
- package/modern/Tooltip/Tooltip.js +11 -11
- package/modern/Typography/Typography.js +2 -2
- package/modern/Zoom/Zoom.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internal/SwitchBase.js +2 -3
- package/modern/styles/CssVarsProvider.js +2 -1
- package/modern/styles/createMuiStrictModeTheme.js +1 -1
- package/modern/styles/createPalette.js +2 -2
- package/modern/styles/createTheme.js +3 -2
- package/modern/styles/createTypography.js +1 -1
- package/modern/styles/experimental_extendTheme.js +4 -2
- package/modern/styles/styled.js +1 -1
- package/modern/styles/useThemeProps.js +1 -1
- package/modern/useMediaQuery/index.js +1 -3
- package/modern/useMediaQuery/useMediaQueryTheme.js +1 -1
- package/modern/usePagination/usePagination.js +1 -1
- package/modern/utils/capitalize.js +1 -1
- package/modern/utils/createChainedFunction.js +1 -1
- package/modern/utils/debounce.js +1 -1
- package/modern/utils/deprecatedPropType.js +1 -1
- package/modern/utils/getScrollbarSize.js +1 -1
- package/modern/utils/isMuiElement.js +1 -1
- package/modern/utils/ownerDocument.js +1 -1
- package/modern/utils/ownerWindow.js +1 -1
- package/modern/utils/requirePropFactory.js +1 -1
- package/modern/utils/setRef.js +1 -1
- package/modern/utils/shouldSpreadAdditionalProps.js +1 -1
- package/modern/utils/unsupportedProp.js +1 -1
- package/modern/utils/useControlled.js +1 -1
- package/modern/utils/useEnhancedEffect.js +1 -1
- package/modern/utils/useEventCallback.js +1 -1
- package/modern/utils/useForkRef.js +1 -1
- package/modern/utils/useId.js +1 -1
- package/modern/utils/useIsFocusVisible.js +1 -1
- package/modern/utils/useSlot.js +1 -1
- package/node/Accordion/Accordion.js +5 -6
- package/node/AccordionActions/AccordionActions.js +2 -2
- package/node/AccordionDetails/AccordionDetails.js +2 -2
- package/node/AccordionSummary/AccordionSummary.js +2 -2
- package/node/Alert/Alert.js +86 -64
- package/node/Alert/alertClasses.js +1 -1
- package/node/AlertTitle/AlertTitle.js +6 -6
- package/node/AppBar/AppBar.js +2 -2
- package/node/Autocomplete/Autocomplete.js +13 -10
- package/node/Avatar/Avatar.js +8 -8
- package/node/AvatarGroup/AvatarGroup.js +4 -4
- package/node/Backdrop/Backdrop.js +2 -2
- package/node/Badge/Badge.js +7 -7
- package/node/BottomNavigation/BottomNavigation.js +2 -2
- package/node/BottomNavigationAction/BottomNavigationAction.js +2 -2
- package/node/Breadcrumbs/BreadcrumbCollapsed.js +3 -3
- package/node/Breadcrumbs/Breadcrumbs.js +8 -7
- package/node/Button/Button.js +12 -12
- package/node/Button/buttonClasses.js +1 -1
- package/node/ButtonBase/ButtonBase.js +6 -5
- package/node/ButtonBase/Ripple.js +0 -1
- package/node/ButtonBase/TouchRipple.js +2 -3
- package/node/ButtonGroup/ButtonGroup.js +6 -6
- package/node/Card/Card.js +4 -4
- package/node/CardActionArea/CardActionArea.js +2 -2
- package/node/CardActions/CardActions.js +2 -2
- package/node/CardContent/CardContent.js +2 -2
- package/node/CardHeader/CardHeader.js +2 -2
- package/node/CardMedia/CardMedia.js +4 -4
- package/node/Checkbox/Checkbox.js +6 -6
- package/node/Chip/Chip.js +13 -13
- package/node/CircularProgress/CircularProgress.js +4 -4
- package/node/Collapse/Collapse.js +15 -12
- package/node/Dialog/Dialog.js +5 -5
- package/node/DialogActions/DialogActions.js +2 -2
- package/node/DialogContent/DialogContent.js +2 -2
- package/node/DialogContentText/DialogContentText.js +2 -2
- package/node/DialogTitle/DialogTitle.js +2 -2
- package/node/Divider/Divider.js +4 -4
- package/node/Drawer/Drawer.js +4 -4
- package/node/Fab/Fab.js +2 -2
- package/node/Fade/Fade.js +6 -6
- package/node/FilledInput/FilledInput.js +6 -5
- package/node/FormControl/FormControl.js +2 -2
- package/node/FormControlLabel/FormControlLabel.js +4 -4
- package/node/FormGroup/FormGroup.js +2 -2
- package/node/FormHelperText/FormHelperText.js +2 -2
- package/node/FormLabel/FormLabel.js +2 -2
- package/node/Grid/Grid.js +4 -3
- package/node/Grow/Grow.js +8 -7
- package/node/Hidden/HiddenCss.js +2 -2
- package/node/Hidden/HiddenJs.js +2 -2
- package/node/Hidden/withWidth.js +4 -4
- package/node/Icon/Icon.js +2 -2
- package/node/IconButton/IconButton.js +9 -9
- package/node/ImageList/ImageList.js +4 -4
- package/node/ImageListItem/ImageListItem.js +5 -5
- package/node/ImageListItemBar/ImageListItemBar.js +2 -2
- package/node/Input/Input.js +6 -5
- package/node/InputAdornment/InputAdornment.js +2 -2
- package/node/InputBase/InputBase.js +9 -6
- package/node/InputLabel/InputLabel.js +2 -2
- package/node/LinearProgress/LinearProgress.js +4 -3
- package/node/Link/Link.js +4 -4
- package/node/Link/getTextDecoration.js +2 -1
- package/node/List/List.js +2 -2
- package/node/ListItem/ListItem.js +14 -12
- package/node/ListItemAvatar/ListItemAvatar.js +2 -2
- package/node/ListItemButton/ListItemButton.js +7 -7
- package/node/ListItemIcon/ListItemIcon.js +2 -2
- package/node/ListItemSecondaryAction/ListItemSecondaryAction.js +2 -2
- package/node/ListItemText/ListItemText.js +2 -2
- package/node/ListSubheader/ListSubheader.js +2 -2
- package/node/Menu/Menu.js +5 -5
- package/node/MenuItem/MenuItem.js +7 -7
- package/node/MobileStepper/MobileStepper.js +5 -5
- package/node/Modal/Modal.js +9 -8
- package/node/NativeSelect/NativeSelect.js +2 -2
- package/node/NativeSelect/NativeSelectInput.js +4 -5
- package/node/OutlinedInput/NotchedOutline.js +0 -1
- package/node/OutlinedInput/OutlinedInput.js +4 -4
- package/node/Pagination/Pagination.js +8 -8
- package/node/PaginationItem/PaginationItem.js +9 -9
- package/node/Paper/Paper.js +7 -6
- package/node/Popover/Popover.js +17 -12
- package/node/Popper/Popper.js +7 -6
- package/node/Radio/Radio.js +6 -6
- package/node/Radio/RadioButtonIcon.js +0 -1
- package/node/Rating/Rating.js +16 -14
- package/node/ScopedCssBaseline/ScopedCssBaseline.js +2 -2
- package/node/Select/Select.js +2 -2
- package/node/Select/SelectInput.js +8 -8
- package/node/Skeleton/Skeleton.js +2 -2
- package/node/Slide/Slide.js +12 -10
- package/node/Slider/Slider.js +23 -24
- package/node/Snackbar/Snackbar.js +5 -4
- package/node/SnackbarContent/SnackbarContent.js +4 -4
- package/node/SpeedDial/SpeedDial.js +7 -6
- package/node/SpeedDialAction/SpeedDialAction.js +4 -4
- package/node/SpeedDialIcon/SpeedDialIcon.js +2 -2
- package/node/Step/Step.js +4 -4
- package/node/StepButton/StepButton.js +2 -2
- package/node/StepConnector/StepConnector.js +2 -2
- package/node/StepContent/StepContent.js +3 -3
- package/node/StepIcon/StepIcon.js +2 -2
- package/node/StepLabel/StepLabel.js +2 -2
- package/node/Stepper/Stepper.js +4 -4
- package/node/SvgIcon/SvgIcon.js +2 -2
- package/node/SwipeableDrawer/SwipeableDrawer.js +7 -7
- package/node/Switch/Switch.js +8 -8
- package/node/Tab/Tab.js +2 -2
- package/node/TabScrollButton/TabScrollButton.js +5 -4
- package/node/Table/Table.js +2 -2
- package/node/TableBody/TableBody.js +2 -2
- package/node/TableCell/TableCell.js +4 -4
- package/node/TableContainer/TableContainer.js +2 -2
- package/node/TableFooter/TableFooter.js +2 -2
- package/node/TableHead/TableHead.js +2 -2
- package/node/TablePagination/TablePagination.js +9 -7
- package/node/TableRow/TableRow.js +5 -5
- package/node/TableSortLabel/TableSortLabel.js +2 -2
- package/node/Tabs/Tabs.js +7 -6
- package/node/TextField/TextField.js +6 -5
- package/node/ToggleButton/ToggleButton.js +4 -4
- package/node/ToggleButtonGroup/ToggleButtonGroup.js +4 -4
- package/node/Toolbar/Toolbar.js +2 -2
- package/node/Tooltip/Tooltip.js +24 -24
- package/node/Typography/Typography.js +4 -4
- package/node/Zoom/Zoom.js +6 -6
- package/node/index.js +1 -1
- package/node/internal/SwitchBase.js +4 -5
- package/node/styles/CssVarsProvider.js +2 -1
- package/node/styles/createMuiStrictModeTheme.js +2 -2
- package/node/styles/createPalette.js +7 -7
- package/node/styles/createTheme.js +11 -8
- package/node/styles/createTypography.js +2 -2
- package/node/styles/experimental_extendTheme.js +74 -70
- package/node/styles/styled.js +6 -4
- package/node/styles/useThemeProps.js +2 -2
- package/node/useMediaQuery/index.js +1 -2
- package/node/useMediaQuery/useMediaQueryTheme.js +1 -1
- package/node/usePagination/usePagination.js +2 -2
- package/node/utils/capitalize.js +3 -2
- package/node/utils/createChainedFunction.js +3 -2
- package/node/utils/debounce.js +3 -2
- package/node/utils/deprecatedPropType.js +3 -2
- package/node/utils/getScrollbarSize.js +3 -2
- package/node/utils/isMuiElement.js +3 -2
- package/node/utils/ownerDocument.js +3 -2
- package/node/utils/ownerWindow.js +3 -2
- package/node/utils/requirePropFactory.js +3 -2
- package/node/utils/setRef.js +3 -2
- package/node/utils/shouldSpreadAdditionalProps.js +2 -2
- package/node/utils/unsupportedProp.js +3 -2
- package/node/utils/useControlled.js +3 -2
- package/node/utils/useEnhancedEffect.js +3 -2
- package/node/utils/useEventCallback.js +3 -2
- package/node/utils/useForkRef.js +3 -2
- package/node/utils/useId.js +3 -2
- package/node/utils/useIsFocusVisible.js +3 -2
- package/node/utils/useSlot.js +6 -6
- package/package.json +5 -5
- package/styles/CssVarsProvider.js +2 -1
- package/styles/createMuiStrictModeTheme.js +1 -1
- package/styles/createPalette.js +2 -2
- package/styles/createTheme.js +3 -2
- package/styles/createTypography.js +1 -1
- package/styles/experimental_extendTheme.js +4 -2
- package/styles/styled.js +1 -1
- package/styles/useThemeProps.js +1 -1
- package/styles/variants.d.ts +7 -1
- package/umd/material-ui.development.js +3327 -3314
- package/umd/material-ui.production.min.js +3 -3
- package/useMediaQuery/index.d.ts +2 -2
- package/useMediaQuery/index.js +1 -3
- package/useMediaQuery/useMediaQueryTheme.d.ts +1 -1
- package/useMediaQuery/useMediaQueryTheme.js +1 -1
- package/usePagination/usePagination.js +1 -1
- package/utils/capitalize.d.ts +1 -1
- package/utils/capitalize.js +1 -1
- package/utils/createChainedFunction.d.ts +1 -1
- package/utils/createChainedFunction.js +1 -1
- package/utils/debounce.d.ts +1 -1
- package/utils/debounce.js +1 -1
- package/utils/deprecatedPropType.d.ts +1 -1
- package/utils/deprecatedPropType.js +1 -1
- package/utils/getScrollbarSize.d.ts +1 -1
- package/utils/getScrollbarSize.js +1 -1
- package/utils/isMuiElement.d.ts +1 -1
- package/utils/isMuiElement.js +1 -1
- package/utils/ownerDocument.d.ts +1 -1
- package/utils/ownerDocument.js +1 -1
- package/utils/ownerWindow.d.ts +1 -1
- package/utils/ownerWindow.js +1 -1
- package/utils/requirePropFactory.d.ts +1 -1
- package/utils/requirePropFactory.js +1 -1
- package/utils/setRef.d.ts +1 -1
- package/utils/setRef.js +1 -1
- package/utils/shouldSpreadAdditionalProps.js +1 -1
- package/utils/unsupportedProp.d.ts +1 -1
- package/utils/unsupportedProp.js +1 -1
- package/utils/useControlled.d.ts +1 -1
- package/utils/useControlled.js +1 -1
- package/utils/useEnhancedEffect.d.ts +1 -1
- package/utils/useEnhancedEffect.js +1 -1
- package/utils/useEventCallback.d.ts +1 -1
- package/utils/useEventCallback.js +1 -1
- package/utils/useForkRef.d.ts +1 -1
- package/utils/useForkRef.js +1 -1
- package/utils/useId.d.ts +1 -1
- package/utils/useId.js +1 -1
- package/utils/useIsFocusVisible.d.ts +1 -1
- package/utils/useIsFocusVisible.js +1 -1
- package/utils/useSlot.js +1 -1
- package/legacy/useMediaQuery/useMediaQuery.js +0 -144
- package/modern/useMediaQuery/useMediaQuery.js +0 -125
- package/node/useMediaQuery/useMediaQuery.js +0 -132
- package/useMediaQuery/useMediaQuery.d.ts +0 -46
- package/useMediaQuery/useMediaQuery.js +0 -125
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = useMediaQuery;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _system = require("@mui/system");
|
|
11
|
-
var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
|
|
12
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @deprecated Not used internally. Use `MediaQueryList` from lib.dom.d.ts instead.
|
|
20
|
-
*/
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
27
|
-
const [match, setMatch] = React.useState(() => {
|
|
28
|
-
if (noSsr && matchMedia) {
|
|
29
|
-
return matchMedia(query).matches;
|
|
30
|
-
}
|
|
31
|
-
if (ssrMatchMedia) {
|
|
32
|
-
return ssrMatchMedia(query).matches;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Once the component is mounted, we rely on the
|
|
36
|
-
// event listeners to return the correct matches value.
|
|
37
|
-
return defaultMatches;
|
|
38
|
-
});
|
|
39
|
-
(0, _useEnhancedEffect.default)(() => {
|
|
40
|
-
let active = true;
|
|
41
|
-
if (!matchMedia) {
|
|
42
|
-
return undefined;
|
|
43
|
-
}
|
|
44
|
-
const queryList = matchMedia(query);
|
|
45
|
-
const updateMatch = () => {
|
|
46
|
-
// Workaround Safari wrong implementation of matchMedia
|
|
47
|
-
// TODO can we remove it?
|
|
48
|
-
// https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
|
|
49
|
-
if (active) {
|
|
50
|
-
setMatch(queryList.matches);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
updateMatch();
|
|
54
|
-
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
55
|
-
queryList.addListener(updateMatch);
|
|
56
|
-
return () => {
|
|
57
|
-
active = false;
|
|
58
|
-
queryList.removeListener(updateMatch);
|
|
59
|
-
};
|
|
60
|
-
}, [query, matchMedia]);
|
|
61
|
-
return match;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
65
|
-
const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
|
|
66
|
-
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
67
|
-
const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
|
|
68
|
-
const getServerSnapshot = React.useMemo(() => {
|
|
69
|
-
if (noSsr && matchMedia) {
|
|
70
|
-
return () => matchMedia(query).matches;
|
|
71
|
-
}
|
|
72
|
-
if (ssrMatchMedia !== null) {
|
|
73
|
-
const {
|
|
74
|
-
matches
|
|
75
|
-
} = ssrMatchMedia(query);
|
|
76
|
-
return () => matches;
|
|
77
|
-
}
|
|
78
|
-
return getDefaultSnapshot;
|
|
79
|
-
}, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
|
|
80
|
-
const [getSnapshot, subscribe] = React.useMemo(() => {
|
|
81
|
-
if (matchMedia === null) {
|
|
82
|
-
return [getDefaultSnapshot, () => () => {}];
|
|
83
|
-
}
|
|
84
|
-
const mediaQueryList = matchMedia(query);
|
|
85
|
-
return [() => mediaQueryList.matches, notify => {
|
|
86
|
-
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
87
|
-
mediaQueryList.addListener(notify);
|
|
88
|
-
return () => {
|
|
89
|
-
mediaQueryList.removeListener(notify);
|
|
90
|
-
};
|
|
91
|
-
}];
|
|
92
|
-
}, [getDefaultSnapshot, matchMedia, query]);
|
|
93
|
-
const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
94
|
-
return match;
|
|
95
|
-
}
|
|
96
|
-
function useMediaQuery(queryInput, options = {}) {
|
|
97
|
-
const theme = (0, _system.useThemeWithoutDefault)();
|
|
98
|
-
// Wait for jsdom to support the match media feature.
|
|
99
|
-
// All the browsers MUI support have this built-in.
|
|
100
|
-
// This defensive check is here for simplicity.
|
|
101
|
-
// Most of the time, the match media logic isn't central to people tests.
|
|
102
|
-
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
103
|
-
const {
|
|
104
|
-
defaultMatches = false,
|
|
105
|
-
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
106
|
-
ssrMatchMedia = null,
|
|
107
|
-
noSsr = false
|
|
108
|
-
} = (0, _system.getThemeProps)({
|
|
109
|
-
name: 'MuiUseMediaQuery',
|
|
110
|
-
props: options,
|
|
111
|
-
theme
|
|
112
|
-
});
|
|
113
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
114
|
-
if (typeof queryInput === 'function' && theme === null) {
|
|
115
|
-
console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
119
|
-
query = query.replace(/^@media( ?)/m, '');
|
|
120
|
-
|
|
121
|
-
// TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
|
|
122
|
-
const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
123
|
-
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
124
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
125
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
126
|
-
React.useDebugValue({
|
|
127
|
-
query,
|
|
128
|
-
match
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return match;
|
|
132
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
|
|
3
|
-
*/
|
|
4
|
-
export interface MuiMediaQueryListEvent {
|
|
5
|
-
matches: boolean;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Not used internally. Use `MediaQueryList` from lib.dom.d.ts instead.
|
|
9
|
-
*/
|
|
10
|
-
export interface MuiMediaQueryList {
|
|
11
|
-
matches: boolean;
|
|
12
|
-
addListener: (listener: MuiMediaQueryListListener) => void;
|
|
13
|
-
removeListener: (listener: MuiMediaQueryListListener) => void;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
|
|
17
|
-
*/
|
|
18
|
-
export type MuiMediaQueryListListener = (event: MuiMediaQueryListEvent) => void;
|
|
19
|
-
export interface UseMediaQueryOptions {
|
|
20
|
-
/**
|
|
21
|
-
* As `window.matchMedia()` is unavailable on the server,
|
|
22
|
-
* it returns a default matches during the first mount.
|
|
23
|
-
* @default false
|
|
24
|
-
*/
|
|
25
|
-
defaultMatches?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* You can provide your own implementation of matchMedia.
|
|
28
|
-
* This can be used for handling an iframe content window.
|
|
29
|
-
*/
|
|
30
|
-
matchMedia?: typeof window.matchMedia;
|
|
31
|
-
/**
|
|
32
|
-
* To perform the server-side hydration, the hook needs to render twice.
|
|
33
|
-
* A first time with `defaultMatches`, the value of the server, and a second time with the resolved value.
|
|
34
|
-
* This double pass rendering cycle comes with a drawback: it's slower.
|
|
35
|
-
* You can set this option to `true` if you use the returned value **only** client-side.
|
|
36
|
-
* @default false
|
|
37
|
-
*/
|
|
38
|
-
noSsr?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* You can provide your own implementation of `matchMedia`, it's used when rendering server-side.
|
|
41
|
-
*/
|
|
42
|
-
ssrMatchMedia?: (query: string) => {
|
|
43
|
-
matches: boolean;
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
export default function useMediaQuery<Theme = unknown>(queryInput: string | ((theme: Theme) => string), options?: UseMediaQueryOptions): boolean;
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { getThemeProps, useThemeWithoutDefault as useTheme } from '@mui/system';
|
|
5
|
-
import useEnhancedEffect from '../utils/useEnhancedEffect';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @deprecated Not used internally. Use `MediaQueryListEvent` from lib.dom.d.ts instead.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @deprecated Not used internally. Use `MediaQueryList` from lib.dom.d.ts instead.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated Not used internally. Use `(event: MediaQueryListEvent) => void` instead.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
function useMediaQueryOld(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
20
|
-
const [match, setMatch] = React.useState(() => {
|
|
21
|
-
if (noSsr && matchMedia) {
|
|
22
|
-
return matchMedia(query).matches;
|
|
23
|
-
}
|
|
24
|
-
if (ssrMatchMedia) {
|
|
25
|
-
return ssrMatchMedia(query).matches;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Once the component is mounted, we rely on the
|
|
29
|
-
// event listeners to return the correct matches value.
|
|
30
|
-
return defaultMatches;
|
|
31
|
-
});
|
|
32
|
-
useEnhancedEffect(() => {
|
|
33
|
-
let active = true;
|
|
34
|
-
if (!matchMedia) {
|
|
35
|
-
return undefined;
|
|
36
|
-
}
|
|
37
|
-
const queryList = matchMedia(query);
|
|
38
|
-
const updateMatch = () => {
|
|
39
|
-
// Workaround Safari wrong implementation of matchMedia
|
|
40
|
-
// TODO can we remove it?
|
|
41
|
-
// https://github.com/mui/material-ui/pull/17315#issuecomment-528286677
|
|
42
|
-
if (active) {
|
|
43
|
-
setMatch(queryList.matches);
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
updateMatch();
|
|
47
|
-
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
48
|
-
queryList.addListener(updateMatch);
|
|
49
|
-
return () => {
|
|
50
|
-
active = false;
|
|
51
|
-
queryList.removeListener(updateMatch);
|
|
52
|
-
};
|
|
53
|
-
}, [query, matchMedia]);
|
|
54
|
-
return match;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// eslint-disable-next-line no-useless-concat -- Workaround for https://github.com/webpack/webpack/issues/14814
|
|
58
|
-
const maybeReactUseSyncExternalStore = React['useSyncExternalStore' + ''];
|
|
59
|
-
function useMediaQueryNew(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr) {
|
|
60
|
-
const getDefaultSnapshot = React.useCallback(() => defaultMatches, [defaultMatches]);
|
|
61
|
-
const getServerSnapshot = React.useMemo(() => {
|
|
62
|
-
if (noSsr && matchMedia) {
|
|
63
|
-
return () => matchMedia(query).matches;
|
|
64
|
-
}
|
|
65
|
-
if (ssrMatchMedia !== null) {
|
|
66
|
-
const {
|
|
67
|
-
matches
|
|
68
|
-
} = ssrMatchMedia(query);
|
|
69
|
-
return () => matches;
|
|
70
|
-
}
|
|
71
|
-
return getDefaultSnapshot;
|
|
72
|
-
}, [getDefaultSnapshot, query, ssrMatchMedia, noSsr, matchMedia]);
|
|
73
|
-
const [getSnapshot, subscribe] = React.useMemo(() => {
|
|
74
|
-
if (matchMedia === null) {
|
|
75
|
-
return [getDefaultSnapshot, () => () => {}];
|
|
76
|
-
}
|
|
77
|
-
const mediaQueryList = matchMedia(query);
|
|
78
|
-
return [() => mediaQueryList.matches, notify => {
|
|
79
|
-
// TODO: Use `addEventListener` once support for Safari < 14 is dropped
|
|
80
|
-
mediaQueryList.addListener(notify);
|
|
81
|
-
return () => {
|
|
82
|
-
mediaQueryList.removeListener(notify);
|
|
83
|
-
};
|
|
84
|
-
}];
|
|
85
|
-
}, [getDefaultSnapshot, matchMedia, query]);
|
|
86
|
-
const match = maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
87
|
-
return match;
|
|
88
|
-
}
|
|
89
|
-
export default function useMediaQuery(queryInput, options = {}) {
|
|
90
|
-
const theme = useTheme();
|
|
91
|
-
// Wait for jsdom to support the match media feature.
|
|
92
|
-
// All the browsers MUI support have this built-in.
|
|
93
|
-
// This defensive check is here for simplicity.
|
|
94
|
-
// Most of the time, the match media logic isn't central to people tests.
|
|
95
|
-
const supportMatchMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
96
|
-
const {
|
|
97
|
-
defaultMatches = false,
|
|
98
|
-
matchMedia = supportMatchMedia ? window.matchMedia : null,
|
|
99
|
-
ssrMatchMedia = null,
|
|
100
|
-
noSsr = false
|
|
101
|
-
} = getThemeProps({
|
|
102
|
-
name: 'MuiUseMediaQuery',
|
|
103
|
-
props: options,
|
|
104
|
-
theme
|
|
105
|
-
});
|
|
106
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
107
|
-
if (typeof queryInput === 'function' && theme === null) {
|
|
108
|
-
console.error(['MUI: The `query` argument provided is invalid.', 'You are providing a function without a theme in the context.', 'One of the parent elements needs to use a ThemeProvider.'].join('\n'));
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
let query = typeof queryInput === 'function' ? queryInput(theme) : queryInput;
|
|
112
|
-
query = query.replace(/^@media( ?)/m, '');
|
|
113
|
-
|
|
114
|
-
// TODO: Drop `useMediaQueryOld` and use `use-sync-external-store` shim in `useMediaQueryNew` once the package is stable
|
|
115
|
-
const useMediaQueryImplementation = maybeReactUseSyncExternalStore !== undefined ? useMediaQueryNew : useMediaQueryOld;
|
|
116
|
-
const match = useMediaQueryImplementation(query, defaultMatches, matchMedia, ssrMatchMedia, noSsr);
|
|
117
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
118
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
119
|
-
React.useDebugValue({
|
|
120
|
-
query,
|
|
121
|
-
match
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
return match;
|
|
125
|
-
}
|