{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Option Chips component",
  "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-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import type { DishOption } from \"./option-chips.types\";\n\n  export type OptionChipsProps = {\n    name: string;\n    legend: string;\n    options: DishOption[];\n    extra?: \"none\" | \"price\" | \"note\";\n    layout?: \"wrap\" | \"column\";\n  };\n</script>\n\n<script lang=\"ts\">\n  import Box from \"../compose/Box.svelte\";\n  import Fieldset from \"../compose/Fieldset.svelte\";\n  import Inline from \"../compose/Inline.svelte\";\n  import Label from \"../compose/Label.svelte\";\n  import Legend from \"../compose/Legend.svelte\";\n  import Radio from \"../compose/Radio.svelte\";\n  import { cn, fmtMoney, tpl } from \"../utils\";\n\n  let { name, legend, options, extra = \"none\", layout = \"wrap\" }: OptionChipsProps = $props();\n</script>\n\n<Fieldset\n  class=\"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\" class=\"mb-2\" id={tpl(\"{0}-legend\", name)}>\n    {legend}\n  </Legend>\n  <Box class={(((layout as string) === \"column\") ? \"flex flex-col gap-2\" : \"flex flex-wrap gap-2\")}>\n    {#each options as o, i (o.id)}\n      <Label\n        class={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 class=\"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        {#if ((extra as string) === \"price\")}\n          <Inline class=\"text-muted-foreground\">\n            {fmtMoney(o.price, o.currency)}\n          </Inline>\n        {/if}\n        {#if ((extra as string) === \"note\")}\n          <Inline class=\"text-muted-foreground\">\n            {o.note}\n          </Inline>\n        {/if}\n      </Label>\n    {/each}\n  </Box>\n</Fieldset>\n",
      "path": "components/option-chips.svelte",
      "target": "components/option-chips.svelte"
    },
    {
      "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": [
      "svelte",
      "component"
    ]
  },
  "name": "option-chips",
  "registryDependencies": [
    "box",
    "fieldset",
    "inline",
    "label",
    "legend",
    "radio",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Option Chips",
  "type": "registry:component"
}
