{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "team-workload",
  "type": "registry:block",
  "title": "Team workload",
  "description": "Compare allocated time with each teammate’s capacity and make overload visible.",
  "categories": [
    "blocks"
  ],
  "dependencies": [
    "@tabler/icons-react"
  ],
  "registryDependencies": [],
  "files": [
    {
      "path": "src/registry/overtrue/team-workload.tsx",
      "type": "registry:component",
      "target": "components/overtrue/team-workload.tsx",
      "content": "import { useId } from \"react\";\nimport { IconAlertCircle } from \"@tabler/icons-react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface WorkloadMember {\n  id: string;\n  name: string;\n  role?: string;\n  image?: string;\n  allocated: number;\n  capacity: number;\n  href?: string;\n}\n\nexport function TeamWorkload({\n  title = \"Team workload\",\n  period = \"This week\",\n  members,\n  unit = \"h\",\n  className,\n}: {\n  title?: string;\n  period?: string;\n  members: readonly WorkloadMember[];\n  unit?: string;\n  className?: string;\n}) {\n  const id = useId();\n  return (\n    <section\n      data-slot=\"team-workload\"\n      aria-labelledby={id}\n      className={cn(\n        \"min-w-0 rounded-xl border border-border bg-card text-card-foreground\",\n        className,\n      )}\n    >\n      <header className=\"flex items-center justify-between gap-3 border-b border-border px-5 py-4\">\n        <h2 id={id} className=\"m-0 text-sm font-semibold\">\n          {title}\n        </h2>\n        <span className=\"text-xs text-muted-foreground\">{period}</span>\n      </header>\n      <ul className=\"m-0 list-none divide-y divide-border px-5\">\n        {members.map((member) => {\n          const allocated = Number.isFinite(member.allocated)\n            ? Math.max(0, member.allocated)\n            : 0;\n          const capacity = Number.isFinite(member.capacity)\n            ? Math.max(0, member.capacity)\n            : 0;\n          const over = allocated > capacity;\n          return (\n            <li key={member.id} data-slot=\"workload-member\" className=\"py-4\">\n              <div className=\"mb-2.5 flex items-center gap-2.5\">\n                <span className=\"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted text-[10px] font-medium text-muted-foreground\">\n                  {member.image ? (\n                    <img\n                      src={member.image}\n                      alt=\"\"\n                      className=\"size-full object-cover\"\n                    />\n                  ) : (\n                    member.name\n                      .split(/\\s+/)\n                      .slice(0, 2)\n                      .map((word) => word[0])\n                      .join(\"\")\n                  )}\n                </span>\n                <div className=\"min-w-0 flex-1\">\n                  <p className=\"m-0 text-xs font-medium\">\n                    {member.href ? (\n                      <a\n                        href={member.href}\n                        className=\"rounded-sm text-inherit hover:underline focus-visible:outline-2 focus-visible:outline-ring\"\n                      >\n                        {member.name}\n                      </a>\n                    ) : (\n                      member.name\n                    )}\n                  </p>\n                  {member.role && (\n                    <p className=\"m-0 mt-0.5 text-[11px] text-muted-foreground\">\n                      {member.role}\n                    </p>\n                  )}\n                </div>\n                <span\n                  className={cn(\n                    \"shrink-0 text-xs tabular-nums\",\n                    over ? \"text-destructive\" : \"text-muted-foreground\",\n                  )}\n                >\n                  {allocated}\n                  <span className=\"text-muted-foreground\">\n                    {\" \"}\n                    / {capacity}\n                    {unit}\n                  </span>\n                </span>\n              </div>\n              <div\n                role=\"meter\"\n                aria-label={`${member.name} workload`}\n                aria-valuenow={allocated}\n                aria-valuemin={0}\n                aria-valuemax={Math.max(capacity, allocated, 1)}\n                aria-valuetext={`${allocated} of ${capacity} ${unit}${over ? \", over capacity\" : \"\"}`}\n                className=\"h-1.5 overflow-hidden rounded-full bg-muted\"\n              >\n                <div\n                  className={cn(\n                    \"h-full rounded-full\",\n                    over ? \"bg-destructive/75\" : \"bg-primary/70\",\n                  )}\n                  style={{\n                    width: `${capacity ? Math.min(100, (allocated / capacity) * 100) : allocated ? 100 : 0}%`,\n                  }}\n                />\n              </div>\n              {over && (\n                <p className=\"mb-0 mt-2 flex items-center gap-1 text-[11px] text-destructive\">\n                  <IconAlertCircle size={12} aria-hidden=\"true\" />\n                  {allocated - capacity}\n                  {unit} over capacity\n                </p>\n              )}\n            </li>\n          );\n        })}\n      </ul>\n      {!members.length && (\n        <p className=\"m-0 px-5 py-8 text-center text-sm text-muted-foreground\">\n          No workload assigned.\n        </p>\n      )}\n    </section>\n  );\n}\n"
    }
  ],
  "docs": "Documentation: https://ui.overtrue.xyz/blocks/team-workload. Requires an initialized shadcn/ui project with Tailwind CSS v4."
}
