@mui/material 7.3.5 → 7.3.7

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 (105) hide show
  1. package/Accordion/Accordion.d.ts +56 -55
  2. package/Accordion/Accordion.js +3 -13
  3. package/Alert/Alert.js +1 -1
  4. package/AppBar/AppBar.d.ts +13 -2
  5. package/AppBar/AppBar.js +14 -2
  6. package/Backdrop/Backdrop.js +0 -1
  7. package/Button/Button.d.ts +1 -0
  8. package/ButtonBase/ButtonBase.js +8 -1
  9. package/ButtonBase/TouchRipple.js +1 -1
  10. package/ButtonGroup/ButtonGroup.js +8 -11
  11. package/CHANGELOG.md +144 -1
  12. package/CardActionArea/CardActionArea.js +0 -1
  13. package/Chip/Chip.js +1 -1
  14. package/CssBaseline/CssBaseline.d.ts +1 -1
  15. package/CssBaseline/CssBaseline.js +1 -1
  16. package/Dialog/Dialog.js +4 -3
  17. package/Dialog/dialogClasses.d.ts +2 -0
  18. package/Dialog/dialogClasses.js +1 -1
  19. package/FormControl/FormControl.d.ts +1 -0
  20. package/FormHelperText/FormHelperText.d.ts +1 -0
  21. package/FormLabel/FormLabel.d.ts +1 -0
  22. package/IconButton/IconButton.d.ts +1 -0
  23. package/InputLabel/InputLabel.d.ts +1 -0
  24. package/ListItem/ListItem.d.ts +5 -0
  25. package/ListItem/ListItem.js +19 -4
  26. package/MenuList/MenuList.js +2 -1
  27. package/Modal/ModalManager.js +1 -1
  28. package/OutlinedInput/OutlinedInput.d.ts +1 -0
  29. package/README.md +2 -2
  30. package/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
  31. package/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
  32. package/Select/SelectInput.d.ts +2 -0
  33. package/Select/SelectInput.js +25 -4
  34. package/Slider/Slider.d.ts +1 -1
  35. package/Slider/useSlider.types.d.ts +1 -1
  36. package/Snackbar/Snackbar.js +1 -3
  37. package/Tabs/Tabs.d.ts +1 -1
  38. package/Tabs/Tabs.js +4 -3
  39. package/TextField/TextField.d.ts +10 -5
  40. package/Unstable_TrapFocus/FocusTrap.js +13 -8
  41. package/esm/Accordion/Accordion.d.ts +56 -55
  42. package/esm/Accordion/Accordion.js +3 -13
  43. package/esm/Alert/Alert.js +1 -1
  44. package/esm/AppBar/AppBar.d.ts +13 -2
  45. package/esm/AppBar/AppBar.js +14 -2
  46. package/esm/Backdrop/Backdrop.js +0 -1
  47. package/esm/Button/Button.d.ts +1 -0
  48. package/esm/ButtonBase/ButtonBase.js +8 -1
  49. package/esm/ButtonBase/TouchRipple.js +1 -1
  50. package/esm/ButtonGroup/ButtonGroup.js +8 -11
  51. package/esm/CardActionArea/CardActionArea.js +0 -1
  52. package/esm/Chip/Chip.js +1 -1
  53. package/esm/CssBaseline/CssBaseline.d.ts +1 -1
  54. package/esm/CssBaseline/CssBaseline.js +1 -1
  55. package/esm/Dialog/Dialog.js +4 -3
  56. package/esm/Dialog/dialogClasses.d.ts +2 -0
  57. package/esm/Dialog/dialogClasses.js +1 -1
  58. package/esm/FormControl/FormControl.d.ts +1 -0
  59. package/esm/FormHelperText/FormHelperText.d.ts +1 -0
  60. package/esm/FormLabel/FormLabel.d.ts +1 -0
  61. package/esm/IconButton/IconButton.d.ts +1 -0
  62. package/esm/InputLabel/InputLabel.d.ts +1 -0
  63. package/esm/ListItem/ListItem.d.ts +5 -0
  64. package/esm/ListItem/ListItem.js +19 -4
  65. package/esm/MenuList/MenuList.js +2 -1
  66. package/esm/Modal/ModalManager.js +1 -1
  67. package/esm/OutlinedInput/OutlinedInput.d.ts +1 -0
  68. package/esm/ScopedCssBaseline/ScopedCssBaseline.d.ts +1 -1
  69. package/esm/ScopedCssBaseline/ScopedCssBaseline.js +1 -1
  70. package/esm/Select/SelectInput.d.ts +2 -0
  71. package/esm/Select/SelectInput.js +25 -4
  72. package/esm/Slider/Slider.d.ts +1 -1
  73. package/esm/Slider/useSlider.types.d.ts +1 -1
  74. package/esm/Snackbar/Snackbar.js +1 -3
  75. package/esm/Tabs/Tabs.d.ts +1 -1
  76. package/esm/Tabs/Tabs.js +4 -3
  77. package/esm/TextField/TextField.d.ts +10 -5
  78. package/esm/Unstable_TrapFocus/FocusTrap.js +13 -8
  79. package/esm/index.js +1 -1
  80. package/esm/internal/SwitchBase.js +1 -1
  81. package/esm/locale/arEG.js +1 -1
  82. package/esm/locale/arSA.js +1 -1
  83. package/esm/locale/arSD.js +1 -1
  84. package/esm/locale/kuCKB.js +1 -1
  85. package/esm/locale/neNP.js +1 -1
  86. package/esm/styles/createThemeNoVars.d.ts +4 -3
  87. package/esm/styles/createThemeWithVars.d.ts +2 -2
  88. package/esm/useAutocomplete/useAutocomplete.js +62 -16
  89. package/esm/utils/getActiveElement.d.ts +2 -0
  90. package/esm/utils/getActiveElement.js +2 -0
  91. package/esm/version/index.js +2 -2
  92. package/index.js +1 -1
  93. package/internal/SwitchBase.js +1 -1
  94. package/locale/arEG.js +1 -1
  95. package/locale/arSA.js +1 -1
  96. package/locale/arSD.js +1 -1
  97. package/locale/kuCKB.js +1 -1
  98. package/locale/neNP.js +1 -1
  99. package/package.json +8 -8
  100. package/styles/createThemeNoVars.d.ts +4 -3
  101. package/styles/createThemeWithVars.d.ts +2 -2
  102. package/useAutocomplete/useAutocomplete.js +62 -16
  103. package/utils/getActiveElement.d.ts +2 -0
  104. package/utils/getActiveElement.js +9 -0
  105. package/version/index.js +2 -2
