@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
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps } from '@mui/system';
3
3
  import { FadeProps } from "../Fade/index.js";
4
- import { TransitionProps } from "../transitions/transition.js";
4
+ import { TransitionProps } from "../transitions/types.js";
5
5
  import { Theme } from "../styles/index.js";
6
6
  import { BackdropClasses } from "./backdropClasses.js";
7
7
  import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.js";
@@ -14,7 +14,7 @@ export interface BackdropSlots {
14
14
  root: React.ElementType;
15
15
  /**
16
16
  * The component that renders the transition.
17
- * [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
17
+ * [Follow this guide](/material-ui/transitions/#transition-slots) to learn more about the requirements for this component.
18
18
  * @default Fade
19
19
  */
20
20
  transition: React.ElementType;
package/Badge/Badge.js CHANGED
@@ -20,6 +20,7 @@ var _DefaultPropsProvider = require("../DefaultPropsProvider");
20
20
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
21
21
  var _badgeClasses = _interopRequireWildcard(require("./badgeClasses"));
22
22
  var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
23
+ var _utils = require("../transitions/utils");
23
24
  var _jsxRuntime = require("react/jsx-runtime");
24
25
  const RADIUS_STANDARD = 10;
25
26
  const RADIUS_DOT = 4;
@@ -78,7 +79,10 @@ const BadgeBadge = (0, _zeroStyled.styled)('span', {
78
79
  borderRadius: RADIUS_STANDARD,
79
80
  zIndex: 1,
80
81
  // Render the badge on top of potential ripples.
81
- transition: theme.transitions.create('transform', {
82
+ '@media (forced-colors: active)': {
83
+ border: '1px solid ButtonBorder'
84
+ },
85
+ ...(0, _utils.getTransitionStyles)(theme, 'transform', {
82
86
  easing: theme.transitions.easing.easeInOut,
83
87
  duration: theme.transitions.duration.enteringScreen
84
88
  }),
@@ -105,33 +109,19 @@ const BadgeBadge = (0, _zeroStyled.styled)('span', {
105
109
  invisible: true
106
110
  },
107
111
  style: {
108
- transition: theme.transitions.create('transform', {
112
+ ...(0, _utils.getTransitionStyles)(theme, 'transform', {
109
113
  easing: theme.transitions.easing.easeInOut,
110
114
  duration: theme.transitions.duration.leavingScreen
111
115
  })
112
116
  }
113
117
  }, {
114
- style: ({
115
- ownerState
116
- }) => {
117
- const {
118
- vertical,
119
- horizontal
120
- } = ownerState.anchorOrigin;
121
- const offset = ownerState.overlap === 'circular' ? '14%' : 0;
122
- return {
123
- '--Badge-translateX': horizontal === 'right' ? '50%' : '-50%',
124
- '--Badge-translateY': vertical === 'top' ? '-50%' : '50%',
125
- top: vertical === 'top' ? offset : 'initial',
126
- bottom: vertical === 'bottom' ? offset : 'initial',
127
- right: horizontal === 'right' ? offset : 'initial',
128
- left: horizontal === 'left' ? offset : 'initial',
129
- transform: 'scale(1) translate(var(--Badge-translateX), var(--Badge-translateY))',
130
- transformOrigin: `${horizontal === 'right' ? '100%' : '0%'} ${vertical === 'top' ? '0%' : '100%'}`,
131
- [`&.${_badgeClasses.default.invisible}`]: {
132
- transform: 'scale(0) translate(var(--Badge-translateX), var(--Badge-translateY))'
133
- }
134
- };
118
+ style: {
119
+ inset: 'var(--Badge-inset)',
120
+ transform: 'scale(1) translate(var(--Badge-translate))',
121
+ transformOrigin: 'var(--Badge-origin)',
122
+ [`&.${_badgeClasses.default.invisible}`]: {
123
+ transform: 'scale(0) translate(var(--Badge-translate))'
124
+ }
135
125
  }
136
126
  }]
137
127
  })));
@@ -220,11 +210,28 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
220
210
  as: component
221
211
  }
222
212
  });
