Skip to content

Commit

Permalink
fix(field): extend box to include outline
Browse files Browse the repository at this point in the history
  • Loading branch information
samrichardsontylertech committed Oct 10, 2024
1 parent 2c89759 commit d4bb765
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/lib/field/_core.theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ $elevations: (
@include override(tonal-background, map.get($tonal-backgrounds, $theme), value);
@include override(tonal-background-hover, map.get($tonal-backgrounds-hover, $theme), value);
}

@include override(content-color, map.get($content-colors, $theme), value);
@include override(inner-border-color, map.get($outline-colors, $theme), value);
@include override(inner-border-color-hover, map.get($outline-colors-hover, $theme), value);
Expand All @@ -106,13 +107,15 @@ $elevations: (
@include override(padding-inline, 0, value);
@include override(surface-display, none, value);
} @else if $variant == outlined {
@include with-outline;
@include hidden-background;
} @else if $variant == tonal {
@include no-outline;
@include unoutlined-variant-inner-border;
@include visible-background(tonal);
@include override(multiline-inset-label-background, #{token(multiline-inset-label-tonal-background, custom)}, value);
} @else if $variant == filled {
@include with-outline;
@include visible-background(filled);
} @else if $variant == raised {
@include elevated;
Expand All @@ -122,6 +125,10 @@ $elevations: (
}
}

@mixin with-outline {
padding: #{token(outline-width)};
}

@mixin no-outline($no-inner: false) {
@include override(outline-color, transparent, value);
@include override(outline-color-hover, transparent, value);
Expand Down
4 changes: 4 additions & 0 deletions src/lib/field/forge-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ $_input-selector: ':where(input, textarea, select, .forge-field__input)';

box-shadow: #{token(elevation, custom)};

margin: #{token(outline-width)};
padding-inline: #{token(padding-inline)};
border-radius: #{token(shape)};
outline-style: #{token(outline-style)};
Expand Down Expand Up @@ -72,12 +73,14 @@ $_input-selector: ':where(input, textarea, select, .forge-field__input)';
&--plain {
@include core.variant(plain);

margin: 0;
outline-width: 0;
}

&--tonal {
@include core.variant(tonal);

margin: 0;
outline-width: 0;
background: #{theme.variable(primary-container-low)};

Expand All @@ -95,6 +98,7 @@ $_input-selector: ':where(input, textarea, select, .forge-field__input)';
&--raised {
@include core.variant(raised);

margin: 0;
outline-width: 0;

&:hover:not(:has(#{$_input-selector}:disabled)) {
Expand Down

0 comments on commit d4bb765

Please sign in to comment.