+
diff --git a/src/material-experimental/mdc-helpers/_mdc-helpers.scss b/src/material-experimental/mdc-helpers/_mdc-helpers.scss
index 82ac85c258c3..48f43ad81962 100644
--- a/src/material-experimental/mdc-helpers/_mdc-helpers.scss
+++ b/src/material-experimental/mdc-helpers/_mdc-helpers.scss
@@ -18,7 +18,8 @@ $mat-theme-styles-query: color;
$mat-typography-styles-query: typography;
// Mappings between Angular Material and MDC's typography levels.
-$mat-typography-level-mappings: (
+// TODO: delete once all MDC components have migrated to using the 2018 mappings.
+$mat-typography-2014-level-mappings: (
mdc-to-mat: (
headline1: display-4,
headline2: display-3,
@@ -51,9 +52,45 @@ $mat-typography-level-mappings: (
)
);
+// Mappings between Angular Material and MDC's typography levels.
+$mat-typography-2018-level-mappings: (
+ mdc-to-mat: (
+ headline1: headline-1,
+ headline2: headline-2,
+ headline3: headline-3,
+ headline4: headline-4,
+ headline5: headline-5,
+ headline6: headline-6,
+ subtitle1: subtitle-1,
+ subtitle2: subtitle-2,
+ body1: body-1,
+ body2: body-2,
+ caption: caption,
+ button: button,
+ overline: overline
+ ),
+ mat-to-mdc: (
+ headline-1: headline1,
+ headline-2: headline2,
+ headline-3: headline3,
+ headline-4: headline4,
+ headline-5: headline5,
+ headline-6: headline6,
+ subtitle-1: subtitle1,
+ subtitle-2: subtitle2,
+ body-1: body1,
+ body-2: body2,
+ caption: caption,
+ button: button,
+ overline: overline
+ )
+);
+
// Converts an Angular Material typography level config to an MDC one.
@function mat-typography-level-config-to-mdc($mat-config, $mat-level) {
- $mdc-level: map-get(map-get($mat-typography-level-mappings, mat-to-mdc), $mat-level);
+ $mappings: if(mat-private-typography-is-2018-config($mat-config),
+ $mat-typography-2018-level-mappings, $mat-typography-2014-level-mappings);
+ $mdc-level: map-get(map-get($mappings, mat-to-mdc), $mat-level);
@return map-merge(
if($mdc-level,
@@ -81,7 +118,10 @@ $mat-typography-level-mappings: (
@function mat-typography-config-to-mdc($mat-config: mat-typography-config()) {
$mdc-config: ();
- @each $mdc-level, $mat-level in map-get($mat-typography-level-mappings, mdc-to-mat) {
+ $mappings: if(mat-private-typography-is-2018-config($mat-config),
+ $mat-typography-2018-level-mappings, $mat-typography-2014-level-mappings);
+
+ @each $mdc-level, $mat-level in map-get($mappings, mdc-to-mat) {
$mdc-config: map-merge(
$mdc-config,
($mdc-level: mat-typography-level-config-to-mdc($mat-config, $mat-level)));
@@ -92,23 +132,14 @@ $mat-typography-level-mappings: (
// Converts an MDC typography level config to an Angular Material one.
@function mat-typography-config-level-from-mdc($mdc-level) {
- @return mat-typography-level(
- map-get($mdc-typography-styles, font-size),
- map-get($mdc-typography-styles, line-height),
- map-get($mdc-typography-styles, font-weight),
- map-get($mdc-typography-styles, font-family),
- map-get($mdc-typography-styles, letter-spacing));
-}
-
-// Converts an MDC typography config to an Angular Material one.
-@function mat-typography-config-from-mdc() {
- $mat-config: ();
+ $mdc-level-config: map-get($mdc-typography-styles, $mdc-level);
- @each $mat-level, $mdc-level in map-get($mat-typography-level-mappings, mat-to-mdc) {
- $mat-config: map-merge($mat-config, mat-typography-config-from-mdc($mdc-level));
- }
-
- @return $mat-config;
+ @return mat-typography-level(
+ map-get($mdc-level-config, font-size),
+ map-get($mdc-level-config, line-height),
+ map-get($mdc-level-config, font-weight),
+ map-get($mdc-level-config, font-family),
+ map-get($mdc-level-config, letter-spacing));
}
// Configures MDC's global variables to reflect the given theme, applies the given styles,
diff --git a/src/material-experimental/mdc-menu/_menu-theme.scss b/src/material-experimental/mdc-menu/_menu-theme.scss
index 66b306fa53e6..8e8c40d83b01 100644
--- a/src/material-experimental/mdc-menu/_menu-theme.scss
+++ b/src/material-experimental/mdc-menu/_menu-theme.scss
@@ -4,6 +4,7 @@
@import '@material/list/variables.import';
@import '@material/theme/functions.import';
@import '@material/theme/mixins.import';
+@import '@material/typography/mixins.import';
@import '../mdc-helpers/mdc-helpers';
@mixin mat-mdc-menu-color($config-or-theme) {
@@ -47,10 +48,16 @@
@include mat-using-mdc-typography($config) {
@include mdc-menu-surface-core-styles($mat-typography-styles-query);
- .mat-mdc-menu-content, .mat-mdc-menu-item {
+ .mat-mdc-menu-content {
// Note that we include this private mixin, because the public
// one adds a bunch of styles that we aren't using for the menu.
@include mdc-list-base_($mat-typography-styles-query);
+
+ // MDC uses the `subtitle1` level for list items, but the spec shows `body1` as the correct
+ // level.
+ .mat-mdc-menu-item {
+ @include mdc-typography(body1, $query: $mat-typography-styles-query);
+ }
}
}
}
diff --git a/src/material-experimental/mdc-select/_select-theme.scss b/src/material-experimental/mdc-select/_select-theme.scss
index 4555d7126911..9e0530afd1af 100644
--- a/src/material-experimental/mdc-select/_select-theme.scss
+++ b/src/material-experimental/mdc-select/_select-theme.scss
@@ -2,6 +2,7 @@
@import '@material/list/mixins.import';
@import '@material/theme/variables.import';
@import '@material/select/variables.import';
+@import '@material/typography/mixins.import';
@import '../mdc-helpers/mdc-helpers';
// Gets the color to use for some text that is highlighted while a select has focus.
@@ -89,6 +90,10 @@
// a bunch of styles that we aren't using for the select panel.
@include mdc-list-base_($mat-typography-styles-query);
}
+
+ .mat-mdc-select-value {
+ @include mdc-typography(body1, $query: $mat-typography-styles-query);
+ }
}
}
diff --git a/src/material-experimental/mdc-typography/_all-typography.scss b/src/material-experimental/mdc-typography/_all-typography.scss
index b29ac61cf38a..83f673bbf469 100644
--- a/src/material-experimental/mdc-typography/_all-typography.scss
+++ b/src/material-experimental/mdc-typography/_all-typography.scss
@@ -1,5 +1,52 @@
+@import '@material/typography/variables.import';
@import '../mdc-theming/all-theme';
+@function mat-mdc-typography-config(
+ $font-family: $mdc-typography-font-family,
+ $headline-1: mat-typography-config-level-from-mdc(headline1),
+ $headline-2: mat-typography-config-level-from-mdc(headline2),
+ $headline-3: mat-typography-config-level-from-mdc(headline3),
+ $headline-4: mat-typography-config-level-from-mdc(headline4),
+ $headline-5: mat-typography-config-level-from-mdc(headline5),
+ $headline-6: mat-typography-config-level-from-mdc(headline6),
+ $subtitle-1: mat-typography-config-level-from-mdc(subtitle1),
+ $subtitle-2: mat-typography-config-level-from-mdc(subtitle2),
+ $body-1: mat-typography-config-level-from-mdc(body1),
+ $body-2: mat-typography-config-level-from-mdc(body2),
+ $caption: mat-typography-config-level-from-mdc(caption),
+ $button: mat-typography-config-level-from-mdc(button),
+ $overline: mat-typography-config-level-from-mdc(overline),
+) {
+ // Declare an initial map with all of the levels.
+ $config: (
+ headline-1: $headline-1,
+ headline-2: $headline-2,
+ headline-3: $headline-3,
+ headline-4: $headline-4,
+ headline-5: $headline-5,
+ headline-6: $headline-6,
+ subtitle-1: $subtitle-1,
+ subtitle-2: $subtitle-2,
+ body-1: $body-1,
+ body-2: $body-2,
+ caption: $caption,
+ button: $button,
+ overline: $overline,
+ );
+
+ // Loop through the levels and set the `font-family` of the ones that don't have one to the base.
+ // Note that Sass can't modify maps in place, which means that we need to merge and re-assign.
+ @each $key, $level in $config {
+ @if map-get($level, font-family) == null {
+ $new-level: map-merge($level, (font-family: $font-family));
+ $config: map-merge($config, ($key: $new-level));
+ }
+ }
+
+ // Add the base font family to the config.
+ @return map-merge($config, (font-family: $font-family));
+}
+
@mixin angular-material-mdc-typography($config-or-theme: null) {
$config: if(mat-private-is-theme-object($config-or-theme),
mat-get-typography-config($config-or-theme), $config-or-theme);
diff --git a/src/material/form-field/form-field-animations.ts b/src/material/form-field/form-field-animations.ts
index 51fb83fdebca..5e2fc96d9f94 100644
--- a/src/material/form-field/form-field-animations.ts
+++ b/src/material/form-field/form-field-animations.ts
@@ -26,7 +26,7 @@ export const matFormFieldAnimations: {
// TODO(mmalerba): Use angular animations for label animation as well.
state('enter', style({ opacity: 1, transform: 'translateY(0%)' })),
transition('void => enter', [
- style({ opacity: 0, transform: 'translateY(-100%)' }),
+ style({ opacity: 0, transform: 'translateY(-5px)' }),
animate('300ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
]),
])