{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "integrations-grid",
  "type": "registry:block",
  "title": "Integrations, filterable grid",
  "description": "A grid of integrations, each with a logo, name, one line and a link, and filter chips built from the groups (All, Payments, Calendars, ...). The chips are native radios the block stylesheet reads, so the filter works with no script; the count follows the filter. Leave a link label empty to drop that link.",
  "categories": [
    "integrations"
  ],
  "dependencies": [
    "zod@^4.6.5"
  ],
  "registryDependencies": [
    "https://ui.klarhimmel.com/r/badge.json",
    "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-c-proof.json",
    "https://ui.klarhimmel.com/r/text-link.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/integrations-grid/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/integrations-grid/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, link, media, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  description: t(300),\n  /** Names the filter group for assistive tech; not shown. */\n  filterLabel: t(30),\n  /** The chip that shows everything. The other chips are the `group` of each integration, in the order they first appear. Empty: no chips, every integration shows. */\n  allLabel: t(20),\n  /** Follows the number shown: \"6 integrations\". Announced when the filter changes. */\n  countSuffix: t(20),\n  items: z.array(z.object({ name: t(40), group: t(24), description: t(120), logo: media, link })).min(2).max(12),\n});\n\nexport const spec = defineSpec({\n  type: 'integrations-grid',\n  aliases: ['integrations/grid'],\n  name: 'Integrations, filterable grid',\n  category: 'integrations',\n  role: 'body',\n  description: 'A grid of integrations, each with a logo, name, one line and a link, and filter chips built from the groups (All, Payments, Calendars, ...). The chips are native radios the block stylesheet reads, so the filter works with no script; the count follows the filter. Leave a link label empty to drop that link.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the topic',\n    title: 'Say what it connects with',\n    description: 'Say in one or two sentences what they can connect and how quickly it is done.',\n    filterLabel: 'Name what the filter does',\n    allLabel: 'All',\n    countSuffix: 'items',\n    items: [\n      { name: 'First tool', group: 'First group', description: 'Say what it does for them, in a line', logo: { src: '', alt: 'The tool\\'s logo' }, link: { label: 'Main action', href: '#stripe' } },\n      { name: 'Second tool', group: 'First group', description: 'Say what it does for them, in a line', logo: { src: '', alt: 'The tool\\'s logo' }, link: { label: 'Main action', href: '#swish' } },\n      { name: 'Third tool', group: 'Second group', description: 'Say what it does for them, in a line', logo: { src: '', alt: 'The tool\\'s logo' }, link: { label: 'Main action', href: '#gcal' } },\n      { name: 'Fourth tool', group: 'Second group', description: 'Say what it does for them, in a line', logo: { src: '', alt: 'The tool\\'s logo' }, link: { label: 'Main action', href: '#outlook' } },\n      { name: 'Fifth tool', group: 'Third group', description: 'Say what it does for them, in a line', logo: { src: '', alt: 'The tool\\'s logo' }, link: { label: 'Main action', href: '#slack' } },\n      { name: 'Sixth tool', group: 'Third group', description: 'Say what it does for them, in a line', logo: { src: '', alt: 'The tool\\'s logo' }, link: { label: 'Main action', href: '#whatsapp' } },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/integrations-grid/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/integrations-grid/index.tsx",
      "content": "/// <reference path=\"../../css.d.ts\" />\nimport './filter.css';\nimport { useId } from 'react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { cn } from '../../lib/utils';\nimport { Badge } from '../../ui/badge';\nimport { safeHref } from '../../ui/button';\nimport { linkClass } from '../../ui/text-link';\nimport { Container, Section, useEditing } from '../_shared/kit';\nimport { Heading, useHeadingId } from '../_shared/c-proof-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\n// Each chip is a label around a native radio, and filter.css shows the cards and the count of the checked group: the filter works\n// the same with or without script, so the block is a library row (KB-425). Groups are numbered by first appearance (12 at most).\nconst chip = cn(\n  'inline-flex min-h-11 max-w-full min-w-0 cursor-pointer items-center [overflow-wrap:anywhere] rounded-kh-pill border px-4 text-kh-small font-medium transition-colors duration-(--kh-dur)',\n  'border-kh-line-strong bg-kh-surface text-kh-ink-2 hover:bg-kh-surface-2 hover:text-kh-ink',\n  'has-[:checked]:border-kh-ink has-[:checked]:bg-kh-ink has-[:checked]:text-kh-on-ink',\n  'has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-2 has-[:focus-visible]:outline-(--kh-focus)',\n);\n\nfunction IntegrationsGrid({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const editing = useEditing();\n  const name = `kh-filter-${useId()}`;\n  const groups = [...new Set(props.items.map((i) => i.group).filter(Boolean))];\n  // Without an All chip there is no way back to everything, so there are no chips and every card shows.\n  const filters = !editing && !!props.allLabel.trim() && groups.length > 0;\n  const radio = (value: string, checked?: boolean) => (\n    <input type=\"radio\" name={name} value={value} defaultChecked={checked} data-kh-css-control=\"\" data-kh-filter={value} className=\"sr-only\" />\n  );\n  return (\n    <Section labelledBy={id}>\n      <Container className=\"kh-integrations\">\n        <Heading id={id} eyebrow={props.eyebrow} title={props.title} description={props.description} />\n        <div className=\"mt-10 flex flex-wrap items-center gap-x-6 gap-y-3\">\n          {editing ? (\n            <p className=\"flex flex-wrap gap-2 text-kh-small\">\n              <Text path={['allLabel']} value={props.allLabel} as=\"span\" className=\"rounded-kh-pill border border-kh-line-strong px-4 py-2\" />\n              <Text path={['filterLabel']} value={props.filterLabel} as=\"span\" className=\"px-2 py-2 text-kh-muted\" />\n            </p>\n          ) : filters && (\n            <fieldset className=\"flex min-w-0 max-w-full flex-wrap gap-2\">\n              <legend className=\"sr-only\">{props.filterLabel}</legend>\n              <label className={chip}>\n                {radio('all', true)}\n                <Text path={['allLabel']} value={props.allLabel} as=\"span\" />\n              </label>\n              {groups.map((g, k) => (\n                <label key={g} className={chip}>\n                  {radio(String(k))}\n                  {g}\n                </label>\n              ))}\n            </fieldset>\n          )}\n          <p role=\"status\" className=\"text-kh-small tabular-nums text-kh-muted\">\n            <span data-kh-count=\"all\">{props.items.length}</span>\n            {filters && groups.map((g, k) => (\n              <span key={g} data-kh-count={k}>{props.items.filter((it) => it.group === g).length}</span>\n            ))}{' '}\n            <Text path={['countSuffix']} value={props.countSuffix} as=\"span\" />\n          </p>\n        </div>\n        <ul className=\"mt-8 grid gap-4 @xl:grid-cols-2 @4xl:grid-cols-3\">\n          {props.items.map((it, i) => (\n            <li key={i} data-kh-group={it.group ? groups.indexOf(it.group) : undefined} className=\"flex flex-col gap-4 rounded-kh-xl border border-kh-line bg-kh-surface p-6\">\n              <div className=\"flex items-center gap-4\">\n                <Media path={['items', i, 'logo']} value={it.logo} ratio=\"1 / 1\" className=\"size-12 shrink-0 rounded-kh border border-kh-line\" />\n                <div className=\"min-w-0\">\n                  <Text path={['items', i, 'name']} value={it.name} as=\"h3\" className=\"text-kh-body font-semibold\" />\n                  {(it.group || editing) && (\n                    <Badge tone=\"outline\" className=\"mt-1\">\n                      <Text path={['items', i, 'group']} value={it.group} as=\"span\" />\n                    </Badge>\n                  )}\n                </div>\n              </div>\n              <Text path={['items', i, 'description']} value={it.description} as=\"p\" className=\"text-kh-small text-kh-muted\" />\n              {(it.link.label || editing) && (\n                <a href={safeHref(it.link.href)} className={cn(linkClass(), 'mt-auto inline-flex min-h-11 items-center self-start text-kh-small font-medium')}>\n                  <Text path={['items', i, 'link', 'label']} value={it.link.label} as=\"span\" placeholder=\"Label\" />\n                  {' '}\n                  <span className=\"sr-only\">{it.name}</span>\n                </a>\n              )}\n            </li>\n          ))}\n        </ul>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(IntegrationsGrid);\n"
    },
    {
      "path": "src/blocks/integrations-grid/filter.css",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/integrations-grid/filter.css",
      "content": "/* The checked radio is the filter: only its group's cards and count show. No script (KB-425). Twelve groups at most (the schema's max items). */\n.kh-integrations:has(input[data-kh-filter]:not([data-kh-filter=\"all\"]):checked) [data-kh-count=\"all\"] { display: none; }\n.kh-integrations [data-kh-count]:not([data-kh-count=\"all\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"0\"]:checked) [data-kh-count=\"0\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"0\"]:checked) li:not([data-kh-group=\"0\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"1\"]:checked) [data-kh-count=\"1\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"1\"]:checked) li:not([data-kh-group=\"1\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"2\"]:checked) [data-kh-count=\"2\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"2\"]:checked) li:not([data-kh-group=\"2\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"3\"]:checked) [data-kh-count=\"3\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"3\"]:checked) li:not([data-kh-group=\"3\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"4\"]:checked) [data-kh-count=\"4\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"4\"]:checked) li:not([data-kh-group=\"4\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"5\"]:checked) [data-kh-count=\"5\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"5\"]:checked) li:not([data-kh-group=\"5\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"6\"]:checked) [data-kh-count=\"6\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"6\"]:checked) li:not([data-kh-group=\"6\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"7\"]:checked) [data-kh-count=\"7\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"7\"]:checked) li:not([data-kh-group=\"7\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"8\"]:checked) [data-kh-count=\"8\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"8\"]:checked) li:not([data-kh-group=\"8\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"9\"]:checked) [data-kh-count=\"9\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"9\"]:checked) li:not([data-kh-group=\"9\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"10\"]:checked) [data-kh-count=\"10\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"10\"]:checked) li:not([data-kh-group=\"10\"]) { display: none; }\n.kh-integrations:has(input[data-kh-filter=\"11\"]:checked) [data-kh-count=\"11\"] { display: inline; }\n.kh-integrations:has(input[data-kh-filter=\"11\"]:checked) li:not([data-kh-group=\"11\"]) { display: none; }\n"
    }
  ]
}
