@mui/material 9.0.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion/Accordion.d.mts +2 -2
- package/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.js +3 -2
- package/Accordion/Accordion.mjs +3 -2
- package/AccordionSummary/AccordionSummary.js +27 -29
- package/AccordionSummary/AccordionSummary.mjs +27 -29
- package/Autocomplete/Autocomplete.js +8 -6
- package/Autocomplete/Autocomplete.mjs +8 -6
- package/Backdrop/Backdrop.d.mts +2 -2
- package/Backdrop/Backdrop.d.ts +2 -2
- package/Badge/Badge.js +28 -24
- package/Badge/Badge.mjs +28 -24
- package/BottomNavigationAction/BottomNavigationAction.js +6 -2
- package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
- package/Button/Button.js +11 -15
- package/Button/Button.mjs +11 -15
- package/ButtonBase/Ripple.js +21 -11
- package/ButtonBase/Ripple.mjs +21 -11
- package/ButtonBase/TouchRipple.js +252 -116
- package/ButtonBase/TouchRipple.mjs +253 -117
- package/CHANGELOG.md +84 -0
- package/CardActionArea/CardActionArea.js +2 -1
- package/CardActionArea/CardActionArea.mjs +2 -1
- package/Chip/Chip.js +2 -1
- package/Chip/Chip.mjs +2 -1
- package/CircularProgress/CircularProgress.js +85 -55
- package/CircularProgress/CircularProgress.mjs +84 -55
- package/Collapse/Collapse.d.mts +15 -3
- package/Collapse/Collapse.d.ts +15 -3
- package/Collapse/Collapse.js +44 -31
- package/Collapse/Collapse.mjs +43 -30
- package/Dialog/Dialog.d.mts +2 -2
- package/Dialog/Dialog.d.ts +2 -2
- package/Dialog/Dialog.js +2 -0
- package/Dialog/Dialog.mjs +2 -0
- package/Drawer/Drawer.d.mts +2 -2
- package/Drawer/Drawer.d.ts +2 -2
- package/Fab/Fab.js +2 -1
- package/Fab/Fab.mjs +2 -1
- package/Fade/Fade.d.mts +15 -2
- package/Fade/Fade.d.ts +15 -2
- package/Fade/Fade.js +46 -19
- package/Fade/Fade.mjs +45 -18
- package/FilledInput/FilledInput.js +4 -3
- package/FilledInput/FilledInput.mjs +4 -3
- package/Grow/Grow.d.mts +15 -2
- package/Grow/Grow.d.ts +15 -2
- package/Grow/Grow.js +45 -28
- package/Grow/Grow.mjs +44 -27
- package/IconButton/IconButton.js +2 -1
- package/IconButton/IconButton.mjs +2 -1
- package/Input/Input.js +3 -2
- package/Input/Input.mjs +3 -2
- package/InputBase/InputBase.js +2 -1
- package/InputBase/InputBase.mjs +2 -1
- package/InputLabel/InputLabel.js +2 -1
- package/InputLabel/InputLabel.mjs +2 -1
- package/LICENSE +1 -1
- package/LinearProgress/LinearProgress.js +187 -120
- package/LinearProgress/LinearProgress.mjs +186 -120
- package/ListItem/ListItem.js +2 -1
- package/ListItem/ListItem.mjs +2 -1
- package/ListItemButton/ListItemButton.js +2 -1
- package/ListItemButton/ListItemButton.mjs +2 -1
- package/Menu/Menu.d.mts +1 -1
- package/Menu/Menu.d.ts +1 -1
- package/MobileStepper/MobileStepper.js +2 -1
- package/MobileStepper/MobileStepper.mjs +2 -1
- package/OutlinedInput/NotchedOutline.js +4 -3
- package/OutlinedInput/NotchedOutline.mjs +4 -3
- package/PaginationItem/PaginationItem.js +2 -1
- package/PaginationItem/PaginationItem.mjs +2 -1
- package/Paper/Paper.js +2 -1
- package/Paper/Paper.mjs +2 -1
- package/Popover/Popover.d.mts +1 -1
- package/Popover/Popover.d.ts +1 -1
- package/README.md +3 -2
- package/Radio/RadioButtonIcon.js +3 -2
- package/Radio/RadioButtonIcon.mjs +3 -2
- package/Rating/Rating.js +2 -1
- package/Rating/Rating.mjs +2 -1
- package/Select/SelectInput.js +115 -25
- package/Select/SelectInput.mjs +115 -25
- package/Select/utils/closedTypeahead.js +73 -0
- package/Select/utils/closedTypeahead.mjs +63 -0
- package/Skeleton/Skeleton.js +22 -2
- package/Skeleton/Skeleton.mjs +22 -2
- package/Slide/Slide.d.mts +15 -2
- package/Slide/Slide.d.ts +15 -2
- package/Slide/Slide.js +53 -25
- package/Slide/Slide.mjs +52 -24
- package/Slider/Slider.js +4 -3
- package/Slider/Slider.mjs +4 -3
- package/Slider/useSlider.js +1 -1
- package/Slider/useSlider.mjs +1 -1
- package/Snackbar/Snackbar.d.mts +2 -2
- package/Snackbar/Snackbar.d.ts +2 -2
- package/SpeedDial/SpeedDial.d.mts +1 -1
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/SpeedDial/SpeedDial.js +6 -2
- package/SpeedDial/SpeedDial.mjs +6 -2
- package/SpeedDialAction/SpeedDialAction.js +11 -2
- package/SpeedDialAction/SpeedDialAction.mjs +12 -3
- package/SpeedDialIcon/SpeedDialIcon.js +40 -37
- package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
- package/Step/Step.js +47 -15
- package/Step/Step.mjs +47 -15
- package/StepButton/StepButton.js +9 -3
- package/StepButton/StepButton.mjs +9 -3
- package/StepConnector/StepConnector.js +10 -0
- package/StepConnector/StepConnector.mjs +10 -0
- package/StepContent/StepContent.d.mts +2 -2
- package/StepContent/StepContent.d.ts +2 -2
- package/StepContent/StepContent.js +26 -2
- package/StepContent/StepContent.mjs +26 -2
- package/StepIcon/StepIcon.js +2 -1
- package/StepIcon/StepIcon.mjs +2 -1
- package/StepLabel/StepLabel.js +52 -7
- package/StepLabel/StepLabel.mjs +52 -7
- package/Stepper/Stepper.d.mts +2 -0
- package/Stepper/Stepper.d.ts +2 -0
- package/Stepper/Stepper.js +18 -0
- package/Stepper/Stepper.mjs +18 -0
- package/SvgIcon/SvgIcon.js +2 -1
- package/SvgIcon/SvgIcon.mjs +2 -1
- package/SwipeableDrawer/SwipeableDrawer.js +14 -3
- package/SwipeableDrawer/SwipeableDrawer.mjs +14 -3
- package/Switch/Switch.js +3 -2
- package/Switch/Switch.mjs +3 -2
- package/TableSortLabel/TableSortLabel.js +2 -1
- package/TableSortLabel/TableSortLabel.mjs +2 -1
- package/Tabs/Tabs.js +14 -3
- package/Tabs/Tabs.mjs +14 -3
- package/Tooltip/Tooltip.d.mts +2 -2
- package/Tooltip/Tooltip.d.ts +2 -2
- package/Tooltip/Tooltip.js +3 -0
- package/Tooltip/Tooltip.mjs +3 -0
- package/Unstable_TrapFocus/FocusTrap.js +42 -8
- package/Unstable_TrapFocus/FocusTrap.mjs +42 -8
- package/Zoom/Zoom.d.mts +15 -2
- package/Zoom/Zoom.d.ts +15 -2
- package/Zoom/Zoom.js +43 -16
- package/Zoom/Zoom.mjs +42 -15
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internal/Transition.d.mts +34 -0
- package/internal/Transition.d.ts +34 -0
- package/internal/Transition.js +444 -0
- package/internal/Transition.mjs +436 -0
- package/internal/react-transition-group.d.mts +8 -0
- package/internal/react-transition-group.d.ts +8 -0
- package/package.json +6 -6
- package/styles/createMotion.d.mts +8 -0
- package/styles/createMotion.d.ts +8 -0
- package/styles/createMotion.js +13 -0
- package/styles/createMotion.mjs +7 -0
- package/styles/createThemeFoundation.d.mts +2 -0
- package/styles/createThemeFoundation.d.ts +2 -0
- package/styles/createThemeNoVars.d.mts +3 -0
- package/styles/createThemeNoVars.d.ts +3 -0
- package/styles/createThemeNoVars.js +5 -0
- package/styles/createThemeNoVars.mjs +5 -0
- package/styles/createTransitions.d.mts +6 -2
- package/styles/createTransitions.d.ts +6 -2
- package/styles/createTransitions.js +12 -4
- package/styles/createTransitions.mjs +12 -4
- package/styles/enhanceHighContrast.d.mts +70 -0
- package/styles/enhanceHighContrast.d.ts +70 -0
- package/styles/enhanceHighContrast.js +502 -0
- package/styles/enhanceHighContrast.mjs +495 -0
- package/styles/index.d.mts +2 -0
- package/styles/index.d.ts +2 -0
- package/styles/index.js +8 -0
- package/styles/index.mjs +1 -0
- package/styles/reducedMotion.d.mts +7 -0
- package/styles/reducedMotion.d.ts +7 -0
- package/styles/reducedMotion.js +21 -0
- package/styles/reducedMotion.mjs +14 -0
- package/styles/shouldSkipGeneratingVar.js +1 -1
- package/styles/shouldSkipGeneratingVar.mjs +1 -1
- package/styles/stringifyTheme.js +1 -0
- package/styles/stringifyTheme.mjs +1 -0
- package/transitions/index.d.mts +1 -1
- package/transitions/index.d.ts +1 -1
- package/transitions/index.js +0 -11
- package/transitions/index.mjs +1 -1
- package/transitions/transition.d.mts +1 -12
- package/transitions/transition.d.ts +1 -12
- package/transitions/types.d.mts +73 -0
- package/transitions/types.d.ts +73 -0
- package/transitions/useReducedMotion.d.mts +14 -0
- package/transitions/useReducedMotion.d.ts +14 -0
- package/transitions/useReducedMotion.js +117 -0
- package/transitions/useReducedMotion.mjs +110 -0
- package/transitions/utils.d.mts +34 -2
- package/transitions/utils.d.ts +34 -2
- package/transitions/utils.js +33 -4
- package/transitions/utils.mjs +31 -4
- package/useAutocomplete/useAutocomplete.d.mts +8 -1
- package/useAutocomplete/useAutocomplete.d.ts +8 -1
- package/useAutocomplete/useAutocomplete.js +66 -4
- package/useAutocomplete/useAutocomplete.mjs +66 -4
- package/version/index.js +3 -3
- package/version/index.mjs +3 -3
- /package/transitions/{transition.js → types.js} +0 -0
- /package/transitions/{transition.mjs → types.mjs} +0 -0
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
363
|
+
...getTransitionStyles(theme, ['opacity'], {
|
|
368
364
|
duration: theme.transitions.duration.short
|
|
369
365
|
}),
|
|
370
366
|
opacity: 0
|
package/ButtonBase/Ripple.js
CHANGED
|
@@ -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 &&
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
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 -
|
|
75
|
+
* @ignore - controlled by TouchRipple
|
|
66
76
|
*/
|
|
67
77
|
in: _propTypes.default.bool,
|
|
68
78
|
/**
|
|
69
|
-
* @ignore -
|
|
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
|
-
*
|
|
99
|
+
* Exit delay.
|
|
90
100
|
*/
|
|
91
101
|
timeout: _propTypes.default.number.isRequired
|
|
92
102
|
} : void 0;
|
package/ButtonBase/Ripple.mjs
CHANGED
|
@@ -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 &&
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
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 -
|
|
70
|
+
* @ignore - controlled by TouchRipple
|
|
61
71
|
*/
|
|
62
72
|
in: PropTypes.bool,
|
|
63
73
|
/**
|
|
64
|
-
* @ignore -
|
|
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
|
-
*
|
|
94
|
+
* Exit delay.
|
|
85
95
|
*/
|
|
86
96
|
timeout: PropTypes.number.isRequired
|
|
87
97
|
} : void 0;
|