@@ -18,6 +18,12 @@ export interface AppBarOwnProps {
18
18
  * @default 'primary'
19
19
  */
20
20
  color?: OverridableStringUnion<PropTypes.Color | 'transparent' | 'error' | 'info' | 'success' | 'warning', AppBarPropsColorOverrides>;
21
+ /**
22
+ * Shadow depth, corresponds to `dp` in the spec.
23
+ * It accepts values between 0 and 24 inclusive.
24
+ * @default 4
25
+ */
26
+ elevation?: number;
21
27
  /**
22
28
  * If true, the `color` prop is applied in dark mode.
23
29
  * @default false
@@ -25,11 +31,16 @@ export interface AppBarOwnProps {
25
31
  enableColorOnDark?: boolean;
26
32
  /**
27
33
  * The positioning type. The behavior of the different options is described
28
- * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
34
+ * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/position).
29
35
  * Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
30
36
  * @default 'fixed'
31
37
  */
32
38
  position?: 'fixed' | 'absolute' | 'sticky' | 'static' | 'relative';
39
+ /**
40
+ * If `false`, rounded corners are enabled.
41
+ * @default true
42
+ */
43
+ square?: boolean;
33
44
  /**
34
45
  * The system prop that allows defining system overrides as well as additional CSS styles.
35
46
  */
@@ -38,7 +49,7 @@ export interface AppBarOwnProps {
38
49
  export type AppBarTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'header'> = ExtendPaperTypeMap<{
39
50
  props: AdditionalProps & AppBarOwnProps;
40
51
  defaultComponent: RootComponent;
41
- }, 'position' | 'color' | 'classes'>;
52
+ }, 'position' | 'color' | 'classes' | 'elevation' | 'square'>;
42
53
 
43
54
  /**
44
55
  *
@@ -101,7 +101,8 @@ const AppBarRoot = styled(Paper, {
101
101
  color: 'inherit'
102
102
  },
103
103
  style: {
104
- '--AppBar-color': 'inherit'
104
+ '--AppBar-color': 'inherit',
105
+ color: 'var(--AppBar-color)'
105
106
  }
106
107
  }, {
107
108
  props: {
@@ -207,6 +208,12 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
207
208
  * @default 'primary'
208
209
  */
209
210
  color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['default', 'inherit', 'primary', 'secondary', 'transparent', 'error', 'info', 'success', 'warning']), PropTypes.string]),
