{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "report-stats",
  "type": "registry:block",
  "title": "Report, key figures",
  "description": "Two to six figures at a glance: a value, what it counts, an optional note and a direction (up, down, flat).",
  "categories": [
    "report"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-report.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/report-stats/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/report-stats/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t } from '../_shared/schema';\n\nconst schema = z.object({\n  title: t(100),\n  lead: t(300),\n  items: z.array(z.object({\n    value: z.string().min(1).max(24),\n    label: z.string().min(1).max(60),\n    note: t(100),\n    trend: z.enum(['up', 'down', 'flat']).optional(),\n  })).min(2).max(6),\n});\n\nexport const spec = defineSpec({\n  type: 'report-stats',\n  aliases: ['report/stats'],\n  name: 'Report, key figures',\n  category: 'report',\n  role: 'body',\n  description: 'Two to six figures at a glance: a value, what it counts, an optional note and a direction (up, down, flat).',\n  schema,\n  defaults: {\n    title: 'Name the figures',\n    lead: '',\n    items: [\n      { value: '00', label: 'Name count 1', note: '' },\n      { value: '00', label: 'Name count 2', note: 'Say a short note', trend: 'up' },\n      { value: '00', label: 'Name count 3', note: 'Say a short note', trend: 'flat' },\n      { value: '00', label: 'Name count 4', note: 'Say a short note', trend: 'down' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/report-stats/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/report-stats/index.tsx",
      "content": "import { useId } from 'react';\nimport { ArrowDownRight, ArrowRight, ArrowUpRight } from 'lucide-react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { cn } from '../../lib/utils';\nimport { ReportSection, ReportTitle } from '../_shared/report-kit';\nimport { spec } from './spec';\nimport type { BlockProps } from '../types';\nimport type { z } from 'zod';\n\nexport { spec };\ntype Props = z.infer<typeof spec.schema>;\n\nconst TREND = { up: { Icon: ArrowUpRight, word: 'Up' }, down: { Icon: ArrowDownRight, word: 'Down' }, flat: { Icon: ArrowRight, word: 'Unchanged' } } as const;\n\nfunction ReportStats({ props }: BlockProps<Props>) {\n  const id = useId();\n  const n = props.items.length;\n  // 3, 5 and 6 figures read in threes; 2 and 4 in twos.\n  const cols = n % 3 === 0 || n > 4 ? '@xl:grid-cols-2 @3xl:grid-cols-3' : '@md:grid-cols-2';\n  return (\n    <ReportSection labelledBy={id}>\n      <ReportTitle id={id} title={props.title} lead={props.lead} />\n      <dl className={cn('mt-5 grid gap-3', cols)}>\n        {props.items.map((item, i) => {\n          const trend = item.trend ? TREND[item.trend] : undefined;\n          return (\n            // One reading order (Felix 2026-10-16: \"the double text above and below the number confuses the eye\"): the number with its\n            // label beside it as one line (\"6 workspaces open\"), then at most one quiet line of context. Nothing above the number.\n            // The DOM stays dt, dd, dd (a valid group in the dl); order puts the value first on screen.\n            <div key={i} className=\"relative flex flex-wrap content-start items-baseline gap-x-2 gap-y-1 rounded-kh-lg border border-kh-line bg-kh-surface p-5 pr-10 print:break-inside-avoid\">\n              <dt className=\"order-2 text-kh-body font-medium text-kh-ink-2 [overflow-wrap:anywhere]\"><Text path={['items', i, 'label']} value={item.label} as=\"span\" /></dt>\n              <dd className=\"order-1 inline-flex items-baseline gap-1.5 text-kh-title font-semibold leading-none tabular-nums text-kh-ink [overflow-wrap:anywhere]\">\n                <Text path={['items', i, 'value']} value={item.value} as=\"span\" />\n                {/* The trend sits in the corner, so the number and its label stay one line; it is still part of the value for screen readers. */}\n                {trend && <span className=\"absolute right-4 top-4 inline-flex text-kh-muted\"><trend.Icon aria-hidden className=\"size-4\" /><span className=\"sr-only\">{trend.word}</span></span>}\n              </dd>\n              {item.note && <dd className=\"order-3 basis-full text-kh-small text-kh-muted\"><Text path={['items', i, 'note']} value={item.note} as=\"span\" /></dd>}\n            </div>\n          );\n        })}\n      </dl>\n    </ReportSection>\n  );\n}\n\nexport default withHeadingLevel(ReportStats);\n"
    }
  ]
}
