Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Bring experimental_sx back with error code #35528

Merged
merged 5 commits into from Dec 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/public/static/error-codes.json
Expand Up @@ -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 <CssVarsProvider />"
"19": "MUI: `useColorScheme` must be called under <CssVarsProvider />",
"20": "MUI: The `experimental_sx` has been moved to `theme.unstable_sx`.For more details, see https://github.com/mui/material-ui/pull/35150."
}
3 changes: 3 additions & 0 deletions packages/mui-material/src/styles/index.d.ts
Expand Up @@ -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';
Expand Down
10 changes: 10 additions & 0 deletions 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,
Expand All @@ -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';
Expand Down
4 changes: 4 additions & 0 deletions packages/mui-system/src/index.d.ts
Expand Up @@ -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';

Expand Down
10 changes: 10 additions & 0 deletions 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';
Expand Down Expand Up @@ -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';
Expand Down