211
+ /**
212
+ * Shadow depth, corresponds to `dp` in the spec.
213
+ * It accepts values between 0 and 24 inclusive.
214
+ * @default 4
215
+ */
216
+ elevation: PropTypes.number,
210
217
  /**
211
218
  * If true, the `color` prop is applied in dark mode.
212
219
  * @default false
@@ -214,11 +221,16 @@ process.env.NODE_ENV !== "production" ? AppBar.propTypes /* remove-proptypes */
214
221
  enableColorOnDark: PropTypes.bool,
215
222
  /**
216
223
  * The positioning type. The behavior of the different options is described
217
- * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/position).
224
+ * [in the MDN web docs](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/position).
218
225
  * Note: `sticky` is not universally supported and will fall back to `static` when unavailable.
219
226
  * @default 'fixed'
220
227
  */
221
228
  position: PropTypes.oneOf(['absolute', 'fixed', 'relative', 'static', 'sticky']),
229
+ /**
230
+ * If `false`, rounded corners are enabled.
231
+ * @default true
232
+ */
233
+ square: PropTypes.bool,
222
234
  /**
223
235
  * The system prop that allows defining system overrides as well as additional CSS styles.
224
236
  */
@@ -107,7 +107,6 @@ const Backdrop = /*#__PURE__*/React.forwardRef(function Backdrop(inProps, ref) {
107
107
  children: /*#__PURE__*/_jsx(RootSlot, {
108
108
  "aria-hidden": true,
109
109
  ...rootProps,
110
- classes: classes,
111
110
  ref: ref,
112
111
  children: children
113
112
  })
@@ -117,6 +117,7 @@ export type ExtendButton<TypeMap extends OverridableTypeMap> = ((props: {
117
117
  *
118
118
  * - [Button Group](https://mui.com/material-ui/react-button-group/)
119
119
  * - [Button](https://mui.com/material-ui/react-button/)
120
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
120
121
  *
121
122
  * API:
122
123
  *
@@ -222,7 +222,10 @@ const ButtonBase = /*#__PURE__*/React.forwardRef(function ButtonBase(inProps, re
222
222
  }
223
223
  const buttonProps = {};
224
224
  if (ComponentProp === 'button') {
225
- buttonProps.type = type === undefined ? 'button' : type;
225
+ const hasFormAttributes = !!other.formAction;
226
+ // ButtonBase was defaulting to type="button" when no type prop was provided, which prevented form submission and broke formAction functionality.
227
+ // The fix checks for form-related attributes and skips the default type to allow the browser's natural submit behavior (type="submit").
228
+ buttonProps.type = type === undefined && !hasFormAttributes ? 'button' : type;
226
229
  buttonProps.disabled = disabled;
227
230
  } else {
228
231
  if (!other.href && !other.to) {
@@ -350,6 +353,10 @@ process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes
350
353
  * if needed.
351
354
  */
352
355
  focusVisibleClassName: PropTypes.string,
356
+ /**
357
+ * @ignore
358
+ */
359
+ formAction: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
353
360
  /**
354
361
  * @ignore
355
362
  */
@@ -228,7 +228,7 @@ const TouchRipple = /*#__PURE__*/React.forwardRef(function TouchRipple(inProps,
228
228
  rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
229
229
  }
230
230
 
231
- // Touche devices
231
+ // Touch devices
232
232
  if (event?.touches) {
233
233
  // check that this isn't another touchstart due to multitouch
234
234
  // otherwise we will only clear a single timer when unmounting while two
@@ -69,7 +69,13 @@ const ButtonGroupRoot = styled('div', {
69
69
  variant: 'contained'
70
70
  },
71
71
  style: {
72
- boxShadow: (theme.vars || theme).shadows[2]
72
+ boxShadow: (theme.vars || theme).shadows[2],
73
+ [`& .${buttonGroupClasses.grouped}`]: {
74
+ boxShadow: 'none',
75
+ '&:hover': {
76
+ boxShadow: 'none'
77
+ }
78
+ }
73
79
  }
74
80
  }, {
75
81
  props: {
@@ -220,16 +226,7 @@ const ButtonGroupRoot = styled('div', {
220
226
  }
221
227
  }))],
222
228
  [`& .${buttonGroupClasses.grouped}`]: {
223
- minWidth: 40,
224
- boxShadow: 'none',
225
- props: {
226
- variant: 'contained'
227
- },
228
- style: {
229
- '&:hover': {
230
- boxShadow: 'none'
231
- }
232
- }
229
+ minWidth: 40
233
230
  }
234
231
  })));
235
232
  const ButtonGroup = /*#__PURE__*/React.forwardRef(function ButtonGroup(inProps, ref) {
@@ -99,7 +99,6 @@ const CardActionArea = /*#__PURE__*/React.forwardRef(function CardActionArea(inP
99
99
  elementType: CardActionAreaFocusHighlight,
100
100
  externalForwardedProps,
101
101
  ownerState,
102
- ref,
103
102
  className: classes.focusHighlight
104
103
  });
105
104
  return /*#__PURE__*/_jsxs(RootSlot, {
package/esm/Chip/Chip.js CHANGED
@@ -71,7 +71,7 @@ const ChipRoot = styled('div', {
71
71
  [`& .${chipClasses.deleteIcon}`]: styles[`deleteIconColor${capitalize(color)}`]
72
72
  }, {
73
73
  [`& .${chipClasses.deleteIcon}`]: styles[`deleteIcon${capitalize(variant)}Color${capitalize(color)}`]
74
- }, styles.root, styles[`size${capitalize(size)}`], styles[`color${capitalize(color)}`], clickable && styles.clickable, clickable && color !== 'default' && styles[`clickableColor${capitalize(color)})`], onDelete && styles.deletable, onDelete && color !== 'default' && styles[`deletableColor${capitalize(color)}`], styles[variant], styles[`${variant}${capitalize(color)}`]];
74
+ }, styles.root, styles[`size${capitalize(size)}`], styles[`color${capitalize(color)}`], clickable && styles.clickable, clickable && color !== 'default' && styles[`clickableColor${capitalize(color)}`], onDelete && styles.deletable, onDelete && color !== 'default' && styles[`deletableColor${capitalize(color)}`], styles[variant], styles[`${variant}${capitalize(color)}`]];
75
75
  }
76
76
  })(memoTheme(({
77
77
  theme
@@ -7,7 +7,7 @@ export interface CssBaselineProps extends StyledComponentProps<never> {
7
7
  children?: React.ReactNode;
8
8
  /**
9
9
  * Enable `color-scheme` CSS property to use `theme.palette.mode`.
10
- * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
10
+ * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
11
11
  * For browser support, check out https://caniuse.com/?search=color-scheme
12
12
  * @default false
13
13
  */
@@ -152,7 +152,7 @@ process.env.NODE_ENV !== "production" ? CssBaseline.propTypes /* remove-proptype
152
152
  children: PropTypes.node,
153
153
  /**
154
154
  * Enable `color-scheme` CSS property to use `theme.palette.mode`.
155
- * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
155
+ * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
156
156
  * For browser support, check out https://caniuse.com/?search=color-scheme
157
157
  * @default false
158
158
  */
@@ -19,8 +19,7 @@ import useSlot from "../utils/useSlot.js";
19
19
  import { jsx as _jsx } from "react/jsx-runtime";
20
20
  const DialogBackdrop = styled(Backdrop, {
21
21
  name: 'MuiDialog',
22
- slot: 'Backdrop',
23
- overrides: (props, styles) => styles.backdrop
22
+ slot: 'Backdrop'
24
23
  })({
25
24
  // Improve scrollable dialog support.
26
25
  zIndex: -1
@@ -35,6 +34,7 @@ const useUtilityClasses = ownerState => {
35
34
  } = ownerState;
36
35
  const slots = {
37
36
  root: ['root'],
37
+ backdrop: ['backdrop'],
38
38
  container: ['container', `scroll${capitalize(scroll)}`],
39
39
  paper: ['paper', `paperScroll${capitalize(scroll)}`, `paperWidth${capitalize(String(maxWidth))}`, fullWidth && 'paperFullWidth', fullScreen && 'paperFullScreen']
40
40
  };
@@ -285,7 +285,8 @@ const Dialog = /*#__PURE__*/React.forwardRef(function Dialog(inProps, ref) {
285
285
  elementType: DialogBackdrop,
286
286
  shouldForwardComponentProp: true,
287
287
  externalForwardedProps,
288
- ownerState
288
+ ownerState,
289
+ className: classes.backdrop
289
290
  });
290
291
  const [PaperSlot, paperSlotProps] = useSlot('paper', {
291
292
  elementType: DialogPaper,
@@ -1,6 +1,8 @@
1
1
  export interface DialogClasses {
2
2
  /** Styles applied to the root element. */
3
3
  root: string;
4
+ /** Styles applied to the backdrop element. */
5
+ backdrop: string;
4
6
  /** Styles applied to the container element if `scroll="paper"`. */
5
7
  scrollPaper: string;
6
8
  /** Styles applied to the container element if `scroll="body"`. */
@@ -3,5 +3,5 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
3
  export function getDialogUtilityClass(slot) {
4
4
  return generateUtilityClass('MuiDialog', slot);
5
5
  }
6
- const dialogClasses = generateUtilityClasses('MuiDialog', ['root', 'scrollPaper', 'scrollBody', 'container', 'paper', 'paperScrollPaper', 'paperScrollBody', 'paperWidthFalse', 'paperWidthXs', 'paperWidthSm', 'paperWidthMd', 'paperWidthLg', 'paperWidthXl', 'paperFullWidth', 'paperFullScreen']);
6
+ const dialogClasses = generateUtilityClasses('MuiDialog', ['root', 'backdrop', 'scrollPaper', 'scrollBody', 'container', 'paper', 'paperScrollPaper', 'paperScrollBody', 'paperWidthFalse', 'paperWidthXs', 'paperWidthSm', 'paperWidthMd', 'paperWidthLg', 'paperWidthXl', 'paperFullWidth', 'paperFullScreen']);
7
7
  export default dialogClasses;
@@ -105,6 +105,7 @@ export interface FormControlTypeMap<AdditionalProps = {}, RootComponent extends
105
105
  * Demos:
106
106
  *
107
107
  * - [Checkbox](https://mui.com/material-ui/react-checkbox/)
108
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
108
109
  * - [Radio Group](https://mui.com/material-ui/react-radio-button/)
109
110
  * - [Switch](https://mui.com/material-ui/react-switch/)
110
111
  * - [Text Field](https://mui.com/material-ui/react-text-field/)
@@ -58,6 +58,7 @@ export interface FormHelperTextTypeMap<AdditionalProps = {}, RootComponent exten
58
58
  *
59
59
  * Demos:
60
60
  *
61
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
61
62
  * - [Text Field](https://mui.com/material-ui/react-text-field/)
62
63
  *
63
64
  * API:
@@ -60,6 +60,7 @@ export interface FormLabelTypeMap<AdditionalProps = {}, RootComponent extends Re
60
60
  * Demos:
61
61
  *
62
62
  * - [Checkbox](https://mui.com/material-ui/react-checkbox/)
63
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
63
64
  * - [Radio Group](https://mui.com/material-ui/react-radio-button/)
64
65
  * - [Switch](https://mui.com/material-ui/react-switch/)
65
66
  *
@@ -77,6 +77,7 @@ export type IconButtonTypeMap<AdditionalProps = {}, RootComponent extends React.
77
77
  * Demos:
78
78
  *
79
79
  * - [Button](https://mui.com/material-ui/react-button/)
80
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
80
81
  *
81
82
  * API:
82
83
  *
@@ -65,6 +65,7 @@ export type InputLabelTypeMap<AdditionalProps = {}, RootComponent extends React.
65
65
  *
66
66
  * Demos:
67
67
  *
68
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
68
69
  * - [Text Field](https://mui.com/material-ui/react-text-field/)
69
70
  *
70
71
  * API:
@@ -3,7 +3,9 @@ import { SxProps } from '@mui/system';
3
3
  import { Theme } from "../styles/index.js";
4
4
  import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.js";
5
5
  import { ListItemClasses } from "./listItemClasses.js";
6
+ import { SlotProps } from "../utils/types.js";
6
7
  export interface ListItemComponentsPropsOverrides {}
8
+ export interface ListItemSecondaryActionSlotPropsOverrides {}
7
9
 
8
10
  /**
9
11
  * This type is kept for compatibility. Use `ListItemOwnProps` instead.
@@ -65,6 +67,7 @@ export interface ListItemBaseProps {
65
67
  */
66
68
  sx?: SxProps<Theme>;
67
69
  }
70
+ export interface ListItemOwnerState extends Omit<ListItemProps, 'slots' | 'slotProps'> {}
68
71
  export interface ListItemOwnProps extends ListItemBaseProps {
69
72
  /**
70
73
  * The components used for each slot inside.
@@ -93,6 +96,7 @@ export interface ListItemOwnProps extends ListItemBaseProps {
93
96
  */
94
97
  slotProps?: {
95
98
  root?: React.HTMLAttributes<HTMLDivElement> & ListItemComponentsPropsOverrides;
99
+ secondaryAction?: SlotProps<React.ElementType<React.HTMLAttributes<HTMLDivElement>>, ListItemSecondaryActionSlotPropsOverrides, ListItemOwnerState>;
96
100
  };
97
101
  /**
98
102
  * The components used for each slot inside.
@@ -101,6 +105,7 @@ export interface ListItemOwnProps extends ListItemBaseProps {
101
105
  */
102
106
  slots?: {
103
107
  root?: React.ElementType;
108
+ secondaryAction?: React.ElementType;
104
109
  };
105
110
  }
106
111
  export interface ListItemTypeMap<AdditionalProps, RootComponent extends React.ElementType> {
@@ -12,6 +12,7 @@ import memoTheme from "../utils/memoTheme.js";
12
12
  import { useDefaultProps } from "../DefaultPropsProvider/index.js";
13
13
  import isMuiElement from "../utils/isMuiElement.js";
14
14
  import useForkRef from "../utils/useForkRef.js";
15
+ import useSlot from "../utils/useSlot.js";
15
16
  import ListContext from "../List/ListContext.js";
16
17
  import { getListItemUtilityClass } from "./listItemClasses.js";
17
18
  import { listItemButtonClasses } from "../ListItemButton/index.js";
@@ -35,7 +36,8 @@ const useUtilityClasses = ownerState => {
35
36
  } = ownerState;
36
37
  const slots = {
37
38
  root: ['root', dense && 'dense', !disableGutters && 'gutters', !disablePadding && 'padding', divider && 'divider', alignItems === 'flex-start' && 'alignItemsFlexStart', hasSecondaryAction && 'secondaryAction'],
38
- container: ['container']
39
+ container: ['container'],
40
+ secondaryAction: ['secondaryAction']
39
41
  };
40
42
  return composeClasses(slots, getListItemUtilityClass, classes);
41
43
  };
@@ -197,6 +199,16 @@ const ListItem = /*#__PURE__*/React.forwardRef(function ListItem(inProps, ref) {
197
199
  };
198
200
  const classes = useUtilityClasses(ownerState);
199
201
  const handleRef = useForkRef(listItemRef, ref);
202
+ const externalForwardedProps = {
203
+ slots,
204
+ slotProps
205
+ };
206
+ const [SecondaryActionSlot, secondaryActionSlotProps] = useSlot('secondaryAction', {
207
+ elementType: ListItemSecondaryAction,
208
+ externalForwardedProps,
209
+ ownerState,
210
+ className: classes.secondaryAction
211
+ });
200
212
  const Root = slots.root || components.Root || ListItemRoot;
201
213
  const rootProps = slotProps.root || componentsProps.root || {};
202
214
  const componentProps = {
@@ -254,7 +266,8 @@ const ListItem = /*#__PURE__*/React.forwardRef(function ListItem(inProps, ref) {
254
266
  }
255
267
  }),
256
268
  ...componentProps,
257
- children: [children, secondaryAction && /*#__PURE__*/_jsx(ListItemSecondaryAction, {
269
+ children: [children, secondaryAction && /*#__PURE__*/_jsx(SecondaryActionSlot, {
270
+ ...secondaryActionSlotProps,
258
271
  children: secondaryAction
259
272
  })]
260
273
  })
@@ -369,7 +382,8 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
369
382
  * @default {}
370
383
  */
371
384
  slotProps: PropTypes.shape({
372
- root: PropTypes.object
385
+ root: PropTypes.object,
386
+ secondaryAction: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
373
387
  }),
374
388
  /**
375
389
  * The components used for each slot inside.
@@ -377,7 +391,8 @@ process.env.NODE_ENV !== "production" ? ListItem.propTypes /* remove-proptypes *
377
391
  * @default {}
378
392
  */
379
393
  slots: PropTypes.shape({
380
- root: PropTypes.elementType
394
+ root: PropTypes.elementType,
395
+ secondaryAction: PropTypes.elementType
381
396
  }),
382
397
  /**
383
398
  * The system prop that allows defining system overrides as well as additional CSS styles.
@@ -5,6 +5,7 @@ import { isFragment } from 'react-is';
5
5
  import PropTypes from 'prop-types';
6
6
  import ownerDocument from "../utils/ownerDocument.js";
7
7
  import List from "../List/index.js";
8
+ import getActiveElement from "../utils/getActiveElement.js";
8
9
  import getScrollbarSize from "../utils/getScrollbarSize.js";
9
10
  import useForkRef from "../utils/useForkRef.js";
10
11
  import useEnhancedEffect from "../utils/useEnhancedEffect.js";
@@ -136,7 +137,7 @@ const MenuList = /*#__PURE__*/React.forwardRef(function MenuList(props, ref) {
136
137
  * or document.body or document.documentElement. Only the first case will
137
138
  * trigger this specific handler.
138
139
  */
139
- const currentFocus = ownerDocument(list).activeElement;
140
+ const currentFocus = getActiveElement(ownerDocument(list));
140
141
  if (key === 'ArrowDown') {
141
142
  // Prevent scroll of the page
142
143
  event.preventDefault();
@@ -17,7 +17,7 @@ export function ariaHidden(element, hide) {
17
17
  }
18
18
  }
19
19
  function getPaddingRight(element) {
20
- return parseInt(ownerWindow(element).getComputedStyle(element).paddingRight, 10) || 0;
20
+ return parseFloat(ownerWindow(element).getComputedStyle(element).paddingRight) || 0;
21
21
  }
22
22
  function isAriaHiddenForbiddenOnElement(element) {
23
23
  // The forbidden HTML tags are the ones from ARIA specification that
@@ -43,6 +43,7 @@ export interface OutlinedInputOwnerState extends Omit<OutlinedInputProps, 'slots
43
43
  *
44
44
  * Demos:
45
45
  *
46
+ * - [Number Field](https://mui.com/material-ui/react-number-field/)
46
47
  * - [Text Field](https://mui.com/material-ui/react-text-field/)
47
48
  *
48
49
  * API:
@@ -14,7 +14,7 @@ export interface ScopedCssBaselineOwnProps {
14
14
  classes?: Partial<ScopedCssBaselineClasses>;
15
15
  /**
16
16
  * Enable `color-scheme` CSS property to use `theme.palette.mode`.
17
- * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
17
+ * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
18
18
  * For browser support, check out https://caniuse.com/?search=color-scheme
19
19
  */
20
20
  enableColorScheme?: boolean;
@@ -107,7 +107,7 @@ process.env.NODE_ENV !== "production" ? ScopedCssBaseline.propTypes /* remove-pr
107
107
  component: PropTypes.elementType,
108
108
  /**
109
109
  * Enable `color-scheme` CSS property to use `theme.palette.mode`.
110
- * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/color-scheme
110
+ * For more details, check out https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/color-scheme
111
111
  * For browser support, check out https://caniuse.com/?search=color-scheme
112
112
  */
113
113
  enableColorScheme: PropTypes.bool,
@@ -41,6 +41,8 @@ export interface SelectInputProps<Value = unknown> {
41
41
  onChange?: (event: SelectChangeEvent<Value>, child: React.ReactNode) => void;
42
42
  onClose?: (event: React.SyntheticEvent) => void;
43
43
  onFocus?: React.FocusEventHandler<any>;
44
+ onKeyDown?: React.KeyboardEventHandler;
45
+ onMouseDown?: React.MouseEventHandler;
44
46
  onOpen?: (event: React.SyntheticEvent) => void;
45
47
  open?: boolean;
46
48
  readOnly?: boolean;
@@ -128,6 +128,10 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
128
128
  onChange,
129
129
  onClose,
130
130
  onFocus,
131
+ // eslint-disable-next-line react/prop-types
132
+ onKeyDown,
133
+ // eslint-disable-next-line react/prop-types
134
+ onMouseDown,
131
135
  onOpen,
132
136
  open: openProp,
133
137
  readOnly,
@@ -173,6 +177,22 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
173
177
  node: inputRef.current,
174
178
  value
175
179
  }), [value]);
180
+ const open = displayNode !== null && openState;
181
+ React.useEffect(() => {
182
+ if (!open || !anchorElement || autoWidth) {
183
+ return undefined;
184
+ }
185
+ if (typeof ResizeObserver === 'undefined') {
186
+ return undefined;
187
+ }
188
+ const observer = new ResizeObserver(() => {
189
+ setMenuMinWidthState(anchorElement.clientWidth);
190
+ });
191
+ observer.observe(anchorElement);
192
+ return () => {
193
+ observer.disconnect();
194
+ };
195
+ }, [open, anchorElement, autoWidth]);
176
196
 
177
197
  // Resize menu on `defaultOpen` automatic toggle.
178
198
  React.useEffect(() => {
@@ -208,8 +228,8 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
208
228
  }
209
229
  return undefined;
210
230
  }, [labelId]);
211
- const update = (open, event) => {
212
- if (open) {
231
+ const update = (openParam, event) => {
232
+ if (openParam) {
213
233
  if (onOpen) {
214
234
  onOpen(event);
215
235
  }
@@ -218,10 +238,11 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
218
238
  }
219
239
  if (!isOpenControlled) {
220
240
  setMenuMinWidthState(autoWidth ? null : anchorElement.clientWidth);
221
- setOpenState(open);
241
+ setOpenState(openParam);
222
242
  }
223
243
  };
224
244
  const handleMouseDown = event => {
245
+ onMouseDown?.(event);
225
246
  // Ignore everything but left-click
226
247
  if (event.button !== 0) {
227
248
  return;
@@ -301,9 +322,9 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
301
322
  event.preventDefault();
302
323
  update(true, event);
303
324
  }
325
+ onKeyDown?.(event);
304
326
  }
305
327
  };
306
- const open = displayNode !== null && openState;
307
328
  const handleBlur = event => {
308
329
  // if open event.stopImmediatePropagation
309
330
  if (!open && onBlur) {
@@ -113,7 +113,7 @@ export interface SliderOwnProps<Value extends number | number[]> {
113
113
  * If an array, it should contain objects with `value` and an optional `label` keys.
114
114
  * @default false
115
115
  */
116
- marks?: boolean | Mark[];
116
+ marks?: boolean | readonly Mark[];
117
117
  /**
118
118
  * The maximum allowed value of the slider.
119
119
  * Should not be equal to min.
@@ -198,7 +198,7 @@ export interface UseSliderReturnValue {
198
198
  /**
199
199
  * The marks of the slider. Marks indicate predetermined values to which the user can move the slider.
200
200
  */
201
- marks: Mark[];
201
+ marks: readonly Mark[];
202
202
  /**
203
203
  * The thumb index for the current value when in hover state.
204
204
  */
@@ -157,9 +157,7 @@ const Snackbar = /*#__PURE__*/React.forwardRef(function Snackbar(inProps, ref) {
157
157
  const {
158
158
  getRootProps,
159
159
  onClickAway
160
- } = useSnackbar({
161
- ...ownerState
162
- });
160
+ } = useSnackbar(ownerState);
163
161
  const [exited, setExited] = React.useState(true);
164
162
  const handleExited = node => {
165
163
  setExited(true);
@@ -87,7 +87,7 @@ export type TabsSlotsAndSlotProps = CreateSlotsAndSlotProps<TabsSlots, {
87
87
  */
88
88
  indicator: SlotProps<'span', TabsIndicatorSlotPropsOverrides, TabsOwnerState>;
89
89
  /**
90
- * Props forwarded to the scrollButton slot.
90
+ * Props forwarded to the scrollButtons slot.
91
91
  * By default, the available props are based on the [TabScrollButton](https://mui.com/material-ui/api/tab-scroll-button/#props) component.
92
92
  */
93
93
  scrollButtons: SlotProps<typeof TabScrollButton, TabsScrollButtonsSlotPropsOverrides, TabsOwnerState>;
package/esm/Tabs/Tabs.js CHANGED
@@ -19,6 +19,7 @@ import useEventCallback from "../utils/useEventCallback.js";
19
19
  import tabsClasses, { getTabsUtilityClass } from "./tabsClasses.js";
20
20
  import ownerDocument from "../utils/ownerDocument.js";
21
21
  import ownerWindow from "../utils/ownerWindow.js";
22
+ import getActiveElement from "../utils/getActiveElement.js";
22
23
  import useSlot from "../utils/useSlot.js";
23
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
25
  const nextItem = (list, item) => {
@@ -344,7 +345,7 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
344
345
  slots,
345
346
  slotProps: {
346
347
  indicator: TabIndicatorProps,
347
- scrollButton: TabScrollButtonProps,
348
+ scrollButtons: TabScrollButtonProps,
348
349
  ...slotProps
349
350
  }
350
351
  };
@@ -697,11 +698,11 @@ const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(inProps, ref) {
697
698
  return;
698
699
  }
699
700
  const list = tabListRef.current;
700
- const currentFocus = ownerDocument(list).activeElement;
701
+ const currentFocus = getActiveElement(ownerDocument(list));
701
702
  // Keyboard navigation assumes that [role="tab"] are siblings
702
703
  // though we might warn in the future about nested, interactive elements
703
704
  // as a a11y violation
704
- const role = currentFocus.getAttribute('role');
705
+ const role = currentFocus?.getAttribute('role');
705
706
  if (role !== 'tab') {
706
707
  return;
707
708
  }