@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.
Files changed (126) hide show
  1. package/Accordion/Accordion.d.ts +13 -2
  2. package/Accordion/Accordion.js +18 -6
  3. package/AccordionSummary/AccordionSummary.d.ts +39 -4
  4. package/AccordionSummary/AccordionSummary.js +67 -16
  5. package/CHANGELOG.md +84 -0
  6. package/InputBase/InputBase.js +2 -2
  7. package/ListItemText/ListItemText.d.ts +10 -0
  8. package/ListItemText/ListItemText.js +14 -5
  9. package/Select/SelectInput.js +2 -2
  10. package/SpeedDial/SpeedDial.d.ts +10 -0
  11. package/SpeedDial/SpeedDial.js +40 -11
  12. package/SpeedDialAction/SpeedDialAction.js +1 -1
  13. package/StepLabel/StepLabel.d.ts +19 -1
  14. package/StepLabel/StepLabel.js +14 -5
  15. package/Switch/Switch.d.ts +62 -1
  16. package/Switch/Switch.js +71 -9
  17. package/TextField/TextField.d.ts +30 -0
  18. package/TextField/TextField.js +22 -11
  19. package/TextareaAutosize/TextareaAutosize.js +25 -14
  20. package/Tooltip/Tooltip.d.ts +1 -1
  21. package/Tooltip/Tooltip.js +1 -1
  22. package/Typography/Typography.d.ts +3 -3
  23. package/esm/Accordion/Accordion.d.ts +13 -2
  24. package/esm/Accordion/Accordion.js +18 -6
  25. package/esm/AccordionSummary/AccordionSummary.d.ts +39 -4
  26. package/esm/AccordionSummary/AccordionSummary.js +67 -16
  27. package/esm/InputBase/InputBase.js +2 -2
  28. package/esm/ListItemText/ListItemText.d.ts +10 -0
  29. package/esm/ListItemText/ListItemText.js +14 -5
  30. package/esm/Select/SelectInput.js +2 -2
  31. package/esm/SpeedDial/SpeedDial.d.ts +10 -0
  32. package/esm/SpeedDial/SpeedDial.js +40 -11
  33. package/esm/SpeedDialAction/SpeedDialAction.js +1 -1
  34. package/esm/StepLabel/StepLabel.d.ts +19 -1
  35. package/esm/StepLabel/StepLabel.js +14 -5
  36. package/esm/Switch/Switch.d.ts +62 -1
  37. package/esm/Switch/Switch.js +71 -9
  38. package/esm/TextField/TextField.d.ts +30 -0
  39. package/esm/TextField/TextField.js +22 -11
  40. package/esm/TextareaAutosize/TextareaAutosize.js +26 -15
  41. package/esm/Tooltip/Tooltip.d.ts +1 -1
  42. package/esm/Tooltip/Tooltip.js +1 -1
  43. package/esm/Typography/Typography.d.ts +3 -3
  44. package/esm/index.js +1 -1
  45. package/esm/styles/ThemeProvider.d.ts +6 -0
  46. package/esm/styles/ThemeProvider.js +11 -0
  47. package/esm/styles/adaptV4Theme.d.ts +2 -2
  48. package/esm/styles/createPalette.js +3 -3
  49. package/esm/styles/createThemeNoVars.d.ts +3 -3
  50. package/esm/styles/createThemeNoVars.js +2 -2
  51. package/esm/styles/createThemeWithVars.js +2 -2
  52. package/esm/styles/createTypography.d.ts +4 -4
  53. package/esm/styles/index.d.ts +1 -1
  54. package/esm/styles/index.js +2 -2
  55. package/esm/styles/makeStyles.js +2 -2
  56. package/esm/styles/responsiveFontSizes.d.ts +3 -3
  57. package/esm/styles/responsiveFontSizes.js +2 -2
  58. package/esm/styles/withStyles.js +2 -2
  59. package/esm/styles/withTheme.js +2 -2
  60. package/esm/useScrollTrigger/useScrollTrigger.d.ts +1 -1
  61. package/esm/useScrollTrigger/useScrollTrigger.js +3 -0
  62. package/esm/utils/mergeSlotProps.js +25 -0
  63. package/esm/version/index.js +2 -2
  64. package/index.js +1 -1
  65. package/modern/Accordion/Accordion.d.ts +13 -2
  66. package/modern/Accordion/Accordion.js +18 -6
  67. package/modern/AccordionSummary/AccordionSummary.d.ts +39 -4
  68. package/modern/AccordionSummary/AccordionSummary.js +67 -16
  69. package/modern/InputBase/InputBase.js +2 -2
  70. package/modern/ListItemText/ListItemText.d.ts +10 -0
  71. package/modern/ListItemText/ListItemText.js +14 -5
  72. package/modern/Select/SelectInput.js +2 -2
  73. package/modern/SpeedDial/SpeedDial.d.ts +10 -0
  74. package/modern/SpeedDial/SpeedDial.js +40 -11
  75. package/modern/SpeedDialAction/SpeedDialAction.js +1 -1
  76. package/modern/StepLabel/StepLabel.d.ts +19 -1
  77. package/modern/StepLabel/StepLabel.js +14 -5
  78. package/modern/Switch/Switch.d.ts +62 -1
  79. package/modern/Switch/Switch.js +71 -9
  80. package/modern/TextField/TextField.d.ts +30 -0
  81. package/modern/TextField/TextField.js +22 -11
  82. package/modern/TextareaAutosize/TextareaAutosize.js +26 -15
  83. package/modern/Tooltip/Tooltip.d.ts +1 -1
  84. package/modern/Tooltip/Tooltip.js +1 -1
  85. package/modern/Typography/Typography.d.ts +3 -3
  86. package/modern/index.js +1 -1
  87. package/modern/styles/ThemeProvider.d.ts +6 -0
  88. package/modern/styles/ThemeProvider.js +11 -0
  89. package/modern/styles/adaptV4Theme.d.ts +2 -2
  90. package/modern/styles/createPalette.js +3 -3
  91. package/modern/styles/createThemeNoVars.d.ts +3 -3
  92. package/modern/styles/createThemeNoVars.js +2 -2
  93. package/modern/styles/createThemeWithVars.js +2 -2
  94. package/modern/styles/createTypography.d.ts +4 -4
  95. package/modern/styles/index.d.ts +1 -1
  96. package/modern/styles/index.js +2 -2
  97. package/modern/styles/makeStyles.js +2 -2
  98. package/modern/styles/responsiveFontSizes.d.ts +3 -3
  99. package/modern/styles/responsiveFontSizes.js +2 -2
  100. package/modern/styles/withStyles.js +2 -2
  101. package/modern/styles/withTheme.js +2 -2
  102. package/modern/useScrollTrigger/useScrollTrigger.d.ts +1 -1
  103. package/modern/useScrollTrigger/useScrollTrigger.js +3 -0
  104. package/modern/utils/mergeSlotProps.js +25 -0
  105. package/modern/version/index.js +2 -2
  106. package/package.json +7 -7
  107. package/styles/ThemeProvider.d.ts +6 -0
  108. package/styles/ThemeProvider.js +11 -0
  109. package/styles/adaptV4Theme.d.ts +2 -2
  110. package/styles/createPalette.js +3 -3
  111. package/styles/createThemeNoVars.d.ts +3 -3
  112. package/styles/createThemeNoVars.js +2 -2
  113. package/styles/createThemeWithVars.js +2 -2
  114. package/styles/createTypography.d.ts +4 -4
  115. package/styles/index.d.ts +1 -1
  116. package/styles/index.js +2 -2
  117. package/styles/makeStyles.js +2 -2
  118. package/styles/responsiveFontSizes.d.ts +3 -3
  119. package/styles/responsiveFontSizes.js +2 -2
  120. package/styles/withStyles.js +2 -2
  121. package/styles/withTheme.js +2 -2
  122. package/tsconfig.build.tsbuildinfo +1 -1
  123. package/useScrollTrigger/useScrollTrigger.d.ts +1 -1
  124. package/useScrollTrigger/useScrollTrigger.js +3 -0
  125. package/utils/mergeSlotProps.js +24 -0
  126. package/version/index.js +2 -2
