@mui/material 7.0.1 → 7.0.2

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 (606) hide show
  1. package/Autocomplete/Autocomplete.d.ts +31 -1
  2. package/Autocomplete/Autocomplete.js +39 -27
  3. package/AvatarGroup/AvatarGroup.js +10 -2
  4. package/CHANGELOG.md +60 -0
  5. package/Dialog/dialogClasses.d.ts +6 -2
  6. package/SvgIcon/SvgIcon.d.ts +1 -1
  7. package/SvgIcon/SvgIcon.js +1 -1
  8. package/esm/Autocomplete/Autocomplete.d.ts +31 -1
  9. package/esm/Autocomplete/Autocomplete.js +39 -27
  10. package/esm/AvatarGroup/AvatarGroup.js +10 -2
  11. package/esm/Dialog/dialogClasses.d.ts +6 -2
  12. package/esm/SvgIcon/SvgIcon.d.ts +1 -1
  13. package/esm/SvgIcon/SvgIcon.js +1 -1
  14. package/esm/index.d.ts +0 -1
  15. package/esm/index.js +1 -1
  16. package/esm/useAutocomplete/useAutocomplete.d.ts +26 -0
  17. package/esm/useAutocomplete/useAutocomplete.js +88 -42
  18. package/esm/utils/memoTheme.d.ts +1 -1
  19. package/esm/version/index.js +2 -2
  20. package/index.d.ts +0 -1
  21. package/index.js +1 -1
  22. package/modern/Autocomplete/Autocomplete.d.ts +31 -1
  23. package/modern/Dialog/dialogClasses.d.ts +6 -2
  24. package/modern/SvgIcon/SvgIcon.d.ts +1 -1
  25. package/modern/index.d.ts +0 -1
  26. package/modern/useAutocomplete/useAutocomplete.d.ts +26 -0
  27. package/modern/utils/memoTheme.d.ts +1 -1
  28. package/package.json +8 -20
  29. package/useAutocomplete/useAutocomplete.d.ts +26 -0
  30. package/useAutocomplete/useAutocomplete.js +88 -42
  31. package/utils/memoTheme.d.ts +1 -1
  32. package/version/index.js +2 -2
  33. package/modern/Accordion/Accordion.js +0 -328
  34. package/modern/Accordion/AccordionContext.js +0 -13
  35. package/modern/Accordion/accordionClasses.js +0 -7
  36. package/modern/Accordion/index.js +0 -3
  37. package/modern/AccordionActions/AccordionActions.js +0 -93
  38. package/modern/AccordionActions/accordionActionsClasses.js +0 -7
  39. package/modern/AccordionActions/index.js +0 -3
  40. package/modern/AccordionDetails/AccordionDetails.js +0 -70
  41. package/modern/AccordionDetails/accordionDetailsClasses.js +0 -7
  42. package/modern/AccordionDetails/index.js +0 -3
  43. package/modern/AccordionSummary/AccordionSummary.js +0 -250
  44. package/modern/AccordionSummary/accordionSummaryClasses.js +0 -7
  45. package/modern/AccordionSummary/index.js +0 -3
  46. package/modern/Alert/Alert.js +0 -386
  47. package/modern/Alert/alertClasses.js +0 -7
  48. package/modern/Alert/index.js +0 -3
  49. package/modern/AlertTitle/AlertTitle.js +0 -76
  50. package/modern/AlertTitle/alertTitleClasses.js +0 -7
  51. package/modern/AlertTitle/index.js +0 -3
  52. package/modern/AppBar/AppBar.js +0 -227
  53. package/modern/AppBar/appBarClasses.js +0 -7
  54. package/modern/AppBar/index.js +0 -3
  55. package/modern/Autocomplete/Autocomplete.js +0 -1186
  56. package/modern/Autocomplete/autocompleteClasses.js +0 -7
  57. package/modern/Autocomplete/index.js +0 -3
  58. package/modern/Avatar/Avatar.js +0 -299
  59. package/modern/Avatar/avatarClasses.js +0 -7
  60. package/modern/Avatar/index.js +0 -3
  61. package/modern/AvatarGroup/AvatarGroup.js +0 -223
  62. package/modern/AvatarGroup/avatarGroupClasses.js +0 -7
  63. package/modern/AvatarGroup/index.js +0 -3
  64. package/modern/Backdrop/Backdrop.js +0 -205
  65. package/modern/Backdrop/backdropClasses.js +0 -7
  66. package/modern/Backdrop/index.js +0 -3
  67. package/modern/Badge/Badge.js +0 -428
  68. package/modern/Badge/badgeClasses.js +0 -9
  69. package/modern/Badge/index.js +0 -3
  70. package/modern/Badge/useBadge.js +0 -41
  71. package/modern/Badge/useBadge.types.js +0 -1
  72. package/modern/BottomNavigation/BottomNavigation.js +0 -123
  73. package/modern/BottomNavigation/bottomNavigationClasses.js +0 -7
  74. package/modern/BottomNavigation/index.js +0 -3
  75. package/modern/BottomNavigationAction/BottomNavigationAction.js +0 -187
  76. package/modern/BottomNavigationAction/bottomNavigationActionClasses.js +0 -7
  77. package/modern/BottomNavigationAction/index.js +0 -3
  78. package/modern/Box/Box.js +0 -35
  79. package/modern/Box/boxClasses.js +0 -3
  80. package/modern/Box/index.js +0 -3
  81. package/modern/Breadcrumbs/BreadcrumbCollapsed.js +0 -90
  82. package/modern/Breadcrumbs/Breadcrumbs.js +0 -240
  83. package/modern/Breadcrumbs/breadcrumbsClasses.js +0 -7
  84. package/modern/Breadcrumbs/index.js +0 -3
  85. package/modern/Button/Button.js +0 -688
  86. package/modern/Button/buttonClasses.js +0 -7
  87. package/modern/Button/index.js +0 -3
  88. package/modern/ButtonBase/ButtonBase.js +0 -447
  89. package/modern/ButtonBase/Ripple.js +0 -88
  90. package/modern/ButtonBase/TouchRipple.js +0 -324
  91. package/modern/ButtonBase/buttonBaseClasses.js +0 -7
  92. package/modern/ButtonBase/index.js +0 -5
  93. package/modern/ButtonBase/touchRippleClasses.js +0 -7
  94. package/modern/ButtonGroup/ButtonGroup.js +0 -390
  95. package/modern/ButtonGroup/ButtonGroupButtonContext.js +0 -11
  96. package/modern/ButtonGroup/ButtonGroupContext.js +0 -11
  97. package/modern/ButtonGroup/buttonGroupClasses.js +0 -7
  98. package/modern/ButtonGroup/index.js +0 -5
  99. package/modern/Card/Card.js +0 -84
  100. package/modern/Card/cardClasses.js +0 -7
  101. package/modern/Card/index.js +0 -3
  102. package/modern/CardActionArea/CardActionArea.js +0 -117
  103. package/modern/CardActionArea/cardActionAreaClasses.js +0 -7
  104. package/modern/CardActionArea/index.js +0 -3
  105. package/modern/CardActions/CardActions.js +0 -94
  106. package/modern/CardActions/cardActionsClasses.js +0 -7
  107. package/modern/CardActions/index.js +0 -3
  108. package/modern/CardContent/CardContent.js +0 -80
  109. package/modern/CardContent/cardContentClasses.js +0 -7
  110. package/modern/CardContent/index.js +0 -3
  111. package/modern/CardHeader/CardHeader.js +0 -267
  112. package/modern/CardHeader/cardHeaderClasses.js +0 -7
  113. package/modern/CardHeader/index.js +0 -3
  114. package/modern/CardMedia/CardMedia.js +0 -145
  115. package/modern/CardMedia/cardMediaClasses.js +0 -7
  116. package/modern/CardMedia/index.js +0 -3
  117. package/modern/Checkbox/Checkbox.js +0 -280
  118. package/modern/Checkbox/checkboxClasses.js +0 -7
  119. package/modern/Checkbox/index.js +0 -3
  120. package/modern/Chip/Chip.js +0 -576
  121. package/modern/Chip/chipClasses.js +0 -7
  122. package/modern/Chip/index.js +0 -3
  123. package/modern/CircularProgress/CircularProgress.js +0 -285
  124. package/modern/CircularProgress/circularProgressClasses.js +0 -7
  125. package/modern/CircularProgress/index.js +0 -3
  126. package/modern/ClickAwayListener/ClickAwayListener.js +0 -174
  127. package/modern/ClickAwayListener/index.js +0 -1
  128. package/modern/Collapse/Collapse.js +0 -411
  129. package/modern/Collapse/collapseClasses.js +0 -7
  130. package/modern/Collapse/index.js +0 -3
  131. package/modern/Container/Container.js +0 -67
  132. package/modern/Container/containerClasses.js +0 -7
  133. package/modern/Container/index.js +0 -3
  134. package/modern/CssBaseline/CssBaseline.js +0 -161
  135. package/modern/CssBaseline/index.js +0 -1
  136. package/modern/DefaultPropsProvider/DefaultPropsProvider.js +0 -29
  137. package/modern/DefaultPropsProvider/index.js +0 -1
  138. package/modern/Dialog/Dialog.js +0 -513
  139. package/modern/Dialog/DialogContext.js +0 -8
  140. package/modern/Dialog/dialogClasses.js +0 -7
  141. package/modern/Dialog/index.js +0 -3
  142. package/modern/DialogActions/DialogActions.js +0 -96
  143. package/modern/DialogActions/dialogActionsClasses.js +0 -7
  144. package/modern/DialogActions/index.js +0 -3
  145. package/modern/DialogContent/DialogContent.js +0 -109
  146. package/modern/DialogContent/dialogContentClasses.js +0 -7
  147. package/modern/DialogContent/index.js +0 -3
  148. package/modern/DialogContentText/DialogContentText.js +0 -77
  149. package/modern/DialogContentText/dialogContentTextClasses.js +0 -7
  150. package/modern/DialogContentText/index.js +0 -3
  151. package/modern/DialogTitle/DialogTitle.js +0 -81
  152. package/modern/DialogTitle/dialogTitleClasses.js +0 -7
  153. package/modern/DialogTitle/index.js +0 -3
  154. package/modern/Divider/Divider.js +0 -314
  155. package/modern/Divider/dividerClasses.js +0 -7
  156. package/modern/Divider/index.js +0 -3
  157. package/modern/Drawer/Drawer.js +0 -434
  158. package/modern/Drawer/drawerClasses.js +0 -7
  159. package/modern/Drawer/index.js +0 -3
  160. package/modern/Fab/Fab.js +0 -271
  161. package/modern/Fab/fabClasses.js +0 -7
  162. package/modern/Fab/index.js +0 -3
  163. package/modern/Fade/Fade.js +0 -210
  164. package/modern/Fade/index.js +0 -1
  165. package/modern/FilledInput/FilledInput.js +0 -516
  166. package/modern/FilledInput/filledInputClasses.js +0 -11
  167. package/modern/FilledInput/index.js +0 -3
  168. package/modern/FormControl/FormControl.js +0 -305
  169. package/modern/FormControl/FormControlContext.js +0 -11
  170. package/modern/FormControl/formControlClasses.js +0 -7
  171. package/modern/FormControl/formControlState.js +0 -15
  172. package/modern/FormControl/index.js +0 -4
  173. package/modern/FormControl/useFormControl.js +0 -7
  174. package/modern/FormControlLabel/FormControlLabel.js +0 -283
  175. package/modern/FormControlLabel/formControlLabelClasses.js +0 -7
  176. package/modern/FormControlLabel/index.js +0 -3
  177. package/modern/FormGroup/FormGroup.js +0 -108
  178. package/modern/FormGroup/formGroupClasses.js +0 -7
  179. package/modern/FormGroup/index.js +0 -3
  180. package/modern/FormHelperText/FormHelperText.js +0 -186
  181. package/modern/FormHelperText/formHelperTextClasses.js +0 -7
  182. package/modern/FormHelperText/index.js +0 -3
  183. package/modern/FormLabel/FormLabel.js +0 -182
  184. package/modern/FormLabel/formLabelClasses.js +0 -7
  185. package/modern/FormLabel/index.js +0 -4
  186. package/modern/GlobalStyles/GlobalStyles.js +0 -26
  187. package/modern/GlobalStyles/index.js +0 -1
  188. package/modern/Grid/Grid.js +0 -138
  189. package/modern/Grid/gridClasses.js +0 -19
  190. package/modern/Grid/index.js +0 -4
  191. package/modern/GridLegacy/GridLegacy.js +0 -588
  192. package/modern/GridLegacy/GridLegacyContext.js +0 -12
  193. package/modern/GridLegacy/gridLegacyClasses.js +0 -19
  194. package/modern/GridLegacy/index.js +0 -3
  195. package/modern/Grow/Grow.js +0 -262
  196. package/modern/Grow/index.js +0 -1
  197. package/modern/Icon/Icon.js +0 -185
  198. package/modern/Icon/iconClasses.js +0 -7
  199. package/modern/Icon/index.js +0 -3
  200. package/modern/IconButton/IconButton.js +0 -322
  201. package/modern/IconButton/iconButtonClasses.js +0 -7
  202. package/modern/IconButton/index.js +0 -3
  203. package/modern/ImageList/ImageList.js +0 -150
  204. package/modern/ImageList/ImageListContext.js +0 -13
  205. package/modern/ImageList/imageListClasses.js +0 -7
  206. package/modern/ImageList/index.js +0 -3
  207. package/modern/ImageListItem/ImageListItem.js +0 -188
  208. package/modern/ImageListItem/imageListItemClasses.js +0 -7
  209. package/modern/ImageListItem/index.js +0 -3
  210. package/modern/ImageListItemBar/ImageListItemBar.js +0 -253
  211. package/modern/ImageListItemBar/imageListItemBarClasses.js +0 -7
  212. package/modern/ImageListItemBar/index.js +0 -3
  213. package/modern/InitColorSchemeScript/InitColorSchemeScript.js +0 -16
  214. package/modern/InitColorSchemeScript/index.js +0 -1
  215. package/modern/Input/Input.js +0 -361
  216. package/modern/Input/index.js +0 -3
  217. package/modern/Input/inputClasses.js +0 -11
  218. package/modern/InputAdornment/InputAdornment.js +0 -186
  219. package/modern/InputAdornment/index.js +0 -3
  220. package/modern/InputAdornment/inputAdornmentClasses.js +0 -7
  221. package/modern/InputBase/InputBase.js +0 -749
  222. package/modern/InputBase/index.js +0 -3
  223. package/modern/InputBase/inputBaseClasses.js +0 -7
  224. package/modern/InputBase/utils.js +0 -30
  225. package/modern/InputLabel/InputLabel.js +0 -283
  226. package/modern/InputLabel/index.js +0 -3
  227. package/modern/InputLabel/inputLabelClasses.js +0 -7
  228. package/modern/LinearProgress/LinearProgress.js +0 -455
  229. package/modern/LinearProgress/index.js +0 -3
  230. package/modern/LinearProgress/linearProgressClasses.js +0 -7
  231. package/modern/Link/Link.js +0 -283
  232. package/modern/Link/getTextDecoration.js +0 -16
  233. package/modern/Link/index.js +0 -3
  234. package/modern/Link/linkClasses.js +0 -7
  235. package/modern/List/List.js +0 -134
  236. package/modern/List/ListContext.js +0 -12
  237. package/modern/List/index.js +0 -3
  238. package/modern/List/listClasses.js +0 -7
  239. package/modern/ListItem/ListItem.js +0 -388
  240. package/modern/ListItem/index.js +0 -3
  241. package/modern/ListItem/listItemClasses.js +0 -7
  242. package/modern/ListItemAvatar/ListItemAvatar.js +0 -91
  243. package/modern/ListItemAvatar/index.js +0 -3
  244. package/modern/ListItemAvatar/listItemAvatarClasses.js +0 -7
  245. package/modern/ListItemButton/ListItemButton.js +0 -264
  246. package/modern/ListItemButton/index.js +0 -3
  247. package/modern/ListItemButton/listItemButtonClasses.js +0 -7
  248. package/modern/ListItemIcon/ListItemIcon.js +0 -97
  249. package/modern/ListItemIcon/index.js +0 -3
  250. package/modern/ListItemIcon/listItemIconClasses.js +0 -7
  251. package/modern/ListItemSecondaryAction/ListItemSecondaryAction.js +0 -96
  252. package/modern/ListItemSecondaryAction/index.js +0 -3
  253. package/modern/ListItemSecondaryAction/listItemSecondaryActionClasses.js +0 -7
  254. package/modern/ListItemText/ListItemText.js +0 -227
  255. package/modern/ListItemText/index.js +0 -3
  256. package/modern/ListItemText/listItemTextClasses.js +0 -7
  257. package/modern/ListSubheader/ListSubheader.js +0 -167
  258. package/modern/ListSubheader/index.js +0 -3
  259. package/modern/ListSubheader/listSubheaderClasses.js +0 -7
  260. package/modern/Menu/Menu.js +0 -341
  261. package/modern/Menu/index.js +0 -3
  262. package/modern/Menu/menuClasses.js +0 -7
  263. package/modern/MenuItem/MenuItem.js +0 -283
  264. package/modern/MenuItem/index.js +0 -3
  265. package/modern/MenuItem/menuItemClasses.js +0 -7
  266. package/modern/MenuList/MenuList.js +0 -290
  267. package/modern/MenuList/index.js +0 -1
  268. package/modern/MobileStepper/MobileStepper.js +0 -306
  269. package/modern/MobileStepper/index.js +0 -3
  270. package/modern/MobileStepper/mobileStepperClasses.js +0 -7
  271. package/modern/Modal/Modal.js +0 -396
  272. package/modern/Modal/ModalManager.js +0 -211
  273. package/modern/Modal/index.js +0 -4
  274. package/modern/Modal/modalClasses.js +0 -7
  275. package/modern/Modal/useModal.js +0 -200
  276. package/modern/Modal/useModal.types.js +0 -1
  277. package/modern/NativeSelect/NativeSelect.js +0 -133
  278. package/modern/NativeSelect/NativeSelectInput.js +0 -240
  279. package/modern/NativeSelect/index.js +0 -3
  280. package/modern/NativeSelect/nativeSelectClasses.js +0 -7
  281. package/modern/NoSsr/NoSsr.js +0 -70
  282. package/modern/NoSsr/NoSsr.types.js +0 -1
  283. package/modern/NoSsr/index.js +0 -1
  284. package/modern/OutlinedInput/NotchedOutline.js +0 -154
  285. package/modern/OutlinedInput/OutlinedInput.js +0 -410
  286. package/modern/OutlinedInput/index.js +0 -3
  287. package/modern/OutlinedInput/outlinedInputClasses.js +0 -11
  288. package/modern/OverridableComponent/index.js +0 -1
  289. package/modern/Pagination/Pagination.js +0 -245
  290. package/modern/Pagination/index.js +0 -3
  291. package/modern/Pagination/paginationClasses.js +0 -7
  292. package/modern/PaginationItem/PaginationItem.js +0 -472
  293. package/modern/PaginationItem/index.js +0 -3
  294. package/modern/PaginationItem/paginationItemClasses.js +0 -7
  295. package/modern/Paper/Paper.js +0 -170
  296. package/modern/Paper/index.js +0 -3
  297. package/modern/Paper/paperClasses.js +0 -7
  298. package/modern/PigmentContainer/PigmentContainer.js +0 -98
  299. package/modern/PigmentContainer/index.js +0 -3
  300. package/modern/PigmentGrid/PigmentGrid.js +0 -126
  301. package/modern/PigmentGrid/index.js +0 -3
  302. package/modern/PigmentStack/PigmentStack.js +0 -81
  303. package/modern/PigmentStack/index.js +0 -3
  304. package/modern/Popover/Popover.js +0 -583
  305. package/modern/Popover/index.js +0 -4
  306. package/modern/Popover/popoverClasses.js +0 -7
  307. package/modern/Popper/BasePopper.js +0 -370
  308. package/modern/Popper/BasePopper.types.js +0 -1
  309. package/modern/Popper/Popper.js +0 -210
  310. package/modern/Popper/index.js +0 -2
  311. package/modern/Popper/popperClasses.js +0 -7
  312. package/modern/Portal/Portal.js +0 -86
  313. package/modern/Portal/Portal.types.js +0 -1
  314. package/modern/Portal/index.js +0 -1
  315. package/modern/Radio/Radio.js +0 -309
  316. package/modern/Radio/RadioButtonIcon.js +0 -87
  317. package/modern/Radio/index.js +0 -3
  318. package/modern/Radio/radioClasses.js +0 -7
  319. package/modern/RadioGroup/RadioGroup.js +0 -114
  320. package/modern/RadioGroup/RadioGroupContext.js +0 -11
  321. package/modern/RadioGroup/index.js +0 -4
  322. package/modern/RadioGroup/radioGroupClasses.js +0 -7
  323. package/modern/RadioGroup/useRadioGroup.js +0 -7
  324. package/modern/Rating/Rating.js +0 -777
  325. package/modern/Rating/index.js +0 -3
  326. package/modern/Rating/ratingClasses.js +0 -7
  327. package/modern/ScopedCssBaseline/ScopedCssBaseline.js +0 -120
  328. package/modern/ScopedCssBaseline/index.js +0 -3
  329. package/modern/ScopedCssBaseline/scopedCssBaselineClasses.js +0 -7
  330. package/modern/Select/Select.js +0 -300
  331. package/modern/Select/SelectInput.js +0 -673
  332. package/modern/Select/index.js +0 -3
  333. package/modern/Select/selectClasses.js +0 -7
  334. package/modern/Skeleton/Skeleton.js +0 -269
  335. package/modern/Skeleton/index.js +0 -3
  336. package/modern/Skeleton/skeletonClasses.js +0 -7
  337. package/modern/Slide/Slide.js +0 -338
  338. package/modern/Slide/index.js +0 -1
  339. package/modern/Slider/Slider.js +0 -1095
  340. package/modern/Slider/SliderValueLabel.js +0 -53
  341. package/modern/Slider/SliderValueLabel.types.js +0 -1
  342. package/modern/Slider/index.js +0 -4
  343. package/modern/Slider/sliderClasses.js +0 -7
  344. package/modern/Slider/useSlider.js +0 -704
  345. package/modern/Slider/useSlider.types.js +0 -1
  346. package/modern/Snackbar/Snackbar.js +0 -426
  347. package/modern/Snackbar/index.js +0 -3
  348. package/modern/Snackbar/snackbarClasses.js +0 -7
  349. package/modern/Snackbar/useSnackbar.js +0 -133
  350. package/modern/Snackbar/useSnackbar.types.js +0 -1
  351. package/modern/SnackbarContent/SnackbarContent.js +0 -132
  352. package/modern/SnackbarContent/index.js +0 -3
  353. package/modern/SnackbarContent/snackbarContentClasses.js +0 -7
  354. package/modern/SpeedDial/SpeedDial.js +0 -579
  355. package/modern/SpeedDial/index.js +0 -3
  356. package/modern/SpeedDial/speedDialClasses.js +0 -7
  357. package/modern/SpeedDialAction/SpeedDialAction.js +0 -351
  358. package/modern/SpeedDialAction/index.js +0 -3
  359. package/modern/SpeedDialAction/speedDialActionClasses.js +0 -7
  360. package/modern/SpeedDialIcon/SpeedDialIcon.js +0 -156
  361. package/modern/SpeedDialIcon/index.js +0 -3
  362. package/modern/SpeedDialIcon/speedDialIconClasses.js +0 -7
  363. package/modern/Stack/Stack.js +0 -62
  364. package/modern/Stack/index.js +0 -2
  365. package/modern/Stack/stackClasses.js +0 -7
  366. package/modern/Step/Step.js +0 -176
  367. package/modern/Step/StepContext.js +0 -19
  368. package/modern/Step/index.js +0 -5
  369. package/modern/Step/stepClasses.js +0 -7
  370. package/modern/StepButton/StepButton.js +0 -133
  371. package/modern/StepButton/index.js +0 -3
  372. package/modern/StepButton/stepButtonClasses.js +0 -7
  373. package/modern/StepConnector/StepConnector.js +0 -152
  374. package/modern/StepConnector/index.js +0 -3
  375. package/modern/StepConnector/stepConnectorClasses.js +0 -7
  376. package/modern/StepContent/StepContent.js +0 -187
  377. package/modern/StepContent/index.js +0 -3
  378. package/modern/StepContent/stepContentClasses.js +0 -7
  379. package/modern/StepIcon/StepIcon.js +0 -161
  380. package/modern/StepIcon/index.js +0 -3
  381. package/modern/StepIcon/stepIconClasses.js +0 -7
  382. package/modern/StepLabel/StepLabel.js +0 -280
  383. package/modern/StepLabel/index.js +0 -3
  384. package/modern/StepLabel/stepLabelClasses.js +0 -7
  385. package/modern/Stepper/Stepper.js +0 -167
  386. package/modern/Stepper/StepperContext.js +0 -19
  387. package/modern/Stepper/index.js +0 -5
  388. package/modern/Stepper/stepperClasses.js +0 -7
  389. package/modern/SvgIcon/SvgIcon.js +0 -234
  390. package/modern/SvgIcon/index.js +0 -3
  391. package/modern/SvgIcon/svgIconClasses.js +0 -7
  392. package/modern/SwipeableDrawer/SwipeArea.js +0 -104
  393. package/modern/SwipeableDrawer/SwipeableDrawer.js +0 -661
  394. package/modern/SwipeableDrawer/index.js +0 -1
  395. package/modern/Switch/Switch.js +0 -407
  396. package/modern/Switch/index.js +0 -3
  397. package/modern/Switch/switchClasses.js +0 -7
  398. package/modern/Tab/Tab.js +0 -338
  399. package/modern/Tab/index.js +0 -3
  400. package/modern/Tab/tabClasses.js +0 -7
  401. package/modern/TabScrollButton/TabScrollButton.js +0 -172
  402. package/modern/TabScrollButton/index.js +0 -3
  403. package/modern/TabScrollButton/tabScrollButtonClasses.js +0 -7
  404. package/modern/Table/Table.js +0 -136
  405. package/modern/Table/TableContext.js +0 -12
  406. package/modern/Table/Tablelvl2Context.js +0 -12
  407. package/modern/Table/index.js +0 -3
  408. package/modern/Table/tableClasses.js +0 -7
  409. package/modern/TableBody/TableBody.js +0 -86
  410. package/modern/TableBody/index.js +0 -3
  411. package/modern/TableBody/tableBodyClasses.js +0 -7
  412. package/modern/TableCell/TableCell.js +0 -270
  413. package/modern/TableCell/index.js +0 -3
  414. package/modern/TableCell/tableCellClasses.js +0 -7
  415. package/modern/TableContainer/TableContainer.js +0 -78
  416. package/modern/TableContainer/index.js +0 -3
  417. package/modern/TableContainer/tableContainerClasses.js +0 -7
  418. package/modern/TableFooter/TableFooter.js +0 -86
  419. package/modern/TableFooter/index.js +0 -3
  420. package/modern/TableFooter/tableFooterClasses.js +0 -7
  421. package/modern/TableHead/TableHead.js +0 -86
  422. package/modern/TableHead/index.js +0 -3
  423. package/modern/TableHead/tableHeadClasses.js +0 -7
  424. package/modern/TablePagination/TablePagination.js +0 -505
  425. package/modern/TablePagination/TablePaginationActions.js +0 -194
  426. package/modern/TablePagination/index.js +0 -3
  427. package/modern/TablePagination/tablePaginationClasses.js +0 -7
  428. package/modern/TableRow/TableRow.js +0 -127
  429. package/modern/TableRow/index.js +0 -3
  430. package/modern/TableRow/tableRowClasses.js +0 -7
  431. package/modern/TableSortLabel/TableSortLabel.js +0 -212
  432. package/modern/TableSortLabel/index.js +0 -3
  433. package/modern/TableSortLabel/tableSortLabelClasses.js +0 -7
  434. package/modern/Tabs/ScrollbarSize.js +0 -58
  435. package/modern/Tabs/Tabs.js +0 -956
  436. package/modern/Tabs/index.js +0 -3
  437. package/modern/Tabs/tabsClasses.js +0 -7
  438. package/modern/TextField/TextField.js +0 -457
  439. package/modern/TextField/index.js +0 -3
  440. package/modern/TextField/textFieldClasses.js +0 -7
  441. package/modern/TextareaAutosize/TextareaAutosize.js +0 -243
  442. package/modern/TextareaAutosize/TextareaAutosize.types.js +0 -1
  443. package/modern/TextareaAutosize/index.js +0 -1
  444. package/modern/ToggleButton/ToggleButton.js +0 -268
  445. package/modern/ToggleButton/index.js +0 -3
  446. package/modern/ToggleButton/toggleButtonClasses.js +0 -7
  447. package/modern/ToggleButtonGroup/ToggleButtonGroup.js +0 -281
  448. package/modern/ToggleButtonGroup/ToggleButtonGroupButtonContext.js +0 -11
  449. package/modern/ToggleButtonGroup/ToggleButtonGroupContext.js +0 -11
  450. package/modern/ToggleButtonGroup/index.js +0 -3
  451. package/modern/ToggleButtonGroup/isValueSelected.js +0 -11
  452. package/modern/ToggleButtonGroup/toggleButtonGroupClasses.js +0 -7
  453. package/modern/Toolbar/Toolbar.js +0 -129
  454. package/modern/Toolbar/index.js +0 -3
  455. package/modern/Toolbar/toolbarClasses.js +0 -7
  456. package/modern/Tooltip/Tooltip.js +0 -898
  457. package/modern/Tooltip/index.js +0 -3
  458. package/modern/Tooltip/tooltipClasses.js +0 -7
  459. package/modern/Typography/Typography.js +0 -268
  460. package/modern/Typography/index.js +0 -3
  461. package/modern/Typography/typographyClasses.js +0 -7
  462. package/modern/Unstable_TrapFocus/FocusTrap.js +0 -329
  463. package/modern/Unstable_TrapFocus/FocusTrap.types.js +0 -1
  464. package/modern/Unstable_TrapFocus/index.js +0 -1
  465. package/modern/Zoom/Zoom.js +0 -210
  466. package/modern/Zoom/index.js +0 -1
  467. package/modern/className/index.js +0 -2
  468. package/modern/colors/amber.js +0 -17
  469. package/modern/colors/blue.js +0 -17
  470. package/modern/colors/blueGrey.js +0 -17
  471. package/modern/colors/brown.js +0 -17
  472. package/modern/colors/common.js +0 -5
  473. package/modern/colors/cyan.js +0 -17
  474. package/modern/colors/deepOrange.js +0 -17
  475. package/modern/colors/deepPurple.js +0 -17
  476. package/modern/colors/green.js +0 -17
  477. package/modern/colors/grey.js +0 -17
  478. package/modern/colors/index.js +0 -20
  479. package/modern/colors/indigo.js +0 -17
  480. package/modern/colors/lightBlue.js +0 -17
  481. package/modern/colors/lightGreen.js +0 -17
  482. package/modern/colors/lime.js +0 -17
  483. package/modern/colors/orange.js +0 -17
  484. package/modern/colors/pink.js +0 -17
  485. package/modern/colors/purple.js +0 -17
  486. package/modern/colors/red.js +0 -17
  487. package/modern/colors/teal.js +0 -17
  488. package/modern/colors/yellow.js +0 -17
  489. package/modern/darkScrollbar/index.js +0 -32
  490. package/modern/generateUtilityClass/index.js +0 -1
  491. package/modern/generateUtilityClasses/index.js +0 -1
  492. package/modern/index.js +0 -286
  493. package/modern/internal/SwitchBase.js +0 -355
  494. package/modern/internal/animate.js +0 -39
  495. package/modern/internal/svg-icons/Add.js +0 -12
  496. package/modern/internal/svg-icons/ArrowDownward.js +0 -12
  497. package/modern/internal/svg-icons/ArrowDropDown.js +0 -12
  498. package/modern/internal/svg-icons/Cancel.js +0 -12
  499. package/modern/internal/svg-icons/CheckBox.js +0 -12
  500. package/modern/internal/svg-icons/CheckBoxOutlineBlank.js +0 -12
  501. package/modern/internal/svg-icons/CheckCircle.js +0 -12
  502. package/modern/internal/svg-icons/Close.js +0 -14
  503. package/modern/internal/svg-icons/ErrorOutline.js +0 -12
  504. package/modern/internal/svg-icons/FirstPage.js +0 -12
  505. package/modern/internal/svg-icons/IndeterminateCheckBox.js +0 -12
  506. package/modern/internal/svg-icons/InfoOutlined.js +0 -12
  507. package/modern/internal/svg-icons/KeyboardArrowLeft.js +0 -12
  508. package/modern/internal/svg-icons/KeyboardArrowRight.js +0 -12
  509. package/modern/internal/svg-icons/LastPage.js +0 -12
  510. package/modern/internal/svg-icons/MoreHoriz.js +0 -12
  511. package/modern/internal/svg-icons/NavigateBefore.js +0 -12
  512. package/modern/internal/svg-icons/NavigateNext.js +0 -12
  513. package/modern/internal/svg-icons/Person.js +0 -12
  514. package/modern/internal/svg-icons/RadioButtonChecked.js +0 -12
  515. package/modern/internal/svg-icons/RadioButtonUnchecked.js +0 -12
  516. package/modern/internal/svg-icons/ReportProblemOutlined.js +0 -12
  517. package/modern/internal/svg-icons/Star.js +0 -12
  518. package/modern/internal/svg-icons/StarBorder.js +0 -12
  519. package/modern/internal/svg-icons/SuccessOutlined.js +0 -12
  520. package/modern/internal/svg-icons/Warning.js +0 -12
  521. package/modern/internal/switchBaseClasses.js +0 -7
  522. package/modern/locale/index.js +0 -4324
  523. package/modern/package.json +0 -1
  524. package/modern/styles/ThemeProvider.js +0 -40
  525. package/modern/styles/ThemeProviderNoVars.js +0 -17
  526. package/modern/styles/ThemeProviderWithVars.js +0 -91
  527. package/modern/styles/adaptV4Theme.js +0 -83
  528. package/modern/styles/components.js +0 -1
  529. package/modern/styles/createColorScheme.js +0 -41
  530. package/modern/styles/createGetSelector.js +0 -60
  531. package/modern/styles/createMixins.js +0 -16
  532. package/modern/styles/createMuiStrictModeTheme.js +0 -7
  533. package/modern/styles/createPalette.js +0 -302
  534. package/modern/styles/createStyles.js +0 -10
  535. package/modern/styles/createTheme.js +0 -98
  536. package/modern/styles/createThemeNoVars.js +0 -91
  537. package/modern/styles/createThemeWithVars.js +0 -386
  538. package/modern/styles/createTransitions.js +0 -89
  539. package/modern/styles/createTypography.js +0 -92
  540. package/modern/styles/cssUtils.js +0 -125
  541. package/modern/styles/defaultTheme.js +0 -5
  542. package/modern/styles/excludeVariablesFromRoot.js +0 -5
  543. package/modern/styles/experimental_extendTheme.js +0 -9
  544. package/modern/styles/getOverlayAlpha.js +0 -10
  545. package/modern/styles/identifier.js +0 -1
  546. package/modern/styles/index.js +0 -37
  547. package/modern/styles/makeStyles.js +0 -4
  548. package/modern/styles/overrides.js +0 -1
  549. package/modern/styles/props.js +0 -1
  550. package/modern/styles/responsiveFontSizes.js +0 -67
  551. package/modern/styles/rootShouldForwardProp.js +0 -3
  552. package/modern/styles/shadows.js +0 -10
  553. package/modern/styles/shouldSkipGeneratingVar.js +0 -5
  554. package/modern/styles/slotShouldForwardProp.js +0 -5
  555. package/modern/styles/stringifyTheme.js +0 -54
  556. package/modern/styles/styled.js +0 -14
  557. package/modern/styles/useTheme.js +0 -15
  558. package/modern/styles/useThemeProps.js +0 -16
  559. package/modern/styles/variants.js +0 -1
  560. package/modern/styles/withStyles.js +0 -4
  561. package/modern/styles/withTheme.js +0 -4
  562. package/modern/styles/zIndex.js +0 -13
  563. package/modern/transitions/index.js +0 -1
  564. package/modern/transitions/transition.js +0 -1
  565. package/modern/transitions/utils.js +0 -13
  566. package/modern/types/OverridableComponentAugmentation.js +0 -1
  567. package/modern/useAutocomplete/index.js +0 -1
  568. package/modern/useAutocomplete/useAutocomplete.js +0 -973
  569. package/modern/useLazyRipple/index.js +0 -3
  570. package/modern/useLazyRipple/useLazyRipple.js +0 -85
  571. package/modern/useMediaQuery/index.js +0 -6
  572. package/modern/usePagination/index.js +0 -1
  573. package/modern/usePagination/usePagination.js +0 -113
  574. package/modern/useScrollTrigger/index.js +0 -1
  575. package/modern/useScrollTrigger/useScrollTrigger.js +0 -55
  576. package/modern/utils/PolymorphicComponent.js +0 -1
  577. package/modern/utils/areArraysEqual.js +0 -4
  578. package/modern/utils/capitalize.js +0 -2
  579. package/modern/utils/createChainedFunction.js +0 -2
  580. package/modern/utils/createSimplePaletteValueFilter.js +0 -41
  581. package/modern/utils/createSvgIcon.js +0 -26
  582. package/modern/utils/debounce.js +0 -2
  583. package/modern/utils/deprecatedPropType.js +0 -2
  584. package/modern/utils/getScrollbarSize.js +0 -2
  585. package/modern/utils/index.js +0 -31
  586. package/modern/utils/isHostComponent.js +0 -7
  587. package/modern/utils/isMuiElement.js +0 -2
  588. package/modern/utils/memoTheme.js +0 -3
  589. package/modern/utils/mergeSlotProps.js +0 -75
  590. package/modern/utils/omitEventHandlers.js +0 -18
  591. package/modern/utils/ownerDocument.js +0 -2
  592. package/modern/utils/ownerWindow.js +0 -2
  593. package/modern/utils/requirePropFactory.js +0 -2
  594. package/modern/utils/setRef.js +0 -2
  595. package/modern/utils/shouldSpreadAdditionalProps.js +0 -5
  596. package/modern/utils/types.js +0 -1
  597. package/modern/utils/unsupportedProp.js +0 -2
  598. package/modern/utils/useControlled.js +0 -4
  599. package/modern/utils/useEnhancedEffect.js +0 -4
  600. package/modern/utils/useEventCallback.js +0 -4
  601. package/modern/utils/useForkRef.js +0 -4
  602. package/modern/utils/useId.js +0 -4
  603. package/modern/utils/useSlot.js +0 -80
  604. package/modern/version/index.js +0 -6
  605. package/modern/zero-styled/index.js +0 -27
  606. package/tsconfig.build.tsbuildinfo +0 -1
