@@ -221,7 +221,7 @@ $transition-timing-function: animation-variables.$standard-curve-timing-function
221221/// @return {List|null} the complete box shadow or null.
222222///
223223@function _shadow ($level , $color ) {
224- @if $level < 0 or $level > 24 {
224+ @if $level == null or $level < 0 or $level > 24 {
225225 @warn " $level must be between 0 and 24; received '#{$level } '" ;
226226 @return null;
227227 }
@@ -238,6 +238,19 @@ $transition-timing-function: animation-variables.$standard-curve-timing-function
238238 @return (box-shadow : elevation-box-shadow ($level ));
239239}
240240
241+ ///
242+ /// Sets the shadow of the element.
243+ ///
244+ /// @param {String} $box-shadow - The shadow to apply to the element.
245+ ///
246+ @mixin _box-shadow ($shadow , $query : feature-targeting .all ()) {
247+ $feat-color : feature-targeting .create-target ($query , color );
248+
249+ @include feature-targeting .targets ($feat-color ) {
250+ @include theme .property (box-shadow , $shadow );
251+ }
252+ }
253+
241254///
242255/// Sets the shadow of the element.
243256///
@@ -328,6 +341,16 @@ $transition-timing-function: animation-variables.$standard-curve-timing-function
328341 }
329342}
330343
344+ ///
345+ /// Applies the given color to the container of the overlay.
346+ /// @param {color} $color - the color of the overlay container
347+ ///
348+ @mixin _overlay-container-color ($color , $query : feature-targeting .all ()) {
349+ .mdc-elevation-overlay {
350+ @include overlay-fill-color ($color , $query : $query );
351+ }
352+ }
353+
331354///
332355/// Sets the elevation overlay opacity.
333356/// Expected to be called from a parent element.
@@ -380,21 +403,32 @@ $_theme-values: (
380403/// @param {Number} $level - the level in the elevation system.
381404/// @param {String} $shadow-color - the color used for the shadow.
382405///
383- @mixin with-resolver ($resolver , $query : feature-targeting . all (), $ args ...) {
406+ @mixin with-resolver ($resolver , $args ...) {
384407 @if $resolver {
385- @include theme (meta .call ($resolver , $args ... ), $query : $query );
408+ @include _theme (meta .call ($resolver , $args ... ));
386409 }
387410}
388411
389412///
390- /// Applies the given theme.
413+ /// Applies the given theme with validation .
391414/// @param {Map} $theme - @see $_theme-values for accepted theme properties.
392415///
393416@mixin theme ($theme : (), $query : feature-targeting .all ()) {
394417 @include theme .validate-keys ($_theme-values , $theme );
395- @include shadow (map .get ($theme , shadow ), $query : $query );
418+ @include _theme ($theme , $query : $query );
419+ }
420+
421+ ///
422+ /// Applies the given theme.
423+ /// @param {Map} $theme - @see $_theme-values for accepted theme properties.
424+ ///
425+ @mixin _theme ($theme : (), $query : feature-targeting .all ()) {
426+ @include _box-shadow (map .get ($theme , shadow ), $query : $query );
396427 @include overlay-opacity (map .get ($theme , overlay-opacity ), $query : $query );
397- @include overlay-fill-color (map .get ($theme , overlay-color ), $query : $query );
428+ @include _overlay-container-color (
429+ map .get ($theme , overlay-color ),
430+ $query : $query
431+ );
398432}
399433
400434///
@@ -405,8 +439,11 @@ $_theme-values: (
405439///
406440@function resolver ($args ... ) {
407441 $opts : meta .keywords ($args );
408- $level : map .get ($opts , level );
442+ $elevation : map .get ($opts , elevation );
409443 $shadow-color : map .get ($opts , shadow-color );
444+ @if custom-properties .is-custom-prop ($elevation ) {
445+ @return (shadow : $elevation );
446+ }
410447
411- @return (shadow : _shadow ($level , $shadow-color ));
448+ @return (shadow : _shadow ($elevation , $shadow-color ));
412449}
0 commit comments