{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "testimonials-carousel",
  "type": "registry:block",
  "title": "Testimonials, carousel",
  "description": "One quote at a time with previous and next buttons. Moves only when pressed; every quote shows while editing.",
  "categories": [
    "testimonials"
  ],
  "dependencies": [
    "lucide-react@^1.49.0",
    "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-c-proof.json",
    "https://ui.klarhimmel.com/r/utils.json"
  ],
  "files": [
    {
      "path": "src/blocks/testimonials-carousel/spec.ts",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/testimonials-carousel/spec.ts",
      "content": "import { z } from 'zod';\nimport { defineSpec, media, t } from '../_shared/schema';\n\nconst schema = z.object({\n  eyebrow: t(60),\n  title: t(120),\n  /** arrows (the default): previous and next buttons with a counter. tabs: a row of labels (each quote's name) above the card, and choosing one shows its quote. */\n  switcher: z.enum(['arrows', 'tabs']).optional(),\n  items: z.array(z.object({ quote: t(400), name: t(60), role: t(80), photo: media })).min(1).max(6),\n});\n\nconst who = () => ({ src: '', alt: 'Portrait of the person quoted' });\n\nexport const spec = defineSpec({\n  type: 'testimonials-carousel',\n  aliases: ['testimonials/carousel'],\n  name: 'Testimonials, carousel',\n  category: 'testimonials',\n  role: 'body',\n  description: 'One quote at a time with previous and next buttons. Moves only when pressed; every quote shows while editing.',\n  schema,\n  defaults: {\n    eyebrow: 'Name the section',\n    title: 'Say what the quotes show, in one short line',\n    items: [\n      { quote: 'Quote a customer, in their words, on the result they got and what it changed for them afterwards.', name: 'Name a person', role: 'Their role and their company', photo: who() },\n      { quote: 'Quote a customer, in their words, on the result they got and what it changed for them afterwards.', name: 'Name a person', role: 'Their role and their company', photo: who() },\n      { quote: 'Quote a customer, in their words, on the result they got and what it changed for them afterwards.', name: 'Name a person', role: 'Their role and their company', photo: who() },\n      { quote: 'Quote a customer, in their words, on the result they got and what it changed for them afterwards.', name: 'Name a person', role: 'Their role and company', photo: who() },\n    ],\n  },\n});\n"
    },
    {
      "path": "src/blocks/testimonials-carousel/index.tsx",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/testimonials-carousel/index.tsx",
      "content": "/// <reference path=\"../../css.d.ts\" />\nimport './slides.css';\nimport { useId } from 'react';\nimport { ArrowLeft, ArrowRight } from 'lucide-react';\nimport { Media, Text, withHeadingLevel } from '../../editing';\nimport { Container, Section, useEditing } from '../_shared/kit';\nimport { Heading, useHeadingId } from '../_shared/c-proof-kit';\nimport { buttonClass } from '../../ui/button';\nimport { cn } from '../../lib/utils';\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\ntype Item = Props['items'][number];\n\nfunction Slide({ item, i }: { item: Item; i: number }) {\n  return (\n    <figure className=\"grid items-center gap-8 @3xl:grid-cols-[auto_1fr] @3xl:gap-12\">\n      <div className=\"size-20 overflow-hidden rounded-kh-pill border border-kh-line @3xl:size-40\">\n        <Media path={['items', i, 'photo']} value={item.photo} ratio=\"1 / 1\" />\n      </div>\n      <div>\n        <blockquote>\n          <Text path={['items', i, 'quote']} value={item.quote} as=\"p\" multiline className=\"text-kh-lead font-medium leading-snug @3xl:text-kh-title @3xl:leading-tight\" />\n        </blockquote>\n        <figcaption className=\"mt-6\">\n          <Text path={['items', i, 'name']} value={item.name} as=\"span\" className=\"block text-kh-body font-semibold\" />\n          <Text path={['items', i, 'role']} value={item.role} as=\"span\" className=\"block text-kh-small text-kh-muted\" />\n        </figcaption>\n      </div>\n    </figure>\n  );\n}\n\nfunction TestimonialsCarousel({ props }: BlockProps<Props>) {\n  const id = useHeadingId(props.title);\n  const editing = useEditing();\n  // One native radio per slide (hidden, named for readers), and slides.css shows the slide whose radio is checked: the arrows are\n  // labels for the neighbouring radio, so the carousel works the same with or without script and is a library row (KB-364).\n  // Keyboard: Tab reaches the checked radio and the arrow keys move between slides.\n  const n = props.items.length;\n  const live = !editing && n > 1;\n  const name = `kh-slide-${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`;\n  const rid = (i: number) => `${name}-${(i + n) % n}`;\n  const tabs = props.switcher === 'tabs';\n  const arrow = cn(buttonClass('secondary', 'md'), 'size-11 cursor-pointer px-0');\n  return (\n    <Section labelledBy={id}>\n      <Container className=\"kh-carousel\">\n        <div className=\"flex flex-wrap items-end justify-between gap-6\">\n          <Heading id={id} eyebrow={props.eyebrow} title={props.title} />\n          {live && !tabs && props.items.map((_, i) => (\n            <div key={i} data-kh-slide-part={i} aria-hidden>\n              <div className=\"flex items-center gap-3\">\n                <span className=\"mr-2 text-kh-small tabular-nums text-kh-muted\">{i + 1} / {n}</span>\n                <label htmlFor={rid(i - 1)} className={arrow}><ArrowLeft className=\"size-4\" /></label>\n                <label htmlFor={rid(i + 1)} className={arrow}><ArrowRight className=\"size-4\" /></label>\n              </div>\n            </div>\n          ))}\n        </div>\n        {live && tabs && (\n          <div className=\"mt-8 flex flex-wrap gap-2\">\n            {props.items.map((item, i) => (\n              <label key={i} htmlFor={rid(i)} data-kh-tab={i} className=\"kh-carousel-tab cursor-pointer rounded-kh-pill border border-kh-line bg-kh-surface px-4 py-2 text-kh-small text-kh-ink-2 hover:border-kh-line-strong hover:text-kh-ink\">\n                <Text path={['items', i, 'name']} value={item.name} as=\"span\" />\n              </label>\n            ))}\n          </div>\n        )}\n        <div role=\"group\" aria-roledescription=\"carousel\" aria-label={props.title || 'Testimonials'} className={cn(tabs ? 'mt-6' : 'mt-12', 'rounded-kh-xl border border-kh-line bg-kh-surface p-7 @3xl:p-12')}>\n          {editing ? (\n            <div className=\"divide-y divide-kh-line\">\n              {props.items.map((item, i) => (\n                <div key={i} className=\"py-10 first:pt-0 last:pb-0\">\n                  <Slide item={item} i={i} />\n                </div>\n              ))}\n            </div>\n          ) : live ? (\n            // The carousel group above already carries the title; radios sharing a name are one group without a second name.\n            <div aria-live=\"polite\">\n              {props.items.map((_, i) => (\n                <input key={i} type=\"radio\" id={rid(i)} name={name} defaultChecked={i === 0} data-kh-css-control=\"\" data-kh-slide={i} aria-label={`Testimonial ${i + 1} of ${n}`} className=\"sr-only\" />\n              ))}\n              {props.items.map((item, i) => (\n                <div key={i} data-kh-slide-part={i} role=\"group\" aria-roledescription=\"slide\" aria-label={`${i + 1} of ${n}`}>\n                  <Slide item={item} i={i} />\n                </div>\n              ))}\n            </div>\n          ) : (\n            props.items[0] && <Slide item={props.items[0]} i={0} />\n          )}\n        </div>\n      </Container>\n    </Section>\n  );\n}\n\nexport default withHeadingLevel(TestimonialsCarousel);\n"
    },
    {
      "path": "src/blocks/testimonials-carousel/slides.css",
      "type": "registry:file",
      "target": "components/klarhimmel/blocks/testimonials-carousel/slides.css",
      "content": "/* The checked radio picks the slide and its arrows; no script (KB-364). Up to six slides (the schema's max). */\n.kh-carousel [data-kh-slide-part] { display: none; }\n.kh-carousel:has(input[data-kh-slide=\"0\"]:checked) [data-kh-slide-part=\"0\"] { display: block; }\n.kh-carousel:has(input[data-kh-slide=\"1\"]:checked) [data-kh-slide-part=\"1\"] { display: block; }\n.kh-carousel:has(input[data-kh-slide=\"2\"]:checked) [data-kh-slide-part=\"2\"] { display: block; }\n.kh-carousel:has(input[data-kh-slide=\"3\"]:checked) [data-kh-slide-part=\"3\"] { display: block; }\n.kh-carousel:has(input[data-kh-slide=\"4\"]:checked) [data-kh-slide-part=\"4\"] { display: block; }\n.kh-carousel:has(input[data-kh-slide=\"5\"]:checked) [data-kh-slide-part=\"5\"] { display: block; }\n.kh-carousel:has(input[data-kh-slide]:focus-visible) [role='group'][aria-roledescription='carousel'] { outline: 2px solid var(--kh-focus); outline-offset: 4px; }\n.kh-carousel:has(input[data-kh-slide=\"0\"]:checked) [data-kh-tab=\"0\"] { background: var(--kh-accent-fill); border-color: var(--kh-accent-fill); color: var(--kh-accent-fg); }\n.kh-carousel:has(input[data-kh-slide=\"1\"]:checked) [data-kh-tab=\"1\"] { background: var(--kh-accent-fill); border-color: var(--kh-accent-fill); color: var(--kh-accent-fg); }\n.kh-carousel:has(input[data-kh-slide=\"2\"]:checked) [data-kh-tab=\"2\"] { background: var(--kh-accent-fill); border-color: var(--kh-accent-fill); color: var(--kh-accent-fg); }\n.kh-carousel:has(input[data-kh-slide=\"3\"]:checked) [data-kh-tab=\"3\"] { background: var(--kh-accent-fill); border-color: var(--kh-accent-fill); color: var(--kh-accent-fg); }\n.kh-carousel:has(input[data-kh-slide=\"4\"]:checked) [data-kh-tab=\"4\"] { background: var(--kh-accent-fill); border-color: var(--kh-accent-fill); color: var(--kh-accent-fg); }\n.kh-carousel:has(input[data-kh-slide=\"5\"]:checked) [data-kh-tab=\"5\"] { background: var(--kh-accent-fill); border-color: var(--kh-accent-fill); color: var(--kh-accent-fg); }\n"
    }
  ]
}