@@ -178,7 +178,7 @@ export interface TooltipProps extends StandardProps<React.HTMLAttributes<HTMLDiv
178
178
  * Tooltip placement.
179
179
  * @default 'bottom'
180
180
  */
181
- placement?: 'bottom-end' | 'bottom-start' | 'bottom' | 'left-end' | 'left-start' | 'left' | 'right-end' | 'right-start' | 'right' | 'top-end' | 'top-start' | 'top';
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.
@@ -841,7 +841,7 @@ process.env.NODE_ENV !== "production" ? Tooltip.propTypes /* remove-proptypes */
841
841
  * Tooltip placement.
842
842
  * @default 'bottom'
843
843
  */
844
- placement: PropTypes.oneOf(['bottom-end', 'bottom-start', 'bottom', 'left-end', 'left-start', 'left', 'right-end', 'right-start', 'right', 'top-end', 'top-start', 'top']),
844
+ placement: 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']),
845
845
  /**
846
846
  * The component used for the popper.
847
847
  * @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 { Variant } from "../styles/createTypography.js";
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<Variant | 'inherit', TypographyPropsVariantOverrides>;
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<Variant | 'inherit', TypographyPropsVariantOverrides>, string>>;
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;
package/esm/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v7.0.0-beta.3
2
+ * @mui/material v7.0.0-rc.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -21,6 +21,12 @@ type ThemeProviderCssVariablesProps = CssThemeVariables extends {
21
21
  * @default false
22
22
  */
