Skip to content

Commit 9651b86

Browse files
committed
refactor(multiple): disable CSS variable fallbacks in MDC components
Since we don't support IE, we don't have to include a fallback for CSS variables in the MDC components.
1 parent 15774a9 commit 9651b86

File tree

9 files changed

+47
-23
lines changed

9 files changed

+47
-23
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ $mat-card-header-size: 40px !default;
1010
// Default padding for text content within a card.
1111
$mat-card-default-padding: 16px !default;
1212

13-
// Include all MDC card styles except for color and typography.
14-
@include mdc-card.without-ripple($query: mdc-helpers.$mat-base-styles-query);
13+
@include mdc-helpers.disable-fallback-declarations {
14+
// Include all MDC card styles except for color and typography.
15+
@include mdc-card.without-ripple($query: mdc-helpers.$mat-base-styles-query);
16+
}
1517

1618
// Title text and subtitles text within a card. MDC doesn't have pre-made title sections for cards.
1719
// Maintained here for backwards compatibility with the previous generation MatCard.

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ $mat-dialog-content-max-height: 65vh !default;
99
// don't expose this value as variable.
1010
$mat-dialog-button-horizontal-margin: 8px !default;
1111

12-
@include mdc-dialog.core-styles($query: mdc-helpers.$mat-base-styles-query);
12+
@include mdc-helpers.disable-fallback-declarations {
13+
@include mdc-dialog.core-styles($query: mdc-helpers.$mat-base-styles-query);
14+
}
15+
1316
@include mdc-dialog-structure-overrides.private-dialog-structure-overrides(
1417
$mat-dialog-content-max-height);
1518

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@
1212
@use '../mdc-helpers/mdc-helpers';
1313

1414
// Base styles for MDC text-field, notched-outline, floating label and line-ripple.
15-
@include mdc-textfield.without-ripple(
16-
$query: mdc-helpers.$mat-base-styles-without-animation-query);
17-
@include mdc-floating-label.core-styles(
18-
$query: mdc-helpers.$mat-base-styles-without-animation-query);
19-
@include mdc-notched-outline.core-styles(
20-
$query: mdc-helpers.$mat-base-styles-without-animation-query);
21-
@include mdc-line-ripple.core-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
15+
@include mdc-helpers.disable-fallback-declarations {
16+
@include mdc-textfield.without-ripple(
17+
$query: mdc-helpers.$mat-base-styles-without-animation-query);
18+
@include mdc-floating-label.core-styles(
19+
$query: mdc-helpers.$mat-base-styles-without-animation-query);
20+
@include mdc-notched-outline.core-styles(
21+
$query: mdc-helpers.$mat-base-styles-without-animation-query);
22+
@include mdc-line-ripple.core-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
23+
}
2224

2325
// MDC text-field overwrites.
2426
@include mdc-text-field-textarea-overrides.private-text-field-textarea-overrides();
@@ -119,8 +121,10 @@
119121
// In order to make it possible for developers to disable animations for form-fields,
120122
// we only activate the animation styles if animations are not explicitly disabled.
121123
.mat-mdc-form-field:not(.mat-form-field-no-animations) {
122-
@include mdc-textfield.without-ripple($query: animation);
123-
@include mdc-floating-label.core-styles($query: animation);
124-
@include mdc-notched-outline.core-styles($query: animation);
125-
@include mdc-line-ripple.core-styles($query: animation);
124+
@include mdc-helpers.disable-fallback-declarations {
125+
@include mdc-textfield.without-ripple($query: animation);
126+
@include mdc-floating-label.core-styles($query: animation);
127+
@include mdc-notched-outline.core-styles($query: animation);
128+
@include mdc-line-ripple.core-styles($query: animation);
129+
}
126130
}

src/material-experimental/mdc-menu/menu.scss

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
@use '../../cdk/a11y';
88
@use '../mdc-helpers/mdc-helpers';
99

