@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.
Files changed (130) hide show
  1. package/Autocomplete/Autocomplete.js +65 -11
  2. package/Autocomplete/Autocomplete.mjs +65 -11
  3. package/Avatar/Avatar.js +4 -0
  4. package/Avatar/Avatar.mjs +4 -0
  5. package/Badge/Badge.js +3 -0
  6. package/Badge/Badge.mjs +3 -0
  7. package/Button/Button.js +19 -2
  8. package/Button/Button.mjs +19 -2
  9. package/ButtonBase/ButtonBase.d.mts +7 -0
  10. package/ButtonBase/ButtonBase.d.ts +7 -0
  11. package/ButtonBase/ButtonBase.js +5 -2
  12. package/ButtonBase/ButtonBase.mjs +5 -2
  13. package/CHANGELOG.md +132 -1245
  14. package/Checkbox/Checkbox.js +2 -1
  15. package/Checkbox/Checkbox.mjs +2 -1
  16. package/CircularProgress/CircularProgress.d.mts +12 -2
  17. package/CircularProgress/CircularProgress.d.ts +12 -2
  18. package/CircularProgress/CircularProgress.js +33 -6
  19. package/CircularProgress/CircularProgress.mjs +33 -6
  20. package/ClickAwayListener/ClickAwayListener.js +3 -6
  21. package/ClickAwayListener/ClickAwayListener.mjs +3 -6
  22. package/Dialog/Dialog.js +11 -6
  23. package/Dialog/Dialog.mjs +11 -6
  24. package/Drawer/Drawer.js +18 -4
  25. package/Drawer/Drawer.mjs +18 -4
  26. package/Fab/Fab.js +7 -1
  27. package/Fab/Fab.mjs +7 -1
  28. package/FilledInput/FilledInput.d.mts +4 -0
  29. package/FilledInput/FilledInput.d.ts +4 -0
  30. package/FilledInput/FilledInput.js +18 -20
  31. package/FilledInput/FilledInput.mjs +18 -20
  32. package/FormControl/useFormControl.d.mts +12 -2
  33. package/FormControl/useFormControl.d.ts +12 -2
  34. package/FormControl/useFormControl.js +13 -0
  35. package/FormControl/useFormControl.mjs +12 -0
  36. package/FormControlLabel/FormControlLabel.js +5 -8
  37. package/FormControlLabel/FormControlLabel.mjs +5 -8
  38. package/FormGroup/FormGroup.js +2 -5
  39. package/FormGroup/FormGroup.mjs +2 -5
  40. package/FormHelperText/FormHelperText.js +2 -5
  41. package/FormHelperText/FormHelperText.mjs +2 -5
  42. package/FormLabel/FormLabel.js +2 -5
  43. package/FormLabel/FormLabel.mjs +2 -5
  44. package/IconButton/IconButton.js +1 -8
  45. package/IconButton/IconButton.mjs +1 -8
  46. package/Input/Input.d.mts +4 -0
  47. package/Input/Input.d.ts +4 -0
  48. package/Input/Input.js +6 -0
  49. package/Input/Input.mjs +6 -0
  50. package/InputBase/InputBase.d.mts +2 -1
  51. package/InputBase/InputBase.d.ts +2 -1
  52. package/InputBase/InputBase.js +50 -15
  53. package/InputBase/InputBase.mjs +50 -15
  54. package/InputLabel/InputLabel.js +5 -8
  55. package/InputLabel/InputLabel.mjs +5 -8
  56. package/LinearProgress/LinearProgress.d.mts +12 -2
  57. package/LinearProgress/LinearProgress.d.ts +12 -2
  58. package/LinearProgress/LinearProgress.js +42 -10
  59. package/LinearProgress/LinearProgress.mjs +42 -10
  60. package/List/List.js +2 -1
  61. package/List/List.mjs +2 -1
  62. package/ListItemButton/ListItemButton.js +7 -1
  63. package/ListItemButton/ListItemButton.mjs +7 -1
  64. package/MenuItem/MenuItem.js +7 -1
  65. package/MenuItem/MenuItem.mjs +7 -1
  66. package/MenuList/MenuList.js +2 -1
  67. package/MenuList/MenuList.mjs +2 -1
  68. package/NativeSelect/NativeSelect.js +2 -5
  69. package/NativeSelect/NativeSelect.mjs +2 -5
  70. package/OutlinedInput/OutlinedInput.js +13 -23
  71. package/OutlinedInput/OutlinedInput.mjs +13 -23
  72. package/PigmentContainer/PigmentContainer.js +0 -1
  73. package/PigmentContainer/PigmentContainer.mjs +0 -1
  74. package/Popper/BasePopper.js +23 -1
  75. package/Popper/BasePopper.mjs +23 -1
  76. package/Select/Select.js +2 -5
  77. package/Select/Select.mjs +2 -5
  78. package/Select/SelectInput.js +164 -2
  79. package/Select/SelectInput.mjs +164 -2
  80. package/Slide/Slide.js +48 -26
  81. package/Slide/Slide.mjs +49 -27
  82. package/Slider/Slider.js +10 -1
  83. package/Slider/Slider.mjs +10 -1
  84. package/Slider/useSlider.js +3 -2
  85. package/Slider/useSlider.mjs +3 -2
  86. package/SwipeableDrawer/SwipeableDrawer.js +7 -3
  87. package/SwipeableDrawer/SwipeableDrawer.mjs +7 -3
  88. package/Switch/Switch.js +7 -6
  89. package/Switch/Switch.mjs +7 -6
  90. package/Tabs/ScrollbarSize.js +2 -1
  91. package/Tabs/ScrollbarSize.mjs +2 -1
  92. package/Tabs/Tabs.js +2 -1
  93. package/Tabs/Tabs.mjs +2 -1
  94. package/Tooltip/Tooltip.js +26 -108
  95. package/Tooltip/Tooltip.mjs +26 -108
  96. package/Unstable_TrapFocus/FocusTrap.js +18 -14
  97. package/Unstable_TrapFocus/FocusTrap.mjs +18 -14
  98. package/index.js +1 -1
  99. package/index.mjs +1 -1
  100. package/package.json +49 -49
  101. package/styles/responsiveFontSizes.js +19 -8
  102. package/styles/responsiveFontSizes.mjs +19 -8
  103. package/styles/useThemeProps.d.mts +3 -3
  104. package/styles/useThemeProps.d.ts +3 -3
  105. package/transitions/utils.d.mts +17 -0
  106. package/transitions/utils.d.ts +17 -0
  107. package/transitions/utils.js +64 -0
  108. package/transitions/utils.mjs +63 -0
  109. package/useAutocomplete/useAutocomplete.d.mts +4 -5
  110. package/useAutocomplete/useAutocomplete.d.ts +4 -5
  111. package/useAutocomplete/useAutocomplete.js +166 -53
  112. package/useAutocomplete/useAutocomplete.mjs +166 -53
  113. package/utils/contains.d.mts +2 -0
  114. package/utils/contains.d.ts +2 -0
  115. package/utils/contains.js +9 -0
  116. package/utils/contains.mjs +2 -0
  117. package/utils/focusable.d.mts +7 -0
  118. package/utils/focusable.d.ts +7 -0
  119. package/utils/focusable.js +20 -0
  120. package/utils/focusable.mjs +13 -0
  121. package/utils/getEventTarget.d.mts +2 -0
  122. package/utils/getEventTarget.d.ts +2 -0
  123. package/utils/getEventTarget.js +9 -0
  124. package/utils/getEventTarget.mjs +2 -0
  125. package/utils/mergeSlotProps.js +2 -8
  126. package/utils/mergeSlotProps.mjs +1 -8
  127. package/version/index.js +2 -2
  128. package/version/index.mjs +2 -2
  129. package/FormControl/formControlState.js +0 -21
  130. package/FormControl/formControlState.mjs +0 -15
