@mui/material 5.2.7 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/Autocomplete/Autocomplete.d.ts +7 -0
  2. package/Autocomplete/Autocomplete.js +22 -10
  3. package/Backdrop/Backdrop.js +3 -1
  4. package/Badge/Badge.js +6 -7
  5. package/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  6. package/Button/buttonClasses.d.ts +1 -1
  7. package/ButtonBase/TouchRipple.js +1 -2
  8. package/CHANGELOG.md +284 -33
  9. package/FilledInput/FilledInput.js +4 -1
  10. package/FormControlLabel/FormControlLabel.js +14 -4
  11. package/FormControlLabel/formControlLabelClasses.d.ts +2 -0
  12. package/FormControlLabel/formControlLabelClasses.js +1 -1
  13. package/FormGroup/FormGroup.js +14 -3
  14. package/FormGroup/formGroupClasses.d.ts +2 -0
  15. package/FormGroup/formGroupClasses.js +1 -1
  16. package/FormHelperText/FormHelperText.js +7 -9
  17. package/Grid/Grid.js +2 -4
  18. package/Input/Input.js +4 -1
  19. package/InputAdornment/InputAdornment.js +6 -9
  20. package/InputBase/InputBase.js +4 -1
  21. package/InputLabel/InputLabel.js +4 -0
  22. package/ListItem/ListItem.js +3 -1
  23. package/Modal/Modal.js +3 -1
  24. package/OutlinedInput/NotchedOutline.js +14 -16
  25. package/OutlinedInput/OutlinedInput.js +1 -1
  26. package/README.md +5 -4
  27. package/Radio/RadioButtonIcon.js +2 -6
  28. package/Select/Select.d.ts +9 -1
  29. package/Select/Select.js +10 -1
  30. package/Select/SelectInput.d.ts +1 -0
  31. package/Select/SelectInput.js +32 -13
  32. package/Slider/Slider.d.ts +2 -0
  33. package/Slider/Slider.js +126 -53
  34. package/StepLabel/StepLabel.js +3 -1
  35. package/SvgIcon/SvgIcon.js +9 -9
  36. package/SwipeableDrawer/SwipeArea.js +1 -3
  37. package/TextField/TextField.d.ts +1 -0
  38. package/TextField/TextField.js +2 -1
  39. package/Tooltip/Tooltip.js +6 -1
  40. package/index.d.ts +7 -2
  41. package/index.js +6 -3
  42. package/internal/SwitchBase.js +2 -6
  43. package/legacy/Autocomplete/Autocomplete.js +23 -10
  44. package/legacy/Backdrop/Backdrop.js +3 -1
  45. package/legacy/Badge/Badge.js +6 -7
  46. package/legacy/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  47. package/legacy/ButtonBase/TouchRipple.js +1 -2
  48. package/legacy/FilledInput/FilledInput.js +4 -1
  49. package/legacy/FormControlLabel/FormControlLabel.js +14 -4
  50. package/legacy/FormControlLabel/formControlLabelClasses.js +1 -1
  51. package/legacy/FormGroup/FormGroup.js +14 -3
  52. package/legacy/FormGroup/formGroupClasses.js +1 -1
  53. package/legacy/FormHelperText/FormHelperText.js +7 -9
  54. package/legacy/Grid/Grid.js +2 -4
  55. package/legacy/Input/Input.js +4 -1
  56. package/legacy/InputAdornment/InputAdornment.js +6 -9
  57. package/legacy/InputBase/InputBase.js +4 -1
  58. package/legacy/InputLabel/InputLabel.js +4 -0
  59. package/legacy/ListItem/ListItem.js +3 -1
  60. package/legacy/Modal/Modal.js +3 -1
  61. package/legacy/OutlinedInput/NotchedOutline.js +14 -16
  62. package/legacy/OutlinedInput/OutlinedInput.js +1 -1
  63. package/legacy/Radio/RadioButtonIcon.js +2 -6
  64. package/legacy/Select/Select.js +11 -1
  65. package/legacy/Select/SelectInput.js +36 -16
  66. package/legacy/Slider/Slider.js +127 -54
  67. package/legacy/StepLabel/StepLabel.js +3 -1
  68. package/legacy/SvgIcon/SvgIcon.js +9 -9
  69. package/legacy/SwipeableDrawer/SwipeArea.js +1 -3
  70. package/legacy/TextField/TextField.js +2 -1
  71. package/legacy/Tooltip/Tooltip.js +6 -1
  72. package/legacy/index.js +6 -3
  73. package/legacy/internal/SwitchBase.js +2 -6
  74. package/legacy/useMediaQuery/useMediaQuery.js +86 -31
  75. package/legacy/utils/shouldSpreadAdditionalProps.js +7 -0
  76. package/modern/Autocomplete/Autocomplete.js +21 -9
  77. package/modern/Backdrop/Backdrop.js +3 -1
  78. package/modern/Badge/Badge.js +6 -7
  79. package/modern/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  80. package/modern/ButtonBase/TouchRipple.js +1 -2
  81. package/modern/FilledInput/FilledInput.js +4 -1
  82. package/modern/FormControlLabel/FormControlLabel.js +14 -4
  83. package/modern/FormControlLabel/formControlLabelClasses.js +1 -1
  84. package/modern/FormGroup/FormGroup.js +14 -3
  85. package/modern/FormGroup/formGroupClasses.js +1 -1
  86. package/modern/FormHelperText/FormHelperText.js +7 -9
  87. package/modern/Grid/Grid.js +2 -4
  88. package/modern/Input/Input.js +4 -1
  89. package/modern/InputAdornment/InputAdornment.js +6 -9
  90. package/modern/InputBase/InputBase.js +4 -1
  91. package/modern/InputLabel/InputLabel.js +4 -0
  92. package/modern/ListItem/ListItem.js +3 -1
  93. package/modern/Modal/Modal.js +3 -1
  94. package/modern/OutlinedInput/NotchedOutline.js +14 -16
  95. package/modern/OutlinedInput/OutlinedInput.js +1 -1
  96. package/modern/Radio/RadioButtonIcon.js +2 -6
  97. package/modern/Select/Select.js +10 -1
  98. package/modern/Select/SelectInput.js +32 -13
  99. package/modern/Slider/Slider.js +126 -53
  100. package/modern/StepLabel/StepLabel.js +3 -1
  101. package/modern/SvgIcon/SvgIcon.js +8 -8
  102. package/modern/SwipeableDrawer/SwipeArea.js +1 -3
  103. package/modern/TextField/TextField.js +2 -1
  104. package/modern/Tooltip/Tooltip.js +6 -1
  105. package/modern/index.js +6 -3
  106. package/modern/internal/SwitchBase.js +2 -6
  107. package/modern/useMediaQuery/useMediaQuery.js +68 -26
  108. package/modern/utils/shouldSpreadAdditionalProps.js +7 -0
  109. package/node/Autocomplete/Autocomplete.js +22 -10
  110. package/node/Backdrop/Backdrop.js +3 -1
  111. package/node/Badge/Badge.js +8 -8
  112. package/node/Breadcrumbs/BreadcrumbCollapsed.js +1 -3
  113. package/node/ButtonBase/TouchRipple.js +1 -2
  114. package/node/FilledInput/FilledInput.js +4 -1
  115. package/node/FormControlLabel/FormControlLabel.js +15 -4
  116. package/node/FormControlLabel/formControlLabelClasses.js +1 -1
  117. package/node/FormGroup/FormGroup.js +15 -3
  118. package/node/FormGroup/formGroupClasses.js +1 -1
  119. package/node/FormHelperText/FormHelperText.js +6 -9
  120. package/node/Grid/Grid.js +2 -4
  121. package/node/Input/Input.js +4 -1
  122. package/node/InputAdornment/InputAdornment.js +5 -9
  123. package/node/InputBase/InputBase.js +4 -1
  124. package/node/InputLabel/InputLabel.js +4 -0
  125. package/node/ListItem/ListItem.js +3 -1
  126. package/node/Modal/Modal.js +3 -1
  127. package/node/OutlinedInput/NotchedOutline.js +12 -16
  128. package/node/OutlinedInput/OutlinedInput.js +1 -1
  129. package/node/Radio/RadioButtonIcon.js +2 -6
  130. package/node/Select/Select.js +10 -1
  131. package/node/Select/SelectInput.js +31 -13
  132. package/node/Slider/Slider.js +112 -45
  133. package/node/StepLabel/StepLabel.js +3 -1
  134. package/node/SvgIcon/SvgIcon.js +9 -9
  135. package/node/SwipeableDrawer/SwipeArea.js +1 -3
  136. package/node/TextField/TextField.js +2 -1
  137. package/node/Tooltip/Tooltip.js +6 -1
  138. package/node/index.js +41 -16
  139. package/node/internal/SwitchBase.js +2 -6
  140. package/node/useMediaQuery/useMediaQuery.js +68 -26
  141. package/node/utils/shouldSpreadAdditionalProps.js +15 -0
  142. package/package.json +7 -7
  143. package/styles/ThemeProvider.d.ts +1 -1
  144. package/styles/components.d.ts +452 -113
  145. package/styles/createTheme.d.ts +12 -6
  146. package/styles/overrides.d.ts +16 -4
  147. package/styles/useThemeProps.d.ts +2 -1
  148. package/umd/material-ui.development.js +2988 -4926
  149. package/umd/material-ui.production.min.js +21 -21
  150. package/useMediaQuery/useMediaQuery.d.ts +4 -0
  151. package/useMediaQuery/useMediaQuery.js +68 -26
  152. package/utils/shouldSpreadAdditionalProps.js +7 -0
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { IconButtonProps, InternalStandardProps as StandardProps, Theme } from '@mui/material';
3
3
  import { ChipProps, ChipTypeMap } from '@mui/material/Chip';
