Skip to content

Commit c2a20c4

Browse files
authored
refactor(multiple): clean up ripple overrides in MDC components (#23376)
Now that the default ripple timings have been aligned to MDC, we don't have to make any overrides in the various MDC components.
1 parent b5b262d commit c2a20c4

File tree

22 files changed

+10
-141
lines changed

22 files changed

+10
-141
lines changed

src/material-experimental/mdc-button/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ ng_module(
2828
deps = [
2929
"//src/cdk/platform",
3030
"//src/material-experimental/mdc-core",
31-
"@npm//@material/ripple",
3231
],
3332
)
3433

src/material-experimental/mdc-button/button-base.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ import {
1717
mixinColor,
1818
mixinDisabled,
1919
mixinDisableRipple,
20-
RippleAnimationConfig
2120
} from '@angular/material-experimental/mdc-core';
22-
import {numbers} from '@material/ripple';
2321
import {FocusOrigin} from '@angular/cdk/a11y';
2422

2523
/** Inputs common to all buttons. */
@@ -38,12 +36,6 @@ export const MAT_BUTTON_HOST = {
3836
'[class.mat-mdc-button-base]': 'true',
3937
};
4038

41-
/** Configuration for the ripple animation. */
42-
const RIPPLE_ANIMATION_CONFIG: RippleAnimationConfig = {
43-
enterDuration: numbers.DEACTIVATION_TIMEOUT_MS,
44-
exitDuration: numbers.FG_DEACTIVATION_MS
45-
};
46-
4739
/** List of classes to add to buttons instances based on host attribute selector. */
4840
const HOST_SELECTOR_MDC_CLASS_PAIR: {selector: string, mdcClasses: string[]}[] = [
4941
{
@@ -86,12 +78,6 @@ export const _MatButtonMixin = mixinColor(mixinDisabled(mixinDisableRipple(class
8678
@Directive()
8779
export class MatButtonBase extends _MatButtonMixin implements CanDisable, CanColor,
8880
CanDisableRipple {
89-
/** The ripple animation configuration to use for the buttons. */
90-
_rippleAnimation: RippleAnimationConfig =
91-
this._animationMode === 'NoopAnimations' ?
92-
{enterDuration: 0, exitDuration: 0} :
93-
RIPPLE_ANIMATION_CONFIG;
94-
9581
/** Whether the ripple is centered on the button. */
9682
_isRippleCentered = false;
9783

src/material-experimental/mdc-button/button.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
<span class="mat-mdc-focus-indicator"></span>
1818

1919
<span matRipple class="mat-mdc-button-ripple"
20-
[matRippleAnimation]="_rippleAnimation"
2120
[matRippleDisabled]="_isRippleDisabled()"
2221
[matRippleCentered]="_isRippleCentered"
2322
[matRippleTrigger]="_elementRef.nativeElement"></span>

src/material-experimental/mdc-checkbox/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ ng_module(
2929
"@npm//@angular/core",
3030
"@npm//@angular/forms",
3131
"@npm//@material/checkbox",
32-
"@npm//@material/ripple",
3332
],
3433
)
3534

src/material-experimental/mdc-checkbox/checkbox.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
<div class="mat-mdc-checkbox-ripple mat-mdc-focus-indicator" mat-ripple
3636
[matRippleTrigger]="checkbox"
3737
[matRippleDisabled]="disableRipple || disabled"
38-
[matRippleCentered]="true"
39-
[matRippleAnimation]="_rippleAnimation"></div>
38+
[matRippleCentered]="true"></div>
4039
</div>
4140
<label #label
4241
[for]="inputId"

src/material-experimental/mdc-checkbox/checkbox.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
MatCheckboxDefaultOptions, MAT_CHECKBOX_DEFAULT_OPTIONS_FACTORY
3131
} from '@angular/material/checkbox';
3232
import {
33-
RippleAnimationConfig,
3433
mixinColor,
3534
mixinDisabled,
3635
CanColor,
@@ -39,7 +38,6 @@ import {
3938
} from '@angular/material-experimental/mdc-core';
4039
import {ANIMATION_MODULE_TYPE} from '@angular/platform-browser/animations';
4140
import {MDCCheckboxAdapter, MDCCheckboxFoundation} from '@material/checkbox';
42-
import {numbers} from '@material/ripple';
4341

4442
let nextUniqueId = 0;
4543

@@ -66,13 +64,6 @@ const _MatCheckboxBase = mixinColor(mixinDisabled(class {
6664
constructor(public _elementRef: ElementRef) {}
6765
}));
6866

69-
70-
/** Configuration for the ripple animation. */
71-
const RIPPLE_ANIMATION_CONFIG: RippleAnimationConfig = {
72-
enterDuration: numbers.DEACTIVATION_TIMEOUT_MS,
73-
exitDuration: numbers.FG_DEACTIVATION_MS,
74-
};
75-
7667
@Component({
7768
selector: 'mat-checkbox',
7869
templateUrl: 'checkbox.html',
@@ -197,9 +188,6 @@ export class MatCheckbox extends _MatCheckboxBase implements AfterViewInit, OnDe
197188
/** The set of classes that should be applied to the native input. */
198189
_classes: {[key: string]: boolean} = {'mdc-checkbox__native-control': true};
199190

200-
/** Animation config for the ripple. */
201-
_rippleAnimation = RIPPLE_ANIMATION_CONFIG;
202-
203191
/** ControlValueAccessor onChange */
204192
private _cvaOnChange = (_: boolean) => {};
205193

src/material-experimental/mdc-chips/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ ng_module(
2727
"@npm//@angular/core",
2828
"@npm//@angular/forms",
2929
"@npm//@material/chips",
30-
"@npm//@material/ripple",
3130
],
3231
)
3332

src/material-experimental/mdc-chips/chip-option.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<span class="mdc-chip__ripple"></span>
22

33
<span matRipple class="mat-mdc-chip-ripple"
4-
[matRippleAnimation]="_rippleAnimation"
54
[matRippleDisabled]="_isRippleDisabled()"
65
[matRippleCentered]="_isRippleCentered"
76
[matRippleTrigger]="_elementRef.nativeElement"></span>

src/material-experimental/mdc-chips/chip-row.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<span class="mdc-chip__ripple"></span>
33

44
<span matRipple class="mat-mdc-chip-ripple"
5-
[matRippleAnimation]="_rippleAnimation"
65
[matRippleDisabled]="_isRippleDisabled()"
76
[matRippleCentered]="_isRippleCentered"
87
[matRippleTrigger]="_elementRef.nativeElement"></span>
@@ -29,4 +28,4 @@
2928
<ng-template #defaultMatChipEditInput>
3029
<span matChipEditInput></span>
3130
</ng-template>
32-
</div>
31+
</div>

src/material-experimental/mdc-chips/chip.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<span class="mdc-chip__ripple"></span>
22

33
<span matRipple class="mat-mdc-chip-ripple"
4-
[matRippleAnimation]="_rippleAnimation"
54
[matRippleDisabled]="_isRippleDisabled()"
65
[matRippleCentered]="_isRippleCentered"
76
[matRippleTrigger]="_elementRef.nativeElement"></span>

0 commit comments

Comments
 (0)