@@ -10,18 +10,21 @@ 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 useFormControl from "../FormControl/useFormControl.mjs";
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";
24
25
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
26
+ const MUI_AUTO_FILL = 'mui-auto-fill';
27
+ const MUI_AUTO_FILL_CANCEL = 'mui-auto-fill-cancel';
25
28
  export const rootOverridesResolver = (props, styles) => {
26
29
  const {
27
30
  ownerState
@@ -184,11 +187,11 @@ export const InputBaseInput = styled('input', {
184
187
  ownerState
185
188
  }) => !ownerState.disableInjectingGlobalStyles,
186
189
  style: {
187
- animationName: 'mui-auto-fill-cancel',
190
+ animationName: MUI_AUTO_FILL_CANCEL,
188
191
  animationDuration: '10ms',
189
192
  '&:-webkit-autofill': {
190
193
  animationDuration: '5000s',
191
- animationName: 'mui-auto-fill'
194
+ animationName: MUI_AUTO_FILL
192
195
  }
193
196
  }
194
197
  }, {
@@ -219,14 +222,16 @@ export const InputBaseInput = styled('input', {
219
222
  };
220
223
  }));
221
224
  const InputGlobalStyles = globalCss({
222
- '@keyframes mui-auto-fill': {
225
+ // Keep keyframes non-empty for Emotion production builds. Animation properties are ignored
226
+ // inside keyframes, avoiding the visible display animation triggered by Chrome 117+.
227
+ [`@keyframes ${MUI_AUTO_FILL}`]: {
223
228
  from: {
224
- display: 'block'
229
+ animationName: MUI_AUTO_FILL
225
230
  }
226
231
  },
227
- '@keyframes mui-auto-fill-cancel': {
232
+ [`@keyframes ${MUI_AUTO_FILL_CANCEL}`]: {
228
233
  from: {
229
- display: 'block'
234
+ animationName: MUI_AUTO_FILL_CANCEL
230
235
  }
231
236
  }
232
237
  });
@@ -243,6 +248,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
243
248
  });
