{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "background-inbox",
  "title": "Background Inbox",
  "description": "Work still running elsewhere and completed results waiting to be collected.",
  "dependencies": [
    "@solar-icons/react@^2.2.0",
    "cn@^0.3.0"
  ],
  "registryDependencies": [
    "button",
    "https://pastaui.com/r/pastaui-styles.json"
  ],
  "files": [
    {
      "path": "src/components/ai/background-inbox.tsx",
      "content": "import { CheckCircleIcon as CheckIcon } from '@solar-icons/react/bold/check-circle'\nimport { ClockCircleIcon as Clock3Icon } from '@solar-icons/react/linear/clock-circle'\nimport { InboxIcon } from '@solar-icons/react/linear/inbox'\nimport { LoaderIcon as LoaderCircleIcon } from '@solar-icons/react/linear/loader'\nimport { CloseIcon as XIcon } from '@solar-icons/react/linear/close'\nimport * as React from 'react'\n\nimport { Button } from '@/components/ui/button'\nimport { cn } from 'cn'\n\ninterface BackgroundInboxItem {\n  detail?: string\n  id: string\n  status: 'ready' | 'running' | 'waiting'\n  time?: string\n  title: string\n}\n\ninterface BackgroundInboxProps extends Omit<React.ComponentProps<'section'>, 'onSelect'> {\n  items: BackgroundInboxItem[]\n  onDismiss?: (id: string) => void\n  onSelect?: (id: string) => void\n}\n\nconst titleTone: Record<BackgroundInboxItem['status'], string> = {\n  ready: 'text-foreground',\n  running: 'text-muted-foreground',\n  waiting: 'text-muted-foreground/70',\n}\n\nfunction InboxStatus({ status }: Pick<BackgroundInboxItem, 'status'>) {\n  if (status === 'ready')\n    return (\n      <CheckIcon\n        aria-label=\"Ready\"\n        className=\"size-4 text-emerald-600 transition-[opacity,scale] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] dark:text-emerald-500 starting:scale-90 starting:opacity-0 motion-reduce:starting:scale-100\"\n      />\n    )\n  if (status === 'running')\n    return (\n      <LoaderCircleIcon\n        aria-label=\"Running\"\n        className=\"size-4 animate-spin text-blue-500 motion-reduce:animate-none dark:text-blue-400\"\n      />\n    )\n  return <Clock3Icon aria-label=\"Waiting\" className=\"size-4 text-muted-foreground/70\" />\n}\n\nfunction BackgroundInbox({\n  className,\n  items,\n  onDismiss,\n  onSelect,\n  ...props\n}: BackgroundInboxProps) {\n  const ready = items.filter((item) => item.status === 'ready').length\n\n  return (\n    <section\n      data-slot=\"background-inbox\"\n      className={cn(\n        'rounded-[16px] bg-card p-2 font-sans text-sm font-[450] tracking-[-0.05px] text-muted-foreground shadow-card',\n        className,\n      )}\n      {...props}\n    >\n      <header className=\"flex items-center gap-2 px-3 pt-2 pb-1\">\n        <InboxIcon className=\"size-4 text-muted-foreground\" />\n        <h3 className=\"text-sm leading-5 font-medium text-muted-foreground\">Background inbox</h3>\n        <span\n          className={cn(\n            'ml-auto rounded-full px-2 py-0.5 text-xs leading-5 tabular-nums',\n            ready > 0\n              ? 'bg-blue-500/12 text-blue-600 dark:bg-blue-400/15 dark:text-blue-300'\n              : 'bg-foreground/6 text-muted-foreground',\n          )}\n        >\n          {ready} ready\n        </span>\n      </header>\n      <ul className=\"flex flex-col\">\n        {items.map((item) => (\n          <li\n            className=\"group relative rounded-[12px] px-3 py-3 transition-[opacity,translate,background-color] duration-200 ease-[cubic-bezier(0.23,1,0.32,1)] hover:bg-foreground/4 starting:-translate-y-1 starting:opacity-0 motion-reduce:starting:translate-y-0\"\n            key={item.id}\n          >\n            <div className=\"flex items-start gap-3\">\n              <span className=\"flex h-6 shrink-0 items-center\">\n                <InboxStatus status={item.status} />\n              </span>\n              <button\n                className={cn(\n                  'min-w-0 flex-1 rounded-sm text-left outline-none focus-visible:ring-2 focus-visible:ring-ring',\n                  onDismiss && 'pointer-coarse:pr-8',\n                )}\n                onClick={() => onSelect?.(item.id)}\n                type=\"button\"\n              >\n                <span className=\"flex items-baseline gap-3\">\n                  <span className=\"flex min-w-0 flex-1 items-center gap-2\">\n                    <span\n                      className={cn(\n                        'truncate text-[15px] leading-6 font-medium',\n                        titleTone[item.status],\n                      )}\n                    >\n                      {item.title}\n                    </span>\n                    {item.status === 'ready' && (\n                      <>\n                        <span\n                          aria-hidden=\"true\"\n                          className=\"size-1.5 shrink-0 rounded-full bg-blue-500 dark:bg-blue-400\"\n                        />\n                        <span className=\"sr-only\">Unread</span>\n                      </>\n                    )}\n                  </span>\n                  {item.time && (\n                    <span\n                      className={cn(\n                        'shrink-0 text-xs text-muted-foreground/70 tabular-nums',\n                        onDismiss &&\n                          'transition-opacity duration-150 ease-out group-focus-within:opacity-0 group-hover:opacity-0 pointer-coarse:opacity-100',\n                      )}\n                    >\n                      {item.time}\n                    </span>\n                  )}\n                </span>\n                {item.detail && (\n                  <span className=\"mt-0.5 block truncate text-[13px] leading-5 text-muted-foreground/70\">\n                    {item.detail}\n                  </span>\n                )}\n              </button>\n            </div>\n            {onDismiss && (\n              <Button\n                aria-label={`Dismiss ${item.title}`}\n                className=\"absolute top-3 right-3 opacity-0 transition-[opacity,background-color] duration-150 ease-out group-focus-within:opacity-100 group-hover:opacity-100 pointer-coarse:opacity-100\"\n                onClick={() => onDismiss(item.id)}\n                size=\"icon-xs\"\n                type=\"button\"\n                variant=\"ghost\"\n              >\n                <XIcon />\n              </Button>\n            )}\n          </li>\n        ))}\n      </ul>\n    </section>\n  )\n}\n\nexport { BackgroundInbox }\nexport type { BackgroundInboxItem, BackgroundInboxProps }\n",
      "type": "registry:component",
      "target": "@components/ai/background-inbox.tsx"
    }
  ],
  "type": "registry:component"
}