Skip to content

Commit b35a388

Browse files
committed
fix(material/core): allow mixins to handle 2018 typography configs
In 2018 Material Design did a major overhaul of their spec and changed the typography levels. This PR makes it so that our typography mixins can handle configs that speicfy the levels for the 2018 update. The mixins themselves still use the 2014 levels in their implementation, but are able to map the new levels to what they would have corresponded to in the old system. For refernece, see both versions of the spec below. 2014 spec: https://material.io/archive/guidelines/style/typography.html#typography-styles 2018 spec: https://material.io/design/typography/the-type-system.html#type-scale
1 parent e436479 commit b35a388

File tree

58 files changed

+101
-73
lines changed

Some content is hidden

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

58 files changed

+101
-73
lines changed

src/material-experimental/mdc-autocomplete/_autocomplete-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
}
1212

1313
@mixin mat-mdc-autocomplete-typography($config-or-theme) {
14-
$config: mat-get-typography-config($config-or-theme);
14+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
1515
@include mat-using-mdc-typography($config) {
1616
@include mdc-menu-surface-core-styles($mat-typography-styles-query);
1717

src/material-experimental/mdc-button/_button-theme.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ $mat-button-state-target: '.mdc-button__ripple';
167167
}
168168

169169
@mixin mat-mdc-button-typography($config-or-theme) {
170-
$config: mat-get-typography-config($config-or-theme);
170+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
171171
@include mat-using-mdc-typography($config) {
172172
@include mdc-button-without-ripple($query: $mat-typography-styles-query);
173173
}
@@ -253,7 +253,7 @@ $mat-button-state-target: '.mdc-button__ripple';
253253
}
254254

255255
@mixin mat-mdc-fab-typography($config-or-theme) {
256-
$config: mat-get-typography-config($config-or-theme);
256+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
257257
@include mat-using-mdc-typography($config) {
258258
@include mdc-fab-without-ripple($query: $mat-typography-styles-query);
259259
}
@@ -326,7 +326,7 @@ $mat-button-state-target: '.mdc-button__ripple';
326326
}
327327

328328
@mixin mat-mdc-icon-button-typography($config-or-theme) {
329-
$config: mat-get-typography-config($config-or-theme);
329+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
330330
@include mat-using-mdc-typography($config) {
331331
@include mdc-icon-button-without-ripple($query: $mat-typography-styles-query);
332332
}

src/material-experimental/mdc-card/_card-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333

3434
@mixin mat-mdc-card-typography($config-or-theme) {
35-
$config: mat-get-typography-config($config-or-theme);
35+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
3636
@include mat-using-mdc-typography($config) {
3737
@include mdc-card-without-ripple($query: $mat-typography-styles-query);
3838

src/material-experimental/mdc-checkbox/_checkbox-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
}
8484

8585
@mixin mat-mdc-checkbox-typography($config-or-theme) {
86-
$config: mat-get-typography-config($config-or-theme);
86+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
8787
@include mat-using-mdc-typography($config) {
8888
@include mdc-checkbox-without-ripple($query: $mat-typography-styles-query);
8989
@include mdc-form-field-core-styles($query: $mat-typography-styles-query);

src/material-experimental/mdc-chips/_chips-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
}
5757

5858
@mixin mat-mdc-chips-typography($config-or-theme) {
59-
$config: mat-get-typography-config($config-or-theme);
59+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
6060
@include mdc-chip-set-core-styles($query: $mat-typography-styles-query);
6161
@include mat-using-mdc-typography($config) {
6262
@include mdc-chip-without-ripple($query: $mat-typography-styles-query);

src/material-experimental/mdc-core/option/_optgroup-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
}
2020
}
2121

22-
@mixin mat-mdc-optgroup-typography($config-or-theme) {
23-
$config: mat-get-typography-config($config-or-theme);
24-
}
22+
@mixin mat-mdc-optgroup-typography($config-or-theme) {}
2523

2624
@mixin mat-mdc-optgroup-density($config-or-theme) {
2725
$density-scale: mat-get-density-config($config-or-theme);

src/material-experimental/mdc-core/option/_option-theme.scss

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
}
4242
}
4343

44-
@mixin mat-mdc-option-typography($config-or-theme) {
45-
$config: mat-get-typography-config($config-or-theme);
46-
}
44+
@mixin mat-mdc-option-typography($config-or-theme) {}
4745

4846
@mixin mat-mdc-option-density($config-or-theme) {
4947
$density-scale: mat-get-density-config($config-or-theme);

src/material-experimental/mdc-dialog/_dialog-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
}
1010

1111
@mixin mat-mdc-dialog-typography($config-or-theme) {
12-
$config: mat-get-typography-config($config-or-theme);
12+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
1313
@include mat-using-mdc-typography($config) {
1414
@include mdc-dialog-core-styles($query: $mat-typography-styles-query);
1515
}

src/material-experimental/mdc-form-field/_form-field-subscript.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
}
4545

4646
@mixin mat-mdc-private-form-field-subscript-typography($config-or-theme) {
47-
$config: mat-get-typography-config($config-or-theme);
47+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
4848
// The unit-less line-height from the font config.
4949
$line-height: mat-line-height($config, input);
5050
// The amount to scale the font for the subscript.

src/material-experimental/mdc-form-field/_form-field-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060

6161
@mixin mat-mdc-form-field-typography($config-or-theme) {
62-
$config: mat-get-typography-config($config-or-theme);
62+
$config: mat-private-typography-normalized-config(mat-get-typography-config($config-or-theme));
6363
@include mat-using-mdc-typography($config) {
6464
@include mdc-text-field-without-ripple($query: $mat-typography-styles-query);
6565
@include mdc-floating-label-core-styles($query: $mat-typography-styles-query);

0 commit comments

Comments
 (0)