import "./reference_field.css"; import { type ReactNode } from "react"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import { type StyleProps } from "./style_props"; /** * A reference to another record, rendered as a field value. One act on the surface, the rest a layer in: * press the value → the facts, in a popover * Change / Clear → the link: point it elsewhere, or empty it * Edit → the record's own facts, as a draft committed by Save * Open → the referenced record's page (optional) */ export interface ReferenceFact { label: string; value: string; /** The key this fact saves under; without one it stays read-only in the draft. */ name?: string; multiline?: boolean; /** `text` (default) is a text input; `date` the kit's `DatePicker`, valued as ISO. */ type?: "text" | "date"; /** A verb about this value, at rest, never in the draft: an action acts on the record, and Save would * write the draft's pre-action values back over it. */ action?: ReactNode; /** This value's own pick-committing editor outside the draft; blur-committed would lose the edit to the * peek's dismissing outside press. */ control?: ReactNode; } export interface ReferenceFieldProps extends StyleProps { name: string; code?: string; facts: ReferenceFact[]; accessibilityLabel: string; /** Omit and the peek carries no Open. */ onOpen?: () => void; openLabel?: string; /** Unsets the reference so the call site's picker returns; the caller should focus it. */ onChange?: () => void; /** The same write as `onChange`, differing only in follow-through. Pass both or neither — **neither is * the read-only reference**. Whether empty is valid is the row's business. */ onClear?: () => void; /** Receives only the facts the reader stated, keyed by `name` — never a snapshot, so locks and * `before_update` see the real edit. A value typed back to itself is stated and travels. */ onSave?: (patch: Record) => void | Promise; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } export declare function ReferenceField(props: ReferenceFieldProps): React.JSX.Element;