{
  "name": "alert",
  "type": "registry:ui",
  "framework": "react",
  "title": "Alert",
  "description": "An inline notice with an icon and a coloured edge, in info, success, warning and danger kinds.",
  "dependencies": [
    "class-variance-authority"
  ],
  "files": [
    {
      "path": "ui/alert.tsx",
      "content": "import { cva, type VariantProps } from \"class-variance-authority\"\nimport * as React from \"react\"\n\nimport { cn } from \"@/lib/utils\"\n\nconst alertVariants = cva(\n  \"flex w-full items-start gap-3 rounded-[var(--newt-radius-sm)] border border-s-4 border-newt-border bg-newt-bg-surface px-3.5 py-3 text-sm leading-5 text-newt-text-secondary\",\n  {\n    variants: {\n      variant: {\n        info: \"border-s-newt-text-link [&>svg]:text-newt-text-link\",\n        success: \"border-s-newt-online [&>svg]:text-newt-online\",\n        warning: \"border-s-newt-idle [&>svg]:text-newt-idle\",\n        danger: \"border-s-newt-danger [&>svg]:text-newt-danger\",\n      },\n    },\n    defaultVariants: { variant: \"info\" },\n  }\n)\n\n/* One shape per kind, so the kind survives without its colour. */\nconst ICONS = {\n  info: \"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm0 3.2a.9.9 0 1 1 0 1.8.9.9 0 0 1 0-1.8Zm-.8 3.4a.8.8 0 0 1 1.6 0v3.6a.8.8 0 0 1-1.6 0V7.6Z\",\n  success:\n    \"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm3.2 5.5-3.6 3.9a.8.8 0 0 1-1.2 0L4.8 8.7a.8.8 0 1 1 1.2-1.1l1 1.1 3-3.3a.8.8 0 0 1 1.2 1.1Z\",\n  warning:\n    \"M8.9 1.5a1 1 0 0 0-1.8 0L.6 13.2A1 1 0 0 0 1.5 14.7h13a1 1 0 0 0 .9-1.5L8.9 1.5ZM8 5.5a.8.8 0 0 1 .8.8v3.2a.8.8 0 0 1-1.6 0V6.3a.8.8 0 0 1 .8-.8Zm0 7.2a.9.9 0 1 1 0-1.8.9.9 0 0 1 0 1.8Z\",\n  danger:\n    \"M8 1a7 7 0 1 0 0 14A7 7 0 0 0 8 1Zm0 3.5a.8.8 0 0 1 .8.8v3.4a.8.8 0 0 1-1.6 0V5.3a.8.8 0 0 1 .8-.8Zm0 7.4a.9.9 0 1 1 0-1.8.9.9 0 0 1 0 1.8Z\",\n} as const\n\nexport interface AlertProps\n  extends React.ComponentProps<\"div\">, VariantProps<typeof alertVariants> {}\n\n/*\n * A notice that sits in the page, where a toast floats over it. What kind of\n * notice it is shows three ways: the bar down its leading edge, the icon's\n * shape and the words. A `danger` alert is announced at once (`role=\"alert\"`);\n * the others wait their turn (`role=\"status\"`).\n */\nconst Alert = React.forwardRef<HTMLDivElement, AlertProps>(\n  ({ className, variant, role, children, ...props }, ref) => {\n    const kind = variant ?? \"info\"\n    return (\n      <div\n        ref={ref}\n        role={role ?? (kind === \"danger\" ? \"alert\" : \"status\")}\n        data-variant={kind}\n        className={cn(alertVariants({ variant }), className)}\n        {...props}\n      >\n        <svg\n          viewBox=\"0 0 16 16\"\n          aria-hidden=\"true\"\n          className=\"h-5 w-5 shrink-0\"\n        >\n          <path fill=\"currentColor\" d={ICONS[kind]} />\n        </svg>\n        <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">{children}</div>\n      </div>\n    )\n  }\n)\nAlert.displayName = \"Alert\"\n\nconst AlertTitle = React.forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"font-semibold text-newt-text-primary\", className)}\n    {...props}\n  />\n))\nAlertTitle.displayName = \"AlertTitle\"\n\nconst AlertDescription = React.forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n  <div ref={ref} className={className} {...props} />\n))\nAlertDescription.displayName = \"AlertDescription\"\n\n/** A row of buttons under the text. */\nconst AlertActions = React.forwardRef<\n  HTMLDivElement,\n  React.ComponentProps<\"div\">\n>(({ className, ...props }, ref) => (\n  <div\n    ref={ref}\n    className={cn(\"mt-2 flex flex-wrap gap-2\", className)}\n    {...props}\n  />\n))\nAlertActions.displayName = \"AlertActions\"\n\nexport { Alert, AlertTitle, AlertDescription, AlertActions, alertVariants }\n",
      "type": "registry:ui"
    }
  ]
}