244
249
  const {
245
250
  'aria-describedby': ariaDescribedby,
251
+ 'aria-label': ariaLabel,
246
252
  autoComplete,
247
253
  autoFocus,
248
254
  className,
@@ -294,7 +300,10 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
294
300
  }, []);
295
301
  const handleInputRef = useForkRef(inputRef, inputRefProp, inputPropsProp.ref, handleInputRefWarning);
296
302
  const [focused, setFocused] = React.useState(false);
297
- const muiFormControl = useFormControl();
303
+ const [fcs, muiFormControl] = useFormControlState({
304
+ props,
305
+ states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
306
+ });
298
307
  if (process.env.NODE_ENV !== 'production') {
299
308
  // TODO: uncomment once we enable eslint-plugin-react-compiler // eslint-disable-next-line react-compiler/react-compiler
300
309
  // eslint-disable-next-line react-hooks/rules-of-hooks
@@ -305,11 +314,6 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
305
314
  return undefined;
306
315
  }, [muiFormControl]);
307
316
  }
308
- const fcs = formControlState({
309
- props,
310
- muiFormControl,
311
- states: ['color', 'disabled', 'error', 'hiddenLabel', 'size', 'required', 'filled']
312
- });
313
317
  fcs.focused = muiFormControl ? muiFormControl.focused : focused;
314
318
 
315
319
  // The blur won't fire when the disabled state is set on a focused input.
@@ -340,6 +344,32 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
340
344
  });
341
345
  }
342
346
  }, [value, checkDirty, isControlled]);
