/** Lifecycle state for a suggested-change review card. */ export type GuidanceCardState = "default" | "accepted" | "rejected" | "skipped"; export type GuidanceChange = { /** Stable identity; used for selection and accepted-state filtering. */ id: string; /** Eyebrow label for the change. */ label: string; /** Original value. Explicit `null` renders the empty placeholder. */ from?: string | null; /** Proposed value. When both values are omitted, no diff is rendered. */ to?: string | null; /** Optional supporting copy shown in the reason callout. */ reason?: string; }; export type GuidanceChangeTableColumn = { /** Row-data key this column reads. Must not be `id` (reserved for row identity). */ key: string; /** Used as both visible text and the accessible column heading. */ header: string; /** Minimum width in pixels so columns scroll instead of overlapping. */ minWidth?: number; }; /** Discriminator for typed table cell payloads. */ export type GuidanceChangeTableCellType = "text" | "diff" | "addition"; export type GuidanceChangeTableTextCell = { /** Selects plain-text rendering. */ type: "text"; /** Verbatim cell copy. */ value: string; }; export type GuidanceChangeTableDiffCell = { /** Selects {@link DiffValue} rendering. */ type: "diff"; /** Original value. Explicit `null` renders the empty placeholder. */ from?: string | null; /** Proposed value. Explicit `null` renders the removed-value treatment. */ to?: string | null; }; /** Highlighted addition copy (e.g. a newly suggested line item). */ export type GuidanceChangeTableAdditionCell = { /** Selects highlighted-addition rendering. */ type: "addition"; /** Copy rendered with suggested-change highlighting. */ value: string; }; /** * Cell value for a table row. A bare `string` is treated as plain text; typed * objects select {@link DiffValue} or highlighted {@link Text} rendering. */ export type GuidanceChangeTableCellValue = string | GuidanceChangeTableTextCell | GuidanceChangeTableDiffCell | GuidanceChangeTableAdditionCell; export type GuidanceChangeTableRow = { /** Stable row identity; used for selection and accepted-state filtering. */ id: string; } & Record; /** One labelled table group in a suggested-change section. */ export type GuidanceChangeTable = { /** Headline above this table, distinct from the section eyebrow. */ label: string; /** Column definitions in display order. */ columns: GuidanceChangeTableColumn[]; /** Rows whose keys correspond to the configured columns. */ data: GuidanceChangeTableRow[]; /** Optional supporting copy shown below the table. */ reason?: string; }; /** * Scalar-change section. In `default`, checkboxes show when the card has more * than one visible scalar change. */ export type GuidanceChangeSingleSection = { /** Selects scalar-change rendering. */ type: "single"; /** Scalar changes in display order. */ changes: GuidanceChange[]; }; /** Body section: one or more labeled line-item tables under a section eyebrow. */ export type GuidanceChangeTableSection = { /** Selects table-group rendering. */ type: "table"; /** Section eyebrow label shown above the table groups. */ label: string; /** Table groups in display order. */ changeTables: GuidanceChangeTable[]; }; /** Ordered body section — either single changes or table groups. */ export type GuidanceChangeSection = GuidanceChangeSingleSection | GuidanceChangeTableSection; export type GuidanceCardProps = { /** Card lifecycle state. Defaults to `default`. */ state?: GuidanceCardState; /** Shown beneath the default title and as the outcome disclosure subtitle. */ referenceLabel: string; /** Opens the reference in a new tab when set. */ referenceHref?: string; /** Scalar and table sections rendered in order below the header. */ changeSections: GuidanceChangeSection[]; /** * Filters the accepted state to applied scalar changes and table rows. Omit * to show every accepted change. */ appliedChangeIds?: string[]; /** Initial outcome disclosure state. Defaults to `false`. */ defaultExpanded?: boolean; /** Receives selected scalar-change and table-row ids from Accept. */ onApply?: (acceptedChangeIds: string[]) => void; /** Receives the current selection from Edit. */ onEdit?: (acceptedChangeIds: string[]) => void; /** Reject remains visible; omit to leave it inert. */ onDismiss?: () => void; className?: string; };