@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
package/node/Grid/Grid.js CHANGED
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports.default = void 0;
9
9
  exports.generateColumnGap = generateColumnGap;
10
10
  exports.generateDirection = generateDirection;
11
+ exports.generateGrid = generateGrid;
11
12
  exports.generateRowGap = generateRowGap;
12
13
  exports.resolveSpacingClasses = resolveSpacingClasses;
13
14
 
@@ -48,67 +49,83 @@ function getOffset(val) {
48
49
  return `${parse}${String(val).replace(String(parse), '') || 'px'}`;
49
50
  }
50
51
 
51
- function generateGrid(globalStyles, theme, breakpoint, ownerState) {
52
- const size = ownerState[breakpoint];
53
-
54
- if (!size) {
55
- return;
56
- }
57
-
58
- let styles = {};
59
-
60
- if (size === true) {
61
- // For the auto layouting
62
- styles = {
63
- flexBasis: 0,
64
- flexGrow: 1,
65
- maxWidth: '100%'
66
- };
67
- } else if (size === 'auto') {
68
- styles = {
69
- flexBasis: 'auto',
70
- flexGrow: 0,
71
- flexShrink: 0,
72
- maxWidth: 'none',
73
- width: 'auto'
74
- };
75
- } else {
76
- const columnsBreakpointValues = (0, _system.unstable_resolveBreakpointValues)({
77
- values: ownerState.columns,
78
- breakpoints: theme.breakpoints.values
79
- });
80
- const columnValue = typeof columnsBreakpointValues === 'object' ? columnsBreakpointValues[breakpoint] : columnsBreakpointValues; // Keep 7 significant numbers.
81
-
82
- const width = `${Math.round(size / columnValue * 10e7) / 10e5}%`;
83
- let more = {};
84
-
85
- if (ownerState.container && ownerState.item && ownerState.columnSpacing !== 0) {
86
- const themeSpacing = theme.spacing(ownerState.columnSpacing);
87
-
88
- if (themeSpacing !== '0px') {
89
- const fullWidth = `calc(${width} + ${getOffset(themeSpacing)})`;
90
- more = {
91
- flexBasis: fullWidth,
92
- maxWidth: fullWidth
93
- };
94
- }
95
- } // Close to the bootstrap implementation:
96
- // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
52
+ function generateGrid({
53
+ theme,
54
+ ownerState
55
+ }) {
56
+ let size;
57
+ return theme.breakpoints.keys.reduce((globalStyles, breakpoint) => {
58
+ // Use side effect over immutability for better performance.
59
+ let styles = {};
97
60
 
61
+ if (ownerState[breakpoint]) {
62
+ size = ownerState[breakpoint];
63
+ }
98
64
 
99
- styles = (0, _extends2.default)({
100
- flexBasis: width,
101
- flexGrow: 0,
102
- maxWidth: width
103
- }, more);
104
- } // No need for a media query for the first size.
65
+ if (!size) {
66
+ return globalStyles;
67
+ }
105
68
 
69
+ if (size === true) {
70
+ // For the auto layouting
71
+ styles = {
72
+ flexBasis: 0,
73
+ flexGrow: 1,
74
+ maxWidth: '100%'
75
+ };
76
+ } else if (size === 'auto') {
77
+ styles = {
78
+ flexBasis: 'auto',
79
+ flexGrow: 0,
80
+ flexShrink: 0,
81
+ maxWidth: 'none',
82
+ width: 'auto'
83
+ };
84
+ } else {
85
+ const columnsBreakpointValues = (0, _system.unstable_resolveBreakpointValues)({
86
+ values: ownerState.columns,
87
+ breakpoints: theme.breakpoints.values
88
+ });
89
+ const columnValue = typeof columnsBreakpointValues === 'object' ? columnsBreakpointValues[breakpoint] : columnsBreakpointValues;
90
+
91
+ if (columnValue === undefined || columnValue === null) {
92
+ return globalStyles;
93
+ } // Keep 7 significant numbers.
94
+
95
+
96
+ const width = `${Math.round(size / columnValue * 10e7) / 10e5}%`;
97
+ let more = {};
98
+
99
+ if (ownerState.container && ownerState.item && ownerState.columnSpacing !== 0) {
100
+ const themeSpacing = theme.spacing(ownerState.columnSpacing);
101
+
102
+ if (themeSpacing !== '0px') {
103
+ const fullWidth = `calc(${width} + ${getOffset(themeSpacing)})`;
104
+ more = {
105
+ flexBasis: fullWidth,
106
+ maxWidth: fullWidth
107
+ };
108
+ }
109
+ } // Close to the bootstrap implementation:
110
+ // https://github.com/twbs/bootstrap/blob/8fccaa2439e97ec72a4b7dc42ccc1f649790adb0/scss/mixins/_grid.scss#L41
111
+
112
+
113
+ styles = (0, _extends2.default)({
114
+ flexBasis: width,
115
+ flexGrow: 0,
116
+ maxWidth: width
117
+ }, more);
118
+ } // No need for a media query for the first size.
119
+
120
+
121
+ if (theme.breakpoints.values[breakpoint] === 0) {
122
+ Object.assign(globalStyles, styles);
123
+ } else {
124
+ globalStyles[theme.breakpoints.up(breakpoint)] = styles;
125
+ }
106
126
 
107
- if (theme.breakpoints.values[breakpoint] === 0) {
108
- Object.assign(globalStyles, styles);
109
- } else {
110
- globalStyles[theme.breakpoints.up(breakpoint)] = styles;
111
- }
127
+ return globalStyles;
128
+ }, {});
112
129
  }
113
130
 
114
131
  function generateDirection({
@@ -273,14 +290,7 @@ const GridRoot = (0, _styled.default)('div', {
273
290
  flexWrap: 'nowrap'
274
291
  }, ownerState.wrap === 'reverse' && {
275
292
  flexWrap: 'wrap-reverse'
276
- }), generateDirection, generateRowGap, generateColumnGap, ({
277
- theme,
278
- ownerState
279
- }) => theme.breakpoints.keys.reduce((globalStyles, breakpoint) => {
280
- // Use side effect over immutability for better performance.
281
- generateGrid(globalStyles, theme, breakpoint, ownerState);
282
- return globalStyles;
283
- }, {}));
293
+ }), generateDirection, generateRowGap, generateColumnGap, generateGrid);
284
294
 
