{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "docs-swatches",
  "type": "registry:block",
  "title": "Docs, colour swatches",
  "description": "A grid of colour swatches with name, hex value and token. The colour foundation specimen. Only hex values paint a swatch.",
  "categories": [
    "docs"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/block-kit.json",
    "https://ui.klarhimmel.com/r/copy-button.json",
    "https://ui.klarhimmel.com/r/editing.json"
  ],
  "files": [
    {
      "path": "src/blocks/docs-swatches/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/docs-swatches/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, t } from '../_shared/schema';\n\nconst schema = z.object({\n  title: t(60),\n  description: t(200),\n  swatches: z.array(z.object({ name: t(30), value: t(16), token: t(30) })).min(1).max(16),\n});\n\nexport const spec = defineSpec({\n  type: 'docs-swatches',\n  aliases: ['docs/swatches'],\n  name: 'Docs, colour swatches',\n  category: 'docs',\n  role: 'body',\n  description: 'A grid of colour swatches with name, hex value and token. The colour foundation specimen. Only hex values paint a swatch.',\n  schema,\n  defaults: {\n    title: 'Name the set',\n    description: 'Say where the values come from and how to use them.',\n    swatches: [\n      { name: 'Colour 1', value: '#F4F1EA', token: '--canvas' },\n      { name: 'Colour 2', value: '#FFFFFF', token: '--surface' },\n      { name: 'Colour 3', value: '#16181D', token: '--ink' },\n      { name: 'Colour 4', value: '#2B65C9', token: '--accent' },\n      { name: 'Colour 5', value: '#D49A2C', token: '--attention' },\n      { name: 'Colour 6', value: '#B84A32', token: '--danger' },\n      { name: 'Colour 7', value: '#437A52', token: '--success' },\n      { name: 'Colour 8', value: '#E0DCD2', token: '--line' },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/docs-swatches/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/docs-swatches/index.tsx",
      "content": "import { useId } from 'react';\nimport { Text, withHeadingLevel } from '../../editing';\nimport { CopyButton } from '../../ui/copy-button';\nimport { Container, Section, SectionHeader } from '../_shared/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 HEX = /^#[0-9a-f]{3,8}$/i;\n\nfunction DocsSwatches({ props }: BlockProps<Props>) {\n  const id = useId();\n  return (\n    <Section labelledBy={id} className=\"py-10 @3xl:py-14\">\n      <Container>\n        <SectionHeader id={id} title={props.title} description={props.description} />\n        <ul className=\"mt-8 grid grid-cols-2 gap-4 @3xl:grid-cols-3 @4xl:grid-cols-4\">\n          {props.swatches.map((s, i) => (\n            <li key={i} className=\"overflow-hidden rounded-kh-lg border border-kh-line bg-kh-surface\">\n              {/* the wireframe theme paints every swatch grey */}\n              {/* an SVG fill attribute, not a style attribute: the swatch colour is data, and inline style is blocked by a strict CSP */}\n              <svg aria-hidden className=\"block h-24 w-full border-b border-kh-line bg-kh-surface-3\">\n                <rect width=\"100%\" height=\"100%\" fill={HEX.test(s.value) ? s.value : 'none'} className=\"[[data-kh-theme='wireframe']_&]:fill-none\" />\n              </svg>\n              <div className=\"px-3.5 py-3\">\n                <Text path={['swatches', i, 'name']} value={s.name} as=\"p\" className=\"text-kh-small font-medium\" />\n                <div className=\"mt-1 flex items-center justify-between gap-2\">\n                  <Text path={['swatches', i, 'value']} value={s.value} as=\"code\" className=\"font-kh-mono text-kh-caption text-kh-ink-2\" />\n                  <CopyButton value={s.value} label={`Copy ${s.name} value`} className=\"-my-1.5 -mr-2\" />\n                </div>\n                <Text path={['swatches', i, 'token']} value={s.token} as=\"code\" className=\"mt-0.5 block truncate font-kh-mono text-kh-caption text-kh-muted\" />\n              </div>\n            </li>\n          ))}\n        </ul>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(DocsSwatches);\n"
    }
  ]
}
