@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.
Files changed (395) hide show
  1. package/Accordion/Accordion.d.ts +3 -3
  2. package/AccordionActions/AccordionActions.d.ts +2 -2
  3. package/AccordionDetails/AccordionDetails.d.ts +2 -2
  4. package/AccordionSummary/AccordionSummary.d.ts +3 -3
  5. package/Alert/Alert.d.ts +3 -3
  6. package/AlertTitle/AlertTitle.d.ts +3 -3
  7. package/AppBar/AppBar.d.ts +3 -3
  8. package/Autocomplete/Autocomplete.d.ts +18 -2
  9. package/Autocomplete/Autocomplete.js +111 -37
  10. package/Avatar/Avatar.d.ts +2 -2
  11. package/AvatarGroup/AvatarGroup.d.ts +2 -2
  12. package/Backdrop/Backdrop.d.ts +3 -3
  13. package/Badge/Badge.d.ts +3 -3
  14. package/BottomNavigation/BottomNavigation.d.ts +2 -2
  15. package/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
  16. package/Box/Box.d.ts +3 -2
  17. package/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  18. package/Button/Button.d.ts +6 -5
  19. package/Button/Button.js +18 -1
  20. package/ButtonBase/ButtonBase.d.ts +2 -2
  21. package/ButtonBase/ButtonBase.js +8 -2
  22. package/ButtonGroup/ButtonGroup.d.ts +2 -2
  23. package/CHANGELOG.md +82 -0
  24. package/Card/Card.d.ts +3 -3
  25. package/CardActionArea/CardActionArea.d.ts +3 -3
  26. package/CardActions/CardActions.d.ts +2 -2
  27. package/CardContent/CardContent.d.ts +2 -2
  28. package/CardHeader/CardHeader.d.ts +2 -2
  29. package/CardHeader/CardHeader.js +5 -1
  30. package/CardMedia/CardMedia.d.ts +2 -2
  31. package/Checkbox/Checkbox.d.ts +4 -4
  32. package/Checkbox/Checkbox.js +2 -1
  33. package/Chip/Chip.d.ts +2 -2
  34. package/CircularProgress/CircularProgress.d.ts +2 -2
  35. package/ClickAwayListener/ClickAwayListener.d.ts +3 -3
  36. package/ClickAwayListener/ClickAwayListener.js +5 -8
  37. package/Collapse/Collapse.d.ts +5 -5
  38. package/Collapse/Collapse.js +6 -18
  39. package/Container/Container.d.ts +2 -2
  40. package/CssBaseline/CssBaseline.d.ts +2 -2
  41. package/Dialog/Dialog.d.ts +10 -3
  42. package/Dialog/Dialog.js +19 -6
  43. package/DialogActions/DialogActions.d.ts +2 -2
  44. package/DialogContent/DialogContent.d.ts +2 -2
  45. package/DialogContentText/DialogContentText.d.ts +3 -3
  46. package/DialogTitle/DialogTitle.d.ts +3 -3
  47. package/Divider/Divider.d.ts +4 -3
  48. package/Drawer/Drawer.d.ts +3 -3
  49. package/Drawer/Drawer.js +18 -4
  50. package/Fab/Fab.d.ts +3 -3
  51. package/Fab/Fab.js +7 -1
  52. package/Fade/Fade.d.ts +3 -3
  53. package/Fade/Fade.js +28 -32
  54. package/FilledInput/FilledInput.d.ts +3 -3
  55. package/FilledInput/FilledInput.js +1 -1
  56. package/FormControl/FormControl.d.ts +7 -7
  57. package/FormControlLabel/FormControlLabel.d.ts +4 -4
  58. package/FormGroup/FormGroup.d.ts +3 -3
  59. package/FormHelperText/FormHelperText.d.ts +3 -3
  60. package/FormLabel/FormLabel.d.ts +5 -5
  61. package/GlobalStyles/GlobalStyles.d.ts +2 -2
  62. package/Grid/Grid.d.ts +2 -2
  63. package/Grid/Grid.js +2 -2
  64. package/GridLegacy/GridLegacy.d.ts +2 -2
  65. package/Grow/Grow.d.ts +5 -5
  66. package/Grow/Grow.js +30 -38
  67. package/Icon/Icon.d.ts +3 -3
  68. package/IconButton/IconButton.d.ts +5 -5
  69. package/ImageList/ImageList.d.ts +2 -2
  70. package/ImageListItem/ImageListItem.d.ts +2 -2
  71. package/ImageListItemBar/ImageListItemBar.d.ts +2 -2
  72. package/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -2
  73. package/InitColorSchemeScript/InitColorSchemeScript.js +2 -2
  74. package/Input/Input.d.ts +3 -3
  75. package/Input/Input.js +1 -1
  76. package/InputAdornment/InputAdornment.d.ts +2 -2
  77. package/InputBase/InputBase.d.ts +2 -2
  78. package/InputBase/InputBase.js +39 -7
  79. package/InputLabel/InputLabel.d.ts +4 -4
  80. package/LinearProgress/LinearProgress.d.ts +2 -2
  81. package/Link/Link.d.ts +4 -4
  82. package/List/List.d.ts +4 -3
  83. package/ListItem/ListItem.d.ts +3 -3
  84. package/ListItemAvatar/ListItemAvatar.d.ts +2 -2
  85. package/ListItemButton/ListItemButton.d.ts +4 -3
  86. package/ListItemButton/ListItemButton.js +7 -1
  87. package/ListItemIcon/ListItemIcon.d.ts +3 -2
  88. package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
  89. package/ListItemText/ListItemText.d.ts +3 -2
  90. package/ListItemText/ListItemText.js +5 -1
  91. package/ListSubheader/ListSubheader.d.ts +3 -2
  92. package/Menu/Menu.d.ts +4 -4
  93. package/MenuItem/MenuItem.d.ts +3 -3
  94. package/MenuItem/MenuItem.js +27 -2
  95. package/MenuList/MenuList.d.ts +4 -4
  96. package/MobileStepper/MobileStepper.d.ts +3 -3
  97. package/Modal/Modal.d.ts +7 -7
  98. package/NativeSelect/NativeSelect.d.ts +3 -3
  99. package/NoSsr/NoSsr.d.ts +2 -2
  100. package/NoSsr/NoSsr.js +2 -2
  101. package/OutlinedInput/OutlinedInput.d.ts +4 -4
  102. package/Pagination/Pagination.d.ts +2 -2
  103. package/PaginationItem/PaginationItem.d.ts +3 -3
  104. package/Paper/Paper.d.ts +4 -3
  105. package/PigmentContainer/PigmentContainer.d.ts +2 -2
  106. package/PigmentContainer/PigmentContainer.js +2 -3
  107. package/PigmentGrid/PigmentGrid.d.ts +2 -2
  108. package/PigmentGrid/PigmentGrid.js +2 -3
  109. package/PigmentStack/PigmentStack.d.ts +2 -2
  110. package/PigmentStack/PigmentStack.js +2 -3
  111. package/Popover/Popover.d.ts +4 -4
  112. package/Popper/BasePopper.js +23 -1
  113. package/Popper/Popper.d.ts +4 -4
  114. package/Popper/Popper.js +4 -4
  115. package/Popper/index.d.ts +1 -0
  116. package/Popper/index.js +11 -2
  117. package/Portal/Portal.d.ts +2 -2
  118. package/Portal/Portal.js +2 -2
  119. package/README.md +2 -2
  120. package/Radio/Radio.d.ts +3 -3
  121. package/RadioGroup/RadioGroup.d.ts +3 -3
  122. package/Rating/Rating.d.ts +2 -2
  123. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
  124. package/Select/Select.d.ts +3 -3
  125. package/Select/SelectInput.js +46 -47
  126. package/Select/index.d.ts +1 -0
  127. package/Select/index.js +12 -0
  128. package/Select/utils/SelectFocusSourceContext.d.ts +4 -0
  129. package/Select/utils/SelectFocusSourceContext.js +19 -0
  130. package/Select/utils/areEqualValues.d.ts +1 -0
  131. package/Select/utils/areEqualValues.js +14 -0
  132. package/Select/utils/getOpenInteractionType.d.ts +1 -0
  133. package/Select/utils/getOpenInteractionType.js +18 -0
  134. package/Select/utils/index.d.ts +4 -0
  135. package/Select/utils/index.js +40 -0
  136. package/Select/utils/isEmpty.d.ts +1 -0
  137. package/Select/utils/isEmpty.js +9 -0
  138. package/Skeleton/Skeleton.d.ts +2 -2
  139. package/Slide/Slide.d.ts +4 -4
  140. package/Slide/Slide.js +43 -42
  141. package/Slider/Slider.d.ts +7 -7
  142. package/Slider/useSlider.js +6 -3
  143. package/Snackbar/Snackbar.d.ts +2 -2
  144. package/SnackbarContent/SnackbarContent.d.ts +3 -3
  145. package/SpeedDial/SpeedDial.d.ts +2 -2
  146. package/SpeedDialAction/SpeedDialAction.d.ts +3 -3
  147. package/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
  148. package/Stack/Stack.d.ts +2 -2
  149. package/Step/Step.d.ts +2 -2
  150. package/StepButton/StepButton.d.ts +3 -3
  151. package/StepConnector/StepConnector.d.ts +2 -2
  152. package/StepContent/StepContent.d.ts +2 -2
  153. package/StepIcon/StepIcon.d.ts +3 -3
  154. package/StepLabel/StepLabel.d.ts +2 -2
  155. package/Stepper/Stepper.d.ts +2 -2
  156. package/SvgIcon/SvgIcon.d.ts +3 -3
  157. package/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
  158. package/SwipeableDrawer/SwipeableDrawer.js +5 -7
  159. package/Switch/Switch.d.ts +4 -4
  160. package/Switch/Switch.js +7 -4
  161. package/Tab/Tab.d.ts +3 -3
  162. package/TabScrollButton/TabScrollButton.d.ts +2 -2
  163. package/Table/Table.d.ts +2 -2
  164. package/TableBody/TableBody.d.ts +2 -2
  165. package/TableCell/TableCell.d.ts +2 -2
  166. package/TableContainer/TableContainer.d.ts +2 -2
  167. package/TableFooter/TableFooter.d.ts +2 -2
  168. package/TableHead/TableHead.d.ts +2 -2
  169. package/TablePagination/TablePagination.d.ts +4 -4
  170. package/TablePaginationActions/TablePaginationActions.d.ts +2 -2
  171. package/TableRow/TableRow.d.ts +2 -2
  172. package/TableSortLabel/TableSortLabel.d.ts +3 -3
  173. package/Tabs/Tabs.d.ts +2 -2
  174. package/TextField/TextField.d.ts +10 -10
  175. package/TextareaAutosize/TextareaAutosize.d.ts +2 -2
  176. package/TextareaAutosize/TextareaAutosize.js +2 -2
  177. package/ToggleButton/ToggleButton.d.ts +3 -3
  178. package/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
  179. package/Toolbar/Toolbar.d.ts +2 -2
  180. package/Tooltip/Tooltip.d.ts +2 -2
  181. package/Typography/Typography.d.ts +4 -3
  182. package/Unstable_TrapFocus/FocusTrap.js +15 -5
  183. package/Zoom/Zoom.d.ts +3 -3
  184. package/Zoom/Zoom.js +24 -30
  185. package/esm/Accordion/Accordion.d.ts +3 -3
  186. package/esm/AccordionActions/AccordionActions.d.ts +2 -2
  187. package/esm/AccordionDetails/AccordionDetails.d.ts +2 -2
  188. package/esm/AccordionSummary/AccordionSummary.d.ts +3 -3
  189. package/esm/Alert/Alert.d.ts +3 -3
  190. package/esm/AlertTitle/AlertTitle.d.ts +3 -3
  191. package/esm/AppBar/AppBar.d.ts +3 -3
  192. package/esm/Autocomplete/Autocomplete.d.ts +18 -2
  193. package/esm/Autocomplete/Autocomplete.js +111 -37
  194. package/esm/Avatar/Avatar.d.ts +2 -2
  195. package/esm/AvatarGroup/AvatarGroup.d.ts +2 -2
  196. package/esm/Backdrop/Backdrop.d.ts +3 -3
  197. package/esm/Badge/Badge.d.ts +3 -3
  198. package/esm/BottomNavigation/BottomNavigation.d.ts +2 -2
  199. package/esm/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
  200. package/esm/Box/Box.d.ts +3 -2
  201. package/esm/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  202. package/esm/Button/Button.d.ts +6 -5
  203. package/esm/Button/Button.js +18 -1
  204. package/esm/ButtonBase/ButtonBase.d.ts +2 -2
  205. package/esm/ButtonBase/ButtonBase.js +8 -2
  206. package/esm/ButtonGroup/ButtonGroup.d.ts +2 -2
  207. package/esm/Card/Card.d.ts +3 -3
  208. package/esm/CardActionArea/CardActionArea.d.ts +3 -3
  209. package/esm/CardActions/CardActions.d.ts +2 -2
  210. package/esm/CardContent/CardContent.d.ts +2 -2
  211. package/esm/CardHeader/CardHeader.d.ts +2 -2
  212. package/esm/CardHeader/CardHeader.js +5 -1
  213. package/esm/CardMedia/CardMedia.d.ts +2 -2
  214. package/esm/Checkbox/Checkbox.d.ts +4 -4
  215. package/esm/Checkbox/Checkbox.js +2 -1
  216. package/esm/Chip/Chip.d.ts +2 -2
  217. package/esm/CircularProgress/CircularProgress.d.ts +2 -2
  218. package/esm/ClickAwayListener/ClickAwayListener.d.ts +3 -3
  219. package/esm/ClickAwayListener/ClickAwayListener.js +5 -8
  220. package/esm/Collapse/Collapse.d.ts +5 -5
  221. package/esm/Collapse/Collapse.js +7 -19
  222. package/esm/Container/Container.d.ts +2 -2
  223. package/esm/CssBaseline/CssBaseline.d.ts +2 -2
  224. package/esm/Dialog/Dialog.d.ts +10 -3
  225. package/esm/Dialog/Dialog.js +19 -6
  226. package/esm/DialogActions/DialogActions.d.ts +2 -2
  227. package/esm/DialogContent/DialogContent.d.ts +2 -2
  228. package/esm/DialogContentText/DialogContentText.d.ts +3 -3
  229. package/esm/DialogTitle/DialogTitle.d.ts +3 -3
  230. package/esm/Divider/Divider.d.ts +4 -3
  231. package/esm/Drawer/Drawer.d.ts +3 -3
  232. package/esm/Drawer/Drawer.js +18 -4
  233. package/esm/Fab/Fab.d.ts +3 -3
  234. package/esm/Fab/Fab.js +7 -1
  235. package/esm/Fade/Fade.d.ts +3 -3
  236. package/esm/Fade/Fade.js +29 -33
  237. package/esm/FilledInput/FilledInput.d.ts +3 -3
  238. package/esm/FilledInput/FilledInput.js +1 -1
  239. package/esm/FormControl/FormControl.d.ts +7 -7
  240. package/esm/FormControlLabel/FormControlLabel.d.ts +4 -4
  241. package/esm/FormGroup/FormGroup.d.ts +3 -3
  242. package/esm/FormHelperText/FormHelperText.d.ts +3 -3
  243. package/esm/FormLabel/FormLabel.d.ts +5 -5
  244. package/esm/GlobalStyles/GlobalStyles.d.ts +2 -2
  245. package/esm/Grid/Grid.d.ts +2 -2
  246. package/esm/Grid/Grid.js +2 -2
  247. package/esm/GridLegacy/GridLegacy.d.ts +2 -2
  248. package/esm/Grow/Grow.d.ts +5 -5
  249. package/esm/Grow/Grow.js +31 -39
  250. package/esm/Icon/Icon.d.ts +3 -3
  251. package/esm/IconButton/IconButton.d.ts +5 -5
  252. package/esm/ImageList/ImageList.d.ts +2 -2
  253. package/esm/ImageListItem/ImageListItem.d.ts +2 -2
  254. package/esm/ImageListItemBar/ImageListItemBar.d.ts +2 -2
  255. package/esm/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -2
  256. package/esm/InitColorSchemeScript/InitColorSchemeScript.js +2 -2
  257. package/esm/Input/Input.d.ts +3 -3
  258. package/esm/Input/Input.js +1 -1
  259. package/esm/InputAdornment/InputAdornment.d.ts +2 -2
  260. package/esm/InputBase/InputBase.d.ts +2 -2
  261. package/esm/InputBase/InputBase.js +39 -7
  262. package/esm/InputLabel/InputLabel.d.ts +4 -4
  263. package/esm/LinearProgress/LinearProgress.d.ts +2 -2
  264. package/esm/Link/Link.d.ts +4 -4
  265. package/esm/List/List.d.ts +4 -3
  266. package/esm/ListItem/ListItem.d.ts +3 -3
  267. package/esm/ListItemAvatar/ListItemAvatar.d.ts +2 -2
  268. package/esm/ListItemButton/ListItemButton.d.ts +4 -3
  269. package/esm/ListItemButton/ListItemButton.js +7 -1
  270. package/esm/ListItemIcon/ListItemIcon.d.ts +3 -2
  271. package/esm/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
  272. package/esm/ListItemText/ListItemText.d.ts +3 -2
  273. package/esm/ListItemText/ListItemText.js +5 -1
  274. package/esm/ListSubheader/ListSubheader.d.ts +3 -2
  275. package/esm/Menu/Menu.d.ts +4 -4
  276. package/esm/MenuItem/MenuItem.d.ts +3 -3
  277. package/esm/MenuItem/MenuItem.js +29 -2
  278. package/esm/MenuList/MenuList.d.ts +4 -4
  279. package/esm/MobileStepper/MobileStepper.d.ts +3 -3
  280. package/esm/Modal/Modal.d.ts +7 -7
  281. package/esm/NativeSelect/NativeSelect.d.ts +3 -3
  282. package/esm/NoSsr/NoSsr.d.ts +2 -2
  283. package/esm/NoSsr/NoSsr.js +2 -2
  284. package/esm/OutlinedInput/OutlinedInput.d.ts +4 -4
  285. package/esm/Pagination/Pagination.d.ts +2 -2
  286. package/esm/PaginationItem/PaginationItem.d.ts +3 -3
  287. package/esm/Paper/Paper.d.ts +4 -3
  288. package/esm/PigmentContainer/PigmentContainer.d.ts +2 -2
  289. package/esm/PigmentContainer/PigmentContainer.js +2 -4
  290. package/esm/PigmentGrid/PigmentGrid.d.ts +2 -2
  291. package/esm/PigmentGrid/PigmentGrid.js +2 -4
  292. package/esm/PigmentStack/PigmentStack.d.ts +2 -2
  293. package/esm/PigmentStack/PigmentStack.js +2 -4
  294. package/esm/Popover/Popover.d.ts +4 -4
  295. package/esm/Popper/BasePopper.js +23 -1
  296. package/esm/Popper/Popper.d.ts +4 -4
  297. package/esm/Popper/Popper.js +4 -4
  298. package/esm/Popper/index.d.ts +1 -0
  299. package/esm/Popper/index.js +1 -0
  300. package/esm/Portal/Portal.d.ts +2 -2
  301. package/esm/Portal/Portal.js +2 -2
  302. package/esm/Radio/Radio.d.ts +3 -3
  303. package/esm/RadioGroup/RadioGroup.d.ts +3 -3
  304. package/esm/Rating/Rating.d.ts +2 -2
  305. package/esm/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
  306. package/esm/Select/Select.d.ts +3 -3
  307. package/esm/Select/SelectInput.js +43 -44
  308. package/esm/Select/index.d.ts +1 -0
  309. package/esm/Select/index.js +1 -0
  310. package/esm/Select/utils/SelectFocusSourceContext.d.ts +4 -0
  311. package/esm/Select/utils/SelectFocusSourceContext.js +13 -0
  312. package/esm/Select/utils/areEqualValues.d.ts +1 -0
  313. package/esm/Select/utils/areEqualValues.js +8 -0
  314. package/esm/Select/utils/getOpenInteractionType.d.ts +1 -0
  315. package/esm/Select/utils/getOpenInteractionType.js +12 -0
  316. package/esm/Select/utils/index.d.ts +4 -0
  317. package/esm/Select/utils/index.js +4 -0
  318. package/esm/Select/utils/isEmpty.d.ts +1 -0
  319. package/esm/Select/utils/isEmpty.js +3 -0
  320. package/esm/Skeleton/Skeleton.d.ts +2 -2
  321. package/esm/Slide/Slide.d.ts +4 -4
  322. package/esm/Slide/Slide.js +44 -44
  323. package/esm/Slider/Slider.d.ts +7 -7
  324. package/esm/Slider/useSlider.js +6 -3
  325. package/esm/Snackbar/Snackbar.d.ts +2 -2
  326. package/esm/SnackbarContent/SnackbarContent.d.ts +3 -3
  327. package/esm/SpeedDial/SpeedDial.d.ts +2 -2
  328. package/esm/SpeedDialAction/SpeedDialAction.d.ts +3 -3
  329. package/esm/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
  330. package/esm/Stack/Stack.d.ts +2 -2
  331. package/esm/Step/Step.d.ts +2 -2
  332. package/esm/StepButton/StepButton.d.ts +3 -3
  333. package/esm/StepConnector/StepConnector.d.ts +2 -2
  334. package/esm/StepContent/StepContent.d.ts +2 -2
  335. package/esm/StepIcon/StepIcon.d.ts +3 -3
  336. package/esm/StepLabel/StepLabel.d.ts +2 -2
  337. package/esm/Stepper/Stepper.d.ts +2 -2
  338. package/esm/SvgIcon/SvgIcon.d.ts +3 -3
  339. package/esm/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
  340. package/esm/SwipeableDrawer/SwipeableDrawer.js +5 -7
  341. package/esm/Switch/Switch.d.ts +4 -4
  342. package/esm/Switch/Switch.js +7 -4
  343. package/esm/Tab/Tab.d.ts +3 -3
  344. package/esm/TabScrollButton/TabScrollButton.d.ts +2 -2
  345. package/esm/Table/Table.d.ts +2 -2
  346. package/esm/TableBody/TableBody.d.ts +2 -2
  347. package/esm/TableCell/TableCell.d.ts +2 -2
  348. package/esm/TableContainer/TableContainer.d.ts +2 -2
  349. package/esm/TableFooter/TableFooter.d.ts +2 -2
  350. package/esm/TableHead/TableHead.d.ts +2 -2
  351. package/esm/TablePagination/TablePagination.d.ts +4 -4
  352. package/esm/TablePaginationActions/TablePaginationActions.d.ts +2 -2
  353. package/esm/TableRow/TableRow.d.ts +2 -2
  354. package/esm/TableSortLabel/TableSortLabel.d.ts +3 -3
  355. package/esm/Tabs/Tabs.d.ts +2 -2
  356. package/esm/TextField/TextField.d.ts +10 -10
  357. package/esm/TextareaAutosize/TextareaAutosize.d.ts +2 -2
  358. package/esm/TextareaAutosize/TextareaAutosize.js +2 -2
  359. package/esm/ToggleButton/ToggleButton.d.ts +3 -3
  360. package/esm/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
  361. package/esm/Toolbar/Toolbar.d.ts +2 -2
  362. package/esm/Tooltip/Tooltip.d.ts +2 -2
  363. package/esm/Typography/Typography.d.ts +4 -3
  364. package/esm/Unstable_TrapFocus/FocusTrap.js +15 -5
  365. package/esm/Zoom/Zoom.d.ts +3 -3
  366. package/esm/Zoom/Zoom.js +25 -31
  367. package/esm/index.js +1 -1
  368. package/esm/styles/createThemeNoVars.js +1 -1
  369. package/esm/styles/createThemeWithVars.js +9 -9
  370. package/esm/transitions/utils.d.ts +7 -0
  371. package/esm/transitions/utils.js +25 -0
  372. package/esm/useAutocomplete/useAutocomplete.d.ts +4 -5
  373. package/esm/useAutocomplete/useAutocomplete.js +211 -47
  374. package/esm/utils/contains.d.ts +2 -0
  375. package/esm/utils/contains.js +2 -0
  376. package/esm/utils/focusable.d.ts +7 -0
  377. package/esm/utils/focusable.js +13 -0
  378. package/esm/utils/getEventTarget.d.ts +2 -0
  379. package/esm/utils/getEventTarget.js +2 -0
  380. package/esm/version/index.js +2 -2
  381. package/index.js +1 -1
  382. package/package.json +5 -5
  383. package/styles/createThemeNoVars.js +1 -1
  384. package/styles/createThemeWithVars.js +9 -9
  385. package/transitions/utils.d.ts +7 -0
  386. package/transitions/utils.js +27 -0
  387. package/useAutocomplete/useAutocomplete.d.ts +4 -5
  388. package/useAutocomplete/useAutocomplete.js +211 -47
  389. package/utils/contains.d.ts +2 -0
  390. package/utils/contains.js +9 -0
  391. package/utils/focusable.d.ts +7 -0
  392. package/utils/focusable.js +20 -0
  393. package/utils/getEventTarget.d.ts +2 -0
  394. package/utils/getEventTarget.js +9 -0
  395. 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
