@mui/material 5.2.8 → 5.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Autocomplete/Autocomplete.d.ts +7 -0
- package/Autocomplete/Autocomplete.js +20 -10
- package/AvatarGroup/AvatarGroup.d.ts +10 -0
- package/AvatarGroup/AvatarGroup.js +19 -7
- package/Badge/Badge.js +5 -8
- package/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/Button/buttonClasses.d.ts +1 -1
- package/ButtonBase/ButtonBase.d.ts +5 -1
- package/ButtonBase/ButtonBase.js +15 -2
- package/ButtonBase/TouchRipple.js +1 -2
- package/CHANGELOG.md +308 -28
- package/Fab/Fab.d.ts +4 -1
- package/Fab/Fab.js +8 -20
- package/Fab/fabClasses.js +1 -1
- package/FormControlLabel/FormControlLabel.js +11 -3
- package/FormControlLabel/formControlLabelClasses.d.ts +2 -0
- package/FormControlLabel/formControlLabelClasses.js +1 -1
- package/FormGroup/FormGroup.js +14 -3
- package/FormGroup/formGroupClasses.d.ts +2 -0
- package/FormGroup/formGroupClasses.js +1 -1
- package/FormHelperText/FormHelperText.js +7 -9
- package/Grid/Grid.js +2 -4
- package/ImageList/ImageList.js +3 -1
- package/InputAdornment/InputAdornment.js +6 -9
- package/Modal/Modal.js +1 -1
- package/OutlinedInput/NotchedOutline.js +14 -16
- package/OutlinedInput/OutlinedInput.js +1 -1
- package/README.md +9 -9
- package/Radio/RadioButtonIcon.js +2 -6
- package/Rating/Rating.js +1 -1
- package/Select/Select.d.ts +9 -1
- package/Select/Select.js +10 -1
- package/Select/SelectInput.d.ts +1 -0
- package/Select/SelectInput.js +37 -14
- package/Slider/Slider.js +112 -55
- package/Snackbar/Snackbar.js +4 -1
- package/SvgIcon/SvgIcon.js +9 -9
- package/SwipeableDrawer/SwipeArea.js +1 -3
- package/TextField/TextField.js +1 -1
- package/index.d.ts +8 -3
- package/index.js +6 -3
- package/internal/SwitchBase.js +2 -6
- package/legacy/Autocomplete/Autocomplete.js +21 -10
- package/legacy/AvatarGroup/AvatarGroup.js +20 -7
- package/legacy/Badge/Badge.js +6 -8
- package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/legacy/ButtonBase/ButtonBase.js +15 -2
- package/legacy/ButtonBase/TouchRipple.js +1 -2
- package/legacy/Fab/Fab.js +8 -20
- package/legacy/Fab/fabClasses.js +1 -1
- package/legacy/FormControlLabel/FormControlLabel.js +11 -3
- package/legacy/FormControlLabel/formControlLabelClasses.js +1 -1
- package/legacy/FormGroup/FormGroup.js +14 -3
- package/legacy/FormGroup/formGroupClasses.js +1 -1
- package/legacy/FormHelperText/FormHelperText.js +7 -9
- package/legacy/Grid/Grid.js +2 -4
- package/legacy/ImageList/ImageList.js +3 -1
- package/legacy/InputAdornment/InputAdornment.js +6 -9
- package/legacy/Modal/Modal.js +1 -1
- package/legacy/OutlinedInput/NotchedOutline.js +14 -16
- package/legacy/OutlinedInput/OutlinedInput.js +1 -1
- package/legacy/Radio/RadioButtonIcon.js +2 -6
- package/legacy/Rating/Rating.js +1 -1
- package/legacy/Select/Select.js +11 -1
- package/legacy/Select/SelectInput.js +41 -17
- package/legacy/Slider/Slider.js +113 -56
- package/legacy/Snackbar/Snackbar.js +4 -1
- package/legacy/SvgIcon/SvgIcon.js +9 -9
- package/legacy/SwipeableDrawer/SwipeArea.js +1 -3
- package/legacy/TextField/TextField.js +1 -1
- package/legacy/index.js +6 -3
- package/legacy/internal/SwitchBase.js +2 -6
- package/legacy/styles/makeStyles.js +1 -1
- package/legacy/styles/withStyles.js +1 -1
- package/legacy/styles/withTheme.js +1 -1
- package/legacy/useMediaQuery/useMediaQuery.js +87 -32
- package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
- package/modern/Autocomplete/Autocomplete.js +19 -9
- package/modern/AvatarGroup/AvatarGroup.js +17 -7
- package/modern/Badge/Badge.js +5 -8
- package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/modern/ButtonBase/ButtonBase.js +15 -2
- package/modern/ButtonBase/TouchRipple.js +1 -2
- package/modern/Fab/Fab.js +8 -20
- package/modern/Fab/fabClasses.js +1 -1
- package/modern/FormControlLabel/FormControlLabel.js +11 -3
- package/modern/FormControlLabel/formControlLabelClasses.js +1 -1
- package/modern/FormGroup/FormGroup.js +14 -3
- package/modern/FormGroup/formGroupClasses.js +1 -1
- package/modern/FormHelperText/FormHelperText.js +7 -9
- package/modern/Grid/Grid.js +2 -4
- package/modern/ImageList/ImageList.js +3 -1
- package/modern/InputAdornment/InputAdornment.js +6 -9
- package/modern/Modal/Modal.js +1 -1
- package/modern/OutlinedInput/NotchedOutline.js +14 -16
- package/modern/OutlinedInput/OutlinedInput.js +1 -1
- package/modern/Radio/RadioButtonIcon.js +2 -6
- package/modern/Rating/Rating.js +1 -1
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +37 -14
- package/modern/Slider/Slider.js +112 -55
- package/modern/Snackbar/Snackbar.js +4 -1
- package/modern/SvgIcon/SvgIcon.js +8 -8
- package/modern/SwipeableDrawer/SwipeArea.js +1 -3
- package/modern/TextField/TextField.js +1 -1
- package/modern/index.js +6 -3
- package/modern/internal/SwitchBase.js +2 -6
- package/modern/styles/makeStyles.js +1 -1
- package/modern/styles/withStyles.js +1 -1
- package/modern/styles/withTheme.js +1 -1
- package/modern/useMediaQuery/useMediaQuery.js +69 -27
- package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
- package/node/Autocomplete/Autocomplete.js +20 -10
- package/node/AvatarGroup/AvatarGroup.js +19 -7
- package/node/Badge/Badge.js +7 -9
- package/node/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/node/ButtonBase/ButtonBase.js +15 -2
- package/node/ButtonBase/TouchRipple.js +1 -2
- package/node/Fab/Fab.js +8 -20
- package/node/Fab/fabClasses.js +1 -1
- package/node/FormControlLabel/FormControlLabel.js +12 -3
- package/node/FormControlLabel/formControlLabelClasses.js +1 -1
- package/node/FormGroup/FormGroup.js +15 -3
- package/node/FormGroup/formGroupClasses.js +1 -1
- package/node/FormHelperText/FormHelperText.js +6 -9
- package/node/Grid/Grid.js +2 -4
- package/node/ImageList/ImageList.js +3 -1
- package/node/InputAdornment/InputAdornment.js +5 -9
- package/node/Modal/Modal.js +1 -1
- package/node/OutlinedInput/NotchedOutline.js +12 -16
- package/node/OutlinedInput/OutlinedInput.js +1 -1
- package/node/Radio/RadioButtonIcon.js +2 -6
- package/node/Rating/Rating.js +1 -1
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +36 -14
- package/node/Slider/Slider.js +98 -47
- package/node/Snackbar/Snackbar.js +4 -1
- package/node/SvgIcon/SvgIcon.js +9 -9
- package/node/SwipeableDrawer/SwipeArea.js +1 -3
- package/node/TextField/TextField.js +1 -1
- package/node/index.js +41 -16
- package/node/internal/SwitchBase.js +2 -6
- package/node/styles/makeStyles.js +1 -1
- package/node/styles/withStyles.js +1 -1
- package/node/styles/withTheme.js +1 -1
- package/node/useMediaQuery/useMediaQuery.js +69 -27
- package/node/utils/shouldSpreadAdditionalProps.js +15 -0
- package/package.json +10 -10
- package/styles/ThemeProvider.d.ts +1 -1
- package/styles/components.d.ts +452 -113
- package/styles/createTheme.d.ts +12 -6
- package/styles/makeStyles.js +1 -1
- package/styles/overrides.d.ts +16 -4
- package/styles/useThemeProps.d.ts +2 -1
- package/styles/withStyles.js +1 -1
- package/styles/withTheme.js +1 -1
- package/umd/material-ui.development.js +5099 -7092
- package/umd/material-ui.production.min.js +21 -21
- package/useMediaQuery/useMediaQuery.d.ts +4 -0
- package/useMediaQuery/useMediaQuery.js +69 -27
- package/utils/shouldSpreadAdditionalProps.js +7 -0
|
@@ -11,6 +11,8 @@ export interface FormControlLabelClasses {
|
|
|
11
11
|
disabled: string;
|
|
12
12
|
/** Styles applied to the label's Typography component. */
|
|
13
13
|
label: string;
|
|
14
|
+
/** State class applied to the root element if `error={true}`. */
|
|
15
|
+
error: string;
|
|
14
16
|
}
|
|
15
17
|
export declare type FormControlLabelClassKey = keyof FormControlLabelClasses;
|
|
16
18
|
export declare function getFormControlLabelUtilityClasses(slot: string): string;
|
|
@@ -2,5 +2,5 @@ import { generateUtilityClasses, generateUtilityClass } from '@mui/base';
|
|
|
2
2
|
export function getFormControlLabelUtilityClasses(slot) {
|
|
3
3
|
return generateUtilityClass('MuiFormControlLabel', slot);
|
|
4
4
|
}
|
|
5
|
-
const formControlLabelClasses = generateUtilityClasses('MuiFormControlLabel', ['root', 'labelPlacementStart', 'labelPlacementTop', 'labelPlacementBottom', 'disabled', 'label']);
|
|
5
|
+
const formControlLabelClasses = generateUtilityClasses('MuiFormControlLabel', ['root', 'labelPlacementStart', 'labelPlacementTop', 'labelPlacementBottom', 'disabled', 'label', 'error']);
|
|
6
6
|
export default formControlLabelClasses;
|
package/FormGroup/FormGroup.js
CHANGED
|
@@ -8,15 +8,18 @@ import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
|
8
8
|
import styled from '../styles/styled';
|
|
9
9
|
import useThemeProps from '../styles/useThemeProps';
|
|
10
10
|
import { getFormGroupUtilityClass } from './formGroupClasses';
|
|
11
|
+
import useFormControl from '../FormControl/useFormControl';
|
|
12
|
+
import formControlState from '../FormControl/formControlState';
|
|
11
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
14
|
|
|
13
15
|
const useUtilityClasses = ownerState => {
|
|
14
16
|
const {
|
|
15
17
|
classes,
|
|
16
|
-
row
|
|
18
|
+
row,
|
|
19
|
+
error
|
|
17
20
|
} = ownerState;
|
|
18
21
|
const slots = {
|
|
19
|
-
root: ['root', row && 'row']
|
|
22
|
+
root: ['root', row && 'row', error && 'error']
|
|
20
23
|
};
|
|
21
24
|
return composeClasses(slots, getFormGroupUtilityClass, classes);
|
|
22
25
|
};
|
|
@@ -57,8 +60,16 @@ const FormGroup = /*#__PURE__*/React.forwardRef(function FormGroup(inProps, ref)
|
|
|
57
60
|
} = props,
|
|
58
61
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
59
62
|
|
|
63
|
+
const muiFormControl = useFormControl();
|
|
64
|
+
const fcs = formControlState({
|
|
65
|
+
props,
|
|
66
|
+
muiFormControl,
|
|
67
|
+
states: ['error']
|
|
68
|
+
});
|
|
69
|
+
|
|
60
70
|
const ownerState = _extends({}, props, {
|
|
61
|
-
row
|
|
71
|
+
row,
|
|
72
|
+
error: fcs.error
|
|
62
73
|
});
|
|
63
74
|
|
|
64
75
|
const classes = useUtilityClasses(ownerState);
|
|
@@ -3,6 +3,8 @@ export interface FormGroupClasses {
|
|
|
3
3
|
root: string;
|
|
4
4
|
/** Styles applied to the root element if `row={true}`. */
|
|
5
5
|
row: string;
|
|
6
|
+
/** State class applied to the root element if `error={true}`. */
|
|
7
|
+
error: string;
|
|
6
8
|
}
|
|
7
9
|
export declare type FormGroupClassKey = keyof FormGroupClasses;
|
|
8
10
|
export declare function getFormGroupUtilityClass(slot: string): string;
|
|
@@ -2,5 +2,5 @@ import { generateUtilityClass, generateUtilityClasses } from '@mui/base';
|
|
|
2
2
|
export function getFormGroupUtilityClass(slot) {
|
|
3
3
|
return generateUtilityClass('MuiFormGroup', slot);
|
|
4
4
|
}
|
|
5
|
-
const formGroupClasses = generateUtilityClasses('MuiFormGroup', ['root', 'row']);
|
|
5
|
+
const formGroupClasses = generateUtilityClasses('MuiFormGroup', ['root', 'row', 'error']);
|
|
6
6
|
export default formGroupClasses;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
|
|
4
|
+
var _span;
|
|
5
|
+
|
|
3
6
|
const _excluded = ["children", "className", "component", "disabled", "error", "filled", "focused", "margin", "required", "variant"];
|
|
4
7
|
import * as React from 'react';
|
|
5
8
|
import PropTypes from 'prop-types';
|
|
@@ -101,16 +104,11 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
101
104
|
className: clsx(classes.root, className),
|
|
102
105
|
ref: ref
|
|
103
106
|
}, other, {
|
|
104
|
-
children: children === ' ' ?
|
|
105
|
-
/*#__PURE__*/
|
|
106
|
-
// notranslate needed while Google Translate will not fix zero-width space issue
|
|
107
|
-
// eslint-disable-next-line react/no-danger
|
|
108
|
-
_jsx("span", {
|
|
107
|
+
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
108
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
109
109
|
className: "notranslate",
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
}) : children
|
|
110
|
+
children: "\u200B"
|
|
111
|
+
})) : children
|
|
114
112
|
}));
|
|
115
113
|
});
|
|
116
114
|
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes
|
package/Grid/Grid.js
CHANGED
|
@@ -260,10 +260,8 @@ const GridRoot = styled('div', {
|
|
|
260
260
|
|
|
261
261
|
}, ownerState.zeroMinWidth && {
|
|
262
262
|
minWidth: 0
|
|
263
|
-
}, ownerState.wrap
|
|
264
|
-
flexWrap:
|
|
265
|
-
}, ownerState.wrap === 'reverse' && {
|
|
266
|
-
flexWrap: 'wrap-reverse'
|
|
263
|
+
}, ownerState.wrap !== 'wrap' && {
|
|
264
|
+
flexWrap: ownerState.wrap
|
|
267
265
|
}), generateDirection, generateRowGap, generateColumnGap, generateGrid);
|
|
268
266
|
|
|
269
267
|
const useUtilityClasses = ownerState => {
|
package/ImageList/ImageList.js
CHANGED
|
@@ -169,6 +169,8 @@ process.env.NODE_ENV !== "production" ? ImageList.propTypes
|
|
|
169
169
|
* The variant to use.
|
|
170
170
|
* @default 'standard'
|
|
171
171
|
*/
|
|
172
|
-
variant: PropTypes
|
|
172
|
+
variant: PropTypes
|
|
173
|
+
/* @typescript-to-proptypes-ignore */
|
|
174
|
+
.oneOfType([PropTypes.oneOf(['masonry', 'quilted', 'standard', 'woven']), PropTypes.string])
|
|
173
175
|
} : void 0;
|
|
174
176
|
export default ImageList;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
|
|
4
|
+
var _span;
|
|
5
|
+
|
|
3
6
|
const _excluded = ["children", "className", "component", "disablePointerEvents", "disableTypography", "position", "variant"];
|
|
4
7
|
import * as React from 'react';
|
|
5
8
|
import PropTypes from 'prop-types';
|
|
@@ -121,17 +124,11 @@ const InputAdornment = /*#__PURE__*/React.forwardRef(function InputAdornment(inP
|
|
|
121
124
|
children: children
|
|
122
125
|
}) : /*#__PURE__*/_jsxs(React.Fragment, {
|
|
123
126
|
children: [position === 'start' ?
|
|
124
|
-
/*#__PURE__*/
|
|
125
|
-
|
|
126
127
|
/* notranslate needed while Google Translate will not fix zero-width space issue */
|
|
127
|
-
|
|
128
|
-
/* eslint-disable-next-line react/no-danger */
|
|
129
|
-
_jsx("span", {
|
|
128
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
130
129
|
className: "notranslate",
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
}
|
|
134
|
-
}) : null, children]
|
|
130
|
+
children: "\u200B"
|
|
131
|
+
})) : null, children]
|
|
135
132
|
})
|
|
136
133
|
}))
|
|
137
134
|
});
|
package/Modal/Modal.js
CHANGED
|
@@ -228,7 +228,7 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
|
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* If `true`, the modal will not restore focus to previously focused element once
|
|
231
|
-
* modal is hidden.
|
|
231
|
+
* modal is hidden or unmounted.
|
|
232
232
|
* @default false
|
|
233
233
|
*/
|
|
234
234
|
disableRestoreFocus: PropTypes.bool,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
|
|
4
|
+
var _span;
|
|
5
|
+
|
|
3
6
|
const _excluded = ["children", "classes", "className", "label", "notched"];
|
|
4
7
|
import * as React from 'react';
|
|
5
8
|
import PropTypes from 'prop-types';
|
|
@@ -21,14 +24,12 @@ const NotchedOutlineRoot = styled('fieldset')({
|
|
|
21
24
|
overflow: 'hidden',
|
|
22
25
|
minWidth: '0%'
|
|
23
26
|
});
|
|
24
|
-
const NotchedOutlineLegend = styled('legend'
|
|
25
|
-
skipSx: true
|
|
26
|
-
})(({
|
|
27
|
+
const NotchedOutlineLegend = styled('legend')(({
|
|
27
28
|
ownerState,
|
|
28
29
|
theme
|
|
29
30
|
}) => _extends({
|
|
30
31
|
float: 'unset'
|
|
31
|
-
}, ownerState.
|
|
32
|
+
}, !ownerState.withLabel && {
|
|
32
33
|
padding: 0,
|
|
33
34
|
lineHeight: '11px',
|
|
34
35
|
// sync with `height` in `legend` styles
|
|
@@ -36,7 +37,7 @@ const NotchedOutlineLegend = styled('legend', {
|
|
|
36
37
|
duration: 150,
|
|
37
38
|
easing: theme.transitions.easing.easeOut
|
|
38
39
|
})
|
|
39
|
-
}, ownerState.
|
|
40
|
+
}, ownerState.withLabel && _extends({
|
|
40
41
|
display: 'block',
|
|
41
42
|
// Fix conflict with normalize.css and sanitize.css
|
|
42
43
|
width: 'auto',
|
|
@@ -77,9 +78,11 @@ export default function NotchedOutline(props) {
|
|
|
77
78
|
} = props,
|
|
78
79
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
79
80
|
|
|
81
|
+
const withLabel = label != null && label !== '';
|
|
82
|
+
|
|
80
83
|
const ownerState = _extends({}, props, {
|
|
81
84
|
notched,
|
|
82
|
-
|
|
85
|
+
withLabel
|
|
83
86
|
});
|
|
84
87
|
|
|
85
88
|
return /*#__PURE__*/_jsx(NotchedOutlineRoot, _extends({
|
|
@@ -89,18 +92,13 @@ export default function NotchedOutline(props) {
|
|
|
89
92
|
}, other, {
|
|
90
93
|
children: /*#__PURE__*/_jsx(NotchedOutlineLegend, {
|
|
91
94
|
ownerState: ownerState,
|
|
92
|
-
children:
|
|
95
|
+
children: withLabel ? /*#__PURE__*/_jsx("span", {
|
|
93
96
|
children: label
|
|
94
|
-
}) :
|
|
95
|
-
/*#__PURE__*/
|
|
96
|
-
// notranslate needed while Google Translate will not fix zero-width space issue
|
|
97
|
-
// eslint-disable-next-line react/no-danger
|
|
98
|
-
_jsx("span", {
|
|
97
|
+
}) : // notranslate needed while Google Translate will not fix zero-width space issue
|
|
98
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
99
99
|
className: "notranslate",
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
})
|
|
100
|
+
children: "\u200B"
|
|
101
|
+
}))
|
|
104
102
|
})
|
|
105
103
|
}));
|
|
106
104
|
}
|
|
@@ -136,7 +136,7 @@ const OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inPro
|
|
|
136
136
|
}, components),
|
|
137
137
|
renderSuffix: state => /*#__PURE__*/_jsx(NotchedOutlineRoot, {
|
|
138
138
|
className: classes.notchedOutline,
|
|
139
|
-
label: label && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
139
|
+
label: label != null && label !== '' && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
140
140
|
children: [label, "\xA0", '*']
|
|
141
141
|
})) : label,
|
|
142
142
|
notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!-- markdownlint-disable-next-line -->
|
|
2
2
|
<p align="center">
|
|
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
|
+
<a href="https://mui.com/" rel="noopener" target="_blank"><img width="150" src="https://mui.com/static/logo.svg" alt="MUI logo"></a>
|
|
4
4
|
</p>
|
|
5
5
|
|
|
6
6
|
<h1 align="center">MUI</h1>
|
|
@@ -9,15 +9,15 @@
|
|
|
9
9
|
|
|
10
10
|
Quickly build beautiful [React](https://reactjs.org/) apps. MUI is a simple and customizable component library to build faster, beautiful, and more accessible React applications. Follow your own design system, or start with [Material Design](https://material.io/design/introduction/).
|
|
11
11
|
|
|
12
|
-
[](https://github.com/mui
|
|
12
|
+
[](https://github.com/mui/material-ui/blob/HEAD/LICENSE)
|
|
13
13
|
[](https://www.npmjs.com/package/@mui/material)
|
|
14
14
|
[](https://www.npmjs.com/package/@mui/material)
|
|
15
15
|
[](https://www.npmjs.com/package/@mui/material)
|
|
16
|
-
[](https://github.com/mui
|
|
20
|
-
[](https://app.circleci.com/pipelines/github/mui/material-ui?branch=master)
|
|
17
|
+
[](https://codecov.io/gh/mui/material-ui/branch/master)
|
|
18
|
+
[](https://twitter.com/MUI_hq)
|
|
19
|
+
[](https://github.com/mui/material-ui/issues/27062)
|
|
20
|
+
[](https://isitmaintained.com/project/mui/material-ui 'Average time to resolve an issue')
|
|
21
21
|
[](https://translate.mui.com/project/material-ui-docs)
|
|
22
22
|
[](https://opencollective.com/mui)
|
|
23
23
|
|
|
@@ -54,7 +54,7 @@ Please note that `@next` will only point to pre-releases; to get the latest stab
|
|
|
54
54
|
|
|
55
55
|
<p align="center">
|
|
56
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/?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>
|
|
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
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>
|
|
59
59
|
</p>
|
|
60
60
|
|
|
@@ -132,7 +132,7 @@ Although we love giving you the opportunity to put your stamp on MUI, we also ar
|
|
|
132
132
|
|
|
133
133
|
## Changelog
|
|
134
134
|
|
|
135
|
-
If you have recently updated, please read the [changelog](https://github.com/mui
|
|
135
|
+
If you have recently updated, please read the [changelog](https://github.com/mui/material-ui/releases) for details of what has changed.
|
|
136
136
|
|
|
137
137
|
## Roadmap
|
|
138
138
|
|
package/Radio/RadioButtonIcon.js
CHANGED
|
@@ -10,15 +10,11 @@ const RadioButtonIconRoot = styled('span')({
|
|
|
10
10
|
position: 'relative',
|
|
11
11
|
display: 'flex'
|
|
12
12
|
});
|
|
13
|
-
const RadioButtonIconBackground = styled(RadioButtonUncheckedIcon
|
|
14
|
-
skipSx: true
|
|
15
|
-
})({
|
|
13
|
+
const RadioButtonIconBackground = styled(RadioButtonUncheckedIcon)({
|
|
16
14
|
// Scale applied to prevent dot misalignment in Safari
|
|
17
15
|
transform: 'scale(1)'
|
|
18
16
|
});
|
|
19
|
-
const RadioButtonIconDot = styled(RadioButtonCheckedIcon
|
|
20
|
-
skipSx: true
|
|
21
|
-
})(({
|
|
17
|
+
const RadioButtonIconDot = styled(RadioButtonCheckedIcon)(({
|
|
22
18
|
theme,
|
|
23
19
|
ownerState
|
|
24
20
|
}) => _extends({
|
package/Rating/Rating.js
CHANGED
|
@@ -405,7 +405,7 @@ const Rating = /*#__PURE__*/React.forwardRef(function Rating(inProps, ref) {
|
|
|
405
405
|
|
|
406
406
|
const handleChange = event => {
|
|
407
407
|
let newValue = event.target.value === '' ? null : parseFloat(event.target.value); // Give mouse priority over keyboard
|
|
408
|
-
// Fix https://github.com/mui
|
|
408
|
+
// Fix https://github.com/mui/material-ui/issues/22827
|
|
409
409
|
|
|
410
410
|
if (hover !== -1) {
|
|
411
411
|
newValue = hover;
|
package/Select/Select.d.ts
CHANGED
|
@@ -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) & {
|
|
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
|
*/
|
package/Select/SelectInput.d.ts
CHANGED
package/Select/SelectInput.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
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
|
-
|
|
4
|
+
|
|
5
|
+
var _span;
|
|
6
|
+
|
|
7
|
+
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
8
|
import * as React from 'react';
|
|
6
9
|
import { isFragment } from 'react-is';
|
|
7
10
|
import PropTypes from 'prop-types';
|
|
@@ -113,6 +116,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
113
116
|
autoWidth,
|
|
114
117
|
children,
|
|
115
118
|
className,
|
|
119
|
+
defaultOpen,
|
|
116
120
|
defaultValue,
|
|
117
121
|
disabled,
|
|
118
122
|
displayEmpty,
|
|
@@ -142,6 +146,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
142
146
|
default: defaultValue,
|
|
143
147
|
name: 'Select'
|
|
144
148
|
});
|
|
149
|
+
const [openState, setOpenState] = useControlled({
|
|
150
|
+
controlled: openProp,
|
|
151
|
+
default: defaultOpen,
|
|
152
|
+
name: 'Select'
|
|
153
|
+
});
|
|
145
154
|
const inputRef = React.useRef(null);
|
|
146
155
|
const displayRef = React.useRef(null);
|
|
147
156
|
const [displayNode, setDisplayNode] = React.useState(null);
|
|
@@ -149,7 +158,6 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
149
158
|
current: isOpenControlled
|
|
150
159
|
} = React.useRef(openProp != null);
|
|
151
160
|
const [menuMinWidthState, setMenuMinWidthState] = React.useState();
|
|
152
|
-
const [openState, setOpenState] = React.useState(false);
|
|
153
161
|
const handleRef = useForkRef(ref, inputRefProp);
|
|
154
162
|
const handleDisplayRef = React.useCallback(node => {
|
|
155
163
|
displayRef.current = node;
|
|
@@ -164,13 +172,27 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
164
172
|
},
|
|
165
173
|
node: inputRef.current,
|
|
166
174
|
value
|
|
167
|
-
}), [value]);
|
|
175
|
+
}), [value]); // Resize menu on `defaultOpen` automatic toggle.
|
|
176
|
+
|
|
177
|
+
React.useEffect(() => {
|
|
178
|
+
if (defaultOpen && openState && displayNode && !isOpenControlled) {
|
|
179
|
+
setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
|
|
180
|
+
displayRef.current.focus();
|
|
181
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
182
|
+
|
|
183
|
+
}, [displayNode, autoWidth]); // `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
|
|
184
|
+
// `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
|
|
185
|
+
|
|
168
186
|
React.useEffect(() => {
|
|
169
187
|
if (autoFocus) {
|
|
170
188
|
displayRef.current.focus();
|
|
171
189
|
}
|
|
172
190
|
}, [autoFocus]);
|
|
173
191
|
React.useEffect(() => {
|
|
192
|
+
if (!labelId) {
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
|
|
174
196
|
const label = ownerDocument(displayRef.current).getElementById(labelId);
|
|
175
197
|
|
|
176
198
|
if (label) {
|
|
@@ -267,7 +289,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
267
289
|
if (onChange) {
|
|
268
290
|
// Redefine target to allow name and value to be read.
|
|
269
291
|
// This allows seamless integration with the most popular form libraries.
|
|
270
|
-
// https://github.com/mui
|
|
292
|
+
// https://github.com/mui/material-ui/issues/13485#issuecomment-676048492
|
|
271
293
|
// Clone the event to not override `target` of the original event.
|
|
272
294
|
const nativeEvent = event.nativeEvent || event;
|
|
273
295
|
const clonedEvent = new nativeEvent.constructor(nativeEvent.type, nativeEvent);
|
|
@@ -300,7 +322,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
300
322
|
}
|
|
301
323
|
};
|
|
302
324
|
|
|
303
|
-
const open = displayNode !== null &&
|
|
325
|
+
const open = displayNode !== null && openState;
|
|
304
326
|
|
|
305
327
|
const handleBlur = event => {
|
|
306
328
|
// if open event.stopImmediatePropagation
|
|
@@ -467,16 +489,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
467
489
|
className: clsx(classes.select, className, SelectDisplayProps.className) // The id is required for proper a11y
|
|
468
490
|
,
|
|
469
491
|
id: buttonId,
|
|
470
|
-
children: isEmpty(display) ?
|
|
471
|
-
/*#__PURE__*/
|
|
472
|
-
// notranslate needed while Google Translate will not fix zero-width space issue
|
|
473
|
-
// eslint-disable-next-line react/no-danger
|
|
474
|
-
_jsx("span", {
|
|
492
|
+
children: isEmpty(display) ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
493
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
475
494
|
className: "notranslate",
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
}) : display
|
|
495
|
+
children: "\u200B"
|
|
496
|
+
})) : display
|
|
480
497
|
})), /*#__PURE__*/_jsx(SelectNativeInput, _extends({
|
|
481
498
|
value: Array.isArray(value) ? value.join(',') : value,
|
|
482
499
|
name: name,
|
|
@@ -559,6 +576,12 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
559
576
|
*/
|
|
560
577
|
className: PropTypes.string,
|
|
561
578
|
|
|
579
|
+
/**
|
|
580
|
+
* If `true`, the component is toggled on mount. Use when the component open state is not controlled.
|
|
581
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
582
|
+
*/
|
|
583
|
+
defaultOpen: PropTypes.bool,
|
|
584
|
+
|
|
562
585
|
/**
|
|
563
586
|
* The default value. Use when the component is not controlled.
|
|
564
587
|
*/
|