{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "hiring-pipeline-board",
  "title": "Hiring Pipeline Board",
  "description": "A recruiting pipeline screen for one role: a stage funnel bar, Applied → Screening → Interview → Offer → Hired columns with counts and reach rates, candidate cards with ratings, source, next step and days in stage (red after a week), drag and drop between stages, select-to-advance or reject, search, and undo toasts.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/hiring-pipeline-board/hiring-pipeline-board.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 type Stage = \"applied\" | \"screen\" | \"interview\" | \"offer\" | \"hired\";\n\nexport interface Candidate {\n  id: string;\n  name: string;\n  current: string;\n  stage: Stage;\n  rating: number;\n  source: string;\n  days: number;\n  tags?: string[];\n  color: string;\n  next?: string;\n}\n\nexport interface HiringPipelineBoardProps {\n  role?: string;\n  team?: string;\n  candidates?: Candidate[];\n  onMove?: (id: string, stage: Stage) => void;\n  onReject?: (id: string) => 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)\", col: \"#101010\", card: \"#171717\", cardHover: \"#1C1C1C\", border: \"rgba(255,255,255,0.08)\", input: \"#0D0D0D\", track: \"rgba(255,255,255,0.08)\", on: \"#F5F4F1\", onText: \"#0A0A0A\", green: \"#4ADE80\", amber: \"#FBBF24\", red: \"#F87171\", star: \"#FBBF24\", ring: \"rgba(245,244,241,0.6)\" },\n  light: { bg: \"#FAFAF8\", text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.62)\", faint: \"rgba(10,10,10,0.4)\", col: \"#F2F1EE\", card: \"#FFFFFF\", cardHover: \"#FFFFFF\", border: \"rgba(10,10,10,0.09)\", input: \"#FFFFFF\", track: \"rgba(10,10,10,0.08)\", on: \"#0A0A0A\", onText: \"#FAFAF8\", green: \"#15803D\", amber: \"#B45309\", red: \"#DC2626\", star: \"#D97706\", ring: \"rgba(10,10,10,0.5)\" },\n};\nconst STAGES: { id: Stage; label: string; color: string }[] = [\n  { id: \"applied\", label: \"Applied\", color: \"#A3A3A3\" },\n  { id: \"screen\", label: \"Screening\", color: \"#60A5FA\" },\n  { id: \"interview\", label: \"Interview\", color: \"#A78BFA\" },\n  { id: \"offer\", label: \"Offer\", color: \"#FBBF24\" },\n  { id: \"hired\", label: \"Hired\", color: \"#4ADE80\" },\n];\nconst COLORS = [\"#F472B6\", \"#60A5FA\", \"#A78BFA\", \"#34D399\", \"#FB923C\", \"#FBBF24\", \"#22D3EE\", \"#F87171\"];\nconst RAW: [string, string, Stage, number, string, number, string[], string?][] = [\n  [\"Nadia Rahman\", \"Product Designer at Lumio\", \"applied\", 0, \"Referral\", 1, [\"Fintech\"]],\n  [\"Oscar Lindqvist\", \"UI Designer at Kiteworks\", \"applied\", 0, \"Careers page\", 2, []],\n  [\"Mei Takahashi\", \"Designer at Orbitly\", \"applied\", 0, \"LinkedIn\", 3, [\"Motion\"]],\n  [\"Diego Alvarez\", \"Freelance\", \"applied\", 0, \"Careers page\", 9, []],\n  [\"Hannah Weiss\", \"Senior Designer at Pellucid\", \"screen\", 4, \"Referral\", 2, [\"Design systems\"], \"Call today 15:00\"],\n  [\"Kwame Mensah\", \"Product Designer at Northwind\", \"screen\", 3, \"LinkedIn\", 5, []],\n  [\"Lea Fontaine\", \"UX Lead at Halden\", \"screen\", 4, \"Sourced\", 8, [\"Lead\"]],\n  [\"Ravi Kapoor\", \"Senior Designer at Lumio\", \"interview\", 5, \"Referral\", 3, [\"Design systems\", \"B2B\"], \"Panel Thu 10:00\"],\n  [\"Sofia Marino\", \"Product Designer at Orbitly\", \"interview\", 4, \"Careers page\", 6, [\"Research\"], \"Portfolio review Fri\"],\n  [\"Tom Becker\", \"Designer at Kiteworks\", \"interview\", 3, \"LinkedIn\", 11, []],\n  [\"Ana Costa\", \"Senior Designer at Northwind\", \"offer\", 5, \"Referral\", 2, [\"B2B\"], \"Offer sent · expires Mon\"],\n  [\"Jun Park\", \"Product Designer at Pellucid\", \"hired\", 5, \"Sourced\", 0, [], \"Starts Dec 1\"],\n];\nconst CANDIDATES: Candidate[] = RAW.map(([name, current, stage, rating, source, days, tags, next], i) => ({ id: `c${i + 1}`, name, current, stage, rating, source, days, tags, next, color: COLORS[i % COLORS.length] }));\nconst initials = (n: string) =>\n  n\n    .split(\" \")\n    .map((w) => w[0])\n    .join(\"\")\n    .slice(0, 2);\n\ntype Drag = { id: string; x: number; y: number; offX: number; offY: number; w: number; startX: number; startY: number; active: boolean; over: Stage | null };\n\nexport function HiringPipelineBoard({ role = \"Senior Product Designer\", team = \"Design · Berlin or remote\", candidates: initial = CANDIDATES, onMove, onReject, theme = \"dark\", className }: HiringPipelineBoardProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const [items, setItems] = React.useState(initial);\n  const [query, setQuery] = React.useState(\"\");\n  const [selected, setSelected] = React.useState<string | null>(null);\n  const [drag, setDrag] = React.useState<Drag | null>(null);\n  const [toast, setToast] = React.useState<{ text: string; undo?: Candidate[] } | null>(null);\n  const boardRef = React.useRef<HTMLDivElement>(null);\n\n  React.useEffect(() => {\n    if (!toast) return;\n    const t = setTimeout(() => setToast(null), 3500);\n    return () => clearTimeout(t);\n  }, [toast]);\n\n  const q = query.trim().toLowerCase();\n  const visible = items.filter((c) => !q || `${c.name} ${c.current} ${c.source} ${(c.tags ?? []).join(\" \")}`.toLowerCase().includes(q));\n  const counts = STAGES.map((s) => items.filter((c) => c.stage === s.id).length);\n  const total = items.length;\n  const stuck = items.filter((c) => c.days > 7 && c.stage !== \"hired\").length;\n\n  const move = (id: string, stage: Stage) => {\n    const c = items.find((x) => x.id === id);\n    if (!c || c.stage === stage) return;\n    const before = items;\n    setItems((list) => [{ ...c, stage, days: 0, next: stage === \"hired\" ? \"Starts in 2 weeks\" : stage === \"offer\" ? \"Offer being drafted\" : undefined }, ...list.filter((x) => x.id !== id)]);\n    onMove?.(id, stage);\n    setToast({ text: `${c.name.split(\" \")[0]} moved to ${STAGES.find((s) => s.id === stage)!.label}`, undo: before });\n  };\n  const advance = (c: Candidate) => {\n    const i = STAGES.findIndex((s) => s.id === c.stage);\n    if (i < STAGES.length - 1) move(c.id, STAGES[i + 1].id);\n  };\n  const reject = (c: Candidate) => {\n    const before = items;\n    setItems((list) => list.filter((x) => x.id !== c.id));\n    setSelected(null);\n    onReject?.(c.id);\n    setToast({ text: `${c.name.split(\" \")[0]} rejected · email queued`, undo: before });\n  };\n\n  // Board-relative coordinates work inside zoomed or scaled containers.\n  const local = (clientX: number, clientY: number) => {\n    const b = boardRef.current;\n    if (!b) return { x: clientX, y: clientY, s: 1 };\n    const r = b.getBoundingClientRect();\n    const s = r.width / b.offsetWidth || 1;\n    return { x: (clientX - r.left) / s + b.scrollLeft, y: (clientY - r.top) / s, s };\n  };\n  const onDown = (e: React.PointerEvent<HTMLElement>, c: Candidate) => {\n    if (e.button !== 0 || e.pointerType === \"touch\") return;\n    const rect = e.currentTarget.getBoundingClientRect();\n    const pt = local(e.clientX, e.clientY);\n    const s = pt.s;\n    e.currentTarget.setPointerCapture(e.pointerId);\n    setDrag({ id: c.id, x: pt.x, y: pt.y, offX: (e.clientX - rect.left) / s, offY: (e.clientY - rect.top) / s, w: rect.width / s, startX: e.clientX, startY: e.clientY, active: false, over: c.stage });\n  };\n  const onMoveP = (e: React.PointerEvent<HTMLElement>) => {\n    if (!drag) return;\n    const pt = local(e.clientX, e.clientY);\n    const active = drag.active || Math.hypot(e.clientX - drag.startX, e.clientY - drag.startY) > 5;\n    const el = document.elementFromPoint(e.clientX, e.clientY)?.closest<HTMLElement>(\"[data-col]\");\n    setDrag({ ...drag, x: pt.x, y: pt.y, active, over: (el?.dataset.col as Stage) ?? null });\n  };\n  const onUp = (c: Candidate) => {\n    if (!drag) return;\n    if (drag.active) {\n      if (drag.over) move(c.id, drag.over);\n    } else setSelected((s) => (s === c.id ? null : c.id));\n    setDrag(null);\n  };\n\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.col } as React.CSSProperties;\n  const focus = \"outline-none focus-visible:ring-2 focus-visible:ring-offset-2\";\n  const dragged = drag?.active ? items.find((c) => c.id === drag.id) : null;\n\n  const cardBody = (c: Candidate, ghost = false) => (\n    <>\n      <div className=\"flex items-start gap-2.5\">\n        <span className=\"grid h-8 w-8 shrink-0 place-items-center rounded-full text-[11.5px] font-semibold text-[#0A0A0A]\" style={{ background: c.color }} aria-hidden=\"true\">\n          {initials(c.name)}\n        </span>\n        <span className=\"min-w-0 flex-1\">\n          <span className=\"block truncate text-[13px] font-medium\">{c.name}</span>\n          <span className=\"block truncate text-[11.5px]\" style={{ color: p.faint }}>\n            {c.current}\n          </span>\n        </span>\n      </div>\n      {c.next && (\n        <p className=\"m-0 mt-2 truncate rounded-md px-2 py-1 text-[11.5px]\" style={{ background: p.track, color: p.muted }}>\n          {c.next}\n        </p>\n      )}\n      <div className=\"mt-2.5 flex items-center gap-2 text-[11px]\">\n        <span className=\"flex gap-px\" aria-label={c.rating ? `${c.rating} of 5` : \"Not rated\"} role=\"img\">\n          {[1, 2, 3, 4, 5].map((i) => (\n            <svg key={i} width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill={i <= c.rating ? p.star : \"none\"} stroke={i <= c.rating ? p.star : p.faint} strokeWidth=\"2\" aria-hidden=\"true\">\n              <path d=\"m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.5 2.9 1-6.1L3.2 9.5l6.1-.9z\" />\n            </svg>\n          ))}\n        </span>\n        <span className=\"truncate\" style={{ color: p.faint }}>\n          {c.source}\n        </span>\n        {c.stage !== \"hired\" && (\n          <span className=\"ml-auto shrink-0 tabular-nums\" style={{ color: c.days > 7 ? p.red : p.faint }} title=\"Days in stage\">\n            {c.days === 0 ? \"new\" : `${c.days}d`}\n          </span>\n        )}\n      </div>\n      {!ghost && (c.tags?.length ?? 0) > 0 && (\n        <div className=\"mt-2 flex flex-wrap gap-1\">\n          {c.tags!.map((t) => (\n            <span key={t} className=\"rounded px-1.5 py-px text-[10.5px]\" style={{ background: p.track, color: p.muted }}>\n              {t}\n            </span>\n          ))}\n        </div>\n      )}\n    </>\n  );\n\n  return (\n    <section className={cn(\"@container relative w-full\", className)} style={{ background: p.bg, color: p.text }}>\n      <div className=\"mx-auto max-w-7xl px-4 py-10 @[640px]:px-6\">\n        <div className=\"flex flex-wrap items-end justify-between gap-3\">\n          <div>\n            <p className=\"m-0 text-[12px]\" style={{ color: p.faint }}>\n              {team}\n            </p>\n            <h2 className=\"m-0 mt-0.5 text-[22px] font-semibold tracking-[-0.01em]\">{role}</h2>\n            <p className=\"m-0 mt-1 text-[13px]\" style={{ color: p.muted }}>\n              {total} candidates · {counts[4]} hired of 1 opening\n              {stuck > 0 && <span style={{ color: p.red }}> · {stuck} waiting over a week</span>}\n            </p>\n          </div>\n          <label className=\"flex h-9 w-full items-center gap-2 rounded-lg border px-2.5 focus-within:ring-2 @[640px]:w-60\" style={{ borderColor: p.border, background: p.input, color: p.faint, ...ring }}>\n            <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n              <path d=\"M11 4a7 7 0 1 0 0 14 7 7 0 0 0 0-14zM21 21l-4.3-4.3\" />\n            </svg>\n            <input value={query} onChange={(e) => setQuery(e.target.value)} placeholder=\"Search candidates or tags\" aria-label=\"Search candidates\" className=\"h-full min-w-0 flex-1 border-0 bg-transparent text-[13px] outline-none\" style={{ color: p.text }} />\n          </label>\n        </div>\n\n        {/* Funnel */}\n        <div className=\"mt-4 flex h-1.5 gap-0.5 overflow-hidden rounded-full\" role=\"img\" aria-label={STAGES.map((s, i) => `${s.label} ${counts[i]}`).join(\", \")}>\n          {STAGES.map((s, i) => (\n            <motion.span key={s.id} className=\"h-full\" initial={false} animate={{ flexGrow: Math.max(counts[i], 0.15) }} transition={{ duration: reduce ? 0 : 0.4 }} style={{ background: s.color, flexBasis: 0 }} />\n          ))}\n        </div>\n\n        <div ref={boardRef} className=\"relative mt-4 -mx-4 overflow-x-auto px-4 pb-2 [scrollbar-width:thin] @[640px]:-mx-6 @[640px]:px-6\">\n          <div className=\"grid min-w-[880px] grid-cols-5 gap-3\">\n            {STAGES.map((s, i) => {\n              const list = visible.filter((c) => c.stage === s.id);\n              const isOver = drag?.active && drag.over === s.id && dragged?.stage !== s.id;\n              return (\n                <div key={s.id} data-col={s.id} role=\"group\" aria-label={`${s.label}, ${counts[i]} candidates`} className=\"flex min-h-[420px] flex-col rounded-xl border p-2 transition-colors\" style={{ background: isOver ? `${s.color}14` : p.col, borderColor: isOver ? `${s.color}88` : p.border }}>\n                  <div className=\"flex items-center gap-2 px-1.5 pt-1 pb-2.5\">\n                    <span className=\"h-2 w-2 rounded-full\" style={{ background: s.color }} />\n                    <span className=\"text-[12.5px] font-semibold\">{s.label}</span>\n                    <motion.span key={counts[i]} initial={reduce ? false : { scale: 1.4 }} animate={{ scale: 1 }} className=\"rounded-full px-1.5 text-[11px] tabular-nums\" style={{ background: p.track, color: p.muted }}>\n                      {counts[i]}\n                    </motion.span>\n                    {i > 0 && counts[i - 1] + counts[i] > 0 && (\n                      <span className=\"ml-auto text-[10.5px] tabular-nums\" style={{ color: p.faint }} title=\"Share of candidates who reached this stage\">\n                        {Math.round((STAGES.slice(i).reduce((a, _, j) => a + counts[i + j], 0) / total) * 100)}%\n                      </span>\n                    )}\n                  </div>\n                  <ul className=\"m-0 flex flex-1 list-none flex-col gap-2 p-0\">\n                    <AnimatePresence initial={false}>\n                      {list.map((c) => {\n                        const isSel = selected === c.id;\n                        const lifted = drag?.active && drag.id === c.id;\n                        return (\n                          <motion.li key={c.id} layout={reduce ? false : \"position\"} initial={reduce ? false : { opacity: 0, scale: 0.96 }} animate={{ opacity: lifted ? 0.35 : 1, scale: 1 }} exit={reduce ? undefined : { opacity: 0, scale: 0.96 }} transition={{ duration: 0.2 }}>\n                            <div\n                              role=\"button\"\n                              tabIndex={0}\n                              aria-expanded={isSel}\n                              aria-label={`${c.name}, ${s.label}`}\n                              onPointerDown={(e) => onDown(e, c)}\n                              onPointerMove={onMoveP}\n                              onPointerUp={() => onUp(c)}\n                              onPointerCancel={() => setDrag(null)}\n                              onKeyDown={(e) => {\n                                if (e.key === \"Enter\" || e.key === \" \") {\n                                  e.preventDefault();\n                                  setSelected(isSel ? null : c.id);\n                                } else if (e.key === \"ArrowRight\" && e.shiftKey) advance(c);\n                              }}\n                              className={cn(\"cursor-grab touch-pan-x touch-pan-y rounded-lg border p-2.5 select-none active:cursor-grabbing\", focus)}\n                              style={{ background: isSel ? p.cardHover : p.card, borderColor: isSel ? p.ring.replace(/[\\d.]+\\)$/, \"0.35)\") : p.border, ...ring }}\n                            >\n                              {cardBody(c)}\n                            </div>\n                            <AnimatePresence initial={false}>\n                              {isSel && (\n                                <motion.div key=\"act\" initial={reduce ? false : { height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={reduce ? undefined : { height: 0, opacity: 0 }} className=\"overflow-hidden\">\n                                  <div className=\"flex gap-1.5 pt-1.5\">\n                                    {s.id !== \"hired\" && (\n                                      <button type=\"button\" onClick={() => advance(c)} className={cn(\"h-7 flex-1 cursor-pointer rounded-md border-0 text-[11.5px] font-medium\", focus)} style={{ background: p.on, color: p.onText, ...ring }}>\n                                        Move to {STAGES[i + 1].label} →\n                                      </button>\n                                    )}\n                                    <button type=\"button\" onClick={() => reject(c)} className={cn(\"h-7 cursor-pointer rounded-md border bg-transparent px-2 text-[11.5px] font-medium\", focus, s.id === \"hired\" && \"flex-1\")} style={{ borderColor: p.border, color: p.red, ...ring }}>\n                                      Reject\n                                    </button>\n                                  </div>\n                                </motion.div>\n                              )}\n                            </AnimatePresence>\n                          </motion.li>\n                        );\n                      })}\n                    </AnimatePresence>\n                    {list.length === 0 && (\n                      <li className=\"grid flex-1 place-items-center rounded-lg border border-dashed text-[11.5px]\" style={{ borderColor: p.border, color: p.faint }}>\n                        {q ? \"No matches\" : \"Drop candidates here\"}\n                      </li>\n                    )}\n                  </ul>\n                </div>\n              );\n            })}\n          </div>\n          {dragged && drag && (\n            <div className=\"pointer-events-none absolute top-0 left-0 z-20 rounded-lg border p-2.5 shadow-2xl\" style={{ width: drag.w, transform: `translate(${drag.x - drag.offX}px, ${drag.y - drag.offY}px) rotate(2deg)`, background: p.cardHover, borderColor: p.ring.replace(/[\\d.]+\\)$/, \"0.4)\"), color: p.text }} aria-hidden=\"true\">\n              {cardBody(dragged, true)}\n            </div>\n          )}\n        </div>\n        <p className=\"m-0 mt-2 text-[11.5px]\" style={{ color: p.faint }}>\n          Drag cards between stages, or select one and use Move to. Shift + → also advances a focused card.\n        </p>\n      </div>\n      <AnimatePresence>\n        {toast && (\n          <motion.div key={toast.text} role=\"status\" initial={reduce ? false : { opacity: 0, y: 8 }} animate={{ opacity: 1, y: 0 }} exit={reduce ? undefined : { opacity: 0 }} className=\"absolute bottom-5 left-1/2 z-30 flex -translate-x-1/2 items-center gap-3 rounded-full border py-1.5 pr-1.5 pl-3.5 text-[12.5px] whitespace-nowrap shadow-xl\" style={{ background: p.card, borderColor: p.border }}>\n            {toast.text}\n            {toast.undo && (\n              <button\n                type=\"button\"\n                onClick={() => {\n                  setItems(toast.undo!);\n                  setToast(null);\n                }}\n                className={cn(\"h-6 cursor-pointer rounded-full border-0 px-2.5 text-[12px] font-medium\", focus)}\n                style={{ background: p.on, color: p.onText, ...ring }}\n              >\n                Undo\n              </button>\n            )}\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </section>\n  );\n}\n\nexport default HiringPipelineBoard;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}