@mui/material 9.0.1 → 9.1.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 (228) hide show
  1. package/Accordion/Accordion.d.mts +2 -2
  2. package/Accordion/Accordion.d.ts +2 -2
  3. package/Accordion/Accordion.js +3 -2
  4. package/Accordion/Accordion.mjs +3 -2
  5. package/AccordionSummary/AccordionSummary.js +27 -29
  6. package/AccordionSummary/AccordionSummary.mjs +27 -29
  7. package/Autocomplete/Autocomplete.d.mts +5 -1
  8. package/Autocomplete/Autocomplete.d.ts +5 -1
  9. package/Autocomplete/Autocomplete.js +13 -7
  10. package/Autocomplete/Autocomplete.mjs +13 -7
  11. package/Backdrop/Backdrop.d.mts +2 -2
  12. package/Backdrop/Backdrop.d.ts +2 -2
  13. package/Badge/Badge.js +28 -24
  14. package/Badge/Badge.mjs +28 -24
  15. package/BottomNavigationAction/BottomNavigationAction.js +6 -2
  16. package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
  17. package/Button/Button.js +11 -15
  18. package/Button/Button.mjs +11 -15
  19. package/ButtonBase/Ripple.js +21 -11
  20. package/ButtonBase/Ripple.mjs +21 -11
  21. package/ButtonBase/TouchRipple.js +252 -108
  22. package/ButtonBase/TouchRipple.mjs +253 -109
  23. package/CHANGELOG.md +122 -0
  24. package/CardActionArea/CardActionArea.js +2 -1
  25. package/CardActionArea/CardActionArea.mjs +2 -1
  26. package/Chip/Chip.js +2 -1
  27. package/Chip/Chip.mjs +2 -1
  28. package/CircularProgress/CircularProgress.js +85 -55
  29. package/CircularProgress/CircularProgress.mjs +84 -55
  30. package/Collapse/Collapse.d.mts +15 -3
  31. package/Collapse/Collapse.d.ts +15 -3
  32. package/Collapse/Collapse.js +44 -31
  33. package/Collapse/Collapse.mjs +43 -30
  34. package/Dialog/Dialog.d.mts +2 -2
  35. package/Dialog/Dialog.d.ts +2 -2
  36. package/Dialog/Dialog.js +2 -0
  37. package/Dialog/Dialog.mjs +2 -0
  38. package/Drawer/Drawer.d.mts +2 -2
  39. package/Drawer/Drawer.d.ts +2 -2
  40. package/Fab/Fab.js +2 -1
  41. package/Fab/Fab.mjs +2 -1
  42. package/Fade/Fade.d.mts +15 -2
  43. package/Fade/Fade.d.ts +15 -2
  44. package/Fade/Fade.js +46 -19
  45. package/Fade/Fade.mjs +45 -18
  46. package/FilledInput/FilledInput.js +4 -3
  47. package/FilledInput/FilledInput.mjs +4 -3
  48. package/Grow/Grow.d.mts +15 -2
  49. package/Grow/Grow.d.ts +15 -2
  50. package/Grow/Grow.js +45 -28
  51. package/Grow/Grow.mjs +44 -27
  52. package/IconButton/IconButton.js +2 -1
  53. package/IconButton/IconButton.mjs +2 -1
  54. package/InitColorSchemeScript/InitColorSchemeScript.d.mts +5 -5
  55. package/InitColorSchemeScript/InitColorSchemeScript.d.ts +5 -5
  56. package/Input/Input.js +3 -2
  57. package/Input/Input.mjs +3 -2
  58. package/InputBase/InputBase.js +2 -1
  59. package/InputBase/InputBase.mjs +2 -1
  60. package/InputLabel/InputLabel.js +2 -1
  61. package/InputLabel/InputLabel.mjs +2 -1
  62. package/LICENSE +1 -1
  63. package/LinearProgress/LinearProgress.js +187 -120
  64. package/LinearProgress/LinearProgress.mjs +186 -120
  65. package/ListItem/ListItem.js +2 -1
  66. package/ListItem/ListItem.mjs +2 -1
  67. package/ListItemButton/ListItemButton.js +2 -1
  68. package/ListItemButton/ListItemButton.mjs +2 -1
  69. package/Menu/Menu.d.mts +1 -1
  70. package/Menu/Menu.d.ts +1 -1
  71. package/MobileStepper/MobileStepper.js +2 -1
  72. package/MobileStepper/MobileStepper.mjs +2 -1
  73. package/OutlinedInput/NotchedOutline.js +4 -3
  74. package/OutlinedInput/NotchedOutline.mjs +4 -3
  75. package/PaginationItem/PaginationItem.js +2 -1
  76. package/PaginationItem/PaginationItem.mjs +2 -1
  77. package/Paper/Paper.js +2 -1
  78. package/Paper/Paper.mjs +2 -1
  79. package/Popover/Popover.d.mts +1 -1
  80. package/Popover/Popover.d.ts +1 -1
  81. package/README.md +3 -2
  82. package/Radio/RadioButtonIcon.js +3 -2
  83. package/Radio/RadioButtonIcon.mjs +3 -2
  84. package/Rating/Rating.js +2 -1
  85. package/Rating/Rating.mjs +2 -1
  86. package/Select/SelectInput.js +115 -25
  87. package/Select/SelectInput.mjs +115 -25
  88. package/Select/utils/SelectFocusSourceContext.d.mts +2 -2
  89. package/Select/utils/SelectFocusSourceContext.d.ts +2 -2
  90. package/Select/utils/closedTypeahead.js +73 -0
  91. package/Select/utils/closedTypeahead.mjs +63 -0
  92. package/Skeleton/Skeleton.js +22 -2
  93. package/Skeleton/Skeleton.mjs +22 -2
  94. package/Slide/Slide.d.mts +15 -2
  95. package/Slide/Slide.d.ts +15 -2
  96. package/Slide/Slide.js +53 -25
  97. package/Slide/Slide.mjs +52 -24
  98. package/Slider/Slider.js +4 -3
  99. package/Slider/Slider.mjs +4 -3
  100. package/Slider/SliderValueLabel.d.mts +2 -2
  101. package/Slider/SliderValueLabel.d.ts +2 -2
  102. package/Slider/useSlider.js +1 -1
  103. package/Slider/useSlider.mjs +1 -1
  104. package/Snackbar/Snackbar.d.mts +2 -2
  105. package/Snackbar/Snackbar.d.ts +2 -2
  106. package/SpeedDial/SpeedDial.d.mts +1 -1
  107. package/SpeedDial/SpeedDial.d.ts +1 -1
  108. package/SpeedDial/SpeedDial.js +6 -2
  109. package/SpeedDial/SpeedDial.mjs +6 -2
  110. package/SpeedDialAction/SpeedDialAction.js +11 -2
  111. package/SpeedDialAction/SpeedDialAction.mjs +12 -3
  112. package/SpeedDialIcon/SpeedDialIcon.js +40 -37
  113. package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
  114. package/Step/Step.js +47 -15
  115. package/Step/Step.mjs +47 -15
  116. package/Step/StepContext.d.mts +1 -1
  117. package/Step/StepContext.d.ts +1 -1
  118. package/StepButton/StepButton.js +9 -3
  119. package/StepButton/StepButton.mjs +9 -3
  120. package/StepConnector/StepConnector.js +10 -0
  121. package/StepConnector/StepConnector.mjs +10 -0
  122. package/StepContent/StepContent.d.mts +2 -2
  123. package/StepContent/StepContent.d.ts +2 -2
  124. package/StepContent/StepContent.js +26 -2
  125. package/StepContent/StepContent.mjs +26 -2
  126. package/StepIcon/StepIcon.js +2 -1
  127. package/StepIcon/StepIcon.mjs +2 -1
  128. package/StepLabel/StepLabel.js +52 -7
  129. package/StepLabel/StepLabel.mjs +52 -7
  130. package/Stepper/Stepper.d.mts +2 -0
  131. package/Stepper/Stepper.d.ts +2 -0
  132. package/Stepper/Stepper.js +18 -0
  133. package/Stepper/Stepper.mjs +18 -0
  134. package/Stepper/StepperContext.d.mts +1 -1
  135. package/Stepper/StepperContext.d.ts +1 -1
  136. package/SvgIcon/SvgIcon.js +2 -1
  137. package/SvgIcon/SvgIcon.mjs +2 -1
  138. package/SwipeableDrawer/SwipeableDrawer.js +14 -3
  139. package/SwipeableDrawer/SwipeableDrawer.mjs +14 -3
  140. package/Switch/Switch.js +3 -2
  141. package/Switch/Switch.mjs +3 -2
  142. package/TableSortLabel/TableSortLabel.js +2 -1
  143. package/TableSortLabel/TableSortLabel.mjs +2 -1
  144. package/Tabs/Tabs.js +14 -3
  145. package/Tabs/Tabs.mjs +14 -3
  146. package/Tooltip/Tooltip.d.mts +2 -2
  147. package/Tooltip/Tooltip.d.ts +2 -2
  148. package/Tooltip/Tooltip.js +3 -0
  149. package/Tooltip/Tooltip.mjs +3 -0
  150. package/Unstable_TrapFocus/FocusTrap.js +42 -8
  151. package/Unstable_TrapFocus/FocusTrap.mjs +42 -8
  152. package/Zoom/Zoom.d.mts +15 -2
  153. package/Zoom/Zoom.d.ts +15 -2
  154. package/Zoom/Zoom.js +43 -16
  155. package/Zoom/Zoom.mjs +42 -15
  156. package/index.js +1 -1
  157. package/index.mjs +1 -1
  158. package/internal/Transition.d.mts +34 -0
  159. package/internal/Transition.d.ts +34 -0
  160. package/internal/Transition.js +450 -0
  161. package/internal/Transition.mjs +442 -0
  162. package/internal/react-transition-group.d.mts +8 -0
  163. package/internal/react-transition-group.d.ts +8 -0
  164. package/package.json +7 -7
  165. package/styles/ThemeProviderWithVars.d.mts +7 -7
  166. package/styles/ThemeProviderWithVars.d.ts +7 -7
  167. package/styles/createGetSelector.d.mts +2 -2
  168. package/styles/createGetSelector.d.ts +2 -2
  169. package/styles/createMotion.d.mts +8 -0
  170. package/styles/createMotion.d.ts +8 -0
  171. package/styles/createMotion.js +13 -0
  172. package/styles/createMotion.mjs +7 -0
  173. package/styles/createThemeFoundation.d.mts +2 -0
  174. package/styles/createThemeFoundation.d.ts +2 -0
  175. package/styles/createThemeNoVars.d.mts +3 -0
  176. package/styles/createThemeNoVars.d.ts +3 -0
  177. package/styles/createThemeNoVars.js +5 -0
  178. package/styles/createThemeNoVars.mjs +5 -0
  179. package/styles/createTransitions.d.mts +6 -2
  180. package/styles/createTransitions.d.ts +6 -2
  181. package/styles/createTransitions.js +12 -4
  182. package/styles/createTransitions.mjs +12 -4
  183. package/styles/enhanceHighContrast.d.mts +70 -0
  184. package/styles/enhanceHighContrast.d.ts +70 -0
  185. package/styles/enhanceHighContrast.js +502 -0
  186. package/styles/enhanceHighContrast.mjs +495 -0
  187. package/styles/identifier.d.mts +1 -1
  188. package/styles/identifier.d.ts +1 -1
  189. package/styles/index.d.mts +2 -0
  190. package/styles/index.d.ts +2 -0
  191. package/styles/index.js +8 -0
  192. package/styles/index.mjs +1 -0
  193. package/styles/reducedMotion.d.mts +7 -0
  194. package/styles/reducedMotion.d.ts +7 -0
  195. package/styles/reducedMotion.js +21 -0
  196. package/styles/reducedMotion.mjs +14 -0
  197. package/styles/shouldSkipGeneratingVar.js +1 -1
  198. package/styles/shouldSkipGeneratingVar.mjs +1 -1
  199. package/styles/stringifyTheme.js +1 -0
  200. package/styles/stringifyTheme.mjs +1 -0
  201. package/transitions/index.d.mts +1 -1
  202. package/transitions/index.d.ts +1 -1
  203. package/transitions/index.js +0 -11
  204. package/transitions/index.mjs +1 -1
  205. package/transitions/transition.d.mts +1 -12
  206. package/transitions/transition.d.ts +1 -12
  207. package/transitions/types.d.mts +73 -0
  208. package/transitions/types.d.ts +73 -0
  209. package/transitions/useReducedMotion.d.mts +14 -0
  210. package/transitions/useReducedMotion.d.ts +14 -0
  211. package/transitions/useReducedMotion.js +117 -0
  212. package/transitions/useReducedMotion.mjs +110 -0
  213. package/transitions/utils.d.mts +34 -2
  214. package/transitions/utils.d.ts +34 -2
  215. package/transitions/utils.js +33 -4
  216. package/transitions/utils.mjs +31 -4
  217. package/useAutocomplete/useAutocomplete.d.mts +8 -1
  218. package/useAutocomplete/useAutocomplete.d.ts +8 -1
  219. package/useAutocomplete/useAutocomplete.js +66 -4
  220. package/useAutocomplete/useAutocomplete.mjs +66 -4
  221. package/utils/memoTheme.d.mts +1 -1
  222. package/utils/memoTheme.d.ts +1 -1
  223. package/utils/useSlot.d.mts +1 -1
  224. package/utils/useSlot.d.ts +1 -1
  225. package/version/index.js +2 -2
  226. package/version/index.mjs +2 -2
  227. /package/transitions/{transition.js → types.js} +0 -0
  228. /package/transitions/{transition.mjs → types.mjs} +0 -0
