@mui/material 6.4.5 → 6.4.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 (80) hide show
  1. package/Accordion/Accordion.d.ts +14 -12
  2. package/Alert/Alert.d.ts +3 -15
  3. package/Backdrop/Backdrop.d.ts +14 -12
  4. package/CHANGELOG.md +58 -0
  5. package/CardHeader/CardHeader.d.ts +4 -20
  6. package/Checkbox/Checkbox.d.ts +45 -9
  7. package/Checkbox/Checkbox.js +51 -21
  8. package/Dialog/Dialog.d.ts +4 -4
  9. package/Drawer/Drawer.d.ts +92 -1
  10. package/Drawer/Drawer.js +108 -36
  11. package/InputBase/inputBaseClasses.d.ts +15 -6
  12. package/Menu/Menu.d.ts +88 -1
  13. package/Menu/Menu.js +58 -19
  14. package/Modal/Modal.js +9 -10
  15. package/Popover/Popover.d.ts +60 -6
  16. package/Popover/Popover.js +78 -51
  17. package/Radio/Radio.d.ts +45 -1
  18. package/Radio/Radio.js +61 -16
  19. package/Rating/Rating.d.ts +59 -1
  20. package/Rating/Rating.js +131 -45
  21. package/Select/SelectInput.js +8 -8
  22. package/Snackbar/Snackbar.d.ts +79 -2
  23. package/Snackbar/Snackbar.js +110 -32
  24. package/SpeedDial/SpeedDial.d.ts +8 -6
  25. package/SpeedDialAction/SpeedDialAction.d.ts +82 -1
  26. package/SpeedDialAction/SpeedDialAction.js +108 -30
  27. package/StepContent/StepContent.d.ts +2 -2
  28. package/SwipeableDrawer/SwipeableDrawer.d.ts +28 -2
  29. package/SwipeableDrawer/SwipeableDrawer.js +60 -13
  30. package/Switch/Switch.js +2 -0
  31. package/Tabs/Tabs.d.ts +129 -29
  32. package/Tabs/Tabs.js +120 -52
  33. package/Tabs/tabsClasses.d.ts +4 -0
  34. package/Tabs/tabsClasses.js +1 -1
  35. package/Tooltip/Tooltip.d.ts +20 -12
  36. package/index.js +1 -1
  37. package/internal/SwitchBase.d.ts +35 -1
  38. package/internal/SwitchBase.js +84 -30
  39. package/modern/Checkbox/Checkbox.js +51 -21
  40. package/modern/Drawer/Drawer.js +108 -36
  41. package/modern/Menu/Menu.js +58 -19
  42. package/modern/Modal/Modal.js +9 -10
  43. package/modern/Popover/Popover.js +78 -51
  44. package/modern/Radio/Radio.js +61 -16
  45. package/modern/Rating/Rating.js +131 -45
  46. package/modern/Select/SelectInput.js +8 -8
  47. package/modern/Snackbar/Snackbar.js +110 -32
  48. package/modern/SpeedDialAction/SpeedDialAction.js +108 -30
  49. package/modern/SwipeableDrawer/SwipeableDrawer.js +60 -13
  50. package/modern/Switch/Switch.js +2 -0
  51. package/modern/Tabs/Tabs.js +120 -52
  52. package/modern/Tabs/tabsClasses.js +1 -1
  53. package/modern/index.js +1 -1
  54. package/modern/internal/SwitchBase.js +84 -30
  55. package/modern/styles/createThemeNoVars.js +7 -2
  56. package/modern/version/index.js +2 -2
  57. package/node/Checkbox/Checkbox.js +51 -21
  58. package/node/Drawer/Drawer.js +108 -36
  59. package/node/Menu/Menu.js +58 -19
  60. package/node/Modal/Modal.js +9 -10
  61. package/node/Popover/Popover.js +78 -51
  62. package/node/Radio/Radio.js +61 -16
  63. package/node/Rating/Rating.js +132 -46
  64. package/node/Select/SelectInput.js +8 -8
  65. package/node/Snackbar/Snackbar.js +110 -32
  66. package/node/SpeedDialAction/SpeedDialAction.js +108 -30
  67. package/node/SwipeableDrawer/SwipeableDrawer.js +60 -13
  68. package/node/Switch/Switch.js +2 -0
  69. package/node/Tabs/Tabs.js +120 -52
  70. package/node/Tabs/tabsClasses.js +1 -1
  71. package/node/index.js +1 -1
  72. package/node/internal/SwitchBase.js +84 -30
  73. package/node/styles/createThemeNoVars.js +7 -2
  74. package/node/version/index.js +2 -2
  75. package/package.json +5 -5
  76. package/styles/ThemeProvider.d.ts +6 -0
  77. package/styles/ThemeProviderWithVars.d.ts +1 -0
  78. package/styles/createThemeNoVars.js +7 -2
  79. package/styles/index.d.ts +1 -0
  80. package/version/index.js +2 -2