4
+ import { PaperProps } from '@mui/material/Paper';
4
5
  import { PopperProps } from '@mui/material/Popper';
5
6
  import { SxProps } from '@mui/system';
6
7
  import { OverridableStringUnion } from '@mui/types';
@@ -101,6 +102,7 @@ export interface AutocompleteProps<
101
102
  */
102
103
  componentsProps?: {
103
104
  clearIndicator?: Partial<IconButtonProps>;
105
+ paper?: PaperProps;
104
106
  };
105
107
  /**
106
108
  * If `true`, the component is disabled.
@@ -187,6 +189,11 @@ export interface AutocompleteProps<
187
189
  * @default <ArrowDropDownIcon />
188
190
  */
189
191
  popupIcon?: React.ReactNode;
192
+ /**
193
+ * If `true`, the component becomes readonly. It is also supported for multiple tags where the tag cannot be deleted.
194
+ * @default false
195
+ */
196
+ readOnly?: boolean;
190
197
  /**
191
198
  * Render the group.
192
199
  *
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
3
3
 
4
4
  var _ClearIcon, _ArrowDropDownIcon;
5
5
 
6
- const _excluded = ["autoComplete", "autoHighlight", "autoSelect", "blurOnSelect", "ChipProps", "className", "clearIcon", "clearOnBlur", "clearOnEscape", "clearText", "closeText", "componentsProps", "defaultValue", "disableClearable", "disableCloseOnSelect", "disabled", "disabledItemsFocusable", "disableListWrap", "disablePortal", "filterOptions", "filterSelectedOptions", "forcePopupIcon", "freeSolo", "fullWidth", "getLimitTagsText", "getOptionDisabled", "getOptionLabel", "isOptionEqualToValue", "groupBy", "handleHomeEndKeys", "id", "includeInputInList", "inputValue", "limitTags", "ListboxComponent", "ListboxProps", "loading", "loadingText", "multiple", "noOptionsText", "onChange", "onClose", "onHighlightChange", "onInputChange", "onOpen", "open", "openOnFocus", "openText", "options", "PaperComponent", "PopperComponent", "popupIcon", "renderGroup", "renderInput", "renderOption", "renderTags", "selectOnFocus", "size", "value"];
6
+ const _excluded = ["autoComplete", "autoHighlight", "autoSelect", "blurOnSelect", "ChipProps", "className", "clearIcon", "clearOnBlur", "clearOnEscape", "clearText", "closeText", "componentsProps", "defaultValue", "disableClearable", "disableCloseOnSelect", "disabled", "disabledItemsFocusable", "disableListWrap", "disablePortal", "filterOptions", "filterSelectedOptions", "forcePopupIcon", "freeSolo", "fullWidth", "getLimitTagsText", "getOptionDisabled", "getOptionLabel", "isOptionEqualToValue", "groupBy", "handleHomeEndKeys", "id", "includeInputInList", "inputValue", "limitTags", "ListboxComponent", "ListboxProps", "loading", "loadingText", "multiple", "noOptionsText", "onChange", "onClose", "onHighlightChange", "onInputChange", "onOpen", "open", "openOnFocus", "openText", "options", "PaperComponent", "PopperComponent", "popupIcon", "readOnly", "renderGroup", "renderInput", "renderOption", "renderTags", "selectOnFocus", "size", "value"];
7
7
  import * as React from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
  import clsx from 'clsx';
@@ -349,7 +349,7 @@ const AutocompleteGroupUl = styled('ul', {
349
349
  });
350
350
  export { createFilterOptions };
351
351
  const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps, ref) {
352
- var _componentsProps$clea;
352
+ var _componentsProps$clea, _componentsProps$pape;
353
353
 
354
354
  const props = useThemeProps({
355
355
  props: inProps,
@@ -404,6 +404,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
404
404
  PaperComponent = Paper,
405
405
  PopperComponent = Popper,
406
406
  popupIcon = _ArrowDropDownIcon || (_ArrowDropDownIcon = /*#__PURE__*/_jsx(ArrowDropDownIcon, {})),
