Skip to content

Commit 4f90093

Browse files
committed
address comments
1 parent a9d8b21 commit 4f90093

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

src/lib/input/input-container.scss

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $mat-input-line-spacing: 0.125 !default;
1010
// The height of the underline.
1111
$mat-input-underline-height: 1px !default;
1212
// The amount to scale the font for the floating label and subscript.
13-
$mat-input-helper-font-scale: 0.75 !default;
13+
$mat-input-subscript-font-scale: 0.75 !default;
1414
// The amount to scale the font for the prefix and suffix icons.
1515
$mat-input-prefix-suffix-icon-font-scale: 1.5 !default;
1616

@@ -20,33 +20,34 @@ $mat-input-line-height: 1 + $mat-input-line-spacing;
2020
// the text itself, not the edge of the line; therefore we subtract off 1/2 of the line spacing.
2121
$mat-input-infix-padding: 0.5em - $mat-input-line-spacing / 2;
2222
// The margin applied to the input-infix to reserve space for the floating label.
23-
$mat-input-infix-margin-top: 1em * $mat-input-line-height * $mat-input-helper-font-scale;
23+
$mat-input-infix-margin-top: 1em * $mat-input-line-height * $mat-input-subscript-font-scale;
2424
// Font size to use for the label and subscript text.
25-
$mat-input-helper-font-size: $mat-input-helper-font-scale * 100%;
25+
$mat-input-subscript-font-size: $mat-input-subscript-font-scale * 100%;
2626
// Font size to use for the for the prefix and suffix icons.
2727
$mat-input-prefix-suffix-icon-font-size: $mat-input-prefix-suffix-icon-font-scale * 100%;
2828
// The space between the bottom of the input table and the subscript container. Mocks show half of
29-
// the text size, but this margin is applied to an element with the helper text font size, so we
29+
// the text size, but this margin is applied to an element with the subscript text font size, so we
3030
// need to divide by the scale factor to make it half of the original text size. We again need to
3131
// subtract off 1/2 of the line spacing since the mocks measure to the edge of the text, not the
3232
// edge of the line.
33-
$mat-input-subscript-margin-top: 0.5em / $mat-input-helper-font-scale - $mat-input-line-spacing / 2;
33+
$mat-input-subscript-margin-top:
34+
0.5em / $mat-input-subscript-font-scale - $mat-input-line-spacing / 2;
3435
// The padding applied to the input-wrapper to reserve space for the subscript, since it's
3536
// absolutely positioned. This is a combination of the subscript's margin and line-height, but we
36-
// need to multiply by the helper font scale factor since the wrapper has a larger font size.
37+
// need to multiply by the subscript font scale factor since the wrapper has a larger font size.
3738
$mat-input-wrapper-padding-bottom:
38-
($mat-input-subscript-margin-top + $mat-input-line-height) * $mat-input-helper-font-scale;
39-
// The amount of y-offset to apply to the placeholder when it is floating.
40-
$mat-input-floating-placeholder-offset: -$mat-input-infix-padding - 1em;
39+
($mat-input-subscript-margin-top + $mat-input-line-height) * $mat-input-subscript-font-scale;
4140

4241

4342
// Applies a floating placeholder above the input itself.
4443
@mixin mat-input-placeholder-floating {
4544
display: block;
4645
transform: translateY(-$mat-input-infix-margin-top - $mat-input-infix-padding)
47-
perspective(1px) // fixes text blurriness.
48-
scale($mat-input-helper-font-scale);
49-
width: 100% / $mat-input-helper-font-scale;
46+
// fixes text blurriness, see
47+
// https://css-tricks.com/forums/topic/transforms-cause-font-smoothing-weirdness-in-webkit/
48+
perspective(1px)
49+
scale($mat-input-subscript-font-scale);
50+
width: 100% / $mat-input-subscript-font-scale;
5051
}
5152

5253

@@ -281,14 +282,14 @@ $mat-input-floating-placeholder-offset: -$mat-input-infix-padding - 1em;
281282
// Note that we're using `top` in order to allow for stacked children to flow downwards.
282283
.mat-input-subscript-wrapper {
283284
position: absolute;
284-
font-size: $mat-input-helper-font-size;
285+
font-size: $mat-input-subscript-font-size;
285286
margin-top: $mat-input-subscript-margin-top;
286287
width: 100%;
287288
overflow: hidden; // prevents multi-line errors from overlapping the input
288289

289290
// We want the subscript to start at the end of the content box, not the padding box,
290291
// so we move it up by the padding amount (adjusted for the smaller font size);
291-
top: calc(100% - #{$mat-input-wrapper-padding-bottom / $mat-input-helper-font-scale});
292+
top: calc(100% - #{$mat-input-wrapper-padding-bottom / $mat-input-subscript-font-scale});
292293
}
293294

294295
// Scale down icons in the placeholder and hint to be the same size as the text.

0 commit comments

Comments
 (0)