{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "ecommerce-09",
  "type": "registry:block",
  "description": "Multi-step checkout stepper for contact, delivery and payment beside a live order summary.",
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "button",
    "input",
    "label"
  ],
  "files": [
    {
      "path": "registry/designali/blocks/ecommerce/ecommerce-09.tsx",
      "content": "\"use client\"\n\nimport { useState } from \"react\"\nimport {\n  Check,\n  CreditCard,\n  Lock,\n} from \"@designali/icons\"\n\nimport { Button } from \"@workspace/ui/components/button\"\nimport { Input } from \"@workspace/ui/components/input\"\nimport { Label } from \"@workspace/ui/components/label\"\nimport { cn } from \"@workspace/ui/lib/utils\"\n\nconst steps = [\"Contact\", \"Delivery\", \"Payment\"]\n\nconst deliveryOptions = [\n  { id: \"standard\", label: \"Instant download\", detail: \"Files and license by email\", price: 0 },\n  { id: \"express\", label: \"Setup help\", detail: \"Designali installs it on your Vercel\", price: 9 },\n  { id: \"pickup\", label: \"GitHub access\", detail: \"Private repo invite in 2 hours\", price: 0 },\n]\n\nconst items = [\n  { name: \"Design Agency Template\", variant: \"Pro license · Next.js + Figma\", price: 79, image: \"/images/templates/design-agency.jpg\" },\n  { name: \"Designali Icons Pro\", variant: \"Personal license\", price: 39, image: \"/images/templates/dalim-icons-old.jpg\" },\n]\n\nexport default function Ecommerce09() {\n  const [step, setStep] = useState(0)\n  const [delivery, setDelivery] = useState(\"standard\")\n  const [placed, setPlaced] = useState(false)\n\n  const shipping = deliveryOptions.find((d) => d.id === delivery)?.price ?? 0\n  const subtotal = items.reduce((s, i) => s + i.price, 0)\n  const total = subtotal + shipping\n\n  const next = () => (step < steps.length - 1 ? setStep(step + 1) : setPlaced(true))\n\n  return (\n    <section className=\"w-full bg-background py-16 text-foreground md:py-24\">\n      <div className=\"mx-auto grid max-w-6xl gap-10 px-6 lg:grid-cols-[1fr_380px]\">\n        <div>\n          <ol className=\"flex items-center gap-2 text-sm\">\n            {steps.map((s, i) => (\n              <li key={s} className=\"flex flex-1 items-center gap-2\">\n                <button\n                  type=\"button\"\n                  disabled={i > step || placed}\n                  onClick={() => setStep(i)}\n                  className=\"flex items-center gap-2 disabled:cursor-default\"\n                >\n                  <span\n                    className={cn(\n                      \"flex size-6 shrink-0 items-center justify-center border text-xs\",\n                      i < step || placed\n                        ? \"border-foreground bg-foreground text-background\"\n                        : i === step\n                          ? \"border-foreground\"\n                          : \"border-border text-muted-foreground\"\n                    )}\n                  >\n                    {i < step || placed ? <Check className=\"size-3\" /> : i + 1}\n                  </span>\n                  <span className={cn(i > step && \"text-muted-foreground\")}>{s}</span>\n                </button>\n                {i < steps.length - 1 && <span className=\"h-px flex-1 bg-border\" />}\n              </li>\n            ))}\n          </ol>\n\n          <div className=\"mt-10\">\n            {placed ? (\n              <div className=\"border border-border p-8 text-center\">\n                <span className=\"mx-auto flex size-12 items-center justify-center rounded-full bg-primary/15 text-chart-3 dark:text-primary\">\n                  <Check className=\"size-6\" />\n                </span>\n                <h2 className=\"mt-4 text-2xl font-medium tracking-tight\">Order placed</h2>\n                <p className=\"mt-2 text-sm text-muted-foreground\">\n                  Confirmation #DA-20931 is on its way to your inbox.\n                </p>\n              </div>\n            ) : step === 0 ? (\n              <div className=\"space-y-5\">\n                <h2 className=\"text-2xl font-medium tracking-tight\">Contact details</h2>\n                <div className=\"grid gap-2\">\n                  <Label htmlFor=\"e09-email\">Email</Label>\n                  <Input id=\"e09-email\" type=\"email\" placeholder=\"you@example.com\" className=\"h-10\" />\n                </div>\n                <div className=\"grid gap-4 sm:grid-cols-2\">\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"e09-first\">First name</Label>\n                    <Input id=\"e09-first\" className=\"h-10\" />\n                  </div>\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"e09-last\">Last name</Label>\n                    <Input id=\"e09-last\" className=\"h-10\" />\n                  </div>\n                </div>\n                <div className=\"grid gap-2\">\n                  <Label htmlFor=\"e09-address\">Address</Label>\n                  <Input id=\"e09-address\" placeholder=\"Street and number\" className=\"h-10\" />\n                </div>\n                <div className=\"grid gap-4 sm:grid-cols-[1fr_140px]\">\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"e09-city\">City</Label>\n                    <Input id=\"e09-city\" className=\"h-10\" />\n                  </div>\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"e09-zip\">Postcode</Label>\n                    <Input id=\"e09-zip\" className=\"h-10\" />\n                  </div>\n                </div>\n              </div>\n            ) : step === 1 ? (\n              <fieldset className=\"space-y-3\">\n                <legend className=\"mb-5 text-2xl font-medium tracking-tight\">Delivery method</legend>\n                {deliveryOptions.map((o) => (\n                  <label\n                    key={o.id}\n                    className={cn(\n                      \"flex cursor-pointer items-center gap-4 border p-4 transition-colors\",\n                      delivery === o.id ? \"border-foreground bg-muted/50\" : \"border-border hover:bg-muted/30\"\n                    )}\n                  >\n                    <input\n                      type=\"radio\"\n                      name=\"e09-delivery\"\n                      value={o.id}\n                      checked={delivery === o.id}\n                      onChange={() => setDelivery(o.id)}\n                      className=\"size-4 accent-foreground\"\n                    />\n                    <span className=\"flex-1\">\n                      <span className=\"block text-sm font-medium\">{o.label}</span>\n                      <span className=\"block text-xs text-muted-foreground\">{o.detail}</span>\n                    </span>\n                    <span className=\"text-sm tabular-nums\">{o.price ? `$${o.price}` : \"Free\"}</span>\n                  </label>\n                ))}\n              </fieldset>\n            ) : (\n              <div className=\"space-y-5\">\n                <h2 className=\"text-2xl font-medium tracking-tight\">Payment</h2>\n                <div className=\"grid gap-2\">\n                  <Label htmlFor=\"e09-card\">Card number</Label>\n                  <div className=\"relative\">\n                    <Input id=\"e09-card\" inputMode=\"numeric\" placeholder=\"1234 1234 1234 1234\" className=\"h-10 pr-10\" />\n                    <CreditCard className=\"absolute top-1/2 right-3 size-4 -translate-y-1/2 text-muted-foreground\" />\n                  </div>\n                </div>\n                <div className=\"grid grid-cols-2 gap-4\">\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"e09-exp\">Expiry</Label>\n                    <Input id=\"e09-exp\" placeholder=\"MM / YY\" className=\"h-10\" />\n                  </div>\n                  <div className=\"grid gap-2\">\n                    <Label htmlFor=\"e09-cvc\">CVC</Label>\n                    <Input id=\"e09-cvc\" placeholder=\"123\" className=\"h-10\" />\n                  </div>\n                </div>\n                <p className=\"flex items-center gap-2 text-xs text-muted-foreground\">\n                  <Lock className=\"size-3.5\" />\n                  Payments are encrypted and processed securely.\n                </p>\n              </div>\n            )}\n\n            {!placed && (\n              <div className=\"mt-8 flex items-center justify-between gap-4\">\n                <Button variant=\"ghost\" disabled={step === 0} onClick={() => setStep(step - 1)}>\n                  Back\n                </Button>\n                <Button size=\"lg\" onClick={next}>\n                  {step === steps.length - 1 ? `Pay $${total.toFixed(2)}` : `Continue to ${steps[step + 1]?.toLowerCase()}`}\n                </Button>\n              </div>\n            )}\n          </div>\n        </div>\n\n        <aside className=\"h-fit border border-border bg-muted/40 p-6\">\n          <h3 className=\"font-medium\">Order summary</h3>\n          <ul className=\"mt-5 space-y-4\">\n            {items.map((item) => (\n              <li key={item.name} className=\"flex gap-3\">\n                <img src={item.image} alt={item.name} className=\"size-14 shrink-0 object-cover object-top border border-border\" />\n                <span className=\"flex-1\">\n                  <span className=\"block text-sm font-medium\">{item.name}</span>\n                  <span className=\"block text-xs text-muted-foreground\">{item.variant}</span>\n                </span>\n                <span className=\"text-sm tabular-nums\">${item.price}</span>\n              </li>\n            ))}\n          </ul>\n          <dl className=\"mt-6 space-y-2 border-t border-border pt-4 text-sm\">\n            <div className=\"flex justify-between\">\n              <dt className=\"text-muted-foreground\">Subtotal</dt>\n              <dd className=\"tabular-nums\">${subtotal.toFixed(2)}</dd>\n            </div>\n            <div className=\"flex justify-between\">\n              <dt className=\"text-muted-foreground\">Delivery</dt>\n              <dd className=\"tabular-nums\">{shipping ? `$${shipping.toFixed(2)}` : \"Free\"}</dd>\n            </div>\n            <div className=\"flex justify-between border-t border-border pt-3 text-base font-medium\">\n              <dt>Total</dt>\n              <dd className=\"tabular-nums\">${total.toFixed(2)}</dd>\n            </div>\n          </dl>\n        </aside>\n      </div>\n    </section>\n  )\n}\n",
      "type": "registry:component"
    }
  ],
  "meta": {
    "iframeHeight": "800px"
  },
  "categories": [
    "ecommerce"
  ]
}