Skip to content

Commit 2f1a8df

Browse files
asynclizcopybara-github
authored andcommitted
fix(button): use new elevation component
PiperOrigin-RevId: 499297613
1 parent 563518b commit 2f1a8df

File tree

4 files changed

+37
-52
lines changed

4 files changed

+37
-52
lines changed

chips/chip/lib/_chip-theme.scss

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@use 'sass:math';
1313
@use 'sass:color';
1414

15-
@use '../../../elevationold/lib/elevation-theme';
15+
@use '../../../elevation/lib/elevation';
1616
@use '../../../ripple/ripple';
1717
@use '../../../sass/dom';
1818
@use '../../../sass/resolvers';
@@ -191,10 +191,10 @@ $_custom-property-prefix: 'chip';
191191
@include _avatar-shape(map.get($theme, with-avatar-avatar-shape));
192192
@include graphic-size(map.get($theme, with-avatar-avatar-size));
193193
@include height(map.get($theme, container-height));
194-
@include elevation-theme.theme-styles(
194+
@include elevation.theme(
195195
(
196-
surface-tint-layer-color:
197-
map.get($theme, container-surface-tint-layer-color),
196+
shadow-color: map.get($theme, elevated-container-shadow-color),
197+
surface-tint-color: map.get($theme, container-surface-tint-layer-color),
198198
)
199199
);
200200
@include _container-elevation(
@@ -426,26 +426,22 @@ $_custom-property-prefix: 'chip';
426426
}
427427

428428
@function _resolve-theme($theme, $resolvers) {
429-
$theme: elevation-theme.resolve-theme(
429+
$theme: elevation.resolve-tokens(
430430
$theme,
431-
map.get($resolvers, elevation),
432-
$shadow-color-token: elevated-container-shadow-color,
433-
$elevation-tokens: (
434-
container-elevation,
435-
elevated-container-elevation,
436-
elevated-disabled-container-elevation,
437-
elevated-focus-container-elevation,
438-
elevated-hover-container-elevation,
439-
elevated-pressed-container-elevation,
440-
elevated-selected-container-elevation,
441-
flat-container-elevation,
442-
flat-selected-focus-container-elevation,
443-
flat-selected-hover-container-elevation,
444-
flat-selected-pressed-container-elevation,
445-
flat-unselected-focus-container-elevation,
446-
flat-unselected-hover-container-elevation,
447-
flat-unselected-pressed-container-elevation
448-
)
431+
'container-elevation',
432+
'elevated-container-elevation',
433+
'elevated-disabled-container-elevation',
434+
'elevated-focus-container-elevation',
435+
'elevated-hover-container-elevation',
436+
'elevated-pressed-container-elevation',
437+
'elevated-selected-container-elevation',
438+
'flat-container-elevation',
439+
'flat-selected-focus-container-elevation',
440+
'flat-selected-hover-container-elevation',
441+
'flat-selected-pressed-container-elevation',
442+
'flat-unselected-focus-container-elevation',
443+
'flat-unselected-hover-container-elevation',
444+
'flat-unselected-pressed-container-elevation'
449445
);
450446
@return $theme;
451447
}

chips/chip/lib/_chip.scss

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@
7777
.md3-chip {
7878
position: relative;
7979
max-width: 100%;
80-
// TODO(b/240224981): Translate to md3 elevation
81-
// @include elevation-theme.overlay-dimensions(100%, $query: $query);
8280
}
8381

8482
.md3-chip__cell,

chips/chip/lib/_input-chip-theme.scss

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
*/
66

77
@use 'sass:map';
8+
@use '../../../elevation/lib/elevation';
89
@use '../../../sass/resolvers';
910
@use '../../../sass/theme';
1011
@use './chip-theme';
@@ -60,38 +61,27 @@ $_custom-property-prefix: 'input-chip';
6061

6162
@mixin theme($theme, $resolvers: resolvers.$material) {
6263
@include theme.validate-theme($_light-theme, $theme);
63-
64-
// Resolve elevation.
65-
@each $key
66-
in (
67-
flat-container-elevation,
68-
elevated-container-elevation,
69-
elevated-disabled-container-elevation,
70-
elevated-hover-container-elevation,
71-
elevated-focus-container-elevation,
72-
elevated-pressed-container-elevation
73-
)
74-
{
75-
$value: map.get($theme, $key);
76-
@if $value {
77-
$theme: map.set(
78-
$theme,
79-
$key,
80-
meta.call(
81-
$elevation-resolver: map.get($resolvers, elevation),
82-
$elevation: $value,
83-
$shadow-color: map.get($theme, elevated-container-shadow-color),
84-
)
85-
);
86-
}
87-
}
88-
64+
$theme: _resolve-tokens($theme);
8965
$theme: theme.create-theme-vars($theme, $_custom-property-prefix);
9066
@include theme.emit-theme-vars($theme);
9167
}
9268

9369
@mixin theme-styles($theme, $resolvers: resolvers.$material) {
9470
@include theme.validate-theme($_light-theme, $theme);
71+
$theme: _resolve-tokens($theme);
9572
$theme: theme.create-theme-vars($theme, $_custom-property-prefix);
9673
@include chip-theme.theme-styles($theme, $resolvers: $resolvers);
9774
}
75+
76+
@function _resolve-tokens($tokens) {
77+
$tokens: elevation.resolve-tokens(
78+
$tokens,
79+
'flat-container-elevation',
80+
'elevated-container-elevation',
81+
'elevated-disabled-container-elevation',
82+
'elevated-hover-container-elevation',
83+
'elevated-focus-container-elevation',
84+
'elevated-pressed-container-elevation'
85+
);
86+
@return $tokens;
87+
}

chips/chip/lib/chip.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
import '../../../elevation/elevation.js';
78
import '../../action/delete-action.js';
89

910
import {html, TemplateResult} from 'lit';
@@ -73,7 +74,7 @@ export abstract class Chip extends ActionElement {
7374
/** @soyTemplate */
7475
protected renderOverlay(): TemplateResult {
7576
return this.borderType === BorderType.ELEVATED ?
76-
html`<div class="md3-elevation-overlay" aria-hidden="true"></div>` :
77+
html`<md-elevation aria-hidden="true" shadow surface></md-elevation>` :
7778
html``;
7879
}
7980

0 commit comments

Comments
 (0)