@@ -9,7 +9,6 @@ Object.defineProperty(exports, "__esModule", {
9
9
  exports.default = void 0;
10
10
  var React = _interopRequireWildcard(require("react"));
11
11
  var _propTypes = _interopRequireDefault(require("prop-types"));
12
- var _clsx = _interopRequireDefault(require("clsx"));
13
12
  var _refType = _interopRequireDefault(require("@mui/utils/refType"));
14
13
  var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
15
14
  var _capitalize = _interopRequireDefault(require("../utils/capitalize"));
@@ -19,6 +18,7 @@ var _useControlled = _interopRequireDefault(require("../utils/useControlled"));
19
18
  var _useFormControl = _interopRequireDefault(require("../FormControl/useFormControl"));
20
19
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
21
20
  var _switchBaseClasses = require("./switchBaseClasses");
21
+ var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
  const useUtilityClasses = ownerState => {
24
24
  const {
@@ -93,7 +93,6 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
93
93
  autoFocus,
94
94
  checked: checkedProp,
95
95
  checkedIcon,
96
- className,
97
96
  defaultChecked,
98
97
  disabled: disabledProp,
99
98
  disableFocusRipple = false,
@@ -111,6 +110,8 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
111
110
  tabIndex,
112
111
  type,
113
112
  value,
113
+ slots = {},
114
+ slotProps = {},
114
115
  ...other
115
116
  } = props;
116
117
  const [checked, setCheckedState] = (0, _useControlled.default)({
@@ -163,38 +164,75 @@ const SwitchBase = /*#__PURE__*/React.forwardRef(function SwitchBase(props, ref)
163
164
  edge
164
165
  };
165
166
  const classes = useUtilityClasses(ownerState);
166
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(SwitchBaseRoot, {
167
- component: "span",
168
- className: (0, _clsx.default)(classes.root, className),
169
- centerRipple: true,
170
- focusRipple: !disableFocusRipple,
171
- disabled: disabled,
172
- tabIndex: null,
173
- role: undefined,
174
- onFocus: handleFocus,
175
- onBlur: handleBlur,
176
- ownerState: ownerState,
177
- ref: ref,
178
- ...other,
179
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SwitchBaseInput, {
180
- autoFocus: autoFocus,
167
+ const externalForwardedProps = {
168
+ slots,
169
+ slotProps: {
170
+ input: inputProps,
171
+ ...slotProps
172
+ }
173
+ };
174
+ const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
175
+ ref,
176
+ elementType: SwitchBaseRoot,
177
+ className: classes.root,
178
+ shouldForwardComponentProp: true,
179
+ externalForwardedProps: {
180
+ ...externalForwardedProps,
181
+ component: 'span',
182
+ ...other
183
+ },
184
+ getSlotProps: handlers => ({
185
+ ...handlers,
186
+ onFocus: event => {
187
+ handlers.onFocus?.(event);
188
+ handleFocus(event);
189
+ },
190
+ onBlur: event => {
191
+ handlers.onBlur?.(event);
192
+ handleBlur(event);
193
+ }
194
+ }),
195
+ ownerState,
196
+ additionalProps: {
197
+ centerRipple: true,
198
+ focusRipple: !disableFocusRipple,
199
+ disabled,
200
+ role: undefined,
201
+ tabIndex: null
202
+ }
203
+ });
204
+ const [InputSlot, inputSlotProps] = (0, _useSlot.default)('input', {
205
+ ref: inputRef,
206
+ elementType: SwitchBaseInput,
207
+ className: classes.input,
208
+ externalForwardedProps,
209
+ getSlotProps: handlers => ({
210
+ onChange: event => {
211
+ handlers.onChange?.(event);
212
+ handleInputChange(event);
213
+ }
214
+ }),
215
+ ownerState,
216
+ additionalProps: {
217
+ autoFocus,
181
218
  checked: checkedProp,
182
- defaultChecked: defaultChecked,
183
- className: classes.input,
184
- disabled: disabled,
219
+ defaultChecked,
220
+ disabled,
185
221
  id: hasLabelFor ? id : undefined,
186
- name: name,
187
- onChange: handleInputChange,
188
- readOnly: readOnly,
189
- ref: inputRef,
190
- required: required,
191
- ownerState: ownerState,
192
- tabIndex: tabIndex,
193
- type: type,
222
+ name,
223
+ readOnly,
224
+ required,
225
+ tabIndex,
226
+ type,
194
227
  ...(type === 'checkbox' && value === undefined ? {} : {
195
228
  value
196
- }),
197
- ...inputProps
229
+ })
230
+ }
231
+ });
232
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
233
+ ...rootSlotProps,
234
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(InputSlot, {
235
+ ...inputSlotProps
198
236
  }), checked ? checkedIcon : icon]
199
237
  });
200
238
  });
