@@ -12,25 +12,66 @@ $input-inline-padding: rem(4px);
1212$input-top-spacing : rem (20px );
1313$input-bottom-spacing : rem (6px );
1414
15- // TODO: Talk to simo about this
1615@layer ig.material {
1716 @container style (--ig-theme : material) {
1817 %box-floating-label {
19- transform : translateY (rem (-12px ));
18+ @include type-style (caption );
19+
20+ translate : 0 rem (-12px );
2021 }
2122
2223 %box-floating-text-area-label {
23- transform : translateY (0 );
24+ @include type-style (caption );
25+
26+ translate : 0 ;
2427 inset-block-start : calc (var (--_input-top-spacing ) / 4 );
2528 }
2629
2730 %border-textarea-floating-label {
31+ @include type-style (caption );
32+
2833 display : inline-block ;
29- transform-origin : left top ;
3034 position : relative ;
3135 inset-block : 0 ;
32- transform : translateY (-50% );
33- margin-block-end : auto ;
36+ }
37+ }
38+
39+ .igx-input-group--base :not (.igx-input-group--filled , .igx-input-group--focused ) {
40+ & :has (input :placeholder-shown ) {
41+ .igx-input-group__label {
42+ @extend %box-floating-label ;
43+ }
44+ }
45+
46+ & :has (textarea :placeholder-shown ) {
47+ .igx-input-group__label {
48+ @extend %box-floating-text-area-label ;
49+ }
50+ }
51+ }
52+
53+ .igx-input-group--border :not (.igx-input-group--filled , .igx-input-group--focused ) {
54+ & :has (input :placeholder-shown ) {
55+ .igx-input-group__label {
56+ @include type-style (caption );
57+ }
58+ }
59+
60+ & :has (textarea :placeholder-shown ) {
61+ .igx-input-group__label {
62+ @extend %border-textarea-floating-label ;
63+ }
64+ }
65+
66+ & :has (input :placeholder-shown , textarea :placeholder-shown ) {
67+ .igx-input-group__label {
68+ align-self : start ;
69+ translate : 0 var (--_label-translate-top );
70+ }
71+
72+ .igx-input-group__notch {
73+ border-block-start-color : transparent ;
74+ }
3475 }
3576 }
3677}
@@ -83,18 +124,10 @@ $input-bottom-spacing: rem(6px);
83124 grid-row : var (--_hint-row );
84125 }
85126
86-
87- @include m (focused) {
88- @include e (label ) {
89- @include type-style (caption );
90- }
91- }
92-
93127 @include m (base) {
94128 %input-paddings {
95129 padding-block-start : var (--_input-top-spacing );
96130 padding-block-end : var (--_input-bottom-spacing );
97-
98131 }
99132
100133 @include e (bundle) {
@@ -228,12 +261,6 @@ $input-bottom-spacing: rem(6px);
228261 }
229262 }
230263
231- @include mx (base, placeholder) {
232- @include e (label ) {
233- @extend %box-floating-label ;
234- }
235- }
236-
237264 @include mx (base, filled ) {
238265 @include e (label ) {
239266 @extend %box-floating-label ;
@@ -300,18 +327,21 @@ $input-bottom-spacing: rem(6px);
300327
301328 @include m (textarea- group) {
302329 --_bundle-template-rows : auto ;
303- }
304330
305- @include mx (base, textarea- group) {
306- @include e (label ) {
307- top : var (--_input-top-spacing );
308- margin-block-end : auto ;
331+ @include e (bundle- main) {
332+ padding-block-start : $input-top-spacing ;
333+ }
334+
335+ @include e (textarea) {
336+ // This gives the drag handle some room from the field bottom border
337+ border-bottom : rem (2px ) solid transparent ;
309338 }
310339 }
311340
312- @include mx (base, textarea- group, placeholder ) {
341+ @include mx (base, textarea- group) {
313342 @include e (label ) {
314- @extend %box-floating-text-area-label ;
343+ top : var (--_input-top-spacing );
344+ align-self : start ;
315345 }
316346 }
317347
@@ -421,18 +451,18 @@ $input-bottom-spacing: rem(6px);
421451 @include mx (border , textarea- group) {
422452 @include e (label ) {
423453 top : var (--_input-top-spacing );
424- margin-block-end : auto ;
425- transform-origin : top left ;
426454 transition :
427- transform 150ms cubic-bezier (.4 , 0 , .2 , 1 ),
455+ translate 150ms cubic-bezier (.4 , 0 , .2 , 1 ),
428456 color 150ms cubic-bezier (.4 , 0 , .2 , 1 ),
429457 font-size 150ms cubic-bezier (.4 , 0 , .2 , 1 );
430- will-change : transform ;
458+ will-change : translate ;
459+ align-self : start ;
431460 }
432461
433- @include e (textarea) {
434- margin-block-start : $input-top-spacing ;
435- }
462+ // @include e(textarea) {
463+ // margin-block-start: $input-top-spacing;
464+ // bottom: rem(2px);
465+ // }
436466 }
437467
438468 @include mx (border , textarea- group, filled ) {
@@ -445,16 +475,6 @@ $input-bottom-spacing: rem(6px);
445475 @include e (label ) {
446476 @extend %border-textarea-floating-label ;
447477 }
448-
449- @include e (notch) {
450- border-block-start-width : rem (1px );
451- }
452- }
453-
454- @include mx (border , textarea- group, placeholder) {
455- @include e (label ) {
456- @extend %border-textarea-floating-label ;
457- }
458478 }
459479
460480 @include mx (base, file) {
@@ -472,16 +492,16 @@ $input-bottom-spacing: rem(6px);
472492 }
473493
474494 @include m (border ) {
475- --_label- position : #{ sizable ( 18 px , 22 px , 26 px )} ;
495+ $label- position : calc (( var-get ( $_theme , ' size ' ) / 2 ) - ( var ( --_input-border-size ) / 2 )) ;
476496 --_bundle-template-columns : auto auto 1fr auto ;
477497 --_input-border-size : #{rem (1px )} ;
478498 --_input-border-style : solid ;
479- --_label-translate-top : calc ( var ( --_label-position ) * -1 ) ;
499+ --_label-translate-top : -50 % ;
480500
481501 $border-size : rem (1px );
482502
483503 %idle-border-styles {
484- border-width : var (--_input-border-size );
504+ border-width : var (--_input-border-size-focus , var ( --_input-border-size ) );
485505 border-style : var (--_input-border-style );
486506 border-color : var-get ($_theme , ' border-color' );
487507 }
@@ -492,7 +512,7 @@ $input-bottom-spacing: rem(6px);
492512 border-radius : var-get ($_theme , ' border-border-radius' );
493513 }
494514
495- @include e (inut ) {
515+ @include e (input ) {
496516 width : 100% ;
497517 height : 100% ;
498518 padding : 0 ;
@@ -574,12 +594,11 @@ $input-bottom-spacing: rem(6px);
574594 }
575595
576596 @include mx (border , focused) {
577- --_input-border-size : #{rem (2 px )} ;
597+ --_input-border-size-focus : calc ( var ( --_input-border-size ) + #{rem (1 px )} ) ;
578598
579- $negative-margin : calc ((var (--_input-border-size ) / 2 ) * -1 );
599+ $negative-margin : calc ((var (--_input-border-size-focus ) / 2 ) * -1 );
580600
581601 @include e (label ) {
582- transform : translateY (var (--_label-translate-top ));
583602 color : var-get ($_theme , ' focused-secondary-color' );
584603 }
585604
@@ -588,7 +607,10 @@ $input-bottom-spacing: rem(6px);
588607
589608 & :has (igx-prefix ),
590609 & :has ([igxPrefix ]) {
591- margin-inline-start : $negative-margin ;
610+ igx-prefix :first-child ,
611+ [igxPrefix ]:first-child {
612+ margin-inline-start : $negative-margin ;
613+ }
592614 }
593615 }
594616
@@ -597,13 +619,17 @@ $input-bottom-spacing: rem(6px);
597619
598620 & :has (igx-suffix ),
599621 & :has ([igxSuffix ]) {
600- margin-inline-end : $negative-margin ;
622+ igx-suffix :last-child ,
623+ [igxSuffix ]:last-child {
624+ margin-inline-end : $negative-margin ;
625+ }
601626 }
602627 }
603628
604629 @include e (notch) {
605630 border-color : var-get ($_theme , ' focused-border-color' );
606631 border-block-start-color : transparent ;
632+ border-block-start-width : rem (1px );
607633 }
608634
609635 @include e (filler) {
@@ -615,17 +641,17 @@ $input-bottom-spacing: rem(6px);
615641 }
616642 }
617643
618- @include mx (border , focused, ( ' not ' : (placeholder, textarea - group)) ) {
644+ @include mx (border , focused) {
619645 @include e (label ) {
620- transform : translateY (var (--_label-translate-top ));
646+ translate : 0 var (--_label-translate-top );
647+ align-self : start ;
621648 }
622649 }
623650
624- @include mx (border , filled , (' not' : (placeholder, textarea - group ))) {
651+ @include mx (border , filled , (' not' : (focused ))) {
625652 @include e (label ) {
626- @include type-style (caption );
627-
628- transform : translateY (var (--_label-translate-top ));
653+ translate : 0 var (--_label-translate-top );
654+ align-self : start ;
629655 }
630656 }
631657
@@ -635,16 +661,6 @@ $input-bottom-spacing: rem(6px);
635661 }
636662 }
637663
638- @include mx (border , placeholder, (' not' : (focused))) {
639- @include e (label ) {
640- transform : translateY (var (--_label-translate-top ));
641- }
642-
643- @include e (notch) {
644- border-block-start-color : transparent ;
645- }
646- }
647-
648664 @include mx (border , valid) {
649665 @include e (bundle- start) {
650666 border-color : var-get ($_theme , ' success-secondary-color' );
@@ -741,17 +757,23 @@ $input-bottom-spacing: rem(6px);
741757 }
742758 }
743759
744- @include mx (border , file) {
745- --_bundle-template-columns : auto auto auto 1fr auto ;
746-
760+ @include mx (border , file, (' not' : (focused))) {
747761 @include e (label ) {
748762 @include type-style (caption );
749763
750- transform : translateY (var (--_label-translate-top ));
764+ translate : 0 var (--_label-translate-top );
765+ align-self : start ;
751766 }
752767
753768 @include e (notch) {
754769 border-block-start-color : transparent ;
770+ }
771+ }
772+
773+ @include mx (border , file) {
774+ --_bundle-template-columns : auto auto auto 1fr auto ;
775+
776+ @include e (notch) {
755777 grid-column : 3
756778 }
757779
@@ -854,7 +876,7 @@ $input-bottom-spacing: rem(6px);
854876 @include e (label ) {
855877 @include type-style (subtitle- 1);
856878
857- will-change : font-size , color , transform ;
879+ will-change : font-size , color , translate ;
858880 transition : all $transition-timing ;
859881 pointer-events : none ;
860882 }
@@ -865,8 +887,6 @@ $input-bottom-spacing: rem(6px);
865887
866888 @include e (textarea) {
867889 @include type-style (subtitle- 1);
868-
869- margin-block-start : $input-top-spacing ;
870890 }
871891
872892 @include m (filled ) {
@@ -881,12 +901,6 @@ $input-bottom-spacing: rem(6px);
881901 }
882902 }
883903
884- @include m (placeholder, $not : (focused, file)) {
885- @include e (label ) {
886- @include type-style (caption );
887- }
888- }
889-
890904 @include m (file, $not : (focused)) {
891905 @include e (label ) {
892906 @include type-style (caption );
0 commit comments