import type { JSX } from "@solidjs/web"; import { type Accessor } from "solid-js"; import type { MaybeAccessor } from "../internals/maybe-accessor.js"; /** * Why the alert dialog's open state changed. * * Alert dialogs cannot be dismissed by an outside press or Escape without * an explicit action, so those reasons are excluded from the public surface. * * - `"trigger-press"` — trigger was clicked or keyboard-activated. * - `"close-button"` — `` / an action button was pressed. * - `"imperative"` — `ad.setOpen()` called programmatically. */ export type AlertDialogChangeReason = "trigger-press" | "close-button" | "imperative"; /** * Options for {@link createAlertDialog}. */ export interface CreateAlertDialogOptions { /** * Open state. Consumer-owned signal. */ open: MaybeAccessor; /** * Whether interaction is suppressed. * @default false */ disabled?: MaybeAccessor; /** * Pre-change callback fired via `runWithOwner(null, ...)`. */ onOpenChange?: (open: boolean, event: Event, reason: AlertDialogChangeReason) => void; } /** * Public API returned by {@link createAlertDialog}. */ export interface AlertDialogApi { /** Reactive accessor for the current open state. */ open: Accessor; /** Whether interaction is suppressed. */ disabled: Accessor; /** * Alert dialogs are always modal and never close on outside press — * this is a fixed behavioral invariant, not a knob. */ readonly modal: true; readonly disablePointerDismissal: true; /** Imperative open setter. */ setOpen: (next: boolean, event?: Event, reason?: AlertDialogChangeReason) => void; /** Flip open (no-op when disabled). */ toggle: (event?: Event, reason?: AlertDialogChangeReason) => void; /** Context provider. */ Provider: (props: { children: JSX.Element; }) => JSX.Element; } /** * Read the nearest {@link AlertDialogApi}. Throws unless `optional` is true. */ export declare function useAlertDialog(): AlertDialogApi; export declare function useAlertDialog(optional: true): AlertDialogApi | null; /** * Headless primitive for an alert-dialog compound. Always modal, always * disables outside-press dismissal — both are fixed invariants of the * ARIA `alertdialog` role. DOM machinery lives in ``. */ export declare function createAlertDialog(options: CreateAlertDialogOptions): AlertDialogApi; //# sourceMappingURL=create-alert-dialog.d.ts.map