{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "popconfirm-publish-checklist",
  "title": "Popconfirm Publish Checklist",
  "description": "A publish button whose popconfirm lists what is missing (title, image alt text, summary) and offers Publish anyway only when there are warnings.",
  "registryDependencies": [
    "button",
    "@tealmac/popconfirm"
  ],
  "files": [
    {
      "path": "registry/patterns/popconfirm-publish-checklist/popconfirm-publish-checklist.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { AlertTriangle, CheckCircle2 } from \"lucide-react\"\n\nimport { Button } from \"@/components/ui/button\"\nimport { Popconfirm } from \"@/components/ui/popconfirm\"\n\nexport interface PublishCheck {\n  id: string\n  label: string\n  passed: boolean\n}\n\nexport interface PopconfirmPublishChecklistProps {\n  checks: PublishCheck[]\n  onPublish: () => void | Promise<void>\n  /** Name of the thing, for example \"post\". */\n  noun?: string\n}\n\n/**\n * Publishing is easy to regret in a CMS. The popconfirm shows each check with\n * an icon and a word (Done or Missing), the title says whether the page is\n * ready, and when something is missing the button reads \"Publish anyway\" so the\n * choice is explicit rather than silent.\n */\nexport function PopconfirmPublishChecklist({\n  checks,\n  onPublish,\n  noun = \"page\",\n}: PopconfirmPublishChecklistProps) {\n  const missing = checks.filter((c) => !c.passed)\n  return (\n    <Popconfirm\n      title={\n        missing.length\n          ? `${missing.length} thing${missing.length === 1 ? \"\" : \"s\"} missing`\n          : `Publish this ${noun}?`\n      }\n      description={\n        <ul className=\"mt-2 space-y-1.5\">\n          {checks.map((c) => (\n            <li key={c.id} className=\"flex items-center gap-2\">\n              {c.passed ? (\n                <CheckCircle2\n                  className=\"size-4 text-emerald-700 dark:text-emerald-400\"\n                  aria-hidden\n                />\n              ) : (\n                <AlertTriangle\n                  className=\"size-4 text-amber-700 dark:text-amber-400\"\n                  aria-hidden\n                />\n              )}\n              <span>\n                {c.label}\n                <span className=\"sr-only\">\n                  {c.passed ? \": done\" : \": missing\"}\n                </span>\n              </span>\n            </li>\n          ))}\n        </ul>\n      }\n      confirmLabel={missing.length ? \"Publish anyway\" : \"Publish\"}\n      cancelLabel=\"Not yet\"\n      onConfirm={onPublish}\n    >\n      <Button type=\"button\">Publish {noun}</Button>\n    </Popconfirm>\n  )\n}\n",
      "type": "registry:block"
    }
  ],
  "type": "registry:block"
}