Skip to content

Commit f6e5f58

Browse files
committed
fix(input-group, textarea): label position
1 parent d1c8765 commit f6e5f58

File tree

1 file changed

+20
-41
lines changed

1 file changed

+20
-41
lines changed

projects/igniteui-angular/src/lib/core/styles/components/input/_input-group-theme.scss

Lines changed: 20 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -396,19 +396,15 @@
396396

397397
@if $variant == 'material' {
398398
%form-group-display--border {
399+
--label-position: calc((#{var-get($theme, 'size')} / 2) - #{rem(1px)});
400+
401+
399402
&:has(input:-webkit-autofill, input:autofill) {
400403
%igx-input-group__notch--border {
401404
border-block-start-color: transparent;
402405
}
403406

404-
%form-group-label {
405-
--label-position: #{sizable(18px, 22px, 26px)};
406-
407-
transform: translateY(calc(var(--label-position) * -1));
408-
margin-top: 0;
409-
overflow: hidden;
410-
will-change: font-size, color, transform;
411-
}
407+
@extend %form-group-label--float-border;
412408
}
413409
}
414410
}
@@ -994,11 +990,9 @@
994990

995991
@if $variant == 'material' {
996992
%form-group-label--float {
997-
--floating-label-position: -73%;
998-
999993
@include type-style('caption');
1000994

1001-
transform: translateY(var(--floating-label-position));
995+
translate: 0 -73%;
1002996
}
1003997
}
1004998

@@ -1072,12 +1066,19 @@
10721066
}
10731067

10741068
%form-group-label--float-border {
1075-
--label-position: #{sizable(18px, 22px, 26px)};
1076-
1077-
transform: translateY(calc(var(--label-position) * -1));
1069+
translate: 0 calc(var(--label-position) * -1);
10781070
margin-top: 0;
10791071
overflow: hidden;
1080-
will-change: font-size, color, transform;
1072+
will-change: font-size, color, transform, translate;
1073+
}
1074+
1075+
%textarea-group {
1076+
// 3 lines * 22px + 8px bottom padding + 8px top padding
1077+
--textarea-size: #{sizable(
1078+
rem(82px, map.get($base-scale-size, 'compact')),
1079+
rem(82px, map.get($base-scale-size, 'cosy')),
1080+
rem(82px, map.get($base-scale-size, 'comfortable'))
1081+
)};
10811082
}
10821083

10831084
@if $variant == 'material' {
@@ -1101,12 +1102,6 @@
11011102
}
11021103

11031104
%form-group-textarea-group-bundle {
1104-
// 3 lines * 22px + 8px bottom padding + 8px top padding
1105-
--textarea-size: #{sizable(
1106-
rem(82px, map.get($base-scale-size, 'compact')),
1107-
rem(82px, map.get($base-scale-size, 'cosy')),
1108-
rem(82px, map.get($base-scale-size, 'comfortable'))
1109-
)};
11101105
min-height: var(--textarea-size) !important;
11111106
height: auto !important;
11121107

@@ -1118,12 +1113,12 @@
11181113
@if $material-theme {
11191114
%form-group-textarea-label {
11201115
top: calc($input-top-padding - #{rem(1px)});
1121-
margin-block-end: auto;
11221116
}
11231117

11241118
%textarea-group--outlined {
11251119
%form-group-textarea-label {
11261120
top: calc($input-top-padding - #{rem(3px)});
1121+
margin-block-end: auto;
11271122
}
11281123
}
11291124

@@ -1133,16 +1128,10 @@
11331128
}
11341129
}
11351130

1136-
%textarea-group-label--focused {
1137-
transform: translateY(0);
1138-
top: calc(#{$input-top-padding} / 4);
1139-
}
1140-
11411131
%textarea-group-label--filled--border,
11421132
%textarea-group-label--focused--border {
11431133
top: 0;
1144-
transform: translateY(-50%);
1145-
margin-block-end: auto !important;
1134+
translate: 0 -50%;
11461135
}
11471136

11481137
%textarea-group-notch--focused {
@@ -1323,20 +1312,14 @@
13231312
}
13241313

13251314
%form-group-textarea {
1326-
--textarea-size: #{sizable(
1327-
rem(82px, map.get($base-scale-size, 'compact')),
1328-
rem(82px, map.get($base-scale-size, 'cosy')),
1329-
rem(82px, map.get($base-scale-size, 'comfortable'))
1330-
)};
1331-
13321315
min-height: var(--textarea-size);
13331316
height: auto;
13341317
resize: vertical;
13351318
overflow: hidden;
13361319

13371320
@if $material-theme {
13381321
padding: 0;
1339-
inset-block-start: rem(-3px);
1322+
margin-block-start: rem(20px) !important;
13401323
}
13411324

13421325
// resets typography styles
@@ -1352,14 +1335,10 @@
13521335
%form-group-textarea-group-bundle-main {
13531336
overflow: hidden;
13541337

1355-
@if $material-theme or $indigo-theme {
1338+
@if $indigo-theme {
13561339
height: calc(100% - #{rem(2px)});
13571340
top: rem(1px);
13581341
}
1359-
1360-
@if $material-theme {
1361-
padding-block-start: $input-top-padding;
1362-
}
13631342
}
13641343

13651344
%form-group-textarea--disabled {

0 commit comments

Comments
 (0)