| 64 | }, |
| 65 | }) |
| 66 | export class MatRipple implements OnInit, OnDestroy, RippleTarget { |
| 67 | private _elementRef = inject<ElementRef<HTMLElement>>(ElementRef); |
| 68 | private _animationsDisabled = _animationsDisabled(); |
| 69 | |
| 70 | /** Custom color for all ripples. */ |
| 71 | @Input('matRippleColor') color!: string; |
| 72 | |
| 73 | /** Whether the ripples should be visible outside the component's bounds. */ |
| 74 | @Input('matRippleUnbounded') unbounded: boolean = false; |
| 75 | |
| 76 | /** |
| 77 | * Whether the ripple always originates from the center of the host element's bounds, rather |
| 78 | * than originating from the location of the click event. |
| 79 | */ |
| 80 | @Input('matRippleCentered') centered: boolean = false; |
| 81 | |
| 82 | /** |
| 83 | * If set, the radius in pixels of foreground ripples when fully expanded. If unset, the radius |
| 84 | * will be the distance from the center of the ripple to the furthest corner of the host element's |
| 85 | * bounding rectangle. |
| 86 | */ |
| 87 | @Input('matRippleRadius') radius: number = 0; |
| 88 | |
| 89 | /** |
| 90 | * Configuration for the ripple animation. Allows modifying the enter and exit animation |
| 91 | * duration of the ripples. The animation durations will be overwritten if animations are |
| 92 | * disabled. |
| 93 | */ |
| 94 | @Input('matRippleAnimation') animation!: RippleAnimationConfig; |
| 95 | |
| 96 | /** |
| 97 | * Whether click events will not trigger the ripple. Ripples can be still launched manually |
| 98 | * by using the `launch()` method. |
| 99 | */ |
| 100 | @Input('matRippleDisabled') |
| 101 | get disabled() { |
| 102 | return this._disabled; |
| 103 | } |
| 104 | set disabled(value: boolean) { |
| 105 | if (value) { |
| 106 | this.fadeOutAllNonPersistent(); |
| 107 | } |
| 108 | this._disabled = value; |
| 109 | this._setupTriggerEventsIfEnabled(); |
| 110 | } |
| 111 | private _disabled: boolean = false; |
| 112 | |
| 113 | /** |
| 114 | * The element that triggers the ripple when click events are received. |
| 115 | * Defaults to the directive's host element. |
| 116 | */ |
| 117 | @Input('matRippleTrigger') |
| 118 | get trigger() { |
| 119 | return this._trigger || this._elementRef.nativeElement; |
| 120 | } |
| 121 | set trigger(trigger: HTMLElement) { |
| 122 | this._trigger = trigger; |
| 123 | this._setupTriggerEventsIfEnabled(); |
nothing calls this directly
no test coverage detected