/** * Toast presentational parts: the pure-visual surface + types, with NO queue and * NO adapter dependency. The queue/imperative engine lives in an adapter * (`adapter/builtin/toast.tsx` by default), which composes these parts; the * `toast.tsx` skin re-exports them. Keeping them here (importing only React + * cva) is what lets Toast be adapter-routed without an import cycle. * * @module react/components/ui/toast-parts */ import * as React from "react"; import { type VariantProps } from "./cva.js"; /** Largest delay accepted by browser and server JavaScript timer hosts. */ export declare const MAX_TOAST_DURATION_MS = 2147483647; /** Enforce the timer-domain duration shared by public and adapter-owned toast lifecycle APIs. */ export declare function assertToastDuration(value: number, label: string): void; export declare const toastVariants: (props?: ({ variant?: "default" | "success" | "destructive" | null | undefined; } & { class?: import("../../../utils/clsx.js").ClassValue; className?: import("../../../utils/clsx.js").ClassValue; }) | undefined) => string; /** One of the `cva` colour schemes a toast can take. */ export type ToastVariant = NonNullable["variant"]>; /** A toast button: a label plus what to do when it's pressed. */ export interface ToastAction { /** Button text. */ label: React.ReactNode; /** Runs when the button is pressed (the toast is dismissed afterwards). */ onClick: () => void; } /** Options accepted by `toast(...)` when enqueuing a notification. */ export interface ToastOptions { /** Heading line. */ title?: React.ReactNode; /** Secondary supporting line shown under the title. */ description?: React.ReactNode; /** Leading icon shown before the text (any node: an SVG, emoji, etc.). */ icon?: React.ReactNode; /** Primary action button; pressing it runs `onClick` then dismisses the toast. */ action?: ToastAction; /** Secondary/cancel button; pressing it runs `onClick` (if given) then dismisses. */ cancel?: { label: React.ReactNode; onClick?: () => void; }; /** Colour scheme. @default "default" */ variant?: ToastVariant; /** Milliseconds before auto-dismiss; pass `Infinity` to persist. Overrides the provider default. */ duration?: number; } /** Imperative enqueue function: call `toast(options)`, or `toast.custom(render)`. */ export interface ToastFn { /** Enqueue a structured toast; returns its id (for `dismiss`). */ (options: ToastOptions): string; /** Enqueue a fully custom node: you own the markup, the provider owns the lifecycle (queue + auto-dismiss). */ custom: (render: (id: string) => React.ReactNode) => string; } /** Arm a pausable auto-dismiss timer. Infinity and zero disable it. */ export declare function useAutoDismiss(duration: number | undefined, onClose?: () => void, options?: { paused?: boolean; ownerDocument?: Document; }): void; /** Props accepted by ``. */ export interface ToastProps extends Omit, "title">, VariantProps { /** Milliseconds before the toast auto-closes; `Infinity`/`0` disables the timer. @default 5000 */ duration?: number; /** Invoked when the auto-dismiss timer fires. */ onClose?: () => void; /** React 19: ref is a regular prop. */ ref?: React.Ref; } /** * A single toast surface. Renders as a live region and arms an auto-dismiss timer * that calls `onClose` after `duration`. Compose `ToastTitle`, `ToastDescription` * and `ToastClose` inside it. */ export declare function Toast({ variant, duration, onClose, className, children, ref, onMouseEnter, onMouseLeave, onFocus, onBlur, ...props }: ToastProps): React.ReactElement; export declare namespace Toast { var displayName: string; } /** Heading line for ``. */ export declare function ToastTitle({ className, ref, ...props }: React.HTMLAttributes & { ref?: React.Ref; }): React.ReactElement; export declare namespace ToastTitle { var displayName: string; } /** Secondary supporting line for ``. */ export declare function ToastDescription({ className, ref, ...props }: React.HTMLAttributes & { ref?: React.Ref; }): React.ReactElement; export declare namespace ToastDescription { var displayName: string; } /** Manual close button for `` (renders an ✕ glyph when given no children). */ export declare function ToastClose({ className, children, ref, "aria-label": ariaLabel, ...props }: React.ButtonHTMLAttributes & { ref?: React.Ref; }): React.ReactElement; export declare namespace ToastClose { var displayName: string; } //# sourceMappingURL=toast-parts.d.ts.map