{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "boards-01",
  "title": "Kanban board",
  "description": "Tinted lanes that scroll on their own, cards with property chips, issue types and worked time, dragged between lanes with the keyboard or the pointer.",
  "dependencies": [
    "@dnd-kit/core",
    "@dnd-kit/sortable",
    "@dnd-kit/utilities",
    "motion"
  ],
  "registryDependencies": [
    "https://ui.ndekocode.dev/r/avatar.json",
    "https://ui.ndekocode.dev/r/badge.json",
    "https://ui.ndekocode.dev/r/button.json",
    "https://ui.ndekocode.dev/r/chip.json",
    "https://ui.ndekocode.dev/r/icons.json",
    "https://ui.ndekocode.dev/r/input.json",
    "https://ui.ndekocode.dev/r/motion-number.json",
    "https://ui.ndekocode.dev/r/theme.json",
    "https://ui.ndekocode.dev/r/use-prefers-reduced-motion.json",
    "https://ui.ndekocode.dev/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/ndeko/blocks/boards/boards-01/index.tsx",
      "content": "'use client';\n\nimport {\n  DndContext,\n  DragOverlay,\n  KeyboardSensor,\n  MeasuringStrategy,\n  MouseSensor,\n  TouchSensor,\n  defaultDropAnimationSideEffects,\n  useSensor,\n  useSensors,\n  type Announcements,\n  type CollisionDetection,\n  type DragEndEvent,\n  type DragMoveEvent,\n  type DragOverEvent,\n  type DragStartEvent,\n  type DropAnimation,\n  type UniqueIdentifier,\n} from '@dnd-kit/core';\nimport { sortableKeyboardCoordinates } from '@dnd-kit/sortable';\nimport { useMotionValue } from 'motion/react';\nimport { useCallback, useEffect, useId, useRef, useState } from 'react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { Button } from '@/registry/ndeko/ui/button';\n\nimport { BoardLane } from './board-lane';\nimport {\n  detectBoardCollision,\n  laneOf,\n  moveAcrossLanes,\n  reorderInLane,\n  targetLaneOf,\n} from './board-moves';\nimport {\n  COLUMNS,\n  LANES,\n  TASKS,\n  TASK_PREFIX,\n  TEAM_NAME,\n  type Columns,\n  type LaneId,\n  type Task,\n} from './data';\nimport { OverlayCard } from './drag-overlay-card';\n\nconst MEASURING = { droppable: { strategy: MeasuringStrategy.Always } };\n\nconst DROP_ANIMATION: DropAnimation = {\n  duration: 220,\n  easing: 'cubic-bezier(0.23, 1, 0.32, 1)',\n  sideEffects: defaultDropAnimationSideEffects({\n    styles: { active: { opacity: '0.4' } },\n  }),\n};\n\nconst SCREEN_READER_INSTRUCTIONS = {\n  draggable:\n    'To pick up a task, press Space or Enter. Use the arrow keys to move it between lanes and cards, Space or Enter to drop it, Escape to cancel.',\n};\n\nconst DEFAULT_COMPOSER_LANE: LaneId = 'todo';\n\nfunction dropAnimationOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return null;\n  }\n  return DROP_ANIMATION;\n}\n\nfunction laneLabelOf(laneId: LaneId | null) {\n  const lane = LANES.find((candidate) => candidate.id === laneId);\n  if (lane) {\n    return lane.label;\n  }\n  return 'the board';\n}\n\nfunction highestNumberOf(tasks: Record<string, Task>) {\n  const numbers = Object.values(tasks).map((task) => {\n    const digits = task.number.replace(/\\D/g, '');\n    return Number(digits);\n  });\n  return Math.max(0, ...numbers);\n}\n\nfunction countLabel(count: number, singular: string, plural: string) {\n  if (count === 1) {\n    return `1 ${singular}`;\n  }\n  return `${count} ${plural}`;\n}\n\nexport default function Boards01() {\n  const [columns, setColumns] = useState<Columns>(COLUMNS);\n  const [tasks, setTasks] = useState<Record<string, Task>>(TASKS);\n  const [activeId, setActiveId] = useState<string | null>(null);\n  const [targetLaneId, setTargetLaneId] = useState<LaneId | null>(null);\n  const [composerLaneId, setComposerLaneId] = useState<LaneId | null>(null);\n  const [newTaskIds, setNewTaskIds] = useState<ReadonlySet<string>>(\n    () => new Set()\n  );\n  const columnsRef = useRef(columns);\n  const snapshotRef = useRef<Columns | null>(null);\n  const lastOverIdRef = useRef<UniqueIdentifier | null>(null);\n  const movedLaneRef = useRef(false);\n  const nextNumberRef = useRef(highestNumberOf(TASKS) + 1);\n  const dragX = useMotionValue(0);\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const dndContextId = useId();\n  const sensors = useSensors(\n    useSensor(MouseSensor, { activationConstraint: { distance: 4 } }),\n    useSensor(TouchSensor, {\n      activationConstraint: { delay: 180, tolerance: 6 },\n    }),\n    useSensor(KeyboardSensor, {\n      coordinateGetter: sortableKeyboardCoordinates,\n    })\n  );\n\n  const allTaskIds = Object.values(columns).flat();\n  const trackedCount = allTaskIds.filter(\n    (taskId) => tasks[taskId].isTracked\n  ).length;\n  const taskCountText = countLabel(allTaskIds.length, 'task', 'tasks');\n  const timerText = countLabel(trackedCount, 'timer running', 'timers running');\n  const metaText = `${taskCountText} · ${timerText}`;\n  let activeTask: Task | null = null;\n  if (activeId) {\n    activeTask = tasks[activeId];\n  }\n\n  useEffect(() => {\n    columnsRef.current = columns;\n    const frame = requestAnimationFrame(() => {\n      movedLaneRef.current = false;\n    });\n    return () => cancelAnimationFrame(frame);\n  }, [columns]);\n\n  const collisionDetection = useCallback<CollisionDetection>((args) => {\n    const hits = detectBoardCollision(args, columnsRef.current);\n    if (hits.length > 0) {\n      lastOverIdRef.current = hits[0].id;\n      return hits;\n    }\n    if (movedLaneRef.current) {\n      lastOverIdRef.current = args.active.id;\n    }\n    const lastOverId = lastOverIdRef.current;\n    if (lastOverId) {\n      return [{ id: lastOverId }];\n    }\n    return [];\n  }, []);\n\n  const announcements: Announcements = {\n    onDragStart({ active }) {\n      const lane = laneOf(columnsRef.current, String(active.id));\n      return `Picked up ${tasks[String(active.id)].number} in ${laneLabelOf(lane)}`;\n    },\n    onDragOver({ active, over }) {\n      if (!over) {\n        return `${tasks[String(active.id)].number} is no longer over a lane`;\n      }\n      const lane = targetLaneOf(columnsRef.current, String(over.id));\n      return `${tasks[String(active.id)].number} is over ${laneLabelOf(lane)}`;\n    },\n    onDragEnd({ active }) {\n      const lane = laneOf(columnsRef.current, String(active.id));\n      return `${tasks[String(active.id)].number} dropped in ${laneLabelOf(lane)}`;\n    },\n    onDragCancel({ active }) {\n      return `Moving ${tasks[String(active.id)].number} was cancelled`;\n    },\n  };\n\n  function handleDragStart({ active }: DragStartEvent) {\n    const taskId = String(active.id);\n    snapshotRef.current = columns;\n    dragX.set(0);\n    setActiveId(taskId);\n    setTargetLaneId(laneOf(columns, taskId));\n    setComposerLaneId(null);\n  }\n\n  function handleDragMove({ delta }: DragMoveEvent) {\n    dragX.set(delta.x);\n  }\n\n  function handleDragOver({ active, over }: DragOverEvent) {\n    if (!over) {\n      return;\n    }\n    const overLane = targetLaneOf(columnsRef.current, String(over.id));\n    setTargetLaneId(overLane);\n    const fromLane = laneOf(columnsRef.current, String(active.id));\n    const isOtherLane = fromLane !== overLane;\n    if (!isOtherLane) {\n      return;\n    }\n    movedLaneRef.current = true;\n    setColumns((previous) => moveAcrossLanes(previous, active, over));\n  }\n\n  function handleDragEnd({ active, over }: DragEndEvent) {\n    setActiveId(null);\n    setTargetLaneId(null);\n    snapshotRef.current = null;\n    if (!over) {\n      return;\n    }\n    const activeTaskId = String(active.id);\n    const overId = String(over.id);\n    setColumns((previous) => reorderInLane(previous, activeTaskId, overId));\n  }\n\n  function handleDragCancel() {\n    const snapshot = snapshotRef.current;\n    if (snapshot) {\n      setColumns(snapshot);\n    }\n    snapshotRef.current = null;\n    setActiveId(null);\n    setTargetLaneId(null);\n  }\n\n  const openComposer = useCallback((laneId: LaneId) => {\n    setComposerLaneId(laneId);\n  }, []);\n\n  const closeComposer = useCallback(() => {\n    setComposerLaneId(null);\n  }, []);\n\n  const createTask = useCallback((laneId: LaneId, title: string) => {\n    const taskNumber = nextNumberRef.current;\n    nextNumberRef.current = taskNumber + 1;\n    const task: Task = {\n      id: `task-${taskNumber}`,\n      number: `${TASK_PREFIX}-${taskNumber}`,\n      title,\n      type: 'task',\n      priority: 'medium',\n      size: null,\n      labels: [],\n      assigneeIds: [],\n      estimateMinutes: 0,\n      workedMinutes: 0,\n      isTracked: false,\n    };\n    setTasks((previous) => ({ ...previous, [task.id]: task }));\n    setColumns((previous) => ({\n      ...previous,\n      [laneId]: [...previous[laneId], task.id],\n    }));\n    setNewTaskIds((previous) => new Set(previous).add(task.id));\n  }, []);\n\n  function openDefaultComposer() {\n    setComposerLaneId(DEFAULT_COMPOSER_LANE);\n  }\n\n  return (\n    <div className='bg-background text-foreground flex h-dvh min-h-0 w-full flex-col'>\n      <div className='hairline-b border-border flex shrink-0 flex-wrap items-center gap-x-3 gap-y-2 px-4 py-3 md:px-6'>\n        <div className='flex min-w-0 items-baseline gap-2'>\n          <h1 className='truncate text-lg font-semibold'>{`${TEAM_NAME} board`}</h1>\n          <span className='text-muted-foreground text-xs tabular-nums'>\n            {metaText}\n          </span>\n        </div>\n        <Button onClick={openDefaultComposer} className='ml-auto'>\n          <PlusIcon />\n          Create task\n        </Button>\n      </div>\n      <DndContext\n        id={dndContextId}\n        sensors={sensors}\n        collisionDetection={collisionDetection}\n        measuring={MEASURING}\n        accessibility={{\n          announcements,\n          screenReaderInstructions: SCREEN_READER_INSTRUCTIONS,\n        }}\n        onDragStart={handleDragStart}\n        onDragMove={handleDragMove}\n        onDragOver={handleDragOver}\n        onDragEnd={handleDragEnd}\n        onDragCancel={handleDragCancel}\n      >\n        <div className='min-h-0 flex-1 overflow-x-auto overscroll-x-contain max-md:snap-x max-md:snap-proximity max-md:scroll-px-4'>\n          <div className='flex h-full w-max items-start gap-3 px-4 py-3 md:px-6'>\n            {LANES.map((lane) => (\n              <BoardLane\n                key={lane.id}\n                lane={lane}\n                taskIds={columns[lane.id]}\n                tasks={tasks}\n                newTaskIds={newTaskIds}\n                isTarget={targetLaneId === lane.id}\n                isComposerOpen={composerLaneId === lane.id}\n                emptyLine='Drop a task here or create one'\n                onOpenComposer={openComposer}\n                onCloseComposer={closeComposer}\n                onCreateTask={createTask}\n              />\n            ))}\n          </div>\n        </div>\n        <DragOverlay dropAnimation={dropAnimationOf(shouldReduceMotion)}>\n          {activeTask && <OverlayCard task={activeTask} dragX={dragX} />}\n        </DragOverlay>\n      </DndContext>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/boards-01/index.tsx"
    },
    {
      "path": "registry/ndeko/blocks/boards/boards-01/board-lane.tsx",
      "content": "'use client';\n\nimport { useDroppable } from '@dnd-kit/core';\nimport {\n  SortableContext,\n  useSortable,\n  verticalListSortingStrategy,\n} from '@dnd-kit/sortable';\nimport { CSS } from '@dnd-kit/utilities';\nimport { motion, type Transition, type Variants } from 'motion/react';\nimport { memo, useEffect, useRef, useState } from 'react';\n\nimport { MotionNumber } from '@/components/core/motion-number';\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\nimport { PlusIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Button } from '@/registry/ndeko/ui/button';\nimport { Input } from '@/registry/ndeko/ui/input';\n\nimport {\n  CARD_SURFACE,\n  TRACKED_CARD,\n  TaskCardBody,\n  formatDuration,\n} from './card-parts';\nimport type { LANES, LaneId, Task } from './data';\n\nexport type LaneMeta = (typeof LANES)[number];\n\nconst SORT_TRANSITION = {\n  duration: 220,\n  easing: 'cubic-bezier(0.23, 1, 0.32, 1)',\n};\n\nconst ENTER_IN: Transition = { duration: 0.2, ease: [0.23, 1, 0.32, 1] };\n\nconst CARD_PRESENCE: Variants = {\n  hidden: { height: 0, opacity: 0, overflow: 'hidden' },\n  shown: {\n    height: 'auto',\n    opacity: 1,\n    transition: ENTER_IN,\n    transitionEnd: { overflow: 'visible' },\n  },\n};\n\nconst CARD_FADE: Variants = {\n  hidden: { opacity: 0 },\n  shown: { opacity: 1, transition: ENTER_IN },\n};\n\nfunction sortTransitionOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return null;\n  }\n  return SORT_TRANSITION;\n}\n\nfunction cardVariantsOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return CARD_FADE;\n  }\n  return CARD_PRESENCE;\n}\n\nfunction initialOf(isNew: boolean) {\n  if (isNew) {\n    return 'hidden';\n  }\n  return false;\n}\n\nfunction taskCountLabel(count: number) {\n  if (count === 1) {\n    return '1 task';\n  }\n  return `${count} tasks`;\n}\n\nfunction cardLabelOf(task: Task) {\n  const worked = formatDuration(task.workedMinutes);\n  return `${task.number} ${task.title}, ${worked} worked`;\n}\n\nfunction LaneCount({ value }: { value: number }) {\n  const label = taskCountLabel(value);\n\n  return (\n    <span className='bg-foreground/[0.06] text-muted-foreground inline-flex h-5 min-w-5 items-center justify-center rounded-sm px-1.5 text-xs tabular-nums'>\n      <span aria-hidden='true' className='inline-flex'>\n        <MotionNumber value={value} />\n      </span>\n      <span className='sr-only'>{` ${label}`}</span>\n    </span>\n  );\n}\n\nexport function LaneTile({ lane }: { lane: LaneMeta }) {\n  const LaneGlyph = lane.icon;\n  const tileStyle = { '--chip': lane.color } as React.CSSProperties;\n\n  return (\n    <span\n      style={tileStyle}\n      className='chip-3d flex size-5 shrink-0 items-center justify-center rounded-md'\n    >\n      <LaneGlyph className='size-3' strokeWidth={2.25} />\n    </span>\n  );\n}\n\nfunction SortableTaskCard({ task, isNew }: { task: Task; isNew: boolean }) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const cardVariants = cardVariantsOf(shouldReduceMotion);\n  const {\n    attributes,\n    listeners,\n    setNodeRef,\n    transform,\n    transition,\n    isDragging,\n  } = useSortable({\n    id: task.id,\n    transition: sortTransitionOf(shouldReduceMotion),\n  });\n  const style = {\n    transform: CSS.Translate.toString(transform),\n    transition,\n  } as React.CSSProperties;\n\n  return (\n    <motion.li\n      variants={cardVariants}\n      initial={initialOf(isNew)}\n      animate='shown'\n    >\n      <div\n        ref={setNodeRef}\n        style={style}\n        {...attributes}\n        {...listeners}\n        aria-label={cardLabelOf(task)}\n        className={cn(\n          CARD_SURFACE,\n          task.isTracked && TRACKED_CARD,\n          'focus-visible:ring-ring/25 cursor-grab touch-manipulation outline-none focus-visible:ring-[3px] active:cursor-grabbing',\n          '[contain-intrinsic-size:auto_9rem] [content-visibility:auto]',\n          isDragging && 'opacity-40'\n        )}\n      >\n        <TaskCardBody task={task} />\n      </div>\n    </motion.li>\n  );\n}\n\nfunction LaneComposer({\n  laneLabel,\n  onCreate,\n  onClose,\n}: {\n  laneLabel: string;\n  onCreate: (title: string) => void;\n  onClose: () => void;\n}) {\n  const [title, setTitle] = useState('');\n  const formRef = useRef<HTMLFormElement>(null);\n\n  useEffect(() => {\n    formRef.current?.scrollIntoView({ block: 'nearest' });\n  }, []);\n\n  function changeTitle(event: React.ChangeEvent<HTMLInputElement>) {\n    setTitle(event.target.value);\n  }\n\n  function handleKeyDown(event: React.KeyboardEvent<HTMLInputElement>) {\n    if (event.key === 'Escape') {\n      event.preventDefault();\n      onClose();\n    }\n  }\n\n  function create(event: React.FormEvent<HTMLFormElement>) {\n    event.preventDefault();\n    const trimmed = title.trim();\n    if (trimmed.length === 0) {\n      return;\n    }\n    onCreate(trimmed);\n    setTitle('');\n  }\n\n  return (\n    <form\n      ref={formRef}\n      onSubmit={create}\n      className={cn(CARD_SURFACE, 'flex flex-col gap-2 p-2')}\n    >\n      <Input\n        autoFocus\n        value={title}\n        placeholder='Task title'\n        aria-label={`Title of the new task in ${laneLabel}`}\n        onChange={changeTitle}\n        onKeyDown={handleKeyDown}\n      />\n      <div className='flex items-center justify-end gap-1'>\n        <Button type='button' variant='ghost' size='sm' onClick={onClose}>\n          Cancel\n        </Button>\n        <Button type='submit' size='sm'>\n          Add task\n        </Button>\n      </div>\n    </form>\n  );\n}\n\ntype BoardLaneProps = {\n  lane: LaneMeta;\n  taskIds: string[];\n  tasks: Record<string, Task>;\n  newTaskIds: ReadonlySet<string>;\n  isTarget: boolean;\n  isComposerOpen: boolean;\n  emptyLine: string;\n  menu?: React.ReactNode;\n  onOpenComposer: (laneId: LaneId) => void;\n  onCloseComposer: () => void;\n  onCreateTask: (laneId: LaneId, title: string) => void;\n};\n\n/** A tinted lane whose body scrolls on its own. It takes drops anywhere, even when empty. */\nexport const BoardLane = memo(function BoardLane({\n  lane,\n  taskIds,\n  tasks,\n  newTaskIds,\n  isTarget,\n  isComposerOpen,\n  emptyLine,\n  menu,\n  onOpenComposer,\n  onCloseComposer,\n  onCreateTask,\n}: BoardLaneProps) {\n  const { setNodeRef } = useDroppable({ id: lane.id });\n  const isEmpty = taskIds.length === 0;\n\n  function openComposer() {\n    onOpenComposer(lane.id);\n  }\n\n  function createTask(title: string) {\n    onCreateTask(lane.id, title);\n  }\n\n  return (\n    <section\n      ref={setNodeRef}\n      aria-label={lane.label}\n      className={cn(\n        'flex max-h-full w-72 shrink-0 snap-start flex-col rounded-xl transition-colors duration-150',\n        isTarget && 'bg-primary/[0.06]',\n        !isTarget && 'bg-foreground/[0.03]'\n      )}\n    >\n      <header className='flex h-11 shrink-0 items-center gap-2 pr-1.5 pl-3'>\n        <LaneTile lane={lane} />\n        <h2 className='min-w-0 truncate text-[13px] font-semibold'>\n          {lane.label}\n        </h2>\n        <LaneCount value={taskIds.length} />\n        <div className='ml-auto flex items-center'>\n          <Button\n            variant='ghost'\n            size='icon-sm'\n            aria-label={`Add a task to ${lane.label}`}\n            onClick={openComposer}\n            className='text-muted-foreground'\n          >\n            <PlusIcon />\n          </Button>\n          {menu}\n        </div>\n      </header>\n      <div className='flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto px-2 pt-0.5 pb-2'>\n        <SortableContext items={taskIds} strategy={verticalListSortingStrategy}>\n          <ul className='flex flex-col gap-2'>\n            {taskIds.map((taskId) => (\n              <SortableTaskCard\n                key={taskId}\n                task={tasks[taskId]}\n                isNew={newTaskIds.has(taskId)}\n              />\n            ))}\n          </ul>\n        </SortableContext>\n        {isEmpty && (\n          <div\n            className={cn(\n              'hairline-border text-muted-foreground flex h-20 items-center justify-center rounded-lg border-dashed px-3 text-center text-xs transition-colors duration-150',\n              isTarget && 'border-primary/40',\n              !isTarget && 'border-foreground/20'\n            )}\n          >\n            {emptyLine}\n          </div>\n        )}\n        {isComposerOpen && (\n          <LaneComposer\n            laneLabel={lane.label}\n            onCreate={createTask}\n            onClose={onCloseComposer}\n          />\n        )}\n        {!isComposerOpen && (\n          <button\n            type='button'\n            onClick={openComposer}\n            className='text-muted-foreground hover:bg-foreground/5 hover:text-foreground focus-visible:ring-ring/25 flex h-8 w-full shrink-0 cursor-pointer items-center gap-2 rounded-md px-2 text-[13px] transition-colors duration-150 outline-none focus-visible:ring-[3px]'\n          >\n            <PlusIcon className='size-4' />\n            Create task\n          </button>\n        )}\n      </div>\n    </section>\n  );\n});\n",
      "type": "registry:component",
      "target": "components/blocks/boards-01/board-lane.tsx"
    },
    {
      "path": "registry/ndeko/blocks/boards/boards-01/card-parts.tsx",
      "content": "import { memo } from 'react';\n\nimport { ClockIcon } from '@/registry/ndeko/lib/icons';\nimport { cn } from '@/registry/ndeko/lib/utils';\nimport { Avatar } from '@/registry/ndeko/ui/avatar';\nimport { Badge } from '@/registry/ndeko/ui/badge';\nimport { Chip } from '@/registry/ndeko/ui/chip';\n\nimport {\n  ISSUE_TYPES,\n  LABELS,\n  PEOPLE,\n  PRIORITIES,\n  type IssueType,\n  type Person,\n  type Task,\n} from './data';\n\nconst VISIBLE_LABELS = 2;\n\nconst VISIBLE_ASSIGNEES = 3;\n\nexport const CARD_SURFACE =\n  'bg-card hairline-ring ring-border rounded-lg shadow-[0_1px_2px_rgb(0_0_0/0.04)]';\n\nexport const TRACKED_CARD = 'ring-primary/45';\n\nexport function formatDuration(minutes: number) {\n  const hours = Math.floor(minutes / 60);\n  const rest = minutes % 60;\n  const paddedRest = String(rest).padStart(2, '0');\n  return `${hours}h ${paddedRest}m`;\n}\n\nfunction personOf(personId: string): Person | undefined {\n  return PEOPLE.find((person) => person.id === personId);\n}\n\nfunction isPerson(value: Person | undefined): value is Person {\n  return value !== undefined;\n}\n\nfunction progressOf(task: Task) {\n  if (task.estimateMinutes === 0) {\n    return 0;\n  }\n  const ratio = task.workedMinutes / task.estimateMinutes;\n  return Math.min(100, Math.round(ratio * 100));\n}\n\nexport function IssueTypeGem({ type }: { type: IssueType }) {\n  const meta = ISSUE_TYPES[type];\n  const TypeGlyph = meta.icon;\n  const gemStyle = { '--gem': meta.color } as React.CSSProperties;\n\n  return (\n    <span\n      style={gemStyle}\n      className='gem-plate inline-flex size-4 shrink-0 items-center justify-center rounded-[4px]'\n    >\n      <TypeGlyph className='size-2.5' strokeWidth={2.75} />\n      <span className='sr-only'>{meta.label}</span>\n    </span>\n  );\n}\n\nfunction AssigneeStack({ assigneeIds }: { assigneeIds: string[] }) {\n  const people = assigneeIds.map(personOf).filter(isPerson);\n  const shown = people.slice(0, VISIBLE_ASSIGNEES);\n  const hiddenCount = people.length - shown.length;\n  const hasHidden = hiddenCount > 0;\n  const isUnassigned = people.length === 0;\n\n  if (isUnassigned) {\n    return <span className='text-muted-foreground text-xs'>Unassigned</span>;\n  }\n\n  return (\n    <span className='flex items-center'>\n      {shown.map((person) => (\n        <Avatar\n          key={person.id}\n          className='ring-card -ml-1 size-5 ring-2 first:ml-0'\n          seed={person.name}\n        />\n      ))}\n      {hasHidden && (\n        <span className='bg-muted text-muted-foreground ring-card -ml-1 inline-flex size-5 items-center justify-center rounded-full text-[9px] font-medium ring-2'>\n          +{hiddenCount}\n        </span>\n      )}\n      <span className='sr-only'>\n        {`Assigned to ${people.map((person) => person.name).join(', ')}`}\n      </span>\n    </span>\n  );\n}\n\ntype TaskCardBodyProps = {\n  task: Task;\n};\n\n/** The content of a card. Memoised, so a drag re-renders only the thin sortable wrapper around it. */\nexport const TaskCardBody = memo(function TaskCardBody({\n  task,\n}: TaskCardBodyProps) {\n  const priority = PRIORITIES[task.priority];\n  const shownLabels = task.labels.slice(0, VISIBLE_LABELS);\n  const hiddenLabelCount = task.labels.length - shownLabels.length;\n  const hasHiddenLabels = hiddenLabelCount > 0;\n  const hasEstimate = task.estimateMinutes > 0;\n  const progress = progressOf(task);\n  const progressStyle = { width: `${progress}%` } as React.CSSProperties;\n\n  return (\n    <div className='flex flex-col gap-2.5 p-3'>\n      <div className='flex flex-wrap items-center gap-1'>\n        <Chip color={priority.color}>{priority.label}</Chip>\n        {task.size && (\n          <Badge variant='secondary' className='text-muted-foreground'>\n            {`Size ${task.size}`}\n          </Badge>\n        )}\n        {shownLabels.map((labelId) => {\n          const label = LABELS[labelId];\n          return (\n            <Chip key={labelId} color={label.color}>\n              {label.label}\n            </Chip>\n          );\n        })}\n        {hasHiddenLabels && (\n          <Badge\n            variant='secondary'\n            className='text-muted-foreground tabular-nums'\n          >\n            {`+${hiddenLabelCount}`}\n          </Badge>\n        )}\n      </div>\n      <div className='flex flex-col gap-1'>\n        <span className='text-muted-foreground flex items-center gap-1.5 text-xs tabular-nums'>\n          <IssueTypeGem type={task.type} />\n          {task.number}\n        </span>\n        <p className='line-clamp-2 text-[13px] leading-snug font-medium text-balance'>\n          {task.title}\n        </p>\n      </div>\n      {hasEstimate && (\n        <div\n          role='meter'\n          aria-label={`${formatDuration(task.workedMinutes)} of ${formatDuration(task.estimateMinutes)} estimated`}\n          aria-valuemin={0}\n          aria-valuemax={100}\n          aria-valuenow={progress}\n          className='bg-foreground/[0.06] h-1 overflow-hidden rounded-full'\n        >\n          <span\n            style={progressStyle}\n            className='bg-primary block h-full rounded-full'\n          />\n        </div>\n      )}\n      <div className='hairline-t border-border flex items-center justify-between gap-2 border-dashed pt-2.5'>\n        <AssigneeStack assigneeIds={task.assigneeIds} />\n        <span\n          className={cn(\n            'text-muted-foreground flex items-center gap-1.5 text-xs font-medium tabular-nums',\n            task.isTracked && 'text-primary-ink'\n          )}\n        >\n          {task.isTracked && (\n            <span className='bg-primary size-1.5 rounded-full'>\n              <span className='sr-only'>Timer running,</span>\n            </span>\n          )}\n          {!task.isTracked && <ClockIcon className='size-3.5' />}\n          {formatDuration(task.workedMinutes)}\n        </span>\n      </div>\n    </div>\n  );\n});\n",
      "type": "registry:component",
      "target": "components/blocks/boards-01/card-parts.tsx"
    },
    {
      "path": "registry/ndeko/blocks/boards/boards-01/drag-overlay-card.tsx",
      "content": "'use client';\n\nimport {\n  motion,\n  type MotionValue,\n  type Transition,\n  useSpring,\n  useTransform,\n  useVelocity,\n} from 'motion/react';\n\nimport { usePrefersReducedMotion } from '@/registry/ndeko/hooks/use-prefers-reduced-motion';\n\nimport { TaskCardBody } from './card-parts';\nimport type { Task } from './data';\n\nconst VELOCITY_RANGE = [-1400, 0, 1400];\n\nconst TILT_RANGE = [-5, 0, 5];\n\nconst TILT_SPRING = { stiffness: 380, damping: 26, mass: 0.6 };\n\nconst LIFT: Transition = { type: 'spring', bounce: 0, duration: 0.25 };\n\nconst INSTANT: Transition = { duration: 0 };\n\nfunction liftOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return INSTANT;\n  }\n  return LIFT;\n}\n\nfunction liftScaleOf(shouldReduceMotion: boolean | null) {\n  if (shouldReduceMotion) {\n    return 1;\n  }\n  return 1.02;\n}\n\ntype OverlayCardProps = {\n  task: Task;\n  dragX: MotionValue<number>;\n};\n\n/** The card under the pointer: it leans with the speed of the drag and settles on a spring when the pointer slows. */\nexport function OverlayCard({ task, dragX }: OverlayCardProps) {\n  const shouldReduceMotion = usePrefersReducedMotion();\n  const velocity = useVelocity(dragX);\n  const tiltTarget = useTransform(velocity, VELOCITY_RANGE, TILT_RANGE, {\n    clamp: true,\n  });\n  const tilt = useSpring(tiltTarget, TILT_SPRING);\n  const noTilt = useTransform(tilt, () => 0);\n  let rotate = tilt;\n  if (shouldReduceMotion) {\n    rotate = noTilt;\n  }\n\n  return (\n    <motion.div\n      style={{ rotate }}\n      initial={{ scale: 1 }}\n      animate={{ scale: liftScaleOf(shouldReduceMotion) }}\n      transition={liftOf(shouldReduceMotion)}\n      className='surface-raised cursor-grabbing rounded-lg'\n    >\n      <TaskCardBody task={task} />\n    </motion.div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/blocks/boards-01/drag-overlay-card.tsx"
    },
    {
      "path": "registry/ndeko/blocks/boards/boards-01/board-moves.ts",
      "content": "import {\n  closestCenter,\n  closestCorners,\n  pointerWithin,\n  type Active,\n  type CollisionDetection,\n  type Over,\n} from '@dnd-kit/core';\nimport { arrayMove } from '@dnd-kit/sortable';\n\nimport type { Columns, LaneId } from './data';\n\nexport function isLaneId(columns: Columns, id: string): id is LaneId {\n  return Object.prototype.hasOwnProperty.call(columns, id);\n}\n\nexport function laneOf(columns: Columns, taskId: string): LaneId | null {\n  const lanes = Object.keys(columns) as LaneId[];\n  const lane = lanes.find((laneId) => columns[laneId].includes(taskId));\n  if (lane) {\n    return lane;\n  }\n  return null;\n}\n\nexport function targetLaneOf(columns: Columns, overId: string) {\n  if (isLaneId(columns, overId)) {\n    return overId;\n  }\n  return laneOf(columns, overId);\n}\n\n/** Inside the lane under the pointer, the closest card wins; an empty lane is the target itself. */\nexport function detectBoardCollision(\n  args: Parameters<CollisionDetection>[0],\n  columns: Columns\n) {\n  const hasPointer = Boolean(args.pointerCoordinates);\n  if (!hasPointer) {\n    return closestCorners(args);\n  }\n  const pointerHits = pointerWithin(args);\n  const laneHit = pointerHits.find((hit) => isLaneId(columns, String(hit.id)));\n  if (!laneHit) {\n    return pointerHits;\n  }\n  const laneTaskIds = columns[laneHit.id as LaneId];\n  const cardContainers = args.droppableContainers.filter((container) =>\n    laneTaskIds.includes(String(container.id))\n  );\n  const isEmptyLane = cardContainers.length === 0;\n  if (isEmptyLane) {\n    return [laneHit];\n  }\n  return closestCenter({ ...args, droppableContainers: cardContainers });\n}\n\nfunction isBelowOver(active: Active, over: Over) {\n  const translated = active.rect.current.translated;\n  if (!translated) {\n    return false;\n  }\n  const overMiddle = over.rect.top + over.rect.height / 2;\n  return translated.top > overMiddle;\n}\n\n/** Moves the dragged card into the lane under it, before or after the card it hovers. */\nexport function moveAcrossLanes(\n  columns: Columns,\n  active: Active,\n  over: Over\n): Columns {\n  const activeId = String(active.id);\n  const overId = String(over.id);\n  const fromLane = laneOf(columns, activeId);\n  const toLane = targetLaneOf(columns, overId);\n  if (!fromLane) {\n    return columns;\n  }\n  if (!toLane) {\n    return columns;\n  }\n  if (fromLane === toLane) {\n    return columns;\n  }\n  const fromItems = columns[fromLane].filter((id) => id !== activeId);\n  const toItems = columns[toLane];\n  let insertAt = toItems.length;\n  const isOverCard = !isLaneId(columns, overId);\n  if (isOverCard) {\n    const overIndex = toItems.indexOf(overId);\n    insertAt = overIndex;\n    if (isBelowOver(active, over)) {\n      insertAt = overIndex + 1;\n    }\n  }\n  const nextToItems = [\n    ...toItems.slice(0, insertAt),\n    activeId,\n    ...toItems.slice(insertAt),\n  ];\n  return { ...columns, [fromLane]: fromItems, [toLane]: nextToItems };\n}\n\n/** Reorders the dragged card inside its lane once it is dropped. */\nexport function reorderInLane(\n  columns: Columns,\n  activeId: string,\n  overId: string\n): Columns {\n  const lane = laneOf(columns, activeId);\n  if (!lane) {\n    return columns;\n  }\n  const items = columns[lane];\n  const oldIndex = items.indexOf(activeId);\n  const newIndex = items.indexOf(overId);\n  const isMissing = newIndex === -1;\n  const isSamePlace = oldIndex === newIndex;\n  if (isMissing || isSamePlace) {\n    return columns;\n  }\n  return { ...columns, [lane]: arrayMove(items, oldIndex, newIndex) };\n}\n",
      "type": "registry:component",
      "target": "components/blocks/boards-01/board-moves.ts"
    },
    {
      "path": "registry/ndeko/blocks/boards/boards-01/data.ts",
      "content": "import {\n  BookmarkIcon,\n  CheckIcon,\n  CircleAlertIcon,\n  CircleCheckIcon,\n  CircleDashedIcon,\n  CircleIcon,\n  EclipseIcon,\n  EyeIcon,\n  ZapIcon,\n  type Icon,\n} from '@/registry/ndeko/lib/icons';\n\nexport type LaneId = 'backlog' | 'todo' | 'in-progress' | 'in-review' | 'done';\n\nexport type IssueType = 'task' | 'bug' | 'story' | 'epic';\n\nexport type Priority = 'urgent' | 'high' | 'medium' | 'low';\n\nexport type Size = 'S' | 'M' | 'L' | 'XL';\n\nexport type LabelId = 'design' | 'web' | 'mobile' | 'api' | 'research';\n\nexport type Person = {\n  id: string;\n  name: string;\n};\n\nexport type Task = {\n  id: string;\n  number: string;\n  title: string;\n  type: IssueType;\n  priority: Priority;\n  size: Size | null;\n  labels: LabelId[];\n  assigneeIds: string[];\n  estimateMinutes: number;\n  workedMinutes: number;\n  isTracked: boolean;\n};\n\nexport type Columns = Record<LaneId, string[]>;\n\ntype Meta = { label: string; color: string };\n\ntype GlyphMeta = Meta & { icon: Icon };\n\nexport const LANES: (GlyphMeta & { id: LaneId })[] = [\n  {\n    id: 'backlog',\n    label: 'Backlog',\n    color: 'var(--muted-foreground)',\n    icon: CircleDashedIcon,\n  },\n  { id: 'todo', label: 'Todo', color: 'var(--info)', icon: CircleIcon },\n  {\n    id: 'in-progress',\n    label: 'In progress',\n    color: 'var(--warning)',\n    icon: EclipseIcon,\n  },\n  {\n    id: 'in-review',\n    label: 'In review',\n    color: 'var(--primary)',\n    icon: EyeIcon,\n  },\n  { id: 'done', label: 'Done', color: 'var(--success)', icon: CircleCheckIcon },\n];\n\nexport const ISSUE_TYPES: Record<IssueType, GlyphMeta> = {\n  task: { label: 'Task', color: 'var(--info)', icon: CheckIcon },\n  bug: { label: 'Bug', color: 'var(--destructive)', icon: CircleAlertIcon },\n  story: { label: 'Story', color: 'var(--success)', icon: BookmarkIcon },\n  epic: { label: 'Epic', color: 'var(--primary)', icon: ZapIcon },\n};\n\nexport const PRIORITIES: Record<Priority, Meta> = {\n  urgent: { label: 'Urgent', color: 'var(--destructive)' },\n  high: { label: 'High', color: 'var(--warning)' },\n  medium: { label: 'Medium', color: 'var(--info)' },\n  low: { label: 'Low', color: 'var(--muted-foreground)' },\n};\n\nexport const LABELS: Record<LabelId, Meta> = {\n  design: { label: 'Design', color: 'var(--primary)' },\n  web: { label: 'Web', color: 'var(--info)' },\n  mobile: { label: 'Mobile', color: 'var(--success)' },\n  api: { label: 'API', color: 'var(--warning)' },\n  research: { label: 'Research', color: 'var(--muted-foreground)' },\n};\n\nexport const PEOPLE: Person[] = [\n  {\n    id: 'amara',\n    name: 'Amara Okafor',\n  },\n  {\n    id: 'lucas',\n    name: 'Lucas Moreau',\n  },\n  {\n    id: 'priya',\n    name: 'Priya Raman',\n  },\n  {\n    id: 'mateo',\n    name: 'Mateo Silva',\n  },\n  {\n    id: 'hana',\n    name: 'Hana Kobayashi',\n  },\n  { id: 'jonas', name: 'Jonas Weber' },\n];\n\nexport const TEAM_NAME = 'Product';\n\nexport const TASK_PREFIX = 'LAT';\n\nconst TASK_LIST: Task[] = [\n  {\n    id: 'task-151',\n    number: 'LAT-151',\n    title: 'Let managers export a timesheet as CSV',\n    type: 'story',\n    priority: 'medium',\n    size: 'M',\n    labels: ['web', 'api'],\n    assigneeIds: [],\n    estimateMinutes: 0,\n    workedMinutes: 0,\n    isTracked: false,\n  },\n  {\n    id: 'task-150',\n    number: 'LAT-150',\n    title: 'Interview three teams about weekly planning',\n    type: 'task',\n    priority: 'low',\n    size: 'S',\n    labels: ['research'],\n    assigneeIds: ['hana'],\n    estimateMinutes: 180,\n    workedMinutes: 0,\n    isTracked: false,\n  },\n  {\n    id: 'task-149',\n    number: 'LAT-149',\n    title: 'Dark mode for the public report pages',\n    type: 'epic',\n    priority: 'low',\n    size: 'XL',\n    labels: ['design', 'web'],\n    assigneeIds: [],\n    estimateMinutes: 0,\n    workedMinutes: 0,\n    isTracked: false,\n  },\n  {\n    id: 'task-146',\n    number: 'LAT-146',\n    title: 'Timesheet export drops the last day of the month',\n    type: 'bug',\n    priority: 'urgent',\n    size: 'S',\n    labels: ['api'],\n    assigneeIds: ['mateo'],\n    estimateMinutes: 120,\n    workedMinutes: 25,\n    isTracked: false,\n  },\n  {\n    id: 'task-145',\n    number: 'LAT-145',\n    title: 'Empty state for a project without tasks',\n    type: 'task',\n    priority: 'medium',\n    size: 'S',\n    labels: ['design'],\n    assigneeIds: ['amara'],\n    estimateMinutes: 90,\n    workedMinutes: 0,\n    isTracked: false,\n  },\n  {\n    id: 'task-129',\n    number: 'LAT-129',\n    title: 'Test the invitation flow on a slow network',\n    type: 'task',\n    priority: 'high',\n    size: 'M',\n    labels: ['web', 'mobile', 'research'],\n    assigneeIds: ['jonas'],\n    estimateMinutes: 240,\n    workedMinutes: 0,\n    isTracked: false,\n  },\n  {\n    id: 'task-142',\n    number: 'LAT-142',\n    title: 'Redraw the onboarding checklist for small screens',\n    type: 'story',\n    priority: 'high',\n    size: 'L',\n    labels: ['design', 'mobile'],\n    assigneeIds: ['amara', 'priya'],\n    estimateMinutes: 480,\n    workedMinutes: 305,\n    isTracked: true,\n  },\n  {\n    id: 'task-141',\n    number: 'LAT-141',\n    title: 'Paginate the invoices endpoint',\n    type: 'task',\n    priority: 'medium',\n    size: 'M',\n    labels: ['api'],\n    assigneeIds: ['lucas'],\n    estimateMinutes: 180,\n    workedMinutes: 95,\n    isTracked: true,\n  },\n  {\n    id: 'task-120',\n    number: 'LAT-120',\n    title: 'Reports beta with two pilot customers',\n    type: 'epic',\n    priority: 'high',\n    size: 'XL',\n    labels: ['research', 'web'],\n    assigneeIds: ['hana', 'lucas', 'amara'],\n    estimateMinutes: 0,\n    workedMinutes: 640,\n    isTracked: false,\n  },\n  {\n    id: 'task-144',\n    number: 'LAT-144',\n    title: 'Invoices total rounds to the wrong cent',\n    type: 'bug',\n    priority: 'urgent',\n    size: 'S',\n    labels: ['api'],\n    assigneeIds: ['mateo'],\n    estimateMinutes: 60,\n    workedMinutes: 20,\n    isTracked: false,\n  },\n  {\n    id: 'task-136',\n    number: 'LAT-136',\n    title: 'Chart the hours of the week as day bars',\n    type: 'story',\n    priority: 'medium',\n    size: 'M',\n    labels: ['web', 'design'],\n    assigneeIds: ['priya'],\n    estimateMinutes: 300,\n    workedMinutes: 290,\n    isTracked: false,\n  },\n  {\n    id: 'task-133',\n    number: 'LAT-133',\n    title: 'Fix the focus ring of the date picker',\n    type: 'bug',\n    priority: 'low',\n    size: 'S',\n    labels: ['web'],\n    assigneeIds: ['priya'],\n    estimateMinutes: 45,\n    workedMinutes: 40,\n    isTracked: false,\n  },\n  {\n    id: 'task-119',\n    number: 'LAT-119',\n    title: 'Audit the contrast of the status chips',\n    type: 'task',\n    priority: 'medium',\n    size: 'S',\n    labels: ['design'],\n    assigneeIds: ['amara'],\n    estimateMinutes: 120,\n    workedMinutes: 110,\n    isTracked: false,\n  },\n  {\n    id: 'task-117',\n    number: 'LAT-117',\n    title: 'Plan the reports beta with two customers',\n    type: 'task',\n    priority: 'medium',\n    size: 'M',\n    labels: ['research'],\n    assigneeIds: ['hana'],\n    estimateMinutes: 150,\n    workedMinutes: 165,\n    isTracked: false,\n  },\n  {\n    id: 'task-112',\n    number: 'LAT-112',\n    title: 'Sign in with a magic link on mobile',\n    type: 'story',\n    priority: 'high',\n    size: 'L',\n    labels: ['mobile', 'api'],\n    assigneeIds: ['mateo', 'jonas'],\n    estimateMinutes: 600,\n    workedMinutes: 540,\n    isTracked: false,\n  },\n];\n\nexport const TASKS: Record<string, Task> = Object.fromEntries(\n  TASK_LIST.map((task) => [task.id, task])\n);\n\nexport const COLUMNS: Columns = {\n  backlog: ['task-151', 'task-150', 'task-149'],\n  todo: ['task-146', 'task-145', 'task-129'],\n  'in-progress': ['task-142', 'task-141', 'task-120', 'task-144'],\n  'in-review': ['task-136', 'task-133'],\n  done: ['task-119', 'task-117', 'task-112'],\n};\n",
      "type": "registry:component",
      "target": "components/blocks/boards-01/data.ts"
    }
  ],
  "categories": [
    "blocks",
    "boards"
  ],
  "type": "registry:block"
}