import type { ReactElement, ReactNode } from 'react'; /** * Canonical field TYPE. When set (and no explicit `value` is supplied), the * kit renders the field's canonical chip from the shared `` * registry instead of plain text — so the SAME field type looks the same on * every surface. Each chip is a high-contrast neutral pill with a glyph: * * - `sex` → Venus / Mars / User glyph + localised label * - `age` → hourglass glyph + localised, pluralised age * - `dob` → calendar glyph + locale-formatted date * - `fiscalCode` → hash glyph + monospace code (already mono — no `mono` flag * needed; copy + PHI lock stay the row-level affordance via * `copyable` / `sensitive`) * - `discount` → `TransactionChip` `state="discount"` (the canonical monetary * discount chip — magnitude + `currency`, sign owned by the chip) * - `email` → a `mailto:` `Link` (the address is both display + target) * - `phone` → a `tel:` `Link` (formatted display, target normalised to * `+` and digits) * * The raw datum is read from `editValue` (the same scalar that seeds the * editor): a number for `age` / `discount`, an ISO string or `Date` for `dob`, * a code string for `sex`, the code string for `fiscalCode`. For the contact * link kinds the DISPLAY string is read from `value` (or `editValue`) and the * href is derived from it — so a plain-string `value` still becomes a link. * For every OTHER kind an explicit `value` ALWAYS wins, so a consumer can still * override per placement. */ export type PatientFieldKind = 'sex' | 'age' | 'dob' | 'fiscalCode' | 'discount' | 'email' | 'phone'; /** Editor control rendered when a field enters inline-edit mode. */ export type PatientFieldEditType = 'text' | 'textarea' | 'select' | 'boolean' | 'date' | 'number' | 'email' | 'phone' | 'fiscalCode' | 'province' | 'country' | 'postalCode' | 'city'; /** A choice for an `editType: 'select'` field. */ export interface PatientFieldOption { value: string; label: string; } /** * Raw value seeded into an editor. The kit never inspects this beyond * handing it to the matching control and back through a save callback. */ export type PatientFieldEditValue = string | number | boolean | Date | null | undefined; /** One label→value patient field. */ export interface PatientField { /** * Stable field key — drives visibility, ordering, the `data-field-id` * hook, and agent addressing. MUST NOT be the value (no PHI in keys). */ id: string; /** Display label (already localised by the consumer, or a kit label). */ label: string; /** * Display node — formatted by the consumer (Badge / Tag / Link / text). * Optional: omit it and set `kind` to let the kit render the field's * canonical chip from `editValue`. When present, `value` ALWAYS wins. */ value?: ReactNode; /** * Canonical field type — when set and `value` is omitted, the kit renders * the matching canonical chip from the shared registry. Presentation only; * NEVER emitted into any `data-*` attribute (same rule as `sensitive`). */ kind?: PatientFieldKind; /** Leading icon (a single lucide element). */ icon?: ReactElement | null; /** Render the copy-to-clipboard affordance (fiscal code, ids). */ copyable?: boolean; /** Text written to the clipboard when `copyable`. */ copyText?: string; /** Render the value monospaced (codes, ids). */ mono?: boolean; /** * High-sensitivity PHI marker — renders a lock glyph next to the label. * Presentation only; NEVER emitted into any `data-*` attribute. */ sensitive?: boolean; /** Whether this field can be inline-edited (consumer gates by permission). */ editable?: boolean; /** Control used in edit mode. Defaults to `'text'`. */ editType?: PatientFieldEditType; /** Options for `editType: 'select'`. */ options?: PatientFieldOption[]; /** Value seeded into the editor when editing begins. */ editValue?: PatientFieldEditValue; /** Currency code for `editType: 'number'` (renders a currency input). */ currency?: string; } /** A labelled, collapsible group of fields. */ export interface PatientFieldSection { /** Stable section key. */ id: string; /** Section heading. */ heading: string; fields: PatientField[]; /** Wrap the section in a Collapsible (default `true`). Honoured by PatientDetails. */ collapsible?: boolean; /** Initial open state when `collapsible` (default `true`). */ defaultOpen?: boolean; } /** The flat declaration-order list of every field id — the "show everything" default. */ export declare function patientFieldCatalogue(sections: PatientFieldSection[]): string[]; /** A section paired with its currently-visible fields, in the chosen order. */ export interface ResolvedPatientSection { section: PatientFieldSection; fields: PatientField[]; } /** * Project `sections` to the visible fields per section, ordered by * `visibleFieldOrder`. This is the single piece of visibility logic shared * by every patient surface, so the card and the details panel always agree * on what is shown and in what order. * * `visibleFieldOrder` omitted (`undefined`) ⇒ every field visible in * declaration order ("show everything by default", design doc D3). An explicit * empty array `[]` ⇒ NO fields visible — a surface that starts collapsed and * reveals fields via the customize-fields cog. Unknown ids are ignored. * Sections stay in declaration order; only intra-section field order follows * `visibleFieldOrder`. */ export declare function resolveVisibleFields(sections: PatientFieldSection[], visibleFieldOrder?: string[]): ResolvedPatientSection[]; //# sourceMappingURL=patient-fields.d.ts.map