diff --git a/docs/public/static/error-codes.json b/docs/public/static/error-codes.json index 0cc6f9b9a9db27..a6486f38f45d49 100644 --- a/docs/public/static/error-codes.json +++ b/docs/public/static/error-codes.json @@ -17,5 +17,6 @@ "16": "MUI: withTheme is no longer exported from @mui/material/styles.\nYou have to import it from @mui/styles.\nSee https://mui.com/r/migration-v4/#mui-material-styles for more details.", "17": "MUI: Expected valid input target. Did you use a custom `slots.input` and forget to forward refs? See https://mui.com/r/input-component-ref-interface for more info.", "18": "MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.", - "19": "MUI: `useColorScheme` must be called under " + "19": "MUI: `useColorScheme` must be called under ", + "20": "MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.For more details, see https://github.com/mui/material-ui/pull/35150." } diff --git a/packages/mui-material/src/styles/index.d.ts b/packages/mui-material/src/styles/index.d.ts index f7d1a625424649..7b97e384404e37 100644 --- a/packages/mui-material/src/styles/index.d.ts +++ b/packages/mui-material/src/styles/index.d.ts @@ -65,6 +65,9 @@ export { StyledEngineProvider, SxProps, } from '@mui/system'; +// 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 c87fa88993319e..b1801a34a373ac 100644 --- a/packages/mui-material/src/styles/index.js +++ b/packages/mui-material/src/styles/index.js @@ -1,3 +1,5 @@ +import MuiError from '@mui/utils/macros/MuiError.macro'; + export { default as adaptV4Theme } from './adaptV4Theme'; export { hexToRgb, @@ -14,6 +16,14 @@ export { css, keyframes, } from '@mui/system'; +// TODO: Remove this function in v6. +// eslint-disable-next-line @typescript-eslint/naming-convention +export function experimental_sx() { + throw new MuiError( + '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, createMuiTheme } from './createTheme'; export { default as unstable_createMuiStrictModeTheme } from './createMuiStrictModeTheme'; export { default as createStyles } from './createStyles'; diff --git a/packages/mui-system/src/index.d.ts b/packages/mui-system/src/index.d.ts index 2f2a9d6b838bdb..6187f48d589ddf 100644 --- a/packages/mui-system/src/index.d.ts +++ b/packages/mui-system/src/index.d.ts @@ -123,6 +123,10 @@ export { } from './styleFunctionSx'; export * from './styleFunctionSx'; +// TODO: Remove this function in v6. +// eslint-disable-next-line @typescript-eslint/naming-convention +export function experimental_sx(): any; + export { default as Box } from './Box'; export * from './Box'; diff --git a/packages/mui-system/src/index.js b/packages/mui-system/src/index.js index a3bf2528a8cc89..fa438972642b9b 100644 --- a/packages/mui-system/src/index.js +++ b/packages/mui-system/src/index.js @@ -1,3 +1,5 @@ +import MuiError from '@mui/utils/macros/MuiError.macro'; + export { css, keyframes, GlobalStyles, StyledEngineProvider } from '@mui/styled-engine'; export { default as borders } from './borders'; export * from './borders'; @@ -31,6 +33,14 @@ export { extendSxProp as unstable_extendSxProp, unstable_defaultSxConfig, } from './styleFunctionSx'; +// TODO: Remove this function in v6 +// eslint-disable-next-line @typescript-eslint/naming-convention +export function experimental_sx() { + throw new MuiError( + '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 unstable_getThemeValue } from './getThemeValue'; export { default as Box } from './Box'; export { default as createBox } from './createBox';