@mui/material 5.2.7 → 5.4.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.
- package/Autocomplete/Autocomplete.d.ts +7 -0
- package/Autocomplete/Autocomplete.js +22 -10
- package/Backdrop/Backdrop.js +3 -1
- package/Badge/Badge.js +6 -7
- package/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/Button/buttonClasses.d.ts +1 -1
- package/ButtonBase/TouchRipple.js +1 -2
- package/CHANGELOG.md +284 -33
- package/FilledInput/FilledInput.js +4 -1
- package/FormControlLabel/FormControlLabel.js +14 -4
- 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/Input/Input.js +4 -1
- package/InputAdornment/InputAdornment.js +6 -9
- package/InputBase/InputBase.js +4 -1
- package/InputLabel/InputLabel.js +4 -0
- package/ListItem/ListItem.js +3 -1
- package/Modal/Modal.js +3 -1
- package/OutlinedInput/NotchedOutline.js +14 -16
- package/OutlinedInput/OutlinedInput.js +1 -1
- package/README.md +5 -4
- package/Radio/RadioButtonIcon.js +2 -6
- package/Select/Select.d.ts +9 -1
- package/Select/Select.js +10 -1
- package/Select/SelectInput.d.ts +1 -0
- package/Select/SelectInput.js +32 -13
- package/Slider/Slider.d.ts +2 -0
- package/Slider/Slider.js +126 -53
- package/StepLabel/StepLabel.js +3 -1
- package/SvgIcon/SvgIcon.js +9 -9
- package/SwipeableDrawer/SwipeArea.js +1 -3
- package/TextField/TextField.d.ts +1 -0
- package/TextField/TextField.js +2 -1
- package/Tooltip/Tooltip.js +6 -1
- package/index.d.ts +7 -2
- package/index.js +6 -3
- package/internal/SwitchBase.js +2 -6
- package/legacy/Autocomplete/Autocomplete.js +23 -10
- package/legacy/Backdrop/Backdrop.js +3 -1
- package/legacy/Badge/Badge.js +6 -7
- package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/legacy/ButtonBase/TouchRipple.js +1 -2
- package/legacy/FilledInput/FilledInput.js +4 -1
- package/legacy/FormControlLabel/FormControlLabel.js +14 -4
- 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/Input/Input.js +4 -1
- package/legacy/InputAdornment/InputAdornment.js +6 -9
- package/legacy/InputBase/InputBase.js +4 -1
- package/legacy/InputLabel/InputLabel.js +4 -0
- package/legacy/ListItem/ListItem.js +3 -1
- package/legacy/Modal/Modal.js +3 -1
- package/legacy/OutlinedInput/NotchedOutline.js +14 -16
- package/legacy/OutlinedInput/OutlinedInput.js +1 -1
- package/legacy/Radio/RadioButtonIcon.js +2 -6
- package/legacy/Select/Select.js +11 -1
- package/legacy/Select/SelectInput.js +36 -16
- package/legacy/Slider/Slider.js +127 -54
- package/legacy/StepLabel/StepLabel.js +3 -1
- package/legacy/SvgIcon/SvgIcon.js +9 -9
- package/legacy/SwipeableDrawer/SwipeArea.js +1 -3
- package/legacy/TextField/TextField.js +2 -1
- package/legacy/Tooltip/Tooltip.js +6 -1
- package/legacy/index.js +6 -3
- package/legacy/internal/SwitchBase.js +2 -6
- package/legacy/useMediaQuery/useMediaQuery.js +86 -31
- package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
- package/modern/Autocomplete/Autocomplete.js +21 -9
- package/modern/Backdrop/Backdrop.js +3 -1
- package/modern/Badge/Badge.js +6 -7
- package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/modern/ButtonBase/TouchRipple.js +1 -2
- package/modern/FilledInput/FilledInput.js +4 -1
- package/modern/FormControlLabel/FormControlLabel.js +14 -4
- 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/Input/Input.js +4 -1
- package/modern/InputAdornment/InputAdornment.js +6 -9
- package/modern/InputBase/InputBase.js +4 -1
- package/modern/InputLabel/InputLabel.js +4 -0
- package/modern/ListItem/ListItem.js +3 -1
- package/modern/Modal/Modal.js +3 -1
- package/modern/OutlinedInput/NotchedOutline.js +14 -16
- package/modern/OutlinedInput/OutlinedInput.js +1 -1
- package/modern/Radio/RadioButtonIcon.js +2 -6
- package/modern/Select/Select.js +10 -1
- package/modern/Select/SelectInput.js +32 -13
- package/modern/Slider/Slider.js +126 -53
- package/modern/StepLabel/StepLabel.js +3 -1
- package/modern/SvgIcon/SvgIcon.js +8 -8
- package/modern/SwipeableDrawer/SwipeArea.js +1 -3
- package/modern/TextField/TextField.js +2 -1
- package/modern/Tooltip/Tooltip.js +6 -1
- package/modern/index.js +6 -3
- package/modern/internal/SwitchBase.js +2 -6
- package/modern/useMediaQuery/useMediaQuery.js +68 -26
- package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
- package/node/Autocomplete/Autocomplete.js +22 -10
- package/node/Backdrop/Backdrop.js +3 -1
- package/node/Badge/Badge.js +8 -8
- package/node/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
- package/node/ButtonBase/TouchRipple.js +1 -2
- package/node/FilledInput/FilledInput.js +4 -1
- package/node/FormControlLabel/FormControlLabel.js +15 -4
- 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/Input/Input.js +4 -1
- package/node/InputAdornment/InputAdornment.js +5 -9
- package/node/InputBase/InputBase.js +4 -1
- package/node/InputLabel/InputLabel.js +4 -0
- package/node/ListItem/ListItem.js +3 -1
- package/node/Modal/Modal.js +3 -1
- package/node/OutlinedInput/NotchedOutline.js +12 -16
- package/node/OutlinedInput/OutlinedInput.js +1 -1
- package/node/Radio/RadioButtonIcon.js +2 -6
- package/node/Select/Select.js +10 -1
- package/node/Select/SelectInput.js +31 -13
- package/node/Slider/Slider.js +112 -45
- package/node/StepLabel/StepLabel.js +3 -1
- package/node/SvgIcon/SvgIcon.js +9 -9
- package/node/SwipeableDrawer/SwipeArea.js +1 -3
- package/node/TextField/TextField.js +2 -1
- package/node/Tooltip/Tooltip.js +6 -1
- package/node/index.js +41 -16
- package/node/internal/SwitchBase.js +2 -6
- package/node/useMediaQuery/useMediaQuery.js +68 -26
- package/node/utils/shouldSpreadAdditionalProps.js +15 -0
- package/package.json +7 -7
- package/styles/ThemeProvider.d.ts +1 -1
- package/styles/components.d.ts +452 -113
- package/styles/createTheme.d.ts +12 -6
- package/styles/overrides.d.ts +16 -4
- package/styles/useThemeProps.d.ts +2 -1
- package/umd/material-ui.development.js +2988 -4926
- package/umd/material-ui.production.min.js +21 -21
- package/useMediaQuery/useMediaQuery.d.ts +4 -0
- package/useMediaQuery/useMediaQuery.js +68 -26
- package/utils/shouldSpreadAdditionalProps.js +7 -0
|
@@ -12,15 +12,17 @@ import capitalize from '../utils/capitalize';
|
|
|
12
12
|
import styled from '../styles/styled';
|
|
13
13
|
import useThemeProps from '../styles/useThemeProps';
|
|
14
14
|
import formControlLabelClasses, { getFormControlLabelUtilityClasses } from './formControlLabelClasses';
|
|
15
|
+
import formControlState from '../FormControl/formControlState';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
|
|
18
19
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
19
20
|
var classes = ownerState.classes,
|
|
20
21
|
disabled = ownerState.disabled,
|
|
21
|
-
labelPlacement = ownerState.labelPlacement
|
|
22
|
+
labelPlacement = ownerState.labelPlacement,
|
|
23
|
+
error = ownerState.error;
|
|
22
24
|
var slots = {
|
|
23
|
-
root: ['root', disabled && 'disabled', "labelPlacement".concat(capitalize(labelPlacement))],
|
|
25
|
+
root: ['root', disabled && 'disabled', "labelPlacement".concat(capitalize(labelPlacement)), error && 'error'],
|
|
24
26
|
label: ['label', disabled && 'disabled']
|
|
25
27
|
};
|
|
26
28
|
return composeClasses(slots, getFormControlLabelUtilityClasses, classes);
|
|
@@ -108,11 +110,17 @@ var FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel(i
|
|
|
108
110
|
controlProps[key] = props[key];
|
|
109
111
|
}
|
|
110
112
|
});
|
|
113
|
+
var fcs = formControlState({
|
|
114
|
+
props: props,
|
|
115
|
+
muiFormControl: muiFormControl,
|
|
116
|
+
states: ['error']
|
|
117
|
+
});
|
|
111
118
|
|
|
112
119
|
var ownerState = _extends({}, props, {
|
|
113
120
|
disabled: disabled,
|
|
114
121
|
label: label,
|
|
115
|
-
labelPlacement: labelPlacement
|
|
122
|
+
labelPlacement: labelPlacement,
|
|
123
|
+
error: fcs.error
|
|
116
124
|
});
|
|
117
125
|
|
|
118
126
|
var classes = useUtilityClasses(ownerState);
|
|
@@ -156,7 +164,9 @@ process.env.NODE_ENV !== "production" ? FormControlLabel.propTypes
|
|
|
156
164
|
* The props used for each slot inside.
|
|
157
165
|
* @default {}
|
|
158
166
|
*/
|
|
159
|
-
componentsProps: PropTypes.
|
|
167
|
+
componentsProps: PropTypes.shape({
|
|
168
|
+
typography: PropTypes.object
|
|
169
|
+
}),
|
|
160
170
|
|
|
161
171
|
/**
|
|
162
172
|
* A control element. For instance, it can be a `Radio`, a `Switch` or a `Checkbox`.
|
|
@@ -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
|
-
var formControlLabelClasses = generateUtilityClasses('MuiFormControlLabel', ['root', 'labelPlacementStart', 'labelPlacementTop', 'labelPlacementBottom', 'disabled', 'label']);
|
|
5
|
+
var formControlLabelClasses = generateUtilityClasses('MuiFormControlLabel', ['root', 'labelPlacementStart', 'labelPlacementTop', 'labelPlacementBottom', 'disabled', 'label', 'error']);
|
|
6
6
|
export default formControlLabelClasses;
|
|
@@ -7,13 +7,16 @@ import { unstable_composeClasses as composeClasses } from '@mui/base';
|
|
|
7
7
|
import styled from '../styles/styled';
|
|
8
8
|
import useThemeProps from '../styles/useThemeProps';
|
|
9
9
|
import { getFormGroupUtilityClass } from './formGroupClasses';
|
|
10
|
+
import useFormControl from '../FormControl/useFormControl';
|
|
11
|
+
import formControlState from '../FormControl/formControlState';
|
|
10
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
13
|
|
|
12
14
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
13
15
|
var classes = ownerState.classes,
|
|
14
|
-
row = ownerState.row
|
|
16
|
+
row = ownerState.row,
|
|
17
|
+
error = ownerState.error;
|
|
15
18
|
var slots = {
|
|
16
|
-
root: ['root', row && 'row']
|
|
19
|
+
root: ['root', row && 'row', error && 'error']
|
|
17
20
|
};
|
|
18
21
|
return composeClasses(slots, getFormGroupUtilityClass, classes);
|
|
19
22
|
};
|
|
@@ -52,8 +55,16 @@ var FormGroup = /*#__PURE__*/React.forwardRef(function FormGroup(inProps, ref) {
|
|
|
52
55
|
row = _props$row === void 0 ? false : _props$row,
|
|
53
56
|
other = _objectWithoutProperties(props, ["className", "row"]);
|
|
54
57
|
|
|
58
|
+
var muiFormControl = useFormControl();
|
|
59
|
+
var fcs = formControlState({
|
|
60
|
+
props: props,
|
|
61
|
+
muiFormControl: muiFormControl,
|
|
62
|
+
states: ['error']
|
|
63
|
+
});
|
|
64
|
+
|
|
55
65
|
var ownerState = _extends({}, props, {
|
|
56
|
-
row: row
|
|
66
|
+
row: row,
|
|
67
|
+
error: fcs.error
|
|
57
68
|
});
|
|
58
69
|
|
|
59
70
|
var classes = useUtilityClasses(ownerState);
|
|
@@ -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
|
-
var formGroupClasses = generateUtilityClasses('MuiFormGroup', ['root', 'row']);
|
|
5
|
+
var formGroupClasses = generateUtilityClasses('MuiFormGroup', ['root', 'row', 'error']);
|
|
6
6
|
export default formGroupClasses;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
|
|
5
|
+
var _span;
|
|
6
|
+
|
|
4
7
|
import * as React from 'react';
|
|
5
8
|
import PropTypes from 'prop-types';
|
|
6
9
|
import clsx from 'clsx';
|
|
@@ -104,16 +107,11 @@ var FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inPro
|
|
|
104
107
|
className: clsx(classes.root, className),
|
|
105
108
|
ref: ref
|
|
106
109
|
}, other, {
|
|
107
|
-
children: children === ' ' ?
|
|
108
|
-
/*#__PURE__*/
|
|
109
|
-
// notranslate needed while Google Translate will not fix zero-width space issue
|
|
110
|
-
// eslint-disable-next-line react/no-danger
|
|
111
|
-
_jsx("span", {
|
|
110
|
+
children: children === ' ' ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
111
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
112
112
|
className: "notranslate",
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
}) : children
|
|
113
|
+
children: "\u200B"
|
|
114
|
+
})) : children
|
|
117
115
|
}));
|
|
118
116
|
});
|
|
119
117
|
process.env.NODE_ENV !== "production" ? FormHelperText.propTypes
|
package/legacy/Grid/Grid.js
CHANGED
|
@@ -251,10 +251,8 @@ var GridRoot = styled('div', {
|
|
|
251
251
|
|
|
252
252
|
}, ownerState.zeroMinWidth && {
|
|
253
253
|
minWidth: 0
|
|
254
|
-
}, ownerState.wrap
|
|
255
|
-
flexWrap:
|
|
256
|
-
}, ownerState.wrap === 'reverse' && {
|
|
257
|
-
flexWrap: 'wrap-reverse'
|
|
254
|
+
}, ownerState.wrap !== 'wrap' && {
|
|
255
|
+
flexWrap: ownerState.wrap
|
|
258
256
|
});
|
|
259
257
|
}, generateDirection, generateRowGap, generateColumnGap, generateGrid);
|
|
260
258
|
|
package/legacy/Input/Input.js
CHANGED
|
@@ -190,7 +190,10 @@ process.env.NODE_ENV !== "production" ? Input.propTypes
|
|
|
190
190
|
* The props used for each slot inside the Input.
|
|
191
191
|
* @default {}
|
|
192
192
|
*/
|
|
193
|
-
componentsProps: PropTypes.
|
|
193
|
+
componentsProps: PropTypes.shape({
|
|
194
|
+
input: PropTypes.object,
|
|
195
|
+
root: PropTypes.object
|
|
196
|
+
}),
|
|
194
197
|
|
|
195
198
|
/**
|
|
196
199
|
* The default value. Use when the component is not controlled.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
|
|
5
|
+
var _span;
|
|
6
|
+
|
|
4
7
|
import * as React from 'react';
|
|
5
8
|
import PropTypes from 'prop-types';
|
|
6
9
|
import clsx from 'clsx';
|
|
@@ -116,17 +119,11 @@ var InputAdornment = /*#__PURE__*/React.forwardRef(function InputAdornment(inPro
|
|
|
116
119
|
children: children
|
|
117
120
|
}) : /*#__PURE__*/_jsxs(React.Fragment, {
|
|
118
121
|
children: [position === 'start' ?
|
|
119
|
-
/*#__PURE__*/
|
|
120
|
-
|
|
121
122
|
/* notranslate needed while Google Translate will not fix zero-width space issue */
|
|
122
|
-
|
|
123
|
-
/* eslint-disable-next-line react/no-danger */
|
|
124
|
-
_jsx("span", {
|
|
123
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
125
124
|
className: "notranslate",
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
129
|
-
}) : null, children]
|
|
125
|
+
children: "\u200B"
|
|
126
|
+
})) : null, children]
|
|
130
127
|
})
|
|
131
128
|
}))
|
|
132
129
|
});
|
|
@@ -561,7 +561,10 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes
|
|
|
561
561
|
* The props used for each slot inside the Input.
|
|
562
562
|
* @default {}
|
|
563
563
|
*/
|
|
564
|
-
componentsProps: PropTypes.
|
|
564
|
+
componentsProps: PropTypes.shape({
|
|
565
|
+
input: PropTypes.object,
|
|
566
|
+
root: PropTypes.object
|
|
567
|
+
}),
|
|
565
568
|
|
|
566
569
|
/**
|
|
567
570
|
* The default value. Use when the component is not controlled.
|
|
@@ -78,6 +78,8 @@ var InputLabelRoot = styled(FormLabel, {
|
|
|
78
78
|
}, ownerState.size === 'small' && {
|
|
79
79
|
transform: 'translate(12px, 13px) scale(1)'
|
|
80
80
|
}, ownerState.shrink && _extends({
|
|
81
|
+
userSelect: 'none',
|
|
82
|
+
pointerEvents: 'auto',
|
|
81
83
|
transform: 'translate(12px, 7px) scale(0.75)',
|
|
82
84
|
maxWidth: 'calc(133% - 24px)'
|
|
83
85
|
}, ownerState.size === 'small' && {
|
|
@@ -91,6 +93,8 @@ var InputLabelRoot = styled(FormLabel, {
|
|
|
91
93
|
}, ownerState.size === 'small' && {
|
|
92
94
|
transform: 'translate(14px, 9px) scale(1)'
|
|
93
95
|
}, ownerState.shrink && {
|
|
96
|
+
userSelect: 'none',
|
|
97
|
+
pointerEvents: 'auto',
|
|
94
98
|
maxWidth: 'calc(133% - 24px)',
|
|
95
99
|
transform: 'translate(14px, -9px) scale(0.75)'
|
|
96
100
|
}));
|
|
@@ -348,7 +348,9 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes
|
|
|
348
348
|
* The props used for each slot inside the Input.
|
|
349
349
|
* @default {}
|
|
350
350
|
*/
|
|
351
|
-
componentsProps: PropTypes.
|
|
351
|
+
componentsProps: PropTypes.shape({
|
|
352
|
+
root: PropTypes.object
|
|
353
|
+
}),
|
|
352
354
|
|
|
353
355
|
/**
|
|
354
356
|
* The container component used when a `ListItemSecondaryAction` is the last child.
|
package/legacy/Modal/Modal.js
CHANGED
|
@@ -194,7 +194,9 @@ process.env.NODE_ENV !== "production" ? Modal.propTypes
|
|
|
194
194
|
* The props used for each slot inside the Modal.
|
|
195
195
|
* @default {}
|
|
196
196
|
*/
|
|
197
|
-
componentsProps: PropTypes.
|
|
197
|
+
componentsProps: PropTypes.shape({
|
|
198
|
+
root: PropTypes.object
|
|
199
|
+
}),
|
|
198
200
|
|
|
199
201
|
/**
|
|
200
202
|
* An HTML element or function that returns one.
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
|
|
4
|
+
var _span;
|
|
5
|
+
|
|
3
6
|
import * as React from 'react';
|
|
4
7
|
import PropTypes from 'prop-types';
|
|
5
8
|
import styled from '../styles/styled';
|
|
@@ -20,14 +23,12 @@ var NotchedOutlineRoot = styled('fieldset')({
|
|
|
20
23
|
overflow: 'hidden',
|
|
21
24
|
minWidth: '0%'
|
|
22
25
|
});
|
|
23
|
-
var NotchedOutlineLegend = styled('legend'
|
|
24
|
-
skipSx: true
|
|
25
|
-
})(function (_ref) {
|
|
26
|
+
var NotchedOutlineLegend = styled('legend')(function (_ref) {
|
|
26
27
|
var ownerState = _ref.ownerState,
|
|
27
28
|
theme = _ref.theme;
|
|
28
29
|
return _extends({
|
|
29
30
|
float: 'unset'
|
|
30
|
-
}, ownerState.
|
|
31
|
+
}, !ownerState.withLabel && {
|
|
31
32
|
padding: 0,
|
|
32
33
|
lineHeight: '11px',
|
|
33
34
|
// sync with `height` in `legend` styles
|
|
@@ -35,7 +36,7 @@ var NotchedOutlineLegend = styled('legend', {
|
|
|
35
36
|
duration: 150,
|
|
36
37
|
easing: theme.transitions.easing.easeOut
|
|
37
38
|
})
|
|
38
|
-
}, ownerState.
|
|
39
|
+
}, ownerState.withLabel && _extends({
|
|
39
40
|
display: 'block',
|
|
40
41
|
// Fix conflict with normalize.css and sanitize.css
|
|
41
42
|
width: 'auto',
|
|
@@ -77,9 +78,11 @@ export default function NotchedOutline(props) {
|
|
|
77
78
|
notched = props.notched,
|
|
78
79
|
other = _objectWithoutProperties(props, ["children", "classes", "className", "label", "notched"]);
|
|
79
80
|
|
|
81
|
+
var withLabel = label != null && label !== '';
|
|
82
|
+
|
|
80
83
|
var ownerState = _extends({}, props, {
|
|
81
84
|
notched: notched,
|
|
82
|
-
|
|
85
|
+
withLabel: 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
|
}
|
|
@@ -137,7 +137,7 @@ var OutlinedInput = /*#__PURE__*/React.forwardRef(function OutlinedInput(inProps
|
|
|
137
137
|
renderSuffix: function renderSuffix(state) {
|
|
138
138
|
return /*#__PURE__*/_jsx(NotchedOutlineRoot, {
|
|
139
139
|
className: classes.notchedOutline,
|
|
140
|
-
label: label && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
140
|
+
label: label != null && label !== '' && fcs.required ? _React$Fragment || (_React$Fragment = /*#__PURE__*/_jsxs(React.Fragment, {
|
|
141
141
|
children: [label, "\xA0", '*']
|
|
142
142
|
})) : label,
|
|
143
143
|
notched: typeof notched !== 'undefined' ? notched : Boolean(state.startAdornment || state.filled || state.focused)
|
|
@@ -10,15 +10,11 @@ var RadioButtonIconRoot = styled('span')({
|
|
|
10
10
|
position: 'relative',
|
|
11
11
|
display: 'flex'
|
|
12
12
|
});
|
|
13
|
-
var RadioButtonIconBackground = styled(RadioButtonUncheckedIcon
|
|
14
|
-
skipSx: true
|
|
15
|
-
})({
|
|
13
|
+
var RadioButtonIconBackground = styled(RadioButtonUncheckedIcon)({
|
|
16
14
|
// Scale applied to prevent dot misalignment in Safari
|
|
17
15
|
transform: 'scale(1)'
|
|
18
16
|
});
|
|
19
|
-
var RadioButtonIconDot = styled(RadioButtonCheckedIcon
|
|
20
|
-
skipSx: true
|
|
21
|
-
})(function (_ref) {
|
|
17
|
+
var RadioButtonIconDot = styled(RadioButtonCheckedIcon)(function (_ref) {
|
|
22
18
|
var theme = _ref.theme,
|
|
23
19
|
ownerState = _ref.ownerState;
|
|
24
20
|
return _extends({
|
package/legacy/Select/Select.js
CHANGED
|
@@ -36,6 +36,8 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
36
36
|
_props$classes = props.classes,
|
|
37
37
|
classesProp = _props$classes === void 0 ? {} : _props$classes,
|
|
38
38
|
className = props.className,
|
|
39
|
+
_props$defaultOpen = props.defaultOpen,
|
|
40
|
+
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
39
41
|
_props$displayEmpty = props.displayEmpty,
|
|
40
42
|
displayEmpty = _props$displayEmpty === void 0 ? false : _props$displayEmpty,
|
|
41
43
|
_props$IconComponent = props.IconComponent,
|
|
@@ -57,7 +59,7 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
57
59
|
SelectDisplayProps = props.SelectDisplayProps,
|
|
58
60
|
_props$variant = props.variant,
|
|
59
61
|
variantProps = _props$variant === void 0 ? 'outlined' : _props$variant,
|
|
60
|
-
other = _objectWithoutProperties(props, ["autoWidth", "children", "classes", "className", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"]);
|
|
62
|
+
other = _objectWithoutProperties(props, ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"]);
|
|
61
63
|
|
|
62
64
|
var inputComponent = native ? NativeSelectInput : SelectInput;
|
|
63
65
|
var muiFormControl = useFormControl();
|
|
@@ -96,6 +98,7 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
96
98
|
id: id
|
|
97
99
|
} : {
|
|
98
100
|
autoWidth: autoWidth,
|
|
101
|
+
defaultOpen: defaultOpen,
|
|
99
102
|
displayEmpty: displayEmpty,
|
|
100
103
|
labelId: labelId,
|
|
101
104
|
MenuProps: MenuProps,
|
|
@@ -150,6 +153,13 @@ process.env.NODE_ENV !== "production" ? Select.propTypes
|
|
|
150
153
|
*/
|
|
151
154
|
className: PropTypes.string,
|
|
152
155
|
|
|
156
|
+
/**
|
|
157
|
+
* If `true`, the component is initially open. Use when the component open state is not controlled (i.e. the `open` prop is not defined).
|
|
158
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
159
|
+
* @default false
|
|
160
|
+
*/
|
|
161
|
+
defaultOpen: PropTypes.bool,
|
|
162
|
+
|
|
153
163
|
/**
|
|
154
164
|
* The default value. Use when the component is not controlled.
|
|
155
165
|
*/
|
|
@@ -4,6 +4,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
4
4
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import { formatMuiErrorMessage as _formatMuiErrorMessage } from "@mui/utils";
|
|
7
|
+
|
|
8
|
+
var _span;
|
|
9
|
+
|
|
7
10
|
import * as React from 'react';
|
|
8
11
|
import { isFragment } from 'react-is';
|
|
9
12
|
import PropTypes from 'prop-types';
|
|
@@ -103,6 +106,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
103
106
|
autoWidth = props.autoWidth,
|
|
104
107
|
children = props.children,
|
|
105
108
|
className = props.className,
|
|
109
|
+
defaultOpen = props.defaultOpen,
|
|
106
110
|
defaultValue = props.defaultValue,
|
|
107
111
|
disabled = props.disabled,
|
|
108
112
|
displayEmpty = props.displayEmpty,
|
|
@@ -128,7 +132,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
128
132
|
valueProp = props.value,
|
|
129
133
|
_props$variant = props.variant,
|
|
130
134
|
variant = _props$variant === void 0 ? 'standard' : _props$variant,
|
|
131
|
-
other = _objectWithoutProperties(props, ["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"]);
|
|
135
|
+
other = _objectWithoutProperties(props, ["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"]);
|
|
132
136
|
|
|
133
137
|
var _useControlled = useControlled({
|
|
134
138
|
controlled: valueProp,
|
|
@@ -139,6 +143,15 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
139
143
|
value = _useControlled2[0],
|
|
140
144
|
setValueState = _useControlled2[1];
|
|
141
145
|
|
|
146
|
+
var _useControlled3 = useControlled({
|
|
147
|
+
controlled: openProp,
|
|
148
|
+
default: defaultOpen,
|
|
149
|
+
name: 'Select'
|
|
150
|
+
}),
|
|
151
|
+
_useControlled4 = _slicedToArray(_useControlled3, 2),
|
|
152
|
+
openState = _useControlled4[0],
|
|
153
|
+
setOpenState = _useControlled4[1];
|
|
154
|
+
|
|
142
155
|
var inputRef = React.useRef(null);
|
|
143
156
|
var displayRef = React.useRef(null);
|
|
144
157
|
|
|
@@ -153,10 +166,6 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
153
166
|
menuMinWidthState = _React$useState2[0],
|
|
154
167
|
setMenuMinWidthState = _React$useState2[1];
|
|
155
168
|
|
|
156
|
-
var _React$useState3 = React.useState(false),
|
|
157
|
-
openState = _React$useState3[0],
|
|
158
|
-
setOpenState = _React$useState3[1];
|
|
159
|
-
|
|
160
169
|
var handleRef = useForkRef(ref, inputRefProp);
|
|
161
170
|
var handleDisplayRef = React.useCallback(function (node) {
|
|
162
171
|
displayRef.current = node;
|
|
@@ -173,7 +182,17 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
173
182
|
node: inputRef.current,
|
|
174
183
|
value: value
|
|
175
184
|
};
|
|
176
|
-
}, [value]);
|
|
185
|
+
}, [value]); // Resize menu on `defaultOpen` automatic toggle.
|
|
186
|
+
|
|
187
|
+
React.useEffect(function () {
|
|
188
|
+
if (defaultOpen && openState && displayNode && !isOpenControlled) {
|
|
189
|
+
setMenuMinWidthState(autoWidth ? null : displayNode.clientWidth);
|
|
190
|
+
displayRef.current.focus();
|
|
191
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
192
|
+
|
|
193
|
+
}, [displayNode, autoWidth]); // `isOpenControlled` is ignored because the component should never switch between controlled and uncontrolled modes.
|
|
194
|
+
// `defaultOpen` and `openState` are ignored to avoid unnecessary callbacks.
|
|
195
|
+
|
|
177
196
|
React.useEffect(function () {
|
|
178
197
|
if (autoFocus) {
|
|
179
198
|
displayRef.current.focus();
|
|
@@ -313,7 +332,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
313
332
|
}
|
|
314
333
|
};
|
|
315
334
|
|
|
316
|
-
var open = displayNode !== null &&
|
|
335
|
+
var open = displayNode !== null && openState;
|
|
317
336
|
|
|
318
337
|
var handleBlur = function handleBlur(event) {
|
|
319
338
|
// if open event.stopImmediatePropagation
|
|
@@ -488,16 +507,11 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
488
507
|
className: clsx(classes.select, className, SelectDisplayProps.className) // The id is required for proper a11y
|
|
489
508
|
,
|
|
490
509
|
id: buttonId,
|
|
491
|
-
children: isEmpty(display) ?
|
|
492
|
-
/*#__PURE__*/
|
|
493
|
-
// notranslate needed while Google Translate will not fix zero-width space issue
|
|
494
|
-
// eslint-disable-next-line react/no-danger
|
|
495
|
-
_jsx("span", {
|
|
510
|
+
children: isEmpty(display) ? // notranslate needed while Google Translate will not fix zero-width space issue
|
|
511
|
+
_span || (_span = /*#__PURE__*/_jsx("span", {
|
|
496
512
|
className: "notranslate",
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
}
|
|
500
|
-
}) : display
|
|
513
|
+
children: "\u200B"
|
|
514
|
+
})) : display
|
|
501
515
|
})), /*#__PURE__*/_jsx(SelectNativeInput, _extends({
|
|
502
516
|
value: Array.isArray(value) ? value.join(',') : value,
|
|
503
517
|
name: name,
|
|
@@ -580,6 +594,12 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
580
594
|
*/
|
|
581
595
|
className: PropTypes.string,
|
|
582
596
|
|
|
597
|
+
/**
|
|
598
|
+
* If `true`, the component is toggled on mount. Use when the component open state is not controlled.
|
|
599
|
+
* You can only use it when the `native` prop is `false` (default).
|
|
600
|
+
*/
|
|
601
|
+
defaultOpen: PropTypes.bool,
|
|
602
|
+
|
|
583
603
|
/**
|
|
584
604
|
* The default value. Use when the component is not controlled.
|
|
585
605
|
*/
|