{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "recap",
  "type": "registry:ui",
  "title": "Recap",
  "description": "What one person takes home from a session: what it covered, how they did, the one thing they picked for this week, what they asked to hear more about, and where to go next. Every section is optional and shows only when it has something in it, in the order…",
  "author": "ofri-peretz <https://github.com/ofri-peretz>",
  "categories": [
    "blog",
    "pattern"
  ],
  "dependencies": [
    "lucide-react"
  ],
  "registryDependencies": [
    "https://ds.interlace.tools/r/interlace-base.json",
    "https://ds.interlace.tools/r/cn.json"
  ],
  "files": [
    {
      "path": "registry/interlace-ui/patterns/recap.tsx",
      "target": "components/ui/patterns/recap.tsx",
      "type": "registry:ui",
      "content": "import * as React from 'react';\n\n// @interlace/recap v1.0.0 — Interlace design system.\n// Docs, props and live preview: https://ds.interlace.tools/c/recap\n// What changed since: https://ds.interlace.tools/c/recap#history\n// Generated banner — keep it, the upgrade diff reads this version.\n\n/**\n * @interlace/ui — Recap\n *\n * What one person takes home from a session: what it covered, how they did,\n * the one thing they picked for this week, what they asked to hear more\n * about, and where to go next. Every section is optional and shows only\n * when it has something in it, in the order a person reads a recap: what\n * happened, what it means for them, what to do now.\n *\n * Pair it with `patterns/recap-model` to put the per-person part in the\n * link itself (`encodeRecap` / `decodeRecap`), so a recap page needs no\n * account and stores nothing.\n *\n * ## Anatomy\n *\n *   Recap                          (article — data-slot=\"recap\")\n *     ├─ header                    (data-slot=\"recap-header\": title as h1|h2, meta line)\n *     ├─ section?                  (data-slot=\"recap-covered\": a checked list)\n *     ├─ section?                  (data-slot=\"recap-stats\": dl of label and value)\n *     ├─ section?                  (data-slot=\"recap-commitment\": the pick, as a quote)\n *     ├─ section?                  (data-slot=\"recap-interests\": a list of topics)\n *     ├─ section?                  (data-slot=\"recap-next\": links, each with a line)\n *     └─ footer?                   (data-slot=\"recap-footer\")\n *\n * ## Motion\n *\n * None. A recap is read, often later, often on a phone.\n *\n * ## MIN_VIEWPORT — 320\n *\n * Stats sit two to a row, four from 36rem of the recap's own width.\n *\n * | Rule | Concept                   | Where in this file                                   |\n * | ---- | ------------------------- | ---------------------------------------------------- |\n * | R4   | Extends native el         | `React.ComponentProps<'article'>`                    |\n * | R6   | data-slot per part        | recap-*                                              |\n * | R7   | cn + ...rest              | `cn(…, className)` + `{...props}`                    |\n * | R14  | Declares min viewport     | `data-min-viewport` + exported const                 |\n * | R26  | A11y                      | one heading per section, in order; real lists        |\n */\n\nimport { ArrowRight, Check } from 'lucide-react';\n\nimport { cn } from '@/lib/utils';\n\nexport const MIN_VIEWPORT = 320 as const;\n\ninterface RecapStat {\n  label: React.ReactNode;\n  value: React.ReactNode;\n}\n\ninterface RecapLink {\n  label: React.ReactNode;\n  href: string;\n  /** One line on what is there. */\n  description?: React.ReactNode;\n}\n\ninterface RecapLabels {\n  /** @default 'What we covered' */\n  covered?: string;\n  /** @default 'Your session' */\n  stats?: string;\n  /** @default 'Your one thing this week' */\n  commitment?: string;\n  /** @default 'You asked for more on' */\n  interests?: string;\n  /** @default 'Keep going' */\n  next?: string;\n}\n\ntype RecapProps = Omit<React.ComponentProps<'article'>, 'children' | 'title'> & {\n  title: React.ReactNode;\n  /** Under the title: the date, the place, who ran it. */\n  meta?: React.ReactNode;\n  covered?: readonly React.ReactNode[];\n  stats?: readonly RecapStat[];\n  commitment?: React.ReactNode;\n  interests?: readonly React.ReactNode[];\n  next?: readonly RecapLink[];\n  footer?: React.ReactNode;\n  /** The title's level; sections take the next one down. @default 'h1' */\n  titleAs?: 'h1' | 'h2';\n  labels?: RecapLabels;\n};\n\nfunction RecapSection({\n  slot,\n  title,\n  as: Heading,\n  children,\n}: {\n  slot: string;\n  title: string;\n  as: 'h2' | 'h3';\n  children: React.ReactNode;\n}) {\n  const id = React.useId();\n  return (\n    <section data-slot={slot} aria-labelledby={id} className=\"grid gap-3 border-t pt-6\">\n      <Heading id={id} className=\"text-muted-foreground text-sm font-semibold tracking-wide uppercase\">\n        {title}\n      </Heading>\n      {children}\n    </section>\n  );\n}\n\nfunction Recap({\n  title,\n  meta,\n  covered,\n  stats,\n  commitment,\n  interests,\n  next,\n  footer,\n  titleAs: Title = 'h1',\n  labels,\n  className,\n  ...props\n}: RecapProps) {\n  const section = Title === 'h1' ? 'h2' : 'h3';\n  return (\n    <article\n      data-slot=\"recap\"\n      data-min-viewport={String(MIN_VIEWPORT)}\n      className={cn('@container grid gap-6', className)}\n      {...props}\n    >\n      <header data-slot=\"recap-header\" className=\"grid gap-2\">\n        <Title className=\"font-heading text-h2 font-semibold text-balance\">{title}</Title>\n        {meta ? <p className=\"text-muted-foreground\">{meta}</p> : null}\n      </header>\n\n      {covered?.length ? (\n        <RecapSection slot=\"recap-covered\" title={labels?.covered ?? 'What we covered'} as={section}>\n          <ul className=\"grid gap-2\">\n            {covered.map((c, i) => (\n              <li key={i} className=\"flex items-start gap-3\">\n                <Check aria-hidden=\"true\" className=\"text-primary mt-1 size-4 shrink-0\" />\n                <span className=\"text-pretty\">{c}</span>\n              </li>\n            ))}\n          </ul>\n        </RecapSection>\n      ) : null}\n\n      {stats?.length ? (\n        <RecapSection slot=\"recap-stats\" title={labels?.stats ?? 'Your session'} as={section}>\n          <dl className=\"grid grid-cols-2 gap-4 @xl:grid-cols-4\">\n            {stats.map((s, i) => (\n              <div key={i} className=\"grid gap-1\">\n                <dt className=\"text-muted-foreground text-sm\">{s.label}</dt>\n                <dd className=\"font-heading text-2xl font-semibold tabular-nums\">{s.value}</dd>\n              </div>\n            ))}\n          </dl>\n        </RecapSection>\n      ) : null}\n\n      {commitment ? (\n        <RecapSection slot=\"recap-commitment\" title={labels?.commitment ?? 'Your one thing this week'} as={section}>\n          <p className=\"border-primary border-s-2 ps-4 text-lg font-medium text-pretty\">{commitment}</p>\n        </RecapSection>\n      ) : null}\n\n      {interests?.length ? (\n        <RecapSection slot=\"recap-interests\" title={labels?.interests ?? 'You asked for more on'} as={section}>\n          <ul className=\"flex flex-wrap gap-2\">\n            {interests.map((t, i) => (\n              <li key={i} className=\"bg-muted rounded-full px-3 py-1 text-sm\">\n                {t}\n              </li>\n            ))}\n          </ul>\n        </RecapSection>\n      ) : null}\n\n      {next?.length ? (\n        <RecapSection slot=\"recap-next\" title={labels?.next ?? 'Keep going'} as={section}>\n          <ul className=\"grid gap-3\">\n            {next.map((l, i) => (\n              <li key={i}>\n                <a\n                  href={l.href}\n                  className=\"group focus-visible:outline-ring grid gap-0.5 rounded-sm outline-offset-4 focus-visible:outline-2\"\n                >\n                  <span className=\"text-primary inline-flex items-center gap-1.5 font-medium underline-offset-4 group-hover:underline group-focus-visible:underline\">\n                    {l.label}\n                    <ArrowRight aria-hidden=\"true\" className=\"size-4 rtl:-scale-x-100\" />\n                  </span>\n                  {l.description ? <span className=\"text-muted-foreground text-sm\">{l.description}</span> : null}\n                </a>\n              </li>\n            ))}\n          </ul>\n        </RecapSection>\n      ) : null}\n\n      {footer ? (\n        <footer data-slot=\"recap-footer\" className=\"text-muted-foreground border-t pt-6 text-sm\">\n          {footer}\n        </footer>\n      ) : null}\n    </article>\n  );\n}\nRecap.displayName = 'Recap';\n\nexport { Recap };\nexport type { RecapProps, RecapStat, RecapLink, RecapLabels };\n"
    }
  ],
  "meta": {
    "tier": "pattern",
    "client": false,
    "minViewport": 320,
    "loading": false,
    "version": "1.0.0",
    "since": "2.0.0"
  },
  "docs": "## @interlace/recap\n\nInstalled to `components/ui/patterns/recap.tsx`.\n\n```tsx\nimport { /* … */ } from '@/components/ui/patterns/recap';\n```\n\nProps, a11y contract, live preview and source: https://ds.interlace.tools/c/recap\n\nRequires the `@interlace/interlace-base` CSS baseline (installed automatically as a registry dependency). For the Interlace look, also add `@interlace/theme`."
}
