@mui/material 6.4.6 → 6.4.8
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 +17 -2
- package/Accordion/Accordion.js +18 -6
- package/AccordionSummary/AccordionSummary.d.ts +59 -4
- package/AccordionSummary/AccordionSummary.js +67 -16
- package/CHANGELOG.md +67 -4
- package/ListItemText/ListItemText.d.ts +10 -0
- package/ListItemText/ListItemText.js +14 -5
- package/Radio/Radio.js +3 -1
- package/Rating/Rating.d.ts +59 -1
- package/Rating/Rating.js +131 -45
- package/Snackbar/Snackbar.js +7 -1
- package/SpeedDial/SpeedDial.d.ts +10 -0
- package/SpeedDial/SpeedDial.js +40 -11
- package/SpeedDialAction/SpeedDialAction.js +1 -1
- package/TextareaAutosize/TextareaAutosize.js +26 -15
- package/Tooltip/Tooltip.d.ts +1 -13
- package/Tooltip/Tooltip.js +1 -1
- package/index.js +1 -1
- package/modern/Accordion/Accordion.js +18 -6
- package/modern/AccordionSummary/AccordionSummary.js +67 -16
- package/modern/ListItemText/ListItemText.js +14 -5
- package/modern/Radio/Radio.js +3 -1
- package/modern/Rating/Rating.js +131 -45
- package/modern/Snackbar/Snackbar.js +7 -1
- package/modern/SpeedDial/SpeedDial.js +40 -11
- package/modern/SpeedDialAction/SpeedDialAction.js +1 -1
- package/modern/TextareaAutosize/TextareaAutosize.js +26 -15
- package/modern/Tooltip/Tooltip.js +1 -1
- package/modern/index.js +1 -1
- package/modern/styles/ThemeProvider.js +11 -0
- package/modern/useScrollTrigger/useScrollTrigger.js +3 -0
- package/modern/version/index.js +2 -2
- package/node/Accordion/Accordion.js +18 -6
- package/node/AccordionSummary/AccordionSummary.js +67 -16
- package/node/ListItemText/ListItemText.js +14 -5
- package/node/Radio/Radio.js +3 -1
- package/node/Rating/Rating.js +132 -46
- package/node/Snackbar/Snackbar.js +7 -1
- package/node/SpeedDial/SpeedDial.js +40 -11
- package/node/SpeedDialAction/SpeedDialAction.js +1 -1
- package/node/TextareaAutosize/TextareaAutosize.js +25 -14
- package/node/Tooltip/Tooltip.js +1 -1
- package/node/index.js +1 -1
- package/node/styles/ThemeProvider.js +11 -0
- package/node/useScrollTrigger/useScrollTrigger.js +3 -0
- package/node/version/index.js +2 -2
- package/package.json +6 -6
- package/styles/ThemeProvider.d.ts +6 -0
- package/styles/ThemeProvider.js +11 -0
- package/styles/ThemeProviderWithVars.d.ts +1 -0
- package/styles/index.d.ts +1 -0
- package/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/useScrollTrigger/useScrollTrigger.js +3 -0
- package/version/index.js +2 -2
package/Accordion/Accordion.d.ts
CHANGED
|
@@ -4,10 +4,15 @@ import { Theme } from '..';
|
|
|
4
4
|
import { TransitionProps } from '../transitions/transition';
|
|
5
5
|
import { AccordionClasses } from './accordionClasses';
|
|
6
6
|
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
|
7
|
-
import { ExtendPaperTypeMap } from '../Paper/Paper';
|
|
7
|
+
import { ExtendPaperTypeMap, PaperProps } from '../Paper/Paper';
|
|
8
8
|
import { CreateSlotsAndSlotProps, SlotComponentProps, SlotProps } from '../utils/types';
|
|
9
9
|
|
|
10
10
|
export interface AccordionSlots {
|
|
11
|
+
/**
|
|
12
|
+
* The component that renders the root.
|
|
13
|
+
* @default Paper
|
|
14
|
+
*/
|
|
15
|
+
root: React.ElementType;
|
|
11
16
|
/**
|
|
12
17
|
* The component that renders the heading.
|
|
13
18
|
* @default 'h3'
|
|
@@ -21,12 +26,22 @@ export interface AccordionSlots {
|
|
|
21
26
|
transition: React.ElementType;
|
|
22
27
|
}
|
|
23
28
|
|
|
24
|
-
export interface
|
|
29
|
+
export interface AccordionRootSlotPropsOverrides {}
|
|
25
30
|
export interface AccordionHeadingSlotPropsOverrides {}
|
|
31
|
+
export interface AccordionTransitionSlotPropsOverrides {}
|
|
26
32
|
|
|
27
33
|
export type AccordionSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
28
34
|
AccordionSlots,
|
|
29
35
|
{
|
|
36
|
+
/**
|
|
37
|
+
* Props forwarded to the root slot.
|
|
38
|
+
* By default, the avaible props are based on the Paper element.
|
|
39
|
+
*/
|
|
40
|
+
root: SlotProps<
|
|
41
|
+
React.ElementType<PaperProps>,
|
|
42
|
+
AccordionRootSlotPropsOverrides,
|
|
43
|
+
AccordionOwnerState
|
|
44
|
+
>;
|
|
30
45
|
/**
|
|
31
46
|
* Props forwarded to the heading slot.
|
|
32
47
|
* By default, the avaible props are based on the h3 element.
|
package/Accordion/Accordion.js
CHANGED
|
@@ -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,14 +1,66 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SxProps } from '@mui/system';
|
|
3
|
-
import { ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
|
|
3
|
+
import { ButtonBaseProps, ExtendButtonBase, ExtendButtonBaseTypeMap } from '../ButtonBase';
|
|
4
4
|
import { OverrideProps } from '../OverridableComponent';
|
|
5
|
-
import { Theme } from '..';
|
|
5
|
+
import { CreateSlotsAndSlotProps, SlotProps, Theme } from '..';
|
|
6
6
|
import { AccordionSummaryClasses } from './accordionSummaryClasses';
|
|
7
7
|
|
|
8
|
-
export interface
|
|
8
|
+
export interface AccordionSummarySlots {
|
|
9
9
|
/**
|
|
10
|
-
* The
|
|
10
|
+
* The component that renders the root slot.
|
|
11
|
+
* @default ButtonBase
|
|
11
12
|
*/
|
|
13
|
+
root: React.ElementType;
|
|
14
|
+
/**
|
|
15
|
+
* The component that renders the content slot.
|
|
16
|
+
* @default div
|
|
17
|
+
*/
|
|
18
|
+
content: React.ElementType;
|
|
19
|
+
/**
|
|
20
|
+
* The component that renders the expand icon wrapper slot.
|
|
21
|
+
* @default div
|
|
22
|
+
*/
|
|
23
|
+
expandIconWrapper: React.ElementType;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface AccordionSummaryRootSlotPropsOverrides {}
|
|
27
|
+
export interface AccordionSummaryContentSlotPropsOverrides {}
|
|
28
|
+
export interface AccordionSummaryExpandIconWrapperSlotPropsOverrides {}
|
|
29
|
+
|
|
30
|
+
export type AccordionSummarySlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
31
|
+
AccordionSummarySlots,
|
|
32
|
+
{
|
|
33
|
+
/**
|
|
34
|
+
* Props forwarded to the root slot.
|
|
35
|
+
* By default, the avaible props are based on the [ButtonBase](https://mui.com/material-ui/api/button-base/#props) component.
|
|
36
|
+
*/
|
|
37
|
+
root: SlotProps<
|
|
38
|
+
React.ElementType<ButtonBaseProps>,
|
|
39
|
+
AccordionSummaryRootSlotPropsOverrides,
|
|
40
|
+
AccordionSummaryOwnerState
|
|
41
|
+
>;
|
|
42
|
+
/**
|
|
43
|
+
* Props forwarded to the content slot.
|
|
44
|
+
* By default, the avaible props are based on a div element.
|
|
45
|
+
*/
|
|
46
|
+
content: SlotProps<
|
|
47
|
+
'div',
|
|
48
|
+
AccordionSummaryContentSlotPropsOverrides,
|
|
49
|
+
AccordionSummaryOwnerState
|
|
50
|
+
>;
|
|
51
|
+
/**
|
|
52
|
+
* Props forwarded to the expand icon wrapper slot.
|
|
53
|
+
* By default, the avaible props are based on a div element.
|
|
54
|
+
*/
|
|
55
|
+
expandIconWrapper: SlotProps<
|
|
56
|
+
'div',
|
|
57
|
+
AccordionSummaryExpandIconWrapperSlotPropsOverrides,
|
|
58
|
+
AccordionSummaryOwnerState
|
|
59
|
+
>;
|
|
60
|
+
}
|
|
61
|
+
>;
|
|
62
|
+
|
|
63
|
+
export interface AccordionSummaryOwnProps extends AccordionSummarySlotsAndSlotProps {
|
|
12
64
|
children?: React.ReactNode;
|
|
13
65
|
/**
|
|
14
66
|
* Override or extend the styles applied to the component.
|
|
@@ -32,6 +84,9 @@ export type AccordionSummaryTypeMap<
|
|
|
32
84
|
defaultComponent: RootComponent;
|
|
33
85
|
}>;
|
|
34
86
|
|
|
87
|
+
export interface AccordionSummaryOwnerState
|
|
88
|
+
extends Omit<AccordionSummaryProps, 'slots' | 'slotProps'> {}
|
|
89
|
+
|
|
35
90
|
/**
|
|
36
91
|
*
|
|
37
92
|
* Demos:
|
|
@@ -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
|
*/
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,68 @@
|
|
|
1
1
|
# [Versions](https://mui.com/versions/)
|
|
2
2
|
|
|
3
|
+
## 6.4.8
|
|
4
|
+
|
|
5
|
+
<!-- generated comparing v6.4.7..v6.x -->
|
|
6
|
+
|
|
7
|
+
_Mar 14, 2025_
|
|
8
|
+
|
|
9
|
+
A big thanks to the 9 contributors who made this release possible.
|
|
10
|
+
|
|
11
|
+
### `@mui/material@6.4.8`
|
|
12
|
+
|
|
13
|
+
- [ListItemText] Add missing `root` slot (#45552) @sai6855
|
|
14
|
+
- [SpeedDial] Add missing `root` slot (#45551) @sai6855
|
|
15
|
+
- [Tooltip] Allow auto placement on tooltip (#45536) @Jtaks
|
|
16
|
+
- [useScrollTrigger] Do nothing if target is null (#45553) @vipierozan99
|
|
17
|
+
- [Accordion] Add missing `root` slot (#45534) @sai6855
|
|
18
|
+
- [AccordionSummary] Add slots and slotProps (#45560) @sai6855
|
|
19
|
+
- [TextareaAutosize] Fix ResizeObserver causing infinite `selectionchange` loop (#45351) (#45498) @mj12albert
|
|
20
|
+
|
|
21
|
+
### `@mui/styled-engine@6.4.8`
|
|
22
|
+
|
|
23
|
+
- Add `enableCssLayer` prop to StyledEngineProvider (#45563) @siriwatknp
|
|
24
|
+
|
|
25
|
+
### `@mui/system@6.4.8`
|
|
26
|
+
|
|
27
|
+
- [system] Prevent nested non-vars theme inheritance (#45564) @siriwatknp
|
|
28
|
+
|
|
29
|
+
### `@mui/utils@6.4.8`
|
|
30
|
+
|
|
31
|
+
- Use correct iri-reference homepage format (#45511) @dahiro
|
|
32
|
+
|
|
33
|
+
### Core
|
|
34
|
+
|
|
35
|
+
- [test] Fix React 18 tests (#45161) (#45496) @DiegoAndai
|
|
36
|
+
|
|
37
|
+
### Docs
|
|
38
|
+
|
|
39
|
+
- [Backdrop] Fix component name in migration guide (#45507) @sai6855
|
|
40
|
+
- Fix broken links to MUI X docs (cherry-pick of #45145) (#45481) @mapache-salvaje
|
|
41
|
+
- [examples] Fix the invalid argument to extract examples (#45493) @ovtn
|
|
42
|
+
- Add `overriding-component-structure` doc to Material UI (#45570) @siriwatknp
|
|
43
|
+
|
|
44
|
+
All contributors of this release in alphabetical order: @dahiro, @DiegoAndai, @Jtaks, @mapache-salvaje, @mj12albert, @ovtn, @sai6855, @siriwatknp, @vipierozan99
|
|
45
|
+
|
|
46
|
+
## 6.4.7
|
|
47
|
+
|
|
48
|
+
<!-- generated comparing v6.4.6..v6.x -->
|
|
49
|
+
|
|
50
|
+
_Mar 5, 2025_
|
|
51
|
+
|
|
52
|
+
A big thanks to the 3 contributors who made this release possible.
|
|
53
|
+
|
|
54
|
+
### `@mui/material@6.4.7`
|
|
55
|
+
|
|
56
|
+
- [ThemeProvider] Add `storageManager` prop to `ThemeProvider` (@siriwatknp) (#45437) @siriwatknp
|
|
57
|
+
- [Rating] Deprecate \*Props and complete slots, slotProps (#45295) (#45398) @DiegoAndai
|
|
58
|
+
- [Radio] Fix `inputProps` not forwarded (@siriwatknp) (#45475) @siriwatknp
|
|
59
|
+
|
|
60
|
+
### Core
|
|
61
|
+
|
|
62
|
+
- [blog] React 19 migration for MUI X (#45440) @arminmeh
|
|
63
|
+
|
|
64
|
+
All contributors of this release in alphabetical order: @arminmeh, @DiegoAndai, @siriwatknp
|
|
65
|
+
|
|
3
66
|
## 6.4.6
|
|
4
67
|
|
|
5
68
|
<!-- generated comparing v6.4.5..v6.x -->
|
|
@@ -11,21 +74,21 @@ A big thanks to the 4 contributors who made this release possible.
|
|
|
11
74
|
### `@mui/material@6.4.6`
|
|
12
75
|
|
|
13
76
|
- [Checkbox] Add slots and slotProps (#45361) @siriwatknp
|
|
14
|
-
- [Drawer] Deprecate
|
|
77
|
+
- [Drawer] Deprecate \*Props and complete `slots`, `slotProps` (#45377) @siriwatknp
|
|
15
78
|
- [Grid] Improve Grid2 upgrade experience (#45372) @DiegoAndai
|
|
16
79
|
- [InputBase] Deprecate composed classes (#45366) @siriwatknp
|
|
17
80
|
- Fix `slotProps.transition` types (#45367) @siriwatknp
|
|
18
81
|
- Allow nested theme creation with `vars` (#45368) @siriwatknp
|
|
19
82
|
- Fix wrong slotProps of DetailsHTMLAttributes types (#45356) @siriwatknp
|
|
20
|
-
- [Popover] Deprecate
|
|
83
|
+
- [Popover] Deprecate \*Props and complete `slots`, `slotProps` (#45337) @siriwatknp
|
|
21
84
|
- [Radio] Add slots and slotProps (#45364) @siriwatknp
|
|
22
85
|
- [Slider] Fix css class selector in migration guide (#45409) @sai6855
|
|
23
86
|
- [Slider] Fix spacings in .md files (#45393) @sai6855
|
|
24
87
|
- [Snackbar] Add Slots and SlotProps (#45103) (#45352) @siriwatknp
|
|
25
88
|
- [SpeedDialAction] Add slots and slotProps (#45365) @siriwatknp
|
|
26
89
|
- [SwitchBase] Deprecate `inputProps` and complete slots, slotProps (#45338) @siriwatknp
|
|
27
|
-
- [Tabs] Deprecate
|
|
28
|
-
- [Menu] Deprecate
|
|
90
|
+
- [Tabs] Deprecate \*Props and complete slots, slotProps (#45012) (#45355) @siriwatknp
|
|
91
|
+
- [Menu] Deprecate \*Props and complete `slots`, `slotProps` (#45369) @siriwatknp
|
|
29
92
|
|
|
30
93
|
### Docs
|
|
31
94
|
|
|
@@ -6,6 +6,11 @@ import { ListItemTextClasses } from './listItemTextClasses';
|
|
|
6
6
|
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
|
|
7
7
|
|
|
8
8
|
export interface ListItemTextSlots {
|
|
9
|
+
/**
|
|
10
|
+
* The component that renders the root slot.
|
|
11
|
+
* @default 'div'
|
|
12
|
+
*/
|
|
13
|
+
root?: React.ElementType;
|
|
9
14
|
/**
|
|
10
15
|
* The component that renders the primary slot.
|
|
11
16
|
* @default Typography
|
|
@@ -21,6 +26,11 @@ export interface ListItemTextSlots {
|
|
|
21
26
|
export type ListItemTextSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
22
27
|
ListItemTextSlots,
|
|
23
28
|
{
|
|
29
|
+
/**
|
|
30
|
+
* Props forwared to the root slot.
|
|
31
|
+
* By default, the available props are based on `div` element.
|
|
32
|
+
*/
|
|
33
|
+
root: SlotProps<'div', {}, ListItemTextOwnerState>;
|
|
24
34
|
/**
|
|
25
35
|
* Props forwared to the primary slot (as long as disableTypography is not `true`)
|
|
26
36
|
* 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
|
/**
|
package/Radio/Radio.js
CHANGED
|
@@ -128,6 +128,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
128
128
|
disableRipple = false,
|
|
129
129
|
slots = {},
|
|
130
130
|
slotProps = {},
|
|
131
|
+
inputProps,
|
|
131
132
|
...other
|
|
132
133
|
} = props;
|
|
133
134
|
const muiFormControl = useFormControl();
|
|
@@ -158,6 +159,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
158
159
|
name = radioGroup.name;
|
|
159
160
|
}
|
|
160
161
|
}
|
|
162
|
+
const externalInputProps = slotProps.input ?? inputProps;
|
|
161
163
|
const [RootSlot, rootSlotProps] = useSlot('root', {
|
|
162
164
|
ref,
|
|
163
165
|
elementType: RadioRoot,
|
|
@@ -190,7 +192,7 @@ const Radio = /*#__PURE__*/React.forwardRef(function Radio(inProps, ref) {
|
|
|
190
192
|
slots,
|
|
191
193
|
slotProps: {
|
|
192
194
|
// Do not forward `slotProps.root` again because it's already handled by the `RootSlot` in this file.
|
|
193
|
-
input: typeof
|
|
195
|
+
input: typeof externalInputProps === 'function' ? externalInputProps(ownerState) : externalInputProps
|
|
194
196
|
}
|
|
195
197
|
}
|
|
196
198
|
});
|
package/Rating/Rating.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { OverridableStringUnion } from '@mui/types';
|
|
|
4
4
|
import { Theme } from '..';
|
|
5
5
|
import { RatingClasses } from './ratingClasses';
|
|
6
6
|
import { OverridableComponent, OverrideProps } from '../OverridableComponent';
|
|
7
|
+
import { CreateSlotsAndSlotProps, SlotProps } from '../utils/types';
|
|
7
8
|
|
|
8
9
|
export interface IconContainerProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
9
10
|
value: number;
|
|
@@ -11,7 +12,61 @@ export interface IconContainerProps extends React.HTMLAttributes<HTMLSpanElement
|
|
|
11
12
|
|
|
12
13
|
export interface RatingPropsSizeOverrides {}
|
|
13
14
|
|
|
14
|
-
export interface
|
|
15
|
+
export interface RatingRootSlotPropsOverrides {}
|
|
16
|
+
export interface RatingLabelSlotPropsOverrides {}
|
|
17
|
+
export interface RatingIconSlotPropsOverrides {}
|
|
18
|
+
export interface RatingDecimalSlotPropsOverrides {}
|
|
19
|
+
|
|
20
|
+
export interface RatingSlots {
|
|
21
|
+
/**
|
|
22
|
+
* The component used for the root slot.
|
|
23
|
+
* @default 'span'
|
|
24
|
+
*/
|
|
25
|
+
root: React.ElementType;
|
|
26
|
+
/**
|
|
27
|
+
* The component used for the label slot.
|
|
28
|
+
* @default 'label'
|
|
29
|
+
*/
|
|
30
|
+
label: React.ElementType;
|
|
31
|
+
/**
|
|
32
|
+
* The component used for the icon slot.
|
|
33
|
+
* @default 'span'
|
|
34
|
+
*/
|
|
35
|
+
icon: React.ElementType;
|
|
36
|
+
/**
|
|
37
|
+
* The component used fo r the decimal slot.
|
|
38
|
+
* @default 'span'
|
|
39
|
+
*/
|
|
40
|
+
decimal: React.ElementType;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type RatingSlotsAndSlotProps = CreateSlotsAndSlotProps<
|
|
44
|
+
RatingSlots,
|
|
45
|
+
{
|
|
46
|
+
/**
|
|
47
|
+
* Props forwarded to the root slot.
|
|
48
|
+
* By default, the avaible props are based on the span element.
|
|
49
|
+
*/
|
|
50
|
+
root: SlotProps<'span', RatingRootSlotPropsOverrides, RatingOwnerState>;
|
|
51
|
+
/**
|
|
52
|
+
* Props forwarded to the label slot.
|
|
53
|
+
* By default, the avaible props are based on the label element.
|
|
54
|
+
*/
|
|
55
|
+
label: SlotProps<'label', RatingLabelSlotPropsOverrides, RatingOwnerState>;
|
|
56
|
+
/**
|
|
57
|
+
* Props forwarded to the icon slot.
|
|
58
|
+
* By default, the avaible props are based on the span element.
|
|
59
|
+
*/
|
|
60
|
+
icon: SlotProps<'span', RatingIconSlotPropsOverrides, RatingOwnerState>;
|
|
61
|
+
/**
|
|
62
|
+
* Props forwarded to the decimal slot.
|
|
63
|
+
* By default, the avaible props are based on the span element.
|
|
64
|
+
*/
|
|
65
|
+
decimal: SlotProps<'span', RatingDecimalSlotPropsOverrides, RatingOwnerState>;
|
|
66
|
+
}
|
|
67
|
+
>;
|
|
68
|
+
|
|
69
|
+
export interface RatingOwnProps extends RatingSlotsAndSlotProps {
|
|
15
70
|
/**
|
|
16
71
|
* Override or extend the styles applied to the component.
|
|
17
72
|
*/
|
|
@@ -60,6 +115,7 @@ export interface RatingOwnProps {
|
|
|
60
115
|
icon?: React.ReactNode;
|
|
61
116
|
/**
|
|
62
117
|
* The component containing the icon.
|
|
118
|
+
* @deprecated Use `slotProps.icon.component` instead. This prop will be removed in v7. See [Migrating from deprecated APIs](/material-ui/migration/migrating-from-deprecated-apis/) for more details.
|
|
63
119
|
* @default function IconContainer(props) {
|
|
64
120
|
* const { value, ...other } = props;
|
|
65
121
|
* return <span {...other} />;
|
|
@@ -114,6 +170,8 @@ export interface RatingOwnProps {
|
|
|
114
170
|
value?: number | null;
|
|
115
171
|
}
|
|
116
172
|
|
|
173
|
+
export interface RatingOwnerState extends Omit<RatingProps, 'slots' | 'slotProps'> {}
|
|
174
|
+
|
|
117
175
|
export type RatingTypeMap<
|
|
118
176
|
AdditionalProps = {},
|
|
119
177
|
RootComponent extends React.ElementType = 'span',
|