File tree Expand file tree Collapse file tree 7 files changed +60
-12
lines changed
Expand file tree Collapse file tree 7 files changed +60
-12
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ $light-theme: map.merge(
4141 disabled- stroke- color: color-palette .$grey-700 ,
4242 disabled- stroke- opacity: 0.38 ,
4343 error- hover- stroke- color: $_error-state-content ,
44- error- stroke- color: error,
45- focus- stroke- color: primary,
44+ error- stroke- color: theme-color . $ error ,
45+ focus- stroke- color: theme-color . $ primary ,
4646 focus- stroke- width: 2px ,
4747 hover- state- layer- color: color-palette .$grey-800 ,
4848 hover- state- layer- opacity: 0.08 ,
@@ -209,7 +209,7 @@ $light-theme: map.merge(
209209@mixin _shape ($shape ) {
210210 .mdc-field__container {
211211 border-start-start-radius : $shape ;
212- broder -start-end-radius : $shape ;
212+ border -start-end-radius : $shape ;
213213 }
214214}
215215
Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ $light-theme: map.merge(
5454 outlined-field
5555 );
5656
57- @include theme .emit-theme-vars ($theme , outlined - field );
57+ @include theme .emit-theme-vars ($theme );
5858}
5959
6060@mixin theme-styles ($theme ) {
@@ -126,18 +126,18 @@ $light-theme: map.merge(
126126
127127 .mdc-field__outline-notch {
128128 padding : 0 $padding ;
129- margin-inline-start : calc (-1 * $padding );
129+ margin-inline-start : calc (-1 * #{ $padding } );
130130 margin-inline-end : $padding ;
131131 }
132132
133133 .mdc-field__outline-end {
134- margin-inline-start : calc (-1 * $padding );
134+ margin-inline-start : calc (-1 * #{ $padding } );
135135 }
136136}
137137
138138@mixin _outline-notch-max-width ($container-padding-horizontal ) {
139139 .mdc-field__outline-notch {
140- max-width : calc (100% - 2 * $container-padding-horizontal );
140+ max-width : calc (100% - 2 * #{ $container-padding-horizontal } );
141141 }
142142}
143143
@@ -207,7 +207,7 @@ $light-theme: map.merge(
207207
208208 .mdc-field__label--floating {
209209 // Center the label within the outline stroke
210- transform : translateY (calc (-50% + $width / 2 ));
210+ transform : translateY (calc (-50% + #{ $width } / 2 ));
211211 }
212212}
213213
Original file line number Diff line number Diff line change @@ -50,6 +50,10 @@ $_animation-duration: 150ms;
5050
5151 .mdc-field__outline-notch {
5252 @include outline-notch ;
53+
54+ .mdc-field--no-label & {
55+ @include outline-notch-no-label ;
56+ }
5357 }
5458
5559 .mdc-field__outline-panel-inactive ,
@@ -165,6 +169,10 @@ $_animation-duration: 150ms;
165169 position : relative ;
166170}
167171
172+ @mixin outline-notch-no-label () {
173+ display : none ;
174+ }
175+
168176@mixin outline-panel () {
169177 border : inherit ;
170178 border-bottom-style : solid ;
Original file line number Diff line number Diff line change @@ -41,9 +41,10 @@ export class Field extends LitElement implements FieldState {
4141 return {
4242 'mdc-field--disabled' : this . disabled ,
4343 'mdc-field--error' : this . error ,
44- 'mdc-field--focused ' : this . focused ,
44+ 'mdc-field--focus ' : this . focused ,
4545 'mdc-field--populated' : this . populated ,
4646 'mdc-field--required' : this . required ,
47+ 'mdc-field--no-label' : ! this . label ,
4748 } ;
4849 }
4950
Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright 2021 Google LLC
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ import { Harness } from '../../testing/harness' ;
8+ import { Field } from '../lib/field' ;
9+
10+ /**
11+ * Test harness for field elements.
12+ */
13+ export class FieldHarness extends Harness < Field > {
14+ override async focusWithKeyboard ( ) {
15+ this . element . focused = true ;
16+ }
17+
18+ override async focusWithPointer ( ) {
19+ await this . hoverEnter ( ) ;
20+ this . element . focused = true ;
21+ }
22+
23+ override async blur ( ) {
24+ await this . hoverLeave ( ) ;
25+ this . element . focused = false ;
26+ }
27+
28+ protected override async getInteractiveElement ( ) {
29+ await this . element . updateComplete ;
30+ return this . element . renderRoot . querySelector ( '.mdc-field' ) as HTMLElement ;
31+ }
32+ }
Original file line number Diff line number Diff line change 1+ /**
2+ * @license
3+ * Copyright 2021 Google LLC
4+ * SPDX-License-Identifier: Apache-2.0
5+ */
6+
7+ // TODO(b/201431473): add unit tests
Original file line number Diff line number Diff line change 8686/// @param {Map} $theme - The theme Map to emit custom property declarations
8787/// for.
8888@mixin emit-theme-vars ($theme ) {
89- $theme : create-theme-properties ($theme , $prefix );
90-
9189 @each $token , $value in $theme {
9290 @if meta .type-of ($value ) == ' map' {
9391 @include emit-theme-vars ($value );
119117/// @param {Map} $theme - User-provided theme Map to validate.
120118/// @return {Map} The validated user-provided theme Map.
121119@function validate-theme ($reference-theme , $theme ) {
122- @return _validate-theme-values (validate-theme-keys ($reference-theme , $theme ));
120+ @return _validate-theme-values (
121+ validate-theme-tokens ($reference-theme , $theme )
122+ );
123123}
124124
125125/// Validates a theme's tokens and throws an error if incorrect tokens are
You can’t perform that action at this time.
0 commit comments