@@ -287,6 +325,22 @@ process.env.NODE_ENV !== "production" ? SwitchBase.propTypes = {
287
325
  * If `true`, the `input` element is required.
288
326
  */
289
327
  required: _propTypes.default.bool,
328
+ /**
329
+ * The props used for each slot inside.
330
+ * @default {}
331
+ */
332
+ slotProps: _propTypes.default.shape({
333
+ input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
334
+ root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
335
+ }),
336
+ /**
337
+ * The components used for each slot inside.
338
+ * @default {}
339
+ */
340
+ slots: _propTypes.default.shape({
341
+ input: _propTypes.default.elementType,
342
+ root: _propTypes.default.elementType
343
+ }),
290
344
  /**
291
345
  * The system prop that allows defining system overrides as well as additional CSS styles.
292
346
  */
@@ -30,8 +30,13 @@ function createThemeNoVars(options = {}, ...args) {
30
30
  shape: shapeInput,
31
31
  ...other
32
32
  } = options;
33
- if (options.vars) {
34
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' + 'Please use another name.' : (0, _formatMuiErrorMessage2.default)(20));
33
+ if (options.vars &&
34
+ // The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
35
+ // `generateThemeVars` is the closest identifier for checking that the `options` is a result of `createTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
36
+ options.generateThemeVars === undefined) {
37
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
38
+ // #host-reference
39
+ 'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : (0, _formatMuiErrorMessage2.default)(20));
35
40
  }
36
41
  const palette = (0, _createPalette.default)(paletteInput);
37
42
  const systemTheme = (0, _createTheme.default)(options);
@@ -4,9 +4,9 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.version = exports.prerelease = exports.patch = exports.minor = exports.major = exports.default = void 0;
7
- const version = exports.version = "6.4.5";
7
+ const version = exports.version = "6.4.7";
8
8
  const major = exports.major = Number("6");
9
9
  const minor = exports.minor = Number("4");
10
- const patch = exports.patch = Number("5");
10
+ const patch = exports.patch = Number("7");
11
11
  const prerelease = exports.prerelease = undefined;
12
12
  var _default = exports.default = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/material",
3
- "version": "6.4.5",
3
+ "version": "6.4.7",
4
4
  "private": false,
5
5
  "author": "MUI Team",
6
6
  "description": "Material UI is an open-source React component library that implements Google's Material Design. It's comprehensive and can be used in production out of the box.",
@@ -35,10 +35,10 @@
35
35
  "prop-types": "^15.8.1",
36
36
  "react-is": "^19.0.0",
37
37
  "react-transition-group": "^4.4.5",
38
- "@mui/core-downloads-tracker": "^6.4.5",
39
- "@mui/system": "^6.4.3",
38
+ "@mui/utils": "^6.4.6",
39
+ "@mui/system": "^6.4.7",
40
40
  "@mui/types": "^7.2.21",
41
- "@mui/utils": "^6.4.3"
41
+ "@mui/core-downloads-tracker": "^6.4.7"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@emotion/react": "^11.5.0",
@@ -46,7 +46,7 @@
46
46
  "@types/react": "^17.0.0 || ^18.0.0 || ^19.0.0",
47
47
  "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
48
48
  "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
49
- "@mui/material-pigment-css": "^6.4.3"
49
+ "@mui/material-pigment-css": "^6.4.7"
50
50
  },
51
51
  "peerDependenciesMeta": {
52
52
  "@types/react": {
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { DefaultTheme } from '@mui/system';
3
+ import { StorageManager } from '@mui/system/cssVars';
3
4
  import { CssThemeVariables } from './createThemeNoVars';
4
5
  type ThemeProviderCssVariablesProps = CssThemeVariables extends {
5
6
  enabled: true;
@@ -40,6 +41,11 @@ export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderC
40
41
  * @default window
41
42
  */
42
43
  storageWindow?: Window | null;
44
+ /**
45
+ * The storage manager to be used for storing the mode and color scheme
46
+ * @default using `window.localStorage`
47
+ */
48
+ storageManager?: StorageManager | null;
43
49
  /**
44
50
  * localStorage key used to store application `mode`
45
51
  * @default 'mui-mode'
@@ -43,6 +43,7 @@ export declare const CssVarsProvider: (props: React.PropsWithChildren<Partial<im
43
43
  defaultMode?: "light" | "dark" | "system";
44
44
  documentNode?: Document | null;
45
45
  colorSchemeNode?: Element | null;
46
+ storageManager?: import("@mui/system").StorageManager | null;
46
47
  storageWindow?: Window | null;
47
48
  disableNestedContext?: boolean;
48
49
  disableStyleSheetGeneration?: boolean;
@@ -21,8 +21,13 @@ function createThemeNoVars(options = {}, ...args) {
21
21
  shape: shapeInput,
22
22
  ...other
23
23
  } = options;
24
- if (options.vars) {
25
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' + 'Please use another name.' : _formatMuiErrorMessage(20));
24
+ if (options.vars &&
25
+ // The error should throw only for the root theme creation because user is not allowed to use a custom node `vars`.
26
+ // `generateThemeVars` is the closest identifier for checking that the `options` is a result of `createTheme` with CSS variables so that user can create new theme for nested ThemeProvider.
27
+ options.generateThemeVars === undefined) {
28
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
29
+ // #host-reference
30
+ 'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : _formatMuiErrorMessage(20));
26
31
  }
27
32
  const palette = createPalette(paletteInput);
28
33
  const systemTheme = systemCreateTheme(options);
package/styles/index.d.ts CHANGED
@@ -103,6 +103,7 @@ export { default as withStyles } from './withStyles';
103
103
  export { default as withTheme } from './withTheme';
104
104
 
105
105
  export * from './ThemeProviderWithVars';
106
+ export type { StorageManager } from '@mui/system/cssVars';
106
107
 
107
108
  export { default as extendTheme } from './createThemeWithVars';
108
109
 
package/version/index.js CHANGED
@@ -1,6 +1,6 @@
1
- export const version = "6.4.5";
1
+ export const version = "6.4.7";
2
2
  export const major = Number("6");
3
3
  export const minor = Number("4");
4
- export const patch = Number("5");
4
+ export const patch = Number("7");
5
5
  export const prerelease = undefined;
6
6
  export default version;