Skip to content

Commit 02f7561

Browse files
crisbetojelbourn
authored andcommitted
refactor(material/core): remove usages of deprecated Sass functions (#20811)
We had a bunch of places using the deprecated variants of functions like `map_get`, `map_has_key` and `map_merge`. These changes migrate to the non-deprecated variants. These changes are also necessary in order for the `sass-migrator` script to migrate the function calls. (cherry picked from commit 63a8ff5)
1 parent 2594c0b commit 02f7561

File tree

16 files changed

+104
-104
lines changed

16 files changed

+104
-104
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77
// provided by MDC in order to support arbitrary form-field controls.
88
@mixin _mat-mdc-form-field-infix-vertical-spacing-filled($with-label-padding, $no-label-padding) {
99
.mat-mdc-text-field-wrapper:not(.mdc-text-field--outlined) .mat-mdc-form-field-infix {
10-
padding-top: map_get($with-label-padding, top);
11-
padding-bottom: map_get($with-label-padding, bottom);
10+
padding-top: map-get($with-label-padding, top);
11+
padding-bottom: map-get($with-label-padding, bottom);
1212
}
1313

1414
.mdc-text-field--no-label:not(.mdc-text-field--outlined):not(.mdc-text-field--textarea)
1515
.mat-mdc-form-field-infix {
16-
padding-top: map_get($no-label-padding, top);
17-
padding-bottom: map_get($no-label-padding, bottom);
16+
padding-top: map-get($no-label-padding, top);
17+
padding-bottom: map-get($no-label-padding, bottom);
1818
}
1919
}
2020

@@ -23,8 +23,8 @@
2323
// provided by MDC in order to support arbitrary form-field controls.
2424
@mixin _mat-mdc-form-field-infix-vertical-spacing-outlined($padding) {
2525
.mat-mdc-text-field-wrapper.mdc-text-field--outlined .mat-mdc-form-field-infix {
26-
padding-top: map_get($padding, top);
27-
padding-bottom: map_get($padding, bottom);
26+
padding-top: map-get($padding, top);
27+
padding-bottom: map-get($padding, bottom);
2828
}
2929
}
3030

src/material-experimental/mdc-helpers/_focus-indicators.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696

9797
@mixin mat-mdc-strong-focus-indicators-color($config-or-theme) {
9898
$config: mat-get-color-config($config-or-theme);
99-
@include _mat-mdc-strong-focus-indicators-border-color(mat-color(map_get($config, primary)));
99+
@include _mat-mdc-strong-focus-indicators-border-color(mat-color(map-get($config, primary)));
100100
}
101101

102102
/// Mixin that sets the color of the focus indicators.

src/material-experimental/mdc-list/_interactive-list-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
}
1515

1616
&.mdc-list-item--selected::before {
17-
background: mat-color(map_get($config, primary));
17+
background: mat-color(map-get($config, primary));
1818
opacity: map-get($state-opacities, selected);
1919
}
2020

src/material/button/_button-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ $_mat-button-ripple-opacity: 0.1;
113113
}
114114

115115
.mat-button-focus-overlay {
116-
background: map_get($foreground, base);
116+
background: map-get($foreground, base);
117117
}
118118

119119
// Note: this needs a bit extra specificity, because we're not guaranteed the inclusion

src/material/checkbox/_checkbox-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
// Switch this to a solid color since we're using `opacity`
7878
// to control how opaque the ripple should be.
7979
.mat-checkbox .mat-ripple-element {
80-
background-color: map_get(map-get($config, foreground), base);
80+
background-color: map-get(map-get($config, foreground), base);
8181
}
8282

8383
.mat-checkbox-checked:not(.mat-checkbox-disabled),

src/material/chips/_chips-theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ $mat-chip-remove-font-size: 18px;
6868
}
6969

7070
&::after {
71-
background: map_get($foreground, base);
71+
background: map-get($foreground, base);
7272
}
7373
}
7474

src/material/core/density/_index.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ $_mat-density-generate-styles: true;
4747
}
4848

