@mui/material 5.2.3 → 5.2.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 (56) hide show
  1. package/Avatar/Avatar.d.ts +4 -2
  2. package/Badge/Badge.d.ts +25 -0
  3. package/Badge/Badge.js +40 -10
  4. package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  5. package/ButtonGroup/ButtonGroupContext.d.ts +1 -1
  6. package/CHANGELOG.md +227 -0
  7. package/CssBaseline/CssBaseline.d.ts +1 -1
  8. package/GlobalStyles/GlobalStyles.d.ts +2 -1
  9. package/Grid/Grid.js +74 -66
  10. package/InputBase/InputBase.d.ts +6 -0
  11. package/InputBase/InputBase.js +10 -2
  12. package/ListItem/ListItem.d.ts +1 -1
  13. package/ListItemButton/ListItemButton.d.ts +1 -1
  14. package/MenuItem/MenuItem.d.ts +1 -1
  15. package/OutlinedInput/OutlinedInput.js +14 -1
  16. package/README.md +15 -27
  17. package/Select/SelectInput.js +11 -3
  18. package/SvgIcon/SvgIcon.d.ts +8 -0
  19. package/SvgIcon/SvgIcon.js +19 -3
  20. package/Tabs/Tabs.d.ts +1 -1
  21. package/TextField/TextField.js +2 -9
  22. package/index.js +1 -1
  23. package/legacy/Badge/Badge.js +46 -11
  24. package/legacy/Grid/Grid.js +84 -78
  25. package/legacy/InputBase/InputBase.js +10 -2
  26. package/legacy/OutlinedInput/OutlinedInput.js +14 -1
  27. package/legacy/Select/SelectInput.js +11 -5
  28. package/legacy/SvgIcon/SvgIcon.js +20 -3
  29. package/legacy/TextField/TextField.js +2 -9
  30. package/legacy/index.js +1 -1
  31. package/legacy/locale/index.js +319 -142
  32. package/locale/index.d.ts +2 -0
  33. package/locale/index.js +220 -50
  34. package/modern/Badge/Badge.js +40 -10
  35. package/modern/Grid/Grid.js +74 -66
  36. package/modern/InputBase/InputBase.js +10 -2
  37. package/modern/OutlinedInput/OutlinedInput.js +14 -1
  38. package/modern/Select/SelectInput.js +11 -3
  39. package/modern/SvgIcon/SvgIcon.js +19 -3
  40. package/modern/TextField/TextField.js +2 -7
  41. package/modern/index.js +1 -1
  42. package/modern/locale/index.js +220 -50
  43. package/node/Badge/Badge.js +40 -10
  44. package/node/Grid/Grid.js +75 -65
  45. package/node/InputBase/InputBase.js +10 -2
  46. package/node/OutlinedInput/OutlinedInput.js +15 -1
  47. package/node/Select/SelectInput.js +11 -3
  48. package/node/SvgIcon/SvgIcon.js +19 -3
  49. package/node/TextField/TextField.js +1 -8
  50. package/node/index.js +1 -1
  51. package/node/locale/index.js +223 -51
  52. package/package.json +3 -3
  53. package/styles/createTheme.d.ts +1 -1
  54. package/transitions/transition.d.ts +1 -2
  55. package/umd/material-ui.development.js +278 -171
  56. package/umd/material-ui.production.min.js +21 -21
@@ -30,72 +30,86 @@ function getOffset(val) {
30
30
  return "".concat(parse).concat(String(val).replace(String(parse), '') || 'px');
31
31
  }
32
32
 
