@@ -34,11 +34,10 @@ $color: black !default;
34
34
// Prefix for elevation-related selectors.
35
35
$prefix : ' mat-elevation-z' ;
36
36
37
- // Applies the correct css rules to an element to give it the elevation specified by $zValue.
38
- // The $zValue must be between 0 and 24.
39
- @mixin elevation ($zValue , $color : $color , $opacity : null) {
37
+ // Gets the box shadow value for a specific elevation.
38
+ @function private-get-elevation-shadow ($zValue , $color : $color , $opacity : null ) {
40
39
@if meta .type-of ($color ) == color and $opacity == null {
41
- @include mdc-elevation .elevation ($zValue , $color );
40
+ @return mdc-elevation .elevation-box-shadow ($zValue , $color );
42
41
}
43
42
@else {
44
43
// Copied from @material/elevation/_elevation-theme.scss#_box-shadow
@@ -53,10 +52,18 @@ $prefix: 'mat-elevation-z';
53
52
#{' #{$penumbra-z-value } #{$shadow-color } ' } ,
54
53
#{$ambient-z-value } $shadow-color
55
54
);
56
- @include mdc-elevation . shadow ( $box-shadow ) ;
55
+ @return $box-shadow ;
57
56
}
58
57
}
59
58
59
+ // Applies the correct css rules to an element to give it the elevation specified by $zValue.
60
+ // The $zValue must be between 0 and 24.
61
+ @mixin elevation ($zValue , $color : $color , $opacity : null) {
62
+ $shadow : private-get-elevation-shadow ($zValue , $color , $opacity );
63
+ box-shadow : $shadow ;
64
+ --mat-mdc-elevation-override : #{$shadow } ;
65
+ }
66
+
60
67
// Applies the elevation to an element in a manner that allows
61
68
// consumers to override it via the Material elevation classes.
62
69
@mixin overridable-elevation ($zValue , $color : $color ) {
0 commit comments