{
  "$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\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"
    },
    {
      "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\">\nimport type { Bar } from \"./bar-chart.types\";\n\nexport type BarChartProps = {\n  bars: Bar[];\n  label: string;\n  max?: number;\n  height?: number;\n  class?: string;\n};\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from \"vue\";\nimport Box from \"../compose/Box.vue\";\nimport Text from \"../compose/Text.vue\";\nimport { cn, cssValue } from \"../utils\";\n\nconst { bars, label, max, height = 160, class: className } = defineProps<BarChartProps>();\nconst top = computed(() => Math.max(1, (max ?? bars.reduce((m, i) => Math.max(m, i.value), 0))));\n</script>\n\n<template>\n  <Box :class=\"cn('min-w-0', className)\" data-slot=\"bar-chart\">\n    <Box\n      class=\"flex min-w-0 items-end gap-2\"\n      role=\"img\"\n      :aria-label=\"label\"\n      :style=\"`height:${cssValue(height)}px`\"\n    >\n      <Box\n        v-for=\"b in bars\"\n        :key=\"b.id\"\n        class=\"flex h-full min-w-0 flex-1 items-end\"\n        :title=\"(b.title ?? b.label)\"\n        data-slot=\"bar\"\n      >\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    </Box>\n    <Box class=\"mt-2 flex min-w-0 gap-2\" aria-hidden=\"true\">\n      <Box v-for=\"b in bars\" :key=\"b.id\" 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    </Box>\n  </Box>\n</template>\n",
      "path": "components/bar-chart.vue",
      "target": "components/bar-chart.vue"
    }
  ],
  "meta": {
    "category": "components",
    "kind": "component",
    "tags": [
      "vue",
      "component"
    ]
  },
  "name": "bar-chart",
  "registryDependencies": [
    "box",
    "text",
    "utils"
  ],
  "runtime": "vue",
  "title": "Bar Chart",
  "type": "registry:component"
}
