@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
package/Fade/Fade.js CHANGED
@@ -9,9 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _reactTransitionGroup = require("react-transition-group");
13
12
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
14
13
  var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
14
+ var _Transition = _interopRequireDefault(require("../internal/Transition"));
15
+ var _useReducedMotion = _interopRequireDefault(require("../transitions/useReducedMotion"));
15
16
  var _zeroStyled = require("../zero-styled");
16
17
  var _utils = require("../transitions/utils");
17
18
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
@@ -37,7 +38,6 @@ const hiddenStyles = {
37
38
 
38
39
  /**
39
40
  * The Fade transition is used by the [Modal](/material-ui/react-modal/) component.
40
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
41
41
  */
42
42
  const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
43
43
  const theme = (0, _zeroStyled.useTheme)();
@@ -49,6 +49,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
49
49
  addEndListener,
50
50
  appear = true,
51
51
  children,
52
+ disablePrefersReducedMotion = false,
52
53
  easing,
53
54
  in: inProp,
54
55
  onEnter,
@@ -61,12 +62,14 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
61
62
  timeout = defaultTimeout,
62
63
  ...other
63
64
  } = props;
65
+ const reducedMotion = (0, _useReducedMotion.default)(theme.motion.reducedMotion, disablePrefersReducedMotion);
64
66
  const nodeRef = React.useRef(null);
65
67
  const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactElementRef.default)(children), ref);
66
68
  const handleEntering = (0, _utils.normalizedTransitionCallback)(nodeRef, onEntering);
67
69
  const handleEnter = (0, _utils.normalizedTransitionCallback)(nodeRef, (node, isAppearing) => {
68
- (0, _utils.reflow)(node); // So the animation always start from the start.
69
-
70
+ if (!reducedMotion.shouldReduceMotion) {
71
+ (0, _utils.reflow)(node); // Force layout so the animation starts from the initial styles.
72
+ }
70
73
  const transitionProps = (0, _utils.getTransitionProps)({
71
74
  style,
72
75
  timeout,
@@ -74,7 +77,15 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
74
77
  }, {
75
78
  mode: 'enter'
76
79
  });
77
- node.style.transition = theme.transitions.create('opacity', transitionProps);
80
+ const transitionTiming = reducedMotion.getTransitionTiming({
81
+ duration: transitionProps.duration,
82
+ delay: transitionProps.delay
83
+ });
84
+ node.style.transition = theme.transitions.create('opacity', {
85
+ duration: transitionTiming.duration,
86
+ easing: transitionProps.easing,
87
+ delay: transitionTiming.delay
88
+ });
78
89
  if (onEnter) {
79
90
  onEnter(node, isAppearing);
80
91
  }
@@ -89,27 +100,32 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
89
100
  }, {
90
101
  mode: 'exit'
91
102
  });
92
- node.style.transition = theme.transitions.create('opacity', transitionProps);
103
+ const transitionTiming = reducedMotion.getTransitionTiming({
104
+ duration: transitionProps.duration,
105
+ delay: transitionProps.delay
106
+ });
107
+ node.style.transition = theme.transitions.create('opacity', {
108
+ duration: transitionTiming.duration,
109
+ easing: transitionProps.easing,
110
+ delay: transitionTiming.delay
111
+ });
93
112
  if (onExit) {
94
113
  onExit(node);
95
114
  }
96
115
  });
97
116
  const handleExited = (0, _utils.normalizedTransitionCallback)(nodeRef, node => {
98
- // Clear the transition CSS to release the compositor layer when the
99
- // element is fully exited (prevents idle CPU usage on fixed elements
100
- // like Backdrop). handleEnter re-sets it on the next open.
117
+ // Clear transition CSS after exit so fixed elements like Backdrop do not
118
+ // keep a compositor layer alive and cause idle CPU usage. handleEnter sets
119
+ // it again on next open.
101
120
  node.style.transition = '';
102
121
  if (onExited) {
103
122
  onExited(node);
104
123
  }
105
124
  });