213
+ const {
214
+ vertical,
215
+ horizontal
216
+ } = anchorOrigin;
217
+ const offset = overlap === 'circular' ? '14%' : '0';
218
+ const top = vertical === 'top' ? offset : 'auto';
219
+ const bottom = vertical === 'bottom' ? offset : 'auto';
220
+ const right = horizontal === 'right' ? offset : 'auto';
221
+ const left = horizontal === 'left' ? offset : 'auto';
223
222
  const [BadgeSlot, badgeProps] = (0, _useSlot.default)('badge', {
224
223
  elementType: BadgeBadge,
225
224
  externalForwardedProps,
226
225
  ownerState,
227
- className: classes.badge
226
+ className: classes.badge,
227
+ additionalProps: {
228
+ 'aria-hidden': true,
229
+ style: {
230
+ '--Badge-translate': `${horizontal === 'right' ? '50%' : '-50%'}, ${vertical === 'top' ? '-50%' : '50%'}`,
231
+ '--Badge-inset': `${top} ${right} ${bottom} ${left}`,
232
+ '--Badge-origin': `${horizontal === 'right' ? '100%' : '0%'} ${vertical === 'top' ? '0%' : '100%'}`
233
+ }
234
+ }
228
235
  });
229
236
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
230
237
  ...rootProps,
package/Badge/Badge.mjs CHANGED
@@ -13,6 +13,7 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
13
13
  import capitalize from "../utils/capitalize.mjs";
14
14
  import badgeClasses, { getBadgeUtilityClass } from "./badgeClasses.mjs";
15
15
  import useSlot from "../utils/useSlot.mjs";
16
+ import { getTransitionStyles } from "../transitions/utils.mjs";
16
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
18
  const RADIUS_STANDARD = 10;
18
19
  const RADIUS_DOT = 4;
@@ -71,7 +72,10 @@ const BadgeBadge = styled('span', {
71
72
  borderRadius: RADIUS_STANDARD,
72
73
  zIndex: 1,
73
74
  // Render the badge on top of potential ripples.
74
- transition: theme.transitions.create('transform', {
75
+ '@media (forced-colors: active)': {
76
+ border: '1px solid ButtonBorder'
77
+ },
78
+ ...getTransitionStyles(theme, 'transform', {
75
79
  easing: theme.transitions.easing.easeInOut,
76
80
  duration: theme.transitions.duration.enteringScreen
77
81
  }),
@@ -98,33 +102,19 @@ const BadgeBadge = styled('span', {
98
102
  invisible: true
99
103
  },
100
104
  style: {
101
- transition: theme.transitions.create('transform', {
105
+ ...getTransitionStyles(theme, 'transform', {
102
106
  easing: theme.transitions.easing.easeInOut,
103
107
  duration: theme.transitions.duration.leavingScreen
104
108
  })
105
109
  }
106
110
  }, {
107
- style: ({
108
- ownerState
109
- }) => {
110
- const {
111
- vertical,
112
- horizontal
113
- } = ownerState.anchorOrigin;
114
- const offset = ownerState.overlap === 'circular' ? '14%' : 0;
115
- return {
116
- '--Badge-translateX': horizontal === 'right' ? '50%' : '-50%',
117
- '--Badge-translateY': vertical === 'top' ? '-50%' : '50%',
118
- top: vertical === 'top' ? offset : 'initial',
119
- bottom: vertical === 'bottom' ? offset : 'initial',
120
- right: horizontal === 'right' ? offset : 'initial',
121
- left: horizontal === 'left' ? offset : 'initial',
122
- transform: 'scale(1) translate(var(--Badge-translateX), var(--Badge-translateY))',
123
- transformOrigin: `${horizontal === 'right' ? '100%' : '0%'} ${vertical === 'top' ? '0%' : '100%'}`,
124
- [`&.${badgeClasses.invisible}`]: {
125
- transform: 'scale(0) translate(var(--Badge-translateX), var(--Badge-translateY))'
126
- }
127
- };
111
+ style: {
112
+ inset: 'var(--Badge-inset)',
113
+ transform: 'scale(1) translate(var(--Badge-translate))',
114
+ transformOrigin: 'var(--Badge-origin)',
115
+ [`&.${badgeClasses.invisible}`]: {
116
+ transform: 'scale(0) translate(var(--Badge-translate))'
117
+ }
128
118
  }
129
119
  }]
130
120
  })));
@@ -213,11 +203,28 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
213
203
  as: component
214
204
  }
215
205
  });
