{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "chart-delivery-capacity",
  "title": "Delivery capacity",
  "description": "Planned versus delivered work with signed variance.",
  "registryDependencies": [
    "@neumorphism-ui/chart",
    "@neumorphism-ui/select"
  ],
  "files": [
    {
      "path": "src/components/blocks/delivery-capacity-chart.tsx",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport { Bar, BarChart, CartesianGrid, ReferenceLine, XAxis, YAxis } from \"recharts\";\n\nimport { ChartContainer, ChartTooltip, ChartLegend } from \"@/components/ui/chart\";\nimport { Select, SelectItem } from \"@/components/ui/select\";\n\nconst copy = {\n  \"en\": {\n    \"title\": \"Delivery capacity\",\n    \"description\": \"Planned and delivered item counts. This is not a productivity score.\",\n    \"planned\": \"Planned\",\n    \"delivered\": \"Delivered\",\n    \"netVariance\": \"Net variance\",\n    \"empty\": \"No delivery records.\",\n    \"view\": \"View\",\n    \"compare\": \"Planned vs delivered\",\n    \"signed\": \"Signed variance\",\n    \"table\": \"View delivery data\",\n    \"caption\": \"Delivery capacity data\",\n    \"period\": \"Period\",\n    \"variance\": \"Variance\",\n    \"difference\": \"Delivered − planned\"\n  },\n  \"ko\": {\n    \"title\": \"계획·완료 수량\",\n    \"description\": \"계획한 항목과 완료한 항목의 수를 비교합니다. 생산성 점수가 아닙니다.\",\n    \"planned\": \"계획\",\n    \"delivered\": \"완료\",\n    \"netVariance\": \"순차이\",\n    \"empty\": \"완료 기록이 없습니다.\",\n    \"view\": \"보기 방식\",\n    \"compare\": \"계획과 완료 비교\",\n    \"signed\": \"증감 차이\",\n    \"table\": \"계획·완료 데이터 보기\",\n    \"caption\": \"계획·완료 수량 데이터\",\n    \"period\": \"기간\",\n    \"variance\": \"차이\",\n    \"difference\": \"완료 − 계획\"\n  },\n  \"ja\": {\n    \"title\": \"計画・完了件数\",\n    \"description\": \"計画した項目と完了した項目の件数です。生産性スコアではありません。\",\n    \"planned\": \"計画\",\n    \"delivered\": \"完了\",\n    \"netVariance\": \"合計差分\",\n    \"empty\": \"完了記録はありません。\",\n    \"view\": \"表示方法\",\n    \"compare\": \"計画と完了を比較\",\n    \"signed\": \"増減の差分\",\n    \"table\": \"計画・完了データを表示\",\n    \"caption\": \"計画・完了件数データ\",\n    \"period\": \"期間\",\n    \"variance\": \"差分\",\n    \"difference\": \"完了 − 計画\"\n  },\n  \"zh\": {\n    \"title\": \"计划与完成数量\",\n    \"description\": \"比较计划和已完成的事项数量。这不是生产力评分。\",\n    \"planned\": \"计划\",\n    \"delivered\": \"完成\",\n    \"netVariance\": \"净差额\",\n    \"empty\": \"暂无完成记录。\",\n    \"view\": \"显示方式\",\n    \"compare\": \"计划与完成对比\",\n    \"signed\": \"增减差额\",\n    \"table\": \"查看计划与完成数据\",\n    \"caption\": \"计划与完成数量数据\",\n    \"period\": \"时段\",\n    \"variance\": \"差额\",\n    \"difference\": \"完成 − 计划\"\n  }\n} as const;\n\nexport type DeliveryCapacityPoint = {\n  period: string;\n  planned: number;\n  delivered: number;\n};\n\nexport function DeliveryCapacityChart({\n  data,\n  locale = \"en\",\n}: {\n  data: readonly DeliveryCapacityPoint[];\n  locale?: keyof typeof copy;\n}) {\n  const t = copy[locale];\n  const [view, setView] = React.useState<\"compare\" | \"variance\">(\"compare\");\n  const planned = data.reduce((sum, row) => sum + row.planned, 0);\n  const delivered = data.reduce((sum, row) => sum + row.delivered, 0);\n  const chartData = data.map((row) => ({ ...row, variance: row.delivered - row.planned }));\n\n  return (\n    <ChartContainer\n      data-chart=\"delivery-capacity\"\n      title={t.title}\n      description={t.description}\n      summary={data.length ? `${t.planned} ${planned} · ${t.delivered} ${delivered} · ${t.netVariance} ${delivered - planned >= 0 ? \"+\" : \"\"}${delivered - planned}` : t.empty}\n      actions={\n        <label className=\"grid gap-1.5 text-xs\">\n          {t.view}\n          <Select value={view} onChange={(event) => setView(event.target.value as typeof view)}>\n            <SelectItem value=\"compare\">{t.compare}</SelectItem>\n            <SelectItem value=\"variance\">{t.signed}</SelectItem>\n          </Select>\n        </label>\n      }\n      tableLabel={t.table}\n      emptyLabel={t.empty}\n      empty={!data.length}\n      table={\n        <table>\n          <caption className=\"sr-only\">{t.caption}</caption>\n          <thead><tr><th>{t.period}</th><th>{t.planned}</th><th>{t.delivered}</th><th>{t.variance}</th></tr></thead>\n          <tbody>{chartData.map((row) => <tr key={row.period}><th scope=\"row\">{row.period}</th><td>{row.planned}</td><td>{row.delivered}</td><td>{row.variance > 0 ? \"+\" + row.variance : row.variance}</td></tr>)}</tbody>\n        </table>\n      }\n    >\n      <BarChart data={chartData} accessibilityLayer margin={{ top: 12, right: 12, bottom: 4, left: 0 }}>\n        <CartesianGrid vertical={false} stroke=\"var(--border)\" strokeDasharray=\"3 4\" />\n        <XAxis dataKey=\"period\" tick={{ fill: \"var(--muted-foreground)\" }} tickLine={false} axisLine={false} />\n        <YAxis width={44} tick={{ fill: \"var(--muted-foreground)\" }} tickLine={false} axisLine={false} />\n        <ReferenceLine y={0} stroke=\"var(--foreground)\" />\n        <ChartLegend />\n        <ChartTooltip />\n        {view === \"variance\" ? (\n          <Bar dataKey=\"variance\" name={t.difference} fill=\"var(--primary)\" maxBarSize={52} isAnimationActive={false} />\n        ) : (\n          <>\n            <Bar dataKey=\"planned\" name={t.planned} legendType=\"plainline\" fill=\"var(--muted-foreground)\" fillOpacity={0.14} stroke=\"var(--muted-foreground)\" strokeDasharray=\"4 3\" maxBarSize={40} isAnimationActive={false} />\n            <Bar dataKey=\"delivered\" name={t.delivered} fill=\"var(--primary)\" maxBarSize={40} isAnimationActive={false} />\n          </>\n        )}\n      </BarChart>\n    </ChartContainer>\n  );\n}\n\nconst exampleCapacity: DeliveryCapacityPoint[] = [\n  { period: \"S1\", planned: 32, delivered: 28 },\n  { period: \"S2\", planned: 36, delivered: 39 },\n  { period: \"S3\", planned: 34, delivered: 31 },\n  { period: \"S4\", planned: 38, delivered: 42 },\n];\n\nexport function DeliveryCapacityExample({ locale = \"en\" }: { locale?: keyof typeof copy }) {\n  return <DeliveryCapacityChart data={exampleCapacity} locale={locale} />;\n}\n",
      "type": "registry:component",
      "target": "@components/blocks/delivery-capacity-chart.tsx"
    }
  ],
  "categories": [
    "chart"
  ],
  "type": "registry:block"
}