|
59 | 59 | @include ripple-mixins.states-hover-opacity(ripple-functions.states-opacity(variables.$ink-color, hover), $query: $query, $ripple-target: variables.$ripple-target);
|
60 | 60 | @include ripple-mixins.states-focus-opacity(ripple-functions.states-opacity(variables.$ink-color, focus), $query: $query, $ripple-target: variables.$ripple-target);
|
61 | 61 |
|
62 |
| - // Height |
| 62 | + // Height and baseline |
63 | 63 | @include height(variables.$height, $query: $query);
|
64 | 64 |
|
65 | 65 | // Shape
|
|
84 | 84 |
|
85 | 85 | @include feature-targeting-mixins.targets($feat-structure) {
|
86 | 86 | display: inline-flex;
|
| 87 | + padding: 0 variables.$padding-horizontal; |
87 | 88 | position: relative;
|
88 | 89 | box-sizing: border-box;
|
89 | 90 | overflow: hidden;
|
|
95 | 96 | .mdc-text-field__input {
|
96 | 97 | // Exclude setting line-height to keep caret (text cursor) same height as the input text in iOS browser.
|
97 | 98 | @include typography-mixins.typography(subtitle1, $exclude-props: (line-height), $query: $query);
|
98 |
| - @include input-padding_($query: $query); |
99 | 99 |
|
100 | 100 | @include feature-targeting-mixins.targets($feat-structure) {
|
101 |
| - align-self: flex-end; |
102 |
| - box-sizing: border-box; |
103 | 101 | width: 100%;
|
104 |
| - height: 100%; |
| 102 | + height: variables.$input-height; |
105 | 103 | border: none;
|
106 | 104 | border-radius: 0;
|
107 | 105 | background: none;
|
108 | 106 | appearance: none;
|
| 107 | + padding: 0; |
109 | 108 | }
|
110 | 109 |
|
111 | 110 | @include feature-targeting-mixins.targets($feat-animation) {
|
|
158 | 157 | z-index: auto !important;
|
159 | 158 | }
|
160 | 159 | }
|
161 |
| - |
162 |
| - // Vertically center aligns the text input placeholder and value for only filled variant. |
163 |
| - .mdc-text-field--no-label:not(.mdc-text-field--outlined):not(.mdc-text-field--textarea) & { |
164 |
| - @include input-no-label-padding_($query: $query); |
165 |
| - } |
166 | 160 | }
|
167 | 161 |
|
168 | 162 | // stylelint-disable-next-line plugin/selector-bem-pattern
|
|
440 | 434 | /// @param {Number} $height
|
441 | 435 | /// @param {Number} $minimum-height-for-filled-label Sets the minimum height for
|
442 | 436 | /// filled textfields at which to allow floating labels.
|
| 437 | +/// @param {Number} $filled-baseline-top The baseline from the top of the field |
| 438 | +///. that the input should be aligned to for a filled variant with a label |
443 | 439 | /// @access public
|
444 | 440 | ///
|
445 |
| -@mixin height($height, $minimum-height-for-filled-label: variables.$minimum-height-for-filled-label, $query: feature-targeting-functions.all()) { |
| 441 | +@mixin height( |
| 442 | + $height, |
| 443 | + $minimum-height-for-filled-label: variables.$minimum-height-for-filled-label, |
| 444 | + $filled-baseline-top: variables.$filled-baseline-top, |
| 445 | + $query: feature-targeting-functions.all() |
| 446 | +) { |
446 | 447 | $feat-structure: feature-targeting-functions.create-target($query, structure);
|
447 |
| - |
448 | 448 | @include feature-targeting-mixins.targets($feat-structure) {
|
449 | 449 | height: $height;
|
450 | 450 | }
|
451 | 451 |
|
| 452 | + // Filled variant is aligned to baseline... |
| 453 | + @include typography-mixins.baseline($top: $filled-baseline-top, $display: inline-flex, $query: $query); |
| 454 | + // ...unless it is too small to display a label |
452 | 455 | @if $height < $minimum-height-for-filled-label {
|
453 |
| - // Filled text fields must be tall enough to display a label |
454 |
| - &:not(.mdc-text-field--outlined):not(.mdc-text-field--textarea) { |
455 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
| 456 | + @include center-aligned_($query: $query); |
| 457 | + |
| 458 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 459 | + &:not(.mdc-text-field--outlined) { |
456 | 460 | .mdc-floating-label {
|
457 | 461 | display: none;
|
458 | 462 | }
|
459 | 463 | }
|
460 |
| - |
461 |
| - .mdc-text-field__input { |
462 |
| - @include input-no-label-padding_($query: $query); |
463 |
| - } |
464 | 464 | }
|
465 | 465 | }
|
| 466 | + |
| 467 | + // Outlined and no-label variants are always centered |
| 468 | + &.mdc-text-field--outlined, |
| 469 | + &.mdc-text-field--fullwidth, |
| 470 | + &.mdc-text-field--textarea, |
| 471 | + &.mdc-text-field--no-label { |
| 472 | + @include center-aligned_($query: $query); |
| 473 | + } |
466 | 474 | }
|
467 | 475 |
|
468 | 476 | ///
|
|
482 | 490 | }
|
483 | 491 |
|
484 | 492 | @include floating-label-mixins.shake-animation($keyframe-suffix, $query: $query);
|
485 |
| - @include height($height, $query: $query); |
| 493 | + // Avoid unnecessary rules for filled variant since this is outlined |
| 494 | + @include height($height, $minimum-height-for-filled-label: 0, $query: $query); |
486 | 495 | }
|
487 | 496 |
|
488 | 497 | ///
|
|
525 | 534 | @include rtl-mixins.rtl {
|
526 | 535 | @include floating-label-mixins.shake-animation($keyframe-suffix, $query: $query);
|
527 | 536 | }
|
528 |
| - |
529 |
| - @include height($height, $query: $query); |
| 537 | + // Avoid unnecessary rules for filled variant since this is outlined |
| 538 | + @include height($height, $minimum-height-for-filled-label: 0, $query: $query); |
530 | 539 | }
|
531 | 540 |
|
532 | 541 | ///
|
|
743 | 752 |
|
744 | 753 | // Baseline
|
745 | 754 |
|
746 |
| -@mixin input-padding_($query: feature-targeting-functions.all()) { |
| 755 | +// Removes filled baseline alignment |
| 756 | +@mixin center-aligned_($query: feature-targeting-functions.all()) { |
747 | 757 | $feat-structure: feature-targeting-functions.create-target($query, structure);
|
748 | 758 |
|
749 | 759 | @include feature-targeting-mixins.targets($feat-structure) {
|
750 |
| - padding: |
751 |
| - variables.$input-padding-top |
752 |
| - variables.$input-padding |
753 |
| - variables.$input-padding-bottom + variables.$input-border-bottom; |
754 |
| - } |
755 |
| -} |
| 760 | + align-items: center; |
756 | 761 |
|
757 |
| -@mixin input-no-label-padding_($query: feature-targeting-functions.all()) { |
758 |
| - $feat-structure: feature-targeting-functions.create-target($query, structure); |
759 |
| - |
760 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
761 |
| - padding-top: 0; |
762 |
| - padding-bottom: variables.$input-border-bottom; |
| 762 | + // Remove baseline-top pseudo element |
| 763 | + &::before { |
| 764 | + display: none; |
| 765 | + } |
763 | 766 | }
|
764 | 767 | }
|
765 | 768 |
|
|
900 | 903 | }
|
901 | 904 |
|
902 | 905 | @if ($resolved-radius > notched-outline-variables.$leading-width) {
|
903 |
| - .mdc-text-field__input { |
904 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
905 |
| - @include rtl-mixins.reflexive-property(padding, $resolved-radius + notched-outline-variables.$padding, 0); |
906 |
| - } |
| 906 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 907 | + @include rtl-mixins.reflexive-property(padding, $resolved-radius + notched-outline-variables.$padding, 0); |
907 | 908 | }
|
908 | 909 |
|
909 | 910 | + .mdc-text-field-helper-line {
|
|
1038 | 1039 | }
|
1039 | 1040 |
|
1040 | 1041 | .mdc-text-field__input {
|
1041 |
| - @include outlined-input-padding_($query: $query); |
1042 | 1042 | @include feature-targeting-mixins.targets($feat-structure) {
|
1043 | 1043 | display: flex;
|
1044 | 1044 | border: none !important; // FF adds unwanted border in HC mode on windows.
|
|
1058 | 1058 | }
|
1059 | 1059 | }
|
1060 | 1060 |
|
1061 |
| -@mixin outlined-input-padding_($query: feature-targeting-functions.all()) { |
1062 |
| - $feat-structure: feature-targeting-functions.create-target($query, structure); |
1063 |
| - |
1064 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1065 |
| - padding-top: variables.$outlined-input-padding-top; |
1066 |
| - padding-bottom: variables.$outlined-input-padding-bottom; |
1067 |
| - } |
1068 |
| -} |
1069 |
| - |
1070 | 1061 | @mixin hover-outline-color_($color, $query: feature-targeting-functions.all()) {
|
1071 | 1062 | &:not(.mdc-text-field--focused):hover {
|
1072 | 1063 | .mdc-notched-outline {
|
|
1088 | 1079 |
|
1089 | 1080 | @include icon-mixins.leading-icon-horizontal-position_(icon-variables.$icon-position, $query: $query);
|
1090 | 1081 |
|
1091 |
| - .mdc-text-field__input { |
1092 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1093 |
| - @include rtl-mixins.reflexive-property(padding, icon-variables.$icon-padding, variables.$input-padding); |
1094 |
| - } |
| 1082 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 1083 | + @include rtl-mixins.reflexive-property(padding, icon-variables.$icon-padding, variables.$padding-horizontal); |
1095 | 1084 | }
|
1096 | 1085 |
|
1097 | 1086 | .mdc-floating-label {
|
|
1106 | 1095 |
|
1107 | 1096 | @include icon-mixins.leading-icon-horizontal-position_(icon-variables.$dense-icon-position, $query: $query);
|
1108 | 1097 |
|
1109 |
| - .mdc-text-field__input { |
1110 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1111 |
| - @include rtl-mixins.reflexive-property(padding, icon-variables.$dense-icon-padding, variables.$input-padding); |
1112 |
| - } |
| 1098 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 1099 | + @include rtl-mixins.reflexive-property(padding, icon-variables.$dense-icon-padding, variables.$padding-horizontal); |
1113 | 1100 | }
|
1114 | 1101 |
|
1115 | 1102 | .mdc-floating-label {
|
|
1168 | 1155 |
|
1169 | 1156 | @include icon-mixins.trailing-icon-horizontal-position_(icon-variables.$trailing-icon-position, $query: $query);
|
1170 | 1157 |
|
1171 |
| - .mdc-text-field__input { |
1172 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1173 |
| - @include rtl-mixins.reflexive-property(padding, variables.$input-padding, icon-variables.$icon-padding); |
1174 |
| - } |
| 1158 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 1159 | + @include rtl-mixins.reflexive-property(padding, variables.$padding-horizontal, icon-variables.$icon-padding); |
1175 | 1160 | }
|
1176 | 1161 | }
|
1177 | 1162 |
|
|
1180 | 1165 |
|
1181 | 1166 | @include icon-mixins.trailing-icon-horizontal-position_(icon-variables.$dense-icon-position, $query: $query);
|
1182 | 1167 |
|
1183 |
| - .mdc-text-field__input { |
1184 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1185 |
| - @include rtl-mixins.reflexive-property(padding, variables.$input-padding, icon-variables.$dense-icon-padding); |
1186 |
| - } |
| 1168 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 1169 | + @include rtl-mixins.reflexive-property(padding, variables.$padding-horizontal, icon-variables.$dense-icon-padding); |
1187 | 1170 | }
|
1188 | 1171 | }
|
1189 | 1172 |
|
|
1196 | 1179 | $query: $query
|
1197 | 1180 | );
|
1198 | 1181 |
|
1199 |
| - .mdc-text-field__input { |
1200 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1201 |
| - padding-right: icon-variables.$icon-padding; |
1202 |
| - padding-left: icon-variables.$icon-padding; |
1203 |
| - } |
| 1182 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 1183 | + padding-right: icon-variables.$icon-padding; |
| 1184 | + padding-left: icon-variables.$icon-padding; |
1204 | 1185 | }
|
1205 | 1186 | }
|
1206 | 1187 |
|
|
1213 | 1194 | $query: $query
|
1214 | 1195 | );
|
1215 | 1196 |
|
1216 |
| - .mdc-text-field__input { |
1217 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1218 |
| - padding-right: icon-variables.$dense-icon-padding; |
1219 |
| - padding-left: icon-variables.$dense-icon-padding; |
1220 |
| - } |
| 1197 | + @include feature-targeting-mixins.targets($feat-structure) { |
| 1198 | + padding-right: icon-variables.$dense-icon-padding; |
| 1199 | + padding-left: icon-variables.$dense-icon-padding; |
1221 | 1200 | }
|
1222 | 1201 | }
|
1223 | 1202 |
|
|
1229 | 1208 | @include disabled-bottom-line-color(variables.$bottom-line-idle, $query: $query);
|
1230 | 1209 |
|
1231 | 1210 | @include feature-targeting-mixins.targets($feat-structure) {
|
| 1211 | + padding: 0; |
1232 | 1212 | width: 100%;
|
1233 | 1213 | }
|
1234 | 1214 |
|
|
1237 | 1217 | @include fill-color(transparent, $query: $query);
|
1238 | 1218 |
|
1239 | 1219 | @include feature-targeting-mixins.targets($feat-structure) {
|
1240 |
| - display: block; |
1241 |
| - } |
1242 |
| - |
1243 |
| - .mdc-text-field__input { |
1244 |
| - @include feature-targeting-mixins.targets($feat-structure) { |
1245 |
| - padding: 0 0 variables.$input-border-bottom; |
1246 |
| - } |
| 1220 | + display: flex; |
1247 | 1221 | }
|
1248 | 1222 | }
|
1249 | 1223 |
|
|
1283 | 1257 | @include notched-outline-mixins.floating-label-float-position(variables.$textarea-label-position-y, $query: $query);
|
1284 | 1258 | @include character-counter-mixins.character-counter-position(16px, 13px, $query: $query);
|
1285 | 1259 |
|
1286 |
| - $padding-inset: 16px; |
1287 | 1260 | $feat-structure: feature-targeting-functions.create-target($query, structure);
|
1288 | 1261 | $feat-animation: feature-targeting-functions.create-target($query, animation);
|
1289 | 1262 | $feat-typography: feature-targeting-functions.create-target($query, typography);
|
|
1292 | 1265 | display: inline-flex;
|
1293 | 1266 | width: auto;
|
1294 | 1267 | height: auto;
|
| 1268 | + padding: 0; // see below for explanation |
1295 | 1269 | overflow: visible;
|
1296 | 1270 | }
|
1297 | 1271 |
|
|
1301 | 1275 |
|
1302 | 1276 | .mdc-text-field__input {
|
1303 | 1277 | @include feature-targeting-mixins.targets($feat-structure) {
|
1304 |
| - align-self: auto; |
| 1278 | + align-self: stretch; |
1305 | 1279 | box-sizing: border-box;
|
1306 | 1280 | height: auto;
|
1307 |
| - margin: $padding-inset / 2 1px 1px 0; |
1308 |
| - padding: 0 $padding-inset $padding-inset; |
| 1281 | + // Top margin is used to keep the text from overlapping the floating label |
| 1282 | + // when scrolling |
| 1283 | + margin-top: variables.$textarea-input-margin-top; |
| 1284 | + // Bottom and left/right margins are used to add space for the resize handle |
| 1285 | + margin-bottom: variables.$textarea-input-handle-margin; |
| 1286 | + @include rtl-mixins.reflexive-box(margin, right, variables.$textarea-input-handle-margin); |
| 1287 | + // Textarea has horizontal padding instead of the container. This allows the |
| 1288 | + // resize handle to extend to the edge of the container. |
| 1289 | + padding: 0 variables.$padding-horizontal variables.$textarea-input-padding-bottom; |
1309 | 1290 | }
|
1310 | 1291 |
|
1311 | 1292 | @include feature-targeting-mixins.targets($feat-typography) {
|
|
0 commit comments