Skip to content

Commit

Permalink
Remove styles deprecated exports
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai committed Feb 24, 2025
1 parent f3aef7b commit 55efaa9
Show file tree
Hide file tree
Showing 16 changed files with 38 additions and 48 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/GridLegacy';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/GridLegacy';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/grid/ResponsiveGrid.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/Grid';
Expand Down
2 changes: 1 addition & 1 deletion docs/data/material/components/grid/ResponsiveGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import Box from '@mui/material/Box';
import Paper from '@mui/material/Paper';
import Grid from '@mui/material/Grid';
Expand Down
30 changes: 30 additions & 0 deletions docs/data/material/migration/upgrade-to-v7/upgrade-to-v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,26 @@ If you were using a Vite alias to force ESM imports for the icons package, you s
},
```

### createMuiTheme removed

The deprecated `createMuiTheme` function has been removed.
Use `createTheme` instead.

```diff
-import { createMuiTheme } from '@mui/material/styles';
+import { createTheme } from '@mui/material/styles';
```

### experimentalStyled removed

The deprecated `experimentalStyled` function has been removed.
Use `styled` instead.

```diff
-import { experimentalStyled as styled } from '@mui/material/styles';
+import { styled } from '@mui/material/styles';
```

### Grid and Grid2 renamed

The deprecated `Grid` component has been renamed to `GridLegacy`.
Expand Down Expand Up @@ -228,3 +248,13 @@ npx @mui/codemod@next v7.0.0/input-label-size-normal-medium <path/to/folder>
### Removal of `data-testid` prop from `SvgIcon`

The default `data-testid` prop has been removed from the icons in `@mui/icons-material` in production bundles. This change ensures that the `data-testid` prop is only defined where needed, reducing the potential for naming clashes and removing unnecessary properties in production.

### StyledEngineProvider deprecated import path removed

Importing `StyledEngineProvider` from `'@mui/material'` was deprecated and now has been removed.
Import it from `'@mui/material/styles'` instead:

```diff
-import { StyledEngineProvider } from '@mui/material';
+import { StyledEngineProvider } from '@mui/material/styles';
```
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import MuiButton from '@mui/material/Button';

const ButtonRoot = styled(MuiButton)(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';
import MuiButton, { ButtonProps } from '@mui/material/Button';

const ButtonRoot = styled(MuiButton)(({ theme }) => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';
import PropTypes from 'prop-types';
import { experimentalStyled as styled } from '@mui/material/styles';
import { styled } from '@mui/material/styles';

import Typography from '../components/Typography';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { experimentalStyled as styled, Theme } from '@mui/material/styles';
import { styled, Theme } from '@mui/material/styles';
import { SxProps } from '@mui/system';
import Typography from '../components/Typography';

Expand Down
4 changes: 0 additions & 4 deletions packages/mui-material/src/StyledEngineProvider/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/mui-material/src/StyledEngineProvider/index.js

This file was deleted.

5 changes: 0 additions & 5 deletions packages/mui-material/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,6 @@ export * from './GlobalStyles';

export * from './version';

/**
* @deprecated will be removed in v5.beta, please use StyledEngineProvider from @mui/material/styles instead
*/
export { StyledEngineProvider } from './styles';

export { unstable_composeClasses } from '@mui/utils';

export { default as generateUtilityClass } from './generateUtilityClass';
Expand Down
6 changes: 0 additions & 6 deletions packages/mui-material/src/styles/createThemeNoVars.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,6 @@ export interface Theme extends BaseTheme, CssVarsProperties {
unstable_sxConfig: SxConfig;
}

/**
* @deprecated
* Use `import { createTheme } from '@mui/material/styles'` instead.
*/
export function createMuiTheme(options?: ThemeOptions, ...args: object[]): Theme;

/**
* Generate a theme base on the options received.
* @param options Takes an incomplete theme object and adds the missing parts.
Expand Down
19 changes: 0 additions & 19 deletions packages/mui-material/src/styles/createThemeNoVars.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,23 +129,4 @@ function createThemeNoVars(options = {}, ...args) {
return muiTheme;
}

let warnedOnce = false;

export function createMuiTheme(...args) {
if (process.env.NODE_ENV !== 'production') {
if (!warnedOnce) {
warnedOnce = true;
console.error(
[
'MUI: the createMuiTheme function was renamed to createTheme.',
'',
"You should use `import { createTheme } from '@mui/material/styles'`",
].join('\n'),
);
}
}

return createThemeNoVars(...args);
}

export default createThemeNoVars;
4 changes: 0 additions & 4 deletions packages/mui-material/src/styles/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,6 @@ export { default as useTheme } from './useTheme';
export { default as useThemeProps } from './useThemeProps';
export * from './useThemeProps';
export { default as styled } from './styled';
/**
* @deprecated will be removed in v5.beta, please use styled from @mui/material/styles instead
*/
export { default as experimentalStyled } from './styled';
export { default as ThemeProvider } from './ThemeProvider';
export { ComponentsProps, ComponentsPropsList } from './props';
export { ComponentsVariants } from './variants';
Expand Down
1 change: 0 additions & 1 deletion packages/mui-material/src/styles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export { default as createColorScheme } from './createColorScheme';
export { default as useTheme } from './useTheme';
export { default as useThemeProps } from './useThemeProps';
export { default as styled } from './styled';
export { default as experimentalStyled } from './styled';
export { default as ThemeProvider } from './ThemeProvider';
export { StyledEngineProvider } from '@mui/system';
// The legacy utilities from @mui/styles
Expand Down

0 comments on commit 55efaa9

Please sign in to comment.