RecordPeek
A record page in a peek: the view's record view, drawn inline in a sheet at the edge (`side-peek`) or a centered dialog (`center-peek`). ```tsx <RecordPeek view={brandRecordView} row={open} open={open !== null} onClose={() => setOpen(null)} mode="center-peek" /> ``` `<ResourceView>`, the board and the calendar open one by themselves when the view names its record view (`defineView(…, { recordView: (): AnyRecordView => brandRecordView })`).
packages/ui/src/components/data/resource-view/RecordPeek.tsx
@marktiderman/genesis-ui/dataimport { RecordPeek } from "@marktiderman/genesis-ui/data";react-docgen-typescript.RecordPeek
A record page in a peek: the view's record view, drawn inline in a sheet at the edge (`side-peek`) or a centered dialog (`center-peek`). ```tsx <RecordPeek view={brandRecordView} row={open} open={open !== null} onClose={() => setOpen(null)} mode="center-peek" /> ``` `<ResourceView>`, the board and the calendar open one by themselves when the view names its record view (`defineView(…, { recordView: (): AnyRecordView => brandRecordView })`).
| Prop | Type | Default | Description |
|---|---|---|---|
| onClose* | () => void | — | |
| open* | boolean | — | |
| row* | Row | null | — | The record, or null while none is open. |
| view* | RecordView<ResourceContract<any>, T & DataRow> | — | |
| can | ((action: string, row: T) => false | Allowed) | — | The screen's own rule for a header action. It only narrows the view's guards: `false` hides the action, a sentence refuses it with that reason. |
| confirmDelete | boolean | true | `false` when `onDelete` confirms on its own (ResourcePage's delete handler, which `recordPeekSlot` passes): the peek calls it at once. Default `true`, as NativeRecordPeek. |
| header | ReactNode | — | Above the record page, inside the peek (a link to the full page, say). |
| lists | Partial<Record<string, Partial<Omit<ResourceViewProps, "view" | "filter">>>> | — | More props for a list section's ResourceView, by section id. |
| mode | enum | side-peek | `side-peek` (default) or `center-peek`. A full `page` is the app's route, not a peek. |
| onAction | ((name: string, row: T) => unknown) | — | Runs a header action once allowed (and confirmed). Default: the provider's `runAction`. A rejection shows inline. |
| onDelete | ((row: T) => unknown) | — | Shows Delete. The peek confirms first, once, in the list's words (the recycle bin's when the provider bins deleted rows), so pass the write itself; the peek closes when it resolves, and a rejection shows in the dialog. NativeRecordPeek's `onDelete` means the same. |
| onEdit | ((row: T) => void) | — | Edit the record (the list's form, say): an Edit button among the header's actions. A peek opened from a list passes the list's own. |
| onSaved | ((row: T) => void) | — | After a settings section saved, with the stored row. |
| parent | ReactNode | — | The breadcrumb's parent link: one element, so the host's router renders it. |
| readinessLabels | ReadinessLabels | — | The readiness chip's words. |
| section | string | — | The section showing now: the route's segment. Default the first section. In a peek, the section it opens on; its tabs then switch in place. |
| sectionIcons | Partial<Record<string, LucideIcon>> | — | Each section's icon, by section id, for the shell's tabs and the phone's bottom bar (which otherwise shows the label's first letter). |
| settingsLocked | ((sectionId: string, row: T) => string | null) | — | Why a settings section is read-only for this viewer, when the screen knows more than the view's guards (a role the viewer lacks): the reason, or null. It only narrows: a section the view's update guard locks stays locked. |
| slots | Partial<Record<string, ReactNode>> | — | The screen's own sections, by id (sections with neither list nor settings). |
| switcher | ReactNode | — | In the header's leading area, before the title: a switcher between records. |
| testID | string | record-peek | |
| width | enum | md | A side peek's width. Default `md`. |
recordPeekSlot
A ResourcePage `detail` slot that opens the record view instead of the view's columns: the panel layout is a side peek, the modal one a center peek.
| Prop | Type | Default | Description |
|---|---|---|---|
| document* | Readonly<RecordViewDocument<string>> | — | The document template's fields (frozen); empty for `standard`. |
| hasReadiness* | boolean | — | |
| headerActions* | readonly string[] | — | The header's action names, in order. |
| headerFor* | (row: T & DataRow, options?: RecordViewHeaderOptions<T & DataRow> | undefined) => RecordViewHeader | — | |
| listFilter* | (sectionId: string, row: T & DataRow) => Readonly<Record<string, string | number | boolean | null>> | — | A list section's filter for this row. In development, a filter with no key, or a value that isn't a string, number, boolean or null, throws: it would show every child row. |
| readinessFor* | (row: T & DataRow) => readonly ResolvedReadinessItem[] | — | The readiness checks for this row, tones resolved; empty without `readiness`. |
| readinessSummary* | (row: T & DataRow) => Readiness | null | — | The checks in one chip's terms (genesis-core/resource's `readinessOf`): an unmet `danger` check is a problem, any other unmet check one to look at. `null` without `readiness`. Draw it with `readinessChip`. |
| recordId* | (row: T & DataRow) => Identifier | — | The record's address for the provider: its key fields (`keyFields`), composite keys encoded. |
| section* | (id: string) => ResolvedRecordViewSection | undefined | — | |
| sections* | readonly ResolvedRecordViewSection[] | — | |
| settingsFields* | (sectionId?: string | undefined) => readonly ResolvedFormField[] | — | Settings fields as the view's form resolves them (`view.form("edit")`), in the order listed: one section's, or every settings section's without an id. |
| settingsLocked* | (row: T & DataRow, viewer?: Viewer | undefined) => string | null | — | Why settings can't be saved for this row and viewer: the view's `can("update", row, viewer)` reason, or `null` when they can. Renderers then show the settings read-only with the reason. Without a viewer the guard gets no one, so one that needs the viewer locks them. |
| settingsPatch* | (sectionId: string, values: Readonly<Record<string, unknown>>) => Record<string, unknown> | — | Only the section's listed keys that `values` has: what a save sends. |
| template* | enum | — | The record page template: `standard` unless the definition says `document`. |
| view* | ResourceView<ResourceContract<any>, T & DataRow> | — |