{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "trust-badges-block",
  "title": "Trust Badges Block",
  "description": "A store reassurance strip: shipping, returns, warranty and secure checkout badges with icons that draw themselves, each opening the three facts behind the promise, plus an overall rating with partially filled stars and the accepted payment types shown as neutral icons.",
  "dependencies": [
    "motion",
    "clsx",
    "tailwind-merge"
  ],
  "files": [
    {
      "path": "registry/new-york/trust-badges-block/trust-badges-block.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { AnimatePresence, 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 TrustBadge {\n  id: string;\n  icon: \"truck\" | \"return\" | \"shield\" | \"lock\" | \"leaf\" | \"chat\";\n  title: string;\n  text: string;\n  details: string[];\n}\n\nexport interface TrustBadgesBlockProps {\n  badges?: TrustBadge[];\n  rating?: number;\n  reviewCount?: number;\n  payments?: string[];\n  theme?: \"dark\" | \"light\";\n  className?: string;\n}\n\nconst PALETTES = {\n  dark: { bg: \"#0A0A0A\", title: \"#FFFFFF\", muted: \"rgba(255,255,255,0.45)\", body: \"rgba(255,255,255,0.62)\", line: \"rgba(255,255,255,0.12)\", card: \"#161616\", cardOn: \"#1E1E1E\", accent: \"#7CDE6A\", ring: \"rgba(255,255,255,0.5)\" },\n  light: { bg: \"#FFFFFF\", title: \"#111111\", muted: \"rgba(0,0,0,0.45)\", body: \"rgba(0,0,0,0.62)\", line: \"rgba(0,0,0,0.1)\", card: \"#F5F5F4\", cardOn: \"#ECECEA\", accent: \"#2F9E44\", ring: \"rgba(0,0,0,0.45)\" },\n};\nconst BADGES: TrustBadge[] = [\n  { id: \"ship\", icon: \"truck\", title: \"Free shipping\", text: \"On orders over $50\", details: [\"Orders before 2 pm ship the same day\", \"Delivery in 2–4 business days\", \"Tracking link by email and SMS\"] },\n  { id: \"returns\", icon: \"return\", title: \"30-day returns\", text: \"Free, no questions\", details: [\"Print a label from your order page\", \"Drop it at any parcel point\", \"Refunded within 3 days of arrival\"] },\n  { id: \"warranty\", icon: \"shield\", title: \"2-year warranty\", text: \"Repair or replace\", details: [\"Covers defects in materials and build\", \"Free repair or a replacement\", \"Extend to 4 years at checkout\"] },\n  { id: \"secure\", icon: \"lock\", title: \"Secure checkout\", text: \"Encrypted payments\", details: [\"Card details never touch our servers\", \"3-D Secure for card payments\", \"Pay later in 3 interest-free parts\"] },\n];\nconst ICONS: Record<TrustBadge[\"icon\"], string[]> = {\n  truck: [\"M3 7h11v9H3z\", \"M14 10h4l3 3v3h-7\", \"M7 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4z\", \"M17 19a2 2 0 1 0 0-4 2 2 0 0 0 0 4z\"],\n  return: [\"M4 9h11a5 5 0 0 1 0 10H9\", \"M8 5 4 9l4 4\"],\n  shield: [\"M12 3 5 6v6c0 4.4 3 7.6 7 9 4-1.4 7-4.6 7-9V6z\", \"m9 12 2 2 4-4\"],\n  lock: [\"M6 11h12v9H6z\", \"M8 11V8a4 4 0 0 1 8 0v3\", \"M12 15v2\"],\n  leaf: [\"M5 19c8 0 14-6 14-14-8 0-14 6-14 14z\", \"M5 19 13 11\"],\n  chat: [\"M4 5h16v11H9l-5 4z\", \"M8 10h8\"],\n};\nconst PAYMENTS = [\"Card\", \"Bank\", \"Wallet\", \"Pay later\"];\n\nfunction Icon({ name, color, reduce }: { name: TrustBadge[\"icon\"]; color: string; reduce: boolean }) {\n  return (\n    <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n      {ICONS[name].map((d, i) => (\n        <motion.path key={i} d={d} initial={reduce ? false : { pathLength: 0 }} animate={{ pathLength: 1 }} transition={{ duration: reduce ? 0 : 0.8, delay: reduce ? 0 : 0.15 * i }} />\n      ))}\n    </svg>\n  );\n}\n\nfunction PayIcon({ kind, p }: { kind: string; p: (typeof PALETTES)[\"dark\"] }) {\n  const paths: Record<string, string> = {\n    Card: \"M3 7h18v10H3zM3 10h18M6 14h4\",\n    Bank: \"M3 9 12 4l9 5M5 9v8M9.5 9v8M14.5 9v8M19 9v8M3 19h18\",\n    Wallet: \"M4 7h14a2 2 0 0 1 2 2v8H4zM4 7V5h12v2M16 12h2\",\n    \"Pay later\": \"M12 4a8 8 0 1 0 0 16 8 8 0 0 0 0-16zM12 8v4l3 2\",\n  };\n  return (\n    <span className=\"flex h-8 items-center gap-1.5 rounded-lg border px-2.5 text-[11.5px]\" style={{ borderColor: p.line, color: p.body }}>\n      <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"1.7\" strokeLinecap=\"round\" strokeLinejoin=\"round\" aria-hidden=\"true\">\n        <path d={paths[kind] ?? paths.Card} />\n      </svg>\n      {kind}\n    </span>\n  );\n}\n\nexport function TrustBadgesBlock({ badges = BADGES, rating = 4.8, reviewCount = 12480, payments = PAYMENTS, theme = \"dark\", className }: TrustBadgesBlockProps) {\n  const p = PALETTES[theme];\n  const reduce = !!useReducedMotion();\n  const uid = React.useId();\n  const [open, setOpen] = React.useState<string | null>(null);\n  const current = badges.find((b) => b.id === open);\n  const ring = { [\"--tw-ring-color\" as string]: p.ring, [\"--tw-ring-offset-color\" as string]: p.bg } as React.CSSProperties;\n  const details = (b: TrustBadge, id: string) => (\n    <motion.div key={b.id} id={id} role=\"region\" aria-label={`${b.title} details`} initial={reduce ? false : { opacity: 0, height: 0 }} animate={{ opacity: 1, height: \"auto\" }} exit={reduce ? undefined : { opacity: 0, height: 0 }} transition={{ duration: 0.28, ease: [0.22, 1, 0.36, 1] }} className=\"overflow-hidden\">\n      <ol className=\"m-0 mt-2.5 grid list-none grid-cols-1 gap-2.5 rounded-2xl border p-4 @[640px]:grid-cols-3 @[640px]:p-5\" style={{ borderColor: p.line, background: p.card }}>\n        {b.details.map((d, i) => (\n          <motion.li key={d} initial={reduce ? false : { opacity: 0, x: -8 }} animate={{ opacity: 1, x: 0 }} transition={{ delay: reduce ? 0 : 0.08 + i * 0.07 }} className=\"flex items-start gap-3 text-[13.5px]\" style={{ color: p.body }}>\n            <span className=\"grid h-6 w-6 shrink-0 place-items-center rounded-full text-[11px] font-semibold\" style={{ background: p.accent, color: \"#0A0A0A\" }}>\n              {i + 1}\n            </span>\n            <span className=\"pt-0.5\">{d}</span>\n          </motion.li>\n        ))}\n      </ol>\n    </motion.div>\n  );\n\n  return (\n    <section className={cn(\"@container w-full\", className)} style={{ background: p.bg, color: p.title }} aria-label=\"Why shop with us\">\n      <div className=\"mx-auto max-w-6xl px-4 py-12 @[640px]:px-8\">\n        <ul className=\"m-0 grid list-none grid-cols-1 gap-2.5 p-0 @[480px]:grid-cols-2 @[900px]:grid-cols-4\">\n          {badges.map((b, i) => {\n            const on = open === b.id;\n            return (\n              <motion.li key={b.id} initial={reduce ? false : { opacity: 0, y: 12 }} animate={{ opacity: 1, y: 0 }} transition={{ duration: 0.45, delay: reduce ? 0 : i * 0.07, ease: [0.22, 1, 0.36, 1] }}>\n                <button\n                  type=\"button\"\n                  onClick={() => setOpen(on ? null : b.id)}\n                  aria-expanded={on}\n                  aria-controls={`${uid}-details ${uid}-${b.id}-inline`}\n                  className=\"group flex h-full w-full cursor-pointer items-center gap-4 rounded-2xl border p-4 text-left outline-none focus-visible:ring-2 focus-visible:ring-offset-2 @[640px]:p-5\"\n                  style={{ borderColor: on ? p.title : p.line, background: on ? p.cardOn : p.card, color: p.title, transition: \"background-color .2s, border-color .2s\", ...ring }}\n                >\n                  <motion.span className=\"grid h-12 w-12 shrink-0 place-items-center rounded-xl\" style={{ background: on ? p.title : \"transparent\", border: `1px solid ${on ? p.title : p.line}` }} animate={{ rotate: on && !reduce ? -6 : 0 }}>\n                    <Icon name={b.icon} color={on ? p.bg : p.title} reduce={reduce} />\n                  </motion.span>\n                  <span className=\"min-w-0 flex-1\">\n                    <span className=\"block text-[15px] font-semibold\">{b.title}</span>\n                    <span className=\"block text-[13px]\" style={{ color: p.muted }}>\n                      {b.text}\n                    </span>\n                  </span>\n                  <motion.svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke={p.muted} strokeWidth=\"2\" strokeLinecap=\"round\" animate={{ rotate: on ? 45 : 0 }} transition={{ duration: reduce ? 0 : 0.2 }} aria-hidden=\"true\">\n                    <path d=\"M12 5v14M5 12h14\" />\n                  </motion.svg>\n                </button>\n                <div className=\"@[480px]:hidden\">\n                  <AnimatePresence initial={false}>{on && details(b, `${uid}-${b.id}-inline`)}</AnimatePresence>\n                </div>\n              </motion.li>\n            );\n          })}\n        </ul>\n\n        <div className=\"hidden @[480px]:block\">\n          <AnimatePresence initial={false}>{current && details(current, `${uid}-details`)}</AnimatePresence>\n        </div>\n\n        <div className=\"mt-6 flex flex-col gap-4 border-t pt-6 @[760px]:flex-row @[760px]:items-center @[760px]:justify-between\" style={{ borderColor: p.line }}>\n          <div className=\"flex items-center gap-3\">\n            <span className=\"text-[28px] font-semibold tracking-[-0.02em] tabular-nums\">{rating.toFixed(1)}</span>\n            <span>\n              <span className=\"flex gap-0.5\" role=\"img\" aria-label={`${rating} out of 5 stars`}>\n                {[1, 2, 3, 4, 5].map((i) => {\n                  const fill = Math.max(0, Math.min(1, rating - (i - 1)));\n                  return (\n                    <span key={i} className=\"relative h-4 w-4\">\n                      <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" className=\"absolute inset-0\" fill=\"none\" stroke={p.title} strokeWidth=\"1.5\" aria-hidden=\"true\">\n                        <path d=\"m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.5 2.9 1-6.1L3.2 9.5l6.1-.9z\" />\n                      </svg>\n                      <motion.span className=\"absolute inset-y-0 left-0 overflow-hidden\" initial={reduce ? false : { width: 0 }} animate={{ width: `${fill * 100}%` }} transition={{ duration: 0.4, delay: reduce ? 0 : 0.4 + i * 0.08 }}>\n                        <svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill={p.title} aria-hidden=\"true\">\n                          <path d=\"m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.5 2.9 1-6.1L3.2 9.5l6.1-.9z\" />\n                        </svg>\n                      </motion.span>\n                    </span>\n                  );\n                })}\n              </span>\n              <span className=\"mt-0.5 block text-[12.5px]\" style={{ color: p.muted }}>\n                From {reviewCount.toLocaleString(\"en-US\")} verified reviews\n              </span>\n            </span>\n          </div>\n          <div className=\"flex flex-wrap items-center gap-2\">\n            <span className=\"mr-1 flex items-center gap-1.5 text-[12px]\" style={{ color: p.muted }}>\n              <svg width=\"13\" height=\"13\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" aria-hidden=\"true\">\n                <path d=\"M6 11h12v9H6zM8 11V8a4 4 0 0 1 8 0v3\" />\n              </svg>\n              We accept\n            </span>\n            {payments.map((k) => (\n              <PayIcon key={k} kind={k} p={p} />\n            ))}\n          </div>\n        </div>\n      </div>\n    </section>\n  );\n}\n\nexport default TrustBadgesBlock;\n",
      "type": "registry:component"
    }
  ],
  "type": "registry:component"
}