@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
@@ -0,0 +1,436 @@
1
+ /// <reference path="./react-transition-group.d.ts" />
2
+ 'use client';
3
+
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
7
+ import useValueAsRef from '@mui/utils/useValueAsRef';
8
+ // Material UI transitions must still work inside react-transition-group's TransitionGroup.
9
+ // Import only its context module; do not import its Transition or TransitionGroup components.
10
+ import TransitionGroupContext from 'react-transition-group/TransitionGroupContext';
11
+ import { reflow } from "../transitions/utils.mjs";
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ function resolveTimeouts(timeout) {
14
+ if (timeout == null) {
15
+ return {
16
+ appear: undefined,
17
+ enter: undefined,
18
+ exit: undefined
19
+ };
20
+ }
21
+ if (typeof timeout === 'number') {
22
+ return {
23
+ appear: timeout,
24
+ enter: timeout,
25
+ exit: timeout
26
+ };
27
+ }
28
+ const enter = timeout.enter;
29
+ const exit = timeout.exit;
30
+ const appear = timeout.appear !== undefined ? timeout.appear : enter;
31
+ return {
32
+ appear,
33
+ enter,
34
+ exit
35
+ };
36
+ }
37
+
38
+ /**
39
+ * Resolves the authored completion timeout for the current transition phase.
40
+ * Auto durations are read by the caller at scheduling time so Grow/Collapse
41
+ * can pass the latest measured value without storing it in React state.
42
+ */
43
+ function getCompletionTimeout(params) {
44
+ if (params.autoTimeout != null) {
45
+ return params.autoTimeout;
46
+ }
47
+ const resolved = resolveTimeouts(params.timeout);
48
+ if (params.currentStatus === 'entering') {
49
+ return params.isAppearing ? resolved.appear ?? resolved.enter ?? null : resolved.enter ?? null;
50
+ }
51
+ return resolved.exit ?? null;
52
+ }
53
+ function Transition(props) {
54
+ const {
55
+ in: inProp = false,
56
+ appear = false,
57
+ enter = true,
58
+ exit = true,
59
+ mountOnEnter = false,
60
+ unmountOnExit = false,
61
+ timeout,
62
+ addEndListener,
63
+ reduceMotion = false,
64
+ getAutoTimeout,
65
+ nodeRef,
66
+ onEnter,
67
+ onEntering,
68
+ onEntered,
69
+ onExit,
70
+ onExiting,
71
+ onExited,
72
+ children,
73
+ ...childProps
74
+ } = props;
75
+ const parentGroup = React.useContext(TransitionGroupContext);
76
+
77
+ // react-transition-group's TransitionGroup tells children whether the group
78
+ // is still mounting. Material UI needs two values from that:
79
+ // - shouldEnterOnMount: whether this child should run an enter animation now.
80
+ // - isAppearing: the value passed to enter callbacks.
81
+ // A child added after the group mounted still enters, but callbacks receive
82
+ // isAppearing=false because the parent group is no longer mounting.
83
+ const shouldEnterOnMount = parentGroup && !parentGroup.isMounting ? enter : appear;
84
+ const [status, setStatus] = React.useState(() => {
85
+ if (inProp) {
86
+ return shouldEnterOnMount ? 'exited' : 'entered';
87
+ }
88
+ if (mountOnEnter || unmountOnExit) {
89
+ return 'unmounted';
90
+ }
91
+ return 'exited';
92
+ });
93
+ const statusRef = React.useRef(status);
94
+ statusRef.current = status;
95
+ const shouldAppearOnMountRef = React.useRef(inProp && shouldEnterOnMount);
96
+ const mountedRef = React.useRef(false);
97
+ const nextCallbackRef = React.useRef(null);
98
+ // Remember which status already fired lifecycle callbacks. React StrictMode
99
+ // can run effects twice in development; this prevents duplicate callbacks.
100
+ const lastFiredStatusRef = React.useRef(status);
101
+ // Store the isAppearing value for the current enter transition. performEnter
102
+ // sets it before the status effect later calls onEntering/onEntered.
103
+ const isAppearingRef = React.useRef(false);
104
+ // Capture reduced motion at the start of each phase so prop updates do not
105
+ // change the completion timing for an active transition.
106
+ const transitionReduceMotionRef = React.useRef(reduceMotion);
107
+
108
+ // Transition end callbacks can run after props changed. Read props through
109
+ // this ref so delayed work uses the latest callbacks and timeout settings.
110
+ const propsRef = useValueAsRef({
111
+ timeout,
112
+ addEndListener,
113
+ reduceMotion,
114
+ getAutoTimeout,
115
+ onEnter,
116
+ onEntering,
117
+ onEntered,
118
+ onExit,
119
+ onExiting,
120
+ onExited,
121
+ enter,
122
+ exit,
123
+ mountOnEnter,
124
+ unmountOnExit,
125
+ nodeRef,
126
+ parentGroup
127
+ });
128
+
129
+ // Effects below depend on these helpers. Keep their identity stable; they read
130
+ // changing props through propsRef.
131
+ const cancelPendingCallback = React.useCallback(() => {
132
+ if (nextCallbackRef.current !== null) {
133
+ nextCallbackRef.current.cancel();
134
+ nextCallbackRef.current = null;
135
+ }
136
+ }, []);
137
+ const makeCallback = React.useCallback(handler => {
138
+ let active = true;
139
+ const wrapped = () => {
140
+ if (active) {
141
+ active = false;
142
+ nextCallbackRef.current = null;
143
+ handler();
144
+ }
145
+ };
146
+ wrapped.cancel = () => {
147
+ active = false;
148
+ };
149
+ nextCallbackRef.current = wrapped;
150
+ return wrapped;
151
+ }, []);
152
+ const scheduleTransitionEnd = React.useCallback((nextStatus, currentStatus) => {
153
+ let timeoutId;
154
+ const clearTimer = () => {
155
+ if (timeoutId !== undefined) {
156
+ clearTimeout(timeoutId);
157
+ timeoutId = undefined;
158
+ }
159
+ };
160
+ const done = makeCallback(() => {
161
+ clearTimer();
162
+ statusRef.current = nextStatus;
163
+ setStatus(nextStatus);
164
+ });
165
+ const cancelDone = done.cancel;
166
+ done.cancel = () => {
167
+ clearTimer();
168
+ cancelDone();
169
+ };
170
+ const node = propsRef.current.nodeRef.current;
171
+ const listener = propsRef.current.addEndListener;
172
+ const hasAutoTimeout = propsRef.current.getAutoTimeout !== undefined;
173
+ const autoTimeout = propsRef.current.getAutoTimeout?.();
174
+ const authoredTimeout = getCompletionTimeout({
175
+ currentStatus,
176
+ isAppearing: isAppearingRef.current,
177
+ timeout: propsRef.current.timeout,
178
+ autoTimeout
179
+ });
180
+ const transitionReduceMotion = transitionReduceMotionRef.current;
181
+ // Auto-duration consumers may skip measurement under reduced motion, but
182
+ // still need a 0ms timeout when they provide addEndListener.
183
+ const fallbackTimeout = authoredTimeout ?? (transitionReduceMotion && hasAutoTimeout ? 0 : null);
184
+ const scheduleTimer = value => {
185
+ timeoutId = setTimeout(done, value);
186
+ };
187
+ if (!node) {
188
+ if (process.env.NODE_ENV !== 'production') {
189
+ console.warn(['MUI: The transition child does not expose a DOM element.', 'Make sure the child accepts a ref and forwards it to the underlying DOM element.', 'The transition animation cannot be observed without a DOM element and will be skipped.'].join('\n'));
190
+ }
191
+
192
+ // Match react-transition-group: if there is no DOM node, there is no
193
+ // transition to observe, so finish on the next tick.
194
+ scheduleTimer(0);
195
+ return;
196
+ }
197
+ if (listener) {
198
+ if (fallbackTimeout != null) {
199
+ scheduleTimer(transitionReduceMotion ? 0 : fallbackTimeout);
200
+ }
201
+
202
+ // With nodeRef, react-transition-group calls addEndListener(done).
203
+ // Material UI has long supported addEndListener(node, done). Keep both call
204
+ // shapes so existing transition wrappers do not have to change.
205
+ if (listener.length >= 2) {
206
+ listener(node, done);
207
+ } else {
208
+ listener(done);
209
+ }
210
+ return;
211
+ }
212
+ scheduleTimer(transitionReduceMotion ? 0 : authoredTimeout ?? 0);
213
+ }, [makeCallback, propsRef]);
214
+ const performEnter = React.useCallback(mounting => {
215
+ const current = propsRef.current;
216
+ const isAppearing = current.parentGroup ? current.parentGroup.isMounting : mounting;
217
+ isAppearingRef.current = isAppearing;
218
+
219
+ // On updates, enter=false skips the enter animation. Move straight to
220
+ // entered; the status effect will call onEntered, but onEnter/onEntering
221
+ // must not fire.
222
+ if (!mounting && !current.enter) {
223
+ statusRef.current = 'entered';
224
+ setStatus('entered');
225
+ return;
226
+ }
227
+ transitionReduceMotionRef.current = current.reduceMotion;
228
+ current.onEnter?.(isAppearing);
229
+ statusRef.current = 'entering';
230
+ setStatus('entering');
231
+ }, [propsRef]);
232
+ const performExit = React.useCallback(() => {
233
+ const current = propsRef.current;
234
+ if (!current.exit) {
235
+ statusRef.current = 'exited';
236
+ setStatus('exited');
237
+ return;
238
+ }
239
+ transitionReduceMotionRef.current = current.reduceMotion;
240
+ current.onExit?.();
241
+ statusRef.current = 'exiting';
242
+ setStatus('exiting');
243
+ }, [propsRef]);
244
+ const updateStatus = React.useCallback((mounting, nextStatus) => {
245
+ cancelPendingCallback();
246
+ if (nextStatus === 'entering') {
247
+ const current = propsRef.current;
248
+ // If the node was just mounted, read layout before entering so the
249
+ // browser applies the starting styles before the animation begins.
250
+ if (current.mountOnEnter || current.unmountOnExit) {
251
+ const node = current.nodeRef.current;
252
+ if (node) {
253
+ reflow(node);
254
+ }
255
+ }
256
+ performEnter(mounting);
257
+ } else {
258
+ performExit();
259
+ }
260
+ }, [cancelPendingCallback, performEnter, performExit, propsRef]);
261
+
262
+ // Runs on mount. useEnhancedEffect is needed because the initial appear
263
+ // transition may read layout before paint. In StrictMode development builds,
264
+ // React mounts, cleans up, and mounts again; cleanup cancels pending work and
265
+ // the second mount restarts the same transition.
266
+ useEnhancedEffect(() => {
267
+ mountedRef.current = true;
268
+ if (shouldAppearOnMountRef.current) {
269
+ shouldAppearOnMountRef.current = false;
270
+ updateStatus(true, 'entering');
271
+ }
272
+ return () => {
273
+ mountedRef.current = false;
274
+ cancelPendingCallback();
275
+ };
276
+ }, [cancelPendingCallback, updateStatus]);
277
+
278
+ // Reconcile the rendered status after `in` or status changes:
279
+ // - opening from unmounted first renders the child as exited so refs exist.
280
+ // - unmountOnExit removes the child after the exited state commits.
281
+ // This matches react-transition-group's observable status steps without
282
+ // running work after unrelated commits.
283
+ useEnhancedEffect(() => {
284
+ if (!mountedRef.current) {
285
+ return;
286
+ }
287
+ const current = statusRef.current;
288
+ if (inProp) {
289
+ if (current === 'unmounted') {
290
+ // Opening from unmounted needs one render with the child present so
291
+ // refs are attached before the enter animation starts.
292
+ statusRef.current = 'exited';
293
+ setStatus('exited');
294
+ } else if (current !== 'entering' && current !== 'entered') {
295
+ updateStatus(false, 'entering');
296
+ }
297
+ } else if (current === 'entering' || current === 'entered') {
298
+ updateStatus(false, 'exiting');
299
+ } else if (current === 'exited' && unmountOnExit) {
300
+ statusRef.current = 'unmounted';
301
+ setStatus('unmounted');
302
+ }
303
+ }, [inProp, status, unmountOnExit, updateStatus]);
304
+
305
+ // Fire lifecycle callbacks for committed status changes. The guard prevents
306
+ // duplicate callbacks in StrictMode; propsRef keeps delayed callbacks fresh.
307
+ useEnhancedEffect(() => {
308
+ // `unmounted` is bookkeeping, not a real transition state. Do not fire
309
+ // callbacks when moving into or out of it; otherwise the first open with
310
+ // mountOnEnter/unmountOnExit would look like a completed exit.
311
+ if (status === 'unmounted' || lastFiredStatusRef.current === 'unmounted') {
312
+ lastFiredStatusRef.current = status;
313
+ return;
314
+ }
315
+ const prev = lastFiredStatusRef.current;
316
+ if (prev === status) {
317
+ return;
318
+ }
319
+ lastFiredStatusRef.current = status;
320
+ const current = propsRef.current;
321
+ if (status === 'entering') {
322
+ current.onEntering?.(isAppearingRef.current);
323
+ scheduleTransitionEnd('entered', 'entering');
324
+ } else if (status === 'exiting') {
325
+ current.onExiting?.();
326
+ scheduleTransitionEnd('exited', 'exiting');
327
+ } else if (status === 'entered') {
328
+ current.onEntered?.(isAppearingRef.current);
329
+ } else if (status === 'exited') {
330
+ current.onExited?.();
331
+ }
332
+ }, [propsRef, scheduleTransitionEnd, status]);
333
+ if (status === 'unmounted') {
334
+ return null;
335
+ }
336
+
337
+ // Nested Material UI transitions should not inherit this transition's parent group.
338
+ // A null context keeps an outer TransitionGroup from controlling them.
339
+ return /*#__PURE__*/_jsx(TransitionGroupContext.Provider, {
340
+ value: null,
341
+ children: children(status, childProps)
342
+ });
343
+ }
344
+ process.env.NODE_ENV !== "production" ? Transition.propTypes /* remove-proptypes */ = {
345
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
346
+ // │ These PropTypes are generated from the TypeScript type definitions. │
347
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
348
+ // └─────────────────────────────────────────────────────────────────────┘
349
+ /**
350
+ * @ignore
351
+ */
352
+ addEndListener: PropTypes.func,
353
+ /**
354
+ * @ignore
355
+ */
356
+ appear: PropTypes.bool,
357
+ /**
358
+ * @ignore
359
+ */
360
+ children: PropTypes.func.isRequired,
361
+ /**
362
+ * @ignore
363
+ */
364
+ enter: PropTypes.bool,
365
+ /**
366
+ * @ignore
367
+ */
368
+ exit: PropTypes.bool,
369
+ /**
370
+ * @ignore
371
+ */
372
+ getAutoTimeout: PropTypes.func,
373
+ /**
374
+ * @ignore
375
+ */
376
+ in: PropTypes.bool,
377
+ /**
378
+ * @ignore
379
+ */
380
+ mountOnEnter: PropTypes.bool,
381
+ /**
382
+ * @ignore
383
+ */
384
+ nodeRef: PropTypes.shape({
385
+ current: (props, propName) => {
386
+ if (props[propName] == null) {
387
+ return null;
388
+ }
389
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
390
+ return new Error(`Expected prop '${propName}' to be of type Element`);
391
+ }
392
+ return null;
393
+ }
394
+ }).isRequired,
395
+ /**
396
+ * @ignore
397
+ */
398
+ onEnter: PropTypes.func,
399
+ /**
400
+ * @ignore
401
+ */
402
+ onEntered: PropTypes.func,
403
+ /**
404
+ * @ignore
405
+ */
406
+ onEntering: PropTypes.func,
407
+ /**
408
+ * @ignore
409
+ */
410
+ onExit: PropTypes.func,
411
+ /**
412
+ * @ignore
413
+ */
414
+ onExited: PropTypes.func,
415
+ /**
416
+ * @ignore
417
+ */
418
+ onExiting: PropTypes.func,
419
+ /**
420
+ * @ignore
421
+ */
422
+ reduceMotion: PropTypes.bool,
423
+ /**
424
+ * @ignore
425
+ */
426
+ timeout: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
427
+ appear: PropTypes.number,
428
+ enter: PropTypes.number,
429
+ exit: PropTypes.number
430
+ })]),
431
+ /**
432
+ * @ignore
433
+ */
434
+ unmountOnExit: PropTypes.bool
435
+ } : void 0;
436
+ export default Transition;
@@ -0,0 +1,8 @@
1
+ declare module 'react-transition-group/TransitionGroupContext' {
2
+ import * as React from 'react';
3
+ interface TransitionGroupContextValue {
4
+ isMounting: boolean;
5
+ }
6
+ const TransitionGroupContext: React.Context<TransitionGroupContextValue | null>;
7
+ export default TransitionGroupContext;
8
+ }
@@ -0,0 +1,8 @@
1
+ declare module 'react-transition-group/TransitionGroupContext' {
2
+ import * as React from 'react';
3
+ interface TransitionGroupContextValue {
4
+ isMounting: boolean;
5
+ }
6
+ const TransitionGroupContext: React.Context<TransitionGroupContextValue | null>;
7
+ export default TransitionGroupContext;
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "9.0.0",
3
+ "version": "9.1.0",
4
4
  "author": "MUI Team",
5
5
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
6
6
  "license": "MIT",
@@ -31,12 +31,12 @@
31
31
  "clsx": "^2.1.1",
32
32
  "csstype": "^3.2.3",
33
33
  "prop-types": "^15.8.1",
34
- "react-is": "^19.2.4",
34
+ "react-is": "^19.2.6",
35
35
  "react-transition-group": "^4.4.5",
36
- "@mui/core-downloads-tracker": "^9.0.0",
36
+ "@mui/core-downloads-tracker": "^9.1.0",
37
37
  "@mui/types": "^9.0.0",
38
- "@mui/system": "^9.0.0",
39
- "@mui/utils": "^9.0.0"
38
+ "@mui/utils": "^9.1.0",
39
+ "@mui/system": "^9.1.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.5.0",
@@ -44,7 +44,7 @@
44
44
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
45
45
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
46
46
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
47
- "@mui/material-pigment-css": "^9.0.0"
47
+ "@mui/material-pigment-css": "^9.1.0"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@types/react": {
@@ -573,154 +573,154 @@
573
573
  }
