{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "record-list",
  "title": "Record cards and pager",
  "description": "A card list of records built from their facts, and a cursor-based pager for moving between pages of results.",
  "dependencies": [
    "@registrystack/app-runtime@~0.43.0-next.0",
    "lucide-react@1.43.0"
  ],
  "registryDependencies": [
    "@registrystack/field-renderers",
    "@registrystack/record-summary",
    "@registrystack/lib-content",
    "@registrystack/ui-button"
  ],
  "files": [
    {
      "path": "record/record-list.tsx",
      "content": "import { ArrowRight, FileText } from \"lucide-react\";\nimport type { EntityModel, RecordView } from \"@registrystack/app-runtime\";\nimport { Button } from \"@/components/ui/button\";\nimport { useBlockContent } from \"@/blocks/lib/content\";\nimport { InPhrase } from \"@/blocks/fields/values\";\nimport { RecordFacts } from \"@/blocks/record/record-summary\";\n\n/**\n * A record list as cards: one card per record, its title and a compact\n * summary of the fields the app chooses to show beneath it. `titleOf` and\n * `recordHref` come from the app: what names a record and the route it opens\n * on are the app's business, not a block's.\n */\nexport function RecordCards({\n  entity,\n  records,\n  fields,\n  titleOf,\n  recordHref,\n}: {\n  entity: EntityModel;\n  records: readonly RecordView[];\n  /** The fields shown beneath the title, in order. */\n  fields: readonly string[];\n  titleOf: (record: RecordView) => string;\n  recordHref: (record: RecordView) => string;\n}) {\n  const c = useBlockContent();\n  return (\n    <div className=\"record-cards\">\n      {records.map((record) => (\n        <a className=\"record-card\" href={recordHref(record)} key={record.id}>\n          <div className=\"record-card-top\">\n            <span className=\"record-icon\">\n              <FileText size={21} />\n            </span>\n          </div>\n          <p className=\"eyebrow\">{entity.label}</p>\n          <h2>{titleOf(record)}</h2>\n          <InPhrase>\n            <RecordFacts\n              entity={entity}\n              record={record}\n              fields={fields}\n              compact\n            />\n          </InPhrase>\n          <span className=\"text-link card-link\">\n            {c.viewRecord}\n            <ArrowRight size={17} />\n          </span>\n        </a>\n      ))}\n    </div>\n  );\n}\n\n/**\n * A cursor pager: Previous steps back through the pages visited, Next moves\n * on with the cursor the last page carried. There is no total, so the count\n * shown is how many pages this session has turned, not a position in one.\n */\nexport function RecordPager({\n  nextCursor,\n  pageCount,\n  onPrevious,\n  onNext,\n}: {\n  nextCursor?: string | null;\n  /** Pages visited so far, including this one; Previous disables at 1. */\n  pageCount: number;\n  onPrevious: () => void;\n  onNext: (cursor: string) => void;\n}) {\n  const c = useBlockContent();\n  return (\n    <div className=\"pager\">\n      <span>\n        {c.page} {pageCount}\n      </span>\n      <div className=\"actions\">\n        <Button\n          variant=\"outline\"\n          disabled={pageCount === 1}\n          onClick={onPrevious}\n        >\n          {c.previous}\n        </Button>\n        <Button\n          variant=\"outline\"\n          disabled={!nextCursor}\n          onClick={() => nextCursor && onNext(nextCursor)}\n        >\n          {c.next}\n        </Button>\n      </div>\n    </div>\n  );\n}\n",
      "type": "registry:block",
      "target": "@components/record/record-list.tsx"
    }
  ],
  "type": "registry:block"
}