Skip to content

Commit 2ccf0ae

Browse files
mmalerbatinayuangao
authored andcommitted
fix(input): change dividerColor to color (#3726)
* fix(input): change dividerColor to color * change over docs and demo usages
1 parent 7cff349 commit 2ccf0ae

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

src/demo-app/input/input-demo.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,24 @@ <h4>Icons</h4>
119119
<md-toolbar color="primary">Divider Colors</md-toolbar>
120120
<md-card-content>
121121
<h4>Input</h4>
122-
<md-input-container dividerColor="primary" >
122+
<md-input-container color="primary" >
123123
<input mdInput placeholder="Default Color" value="example">
124124
</md-input-container>
125-
<md-input-container dividerColor="accent">
125+
<md-input-container color="accent">
126126
<input mdInput placeholder="Accent Color" value="example">
127127
</md-input-container>
128-
<md-input-container dividerColor="warn">
128+
<md-input-container color="warn">
129129
<input mdInput placeholder="Warn Color" value="example">
130130
</md-input-container>
131131

132132
<h4>Textarea</h4>
133-
<md-input-container dividerColor="primary">
133+
<md-input-container color="primary">
134134
<textarea mdInput placeholder="Default Color">example</textarea>
135135
</md-input-container>
136-
<md-input-container dividerColor="accent">
136+
<md-input-container color="accent">
137137
<textarea mdInput placeholder="Accent Color">example</textarea>
138138
</md-input-container>
139-
<md-input-container dividerColor="warn">
139+
<md-input-container color="warn">
140140
<textarea mdInput placeholder="Warn Color">example</textarea>
141141
</md-input-container>
142142
</md-card-content>
@@ -173,7 +173,7 @@ <h4>Textarea</h4>
173173
<md-card class="demo-card demo-basic">
174174
<md-toolbar color="primary">
175175
Hello&nbsp;
176-
<md-input-container dividerColor="accent">
176+
<md-input-container color="accent">
177177
<input mdInput [(ngModel)]="name" type="text" placeholder="First name">
178178
</md-input-container>,
179179
how are you?
@@ -222,9 +222,9 @@ <h4>Textarea</h4>
222222
</md-input-container>
223223
</p>
224224
<p>
225-
<md-checkbox [(ngModel)]="dividerColor">Check to change the divider color:</md-checkbox>
226-
<md-input-container [dividerColor]="dividerColor ? 'primary' : 'accent'">
227-
<input mdInput [placeholder]="dividerColor ? 'Primary color' : 'Accent color'">
225+
<md-checkbox [(ngModel)]="color">Check to change the color:</md-checkbox>
226+
<md-input-container [color]="color ? 'primary' : 'accent'">
227+
<input mdInput [placeholder]="color ? 'Primary color' : 'Accent color'">
228228
</md-input-container>
229229
</p>
230230
<p>

src/demo-app/input/input-demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA
1414
})
1515
export class InputDemo {
1616
floatingLabel: string = 'auto';
17-
dividerColor: boolean;
17+
color: boolean;
1818
requiredField: boolean;
1919
ctrlDisabled = false;
2020

src/lib/input/input-container.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
[attr.for]="_mdInputChild.id"
1414
[class.mat-empty]="_mdInputChild.empty && !_shouldAlwaysFloat"
1515
[class.mat-float]="_canPlaceholderFloat"
16-
[class.mat-accent]="dividerColor == 'accent'"
17-
[class.mat-warn]="dividerColor == 'warn'"
16+
[class.mat-accent]="color == 'accent'"
17+
[class.mat-warn]="color == 'warn'"
1818
*ngIf="_hasPlaceholder()">
1919
<ng-content select="md-placeholder, mat-placeholder"></ng-content>
2020
{{_mdInputChild.placeholder}}
@@ -32,8 +32,8 @@
3232
<div class="mat-input-underline"
3333
[class.mat-disabled]="_mdInputChild.disabled">
3434
<span class="mat-input-ripple"
35-
[class.mat-accent]="dividerColor == 'accent'"
36-
[class.mat-warn]="dividerColor == 'warn'"></span>
35+
[class.mat-accent]="color == 'accent'"
36+
[class.mat-warn]="color == 'warn'"></span>
3737
</div>
3838

3939
<div class="mat-input-subscript-wrapper" [ngSwitch]="_getDisplayedMessages()">

src/lib/input/input-container.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,12 @@ export class MdInputContainer implements AfterViewInit, AfterContentInit {
283283
@Input() align: 'start' | 'end' = 'start';
284284

285285
/** Color of the input divider, based on the theme. */
286-
@Input() dividerColor: 'primary' | 'accent' | 'warn' = 'primary';
286+
@Input() color: 'primary' | 'accent' | 'warn' = 'primary';
287+
288+
/** @deprecated Use color instead. */
289+
@Input()
290+
get dividerColor() { return this.color; }
291+
set dividerColor(value) { this.color = value; }
287292

288293
/** Whether the floating label should always float or not. */
289294
get _shouldAlwaysFloat() { return this._floatPlaceholder === 'always'; };

src/lib/input/input.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ Hint labels are specified in one of two ways: either using the `hintLabel` attri
7979
`align` attribute containing the side. The attribute version is assumed to be at the `start`.
8080
Specifying a side twice will result in an exception during initialization.
8181

82-
### Divider Color
82+
### Underline Color
8383

84-
The divider (line under the `input` content) color can be changed by using the `dividerColor`
84+
The underline (line under the `input` content) color can be changed by using the `color`
8585
attribute of `md-input-container`. A value of `primary` is the default and will correspond to the
8686
theme primary color. Alternatively, `accent` or `warn` can be specified to use the theme's accent or
8787
warn color.

0 commit comments

Comments
 (0)