{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "A row of vertical bars (sales by day, orders by week) with a caption under each bar. The chart is one image for assistive technology: `label` carries the summary, the bar values are in the captions and titles.",
  "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/parts/bar-chart.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\t\"github.com/ui8kit/codegen/generated/templ/ui/text\"\n\tuiutils \"github.com/ui8kit/codegen/generated/templ/orgutils\"\n)\n\n// BarChartProps are the props of BarChart; the values are the JSON shapes of the TypeScript props.\ntype BarChartProps struct {\n\tBars any `json:\"bars\"`\n\tLabel any `json:\"label\"`\n\tMax any `json:\"max\"`\n\tHeight any `json:\"height\"`\n\tClass string `json:\"className\"`\n}\n\n// A row of vertical bars (sales by day, orders by week) with a caption under each bar. The chart is one image for assistive technology: `label` carries the summary, the bar values are in the captions and titles.\ntempl BarChart(p BarChartProps) {\n\t{{ vBars := p.Bars }}\n\t{{ vLabel := p.Label }}\n\t{{ vMax := p.Max }}\n\t{{ vHeight := uiutils.Def(p.Height, float64(160)) }}\n\t{{ vTop := any(uiutils.Max(float64(1), uiutils.Coalesce(vMax, uiutils.MaxBy(vBars, \"value\")))) }}\n\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(\"min-w-0\", p.Class)), Attrs: uiutils.Attrs(\"data-slot\", \"bar-chart\")}}) {\n\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"flex min-w-0 items-end gap-2\", Attrs: uiutils.Attrs(\"role\", \"img\", \"aria-label\", vLabel, \"style\", uiutils.Css(\"height\", vHeight, \"px\"))}}) {\n\t\t\tfor _, vB := range uiutils.L(vBars) {\n\t\t\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"flex h-full min-w-0 flex-1 items-end\", Attrs: uiutils.Attrs(\"title\", uiutils.Coalesce(uiutils.Get(vB, \"title\"), uiutils.Get(vB, \"label\")), \"data-slot\", \"bar\")}}) {\n\t\t\t\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(\"w-full rounded\", uiutils.Cond(uiutils.T(uiutils.Get(vB, \"muted\")), \"bg-muted-foreground\", \"bg-primary\"))), Attrs: uiutils.Attrs(\"style\", uiutils.Css(\"height\", uiutils.Max(float64(2), uiutils.Round(uiutils.Mul(uiutils.Div(uiutils.Get(vB, \"value\"), vTop), float64(100)))), \"%\"), \"data-bar\", uiutils.Get(vB, \"id\"))}})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"mt-2 flex min-w-0 gap-2\", Attrs: uiutils.Attrs(\"aria-hidden\", \"true\")}}) {\n\t\t\tfor _, vB := range uiutils.L(vBars) {\n\t\t\t\t@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: \"relative h-4 min-w-0 flex-1\", Attrs: uiutils.Attrs(\"data-slot\", \"bar\")}}) {\n\t\t\t\t\t@compose.Text(compose.TextProps{TextProps: text.TextProps{Class: \"absolute left-1/2 top-0 m-0 -translate-x-1/2 whitespace-nowrap text-xs font-medium text-muted-foreground\"}}) {\n\t\t\t\t\t\t{ uiutils.Text(uiutils.Get(vB, \"label\")) }\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n",
      "path": "blocks/bar-chart.templ",
      "target": "blocks/bar-chart.templ"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "templ",
      "component"
    ]
  },
  "name": "bar-chart",
  "registryDependencies": [
    "box",
    "kit-box",
    "kit-text",
    "text",
    "utils"
  ],
  "runtime": "templ",
  "title": "Bar Chart",
  "type": "registry:component"
}
