@mui/material 9.0.1 → 9.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/Accordion/Accordion.d.mts +2 -2
  2. package/Accordion/Accordion.d.ts +2 -2
  3. package/Accordion/Accordion.js +3 -2
  4. package/Accordion/Accordion.mjs +3 -2
  5. package/AccordionSummary/AccordionSummary.js +27 -29
  6. package/AccordionSummary/AccordionSummary.mjs +27 -29
  7. package/Autocomplete/Autocomplete.d.mts +5 -1
  8. package/Autocomplete/Autocomplete.d.ts +5 -1
  9. package/Autocomplete/Autocomplete.js +13 -7
  10. package/Autocomplete/Autocomplete.mjs +13 -7
  11. package/Backdrop/Backdrop.d.mts +2 -2
  12. package/Backdrop/Backdrop.d.ts +2 -2
  13. package/Badge/Badge.js +28 -24
  14. package/Badge/Badge.mjs +28 -24
  15. package/BottomNavigationAction/BottomNavigationAction.js +6 -2
  16. package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
  17. package/Button/Button.js +11 -15
  18. package/Button/Button.mjs +11 -15
  19. package/ButtonBase/Ripple.js +21 -11
  20. package/ButtonBase/Ripple.mjs +21 -11
  21. package/ButtonBase/TouchRipple.js +252 -108
  22. package/ButtonBase/TouchRipple.mjs +253 -109
  23. package/CHANGELOG.md +122 -0
  24. package/CardActionArea/CardActionArea.js +2 -1
  25. package/CardActionArea/CardActionArea.mjs +2 -1
  26. package/Chip/Chip.js +2 -1
  27. package/Chip/Chip.mjs +2 -1
  28. package/CircularProgress/CircularProgress.js +85 -55
  29. package/CircularProgress/CircularProgress.mjs +84 -55
  30. package/Collapse/Collapse.d.mts +15 -3
  31. package/Collapse/Collapse.d.ts +15 -3
  32. package/Collapse/Collapse.js +44 -31
  33. package/Collapse/Collapse.mjs +43 -30
  34. package/Dialog/Dialog.d.mts +2 -2
  35. package/Dialog/Dialog.d.ts +2 -2
  36. package/Dialog/Dialog.js +2 -0
  37. package/Dialog/Dialog.mjs +2 -0
  38. package/Drawer/Drawer.d.mts +2 -2
  39. package/Drawer/Drawer.d.ts +2 -2
  40. package/Fab/Fab.js +2 -1
  41. package/Fab/Fab.mjs +2 -1
  42. package/Fade/Fade.d.mts +15 -2
  43. package/Fade/Fade.d.ts +15 -2
  44. package/Fade/Fade.js +46 -19
  45. package/Fade/Fade.mjs +45 -18
  46. package/FilledInput/FilledInput.js +4 -3
  47. package/FilledInput/FilledInput.mjs +4 -3
  48. package/Grow/Grow.d.mts +15 -2
  49. package/Grow/Grow.d.ts +15 -2
  50. package/Grow/Grow.js +45 -28
  51. package/Grow/Grow.mjs +44 -27
  52. package/IconButton/IconButton.js +2 -1
  53. package/IconButton/IconButton.mjs +2 -1
  54. package/InitColorSchemeScript/InitColorSchemeScript.d.mts +5 -5
  55. package/InitColorSchemeScript/InitColorSchemeScript.d.ts +5 -5
  56. package/Input/Input.js +3 -2
  57. package/Input/Input.mjs +3 -2
  58. package/InputBase/InputBase.js +2 -1
  59. package/InputBase/InputBase.mjs +2 -1
  60. package/InputLabel/InputLabel.js +2 -1
  61. package/InputLabel/InputLabel.mjs +2 -1
  62. package/LICENSE +1 -1
  63. package/LinearProgress/LinearProgress.js +187 -120
  64. package/LinearProgress/LinearProgress.mjs +186 -120
  65. package/ListItem/ListItem.js +2 -1
  66. package/ListItem/ListItem.mjs +2 -1
  67. package/ListItemButton/ListItemButton.js +2 -1
  68. package/ListItemButton/ListItemButton.mjs +2 -1
  69. package/Menu/Menu.d.mts +1 -1
  70. package/Menu/Menu.d.ts +1 -1
  71. package/MobileStepper/MobileStepper.js +2 -1
  72. package/MobileStepper/MobileStepper.mjs +2 -1
  73. package/OutlinedInput/NotchedOutline.js +4 -3
  74. package/OutlinedInput/NotchedOutline.mjs +4 -3
  75. package/PaginationItem/PaginationItem.js +2 -1
  76. package/PaginationItem/PaginationItem.mjs +2 -1
  77. package/Paper/Paper.js +2 -1
  78. package/Paper/Paper.mjs +2 -1
  79. package/Popover/Popover.d.mts +1 -1
  80. package/Popover/Popover.d.ts +1 -1
  81. package/README.md +3 -2
  82. package/Radio/RadioButtonIcon.js +3 -2
  83. package/Radio/RadioButtonIcon.mjs +3 -2
  84. package/Rating/Rating.js +2 -1
  85. package/Rating/Rating.mjs +2 -1
  86. package/Select/SelectInput.js +115 -25
  87. package/Select/SelectInput.mjs +115 -25
  88. package/Select/utils/SelectFocusSourceContext.d.mts +2 -2
  89. package/Select/utils/SelectFocusSourceContext.d.ts +2 -2
  90. package/Select/utils/closedTypeahead.js +73 -0
  91. package/Select/utils/closedTypeahead.mjs +63 -0
  92. package/Skeleton/Skeleton.js +22 -2
  93. package/Skeleton/Skeleton.mjs +22 -2
  94. package/Slide/Slide.d.mts +15 -2
  95. package/Slide/Slide.d.ts +15 -2
  96. package/Slide/Slide.js +53 -25
  97. package/Slide/Slide.mjs +52 -24
  98. package/Slider/Slider.js +4 -3
  99. package/Slider/Slider.mjs +4 -3
  100. package/Slider/SliderValueLabel.d.mts +2 -2
  101. package/Slider/SliderValueLabel.d.ts +2 -2
  102. package/Slider/useSlider.js +1 -1
  103. package/Slider/useSlider.mjs +1 -1
  104. package/Snackbar/Snackbar.d.mts +2 -2
  105. package/Snackbar/Snackbar.d.ts +2 -2
  106. package/SpeedDial/SpeedDial.d.mts +1 -1
  107. package/SpeedDial/SpeedDial.d.ts +1 -1
  108. package/SpeedDial/SpeedDial.js +6 -2
  109. package/SpeedDial/SpeedDial.mjs +6 -2
  110. package/SpeedDialAction/SpeedDialAction.js +11 -2
  111. package/SpeedDialAction/SpeedDialAction.mjs +12 -3
  112. package/SpeedDialIcon/SpeedDialIcon.js +40 -37
  113. package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
  114. package/Step/Step.js +47 -15
  115. package/Step/Step.mjs +47 -15
  116. package/Step/StepContext.d.mts +1 -1
  117. package/Step/StepContext.d.ts +1 -1
  118. package/StepButton/StepButton.js +9 -3
  119. package/StepButton/StepButton.mjs +9 -3
  120. package/StepConnector/StepConnector.js +10 -0
  121. package/StepConnector/StepConnector.mjs +10 -0
  122. package/StepContent/StepContent.d.mts +2 -2
  123. package/StepContent/StepContent.d.ts +2 -2
  124. package/StepContent/StepContent.js +26 -2
  125. package/StepContent/StepContent.mjs +26 -2
  126. package/StepIcon/StepIcon.js +2 -1
  127. package/StepIcon/StepIcon.mjs +2 -1
  128. package/StepLabel/StepLabel.js +52 -7
  129. package/StepLabel/StepLabel.mjs +52 -7
  130. package/Stepper/Stepper.d.mts +2 -0
  131. package/Stepper/Stepper.d.ts +2 -0
  132. package/Stepper/Stepper.js +18 -0
  133. package/Stepper/Stepper.mjs +18 -0
  134. package/Stepper/StepperContext.d.mts +1 -1
  135. package/Stepper/StepperContext.d.ts +1 -1
  136. package/SvgIcon/SvgIcon.js +2 -1
  137. package/SvgIcon/SvgIcon.mjs +2 -1
  138. package/SwipeableDrawer/SwipeableDrawer.js +14 -3
  139. package/SwipeableDrawer/SwipeableDrawer.mjs +14 -3
  140. package/Switch/Switch.js +3 -2
  141. package/Switch/Switch.mjs +3 -2
  142. package/TableSortLabel/TableSortLabel.js +2 -1
  143. package/TableSortLabel/TableSortLabel.mjs +2 -1
  144. package/Tabs/Tabs.js +14 -3
  145. package/Tabs/Tabs.mjs +14 -3
  146. package/Tooltip/Tooltip.d.mts +2 -2
  147. package/Tooltip/Tooltip.d.ts +2 -2
  148. package/Tooltip/Tooltip.js +3 -0
  149. package/Tooltip/Tooltip.mjs +3 -0
  150. package/Unstable_TrapFocus/FocusTrap.js +42 -8
  151. package/Unstable_TrapFocus/FocusTrap.mjs +42 -8
  152. package/Zoom/Zoom.d.mts +15 -2
  153. package/Zoom/Zoom.d.ts +15 -2
  154. package/Zoom/Zoom.js +43 -16
  155. package/Zoom/Zoom.mjs +42 -15
  156. package/index.js +1 -1
  157. package/index.mjs +1 -1
  158. package/internal/Transition.d.mts +34 -0
  159. package/internal/Transition.d.ts +34 -0
  160. package/internal/Transition.js +450 -0
  161. package/internal/Transition.mjs +442 -0
  162. package/internal/react-transition-group.d.mts +8 -0
  163. package/internal/react-transition-group.d.ts +8 -0
  164. package/package.json +7 -7
  165. package/styles/ThemeProviderWithVars.d.mts +7 -7
  166. package/styles/ThemeProviderWithVars.d.ts +7 -7
  167. package/styles/createGetSelector.d.mts +2 -2
  168. package/styles/createGetSelector.d.ts +2 -2
  169. package/styles/createMotion.d.mts +8 -0
  170. package/styles/createMotion.d.ts +8 -0
  171. package/styles/createMotion.js +13 -0
  172. package/styles/createMotion.mjs +7 -0
  173. package/styles/createThemeFoundation.d.mts +2 -0
  174. package/styles/createThemeFoundation.d.ts +2 -0
  175. package/styles/createThemeNoVars.d.mts +3 -0
  176. package/styles/createThemeNoVars.d.ts +3 -0
  177. package/styles/createThemeNoVars.js +5 -0
  178. package/styles/createThemeNoVars.mjs +5 -0
  179. package/styles/createTransitions.d.mts +6 -2
  180. package/styles/createTransitions.d.ts +6 -2
  181. package/styles/createTransitions.js +12 -4
  182. package/styles/createTransitions.mjs +12 -4
  183. package/styles/enhanceHighContrast.d.mts +70 -0
  184. package/styles/enhanceHighContrast.d.ts +70 -0
  185. package/styles/enhanceHighContrast.js +502 -0
  186. package/styles/enhanceHighContrast.mjs +495 -0
  187. package/styles/identifier.d.mts +1 -1
  188. package/styles/identifier.d.ts +1 -1
  189. package/styles/index.d.mts +2 -0
  190. package/styles/index.d.ts +2 -0
  191. package/styles/index.js +8 -0
  192. package/styles/index.mjs +1 -0
  193. package/styles/reducedMotion.d.mts +7 -0
  194. package/styles/reducedMotion.d.ts +7 -0
  195. package/styles/reducedMotion.js +21 -0
  196. package/styles/reducedMotion.mjs +14 -0
  197. package/styles/shouldSkipGeneratingVar.js +1 -1
  198. package/styles/shouldSkipGeneratingVar.mjs +1 -1
  199. package/styles/stringifyTheme.js +1 -0
  200. package/styles/stringifyTheme.mjs +1 -0
  201. package/transitions/index.d.mts +1 -1
  202. package/transitions/index.d.ts +1 -1
  203. package/transitions/index.js +0 -11
  204. package/transitions/index.mjs +1 -1
  205. package/transitions/transition.d.mts +1 -12
  206. package/transitions/transition.d.ts +1 -12
  207. package/transitions/types.d.mts +73 -0
  208. package/transitions/types.d.ts +73 -0
  209. package/transitions/useReducedMotion.d.mts +14 -0
  210. package/transitions/useReducedMotion.d.ts +14 -0
  211. package/transitions/useReducedMotion.js +117 -0
  212. package/transitions/useReducedMotion.mjs +110 -0
  213. package/transitions/utils.d.mts +34 -2
  214. package/transitions/utils.d.ts +34 -2
  215. package/transitions/utils.js +33 -4
  216. package/transitions/utils.mjs +31 -4
  217. package/useAutocomplete/useAutocomplete.d.mts +8 -1
  218. package/useAutocomplete/useAutocomplete.d.ts +8 -1
  219. package/useAutocomplete/useAutocomplete.js +66 -4
  220. package/useAutocomplete/useAutocomplete.mjs +66 -4
  221. package/utils/memoTheme.d.mts +1 -1
  222. package/utils/memoTheme.d.ts +1 -1
  223. package/utils/useSlot.d.mts +1 -1
  224. package/utils/useSlot.d.ts +1 -1
  225. package/version/index.js +2 -2
  226. package/version/index.mjs +2 -2
  227. /package/transitions/{transition.js → types.js} +0 -0
  228. /package/transitions/{transition.mjs → types.mjs} +0 -0
