import "./matrix.css"; import { type ReactNode } from "react"; import type * as React from "react"; import { useRender } from "@base-ui/react/use-render"; import type { ColorName } from "./color_tokens"; import { type MatrixAxisItem, type MatrixCellRef, type MatrixHeatScale } from "./matrix_totals"; import { type StyleProps } from "./style_props"; type Display = "number" | "heat" | "both"; export interface MatrixProps extends StyleProps { /** Pre-sorted by the consumer. */ rows: MatrixAxisItem[]; /** Few and fixed; they share the width. */ cols: MatrixAxisItem[]; /** Pure — a Map lookup, not a scan. */ value: (row: string, col: string) => number; /** Press again to clear. */ selected?: MatrixCellRef | null; /** Omit for an informational matrix. */ onSelectCell?: (cell: MatrixCellRef | null) => void; /** Intensity is alpha within it; zero is neutral. Default blue. */ heatColor?: ColorName; /** `rank` spends the band on order, `linear` on share of the largest. Default `rank` behind numbers, * `linear` for a pure heatmap, where colour is the only magnitude. */ heatScale?: MatrixHeatScale; formatValue?: (n: number) => string; /** The row names' width, default 140; a row's mark is budgeted beside it. */ rowLabelWidth?: number; children: ReactNode; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } /** The sheet's floors, in px: a cell's figure, a total, a cell's inset each side and its border, the gap * between columns (`matrix.css`, which `matrix.test.ts` reads back so the two cannot drift). */ export declare const MATRIX_FLOORS: { readonly figure: 52; readonly total: 64; readonly pad: 6; readonly edge: 2; readonly gap: 2; }; /** * The least width a matrix of these columns seats whole in — its row names (and `rows`' marks), every column at * its head's words or a figure's floor, and its totals — as its frame's minimum computes it. Wider than the box * it stands in, its cells scroll; a caller with another form for a narrow box (one bar of each row's shares) * reads this to choose it. */ export declare function matrixFloor(cols: readonly Pick[], seat: { width: number; totals: boolean; rowLabelWidth?: number; rows?: readonly Pick[]; }): number; /** A cross-tab of one dimension against another. The root owns data, heat scale, totals and selection; * compose the opt-in bands `MatrixHeader`, `MatrixGrid`, `MatrixTotals`, `MatrixLegend`. Every number is * a door the host drills. Wider than its box, it scrolls its cells between its pinned names and totals. */ export declare function Matrix({ rows, cols, value, selected, onSelectCell, heatColor, heatScale, formatValue: formatValueProp, rowLabelWidth, children, testID, render, ref, ...props }: MatrixProps): React.JSX.Element; export interface MatrixHeaderProps extends StyleProps { /** Names both axes, e.g. "Line \ Size". */ corner?: ReactNode; /** Shown only with `MatrixTotals`. */ totalLabel?: string; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } export declare function MatrixHeader({ corner, totalLabel, testID, render, ref, ...props }: MatrixHeaderProps): React.ReactElement>; export interface MatrixGridProps extends StyleProps { /** `both` = a heat wash behind the number (default). */ display?: Display; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } declare function MatrixGridBand({ display, testID, render, ref, ...props }: MatrixGridProps): React.ReactElement>; export interface MatrixTotalsProps extends StyleProps { label?: string; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } declare function MatrixTotalsBand({ label, testID, render, ref, ...props }: MatrixTotalsProps): React.ReactElement>; /** Detected by the root to decide whether a total column exists. */ export declare const MatrixTotals: typeof MatrixTotalsBand & { isMatrixTotals: true; }; /** Detected by the root to learn its `display`. */ export declare const MatrixGrid: typeof MatrixGridBand & { isMatrixGrid: true; }; export interface MatrixLegendProps extends StyleProps { lessLabel?: string; moreLabel?: string; testID?: string; ref?: React.Ref; render?: useRender.RenderProp; } export declare function MatrixLegend({ lessLabel, moreLabel, testID, render, ref, ...props }: MatrixLegendProps): React.ReactElement> | null; export {};