5
5
6
6
// Min amount of space between start and end hint.
7
7
$mat-input-hint-min-space : 1em !default ;
8
- // The amount of additional line space beyond 1em on the input (1/2 below, 1/2 above).
9
- $mat-input-line-spacing : 0.125 !default ;
10
8
// The height of the underline.
11
9
$mat-input-underline-height : 1px !default ;
12
- // The amount to scale the font for the floating label and subscript.
13
- $mat-input-subscript-font-scale : 0.75 !default ;
14
- // The amount to scale the font for the prefix and suffix icons.
15
- $mat-input-prefix-suffix-icon-font-scale : 1.5 !default ;
16
-
17
- // The line-height for all text in the md-input-container
18
- $mat-input-line-height : 1 + $mat-input-line-spacing ;
19
- // The padding on the infix. Mocks show half of the text size, but seem to measure from the edge of
20
- // the text itself, not the edge of the line; therefore we subtract off 1/2 of the line spacing.
21
- $mat-input-infix-padding : 0.5em - $mat-input-line-spacing / 2 ;
22
- // 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-subscript-font-scale ;
24
- // Font size to use for the label and subscript text.
25
- $mat-input-subscript-font-size : $mat-input-subscript-font-scale * 100% ;
26
- // Font size to use for the for the prefix and suffix icons.
27
- $mat-input-prefix-suffix-icon-font-size : $mat-input-prefix-suffix-icon-font-scale * 100% ;
28
- // 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 subscript text font size, so we
30
- // need to divide by the scale factor to make it half of the original text size. We again need to
31
- // subtract off 1/2 of the line spacing since the mocks measure to the edge of the text, not the
32
- // edge of the line.
33
- $mat-input-subscript-margin-top :
34
- 0.5em / $mat-input-subscript-font-scale - $mat-input-line-spacing / 2 ;
35
- // The padding applied to the input-wrapper to reserve space for the subscript, since it's
36
- // absolutely positioned. This is a combination of the subscript's margin and line-height, but we
37
- // need to multiply by the subscript font scale factor since the wrapper has a larger font size.
38
- $mat-input-wrapper-padding-bottom :
39
- ($mat-input-subscript-margin-top + $mat-input-line-height ) * $mat-input-subscript-font-scale ;
40
-
41
-
42
- // Applies a floating placeholder above the input itself.
43
- @mixin mat-input-placeholder-floating {
44
- display : block ;
45
-
46
- transform : translateY (- $mat-input-infix-margin-top - $mat-input-infix-padding )
47
- scale ($mat-input-subscript-font-scale )
48
- // We use perspecitve to fix the text blurriness as described here:
49
- // http://www.useragentman.com/blog/2014/05/04/fixing-typography-inside-of-2-d-css-transforms/
50
- // This results in a small jitter after the label floats on Firefox, which the
51
- // translateZ fixes.
52
- perspective (1px ) translateZ (0.001px );
53
- // The tricks above used to smooth out the animation on chrome and firefox actually make things
54
- // worse on IE, so we don't include them in the IE version.
55
- -ms-transform : translateY (- $mat-input-infix-margin-top - $mat-input-infix-padding )
56
- scale ($mat-input-subscript-font-scale );
57
-
58
- width : 100% / $mat-input-subscript-font-scale ;
59
- }
60
10
61
11
62
12
.mat-input-container {
63
13
display : inline-block ;
64
14
position : relative ;
65
- font-family : $mat-font-family ;
66
-
67
- // TODO(mmalerba): should this come from typography settings? If so a lot of this CSS needs to go
68
- // into some sort of typography mixin.
69
- line-height : $mat-input-line-height ;
70
15
71
16
// To avoid problems with text-align.
72
17
text-align : left ;
@@ -80,7 +25,6 @@ $mat-input-wrapper-padding-bottom:
80
25
// cannot apply it to the host element directly.
81
26
.mat-input-wrapper {
82
27
position : relative ;
83
- padding-bottom : $mat-input-wrapper-padding-bottom ;
84
28
}
85
29
86
30
// We use a flex layout to baseline align the prefix and suffix elements.
@@ -101,21 +45,16 @@ $mat-input-wrapper-padding-bottom:
101
45
.mat-datepicker-toggle {
102
46
width : 1em ;
103
47
height : 1em ;
104
- font-size : $mat-input-prefix-suffix-icon-font-size ;
105
48
vertical-align : text-bottom ;
106
49
}
107
50
108
51
// Allow icon buttons in a prefix or suffix to adapt to the correct size.
109
52
.mat-icon-button {
110
- font-size : inherit ;
111
- line-height : $mat-input-line-height ;
112
- height : $mat-input-prefix-suffix-icon-font-scale * 1em ;
113
- width : $mat-input-prefix-suffix-icon-font-scale * 1em ;
53
+ font : inherit ;
114
54
vertical-align : baseline ;
115
55
116
56
.mat-icon {
117
57
font-size : inherit ;
118
- line-height : $mat-input-prefix-suffix-icon-font-scale ;
119
58
width : 1em ;
120
59
height : 1em ;
121
60
vertical-align : baseline ;
@@ -126,9 +65,6 @@ $mat-input-wrapper-padding-bottom:
126
65
.mat-input-infix {
127
66
display : block ;
128
67
position : relative ;
129
- padding : $mat-input-infix-padding 0 ;
130
- // Throws off the baseline if we do it as a real margin, so we do it as a border instead.
131
- border-top : $mat-input-infix-margin-top solid transparent ;
132
68
flex : auto ;
133
69
}
134
70
@@ -173,7 +109,6 @@ $mat-input-wrapper-padding-bottom:
173
109
// classes take over to fulfill this behaviour.
174
110
// Assumes the autofill is non-empty.
175
111
& :-webkit-autofill + .mat-input-placeholder-wrapper .mat-float {
176
- @include mat-input-placeholder-floating ;
177
112
transition : none ;
178
113
}
179
114
@@ -192,11 +127,9 @@ $mat-input-wrapper-padding-bottom:
192
127
.mat-input-placeholder-wrapper {
193
128
position : absolute ;
194
129
left : 0 ;
195
- top : - $mat-input-infix-margin-top ;
196
130
box-sizing : content-box ;
197
131
width : 100% ;
198
132
height : 100% ;
199
- padding-top : $mat-input-infix-margin-top ;
200
133
overflow : hidden ;
201
134
pointer-events : none ; // We shouldn't catch mouse events (let them through).
202
135
}
@@ -209,8 +142,8 @@ $mat-input-wrapper-padding-bottom:
209
142
// infix <div>.
210
143
position : absolute ;
211
144
left : 0 ;
212
- top : $mat-input-infix-margin-top + $mat-input-infix-padding ;
213
145
146
+ font : inherit ;
214
147
pointer-events : none ; // We shouldn't catch mouse events (let them through).
215
148
216
149
// Put ellipsis text overflow.
@@ -221,7 +154,7 @@ $mat-input-wrapper-padding-bottom:
221
154
overflow : hidden ;
222
155
223
156
// The perspective helps smooth out animations on Chrome and Firefox but isn't needed on IE.
224
- transform : perspective (1 px );
157
+ transform : perspective (100 px );
225
158
-ms-transform : none ;
226
159
227
160
transform-origin : 0 0 ;
@@ -230,15 +163,9 @@ $mat-input-wrapper-padding-bottom:
230
163
width $swift-ease-out-duration $swift-ease-out-timing-function ;
231
164
232
165
& .mat-empty {
233
- display : block ;
234
166
cursor : text ;
235
167
}
236
168
237
- // Show the placeholder above the input when it's not empty, or focused.
238
- & .mat-float :not (.mat-empty ), .mat-focused & .mat-float {
239
- @include mat-input-placeholder-floating ;
240
- }
241
-
242
169
[dir = ' rtl' ] & {
243
170
transform-origin : 100% 0 ;
244
171
left : auto ;
@@ -259,10 +186,6 @@ $mat-input-wrapper-padding-bottom:
259
186
height : $mat-input-underline-height ;
260
187
width : 100% ;
261
188
262
- // We want the underline to start at the end of the content box, not the padding box,
263
- // so we move it up by the padding amount;
264
- bottom : $mat-input-wrapper-padding-bottom ;
265
-
266
189
& .mat-disabled {
267
190
@include mat-control-disabled-underline ();
268
191
background-position : 0 ;
@@ -293,14 +216,8 @@ $mat-input-wrapper-padding-bottom:
293
216
// Note that we're using `top` in order to allow for stacked children to flow downwards.
294
217
.mat-input-subscript-wrapper {
295
218
position : absolute ;
296
- font-size : $mat-input-subscript-font-size ;
297
- margin-top : $mat-input-subscript-margin-top ;
298
219
width : 100% ;
299
220
overflow : hidden ; // prevents multi-line errors from overlapping the input
300
-
301
- // We want the subscript to start at the end of the content box, not the padding box,
302
- // so we move it up by the padding amount (adjusted for the smaller font size);
303
- top : calc (100% - #{$mat-input-wrapper-padding-bottom / $mat-input-subscript-font-scale } );
304
221
}
305
222
306
223
// Scale down icons in the placeholder and hint to be the same size as the text.
0 commit comments