{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "sticky-add-to-cart-bar",
  "title": "Sticky Add to Cart Bar",
  "description": "A product page whose buy box hands off to a floating add-to-cart bar once the main button scrolls away: product thumb, live variant summary, an upward size menu, quantity, price and an Add to cart button that turns into Added while the cart count bumps.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/sticky-add-to-cart-bar/sticky-add-to-cart-bar.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, LayoutGroup, 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 interface StickyBarOption {\n  id: string;\n  label: string;\n  /** Added to the base price. */\n  extra?: number;\n  swatch?: string;\n}\nexport interface StickyBarProduct {\n  name: string;\n  price: number;\n  was?: number;\n  rating: number;\n  reviews: number;\n  images: string[];\n  sizes: StickyBarOption[];\n  straps: StickyBarOption[];\n  details: { title: string; body: string }[];\n}\nexport interface StickyAddToCartBarProps {\n  product?: StickyBarProduct;\n  currency?: string;\n  onAdd?: (item: { size: string; strap: string; qty: number; price: number }) => void | Promise<void>;\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: {\n    bg: \"#0A0A0A\",\n    card: \"#141414\",\n    bar: \"rgba(22,22,22,0.86)\",\n    title: \"#FFFFFF\",\n    muted: \"rgba(255,255,255,0.45)\",\n    body: \"rgba(255,255,255,0.62)\",\n    line: \"rgba(255,255,255,0.12)\",\n    lineHi: \"rgba(255,255,255,0.35)\",\n    tile: \"#F1F1F1\",\n    accent: \"#7CDE6A\",\n    accentText: \"#0B1A08\",\n    star: \"#F5C451\",\n    buttonBg: \"#FFFFFF\",\n    buttonText: \"#111111\",\n    ghost: \"rgba(255,255,255,0.07)\",\n    shadow: \"0 18px 50px -12px rgba(0,0,0,0.7)\",\n  },\n  light: {\n    bg: \"#FFFFFF\",\n    card: \"#F7F7F7\",\n    bar: \"rgba(255,255,255,0.88)\",\n    title: \"#111111\",\n    muted: \"rgba(0,0,0,0.45)\",\n    body: \"rgba(0,0,0,0.62)\",\n    line: \"rgba(0,0,0,0.1)\",\n    lineHi: \"rgba(0,0,0,0.32)\",\n    tile: \"#F1F1F1\",\n    accent: \"#2F9E44\",\n    accentText: \"#FFFFFF\",\n    star: \"#E0A100\",\n    buttonBg: \"#111111\",\n    buttonText: \"#FFFFFF\",\n    ghost: \"rgba(0,0,0,0.05)\",\n    shadow: \"0 18px 50px -14px rgba(0,0,0,0.28)\",\n  },\n};\ntype Palette = (typeof PALETTES)[\"dark\"];\n\nconst W = \"/demo/blocks/product-detail\";\nconst PRODUCT: StickyBarProduct = {\n  name: \"Minimal Watch\",\n  price: 79,\n  was: 129,\n  rating: 4.7,\n  reviews: 318,\n  images: [`${W}/watch-1.webp`, `${W}/watch-2.webp`, `${W}/watch-3.webp`, `${W}/watch-4.webp`],\n  sizes: [\n    { id: \"36\", label: \"36 mm\" },\n    { id: \"40\", label: \"40 mm\" },\n    { id: \"44\", label: \"44 mm\", extra: 10 },\n  ],\n  straps: [\n    { id: \"black\", label: \"Black leather\", swatch: \"#1C1C1C\" },\n    { id: \"tan\", label: \"Tan leather\", swatch: \"#A86F43\" },\n    { id: \"mesh\", label: \"Steel mesh\", swatch: \"#B9BCC0\", extra: 20 },\n  ],\n  details: [\n    { title: \"Design\", body: \"A 7 mm matte case with no logo on the dial, sapphire-coated glass and hand-finished indices that stay legible in low light.\" },\n    { title: \"Movement\", body: \"Japanese quartz movement with a three-year battery, accurate to ±15 seconds a month. Water resistant to 50 m, so rain and hand-washing are fine.\" },\n    { title: \"Strap\", body: \"Vegetable-tanned leather that softens within a week, with quick-release pins. Swap to steel mesh or canvas without tools.\" },\n    { title: \"Shipping & returns\", body: \"Free carbon-neutral shipping over $50, delivered in 2–4 business days. Not right? Return it within 60 days, no questions asked.\" },\n  ],\n};\n\nconst STAR = \"m12 2.8 2.8 5.8 6.3.9-4.6 4.4 1.1 6.3L12 17.2l-5.6 3 1.1-6.3-4.6-4.4 6.3-.9z\";\n\nfunction money(n: number, c: string) {\n  return `${c}${n.toFixed(2)}`;\n}\n\nfunction Qty({ value, onChange, p, small }: { value: number; onChange: (n: number) => void; p: Palette; small?: boolean }) {\n  const btn = cn(\"grid place-items-center rounded-full transition-colors disabled:opacity-30\", small ? \"size-8\" : \"size-10\");\n  return (\n    <div className={cn(\"inline-flex items-center rounded-full border\", small ? \"h-10 px-0.5\" : \"h-12 px-1\")} style={{ borderColor: p.line }}>\n      <button type=\"button\" className={btn} onClick={() => onChange(value - 1)} disabled={value <= 1} aria-label=\"Decrease quantity\" style={{ color: p.title }}>\n        <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"round\" aria-hidden=\"true\">\n          <path d=\"M5 12h14\" />\n        </svg>\n      </button>\n      <span className={cn(\"text-center text-[14px] font-medium tabular-nums\", small ? \"w-6\" : \"w-8\")} style={{ color: p.title }} aria-live=\"polite\" aria-label={`Quantity ${value}`}>\n        {value}\n      </span>\n      <button type=\"button\" className={btn} onClick={() => onChange(value + 1)} disabled={value >= 9} aria-label=\"Increase quantity\" style={{ color: p.title }}>\n        <svg width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.6\" strokeLinecap=\"round\" aria-hidden=\"true\">\n          <path d=\"M12 5v14M5 12h14\" />\n        </svg>\n      </button>\n    </div>\n  );\n}\n\nfunction AddButton({ state, onClick, p, label, className }: { state: \"idle\" | \"adding\" | \"added\"; onClick: () => void; p: Palette; label: string; className?: string }) {\n  const reduce = useReducedMotion();\n  return (\n    <motion.button\n      type=\"button\"\n      onClick={onClick}\n      disabled={state === \"adding\"}\n      whileTap={reduce ? undefined : { scale: 0.97 }}\n      animate={{ background: state === \"added\" ? p.accent : p.buttonBg, color: state === \"added\" ? p.accentText : p.buttonText }}\n      transition={{ duration: 0.25 }}\n      className={cn(\"relative inline-flex items-center justify-center overflow-hidden rounded-full font-semibold whitespace-nowrap\", className)}\n    >\n      <AnimatePresence mode=\"popLayout\" initial={false}>\n        <motion.span key={state} initial={reduce ? false : { y: 14, opacity: 0 }} animate={{ y: 0, opacity: 1 }} exit={{ y: -14, opacity: 0 }} transition={{ duration: 0.2 }} className=\"inline-flex items-center gap-2\">\n          {state === \"adding\" ? (\n            <>\n              <motion.span className=\"size-4 rounded-full border-2 border-current border-t-transparent\" animate={reduce ? undefined : { rotate: 360 }} transition={{ repeat: Infinity, duration: 0.8, ease: \"linear\" }} aria-hidden=\"true\" />\n              Adding…\n            </>\n          ) : state === \"added\" ? (\n            <>\n              <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n                <path d=\"M5 12.5 10 17l9-10\" />\n              </svg>\n              Added\n            </>\n          ) : (\n            label\n          )}\n        </motion.span>\n      </AnimatePresence>\n    </motion.button>\n  );\n}\n\nexport function StickyAddToCartBar({ product = PRODUCT, currency = \"$\", onAdd, theme = \"dark\", className }: StickyAddToCartBarProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [img, setImg] = React.useState(0);\n  const [size, setSize] = React.useState(product.sizes[1]?.id ?? product.sizes[0].id);\n  const [strap, setStrap] = React.useState(product.straps[0].id);\n  const [qty, setQty] = React.useState(1);\n  const [state, setState] = React.useState<\"idle\" | \"adding\" | \"added\">(\"idle\");\n  const [cart, setCart] = React.useState(0);\n  const [open, setOpen] = React.useState<number | null>(0);\n  const [showBar, setShowBar] = React.useState(false);\n  const [sizeMenu, setSizeMenu] = React.useState(false);\n  const ctaRef = React.useRef<HTMLDivElement>(null);\n  const optionsRef = React.useRef<HTMLDivElement>(null);\n  const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);\n\n  const sizeOpt = product.sizes.find((s) => s.id === size) ?? product.sizes[0];\n  const strapOpt = product.straps.find((s) => s.id === strap) ?? product.straps[0];\n  const unit = product.price + (sizeOpt.extra ?? 0) + (strapOpt.extra ?? 0);\n  const wasUnit = product.was ? product.was + (sizeOpt.extra ?? 0) + (strapOpt.extra ?? 0) : undefined;\n\n  // The bar shows once the main button has scrolled above the viewport. A scroll listener (capture, so inner\n  // scrollers count too) instead of IntersectionObserver: a jump straight past the button never crosses a threshold.\n  React.useEffect(() => {\n    let raf = 0;\n    const check = () => {\n      raf = 0;\n      const cta = ctaRef.current;\n      if (!cta) return;\n      const gone = cta.getBoundingClientRect().bottom < 0;\n      setShowBar(gone);\n      if (!gone) setSizeMenu(false);\n    };\n    const onScroll = () => void (raf ||= requestAnimationFrame(check));\n    check();\n    window.addEventListener(\"scroll\", onScroll, { passive: true, capture: true });\n    window.addEventListener(\"resize\", onScroll);\n    return () => {\n      cancelAnimationFrame(raf);\n      window.removeEventListener(\"scroll\", onScroll, { capture: true });\n      window.removeEventListener(\"resize\", onScroll);\n    };\n  }, []);\n  React.useEffect(() => () => void (timer.current && clearTimeout(timer.current)), []);\n\n  const add = async () => {\n    if (state === \"adding\") return;\n    setState(\"adding\");\n    await Promise.all([onAdd?.({ size, strap, qty, price: unit }), new Promise((r) => setTimeout(r, reduce ? 0 : 700))]);\n    setCart((c) => c + qty);\n    setState(\"added\");\n    if (timer.current) clearTimeout(timer.current);\n    timer.current = setTimeout(() => setState(\"idle\"), 2200);\n  };\n  const pickSize = (id: string) => {\n    setSize(id);\n    setState(\"idle\");\n  };\n  const pickStrap = (id: string) => {\n    setStrap(id);\n    setState(\"idle\");\n  };\n  const toOptions = () => optionsRef.current?.scrollIntoView({ behavior: reduce ? \"auto\" : \"smooth\", block: \"center\" });\n\n  const segBtn = (on: boolean) => ({ borderColor: on ? p.title : p.line, background: on ? p.buttonBg : \"transparent\", color: on ? p.buttonText : p.body });\n\n  return (\n    <section className={cn(\"relative w-full overflow-clip px-4 pt-10 pb-24 sm:px-8 sm:pt-14 sm:pb-28\", className)} style={{ background: p.bg, color: p.body }}>\n      <div className=\"mx-auto w-full max-w-[1080px]\">\n        <div className=\"mb-6 flex items-center justify-between gap-4 text-[13px]\">\n          <nav aria-label=\"Breadcrumb\" style={{ color: p.muted }}>\n            <a href=\"#\" className=\"hover:underline\">\n              Watches\n            </a>\n            <span className=\"mx-2\">/</span>\n            <span style={{ color: p.title }}>{product.name}</span>\n          </nav>\n          <a href=\"#\" className=\"inline-flex items-center gap-2 rounded-full border px-3 py-1.5\" style={{ borderColor: p.line, color: p.title }} aria-label={`Cart, ${cart} item${cart === 1 ? \"\" : \"s\"}`}>\n            <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.8\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n              <path d=\"M5 7h14l-1.3 11.2a2 2 0 0 1-2 1.8H8.3a2 2 0 0 1-2-1.8z\" />\n              <path d=\"M9 7V6a3 3 0 0 1 6 0v1\" />\n            </svg>\n            Cart\n            <motion.span\n              key={cart}\n              initial={reduce || !cart ? false : { scale: 1.6 }}\n              animate={{ scale: 1 }}\n              transition={{ type: \"spring\", stiffness: 500, damping: 18 }}\n              className=\"grid h-5 min-w-5 place-items-center rounded-full px-1 text-[11px] font-semibold tabular-nums\"\n              style={{ background: cart ? p.accent : p.ghost, color: cart ? p.accentText : p.muted }}\n            >\n              {cart}\n            </motion.span>\n          </a>\n        </div>\n\n        <div className=\"grid gap-8 md:grid-cols-[minmax(0,1.05fr)_minmax(0,1fr)] md:gap-12\">\n          {/* Gallery */}\n          <div>\n            <div className=\"relative aspect-square overflow-hidden rounded-2xl\" style={{ background: p.tile }}>\n              <AnimatePresence initial={false}>\n                <motion.img\n                  key={img}\n                  src={product.images[img]}\n                  alt={`${product.name}, photo ${img + 1}`}\n                  width={900}\n                  height={900}\n                  initial={reduce ? false : { opacity: 0, scale: 1.04 }}\n                  animate={{ opacity: 1, scale: 1 }}\n                  exit={{ opacity: 0 }}\n                  transition={{ duration: 0.4 }}\n                  className=\"absolute inset-0 h-full w-full object-cover\"\n                />\n              </AnimatePresence>\n              {product.was ? (\n                <span className=\"absolute top-3 left-3 rounded-full px-2.5 py-1 text-[12px] font-semibold\" style={{ background: p.accent, color: p.accentText }}>\n                  −{Math.round((1 - product.price / product.was) * 100)}%\n                </span>\n              ) : null}\n            </div>\n            <div className=\"mt-3 grid grid-cols-4 gap-2.5\">\n              {product.images.map((src, i) => (\n                <button\n                  key={src + i}\n                  type=\"button\"\n                  onClick={() => setImg(i)}\n                  aria-label={`Show photo ${i + 1}`}\n                  aria-current={img === i}\n                  className=\"aspect-square overflow-hidden rounded-xl border-2 transition-colors\"\n                  style={{ background: p.tile, borderColor: img === i ? p.title : \"transparent\" }}\n                >\n                  {/* eslint-disable-next-line @next/next/no-img-element -- plain img keeps the block framework-agnostic */}\n                  <img src={src} alt=\"\" width={200} height={200} className=\"h-full w-full object-cover\" />\n                </button>\n              ))}\n            </div>\n          </div>\n\n          {/* Buy box */}\n          <div className=\"min-w-0\">\n            <h2 className=\"text-[30px] font-semibold tracking-tight sm:text-[36px]\" style={{ color: p.title }}>\n              {product.name}\n            </h2>\n            <div className=\"mt-2 flex items-center gap-2 text-[13px]\">\n              <span className=\"flex gap-0.5\" aria-hidden=\"true\">\n                {[1, 2, 3, 4, 5].map((i) => (\n                  <svg key={i} width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill={i <= Math.round(product.rating) ? p.star : p.line}>\n                    <path d={STAR} />\n                  </svg>\n                ))}\n              </span>\n              <span style={{ color: p.title }}>{product.rating}</span>\n              <span style={{ color: p.muted }}>({product.reviews} reviews)</span>\n            </div>\n            <div className=\"mt-5 flex items-baseline gap-3\">\n              <span className=\"text-[26px] font-semibold tabular-nums\" style={{ color: p.title }}>\n                {money(unit, currency)}\n              </span>\n              {wasUnit ? (\n                <span className=\"text-[16px] tabular-nums line-through\" style={{ color: p.muted }}>\n                  {money(wasUnit, currency)}\n                </span>\n              ) : null}\n            </div>\n\n            <div ref={optionsRef} className=\"mt-7 space-y-6\">\n              <div>\n                <p id={`${uid}-size`} className=\"mb-2.5 text-[13px]\" style={{ color: p.muted }}>\n                  Case size <span style={{ color: p.title }}>{sizeOpt.label}</span>\n                </p>\n                <div role=\"radiogroup\" aria-labelledby={`${uid}-size`} className=\"flex flex-wrap gap-2\">\n                  {product.sizes.map((s) => (\n                    <button key={s.id} type=\"button\" role=\"radio\" aria-checked={size === s.id} onClick={() => pickSize(s.id)} className=\"rounded-full border px-4 py-2 text-[14px] font-medium transition-colors\" style={segBtn(size === s.id)}>\n                      {s.label}\n                      {s.extra ? (\n                        <span className=\"ml-1 opacity-60\">\n                          +{currency}\n                          {s.extra}\n                        </span>\n                      ) : null}\n                    </button>\n                  ))}\n                </div>\n              </div>\n              <div>\n                <p id={`${uid}-strap`} className=\"mb-2.5 text-[13px]\" style={{ color: p.muted }}>\n                  Strap <span style={{ color: p.title }}>{strapOpt.label}</span>\n                </p>\n                <div role=\"radiogroup\" aria-labelledby={`${uid}-strap`} className=\"flex flex-wrap gap-2.5\">\n                  {product.straps.map((s) => (\n                    <button\n                      key={s.id}\n                      type=\"button\"\n                      role=\"radio\"\n                      aria-checked={strap === s.id}\n                      aria-label={`${s.label}${s.extra ? `, plus ${currency}${s.extra}` : \"\"}`}\n                      onClick={() => pickStrap(s.id)}\n                      className=\"grid size-10 place-items-center rounded-full border-2 transition-colors\"\n                      style={{ borderColor: strap === s.id ? p.title : \"transparent\" }}\n                    >\n                      <span className=\"size-7 rounded-full\" style={{ background: s.swatch, boxShadow: `inset 0 0 0 1px ${p.line}` }} />\n                    </button>\n                  ))}\n                </div>\n              </div>\n            </div>\n\n            <div ref={ctaRef} className=\"mt-7 flex gap-3\">\n              <Qty value={qty} onChange={setQty} p={p} />\n              <AddButton state={state} onClick={add} p={p} label={`Add to cart · ${money(unit * qty, currency)}`} className=\"h-12 flex-1 px-6 text-[15px]\" />\n            </div>\n            <p className=\"mt-3 flex items-center gap-2 text-[13px]\">\n              <span className=\"size-2 rounded-full\" style={{ background: p.accent }} />\n              In stock · ships tomorrow · free returns for 60 days\n            </p>\n\n            <div className=\"mt-8 border-t\" style={{ borderColor: p.line }}>\n              {product.details.map((d, i) => {\n                const isOpen = open === i;\n                return (\n                  <div key={d.title} className=\"border-b\" style={{ borderColor: p.line }}>\n                    <button type=\"button\" onClick={() => setOpen(isOpen ? null : i)} aria-expanded={isOpen} aria-controls={`${uid}-d${i}`} className=\"flex w-full items-center justify-between py-4 text-left text-[15px] font-medium\" style={{ color: p.title }}>\n                      {d.title}\n                      <motion.svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2.4\" strokeLinecap=\"round\" animate={{ rotate: isOpen ? 45 : 0 }} aria-hidden=\"true\">\n                        <path d=\"M12 5v14M5 12h14\" />\n                      </motion.svg>\n                    </button>\n                    <AnimatePresence initial={false}>\n                      {isOpen ? (\n                        <motion.div id={`${uid}-d${i}`} initial={{ height: 0, opacity: 0 }} animate={{ height: \"auto\", opacity: 1 }} exit={{ height: 0, opacity: 0 }} transition={{ duration: reduce ? 0 : 0.25 }} className=\"overflow-hidden\">\n                          <p className=\"pb-4 text-[14px] leading-relaxed\">{d.body}</p>\n                        </motion.div>\n                      ) : null}\n                    </AnimatePresence>\n                  </div>\n                );\n              })}\n            </div>\n          </div>\n        </div>\n\n        {/* Story: gives the page scroll length, like a real product page */}\n        <div className=\"mt-14 grid gap-4 sm:grid-cols-3\">\n          {[\n            { k: \"7 mm\", v: \"Case thickness, slimmer than most dress watches.\" },\n            { k: \"50 m\", v: \"Water resistance, fine for rain and the sink.\" },\n            { k: \"3 yrs\", v: \"Battery life, plus a 2-year warranty.\" },\n          ].map((s) => (\n            <div key={s.k} className=\"rounded-2xl border p-5\" style={{ borderColor: p.line, background: p.card }}>\n              <p className=\"text-[28px] font-semibold tracking-tight\" style={{ color: p.title }}>\n                {s.k}\n              </p>\n              <p className=\"mt-1 text-[14px] leading-relaxed\">{s.v}</p>\n            </div>\n          ))}\n        </div>\n        <div className=\"mt-4 grid gap-4 sm:grid-cols-2\">\n          {product.images.slice(1, 3).map((src, i) => (\n            <div key={src} className=\"relative aspect-[4/3] overflow-hidden rounded-2xl\" style={{ background: p.tile }}>\n              {/* eslint-disable-next-line @next/next/no-img-element -- plain img keeps the block framework-agnostic */}\n              <img src={src} alt=\"\" width={900} height={900} className=\"h-full w-full object-cover\" style={{ objectPosition: i ? \"50% 30%\" : \"50% 55%\" }} />\n            </div>\n          ))}\n        </div>\n      </div>\n\n      {/* Zero-height sticky rail at the end of the section keeps the bar pinned to the bottom of the viewport. */}\n      <div className=\"pointer-events-none sticky bottom-0 z-20 h-0\">\n        <AnimatePresence>\n          {showBar ? (\n            <motion.div\n              key=\"bar\"\n              role=\"region\"\n              aria-label=\"Quick add to cart\"\n              initial={reduce ? { opacity: 0 } : { y: \"130%\" }}\n              animate={reduce ? { opacity: 1 } : { y: 0 }}\n              exit={reduce ? { opacity: 0 } : { y: \"130%\" }}\n              transition={{ type: \"spring\", stiffness: 380, damping: 36 }}\n              className=\"pointer-events-auto absolute inset-x-0 bottom-3 mx-auto w-[min(100%,960px)] sm:bottom-5\"\n            >\n              <div className=\"flex items-center gap-3 rounded-2xl border p-2 pl-2 backdrop-blur-xl sm:gap-4 sm:p-2.5\" style={{ background: p.bar, borderColor: p.line, boxShadow: p.shadow }}>\n                <button type=\"button\" onClick={toOptions} className=\"flex min-w-0 flex-1 items-center gap-3 text-left\" aria-label={`${product.name}, ${sizeOpt.label}, ${strapOpt.label}. Change options`}>\n                  <span className=\"size-11 shrink-0 overflow-hidden rounded-xl sm:size-12\" style={{ background: p.tile }}>\n                    {/* eslint-disable-next-line @next/next/no-img-element -- plain img keeps the block framework-agnostic */}\n                    <img src={product.images[0]} alt=\"\" width={96} height={96} className=\"h-full w-full object-cover\" />\n                  </span>\n                  <span className=\"min-w-0\">\n                    <span className=\"block truncate text-[14px] font-semibold\" style={{ color: p.title }}>\n                      {product.name}\n                    </span>\n                    <span className=\"block truncate text-[12px]\" style={{ color: p.muted }}>\n                      <span className=\"font-medium tabular-nums sm:hidden\" style={{ color: p.title }}>\n                        {money(unit * qty, currency)} ·{\" \"}\n                      </span>\n                      <AnimatePresence mode=\"popLayout\" initial={false}>\n                        <motion.span key={`${size}-${strap}`} initial={reduce ? false : { opacity: 0, y: 6 }} animate={{ opacity: 1, y: 0 }} exit={{ opacity: 0, y: -6 }} className=\"inline-block\">\n                          {sizeOpt.label}\n                          <span className=\"hidden sm:inline\"> · {strapOpt.label}</span>\n                        </motion.span>\n                      </AnimatePresence>\n                    </span>\n                  </span>\n                </button>\n\n                {/* Size switcher (wider screens) */}\n                <div className=\"relative hidden md:block\">\n                  <button\n                    type=\"button\"\n                    onClick={() => setSizeMenu((v) => !v)}\n                    aria-expanded={sizeMenu}\n                    aria-haspopup=\"listbox\"\n                    className=\"inline-flex h-10 items-center gap-2 rounded-full border px-4 text-[13px] font-medium\"\n                    style={{ borderColor: p.line, color: p.title }}\n                  >\n                    {sizeOpt.label}\n                    <motion.svg width=\"10\" height=\"10\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"3\" strokeLinecap=\"round\" strokeLinejoin=\"round\" animate={{ rotate: sizeMenu ? 180 : 0 }} aria-hidden=\"true\">\n                      <path d=\"m6 15 6-6 6 6\" />\n                    </motion.svg>\n                  </button>\n                  <AnimatePresence>\n                    {sizeMenu ? (\n                      <motion.ul\n                        role=\"listbox\"\n                        aria-label=\"Case size\"\n                        initial={reduce ? { opacity: 0 } : { opacity: 0, y: 6, scale: 0.97 }}\n                        animate={{ opacity: 1, y: 0, scale: 1 }}\n                        exit={{ opacity: 0, y: 6, scale: 0.97 }}\n                        transition={{ duration: 0.16 }}\n                        className=\"absolute bottom-full left-0 mb-2 min-w-[150px] origin-bottom rounded-xl border p-1\"\n                        style={{ background: p.card, borderColor: p.line, boxShadow: p.shadow }}\n                      >\n                        <LayoutGroup id={`${uid}-sizes`}>\n                          {product.sizes.map((s) => (\n                            <li key={s.id}>\n                              <button\n                                type=\"button\"\n                                role=\"option\"\n                                aria-selected={size === s.id}\n                                onClick={() => (pickSize(s.id), setSizeMenu(false))}\n                                className=\"relative flex w-full items-center justify-between gap-3 rounded-lg px-3 py-2 text-left text-[13px]\"\n                                style={{ color: p.title }}\n                              >\n                                {size === s.id ? <motion.span layoutId=\"size-hl\" className=\"absolute inset-0 rounded-lg\" style={{ background: p.ghost }} /> : null}\n                                <span className=\"relative\">{s.label}</span>\n                                <span className=\"relative tabular-nums\" style={{ color: p.muted }}>\n                                  {s.extra ? `+${currency}${s.extra}` : \"\"}\n                                </span>\n                              </button>\n                            </li>\n                          ))}\n                        </LayoutGroup>\n                      </motion.ul>\n                    ) : null}\n                  </AnimatePresence>\n                </div>\n                <div className=\"hidden lg:block\">\n                  <Qty value={qty} onChange={setQty} p={p} small />\n                </div>\n                <div className=\"hidden text-right sm:block\">\n                  <span className=\"block text-[15px] font-semibold tabular-nums\" style={{ color: p.title }}>\n                    {money(unit * qty, currency)}\n                  </span>\n                  {wasUnit ? (\n                    <span className=\"block text-[11px] tabular-nums line-through\" style={{ color: p.muted }}>\n                      {money(wasUnit * qty, currency)}\n                    </span>\n                  ) : null}\n                </div>\n                <AddButton state={state} onClick={add} p={p} label=\"Add to cart\" className=\"h-11 shrink-0 px-5 text-[14px] sm:h-12 sm:px-6\" />\n              </div>\n            </motion.div>\n          ) : null}\n        </AnimatePresence>\n      </div>\n    </section>\n  );\n}\n\nexport default StickyAddToCartBar;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}