Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Commit 308830d

Browse files
committed
chore(textfield): separate position mixins for leading/trailing icons
1 parent 85b8ee7 commit 308830d

File tree

2 files changed

+11
-49
lines changed

2 files changed

+11
-49
lines changed

packages/mdc-textfield/_mixins.scss

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,7 @@
622622
// Icons
623623

624624
@mixin mdc-text-field-with-leading-icon_ {
625-
@include mdc-text-field-icon-horizontal-position_(
626-
left,
627-
$mdc-text-field-icon-position
628-
);
625+
@include mdc-text-field-leading-icon-horizontal-position_($mdc-text-field-icon-position);
629626

630627
.mdc-text-field__input {
631628
@include mdc-rtl-reflexive-property(padding, $mdc-text-field-icon-padding, $mdc-text-field-input-padding);
@@ -637,10 +634,7 @@
637634
}
638635

639636
@mixin mdc-text-field-dense-with-leading-icon_ {
640-
@include mdc-text-field-icon-horizontal-position_(
641-
left,
642-
$mdc-text-field-dense-icon-position
643-
);
637+
@include mdc-text-field-leading-icon-horizontal-position_($mdc-text-field-dense-icon-position);
644638

645639
.mdc-text-field__input {
646640
@include mdc-rtl-reflexive-property(padding, $mdc-text-field-dense-icon-padding, $mdc-text-field-input-padding);
@@ -652,10 +646,7 @@
652646
}
653647

654648
@mixin mdc-text-field-outlined-with-leading-icon_ {
655-
@include mdc-text-field-icon-horizontal-position_(
656-
left,
657-
$mdc-text-field-icon-position
658-
);
649+
@include mdc-text-field-leading-icon-horizontal-position_($mdc-text-field-icon-position);
659650
@include mdc-notched-outline-floating-label-float-position-absolute($mdc-text-field-outlined-label-position-y, 32px);
660651
@include mdc-floating-label-shake-animation(text-field-outlined-leading-icon);
661652

@@ -686,53 +677,34 @@
686677
}
687678

688679
@mixin mdc-text-field-with-trailing-icon_ {
689-
@include mdc-text-field-icon-horizontal-position_(
690-
right,
691-
$mdc-text-field-trailing-icon-position
692-
);
680+
@include mdc-text-field-trailing-icon-horizontal-position_($mdc-text-field-trailing-icon-position);
693681

694682
.mdc-text-field__input {
695683
@include mdc-rtl-reflexive-property(padding, $mdc-text-field-input-padding, $mdc-text-field-icon-padding);
696684
}
697685

698686
// Outlined uses 16px for text alignment when using a trailing icon.
699687
&.mdc-text-field--outlined {
700-
@include mdc-text-field-icon-horizontal-position_(
701-
right,
702-
$mdc-text-field-icon-position
703-
);
688+
@include mdc-text-field-trailing-icon-horizontal-position_($mdc-text-field-icon-position);
704689
}
705690
}
706691

707692
@mixin mdc-text-field-dense-with-trailing-icon_ {
708-
@include mdc-text-field-icon-horizontal-position_(
709-
right,
710-
$mdc-text-field-dense-icon-position
711-
);
693+
@include mdc-text-field-trailing-icon-horizontal-position_($mdc-text-field-dense-icon-position);
712694

713695
.mdc-text-field__input {
714696
@include mdc-rtl-reflexive-property(padding, $mdc-text-field-input-padding, $mdc-text-field-dense-icon-padding);
715697
}
716698
}
717699

718700
@mixin mdc-text-field-with-both-icons_ {
719-
@include mdc-text-field-icon-horizontal-position-two-icons_(
720-
$mdc-text-field-icon-position,
721-
$mdc-text-field-trailing-icon-position
722-
);
723-
724701
.mdc-text-field__input {
725702
padding-right: $mdc-text-field-icon-padding;
726703
padding-left: $mdc-text-field-icon-padding;
727704
}
728705
}
729706

730707
@mixin mdc-text-field-dense-with-both-icons_ {
731-
@include mdc-text-field-icon-horizontal-position-two-icons_(
732-
$mdc-text-field-dense-icon-position,
733-
$mdc-text-field-dense-icon-position
734-
);
735-
736708
.mdc-text-field__input {
737709
padding-right: $mdc-text-field-dense-icon-padding;
738710
padding-left: $mdc-text-field-dense-icon-padding;

packages/mdc-textfield/icon/_mixins.scss

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,25 +59,15 @@
5959

6060
// Private mixins
6161

62-
@mixin mdc-text-field-icon-horizontal-position_($position-property, $position) {
63-
@if ($position-property == left) {
64-
.mdc-text-field__icon--leading {
65-
@include mdc-rtl-reflexive-position($position-property, $position);
66-
}
67-
} @else {
68-
.mdc-text-field__icon--trailing {
69-
@include mdc-rtl-reflexive-position($position-property, $position);
70-
}
71-
}
72-
}
73-
74-
@mixin mdc-text-field-icon-horizontal-position-two-icons_($position-left, $position-right) {
62+
@mixin mdc-text-field-leading-icon-horizontal-position_($position) {
7563
.mdc-text-field__icon--leading {
76-
@include mdc-rtl-reflexive(left, $position-left, right, auto);
64+
@include mdc-rtl-reflexive-position(left, $position);
7765
}
66+
}
7867

68+
@mixin mdc-text-field-trailing-icon-horizontal-position_($position) {
7969
.mdc-text-field__icon--trailing {
80-
@include mdc-rtl-reflexive(right, $position-right, left, auto);
70+
@include mdc-rtl-reflexive-position(right, $position);
8171
}
8272
}
8373

0 commit comments

Comments
 (0)