import "./alert.css"; import type * as React from "react"; /** Named `kind`, not `style`, which read as a style object. */ export type AlertButtonKind = "default" | "cancel" | "destructive"; export interface AlertButton { text: string; onPress?: () => void; /** Overrides the colour position would otherwise pick: `destructive` → danger, * `cancel` → the dismiss (`muted`). */ kind?: AlertButtonKind; isPreferred?: boolean; } export interface AlertOptions { cancelable?: boolean; onDismiss?: () => void; } /** * The caller owns everything said about the object; the kit owns the safe exit, the consequence, * focus, button sides and the typed gate. */ export interface ConfirmRequest { /** Names the object as a question — "Delete order SO-1043?". Never "Are you sure?". */ title: string; /** * One sentence stating the consequence. Omitted on `danger`, `confirm.irreversible` stands in; * `primary` gets no default, since "cannot be undone" is untrue of it. */ message?: string; /** Verb + noun — "Delete order". Never "OK" / "Yes". */ confirmLabel: string; cancelLabel?: string; /** * The commit stays disabled until the field matches exactly. Only for the highest blast radius (a * record with children, a whole book); on an ordinary delete it trains copy-paste. */ typed?: string; /** * May be async: the dialog stays open until it settles, and a rejection shows the failure under * the buttons. */ onConfirm: () => void | Promise; /** * Where focus goes when the act disables the control that opened the question (a delete of the * row the button sat on); otherwise it falls to the document. */ finalFocus?: React.RefObject; onCancel?: () => void; /** * `danger` (default) destroys; `primary` merely cannot be cheaply undone (a split, a posting). It * colours the commit and nothing else — every other guarantee is shared, which is why this is a * tone and not a second entry. */ tone?: "danger" | "primary"; } /** * THE BLOCKING CONFIRM — the kit's only one (`Dialog` announces `role="dialog"` and needs an * element in the tree). It renders into its own React root, since the API is imperative; so it * takes no `className` (restyle via `lotics-alert__*`) and carries its own `LoticsLocaleProvider`. */ declare class Alert { /** Reports, or asks something non-destructive. A destructive act is {@link Alert.confirm}. */ static alert(title: string, message?: string, buttons?: AlertButton[], options?: AlertOptions): void; /** * Cancel left and focused, commit right in the act's tone, Escape cancels, and nothing dismisses * while the commit is in flight. */ static confirm(request: ConfirmRequest): void; } export { Alert };