23
23
  disableStyleSheetGeneration?: boolean;
24
+ /**
25
+ * If `true`, theme values are recalculated when the mode changes.
26
+ * The `theme.colorSchemes.{mode}.*` nodes will be shallow merged to the top-level of the theme.
27
+ * @default false
28
+ */
29
+ forceThemeRerender?: boolean;
24
30
  } : {};
25
31
  export interface ThemeProviderProps<Theme = DefaultTheme> extends ThemeProviderCssVariablesProps {
26
32
  children?: React.ReactNode;
@@ -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
@@ -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 { TypographyOptions } from "./createTypography.js";
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?: TypographyOptions | ((palette: Palette) => TypographyOptions);
24
+ typography?: TypographyVariantsOptions | ((palette: Palette) => TypographyVariantsOptions);
25
25
  variants?: ComponentsVariants;
26
26
  zIndex?: ZIndexOptions;
27
27
  unstable_strictMode?: boolean;
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  import deepmerge from '@mui/utils/deepmerge';
3
3
  import { darken, getContrastRatio, lighten } from '@mui/system/colorManipulator';
4
4
  import common from "../colors/common.js";
@@ -218,10 +218,10 @@ export default function createPalette(palette) {
218
218
  color.main = color[mainShade];
219
219
  }
220
220
  if (!color.hasOwnProperty('main')) {
221
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatMuiErrorMessage(11, name ? ` (${name})` : '', mainShade));
221
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `The color object needs to have a \`main\` property or a \`${mainShade}\` property.` : _formatErrorMessage(11, name ? ` (${name})` : '', mainShade));
222
222
  }
223
223
  if (typeof color.main !== 'string') {
224
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : _formatMuiErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
224
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The color${name ? ` (${name})` : ''} provided to augmentColor(color) is invalid.\n` + `\`color.main\` should be a string, but \`${JSON.stringify(color.main)}\` was provided instead.\n` + '\n' + 'Did you intend to use one of the following approaches?\n' + '\n' + 'import { green } from "@mui/material/colors";\n' + '\n' + 'const theme1 = createTheme({ palette: {\n' + ' primary: green,\n' + '} });\n' + '\n' + 'const theme2 = createTheme({ palette: {\n' + ' primary: { main: green[500] },\n' + '} });' : _formatErrorMessage(12, name ? ` (${name})` : '', JSON.stringify(color.main)));
225
225
  }
226
226
  addLightOrDark(color, 'light', lightShade, tonalOffset);
227
227
  addLightOrDark(color, 'dark', darkShade, tonalOffset);
@@ -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 { Typography, TypographyOptions } from "./createTypography.js";
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?: TypographyOptions | ((palette: Palette) => TypographyOptions);
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: Typography;
43
+ typography: TypographyVariants;
44
44
  zIndex: ZIndex;
45
45
  unstable_strictMode?: boolean;
46
46
  }
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  import deepmerge from '@mui/utils/deepmerge';
3
3
  import styleFunctionSx, { unstable_defaultSxConfig as defaultSxConfig } from '@mui/system/styleFunctionSx';
4
4
  import systemCreateTheme from '@mui/system/createTheme';
@@ -27,7 +27,7 @@ function createThemeNoVars(options = {}, ...args) {
27
27
  options.generateThemeVars === undefined) {
28
28
  throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: `vars` is a private field used for CSS variables support.\n' +
29
29
  // #host-reference
30
- 'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : _formatMuiErrorMessage(20));
30
+ 'Please use another name or follow the [docs](https://mui.com/material-ui/customization/css-theme-variables/usage/) to enable the feature.' : _formatErrorMessage(20));
31
31
  }