574
574
  },
575
575
  "./Box": {
576
- "require": {
577
- "types": "./Box/index.d.ts",
578
- "default": "./Box/index.js"
579
- },
580
576
  "import": {
581
577
  "types": "./Box/index.d.mts",
582
578
  "default": "./Box/index.mjs"
583
579
  },
580
+ "require": {
581
+ "types": "./Box/index.d.ts",
582
+ "default": "./Box/index.js"
583
+ },
584
584
  "default": {
585
585
  "types": "./Box/index.d.mts",
586
586
  "default": "./Box/index.mjs"
587
587
  }
588
588
  },
589
589
  "./Breadcrumbs": {
590
- "require": {
591
- "types": "./Breadcrumbs/index.d.ts",
592
- "default": "./Breadcrumbs/index.js"
593
- },
594
590
  "import": {
595
591
  "types": "./Breadcrumbs/index.d.mts",
596
592
  "default": "./Breadcrumbs/index.mjs"
597
593
  },
594
+ "require": {
595
+ "types": "./Breadcrumbs/index.d.ts",
596
+ "default": "./Breadcrumbs/index.js"
597
+ },
598
598
  "default": {
599
599
  "types": "./Breadcrumbs/index.d.mts",
600
600
  "default": "./Breadcrumbs/index.mjs"
601
601
  }
602
602
  },
