@mui/material 5.15.5 → 5.15.7

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 (89) hide show
  1. package/Accordion/index.js +0 -2
  2. package/AccordionActions/index.js +0 -2
  3. package/AccordionDetails/index.js +0 -2
  4. package/AccordionSummary/index.js +0 -2
  5. package/Avatar/Avatar.js +33 -16
  6. package/AvatarGroup/AvatarGroup.js +19 -39
  7. package/Badge/Badge.js +2 -2
  8. package/ButtonBase/TouchRipple.js +9 -14
  9. package/CHANGELOG.md +401 -249
  10. package/Collapse/Collapse.js +3 -8
  11. package/Grow/Grow.js +3 -8
  12. package/PaginationItem/PaginationItem.js +1 -1
  13. package/PaginationItem/paginationItemClasses.d.ts +20 -4
  14. package/PaginationItem/paginationItemClasses.js +1 -1
  15. package/README.md +5 -5
  16. package/Rating/Rating.js +1 -0
  17. package/Rating/index.js +0 -2
  18. package/Select/Select.js +1 -1
  19. package/SpeedDial/SpeedDial.js +7 -12
  20. package/TablePagination/TablePagination.d.ts +1 -1
  21. package/Toolbar/index.js +0 -2
  22. package/Tooltip/Tooltip.js +29 -40
  23. package/index.js +1 -3
  24. package/legacy/Accordion/index.js +0 -2
  25. package/legacy/AccordionActions/index.js +0 -2
  26. package/legacy/AccordionDetails/index.js +0 -2
  27. package/legacy/AccordionSummary/index.js +0 -2
  28. package/legacy/Avatar/Avatar.js +33 -16
  29. package/legacy/AvatarGroup/AvatarGroup.js +6 -31
  30. package/legacy/Badge/Badge.js +2 -2
  31. package/legacy/ButtonBase/TouchRipple.js +9 -14
  32. package/legacy/Collapse/Collapse.js +3 -8
  33. package/legacy/Grow/Grow.js +3 -8
  34. package/legacy/PaginationItem/PaginationItem.js +1 -1
  35. package/legacy/PaginationItem/paginationItemClasses.js +1 -1
  36. package/legacy/Rating/Rating.js +1 -0
  37. package/legacy/Rating/index.js +0 -2
  38. package/legacy/Select/Select.js +1 -1
  39. package/legacy/SpeedDial/SpeedDial.js +7 -12
  40. package/legacy/Toolbar/index.js +0 -2
  41. package/legacy/Tooltip/Tooltip.js +29 -38
  42. package/legacy/index.js +1 -3
  43. package/legacy/zero-styled/index.js +7 -2
  44. package/modern/Accordion/index.js +0 -2
  45. package/modern/AccordionActions/index.js +0 -2
  46. package/modern/AccordionDetails/index.js +0 -2
  47. package/modern/AccordionSummary/index.js +0 -2
  48. package/modern/Avatar/Avatar.js +33 -16
  49. package/modern/AvatarGroup/AvatarGroup.js +19 -39
  50. package/modern/Badge/Badge.js +2 -2
  51. package/modern/ButtonBase/TouchRipple.js +9 -14
  52. package/modern/Collapse/Collapse.js +3 -8
  53. package/modern/Grow/Grow.js +3 -8
  54. package/modern/PaginationItem/PaginationItem.js +1 -1
  55. package/modern/PaginationItem/paginationItemClasses.js +1 -1
  56. package/modern/Rating/Rating.js +1 -0
  57. package/modern/Rating/index.js +0 -2
  58. package/modern/Select/Select.js +1 -1
  59. package/modern/SpeedDial/SpeedDial.js +7 -12
  60. package/modern/Toolbar/index.js +0 -2
  61. package/modern/Tooltip/Tooltip.js +29 -40
  62. package/modern/index.js +1 -3
  63. package/modern/zero-styled/index.js +7 -2
  64. package/node/Accordion/index.js +0 -1
  65. package/node/AccordionActions/index.js +0 -1
  66. package/node/AccordionDetails/index.js +0 -1
  67. package/node/AccordionSummary/index.js +0 -1
  68. package/node/Avatar/Avatar.js +33 -16
  69. package/node/AvatarGroup/AvatarGroup.js +19 -39
  70. package/node/Badge/Badge.js +2 -2
  71. package/node/ButtonBase/TouchRipple.js +9 -14
  72. package/node/Collapse/Collapse.js +2 -7
  73. package/node/Grow/Grow.js +2 -7
  74. package/node/PaginationItem/PaginationItem.js +1 -1
  75. package/node/PaginationItem/paginationItemClasses.js +1 -1
  76. package/node/Rating/Rating.js +1 -0
  77. package/node/Rating/index.js +0 -1
  78. package/node/Select/Select.js +1 -1
  79. package/node/SpeedDial/SpeedDial.js +6 -11
  80. package/node/Toolbar/index.js +0 -1
  81. package/node/Tooltip/Tooltip.js +28 -39
  82. package/node/index.js +1 -3
  83. package/node/zero-styled/index.js +7 -1
  84. package/package.json +7 -7
  85. package/styles/experimental_extendTheme.d.ts +3 -2
  86. package/umd/material-ui.development.js +400 -292
  87. package/umd/material-ui.production.min.js +4 -4
  88. package/zero-styled/index.d.ts +2 -1
  89. package/zero-styled/index.js +7 -2
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  export { default } from './Accordion';
4
2
  export { default as accordionClasses } from './accordionClasses';
