{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "features",
  "title": "Features",
  "description": "A landing page’s features as tiles, wide and narrow in turn, each with the product doing it above its words, every row full whatever the count.",
  "dependencies": [],
  "registryDependencies": [
    "https://kinoui.com/r/animated-number.json",
    "https://kinoui.com/r/avatar.json",
    "https://kinoui.com/r/badge.json",
    "https://kinoui.com/r/button.json",
    "https://kinoui.com/r/card.json",
    "https://kinoui.com/r/command.json",
    "https://kinoui.com/r/feature-parts.json",
    "https://kinoui.com/r/meter.json",
    "https://kinoui.com/r/scene.json",
    "https://kinoui.com/r/section-heading.json",
    "https://kinoui.com/r/sparkline.json",
    "https://kinoui.com/r/swap.json",
    "https://kinoui.com/r/text-shimmer.json"
  ],
  "files": [
    {
      "path": "registry/components/kino/features/features.tsx",
      "content": "'use client'\n\nimport { Card, CardContent, CardSection } from '@/registry/components/kino/card'\nimport {\n  type Feature,\n  type FeatureHeading,\n  FeatureIcon,\n  featuresColumnClassName,\n  featuresSectionClassName,\n  FeatureStage,\n  FeatureWords,\n} from '@/registry/lib/feature-parts'\nimport {\n  HEADING_BELOW,\n  SectionHeading,\n  type SectionHeadingLevel,\n} from '@/registry/lib/section-heading'\nimport { type ComponentProps, type ReactNode, useId } from 'react'\n\nimport { cn } from '@/lib/utils'\n\n/*\n * A landing page's features as a grid of tiles, each with the product doing\n * it above its words. The tiles take turns at a wide slot, so the grid\n * reads as a whole rather than a list, and every row is full whatever the\n * count. In a phone's column the tiles stack, in the order given.\n *\n *   <Features\n *     title='Plan less. Ship more.'\n *     features={[{ value: 'cycles', title: 'Cycles that size themselves', description: '…', picture: <CyclePicture /> }]}\n *   />\n */\n\ninterface FeaturesProps extends Omit<ComponentProps<'section'>, 'title' | 'children'> {\n  /** Most important first: the first takes the first wide slot. */\n  features: Feature[]\n  title: ReactNode\n  /** A few words above the title that name the topic. */\n  eyebrow?: ReactNode\n  description?: ReactNode\n  /** Under the heading: a link to more, for the whole section. */\n  actions?: ReactNode\n  /** The title's level: `h2` under the page's `h1`. */\n  heading?: SectionHeadingLevel\n}\n\nfunction Features({\n  features,\n  title,\n  eyebrow,\n  description,\n  actions,\n  heading = 'h2',\n  className,\n  ...props\n}: FeaturesProps) {\n  const titleId = useId()\n  const spans = bentoSpans(features.length)\n  return (\n    <section\n      data-slot='features'\n      aria-labelledby={titleId}\n      className={cn(featuresSectionClassName, className)}\n      {...props}\n    >\n      <div className={featuresColumnClassName}>\n        <SectionHeading\n          id={titleId}\n          eyebrow={eyebrow}\n          title={title}\n          description={description}\n          heading={heading}\n        >\n          {actions ? (\n            <div className='mt-3 flex flex-wrap items-center justify-center gap-3'>\n              {actions}\n            </div>\n          ) : null}\n        </SectionHeading>\n        <ul\n          data-slot='features-grid'\n          className='grid min-w-0 grid-cols-1 gap-4 @2xl/features:grid-cols-2 @4xl/features:grid-cols-6'\n        >\n          {features.map((feature, index) => (\n            <FeatureTile\n              key={feature.value}\n              feature={feature}\n              heading={HEADING_BELOW[heading]}\n              className={cn(\n                SPAN_CLASSES[spans[index] ?? 2],\n                // Two to a row before there is room for the grid: an odd last one takes the row.\n                features.length % 2 === 1 &&\n                  index === features.length - 1 &&\n                  '@2xl/features:col-span-2',\n              )}\n            />\n          ))}\n        </ul>\n      </div>\n    </section>\n  )\n}\n\n/** A tile: the picture to the edges, the words under it. */\nfunction FeatureTile({\n  feature,\n  heading,\n  className,\n}: {\n  feature: Feature\n  heading: FeatureHeading\n  className?: string\n}) {\n  return (\n    <Card\n      render={<li />}\n      data-slot='features-tile'\n      className={cn('@container/tile min-w-0 overflow-hidden', className)}\n    >\n      {feature.picture ? (\n        <CardSection className='border-b'>\n          <FeatureStage className='h-64'>{feature.picture}</FeatureStage>\n        </CardSection>\n      ) : null}\n      <CardContent className='flex flex-col gap-4'>\n        {feature.picture || !feature.icon ? null : (\n          <FeatureIcon>{feature.icon}</FeatureIcon>\n        )}\n        <FeatureWords feature={feature} heading={heading} />\n      </CardContent>\n    </Card>\n  )\n}\n\n/**\n * Each tile's share of a six-column row, in order, so every row is full: a\n * wide tile and a narrow one, turn about, and three alike where the count\n * is odd, second, so the first tile always leads wide.\n */\nfunction bentoSpans(count: number): number[] {\n  if (count <= 0) return []\n  if (count === 1) return [6]\n  if (count === 3) return [2, 2, 2]\n  const pairs = Math.floor(count / 2) - (count % 2 === 1 ? 1 : 0)\n  const rows: number[][] = []\n  for (let pair = 0; pair < pairs; pair += 1) {\n    rows.push(pair % 2 === 0 ? [4, 2] : [2, 4])\n    // An odd count takes its row of three after the first pair.\n    if (pair === 0 && count % 2 === 1) rows.push([2, 2, 2])\n  }\n  return rows.flat()\n}\n\n/** A tile's span in the six columns, written out so the classes are in the stylesheet. */\nconst SPAN_CLASSES: Record<number, string> = {\n  2: '@4xl/features:col-span-2',\n  4: '@4xl/features:col-span-4',\n  6: '@4xl/features:col-span-6',\n}\n\nexport { bentoSpans, Features, type FeaturesProps }\n",
      "type": "registry:component",
      "target": "@components/kino/features/features.tsx"
    }
  ],
  "type": "registry:block"
}