603
603
  "./Button": {
604
- "require": {
605
- "types": "./Button/index.d.ts",
606
- "default": "./Button/index.js"
607
- },
608
604
  "import": {
609
605
  "types": "./Button/index.d.mts",
610
606
  "default": "./Button/index.mjs"
611
607
  },
608
+ "require": {
609
+ "types": "./Button/index.d.ts",
610
+ "default": "./Button/index.js"
611
+ },
612
612
  "default": {
613
613
  "types": "./Button/index.d.mts",
614
614
  "default": "./Button/index.mjs"
615
615
  }
616
616
  },
617
617
  "./ButtonBase": {
618
- "require": {
619
- "types": "./ButtonBase/index.d.ts",
620
- "default": "./ButtonBase/index.js"
621
- },
622
618
  "import": {
623
619
  "types": "./ButtonBase/index.d.mts",
624
620
  "default": "./ButtonBase/index.mjs"
625
621
  },
622
+ "require": {
623
+ "types": "./ButtonBase/index.d.ts",
624
+ "default": "./ButtonBase/index.js"
625
+ },
626
626
  "default": {
627
627
  "types": "./ButtonBase/index.d.mts",
628
628
  "default": "./ButtonBase/index.mjs"
629
629
  }
630
630
  },
631
631
  "./ButtonGroup": {
632
- "require": {
633
- "types": "./ButtonGroup/index.d.ts",
634
- "default": "./ButtonGroup/index.js"
635
- },
636
632
  "import": {
637
633
  "types": "./ButtonGroup/index.d.mts",
638
634
  "default": "./ButtonGroup/index.mjs"
639
635
  },
636
+ "require": {
637
+ "types": "./ButtonGroup/index.d.ts",
638
+ "default": "./ButtonGroup/index.js"
639
+ },
640
640
  "default": {
641
641
  "types": "./ButtonGroup/index.d.mts",
642
642
  "default": "./ButtonGroup/index.mjs"
643
643
  }
644
644
  },
