Skip to content

Commit 99b3dc8

Browse files
committed
refactor(material/theming): normalize config in all typography mixins
for mdc components This is split off of angular#21778 which covers non-MDC conmponents as well
1 parent 9cbfd91 commit 99b3dc8

File tree

25 files changed

+77
-113
lines changed

25 files changed

+77
-113
lines changed

src/dev-app/theme.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ $candy-app-theme: theming.light-theme((
2828
accent: $candy-app-accent
2929
),
3030
// Define the default typography for our app.
31+
// TODO(mmalerba): Update to `mat-mdc-typography-config()` once non-MDC components can handle
32+
// 2018 configs.
3133
typography: all-typography.config(),
3234
// Define the default density level for our app.
3335
density: 0,

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use '../mdc-helpers/mdc-helpers';
2+
@use '../../material/core/typography/typography';
23
@use '../../material/core/theming/theming';
34
@import '@material/menu-surface/mixins.import';
45
@import '@material/list/mixins.import';
@@ -12,7 +13,7 @@
1213
}
1314

1415
@mixin typography($config-or-theme) {
15-
$config: theming.get-typography-config($config-or-theme);
16+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
1617
@include mdc-helpers.mat-using-mdc-typography($config) {
1718
@include mdc-menu-surface-core-styles(mdc-helpers.$mat-typography-styles-query);
1819

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
@use '../../material/core/ripple/ripple';
2+
@use '../../material/core/typography/typography';
23
@use '../mdc-helpers/mdc-helpers';
34
@use '../../material/core/theming/theming';
45
@import '@material/button/mixins.import';
@@ -174,7 +175,7 @@ $mat-fab-state-target: '.mdc-fab__ripple';
174175
}
175176

176177
@mixin typography($config-or-theme) {
177-
$config: theming.get-typography-config($config-or-theme);
178+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
178179
@include mdc-helpers.mat-using-mdc-typography($config) {
179180
@include mdc-button-without-ripple($query: mdc-helpers.$mat-typography-styles-query);
180181
}
@@ -261,7 +262,7 @@ $mat-fab-state-target: '.mdc-fab__ripple';
261262
}
262263

263264
@mixin fab-typography($config-or-theme) {
264-
$config: theming.get-typography-config($config-or-theme);
265+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
265266
@include mdc-helpers.mat-using-mdc-typography($config) {
266267
@include mdc-fab-without-ripple($query: mdc-helpers.$mat-typography-styles-query);
267268
}
@@ -334,7 +335,7 @@ $mat-fab-state-target: '.mdc-fab__ripple';
334335
}
335336

336337
@mixin icon-button-typography($config-or-theme) {
337-
$config: theming.get-typography-config($config-or-theme);
338+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
338339
@include mdc-helpers.mat-using-mdc-typography($config) {
339340
@include mdc-icon-button-without-ripple($query: mdc-helpers.$mat-typography-styles-query);
340341
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use 'sass:color';
22
@use 'sass:map';
33
@use '../mdc-helpers/mdc-helpers';
4+
@use '../../material/core/typography/typography';
45
@use '../../material/core/theming/theming';
56
@import '@material/card/mixins.import';
67
@import '@material/theme/functions.import';
@@ -35,7 +36,7 @@
3536
}
3637

3738
@mixin typography($config-or-theme) {
38-
$config: theming.get-typography-config($config-or-theme);
39+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
3940
@include mdc-helpers.mat-using-mdc-typography($config) {
4041
@include mdc-card-without-ripple($query: mdc-helpers.$mat-typography-styles-query);
4142

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@use '@material/theme/theme';
44
@use 'sass:map';
55
@use '../mdc-helpers/mdc-helpers';
6+
@use '../../material/core/typography/typography';
67
@use '../../material/core/theming/theming';
78
@use '../../material/core/ripple/ripple';
89

@@ -110,7 +111,7 @@
110111
}
111112

112113
@mixin typography($config-or-theme) {
113-
$config: theming.get-typography-config($config-or-theme);
114+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
114115
@include mdc-helpers.mat-using-mdc-typography($config) {
115116
@include mdc-checkbox-without-ripple($query: mdc-helpers.$mat-typography-styles-query);
116117
@include mdc-form-field-core-styles($query: mdc-helpers.$mat-typography-styles-query);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
@use 'sass:color';
22
@use 'sass:map';
33
@use '../mdc-helpers/mdc-helpers';
4+
@use '../../material/core/typography/typography';
45
@use '../../material/core/theming/theming';
56
@import '@material/chips/mixins.import';
6-
77
@import '@material/theme/functions.import';
88

99
@mixin _selected-color($color) {
@@ -76,7 +76,7 @@
7676
}
7777

7878
@mixin typography($config-or-theme) {
79-
$config: theming.get-typography-config($config-or-theme);
79+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
8080
@include mdc-chip-set-core-styles($query: mdc-helpers.$mat-typography-styles-query);
8181
@include mdc-helpers.mat-using-mdc-typography($config) {
8282
@include mdc-chip-without-ripple($query: mdc-helpers.$mat-typography-styles-query);

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
@use '../../mdc-helpers/mdc-helpers';
22
@use '../../../material/core/theming/theming';
3+
@use '../../../material/core/typography/typography';
34
@import '@material/list/mixins.import';
45
@import '@material/list/variables.import';
56
@import '@material/theme/functions.import';
67
@import '@material/theme/mixins.import';
78

9+
810
@mixin color($config-or-theme) {
911
$config: theming.get-color-config($config-or-theme);
1012

@@ -20,7 +22,7 @@
2022
}
2123

2224
@mixin typography($config-or-theme) {
23-
$config: theming.get-typography-config($config-or-theme);
25+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
2426
}
2527

2628
@mixin density($config-or-theme) {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
@use '../../mdc-helpers/mdc-helpers';
22
@use '../../../material/core/theming/theming';
3+
@use '../../../material/core/typography/typography';
34
@import '@material/list/mixins.import';
45
@import '@material/list/variables.import';
56
@import '@material/theme/functions.import';
@@ -46,7 +47,7 @@
4647
}
4748

4849
@mixin option-typography($config-or-theme) {
49-
$config: theming.get-typography-config($config-or-theme);
50+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
5051

5152
@include mdc-helpers.mat-using-mdc-typography($config) {
5253
// MDC uses the `subtitle1` level for list items, but the spec shows `body1` as the correct

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@use '../mdc-helpers/mdc-helpers';
2+
@use '../../material/core/typography/typography';
23
@use '../../material/core/theming/theming';
3-
44
@import '@material/dialog/mixins.import';
55

66
@mixin color($config-or-theme) {
@@ -11,7 +11,7 @@
1111
}
1212

1313
@mixin typography($config-or-theme) {
14-
$config: theming.get-typography-config($config-or-theme);
14+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
1515
@include mdc-helpers.mat-using-mdc-typography($config) {
1616
@include mdc-dialog-core-styles($query: mdc-helpers.$mat-typography-styles-query);
1717
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@use '@material/ripple/mixins' as mdc-ripple;
22
@use '@material/textfield/variables' as mdc-text-field;
33
@use '../mdc-helpers/mdc-helpers';
4+
@use '../../material/core/typography/typography';
45
@use 'form-field-density';
56
@use 'form-field-subscript';
67
@use 'form-field-focus-overlay';
@@ -63,7 +64,7 @@
6364
}
6465

6566
@mixin typography($config-or-theme) {
66-
$config: theming.get-typography-config($config-or-theme);
67+
$config: typography.typography-to-2018-config(theming.get-typography-config($config-or-theme));
6768
@include mdc-helpers.mat-using-mdc-typography($config) {
6869
@include mdc-text-field-without-ripple($query: mdc-helpers.$mat-typography-styles-query);
6970
@include mdc-floating-label-core-styles($query: mdc-helpers.$mat-typography-styles-query);

0 commit comments

Comments
 (0)