347
+
348
+ // Sync focused state when autoFocus is used in SSR.
349
+ // If the browser focused the element before hydration, the onFocus handler never
350
+ // fires. If it did not, React hydration does not call focus() for autoFocus.
351
+ useEnhancedEffect(() => {
352
+ if (!autoFocus) {
353
+ return;
354
+ }
355
+ const input = inputRef.current;
356
+ if (!input) {
357
+ return;
358
+ }
359
+ const doc = ownerDocument(input);
360
+ const activeElement = getActiveElement(doc);
361
+ const noElementFocused = activeElement == null || activeElement === doc.body || activeElement === doc.documentElement;
362
+ if (input === activeElement) {
363
+ if (muiFormControl && muiFormControl.onFocus) {
364
+ muiFormControl.onFocus();
365
+ } else {
366
+ setFocused(true);
367
+ }
368
+ } else if (noElementFocused) {
369
+ input.focus();
370
+ }
371
+ // eslint-disable-next-line react-hooks/exhaustive-deps
372
+ }, [autoFocus]);
343
373
  const handleFocus = event => {
344
374
  if (onFocus) {
345
375
  onFocus(event);
@@ -428,7 +458,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
428
458
  }
429
459
  const handleAutoFill = event => {
430
460
  // Provide a fake value as Chrome might not let you access it for security reasons.
431
- checkDirty(event.animationName === 'mui-auto-fill-cancel' ? inputRef.current : {
461
+ checkDirty(event.animationName === MUI_AUTO_FILL_CANCEL ? inputRef.current : {
432
462
  value: 'x'
433
463
  });
434
464
  };
@@ -480,6 +510,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
480
510
  children: /*#__PURE__*/_jsx(Input, {
481
511
  "aria-invalid": fcs.error,
482
512
  "aria-describedby": ariaDescribedby,
513
+ "aria-label": ariaLabel,
483
514
  autoComplete: autoComplete,
484
515
  autoFocus: autoFocus,
485
516
  defaultValue: defaultValue,
@@ -525,6 +556,10 @@ process.env.NODE_ENV !== "production" ? InputBase.propTypes /* remove-proptypes
525
556
  * @ignore
526
557
  */
527
558
  'aria-describedby': PropTypes.string,
559
+ /**
560
+ * @ignore
561
+ */
562
+ 'aria-label': PropTypes.string,
528
563
  /**
529
564
  * This prop helps users to fill forms faster, especially on mobile devices.
530
565
  * The name can be confusing, as it's more like an autofill.
@@ -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 _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
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"));
@@ -190,16 +189,14 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
190
189
  className,
191
190
  ...other
192
191
  } = props;
193
- const muiFormControl = (0, _useFormControl.default)();
192
+ const [fcs, muiFormControl] = (0, _useFormControl.useFormControlState)({
193
+ props,
194
+ states: ['size', 'variant', 'required', 'focused']
195
+ });
194
196
  let shrink = shrinkProp;
195
197
  if (typeof shrink === 'undefined' && muiFormControl) {
196
198
  shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
197
199
  }
198
- const fcs = (0, _formControlState.default)({
199
- props,
200
- muiFormControl,
201
- states: ['size', 'variant', 'required', 'focused']
202
- });
203
200
  const ownerState = {
204
201
  ...props,
205
202
  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 formControlState from "../FormControl/formControlState.mjs";
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";
@@ -183,16 +182,14 @@ const InputLabel = /*#__PURE__*/React.forwardRef(function InputLabel(inProps, re
183
182
  className,
184
183
  ...other
185
184
  } = props;
186
- const muiFormControl = useFormControl();
185
+ const [fcs, muiFormControl] = useFormControlState({
186
+ props,
187
+ states: ['size', 'variant', 'required', 'focused']
188
+ });
187
189
  let shrink = shrinkProp;
188
190
  if (typeof shrink === 'undefined' && muiFormControl) {
189
191
  shrink = muiFormControl.filled || muiFormControl.focused || muiFormControl.adornedStart;
190
192
  }
191
- const fcs = formControlState({
192
- props,
193
- muiFormControl,
194
- states: ['size', 'variant', 'required', 'focused']
195
- });
196
193
  const ownerState = {
197
194
  ...props,
198
195
  disableAnimation,
@@ -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 0 and 100.
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 0 and 100.
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 0 and 100.
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 0 and 100.
42
+ * Value between `min` and `max`.
33
43
  */
34
44
  valueBuffer?: number | undefined;
35
45
  /**
@@ -342,6 +342,8 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
342
342
  const {
343
343
  className,
344
344
  color = 'primary',
345
+ max: maxProp,
346
+ min: minProp,
345
347
  value,
346
348
  valueBuffer,
347
349
  variant = 'indeterminate',
@@ -352,6 +354,13 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
352
354
  color,
353
355
  variant
354
356
  };
357
+ if (process.env.NODE_ENV !== 'production') {
358
+ if (['indeterminate', 'query'].includes(variant) && (minProp !== undefined || maxProp !== undefined)) {
359
+ console.warn(`MUI: You have provided the \`min\` or \`max\` props with an 'indeterminate' or 'query' variant. These props will have no effect.`);
360
+ }
361
+ }
362
+ const min = minProp ?? 0;
363
+ const max = maxProp ?? 100;
355
364
  const classes = useUtilityClasses(ownerState);
356
365
  const isRtl = (0, _RtlProvider.useRtl)();
357
366
  const rootProps = {};
@@ -361,25 +370,38 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
361
370
  };
362
371
  if (variant === 'determinate' || variant === 'buffer') {
363
372
  if (value !== undefined) {
364
- rootProps['aria-valuenow'] = Math.round(value);
365
- rootProps['aria-valuemin'] = 0;
366
- rootProps['aria-valuemax'] = 100;
367
- let transform = value - 100;
373
+ if (process.env.NODE_ENV !== 'production') {
374
+ if (value < min || value > max || min >= max) {
375
+ console.error(`MUI: The min, max, and value props in LinearProgress should be numbers where min < max and min <= value <= max. Received min=${min}, max=${max}, value=${value}.`);
376
+ }
377
+ }
378
+ const range = max - min;
379
+ let transform = (value - min) / range * 100 - 100;
368
380
  if (isRtl) {
369
381
  transform = -transform;
370
382
  }
371
- inlineStyles.bar1.transform = `translateX(${transform}%)`;
383
+ inlineStyles.bar1.transform = range > 0 ? `translateX(${transform}%)` : 'translateX(-100%)'; // empty-state fallback when range is invalid
384
+
385
+ rootProps['aria-valuenow'] = value;
386
+ rootProps['aria-valuemin'] = min;
387
+ rootProps['aria-valuemax'] = max;
372
388
  } else if (process.env.NODE_ENV !== 'production') {
373
- console.error('MUI: You need to provide a value prop ' + 'when using the determinate or buffer variant of LinearProgress .');
389
+ console.error('MUI: You need to provide a value prop ' + 'when using the determinate or buffer variant of LinearProgress.');
374
390
  }
375
391
  }
376
392
  if (variant === 'buffer') {
377
393
  if (valueBuffer !== undefined) {
378
- let transform = (valueBuffer || 0) - 100;
394
+ if (process.env.NODE_ENV !== 'production') {
395
+ if (valueBuffer < min || valueBuffer > max || valueBuffer < value || min >= max) {
396
+ console.error(`MUI: The min, max, value, and valueBuffer props in LinearProgress should be numbers where min < max and min <= value <= valueBuffer <= max. Received min=${min}, max=${max}, value=${value}, valueBuffer=${valueBuffer}.`);
397
+ }
398
+ }
399
+ const range = max - min;
400
+ let transform = (valueBuffer - min) / range * 100 - 100;
379
401
  if (isRtl) {
380
402
  transform = -transform;
381
403
  }
382
- inlineStyles.bar2.transform = `translateX(${transform}%)`;
404
+ inlineStyles.bar2.transform = range > 0 ? `translateX(${transform}%)` : 'translateX(-100%)'; // empty-state fallback when range is invalid
383
405
  } else if (process.env.NODE_ENV !== 'production') {
384
406
  console.error('MUI: You need to provide a valueBuffer prop ' + 'when using the buffer variant of LinearProgress.');
385
407
  }
@@ -425,18 +447,28 @@ process.env.NODE_ENV !== "production" ? LinearProgress.propTypes /* remove-propt
425
447
  * @default 'primary'
426
448
  */
427
449
  color: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['inherit', 'primary', 'secondary']), _propTypes.default.string]),
450
+ /**
451
+ * The maximum value for the progress indicator for the determinate and buffer variants.
452
+ * @default 100
453
+ */
454
+ max: _propTypes.default.number,
455
+ /**
456
+ * The minimum value for the progress indicator for the determinate and buffer variants.
457
+ * @default 0
458
+ */
459
+ min: _propTypes.default.number,
428
460
  /**
429
461
  * The system prop that allows defining system overrides as well as additional CSS styles.
430
462
  */
431
463
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
432
464
  /**
433
465
  * The value of the progress indicator for the determinate and buffer variants.
434
- * Value between 0 and 100.
466
+ * Value between `min` and `max`.
435
467
  */
436
468
  value: _propTypes.default.number,
437
469
  /**
438
470
  * The value for the buffer variant.
439
- * Value between 0 and 100.
471
+ * Value between `min` and `max`.
440
472
  */
441
473
  valueBuffer: _propTypes.default.number,
442
474
  /**
@@ -335,6 +335,8 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
335
335
  const {
336
336
  className,
337
337
  color = 'primary',
338
+ max: maxProp,
339
+ min: minProp,
338
340
  value,
339
341
  valueBuffer,
340
342
  variant = 'indeterminate',
@@ -345,6 +347,13 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
345
347
  color,
346
348
  variant
347
349
  };
350
+ if (process.env.NODE_ENV !== 'production') {
351
+ if (['indeterminate', 'query'].includes(variant) && (minProp !== undefined || maxProp !== undefined)) {
352
+ console.warn(`MUI: You have provided the \`min\` or \`max\` props with an 'indeterminate' or 'query' variant. These props will have no effect.`);
353
+ }
354
+ }
355
+ const min = minProp ?? 0;
356
+ const max = maxProp ?? 100;
348
357
  const classes = useUtilityClasses(ownerState);
349
358
  const isRtl = useRtl();
350
359
  const rootProps = {};
@@ -354,25 +363,38 @@ const LinearProgress = /*#__PURE__*/React.forwardRef(function LinearProgress(inP
354
363
  };
355
364
  if (variant === 'determinate' || variant === 'buffer') {
356
365
  if (value !== undefined) {
357
- rootProps['aria-valuenow'] = Math.round(value);
358
- rootProps['aria-valuemin'] = 0;
359
- rootProps['aria-valuemax'] = 100;
360
- let transform = value - 100;
366
+ if (process.env.NODE_ENV !== 'production') {
367
+ if (value < min || value > max || min >= max) {
368
+ console.error(`MUI: The min, max, and value props in LinearProgress should be numbers where min < max and min <= value <= max. Received min=${min}, max=${max}, value=${value}.`);
369
+ }
370
+ }
371
+ const range = max - min;
372
+ let transform = (value - min) / range * 100 - 100;
361
373
  if (isRtl) {
362
374
  transform = -transform;
363
375
  }
364
- inlineStyles.bar1.transform = `translateX(${transform}%)`;
376
+ inlineStyles.bar1.transform = range > 0 ? `translateX(${transform}%)` : 'translateX(-100%)'; // empty-state fallback when range is invalid
377
+
378
+ rootProps['aria-valuenow'] = value;
379
+ rootProps['aria-valuemin'] = min;
380
+ rootProps['aria-valuemax'] = max;
365
381
  } else if (process.env.NODE_ENV !== 'production') {
366
- console.error('MUI: You need to provide a value prop ' + 'when using the determinate or buffer variant of LinearProgress .');
382
+ console.error('MUI: You need to provide a value prop ' + 'when using the determinate or buffer variant of LinearProgress.');
367
383
  }
368
384
  }
369
385
  if (variant === 'buffer') {
370
386
  if (valueBuffer !== undefined) {
371
- let transform = (valueBuffer || 0) - 100;
387
+ if (process.env.NODE_ENV !== 'production') {
388
+ if (valueBuffer < min || valueBuffer > max || valueBuffer < value || min >= max) {
389
+ console.error(`MUI: The min, max, value, and valueBuffer props in LinearProgress should be numbers where min < max and min <= value <= valueBuffer <= max. Received min=${min}, max=${max}, value=${value}, valueBuffer=${valueBuffer}.`);
390
+ }
391
+ }
392
+ const range = max - min;
393
+ let transform = (valueBuffer - min) / range * 100 - 100;
372
394
  if (isRtl) {
373
395
  transform = -transform;
374
396
  }
375
- inlineStyles.bar2.transform = `translateX(${transform}%)`;
397
+ inlineStyles.bar2.transform = range > 0 ? `translateX(${transform}%)` : 'translateX(-100%)'; // empty-state fallback when range is invalid
376
398
  } else if (process.env.NODE_ENV !== 'production') {
377
399
  console.error('MUI: You need to provide a valueBuffer prop ' + 'when using the buffer variant of LinearProgress.');
378
400
  }
@@ -418,18 +440,28 @@ process.env.NODE_ENV !== "production" ? LinearProgress.propTypes /* remove-propt
418
440
  * @default 'primary'
419
441
  */
420
442
  color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['inherit', 'primary', 'secondary']), PropTypes.string]),
443
+ /**
444
+ * The maximum value for the progress indicator for the determinate and buffer variants.
445
+ * @default 100
446
+ */
447
+ max: PropTypes.number,
448
+ /**
449
+ * The minimum value for the progress indicator for the determinate and buffer variants.
450
+ * @default 0
451
+ */
452
+ min: PropTypes.number,
421
453
  /**
422
454
  * The system prop that allows defining system overrides as well as additional CSS styles.
423
455
  */
424
456
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
425
457
  /**
426
458
  * The value of the progress indicator for the determinate and buffer variants.
427
- * Value between 0 and 100.
459
+ * Value between `min` and `max`.
428
460
  */
429
461
  value: PropTypes.number,
430
462
  /**
431
463
  * The value for the buffer variant.
432
- * Value between 0 and 100.
464
+ * Value between `min` and `max`.
433
465
  */
434
466
  valueBuffer: PropTypes.number,
435
467
  /**
package/List/List.js CHANGED
@@ -55,7 +55,8 @@ const ListRoot = (0, _zeroStyled.styled)('ul', {
55
55
  ownerState
56
56
  }) => ownerState.subheader,
57
57
  style: {
58
- paddingTop: 0
58
+ paddingTop: 0,
59
+ isolation: 'isolate' // Prevent overlap with iOS overlay scrollbars.
59
60
  }
60
61
  }]
61
62
  });
package/List/List.mjs CHANGED
@@ -48,7 +48,8 @@ const ListRoot = styled('ul', {
48
48
  ownerState
49
49
  }) => ownerState.subheader,
50
50
  style: {
51
- paddingTop: 0
51
+ paddingTop: 0,
52
+ isolation: 'isolate' // Prevent overlap with iOS overlay scrollbars.
52
53
  }
53
54
  }]
54
55
  });
@@ -172,6 +172,12 @@ const ListItemButton = /*#__PURE__*/React.forwardRef(function ListItemButton(inP
172
172
  selected
173
173
  };
174
174
  const classes = useUtilityClasses(ownerState);
175
+
176
+ // Don't forward the 'root' class to the ButtonBase, as it will get duplicated with the one passed to the className prop.
177
+ const {
178
+ root,
179
+ ...forwardedClasses
180
+ } = classes;
175
181
  const handleRef = (0, _useForkRef.default)(listItemRef, ref);
176
182
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListContext.default.Provider, {
177
183
  value: childContext,
@@ -186,7 +192,7 @@ const ListItemButton = /*#__PURE__*/React.forwardRef(function ListItemButton(inP
186
192
  ownerState: ownerState,
187
193
  className: (0, _clsx.default)(classes.root, className),
188
194
  ...other,
189
- classes: classes,
195
+ classes: forwardedClasses,
190
196
  children: children
191
197
  })
192
198
  });
@@ -164,6 +164,12 @@ const ListItemButton = /*#__PURE__*/React.forwardRef(function ListItemButton(inP
164
164
  selected
165
165
  };
166
166
  const classes = useUtilityClasses(ownerState);
167
+
168
+ // Don't forward the 'root' class to the ButtonBase, as it will get duplicated with the one passed to the className prop.
169
+ const {
170
+ root,
171
+ ...forwardedClasses
172
+ } = classes;
167
173
  const handleRef = useForkRef(listItemRef, ref);
168
174
  return /*#__PURE__*/_jsx(ListContext.Provider, {
169
175
  value: childContext,
@@ -178,7 +184,7 @@ const ListItemButton = /*#__PURE__*/React.forwardRef(function ListItemButton(inP
178
184
  ownerState: ownerState,
179
185
  className: clsx(classes.root, className),
180
186
  ...other,
181
- classes: classes,
187
+ classes: forwardedClasses,
182
188
  children: children
183
189
  })
184
190
  });
@@ -206,6 +206,12 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
206
206
  disableGutters
207
207
  };
208
208
  const classes = useUtilityClasses(props);
209
+
210
+ // Don't forward the 'root' class to the ButtonBase, as it will get duplicated with the one passed to the className prop.
211
+ const {
212
+ root,
213
+ ...forwardedClasses
214
+ } = classes;
209
215
  const rovingItemProps = (0, _useRovingTabIndex.useRovingTabIndexItem)({
210
216
  id: rovingItemId,
211
217
  ref,
@@ -238,7 +244,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
238
244
  className: (0, _clsx.default)(classes.root, className),
239
245
  ...other,
240
246
  ownerState: ownerState,
241
- classes: classes
247
+ classes: forwardedClasses
242
248
  })
243
249
  });
244
250
  });
