diff --git a/packages/mui-material/src/styles/ThemeProvider.tsx b/packages/mui-material/src/styles/ThemeProvider.tsx index b3f45c0f65f267..2b5501a28039ec 100644 --- a/packages/mui-material/src/styles/ThemeProvider.tsx +++ b/packages/mui-material/src/styles/ThemeProvider.tsx @@ -4,7 +4,7 @@ import { DefaultTheme } from '@mui/system'; import { StorageManager } from '@mui/system/cssVars'; import ThemeProviderNoVars from './ThemeProviderNoVars'; import { CssThemeVariables } from './createThemeNoVars'; -import { CssVarsProvider } from './ThemeProviderWithVars'; +import { InternalCssVarsProvider as CssVarsProvider } from './ThemeProviderWithVars'; import { CssVarsTheme } from './createThemeWithVars'; import THEME_ID from './identifier'; diff --git a/packages/mui-material/src/styles/ThemeProviderWithVars.tsx b/packages/mui-material/src/styles/ThemeProviderWithVars.tsx index 533448510aca67..2036a6b6084806 100644 --- a/packages/mui-material/src/styles/ThemeProviderWithVars.tsx +++ b/packages/mui-material/src/styles/ThemeProviderWithVars.tsx @@ -7,11 +7,10 @@ import createTypography from './createTypography'; import THEME_ID from './identifier'; import { defaultConfig } from '../InitColorSchemeScript/InitColorSchemeScript'; -const { - CssVarsProvider: InternalCssVarsProvider, - useColorScheme, - getInitColorSchemeScript: deprecatedGetInitColorSchemeScript, -} = createCssVarsProvider({ +const { CssVarsProvider: InternalCssVarsProvider, useColorScheme } = createCssVarsProvider< + SupportedColorScheme, + typeof THEME_ID +>({ themeId: THEME_ID, // @ts-ignore ignore module augmentation tests theme: () => createTheme({ cssVariables: true }), @@ -35,71 +34,6 @@ const { }, }); -let warnedOnce = false; +export { useColorScheme }; -// TODO: remove in v7 -// eslint-disable-next-line @typescript-eslint/naming-convention -function Experimental_CssVarsProvider(props: any) { - if (process.env.NODE_ENV !== 'production') { - if (!warnedOnce) { - console.warn( - [ - 'MUI: The Experimental_CssVarsProvider component has been ported into ThemeProvider.', - '', - "You should use `import { ThemeProvider } from '@mui/material/styles'` instead.", - 'For more details, check out https://mui.com/material-ui/customization/css-theme-variables/usage/', - ].join('\n'), - ); - - warnedOnce = true; - } - } - - return ; -} - -let warnedInitScriptOnce = false; - -// TODO: remove in v7 -const getInitColorSchemeScript: typeof deprecatedGetInitColorSchemeScript = (params) => { - if (!warnedInitScriptOnce) { - console.warn( - [ - 'MUI: The getInitColorSchemeScript function has been deprecated.', - '', - "You should use `import InitColorSchemeScript from '@mui/material/InitColorSchemeScript'`", - 'and replace the function call with `` instead.', - ].join('\n'), - ); - - warnedInitScriptOnce = true; - } - return deprecatedGetInitColorSchemeScript(params); -}; - -/** - * TODO: remove this export in v7 - * @deprecated - * The `CssVarsProvider` component has been deprecated and ported into `ThemeProvider`. - * - * You should use `ThemeProvider` and `createTheme()` instead: - * - * ```diff - * - import { CssVarsProvider, extendTheme } from '@mui/material/styles'; - * + import { ThemeProvider, createTheme } from '@mui/material/styles'; - * - * - const theme = extendTheme(); - * + const theme = createTheme({ - * + cssVariables: true, - * + colorSchemes: { light: true, dark: true }, - * + }); - * - * - - * + - * ``` - * - * To see the full documentation, check out https://mui.com/material-ui/customization/css-theme-variables/usage/. - */ -export const CssVarsProvider = InternalCssVarsProvider; - -export { useColorScheme, getInitColorSchemeScript, Experimental_CssVarsProvider }; +export { InternalCssVarsProvider }; diff --git a/packages/mui-material/src/styles/createStyles.d.ts b/packages/mui-material/src/styles/createStyles.d.ts deleted file mode 100644 index c2b2a0e429c310..00000000000000 --- a/packages/mui-material/src/styles/createStyles.d.ts +++ /dev/null @@ -1 +0,0 @@ -export default function createStyles(styles: any): never; diff --git a/packages/mui-material/src/styles/createStyles.js b/packages/mui-material/src/styles/createStyles.js deleted file mode 100644 index dc0013616e2e31..00000000000000 --- a/packages/mui-material/src/styles/createStyles.js +++ /dev/null @@ -1,16 +0,0 @@ -let warnedOnce = false; - -// To remove in v6 -export default function createStyles(styles) { - if (!warnedOnce) { - console.warn( - [ - 'MUI: createStyles from @mui/material/styles is deprecated.', - 'Please use @mui/styles/createStyles', - ].join('\n'), - ); - - warnedOnce = true; - } - return styles; -} diff --git a/packages/mui-material/src/styles/experimental_extendTheme.js b/packages/mui-material/src/styles/experimental_extendTheme.js deleted file mode 100644 index be0e6f349b9317..00000000000000 --- a/packages/mui-material/src/styles/experimental_extendTheme.js +++ /dev/null @@ -1,19 +0,0 @@ -import extendTheme from './createThemeWithVars'; - -let warnedOnce = false; - -export default function deprecatedExtendTheme(...args) { - if (!warnedOnce) { - console.warn( - [ - 'MUI: The `experimental_extendTheme` has been stabilized.', - '', - "You should use `import { extendTheme } from '@mui/material/styles'`", - ].join('\n'), - ); - - warnedOnce = true; - } - - return extendTheme(...args); -} diff --git a/packages/mui-material/src/styles/index.d.ts b/packages/mui-material/src/styles/index.d.ts index 1241e52782be10..b53e7e873c07ad 100644 --- a/packages/mui-material/src/styles/index.d.ts +++ b/packages/mui-material/src/styles/index.d.ts @@ -26,7 +26,6 @@ export { Color, } from './createPalette'; export { default as createColorScheme } from './createColorScheme'; -export { default as createStyles } from './createStyles'; export { TypographyVariants, TypographyVariantsOptions, @@ -73,9 +72,6 @@ export { SxProps, } from '@mui/system'; export { unstable_createBreakpoints } from '@mui/system/createBreakpoints'; -// TODO: Remove this function in v6. -// eslint-disable-next-line @typescript-eslint/naming-convention -export function experimental_sx(): any; export { default as useTheme } from './useTheme'; export { default as useThemeProps } from './useThemeProps'; export * from './useThemeProps'; diff --git a/packages/mui-material/src/styles/index.js b/packages/mui-material/src/styles/index.js index b9dfa4913c7d61..d059e306201673 100644 --- a/packages/mui-material/src/styles/index.js +++ b/packages/mui-material/src/styles/index.js @@ -16,18 +16,9 @@ export { keyframes, } from '@mui/system'; export { unstable_createBreakpoints } from '@mui/system/createBreakpoints'; -// TODO: Remove this function in v6. -// eslint-disable-next-line @typescript-eslint/naming-convention -export function experimental_sx() { - throw /* minify-error */ new Error( - 'MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.' + - 'For more details, see https://github.com/mui/material-ui/pull/35150.', - ); -} export { default as createTheme } from './createTheme'; export { default as enhanceHighContrast } from './enhanceHighContrast'; export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictModeTheme'; -export { default as createStyles } from './createStyles'; export { getUnit as unstable_getUnit, toUnitless as unstable_toUnitless } from './cssUtils'; export { default as responsiveFontSizes } from './responsiveFontSizes'; export { default as createTransitions, duration, easing } from './createTransitions'; @@ -45,7 +36,6 @@ export { default as withTheme } from './withTheme'; export * from './ThemeProviderWithVars'; export { default as extendTheme } from './createThemeWithVars'; -export { default as experimental_extendTheme } from './experimental_extendTheme'; // TODO: Remove in v7 export { default as getOverlayAlpha } from './getOverlayAlpha'; export { default as shouldSkipGeneratingVar } from './shouldSkipGeneratingVar';