{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ds-gantt",
  "title": "Gantt",
  "description": "Timeline Gantt com barras e progresso — adaptado Kibo.",
  "dependencies": [
    "class-variance-authority"
  ],
  "registryDependencies": [
    "@lema-ds/skeleton"
  ],
  "files": [
    {
      "path": "components/ds/ds-gantt.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { Skeleton } from \"@/components/ui/skeleton\"\n\n// ── Types ──────────────────────────────────────────────────────────────────\n\nexport interface GanttTask {\n  id: string\n  name: string\n  start: number\n  end: number\n  progress?: number\n  color?: string\n}\n\nexport interface GanttProps\n  extends\n    React.HTMLAttributes<HTMLDivElement>,\n    VariantProps<typeof ganttVariants> {\n  tasks: GanttTask[]\n  range?: [number, number]\n  loading?: boolean\n}\n\n// ── Variants ───────────────────────────────────────────────────────────────\n\nexport const ganttVariants = cva(\n  \"w-full overflow-x-auto rounded-2xl border bg-card p-4\",\n  {\n    variants: {\n      size: {\n        sm: \"text-xs\",\n        md: \"text-sm\",\n      },\n    },\n    defaultVariants: { size: \"md\" },\n  }\n)\n\n// ── Component ──────────────────────────────────────────────────────────────\n\nexport function Gantt({\n  className,\n  tasks,\n  range,\n  size = \"md\",\n  loading = false,\n  ...props\n}: GanttProps) {\n  if (loading) {\n    return (\n      <div\n        data-slot=\"gantt-skeleton\"\n        className={cn(ganttVariants({ size }), className)}\n        {...props}\n      >\n        <div className=\"flex flex-col gap-2\">\n          {Array.from({ length: 4 }).map((_, i) => (\n            <Skeleton key={i} className=\"h-6 w-full rounded-md\" />\n          ))}\n        </div>\n      </div>\n    )\n  }\n\n  const min = range?.[0] ?? Math.min(...tasks.map((t) => t.start))\n  const max = range?.[1] ?? Math.max(...tasks.map((t) => t.end))\n  const total = max - min || 1\n\n  return (\n    <div\n      data-slot=\"gantt\"\n      className={cn(ganttVariants({ size }), className)}\n      {...props}\n    >\n      <div className=\"flex flex-col gap-3\">\n        {tasks.map((task) => {\n          const left = ((task.start - min) / total) * 100\n          const width = ((task.end - task.start) / total) * 100\n          return (\n            <div key={task.id} className=\"flex items-center gap-3\">\n              <span className=\"w-24 shrink-0 truncate text-xs font-medium text-muted-foreground\">\n                {task.name}\n              </span>\n              <div className=\"relative h-6 flex-1 rounded-full bg-muted\">\n                <div\n                  className=\"absolute top-0 h-6 rounded-full bg-primary transition-all\"\n                  style={{\n                    left: `${left}%`,\n                    width: `${width}%`,\n                    backgroundColor: task.color,\n                  }}\n                  aria-label={`${task.name} ${task.progress ?? 0}%`}\n                  role=\"progressbar\"\n                  aria-valuenow={task.progress}\n                  aria-valuemin={0}\n                  aria-valuemax={100}\n                >\n                  {typeof task.progress === \"number\" && (\n                    <span\n                      className=\"absolute inset-0 rounded-full bg-primary-foreground/20\"\n                      style={{ width: `${task.progress}%` }}\n                    />\n                  )}\n                </div>\n              </div>\n            </div>\n          )\n        })}\n      </div>\n    </div>\n  )\n}\n",
      "type": "registry:ui"
    }
  ],
  "type": "registry:ui"
}
