@mui/material 5.2.5 → 5.3.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.
- package/Autocomplete/Autocomplete.d.ts +2 -0
- package/Autocomplete/Autocomplete.js +10 -6
- package/Avatar/Avatar.d.ts +3 -1
- package/Backdrop/Backdrop.js +3 -1
- package/Badge/Badge.d.ts +25 -0
- package/Badge/Badge.js +31 -15
- package/ButtonGroup/ButtonGroupContext.d.ts +1 -1
- package/CHANGELOG.md +245 -32
- package/FilledInput/FilledInput.js +4 -1
- package/FormControlLabel/FormControlLabel.js +3 -1
- package/Input/Input.js +4 -1
- package/InputBase/InputBase.js +4 -1
- package/InputLabel/InputLabel.js +4 -0
- package/ListItem/ListItem.js +3 -1
- package/Modal/Modal.js +3 -1
- package/README.md +19 -24
- package/Select/Select.d.ts +9 -1
- package/Select/Select.js +10 -1
- package/Select/SelectInput.d.ts +1 -0
- package/Select/SelectInput.js +25 -4
- package/Slider/Slider.d.ts +2 -0
- package/Slider/Slider.js +126 -53
- package/StepLabel/StepLabel.js +3 -1
- package/SvgIcon/SvgIcon.d.ts +8 -0
- package/SvgIcon/SvgIcon.js +19 -3
- package/TextField/TextField.d.ts +1 -0
- package/TextField/TextField.js +1 -0
- package/Tooltip/Tooltip.js +6 -1
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +10 -6
- package/legacy/Backdrop/Backdrop.js +3 -1
- package/legacy/Badge/Badge.js +36 -16
- package/legacy/FilledInput/FilledInput.js +4 -1
- package/legacy/FormControlLabel/FormControlLabel.js +3 -1
- package/legacy/Input/Input.js +4 -1
- package/legacy/InputBase/InputBase.js +4 -1
- package/legacy/InputLabel/InputLabel.js +4 -0
- package/legacy/ListItem/ListItem.js +3 -1
- package/legacy/Modal/Modal.js +3 -1
- package/legacy/Select/Select.js +11 -1
- package/legacy/Select/SelectInput.js +29 -7
- package/legacy/Slider/Slider.js +127 -54
- package/legacy/StepLabel/StepLabel.js +3 -1
- package/legacy/SvgIcon/SvgIcon.js +20 -3
- package/legacy/TextField/TextField.js +1 -0
- package/legacy/Tooltip/Tooltip.js +6 -1
- package/legacy/index.js +1 -1
- package/legacy/locale/index.js +224 -130
- package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
- package/locale/index.d.ts +1 -0
- package/locale/index.js +140 -50
- package/modern/Autocomplete/Autocomplete.js +9 -5
- package/modern/Backdrop/Backdrop.js +3 -1
- package/modern/Badge/Badge.js +31 -15
- package/modern/FilledInput/FilledInput.js +4 -1
- package/modern/FormControlLabel/FormControlLabel.js +3 -1
- package/modern/Input/Input.js +4 -1
- package/modern/InputBase/InputBase.js +4 -1
- package/modern/InputLabel/InputLabel.js +4 -0
- package/modern/ListItem/ListItem.js +3 -1
- package/modern/Modal/Modal.js +3 -1
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +25 -4
- package/modern/Slider/Slider.js +126 -53
- package/modern/StepLabel/StepLabel.js +3 -1
- package/modern/SvgIcon/SvgIcon.js +19 -3
- package/modern/TextField/TextField.js +1 -0
- package/modern/Tooltip/Tooltip.js +6 -1
- package/modern/index.js +1 -1
- package/modern/locale/index.js +140 -50
- package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
- package/node/Autocomplete/Autocomplete.js +10 -6
- package/node/Backdrop/Backdrop.js +3 -1
- package/node/Badge/Badge.js +33 -16
- package/node/FilledInput/FilledInput.js +4 -1
- package/node/FormControlLabel/FormControlLabel.js +3 -1
- package/node/Input/Input.js +4 -1
- package/node/InputBase/InputBase.js +4 -1
- package/node/InputLabel/InputLabel.js +4 -0
- package/node/ListItem/ListItem.js +3 -1
- package/node/Modal/Modal.js +3 -1
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +25 -4
- package/node/Slider/Slider.js +112 -45
- package/node/StepLabel/StepLabel.js +3 -1
- package/node/SvgIcon/SvgIcon.js +19 -3
- package/node/TextField/TextField.js +1 -0
- package/node/Tooltip/Tooltip.js +6 -1
- package/node/index.js +1 -1
- package/node/locale/index.js +142 -51
- package/node/utils/shouldSpreadAdditionalProps.js +15 -0
- package/package.json +7 -7
- package/styles/components.d.ts +452 -113
- package/styles/createTheme.d.ts +12 -6
- package/styles/overrides.d.ts +16 -4
- package/styles/useThemeProps.d.ts +2 -1
- package/umd/material-ui.development.js +703 -332
- package/umd/material-ui.production.min.js +21 -21
- package/utils/shouldSpreadAdditionalProps.js +7 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IconButtonProps, InternalStandardProps as StandardProps, Theme } from '@mui/material';
|
|
3
3
|
import { ChipProps, ChipTypeMap } from '@mui/material/Chip';
|
|
4
|
+
import { PaperProps } from '@mui/material/Paper';
|
|
4
5
|
import { PopperProps } from '@mui/material/Popper';
|
|
5
6
|
import { SxProps } from '@mui/system';
|
|
6
7
|
import { OverridableStringUnion } from '@mui/types';
|
|
@@ -101,6 +102,7 @@ export interface AutocompleteProps<
|
|
|
101
102
|
*/
|
|
102
103
|
componentsProps?: {
|
|
103
104
|
clearIndicator?: Partial<IconButtonProps>;
|
|
105
|
+
paper?: PaperProps;
|
|
104
106
|
};
|
|
105
107
|
/**
|
|
106
108
|
* If `true`, the component is disabled.
|
|
@@ -349,7 +349,7 @@ const AutocompleteGroupUl = styled('ul', {
|
|
|
349
349
|
});
|
|
350
350
|
export { createFilterOptions };
|
|
351
351
|
const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps, ref) {
|
|
352
|
-
var _componentsProps$clea;
|
|
352
|
+
var _componentsProps$clea, _componentsProps$pape;
|
|
353
353
|
|
|
354
354
|
const props = useThemeProps({
|
|
355
355
|
props: inProps,
|
|
@@ -570,10 +570,11 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
570
570
|
role: "presentation",
|
|
571
571
|
anchorEl: anchorEl,
|
|
572
572
|
open: true,
|
|
573
|
-
children: /*#__PURE__*/_jsxs(AutocompletePaper, {
|
|
574
|
-
as: PaperComponent,
|
|
575
|
-
className: classes.paper,
|
|
573
|
+
children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
|
|
576
574
|
ownerState: ownerState,
|
|
575
|
+
as: PaperComponent
|
|
576
|
+
}, componentsProps.paper, {
|
|
577
|
+
className: clsx(classes.paper, (_componentsProps$pape = componentsProps.paper) == null ? void 0 : _componentsProps$pape.className),
|
|
577
578
|
children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
|
|
578
579
|
className: classes.loading,
|
|
579
580
|
ownerState: ownerState,
|
|
@@ -604,7 +605,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
604
605
|
return renderListOption(option, index);
|
|
605
606
|
})
|
|
606
607
|
})) : null]
|
|
607
|
-
})
|
|
608
|
+
}))
|
|
608
609
|
}) : null]
|
|
609
610
|
});
|
|
610
611
|
});
|
|
@@ -705,7 +706,10 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes
|
|
|
705
706
|
* The props used for each slot inside.
|
|
706
707
|
* @default {}
|
|
707
708
|
*/
|
|
708
|
-
componentsProps: PropTypes.
|
|
709
|
+
componentsProps: PropTypes.shape({
|
|
710
|
+
clearIndicator: PropTypes.object,
|
|
711
|
+
paper: PropTypes.object
|
|
712
|
+
}),
|
|
709
713
|
|
|
710
714
|
/**
|
|
711
715
|
* The default value. Use when the component is not controlled.
|
package/Avatar/Avatar.d.ts
CHANGED
|
@@ -27,7 +27,9 @@ export interface AvatarTypeMap<P = {}, D extends React.ElementType = 'div'> {
|
|
|
27
27
|
* [Attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) applied to the `img` element if the component is used to display an image.
|
|
28
28
|
* It can be used to listen for the loading error event.
|
|
29
29
|
*/
|
|
30
|
-
imgProps?: React.ImgHTMLAttributes<HTMLImageElement
|
|
30
|
+
imgProps?: React.ImgHTMLAttributes<HTMLImageElement> & {
|
|
31
|
+
sx?: SxProps<Theme>;
|
|
32
|
+
};
|
|
31
33
|
/**
|
|
32
34
|
* The `sizes` attribute for the `img` element.
|
|
33
35
|
*/
|
package/Backdrop/Backdrop.js
CHANGED
|
@@ -126,7 +126,9 @@ process.env.NODE_ENV !== "production" ? Backdrop.propTypes
|
|
|
126
126
|
* The props used for each slot inside the Backdrop.
|
|
127
127
|
* @default {}
|
|
128
128
|
*/
|
|
129
|
-
componentsProps: PropTypes.
|
|
129
|
+
componentsProps: PropTypes.shape({
|
|
130
|
+
root: PropTypes.object
|
|
131
|
+
}),
|
|
130
132
|
|
|
131
133
|
/**
|
|
132
134
|
* If `true`, the backdrop is invisible.
|
package/Badge/Badge.d.ts
CHANGED
|
@@ -30,6 +30,26 @@ export type BadgeTypeMap<
|
|
|
30
30
|
colorSuccess?: string;
|
|
31
31
|
/** Styles applied to the badge `span` element if `color="warning"`. */
|
|
32
32
|
colorWarning?: string;
|
|
33
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'top', 'right' }} overlap="rectangular"`. */
|
|
34
|
+
anchorOriginTopRightRectangular?: string;
|
|
35
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'bottom', 'right' }} overlap="rectangular"`. */
|
|
36
|
+
anchorOriginBottomRightRectangular?: string;
|
|
37
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'top', 'left' }} overlap="rectangular"`. */
|
|
38
|
+
anchorOriginTopLeftRectangular?: string;
|
|
39
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'bottom', 'left' }} overlap="rectangular"`. */
|
|
40
|
+
anchorOriginBottomLeftRectangular?: string;
|
|
41
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'top', 'right' }} overlap="circular"`. */
|
|
42
|
+
anchorOriginTopRightCircular?: string;
|
|
43
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'bottom', 'right' }} overlap="circular"`. */
|
|
44
|
+
anchorOriginBottomRightCircular?: string;
|
|
45
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'top', 'left' }} overlap="circular"`. */
|
|
46
|
+
anchorOriginTopLeftCircular?: string;
|
|
47
|
+
/** Class name applied to the badge `span` element if `anchorOrigin={{ 'bottom', 'left' }} overlap="circular"`. */
|
|
48
|
+
anchorOriginBottomLeftCircular?: string;
|
|
49
|
+
/** Class name applied to the badge `span` element if `overlap="rectangular"`. */
|
|
50
|
+
overlapRectangular?: string;
|
|
51
|
+
/** Class name applied to the badge `span` element if `overlap="circular"`. */
|
|
52
|
+
overlapCircular?: string;
|
|
33
53
|
};
|
|
34
54
|
/**
|
|
35
55
|
* The color of the component. It supports those theme colors that make sense for this component.
|
|
@@ -39,6 +59,11 @@ export type BadgeTypeMap<
|
|
|
39
59
|
'primary' | 'secondary' | 'default' | 'error' | 'info' | 'success' | 'warning',
|
|
40
60
|
BadgePropsColorOverrides
|
|
41
61
|
>;
|
|
62
|
+
/**
|
|
63
|
+
* Wrapped shape the badge should overlap.
|
|
64
|
+
* @default 'rectangular'
|
|
65
|
+
*/
|
|
66
|
+
overlap?: 'rectangular' | 'circular';
|
|
42
67
|
/**
|
|
43
68
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
44
69
|
*/
|
package/Badge/Badge.js
CHANGED
|
@@ -1,27 +1,31 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["component", "components", "componentsProps", "color", "invisible", "badgeContent", "showZero", "variant"];
|
|
3
|
+
const _excluded = ["anchorOrigin", "component", "components", "componentsProps", "overlap", "color", "invisible", "badgeContent", "showZero", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { usePreviousProps } from '@mui/utils';
|
|
8
|
-
import { generateUtilityClasses
|
|
8
|
+
import { generateUtilityClasses } from '@mui/base';
|
|
9
9
|
import BadgeUnstyled, { badgeUnstyledClasses, getBadgeUtilityClass } from '@mui/base/BadgeUnstyled';
|
|
10
10
|
import styled from '../styles/styled';
|
|
11
11
|
import useThemeProps from '../styles/useThemeProps';
|
|
12
|
+
import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
|
|
12
13
|
import capitalize from '../utils/capitalize';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export const badgeClasses = _extends({}, badgeUnstyledClasses, generateUtilityClasses('MuiBadge', ['colorError', 'colorInfo', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorWarning'
|
|
15
|
+
export const badgeClasses = _extends({}, badgeUnstyledClasses, generateUtilityClasses('MuiBadge', ['colorError', 'colorInfo', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorWarning', 'overlapRectangular', 'overlapCircular', // TODO: v6 remove the overlap value from these class keys
|
|
16
|
+
'anchorOriginTopLeftCircular', 'anchorOriginTopLeftRectangular', 'anchorOriginTopRightCircular', 'anchorOriginTopRightRectangular', 'anchorOriginBottomLeftCircular', 'anchorOriginBottomLeftRectangular', 'anchorOriginBottomRightCircular', 'anchorOriginBottomRightRectangular']));
|
|
15
17
|
const RADIUS_STANDARD = 10;
|
|
16
18
|
const RADIUS_DOT = 4;
|
|
17
19
|
|
|
18
20
|
const extendUtilityClasses = ownerState => {
|
|
19
21
|
const {
|
|
20
22
|
color,
|
|
23
|
+
anchorOrigin,
|
|
24
|
+
overlap,
|
|
21
25
|
classes = {}
|
|
22
26
|
} = ownerState;
|
|
23
27
|
return _extends({}, classes, {
|
|
24
|
-
badge: clsx(classes.badge, color !== 'default' && [getBadgeUtilityClass(`color${capitalize(color)}`), classes[`color${capitalize(color)}`]])
|
|
28
|
+
badge: clsx(classes.badge, getBadgeUtilityClass(`anchorOrigin${capitalize(anchorOrigin.vertical)}${capitalize(anchorOrigin.horizontal)}${capitalize(overlap)}`), getBadgeUtilityClass(`overlap${capitalize(overlap)}`), color !== 'default' && [getBadgeUtilityClass(`color${capitalize(color)}`), classes[`color${capitalize(color)}`]])
|
|
25
29
|
});
|
|
26
30
|
};
|
|
27
31
|
|
|
@@ -149,11 +153,6 @@ const BadgeBadge = styled('span', {
|
|
|
149
153
|
duration: theme.transitions.duration.leavingScreen
|
|
150
154
|
})
|
|
151
155
|
}));
|
|
152
|
-
|
|
153
|
-
const shouldSpreadAdditionalProps = Slot => {
|
|
154
|
-
return !Slot || !isHostComponent(Slot);
|
|
155
|
-
};
|
|
156
|
-
|
|
157
156
|
const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
158
157
|
var _componentsProps$root, _componentsProps$badg;
|
|
159
158
|
|
|
@@ -163,9 +162,14 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
163
162
|
});
|
|
164
163
|
|
|
165
164
|
const {
|
|
165
|
+
anchorOrigin: anchorOriginProp = {
|
|
166
|
+
vertical: 'top',
|
|
167
|
+
horizontal: 'right'
|
|
168
|
+
},
|
|
166
169
|
component = 'span',
|
|
167
170
|
components = {},
|
|
168
171
|
componentsProps = {},
|
|
172
|
+
overlap: overlapProp = 'rectangular',
|
|
169
173
|
color: colorProp = 'default',
|
|
170
174
|
invisible: invisibleProp,
|
|
171
175
|
badgeContent: badgeContentProp,
|
|
@@ -175,7 +179,9 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
175
179
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
176
180
|
|
|
177
181
|
const prevProps = usePreviousProps({
|
|
178
|
-
|
|
182
|
+
anchorOrigin: anchorOriginProp,
|
|
183
|
+
color: colorProp,
|
|
184
|
+
overlap: overlapProp
|
|
179
185
|
});
|
|
180
186
|
let invisible = invisibleProp;
|
|
181
187
|
|
|
@@ -184,16 +190,21 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
184
190
|
}
|
|
185
191
|
|
|
186
192
|
const {
|
|
187
|
-
color = colorProp
|
|
193
|
+
color = colorProp,
|
|
194
|
+
overlap = overlapProp,
|
|
195
|
+
anchorOrigin = anchorOriginProp
|
|
188
196
|
} = invisible ? prevProps : props;
|
|
189
197
|
|
|
190
198
|
const ownerState = _extends({}, props, {
|
|
199
|
+
anchorOrigin,
|
|
191
200
|
invisible,
|
|
192
|
-
color
|
|
201
|
+
color,
|
|
202
|
+
overlap
|
|
193
203
|
});
|
|
194
204
|
|
|
195
205
|
const classes = extendUtilityClasses(ownerState);
|
|
196
206
|
return /*#__PURE__*/_jsx(BadgeUnstyled, _extends({
|
|
207
|
+
anchorOrigin: anchorOrigin,
|
|
197
208
|
invisible: invisibleProp,
|
|
198
209
|
badgeContent: badgeContentProp,
|
|
199
210
|
showZero: showZero,
|
|
@@ -207,12 +218,14 @@ const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
|
|
|
207
218
|
root: _extends({}, componentsProps.root, shouldSpreadAdditionalProps(components.Root) && {
|
|
208
219
|
as: component,
|
|
209
220
|
ownerState: _extends({}, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.ownerState, {
|
|
210
|
-
color
|
|
221
|
+
color,
|
|
222
|
+
overlap
|
|
211
223
|
})
|
|
212
224
|
}),
|
|
213
225
|
badge: _extends({}, componentsProps.badge, shouldSpreadAdditionalProps(components.Badge) && {
|
|
214
226
|
ownerState: _extends({}, (_componentsProps$badg = componentsProps.badge) == null ? void 0 : _componentsProps$badg.ownerState, {
|
|
215
|
-
color
|
|
227
|
+
color,
|
|
228
|
+
overlap
|
|
216
229
|
})
|
|
217
230
|
})
|
|
218
231
|
},
|
|
@@ -283,7 +296,10 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes
|
|
|
283
296
|
* The props used for each slot inside the Badge.
|
|
284
297
|
* @default {}
|
|
285
298
|
*/
|
|
286
|
-
componentsProps: PropTypes.
|
|
299
|
+
componentsProps: PropTypes.shape({
|
|
300
|
+
badge: PropTypes.object,
|
|
301
|
+
root: PropTypes.object
|
|
302
|
+
}),
|
|
287
303
|
|
|
288
304
|
/**
|
|
289
305
|
* If `true`, the badge is invisible.
|