{
  "$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/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n// Source: packages/compose-gen/specs/organisms/product-grid.json\n\npackage blocks\n\nimport (\n\t\"github.com/ui8kit/codegen/generated/templ/ui/box\"\n\t\"github.com/ui8kit/codegen/generated/templ/compose\"\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/orgutils\"\n)\n\n// ProductGridProps are the props of ProductGrid; the values are the JSON shapes of the TypeScript props.\ntype ProductGridProps struct {\n\tId any `json:\"id\"`\n\tTitle any `json:\"title\"`\n\tProducts any `json:\"products\"`\n\tLabels any `json:\"labels\"`\n\tBadges any `json:\"badges\"`\n\tLayout any `json:\"layout\"`\n\tCols any `json:\"cols\"`\n\tRatio any `json:\"ratio\"`\n\tRating any `json:\"rating\"`\n\tAction any `json:\"action\"`\n\tTone any `json:\"tone\"`\n\tDensity any `json:\"density\"`\n\tLandmarkLabel any `json:\"landmarkLabel\"`\n}\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 scrolls sideways; an empty state when there are none. Axes: layout (grid, list, rail), columns, ratio, rating, action, tone, density.\ntempl ProductGrid(p ProductGridProps) {\n\t{{ vId := p.Id }}\n\t{{ vTitle := p.Title }}\n\t{{ vProducts := p.Products }}\n\t{{ vLabels := p.Labels }}\n\t{{ vBadges := p.Badges }}\n\t{{ vLayout := uiutils.Def(p.Layout, \"grid\") }}\n\t{{ vCols := uiutils.Def(p.Cols, \"1-3\") }}\n\t{{ vRatio := uiutils.Def(p.Ratio, \"4/3\") }}\n\t{{ vRating := uiutils.Def(p.Rating, \"show\") }}\n\t{{ vAction := uiutils.Def(p.Action, \"button\") }}\n\t{{ vTone := uiutils.Def(p.Tone, \"default\") }}\n\t{{ vDensity := uiutils.Def(p.Density, \"default\") }}\n\t{{ vLandmarkLabel := p.LandmarkLabel }}\n\t@SectionFrame(SectionFrameProps{Id: vId, Title: vTitle, Tone: vTone, Density: vDensity, LandmarkLabel: vLandmarkLabel}) {\n\t\tif uiutils.Eq(uiutils.Len(vProducts), float64(0)) {\n\t\t\t@EmptyState(EmptyStateProps{Icon: \"package\", Title: uiutils.Get(vLabels, \"empty\")})\n\t\t} else if uiutils.Eq(vLayout, \"rail\") {\n\t\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"flex snap-x gap-4 overflow-x-auto pb-4\", Attrs: uiutils.Attrs(\"data-slot\", \"items\")}}) {\n\t\t\t\tfor _, vP := range uiutils.L(vProducts) {\n\t\t\t\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"w-64 shrink-0 snap-start\", Attrs: uiutils.Attrs(\"data-slot\", \"product\")}}) {\n\t\t\t\t\t\t@ProductCard(ProductCardProps{Product: vP, Labels: vLabels, Badges: vBadges, Layout: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, \"list\")), \"horizontal\", \"vertical\"), Ratio: vRatio, Rating: vRating, Action: vAction, Density: uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, \"compact\")), \"compact\", \"default\")})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t@compose.Grid(compose.GridProps{Cols: uiutils.S(uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, \"list\")), \"1\", vCols)), BoxProps: box.BoxProps{Class: \"gap-4\", Attrs: uiutils.Attrs(\"data-slot\", \"items\")}}) {\n\t\t\t\tfor _, vP := range uiutils.L(vProducts) {\n\t\t\t\t\t@ProductCard(ProductCardProps{Product: vP, Labels: vLabels, Badges: vBadges, Layout: uiutils.Cond(uiutils.T(uiutils.Eq(vLayout, \"list\")), \"horizontal\", \"vertical\"), Ratio: vRatio, Rating: vRating, Action: vAction, Density: uiutils.Cond(uiutils.T(uiutils.Eq(vDensity, \"compact\")), \"compact\", \"default\")})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
      "path": "blocks/product-grid.templ",
      "target": "blocks/product-grid.templ"
    }
  ],
  "meta": {
    "category": "commerce",
    "group": "catalog",
    "kind": "block",
    "tags": [
      "templ",
      "block"
    ]
  },
  "name": "product-grid",
  "registryDependencies": [
    "box",
    "empty-state",
    "grid",
    "kit-box",
    "product-card",
    "section-frame",
    "utils"
  ],
  "runtime": "templ",
  "title": "Product Grid",
  "type": "registry:block"
}