206
+ const {
207
+ vertical,
208
+ horizontal
209
+ } = anchorOrigin;
210
+ const offset = overlap === 'circular' ? '14%' : '0';
211
+ const top = vertical === 'top' ? offset : 'auto';
212
+ const bottom = vertical === 'bottom' ? offset : 'auto';
213
+ const right = horizontal === 'right' ? offset : 'auto';
214
+ const left = horizontal === 'left' ? offset : 'auto';
216
215
  const [BadgeSlot, badgeProps] = useSlot('badge', {
217
216
  elementType: BadgeBadge,
218
217
  externalForwardedProps,
219
218
  ownerState,
220
- className: classes.badge
219
+ className: classes.badge,
220
+ additionalProps: {
221
+ 'aria-hidden': true,
222
+ style: {
223
+ '--Badge-translate': `${horizontal === 'right' ? '50%' : '-50%'}, ${vertical === 'top' ? '-50%' : '50%'}`,
224
+ '--Badge-inset': `${top} ${right} ${bottom} ${left}`,
225
+ '--Badge-origin': `${horizontal === 'right' ? '100%' : '0%'} ${vertical === 'top' ? '0%' : '100%'}`
226
+ }
227
+ }
221
228
  });
222
229
  return /*#__PURE__*/_jsxs(RootSlot, {
223
230
  ...rootProps,
@@ -16,6 +16,7 @@ var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
16
16
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
17
17
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
18
18
  var _unsupportedProp = _interopRequireDefault(require("../utils/unsupportedProp"));
19
+ var _utils = require("../transitions/utils");
19
20
  var _bottomNavigationActionClasses = _interopRequireWildcard(require("./bottomNavigationActionClasses"));
20
21
  var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
21
22
  var _jsxRuntime = require("react/jsx-runtime");
@@ -43,7 +44,7 @@ const BottomNavigationActionRoot = (0, _zeroStyled.styled)(_ButtonBase.default,
43
44
  })((0, _memoTheme.default)(({
44
45
  theme
45
46
  }) => ({
46
- transition: theme.transitions.create(['color', 'padding-top'], {
47
+ ...(0, _utils.getTransitionStyles)(theme, ['color', 'padding-top'], {
47
48
  duration: theme.transitions.duration.short
48
49
  }),
49
50
  padding: '0px 12px',
@@ -83,7 +84,10 @@ const BottomNavigationActionLabel = (0, _zeroStyled.styled)('span', {
83
84
  fontFamily: theme.typography.fontFamily,
84
85
  fontSize: theme.typography.pxToRem(12),
85
86
  opacity: 1,
86
- transition: 'font-size 0.2s, opacity 0.2s',
87
+ ...(0, _utils.getTransitionStyles)(theme, ['font-size', 'opacity'], {
88
+ duration: '0.2s',
89
+ easing: 'ease'
90
+ }),
87
91
  transitionDelay: '0.1s',
88
92
  [`&.${_bottomNavigationActionClasses.default.selected}`]: {
89
93
  fontSize: theme.typography.pxToRem(14)
@@ -9,6 +9,7 @@ import memoTheme from "../utils/memoTheme.mjs";
9
9
  import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
10
10
  import ButtonBase from "../ButtonBase/index.mjs";
11
11
  import unsupportedProp from "../utils/unsupportedProp.mjs";
12
+ import { getTransitionStyles } from "../transitions/utils.mjs";
12
13
  import bottomNavigationActionClasses, { getBottomNavigationActionUtilityClass } from "./bottomNavigationActionClasses.mjs";
13
14
  import useSlot from "../utils/useSlot.mjs";
14
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -36,7 +37,7 @@ const BottomNavigationActionRoot = styled(ButtonBase, {
36
37
  })(memoTheme(({
37
38
  theme
38
39
  }) => ({
39
- transition: theme.transitions.create(['color', 'padding-top'], {
40
+ ...getTransitionStyles(theme, ['color', 'padding-top'], {
40
41
  duration: theme.transitions.duration.short
41
42
  }),
42
43
  padding: '0px 12px',
@@ -76,7 +77,10 @@ const BottomNavigationActionLabel = styled('span', {
76
77
  fontFamily: theme.typography.fontFamily,
77
78
  fontSize: theme.typography.pxToRem(12),
78
79
  opacity: 1,
79
- transition: 'font-size 0.2s, opacity 0.2s',
80
+ ...getTransitionStyles(theme, ['font-size', 'opacity'], {
81
+ duration: '0.2s',
82
+ easing: 'ease'
83
+ }),
80
84
  transitionDelay: '0.1s',
81
85
  [`&.${bottomNavigationActionClasses.selected}`]: {
82
86
  fontSize: theme.typography.pxToRem(14)
package/Button/Button.js CHANGED
@@ -24,6 +24,7 @@ var _createSimplePaletteValueFilter = _interopRequireDefault(require("../utils/c
24
24
  var _buttonClasses = _interopRequireWildcard(require("./buttonClasses"));
25
25
  var _ButtonGroupContext = _interopRequireDefault(require("../ButtonGroup/ButtonGroupContext"));
26
26
  var _ButtonGroupButtonContext = _interopRequireDefault(require("../ButtonGroup/ButtonGroupButtonContext"));
27
+ var _utils2 = require("../transitions/utils");
27
28
  var _jsxRuntime = require("react/jsx-runtime");
28
29
  const useUtilityClasses = ownerState => {
29
30
  const {
@@ -99,7 +100,7 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
99
100
  padding: '6px 16px',
100
101
  border: 0,
101
102
  borderRadius: (theme.vars || theme).shape.borderRadius,
102
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
103
+ ...(0, _utils2.getTransitionStyles)(theme, ['background-color', 'box-shadow', 'border-color', 'color'], {
103
104
  duration: theme.transitions.duration.short
104
105
  }),
105
106
  '&:hover': {
@@ -278,7 +279,7 @@ const ButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
278
279
  loadingPosition: 'center'
279
280
  },
280
281
  style: {
281
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
282
+ ...(0, _utils2.getTransitionStyles)(theme, ['background-color', 'box-shadow', 'border-color'], {
282
283
  duration: theme.transitions.duration.short
283
284
  }),
284
285
  [`&.${_buttonClasses.default.loading}`]: {
@@ -301,8 +302,14 @@ const ButtonStartIcon = (0, _zeroStyled.styled)('span', {
301
302
  theme
302
303
  }) => ({
303
304
  display: 'inherit',
305
+ alignItems: 'center',
304
306
  marginRight: 8,
305
307
  marginLeft: -4,
308
+ '&::before': {
309
+ content: '"\\200b"',
310
+ width: 0,
311
+ overflow: 'hidden'
312
+ },
306
313
  variants: [{
307
314
  props: {
308
315
  size: 'small'
@@ -316,7 +323,7 @@ const ButtonStartIcon = (0, _zeroStyled.styled)('span', {
316
323
  loading: true
317
324
  },
318
325
  style: {
319
- transition: theme.transitions.create(['opacity'], {
326
+ ...(0, _utils2.getTransitionStyles)(theme, ['opacity'], {
320
327
  duration: theme.transitions.duration.short
321
328
  }),
322
329
  opacity: 0
@@ -360,7 +367,7 @@ const ButtonEndIcon = (0, _zeroStyled.styled)('span', {
360
367
  loading: true
361
368
  },
362
369
  style: {
363
- transition: theme.transitions.create(['opacity'], {
370
+ ...(0, _utils2.getTransitionStyles)(theme, ['opacity'], {
364
371
  duration: theme.transitions.duration.short
365
372
  }),
366
373
  opacity: 0
@@ -558,6 +565,12 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
558
565
  children: loadingIndicator
559
566
  })
560
567
  }) : null;
568
+
569
+ // Don't forward the 'root' classes to the ButtonBase, as they will get duplicated with the one passed to the className prop.
570
+ const {
571
+ root,
572
+ ...forwardedClasses
573
+ } = classes;
561
574
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(ButtonRoot, {
562
575
  ownerState: ownerState,
563
576
  className: (0, _clsx.default)(contextProps.className, classes.root, className, positionClassName),
@@ -570,7 +583,7 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
570
583
  type: type,
571
584
  id: loading ? loadingId : idProp,
572
585
  ...other,
573
- classes: classes,
586
+ classes: forwardedClasses,
574
587
  children: [startIcon, loadingPosition !== 'end' && loader, children, loadingPosition === 'end' && loader, endIcon]
575
588
  });
576
589
  });
@@ -683,7 +696,7 @@ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */
683
696
  /**
684
697
  * @ignore
685
698
  */
686
- type: _propTypes.default.oneOfType([_propTypes.default.oneOf(['button', 'reset', 'submit']), _propTypes.default.string]),
699
+ type: _propTypes.default.string,
687
700
  /**
688
701
  * The variant to use.
689
702
  * @default 'text'
package/Button/Button.mjs CHANGED
@@ -17,6 +17,7 @@ import createSimplePaletteValueFilter from "../utils/createSimplePaletteValueFil
17
17
  import buttonClasses, { getButtonUtilityClass } from "./buttonClasses.mjs";
18
18
  import ButtonGroupContext from "../ButtonGroup/ButtonGroupContext.mjs";
19
19
  import ButtonGroupButtonContext from "../ButtonGroup/ButtonGroupButtonContext.mjs";
20
+ import { getTransitionStyles } from "../transitions/utils.mjs";
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
22
  const useUtilityClasses = ownerState => {
22
23
  const {
@@ -92,7 +93,7 @@ const ButtonRoot = styled(ButtonBase, {
92
93
  padding: '6px 16px',
93
94
  border: 0,
94
95
  borderRadius: (theme.vars || theme).shape.borderRadius,
95
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
96
+ ...getTransitionStyles(theme, ['background-color', 'box-shadow', 'border-color', 'color'], {
96
97
  duration: theme.transitions.duration.short
97
98
  }),
98
99
  '&:hover': {
@@ -271,7 +272,7 @@ const ButtonRoot = styled(ButtonBase, {
271
272
  loadingPosition: 'center'
272
273
  },
273
274
  style: {
274
- transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
275
+ ...getTransitionStyles(theme, ['background-color', 'box-shadow', 'border-color'], {
275
276
  duration: theme.transitions.duration.short
276
277
  }),
277
278
  [`&.${buttonClasses.loading}`]: {
@@ -294,8 +295,14 @@ const ButtonStartIcon = styled('span', {
294
295
  theme
295
296
  }) => ({
296
297
  display: 'inherit',
298
+ alignItems: 'center',
297
299
  marginRight: 8,
298
300
  marginLeft: -4,
301
+ '&::before': {
302
+ content: '"\\200b"',
303
+ width: 0,
304
+ overflow: 'hidden'
305
+ },
299
306
  variants: [{
300
307
  props: {
301
308
  size: 'small'
@@ -309,7 +316,7 @@ const ButtonStartIcon = styled('span', {
309
316
  loading: true
310
317
  },
311
318
  style: {
312
- transition: theme.transitions.create(['opacity'], {
319
+ ...getTransitionStyles(theme, ['opacity'], {
313
320
  duration: theme.transitions.duration.short
314
321
  }),
315
322
  opacity: 0
@@ -353,7 +360,7 @@ const ButtonEndIcon = styled('span', {
353
360
  loading: true
354
361
  },
355
362
  style: {
356
- transition: theme.transitions.create(['opacity'], {
363
+ ...getTransitionStyles(theme, ['opacity'], {
357
364
  duration: theme.transitions.duration.short
358
365
  }),
359
366
  opacity: 0
@@ -551,6 +558,12 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
551
558
  children: loadingIndicator
552
559
  })
553
560
  }) : null;
561
+
562
+ // Don't forward the 'root' classes to the ButtonBase, as they will get duplicated with the one passed to the className prop.
563
+ const {
564
+ root,
565
+ ...forwardedClasses
566
+ } = classes;
554
567
  return /*#__PURE__*/_jsxs(ButtonRoot, {
555
568
  ownerState: ownerState,
556
569
  className: clsx(contextProps.className, classes.root, className, positionClassName),
@@ -563,7 +576,7 @@ const Button = /*#__PURE__*/React.forwardRef(function Button(inProps, ref) {
563
576
  type: type,
564
577
  id: loading ? loadingId : idProp,
565
578
  ...other,
566
- classes: classes,
579
+ classes: forwardedClasses,
567
580
  children: [startIcon, loadingPosition !== 'end' && loader, children, loadingPosition === 'end' && loader, endIcon]
568
581
  });
569
582
  });
@@ -676,7 +689,7 @@ process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */
676
689
  /**
677
690
  * @ignore
678
691
  */
679
- type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string]),
692
+ type: PropTypes.string,
680
693
  /**
681
694
  * The variant to use.
682
695
  * @default 'text'
@@ -88,6 +88,13 @@ export interface ButtonBaseOwnProps {
88
88
  * A ref that points to the `TouchRipple` element.
89
89
  */
90
90
  touchRippleRef?: React.Ref<TouchRippleActions> | undefined;
91
+ /**
92
+ * The HTML [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type)
93
+ * attribute applied to `button` and `a` elements.
94
+ * Ignored when rendering non-native buttons.
95
+ * @default 'button'
96
+ */
97
+ type?: string | undefined;
91
98
  }
92
99
  export interface ButtonBaseTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'button'> {
93
100
  props: AdditionalProps & ButtonBaseOwnProps;
@@ -88,6 +88,13 @@ export interface ButtonBaseOwnProps {
88
88
  * A ref that points to the `TouchRipple` element.
89
89
  */
90
90
  touchRippleRef?: React.Ref<TouchRippleActions> | undefined;
91
+ /**
92
+ * The HTML [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type)
93
+ * attribute applied to `button` and `a` elements.
94
+ * Ignored when rendering non-native buttons.
95
+ * @default 'button'
96
+ */
97
+ type?: string | undefined;
91
98
  }
92
99
  export interface ButtonBaseTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'button'> {
93
100
  props: AdditionalProps & ButtonBaseOwnProps;
@@ -464,8 +464,11 @@ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes
464
464
  })
465
465
  })]),
466
466
  /**
467
- * @ignore
467
+ * The HTML [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type)
468
+ * attribute applied to `button` and `a` elements.
469
+ * Ignored when rendering non-native buttons.
470
+ * @default 'button'
468
471
  */
469
- type: _propTypes.default.oneOfType([_propTypes.default.oneOf(['button', 'reset', 'submit']), _propTypes.default.string])
472
+ type: _propTypes.default.string
470
473
  } : void 0;
471
474
  var _default = exports.default = ButtonBase;
@@ -457,8 +457,11 @@ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes
457
457
  })
458
458
  })]),
459
459
  /**
460
- * @ignore
460
+ * The HTML [`type`](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/button#type)
461
+ * attribute applied to `button` and `a` elements.
462
+ * Ignored when rendering non-native buttons.
463
+ * @default 'button'
461
464
  */
462
- type: PropTypes.oneOfType([PropTypes.oneOf(['button', 'reset', 'submit']), PropTypes.string])
465
+ type: PropTypes.string
463
466
  } : void 0;
464
467
  export default ButtonBase;
@@ -10,6 +10,7 @@ exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _clsx = _interopRequireDefault(require("clsx"));
13
+ var _useTimeout = _interopRequireDefault(require("@mui/utils/useTimeout"));
13
14
  var _jsxRuntime = require("react/jsx-runtime");
14
15
  /**
15
16
  * @ignore - internal component.
@@ -26,6 +27,11 @@ var _jsxRuntime = require("react/jsx-runtime");
26
27
  timeout
27
28
  } = props;
28
29
  const [leaving, setLeaving] = React.useState(false);
30
+ const exitTimer = (0, _useTimeout.default)();
31
+ const exitTimerStartedRef = React.useRef(false);
32
+ const onExitedRef = React.useRef(onExited);
33
+ onExitedRef.current = onExited;
34
+ const hasExitedCallback = onExited != null;
29
35
  const rippleClassName = (0, _clsx.default)(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
30
36
  const rippleStyles = {
31
37
  width: rippleSize,
@@ -38,15 +44,19 @@ var _jsxRuntime = require("react/jsx-runtime");
38
44
  setLeaving(true);
39
45
  }
40
46
  React.useEffect(() => {
41
- if (!inProp && onExited != null) {
42
- // react-transition-group#onExited
43
- const timeoutId = setTimeout(onExited, timeout);
44
- return () => {
45
- clearTimeout(timeoutId);
46
- };
47
+ if (!inProp && hasExitedCallback) {
48
+ if (!exitTimerStartedRef.current) {
49
+ exitTimerStartedRef.current = true;
50
+ exitTimer.start(timeout, () => {
51
+ exitTimerStartedRef.current = false;
52
+ onExitedRef.current?.();
53
+ });
54
+ }
55
+ } else {
56
+ exitTimerStartedRef.current = false;
57
+ exitTimer.clear();
47
58
  }
48
- return undefined;
49
- }, [onExited, inProp, timeout]);
59
+ }, [exitTimer, hasExitedCallback, inProp, timeout]);
50
60
  return /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
51
61
  className: rippleClassName,
52
62
  style: rippleStyles,
@@ -62,11 +72,11 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
62
72
  classes: _propTypes.default.object.isRequired,
63
73
  className: _propTypes.default.string,
64
74
  /**
65
- * @ignore - injected from TransitionGroup
75
+ * @ignore - controlled by TouchRipple
66
76
  */
67
77
  in: _propTypes.default.bool,
68
78
  /**
69
- * @ignore - injected from TransitionGroup
79
+ * @ignore - controlled by TouchRipple
70
80
  */
71
81
  onExited: _propTypes.default.func,
72
82
  /**
@@ -86,7 +96,7 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
86
96
  */
87
97
  rippleY: _propTypes.default.number,
88
98
  /**
89
- * exit delay
99
+ * Exit delay.
90
100
  */
91
101
  timeout: _propTypes.default.number.isRequired
92
102
  } : void 0;
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import clsx from 'clsx';
6
+ import useTimeout from '@mui/utils/useTimeout';
6
7
 
7
8
  /**
8
9
  * @ignore - internal component.
@@ -21,6 +22,11 @@ function Ripple(props) {
21
22
  timeout
22
23
  } = props;
23
24
  const [leaving, setLeaving] = React.useState(false);
25
+ const exitTimer = useTimeout();
26
+ const exitTimerStartedRef = React.useRef(false);
27
+ const onExitedRef = React.useRef(onExited);
28
+ onExitedRef.current = onExited;
29
+ const hasExitedCallback = onExited != null;
24
30
  const rippleClassName = clsx(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
25
31
  const rippleStyles = {
26
32
  width: rippleSize,
@@ -33,15 +39,19 @@ function Ripple(props) {
33
39
  setLeaving(true);
34
40
  }
35
41
  React.useEffect(() => {
36
- if (!inProp && onExited != null) {
37
- // react-transition-group#onExited
38
- const timeoutId = setTimeout(onExited, timeout);
39
- return () => {
40
- clearTimeout(timeoutId);
41
- };
42
+ if (!inProp && hasExitedCallback) {
43
+ if (!exitTimerStartedRef.current) {
44
+ exitTimerStartedRef.current = true;
45
+ exitTimer.start(timeout, () => {
46
+ exitTimerStartedRef.current = false;
47
+ onExitedRef.current?.();
48
+ });
49
+ }
50
+ } else {
51
+ exitTimerStartedRef.current = false;
52
+ exitTimer.clear();
42
53
  }
43
- return undefined;
44
- }, [onExited, inProp, timeout]);
54
+ }, [exitTimer, hasExitedCallback, inProp, timeout]);
45
55
  return /*#__PURE__*/_jsx("span", {
46
56
  className: rippleClassName,
47
57
  style: rippleStyles,
@@ -57,11 +67,11 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
57
67
  classes: PropTypes.object.isRequired,
58
68
  className: PropTypes.string,
59
69
  /**
60
- * @ignore - injected from TransitionGroup
70
+ * @ignore - controlled by TouchRipple
61
71
  */
62
72
  in: PropTypes.bool,
63
73
  /**
64
- * @ignore - injected from TransitionGroup
74
+ * @ignore - controlled by TouchRipple
65
75
  */
66
76
  onExited: PropTypes.func,
67
77
  /**
@@ -81,7 +91,7 @@ process.env.NODE_ENV !== "production" ? Ripple.propTypes /* remove-proptypes */
81
91
  */
82
92
  rippleY: PropTypes.number,
83
93
  /**
84
- * exit delay
94
+ * Exit delay.
85
95
  */
86
96
  timeout: PropTypes.number.isRequired
87
97
  } : void 0;