{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"checkout-stepper-with-completed-checkmarks","type":"registry:component","title":"Checkout Stepper With Completed Checkmarks","description":"","dependencies":[],"files":[{"path":"components/we-inc/checkout-stepper-with-completed-checkmarks.tsx","type":"registry:component","content":"import { useState } from \"react\";\n\n// Checkout stages. `summary` is what a finished stage shows under its name.\nconst stages = [\n  { name: \"Bag\", summary: \"2 items, $86.00\" },\n  { name: \"Address\", summary: \"18 Orchard Row, Bristol\" },\n  { name: \"Delivery\", summary: \"Standard, 3 to 4 days\" },\n  { name: \"Payment\", summary: \"\" },\n];\nconst options = [\n  { id: \"standard\", label: \"Standard\", note: \"3 to 4 working days\", price: \"Free\" },\n  { id: \"next\", label: \"Next day\", note: \"Order by 2pm\", price: \"$6.50\" },\n  { id: \"collect\", label: \"Collect in store\", note: \"Ready tomorrow, Park Street\", price: \"Free\" },\n];\n\nexport default function CheckoutStepperWithCompletedCheckmarks() {\n  const [current, setCurrent] = useState(2);\n  const [choice, setChoice] = useState(\"standard\");\n\n  return (\n    <div className=\"bg-rose-50 px-4 py-12 sm:px-8\">\n      <div className=\"mx-auto max-w-2xl rounded-2xl bg-white p-5 shadow-sm ring-1 ring-rose-100 sm:p-8\">\n        <nav aria-label=\"Checkout progress\">\n          <ol className=\"grid grid-cols-4 gap-2\">\n            {stages.map((s, i) => {\n              const done = i < current;\n              const now = i === current;\n              const inner = (\n                <>\n                  <span className={`block h-1 rounded-full ${done ? \"bg-rose-600\" : now ? \"bg-rose-300\" : \"bg-slate-200\"}`} aria-hidden=\"true\" />\n                  <span className=\"mt-2 flex items-center gap-1.5 text-sm font-semibold\">\n                    {done && <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" className=\"text-rose-600\" aria-hidden=\"true\"><path d=\"M5 12l5 5 9-10\" /></svg>}\n                    <span className={now || done ? \"text-slate-900\" : \"text-slate-600\"}>{s.name}</span>\n                    {done && <span className=\"sr-only\">, done, edit</span>}\n                  </span>\n                  {done && <span className=\"mt-0.5 hidden truncate text-xs text-slate-600 sm:block\">{s.summary}</span>}\n                </>\n              );\n              return (\n                <li key={s.name} aria-current={now ? \"step\" : undefined} className=\"min-w-0\">\n                  {done ? (\n                    <button type=\"button\" onClick={() => setCurrent(i)} className=\"block w-full rounded-md pb-1 text-left hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-rose-500\">{inner}</button>\n                  ) : (\n                    <div className=\"pb-1\">{inner}</div>\n                  )}\n                </li>\n              );\n            })}\n          </ol>\n        </nav>\n\n        <fieldset className=\"mt-8\">\n          <legend className=\"text-lg font-semibold text-slate-900\">{current === 2 ? \"Choose delivery\" : `${stages[current].name}`}</legend>\n          {current === 2 ? (\n            <div className=\"mt-4 space-y-2\">\n              {options.map((o) => (\n                <label key={o.id} className={`flex min-h-[56px] cursor-pointer items-center gap-3 rounded-xl border px-4 py-3 ${choice === o.id ? \"border-rose-500 bg-rose-50/60\" : \"border-slate-200 hover:border-slate-300\"}`}>\n                  <input type=\"radio\" aria-label={o.label} name=\"ccs-delivery\" value={o.id} checked={choice === o.id} onChange={() => setChoice(o.id)} className=\"h-4 w-4 accent-rose-600\" />\n                  <span className=\"flex-1\">\n                    <span className=\"block text-sm font-medium text-slate-900\">{o.label}</span>\n                    <span className=\"block text-xs text-slate-600\">{o.note}</span>\n                  </span>\n                  <span className=\"text-sm font-semibold text-slate-900\">{o.price}</span>\n                </label>\n              ))}\n            </div>\n          ) : (\n            <p className=\"mt-3 text-sm text-slate-600\">{current < 2 ? `Saved: ${stages[current].summary}.` : \"Card details would go here.\"}</p>\n          )}\n        </fieldset>\n\n        <div className=\"mt-6 flex items-center justify-between\">\n          <button type=\"button\" onClick={() => setCurrent((c) => Math.max(0, c - 1))} disabled={current === 0} className=\"h-11 rounded-full px-4 text-sm font-medium text-slate-700 hover:bg-slate-100 disabled:opacity-40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-rose-500\">Back</button>\n          <button type=\"button\" onClick={() => setCurrent((c) => Math.min(stages.length - 1, c + 1))} className=\"h-11 rounded-full bg-rose-600 px-6 text-sm font-semibold text-white hover:bg-rose-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-rose-500 focus-visible:ring-offset-2\">\n            {current === stages.length - 1 ? \"Pay $86.00\" : `Continue to ${stages[current + 1].name.toLowerCase()}`}\n          </button>\n        </div>\n      </div>\n    </div>\n  );\n}\n"}]}
