Skip to content

Commit 7687114

Browse files
committed
refactor: convert dash-case inputs to camelCase
Converts any dash-cased `@Input` properties into camelCase and adds a deprecated proxy property with the old naming. The following properties have been renamed: * `md-ripple-trigger` * `md-ripple-centered` * `md-ripple-disabled` * `md-ripple-max-radius` * `md-ripple-speed-factor` * `md-ripple-color` * `md-ripple-background-color` * `md-ripple-focused` * `md-ripple-unbounded` * `thumb-label` * `tick-interval` * `md-dynamic-height` * `tooltip-position` The following properties were skipped: * `md-menu-trigger-for` - Is currently used also as a selector for the menu trigger. * Any properties that a native equivalent (e.g. `aria-label`, `aria-labeledby`).
1 parent e436775 commit 7687114

26 files changed

+175
-111
lines changed

src/demo-app/ripple/ripple-demo.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@
4848
[class.demo-ripple-disabled]="disabled"
4949
[class.demo-ripple-rounded]="rounded"
5050
md-ripple
51-
[md-ripple-centered]="centered"
52-
[md-ripple-disabled]="disabled"
53-
[md-ripple-unbounded]="unbounded"
54-
[md-ripple-max-radius]="maxRadius"
55-
[md-ripple-color]="rippleColor"
56-
[md-ripple-background-color]="rippleBackgroundColor"
57-
[md-ripple-speed-factor]="rippleSpeed">
51+
[mdRippleCentered]="centered"
52+
[mdRippleDisabled]="disabled"
53+
[mdRippleUnbounded]="unbounded"
54+
[mdRippleMaxRadius]="maxRadius"
55+
[mdRippleColor]="rippleColor"
56+
[mdRippleBackgroundColor]="rippleBackgroundColor"
57+
[mdRippleSpeedFactor]="rippleSpeed">
5858
Click me
5959
</div>
6060
</section>

src/demo-app/slider/slider-demo.html

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ <h1>Default Slider</h1>
44

55
<h1>Slider with Min and Max</h1>
66
<input [(ngModel)]="min">
7-
<md-slider [min]="min" [max]="max" tick-interval="5" #slider2></md-slider>
7+
<md-slider [min]="min" [max]="max" tickInterval="5" #slider2></md-slider>
88
{{slider2.value}}
99
<input [(ngModel)]="max">
1010

@@ -20,11 +20,11 @@ <h1>Slider with step defined</h1>
2020
{{slider5.value}}
2121

2222
<h1>Slider with set tick interval</h1>
23-
<md-slider tick-interval="auto"></md-slider>
24-
<md-slider tick-interval="9"></md-slider>
23+
<md-slider tickInterval="auto"></md-slider>
24+
<md-slider tickInterval="9"></md-slider>
2525

2626
<h1>Slider with Thumb Label</h1>
27-
<md-slider thumb-label></md-slider>
27+
<md-slider thumbLabel></md-slider>
2828

2929
<h1>Slider with one-way binding</h1>
3030
<md-slider [value]="val" step="40"></md-slider>
@@ -35,13 +35,13 @@ <h1>Slider with two-way binding</h1>
3535
<input [(ngModel)]="demo">
3636

3737
<h1>Inverted slider</h1>
38-
<md-slider invert value="50" tick-interval="5"></md-slider>
38+
<md-slider invert value="50" tickInterval="5"></md-slider>
3939

4040
<h1>Vertical slider</h1>
41-
<md-slider vertical thumb-label tick-interval="auto" value="50"></md-slider>
41+
<md-slider vertical thumbLabel tickInterval="auto" value="50"></md-slider>
4242

4343
<h1>Inverted vertical slider</h1>
44-
<md-slider vertical invert thumb-label tick-interval="auto" value="50"></md-slider>
44+
<md-slider vertical invert thumbLabel tickInterval="auto" value="50"></md-slider>
4545

4646
<md-tab-group>
4747
<md-tab label="One">

src/demo-app/tabs/tabs-demo.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ <h1>Tab Group Demo - Dynamic Tabs</h1>
4343
</md-card>
4444

4545
<md-tab-group class="demo-tab-group"
46-
md-dynamic-height
46+
mdDynamicHeight
4747
[(selectedIndex)]="activeTabIndex">
4848
<md-tab *ngFor="let tab of dynamicTabs" [disabled]="tab.disabled">
4949
<template md-tab-label>{{tab.label}}</template>
@@ -92,7 +92,7 @@ <h1>Tab Group Demo - Dynamic Tabs</h1>
9292

