{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "v-tooltip-16",
  "description": "Permissions matrix with role access details per cell",
  "registryDependencies": [
    "@cnippet/tooltip"
  ],
  "files": [
    {
      "path": "registry/default/variants/v-tooltip-16.tsx",
      "content": "// title: Permissions matrix with role access details per cell\nimport { CheckIcon, MinusIcon } from \"lucide-react\";\nimport {\n  Tooltip,\n  TooltipContent,\n  TooltipProvider,\n  TooltipTrigger,\n} from \"@/registry/default/ui/tooltip\";\n\ntype Access = \"full\" | \"read\" | \"none\";\n\ntype Permission = {\n  resource: string;\n  admin: Access;\n  editor: Access;\n  viewer: Access;\n  detail: string;\n};\n\nconst permissions: Permission[] = [\n  {\n    admin: \"full\",\n    detail: \"Create, update, and delete workspace members and their roles.\",\n    editor: \"none\",\n    resource: \"Members\",\n    viewer: \"none\",\n  },\n  {\n    admin: \"full\",\n    detail: \"Publish, archive, and permanently remove documents.\",\n    editor: \"full\",\n    resource: \"Documents\",\n    viewer: \"read\",\n  },\n  {\n    admin: \"full\",\n    detail: \"Manage API keys, OAuth apps, and third-party connections.\",\n    editor: \"read\",\n    resource: \"Integrations\",\n    viewer: \"none\",\n  },\n  {\n    admin: \"full\",\n    detail: \"View and export activity logs for auditing.\",\n    editor: \"read\",\n    resource: \"Audit Logs\",\n    viewer: \"none\",\n  },\n];\n\nconst roles = [\"admin\", \"editor\", \"viewer\"] as const;\n\nfunction AccessCell({ access, detail }: { access: Access; detail: string }) {\n  const icon =\n    access === \"full\" ? (\n      <CheckIcon className=\"size-3.5 text-success-foreground\" />\n    ) : access === \"read\" ? (\n      <CheckIcon className=\"size-3.5 text-warning-foreground\" />\n    ) : (\n      <MinusIcon className=\"size-3.5 text-muted-foreground\" />\n    );\n\n  const label =\n    access === \"full\"\n      ? \"Full access\"\n      : access === \"read\"\n        ? \"Read only\"\n        : \"No access\";\n\n  return (\n    <Tooltip>\n      <TooltipTrigger className=\"flex cursor-default items-center justify-center\">\n        {icon}\n      </TooltipTrigger>\n      <TooltipContent className=\"p-2.5\">\n        <p className=\"font-medium\">{label}</p>\n        <p className=\"max-w-44 text-muted-foreground\">{detail}</p>\n      </TooltipContent>\n    </Tooltip>\n  );\n}\n\nexport function Pattern() {\n  return (\n    <div className=\"w-full max-w-sm overflow-hidden rounded-xl border bg-card\">\n      <TooltipProvider>\n        <table className=\"w-full text-sm\">\n          <thead>\n            <tr className=\"border-b bg-muted/40\">\n              <th className=\"px-4 py-2.5 text-left font-medium text-muted-foreground\">\n                Resource\n              </th>\n              {roles.map((role) => (\n                <th\n                  className=\"px-4 py-2.5 text-center font-medium text-muted-foreground capitalize\"\n                  key={role}\n                >\n                  {role}\n                </th>\n              ))}\n            </tr>\n          </thead>\n          <tbody>\n            {permissions.map(({ resource, admin, editor, viewer, detail }) => (\n              <tr className=\"border-b last:border-0\" key={resource}>\n                <td className=\"px-4 py-2.5 font-medium\">{resource}</td>\n                <td className=\"px-4 py-2.5 text-center\">\n                  <AccessCell access={admin} detail={detail} />\n                </td>\n                <td className=\"px-4 py-2.5 text-center\">\n                  <AccessCell access={editor} detail={detail} />\n                </td>\n                <td className=\"px-4 py-2.5 text-center\">\n                  <AccessCell access={viewer} detail={detail} />\n                </td>\n              </tr>\n            ))}\n          </tbody>\n        </table>\n      </TooltipProvider>\n    </div>\n  );\n}\n",
      "type": "registry:block"
    }
  ],
  "meta": {
    "className": ""
  },
  "categories": [
    "tooltip"
  ],
  "type": "registry:block"
}