@mui/material 7.0.0-beta.4 → 7.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/InputBase/InputBase.js +2 -2
- package/Select/SelectInput.js +2 -2
- package/StepLabel/StepLabel.d.ts +19 -1
- package/StepLabel/StepLabel.js +14 -5
- package/Switch/Switch.d.ts +62 -1
- package/Switch/Switch.js +71 -9
- package/TextField/TextField.d.ts +30 -0
- package/TextField/TextField.js +22 -11
- package/esm/InputBase/InputBase.js +2 -2
- package/esm/Select/SelectInput.js +2 -2
- package/esm/StepLabel/StepLabel.d.ts +19 -1
- package/esm/StepLabel/StepLabel.js +14 -5
- package/esm/Switch/Switch.d.ts +62 -1
- package/esm/Switch/Switch.js +71 -9
- package/esm/TextField/TextField.d.ts +30 -0
- package/esm/TextField/TextField.js +22 -11
- package/esm/index.js +1 -1
- package/esm/styles/createPalette.js +3 -3
- package/esm/styles/createThemeNoVars.js +2 -2
- package/esm/styles/createThemeWithVars.js +2 -2
- package/esm/styles/index.js +2 -2
- package/esm/styles/makeStyles.js +2 -2
- package/esm/styles/responsiveFontSizes.js +2 -2
- package/esm/styles/withStyles.js +2 -2
- package/esm/styles/withTheme.js +2 -2
- package/esm/utils/mergeSlotProps.js +25 -0
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/modern/InputBase/InputBase.js +2 -2
- package/modern/Select/SelectInput.js +2 -2
- package/modern/StepLabel/StepLabel.d.ts +19 -1
- package/modern/StepLabel/StepLabel.js +14 -5
- package/modern/Switch/Switch.d.ts +62 -1
- package/modern/Switch/Switch.js +71 -9
- package/modern/TextField/TextField.d.ts +30 -0
- package/modern/TextField/TextField.js +22 -11
- package/modern/index.js +1 -1
- package/modern/styles/createPalette.js +3 -3
- package/modern/styles/createThemeNoVars.js +2 -2
- package/modern/styles/createThemeWithVars.js +2 -2
- package/modern/styles/index.js +2 -2
- package/modern/styles/makeStyles.js +2 -2
- package/modern/styles/responsiveFontSizes.js +2 -2
- package/modern/styles/withStyles.js +2 -2
- package/modern/styles/withTheme.js +2 -2
- package/modern/utils/mergeSlotProps.js +25 -0
- package/modern/version/index.js +2 -2
- package/package.json +7 -7
- package/styles/createPalette.js +3 -3
- package/styles/createThemeNoVars.js +2 -2
- package/styles/createThemeWithVars.js +2 -2
- package/styles/index.js +2 -2
- package/styles/makeStyles.js +2 -2
- package/styles/responsiveFontSizes.js +2 -2
- package/styles/withStyles.js +2 -2
- package/styles/withTheme.js +2 -2
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/mergeSlotProps.js +24 -0
- package/version/index.js +2 -2
package/modern/Switch/Switch.js
CHANGED
|
@@ -14,6 +14,7 @@ import { styled } from "../zero-styled/index.js";
|
|
|
14
14
|
import memoTheme from "../utils/memoTheme.js";
|
|
15
15
|
import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
16
16
|
import switchClasses, { getSwitchUtilityClass } from "./switchClasses.js";
|
|
17
|
+
import useSlot from "../utils/useSlot.js";
|
|
17
18
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
19
|
const useUtilityClasses = ownerState => {
|
|
19
20
|
const {
|
|
@@ -212,6 +213,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
212
213
|
edge = false,
|
|
213
214
|
size = 'medium',
|
|
214
215
|
sx,
|
|
216
|
+
slots = {},
|
|
217
|
+
slotProps = {},
|
|
215
218
|
...other
|
|
216
219
|
} = props;
|
|
217
220
|
const ownerState = {
|
|
@@ -221,14 +224,36 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
221
224
|
size
|
|
222
225
|
};
|
|
223
226
|
const classes = useUtilityClasses(ownerState);
|
|
224
|
-
const
|
|
227
|
+
const externalForwardedProps = {
|
|
228
|
+
slots,
|
|
229
|
+
slotProps
|
|
230
|
+
};
|
|
231
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
232
|
+
className: clsx(classes.root, className),
|
|
233
|
+
elementType: SwitchRoot,
|
|
234
|
+
externalForwardedProps,
|
|
235
|
+
ownerState,
|
|
236
|
+
additionalProps: {
|
|
237
|
+
sx
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
const [ThumbSlot, thumbSlotProps] = useSlot('thumb', {
|
|
225
241
|
className: classes.thumb,
|
|
226
|
-
|
|
242
|
+
elementType: SwitchThumb,
|
|
243
|
+
externalForwardedProps,
|
|
244
|
+
ownerState
|
|
227
245
|
});
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
246
|
+
const icon = /*#__PURE__*/_jsx(ThumbSlot, {
|
|
247
|
+
...thumbSlotProps
|
|
248
|
+
});
|
|
249
|
+
const [TrackSlot, trackSlotProps] = useSlot('track', {
|
|
250
|
+
className: classes.track,
|
|
251
|
+
elementType: SwitchTrack,
|
|
252
|
+
externalForwardedProps,
|
|
253
|
+
ownerState
|
|
254
|
+
});
|
|
255
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
256
|
+
...rootSlotProps,
|
|
232
257
|
children: [/*#__PURE__*/_jsx(SwitchSwitchBase, {
|
|
233
258
|
type: "checkbox",
|
|
234
259
|
icon: icon,
|
|
@@ -239,10 +264,25 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
239
264
|
classes: {
|
|
240
265
|
...classes,
|
|
241
266
|
root: classes.switchBase
|
|
267
|
+
},
|
|
268
|
+
slots: {
|
|
269
|
+
...(slots.switchBase && {
|
|
270
|
+
root: slots.switchBase
|
|
271
|
+
}),
|
|
272
|
+
...(slots.input && {
|
|
273
|
+
input: slots.input
|
|
274
|
+
})
|
|
275
|
+
},
|
|
276
|
+
slotProps: {
|
|
277
|
+
...(slotProps.switchBase && {
|
|
278
|
+
root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
|
|
279
|
+
}),
|
|
280
|
+
...(slotProps.input && {
|
|
281
|
+
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
282
|
+
})
|
|
242
283
|
}
|
|
243
|
-
}), /*#__PURE__*/_jsx(
|
|
244
|
-
|
|
245
|
-
ownerState: ownerState
|
|
284
|
+
}), /*#__PURE__*/_jsx(TrackSlot, {
|
|
285
|
+
...trackSlotProps
|
|
246
286
|
})]
|
|
247
287
|
});
|
|
248
288
|
});
|
|
@@ -332,6 +372,28 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
|
|
|
332
372
|
* @default 'medium'
|
|
333
373
|
*/
|
|
334
374
|
size: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([PropTypes.oneOf(['medium', 'small']), PropTypes.string]),
|
|
375
|
+
/**
|
|
376
|
+
* The props used for each slot inside.
|
|
377
|
+
* @default {}
|
|
378
|
+
*/
|
|
379
|
+
slotProps: PropTypes.shape({
|
|
380
|
+
input: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
381
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
382
|
+
switchBase: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
383
|
+
thumb: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
384
|
+
track: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
385
|
+
}),
|
|
386
|
+
/**
|
|
387
|
+
* The components used for each slot inside.
|
|
388
|
+
* @default {}
|
|
389
|
+
*/
|
|
390
|
+
slots: PropTypes.shape({
|
|
391
|
+
input: PropTypes.elementType,
|
|
392
|
+
root: PropTypes.elementType,
|
|
393
|
+
switchBase: PropTypes.elementType,
|
|
394
|
+
thumb: PropTypes.elementType,
|
|
395
|
+
track: PropTypes.elementType
|
|
396
|
+
}),
|
|
335
397
|
/**
|
|
336
398
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
337
399
|
*/
|
|
@@ -16,6 +16,11 @@ import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
|
16
16
|
export interface TextFieldPropsColorOverrides {}
|
|
17
17
|
export interface TextFieldPropsSizeOverrides {}
|
|
18
18
|
export interface TextFieldSlots {
|
|
19
|
+
/**
|
|
20
|
+
* The component that renders the root.
|
|
21
|
+
* @default FormControl
|
|
22
|
+
*/
|
|
23
|
+
root: React.ElementType;
|
|
19
24
|
/**
|
|
20
25
|
* The component that renders the input.
|
|
21
26
|
* @default OutlinedInput
|
|
@@ -43,10 +48,35 @@ export interface TextFieldSlots {
|
|
|
43
48
|
select: React.ElementType;
|
|
44
49
|
}
|
|
45
50
|
export type TextFieldSlotsAndSlotProps<InputPropsType> = CreateSlotsAndSlotProps<TextFieldSlots, {
|
|
51
|
+
/**
|
|
52
|
+
* Props forwarded to the root slot.
|
|
53
|
+
* By default, the avaible props are based on the [FormControl](https://mui.com/material-ui/api/form-control/#props) component.
|
|
54
|
+
*/
|
|
55
|
+
root: SlotProps<React.ElementType<FormControlProps>, {}, TextFieldOwnerState>;
|
|
56
|
+
/**
|
|
57
|
+
* Props forwarded to the input slot.
|
|
58
|
+
* By default, the avaible props are based on the [Input](https://mui.com/material-ui/api/input/#props) component.
|
|
59
|
+
*/
|
|
46
60
|
input: SlotProps<React.ElementType<InputPropsType>, {}, TextFieldOwnerState>;
|
|
61
|
+
/**
|
|
62
|
+
* Props forwarded to the input label slot.
|
|
63
|
+
* By default, the avaible props are based on the [InputLabel](https://mui.com/material-ui/api/input-label/#props) component.
|
|
64
|
+
*/
|
|
47
65
|
inputLabel: SlotProps<React.ElementType<InputLabelProps>, {}, TextFieldOwnerState>;
|
|
66
|
+
/**
|
|
67
|
+
* Props forwarded to the html input slot.
|
|
68
|
+
* By default, the avaible props are based on the html input element.
|
|
69
|
+
*/
|
|
48
70
|
htmlInput: SlotProps<React.ElementType<InputBaseProps['inputProps']>, {}, TextFieldOwnerState>;
|
|
71
|
+
/**
|
|
72
|
+
* Props forwarded to the form helper text slot.
|
|
73
|
+
* By default, the avaible props are based on the [FormHelperText](https://mui.com/material-ui/api/form-helper-text/#props) component.
|
|
74
|
+
*/
|
|
49
75
|
formHelperText: SlotProps<React.ElementType<FormHelperTextProps>, {}, TextFieldOwnerState>;
|
|
76
|
+
/**
|
|
77
|
+
* Props forwarded to the select slot.
|
|
78
|
+
* By default, the avaible props are based on the [Select](https://mui.com/material-ui/api/select/#props) component.
|
|
79
|
+
*/
|
|
50
80
|
select: SlotProps<React.ElementType<SelectProps>, {}, TextFieldOwnerState>;
|
|
51
81
|
}>;
|
|
52
82
|
export interface BaseTextFieldProps extends StandardProps<FormControlProps,
|
|
@@ -160,6 +160,25 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
160
160
|
}
|
|
161
161
|
inputAdditionalProps['aria-describedby'] = undefined;
|
|
162
162
|
}
|
|
163
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
164
|
+
elementType: TextFieldRoot,
|
|
165
|
+
shouldForwardComponentProp: true,
|
|
166
|
+
externalForwardedProps: {
|
|
167
|
+
...externalForwardedProps,
|
|
168
|
+
...other
|
|
169
|
+
},
|
|
170
|
+
ownerState,
|
|
171
|
+
className: clsx(classes.root, className),
|
|
172
|
+
ref,
|
|
173
|
+
additionalProps: {
|
|
174
|
+
disabled,
|
|
175
|
+
error,
|
|
176
|
+
fullWidth,
|
|
177
|
+
required,
|
|
178
|
+
color,
|
|
179
|
+
variant
|
|
180
|
+
}
|
|
181
|
+
});
|
|
163
182
|
const [InputSlot, inputProps] = useSlot('input', {
|
|
164
183
|
elementType: InputComponent,
|
|
165
184
|
externalForwardedProps,
|
|
@@ -211,17 +230,8 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
211
230
|
},
|
|
212
231
|
...inputProps
|
|
213
232
|
});
|
|
214
|
-
return /*#__PURE__*/_jsxs(
|
|
215
|
-
|
|
216
|
-
disabled: disabled,
|
|
217
|
-
error: error,
|
|
218
|
-
fullWidth: fullWidth,
|
|
219
|
-
ref: ref,
|
|
220
|
-
required: required,
|
|
221
|
-
color: color,
|
|
222
|
-
variant: variant,
|
|
223
|
-
ownerState: ownerState,
|
|
224
|
-
...other,
|
|
233
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
234
|
+
...rootProps,
|
|
225
235
|
children: [label != null && label !== '' && /*#__PURE__*/_jsx(InputLabelSlot, {
|
|
226
236
|
htmlFor: id,
|
|
227
237
|
id: inputLabelId,
|
|
@@ -423,6 +433,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
423
433
|
htmlInput: PropTypes.elementType,
|
|
424
434
|
input: PropTypes.elementType,
|
|
425
435
|
inputLabel: PropTypes.elementType,
|
|
436
|
+
root: PropTypes.elementType,
|
|
426
437
|
select: PropTypes.elementType
|
|
427
438
|
}),
|
|
428
439
|
/**
|
package/modern/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
import deepmerge from '@mui/utils/deepmerge';
|
|
3
3
|
import { darken, getContrastRatio, lighten } from '@mui/system/colorManipulator';
|
|
4
4
|
import common from "../colors/common.js";
|
|
@@ -218,10 +218,10 @@ export default function createPalette(palette) {
|
|
|
218
218
|
color.main = color[mainShade];
|
|
219
219
|
}
|
|
220
220
|
if (!color.hasOwnProperty('main')) {
|
|
221
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` :
|
|
221
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatErrorMessage(11, name ? ` (${name})` : '', mainShade));
|
|
222
222
|
}
|
|
223
223
|
if (typeof color.main !== 'string') {
|
|
224
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' :
|
|
224
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : _formatErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
|
225
225
|
}
|
|
226
226
|
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
|
227
227
|
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
import deepmerge from '@mui/utils/deepmerge';
|
|
3
3
|
import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
|
|
4
4
|
import systemCreateTheme from '@mui/system/createTheme';
|
|
@@ -27,7 +27,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
27
27
|
options.generateThemeVars === undefined) {
|
|
28
28
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
|
|
29
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.' :
|
|
30
|
+
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : _formatErrorMessage(20));
|
|
31
31
|
}
|
|
32
32
|
const palette = createPalette(paletteInput);
|
|
33
33
|
const systemTheme = systemCreateTheme(options);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
import deepmerge from '@mui/utils/deepmerge';
|
|
3
3
|
import { unstable_createGetCssVar as systemCreateGetCssVar, createSpacing } from '@mui/system';
|
|
4
4
|
import { createUnarySpacing } from '@mui/system/spacing';
|
|
@@ -131,7 +131,7 @@ export default function createThemeWithVars(options = {}, ...args) {
|
|
|
131
131
|
defaultScheme = true;
|
|
132
132
|
}
|
|
133
133
|
if (!defaultScheme) {
|
|
134
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` :
|
|
134
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : _formatErrorMessage(21, defaultColorScheme));
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
// Create the palette for the default color scheme, either `light`, `dark`, or custom color scheme.
|
package/modern/styles/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export { default as THEME_ID } from "./identifier.js";
|
|
3
3
|
export { default as adaptV4Theme } from "./adaptV4Theme.js";
|
|
4
4
|
export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes } from '@mui/system';
|
|
@@ -6,7 +6,7 @@ export { unstable_createBreakpoints } from '@mui/system/createBreakpoints';
|
|
|
6
6
|
// TODO: Remove this function in v6.
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8
8
|
export function experimental_sx() {
|
|
9
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' :
|
|
9
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatErrorMessage(19));
|
|
10
10
|
}
|
|
11
11
|
export { default as createTheme } from "./createTheme.js";
|
|
12
12
|
export { default as unstable_createMuiStrictModeTheme } from "./createMuiStrictModeTheme.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export default function makeStyles() {
|
|
3
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' :
|
|
3
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatErrorMessage(14));
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
import { isUnitless, convertLength, responsiveProperty, alignProperty, fontGrid } from "./cssUtils.js";
|
|
3
3
|
export default function responsiveFontSizes(themeInput, options = {}) {
|
|
4
4
|
const {
|
|
@@ -34,7 +34,7 @@ export default function responsiveFontSizes(themeInput, options = {}) {
|
|
|
34
34
|
lineHeight
|
|
35
35
|
} = style;
|
|
36
36
|
if (!isUnitless(lineHeight) && !disableAlign) {
|
|
37
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' :
|
|
37
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : _formatErrorMessage(6));
|
|
38
38
|
}
|
|
39
39
|
if (!isUnitless(lineHeight)) {
|
|
40
40
|
// make it unitless
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export default function withStyles() {
|
|
3
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' :
|
|
3
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatErrorMessage(15));
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
2
2
|
export default function withTheme() {
|
|
3
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' :
|
|
3
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatErrorMessage(16));
|
|
4
4
|
}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import clsx from 'clsx';
|
|
2
|
+
|
|
3
|
+
// Brought from [Base UI](https://github.com/mui/base-ui/blob/master/packages/react/src/merge-props/mergeProps.ts#L119)
|
|
4
|
+
// Use it directly from Base UI once it's a package dependency.
|
|
5
|
+
function isEventHandler(key, value) {
|
|
6
|
+
// This approach is more efficient than using a regex.
|
|
7
|
+
const thirdCharCode = key.charCodeAt(2);
|
|
8
|
+
return key[0] === 'o' && key[1] === 'n' && thirdCharCode >= 65 /* A */ && thirdCharCode <= 90 /* Z */ && typeof value === 'function';
|
|
9
|
+
}
|
|
2
10
|
export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
|
|
3
11
|
if (!externalSlotProps) {
|
|
4
12
|
return defaultSlotProps;
|
|
5
13
|
}
|
|
14
|
+
function extractHandlers(externalSlotPropsValue, defaultSlotPropsValue) {
|
|
15
|
+
const handlers = {};
|
|
16
|
+
Object.keys(defaultSlotPropsValue).forEach(key => {
|
|
17
|
+
if (isEventHandler(key, defaultSlotPropsValue[key]) && typeof externalSlotPropsValue[key] === 'function') {
|
|
18
|
+
// only compose the handlers if both default and external slot props match the event handler
|
|
19
|
+
handlers[key] = (...args) => {
|
|
20
|
+
externalSlotPropsValue[key](...args);
|
|
21
|
+
defaultSlotPropsValue[key](...args);
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return handlers;
|
|
26
|
+
}
|
|
6
27
|
if (typeof externalSlotProps === 'function' || typeof defaultSlotProps === 'function') {
|
|
7
28
|
return ownerState => {
|
|
8
29
|
const defaultSlotPropsValue = typeof defaultSlotProps === 'function' ? defaultSlotProps(ownerState) : defaultSlotProps;
|
|
@@ -11,9 +32,11 @@ export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
|
|
|
11
32
|
...defaultSlotPropsValue
|
|
12
33
|
}) : externalSlotProps;
|
|
13
34
|
const className = clsx(ownerState?.className, defaultSlotPropsValue?.className, externalSlotPropsValue?.className);
|
|
35
|
+
const handlers = extractHandlers(externalSlotPropsValue, defaultSlotPropsValue);
|
|
14
36
|
return {
|
|
15
37
|
...defaultSlotPropsValue,
|
|
16
38
|
...externalSlotPropsValue,
|
|
39
|
+
...handlers,
|
|
17
40
|
...(!!className && {
|
|
18
41
|
className
|
|
19
42
|
}),
|
|
@@ -30,10 +53,12 @@ export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
|
|
|
30
53
|
};
|
|
31
54
|
}
|
|
32
55
|
const typedDefaultSlotProps = defaultSlotProps;
|
|
56
|
+
const handlers = extractHandlers(externalSlotProps, typedDefaultSlotProps);
|
|
33
57
|
const className = clsx(typedDefaultSlotProps?.className, externalSlotProps?.className);
|
|
34
58
|
return {
|
|
35
59
|
...defaultSlotProps,
|
|
36
60
|
...externalSlotProps,
|
|
61
|
+
...handlers,
|
|
37
62
|
...(!!className && {
|
|
38
63
|
className
|
|
39
64
|
}),
|
package/modern/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "7.0.0-
|
|
1
|
+
export const version = "7.0.0-rc.0";
|
|
2
2
|
export const major = Number("7");
|
|
3
3
|
export const minor = Number("0");
|
|
4
4
|
export const patch = Number("0");
|
|
5
|
-
export const prerelease = "
|
|
5
|
+
export const prerelease = "rc.0";
|
|
6
6
|
export default version;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/material",
|
|
3
|
-
"version": "7.0.0-
|
|
3
|
+
"version": "7.0.0-rc.0",
|
|
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.",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"url": "https://opencollective.com/mui-org"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@babel/runtime": "^7.26.
|
|
30
|
+
"@babel/runtime": "^7.26.10",
|
|
31
31
|
"@popperjs/core": "^2.11.8",
|
|
32
32
|
"@types/react-transition-group": "^4.4.12",
|
|
33
33
|
"clsx": "^2.1.1",
|
|
@@ -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/
|
|
39
|
-
"@mui/
|
|
40
|
-
"@mui/
|
|
41
|
-
"@mui/
|
|
38
|
+
"@mui/core-downloads-tracker": "^7.0.0-rc.0",
|
|
39
|
+
"@mui/system": "7.0.0-rc.0",
|
|
40
|
+
"@mui/types": "^7.3.1",
|
|
41
|
+
"@mui/utils": "7.0.0-rc.0"
|
|
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": "7.0.0-
|
|
49
|
+
"@mui/material-pigment-css": "7.0.0-rc.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"@types/react": {
|
package/styles/createPalette.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.dark = void 0;
|
|
8
8
|
exports.default = createPalette;
|
|
9
9
|
exports.light = void 0;
|
|
10
|
-
var
|
|
10
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
11
11
|
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
12
12
|
var _colorManipulator = require("@mui/system/colorManipulator");
|
|
13
13
|
var _common = _interopRequireDefault(require("../colors/common"));
|
|
@@ -227,10 +227,10 @@ function createPalette(palette) {
|
|
|
227
227
|
color.main = color[mainShade];
|
|
228
228
|
}
|
|
229
229
|
if (!color.hasOwnProperty('main')) {
|
|
230
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : (0,
|
|
230
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : (0, _formatMuiErrorMessage.default)(11, name ? ` (${name})` : '', mainShade));
|
|
231
231
|
}
|
|
232
232
|
if (typeof color.main !== 'string') {
|
|
233
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : (0,
|
|
233
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : (0, _formatMuiErrorMessage.default)(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
|
|
234
234
|
}
|
|
235
235
|
addLightOrDark(color, 'light', lightShade, tonalOffset);
|
|
236
236
|
addLightOrDark(color, 'dark', darkShade, tonalOffset);
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
|
-
var
|
|
9
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
10
10
|
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
11
11
|
var _styleFunctionSx = _interopRequireWildcard(require("@mui/system/styleFunctionSx"));
|
|
12
12
|
var _createTheme = _interopRequireDefault(require("@mui/system/createTheme"));
|
|
@@ -35,7 +35,7 @@ function createThemeNoVars(options = {}, ...args) {
|
|
|
35
35
|
options.generateThemeVars === undefined) {
|
|
36
36
|
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
|
|
37
37
|
// #host-reference
|
|
38
|
-
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : (0,
|
|
38
|
+
'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : (0, _formatMuiErrorMessage.default)(20));
|
|
39
39
|
}
|
|
40
40
|
const palette = (0, _createPalette.default)(paletteInput);
|
|
41
41
|
const systemTheme = (0, _createTheme.default)(options);
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.createGetCssVar = void 0;
|
|
9
9
|
exports.default = createThemeWithVars;
|
|
10
|
-
var
|
|
10
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
11
11
|
var _deepmerge = _interopRequireDefault(require("@mui/utils/deepmerge"));
|
|
12
12
|
var _system = require("@mui/system");
|
|
13
13
|
var _spacing = require("@mui/system/spacing");
|
|
@@ -141,7 +141,7 @@ function createThemeWithVars(options = {}, ...args) {
|
|
|
141
141
|
defaultScheme = true;
|
|
142
142
|
}
|
|
143
143
|
if (!defaultScheme) {
|
|
144
|
-
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : (0,
|
|
144
|
+
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : (0, _formatMuiErrorMessage.default)(21, defaultColorScheme));
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// Create the palette for the default color scheme, either `light`, `dark`, or custom color scheme.
|
package/styles/index.js
CHANGED
|
@@ -296,7 +296,7 @@ Object.defineProperty(exports, "withTheme", {
|
|
|
296
296
|
return _withTheme.default;
|
|
297
297
|
}
|
|
298
298
|
});
|
|
299
|
-
var
|
|
299
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
300
300
|
var _identifier = _interopRequireDefault(require("./identifier"));
|
|
301
301
|
var _adaptV4Theme = _interopRequireDefault(require("./adaptV4Theme"));
|
|
302
302
|
var _system = require("@mui/system");
|
|
@@ -337,7 +337,7 @@ var _excludeVariablesFromRoot = _interopRequireDefault(require("./excludeVariabl
|
|
|
337
337
|
// TODO: Remove this function in v6.
|
|
338
338
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
339
339
|
function experimental_sx() {
|
|
340
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : (0,
|
|
340
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : (0, _formatMuiErrorMessage.default)(19));
|
|
341
341
|
}
|
|
342
342
|
|
|
343
343
|
// The legacy utilities from @mui/styles
|
package/styles/makeStyles.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = makeStyles;
|
|
8
|
-
var
|
|
8
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
9
9
|
function makeStyles() {
|
|
10
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0,
|
|
10
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0, _formatMuiErrorMessage.default)(14));
|
|
11
11
|
}
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = responsiveFontSizes;
|
|
8
|
-
var
|
|
8
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
9
9
|
var _cssUtils = require("./cssUtils");
|
|
10
10
|
function responsiveFontSizes(themeInput, options = {}) {
|
|
11
11
|
const {
|
|
@@ -41,7 +41,7 @@ function responsiveFontSizes(themeInput, options = {}) {
|
|
|
41
41
|
lineHeight
|
|
42
42
|
} = style;
|
|
43
43
|
if (!(0, _cssUtils.isUnitless)(lineHeight) && !disableAlign) {
|
|
44
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : (0,
|
|
44
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : (0, _formatMuiErrorMessage.default)(6));
|
|
45
45
|
}
|
|
46
46
|
if (!(0, _cssUtils.isUnitless)(lineHeight)) {
|
|
47
47
|
// make it unitless
|
package/styles/withStyles.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = withStyles;
|
|
8
|
-
var
|
|
8
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
9
9
|
function withStyles() {
|
|
10
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0,
|
|
10
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0, _formatMuiErrorMessage.default)(15));
|
|
11
11
|
}
|
package/styles/withTheme.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.default = withTheme;
|
|
8
|
-
var
|
|
8
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
9
9
|
function withTheme() {
|
|
10
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0,
|
|
10
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : (0, _formatMuiErrorMessage.default)(16));
|
|
11
11
|
}
|