{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "checklist",
  "title": "Checklist",
  "description": "An onboarding checklist: a progress bar and count up top, round checks that draw in and strike the step through, the next step opening by itself with its own action button, a fold-away header and an all-done state.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/checklist/checklist.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { motion, AnimatePresence, 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 ChecklistItem {\n  id: string;\n  title: string;\n  description?: string;\n  /** A button shown while this is the next step, e.g. \"Connect domain\". */\n  action?: { label: string; href?: string; onClick?: () => void };\n  /** Mark it done automatically when its action is used. */\n  completeOnAction?: boolean;\n}\n\nexport interface ChecklistProps {\n  items?: ChecklistItem[];\n  /** Ids of finished items. */\n  value?: string[];\n  defaultValue?: string[];\n  onValueChange?: (done: string[]) => void;\n  title?: string;\n  /** Shown under the title until everything is done. */\n  subtitle?: string;\n  /** Let people fold the list away to just its header. */\n  collapsible?: boolean;\n  defaultCollapsed?: boolean;\n  /** Called from the \"Dismiss\" button that appears once everything is done. */\n  onDismiss?: () => void;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { text: \"#F5F4F1\", muted: \"rgba(245,244,241,0.55)\", faint: \"rgba(245,244,241,0.3)\", panel: \"#0E0E0E\", border: \"rgba(255,255,255,0.1)\", line: \"rgba(255,255,255,0.07)\", hover: \"rgba(255,255,255,0.04)\", track: \"rgba(255,255,255,0.1)\", fill: \"#F5F4F1\", onFill: \"#0A0A0A\", ring: \"rgba(245,244,241,0.3)\", focus: \"rgba(245,244,241,0.85)\" },\n  light: { text: \"#0A0A0A\", muted: \"rgba(10,10,10,0.55)\", faint: \"rgba(10,10,10,0.3)\", panel: \"#FFFFFF\", border: \"rgba(10,10,10,0.12)\", line: \"rgba(10,10,10,0.07)\", hover: \"rgba(10,10,10,0.03)\", track: \"rgba(10,10,10,0.08)\", fill: \"#0A0A0A\", onFill: \"#FFFFFF\", ring: \"rgba(10,10,10,0.28)\", focus: \"rgba(10,10,10,0.85)\" },\n};\n\nconst DEFAULT_ITEMS: ChecklistItem[] = [\n  { id: \"account\", title: \"Create your account\", description: \"Your workspace is ready at northwind.app.\" },\n  { id: \"profile\", title: \"Add your store details\", description: \"Name, logo and support email appear on receipts and emails.\", action: { label: \"Open settings\" }, completeOnAction: true },\n  { id: \"product\", title: \"Add your first product\", description: \"Upload photos, set a price and choose what's in stock.\", action: { label: \"Add product\" }, completeOnAction: true },\n  { id: \"payments\", title: \"Set up payments\", description: \"Connect Stripe or PayPal so you can take orders.\", action: { label: \"Connect payments\" }, completeOnAction: true },\n  { id: \"domain\", title: \"Connect your domain\", description: \"Point shop.yourbrand.com at your store in a couple of minutes.\", action: { label: \"Connect domain\" }, completeOnAction: true },\n  { id: \"launch\", title: \"Launch your store\", description: \"Take the password off and start selling.\", action: { label: \"Go live\" }, completeOnAction: true },\n];\n\nfunction Check({ done, p, reduce }: { done: boolean; p: (typeof PALETTES)[\"dark\"]; reduce: boolean }) {\n  return (\n    <span aria-hidden=\"true\" className=\"relative flex shrink-0 items-center justify-center rounded-full\" style={{ width: 20, height: 20, border: `1.5px solid ${done ? p.fill : p.ring}`, background: done ? p.fill : \"transparent\", transition: \"background 0.18s ease, border-color 0.18s ease\" }}>\n      <svg width=\"11\" height=\"11\" viewBox=\"0 0 12 12\" fill=\"none\">\n        <motion.path d=\"M2.4 6.3 4.9 8.7 9.6 3.4\" stroke={p.onFill} strokeWidth=\"1.9\" strokeLinecap=\"round\" strokeLinejoin=\"round\" initial={false} animate={{ pathLength: done ? 1 : 0, opacity: done ? 1 : 0 }} transition={reduce ? { duration: 0 } : { duration: 0.22, ease: \"easeOut\" }} />\n      </svg>\n      {!reduce && (\n        <AnimatePresence>\n          {done && <motion.span key=\"burst\" className=\"absolute inset-0 rounded-full\" style={{ border: `1.5px solid ${p.fill}` }} initial={{ scale: 1, opacity: 0.6 }} animate={{ scale: 1.9, opacity: 0 }} exit={{ opacity: 0 }} transition={{ duration: 0.5, ease: \"easeOut\" }} />}\n        </AnimatePresence>\n      )}\n    </span>\n  );\n}\n\nexport function Checklist({\n  items = DEFAULT_ITEMS,\n  value,\n  defaultValue = [\"account\"],\n  onValueChange,\n  title = \"Get your store ready\",\n  subtitle = \"A few steps and you're ready to take orders.\",\n  collapsible = true,\n  defaultCollapsed = false,\n  onDismiss,\n  theme = \"dark\",\n  className,\n}: ChecklistProps) {\n  const p = PALETTES[theme];\n  const uid = React.useId();\n  const reduce = Boolean(useReducedMotion());\n  const [internal, setInternal] = React.useState<string[]>(defaultValue);\n  const done = value ?? internal;\n  const [collapsed, setCollapsed] = React.useState(defaultCollapsed);\n  // null follows the next step automatically; \"none\" means the person closed every row.\n  const [openId, setOpenId] = React.useState<string | null>(null);\n\n  const doneCount = items.filter((i) => done.includes(i.id)).length;\n  const allDone = doneCount === items.length && items.length > 0;\n  const nextId = items.find((i) => !done.includes(i.id))?.id ?? null;\n  // The open row is the one the person picked, or else the next step to do.\n  const expanded = openId === \"none\" ? null : openId && items.some((i) => i.id === openId) ? openId : nextId;\n\n  const commit = (next: string[]) => {\n    const ordered = items.map((i) => i.id).filter((id) => next.includes(id));\n    if (value === undefined) setInternal(ordered);\n    onValueChange?.(ordered);\n  };\n  const toggle = (id: string) => {\n    const nowDone = !done.includes(id);\n    commit(nowDone ? [...done, id] : done.filter((x) => x !== id));\n    // Finishing a step hands the open row to the next one.\n    if (nowDone) setOpenId(null);\n  };\n\n  const spring = reduce ? { duration: 0 } : { type: \"spring\" as const, stiffness: 320, damping: 34 };\n\n  return (\n    <section className={cn(\"flex w-full flex-col overflow-hidden\", className)} aria-labelledby={`${uid}-title`} style={{ borderRadius: 18, background: p.panel, border: `1px solid ${p.border}`, fontFamily: \"Inter, sans-serif\", color: p.text }}>\n      {/* Header: title, progress, fold button */}\n      <div className=\"flex flex-col\" style={{ gap: 12, padding: \"16px 18px\" }}>\n        <div className=\"flex items-start justify-between\" style={{ gap: 12 }}>\n          <div className=\"flex min-w-0 flex-col\" style={{ gap: 3 }}>\n            <h3 id={`${uid}-title`} className=\"m-0 flex items-center text-[15px] font-semibold tracking-[-0.01em]\" style={{ gap: 8 }}>\n              <AnimatePresence mode=\"wait\" initial={false}>\n                <motion.span key={allDone ? \"done\" : \"todo\"} initial={{ opacity: 0, y: 4 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -4 }} transition={{ duration: reduce ? 0 : 0.18 }}>\n                  {allDone ? \"You're all set\" : title}\n                </motion.span>\n              </AnimatePresence>\n            </h3>\n            <p className=\"m-0 text-[13px]\" style={{ color: p.muted }}>\n              {allDone ? \"Every step is done. Nice work.\" : subtitle}\n            </p>\n          </div>\n          <div className=\"flex shrink-0 items-center\" style={{ gap: 6 }}>\n            <span className=\"text-[12.5px] font-medium tabular-nums\" style={{ color: p.muted }} aria-live=\"polite\">\n              {doneCount} / {items.length}\n            </span>\n            {collapsible && (\n              <button\n                type=\"button\"\n                aria-expanded={!collapsed}\n                aria-controls={`${uid}-list`}\n                aria-label={collapsed ? \"Show steps\" : \"Hide steps\"}\n                onClick={() => setCollapsed((c) => !c)}\n                className=\"flex cursor-pointer items-center justify-center rounded-lg border-none bg-transparent outline-none focus-visible:ring-2\"\n                style={{ width: 28, height: 28, color: p.muted, [\"--tw-ring-color\" as string]: p.focus }}\n              >\n                <motion.svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\" animate={{ rotate: collapsed ? -90 : 0 }} transition={{ duration: reduce ? 0 : 0.2 }}>\n                  <path d=\"m6 9 6 6 6-6\" />\n                </motion.svg>\n              </button>\n            )}\n          </div>\n        </div>\n        <div className=\"relative overflow-hidden rounded-full\" style={{ height: 5, background: p.track }} role=\"progressbar\" aria-valuemin={0} aria-valuemax={items.length} aria-valuenow={doneCount} aria-label=\"Steps done\">\n          <motion.div className=\"absolute inset-y-0 left-0 rounded-full\" style={{ background: p.fill }} initial={false} animate={{ width: `${items.length ? (doneCount / items.length) * 100 : 0}%` }} transition={spring} />\n        </div>\n      </div>\n\n      <AnimatePresence initial={false}>\n        {!collapsed && (\n          <motion.div key=\"list\" id={`${uid}-list`} initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: reduce ? 0 : 0.26, ease: [0.22, 1, 0.36, 1] }} className=\"overflow-hidden\">\n            <ul className=\"m-0 flex list-none flex-col p-0\" style={{ borderTop: `1px solid ${p.line}`, padding: 6 }}>\n              {items.map((item) => {\n                const isDone = done.includes(item.id);\n                const open = expanded === item.id && !isDone;\n                return (\n                  <li key={item.id} className=\"rounded-xl\" style={{ background: open ? p.hover : \"transparent\", transition: \"background 0.2s ease\" }}>\n                    <div className=\"flex items-center\" style={{ gap: 12, padding: \"10px 12px\" }}>\n                      <button\n                        type=\"button\"\n                        role=\"checkbox\"\n                        aria-checked={isDone}\n                        aria-label={`${item.title}${isDone ? \", done\" : \"\"}`}\n                        onClick={() => toggle(item.id)}\n                        className=\"flex cursor-pointer items-center rounded-full border-none bg-transparent p-0 outline-none focus-visible:ring-2 focus-visible:ring-offset-2\"\n                        style={{ [\"--tw-ring-color\" as string]: p.focus, [\"--tw-ring-offset-color\" as string]: p.panel }}\n                      >\n                        <Check done={isDone} p={p} reduce={reduce} />\n                      </button>\n                      <button\n                        type=\"button\"\n                        onClick={() => setOpenId(open ? \"none\" : item.id)}\n                        aria-expanded={item.description || item.action ? open : undefined}\n                        className=\"relative min-w-0 flex-1 cursor-pointer truncate border-none bg-transparent p-0 text-left text-[14px] font-medium outline-none focus-visible:underline\"\n                        style={{ color: isDone ? p.faint : p.text, transition: \"color 0.2s ease\" }}\n                      >\n                        <span className=\"relative\">\n                          {item.title}\n                          <motion.span aria-hidden=\"true\" className=\"absolute top-1/2 left-0 block h-px w-full origin-left\" style={{ background: p.faint }} initial={false} animate={{ scaleX: isDone ? 1 : 0 }} transition={{ duration: reduce ? 0 : 0.3, ease: [0.22, 1, 0.36, 1] }} />\n                        </span>\n                      </button>\n                    </div>\n                    <AnimatePresence initial={false}>\n                      {open && (item.description || item.action) && (\n                        <motion.div key=\"body\" initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: reduce ? 0 : 0.22, ease: [0.22, 1, 0.36, 1] }} className=\"overflow-hidden\">\n                          <div className=\"flex flex-col items-start\" style={{ gap: 10, padding: \"0 12px 12px 44px\" }}>\n                            {item.description && (\n                              <p className=\"m-0 text-[13px] leading-relaxed\" style={{ color: p.muted }}>\n                                {item.description}\n                              </p>\n                            )}\n                            {item.action &&\n                              (item.action.href ? (\n                                <a href={item.action.href} onClick={() => item.completeOnAction && toggle(item.id)} className=\"inline-flex items-center rounded-lg text-[13px] font-semibold no-underline outline-none focus-visible:ring-2\" style={{ height: 32, padding: \"0 12px\", background: p.fill, color: p.onFill, [\"--tw-ring-color\" as string]: p.focus }}>\n                                  {item.action.label}\n                                </a>\n                              ) : (\n                                <button\n                                  type=\"button\"\n                                  onClick={() => {\n                                    item.action?.onClick?.();\n                                    if (item.completeOnAction) toggle(item.id);\n                                  }}\n                                  className=\"cursor-pointer rounded-lg border-none text-[13px] font-semibold outline-none focus-visible:ring-2\"\n                                  style={{ height: 32, padding: \"0 12px\", background: p.fill, color: p.onFill, [\"--tw-ring-color\" as string]: p.focus }}\n                                >\n                                  {item.action.label}\n                                </button>\n                              ))}\n                          </div>\n                        </motion.div>\n                      )}\n                    </AnimatePresence>\n                  </li>\n                );\n              })}\n            </ul>\n            <AnimatePresence initial={false}>\n              {allDone && onDismiss && (\n                <motion.div key=\"dismiss\" initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} className=\"overflow-hidden\">\n                  <div className=\"flex justify-end\" style={{ padding: \"0 18px 14px\" }}>\n                    <button type=\"button\" onClick={onDismiss} className=\"cursor-pointer rounded-lg bg-transparent text-[13px] font-medium outline-none focus-visible:ring-2\" style={{ height: 32, padding: \"0 12px\", border: `1px solid ${p.border}`, color: p.text, [\"--tw-ring-color\" as string]: p.focus }}>\n                      Dismiss\n                    </button>\n                  </div>\n                </motion.div>\n              )}\n            </AnimatePresence>\n          </motion.div>\n        )}\n      </AnimatePresence>\n    </section>\n  );\n}\n\nexport default Checklist;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}