- // MUI X - DataGrid needs this token.
344
- setColorChannel(palette.background, 'default');
345
-
346
- // added for consistency with the `background.default` token
347
- setColorChannel(palette.background, 'paper');
348
- setColorChannel(palette.common, 'background');
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)));
@@ -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 {};
@@ -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 selected option becomes the value of the input
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
- * When using the `freeSolo` mode, the typed value will be the input value
54
- * if the Autocomplete loses focus without highlighting an option.
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?.contains(document.activeElement);
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 = (option, value) => option === value,
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 && (multiple ? value : [value]).some(value2 => value2 !== null && isOptionEqualToValue(option, value2))) {
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 setHighlightedIndex = (0, _useEventCallback.default)(({
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
- listboxNode.scrollTop = 0;
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
- highlightedIndexRef.current = previousHighlightedOptionIndex;
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 highlighted index if possible
441
- if (multiple && currentOption && value.findIndex(val => isOptionEqualToValue(currentOption, val)) !== -1) {
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' && isTouch.current || blurOnSelect === 'mouse' && !isTouch.current) {
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
- if (highlightedIndexRef.current !== -1 && popupOpen) {
750
- const option = filteredOptions[highlightedIndexRef.current];
751
- const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
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
- // Avoid early form validation, let the end-users continue filling the form.
754
- event.preventDefault();
755
- if (disabled) {
756
- return;
757
- }
758
- selectNewValue(event, option, 'selectOption');
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
- // Move the selection to the end.
761
- if (autoComplete) {
762
- inputRef.current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
763
- }
764
- } else if (freeSolo && inputValue !== '' && inputValueIsSelectedValue === false) {
765
- if (multiple) {
766
- // Allow people to add new values before they submit the form.
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
- selectNewValue(event, inputValue, 'createOption', 'freeSolo');
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
- if (autoSelect && highlightedIndexRef.current !== -1 && popupOpen) {
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
- if (inputValue !== newValue) {
989
+ const valueChanged = inputValue !== newValue;
990
+ if (valueChanged) {
861
991
  setInputValueState(newValue);
862
- setInputPristine(false);
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
- isTouch.current = true;
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
- isTouch.current = false;
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.contains(event.target)) {
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.contains(event.target)) {
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 = (multiple ? value : [value]).some(value2 => value2 != null && isOptionEqualToValue(option, value2));
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,2 @@
1
+ import contains from '@mui/utils/contains';
2
+ export default contains;
@@ -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,2 @@
1
+ import getEventTarget from '@mui/utils/getEventTarget';
2
+ export default getEventTarget;
@@ -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;