106
- const handleAddEndListener = next => {
107
- if (addEndListener) {
108
- // Old call signature before `react-transition-group` implemented `nodeRef`
109
- addEndListener(nodeRef.current, next);
110
- }
111
- };
112
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.Transition, {
125
+ const handleAddEndListener = addEndListener ? next => {
126
+ addEndListener(nodeRef.current, next);
127
+ } : undefined;
128
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Transition.default, {
113
129
  appear: appear,
114
130
  in: inProp,
115
131
  nodeRef: nodeRef,
@@ -120,12 +136,15 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
120
136
  onExited: handleExited,
121
137
  onExiting: handleExiting,
122
138
  addEndListener: handleAddEndListener,
139
+ reduceMotion: reducedMotion.shouldReduceMotion,
123
140
  timeout: timeout,
124
141
  ...other,
125
142
  children: (state, {
126
143
  ownerState,
127
144
  ...restChildProps
128
145
  }) => {
146
+ // Do not pass ownerState to a DOM child. ownerState is only for
147
+ // Material UI styling, and React would treat it as an invalid DOM attribute.
129
148
  const childStyle = (0, _utils.getTransitionChildStyle)(state, inProp, styles, hiddenStyles, style, children.props.style);
130
149
  return /*#__PURE__*/React.cloneElement(children, {
131
150
  style: childStyle,
@@ -141,9 +160,12 @@ process.env.NODE_ENV !== "production" ? Fade.propTypes /* remove-proptypes */ =
141
160
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
142
161
  // └─────────────────────────────────────────────────────────────────────┘
143
162
  /**
144
- * Add a custom transition end trigger. Called with the transitioning DOM
145
- * node and a done callback. Allows for more fine grained transition end
146
- * logic. Note: Timeouts are still used as a fallback if provided.
163
+ * Add a custom transition end trigger.
164
+ * Use it when you need custom logic to decide when the transition has ended.
165
+ * Note: Timeouts are still used as a fallback if provided.
166
+ *
167
+ * @param {HTMLElement} node The transitioning DOM node.
168
+ * @param {Function} done Call this when the transition has finished.
147
169
  */
148
170
  addEndListener: _propTypes.default.func,
149
171
  /**
@@ -156,6 +178,11 @@ process.env.NODE_ENV !== "production" ? Fade.propTypes /* remove-proptypes */ =
156
178
  * A single child content element.
157
179
  */
158
180
  children: _elementAcceptingRef.default.isRequired,
181
+ /**
182
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
183
+ * @default false
184
+ */
185
+ disablePrefersReducedMotion: _propTypes.default.bool,
159
186
  /**
160
187
  * The transition timing function.
161
188
  * You may specify a single easing or a object containing enter and exit values.
package/Fade/Fade.mjs CHANGED
@@ -2,9 +2,10 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import { Transition } from 'react-transition-group';
6
5
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
6
  import getReactElementRef from '@mui/utils/getReactElementRef';
7
+ import Transition from "../internal/Transition.mjs";
8
+ import useReducedMotion from "../transitions/useReducedMotion.mjs";
8
9
  import { useTheme } from "../zero-styled/index.mjs";
9
10
  import { normalizedTransitionCallback, reflow, getTransitionProps, getTransitionChildStyle } from "../transitions/utils.mjs";
10
11
  import useForkRef from "../utils/useForkRef.mjs";
@@ -30,7 +31,6 @@ const hiddenStyles = {
30
31
 
31
32
  /**
32
33
  * The Fade transition is used by the [Modal](/material-ui/react-modal/) component.
33
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
34
34
  */
35
35
  const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
36
36
  const theme = useTheme();
@@ -42,6 +42,7 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
42
42
  addEndListener,
43
43
  appear = true,
44
44
  children,
45
+ disablePrefersReducedMotion = false,
45
46
  easing,
46
47
  in: inProp,
47
48
  onEnter,
@@ -54,12 +55,14 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
54
55
  timeout = defaultTimeout,
55
56
  ...other
56
57
  } = props;
58
+ const reducedMotion = useReducedMotion(theme.motion.reducedMotion, disablePrefersReducedMotion);
57
59
  const nodeRef = React.useRef(null);
58
60
  const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
59
61
  const handleEntering = normalizedTransitionCallback(nodeRef, onEntering);
60
62
  const handleEnter = normalizedTransitionCallback(nodeRef, (node, isAppearing) => {
61
- reflow(node); // So the animation always start from the start.
62
-
63
+ if (!reducedMotion.shouldReduceMotion) {
64
+ reflow(node); // Force layout so the animation starts from the initial styles.
65
+ }
63
66
  const transitionProps = getTransitionProps({
64
67
  style,
65
68
  timeout,
@@ -67,7 +70,15 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
67
70
  }, {
68
71
  mode: 'enter'
69
72
  });
70
- node.style.transition = theme.transitions.create('opacity', transitionProps);
73
+ const transitionTiming = reducedMotion.getTransitionTiming({
74
+ duration: transitionProps.duration,
75
+ delay: transitionProps.delay
76
+ });
77
+ node.style.transition = theme.transitions.create('opacity', {
78
+ duration: transitionTiming.duration,
79
+ easing: transitionProps.easing,
80
+ delay: transitionTiming.delay
81
+ });
71
82
  if (onEnter) {
72
83
  onEnter(node, isAppearing);
73
84
  }
@@ -82,26 +93,31 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
82
93
  }, {
83
94
  mode: 'exit'
84
95
  });
85
- node.style.transition = theme.transitions.create('opacity', transitionProps);
96
+ const transitionTiming = reducedMotion.getTransitionTiming({
97
+ duration: transitionProps.duration,
98
+ delay: transitionProps.delay
99
+ });
100
+ node.style.transition = theme.transitions.create('opacity', {
101
+ duration: transitionTiming.duration,
102
+ easing: transitionProps.easing,
103
+ delay: transitionTiming.delay
104
+ });
86
105
  if (onExit) {
87
106
  onExit(node);
88
107
  }
89
108
  });
90
109
  const handleExited = normalizedTransitionCallback(nodeRef, node => {
91
- // Clear the transition CSS to release the compositor layer when the
92
- // element is fully exited (prevents idle CPU usage on fixed elements
93
- // like Backdrop). handleEnter re-sets it on the next open.
110
+ // Clear transition CSS after exit so fixed elements like Backdrop do not
111
+ // keep a compositor layer alive and cause idle CPU usage. handleEnter sets
112
+ // it again on next open.
94
113
  node.style.transition = '';
95
114
  if (onExited) {
96
115
  onExited(node);
97
116
  }
98
117
  });
99
- const handleAddEndListener = next => {
100
- if (addEndListener) {
101
- // Old call signature before `react-transition-group` implemented `nodeRef`
102
- addEndListener(nodeRef.current, next);
103
- }
104
- };
118
+ const handleAddEndListener = addEndListener ? next => {
119
+ addEndListener(nodeRef.current, next);
120
+ } : undefined;
105
121
  return /*#__PURE__*/_jsx(Transition, {
106
122
  appear: appear,
107
123
  in: inProp,
@@ -113,12 +129,15 @@ const Fade = /*#__PURE__*/React.forwardRef(function Fade(props, ref) {
113
129
  onExited: handleExited,
114
130
  onExiting: handleExiting,
115
131
  addEndListener: handleAddEndListener,
132
+ reduceMotion: reducedMotion.shouldReduceMotion,
116
133
  timeout: timeout,
117
134
  ...other,
118
135
  children: (state, {
119
136
  ownerState,
120
137
  ...restChildProps
121
138
  }) => {
139
+ // Do not pass ownerState to a DOM child. ownerState is only for
140
+ // Material UI styling, and React would treat it as an invalid DOM attribute.
122
141
  const childStyle = getTransitionChildStyle(state, inProp, styles, hiddenStyles, style, children.props.style);
123
142
  return /*#__PURE__*/React.cloneElement(children, {
124
143
  style: childStyle,
@@ -134,9 +153,12 @@ process.env.NODE_ENV !== "production" ? Fade.propTypes /* remove-proptypes */ =
134
153
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
135
154
  // └─────────────────────────────────────────────────────────────────────┘
136
155
  /**
137
- * Add a custom transition end trigger. Called with the transitioning DOM
138
- * node and a done callback. Allows for more fine grained transition end
139
- * logic. Note: Timeouts are still used as a fallback if provided.
156
+ * Add a custom transition end trigger.
157
+ * Use it when you need custom logic to decide when the transition has ended.
158
+ * Note: Timeouts are still used as a fallback if provided.
159
+ *
160
+ * @param {HTMLElement} node The transitioning DOM node.
161
+ * @param {Function} done Call this when the transition has finished.
140
162
  */
141
163
  addEndListener: PropTypes.func,
142
164
  /**
@@ -149,6 +171,11 @@ process.env.NODE_ENV !== "production" ? Fade.propTypes /* remove-proptypes */ =
149
171
  * A single child content element.
150
172
  */
151
173
  children: elementAcceptingRef.isRequired,
174
+ /**
175
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
176
+ * @default false
177
+ */
178
+ disablePrefersReducedMotion: PropTypes.bool,
152
179
  /**
153
180
  * The transition timing function.
154
181
  * You may specify a single easing or a object containing enter and exit values.
@@ -21,6 +21,7 @@ var _DefaultPropsProvider = require("../DefaultPropsProvider");
21
21
  var _filledInputClasses = _interopRequireWildcard(require("./filledInputClasses"));
22
22
  var _InputBase2 = require("../InputBase/InputBase");
23
23
  var _utils = require("../utils");
24
+ var _utils2 = require("../transitions/utils");
24
25
  var _jsxRuntime = require("react/jsx-runtime");
25
26
  const useUtilityClasses = ownerState => {
26
27
  const {
@@ -66,7 +67,7 @@ const FilledInputRoot = (0, _zeroStyled.styled)(_InputBase2.InputBaseRoot, {
66
67
  backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor,
67
68
  borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
68
69
  borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
69
- transition: theme.transitions.create('background-color', {
70
+ ...(0, _utils2.getTransitionStyles)(theme, 'background-color', {
70
71
  duration: theme.transitions.duration.shorter,
71
72
  easing: theme.transitions.easing.easeOut
72
73
  }),
@@ -95,7 +96,7 @@ const FilledInputRoot = (0, _zeroStyled.styled)(_InputBase2.InputBaseRoot, {
95
96
  position: 'absolute',
96
97
  right: 0,
97
98
  transform: 'scaleX(0)',
98
- transition: theme.transitions.create('transform', {
99
+ ...(0, _utils2.getTransitionStyles)(theme, 'transform', {
99
100
  duration: theme.transitions.duration.shorter,
100
101
  easing: theme.transitions.easing.easeOut
101
102
  }),
@@ -118,7 +119,7 @@ const FilledInputRoot = (0, _zeroStyled.styled)(_InputBase2.InputBaseRoot, {
118
119
  content: '""',
119
120
  position: 'absolute',
120
121
  right: 0,
121
- transition: theme.transitions.create('border-bottom-color', {
122
+ ...(0, _utils2.getTransitionStyles)(theme, 'border-bottom-color', {
122
123
  duration: theme.transitions.duration.shorter
123
124
  }),
124
125
  pointerEvents: 'none' // Transparent to the hover style.
@@ -14,6 +14,7 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
14
14
  import filledInputClasses, { getFilledInputUtilityClass } from "./filledInputClasses.mjs";
15
15
  import { rootOverridesResolver as inputBaseRootOverridesResolver, inputOverridesResolver as inputBaseInputOverridesResolver, InputBaseRoot, InputBaseInput } from "../InputBase/InputBase.mjs";
16
16
  import { capitalize } from "../utils/index.mjs";
17
+ import { getTransitionStyles } from "../transitions/utils.mjs";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  const useUtilityClasses = ownerState => {
19
20
  const {
@@ -59,7 +60,7 @@ const FilledInputRoot = styled(InputBaseRoot, {
59
60
  backgroundColor: theme.vars ? theme.vars.palette.FilledInput.bg : backgroundColor,
60
61
  borderTopLeftRadius: (theme.vars || theme).shape.borderRadius,
61
62
  borderTopRightRadius: (theme.vars || theme).shape.borderRadius,
62
- transition: theme.transitions.create('background-color', {
63
+ ...getTransitionStyles(theme, 'background-color', {
63
64
  duration: theme.transitions.duration.shorter,
64
65
  easing: theme.transitions.easing.easeOut
65
66
  }),
@@ -88,7 +89,7 @@ const FilledInputRoot = styled(InputBaseRoot, {
88
89
  position: 'absolute',
89
90
  right: 0,
90
91
  transform: 'scaleX(0)',
91
- transition: theme.transitions.create('transform', {
92
+ ...getTransitionStyles(theme, 'transform', {
92
93
  duration: theme.transitions.duration.shorter,
93
94
  easing: theme.transitions.easing.easeOut
94
95
  }),
@@ -111,7 +112,7 @@ const FilledInputRoot = styled(InputBaseRoot, {
111
112
  content: '""',
112
113
  position: 'absolute',
113
114
  right: 0,
114
- transition: theme.transitions.create('border-bottom-color', {
115
+ ...getTransitionStyles(theme, 'border-bottom-color', {
115
116
  duration: theme.transitions.duration.shorter
116
117
  }),
117
118
  pointerEvents: 'none' // Transparent to the hover style.
package/Grow/Grow.d.mts CHANGED
@@ -1,6 +1,15 @@
1
1
  import * as React from 'react';
2
- import { TransitionProps } from "../transitions/transition.mjs";
2
+ import { TransitionProps } from "../transitions/types.mjs";
3
3
  export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
4
+ /**
5
+ * Add a custom transition end trigger.
6
+ * Use it when you need custom logic to decide when the transition has ended.
7
+ * Note: Timeouts are still used as a fallback if provided.
8
+ *
9
+ * @param {HTMLElement} node The transitioning DOM node.
10
+ * @param {Function} done Call this when the transition has finished.
11
+ */
12
+ addEndListener?: TransitionProps['addEndListener'] | undefined;
4
13
  /**
5
14
  * Perform the enter transition when it first mounts if `in` is also `true`.
6
15
  * Set this to `false` to disable this behavior.
@@ -11,6 +20,11 @@ export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
11
20
  * A single child content element.
12
21
  */
13
22
  children: React.ReactElement<unknown, any>;
23
+ /**
24
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
25
+ * @default false
26
+ */
27
+ disablePrefersReducedMotion?: boolean | undefined;
14
28
  /**
15
29
  * The transition timing function.
16
30
  * You may specify a single easing or a object containing enter and exit values.
@@ -34,7 +48,6 @@ export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
34
48
  /**
35
49
  * The Grow transition is used by the [Tooltip](https://mui.com/material-ui/react-tooltip/) and
36
50
  * [Popover](https://mui.com/material-ui/react-popover/) components.
37
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
38
51
  *
39
52
  * Demos:
40
53
  *
package/Grow/Grow.d.ts CHANGED
@@ -1,6 +1,15 @@
1
1
  import * as React from 'react';
2
- import { TransitionProps } from "../transitions/transition.js";
2
+ import { TransitionProps } from "../transitions/types.js";
3
3
  export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
4
+ /**
5
+ * Add a custom transition end trigger.
6
+ * Use it when you need custom logic to decide when the transition has ended.
7
+ * Note: Timeouts are still used as a fallback if provided.
8
+ *
9
+ * @param {HTMLElement} node The transitioning DOM node.
10
+ * @param {Function} done Call this when the transition has finished.
11
+ */
12
+ addEndListener?: TransitionProps['addEndListener'] | undefined;
4
13
  /**
5
14
  * Perform the enter transition when it first mounts if `in` is also `true`.
6
15
  * Set this to `false` to disable this behavior.
@@ -11,6 +20,11 @@ export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
11
20
  * A single child content element.
12
21
  */
13
22
  children: React.ReactElement<unknown, any>;
23
+ /**
24
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
25
+ * @default false
26
+ */
27
+ disablePrefersReducedMotion?: boolean | undefined;
14
28
  /**
15
29
  * The transition timing function.
16
30
  * You may specify a single easing or a object containing enter and exit values.
@@ -34,7 +48,6 @@ export interface GrowProps extends Omit<TransitionProps, 'timeout'> {
34
48
  /**
35
49
  * The Grow transition is used by the [Tooltip](https://mui.com/material-ui/react-tooltip/) and
36
50
  * [Popover](https://mui.com/material-ui/react-popover/) components.
37
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
38
51
  *
39
52
  * Demos:
40
53
  *
package/Grow/Grow.js CHANGED
@@ -9,10 +9,10 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
13
12
  var _elementAcceptingRef = _interopRequireDefault(require("@mui/utils/elementAcceptingRef"));
14
13
  var _getReactElementRef = _interopRequireDefault(require("@mui/utils/getReactElementRef"));
15
- var _reactTransitionGroup = require("react-transition-group");
14
+ var _Transition = _interopRequireDefault(require("../internal/Transition"));
15
+ var _useReducedMotion = _interopRequireDefault(require("../transitions/useReducedMotion"));
16
16
  var _zeroStyled = require("../zero-styled");
17
17
  var _utils = require("../transitions/utils");
18
18
  var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
@@ -47,13 +47,13 @@ const hiddenStyles = {
47
47
  /**
48
48
  * The Grow transition is used by the [Tooltip](/material-ui/react-tooltip/) and
49
49
  * [Popover](/material-ui/react-popover/) components.
50
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
51
50
  */
52
51
  const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
53
52
  const {
54
53
  addEndListener,
55
54
  appear = true,
56
55
  children,
56
+ disablePrefersReducedMotion = false,
57
57
  easing,
58
58
  in: inProp,
59
59
  onEnter,
@@ -66,15 +66,16 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
66
66
  timeout = 'auto',
67
67
  ...other
68
68
  } = props;
69
- const timer = (0, _useTimeout.default)();
70
- const autoTimeout = React.useRef();
69
+ const autoTimeout = React.useRef(null);
71
70
  const theme = (0, _zeroStyled.useTheme)();
71
+ const reducedMotion = (0, _useReducedMotion.default)(theme.motion.reducedMotion, disablePrefersReducedMotion);
72
72
  const nodeRef = React.useRef(null);
73
73
  const handleRef = (0, _useForkRef.default)(nodeRef, (0, _getReactElementRef.default)(children), ref);
74
74
  const handleEntering = (0, _utils.normalizedTransitionCallback)(nodeRef, onEntering);
75
75
  const handleEnter = (0, _utils.normalizedTransitionCallback)(nodeRef, (node, isAppearing) => {
76
- (0, _utils.reflow)(node); // So the animation always start from the start.
77
-
76
+ if (!reducedMotion.shouldReduceMotion) {
77
+ (0, _utils.reflow)(node); // Force layout so the animation starts from the initial styles.
78
+ }
78
79
  const {
79
80
  duration: transitionDuration,
80
81
  delay,
@@ -87,18 +88,23 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
87
88
  mode: 'enter'
88
89
  });
89
90
  let duration;
90
- if (timeout === 'auto') {
91
+ if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
91
92
  duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
92
93
  autoTimeout.current = duration;
93
94
  } else {
94
95
  duration = transitionDuration;
96
+ autoTimeout.current = null;
95
97
  }
96
- node.style.transition = [theme.transitions.create('opacity', {
98
+ const transitionTiming = reducedMotion.getTransitionTiming({
97
99
  duration,
98
100
  delay
101
+ });
102
+ node.style.transition = [theme.transitions.create('opacity', {
103
+ duration: transitionTiming.duration,
104
+ delay: transitionTiming.delay
99
105
  }), theme.transitions.create('transform', {
100
- duration: duration * 0.666,
101
- delay,
106
+ duration: typeof transitionTiming.duration === 'string' ? transitionTiming.duration : transitionTiming.duration * 0.666,
107
+ delay: transitionTiming.delay,
102
108
  easing: transitionTimingFunction
103
109
  })].join(',');
104
110
  if (onEnter) {
@@ -120,18 +126,23 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
120
126
  mode: 'exit'
121
127
  });
122
128
  let duration;
123
- if (timeout === 'auto') {
129
+ if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
124
130
  duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
125
131
  autoTimeout.current = duration;
126
132
  } else {
127
133
  duration = transitionDuration;
134
+ autoTimeout.current = null;
128
135
  }
129
- node.style.transition = [theme.transitions.create('opacity', {
136
+ const transitionTiming = reducedMotion.getTransitionTiming({
130
137
  duration,
131
138
  delay
139
+ });
140
+ node.style.transition = [theme.transitions.create('opacity', {
141
+ duration: transitionTiming.duration,
142
+ delay: transitionTiming.delay
132
143
  }), theme.transitions.create('transform', {
133
- duration: duration * 0.666,
134
- delay: delay || duration * 0.333,
144
+ duration: typeof transitionTiming.duration === 'string' ? transitionTiming.duration : transitionTiming.duration * 0.666,
145
+ delay: transitionTiming.delay || (typeof transitionTiming.duration === 'string' ? transitionTiming.duration : transitionTiming.duration * 0.333),
135
146
  easing: transitionTimingFunction
136
147
  })].join(',');
137
148
  node.style.opacity = 0;
@@ -146,16 +157,10 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
146
157
  onExited(node);
147
158
  }
148
159
  });
149
- const handleAddEndListener = next => {
150
- if (timeout === 'auto') {
151
- timer.start(autoTimeout.current || 0, next);
152
- }
153
- if (addEndListener) {
154
- // Old call signature before `react-transition-group` implemented `nodeRef`
155
- addEndListener(nodeRef.current, next);
156
- }
157
- };
158
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactTransitionGroup.Transition, {
160
+ const handleAddEndListener = addEndListener ? next => {
161
+ addEndListener(nodeRef.current, next);
162
+ } : undefined;
163
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Transition.default, {
159
164
  appear: appear,
160
165
  in: inProp,
161
166
  nodeRef: nodeRef,
@@ -166,12 +171,16 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
166
171
  onExited: handleExited,
167
172
  onExiting: handleExiting,
168
173
  addEndListener: handleAddEndListener,
174
+ getAutoTimeout: timeout === 'auto' ? () => autoTimeout.current : undefined,
175
+ reduceMotion: reducedMotion.shouldReduceMotion,
169
176
  timeout: timeout === 'auto' ? null : timeout,
170
177
  ...other,
171
178
  children: (state, {
172
179
  ownerState,
173
180
  ...restChildProps
174
181
  }) => {
182
+ // Do not pass ownerState to a DOM child. ownerState is only for
183
+ // Material UI styling, and React would treat it as an invalid DOM attribute.
175
184
  const childStyle = (0, _utils.getTransitionChildStyle)(state, inProp, styles, hiddenStyles, style, children.props.style);
176
185
  return /*#__PURE__*/React.cloneElement(children, {
177
186
  style: childStyle,
@@ -187,9 +196,12 @@ process.env.NODE_ENV !== "production" ? Grow.propTypes /* remove-proptypes */ =
187
196
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
188
197
  // └─────────────────────────────────────────────────────────────────────┘
189
198
  /**
190
- * Add a custom transition end trigger. Called with the transitioning DOM
191
- * node and a done callback. Allows for more fine grained transition end
192
- * logic. Note: Timeouts are still used as a fallback if provided.
199
+ * Add a custom transition end trigger.
200
+ * Use it when you need custom logic to decide when the transition has ended.
201
+ * Note: Timeouts are still used as a fallback if provided.
202
+ *
203
+ * @param {HTMLElement} node The transitioning DOM node.
204
+ * @param {Function} done Call this when the transition has finished.
193
205
  */
194
206
  addEndListener: _propTypes.default.func,
195
207
  /**
@@ -202,6 +214,11 @@ process.env.NODE_ENV !== "production" ? Grow.propTypes /* remove-proptypes */ =
202
214
  * A single child content element.
203
215
  */
204
216
  children: _elementAcceptingRef.default.isRequired,
217
+ /**
218
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
219
+ * @default false
220
+ */
221
+ disablePrefersReducedMotion: _propTypes.default.bool,
205
222
  /**
206
223
  * The transition timing function.
207
224
  * You may specify a single easing or a object containing enter and exit values.