4949
$value: null;
50-
$property-scale-map: map_get($density-config, $property-name);
50+
$property-scale-map: map-get($density-config, $property-name);
5151

52-
@if map_has_key($property-scale-map, $density-scale) {
53-
$value: map_get($property-scale-map, $density-scale);
52+
@if map-has-key($property-scale-map, $density-scale) {
53+
$value: map-get($property-scale-map, $density-scale);
5454
}
5555
@else {
56-
$value: map_get($property-scale-map, default) + $density-scale * $_mat-density-interval;
56+
$value: map-get($property-scale-map, default) + $density-scale * $_mat-density-interval;
5757
}
5858

59-
$min-value: map_get($property-scale-map, $_mat-density-minimum-scale);
60-
$max-value: map_get($property-scale-map, $_mat-density-maximum-scale);
59+
$min-value: map-get($property-scale-map, $_mat-density-minimum-scale);
60+
$max-value: map-get($property-scale-map, $_mat-density-maximum-scale);
6161

6262
@if ($value < $min-value or $value > $max-value) {
6363
@error 'mat-density: #{$property-name} must be between #{$min-value} and ' +

src/material/core/focus-indicators/_focus-indicators.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787

8888
@mixin mat-strong-focus-indicators-color($config-or-theme) {
8989
$config: mat-get-color-config($config-or-theme);
90-
@include _mat-strong-focus-indicators-border-color(mat-color(map_get($config, primary)));
90+
@include _mat-strong-focus-indicators-border-color(mat-color(map-get($config, primary)));
9191
}
9292

9393
/// Mixin that sets the color of the focus indicators.

src/material/core/ripple/_ripple.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ $mat-ripple-color-opacity: 0.1;
4747
/* Colors for the ripple elements.*/
4848
@mixin mat-ripple-color($config-or-theme) {
4949
$config: mat-get-color-config($config-or-theme);
50-
$foreground: map_get($config, foreground);
51-
$foreground-base: map_get($foreground, base);
50+
$foreground: map-get($config, foreground);
51+
$foreground-base: map-get($foreground, base);
5252

5353
.mat-ripple-element {
5454
// If the ripple color is resolves to a color *type*, we can use it directly, otherwise

src/material/core/theming/_check-duplicate-styles.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ $_mat-theme-emitted-density: () !default;
3131
$density-config: mat-get-density-config($theme);
3232
$typography-config: mat-get-typography-config($theme);
3333
// Lists of previous `color`, `density` and `typography` configurations.
34-
$previous-color: map_get($_mat-theme-emitted-color, $id) or ();
35-
$previous-typography: map_get($_mat-theme-emitted-typography, $id) or ();
36-
$previous-density: map_get($_mat-theme-emitted-density, $id) or ();
34+
$previous-color: map-get($_mat-theme-emitted-color, $id) or ();
35+
$previous-typography: map-get($_mat-theme-emitted-typography, $id) or ();
36+
$previous-density: map-get($_mat-theme-emitted-density, $id) or ();
3737
// Whether duplicate legacy density styles would be generated.
3838
$duplicate-legacy-density: false;
3939

@@ -74,11 +74,11 @@ $_mat-theme-emitted-density: () !default;
7474
$previous-density: append($previous-density, $density-config);
7575
}
7676

77-
$_mat-theme-emitted-color: map_merge(
77+
$_mat-theme-emitted-color: map-merge(
7878
$_mat-theme-emitted-color, ($id: $previous-color)) !global;
79-
$_mat-theme-emitted-density: map_merge(
79+
$_mat-theme-emitted-density: map-merge(
8080
$_mat-theme-emitted-density, ($id: $previous-density)) !global;
81-
$_mat-theme-emitted-typography: map_merge(
81+
$_mat-theme-emitted-typography: map-merge(
8282
$_mat-theme-emitted-typography, ($id: $previous-typography)) !global;
8383

8484
// Optionally, consumers of this mixin can wrap contents inside so that nested

0 commit comments

Comments
 (0)