33
- function generateGrid(globalStyles, theme, breakpoint, ownerState) {
34
- var size = ownerState[breakpoint];
35
-
36
- if (!size) {
37
- return;
38
- }
39
-
40
- var styles = {};
41
-
42
- if (size === true) {
43
- // For the auto layouting
44
- styles = {
45
- flexBasis: 0,
46
- flexGrow: 1,
47
- maxWidth: '100%'
48
- };
49
- } else if (size === 'auto') {
50
- styles = {
51
- flexBasis: 'auto',
52
- flexGrow: 0,
53
- flexShrink: 0,
54
- maxWidth: 'none',
55
- width: 'auto'
56
- };
57
- } else {
58
- var columnsBreakpointValues = resolveBreakpointValues({
59
- values: ownerState.columns,
60
- breakpoints: theme.breakpoints.values
61
- });
62
- var columnValue = _typeof(columnsBreakpointValues) === 'object' ? columnsBreakpointValues[breakpoint] : columnsBreakpointValues; // Keep 7 significant numbers.
63
-
64
- var width = "".concat(Math.round(size / columnValue * 10e7) / 10e5, "%");
65
- var more = {};
66
-
67
- if (ownerState.container && ownerState.item && ownerState.columnSpacing !== 0) {
68
- var themeSpacing = theme.spacing(ownerState.columnSpacing);
69
-
70
- if (themeSpacing !== '0px') {
71
- var fullWidth = "calc(".concat(width, " + ").concat(getOffset(themeSpacing), ")");
72
- more = {
73
- flexBasis: fullWidth,
74
- maxWidth: fullWidth
75
- };
76
- }
77
- } // Close to the bootstrap implementation:
78
- // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
33
+ export function generateGrid(_ref) {
34
+ var theme = _ref.theme,
35
+ ownerState = _ref.ownerState;
36
+ var size;
37
+ return theme.breakpoints.keys.reduce(function (globalStyles, breakpoint) {
38
+ // Use side effect over immutability for better performance.
39
+ var styles = {};
79
40
 
41
+ if (ownerState[breakpoint]) {
42
+ size = ownerState[breakpoint];
43
+ }
80
44
 
81
- styles = _extends({
82
- flexBasis: width,
83
- flexGrow: 0,
84
- maxWidth: width
85
- }, more);
86
- } // No need for a media query for the first size.
45
+ if (!size) {
46
+ return globalStyles;
47
+ }
87
48
 
49
+ if (size === true) {
50
+ // For the auto layouting
51
+ styles = {
52
+ flexBasis: 0,
53
+ flexGrow: 1,
54
+ maxWidth: '100%'
55
+ };
56
+ } else if (size === 'auto') {
57
+ styles = {
58
+ flexBasis: 'auto',
59
+ flexGrow: 0,
60
+ flexShrink: 0,
61
+ maxWidth: 'none',
62
+ width: 'auto'
63
+ };
64
+ } else {
65
+ var columnsBreakpointValues = resolveBreakpointValues({
66
+ values: ownerState.columns,
67
+ breakpoints: theme.breakpoints.values
68
+ });
69
+ var columnValue = _typeof(columnsBreakpointValues) === 'object' ? columnsBreakpointValues[breakpoint] : columnsBreakpointValues;
70
+
71
+ if (columnValue === undefined || columnValue === null) {
72
+ return globalStyles;
73
+ } // Keep 7 significant numbers.
74
+
75
+
76
+ var width = "".concat(Math.round(size / columnValue * 10e7) / 10e5, "%");
77
+ var more = {};
78
+
79
+ if (ownerState.container && ownerState.item && ownerState.columnSpacing !== 0) {
80
+ var themeSpacing = theme.spacing(ownerState.columnSpacing);
81
+
82
+ if (themeSpacing !== '0px') {
83
+ var fullWidth = "calc(".concat(width, " + ").concat(getOffset(themeSpacing), ")");
84
+ more = {
85
+ flexBasis: fullWidth,
86
+ maxWidth: fullWidth
87
+ };
88
+ }
89
+ } // Close to the bootstrap implementation:
90
+ // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
91
+
92
+
93
+ styles = _extends({
94
+ flexBasis: width,
95
+ flexGrow: 0,
96
+ maxWidth: width
97
+ }, more);
98
+ } // No need for a media query for the first size.
99
+
100
+
101
+ if (theme.breakpoints.values[breakpoint] === 0) {
102
+ _extends(globalStyles, styles);
103
+ } else {
104
+ globalStyles[theme.breakpoints.up(breakpoint)] = styles;
105
+ }
88
106
 
89
- if (theme.breakpoints.values[breakpoint] === 0) {
90
- _extends(globalStyles, styles);
91
- } else {
92
- globalStyles[theme.breakpoints.up(breakpoint)] = styles;
93
- }
107
+ return globalStyles;
108
+ }, {});
94
109
  }
95
-
96
- export function generateDirection(_ref) {
97
- var theme = _ref.theme,
98
- ownerState = _ref.ownerState;
110
+ export function generateDirection(_ref2) {
111
+ var theme = _ref2.theme,
112
+ ownerState = _ref2.ownerState;
99
113
  var directionValues = resolveBreakpointValues({
100
114
  values: ownerState.direction,
101
115
  breakpoints: theme.breakpoints.values
@@ -116,9 +130,9 @@ export function generateDirection(_ref) {
116
130
  return output;
117
131
  });
118
132
  }
119
- export function generateRowGap(_ref2) {
120
- var theme = _ref2.theme,
121
- ownerState = _ref2.ownerState;
133
+ export function generateRowGap(_ref3) {
134
+ var theme = _ref3.theme,
135
+ ownerState = _ref3.ownerState;
122
136
  var container = ownerState.container,
123
137
  rowSpacing = ownerState.rowSpacing;
124
138
  var styles = {};
@@ -147,9 +161,9 @@ export function generateRowGap(_ref2) {
147
161
 
148
162
  return styles;
149
163
  }
150
- export function generateColumnGap(_ref4) {
151
- var theme = _ref4.theme,
152
- ownerState = _ref4.ownerState;
164
+ export function generateColumnGap(_ref5) {
165
+ var theme = _ref5.theme,
166
+ ownerState = _ref5.ownerState;
153
167
  var container = ownerState.container,
154
168
  columnSpacing = ownerState.columnSpacing;
155
169
  var styles = {};
@@ -224,8 +238,8 @@ var GridRoot = styled('div', {
224
238
  zeroMinWidth = _props$ownerState.zeroMinWidth;
225
239
  return [styles.root, container && styles.container, item && styles.item, zeroMinWidth && styles.zeroMinWidth].concat(_toConsumableArray(resolveSpacingClasses(spacing, container, styles)), [direction !== 'row' && styles["direction-xs-".concat(String(direction))], wrap !== 'wrap' && styles["wrap-xs-".concat(String(wrap))], xs !== false && styles["grid-xs-".concat(String(xs))], sm !== false && styles["grid-sm-".concat(String(sm))], md !== false && styles["grid-md-".concat(String(md))], lg !== false && styles["grid-lg-".concat(String(lg))], xl !== false && styles["grid-xl-".concat(String(xl))]]);
226
240
  }
227
- })(function (_ref6) {
228
- var ownerState = _ref6.ownerState;
241
+ })(function (_ref7) {
242
+ var ownerState = _ref7.ownerState;
229
243
  return _extends({
230
244
  boxSizing: 'border-box'
231
245
  }, ownerState.container && {
@@ -242,15 +256,7 @@ var GridRoot = styled('div', {
242
256
  }, ownerState.wrap === 'reverse' && {
243
257
  flexWrap: 'wrap-reverse'
244
258
  });
245
- }, generateDirection, generateRowGap, generateColumnGap, function (_ref7) {
246
- var theme = _ref7.theme,
247
- ownerState = _ref7.ownerState;
248
- return theme.breakpoints.keys.reduce(function (globalStyles, breakpoint) {
249
- // Use side effect over immutability for better performance.
250
- generateGrid(globalStyles, theme, breakpoint, ownerState);
251
- return globalStyles;
252
- }, {});
253
- });
259
+ }, generateDirection, generateRowGap, generateColumnGap, generateGrid);
254
260
 
255
261
  var useUtilityClasses = function useUtilityClasses(ownerState) {
256
262
  var classes = ownerState.classes,
@@ -213,6 +213,7 @@ var InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref) {
213
213
  componentsProps = _props$componentsProp === void 0 ? {} : _props$componentsProp,
214
214
  defaultValue = props.defaultValue,
215
215
  disabled = props.disabled,
216
+ disableInjectingGlobalStyles = props.disableInjectingGlobalStyles,
216
217
  endAdornment = props.endAdornment,
217
218
  error = props.error,
218
219
  _props$fullWidth = props.fullWidth,
@@ -244,7 +245,7 @@ var InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref) {
244
245
  _props$type = props.type,
245
246
  type = _props$type === void 0 ? 'text' : _props$type,
246
247
  valueProp = props.value,
247
- other = _objectWithoutProperties(props, ["aria-describedby", "autoComplete", "autoFocus", "className", "color", "components", "componentsProps", "defaultValue", "disabled", "endAdornment", "error", "fullWidth", "id", "inputComponent", "inputProps", "inputRef", "margin", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "onKeyDown", "onKeyUp", "placeholder", "readOnly", "renderSuffix", "rows", "size", "startAdornment", "type", "value"]);
248
+ other = _objectWithoutProperties(props, ["aria-describedby", "autoComplete", "autoFocus", "className", "color", "components", "componentsProps", "defaultValue", "disabled", "disableInjectingGlobalStyles", "endAdornment", "error", "fullWidth", "id", "inputComponent", "inputProps", "inputRef", "margin", "maxRows", "minRows", "multiline", "name", "onBlur", "onChange", "onClick", "onFocus", "onKeyDown", "onKeyUp", "placeholder", "readOnly", "renderSuffix", "rows", "size", "startAdornment", "type", "value"]);
248
249
 
249
250
  var value = inputPropsProp.value != null ? inputPropsProp.value : valueProp;
250
251
 
@@ -459,7 +460,7 @@ var InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref) {
459
460
  var Input = components.Input || InputBaseComponent;
460
461
  inputProps = _extends({}, inputProps, componentsProps.input);
461
462
  return /*#__PURE__*/_jsxs(React.Fragment, {
462
- children: [inputGlobalStyles, /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, !isHostComponent(Root) && {
463
+ children: [!disableInjectingGlobalStyles && inputGlobalStyles, /*#__PURE__*/_jsxs(Root, _extends({}, rootProps, !isHostComponent(Root) && {
463
464
  ownerState: _extends({}, ownerState, rootProps.ownerState)
464
465
  }, {
465
466
  ref: ref,
@@ -573,6 +574,13 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes
573
574
  */
574
575
  disabled: PropTypes.bool,
575
576
 
577
+ /**
578
+ * If `true`, GlobalStyles for the auto-fill keyframes will not be injected/removed on mount/unmount. Make sure to inject them at the top of your application.
579
+ * This option is intended to help with boosting the initial rendering performance if you are loading a big amount of Input components at once.
580
+ * @default false
581
+ */
582
+ disableInjectingGlobalStyles: PropTypes.bool,
583
+
576
584
  /**
577
585
  * End `InputAdornment` for this component.
578
586
  */
@@ -6,10 +6,13 @@ import PropTypes from 'prop-types';
6
6
  import { refType } from '@mui/utils';
7
7
  import { unstable_composeClasses as composeClasses } from '@mui/base';
8
8
  import NotchedOutline from './NotchedOutline';
9
+ import useFormControl from '../FormControl/useFormControl';
10
+ import formControlState from '../FormControl/formControlState';
9
11
  import styled, { rootShouldForwardProp } from '../styles/styled';
10
12
  import outlinedInputClasses, { getOutlinedInputUtilityClass } from './outlinedInputClasses';
11
13
  import InputBase, { rootOverridesResolver as inputBaseRootOverridesResolver, inputOverridesResolver as inputBaseInputOverridesResolver, InputBaseRoot, InputBaseComponent as InputBaseInput } from '../InputBase/InputBase';
12
14
  import useThemeProps from '../styles/useThemeProps';
15
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
16
  import { jsx as _jsx } from "react/jsx-runtime";
14
17
 
15
18
  var useUtilityClasses = function useUtilityClasses(ownerState) {
@@ -98,6 +101,8 @@ var OutlinedInputInput = styled(InputBaseInput, {
98
101
  });
99
102
  });
100
103
  var OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps, ref) {
104
+ var _React$Fragment;
105
+
101
106
  var props = useThemeProps({
102
107
  props: inProps,
103
108
  name: 'MuiOutlinedInput'
@@ -118,6 +123,12 @@ var OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps
118
123
  other = _objectWithoutProperties(props, ["components", "fullWidth", "inputComponent", "label", "multiline", "notched", "type"]);
119
124
 
120
125
  var classes = useUtilityClasses(props);
126
+ var muiFormControl = useFormControl();
127
+ var fcs = formControlState({
128
+ props: props,
129
+ muiFormControl: muiFormControl,
130
+ states: ['required']
131
+ });
121
132
  return /*#__PURE__*/_jsx(InputBase, _extends({
122
133
  components: _extends({
123
134
  Root: OutlinedInputRoot,
@@ -126,7 +137,9 @@ var OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps
126
137
  renderSuffix: function renderSuffix(state) {
127
138
  return /*#__PURE__*/_jsx(NotchedOutlineRoot, {
128
139
  className: classes.notchedOutline,
129
- label: label,
140
+ label: label && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
141
+ children: [label, "\xA0", '*']
142
+ })) : label,
130
143
  notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
131
144
  });
132
145
  },
@@ -426,12 +426,18 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
426
426
 
427
427
  if (computeDisplay) {
428
428
  if (multiple) {
429
- if (value.length === 0) {
430
- display = '';
429
+ if (displayMultiple.length === 0) {
430
+ display = null;
431
431
  } else {
432
- display = displayMultiple.reduce(function (prev, curr) {
433
- return [prev, ', ', curr];
434
- });
432
+ display = displayMultiple.reduce(function (output, child, index) {
433
+ output.push(child);
434
+
435
+ if (index < displayMultiple.length - 1) {
436
+ output.push(', ');
437
+ }
438
+
439
+ return output;
440
+ }, []);
435
441
  }
436
442
  } else {
437
443
  display = displaySingle;
@@ -72,30 +72,38 @@ var SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
72
72
  _props$fontSize = props.fontSize,
73
73
  fontSize = _props$fontSize === void 0 ? 'medium' : _props$fontSize,
74
74
  htmlColor = props.htmlColor,
75
+ _props$inheritViewBox = props.inheritViewBox,
76
+ inheritViewBox = _props$inheritViewBox === void 0 ? false : _props$inheritViewBox,
75
77
  titleAccess = props.titleAccess,
76
78
  _props$viewBox = props.viewBox,
77
79
  viewBox = _props$viewBox === void 0 ? '0 0 24 24' : _props$viewBox,
78
- other = _objectWithoutProperties(props, ["children", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"]);
80
+ other = _objectWithoutProperties(props, ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"]);
79
81
 
80
82
  var ownerState = _extends({}, props, {
81
83
  color: color,
82
84
  component: component,
83
85
  fontSize: fontSize,
86
+ inheritViewBox: inheritViewBox,
84
87
  viewBox: viewBox
85
88
  });
86
89
 
90
+ var more = {};
91
+
92
+ if (!inheritViewBox) {
93
+ more.viewBox = viewBox;
94
+ }
95
+
87
96
  var classes = useUtilityClasses(ownerState);
88
97
  return /*#__PURE__*/_jsxs(SvgIconRoot, _extends({
89
98
  as: component,
90
99
  className: clsx(classes.root, className),
91
100
  ownerState: ownerState,
92
101
  focusable: "false",
93
- viewBox: viewBox,
94
102
  color: htmlColor,
95
103
  "aria-hidden": titleAccess ? undefined : true,
96
104
  role: titleAccess ? 'img' : undefined,
97
105
  ref: ref
98
- }, other, {
106
+ }, more, other, {
99
107
  children: [children, titleAccess ? /*#__PURE__*/_jsx("title", {
100
108
  children: titleAccess
101
109
  }) : null]
@@ -152,6 +160,15 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes
152
160
  */
153
161
  htmlColor: PropTypes.string,
154
162
 
163
+ /**
164
+ * If `true`, the root node will inherit the custom `component`'s viewBox and the `viewBox`
165
+ * prop will be ignored.
166
+ * Useful when you want to reference a custom `component` and have `SvgIcon` pass that
167
+ * `component`'s viewBox to the root node.
168
+ * @default false
169
+ */
170
+ inheritViewBox: PropTypes.bool,
171
+
155
172
  /**
156
173
  * The shape-rendering attribute. The behavior of the different options is described on the
157
174
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).
@@ -15,8 +15,8 @@ import FormControl from '../FormControl';
15
15
  import FormHelperText from '../FormHelperText';
16
16
  import Select from '../Select';
17
17
  import { getTextFieldUtilityClass } from './textFieldClasses';
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
18
  import { jsx as _jsx } from "react/jsx-runtime";
19
+ import { jsxs as _jsxs } from "react/jsx-runtime";
20
20
  var variantComponent = {
21
21
  standard: Input,
22
22
  filled: FilledInput,
@@ -147,14 +147,7 @@ var TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref) {
147
147
  InputMore.notched = InputLabelProps.shrink;
148
148
  }
149
149
 
150
- if (label) {
151
- var _InputLabelProps$requ;
152
-
153
- var displayRequired = (_InputLabelProps$requ = InputLabelProps == null ? void 0 : InputLabelProps.required) != null ? _InputLabelProps$requ : required;
154
- InputMore.label = /*#__PURE__*/_jsxs(React.Fragment, {
155
- children: [label, displayRequired && "\xA0*"]
156
- });
157
- }
150
+ InputMore.label = label;
158
151
  }
159
152
 
160
153
  if (select) {
package/legacy/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license MUI v5.2.3
1
+ /** @license MUI v5.2.7
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.