@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.
Files changed (206) 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 +8 -6
  8. package/Autocomplete/Autocomplete.mjs +8 -6
  9. package/Backdrop/Backdrop.d.mts +2 -2
  10. package/Backdrop/Backdrop.d.ts +2 -2
  11. package/Badge/Badge.js +28 -24
  12. package/Badge/Badge.mjs +28 -24
  13. package/BottomNavigationAction/BottomNavigationAction.js +6 -2
  14. package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
  15. package/Button/Button.js +11 -15
  16. package/Button/Button.mjs +11 -15
  17. package/ButtonBase/Ripple.js +21 -11
  18. package/ButtonBase/Ripple.mjs +21 -11
  19. package/ButtonBase/TouchRipple.js +252 -116
  20. package/ButtonBase/TouchRipple.mjs +253 -117
  21. package/CHANGELOG.md +84 -0
  22. package/CardActionArea/CardActionArea.js +2 -1
  23. package/CardActionArea/CardActionArea.mjs +2 -1
  24. package/Chip/Chip.js +2 -1
  25. package/Chip/Chip.mjs +2 -1
  26. package/CircularProgress/CircularProgress.js +85 -55
  27. package/CircularProgress/CircularProgress.mjs +84 -55
  28. package/Collapse/Collapse.d.mts +15 -3
  29. package/Collapse/Collapse.d.ts +15 -3
  30. package/Collapse/Collapse.js +44 -31
  31. package/Collapse/Collapse.mjs +43 -30
  32. package/Dialog/Dialog.d.mts +2 -2
  33. package/Dialog/Dialog.d.ts +2 -2
  34. package/Dialog/Dialog.js +2 -0
  35. package/Dialog/Dialog.mjs +2 -0
  36. package/Drawer/Drawer.d.mts +2 -2
  37. package/Drawer/Drawer.d.ts +2 -2
  38. package/Fab/Fab.js +2 -1
  39. package/Fab/Fab.mjs +2 -1
  40. package/Fade/Fade.d.mts +15 -2
  41. package/Fade/Fade.d.ts +15 -2
  42. package/Fade/Fade.js +46 -19
  43. package/Fade/Fade.mjs +45 -18
  44. package/FilledInput/FilledInput.js +4 -3
  45. package/FilledInput/FilledInput.mjs +4 -3
  46. package/Grow/Grow.d.mts +15 -2
  47. package/Grow/Grow.d.ts +15 -2
  48. package/Grow/Grow.js +45 -28
  49. package/Grow/Grow.mjs +44 -27
  50. package/IconButton/IconButton.js +2 -1
  51. package/IconButton/IconButton.mjs +2 -1
  52. package/Input/Input.js +3 -2
  53. package/Input/Input.mjs +3 -2
  54. package/InputBase/InputBase.js +2 -1
  55. package/InputBase/InputBase.mjs +2 -1
  56. package/InputLabel/InputLabel.js +2 -1
  57. package/InputLabel/InputLabel.mjs +2 -1
  58. package/LICENSE +1 -1
  59. package/LinearProgress/LinearProgress.js +187 -120
  60. package/LinearProgress/LinearProgress.mjs +186 -120
  61. package/ListItem/ListItem.js +2 -1
  62. package/ListItem/ListItem.mjs +2 -1
  63. package/ListItemButton/ListItemButton.js +2 -1
  64. package/ListItemButton/ListItemButton.mjs +2 -1
  65. package/Menu/Menu.d.mts +1 -1
  66. package/Menu/Menu.d.ts +1 -1
  67. package/MobileStepper/MobileStepper.js +2 -1
  68. package/MobileStepper/MobileStepper.mjs +2 -1
  69. package/OutlinedInput/NotchedOutline.js +4 -3
  70. package/OutlinedInput/NotchedOutline.mjs +4 -3
  71. package/PaginationItem/PaginationItem.js +2 -1
  72. package/PaginationItem/PaginationItem.mjs +2 -1
  73. package/Paper/Paper.js +2 -1
  74. package/Paper/Paper.mjs +2 -1
  75. package/Popover/Popover.d.mts +1 -1
  76. package/Popover/Popover.d.ts +1 -1
  77. package/README.md +3 -2
  78. package/Radio/RadioButtonIcon.js +3 -2
  79. package/Radio/RadioButtonIcon.mjs +3 -2
  80. package/Rating/Rating.js +2 -1
  81. package/Rating/Rating.mjs +2 -1
  82. package/Select/SelectInput.js +115 -25
  83. package/Select/SelectInput.mjs +115 -25
  84. package/Select/utils/closedTypeahead.js +73 -0
  85. package/Select/utils/closedTypeahead.mjs +63 -0
  86. package/Skeleton/Skeleton.js +22 -2
  87. package/Skeleton/Skeleton.mjs +22 -2
  88. package/Slide/Slide.d.mts +15 -2
  89. package/Slide/Slide.d.ts +15 -2
  90. package/Slide/Slide.js +53 -25
  91. package/Slide/Slide.mjs +52 -24
  92. package/Slider/Slider.js +4 -3
  93. package/Slider/Slider.mjs +4 -3
  94. package/Slider/useSlider.js +1 -1
  95. package/Slider/useSlider.mjs +1 -1
  96. package/Snackbar/Snackbar.d.mts +2 -2
  97. package/Snackbar/Snackbar.d.ts +2 -2
  98. package/SpeedDial/SpeedDial.d.mts +1 -1
  99. package/SpeedDial/SpeedDial.d.ts +1 -1
  100. package/SpeedDial/SpeedDial.js +6 -2
  101. package/SpeedDial/SpeedDial.mjs +6 -2
  102. package/SpeedDialAction/SpeedDialAction.js +11 -2
  103. package/SpeedDialAction/SpeedDialAction.mjs +12 -3
  104. package/SpeedDialIcon/SpeedDialIcon.js +40 -37
  105. package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
  106. package/Step/Step.js +47 -15
  107. package/Step/Step.mjs +47 -15
  108. package/StepButton/StepButton.js +9 -3
  109. package/StepButton/StepButton.mjs +9 -3
  110. package/StepConnector/StepConnector.js +10 -0
  111. package/StepConnector/StepConnector.mjs +10 -0
  112. package/StepContent/StepContent.d.mts +2 -2
  113. package/StepContent/StepContent.d.ts +2 -2
  114. package/StepContent/StepContent.js +26 -2
  115. package/StepContent/StepContent.mjs +26 -2
  116. package/StepIcon/StepIcon.js +2 -1
  117. package/StepIcon/StepIcon.mjs +2 -1
  118. package/StepLabel/StepLabel.js +52 -7
  119. package/StepLabel/StepLabel.mjs +52 -7
  120. package/Stepper/Stepper.d.mts +2 -0
  121. package/Stepper/Stepper.d.ts +2 -0
  122. package/Stepper/Stepper.js +18 -0
  123. package/Stepper/Stepper.mjs +18 -0
  124. package/SvgIcon/SvgIcon.js +2 -1
  125. package/SvgIcon/SvgIcon.mjs +2 -1
  126. package/SwipeableDrawer/SwipeableDrawer.js +14 -3
  127. package/SwipeableDrawer/SwipeableDrawer.mjs +14 -3
  128. package/Switch/Switch.js +3 -2
  129. package/Switch/Switch.mjs +3 -2
  130. package/TableSortLabel/TableSortLabel.js +2 -1
  131. package/TableSortLabel/TableSortLabel.mjs +2 -1
  132. package/Tabs/Tabs.js +14 -3
  133. package/Tabs/Tabs.mjs +14 -3
  134. package/Tooltip/Tooltip.d.mts +2 -2
  135. package/Tooltip/Tooltip.d.ts +2 -2
  136. package/Tooltip/Tooltip.js +3 -0
  137. package/Tooltip/Tooltip.mjs +3 -0
  138. package/Unstable_TrapFocus/FocusTrap.js +42 -8
  139. package/Unstable_TrapFocus/FocusTrap.mjs +42 -8
  140. package/Zoom/Zoom.d.mts +15 -2
  141. package/Zoom/Zoom.d.ts +15 -2
  142. package/Zoom/Zoom.js +43 -16
  143. package/Zoom/Zoom.mjs +42 -15
  144. package/index.js +1 -1
  145. package/index.mjs +1 -1
  146. package/internal/Transition.d.mts +34 -0
  147. package/internal/Transition.d.ts +34 -0
  148. package/internal/Transition.js +444 -0
  149. package/internal/Transition.mjs +436 -0
  150. package/internal/react-transition-group.d.mts +8 -0
  151. package/internal/react-transition-group.d.ts +8 -0
  152. package/package.json +6 -6
  153. package/styles/createMotion.d.mts +8 -0
  154. package/styles/createMotion.d.ts +8 -0
  155. package/styles/createMotion.js +13 -0
  156. package/styles/createMotion.mjs +7 -0
  157. package/styles/createThemeFoundation.d.mts +2 -0
  158. package/styles/createThemeFoundation.d.ts +2 -0
  159. package/styles/createThemeNoVars.d.mts +3 -0
  160. package/styles/createThemeNoVars.d.ts +3 -0
  161. package/styles/createThemeNoVars.js +5 -0
  162. package/styles/createThemeNoVars.mjs +5 -0
  163. package/styles/createTransitions.d.mts +6 -2
  164. package/styles/createTransitions.d.ts +6 -2
  165. package/styles/createTransitions.js +12 -4
  166. package/styles/createTransitions.mjs +12 -4
  167. package/styles/enhanceHighContrast.d.mts +70 -0
  168. package/styles/enhanceHighContrast.d.ts +70 -0
  169. package/styles/enhanceHighContrast.js +502 -0
  170. package/styles/enhanceHighContrast.mjs +495 -0
  171. package/styles/index.d.mts +2 -0
  172. package/styles/index.d.ts +2 -0
  173. package/styles/index.js +8 -0
  174. package/styles/index.mjs +1 -0
  175. package/styles/reducedMotion.d.mts +7 -0
  176. package/styles/reducedMotion.d.ts +7 -0
  177. package/styles/reducedMotion.js +21 -0
  178. package/styles/reducedMotion.mjs +14 -0
  179. package/styles/shouldSkipGeneratingVar.js +1 -1
  180. package/styles/shouldSkipGeneratingVar.mjs +1 -1
  181. package/styles/stringifyTheme.js +1 -0
  182. package/styles/stringifyTheme.mjs +1 -0
  183. package/transitions/index.d.mts +1 -1
  184. package/transitions/index.d.ts +1 -1
  185. package/transitions/index.js +0 -11
  186. package/transitions/index.mjs +1 -1
  187. package/transitions/transition.d.mts +1 -12
  188. package/transitions/transition.d.ts +1 -12
  189. package/transitions/types.d.mts +73 -0
  190. package/transitions/types.d.ts +73 -0
  191. package/transitions/useReducedMotion.d.mts +14 -0
  192. package/transitions/useReducedMotion.d.ts +14 -0
  193. package/transitions/useReducedMotion.js +117 -0
  194. package/transitions/useReducedMotion.mjs +110 -0
  195. package/transitions/utils.d.mts +34 -2
  196. package/transitions/utils.d.ts +34 -2
  197. package/transitions/utils.js +33 -4
  198. package/transitions/utils.mjs +31 -4
  199. package/useAutocomplete/useAutocomplete.d.mts +8 -1
  200. package/useAutocomplete/useAutocomplete.d.ts +8 -1
  201. package/useAutocomplete/useAutocomplete.js +66 -4
  202. package/useAutocomplete/useAutocomplete.mjs +66 -4
  203. package/version/index.js +3 -3
  204. package/version/index.mjs +3 -3
  205. /package/transitions/{transition.js → types.js} +0 -0
  206. /package/transitions/{transition.mjs → types.mjs} +0 -0
