@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
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
+ <!-- markdownlint-disable-next-line -->
1
2
  <p align="center">
2
- <a href="https://mui.com/" rel="noopener" target="_blank"><img width="150" src="https://mui.com/static/logo.svg" alt="MUI logo"></a></p>
3
+ <a href="https://mui.com/" rel="noopener" target="_blank"><img width="150" src="https://mui.com/static/logo.svg" alt="MUI logo"></a>
3
4
  </p>
4
5
 
5
6
  <h1 align="center">MUI</h1>
@@ -14,11 +15,11 @@ Quickly build beautiful [React](https://reactjs.org/) apps. MUI is a simple and
14
15
  [![npm downloads](https://img.shields.io/npm/dm/@mui/material.svg)](https://www.npmjs.com/package/@mui/material)
15
16
  [![CircleCI](https://circleci.com/gh/mui-org/material-ui/tree/master.svg?style=shield)](https://app.circleci.com/pipelines/github/mui-org/material-ui?branch=master)
16
17
  [![Coverage Status](https://img.shields.io/codecov/c/github/mui-org/material-ui/master.svg)](https://codecov.io/gh/mui-org/material-ui/branch/master)
17
- [![Follow on Twitter](https://img.shields.io/twitter/follow/MaterialUI.svg?label=follow+Material-UI)](https://twitter.com/MaterialUI)
18
+ [![Follow on Twitter](https://img.shields.io/twitter/follow/MUI_hq.svg?label=follow+MUI)](https://twitter.com/MUI_hq)
18
19
  [![Renovate status](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://github.com/mui-org/material-ui/issues/27062)
19
20
  [![Average time to resolve an issue](https://isitmaintained.com/badge/resolution/mui-org/material-ui.svg)](https://isitmaintained.com/project/mui-org/material-ui 'Average time to resolve an issue')
20
21
  [![Crowdin](https://badges.crowdin.net/material-ui-docs/localized.svg)](https://translate.mui.com/project/material-ui-docs)
21
- [![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/material-ui)](https://opencollective.com/mui)
22
+ [![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/mui)](https://opencollective.com/mui)
22
23
 
23
24
  </div>
24
25
 
@@ -51,37 +52,31 @@ Please note that `@next` will only point to pre-releases; to get the latest stab
51
52
 
52
53
  ### Diamond 💎
53
54
 
54
- <p style="display: flex; justify-content: center;">
55
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="octopus" href="https://octopus.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="128" width="128" src="https://avatars3.githubusercontent.com/u/1287123?s=256" alt="octopus" title="Repeatable, reliable deployments" loading="lazy" /></a>
56
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="doit-intl" href="https://www.doit-intl.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="128" width="128" src="https://avatars3.githubusercontent.com/u/8424863?s=256" alt="doit-intl" title="Management Platform for Google Cloud and AWS" loading="lazy" /></a>
57
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="aptugo" href="https://www.aptugo.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="128" width="128" src="https://www.aptugo.com/img/favicon.png" alt="aptugo" title="Augmented Software Development Platform" loading="lazy" /></a>
55
+ <p align="center">
56
+ <a href="https://octopus.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="128" width="128" src="https://avatars3.githubusercontent.com/u/1287123?s=256" alt="octopus" title="Repeatable, reliable deployments" loading="lazy" /></a>
57
+ <a href="https://www.doit-intl.com/flexsave/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="128" width="128" src="https://avatars3.githubusercontent.com/u/8424863?s=256" alt="doit-intl" title="Management Platform for Google Cloud and AWS" loading="lazy" /></a>
58
+ <a href="https://www.aptugo.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="128" width="128" src="https://www.aptugo.com/img/favicon.png" alt="aptugo" title="Augmented Software Development Platform" loading="lazy" /></a>
58
59
  </p>
59
60
 
60
61
  Diamond Sponsors are those who have pledged \$1,500/month or more to MUI.
61
62
 
62
63
  ### Gold 🏆
63
64
 
64
- via [Patreon](https://www.patreon.com/oliviertassinari)
65
-
66
- <p style="display: flex; justify-content: center;">
67
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="tidelift" href="https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=homepage" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://github.com/tidelift.png?size=192" alt="tidelift" title="Enterprise-ready open-source software" loading="lazy" /></a>
68
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="bitsrc" href="https://bit.dev/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://github.com/teambit.png?size=192" alt="bitsrc" title="The fastest way to share code" loading="lazy" /></a>
69
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="movavi" href="https://spicefactory.co/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://avatars.githubusercontent.com/u/13365608?s=192" alt="Next gen digital product studio." loading="lazy" /></a>
70
- </p>
65
+ via [OpenCollective](https://opencollective.com/mui) or via [Patreon](https://www.patreon.com/oliviertassinari)
71
66
 
72
- via [OpenCollective](https://opencollective.com/mui)
73
-
74
- <p style="display: flex; justify-content: center; flex-wrap: wrap;">
75
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="textemall" href="https://www.text-em-all.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img src="https://images.opencollective.com/callemall/a6946da/logo/192.png" alt="call-em-all" title="Mass Text Messaging & Automated Calling" height="96" width="96" loading="lazy"></a>
76
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="hoodiebees" href="https://hoodiebees.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/hoodiebees1/617b451/logo/192.png" alt="hoodiebees" loading="lazy" /></a>
77
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="movavi" href="https://www.movavi.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/movavi-software/a1d0167/logo/192.png" alt="Screen recorder for Mac" loading="lazy" /></a>
78
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="sunmatosoft" href="https://sumatosoft.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/sumatosoft_company/0b78570/avatar/192.png" alt="We help companies to digitalize their businesses" loading="lazy" /></a>
79
- <a data-ga-event-category="sponsor" data-ga-event-action="logo" data-ga-event-label="topaussiecasinos.com" href="https://topaussiecasinos.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-right: 16px;"><img height="96" width="96" src="https://images.opencollective.com/aussiecasinohex/923df37/logo/192.png" alt="Aussie Gambling Guide" loading="lazy" /></a>
67
+ <p align="center">
68
+ <a href="https://tidelift.com/subscription/pkg/npm-material-ui?utm_source=npm-material-ui&utm_medium=referral&utm_campaign=homepage" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://github.com/tidelift.png?size=192" alt="tidelift.com" title="Enterprise-ready open-source software" loading="lazy" /></a>
69
+ <a href="https://bit.dev/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank" style="margin-rig ht: 16px;"><img height="96" width="96" src="https://github.com/teambit.png?size=192" alt="bit.dev" title="The fastest way to share code" loading="lazy" /></a>
70
+ <a href="https://www.text-em-all.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img src="https://images.opencollective.com/callemall/09710fe/logo/192.png" alt="text-em-all.com" title="Mass Text Messaging & Automated Calling" height="96" width="96" loading="lazy"></a>
71
+ <a href="https://www.laststance.io/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://images.opencollective.com/laststance/daffd6c/avatar/192.png" alt="laststance.io" title="Indipendent organization for OSS activity based on Tokyo" loading="lazy" /></a>
72
+ <a href="https://www.movavi.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://images.opencollective.com/movavi-software/a1d0167/logo/192.png" alt="movavi.com" title="Screen recorder for Mac" loading="lazy" /></a>
73
+ <a href="https://topaussiecasinos.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://images.opencollective.com/aussiecasinohex/923df37/logo/192.png" alt="topaussiecasinos.com" title="Aussie Gambling Guide" loading="lazy" /></a>
74
+ <a href="https://sumatosoft.com/?utm_source=MUI&utm_medium=referral&utm_content=readme" rel="noopener sponsored" target="_blank"><img height="96" width="96" src="https://images.opencollective.com/sumatosoft_company/0b78570/avatar/192.png" alt="sumatosoft.com" title="We help companies to digitalize their businesses" loading="lazy" /></a>
80
75
  </p>
81
76
 
82
77
  Gold Sponsors are those who have pledged \$500/month or more to MUI.
83
78
 
84
- ### There is more!
79
+ ### There is more
85
80
 
86
81
  See the full list of [our backers](https://mui.com/discover-more/backers/).
87
82
 
@@ -126,7 +121,7 @@ Check out our [documentation website](https://mui.com/).
126
121
 
127
122
  ## Premium Themes
128
123
 
129
- You can find complete templates & themes in the [MUI Store](https://material-ui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=readme-store).
124
+ You can find complete templates & themes in the [MUI Store](https://mui.com/store/?utm_source=docs&utm_medium=referral&utm_campaign=readme-store).
130
125
 
131
126
  ## Contributing
132
127
 
@@ -29,6 +29,12 @@ export interface SelectProps<T = unknown>
29
29
  * @default {}
30
30
  */
31
31
  classes?: Partial<SelectClasses>;
32
+ /**
33
+ * If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
34
+ * You can only use it when the `native` prop is `false` (default).
35
+ * @default false
36
+ */
37
+ defaultOpen?: boolean;
32
38
  /**
33
39
  * The default value. Use when the component is not controlled.
34
40
  */
@@ -155,6 +161,8 @@ export interface SelectProps<T = unknown>
155
161
  * - [Select API](https://mui.com/api/select/)
156
162
  * - inherits [OutlinedInput API](https://mui.com/api/outlined-input/)
157
163
  */
158
- declare const Select: (<T>(props: SelectProps<T>) => JSX.Element) & { muiName: string };
164
+ declare const Select: (<T>(props: SelectProps<T>) => JSX.Element) & {
165
+ muiName: string;
166
+ };
159
167
 
160
168
  export default Select;
package/Select/Select.js CHANGED
@@ -3,7 +3,7 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
3
3
 
4
4
  var _Input, _FilledInput;
5
5
 
6
- const _excluded = ["autoWidth", "children", "classes", "className", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
6
+ const _excluded = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
@@ -38,6 +38,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
38
38
  children,
39
39
  classes: classesProp = {},
40
40
  className,
41
+ defaultOpen = false,
41
42
  displayEmpty = false,
42
43
  IconComponent = ArrowDropDownIcon,
43
44
  id,
@@ -94,6 +95,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
94
95
  id
95
96
  } : {
96
97
  autoWidth,
98
+ defaultOpen,
97
99
  displayEmpty,
98
100
  labelId,
99
101
  MenuProps,
@@ -148,6 +150,13 @@ process.env.NODE_ENV !== "production" ? Select.propTypes
148
150
  */
149
151
  className: PropTypes.string,
150
152
 
153
+ /**
154
+ * If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
155
+ * You can only use it when the `native` prop is `false` (default).
156
+ * @default false
157
+ */
158
+ defaultOpen: PropTypes.bool,
159
+
151
160
  /**
152
161
  * The default value. Use when the component is not controlled.
153
162
  */
@@ -15,6 +15,7 @@ export type SelectChangeEvent<T = string> =
15
15
  export interface SelectInputProps<T = unknown> {
16
16
  autoFocus?: boolean;
17
17
  autoWidth: boolean;
18
+ defaultOpen?: boolean;
18
19
  disabled?: boolean;
19
20
  IconComponent?: React.ElementType;
20
21
  inputRef?: (
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
4
- const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
4
+ const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultOpen", "defaultValue", "disabled", "displayEmpty", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
5
5
  import * as React from 'react';
6
6
  import { isFragment } from 'react-is';
7
7
  import PropTypes from 'prop-types';
@@ -113,6 +113,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
113
113
  autoWidth,
114
114
  children,
115
115
  className,
116
+ defaultOpen,
116
117
  defaultValue,
117
118
  disabled,
118
119
  displayEmpty,
@@ -142,6 +143,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
142
143
  default: defaultValue,
143
144
  name: 'Select'
144
145
  });
146
+ const [openState, setOpenState] = useControlled({
147
+ controlled: openProp,
148
+ default: defaultOpen,
149
+ name: 'Select'
150
+ });
145
151
  const inputRef = React.useRef(null);
146
152
  const displayRef = React.useRef(null);
147
153
  const [displayNode, setDisplayNode] = React.useState(null);
@@ -149,7 +155,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
149
155
  current: isOpenControlled
150
156
  } = React.useRef(openProp != null);
151
157
  const [menuMinWidthState, setMenuMinWidthState] = React.useState();
152
- const [openState, setOpenState] = React.useState(false);
153
158
  const handleRef = useForkRef(ref, inputRefProp);
154
159
  const handleDisplayRef = React.useCallback(node => {
155
160
  displayRef.current = node;
@@ -164,7 +169,17 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
164
169
  },
165
170
  node: inputRef.current,
166
171
  value
167
- }), [value]);
172
+ }), [value]); // Resize menu on `defaultOpen` automatic toggle.
173
+
174
+ React.useEffect(() => {
175
+ if (defaultOpen && openState && displayNode && !isOpenControlled) {
176
+ setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
177
+ displayRef.current.focus();
178
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
179
+
180
+ }, [displayNode, autoWidth]); // `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
181
+ // `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
182
+
168
183
  React.useEffect(() => {
169
184
  if (autoFocus) {
170
185
  displayRef.current.focus();
@@ -300,7 +315,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
300
315
  }
301
316
  };
302
317
 
303
- const open = displayNode !== null && (isOpenControlled ? openProp : openState);
318
+ const open = displayNode !== null && openState;
304
319
 
305
320
  const handleBlur = event => {
306
321
  // if open event.stopImmediatePropagation
@@ -559,6 +574,12 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
559
574
  */
560
575
  className: PropTypes.string,
561
576
 
577
+ /**
578
+ * If `true`, the component is toggled on mount. Use when the component open state is not controlled.
579
+ * You can only use it when the `native` prop is `false` (default).
580
+ */
581
+ defaultOpen: PropTypes.bool,
582
+
562
583
  /**
563
584
  * The default value. Use when the component is not controlled.
564
585
  */
@@ -60,6 +60,7 @@ type SliderRailProps = NonNullable<SliderTypeMap['props']['componentsProps']>['r
60
60
  type SliderTrackProps = NonNullable<SliderTypeMap['props']['componentsProps']>['track'];
61
61
  type SliderThumbProps = NonNullable<SliderTypeMap['props']['componentsProps']>['thumb'];
62
62
  type SliderValueLabelProps = NonNullable<SliderTypeMap['props']['componentsProps']>['valueLabel'];
63
+ type SliderInputProps = NonNullable<SliderTypeMap['props']['componentsProps']>['input'];
63
64
 
64
65
  export const SliderRoot: React.FC<SliderRootProps>;
65
66
  export const SliderMark: React.FC<SliderMarkProps>;
@@ -68,6 +69,7 @@ export const SliderRail: React.FC<SliderRailProps>;
68
69
  export const SliderTrack: React.FC<SliderTrackProps>;
69
70
  export const SliderThumb: React.FC<SliderThumbProps>;
70
71
  export const SliderValueLabel: React.FC<SliderValueLabelProps>;
72
+ export const SliderInput: React.FC<SliderInputProps>;
71
73
 
72
74
  /**
73
75
  *
package/Slider/Slider.js CHANGED
@@ -1,20 +1,21 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["components", "componentsProps", "color", "size"];
3
+ const _excluded = ["component", "components", "componentsProps", "color", "size"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { chainPropTypes } from '@mui/utils';
8
- import { generateUtilityClasses, isHostComponent } from '@mui/base';
8
+ import { generateUtilityClasses } from '@mui/base';
9
9
  import SliderUnstyled, { SliderValueLabelUnstyled, sliderUnstyledClasses, getSliderUtilityClass } from '@mui/base/SliderUnstyled';
10
10
  import { alpha, lighten, darken } from '@mui/system';
11
11
  import useThemeProps from '../styles/useThemeProps';
12
12
  import styled, { slotShouldForwardProp } from '../styles/styled';
13
13
  import useTheme from '../styles/useTheme';
14
+ import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
14
15
  import capitalize from '../utils/capitalize';
15
16
  import { jsx as _jsx } from "react/jsx-runtime";
16
17
  export const sliderClasses = _extends({}, sliderUnstyledClasses, generateUtilityClasses('MuiSlider', ['colorPrimary', 'colorSecondary', 'thumbColorPrimary', 'thumbColorSecondary', 'sizeSmall', 'thumbSizeSmall']));
17
- export const SliderRoot = styled('span', {
18
+ const SliderRoot = styled('span', {
18
19
  name: 'MuiSlider',
19
20
  slot: 'Root',
20
21
  overridesResolver: (props, styles) => {
@@ -80,7 +81,21 @@ export const SliderRoot = styled('span', {
80
81
  }
81
82
  }
82
83
  }));
83
- export const SliderRail = styled('span', {
84
+ process.env.NODE_ENV !== "production" ? SliderRoot.propTypes
85
+ /* remove-proptypes */
86
+ = {
87
+ // ----------------------------- Warning --------------------------------
88
+ // | These PropTypes are generated from the TypeScript type definitions |
89
+ // | To update them edit the d.ts file and run "yarn proptypes" |
90
+ // ----------------------------------------------------------------------
91
+
92
+ /**
93
+ * @ignore
94
+ */
95
+ children: PropTypes.node
96
+ } : void 0;
97
+ export { SliderRoot };
98
+ const SliderRail = styled('span', {
84
99
  name: 'MuiSlider',
85
100
  slot: 'Rail',
86
101
  overridesResolver: (props, styles) => styles.rail
@@ -105,7 +120,21 @@ export const SliderRail = styled('span', {
105
120
  }, ownerState.track === 'inverted' && {
106
121
  opacity: 1
107
122
  }));
108
- export const SliderTrack = styled('span', {
123
+ process.env.NODE_ENV !== "production" ? SliderRail.propTypes
124
+ /* remove-proptypes */
125
+ = {
126
+ // ----------------------------- Warning --------------------------------
127
+ // | These PropTypes are generated from the TypeScript type definitions |
128
+ // | To update them edit the d.ts file and run "yarn proptypes" |
129
+ // ----------------------------------------------------------------------
130
+
131
+ /**
132
+ * @ignore
133
+ */
134
+ children: PropTypes.node
135
+ } : void 0;
136
+ export { SliderRail };
137
+ const SliderTrack = styled('span', {
109
138
  name: 'MuiSlider',
110
139
  slot: 'Track',
111
140
  overridesResolver: (props, styles) => styles.track
@@ -141,7 +170,21 @@ export const SliderTrack = styled('span', {
141
170
  borderColor: color
142
171
  });
143
172
  });
144
- export const SliderThumb = styled('span', {
173
+ process.env.NODE_ENV !== "production" ? SliderTrack.propTypes
174
+ /* remove-proptypes */
175
+ = {
176
+ // ----------------------------- Warning --------------------------------
177
+ // | These PropTypes are generated from the TypeScript type definitions |
178
+ // | To update them edit the d.ts file and run "yarn proptypes" |
179
+ // ----------------------------------------------------------------------
180
+
181
+ /**
182
+ * @ignore
183
+ */
184
+ children: PropTypes.node
185
+ } : void 0;
186
+ export { SliderTrack };
187
+ const SliderThumb = styled('span', {
145
188
  name: 'MuiSlider',
146
189
  slot: 'Thumb',
147
190
  overridesResolver: (props, styles) => {
@@ -213,7 +256,21 @@ export const SliderThumb = styled('span', {
213
256
  }
214
257
  }
215
258
  }));
216
- export const SliderValueLabel = styled(SliderValueLabelUnstyled, {
259
+ process.env.NODE_ENV !== "production" ? SliderThumb.propTypes
260
+ /* remove-proptypes */
261
+ = {
262
+ // ----------------------------- Warning --------------------------------
263
+ // | These PropTypes are generated from the TypeScript type definitions |
264
+ // | To update them edit the d.ts file and run "yarn proptypes" |
265
+ // ----------------------------------------------------------------------
266
+
267
+ /**
268
+ * @ignore
269
+ */
270
+ children: PropTypes.node
271
+ } : void 0;
272
+ export { SliderThumb };
273
+ const SliderValueLabel = styled(SliderValueLabelUnstyled, {
217
274
  name: 'MuiSlider',
218
275
  slot: 'ValueLabel',
219
276
  overridesResolver: (props, styles) => styles.valueLabel
@@ -257,7 +314,21 @@ export const SliderValueLabel = styled(SliderValueLabelUnstyled, {
257
314
  backgroundColor: 'inherit'
258
315
  }
259
316
  }));
260
- export const SliderMark = styled('span', {
317
+ process.env.NODE_ENV !== "production" ? SliderValueLabel.propTypes
318
+ /* remove-proptypes */
319
+ = {
320
+ // ----------------------------- Warning --------------------------------
321
+ // | These PropTypes are generated from the TypeScript type definitions |
322
+ // | To update them edit the d.ts file and run "yarn proptypes" |
323
+ // ----------------------------------------------------------------------
324
+
325
+ /**
326
+ * @ignore
327
+ */
328
+ children: PropTypes.node
329
+ } : void 0;
330
+ export { SliderValueLabel };
331
+ const SliderMark = styled('span', {
261
332
  name: 'MuiSlider',
262
333
  slot: 'Mark',
263
334
  shouldForwardProp: prop => slotShouldForwardProp(prop) && prop !== 'markActive',
@@ -282,7 +353,21 @@ export const SliderMark = styled('span', {
282
353
  backgroundColor: theme.palette.background.paper,
283
354
  opacity: 0.8
284
355
  }));
285
- export const SliderMarkLabel = styled('span', {
356
+ process.env.NODE_ENV !== "production" ? SliderMark.propTypes
357
+ /* remove-proptypes */
358
+ = {
359
+ // ----------------------------- Warning --------------------------------
360
+ // | These PropTypes are generated from the TypeScript type definitions |
361
+ // | To update them edit the d.ts file and run "yarn proptypes" |
362
+ // ----------------------------------------------------------------------
363
+
364
+ /**
365
+ * @ignore
366
+ */
367
+ children: PropTypes.node
368
+ } : void 0;
369
+ export { SliderMark };
370
+ const SliderMarkLabel = styled('span', {
286
371
  name: 'MuiSlider',
287
372
  slot: 'MarkLabel',
288
373
  shouldForwardProp: prop => slotShouldForwardProp(prop) && prop !== 'markLabelActive',
@@ -310,7 +395,9 @@ export const SliderMarkLabel = styled('span', {
310
395
  }, markLabelActive && {
311
396
  color: theme.palette.text.primary
312
397
  }));
313
- SliderRoot.propTypes = {
398
+ process.env.NODE_ENV !== "production" ? SliderMarkLabel.propTypes
399
+ /* remove-proptypes */
400
+ = {
314
401
  // ----------------------------- Warning --------------------------------
315
402
  // | These PropTypes are generated from the TypeScript type definitions |
316
403
  // | To update them edit the d.ts file and run "yarn proptypes" |
@@ -319,40 +406,9 @@ SliderRoot.propTypes = {
319
406
  /**
320
407
  * @ignore
321
408
  */
322
- children: PropTypes.node,
323
-
324
- /**
325
- * @ignore
326
- */
327
- ownerState: PropTypes.shape({
328
- 'aria-label': PropTypes.string,
329
- 'aria-labelledby': PropTypes.string,
330
- 'aria-valuetext': PropTypes.string,
331
- classes: PropTypes.object,
332
- color: PropTypes.oneOf(['primary', 'secondary']),
333
- defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
334
- disabled: PropTypes.bool,
335
- getAriaLabel: PropTypes.func,
336
- getAriaValueText: PropTypes.func,
337
- isRtl: PropTypes.bool,
338
- marks: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
339
- label: PropTypes.node,
340
- value: PropTypes.number.isRequired
341
- })), PropTypes.bool]),
342
- max: PropTypes.number,
343
- min: PropTypes.number,
344
- name: PropTypes.string,
345
- onChange: PropTypes.func,
346
- onChangeCommitted: PropTypes.func,
347
- orientation: PropTypes.oneOf(['horizontal', 'vertical']),
348
- scale: PropTypes.func,
349
- step: PropTypes.number,
350
- track: PropTypes.oneOf(['inverted', 'normal', false]),
351
- value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
352
- valueLabelDisplay: PropTypes.oneOf(['auto', 'off', 'on']),
353
- valueLabelFormat: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
354
- })
355
- };
409
+ children: PropTypes.node
410
+ } : void 0;
411
+ export { SliderMarkLabel };
356
412
 
357
413
  const extendUtilityClasses = ownerState => {
358
414
  const {
@@ -366,10 +422,6 @@ const extendUtilityClasses = ownerState => {
366
422
  });
367
423
  };
368
424
 
369
- const shouldSpreadOwnerState = Component => {
370
- return !Component || !isHostComponent(Component);
371
- };
372
-
373
425
  const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
374
426
  var _componentsProps$root, _componentsProps$thum, _componentsProps$trac, _componentsProps$valu;
375
427
 
@@ -381,6 +433,8 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
381
433
  const isRtl = theme.direction === 'rtl';
382
434
 
383
435
  const {
436
+ // eslint-disable-next-line react/prop-types
437
+ component = 'span',
384
438
  components = {},
385
439
  componentsProps = {},
386
440
  color = 'primary',
@@ -406,25 +460,26 @@ const Slider = /*#__PURE__*/React.forwardRef(function Slider(inputProps, ref) {
406
460
  MarkLabel: SliderMarkLabel
407
461
  }, components),
408
462
  componentsProps: _extends({}, componentsProps, {
409
- root: _extends({}, componentsProps.root, shouldSpreadOwnerState(components.Root) && {
463
+ root: _extends({}, componentsProps.root, shouldSpreadAdditionalProps(components.Root) && {
464
+ as: component,
410
465
  ownerState: _extends({}, (_componentsProps$root = componentsProps.root) == null ? void 0 : _componentsProps$root.ownerState, {
411
466
  color,
412
467
  size
413
468
  })
414
469
  }),
415
- thumb: _extends({}, componentsProps.thumb, shouldSpreadOwnerState(components.Thumb) && {
470
+ thumb: _extends({}, componentsProps.thumb, shouldSpreadAdditionalProps(components.Thumb) && {
416
471
  ownerState: _extends({}, (_componentsProps$thum = componentsProps.thumb) == null ? void 0 : _componentsProps$thum.ownerState, {
417
472
  color,
418
473
  size
419
474
  })
420
475
  }),
421
- track: _extends({}, componentsProps.track, shouldSpreadOwnerState(components.Track) && {
476
+ track: _extends({}, componentsProps.track, shouldSpreadAdditionalProps(components.Track) && {
422
477
  ownerState: _extends({}, (_componentsProps$trac = componentsProps.track) == null ? void 0 : _componentsProps$trac.ownerState, {
423
478
  color,
424
479
  size
425
480
  })
426
481
  }),
427
- valueLabel: _extends({}, componentsProps.valueLabel, shouldSpreadOwnerState(components.ValueLabel) && {
482
+ valueLabel: _extends({}, componentsProps.valueLabel, shouldSpreadAdditionalProps(components.ValueLabel) && {
428
483
  ownerState: _extends({}, (_componentsProps$valu = componentsProps.valueLabel) == null ? void 0 : _componentsProps$valu.ownerState, {
429
484
  color,
430
485
  size
@@ -498,6 +553,7 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
498
553
  * @default {}
499
554
  */
500
555
  components: PropTypes.shape({
556
+ Input: PropTypes.elementType,
501
557
  Mark: PropTypes.elementType,
502
558
  MarkLabel: PropTypes.elementType,
503
559
  Rail: PropTypes.elementType,
@@ -511,7 +567,24 @@ process.env.NODE_ENV !== "production" ? Slider.propTypes
511
567
  * The props used for each slot inside the Slider.
512
568
  * @default {}
513
569
  */
514
- componentsProps: PropTypes.object,
570
+ componentsProps: PropTypes.shape({
571
+ input: PropTypes.object,
572
+ mark: PropTypes.object,
573
+ markLabel: PropTypes.object,
574
+ rail: PropTypes.object,
575
+ root: PropTypes.object,
576
+ thumb: PropTypes.object,
577
+ track: PropTypes.object,
578
+ valueLabel: PropTypes.shape({
579
+ className: PropTypes.string,
580
+ components: PropTypes.shape({
581
+ Root: PropTypes.elementType
582
+ }),
583
+ style: PropTypes.object,
584
+ value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.number]),
585
+ valueLabelDisplay: PropTypes.oneOf(['auto', 'off', 'on'])
586
+ })
587
+ }),
515
588
 
516
589
  /**
517
590
  * The default value. Use when the component is not controlled.
@@ -205,7 +205,9 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes
205
205
  * The props used for each slot inside.
206
206
  * @default {}
207
207
  */
208
- componentsProps: PropTypes.object,
208
+ componentsProps: PropTypes.shape({
209
+ label: PropTypes.object
210
+ }),
209
211
 
210
212
  /**
211
213
  * If `true`, the step is marked as failed.
@@ -48,6 +48,14 @@ export interface SvgIconTypeMap<P = {}, D extends React.ElementType = 'svg'> {
48
48
  * Applies a color attribute to the SVG element.
49
49
  */
50
50
  htmlColor?: string;
51
+ /**
52
+ * If `true`, the root node will inherit the custom `component`'s viewBox and the `viewBox`
53
+ * prop will be ignored.
54
+ * Useful when you want to reference a custom `component` and have `SvgIcon` pass that
55
+ * `component`'s viewBox to the root node.
56
+ * @default false
57
+ */
58
+ inheritViewBox?: boolean;
51
59
  /**
52
60
  * The shape-rendering attribute. The behavior of the different options is described on the
53
61
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "titleAccess", "viewBox"];
3
+ const _excluded = ["children", "className", "color", "component", "fontSize", "htmlColor", "inheritViewBox", "titleAccess", "viewBox"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
@@ -76,6 +76,7 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
76
76
  component = 'svg',
77
77
  fontSize = 'medium',
78
78
  htmlColor,
79
+ inheritViewBox = false,
79
80
  titleAccess,
80
81
  viewBox = '0 0 24 24'
81
82
  } = props,
@@ -85,21 +86,27 @@ const SvgIcon = /*#__PURE__*/React.forwardRef(function SvgIcon(inProps, ref) {
85
86
  color,
86
87
  component,
87
88
  fontSize,
89
+ inheritViewBox,
88
90
  viewBox
89
91
  });
90
92
 
93
+ const more = {};
94
+
95
+ if (!inheritViewBox) {
96
+ more.viewBox = viewBox;
97
+ }
98
+
91
99
  const classes = useUtilityClasses(ownerState);
92
100
  return /*#__PURE__*/_jsxs(SvgIconRoot, _extends({
93
101
  as: component,
94
102
  className: clsx(classes.root, className),
95
103
  ownerState: ownerState,
96
104
  focusable: "false",
97
- viewBox: viewBox,
98
105
  color: htmlColor,
99
106
  "aria-hidden": titleAccess ? undefined : true,
100
107
  role: titleAccess ? 'img' : undefined,
101
108
  ref: ref
102
- }, other, {
109
+ }, more, other, {
103
110
  children: [children, titleAccess ? /*#__PURE__*/_jsx("title", {
104
111
  children: titleAccess
105
112
  }) : null]
@@ -156,6 +163,15 @@ process.env.NODE_ENV !== "production" ? SvgIcon.propTypes
156
163
  */
157
164
  htmlColor: PropTypes.string,
158
165
 
166
+ /**
167
+ * If `true`, the root node will inherit the custom `component`'s viewBox and the `viewBox`
168
+ * prop will be ignored.
169
+ * Useful when you want to reference a custom `component` and have `SvgIcon` pass that
170
+ * `component`'s viewBox to the root node.
171
+ * @default false
172
+ */
173
+ inheritViewBox: PropTypes.bool,
174
+
159
175
  /**
160
176
  * The shape-rendering attribute. The behavior of the different options is described on the
161
177
  * [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/shape-rendering).