@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
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = shouldSkipGeneratingVar;
7
7
  function shouldSkipGeneratingVar(keys) {
8
- return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
8
+ return keys[0] === 'motion' || !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
9
9
  // ends with sxConfig
10
10
  keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
11
11
  }
@@ -1,5 +1,5 @@
1
1
  export default function shouldSkipGeneratingVar(keys) {
2
- return !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
2
+ return keys[0] === 'motion' || !!keys[0].match(/(cssVarPrefix|colorSchemeSelector|modularCssLayers|rootSelector|typography|mixins|breakpoints|direction|transitions)/) || !!keys[0].match(/sxConfig$/) ||
3
3
  // ends with sxConfig
4
4
  keys[0] === 'palette' && !!keys[1]?.match(/(mode|contrastThreshold|tonalOffset)/);
5
5
  }
@@ -55,6 +55,7 @@ function stringifyTheme(baseTheme = {}) {
55
55
  const theme = ${JSON.stringify(serializableTheme, null, 2)};
56
56
 
57
57
  theme.breakpoints = createBreakpoints(theme.breakpoints || {});
58
+ theme.motion = { reducedMotion: 'never', ...theme.motion };
58
59
  theme.transitions = createTransitions(theme.transitions || {});
59
60
 
60
61
  export default theme;`;
@@ -48,6 +48,7 @@ export function stringifyTheme(baseTheme = {}) {
48
48
  const theme = ${JSON.stringify(serializableTheme, null, 2)};
49
49
 
50
50
  theme.breakpoints = createBreakpoints(theme.breakpoints || {});
51
+ theme.motion = { reducedMotion: 'never', ...theme.motion };
51
52
  theme.transitions = createTransitions(theme.transitions || {});
52
53
 
53
54
  export default theme;`;
@@ -3,7 +3,7 @@ import { Components } from "./components.mjs";
3
3
  export interface ThemeWithProps {
4
4
  components?: Components<Omit<Theme, 'components'>> | undefined;
5
5
  }
6
- export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
6
+ export type ThemedProps<ThemeInput, Name extends keyof any> = ThemeInput extends {
7
7
  components: Record<Name, {
8
8
  defaultProps: infer Props;
9
9
  }>;
@@ -36,7 +36,7 @@ export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
36
36
  * @param params.props The input props
37
37
  * @param params.name The name of the component as defined in the theme
38
38
  */
39
- export default function useThemeProps<Theme extends ThemeWithProps, Props, Name extends keyof any>(params: {
39
+ export default function useThemeProps<ThemeInput extends ThemeWithProps, Props, Name extends keyof any>(params: {
40
40
  props: Props;
41
41
  name: Name;
42
- }): Props & ThemedProps<Theme, Name>;
42
+ }): Props & ThemedProps<ThemeInput, Name>;
@@ -3,7 +3,7 @@ import { Components } from "./components.js";
3
3
  export interface ThemeWithProps {
4
4
  components?: Components<Omit<Theme, 'components'>> | undefined;
5
5
  }
6
- export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
6
+ export type ThemedProps<ThemeInput, Name extends keyof any> = ThemeInput extends {
7
7
  components: Record<Name, {
8
8
  defaultProps: infer Props;
9
9
  }>;
@@ -36,7 +36,7 @@ export type ThemedProps<Theme, Name extends keyof any> = Theme extends {
36
36
  * @param params.props The input props
37
37
  * @param params.name The name of the component as defined in the theme
38
38
  */
39
- export default function useThemeProps<Theme extends ThemeWithProps, Props, Name extends keyof any>(params: {
39
+ export default function useThemeProps<ThemeInput extends ThemeWithProps, Props, Name extends keyof any>(params: {
40
40
  props: Props;
41
41
  name: Name;
42
- }): Props & ThemedProps<Theme, Name>;
42
+ }): Props & ThemedProps<ThemeInput, Name>;
@@ -1 +1 @@
1
- export * from "./transition.mjs";
1
+ export type { EasingProps, TransitionHandlerKeys, TransitionHandlerProps, TransitionKeys, TransitionProps } from "./types.mjs";
@@ -1 +1 @@
1
- export * from "./transition.js";
1
+ export type { EasingProps, TransitionHandlerKeys, TransitionHandlerProps, TransitionKeys, TransitionProps } from "./types.js";
@@ -2,15 +2,4 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
- });
6
- var _transition = require("./transition");
7
- Object.keys(_transition).forEach(function (key) {
8
- if (key === "default" || key === "__esModule") return;
9
- if (key in exports && exports[key] === _transition[key]) return;
10
- Object.defineProperty(exports, key, {
11
- enumerable: true,
12
- get: function () {
13
- return _transition[key];
14
- }
15
- });
16
5
  });
@@ -1 +1 @@
1
- export * from "./transition.mjs";
1
+ export {};
@@ -1,12 +1 @@
1
- import { TransitionProps as _TransitionProps, TransitionActions } from 'react-transition-group/Transition';
2
- import * as React from 'react';
3
- export type TransitionHandlerKeys = 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited';
4
- export type TransitionHandlerProps = Pick<_TransitionProps, TransitionHandlerKeys>;
5
- export interface EasingProps {
6
- easing: string | {
7
- enter?: string | undefined;
8
- exit?: string | undefined;
9
- };
10
- }
11
- export type TransitionKeys = 'in' | 'mountOnEnter' | 'unmountOnExit' | 'timeout' | 'easing' | 'addEndListener' | TransitionHandlerKeys;
12
- export interface TransitionProps extends TransitionActions, Partial<Pick<_TransitionProps & EasingProps, TransitionKeys>>, React.HTMLAttributes<HTMLElement> {}
1
+ export type { EasingProps, EnterHandler, ExitHandler, TransitionActions, TransitionHandlerKeys, TransitionHandlerProps, TransitionKeys, TransitionProps, TransitionStatus } from "./types.mjs";
@@ -1,12 +1 @@
1
- import { TransitionProps as _TransitionProps, TransitionActions } from 'react-transition-group/Transition';
2
- import * as React from 'react';
3
- export type TransitionHandlerKeys = 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited';
4
- export type TransitionHandlerProps = Pick<_TransitionProps, TransitionHandlerKeys>;
5
- export interface EasingProps {
6
- easing: string | {
7
- enter?: string | undefined;
8
- exit?: string | undefined;
9
- };
10
- }
11
- export type TransitionKeys = 'in' | 'mountOnEnter' | 'unmountOnExit' | 'timeout' | 'easing' | 'addEndListener' | TransitionHandlerKeys;
12
- export interface TransitionProps extends TransitionActions, Partial<Pick<_TransitionProps & EasingProps, TransitionKeys>>, React.HTMLAttributes<HTMLElement> {}
1
+ export type { EasingProps, EnterHandler, ExitHandler, TransitionActions, TransitionHandlerKeys, TransitionHandlerProps, TransitionKeys, TransitionProps, TransitionStatus } from "./types.js";
@@ -0,0 +1,73 @@
1
+ import * as React from 'react';
2
+ export type TransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited' | 'unmounted';
3
+ export interface TransitionActions {
4
+ appear?: boolean | undefined;
5
+ enter?: boolean | undefined;
6
+ exit?: boolean | undefined;
7
+ }
8
+ export type TransitionHandlerKeys = 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited';
9
+ export type EnterHandler = (node: HTMLElement, isAppearing: boolean) => void;
10
+ export type ExitHandler = (node: HTMLElement) => void;
11
+ export interface TransitionHandlerProps {
12
+ /**
13
+ * @ignore
14
+ */
15
+ onEnter?: EnterHandler | undefined;
16
+ /**
17
+ * @ignore
18
+ */
19
+ onEntering?: EnterHandler | undefined;
20
+ /**
21
+ * @ignore
22
+ */
23
+ onEntered?: EnterHandler | undefined;
24
+ /**
25
+ * @ignore
26
+ */
27
+ onExit?: ExitHandler | undefined;
28
+ /**
29
+ * @ignore
30
+ */
31
+ onExiting?: ExitHandler | undefined;
32
+ /**
33
+ * @ignore
34
+ */
35
+ onExited?: ExitHandler | undefined;
36
+ }
37
+ export interface EasingProps {
38
+ easing: string | {
39
+ enter?: string | undefined;
40
+ exit?: string | undefined;
41
+ };
42
+ }
43
+ export type TransitionKeys = 'in' | 'mountOnEnter' | 'unmountOnExit' | 'timeout' | 'easing' | 'addEndListener' | 'disablePrefersReducedMotion' | TransitionHandlerKeys;
44
+ interface ConsumerTransitionProps extends TransitionHandlerProps {
45
+ in?: boolean | undefined;
46
+ mountOnEnter?: boolean | undefined;
47
+ unmountOnExit?: boolean | undefined;
48
+ /**
49
+ * The duration for the transition, in milliseconds.
50
+ * You may specify a single timeout for all transitions, or individually with an object.
51
+ */
52
+ timeout?: number | {
53
+ appear?: number | undefined;
54
+ enter?: number | undefined;
55
+ exit?: number | undefined;
56
+ } | undefined;
57
+ /**
58
+ * Add a custom transition end trigger.
59
+ * Use it when you need custom logic to decide when the transition has ended.
60
+ * Note: Timeouts are still used as a fallback if provided.
61
+ *
62
+ * @param {HTMLElement} node The transitioning DOM node.
63
+ * @param {Function} done Call this when the transition has finished.
64
+ */
65
+ addEndListener?: ((node: HTMLElement, done: () => void) => void) | undefined;
66
+ /**
67
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
68
+ * @default false
69
+ */
70
+ disablePrefersReducedMotion?: boolean | undefined;
71
+ }
72
+ export interface TransitionProps extends TransitionActions, Partial<Pick<ConsumerTransitionProps & EasingProps, TransitionKeys>>, React.HTMLAttributes<HTMLElement> {}
73
+ export {};
@@ -0,0 +1,73 @@
1
+ import * as React from 'react';
2
+ export type TransitionStatus = 'entering' | 'entered' | 'exiting' | 'exited' | 'unmounted';
3
+ export interface TransitionActions {
4
+ appear?: boolean | undefined;
5
+ enter?: boolean | undefined;
6
+ exit?: boolean | undefined;
7
+ }
8
+ export type TransitionHandlerKeys = 'onEnter' | 'onEntering' | 'onEntered' | 'onExit' | 'onExiting' | 'onExited';
9
+ export type EnterHandler = (node: HTMLElement, isAppearing: boolean) => void;
10
+ export type ExitHandler = (node: HTMLElement) => void;
11
+ export interface TransitionHandlerProps {
12
+ /**
13
+ * @ignore
14
+ */
15
+ onEnter?: EnterHandler | undefined;
16
+ /**
17
+ * @ignore
18
+ */
19
+ onEntering?: EnterHandler | undefined;
20
+ /**
21
+ * @ignore
22
+ */
23
+ onEntered?: EnterHandler | undefined;
24
+ /**
25
+ * @ignore
26
+ */
27
+ onExit?: ExitHandler | undefined;
28
+ /**
29
+ * @ignore
30
+ */
31
+ onExiting?: ExitHandler | undefined;
32
+ /**
33
+ * @ignore
34
+ */
35
+ onExited?: ExitHandler | undefined;
36
+ }
37
+ export interface EasingProps {
38
+ easing: string | {
39
+ enter?: string | undefined;
40
+ exit?: string | undefined;
41
+ };
42
+ }
43
+ export type TransitionKeys = 'in' | 'mountOnEnter' | 'unmountOnExit' | 'timeout' | 'easing' | 'addEndListener' | 'disablePrefersReducedMotion' | TransitionHandlerKeys;
44
+ interface ConsumerTransitionProps extends TransitionHandlerProps {
45
+ in?: boolean | undefined;
46
+ mountOnEnter?: boolean | undefined;
47
+ unmountOnExit?: boolean | undefined;
48
+ /**
49
+ * The duration for the transition, in milliseconds.
50
+ * You may specify a single timeout for all transitions, or individually with an object.
51
+ */
52
+ timeout?: number | {
53
+ appear?: number | undefined;
54
+ enter?: number | undefined;
55
+ exit?: number | undefined;
56
+ } | undefined;
57
+ /**
58
+ * Add a custom transition end trigger.
59
+ * Use it when you need custom logic to decide when the transition has ended.
60
+ * Note: Timeouts are still used as a fallback if provided.
61
+ *
62
+ * @param {HTMLElement} node The transitioning DOM node.
63
+ * @param {Function} done Call this when the transition has finished.
64
+ */
65
+ addEndListener?: ((node: HTMLElement, done: () => void) => void) | undefined;
66
+ /**
67
+ * If `true`, the transition ignores `theme.motion.reducedMotion` and keeps its normal timing.
68
+ * @default false
69
+ */
70
+ disablePrefersReducedMotion?: boolean | undefined;
71
+ }
72
+ export interface TransitionProps extends TransitionActions, Partial<Pick<ConsumerTransitionProps & EasingProps, TransitionKeys>>, React.HTMLAttributes<HTMLElement> {}
73
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ReducedMotionMode } from "../styles/createMotion.mjs";
2
+ interface TransitionTiming {
3
+ duration: string | number;
4
+ delay: string | undefined;
5
+ }
6
+ /**
7
+ * Resolves whether a Material UI transition should reduce motion and provides
8
+ * adjusted CSS transition timing for MUI-owned duration/delay values.
9
+ */
10
+ export default function useReducedMotion(mode: ReducedMotionMode, disablePrefersReducedMotion: boolean | undefined): {
11
+ shouldReduceMotion: boolean;
12
+ getTransitionTiming(timing: TransitionTiming): TransitionTiming;
13
+ };
14
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { ReducedMotionMode } from "../styles/createMotion.js";
2
+ interface TransitionTiming {
3
+ duration: string | number;
4
+ delay: string | undefined;
5
+ }
6
+ /**
7
+ * Resolves whether a Material UI transition should reduce motion and provides
8
+ * adjusted CSS transition timing for MUI-owned duration/delay values.
9
+ */
10
+ export default function useReducedMotion(mode: ReducedMotionMode, disablePrefersReducedMotion: boolean | undefined): {
11
+ shouldReduceMotion: boolean;
12
+ getTransitionTiming(timing: TransitionTiming): TransitionTiming;
13
+ };
14
+ export {};
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
6
+ Object.defineProperty(exports, "__esModule", {
7
+ value: true
8
+ });
9
+ exports.default = useReducedMotion;
10
+ var React = _interopRequireWildcard(require("react"));
11
+ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
12
+ const MEDIA_QUERY = '(prefers-reduced-motion: reduce)';
13
+ const REDUCED_MOTION_DURATION = 0;
14
+ const REDUCED_MOTION_DELAY = '0ms';
15
+ const NOOP = () => {};
16
+ const getDefaultSnapshot = () => false;
17
+ const getReducedMotionSnapshot = () => true;
18
+ const subscribeNoop = () => NOOP;
19
+ /**
20
+ * Subscribes to the OS reduced-motion media query only when the theme mode needs it.
21
+ * React 17 reads the media query after mount, matching useMediaQuery's fallback path.
22
+ */
23
+ function useReducedMotionMediaQueryOld(enabled) {
24
+ const [queryState, setQueryState] = React.useState(() => ({
25
+ enabled,
26
+ matches: enabled ? null : false
27
+ }));
28
+ let matches = queryState.matches;
29
+ if (queryState.enabled !== enabled) {
30
+ matches = null;
31
+ if (!enabled) {
32
+ matches = false;
33
+ }
34
+ }
35
+ (0, _useEnhancedEffect.default)(() => {
36
+ const setResolvedMatches = nextMatches => {
37
+ setQueryState(previousState => {
38
+ if (previousState.enabled === enabled && previousState.matches === nextMatches) {
39
+ return previousState;
40
+ }
41
+ return {
42
+ enabled,
43
+ matches: nextMatches
44
+ };
45
+ });
46
+ };
47
+ if (!enabled) {
48
+ if (queryState.enabled) {
49
+ setResolvedMatches(false);
50
+ }
51
+ return undefined;
52
+ }
53
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
54
+ setResolvedMatches(false);
55
+ return undefined;
56
+ }
57
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
58
+ const update = () => {
59
+ setResolvedMatches(mediaQueryList.matches);
60
+ };
61
+ update();
62
+ mediaQueryList.addEventListener('change', update);
63
+ return () => {
64
+ mediaQueryList.removeEventListener('change', update);
65
+ };
66
+ }, [enabled, queryState.enabled]);
67
+ return matches;
68
+ }
69
+
70
+ // See https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379 for why
71
+ const safeReact = {
72
+ ...React
73
+ };
74
+ const maybeReactUseSyncExternalStore = safeReact.useSyncExternalStore;
75
+
76
+ /**
77
+ * React 18+ can read the media query during client renders, so newly mounted
78
+ * transitions do not start from the SSR-safe reduced-motion default.
79
+ */
80
+ function useReducedMotionMediaQueryNew(enabled) {
81
+ const getServerSnapshot = enabled ? getReducedMotionSnapshot : getDefaultSnapshot;
82
+ const [getSnapshot, subscribe] = React.useMemo(() => {
83
+ if (!enabled || typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
84
+ return [getDefaultSnapshot, subscribeNoop];
85
+ }
86
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
87
+ return [() => mediaQueryList.matches, notify => {
88
+ mediaQueryList.addEventListener('change', notify);
89
+ return () => {
90
+ mediaQueryList.removeEventListener('change', notify);
91
+ };
92
+ }];
93
+ }, [enabled]);
94
+ return maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
95
+ }
96
+ const useReducedMotionMediaQuery = maybeReactUseSyncExternalStore !== undefined ? useReducedMotionMediaQueryNew : useReducedMotionMediaQueryOld;
97
+
98
+ /**
99
+ * Resolves whether a Material UI transition should reduce motion and provides
100
+ * adjusted CSS transition timing for MUI-owned duration/delay values.
101
+ */
102
+ function useReducedMotion(mode, disablePrefersReducedMotion) {
103
+ const prefersReducedMotion = useReducedMotionMediaQuery(!disablePrefersReducedMotion && mode === 'system');
104
+ const shouldReduceMotion = !disablePrefersReducedMotion && (mode === 'always' || mode === 'system' && prefersReducedMotion !== false);
105
+ return React.useMemo(() => ({
106
+ shouldReduceMotion,
107
+ getTransitionTiming(timing) {
108
+ if (!shouldReduceMotion) {
109
+ return timing;
110
+ }
111
+ return {
112
+ duration: REDUCED_MOTION_DURATION,
113
+ delay: REDUCED_MOTION_DELAY
114
+ };
115
+ }
116
+ }), [shouldReduceMotion]);
117
+ }
@@ -0,0 +1,110 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
5
+ const MEDIA_QUERY = '(prefers-reduced-motion: reduce)';
6
+ const REDUCED_MOTION_DURATION = 0;
7
+ const REDUCED_MOTION_DELAY = '0ms';
8
+ const NOOP = () => {};
9
+ const getDefaultSnapshot = () => false;
10
+ const getReducedMotionSnapshot = () => true;
11
+ const subscribeNoop = () => NOOP;
12
+ /**
13
+ * Subscribes to the OS reduced-motion media query only when the theme mode needs it.
14
+ * React 17 reads the media query after mount, matching useMediaQuery's fallback path.
15
+ */
16
+ function useReducedMotionMediaQueryOld(enabled) {
17
+ const [queryState, setQueryState] = React.useState(() => ({
18
+ enabled,
19
+ matches: enabled ? null : false
20
+ }));
21
+ let matches = queryState.matches;
22
+ if (queryState.enabled !== enabled) {
23
+ matches = null;
24
+ if (!enabled) {
25
+ matches = false;
26
+ }
27
+ }
28
+ useEnhancedEffect(() => {
29
+ const setResolvedMatches = nextMatches => {
30
+ setQueryState(previousState => {
31
+ if (previousState.enabled === enabled && previousState.matches === nextMatches) {
32
+ return previousState;
33
+ }
34
+ return {
35
+ enabled,
36
+ matches: nextMatches
37
+ };
38
+ });
39
+ };
40
+ if (!enabled) {
41
+ if (queryState.enabled) {
42
+ setResolvedMatches(false);
43
+ }
44
+ return undefined;
45
+ }
46
+ if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
47
+ setResolvedMatches(false);
48
+ return undefined;
49
+ }
50
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
51
+ const update = () => {
52
+ setResolvedMatches(mediaQueryList.matches);
53
+ };
54
+ update();
55
+ mediaQueryList.addEventListener('change', update);
56
+ return () => {
57
+ mediaQueryList.removeEventListener('change', update);
58
+ };
59
+ }, [enabled, queryState.enabled]);
60
+ return matches;
61
+ }
62
+
63
+ // See https://github.com/mui/material-ui/issues/41190#issuecomment-2040873379 for why
64
+ const safeReact = {
65
+ ...React
66
+ };
67
+ const maybeReactUseSyncExternalStore = safeReact.useSyncExternalStore;
68
+
69
+ /**
70
+ * React 18+ can read the media query during client renders, so newly mounted
71
+ * transitions do not start from the SSR-safe reduced-motion default.
72
+ */
73
+ function useReducedMotionMediaQueryNew(enabled) {
74
+ const getServerSnapshot = enabled ? getReducedMotionSnapshot : getDefaultSnapshot;
75
+ const [getSnapshot, subscribe] = React.useMemo(() => {
76
+ if (!enabled || typeof window === 'undefined' || typeof window.matchMedia !== 'function') {
77
+ return [getDefaultSnapshot, subscribeNoop];
78
+ }
79
+ const mediaQueryList = window.matchMedia(MEDIA_QUERY);
80
+ return [() => mediaQueryList.matches, notify => {
81
+ mediaQueryList.addEventListener('change', notify);
82
+ return () => {
83
+ mediaQueryList.removeEventListener('change', notify);
84
+ };
85
+ }];
86
+ }, [enabled]);
87
+ return maybeReactUseSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
88
+ }
89
+ const useReducedMotionMediaQuery = maybeReactUseSyncExternalStore !== undefined ? useReducedMotionMediaQueryNew : useReducedMotionMediaQueryOld;
90
+
91
+ /**
92
+ * Resolves whether a Material UI transition should reduce motion and provides
93
+ * adjusted CSS transition timing for MUI-owned duration/delay values.
94
+ */
95
+ export default function useReducedMotion(mode, disablePrefersReducedMotion) {
96
+ const prefersReducedMotion = useReducedMotionMediaQuery(!disablePrefersReducedMotion && mode === 'system');
97
+ const shouldReduceMotion = !disablePrefersReducedMotion && (mode === 'always' || mode === 'system' && prefersReducedMotion !== false);
98
+ return React.useMemo(() => ({
99
+ shouldReduceMotion,
100
+ getTransitionTiming(timing) {
101
+ if (!shouldReduceMotion) {
102
+ return timing;
103
+ }
104
+ return {
105
+ duration: REDUCED_MOTION_DURATION,
106
+ delay: REDUCED_MOTION_DELAY
107
+ };
108
+ }
109
+ }), [shouldReduceMotion]);
110
+ }
@@ -1,4 +1,6 @@
1
1
  import * as React from 'react';
