@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,444 @@
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
+ const shouldAppearOnMountRef = React.useRef(inProp && shouldEnterOnMount);
104
+ const mountedRef = React.useRef(false);
105
+ const nextCallbackRef = React.useRef(null);
106
+ // Remember which status already fired lifecycle callbacks. React StrictMode
107
+ // can run effects twice in development; this prevents duplicate callbacks.
108
+ const lastFiredStatusRef = React.useRef(status);
109
+ // Store the isAppearing value for the current enter transition. performEnter
110
+ // sets it before the status effect later calls onEntering/onEntered.
111
+ const isAppearingRef = React.useRef(false);
112
+ // Capture reduced motion at the start of each phase so prop updates do not
113
+ // change the completion timing for an active transition.
114
+ const transitionReduceMotionRef = React.useRef(reduceMotion);
115
+
116
+ // Transition end callbacks can run after props changed. Read props through
117
+ // this ref so delayed work uses the latest callbacks and timeout settings.
118
+ const propsRef = (0, _useValueAsRef.default)({
119
+ timeout,
120
+ addEndListener,
121
+ reduceMotion,
122
+ getAutoTimeout,
123
+ onEnter,
124
+ onEntering,
125
+ onEntered,
126
+ onExit,
127
+ onExiting,
128
+ onExited,
129
+ enter,
130
+ exit,
131
+ mountOnEnter,
132
+ unmountOnExit,
133
+ nodeRef,
134
+ parentGroup
135
+ });
136
+
137
+ // Effects below depend on these helpers. Keep their identity stable; they read
138
+ // changing props through propsRef.
139
+ const cancelPendingCallback = React.useCallback(() => {
140
+ if (nextCallbackRef.current !== null) {
141
+ nextCallbackRef.current.cancel();
142
+ nextCallbackRef.current = null;
143
+ }
144
+ }, []);
145
+ const makeCallback = React.useCallback(handler => {
146
+ let active = true;
147
+ const wrapped = () => {
148
+ if (active) {
149
+ active = false;
150
+ nextCallbackRef.current = null;
151
+ handler();
152
+ }
153
+ };
154
+ wrapped.cancel = () => {
155
+ active = false;
156
+ };
157
+ nextCallbackRef.current = wrapped;
158
+ return wrapped;
159
+ }, []);
160
+ const scheduleTransitionEnd = React.useCallback((nextStatus, currentStatus) => {
161
+ let timeoutId;
162
+ const clearTimer = () => {
163
+ if (timeoutId !== undefined) {
164
+ clearTimeout(timeoutId);
165
+ timeoutId = undefined;
166
+ }
167
+ };
168
+ const done = makeCallback(() => {
169
+ clearTimer();
170
+ statusRef.current = nextStatus;
171
+ setStatus(nextStatus);
172
+ });
173
+ const cancelDone = done.cancel;
174
+ done.cancel = () => {
175
+ clearTimer();
176
+ cancelDone();
177
+ };
178
+ const node = propsRef.current.nodeRef.current;
179
+ const listener = propsRef.current.addEndListener;
180
+ const hasAutoTimeout = propsRef.current.getAutoTimeout !== undefined;
181
+ const autoTimeout = propsRef.current.getAutoTimeout?.();
182
+ const authoredTimeout = getCompletionTimeout({
183
+ currentStatus,
184
+ isAppearing: isAppearingRef.current,
185
+ timeout: propsRef.current.timeout,
186
+ autoTimeout
187
+ });
188
+ const transitionReduceMotion = transitionReduceMotionRef.current;
189
+ // Auto-duration consumers may skip measurement under reduced motion, but
190
+ // still need a 0ms timeout when they provide addEndListener.
191
+ const fallbackTimeout = authoredTimeout ?? (transitionReduceMotion && hasAutoTimeout ? 0 : null);
192
+ const scheduleTimer = value => {
193
+ timeoutId = setTimeout(done, value);
194
+ };
195
+ if (!node) {
196
+ if (process.env.NODE_ENV !== 'production') {
197
+ 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'));
198
+ }
199
+
200
+ // Match react-transition-group: if there is no DOM node, there is no
201
+ // transition to observe, so finish on the next tick.
202
+ scheduleTimer(0);
203
+ return;
204
+ }
205
+ if (listener) {
206
+ if (fallbackTimeout != null) {
207
+ scheduleTimer(transitionReduceMotion ? 0 : fallbackTimeout);
208
+ }
209
+
210
+ // With nodeRef, react-transition-group calls addEndListener(done).
211
+ // Material UI has long supported addEndListener(node, done). Keep both call
212
+ // shapes so existing transition wrappers do not have to change.
213
+ if (listener.length >= 2) {
214
+ listener(node, done);
215
+ } else {
216
+ listener(done);
217
+ }
218
+ return;
219
+ }
220
+ scheduleTimer(transitionReduceMotion ? 0 : authoredTimeout ?? 0);
221
+ }, [makeCallback, propsRef]);
222
+ const performEnter = React.useCallback(mounting => {
223
+ const current = propsRef.current;
224
+ const isAppearing = current.parentGroup ? current.parentGroup.isMounting : mounting;
225
+ isAppearingRef.current = isAppearing;
226
+
227
+ // On updates, enter=false skips the enter animation. Move straight to
228
+ // entered; the status effect will call onEntered, but onEnter/onEntering
229
+ // must not fire.
230
+ if (!mounting && !current.enter) {
231
+ statusRef.current = 'entered';
232
+ setStatus('entered');
233
+ return;
234
+ }
235
+ transitionReduceMotionRef.current = current.reduceMotion;
236
+ current.onEnter?.(isAppearing);
237
+ statusRef.current = 'entering';
238
+ setStatus('entering');
239
+ }, [propsRef]);
240
+ const performExit = React.useCallback(() => {
241
+ const current = propsRef.current;
242
+ if (!current.exit) {
243
+ statusRef.current = 'exited';
244
+ setStatus('exited');
245
+ return;
246
+ }
247
+ transitionReduceMotionRef.current = current.reduceMotion;
248
+ current.onExit?.();
249
+ statusRef.current = 'exiting';
250
+ setStatus('exiting');
251
+ }, [propsRef]);
252
+ const updateStatus = React.useCallback((mounting, nextStatus) => {
253
+ cancelPendingCallback();
254
+ if (nextStatus === 'entering') {
255
+ const current = propsRef.current;
256
+ // If the node was just mounted, read layout before entering so the
257
+ // browser applies the starting styles before the animation begins.
258
+ if (current.mountOnEnter || current.unmountOnExit) {
259
+ const node = current.nodeRef.current;
260
+ if (node) {
261
+ (0, _utils.reflow)(node);
262
+ }
263
+ }
264
+ performEnter(mounting);
265
+ } else {
266
+ performExit();
267
+ }
268
+ }, [cancelPendingCallback, performEnter, performExit, propsRef]);
269
+
270
+ // Runs on mount. useEnhancedEffect is needed because the initial appear
271
+ // transition may read layout before paint. In StrictMode development builds,
272
+ // React mounts, cleans up, and mounts again; cleanup cancels pending work and
273
+ // the second mount restarts the same transition.
274
+ (0, _useEnhancedEffect.default)(() => {
275
+ mountedRef.current = true;
276
+ if (shouldAppearOnMountRef.current) {
277
+ shouldAppearOnMountRef.current = false;
278
+ updateStatus(true, 'entering');
279
+ }
280
+ return () => {
281
+ mountedRef.current = false;
282
+ cancelPendingCallback();
283
+ };
284
+ }, [cancelPendingCallback, updateStatus]);
285
+
286
+ // Reconcile the rendered status after `in` or status changes:
287
+ // - opening from unmounted first renders the child as exited so refs exist.
288
+ // - unmountOnExit removes the child after the exited state commits.
289
+ // This matches react-transition-group's observable status steps without
290
+ // running work after unrelated commits.
291
+ (0, _useEnhancedEffect.default)(() => {
292
+ if (!mountedRef.current) {
293
+ return;
294
+ }
295
+ const current = statusRef.current;
296
+ if (inProp) {
297
+ if (current === 'unmounted') {
298
+ // Opening from unmounted needs one render with the child present so
299
+ // refs are attached before the enter animation starts.
300
+ statusRef.current = 'exited';
301
+ setStatus('exited');
302
+ } else if (current !== 'entering' && current !== 'entered') {
303
+ updateStatus(false, 'entering');
304
+ }
305
+ } else if (current === 'entering' || current === 'entered') {
306
+ updateStatus(false, 'exiting');
307
+ } else if (current === 'exited' && unmountOnExit) {
308
+ statusRef.current = 'unmounted';
309
+ setStatus('unmounted');
310
+ }
311
+ }, [inProp, status, unmountOnExit, updateStatus]);
312
+
313
+ // Fire lifecycle callbacks for committed status changes. The guard prevents
314
+ // duplicate callbacks in StrictMode; propsRef keeps delayed callbacks fresh.
315
+ (0, _useEnhancedEffect.default)(() => {
316
+ // `unmounted` is bookkeeping, not a real transition state. Do not fire
317
+ // callbacks when moving into or out of it; otherwise the first open with
318
+ // mountOnEnter/unmountOnExit would look like a completed exit.
319
+ if (status === 'unmounted' || lastFiredStatusRef.current === 'unmounted') {
320
+ lastFiredStatusRef.current = status;
321
+ return;
322
+ }
323
+ const prev = lastFiredStatusRef.current;
324
+ if (prev === status) {
325
+ return;
326
+ }
327
+ lastFiredStatusRef.current = status;
328
+ const current = propsRef.current;
329
+ if (status === 'entering') {
330
+ current.onEntering?.(isAppearingRef.current);
331
+ scheduleTransitionEnd('entered', 'entering');
332
+ } else if (status === 'exiting') {
333
+ current.onExiting?.();
334
+ scheduleTransitionEnd('exited', 'exiting');
335
+ } else if (status === 'entered') {
336
+ current.onEntered?.(isAppearingRef.current);
337
+ } else if (status === 'exited') {
338
+ current.onExited?.();
339
+ }
340
+ }, [propsRef, scheduleTransitionEnd, status]);
341
+ if (status === 'unmounted') {
342
+ return null;
343
+ }
344
+
345
+ // Nested Material UI transitions should not inherit this transition's parent group.
346
+ // A null context keeps an outer TransitionGroup from controlling them.
347
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_TransitionGroupContext.default.Provider, {
348
+ value: null,
349
+ children: children(status, childProps)
350
+ });
351
+ }
352
+ process.env.NODE_ENV !== "production" ? Transition.propTypes /* remove-proptypes */ = {
353
+ // ┌────────────────────────────── Warning ──────────────────────────────┐
354
+ // │ These PropTypes are generated from the TypeScript type definitions. │
355
+ // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
356
+ // └─────────────────────────────────────────────────────────────────────┘
357
+ /**
358
+ * @ignore
359
+ */
360
+ addEndListener: _propTypes.default.func,
361
+ /**
362
+ * @ignore
363
+ */
364
+ appear: _propTypes.default.bool,
365
+ /**
366
+ * @ignore
367
+ */
368
+ children: _propTypes.default.func.isRequired,
369
+ /**
370
+ * @ignore
371
+ */
372
+ enter: _propTypes.default.bool,
373
+ /**
374
+ * @ignore
375
+ */
376
+ exit: _propTypes.default.bool,
377
+ /**
378
+ * @ignore
379
+ */
380
+ getAutoTimeout: _propTypes.default.func,
381
+ /**
382
+ * @ignore
383
+ */
384
+ in: _propTypes.default.bool,
385
+ /**
386
+ * @ignore
387
+ */
388
+ mountOnEnter: _propTypes.default.bool,
389
+ /**
390
+ * @ignore
391
+ */
392
+ nodeRef: _propTypes.default.shape({
393
+ current: (props, propName) => {
394
+ if (props[propName] == null) {
395
+ return null;
396
+ }
397
+ if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
398
+ return new Error(`Expected prop '${propName}' to be of type Element`);
399
+ }
400
+ return null;
401
+ }
402
+ }).isRequired,
403
+ /**
404
+ * @ignore
405
+ */
406
+ onEnter: _propTypes.default.func,
407
+ /**
408
+ * @ignore
409
+ */
410
+ onEntered: _propTypes.default.func,
411
+ /**
412
+ * @ignore
413
+ */
414
+ onEntering: _propTypes.default.func,
415
+ /**
416
+ * @ignore
417
+ */
418
+ onExit: _propTypes.default.func,
419
+ /**
420
+ * @ignore
421
+ */
422
+ onExited: _propTypes.default.func,
423
+ /**
424
+ * @ignore
425
+ */
426
+ onExiting: _propTypes.default.func,
427
+ /**
428
+ * @ignore
429
+ */
430
+ reduceMotion: _propTypes.default.bool,
431
+ /**
432
+ * @ignore
433
+ */
434
+ timeout: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.shape({
435
+ appear: _propTypes.default.number,
436
+ enter: _propTypes.default.number,
437
+ exit: _propTypes.default.number
438
+ })]),
439
+ /**
440
+ * @ignore
441
+ */
442
+ unmountOnExit: _propTypes.default.bool
443
+ } : void 0;
444
+ var _default = exports.default = Transition;