@mui/material 9.0.0-beta.0 → 9.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/Accordion/Accordion.d.mts +4 -4
- package/Accordion/Accordion.d.ts +4 -4
- package/AccordionActions/AccordionActions.d.mts +2 -2
- package/AccordionActions/AccordionActions.d.ts +2 -2
- package/AccordionDetails/AccordionDetails.d.mts +2 -2
- package/AccordionDetails/AccordionDetails.d.ts +2 -2
- package/AccordionSummary/AccordionSummary.d.mts +3 -3
- package/AccordionSummary/AccordionSummary.d.ts +3 -3
- package/AccordionSummary/AccordionSummary.js +1 -0
- package/AccordionSummary/AccordionSummary.mjs +1 -0
- package/Alert/Alert.d.mts +3 -3
- package/Alert/Alert.d.ts +3 -3
- package/AlertTitle/AlertTitle.d.mts +3 -3
- package/AlertTitle/AlertTitle.d.ts +3 -3
- package/AppBar/AppBar.d.mts +3 -3
- package/AppBar/AppBar.d.ts +3 -3
- package/Autocomplete/Autocomplete.d.mts +2 -2
- package/Autocomplete/Autocomplete.d.ts +2 -2
- package/Avatar/Avatar.d.mts +2 -2
- package/Avatar/Avatar.d.ts +2 -2
- package/AvatarGroup/AvatarGroup.d.mts +2 -2
- package/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/Backdrop/Backdrop.d.mts +4 -4
- package/Backdrop/Backdrop.d.ts +4 -4
- package/Badge/Badge.d.mts +3 -3
- package/Badge/Badge.d.ts +3 -3
- package/BottomNavigation/BottomNavigation.d.mts +2 -2
- package/BottomNavigation/BottomNavigation.d.ts +2 -2
- package/BottomNavigationAction/BottomNavigationAction.d.mts +3 -3
- package/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
- package/BottomNavigationAction/BottomNavigationAction.js +1 -0
- package/BottomNavigationAction/BottomNavigationAction.mjs +1 -0
- package/Box/Box.d.mts +3 -3
- package/Box/Box.d.ts +3 -3
- package/Breadcrumbs/BreadcrumbCollapsed.js +5 -1
- package/Breadcrumbs/BreadcrumbCollapsed.mjs +5 -1
- package/Breadcrumbs/Breadcrumbs.d.mts +3 -3
- package/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/Button/Button.d.mts +6 -6
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +1 -0
- package/Button/Button.mjs +1 -0
- package/ButtonBase/ButtonBase.d.mts +7 -2
- package/ButtonBase/ButtonBase.d.ts +7 -2
- package/ButtonBase/ButtonBase.js +84 -85
- package/ButtonBase/ButtonBase.mjs +84 -85
- package/ButtonBase/useButtonBase.d.mts +91 -0
- package/ButtonBase/useButtonBase.d.ts +91 -0
- package/ButtonBase/useButtonBase.js +174 -0
- package/ButtonBase/useButtonBase.mjs +167 -0
- package/ButtonGroup/ButtonGroup.d.mts +2 -2
- package/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/CHANGELOG.md +76 -0
- package/Card/Card.d.mts +3 -3
- package/Card/Card.d.ts +3 -3
- package/CardActionArea/CardActionArea.d.mts +3 -3
- package/CardActionArea/CardActionArea.d.ts +3 -3
- package/CardActionArea/CardActionArea.js +1 -0
- package/CardActionArea/CardActionArea.mjs +1 -0
- package/CardActions/CardActions.d.mts +2 -2
- package/CardActions/CardActions.d.ts +2 -2
- package/CardContent/CardContent.d.mts +2 -2
- package/CardContent/CardContent.d.ts +2 -2
- package/CardHeader/CardHeader.d.mts +2 -2
- package/CardHeader/CardHeader.d.ts +2 -2
- package/CardMedia/CardMedia.d.mts +2 -2
- package/CardMedia/CardMedia.d.ts +2 -2
- package/Checkbox/Checkbox.d.mts +4 -4
- package/Checkbox/Checkbox.d.ts +4 -4
- package/Chip/Chip.d.mts +9 -2
- package/Chip/Chip.d.ts +9 -2
- package/Chip/Chip.js +18 -1
- package/Chip/Chip.mjs +18 -1
- package/CircularProgress/CircularProgress.d.mts +2 -2
- package/CircularProgress/CircularProgress.d.ts +2 -2
- package/ClickAwayListener/ClickAwayListener.d.mts +3 -3
- package/ClickAwayListener/ClickAwayListener.d.ts +3 -3
- package/ClickAwayListener/ClickAwayListener.js +3 -3
- package/ClickAwayListener/ClickAwayListener.mjs +3 -3
- package/Collapse/Collapse.d.mts +5 -5
- package/Collapse/Collapse.d.ts +5 -5
- package/Collapse/Collapse.js +6 -18
- package/Collapse/Collapse.mjs +7 -19
- package/Container/Container.d.mts +2 -2
- package/Container/Container.d.ts +2 -2
- package/CssBaseline/CssBaseline.d.mts +2 -2
- package/CssBaseline/CssBaseline.d.ts +2 -2
- package/Dialog/Dialog.d.mts +11 -4
- package/Dialog/Dialog.d.ts +11 -4
- package/Dialog/Dialog.js +9 -1
- package/Dialog/Dialog.mjs +9 -1
- package/DialogActions/DialogActions.d.mts +2 -2
- package/DialogActions/DialogActions.d.ts +2 -2
- package/DialogContent/DialogContent.d.mts +2 -2
- package/DialogContent/DialogContent.d.ts +2 -2
- package/DialogContentText/DialogContentText.d.mts +3 -3
- package/DialogContentText/DialogContentText.d.ts +3 -3
- package/DialogTitle/DialogTitle.d.mts +3 -3
- package/DialogTitle/DialogTitle.d.ts +3 -3
- package/Divider/Divider.d.mts +4 -4
- package/Divider/Divider.d.ts +4 -4
- package/Divider/Divider.js +0 -8
- package/Divider/Divider.mjs +0 -8
- package/Drawer/Drawer.d.mts +4 -4
- package/Drawer/Drawer.d.ts +4 -4
- package/Drawer/Drawer.js +1 -4
- package/Drawer/Drawer.mjs +1 -4
- package/Fab/Fab.d.mts +3 -3
- package/Fab/Fab.d.ts +3 -3
- package/Fab/Fab.js +1 -0
- package/Fab/Fab.mjs +1 -0
- package/Fade/Fade.d.mts +3 -3
- package/Fade/Fade.d.ts +3 -3
- package/Fade/Fade.js +28 -32
- package/Fade/Fade.mjs +29 -33
- package/FilledInput/FilledInput.d.mts +3 -3
- package/FilledInput/FilledInput.d.ts +3 -3
- package/FilledInput/FilledInput.js +1 -1
- package/FilledInput/FilledInput.mjs +1 -1
- package/FormControl/FormControl.d.mts +7 -7
- package/FormControl/FormControl.d.ts +7 -7
- package/FormControlLabel/FormControlLabel.d.mts +4 -4
- package/FormControlLabel/FormControlLabel.d.ts +4 -4
- package/FormGroup/FormGroup.d.mts +3 -3
- package/FormGroup/FormGroup.d.ts +3 -3
- package/FormHelperText/FormHelperText.d.mts +3 -3
- package/FormHelperText/FormHelperText.d.ts +3 -3
- package/FormLabel/FormLabel.d.mts +5 -5
- package/FormLabel/FormLabel.d.ts +5 -5
- package/GlobalStyles/GlobalStyles.d.mts +2 -2
- package/GlobalStyles/GlobalStyles.d.ts +2 -2
- package/Grid/Grid.d.mts +10 -5
- package/Grid/Grid.d.ts +10 -5
- package/Grid/Grid.js +10 -5
- package/Grid/Grid.mjs +10 -5
- package/Grid/gridClasses.js +1 -1
- package/Grid/gridClasses.mjs +1 -1
- package/Grow/Grow.d.mts +5 -5
- package/Grow/Grow.d.ts +5 -5
- package/Grow/Grow.js +30 -38
- package/Grow/Grow.mjs +31 -39
- package/Icon/Icon.d.mts +3 -3
- package/Icon/Icon.d.ts +3 -3
- package/IconButton/IconButton.d.mts +5 -5
- package/IconButton/IconButton.d.ts +5 -5
- package/IconButton/IconButton.js +1 -0
- package/IconButton/IconButton.mjs +1 -0
- package/ImageList/ImageList.d.mts +2 -2
- package/ImageList/ImageList.d.ts +2 -2
- package/ImageListItem/ImageListItem.d.mts +2 -2
- package/ImageListItem/ImageListItem.d.ts +2 -2
- package/ImageListItemBar/ImageListItemBar.d.mts +2 -2
- package/ImageListItemBar/ImageListItemBar.d.ts +2 -2
- package/InitColorSchemeScript/InitColorSchemeScript.d.mts +2 -2
- package/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -2
- package/InitColorSchemeScript/InitColorSchemeScript.js +2 -2
- package/InitColorSchemeScript/InitColorSchemeScript.mjs +2 -2
- package/Input/Input.d.mts +3 -3
- package/Input/Input.d.ts +3 -3
- package/Input/Input.js +1 -1
- package/Input/Input.mjs +1 -1
- package/InputAdornment/InputAdornment.d.mts +2 -2
- package/InputAdornment/InputAdornment.d.ts +2 -2
- package/InputAdornment/inputAdornmentClasses.d.mts +2 -2
- package/InputAdornment/inputAdornmentClasses.d.ts +2 -2
- package/InputBase/InputBase.d.mts +2 -2
- package/InputBase/InputBase.d.ts +2 -2
- package/InputLabel/InputLabel.d.mts +4 -4
- package/InputLabel/InputLabel.d.ts +4 -4
- package/LinearProgress/LinearProgress.d.mts +2 -2
- package/LinearProgress/LinearProgress.d.ts +2 -2
- package/Link/Link.d.mts +4 -4
- package/Link/Link.d.ts +4 -4
- package/List/List.d.mts +4 -4
- package/List/List.d.ts +4 -4
- package/ListItem/ListItem.d.mts +3 -3
- package/ListItem/ListItem.d.ts +3 -3
- package/ListItem/ListItem.js +1 -2
- package/ListItem/ListItem.mjs +1 -2
- package/ListItemAvatar/ListItemAvatar.d.mts +2 -2
- package/ListItemAvatar/ListItemAvatar.d.ts +2 -2
- package/ListItemButton/ListItemButton.d.mts +4 -4
- package/ListItemButton/ListItemButton.d.ts +4 -4
- package/ListItemButton/ListItemButton.js +1 -0
- package/ListItemButton/ListItemButton.mjs +1 -0
- package/ListItemIcon/ListItemIcon.d.mts +3 -3
- package/ListItemIcon/ListItemIcon.d.ts +3 -3
- package/ListItemIcon/ListItemIcon.js +1 -1
- package/ListItemIcon/ListItemIcon.mjs +1 -1
- package/ListItemSecondaryAction/ListItemSecondaryAction.d.mts +2 -2
- package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
- package/ListItemText/ListItemText.d.mts +3 -3
- package/ListItemText/ListItemText.d.ts +3 -3
- package/ListSubheader/ListSubheader.d.mts +3 -3
- package/ListSubheader/ListSubheader.d.ts +3 -3
- package/ListSubheader/ListSubheader.js +0 -3
- package/ListSubheader/ListSubheader.mjs +0 -3
- package/Menu/Menu.d.mts +5 -5
- package/Menu/Menu.d.ts +5 -5
- package/Menu/Menu.js +15 -32
- package/Menu/Menu.mjs +15 -32
- package/MenuItem/MenuItem.d.mts +3 -3
- package/MenuItem/MenuItem.d.ts +3 -3
- package/MenuItem/MenuItem.js +36 -26
- package/MenuItem/MenuItem.mjs +34 -26
- package/MenuList/MenuList.d.mts +4 -4
- package/MenuList/MenuList.d.ts +4 -4
- package/MenuList/MenuList.js +136 -101
- package/MenuList/MenuList.mjs +135 -100
- package/MenuList/MenuListContext.d.mts +11 -0
- package/MenuList/MenuListContext.d.ts +11 -0
- package/MenuList/MenuListContext.js +25 -0
- package/MenuList/MenuListContext.mjs +19 -0
- package/MobileStepper/MobileStepper.d.mts +3 -3
- package/MobileStepper/MobileStepper.d.ts +3 -3
- package/Modal/Modal.d.mts +7 -7
- package/Modal/Modal.d.ts +7 -7
- package/NativeSelect/NativeSelect.d.mts +3 -3
- package/NativeSelect/NativeSelect.d.ts +3 -3
- package/NoSsr/NoSsr.d.mts +2 -2
- package/NoSsr/NoSsr.d.ts +2 -2
- package/NoSsr/NoSsr.js +2 -2
- package/NoSsr/NoSsr.mjs +2 -2
- package/OutlinedInput/OutlinedInput.d.mts +4 -4
- package/OutlinedInput/OutlinedInput.d.ts +4 -4
- package/Pagination/Pagination.d.mts +2 -2
- package/Pagination/Pagination.d.ts +2 -2
- package/PaginationItem/PaginationItem.d.mts +8 -3
- package/PaginationItem/PaginationItem.d.ts +8 -3
- package/PaginationItem/PaginationItem.js +6 -0
- package/PaginationItem/PaginationItem.mjs +6 -0
- package/Paper/Paper.d.mts +4 -4
- package/Paper/Paper.d.ts +4 -4
- package/PigmentContainer/PigmentContainer.d.mts +2 -2
- package/PigmentContainer/PigmentContainer.d.ts +2 -2
- package/PigmentContainer/PigmentContainer.js +2 -2
- package/PigmentContainer/PigmentContainer.mjs +2 -2
- package/PigmentGrid/PigmentGrid.d.mts +3 -3
- package/PigmentGrid/PigmentGrid.d.ts +3 -3
- package/PigmentGrid/PigmentGrid.js +3 -3
- package/PigmentGrid/PigmentGrid.mjs +3 -3
- package/PigmentStack/PigmentStack.d.mts +2 -2
- package/PigmentStack/PigmentStack.d.ts +2 -2
- package/PigmentStack/PigmentStack.js +2 -2
- package/PigmentStack/PigmentStack.mjs +2 -2
- package/Popover/Popover.d.mts +5 -5
- package/Popover/Popover.d.ts +5 -5
- package/Popover/Popover.js +19 -7
- package/Popover/Popover.mjs +18 -6
- package/Popper/Popper.d.mts +4 -4
- package/Popper/Popper.d.ts +4 -4
- package/Popper/Popper.js +4 -4
- package/Popper/Popper.mjs +4 -4
- package/Portal/Portal.d.mts +2 -2
- package/Portal/Portal.d.ts +2 -2
- package/Portal/Portal.js +2 -2
- package/Portal/Portal.mjs +2 -2
- package/README.md +3 -3
- package/Radio/Radio.d.mts +3 -3
- package/Radio/Radio.d.ts +3 -3
- package/RadioGroup/RadioGroup.d.mts +3 -3
- package/RadioGroup/RadioGroup.d.ts +3 -3
- package/Rating/Rating.d.mts +2 -2
- package/Rating/Rating.d.ts +2 -2
- package/ScopedCssBaseline/ScopedCssBaseline.d.mts +2 -2
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
- package/Select/Select.d.mts +3 -3
- package/Select/Select.d.ts +3 -3
- package/Skeleton/Skeleton.d.mts +2 -2
- package/Skeleton/Skeleton.d.ts +2 -2
- package/Slide/Slide.d.mts +4 -4
- package/Slide/Slide.d.ts +4 -4
- package/Slide/Slide.js +43 -42
- package/Slide/Slide.mjs +44 -44
- package/Slider/Slider.d.mts +4 -4
- package/Slider/Slider.d.ts +4 -4
- package/Slider/Slider.js +1 -1
- package/Slider/Slider.mjs +1 -1
- package/Slider/useSlider.d.mts +1 -1
- package/Slider/useSlider.d.ts +1 -1
- package/Slider/useSlider.js +235 -209
- package/Slider/useSlider.mjs +235 -209
- package/Slider/useSlider.types.d.mts +2 -2
- package/Slider/useSlider.types.d.ts +2 -2
- package/Snackbar/Snackbar.d.mts +3 -3
- package/Snackbar/Snackbar.d.ts +3 -3
- package/SnackbarContent/SnackbarContent.d.mts +3 -3
- package/SnackbarContent/SnackbarContent.d.ts +3 -3
- package/SpeedDial/SpeedDial.d.mts +3 -3
- package/SpeedDial/SpeedDial.d.ts +3 -3
- package/SpeedDialAction/SpeedDialAction.d.mts +3 -3
- package/SpeedDialAction/SpeedDialAction.d.ts +3 -3
- package/SpeedDialIcon/SpeedDialIcon.d.mts +2 -2
- package/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
- package/Stack/Stack.d.mts +2 -2
- package/Stack/Stack.d.ts +2 -2
- package/Step/Step.d.mts +2 -2
- package/Step/Step.d.ts +2 -2
- package/StepButton/StepButton.d.mts +3 -3
- package/StepButton/StepButton.d.ts +3 -3
- package/StepButton/StepButton.js +44 -14
- package/StepButton/StepButton.mjs +44 -14
- package/StepConnector/StepConnector.d.mts +2 -2
- package/StepConnector/StepConnector.d.ts +2 -2
- package/StepConnector/StepConnector.js +1 -2
- package/StepConnector/StepConnector.mjs +1 -2
- package/StepContent/StepContent.d.mts +3 -3
- package/StepContent/StepContent.d.ts +3 -3
- package/StepIcon/StepIcon.d.mts +3 -3
- package/StepIcon/StepIcon.d.ts +3 -3
- package/StepLabel/StepLabel.d.mts +2 -2
- package/StepLabel/StepLabel.d.ts +2 -2
- package/Stepper/Stepper.d.mts +2 -2
- package/Stepper/Stepper.d.ts +2 -2
- package/Stepper/Stepper.js +54 -22
- package/Stepper/Stepper.mjs +54 -22
- package/Stepper/StepperContext.d.mts +0 -5
- package/Stepper/StepperContext.d.ts +0 -5
- package/Stepper/StepperContext.js +1 -2
- package/Stepper/StepperContext.mjs +0 -1
- package/SvgIcon/SvgIcon.d.mts +3 -3
- package/SvgIcon/SvgIcon.d.ts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.d.mts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.js +0 -3
- package/SwipeableDrawer/SwipeableDrawer.mjs +0 -3
- package/Switch/Switch.d.mts +4 -4
- package/Switch/Switch.d.ts +4 -4
- package/Switch/Switch.js +4 -0
- package/Switch/Switch.mjs +4 -0
- package/Tab/Tab.d.mts +3 -3
- package/Tab/Tab.d.ts +3 -3
- package/Tab/Tab.js +17 -1
- package/Tab/Tab.mjs +17 -1
- package/TabScrollButton/TabScrollButton.d.mts +3 -3
- package/TabScrollButton/TabScrollButton.d.ts +3 -3
- package/TabScrollButton/TabScrollButton.js +6 -2
- package/TabScrollButton/TabScrollButton.mjs +6 -2
- package/Table/Table.d.mts +2 -2
- package/Table/Table.d.ts +2 -2
- package/TableBody/TableBody.d.mts +2 -2
- package/TableBody/TableBody.d.ts +2 -2
- package/TableCell/TableCell.d.mts +2 -2
- package/TableCell/TableCell.d.ts +2 -2
- package/TableContainer/TableContainer.d.mts +2 -2
- package/TableContainer/TableContainer.d.ts +2 -2
- package/TableFooter/TableFooter.d.mts +2 -2
- package/TableFooter/TableFooter.d.ts +2 -2
- package/TableHead/TableHead.d.mts +2 -2
- package/TableHead/TableHead.d.ts +2 -2
- package/TablePagination/TablePagination.d.mts +4 -4
- package/TablePagination/TablePagination.d.ts +4 -4
- package/TablePaginationActions/TablePaginationActions.d.mts +2 -2
- package/TablePaginationActions/TablePaginationActions.d.ts +2 -2
- package/TableRow/TableRow.d.mts +2 -2
- package/TableRow/TableRow.d.ts +2 -2
- package/TableSortLabel/TableSortLabel.d.mts +3 -3
- package/TableSortLabel/TableSortLabel.d.ts +3 -3
- package/TableSortLabel/TableSortLabel.js +5 -3
- package/TableSortLabel/TableSortLabel.mjs +5 -3
- package/Tabs/Tabs.d.mts +2 -2
- package/Tabs/Tabs.d.ts +2 -2
- package/Tabs/Tabs.js +30 -21
- package/Tabs/Tabs.mjs +29 -20
- package/TextField/TextField.d.mts +10 -10
- package/TextField/TextField.d.ts +10 -10
- package/TextareaAutosize/TextareaAutosize.d.mts +2 -2
- package/TextareaAutosize/TextareaAutosize.d.ts +2 -2
- package/TextareaAutosize/TextareaAutosize.js +2 -2
- package/TextareaAutosize/TextareaAutosize.mjs +2 -2
- package/ToggleButton/ToggleButton.d.mts +3 -3
- package/ToggleButton/ToggleButton.d.ts +3 -3
- package/ToggleButton/ToggleButton.js +1 -0
- package/ToggleButton/ToggleButton.mjs +1 -0
- package/ToggleButtonGroup/ToggleButtonGroup.d.mts +2 -2
- package/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
- package/Toolbar/Toolbar.d.mts +2 -2
- package/Toolbar/Toolbar.d.ts +2 -2
- package/Tooltip/Tooltip.d.mts +3 -3
- package/Tooltip/Tooltip.d.ts +3 -3
- package/Typography/Typography.d.mts +4 -4
- package/Typography/Typography.d.ts +4 -4
- package/Zoom/Zoom.d.mts +3 -3
- package/Zoom/Zoom.d.ts +3 -3
- package/Zoom/Zoom.js +24 -30
- package/Zoom/Zoom.mjs +25 -31
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internal/SwitchBase.d.mts +2 -2
- package/internal/SwitchBase.d.ts +2 -2
- package/internal/SwitchBase.js +5 -1
- package/internal/SwitchBase.mjs +5 -1
- package/locale/psAF.js +1 -1
- package/locale/psAF.mjs +1 -1
- package/package.json +51 -51
- package/styles/createThemeNoVars.js +1 -1
- package/styles/createThemeNoVars.mjs +1 -1
- package/styles/createThemeWithVars.js +9 -9
- package/styles/createThemeWithVars.mjs +9 -9
- package/transitions/utils.d.mts +7 -0
- package/transitions/utils.d.ts +7 -0
- package/transitions/utils.js +27 -0
- package/transitions/utils.mjs +25 -0
- package/useAutocomplete/useAutocomplete.js +8 -0
- package/useAutocomplete/useAutocomplete.mjs +8 -0
- package/utils/focusWithVisible.js +24 -0
- package/utils/focusWithVisible.mjs +19 -0
- package/utils/index.d.mts +0 -1
- package/utils/index.d.ts +0 -1
- package/utils/index.js +0 -7
- package/utils/index.mjs +0 -1
- package/utils/useFocusableWhenDisabled.d.mts +30 -0
- package/utils/useFocusableWhenDisabled.d.ts +30 -0
- package/utils/useFocusableWhenDisabled.js +47 -0
- package/utils/useFocusableWhenDisabled.mjs +41 -0
- package/utils/useRovingTabIndex.d.mts +1 -2
- package/utils/useRovingTabIndex.d.ts +1 -2
- package/utils/useRovingTabIndex.js +25 -4
- package/utils/useRovingTabIndex.mjs +1 -2
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
package/Menu/Menu.d.mts
CHANGED
|
@@ -64,7 +64,7 @@ export type MenuSlotsAndSlotProps = CreateSlotsAndSlotProps<MenuSlots, {
|
|
|
64
64
|
*/
|
|
65
65
|
transition: SlotComponentProps<
|
|
66
66
|
// use SlotComponentProps because transition slot does not support `component` and `sx` prop
|
|
67
|
-
React.ElementType
|
|
67
|
+
React.ElementType<TransitionProps>, TransitionProps & MenuTransitionSlotPropsOverrides, MenuOwnerState>;
|
|
68
68
|
/**
|
|
69
69
|
* Props forwarded to the backdrop slot.
|
|
70
70
|
* By default, the available props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component.
|
|
@@ -138,12 +138,12 @@ export declare const MenuPaper: React.FC<PaperProps>;
|
|
|
138
138
|
*
|
|
139
139
|
* Demos:
|
|
140
140
|
*
|
|
141
|
-
* - [App Bar](https://
|
|
142
|
-
* - [Menu](https://
|
|
141
|
+
* - [App Bar](https://mui.com/material-ui/react-app-bar/)
|
|
142
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
143
143
|
*
|
|
144
144
|
* API:
|
|
145
145
|
*
|
|
146
|
-
* - [Menu API](https://
|
|
147
|
-
* - inherits [Popover API](https://
|
|
146
|
+
* - [Menu API](https://mui.com/material-ui/api/menu/)
|
|
147
|
+
* - inherits [Popover API](https://mui.com/material-ui/api/popover/)
|
|
148
148
|
*/
|
|
149
149
|
export default function Menu(props: MenuProps): React.JSX.Element;
|
package/Menu/Menu.d.ts
CHANGED
|
@@ -64,7 +64,7 @@ export type MenuSlotsAndSlotProps = CreateSlotsAndSlotProps<MenuSlots, {
|
|
|
64
64
|
*/
|
|
65
65
|
transition: SlotComponentProps<
|
|
66
66
|
// use SlotComponentProps because transition slot does not support `component` and `sx` prop
|
|
67
|
-
React.ElementType
|
|
67
|
+
React.ElementType<TransitionProps>, TransitionProps & MenuTransitionSlotPropsOverrides, MenuOwnerState>;
|
|
68
68
|
/**
|
|
69
69
|
* Props forwarded to the backdrop slot.
|
|
70
70
|
* By default, the available props are based on the [Backdrop](https://mui.com/material-ui/api/backdrop/#props) component.
|
|
@@ -138,12 +138,12 @@ export declare const MenuPaper: React.FC<PaperProps>;
|
|
|
138
138
|
*
|
|
139
139
|
* Demos:
|
|
140
140
|
*
|
|
141
|
-
* - [App Bar](https://
|
|
142
|
-
* - [Menu](https://
|
|
141
|
+
* - [App Bar](https://mui.com/material-ui/react-app-bar/)
|
|
142
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
143
143
|
*
|
|
144
144
|
* API:
|
|
145
145
|
*
|
|
146
|
-
* - [Menu API](https://
|
|
147
|
-
* - inherits [Popover API](https://
|
|
146
|
+
* - [Menu API](https://mui.com/material-ui/api/menu/)
|
|
147
|
+
* - inherits [Popover API](https://mui.com/material-ui/api/popover/)
|
|
148
148
|
*/
|
|
149
149
|
export default function Menu(props: MenuProps): React.JSX.Element;
|
package/Menu/Menu.js
CHANGED
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
});
|
|
9
9
|
exports.default = exports.MenuPaper = void 0;
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _reactIs = require("react-is");
|
|
12
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
13
|
var _HTMLElementType = _interopRequireDefault(require("@mui/utils/HTMLElementType"));
|
|
@@ -92,13 +91,17 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
92
91
|
variant
|
|
93
92
|
};
|
|
94
93
|
const classes = useUtilityClasses(ownerState);
|
|
95
|
-
const
|
|
94
|
+
const shouldManageInitialFocus = autoFocus && open; // `&& open` prevents a Menu with `keepMounted={true}` from accidentally stealing focus
|
|
95
|
+
const shouldAutoFocusActiveItem = shouldManageInitialFocus && !disableAutoFocusItem;
|
|
96
96
|
const menuListActionsRef = React.useRef(null);
|
|
97
97
|
const handleEntering = (element, _isAppearing) => {
|
|
98
98
|
if (menuListActionsRef.current) {
|
|
99
99
|
menuListActionsRef.current.adjustStyleForScrollbar(element, {
|
|
100
100
|
direction: isRtl ? 'rtl' : 'ltr'
|
|
101
101
|
});
|
|
102
|
+
if (shouldManageInitialFocus) {
|
|
103
|
+
menuListActionsRef.current.focusInitialTarget?.();
|
|
104
|
+
}
|
|
102
105
|
}
|
|
103
106
|
};
|
|
104
107
|
const handleListKeyDown = event => {
|
|
@@ -109,33 +112,6 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
109
112
|
}
|
|
110
113
|
}
|
|
111
114
|
};
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* the index of the item should receive focus
|
|
115
|
-
* in a `variant="selectedMenu"` it's the first `selected` item
|
|
116
|
-
* otherwise it's the very first item.
|
|
117
|
-
*/
|
|
118
|
-
let activeItemIndex = -1;
|
|
119
|
-
// since we inject focus related props into children we have to do a lookahead
|
|
120
|
-
// to check if there is a `selected` item. We're looking for the last `selected`
|
|
121
|
-
// item and use the first valid item as a fallback
|
|
122
|
-
React.Children.map(children, (child, index) => {
|
|
123
|
-
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
127
|
-
if ((0, _reactIs.isFragment)(child)) {
|
|
128
|
-
console.error(["MUI: The Menu component doesn't accept a Fragment as a child.", 'Consider providing an array instead.'].join('\n'));
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
if (!child.props.disabled) {
|
|
132
|
-
if (variant === 'selectedMenu' && child.props.selected) {
|
|
133
|
-
activeItemIndex = index;
|
|
134
|
-
} else if (activeItemIndex === -1) {
|
|
135
|
-
activeItemIndex = index;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
115
|
const externalForwardedProps = {
|
|
140
116
|
slots,
|
|
141
117
|
slotProps
|
|
@@ -168,7 +144,14 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
168
144
|
ownerState
|
|
169
145
|
});
|
|
170
146
|
const resolvedTransitionProps = typeof slotProps.transition === 'function' ? slotProps.transition(ownerState) : slotProps.transition;
|
|
171
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuRoot
|
|
147
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MenuRoot
|
|
148
|
+
// `disableAutoFocus={autoFocus}` is NOT a mistake
|
|
149
|
+
// - `autoFocus` means `Menu` will control focus and move it into `MenuList` or an active `MenuItem`
|
|
150
|
+
// - `disableAutoFocus` means disable `MenuRoot`s underlying `Popover`'s autoFocus handling
|
|
151
|
+
// This prevents `MenuList` and `Popover` from fighting each other to control focus.
|
|
152
|
+
// (This has nothing to do with DOM `autoFocus`)
|
|
153
|
+
, {
|
|
154
|
+
disableAutoFocus: autoFocus,
|
|
172
155
|
onClose: onClose,
|
|
173
156
|
anchorOrigin: {
|
|
174
157
|
vertical: 'bottom',
|
|
@@ -201,8 +184,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
201
184
|
classes: PopoverClasses,
|
|
202
185
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ListSlot, {
|
|
203
186
|
actions: menuListActionsRef,
|
|
204
|
-
autoFocus:
|
|
205
|
-
autoFocusItem:
|
|
187
|
+
autoFocus: shouldManageInitialFocus,
|
|
188
|
+
autoFocusItem: shouldAutoFocusActiveItem,
|
|
206
189
|
variant: variant,
|
|
207
190
|
...listSlotProps,
|
|
208
191
|
children: children
|
package/Menu/Menu.mjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import { isFragment } from 'react-is';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
6
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
@@ -85,13 +84,17 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
85
84
|
variant
|
|
86
85
|
};
|
|
87
86
|
const classes = useUtilityClasses(ownerState);
|
|
88
|
-
const
|
|
87
|
+
const shouldManageInitialFocus = autoFocus && open; // `&& open` prevents a Menu with `keepMounted={true}` from accidentally stealing focus
|
|
88
|
+
const shouldAutoFocusActiveItem = shouldManageInitialFocus && !disableAutoFocusItem;
|
|
89
89
|
const menuListActionsRef = React.useRef(null);
|
|
90
90
|
const handleEntering = (element, _isAppearing) => {
|
|
91
91
|
if (menuListActionsRef.current) {
|
|
92
92
|
menuListActionsRef.current.adjustStyleForScrollbar(element, {
|
|
93
93
|
direction: isRtl ? 'rtl' : 'ltr'
|
|
94
94
|
});
|
|
95
|
+
if (shouldManageInitialFocus) {
|
|
96
|
+
menuListActionsRef.current.focusInitialTarget?.();
|
|
97
|
+
}
|
|
95
98
|
}
|
|
96
99
|
};
|
|
97
100
|
const handleListKeyDown = event => {
|
|
@@ -102,33 +105,6 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
102
105
|
}
|
|
103
106
|
}
|
|
104
107
|
};
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* the index of the item should receive focus
|
|
108
|
-
* in a `variant="selectedMenu"` it's the first `selected` item
|
|
109
|
-
* otherwise it's the very first item.
|
|
110
|
-
*/
|
|
111
|
-
let activeItemIndex = -1;
|
|
112
|
-
// since we inject focus related props into children we have to do a lookahead
|
|
113
|
-
// to check if there is a `selected` item. We're looking for the last `selected`
|
|
114
|
-
// item and use the first valid item as a fallback
|
|
115
|
-
React.Children.map(children, (child, index) => {
|
|
116
|
-
if (! /*#__PURE__*/React.isValidElement(child)) {
|
|
117
|
-
return;
|
|
118
|
-
}
|
|
119
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
120
|
-
if (isFragment(child)) {
|
|
121
|
-
console.error(["MUI: The Menu component doesn't accept a Fragment as a child.", 'Consider providing an array instead.'].join('\n'));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
if (!child.props.disabled) {
|
|
125
|
-
if (variant === 'selectedMenu' && child.props.selected) {
|
|
126
|
-
activeItemIndex = index;
|
|
127
|
-
} else if (activeItemIndex === -1) {
|
|
128
|
-
activeItemIndex = index;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
108
|
const externalForwardedProps = {
|
|
133
109
|
slots,
|
|
134
110
|
slotProps
|
|
@@ -161,7 +137,14 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
161
137
|
ownerState
|
|
162
138
|
});
|
|
163
139
|
const resolvedTransitionProps = typeof slotProps.transition === 'function' ? slotProps.transition(ownerState) : slotProps.transition;
|
|
164
|
-
return /*#__PURE__*/_jsx(MenuRoot
|
|
140
|
+
return /*#__PURE__*/_jsx(MenuRoot
|
|
141
|
+
// `disableAutoFocus={autoFocus}` is NOT a mistake
|
|
142
|
+
// - `autoFocus` means `Menu` will control focus and move it into `MenuList` or an active `MenuItem`
|
|
143
|
+
// - `disableAutoFocus` means disable `MenuRoot`s underlying `Popover`'s autoFocus handling
|
|
144
|
+
// This prevents `MenuList` and `Popover` from fighting each other to control focus.
|
|
145
|
+
// (This has nothing to do with DOM `autoFocus`)
|
|
146
|
+
, {
|
|
147
|
+
disableAutoFocus: autoFocus,
|
|
165
148
|
onClose: onClose,
|
|
166
149
|
anchorOrigin: {
|
|
167
150
|
vertical: 'bottom',
|
|
@@ -194,8 +177,8 @@ const Menu = /*#__PURE__*/React.forwardRef(function Menu(inProps, ref) {
|
|
|
194
177
|
classes: PopoverClasses,
|
|
195
178
|
children: /*#__PURE__*/_jsx(ListSlot, {
|
|
196
179
|
actions: menuListActionsRef,
|
|
197
|
-
autoFocus:
|
|
198
|
-
autoFocusItem:
|
|
180
|
+
autoFocus: shouldManageInitialFocus,
|
|
181
|
+
autoFocusItem: shouldAutoFocusActiveItem,
|
|
199
182
|
variant: variant,
|
|
200
183
|
...listSlotProps,
|
|
201
184
|
children: children
|
package/MenuItem/MenuItem.d.mts
CHANGED
|
@@ -55,12 +55,12 @@ export type MenuItemTypeMap<AdditionalProps = {}, RootComponent extends React.El
|
|
|
55
55
|
*
|
|
56
56
|
* Demos:
|
|
57
57
|
*
|
|
58
|
-
* - [Menu](https://
|
|
58
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
59
59
|
*
|
|
60
60
|
* API:
|
|
61
61
|
*
|
|
62
|
-
* - [MenuItem API](https://
|
|
63
|
-
* - inherits [ButtonBase API](https://
|
|
62
|
+
* - [MenuItem API](https://mui.com/material-ui/api/menu-item/)
|
|
63
|
+
* - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
|
|
64
64
|
*/
|
|
65
65
|
declare const MenuItem: ExtendButtonBase<MenuItemTypeMap>;
|
|
66
66
|
export type MenuItemProps<RootComponent extends React.ElementType = MenuItemTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<MenuItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
package/MenuItem/MenuItem.d.ts
CHANGED
|
@@ -55,12 +55,12 @@ export type MenuItemTypeMap<AdditionalProps = {}, RootComponent extends React.El
|
|
|
55
55
|
*
|
|
56
56
|
* Demos:
|
|
57
57
|
*
|
|
58
|
-
* - [Menu](https://
|
|
58
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
59
59
|
*
|
|
60
60
|
* API:
|
|
61
61
|
*
|
|
62
|
-
* - [MenuItem API](https://
|
|
63
|
-
* - inherits [ButtonBase API](https://
|
|
62
|
+
* - [MenuItem API](https://mui.com/material-ui/api/menu-item/)
|
|
63
|
+
* - inherits [ButtonBase API](https://mui.com/material-ui/api/button-base/)
|
|
64
64
|
*/
|
|
65
65
|
declare const MenuItem: ExtendButtonBase<MenuItemTypeMap>;
|
|
66
66
|
export type MenuItemProps<RootComponent extends React.ElementType = MenuItemTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<MenuItemTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
package/MenuItem/MenuItem.js
CHANGED
|
@@ -18,30 +18,17 @@ var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
|
18
18
|
var _ListContext = _interopRequireDefault(require("../List/ListContext"));
|
|
19
19
|
var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
|
|
20
20
|
var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
|
|
21
|
+
var _focusWithVisible = _interopRequireDefault(require("../utils/focusWithVisible"));
|
|
21
22
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
23
|
+
var _useId = _interopRequireDefault(require("../utils/useId"));
|
|
24
|
+
var _useRovingTabIndex = require("../utils/useRovingTabIndex");
|
|
22
25
|
var _Divider = require("../Divider");
|
|
23
26
|
var _ListItemIcon = require("../ListItemIcon");
|
|
24
27
|
var _ListItemText = require("../ListItemText");
|
|
28
|
+
var _MenuListContext = require("../MenuList/MenuListContext");
|
|
29
|
+
var _utils = require("../Select/utils");
|
|
25
30
|
var _menuItemClasses = _interopRequireWildcard(require("./menuItemClasses"));
|
|
26
|
-
var _Select = require("../Select");
|
|
27
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
28
|
-
/**
|
|
29
|
-
* If autoFocus is an object, it will attempt to call `element.focus()` with the options argument.
|
|
30
|
-
* If the browser doesn't support the options argument, it will fall back to a simple `element.focus()` call.
|
|
31
|
-
*/function focusWithVisible(element, focusSource) {
|
|
32
|
-
if (focusSource == null) {
|
|
33
|
-
element.focus();
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
try {
|
|
37
|
-
element.focus({
|
|
38
|
-
focusVisible: focusSource === 'keyboard'
|
|
39
|
-
});
|
|
40
|
-
} catch (error) {
|
|
41
|
-
// If the browser doesn't support the focus options argument, fall back to a simple focus call.
|
|
42
|
-
element.focus();
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
32
|
const overridesResolver = (props, styles) => {
|
|
46
33
|
const {
|
|
47
34
|
ownerState
|
|
@@ -177,7 +164,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
177
164
|
name: 'MuiMenuItem'
|
|
178
165
|
});
|
|
179
166
|
const {
|
|
180
|
-
autoFocus = false,
|
|
167
|
+
autoFocus: shouldAutoFocusOnMount = false,
|
|
181
168
|
component = 'li',
|
|
182
169
|
dense = false,
|
|
183
170
|
divider = false,
|
|
@@ -188,23 +175,30 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
188
175
|
className,
|
|
189
176
|
...other
|
|
190
177
|
} = props;
|
|
191
|
-
const focusSource = (0,
|
|
178
|
+
const focusSource = (0, _utils.useSelectFocusSource)();
|
|
192
179
|
const context = React.useContext(_ListContext.default);
|
|
193
180
|
const childContext = React.useMemo(() => ({
|
|
194
181
|
dense: dense || context.dense || false,
|
|
195
182
|
disableGutters
|
|
196
183
|
}), [context.dense, dense, disableGutters]);
|
|
184
|
+
const menuListContext = (0, _MenuListContext.useMenuListContext)();
|
|
185
|
+
const rovingItemId = (0, _useId.default)();
|
|
186
|
+
// Escape hatch via ButtonBase for when an anchored <Menu> is opened with a pointer
|
|
187
|
+
// interaction on a trigger, the item should receive DOM focus but without focus visible
|
|
188
|
+
// styling. Current API does not allow a reliable `openInteractionType` for anchored menus.
|
|
189
|
+
const suppressFocusVisible = menuListContext.suppressInitialFocusVisible;
|
|
190
|
+
const itemsFocusableWhenDisabled = menuListContext.itemsFocusableWhenDisabled;
|
|
197
191
|
const menuItemRef = React.useRef(null);
|
|
198
192
|
(0, _useEnhancedEffect.default)(() => {
|
|
199
|
-
if (
|
|
193
|
+
if (shouldAutoFocusOnMount) {
|
|
200
194
|
if (menuItemRef.current) {
|
|
201
|
-
|
|
195
|
+
(0, _focusWithVisible.default)(menuItemRef.current, focusSource);
|
|
202
196
|
} else if (process.env.NODE_ENV !== 'production') {
|
|
203
197
|
console.error('MUI: Unable to set focus to a MenuItem whose component has not been rendered.');
|
|
204
198
|
}
|
|
205
199
|
}
|
|
206
200
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
207
|
-
}, [
|
|
201
|
+
}, [shouldAutoFocusOnMount]);
|
|
208
202
|
const ownerState = {
|
|
209
203
|
...props,
|
|
210
204
|
dense: childContext.dense,
|
|
@@ -212,10 +206,23 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
212
206
|
disableGutters
|
|
213
207
|
};
|
|
214
208
|
const classes = useUtilityClasses(props);
|
|
215
|
-
const
|
|
209
|
+
const rovingItemProps = (0, _useRovingTabIndex.useRovingTabIndexItem)({
|
|
210
|
+
id: rovingItemId,
|
|
211
|
+
ref,
|
|
212
|
+
disabled: props.disabled,
|
|
213
|
+
focusableWhenDisabled: itemsFocusableWhenDisabled,
|
|
214
|
+
selected: props.selected
|
|
215
|
+
});
|
|
216
|
+
const handleRef = (0, _useForkRef.default)(menuItemRef, rovingItemProps.ref);
|
|
216
217
|
let tabIndex;
|
|
217
|
-
if (
|
|
218
|
-
tabIndex = tabIndexProp
|
|
218
|
+
if (tabIndexProp !== undefined) {
|
|
219
|
+
tabIndex = tabIndexProp;
|
|
220
|
+
} else if (menuListContext.variant === 'selectedMenu') {
|
|
221
|
+
tabIndex = rovingItemProps.tabIndex;
|
|
222
|
+
} else if (!props.disabled || itemsFocusableWhenDisabled) {
|
|
223
|
+
// In `menu` variant, registration still drives arrow-key navigation even
|
|
224
|
+
// though each item keeps `tabIndex={-1}`.
|
|
225
|
+
tabIndex = -1;
|
|
219
226
|
}
|
|
220
227
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListContext.default.Provider, {
|
|
221
228
|
value: childContext,
|
|
@@ -224,6 +231,9 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
224
231
|
role: role,
|
|
225
232
|
tabIndex: tabIndex,
|
|
226
233
|
component: component,
|
|
234
|
+
internalNativeButton: false,
|
|
235
|
+
focusableWhenDisabled: itemsFocusableWhenDisabled,
|
|
236
|
+
suppressFocusVisible: suppressFocusVisible,
|
|
227
237
|
focusVisibleClassName: (0, _clsx.default)(classes.focusVisible, focusVisibleClassName),
|
|
228
238
|
className: (0, _clsx.default)(classes.root, className),
|
|
229
239
|
...other,
|
package/MenuItem/MenuItem.mjs
CHANGED
|
@@ -11,32 +11,17 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
|
11
11
|
import ListContext from "../List/ListContext.mjs";
|
|
12
12
|
import ButtonBase from "../ButtonBase/index.mjs";
|
|
13
13
|
import useEnhancedEffect from "../utils/useEnhancedEffect.mjs";
|
|
14
|
+
import focusWithVisible from "../utils/focusWithVisible.mjs";
|
|
14
15
|
import useForkRef from "../utils/useForkRef.mjs";
|
|
16
|
+
import useId from "../utils/useId.mjs";
|
|
17
|
+
import { useRovingTabIndexItem } from "../utils/useRovingTabIndex.mjs";
|
|
15
18
|
import { dividerClasses } from "../Divider/index.mjs";
|
|
16
19
|
import { listItemIconClasses } from "../ListItemIcon/index.mjs";
|
|
17
20
|
import { listItemTextClasses } from "../ListItemText/index.mjs";
|
|
21
|
+
import { useMenuListContext } from "../MenuList/MenuListContext.mjs";
|
|
22
|
+
import { useSelectFocusSource } from "../Select/utils/index.mjs";
|
|
18
23
|
import menuItemClasses, { getMenuItemUtilityClass } from "./menuItemClasses.mjs";
|
|
19
|
-
import { useSelectFocusSource } from "../Select/index.mjs";
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* If autoFocus is an object, it will attempt to call `element.focus()` with the options argument.
|
|
23
|
-
* If the browser doesn't support the options argument, it will fall back to a simple `element.focus()` call.
|
|
24
|
-
*/
|
|
25
24
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
26
|
-
function focusWithVisible(element, focusSource) {
|
|
27
|
-
if (focusSource == null) {
|
|
28
|
-
element.focus();
|
|
29
|
-
return;
|
|
30
|
-
}
|
|
31
|
-
try {
|
|
32
|
-
element.focus({
|
|
33
|
-
focusVisible: focusSource === 'keyboard'
|
|
34
|
-
});
|
|
35
|
-
} catch (error) {
|
|
36
|
-
// If the browser doesn't support the focus options argument, fall back to a simple focus call.
|
|
37
|
-
element.focus();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
25
|
export const overridesResolver = (props, styles) => {
|
|
41
26
|
const {
|
|
42
27
|
ownerState
|
|
@@ -171,7 +156,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
171
156
|
name: 'MuiMenuItem'
|
|
172
157
|
});
|
|
173
158
|
const {
|
|
174
|
-
autoFocus = false,
|
|
159
|
+
autoFocus: shouldAutoFocusOnMount = false,
|
|
175
160
|
component = 'li',
|
|
176
161
|
dense = false,
|
|
177
162
|
divider = false,
|
|
@@ -188,9 +173,16 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
188
173
|
dense: dense || context.dense || false,
|
|
189
174
|
disableGutters
|
|
190
175
|
}), [context.dense, dense, disableGutters]);
|
|
176
|
+
const menuListContext = useMenuListContext();
|
|
177
|
+
const rovingItemId = useId();
|
|
178
|
+
// Escape hatch via ButtonBase for when an anchored <Menu> is opened with a pointer
|
|
179
|
+
// interaction on a trigger, the item should receive DOM focus but without focus visible
|
|
180
|
+
// styling. Current API does not allow a reliable `openInteractionType` for anchored menus.
|
|
181
|
+
const suppressFocusVisible = menuListContext.suppressInitialFocusVisible;
|
|
182
|
+
const itemsFocusableWhenDisabled = menuListContext.itemsFocusableWhenDisabled;
|
|
191
183
|
const menuItemRef = React.useRef(null);
|
|
192
184
|
useEnhancedEffect(() => {
|
|
193
|
-
if (
|
|
185
|
+
if (shouldAutoFocusOnMount) {
|
|
194
186
|
if (menuItemRef.current) {
|
|
195
187
|
focusWithVisible(menuItemRef.current, focusSource);
|
|
196
188
|
} else if (process.env.NODE_ENV !== 'production') {
|
|
@@ -198,7 +190,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
198
190
|
}
|
|
199
191
|
}
|
|
200
192
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
201
|
-
}, [
|
|
193
|
+
}, [shouldAutoFocusOnMount]);
|
|
202
194
|
const ownerState = {
|
|
203
195
|
...props,
|
|
204
196
|
dense: childContext.dense,
|
|
@@ -206,10 +198,23 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
206
198
|
disableGutters
|
|
207
199
|
};
|
|
208
200
|
const classes = useUtilityClasses(props);
|
|
209
|
-
const
|
|
201
|
+
const rovingItemProps = useRovingTabIndexItem({
|
|
202
|
+
id: rovingItemId,
|
|
203
|
+
ref,
|
|
204
|
+
disabled: props.disabled,
|
|
205
|
+
focusableWhenDisabled: itemsFocusableWhenDisabled,
|
|
206
|
+
selected: props.selected
|
|
207
|
+
});
|
|
208
|
+
const handleRef = useForkRef(menuItemRef, rovingItemProps.ref);
|
|
210
209
|
let tabIndex;
|
|
211
|
-
if (
|
|
212
|
-
tabIndex = tabIndexProp
|
|
210
|
+
if (tabIndexProp !== undefined) {
|
|
211
|
+
tabIndex = tabIndexProp;
|
|
212
|
+
} else if (menuListContext.variant === 'selectedMenu') {
|
|
213
|
+
tabIndex = rovingItemProps.tabIndex;
|
|
214
|
+
} else if (!props.disabled || itemsFocusableWhenDisabled) {
|
|
215
|
+
// In `menu` variant, registration still drives arrow-key navigation even
|
|
216
|
+
// though each item keeps `tabIndex={-1}`.
|
|
217
|
+
tabIndex = -1;
|
|
213
218
|
}
|
|
214
219
|
return /*#__PURE__*/_jsx(ListContext.Provider, {
|
|
215
220
|
value: childContext,
|
|
@@ -218,6 +223,9 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
|
|
|
218
223
|
role: role,
|
|
219
224
|
tabIndex: tabIndex,
|
|
220
225
|
component: component,
|
|
226
|
+
internalNativeButton: false,
|
|
227
|
+
focusableWhenDisabled: itemsFocusableWhenDisabled,
|
|
228
|
+
suppressFocusVisible: suppressFocusVisible,
|
|
221
229
|
focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
|
|
222
230
|
className: clsx(classes.root, className),
|
|
223
231
|
...other,
|
package/MenuList/MenuList.d.mts
CHANGED
|
@@ -42,18 +42,18 @@ export type MenuListClassKey = keyof NonNullable<MenuListTypeMap['props']['class
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* A permanently displayed menu following https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/.
|
|
45
|
-
* It's exposed to help customization of the [`Menu`](https://
|
|
45
|
+
* It's exposed to help customization of the [`Menu`](https://mui.com/material-ui/api/menu/) component if you
|
|
46
46
|
* use it separately you need to move focus into the component manually. Once
|
|
47
47
|
* the focus is placed inside the component it is fully keyboard accessible.
|
|
48
48
|
*
|
|
49
49
|
* Demos:
|
|
50
50
|
*
|
|
51
|
-
* - [Menu](https://
|
|
51
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
52
52
|
*
|
|
53
53
|
* API:
|
|
54
54
|
*
|
|
55
|
-
* - [MenuList API](https://
|
|
56
|
-
* - inherits [List API](https://
|
|
55
|
+
* - [MenuList API](https://mui.com/material-ui/api/menu-list/)
|
|
56
|
+
* - inherits [List API](https://mui.com/material-ui/api/list/)
|
|
57
57
|
*/
|
|
58
58
|
declare const MenuList: ExtendList<MenuListTypeMap>;
|
|
59
59
|
export type MenuListProps<RootComponent extends React.ElementType = MenuListTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<MenuListTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|
package/MenuList/MenuList.d.ts
CHANGED
|
@@ -42,18 +42,18 @@ export type MenuListClassKey = keyof NonNullable<MenuListTypeMap['props']['class
|
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* A permanently displayed menu following https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/.
|
|
45
|
-
* It's exposed to help customization of the [`Menu`](https://
|
|
45
|
+
* It's exposed to help customization of the [`Menu`](https://mui.com/material-ui/api/menu/) component if you
|
|
46
46
|
* use it separately you need to move focus into the component manually. Once
|
|
47
47
|
* the focus is placed inside the component it is fully keyboard accessible.
|
|
48
48
|
*
|
|
49
49
|
* Demos:
|
|
50
50
|
*
|
|
51
|
-
* - [Menu](https://
|
|
51
|
+
* - [Menu](https://mui.com/material-ui/react-menu/)
|
|
52
52
|
*
|
|
53
53
|
* API:
|
|
54
54
|
*
|
|
55
|
-
* - [MenuList API](https://
|
|
56
|
-
* - inherits [List API](https://
|
|
55
|
+
* - [MenuList API](https://mui.com/material-ui/api/menu-list/)
|
|
56
|
+
* - inherits [List API](https://mui.com/material-ui/api/list/)
|
|
57
57
|
*/
|
|
58
58
|
declare const MenuList: ExtendList<MenuListTypeMap>;
|
|
59
59
|
export type MenuListProps<RootComponent extends React.ElementType = MenuListTypeMap['defaultComponent'], AdditionalProps = {}> = OverrideProps<MenuListTypeMap<AdditionalProps, RootComponent>, RootComponent> & {
|