{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "record-summary",
  "title": "Record facts",
  "description": "A definition list of a record's field values, read through the field renderers.",
  "dependencies": [
    "@registrystack/app-runtime@~0.43.0-next.0"
  ],
  "registryDependencies": [
    "@registrystack/field-renderers"
  ],
  "files": [
    {
      "path": "record/record-summary.tsx",
      "content": "import type { ReactNode } from \"react\";\nimport type { EntityModel, RecordView } from \"@registrystack/app-runtime\";\nimport { FieldValue } from \"@/blocks/fields/field-value\";\n\nfunction Definition({\n  label,\n  children,\n}: {\n  label: string;\n  children: ReactNode;\n}) {\n  return (\n    <div className=\"definition\">\n      <dt>{label}</dt>\n      <dd>{children}</dd>\n    </div>\n  );\n}\n\n/** The named fields of a record, labelled from the model, in the order given. */\nexport function RecordFacts({\n  entity,\n  record,\n  fields,\n  compact = false,\n}: {\n  entity: EntityModel;\n  record: RecordView;\n  fields: readonly string[];\n  compact?: boolean;\n}) {\n  return (\n    <dl className={`facts ${compact ? \"facts-compact\" : \"\"}`}>\n      {fields.map((id) => {\n        const field = entity.fields.find((item) => item.id === id);\n        return (\n          field && (\n            <Definition key={id} label={field.label}>\n              <FieldValue field={field} value={record.values[id]} />\n            </Definition>\n          )\n        );\n      })}\n    </dl>\n  );\n}\n",
      "type": "registry:block",
      "target": "@components/record/record-summary.tsx"
    }
  ],
  "type": "registry:block"
}