2
+ import { defaultStyles } from "../styles/reducedMotion.mjs";
3
+ import type { ReducedMotionMode } from "../styles/createMotion.mjs";
2
4
  export declare const reflow: (node: Element) => number;
3
5
  interface ComponentProps {
4
6
  easing: string | {
@@ -19,12 +21,59 @@ interface TransitionProps {
19
21
  easing: string | undefined;
20
22
  delay: string | undefined;
21
23
  }
24
+ interface TransitionCreateOptions {
25
+ duration: number | string;
26
+ easing: string;
27
+ delay: number | string;
28
+ }
29
+ interface TranslateOffset {
30
+ offsetX: number;
31
+ offsetY: number;
32
+ }
33
+ /**
34
+ * Extracts the x/y translation from a CSS transform string.
35
+ *
36
+ * Transition components use these offsets when calculating off-screen positions:
37
+ * if an element is already translated, the distance needed to hide it must start
38
+ * from that visual position instead of its untransformed layout position.
39
+ *
40
+ * CSSOM commonly serializes translations as matrix() or matrix3d(), while inline
41
+ * gesture styles may use translate(), translate3d(), translateX(), or
42
+ * translateY(). This helper normalizes those supported forms into numeric pixel
43
+ * offsets and returns zero offsets for empty, none, or unsupported transforms.
44
+ */
45
+ export declare function getTranslateOffsets(transform: string | undefined): TranslateOffset;
22
46
  export declare function normalizedTransitionCallback(nodeRef: React.RefObject<HTMLElement | null>, callback: ((node: HTMLElement, isAppearing?: boolean) => void) | undefined): (maybeIsAppearing?: boolean) => void;
23
47
  type TransitionState = 'entering' | 'entered' | 'exiting' | 'exited';
24
48
  /**
25
- * Computes the child style for a transition component, reusing existing
26
- * references when possible to preserve referential equality for React.memo.
49
+ * Return the child style for a transition. Reuse predefined style objects when
50
+ * no custom styles are present so memoized children see the same object.
27
51
  */
28
52
  export declare function getTransitionChildStyle(state: TransitionState, inProp: boolean | undefined, baseStyles: Record<string, React.CSSProperties>, hiddenStyles: React.CSSProperties, styleProp: React.CSSProperties | undefined, childStyle: React.CSSProperties | undefined): React.CSSProperties | undefined;
29
53
  export declare function getTransitionProps(props: ComponentProps, options: Options): TransitionProps;
54
+ /**
55
+ * Returns CSS that disables component-owned transitions when reduced motion is active.
56
+ * Pass custom styles only when the default `transition: none` reset is not enough.
57
+ */
58
+ export declare function getReducedMotionStyles<Styles extends object = typeof defaultStyles>(theme: {
59
+ motion?: {
60
+ reducedMotion?: ReducedMotionMode | undefined;
61
+ } | undefined;
62
+ }, styles?: Styles): Styles | {
63
+ '@media (prefers-reduced-motion: reduce)': Styles;
64
+ } | null;
65
+ export declare function getTransitionStyles(theme: {
66
+ transitions?: {
67
+ create: (props?: string | string[], options?: Partial<TransitionCreateOptions>) => string;
68
+ } | undefined;
69
+ motion?: {
70
+ reducedMotion?: ReducedMotionMode | undefined;
71
+ } | undefined;
72
+ }, props?: string | string[], options?: Partial<TransitionCreateOptions>): React.CSSProperties | {
73
+ transition: string;
74
+ } | {
75
+ '@media (prefers-reduced-motion: reduce)': {
76
+ transition: string;
77
+ };
78
+ };
30
79
  export {};