@@ -198,6 +198,12 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
198
198
  disableGutters
199
199
  };
200
200
  const classes = useUtilityClasses(props);
201
+
202
+ // Don't forward the 'root' class to the ButtonBase, as it will get duplicated with the one passed to the className prop.
203
+ const {
204
+ root,
205
+ ...forwardedClasses
206
+ } = classes;
201
207
  const rovingItemProps = useRovingTabIndexItem({
202
208
  id: rovingItemId,
203
209
  ref,
@@ -230,7 +236,7 @@ const MenuItem = /*#__PURE__*/React.forwardRef(function MenuItem(inProps, ref) {
230
236
  className: clsx(classes.root, className),
231
237
  ...other,
232
238
  ownerState: ownerState,
233
- classes: classes
239
+ classes: forwardedClasses
234
240
  })
235
241
  });
236
242
  });
@@ -10,6 +10,7 @@ exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
12
  var _useRovingTabIndex = require("@mui/utils/useRovingTabIndex");
13
+ var _contains = _interopRequireDefault(require("../utils/contains"));
13
14
  var _ownerDocument = _interopRequireDefault(require("../utils/ownerDocument"));
14
15
  var _getActiveElement = _interopRequireDefault(require("../utils/getActiveElement"));
15
16
  var _getScrollbarSize = _interopRequireDefault(require("../utils/getScrollbarSize"));
