@mui/material 9.0.0 → 9.0.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.js +65 -11
- package/Autocomplete/Autocomplete.mjs +65 -11
- package/Avatar/Avatar.js +4 -0
- package/Avatar/Avatar.mjs +4 -0
- package/Badge/Badge.js +3 -0
- package/Badge/Badge.mjs +3 -0
- package/Button/Button.js +19 -2
- package/Button/Button.mjs +19 -2
- package/ButtonBase/ButtonBase.d.mts +7 -0
- package/ButtonBase/ButtonBase.d.ts +7 -0
- package/ButtonBase/ButtonBase.js +5 -2
- package/ButtonBase/ButtonBase.mjs +5 -2
- package/CHANGELOG.md +132 -1245
- package/Checkbox/Checkbox.js +2 -1
- package/Checkbox/Checkbox.mjs +2 -1
- package/CircularProgress/CircularProgress.d.mts +12 -2
- package/CircularProgress/CircularProgress.d.ts +12 -2
- package/CircularProgress/CircularProgress.js +33 -6
- package/CircularProgress/CircularProgress.mjs +33 -6
- package/ClickAwayListener/ClickAwayListener.js +3 -6
- package/ClickAwayListener/ClickAwayListener.mjs +3 -6
- package/Dialog/Dialog.js +11 -6
- package/Dialog/Dialog.mjs +11 -6
- package/Drawer/Drawer.js +18 -4
- package/Drawer/Drawer.mjs +18 -4
- package/Fab/Fab.js +7 -1
- package/Fab/Fab.mjs +7 -1
- package/FilledInput/FilledInput.d.mts +4 -0
- package/FilledInput/FilledInput.d.ts +4 -0
- package/FilledInput/FilledInput.js +18 -20
- package/FilledInput/FilledInput.mjs +18 -20
- package/FormControl/useFormControl.d.mts +12 -2
- package/FormControl/useFormControl.d.ts +12 -2
- package/FormControl/useFormControl.js +13 -0
- package/FormControl/useFormControl.mjs +12 -0
- package/FormControlLabel/FormControlLabel.js +5 -8
- package/FormControlLabel/FormControlLabel.mjs +5 -8
- package/FormGroup/FormGroup.js +2 -5
- package/FormGroup/FormGroup.mjs +2 -5
- package/FormHelperText/FormHelperText.js +2 -5
- package/FormHelperText/FormHelperText.mjs +2 -5
- package/FormLabel/FormLabel.js +2 -5
- package/FormLabel/FormLabel.mjs +2 -5
- package/IconButton/IconButton.js +1 -8
- package/IconButton/IconButton.mjs +1 -8
- package/Input/Input.d.mts +4 -0
- package/Input/Input.d.ts +4 -0
- package/Input/Input.js +6 -0
- package/Input/Input.mjs +6 -0
- package/InputBase/InputBase.d.mts +2 -1
- package/InputBase/InputBase.d.ts +2 -1
- package/InputBase/InputBase.js +50 -15
- package/InputBase/InputBase.mjs +50 -15
- package/InputLabel/InputLabel.js +5 -8
- package/InputLabel/InputLabel.mjs +5 -8
- package/LinearProgress/LinearProgress.d.mts +12 -2
- package/LinearProgress/LinearProgress.d.ts +12 -2
- package/LinearProgress/LinearProgress.js +42 -10
- package/LinearProgress/LinearProgress.mjs +42 -10
- package/List/List.js +2 -1
- package/List/List.mjs +2 -1
- package/ListItemButton/ListItemButton.js +7 -1
- package/ListItemButton/ListItemButton.mjs +7 -1
- package/MenuItem/MenuItem.js +7 -1
- package/MenuItem/MenuItem.mjs +7 -1
- package/MenuList/MenuList.js +2 -1
- package/MenuList/MenuList.mjs +2 -1
- package/NativeSelect/NativeSelect.js +2 -5
- package/NativeSelect/NativeSelect.mjs +2 -5
- package/OutlinedInput/OutlinedInput.js +13 -23
- package/OutlinedInput/OutlinedInput.mjs +13 -23
- package/PigmentContainer/PigmentContainer.js +0 -1
- package/PigmentContainer/PigmentContainer.mjs +0 -1
- package/Popper/BasePopper.js +23 -1
- package/Popper/BasePopper.mjs +23 -1
- package/Select/Select.js +2 -5
- package/Select/Select.mjs +2 -5
- package/Select/SelectInput.js +164 -2
- package/Select/SelectInput.mjs +164 -2
- package/Slide/Slide.js +48 -26
- package/Slide/Slide.mjs +49 -27
- package/Slider/Slider.js +10 -1
- package/Slider/Slider.mjs +10 -1
- package/Slider/useSlider.js +3 -2
- package/Slider/useSlider.mjs +3 -2
- package/SwipeableDrawer/SwipeableDrawer.js +7 -3
- package/SwipeableDrawer/SwipeableDrawer.mjs +7 -3
- package/Switch/Switch.js +7 -6
- package/Switch/Switch.mjs +7 -6
- package/Tabs/ScrollbarSize.js +2 -1
- package/Tabs/ScrollbarSize.mjs +2 -1
- package/Tabs/Tabs.js +2 -1
- package/Tabs/Tabs.mjs +2 -1
- package/Tooltip/Tooltip.js +26 -108
- package/Tooltip/Tooltip.mjs +26 -108
- package/Unstable_TrapFocus/FocusTrap.js +18 -14
- package/Unstable_TrapFocus/FocusTrap.mjs +18 -14
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/package.json +49 -49
- package/styles/responsiveFontSizes.js +19 -8
- package/styles/responsiveFontSizes.mjs +19 -8
- package/styles/useThemeProps.d.mts +3 -3
- package/styles/useThemeProps.d.ts +3 -3
- package/transitions/utils.d.mts +17 -0
- package/transitions/utils.d.ts +17 -0
- package/transitions/utils.js +64 -0
- package/transitions/utils.mjs +63 -0
- package/useAutocomplete/useAutocomplete.d.mts +4 -5
- package/useAutocomplete/useAutocomplete.d.ts +4 -5
- package/useAutocomplete/useAutocomplete.js +166 -53
- package/useAutocomplete/useAutocomplete.mjs +166 -53
- package/utils/contains.d.mts +2 -0
- package/utils/contains.d.ts +2 -0
- package/utils/contains.js +9 -0
- package/utils/contains.mjs +2 -0
- package/utils/focusable.d.mts +7 -0
- package/utils/focusable.d.ts +7 -0
- package/utils/focusable.js +20 -0
- package/utils/focusable.mjs +13 -0
- package/utils/getEventTarget.d.mts +2 -0
- package/utils/getEventTarget.d.ts +2 -0
- package/utils/getEventTarget.js +9 -0
- package/utils/getEventTarget.mjs +2 -0
- package/utils/mergeSlotProps.js +2 -8
- package/utils/mergeSlotProps.mjs +1 -8
- package/version/index.js +2 -2
- package/version/index.mjs +2 -2
- package/FormControl/formControlState.js +0 -21
- package/FormControl/formControlState.mjs +0 -15
|
@@ -194,28 +194,20 @@ const FilledInputInput = styled(InputBaseInput, {
|
|
|
194
194
|
paddingRight: 12,
|
|
195
195
|
paddingBottom: 8,
|
|
196
196
|
paddingLeft: 12,
|
|
197
|
-
|
|
198
|
-
|
|
197
|
+
'&:-webkit-autofill': {
|
|
198
|
+
...(!theme.vars && {
|
|
199
199
|
WebkitBoxShadow: theme.palette.mode === 'light' ? null : '0 0 0 100px #266798 inset',
|
|
200
200
|
WebkitTextFillColor: theme.palette.mode === 'light' ? null : '#fff',
|
|
201
|
-
caretColor: theme.palette.mode === 'light' ? null : '#fff'
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
[theme.getColorSchemeSelector('dark')]: {
|
|
212
|
-
'&:-webkit-autofill': {
|
|
213
|
-
WebkitBoxShadow: '0 0 0 100px #266798 inset',
|
|
214
|
-
WebkitTextFillColor: '#fff',
|
|
215
|
-
caretColor: '#fff'
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
}),
|
|
201
|
+
caretColor: theme.palette.mode === 'light' ? null : '#fff'
|
|
202
|
+
}),
|
|
203
|
+
borderTopLeftRadius: 'inherit',
|
|
204
|
+
borderTopRightRadius: 'inherit',
|
|
205
|
+
...(theme.vars && theme.applyStyles('dark', {
|
|
206
|
+
WebkitBoxShadow: '0 0 0 100px #266798 inset',
|
|
207
|
+
WebkitTextFillColor: '#fff',
|
|
208
|
+
caretColor: '#fff'
|
|
209
|
+
}))
|
|
210
|
+
},
|
|
219
211
|
variants: [{
|
|
220
212
|
props: {
|
|
221
213
|
size: 'small'
|
|
@@ -278,6 +270,8 @@ const FilledInput = /*#__PURE__*/React.forwardRef(function FilledInput(inProps,
|
|
|
278
270
|
// declare here to prevent spreading to DOM
|
|
279
271
|
inputComponent = 'input',
|
|
280
272
|
multiline = false,
|
|
273
|
+
notched,
|
|
274
|
+
// declare here to prevent spreading to DOM
|
|
281
275
|
slotProps,
|
|
282
276
|
slots = {},
|
|
283
277
|
type = 'text',
|
|
@@ -421,6 +415,10 @@ process.env.NODE_ENV !== "production" ? FilledInput.propTypes /* remove-proptype
|
|
|
421
415
|
* Name attribute of the `input` element.
|
|
422
416
|
*/
|
|
423
417
|
name: PropTypes.string,
|
|
418
|
+
/**
|
|
419
|
+
* @internal
|
|
420
|
+
*/
|
|
421
|
+
notched: PropTypes.bool,
|
|
424
422
|
/**
|
|
425
423
|
* Callback fired when the value is changed.
|
|
426
424
|
*
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import { FormControlState } from "./FormControlContext.mjs";
|
|
2
|
-
|
|
1
|
+
import { type FormControlState } from "./FormControlContext.mjs";
|
|
2
|
+
type FormControlStateKey = keyof FormControlState;
|
|
3
|
+
type FormControlStateResult<Props, States extends readonly FormControlStateKey[]> = { [State in States[number]]: State extends keyof Props ? Props[State] | FormControlState[State] : FormControlState[State] };
|
|
4
|
+
export default function useFormControl(): FormControlState | undefined;
|
|
5
|
+
export declare function useFormControlState<Props, States extends readonly FormControlStateKey[]>({
|
|
6
|
+
props,
|
|
7
|
+
states
|
|
8
|
+
}: {
|
|
9
|
+
props: Props;
|
|
10
|
+
states: States;
|
|
11
|
+
}): [FormControlStateResult<Props, States>, FormControlState | undefined];
|
|
12
|
+
export {};
|
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import { FormControlState } from "./FormControlContext.js";
|
|
2
|
-
|
|
1
|
+
import { type FormControlState } from "./FormControlContext.js";
|
|
2
|
+
type FormControlStateKey = keyof FormControlState;
|
|
3
|
+
type FormControlStateResult<Props, States extends readonly FormControlStateKey[]> = { [State in States[number]]: State extends keyof Props ? Props[State] | FormControlState[State] : FormControlState[State] };
|
|
4
|
+
export default function useFormControl(): FormControlState | undefined;
|
|
5
|
+
export declare function useFormControlState<Props, States extends readonly FormControlStateKey[]>({
|
|
6
|
+
props,
|
|
7
|
+
states
|
|
8
|
+
}: {
|
|
9
|
+
props: Props;
|
|
10
|
+
states: States;
|
|
11
|
+
}): [FormControlStateResult<Props, States>, FormControlState | undefined];
|
|
12
|
+
export {};
|
|
@@ -7,8 +7,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = useFormControl;
|
|
10
|
+
exports.useFormControlState = useFormControlState;
|
|
10
11
|
var React = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _FormControlContext = _interopRequireDefault(require("./FormControlContext"));
|
|
12
13
|
function useFormControl() {
|
|
13
14
|
return React.useContext(_FormControlContext.default);
|
|
15
|
+
}
|
|
16
|
+
function useFormControlState({
|
|
17
|
+
props,
|
|
18
|
+
states
|
|
19
|
+
}) {
|
|
20
|
+
const muiFormControl = React.useContext(_FormControlContext.default);
|
|
21
|
+
const result = {};
|
|
22
|
+
states.forEach(state => {
|
|
23
|
+
const value = props[state];
|
|
24
|
+
result[state] = value === undefined && muiFormControl ? muiFormControl[state] : value;
|
|
25
|
+
});
|
|
26
|
+
return [result, muiFormControl];
|
|
14
27
|
}
|
|
@@ -4,4 +4,16 @@ import * as React from 'react';
|
|
|
4
4
|
import FormControlContext from "./FormControlContext.mjs";
|
|
5
5
|
export default function useFormControl() {
|
|
6
6
|
return React.useContext(FormControlContext);
|
|
7
|
+
}
|
|
8
|
+
export function useFormControlState({
|
|
9
|
+
props,
|
|
10
|
+
states
|
|
11
|
+
}) {
|
|
12
|
+
const muiFormControl = React.useContext(FormControlContext);
|
|
13
|
+
const result = {};
|
|
14
|
+
states.forEach(state => {
|
|
15
|
+
const value = props[state];
|
|
16
|
+
result[state] = value === undefined && muiFormControl ? muiFormControl[state] : value;
|
|
17
|
+
});
|
|
18
|
+
return [result, muiFormControl];
|
|
7
19
|
}
|
|
@@ -12,14 +12,13 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
|
14
14
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
-
var
|
|
15
|
+
var _useFormControl = require("../FormControl/useFormControl");
|
|
16
16
|
var _zeroStyled = require("../zero-styled");
|
|
17
17
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
18
18
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
19
19
|
var _Typography = _interopRequireDefault(require("../Typography"));
|
|
20
20
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
21
21
|
var _formControlLabelClasses = _interopRequireWildcard(require("./formControlLabelClasses"));
|
|
22
|
-
var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
|
|
23
22
|
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
24
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
24
|
const useUtilityClasses = ownerState => {
|
|
@@ -136,7 +135,10 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
|
|
|
136
135
|
value,
|
|
137
136
|
...other
|
|
138
137
|
} = props;
|
|
139
|
-
const muiFormControl = (0,
|
|
138
|
+
const [fcs, muiFormControl] = (0, _useFormControl.useFormControlState)({
|
|
139
|
+
props,
|
|
140
|
+
states: ['error']
|
|
141
|
+
});
|
|
140
142
|
const disabled = disabledProp ?? control.props.disabled ?? muiFormControl?.disabled;
|
|
141
143
|
const required = requiredProp ?? control.props.required;
|
|
142
144
|
const controlProps = {
|
|
@@ -148,11 +150,6 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
|
|
|
148
150
|
controlProps[key] = props[key];
|
|
149
151
|
}
|
|
150
152
|
});
|
|
151
|
-
const fcs = (0, _formControlState.default)({
|
|
152
|
-
props,
|
|
153
|
-
muiFormControl,
|
|
154
|
-
states: ['error']
|
|
155
|
-
});
|
|
156
153
|
const ownerState = {
|
|
157
154
|
...props,
|
|
158
155
|
disabled,
|
|
@@ -5,14 +5,13 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import refType from '@mui/utils/refType';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
-
import {
|
|
8
|
+
import { useFormControlState } from "../FormControl/useFormControl.mjs";
|
|
9
9
|
import { styled } from "../zero-styled/index.mjs";
|
|
10
10
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
11
11
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
12
12
|
import Typography from "../Typography/index.mjs";
|
|
13
13
|
import capitalize from "../utils/capitalize.mjs";
|
|
14
14
|
import formControlLabelClasses, { getFormControlLabelUtilityClasses } from "./formControlLabelClasses.mjs";
|
|
15
|
-
import formControlState from "../FormControl/formControlState.mjs";
|
|
16
15
|
import useSlot from "../utils/useSlot.mjs";
|
|
17
16
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
17
|
const useUtilityClasses = ownerState => {
|
|
@@ -129,7 +128,10 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
|
|
|
129
128
|
value,
|
|
130
129
|
...other
|
|
131
130
|
} = props;
|
|
132
|
-
const muiFormControl =
|
|
131
|
+
const [fcs, muiFormControl] = useFormControlState({
|
|
132
|
+
props,
|
|
133
|
+
states: ['error']
|
|
134
|
+
});
|
|
133
135
|
const disabled = disabledProp ?? control.props.disabled ?? muiFormControl?.disabled;
|
|
134
136
|
const required = requiredProp ?? control.props.required;
|
|
135
137
|
const controlProps = {
|
|
@@ -141,11 +143,6 @@ const FormControlLabel = /*#__PURE__*/React.forwardRef(function FormControlLabel
|
|
|
141
143
|
controlProps[key] = props[key];
|
|
142
144
|
}
|
|
143
145
|
});
|
|
144
|
-
const fcs = formControlState({
|
|
145
|
-
props,
|
|
146
|
-
muiFormControl,
|
|
147
|
-
states: ['error']
|
|
148
|
-
});
|
|
149
146
|
const ownerState = {
|
|
150
147
|
...props,
|
|
151
148
|
disabled,
|
package/FormGroup/FormGroup.js
CHANGED
|
@@ -14,8 +14,7 @@ var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"
|
|
|
14
14
|
var _zeroStyled = require("../zero-styled");
|
|
15
15
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
16
16
|
var _formGroupClasses = require("./formGroupClasses");
|
|
17
|
-
var _useFormControl =
|
|
18
|
-
var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
|
|
17
|
+
var _useFormControl = require("../FormControl/useFormControl");
|
|
19
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
19
|
const useUtilityClasses = ownerState => {
|
|
21
20
|
const {
|
|
@@ -66,10 +65,8 @@ const FormGroup = /*#__PURE__*/React.forwardRef(function FormGroup(inProps, ref)
|
|
|
66
65
|
row = false,
|
|
67
66
|
...other
|
|
68
67
|
} = props;
|
|
69
|
-
const
|
|
70
|
-
const fcs = (0, _formControlState.default)({
|
|
68
|
+
const [fcs] = (0, _useFormControl.useFormControlState)({
|
|
71
69
|
props,
|
|
72
|
-
muiFormControl,
|
|
73
70
|
states: ['error']
|
|
74
71
|
});
|
|
75
72
|
const ownerState = {
|
package/FormGroup/FormGroup.mjs
CHANGED
|
@@ -7,8 +7,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
7
7
|
import { styled } from "../zero-styled/index.mjs";
|
|
8
8
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
9
9
|
import { getFormGroupUtilityClass } from "./formGroupClasses.mjs";
|
|
10
|
-
import
|
|
11
|
-
import formControlState from "../FormControl/formControlState.mjs";
|
|
10
|
+
import { useFormControlState } from "../FormControl/useFormControl.mjs";
|
|
12
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
12
|
const useUtilityClasses = ownerState => {
|
|
14
13
|
const {
|
|
@@ -59,10 +58,8 @@ const FormGroup = /*#__PURE__*/React.forwardRef(function FormGroup(inProps, ref)
|
|
|
59
58
|
row = false,
|
|
60
59
|
...other
|
|
61
60
|
} = props;
|
|
62
|
-
const
|
|
63
|
-
const fcs = formControlState({
|
|
61
|
+
const [fcs] = useFormControlState({
|
|
64
62
|
props,
|
|
65
|
-
muiFormControl,
|
|
66
63
|
states: ['error']
|
|
67
64
|
});
|
|
68
65
|
const ownerState = {
|
|
@@ -11,8 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
|
-
var
|
|
15
|
-
var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
|
|
14
|
+
var _useFormControl = require("../FormControl/useFormControl");
|
|
16
15
|
var _zeroStyled = require("../zero-styled");
|
|
17
16
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
18
17
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
@@ -96,10 +95,8 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
96
95
|
variant,
|
|
97
96
|
...other
|
|
98
97
|
} = props;
|
|
99
|
-
const
|
|
100
|
-
const fcs = (0, _formControlState.default)({
|
|
98
|
+
const [fcs] = (0, _useFormControl.useFormControlState)({
|
|
101
99
|
props,
|
|
102
|
-
muiFormControl,
|
|
103
100
|
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
104
101
|
});
|
|
105
102
|
const ownerState = {
|
|
@@ -5,8 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
-
import
|
|
9
|
-
import useFormControl from "../FormControl/useFormControl.mjs";
|
|
8
|
+
import { useFormControlState } from "../FormControl/useFormControl.mjs";
|
|
10
9
|
import { styled } from "../zero-styled/index.mjs";
|
|
11
10
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
12
11
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
@@ -89,10 +88,8 @@ const FormHelperText = /*#__PURE__*/React.forwardRef(function FormHelperText(inP
|
|
|
89
88
|
variant,
|
|
90
89
|
...other
|
|
91
90
|
} = props;
|
|
92
|
-
const
|
|
93
|
-
const fcs = formControlState({
|
|
91
|
+
const [fcs] = useFormControlState({
|
|
94
92
|
props,
|
|
95
|
-
muiFormControl,
|
|
96
93
|
states: ['variant', 'size', 'disabled', 'error', 'filled', 'focused', 'required']
|
|
97
94
|
});
|
|
98
95
|
const ownerState = {
|
package/FormLabel/FormLabel.js
CHANGED
|
@@ -11,8 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
13
13
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
14
|
-
var
|
|
15
|
-
var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
|
|
14
|
+
var _useFormControl = require("../FormControl/useFormControl");
|
|
16
15
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
17
16
|
var _zeroStyled = require("../zero-styled");
|
|
18
17
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
@@ -101,10 +100,8 @@ const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref)
|
|
|
101
100
|
required,
|
|
102
101
|
...other
|
|
103
102
|
} = props;
|
|
104
|
-
const
|
|
105
|
-
const fcs = (0, _formControlState.default)({
|
|
103
|
+
const [fcs] = (0, _useFormControl.useFormControlState)({
|
|
106
104
|
props,
|
|
107
|
-
muiFormControl,
|
|
108
105
|
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
109
106
|
});
|
|
110
107
|
const ownerState = {
|
package/FormLabel/FormLabel.mjs
CHANGED
|
@@ -4,8 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
-
import
|
|
8
|
-
import useFormControl from "../FormControl/useFormControl.mjs";
|
|
7
|
+
import { useFormControlState } from "../FormControl/useFormControl.mjs";
|
|
9
8
|
import capitalize from "../utils/capitalize.mjs";
|
|
10
9
|
import { styled } from "../zero-styled/index.mjs";
|
|
11
10
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
@@ -94,10 +93,8 @@ const FormLabel = /*#__PURE__*/React.forwardRef(function FormLabel(inProps, ref)
|
|
|
94
93
|
required,
|
|
95
94
|
...other
|
|
96
95
|
} = props;
|
|
97
|
-
const
|
|
98
|
-
const fcs = formControlState({
|
|
96
|
+
const [fcs] = useFormControlState({
|
|
99
97
|
props,
|
|
100
|
-
muiFormControl,
|
|
101
98
|
states: ['color', 'required', 'focused', 'disabled', 'error', 'filled']
|
|
102
99
|
});
|
|
103
100
|
const ownerState = {
|
package/IconButton/IconButton.js
CHANGED
|
@@ -118,14 +118,7 @@ const IconButtonRoot = (0, _zeroStyled.styled)(_ButtonBase.default, {
|
|
|
118
118
|
color
|
|
119
119
|
},
|
|
120
120
|
style: {
|
|
121
|
-
color: (theme.vars || theme).palette[color].main
|
|
122
|
-
}
|
|
123
|
-
})), ...Object.entries(theme.palette).filter((0, _createSimplePaletteValueFilter.default)()) // check all the used fields in the style below
|
|
124
|
-
.map(([color]) => ({
|
|
125
|
-
props: {
|
|
126
|
-
color
|
|
127
|
-
},
|
|
128
|
-
style: {
|
|
121
|
+
color: (theme.vars || theme).palette[color].main,
|
|
129
122
|
'--IconButton-hoverBg': theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.hoverOpacity)
|
|
130
123
|
}
|
|
131
124
|
})), {
|
|
@@ -111,14 +111,7 @@ const IconButtonRoot = styled(ButtonBase, {
|
|
|
111
111
|
color
|
|
112
112
|
},
|
|
113
113
|
style: {
|
|
114
|
-
color: (theme.vars || theme).palette[color].main
|
|
115
|
-
}
|
|
116
|
-
})), ...Object.entries(theme.palette).filter(createSimplePaletteValueFilter()) // check all the used fields in the style below
|
|
117
|
-
.map(([color]) => ({
|
|
118
|
-
props: {
|
|
119
|
-
color
|
|
120
|
-
},
|
|
121
|
-
style: {
|
|
114
|
+
color: (theme.vars || theme).palette[color].main,
|
|
122
115
|
'--IconButton-hoverBg': theme.alpha((theme.vars || theme).palette[color].main, (theme.vars || theme).palette.action.hoverOpacity)
|
|
123
116
|
}
|
|
124
117
|
})), {
|
package/Input/Input.d.mts
CHANGED
|
@@ -13,6 +13,10 @@ export interface InputProps extends StandardProps<InputBaseProps> {
|
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
disableUnderline?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
notched?: boolean | undefined;
|
|
16
20
|
/**
|
|
17
21
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
18
22
|
*/
|
package/Input/Input.d.ts
CHANGED
|
@@ -13,6 +13,10 @@ export interface InputProps extends StandardProps<InputBaseProps> {
|
|
|
13
13
|
* @default false
|
|
14
14
|
*/
|
|
15
15
|
disableUnderline?: boolean | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
notched?: boolean | undefined;
|
|
16
20
|
/**
|
|
17
21
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
18
22
|
*/
|
package/Input/Input.js
CHANGED
|
@@ -146,6 +146,8 @@ const Input = /*#__PURE__*/React.forwardRef(function Input(inProps, ref) {
|
|
|
146
146
|
fullWidth = false,
|
|
147
147
|
inputComponent = 'input',
|
|
148
148
|
multiline = false,
|
|
149
|
+
notched,
|
|
150
|
+
// declare here to prevent spreading to DOM
|
|
149
151
|
slotProps,
|
|
150
152
|
slots = {},
|
|
151
153
|
type = 'text',
|
|
@@ -274,6 +276,10 @@ process.env.NODE_ENV !== "production" ? Input.propTypes /* remove-proptypes */ =
|
|
|
274
276
|
* Name attribute of the `input` element.
|
|
275
277
|
*/
|
|
276
278
|
name: _propTypes.default.string,
|
|
279
|
+
/**
|
|
280
|
+
* @internal
|
|
281
|
+
*/
|
|
282
|
+
notched: _propTypes.default.bool,
|
|
277
283
|
/**
|
|
278
284
|
* Callback fired when the value is changed.
|
|
279
285
|
*
|
package/Input/Input.mjs
CHANGED
|
@@ -139,6 +139,8 @@ const Input = /*#__PURE__*/React.forwardRef(function Input(inProps, ref) {
|
|
|
139
139
|
fullWidth = false,
|
|
140
140
|
inputComponent = 'input',
|
|
141
141
|
multiline = false,
|
|
142
|
+
notched,
|
|
143
|
+
// declare here to prevent spreading to DOM
|
|
142
144
|
slotProps,
|
|
143
145
|
slots = {},
|
|
144
146
|
type = 'text',
|
|
@@ -267,6 +269,10 @@ process.env.NODE_ENV !== "production" ? Input.propTypes /* remove-proptypes */ =
|
|
|
267
269
|
* Name attribute of the `input` element.
|
|
268
270
|
*/
|
|
269
271
|
name: PropTypes.string,
|
|
272
|
+
/**
|
|
273
|
+
* @internal
|
|
274
|
+
*/
|
|
275
|
+
notched: PropTypes.bool,
|
|
270
276
|
/**
|
|
271
277
|
* Callback fired when the value is changed.
|
|
272
278
|
*
|
|
@@ -13,8 +13,9 @@ export interface InputBaseProps extends StandardProps<React.HTMLAttributes<HTMLD
|
|
|
13
13
|
* which by default is an input or textarea. Since these handlers differ from the
|
|
14
14
|
* ones inherited by `React.HTMLAttributes<HTMLDivElement>` we need to omit them.
|
|
15
15
|
*/
|
|
16
|
-
'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp'> {
|
|
16
|
+
'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp' | 'aria-label'> {
|
|
17
17
|
'aria-describedby'?: string | undefined;
|
|
18
|
+
'aria-label'?: string | undefined;
|
|
18
19
|
/**
|
|
19
20
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
20
21
|
* The name can be confusing, as it's more like an autofill.
|
package/InputBase/InputBase.d.ts
CHANGED
|
@@ -13,8 +13,9 @@ export interface InputBaseProps extends StandardProps<React.HTMLAttributes<HTMLD
|
|
|
13
13
|
* which by default is an input or textarea. Since these handlers differ from the
|
|
14
14
|
* ones inherited by `React.HTMLAttributes<HTMLDivElement>` we need to omit them.
|
|
15
15
|
*/
|
|
16
|
-
'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp'> {
|
|
16
|
+
'children' | 'defaultValue' | 'onBlur' | 'onChange' | 'onFocus' | 'onInvalid' | 'onKeyDown' | 'onKeyUp' | 'aria-label'> {
|
|
17
17
|
'aria-describedby'?: string | undefined;
|
|
18
|
+
'aria-label'?: string | undefined;
|
|
18
19
|
/**
|
|
19
20
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
20
21
|
* The name can be confusing, as it's more like an autofill.
|
package/InputBase/InputBase.js
CHANGED
|
@@ -16,19 +16,22 @@ var _refType = _interopRequireDefault(require("@mui/utils/refType"));
|
|
|
16
16
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
17
17
|
var _isHostComponent = _interopRequireDefault(require("@mui/utils/isHostComponent"));
|
|
18
18
|
var _TextareaAutosize = _interopRequireDefault(require("../TextareaAutosize"));
|
|
19
|
-
var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
|
|
20
19
|
var _FormControlContext = _interopRequireDefault(require("../FormControl/FormControlContext"));
|
|
21
|
-
var _useFormControl =
|
|
20
|
+
var _useFormControl = require("../FormControl/useFormControl");
|
|
22
21
|
var _zeroStyled = require("../zero-styled");
|
|
23
22
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
24
23
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
25
24
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
26
25
|
var _useForkRef = _interopRequireDefault(require("../utils/useForkRef"));
|
|
27
26
|
var _useEnhancedEffect = _interopRequireDefault(require("../utils/useEnhancedEffect"));
|
|
27
|
+
var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
|
|
28
|
+
var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
|
|
28
29
|
var _utils = require("./utils");
|
|
29
30
|
var _inputBaseClasses = _interopRequireWildcard(require("./inputBaseClasses"));
|
|
30
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
32
|
var _InputGlobalStyles;
|
|
33
|
+
const MUI_AUTO_FILL = 'mui-auto-fill';
|
|
34
|
+
const MUI_AUTO_FILL_CANCEL = 'mui-auto-fill-cancel';
|
|
32
35
|
const rootOverridesResolver = (props, styles) => {
|
|
33
36
|
const {
|
|
34
37
|
ownerState
|
|
@@ -193,11 +196,11 @@ const InputBaseInput = exports.InputBaseInput = (0, _zeroStyled.styled)('input',
|
|
|
193
196
|
ownerState
|
|
194
197
|
}) => !ownerState.disableInjectingGlobalStyles,
|
|
195
198
|
style: {
|
|
196
|
-
animationName:
|
|
199
|
+
animationName: MUI_AUTO_FILL_CANCEL,
|
|
197
200
|
animationDuration: '10ms',
|
|
198
201
|
'&:-webkit-autofill': {
|
|
199
202
|
animationDuration: '5000s',
|
|
200
|
-
animationName:
|
|
203
|
+
animationName: MUI_AUTO_FILL
|
|
201
204
|
}
|
|
202
205
|
}
|
|
203
206
|
}, {
|
|
@@ -228,14 +231,16 @@ const InputBaseInput = exports.InputBaseInput = (0, _zeroStyled.styled)('input',
|
|
|
228
231
|
};
|
|
229
232
|
}));
|
|
230
233
|
const InputGlobalStyles = (0, _zeroStyled.globalCss)({
|
|
231
|
-
|
|
234
|
+
// Keep keyframes non-empty for Emotion production builds. Animation properties are ignored
|
|
235
|
+
// inside keyframes, avoiding the visible display animation triggered by Chrome 117+.
|
|
236
|
+
[`@keyframes ${MUI_AUTO_FILL}`]: {
|
|
232
237
|
from: {
|
|
233
|
-
|
|
238
|
+
animationName: MUI_AUTO_FILL
|
|
234
239
|
}
|
|
235
240
|
},
|
|
236
|
-
|
|
241
|
+
[`@keyframes ${MUI_AUTO_FILL_CANCEL}`]: {
|
|
237
242
|
from: {
|
|
238
|
-
|
|
243
|
+
animationName: MUI_AUTO_FILL_CANCEL
|
|
239
244
|
}
|
|
240
245
|
}
|
|
241
246
|
});
|
|
@@ -252,6 +257,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
252
257
|
});
|
|
253
258
|
const {
|
|
254
259
|
'aria-describedby': ariaDescribedby,
|
|
260
|
+
'aria-label': ariaLabel,
|
|
255
261
|
autoComplete,
|
|
256
262
|
autoFocus,
|
|
257
263
|
className,
|
|
@@ -303,7 +309,10 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
303
309
|
}, []);
|
|
304
310
|
const handleInputRef = (0, _useForkRef.default)(inputRef, inputRefProp, inputPropsProp.ref, handleInputRefWarning);
|
|
305
311
|
const [focused, setFocused] = React.useState(false);
|
|
306
|
-
const muiFormControl = (0, _useFormControl.
|
|
312
|
+
const [fcs, muiFormControl] = (0, _useFormControl.useFormControlState)({
|
|
313
|
+
props,
|
|
314
|
+
states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
|
|
315
|
+
});
|
|
307
316
|
if (process.env.NODE_ENV !== 'production') {
|
|
308
317
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
|
|
309
318
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -314,11 +323,6 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
314
323
|
return undefined;
|
|
315
324
|
}, [muiFormControl]);
|
|
316
325
|
}
|
|
317
|
-
const fcs = (0, _formControlState.default)({
|
|
318
|
-
props,
|
|
319
|
-
muiFormControl,
|
|
320
|
-
states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
|
|
321
|
-
});
|
|
322
326
|
fcs.focused = muiFormControl ? muiFormControl.focused : focused;
|
|
323
327
|
|
|
324
328
|
// The blur won't fire when the disabled state is set on a focused input.
|
|
@@ -349,6 +353,32 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
349
353
|
});
|
|
350
354
|
}
|
|
351
355
|
}, [value, checkDirty, isControlled]);
|
|
356
|
+
|
|
357
|
+
// Sync focused state when autoFocus is used in SSR.
|
|
358
|
+
// If the browser focused the element before hydration, the onFocus handler never
|
|
359
|
+
// fires. If it did not, React hydration does not call focus() for autoFocus.
|
|
360
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
361
|
+
if (!autoFocus) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
const input = inputRef.current;
|
|
365
|
+
if (!input) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
const doc = (0, _ownerDocument.default)(input);
|
|
369
|
+
const activeElement = (0, _getActiveElement.default)(doc);
|
|
370
|
+
const noElementFocused = activeElement == null || activeElement === doc.body || activeElement === doc.documentElement;
|
|
371
|
+
if (input === activeElement) {
|
|
372
|
+
if (muiFormControl && muiFormControl.onFocus) {
|
|
373
|
+
muiFormControl.onFocus();
|
|
374
|
+
} else {
|
|
375
|
+
setFocused(true);
|
|
376
|
+
}
|
|
377
|
+
} else if (noElementFocused) {
|
|
378
|
+
input.focus();
|
|
379
|
+
}
|
|
380
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
381
|
+
}, [autoFocus]);
|
|
352
382
|
const handleFocus = event => {
|
|
353
383
|
if (onFocus) {
|
|
354
384
|
onFocus(event);
|
|
@@ -437,7 +467,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
437
467
|
}
|
|
438
468
|
const handleAutoFill = event => {
|
|
439
469
|
// Provide a fake value as Chrome might not let you access it for security reasons.
|
|
440
|
-
checkDirty(event.animationName ===
|
|
470
|
+
checkDirty(event.animationName === MUI_AUTO_FILL_CANCEL ? inputRef.current : {
|
|
441
471
|
value: 'x'
|
|
442
472
|
});
|
|
443
473
|
};
|
|
@@ -489,6 +519,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
489
519
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {
|
|
490
520
|
"aria-invalid": fcs.error,
|
|
491
521
|
"aria-describedby": ariaDescribedby,
|
|
522
|
+
"aria-label": ariaLabel,
|
|
492
523
|
autoComplete: autoComplete,
|
|
493
524
|
autoFocus: autoFocus,
|
|
494
525
|
defaultValue: defaultValue,
|
|
@@ -534,6 +565,10 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes /* remove-proptypes
|
|
|
534
565
|
* @ignore
|
|
535
566
|
*/
|
|
536
567
|
'aria-describedby': _propTypes.default.string,
|
|
568
|
+
/**
|
|
569
|
+
* @ignore
|
|
570
|
+
*/
|
|
571
|
+
'aria-label': _propTypes.default.string,
|
|
537
572
|
/**
|
|
538
573
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
539
574
|
* The name can be confusing, as it's more like an autofill.
|