{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "report-sources",
  "type": "registry:block",
  "title": "Report, sources",
  "description": "Numbered sources: a label, the address (shown in full) and a note on what it was used for. Only http(s) and mail addresses become links.",
  "categories": [
    "report"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/button.json",
    "https://ui.klarhimmel.com/r/editing.json",
    "https://ui.klarhimmel.com/r/kit-report.json",
    "https://ui.klarhimmel.com/r/text-link.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/report-sources/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/report-sources/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({ label: z.string().min(1).max(200), url: t(500), note: t(300) })).min(1).max(40),\n});\n\nexport const spec = defineSpec({\n  type: 'report-sources',\n  aliases: ['report/sources'],\n  name: 'Report, sources',\n  category: 'report',\n  role: 'body',\n  description: 'Numbered sources: a label, the address (shown in full) and a note on what it was used for. Only http(s) and mail addresses become links.',\n  schema,\n  defaults: {\n    title: 'Name the list',\n    lead: '',\n    items: [\n      { label: 'Name a first source', url: 'https://example.com/specs/component-directory', note: 'Say what it was used for, in a line' },\n      { label: 'Name a second source', url: 'https://example.com/docs/publish-mode', note: '' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/report-sources/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/report-sources/index.tsx",
      "content": "import { useId } from 'react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { safeHref } from '../../ui/button';\nimport { linkClass } from '../../ui/text-link';\nimport { cn } from '../../lib/utils';\nimport { Opt, useEditing } from '../_shared/kit';\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 LINKABLE = /^(https?:\\/\\/|mailto:)/i;\n\nfunction ReportSources({ props }: BlockProps<Props>) {\n  const id = useId();\n  const editing = useEditing();\n  return (\n    <ReportSection labelledBy={id}>\n      <ReportTitle id={id} title={props.title} lead={props.lead} />\n      <ol className=\"mt-5 flex flex-col gap-4 text-kh-small\">\n        {props.items.map((s, i) => (\n          <li key={i} className=\"grid grid-cols-[1.75rem_1fr] gap-x-2 print:break-inside-avoid\">\n            <span aria-hidden className=\"tabular-nums text-kh-muted\">{i + 1}.</span>\n            <div className=\"min-w-0\">\n              <p className=\"font-medium [overflow-wrap:anywhere]\">\n                {LINKABLE.test(s.url) ? (\n                  <a href={safeHref(s.url)} rel=\"noopener noreferrer\" className={cn(linkClass(), 'text-kh-body')}><Text path={['items', i, 'label']} value={s.label} as=\"span\" /></a>\n                ) : (\n                  <Text path={['items', i, 'label']} value={s.label} as=\"span\" className=\"text-kh-body\" />\n                )}\n              </p>\n              {(s.url || editing) && <Text path={['items', i, 'url']} value={s.url} as=\"p\" className=\"mt-0.5 font-kh-mono text-kh-caption text-kh-muted [overflow-wrap:anywhere]\" placeholder=\"Address\" />}\n              <Opt path={['items', i, 'note']} value={s.note} rich className=\"mt-1 text-kh-muted\" placeholder=\"Note\" />\n            </div>\n          </li>\n        ))}\n      </ol>\n    </ReportSection>\n  );\n}\n\nexport default withHeadingLevel(ReportSources);\n"
    }
  ]
}
