Skip to content

Commit

Permalink
feat(textfield): Limit notched outline max-width
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 306891191
  • Loading branch information
patrickrodee authored and Copybara-Service committed Apr 16, 2020
1 parent ce6cb70 commit 0ab62a6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
15 changes: 15 additions & 0 deletions packages/mdc-notched-outline/_mixins.scss
Expand Up @@ -250,6 +250,21 @@
}
}

///
/// Sets the max-width for the notch
///
/// @param {Number} $max-width Max-width for the notch
///
@mixin notch-max-width($max-width, $query: feature-targeting-functions.all()) {
$feat-structure: feature-targeting-functions.create-target($query, structure);

:not(.mdc-notched-outline--notched) .mdc-notched-outline__notch {
@include feature-targeting-mixins.targets($feat-structure) {
max-width: $max-width;
}
}
}

//
// Private
//
Expand Down
13 changes: 7 additions & 6 deletions packages/mdc-textfield/_mixins.scss
Expand Up @@ -1134,14 +1134,15 @@
@include floating-label-mixins.shake-animation(text-field-outlined-leading-icon-rtl, $query: $query);
}

$icon-padding: icon-variables.$leading-icon-padding-left + icon-variables.$icon-size + icon-variables.$leading-icon-padding-right;
$notch-truncation: $icon-padding + notched-outline-variables.$leading-width;
$left-spacing: $icon-padding - notched-outline-variables.$leading-width;

@include notched-outline-mixins.notch-max-width(calc(100% - #{$notch-truncation}), $query: $query);

.mdc-floating-label {
@include feature-targeting-mixins.targets($feat-structure) {
$icon-padding: icon-variables.$leading-icon-padding-left + icon-variables.$icon-size + icon-variables.$leading-icon-padding-right;

@include rtl-mixins.reflexive-position(
left,
$icon-padding - notched-outline-variables.$leading-width
);
@include rtl-mixins.reflexive-position(left, $left-spacing);
}
}
}
Expand Down

0 comments on commit 0ab62a6

Please sign in to comment.