import * as React from 'react'; /** * The severity scale, exported as a value so a story or test can enumerate it and a new member * cannot be added without the coverage following. * * These four and not maker-ds's two. Its `alert-message` offers only success and error, but this * system already states severity in four steps twice over — `ChatLog`'s event banners and `Toast`'s * variants — and a third vocabulary for the same idea is how a design system stops being one. The * glyphs and the hidden labels below are deliberately identical to `ChatLog`'s. */ export declare const ALERT_VARIANTS: readonly ["info", "success", "warning", "error"]; export type AlertVariant = (typeof ALERT_VARIANTS)[number]; /** * Inline feedback about something that has happened or needs attention. * * Not a `Toast`. A toast is transient, floats above the page and announces itself; an alert sits in * the layout, stays until the condition clears, and belongs next to the thing it is about. Strix had * the first and not the second, which meant every consumer built the second by hand. * * WHY THE SURFACES ARE SAFE, since three of them are translucent in dark mode. * `--color-surface-{success,error,warning,info}` resolve to `alpha-*` tokens at 20% opacity on dark, * so an ink cannot be measured against them directly — the contrast depends on what is behind. The * composites over `--color-surface-base` were computed rather than assumed, and the primary ink * clears AA against all four in both themes: * * variant light dark (composited) * success 17.61:1 11.28:1 * error 16.53:1 16.66:1 * warning 17.60:1 13.29:1 * info 16.61:1 15.51:1 * * `alert.test.tsx` records these as data and recomputes them, because a translucent surface is * exactly the case where `checkPairings` cannot help — it files an alpha value under `unmeasurable` * rather than guessing at a backdrop. * * ONE KNOWN GAP, inherited rather than introduced. The warning glyph is `--color-icon-warning` * (#ff7a00), which is 2.37:1 on `--color-surface-warning` (#fff2e5) in light mode — question 3 in * `docs/DESIGN_DECISIONS_NEEDED.md`, already measured and owned. There is nothing else to reach for: * `--color-text-warning` and `--color-icon-warning-strong` do not exist. The glyph is decorative * here — `aria-hidden`, with the severity in text — so 1.4.11 does not require 3:1 of it, and * inventing a value would pre-empt a designer's decision. The test asserts that exclusion by exact * value, so resolving the question makes it fail and get removed. */ declare const alertStyles: (props?: ({ variant?: "error" | "success" | "warning" | "info" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; /** The glyph tint per severity. Same roles `Toast` uses, so the two cannot drift apart. */ declare const alertIconStyles: (props?: ({ variant?: "error" | "success" | "warning" | "info" | null | undefined; } & import("class-variance-authority/types").ClassProp) | undefined) => string; export interface AlertProps extends Omit, 'title' | 'children'> { /** * Severity. Drives the surface, the glyph and the hidden label. * @default 'info' */ variant?: AlertVariant; /** The headline. */ title: string; /** Optional detail below the title. */ children?: React.ReactNode; /** * Element for the title. * * `div` by default rather than a heading: an alert dropped into a page should not silently insert * itself into the document outline. Pass a heading level when it genuinely is a section. * @default 'div' */ titleAs?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'; /** * Override the severity glyph. Decorative — the hidden label carries the meaning. `null` removes * it, which also removes the only non-textual severity cue, so prefer replacing over removing. */ icon?: React.ReactNode; /** * Visually-hidden prefix naming the severity, so severity is not conveyed by colour alone. * @default { info: 'Information:', success: 'Success:', warning: 'Warning:', error: 'Error:' } */ variantLabels?: Record; /** A single inline action — a retry, an undo, a link onward. */ action?: React.ReactNode; /** Render a dismiss button. The alert is uncontrolled unless `visible` is passed. */ dismissible?: boolean; /** Controlled visibility. */ visible?: boolean; /** Initial visibility when uncontrolled. */ defaultVisible?: boolean; /** Called when the dismiss button is pressed. */ onDismiss?: () => void; /** * Accessible name for the dismiss button. * @default 'Dismiss alert' */ closeLabel?: string; } /** * Inline feedback about something that happened or needs attention. * * `error` announces assertively (`role="alert"`); the rest announce politely (`role="status"`). That * split is the whole reason the role is not a prop: an error interrupting a screen reader is the * point, and a success message doing it is rude. * * @example Check your connection and try again. * @example */ export declare const Alert: React.ForwardRefExoticComponent>; export { alertStyles, alertIconStyles }; export interface AlertTitleProps extends React.HTMLAttributes { as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'div'; } /** * The alert's heading. * * `div` by default and not a heading, deliberately: an alert is usually not a section of the * document outline, and a stray `h3` inside a page's flow is a worse default than no heading at * all. `as` is there when it should be one. */ export declare const AlertTitle: React.ForwardRefExoticComponent>; export type AlertDescriptionProps = React.HTMLAttributes; export declare const AlertDescription: React.ForwardRefExoticComponent>; export type AlertActionProps = React.HTMLAttributes; export declare const AlertAction: React.ForwardRefExoticComponent>; //# sourceMappingURL=alert.d.ts.map