32
32
  const palette = createPalette(paletteInput);
33
33
  const systemTheme = systemCreateTheme(options);
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  import deepmerge from '@mui/utils/deepmerge';
3
3
  import { unstable_createGetCssVar as systemCreateGetCssVar, createSpacing } from '@mui/system';
4
4
  import { createUnarySpacing } from '@mui/system/spacing';
@@ -131,7 +131,7 @@ export default function createThemeWithVars(options = {}, ...args) {
131
131
  defaultScheme = true;
132
132
  }
133
133
  if (!defaultScheme) {
134
- throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : _formatMuiErrorMessage(21, defaultColorScheme));
134
+ throw new Error(process.env.NODE_ENV !== "production" ? `MUI: The \`colorSchemes.${defaultColorScheme}\` option is either missing or invalid.` : _formatErrorMessage(21, defaultColorScheme));
135
135
  }
136
136
 
137
137
  // Create the palette for the default color scheme, either `light`, `dark`, or custom color scheme.
@@ -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 Variant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'subtitle1' | 'subtitle2' | 'body1' | 'body2' | 'caption' | 'button' | 'overline';
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 Typography extends Record<Variant, TypographyStyle>, FontStyle, TypographyUtils {}
49
- export interface TypographyOptions extends Partial<Record<Variant, TypographyStyleOptions> & FontStyleOptions> {}
50
- export default function createTypography(palette: Palette, typography: TypographyOptions | ((palette: Palette) => TypographyOptions)): 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;
@@ -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 { Typography as TypographyVariants, TypographyOptions as TypographyVariantsOptions, TypographyStyle, Variant as TypographyVariant } from "./createTypography.js";
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";
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export { default as THEME_ID } from "./identifier.js";
3
3
  export { default as adaptV4Theme } from "./adaptV4Theme.js";
4
4
  export { hexToRgb, rgbToHex, hslToRgb, decomposeColor, recomposeColor, getContrastRatio, getLuminance, emphasize, alpha, darken, lighten, css, keyframes } from '@mui/system';
@@ -6,7 +6,7 @@ export { unstable_createBreakpoints } from '@mui/system/createBreakpoints';
6
6
  // TODO: Remove this function in v6.
7
7
  // eslint-disable-next-line @typescript-eslint/naming-convention
8
8
  export function experimental_sx() {
9
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatMuiErrorMessage(19));
9
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + 'For more details, see https://github.com/mui/material-ui/pull/35150.' : _formatErrorMessage(19));
10
10
  }
11
11
  export { default as createTheme } from "./createTheme.js";
12
12
  export { default as unstable_createMuiStrictModeTheme } from "./createMuiStrictModeTheme.js";
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export default function makeStyles() {
3
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(14));
3
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: makeStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatErrorMessage(14));
4
4
  }
@@ -1,11 +1,11 @@
1
1
  import { Breakpoint } from '@mui/system';
2
- import { Typography } from "./createTypography.js";
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 Typography>;
7
+ variants?: Array<keyof TypographyVariants>;
8
8
  }
9
9
  export default function responsiveFontSizes<T extends {
10
- typography: Typography;
10
+ typography: TypographyVariants;
11
11
  }>(theme: T, options?: ResponsiveFontSizesOptions): T;
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  import { isUnitless, convertLength, responsiveProperty, alignProperty, fontGrid } from "./cssUtils.js";
3
3
  export default function responsiveFontSizes(themeInput, options = {}) {
4
4
  const {
@@ -34,7 +34,7 @@ export default function responsiveFontSizes(themeInput, options = {}) {
34
34
  lineHeight
35
35
  } = style;
36
36
  if (!isUnitless(lineHeight) && !disableAlign) {
37
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : _formatMuiErrorMessage(6));
37
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: Unsupported non-unitless line height with grid alignment.\n' + 'Use unitless line heights instead.' : _formatErrorMessage(6));
38
38
  }
39
39
  if (!isUnitless(lineHeight)) {
40
40
  // make it unitless
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export default function withStyles() {
3
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(15));
3
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withStyles is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatErrorMessage(15));
4
4
  }
