Skip to content

Commit 6a92083

Browse files
joshwoodingoliviertassinari
authored andcommitted
[Typography] Remove deprecated Typography variants and v4 changes (#14562)
* Remove deprecated typography variants and change default colour to inherit * rename headlineMapping to variantMapping * Add Typography display prop * Run docs:api and prettier * Revert incorrect changes * Fix failing tests * Fix Typography demo * Removed some missed useNextVariants * Revert default colour change * Fix regressions * good for me
1 parent 745c6a3 commit 6a92083

File tree

67 files changed

+214
-685
lines changed

Some content is hidden

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

67 files changed

+214
-685
lines changed

.size-limit.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,34 @@ const [main] = fs.readdirSync(dirname).reduce((result, filename) => {
1313

1414
module.exports = [
1515
{
16-
name: 'The initial cost paid for using one component',
16+
name: 'The initial cost paid for using one component with ES modules',
1717
webpack: true,
18-
path: 'packages/material-ui/build/Paper/index.js',
19-
limit: '18.9 KB',
18+
path: 'packages/material-ui/build/esm/Paper/index.js',
19+
limit: '17.5 KB',
2020
},
2121
{
22-
name: 'The initial cost paid for using one component with ES modules',
22+
name: 'The initial cost paid for using one component without ES modules',
2323
webpack: true,
24-
path: 'packages/material-ui/build/esm/Paper/index.js',
25-
limit: '17.9 KB',
24+
path: 'packages/material-ui/build/Paper/index.js',
25+
limit: '18.5 KB',
2626
},
2727
{
2828
name: 'The size of the @material-ui/core modules',
2929
webpack: true,
3030
path: 'packages/material-ui/build/index.js',
31-
limit: '91.9 KB',
31+
limit: '91.5 KB',
3232
},
3333
{
3434
name: 'The theme object',
3535
webpack: true,
3636
path: 'packages/material-ui/build/styles/createMuiTheme.js',
37-
limit: '7 KB',
37+
limit: '6 KB',
3838
},
3939
{
4040
name: 'The size of the @material-ui/styles modules',
4141
webpack: true,
4242
path: 'packages/material-ui-styles/build/index.js',
43-
limit: '16.3 KB',
43+
limit: '15.7 KB',
4444
},
4545
{
4646
name: 'The size of the @material-ui/system modules',
@@ -56,28 +56,28 @@ module.exports = [
5656
},
5757
{
5858
// why we use esm here: https://github.com/mui-org/material-ui/pull/13391#issuecomment-459692816
59-
name: 'The size of the @material-ui/core/Button component',
59+
name: 'The size of the Button component',
6060
webpack: true,
6161
path: 'packages/material-ui/build/esm/Button/index.js',
62-
limit: '24.6 KB',
62+
limit: '24.2 KB',
6363
},
6464
{
6565
// vs https://bundlephobia.com/result?p=react-modal
66-
name: 'The size of the @material-ui/core/Modal component',
66+
name: 'The size of the Modal component',
6767
webpack: true,
6868
path: 'packages/material-ui/build/esm/Modal/index.js',
69-
limit: '24.3 KB',
69+
limit: '24.0 KB',
7070
},
7171
{
7272
// vs https://bundlephobia.com/result?p=react-popper
73-
name: 'The size of the @material-ui/core/Popper component',
73+
name: 'The size of the Popper component',
7474
webpack: true,
7575
path: 'packages/material-ui/build/esm/Popper/index.js',
7676
limit: '9.8 KB',
7777
},
7878
{
7979
// vs https://bundlephobia.com/result?p=focus-trap-react
80-
name: 'The size of the @material-ui/core/Popper component',
80+
name: 'The size of the TrapFocus component',
8181
webpack: true,
8282
path: 'packages/material-ui/build/esm/Modal/TrapFocus.js',
8383
limit: '1.6 KB',
@@ -94,12 +94,12 @@ module.exports = [
9494
name: 'The main docs bundle',
9595
webpack: false,
9696
path: main.path,
97-
limit: '203 KB',
97+
limit: '202 KB',
9898
},
9999
{
100100
name: 'The docs home page',
101101
webpack: false,
102102
path: `.next/static/${buildId}/pages/index.js`,
103-
limit: '13 KB',
103+
limit: '10 KB',
104104
},
105105
];

docs/scripts/buildApi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (args.length < 4) {
3939

4040
const rootDirectory = path.resolve(__dirname, '../../');
4141
const docsApiDirectory = path.resolve(rootDirectory, args[3]);
42-
const theme = createMuiTheme({ typography: { useNextVariants: true } });
42+
const theme = createMuiTheme();
4343

4444
const inheritedComponentRegexp = /\/\/ @inheritedComponent (.*)/;
4545

docs/src/modules/components/AppTableOfContents.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class AppTableOfContents extends React.Component {
231231
{this.itemsServer.map(item2 => (
232232
<li key={item2.text}>
233233
<Link
234-
block
234+
display="block"
235235
color={active === item2.hash ? 'textPrimary' : 'textSecondary'}
236236
href={`#${item2.hash}`}
237237
underline="none"
@@ -248,7 +248,7 @@ class AppTableOfContents extends React.Component {
248248
{item2.children.map(item3 => (
249249
<li key={item3.text}>
250250
<Link
251-
block
251+
display="block"
252252
color={active === item3.hash ? 'textPrimary' : 'textSecondary'}
253253
href={`#${item3.hash}`}
254254
underline="none"

docs/src/modules/styles/getPageContext.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ function getTheme(uiTheme) {
99
direction: uiTheme.direction,
1010
nprogress: { color: uiTheme.paletteType === 'light' ? '#000' : '#fff' },
1111
palette: { ...uiTheme.paletteColors, type: uiTheme.paletteType },
12-
typography: { useNextVariants: true },
1312
});
1413

1514
// Expose the theme as a global variable so people can play with it.

docs/src/modules/utils/getDemoConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import Demo from './demo';
2828
import { createMuiTheme } from "@material-ui/core/styles";
2929
import { ThemeProvider } from "@material-ui/styles";
3030
31-
const theme = createMuiTheme({ typography: { useNextVariants: true } });
31+
const theme = createMuiTheme();
3232
3333
ReactDOM.render(
3434
<ThemeProvider theme={theme}>

docs/src/pages/customization/default-theme/DefaultTheme.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,6 @@ class DefaultTheme extends React.Component {
5050
const { checked, expandPaths } = this.state;
5151

5252
const theme = createMuiTheme({
53-
typography: {
54-
useNextVariants: true,
55-
},
5653
palette: {
5754
type: docsTheme.palette.type,
5855
},

docs/src/pages/customization/overrides/DynamicThemeNesting.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import FormControlLabel from '@material-ui/core/FormControlLabel';
55
import blue from '@material-ui/core/colors/blue';
66
import Switch from '@material-ui/core/Switch';
77

8-
const defaultTheme = createMuiTheme({ typography: { useNextVariants: true } });
8+
const defaultTheme = createMuiTheme();
99

1010
class DynamicThemeNesting extends React.Component {
1111
state = {

docs/src/pages/customization/themes/CustomStyles.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const theme = createMuiTheme({
3535
// My business variables
3636
danger: orange[500],
3737
},
38-
typography: { useNextVariants: true },
3938
});
4039

4140
function CustomStyles() {

docs/src/pages/customization/themes/DarkTheme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const theme = createMuiTheme({
66
palette: {
77
type: 'dark', // Switching the dark mode on is a single property value change.
88
},
9-
typography: { useNextVariants: true },
109
});
1110

1211
function DarkTheme() {

docs/src/pages/customization/themes/FontSizeTheme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const theme = createMuiTheme({
66
typography: {
77
// Tell Material-UI what the font-size on the html element is.
88
htmlFontSize: 10,
9-
useNextVariants: true,
109
},
1110
});
1211

docs/src/pages/customization/themes/OverridesCss.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const theme = createMuiTheme({
1919
},
2020
},
2121
},
22-
typography: { useNextVariants: true },
2322
});
2423

2524
function OverridesCss() {

docs/src/pages/customization/themes/OverridesProperties.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const theme = createMuiTheme({
1010
disableRipple: true, // No more ripple, on the whole application 💣!
1111
},
1212
},
13-
typography: { useNextVariants: true },
1413
});
1514

1615
function OverridesProperties() {

docs/src/pages/customization/themes/Palette.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const theme = createMuiTheme({
88
primary: { main: purple[500] }, // Purple and green play nicely together.
99
secondary: { main: '#11cb5f' }, // This is just green.A700 as hex.
1010
},
11-
typography: { useNextVariants: true },
1211
});
1312

1413
function Palette() {

docs/src/pages/customization/themes/ThemeNesting.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const outerTheme = createMuiTheme({
1010
main: orange[500],
1111
},
1212
},
13-
typography: { useNextVariants: true },
1413
});
1514

1615
const innerTheme = createMuiTheme({
@@ -19,7 +18,6 @@ const innerTheme = createMuiTheme({
1918
main: green[500],
2019
},
2120
},
22-
typography: { useNextVariants: true },
2321
});
2422

2523
function ThemeNesting() {

docs/src/pages/customization/themes/ThemeNestingExtend.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const outerTheme = createMuiTheme({
1010
main: orange[500],
1111
},
1212
},
13-
typography: { useNextVariants: true },
1413
});
1514

1615
function ThemeNestingExtend() {

docs/src/pages/customization/themes/TypographyTheme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const styles = {
1212

1313
const theme = createMuiTheme({
1414
typography: {
15-
useNextVariants: true,
1615
// Use the system font instead of the default Roboto font.
1716
fontFamily: [
1817
'-apple-system',

docs/src/pages/demos/buttons/CustomizedButtons.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,6 @@ const theme = createMuiTheme({
5757
palette: {
5858
primary: green,
5959
},
60-
typography: {
61-
useNextVariants: true,
62-
},
6360
});
6461

6562
function CustomizedButtons(props) {

docs/src/pages/demos/dividers/SubheaderDividers.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,12 @@ function SubheaderDividers(props) {
3232
</ListItem>
3333
<Divider component="li" />
3434
<li>
35-
<Typography className={classes.dividerFullWidth} color="textSecondary" variant="caption">
35+
<Typography
36+
className={classes.dividerFullWidth}
37+
color="textSecondary"
38+
display="block"
39+
variant="caption"
40+
>
3641
Divider
3742
</Typography>
3843
</li>
@@ -41,7 +46,12 @@ function SubheaderDividers(props) {
4146
</ListItem>
4247
<Divider component="li" variant="inset" />
4348
<li>
44-
<Typography className={classes.dividerInset} color="textSecondary" variant="caption">
49+
<Typography
50+
className={classes.dividerInset}
51+
color="textSecondary"
52+
display="block"
53+
variant="caption"
54+
>
4555
Leisure
4656
</Typography>
4757
</li>

docs/src/pages/demos/text-fields/CustomizedInputs.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ const theme = createMuiTheme({
7676
palette: {
7777
primary: green,
7878
},
79-
typography: { useNextVariants: true },
8079
});
8180

8281
function CustomizedInputs(props) {

docs/src/pages/demos/text-fields/CustomizedInputs.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ const theme = createMuiTheme({
8484
palette: {
8585
primary: green,
8686
},
87-
typography: { useNextVariants: true },
8887
});
8988

9089
export interface Props extends WithStyles<typeof styles> {}

docs/src/pages/guides/interoperability/EmotionTheme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { createMuiTheme } from '@material-ui/core/styles';
55
import { darken, fade } from '@material-ui/core/styles/colorManipulator';
66
import { ThemeProvider } from 'emotion-theming';
77

8-
const theme = createMuiTheme({ typography: { useNextVariants: true } });
8+
const theme = createMuiTheme();
99

1010
const StyledButton = styled.button`
1111
padding: 8px 12px;

docs/src/pages/guides/interoperability/StyledComponentsTheme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import NoSsr from '@material-ui/core/NoSsr';
44
import { createMuiTheme } from '@material-ui/core/styles';
55
import { darken, fade } from '@material-ui/core/styles/colorManipulator';
66

7-
const theme = createMuiTheme({ typography: { useNextVariants: true } });
7+
const theme = createMuiTheme();
88

99
const StyledButton = styled.button`
1010
padding: 8px 12px;

docs/src/pages/layout/use-media-query/ThemeHelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function MyComponent() {
1010
return <span>{`theme.breakpoints.up('sm') matches: ${matches}`}</span>;
1111
}
1212

13-
const theme = createMuiTheme({ typography: { useNextVariants: true } });
13+
const theme = createMuiTheme();
1414

1515
export default function ThemeHelper() {
1616
return (

docs/src/pages/layout/use-media-query/UseWidth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function MyComponent() {
1515
return <span>{`width: ${width}`}</span>;
1616
}
1717

18-
const theme = createMuiTheme({ typography: { useNextVariants: true } });
18+
const theme = createMuiTheme();
1919

2020
export default function UseWidth() {
2121
return (

docs/src/pages/premium-themes/instapaper/theme/instapaper/variables.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const primary = {
77

88
const theme = createMuiTheme({
99
typography: {
10-
useNextVariants: true,
1110
// Use the system font instead of the default Roboto font.
1211
fontFamily: [
1312
'-apple-system',

docs/src/pages/premium-themes/onepirate/modules/components/Typography.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const styles = theme => ({
3535
},
3636
});
3737

38-
const headlineMapping = {
38+
const variantMapping = {
3939
h1: 'h1',
4040
h2: 'h1',
4141
h3: 'h1',
@@ -49,7 +49,7 @@ function Typography(props) {
4949
const { children, classes, marked, variant, ...other } = props;
5050

5151
return (
52-
<MuiTypography headlineMapping={headlineMapping} variant={variant} {...other}>
52+
<MuiTypography variantMapping={variantMapping} variant={variant} {...other}>
5353
{children}
5454
{marked ? (
5555
<span className={classes[`marked${capitalize(variant) + capitalize(marked)}`]} />

docs/src/pages/premium-themes/onepirate/modules/theme.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ const rawTheme = createMuiTheme({
3636
fontWeightRegular: 400, // Work Sans
3737
fontWeightMedium: 700, // Roboto Condensed
3838
fontFamilySecondary: "'Roboto Condensed', sans-serif",
39-
useNextVariants: true,
4039
},
4140
});
4241

docs/src/pages/premium-themes/paperbase/Paperbase.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import Header from './Header';
99

1010
let theme = createMuiTheme({
1111
typography: {
12-
useNextVariants: true,
1312
h5: {
1413
fontWeight: 500,
1514
fontSize: 26,

docs/src/pages/premium-themes/tweeper/theme/tweeper/variables.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ const theme = createMuiTheme({
1010
typography: {
1111
fontSize: 15,
1212
fontWeightRegular: 500,
13-
useNextVariants: true,
1413
// Use the system font instead of the default Roboto font.
1514
fontFamily: [
1615
'-apple-system',

0 commit comments

Comments
 (0)