5
3
  export * from './accordionClasses';
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  export { default } from './AccordionActions';
4
2
  export { default as accordionActionsClasses } from './accordionActionsClasses';
5
3
  export * from './accordionActionsClasses';
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  export { default } from './AccordionDetails';
4
2
  export { default as accordionDetailsClasses } from './accordionDetailsClasses';
5
3
  export * from './accordionDetailsClasses';
@@ -1,5 +1,3 @@
1
- 'use client';
2
-
3
1
  export { default } from './AccordionSummary';
4
2
  export { default as accordionSummaryClasses } from './accordionSummaryClasses';
5
3
  export * from './accordionSummaryClasses';
package/Avatar/Avatar.js CHANGED
@@ -35,9 +35,8 @@ const AvatarRoot = styled('div', {
35
35
  return [styles.root, styles[ownerState.variant], ownerState.colorDefault && styles.colorDefault];
36
36
  }
37
37
  })(({
38
- theme,
39
- ownerState
40
- }) => _extends({
38
+ theme
39
+ }) => ({
41
40
  position: 'relative',
42
41
  display: 'flex',
43
42
  alignItems: 'center',
@@ -50,18 +49,36 @@ const AvatarRoot = styled('div', {
50
49
  lineHeight: 1,
51
50
  borderRadius: '50%',
52
51
  overflow: 'hidden',
53
- userSelect: 'none'
54
- }, ownerState.variant === 'rounded' && {
55
- borderRadius: (theme.vars || theme).shape.borderRadius
56
- }, ownerState.variant === 'square' && {
57
- borderRadius: 0
58
- }, ownerState.colorDefault && _extends({
59
- color: (theme.vars || theme).palette.background.default
60
- }, theme.vars ? {
61
- backgroundColor: theme.vars.palette.Avatar.defaultBg
62
- } : {
63
- backgroundColor: theme.palette.mode === 'light' ? theme.palette.grey[400] : theme.palette.grey[600]
64
- })));
52
+ userSelect: 'none',
53
+ variants: [{
54
+ props: {
55
+ variant: 'rounded'
56
+ },
57
+ style: {
58
+ borderRadius: (theme.vars || theme).shape.borderRadius
59
+ }
60
+ }, {
61
+ props: {
62
+ variant: 'square'
63
+ },
64
+ style: {
65
+ borderRadius: 0
66
+ }
67
+ }, {
68
+ props: {
69
+ colorDefault: true
70
+ },
71
+ style: _extends({
72
+ color: (theme.vars || theme).palette.background.default
73
+ }, theme.vars ? {
74
+ backgroundColor: theme.vars.palette.Avatar.defaultBg
75
+ } : _extends({
76
+ backgroundColor: theme.palette.grey[400]
77
+ }, theme.applyStyles('dark', {
78
+ backgroundColor: theme.palette.grey[600]
79
+ })))
80
+ }]
81
+ }));
65
82
  const AvatarImg = styled('img', {
66
83
  name: 'MuiAvatar',
67
84
  slot: 'Img',
@@ -164,7 +181,7 @@ const Avatar = /*#__PURE__*/React.forwardRef(function Avatar(inProps, ref) {
164
181
  ownerState: ownerState,
165
182
  className: classes.img
166
183
  }, imgProps));
167
- } else if (childrenProp != null) {
184
+ } else if (childrenProp != null && childrenProp !== '' && typeof childrenProp !== 'boolean') {
168
185
  children = childrenProp;
169
186
  } else if (hasImg && alt) {
170
187
  children = alt[0];
@@ -36,33 +36,23 @@ const AvatarGroupRoot = styled('div', {
36
36
  [`& .${avatarGroupClasses.avatar}`]: styles.avatar
37
37
  }, styles.root)
38
38
  })(({
39
- theme
40
- }) => ({
41
- [`& .${avatarClasses.root}`]: {
42
- border: `2px solid ${(theme.vars || theme).palette.background.default}`,
43
- boxSizing: 'content-box',
44
- marginLeft: -8,
45
- '&:last-child': {
46
- marginLeft: 0
47
- }
48
- },
49
- display: 'flex',
50
- flexDirection: 'row-reverse'
51
- }));
52
- const AvatarGroupAvatar = styled(Avatar, {
53
- name: 'MuiAvatarGroup',
54
- slot: 'Avatar',
55
- overridesResolver: (props, styles) => styles.avatar
56
- })(({
57
- theme
58
- }) => ({
59
- border: `2px solid ${(theme.vars || theme).palette.background.default}`,
60
- boxSizing: 'content-box',
61
- marginLeft: -8,
62
- '&:last-child': {
63
- marginLeft: 0
64
- }
65
- }));
39
+ theme,
40
+ ownerState
41
+ }) => {
42
+ const marginValue = ownerState.spacing && SPACINGS[ownerState.spacing] !== undefined ? SPACINGS[ownerState.spacing] : -ownerState.spacing;
43
+ return {
44
+ [`& .${avatarClasses.root}`]: {
45
+ border: `2px solid ${(theme.vars || theme).palette.background.default}`,
46
+ boxSizing: 'content-box',
47
+ marginLeft: marginValue != null ? marginValue : -8,
48
+ '&:last-child': {
49
+ marginLeft: 0
50
+ }
51
+ },
52
+ display: 'flex',
53
+ flexDirection: 'row-reverse'
54
+ };
55
+ });
66
56
  const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps, ref) {
67
57
  var _slotProps$additional;
68
58
  const props = useThemeProps({
@@ -106,7 +96,6 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
106
96
  const maxAvatars = Math.min(children.length, clampedMax - 1);
107
97
  const extraAvatars = Math.max(totalAvatars - clampedMax, totalAvatars - maxAvatars, 0);
108
98
  const extraAvatarsElement = renderSurplus ? renderSurplus(extraAvatars) : `+${extraAvatars}`;
109
- const marginLeft = spacing && SPACINGS[spacing] !== undefined ? SPACINGS[spacing] : -spacing;
110
99
  const additionalAvatarSlotProps = (_slotProps$additional = slotProps.additionalAvatar) != null ? _slotProps$additional : componentsProps.additionalAvatar;
111
100
  return /*#__PURE__*/_jsxs(AvatarGroupRoot, _extends({
112
101
  as: component,
@@ -114,23 +103,14 @@ const AvatarGroup = /*#__PURE__*/React.forwardRef(function AvatarGroup(inProps,
114
103
  className: clsx(classes.root, className),
115
104
  ref: ref
116
105
  }, other, {
117
- children: [extraAvatars ? /*#__PURE__*/_jsx(AvatarGroupAvatar, _extends({
118
- ownerState: ownerState,
106
+ children: [extraAvatars ? /*#__PURE__*/_jsx(Avatar, _extends({
119
107
  variant: variant
120
108
  }, additionalAvatarSlotProps, {
121
109
  className: clsx(classes.avatar, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.className),
122
- style: _extends({
123
- marginLeft
124
- }, additionalAvatarSlotProps == null ? void 0 : additionalAvatarSlotProps.style),
125
110
  children: extraAvatarsElement
126
- })) : null, children.slice(0, maxAvatars).reverse().map((child, index) => {
111
+ })) : null, children.slice(0, maxAvatars).reverse().map(child => {
127
112
  return /*#__PURE__*/React.cloneElement(child, {
128
113
  className: clsx(child.props.className, classes.avatar),
129
- style: _extends({
130
- // Consistent with "&:last-child" styling for the default spacing,
131
- // we do not apply custom marginLeft spacing on the last child
132
- marginLeft: index === maxAvatars - 1 ? undefined : marginLeft
133
- }, child.props.style),
134
114
  variant: child.props.variant || variant
135
115
  });
136
116
  })]
package/Badge/Badge.js CHANGED
@@ -10,14 +10,14 @@ import { usePreviousProps } from '@mui/utils';
10
10
  import { unstable_composeClasses as composeClasses } from '@mui/base/composeClasses';
11
11
  import { useBadge } from '@mui/base/useBadge';
12
12
  import { useSlotProps } from '@mui/base';
13
- import { styled } from '../zero-styled';
14
- import useThemeProps from '../styles/useThemeProps';
13
+ import { styled, createUseThemeProps } from '../zero-styled';
15
14
  import capitalize from '../utils/capitalize';
16
15
  import badgeClasses, { getBadgeUtilityClass } from './badgeClasses';
17
16
  import { jsx as _jsx } from "react/jsx-runtime";
18
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
18
  const RADIUS_STANDARD = 10;
20
19
  const RADIUS_DOT = 4;
20
+ const useThemeProps = createUseThemeProps('MuiBadge');
21
21
  const useUtilityClasses = ownerState => {
22
22
  const {
23
23
  color,
@@ -13,6 +13,7 @@ import PropTypes from 'prop-types';
13
13
  import { TransitionGroup } from 'react-transition-group';
14
14
  import clsx from 'clsx';
15
15
  import { keyframes } from '@mui/system';
16
+ import { unstable_useTimeout as useTimeout } from '@mui/utils';
16
17
  import styled from '../styles/styled';
17
18
  import useThemeProps from '../styles/useThemeProps';
18
19
  import Ripple from './Ripple';
@@ -156,18 +157,11 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
156
157
  const ignoringMouseDown = React.useRef(false);
157
158
  // We use a timer in order to only show the ripples for touch "click" like events.
158
159
  // We don't want to display the ripple for touch scroll events.
159
- const startTimer = React.useRef(0);
160
+ const startTimer = useTimeout();
160
161
 
161
162
  // This is the hook called once the previous timeout is ready.
162
163
  const startTimerCommit = React.useRef(null);
163
164
  const container = React.useRef(null);
164
- React.useEffect(() => {
165
- return () => {
166
- if (startTimer.current) {
167
- clearTimeout(startTimer.current);
168
- }
169
- };
170
- }, []);
171
165
  const startCommit = React.useCallback(params => {
172
166
  const {
173
167
  pulsate,
@@ -260,12 +254,13 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
260
254
  });
261
255
  };
262
256
  // Delay the execution of the ripple effect.
263
- startTimer.current = setTimeout(() => {
257
+ // We have to make a tradeoff with this delay value.
258
+ startTimer.start(DELAY_RIPPLE, () => {
264
259
  if (startTimerCommit.current) {
265
260
  startTimerCommit.current();
266
261
  startTimerCommit.current = null;
267
262
  }
268
- }, DELAY_RIPPLE); // We have to make a tradeoff with this value.
263
+ });
269
264
  }
270
265
  } else {
271
266
  startCommit({
@@ -276,21 +271,21 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
276
271
  cb
277
272
  });
278
273
  }
279
- }, [centerProp, startCommit]);
274
+ }, [centerProp, startCommit, startTimer]);
280
275
  const pulsate = React.useCallback(() => {
281
276
  start({}, {
282
277
  pulsate: true
283
278
  });
284
279
  }, [start]);
285
280
  const stop = React.useCallback((event, cb) => {
286
- clearTimeout(startTimer.current);
281
+ startTimer.clear();
287
282
 
288
283
  // The touch interaction occurs too quickly.
289
284
  // We still want to show ripple effect.
290
285
  if ((event == null ? void 0 : event.type) === 'touchend' && startTimerCommit.current) {
291
286
  startTimerCommit.current();
292
287
  startTimerCommit.current = null;
293
- startTimer.current = setTimeout(() => {
288
+ startTimer.start(0, () => {
294
289
  stop(event, cb);
295
290
  });
296
291
  return;
@@ -303,7 +298,7 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
303
298
  return oldRipples;
304
299
  });
305
300
  rippleCallback.current = cb;
306
- }, []);
301
+ }, [startTimer]);
307
302
  React.useImperativeHandle(ref, () => ({
308
303
  pulsate,
309
304
  start,