@@ -1,4 +1,4 @@
1
- import _formatMuiErrorMessage from "@mui/utils/formatMuiErrorMessage";
1
+ import _formatErrorMessage from "@mui/utils/formatMuiErrorMessage";
2
2
  export default function withTheme() {
3
- throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatMuiErrorMessage(16));
3
+ throw new Error(process.env.NODE_ENV !== "production" ? 'MUI: withTheme is no longer exported from @mui/material/styles.\n' + 'You have to import it from @mui/styles.\n' + 'See https://mui.com/r/migration-v4/#mui-material-styles for more details.' : _formatErrorMessage(16));
4
4
  }
@@ -1,6 +1,6 @@
1
1
  export interface UseScrollTriggerOptions {
2
2
  disableHysteresis?: boolean;
3
- target?: Node | Window;
3
+ target?: Node | Window | null;
4
4
  threshold?: number;
5
5
  }
6
6
  export default function useScrollTrigger(options?: UseScrollTriggerOptions): boolean;
@@ -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,
@@ -1,8 +1,29 @@
1
1
  import clsx from 'clsx';
2
+
3
+ // Brought from [Base UI](https://github.com/mui/base-ui/blob/master/packages/react/src/merge-props/mergeProps.ts#L119)
4
+ // Use it directly from Base UI once it's a package dependency.
5
+ function isEventHandler(key, value) {
6
+ // This approach is more efficient than using a regex.
7
+ const thirdCharCode = key.charCodeAt(2);
8
+ return key[0] === 'o' && key[1] === 'n' && thirdCharCode >= 65 /* A */ && thirdCharCode <= 90 /* Z */ && typeof value === 'function';
9
+ }
2
10
  export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
3
11
  if (!externalSlotProps) {
4
12
  return defaultSlotProps;
5
13
  }
14
+ function extractHandlers(externalSlotPropsValue, defaultSlotPropsValue) {
15
+ const handlers = {};
16
+ Object.keys(defaultSlotPropsValue).forEach(key => {
17
+ if (isEventHandler(key, defaultSlotPropsValue[key]) && typeof externalSlotPropsValue[key] === 'function') {
18
+ // only compose the handlers if both default and external slot props match the event handler
19
+ handlers[key] = (...args) => {
20
+ externalSlotPropsValue[key](...args);
21
+ defaultSlotPropsValue[key](...args);
22
+ };
23
+ }
24
+ });
25
+ return handlers;
26
+ }
6
27
  if (typeof externalSlotProps === 'function' || typeof defaultSlotProps === 'function') {
7
28
  return ownerState => {
8
29
  const defaultSlotPropsValue = typeof defaultSlotProps === 'function' ? defaultSlotProps(ownerState) : defaultSlotProps;
@@ -11,9 +32,11 @@ export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
11
32
  ...defaultSlotPropsValue
12
33
  }) : externalSlotProps;
13
34
  const className = clsx(ownerState?.className, defaultSlotPropsValue?.className, externalSlotPropsValue?.className);
35
+ const handlers = extractHandlers(externalSlotPropsValue, defaultSlotPropsValue);
14
36
  return {
15
37
  ...defaultSlotPropsValue,
16
38
  ...externalSlotPropsValue,
39
+ ...handlers,
17
40
  ...(!!className && {
18
41
  className
19
42
  }),
@@ -30,10 +53,12 @@ export default function mergeSlotProps(externalSlotProps, defaultSlotProps) {
30
53
  };
31
54
  }
32
55
  const typedDefaultSlotProps = defaultSlotProps;
56
+ const handlers = extractHandlers(externalSlotProps, typedDefaultSlotProps);
33
57
  const className = clsx(typedDefaultSlotProps?.className, externalSlotProps?.className);
34
58
  return {
35
59
  ...defaultSlotProps,
36
60
  ...externalSlotProps,
61
+ ...handlers,
37
62
  ...(!!className && {
38
63
  className
39
64
  }),
@@ -1,6 +1,6 @@
1
- export const version = "7.0.0-beta.3";
1
+ export const version = "7.0.0-rc.0";
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.3";
5
+ export const prerelease = "rc.0";
6
6
  export default version;
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/material v7.0.0-beta.3
2
+ * @mui/material v7.0.0-rc.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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 AccordionTransitionSlotPropsOverrides {}
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(AccordionRoot, {
200
- className: clsx(classes.root, className),
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 AccordionSummaryOwnProps {
7
+ export interface AccordionSummarySlots {
8
8
  /**
9
- * The content of the component.
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
  *