@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 7.0.0-rc.0
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v7.0.0-beta.4..master -->
|
|
6
|
+
|
|
7
|
+
_Mar 18, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 4 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@7.0.0-rc.0`
|
|
12
|
+
|
|
13
|
+
- [StepLabel] Add missing root slot (#45603) @sai6855
|
|
14
|
+
- [Switch] Add slots and slotProps (#45595) @siriwatknp
|
|
15
|
+
- [utils] Add merging function to `mergeSlotProps` utility (#45543) @siriwatknp
|
|
16
|
+
|
|
17
|
+
### Core
|
|
18
|
+
|
|
19
|
+
- [blog] Clarify the difference between the two Pro plans (#45266) @oliviertassinari
|
|
20
|
+
- [code-infra] Allow specifying a custom error formatter module for error minifcation (#45291) @Janpot
|
|
21
|
+
- [code-infra] Make `getVersionEnvVariables` reusable for other repos (#45562) @Janpot
|
|
22
|
+
- [code-infra] Update peer dependency of `@mui/utils` in `@mui/docs` (#45561) @Janpot
|
|
23
|
+
- Add StackBlitz template to issue template (#45504) @Janpot
|
|
24
|
+
|
|
25
|
+
All contributors of this release in alphabetical order: @Janpot, @oliviertassinari, @sai6855, @siriwatknp
|
|
26
|
+
|
|
3
27
|
## 7.0.0-beta.4
|
|
4
28
|
|
|
5
29
|
<!-- generated comparing v7.0.0-beta.3..master -->
|
package/InputBase/InputBase.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.rootOverridesResolver = exports.inputOverridesResolver = exports.default = exports.InputBaseRoot = exports.InputBaseInput = void 0;
|
|
10
|
-
var
|
|
10
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
@@ -381,7 +381,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
381
381
|
if (!isControlled) {
|
|
382
382
|
const element = event.target || inputRef.current;
|
|
383
383
|
if (element == null) {
|
|
384
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Expected valid input target. ' + 'Did you use a custom `inputComponent` and forget to forward refs? ' + 'See https://mui.com/r/input-component-ref-interface for more info.' : (0,
|
|
384
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Expected valid input target. ' + 'Did you use a custom `inputComponent` and forget to forward refs? ' + 'See https://mui.com/r/input-component-ref-interface for more info.' : (0, _formatMuiErrorMessage.default)(1));
|
|
385
385
|
}
|
|
386
386
|
checkDirty({
|
|
387
387
|
value: element.value
|
package/Select/SelectInput.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.default = void 0;
|
|
10
|
-
var
|
|
10
|
+
var _formatMuiErrorMessage = _interopRequireDefault(require("@mui/utils/formatMuiErrorMessage"));
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _reactIs = require("react-is");
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -355,7 +355,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
355
355
|
let selected;
|
|
356
356
|
if (multiple) {
|
|
357
357
|
if (!Array.isArray(value)) {
|
|
358
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' : (0,
|
|
358
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' : (0, _formatMuiErrorMessage.default)(2));
|
|
359
359
|
}
|
|
360
360
|
selected = value.some(v => areEqualValues(v, child.props.value));
|
|
361
361
|
if (selected && computeDisplay) {
|
package/StepLabel/StepLabel.d.ts
CHANGED
|
@@ -6,6 +6,11 @@ import { Theme } from "../styles/index.js";
|
|
|
6
6
|
import { StepLabelClasses } from "./stepLabelClasses.js";
|
|
7
7
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
8
8
|
export interface StepLabelSlots {
|
|
9
|
+
/**
|
|
10
|
+
* The component that renders the root.
|
|
11
|
+
* @default span
|
|
12
|
+
*/
|
|
13
|
+
root: React.ElementType;
|
|
9
14
|
/**
|
|
10
15
|
* The component that renders the label.
|
|
11
16
|
* @default span
|
|
@@ -17,7 +22,20 @@ export interface StepLabelSlots {
|
|
|
17
22
|
stepIcon: React.ElementType;
|
|
18
23
|
}
|
|
19
24
|
export type StepLabelSlotsAndSlotProps = CreateSlotsAndSlotProps<StepLabelSlots, {
|
|
20
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to the root slot.
|
|
27
|
+
* By default, the avaible props are based on the span element.
|
|
28
|
+
*/
|
|
29
|
+
root: SlotProps<'span', {}, StepLabelOwnerState>;
|
|
30
|
+
/**
|
|
31
|
+
* Props forwarded to the label slot.
|
|
32
|
+
* By default, the avaible props are based on the span element.
|
|
33
|
+
*/
|
|
34
|
+
label: SlotProps<'span', {}, StepLabelOwnerState>;
|
|
35
|
+
/**
|
|
36
|
+
* Props forwarded to the stepIcon slot.
|
|
37
|
+
* By default, the avaible props are based on the div element.
|
|
38
|
+
*/
|
|
21
39
|
stepIcon: SlotProps<React.ElementType<StepIconProps>, {}, StepLabelOwnerState>;
|
|
22
40
|
}>;
|
|
23
41
|
export interface StepLabelOwnerState extends StepLabelProps {}
|
package/StepLabel/StepLabel.js
CHANGED
|
@@ -169,6 +169,16 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
|
|
|
169
169
|
...slotProps
|
|
170
170
|
}
|
|
171
171
|
};
|
|
172
|
+
const [RootSlot, rootProps] = (0, _useSlot.default)('root', {
|
|
173
|
+
elementType: StepLabelRoot,
|
|
174
|
+
externalForwardedProps: {
|
|
175
|
+
...externalForwardedProps,
|
|
176
|
+
...other
|
|
177
|
+
},
|
|
178
|
+
ownerState,
|
|
179
|
+
ref,
|
|
180
|
+
className: (0, _clsx.default)(classes.root, className)
|
|
181
|
+
});
|
|
172
182
|
const [LabelSlot, labelProps] = (0, _useSlot.default)('label', {
|
|
173
183
|
elementType: StepLabelLabel,
|
|
174
184
|
externalForwardedProps,
|
|
@@ -179,11 +189,8 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
|
|
|
179
189
|
externalForwardedProps,
|
|
180
190
|
ownerState
|
|
181
191
|
});
|
|
182
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
183
|
-
|
|
184
|
-
ref: ref,
|
|
185
|
-
ownerState: ownerState,
|
|
186
|
-
...other,
|
|
192
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
|
|
193
|
+
...rootProps,
|
|
187
194
|
children: [icon || StepIconSlot ? /*#__PURE__*/(0, _jsxRuntime.jsx)(StepLabelIconContainer, {
|
|
188
195
|
className: classes.iconContainer,
|
|
189
196
|
ownerState: ownerState,
|
|
@@ -249,6 +256,7 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes /* remove-proptypes
|
|
|
249
256
|
*/
|
|
250
257
|
slotProps: _propTypes.default.shape({
|
|
251
258
|
label: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
259
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
252
260
|
stepIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
253
261
|
}),
|
|
254
262
|
/**
|
|
@@ -257,6 +265,7 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes /* remove-proptypes
|
|
|
257
265
|
*/
|
|
258
266
|
slots: _propTypes.default.shape({
|
|
259
267
|
label: _propTypes.default.elementType,
|
|
268
|
+
root: _propTypes.default.elementType,
|
|
260
269
|
stepIcon: _propTypes.default.elementType
|
|
261
270
|
}),
|
|
262
271
|
/**
|
package/Switch/Switch.d.ts
CHANGED
|
@@ -2,11 +2,72 @@ import * as React from 'react';
|
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
3
|
import { OverridableStringUnion } from '@mui/types';
|
|
4
4
|
import { InternalStandardProps as StandardProps, Theme } from "../index.js";
|
|
5
|
+
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
5
6
|
import { SwitchBaseProps } from "../internal/SwitchBase.js";
|
|
6
7
|
import { SwitchClasses } from "./switchClasses.js";
|
|
7
8
|
export interface SwitchPropsSizeOverrides {}
|
|
8
9
|
export interface SwitchPropsColorOverrides {}
|
|
9
|
-
export interface
|
|
10
|
+
export interface SwitchRootSlotPropsOverrides {}
|
|
11
|
+
export interface SwitchTrackSlotPropsOverrides {}
|
|
12
|
+
export interface SwitchThumbSlotPropsOverrides {}
|
|
13
|
+
export interface SwitchSwitchBaseSlotPropsOverrides {}
|
|
14
|
+
export interface SwitchInputSlotPropsOverrides {}
|
|
15
|
+
export interface SwitchSlots {
|
|
16
|
+
/**
|
|
17
|
+
* The component that renders the root slot.
|
|
18
|
+
* @default 'span'
|
|
19
|
+
*/
|
|
20
|
+
root: React.ElementType;
|
|
21
|
+
/**
|
|
22
|
+
* The component that renders the track slot.
|
|
23
|
+
* @default 'span'
|
|
24
|
+
*/
|
|
25
|
+
track: React.ElementType;
|
|
26
|
+
/**
|
|
27
|
+
* The component that renders the thumb slot.
|
|
28
|
+
* @default 'span'
|
|
29
|
+
*/
|
|
30
|
+
thumb: React.ElementType;
|
|
31
|
+
/**
|
|
32
|
+
* The component that renders the switchBase slot.
|
|
33
|
+
* @default SwitchBase
|
|
34
|
+
*/
|
|
35
|
+
switchBase: React.ElementType;
|
|
36
|
+
/**
|
|
37
|
+
* The component that renders the switchBase's input slot.
|
|
38
|
+
* @default SwitchBaseInput
|
|
39
|
+
*/
|
|
40
|
+
input: React.ElementType;
|
|
41
|
+
}
|
|
42
|
+
export type SwitchSlotsAndSlotProps = CreateSlotsAndSlotProps<SwitchSlots, {
|
|
43
|
+
/**
|
|
44
|
+
* Props forwarded to the root slot.
|
|
45
|
+
* By default, the avaible props are based on the span element.
|
|
46
|
+
*/
|
|
47
|
+
root: SlotProps<'span', SwitchRootSlotPropsOverrides, SwitchOwnerState>;
|
|
48
|
+
/**
|
|
49
|
+
* Props forwarded to the track slot.
|
|
50
|
+
* By default, the avaible props are based on the span element.
|
|
51
|
+
*/
|
|
52
|
+
track: SlotProps<'span', SwitchTrackSlotPropsOverrides, SwitchOwnerState>;
|
|
53
|
+
/**
|
|
54
|
+
* Props forwarded to the thumb slot.
|
|
55
|
+
* By default, the avaible props are based on the span element.
|
|
56
|
+
*/
|
|
57
|
+
thumb: SlotProps<'span', SwitchThumbSlotPropsOverrides, SwitchOwnerState>;
|
|
58
|
+
/**
|
|
59
|
+
* Props forwarded to the switchBase slot.
|
|
60
|
+
* By default, the avaible props are based on the internal SwitchBase component.
|
|
61
|
+
*/
|
|
62
|
+
switchBase: SlotProps<React.ElementType<SwitchBaseProps>, SwitchSwitchBaseSlotPropsOverrides, SwitchOwnerState>;
|
|
63
|
+
/**
|
|
64
|
+
* Props forwarded to the input slot.
|
|
65
|
+
* By default, the avaible props are based on the input element.
|
|
66
|
+
*/
|
|
67
|
+
input: SlotProps<'input', SwitchInputSlotPropsOverrides, SwitchOwnerState>;
|
|
68
|
+
}>;
|
|
69
|
+
export interface SwitchOwnerState extends Omit<SwitchProps, 'slots' | 'slotProps'> {}
|
|
70
|
+
export interface SwitchProps extends StandardProps<SwitchBaseProps, 'checkedIcon' | 'color' | 'icon' | 'slots' | 'slotProps'>, SwitchSlotsAndSlotProps {
|
|
10
71
|
/**
|
|
11
72
|
* The icon to display when the component is checked.
|
|
12
73
|
*/
|
package/Switch/Switch.js
CHANGED
|
@@ -21,6 +21,7 @@ var _zeroStyled = require("../zero-styled");
|
|
|
21
21
|
var _memoTheme = _interopRequireDefault(require("../utils/memoTheme"));
|
|
22
22
|
var _DefaultPropsProvider = require("../DefaultPropsProvider");
|
|
23
23
|
var _switchClasses = _interopRequireWildcard(require("./switchClasses"));
|
|
24
|
+
var _useSlot = _interopRequireDefault(require("../utils/useSlot"));
|
|
24
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
26
|
const useUtilityClasses = ownerState => {
|
|
26
27
|
const {
|
|
@@ -219,6 +220,8 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
219
220
|
edge = false,
|
|
220
221
|
size = 'medium',
|
|
221
222
|
sx,
|
|
223
|
+
slots = {},
|
|
224
|
+
slotProps = {},
|
|
222
225
|
...other
|
|
223
226
|
} = props;
|
|
224
227
|
const ownerState = {
|
|
@@ -228,14 +231,36 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
228
231
|
size
|
|
229
232
|
};
|
|
230
233
|
const classes = useUtilityClasses(ownerState);
|
|
231
|
-
const
|
|
234
|
+
const externalForwardedProps = {
|
|
235
|
+
slots,
|
|
236
|
+
slotProps
|
|
237
|
+
};
|
|
238
|
+
const [RootSlot, rootSlotProps] = (0, _useSlot.default)('root', {
|
|
239
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
240
|
+
elementType: SwitchRoot,
|
|
241
|
+
externalForwardedProps,
|
|
242
|
+
ownerState,
|
|
243
|
+
additionalProps: {
|
|
244
|
+
sx
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
const [ThumbSlot, thumbSlotProps] = (0, _useSlot.default)('thumb', {
|
|
232
248
|
className: classes.thumb,
|
|
233
|
-
|
|
249
|
+
elementType: SwitchThumb,
|
|
250
|
+
externalForwardedProps,
|
|
251
|
+
ownerState
|
|
234
252
|
});
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
253
|
+
const icon = /*#__PURE__*/(0, _jsxRuntime.jsx)(ThumbSlot, {
|
|
254
|
+
...thumbSlotProps
|
|
255
|
+
});
|
|
256
|
+
const [TrackSlot, trackSlotProps] = (0, _useSlot.default)('track', {
|
|
257
|
+
className: classes.track,
|
|
258
|
+
elementType: SwitchTrack,
|
|
259
|
+
externalForwardedProps,
|
|
260
|
+
ownerState
|
|
261
|
+
});
|
|
262
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
|
|
263
|
+
...rootSlotProps,
|
|
239
264
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(SwitchSwitchBase, {
|
|
240
265
|
type: "checkbox",
|
|
241
266
|
icon: icon,
|
|
@@ -246,10 +271,25 @@ const Switch = /*#__PURE__*/React.forwardRef(function Switch(inProps, ref) {
|
|
|
246
271
|
classes: {
|
|
247
272
|
...classes,
|
|
248
273
|
root: classes.switchBase
|
|
274
|
+
},
|
|
275
|
+
slots: {
|
|
276
|
+
...(slots.switchBase && {
|
|
277
|
+
root: slots.switchBase
|
|
278
|
+
}),
|
|
279
|
+
...(slots.input && {
|
|
280
|
+
input: slots.input
|
|
281
|
+
})
|
|
282
|
+
},
|
|
283
|
+
slotProps: {
|
|
284
|
+
...(slotProps.switchBase && {
|
|
285
|
+
root: typeof slotProps.switchBase === 'function' ? slotProps.switchBase(ownerState) : slotProps.switchBase
|
|
286
|
+
}),
|
|
287
|
+
...(slotProps.input && {
|
|
288
|
+
input: typeof slotProps.input === 'function' ? slotProps.input(ownerState) : slotProps.input
|
|
289
|
+
})
|
|
249
290
|
}
|
|
250
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
251
|
-
|
|
252
|
-
ownerState: ownerState
|
|
291
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(TrackSlot, {
|
|
292
|
+
...trackSlotProps
|
|
253
293
|
})]
|
|
254
294
|
});
|
|
255
295
|
});
|
|
@@ -339,6 +379,28 @@ process.env.NODE_ENV !== "production" ? Switch.propTypes /* remove-proptypes */
|
|
|
339
379
|
* @default 'medium'
|
|
340
380
|
*/
|
|
341
381
|
size: _propTypes.default /* @typescript-to-proptypes-ignore */.oneOfType([_propTypes.default.oneOf(['medium', 'small']), _propTypes.default.string]),
|
|
382
|
+
/**
|
|
383
|
+
* The props used for each slot inside.
|
|
384
|
+
* @default {}
|
|
385
|
+
*/
|
|
386
|
+
slotProps: _propTypes.default.shape({
|
|
387
|
+
input: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
388
|
+
root: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
389
|
+
switchBase: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
390
|
+
thumb: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
|
391
|
+
track: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object])
|
|
392
|
+
}),
|
|
393
|
+
/**
|
|
394
|
+
* The components used for each slot inside.
|
|
395
|
+
* @default {}
|
|
396
|
+
*/
|
|
397
|
+
slots: _propTypes.default.shape({
|
|
398
|
+
input: _propTypes.default.elementType,
|
|
399
|
+
root: _propTypes.default.elementType,
|
|
400
|
+
switchBase: _propTypes.default.elementType,
|
|
401
|
+
thumb: _propTypes.default.elementType,
|
|
402
|
+
track: _propTypes.default.elementType
|
|
403
|
+
}),
|
|
342
404
|
/**
|
|
343
405
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
344
406
|
*/
|
package/TextField/TextField.d.ts
CHANGED
|
@@ -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,
|
package/TextField/TextField.js
CHANGED
|
@@ -167,6 +167,25 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
167
167
|
}
|
|
168
168
|
inputAdditionalProps['aria-describedby'] = undefined;
|
|
169
169
|
}
|
|
170
|
+
const [RootSlot, rootProps] = (0, _useSlot.default)('root', {
|
|
171
|
+
elementType: TextFieldRoot,
|
|
172
|
+
shouldForwardComponentProp: true,
|
|
173
|
+
externalForwardedProps: {
|
|
174
|
+
...externalForwardedProps,
|
|
175
|
+
...other
|
|
176
|
+
},
|
|
177
|
+
ownerState,
|
|
178
|
+
className: (0, _clsx.default)(classes.root, className),
|
|
179
|
+
ref,
|
|
180
|
+
additionalProps: {
|
|
181
|
+
disabled,
|
|
182
|
+
error,
|
|
183
|
+
fullWidth,
|
|
184
|
+
required,
|
|
185
|
+
color,
|
|
186
|
+
variant
|
|
187
|
+
}
|
|
188
|
+
});
|
|
170
189
|
const [InputSlot, inputProps] = (0, _useSlot.default)('input', {
|
|
171
190
|
elementType: InputComponent,
|
|
172
191
|
externalForwardedProps,
|
|
@@ -218,17 +237,8 @@ const TextField = /*#__PURE__*/React.forwardRef(function TextField(inProps, ref)
|
|
|
218
237
|
},
|
|
219
238
|
...inputProps
|
|
220
239
|
});
|
|
221
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
222
|
-
|
|
223
|
-
disabled: disabled,
|
|
224
|
-
error: error,
|
|
225
|
-
fullWidth: fullWidth,
|
|
226
|
-
ref: ref,
|
|
227
|
-
required: required,
|
|
228
|
-
color: color,
|
|
229
|
-
variant: variant,
|
|
230
|
-
ownerState: ownerState,
|
|
231
|
-
...other,
|
|
240
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(RootSlot, {
|
|
241
|
+
...rootProps,
|
|
232
242
|
children: [label != null && label !== '' && /*#__PURE__*/(0, _jsxRuntime.jsx)(InputLabelSlot, {
|
|
233
243
|
htmlFor: id,
|
|
234
244
|
id: inputLabelId,
|
|
@@ -430,6 +440,7 @@ process.env.NODE_ENV !== "production" ? TextField.propTypes /* remove-proptypes
|
|
|
430
440
|
htmlInput: _propTypes.default.elementType,
|
|
431
441
|
input: _propTypes.default.elementType,
|
|
432
442
|
inputLabel: _propTypes.default.elementType,
|
|
443
|
+
root: _propTypes.default.elementType,
|
|
433
444
|
select: _propTypes.default.elementType
|
|
434
445
|
}),
|
|
435
446
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
4
4
|
var _InputGlobalStyles;
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
@@ -372,7 +372,7 @@ const InputBase = /*#__PURE__*/React.forwardRef(function InputBase(inProps, ref)
|
|
|
372
372
|
if (!isControlled) {
|
|
373
373
|
const element = event.target || inputRef.current;
|
|
374
374
|
if (element == null) {
|
|
375
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Expected valid input target. ' + 'Did you use a custom `inputComponent` and forget to forward refs? ' + 'See https://mui.com/r/input-component-ref-interface for more info.' :
|
|
375
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Expected valid input target. ' + 'Did you use a custom `inputComponent` and forget to forward refs? ' + 'See https://mui.com/r/input-component-ref-interface for more info.' : _formatErrorMessage(1));
|
|
376
376
|
}
|
|
377
377
|
checkDirty({
|
|
378
378
|
value: element.value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
|
|
4
4
|
var _span;
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import { isFragment } from 'react-is';
|
|
@@ -348,7 +348,7 @@ const SelectInput = /*#__PURE__*/React.forwardRef(function SelectInput(props, re
|
|
|
348
348
|
let selected;
|
|
349
349
|
if (multiple) {
|
|
350
350
|
if (!Array.isArray(value)) {
|
|
351
|
-
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' :
|
|
351
|
+
throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `value` prop must be an array ' + 'when using the `Select` component with `multiple`.' : _formatErrorMessage(2));
|
|
352
352
|
}
|
|
353
353
|
selected = value.some(v => areEqualValues(v, child.props.value));
|
|
354
354
|
if (selected && computeDisplay) {
|
|
@@ -6,6 +6,11 @@ import { Theme } from "../styles/index.js";
|
|
|
6
6
|
import { StepLabelClasses } from "./stepLabelClasses.js";
|
|
7
7
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
8
8
|
export interface StepLabelSlots {
|
|
9
|
+
/**
|
|
10
|
+
* The component that renders the root.
|
|
11
|
+
* @default span
|
|
12
|
+
*/
|
|
13
|
+
root: React.ElementType;
|
|
9
14
|
/**
|
|
10
15
|
* The component that renders the label.
|
|
11
16
|
* @default span
|
|
@@ -17,7 +22,20 @@ export interface StepLabelSlots {
|
|
|
17
22
|
stepIcon: React.ElementType;
|
|
18
23
|
}
|
|
19
24
|
export type StepLabelSlotsAndSlotProps = CreateSlotsAndSlotProps<StepLabelSlots, {
|
|
20
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to the root slot.
|
|
27
|
+
* By default, the avaible props are based on the span element.
|
|
28
|
+
*/
|
|
29
|
+
root: SlotProps<'span', {}, StepLabelOwnerState>;
|
|
30
|
+
/**
|
|
31
|
+
* Props forwarded to the label slot.
|
|
32
|
+
* By default, the avaible props are based on the span element.
|
|
33
|
+
*/
|
|
34
|
+
label: SlotProps<'span', {}, StepLabelOwnerState>;
|
|
35
|
+
/**
|
|
36
|
+
* Props forwarded to the stepIcon slot.
|
|
37
|
+
* By default, the avaible props are based on the div element.
|
|
38
|
+
*/
|
|
21
39
|
stepIcon: SlotProps<React.ElementType<StepIconProps>, {}, StepLabelOwnerState>;
|
|
22
40
|
}>;
|
|
23
41
|
export interface StepLabelOwnerState extends StepLabelProps {}
|
|
@@ -162,6 +162,16 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
|
|
|
162
162
|
...slotProps
|
|
163
163
|
}
|
|
164
164
|
};
|
|
165
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
166
|
+
elementType: StepLabelRoot,
|
|
167
|
+
externalForwardedProps: {
|
|
168
|
+
...externalForwardedProps,
|
|
169
|
+
...other
|
|
170
|
+
},
|
|
171
|
+
ownerState,
|
|
172
|
+
ref,
|
|
173
|
+
className: clsx(classes.root, className)
|
|
174
|
+
});
|
|
165
175
|
const [LabelSlot, labelProps] = useSlot('label', {
|
|
166
176
|
elementType: StepLabelLabel,
|
|
167
177
|
externalForwardedProps,
|
|
@@ -172,11 +182,8 @@ const StepLabel = /*#__PURE__*/React.forwardRef(function StepLabel(inProps, ref)
|
|
|
172
182
|
externalForwardedProps,
|
|
173
183
|
ownerState
|
|
174
184
|
});
|
|
175
|
-
return /*#__PURE__*/_jsxs(
|
|
176
|
-
|
|
177
|
-
ref: ref,
|
|
178
|
-
ownerState: ownerState,
|
|
179
|
-
...other,
|
|
185
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
186
|
+
...rootProps,
|
|
180
187
|
children: [icon || StepIconSlot ? /*#__PURE__*/_jsx(StepLabelIconContainer, {
|
|
181
188
|
className: classes.iconContainer,
|
|
182
189
|
ownerState: ownerState,
|
|
@@ -242,6 +249,7 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes /* remove-proptypes
|
|
|
242
249
|
*/
|
|
243
250
|
slotProps: PropTypes.shape({
|
|
244
251
|
label: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
252
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
245
253
|
stepIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
246
254
|
}),
|
|
247
255
|
/**
|
|
@@ -250,6 +258,7 @@ process.env.NODE_ENV !== "production" ? StepLabel.propTypes /* remove-proptypes
|
|
|
250
258
|
*/
|
|
251
259
|
slots: PropTypes.shape({
|
|
252
260
|
label: PropTypes.elementType,
|
|
261
|
+
root: PropTypes.elementType,
|
|
253
262
|
stepIcon: PropTypes.elementType
|
|
254
263
|
}),
|
|
255
264
|
/**
|
package/esm/Switch/Switch.d.ts
CHANGED
|
@@ -2,11 +2,72 @@ import * as React from 'react';
|
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
3
|
import { OverridableStringUnion } from '@mui/types';
|
|
4
4
|
import { InternalStandardProps as StandardProps, Theme } from "../index.js";
|
|
5
|
+
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
5
6
|
import { SwitchBaseProps } from "../internal/SwitchBase.js";
|
|
6
7
|
import { SwitchClasses } from "./switchClasses.js";
|
|
7
8
|
export interface SwitchPropsSizeOverrides {}
|
|
8
9
|
export interface SwitchPropsColorOverrides {}
|
|
9
|
-
export interface
|
|
10
|
+
export interface SwitchRootSlotPropsOverrides {}
|
|
11
|
+
export interface SwitchTrackSlotPropsOverrides {}
|
|
12
|
+
export interface SwitchThumbSlotPropsOverrides {}
|
|
13
|
+
export interface SwitchSwitchBaseSlotPropsOverrides {}
|
|
14
|
+
export interface SwitchInputSlotPropsOverrides {}
|
|
15
|
+
export interface SwitchSlots {
|
|
16
|
+
/**
|
|
17
|
+
* The component that renders the root slot.
|
|
18
|
+
* @default 'span'
|
|
19
|
+
*/
|
|
20
|
+
root: React.ElementType;
|
|
21
|
+
/**
|
|
22
|
+
* The component that renders the track slot.
|
|
23
|
+
* @default 'span'
|
|
24
|
+
*/
|
|
25
|
+
track: React.ElementType;
|
|
26
|
+
/**
|
|
27
|
+
* The component that renders the thumb slot.
|
|
28
|
+
* @default 'span'
|
|
29
|
+
*/
|
|
30
|
+
thumb: React.ElementType;
|
|
31
|
+
/**
|
|
32
|
+
* The component that renders the switchBase slot.
|
|
33
|
+
* @default SwitchBase
|
|
34
|
+
*/
|
|
35
|
+
switchBase: React.ElementType;
|
|
36
|
+
/**
|
|
37
|
+
* The component that renders the switchBase's input slot.
|
|
38
|
+
* @default SwitchBaseInput
|
|
39
|
+
*/
|
|
40
|
+
input: React.ElementType;
|
|
41
|
+
}
|
|
42
|
+
export type SwitchSlotsAndSlotProps = CreateSlotsAndSlotProps<SwitchSlots, {
|
|
43
|
+
/**
|
|
44
|
+
* Props forwarded to the root slot.
|
|
45
|
+
* By default, the avaible props are based on the span element.
|
|
46
|
+
*/
|
|
47
|
+
root: SlotProps<'span', SwitchRootSlotPropsOverrides, SwitchOwnerState>;
|
|
48
|
+
/**
|
|
49
|
+
* Props forwarded to the track slot.
|
|
50
|
+
* By default, the avaible props are based on the span element.
|
|
51
|
+
*/
|
|
52
|
+
track: SlotProps<'span', SwitchTrackSlotPropsOverrides, SwitchOwnerState>;
|
|
53
|
+
/**
|
|
54
|
+
* Props forwarded to the thumb slot.
|
|
55
|
+
* By default, the avaible props are based on the span element.
|
|
56
|
+
*/
|
|
57
|
+
thumb: SlotProps<'span', SwitchThumbSlotPropsOverrides, SwitchOwnerState>;
|
|
58
|
+
/**
|
|
59
|
+
* Props forwarded to the switchBase slot.
|
|
60
|
+
* By default, the avaible props are based on the internal SwitchBase component.
|
|
61
|
+
*/
|
|
62
|
+
switchBase: SlotProps<React.ElementType<SwitchBaseProps>, SwitchSwitchBaseSlotPropsOverrides, SwitchOwnerState>;
|
|
63
|
+
/**
|
|
64
|
+
* Props forwarded to the input slot.
|
|
65
|
+
* By default, the avaible props are based on the input element.
|
|
66
|
+
*/
|
|
67
|
+
input: SlotProps<'input', SwitchInputSlotPropsOverrides, SwitchOwnerState>;
|
|
68
|
+
}>;
|
|
69
|
+
export interface SwitchOwnerState extends Omit<SwitchProps, 'slots' | 'slotProps'> {}
|
|
70
|
+
export interface SwitchProps extends StandardProps<SwitchBaseProps, 'checkedIcon' | 'color' | 'icon' | 'slots' | 'slotProps'>, SwitchSlotsAndSlotProps {
|
|
10
71
|
/**
|
|
11
72
|
* The icon to display when the component is checked.
|
|
12
73
|
*/
|