-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore(text-field): moved textarea sass into private mixins #1942
Changes from 1 commit
c0570b4
7920a8d
27cc1b0
430ea2d
8d712a2
d8b918f
2c0b483
a46a2f0
5a852db
1bed49f
7a78704
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -243,6 +243,108 @@ | |
} | ||
} | ||
|
||
@mixin mdc-text-field-textarea-invalid_ { | ||
// stylelint-disable plugin/selector-bem-pattern | ||
|
||
border-color: $mdc-text-field-error-on-light; | ||
|
||
// stylelint-enable plugin/selector-bem-pattern | ||
} | ||
|
||
@mixin mdc-text-field-textarea-focused_ { | ||
@include mdc-theme-prop(border-color, primary); | ||
} | ||
|
||
@mixin mdc-text-field-textarea_ { | ||
@include mdc-text-field-textarea-corner-radius($mdc-text-field-border-radius); | ||
|
||
$padding-inset: 16px; | ||
$label-offset-y: $padding-inset + 2; | ||
$label-offset-x: $padding-inset; | ||
|
||
display: flex; | ||
width: fit-content; | ||
height: initial; | ||
transition: none; | ||
border: 1px solid $mdc-textarea-border-on-light; | ||
overflow: hidden; | ||
|
||
@include mdc-theme-dark(".mdc-text-field") { | ||
border-color: $mdc-textarea-border-on-dark; | ||
} | ||
|
||
// stylelint-disable plugin/selector-bem-pattern | ||
.mdc-text-field__input { | ||
margin: 0; | ||
padding: $padding-inset; | ||
padding-top: $padding-inset * 2; | ||
border: 1px solid transparent; | ||
|
||
&:focus { | ||
@include mdc-theme-prop(border-color, primary); | ||
} | ||
|
||
&:invalid:not(:focus) { | ||
border-color: $mdc-text-field-error-on-light; | ||
} | ||
|
||
@include mdc-theme-dark(".mdc-text-field") { | ||
&:hover { | ||
border-bottom-color: transparent; | ||
} | ||
|
||
&:focus { | ||
@include mdc-theme-prop(border-color, secondary); | ||
} | ||
|
||
&:invalid:not(:focus) { | ||
border-color: $mdc-text-field-error-on-dark; | ||
} | ||
} | ||
} | ||
|
||
.mdc-text-field__label { | ||
@include mdc-rtl-reflexive-position(left, 1px); | ||
|
||
top: $label-offset-y; | ||
bottom: auto; | ||
padding: 8px 16px; | ||
background-color: $mdc-textarea-light-background; | ||
line-height: 1.15; | ||
|
||
@include mdc-theme-dark(".mdc-text-field") { | ||
background-color: $mdc-textarea-dark-background; | ||
} | ||
|
||
&--float-above { | ||
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. remove this & syntax and just use .mdc-text-field__label--float-above |
||
// Translate above the top of the input, and compensate for the amount of offset needed | ||
// to position the label within the bounds of the inset padding. | ||
// Note that the scale factor is an eyeball'd approximation of what's shown in the mocks. | ||
transform: translateY(-50%) scale(.923, .923); | ||
} | ||
} | ||
|
||
&.mdc-text-field--disabled { | ||
@include mdc-text-field-textarea-disabled_; | ||
} | ||
|
||
&:not(.mdc-text-field--upgraded) { | ||
.mdc-text-field__input { | ||
padding-top: $padding-inset; | ||
} | ||
} | ||
|
||
&.mdc-text-field--invalid { | ||
@include mdc-text-field-textarea-invalid_; | ||
} | ||
|
||
&.mdc-text-field--focused { | ||
@include mdc-text-field-textarea-focused_; | ||
} | ||
} | ||
|
||
// stylelint-enable plugin/selector-bem-pattern | ||
|
||
// Private Color Mixins | ||
|
||
@mixin mdc-text-field-ink-color_($color) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -399,14 +399,6 @@ | |
@include mdc-text-field-invalid_; | ||
} | ||
|
||
// stylelint-disable plugin/selector-bem-pattern | ||
|
||
.mdc-text-field--invalid.mdc-text-field--textarea { | ||
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. this was moved into the bottom of the main textarea mixins_.scss selector |
||
border-color: $mdc-text-field-error-on-light; | ||
} | ||
|
||
// stylelint-enable plugin/selector-bem-pattern | ||
|
||
.mdc-text-field--dense { | ||
margin-top: 12px; | ||
margin-bottom: 4px; | ||
|
@@ -432,91 +424,9 @@ | |
} | ||
|
||
.mdc-text-field--textarea { | ||
@include mdc-text-field-textarea-corner-radius($mdc-text-field-border-radius); | ||
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. This is all a copy paste into mixins_.scss |
||
|
||
$padding-inset: 16px; | ||
$label-offset-y: $padding-inset + 2; | ||
$label-offset-x: $padding-inset; | ||
|
||
display: flex; | ||
width: fit-content; | ||
height: initial; | ||
transition: none; | ||
border: 1px solid $mdc-textarea-border-on-light; | ||
overflow: hidden; | ||
|
||
@include mdc-theme-dark(".mdc-text-field") { | ||
border-color: $mdc-textarea-border-on-dark; | ||
} | ||
|
||
// stylelint-disable plugin/selector-bem-pattern | ||
.mdc-text-field__input { | ||
margin: 0; | ||
padding: $padding-inset; | ||
padding-top: $padding-inset * 2; | ||
border: 1px solid transparent; | ||
|
||
&:focus { | ||
@include mdc-theme-prop(border-color, primary); | ||
} | ||
|
||
&:invalid:not(:focus) { | ||
border-color: $mdc-text-field-error-on-light; | ||
} | ||
|
||
@include mdc-theme-dark(".mdc-text-field") { | ||
&:hover { | ||
border-bottom-color: transparent; | ||
} | ||
|
||
&:focus { | ||
@include mdc-theme-prop(border-color, secondary); | ||
} | ||
|
||
&:invalid:not(:focus) { | ||
border-color: $mdc-text-field-error-on-dark; | ||
} | ||
} | ||
} | ||
|
||
.mdc-text-field__label { | ||
@include mdc-rtl-reflexive-position(left, 1px); | ||
|
||
top: $label-offset-y; | ||
bottom: auto; | ||
padding: 8px 16px; | ||
background-color: $mdc-textarea-light-background; | ||
line-height: 1.15; | ||
|
||
@include mdc-theme-dark(".mdc-text-field") { | ||
background-color: $mdc-textarea-dark-background; | ||
} | ||
|
||
&--float-above { | ||
// Translate above the top of the input, and compensate for the amount of offset needed | ||
// to position the label within the bounds of the inset padding. | ||
// Note that the scale factor is an eyeball'd approximation of what's shown in the mocks. | ||
transform: translateY(-50%) scale(.923, .923); | ||
} | ||
} | ||
|
||
&.mdc-text-field--disabled { | ||
@include mdc-text-field-textarea-disabled_; | ||
} | ||
|
||
&:not(.mdc-text-field--upgraded) { | ||
.mdc-text-field__input { | ||
padding-top: $padding-inset; | ||
} | ||
} | ||
} | ||
|
||
.mdc-text-field--textarea.mdc-text-field--focused { | ||
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. this was also moved into the bottom of the main textarea mixins_.scss selector |
||
@include mdc-theme-prop(border-color, primary); | ||
@include mdc-text-field-textarea_; | ||
} | ||
|
||
// stylelint-enable plugin/selector-bem-pattern | ||
|
||
.mdc-text-field--fullwidth { | ||
width: 100%; | ||
|
||
|
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.
you dont need this stylelint disable/enable comments any more