import React from 'react'; import type { Status } from '../../util/variant-types'; export type ToastNotificationProps = { /** * Additional class names that can be appended to the component, passed in for styling. */ className?: string; /** * Callback when notification is dismissed. When passed in, renders banner with a close icon in the top right. */ onDismiss?: () => void; /** * CSS properties defined for the HTML element. */ style?: ToastNotificationCSSProperties; /** * Length of time to wait until `onDismiss` is called */ timeout?: number; /** * Determines whether the toast notification will dismiss on its own, or due to user action. When set to `"auto"`, * it will dismiss after 8 seconds. * * **Default is `"manual"`**. */ dismissType?: 'manual' | 'auto'; /** * Keyword to characterize the state of the notification */ status?: Status; /** * The title/heading of the notification */ title: string; }; /** * Color overrides a toast still honors, kept out of the component's documented API on * purpose. All three are held back: `--toast__bg`, `--toast__fg`, and `--toast__icon`. * * `--toast__icon` is the reason. It recolors the status icon, which is the one part of a * toast a reader uses to tell severity apart at a glance, and recoloring it away from its * status is how a favorable toast ends up looking critical. The background and foreground go * with it, since a toast recolored past its status reads the same way whichever property did * it. * * Held back rather than removed: they keep working, and the toasts already relying on them * keep rendering. They are simply not advertised, so nothing points a new consumer at them. * The declarations stay here so existing usage keeps type-checking, and * `ToastNotification.test.tsx` covers all three still taking effect, since no story does. * * See "Properties held back from the documented API" in `.github/copilot-instructions.md`. */ export interface ToastNotificationCSSProperties extends React.CSSProperties { '--toast__bg'?: string; '--toast__fg'?: string; '--toast__icon'?: string; } /** * ## Usage * * | Type/Use | Description | Example | * |----------|-------------|---------| * | Success | Confirms a successful action. | Form submitted, settings saved, message sent. | * | Error | Alerts the user to a failure or problem. | Failed save, API error, input validation failure. | * | Warning | Warns about potential issues without blocking progress. | Unsaved changes, feature deprecation, connectivity issues. | * | Info | Shares neutral or contextual information. | Tip or hint, background updates, non-critical status. | * * ## Interaction * * Toast notifications can be manually dismissed or auto-dismissed using the `dismissType` prop; auto toasts are automatically dismissed after 8 seconds. When building with `ToastNotification`, each should slide in and out from the top right of the screen, placed 16px from the bottom and right side of the viewport, fading in with the `eds-anim-fade-long` token and out with the `eds-anim-fade-quick` token. * * ## Content & Accessibility * * ### Do's * * * Keep the toast to a single, simple message such as a confirmation. * * Use simple phrases or sentence fragments, in sentence case. * * Aim for 1 line of text or less. * * ### Don'ts * * * Don't use more than 2 lines of text; if more is required, find another way to provide the information. * * Don't include any information in a toast that may be needed again. * * Don't punctuate incomplete sentences, and don't rely on color to convey meaning. */ export declare const ToastNotification: { ({ className, dismissType, onDismiss, status, timeout, title, ...other }: ToastNotificationProps): React.JSX.Element; displayName: string; };