645
645
  "./Card": {
646
- "require": {
647
- "types": "./Card/index.d.ts",
648
- "default": "./Card/index.js"
649
- },
650
646
  "import": {
651
647
  "types": "./Card/index.d.mts",
652
648
  "default": "./Card/index.mjs"
653
649
  },
650
+ "require": {
651
+ "types": "./Card/index.d.ts",
652
+ "default": "./Card/index.js"
653
+ },
654
654
  "default": {
655
655
  "types": "./Card/index.d.mts",
656
656
  "default": "./Card/index.mjs"
657
657
  }
658
658
  },
659
659
  "./CardActionArea": {
660
- "require": {
661
- "types": "./CardActionArea/index.d.ts",
662
- "default": "./CardActionArea/index.js"
663
- },
664
660
  "import": {
665
661
  "types": "./CardActionArea/index.d.mts",
666
662
  "default": "./CardActionArea/index.mjs"
667
663
  },
664
+ "require": {
665
+ "types": "./CardActionArea/index.d.ts",
666
+ "default": "./CardActionArea/index.js"
667
+ },
668
668
  "default": {
669
669
  "types": "./CardActionArea/index.d.mts",
670
670
  "default": "./CardActionArea/index.mjs"
671
671
  }
672
672
  },
673
673
  "./CardActions": {
674
- "require": {
675
- "types": "./CardActions/index.d.ts",
676
- "default": "./CardActions/index.js"
677
- },
678
674
  "import": {
679
675
  "types": "./CardActions/index.d.mts",
680
676
  "default": "./CardActions/index.mjs"
681
677
  },
678
+ "require": {
679
+ "types": "./CardActions/index.d.ts",
680
+ "default": "./CardActions/index.js"
681
+ },
682
682
  "default": {
683
683
  "types": "./CardActions/index.d.mts",
684
684
  "default": "./CardActions/index.mjs"
685
685
  }
686
686
  },
