Skip to content

Commit 2982644

Browse files
committed
fix(material/core): expose mixin mentioned in the elevation guide
We were mentioning the `mat-elevation-transition` mixin, but the new API wasn't exposing it. Also updates the imports to the new API and hides a function that was exposed by accident.
1 parent 4a3ca82 commit 2982644

File tree

5 files changed

+17
-18
lines changed

5 files changed

+17
-18
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/core/style/_elevation.import.scss

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ $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;
1211
@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;
12+
$mat-transition-timing-function, mat-get-ambient-map, mat-get-penumbra-map, mat-get-umbra-map;
1513
@forward 'elevation' as mat-elevation-* hide mat-elevation-elevation, mat-elevation-get-ambient-map,
1614
mat-elevation-get-penumbra-map, mat-elevation-get-umbra-map, mat-elevation-overridable-elevation;
1715

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 _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: _transition-property-value($duration, $easing);
197197
}

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)