import type * as React from 'react'; import type { PrimitivePropsWithRef } from '../utils/primitive.cjs'; /** @internal Shared title/description ids and dismissal callback distributed from {@link Alert} to its parts via context. Not part of the public API. */ export interface AlertContextValue { titleId: string; descriptionId: string; /** Reports whether an {@link AlertTitle} is mounted, so the root only emits `aria-labelledby` when there is something to point at. */ setHasTitle: (present: boolean) => void; /** Reports whether an {@link AlertDescription} is mounted, so the root only emits `aria-describedby` when there is something to point at. */ setHasDescription: (present: boolean) => void; /** Accessible name for {@link AlertClose}, from the root's `closeLabel`. */ closeLabel: string; onOpenChange: (open: boolean) => void; } /** * Props for the {@link Alert} recipe. No `asChild`: the recipe always wraps its * children in the derived anatomy, so `Slot` would never receive the single * element it needs. Reach for `primitives/alert`'s headless `AlertRoot` for that. */ export interface AlertProps extends Omit, 'asChild'> { /** * The alert's accessible name, rendered into the derived `AlertTitle` and * pointed at by `aria-labelledby`. A string, not a node. * @default undefined */ title?: string | undefined; /** * The alert's supporting text, rendered into the derived `AlertDescription` part * and pointed at by the root's `aria-describedby`. * @default undefined — no description part is rendered. */ description?: React.ReactNode | undefined; /** * Decorative glyph rendered into the derived `AlertIcon` part, always `aria-hidden`. * Consumer supplies content; position is derived. * @default undefined */ icon?: React.ReactNode | undefined; /** * Buttons and links responding to the alert ("Retry", "View details"), * rendered into the derived `AlertAction` part after the description. * @default undefined — no action part is rendered. */ action?: React.ReactNode | undefined; /** * Renders the derived `AlertClose` part — a `type="button"` dismiss control named * by `closeLabel`. * @default false */ dismissible?: boolean | undefined; /** * `"status"` (default) is a polite live region for informational banners. * Use `"alert"` for assertive, time-critical messages (WAI-ARIA alert role). * @default 'status' */ role?: 'status' | 'alert' | undefined; /** * Controlled visibility. Pair with `onOpenChange`; while defined, `AlertClose` * only reports the request and the Alert never hides itself. * @default undefined — uncontrolled, seeded from `defaultOpen`. */ open?: boolean | undefined; /** * Initial visibility, used only when the alert is uncontrolled. * @default true */ defaultOpen?: boolean | undefined; /** * Fires when visibility changes, typically `false` when `AlertClose` is activated. * Fires controlled or uncontrolled. * @default undefined */ onOpenChange?: ((open: boolean) => void) | undefined; /** * Accessible name for {@link AlertClose}, an icon-only button with no visible text. * Lives on the root, not the part. `aria-label` on `AlertClose` overrides. * @default 'Dismiss' */ closeLabel?: string | undefined; /** * Whether `Escape` dismisses the alert while focus is inside it. Opt-in; * when enabled, focus restores to the nearest focusable element before the alert. * @default false */ dismissOnEscape?: boolean | undefined; /** * Severity rung the skin colours the alert by, mirrored to `data-status`. * @default undefined — the skin's own neutral styling. */ status?: 'info' | 'success' | 'warning' | 'danger' | (string & {}) | undefined; /** * Visual weight rung the skin reads, mirrored to `data-variant` on the root. * @default undefined — the skin's own default weight. */ variant?: 'solid' | 'outline' | (string & {}) | undefined; } /** Props for {@link AlertRoot}: {@link AlertProps} minus the derived-anatomy-only props. */ export type AlertRootProps = Omit & Pick, 'asChild'>; /** Props for {@link AlertClose}, the dismiss button — renders a `