Skip to content

Commit

Permalink
refactor(textfield)!: remove container-height token
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 501699310
  • Loading branch information
asyncLiz authored and copybara-github committed Jan 13, 2023
1 parent 31391eb commit 1d81416
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 19 deletions.
3 changes: 1 addition & 2 deletions autocomplete/lib/_filled-autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@use '../../menusurface/menu-surface';
@use '../../sass/theme';
@use '../../textfield/filled-text-field';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';
@use './shared';

$custom-property-prefix: 'filled-autocomplete';
Expand Down Expand Up @@ -53,7 +53,6 @@ $dark-theme: tokens.md-comp-filled-autocomplete-values(
active-indicator-height: var(--_text-field-active-indicator-height),
caret-color: var(--_text-field-caret-color),
container-color: var(--_text-field-container-color),
container-height: var(--_text-field-container-height),
disabled-active-indicator-color:
var(--_text-field-disabled-active-indicator-color),
disabled-active-indicator-height:
Expand Down
3 changes: 1 addition & 2 deletions autocomplete/lib/_outlined-autocomplete.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
@use '../../menusurface/menu-surface';
@use '../../sass/theme';
@use '../../textfield/outlined-text-field';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';
@use './shared';

$custom-property-prefix: 'outlined-autocomplete';
Expand Down Expand Up @@ -58,7 +58,6 @@ $dark-theme: tokens.md-comp-outlined-autocomplete-values(
@include outlined-text-field.theme(
(
caret-color: var(--_text-field-caret-color),
container-height: var(--_text-field-container-height),
disabled-input-text-color: var(--_text-field-disabled-input-text-color),
disabled-input-text-opacity:
var(--_text-field-disabled-input-text-opacity),
Expand Down
7 changes: 5 additions & 2 deletions field/lib/_filled-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ $_animation-duration: 150ms;
// If bottom corner radii are set, prevent the active indicator from
// overflowing.
overflow: hidden;
padding-top: var(--_container-padding-vertical);
padding-bottom: var(--_container-padding-vertical);
// Needed for negative z-index below to place background and state layer
// behind content.
z-index: 0;
Expand Down Expand Up @@ -148,6 +146,11 @@ $_animation-duration: 150ms;
}

.md3-field:not(.md3-field--no-label) {
.md3-field__container {
padding-bottom: var(--_with-label-container-padding-vertical);
padding-top: var(--_with-label-container-padding-vertical);
}

.md3-field__middle {
padding-top: var(--_label-text-populated-line-height);
}
Expand Down
6 changes: 4 additions & 2 deletions field/lib/_md-comp-filled-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

@use 'sass:map';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';

$_default-deps: (
md-sys-color: tokens.md-sys-color-values-light(),
Expand Down Expand Up @@ -50,7 +50,7 @@ $_default-deps: (
$values,
(
container-padding-horizontal: if($exclude-hardcoded-values, null, 16px),
container-padding-vertical: if($exclude-hardcoded-values, null, 8px),
container-padding-vertical: if($exclude-hardcoded-values, null, 16px),
content-color: map.get($text-field-values, input-text-color),
disabled-content-color:
map.get($text-field-values, disabled-input-text-color),
Expand All @@ -65,6 +65,8 @@ $_default-deps: (
hover-content-color: map.get($text-field-values, hover-input-text-color),
supporting-text-padding: if($exclude-hardcoded-values, null, 16px),
supporting-text-padding-top: if($exclude-hardcoded-values, null, 4px),
with-label-container-padding-vertical:
if($exclude-hardcoded-values, null, 8px),
)
);

Expand Down
4 changes: 2 additions & 2 deletions field/lib/_md-comp-outlined-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//

@use 'sass:map';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';

$_default-deps: (
md-sys-color: tokens.md-sys-color-values-light(),
Expand Down Expand Up @@ -50,7 +50,7 @@ $_default-deps: (
$values,
(
container-padding-horizontal: if($exclude-hardcoded-values, null, 16px),
container-padding-vertical: if($exclude-hardcoded-values, null, 8px),
container-padding-vertical: if($exclude-hardcoded-values, null, 16px),
content-color: map.get($text-field-values, input-text-color),
disabled-content-color:
map.get($text-field-values, disabled-input-text-color),
Expand Down
2 changes: 2 additions & 0 deletions field/lib/_shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
display: flex;
flex: 1;
flex-basis: var(--_container-height);
padding-top: var(--_container-padding-vertical);
padding-bottom: var(--_container-padding-vertical);
position: relative;
}

Expand Down
4 changes: 2 additions & 2 deletions switch/lib/_handle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
border-start-end-radius: var(--_handle-shape-start-end);
border-end-end-radius: var(--_handle-shape-end-end);
border-end-start-radius: var(--_handle-shape-end-start);
height: var(--_handle-height);
width: var(--_handle-width);
height: 20px;
width: 20px;
background-color: var(--_selected-handle-color);

// TODO(b/230484095): Use token instead of hard coded values
Expand Down
2 changes: 1 addition & 1 deletion switch/lib/_switch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
@use '../../sass/theme';
@use '../../sass/touch-target';
@use '../../sass/var';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';

@use './track';
@use './handle';
Expand Down
8 changes: 5 additions & 3 deletions textfield/lib/_filled-text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@use '../../sass/resolvers';
@use '../../sass/shape';
@use '../../sass/theme';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';
@use './shared';

@mixin theme($tokens) {
Expand Down Expand Up @@ -36,9 +36,10 @@
$tokens: map.merge(
(
container-padding-horizontal: 16px,
container-padding-vertical: 8px,
container-padding-vertical: 16px,
input-text-prefix-padding: 2px,
input-text-suffix-padding: 2px,
with-label-container-padding-vertical: 8px,
),
$tokens
);
Expand All @@ -56,7 +57,6 @@
active-indicator-color: var(--_active-indicator-color),
active-indicator-height: var(--_active-indicator-height),
container-color: var(--_container-color),
container-height: var(--_container-height),
container-padding-horizontal: var(--_container-padding-horizontal),
container-padding-vertical: var(--_container-padding-vertical),
container-shape-start-start: var(--_container-shape-start-start),
Expand Down Expand Up @@ -141,6 +141,8 @@
supporting-text-weight: var(--_supporting-text-weight),
trailing-icon-color: var(--_trailing-icon-color),
trailing-icon-size: var(--_trailing-icon-size),
with-label-container-padding-vertical:
var(--_with-label-container-padding-vertical),
)
);
}
Expand Down
7 changes: 4 additions & 3 deletions textfield/lib/_outlined-text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@use '../../sass/resolvers';
@use '../../sass/shape';
@use '../../sass/theme';
@use '../../tokens/v0_150' as tokens;
@use '../../tokens';
@use './shared';

@mixin theme($tokens) {
Expand Down Expand Up @@ -37,7 +37,7 @@
$tokens: map.merge(
(
container-padding-horizontal: 16px,
container-padding-vertical: 8px,
container-padding-vertical: 16px,
input-text-prefix-padding: 2px,
input-text-suffix-padding: 2px,
outline-label-padding: 4px,
Expand All @@ -55,7 +55,8 @@

@include outlined-field.theme(
(
container-height: var(--_container-height),
container-padding-horizontal: var(--_container-padding-horizontal),
container-padding-vertical: var(--_container-padding-vertical),
container-shape-start-start: var(--_container-shape-start-start),
container-shape-start-end: var(--_container-shape-start-end),
container-shape-end-end: var(--_container-shape-end-end),
Expand Down

0 comments on commit 1d81416

Please sign in to comment.