9393
<h1>Tab Group Demo - Dynamic Height</h1>
9494

95-
<md-tab-group class="demo-tab-group" md-dynamic-height>
95+
<md-tab-group class="demo-tab-group" mdDynamicHeight>
9696
<md-tab *ngFor="let tab of tabs" [disabled]="tab.disabled">
9797
<template md-tab-label>{{tab.label}}</template>
9898
{{tab.content}}

src/demo-app/tooltip/tooltip-demo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ <h1>Tooltip Demo</h1>
66
md-raised-button
77
color="primary"
88
[md-tooltip]="message"
9-
[tooltip-position]="position"
9+
[tooltipPosition]="position"
1010
[tooltipShowDelay]="showDelay"
1111
[tooltipHideDelay]="hideDelay">
1212
Mouse over to see the tooltip

src/lib/button/button.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<span class="md-button-wrapper"><ng-content></ng-content></span>
22
<div md-ripple *ngIf="!_isRippleDisabled()" class="md-button-ripple"
33
[class.md-button-ripple-round]="_isRoundButton()"
4-
[md-ripple-trigger]="_getHostElement()"
5-
[md-ripple-color]="_isRoundButton() ? 'rgba(255, 255, 255, 0.2)' : ''"
6-
md-ripple-background-color="rgba(0, 0, 0, 0)"></div>
4+
[mdRippleTrigger]="getHostElement()"
5+
[mdRippleColor]="isRoundButton() ? 'rgba(255, 255, 255, 0.2)' : ''"
6+
mdRippleBackgroundColor="rgba(0, 0, 0, 0)"></div>
77
<!-- the touchstart handler prevents the overlay from capturing the initial tap on touch devices -->
88
<div class="md-button-focus-overlay" (touchstart)="$event.preventDefault()"></div>

src/lib/button/button.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('MdButton', () => {
168168
anchorElement = fixture.nativeElement.querySelector('a[md-button]');
169169
});
170170

