{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "transaction-list",
  "type": "registry:block",
  "title": "Transaction list",
  "description": "Recent transactions in a Card: avatar, name, detail line and signed amount. Money in is green; pending and failed get a Badge. Has loading (skeleton rows) and empty states.",
  "dependencies": [],
  "registryDependencies": [
    "https://unbuiltui.com/r/avatar.json",
    "https://unbuiltui.com/r/badge.json",
    "https://unbuiltui.com/r/button.json",
    "https://unbuiltui.com/r/card.json",
    "https://unbuiltui.com/r/list.json",
    "https://unbuiltui.com/r/skeleton.json",
    "https://unbuiltui.com/r/utils.json"
  ],
  "files": [
    {
      "path": "components/blocks/transaction-list.tsx",
      "type": "registry:component",
      "target": "components/blocks/transaction-list.tsx",
      "content": "import { Avatar, AvatarFallback, AvatarImage } from \"@/components/ui/avatar\";\nimport { Badge } from \"@/components/ui/badge\";\nimport { Button } from \"@/components/ui/button\";\nimport { Card, CardAction, CardContent, CardHeader, CardTitle } from \"@/components/ui/card\";\nimport { List, ListItem } from \"@/components/ui/list\";\nimport { Skeleton } from \"@/components/ui/skeleton\";\nimport { cn } from \"@/lib/utils\";\n\n// UnbuiltUI block: recent transactions in a Card. Money in is green, money out is\n// plain; pending and failed get a Badge. Covers loading and empty states.\n\nexport type Transaction = {\n  id: string;\n  name: string;\n  /** Second line, e.g. \"Today · Groceries\". */\n  detail: string;\n  /** Negative for money out. */\n  amount: number;\n  status?: \"completed\" | \"pending\" | \"failed\";\n  imageUrl?: string;\n};\n\ntype TransactionListProps = {\n  title?: string;\n  transactions: Transaction[];\n  currency?: string;\n  locale?: string;\n  loading?: boolean;\n  onSeeAll?: () => void;\n  onSelect?: (transaction: Transaction) => void;\n  className?: string;\n};\n\nconst initials = (name: string) =>\n  name\n    .split(/\\s+/)\n    .slice(0, 2)\n    .map((word) => word[0]?.toUpperCase())\n    .join(\"\");\n\nfunction TransactionList({\n  title = \"Recent activity\",\n  transactions,\n  currency = \"USD\",\n  locale = \"en-US\",\n  loading = false,\n  onSeeAll,\n  onSelect,\n  className,\n}: TransactionListProps) {\n  const money = new Intl.NumberFormat(locale, {\n    style: \"currency\",\n    currency,\n    signDisplay: \"always\",\n  });\n\n  return (\n    <Card data-slot=\"transaction-list\" className={cn(\"gap-2\", className)}>\n      <CardHeader>\n        <CardTitle>\n          <h2>{title}</h2>\n        </CardTitle>\n        {onSeeAll && (\n          <CardAction>\n            <Button variant=\"ghost\" size=\"sm\" onClick={onSeeAll}>\n              See all\n            </Button>\n          </CardAction>\n        )}\n      </CardHeader>\n      <CardContent aria-busy={loading || undefined}>\n        {loading ? (\n          <div className=\"flex flex-col gap-5 py-3\">\n            {[0, 1, 2].map((row) => (\n              <div key={row} className=\"flex items-center gap-3\">\n                <Skeleton className=\"size-10 rounded-full\" />\n                <div className=\"flex flex-1 flex-col gap-2\">\n                  <Skeleton className=\"h-4 w-1/2\" />\n                  <Skeleton className=\"h-3 w-1/3\" />\n                </div>\n                <Skeleton className=\"h-4 w-16\" />\n              </div>\n            ))}\n          </div>\n        ) : transactions.length === 0 ? (\n          <div className=\"flex flex-col items-center gap-1 py-8 text-center\">\n            <p className=\"font-medium\">No transactions yet</p>\n            <p className=\"text-muted-foreground text-sm\">Payments and transfers will show here.</p>\n          </div>\n        ) : (\n          <List>\n            {transactions.map((t) => (\n              <ListItem\n                key={t.id}\n                interactive={Boolean(onSelect)}\n                onClick={onSelect ? () => onSelect(t) : undefined}\n                leading={\n                  <Avatar>\n                    {t.imageUrl && <AvatarImage src={t.imageUrl} alt=\"\" />}\n                    <AvatarFallback>{initials(t.name)}</AvatarFallback>\n                  </Avatar>\n                }\n                title={t.name}\n                description={t.detail}\n                trailing={\n                  <span className=\"flex flex-col items-end gap-1\">\n                    <span\n                      className={cn(\n                        \"font-mono text-sm\",\n                        t.amount > 0 && \"text-success\",\n                        t.status === \"failed\" && \"text-muted-foreground line-through\",\n                      )}\n                    >\n                      {money.format(t.amount)}\n                    </span>\n                    {t.status === \"pending\" && <Badge variant=\"warning\">Pending</Badge>}\n                    {t.status === \"failed\" && <Badge variant=\"destructive\">Failed</Badge>}\n                  </span>\n                }\n              />\n            ))}\n          </List>\n        )}\n      </CardContent>\n    </Card>\n  );\n}\n\nexport { TransactionList };\n"
    }
  ]
}