285
295
  const useUtilityClasses = ownerState => {
286
296
  const {
@@ -45,7 +45,7 @@ var _inputBaseClasses = _interopRequireWildcard(require("./inputBaseClasses"));
45
45
 
46
46
  var _jsxRuntime = require("react/jsx-runtime");
47
47
 
48
- const _excluded = ["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"];
48
+ const _excluded = ["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"];
49
49
 
50
50
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
51
 
@@ -255,6 +255,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
255
255
  componentsProps = {},
256
256
  defaultValue,
257
257
  disabled,
258
+ disableInjectingGlobalStyles,
258
259
  endAdornment,
259
260
  fullWidth = false,
260
261
  id,
@@ -482,7 +483,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
482
483
  const Input = components.Input || InputBaseComponent;
483
484
  inputProps = (0, _extends2.default)({}, inputProps, componentsProps.input);
484
485
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
485
- children: [inputGlobalStyles, /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, (0, _extends2.default)({}, rootProps, !(0, _base.isHostComponent)(Root) && {
486
+ children: [!disableInjectingGlobalStyles && inputGlobalStyles, /*#__PURE__*/(0, _jsxRuntime.jsxs)(Root, (0, _extends2.default)({}, rootProps, !(0, _base.isHostComponent)(Root) && {
486
487
  ownerState: (0, _extends2.default)({}, ownerState, rootProps.ownerState)
487
488
  }, {
488
489
  ref: ref,
@@ -596,6 +597,13 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes
596
597
  */
597
598
  disabled: _propTypes.default.bool,
598
599
 
600
+ /**
601
+ * 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.
602
+ * This option is intended to help with boosting the initial rendering performance if you are loading a big amount of Input components at once.
603
+ * @default false
604
+ */
605
+ disableInjectingGlobalStyles: _propTypes.default.bool,
606
+
599
607
  /**
600
608
  * End `InputAdornment` for this component.
601
609
  */
@@ -21,6 +21,10 @@ var _base = require("@mui/base");
21
21
 
22
22
  var _NotchedOutline = _interopRequireDefault(require("./NotchedOutline"));
23
23
 
24
+ var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
25
+
26
+ var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
27
+
24
28
  var _styled = _interopRequireWildcard(require("../styles/styled"));
25
29
 
26
30
  var _outlinedInputClasses = _interopRequireWildcard(require("./outlinedInputClasses"));
@@ -126,6 +130,8 @@ const OutlinedInputInput = (0, _styled.default)(_InputBase.InputBaseComponent, {
126
130
  paddingRight: 0
127
131
  }));
128
132
  const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps, ref) {
133
+ var _React$Fragment;
134
+
129
135
  const props = (0, _useThemeProps.default)({
130
136
  props: inProps,
131
137
  name: 'MuiOutlinedInput'
@@ -141,6 +147,12 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
141
147
  } = props,
142
148
  other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
143
149
  const classes = useUtilityClasses(props);
150
+ const muiFormControl = (0, _useFormControl.default)();
151
+ const fcs = (0, _formControlState.default)({
152
+ props,
153
+ muiFormControl,
154
+ states: ['required']
155
+ });
144
156
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputBase.default, (0, _extends2.default)({
145
157
  components: (0, _extends2.default)({
146
158
  Root: OutlinedInputRoot,
@@ -148,7 +160,9 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
148
160
  }, components),
149
161
  renderSuffix: state => /*#__PURE__*/(0, _jsxRuntime.jsx)(NotchedOutlineRoot, {
150
162
  className: classes.notchedOutline,
151
- label: label,
163
+ label: label && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
164
+ children: [label, "\xA0", '*']
165
+ })) : label,
152
166
  notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
153
167
  }),
154
168
  fullWidth: fullWidth,
@@ -434,10 +434,18 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
434
434
 
435
435
  if (computeDisplay) {
436
436
  if (multiple) {
437
- if (value.length === 0) {
438
- display = '';
437
+ if (displayMultiple.length === 0) {
438
+ display = null;
439
439
  } else {
440
- display = displayMultiple.reduce((prev, curr) => [prev, ', ', curr]);
440
+ display = displayMultiple.reduce((output, child, index) => {
441
+ output.push(child);
442
+
443
+ if (index < displayMultiple.length - 1) {
444
+ output.push(', ');
445
+ }
446
+
447
+ return output;
448
+ }, []);
441
449
  }
442
450
  } else {
443
451
  display = displaySingle;
@@ -29,7 +29,7 @@ var _svgIconClasses = require("./svgIconClasses");
29
29
 
30
30
  var _jsxRuntime = require("react/jsx-runtime");
31
31
 
32
- const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"];
32
+ const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
33
33
 
34
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
35
 
@@ -98,6 +98,7 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
98
98
  component = 'svg',
99
99
  fontSize = 'medium',
100
100
  htmlColor,
101
+ inheritViewBox = false,
101
102
  titleAccess,
102
103
  viewBox = '0 0 24 24'
103
104
  } = props,
@@ -106,20 +107,26 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
106
107
  color,
107
108
  component,
108
109
  fontSize,
110
+ inheritViewBox,
109
111
  viewBox
110
112
  });
113
+ const more = {};
114
+
115
+ if (!inheritViewBox) {
116
+ more.viewBox = viewBox;
117
+ }
118
+
111
119
  const classes = useUtilityClasses(ownerState);
112
120
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(SvgIconRoot, (0, _extends2.default)({
113
121
  as: component,
114
122
  className: (0, _clsx.default)(classes.root, className),
115
123
  ownerState: ownerState,
116
124
  focusable: "false",
117
- viewBox: viewBox,
118
125
  color: htmlColor,
119
126
  "aria-hidden": titleAccess ? undefined : true,
120
127
  role: titleAccess ? 'img' : undefined,
121
128
  ref: ref
122
- }, other, {
129
+ }, more, other, {
123
130
  children: [children, titleAccess ? /*#__PURE__*/(0, _jsxRuntime.jsx)("title", {
124
131
  children: titleAccess
125
132
  }) : null]
@@ -176,6 +183,15 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes
176
183
  */
177
184
  htmlColor: _propTypes.default.string,
178
185
 
186
+ /**
187
+ * If `true`, the root node will inherit the custom `component`'s viewBox and the `viewBox`
188
+ * prop will be ignored.
189
+ * Useful when you want to reference a custom `component` and have `SvgIcon` pass that
190
+ * `component`'s viewBox to the root node.
191
+ * @default false
192
+ */
193
+ inheritViewBox: _propTypes.default.bool,
194
+
179
195
  /**
180
196
  * The shape-rendering attribute. The behavior of the different options is described on the
181
197
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).
@@ -169,14 +169,7 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
169
169
  InputMore.notched = InputLabelProps.shrink;
170
170
  }
171
171
 
172
- if (label) {
173
- var _InputLabelProps$requ;
174
-
175
- const displayRequired = (_InputLabelProps$requ = InputLabelProps == null ? void 0 : InputLabelProps.required) != null ? _InputLabelProps$requ : required;
176
- InputMore.label = /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
177
- children: [label, displayRequired && '\u00a0*']
178
- });
179
- }
172
+ InputMore.label = label;
180
173
  }
181
174
 
182
175
  if (select) {
package/node/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.