@mui/material 5.15.4 → 5.15.6
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/Accordion.d.ts +30 -2
- package/Accordion/Accordion.js +39 -6
- package/AccordionSummary/accordionSummaryClasses.d.ts +4 -1
- package/Alert/Alert.d.ts +4 -2
- package/Alert/Alert.js +1 -1
- package/Avatar/Avatar.js +32 -15
- package/Badge/Badge.js +1 -1
- package/CHANGELOG.md +398 -242
- package/Divider/Divider.d.ts +1 -0
- package/Divider/Divider.js +1 -0
- package/Divider/dividerClasses.d.ts +6 -2
- 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 +2 -10
- package/SpeedDial/SpeedDial.js +1 -9
- package/TablePagination/TablePagination.d.ts +1 -1
- package/index.js +1 -1
- package/legacy/Accordion/Accordion.js +44 -7
- package/legacy/Alert/Alert.js +1 -1
- package/legacy/Avatar/Avatar.js +32 -15
- package/legacy/Badge/Badge.js +1 -1
- package/legacy/Divider/Divider.js +1 -0
- package/legacy/PaginationItem/PaginationItem.js +1 -1
- package/legacy/PaginationItem/paginationItemClasses.js +1 -1
- package/legacy/Rating/Rating.js +2 -10
- package/legacy/SpeedDial/SpeedDial.js +1 -9
- package/legacy/index.js +1 -1
- package/legacy/styles/createTheme.js +13 -1
- package/legacy/utils/types.js +1 -0
- package/legacy/utils/useSlot.js +71 -0
- package/legacy/zero-styled/index.js +2 -0
- package/modern/Accordion/Accordion.js +39 -6
- package/modern/Alert/Alert.js +1 -1
- package/modern/Avatar/Avatar.js +32 -15
- package/modern/Badge/Badge.js +1 -1
- package/modern/Divider/Divider.js +1 -0
- package/modern/PaginationItem/PaginationItem.js +1 -1
- package/modern/PaginationItem/paginationItemClasses.js +1 -1
- package/modern/Rating/Rating.js +2 -10
- package/modern/SpeedDial/SpeedDial.js +1 -9
- package/modern/index.js +1 -1
- package/modern/styles/createTheme.js +15 -1
- package/modern/utils/types.js +1 -0
- package/modern/utils/useSlot.js +82 -0
- package/modern/zero-styled/index.js +2 -0
- package/node/Accordion/Accordion.js +39 -6
- package/node/Alert/Alert.js +1 -1
- package/node/Avatar/Avatar.js +32 -15
- package/node/Badge/Badge.js +3 -3
- package/node/Divider/Divider.js +1 -0
- package/node/PaginationItem/PaginationItem.js +1 -1
- package/node/PaginationItem/paginationItemClasses.js +1 -1
- package/node/Rating/Rating.js +2 -10
- package/node/SpeedDial/SpeedDial.js +2 -10
- package/node/index.js +1 -1
- package/node/styles/createTheme.js +15 -1
- package/node/utils/types.js +5 -0
- package/node/utils/useSlot.js +88 -0
- package/node/zero-styled/index.js +13 -0
- package/package.json +6 -6
- package/styles/createTheme.d.ts +1 -0
- package/styles/createTheme.js +15 -1
- package/umd/material-ui.development.js +647 -516
- package/umd/material-ui.production.min.js +4 -4
- package/utils/types.d.ts +27 -0
- package/utils/types.js +1 -0
- package/utils/useSlot.d.ts +84 -0
- package/utils/useSlot.js +82 -0
- package/zero-styled/index.d.ts +2 -0
- package/zero-styled/index.js +2 -0
- package/zero-styled/package.json +6 -0
package/Accordion/Accordion.d.ts
CHANGED
|
@@ -5,6 +5,31 @@ import { TransitionProps } from '../transitions/transition';
|
|
|
5
5
|
import { AccordionClasses } from './accordionClasses';
|
|
6
6
|
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
|
7
7
|
import { ExtendPaperTypeMap } from '../Paper/Paper';
|
|
8
|
+
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
|
|
9
|
+
|
|
10
|
+
export interface AccordionSlots {
|
|
11
|
+
/**
|
|
12
|
+
* The component that renders the transition.
|
|
13
|
+
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
14
|
+
* @default Collapse
|
|
15
|
+
*/
|
|
16
|
+
transition?: React.JSXElementConstructor<
|
|
17
|
+
TransitionProps & { children?: React.ReactElement<any, any> }
|
|
18
|
+
>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface AccordionTransitionSlotPropsOverrides {}
|
|
22
|
+
|
|
23
|
+
export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
24
|
+
AccordionSlots,
|
|
25
|
+
{
|
|
26
|
+
transition: SlotProps<
|
|
27
|
+
React.ElementType<TransitionProps>,
|
|
28
|
+
AccordionTransitionSlotPropsOverrides,
|
|
29
|
+
AccordionOwnerState
|
|
30
|
+
>;
|
|
31
|
+
}
|
|
32
|
+
>;
|
|
8
33
|
|
|
9
34
|
export type AccordionTypeMap<
|
|
10
35
|
AdditionalProps = {},
|
|
@@ -54,7 +79,7 @@ export type AccordionTypeMap<
|
|
|
54
79
|
/**
|
|
55
80
|
* The component used for the transition.
|
|
56
81
|
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
57
|
-
* @
|
|
82
|
+
* @deprecated Use `slots.transition` instead. This prop will be removed in v7.
|
|
58
83
|
*/
|
|
59
84
|
TransitionComponent?: React.JSXElementConstructor<
|
|
60
85
|
TransitionProps & { children?: React.ReactElement<any, any> }
|
|
@@ -62,9 +87,10 @@ export type AccordionTypeMap<
|
|
|
62
87
|
/**
|
|
63
88
|
* Props applied to the transition element.
|
|
64
89
|
* By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
|
|
90
|
+
* @deprecated Use `slotProps.transition` instead. This prop will be removed in v7.
|
|
65
91
|
*/
|
|
66
92
|
TransitionProps?: TransitionProps;
|
|
67
|
-
};
|
|
93
|
+
} & AccordionSlotsAndSlotProps;
|
|
68
94
|
defaultComponent: RootComponent;
|
|
69
95
|
},
|
|
70
96
|
'onChange' | 'classes'
|
|
@@ -90,4 +116,6 @@ export type AccordionProps<
|
|
|
90
116
|
component?: React.ElementType;
|
|
91
117
|
};
|
|
92
118
|
|
|
119
|
+
export interface AccordionOwnerState extends AccordionProps {}
|
|
120
|
+
|
|
93
121
|
export default Accordion;
|
package/Accordion/Accordion.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "TransitionComponent", "TransitionProps"];
|
|
5
|
+
const _excluded = ["children", "className", "defaultExpanded", "disabled", "disableGutters", "expanded", "onChange", "square", "slots", "slotProps", "TransitionComponent", "TransitionProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { isFragment } from 'react-is';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -15,6 +15,7 @@ import Collapse from '../Collapse';
|
|
|
15
15
|
import Paper from '../Paper';
|
|
16
16
|
import AccordionContext from './AccordionContext';
|
|
17
17
|
import useControlled from '../utils/useControlled';
|
|
18
|
+
import useSlot from '../utils/useSlot';
|
|
18
19
|
import accordionClasses, { getAccordionUtilityClass } from './accordionClasses';
|
|
19
20
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
21
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -127,8 +128,10 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
127
128
|
expanded: expandedProp,
|
|
128
129
|
onChange,
|
|
129
130
|
square = false,
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
slots = {},
|
|
132
|
+
slotProps = {},
|
|
133
|
+
TransitionComponent: TransitionComponentProp,
|
|
134
|
+
TransitionProps: TransitionPropsProp
|
|
132
135
|
} = props,
|
|
133
136
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
134
137
|
const [expanded, setExpandedState] = useControlled({
|
|
@@ -157,6 +160,21 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
157
160
|
expanded
|
|
158
161
|
});
|
|
159
162
|
const classes = useUtilityClasses(ownerState);
|
|
163
|
+
const backwardCompatibleSlots = _extends({
|
|
164
|
+
transition: TransitionComponentProp
|
|
165
|
+
}, slots);
|
|
166
|
+
const backwardCompatibleSlotProps = _extends({
|
|
167
|
+
transition: TransitionPropsProp
|
|
168
|
+
}, slotProps);
|
|
169
|
+
const [TransitionSlot, transitionProps] = useSlot('transition', {
|
|
170
|
+
elementType: Collapse,
|
|
171
|
+
externalForwardedProps: {
|
|
172
|
+
slots: backwardCompatibleSlots,
|
|
173
|
+
slotProps: backwardCompatibleSlotProps
|
|
174
|
+
},
|
|
175
|
+
ownerState
|
|
176
|
+
});
|
|
177
|
+
delete transitionProps.ownerState;
|
|
160
178
|
return /*#__PURE__*/_jsxs(AccordionRoot, _extends({
|
|
161
179
|
className: clsx(classes.root, className),
|
|
162
180
|
ref: ref,
|
|
@@ -166,10 +184,10 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
166
184
|
children: [/*#__PURE__*/_jsx(AccordionContext.Provider, {
|
|
167
185
|
value: contextValue,
|
|
168
186
|
children: summary
|
|
169
|
-
}), /*#__PURE__*/_jsx(
|
|
187
|
+
}), /*#__PURE__*/_jsx(TransitionSlot, _extends({
|
|
170
188
|
in: expanded,
|
|
171
189
|
timeout: "auto"
|
|
172
|
-
},
|
|
190
|
+
}, transitionProps, {
|
|
173
191
|
children: /*#__PURE__*/_jsx("div", {
|
|
174
192
|
"aria-labelledby": summary.props.id,
|
|
175
193
|
id: summary.props['aria-controls'],
|
|
@@ -233,6 +251,20 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
|
|
|
233
251
|
* @param {boolean} expanded The `expanded` state of the accordion.
|
|
234
252
|
*/
|
|
235
253
|
onChange: PropTypes.func,
|
|
254
|
+
/**
|
|
255
|
+
* The props used for each slot inside.
|
|
256
|
+
* @default {}
|
|
257
|
+
*/
|
|
258
|
+
slotProps: PropTypes.shape({
|
|
259
|
+
transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
260
|
+
}),
|
|
261
|
+
/**
|
|
262
|
+
* The components used for each slot inside.
|
|
263
|
+
* @default {}
|
|
264
|
+
*/
|
|
265
|
+
slots: PropTypes.shape({
|
|
266
|
+
transition: PropTypes.elementType
|
|
267
|
+
}),
|
|
236
268
|
/**
|
|
237
269
|
* If `true`, rounded corners are disabled.
|
|
238
270
|
* @default false
|
|
@@ -245,12 +277,13 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
|
|
|
245
277
|
/**
|
|
246
278
|
* The component used for the transition.
|
|
247
279
|
* [Follow this guide](/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
248
|
-
* @
|
|
280
|
+
* @deprecated Use `slots.transition` instead. This prop will be removed in v7.
|
|
249
281
|
*/
|
|
250
282
|
TransitionComponent: PropTypes.elementType,
|
|
251
283
|
/**
|
|
252
284
|
* Props applied to the transition element.
|
|
253
285
|
* By default, the element is based on this [`Transition`](http://reactcommunity.org/react-transition-group/transition/) component.
|
|
286
|
+
* @deprecated Use `slotProps.transition` instead. This prop will be removed in v7.
|
|
254
287
|
*/
|
|
255
288
|
TransitionProps: PropTypes.object
|
|
256
289
|
} : void 0;
|
|
@@ -9,7 +9,10 @@ export interface AccordionSummaryClasses {
|
|
|
9
9
|
disabled: string;
|
|
10
10
|
/** Styles applied to the root element unless `disableGutters={true}`. */
|
|
11
11
|
gutters: string;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Styles applied to the children wrapper element unless `disableGutters={true}`.
|
|
14
|
+
* @deprecated Combine the [.MuiAccordionSummary-gutters](/material-ui/api/accordion-summary/#AccordionSummary-classes-gutters) and [.MuiAccordionSummary-content](/material-ui/api/accordion-summary/#AccordionSummary-classes-content) classes instead.
|
|
15
|
+
*/
|
|
13
16
|
contentGutters: string;
|
|
14
17
|
/** Styles applied to the children wrapper element. */
|
|
15
18
|
content: string;
|
package/Alert/Alert.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface AlertProps extends StandardProps<PaperProps, 'variant'> {
|
|
|
62
62
|
* The severity of the alert. This defines the color and icon used.
|
|
63
63
|
* @default 'success'
|
|
64
64
|
*/
|
|
65
|
-
severity?: AlertColor
|
|
65
|
+
severity?: OverridableStringUnion<AlertColor, AlertPropsColorOverrides>;
|
|
66
66
|
/**
|
|
67
67
|
* Override the icon displayed before the children.
|
|
68
68
|
* Unless provided, the icon is mapped to the value of the `severity` prop.
|
|
@@ -80,7 +80,9 @@ export interface AlertProps extends StandardProps<PaperProps, 'variant'> {
|
|
|
80
80
|
* If you wish to change this mapping, you can provide your own.
|
|
81
81
|
* Alternatively, you can use the `icon` prop to override the icon displayed.
|
|
82
82
|
*/
|
|
83
|
-
iconMapping?: Partial<
|
|
83
|
+
iconMapping?: Partial<
|
|
84
|
+
Record<OverridableStringUnion<AlertColor, AlertPropsColorOverrides>, React.ReactNode>
|
|
85
|
+
>;
|
|
84
86
|
/**
|
|
85
87
|
* Callback fired when the component requests to be closed.
|
|
86
88
|
* When provided and no `action` prop is set, a close icon button is displayed that triggers the callback when clicked.
|
package/Alert/Alert.js
CHANGED
|
@@ -289,7 +289,7 @@ process.env.NODE_ENV !== "production" ? Alert.propTypes /* remove-proptypes */ =
|
|
|
289
289
|
* The severity of the alert. This defines the color and icon used.
|
|
290
290
|
* @default 'success'
|
|
291
291
|
*/
|
|
292
|
-
severity: PropTypes.oneOf(['error', 'info', 'success', 'warning']),
|
|
292
|
+
severity: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['error', 'info', 'success', 'warning']), PropTypes.string]),
|
|
293
293
|
/**
|
|
294
294
|
* The extra props for the slot components.
|
|
295
295
|
* You can override the existing props or add new ones.
|
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.applyDarkStyles({
|
|
78
|
+
backgroundColor: theme.palette.grey[600]
|
|
79
|
+
})))
|
|
80
|
+
}]
|
|
81
|
+
}));
|
|
65
82
|
const AvatarImg = styled('img', {
|
|
66
83
|
name: 'MuiAvatar',
|
|
67
84
|
slot: 'Img',
|
package/Badge/Badge.js
CHANGED
|
@@ -10,7 +10,7 @@ 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 '../
|
|
13
|
+
import { styled } from '../zero-styled';
|
|
14
14
|
import useThemeProps from '../styles/useThemeProps';
|
|
15
15
|
import capitalize from '../utils/capitalize';
|
|
16
16
|
import badgeClasses, { getBadgeUtilityClass } from './badgeClasses';
|