@@ -185,7 +186,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
185
186
  return null;
186
187
  }
187
188
  const currentFocus = (0, _getActiveElement.default)((0, _ownerDocument.default)(listRef.current));
188
- if (currentFocus && listRef.current.contains(currentFocus)) {
189
+ if (currentFocus && (0, _contains.default)(listRef.current, currentFocus)) {
189
190
  return currentFocus;
190
191
  }
191
192
  return focusInitialTarget(true);
@@ -3,6 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import PropTypes from 'prop-types';
5
5
  import { isItemFocusable } from '@mui/utils/useRovingTabIndex';
6
+ import contains from "../utils/contains.mjs";
6
7
  import ownerDocument from "../utils/ownerDocument.mjs";
7
8
  import getActiveElement from "../utils/getActiveElement.mjs";
8
9
  import getScrollbarSize from "../utils/getScrollbarSize.mjs";
@@ -178,7 +179,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
178
179
  return null;
179
180
  }
180
181
  const currentFocus = getActiveElement(ownerDocument(listRef.current));
181
- if (currentFocus && listRef.current.contains(currentFocus)) {
182
+ if (currentFocus && contains(listRef.current, currentFocus)) {
182
183
  return currentFocus;
183
184
  }
184
185
  return focusInitialTarget(true);
@@ -12,8 +12,7 @@ var _clsx = _interopRequireDefault(require("clsx"));
12
12
  var _propTypes = _interopRequireDefault(require("prop-types"));
13
13
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
14
14
  var _NativeSelectInput = _interopRequireDefault(require("./NativeSelectInput"));
15
- var _formControlState = _interopRequireDefault(require("../FormControl/formControlState"));
16
- var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
15
+ var _useFormControl = require("../FormControl/useFormControl");
17
16
  var _ArrowDropDown = _interopRequireDefault(require("../internal/svg-icons/ArrowDropDown"));
18
17
  var _Input = _interopRequireDefault(require("../Input"));
19
18
  var _DefaultPropsProvider = require("../DefaultPropsProvider");
@@ -47,10 +46,8 @@ const NativeSelect = /*#__PURE__*/React.forwardRef(function NativeSelect(inProps
47
46
  variant,
48
47
  ...other
49
48
  } = props;
50
- const muiFormControl = (0, _useFormControl.default)();
51
- const fcs = (0, _formControlState.default)({
49
+ const [fcs] = (0, _useFormControl.useFormControlState)({
52
50
  props,
53
- muiFormControl,
54
51
  states: ['variant']
55
52
  });
56
53
  const ownerState = {