From 3a96d6f3a3e74fe5540045dafe75057a65df70a9 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Wed, 1 May 2019 17:01:22 -0400 Subject: [PATCH] fix(label): use primary color on focus for md input labels adds transition for color fixes #15602 --- .../src/components/input/test/spec/index.html | 35 +++++++++++++------ core/src/components/label/label.md.scss | 11 +++++- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/core/src/components/input/test/spec/index.html b/core/src/components/input/test/spec/index.html index faea8416d88..23a9c9c08c3 100644 --- a/core/src/components/input/test/spec/index.html +++ b/core/src/components/input/test/spec/index.html @@ -15,37 +15,41 @@ - Standard + Floating: input - - Standard + + Floating: input focused value - Stacked + Stacked: input - Stacked + Stacked: input value - Floating + Floating: textarea - Floating + Floating: textarea value - Stacked + Stacked: textarea - - Stacked + + Stacked: textarea focused value + + Stacked: textarea focus + + @@ -54,6 +58,17 @@ --background: #f5f5f5; } + .custom { + --background: lightblue; + } + + .custom ion-label { + color: white !important; + } + + .custom.item-has-focus ion-label { + color: purple !important; + } diff --git a/core/src/components/label/label.md.scss b/core/src/components/label/label.md.scss index 098f373499c..3f03db84ff3 100644 --- a/core/src/components/label/label.md.scss +++ b/core/src/components/label/label.md.scss @@ -15,13 +15,17 @@ :host(.label-stacked) { @include transform-origin(start, top); @include transform(translate3d(0, 50%, 0), scale(.75)); + + transition: color 150ms cubic-bezier(.4,0,.2,1); } :host(.label-floating) { @include transform(translate3d(0, 96%, 0)); @include transform-origin(start, top); - transition: transform 150ms cubic-bezier(.4,0,.2,1); + transition: + color 150ms cubic-bezier(.4,0,.2,1), + transform 150ms cubic-bezier(.4,0,.2,1); } :host(.label-stacked), @@ -39,6 +43,11 @@ @include transform(translate3d(0, 50%, 0), scale(.75)); } +:host-context(.item-has-focus).label-stacked, +:host-context(.item-has-focus).label-floating { + color: $label-md-text-color-focused; +} + // MD Typography // --------------------------------------------------