{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "testimonials-spotlight",
  "title": "Testimonials spotlight",
  "description": "One customer’s quote at a time, in large type, with the others as faces to pick from; the room the quote takes follows on the layout role.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/controllable.json",
    "https://kinoui.com/r/resize.json",
    "https://kinoui.com/r/section-heading.json",
    "https://kinoui.com/r/tabs.json",
    "https://kinoui.com/r/testimonial-parts.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/testimonials-spotlight/testimonials-spotlight.tsx",
      "content": "'use client'\n\nimport { Tabs, TabsPanel, TabsList, TabsTab } from '@/registry/components/kino/tabs'\nimport { useControllable } from '@/registry/lib/controllable'\nimport { followHeight } from '@/registry/lib/resize'\nimport { SectionHeading } from '@/registry/lib/section-heading'\nimport {\n  NewTabNote,\n  roleLine,\n  sourceLinkProps,\n  type Testimonial,\n  TestimonialAvatar,\n  testimonialsColumnClassName,\n  type TestimonialsSectionProps,\n  testimonialsSectionClassName,\n} from '@/registry/lib/testimonial-parts'\nimport { useEffect, useId, useRef } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * One customer at a time, in their own words, large, with the others as a\n * row of faces under them. Picking a face slides the pill to it and brings\n * their quote in where the last one stood; the room the quote takes follows\n * on `layout`, so the faces glide to their new place rather than jump.\n * Nothing changes until a visitor picks: there is no timer to race.\n *\n *   <TestimonialsSpotlight\n *     title='Teams plan their week in Kino'\n *     testimonials={[{ value: 'mei', quote: '…', name: 'Mei Lin', role: 'Head of Product', company: 'Tessel' }]}\n *   />\n */\n\ninterface TestimonialsSpotlightProps extends TestimonialsSectionProps {\n  /** The quote in the spotlight, by its `value`. */\n  value?: string\n  /** The quote in the spotlight at first: the first, unless you give another. */\n  defaultValue?: string\n  onValueChange?: (value: string) => void\n}\n\nfunction TestimonialsSpotlight({\n  title,\n  description,\n  eyebrow,\n  heading = 'h2',\n  testimonials,\n  value: valueProp,\n  defaultValue,\n  onValueChange,\n  className,\n  ...props\n}: TestimonialsSpotlightProps) {\n  const titleId = useId()\n  const [picked, setPicked] = useControllable(\n    valueProp,\n    defaultValue ?? testimonials[0]?.value ?? '',\n    onValueChange,\n  )\n  const frameRef = useRef<HTMLDivElement>(null)\n  const innerRef = useRef<HTMLDivElement>(null)\n  useEffect(() => {\n    const frame = frameRef.current\n    const inner = innerRef.current\n    if (!frame || !inner) return\n    return followHeight(frame, inner)\n  }, [])\n\n  return (\n    <section\n      data-slot='testimonials-spotlight'\n      aria-labelledby={titleId}\n      className={cn(testimonialsSectionClassName, className)}\n      {...props}\n    >\n      <div\n        className={cn(testimonialsColumnClassName, 'flex flex-col items-center gap-12')}\n      >\n        <SectionHeading\n          id={titleId}\n          eyebrow={eyebrow}\n          title={title}\n          description={description}\n          heading={heading}\n        />\n        {testimonials.length > 1 ? (\n          <Tabs\n            value={picked}\n            onValueChange={(next) => setPicked(String(next))}\n            className='flex w-full max-w-4xl min-w-0 flex-col items-center gap-10'\n          >\n            {/* The faces first, so Tab goes on from the one picked to its quote. */}\n            <TabsList aria-label='Customers' className='self-center'>\n              {testimonials.map((testimonial) => (\n                <TabsTab key={testimonial.value} value={testimonial.value}>\n                  <TestimonialAvatar testimonial={testimonial} size='xs' />\n                  <bdi>{firstName(testimonial.name)}</bdi>\n                  <span className='sr-only'>{restOfName(testimonial.name)}</span>\n                </TabsTab>\n              ))}\n            </TabsList>\n            {/* Clipped down the page only, with room above and below for a panel's focus ring. */}\n            <div\n              ref={frameRef}\n              className='-my-1 w-full min-w-0 overflow-y-clip py-1 transition-[height] duration-(--motion-layout-duration) ease-(--motion-layout-easing) motion-reduce:transition-none'\n            >\n              <div ref={innerRef} className='flex min-w-0 flex-col'>\n                {testimonials.map((testimonial) => (\n                  <TabsPanel\n                    key={testimonial.value}\n                    value={testimonial.value}\n                    className='focus-visible:ring-inset'\n                  >\n                    <SpotlightQuote testimonial={testimonial} />\n                  </TabsPanel>\n                ))}\n              </div>\n            </div>\n          </Tabs>\n        ) : testimonials[0] ? (\n          <div className='w-full max-w-4xl min-w-0'>\n            <SpotlightQuote testimonial={testimonials[0]} />\n          </div>\n        ) : null}\n      </div>\n    </section>\n  )\n}\n\n/** A quote, large, with who said it, their job and where they said it under it. */\nfunction SpotlightQuote({ testimonial }: { testimonial: Testimonial }) {\n  const { source } = testimonial\n  const line = roleLine(testimonial)\n  return (\n    <figure className='flex min-w-0 flex-col items-center gap-6 p-2 text-center'>\n      <blockquote\n        dir='auto'\n        className='text-foreground text-2xl/snug font-medium tracking-tight text-balance @3xl/testimonials:text-3xl/snug'\n      >\n        <span aria-hidden>“</span>\n        {testimonial.quote}\n        <span aria-hidden>”</span>\n      </blockquote>\n      <figcaption className='flex flex-col items-center gap-1 text-sm text-pretty'>\n        <span>\n          <bdi className='font-medium'>{testimonial.name}</bdi>\n          {line ? (\n            <>\n              <span className='sr-only'>, </span>\n              <bdi className='text-muted-foreground ms-2'>{line}</bdi>\n            </>\n          ) : null}\n        </span>\n        {source ? (\n          <a\n            href={source.href}\n            {...sourceLinkProps(source)}\n            className=\"text-muted-foreground hover:text-foreground focus-visible:ring-ring/50 mt-2 -mx-1.5 inline-flex min-h-6 items-center gap-2 rounded-(--control-radius-xs) px-1.5 transition-[color,box-shadow] duration-(--motion-press-duration) ease-(--motion-press-fade-easing) focus-visible:ring-3 focus-visible:outline-hidden [&_svg:not([class*='size-'])]:size-4\"\n          >\n            {source.icon}\n            <span className='sr-only'>\n              <bdi>{testimonial.name}</bdi>,{' '}\n            </span>\n            <bdi>{source.label}</bdi>\n            <NewTabNote source={source} />\n          </a>\n        ) : null}\n      </figcaption>\n    </figure>\n  )\n}\n\n/** The first word of a name, for its face's tab: Mei. */\nfunction firstName(name: string) {\n  return name.split(' ')[0] ?? name\n}\n\n/** The rest of the name, read after the first by a screen reader, so the tab's name is whole. */\nfunction restOfName(name: string) {\n  const rest = name.split(' ').slice(1).join(' ')\n  return rest ? ` ${rest}` : ''\n}\n\nexport { TestimonialsSpotlight, type TestimonialsSpotlightProps }\n",
      "type": "registry:component",
      "target": "@components/kino/testimonials-spotlight/testimonials-spotlight.tsx"
    }
  ],
  "type": "registry:block"
}