@mui/material 9.0.0 → 9.1.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/Accordion/Accordion.d.mts +2 -2
- package/Accordion/Accordion.d.ts +2 -2
- package/Accordion/Accordion.js +3 -2
- package/Accordion/Accordion.mjs +3 -2
- package/AccordionSummary/AccordionSummary.js +27 -29
- package/AccordionSummary/AccordionSummary.mjs +27 -29
- package/Autocomplete/Autocomplete.js +73 -17
- package/Autocomplete/Autocomplete.mjs +73 -17
- package/Avatar/Avatar.js +4 -0
- package/Avatar/Avatar.mjs +4 -0
- package/Backdrop/Backdrop.d.mts +2 -2
- package/Backdrop/Backdrop.d.ts +2 -2
- package/Badge/Badge.js +31 -24
- package/Badge/Badge.mjs +31 -24
- package/BottomNavigationAction/BottomNavigationAction.js +6 -2
- package/BottomNavigationAction/BottomNavigationAction.mjs +6 -2
- package/Button/Button.js +19 -6
- package/Button/Button.mjs +19 -6
- 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/ButtonBase/Ripple.js +21 -11
- package/ButtonBase/Ripple.mjs +21 -11
- package/ButtonBase/TouchRipple.js +252 -116
- package/ButtonBase/TouchRipple.mjs +253 -117
- package/CHANGELOG.md +216 -1245
- package/CardActionArea/CardActionArea.js +2 -1
- package/CardActionArea/CardActionArea.mjs +2 -1
- package/Checkbox/Checkbox.js +2 -1
- package/Checkbox/Checkbox.mjs +2 -1
- package/Chip/Chip.js +2 -1
- package/Chip/Chip.mjs +2 -1
- package/CircularProgress/CircularProgress.d.mts +12 -2
- package/CircularProgress/CircularProgress.d.ts +12 -2
- package/CircularProgress/CircularProgress.js +115 -58
- package/CircularProgress/CircularProgress.mjs +114 -58
- package/ClickAwayListener/ClickAwayListener.js +3 -6
- package/ClickAwayListener/ClickAwayListener.mjs +3 -6
- package/Collapse/Collapse.d.mts +15 -3
- package/Collapse/Collapse.d.ts +15 -3
- package/Collapse/Collapse.js +44 -31
- package/Collapse/Collapse.mjs +43 -30
- package/Dialog/Dialog.d.mts +2 -2
- package/Dialog/Dialog.d.ts +2 -2
- package/Dialog/Dialog.js +13 -6
- package/Dialog/Dialog.mjs +13 -6
- package/Drawer/Drawer.d.mts +2 -2
- package/Drawer/Drawer.d.ts +2 -2
- package/Drawer/Drawer.js +18 -4
- package/Drawer/Drawer.mjs +18 -4
- package/Fab/Fab.js +9 -2
- package/Fab/Fab.mjs +9 -2
- package/Fade/Fade.d.mts +15 -2
- package/Fade/Fade.d.ts +15 -2
- package/Fade/Fade.js +46 -19
- package/Fade/Fade.mjs +45 -18
- package/FilledInput/FilledInput.d.mts +4 -0
- package/FilledInput/FilledInput.d.ts +4 -0
- package/FilledInput/FilledInput.js +22 -23
- package/FilledInput/FilledInput.mjs +22 -23
- 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/Grow/Grow.d.mts +15 -2
- package/Grow/Grow.d.ts +15 -2
- package/Grow/Grow.js +45 -28
- package/Grow/Grow.mjs +44 -27
- package/IconButton/IconButton.js +3 -9
- package/IconButton/IconButton.mjs +3 -9
- package/Input/Input.d.mts +4 -0
- package/Input/Input.d.ts +4 -0
- package/Input/Input.js +9 -2
- package/Input/Input.mjs +9 -2
- package/InputBase/InputBase.d.mts +2 -1
- package/InputBase/InputBase.d.ts +2 -1
- package/InputBase/InputBase.js +52 -16
- package/InputBase/InputBase.mjs +52 -16
- package/InputLabel/InputLabel.js +7 -9
- package/InputLabel/InputLabel.mjs +7 -9
- package/LICENSE +1 -1
- package/LinearProgress/LinearProgress.d.mts +12 -2
- package/LinearProgress/LinearProgress.d.ts +12 -2
- package/LinearProgress/LinearProgress.js +225 -126
- package/LinearProgress/LinearProgress.mjs +224 -126
- package/List/List.js +2 -1
- package/List/List.mjs +2 -1
- package/ListItem/ListItem.js +2 -1
- package/ListItem/ListItem.mjs +2 -1
- package/ListItemButton/ListItemButton.js +9 -2
- package/ListItemButton/ListItemButton.mjs +9 -2
- package/Menu/Menu.d.mts +1 -1
- package/Menu/Menu.d.ts +1 -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/MobileStepper/MobileStepper.js +2 -1
- package/MobileStepper/MobileStepper.mjs +2 -1
- package/NativeSelect/NativeSelect.js +2 -5
- package/NativeSelect/NativeSelect.mjs +2 -5
- package/OutlinedInput/NotchedOutline.js +4 -3
- package/OutlinedInput/NotchedOutline.mjs +4 -3
- package/OutlinedInput/OutlinedInput.js +13 -23
- package/OutlinedInput/OutlinedInput.mjs +13 -23
- package/PaginationItem/PaginationItem.js +2 -1
- package/PaginationItem/PaginationItem.mjs +2 -1
- package/Paper/Paper.js +2 -1
- package/Paper/Paper.mjs +2 -1
- package/PigmentContainer/PigmentContainer.js +0 -1
- package/PigmentContainer/PigmentContainer.mjs +0 -1
- package/Popover/Popover.d.mts +1 -1
- package/Popover/Popover.d.ts +1 -1
- package/Popper/BasePopper.js +23 -1
- package/Popper/BasePopper.mjs +23 -1
- package/README.md +3 -2
- package/Radio/RadioButtonIcon.js +3 -2
- package/Radio/RadioButtonIcon.mjs +3 -2
- package/Rating/Rating.js +2 -1
- package/Rating/Rating.mjs +2 -1
- package/Select/Select.js +2 -5
- package/Select/Select.mjs +2 -5
- package/Select/SelectInput.js +276 -24
- package/Select/SelectInput.mjs +276 -24
- package/Select/utils/closedTypeahead.js +73 -0
- package/Select/utils/closedTypeahead.mjs +63 -0
- package/Skeleton/Skeleton.js +22 -2
- package/Skeleton/Skeleton.mjs +22 -2
- package/Slide/Slide.d.mts +15 -2
- package/Slide/Slide.d.ts +15 -2
- package/Slide/Slide.js +97 -47
- package/Slide/Slide.mjs +97 -47
- package/Slider/Slider.js +14 -4
- package/Slider/Slider.mjs +14 -4
- package/Slider/useSlider.js +4 -3
- package/Slider/useSlider.mjs +4 -3
- package/Snackbar/Snackbar.d.mts +2 -2
- package/Snackbar/Snackbar.d.ts +2 -2
- package/SpeedDial/SpeedDial.d.mts +1 -1
- package/SpeedDial/SpeedDial.d.ts +1 -1
- package/SpeedDial/SpeedDial.js +6 -2
- package/SpeedDial/SpeedDial.mjs +6 -2
- package/SpeedDialAction/SpeedDialAction.js +11 -2
- package/SpeedDialAction/SpeedDialAction.mjs +12 -3
- package/SpeedDialIcon/SpeedDialIcon.js +40 -37
- package/SpeedDialIcon/SpeedDialIcon.mjs +40 -37
- package/Step/Step.js +47 -15
- package/Step/Step.mjs +47 -15
- package/StepButton/StepButton.js +9 -3
- package/StepButton/StepButton.mjs +9 -3
- package/StepConnector/StepConnector.js +10 -0
- package/StepConnector/StepConnector.mjs +10 -0
- package/StepContent/StepContent.d.mts +2 -2
- package/StepContent/StepContent.d.ts +2 -2
- package/StepContent/StepContent.js +26 -2
- package/StepContent/StepContent.mjs +26 -2
- package/StepIcon/StepIcon.js +2 -1
- package/StepIcon/StepIcon.mjs +2 -1
- package/StepLabel/StepLabel.js +52 -7
- package/StepLabel/StepLabel.mjs +52 -7
- package/Stepper/Stepper.d.mts +2 -0
- package/Stepper/Stepper.d.ts +2 -0
- package/Stepper/Stepper.js +18 -0
- package/Stepper/Stepper.mjs +18 -0
- package/SvgIcon/SvgIcon.js +2 -1
- package/SvgIcon/SvgIcon.mjs +2 -1
- package/SwipeableDrawer/SwipeableDrawer.js +21 -6
- package/SwipeableDrawer/SwipeableDrawer.mjs +21 -6
- package/Switch/Switch.js +10 -8
- package/Switch/Switch.mjs +10 -8
- package/TableSortLabel/TableSortLabel.js +2 -1
- package/TableSortLabel/TableSortLabel.mjs +2 -1
- package/Tabs/ScrollbarSize.js +2 -1
- package/Tabs/ScrollbarSize.mjs +2 -1
- package/Tabs/Tabs.js +16 -4
- package/Tabs/Tabs.mjs +16 -4
- package/Tooltip/Tooltip.d.mts +2 -2
- package/Tooltip/Tooltip.d.ts +2 -2
- package/Tooltip/Tooltip.js +29 -108
- package/Tooltip/Tooltip.mjs +29 -108
- package/Unstable_TrapFocus/FocusTrap.js +60 -22
- package/Unstable_TrapFocus/FocusTrap.mjs +60 -22
- package/Zoom/Zoom.d.mts +15 -2
- package/Zoom/Zoom.d.ts +15 -2
- package/Zoom/Zoom.js +43 -16
- package/Zoom/Zoom.mjs +42 -15
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internal/Transition.d.mts +34 -0
- package/internal/Transition.d.ts +34 -0
- package/internal/Transition.js +444 -0
- package/internal/Transition.mjs +436 -0
- package/internal/react-transition-group.d.mts +8 -0
- package/internal/react-transition-group.d.ts +8 -0
- package/package.json +50 -50
- package/styles/createMotion.d.mts +8 -0
- package/styles/createMotion.d.ts +8 -0
- package/styles/createMotion.js +13 -0
- package/styles/createMotion.mjs +7 -0
- package/styles/createThemeFoundation.d.mts +2 -0
- package/styles/createThemeFoundation.d.ts +2 -0
- package/styles/createThemeNoVars.d.mts +3 -0
- package/styles/createThemeNoVars.d.ts +3 -0
- package/styles/createThemeNoVars.js +5 -0
- package/styles/createThemeNoVars.mjs +5 -0
- package/styles/createTransitions.d.mts +6 -2
- package/styles/createTransitions.d.ts +6 -2
- package/styles/createTransitions.js +12 -4
- package/styles/createTransitions.mjs +12 -4
- package/styles/enhanceHighContrast.d.mts +70 -0
- package/styles/enhanceHighContrast.d.ts +70 -0
- package/styles/enhanceHighContrast.js +502 -0
- package/styles/enhanceHighContrast.mjs +495 -0
- package/styles/index.d.mts +2 -0
- package/styles/index.d.ts +2 -0
- package/styles/index.js +8 -0
- package/styles/index.mjs +1 -0
- package/styles/reducedMotion.d.mts +7 -0
- package/styles/reducedMotion.d.ts +7 -0
- package/styles/reducedMotion.js +21 -0
- package/styles/reducedMotion.mjs +14 -0
- package/styles/responsiveFontSizes.js +19 -8
- package/styles/responsiveFontSizes.mjs +19 -8
- package/styles/shouldSkipGeneratingVar.js +1 -1
- package/styles/shouldSkipGeneratingVar.mjs +1 -1
- package/styles/stringifyTheme.js +1 -0
- package/styles/stringifyTheme.mjs +1 -0
- package/styles/useThemeProps.d.mts +3 -3
- package/styles/useThemeProps.d.ts +3 -3
- package/transitions/index.d.mts +1 -1
- package/transitions/index.d.ts +1 -1
- package/transitions/index.js +0 -11
- package/transitions/index.mjs +1 -1
- package/transitions/transition.d.mts +1 -12
- package/transitions/transition.d.ts +1 -12
- package/transitions/types.d.mts +73 -0
- package/transitions/types.d.ts +73 -0
- package/transitions/useReducedMotion.d.mts +14 -0
- package/transitions/useReducedMotion.d.ts +14 -0
- package/transitions/useReducedMotion.js +117 -0
- package/transitions/useReducedMotion.mjs +110 -0
- package/transitions/utils.d.mts +51 -2
- package/transitions/utils.d.ts +51 -2
- package/transitions/utils.js +97 -4
- package/transitions/utils.mjs +94 -4
- package/useAutocomplete/useAutocomplete.d.mts +12 -6
- package/useAutocomplete/useAutocomplete.d.ts +12 -6
- package/useAutocomplete/useAutocomplete.js +230 -55
- package/useAutocomplete/useAutocomplete.mjs +230 -55
- 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
- /package/transitions/{transition.js → types.js} +0 -0
- /package/transitions/{transition.mjs → types.mjs} +0 -0
package/InputBase/InputBase.js
CHANGED
|
@@ -16,19 +16,23 @@ 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"));
|
|
31
|
+
var _utils2 = require("../transitions/utils");
|
|
30
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
33
|
var _InputGlobalStyles;
|
|
34
|
+
const MUI_AUTO_FILL = 'mui-auto-fill';
|
|
35
|
+
const MUI_AUTO_FILL_CANCEL = 'mui-auto-fill-cancel';
|
|
32
36
|
const rootOverridesResolver = (props, styles) => {
|
|
33
37
|
const {
|
|
34
38
|
ownerState
|
|
@@ -126,7 +130,7 @@ const InputBaseInput = exports.InputBaseInput = (0, _zeroStyled.styled)('input',
|
|
|
126
130
|
} : {
|
|
127
131
|
opacity: light ? 0.42 : 0.5
|
|
128
132
|
}),
|
|
129
|
-
|
|
133
|
+
...(0, _utils2.getTransitionStyles)(theme, 'opacity', {
|
|
130
134
|
duration: theme.transitions.duration.shorter
|
|
131
135
|
})
|
|
132
136
|
};
|
|
@@ -193,11 +197,11 @@ const InputBaseInput = exports.InputBaseInput = (0, _zeroStyled.styled)('input',
|
|
|
193
197
|
ownerState
|
|
194
198
|
}) => !ownerState.disableInjectingGlobalStyles,
|
|
195
199
|
style: {
|
|
196
|
-
animationName:
|
|
200
|
+
animationName: MUI_AUTO_FILL_CANCEL,
|
|
197
201
|
animationDuration: '10ms',
|
|
198
202
|
'&:-webkit-autofill': {
|
|
199
203
|
animationDuration: '5000s',
|
|
200
|
-
animationName:
|
|
204
|
+
animationName: MUI_AUTO_FILL
|
|
201
205
|
}
|
|
202
206
|
}
|
|
203
207
|
}, {
|
|
@@ -228,14 +232,16 @@ const InputBaseInput = exports.InputBaseInput = (0, _zeroStyled.styled)('input',
|
|
|
228
232
|
};
|
|
229
233
|
}));
|
|
230
234
|
const InputGlobalStyles = (0, _zeroStyled.globalCss)({
|
|
231
|
-
|
|
235
|
+
// Keep keyframes non-empty for Emotion production builds. Animation properties are ignored
|
|
236
|
+
// inside keyframes, avoiding the visible display animation triggered by Chrome 117+.
|
|
237
|
+
[`@keyframes ${MUI_AUTO_FILL}`]: {
|
|
232
238
|
from: {
|
|
233
|
-
|
|
239
|
+
animationName: MUI_AUTO_FILL
|
|
234
240
|
}
|
|
235
241
|
},
|
|
236
|
-
|
|
242
|
+
[`@keyframes ${MUI_AUTO_FILL_CANCEL}`]: {
|
|
237
243
|
from: {
|
|
238
|
-
|
|
244
|
+
animationName: MUI_AUTO_FILL_CANCEL
|
|
239
245
|
}
|
|
240
246
|
}
|
|
241
247
|
});
|
|
@@ -252,6 +258,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
252
258
|
});
|
|
253
259
|
const {
|
|
254
260
|
'aria-describedby': ariaDescribedby,
|
|
261
|
+
'aria-label': ariaLabel,
|
|
255
262
|
autoComplete,
|
|
256
263
|
autoFocus,
|
|
257
264
|
className,
|
|
@@ -303,7 +310,10 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
303
310
|
}, []);
|
|
304
311
|
const handleInputRef = (0, _useForkRef.default)(inputRef, inputRefProp, inputPropsProp.ref, handleInputRefWarning);
|
|
305
312
|
const [focused, setFocused] = React.useState(false);
|
|
306
|
-
const muiFormControl = (0, _useFormControl.
|
|
313
|
+
const [fcs, muiFormControl] = (0, _useFormControl.useFormControlState)({
|
|
314
|
+
props,
|
|
315
|
+
states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
|
|
316
|
+
});
|
|
307
317
|
if (process.env.NODE_ENV !== 'production') {
|
|
308
318
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
|
|
309
319
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -314,11 +324,6 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
314
324
|
return undefined;
|
|
315
325
|
}, [muiFormControl]);
|
|
316
326
|
}
|
|
317
|
-
const fcs = (0, _formControlState.default)({
|
|
318
|
-
props,
|
|
319
|
-
muiFormControl,
|
|
320
|
-
states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
|
|
321
|
-
});
|
|
322
327
|
fcs.focused = muiFormControl ? muiFormControl.focused : focused;
|
|
323
328
|
|
|
324
329
|
// The blur won't fire when the disabled state is set on a focused input.
|
|
@@ -349,6 +354,32 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
349
354
|
});
|
|
350
355
|
}
|
|
351
356
|
}, [value, checkDirty, isControlled]);
|
|
357
|
+
|
|
358
|
+
// Sync focused state when autoFocus is used in SSR.
|
|
359
|
+
// If the browser focused the element before hydration, the onFocus handler never
|
|
360
|
+
// fires. If it did not, React hydration does not call focus() for autoFocus.
|
|
361
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
362
|
+
if (!autoFocus) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
const input = inputRef.current;
|
|
366
|
+
if (!input) {
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
const doc = (0, _ownerDocument.default)(input);
|
|
370
|
+
const activeElement = (0, _getActiveElement.default)(doc);
|
|
371
|
+
const noElementFocused = activeElement == null || activeElement === doc.body || activeElement === doc.documentElement;
|
|
372
|
+
if (input === activeElement) {
|
|
373
|
+
if (muiFormControl && muiFormControl.onFocus) {
|
|
374
|
+
muiFormControl.onFocus();
|
|
375
|
+
} else {
|
|
376
|
+
setFocused(true);
|
|
377
|
+
}
|
|
378
|
+
} else if (noElementFocused) {
|
|
379
|
+
input.focus();
|
|
380
|
+
}
|
|
381
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
382
|
+
}, [autoFocus]);
|
|
352
383
|
const handleFocus = event => {
|
|
353
384
|
if (onFocus) {
|
|
354
385
|
onFocus(event);
|
|
@@ -437,7 +468,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
437
468
|
}
|
|
438
469
|
const handleAutoFill = event => {
|
|
439
470
|
// Provide a fake value as Chrome might not let you access it for security reasons.
|
|
440
|
-
checkDirty(event.animationName ===
|
|
471
|
+
checkDirty(event.animationName === MUI_AUTO_FILL_CANCEL ? inputRef.current : {
|
|
441
472
|
value: 'x'
|
|
442
473
|
});
|
|
443
474
|
};
|
|
@@ -489,6 +520,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
489
520
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Input, {
|
|
490
521
|
"aria-invalid": fcs.error,
|
|
491
522
|
"aria-describedby": ariaDescribedby,
|
|
523
|
+
"aria-label": ariaLabel,
|
|
492
524
|
autoComplete: autoComplete,
|
|
493
525
|
autoFocus: autoFocus,
|
|
494
526
|
defaultValue: defaultValue,
|
|
@@ -534,6 +566,10 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes /* remove-proptypes
|
|
|
534
566
|
* @ignore
|
|
535
567
|
*/
|
|
536
568
|
'aria-describedby': _propTypes.default.string,
|
|
569
|
+
/**
|
|
570
|
+
* @ignore
|
|
571
|
+
*/
|
|
572
|
+
'aria-label': _propTypes.default.string,
|
|
537
573
|
/**
|
|
538
574
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
539
575
|
* The name can be confusing, as it's more like an autofill.
|
package/InputBase/InputBase.mjs
CHANGED
|
@@ -10,18 +10,22 @@ import refType from '@mui/utils/refType';
|
|
|
10
10
|
import composeClasses from '@mui/utils/composeClasses';
|
|
11
11
|
import isHostComponent from '@mui/utils/isHostComponent';
|
|
12
12
|
import TextareaAutosize from "../TextareaAutosize/index.mjs";
|
|
13
|
-
import formControlState from "../FormControl/formControlState.mjs";
|
|
14
13
|
import FormControlContext from "../FormControl/FormControlContext.mjs";
|
|
15
|
-
import
|
|
14
|
+
import { useFormControlState } from "../FormControl/useFormControl.mjs";
|
|
16
15
|
import { styled, globalCss } from "../zero-styled/index.mjs";
|
|
17
16
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
18
17
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
19
18
|
import capitalize from "../utils/capitalize.mjs";
|
|
20
19
|
import useForkRef from "../utils/useForkRef.mjs";
|
|
21
20
|
import useEnhancedEffect from "../utils/useEnhancedEffect.mjs";
|
|
21
|
+
import ownerDocument from "../utils/ownerDocument.mjs";
|
|
22
|
+
import getActiveElement from "../utils/getActiveElement.mjs";
|
|
22
23
|
import { isFilled } from "./utils.mjs";
|
|
23
24
|
import inputBaseClasses, { getInputBaseUtilityClass } from "./inputBaseClasses.mjs";
|
|
25
|
+
import { getTransitionStyles } from "../transitions/utils.mjs";
|
|
24
26
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
27
|
+
const MUI_AUTO_FILL = 'mui-auto-fill';
|
|
28
|
+
const MUI_AUTO_FILL_CANCEL = 'mui-auto-fill-cancel';
|
|
25
29
|
export const rootOverridesResolver = (props, styles) => {
|
|
26
30
|
const {
|
|
27
31
|
ownerState
|
|
@@ -117,7 +121,7 @@ export const InputBaseInput = styled('input', {
|
|
|
117
121
|
} : {
|
|
118
122
|
opacity: light ? 0.42 : 0.5
|
|
119
123
|
}),
|
|
120
|
-
|
|
124
|
+
...getTransitionStyles(theme, 'opacity', {
|
|
121
125
|
duration: theme.transitions.duration.shorter
|
|
122
126
|
})
|
|
123
127
|
};
|
|
@@ -184,11 +188,11 @@ export const InputBaseInput = styled('input', {
|
|
|
184
188
|
ownerState
|
|
185
189
|
}) => !ownerState.disableInjectingGlobalStyles,
|
|
186
190
|
style: {
|
|
187
|
-
animationName:
|
|
191
|
+
animationName: MUI_AUTO_FILL_CANCEL,
|
|
188
192
|
animationDuration: '10ms',
|
|
189
193
|
'&:-webkit-autofill': {
|
|
190
194
|
animationDuration: '5000s',
|
|
191
|
-
animationName:
|
|
195
|
+
animationName: MUI_AUTO_FILL
|
|
192
196
|
}
|
|
193
197
|
}
|
|
194
198
|
}, {
|
|
@@ -219,14 +223,16 @@ export const InputBaseInput = styled('input', {
|
|
|
219
223
|
};
|
|
220
224
|
}));
|
|
221
225
|
const InputGlobalStyles = globalCss({
|
|
222
|
-
|
|
226
|
+
// Keep keyframes non-empty for Emotion production builds. Animation properties are ignored
|
|
227
|
+
// inside keyframes, avoiding the visible display animation triggered by Chrome 117+.
|
|
228
|
+
[`@keyframes ${MUI_AUTO_FILL}`]: {
|
|
223
229
|
from: {
|
|
224
|
-
|
|
230
|
+
animationName: MUI_AUTO_FILL
|
|
225
231
|
}
|
|
226
232
|
},
|
|
227
|
-
|
|
233
|
+
[`@keyframes ${MUI_AUTO_FILL_CANCEL}`]: {
|
|
228
234
|
from: {
|
|
229
|
-
|
|
235
|
+
animationName: MUI_AUTO_FILL_CANCEL
|
|
230
236
|
}
|
|
231
237
|
}
|
|
232
238
|
});
|
|
@@ -243,6 +249,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
243
249
|
});
|
|
244
250
|
const {
|
|
245
251
|
'aria-describedby': ariaDescribedby,
|
|
252
|
+
'aria-label': ariaLabel,
|
|
246
253
|
autoComplete,
|
|
247
254
|
autoFocus,
|
|
248
255
|
className,
|
|
@@ -294,7 +301,10 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
294
301
|
}, []);
|
|
295
302
|
const handleInputRef = useForkRef(inputRef, inputRefProp, inputPropsProp.ref, handleInputRefWarning);
|
|
296
303
|
const [focused, setFocused] = React.useState(false);
|
|
297
|
-
const muiFormControl =
|
|
304
|
+
const [fcs, muiFormControl] = useFormControlState({
|
|
305
|
+
props,
|
|
306
|
+
states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
|
|
307
|
+
});
|
|
298
308
|
if (process.env.NODE_ENV !== 'production') {
|
|
299
309
|
// TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
|
|
300
310
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -305,11 +315,6 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
305
315
|
return undefined;
|
|
306
316
|
}, [muiFormControl]);
|
|
307
317
|
}
|
|
308
|
-
const fcs = formControlState({
|
|
309
|
-
props,
|
|
310
|
-
muiFormControl,
|
|
311
|
-
states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
|
|
312
|
-
});
|
|
313
318
|
fcs.focused = muiFormControl ? muiFormControl.focused : focused;
|
|
314
319
|
|
|
315
320
|
// The blur won't fire when the disabled state is set on a focused input.
|
|
@@ -340,6 +345,32 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
340
345
|
});
|
|
341
346
|
}
|
|
342
347
|
}, [value, checkDirty, isControlled]);
|
|
348
|
+
|
|
349
|
+
// Sync focused state when autoFocus is used in SSR.
|
|
350
|
+
// If the browser focused the element before hydration, the onFocus handler never
|
|
351
|
+
// fires. If it did not, React hydration does not call focus() for autoFocus.
|
|
352
|
+
useEnhancedEffect(() => {
|
|
353
|
+
if (!autoFocus) {
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
const input = inputRef.current;
|
|
357
|
+
if (!input) {
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
const doc = ownerDocument(input);
|
|
361
|
+
const activeElement = getActiveElement(doc);
|
|
362
|
+
const noElementFocused = activeElement == null || activeElement === doc.body || activeElement === doc.documentElement;
|
|
363
|
+
if (input === activeElement) {
|
|
364
|
+
if (muiFormControl && muiFormControl.onFocus) {
|
|
365
|
+
muiFormControl.onFocus();
|
|
366
|
+
} else {
|
|
367
|
+
setFocused(true);
|
|
368
|
+
}
|
|
369
|
+
} else if (noElementFocused) {
|
|
370
|
+
input.focus();
|
|
371
|
+
}
|
|
372
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
373
|
+
}, [autoFocus]);
|
|
343
374
|
const handleFocus = event => {
|
|
344
375
|
if (onFocus) {
|
|
345
376
|
onFocus(event);
|
|
@@ -428,7 +459,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
428
459
|
}
|
|
429
460
|
const handleAutoFill = event => {
|
|
430
461
|
// Provide a fake value as Chrome might not let you access it for security reasons.
|
|
431
|
-
checkDirty(event.animationName ===
|
|
462
|
+
checkDirty(event.animationName === MUI_AUTO_FILL_CANCEL ? inputRef.current : {
|
|
432
463
|
value: 'x'
|
|
433
464
|
});
|
|
434
465
|
};
|
|
@@ -480,6 +511,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
480
511
|
children: /*#__PURE__*/_jsx(Input, {
|
|
481
512
|
"aria-invalid": fcs.error,
|
|
482
513
|
"aria-describedby": ariaDescribedby,
|
|
514
|
+
"aria-label": ariaLabel,
|
|
483
515
|
autoComplete: autoComplete,
|
|
484
516
|
autoFocus: autoFocus,
|
|
485
517
|
defaultValue: defaultValue,
|
|
@@ -525,6 +557,10 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes /* remove-proptypes
|
|
|
525
557
|
* @ignore
|
|
526
558
|
*/
|
|
527
559
|
'aria-describedby': PropTypes.string,
|
|
560
|
+
/**
|
|
561
|
+
* @ignore
|
|
562
|
+
*/
|
|
563
|
+
'aria-label': PropTypes.string,
|
|
528
564
|
/**
|
|
529
565
|
* This prop helps users to fill forms faster, especially on mobile devices.
|
|
530
566
|
* The name can be confusing, as it's more like an autofill.
|
package/InputLabel/InputLabel.js
CHANGED
|
@@ -11,8 +11,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
|
-
var
|
|
15
|
-
var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
|
|
14
|
+
var _useFormControl = require("../FormControl/useFormControl");
|
|
16
15
|
var _FormLabel = _interopRequireWildcard(require("../FormLabel"));
|
|
17
16
|
var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
|
|
18
17
|
var _rootShouldForwardProp = _interopRequireDefault(require("../styles/rootShouldForwardProp"));
|
|
@@ -20,6 +19,7 @@ var _zeroStyled = require("../zero-styled");
|
|
|
20
19
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
21
20
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
22
21
|
var _inputLabelClasses = require("./inputLabelClasses");
|
|
22
|
+
var _utils = require("../transitions/utils");
|
|
23
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
24
|
const useUtilityClasses = ownerState => {
|
|
25
25
|
const {
|
|
@@ -96,7 +96,7 @@ const InputLabelRoot = (0, _zeroStyled.styled)(_FormLabel.default, {
|
|
|
96
96
|
ownerState
|
|
97
97
|
}) => !ownerState.disableAnimation,
|
|
98
98
|
style: {
|
|
99
|
-
|
|
99
|
+
...(0, _utils.getTransitionStyles)(theme, ['color', 'transform', 'max-width'], {
|
|
100
100
|
duration: theme.transitions.duration.shorter,
|
|
101
101
|
easing: theme.transitions.easing.easeOut
|
|
102
102
|
})
|
|
@@ -190,16 +190,14 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
|
|
|
190
190
|
className,
|
|
191
191
|
...other
|
|
192
192
|
} = props;
|
|
193
|
-
const muiFormControl = (0, _useFormControl.
|
|
193
|
+
const [fcs, muiFormControl] = (0, _useFormControl.useFormControlState)({
|
|
194
|
+
props,
|
|
195
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
196
|
+
});
|
|
194
197
|
let shrink = shrinkProp;
|
|
195
198
|
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
196
199
|
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
197
200
|
}
|
|
198
|
-
const fcs = (0, _formControlState.default)({
|
|
199
|
-
props,
|
|
200
|
-
muiFormControl,
|
|
201
|
-
states: ['size', 'variant', 'required', 'focused']
|
|
202
|
-
});
|
|
203
201
|
const ownerState = {
|
|
204
202
|
...props,
|
|
205
203
|
disableAnimation,
|
|
@@ -4,8 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
5
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
|
-
import
|
|
8
|
-
import useFormControl from "../FormControl/useFormControl.mjs";
|
|
7
|
+
import { useFormControlState } from "../FormControl/useFormControl.mjs";
|
|
9
8
|
import FormLabel, { formLabelClasses } from "../FormLabel/index.mjs";
|
|
10
9
|
import capitalize from "../utils/capitalize.mjs";
|
|
11
10
|
import rootShouldForwardProp from "../styles/rootShouldForwardProp.mjs";
|
|
@@ -13,6 +12,7 @@ import { styled } from "../zero-styled/index.mjs";
|
|
|
13
12
|
import memoTheme from "../utils/memoTheme.mjs";
|
|
14
13
|
import { useDefaultProps } from "../DefaultPropsProvider/index.mjs";
|
|
15
14
|
import { getInputLabelUtilityClasses } from "./inputLabelClasses.mjs";
|
|
15
|
+
import { getTransitionStyles } from "../transitions/utils.mjs";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
17
|
const useUtilityClasses = ownerState => {
|
|
18
18
|
const {
|
|
@@ -89,7 +89,7 @@ const InputLabelRoot = styled(FormLabel, {
|
|
|
89
89
|
ownerState
|
|
90
90
|
}) => !ownerState.disableAnimation,
|
|
91
91
|
style: {
|
|
92
|
-
|
|
92
|
+
...getTransitionStyles(theme, ['color', 'transform', 'max-width'], {
|
|
93
93
|
duration: theme.transitions.duration.shorter,
|
|
94
94
|
easing: theme.transitions.easing.easeOut
|
|
95
95
|
})
|
|
@@ -183,16 +183,14 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
|
|
|
183
183
|
className,
|
|
184
184
|
...other
|
|
185
185
|
} = props;
|
|
186
|
-
const muiFormControl =
|
|
186
|
+
const [fcs, muiFormControl] = useFormControlState({
|
|
187
|
+
props,
|
|
188
|
+
states: ['size', 'variant', 'required', 'focused']
|
|
189
|
+
});
|
|
187
190
|
let shrink = shrinkProp;
|
|
188
191
|
if (typeof shrink === 'undefined' && muiFormControl) {
|
|
189
192
|
shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
|
|
190
193
|
}
|
|
191
|
-
const fcs = formControlState({
|
|
192
|
-
props,
|
|
193
|
-
muiFormControl,
|
|
194
|
-
states: ['size', 'variant', 'required', 'focused']
|
|
195
|
-
});
|
|
196
194
|
const ownerState = {
|
|
197
195
|
...props,
|
|
198
196
|
disableAnimation,
|
package/LICENSE
CHANGED
|
@@ -18,18 +18,28 @@ export interface LinearProgressProps extends StandardProps<React.HTMLAttributes<
|
|
|
18
18
|
* @default 'primary'
|
|
19
19
|
*/
|
|
20
20
|
color?: OverridableStringUnion<'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'inherit', LinearProgressPropsColorOverrides> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The maximum value for the progress indicator for the determinate and buffer variants.
|
|
23
|
+
* @default 100
|
|
24
|
+
*/
|
|
25
|
+
max?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The minimum value for the progress indicator for the determinate and buffer variants.
|
|
28
|
+
* @default 0
|
|
29
|
+
*/
|
|
30
|
+
min?: number | undefined;
|
|
21
31
|
/**
|
|
22
32
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
23
33
|
*/
|
|
24
34
|
sx?: SxProps<Theme> | undefined;
|
|
25
35
|
/**
|
|
26
36
|
* The value of the progress indicator for the determinate and buffer variants.
|
|
27
|
-
* Value between
|
|
37
|
+
* Value between `min` and `max`.
|
|
28
38
|
*/
|
|
29
39
|
value?: number | undefined;
|
|
30
40
|
/**
|
|
31
41
|
* The value for the buffer variant.
|
|
32
|
-
* Value between
|
|
42
|
+
* Value between `min` and `max`.
|
|
33
43
|
*/
|
|
34
44
|
valueBuffer?: number | undefined;
|
|
35
45
|
/**
|
|
@@ -18,18 +18,28 @@ export interface LinearProgressProps extends StandardProps<React.HTMLAttributes<
|
|
|
18
18
|
* @default 'primary'
|
|
19
19
|
*/
|
|
20
20
|
color?: OverridableStringUnion<'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning' | 'inherit', LinearProgressPropsColorOverrides> | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The maximum value for the progress indicator for the determinate and buffer variants.
|
|
23
|
+
* @default 100
|
|
24
|
+
*/
|
|
25
|
+
max?: number | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* The minimum value for the progress indicator for the determinate and buffer variants.
|
|
28
|
+
* @default 0
|
|
29
|
+
*/
|
|
30
|
+
min?: number | undefined;
|
|
21
31
|
/**
|
|
22
32
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
23
33
|
*/
|
|
24
34
|
sx?: SxProps<Theme> | undefined;
|
|
25
35
|
/**
|
|
26
36
|
* The value of the progress indicator for the determinate and buffer variants.
|
|
27
|
-
* Value between
|
|
37
|
+
* Value between `min` and `max`.
|
|
28
38
|
*/
|
|
29
39
|
value?: number | undefined;
|
|
30
40
|
/**
|
|
31
41
|
* The value for the buffer variant.
|
|
32
|
-
* Value between
|
|
42
|
+
* Value between `min` and `max`.
|
|
33
43
|
*/
|
|
34
44
|
valueBuffer?: number | undefined;
|
|
35
45
|
/**
|