{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "gantt-chart",
  "title": "Gantt Chart",
  "description": "A project timeline with tasks grouped into collapsible phases, bars you drag to move or stretch to resize, milestones, dependency arrows that turn red and dashed when a task starts too early, one-click auto-scheduling, day and week zoom, a today line, keyboard moves and a details bar with a progress slider.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/gantt-chart/gantt-chart.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\nimport { clsx, type ClassValue } from \"clsx\";\nimport { twMerge } from \"tailwind-merge\";\n\nfunction cn(...inputs: ClassValue[]) {\n  return twMerge(clsx(inputs));\n}\n\nexport interface GanttTask {\n  id: string;\n  phase: string;\n  name: string;\n  start: number; // days from projectStart\n  duration: number; // 0 = milestone\n  progress: number; // 0–100\n  owner?: string;\n  dependsOn?: string[];\n}\nexport interface GanttPhase {\n  id: string;\n  name: string;\n  color: string;\n}\n\nexport interface GanttChartProps {\n  title?: string;\n  projectStart?: string; // YYYY-MM-DD, a Monday\n  days?: number;\n  today?: number; // day index\n  phases?: GanttPhase[];\n  tasks?: GanttTask[];\n  onTasksChange?: (tasks: GanttTask[]) => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.62)\", faint: \"rgba(245,244,241,0.36)\", panel: \"#0E0E0E\", card: \"#141414\", border: \"rgba(255,255,255,0.08)\", grid: \"rgba(255,255,255,0.05)\", weekend: \"rgba(255,255,255,0.025)\", sel: \"rgba(255,255,255,0.05)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", red: \"#F87171\", line: \"rgba(245,244,241,0.35)\", ring: \"rgba(245,244,241,0.6)\", track: \"rgba(255,255,255,0.08)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", panel: \"#F4F4F1\", card: \"#FFFFFF\", border: \"rgba(10,10,10,0.09)\", grid: \"rgba(10,10,10,0.06)\", weekend: \"rgba(10,10,10,0.03)\", sel: \"rgba(10,10,10,0.04)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", red: \"#DC2626\", line: \"rgba(10,10,10,0.35)\", ring: \"rgba(10,10,10,0.5)\", track: \"rgba(10,10,10,0.08)\" },\n};\n\nconst PHASES: GanttPhase[] = [\n  { id: \"discovery\", name: \"Discovery\", color: \"#60A5FA\" },\n  { id: \"design\", name: \"Design\", color: \"#A78BFA\" },\n  { id: \"build\", name: \"Build\", color: \"#34D399\" },\n  { id: \"launch\", name: \"Launch\", color: \"#FBBF24\" },\n];\nconst TASKS: GanttTask[] = [\n  { id: \"research\", phase: \"discovery\", name: \"User interviews\", start: 0, duration: 5, progress: 100, owner: \"Lena Brandt\" },\n  { id: \"audit\", phase: \"discovery\", name: \"Content audit\", start: 2, duration: 4, progress: 100, owner: \"Tomás Ferreira\" },\n  { id: \"scope\", phase: \"discovery\", name: \"Define scope\", start: 6, duration: 3, progress: 80, owner: \"Lena Brandt\", dependsOn: [\"research\", \"audit\"] },\n  { id: \"wire\", phase: \"design\", name: \"Wireframes\", start: 9, duration: 5, progress: 60, owner: \"Mia Okafor\", dependsOn: [\"scope\"] },\n  { id: \"visual\", phase: \"design\", name: \"Visual design\", start: 14, duration: 7, progress: 15, owner: \"Mia Okafor\", dependsOn: [\"wire\"] },\n  { id: \"review\", phase: \"design\", name: \"Design sign-off\", start: 21, duration: 0, progress: 0, dependsOn: [\"visual\"] },\n  { id: \"api\", phase: \"build\", name: \"CMS and API\", start: 9, duration: 10, progress: 35, owner: \"Daniel Reyes\", dependsOn: [\"scope\"] },\n  { id: \"front\", phase: \"build\", name: \"Frontend\", start: 21, duration: 10, progress: 0, owner: \"Tomás Ferreira\", dependsOn: [\"visual\"] },\n  { id: \"migrate\", phase: \"build\", name: \"Content migration\", start: 19, duration: 6, progress: 0, owner: \"Daniel Reyes\", dependsOn: [\"api\"] },\n  { id: \"qa\", phase: \"launch\", name: \"QA and fixes\", start: 31, duration: 5, progress: 0, owner: \"Lena Brandt\", dependsOn: [\"front\", \"migrate\"] },\n  { id: \"launch\", phase: \"launch\", name: \"Go live\", start: 36, duration: 0, progress: 0, dependsOn: [\"qa\"] },\n];\n\nconst RH = 36;\nconst MONTHS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\nconst dayDate = (base: string, n: number) => {\n  const [y, m, d] = base.split(\"-\").map(Number);\n  return new Date(Date.UTC(y, m - 1, d + n));\n};\nconst short = (base: string, n: number) => {\n  const d = dayDate(base, n);\n  return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}`;\n};\nconst initials = (n: string) =>\n  n\n    .split(\" \")\n    .map((w) => w[0])\n    .join(\"\")\n    .slice(0, 2);\nconst end = (t: GanttTask) => t.start + t.duration;\n\n/** Push every task to start no earlier than the end of what it depends on (one pass in dependency order). */\nfunction autoSchedule(tasks: GanttTask[]) {\n  const byId = new Map(tasks.map((t) => [t.id, { ...t }]));\n  const done = new Set<string>();\n  const visit = (id: string) => {\n    if (done.has(id)) return;\n    done.add(id);\n    const t = byId.get(id)!;\n    for (const d of t.dependsOn ?? []) visit(d);\n    const earliest = Math.max(t.start, ...(t.dependsOn ?? []).map((d) => end(byId.get(d)!)));\n    t.start = earliest;\n  };\n  tasks.forEach((t) => visit(t.id));\n  return tasks.map((t) => byId.get(t.id)!);\n}\n\nexport function GanttChart({ title = \"Website relaunch\", projectStart = \"2026-11-02\", days = 42, today = 10, phases = PHASES, tasks: initial = TASKS, onTasksChange, theme = \"dark\", className }: GanttChartProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [tasks, setTasks] = React.useState(initial);\n  const [zoom, setZoom] = React.useState<\"day\" | \"week\">(\"day\");\n  const [collapsed, setCollapsed] = React.useState<Record<string, boolean>>({});\n  const [selected, setSelected] = React.useState<string | null>(\"wire\");\n  const [drag, setDrag] = React.useState<null | { id: string; mode: \"move\" | \"resize\"; x0: number; start0: number; dur0: number; scale: number; moved: boolean }>(null);\n  const scrollRef = React.useRef<HTMLDivElement>(null);\n  const dw = zoom === \"day\" ? 30 : 13;\n  const W = days * dw;\n\n  const commit = (next: GanttTask[]) => {\n    setTasks(next);\n    onTasksChange?.(next);\n  };\n  const byId = new Map(tasks.map((t) => [t.id, t]));\n  const color = (t: GanttTask) => phases.find((ph) => ph.id === t.phase)?.color ?? p.on;\n\n  // Visible rows\n  type Row = { kind: \"phase\"; phase: GanttPhase } | { kind: \"task\"; task: GanttTask };\n  const rows: Row[] = phases.flatMap((ph) => [{ kind: \"phase\", phase: ph } as Row, ...(collapsed[ph.id] ? [] : tasks.filter((t) => t.phase === ph.id).map((t) => ({ kind: \"task\", task: t }) as Row))]);\n  const rowIndex = new Map<string, number>();\n  rows.forEach((r, i) => r.kind === \"task\" && rowIndex.set(r.task.id, i));\n\n  const links = tasks.flatMap((t) => (t.dependsOn ?? []).map((d) => ({ from: byId.get(d)!, to: t }))).filter((l) => l.from);\n  const conflicts = links.filter((l) => l.to.start < end(l.from));\n\n  const update = (id: string, patch: Partial<GanttTask>) => tasks.map((t) => (t.id === id ? { ...t, ...patch } : t));\n\n  const onPointerDown = (e: React.PointerEvent, t: GanttTask, mode: \"move\" | \"resize\") => {\n    if (e.button !== 0) return;\n    e.stopPropagation();\n    const el = e.currentTarget as HTMLElement;\n    el.setPointerCapture(e.pointerId);\n    const host = scrollRef.current!;\n    const scale = host.getBoundingClientRect().width / host.offsetWidth || 1;\n    setDrag({ id: t.id, mode, x0: e.clientX, start0: t.start, dur0: t.duration, scale, moved: false });\n    setSelected(t.id);\n  };\n  const onPointerMove = (e: React.PointerEvent) => {\n    if (!drag) return;\n    const delta = Math.round((e.clientX - drag.x0) / drag.scale / dw);\n    const moved = drag.moved || Math.abs(e.clientX - drag.x0) > 3;\n    if (moved !== drag.moved) setDrag({ ...drag, moved });\n    const t = byId.get(drag.id)!;\n    if (drag.mode === \"move\") {\n      const start = Math.min(Math.max(0, drag.start0 + delta), days - Math.max(1, t.duration));\n      if (start !== t.start) setTasks(update(drag.id, { start }));\n    } else {\n      const duration = Math.min(Math.max(1, drag.dur0 + delta), days - t.start);\n      if (duration !== t.duration) setTasks(update(drag.id, { duration }));\n    }\n  };\n  const onPointerUp = () => {\n    if (drag?.moved) onTasksChange?.(tasks);\n    setDrag(null);\n  };\n\n  const onBarKey = (e: React.KeyboardEvent, t: GanttTask) => {\n    const step = e.key === \"ArrowLeft\" ? -1 : e.key === \"ArrowRight\" ? 1 : 0;\n    if (!step) return;\n    e.preventDefault();\n    if (e.shiftKey && t.duration > 0) commit(update(t.id, { duration: Math.min(Math.max(1, t.duration + step), days - t.start) }));\n    else commit(update(t.id, { start: Math.min(Math.max(0, t.start + step), days - Math.max(1, t.duration)) }));\n  };\n\n  const scrollToToday = () => {\n    const el = scrollRef.current;\n    if (!el) return;\n    const left = el.querySelector<HTMLElement>(\"[data-left]\")?.offsetWidth ?? 0;\n    el.scrollTo({ left: Math.max(0, today * dw - (el.clientWidth - left) / 2), behavior: reduce ? \"auto\" : \"smooth\" });\n  };\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const btn = cn(\"flex h-8 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 text-[13px] font-medium disabled:cursor-not-allowed disabled:opacity-40\", focus);\n  const sel = selected ? byId.get(selected) : undefined;\n\n  // Header cells\n  const weeks = Array.from({ length: Math.ceil(days / 7) }, (_, i) => i * 7);\n\n  const linkPath = (from: GanttTask, to: GanttTask) => {\n    const y1 = rowIndex.get(from.id)! * RH + RH / 2;\n    const y2 = rowIndex.get(to.id)! * RH + RH / 2;\n    const x1 = end(from) * dw + (from.duration ? 0 : 6);\n    const x2 = to.start * dw - (to.duration ? 0 : 6);\n    if (x2 - x1 >= 12) {\n      const mx = x1 + 6;\n      return `M${x1} ${y1} H${mx} V${y2} H${x2 - 1}`;\n    }\n    const midY = y1 + (y2 > y1 ? RH / 2 : -RH / 2);\n    return `M${x1} ${y1} H${x1 + 6} V${midY} H${x2 - 8} V${y2} H${x2 - 1}`;\n  };\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      {/* Toolbar */}\n      <div className=\"flex flex-wrap items-center gap-2 border-b px-4 py-3 @[640px]:px-5\" style={{ borderColor: p.border }}>\n        <div className=\"mr-auto min-w-0\">\n          <h2 className=\"m-0 truncate text-[17px] font-semibold tracking-[-0.01em]\">{title}</h2>\n          <p className=\"m-0 text-[12.5px] tabular-nums\" style={{ color: p.faint }}>\n            {short(projectStart, 0)} – {short(projectStart, days - 1)} · {tasks.filter((t) => t.duration).length} tasks · {tasks.filter((t) => !t.duration).length} milestones\n          </p>\n        </div>\n        <AnimatePresence initial={false}>\n          {conflicts.length > 0 && (\n            <motion.button\n              key=\"fix\"\n              type=\"button\"\n              initial={reduce ? false : { opacity: 0, scale: 0.9 }}\n              animate={{ opacity: 1, scale: 1 }}\n              exit={reduce ? undefined : { opacity: 0, scale: 0.9 }}\n              onClick={() => commit(autoSchedule(tasks))}\n              className={cn(btn, \"border bg-transparent\")}\n              style={{ borderColor: `${p.red}66`, color: p.red, ...ring }}\n            >\n              <span className=\"h-1.5 w-1.5 rounded-full\" style={{ background: p.red }} aria-hidden=\"true\" />\n              {conflicts.length} {conflicts.length === 1 ? \"conflict\" : \"conflicts\"} · Auto-schedule\n            </motion.button>\n          )}\n        </AnimatePresence>\n        <button type=\"button\" onClick={scrollToToday} className={cn(btn, \"border bg-transparent\")} style={{ borderColor: p.border, color: p.text, ...ring }}>\n          Today\n        </button>\n        <div role=\"radiogroup\" aria-label=\"Zoom\" className=\"flex rounded-lg border p-0.5\" style={{ borderColor: p.border }}>\n          {([\"day\", \"week\"] as const).map((z) => (\n            <button key={z} type=\"button\" role=\"radio\" aria-checked={zoom === z} onClick={() => setZoom(z)} className={cn(\"relative h-7 cursor-pointer rounded-md border-0 bg-transparent px-3 text-[12.5px] font-medium capitalize\", focus)} style={{ color: zoom === z ? p.onText : p.muted, ...ring }}>\n              {zoom === z && <motion.span layoutId={`${uid}-zoom`} className=\"absolute inset-0 rounded-md\" style={{ background: p.on }} transition={reduce ? { duration: 0 } : { type: \"spring\", stiffness: 520, damping: 38 }} />}\n              <span className=\"relative\">{z === \"day\" ? \"Days\" : \"Weeks\"}</span>\n            </button>\n          ))}\n        </div>\n      </div>\n\n      {/* Chart */}\n      <div ref={scrollRef} className=\"relative overflow-x-auto overscroll-x-contain\" style={{ scrollbarWidth: \"thin\" }}>\n        <div className=\"grid [--gl:150px] @[640px]:[--gl:280px]\" style={{ gridTemplateColumns: `var(--gl) minmax(${W}px, 1fr)`, width: \"max-content\", minWidth: \"100%\" }}>\n          {/* Header */}\n          <div data-left className=\"sticky left-0 z-20 flex items-end border-r border-b px-4 pb-2 text-[11.5px] font-medium tracking-[0.04em] uppercase\" style={{ background: p.panel, borderColor: p.border, color: p.faint }}>\n            <span className=\"flex-1\">Task</span>\n            <span className=\"hidden w-14 text-right @[640px]:block\">Owner</span>\n            <span className=\"hidden w-12 text-right @[640px]:block\">Done</span>\n          </div>\n          <div className=\"border-b\" style={{ borderColor: p.border }}>\n            <div className=\"relative h-6\">\n              {weeks.map((w) => (\n                <span key={w} className=\"absolute top-1.5 border-l pl-1.5 text-[11px] font-medium whitespace-nowrap\" style={{ left: w * dw, borderColor: p.border, color: p.muted }}>\n                  {short(projectStart, w)}\n                </span>\n              ))}\n            </div>\n            <div className=\"relative h-6\">\n              {zoom === \"day\" &&\n                Array.from({ length: days }, (_, i) => (\n                  <span key={i} className=\"absolute top-1 text-center text-[10.5px] tabular-nums\" style={{ left: i * dw, width: dw, color: i === today ? p.red : i % 7 > 4 ? p.faint : p.muted, fontWeight: i === today ? 600 : 400 }}>\n                    {dayDate(projectStart, i).getUTCDate()}\n                  </span>\n                ))}\n            </div>\n          </div>\n\n          {/* Left column */}\n          <div className=\"sticky left-0 z-10 border-r\" style={{ background: p.panel, borderColor: p.border }}>\n            {rows.map((r) =>\n              r.kind === \"phase\" ? (\n                <button key={`ph-${r.phase.id}`} type=\"button\" onClick={() => setCollapsed((c) => ({ ...c, [r.phase.id]: !c[r.phase.id] }))} aria-expanded={!collapsed[r.phase.id]} className={cn(\"flex w-full cursor-pointer items-center gap-2 border-0 bg-transparent px-3 text-left text-[12.5px] font-semibold @[640px]:px-4\", focus)} style={{ height: RH, color: p.text, ...ring }}>\n                  <motion.svg width=\"11\" height=\"11\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" strokeLinejoin=\"round\" initial={false} animate={{ rotate: collapsed[r.phase.id] ? 0 : 90 }} aria-hidden=\"true\">\n                    <path d=\"m9 6 6 6-6 6\" />\n                  </motion.svg>\n                  <span className=\"h-2 w-2 shrink-0 rounded-full\" style={{ background: r.phase.color }} />\n                  <span className=\"truncate\">{r.phase.name}</span>\n                </button>\n              ) : (\n                <div key={r.task.id} onClick={() => setSelected(r.task.id)} className=\"flex cursor-pointer items-center gap-2 px-3 text-[13px] @[640px]:pr-4 @[640px]:pl-[38px]\" style={{ height: RH, background: selected === r.task.id ? p.sel : \"transparent\", color: selected === r.task.id ? p.text : p.muted }}>\n                  <span className=\"min-w-0 flex-1 truncate\">\n                    {!r.task.duration && <span aria-hidden=\"true\">◆ </span>}\n                    {r.task.name}\n                  </span>\n                  <span className=\"hidden w-14 justify-end @[640px]:flex\">\n                    {r.task.owner && (\n                      <span className=\"grid h-6 w-6 place-items-center rounded-full text-[10px] font-semibold\" style={{ background: `${color(r.task)}2a`, color: color(r.task) }} title={r.task.owner}>\n                        {initials(r.task.owner)}\n                      </span>\n                    )}\n                  </span>\n                  <span className=\"hidden w-12 text-right text-[12px] tabular-nums @[640px]:block\" style={{ color: r.task.progress === 100 ? color(r.task) : p.faint }}>\n                    {r.task.duration ? `${r.task.progress}%` : \"—\"}\n                  </span>\n                </div>\n              ),\n            )}\n          </div>\n\n          {/* Timeline */}\n          <div className=\"relative\" style={{ height: rows.length * RH }} onPointerMove={onPointerMove} onPointerUp={onPointerUp}>\n            {/* weekends + grid */}\n            {Array.from({ length: days }, (_, i) =>\n              i % 7 > 4 || i % 7 === 0 ? <span key={`d${i}`} className=\"absolute inset-y-0\" style={{ left: i * dw, width: i % 7 === 0 ? 1 : dw, background: i % 7 === 0 ? p.grid : p.weekend }} aria-hidden=\"true\" /> : null,\n            )}\n            {rows.map((r, i) => (\n              <span key={`r${i}`} className=\"absolute inset-x-0\" style={{ top: i * RH, height: RH, background: r.kind === \"task\" && r.task.id === selected ? p.sel : \"transparent\", borderBottom: r.kind === \"phase\" ? `1px solid ${p.grid}` : undefined }} aria-hidden=\"true\" />\n            ))}\n            {/* today */}\n            <span className=\"pointer-events-none absolute inset-y-0 z-[5] w-[2px]\" style={{ left: today * dw + dw / 2 - 1, background: p.red, opacity: 0.8 }} aria-hidden=\"true\" />\n\n            {/* dependency links */}\n            <svg className=\"pointer-events-none absolute inset-0 z-[6] overflow-visible\" width={W} height={rows.length * RH} aria-hidden=\"true\">\n              <defs>\n                <marker id={`${uid}-a`} viewBox=\"0 0 6 6\" refX=\"5\" refY=\"3\" markerWidth=\"6\" markerHeight=\"6\" orient=\"auto\">\n                  <path d=\"M0 0 6 3 0 6z\" fill={p.line} />\n                </marker>\n                <marker id={`${uid}-r`} viewBox=\"0 0 6 6\" refX=\"5\" refY=\"3\" markerWidth=\"6\" markerHeight=\"6\" orient=\"auto\">\n                  <path d=\"M0 0 6 3 0 6z\" fill={p.red} />\n                </marker>\n              </defs>\n              {links.map((l) => {\n                if (!rowIndex.has(l.from.id) || !rowIndex.has(l.to.id)) return null;\n                const bad = l.to.start < end(l.from);\n                return <path key={`${l.from.id}-${l.to.id}`} d={linkPath(l.from, l.to)} fill=\"none\" stroke={bad ? p.red : p.line} strokeWidth={bad ? 1.5 : 1.2} strokeDasharray={bad ? \"4 3\" : undefined} markerEnd={`url(#${uid}-${bad ? \"r\" : \"a\"})`} />;\n              })}\n            </svg>\n\n            {/* bars */}\n            {rows.map((r, i) => {\n              if (r.kind === \"phase\") {\n                const list = tasks.filter((t) => t.phase === r.phase.id);\n                const s = Math.min(...list.map((t) => t.start));\n                const e = Math.max(...list.map(end));\n                return <motion.span key={`ph-${r.phase.id}`} className=\"absolute z-[4] h-1.5 rounded-full\" initial={false} animate={{ left: s * dw, width: Math.max(4, (e - s) * dw) }} transition={{ duration: drag || reduce ? 0 : 0.3 }} style={{ top: i * RH + RH / 2 - 3, background: `${r.phase.color}55` }} aria-hidden=\"true\" />;\n              }\n              const t = r.task;\n              const c = color(t);\n              const isSel = selected === t.id;\n              const bad = conflicts.some((l) => l.to.id === t.id);\n              const label = `${t.name}, ${short(projectStart, t.start)}${t.duration ? ` to ${short(projectStart, end(t) - 1)}, ${t.duration} days, ${t.progress}% done` : \", milestone\"}. Arrow keys move${t.duration ? \", Shift + arrows resize\" : \"\"}.`;\n              if (!t.duration)\n                return (\n                  <motion.button key={t.id} type=\"button\" aria-label={label} onPointerDown={(e) => onPointerDown(e, t, \"move\")} onKeyDown={(e) => onBarKey(e, t)} onFocus={() => setSelected(t.id)} initial={false} animate={{ left: t.start * dw - 8 }} transition={{ duration: drag || reduce ? 0 : 0.3 }} className={cn(\"absolute z-[7] h-4 w-4 cursor-grab touch-none rounded-[3px] border-0 active:cursor-grabbing\", focus)} style={{ top: i * RH + RH / 2 - 8, rotate: 45, background: c, boxShadow: isSel ? `0 0 0 2px ${p.bg}, 0 0 0 3.5px ${c}` : \"0 0 0 0 transparent\", ...ring }} />\n                );\n              return (\n                <motion.div key={t.id} className=\"absolute z-[7]\" initial={false} animate={{ left: t.start * dw, width: t.duration * dw }} transition={{ duration: drag || reduce ? 0 : 0.3, ease: [0.22, 1, 0.36, 1] }} style={{ top: i * RH + 7, height: RH - 14 }}>\n                  <button\n                    type=\"button\"\n                    aria-label={label}\n                    onPointerDown={(e) => onPointerDown(e, t, \"move\")}\n                    onKeyDown={(e) => onBarKey(e, t)}\n                    onFocus={() => setSelected(t.id)}\n                    className={cn(\"relative flex h-full w-full cursor-grab touch-none items-center overflow-hidden rounded-md border-0 p-0 text-left select-none active:cursor-grabbing\", focus)}\n                    style={{ background: `${c}33`, boxShadow: isSel ? `inset 0 0 0 1.5px ${c}` : bad ? `inset 0 0 0 1.5px ${p.red}` : \"inset 0 0 0 0 transparent\", ...ring }}\n                  >\n                    <motion.span className=\"absolute inset-y-0 left-0\" style={{ background: `${c}88` }} initial={false} animate={{ width: `${t.progress}%` }} transition={{ duration: reduce ? 0 : 0.35 }} />\n                    <span className=\"relative truncate px-2 text-[11.5px] font-medium\" style={{ color: p.text }}>\n                      {t.duration * dw > 70 ? t.name : \"\"}\n                    </span>\n                  </button>\n                  <span onPointerDown={(e) => onPointerDown(e, t, \"resize\")} className=\"absolute inset-y-0 -right-1 w-3 cursor-ew-resize touch-none\" aria-hidden=\"true\">\n                    <span className=\"absolute inset-y-1.5 right-1 w-[3px] rounded-full opacity-70\" style={{ background: c }} />\n                  </span>\n                </motion.div>\n              );\n            })}\n          </div>\n        </div>\n      </div>\n\n      {/* Selected task */}\n      <div className=\"flex min-h-[64px] flex-wrap items-center gap-x-6 gap-y-3 border-t px-4 py-3 @[640px]:px-5\" style={{ borderColor: p.border }} aria-live=\"polite\">\n        {sel ? (\n          <>\n            <div className=\"min-w-0\">\n              <p className=\"m-0 flex items-center gap-2 text-[13.5px] font-semibold\">\n                <span className=\"h-2 w-2 rounded-full\" style={{ background: color(sel) }} />\n                {sel.name}\n              </p>\n              <p className=\"m-0 mt-0.5 text-[12.5px] tabular-nums\" style={{ color: p.muted }}>\n                {sel.duration ? `${short(projectStart, sel.start)} – ${short(projectStart, end(sel) - 1)} · ${sel.duration} days` : `Milestone · ${short(projectStart, sel.start)}`}\n                {sel.dependsOn?.length ? ` · after ${sel.dependsOn.map((d) => byId.get(d)?.name).join(\", \")}` : \"\"}\n              </p>\n            </div>\n            {sel.duration > 0 && (\n              <label className=\"ml-auto flex items-center gap-3 text-[12.5px]\" style={{ color: p.muted }}>\n                Progress\n                <input type=\"range\" min={0} max={100} step={5} value={sel.progress} onChange={(e) => commit(update(sel.id, { progress: Number(e.target.value) }))} className=\"w-32 cursor-pointer @[640px]:w-44\" style={{ accentColor: color(sel) }} />\n                <span className=\"w-9 text-right tabular-nums\" style={{ color: p.text }}>\n                  {sel.progress}%\n                </span>\n              </label>\n            )}\n          </>\n        ) : (\n          <p className=\"m-0 text-[12.5px]\" style={{ color: p.faint }}>\n            Select a bar to see its details.\n          </p>\n        )}\n      </div>\n    </section>\n  );\n}\n\nexport default GanttChart;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}