10-
@include mdc-menu-surface.core-styles($query: structure);
10+
@include mdc-helpers.disable-fallback-declarations {
11+
@include mdc-menu-surface.core-styles($query: structure);
12+
}
1113

1214
// Prevent rendering mat-menu as it can affect the flex layout.
1315
mat-menu {
@@ -37,9 +39,11 @@ mat-menu {
3739
}
3840

3941
.mat-mdc-menu-item {
40-
@include mdc-list-mixins.item-base;
41-
@include mdc-list-mixins.item-spacing(
42-
mdc-list-variables.$side-padding, $query: mdc-helpers.$mat-base-styles-query);
42+
@include mdc-helpers.disable-fallback-declarations {
43+
@include mdc-list-mixins.item-base;
44+
@include mdc-list-mixins.item-spacing(
45+
mdc-list-variables.$side-padding, $query: mdc-helpers.$mat-base-styles-query);
46+
}
4347

4448
// MDC's menu items are `<li>` nodes which don't need resets, however ours
4549
// can be anything, including buttons, so we need to do the reset ourselves.

src/material-experimental/mdc-progress-bar/progress-bar.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
@use '@material/linear-progress' as mdc-linear-progress;
22
@use '../mdc-helpers/mdc-helpers';
33

4-
@include mdc-linear-progress.core-styles($query: mdc-helpers.$mat-base-styles-query);
4+
@include mdc-helpers.disable-fallback-declarations {
5+
@include mdc-linear-progress.core-styles($query: mdc-helpers.$mat-base-styles-query);
6+
}
57

68
.mat-mdc-progress-bar {
79
// Explicitly set to `block` since the browser defaults custom elements to `inline`.

src/material-experimental/mdc-progress-spinner/progress-spinner.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
@use '../mdc-helpers/mdc-helpers';
33
@use '../../cdk/a11y';
44

5-
@include mdc-circular-progress.core-styles($query: mdc-helpers.$mat-base-styles-query);
5+
@include mdc-helpers.disable-fallback-declarations {
6+
@include mdc-circular-progress.core-styles($query: mdc-helpers.$mat-base-styles-query);
7+
}
68

79
.mat-mdc-progress-spinner {
810
// Explicitly set to `block` since the browser defaults custom elements to `inline`.

src/material-experimental/mdc-slider/slider.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
@use '@material/slider/slider' as mdc-slider;
22
@use '../mdc-helpers/mdc-helpers';
33

4-
@include mdc-slider.without-ripple($query: mdc-helpers.$mat-base-styles-query);
4+
@include mdc-helpers.disable-fallback-declarations {
5+
@include mdc-slider.without-ripple($query: mdc-helpers.$mat-base-styles-query);
6+
}
57

68
$mat-slider-min-size: 128px !default;
79
$mat-slider-horizontal-margin: 8px !default;

src/material-experimental/mdc-snack-bar/snack-bar-container.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
@use '../mdc-helpers/mdc-helpers';
33
@use '../../cdk/a11y';
44

5-
@include mdc-snackbar.core-styles($query: mdc-helpers.$mat-base-styles-query);
5+
@include mdc-helpers.disable-fallback-declarations {
6+
@include mdc-snackbar.core-styles($query: mdc-helpers.$mat-base-styles-query);
7+
}
68

79
// MDC sets the position as fixed and sets the container on the bottom center of the page (or
810
// otherwise can be set to be "leading"). Our overlay handles a more advanced configuration

src/material-experimental/mdc-table/table.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
@use '../mdc-helpers/mdc-helpers';
44
@use '../../material/table/table-flex-styles';
55

6-
@include mdc-data-table.core-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
6+
@include mdc-helpers.disable-fallback-declarations {
7+
@include mdc-data-table.core-styles($query: mdc-helpers.$mat-base-styles-without-animation-query);
8+
}
9+
710
@include table-flex-styles.private-table-flex-styles();
811

912
.mat-mdc-table-sticky {

0 commit comments

Comments
 (0)