@mui/material 7.3.9 → 7.3.11
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 +3 -3
- package/AccordionActions/AccordionActions.d.ts +2 -2
- package/AccordionDetails/AccordionDetails.d.ts +2 -2
- package/AccordionSummary/AccordionSummary.d.ts +3 -3
- package/Alert/Alert.d.ts +3 -3
- package/AlertTitle/AlertTitle.d.ts +3 -3
- package/AppBar/AppBar.d.ts +3 -3
- package/Autocomplete/Autocomplete.d.ts +18 -2
- package/Autocomplete/Autocomplete.js +111 -37
- package/Avatar/Avatar.d.ts +2 -2
- package/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/Backdrop/Backdrop.d.ts +3 -3
- package/Badge/Badge.d.ts +3 -3
- package/BottomNavigation/BottomNavigation.d.ts +2 -2
- package/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
- package/Box/Box.d.ts +3 -2
- package/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/Button/Button.d.ts +6 -5
- package/Button/Button.js +18 -1
- package/ButtonBase/ButtonBase.d.ts +2 -2
- package/ButtonBase/ButtonBase.js +8 -2
- package/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/CHANGELOG.md +82 -0
- package/Card/Card.d.ts +3 -3
- package/CardActionArea/CardActionArea.d.ts +3 -3
- package/CardActions/CardActions.d.ts +2 -2
- package/CardContent/CardContent.d.ts +2 -2
- package/CardHeader/CardHeader.d.ts +2 -2
- package/CardHeader/CardHeader.js +5 -1
- package/CardMedia/CardMedia.d.ts +2 -2
- package/Checkbox/Checkbox.d.ts +4 -4
- package/Checkbox/Checkbox.js +2 -1
- package/Chip/Chip.d.ts +2 -2
- package/CircularProgress/CircularProgress.d.ts +2 -2
- package/ClickAwayListener/ClickAwayListener.d.ts +3 -3
- package/ClickAwayListener/ClickAwayListener.js +5 -8
- package/Collapse/Collapse.d.ts +5 -5
- package/Collapse/Collapse.js +6 -18
- package/Container/Container.d.ts +2 -2
- package/CssBaseline/CssBaseline.d.ts +2 -2
- package/Dialog/Dialog.d.ts +10 -3
- package/Dialog/Dialog.js +19 -6
- package/DialogActions/DialogActions.d.ts +2 -2
- package/DialogContent/DialogContent.d.ts +2 -2
- package/DialogContentText/DialogContentText.d.ts +3 -3
- package/DialogTitle/DialogTitle.d.ts +3 -3
- package/Divider/Divider.d.ts +4 -3
- package/Drawer/Drawer.d.ts +3 -3
- package/Drawer/Drawer.js +18 -4
- package/Fab/Fab.d.ts +3 -3
- package/Fab/Fab.js +7 -1
- package/Fade/Fade.d.ts +3 -3
- package/Fade/Fade.js +28 -32
- package/FilledInput/FilledInput.d.ts +3 -3
- package/FilledInput/FilledInput.js +1 -1
- package/FormControl/FormControl.d.ts +7 -7
- package/FormControlLabel/FormControlLabel.d.ts +4 -4
- package/FormGroup/FormGroup.d.ts +3 -3
- package/FormHelperText/FormHelperText.d.ts +3 -3
- package/FormLabel/FormLabel.d.ts +5 -5
- package/GlobalStyles/GlobalStyles.d.ts +2 -2
- package/Grid/Grid.d.ts +2 -2
- package/Grid/Grid.js +2 -2
- package/GridLegacy/GridLegacy.d.ts +2 -2
- package/Grow/Grow.d.ts +5 -5
- package/Grow/Grow.js +30 -38
- package/Icon/Icon.d.ts +3 -3
- package/IconButton/IconButton.d.ts +5 -5
- package/ImageList/ImageList.d.ts +2 -2
- package/ImageListItem/ImageListItem.d.ts +2 -2
- package/ImageListItemBar/ImageListItemBar.d.ts +2 -2
- package/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -2
- package/InitColorSchemeScript/InitColorSchemeScript.js +2 -2
- package/Input/Input.d.ts +3 -3
- package/Input/Input.js +1 -1
- package/InputAdornment/InputAdornment.d.ts +2 -2
- package/InputBase/InputBase.d.ts +2 -2
- package/InputBase/InputBase.js +39 -7
- package/InputLabel/InputLabel.d.ts +4 -4
- package/LinearProgress/LinearProgress.d.ts +2 -2
- package/Link/Link.d.ts +4 -4
- package/List/List.d.ts +4 -3
- package/ListItem/ListItem.d.ts +3 -3
- package/ListItemAvatar/ListItemAvatar.d.ts +2 -2
- package/ListItemButton/ListItemButton.d.ts +4 -3
- package/ListItemButton/ListItemButton.js +7 -1
- package/ListItemIcon/ListItemIcon.d.ts +3 -2
- package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
- package/ListItemText/ListItemText.d.ts +3 -2
- package/ListItemText/ListItemText.js +5 -1
- package/ListSubheader/ListSubheader.d.ts +3 -2
- package/Menu/Menu.d.ts +4 -4
- package/MenuItem/MenuItem.d.ts +3 -3
- package/MenuItem/MenuItem.js +27 -2
- package/MenuList/MenuList.d.ts +4 -4
- package/MobileStepper/MobileStepper.d.ts +3 -3
- package/Modal/Modal.d.ts +7 -7
- package/NativeSelect/NativeSelect.d.ts +3 -3
- package/NoSsr/NoSsr.d.ts +2 -2
- package/NoSsr/NoSsr.js +2 -2
- package/OutlinedInput/OutlinedInput.d.ts +4 -4
- package/Pagination/Pagination.d.ts +2 -2
- package/PaginationItem/PaginationItem.d.ts +3 -3
- package/Paper/Paper.d.ts +4 -3
- package/PigmentContainer/PigmentContainer.d.ts +2 -2
- package/PigmentContainer/PigmentContainer.js +2 -3
- package/PigmentGrid/PigmentGrid.d.ts +2 -2
- package/PigmentGrid/PigmentGrid.js +2 -3
- package/PigmentStack/PigmentStack.d.ts +2 -2
- package/PigmentStack/PigmentStack.js +2 -3
- package/Popover/Popover.d.ts +4 -4
- package/Popper/BasePopper.js +23 -1
- package/Popper/Popper.d.ts +4 -4
- package/Popper/Popper.js +4 -4
- package/Popper/index.d.ts +1 -0
- package/Popper/index.js +11 -2
- package/Portal/Portal.d.ts +2 -2
- package/Portal/Portal.js +2 -2
- package/README.md +2 -2
- package/Radio/Radio.d.ts +3 -3
- package/RadioGroup/RadioGroup.d.ts +3 -3
- package/Rating/Rating.d.ts +2 -2
- package/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
- package/Select/Select.d.ts +3 -3
- package/Select/SelectInput.js +46 -47
- package/Select/index.d.ts +1 -0
- package/Select/index.js +12 -0
- package/Select/utils/SelectFocusSourceContext.d.ts +4 -0
- package/Select/utils/SelectFocusSourceContext.js +19 -0
- package/Select/utils/areEqualValues.d.ts +1 -0
- package/Select/utils/areEqualValues.js +14 -0
- package/Select/utils/getOpenInteractionType.d.ts +1 -0
- package/Select/utils/getOpenInteractionType.js +18 -0
- package/Select/utils/index.d.ts +4 -0
- package/Select/utils/index.js +40 -0
- package/Select/utils/isEmpty.d.ts +1 -0
- package/Select/utils/isEmpty.js +9 -0
- package/Skeleton/Skeleton.d.ts +2 -2
- package/Slide/Slide.d.ts +4 -4
- package/Slide/Slide.js +43 -42
- package/Slider/Slider.d.ts +7 -7
- package/Slider/useSlider.js +6 -3
- package/Snackbar/Snackbar.d.ts +2 -2
- package/SnackbarContent/SnackbarContent.d.ts +3 -3
- package/SpeedDial/SpeedDial.d.ts +2 -2
- package/SpeedDialAction/SpeedDialAction.d.ts +3 -3
- package/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
- package/Stack/Stack.d.ts +2 -2
- package/Step/Step.d.ts +2 -2
- package/StepButton/StepButton.d.ts +3 -3
- package/StepConnector/StepConnector.d.ts +2 -2
- package/StepContent/StepContent.d.ts +2 -2
- package/StepIcon/StepIcon.d.ts +3 -3
- package/StepLabel/StepLabel.d.ts +2 -2
- package/Stepper/Stepper.d.ts +2 -2
- package/SvgIcon/SvgIcon.d.ts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
- package/SwipeableDrawer/SwipeableDrawer.js +5 -7
- package/Switch/Switch.d.ts +4 -4
- package/Switch/Switch.js +7 -4
- package/Tab/Tab.d.ts +3 -3
- package/TabScrollButton/TabScrollButton.d.ts +2 -2
- package/Table/Table.d.ts +2 -2
- package/TableBody/TableBody.d.ts +2 -2
- package/TableCell/TableCell.d.ts +2 -2
- package/TableContainer/TableContainer.d.ts +2 -2
- package/TableFooter/TableFooter.d.ts +2 -2
- package/TableHead/TableHead.d.ts +2 -2
- package/TablePagination/TablePagination.d.ts +4 -4
- package/TablePaginationActions/TablePaginationActions.d.ts +2 -2
- package/TableRow/TableRow.d.ts +2 -2
- package/TableSortLabel/TableSortLabel.d.ts +3 -3
- package/Tabs/Tabs.d.ts +2 -2
- package/TextField/TextField.d.ts +10 -10
- package/TextareaAutosize/TextareaAutosize.d.ts +2 -2
- package/TextareaAutosize/TextareaAutosize.js +2 -2
- package/ToggleButton/ToggleButton.d.ts +3 -3
- package/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
- package/Toolbar/Toolbar.d.ts +2 -2
- package/Tooltip/Tooltip.d.ts +2 -2
- package/Typography/Typography.d.ts +4 -3
- package/Unstable_TrapFocus/FocusTrap.js +15 -5
- package/Zoom/Zoom.d.ts +3 -3
- package/Zoom/Zoom.js +24 -30
- package/esm/Accordion/Accordion.d.ts +3 -3
- package/esm/AccordionActions/AccordionActions.d.ts +2 -2
- package/esm/AccordionDetails/AccordionDetails.d.ts +2 -2
- package/esm/AccordionSummary/AccordionSummary.d.ts +3 -3
- package/esm/Alert/Alert.d.ts +3 -3
- package/esm/AlertTitle/AlertTitle.d.ts +3 -3
- package/esm/AppBar/AppBar.d.ts +3 -3
- package/esm/Autocomplete/Autocomplete.d.ts +18 -2
- package/esm/Autocomplete/Autocomplete.js +111 -37
- package/esm/Avatar/Avatar.d.ts +2 -2
- package/esm/AvatarGroup/AvatarGroup.d.ts +2 -2
- package/esm/Backdrop/Backdrop.d.ts +3 -3
- package/esm/Badge/Badge.d.ts +3 -3
- package/esm/BottomNavigation/BottomNavigation.d.ts +2 -2
- package/esm/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
- package/esm/Box/Box.d.ts +3 -2
- package/esm/Breadcrumbs/Breadcrumbs.d.ts +3 -3
- package/esm/Button/Button.d.ts +6 -5
- package/esm/Button/Button.js +18 -1
- package/esm/ButtonBase/ButtonBase.d.ts +2 -2
- package/esm/ButtonBase/ButtonBase.js +8 -2
- package/esm/ButtonGroup/ButtonGroup.d.ts +2 -2
- package/esm/Card/Card.d.ts +3 -3
- package/esm/CardActionArea/CardActionArea.d.ts +3 -3
- package/esm/CardActions/CardActions.d.ts +2 -2
- package/esm/CardContent/CardContent.d.ts +2 -2
- package/esm/CardHeader/CardHeader.d.ts +2 -2
- package/esm/CardHeader/CardHeader.js +5 -1
- package/esm/CardMedia/CardMedia.d.ts +2 -2
- package/esm/Checkbox/Checkbox.d.ts +4 -4
- package/esm/Checkbox/Checkbox.js +2 -1
- package/esm/Chip/Chip.d.ts +2 -2
- package/esm/CircularProgress/CircularProgress.d.ts +2 -2
- package/esm/ClickAwayListener/ClickAwayListener.d.ts +3 -3
- package/esm/ClickAwayListener/ClickAwayListener.js +5 -8
- package/esm/Collapse/Collapse.d.ts +5 -5
- package/esm/Collapse/Collapse.js +7 -19
- package/esm/Container/Container.d.ts +2 -2
- package/esm/CssBaseline/CssBaseline.d.ts +2 -2
- package/esm/Dialog/Dialog.d.ts +10 -3
- package/esm/Dialog/Dialog.js +19 -6
- package/esm/DialogActions/DialogActions.d.ts +2 -2
- package/esm/DialogContent/DialogContent.d.ts +2 -2
- package/esm/DialogContentText/DialogContentText.d.ts +3 -3
- package/esm/DialogTitle/DialogTitle.d.ts +3 -3
- package/esm/Divider/Divider.d.ts +4 -3
- package/esm/Drawer/Drawer.d.ts +3 -3
- package/esm/Drawer/Drawer.js +18 -4
- package/esm/Fab/Fab.d.ts +3 -3
- package/esm/Fab/Fab.js +7 -1
- package/esm/Fade/Fade.d.ts +3 -3
- package/esm/Fade/Fade.js +29 -33
- package/esm/FilledInput/FilledInput.d.ts +3 -3
- package/esm/FilledInput/FilledInput.js +1 -1
- package/esm/FormControl/FormControl.d.ts +7 -7
- package/esm/FormControlLabel/FormControlLabel.d.ts +4 -4
- package/esm/FormGroup/FormGroup.d.ts +3 -3
- package/esm/FormHelperText/FormHelperText.d.ts +3 -3
- package/esm/FormLabel/FormLabel.d.ts +5 -5
- package/esm/GlobalStyles/GlobalStyles.d.ts +2 -2
- package/esm/Grid/Grid.d.ts +2 -2
- package/esm/Grid/Grid.js +2 -2
- package/esm/GridLegacy/GridLegacy.d.ts +2 -2
- package/esm/Grow/Grow.d.ts +5 -5
- package/esm/Grow/Grow.js +31 -39
- package/esm/Icon/Icon.d.ts +3 -3
- package/esm/IconButton/IconButton.d.ts +5 -5
- package/esm/ImageList/ImageList.d.ts +2 -2
- package/esm/ImageListItem/ImageListItem.d.ts +2 -2
- package/esm/ImageListItemBar/ImageListItemBar.d.ts +2 -2
- package/esm/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -2
- package/esm/InitColorSchemeScript/InitColorSchemeScript.js +2 -2
- package/esm/Input/Input.d.ts +3 -3
- package/esm/Input/Input.js +1 -1
- package/esm/InputAdornment/InputAdornment.d.ts +2 -2
- package/esm/InputBase/InputBase.d.ts +2 -2
- package/esm/InputBase/InputBase.js +39 -7
- package/esm/InputLabel/InputLabel.d.ts +4 -4
- package/esm/LinearProgress/LinearProgress.d.ts +2 -2
- package/esm/Link/Link.d.ts +4 -4
- package/esm/List/List.d.ts +4 -3
- package/esm/ListItem/ListItem.d.ts +3 -3
- package/esm/ListItemAvatar/ListItemAvatar.d.ts +2 -2
- package/esm/ListItemButton/ListItemButton.d.ts +4 -3
- package/esm/ListItemButton/ListItemButton.js +7 -1
- package/esm/ListItemIcon/ListItemIcon.d.ts +3 -2
- package/esm/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
- package/esm/ListItemText/ListItemText.d.ts +3 -2
- package/esm/ListItemText/ListItemText.js +5 -1
- package/esm/ListSubheader/ListSubheader.d.ts +3 -2
- package/esm/Menu/Menu.d.ts +4 -4
- package/esm/MenuItem/MenuItem.d.ts +3 -3
- package/esm/MenuItem/MenuItem.js +29 -2
- package/esm/MenuList/MenuList.d.ts +4 -4
- package/esm/MobileStepper/MobileStepper.d.ts +3 -3
- package/esm/Modal/Modal.d.ts +7 -7
- package/esm/NativeSelect/NativeSelect.d.ts +3 -3
- package/esm/NoSsr/NoSsr.d.ts +2 -2
- package/esm/NoSsr/NoSsr.js +2 -2
- package/esm/OutlinedInput/OutlinedInput.d.ts +4 -4
- package/esm/Pagination/Pagination.d.ts +2 -2
- package/esm/PaginationItem/PaginationItem.d.ts +3 -3
- package/esm/Paper/Paper.d.ts +4 -3
- package/esm/PigmentContainer/PigmentContainer.d.ts +2 -2
- package/esm/PigmentContainer/PigmentContainer.js +2 -4
- package/esm/PigmentGrid/PigmentGrid.d.ts +2 -2
- package/esm/PigmentGrid/PigmentGrid.js +2 -4
- package/esm/PigmentStack/PigmentStack.d.ts +2 -2
- package/esm/PigmentStack/PigmentStack.js +2 -4
- package/esm/Popover/Popover.d.ts +4 -4
- package/esm/Popper/BasePopper.js +23 -1
- package/esm/Popper/Popper.d.ts +4 -4
- package/esm/Popper/Popper.js +4 -4
- package/esm/Popper/index.d.ts +1 -0
- package/esm/Popper/index.js +1 -0
- package/esm/Portal/Portal.d.ts +2 -2
- package/esm/Portal/Portal.js +2 -2
- package/esm/Radio/Radio.d.ts +3 -3
- package/esm/RadioGroup/RadioGroup.d.ts +3 -3
- package/esm/Rating/Rating.d.ts +2 -2
- package/esm/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
- package/esm/Select/Select.d.ts +3 -3
- package/esm/Select/SelectInput.js +43 -44
- package/esm/Select/index.d.ts +1 -0
- package/esm/Select/index.js +1 -0
- package/esm/Select/utils/SelectFocusSourceContext.d.ts +4 -0
- package/esm/Select/utils/SelectFocusSourceContext.js +13 -0
- package/esm/Select/utils/areEqualValues.d.ts +1 -0
- package/esm/Select/utils/areEqualValues.js +8 -0
- package/esm/Select/utils/getOpenInteractionType.d.ts +1 -0
- package/esm/Select/utils/getOpenInteractionType.js +12 -0
- package/esm/Select/utils/index.d.ts +4 -0
- package/esm/Select/utils/index.js +4 -0
- package/esm/Select/utils/isEmpty.d.ts +1 -0
- package/esm/Select/utils/isEmpty.js +3 -0
- package/esm/Skeleton/Skeleton.d.ts +2 -2
- package/esm/Slide/Slide.d.ts +4 -4
- package/esm/Slide/Slide.js +44 -44
- package/esm/Slider/Slider.d.ts +7 -7
- package/esm/Slider/useSlider.js +6 -3
- package/esm/Snackbar/Snackbar.d.ts +2 -2
- package/esm/SnackbarContent/SnackbarContent.d.ts +3 -3
- package/esm/SpeedDial/SpeedDial.d.ts +2 -2
- package/esm/SpeedDialAction/SpeedDialAction.d.ts +3 -3
- package/esm/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
- package/esm/Stack/Stack.d.ts +2 -2
- package/esm/Step/Step.d.ts +2 -2
- package/esm/StepButton/StepButton.d.ts +3 -3
- package/esm/StepConnector/StepConnector.d.ts +2 -2
- package/esm/StepContent/StepContent.d.ts +2 -2
- package/esm/StepIcon/StepIcon.d.ts +3 -3
- package/esm/StepLabel/StepLabel.d.ts +2 -2
- package/esm/Stepper/Stepper.d.ts +2 -2
- package/esm/SvgIcon/SvgIcon.d.ts +3 -3
- package/esm/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
- package/esm/SwipeableDrawer/SwipeableDrawer.js +5 -7
- package/esm/Switch/Switch.d.ts +4 -4
- package/esm/Switch/Switch.js +7 -4
- package/esm/Tab/Tab.d.ts +3 -3
- package/esm/TabScrollButton/TabScrollButton.d.ts +2 -2
- package/esm/Table/Table.d.ts +2 -2
- package/esm/TableBody/TableBody.d.ts +2 -2
- package/esm/TableCell/TableCell.d.ts +2 -2
- package/esm/TableContainer/TableContainer.d.ts +2 -2
- package/esm/TableFooter/TableFooter.d.ts +2 -2
- package/esm/TableHead/TableHead.d.ts +2 -2
- package/esm/TablePagination/TablePagination.d.ts +4 -4
- package/esm/TablePaginationActions/TablePaginationActions.d.ts +2 -2
- package/esm/TableRow/TableRow.d.ts +2 -2
- package/esm/TableSortLabel/TableSortLabel.d.ts +3 -3
- package/esm/Tabs/Tabs.d.ts +2 -2
- package/esm/TextField/TextField.d.ts +10 -10
- package/esm/TextareaAutosize/TextareaAutosize.d.ts +2 -2
- package/esm/TextareaAutosize/TextareaAutosize.js +2 -2
- package/esm/ToggleButton/ToggleButton.d.ts +3 -3
- package/esm/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
- package/esm/Toolbar/Toolbar.d.ts +2 -2
- package/esm/Tooltip/Tooltip.d.ts +2 -2
- package/esm/Typography/Typography.d.ts +4 -3
- package/esm/Unstable_TrapFocus/FocusTrap.js +15 -5
- package/esm/Zoom/Zoom.d.ts +3 -3
- package/esm/Zoom/Zoom.js +25 -31
- package/esm/index.js +1 -1
- package/esm/styles/createThemeNoVars.js +1 -1
- package/esm/styles/createThemeWithVars.js +9 -9
- package/esm/transitions/utils.d.ts +7 -0
- package/esm/transitions/utils.js +25 -0
- package/esm/useAutocomplete/useAutocomplete.d.ts +4 -5
- package/esm/useAutocomplete/useAutocomplete.js +211 -47
- package/esm/utils/contains.d.ts +2 -0
- package/esm/utils/contains.js +2 -0
- package/esm/utils/focusable.d.ts +7 -0
- package/esm/utils/focusable.js +13 -0
- package/esm/utils/getEventTarget.d.ts +2 -0
- package/esm/utils/getEventTarget.js +2 -0
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/package.json +5 -5
- package/styles/createThemeNoVars.js +1 -1
- package/styles/createThemeWithVars.js +9 -9
- package/transitions/utils.d.ts +7 -0
- package/transitions/utils.js +27 -0
- package/useAutocomplete/useAutocomplete.d.ts +4 -5
- package/useAutocomplete/useAutocomplete.js +211 -47
- package/utils/contains.d.ts +2 -0
- package/utils/contains.js +9 -0
- package/utils/focusable.d.ts +7 -0
- package/utils/focusable.js +20 -0
- package/utils/getEventTarget.d.ts +2 -0
- package/utils/getEventTarget.js +9 -0
- package/version/index.js +2 -2
|
@@ -329,21 +329,21 @@ export default function createThemeWithVars(options = {}, ...args) {
|
|
|
329
329
|
setColor(palette.TableCell, 'border', colorMix(safeDarken, safeAlpha(nativeColor ? getCssVar('palette-divider') : palette.divider, 1), 0.68));
|
|
330
330
|
setColor(palette.Tooltip, 'bg', colorMix(safeAlpha, nativeColor ? getCssVar('palette-grey-700') : palette.grey[700], 0.92));
|
|
331
331
|
}
|
|
332
|
+
if (!nativeColor) {
|
|
333
|
+
setColorChannel(palette.background, 'default');
|
|
332
334
|
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
setColorChannel(palette.common, 'onBackground');
|
|
340
|
-
setColorChannel(palette, 'divider');
|
|
335
|
+
// added for consistency with the `background.default` token
|
|
336
|
+
setColorChannel(palette.background, 'paper');
|
|
337
|
+
setColorChannel(palette.common, 'background');
|
|
338
|
+
setColorChannel(palette.common, 'onBackground');
|
|
339
|
+
setColorChannel(palette, 'divider');
|
|
340
|
+
}
|
|
341
341
|
Object.keys(palette).forEach(color => {
|
|
342
342
|
const colors = palette[color];
|
|
343
343
|
|
|
344
344
|
// The default palettes (primary, secondary, error, info, success, and warning) errors are handled by the above `createTheme(...)`.
|
|
345
345
|
|
|
346
|
-
if (color !== 'tonalOffset' && colors && typeof colors === 'object') {
|
|
346
|
+
if (color !== 'tonalOffset' && !nativeColor && colors && typeof colors === 'object') {
|
|
347
347
|
// Silent the error for custom palettes.
|
|
348
348
|
if (colors.main) {
|
|
349
349
|
setColor(palette[color], 'mainChannel', safeColorChannel(toRgb(colors.main)));
|
|
@@ -19,5 +19,12 @@ interface TransitionProps {
|
|
|
19
19
|
easing: string | undefined;
|
|
20
20
|
delay: string | undefined;
|
|
21
21
|
}
|
|
22
|
+
export declare function normalizedTransitionCallback(nodeRef: React.RefObject<HTMLElement | null>, callback: ((node: HTMLElement, isAppearing?: boolean) => void) | undefined): (maybeIsAppearing?: boolean) => void;
|
|
23
|
+
type TransitionState = 'entering' | 'entered' | 'exiting' | 'exited';
|
|
24
|
+
/**
|
|
25
|
+
* Computes the child style for a transition component, reusing existing
|
|
26
|
+
* references when possible to preserve referential equality for React.memo.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getTransitionChildStyle(state: TransitionState, inProp: boolean | undefined, baseStyles: Record<string, React.CSSProperties>, hiddenStyles: React.CSSProperties, styleProp: React.CSSProperties | undefined, childStyle: React.CSSProperties | undefined): React.CSSProperties | undefined;
|
|
22
29
|
export declare function getTransitionProps(props: ComponentProps, options: Options): TransitionProps;
|
|
23
30
|
export {};
|
package/esm/transitions/utils.js
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
export const reflow = node => node.scrollTop;
|
|
2
|
+
export function normalizedTransitionCallback(nodeRef, callback) {
|
|
3
|
+
return maybeIsAppearing => {
|
|
4
|
+
if (callback) {
|
|
5
|
+
const node = nodeRef.current;
|
|
6
|
+
// onEnterXxx and onExitXxx callbacks have a different arguments.length value.
|
|
7
|
+
if (maybeIsAppearing === undefined) {
|
|
8
|
+
callback(node);
|
|
9
|
+
} else {
|
|
10
|
+
callback(node, maybeIsAppearing);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Computes the child style for a transition component, reusing existing
|
|
17
|
+
* references when possible to preserve referential equality for React.memo.
|
|
18
|
+
*/
|
|
19
|
+
export function getTransitionChildStyle(state, inProp, baseStyles, hiddenStyles, styleProp, childStyle) {
|
|
20
|
+
const base = state === 'exited' && !inProp ? hiddenStyles : baseStyles[state] || baseStyles.exited;
|
|
21
|
+
return styleProp || childStyle ? {
|
|
22
|
+
...base,
|
|
23
|
+
...styleProp,
|
|
24
|
+
...childStyle
|
|
25
|
+
} : base;
|
|
26
|
+
}
|
|
2
27
|
export function getTransitionProps(props, options) {
|
|
3
28
|
const {
|
|
4
29
|
timeout,
|
|
@@ -46,12 +46,11 @@ export interface UseAutocompleteProps<Value, Multiple extends boolean | undefine
|
|
|
46
46
|
*/
|
|
47
47
|
autoHighlight?: boolean | undefined;
|
|
48
48
|
/**
|
|
49
|
-
* If `true`, the
|
|
50
|
-
* when the Autocomplete loses focus unless the user chooses
|
|
51
|
-
* a different option or changes the character string in the input.
|
|
49
|
+
* If `true`, the value is updated when the input loses focus under one of these conditions:
|
|
52
50
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
51
|
+
* - An option highlighted via keyboard navigation or `autoHighlight` is selected.
|
|
52
|
+
* Hover and touch highlights are ignored.
|
|
53
|
+
* - Otherwise, in `freeSolo` mode, the typed text becomes the value.
|
|
55
54
|
* @default false
|
|
56
55
|
*/
|
|
57
56
|
autoSelect?: boolean | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
+
import contains from '@mui/utils/contains';
|
|
4
5
|
import setRef from '@mui/utils/setRef';
|
|
5
6
|
import useEventCallback from '@mui/utils/useEventCallback';
|
|
6
7
|
import useControlled from '@mui/utils/useControlled';
|
|
@@ -55,7 +56,8 @@ const defaultFilterOptions = createFilterOptions();
|
|
|
55
56
|
|
|
56
57
|
// Number of options to jump in list box when `Page Up` and `Page Down` keys are used.
|
|
57
58
|
const pageSize = 5;
|
|
58
|
-
const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && listboxRef.current.parentElement
|
|
59
|
+
const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && contains(listboxRef.current.parentElement, document.activeElement);
|
|
60
|
+
const defaultIsOptionEqualToValue = (option, value) => option === value;
|
|
59
61
|
const MULTIPLE_DEFAULT_VALUE = [];
|
|
60
62
|
function getInputValue(value, multiple, getOptionLabel, renderValue) {
|
|
61
63
|
if (multiple || value == null || renderValue) {
|
|
@@ -94,7 +96,7 @@ function useAutocomplete(props) {
|
|
|
94
96
|
id: idProp,
|
|
95
97
|
includeInputInList = false,
|
|
96
98
|
inputValue: inputValueProp,
|
|
97
|
-
isOptionEqualToValue =
|
|
99
|
+
isOptionEqualToValue = defaultIsOptionEqualToValue,
|
|
98
100
|
multiple = false,
|
|
99
101
|
onChange,
|
|
100
102
|
onClose,
|
|
@@ -126,11 +128,26 @@ function useAutocomplete(props) {
|
|
|
126
128
|
const firstFocus = React.useRef(true);
|
|
127
129
|
const inputRef = React.useRef(null);
|
|
128
130
|
const listboxRef = React.useRef(null);
|
|
131
|
+
const windowLostFocus = React.useRef(false);
|
|
129
132
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
130
133
|
const [focusedItem, setFocusedItem] = React.useState(-1);
|
|
131
134
|
const defaultHighlighted = autoHighlight ? 0 : -1;
|
|
132
135
|
const highlightedIndexRef = React.useRef(defaultHighlighted);
|
|
133
136
|
|
|
137
|
+
// Tracks how the current highlight was set:
|
|
138
|
+
// - 'keyboard' — arrow keys, Home/End, PageUp/PageDown
|
|
139
|
+
// - 'mouse' — handleOptionMouseMove
|
|
140
|
+
// - 'touch' — handleOptionTouchStart
|
|
141
|
+
// - null — programmatic (autoHighlight, value sync)
|
|
142
|
+
//
|
|
143
|
+
// This lets handleBlur and the Enter handler distinguish intentional
|
|
144
|
+
// interactions from incidental ones — e.g. autoSelect should not commit
|
|
145
|
+
// a highlight that came from a casual mouse hover.
|
|
146
|
+
/** @type {React.RefObject<AutocompleteHighlightChangeReason | null>} */
|
|
147
|
+
const highlightReasonRef = React.useRef(null);
|
|
148
|
+
const touchScrolledRef = React.useRef(false);
|
|
149
|
+
const isTouchRef = React.useRef(false);
|
|
150
|
+
|
|
134
151
|
// Calculate the initial inputValue on mount only.
|
|
135
152
|
// useRef ensures it doesn't update dynamically with defaultValue or value props.
|
|
136
153
|
const initialInputValue = React.useRef(getInputValue(defaultValue ?? valueProp, multiple, getOptionLabel)).current;
|
|
@@ -171,8 +188,30 @@ function useAutocomplete(props) {
|
|
|
171
188
|
const [inputPristine, setInputPristine] = React.useState(true);
|
|
172
189
|
const inputValueIsSelectedValue = !multiple && value != null && inputValue === getOptionLabel(value);
|
|
173
190
|
const popupOpen = open && !readOnly;
|
|
191
|
+
const selectedValues = React.useMemo(() => {
|
|
192
|
+
if (multiple) {
|
|
193
|
+
return value;
|
|
194
|
+
}
|
|
195
|
+
if (value != null) {
|
|
196
|
+
return [value];
|
|
197
|
+
}
|
|
198
|
+
return [];
|
|
199
|
+
}, [multiple, value]);
|
|
200
|
+
const selectedValuesSet = React.useMemo(() => {
|
|
201
|
+
// Fast path for the default strict equality comparator to avoid O(n^2) option checks.
|
|
202
|
+
if (isOptionEqualToValue !== defaultIsOptionEqualToValue || selectedValues.length === 0) {
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
return new Set(selectedValues);
|
|
206
|
+
}, [isOptionEqualToValue, selectedValues]);
|
|
207
|
+
const isOptionSelected = React.useCallback(option => {
|
|
208
|
+
if (selectedValuesSet) {
|
|
209
|
+
return selectedValuesSet.has(option);
|
|
210
|
+
}
|
|
211
|
+
return selectedValues.some(value2 => value2 != null && isOptionEqualToValue(option, value2));
|
|
212
|
+
}, [isOptionEqualToValue, selectedValues, selectedValuesSet]);
|
|
174
213
|
const filteredOptions = popupOpen ? filterOptions(options.filter(option => {
|
|
175
|
-
if (filterSelectedOptions && (
|
|
214
|
+
if (filterSelectedOptions && isOptionSelected(option)) {
|
|
176
215
|
return false;
|
|
177
216
|
}
|
|
178
217
|
return true;
|
|
@@ -248,22 +287,17 @@ function useAutocomplete(props) {
|
|
|
248
287
|
}
|
|
249
288
|
}
|
|
250
289
|
}
|
|
251
|
-
const
|
|
252
|
-
event,
|
|
290
|
+
const syncHighlightedIndexToDOM = useEventCallback(({
|
|
253
291
|
index,
|
|
254
|
-
reason
|
|
292
|
+
reason,
|
|
293
|
+
preserveScroll = false
|
|
255
294
|
}) => {
|
|
256
|
-
highlightedIndexRef.current = index;
|
|
257
|
-
|
|
258
295
|
// does the index exist?
|
|
259
296
|
if (index === -1) {
|
|
260
297
|
inputRef.current.removeAttribute('aria-activedescendant');
|
|
261
298
|
} else {
|
|
262
299
|
inputRef.current.setAttribute('aria-activedescendant', `${id}-option-${index}`);
|
|
263
300
|
}
|
|
264
|
-
if (onHighlightChange && ['mouse', 'keyboard', 'touch'].includes(reason)) {
|
|
265
|
-
onHighlightChange(event, index === -1 ? null : filteredOptions[index], reason);
|
|
266
|
-
}
|
|
267
301
|
if (!listboxRef.current) {
|
|
268
302
|
return;
|
|
269
303
|
}
|
|
@@ -282,7 +316,9 @@ function useAutocomplete(props) {
|
|
|
282
316
|
return;
|
|
283
317
|
}
|
|
284
318
|
if (index === -1) {
|
|
285
|
-
|
|
319
|
+
if (!preserveScroll) {
|
|
320
|
+
listboxNode.scrollTop = 0;
|
|
321
|
+
}
|
|
286
322
|
return;
|
|
287
323
|
}
|
|
288
324
|
const option = listboxRef.current.querySelector(`[data-option-index="${index}"]`);
|
|
@@ -310,15 +346,46 @@ function useAutocomplete(props) {
|
|
|
310
346
|
}
|
|
311
347
|
}
|
|
312
348
|
});
|
|
349
|
+
const setHighlightedIndex = useEventCallback(({
|
|
350
|
+
event,
|
|
351
|
+
index,
|
|
352
|
+
reason,
|
|
353
|
+
preserveScroll = false
|
|
354
|
+
}) => {
|
|
355
|
+
highlightedIndexRef.current = index;
|
|
356
|
+
highlightReasonRef.current = reason ?? null;
|
|
357
|
+
if (onHighlightChange && ['mouse', 'keyboard', 'touch'].includes(reason)) {
|
|
358
|
+
onHighlightChange(event, index === -1 ? null : filteredOptions[index], reason);
|
|
359
|
+
}
|
|
360
|
+
syncHighlightedIndexToDOM({
|
|
361
|
+
index,
|
|
362
|
+
reason,
|
|
363
|
+
preserveScroll
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
const setHighlightedIndexFromSync = useEventCallback(({
|
|
367
|
+
index
|
|
368
|
+
}) => {
|
|
369
|
+
highlightedIndexRef.current = index;
|
|
370
|
+
syncHighlightedIndexToDOM({
|
|
371
|
+
index,
|
|
372
|
+
reason: highlightReasonRef.current
|
|
373
|
+
});
|
|
374
|
+
});
|
|
313
375
|
const changeHighlightedIndex = useEventCallback(({
|
|
314
376
|
event,
|
|
315
377
|
diff,
|
|
316
378
|
direction = 'next',
|
|
317
|
-
reason
|
|
379
|
+
reason,
|
|
380
|
+
preserveScroll
|
|
318
381
|
}) => {
|
|
319
382
|
if (!popupOpen) {
|
|
320
383
|
return;
|
|
321
384
|
}
|
|
385
|
+
if (reason === 'keyboard') {
|
|
386
|
+
touchScrolledRef.current = false;
|
|
387
|
+
isTouchRef.current = false;
|
|
388
|
+
}
|
|
322
389
|
const getNextIndex = () => {
|
|
323
390
|
const maxIndex = filteredOptions.length - 1;
|
|
324
391
|
if (diff === 'reset') {
|
|
@@ -355,7 +422,8 @@ function useAutocomplete(props) {
|
|
|
355
422
|
setHighlightedIndex({
|
|
356
423
|
index: nextIndex,
|
|
357
424
|
reason,
|
|
358
|
-
event
|
|
425
|
+
event,
|
|
426
|
+
preserveScroll
|
|
359
427
|
});
|
|
360
428
|
|
|
361
429
|
// Sync the content of the input with the highlighted option.
|
|
@@ -409,15 +477,24 @@ function useAutocomplete(props) {
|
|
|
409
477
|
// If it exists and the value and the inputValue haven't changed, just update its index, otherwise continue execution
|
|
410
478
|
const previousHighlightedOptionIndex = getPreviousHighlightedOptionIndex();
|
|
411
479
|
if (previousHighlightedOptionIndex !== -1) {
|
|
412
|
-
|
|
480
|
+
// Keep the original highlight reason while re-syncing the DOM state.
|
|
481
|
+
// The highlighted option still exists after the filteredOptions array changed
|
|
482
|
+
// (e.g. async fetch returns new options while the user is mid-navigation),
|
|
483
|
+
// so the original interaction reason (keyboard, mouse, etc.) still applies.
|
|
484
|
+
setHighlightedIndexFromSync({
|
|
485
|
+
index: previousHighlightedOptionIndex
|
|
486
|
+
});
|
|
413
487
|
return;
|
|
414
488
|
}
|
|
415
489
|
const valueItem = multiple ? value[0] : value;
|
|
416
490
|
|
|
417
491
|
// The popup is empty, reset
|
|
418
492
|
if (filteredOptions.length === 0 || valueItem == null) {
|
|
493
|
+
// Preserve scroll when new options are appended without changing the current filter.
|
|
494
|
+
const isAppendOnly = filteredOptionsChanged && previousProps.inputValue === inputValue && previousProps.filteredOptions?.length > 0 && filteredOptions.length > previousProps.filteredOptions.length && previousProps.filteredOptions.every((option, index) => getOptionLabel(option) === getOptionLabel(filteredOptions[index]));
|
|
419
495
|
changeHighlightedIndex({
|
|
420
|
-
diff: 'reset'
|
|
496
|
+
diff: 'reset',
|
|
497
|
+
preserveScroll: isAppendOnly
|
|
421
498
|
});
|
|
422
499
|
return;
|
|
423
500
|
}
|
|
@@ -429,8 +506,12 @@ function useAutocomplete(props) {
|
|
|
429
506
|
if (valueItem != null) {
|
|
430
507
|
const currentOption = filteredOptions[highlightedIndexRef.current];
|
|
431
508
|
|
|
432
|
-
// Keep the current
|
|
433
|
-
|
|
509
|
+
// Keep the current selected highlight while the popup stays open;
|
|
510
|
+
// on reopen, resync from the selected value.
|
|
511
|
+
if (multiple && currentOption && value.findIndex(val => isOptionEqualToValue(currentOption, val)) !== -1 && previousProps.filteredOptions?.length > 0) {
|
|
512
|
+
setHighlightedIndexFromSync({
|
|
513
|
+
index: highlightedIndexRef.current
|
|
514
|
+
});
|
|
434
515
|
return;
|
|
435
516
|
}
|
|
436
517
|
const itemIndex = filteredOptions.findIndex(optionItem => isOptionEqualToValue(optionItem, valueItem));
|
|
@@ -465,7 +546,7 @@ function useAutocomplete(props) {
|
|
|
465
546
|
filteredOptions.length,
|
|
466
547
|
// Don't sync the highlighted index with the value when multiple
|
|
467
548
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
468
|
-
multiple ? false : value, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
|
|
549
|
+
multiple ? false : value, changeHighlightedIndex, setHighlightedIndex, setHighlightedIndexFromSync, popupOpen, inputValue, multiple]);
|
|
469
550
|
const handleListboxRef = useEventCallback(node => {
|
|
470
551
|
setRef(listboxRef, node);
|
|
471
552
|
if (!node) {
|
|
@@ -490,12 +571,28 @@ function useAutocomplete(props) {
|
|
|
490
571
|
syncHighlightedIndex();
|
|
491
572
|
}
|
|
492
573
|
}, [syncHighlightedIndex, filteredOptionsChanged, popupOpen, disableCloseOnSelect]);
|
|
574
|
+
|
|
575
|
+
// Listen for browser window blur to detect when the user switches tabs or windows.
|
|
576
|
+
// This helps prevent the popup from reopening automatically when the window regains focus.
|
|
577
|
+
React.useEffect(() => {
|
|
578
|
+
if (typeof window === 'undefined') {
|
|
579
|
+
return undefined;
|
|
580
|
+
}
|
|
581
|
+
const handleWindowBlur = () => {
|
|
582
|
+
windowLostFocus.current = true;
|
|
583
|
+
};
|
|
584
|
+
window.addEventListener('blur', handleWindowBlur);
|
|
585
|
+
return () => {
|
|
586
|
+
window.removeEventListener('blur', handleWindowBlur);
|
|
587
|
+
};
|
|
588
|
+
}, []);
|
|
493
589
|
const handleOpen = event => {
|
|
494
590
|
if (open) {
|
|
495
591
|
return;
|
|
496
592
|
}
|
|
497
593
|
setOpenState(true);
|
|
498
594
|
setInputPristine(true);
|
|
595
|
+
isTouchRef.current = false;
|
|
499
596
|
if (onOpen) {
|
|
500
597
|
onOpen(event);
|
|
501
598
|
}
|
|
@@ -505,6 +602,8 @@ function useAutocomplete(props) {
|
|
|
505
602
|
return;
|
|
506
603
|
}
|
|
507
604
|
setOpenState(false);
|
|
605
|
+
touchScrolledRef.current = false;
|
|
606
|
+
highlightReasonRef.current = null;
|
|
508
607
|
if (onClose) {
|
|
509
608
|
onClose(event, reason);
|
|
510
609
|
}
|
|
@@ -522,7 +621,6 @@ function useAutocomplete(props) {
|
|
|
522
621
|
}
|
|
523
622
|
setValueState(newValue);
|
|
524
623
|
};
|
|
525
|
-
const isTouch = React.useRef(false);
|
|
526
624
|
const selectNewValue = (event, option, reasonProp = 'selectOption', origin = 'options') => {
|
|
527
625
|
let reason = reasonProp;
|
|
528
626
|
let newValue = option;
|
|
@@ -549,7 +647,7 @@ function useAutocomplete(props) {
|
|
|
549
647
|
if (!disableCloseOnSelect && (!event || !event.ctrlKey && !event.metaKey)) {
|
|
550
648
|
handleClose(event, reason);
|
|
551
649
|
}
|
|
552
|
-
if (blurOnSelect === true || blurOnSelect === 'touch' &&
|
|
650
|
+
if (blurOnSelect === true || blurOnSelect === 'touch' && isTouchRef.current || blurOnSelect === 'mouse' && !isTouchRef.current) {
|
|
553
651
|
inputRef.current.blur();
|
|
554
652
|
}
|
|
555
653
|
};
|
|
@@ -738,29 +836,47 @@ function useAutocomplete(props) {
|
|
|
738
836
|
}
|
|
739
837
|
break;
|
|
740
838
|
case 'Enter':
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
839
|
+
{
|
|
840
|
+
// In freeSolo, only select the highlighted option if the user hasn't
|
|
841
|
+
// typed new text (inputPristine) or explicitly interacted with an option
|
|
842
|
+
// (keyboard, mouse, or touch — any non-null reason). This lets typed
|
|
843
|
+
// text win over a programmatic highlight (reason=null, e.g. from
|
|
844
|
+
// syncHighlightedIndex matching a previous value) while still honoring
|
|
845
|
+
// deliberate user interactions like hovering a suggestion then pressing Enter.
|
|
846
|
+
const shouldSelectHighlighted = !freeSolo || inputPristine || highlightReasonRef.current !== null;
|
|
847
|
+
if (highlightedIndexRef.current !== -1 && popupOpen && shouldSelectHighlighted &&
|
|
848
|
+
// After a touch-scroll the highlight is stale (the user scrolled
|
|
849
|
+
// past it), so skip selection until the next deliberate interaction.
|
|
850
|
+
!touchScrolledRef.current) {
|
|
851
|
+
const option = filteredOptions[highlightedIndexRef.current];
|
|
852
|
+
const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
|
|
744
853
|
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
854
|
+
// Avoid early form validation, let the end-users continue filling the form.
|
|
855
|
+
event.preventDefault();
|
|
856
|
+
if (disabled) {
|
|
857
|
+
return;
|
|
858
|
+
}
|
|
859
|
+
selectNewValue(event, option, 'selectOption');
|
|
751
860
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
861
|
+
// Move the selection to the end.
|
|
862
|
+
if (autoComplete) {
|
|
863
|
+
inputRef.current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
|
|
864
|
+
}
|
|
865
|
+
} else if (freeSolo && inputValue !== '' && inputValueIsSelectedValue === false) {
|
|
866
|
+
if (multiple) {
|
|
867
|
+
// Allow people to add new values before they submit the form.
|
|
868
|
+
event.preventDefault();
|
|
869
|
+
}
|
|
870
|
+
selectNewValue(event, inputValue, 'createOption', 'freeSolo');
|
|
871
|
+
} else if (popupOpen && touchScrolledRef.current) {
|
|
872
|
+
// The highlight is stale from a touch-scroll - close without selecting.
|
|
759
873
|
event.preventDefault();
|
|
874
|
+
// This happens on Enter, but re-using "escape" as the closest `AutocompleteCloseReason`
|
|
875
|
+
// to avoid creating a new reason
|
|
876
|
+
handleClose(event, 'escape');
|
|
760
877
|
}
|
|
761
|
-
|
|
878
|
+
break;
|
|
762
879
|
}
|
|
763
|
-
break;
|
|
764
880
|
case 'Escape':
|
|
765
881
|
if (popupOpen) {
|
|
766
882
|
// Avoid Opera to exit fullscreen mode.
|
|
@@ -825,6 +941,14 @@ function useAutocomplete(props) {
|
|
|
825
941
|
// Ensure DOM focus lands on the input
|
|
826
942
|
focusItem(-1);
|
|
827
943
|
}
|
|
944
|
+
|
|
945
|
+
// If the window previously lost focus while the popup was open,
|
|
946
|
+
// ignore this focus event to prevent unintended reopening.
|
|
947
|
+
// Reset the flag so normal focus behavior resumes.
|
|
948
|
+
if (windowLostFocus.current) {
|
|
949
|
+
windowLostFocus.current = false;
|
|
950
|
+
return;
|
|
951
|
+
}
|
|
828
952
|
if (openOnFocus && !ignoreFocus.current) {
|
|
829
953
|
handleOpen(event);
|
|
830
954
|
}
|
|
@@ -838,7 +962,12 @@ function useAutocomplete(props) {
|
|
|
838
962
|
setFocused(false);
|
|
839
963
|
firstFocus.current = true;
|
|
840
964
|
ignoreFocus.current = false;
|
|
841
|
-
|
|
965
|
+
|
|
966
|
+
// Auto-select the highlighted option on blur, but only if the highlight
|
|
967
|
+
// came from keyboard navigation or was set programmatically (autoHighlight).
|
|
968
|
+
// Mouse hover and touch should not trigger selection — the user may have
|
|
969
|
+
// moved the pointer over an option without intending to commit to it.
|
|
970
|
+
if (autoSelect && highlightedIndexRef.current !== -1 && popupOpen && highlightReasonRef.current !== 'mouse' && highlightReasonRef.current !== 'touch') {
|
|
842
971
|
selectNewValue(event, filteredOptions[highlightedIndexRef.current], 'blur');
|
|
843
972
|
} else if (autoSelect && freeSolo && inputValue !== '') {
|
|
844
973
|
selectNewValue(event, inputValue, 'blur', 'freeSolo');
|
|
@@ -849,9 +978,10 @@ function useAutocomplete(props) {
|
|
|
849
978
|
};
|
|
850
979
|
const handleInputChange = event => {
|
|
851
980
|
const newValue = event.target.value;
|
|
852
|
-
|
|
981
|
+
const valueChanged = inputValue !== newValue;
|
|
982
|
+
if (valueChanged) {
|
|
853
983
|
setInputValueState(newValue);
|
|
854
|
-
|
|
984
|
+
touchScrolledRef.current = false;
|
|
855
985
|
if (onInputChange) {
|
|
856
986
|
onInputChange(event, newValue, 'input');
|
|
857
987
|
}
|
|
@@ -865,6 +995,12 @@ function useAutocomplete(props) {
|
|
|
865
995
|
} else {
|
|
866
996
|
handleOpen(event);
|
|
867
997
|
}
|
|
998
|
+
|
|
999
|
+
// Called after handleOpen so it overrides handleOpen's setInputPristine(true)
|
|
1000
|
+
// when the first keystroke also opens the popup.
|
|
1001
|
+
if (valueChanged) {
|
|
1002
|
+
setInputPristine(false);
|
|
1003
|
+
}
|
|
868
1004
|
};
|
|
869
1005
|
const handleOptionMouseMove = event => {
|
|
870
1006
|
const index = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
@@ -874,20 +1010,35 @@ function useAutocomplete(props) {
|
|
|
874
1010
|
index,
|
|
875
1011
|
reason: 'mouse'
|
|
876
1012
|
});
|
|
1013
|
+
} else {
|
|
1014
|
+
// The option is already highlighted (e.g. programmatically via autoHighlight),
|
|
1015
|
+
// but the user moved the mouse over it — mark as mouse-initiated so
|
|
1016
|
+
// autoSelect on blur correctly treats this as incidental hover.
|
|
1017
|
+
highlightReasonRef.current = 'mouse';
|
|
1018
|
+
}
|
|
1019
|
+
// Don't clear the touch-scroll guard while touch state is still latched.
|
|
1020
|
+
// After a touch gesture, browsers may fire compatibility mousemove
|
|
1021
|
+
// events; if those cleared the guard immediately, later compat events in
|
|
1022
|
+
// the same sequence could be misclassified as a real mouse interaction.
|
|
1023
|
+
// Touch state is cleared by the next deliberate interaction
|
|
1024
|
+
// (keyboard nav, handleOptionClick, or handleOpen).
|
|
1025
|
+
if (!isTouchRef.current) {
|
|
1026
|
+
touchScrolledRef.current = false;
|
|
877
1027
|
}
|
|
878
1028
|
};
|
|
879
1029
|
const handleOptionTouchStart = event => {
|
|
1030
|
+
touchScrolledRef.current = false;
|
|
880
1031
|
setHighlightedIndex({
|
|
881
1032
|
event,
|
|
882
1033
|
index: Number(event.currentTarget.getAttribute('data-option-index')),
|
|
883
1034
|
reason: 'touch'
|
|
884
1035
|
});
|
|
885
|
-
|
|
1036
|
+
isTouchRef.current = true;
|
|
886
1037
|
};
|
|
887
1038
|
const handleOptionClick = event => {
|
|
888
1039
|
const index = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
889
1040
|
selectNewValue(event, filteredOptions[index], 'selectOption');
|
|
890
|
-
|
|
1041
|
+
isTouchRef.current = false;
|
|
891
1042
|
};
|
|
892
1043
|
const handleItemDelete = index => event => {
|
|
893
1044
|
const newValue = value.slice();
|
|
@@ -912,7 +1063,11 @@ function useAutocomplete(props) {
|
|
|
912
1063
|
// Prevent input blur when interacting with the combobox
|
|
913
1064
|
const handleMouseDown = event => {
|
|
914
1065
|
// Prevent focusing the input if click is anywhere outside the Autocomplete
|
|
915
|
-
if (!event.currentTarget
|
|
1066
|
+
if (!contains(event.currentTarget, event.target)) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
// Don't interfere with interactions outside the input area (e.g. helper text)
|
|
1070
|
+
if (anchorEl && !contains(anchorEl, event.target)) {
|
|
916
1071
|
return;
|
|
917
1072
|
}
|
|
918
1073
|
if (event.target.getAttribute('id') !== id) {
|
|
@@ -923,7 +1078,11 @@ function useAutocomplete(props) {
|
|
|
923
1078
|
// Focus the input when interacting with the combobox
|
|
924
1079
|
const handleClick = event => {
|
|
925
1080
|
// Prevent focusing the input if click is anywhere outside the Autocomplete
|
|
926
|
-
if (!event.currentTarget
|
|
1081
|
+
if (!contains(event.currentTarget, event.target)) {
|
|
1082
|
+
return;
|
|
1083
|
+
}
|
|
1084
|
+
// Don't interfere with interactions outside the input area (e.g. helper text)
|
|
1085
|
+
if (anchorEl && !contains(anchorEl, event.target)) {
|
|
927
1086
|
return;
|
|
928
1087
|
}
|
|
929
1088
|
inputRef.current.focus();
|
|
@@ -1048,13 +1207,18 @@ function useAutocomplete(props) {
|
|
|
1048
1207
|
onMouseDown: event => {
|
|
1049
1208
|
// Prevent blur
|
|
1050
1209
|
event.preventDefault();
|
|
1210
|
+
},
|
|
1211
|
+
onScroll: () => {
|
|
1212
|
+
if (isTouchRef.current) {
|
|
1213
|
+
touchScrolledRef.current = true;
|
|
1214
|
+
}
|
|
1051
1215
|
}
|
|
1052
1216
|
}),
|
|
1053
1217
|
getOptionProps: ({
|
|
1054
1218
|
index,
|
|
1055
1219
|
option
|
|
1056
1220
|
}) => {
|
|
1057
|
-
const selected = (
|
|
1221
|
+
const selected = isOptionSelected(option);
|
|
1058
1222
|
const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
|
|
1059
1223
|
return {
|
|
1060
1224
|
key: getOptionKey?.(option) ?? getOptionLabel(option),
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const FOCUSABLE_ATTRIBUTE = "data-mui-focusable";
|
|
2
|
+
/**
|
|
3
|
+
* Returns the element marked as the initial focus target inside a focus trap.
|
|
4
|
+
* The root element takes precedence over marked descendants so components can
|
|
5
|
+
* opt into focusing their own root surface directly.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getFocusTarget(rootElement: HTMLElement | null | undefined): HTMLElement | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const FOCUSABLE_ATTRIBUTE = 'data-mui-focusable';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the element marked as the initial focus target inside a focus trap.
|
|
5
|
+
* The root element takes precedence over marked descendants so components can
|
|
6
|
+
* opt into focusing their own root surface directly.
|
|
7
|
+
*/
|
|
8
|
+
export function getFocusTarget(rootElement) {
|
|
9
|
+
if (!rootElement) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return rootElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? rootElement : rootElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`);
|
|
13
|
+
}
|
package/esm/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "7.3.
|
|
1
|
+
export const version = "7.3.11";
|
|
2
2
|
export const major = Number("7");
|
|
3
3
|
export const minor = Number("3");
|
|
4
|
-
export const patch = Number("
|
|
4
|
+
export const patch = Number("11");
|
|
5
5
|
export const prerelease = undefined;
|
|
6
6
|
export default version;
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.11",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
|
|
6
6
|
"keywords": [
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
34
|
"react-is": "^19.2.3",
|
|
35
35
|
"react-transition-group": "^4.4.5",
|
|
36
|
-
"@mui/core-downloads-tracker": "^7.3.
|
|
37
|
-
"@mui/
|
|
36
|
+
"@mui/core-downloads-tracker": "^7.3.11",
|
|
37
|
+
"@mui/utils": "^7.3.11",
|
|
38
38
|
"@mui/types": "^7.4.12",
|
|
39
|
-
"@mui/
|
|
39
|
+
"@mui/system": "^7.3.11"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@emotion/react": "^11.5.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
45
45
|
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
47
|
-
"@mui/material-pigment-css": "^7.3.
|
|
47
|
+
"@mui/material-pigment-css": "^7.3.11"
|
|
48
48
|
},
|
|
49
49
|
"peerDependenciesMeta": {
|
|
50
50
|
"@types/react": {
|