@mui/material 5.11.15 → 5.11.16
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.js +9 -1
- package/Badge/badgeClasses.d.ts +18 -18
- package/CHANGELOG.md +66 -4
- package/CardActionArea/CardActionArea.js +2 -0
- package/NativeSelect/NativeSelectInput.d.ts +1 -0
- package/NativeSelect/NativeSelectInput.js +12 -5
- package/NativeSelect/nativeSelectClasses.d.ts +2 -0
- package/NativeSelect/nativeSelectClasses.js +1 -1
- package/Select/Select.js +14 -9
- package/Select/SelectInput.d.ts +1 -0
- package/Select/SelectInput.js +14 -4
- package/Select/selectClasses.d.ts +2 -0
- package/Select/selectClasses.js +1 -1
- package/Slider/Slider.js +6 -6
- package/Slider/sliderClasses.d.ts +22 -22
- package/Unstable_Grid2/Grid2.js +1 -0
- package/index.js +1 -1
- package/legacy/Autocomplete/Autocomplete.js +8 -3
- package/legacy/CardActionArea/CardActionArea.js +2 -0
- package/legacy/NativeSelect/NativeSelectInput.js +12 -5
- package/legacy/NativeSelect/nativeSelectClasses.js +1 -1
- package/legacy/Select/Select.js +14 -9
- package/legacy/Select/SelectInput.js +14 -5
- package/legacy/Select/selectClasses.js +1 -1
- package/legacy/Slider/Slider.js +6 -6
- package/legacy/Unstable_Grid2/Grid2.js +1 -0
- package/legacy/index.js +1 -1
- package/modern/Autocomplete/Autocomplete.js +9 -1
- package/modern/CardActionArea/CardActionArea.js +2 -0
- package/modern/NativeSelect/NativeSelectInput.js +12 -5
- package/modern/NativeSelect/nativeSelectClasses.js +1 -1
- package/modern/Select/Select.js +14 -9
- package/modern/Select/SelectInput.js +14 -4
- package/modern/Select/selectClasses.js +1 -1
- package/modern/Slider/Slider.js +6 -6
- package/modern/Unstable_Grid2/Grid2.js +1 -0
- package/modern/index.js +1 -1
- package/node/Autocomplete/Autocomplete.js +9 -1
- package/node/CardActionArea/CardActionArea.js +2 -0
- package/node/NativeSelect/NativeSelectInput.js +12 -5
- package/node/NativeSelect/nativeSelectClasses.js +1 -1
- package/node/Select/Select.js +14 -9
- package/node/Select/SelectInput.js +14 -4
- package/node/Select/selectClasses.js +1 -1
- package/node/Slider/Slider.js +6 -6
- package/node/Unstable_Grid2/Grid2.js +1 -0
- package/node/index.js +1 -1
- package/package.json +5 -5
- package/umd/material-ui.development.js +81 -45
- package/umd/material-ui.production.min.js +9 -9
|
@@ -16,9 +16,10 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
16
16
|
variant = ownerState.variant,
|
|
17
17
|
disabled = ownerState.disabled,
|
|
18
18
|
multiple = ownerState.multiple,
|
|
19
|
-
open = ownerState.open
|
|
19
|
+
open = ownerState.open,
|
|
20
|
+
error = ownerState.error;
|
|
20
21
|
var slots = {
|
|
21
|
-
select: ['select', variant, disabled && 'disabled', multiple && 'multiple'],
|
|
22
|
+
select: ['select', variant, disabled && 'disabled', multiple && 'multiple', error && 'error'],
|
|
22
23
|
icon: ['icon', "icon".concat(capitalize(variant)), open && 'iconOpen', disabled && 'disabled']
|
|
23
24
|
};
|
|
24
25
|
return composeClasses(slots, getNativeSelectUtilityClasses, classes);
|
|
@@ -80,7 +81,7 @@ var NativeSelectSelect = styled('select', {
|
|
|
80
81
|
shouldForwardProp: rootShouldForwardProp,
|
|
81
82
|
overridesResolver: function overridesResolver(props, styles) {
|
|
82
83
|
var ownerState = props.ownerState;
|
|
83
|
-
return [styles.select, styles[ownerState.variant], _defineProperty({}, "&.".concat(nativeSelectClasses.multiple), styles.multiple)];
|
|
84
|
+
return [styles.select, styles[ownerState.variant], ownerState.error && styles.error, _defineProperty({}, "&.".concat(nativeSelectClasses.multiple), styles.multiple)];
|
|
84
85
|
}
|
|
85
86
|
})(nativeSelectSelectStyles);
|
|
86
87
|
export var nativeSelectIconStyles = function nativeSelectIconStyles(_ref3) {
|
|
@@ -121,14 +122,16 @@ var NativeSelectIcon = styled('svg', {
|
|
|
121
122
|
var NativeSelectInput = /*#__PURE__*/React.forwardRef(function NativeSelectInput(props, ref) {
|
|
122
123
|
var className = props.className,
|
|
123
124
|
disabled = props.disabled,
|
|
125
|
+
error = props.error,
|
|
124
126
|
IconComponent = props.IconComponent,
|
|
125
127
|
inputRef = props.inputRef,
|
|
126
128
|
_props$variant = props.variant,
|
|
127
129
|
variant = _props$variant === void 0 ? 'standard' : _props$variant,
|
|
128
|
-
other = _objectWithoutProperties(props, ["className", "disabled", "IconComponent", "inputRef", "variant"]);
|
|
130
|
+
other = _objectWithoutProperties(props, ["className", "disabled", "error", "IconComponent", "inputRef", "variant"]);
|
|
129
131
|
var ownerState = _extends({}, props, {
|
|
130
132
|
disabled: disabled,
|
|
131
|
-
variant: variant
|
|
133
|
+
variant: variant,
|
|
134
|
+
error: error
|
|
132
135
|
});
|
|
133
136
|
var classes = useUtilityClasses(ownerState);
|
|
134
137
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -163,6 +166,10 @@ process.env.NODE_ENV !== "production" ? NativeSelectInput.propTypes = {
|
|
|
163
166
|
* If `true`, the select is disabled.
|
|
164
167
|
*/
|
|
165
168
|
disabled: PropTypes.bool,
|
|
169
|
+
/**
|
|
170
|
+
* If `true`, the `select input` will indicate an error.
|
|
171
|
+
*/
|
|
172
|
+
error: PropTypes.bool,
|
|
166
173
|
/**
|
|
167
174
|
* The icon that displays the arrow.
|
|
168
175
|
*/
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getNativeSelectUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiNativeSelect', slot);
|
|
5
5
|
}
|
|
6
|
-
var nativeSelectClasses = generateUtilityClasses('MuiNativeSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput']);
|
|
6
|
+
var nativeSelectClasses = generateUtilityClasses('MuiNativeSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
7
7
|
export default nativeSelectClasses;
|
package/legacy/Select/Select.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _StyledInput, _StyledFilledInput;
|
|
4
3
|
import * as React from 'react';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
5
|
import clsx from 'clsx';
|
|
@@ -74,21 +73,26 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
74
73
|
var fcs = formControlState({
|
|
75
74
|
props: props,
|
|
76
75
|
muiFormControl: muiFormControl,
|
|
77
|
-
states: ['variant']
|
|
76
|
+
states: ['variant', 'error']
|
|
78
77
|
});
|
|
79
78
|
var variant = fcs.variant || variantProp;
|
|
80
|
-
var InputComponent = input || {
|
|
81
|
-
standard: _StyledInput || (_StyledInput = /*#__PURE__*/_jsx(StyledInput, {})),
|
|
82
|
-
outlined: /*#__PURE__*/_jsx(StyledOutlinedInput, {
|
|
83
|
-
label: label
|
|
84
|
-
}),
|
|
85
|
-
filled: _StyledFilledInput || (_StyledFilledInput = /*#__PURE__*/_jsx(StyledFilledInput, {}))
|
|
86
|
-
}[variant];
|
|
87
79
|
var ownerState = _extends({}, props, {
|
|
88
80
|
variant: variant,
|
|
89
81
|
classes: classesProp
|
|
90
82
|
});
|
|
91
83
|
var classes = useUtilityClasses(ownerState);
|
|
84
|
+
var InputComponent = input || {
|
|
85
|
+
standard: /*#__PURE__*/_jsx(StyledInput, {
|
|
86
|
+
ownerState: ownerState
|
|
87
|
+
}),
|
|
88
|
+
outlined: /*#__PURE__*/_jsx(StyledOutlinedInput, {
|
|
89
|
+
label: label,
|
|
90
|
+
ownerState: ownerState
|
|
91
|
+
}),
|
|
92
|
+
filled: /*#__PURE__*/_jsx(StyledFilledInput, {
|
|
93
|
+
ownerState: ownerState
|
|
94
|
+
})
|
|
95
|
+
}[variant];
|
|
92
96
|
var inputComponentRef = useForkRef(ref, InputComponent.ref);
|
|
93
97
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
94
98
|
children: /*#__PURE__*/React.cloneElement(InputComponent, _extends({
|
|
@@ -97,6 +101,7 @@ var Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
97
101
|
inputComponent: inputComponent,
|
|
98
102
|
inputProps: _extends({
|
|
99
103
|
children: children,
|
|
104
|
+
error: fcs.error,
|
|
100
105
|
IconComponent: IconComponent,
|
|
101
106
|
variant: variant,
|
|
102
107
|
type: undefined,
|
|
@@ -28,7 +28,7 @@ var SelectSelect = styled('div', {
|
|
|
28
28
|
overridesResolver: function overridesResolver(props, styles) {
|
|
29
29
|
var ownerState = props.ownerState;
|
|
30
30
|
return [// Win specificity over the input base
|
|
31
|
-
_defineProperty({}, "&.".concat(selectClasses.select), styles.select), _defineProperty({}, "&.".concat(selectClasses.select), styles[ownerState.variant]), _defineProperty({}, "&.".concat(selectClasses.multiple), styles.multiple)];
|
|
31
|
+
_defineProperty({}, "&.".concat(selectClasses.select), styles.select), _defineProperty({}, "&.".concat(selectClasses.select), styles[ownerState.variant]), _defineProperty({}, "&.".concat(selectClasses.error), styles.error), _defineProperty({}, "&.".concat(selectClasses.multiple), styles.multiple)];
|
|
32
32
|
}
|
|
33
33
|
})(nativeSelectSelectStyles, _defineProperty({}, "&.".concat(selectClasses.select), {
|
|
34
34
|
height: 'auto',
|
|
@@ -81,9 +81,10 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
81
81
|
variant = ownerState.variant,
|
|
82
82
|
disabled = ownerState.disabled,
|
|
83
83
|
multiple = ownerState.multiple,
|
|
84
|
-
open = ownerState.open
|
|
84
|
+
open = ownerState.open,
|
|
85
|
+
error = ownerState.error;
|
|
85
86
|
var slots = {
|
|
86
|
-
select: ['select', variant, disabled && 'disabled', multiple && 'multiple'],
|
|
87
|
+
select: ['select', variant, disabled && 'disabled', multiple && 'multiple', error && 'error'],
|
|
87
88
|
icon: ['icon', "icon".concat(capitalize(variant)), open && 'iconOpen', disabled && 'disabled'],
|
|
88
89
|
nativeInput: ['nativeInput']
|
|
89
90
|
};
|
|
@@ -104,6 +105,8 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
104
105
|
defaultValue = props.defaultValue,
|
|
105
106
|
disabled = props.disabled,
|
|
106
107
|
displayEmpty = props.displayEmpty,
|
|
108
|
+
_props$error = props.error,
|
|
109
|
+
error = _props$error === void 0 ? false : _props$error,
|
|
107
110
|
IconComponent = props.IconComponent,
|
|
108
111
|
inputRefProp = props.inputRef,
|
|
109
112
|
labelId = props.labelId,
|
|
@@ -126,7 +129,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
126
129
|
valueProp = props.value,
|
|
127
130
|
_props$variant = props.variant,
|
|
128
131
|
variant = _props$variant === void 0 ? 'standard' : _props$variant,
|
|
129
|
-
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
|
+
other = _objectWithoutProperties(props, ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultOpen", "defaultValue", "disabled", "displayEmpty", "error", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"]);
|
|
130
133
|
var _useControlled = useControlled({
|
|
131
134
|
controlled: valueProp,
|
|
132
135
|
default: defaultValue,
|
|
@@ -435,7 +438,8 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
435
438
|
var ownerState = _extends({}, props, {
|
|
436
439
|
variant: variant,
|
|
437
440
|
value: value,
|
|
438
|
-
open: open
|
|
441
|
+
open: open,
|
|
442
|
+
error: error
|
|
439
443
|
});
|
|
440
444
|
var classes = useUtilityClasses(ownerState);
|
|
441
445
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -465,6 +469,7 @@ var SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, ref)
|
|
|
465
469
|
children: "\u200B"
|
|
466
470
|
})) : display
|
|
467
471
|
})), /*#__PURE__*/_jsx(SelectNativeInput, _extends({
|
|
472
|
+
"aria-invalid": error,
|
|
468
473
|
value: Array.isArray(value) ? value.join(',') : value,
|
|
469
474
|
name: name,
|
|
470
475
|
ref: inputRef,
|
|
@@ -556,6 +561,10 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
556
561
|
* If `true`, the selected item is displayed even if its value is empty.
|
|
557
562
|
*/
|
|
558
563
|
displayEmpty: PropTypes.bool,
|
|
564
|
+
/**
|
|
565
|
+
* If `true`, the `select input` will indicate an error.
|
|
566
|
+
*/
|
|
567
|
+
error: PropTypes.bool,
|
|
559
568
|
/**
|
|
560
569
|
* The icon that displays the arrow.
|
|
561
570
|
*/
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getSelectUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiSelect', slot);
|
|
5
5
|
}
|
|
6
|
-
var selectClasses = generateUtilityClasses('MuiSelect', ['select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput']);
|
|
6
|
+
var selectClasses = generateUtilityClasses('MuiSelect', ['select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
7
7
|
export default selectClasses;
|
package/legacy/Slider/Slider.js
CHANGED
|
@@ -268,13 +268,13 @@ var StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
|
268
268
|
var theme = _ref5.theme,
|
|
269
269
|
ownerState = _ref5.ownerState;
|
|
270
270
|
return _extends((_extends4 = {}, _defineProperty(_extends4, "&.".concat(sliderClasses.valueLabelOpen), {
|
|
271
|
-
transform: 'translateY(-100%) scale(1)
|
|
271
|
+
transform: "".concat(ownerState.orientation === 'vertical' ? 'translateY(-50%)' : 'translateY(-100%)', " scale(1)")
|
|
272
272
|
}), _defineProperty(_extends4, "zIndex", 1), _defineProperty(_extends4, "whiteSpace", 'nowrap'), _extends4), theme.typography.body2, {
|
|
273
273
|
fontWeight: 500,
|
|
274
274
|
transition: theme.transitions.create(['transform'], {
|
|
275
275
|
duration: theme.transitions.duration.shortest
|
|
276
276
|
}),
|
|
277
|
-
transform: 'translateY(-100%) scale(0)
|
|
277
|
+
transform: "".concat(ownerState.orientation === 'vertical' ? 'translateY(-50%)' : 'translateY(-100%)', " scale(0)"),
|
|
278
278
|
position: 'absolute',
|
|
279
279
|
backgroundColor: (theme.vars || theme).palette.grey[600],
|
|
280
280
|
borderRadius: 2,
|
|
@@ -297,18 +297,18 @@ var StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
|
297
297
|
left: '50%'
|
|
298
298
|
}
|
|
299
299
|
}, ownerState.orientation === 'vertical' && {
|
|
300
|
-
right: '30px',
|
|
301
|
-
top: '
|
|
300
|
+
right: ownerState.size === 'small' ? '20px' : '30px',
|
|
301
|
+
top: '50%',
|
|
302
302
|
transformOrigin: 'right center',
|
|
303
303
|
'&:before': {
|
|
304
304
|
position: 'absolute',
|
|
305
305
|
content: '""',
|
|
306
306
|
width: 8,
|
|
307
307
|
height: 8,
|
|
308
|
-
transform: 'translate(-50%, 50%) rotate(45deg)',
|
|
308
|
+
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
309
309
|
backgroundColor: 'inherit',
|
|
310
310
|
right: '-20%',
|
|
311
|
-
top: '
|
|
311
|
+
top: '50%'
|
|
312
312
|
}
|
|
313
313
|
}, ownerState.size === 'small' && {
|
|
314
314
|
fontSize: theme.typography.pxToRem(12),
|
package/legacy/index.js
CHANGED
|
@@ -449,6 +449,9 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
449
449
|
}));
|
|
450
450
|
const hasClearIcon = !disableClearable && !disabled && dirty && !readOnly;
|
|
451
451
|
const hasPopupIcon = (!freeSolo || forcePopupIcon === true) && forcePopupIcon !== false;
|
|
452
|
+
const {
|
|
453
|
+
onMouseDown: handleInputMouseDown
|
|
454
|
+
} = getInputProps();
|
|
452
455
|
|
|
453
456
|
// If you modify this, make sure to keep the `AutocompleteOwnerState` type in sync.
|
|
454
457
|
const ownerState = _extends({}, props, {
|
|
@@ -539,7 +542,12 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
539
542
|
InputProps: _extends({
|
|
540
543
|
ref: setAnchorEl,
|
|
541
544
|
className: classes.inputRoot,
|
|
542
|
-
startAdornment
|
|
545
|
+
startAdornment,
|
|
546
|
+
onClick: event => {
|
|
547
|
+
if (event.target === event.currentTarget) {
|
|
548
|
+
handleInputMouseDown(event);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
543
551
|
}, (hasClearIcon || hasPopupIcon) && {
|
|
544
552
|
endAdornment: /*#__PURE__*/_jsxs(AutocompleteEndAdornment, {
|
|
545
553
|
className: classes.endAdornment,
|
|
@@ -30,6 +30,8 @@ const CardActionAreaRoot = styled(ButtonBase, {
|
|
|
30
30
|
}) => ({
|
|
31
31
|
display: 'block',
|
|
32
32
|
textAlign: 'inherit',
|
|
33
|
+
borderRadius: 'inherit',
|
|
34
|
+
// for Safari to work https://github.com/mui/material-ui/issues/36285.
|
|
33
35
|
width: '100%',
|
|
34
36
|
[`&:hover .${cardActionAreaClasses.focusHighlight}`]: {
|
|
35
37
|
opacity: (theme.vars || theme).palette.action.hoverOpacity,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["className", "disabled", "IconComponent", "inputRef", "variant"];
|
|
3
|
+
const _excluded = ["className", "disabled", "error", "IconComponent", "inputRef", "variant"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
@@ -17,10 +17,11 @@ const useUtilityClasses = ownerState => {
|
|
|
17
17
|
variant,
|
|
18
18
|
disabled,
|
|
19
19
|
multiple,
|
|
20
|
-
open
|
|
20
|
+
open,
|
|
21
|
+
error
|
|
21
22
|
} = ownerState;
|
|
22
23
|
const slots = {
|
|
23
|
-
select: ['select', variant, disabled && 'disabled', multiple && 'multiple'],
|
|
24
|
+
select: ['select', variant, disabled && 'disabled', multiple && 'multiple', error && 'error'],
|
|
24
25
|
icon: ['icon', `icon${capitalize(variant)}`, open && 'iconOpen', disabled && 'disabled']
|
|
25
26
|
};
|
|
26
27
|
return composeClasses(slots, getNativeSelectUtilityClasses, classes);
|
|
@@ -87,7 +88,7 @@ const NativeSelectSelect = styled('select', {
|
|
|
87
88
|
const {
|
|
88
89
|
ownerState
|
|
89
90
|
} = props;
|
|
90
|
-
return [styles.select, styles[ownerState.variant], {
|
|
91
|
+
return [styles.select, styles[ownerState.variant], ownerState.error && styles.error, {
|
|
91
92
|
[`&.${nativeSelectClasses.multiple}`]: styles.multiple
|
|
92
93
|
}];
|
|
93
94
|
}
|
|
@@ -133,6 +134,7 @@ const NativeSelectInput = /*#__PURE__*/React.forwardRef(function NativeSelectInp
|
|
|
133
134
|
const {
|
|
134
135
|
className,
|
|
135
136
|
disabled,
|
|
137
|
+
error,
|
|
136
138
|
IconComponent,
|
|
137
139
|
inputRef,
|
|
138
140
|
variant = 'standard'
|
|
@@ -140,7 +142,8 @@ const NativeSelectInput = /*#__PURE__*/React.forwardRef(function NativeSelectInp
|
|
|
140
142
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
141
143
|
const ownerState = _extends({}, props, {
|
|
142
144
|
disabled,
|
|
143
|
-
variant
|
|
145
|
+
variant,
|
|
146
|
+
error
|
|
144
147
|
});
|
|
145
148
|
const classes = useUtilityClasses(ownerState);
|
|
146
149
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -175,6 +178,10 @@ process.env.NODE_ENV !== "production" ? NativeSelectInput.propTypes = {
|
|
|
175
178
|
* If `true`, the select is disabled.
|
|
176
179
|
*/
|
|
177
180
|
disabled: PropTypes.bool,
|
|
181
|
+
/**
|
|
182
|
+
* If `true`, the `select input` will indicate an error.
|
|
183
|
+
*/
|
|
184
|
+
error: PropTypes.bool,
|
|
178
185
|
/**
|
|
179
186
|
* The icon that displays the arrow.
|
|
180
187
|
*/
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getNativeSelectUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiNativeSelect', slot);
|
|
5
5
|
}
|
|
6
|
-
const nativeSelectClasses = generateUtilityClasses('MuiNativeSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput']);
|
|
6
|
+
const nativeSelectClasses = generateUtilityClasses('MuiNativeSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
7
7
|
export default nativeSelectClasses;
|
package/modern/Select/Select.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
var _StyledInput, _StyledFilledInput;
|
|
4
3
|
const _excluded = ["autoWidth", "children", "classes", "className", "defaultOpen", "displayEmpty", "IconComponent", "id", "input", "inputProps", "label", "labelId", "MenuProps", "multiple", "native", "onClose", "onOpen", "open", "renderValue", "SelectDisplayProps", "variant"];
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import PropTypes from 'prop-types';
|
|
@@ -67,21 +66,26 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
67
66
|
const fcs = formControlState({
|
|
68
67
|
props,
|
|
69
68
|
muiFormControl,
|
|
70
|
-
states: ['variant']
|
|
69
|
+
states: ['variant', 'error']
|
|
71
70
|
});
|
|
72
71
|
const variant = fcs.variant || variantProp;
|
|
73
|
-
const InputComponent = input || {
|
|
74
|
-
standard: _StyledInput || (_StyledInput = /*#__PURE__*/_jsx(StyledInput, {})),
|
|
75
|
-
outlined: /*#__PURE__*/_jsx(StyledOutlinedInput, {
|
|
76
|
-
label: label
|
|
77
|
-
}),
|
|
78
|
-
filled: _StyledFilledInput || (_StyledFilledInput = /*#__PURE__*/_jsx(StyledFilledInput, {}))
|
|
79
|
-
}[variant];
|
|
80
72
|
const ownerState = _extends({}, props, {
|
|
81
73
|
variant,
|
|
82
74
|
classes: classesProp
|
|
83
75
|
});
|
|
84
76
|
const classes = useUtilityClasses(ownerState);
|
|
77
|
+
const InputComponent = input || {
|
|
78
|
+
standard: /*#__PURE__*/_jsx(StyledInput, {
|
|
79
|
+
ownerState: ownerState
|
|
80
|
+
}),
|
|
81
|
+
outlined: /*#__PURE__*/_jsx(StyledOutlinedInput, {
|
|
82
|
+
label: label,
|
|
83
|
+
ownerState: ownerState
|
|
84
|
+
}),
|
|
85
|
+
filled: /*#__PURE__*/_jsx(StyledFilledInput, {
|
|
86
|
+
ownerState: ownerState
|
|
87
|
+
})
|
|
88
|
+
}[variant];
|
|
85
89
|
const inputComponentRef = useForkRef(ref, InputComponent.ref);
|
|
86
90
|
return /*#__PURE__*/_jsx(React.Fragment, {
|
|
87
91
|
children: /*#__PURE__*/React.cloneElement(InputComponent, _extends({
|
|
@@ -90,6 +94,7 @@ const Select = /*#__PURE__*/React.forwardRef(function Select(inProps, ref) {
|
|
|
90
94
|
inputComponent,
|
|
91
95
|
inputProps: _extends({
|
|
92
96
|
children,
|
|
97
|
+
error: fcs.error,
|
|
93
98
|
IconComponent,
|
|
94
99
|
variant,
|
|
95
100
|
type: undefined,
|
|
@@ -2,7 +2,7 @@ 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
|
var _span;
|
|
5
|
-
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
|
+
const _excluded = ["aria-describedby", "aria-label", "autoFocus", "autoWidth", "children", "className", "defaultOpen", "defaultValue", "disabled", "displayEmpty", "error", "IconComponent", "inputRef", "labelId", "MenuProps", "multiple", "name", "onBlur", "onChange", "onClose", "onFocus", "onOpen", "open", "readOnly", "renderValue", "SelectDisplayProps", "tabIndex", "type", "value", "variant"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { isFragment } from 'react-is';
|
|
8
8
|
import PropTypes from 'prop-types';
|
|
@@ -33,6 +33,8 @@ const SelectSelect = styled('div', {
|
|
|
33
33
|
[`&.${selectClasses.select}`]: styles.select
|
|
34
34
|
}, {
|
|
35
35
|
[`&.${selectClasses.select}`]: styles[ownerState.variant]
|
|
36
|
+
}, {
|
|
37
|
+
[`&.${selectClasses.error}`]: styles.error
|
|
36
38
|
}, {
|
|
37
39
|
[`&.${selectClasses.multiple}`]: styles.multiple
|
|
38
40
|
}];
|
|
@@ -90,10 +92,11 @@ const useUtilityClasses = ownerState => {
|
|
|
90
92
|
variant,
|
|
91
93
|
disabled,
|
|
92
94
|
multiple,
|
|
93
|
-
open
|
|
95
|
+
open,
|
|
96
|
+
error
|
|
94
97
|
} = ownerState;
|
|
95
98
|
const slots = {
|
|
96
|
-
select: ['select', variant, disabled && 'disabled', multiple && 'multiple'],
|
|
99
|
+
select: ['select', variant, disabled && 'disabled', multiple && 'multiple', error && 'error'],
|
|
97
100
|
icon: ['icon', `icon${capitalize(variant)}`, open && 'iconOpen', disabled && 'disabled'],
|
|
98
101
|
nativeInput: ['nativeInput']
|
|
99
102
|
};
|
|
@@ -115,6 +118,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
115
118
|
defaultValue,
|
|
116
119
|
disabled,
|
|
117
120
|
displayEmpty,
|
|
121
|
+
error = false,
|
|
118
122
|
IconComponent,
|
|
119
123
|
inputRef: inputRefProp,
|
|
120
124
|
labelId,
|
|
@@ -420,7 +424,8 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
420
424
|
const ownerState = _extends({}, props, {
|
|
421
425
|
variant,
|
|
422
426
|
value,
|
|
423
|
-
open
|
|
427
|
+
open,
|
|
428
|
+
error
|
|
424
429
|
});
|
|
425
430
|
const classes = useUtilityClasses(ownerState);
|
|
426
431
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
@@ -450,6 +455,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
450
455
|
children: "\u200B"
|
|
451
456
|
})) : display
|
|
452
457
|
})), /*#__PURE__*/_jsx(SelectNativeInput, _extends({
|
|
458
|
+
"aria-invalid": error,
|
|
453
459
|
value: Array.isArray(value) ? value.join(',') : value,
|
|
454
460
|
name: name,
|
|
455
461
|
ref: inputRef,
|
|
@@ -541,6 +547,10 @@ process.env.NODE_ENV !== "production" ? SelectInput.propTypes = {
|
|
|
541
547
|
* If `true`, the selected item is displayed even if its value is empty.
|
|
542
548
|
*/
|
|
543
549
|
displayEmpty: PropTypes.bool,
|
|
550
|
+
/**
|
|
551
|
+
* If `true`, the `select input` will indicate an error.
|
|
552
|
+
*/
|
|
553
|
+
error: PropTypes.bool,
|
|
544
554
|
/**
|
|
545
555
|
* The icon that displays the arrow.
|
|
546
556
|
*/
|
|
@@ -3,5 +3,5 @@ import generateUtilityClass from '../generateUtilityClass';
|
|
|
3
3
|
export function getSelectUtilityClasses(slot) {
|
|
4
4
|
return generateUtilityClass('MuiSelect', slot);
|
|
5
5
|
}
|
|
6
|
-
const selectClasses = generateUtilityClasses('MuiSelect', ['select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput']);
|
|
6
|
+
const selectClasses = generateUtilityClasses('MuiSelect', ['select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'focused', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
7
7
|
export default selectClasses;
|
package/modern/Slider/Slider.js
CHANGED
|
@@ -269,7 +269,7 @@ const StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
|
269
269
|
ownerState
|
|
270
270
|
}) => _extends({
|
|
271
271
|
[`&.${sliderClasses.valueLabelOpen}`]: {
|
|
272
|
-
transform: 'translateY(-100%) scale(1)
|
|
272
|
+
transform: `${ownerState.orientation === 'vertical' ? 'translateY(-50%)' : 'translateY(-100%)'} scale(1)`
|
|
273
273
|
},
|
|
274
274
|
zIndex: 1,
|
|
275
275
|
whiteSpace: 'nowrap'
|
|
@@ -278,7 +278,7 @@ const StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
|
278
278
|
transition: theme.transitions.create(['transform'], {
|
|
279
279
|
duration: theme.transitions.duration.shortest
|
|
280
280
|
}),
|
|
281
|
-
transform: 'translateY(-100%) scale(0)
|
|
281
|
+
transform: `${ownerState.orientation === 'vertical' ? 'translateY(-50%)' : 'translateY(-100%)'} scale(0)`,
|
|
282
282
|
position: 'absolute',
|
|
283
283
|
backgroundColor: (theme.vars || theme).palette.grey[600],
|
|
284
284
|
borderRadius: 2,
|
|
@@ -301,18 +301,18 @@ const StyledSliderValueLabel = styled(SliderValueLabel, {
|
|
|
301
301
|
left: '50%'
|
|
302
302
|
}
|
|
303
303
|
}, ownerState.orientation === 'vertical' && {
|
|
304
|
-
right: '30px',
|
|
305
|
-
top: '
|
|
304
|
+
right: ownerState.size === 'small' ? '20px' : '30px',
|
|
305
|
+
top: '50%',
|
|
306
306
|
transformOrigin: 'right center',
|
|
307
307
|
'&:before': {
|
|
308
308
|
position: 'absolute',
|
|
309
309
|
content: '""',
|
|
310
310
|
width: 8,
|
|
311
311
|
height: 8,
|
|
312
|
-
transform: 'translate(-50%, 50%) rotate(45deg)',
|
|
312
|
+
transform: 'translate(-50%, -50%) rotate(45deg)',
|
|
313
313
|
backgroundColor: 'inherit',
|
|
314
314
|
right: '-20%',
|
|
315
|
-
top: '
|
|
315
|
+
top: '50%'
|
|
316
316
|
}
|
|
317
317
|
}, ownerState.size === 'small' && {
|
|
318
318
|
fontSize: theme.typography.pxToRem(12),
|
package/modern/index.js
CHANGED
|
@@ -466,6 +466,9 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
466
466
|
}));
|
|
467
467
|
const hasClearIcon = !disableClearable && !disabled && dirty && !readOnly;
|
|
468
468
|
const hasPopupIcon = (!freeSolo || forcePopupIcon === true) && forcePopupIcon !== false;
|
|
469
|
+
const {
|
|
470
|
+
onMouseDown: handleInputMouseDown
|
|
471
|
+
} = getInputProps();
|
|
469
472
|
|
|
470
473
|
// If you modify this, make sure to keep the `AutocompleteOwnerState` type in sync.
|
|
471
474
|
const ownerState = (0, _extends2.default)({}, props, {
|
|
@@ -556,7 +559,12 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
|
|
|
556
559
|
InputProps: (0, _extends2.default)({
|
|
557
560
|
ref: setAnchorEl,
|
|
558
561
|
className: classes.inputRoot,
|
|
559
|
-
startAdornment
|
|
562
|
+
startAdornment,
|
|
563
|
+
onClick: event => {
|
|
564
|
+
if (event.target === event.currentTarget) {
|
|
565
|
+
handleInputMouseDown(event);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
560
568
|
}, (hasClearIcon || hasPopupIcon) && {
|
|
561
569
|
endAdornment: /*#__PURE__*/(0, _jsxRuntime.jsxs)(AutocompleteEndAdornment, {
|
|
562
570
|
className: classes.endAdornment,
|
|
@@ -38,6 +38,8 @@ const CardActionAreaRoot = (0, _styled.default)(_ButtonBase.default, {
|
|
|
38
38
|
}) => ({
|
|
39
39
|
display: 'block',
|
|
40
40
|
textAlign: 'inherit',
|
|
41
|
+
borderRadius: 'inherit',
|
|
42
|
+
// for Safari to work https://github.com/mui/material-ui/issues/36285.
|
|
41
43
|
width: '100%',
|
|
42
44
|
[`&:hover .${_cardActionAreaClasses.default.focusHighlight}`]: {
|
|
43
45
|
opacity: (theme.vars || theme).palette.action.hoverOpacity,
|
|
@@ -16,7 +16,7 @@ var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
|
16
16
|
var _nativeSelectClasses = _interopRequireWildcard(require("./nativeSelectClasses"));
|
|
17
17
|
var _styled = _interopRequireWildcard(require("../styles/styled"));
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["className", "disabled", "IconComponent", "inputRef", "variant"];
|
|
19
|
+
const _excluded = ["className", "disabled", "error", "IconComponent", "inputRef", "variant"];
|
|
20
20
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
21
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
22
|
const useUtilityClasses = ownerState => {
|
|
@@ -25,10 +25,11 @@ const useUtilityClasses = ownerState => {
|
|
|
25
25
|
variant,
|
|
26
26
|
disabled,
|
|
27
27
|
multiple,
|
|
28
|
-
open
|
|
28
|
+
open,
|
|
29
|
+
error
|
|
29
30
|
} = ownerState;
|
|
30
31
|
const slots = {
|
|
31
|
-
select: ['select', variant, disabled && 'disabled', multiple && 'multiple'],
|
|
32
|
+
select: ['select', variant, disabled && 'disabled', multiple && 'multiple', error && 'error'],
|
|
32
33
|
icon: ['icon', `icon${(0, _capitalize.default)(variant)}`, open && 'iconOpen', disabled && 'disabled']
|
|
33
34
|
};
|
|
34
35
|
return (0, _base.unstable_composeClasses)(slots, _nativeSelectClasses.getNativeSelectUtilityClasses, classes);
|
|
@@ -96,7 +97,7 @@ const NativeSelectSelect = (0, _styled.default)('select', {
|
|
|
96
97
|
const {
|
|
97
98
|
ownerState
|
|
98
99
|
} = props;
|
|
99
|
-
return [styles.select, styles[ownerState.variant], {
|
|
100
|
+
return [styles.select, styles[ownerState.variant], ownerState.error && styles.error, {
|
|
100
101
|
[`&.${_nativeSelectClasses.default.multiple}`]: styles.multiple
|
|
101
102
|
}];
|
|
102
103
|
}
|
|
@@ -143,6 +144,7 @@ const NativeSelectInput = /*#__PURE__*/React.forwardRef(function NativeSelectInp
|
|
|
143
144
|
const {
|
|
144
145
|
className,
|
|
145
146
|
disabled,
|
|
147
|
+
error,
|
|
146
148
|
IconComponent,
|
|
147
149
|
inputRef,
|
|
148
150
|
variant = 'standard'
|
|
@@ -150,7 +152,8 @@ const NativeSelectInput = /*#__PURE__*/React.forwardRef(function NativeSelectInp
|
|
|
150
152
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
151
153
|
const ownerState = (0, _extends2.default)({}, props, {
|
|
152
154
|
disabled,
|
|
153
|
-
variant
|
|
155
|
+
variant,
|
|
156
|
+
error
|
|
154
157
|
});
|
|
155
158
|
const classes = useUtilityClasses(ownerState);
|
|
156
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
@@ -185,6 +188,10 @@ process.env.NODE_ENV !== "production" ? NativeSelectInput.propTypes = {
|
|
|
185
188
|
* If `true`, the select is disabled.
|
|
186
189
|
*/
|
|
187
190
|
disabled: _propTypes.default.bool,
|
|
191
|
+
/**
|
|
192
|
+
* If `true`, the `select input` will indicate an error.
|
|
193
|
+
*/
|
|
194
|
+
error: _propTypes.default.bool,
|
|
188
195
|
/**
|
|
189
196
|
* The icon that displays the arrow.
|
|
190
197
|
*/
|
|
@@ -11,6 +11,6 @@ var _generateUtilityClass = _interopRequireDefault(require("../generateUtilityCl
|
|
|
11
11
|
function getNativeSelectUtilityClasses(slot) {
|
|
12
12
|
return (0, _generateUtilityClass.default)('MuiNativeSelect', slot);
|
|
13
13
|
}
|
|
14
|
-
const nativeSelectClasses = (0, _utils.unstable_generateUtilityClasses)('MuiNativeSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput']);
|
|
14
|
+
const nativeSelectClasses = (0, _utils.unstable_generateUtilityClasses)('MuiNativeSelect', ['root', 'select', 'multiple', 'filled', 'outlined', 'standard', 'disabled', 'icon', 'iconOpen', 'iconFilled', 'iconOutlined', 'iconStandard', 'nativeInput', 'error']);
|
|
15
15
|
var _default = nativeSelectClasses;
|
|
16
16
|
exports.default = _default;
|