687
687
  "./CardContent": {
688
- "require": {
689
- "types": "./CardContent/index.d.ts",
690
- "default": "./CardContent/index.js"
691
- },
692
688
  "import": {
693
689
  "types": "./CardContent/index.d.mts",
694
690
  "default": "./CardContent/index.mjs"
695
691
  },
692
+ "require": {
693
+ "types": "./CardContent/index.d.ts",
694
+ "default": "./CardContent/index.js"
695
+ },
696
696
  "default": {
697
697
  "types": "./CardContent/index.d.mts",
698
698
  "default": "./CardContent/index.mjs"
699
699
  }
700
700
  },
701
701
  "./CardHeader": {
702
- "require": {
703
- "types": "./CardHeader/index.d.ts",
704
- "default": "./CardHeader/index.js"
705
- },
706
702
  "import": {
707
703
  "types": "./CardHeader/index.d.mts",
708
704
  "default": "./CardHeader/index.mjs"
709
705
  },
706
+ "require": {
707
+ "types": "./CardHeader/index.d.ts",
708
+ "default": "./CardHeader/index.js"
709
+ },
710
710
  "default": {
711
711
  "types": "./CardHeader/index.d.mts",
712
712
  "default": "./CardHeader/index.mjs"
713
713
  }
714
714
  },
715
715
  "./CardMedia": {
716
- "require": {
717
- "types": "./CardMedia/index.d.ts",
718
- "default": "./CardMedia/index.js"
719
- },
720
716
  "import": {
721
717
  "types": "./CardMedia/index.d.mts",
722
718
  "default": "./CardMedia/index.mjs"
723
719
  },
720
+ "require": {
721
+ "types": "./CardMedia/index.d.ts",
722
+ "default": "./CardMedia/index.js"
723
+ },
724
724
  "default": {
725
725
  "types": "./CardMedia/index.d.mts",
726
726
  "default": "./CardMedia/index.mjs"
@@ -0,0 +1,8 @@
1
+ export type ReducedMotionMode = 'never' | 'system' | 'always';
2
+ export interface Motion {
3
+ reducedMotion: ReducedMotionMode;
4
+ }
5
+ export interface MotionOptions {
6
+ reducedMotion?: ReducedMotionMode | undefined;
7
+ }
8
+ export default function createMotion(inputMotion?: MotionOptions): Motion;