@@ -3,10 +3,10 @@
3
3
  import * as React from 'react';
4
4
  import clsx from 'clsx';
5
5
  import PropTypes from 'prop-types';
6
- import { Transition } from 'react-transition-group';
7
- import useTimeout from '@mui/utils/useTimeout';
8
6
  import elementTypeAcceptingRef from '@mui/utils/elementTypeAcceptingRef';
9
7
  import composeClasses from '@mui/utils/composeClasses';
8
+ import Transition from "../internal/Transition.mjs";
9
+ import useReducedMotion from "../transitions/useReducedMotion.mjs";
10
10
  import { styled, useTheme } from "../zero-styled/index.mjs";
11
11
  import memoTheme from "../utils/memoTheme.mjs";
12
12
  import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
@@ -16,6 +16,7 @@ import { useForkRef } from "../utils/index.mjs";
16
16
  import useSlot from "../utils/useSlot.mjs";
17
17
  import { getCollapseUtilityClass } from "./collapseClasses.mjs";
18
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ const EMPTY_OBJECT = {};
19
20
  const useUtilityClasses = ownerState => {
20
21
  const {
21
22
  orientation,
@@ -83,7 +84,7 @@ const CollapseWrapper = styled('div', {
83
84
  name: 'MuiCollapse',
84
85
  slot: 'Wrapper'
85
86
  })({
86
- // Hack to get children with a negative margin to not falsify the height computation.
87
+ // Prevent children with negative margins from making the measured size too small.
87
88
  display: 'flex',
88
89
  width: '100%',
89
90
  variants: [{
@@ -115,7 +116,6 @@ const CollapseWrapperInner = styled('div', {
115
116
  /**
116
117
  * The Collapse transition is used by the
117
118
  * [Vertical Stepper](/material-ui/react-stepper/#vertical-stepper) StepContent component.
118
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
119
119
  */
120
120
  const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
121
121
  const props = useDefaultProps({
@@ -128,6 +128,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
128
128
  className,
129
129
  collapsedSize: collapsedSizeProp = '0px',
130
130
  component,
131
+ disablePrefersReducedMotion = false,
131
132
  easing,
132
133
  in: inProp,
133
134
  onEnter,
@@ -137,8 +138,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
137
138
  onExited,
138
139
  onExiting,
139
140
  orientation = 'vertical',
140
- slots = {},
141
- slotProps = {},
141
+ slots = EMPTY_OBJECT,
142
+ slotProps = EMPTY_OBJECT,
142
143
  style,
143
144
  timeout = duration.standard,
144
145
  // eslint-disable-next-line react/prop-types
@@ -152,18 +153,19 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
152
153
  };
153
154
  const classes = useUtilityClasses(ownerState);
154
155
  const theme = useTheme();
155
- const timer = useTimeout();
156
156
  const wrapperRef = React.useRef(null);
157
- const autoTransitionDuration = React.useRef();
157
+ const autoTransitionDuration = React.useRef(null);
158
158
  const collapsedSize = typeof collapsedSizeProp === 'number' ? `${collapsedSizeProp}px` : collapsedSizeProp;
159
159
  const isHorizontal = orientation === 'horizontal';
160
160
  const size = isHorizontal ? 'width' : 'height';
161
+ const reducedMotion = useReducedMotion(theme.motion.reducedMotion, disablePrefersReducedMotion);
161
162
  const nodeRef = React.useRef(null);
162
163
  const handleRef = useForkRef(ref, nodeRef);
163
164
  const getWrapperSize = () => wrapperRef.current ? wrapperRef.current[isHorizontal ? 'clientWidth' : 'clientHeight'] : 0;
164
165
  const handleEnter = normalizedTransitionCallback(nodeRef, (node, isAppearing) => {
165
166
  if (wrapperRef.current && isHorizontal) {
166
- // Set absolute position to get the size of collapsed content
167
+ // Temporarily remove horizontal content from normal layout so we can
168
+ // measure its natural width.
167
169
  wrapperRef.current.style.position = 'absolute';
168
170
  }
169
171
  node.style[size] = collapsedSize;
@@ -174,7 +176,7 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
174
176
  const handleEntering = normalizedTransitionCallback(nodeRef, (node, isAppearing) => {
175
177
  const wrapperSize = getWrapperSize();
176
178
  if (wrapperRef.current && isHorizontal) {
177
- // After the size is read reset the position back to default
179
+ // Restore normal layout after measuring the horizontal content.
178
180
  wrapperRef.current.style.position = '';
179
181
  }
180
182
  const {
@@ -187,13 +189,17 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
187
189
  }, {
188
190
  mode: 'enter'
189
191
  });
190
- if (timeout === 'auto') {
192
+ if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
191
193
  const duration2 = theme.transitions.getAutoHeightDuration(wrapperSize);
192
- node.style.transitionDuration = `${duration2}ms`;
193
194
  autoTransitionDuration.current = duration2;
194
195
  } else {
195
- node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : `${transitionDuration}ms`;
196
+ autoTransitionDuration.current = null;
196
197
  }
198
+ const transitionTiming = reducedMotion.getTransitionTiming({
199
+ duration: autoTransitionDuration.current ?? transitionDuration,
200
+ delay: undefined
201
+ });
202
+ node.style.transitionDuration = typeof transitionTiming.duration === 'string' ? transitionTiming.duration : `${transitionTiming.duration}ms`;
197
203
  node.style[size] = `${wrapperSize}px`;
198
204
  node.style.transitionTimingFunction = transitionTimingFunction;
199
205
  if (onEntering) {
@@ -225,30 +231,27 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
225
231
  }, {
226
232
  mode: 'exit'
227
233
  });
228
- if (timeout === 'auto') {
229
- // TODO: rename getAutoHeightDuration to something more generic (width support)
230
- // Actually it just calculates animation duration based on size
234
+ if (timeout === 'auto' && !reducedMotion.shouldReduceMotion) {
235
+ // getAutoHeightDuration also works for width; it calculates duration from size.
231
236
  const duration2 = theme.transitions.getAutoHeightDuration(wrapperSize);
232
- node.style.transitionDuration = `${duration2}ms`;
233
237
  autoTransitionDuration.current = duration2;
234
238
  } else {
235
- node.style.transitionDuration = typeof transitionDuration === 'string' ? transitionDuration : `${transitionDuration}ms`;
239
+ autoTransitionDuration.current = null;
236
240
  }
241
+ const transitionTiming = reducedMotion.getTransitionTiming({
242
+ duration: autoTransitionDuration.current ?? transitionDuration,
243
+ delay: undefined
244
+ });
245
+ node.style.transitionDuration = typeof transitionTiming.duration === 'string' ? transitionTiming.duration : `${transitionTiming.duration}ms`;
237
246
  node.style[size] = collapsedSize;
238
247
  node.style.transitionTimingFunction = transitionTimingFunction;
239
248
  if (onExiting) {
240
249
  onExiting(node);
241
250
  }
242
251
  });
243
- const handleAddEndListener = next => {
244
- if (timeout === 'auto') {
245
- timer.start(autoTransitionDuration.current || 0, next);
246
- }
247
- if (addEndListener) {
248
- // Old call signature before `react-transition-group` implemented `nodeRef`
249
- addEndListener(nodeRef.current, next);
250
- }
251
- };
252
+ const handleAddEndListener = addEndListener ? next => {
253
+ addEndListener(nodeRef.current, next);
254
+ } : undefined;
252
255
  const externalForwardedProps = {
253
256
  slots,
254
257
  slotProps,
@@ -289,6 +292,8 @@ const Collapse = /*#__PURE__*/React.forwardRef(function Collapse(inProps, ref) {
289
292
  onExited: handleExited,
290
293
  onExiting: handleExiting,
291
294
  addEndListener: handleAddEndListener,
295
+ getAutoTimeout: timeout === 'auto' ? () => autoTransitionDuration.current : undefined,
296
+ reduceMotion: reducedMotion.shouldReduceMotion,
292
297
  nodeRef: nodeRef,
293
298
  timeout: timeout === 'auto' ? null : timeout,
294
299
  ...other,
@@ -327,9 +332,12 @@ process.env.NODE_ENV !== "production" ? Collapse.propTypes /* remove-proptypes *
327
332
  // │ To update them, edit the d.ts file and run `pnpm proptypes`. │
328
333
  // └─────────────────────────────────────────────────────────────────────┘
329
334
  /**
330
- * Add a custom transition end trigger. Called with the transitioning DOM
331
- * node and a done callback. Allows for more fine grained transition end
332
- * logic. Note: Timeouts are still used as a fallback if provided.
335
+ * Add a custom transition end trigger.
336
+ * Use it when you need custom logic to decide when the transition has ended.
337
+ * Note: Timeouts are still used as a fallback if provided.
338
+ *
339
+ * @param {HTMLElement} node The transitioning DOM node.
340
+ * @param {Function} done Call this when the transition has finished.
333
341
  */
334
342
  addEndListener: PropTypes.func,
335
343
  /**
@@ -354,6 +362,11 @@ process.env.NODE_ENV !== "production" ? Collapse.propTypes /* remove-proptypes *
354
362
  * Either a string to use a HTML element or a component.
355
363
  */
356
364
  component: elementTypeAcceptingRef,
365
+ /**
366
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
367
+ * @default false
368
+ */
369
+ disablePrefersReducedMotion: PropTypes.bool,
357
370
  /**
358
371
  * The transition timing function.
359
372
  * You may specify a single easing or a object containing enter and exit values.
@@ -5,13 +5,13 @@ import { InternalStandardProps as StandardProps } from "../internal/index.mjs";
5
5
  import { BackdropProps } from "../Backdrop/index.mjs";
6
6
  import { PaperProps } from "../Paper/index.mjs";
7
7
  import { ModalProps } from "../Modal/index.mjs";
8
- import { TransitionProps } from "../transitions/transition.mjs";
8
+ import { TransitionProps } from "../transitions/types.mjs";
9
9
  import { DialogClasses } from "./dialogClasses.mjs";
10
10
  import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from "../utils/types.mjs";
11
11
  export interface DialogSlots {
12
12
  /**
13
13
  * The component that renders the transition.
14
- * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
14
+ * [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
15
15
  * @default Collapse
16
16
  */
17
17
  transition?: React.ElementType | undefined;
@@ -5,13 +5,13 @@ import { InternalStandardProps as StandardProps } from "../internal/index.js";
5
5
  import { BackdropProps } from "../Backdrop/index.js";
6
6
  import { PaperProps } from "../Paper/index.js";
7
7
  import { ModalProps } from "../Modal/index.js";
8
- import { TransitionProps } from "../transitions/transition.js";
8
+ import { TransitionProps } from "../transitions/types.js";
9
9
  import { DialogClasses } from "./dialogClasses.js";
10
10
  import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from "../utils/types.js";
11
11
  export interface DialogSlots {
12
12
  /**
13
13
  * The component that renders the transition.
14
- * [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
14
+ * [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
15
15
  * @default Collapse
16
16
  */
17
17
  transition?: React.ElementType | undefined;
package/Dialog/Dialog.js CHANGED
@@ -115,6 +115,8 @@ const DialogPaper = (0, _zeroStyled.styled)(_Paper.default, {
115
115
  margin: 32,
116
116
  position: 'relative',
117
117
  overflowY: 'auto',
118
+ // We disable the focus ring for mouse, touch and keyboard users.
119
+ outline: 0,
118
120
  '@media print': {
119
121
  overflowY: 'visible',
120
122
  boxShadow: 'none'
package/Dialog/Dialog.mjs CHANGED
@@ -108,6 +108,8 @@ const DialogPaper = styled(Paper, {
108
108
  margin: 32,
109
109
  position: 'relative',
110
110
  overflowY: 'auto',
111
+ // We disable the focus ring for mouse, touch and keyboard users.
112
+ outline: 0,
111
113
  '@media print': {
112
114
  overflowY: 'visible',
113
115
  boxShadow: 'none'
@@ -6,7 +6,7 @@ import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.mjs";
6
6
  import { ModalProps } from "../Modal/index.mjs";
7
7
  import { BackdropProps } from "../Backdrop/index.mjs";
8
8
  import { PaperProps } from "../Paper/index.mjs";
9
- import { TransitionProps } from "../transitions/transition.mjs";
9
+ import { TransitionProps } from "../transitions/types.mjs";
10
10
  import { DrawerClasses } from "./drawerClasses.mjs";
11
11
  export interface DrawerRootSlotPropsOverrides {}
12
12
  export interface DrawerDockedSlotPropsOverrides {}
@@ -36,7 +36,7 @@ export interface DrawerSlots {
36
36
  paper: React.ElementType;
37
37
  /**
38
38
  * The component used for the transition.
39
- * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
39
+ * [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
40
40
  * @default Slide
41
41
  */
42
42
  transition: React.ElementType;
@@ -6,7 +6,7 @@ import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
6
6
  import { ModalProps } from "../Modal/index.js";
7
7
  import { BackdropProps } from "../Backdrop/index.js";
8
8
  import { PaperProps } from "../Paper/index.js";
9
- import { TransitionProps } from "../transitions/transition.js";
9
+ import { TransitionProps } from "../transitions/types.js";
10
10
  import { DrawerClasses } from "./drawerClasses.js";
11
11
  export interface DrawerRootSlotPropsOverrides {}
12
12
  export interface DrawerDockedSlotPropsOverrides {}
@@ -36,7 +36,7 @@ export interface DrawerSlots {
36
36
  paper: React.ElementType;
37
37
  /**
38
38
  * The component used for the transition.
39
- * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
39
+ * [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
40
40
  * @default Slide
41
41
  */
42
42
  transition: React.ElementType;
package/Fab/Fab.js CHANGED
@@ -19,6 +19,7 @@ var _zeroStyled = require("../zero-styled");
19
19
  var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
20
20
  var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/createSimplePaletteValueFilter"));
21
21
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
22
+ var _utils = require("../transitions/utils");
22
23
  var _jsxRuntime = require("react/jsx-runtime");
23
24
  const useUtilityClasses = ownerState => {
24
25
  const {
@@ -52,7 +53,7 @@ const FabRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
52
53
  }) => ({
53
54
  ...theme.typography.button,
54
55
  minHeight: 36,
55
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
56
+ ...(0, _utils.getTransitionStyles)(theme, ['background-color', 'box-shadow', 'border-color'], {
56
57
  duration: theme.transitions.duration.short
57
58
  }),
58
59
  borderRadius: '50%',
package/Fab/Fab.mjs CHANGED
@@ -12,6 +12,7 @@ import { styled } from "../zero-styled/index.mjs";
12
12
  import memoTheme from "../utils/memoTheme.mjs";
13
13
  import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFilter.mjs";
14
14
  import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
15
+ import { getTransitionStyles } from "../transitions/utils.mjs";
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  const useUtilityClasses = ownerState => {
17
18
  const {
@@ -45,7 +46,7 @@ const FabRoot = styled(ButtonBase, {
45
46
  }) => ({
46
47
  ...theme.typography.button,
47
48
  minHeight: 36,
48
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
49
+ ...getTransitionStyles(theme, ['background-color', 'box-shadow', 'border-color'], {
49
50
  duration: theme.transitions.duration.short
50
51
  }),
51
52
  borderRadius: '50%',
package/Fade/Fade.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 FadeProps extends Omit<TransitionProps, 'children'> {
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 FadeProps extends Omit<TransitionProps, 'children'> {
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 FadeProps extends Omit<TransitionProps, 'children'> {
34
48
 
35
49
  /**
36
50
  * The Fade transition is used by the [Modal](https://mui.com/material-ui/react-modal/) component.
37
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
38
51
  *
39
52
  * Demos:
40
53
  *
package/Fade/Fade.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 FadeProps extends Omit<TransitionProps, 'children'> {
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 FadeProps extends Omit<TransitionProps, 'children'> {
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 FadeProps extends Omit<TransitionProps, 'children'> {
34
48
 
35
49
  /**
36
50
  * The Fade transition is used by the [Modal](https://mui.com/material-ui/react-modal/) component.
37
- * It uses [react-transition-group](https://github.com/reactjs/react-transition-group) internally.
38
51
  *
39
52
  * Demos:
40
53
  *
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.