407
+ readOnly = false,
407
408
  renderGroup: renderGroupProp,
408
409
  renderInput,
409
410
  renderOption: renderOptionProp,
@@ -437,7 +438,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
437
438
  } = useAutocomplete(_extends({}, props, {
438
439
  componentName: 'Autocomplete'
439
440
  }));
440
- const hasClearIcon = !disableClearable && !disabled && dirty;
441
+ const hasClearIcon = !disableClearable && !disabled && dirty && !readOnly;
441
442
  const hasPopupIcon = (!freeSolo || forcePopupIcon === true) && forcePopupIcon !== false;
442
443
 
443
444
  const ownerState = _extends({}, props, {
@@ -556,7 +557,8 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
556
557
  },
557
558
  inputProps: _extends({
558
559
  className: clsx(classes.input),
559
- disabled
560
+ disabled,
561
+ readOnly
560
562
  }, getInputProps())
561
563
  })
562
564
  })), popupOpen && anchorEl ? /*#__PURE__*/_jsx(AutocompletePopper, {
@@ -570,10 +572,11 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
570
572
  role: "presentation",
571
573
  anchorEl: anchorEl,
572
574
  open: true,
573
- children: /*#__PURE__*/_jsxs(AutocompletePaper, {
574
- as: PaperComponent,
575
- className: classes.paper,
575
+ children: /*#__PURE__*/_jsxs(AutocompletePaper, _extends({
576
576
  ownerState: ownerState,
577
+ as: PaperComponent
578
+ }, componentsProps.paper, {
579
+ className: clsx(classes.paper, (_componentsProps$pape = componentsProps.paper) == null ? void 0 : _componentsProps$pape.className),
577
580
  children: [loading && groupedOptions.length === 0 ? /*#__PURE__*/_jsx(AutocompleteLoading, {
578
581
  className: classes.loading,
579
582
  ownerState: ownerState,
@@ -604,7 +607,7 @@ const Autocomplete = /*#__PURE__*/React.forwardRef(function Autocomplete(inProps
604
607
  return renderListOption(option, index);
605
608
  })
606
609
  })) : null]
607
- })
610
+ }))
608
611
  }) : null]
