{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"card-tabs-with-content-panels","type":"registry:component","title":"Card Tabs With Content Panels","description":"","dependencies":[],"files":[{"path":"components/we-inc/card-tabs-with-content-panels.tsx","type":"registry:component","content":"import { useRef, useState, type KeyboardEvent } from \"react\";\n\n// Product details split into card tabs. Each panel has a short text and a few facts.\nconst tabs = [\n  { id: \"details\", label: \"Details\", text: \"A wool blanket woven on a 1950s loom in the Borders, finished with a hand-twisted fringe.\", facts: [[\"Size\", \"140 × 200 cm\"], [\"Weight\", \"1.4 kg\"], [\"Pattern\", \"Herringbone\"]] },\n  { id: \"materials\", label: \"Materials\", text: \"Lambswool from two farms within 40 miles of the mill, spun and dyed on site.\", facts: [[\"Fibre\", \"100% lambswool\"], [\"Dye\", \"Low-impact, azo-free\"], [\"Origin\", \"Scotland\"]] },\n  { id: \"care\", label: \"Care\", text: \"Air it outside rather than washing it. Spot clean with cold water and a wool soap.\", facts: [[\"Wash\", \"Hand, 30°C max\"], [\"Dry\", \"Flat, in shade\"], [\"Moths\", \"Store with cedar\"]] },\n  { id: \"delivery\", label: \"Delivery\", text: \"Packed in a cotton bag and sent tracked. Free over $150, otherwise $9.\", facts: [[\"Dispatch\", \"1 to 2 days\"], [\"Returns\", \"30 days\"], [\"Carrier\", \"Tracked post\"]] },\n];\n\nexport default function CardTabsWithContentPanels() {\n  const [active, setActive] = useState(0);\n  const refs = useRef<(HTMLButtonElement | null)[]>([]);\n\n  const onKey = (e: KeyboardEvent<HTMLDivElement>) => {\n    const last = tabs.length - 1;\n    const next = { ArrowRight: active === last ? 0 : active + 1, ArrowLeft: active === 0 ? last : active - 1, Home: 0, End: last }[e.key];\n    if (next === undefined) return;\n    e.preventDefault();\n    setActive(next);\n    refs.current[next]?.focus();\n  };\n\n  return (\n    <div className=\"bg-[#efe9df] px-4 py-12 sm:px-8\">\n      <div className=\"mx-auto max-w-2xl\">\n        <div role=\"tablist\" aria-label=\"Product information\" onKeyDown={onKey} className=\"flex gap-1 overflow-x-auto px-2\">\n          {tabs.map((t, i) => (\n            <button\n              key={t.id}\n              ref={(el) => { refs.current[i] = el; }}\n              id={`ctp-tab-${t.id}`}\n              role=\"tab\"\n              type=\"button\"\n              aria-selected={i === active}\n              aria-controls={`ctp-panel-${t.id}`}\n              tabIndex={i === active ? 0 : -1}\n              onClick={() => setActive(i)}\n              className={`relative h-11 shrink-0 rounded-t-xl px-4 text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-teal-700 sm:px-5 ${i === active ? \"z-10 bg-white text-teal-900 shadow-[0_-1px_0_0_rgba(0,0,0,0.04)]\" : \"translate-y-1 bg-[#e3dbcd] text-stone-700 hover:bg-[#ddd3c2]\"}`}\n            >\n              {t.label}\n            </button>\n          ))}\n        </div>\n        {tabs.map((t, i) => (\n          <div key={t.id} id={`ctp-panel-${t.id}`} role=\"tabpanel\" aria-labelledby={`ctp-tab-${t.id}`} tabIndex={0} hidden={i !== active} className=\"relative rounded-2xl bg-white p-6 shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-teal-700 sm:p-8\">\n            <h3 className=\"font-serif text-2xl text-stone-900\">Ettrick herringbone blanket</h3>\n            <p className=\"mt-3 leading-7 text-stone-600\">{t.text}</p>\n            <dl className=\"mt-6 grid grid-cols-3 gap-3\">\n              {t.facts.map(([k, v]) => (\n                <div key={k} className=\"rounded-xl bg-teal-50 p-3\">\n                  <dt className=\"text-xs font-medium uppercase tracking-wider text-teal-800\">{k}</dt>\n                  <dd className=\"mt-1 text-sm font-semibold text-stone-900\">{v}</dd>\n                </div>\n              ))}\n            </dl>\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n}\n"}]}
