|
4 | 4 |
|
5 | 5 |
|
6 | 6 | $mat-input-floating-placeholder-scale-factor: 0.75 !default; |
| 7 | +$mat-input-wrapper-spacing: 1em !default; |
7 | 8 |
|
8 | 9 | // Gradient for showing the dashed line when the input is disabled. |
9 | 10 | $mat-input-underline-disabled-background-image: |
@@ -41,7 +42,7 @@ $mat-input-underline-disabled-background-image: |
41 | 42 | // Global wrapper. We need to apply margin to the element for spacing, but |
42 | 43 | // cannot apply it to the host element directly. |
43 | 44 | .mat-input-wrapper { |
44 | | - margin: 1em 0; |
| 45 | + margin: $mat-input-wrapper-spacing 0; |
45 | 46 | // Account for the underline which has 4px of margin + 2px of border. |
46 | 47 | padding-bottom: 6px; |
47 | 48 | } |
@@ -219,29 +220,57 @@ $mat-input-underline-disabled-background-image: |
219 | 220 | } |
220 | 221 | } |
221 | 222 |
|
222 | | -// The hint is shown below the underline. There can be more than one; one at the start |
223 | | -// and one at the end. |
224 | | -.mat-hint { |
225 | | - display: block; |
| 223 | +// Wrapper for the hints and error messages. Provides positioning and text size. |
| 224 | +// Note that we're using `top` in order to allow for stacked children to flow downwards. |
| 225 | +.mat-input-subscript-wrapper { |
226 | 226 | position: absolute; |
227 | 227 | font-size: 75%; |
228 | | - bottom: 0; |
| 228 | + top: 100%; |
| 229 | + width: 100%; |
| 230 | + margin-top: -$mat-input-wrapper-spacing; |
| 231 | + overflow: hidden; // prevents multi-line errors from overlapping the input |
| 232 | +} |
| 233 | + |
| 234 | +// Clears the floats on the hints. This is necessary for the hint animation to work. |
| 235 | +.mat-input-hint-wrapper { |
| 236 | + &::before, |
| 237 | + &::after { |
| 238 | + content: ' '; |
| 239 | + display: table; |
| 240 | + } |
| 241 | + |
| 242 | + &::after { |
| 243 | + clear: both; |
| 244 | + } |
| 245 | +} |
229 | 246 |
|
| 247 | +// The hint is shown below the underline. There can be |
| 248 | +// more than one; one at the start and one at the end. |
| 249 | +.mat-hint { |
| 250 | + display: block; |
| 251 | + float: left; |
| 252 | + |
| 253 | + // We use floats here, as opposed to flexbox, in order to make it |
| 254 | + // easier to reverse their location in rtl and to ensure that they're |
| 255 | + // aligned properly in some cases (e.g. when there is only an `end` hint). |
230 | 256 | &.mat-right { |
231 | | - right: 0; |
| 257 | + float: right; |
232 | 258 | } |
233 | 259 |
|
234 | 260 | [dir='rtl'] & { |
235 | | - right: 0; |
236 | | - left: auto; |
| 261 | + float: right; |
237 | 262 |
|
238 | 263 | &.mat-right { |
239 | | - right: auto; |
240 | | - left: 0; |
| 264 | + float: left; |
241 | 265 | } |
242 | 266 | } |
243 | 267 | } |
244 | 268 |
|
| 269 | +// Single error message displayed beneath the input. |
| 270 | +.mat-input-error { |
| 271 | + display: block; |
| 272 | +} |
| 273 | + |
245 | 274 | .mat-input-prefix, .mat-input-suffix { |
246 | 275 | // Prevents the prefix and suffix from stretching together with the container. |
247 | 276 | width: 0.1px; |
|
0 commit comments