@@ -1,973 +0,0 @@
1
- 'use client';
2
-
3
- /* eslint-disable no-constant-condition */
4
- import * as React from 'react';
5
- import { unstable_setRef as setRef, unstable_useEventCallback as useEventCallback, unstable_useControlled as useControlled, unstable_useId as useId, usePreviousProps } from '@mui/utils';
6
-
7
- // https://stackoverflow.com/questions/990904/remove-accents-diacritics-in-a-string-in-javascript
8
- function stripDiacritics(string) {
9
- return string.normalize('NFD').replace(/[\u0300-\u036f]/g, '');
10
- }
11
- export function createFilterOptions(config = {}) {
12
- const {
13
- ignoreAccents = true,
14
- ignoreCase = true,
15
- limit,
16
- matchFrom = 'any',
17
- stringify,
18
- trim = false
19
- } = config;
20
- return (options, {
21
- inputValue,
22
- getOptionLabel
23
- }) => {
24
- let input = trim ? inputValue.trim() : inputValue;
25
- if (ignoreCase) {
26
- input = input.toLowerCase();
27
- }
28
- if (ignoreAccents) {
29
- input = stripDiacritics(input);
30
- }
31
- const filteredOptions = !input ? options : options.filter(option => {
32
- let candidate = (stringify || getOptionLabel)(option);
33
- if (ignoreCase) {
34
- candidate = candidate.toLowerCase();
35
- }
36
- if (ignoreAccents) {
37
- candidate = stripDiacritics(candidate);
38
- }
39
- return matchFrom === 'start' ? candidate.startsWith(input) : candidate.includes(input);
40
- });
41
- return typeof limit === 'number' ? filteredOptions.slice(0, limit) : filteredOptions;
42
- };
43
- }
44
- const defaultFilterOptions = createFilterOptions();
45
-
46
- // Number of options to jump in list box when `Page Up` and `Page Down` keys are used.
47
- const pageSize = 5;
48
- const defaultIsActiveElementInListbox = listboxRef => listboxRef.current !== null && listboxRef.current.parentElement?.contains(document.activeElement);
49
- const MULTIPLE_DEFAULT_VALUE = [];
50
- function getInputValue(value, multiple, getOptionLabel) {
51
- if (multiple || value == null) {
52
- return '';
53
- }
54
- const optionLabel = getOptionLabel(value);
55
- return typeof optionLabel === 'string' ? optionLabel : '';
56
- }
57
- function useAutocomplete(props) {
58
- const {
59
- // eslint-disable-next-line @typescript-eslint/naming-convention
60
- unstable_isActiveElementInListbox = defaultIsActiveElementInListbox,
61
- // eslint-disable-next-line @typescript-eslint/naming-convention
62
- unstable_classNamePrefix = 'Mui',
63
- autoComplete = false,
64
- autoHighlight = false,
65
- autoSelect = false,
66
- blurOnSelect = false,
67
- clearOnBlur = !props.freeSolo,
68
- clearOnEscape = false,
69
- componentName = 'useAutocomplete',
70
- defaultValue = props.multiple ? MULTIPLE_DEFAULT_VALUE : null,
71
- disableClearable = false,
72
- disableCloseOnSelect = false,
73
- disabled: disabledProp,
74
- disabledItemsFocusable = false,
75
- disableListWrap = false,
76
- filterOptions = defaultFilterOptions,
77
- filterSelectedOptions = false,
78
- freeSolo = false,
79
- getOptionDisabled,
80
- getOptionKey,
81
- getOptionLabel: getOptionLabelProp = option => option.label ?? option,
82
- groupBy,
83
- handleHomeEndKeys = !props.freeSolo,
84
- id: idProp,
85
- includeInputInList = false,
86
- inputValue: inputValueProp,
87
- isOptionEqualToValue = (option, value) => option === value,
88
- multiple = false,
89
- onChange,
90
- onClose,
91
- onHighlightChange,
92
- onInputChange,
93
- onOpen,
94
- open: openProp,
95
- openOnFocus = false,
96
- options,
97
- readOnly = false,
98
- selectOnFocus = !props.freeSolo,
99
- value: valueProp
100
- } = props;
101
- const id = useId(idProp);
102
- let getOptionLabel = getOptionLabelProp;
103
- getOptionLabel = option => {
104
- const optionLabel = getOptionLabelProp(option);
105
- if (typeof optionLabel !== 'string') {
106
- if (process.env.NODE_ENV !== 'production') {
107
- const erroneousReturn = optionLabel === undefined ? 'undefined' : `${typeof optionLabel} (${optionLabel})`;
108
- console.error(`MUI: The \`getOptionLabel\` method of ${componentName} returned ${erroneousReturn} instead of a string for ${JSON.stringify(option)}.`);
109
- }
110
- return String(optionLabel);
111
- }
112
- return optionLabel;
113
- };
114
- const ignoreFocus = React.useRef(false);
115
- const firstFocus = React.useRef(true);
116
- const inputRef = React.useRef(null);
117
- const listboxRef = React.useRef(null);
118
- const [anchorEl, setAnchorEl] = React.useState(null);
119
- const [focusedTag, setFocusedTag] = React.useState(-1);
120
- const defaultHighlighted = autoHighlight ? 0 : -1;
121
- const highlightedIndexRef = React.useRef(defaultHighlighted);
122
-
123
- // Calculate the initial inputValue on mount only.
124
- // Using useRef since defaultValue doesn't need to update inputValue dynamically.
125
- const initialInputValue = React.useRef(getInputValue(defaultValue, multiple, getOptionLabel)).current;
126
- const [value, setValueState] = useControlled({
127
- controlled: valueProp,
128
- default: defaultValue,
129
- name: componentName
130
- });
131
- const [inputValue, setInputValueState] = useControlled({
132
- controlled: inputValueProp,
133
- default: initialInputValue,
134
- name: componentName,
135
- state: 'inputValue'
136
- });
137
- const [focused, setFocused] = React.useState(false);
138
- const resetInputValue = React.useCallback((event, newValue, reason) => {
139
- // retain current `inputValue` if new option isn't selected and `clearOnBlur` is false
140
- // When `multiple` is enabled, `newValue` is an array of all selected items including the newly selected item
141
- const isOptionSelected = multiple ? value.length < newValue.length : newValue !== null;
142
- if (!isOptionSelected && !clearOnBlur) {
143
- return;
144
- }
145
- const newInputValue = getInputValue(newValue, multiple, getOptionLabel);
146
- if (inputValue === newInputValue) {
147
- return;
148
- }
149
- setInputValueState(newInputValue);
150
- if (onInputChange) {
151
- onInputChange(event, newInputValue, reason);
152
- }
153
- }, [getOptionLabel, inputValue, multiple, onInputChange, setInputValueState, clearOnBlur, value]);
154
- const [open, setOpenState] = useControlled({
155
- controlled: openProp,
156
- default: false,
157
- name: componentName,
158
- state: 'open'
159
- });
160
- const [inputPristine, setInputPristine] = React.useState(true);
161
- const inputValueIsSelectedValue = !multiple && value != null && inputValue === getOptionLabel(value);
162
- const popupOpen = open && !readOnly;
163
- const filteredOptions = popupOpen ? filterOptions(options.filter(option => {
164
- if (filterSelectedOptions && (multiple ? value : [value]).some(value2 => value2 !== null && isOptionEqualToValue(option, value2))) {
165
- return false;
166
- }
167
- return true;
168
- }),
169
- // we use the empty string to manipulate `filterOptions` to not filter any options
170
- // i.e. the filter predicate always returns true
171
- {
172
- inputValue: inputValueIsSelectedValue && inputPristine ? '' : inputValue,
173
- getOptionLabel
174
- }) : [];
175
- const previousProps = usePreviousProps({
176
- filteredOptions,
177
- value,
178
- inputValue
179
- });
180
- React.useEffect(() => {
181
- const valueChange = value !== previousProps.value;
182
- if (focused && !valueChange) {
183
- return;
184
- }
185
-
186
- // Only reset the input's value when freeSolo if the component's value changes.
187
- if (freeSolo && !valueChange) {
188
- return;
189
- }
190
- resetInputValue(null, value, 'reset');
191
- }, [value, resetInputValue, focused, previousProps.value, freeSolo]);
192
- const listboxAvailable = open && filteredOptions.length > 0 && !readOnly;
193
- const focusTag = useEventCallback(tagToFocus => {
194
- if (tagToFocus === -1) {
195
- inputRef.current.focus();
196
- } else {
197
- anchorEl.querySelector(`[data-tag-index="${tagToFocus}"]`).focus();
198
- }
199
- });
200
-
201
- // Ensure the focusedTag is never inconsistent
202
- React.useEffect(() => {
203
- if (multiple && focusedTag > value.length - 1) {
204
- setFocusedTag(-1);
205
- focusTag(-1);
206
- }
207
- }, [value, multiple, focusedTag, focusTag]);
208
- function validOptionIndex(index, direction) {
209
- if (!listboxRef.current || index < 0 || index >= filteredOptions.length) {
210
- return -1;
211
- }
212
- let nextFocus = index;
213
- while (true) {
214
- const option = listboxRef.current.querySelector(`[data-option-index="${nextFocus}"]`);
215
-
216
- // Same logic as MenuList.js
217
- const nextFocusDisabled = disabledItemsFocusable ? false : !option || option.disabled || option.getAttribute('aria-disabled') === 'true';
218
- if (option && option.hasAttribute('tabindex') && !nextFocusDisabled) {
219
- // The next option is available
220
- return nextFocus;
221
- }
222
-
223
- // The next option is disabled, move to the next element.
224
- // with looped index
225
- if (direction === 'next') {
226
- nextFocus = (nextFocus + 1) % filteredOptions.length;
227
- } else {
228
- nextFocus = (nextFocus - 1 + filteredOptions.length) % filteredOptions.length;
229
- }
230
-
231
- // We end up with initial index, that means we don't have available options.
232
- // All of them are disabled
233
- if (nextFocus === index) {
234
- return -1;
235
- }
236
- }
237
- }
238
- const setHighlightedIndex = useEventCallback(({
239
- event,
240
- index,
241
- reason
242
- }) => {
243
- highlightedIndexRef.current = index;
244
-
245
- // does the index exist?
246
- if (index === -1) {
247
- inputRef.current.removeAttribute('aria-activedescendant');
248
- } else {
249
- inputRef.current.setAttribute('aria-activedescendant', `${id}-option-${index}`);
250
- }
251
- if (onHighlightChange && ['mouse', 'keyboard', 'touch'].includes(reason)) {
252
- onHighlightChange(event, index === -1 ? null : filteredOptions[index], reason);
253
- }
254
- if (!listboxRef.current) {
255
- return;
256
- }
257
- const prev = listboxRef.current.querySelector(`[role="option"].${unstable_classNamePrefix}-focused`);
258
- if (prev) {
259
- prev.classList.remove(`${unstable_classNamePrefix}-focused`);
260
- prev.classList.remove(`${unstable_classNamePrefix}-focusVisible`);
261
- }
262
- let listboxNode = listboxRef.current;
263
- if (listboxRef.current.getAttribute('role') !== 'listbox') {
264
- listboxNode = listboxRef.current.parentElement.querySelector('[role="listbox"]');
265
- }
266
-
267
- // "No results"
268
- if (!listboxNode) {
269
- return;
270
- }
271
- if (index === -1) {
272
- listboxNode.scrollTop = 0;
273
- return;
274
- }
275
- const option = listboxRef.current.querySelector(`[data-option-index="${index}"]`);
276
- if (!option) {
277
- return;
278
- }
279
- option.classList.add(`${unstable_classNamePrefix}-focused`);
280
- if (reason === 'keyboard') {
281
- option.classList.add(`${unstable_classNamePrefix}-focusVisible`);
282
- }
283
-
284
- // Scroll active descendant into view.
285
- // Logic copied from https://www.w3.org/WAI/content-assets/wai-aria-practices/patterns/combobox/examples/js/select-only.js
286
- // In case of mouse clicks and touch (in mobile devices) we avoid scrolling the element and keep both behaviors same.
287
- // Consider this API instead once it has a better browser support:
288
- // .scrollIntoView({ scrollMode: 'if-needed', block: 'nearest' });
289
- if (listboxNode.scrollHeight > listboxNode.clientHeight && reason !== 'mouse' && reason !== 'touch') {
290
- const element = option;
291
- const scrollBottom = listboxNode.clientHeight + listboxNode.scrollTop;
292
- const elementBottom = element.offsetTop + element.offsetHeight;
293
- if (elementBottom > scrollBottom) {
294
- listboxNode.scrollTop = elementBottom - listboxNode.clientHeight;
295
- } else if (element.offsetTop - element.offsetHeight * (groupBy ? 1.3 : 0) < listboxNode.scrollTop) {
296
- listboxNode.scrollTop = element.offsetTop - element.offsetHeight * (groupBy ? 1.3 : 0);
297
- }
298
- }
299
- });
300
- const changeHighlightedIndex = useEventCallback(({
301
- event,
302
- diff,
303
- direction = 'next',
304
- reason
305
- }) => {
306
- if (!popupOpen) {
307
- return;
308
- }
309
- const getNextIndex = () => {
310
- const maxIndex = filteredOptions.length - 1;
311
- if (diff === 'reset') {
312
- return defaultHighlighted;
313
- }
314
- if (diff === 'start') {
315
- return 0;
316
- }
317
- if (diff === 'end') {
318
- return maxIndex;
319
- }
320
- const newIndex = highlightedIndexRef.current + diff;
321
- if (newIndex < 0) {
322
- if (newIndex === -1 && includeInputInList) {
323
- return -1;
324
- }
325
- if (disableListWrap && highlightedIndexRef.current !== -1 || Math.abs(diff) > 1) {
326
- return 0;
327
- }
328
- return maxIndex;
329
- }
330
- if (newIndex > maxIndex) {
331
- if (newIndex === maxIndex + 1 && includeInputInList) {
332
- return -1;
333
- }
334
- if (disableListWrap || Math.abs(diff) > 1) {
335
- return maxIndex;
336
- }
337
- return 0;
338
- }
339
- return newIndex;
340
- };
341
- const nextIndex = validOptionIndex(getNextIndex(), direction);
342
- setHighlightedIndex({
343
- index: nextIndex,
344
- reason,
345
- event
346
- });
347
-
348
- // Sync the content of the input with the highlighted option.
349
- if (autoComplete && diff !== 'reset') {
350
- if (nextIndex === -1) {
351
- inputRef.current.value = inputValue;
352
- } else {
353
- const option = getOptionLabel(filteredOptions[nextIndex]);
354
- inputRef.current.value = option;
355
-
356
- // The portion of the selected suggestion that has not been typed by the user,
357
- // a completion string, appears inline after the input cursor in the textbox.
358
- const index = option.toLowerCase().indexOf(inputValue.toLowerCase());
359
- if (index === 0 && inputValue.length > 0) {
360
- inputRef.current.setSelectionRange(inputValue.length, option.length);
361
- }
362
- }
363
- }
364
- });
365
- const getPreviousHighlightedOptionIndex = () => {
366
- const isSameValue = (value1, value2) => {
367
- const label1 = value1 ? getOptionLabel(value1) : '';
368
- const label2 = value2 ? getOptionLabel(value2) : '';
369
- return label1 === label2;
370
- };
371
- if (highlightedIndexRef.current !== -1 && previousProps.filteredOptions && previousProps.filteredOptions.length !== filteredOptions.length && previousProps.inputValue === inputValue && (multiple ? value.length === previousProps.value.length && previousProps.value.every((val, i) => getOptionLabel(value[i]) === getOptionLabel(val)) : isSameValue(previousProps.value, value))) {
372
- const previousHighlightedOption = previousProps.filteredOptions[highlightedIndexRef.current];
373
- if (previousHighlightedOption) {
374
- return filteredOptions.findIndex(option => {
375
- return getOptionLabel(option) === getOptionLabel(previousHighlightedOption);
376
- });
377
- }
378
- }
379
- return -1;
380
- };
381
- const syncHighlightedIndex = React.useCallback(() => {
382
- if (!popupOpen) {
383
- return;
384
- }
385
-
386
- // Check if the previously highlighted option still exists in the updated filtered options list and if the value and inputValue haven't changed
387
- // If it exists and the value and the inputValue haven't changed, just update its index, otherwise continue execution
388
- const previousHighlightedOptionIndex = getPreviousHighlightedOptionIndex();
389
- if (previousHighlightedOptionIndex !== -1) {
390
- highlightedIndexRef.current = previousHighlightedOptionIndex;
391
- return;
392
- }
393
- const valueItem = multiple ? value[0] : value;
394
-
395
- // The popup is empty, reset
396
- if (filteredOptions.length === 0 || valueItem == null) {
397
- changeHighlightedIndex({
398
- diff: 'reset'
399
- });
400
- return;
401
- }
402
- if (!listboxRef.current) {
403
- return;
404
- }
405
-
406
- // Synchronize the value with the highlighted index
407
- if (valueItem != null) {
408
- const currentOption = filteredOptions[highlightedIndexRef.current];
409
-
410
- // Keep the current highlighted index if possible
411
- if (multiple && currentOption && value.findIndex(val => isOptionEqualToValue(currentOption, val)) !== -1) {
412
- return;
413
- }
414
- const itemIndex = filteredOptions.findIndex(optionItem => isOptionEqualToValue(optionItem, valueItem));
415
- if (itemIndex === -1) {
416
- changeHighlightedIndex({
417
- diff: 'reset'
418
- });
419
- } else {
420
- setHighlightedIndex({
421
- index: itemIndex
422
- });
423
- }
424
- return;
425
- }
426
-
427
- // Prevent the highlighted index to leak outside the boundaries.
428
- if (highlightedIndexRef.current >= filteredOptions.length - 1) {
429
- setHighlightedIndex({
430
- index: filteredOptions.length - 1
431
- });
432
- return;
433
- }
434
-
435
- // Restore the focus to the previous index.
436
- setHighlightedIndex({
437
- index: highlightedIndexRef.current
438
- });
439
- // Ignore filteredOptions (and options, isOptionEqualToValue, getOptionLabel) not to break the scroll position
440
- // eslint-disable-next-line react-hooks/exhaustive-deps
441
- }, [
442
- // Only sync the highlighted index when the option switch between empty and not
443
- filteredOptions.length,
444
- // Don't sync the highlighted index with the value when multiple
445
- // eslint-disable-next-line react-hooks/exhaustive-deps
446
- multiple ? false : value, filterSelectedOptions, changeHighlightedIndex, setHighlightedIndex, popupOpen, inputValue, multiple]);
447
- const handleListboxRef = useEventCallback(node => {
448
- setRef(listboxRef, node);
449
- if (!node) {
450
- return;
451
- }
452
- syncHighlightedIndex();
453
- });
454
- if (process.env.NODE_ENV !== 'production') {
455
- // eslint-disable-next-line react-hooks/rules-of-hooks
456
- React.useEffect(() => {
457
- if (!inputRef.current || inputRef.current.nodeName !== 'INPUT') {
458
- if (inputRef.current && inputRef.current.nodeName === 'TEXTAREA') {
459
- console.warn([`A textarea element was provided to ${componentName} where input was expected.`, `This is not a supported scenario but it may work under certain conditions.`, `A textarea keyboard navigation may conflict with Autocomplete controls (for example enter and arrow keys).`, `Make sure to test keyboard navigation and add custom event handlers if necessary.`].join('\n'));
460
- } else {
461
- console.error([`MUI: Unable to find the input element. It was resolved to ${inputRef.current} while an HTMLInputElement was expected.`, `Instead, ${componentName} expects an input element.`, '', componentName === 'useAutocomplete' ? 'Make sure you have bound getInputProps correctly and that the normal ref/effect resolutions order is guaranteed.' : 'Make sure you have customized the input component correctly.'].join('\n'));
462
- }
463
- }
464
- }, [componentName]);
465
- }
466
- React.useEffect(() => {
467
- syncHighlightedIndex();
468
- }, [syncHighlightedIndex]);
469
- const handleOpen = event => {
470
- if (open) {
471
- return;
472
- }
473
- setOpenState(true);
474
- setInputPristine(true);
475
- if (onOpen) {
476
- onOpen(event);
477
- }
478
- };
479
- const handleClose = (event, reason) => {
480
- if (!open) {
481
- return;
482
- }
483
- setOpenState(false);
484
- if (onClose) {
485
- onClose(event, reason);
486
- }
487
- };
488
- const handleValue = (event, newValue, reason, details) => {
489
- if (multiple) {
490
- if (value.length === newValue.length && value.every((val, i) => val === newValue[i])) {
491
- return;
492
- }
493
- } else if (value === newValue) {
494
- return;
495
- }
496
- if (onChange) {
497
- onChange(event, newValue, reason, details);
498
- }
499
- setValueState(newValue);
500
- };
501
- const isTouch = React.useRef(false);
502
- const selectNewValue = (event, option, reasonProp = 'selectOption', origin = 'options') => {
503
- let reason = reasonProp;
504
- let newValue = option;
505
- if (multiple) {
506
- newValue = Array.isArray(value) ? value.slice() : [];
507
- if (process.env.NODE_ENV !== 'production') {
508
- const matches = newValue.filter(val => isOptionEqualToValue(option, val));
509
- if (matches.length > 1) {
510
- console.error([`MUI: The \`isOptionEqualToValue\` method of ${componentName} does not handle the arguments correctly.`, `The component expects a single value to match a given option but found ${matches.length} matches.`].join('\n'));
511
- }
512
- }
513
- const itemIndex = newValue.findIndex(valueItem => isOptionEqualToValue(option, valueItem));
514
- if (itemIndex === -1) {
515
- newValue.push(option);
516
- } else if (origin !== 'freeSolo') {
517
- newValue.splice(itemIndex, 1);
518
- reason = 'removeOption';
519
- }
520
- }
521
- resetInputValue(event, newValue, reason);
522
- handleValue(event, newValue, reason, {
523
- option
524
- });
525
- if (!disableCloseOnSelect && (!event || !event.ctrlKey && !event.metaKey)) {
526
- handleClose(event, reason);
527
- }
528
- if (blurOnSelect === true || blurOnSelect === 'touch' && isTouch.current || blurOnSelect === 'mouse' && !isTouch.current) {
529
- inputRef.current.blur();
530
- }
531
- };
532
- function validTagIndex(index, direction) {
533
- if (index === -1) {
534
- return -1;
535
- }
536
- let nextFocus = index;
537
- while (true) {
538
- // Out of range
539
- if (direction === 'next' && nextFocus === value.length || direction === 'previous' && nextFocus === -1) {
540
- return -1;
541
- }
542
- const option = anchorEl.querySelector(`[data-tag-index="${nextFocus}"]`);
543
-
544
- // Same logic as MenuList.js
545
- if (!option || !option.hasAttribute('tabindex') || option.disabled || option.getAttribute('aria-disabled') === 'true') {
546
- nextFocus += direction === 'next' ? 1 : -1;
547
- } else {
548
- return nextFocus;
549
- }
550
- }
551
- }
552
- const handleFocusTag = (event, direction) => {
553
- if (!multiple) {
554
- return;
555
- }
556
- if (inputValue === '') {
557
- handleClose(event, 'toggleInput');
558
- }
559
- let nextTag = focusedTag;
560
- if (focusedTag === -1) {
561
- if (inputValue === '' && direction === 'previous') {
562
- nextTag = value.length - 1;
563
- }
564
- } else {
565
- nextTag += direction === 'next' ? 1 : -1;
566
- if (nextTag < 0) {
567
- nextTag = 0;
568
- }
569
- if (nextTag === value.length) {
570
- nextTag = -1;
571
- }
572
- }
573
- nextTag = validTagIndex(nextTag, direction);
574
- setFocusedTag(nextTag);
575
- focusTag(nextTag);
576
- };
577
- const handleClear = event => {
578
- ignoreFocus.current = true;
579
- setInputValueState('');
580
- if (onInputChange) {
581
- onInputChange(event, '', 'clear');
582
- }
583
- handleValue(event, multiple ? [] : null, 'clear');
584
- };
585
- const handleKeyDown = other => event => {
586
- if (other.onKeyDown) {
587
- other.onKeyDown(event);
588
- }
589
- if (event.defaultMuiPrevented) {
590
- return;
591
- }
592
- if (focusedTag !== -1 && !['ArrowLeft', 'ArrowRight'].includes(event.key)) {
593
- setFocusedTag(-1);
594
- focusTag(-1);
595
- }
596
-
597
- // Wait until IME is settled.
598
- if (event.which !== 229) {
599
- switch (event.key) {
600
- case 'Home':
601
- if (popupOpen && handleHomeEndKeys) {
602
- // Prevent scroll of the page
603
- event.preventDefault();
604
- changeHighlightedIndex({
605
- diff: 'start',
606
- direction: 'next',
607
- reason: 'keyboard',
608
- event
609
- });
610
- }
611
- break;
612
- case 'End':
613
- if (popupOpen && handleHomeEndKeys) {
614
- // Prevent scroll of the page
615
- event.preventDefault();
616
- changeHighlightedIndex({
617
- diff: 'end',
618
- direction: 'previous',
619
- reason: 'keyboard',
620
- event
621
- });
622
- }
623
- break;
624
- case 'PageUp':
625
- // Prevent scroll of the page
626
- event.preventDefault();
627
- changeHighlightedIndex({
628
- diff: -pageSize,
629
- direction: 'previous',
630
- reason: 'keyboard',
631
- event
632
- });
633
- handleOpen(event);
634
- break;
635
- case 'PageDown':
636
- // Prevent scroll of the page
637
- event.preventDefault();
638
- changeHighlightedIndex({
639
- diff: pageSize,
640
- direction: 'next',
641
- reason: 'keyboard',
642
- event
643
- });
644
- handleOpen(event);
645
- break;
646
- case 'ArrowDown':
647
- // Prevent cursor move
648
- event.preventDefault();
649
- changeHighlightedIndex({
650
- diff: 1,
651
- direction: 'next',
652
- reason: 'keyboard',
653
- event
654
- });
655
- handleOpen(event);
656
- break;
657
- case 'ArrowUp':
658
- // Prevent cursor move
659
- event.preventDefault();
660
- changeHighlightedIndex({
661
- diff: -1,
662
- direction: 'previous',
663
- reason: 'keyboard',
664
- event
665
- });
666
- handleOpen(event);
667
- break;
668
- case 'ArrowLeft':
669
- handleFocusTag(event, 'previous');
670
- break;
671
- case 'ArrowRight':
672
- handleFocusTag(event, 'next');
673
- break;
674
- case 'Enter':
675
- if (highlightedIndexRef.current !== -1 && popupOpen) {
676
- const option = filteredOptions[highlightedIndexRef.current];
677
- const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
678
-
679
- // Avoid early form validation, let the end-users continue filling the form.
680
- event.preventDefault();
681
- if (disabled) {
682
- return;
683
- }
684
- selectNewValue(event, option, 'selectOption');
685
-
686
- // Move the selection to the end.
687
- if (autoComplete) {
688
- inputRef.current.setSelectionRange(inputRef.current.value.length, inputRef.current.value.length);
689
- }
690
- } else if (freeSolo && inputValue !== '' && inputValueIsSelectedValue === false) {
691
- if (multiple) {
692
- // Allow people to add new values before they submit the form.
693
- event.preventDefault();
694
- }
695
- selectNewValue(event, inputValue, 'createOption', 'freeSolo');
696
- }
697
- break;
698
- case 'Escape':
699
- if (popupOpen) {
700
- // Avoid Opera to exit fullscreen mode.
701
- event.preventDefault();
702
- // Avoid the Modal to handle the event.
703
- event.stopPropagation();
704
- handleClose(event, 'escape');
705
- } else if (clearOnEscape && (inputValue !== '' || multiple && value.length > 0)) {
706
- // Avoid Opera to exit fullscreen mode.
707
- event.preventDefault();
708
- // Avoid the Modal to handle the event.
709
- event.stopPropagation();
710
- handleClear(event);
711
- }
712
- break;
713
- case 'Backspace':
714
- // Remove the value on the left of the "cursor"
715
- if (multiple && !readOnly && inputValue === '' && value.length > 0) {
716
- const index = focusedTag === -1 ? value.length - 1 : focusedTag;
717
- const newValue = value.slice();
718
- newValue.splice(index, 1);
719
- handleValue(event, newValue, 'removeOption', {
720
- option: value[index]
721
- });
722
- }
723
- break;
724
- case 'Delete':
725
- // Remove the value on the right of the "cursor"
726
- if (multiple && !readOnly && inputValue === '' && value.length > 0 && focusedTag !== -1) {
727
- const index = focusedTag;
728
- const newValue = value.slice();
729
- newValue.splice(index, 1);
730
- handleValue(event, newValue, 'removeOption', {
731
- option: value[index]
732
- });
733
- }
734
- break;
735
- default:
736
- }
737
- }
738
- };
739
- const handleFocus = event => {
740
- setFocused(true);
741
- if (openOnFocus && !ignoreFocus.current) {
742
- handleOpen(event);
743
- }
744
- };
745
- const handleBlur = event => {
746
- // Ignore the event when using the scrollbar with IE11
747
- if (unstable_isActiveElementInListbox(listboxRef)) {
748
- inputRef.current.focus();
749
- return;
750
- }
751
- setFocused(false);
752
- firstFocus.current = true;
753
- ignoreFocus.current = false;
754
- if (autoSelect && highlightedIndexRef.current !== -1 && popupOpen) {
755
- selectNewValue(event, filteredOptions[highlightedIndexRef.current], 'blur');
756
- } else if (autoSelect && freeSolo && inputValue !== '') {
757
- selectNewValue(event, inputValue, 'blur', 'freeSolo');
758
- } else if (clearOnBlur) {
759
- resetInputValue(event, value, 'blur');
760
- }
761
- handleClose(event, 'blur');
762
- };
763
- const handleInputChange = event => {
764
- const newValue = event.target.value;
765
- if (inputValue !== newValue) {
766
- setInputValueState(newValue);
767
- setInputPristine(false);
768
- if (onInputChange) {
769
- onInputChange(event, newValue, 'input');
770
- }
771
- }
772
- if (newValue === '') {
773
- if (!disableClearable && !multiple) {
774
- handleValue(event, null, 'clear');
775
- }
776
- } else {
777
- handleOpen(event);
778
- }
779
- };
780
- const handleOptionMouseMove = event => {
781
- const index = Number(event.currentTarget.getAttribute('data-option-index'));
782
- if (highlightedIndexRef.current !== index) {
783
- setHighlightedIndex({
784
- event,
785
- index,
786
- reason: 'mouse'
787
- });
788
- }
789
- };
790
- const handleOptionTouchStart = event => {
791
- setHighlightedIndex({
792
- event,
793
- index: Number(event.currentTarget.getAttribute('data-option-index')),
794
- reason: 'touch'
795
- });
796
- isTouch.current = true;
797
- };
798
- const handleOptionClick = event => {
799
- const index = Number(event.currentTarget.getAttribute('data-option-index'));
800
- selectNewValue(event, filteredOptions[index], 'selectOption');
801
- isTouch.current = false;
802
- };
803
- const handleTagDelete = index => event => {
804
- const newValue = value.slice();
805
- newValue.splice(index, 1);
806
- handleValue(event, newValue, 'removeOption', {
807
- option: value[index]
808
- });
809
- };
810
- const handlePopupIndicator = event => {
811
- if (open) {
812
- handleClose(event, 'toggleInput');
813
- } else {
814
- handleOpen(event);
815
- }
816
- };
817
-
818
- // Prevent input blur when interacting with the combobox
819
- const handleMouseDown = event => {
820
- // Prevent focusing the input if click is anywhere outside the Autocomplete
821
- if (!event.currentTarget.contains(event.target)) {
822
- return;
823
- }
824
- if (event.target.getAttribute('id') !== id) {
825
- event.preventDefault();
826
- }
827
- };
828
-
829
- // Focus the input when interacting with the combobox
830
- const handleClick = event => {
831
- // Prevent focusing the input if click is anywhere outside the Autocomplete
832
- if (!event.currentTarget.contains(event.target)) {
833
- return;
834
- }
835
- inputRef.current.focus();
836
- if (selectOnFocus && firstFocus.current && inputRef.current.selectionEnd - inputRef.current.selectionStart === 0) {
837
- inputRef.current.select();
838
- }
839
- firstFocus.current = false;
840
- };
841
- const handleInputMouseDown = event => {
842
- if (!disabledProp && (inputValue === '' || !open)) {
843
- handlePopupIndicator(event);
844
- }
845
- };
846
- let dirty = freeSolo && inputValue.length > 0;
847
- dirty = dirty || (multiple ? value.length > 0 : value !== null);
848
- let groupedOptions = filteredOptions;
849
- if (groupBy) {
850
- // used to keep track of key and indexes in the result array
851
- const indexBy = new Map();
852
- let warn = false;
853
- groupedOptions = filteredOptions.reduce((acc, option, index) => {
854
- const group = groupBy(option);
855
- if (acc.length > 0 && acc[acc.length - 1].group === group) {
856
- acc[acc.length - 1].options.push(option);
857
- } else {
858
- if (process.env.NODE_ENV !== 'production') {
859
- if (indexBy.get(group) && !warn) {
860
- console.warn(`MUI: The options provided combined with the \`groupBy\` method of ${componentName} returns duplicated headers.`, 'You can solve the issue by sorting the options with the output of `groupBy`.');
861
- warn = true;
862
- }
863
- indexBy.set(group, true);
864
- }
865
- acc.push({
866
- key: index,
867
- index,
868
- group,
869
- options: [option]
870
- });
871
- }
872
- return acc;
873
- }, []);
874
- }
875
- if (disabledProp && focused) {
876
- handleBlur();
877
- }
878
- return {
879
- getRootProps: (other = {}) => ({
880
- ...other,
881
- onKeyDown: handleKeyDown(other),
882
- onMouseDown: handleMouseDown,
883
- onClick: handleClick
884
- }),
885
- getInputLabelProps: () => ({
886
- id: `${id}-label`,
887
- htmlFor: id
888
- }),
889
- getInputProps: () => ({
890
- id,
891
- value: inputValue,
892
- onBlur: handleBlur,
893
- onFocus: handleFocus,
894
- onChange: handleInputChange,
895
- onMouseDown: handleInputMouseDown,
896
- // if open then this is handled imperatively so don't let react override
897
- // only have an opinion about this when closed
898
- 'aria-activedescendant': popupOpen ? '' : null,
899
- 'aria-autocomplete': autoComplete ? 'both' : 'list',
900
- 'aria-controls': listboxAvailable ? `${id}-listbox` : undefined,
901
- 'aria-expanded': listboxAvailable,
902
- // Disable browser's suggestion that might overlap with the popup.
903
- // Handle autocomplete but not autofill.
904
- autoComplete: 'off',
905
- ref: inputRef,
906
- autoCapitalize: 'none',
907
- spellCheck: 'false',
908
- role: 'combobox',
909
- disabled: disabledProp
910
- }),
911
- getClearProps: () => ({
912
- tabIndex: -1,
913
- type: 'button',
914
- onClick: handleClear
915
- }),
916
- getPopupIndicatorProps: () => ({
917
- tabIndex: -1,
918
- type: 'button',
919
- onClick: handlePopupIndicator
920
- }),
921
- getTagProps: ({
922
- index
923
- }) => ({
924
- key: index,
925
- 'data-tag-index': index,
926
- tabIndex: -1,
927
- ...(!readOnly && {
928
- onDelete: handleTagDelete(index)
929
- })
930
- }),
931
- getListboxProps: () => ({
932
- role: 'listbox',
933
- id: `${id}-listbox`,
934
- 'aria-labelledby': `${id}-label`,
935
- ref: handleListboxRef,
936
- onMouseDown: event => {
937
- // Prevent blur
938
- event.preventDefault();
939
- }
940
- }),
941
- getOptionProps: ({
942
- index,
943
- option
944
- }) => {
945
- const selected = (multiple ? value : [value]).some(value2 => value2 != null && isOptionEqualToValue(option, value2));
946
- const disabled = getOptionDisabled ? getOptionDisabled(option) : false;
947
- return {
948
- key: getOptionKey?.(option) ?? getOptionLabel(option),
949
- tabIndex: -1,
950
- role: 'option',
951
- id: `${id}-option-${index}`,
952
- onMouseMove: handleOptionMouseMove,
953
- onClick: handleOptionClick,
954
- onTouchStart: handleOptionTouchStart,
955
- 'data-option-index': index,
956
- 'aria-disabled': disabled,
957
- 'aria-selected': selected
958
- };
959
- },
960
- id,
961
- inputValue,
962
- value,
963
- dirty,
964
- expanded: popupOpen && anchorEl,
965
- popupOpen,
966
- focused: focused || focusedTag !== -1,
967
- anchorEl,
968
- setAnchorEl,
969
- focusedTag,
970
- groupedOptions
971
- };
972
- }
973
- export default useAutocomplete;