{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per option (the first checked), the name and an optional price or note. Static markup.",
  "devDependencies": [],
  "digest": "0.1.0",
  "files": [
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * One choice as a radio group drawn as chips: a fieldset with role radiogroup named by its legend, one radio per\n * option (the first checked), the name and an optional price or note. Static markup.\n */\nimport { type ReactNode } from \"react\";\nimport { Box, Fieldset, Inline, Label, Legend, Radio } from \"../compose\";\nimport { cn, fmtMoney, tpl } from \"../utils\";\nimport type { DishOption } from \"./option-chips.types\";\n\nexport type OptionChipsProps = {\n  name: string;\n  legend: string;\n  options: DishOption[];\n  extra?: \"none\" | \"price\" | \"note\";\n  layout?: \"wrap\" | \"column\";\n};\n\nexport function OptionChips({ name, legend, options, extra = \"none\", layout = \"wrap\" }: OptionChipsProps) {\n  return (\n    <Fieldset\n      className=\"flex flex-col gap-2\"\n      role=\"radiogroup\"\n      aria-labelledby={tpl(\"{0}-legend\", name)}\n      data-slot=\"option-group\"\n    >\n      <Legend size=\"sm\" className=\"mb-2\" id={tpl(\"{0}-legend\", name)}>\n        {legend}\n      </Legend>\n      <Box className={(((layout as string) === \"column\") ? \"flex flex-col gap-2\" : \"flex flex-wrap gap-2\")}>\n        {(options ?? []).map((o, i) => (\n          <Label key={o.id}\n            className={cn(\n              \"flex items-center gap-2 rounded px-4 py-2 text-sm inset-ring inset-ring-border has-checked:bg-muted \" +\n                \"has-checked:inset-ring-foreground\",\n              (((layout as string) === \"column\") ? \"justify-between\" : \"\")\n            )}\n            data-slot=\"option\"\n          >\n            <Inline className=\"flex items-center gap-2\">\n              <Radio name={name} value={o.id} checked={(i === 0)} />\n              <Inline>\n                {o.name}\n              </Inline>\n            </Inline>\n            {((extra as string) === \"price\") ? (\n              <Inline className=\"text-muted-foreground\">\n                {fmtMoney(o.price, o.currency)}\n              </Inline>\n            ) : null}\n            {((extra as string) === \"note\") ? (\n              <Inline className=\"text-muted-foreground\">\n                {o.note}\n              </Inline>\n            ) : null}\n          </Label>\n        ))}\n      </Box>\n    </Fieldset>\n  );\n}\n",
      "path": "components/option-chips.tsx",
      "target": "components/option-chips.tsx"
    },
    {
      "content": "// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n\nexport type DishOption = {\n  id: string;\n  name: string;\n  price: number;\n  currency: string;\n  note: string;\n  image?: string;\n};\n",
      "path": "components/option-chips.types.ts",
      "target": "components/option-chips.types.ts"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "react",
      "component"
    ]
  },
  "name": "option-chips",
  "registryDependencies": [
    "compose",
    "utils"
  ],
  "runtime": "react",
  "title": "Option Chips",
  "type": "registry:component"
}
