Skip to content

Commit 684a0d5

Browse files
m4theushweps1lon
authored andcommitted
[theme] Rename createMuiTheme to createTheme (mui#25992)
1 parent 4567565 commit 684a0d5

File tree

322 files changed

+993
-960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+993
-960
lines changed

benchmark/browser/scenarios/styled-components-box-material-ui-system/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import * as React from 'react';
2-
import { createMuiTheme } from '@material-ui/core/styles';
2+
import { createTheme } from '@material-ui/core/styles';
33
import styledComponents, {
44
ThemeProvider as StyledComponentsThemeProvider,
55
} from 'styled-components';
66
import { spacing, palette, typography, compose } from '@material-ui/system';
77

88
const materialSystem = compose(palette, spacing, typography);
9-
const materialSystemTheme = createMuiTheme();
9+
const materialSystemTheme = createTheme();
1010
const BoxMaterialSystem = styledComponents('div')(materialSystem);
1111

1212
export default function StyledComponentsBoxMaterialUISystem() {

benchmark/browser/scenarios/styled-components-box-styled-system/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { createMuiTheme } from '@material-ui/core/styles';
2+
import { createTheme } from '@material-ui/core/styles';
33
import styledComponents, {
44
ThemeProvider as StyledComponentsThemeProvider,
55
} from 'styled-components';
@@ -8,7 +8,7 @@ import { space, color, fontFamily, fontSize, compose } from 'styled-system';
88
const styledSystem = compose(color, space, fontFamily, fontSize);
99
const BoxStyledSystem = styledComponents('div')(styledSystem);
1010

11-
const styledSystemTheme = createMuiTheme();
11+
const styledSystemTheme = createTheme();
1212
styledSystemTheme.breakpoints = ['40em', '52em', '64em'];
1313
styledSystemTheme.colors = styledSystemTheme.palette;
1414
styledSystemTheme.fontSizes = styledSystemTheme.typography;

benchmark/browser/scenarios/styled-emotion/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { createMuiTheme } from '@material-ui/core/styles';
2+
import { createTheme } from '@material-ui/core/styles';
33
import emotionStyled from '@emotion/styled';
44

55
const Div = emotionStyled('div')(
@@ -18,7 +18,7 @@ const Div = emotionStyled('div')(
1818
`,
1919
);
2020

21-
const theme = createMuiTheme();
21+
const theme = createTheme();
2222

2323
export default function StyledEmotion() {
2424
return (

benchmark/browser/scenarios/styled-sc/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { createMuiTheme } from '@material-ui/core/styles';
2+
import { createTheme } from '@material-ui/core/styles';
33
import styledComponents, {
44
ThemeProvider as StyledComponentsThemeProvider,
55
} from 'styled-components';
@@ -20,7 +20,7 @@ const Div = styledComponents('div')(
2020
`,
2121
);
2222

23-
const theme = createMuiTheme();
23+
const theme = createTheme();
2424

2525
export default function StyledSC() {
2626
return (

benchmark/server/scenarios/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import express from 'express';
33
import * as React from 'react';
44
import ReactDOMServer from 'react-dom/server';
55
import { SheetsRegistry } from 'jss';
6-
import { createMuiTheme } from '@material-ui/core/styles';
6+
import { createTheme } from '@material-ui/core/styles';
77
import {
88
styled as materialStyled,
99
StylesProvider,
@@ -35,7 +35,7 @@ function renderFullPage(html, css) {
3535
`;
3636
}
3737

38-
const theme = createMuiTheme({
38+
const theme = createTheme({
3939
palette: {
4040
primary: green,
4141
accent: red,

benchmark/server/scenarios/system.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import Benchmark from 'benchmark';
33
import { unstable_styleFunctionSx as styleFunctionSx } from '@material-ui/system';
44
import styledSystemCss from '@styled-system/css';
5-
import { createMuiTheme } from '@material-ui/core/styles';
5+
import { createTheme } from '@material-ui/core/styles';
66
import { css as chakraCss } from '@chakra-ui/system';
77

88
const suite = new Benchmark.Suite('system', {
@@ -12,7 +12,7 @@ const suite = new Benchmark.Suite('system', {
1212
});
1313
Benchmark.options.minSamples = 100;
1414

15-
const materialSystemTheme = createMuiTheme();
15+
const materialSystemTheme = createTheme();
1616

1717
const styledSystemTheme = {
1818
breakpoints: ['40em', '52em', '64em'],

docs/public/static/error-codes.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
"2": "Material-UI: The `value` prop must be an array when using the `Select` component with `multiple`.",
44
"3": "Material-UI: Unsupported `%s` color.\nWe support the following formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla().",
55
"4": "Material-UI: The color provided to augmentColor(color) is invalid.\nThe color object needs to have a `main` property or a `%s` property.",
6-
"5": "Material-UI: The color provided to augmentColor(color) is invalid.\n`color.main` should be a string, but `%s` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from \"@material-ui/core/colors\";\n\nconst theme1 = createMuiTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createMuiTheme({ palette: {\n primary: { main: green[500] },\n} });",
6+
"5": "Material-UI: The color provided to augmentColor(color) is invalid.\n`color.main` should be a string, but `%s` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from \"@material-ui/core/colors\";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });",
77
"6": "Material-UI: Unsupported non-unitless line height with grid alignment.\nUse unitless line heights instead.",
88
"7": "Material-UI: `capitalize(string)` expects a string argument.",
99
"8": "Material-UI: Unsupported `%s` color.\nWe support the following formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().",
1010
"9": "Material-UI: Unsupported `%s` color.\nThe following formats are supported: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().",
1111
"10": "Material-UI: unsupported `%s` color space.\nThe following color spaces are supported: srgb, display-p3, a98-rgb, prophoto-rgb, rec-2020.",
1212
"11": "Material-UI: The color%s provided to augmentColor(color) is invalid.\nThe color object needs to have a `main` property or a `%s` property.",
13-
"12": "Material-UI: The color%s provided to augmentColor(color) is invalid.\n`color.main` should be a string, but `%s` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from \"@material-ui/core/colors\";\n\nconst theme1 = createMuiTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createMuiTheme({ palette: {\n primary: { main: green[500] },\n} });"
13+
"12": "Material-UI: The color%s provided to augmentColor(color) is invalid.\n`color.main` should be a string, but `%s` was provided instead.\n\nDid you intend to use one of the following approaches?\n\nimport { green } from \"@material-ui/core/colors\";\n\nconst theme1 = createTheme({ palette: {\n primary: green,\n} });\n\nconst theme2 = createTheme({ palette: {\n primary: { main: green[500] },\n} });"
1414
}

docs/scripts/buildApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
import { pageToTitle } from 'docs/src/modules/utils/helpers';
3535
import createGenerateClassName from '@material-ui/styles/createGenerateClassName';
3636
import getStylesCreator from '@material-ui/styles/getStylesCreator';
37-
import { createMuiTheme } from '@material-ui/core/styles';
37+
import { createTheme } from '@material-ui/core/styles';
3838
import { getLineFeed, getUnstyledFilename } from './helpers';
3939

4040
const apiDocsTranslationsDirectory = path.resolve('docs', 'translations', 'api-docs');
@@ -1306,7 +1306,7 @@ async function run(argv: {
13061306

13071307
mkdirSync(outputDirectory, { mode: 0o777, recursive: true });
13081308

1309-
const theme = createMuiTheme();
1309+
const theme = createTheme();
13101310

13111311
/**
13121312
* pageMarkdown: Array<{ components: string[]; filename: string; pathname: string }>

docs/src/modules/branding/BrandingRoot.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react';
22
import CssBaseline from '@material-ui/core/CssBaseline';
3-
import { lighten, darken, createMuiTheme, alpha, ThemeProvider } from '@material-ui/core/styles';
3+
import { lighten, darken, createTheme, alpha, ThemeProvider } from '@material-ui/core/styles';
44
import NProgressBar from '@material-ui/docs/NProgressBar';
55
import BrandingFooter from 'docs/src/modules/branding/BrandingFooter';
66

@@ -50,7 +50,7 @@ function round(value: number) {
5050

5151
const oxfordBlue = '#001E3C';
5252

53-
let theme = createMuiTheme({
53+
let theme = createTheme({
5454
palette: {
5555
text: {
5656
primary: oxfordBlue,
@@ -104,7 +104,7 @@ let theme = createMuiTheme({
104104
},
105105
});
106106

107-
theme = createMuiTheme(theme, {
107+
theme = createTheme(theme, {
108108
palette: {
109109
action: {
110110
active: theme.palette.grey87,

docs/src/modules/components/ThemeContext.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import * as React from 'react';
22
import PropTypes from 'prop-types';
33
import {
44
ThemeProvider as MuiThemeProvider,
5-
createMuiTheme as createLegacyModeTheme,
5+
createTheme as createLegacyModeTheme,
66
unstable_createMuiStrictModeTheme as createStrictModeTheme,
77
darken,
88
} from '@material-ui/core/styles';
@@ -122,11 +122,11 @@ if (process.env.NODE_ENV !== 'production') {
122122
DispatchContext.displayName = 'ThemeDispatchContext';
123123
}
124124

125-
let createMuiTheme;
125+
let createTheme;
126126
if (process.env.REACT_MODE === 'legacy') {
127-
createMuiTheme = createLegacyModeTheme;
127+
createTheme = createLegacyModeTheme;
128128
} else {
129-
createMuiTheme = createStrictModeTheme;
129+
createTheme = createStrictModeTheme;
130130
}
131131

132132
export function ThemeProvider(props) {
@@ -203,7 +203,7 @@ export function ThemeProvider(props) {
203203
}, [direction]);
204204

205205
const theme = React.useMemo(() => {
206-
const nextTheme = createMuiTheme(
206+
const nextTheme = createTheme(
207207
{
208208
direction,
209209
nprogress: {
@@ -247,7 +247,7 @@ export function ThemeProvider(props) {
247247
// Expose the theme as a global variable so people can play with it.
248248
if (process.browser) {
249249
window.theme = theme;
250-
window.createMuiTheme = createMuiTheme;
250+
window.createTheme = createTheme;
251251
}
252252
}, [theme]);
253253

0 commit comments

Comments
 (0)