@@ -4,6 +4,7 @@ $input-label-default-offset: 24px !default;
44$input-label-default-scale : 1.0 !default ;
55$input-label-float-offset : 8px !default ;
66$input-label-float-scale : 0.75 !default ;
7+ $input-label-float-width : $input-container-padding + 16px ;
78
89$input-placeholder-offset : $input-label-default-offset !default ;
910
@@ -95,6 +96,10 @@ md-input-container {
9596
9697 label :not (.md-no-float ):not (.md-container-ignore ),
9798 .md-placeholder {
99+ overflow : hidden ;
100+ text-overflow : ellipsis ;
101+ white-space : nowrap ;
102+ width : 100% ;
98103 order : 1 ;
99104 pointer-events : none ;
100105 -webkit-font-smoothing : antialiased ;
@@ -262,6 +267,9 @@ md-input-container {
262267 & .md-input-has-value {
263268 label :not (.md-no-float ) {
264269 transform : translate3d (0 , $input-label-float-offset , 0 ) scale ($input-label-float-scale );
270+ transition : transform $swift-ease-out-timing-function 0.5s ,
271+ width $swift-ease-out-timing-function 0.5s ;
272+ width : calc ((100% - #{$input-label-float-width } ) / #{$input-label-float-scale } );
265273 }
266274 }
267275
@@ -307,15 +315,27 @@ md-input-container {
307315 @include rtl (right , auto , 2px );
308316 }
309317
310- & .md-input-focused ,
311- & .md-input-has-value {
318+ }
312319
313- label {
314- transform : translate3d (0 , $input-label-float-offset , 0 ) scale ($input-label-float-scale );
315- transition : transform $swift-ease-out-timing-function 0.5s ;
320+ & .md-icon-left ,
321+ & .md-icon-right {
322+ > label {
323+ & :not (.md-no-float ):not (.md-container-ignore ),
324+ .md-placeholder {
325+ width : calc (100% - #{$icon-offset } - #{$input-label-float-width } );
316326 }
317327 }
318328
329+ & .md-input-focused ,
330+ & .md-input-has-placeholder ,
331+ & .md-input-has-value {
332+ > label {
333+ & :not (.md-no-float ):not (.md-container-ignore ),
334+ .md-placeholder {
335+ width : calc ((100% - #{$icon-offset } - #{$input-label-float-width } ) / #{$input-label-float-scale } );
336+ }
337+ }
338+ }
319339 }
320340
321341 // icon offset should have higher priority as normal label
@@ -343,6 +363,24 @@ md-input-container {
343363 & .md-icon-left.md-icon-right {
344364 padding-left : $icon-offset ;
345365 padding-right : $icon-offset ;
366+
367+ > label {
368+ & :not (.md-no-float ):not (.md-container-ignore ),
369+ .md-placeholder {
370+ width : calc (100% - (#{$icon-offset } * 2 ));
371+ }
372+ }
373+
374+ & .md-input-focused ,
375+ & .md-input-has-placeholder ,
376+ & .md-input-has-value {
377+ > label {
378+ & :not (.md-no-float ):not (.md-container-ignore ),
379+ .md-placeholder {
380+ width : calc ((100% - (#{$icon-offset } * 2 )) / #{$input-label-float-scale } );
381+ }
382+ }
383+ }
346384 }
347385}
348386
0 commit comments