{
  "$schema": "https://registry.buildy.tw/schema/registry-item.json",
  "dependencies": [],
  "description": "Bar Chart component",
  "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-->\n<script lang=\"ts\" module>\n  import type { Snippet } from \"svelte\";\n  import type { Bar } from \"./bar-chart.types\";\n\n  export type BarChartProps = {\n    bars: Bar[];\n    label: string;\n    max?: number;\n    height?: number;\n    class?: string;\n  };\n</script>\n\n<script lang=\"ts\">\n  import Box from \"../compose/Box.svelte\";\n  import Text from \"../compose/Text.svelte\";\n  import { cn, cssValue } from \"../utils\";\n\n  let { bars, label, max, height = 160, class: className }: BarChartProps = $props();\n  const top = $derived(Math.max(1, (max ?? bars.reduce((m, i) => Math.max(m, i.value), 0))));\n</script>\n\n<Box class={cn(\"min-w-0\", className)} data-slot=\"bar-chart\">\n  <Box class=\"flex min-w-0 items-end gap-2\" role=\"img\" aria-label={label} style={`height:${cssValue(height)}px`}>\n    {#each bars as b (b.id)}\n      <Box class=\"flex h-full min-w-0 flex-1 items-end\" title={(b.title ?? b.label)} data-slot=\"bar\">\n        <Box\n          class={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    {/each}\n  </Box>\n  <Box class=\"mt-2 flex min-w-0 gap-2\" aria-hidden=\"true\">\n    {#each bars as b (b.id)}\n      <Box class=\"relative h-4 min-w-0 flex-1\" data-slot=\"bar\">\n        <Text class={\"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    {/each}\n  </Box>\n</Box>\n",
      "path": "components/bar-chart.svelte",
      "target": "components/bar-chart.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 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": [
      "svelte",
      "component"
    ]
  },
  "name": "bar-chart",
  "registryDependencies": [
    "box",
    "text",
    "utils"
  ],
  "runtime": "svelte",
  "title": "Bar Chart",
  "type": "registry:component"
}
