{
  "$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-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import type { Dish, FoodLabels } from \"./dish-showcase.types\";\n\n  export 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</script>\n\n<script lang=\"ts\">\n  import Box from \"../compose/Box.svelte\";\n  import Button from \"../compose/Button.svelte\";\n  import Group from \"../compose/Group.svelte\";\n  import Inline from \"../compose/Inline.svelte\";\n  import Label from \"../compose/Label.svelte\";\n  import LucideIcon from \"../icons/LucideIcon.svelte\";\n  import Meter from \"../compose/Meter.svelte\";\n  import Stack from \"../compose/Stack.svelte\";\n  import Text from \"../compose/Text.svelte\";\n  import EmptyState from \"../components/empty-state.svelte\";\n  import MediaFrame from \"../components/media-frame.svelte\";\n  import NumberField from \"../components/number-field.svelte\";\n  import SectionFrame from \"../components/section-frame.svelte\";\n  import { fmtMoney, tpl } from \"../utils\";\n\n  let {\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 = $props();\n</script>\n\n<SectionFrame id={id} title={title} lead={lead} tone={tone} landmarkLabel={landmarkLabel}>\n  {#if ((dishes?.length ?? 0) === 0)}\n    <EmptyState icon=\"package\" title={empty} />\n  {:else}\n    <Box class=\"grid grid-cols-1 items-start gap-8 lg:grid-cols-3\">\n      <Box\n        class={\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        {#each dishes as d (d.id)}\n          <Stack gap=\"2\" class=\"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\" class=\"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        {/each}\n      </Box>\n      <Stack\n        gap=\"4\"\n        class={\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 for={tpl(\"{0}-fill\", id)} class=\"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\" class=\"text-muted-foreground\">\n            {labels.total}\n          </Text>\n          <Inline class=\"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\" class=\"w-full\">\n          <LucideIcon name=\"shopping-bag\" size={16} />\n          {labels.order}\n        </Button>\n      </Stack>\n    </Box>\n  {/if}\n</SectionFrame>\n",
      "path": "blocks/veggie-box.svelte",
      "target": "blocks/veggie-box.svelte"
    }
  ],
  "meta": {
    "category": "commerce",
    "group": "food",
    "kind": "block",
    "tags": [
      "svelte",
      "block"
    ]
  },
  "name": "veggie-box",
  "registryDependencies": [
    "box",
    "button",
    "dish-showcase",
    "empty-state",
    "group",
    "inline",
    "label",
    "lucide-icon",
    "media-frame",
    "meter",
    "number-field",
    "section-frame",
    "stack",
    "text",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Veggie Box",
  "type": "registry:block"
}
