-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(notched-outline): separate outline from text-field #2326
Changes from 9 commits
a9d6c3c
9b750cd
4b01134
5a4500f
324a638
51f16f6
af02b19
6f9abdf
028c00d
024ff39
2f72c61
c2f6b95
f452125
f00ef39
4a9846c
1f2cf62
ab8b035
040f739
d3871a3
252ffc4
43bd881
9b627e2
808b6ff
bed6857
2c1c55e
d7e1776
8a03462
5973760
8385248
182b4b1
ce05cda
1a0aa6c
7f69180
f8ca6f1
161e40a
d6a5606
eb3893f
da53da7
ead024d
78f5b2d
8a05219
60467b6
466e7e6
699da0a
ca134d9
67c1ab8
d7e6962
d76fedc
91ad0a9
edc898b
5dbf686
6fdbafc
30b59cb
2ae20d1
f03ca0e
957fa3c
7d3a17c
5247b43
cf75c3b
fbce528
4237987
f556712
f772800
a14f34a
0898056
c46fa37
5d19c87
c2a9737
3bfdcf2
4d4c4fe
b98ae09
b7b9ce7
fc35362
2a30f0d
9b539e0
adf5817
3f3ca89
f351e17
526a69f
67bb0a5
e9141ea
0a6294c
9378b7c
8157968
142a142
0ec3a8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,6 @@ | |
@import "icon/mixins"; | ||
@import "icon/variables"; | ||
|
||
@mixin mdc-text-field-outline-corner-radius($radius) { | ||
border-radius: $radius; | ||
} | ||
|
||
@mixin mdc-text-field-box-corner-radius($radius) { | ||
border-radius: $radius $radius 0 0; | ||
} | ||
|
@@ -189,6 +185,20 @@ | |
} | ||
} | ||
|
||
@mixin mdc-text-field-outline-corner-radius_($radius) { | ||
// NOTE: idle and notched state border radius mixins | ||
// are broken into 2 different mixins, otherwise | ||
// we would be overly specific (big no, no). The cause of | ||
// this is because .mdc-notched-outline and .mdc-notched-outline__idle | ||
// are siblings. .mdc-notched-outline__idle needs to be a child of | ||
// .mdc-notched-outline in order to remedy this issue. | ||
.mdc-notched-outline { | ||
@include mdc-notched-outline-corner-radius($radius); | ||
} | ||
|
||
@include mdc-notched-outline-idle-corner-radius($radius); | ||
} | ||
|
||
// Outlined | ||
|
||
@mixin mdc-text-field-outlined-disabled_ { | ||
|
@@ -207,9 +217,7 @@ | |
} | ||
|
||
@mixin mdc-text-field-outlined-focused_ { | ||
.mdc-notched-outline__path { | ||
stroke-width: 2px; | ||
} | ||
@include mdc-notched-outline-stroke-width(2px); | ||
} | ||
|
||
@mixin mdc-text-field-outlined-dense_ { | ||
|
@@ -237,6 +245,7 @@ | |
@include mdc-text-field-focused-outline-color(primary); | ||
@include mdc-floating-label-float-position($mdc-text-field-outlined-label-position-y); | ||
@include mdc-floating-label-shake-animation(text-field-outlined); | ||
@include mdc-text-field-outline-corner-radius_($mdc-text-field-border-radius); | ||
|
||
height: 56px; | ||
border: none; | ||
|
@@ -261,14 +270,13 @@ | |
.mdc-text-field__icon { | ||
z-index: 2; | ||
} | ||
|
||
.mdc-notched-outline, | ||
.mdc-notched-outline__idle { | ||
@include mdc-text-field-outline-corner-radius($mdc-text-field-border-radius); | ||
} | ||
} | ||
|
||
@mixin mdc-text-field-outline-color_($color) { | ||
// NOTE: outlined version of text-field wants the "idle" and | ||
// "notched" outline to have the same color. This covers two cases: | ||
// 1) text field renders with NO value in the "idle" state | ||
// 2) text field renders with a value in the "notched" state | ||
@include mdc-notched-outline-idle-color($color); | ||
@include mdc-notched-outline-color($color); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add a comment that outlined version of text field wants the "idle" and "notched" version to have the same color. This covers two cases: 1) the "idle" state when a text field renders with no value 2) the "notched" state when a text field renders with an initial value |
||
} | ||
|
@@ -279,6 +287,12 @@ | |
.mdc-text-field__icon:hover ~ { | ||
@include mdc-notched-outline-idle-color($color); | ||
|
||
// tldr; this doesn't break BEM: | ||
// We need to wrap this mixin with the .mdc-notched-outline | ||
// selector, because of the sibling selector '~'. The notched | ||
// outline html structure has .mdc-notched-outline | ||
// and .mdc-notched-outline__idle as siblings, while | ||
// .mdc-notched-outline__path is a child of .mdc-notched-outline | ||
.mdc-notched-outline { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Put a bunch of comments here around the ~ and sibling selector, and why thats hella complicated because And then file a GitHub issue to investigate making |
||
@include mdc-notched-outline-color($color); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change this whole NOTE to
Because notched-outline has sibling elements, you need to call the "idle" Sass mixins with parent selectors.
Consider the following example HTML:
In order to customize any "non-idle" part of notched-outline, use the
.foo-line-ripple
CSS selector:But in order to customize any "idle" part of the notched-outline, you must use the
.foo-line-ripple-parent
CSS selector: