{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "kanban-01",
  "description": "A sprint board of issues in columns with labels, assignees, due dates and priorities, and warnings when a column passes its limit.",
  "registryDependencies": [
    "https://www.dashboardblocks.com/r/radix/block-state.json",
    "https://www.dashboardblocks.com/r/radix/kanban.json",
    "https://www.dashboardblocks.com/r/radix/schedule.json"
  ],
  "files": [
    {
      "path": "registry/components/dashboardblocks/kanban/kanban-01.tsx",
      "content": "'use client'\n\nimport {\n  BlockReady,\n  BlockStateProvider,\n  BlockStateRows,\n  type BlockStateProps,\n  getBlockState,\n} from '@/registry/components/dashboardblocks/block-state'\nimport {\n  KanbanAssignees,\n  KanbanAttachments,\n  KanbanBoard,\n  KanbanCard,\n  KanbanCardMenu,\n  KanbanCardTitle,\n  KanbanColumn,\n  type KanbanColumnDef,\n  KanbanComments,\n  KanbanDueDate,\n  type KanbanItem,\n  type KanbanLabelDef,\n  KanbanLabels,\n  KanbanPriority,\n  type KanbanPriorityLevel,\n  KanbanSubtasks,\n  getColumnItems,\n  moveItem,\n} from '@/registry/components/dashboardblocks/kanban'\nimport { getDayOffset } from '@/registry/components/dashboardblocks/schedule'\nimport { useMemo, useState } from 'react'\n\ninterface SprintIssue extends KanbanItem {\n  assignees: string[]\n  attachments?: number\n  comments?: number\n  due?: Date\n  key: string\n  labels: KanbanLabelDef[]\n  priority: KanbanPriorityLevel\n  subtasks?: { done: number; total: number }\n}\n\ninterface Kanban1Props extends BlockStateProps {\n  columns: KanbanColumnDef[]\n  /** The column that counts as finished: its due dates lose their urgency. */\n  doneColumn: string\n  /** Leave out, or pass none, to show the empty state. */\n  issues?: SprintIssue[]\n  /** Pass a fixed date, so due dates render the same on the server and in the browser. */\n  now: Date\n  onMove?: (id: string, column: string, index: number) => void\n  /** Such as `Sep 21 – Oct 4`. */\n  period: string\n  project: string\n  title: string\n}\n\nconst NOW = Date.UTC(2026, 8, 28, 10)\nconst noIssues: SprintIssue[] = []\n\nconst inDays = (days: number) => new Date(NOW + days * 86_400_000)\n\nconst labels = {\n  api: { name: 'API', tone: 'info' },\n  bug: { name: 'Bug', tone: 'danger' },\n  design: { name: 'Design', tone: 'accent' },\n  feature: { name: 'Feature', tone: 'success' },\n  infra: { name: 'Infra', tone: 'neutral' },\n  perf: { name: 'Performance', tone: 'warning' },\n} satisfies Record<string, KanbanLabelDef>\n\nconst exampleProps: Kanban1Props = {\n  columns: [\n    { color: 'var(--color-muted-foreground)', id: 'backlog', title: 'Backlog' },\n    { color: 'var(--color-chart-3)', id: 'todo', title: 'To do' },\n    { color: 'var(--color-chart-2)', id: 'progress', title: 'In progress', wipLimit: 3 },\n    { color: 'var(--color-chart-5)', id: 'review', title: 'In review', wipLimit: 2 },\n    { color: 'var(--color-chart-4)', id: 'done', title: 'Done' },\n  ],\n  doneColumn: 'done',\n  issues: [\n    {\n      assignees: [],\n      column: 'backlog',\n      comments: 2,\n      id: 'web-171',\n      key: 'WEB-171',\n      labels: [labels.feature],\n      priority: 'low',\n      title: 'Saved filters on the orders table',\n    },\n    {\n      assignees: ['Noah Becker'],\n      column: 'backlog',\n      id: 'web-168',\n      key: 'WEB-168',\n      labels: [labels.infra],\n      priority: 'medium',\n      title: 'Move preview deploys to the new runner pool',\n    },\n    {\n      assignees: [],\n      attachments: 1,\n      column: 'backlog',\n      id: 'web-165',\n      key: 'WEB-165',\n      labels: [labels.design],\n      priority: 'low',\n      title: 'Empty states for reports',\n    },\n    {\n      assignees: ['Priya Nair'],\n      column: 'todo',\n      comments: 4,\n      due: inDays(3),\n      id: 'web-158',\n      key: 'WEB-158',\n      labels: [labels.feature, labels.api],\n      priority: 'high',\n      subtasks: { done: 0, total: 4 },\n      title: 'Webhooks for refund events',\n    },\n    {\n      assignees: ['Tomás Ortega'],\n      column: 'todo',\n      due: inDays(6),\n      id: 'web-161',\n      key: 'WEB-161',\n      labels: [labels.perf],\n      priority: 'medium',\n      title: 'Lazy-load chart bundles on the overview',\n    },\n    {\n      assignees: ['Aiko Tanaka', 'Priya Nair'],\n      attachments: 3,\n      column: 'progress',\n      comments: 7,\n      due: inDays(-1),\n      id: 'web-142',\n      key: 'WEB-142',\n      labels: [labels.bug],\n      priority: 'urgent',\n      subtasks: { done: 2, total: 3 },\n      title: 'Checkout fails on Safari 17',\n    },\n    {\n      assignees: ['Lena Fischer'],\n      column: 'progress',\n      comments: 3,\n      due: inDays(0),\n      id: 'web-150',\n      key: 'WEB-150',\n      labels: [labels.feature, labels.design],\n      priority: 'high',\n      subtasks: { done: 3, total: 5 },\n      title: 'Team invites with roles',\n    },\n    {\n      assignees: ['Noah Becker'],\n      column: 'progress',\n      due: inDays(4),\n      id: 'web-153',\n      key: 'WEB-153',\n      labels: [labels.api],\n      priority: 'medium',\n      title: 'Rate limit the public search endpoint',\n    },\n    {\n      assignees: ['Tomás Ortega', 'Lena Fischer', 'Aiko Tanaka', 'Priya Nair'],\n      attachments: 2,\n      column: 'review',\n      comments: 12,\n      due: inDays(1),\n      id: 'web-147',\n      key: 'WEB-147',\n      labels: [labels.perf],\n      priority: 'high',\n      subtasks: { done: 6, total: 6 },\n      title: 'Cut dashboard load time under one second',\n    },\n    {\n      assignees: ['Priya Nair'],\n      column: 'done',\n      comments: 5,\n      due: inDays(-2),\n      id: 'web-139',\n      key: 'WEB-139',\n      labels: [labels.bug],\n      priority: 'high',\n      title: 'CSV export drops rows past 10,000',\n    },\n    {\n      assignees: ['Aiko Tanaka'],\n      column: 'done',\n      due: inDays(-4),\n      id: 'web-136',\n      key: 'WEB-136',\n      labels: [labels.design],\n      priority: 'medium',\n      subtasks: { done: 4, total: 4 },\n      title: 'Dark mode for the billing pages',\n    },\n  ],\n  now: new Date(NOW),\n  period: 'Sep 21 – Oct 4',\n  project: 'Web app',\n  title: 'Sprint 24',\n}\n\nconst Kanban1 = (props: Kanban1Props) => {\n  const {\n    columns,\n    doneColumn,\n    issues: loadedIssues = noIssues,\n    now,\n    onMove,\n    period,\n    project,\n    errorMessage,\n    status,\n    title,\n  } = props\n  const [moves, setMoves] = useState<{ column: string; id: string; index: number }[]>([])\n  const issues = useMemo(\n    () =>\n      moves.reduce(\n        (current, move) => moveItem(current, move.id, move.column, move.index),\n        loadedIssues,\n      ),\n    [loadedIssues, moves],\n  )\n  const state = getBlockState(status, loadedIssues)\n  const done = getColumnItems(issues, doneColumn).length\n  const overdue = issues.filter(\n    (issue) =>\n      issue.column !== doneColumn && issue.due && getDayOffset(issue.due, now) < 0,\n  ).length\n\n  return (\n    <BlockStateProvider errorMessage={errorMessage} state={state}>\n      <section className='@container flex flex-col gap-3'>\n        <header className='flex flex-col gap-0.5'>\n          <h2 className='font-semibold tracking-tight'>{title}</h2>\n          <BlockReady className='text-sm'>\n            <p className='text-muted-foreground text-sm'>\n              {project}, {period}. {done} of {issues.length} issues done\n              {overdue > 0 ? `, ${overdue} overdue.` : '.'}\n            </p>\n          </BlockReady>\n        </header>\n        {(state === 'empty' || state === 'error') && (\n          <BlockStateRows className='border-t pt-3' />\n        )}\n        {(state === undefined || state === 'loading') && (\n          <KanbanBoard\n            className='pb-2'\n            columns={columns}\n            itemName={{ one: 'issue', other: 'issues' }}\n            items={issues}\n            label={`${title} board`}\n            onMove={(id, column, index) => {\n              setMoves((current) => [...current, { column, id, index }])\n              onMove?.(id, column, index)\n            }}\n          >\n            {columns.map((column) => (\n              <KanbanColumn key={column.id} column={column}>\n                {getColumnItems(issues, column.id).map((issue) => (\n                  <KanbanCard key={issue.id} item={issue}>\n                    <div className='flex min-h-6 items-center gap-2 pr-7'>\n                      <span className='text-muted-foreground font-mono text-xs'>\n                        {issue.key}\n                      </span>\n                      <KanbanPriority className='mr-auto' priority={issue.priority} />\n                      <KanbanAssignees names={issue.assignees} />\n                    </div>\n                    <KanbanCardTitle />\n                    <KanbanCardMenu className='absolute top-3 right-2' />\n                    {issue.labels.length > 0 && <KanbanLabels labels={issue.labels} />}\n                    <div className='flex flex-wrap items-center gap-x-3 gap-y-2 empty:hidden'>\n                      {issue.due && (\n                        <KanbanDueDate\n                          date={issue.due}\n                          done={issue.column === doneColumn}\n                          now={now}\n                        />\n                      )}\n                      {issue.comments !== undefined && (\n                        <KanbanComments count={issue.comments} />\n                      )}\n                      {issue.attachments !== undefined && (\n                        <KanbanAttachments count={issue.attachments} />\n                      )}\n                      {issue.subtasks && (\n                        <KanbanSubtasks\n                          done={issue.subtasks.done}\n                          total={issue.subtasks.total}\n                        />\n                      )}\n                    </div>\n                  </KanbanCard>\n                ))}\n              </KanbanColumn>\n            ))}\n          </KanbanBoard>\n        )}\n      </section>\n    </BlockStateProvider>\n  )\n}\n\nexport { Kanban1, exampleProps as kanban1ExampleProps, type Kanban1Props }\n",
      "type": "registry:component",
      "target": "@components/dashboardblocks/kanban/kanban-01.tsx"
    }
  ],
  "meta": {
    "shows": "A sprint board of issues in columns with labels, assignees, due dates and priorities, and warnings when a column passes its limit.",
    "size": "full",
    "usedWith": [
      "comments-04",
      "calendar-01"
    ],
    "component": "Kanban1",
    "props": "{ columns: { color?: string; icon?: ReactNode; id: string; title: string; wipLimit?: number }[]; doneColumn: string; issues?: { assignees: string[]; attachments?: number; comments?: number; due?: Date; key: string; labels: { name: string; tone?: \"success\" | \"warning\" | \"danger\" | \"info\" | \"neutral\" | \"accent\" }[]; priority: \"low\" | \"high\" | \"medium\" | \"urgent\"; subtasks?: { done: number; total: number }; column: string; id: string; title: string }[]; now: Date; onMove?: (id: string, column: string, index: number) => void; period: string; project: string; title: string; errorMessage?: string; status?: \"loading\" | \"error\" }"
  },
  "type": "registry:component"
}
