@mui/material 9.0.0-beta.1 → 9.0.1

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 (419) hide show
  1. package/Accordion/Accordion.d.mts +3 -3
  2. package/Accordion/Accordion.d.ts +3 -3
  3. package/AccordionActions/AccordionActions.d.mts +2 -2
  4. package/AccordionActions/AccordionActions.d.ts +2 -2
  5. package/AccordionDetails/AccordionDetails.d.mts +2 -2
  6. package/AccordionDetails/AccordionDetails.d.ts +2 -2
  7. package/AccordionSummary/AccordionSummary.d.mts +3 -3
  8. package/AccordionSummary/AccordionSummary.d.ts +3 -3
  9. package/Alert/Alert.d.mts +3 -3
  10. package/Alert/Alert.d.ts +3 -3
  11. package/AlertTitle/AlertTitle.d.mts +3 -3
  12. package/AlertTitle/AlertTitle.d.ts +3 -3
  13. package/AppBar/AppBar.d.mts +3 -3
  14. package/AppBar/AppBar.d.ts +3 -3
  15. package/Autocomplete/Autocomplete.d.mts +2 -2
  16. package/Autocomplete/Autocomplete.d.ts +2 -2
  17. package/Autocomplete/Autocomplete.js +65 -11
  18. package/Autocomplete/Autocomplete.mjs +65 -11
  19. package/Avatar/Avatar.d.mts +2 -2
  20. package/Avatar/Avatar.d.ts +2 -2
  21. package/Avatar/Avatar.js +4 -0
  22. package/Avatar/Avatar.mjs +4 -0
  23. package/AvatarGroup/AvatarGroup.d.mts +2 -2
  24. package/AvatarGroup/AvatarGroup.d.ts +2 -2
  25. package/Backdrop/Backdrop.d.mts +3 -3
  26. package/Backdrop/Backdrop.d.ts +3 -3
  27. package/Badge/Badge.d.mts +3 -3
  28. package/Badge/Badge.d.ts +3 -3
  29. package/Badge/Badge.js +3 -0
  30. package/Badge/Badge.mjs +3 -0
  31. package/BottomNavigation/BottomNavigation.d.mts +2 -2
  32. package/BottomNavigation/BottomNavigation.d.ts +2 -2
  33. package/BottomNavigationAction/BottomNavigationAction.d.mts +3 -3
  34. package/BottomNavigationAction/BottomNavigationAction.d.ts +3 -3
  35. package/Box/Box.d.mts +3 -3
  36. package/Box/Box.d.ts +3 -3
  37. package/Breadcrumbs/Breadcrumbs.d.mts +3 -3
  38. package/Breadcrumbs/Breadcrumbs.d.ts +3 -3
  39. package/Button/Button.d.mts +6 -6
  40. package/Button/Button.d.ts +6 -6
  41. package/Button/Button.js +19 -2
  42. package/Button/Button.mjs +19 -2
  43. package/ButtonBase/ButtonBase.d.mts +9 -2
  44. package/ButtonBase/ButtonBase.d.ts +9 -2
  45. package/ButtonBase/ButtonBase.js +5 -2
  46. package/ButtonBase/ButtonBase.mjs +5 -2
  47. package/ButtonGroup/ButtonGroup.d.mts +2 -2
  48. package/ButtonGroup/ButtonGroup.d.ts +2 -2
  49. package/CHANGELOG.md +160 -1245
  50. package/Card/Card.d.mts +3 -3
  51. package/Card/Card.d.ts +3 -3
  52. package/CardActionArea/CardActionArea.d.mts +3 -3
  53. package/CardActionArea/CardActionArea.d.ts +3 -3
  54. package/CardActions/CardActions.d.mts +2 -2
  55. package/CardActions/CardActions.d.ts +2 -2
  56. package/CardContent/CardContent.d.mts +2 -2
  57. package/CardContent/CardContent.d.ts +2 -2
  58. package/CardHeader/CardHeader.d.mts +2 -2
  59. package/CardHeader/CardHeader.d.ts +2 -2
  60. package/CardMedia/CardMedia.d.mts +2 -2
  61. package/CardMedia/CardMedia.d.ts +2 -2
  62. package/Checkbox/Checkbox.d.mts +4 -4
  63. package/Checkbox/Checkbox.d.ts +4 -4
  64. package/Checkbox/Checkbox.js +2 -1
  65. package/Checkbox/Checkbox.mjs +2 -1
  66. package/Chip/Chip.d.mts +2 -2
  67. package/Chip/Chip.d.ts +2 -2
  68. package/CircularProgress/CircularProgress.d.mts +14 -4
  69. package/CircularProgress/CircularProgress.d.ts +14 -4
  70. package/CircularProgress/CircularProgress.js +33 -6
  71. package/CircularProgress/CircularProgress.mjs +33 -6
  72. package/ClickAwayListener/ClickAwayListener.d.mts +3 -3
  73. package/ClickAwayListener/ClickAwayListener.d.ts +3 -3
  74. package/ClickAwayListener/ClickAwayListener.js +6 -9
  75. package/ClickAwayListener/ClickAwayListener.mjs +6 -9
  76. package/Collapse/Collapse.d.mts +5 -5
  77. package/Collapse/Collapse.d.ts +5 -5
  78. package/Collapse/Collapse.js +6 -18
  79. package/Collapse/Collapse.mjs +7 -19
  80. package/Container/Container.d.mts +2 -2
  81. package/Container/Container.d.ts +2 -2
  82. package/CssBaseline/CssBaseline.d.mts +2 -2
  83. package/CssBaseline/CssBaseline.d.ts +2 -2
  84. package/Dialog/Dialog.d.mts +3 -3
  85. package/Dialog/Dialog.d.ts +3 -3
  86. package/Dialog/Dialog.js +11 -6
  87. package/Dialog/Dialog.mjs +11 -6
  88. package/DialogActions/DialogActions.d.mts +2 -2
  89. package/DialogActions/DialogActions.d.ts +2 -2
  90. package/DialogContent/DialogContent.d.mts +2 -2
  91. package/DialogContent/DialogContent.d.ts +2 -2
  92. package/DialogContentText/DialogContentText.d.mts +3 -3
  93. package/DialogContentText/DialogContentText.d.ts +3 -3
  94. package/DialogTitle/DialogTitle.d.mts +3 -3
  95. package/DialogTitle/DialogTitle.d.ts +3 -3
  96. package/Divider/Divider.d.mts +4 -4
  97. package/Divider/Divider.d.ts +4 -4
  98. package/Drawer/Drawer.d.mts +3 -3
  99. package/Drawer/Drawer.d.ts +3 -3
  100. package/Drawer/Drawer.js +19 -8
  101. package/Drawer/Drawer.mjs +19 -8
  102. package/Fab/Fab.d.mts +3 -3
  103. package/Fab/Fab.d.ts +3 -3
  104. package/Fab/Fab.js +7 -1
  105. package/Fab/Fab.mjs +7 -1
  106. package/Fade/Fade.d.mts +3 -3
  107. package/Fade/Fade.d.ts +3 -3
  108. package/Fade/Fade.js +28 -32
  109. package/Fade/Fade.mjs +29 -33
  110. package/FilledInput/FilledInput.d.mts +7 -3
  111. package/FilledInput/FilledInput.d.ts +7 -3
  112. package/FilledInput/FilledInput.js +18 -20
  113. package/FilledInput/FilledInput.mjs +18 -20
  114. package/FormControl/FormControl.d.mts +7 -7
  115. package/FormControl/FormControl.d.ts +7 -7
  116. package/FormControl/useFormControl.d.mts +12 -2
  117. package/FormControl/useFormControl.d.ts +12 -2
  118. package/FormControl/useFormControl.js +13 -0
  119. package/FormControl/useFormControl.mjs +12 -0
  120. package/FormControlLabel/FormControlLabel.d.mts +4 -4
  121. package/FormControlLabel/FormControlLabel.d.ts +4 -4
  122. package/FormControlLabel/FormControlLabel.js +5 -8
  123. package/FormControlLabel/FormControlLabel.mjs +5 -8
  124. package/FormGroup/FormGroup.d.mts +3 -3
  125. package/FormGroup/FormGroup.d.ts +3 -3
  126. package/FormGroup/FormGroup.js +2 -5
  127. package/FormGroup/FormGroup.mjs +2 -5
  128. package/FormHelperText/FormHelperText.d.mts +3 -3
  129. package/FormHelperText/FormHelperText.d.ts +3 -3
  130. package/FormHelperText/FormHelperText.js +2 -5
  131. package/FormHelperText/FormHelperText.mjs +2 -5
  132. package/FormLabel/FormLabel.d.mts +5 -5
  133. package/FormLabel/FormLabel.d.ts +5 -5
  134. package/FormLabel/FormLabel.js +2 -5
  135. package/FormLabel/FormLabel.mjs +2 -5
  136. package/GlobalStyles/GlobalStyles.d.mts +2 -2
  137. package/GlobalStyles/GlobalStyles.d.ts +2 -2
  138. package/Grid/Grid.d.mts +2 -2
  139. package/Grid/Grid.d.ts +2 -2
  140. package/Grid/Grid.js +2 -2
  141. package/Grid/Grid.mjs +2 -2
  142. package/Grow/Grow.d.mts +5 -5
  143. package/Grow/Grow.d.ts +5 -5
  144. package/Grow/Grow.js +30 -38
  145. package/Grow/Grow.mjs +31 -39
  146. package/Icon/Icon.d.mts +3 -3
  147. package/Icon/Icon.d.ts +3 -3
  148. package/IconButton/IconButton.d.mts +5 -5
  149. package/IconButton/IconButton.d.ts +5 -5
  150. package/IconButton/IconButton.js +1 -8
  151. package/IconButton/IconButton.mjs +1 -8
  152. package/ImageList/ImageList.d.mts +2 -2
  153. package/ImageList/ImageList.d.ts +2 -2
  154. package/ImageListItem/ImageListItem.d.mts +2 -2
  155. package/ImageListItem/ImageListItem.d.ts +2 -2
  156. package/ImageListItemBar/ImageListItemBar.d.mts +2 -2
  157. package/ImageListItemBar/ImageListItemBar.d.ts +2 -2
  158. package/InitColorSchemeScript/InitColorSchemeScript.d.mts +2 -2
  159. package/InitColorSchemeScript/InitColorSchemeScript.d.ts +2 -2
  160. package/InitColorSchemeScript/InitColorSchemeScript.js +2 -2
  161. package/InitColorSchemeScript/InitColorSchemeScript.mjs +2 -2
  162. package/Input/Input.d.mts +7 -3
  163. package/Input/Input.d.ts +7 -3
  164. package/Input/Input.js +6 -0
  165. package/Input/Input.mjs +6 -0
  166. package/InputAdornment/InputAdornment.d.mts +2 -2
  167. package/InputAdornment/InputAdornment.d.ts +2 -2
  168. package/InputBase/InputBase.d.mts +4 -3
  169. package/InputBase/InputBase.d.ts +4 -3
  170. package/InputBase/InputBase.js +50 -15
  171. package/InputBase/InputBase.mjs +50 -15
  172. package/InputLabel/InputLabel.d.mts +4 -4
  173. package/InputLabel/InputLabel.d.ts +4 -4
  174. package/InputLabel/InputLabel.js +5 -8
  175. package/InputLabel/InputLabel.mjs +5 -8
  176. package/LinearProgress/LinearProgress.d.mts +14 -4
  177. package/LinearProgress/LinearProgress.d.ts +14 -4
  178. package/LinearProgress/LinearProgress.js +42 -10
  179. package/LinearProgress/LinearProgress.mjs +42 -10
  180. package/Link/Link.d.mts +4 -4
  181. package/Link/Link.d.ts +4 -4
  182. package/List/List.d.mts +4 -4
  183. package/List/List.d.ts +4 -4
  184. package/List/List.js +2 -1
  185. package/List/List.mjs +2 -1
  186. package/ListItem/ListItem.d.mts +3 -3
  187. package/ListItem/ListItem.d.ts +3 -3
  188. package/ListItem/ListItem.js +1 -2
  189. package/ListItem/ListItem.mjs +1 -2
  190. package/ListItemAvatar/ListItemAvatar.d.mts +2 -2
  191. package/ListItemAvatar/ListItemAvatar.d.ts +2 -2
  192. package/ListItemButton/ListItemButton.d.mts +4 -4
  193. package/ListItemButton/ListItemButton.d.ts +4 -4
  194. package/ListItemButton/ListItemButton.js +7 -1
  195. package/ListItemButton/ListItemButton.mjs +7 -1
  196. package/ListItemIcon/ListItemIcon.d.mts +3 -3
  197. package/ListItemIcon/ListItemIcon.d.ts +3 -3
  198. package/ListItemSecondaryAction/ListItemSecondaryAction.d.mts +2 -2
  199. package/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +2 -2
  200. package/ListItemText/ListItemText.d.mts +3 -3
  201. package/ListItemText/ListItemText.d.ts +3 -3
  202. package/ListSubheader/ListSubheader.d.mts +3 -3
  203. package/ListSubheader/ListSubheader.d.ts +3 -3
  204. package/Menu/Menu.d.mts +4 -4
  205. package/Menu/Menu.d.ts +4 -4
  206. package/MenuItem/MenuItem.d.mts +3 -3
  207. package/MenuItem/MenuItem.d.ts +3 -3
  208. package/MenuItem/MenuItem.js +7 -1
  209. package/MenuItem/MenuItem.mjs +7 -1
  210. package/MenuList/MenuList.d.mts +4 -4
  211. package/MenuList/MenuList.d.ts +4 -4
  212. package/MenuList/MenuList.js +2 -1
  213. package/MenuList/MenuList.mjs +2 -1
  214. package/MobileStepper/MobileStepper.d.mts +3 -3
  215. package/MobileStepper/MobileStepper.d.ts +3 -3
  216. package/Modal/Modal.d.mts +7 -7
  217. package/Modal/Modal.d.ts +7 -7
  218. package/NativeSelect/NativeSelect.d.mts +3 -3
  219. package/NativeSelect/NativeSelect.d.ts +3 -3
  220. package/NativeSelect/NativeSelect.js +2 -5
  221. package/NativeSelect/NativeSelect.mjs +2 -5
  222. package/NoSsr/NoSsr.d.mts +2 -2
  223. package/NoSsr/NoSsr.d.ts +2 -2
  224. package/NoSsr/NoSsr.js +2 -2
  225. package/NoSsr/NoSsr.mjs +2 -2
  226. package/OutlinedInput/OutlinedInput.d.mts +4 -4
  227. package/OutlinedInput/OutlinedInput.d.ts +4 -4
  228. package/OutlinedInput/OutlinedInput.js +13 -23
  229. package/OutlinedInput/OutlinedInput.mjs +13 -23
  230. package/Pagination/Pagination.d.mts +2 -2
  231. package/Pagination/Pagination.d.ts +2 -2
  232. package/PaginationItem/PaginationItem.d.mts +3 -3
  233. package/PaginationItem/PaginationItem.d.ts +3 -3
  234. package/Paper/Paper.d.mts +4 -4
  235. package/Paper/Paper.d.ts +4 -4
  236. package/PigmentContainer/PigmentContainer.d.mts +2 -2
  237. package/PigmentContainer/PigmentContainer.d.ts +2 -2
  238. package/PigmentContainer/PigmentContainer.js +2 -3
  239. package/PigmentContainer/PigmentContainer.mjs +2 -3
  240. package/PigmentGrid/PigmentGrid.d.mts +2 -2
  241. package/PigmentGrid/PigmentGrid.d.ts +2 -2
  242. package/PigmentGrid/PigmentGrid.js +2 -2
  243. package/PigmentGrid/PigmentGrid.mjs +2 -2
  244. package/PigmentStack/PigmentStack.d.mts +2 -2
  245. package/PigmentStack/PigmentStack.d.ts +2 -2
  246. package/PigmentStack/PigmentStack.js +2 -2
  247. package/PigmentStack/PigmentStack.mjs +2 -2
  248. package/Popover/Popover.d.mts +4 -4
  249. package/Popover/Popover.d.ts +4 -4
  250. package/Popper/BasePopper.js +23 -1
  251. package/Popper/BasePopper.mjs +23 -1
  252. package/Popper/Popper.d.mts +4 -4
  253. package/Popper/Popper.d.ts +4 -4
  254. package/Popper/Popper.js +4 -4
  255. package/Popper/Popper.mjs +4 -4
  256. package/Portal/Portal.d.mts +2 -2
  257. package/Portal/Portal.d.ts +2 -2
  258. package/Portal/Portal.js +2 -2
  259. package/Portal/Portal.mjs +2 -2
  260. package/README.md +3 -3
  261. package/Radio/Radio.d.mts +3 -3
  262. package/Radio/Radio.d.ts +3 -3
  263. package/RadioGroup/RadioGroup.d.mts +3 -3
  264. package/RadioGroup/RadioGroup.d.ts +3 -3
  265. package/Rating/Rating.d.mts +2 -2
  266. package/Rating/Rating.d.ts +2 -2
  267. package/ScopedCssBaseline/ScopedCssBaseline.d.mts +2 -2
  268. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +2 -2
  269. package/Select/Select.d.mts +3 -3
  270. package/Select/Select.d.ts +3 -3
  271. package/Select/Select.js +2 -5
  272. package/Select/Select.mjs +2 -5
  273. package/Select/SelectInput.js +164 -2
  274. package/Select/SelectInput.mjs +164 -2
  275. package/Skeleton/Skeleton.d.mts +2 -2
  276. package/Skeleton/Skeleton.d.ts +2 -2
  277. package/Slide/Slide.d.mts +4 -4
  278. package/Slide/Slide.d.ts +4 -4
  279. package/Slide/Slide.js +73 -50
  280. package/Slide/Slide.mjs +74 -52
  281. package/Slider/Slider.d.mts +4 -4
  282. package/Slider/Slider.d.ts +4 -4
  283. package/Slider/Slider.js +11 -2
  284. package/Slider/Slider.mjs +11 -2
  285. package/Slider/useSlider.d.mts +1 -1
  286. package/Slider/useSlider.d.ts +1 -1
  287. package/Slider/useSlider.js +236 -209
  288. package/Slider/useSlider.mjs +236 -209
  289. package/Slider/useSlider.types.d.mts +2 -2
  290. package/Slider/useSlider.types.d.ts +2 -2
  291. package/Snackbar/Snackbar.d.mts +2 -2
  292. package/Snackbar/Snackbar.d.ts +2 -2
  293. package/SnackbarContent/SnackbarContent.d.mts +3 -3
  294. package/SnackbarContent/SnackbarContent.d.ts +3 -3
  295. package/SpeedDial/SpeedDial.d.mts +2 -2
  296. package/SpeedDial/SpeedDial.d.ts +2 -2
  297. package/SpeedDialAction/SpeedDialAction.d.mts +3 -3
  298. package/SpeedDialAction/SpeedDialAction.d.ts +3 -3
  299. package/SpeedDialIcon/SpeedDialIcon.d.mts +2 -2
  300. package/SpeedDialIcon/SpeedDialIcon.d.ts +2 -2
  301. package/Stack/Stack.d.mts +2 -2
  302. package/Stack/Stack.d.ts +2 -2
  303. package/Step/Step.d.mts +2 -2
  304. package/Step/Step.d.ts +2 -2
  305. package/StepButton/StepButton.d.mts +3 -3
  306. package/StepButton/StepButton.d.ts +3 -3
  307. package/StepConnector/StepConnector.d.mts +2 -2
  308. package/StepConnector/StepConnector.d.ts +2 -2
  309. package/StepConnector/StepConnector.js +1 -2
  310. package/StepConnector/StepConnector.mjs +1 -2
  311. package/StepContent/StepContent.d.mts +2 -2
  312. package/StepContent/StepContent.d.ts +2 -2
  313. package/StepIcon/StepIcon.d.mts +3 -3
  314. package/StepIcon/StepIcon.d.ts +3 -3
  315. package/StepLabel/StepLabel.d.mts +2 -2
  316. package/StepLabel/StepLabel.d.ts +2 -2
  317. package/Stepper/Stepper.d.mts +2 -2
  318. package/Stepper/Stepper.d.ts +2 -2
  319. package/SvgIcon/SvgIcon.d.mts +3 -3
  320. package/SvgIcon/SvgIcon.d.ts +3 -3
  321. package/SwipeableDrawer/SwipeableDrawer.d.mts +3 -3
  322. package/SwipeableDrawer/SwipeableDrawer.d.ts +3 -3
  323. package/SwipeableDrawer/SwipeableDrawer.js +7 -6
  324. package/SwipeableDrawer/SwipeableDrawer.mjs +7 -6
  325. package/Switch/Switch.d.mts +4 -4
  326. package/Switch/Switch.d.ts +4 -4
  327. package/Switch/Switch.js +9 -4
  328. package/Switch/Switch.mjs +9 -4
  329. package/Tab/Tab.d.mts +3 -3
  330. package/Tab/Tab.d.ts +3 -3
  331. package/TabScrollButton/TabScrollButton.d.mts +2 -2
  332. package/TabScrollButton/TabScrollButton.d.ts +2 -2
  333. package/Table/Table.d.mts +2 -2
  334. package/Table/Table.d.ts +2 -2
  335. package/TableBody/TableBody.d.mts +2 -2
  336. package/TableBody/TableBody.d.ts +2 -2
  337. package/TableCell/TableCell.d.mts +2 -2
  338. package/TableCell/TableCell.d.ts +2 -2
  339. package/TableContainer/TableContainer.d.mts +2 -2
  340. package/TableContainer/TableContainer.d.ts +2 -2
  341. package/TableFooter/TableFooter.d.mts +2 -2
  342. package/TableFooter/TableFooter.d.ts +2 -2
  343. package/TableHead/TableHead.d.mts +2 -2
  344. package/TableHead/TableHead.d.ts +2 -2
  345. package/TablePagination/TablePagination.d.mts +4 -4
  346. package/TablePagination/TablePagination.d.ts +4 -4
  347. package/TablePaginationActions/TablePaginationActions.d.mts +2 -2
  348. package/TablePaginationActions/TablePaginationActions.d.ts +2 -2
  349. package/TableRow/TableRow.d.mts +2 -2
  350. package/TableRow/TableRow.d.ts +2 -2
  351. package/TableSortLabel/TableSortLabel.d.mts +3 -3
  352. package/TableSortLabel/TableSortLabel.d.ts +3 -3
  353. package/TableSortLabel/TableSortLabel.js +1 -2
  354. package/TableSortLabel/TableSortLabel.mjs +1 -2
  355. package/Tabs/ScrollbarSize.js +2 -1
  356. package/Tabs/ScrollbarSize.mjs +2 -1
  357. package/Tabs/Tabs.d.mts +2 -2
  358. package/Tabs/Tabs.d.ts +2 -2
  359. package/Tabs/Tabs.js +2 -1
  360. package/Tabs/Tabs.mjs +2 -1
  361. package/TextField/TextField.d.mts +10 -10
  362. package/TextField/TextField.d.ts +10 -10
  363. package/TextareaAutosize/TextareaAutosize.d.mts +2 -2
  364. package/TextareaAutosize/TextareaAutosize.d.ts +2 -2
  365. package/TextareaAutosize/TextareaAutosize.js +2 -2
  366. package/TextareaAutosize/TextareaAutosize.mjs +2 -2
  367. package/ToggleButton/ToggleButton.d.mts +3 -3
  368. package/ToggleButton/ToggleButton.d.ts +3 -3
  369. package/ToggleButtonGroup/ToggleButtonGroup.d.mts +2 -2
  370. package/ToggleButtonGroup/ToggleButtonGroup.d.ts +2 -2
  371. package/Toolbar/Toolbar.d.mts +2 -2
  372. package/Toolbar/Toolbar.d.ts +2 -2
  373. package/Tooltip/Tooltip.d.mts +2 -2
  374. package/Tooltip/Tooltip.d.ts +2 -2
  375. package/Tooltip/Tooltip.js +26 -108
  376. package/Tooltip/Tooltip.mjs +26 -108
  377. package/Typography/Typography.d.mts +4 -4
  378. package/Typography/Typography.d.ts +4 -4
  379. package/Unstable_TrapFocus/FocusTrap.js +18 -14
  380. package/Unstable_TrapFocus/FocusTrap.mjs +18 -14
  381. package/Zoom/Zoom.d.mts +3 -3
  382. package/Zoom/Zoom.d.ts +3 -3
  383. package/Zoom/Zoom.js +24 -30
  384. package/Zoom/Zoom.mjs +25 -31
  385. package/index.js +1 -1
  386. package/index.mjs +1 -1
  387. package/package.json +7 -7
  388. package/styles/createThemeNoVars.js +1 -1
  389. package/styles/createThemeNoVars.mjs +1 -1
  390. package/styles/responsiveFontSizes.js +19 -8
  391. package/styles/responsiveFontSizes.mjs +19 -8
  392. package/styles/useThemeProps.d.mts +3 -3
  393. package/styles/useThemeProps.d.ts +3 -3
  394. package/transitions/utils.d.mts +24 -0
  395. package/transitions/utils.d.ts +24 -0
  396. package/transitions/utils.js +91 -0
  397. package/transitions/utils.mjs +88 -0
  398. package/useAutocomplete/useAutocomplete.d.mts +4 -5
  399. package/useAutocomplete/useAutocomplete.d.ts +4 -5
  400. package/useAutocomplete/useAutocomplete.js +166 -53
  401. package/useAutocomplete/useAutocomplete.mjs +166 -53
  402. package/utils/contains.d.mts +2 -0
  403. package/utils/contains.d.ts +2 -0
  404. package/utils/contains.js +9 -0
  405. package/utils/contains.mjs +2 -0
  406. package/utils/focusable.d.mts +7 -0
  407. package/utils/focusable.d.ts +7 -0
  408. package/utils/focusable.js +20 -0
  409. package/utils/focusable.mjs +13 -0
  410. package/utils/getEventTarget.d.mts +2 -0
  411. package/utils/getEventTarget.d.ts +2 -0
  412. package/utils/getEventTarget.js +9 -0
  413. package/utils/getEventTarget.mjs +2 -0
  414. package/utils/mergeSlotProps.js +2 -8
  415. package/utils/mergeSlotProps.mjs +1 -8
  416. package/version/index.js +3 -3
  417. package/version/index.mjs +3 -3
  418. package/FormControl/formControlState.js +0 -21
  419. package/FormControl/formControlState.mjs +0 -15
