@mui/material 9.0.0 → 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.
Files changed (278) 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.js +73 -17
  8. package/Autocomplete/Autocomplete.mjs +73 -17
  9. package/Avatar/Avatar.js +4 -0
  10. package/Avatar/Avatar.mjs +4 -0
  11. package/Backdrop/Backdrop.d.mts +2 -2
  12. package/Backdrop/Backdrop.d.ts +2 -2
  13. package/Badge/Badge.js +31 -24
  14. package/Badge/Badge.mjs +31 -24
  15. package/BottomNavigationAction/BottomNavigationAction.js +6 -2
  16. package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
  17. package/Button/Button.js +19 -6
  18. package/Button/Button.mjs +19 -6
  19. package/ButtonBase/ButtonBase.d.mts +7 -0
  20. package/ButtonBase/ButtonBase.d.ts +7 -0
  21. package/ButtonBase/ButtonBase.js +5 -2
  22. package/ButtonBase/ButtonBase.mjs +5 -2
  23. package/ButtonBase/Ripple.js +21 -11
  24. package/ButtonBase/Ripple.mjs +21 -11
  25. package/ButtonBase/TouchRipple.js +252 -116
  26. package/ButtonBase/TouchRipple.mjs +253 -117
  27. package/CHANGELOG.md +216 -1245
  28. package/CardActionArea/CardActionArea.js +2 -1
  29. package/CardActionArea/CardActionArea.mjs +2 -1
  30. package/Checkbox/Checkbox.js +2 -1
  31. package/Checkbox/Checkbox.mjs +2 -1
  32. package/Chip/Chip.js +2 -1
  33. package/Chip/Chip.mjs +2 -1
  34. package/CircularProgress/CircularProgress.d.mts +12 -2
  35. package/CircularProgress/CircularProgress.d.ts +12 -2
  36. package/CircularProgress/CircularProgress.js +115 -58
  37. package/CircularProgress/CircularProgress.mjs +114 -58
  38. package/ClickAwayListener/ClickAwayListener.js +3 -6
  39. package/ClickAwayListener/ClickAwayListener.mjs +3 -6
  40. package/Collapse/Collapse.d.mts +15 -3
  41. package/Collapse/Collapse.d.ts +15 -3
  42. package/Collapse/Collapse.js +44 -31
  43. package/Collapse/Collapse.mjs +43 -30
  44. package/Dialog/Dialog.d.mts +2 -2
  45. package/Dialog/Dialog.d.ts +2 -2
  46. package/Dialog/Dialog.js +13 -6
  47. package/Dialog/Dialog.mjs +13 -6
  48. package/Drawer/Drawer.d.mts +2 -2
  49. package/Drawer/Drawer.d.ts +2 -2
  50. package/Drawer/Drawer.js +18 -4
  51. package/Drawer/Drawer.mjs +18 -4
  52. package/Fab/Fab.js +9 -2
  53. package/Fab/Fab.mjs +9 -2
  54. package/Fade/Fade.d.mts +15 -2
  55. package/Fade/Fade.d.ts +15 -2
  56. package/Fade/Fade.js +46 -19
  57. package/Fade/Fade.mjs +45 -18
  58. package/FilledInput/FilledInput.d.mts +4 -0
  59. package/FilledInput/FilledInput.d.ts +4 -0
  60. package/FilledInput/FilledInput.js +22 -23
  61. package/FilledInput/FilledInput.mjs +22 -23
  62. package/FormControl/useFormControl.d.mts +12 -2
  63. package/FormControl/useFormControl.d.ts +12 -2
  64. package/FormControl/useFormControl.js +13 -0
  65. package/FormControl/useFormControl.mjs +12 -0
  66. package/FormControlLabel/FormControlLabel.js +5 -8
  67. package/FormControlLabel/FormControlLabel.mjs +5 -8
  68. package/FormGroup/FormGroup.js +2 -5
  69. package/FormGroup/FormGroup.mjs +2 -5
  70. package/FormHelperText/FormHelperText.js +2 -5
  71. package/FormHelperText/FormHelperText.mjs +2 -5
  72. package/FormLabel/FormLabel.js +2 -5
  73. package/FormLabel/FormLabel.mjs +2 -5
  74. package/Grow/Grow.d.mts +15 -2
  75. package/Grow/Grow.d.ts +15 -2
  76. package/Grow/Grow.js +45 -28
  77. package/Grow/Grow.mjs +44 -27
  78. package/IconButton/IconButton.js +3 -9
  79. package/IconButton/IconButton.mjs +3 -9
  80. package/Input/Input.d.mts +4 -0
  81. package/Input/Input.d.ts +4 -0
  82. package/Input/Input.js +9 -2
  83. package/Input/Input.mjs +9 -2
  84. package/InputBase/InputBase.d.mts +2 -1
  85. package/InputBase/InputBase.d.ts +2 -1
  86. package/InputBase/InputBase.js +52 -16
  87. package/InputBase/InputBase.mjs +52 -16
  88. package/InputLabel/InputLabel.js +7 -9
  89. package/InputLabel/InputLabel.mjs +7 -9
  90. package/LICENSE +1 -1
  91. package/LinearProgress/LinearProgress.d.mts +12 -2
  92. package/LinearProgress/LinearProgress.d.ts +12 -2
  93. package/LinearProgress/LinearProgress.js +225 -126
  94. package/LinearProgress/LinearProgress.mjs +224 -126
  95. package/List/List.js +2 -1
  96. package/List/List.mjs +2 -1
  97. package/ListItem/ListItem.js +2 -1
  98. package/ListItem/ListItem.mjs +2 -1
  99. package/ListItemButton/ListItemButton.js +9 -2
  100. package/ListItemButton/ListItemButton.mjs +9 -2
  101. package/Menu/Menu.d.mts +1 -1
  102. package/Menu/Menu.d.ts +1 -1
  103. package/MenuItem/MenuItem.js +7 -1
  104. package/MenuItem/MenuItem.mjs +7 -1
  105. package/MenuList/MenuList.js +2 -1
  106. package/MenuList/MenuList.mjs +2 -1
  107. package/MobileStepper/MobileStepper.js +2 -1
  108. package/MobileStepper/MobileStepper.mjs +2 -1
  109. package/NativeSelect/NativeSelect.js +2 -5
  110. package/NativeSelect/NativeSelect.mjs +2 -5
  111. package/OutlinedInput/NotchedOutline.js +4 -3
  112. package/OutlinedInput/NotchedOutline.mjs +4 -3
  113. package/OutlinedInput/OutlinedInput.js +13 -23
  114. package/OutlinedInput/OutlinedInput.mjs +13 -23
  115. package/PaginationItem/PaginationItem.js +2 -1
  116. package/PaginationItem/PaginationItem.mjs +2 -1
  117. package/Paper/Paper.js +2 -1
  118. package/Paper/Paper.mjs +2 -1
  119. package/PigmentContainer/PigmentContainer.js +0 -1
  120. package/PigmentContainer/PigmentContainer.mjs +0 -1
  121. package/Popover/Popover.d.mts +1 -1
  122. package/Popover/Popover.d.ts +1 -1
  123. package/Popper/BasePopper.js +23 -1
  124. package/Popper/BasePopper.mjs +23 -1
  125. package/README.md +3 -2
  126. package/Radio/RadioButtonIcon.js +3 -2
  127. package/Radio/RadioButtonIcon.mjs +3 -2
  128. package/Rating/Rating.js +2 -1
  129. package/Rating/Rating.mjs +2 -1
  130. package/Select/Select.js +2 -5
  131. package/Select/Select.mjs +2 -5
  132. package/Select/SelectInput.js +276 -24
  133. package/Select/SelectInput.mjs +276 -24
  134. package/Select/utils/closedTypeahead.js +73 -0
  135. package/Select/utils/closedTypeahead.mjs +63 -0
  136. package/Skeleton/Skeleton.js +22 -2
  137. package/Skeleton/Skeleton.mjs +22 -2
  138. package/Slide/Slide.d.mts +15 -2
  139. package/Slide/Slide.d.ts +15 -2
  140. package/Slide/Slide.js +97 -47
  141. package/Slide/Slide.mjs +97 -47
  142. package/Slider/Slider.js +14 -4
  143. package/Slider/Slider.mjs +14 -4
  144. package/Slider/useSlider.js +4 -3
  145. package/Slider/useSlider.mjs +4 -3
  146. package/Snackbar/Snackbar.d.mts +2 -2
  147. package/Snackbar/Snackbar.d.ts +2 -2
  148. package/SpeedDial/SpeedDial.d.mts +1 -1
  149. package/SpeedDial/SpeedDial.d.ts +1 -1
  150. package/SpeedDial/SpeedDial.js +6 -2
  151. package/SpeedDial/SpeedDial.mjs +6 -2
  152. package/SpeedDialAction/SpeedDialAction.js +11 -2
  153. package/SpeedDialAction/SpeedDialAction.mjs +12 -3
  154. package/SpeedDialIcon/SpeedDialIcon.js +40 -37
  155. package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
  156. package/Step/Step.js +47 -15
  157. package/Step/Step.mjs +47 -15
  158. package/StepButton/StepButton.js +9 -3
  159. package/StepButton/StepButton.mjs +9 -3
  160. package/StepConnector/StepConnector.js +10 -0
  161. package/StepConnector/StepConnector.mjs +10 -0
  162. package/StepContent/StepContent.d.mts +2 -2
  163. package/StepContent/StepContent.d.ts +2 -2
  164. package/StepContent/StepContent.js +26 -2
  165. package/StepContent/StepContent.mjs +26 -2
  166. package/StepIcon/StepIcon.js +2 -1
  167. package/StepIcon/StepIcon.mjs +2 -1
  168. package/StepLabel/StepLabel.js +52 -7
  169. package/StepLabel/StepLabel.mjs +52 -7
  170. package/Stepper/Stepper.d.mts +2 -0
  171. package/Stepper/Stepper.d.ts +2 -0
  172. package/Stepper/Stepper.js +18 -0
  173. package/Stepper/Stepper.mjs +18 -0
  174. package/SvgIcon/SvgIcon.js +2 -1
  175. package/SvgIcon/SvgIcon.mjs +2 -1
  176. package/SwipeableDrawer/SwipeableDrawer.js +21 -6
  177. package/SwipeableDrawer/SwipeableDrawer.mjs +21 -6
  178. package/Switch/Switch.js +10 -8
  179. package/Switch/Switch.mjs +10 -8
  180. package/TableSortLabel/TableSortLabel.js +2 -1
  181. package/TableSortLabel/TableSortLabel.mjs +2 -1
  182. package/Tabs/ScrollbarSize.js +2 -1
  183. package/Tabs/ScrollbarSize.mjs +2 -1
  184. package/Tabs/Tabs.js +16 -4
  185. package/Tabs/Tabs.mjs +16 -4
  186. package/Tooltip/Tooltip.d.mts +2 -2
  187. package/Tooltip/Tooltip.d.ts +2 -2
  188. package/Tooltip/Tooltip.js +29 -108
  189. package/Tooltip/Tooltip.mjs +29 -108
  190. package/Unstable_TrapFocus/FocusTrap.js +60 -22
  191. package/Unstable_TrapFocus/FocusTrap.mjs +60 -22
  192. package/Zoom/Zoom.d.mts +15 -2
  193. package/Zoom/Zoom.d.ts +15 -2
  194. package/Zoom/Zoom.js +43 -16
  195. package/Zoom/Zoom.mjs +42 -15
  196. package/index.js +1 -1
  197. package/index.mjs +1 -1
  198. package/internal/Transition.d.mts +34 -0
  199. package/internal/Transition.d.ts +34 -0
  200. package/internal/Transition.js +444 -0
  201. package/internal/Transition.mjs +436 -0
  202. package/internal/react-transition-group.d.mts +8 -0
  203. package/internal/react-transition-group.d.ts +8 -0
  204. package/package.json +50 -50
  205. package/styles/createMotion.d.mts +8 -0
  206. package/styles/createMotion.d.ts +8 -0
  207. package/styles/createMotion.js +13 -0
  208. package/styles/createMotion.mjs +7 -0
  209. package/styles/createThemeFoundation.d.mts +2 -0
  210. package/styles/createThemeFoundation.d.ts +2 -0
  211. package/styles/createThemeNoVars.d.mts +3 -0
  212. package/styles/createThemeNoVars.d.ts +3 -0
  213. package/styles/createThemeNoVars.js +5 -0
  214. package/styles/createThemeNoVars.mjs +5 -0
  215. package/styles/createTransitions.d.mts +6 -2
  216. package/styles/createTransitions.d.ts +6 -2
  217. package/styles/createTransitions.js +12 -4
  218. package/styles/createTransitions.mjs +12 -4
  219. package/styles/enhanceHighContrast.d.mts +70 -0
  220. package/styles/enhanceHighContrast.d.ts +70 -0
  221. package/styles/enhanceHighContrast.js +502 -0
  222. package/styles/enhanceHighContrast.mjs +495 -0
  223. package/styles/index.d.mts +2 -0
  224. package/styles/index.d.ts +2 -0
  225. package/styles/index.js +8 -0
  226. package/styles/index.mjs +1 -0
  227. package/styles/reducedMotion.d.mts +7 -0
  228. package/styles/reducedMotion.d.ts +7 -0
  229. package/styles/reducedMotion.js +21 -0
  230. package/styles/reducedMotion.mjs +14 -0
  231. package/styles/responsiveFontSizes.js +19 -8
  232. package/styles/responsiveFontSizes.mjs +19 -8
  233. package/styles/shouldSkipGeneratingVar.js +1 -1
  234. package/styles/shouldSkipGeneratingVar.mjs +1 -1
  235. package/styles/stringifyTheme.js +1 -0
  236. package/styles/stringifyTheme.mjs +1 -0
  237. package/styles/useThemeProps.d.mts +3 -3
  238. package/styles/useThemeProps.d.ts +3 -3
  239. package/transitions/index.d.mts +1 -1
  240. package/transitions/index.d.ts +1 -1
  241. package/transitions/index.js +0 -11
  242. package/transitions/index.mjs +1 -1
  243. package/transitions/transition.d.mts +1 -12
  244. package/transitions/transition.d.ts +1 -12
  245. package/transitions/types.d.mts +73 -0
  246. package/transitions/types.d.ts +73 -0
  247. package/transitions/useReducedMotion.d.mts +14 -0
  248. package/transitions/useReducedMotion.d.ts +14 -0
  249. package/transitions/useReducedMotion.js +117 -0
  250. package/transitions/useReducedMotion.mjs +110 -0
  251. package/transitions/utils.d.mts +51 -2
  252. package/transitions/utils.d.ts +51 -2
  253. package/transitions/utils.js +97 -4
  254. package/transitions/utils.mjs +94 -4
  255. package/useAutocomplete/useAutocomplete.d.mts +12 -6
  256. package/useAutocomplete/useAutocomplete.d.ts +12 -6
  257. package/useAutocomplete/useAutocomplete.js +230 -55
  258. package/useAutocomplete/useAutocomplete.mjs +230 -55
  259. package/utils/contains.d.mts +2 -0
  260. package/utils/contains.d.ts +2 -0
  261. package/utils/contains.js +9 -0
  262. package/utils/contains.mjs +2 -0
  263. package/utils/focusable.d.mts +7 -0
  264. package/utils/focusable.d.ts +7 -0
  265. package/utils/focusable.js +20 -0
  266. package/utils/focusable.mjs +13 -0
  267. package/utils/getEventTarget.d.mts +2 -0
  268. package/utils/getEventTarget.d.ts +2 -0
  269. package/utils/getEventTarget.js +9 -0
  270. package/utils/getEventTarget.mjs +2 -0
  271. package/utils/mergeSlotProps.js +2 -8
  272. package/utils/mergeSlotProps.mjs +1 -8
  273. package/version/index.js +2 -2
  274. package/version/index.mjs +2 -2
  275. package/FormControl/formControlState.js +0 -21
  276. package/FormControl/formControlState.mjs +0 -15
  277. /package/transitions/{transition.js → types.js} +0 -0
  278. /package/transitions/{transition.mjs → types.mjs} +0 -0
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.
package/Grow/Grow.mjs CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
- import useTimeout from '@mui/utils/useTimeout';
6
5
  import elementAcceptingRef from '@mui/utils/elementAcceptingRef';
