{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "v-table-10",
  "description": "Audit Log",
  "registryDependencies": [
    "@cnippet/table"
  ],
  "files": [
    {
      "path": "registry/default/variants/v-table-10.tsx",
      "content": "// title: Audit Log\n//biome-ignore-all lint/suspicious/noArrayIndexKey: <>\n\nimport {\n  Avatar,\n  AvatarFallback,\n  AvatarImage,\n} from \"@/registry/default/ui/avatar\";\nimport { Badge } from \"@/registry/default/ui/badge\";\nimport { Frame, FramePanel } from \"@/registry/default/ui/frame\";\nimport {\n  Table,\n  TableBody,\n  TableCell,\n  TableHead,\n  TableHeader,\n  TableRow,\n} from \"@/registry/default/ui/table\";\n\ntype ActionType =\n  | \"login\"\n  | \"export\"\n  | \"delete\"\n  | \"invite\"\n  | \"update\"\n  | \"create\";\n\nconst actionVariant: Record<\n  ActionType,\n  \"success\" | \"info\" | \"destructive\" | \"warning\" | \"outline\"\n> = {\n  create: \"success\",\n  delete: \"destructive\",\n  export: \"outline\",\n  invite: \"info\",\n  login: \"outline\",\n  update: \"warning\",\n};\n\nconst logs = [\n  {\n    action: \"delete\" as ActionType,\n    actor: {\n      avatar:\n        \"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=96&h=96&dpr=2&q=80\",\n      email: \"olivia@example.com\",\n      name: \"Olivia Martin\",\n    },\n    ip: \"192.168.1.42\",\n    resource: \"Project · Mobile App\",\n    time: \"2 min ago\",\n  },\n  {\n    action: \"invite\" as ActionType,\n    actor: {\n      avatar:\n        \"https://images.unsplash.com/photo-1535713875002-d1d0cf377fde?w=96&h=96&dpr=2&q=80\",\n      email: \"jackson@example.com\",\n      name: \"Jackson Lee\",\n    },\n    ip: \"10.0.0.15\",\n    resource: \"User · sofia@example.com\",\n    time: \"18 min ago\",\n  },\n  {\n    action: \"export\" as ActionType,\n    actor: {\n      avatar:\n        \"https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=96&h=96&dpr=2&q=80\",\n      email: \"isabella@example.com\",\n      name: \"Isabella Nguyen\",\n    },\n    ip: \"203.0.113.7\",\n    resource: \"Report · Q1 2025\",\n    time: \"1 hr ago\",\n  },\n  {\n    action: \"update\" as ActionType,\n    actor: {\n      avatar:\n        \"https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=96&h=96&dpr=2&q=80\",\n      email: \"william@example.com\",\n      name: \"William Kim\",\n    },\n    ip: \"172.16.0.3\",\n    resource: \"Settings · Billing\",\n    time: \"3 hr ago\",\n  },\n  {\n    action: \"login\" as ActionType,\n    actor: {\n      avatar:\n        \"https://images.unsplash.com/photo-1519699047748-de8e457a634e?w=96&h=96&dpr=2&q=80\",\n      email: \"sofia@example.com\",\n      name: \"Sofia Davis\",\n    },\n    ip: \"198.51.100.22\",\n    resource: \"Auth · Password\",\n    time: \"5 hr ago\",\n  },\n  {\n    action: \"create\" as ActionType,\n    actor: {\n      avatar:\n        \"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=96&h=96&dpr=2&q=80\",\n      email: \"olivia@example.com\",\n      name: \"Olivia Martin\",\n    },\n    ip: \"192.168.1.42\",\n    resource: \"API Key · Production\",\n    time: \"Yesterday\",\n  },\n];\n\nexport function Pattern() {\n  return (\n    <div className=\"mx-auto w-full max-w-3xl\">\n      <div className=\"mb-3 flex items-center justify-between\">\n        <p className=\"font-semibold text-sm\">Audit Log</p>\n        <span className=\"text-muted-foreground text-xs\">\n          {logs.length} recent events\n        </span>\n      </div>\n      <Frame>\n        <FramePanel className=\"p-0!\">\n          <Table>\n            <TableHeader>\n              <TableRow>\n                <TableHead>Actor</TableHead>\n                <TableHead>Action</TableHead>\n                <TableHead>Resource</TableHead>\n                <TableHead>IP Address</TableHead>\n                <TableHead className=\"text-right\">Time</TableHead>\n              </TableRow>\n            </TableHeader>\n            <TableBody>\n              {logs.map((log, i) => (\n                <TableRow key={i}>\n                  <TableCell>\n                    <div className=\"flex items-center gap-2.5\">\n                      <Avatar className=\"size-7\">\n                        <AvatarImage\n                          alt={log.actor.name}\n                          src={log.actor.avatar}\n                        />\n                        <AvatarFallback className=\"text-xs\">\n                          {log.actor.name\n                            .split(\" \")\n                            .map((n) => n[0])\n                            .join(\"\")}\n                        </AvatarFallback>\n                      </Avatar>\n                      <div className=\"flex flex-col\">\n                        <span className=\"font-medium text-xs\">\n                          {log.actor.name}\n                        </span>\n                        <span className=\"text-muted-foreground text-xs\">\n                          {log.actor.email}\n                        </span>\n                      </div>\n                    </div>\n                  </TableCell>\n                  <TableCell>\n                    <Badge size=\"sm\" variant={actionVariant[log.action]}>\n                      {log.action}\n                    </Badge>\n                  </TableCell>\n                  <TableCell className=\"text-muted-foreground text-xs\">\n                    {log.resource}\n                  </TableCell>\n                  <TableCell className=\"font-mono text-muted-foreground text-xs\">\n                    {log.ip}\n                  </TableCell>\n                  <TableCell className=\"text-right text-muted-foreground text-xs\">\n                    {log.time}\n                  </TableCell>\n                </TableRow>\n              ))}\n            </TableBody>\n          </Table>\n        </FramePanel>\n      </Frame>\n    </div>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": ""
  },
  "categories": [
    "table"
  ],
  "type": "registry:block"
}