{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle-group-reps",
  "title": "Toggle group: orders by rep",
  "description": "An example of Toggle group: orders by rep.",
  "dependencies": [],
  "registryDependencies": [
    "@keyline-ui/keyline",
    "@keyline-ui/toggle-group"
  ],
  "files": [
    {
      "path": "src/registry/keyline/examples/toggle-group-reps.tsx",
      "content": "\"use client\";\n\nimport { useState } from \"react\";\nimport { ToggleGroup, ToggleGroupItem } from \"../ui/toggle-group\";\n\nconst ORDERS = [\n  { id: \"DM-4102\", client: \"Scranton Business Park\", rep: \"Dwight\" },\n  { id: \"DM-4087\", client: \"Lackawanna County\", rep: \"Jim\" },\n  { id: \"DM-4120\", client: \"Wilkes-Barre Library\", rep: \"Phyllis\" },\n  { id: \"DM-4131\", client: \"Blue Cross of Pennsylvania\", rep: \"Stanley\" },\n  { id: \"DM-4133\", client: \"Pennsylvania Power & Light\", rep: \"Dwight\" },\n  { id: \"DM-4136\", client: \"Harper Collins, Scranton\", rep: \"Andy\" },\n  { id: \"DM-4140\", client: \"Vance Refrigeration\", rep: \"Phyllis\" },\n];\nconst REPS = [\"Dwight\", \"Jim\", \"Phyllis\", \"Stanley\", \"Andy\"];\n\nexport function OrdersByRep() {\n  const [reps, setReps] = useState<string[]>([\"Dwight\", \"Phyllis\"]);\n  // no rep chosen means no filter: every order shows\n  const rows = reps.length ? ORDERS.filter((o) => reps.includes(o.rep)) : ORDERS;\n\n  return (\n    <div className=\"grid min-w-0 grid-cols-[minmax(0,1fr)] gap-4\">\n      <ToggleGroup aria-label=\"Sales rep\" value={reps} onValueChange={setReps} className=\"justify-self-start\">\n        {REPS.map((r) => (\n          <ToggleGroupItem key={r} value={r} count={ORDERS.filter((o) => o.rep === r).length}>\n            {r}\n          </ToggleGroupItem>\n        ))}\n      </ToggleGroup>\n      <ul className=\"m-0 grid list-none gap-1 p-0 text-[14px]\" aria-label=\"Open orders\">\n        {rows.map((o) => (\n          <li key={o.id} className=\"truncate\">\n            <span className=\"font-kl-mono whitespace-nowrap\">{o.id}</span> · {o.client}\n          </li>\n        ))}\n      </ul>\n      <p role=\"status\" className=\"m-0 text-[14px] text-kl-ink-2\">\n        {reps.length ? `${rows.length} open orders for ${reps.join(\", \")}.` : `All ${ORDERS.length} open orders.`}\n      </p>\n    </div>\n  );\n}\n",
      "type": "registry:component",
      "target": "components/keyline/examples/toggle-group-reps.tsx"
    }
  ],
  "categories": [
    "toggle-group"
  ],
  "type": "registry:block"
}