import { type ReactNode } from "react"; import { type ColorTokens, type StyleProp, type ViewStyle, type TextStyle } from "../../style/index.js"; import { type GlassLayer } from "../../style/glass-surface/glass-surface-props.js"; /** The intent axis: pick one (or none for the neutral default). */ type Intent = "success" | "error" | "warning" | "info" | "neutral"; /** A trailing action button on a toast. */ export interface ToastAction { /** The action label. */ label: string; /** Run when the action is pressed. */ onPress: () => void; } export interface ToastProps { /** A single-line notification pill without extra chrome. */ brief?: boolean; /** The headline line (required). */ message: string; /** A secondary line under the message. */ description?: string; /** A trailing action button (e.g. Undo). */ action?: ToastAction; /** Green success intent (icon + tint). */ success?: boolean; /** Red danger intent (icon + tint). This is the name the intent axis uses across the * kit (Button, AlertDialog, and every chart) and the one the design hand-off uses. */ destructive?: boolean; /** Amber warning intent (icon + tint). */ warning?: boolean; /** Brand-tinted informational intent (icon + tint). */ info?: boolean; /** Override the auto intent icon; pass any node, or omit to use the intent glyph. */ icon?: ReactNode; /** When provided, render a trailing dismiss (x) that calls this. */ onDismiss?: () => void; /** E2E hook forwarded to the root element. */ testID?: string; /** Outer layout composition only (width/flex within a parent), never a restyle hook. */ style?: StyleProp; } export interface ToastSkin { /** The glass layer the toast takes under glass; omitted, the dense layer. The web card * floats on the functional layer, as every web floating surface does (design-language * item 7, the hand-off's `--gl`). */ glassLayer?: GlassLayer; /** The capsule shape + density (radius, padding, gap, minHeight, shadow, maxWidth). * `hasTrailing` is true when a trailing action/dismiss control renders, so a skin * can tighten the trailing padding (M3: 8dp beside a trailing control); * `hasDescription` when a description line wraps under the message, so a pill can * take a corner that holds more than one line. */ container: (t: ColorTokens, hasTrailing: boolean, hasDescription: boolean) => ViewStyle; /** Render the auto intent glyph (success / error / warning / info) in the leading * slot. The M3 snackbar anatomy has no leading icon, so the Android skin turns * this off; an explicit `icon` prop always renders. */ intentIcon: boolean; /** Single-line application pill geometry and type; omitted skins retain their native shape. */ briefContainer?: (t: ColorTokens) => ViewStyle; briefMessage?: (t: ColorTokens) => TextStyle; /** Draw the accent's sparkle on the neutral toast too (the web card); omitted, the * neutral toast carries no glyph. */ neutralIcon?: boolean; /** The intent icon glyph size, in px. */ iconSize: number; /** The glyph slot's offset on the message's first line. */ iconSlot?: ViewStyle; /** The gap between the message and the description; omitted, 2 px. */ textGap?: number; /** The intent glyph's ink, where the capsule's own fill needs one of its own (the * inverse pill); null keeps each intent's status token. */ intentColor: ((t: ColorTokens, intent: "success" | "error" | "warning" | "info") => string) | null; /** The message line type. */ message: (t: ColorTokens) => TextStyle; /** The description line type. */ description: (t: ColorTokens) => TextStyle; /** The trailing action button shape. */ actionButton: (t: ColorTokens) => ViewStyle; /** The trailing action label type (brand-tinted). */ actionLabel: (t: ColorTokens) => TextStyle; /** Extra touch area (px, all edges) around the action button so its target * reaches the platform minimum (44pt iOS / 48dp Android); null on web. */ actionHitSlop: number | null; /** The dismiss (x) control shape. */ dismissButton: (t: ColorTokens) => ViewStyle; /** The dismiss glyph size, in px. */ dismissIconSize: number; /** The dismiss glyph color; null keeps the default muted glyph. The Android skin * paints the inverse surface's ink (`inverse-foreground`) so the x reads on the * inverse bar. */ dismissColor: ((t: ColorTokens) => string) | null; /** Extra touch area (px, all edges) around the dismiss control (same platform * minimums as `actionHitSlop`); null on web. */ dismissHitSlop: number | null; /** iOS/web dim the action/dismiss on press; Android uses a ripple instead (null). */ pressedOpacity: number | null; /** Android action/dismiss ripple; null on iOS/web. On the inverse Android bar the * ink is the bar's own ink (a foreground-ink ripple would paint bar-on-bar). */ ripple: ((t: ColorTokens) => { color: string; borderless: boolean; }) | null; } export declare function intentOf(p: { success?: boolean; destructive?: boolean; warning?: boolean; info?: boolean; }): Intent; /** Options for the imperative toast() call: the toast content plus a lifetime. */ export interface ToastOptions { message: string; description?: string; action?: ToastAction; success?: boolean; /** The danger intent. */ destructive?: boolean; warning?: boolean; info?: boolean; icon?: ReactNode; /** Auto-dismiss after this many ms (default 4000). Pass 0 or Infinity to keep it * until dismissed explicitly. */ duration?: number; } /** The imperative handle returned by useToast(). */ export interface ToastHandle { /** Enqueue a toast; returns its id (for dismiss). */ toast: (options: ToastOptions) => string; /** Dismiss a live toast early by its id. */ dismiss: (id: string) => void; } export interface ToastProviderProps { children: ReactNode; /** Replace the previous notification rather than stacking. */ single?: boolean; /** Present a one-line pill without a dismiss control. */ brief?: boolean; /** Default lifetime in milliseconds; each toast can override it. */ duration?: number; /** Include device safe areas in the offsets. */ safeArea?: boolean; /** Distance from the bottom safe area. */ bottomInset?: number; /** Distance from each horizontal safe area. */ horizontalInset?: number; } /** * Build a Toast system (the presentational `Toast`, the `ToastProvider`, and the * `useToast` hook) from a platform skin. The wrappers call this with their skin and * re-export all three; an app mounts one ToastProvider near its root. */ export declare function createToastSystem(skin: ToastSkin): { Toast: (props: ToastProps) => import("react").JSX.Element; ToastProvider: ({ children, single, brief, safeArea, duration: defaultDuration, bottomInset, horizontalInset }: ToastProviderProps) => import("react").JSX.Element; useToast: () => ToastHandle; }; export {}; //# sourceMappingURL=toast.shared.d.ts.map