7
6
  import getReactElementRef from '@mui/utils/getReactElementRef';
8
- import { Transition } from 'react-transition-group';
7
+ import Transition from "../internal/Transition.mjs";
8
+ import useReducedMotion from "../transitions/useReducedMotion.mjs";
9
9
  import { useTheme } from "../zero-styled/index.mjs";
10
10
  import { normalizedTransitionCallback, getTransitionProps, getTransitionChildStyle, reflow } from "../transitions/utils.mjs";
11
11
  import useForkRef from "../utils/useForkRef.mjs";
@@ -40,13 +40,13 @@ const hiddenStyles = {
40
40
  /**
41
41
  * The Grow transition is used by the [Tooltip](/material-ui/react-tooltip/) and
42
42
  * [Popover](/material-ui/react-popover/) components.
43
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
44
43
  */
45
44
  const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
46
45
  const {
47
46
  addEndListener,
48
47
  appear = true,
49
48
  children,
49
+ disablePrefersReducedMotion = false,
50
50
  easing,
51
51
  in: inProp,
52
52
  onEnter,
@@ -59,15 +59,16 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
59
59
  timeout = 'auto',
60
60
  ...other
61
61
  } = props;
62
- const timer = useTimeout();
63
- const autoTimeout = React.useRef();
62
+ const autoTimeout = React.useRef(null);
64
63
  const theme = useTheme();
64
+ const reducedMotion = useReducedMotion(theme.motion.reducedMotion, disablePrefersReducedMotion);
65
65
  const nodeRef = React.useRef(null);
66
66
  const handleRef = useForkRef(nodeRef, getReactElementRef(children), ref);
67
67
  const handleEntering = normalizedTransitionCallback(nodeRef, onEntering);
68
68
  const handleEnter = normalizedTransitionCallback(nodeRef, (node, isAppearing) => {
69
- reflow(node); // So the animation always start from the start.
70
-
69
+ if (!reducedMotion.shouldReduceMotion) {
70
+ reflow(node); // Force layout so the animation starts from the initial styles.
71
+ }
71
72
  const {
72
73
  duration: transitionDuration,
73
74
  delay,
@@ -80,18 +81,23 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
80
81
  mode: 'enter'
81
82
  });
82
83
  let duration;
83
- if (timeout === 'auto') {
84
+ if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
84
85
  duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
85
86
  autoTimeout.current = duration;
86
87
  } else {
87
88
  duration = transitionDuration;
89
+ autoTimeout.current = null;
88
90
  }
89
- node.style.transition = [theme.transitions.create('opacity', {
91
+ const transitionTiming = reducedMotion.getTransitionTiming({
90
92
  duration,
91
93
  delay
94
+ });
95
+ node.style.transition = [theme.transitions.create('opacity', {
96
+ duration: transitionTiming.duration,
97
+ delay: transitionTiming.delay
92
98
  }), theme.transitions.create('transform', {
93
- duration: duration * 0.666,
94
- delay,
99
+ duration: typeof transitionTiming.duration === 'string' ? transitionTiming.duration : transitionTiming.duration * 0.666,
100
+ delay: transitionTiming.delay,
95
101
  easing: transitionTimingFunction
96
102
  })].join(',');
97
103
  if (onEnter) {
@@ -113,18 +119,23 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
113
119
  mode: 'exit'
114
120
  });
115
121
  let duration;
116
- if (timeout === 'auto') {
122
+ if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
117
123
  duration = theme.transitions.getAutoHeightDuration(node.clientHeight);
118
124
  autoTimeout.current = duration;
119
125
  } else {
120
126
  duration = transitionDuration;
127
+ autoTimeout.current = null;
121
128
  }
122
- node.style.transition = [theme.transitions.create('opacity', {
129
+ const transitionTiming = reducedMotion.getTransitionTiming({
123
130
  duration,
124
131
  delay
132
+ });
133
+ node.style.transition = [theme.transitions.create('opacity', {
134
+ duration: transitionTiming.duration,
135
+ delay: transitionTiming.delay
125
136
  }), theme.transitions.create('transform', {
126
- duration: duration * 0.666,
127
- delay: delay || duration * 0.333,
137
+ duration: typeof transitionTiming.duration === 'string' ? transitionTiming.duration : transitionTiming.duration * 0.666,
138
+ delay: transitionTiming.delay || (typeof transitionTiming.duration === 'string' ? transitionTiming.duration : transitionTiming.duration * 0.333),
128
139
  easing: transitionTimingFunction
129
140
  })].join(',');
130
141
  node.style.opacity = 0;
@@ -139,15 +150,9 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
139
150
  onExited(node);
140
151
  }
141
152
  });
142
- const handleAddEndListener = next => {
143
- if (timeout === 'auto') {
144
- timer.start(autoTimeout.current || 0, next);
145
- }
146
- if (addEndListener) {
147
- // Old call signature before `react-transition-group` implemented `nodeRef`
148
- addEndListener(nodeRef.current, next);
149
- }
150
- };
153
+ const handleAddEndListener = addEndListener ? next => {
154
+ addEndListener(nodeRef.current, next);
155
+ } : undefined;
151
156
  return /*#__PURE__*/_jsx(Transition, {
152
157
  appear: appear,
153
158
  in: inProp,
@@ -159,12 +164,16 @@ const Grow = /*#__PURE__*/React.forwardRef(function Grow(props, ref) {
159
164
  onExited: handleExited,
160
165
  onExiting: handleExiting,
161
166
  addEndListener: handleAddEndListener,
167
+ getAutoTimeout: timeout === 'auto' ? () => autoTimeout.current : undefined,
168
+ reduceMotion: reducedMotion.shouldReduceMotion,
162
169
  timeout: timeout === 'auto' ? null : timeout,
163
170
  ...other,
164
171
  children: (state, {
165
172
  ownerState,
166
173
  ...restChildProps
167
174
  }) => {
175
+ // Do not pass ownerState to a DOM child. ownerState is only for
176
+ // Material UI styling, and React would treat it as an invalid DOM attribute.
168
177
  const childStyle = getTransitionChildStyle(state, inProp, styles, hiddenStyles, style, children.props.style);
169
178
  return /*#__PURE__*/React.cloneElement(children, {
170
179
  style: childStyle,
@@ -180,9 +189,12 @@ process.env.NODE_ENV !== "production" ? Grow.propTypes /* remove-proptypes */ =
180
189
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
181
190
  // └─────────────────────────────────────────────────────────────────────┘
182
191
  /**
183
- * Add a custom transition end trigger. Called with the transitioning DOM
184
- * node and a done callback. Allows for more fine grained transition end
185
- * logic. Note: Timeouts are still used as a fallback if provided.
192
+ * Add a custom transition end trigger.
193
+ * Use it when you need custom logic to decide when the transition has ended.
194
+ * Note: Timeouts are still used as a fallback if provided.
195
+ *
196
+ * @param {HTMLElement} node The transitioning DOM node.
197
+ * @param {Function} done Call this when the transition has finished.
186
198
  */
187
199
  addEndListener: PropTypes.func,
188
200
  /**
@@ -195,6 +207,11 @@ process.env.NODE_ENV !== "production" ? Grow.propTypes /* remove-proptypes */ =
195
207
  * A single child content element.
196
208
  */
197
209
  children: elementAcceptingRef.isRequired,
210
+ /**
211
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
212
+ * @default false
213
+ */
214
+ disablePrefersReducedMotion: PropTypes.bool,
198
215
  /**
199
216
  * The transition timing function.
200
217
  * You may specify a single easing or a object containing enter and exit values.
@@ -21,6 +21,7 @@ var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
21
21
  var _CircularProgress = _interopRequireDefault(require("../CircularProgress"));
22
22
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
23
23
  var _iconButtonClasses = _interopRequireWildcard(require("./iconButtonClasses"));
24
+ var _utils2 = require("../transitions/utils");
24
25
  var _jsxRuntime = require("react/jsx-runtime");
25
26
  const useUtilityClasses = ownerState => {
26
27
  const {
@@ -56,7 +57,7 @@ const IconButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
56
57
  padding: 8,
57
58
  borderRadius: '50%',
58
59
  color: (theme.vars || theme).palette.action.active,
59
- transition: theme.transitions.create('background-color', {
60
+ ...(0, _utils2.getTransitionStyles)(theme, 'background-color', {
60
61
  duration: theme.transitions.duration.shortest
61
62
  }),
62
63
  variants: [{
@@ -118,14 +119,7 @@ const IconButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
118
119
  color
119
120
  },
120
121
  style: {
121
- color: (theme.vars || theme).palette[color].main
122
- }
123
- })), ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)()) // check all the used fields in the style below
124
- .map(([color]) => ({
125
- props: {
126
- color
127
- },
128
- style: {
122
+ color: (theme.vars || theme).palette[color].main,
129
123
  '--IconButton-hoverBg': theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.hoverOpacity)
130
124
  }
131
125
  })), {
@@ -14,6 +14,7 @@ import ButtonBase from "../ButtonBase/index.mjs";
14
14
  import CircularProgress from "../CircularProgress/index.mjs";
15
15
  import capitalize from "../utils/capitalize.mjs";
16
16
  import iconButtonClasses, { getIconButtonUtilityClass } from "./iconButtonClasses.mjs";
17
+ import { getTransitionStyles } from "../transitions/utils.mjs";
17
18
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
18
19
  const useUtilityClasses = ownerState => {
19
20
  const {
@@ -49,7 +50,7 @@ const IconButtonRoot = styled(ButtonBase, {
49
50
  padding: 8,
50
51
  borderRadius: '50%',
51
52
  color: (theme.vars || theme).palette.action.active,
52
- transition: theme.transitions.create('background-color', {
53
+ ...getTransitionStyles(theme, 'background-color', {
53
54
  duration: theme.transitions.duration.shortest
54
55
  }),
55
56
  variants: [{
@@ -111,14 +112,7 @@ const IconButtonRoot = styled(ButtonBase, {
111
112
  color
112
113
  },
113
114
  style: {
114
- color: (theme.vars || theme).palette[color].main
115
- }
116
- })), ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()) // check all the used fields in the style below
117
- .map(([color]) => ({
118
- props: {
119
- color
120
- },
121
- style: {
115
+ color: (theme.vars || theme).palette[color].main,
122
116
  '--IconButton-hoverBg': theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.hoverOpacity)
123
117
  }
124
118
  })), {
package/Input/Input.d.mts CHANGED
@@ -13,6 +13,10 @@ export interface InputProps extends StandardProps<InputBaseProps> {
13
13
  * @default false
14
14
  */
15
15
  disableUnderline?: boolean | undefined;
16
+ /**
17
+ * @internal
18
+ */
19
+ notched?: boolean | undefined;
16
20
  /**
17
21
  * The system prop that allows defining system overrides as well as additional CSS styles.
18
22
  */
package/Input/Input.d.ts CHANGED
@@ -13,6 +13,10 @@ export interface InputProps extends StandardProps<InputBaseProps> {
13
13
  * @default false
14
14
  */
15
15
  disableUnderline?: boolean | undefined;
16
+ /**
17
+ * @internal
18
+ */
19
+ notched?: boolean | undefined;
16
20
  /**
17
21
  * The system prop that allows defining system overrides as well as additional CSS styles.
18
22
  */
package/Input/Input.js CHANGED
@@ -20,6 +20,7 @@ var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/c
20
20
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
21
21
  var _inputLabelClasses = _interopRequireDefault(require("../InputLabel/inputLabelClasses"));
22
22
  var _inputClasses = _interopRequireWildcard(require("./inputClasses"));
23
+ var _utils = require("../transitions/utils");
23
24
  var _InputBase2 = require("../InputBase/InputBase");
24
25
  var _jsxRuntime = require("react/jsx-runtime");
25
26
  const useUtilityClasses = ownerState => {
@@ -79,7 +80,7 @@ const InputRoot = (0, _zeroStyled.styled)(_InputBase2.InputBaseRoot, {
79
80
  position: 'absolute',
80
81
  right: 0,
81
82
  transform: 'scaleX(0)',
82
- transition: theme.transitions.create('transform', {
83
+ ...(0, _utils.getTransitionStyles)(theme, 'transform', {
83
84
  duration: theme.transitions.duration.shorter,
84
85
  easing: theme.transitions.easing.easeOut
85
86
  }),
@@ -102,7 +103,7 @@ const InputRoot = (0, _zeroStyled.styled)(_InputBase2.InputBaseRoot, {
102
103
  content: '""',
103
104
  position: 'absolute',
104
105
  right: 0,
105
- transition: theme.transitions.create('border-bottom-color', {
106
+ ...(0, _utils.getTransitionStyles)(theme, 'border-bottom-color', {
106
107
  duration: theme.transitions.duration.shorter
107
108
  }),
108
109
  pointerEvents: 'none' // Transparent to the hover style.
@@ -146,6 +147,8 @@ const Input = /*#__PURE__*/React.forwardRef(function Input(inProps, ref) {
146
147
  fullWidth = false,
147
148
  inputComponent = 'input',
148
149
  multiline = false,
150
+ notched,
151
+ // declare here to prevent spreading to DOM
149
152
  slotProps,
150
153
  slots = {},
151
154
  type = 'text',
@@ -274,6 +277,10 @@ process.env.NODE_ENV !== "production" ? Input.propTypes /* remove-proptypes */ =
274
277
  * Name attribute of the `input` element.
275
278
  */
276
279
  name: _propTypes.default.string,
280
+ /**
281
+ * @internal
282
+ */
283
+ notched: _propTypes.default.bool,
277
284
  /**
278
285
  * Callback fired when the value is changed.
279
286
  *
package/Input/Input.mjs CHANGED
@@ -13,6 +13,7 @@ import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFil
13
13
  import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
14
14
  import inputLabelClasses from "../InputLabel/inputLabelClasses.mjs";
15
15
  import inputClasses, { getInputUtilityClass } from "./inputClasses.mjs";
16
+ import { getTransitionStyles } from "../transitions/utils.mjs";
16
17
  import { rootOverridesResolver as inputBaseRootOverridesResolver, inputOverridesResolver as inputBaseInputOverridesResolver, InputBaseRoot, InputBaseInput } from "../InputBase/InputBase.mjs";
17
18
  import { jsx as _jsx } from "react/jsx-runtime";
18
19
  const useUtilityClasses = ownerState => {
@@ -72,7 +73,7 @@ const InputRoot = styled(InputBaseRoot, {
72
73
  position: 'absolute',
73
74
  right: 0,
74
75
  transform: 'scaleX(0)',
75
- transition: theme.transitions.create('transform', {
76
+ ...getTransitionStyles(theme, 'transform', {
76
77
  duration: theme.transitions.duration.shorter,
77
78
  easing: theme.transitions.easing.easeOut
78
79
  }),
@@ -95,7 +96,7 @@ const InputRoot = styled(InputBaseRoot, {
95
96
  content: '""',
96
97
  position: 'absolute',
97
98
  right: 0,
98
- transition: theme.transitions.create('border-bottom-color', {
99
+ ...getTransitionStyles(theme, 'border-bottom-color', {
99
100
  duration: theme.transitions.duration.shorter
100
101
  }),
101
102
  pointerEvents: 'none' // Transparent to the hover style.
@@ -139,6 +140,8 @@ const Input = /*#__PURE__*/React.forwardRef(function Input(inProps, ref) {
139
140
  fullWidth = false,
140
141
  inputComponent = 'input',
141
142
  multiline = false,
143
+ notched,
144
+ // declare here to prevent spreading to DOM
142
145
  slotProps,
143
146
  slots = {},
144
147
  type = 'text',
@@ -267,6 +270,10 @@ process.env.NODE_ENV !== "production" ? Input.propTypes /* remove-proptypes */ =
267
270
  * Name attribute of the `input` element.
268
271
  */
269
272
  name: PropTypes.string,
273
+ /**
274
+ * @internal
275
+ */
276
+ notched: PropTypes.bool,
270
277
  /**
271
278
  * Callback fired when the value is changed.
272
279
  *
@@ -13,8 +13,9 @@ export interface InputBaseProps extends StandardProps<React.HTMLAttributes<HTMLD
13
13
  * which by default is an input or textarea. Since these handlers differ from the
14
14
  * ones inherited by `React.HTMLAttributes<HTMLDivElement>` we need to omit them.
15
15
  */
16
- 'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp'> {
16
+ 'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp' | 'aria-label'> {
17
17
  'aria-describedby'?: string | undefined;
18
+ 'aria-label'?: string | undefined;
18
19
  /**
19
20
  * This prop helps users to fill forms faster, especially on mobile devices.
20
21
  * The name can be confusing, as it's more like an autofill.
@@ -13,8 +13,9 @@ export interface InputBaseProps extends StandardProps<React.HTMLAttributes<HTMLD
13
13
  * which by default is an input or textarea. Since these handlers differ from the
14
14
  * ones inherited by `React.HTMLAttributes<HTMLDivElement>` we need to omit them.
15
15
  */
16
- 'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp'> {
16
+ 'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp' | 'aria-label'> {
17
17
  'aria-describedby'?: string | undefined;
18
+ 'aria-label'?: string | undefined;
18
19
  /**
19
20
  * This prop helps users to fill forms faster, especially on mobile devices.
20
21
  * The name can be confusing, as it's more like an autofill.