171-
it('should remove ripple if md-ripple-disabled input is set', () => {
171+
it('should remove ripple if mdRippleDisabled input is set', () => {
172172
expect(buttonElement.querySelectorAll('[md-ripple]').length).toBe(1);
173173

174174
testComponent.rippleDisabled = true;

src/lib/checkbox/checkbox.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
(change)="_onInteractionEvent($event)"
1717
(click)="_onInputClick($event)">
1818
<div md-ripple *ngIf="!_isRippleDisabled()" class="md-checkbox-ripple"
19-
[md-ripple-trigger]="_getHostElement()"
20-
[md-ripple-centered]="true"
21-
[md-ripple-speed-factor]="0.3"
22-
md-ripple-background-color="rgba(0, 0, 0, 0)"></div>
19+
[mdRippleTrigger]="_getHostElement()"
20+
[mdRippleCentered]="true"
21+
[mdRippleSpeedFactor]="0.3"
22+
mdRippleBackgroundColor="rgba(0, 0, 0, 0)"></div>
2323
<div class="md-checkbox-frame"></div>
2424
<div class="md-checkbox-background">
2525
<svg version="1.1"

src/lib/checkbox/checkbox.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ describe('MdCheckbox', () => {
521521
expect(inputElement.tabIndex).toBe(13);
522522
});
523523

524-
it('should remove ripple if md-ripple-disabled input is set', async(() => {
524+
it('should remove ripple if mdRippleDisabled input is set', async(() => {
525525
testComponent.disableRipple = true;
526526
fixture.detectChanges();
527527

src/lib/core/ripple/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# md-ripple
22

3-
`md-ripple` defines an area in which a ripple animates, usually in response to user action. It is used as an attribute directive, for example `<div md-ripple [md-ripple-color]="rippleColor">...</div>`.
3+
`md-ripple` defines an area in which a ripple animates, usually in response to user action. It is used as an attribute directive, for example `<div md-ripple [mdRippleColor]="rippleColor">...</div>`.
44

55
By default, a ripple is activated when the host element of the `md-ripple` directive receives mouse or touch events. On a mousedown or touch start, the ripple background fades in. When the click event completes, a circular foreground ripple fades in and expands from the event location to cover the host element bounds.
66

@@ -17,11 +17,11 @@ Properties:
1717

1818
| Name | Type | Description |
1919
| --- | --- | --- |
20-
| `md-ripple-trigger` | Element | The DOM element that triggers the ripple when clicked. Defaults to the parent of the `md-ripple`.
21-
| `md-ripple-color` | string | Custom color for foreground ripples
22-
| `md-ripple-background-color` | string | Custom color for the ripple background
23-
| `md-ripple-centered` | boolean | If true, the ripple animation originates from the center of the `md-ripple` bounds rather than from the location of the click event.
24-
| `md-ripple-max-radius` | number | Optional fixed radius of foreground ripples when fully expanded. Mainly used in conjunction with `unbounded` attribute. If not set, ripples will expand from their origin to the most distant corner of the component's bounding rectangle.
25-
| `md-ripple-unbounded` | boolean | If true, foreground ripples will be visible outside the component's bounds.
26-
| `md-ripple-focused` | boolean | If true, the background ripple is shown using the current theme's accent color to indicate focus.
27-
| `md-ripple-disabled` | boolean | If true, click events on the trigger element will not activate ripples. The `start` and `end` methods can still be called to programmatically create ripples.
20+
| `mdRippleTrigger` | Element | The DOM element that triggers the ripple when clicked. Defaults to the parent of the `md-ripple`.
21+
| `mdRippleColor` | string | Custom color for foreground ripples
22+
| `mdRippleBackgroundColor` | string | Custom color for the ripple background
23+
| `mdRippleCentered` | boolean | If true, the ripple animation originates from the center of the `md-ripple` bounds rather than from the location of the click event.
24+
| `mdRippleMaxRadius` | number | Optional fixed radius of foreground ripples when fully expanded. Mainly used in conjunction with `unbounded` attribute. If not set, ripples will expand from their origin to the most distant corner of the component's bounding rectangle.
25+
| `mdRippleUnbounded` | boolean | If true, foreground ripples will be visible outside the component's bounds.
26+
| `mdRippleFocused` | boolean | If true, the background ripple is shown using the current theme's accent color to indicate focus.
27+
| `mdRippleDisabled` | boolean | If true, click events on the trigger element will not activate ripples. The `start` and `end` methods can still be called to programmatically create ripples.

src/lib/core/ripple/_ripple.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import '../theming/theming';
22

33

4-
$md-ripple-focused-opacity: 0.1;
4+
$mdRippleFocused-opacity: 0.1;
55
$md-ripple-background-fade-duration: 300ms;
66
$md-ripple-background-default-color: rgba(0, 0, 0, 0.0588);
77
$md-ripple-foreground-initial-opacity: 0.25;
@@ -15,7 +15,7 @@ $md-ripple-foreground-default-color: rgba(0, 0, 0, 0.0588);
1515
overflow: hidden;
1616
}
1717

18-
[md-ripple].md-ripple-unbounded {
18+
[md-ripple].mdRippleUnbounded {
1919
overflow: visible;
2020
}
2121

@@ -30,15 +30,15 @@ $md-ripple-foreground-default-color: rgba(0, 0, 0, 0.0588);
3030
bottom: 0;
3131
}
3232

33-
.md-ripple-unbounded .md-ripple-background {
33+
.mdRippleUnbounded .md-ripple-background {
3434
display: none;
3535
}
3636

3737
.md-ripple-background.md-ripple-active {
3838
opacity: 1;
3939
}
4040

41-
.md-ripple-focused .md-ripple-background {
41+
.mdRippleFocused .md-ripple-background {
4242
opacity: 1;
4343
}
4444

@@ -64,8 +64,8 @@ $md-ripple-foreground-default-color: rgba(0, 0, 0, 0.0588);
6464
@mixin md-ripple-theme($theme) {
6565
$accent: map-get($theme, accent);
6666

67-
.md-ripple-focused .md-ripple-background {
68-
background-color: md-color($accent, $md-ripple-focused-opacity);
67+
.mdRippleFocused .md-ripple-background {
68+
background-color: md-color($accent, $mdRippleFocused-opacity);
6969
}
7070
}
7171

src/lib/core/ripple/ripple.spec.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,12 +438,12 @@ class BasicRippleContainer {
438438
template: `
439439
<div id="container" style="position: relative; width:300px; height:200px;"
440440
md-ripple
441-
[md-ripple-trigger]="trigger"
442-
[md-ripple-centered]="centered"
443-
[md-ripple-max-radius]="maxRadius"
444-
[md-ripple-disabled]="disabled"
445-
[md-ripple-color]="color"
446-
[md-ripple-background-color]="backgroundColor">
441+
[mdRippleTrigger]="trigger"
442+
[mdRippleCentered]="centered"
443+
[mdRippleMaxRadius]="maxRadius"
444+
[mdRippleDisabled]="disabled"
445+
[mdRippleColor]="color"
446+
[mdRippleBackgroundColor]="backgroundColor">
447447
</div>
448448
<div class="alternateTrigger"></div>
449449
`,

src/lib/core/ripple/ripple.ts

Lines changed: 61 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,89 @@ export class MdRipple implements OnInit, OnDestroy, OnChanges {
3030
*/
3131
// Prevent TS metadata emit from referencing HTMLElement in ripple.js
3232
// That breaks tests running in node that load material components.
33-
@Input('md-ripple-trigger') trigger: HTMLElement|HTMLElement;
33+
@Input('mdRippleTrigger') trigger: HTMLElement|HTMLElement;
34+
35+
/** @deprecated */
36+
@Input('md-ripple-trigger')
37+
get _triggerDeprecated() { return this.trigger; }
38+
set _triggerDeprecated(value: HTMLElement|HTMLElement) { this.trigger = value; };
39+
3440
/**
3541
* Whether the ripple always originates from the center of the host element's bounds, rather
3642
* than originating from the location of the click event.
3743
*/
38-
@Input('md-ripple-centered') centered: boolean;
44+
@Input('mdRippleCentered') centered: boolean;
45+
46+
/** @deprecated */
47+
@Input('md-ripple-centered')
48+
get _centeredDeprecated() { return this.centered; }
49+
set _centeredDeprecated(value: boolean) { this.centered = value; };
50+
3951
/**
4052
* Whether click events will not trigger the ripple. It can still be triggered by manually
4153
* calling start() and end().
4254
*/
43-
@Input('md-ripple-disabled') disabled: boolean;
55+
@Input('mdRippleDisabled') disabled: boolean;
56+
57+
/** @deprecated */
58+
@Input('md-ripple-disabled')
59+
get _disabledDeprecated() { return this.disabled; }
60+
set _disabledDeprecated(value: boolean) { this.disabled = value; };
61+
4462
/**
4563
* If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius
4664
* will be the distance from the center of the ripple to the furthest corner of the host element's
4765
* bounding rectangle.
4866
*/
49-
@Input('md-ripple-max-radius') maxRadius: number = 0;
67+
@Input('mdRippleMaxRadius') maxRadius: number = 0;
68+
69+
/** @deprecated */
70+
@Input('md-ripple-max-radius')
71+
get _maxRadiusDeprecated() { return this.maxRadius; }
72+
set _maxRadiusDeprecated(value: number) { this.maxRadius = value; };
73+
5074
/**
5175
* If set, the normal duration of ripple animations is divided by this value. For example,
5276
* setting it to 0.5 will cause the animations to take twice as long.
5377
*/
54-
@Input('md-ripple-speed-factor') speedFactor: number = 1;
78+
@Input('mdRippleSpeedFactor') speedFactor: number = 1;
79+
80+
/** @deprecated */
81+
@Input('md-ripple-speed-factor')
82+
get _speedFactorDeprecated() { return this.speedFactor; }
83+
set _speedFactorDeprecated(value: number) { this.speedFactor = value; };
84+
5585
/** Custom color for ripples. */
56-
@Input('md-ripple-color') color: string;
86+
@Input('mdRippleColor') color: string;
87+
88+
/** @deprecated */
89+
@Input('md-ripple-color')
90+
get _colorDeprecated() { return this.color; }
91+
set _colorDeprecated(value: string) { this.color = value; };
92+
5793
/** Custom color for the ripple background. */
58-
@Input('md-ripple-background-color') backgroundColor: string;
94+
@Input('mdRippleBackgroundColor') backgroundColor: string;
95+
96+
/** @deprecated */
97+
@Input('md-ripple-background-color')
98+
get _backgroundColorDeprecated() { return this.backgroundColor; }
99+
set _backgroundColorDeprecated(value: string) { this.backgroundColor = value; };
59100

60101
/** Whether the ripple background will be highlighted to indicated a focused state. */
61-
@HostBinding('class.md-ripple-focused') @Input('md-ripple-focused') focused: boolean;
102+
@HostBinding('class.md-ripple-focused') @Input('mdRippleFocused') focused: boolean;
103+
104+
/** @deprecated */
105+
@Input('md-ripple-focused')
106+
get _focusedDeprecated(): boolean { return this.focused; }
107+
set _focusedDeprecated(value: boolean) { this.focused = value; };
108+
62109
/** Whether foreground ripples should be visible outside the component's bounds. */
63-
@HostBinding('class.md-ripple-unbounded') @Input('md-ripple-unbounded') unbounded: boolean;
110+
@HostBinding('class.md-ripple-unbounded') @Input('mdRippleUnbounded') unbounded: boolean;
111+
112+
/** @deprecated */
113+
@Input('md-ripple-unbounded')
114+
get _unboundedDeprecated(): boolean { return this.unbounded; }
115+
set _unboundedDeprecated(value: boolean) { this.unbounded = value; };
64116

65117
private _rippleRenderer: RippleRenderer;
66118
_ruler: ViewportRuler;

src/lib/grid-list/grid-list.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,12 @@ export class MdGridList implements OnInit, AfterContentChecked {
6666
@Optional() private _dir: Dir) {}
6767

6868
@Input()
69-
get cols() {
70-
return this._cols;
71-
}
72-
73-
set cols(value: any) {
74-
this._cols = coerceToNumber(value);
75-
}
69+
get cols() { return this._cols; }
70+
set cols(value: any) { this._cols = coerceToNumber(value); }
7671

77-
@Input('gutterSize')
78-
get gutterSize() {
79-
return this._gutter;
80-
}
81-
82-
set gutterSize(value: any) {
83-
this._gutter = coerceToString(value);
84-
}
72+
@Input()
73+
get gutterSize() { return this._gutter; }
74+
set gutterSize(value: any) { this._gutter = coerceToString(value); }
8575

8676
/** Set internal representation of row height from the user-provided value. */
8777
@Input()

src/lib/menu/menu-item.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<ng-content></ng-content>
2-
<div class="md-menu-ripple" *ngIf="!disabled" md-ripple md-ripple-background-color="rgba(0,0,0,0)"
3-
[md-ripple-trigger]="_getHostElement()">
2+
<div class="md-menu-ripple" *ngIf="!disabled" md-ripple mdRippleBackgroundColor="rgba(0,0,0,0)"
3+
[mdRippleTrigger]="_getHostElement()">
44
</div>

src/lib/radio/radio.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
<div class="md-radio-outer-circle"></div>
77
<div class="md-radio-inner-circle"></div>
88
<div md-ripple *ngIf="!_isRippleDisabled()" class="md-radio-ripple"
9-
[md-ripple-trigger]="_getHostElement()"
10-
[md-ripple-centered]="true"
11-
[md-ripple-speed-factor]="0.3"
12-
md-ripple-background-color="rgba(0, 0, 0, 0)"></div>
9+
[mdRippleTrigger]="_getHostElement()"
10+
[mdRippleCentered]="true"
11+
[mdRippleSpeedFactor]="0.3"
12+
mdRippleBackgroundColor="rgba(0, 0, 0, 0)"></div>
1313
</div>
1414

1515
<input #input class="md-radio-input md-visually-hidden" type="radio"

src/lib/radio/radio.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ describe('MdRadio', () => {
249249
expect(rippleElement).toBeFalsy('Expected a disabled radio button not to have a ripple');
250250
});
251251

252-
it('should remove ripple if md-ripple-disabled input is set', async(() => {
252+
it('should remove ripple if mdRippleDisabled input is set', async(() => {
253253
fixture.detectChanges();
254254
for (let radioNativeElement of radioNativeElements)
255255
{

src/lib/select/option.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<ng-content></ng-content>
2-
<div class="md-option-ripple" *ngIf="!disabled" md-ripple md-ripple-background-color="rgba(0,0,0,0)"
3-
[md-ripple-trigger]="_getHostElement()"></div>
2+
<div class="md-option-ripple" *ngIf="!disabled" md-ripple mdRippleBackgroundColor="rgba(0,0,0,0)"
3+
[mdRippleTrigger]="_getHostElement()"></div>

0 commit comments

Comments
 (0)