{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "message-attachment",
  "type": "registry:component",
  "title": "Message Attachment",
  "description": "User/assistant message attachment chips with upload states.",
  "files": [
    {
      "path": "registry/tonic/message-attachment/message-attachment.tsx",
      "content": "\"use client\"\n\nimport { AlertCircleIcon, FileTextIcon, Loader2Icon } from \"lucide-react\"\n\nimport { cn } from \"@/lib/utils\"\n\nexport type MessageAttachmentStatus = \"ready\" | \"uploading\" | \"error\"\n\nexport type MessageAttachmentChipProps = {\n  type: \"image\" | \"document\" | \"file\"\n  name: string\n  src?: string\n  status?: MessageAttachmentStatus\n  errorMessage?: string\n  onOpen?: () => void\n  className?: string\n}\n\nexport function MessageAttachmentChip({\n  type,\n  name,\n  src,\n  status = \"ready\",\n  errorMessage,\n  onOpen,\n  className,\n}: MessageAttachmentChipProps) {\n  const isImage = type === \"image\" && !!src\n  const isUploading = status === \"uploading\"\n  const isError = status === \"error\"\n  const typeLabel =\n    type === \"image\" ? \"Image\" : type === \"document\" ? \"Document\" : \"File\"\n\n  return (\n    <button\n      type=\"button\"\n      data-slot=\"message-attachment-chip\"\n      title={isError ? errorMessage || `${name} failed` : name}\n      aria-label={`${typeLabel} attachment${\n        isError ? \", upload failed\" : isUploading ? \", uploading\" : \"\"\n      }: ${name}`}\n      disabled={!onOpen && !isImage}\n      onClick={onOpen}\n      className={cn(\n        \"bg-muted relative size-14 overflow-hidden rounded-[calc(1.5rem-8px)] outline-none transition-transform after:pointer-events-none after:absolute after:inset-0 after:rounded-[inherit] after:ring-1 after:ring-border after:ring-inset after:transition-colors focus-visible:ring-1 focus-visible:ring-ring/50 active:scale-[0.96] motion-reduce:transition-none\",\n        isError && \"after:ring-destructive/60\",\n        onOpen || isImage ? \"cursor-pointer\" : \"cursor-default\",\n        className\n      )}\n    >\n      {isImage ? (\n        // eslint-disable-next-line @next/next/no-img-element\n        <img src={src} alt=\"\" className=\"size-full object-cover\" />\n      ) : (\n        <span className=\"text-muted-foreground flex size-full items-center justify-center\">\n          <FileTextIcon className=\"size-5\" />\n        </span>\n      )}\n      {isUploading ? (\n        <span\n          aria-hidden\n          className=\"bg-background/60 absolute inset-0 flex items-center justify-center backdrop-blur-[2px]\"\n        >\n          <Loader2Icon className=\"text-muted-foreground size-4 animate-spin\" />\n        </span>\n      ) : null}\n      {isError ? (\n        <span\n          aria-hidden\n          className=\"bg-background/70 absolute inset-0 flex items-center justify-center\"\n        >\n          <AlertCircleIcon className=\"text-destructive size-4\" />\n        </span>\n      ) : null}\n    </button>\n  )\n}\n\nexport function MessageAttachmentRow({\n  children,\n  align = \"end\",\n  className,\n}: {\n  children: React.ReactNode\n  align?: \"start\" | \"end\"\n  className?: string\n}) {\n  return (\n    <div\n      data-slot=\"message-attachment-row\"\n      className={cn(\n        \"flex w-full flex-row gap-2\",\n        align === \"end\" ? \"justify-end\" : \"justify-start\",\n        className\n      )}\n    >\n      {children}\n    </div>\n  )\n}\n",
      "type": "registry:component"
    }
  ]
}