@mui/material 7.0.0-beta.3 → 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/Accordion/Accordion.d.ts +13 -2
- package/Accordion/Accordion.js +18 -6
- package/AccordionSummary/AccordionSummary.d.ts +39 -4
- package/AccordionSummary/AccordionSummary.js +67 -16
- package/CHANGELOG.md +84 -0
- package/InputBase/InputBase.js +2 -2
- package/ListItemText/ListItemText.d.ts +10 -0
- package/ListItemText/ListItemText.js +14 -5
- package/Select/SelectInput.js +2 -2
- package/SpeedDial/SpeedDial.d.ts +10 -0
- package/SpeedDial/SpeedDial.js +40 -11
- package/SpeedDialAction/SpeedDialAction.js +1 -1
- 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/TextareaAutosize/TextareaAutosize.js +25 -14
- package/Tooltip/Tooltip.d.ts +1 -1
- package/Tooltip/Tooltip.js +1 -1
- package/Typography/Typography.d.ts +3 -3
- package/esm/Accordion/Accordion.d.ts +13 -2
- package/esm/Accordion/Accordion.js +18 -6
- package/esm/AccordionSummary/AccordionSummary.d.ts +39 -4
- package/esm/AccordionSummary/AccordionSummary.js +67 -16
- package/esm/InputBase/InputBase.js +2 -2
- package/esm/ListItemText/ListItemText.d.ts +10 -0
- package/esm/ListItemText/ListItemText.js +14 -5
- package/esm/Select/SelectInput.js +2 -2
- package/esm/SpeedDial/SpeedDial.d.ts +10 -0
- package/esm/SpeedDial/SpeedDial.js +40 -11
- package/esm/SpeedDialAction/SpeedDialAction.js +1 -1
- 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/TextareaAutosize/TextareaAutosize.js +26 -15
- package/esm/Tooltip/Tooltip.d.ts +1 -1
- package/esm/Tooltip/Tooltip.js +1 -1
- package/esm/Typography/Typography.d.ts +3 -3
- package/esm/index.js +1 -1
- package/esm/styles/ThemeProvider.d.ts +6 -0
- package/esm/styles/ThemeProvider.js +11 -0
- package/esm/styles/adaptV4Theme.d.ts +2 -2
- package/esm/styles/createPalette.js +3 -3
- package/esm/styles/createThemeNoVars.d.ts +3 -3
- package/esm/styles/createThemeNoVars.js +2 -2
- package/esm/styles/createThemeWithVars.js +2 -2
- package/esm/styles/createTypography.d.ts +4 -4
- package/esm/styles/index.d.ts +1 -1
- package/esm/styles/index.js +2 -2
- package/esm/styles/makeStyles.js +2 -2
- package/esm/styles/responsiveFontSizes.d.ts +3 -3
- package/esm/styles/responsiveFontSizes.js +2 -2
- package/esm/styles/withStyles.js +2 -2
- package/esm/styles/withTheme.js +2 -2
- package/esm/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/esm/useScrollTrigger/useScrollTrigger.js +3 -0
- package/esm/utils/mergeSlotProps.js +25 -0
- package/esm/version/index.js +2 -2
- package/index.js +1 -1
- package/modern/Accordion/Accordion.d.ts +13 -2
- package/modern/Accordion/Accordion.js +18 -6
- package/modern/AccordionSummary/AccordionSummary.d.ts +39 -4
- package/modern/AccordionSummary/AccordionSummary.js +67 -16
- package/modern/InputBase/InputBase.js +2 -2
- package/modern/ListItemText/ListItemText.d.ts +10 -0
- package/modern/ListItemText/ListItemText.js +14 -5
- package/modern/Select/SelectInput.js +2 -2
- package/modern/SpeedDial/SpeedDial.d.ts +10 -0
- package/modern/SpeedDial/SpeedDial.js +40 -11
- package/modern/SpeedDialAction/SpeedDialAction.js +1 -1
- 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/TextareaAutosize/TextareaAutosize.js +26 -15
- package/modern/Tooltip/Tooltip.d.ts +1 -1
- package/modern/Tooltip/Tooltip.js +1 -1
- package/modern/Typography/Typography.d.ts +3 -3
- package/modern/index.js +1 -1
- package/modern/styles/ThemeProvider.d.ts +6 -0
- package/modern/styles/ThemeProvider.js +11 -0
- package/modern/styles/adaptV4Theme.d.ts +2 -2
- package/modern/styles/createPalette.js +3 -3
- package/modern/styles/createThemeNoVars.d.ts +3 -3
- package/modern/styles/createThemeNoVars.js +2 -2
- package/modern/styles/createThemeWithVars.js +2 -2
- package/modern/styles/createTypography.d.ts +4 -4
- package/modern/styles/index.d.ts +1 -1
- package/modern/styles/index.js +2 -2
- package/modern/styles/makeStyles.js +2 -2
- package/modern/styles/responsiveFontSizes.d.ts +3 -3
- package/modern/styles/responsiveFontSizes.js +2 -2
- package/modern/styles/withStyles.js +2 -2
- package/modern/styles/withTheme.js +2 -2
- package/modern/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/modern/useScrollTrigger/useScrollTrigger.js +3 -0
- package/modern/utils/mergeSlotProps.js +25 -0
- package/modern/version/index.js +2 -2
- package/package.json +7 -7
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProvider.js +11 -0
- package/styles/adaptV4Theme.d.ts +2 -2
- package/styles/createPalette.js +3 -3
- package/styles/createThemeNoVars.d.ts +3 -3
- package/styles/createThemeNoVars.js +2 -2
- package/styles/createThemeWithVars.js +2 -2
- package/styles/createTypography.d.ts +4 -4
- package/styles/index.d.ts +1 -1
- package/styles/index.js +2 -2
- package/styles/makeStyles.js +2 -2
- package/styles/responsiveFontSizes.d.ts +3 -3
- 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/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/useScrollTrigger/useScrollTrigger.js +3 -0
- package/utils/mergeSlotProps.js +24 -0
- package/version/index.js +2 -2
|
@@ -10,6 +10,7 @@ import { useDefaultProps } from "../DefaultPropsProvider/index.js";
|
|
|
10
10
|
import ButtonBase from "../ButtonBase/index.js";
|
|
11
11
|
import AccordionContext from "../Accordion/AccordionContext.js";
|
|
12
12
|
import accordionSummaryClasses, { getAccordionSummaryUtilityClass } from "./accordionSummaryClasses.js";
|
|
13
|
+
import useSlot from "../utils/useSlot.js";
|
|
13
14
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
15
|
const useUtilityClasses = ownerState => {
|
|
15
16
|
const {
|
|
@@ -112,6 +113,8 @@ const AccordionSummary = /*#__PURE__*/React.forwardRef(function AccordionSummary
|
|
|
112
113
|
expandIcon,
|
|
113
114
|
focusVisibleClassName,
|
|
114
115
|
onClick,
|
|
116
|
+
slots,
|
|
117
|
+
slotProps,
|
|
115
118
|
...other
|
|
116
119
|
} = props;
|
|
117
120
|
const {
|
|
@@ -135,24 +138,54 @@ const AccordionSummary = /*#__PURE__*/React.forwardRef(function AccordionSummary
|
|
|
135
138
|
disableGutters
|
|
136
139
|
};
|
|
137
140
|
const classes = useUtilityClasses(ownerState);
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
const externalForwardedProps = {
|
|
142
|
+
slots,
|
|
143
|
+
slotProps
|
|
144
|
+
};
|
|
145
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
146
|
+
ref,
|
|
147
|
+
shouldForwardComponentProp: true,
|
|
143
148
|
className: clsx(classes.root, className),
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
elementType: AccordionSummaryRoot,
|
|
150
|
+
externalForwardedProps: {
|
|
151
|
+
...externalForwardedProps,
|
|
152
|
+
...other
|
|
153
|
+
},
|
|
154
|
+
ownerState,
|
|
155
|
+
additionalProps: {
|
|
156
|
+
focusRipple: false,
|
|
157
|
+
disableRipple: true,
|
|
158
|
+
disabled,
|
|
159
|
+
'aria-expanded': expanded,
|
|
160
|
+
focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName)
|
|
161
|
+
},
|
|
162
|
+
getSlotProps: handlers => ({
|
|
163
|
+
...handlers,
|
|
164
|
+
onClick: event => {
|
|
165
|
+
handlers.onClick?.(event);
|
|
166
|
+
handleChange(event);
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
});
|
|
170
|
+
const [ContentSlot, contentSlotProps] = useSlot('content', {
|
|
171
|
+
className: classes.content,
|
|
172
|
+
elementType: AccordionSummaryContent,
|
|
173
|
+
externalForwardedProps,
|
|
174
|
+
ownerState
|
|
175
|
+
});
|
|
176
|
+
const [ExpandIconWrapperSlot, expandIconWrapperSlotProps] = useSlot('expandIconWrapper', {
|
|
177
|
+
className: classes.expandIconWrapper,
|
|
178
|
+
elementType: AccordionSummaryExpandIconWrapper,
|
|
179
|
+
externalForwardedProps,
|
|
180
|
+
ownerState
|
|
181
|
+
});
|
|
182
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
183
|
+
...rootSlotProps,
|
|
184
|
+
children: [/*#__PURE__*/_jsx(ContentSlot, {
|
|
185
|
+
...contentSlotProps,
|
|
152
186
|
children: children
|
|
153
|
-
}), expandIcon && /*#__PURE__*/_jsx(
|
|
154
|
-
|
|
155
|
-
ownerState: ownerState,
|
|
187
|
+
}), expandIcon && /*#__PURE__*/_jsx(ExpandIconWrapperSlot, {
|
|
188
|
+
...expandIconWrapperSlotProps,
|
|
156
189
|
children: expandIcon
|
|
157
190
|
})]
|
|
158
191
|
});
|
|
@@ -191,6 +224,24 @@ process.env.NODE_ENV !== "production" ? AccordionSummary.propTypes /* remove-pro
|
|
|
191
224
|
* @ignore
|
|
192
225
|
*/
|
|
193
226
|
onClick: PropTypes.func,
|
|
227
|
+
/**
|
|
228
|
+
* The props used for each slot inside.
|
|
229
|
+
* @default {}
|
|
230
|
+
*/
|
|
231
|
+
slotProps: PropTypes.shape({
|
|
232
|
+
content: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
233
|
+
expandIconWrapper: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
234
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
235
|
+
}),
|
|
236
|
+
/**
|
|
237
|
+
* The components used for each slot inside.
|
|
238
|
+
* @default {}
|
|
239
|
+
*/
|
|
240
|
+
slots: PropTypes.shape({
|
|
241
|
+
content: PropTypes.elementType,
|
|
242
|
+
expandIconWrapper: PropTypes.elementType,
|
|
243
|
+
root: PropTypes.elementType
|
|
244
|
+
}),
|
|
194
245
|
/**
|
|
195
246
|
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
196
247
|
*/
|
|
@@ -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
|
|
@@ -5,6 +5,11 @@ import { TypographyProps } from "../Typography/index.js";
|
|
|
5
5
|
import { ListItemTextClasses } from "./listItemTextClasses.js";
|
|
6
6
|
import { CreateSlotsAndSlotProps, SlotProps } from "../utils/types.js";
|
|
7
7
|
export interface ListItemTextSlots {
|
|
8
|
+
/**
|
|
9
|
+
* The component that renders the root slot.
|
|
10
|
+
* @default 'div'
|
|
11
|
+
*/
|
|
12
|
+
root?: React.ElementType;
|
|
8
13
|
/**
|
|
9
14
|
* The component that renders the primary slot.
|
|
10
15
|
* @default Typography
|
|
@@ -17,6 +22,11 @@ export interface ListItemTextSlots {
|
|
|
17
22
|
secondary?: React.ElementType;
|
|
18
23
|
}
|
|
19
24
|
export type ListItemTextSlotsAndSlotProps = CreateSlotsAndSlotProps<ListItemTextSlots, {
|
|
25
|
+
/**
|
|
26
|
+
* Props forwared to the root slot.
|
|
27
|
+
* By default, the available props are based on `div` element.
|
|
28
|
+
*/
|
|
29
|
+
root: SlotProps<'div', {}, ListItemTextOwnerState>;
|
|
20
30
|
/**
|
|
21
31
|
* Props forwared to the primary slot (as long as disableTypography is not `true`)
|
|
22
32
|
* By default, the available props are based on the [Typography](https://mui.com/material-ui/api/typography/#props) component
|
|
@@ -107,6 +107,16 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
|
|
|
107
107
|
...slotProps
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
111
|
+
className: clsx(classes.root, className),
|
|
112
|
+
elementType: ListItemTextRoot,
|
|
113
|
+
externalForwardedProps: {
|
|
114
|
+
...externalForwardedProps,
|
|
115
|
+
...other
|
|
116
|
+
},
|
|
117
|
+
ownerState,
|
|
118
|
+
ref
|
|
119
|
+
});
|
|
110
120
|
const [PrimarySlot, primarySlotProps] = useSlot('primary', {
|
|
111
121
|
className: classes.primary,
|
|
112
122
|
elementType: Typography,
|
|
@@ -135,11 +145,8 @@ const ListItemText = /*#__PURE__*/React.forwardRef(function ListItemText(inProps
|
|
|
135
145
|
children: secondary
|
|
136
146
|
});
|
|
137
147
|
}
|
|
138
|
-
return /*#__PURE__*/_jsxs(
|
|
139
|
-
|
|
140
|
-
ownerState: ownerState,
|
|
141
|
-
ref: ref,
|
|
142
|
-
...other,
|
|
148
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
149
|
+
...rootSlotProps,
|
|
143
150
|
children: [primary, secondary]
|
|
144
151
|
});
|
|
145
152
|
});
|
|
@@ -200,6 +207,7 @@ process.env.NODE_ENV !== "production" ? ListItemText.propTypes /* remove-proptyp
|
|
|
200
207
|
*/
|
|
201
208
|
slotProps: PropTypes.shape({
|
|
202
209
|
primary: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
210
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
203
211
|
secondary: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
204
212
|
}),
|
|
205
213
|
/**
|
|
@@ -208,6 +216,7 @@ process.env.NODE_ENV !== "production" ? ListItemText.propTypes /* remove-proptyp
|
|
|
208
216
|
*/
|
|
209
217
|
slots: PropTypes.shape({
|
|
210
218
|
primary: PropTypes.elementType,
|
|
219
|
+
root: PropTypes.elementType,
|
|
211
220
|
secondary: PropTypes.elementType
|
|
212
221
|
}),
|
|
213
222
|
/**
|
|
@@ -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) {
|
|
@@ -9,6 +9,11 @@ import { CreateSlotsAndSlotProps, SlotComponentProps } from "../utils/types.js";
|
|
|
9
9
|
export type CloseReason = 'toggle' | 'blur' | 'mouseLeave' | 'escapeKeyDown';
|
|
10
10
|
export type OpenReason = 'toggle' | 'focus' | 'mouseEnter';
|
|
11
11
|
export interface SpeedDialSlots {
|
|
12
|
+
/**
|
|
13
|
+
* The component that renders the root slot.
|
|
14
|
+
* @default 'div'
|
|
15
|
+
*/
|
|
16
|
+
root: React.ElementType;
|
|
12
17
|
/**
|
|
13
18
|
* The component that renders the transition.
|
|
14
19
|
* [Follow this guide](https://mui.com/material-ui/transitions/#transitioncomponent-prop) to learn more about the requirements for this component.
|
|
@@ -17,6 +22,11 @@ export interface SpeedDialSlots {
|
|
|
17
22
|
transition: React.ElementType;
|
|
18
23
|
}
|
|
19
24
|
export type SpeedDialSlotsAndSlotProps = CreateSlotsAndSlotProps<SpeedDialSlots, {
|
|
25
|
+
/**
|
|
26
|
+
* Props forwarded to the root slot.
|
|
27
|
+
* By default, the avaible props are based on div element.
|
|
28
|
+
*/
|
|
29
|
+
root: SlotComponentProps<'div', React.HTMLAttributes<HTMLDivElement>, SpeedDialOwnerState>;
|
|
20
30
|
/**
|
|
21
31
|
* Props forwarded to the transition slot.
|
|
22
32
|
* By default, the avaible props are based on the [Zoom](https://mui.com/material-ui/api/zoom/#props) component.
|
|
@@ -372,22 +372,49 @@ const SpeedDial = /*#__PURE__*/React.forwardRef(function SpeedDial(inProps, ref)
|
|
|
372
372
|
slots: backwardCompatibleSlots,
|
|
373
373
|
slotProps: backwardCompatibleSlotProps
|
|
374
374
|
};
|
|
375
|
+
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
376
|
+
elementType: SpeedDialRoot,
|
|
377
|
+
externalForwardedProps: {
|
|
378
|
+
...externalForwardedProps,
|
|
379
|
+
...other
|
|
380
|
+
},
|
|
381
|
+
ownerState,
|
|
382
|
+
ref,
|
|
383
|
+
className: clsx(classes.root, className),
|
|
384
|
+
additionalProps: {
|
|
385
|
+
role: 'presentation'
|
|
386
|
+
},
|
|
387
|
+
getSlotProps: handlers => ({
|
|
388
|
+
...handlers,
|
|
389
|
+
onKeyDown: event => {
|
|
390
|
+
handlers.onKeyDown?.(event);
|
|
391
|
+
handleKeyDown(event);
|
|
392
|
+
},
|
|
393
|
+
onBlur: event => {
|
|
394
|
+
handlers.onBlur?.(event);
|
|
395
|
+
handleClose(event);
|
|
396
|
+
},
|
|
397
|
+
onFocus: event => {
|
|
398
|
+
handlers.onFocus?.(event);
|
|
399
|
+
handleOpen(event);
|
|
400
|
+
},
|
|
401
|
+
onMouseEnter: event => {
|
|
402
|
+
handlers.onMouseEnter?.(event);
|
|
403
|
+
handleOpen(event);
|
|
404
|
+
},
|
|
405
|
+
onMouseLeave: event => {
|
|
406
|
+
handlers.onMouseLeave?.(event);
|
|
407
|
+
handleClose(event);
|
|
408
|
+
}
|
|
409
|
+
})
|
|
410
|
+
});
|
|
375
411
|
const [TransitionSlot, transitionProps] = useSlot('transition', {
|
|
376
412
|
elementType: Zoom,
|
|
377
413
|
externalForwardedProps,
|
|
378
414
|
ownerState
|
|
379
415
|
});
|
|
380
|
-
return /*#__PURE__*/_jsxs(
|
|
381
|
-
|
|
382
|
-
ref: ref,
|
|
383
|
-
role: "presentation",
|
|
384
|
-
onKeyDown: handleKeyDown,
|
|
385
|
-
onBlur: handleClose,
|
|
386
|
-
onFocus: handleOpen,
|
|
387
|
-
onMouseEnter: handleOpen,
|
|
388
|
-
onMouseLeave: handleClose,
|
|
389
|
-
ownerState: ownerState,
|
|
390
|
-
...other,
|
|
416
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
417
|
+
...rootSlotProps,
|
|
391
418
|
children: [/*#__PURE__*/_jsx(TransitionSlot, {
|
|
392
419
|
in: !hidden,
|
|
393
420
|
timeout: transitionDuration,
|
|
@@ -507,6 +534,7 @@ process.env.NODE_ENV !== "production" ? SpeedDial.propTypes /* remove-proptypes
|
|
|
507
534
|
* @default {}
|
|
508
535
|
*/
|
|
509
536
|
slotProps: PropTypes.shape({
|
|
537
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
510
538
|
transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
511
539
|
}),
|
|
512
540
|
/**
|
|
@@ -514,6 +542,7 @@ process.env.NODE_ENV !== "production" ? SpeedDial.propTypes /* remove-proptypes
|
|
|
514
542
|
* @default {}
|
|
515
543
|
*/
|
|
516
544
|
slots: PropTypes.shape({
|
|
545
|
+
root: PropTypes.elementType,
|
|
517
546
|
transition: PropTypes.elementType
|
|
518
547
|
}),
|
|
519
548
|
/**
|
|
@@ -341,7 +341,7 @@ process.env.NODE_ENV !== "production" ? SpeedDialAction.propTypes /* remove-prop
|
|
|
341
341
|
* @default 'left'
|
|
342
342
|
* @deprecated Use `slotProps.tooltip.placement` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
343
343
|
*/
|
|
344
|
-
tooltipPlacement: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
344
|
+
tooltipPlacement: PropTypes.oneOf(['auto-end', 'auto-start', 'auto', 'bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
345
345
|
/**
|
|
346
346
|
* Label to display in the tooltip.
|
|
347
347
|
* @deprecated Use `slotProps.tooltip.title` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
@@ -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
|
/**
|
|
@@ -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/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,
|