{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Products as cards in a grid, a list or a rail that scrolls sideways.",
  "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 section with a heading and the products as cards in a grid, as a list of horizontal cards, or as a rail that\n  scrolls sideways; an empty state when there are none. Axes: layout (grid, list, rail), columns, ratio, rating,\n  action, tone, density.\n-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import type { Product, ProductLabels } from \"./product-card.types\";\n\n  export type ProductGridProps = {\n    id: string;\n    title: string;\n    products: Product[];\n    labels: ProductLabels;\n    badges: Record<string, string>;\n    layout?: \"grid\" | \"list\" | \"rail\";\n    cols?: \"1-2\" | \"1-3\" | \"1-4\";\n    ratio?: \"4/3\" | \"1/1\" | \"3/4\";\n    rating?: \"show\" | \"hide\";\n    action?: \"button\" | \"none\";\n    tone?: \"default\" | \"muted\";\n    density?: \"roomy\" | \"default\" | \"compact\";\n    landmarkLabel?: string;\n    onadd?: (id: string) => void;\n  };\n</script>\n\n<script lang=\"ts\">\n  import Box from \"../compose/Box.svelte\";\n  import Grid from \"../compose/Grid.svelte\";\n  import EmptyState from \"../components/empty-state.svelte\";\n  import ProductCard from \"../blocks/product-card.svelte\";\n  import SectionFrame from \"../components/section-frame.svelte\";\n\n  let {\n    id,\n    title,\n    products,\n    labels,\n    badges,\n    layout = \"grid\",\n    cols = \"1-3\",\n    ratio = \"4/3\",\n    rating = \"show\",\n    action = \"button\",\n    tone = \"default\",\n    density = \"default\",\n    landmarkLabel,\n    onadd,\n  }: ProductGridProps = $props();\n</script>\n\n<SectionFrame id={id} title={title} tone={tone} density={density} landmarkLabel={landmarkLabel}>\n  {#if ((products?.length ?? 0) === 0)}\n    <EmptyState icon=\"package\" title={labels.empty} />\n  {:else if ((layout as string) === \"rail\")}\n    <Box class=\"flex snap-x gap-4 overflow-x-auto pb-4\" data-slot=\"items\">\n      {#each products as p (p.id)}\n        <Box class=\"w-64 shrink-0 snap-start\" data-slot=\"product\">\n          <ProductCard\n            product={p}\n            labels={labels}\n            badges={badges}\n            layout={(((layout as string) === \"list\") ? \"horizontal\" : \"vertical\")}\n            ratio={ratio}\n            rating={rating}\n            action={action}\n            density={(((density as string) === \"compact\") ? \"compact\" : \"default\")}\n            onadd={() => onadd?.(p.id)}\n          />\n        </Box>\n      {/each}\n    </Box>\n  {:else}\n    <Grid cols={(((layout as string) === \"list\") ? \"1\" : cols)} class=\"gap-4\" data-slot=\"items\">\n      {#each products as p (p.id)}\n        <ProductCard\n          product={p}\n          labels={labels}\n          badges={badges}\n          layout={(((layout as string) === \"list\") ? \"horizontal\" : \"vertical\")}\n          ratio={ratio}\n          rating={rating}\n          action={action}\n          density={(((density as string) === \"compact\") ? \"compact\" : \"default\")}\n          onadd={() => onadd?.(p.id)}\n        />\n      {/each}\n    </Grid>\n  {/if}\n</SectionFrame>\n",
      "path": "blocks/product-grid.svelte",
      "target": "blocks/product-grid.svelte"
    }
  ],
  "meta": {
    "category": "commerce",
    "group": "catalog",
    "kind": "block",
    "tags": [
      "svelte",
      "block"
    ]
  },
  "name": "product-grid",
  "registryDependencies": [
    "box",
    "empty-state",
    "grid",
    "product-card",
    "section-frame",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Product Grid",
  "type": "registry:block"
}