@@ -0,0 +1,450 @@
1
+ "use strict";
2
+ /// <reference path="./react-transition-group.d.ts" />
3
+ 'use client';
4
+
5
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports.default = void 0;
11
+ var React = _interopRequireWildcard(require("react"));
12
+ var _propTypes = _interopRequireDefault(require("prop-types"));
13
+ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
14
+ var _useValueAsRef = _interopRequireDefault(require("@mui/utils/useValueAsRef"));
15
+ var _TransitionGroupContext = _interopRequireDefault(require("react-transition-group/TransitionGroupContext"));
16
+ var _utils = require("../transitions/utils");
17
+ var _jsxRuntime = require("react/jsx-runtime");
18
+ // Material UI transitions must still work inside react-transition-group's TransitionGroup.
19
+ // Import only its context module; do not import its Transition or TransitionGroup components.
20
+
21
+ function resolveTimeouts(timeout) {
22
+ if (timeout == null) {
23
+ return {
24
+ appear: undefined,
25
+ enter: undefined,
26
+ exit: undefined
27
+ };
28
+ }
29
+ if (typeof timeout === 'number') {
30
+ return {
31
+ appear: timeout,
32
+ enter: timeout,
33
+ exit: timeout
34
+ };
35
+ }
36
+ const enter = timeout.enter;
37
+ const exit = timeout.exit;
38
+ const appear = timeout.appear !== undefined ? timeout.appear : enter;
39
+ return {
40
+ appear,
41
+ enter,
42
+ exit
43
+ };
44
+ }
45
+
46
+ /**
47
+ * Resolves the authored completion timeout for the current transition phase.
48
+ * Auto durations are read by the caller at scheduling time so Grow/Collapse
49
+ * can pass the latest measured value without storing it in React state.
50
+ */
51
+ function getCompletionTimeout(params) {
52
+ if (params.autoTimeout != null) {
53
+ return params.autoTimeout;
54
+ }
55
+ const resolved = resolveTimeouts(params.timeout);
56
+ if (params.currentStatus === 'entering') {
57
+ return params.isAppearing ? resolved.appear ?? resolved.enter ?? null : resolved.enter ?? null;
58
+ }
59
+ return resolved.exit ?? null;
60
+ }
61
+ function Transition(props) {
62
+ const {
63
+ in: inProp = false,
64
+ appear = false,
65
+ enter = true,
66
+ exit = true,
67
+ mountOnEnter = false,
68
+ unmountOnExit = false,
69
+ timeout,
70
+ addEndListener,
71
+ reduceMotion = false,
72
+ getAutoTimeout,
73
+ nodeRef,
74
+ onEnter,
75
+ onEntering,
76
+ onEntered,
77
+ onExit,
78
+ onExiting,
79
+ onExited,
80
+ children,
81
+ ...childProps
82
+ } = props;
83
+ const parentGroup = React.useContext(_TransitionGroupContext.default);
84
+
85
+ // react-transition-group's TransitionGroup tells children whether the group
86
+ // is still mounting. Material UI needs two values from that:
87
+ // - shouldEnterOnMount: whether this child should run an enter animation now.
88
+ // - isAppearing: the value passed to enter callbacks.
89
+ // A child added after the group mounted still enters, but callbacks receive
90
+ // isAppearing=false because the parent group is no longer mounting.
91
+ const shouldEnterOnMount = parentGroup && !parentGroup.isMounting ? enter : appear;
92
+ const [status, setStatus] = React.useState(() => {
93
+ if (inProp) {
94
+ return shouldEnterOnMount ? 'exited' : 'entered';
95
+ }
96
+ if (mountOnEnter || unmountOnExit) {
97
+ return 'unmounted';
98
+ }
99
+ return 'exited';
100
+ });
101
+ const statusRef = React.useRef(status);
102
+ statusRef.current = status;
103
+
104
+ // Opening from `unmounted`: mount the child in the same commit that `in` turns
105
+ // true so its ref is attached before effects run. react-transition-group did
106
+ // this by deriving the status from props during render; handling it in a
107
+ // layout effect instead would add a commit where the child is still null,
108
+ // breaking consumers that read the ref right after `in` flips.
109
+ if (inProp && status === 'unmounted') {
110
+ statusRef.current = 'exited';
111
+ setStatus('exited');
112
+ }
113
+ const shouldAppearOnMountRef = React.useRef(inProp && shouldEnterOnMount);
114
+ const mountedRef = React.useRef(false);
115
+ const nextCallbackRef = React.useRef(null);
116
+ // Remember which status already fired lifecycle callbacks. React StrictMode
117
+ // can run effects twice in development; this prevents duplicate callbacks.
118
+ const lastFiredStatusRef = React.useRef(status);
119
+ // Store the isAppearing value for the current enter transition. performEnter
120
+ // sets it before the status effect later calls onEntering/onEntered.
121
+ const isAppearingRef = React.useRef(false);
122
+ // Capture reduced motion at the start of each phase so prop updates do not
123
+ // change the completion timing for an active transition.
124
+ const transitionReduceMotionRef = React.useRef(reduceMotion);
125
+
126
+ // Transition end callbacks can run after props changed. Read props through
127
+ // this ref so delayed work uses the latest callbacks and timeout settings.
128
+ const propsRef = (0, _useValueAsRef.default)({
129
+ timeout,
130
+ addEndListener,
131
+ reduceMotion,
132
+ getAutoTimeout,
133
+ onEnter,
134
+ onEntering,
135
+ onEntered,
136
+ onExit,
137
+ onExiting,
138
+ onExited,
139
+ enter,
140
+ exit,
141
+ mountOnEnter,
142
+ unmountOnExit,
143
+ nodeRef,
144
+ parentGroup
145
+ });
146
+
147
+ // Effects below depend on these helpers. Keep their identity stable; they read
148
+ // changing props through propsRef.
149
+ const cancelPendingCallback = React.useCallback(() => {
150
+ if (nextCallbackRef.current !== null) {
151
+ nextCallbackRef.current.cancel();
152
+ nextCallbackRef.current = null;
153
+ }
154
+ }, []);
155
+ const makeCallback = React.useCallback(handler => {
156
+ let active = true;
157
+ const wrapped = () => {
158
+ if (active) {
159
+ active = false;
160
+ nextCallbackRef.current = null;
161
+ handler();
162
+ }
163
+ };
164
+ wrapped.cancel = () => {
165
+ active = false;
166
+ };
167
+ nextCallbackRef.current = wrapped;
168
+ return wrapped;
169
+ }, []);
170
+ const scheduleTransitionEnd = React.useCallback((nextStatus, currentStatus) => {
171
+ let timeoutId;
172
+ const clearTimer = () => {
173
+ if (timeoutId !== undefined) {
174
+ clearTimeout(timeoutId);
175
+ timeoutId = undefined;
176
+ }
177
+ };
178
+ const done = makeCallback(() => {
179
+ clearTimer();
180
+ statusRef.current = nextStatus;
181
+ setStatus(nextStatus);
182
+ });
183
+ const cancelDone = done.cancel;
184
+ done.cancel = () => {
185
+ clearTimer();
186
+ cancelDone();
187
+ };
188
+ const node = propsRef.current.nodeRef.current;
189
+ const listener = propsRef.current.addEndListener;
190
+ const hasAutoTimeout = propsRef.current.getAutoTimeout !== undefined;
191
+ const autoTimeout = propsRef.current.getAutoTimeout?.();
192
+ const authoredTimeout = getCompletionTimeout({
193
+ currentStatus,
194
+ isAppearing: isAppearingRef.current,
195
+ timeout: propsRef.current.timeout,
196
+ autoTimeout
197
+ });
198
+ const transitionReduceMotion = transitionReduceMotionRef.current;
199
+ // Auto-duration consumers may skip measurement under reduced motion, but
200
+ // still need a 0ms timeout when they provide addEndListener.
201
+ const fallbackTimeout = authoredTimeout ?? (transitionReduceMotion && hasAutoTimeout ? 0 : null);
202
+ const scheduleTimer = value => {
203
+ timeoutId = setTimeout(done, value);
204
+ };
205
+ if (!node) {
206
+ if (process.env.NODE_ENV !== 'production') {
207
+ 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'));
208
+ }
209
+
210
+ // Match react-transition-group: if there is no DOM node, there is no
211
+ // transition to observe, so finish on the next tick.
212
+ scheduleTimer(0);
213
+ return;
214
+ }
215
+ if (listener) {
216
+ if (fallbackTimeout != null) {
217
+ scheduleTimer(transitionReduceMotion ? 0 : fallbackTimeout);
218
+ }
219
+
220
+ // With nodeRef, react-transition-group calls addEndListener(done).
221
+ // Material UI has long supported addEndListener(node, done). Keep both call
222
+ // shapes so existing transition wrappers do not have to change.
223
+ if (listener.length >= 2) {
224
+ listener(node, done);
225
+ } else {
226
+ listener(done);
227
+ }
228
+ return;
229
+ }
230
+ scheduleTimer(transitionReduceMotion ? 0 : authoredTimeout ?? 0);
231
+ }, [makeCallback, propsRef]);
232
+ const performEnter = React.useCallback(mounting => {
233
+ const current = propsRef.current;
234
+ const isAppearing = current.parentGroup ? current.parentGroup.isMounting : mounting;
235
+ isAppearingRef.current = isAppearing;
236
+
237
+ // On updates, enter=false skips the enter animation. Move straight to
238
+ // entered; the status effect will call onEntered, but onEnter/onEntering
239
+ // must not fire.
240
+ if (!mounting && !current.enter) {
241
+ statusRef.current = 'entered';
242
+ setStatus('entered');
243
+ return;
244
+ }
245
+ transitionReduceMotionRef.current = current.reduceMotion;
246
+ current.onEnter?.(isAppearing);
247
+ statusRef.current = 'entering';
248
+ setStatus('entering');
249
+ }, [propsRef]);
250
+ const performExit = React.useCallback(() => {
251
+ const current = propsRef.current;
252
+ if (!current.exit) {
253
+ statusRef.current = 'exited';
254
+ setStatus('exited');
255
+ return;
256
+ }
257
+ transitionReduceMotionRef.current = current.reduceMotion;
258
+ current.onExit?.();
259
+ statusRef.current = 'exiting';
260
+ setStatus('exiting');
261
+ }, [propsRef]);
262
+ const updateStatus = React.useCallback((mounting, nextStatus) => {
263
+ cancelPendingCallback();
264
+ if (nextStatus === 'entering') {
265
+ const current = propsRef.current;
266
+ // If the node was just mounted, read layout before entering so the
267
+ // browser applies the starting styles before the animation begins.
268
+ if (current.mountOnEnter || current.unmountOnExit) {
269
+ const node = current.nodeRef.current;
270
+ if (node) {
271
+ (0, _utils.reflow)(node);
272
+ }
273
+ }
274
+ performEnter(mounting);
275
+ } else {
276
+ performExit();
277
+ }
278
+ }, [cancelPendingCallback, performEnter, performExit, propsRef]);
279
+
280
+ // Runs on mount. useEnhancedEffect is needed because the initial appear
281
+ // transition may read layout before paint. In StrictMode development builds,
282
+ // React mounts, cleans up, and mounts again; cleanup cancels pending work and
283
+ // the second mount restarts the same transition.
284
+ (0, _useEnhancedEffect.default)(() => {
285
+ mountedRef.current = true;
286
+ if (shouldAppearOnMountRef.current) {
287
+ shouldAppearOnMountRef.current = false;
288
+ updateStatus(true, 'entering');
289
+ }
290
+ return () => {
291
+ mountedRef.current = false;
292
+ cancelPendingCallback();
293
+ };
294
+ }, [cancelPendingCallback, updateStatus]);
295
+
296
+ // Reconcile the rendered status after `in` or status changes:
297
+ // - opening from unmounted is handled during render (see above) so the child
298
+ // is committed as exited with its ref attached before this effect runs.
299
+ // - unmountOnExit removes the child after the exited state commits.
300
+ // This matches react-transition-group's observable status steps without
301
+ // running work after unrelated commits.
302
+ (0, _useEnhancedEffect.default)(() => {
303
+ if (!mountedRef.current) {
304
+ return;
305
+ }
306
+ const current = statusRef.current;
307
+ if (inProp) {
308
+ if (current !== 'entering' && current !== 'entered') {
309
+ updateStatus(false, 'entering');
310
+ }
311
+ } else if (current === 'entering' || current === 'entered') {
312
+ updateStatus(false, 'exiting');
313
+ } else if (current === 'exited' && unmountOnExit) {
314
+ statusRef.current = 'unmounted';
315
+ setStatus('unmounted');
316
+ }
317
+ }, [inProp, status, unmountOnExit, updateStatus]);
318
+
319
+ // Fire lifecycle callbacks for committed status changes. The guard prevents
320
+ // duplicate callbacks in StrictMode; propsRef keeps delayed callbacks fresh.
321
+ (0, _useEnhancedEffect.default)(() => {
322
+ // `unmounted` is bookkeeping, not a real transition state. Do not fire
323
+ // callbacks when moving into or out of it; otherwise the first open with
324
+ // mountOnEnter/unmountOnExit would look like a completed exit.
325
+ if (status === 'unmounted' || lastFiredStatusRef.current === 'unmounted') {
326
+ lastFiredStatusRef.current = status;
327
+ return;
328
+ }
329
+ const prev = lastFiredStatusRef.current;
330
+ if (prev === status) {
331
+ return;
332
+ }
333
+ lastFiredStatusRef.current = status;
334
+ const current = propsRef.current;
335
+ if (status === 'entering') {
336
+ current.onEntering?.(isAppearingRef.current);
337
+ scheduleTransitionEnd('entered', 'entering');
338
+ } else if (status === 'exiting') {
339
+ current.onExiting?.();
340
+ scheduleTransitionEnd('exited', 'exiting');
341
+ } else if (status === 'entered') {
342
+ current.onEntered?.(isAppearingRef.current);
343
+ } else if (status === 'exited') {
344
+ current.onExited?.();
345
+ }
346
+ }, [propsRef, scheduleTransitionEnd, status]);
347
+ if (status === 'unmounted') {
348
+ return null;
349
+ }
350
+
351
+ // Nested Material UI transitions should not inherit this transition's parent group.
352
+ // A null context keeps an outer TransitionGroup from controlling them.
353
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TransitionGroupContext.default.Provider, {
354
+ value: null,
355
+ children: children(status, childProps)
356
+ });
357
+ }
358
+ process.env.NODE_ENV !== "production" ? Transition.propTypes /* remove-proptypes */ = {
359
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
360
+ // │ These PropTypes are generated from the TypeScript type definitions. │
361
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
362
+ // └─────────────────────────────────────────────────────────────────────┘
363
+ /**
364
+ * @ignore
365
+ */
366
+ addEndListener: _propTypes.default.func,
367
+ /**
368
+ * @ignore
369
+ */
370
+ appear: _propTypes.default.bool,
371
+ /**
372
+ * @ignore
373
+ */
374
+ children: _propTypes.default.func.isRequired,
375
+ /**
376
+ * @ignore
377
+ */
378
+ enter: _propTypes.default.bool,
379
+ /**
380
+ * @ignore
381
+ */
382
+ exit: _propTypes.default.bool,
383
+ /**
384
+ * @ignore
385
+ */
386
+ getAutoTimeout: _propTypes.default.func,
387
+ /**
388
+ * @ignore
389
+ */
390
+ in: _propTypes.default.bool,
391
+ /**
392
+ * @ignore
393
+ */
394
+ mountOnEnter: _propTypes.default.bool,
395
+ /**
396
+ * @ignore
397
+ */
398
+ nodeRef: _propTypes.default.shape({
399
+ current: (props, propName) => {
400
+ if (props[propName] == null) {
401
+ return null;
402
+ }
403
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
404
+ return new Error(`Expected prop '${propName}' to be of type Element`);
405
+ }
406
+ return null;
407
+ }
408
+ }).isRequired,
409
+ /**
410
+ * @ignore
411
+ */
412
+ onEnter: _propTypes.default.func,
413
+ /**
414
+ * @ignore
415
+ */
416
+ onEntered: _propTypes.default.func,
417
+ /**
418
+ * @ignore
419
+ */
420
+ onEntering: _propTypes.default.func,
421
+ /**
422
+ * @ignore
423
+ */
424
+ onExit: _propTypes.default.func,
425
+ /**
426
+ * @ignore
427
+ */
428
+ onExited: _propTypes.default.func,
429
+ /**
430
+ * @ignore
431
+ */
432
+ onExiting: _propTypes.default.func,
433
+ /**
434
+ * @ignore
435
+ */
436
+ reduceMotion: _propTypes.default.bool,
437
+ /**
438
+ * @ignore
439
+ */
440
+ timeout: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
441
+ appear: _propTypes.default.number,
442
+ enter: _propTypes.default.number,
443
+ exit: _propTypes.default.number
444
+ })]),
445
+ /**
446
+ * @ignore
447
+ */
448
+ unmountOnExit: _propTypes.default.bool
449
+ } : void 0;
450
+ var _default = exports.default = Transition;