{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Fill a box by weight: produce tiles beside the box with a meter.",
  "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 * A vegetable box by weight: produce tiles (picture, name, price per kg, a weight field in kg named after the\n * item) beside the box card with a meter of how full the box is, the total and the order button. Axes: layout\n * (split, stacked), tone.\n */\nimport { type ReactNode } from \"react\";\nimport { Box, Button, Group, Inline, Label, Meter, Stack, Text } from \"../compose\";\nimport { LucideIcon } from \"../icons/LucideIcon\";\nimport { EmptyState } from \"../components/empty-state\";\nimport { MediaFrame } from \"../components/media-frame\";\nimport { NumberField } from \"../components/number-field\";\nimport { SectionFrame } from \"../components/section-frame\";\nimport { fmtMoney, tpl } from \"../utils\";\nimport type { Dish, FoodLabels } from \"./dish-showcase.types\";\n\nexport type VeggieBoxProps = {\n  id: string;\n  title: string;\n  lead?: string;\n  dishes: Dish[];\n  empty?: string;\n  labels: FoodLabels;\n  fill?: number;\n  total: number;\n  currency: string;\n  layout?: \"split\" | \"stacked\";\n  tone?: \"default\" | \"muted\";\n  landmarkLabel?: string;\n};\n\nexport function VeggieBox({\n  id,\n  title,\n  lead = \"\",\n  dishes,\n  empty = \"\",\n  labels,\n  fill = 60,\n  total,\n  currency,\n  layout = \"split\",\n  tone = \"default\",\n  landmarkLabel,\n}: VeggieBoxProps) {\n  return (\n    <SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>\n      {((dishes?.length ?? 0) === 0) ? (\n        <EmptyState icon=\"package\" title={empty} />\n      ) : (\n        <Box className=\"grid grid-cols-1 items-start gap-8 lg:grid-cols-3\">\n          <Box\n            className={\n              (layout as string) === \"split\" ? \"grid grid-cols-2 gap-4 md:grid-cols-3 lg:col-span-2\"\n              : \"grid grid-cols-2 gap-4 md:grid-cols-3 lg:col-span-3 lg:grid-cols-6\"\n            }\n            data-slot=\"items\"\n          >\n            {(dishes ?? []).map((d) => (\n              <Stack key={d.id} gap=\"2\" className=\"rounded bg-card inset-ring inset-ring-border p-4\" data-slot=\"item\">\n                <MediaFrame alt={d.name} src={d.image} ratio=\"1/1\" />\n                <Text size=\"sm\" weight=\"semibold\">\n                  {d.name}\n                </Text>\n                <Text size=\"xs\" className=\"text-muted-foreground\">\n                  {tpl(labels.perKg, fmtMoney(d.price, d.currency))}\n                </Text>\n                <NumberField\n                  value=\"1\"\n                  name={tpl(\"{0}-kg-{1}\", id, d.id)}\n                  min=\"0\"\n                  label={tpl(labels.weightOf, d.name)}\n                  decrease={tpl(labels.decreaseOf, d.name)}\n                  increase={tpl(labels.increaseOf, d.name)}\n                />\n              </Stack>\n            ))}\n          </Box>\n          <Stack\n            gap=\"4\"\n            className={\n              (layout as string) === \"split\" ? \"rounded bg-card inset-ring inset-ring-border p-6 lg:sticky lg:top-8\"\n              : \"rounded bg-card inset-ring inset-ring-border p-6 lg:col-span-3\"\n            }\n            data-slot=\"summary\"\n          >\n            <Text size=\"lg\" weight=\"semibold\">\n              {labels.summary}\n            </Text>\n            <Label htmlFor={tpl(\"{0}-fill\", id)} className=\"text-sm text-muted-foreground\">\n              {labels.boxFill}\n            </Label>\n            <Meter value={fill} min={0} max={100} id={tpl(\"{0}-fill\", id)} />\n            <Group gap=\"2\" align=\"baseline\" justify=\"between\">\n              <Text size=\"sm\" className=\"text-muted-foreground\">\n                {labels.total}\n              </Text>\n              <Inline className=\"text-2xl font-bold\" role=\"status\" aria-live=\"polite\" data-slot=\"total\">\n                {fmtMoney(total, currency)}\n              </Inline>\n            </Group>\n            <Button variant=\"default\" size=\"lg\" type=\"button\" className=\"w-full\">\n              <LucideIcon name=\"shopping-bag\" size={16} />\n              {labels.order}\n            </Button>\n          </Stack>\n        </Box>\n      )}\n    </SectionFrame>\n  );\n}\n",
      "path": "blocks/veggie-box.tsx",
      "target": "blocks/veggie-box.tsx"
    }
  ],
  "meta": {
    "category": "commerce",
    "group": "food",
    "kind": "block",
    "tags": [
      "react",
      "block"
    ]
  },
  "name": "veggie-box",
  "registryDependencies": [
    "compose",
    "dish-showcase",
    "empty-state",
    "lucide-icon",
    "media-frame",
    "number-field",
    "section-frame",
    "utils"
  ],
  "runtime": "react",
  "title": "Veggie Box",
  "type": "registry:block"
}
