@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.
Files changed (99) hide show
  1. package/Autocomplete/Autocomplete.d.ts +2 -0
  2. package/Autocomplete/Autocomplete.js +10 -6
  3. package/Avatar/Avatar.d.ts +3 -1
  4. package/Backdrop/Backdrop.js +3 -1
  5. package/Badge/Badge.d.ts +25 -0
  6. package/Badge/Badge.js +31 -15
  7. package/ButtonGroup/ButtonGroupContext.d.ts +1 -1
  8. package/CHANGELOG.md +245 -32
  9. package/FilledInput/FilledInput.js +4 -1
  10. package/FormControlLabel/FormControlLabel.js +3 -1
  11. package/Input/Input.js +4 -1
  12. package/InputBase/InputBase.js +4 -1
  13. package/InputLabel/InputLabel.js +4 -0
  14. package/ListItem/ListItem.js +3 -1
  15. package/Modal/Modal.js +3 -1
  16. package/README.md +19 -24
  17. package/Select/Select.d.ts +9 -1
  18. package/Select/Select.js +10 -1
  19. package/Select/SelectInput.d.ts +1 -0
  20. package/Select/SelectInput.js +25 -4
  21. package/Slider/Slider.d.ts +2 -0
  22. package/Slider/Slider.js +126 -53
  23. package/StepLabel/StepLabel.js +3 -1
  24. package/SvgIcon/SvgIcon.d.ts +8 -0
  25. package/SvgIcon/SvgIcon.js +19 -3
  26. package/TextField/TextField.d.ts +1 -0
  27. package/TextField/TextField.js +1 -0
  28. package/Tooltip/Tooltip.js +6 -1
  29. package/index.js +1 -1
  30. package/legacy/Autocomplete/Autocomplete.js +10 -6
  31. package/legacy/Backdrop/Backdrop.js +3 -1
  32. package/legacy/Badge/Badge.js +36 -16
  33. package/legacy/FilledInput/FilledInput.js +4 -1
  34. package/legacy/FormControlLabel/FormControlLabel.js +3 -1
  35. package/legacy/Input/Input.js +4 -1
  36. package/legacy/InputBase/InputBase.js +4 -1
  37. package/legacy/InputLabel/InputLabel.js +4 -0
  38. package/legacy/ListItem/ListItem.js +3 -1
  39. package/legacy/Modal/Modal.js +3 -1
  40. package/legacy/Select/Select.js +11 -1
  41. package/legacy/Select/SelectInput.js +29 -7
  42. package/legacy/Slider/Slider.js +127 -54
  43. package/legacy/StepLabel/StepLabel.js +3 -1
  44. package/legacy/SvgIcon/SvgIcon.js +20 -3
  45. package/legacy/TextField/TextField.js +1 -0
  46. package/legacy/Tooltip/Tooltip.js +6 -1
  47. package/legacy/index.js +1 -1
  48. package/legacy/locale/index.js +224 -130
  49. package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
  50. package/locale/index.d.ts +1 -0
  51. package/locale/index.js +140 -50
  52. package/modern/Autocomplete/Autocomplete.js +9 -5
  53. package/modern/Backdrop/Backdrop.js +3 -1
  54. package/modern/Badge/Badge.js +31 -15
  55. package/modern/FilledInput/FilledInput.js +4 -1
  56. package/modern/FormControlLabel/FormControlLabel.js +3 -1
  57. package/modern/Input/Input.js +4 -1
  58. package/modern/InputBase/InputBase.js +4 -1
  59. package/modern/InputLabel/InputLabel.js +4 -0
  60. package/modern/ListItem/ListItem.js +3 -1
  61. package/modern/Modal/Modal.js +3 -1
  62. package/modern/Select/Select.js +10 -1
  63. package/modern/Select/SelectInput.js +25 -4
  64. package/modern/Slider/Slider.js +126 -53
  65. package/modern/StepLabel/StepLabel.js +3 -1
  66. package/modern/SvgIcon/SvgIcon.js +19 -3
  67. package/modern/TextField/TextField.js +1 -0
  68. package/modern/Tooltip/Tooltip.js +6 -1
  69. package/modern/index.js +1 -1
  70. package/modern/locale/index.js +140 -50
  71. package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
  72. package/node/Autocomplete/Autocomplete.js +10 -6
  73. package/node/Backdrop/Backdrop.js +3 -1
  74. package/node/Badge/Badge.js +33 -16
  75. package/node/FilledInput/FilledInput.js +4 -1
  76. package/node/FormControlLabel/FormControlLabel.js +3 -1
  77. package/node/Input/Input.js +4 -1
  78. package/node/InputBase/InputBase.js +4 -1
  79. package/node/InputLabel/InputLabel.js +4 -0
  80. package/node/ListItem/ListItem.js +3 -1
  81. package/node/Modal/Modal.js +3 -1
  82. package/node/Select/Select.js +10 -1
  83. package/node/Select/SelectInput.js +25 -4
  84. package/node/Slider/Slider.js +112 -45
  85. package/node/StepLabel/StepLabel.js +3 -1
  86. package/node/SvgIcon/SvgIcon.js +19 -3
  87. package/node/TextField/TextField.js +1 -0
  88. package/node/Tooltip/Tooltip.js +6 -1
  89. package/node/index.js +1 -1
  90. package/node/locale/index.js +142 -51
  91. package/node/utils/shouldSpreadAdditionalProps.js +15 -0
  92. package/package.json +7 -7
  93. package/styles/components.d.ts +452 -113
  94. package/styles/createTheme.d.ts +12 -6
  95. package/styles/overrides.d.ts +16 -4
  96. package/styles/useThemeProps.d.ts +2 -1
  97. package/umd/material-ui.development.js +703 -332
  98. package/umd/material-ui.production.min.js +21 -21
  99. 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.object,
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.
@@ -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
  */
@@ -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.object,
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, isHostComponent } from '@mui/base';
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
- color: colorProp
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.object,
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.
@@ -4,7 +4,7 @@ interface IButtonGroupContext {
4
4
  className?: string;
5
5
  color?: ButtonGroupProps['color'];
6
6
  disabled?: boolean;
7
- disabledElevation?: boolean;
7
+ disableElevation?: boolean;
8
8
  disableFocusRipple?: boolean;
9
9
  disableRipple?: boolean;
10
10
  fullWidth?: boolean;