@@ -11,35 +11,46 @@ import visuallyHidden from '@mui/utils/visuallyHidden';
11
11
  import clamp from '@mui/utils/clamp';
12
12
  import extractEventHandlers from '@mui/utils/extractEventHandlers';
13
13
  import areArraysEqual from "../utils/areArraysEqual.mjs";
14
+ import contains from "../utils/contains.mjs";
15
+ import getActiveElement from "../utils/getActiveElement.mjs";
14
16
  const INTENTIONAL_DRAG_COUNT_THRESHOLD = 2;
17
+ const EMPTY_MARKS = [];
18
+ const EMPTY_OBJ = {};
15
19
  function getNewValue(currentValue, step, direction, min, max) {
16
20
  return direction === 1 ? Math.min(currentValue + step, max) : Math.max(currentValue - step, min);
17
21
  }
18
22
  function asc(a, b) {
19
23
  return a - b;
20
24
  }
21
- function findClosest(values, currentValue) {
22
- const {
23
- index: closestIndex
24
- } = values.reduce((acc, value, index) => {
25
+ function findClosest(values, currentValue, preferredIndex = -1) {
26
+ const closestValue = values.reduce((acc, value, index) => {
25
27
  const distance = Math.abs(currentValue - value);
26
- if (acc === null || distance < acc.distance || distance === acc.distance) {
28
+ if (acc == null || distance <= acc.distance) {
27
29
  return {
28
30
  distance,
29
31
  index
30
32
  };
31
33
  }
32
34
  return acc;
33
- }, null) ?? {};
35
+ }, null) ?? EMPTY_OBJ;
36
+ const {
37
+ index: closestIndex
38
+ } = closestValue;
39
+ if (closestIndex == null) {
40
+ return closestIndex;
41
+ }
42
+ if (preferredIndex >= 0 && values[preferredIndex] === values[closestIndex]) {
43
+ return preferredIndex;
44
+ }
34
45
  return closestIndex;
35
46
  }
36
- function trackFinger(event, touchId) {
47
+ function trackFinger(event, touchIdRef) {
37
48
  // The event is TouchEvent
38
- if (touchId.current !== undefined && event.changedTouches) {
49
+ if (touchIdRef.current != null && event.changedTouches) {
39
50
  const touchEvent = event;
40
51
  for (let i = 0; i < touchEvent.changedTouches.length; i += 1) {
41
52
  const touch = touchEvent.changedTouches[i];
42
- if (touch.identifier === touchId.current) {
53
+ if (touch.identifier === touchIdRef.current) {
43
54
  return {
44
55
  x: touch.clientX,
45
56
  y: touch.clientY
@@ -49,7 +60,7 @@ function trackFinger(event, touchId) {
49
60
  return false;
50
61
  }
51
62
 
52
- // The event is MouseEvent
63
+ // The event is PointerEvent or MouseEvent
53
64
  return {
54
65
  x: event.clientX,
55
66
  y: event.clientY
@@ -76,26 +87,18 @@ function roundValueToStep(value, step, min) {
76
87
  const nearest = Math.round((value - min) / step) * step + min;
77
88
  return Number(nearest.toFixed(getDecimalPrecision(step)));
78
89
  }
79
- function setValueIndex({
80
- values,
81
- newValue,
82
- index
83
- }) {
90
+ function setValueIndex(values, newValue, index) {
84
91
  const output = values.slice();
85
92
  output[index] = newValue;
86
93
  return output.sort(asc);
87
94
  }
88
- function focusThumb({
89
- sliderRef,
90
- activeIndex,
91
- setActive,
92
- focusVisible
93
- }) {
95
+ function focusThumb(sliderRef, activeIndex, setActive, focusVisible) {
94
96
  const doc = ownerDocument(sliderRef.current);
95
- if (!sliderRef.current?.contains(doc.activeElement) || Number(doc?.activeElement?.getAttribute('data-index')) !== activeIndex) {
97
+ const activeElement = getActiveElement(doc);
98
+ if (!contains(sliderRef.current, activeElement) || Number(activeElement?.getAttribute('data-index')) !== activeIndex) {
96
99
  const input = sliderRef.current?.querySelector(`[type="range"][data-index="${activeIndex}"]`);
97
100
  if (input != null) {
98
- if (focusVisible === undefined) {
101
+ if (focusVisible == null) {
99
102
  input.focus({
100
103
  preventScroll: true
101
104
  });
@@ -104,7 +107,7 @@ function focusThumb({
104
107
  preventScroll: true,
105
108
  // Prevent pointer-driven focus rings in browsers that support this option.
106
109
  // Chrome 144+ supports `focusVisible` in `HTMLElement.focus()` options.
107
- // @ts-ignore - `focusVisible` is not yet in TypeScript's lib.dom FocusOptions.
110
+ // @ts-expect-error `focusVisible` is not yet in TypeScript's lib.dom FocusOptions.
108
111
  focusVisible
109
112
  });
110
113
  }
@@ -150,28 +153,6 @@ const axisProps = {
150
153
  }
151
154
  };
152
155
  export const Identity = x => x;
153
-
154
- // TODO: remove support for Safari < 13.
155
- // https://caniuse.com/#search=touch-action
156
- //
157
- // Safari, on iOS, supports touch action since v13.
158
- // Over 80% of the iOS phones are compatible
159
- // in August 2020.
160
- // Utilizing the CSS.supports method to check if touch-action is supported.
161
- // Since CSS.supports is supported on all but Edge@12 and IE and touch-action
162
- // is supported on both Edge@12 and IE if CSS.supports is not available that means that
163
- // touch-action will be supported
164
- let cachedSupportsTouchActionNone;
165
- function doesSupportTouchActionNone() {
166
- if (cachedSupportsTouchActionNone === undefined) {
167
- if (typeof CSS !== 'undefined' && typeof CSS.supports === 'function') {
168
- cachedSupportsTouchActionNone = CSS.supports('touch-action', 'none');
169
- } else {
170
- cachedSupportsTouchActionNone = true;
171
- }
172
- }
173
- return cachedSupportsTouchActionNone;
174
- }
175
156
  export function useSlider(parameters) {
176
157
  const {
177
158
  'aria-labelledby': ariaLabelledby,
@@ -193,35 +174,42 @@ export function useSlider(parameters) {
193
174
  tabIndex,
194
175
  value: valueProp
195
176
  } = parameters;
196
- const touchId = React.useRef(undefined);
197
- const focusFrame = React.useRef(null);
177
+ const touchIdRef = React.useRef(undefined);
178
+ const focusFrameRef = React.useRef(null);
198
179
  // We can't use the :active browser pseudo-classes.
199
180
  // - The active state isn't triggered when clicking on the rail.
200
181
  // - The active state isn't transferred when inversing a range slider.
201
182
  const [active, setActive] = React.useState(-1);
202
183
  const [open, setOpen] = React.useState(-1);
203
184
  const [dragging, setDragging] = React.useState(false);
204
- const moveCount = React.useRef(0);
185
+ const moveCountRef = React.useRef(0);
186
+ // Ref (not state) because setActive() always accompanies updates, providing the re-render.
187
+ const lastUsedThumbIndexRef = React.useRef(-1);
188
+ // Prevents duplicate listener registration when both pointer and touch events fire
189
+ // for the same physical touch interaction.
190
+ const pointerDownHandledRef = React.useRef(false);
191
+ // Tracks which pointer owns the current drag session, so stray pointerup/pointermove
192
+ // events from a second pointer don't interfere.
193
+ const activePointerIdRef = React.useRef(-1);
205
194
  const cancelFocusFrame = useEventCallback(() => {
206
- if (focusFrame.current != null) {
207
- cancelAnimationFrame(focusFrame.current);
208
- focusFrame.current = null;
195
+ if (focusFrameRef.current != null) {
196
+ cancelAnimationFrame(focusFrameRef.current);
197
+ focusFrameRef.current = null;
209
198
  }
210
199
  });
211
- // lastChangedValue is updated whenever onChange is triggered.
212
- const lastChangedValue = React.useRef(null);
200
+ // lastChangedValueRef is updated whenever onChange is triggered.
201
+ const lastChangedValueRef = React.useRef(null);
213
202
  const [valueDerived, setValueState] = useControlled({
214
203
  controlled: valueProp,
215
204
  default: defaultValue ?? min,
216
205
  name: 'Slider'
217
206
  });
218
- const handleChange = onChange && ((event, value, thumbIndex) => {
207
+ const handleChange = useEventCallback((event, value, thumbIndex) => {
219
208
  // Redefine target to allow name and value to be read.
220
209
  // This allows seamless integration with the most popular form libraries.
221
210
  // https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
222
211
  // Clone the event to not override `target` of the original event.
223
- const nativeEvent = event.nativeEvent || event;
224
- // @ts-ignore The nativeEvent is function, not object
212
+ const nativeEvent = 'nativeEvent' in event ? event.nativeEvent : event;
225
213
  const clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
226
214
  Object.defineProperty(clonedEvent, 'target', {
227
215
  writable: true,
@@ -230,16 +218,43 @@ export function useSlider(parameters) {
230
218
  name
231
219
  }
232
220
  });
233
- lastChangedValue.current = value;
234
- onChange(clonedEvent, value, thumbIndex);
221
+ lastChangedValueRef.current = value;
222
+ onChange?.(clonedEvent, value, thumbIndex);
235
223
  });
236
224
  const range = Array.isArray(valueDerived);
237
- let values = range ? valueDerived.slice().sort(asc) : [valueDerived];
238
- values = values.map(value => value == null ? min : clamp(value, min, max));
239
- const marks = marksProp === true && step !== null ? [...Array(Math.floor((max - min) / step) + 1)].map((_, index) => ({
240
- value: min + step * index
241
- })) : marksProp || [];
242
- const marksValues = marks.map(mark => mark.value);
225
+ const values = React.useMemo(() => {
226
+ if (typeof valueDerived === 'number') {
227
+ return [clamp(valueDerived, min, max)];
228
+ }
229
+ if (valueDerived == null) {
230
+ return [min];
231
+ }
232
+ const sortedValues = valueDerived.slice().sort(asc);
233
+ for (let i = 0; i < sortedValues.length; i += 1) {
234
+ const value = sortedValues[i];
235
+ sortedValues[i] = value == null ? min : clamp(value, min, max);
236
+ }
237
+ return sortedValues;
238
+ }, [valueDerived, min, max]);
239
+ const marks = React.useMemo(() => {
240
+ if (marksProp === true && step != null) {
241
+ const generatedMarks = new Array(Math.floor((max - min) / step) + 1);
242
+ for (let i = 0; i < generatedMarks.length; i += 1) {
243
+ generatedMarks[i] = {
244
+ value: min + step * i
245
+ };
246
+ }
247
+ return generatedMarks;
248
+ }
249
+ return Array.isArray(marksProp) ? marksProp : EMPTY_MARKS;
250
+ }, [marksProp, step, min, max]);
251
+ const marksValues = React.useMemo(() => {
252
+ const markValues = new Array(marks.length);
253
+ for (let i = 0; i < marks.length; i += 1) {
254
+ markValues[i] = marks[i].value;
255
+ }
256
+ return markValues;
257
+ }, [marks]);
243
258
  const [focusedThumbIndex, setFocusedThumbIndex] = React.useState(-1);
244
259
  const sliderRef = React.useRef(null);
245
260
  const handleRef = useForkRef(ref, sliderRef);
@@ -280,29 +295,22 @@ export function useSlider(parameters) {
280
295
  newValue = clamp(newValue, values[index - 1] || -Infinity, values[index + 1] || Infinity);
281
296
  }
282
297
  const previousValue = newValue;
283
- newValue = setValueIndex({
284
- values,
285
- newValue,
286
- index
287
- });
298
+ newValue = setValueIndex(values, newValue, index);
288
299
  let activeIndex = index;
289
300
 
290
301
  // Potentially swap the index if needed.
291
302
  if (!disableSwap) {
292
303
  activeIndex = newValue.indexOf(previousValue);
293
304
  }
294
- focusThumb({
295
- sliderRef,
296
- activeIndex
297
- });
305
+ focusThumb(sliderRef, activeIndex);
298
306
  }
299
307
  setValueState(newValue);
300
308
  setFocusedThumbIndex(index);
301
- if (handleChange && !areValuesEqual(newValue, valueDerived)) {
309
+ if (onChange && !areValuesEqual(newValue, valueDerived)) {
302
310
  handleChange(event, newValue, index);
303
311
  }
304
312
  if (onChangeCommitted) {
305
- onChangeCommitted(event, lastChangedValue.current ?? newValue);
313
+ onChangeCommitted(event, lastChangedValueRef.current ?? newValue);
306
314
  }
307
315
  };
308
316
  const createHandleHiddenInputKeyDown = otherHandlers => event => {
@@ -370,12 +378,14 @@ export function useSlider(parameters) {
370
378
  otherHandlers?.onKeyDown?.(event);
371
379
  };
372
380
  useEnhancedEffect(() => {
373
- if (disabled && sliderRef.current.contains(document.activeElement)) {
381
+ const activeElement = getActiveElement(ownerDocument(sliderRef.current));
382
+ if (disabled && contains(sliderRef.current, activeElement)) {
374
383
  // This is necessary because Firefox and Safari will keep focus
375
384
  // on a disabled element:
376
385
  // https://codesandbox.io/p/sandbox/mui-pr-22247-forked-h151h?file=/src/App.js
377
- // @ts-ignore
378
- document.activeElement?.blur();
386
+ if (activeElement != null && 'blur' in activeElement) {
387
+ activeElement.blur();
388
+ }
379
389
  }
380
390
  }, [disabled]);
381
391
  if (disabled && active !== -1) {
@@ -386,22 +396,27 @@ export function useSlider(parameters) {
386
396
  }
387
397
  const createHandleHiddenInputChange = otherHandlers => event => {
388
398
  otherHandlers.onChange?.(event);
389
- // this handles value change by Pointer or Touch events
390
- // @ts-ignore
391
- changeValue(event, event.target.valueAsNumber);
399
+ // Handles value changes reported through the hidden range input.
400
+ changeValue(event, event.currentTarget.valueAsNumber);
392
401
  };
393
- const previousIndex = React.useRef(undefined);
402
+ const previousIndexRef = React.useRef(undefined);
394
403
  let axis = orientation;
395
404
  if (isRtl && orientation === 'horizontal') {
396
405
  axis += '-reverse';
397
406
  }
398
- const getFingerNewValue = ({
399
- finger,
400
- move = false
401
- }) => {
407
+
408
+ // Converts finger coordinates to a slider value and determines the active thumb.
409
+ // For range sliders, reads `previousIndexRef.current` to decide which thumb is active:
410
+ // -1 = initial press → find closest thumb
411
+ // ≥0 = drag in progress → keep same thumb
412
+ // Callers must reset `previousIndexRef.current = -1` before calling on a new interaction.
413
+ const getValueAtFinger = finger => {
402
414
  const {
403
415
  current: slider
404
416
  } = sliderRef;
417
+ if (!slider) {
418
+ return null;
419
+ }
405
420
  const {
406
421
  width,
407
422
  height,
@@ -428,27 +443,20 @@ export function useSlider(parameters) {
428
443
  newValue = clamp(newValue, min, max);
429
444
  let activeIndex = 0;
430
445
  if (range) {
431
- if (!move) {
432
- activeIndex = findClosest(values, newValue);
433
- } else {
434
- activeIndex = previousIndex.current;
435
- }
446
+ const isDragging = previousIndexRef.current !== -1;
447
+ activeIndex = isDragging ? previousIndexRef.current : findClosest(values, newValue, lastUsedThumbIndexRef.current);
436
448
 
437
449
  // Bound the new value to the thumb's neighbours.
438
450
  if (disableSwap) {
439
451
  newValue = clamp(newValue, values[activeIndex - 1] || -Infinity, values[activeIndex + 1] || Infinity);
440
452
  }
441
453
  const previousValue = newValue;
442
- newValue = setValueIndex({
443
- values,
444
- newValue,
445
- index: activeIndex
446
- });
454
+ newValue = setValueIndex(values, newValue, activeIndex);
447
455
 
448
456
  // Potentially swap the index if needed.
449
- if (!(disableSwap && move)) {
457
+ if (!(disableSwap && isDragging)) {
450
458
  activeIndex = newValue.indexOf(previousValue);
451
- previousIndex.current = activeIndex;
459
+ previousIndexRef.current = activeIndex;
452
460
  }
453
461
  }
454
462
  return {
@@ -457,60 +465,61 @@ export function useSlider(parameters) {
457
465
  };
458
466
  };
459
467
  const handleTouchMove = useEventCallback(nativeEvent => {
460
- const finger = trackFinger(nativeEvent, touchId);
468
+ // Ignore pointer events from a different pointer than the one that started the drag.
469
+ if ('pointerId' in nativeEvent && nativeEvent.pointerId !== activePointerIdRef.current) {
470
+ return;
471
+ }
472
+ const finger = trackFinger(nativeEvent, touchIdRef);
461
473
  if (!finger) {
462
474
  return;
463
475
  }
464
- moveCount.current += 1;
476
+ moveCountRef.current += 1;
465
477
 
466
- // Cancel move in case some other element consumed a mouseup event and it was not fired.
467
- // @ts-ignore buttons doesn't not exists on touch event
468
- if (nativeEvent.type === 'mousemove' && nativeEvent.buttons === 0) {
478
+ // Cancel move in case some other element consumed a pointerup event and it was not fired.
479
+ if (nativeEvent.type === 'pointermove' && nativeEvent.buttons === 0) {
469
480
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
470
481
  handleTouchEnd(nativeEvent);
471
482
  return;
472
483
  }
473
- const {
474
- newValue,
475
- activeIndex
476
- } = getFingerNewValue({
477
- finger,
478
- move: true
479
- });
480
- focusThumb({
481
- sliderRef,
482
- activeIndex,
483
- setActive,
484
- focusVisible: false
485
- });
486
- setValueState(newValue);
487
- if (!dragging && moveCount.current > INTENTIONAL_DRAG_COUNT_THRESHOLD) {
484
+ const newFingerValue = getValueAtFinger(finger);
485
+ if (!newFingerValue) {
486
+ return;
487
+ }
488
+ focusThumb(sliderRef, newFingerValue.activeIndex, setActive, false);
489
+ lastUsedThumbIndexRef.current = newFingerValue.activeIndex;
490
+ setValueState(newFingerValue.newValue);
491
+ if (!dragging && moveCountRef.current > INTENTIONAL_DRAG_COUNT_THRESHOLD) {
488
492
  setDragging(true);
489
493
  }
490
- if (handleChange && !areValuesEqual(newValue, valueDerived)) {
491
- handleChange(nativeEvent, newValue, activeIndex);
494
+ if (onChange && !areValuesEqual(newFingerValue.newValue, valueDerived)) {
495
+ handleChange(nativeEvent, newFingerValue.newValue, newFingerValue.activeIndex);
492
496
  }
493
497
  });
494
498
  const handleTouchEnd = useEventCallback(nativeEvent => {
495
- const finger = trackFinger(nativeEvent, touchId);
499
+ // Ignore pointer events from a different pointer than the one that started the drag.
500
+ if ('pointerId' in nativeEvent && nativeEvent.pointerId !== activePointerIdRef.current) {
501
+ return;
502
+ }
503
+ const finger = trackFinger(nativeEvent, touchIdRef);
496
504
  setDragging(false);
497
505
  if (!finger) {
498
506
  return;
499
507
  }
500
- const {
501
- newValue
502
- } = getFingerNewValue({
503
- finger,
504
- move: true
505
- });
508
+ const newFingerValue = getValueAtFinger(finger);
506
509
  setActive(-1);
507
510
  if (nativeEvent.type === 'touchend') {
508
511
  setOpen(-1);
509
512
  }
510
- if (onChangeCommitted) {
511
- onChangeCommitted(nativeEvent, lastChangedValue.current ?? newValue);
513
+ if (newFingerValue && onChangeCommitted) {
514
+ onChangeCommitted(nativeEvent, lastChangedValueRef.current ?? newFingerValue.newValue);
515
+ }
516
+
517
+ // Release pointer capture if applicable
518
+ if ('pointerType' in nativeEvent && sliderRef.current?.hasPointerCapture(nativeEvent.pointerId)) {
519
+ sliderRef.current.releasePointerCapture(nativeEvent.pointerId);
512
520
  }
513
- touchId.current = undefined;
521
+ touchIdRef.current = undefined;
522
+ activePointerIdRef.current = -1;
514
523
 
515
524
  // eslint-disable-next-line @typescript-eslint/no-use-before-define
516
525
  stopListening();
@@ -519,35 +528,36 @@ export function useSlider(parameters) {
519
528
  if (disabled) {
520
529
  return;
521
530
  }
522
- // If touch-action: none; is not supported we need to prevent the scroll manually.
523
- if (!doesSupportTouchActionNone()) {
524
- nativeEvent.preventDefault();
531
+
532
+ // If the pointer path already handled this interaction,
533
+ // only record the touch identifier and skip duplicate listener registration.
534
+ if (pointerDownHandledRef.current) {
535
+ pointerDownHandledRef.current = false;
536
+ const touch = nativeEvent.changedTouches[0];
537
+ if (touch != null) {
538
+ touchIdRef.current = touch.identifier;
539
+ }
540
+ return;
525
541
  }
526
542
  const touch = nativeEvent.changedTouches[0];
527
543
  if (touch != null) {
528
544
  // A number that uniquely identifies the current finger in the touch session.
529
- touchId.current = touch.identifier;
545
+ touchIdRef.current = touch.identifier;
530
546
  }
531
- const finger = trackFinger(nativeEvent, touchId);
547
+ const finger = trackFinger(nativeEvent, touchIdRef);
532
548
  if (finger !== false) {
533
- const {
534
- newValue,
535
- activeIndex
536
- } = getFingerNewValue({
537
- finger
538
- });
539
- focusThumb({
540
- sliderRef,
541
- activeIndex,
542
- setActive,
543
- focusVisible: false
544
- });
545
- setValueState(newValue);
546
- if (handleChange && !areValuesEqual(newValue, valueDerived)) {
547
- handleChange(nativeEvent, newValue, activeIndex);
549
+ previousIndexRef.current = -1;
550
+ const newFingerValue = getValueAtFinger(finger);
551
+ if (newFingerValue) {
552
+ focusThumb(sliderRef, newFingerValue.activeIndex, setActive, false);
553
+ lastUsedThumbIndexRef.current = newFingerValue.activeIndex;
554
+ setValueState(newFingerValue.newValue);
555
+ if (onChange && !areValuesEqual(newFingerValue.newValue, valueDerived)) {
556
+ handleChange(nativeEvent, newFingerValue.newValue, newFingerValue.activeIndex);
557
+ }
548
558
  }
549
559
  }
550
- moveCount.current = 0;
560
+ moveCountRef.current = 0;
551
561
  const doc = ownerDocument(sliderRef.current);
552
562
  doc.addEventListener('touchmove', handleTouchMove, {
553
563
  passive: true
@@ -558,17 +568,18 @@ export function useSlider(parameters) {
558
568
  });
559
569
  const stopListening = React.useCallback(() => {
560
570
  const doc = ownerDocument(sliderRef.current);
561
- doc.removeEventListener('mousemove', handleTouchMove);
562
- doc.removeEventListener('mouseup', handleTouchEnd);
571
+ doc.removeEventListener('pointermove', handleTouchMove);
572
+ doc.removeEventListener('pointerup', handleTouchEnd);
563
573
  doc.removeEventListener('touchmove', handleTouchMove);
564
574
  doc.removeEventListener('touchend', handleTouchEnd);
565
575
  }, [handleTouchEnd, handleTouchMove]);
566
576
  React.useEffect(() => {
567
- const {
568
- current: slider
569
- } = sliderRef;
577
+ const slider = sliderRef.current;
578
+ if (!slider) {
579
+ return undefined;
580
+ }
570
581
  slider.addEventListener('touchstart', handleTouchStart, {
571
- passive: doesSupportTouchActionNone()
582
+ passive: true
572
583
  });
573
584
  return () => {
574
585
  slider.removeEventListener('touchstart', handleTouchStart);
@@ -582,62 +593,67 @@ export function useSlider(parameters) {
582
593
  cancelFocusFrame();
583
594
  }
584
595
  }, [disabled, stopListening, cancelFocusFrame]);
585
- const createHandleMouseDown = otherHandlers => event => {
586
- otherHandlers.onMouseDown?.(event);
587
- if (disabled) {
588
- return;
589
- }
590
- if (event.defaultPrevented) {
591
- return;
592
- }
596
+ const createHandlePointerDown = otherHandlers => event => {
597
+ otherHandlers.onPointerDown?.(event);
593
598
 
594
- // Only handle left clicks
595
- if (event.button !== 0) {
599
+ // On touch devices, the browser fires both pointerdown and touchstart for the
600
+ // same physical touch. Mark this BEFORE early returns so handleTouchStart always
601
+ // knows the pointer path saw this interaction — even if it was prevented or disabled.
602
+ if (event.pointerType === 'touch') {
603
+ pointerDownHandledRef.current = true;
604
+ }
605
+ if (disabled || event.defaultPrevented || event.button !== 0) {
596
606
  return;
597
607
  }
598
- const finger = trackFinger(event, touchId);
608
+ const finger = trackFinger(event, touchIdRef);
599
609
  if (finger !== false) {
600
- const {
601
- newValue,
602
- activeIndex
603
- } = getFingerNewValue({
604
- finger
605
- });
606
- const doc = ownerDocument(sliderRef.current);
607
- const activeElement = doc.activeElement;
608
- const pressedOnFocusedThumb = sliderRef.current?.contains(activeElement) && Number(activeElement?.getAttribute('data-index')) === activeIndex;
609
- setActive(activeIndex);
610
- if (pressedOnFocusedThumb) {
611
- event.preventDefault();
612
- } else {
613
- cancelFocusFrame();
614
- focusFrame.current = requestAnimationFrame(() => {
615
- focusFrame.current = null;
616
- focusThumb({
617
- sliderRef,
618
- activeIndex,
619
- focusVisible: false
610
+ previousIndexRef.current = -1;
611
+ const newFingerValue = getValueAtFinger(finger);
612
+ if (newFingerValue) {
613
+ const thumbInput = sliderRef.current?.querySelector(`input[type="range"][data-index="${newFingerValue.activeIndex}"]`);
614
+ const doc = ownerDocument(sliderRef.current);
615
+ const pressedOnFocusedThumb = thumbInput != null && thumbInput === getActiveElement(doc);
616
+ setActive(newFingerValue.activeIndex);
617
+ lastUsedThumbIndexRef.current = newFingerValue.activeIndex;
618
+ if (pressedOnFocusedThumb) {
619
+ event.preventDefault();
620
+ } else {
621
+ cancelFocusFrame();
622
+ focusFrameRef.current = requestAnimationFrame(() => {
623
+ focusFrameRef.current = null;
624
+ focusThumb(sliderRef, newFingerValue.activeIndex, undefined, false);
620
625
  });
621
- });
622
- }
623
- setValueState(newValue);
624
- if (handleChange && !areValuesEqual(newValue, valueDerived)) {
625
- handleChange(event, newValue, activeIndex);
626
+ }
627
+ setValueState(newFingerValue.newValue);
628
+ if (onChange && !areValuesEqual(newFingerValue.newValue, valueDerived)) {
629
+ handleChange(event, newFingerValue.newValue, newFingerValue.activeIndex);
630
+ }
626
631
  }
627
632
  }
628
- moveCount.current = 0;
633
+ moveCountRef.current = 0;
634
+ activePointerIdRef.current = event.pointerId;
629
635
  const doc = ownerDocument(sliderRef.current);
630
- doc.addEventListener('mousemove', handleTouchMove, {
636
+
637
+ // Use pointer capture for reliable drag tracking
638
+ try {
639
+ event.currentTarget.setPointerCapture(event.pointerId);
640
+ } catch {
641
+ // setPointerCapture can throw if the pointerId is invalid (e.g. synthetic
642
+ // events in tests, or the pointer was already released). The slider still
643
+ // works via document-level listeners; pointer capture is a progressive
644
+ // enhancement for reliable drag tracking.
645
+ }
646
+ doc.addEventListener('pointermove', handleTouchMove, {
631
647
  passive: true
632
648
  });
633
- doc.addEventListener('mouseup', handleTouchEnd);
649
+ doc.addEventListener('pointerup', handleTouchEnd);
634
650
  };
635
651
  const trackOffset = valueToPercent(range ? values[0] : min, min, max);
636
652
  const trackLeap = valueToPercent(values[values.length - 1], min, max) - trackOffset;
637
- const getRootProps = (externalProps = {}) => {
653
+ const getRootProps = (externalProps = EMPTY_OBJ) => {
638
654
  const externalHandlers = extractEventHandlers(externalProps);
639
655
  const ownEventHandlers = {
640
- onMouseDown: createHandleMouseDown(externalHandlers || {})
656
+ onPointerDown: createHandlePointerDown(externalHandlers)
641
657
  };
642
658
  const mergedEventHandlers = {
643
659
  ...externalHandlers,
@@ -658,11 +674,11 @@ export function useSlider(parameters) {
658
674
  otherHandlers.onMouseLeave?.(event);
659
675
  setOpen(-1);
660
676
  };
661
- const getThumbProps = (externalProps = {}) => {
677
+ const getThumbProps = (externalProps = EMPTY_OBJ) => {
662
678
  const externalHandlers = extractEventHandlers(externalProps);
663
679
  const ownEventHandlers = {
664
- onMouseOver: createHandleMouseOver(externalHandlers || {}),
665
- onMouseLeave: createHandleMouseLeave(externalHandlers || {})
680
+ onMouseOver: createHandleMouseOver(externalHandlers),
681
+ onMouseLeave: createHandleMouseLeave(externalHandlers)
666
682
  };
667
683
  return {
668
684
  ...externalProps,
@@ -671,22 +687,33 @@ export function useSlider(parameters) {
671
687
  };
672
688
  };
673
689
  const getThumbStyle = index => {
690
+ let zIndex;
691
+ if (range) {
692
+ if (active === index) {
693
+ zIndex = 2;
694
+ } else if (lastUsedThumbIndexRef.current === index) {
695
+ zIndex = 1;
696
+ }
697
+ } else if (active === index) {
698
+ zIndex = 1;
699
+ }
674
700
  return {
675
701
  // So the non active thumb doesn't show its label on hover.
676
- pointerEvents: active !== -1 && active !== index ? 'none' : undefined
702
+ pointerEvents: active !== -1 && active !== index ? 'none' : undefined,
703
+ zIndex
677
704
  };
678
705
  };
679
706
  let cssWritingMode;
680
707
  if (orientation === 'vertical') {
681
708
  cssWritingMode = isRtl ? 'vertical-rl' : 'vertical-lr';
682
709
  }
683
- const getHiddenInputProps = (externalProps = {}) => {
710
+ const getHiddenInputProps = (externalProps = EMPTY_OBJ) => {
684
711
  const externalHandlers = extractEventHandlers(externalProps);
685
712
  const ownEventHandlers = {
686
- onChange: createHandleHiddenInputChange(externalHandlers || {}),
687
- onFocus: createHandleHiddenInputFocus(externalHandlers || {}),
688
- onBlur: createHandleHiddenInputBlur(externalHandlers || {}),
689
- onKeyDown: createHandleHiddenInputKeyDown(externalHandlers || {})
713
+ onChange: createHandleHiddenInputChange(externalHandlers),
714
+ onFocus: createHandleHiddenInputFocus(externalHandlers),
715
+ onBlur: createHandleHiddenInputBlur(externalHandlers),
716
+ onKeyDown: createHandleHiddenInputKeyDown(externalHandlers)
690
717
  };
691
718
  const mergedEventHandlers = {
692
719
  ...externalHandlers,
@@ -725,7 +752,7 @@ export function useSlider(parameters) {
725
752
  getHiddenInputProps,
726
753
  getRootProps,
727
754
  getThumbProps,
728
- marks: marks,
755
+ marks,
729
756
  open,
730
757
  range,
731
758
  rootRef: handleRef,