@mui/material 7.0.0-beta.2 → 7.0.0-beta.4
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 +80 -0
- package/ListItemText/ListItemText.d.ts +10 -0
- package/ListItemText/ListItemText.js +14 -5
- package/Radio/Radio.js +3 -1
- package/SpeedDial/SpeedDial.d.ts +10 -0
- package/SpeedDial/SpeedDial.js +40 -11
- package/SpeedDialAction/SpeedDialAction.js +1 -1
- 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/ListItemText/ListItemText.d.ts +10 -0
- package/esm/ListItemText/ListItemText.js +14 -5
- package/esm/Radio/Radio.js +3 -1
- package/esm/SpeedDial/SpeedDial.d.ts +10 -0
- package/esm/SpeedDial/SpeedDial.js +40 -11
- package/esm/SpeedDialAction/SpeedDialAction.js +1 -1
- 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 +12 -0
- package/esm/styles/ThemeProvider.js +11 -0
- package/esm/styles/ThemeProviderWithVars.d.ts +1 -0
- package/esm/styles/adaptV4Theme.d.ts +2 -2
- package/esm/styles/createThemeNoVars.d.ts +3 -3
- package/esm/styles/createTypography.d.ts +4 -4
- package/esm/styles/index.d.ts +2 -1
- package/esm/styles/responsiveFontSizes.d.ts +3 -3
- package/esm/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/esm/useScrollTrigger/useScrollTrigger.js +3 -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/ListItemText/ListItemText.d.ts +10 -0
- package/modern/ListItemText/ListItemText.js +14 -5
- package/modern/Radio/Radio.js +3 -1
- package/modern/SpeedDial/SpeedDial.d.ts +10 -0
- 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.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 +12 -0
- package/modern/styles/ThemeProvider.js +11 -0
- package/modern/styles/ThemeProviderWithVars.d.ts +1 -0
- package/modern/styles/adaptV4Theme.d.ts +2 -2
- package/modern/styles/createThemeNoVars.d.ts +3 -3
- package/modern/styles/createTypography.d.ts +4 -4
- package/modern/styles/index.d.ts +2 -1
- package/modern/styles/responsiveFontSizes.d.ts +3 -3
- package/modern/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/modern/useScrollTrigger/useScrollTrigger.js +3 -0
- package/modern/version/index.js +2 -2
- package/package.json +6 -6
- package/styles/ThemeProvider.d.ts +12 -0
- package/styles/ThemeProvider.js +11 -0
- package/styles/ThemeProviderWithVars.d.ts +1 -0
- package/styles/adaptV4Theme.d.ts +2 -2
- package/styles/createThemeNoVars.d.ts +3 -3
- package/styles/createTypography.d.ts +4 -4
- package/styles/index.d.ts +2 -1
- package/styles/responsiveFontSizes.d.ts +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/useScrollTrigger/useScrollTrigger.d.ts +1 -1
- package/useScrollTrigger/useScrollTrigger.js +3 -0
- package/version/index.js +2 -2
|
@@ -17,6 +17,17 @@ export default function ThemeProvider({
|
|
|
17
17
|
}
|
|
18
18
|
const muiTheme = THEME_ID in theme ? theme[THEME_ID] : theme;
|
|
19
19
|
if (!('colorSchemes' in muiTheme)) {
|
|
20
|
+
if (!('vars' in muiTheme)) {
|
|
21
|
+
// For non-CSS variables themes, set `vars` to null to prevent theme inheritance from the upper theme.
|
|
22
|
+
// The example use case is the docs demo that uses ThemeProvider to customize the theme while the upper theme is using CSS variables.
|
|
23
|
+
return /*#__PURE__*/_jsx(ThemeProviderNoVars, {
|
|
24
|
+
theme: {
|
|
25
|
+
...theme,
|
|
26
|
+
vars: null
|
|
27
|
+
},
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
20
31
|
return /*#__PURE__*/_jsx(ThemeProviderNoVars, {
|
|
21
32
|
theme: theme,
|
|
22
33
|
...props
|
|
@@ -43,6 +43,7 @@ export declare const CssVarsProvider: (props: React.PropsWithChildren<Partial<im
|
|
|
43
43
|
defaultMode?: "light" | "dark" | "system";
|
|
44
44
|
documentNode?: Document | null;
|
|
45
45
|
colorSchemeNode?: Element | null;
|
|
46
|
+
storageManager?: import("@mui/system").StorageManager | null;
|
|
46
47
|
storageWindow?: Window | null;
|
|
47
48
|
disableNestedContext?: boolean;
|
|
48
49
|
disableStyleSheetGeneration?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BreakpointsOptions, ShapeOptions, SpacingOptions } from '@mui/system';
|
|
2
2
|
import { MixinsOptions } from "./createMixins.js";
|
|
3
3
|
import { Palette, PaletteOptions } from "./createPalette.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TypographyVariantsOptions } from "./createTypography.js";
|
|
5
5
|
import { Shadows } from "./shadows.js";
|
|
6
6
|
import { TransitionsOptions } from "./createTransitions.js";
|
|
7
7
|
import { ZIndexOptions } from "./zIndex.js";
|
|
@@ -21,7 +21,7 @@ export interface DeprecatedThemeOptions {
|
|
|
21
21
|
shadows?: Shadows;
|
|
22
22
|
spacing?: SpacingOptions;
|
|
23
23
|
transitions?: TransitionsOptions;
|
|
24
|
-
typography?:
|
|
24
|
+
typography?: TypographyVariantsOptions | ((palette: Palette) => TypographyVariantsOptions);
|
|
25
25
|
variants?: ComponentsVariants;
|
|
26
26
|
zIndex?: ZIndexOptions;
|
|
27
27
|
unstable_strictMode?: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ThemeOptions as SystemThemeOptions, Theme as SystemTheme, SxProps, CSSObject, SxConfig } from '@mui/system';
|
|
2
2
|
import { Mixins, MixinsOptions } from "./createMixins.js";
|
|
3
3
|
import { Palette, PaletteOptions } from "./createPalette.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TypographyVariants, TypographyVariantsOptions } from "./createTypography.js";
|
|
5
5
|
import { Shadows } from "./shadows.js";
|
|
6
6
|
import { Transitions, TransitionsOptions } from "./createTransitions.js";
|
|
7
7
|
import { ZIndex, ZIndexOptions } from "./zIndex.js";
|
|
@@ -28,7 +28,7 @@ export interface ThemeOptions extends Omit<SystemThemeOptions, 'zIndex'>, CssVar
|
|
|
28
28
|
palette?: PaletteOptions;
|
|
29
29
|
shadows?: Shadows;
|
|
30
30
|
transitions?: TransitionsOptions;
|
|
31
|
-
typography?:
|
|
31
|
+
typography?: TypographyVariantsOptions | ((palette: Palette) => TypographyVariantsOptions);
|
|
32
32
|
zIndex?: ZIndexOptions;
|
|
33
33
|
unstable_strictMode?: boolean;
|
|
34
34
|
unstable_sxConfig?: SxConfig;
|
|
@@ -40,7 +40,7 @@ export interface BaseTheme extends SystemTheme {
|
|
|
40
40
|
} ? CssVarsPalette : {});
|
|
41
41
|
shadows: Shadows;
|
|
42
42
|
transitions: Transitions;
|
|
43
|
-
typography:
|
|
43
|
+
typography: TypographyVariants;
|
|
44
44
|
zIndex: ZIndex;
|
|
45
45
|
unstable_strictMode?: boolean;
|
|
46
46
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import * as CSS from 'csstype';
|
|
3
3
|
import { Palette } from "./createPalette.js";
|
|
4
|
-
export type
|
|
4
|
+
export type TypographyVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'button' | 'overline';
|
|
5
5
|
export interface FontStyle {
|
|
6
6
|
fontFamily: React.CSSProperties['fontFamily'];
|
|
7
7
|
fontSize: number;
|
|
@@ -45,6 +45,6 @@ export interface TypographyStyleOptions extends TypographyStyle {}
|
|
|
45
45
|
export interface TypographyUtils {
|
|
46
46
|
pxToRem: (px: number) => string;
|
|
47
47
|
}
|
|
48
|
-
export interface
|
|
49
|
-
export interface
|
|
50
|
-
export default function createTypography(palette: Palette, typography:
|
|
48
|
+
export interface TypographyVariants extends Record<TypographyVariant, TypographyStyle>, FontStyle, TypographyUtils {}
|
|
49
|
+
export interface TypographyVariantsOptions extends Partial<Record<TypographyVariant, TypographyStyleOptions> & FontStyleOptions> {}
|
|
50
|
+
export default function createTypography(palette: Palette, typography: TypographyVariantsOptions | ((palette: Palette) => TypographyVariantsOptions)): TypographyVariants;
|
package/esm/styles/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export { ZIndex } from "./zIndex.js";
|
|
|
6
6
|
export { CommonColors, Palette, PaletteColor, PaletteColorOptions, PaletteOptions, SimplePaletteColorOptions, TypeText, TypeAction, TypeBackground, PaletteMode, Color } from "./createPalette.js";
|
|
7
7
|
export { default as createColorScheme } from "./createColorScheme.js";
|
|
8
8
|
export { default as createStyles } from "./createStyles.js";
|
|
9
|
-
export {
|
|
9
|
+
export { TypographyVariants, TypographyVariantsOptions, TypographyStyle, TypographyVariant } from "./createTypography.js";
|
|
10
10
|
export { default as responsiveFontSizes } from "./responsiveFontSizes.js";
|
|
11
11
|
export { Duration, Easing, Transitions, TransitionsOptions, duration, easing } from "./createTransitions.js";
|
|
12
12
|
export { Mixins } from "./createMixins.js";
|
|
@@ -38,6 +38,7 @@ export { default as makeStyles } from "./makeStyles.js";
|
|
|
38
38
|
export { default as withStyles } from "./withStyles.js";
|
|
39
39
|
export { default as withTheme } from "./withTheme.js";
|
|
40
40
|
export * from "./ThemeProviderWithVars.js";
|
|
41
|
+
export type { StorageManager } from '@mui/system/cssVars';
|
|
41
42
|
export { default as extendTheme } from "./createThemeWithVars.js";
|
|
42
43
|
export type { ColorSchemeOverrides, SupportedColorScheme, ColorSystem, CssVarsPalette, Opacity, Overlays, PaletteAlert, PaletteActionChannel, PaletteAppBar, PaletteAvatar, PaletteChip, PaletteColorChannel, PaletteCommonChannel, PaletteFilledInput, PaletteLinearProgress, PaletteSkeleton, PaletteSlider, PaletteSnackbarContent, PaletteSpeedDialAction, PaletteStepConnector, PaletteStepContent, PaletteSwitch, PaletteTableCell, PaletteTextChannel, PaletteTooltip, CssVarsThemeOptions, CssVarsTheme, ThemeVars, ThemeCssVar, ThemeCssVarOverrides, ColorSystemOptions } from "./createThemeWithVars.js";
|
|
43
44
|
export { default as getOverlayAlpha } from "./getOverlayAlpha.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Breakpoint } from '@mui/system';
|
|
2
|
-
import {
|
|
2
|
+
import { TypographyVariants } from "./createTypography.js";
|
|
3
3
|
export interface ResponsiveFontSizesOptions {
|
|
4
4
|
breakpoints?: Breakpoint[];
|
|
5
5
|
disableAlign?: boolean;
|
|
6
6
|
factor?: number;
|
|
7
|
-
variants?: Array<keyof
|
|
7
|
+
variants?: Array<keyof TypographyVariants>;
|
|
8
8
|
}
|
|
9
9
|
export default function responsiveFontSizes<T extends {
|
|
10
|
-
typography:
|
|
10
|
+
typography: TypographyVariants;
|
|
11
11
|
}>(theme: T, options?: ResponsiveFontSizesOptions): T;
|
|
@@ -29,6 +29,9 @@ export default function useScrollTrigger(options = {}) {
|
|
|
29
29
|
const store = React.useRef();
|
|
30
30
|
const [trigger, setTrigger] = React.useState(() => getTrigger(store, other));
|
|
31
31
|
React.useEffect(() => {
|
|
32
|
+
if (target === null) {
|
|
33
|
+
return setTrigger(false);
|
|
34
|
+
}
|
|
32
35
|
const handleScroll = () => {
|
|
33
36
|
setTrigger(getTrigger(store, {
|
|
34
37
|
target,
|
package/esm/version/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const version = "7.0.0-beta.
|
|
1
|
+
export const version = "7.0.0-beta.4";
|
|
2
2
|
export const major = Number("7");
|
|
3
3
|
export const minor = Number("0");
|
|
4
4
|
export const patch = Number("0");
|
|
5
|
-
export const prerelease = "beta.
|
|
5
|
+
export const prerelease = "beta.4";
|
|
6
6
|
export default version;
|
package/index.js
CHANGED
|
@@ -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
|
*/
|
|
@@ -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
|
/**
|
package/modern/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
|
});
|
|
@@ -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.
|