Skip to content

Commit

Permalink
fix: floating label misalignment
Browse files Browse the repository at this point in the history
  • Loading branch information
JoomFX authored and joneff committed Nov 6, 2019
1 parent 50e81a5 commit 944cce7
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 21 deletions.
14 changes: 7 additions & 7 deletions packages/material/scss/input/_layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
left: calc( #{$textarea-padding-x } + #{$input-border-width} );
}

&:not(.k-state-empty) {
> .k-label {
top: calc( #{$floating-label-height} + #{$input-border-width} + #{$input-padding-y} - 10px );
padding: 0 $textarea-floating-label-padding;
}
}

&::after {
// disable input ripple
display: none;
Expand All @@ -33,11 +40,4 @@
}
}
}

.k-textarea-wrapper {
&.k-state-focused > .k-label {
top: calc( #{$floating-label-height} + #{$input-border-width} + #{$input-padding-y} - 10px );
padding: 0 $textarea-floating-label-padding;
}
}
}
35 changes: 21 additions & 14 deletions packages/material/scss/input/_theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.k-textbox,
.k-textarea,
.k-input.k-textbox {
@include fill (
@include fill(
$bg: transparent,
$border: $input-border
);
Expand All @@ -15,18 +15,18 @@
// Hovered
&:hover,
&.k-state-hover {
@include fill ( $border: $input-hovered-border );
@include fill( $border: $input-hovered-border );
}

// Focused
&:focus,
&.k-state-focus {
@include fill ( $border: $input-focused-border );
@include fill( $border: $input-focused-border );
}

// Selection
&::selection {
@include fill (
@include fill(
$color: $accent-contrast,
$bg: $accent
);
Expand All @@ -37,7 +37,7 @@
&.k-state-invalid,
&.ng-invalid.ng-touched,
&.ng-invalid.ng-dirty {
@include fill ( $border: $error );
@include fill( $border: $error );
}

&:disabled {
Expand All @@ -51,7 +51,7 @@
// Textarea
.k-textarea {
border-width: $input-border-width;
@include fill ( $border: $border-color );
@include fill( $border: $border-color );
border-radius: $border-radius;
}

Expand All @@ -60,24 +60,31 @@
vertical-align: baseline;

> .k-label {
@include fill ( $color: $floating-label-text );
@include fill( $color: $floating-label-text );
}

&.k-state-focused > .k-label {
@include fill (
$color: $floating-label-focused-text,
$bg: $floating-label-focused-bg
);
@include fill( $color: $floating-label-focused-text );
}

.ng-invalid.ng-touched + .k-label,
.ng-invalid.ng-dirty + .k-label {
@include fill ( $color: $error );
@include fill( $color: $error );
}
}

.k-textarea-wrapper .k-textarea:focus {
@include fill ( $border: $accent );
.k-textarea-wrapper {
&:not(.k-state-empty) {
> .k-label {
@include fill( $bg: $floating-label-focused-bg );
}
}

.k-textarea {
&:focus {
@include fill( $border: $accent );
}
}
}
}

Expand Down

0 comments on commit 944cce7

Please sign in to comment.