import "./charge_lines.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"; export interface ChargeLineProps extends StyleProps { /** What is being charged. */ label: string; /** A neutral qualifier under the label — a basis, a period. Never a problem: * a problem belongs on the control that can fix it. */ meta?: string; /** Priced line: `quantity × unitPrice` derives the amount, and the amount is * never typed. Leave BOTH out for a flat line whose amount IS the figure * someone states — a fee agreed as one number rather than computed. */ quantity?: number | null; unitPrice?: number | null; /** Flat line: the amount itself. Ignored when `quantity`/`unitPrice` are set, * because a derived figure and a typed one cannot both be the truth. * `null` is a cost NOBODY HAS STATED — a supplier's exclusion, a line still * awaiting a figure — and renders as a dash, never as the band's zero: a * service printed at zero reads as free. Pass `0` for a price somebody * actually set to nothing. */ amount?: number | null; onAmountChange?: (next: number | null) => void | Promise; /** The same, for a FLAT line's amount. Unconditional and `disabled` when idle. */ amountActions?: ReactNode; /** One more control on this line — how it was paid, which party owes it. * It belongs to the charge, so it rides the charge's own row. */ extra?: ReactNode; /** A problem with THIS line, beside the control that fixes it. */ warning?: string; onQuantityChange?: (next: number | null) => void | Promise; onUnitPriceChange?: (next: number | null) => void | Promise; /** * A verb about the unit price — "apply the standard rate" — as an * `InlineButton`, which rides the field it acts on rather than standing on * its own beside it. * * **Pass it UNCONDITIONALLY and `disabled` it when there is nothing to act * on.** Passing it only when it has work makes the field narrower on the rows * that carry it, so a row with a one-tap rate and a row without stop sharing * a price column — and a verb that appears and disappears as a value changes * is furniture the reader cannot learn. */ unitPriceActions?: ReactNode; /** The row's own verb, usually removal. Rendered in a fixed slot so the money * column does not move between a row that has one and a row that does not. */ action?: ReactNode; /** Read-only band: editors become values, and NO verb is drawn — not the row's * action and not either money verb. A verb on a figure nobody can change is a * control with nothing behind it, and a disabled one that merely repeats the * value beside it prints the same number twice. */ locked?: boolean; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } export interface ChargeLinesProps extends StyleProps { /** The lines. Absent is a real state — a record that has not been priced yet * — so this is optional and `empty` speaks for it. */ children?: ReactNode; /** * The closing row's word, where the total answers a DIFFERENT question from * the one the section heading asked — "Payable", "Quoted", "Owed now". * * Omit it for the pack's "Total", which is the right answer whenever the * heading above already names what is being added up. A band under "Chi phí" * that closed with "Chi phí" said the word twice and neither time said what * the figure IS. */ totalLabel?: string; /** * WHAT THE SECTION ABOVE IS CALLED. Given, a `totalLabel` that only repeats * it is dropped for the pack's "Total" — the band cannot see the heading it * sits under, and an app that passes the section's own name (every generated * one did) is not choosing a word, it is filling a required prop. */ heading?: string; /** The band's total. Pass the sum of the lines on screen — a total that is * not the sum of something visible is the one figure a reader cannot check. */ total: number; /** * WHAT THE BAND IS PRICED IN — an ISO code, stated ONCE for every figure in * it: the lines, their editors and the total. * * It was a formatter the caller passed, and half this band's figures are typed * into a numeric field, which prints the figure it will READ BACK. A field * resting on a string its own parser rejects commits the wrong number, so the * notation cannot be a function the field cannot invert — it is the currency, * and the kit writes it the way it writes every other amount on the record. * Defaults to the kit's own (`formatMoney`). */ currency?: string; /** Sits in the closing row beside the total — the issue/collect action. */ action?: ReactNode; /** Shown in place of the lines when there are none. */ empty?: ReactNode; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } export declare function ChargeLines({ children, totalLabel, heading, total, currency, action, empty, testID, render, ref, ...props }: ChargeLinesProps): React.JSX.Element; export declare function ChargeLine({ label, meta, quantity, unitPrice, amount, onAmountChange, onQuantityChange, onUnitPriceChange, unitPriceActions, amountActions, extra, warning, action, locked, testID, render, ref, ...props }: ChargeLineProps): React.ReactElement>;