@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.
- package/Accordion/index.js +0 -2
- package/AccordionActions/index.js +0 -2
- package/AccordionDetails/index.js +0 -2
- package/AccordionSummary/index.js +0 -2
- package/Avatar/Avatar.js +33 -16
- package/AvatarGroup/AvatarGroup.js +19 -39
- package/Badge/Badge.js +2 -2
- package/ButtonBase/TouchRipple.js +9 -14
- package/CHANGELOG.md +401 -249
- package/Collapse/Collapse.js +3 -8
- package/Grow/Grow.js +3 -8
- package/PaginationItem/PaginationItem.js +1 -1
- package/PaginationItem/paginationItemClasses.d.ts +20 -4
- package/PaginationItem/paginationItemClasses.js +1 -1
- package/README.md +5 -5
- package/Rating/Rating.js +1 -0
- package/Rating/index.js +0 -2
- package/Select/Select.js +1 -1
- package/SpeedDial/SpeedDial.js +7 -12
- package/TablePagination/TablePagination.d.ts +1 -1
- package/Toolbar/index.js +0 -2
- package/Tooltip/Tooltip.js +29 -40
- package/index.js +1 -3
- package/legacy/Accordion/index.js +0 -2
- package/legacy/AccordionActions/index.js +0 -2
- package/legacy/AccordionDetails/index.js +0 -2
- package/legacy/AccordionSummary/index.js +0 -2
- package/legacy/Avatar/Avatar.js +33 -16
- package/legacy/AvatarGroup/AvatarGroup.js +6 -31
- package/legacy/Badge/Badge.js +2 -2
- package/legacy/ButtonBase/TouchRipple.js +9 -14
- package/legacy/Collapse/Collapse.js +3 -8
- package/legacy/Grow/Grow.js +3 -8
- package/legacy/PaginationItem/PaginationItem.js +1 -1
- package/legacy/PaginationItem/paginationItemClasses.js +1 -1
- package/legacy/Rating/Rating.js +1 -0
- package/legacy/Rating/index.js +0 -2
- package/legacy/Select/Select.js +1 -1
- package/legacy/SpeedDial/SpeedDial.js +7 -12
- package/legacy/Toolbar/index.js +0 -2
- package/legacy/Tooltip/Tooltip.js +29 -38
- package/legacy/index.js +1 -3
- package/legacy/zero-styled/index.js +7 -2
- package/modern/Accordion/index.js +0 -2
- package/modern/AccordionActions/index.js +0 -2
- package/modern/AccordionDetails/index.js +0 -2
- package/modern/AccordionSummary/index.js +0 -2
- package/modern/Avatar/Avatar.js +33 -16
- package/modern/AvatarGroup/AvatarGroup.js +19 -39
- package/modern/Badge/Badge.js +2 -2
- package/modern/ButtonBase/TouchRipple.js +9 -14
- package/modern/Collapse/Collapse.js +3 -8
- package/modern/Grow/Grow.js +3 -8
- package/modern/PaginationItem/PaginationItem.js +1 -1
- package/modern/PaginationItem/paginationItemClasses.js +1 -1
- package/modern/Rating/Rating.js +1 -0
- package/modern/Rating/index.js +0 -2
- package/modern/Select/Select.js +1 -1
- package/modern/SpeedDial/SpeedDial.js +7 -12
- package/modern/Toolbar/index.js +0 -2
- package/modern/Tooltip/Tooltip.js +29 -40
- package/modern/index.js +1 -3
- package/modern/zero-styled/index.js +7 -2
- package/node/Accordion/index.js +0 -1
- package/node/AccordionActions/index.js +0 -1
- package/node/AccordionDetails/index.js +0 -1
- package/node/AccordionSummary/index.js +0 -1
- package/node/Avatar/Avatar.js +33 -16
- package/node/AvatarGroup/AvatarGroup.js +19 -39
- package/node/Badge/Badge.js +2 -2
- package/node/ButtonBase/TouchRipple.js +9 -14
- package/node/Collapse/Collapse.js +2 -7
- package/node/Grow/Grow.js +2 -7
- package/node/PaginationItem/PaginationItem.js +1 -1
- package/node/PaginationItem/paginationItemClasses.js +1 -1
- package/node/Rating/Rating.js +1 -0
- package/node/Rating/index.js +0 -1
- package/node/Select/Select.js +1 -1
- package/node/SpeedDial/SpeedDial.js +6 -11
- package/node/Toolbar/index.js +0 -1
- package/node/Tooltip/Tooltip.js +28 -39
- package/node/index.js +1 -3
- package/node/zero-styled/index.js +7 -1
- package/package.json +7 -7
- package/styles/experimental_extendTheme.d.ts +3 -2
- package/umd/material-ui.development.js +400 -292
- package/umd/material-ui.production.min.js +4 -4
- package/zero-styled/index.d.ts +2 -1
- package/zero-styled/index.js +7 -2
package/Accordion/index.js
CHANGED
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
|
-
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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(
|
|
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(
|
|
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 =
|
|
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
|
-
|
|
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
|
-
}
|
|
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
|
-
|
|
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.
|
|
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,
|