{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "audit-trail",
  "type": "registry:ui",
  "title": "Audit trail",
  "description": "Bordered audit trail in React that renders a list of actor, action, target and time records as stacked log entries. Useful for security and admin history pages.",
  "dependencies": [],
  "registryDependencies": [
    "https://ui.minidev.pro/r/audit-log-entry.json",
    "utils"
  ],
  "files": [
    {
      "path": "registry/ui/audit-trail.tsx",
      "type": "registry:ui",
      "target": "components/ui/audit-trail.tsx",
      "content": "\"use client\"\nimport * as React from \"react\"\nimport { AuditLogEntry } from \"@/components/ui/audit-log-entry\"\nimport { cn } from \"@/lib/utils\"\n\ntype AuditEntry = { id: string; actor: string; action: string; time: string; target?: string }\n\n/** A bordered list of audit log entries, newest first, each with a relative timestamp. */\ntype AuditTrailProps = {\n  /** Entries to show. Omit for a sample trail with times relative to now. */\n  entries?: AuditEntry[]\n  className?: string\n}\n\n/** Sample rows, as minutes ago; turned into ISO timestamps at render time so the relative labels stay fresh. */\nconst SAMPLE_ROWS: { id: string; actor: string; action: string; target?: string; minutesAgo: number }[] = [\n  { id: \"t1\", actor: \"Maya Chen\", action: \"approved refund on\", target: \"INV-2041\", minutesAgo: 4 },\n  { id: \"t2\", actor: \"Theo Okafor\", action: \"deployed\", target: \"lumen-web v2.4.0\", minutesAgo: 38 },\n  { id: \"t3\", actor: \"Priya Raman\", action: \"changed the role of\", target: \"Sam Lowe to Write\", minutesAgo: 140 },\n  { id: \"t4\", actor: \"Sam Lowe\", action: \"exported customers to CSV\", minutesAgo: 300 },\n  { id: \"t5\", actor: \"Ada Novak\", action: \"rotated the API key for\", target: \"Northwind\", minutesAgo: 1560 },\n]\n\nfunction sampleEntries(now: number): AuditEntry[] {\n  return SAMPLE_ROWS.map(({ minutesAgo, ...row }) => ({ ...row, time: new Date(now - minutesAgo * 60_000).toISOString() }))\n}\n\nfunction AuditTrail({ entries, className }: AuditTrailProps) {\n  const list = React.useMemo(() => entries ?? sampleEntries(Date.now()), [entries])\n  return (\n    <div data-slot=\"audit-trail\" className={cn(\"w-full max-w-md rounded-xl border border-border px-3\", className)}>\n      {list.map((e) => (\n        <AuditLogEntry key={e.id} actor={e.actor} action={e.action} date={e.time} target={e.target} />\n      ))}\n    </div>\n  )\n}\nexport { AuditTrail }\nexport type { AuditTrailProps, AuditEntry }\n"
    }
  ]
}
