@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
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
|
/**
|
|
@@ -119,6 +119,15 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
119
119
|
overflowing
|
|
120
120
|
};
|
|
121
121
|
}, [maxRows, minRows, props.placeholder]);
|
|
122
|
+
const didHeightChange = (0, _utils.unstable_useEventCallback)(() => {
|
|
123
|
+
const textarea = textareaRef.current;
|
|
124
|
+
const textareaStyles = calculateTextareaStyles();
|
|
125
|
+
if (!textarea || !textareaStyles || isEmpty(textareaStyles)) {
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
const outerHeightStyle = textareaStyles.outerHeightStyle;
|
|
129
|
+
return heightRef.current != null && heightRef.current !== outerHeightStyle;
|
|
130
|
+
});
|
|
122
131
|
const syncHeight = React.useCallback(() => {
|
|
123
132
|
const textarea = textareaRef.current;
|
|
124
133
|
const textareaStyles = calculateTextareaStyles();
|
|
@@ -134,37 +143,39 @@ const TextareaAutosize = /*#__PURE__*/React.forwardRef(function TextareaAutosize
|
|
|
134
143
|
}, [calculateTextareaStyles]);
|
|
135
144
|
const frameRef = React.useRef(-1);
|
|
136
145
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
137
|
-
const
|
|
146
|
+
const debouncedHandleResize = (0, _utils.unstable_debounce)(syncHeight);
|
|
138
147
|
const textarea = textareaRef?.current;
|
|
139
148
|
if (!textarea) {
|
|
140
149
|
return undefined;
|
|
141
150
|
}
|
|
142
151
|
const containerWindow = (0, _utils.unstable_ownerWindow)(textarea);
|
|
143
|
-
containerWindow.addEventListener('resize',
|
|
152
|
+
containerWindow.addEventListener('resize', debouncedHandleResize);
|
|
144
153
|
let resizeObserver;
|
|
145
154
|
if (typeof ResizeObserver !== 'undefined') {
|
|
146
155
|
resizeObserver = new ResizeObserver(() => {
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
+
if (didHeightChange()) {
|
|
157
|
+
// avoid "ResizeObserver loop completed with undelivered notifications" error
|
|
158
|
+
// by temporarily unobserving the textarea element while manipulating the height
|
|
159
|
+
// and reobserving one frame later
|
|
160
|
+
resizeObserver.unobserve(textarea);
|
|
161
|
+
cancelAnimationFrame(frameRef.current);
|
|
162
|
+
syncHeight();
|
|
163
|
+
frameRef.current = requestAnimationFrame(() => {
|
|
164
|
+
resizeObserver.observe(textarea);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
156
167
|
});
|
|
157
168
|
resizeObserver.observe(textarea);
|
|
158
169
|
}
|
|
159
170
|
return () => {
|
|
160
|
-
|
|
171
|
+
debouncedHandleResize.clear();
|
|
161
172
|
cancelAnimationFrame(frameRef.current);
|
|
162
|
-
containerWindow.removeEventListener('resize',
|
|
173
|
+
containerWindow.removeEventListener('resize', debouncedHandleResize);
|
|
163
174
|
if (resizeObserver) {
|
|
164
175
|
resizeObserver.disconnect();
|
|
165
176
|
}
|
|
166
177
|
};
|
|
167
|
-
}, [calculateTextareaStyles, syncHeight]);
|
|
178
|
+
}, [calculateTextareaStyles, syncHeight, didHeightChange]);
|
|
168
179
|
(0, _utils.unstable_useEnhancedEffect)(() => {
|
|
169
180
|
syncHeight();
|
|
170
181
|
});
|
package/Tooltip/Tooltip.d.ts
CHANGED
|
@@ -178,7 +178,7 @@ export interface TooltipProps extends StandardProps<React.HTMLAttributes<HTMLDiv
|
|
|
178
178
|
* Tooltip placement.
|
|
179
179
|
* @default 'bottom'
|
|
180
180
|
*/
|
|
181
|
-
placement?: '
|
|
181
|
+
placement?: PopperProps['placement'];
|
|
182
182
|
/**
|
|
183
183
|
* The component used for the popper.
|
|
184
184
|
* @deprecated use the `slots.popper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
package/Tooltip/Tooltip.js
CHANGED
|
@@ -849,7 +849,7 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes /* remove-proptypes */
|
|
|
849
849
|
* Tooltip placement.
|
|
850
850
|
* @default 'bottom'
|
|
851
851
|
*/
|
|
852
|
-
placement: _propTypes.default.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
|
|
852
|
+
placement: _propTypes.default.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']),
|
|
853
853
|
/**
|
|
854
854
|
* The component used for the popper.
|
|
855
855
|
* @deprecated use the `slots.popper` prop instead. This prop will be removed in v7. See [Migrating from deprecated APIs](https://mui.com/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
@@ -3,7 +3,7 @@ import { OverridableStringUnion } from '@mui/types';
|
|
|
3
3
|
import { SxProps, SystemProps } from '@mui/system';
|
|
4
4
|
import { Theme, TypeText } from "../styles/index.js";
|
|
5
5
|
import { OverrideProps, OverridableComponent } from "../OverridableComponent/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { TypographyVariant } from "../styles/createTypography.js";
|
|
7
7
|
import { TypographyClasses } from "./typographyClasses.js";
|
|
8
8
|
export interface TypographyPropsVariantOverrides {}
|
|
9
9
|
export interface TypographyPropsColorOverrides {}
|
|
@@ -54,7 +54,7 @@ export interface TypographyOwnProps extends Omit<SystemProps<Theme>, 'color'> {
|
|
|
54
54
|
* Applies the theme typography styles.
|
|
55
55
|
* @default 'body1'
|
|
56
56
|
*/
|
|
57
|
-
variant?: OverridableStringUnion<
|
|
57
|
+
variant?: OverridableStringUnion<TypographyVariant | 'inherit', TypographyPropsVariantOverrides>;
|
|
58
58
|
/**
|
|
59
59
|
* The component maps the variant prop to a range of different HTML element types.
|
|
60
60
|
* For instance, subtitle1 to `<h6>`.
|
|
@@ -74,7 +74,7 @@ export interface TypographyOwnProps extends Omit<SystemProps<Theme>, 'color'> {
|
|
|
74
74
|
* inherit: 'p',
|
|
75
75
|
* }
|
|
76
76
|
*/
|
|
77
|
-
variantMapping?: Partial<Record<OverridableStringUnion<
|
|
77
|
+
variantMapping?: Partial<Record<OverridableStringUnion<TypographyVariant | 'inherit', TypographyPropsVariantOverrides>, string>>;
|
|
78
78
|
}
|
|
79
79
|
export interface TypographyTypeMap<AdditionalProps = {}, RootComponent extends React.ElementType = 'span'> {
|
|
80
80
|
props: AdditionalProps & TypographyOwnProps;
|
|
@@ -4,9 +4,14 @@ import { Theme } from "../index.js";
|
|
|
4
4
|
import { TransitionProps } from "../transitions/transition.js";
|
|
5
5
|
import { AccordionClasses } from "./accordionClasses.js";
|
|
6
6
|
import { OverridableComponent, OverrideProps } from "../OverridableComponent/index.js";
|
|
7
|
-
import { ExtendPaperTypeMap } from "../Paper/Paper.js";
|
|
7
|
+
import { ExtendPaperTypeMap, PaperProps } from "../Paper/Paper.js";
|
|
8
8
|
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from "../utils/types.js";
|
|
9
9
|
export interface AccordionSlots {
|
|
10
|
+
/**
|
|
11
|
+
* The component that renders the root.
|
|
12
|
+
* @default Paper
|
|
13
|
+
*/
|
|
14
|
+
root: React.ElementType;
|
|
10
15
|
/**
|
|
11
16
|
* The component that renders the heading.
|
|
12
17
|
* @default 'h3'
|
|
@@ -19,9 +24,15 @@ export interface AccordionSlots {
|
|
|
19
24
|
*/
|
|
20
25
|
transition: React.ElementType;
|
|
21
26
|
}
|
|
22
|
-
export interface
|
|
27
|
+
export interface AccordionRootSlotPropsOverrides {}
|
|
23
28
|
export interface AccordionHeadingSlotPropsOverrides {}
|
|
29
|
+
export interface AccordionTransitionSlotPropsOverrides {}
|
|
24
30
|
export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<AccordionSlots, {
|
|
31
|
+
/**
|
|
32
|
+
* Props forwarded to the root slot.
|
|
33
|
+
* By default, the avaible props are based on the Paper element.
|
|
34
|
+
*/
|
|
35
|
+
root: SlotProps<React.ElementType<PaperProps>, AccordionRootSlotPropsOverrides, AccordionOwnerState>;
|
|
25
36
|
/**
|
|
26
37
|
* Props forwarded to the heading slot.
|
|
27
38
|
* By default, the avaible props are based on the h3 element.
|
|
@@ -185,6 +185,20 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
185
185
|
slots: backwardCompatibleSlots,
|
|
186
186
|
slotProps: backwardCompatibleSlotProps
|
|
187
187
|
};
|
|
188
|
+
const [RootSlot, rootProps] = useSlot('root', {
|
|
189
|
+
elementType: AccordionRoot,
|
|
190
|
+
externalForwardedProps: {
|
|
191
|
+
...externalForwardedProps,
|
|
192
|
+
...other
|
|
193
|
+
},
|
|
194
|
+
className: clsx(classes.root, className),
|
|
195
|
+
shouldForwardComponentProp: true,
|
|
196
|
+
ownerState,
|
|
197
|
+
ref,
|
|
198
|
+
additionalProps: {
|
|
199
|
+
square
|
|
200
|
+
}
|
|
201
|
+
});
|
|
188
202
|
const [AccordionHeadingSlot, accordionProps] = useSlot('heading', {
|
|
189
203
|
elementType: AccordionHeading,
|
|
190
204
|
externalForwardedProps,
|
|
@@ -196,12 +210,8 @@ const Accordion = /*#__PURE__*/React.forwardRef(function Accordion(inProps, ref)
|
|
|
196
210
|
externalForwardedProps,
|
|
197
211
|
ownerState
|
|
198
212
|
});
|
|
199
|
-
return /*#__PURE__*/_jsxs(
|
|
200
|
-
|
|
201
|
-
ref: ref,
|
|
202
|
-
ownerState: ownerState,
|
|
203
|
-
square: square,
|
|
204
|
-
...other,
|
|
213
|
+
return /*#__PURE__*/_jsxs(RootSlot, {
|
|
214
|
+
...rootProps,
|
|
205
215
|
children: [/*#__PURE__*/_jsx(AccordionHeadingSlot, {
|
|
206
216
|
...accordionProps,
|
|
207
217
|
children: /*#__PURE__*/_jsx(AccordionContext.Provider, {
|
|
@@ -281,6 +291,7 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
|
|
|
281
291
|
*/
|
|
282
292
|
slotProps: PropTypes.shape({
|
|
283
293
|
heading: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
294
|
+
root: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
|
284
295
|
transition: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
285
296
|
}),
|
|
286
297
|
/**
|
|
@@ -289,6 +300,7 @@ process.env.NODE_ENV !== "production" ? Accordion.propTypes /* remove-proptypes
|
|
|
289
300
|
*/
|
|
290
301
|
slots: PropTypes.shape({
|
|
291
302
|
heading: PropTypes.elementType,
|
|
303
|
+
root: PropTypes.elementType,
|
|
292
304
|
transition: PropTypes.elementType
|
|
293
305
|
}),
|
|
294
306
|
/**
|
|
@@ -1,13 +1,47 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
|
-
import { ExtendButtonBase, ExtendButtonBaseTypeMap } from "../ButtonBase/index.js";
|
|
3
|
+
import { ButtonBaseProps, ExtendButtonBase, ExtendButtonBaseTypeMap } from "../ButtonBase/index.js";
|
|
4
4
|
import { OverrideProps } from "../OverridableComponent/index.js";
|
|
5
|
-
import { Theme } from "../index.js";
|
|
5
|
+
import { CreateSlotsAndSlotProps, SlotProps, Theme } from "../index.js";
|
|
6
6
|
import { AccordionSummaryClasses } from "./accordionSummaryClasses.js";
|
|
7
|
-
export interface
|
|
7
|
+
export interface AccordionSummarySlots {
|
|
8
8
|
/**
|
|
9
|
-
* The
|
|
9
|
+
* The component that renders the root slot.
|
|
10
|
+
* @default ButtonBase
|
|
10
11
|
*/
|
|
12
|
+
root: React.ElementType;
|
|
13
|
+
/**
|
|
14
|
+
* The component that renders the content slot.
|
|
15
|
+
* @default div
|
|
16
|
+
*/
|
|
17
|
+
content: React.ElementType;
|
|
18
|
+
/**
|
|
19
|
+
* The component that renders the expand icon wrapper slot.
|
|
20
|
+
* @default div
|
|
21
|
+
*/
|
|
22
|
+
expandIconWrapper: React.ElementType;
|
|
23
|
+
}
|
|
24
|
+
export interface AccordionSummaryRootSlotPropsOverrides {}
|
|
25
|
+
export interface AccordionSummaryContentSlotPropsOverrides {}
|
|
26
|
+
export interface AccordionSummaryExpandIconWrapperSlotPropsOverrides {}
|
|
27
|
+
export type AccordionSummarySlotsAndSlotProps = CreateSlotsAndSlotProps<AccordionSummarySlots, {
|
|
28
|
+
/**
|
|
29
|
+
* Props forwarded to the root slot.
|
|
30
|
+
* By default, the avaible props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component.
|
|
31
|
+
*/
|
|
32
|
+
root: SlotProps<React.ElementType<ButtonBaseProps>, AccordionSummaryRootSlotPropsOverrides, AccordionSummaryOwnerState>;
|
|
33
|
+
/**
|
|
34
|
+
* Props forwarded to the content slot.
|
|
35
|
+
* By default, the avaible props are based on a div element.
|
|
36
|
+
*/
|
|
37
|
+
content: SlotProps<'div', AccordionSummaryContentSlotPropsOverrides, AccordionSummaryOwnerState>;
|
|
38
|
+
/**
|
|
39
|
+
* Props forwarded to the expand icon wrapper slot.
|
|
40
|
+
* By default, the avaible props are based on a div element.
|
|
41
|
+
*/
|
|
42
|
+
expandIconWrapper: SlotProps<'div', AccordionSummaryExpandIconWrapperSlotPropsOverrides, AccordionSummaryOwnerState>;
|
|
43
|
+
}>;
|
|
44
|
+
export interface AccordionSummaryOwnProps extends AccordionSummarySlotsAndSlotProps {
|
|
11
45
|
children?: React.ReactNode;
|
|
12
46
|
/**
|
|
13
47
|
* Override or extend the styles applied to the component.
|
|
@@ -26,6 +60,7 @@ export type AccordionSummaryTypeMap<AdditionalProps = {}, RootComponent extends
|
|
|
26
60
|
props: AdditionalProps & AccordionSummaryOwnProps;
|
|
27
61
|
defaultComponent: RootComponent;
|
|
28
62
|
}>;
|
|
63
|
+
export interface AccordionSummaryOwnerState extends Omit<AccordionSummaryProps, 'slots' | 'slotProps'> {}
|
|
29
64
|
|
|
30
65
|
/**
|
|
31
66
|
*
|
|
@@ -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
|
*/
|