diff --git a/src/material/core/option/option-parent.ts b/src/material/core/option/option-parent.ts index decd8e50e268..8df8908f35a5 100644 --- a/src/material/core/option/option-parent.ts +++ b/src/material/core/option/option-parent.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.dev/license */ -import {InjectionToken} from '@angular/core'; +import {InjectionToken, Signal} from '@angular/core'; /** * Describes a parent component that manages a list of options. @@ -14,7 +14,7 @@ import {InjectionToken} from '@angular/core'; * @docs-private */ export interface MatOptionParentComponent { - disableRipple?: boolean; + disableRipple?: boolean | Signal; multiple?: boolean; inertGroups?: boolean; hideSingleSelectionIndicator?: boolean; diff --git a/src/material/core/option/option.ts b/src/material/core/option/option.ts index f086d36bd965..77ee6fbdb061 100644 --- a/src/material/core/option/option.ts +++ b/src/material/core/option/option.ts @@ -23,6 +23,8 @@ import { ViewChild, booleanAttribute, inject, + isSignal, + Signal, } from '@angular/core'; import {Subject} from 'rxjs'; import {MAT_OPTGROUP, MatOptgroup} from './optgroup'; @@ -87,6 +89,7 @@ export class MatOption implements FocusableOption, AfterViewChecked, On private _parent = inject(MAT_OPTION_PARENT_COMPONENT, {optional: true}); group = inject(MAT_OPTGROUP, {optional: true}); + private _signalDisableRipple = false; private _selected = false; private _active = false; private _disabled = false; @@ -119,7 +122,9 @@ export class MatOption implements FocusableOption, AfterViewChecked, On /** Whether ripples for the option are disabled. */ get disableRipple(): boolean { - return !!(this._parent && this._parent.disableRipple); + return this._signalDisableRipple + ? (this._parent!.disableRipple as Signal)() + : !!this._parent?.disableRipple; } /** Whether to display checkmark for single-selection. */ @@ -138,7 +143,9 @@ export class MatOption implements FocusableOption, AfterViewChecked, On readonly _stateChanges = new Subject(); constructor(...args: unknown[]); - constructor() {} + constructor() { + this._signalDisableRipple = !!this._parent && isSignal(this._parent.disableRipple); + } /** * Whether or not the option is currently active and ready to be selected. diff --git a/tools/public_api_guard/material/core.md b/tools/public_api_guard/material/core.md index 0246d052438b..abdc0028e14e 100644 --- a/tools/public_api_guard/material/core.md +++ b/tools/public_api_guard/material/core.md @@ -25,6 +25,7 @@ import { OnInit } from '@angular/core'; import { Platform } from '@angular/cdk/platform'; import { Provider } from '@angular/core'; import { QueryList } from '@angular/core'; +import { Signal } from '@angular/core'; import { Subject } from 'rxjs'; import { Version } from '@angular/core'; @@ -295,7 +296,7 @@ export class MatOptionModule { // @public export interface MatOptionParentComponent { // (undocumented) - disableRipple?: boolean; + disableRipple?: boolean | Signal; // (undocumented) hideSingleSelectionIndicator?: boolean; // (undocumented)