@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
|
@@ -89,7 +89,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
89
89
|
options.generateThemeVars === undefined) {
|
|
90
90
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
|
|
91
91
|
// #host-reference
|
|
92
|
-
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : (0, _formatMuiErrorMessage.default)(20));
|
|
92
|
+
'Please use another name or follow the [docs](https://v7.mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : (0, _formatMuiErrorMessage.default)(20));
|
|
93
93
|
}
|
|
94
94
|
const palette = (0, _createPalette.default)({
|
|
95
95
|
...paletteInput,
|
|
@@ -339,21 +339,21 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
339
339
|
setColor(palette.TableCell, 'border', colorMix(_colorManipulator.private_safeDarken, (0, _colorManipulator.private_safeAlpha)(nativeColor ? getCssVar('palette-divider') : palette.divider, 1), 0.68));
|
|
340
340
|
setColor(palette.Tooltip, 'bg', colorMix(_colorManipulator.private_safeAlpha, nativeColor ? getCssVar('palette-grey-700') : palette.grey[700], 0.92));
|
|
341
341
|
}
|
|
342
|
+
if (!nativeColor) {
|
|
343
|
+
setColorChannel(palette.background, 'default');
|
|
342
344
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
setColorChannel(palette.common, 'onBackground');
|
|
350
|
-
setColorChannel(palette, 'divider');
|
|
345
|
+
// added for consistency with the `background.default` token
|
|
346
|
+
setColorChannel(palette.background, 'paper');
|
|
347
|
+
setColorChannel(palette.common, 'background');
|
|
348
|
+
setColorChannel(palette.common, 'onBackground');
|
|
349
|
+
setColorChannel(palette, 'divider');
|
|
350
|
+
}
|
|
351
351
|
Object.keys(palette).forEach(color => {
|
|
352
352
|
const colors = palette[color];
|
|
353
353
|
|
|
354
354
|
// The default palettes (primary, secondary, error, info, success, and warning) errors are handled by the above `createTheme(...)`.
|
|
355
355
|
|
|
356
|
-
if (color !== 'tonalOffset' && colors && typeof colors === 'object') {
|
|
356
|
+
if (color !== 'tonalOffset' && !nativeColor && colors && typeof colors === 'object') {
|
|
357
357
|
// Silent the error for custom palettes.
|
|
358
358
|
if (colors.main) {
|
|
359
359
|
setColor(palette[color], 'mainChannel', (0, _colorManipulator.private_safeColorChannel)(toRgb(colors.main)));
|
package/transitions/utils.d.ts
CHANGED
|
@@ -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/transitions/utils.js
CHANGED
|
@@ -3,10 +3,37 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getTransitionChildStyle = getTransitionChildStyle;
|
|
6
7
|
exports.getTransitionProps = getTransitionProps;
|
|
8
|
+
exports.normalizedTransitionCallback = normalizedTransitionCallback;
|
|
7
9
|
exports.reflow = void 0;
|
|
8
10
|
const reflow = node => node.scrollTop;
|
|
9
11
|
exports.reflow = reflow;
|
|
12
|
+
function normalizedTransitionCallback(nodeRef, callback) {
|
|
13
|
+
return maybeIsAppearing => {
|
|
14
|
+
if (callback) {
|
|
15
|
+
const node = nodeRef.current;
|
|
16
|
+
// onEnterXxx and onExitXxx callbacks have a different arguments.length value.
|
|
17
|
+
if (maybeIsAppearing === undefined) {
|
|
18
|
+
callback(node);
|
|
19
|
+
} else {
|
|
20
|
+
callback(node, maybeIsAppearing);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Computes the child style for a transition component, reusing existing
|
|
27
|
+
* references when possible to preserve referential equality for React.memo.
|
|
28
|
+
*/
|
|
29
|
+
function getTransitionChildStyle(state, inProp, baseStyles, hiddenStyles, styleProp, childStyle) {
|
|
30
|
+
const base = state === 'exited' && !inProp ? hiddenStyles : baseStyles[state] || baseStyles.exited;
|
|
31
|
+
return styleProp || childStyle ? {
|
|
32
|
+
...base,
|
|
33
|
+
...styleProp,
|
|
34
|
+
...childStyle
|
|
35
|
+
} : base;
|
|
36
|
+
}
|
|
10
37
|
function getTransitionProps(props, options) {
|
|
11
38
|
const {
|
|
12
39
|
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;
|
|
@@ -9,6 +9,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
exports.createFilterOptions = createFilterOptions;
|
|
10
10
|
exports.default = void 0;
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _contains = _interopRequireDefault(require("@mui/utils/contains"));
|
|
12
13
|
var _setRef = _interopRequireDefault(require("@mui/utils/setRef"));
|
|
13
14
|
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
14
15
|
var _useControlled = _interopRequireDefault(require("@mui/utils/useControlled"));
|
|
@@ -63,7 +64,8 @@ const defaultFilterOptions = createFilterOptions();
|
|
|
63
64
|
|
|
64
65
|
// Number of options to jump in list box when `Page Up` and `Page Down` keys are used.
|
|
65
66
|
const pageSize = 5;
|
|
66
|
-
const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && listboxRef.current.parentElement
|
|
67
|
+
const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && (0, _contains.default)(listboxRef.current.parentElement, document.activeElement);
|
|
68
|
+
const defaultIsOptionEqualToValue = (option, value) => option === value;
|
|
67
69
|
const MULTIPLE_DEFAULT_VALUE = [];
|
|
68
70
|
function getInputValue(value, multiple, getOptionLabel, renderValue) {
|
|
69
71
|
if (multiple || value == null || renderValue) {
|
|
@@ -102,7 +104,7 @@ function useAutocomplete(props) {
|
|
|
102
104
|
id: idProp,
|
|
103
105
|
includeInputInList = false,
|
|
104
106
|
inputValue: inputValueProp,
|
|
105
|
-
isOptionEqualToValue =
|
|
107
|
+
isOptionEqualToValue = defaultIsOptionEqualToValue,
|
|
106
108
|
multiple = false,
|
|
107
109
|
onChange,
|
|
108
110
|
onClose,
|
|
@@ -134,11 +136,26 @@ function useAutocomplete(props) {
|
|
|
134
136
|
const firstFocus = React.useRef(true);
|
|
135
137
|
const inputRef = React.useRef(null);
|
|
136
138
|
const listboxRef = React.useRef(null);
|
|
139
|
+
const windowLostFocus = React.useRef(false);
|
|
137
140
|
const [anchorEl, setAnchorEl] = React.useState(null);
|
|
138
141
|
const [focusedItem, setFocusedItem] = React.useState(-1);
|
|
139
142
|
const defaultHighlighted = autoHighlight ? 0 : -1;
|
|
140
143
|
const highlightedIndexRef = React.useRef(defaultHighlighted);
|
|
141
144
|
|
|
145
|
+
// Tracks how the current highlight was set:
|
|
146
|
+
// - 'keyboard' — arrow keys, Home/End, PageUp/PageDown
|
|
147
|
+
// - 'mouse' — handleOptionMouseMove
|
|
148
|
+
// - 'touch' — handleOptionTouchStart
|
|
149
|
+
// - null — programmatic (autoHighlight, value sync)
|
|
150
|
+
//
|
|
151
|
+
// This lets handleBlur and the Enter handler distinguish intentional
|
|
152
|
+
// interactions from incidental ones — e.g. autoSelect should not commit
|
|
153
|
+
// a highlight that came from a casual mouse hover.
|
|
154
|
+
/** @type {React.RefObject<AutocompleteHighlightChangeReason | null>} */
|
|
155
|
+
const highlightReasonRef = React.useRef(null);
|
|
156
|
+
const touchScrolledRef = React.useRef(false);
|
|
157
|
+
const isTouchRef = React.useRef(false);
|
|
158
|
+
|
|
142
159
|
// Calculate the initial inputValue on mount only.
|
|
143
160
|
// useRef ensures it doesn't update dynamically with defaultValue or value props.
|
|
144
161
|
const initialInputValue = React.useRef(getInputValue(defaultValue ?? valueProp, multiple, getOptionLabel)).current;
|
|
@@ -179,8 +196,30 @@ function useAutocomplete(props) {
|
|
|
179
196
|
const [inputPristine, setInputPristine] = React.useState(true);
|
|
180
197
|
const inputValueIsSelectedValue = !multiple && value != null && inputValue === getOptionLabel(value);
|
|
181
198
|
const popupOpen = open && !readOnly;
|
|
199
|
+
const selectedValues = React.useMemo(() => {
|
|
200
|
+
if (multiple) {
|
|
201
|
+
return value;
|
|
202
|
+
}
|
|
203
|
+
if (value != null) {
|
|
204
|
+
return [value];
|
|
205
|
+
}
|
|
206
|
+
return [];
|
|
207
|
+
}, [multiple, value]);
|
|
208
|
+
const selectedValuesSet = React.useMemo(() => {
|
|
209
|
+
// Fast path for the default strict equality comparator to avoid O(n^2) option checks.
|
|
210
|
+
if (isOptionEqualToValue !== defaultIsOptionEqualToValue || selectedValues.length === 0) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
return new Set(selectedValues);
|
|
214
|
+
}, [isOptionEqualToValue, selectedValues]);
|
|
215
|
+
const isOptionSelected = React.useCallback(option => {
|
|
216
|
+
if (selectedValuesSet) {
|
|
217
|
+
return selectedValuesSet.has(option);
|
|
218
|
+
}
|
|
219
|
+
return selectedValues.some(value2 => value2 != null && isOptionEqualToValue(option, value2));
|
|
220
|
+
}, [isOptionEqualToValue, selectedValues, selectedValuesSet]);
|
|
182
221
|
const filteredOptions = popupOpen ? filterOptions(options.filter(option => {
|
|
183
|
-
if (filterSelectedOptions && (
|
|
222
|
+
if (filterSelectedOptions && isOptionSelected(option)) {
|
|
184
223
|
return false;
|
|
185
224
|
}
|
|
186
225
|
return true;
|
|
@@ -256,22 +295,17 @@ function useAutocomplete(props) {
|
|
|
256
295
|
}
|
|
257
296
|
}
|
|
258
297
|
}
|
|
259
|
-
const
|
|
260
|
-
event,
|
|
298
|
+
const syncHighlightedIndexToDOM = (0, _useEventCallback.default)(({
|
|
261
299
|
index,
|
|
262
|
-
reason
|
|
300
|
+
reason,
|
|
301
|
+
preserveScroll = false
|
|
263
302
|
}) => {
|
|
264
|
-
highlightedIndexRef.current = index;
|
|
265
|
-
|
|
266
303
|
// does the index exist?
|
|
267
304
|
if (index === -1) {
|
|
268
305
|
inputRef.current.removeAttribute('aria-activedescendant');
|
|
269
306
|
} else {
|
|
270
307
|
inputRef.current.setAttribute('aria-activedescendant', `${id}-option-${index}`);
|
|
271
308
|
}
|
|
272
|
-
if (onHighlightChange && ['mouse', 'keyboard', 'touch'].includes(reason)) {
|
|
273
|
-
onHighlightChange(event, index === -1 ? null : filteredOptions[index], reason);
|
|
274
|
-
}
|
|
275
309
|
if (!listboxRef.current) {
|
|
276
310
|
return;
|
|
277
311
|
}
|
|
@@ -290,7 +324,9 @@ function useAutocomplete(props) {
|
|
|
290
324
|
return;
|
|
291
325
|
}
|
|
292
326
|
if (index === -1) {
|
|
293
|
-
|
|
327
|
+
if (!preserveScroll) {
|
|
328
|
+
listboxNode.scrollTop = 0;
|
|
329
|
+
}
|
|
294
330
|
return;
|
|
295
331
|
}
|
|
296
332
|
const option = listboxRef.current.querySelector(`[data-option-index="${index}"]`);
|
|
@@ -318,15 +354,46 @@ function useAutocomplete(props) {
|
|
|
318
354
|
}
|
|
319
355
|
}
|
|
320
356
|
});
|
|
357
|
+
const setHighlightedIndex = (0, _useEventCallback.default)(({
|
|
358
|
+
event,
|
|
359
|
+
index,
|
|
360
|
+
reason,
|
|
361
|
+
preserveScroll = false
|
|
362
|
+
}) => {
|
|
363
|
+
highlightedIndexRef.current = index;
|
|
364
|
+
highlightReasonRef.current = reason ?? null;
|
|
365
|
+
if (onHighlightChange && ['mouse', 'keyboard', 'touch'].includes(reason)) {
|
|
366
|
+
onHighlightChange(event, index === -1 ? null : filteredOptions[index], reason);
|
|
367
|
+
}
|
|
368
|
+
syncHighlightedIndexToDOM({
|
|
369
|
+
index,
|
|
370
|
+
reason,
|
|
371
|
+
preserveScroll
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
const setHighlightedIndexFromSync = (0, _useEventCallback.default)(({
|
|
375
|
+
index
|
|
376
|
+
}) => {
|
|
377
|
+
highlightedIndexRef.current = index;
|
|
378
|
+
syncHighlightedIndexToDOM({
|
|
379
|
+
index,
|
|
380
|
+
reason: highlightReasonRef.current
|
|
381
|
+
});
|
|
382
|
+
});
|
|
321
383
|
const changeHighlightedIndex = (0, _useEventCallback.default)(({
|
|
322
384
|
event,
|
|
323
385
|
diff,
|
|
324
386
|
direction = 'next',
|
|
325
|
-
reason
|
|
387
|
+
reason,
|
|
388
|
+
preserveScroll
|
|
326
389
|
}) => {
|
|
327
390
|
if (!popupOpen) {
|
|
328
391
|
return;
|
|
329
392
|
}
|
|
393
|
+
if (reason === 'keyboard') {
|
|
394
|
+
touchScrolledRef.current = false;
|
|
395
|
+
isTouchRef.current = false;
|
|
396
|
+
}
|
|
330
397
|
const getNextIndex = () => {
|
|
331
398
|
const maxIndex = filteredOptions.length - 1;
|
|
332
399
|
if (diff === 'reset') {
|
|
@@ -363,7 +430,8 @@ function useAutocomplete(props) {
|
|
|
363
430
|
setHighlightedIndex({
|
|
364
431
|
index: nextIndex,
|
|
365
432
|
reason,
|
|
366
|
-
event
|
|
433
|
+
event,
|
|
434
|
+
preserveScroll
|
|
367
435
|
});
|
|
368
436
|
|
|
369
437
|
// Sync the content of the input with the highlighted option.
|
|
@@ -417,15 +485,24 @@ function useAutocomplete(props) {
|
|
|
417
485
|
// If it exists and the value and the inputValue haven't changed, just update its index, otherwise continue execution
|
|
418
486
|
const previousHighlightedOptionIndex = getPreviousHighlightedOptionIndex();
|
|
419
487
|
if (previousHighlightedOptionIndex !== -1) {
|
|
420
|
-
|
|
488
|
+
// Keep the original highlight reason while re-syncing the DOM state.
|
|
489
|
+
// The highlighted option still exists after the filteredOptions array changed
|
|
490
|
+
// (e.g. async fetch returns new options while the user is mid-navigation),
|
|
491
|
+
// so the original interaction reason (keyboard, mouse, etc.) still applies.
|
|
492
|
+
setHighlightedIndexFromSync({
|
|
493
|
+
index: previousHighlightedOptionIndex
|
|
494
|
+
});
|
|
421
495
|
return;
|
|
422
496
|
}
|
|
423
497
|
const valueItem = multiple ? value[0] : value;
|
|
424
498
|
|
|
425
499
|
// The popup is empty, reset
|
|
426
500
|
if (filteredOptions.length === 0 || valueItem == null) {
|
|
501
|
+
// Preserve scroll when new options are appended without changing the current filter.
|
|
502
|
+
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]));
|
|
427
503
|
changeHighlightedIndex({
|
|
428
|
-
diff: 'reset'
|
|
504
|
+
diff: 'reset',
|
|
505
|
+
preserveScroll: isAppendOnly
|
|
429
506
|
});
|
|
430
507
|
return;
|
|
431
508
|
}
|
|
@@ -437,8 +514,12 @@ function useAutocomplete(props) {
|
|
|
437
514
|
if (valueItem != null) {
|
|
438
515
|
const currentOption = filteredOptions[highlightedIndexRef.current];
|
|
439
516
|
|
|
440
|
-
// Keep the current
|
|
441
|
-
|
|
517
|
+
// Keep the current selected highlight while the popup stays open;
|
|
518
|
+
// on reopen, resync from the selected value.
|
|
519
|
+
if (multiple && currentOption && value.findIndex(val => isOptionEqualToValue(currentOption, val)) !== -1 && previousProps.filteredOptions?.length > 0) {
|
|
520
|
+
setHighlightedIndexFromSync({
|
|
521
|
+
index: highlightedIndexRef.current
|
|
522
|
+
});
|
|
442
523
|
return;
|
|
443
524
|
}
|
|
444
525
|
const itemIndex = filteredOptions.findIndex(optionItem => isOptionEqualToValue(optionItem, valueItem));
|
|
@@ -473,7 +554,7 @@ function useAutocomplete(props) {
|
|
|
473
554
|
filteredOptions.length,
|
|
474
555
|
// Don't sync the highlighted index with the value when multiple
|
|
475
556
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
476
|
-
multiple ? false : value, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
|
|
557
|
+
multiple ? false : value, changeHighlightedIndex, setHighlightedIndex, setHighlightedIndexFromSync, popupOpen, inputValue, multiple]);
|
|
477
558
|
const handleListboxRef = (0, _useEventCallback.default)(node => {
|
|
478
559
|
(0, _setRef.default)(listboxRef, node);
|
|
479
560
|
if (!node) {
|
|
@@ -498,12 +579,28 @@ function useAutocomplete(props) {
|
|
|
498
579
|
syncHighlightedIndex();
|
|
499
580
|
}
|
|
500
581
|
}, [syncHighlightedIndex, filteredOptionsChanged, popupOpen, disableCloseOnSelect]);
|
|
582
|
+
|
|
583
|
+
// Listen for browser window blur to detect when the user switches tabs or windows.
|
|
584
|
+
// This helps prevent the popup from reopening automatically when the window regains focus.
|
|
585
|
+
React.useEffect(() => {
|
|
586
|
+
if (typeof window === 'undefined') {
|
|
587
|
+
return undefined;
|
|
588
|
+
}
|
|
589
|
+
const handleWindowBlur = () => {
|
|
590
|
+
windowLostFocus.current = true;
|
|
591
|
+
};
|
|
592
|
+
window.addEventListener('blur', handleWindowBlur);
|
|
593
|
+
return () => {
|
|
594
|
+
window.removeEventListener('blur', handleWindowBlur);
|
|
595
|
+
};
|
|
596
|
+
}, []);
|
|
501
597
|
const handleOpen = event => {
|
|
502
598
|
if (open) {
|
|
503
599
|
return;
|
|
504
600
|
}
|
|
505
601
|
setOpenState(true);
|
|
506
602
|
setInputPristine(true);
|
|
603
|
+
isTouchRef.current = false;
|
|
507
604
|
if (onOpen) {
|
|
508
605
|
onOpen(event);
|
|
509
606
|
}
|
|
@@ -513,6 +610,8 @@ function useAutocomplete(props) {
|
|
|
513
610
|
return;
|
|
514
611
|
}
|
|
515
612
|
setOpenState(false);
|
|
613
|
+
touchScrolledRef.current = false;
|
|
614
|
+
highlightReasonRef.current = null;
|
|
516
615
|
if (onClose) {
|
|
517
616
|
onClose(event, reason);
|
|
518
617
|
}
|
|
@@ -530,7 +629,6 @@ function useAutocomplete(props) {
|
|
|
530
629
|
}
|
|
531
630
|
setValueState(newValue);
|
|
532
631
|
};
|
|
533
|
-
const isTouch = React.useRef(false);
|
|
534
632
|
const selectNewValue = (event, option, reasonProp = 'selectOption', origin = 'options') => {
|
|
535
633
|
let reason = reasonProp;
|
|
536
634
|
let newValue = option;
|
|
@@ -557,7 +655,7 @@ function useAutocomplete(props) {
|
|
|
557
655
|
if (!disableCloseOnSelect && (!event || !event.ctrlKey && !event.metaKey)) {
|
|
558
656
|
handleClose(event, reason);
|
|
559
657
|
}
|
|
560
|
-
if (blurOnSelect === true || blurOnSelect === 'touch' &&
|
|
658
|
+
if (blurOnSelect === true || blurOnSelect === 'touch' && isTouchRef.current || blurOnSelect === 'mouse' && !isTouchRef.current) {
|
|
561
659
|
inputRef.current.blur();
|
|
562
660
|
}
|
|
563
661
|
};
|
|
@@ -746,29 +844,47 @@ function useAutocomplete(props) {
|
|
|
746
844
|
}
|
|
747
845
|
break;
|
|
748
846
|
case 'Enter':
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
847
|
+
{
|
|
848
|
+
// In freeSolo, only select the highlighted option if the user hasn't
|
|
849
|
+
// typed new text (inputPristine) or explicitly interacted with an option
|
|
850
|
+
// (keyboard, mouse, or touch — any non-null reason). This lets typed
|
|
851
|
+
// text win over a programmatic highlight (reason=null, e.g. from
|
|
852
|
+
// syncHighlightedIndex matching a previous value) while still honoring
|
|
853
|
+
// deliberate user interactions like hovering a suggestion then pressing Enter.
|
|
854
|
+
const shouldSelectHighlighted = !freeSolo || inputPristine || highlightReasonRef.current !== null;
|
|
855
|
+
if (highlightedIndexRef.current !== -1 && popupOpen && shouldSelectHighlighted &&
|
|
856
|
+
// After a touch-scroll the highlight is stale (the user scrolled
|
|
857
|
+
// past it), so skip selection until the next deliberate interaction.
|
|
858
|
+
!touchScrolledRef.current) {
|
|
859
|
+
const option = filteredOptions[highlightedIndexRef.current];
|
|
860
|
+
const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
|
|
752
861
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
862
|
+
// Avoid early form validation, let the end-users continue filling the form.
|
|
863
|
+
event.preventDefault();
|
|
864
|
+
if (disabled) {
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
selectNewValue(event, option, 'selectOption');
|
|
759
868
|
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
869
|
+
// Move the selection to the end.
|
|
870
|
+
if (autoComplete) {
|
|
871
|
+
inputRef.current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
|
|
872
|
+
}
|
|
873
|
+
} else if (freeSolo && inputValue !== '' && inputValueIsSelectedValue === false) {
|
|
874
|
+
if (multiple) {
|
|
875
|
+
// Allow people to add new values before they submit the form.
|
|
876
|
+
event.preventDefault();
|
|
877
|
+
}
|
|
878
|
+
selectNewValue(event, inputValue, 'createOption', 'freeSolo');
|
|
879
|
+
} else if (popupOpen && touchScrolledRef.current) {
|
|
880
|
+
// The highlight is stale from a touch-scroll - close without selecting.
|
|
767
881
|
event.preventDefault();
|
|
882
|
+
// This happens on Enter, but re-using "escape" as the closest `AutocompleteCloseReason`
|
|
883
|
+
// to avoid creating a new reason
|
|
884
|
+
handleClose(event, 'escape');
|
|
768
885
|
}
|
|
769
|
-
|
|
886
|
+
break;
|
|
770
887
|
}
|
|
771
|
-
break;
|
|
772
888
|
case 'Escape':
|
|
773
889
|
if (popupOpen) {
|
|
774
890
|
// Avoid Opera to exit fullscreen mode.
|
|
@@ -833,6 +949,14 @@ function useAutocomplete(props) {
|
|
|
833
949
|
// Ensure DOM focus lands on the input
|
|
834
950
|
focusItem(-1);
|
|
835
951
|
}
|
|
952
|
+
|
|
953
|
+
// If the window previously lost focus while the popup was open,
|
|
954
|
+
// ignore this focus event to prevent unintended reopening.
|
|
955
|
+
// Reset the flag so normal focus behavior resumes.
|
|
956
|
+
if (windowLostFocus.current) {
|
|
957
|
+
windowLostFocus.current = false;
|
|
958
|
+
return;
|
|
959
|
+
}
|
|
836
960
|
if (openOnFocus && !ignoreFocus.current) {
|
|
837
961
|
handleOpen(event);
|
|
838
962
|
}
|
|
@@ -846,7 +970,12 @@ function useAutocomplete(props) {
|
|
|
846
970
|
setFocused(false);
|
|
847
971
|
firstFocus.current = true;
|
|
848
972
|
ignoreFocus.current = false;
|
|
849
|
-
|
|
973
|
+
|
|
974
|
+
// Auto-select the highlighted option on blur, but only if the highlight
|
|
975
|
+
// came from keyboard navigation or was set programmatically (autoHighlight).
|
|
976
|
+
// Mouse hover and touch should not trigger selection — the user may have
|
|
977
|
+
// moved the pointer over an option without intending to commit to it.
|
|
978
|
+
if (autoSelect && highlightedIndexRef.current !== -1 && popupOpen && highlightReasonRef.current !== 'mouse' && highlightReasonRef.current !== 'touch') {
|
|
850
979
|
selectNewValue(event, filteredOptions[highlightedIndexRef.current], 'blur');
|
|
851
980
|
} else if (autoSelect && freeSolo && inputValue !== '') {
|
|
852
981
|
selectNewValue(event, inputValue, 'blur', 'freeSolo');
|
|
@@ -857,9 +986,10 @@ function useAutocomplete(props) {
|
|
|
857
986
|
};
|
|
858
987
|
const handleInputChange = event => {
|
|
859
988
|
const newValue = event.target.value;
|
|
860
|
-
|
|
989
|
+
const valueChanged = inputValue !== newValue;
|
|
990
|
+
if (valueChanged) {
|
|
861
991
|
setInputValueState(newValue);
|
|
862
|
-
|
|
992
|
+
touchScrolledRef.current = false;
|
|
863
993
|
if (onInputChange) {
|
|
864
994
|
onInputChange(event, newValue, 'input');
|
|
865
995
|
}
|
|
@@ -873,6 +1003,12 @@ function useAutocomplete(props) {
|
|
|
873
1003
|
} else {
|
|
874
1004
|
handleOpen(event);
|
|
875
1005
|
}
|
|
1006
|
+
|
|
1007
|
+
// Called after handleOpen so it overrides handleOpen's setInputPristine(true)
|
|
1008
|
+
// when the first keystroke also opens the popup.
|
|
1009
|
+
if (valueChanged) {
|
|
1010
|
+
setInputPristine(false);
|
|
1011
|
+
}
|
|
876
1012
|
};
|
|
877
1013
|
const handleOptionMouseMove = event => {
|
|
878
1014
|
const index = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
@@ -882,20 +1018,35 @@ function useAutocomplete(props) {
|
|
|
882
1018
|
index,
|
|
883
1019
|
reason: 'mouse'
|
|
884
1020
|
});
|
|
1021
|
+
} else {
|
|
1022
|
+
// The option is already highlighted (e.g. programmatically via autoHighlight),
|
|
1023
|
+
// but the user moved the mouse over it — mark as mouse-initiated so
|
|
1024
|
+
// autoSelect on blur correctly treats this as incidental hover.
|
|
1025
|
+
highlightReasonRef.current = 'mouse';
|
|
1026
|
+
}
|
|
1027
|
+
// Don't clear the touch-scroll guard while touch state is still latched.
|
|
1028
|
+
// After a touch gesture, browsers may fire compatibility mousemove
|
|
1029
|
+
// events; if those cleared the guard immediately, later compat events in
|
|
1030
|
+
// the same sequence could be misclassified as a real mouse interaction.
|
|
1031
|
+
// Touch state is cleared by the next deliberate interaction
|
|
1032
|
+
// (keyboard nav, handleOptionClick, or handleOpen).
|
|
1033
|
+
if (!isTouchRef.current) {
|
|
1034
|
+
touchScrolledRef.current = false;
|
|
885
1035
|
}
|
|
886
1036
|
};
|
|
887
1037
|
const handleOptionTouchStart = event => {
|
|
1038
|
+
touchScrolledRef.current = false;
|
|
888
1039
|
setHighlightedIndex({
|
|
889
1040
|
event,
|
|
890
1041
|
index: Number(event.currentTarget.getAttribute('data-option-index')),
|
|
891
1042
|
reason: 'touch'
|
|
892
1043
|
});
|
|
893
|
-
|
|
1044
|
+
isTouchRef.current = true;
|
|
894
1045
|
};
|
|
895
1046
|
const handleOptionClick = event => {
|
|
896
1047
|
const index = Number(event.currentTarget.getAttribute('data-option-index'));
|
|
897
1048
|
selectNewValue(event, filteredOptions[index], 'selectOption');
|
|
898
|
-
|
|
1049
|
+
isTouchRef.current = false;
|
|
899
1050
|
};
|
|
900
1051
|
const handleItemDelete = index => event => {
|
|
901
1052
|
const newValue = value.slice();
|
|
@@ -920,7 +1071,11 @@ function useAutocomplete(props) {
|
|
|
920
1071
|
// Prevent input blur when interacting with the combobox
|
|
921
1072
|
const handleMouseDown = event => {
|
|
922
1073
|
// Prevent focusing the input if click is anywhere outside the Autocomplete
|
|
923
|
-
if (!event.currentTarget
|
|
1074
|
+
if (!(0, _contains.default)(event.currentTarget, event.target)) {
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
// Don't interfere with interactions outside the input area (e.g. helper text)
|
|
1078
|
+
if (anchorEl && !(0, _contains.default)(anchorEl, event.target)) {
|
|
924
1079
|
return;
|
|
925
1080
|
}
|
|
926
1081
|
if (event.target.getAttribute('id') !== id) {
|
|
@@ -931,7 +1086,11 @@ function useAutocomplete(props) {
|
|
|
931
1086
|
// Focus the input when interacting with the combobox
|
|
932
1087
|
const handleClick = event => {
|
|
933
1088
|
// Prevent focusing the input if click is anywhere outside the Autocomplete
|
|
934
|
-
if (!event.currentTarget
|
|
1089
|
+
if (!(0, _contains.default)(event.currentTarget, event.target)) {
|
|
1090
|
+
return;
|
|
1091
|
+
}
|
|
1092
|
+
// Don't interfere with interactions outside the input area (e.g. helper text)
|
|
1093
|
+
if (anchorEl && !(0, _contains.default)(anchorEl, event.target)) {
|
|
935
1094
|
return;
|
|
936
1095
|
}
|
|
937
1096
|
inputRef.current.focus();
|
|
@@ -1056,13 +1215,18 @@ function useAutocomplete(props) {
|
|
|
1056
1215
|
onMouseDown: event => {
|
|
1057
1216
|
// Prevent blur
|
|
1058
1217
|
event.preventDefault();
|
|
1218
|
+
},
|
|
1219
|
+
onScroll: () => {
|
|
1220
|
+
if (isTouchRef.current) {
|
|
1221
|
+
touchScrolledRef.current = true;
|
|
1222
|
+
}
|
|
1059
1223
|
}
|
|
1060
1224
|
}),
|
|
1061
1225
|
getOptionProps: ({
|
|
1062
1226
|
index,
|
|
1063
1227
|
option
|
|
1064
1228
|
}) => {
|
|
1065
|
-
const selected = (
|
|
1229
|
+
const selected = isOptionSelected(option);
|
|
1066
1230
|
const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
|
|
1067
1231
|
return {
|
|
1068
1232
|
key: getOptionKey?.(option) ?? getOptionLabel(option),
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _contains = _interopRequireDefault(require("@mui/utils/contains"));
|
|
9
|
+
var _default = exports.default = _contains.default;
|
|
@@ -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,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FOCUSABLE_ATTRIBUTE = void 0;
|
|
7
|
+
exports.getFocusTarget = getFocusTarget;
|
|
8
|
+
const FOCUSABLE_ATTRIBUTE = exports.FOCUSABLE_ATTRIBUTE = 'data-mui-focusable';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns the element marked as the initial focus target inside a focus trap.
|
|
12
|
+
* The root element takes precedence over marked descendants so components can
|
|
13
|
+
* opt into focusing their own root surface directly.
|
|
14
|
+
*/
|
|
15
|
+
function getFocusTarget(rootElement) {
|
|
16
|
+
if (!rootElement) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
return rootElement.hasAttribute(FOCUSABLE_ATTRIBUTE) ? rootElement : rootElement.querySelector(`[${FOCUSABLE_ATTRIBUTE}]`);
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _getEventTarget = _interopRequireDefault(require("@mui/utils/getEventTarget"));
|
|
9
|
+
var _default = exports.default = _getEventTarget.default;
|