{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "logo-cloud-parts",
  "title": "Logo cloud parts",
  "description": "What the Logo cloud blocks share: a customer’s logo drawn in the text colour at a size that gives every logo the same area, a link to the customer’s story, the line over the logos and the section they stand in.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/hero-parts.json",
    "https://kinoui.com/r/section-heading.json",
    "https://kinoui.com/r/theme.json"
  ],
  "files": [
    {
      "path": "registry/lib/logo-cloud-parts.tsx",
      "content": "'use client'\n\nimport { IconPlaceholder } from '@/registry/icons/icon-placeholder'\nimport { pageColumnClassName } from '@/registry/lib/hero-parts'\nimport type { SectionHeadingLevel } from '@/registry/lib/section-heading'\nimport type { ComponentProps, CSSProperties, ReactNode } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * What the Logo cloud blocks share: a customer's logo, drawn in the text\n * colour at a size that gives every logo the same area, the line over the\n * logos, and the section they stand in.\n */\n\n/** A customer's logo: a picture of it, and its size, so it takes its room before it loads. */\ninterface CustomerLogo {\n  /** The company's name, read out in place of the logo. */\n  name: string\n  /**\n   * An SVG or a PNG with a clear background. Its shape is drawn in the text\n   * colour, as a CSS mask, so a picture on another site must be served with\n   * CORS (`Access-Control-Allow-Origin`), or it draws nothing.\n   */\n  src: string\n  /** The picture's width and height in any unit: only their ratio is used. */\n  width: number\n  height: number\n  /** Where their story is told, such as a case study: the logo leads there. */\n  href?: string\n}\n\n/** What every Logo cloud block takes. */\ninterface LogoCloudProps extends Omit<ComponentProps<'section'>, 'title' | 'children'> {\n  /** The line over the logos, such as Trusted by the teams behind… */\n  title: ReactNode\n  /** The title's level: `h2` under the page's `h1`. */\n  heading?: SectionHeadingLevel\n  logos: CustomerLogo[]\n}\n\n/** The section every arrangement stands in, laid out by its own width. */\nconst logoCloudSectionClassName =\n  '@container/logo-cloud relative isolate flex w-full min-w-0 flex-col overflow-x-clip bg-background'\n\n/** The column the line and the logos sit in, with a strip's room above and below. */\nconst logoCloudColumnClassName = cn(pageColumnClassName, 'py-12 @3xl:py-16')\n\n/**\n * How wide a logo is beside a square one of the same area, from its width\n * and height: the square root of its ratio. A logo four times as wide as it\n * is tall is twice as wide as the square and half as tall, so long wordmarks\n * and compact marks read at the same weight.\n */\nfunction logoScale({ width, height }: Pick<CustomerLogo, 'width' | 'height'>) {\n  if (!(width > 0) || !(height > 0)) return 1\n  return Math.sqrt(width / height)\n}\n\n/**\n * A logo, drawn in the text colour through its picture's shape, so it\n * follows the theme and the hover colour around it. Its area is the square\n * of `--logo-cloud-size` (2.5rem on a phone to 3.25rem on a page, unless set on it or anything above it),\n * and it never grows wider than its box.\n */\nfunction LogoCloudLogo({ logo, className }: { logo: CustomerLogo; className?: string }) {\n  return (\n    <span\n      role='img'\n      aria-label={logo.name}\n      data-slot='logo-cloud-logo'\n      style={\n        {\n          '--logo-cloud-src': `url(${JSON.stringify(logo.src)})`,\n          aspectRatio: `${logo.width} / ${logo.height}`,\n          width: `calc(var(--logo-cloud-size,clamp(2.5rem,7cqi,3.25rem))*${logoScale(logo).toFixed(4)})`,\n        } as CSSProperties\n      }\n      className={cn(\n        // The shape of the picture, filled with the text colour; forced colours take the text's system colour.\n        'block max-w-full shrink-0 bg-current [mask:var(--logo-cloud-src)_center/contain_no-repeat] forced-colors:bg-[CanvasText]',\n        className,\n      )}\n    />\n  )\n}\n\n/** The line over the logos: small and quiet, as the logos are the proof. */\nfunction LogoCloudTitle({\n  id,\n  title,\n  heading = 'h2',\n  className,\n}: {\n  id: string\n  title: ReactNode\n  heading?: SectionHeadingLevel\n  className?: string\n}) {\n  const Title = heading\n  return (\n    <Title\n      id={id}\n      className={cn(\n        'text-muted-foreground text-center text-sm font-medium text-balance',\n        className,\n      )}\n    >\n      <bdi>{title}</bdi>\n    </Title>\n  )\n}\n\n/** A logo that leads to its customer's story: the whole box is the link, named \"Tessel: read their story\". */\nfunction LogoCloudLink({\n  logo,\n  className,\n  children,\n}: {\n  logo: CustomerLogo & { href: string }\n  className?: string\n  children: ReactNode\n}) {\n  return (\n    <a\n      href={logo.href}\n      // The logo inside is its picture; the link says where it leads.\n      aria-label={`${logo.name}: read their story`}\n      data-slot='logo-cloud-link'\n      className={cn(\n        'group/logo relative focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-hidden',\n        className,\n      )}\n    >\n      {children}\n    </a>\n  )\n}\n\n/**\n * The arrow at a linked box's top end, that says it leads to a story before\n * a pointer finds it, and nudges out while the link is hovered.\n */\nfunction LogoCloudStoryArrow() {\n  return (\n    <IconPlaceholder\n      lucide='ArrowUpRightIcon'\n      tabler='IconArrowUpRight'\n      hugeicons='ArrowUpRight01Icon'\n      phosphor='ArrowUpRightIcon'\n      remixicon='RiArrowRightUpLine'\n      aria-hidden\n      className='text-muted-foreground group-hover/logo:text-foreground absolute end-3 top-3 size-4 transition-[color,translate] duration-(--motion-press-duration) ease-[var(--motion-press-fade-easing),var(--motion-press-easing)] group-hover/logo:translate-x-0.5 group-hover/logo:-translate-y-0.5 motion-reduce:transition-[color] rtl:-scale-x-100 rtl:group-hover/logo:-translate-x-0.5'\n    />\n  )\n}\n\nexport {\n  type CustomerLogo,\n  logoCloudColumnClassName,\n  LogoCloudLink,\n  LogoCloudLogo,\n  LogoCloudStoryArrow,\n  type LogoCloudProps,\n  logoCloudSectionClassName,\n  LogoCloudTitle,\n  logoScale,\n}\n",
      "type": "registry:lib",
      "target": "@lib/logo-cloud-parts.tsx"
    }
  ],
  "type": "registry:lib"
}