@@ -9,6 +9,7 @@ import memoTheme from "../utils/memoTheme.mjs";
9
9
  import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
10
10
  import ButtonBase from "../ButtonBase/index.mjs";
11
11
  import unsupportedProp from "../utils/unsupportedProp.mjs";
12
+ import { getTransitionStyles } from "../transitions/utils.mjs";
12
13
  import bottomNavigationActionClasses, { getBottomNavigationActionUtilityClass } from "./bottomNavigationActionClasses.mjs";
13
14
  import useSlot from "../utils/useSlot.mjs";
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -36,7 +37,7 @@ const BottomNavigationActionRoot = styled(ButtonBase, {
36
37
  })(memoTheme(({
37
38
  theme
38
39
  }) => ({
39
- transition: theme.transitions.create(['color', 'padding-top'], {
40
+ ...getTransitionStyles(theme, ['color', 'padding-top'], {
40
41
  duration: theme.transitions.duration.short
41
42
  }),
42
43
  padding: '0px 12px',
@@ -76,7 +77,10 @@ const BottomNavigationActionLabel = styled('span', {
76
77
  fontFamily: theme.typography.fontFamily,
77
78
  fontSize: theme.typography.pxToRem(12),
78
79
  opacity: 1,
79
- transition: 'font-size 0.2s, opacity 0.2s',
80
+ ...getTransitionStyles(theme, ['font-size', 'opacity'], {
81
+ duration: '0.2s',
82
+ easing: 'ease'
83
+ }),
80
84
  transitionDelay: '0.1s',
81
85
  [`&.${bottomNavigationActionClasses.selected}`]: {
82
86
  fontSize: theme.typography.pxToRem(14)
package/Button/Button.js CHANGED
@@ -24,6 +24,7 @@ var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/c
24
24
  var _buttonClasses = _interopRequireWildcard(require("./buttonClasses"));
25
25
  var _ButtonGroupContext = _interopRequireDefault(require("../ButtonGroup/ButtonGroupContext"));
26
26
  var _ButtonGroupButtonContext = _interopRequireDefault(require("../ButtonGroup/ButtonGroupButtonContext"));
27
+ var _utils2 = require("../transitions/utils");
27
28
  var _jsxRuntime = require("react/jsx-runtime");
28
29
  const useUtilityClasses = ownerState => {
29
30
  const {
@@ -99,7 +100,7 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
99
100
  padding: '6px 16px',
100
101
  border: 0,
101
102
  borderRadius: (theme.vars || theme).shape.borderRadius,
102
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
103
+ ...(0, _utils2.getTransitionStyles)(theme, ['background-color', 'box-shadow', 'border-color', 'color'], {
103
104
  duration: theme.transitions.duration.short
104
105
  }),
105
106
  '&:hover': {
@@ -109,17 +110,6 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
109
110
  color: (theme.vars || theme).palette.action.disabled
110
111
  },
111
112
  variants: [{
112
- props: ({
113
- ownerState
114
- }) => ownerState.startIcon || ownerState.loading && ownerState.loadingPosition === 'start',
115
- style: {
116
- '&::before': {
117
- content: '"\\200b"',
118
- width: 0,
119
- overflow: 'hidden'
120
- }
121
- }
122
- }, {
123
113
  props: {
124
114
  variant: 'contained'
125
115
  },
@@ -289,7 +279,7 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
289
279
  loadingPosition: 'center'
290
280
  },
291
281
  style: {
292
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
282
+ ...(0, _utils2.getTransitionStyles)(theme, ['background-color', 'box-shadow', 'border-color'], {
293
283
  duration: theme.transitions.duration.short
294
284
  }),
295
285
  [`&.${_buttonClasses.default.loading}`]: {
@@ -312,8 +302,14 @@ const ButtonStartIcon = (0, _zeroStyled.styled)('span', {
312
302
  theme
313
303
  }) => ({
314
304
  display: 'inherit',
305
+ alignItems: 'center',
315
306
  marginRight: 8,
316
307
  marginLeft: -4,
308
+ '&::before': {
309
+ content: '"\\200b"',
310
+ width: 0,
311
+ overflow: 'hidden'
312
+ },
317
313
  variants: [{
318
314
  props: {
319
315
  size: 'small'
@@ -327,7 +323,7 @@ const ButtonStartIcon = (0, _zeroStyled.styled)('span', {
327
323
  loading: true
328
324
  },
329
325
  style: {
330
- transition: theme.transitions.create(['opacity'], {
326
+ ...(0, _utils2.getTransitionStyles)(theme, ['opacity'], {
331
327
  duration: theme.transitions.duration.short
332
328
  }),
333
329
  opacity: 0
@@ -371,7 +367,7 @@ const ButtonEndIcon = (0, _zeroStyled.styled)('span', {
371
367
  loading: true
372
368
  },
373
369
  style: {
374
- transition: theme.transitions.create(['opacity'], {
370
+ ...(0, _utils2.getTransitionStyles)(theme, ['opacity'], {
375
371
  duration: theme.transitions.duration.short
376
372
  }),
377
373
  opacity: 0
package/Button/Button.mjs CHANGED
@@ -17,6 +17,7 @@ import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFil
17
17
  import buttonClasses, { getButtonUtilityClass } from "./buttonClasses.mjs";
18
18
  import ButtonGroupContext from "../ButtonGroup/ButtonGroupContext.mjs";
19
19
  import ButtonGroupButtonContext from "../ButtonGroup/ButtonGroupButtonContext.mjs";
20
+ import { getTransitionStyles } from "../transitions/utils.mjs";
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
22
  const useUtilityClasses = ownerState => {
22
23
  const {
@@ -92,7 +93,7 @@ const ButtonRoot = styled(ButtonBase, {
92
93
  padding: '6px 16px',
93
94
  border: 0,
94
95
  borderRadius: (theme.vars || theme).shape.borderRadius,
95
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
96
+ ...getTransitionStyles(theme, ['background-color', 'box-shadow', 'border-color', 'color'], {
96
97
  duration: theme.transitions.duration.short
97
98
  }),
98
99
  '&:hover': {
@@ -102,17 +103,6 @@ const ButtonRoot = styled(ButtonBase, {
102
103
  color: (theme.vars || theme).palette.action.disabled
103
104
  },
104
105
  variants: [{
105
- props: ({
106
- ownerState
107
- }) => ownerState.startIcon || ownerState.loading && ownerState.loadingPosition === 'start',
108
- style: {
109
- '&::before': {
110
- content: '"\\200b"',
111
- width: 0,
112
- overflow: 'hidden'
113
- }
114
- }
115
- }, {
116
106
  props: {
117
107
  variant: 'contained'
118
108
  },
@@ -282,7 +272,7 @@ const ButtonRoot = styled(ButtonBase, {
282
272
  loadingPosition: 'center'
283
273
  },
284
274
  style: {
285
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
275
+ ...getTransitionStyles(theme, ['background-color', 'box-shadow', 'border-color'], {
286
276
  duration: theme.transitions.duration.short
287
277
  }),
288
278
  [`&.${buttonClasses.loading}`]: {
@@ -305,8 +295,14 @@ const ButtonStartIcon = styled('span', {
305
295
  theme
306
296
  }) => ({
307
297
  display: 'inherit',
298
+ alignItems: 'center',
308
299
  marginRight: 8,
309
300
  marginLeft: -4,
301
+ '&::before': {
302
+ content: '"\\200b"',
303
+ width: 0,
304
+ overflow: 'hidden'
305
+ },
310
306
  variants: [{
311
307
  props: {
312
308
  size: 'small'
@@ -320,7 +316,7 @@ const ButtonStartIcon = styled('span', {
320
316
  loading: true
321
317
  },
322
318
  style: {
323
- transition: theme.transitions.create(['opacity'], {
319
+ ...getTransitionStyles(theme, ['opacity'], {
324
320
  duration: theme.transitions.duration.short
325
321
  }),
326
322
  opacity: 0
@@ -364,7 +360,7 @@ const ButtonEndIcon = styled('span', {
364
360
  loading: true
365
361
  },
366
362
  style: {
367
- transition: theme.transitions.create(['opacity'], {
363
+ ...getTransitionStyles(theme, ['opacity'], {
368
364
  duration: theme.transitions.duration.short
369
365
  }),
370
366
  opacity: 0
@@ -10,6 +10,7 @@ exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
+ var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  /**
15
16
  * @ignore - internal component.
@@ -26,6 +27,11 @@ var _jsxRuntime = require("react/jsx-runtime");
26
27
  timeout
27
28
  } = props;
28
29
  const [leaving, setLeaving] = React.useState(false);
30
+ const exitTimer = (0, _useTimeout.default)();
31
+ const exitTimerStartedRef = React.useRef(false);
32
+ const onExitedRef = React.useRef(onExited);
33
+ onExitedRef.current = onExited;
34
+ const hasExitedCallback = onExited != null;
29
35
  const rippleClassName = (0, _clsx.default)(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
30
36
  const rippleStyles = {
31
37
  width: rippleSize,
@@ -38,15 +44,19 @@ var _jsxRuntime = require("react/jsx-runtime");
38
44
  setLeaving(true);
39
45
  }
40
46
  React.useEffect(() => {
41
- if (!inProp && onExited != null) {
42
- // react-transition-group#onExited
43
- const timeoutId = setTimeout(onExited, timeout);
44
- return () => {
45
- clearTimeout(timeoutId);
46
- };
47
+ if (!inProp && hasExitedCallback) {
48
+ if (!exitTimerStartedRef.current) {
49
+ exitTimerStartedRef.current = true;
50
+ exitTimer.start(timeout, () => {
51
+ exitTimerStartedRef.current = false;
52
+ onExitedRef.current?.();
53
+ });
54
+ }
55
+ } else {
56
+ exitTimerStartedRef.current = false;
57
+ exitTimer.clear();
47
58
  }
48
- return undefined;
49
- }, [onExited, inProp, timeout]);
59
+ }, [exitTimer, hasExitedCallback, inProp, timeout]);
50
60
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
51
61
  className: rippleClassName,
52
62
  style: rippleStyles,
@@ -62,11 +72,11 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
62
72
  classes: _propTypes.default.object.isRequired,
63
73
  className: _propTypes.default.string,
64
74
  /**
65
- * @ignore - injected from TransitionGroup
75
+ * @ignore - controlled by TouchRipple
66
76
  */
67
77
  in: _propTypes.default.bool,
68
78
  /**
69
- * @ignore - injected from TransitionGroup
79
+ * @ignore - controlled by TouchRipple
70
80
  */
71
81
  onExited: _propTypes.default.func,
72
82
  /**
@@ -86,7 +96,7 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
86
96
  */
87
97
  rippleY: _propTypes.default.number,
88
98
  /**
89
- * exit delay
99
+ * Exit delay.
90
100
  */
91
101
  timeout: _propTypes.default.number.isRequired
92
102
  } : void 0;
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
+ import useTimeout from '@mui/utils/useTimeout';
6
7
 
7
8
  /**
8
9
  * @ignore - internal component.
@@ -21,6 +22,11 @@ function Ripple(props) {
21
22
  timeout
22
23
  } = props;
23
24
  const [leaving, setLeaving] = React.useState(false);
25
+ const exitTimer = useTimeout();
26
+ const exitTimerStartedRef = React.useRef(false);
27
+ const onExitedRef = React.useRef(onExited);
28
+ onExitedRef.current = onExited;
29
+ const hasExitedCallback = onExited != null;
24
30
  const rippleClassName = clsx(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
25
31
  const rippleStyles = {
26
32
  width: rippleSize,
@@ -33,15 +39,19 @@ function Ripple(props) {
33
39
  setLeaving(true);
34
40
  }
35
41
  React.useEffect(() => {
36
- if (!inProp && onExited != null) {
37
- // react-transition-group#onExited
38
- const timeoutId = setTimeout(onExited, timeout);
39
- return () => {
40
- clearTimeout(timeoutId);
41
- };
42
+ if (!inProp && hasExitedCallback) {
43
+ if (!exitTimerStartedRef.current) {
44
+ exitTimerStartedRef.current = true;
45
+ exitTimer.start(timeout, () => {
46
+ exitTimerStartedRef.current = false;
47
+ onExitedRef.current?.();
48
+ });
49
+ }
50
+ } else {
51
+ exitTimerStartedRef.current = false;
52
+ exitTimer.clear();
42
53
  }
43
- return undefined;
44
- }, [onExited, inProp, timeout]);
54
+ }, [exitTimer, hasExitedCallback, inProp, timeout]);
45
55
  return /*#__PURE__*/_jsx("span", {
46
56
  className: rippleClassName,
47
57
  style: rippleStyles,
@@ -57,11 +67,11 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
57
67
  classes: PropTypes.object.isRequired,
58
68
  className: PropTypes.string,
59
69
  /**
60
- * @ignore - injected from TransitionGroup
70
+ * @ignore - controlled by TouchRipple
61
71
  */
62
72
  in: PropTypes.bool,
63
73
  /**
64
- * @ignore - injected from TransitionGroup
74
+ * @ignore - controlled by TouchRipple
65
75
  */
66
76
  onExited: PropTypes.func,
67
77
  /**
@@ -81,7 +91,7 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
81
91
  */
82
92
  rippleY: PropTypes.number,
83
93
  /**
84
- * exit delay
94
+ * Exit delay.
85
95
  */
86
96
  timeout: PropTypes.number.isRequired
87
97
  } : void 0;