From 2ccf0ae170ac37cf351aba2193e02a31b17a00a6 Mon Sep 17 00:00:00 2001 From: mmalerba Date: Mon, 27 Mar 2017 16:38:56 -0700 Subject: [PATCH] fix(input): change dividerColor to color (#3726) * fix(input): change dividerColor to color * change over docs and demo usages --- src/demo-app/input/input-demo.html | 20 ++++++++++---------- src/demo-app/input/input-demo.ts | 2 +- src/lib/input/input-container.html | 8 ++++---- src/lib/input/input-container.ts | 7 ++++++- src/lib/input/input.md | 4 ++-- 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/src/demo-app/input/input-demo.html b/src/demo-app/input/input-demo.html index c2495400c6e7..7898932b2d5f 100644 --- a/src/demo-app/input/input-demo.html +++ b/src/demo-app/input/input-demo.html @@ -119,24 +119,24 @@

Icons

Divider Colors

Input

- + - + - +

Textarea

- + - + - +
@@ -173,7 +173,7 @@

Textarea

Hello  - + , how are you? @@ -222,9 +222,9 @@

Textarea

- Check to change the divider color: - - + Check to change the color: + +

diff --git a/src/demo-app/input/input-demo.ts b/src/demo-app/input/input-demo.ts index 291769258cea..30d27810f522 100644 --- a/src/demo-app/input/input-demo.ts +++ b/src/demo-app/input/input-demo.ts @@ -14,7 +14,7 @@ const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA }) export class InputDemo { floatingLabel: string = 'auto'; - dividerColor: boolean; + color: boolean; requiredField: boolean; ctrlDisabled = false; diff --git a/src/lib/input/input-container.html b/src/lib/input/input-container.html index 653c903bbd83..33e4292f3c4f 100644 --- a/src/lib/input/input-container.html +++ b/src/lib/input/input-container.html @@ -13,8 +13,8 @@ [attr.for]="_mdInputChild.id" [class.mat-empty]="_mdInputChild.empty && !_shouldAlwaysFloat" [class.mat-float]="_canPlaceholderFloat" - [class.mat-accent]="dividerColor == 'accent'" - [class.mat-warn]="dividerColor == 'warn'" + [class.mat-accent]="color == 'accent'" + [class.mat-warn]="color == 'warn'" *ngIf="_hasPlaceholder()"> {{_mdInputChild.placeholder}} @@ -32,8 +32,8 @@

+ [class.mat-accent]="color == 'accent'" + [class.mat-warn]="color == 'warn'">
diff --git a/src/lib/input/input-container.ts b/src/lib/input/input-container.ts index 3b5e55494404..f1f564d2598f 100644 --- a/src/lib/input/input-container.ts +++ b/src/lib/input/input-container.ts @@ -283,7 +283,12 @@ export class MdInputContainer implements AfterViewInit, AfterContentInit { @Input() align: 'start' | 'end' = 'start'; /** Color of the input divider, based on the theme. */ - @Input() dividerColor: 'primary' | 'accent' | 'warn' = 'primary'; + @Input() color: 'primary' | 'accent' | 'warn' = 'primary'; + + /** @deprecated Use color instead. */ + @Input() + get dividerColor() { return this.color; } + set dividerColor(value) { this.color = value; } /** Whether the floating label should always float or not. */ get _shouldAlwaysFloat() { return this._floatPlaceholder === 'always'; }; diff --git a/src/lib/input/input.md b/src/lib/input/input.md index a1cbe4f3cfce..ec083cfd9473 100644 --- a/src/lib/input/input.md +++ b/src/lib/input/input.md @@ -79,9 +79,9 @@ Hint labels are specified in one of two ways: either using the `hintLabel` attri `align` attribute containing the side. The attribute version is assumed to be at the `start`. Specifying a side twice will result in an exception during initialization. -### Divider Color +### Underline Color -The divider (line under the `input` content) color can be changed by using the `dividerColor` +The underline (line under the `input` content) color can be changed by using the `color` attribute of `md-input-container`. A value of `primary` is the default and will correspond to the theme primary color. Alternatively, `accent` or `warn` can be specified to use the theme's accent or warn color.