From 94d7f337188fafeb78f8f5addea0c472b4d2ef60 Mon Sep 17 00:00:00 2001 From: Vicki League Date: Wed, 25 Jun 2025 09:50:12 -0400 Subject: [PATCH] finish migrating toast module --- libs/components/src/toast/toast.component.html | 2 +- libs/components/src/toast/toast.component.ts | 7 ++----- libs/components/src/toast/toast.service.ts | 5 ++++- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libs/components/src/toast/toast.component.html b/libs/components/src/toast/toast.component.html index c891693e521..f969a3b4b50 100644 --- a/libs/components/src/toast/toast.component.html +++ b/libs/components/src/toast/toast.component.html @@ -8,7 +8,7 @@
{{ variant() | i18n }} - @if (title) { + @if (title(); as title) {

{{ title }}

} @for (m of messageArray; track m) { diff --git a/libs/components/src/toast/toast.component.ts b/libs/components/src/toast/toast.component.ts index 221e4889c71..532d137e904 100644 --- a/libs/components/src/toast/toast.component.ts +++ b/libs/components/src/toast/toast.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, Output, input } from "@angular/core"; +import { Component, EventEmitter, Output, input } from "@angular/core"; import { IconButtonModule } from "../icon-button"; import { SharedModule } from "../shared"; @@ -41,10 +41,7 @@ export class ToastComponent { readonly message = input.required(); /** An optional title to display over the message. */ - // TODO: Skipped for migration because: - // This input is used in a control flow expression (e.g. `@if` or `*ngIf`) - // and migrating would break narrowing currently. - @Input() title?: string; + title = input(); /** * The percent width of the progress bar, from 0-100 diff --git a/libs/components/src/toast/toast.service.ts b/libs/components/src/toast/toast.service.ts index 00c32f9b1b3..f55fb3ada83 100644 --- a/libs/components/src/toast/toast.service.ts +++ b/libs/components/src/toast/toast.service.ts @@ -11,7 +11,10 @@ export type ToastOptions = { * The duration the toast will persist in milliseconds **/ timeout?: number; -} & Pick; + message: ReturnType; + variant?: ReturnType; + title?: ReturnType; +}; /** * Presents toast notifications