Skip to content

Commit dd1d28f

Browse files
authored
fix(material/core): expose mixin mentioned in the elevation guide (#22426)
We were mentioning the `mat-elevation-transition` mixin, but the new API wasn't exposing it. Also updates the imports to the new API.
1 parent 7039d3e commit dd1d28f

File tree

10 files changed

+23
-23
lines changed

10 files changed

+23
-23
lines changed

guides/elevation.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,42 @@ achieved by switching elevation classes:
2323

2424
## Mixins
2525

26-
Elevations can also be added in CSS via the `mat-elevation` mixin, which takes a number 0-24
26+
Elevations can also be added in CSS via the `elevation` mixin, which takes a number 0-24
2727
indicating the elevation of the element as well as optional arguments for the elevation shadow's
2828
color tone and opacity.
2929

3030
Since an elevation shadow consists of multiple shadow components of varying opacities, the
3131
`$opacity` argument of the mixin is considered a factor by which to scale these initial values
3232
rather than an absolute value.
3333

34-
In order to use the mixin, you must import `~@angular/material/theming`:
34+
In order to use the mixin, you must import `~@angular/material`:
3535

3636
```scss
37-
@import '~@angular/material/theming';
37+
@use '~@angular/material' as mat;
3838

3939
.my-class-with-default-shadow {
4040
// Adds a shadow for elevation level 2 with default color and full opacity:
41-
@include mat-elevation(2);
41+
@include mat.elevation(2);
4242
}
4343

4444
.my-class-with-custom-shadow {
4545
// Adds a shadow for elevation level 2 with color #e91e63 and 80% of the default opacity:
46-
@include mat-elevation(2, #e91e63, 0.8);
46+
@include mat.elevation(2, #e91e63, 0.8);
4747
}
4848
```
4949

50-
For convenience, you can use the `mat-elevation-transition` mixin to add a transition when the
50+
For convenience, you can use the `elevation-transition` mixin to add a transition when the
5151
elevation changes:
5252

5353
```scss
54-
@import '~@angular/material/theming';
54+
@use '~@angular/material' as mat;
5555

5656
.my-class {
57-
@include mat-elevation-transition;
58-
@include mat-elevation(2);
57+
@include mat.elevation-transition;
58+
@include mat.elevation(2);
5959

6060
&:active {
61-
@include mat-elevation(8);
61+
@include mat.elevation(8);
6262
}
6363
}
6464
```

src/material/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
@forward './core/core' show core;
1717
@forward './core/ripple/ripple' show ripple;
1818
@forward './core/focus-indicators/focus-indicators' show strong-focus-indicators;
19-
@forward './core/style/elevation' show elevation, overridable-elevation;
19+
@forward './core/style/elevation' show elevation, overridable-elevation, elevation-transition;
2020

2121
// Theme bundles
2222
@forward './core/theming/all-theme' show all-component-themes;

src/material/button/_button-base.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ $mini-fab-padding: 8px !default;
8383

8484
// Animation.
8585
transition: background variables.$swift-ease-out-duration
86-
variables.$swift-ease-out-timing-function, elevation.transition-property-value();
86+
variables.$swift-ease-out-timing-function, elevation.private-transition-property-value();
8787
}
8888

8989
// Applies styles to fab and mini-fab button types only

src/material/card/card.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ $border-radius: 4px !default;
99
$header-size: 40px !default;
1010

1111
.mat-card {
12-
@include elevation.transition;
12+
@include elevation.elevation-transition;
1313
@include private.private-animation-noop();
1414
display: block;
1515
position: relative;

src/material/checkbox/checkbox.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ $_mat-checkbox-mark-stroke-size: 2 / 15 * checkbox-common.$size !default;
183183

184184
// Animation
185185
transition: background variables.$swift-ease-out-duration
186-
variables.$swift-ease-out-timing-function, elevation.transition-property-value();
186+
variables.$swift-ease-out-timing-function, elevation.private-transition-property-value();
187187

188188
cursor: pointer;
189189
-webkit-tap-highlight-color: transparent;

src/material/chips/chips.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ $chip-remove-size: 18px;
4040
}
4141

4242
.mat-standard-chip {
43-
@include elevation.transition;
43+
@include elevation.elevation-transition;
4444
@include private.private-animation-noop;
4545
display: inline-flex;
4646
padding: $chip-vertical-padding $chip-horizontal-padding;

src/material/core/style/_elevation.import.scss

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ $mat-swift-ease-out-duration, $mat-swift-ease-out-timing-function, $mat-swift-li
77
$mat-swift-linear-duration, $mat-swift-linear-timing-function, $mat-z-index-drawer,
88
$mat-z-index-fab;
99
@forward 'elevation' hide $color, $opacity, $prefix, $transition-duration,
10-
$transition-timing-function, elevation, overridable-elevation, transition,
11-
transition-property-value;
10+
$transition-timing-function, elevation, overridable-elevation, elevation-transition,
11+
private-transition-property-value;
1212
@forward 'elevation' as mat-* hide $mat-color, $mat-opacity, $mat-prefix, $mat-transition-duration,
13-
$mat-transition-timing-function, mat-get-ambient-map, mat-get-penumbra-map, mat-get-umbra-map,
14-
mat-transition, mat-transition-property-value;
13+
$mat-transition-timing-function, mat-get-ambient-map, mat-get-penumbra-map, mat-get-umbra-map;
1514
@forward 'elevation' as mat-elevation-* hide mat-elevation-elevation, mat-elevation-get-ambient-map,
1615
mat-elevation-get-penumbra-map, mat-elevation-get-umbra-map, mat-elevation-overridable-elevation;
1716

src/material/core/style/_elevation.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ $prefix: 'mat-elevation-z';
178178
// .foo {
179179
// transition: mat-elevation-transition-property-value(), opacity 100ms ease;
180180
// }
181-
@function transition-property-value(
181+
@function private-transition-property-value(
182182
$duration: $transition-duration,
183183
$easing: $transition-timing-function) {
184184
@return box-shadow #{$duration} #{$easing};
@@ -190,8 +190,8 @@ $prefix: 'mat-elevation-z';
190190
//
191191
// NOTE(traviskaufman): Both this mixin and the above function use default parameters so they can
192192
// be used in the same way by clients.
193-
@mixin transition(
193+
@mixin elevation-transition(
194194
$duration: $transition-duration,
195195
$easing: $transition-timing-function) {
196-
transition: transition-property-value($duration, $easing);
196+
transition: private-transition-property-value($duration, $easing);
197197
}

src/material/expansion/expansion-panel.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
border-radius: $border-radius;
1212
overflow: hidden;
1313
transition: margin 225ms variables.$fast-out-slow-in-timing-function,
14-
elevation.transition-property-value();
14+
elevation.private-transition-property-value();
1515

1616
// Required so that the `box-shadow` works after the focus indicator relatively positions the
1717
// header.

src/material/schematics/ng-generate/theming-api/migration.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const materialMixins: Record<string, string> = {
1818
'mat-typography-level-to-styles': 'typography-level',
1919
'mat-elevation': 'elevation',
2020
'mat-overridable-elevation': 'overridable-elevation',
21+
'mat-elevation-transition': 'elevation-transition',
2122
'mat-ripple': 'ripple',
2223
'mat-ripple-color': 'ripple-color',
2324
'mat-ripple-theme': 'ripple-theme',

0 commit comments

Comments
 (0)