609
612
  });
610
613
  });
@@ -674,7 +677,7 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes
674
677
  * If `true`, the input's text is cleared on blur if no value is selected.
675
678
  *
676
679
  * Set to `true` if you want to help the user enter a new value.
677
- * Set to `false` if you want to help the user resume his search.
680
+ * Set to `false` if you want to help the user resume their search.
678
681
  * @default !props.freeSolo
679
682
  */
680
683
  clearOnBlur: PropTypes.bool,
@@ -705,7 +708,10 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes
705
708
  * The props used for each slot inside.
706
709
  * @default {}
707
710
  */
708
- componentsProps: PropTypes.object,
711
+ componentsProps: PropTypes.shape({
712
+ clearIndicator: PropTypes.object,
713
+ paper: PropTypes.object
714
+ }),
709
715
 
710
716
  /**
711
717
  * The default value. Use when the component is not controlled.
@@ -993,6 +999,12 @@ process.env.NODE_ENV !== "production" ? Autocomplete.propTypes
993
999
  */
994
1000
  popupIcon: PropTypes.node,
995
1001
 
1002
+ /**
1003
+ * If `true`, the component becomes readonly. It is also supported for multiple tags where the tag cannot be deleted.
1004
+ * @default false
1005
+ */
1006
+ readOnly: PropTypes.bool,
1007
+
996
1008
  /**
997
1009
  * Render the group.
998
1010
  *
@@ -126,7 +126,9 @@ process.env.NODE_ENV !== "production" ? Backdrop.propTypes
126
126
  * The props used for each slot inside the Backdrop.
127
127
  * @default {}
128
128
  */
