{
  "$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/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.\n/**\n * A row of vertical bars (sales by day, orders by week) with a caption under each bar. The chart is one image\n * for assistive technology: `label` carries the summary, the bar values are in the captions and titles.\n */\nimport { type ReactNode } from \"react\";\nimport { Box, Text } from \"../compose\";\nimport { cn, cssValue } from \"../utils\";\nimport type { Bar } from \"./bar-chart.types\";\n\nexport type BarChartProps = {\n  bars: Bar[];\n  label: string;\n  max?: number;\n  height?: number;\n  className?: string;\n};\n\nexport function BarChart({ bars, label, max, height = 160, className }: BarChartProps) {\n  const top = Math.max(1, (max ?? bars.reduce((m, i) => Math.max(m, i.value), 0)));\n  return (\n    <Box className={cn(\"min-w-0\", className)} data-slot=\"bar-chart\">\n      <Box\n        className=\"flex min-w-0 items-end gap-2\"\n        role=\"img\"\n        aria-label={label}\n        style={{ height: `${cssValue(height)}px` }}\n      >\n        {(bars ?? []).map((b) => (\n          <Box key={b.id} className=\"flex h-full min-w-0 flex-1 items-end\" title={(b.title ?? b.label)} data-slot=\"bar\">\n            <Box\n              className={cn(\"w-full rounded\", (b.muted ? \"bg-muted-foreground\" : \"bg-primary\"))}\n              style={{ height: `${cssValue(Math.max(2, Math.round(((b.value / top) * 100))))}%` }}\n              data-bar={b.id}\n            />\n          </Box>\n        ))}\n      </Box>\n      <Box className=\"mt-2 flex min-w-0 gap-2\" aria-hidden=\"true\">\n        {(bars ?? []).map((b) => (\n          <Box key={b.id} className=\"relative h-4 min-w-0 flex-1\" data-slot=\"bar\">\n            <Text className={\"absolute left-1/2 top-0 m-0 -translate-x-1/2 whitespace-nowrap text-xs font-medium text-muted-foreground\"}>\n              {b.label}\n            </Text>\n          </Box>\n        ))}\n      </Box>\n    </Box>\n  );\n}\n",
      "path": "components/bar-chart.tsx",
      "target": "components/bar-chart.tsx"
    },
    {
      "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 Bar = {\n  id: string;\n  label: string;\n  value: number;\n  title?: string;\n  muted?: boolean;\n};\n",
      "path": "components/bar-chart.types.ts",
      "target": "components/bar-chart.types.ts"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "react",
      "component"
    ]
  },
  "name": "bar-chart",
  "registryDependencies": [
    "compose",
    "utils"
  ],
  "runtime": "react",
  "title": "Bar Chart",
  "type": "registry:component"
}
