{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"tabs-with-count-badges","type":"registry:component","title":"Tabs With Count Badges","description":"","dependencies":[],"files":[{"path":"components/we-inc/tabs-with-count-badges.tsx","type":"registry:component","content":"import { useRef, useState, type KeyboardEvent } from \"react\";\n\n// Each tab is a filtered list; the badge shows how many items it holds.\nconst tabs = [\n  { id: \"open\", label: \"Open\", items: [\"Checkout button hidden on small Android screens\", \"Invoice PDF shows the wrong VAT number\", \"Search ignores accented letters\", \"Reset link expires too quickly\"] },\n  { id: \"review\", label: \"In review\", items: [\"Add Dutch translation to emails\", \"Cache product images for a week\"] },\n  { id: \"done\", label: \"Closed\", items: [\"Dark mode for the dashboard\", \"Export orders as CSV\", \"Fix date picker in Safari\"] },\n];\n\nexport default function TabsWithCountBadges() {\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-slate-50 px-4 py-12 sm:px-8\">\n      <div className=\"mx-auto max-w-2xl overflow-hidden rounded-xl border border-slate-200 bg-white\">\n        <div role=\"tablist\" aria-label=\"Issues\" onKeyDown={onKey} className=\"flex overflow-x-auto border-b border-slate-200 px-2\">\n          {tabs.map((t, i) => (\n            <button\n              key={t.id}\n              ref={(el) => { refs.current[i] = el; }}\n              id={`tcb-tab-${t.id}`}\n              role=\"tab\"\n              type=\"button\"\n              aria-selected={i === active}\n              aria-controls={`tcb-panel-${t.id}`}\n              tabIndex={i === active ? 0 : -1}\n              onClick={() => setActive(i)}\n              className={`-mb-px flex h-12 shrink-0 items-center gap-2 border-b-2 px-3 text-sm font-medium focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500 ${i === active ? \"border-indigo-600 text-indigo-700\" : \"border-transparent text-slate-600 hover:text-slate-900\"}`}\n            >\n              {t.label}\n              <span className={`min-w-[1.5rem] rounded-full px-1.5 py-0.5 text-center text-xs font-semibold tabular-nums ${i === active ? \"bg-indigo-600 text-white\" : \"bg-slate-100 text-slate-700\"}`}>\n                {t.items.length}\n                <span className=\"sr-only\"> items</span>\n              </span>\n            </button>\n          ))}\n        </div>\n        {tabs.map((t, i) => (\n          <div key={t.id} id={`tcb-panel-${t.id}`} role=\"tabpanel\" aria-labelledby={`tcb-tab-${t.id}`} tabIndex={0} hidden={i !== active} className=\"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-500\">\n            <ul className=\"divide-y divide-slate-100\">\n              {t.items.map((it, n) => (\n                <li key={it} className=\"flex items-center gap-3 px-5 py-3.5\">\n                  <span className={`h-2.5 w-2.5 shrink-0 rounded-full ${t.id === \"open\" ? \"bg-emerald-500\" : t.id === \"review\" ? \"bg-amber-500\" : \"bg-slate-400\"}`} aria-hidden=\"true\" />\n                  <span className=\"min-w-0 flex-1 truncate text-sm text-slate-800\">{it}</span>\n                  <span className=\"shrink-0 font-mono text-xs text-slate-600\">#{(412 - n * 7 - i * 31).toString()}</span>\n                </li>\n              ))}\n            </ul>\n          </div>\n        ))}\n      </div>\n    </div>\n  );\n}\n"}]}
