{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "A dish as a card: picture, category, portion/weight, price and an order button. No rating.",
  "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 dish as a card: picture, optional badge, category, name, portion/weight, summary, price and an order button.\n  No rating. Axes: layout (vertical, horizontal), media (image, none), density, action (button, none). Records\n  map from Codex kind `dish`.\n-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import type { DishLabels } from \"./dish-card.types\";\n  import type { Dish } from \"./dish-showcase.types\";\n\n  export type DishCardProps = {\n    dish: Dish;\n    labels: DishLabels;\n    layout?: \"vertical\" | \"horizontal\";\n    media?: \"image\" | \"none\";\n    prices?: \"show\" | \"hide\";\n    action?: \"button\" | \"none\";\n    density?: \"default\" | \"compact\";\n    onadd?: (id: string) => void;\n  };\n</script>\n\n<script lang=\"ts\">\n  import Badge from \"../compose/Badge.svelte\";\n  import Block from \"../compose/Block.svelte\";\n  import Box from \"../compose/Box.svelte\";\n  import Button from \"../compose/Button.svelte\";\n  import CardContent from \"../compose/CardContent.svelte\";\n  import Group from \"../compose/Group.svelte\";\n  import Link from \"../compose/Link.svelte\";\n  import Text from \"../compose/Text.svelte\";\n  import Title from \"../compose/Title.svelte\";\n  import MediaFrame from \"../components/media-frame.svelte\";\n  import { cn, fmtMoney, urlOf } from \"../utils\";\n\n  let {\n    dish,\n    labels,\n    layout = \"vertical\",\n    media = \"image\",\n    prices = \"show\",\n    action = \"button\",\n    density = \"default\",\n    onadd,\n  }: DishCardProps = $props();\n</script>\n\n<Block\n  tag=\"article\"\n  class={cn(\n    \"flex flex-col gap-8 bg-card p-6 text-card-foreground inset-ring inset-ring-border rounded\",\n    \"h-full gap-4 overflow-hidden\",\n    (((layout as string) === \"horizontal\") ? \"flex flex-col sm:flex-row\" : \"flex flex-col\")\n  )}\n  data-slot=\"card\"\n  data-layout={layout}\n>\n  {#if ((media as string) === \"image\")}\n    <Box class={cn(\"relative shrink-0\", (((layout as string) === \"horizontal\") ? \"sm:w-48\" : \"\"))}>\n      <MediaFrame alt={dish.name} src={dish.image} ratio=\"4/3\" class=\"h-full\" />\n      {#if dish.badge}\n        <Badge variant=\"default\" size=\"default\" class=\"absolute left-4 top-4\">\n          {dish.badge}\n        </Badge>\n      {/if}\n    </Box>\n  {/if}\n  <CardContent class=\"flex flex-1 flex-col gap-2\">\n    <Group gap=\"2\" align=\"center\" class=\"flex-wrap\">\n      <Text size=\"xs\" class=\"uppercase tracking-wide text-muted-foreground\" data-slot=\"category\">\n        {dish.tag}\n      </Text>\n      {#if ((media as string) === \"none\")}\n        {#if dish.badge}\n          <Badge variant=\"secondary\" size=\"sm\">\n            {dish.badge}\n          </Badge>\n        {/if}\n      {/if}\n    </Group>\n    <Title as={3} size=\"base\" weight=\"bold\">\n      {#if dish.href}\n        <Link href={urlOf(dish.href)} variant=\"default\" data-slot=\"open\">\n          {dish.name}\n        </Link>\n      {:else}\n        {dish.name}\n      {/if}\n    </Title>\n    {#if dish.weight}\n      <Text size=\"xs\" class=\"text-muted-foreground\" data-slot=\"portion\">\n        {dish.weight}\n      </Text>\n    {/if}\n    {#if ((density as string) === \"default\")}\n      <Text size=\"sm\" class=\"text-muted-foreground\">\n        {dish.summary}\n      </Text>\n    {/if}\n    <Group gap=\"4\" justify=\"between\" class=\"mt-auto pt-2\">\n      {#if ((prices as string) === \"show\")}\n        <Text size=\"xl\" weight=\"bold\" data-slot=\"price\">\n          {fmtMoney(dish.price, dish.currency)}\n        </Text>\n      {/if}\n      {#if ((action as string) === \"button\")}\n        <Button variant=\"default\" size=\"sm\" type=\"button\" onclick={() => onadd?.(dish.id)}>\n          {labels.add}\n        </Button>\n      {/if}\n    </Group>\n  </CardContent>\n</Block>\n",
      "path": "blocks/dish-card.svelte",
      "target": "blocks/dish-card.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 DishLabels = {\n  add: string;\n};\n",
      "path": "blocks/dish-card.types.ts",
      "target": "blocks/dish-card.types.ts"
    }
  ],
  "meta": {
    "category": "commerce",
    "group": "restaurant",
    "kind": "block",
    "tags": [
      "svelte",
      "block"
    ]
  },
  "name": "dish-card",
  "registryDependencies": [
    "badge",
    "block",
    "box",
    "button",
    "card-content",
    "dish-showcase",
    "group",
    "link",
    "media-frame",
    "text",
    "title",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Dish Card",
  "type": "registry:block"
}
