{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "testimonial-parts",
  "title": "Testimonial parts",
  "description": "What the Testimonials blocks share: a customer’s quote with who said it and where, the card it sits on, and the section they stand in.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/avatar.json",
    "https://kinoui.com/r/card.json",
    "https://kinoui.com/r/hero-parts.json",
    "https://kinoui.com/r/section-heading.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/lib/testimonial-parts.tsx",
      "content": "'use client'\n\nimport {\n  Avatar,\n  AvatarFallback,\n  AvatarImage,\n  initials,\n} from '@/registry/components/kino/avatar'\nimport { Card, CardLink } from '@/registry/components/kino/card'\nimport { sectionColumnClassName } from '@/registry/lib/hero-parts'\nimport type { SectionHeadingLevel } from '@/registry/lib/section-heading'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * What the Testimonials blocks share: a customer's quote with who said it,\n * the card it sits on, and the section they stand in.\n */\n\n/** A customer's words, and who said them. */\ninterface Testimonial {\n  /** Tells the quotes apart. */\n  value: string\n  quote: ReactNode\n  name: string\n  /** Their job, such as Head of Product. */\n  role?: string\n  company?: string\n  /** The person's photo. Their initials show without one. */\n  photo?: string\n  /** Where they said it, such as a post on X or a case study: the card leads there. */\n  source?: TestimonialSource\n}\n\n/** Where a customer said it. */\ninterface TestimonialSource {\n  /** Where, read after their name: Posted on X, Read the case study. */\n  label: string\n  href: string\n  /** The place's mark, such as X's logo, in the text colour, or an icon for a page of your own. */\n  icon: ReactNode\n  /** Opens in a new tab, and says so to a screen reader: a post on another site. */\n  external?: boolean\n}\n\n/** What every Testimonials block takes. */\ninterface TestimonialsSectionProps extends Omit<\n  ComponentProps<'section'>,\n  'title' | 'children'\n> {\n  title: ReactNode\n  description?: ReactNode\n  /** A few words above the title that name the topic. */\n  eyebrow?: ReactNode\n  /** The title's level: `h2` under the page's `h1`. */\n  heading?: SectionHeadingLevel\n  testimonials: Testimonial[]\n}\n\n/** The section every arrangement stands in, laid out by its own width. */\nconst testimonialsSectionClassName =\n  '@container/testimonials relative isolate flex w-full min-w-0 flex-col overflow-x-clip bg-background'\n\nconst testimonialsColumnClassName = sectionColumnClassName\n\n/** Their job and company on one line: Head of Product, Tessel. */\nfunction roleLine({ role, company }: Pick<Testimonial, 'role' | 'company'>) {\n  return [role, company].filter(Boolean).join(', ')\n}\n\n/** Their photo, over their initials. Decorative: their name is always written beside it. */\nfunction TestimonialAvatar({\n  testimonial,\n  size,\n}: {\n  testimonial: Testimonial\n  size?: 'xs' | 'default'\n}) {\n  return (\n    <Avatar size={size}>\n      {testimonial.photo ? (\n        <AvatarImage src={testimonial.photo} alt='' draggable={false} />\n      ) : null}\n      <AvatarFallback aria-hidden>{initials(testimonial.name)}</AvatarFallback>\n    </Avatar>\n  )\n}\n\n/** A source link's target, and the word that says a new tab opens. */\nfunction sourceLinkProps(source: TestimonialSource) {\n  return source.external ? { target: '_blank', rel: 'noreferrer' } : {}\n}\n\n/** Read after a source link's words when it opens a new tab. */\nfunction NewTabNote({ source }: { source: TestimonialSource }) {\n  return source.external ? <span className='sr-only'> (opens in a new tab)</span> : null\n}\n\n/** Who said it: their photo, their name, and their job and company under it. */\nfunction TestimonialAuthor({ testimonial }: { testimonial: Testimonial }) {\n  const line = roleLine(testimonial)\n  return (\n    <div\n      data-slot='testimonial-author'\n      className='flex min-w-0 items-center gap-3 text-start'\n    >\n      <TestimonialAvatar testimonial={testimonial} />\n      <div className='flex min-w-0 flex-col'>\n        <span className='text-sm font-medium text-pretty'>\n          <bdi>{testimonial.name}</bdi>\n        </span>\n        {line ? (\n          <span className='text-muted-foreground text-sm text-pretty'>\n            <bdi>{line}</bdi>\n          </span>\n        ) : null}\n      </div>\n    </div>\n  )\n}\n\n/**\n * A quote on a card, with who said it under it. With a `source`, the whole\n * card leads to where they said it, and the place's mark stands at the\n * quote's top end, as a post's does; its name, \"Ben Hartley, posted on X\",\n * tells one card's link from the next.\n */\nfunction TestimonialCard({\n  testimonial,\n  className,\n  ...props\n}: { testimonial: Testimonial } & Omit<ComponentProps<'figure'>, 'children'>) {\n  const { source } = testimonial\n  return (\n    <Card\n      data-slot='testimonial-card'\n      render={<figure {...props} />}\n      className={cn('px-(--surface-padding)', className)}\n    >\n      {/* It takes the room a taller card beside it leaves, so the names in a row line up. */}\n      <div className='flex min-w-0 flex-1 items-start gap-4'>\n        <blockquote\n          dir='auto'\n          className='text-foreground min-w-0 flex-1 text-sm/6 text-pretty'\n        >\n          {testimonial.quote}\n        </blockquote>\n        {source ? (\n          // Centred on the quote's first line. Hovering the card is hovering its link, so the mark brightens.\n          <CardLink\n            href={source.href}\n            {...sourceLinkProps(source)}\n            className=\"text-muted-foreground hover:text-foreground mt-1 shrink-0 transition-colors duration-(--motion-press-duration) ease-(--motion-press-fade-easing) [&_svg:not([class*='size-'])]:size-4\"\n          >\n            {source.icon}\n            <span className='sr-only'>\n              <bdi>{testimonial.name}</bdi>, <bdi>{source.label}</bdi>\n            </span>\n            <NewTabNote source={source} />\n          </CardLink>\n        ) : null}\n      </div>\n      <figcaption className='min-w-0'>\n        <TestimonialAuthor testimonial={testimonial} />\n      </figcaption>\n    </Card>\n  )\n}\n\nexport {\n  roleLine,\n  NewTabNote,\n  sourceLinkProps,\n  type Testimonial,\n  TestimonialAuthor,\n  TestimonialAvatar,\n  TestimonialCard,\n  type TestimonialSource,\n  testimonialsColumnClassName,\n  type TestimonialsSectionProps,\n  testimonialsSectionClassName,\n}\n",
      "type": "registry:lib",
      "target": "@lib/testimonial-parts.tsx"
    }
  ],
  "type": "registry:lib"
}