129
- componentsProps: PropTypes.object,
129
+ componentsProps: PropTypes.shape({
130
+ root: PropTypes.object
131
+ }),
130
132
 
131
133
  /**
132
134
  * If `true`, the backdrop is invisible.
package/Badge/Badge.js CHANGED
@@ -5,10 +5,11 @@ import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import clsx from 'clsx';
7
7
  import { usePreviousProps } from '@mui/utils';
8
- import { generateUtilityClasses, isHostComponent } from '@mui/base';
8
+ import { generateUtilityClasses } from '@mui/base';
9
9
  import BadgeUnstyled, { badgeUnstyledClasses, getBadgeUtilityClass } from '@mui/base/BadgeUnstyled';
10
10
  import styled from '../styles/styled';
11
11
  import useThemeProps from '../styles/useThemeProps';
12
+ import shouldSpreadAdditionalProps from '../utils/shouldSpreadAdditionalProps';
12
13
  import capitalize from '../utils/capitalize';
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  export const badgeClasses = _extends({}, badgeUnstyledClasses, generateUtilityClasses('MuiBadge', ['colorError', 'colorInfo', 'colorPrimary', 'colorSecondary', 'colorSuccess', 'colorWarning', 'overlapRectangular', 'overlapCircular', // TODO: v6 remove the overlap value from these class keys
@@ -152,11 +153,6 @@ const BadgeBadge = styled('span', {
152
153
  duration: theme.transitions.duration.leavingScreen
153
154
  })
154
155
  }));
155
-
156
- const shouldSpreadAdditionalProps = Slot => {
157
- return !Slot || !isHostComponent(Slot);
158
- };
159
-
160
156
  const Badge = /*#__PURE__*/React.forwardRef(function Badge(inProps, ref) {
161
157
  var _componentsProps$root, _componentsProps$badg;
162
158
 
@@ -300,7 +296,10 @@ process.env.NODE_ENV !== "production" ? Badge.propTypes
300
296
  * The props used for each slot inside the Badge.
301
297
  * @default {}
302
298
  */
303
- componentsProps: PropTypes.object,
299
+ componentsProps: PropTypes.shape({
300
+ badge: PropTypes.object,
301
+ root: PropTypes.object
302
+ }),
304
303
 
305
304
  /**
306
305
  * If `true`, the badge is invisible.
@@ -6,9 +6,7 @@ import styled from '../styles/styled';
6
6
  import MoreHorizIcon from '../internal/svg-icons/MoreHoriz';
7
7
  import ButtonBase from '../ButtonBase';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- const BreadcrumbCollapsedButton = styled(ButtonBase, {
10
- skipSx: true
11
- })(({
9
+ const BreadcrumbCollapsedButton = styled(ButtonBase)(({
12
10
  theme
13
11
  }) => _extends({
14
12
  display: 'flex',
@@ -47,7 +47,7 @@ export interface ButtonClasses {
47
47
  outlinedSizeLarge: string;
48
48
  /** Styles applied to the root element if `size="small"` and `variant="contained"`. */
49
49
  containedSizeSmall: string;
50
- /** Styles applied to the root element if `size="small"` and `variant="contained"`. */
50
+ /** Styles applied to the root element if `size="medium"` and `variant="contained"`. */
51
51
  containedSizeMedium: string;
52
52
  /** Styles applied to the root element if `size="large"` and `variant="contained"`. */
53
53
  containedSizeLarge: string;
@@ -55,8 +55,7 @@ const pulsateKeyframe = keyframes(_t3 || (_t3 = _`
55
55
  `));
56
56
  export const TouchRippleRoot = styled('span', {
57
57
  name: 'MuiTouchRipple',
58
- slot: 'Root',
59
- skipSx: true
58
+ slot: 'Root'
60
59
  })({
61
60
  overflow: 'hidden',
62
61
  pointerEvents: 'none',