import * as React from "react" import { cva, type VariantProps } from "class-variance-authority" import { cn } from "../../lib/utils" // A token-driven Alert primitive replacing the family's ad-hoc role="alert" / // role="status" notice divs. Each variant is a soft-filled, colored-border block // that recolors correctly on every base (light, dark) via the semantic // tokens. Callers keep control of the a11y role (default "alert"; pass // role="status" for non-urgent notices) so existing e2e querying by role stays // green. An optional leading icon is supported via the grid layout below. const alertVariants = cva( "relative grid w-full grid-cols-[0_1fr] items-start gap-y-0.5 rounded-md border px-3 py-2 text-sm has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-[>svg]:gap-x-3 [&>svg]:size-4 [&>svg]:translate-y-0.5", { variants: { variant: { default: "border-border bg-muted text-muted-foreground [&>svg]:text-muted-foreground", success: "border-success/40 bg-success-soft text-success [&>svg]:text-success", warning: "border-warning/40 bg-warning-soft text-warning [&>svg]:text-warning", info: "border-info/40 bg-info-soft text-info [&>svg]:text-info", destructive: "border-destructive/40 bg-destructive-soft text-destructive [&>svg]:text-destructive", }, }, defaultVariants: { variant: "default", }, } ) function Alert({ className, variant = "default", role = "alert", ...props }: React.ComponentProps<"div"> & VariantProps) { return (
) } function AlertTitle({ className, ...props }: React.ComponentProps<"div">) { return (
) } function AlertDescription({ className, ...props }: React.ComponentProps<"div">) { return (
) } export { Alert, AlertTitle, AlertDescription, alertVariants }