import React from 'react'; import { Checkbox } from './Checkbox.js'; export type TableDensity = 'compact' | 'default' | 'relaxed'; export interface TableProps extends React.TableHTMLAttributes { /** Matches Figma's `Density` variant on `Table Cell` / `Table Row`. */ density?: TableDensity; /** Alternating row background, read from the row's position, not a prop * repeated on every `TableRow`. */ isStriped?: boolean; /** * Scroll the rows inside the table past this height, with the header held * at the top — a number is pixels, a string any CSS length (`"60vh"`). * The header sticks to the table's own scroll region, not the page: that * region already scrolls sideways, and a sticky cell sticks to the nearest * scroller. */ maxHeight?: number | string; /** * Hold the first column in place while the table scrolls sideways — with * the toggle and checkbox cells before it, when the rows have them. For a * table wider than its space whose rows are named by their first column. */ stickyFirstColumn?: boolean; } export declare const Table: React.ForwardRefExoticComponent>; export declare const TableHead: React.ForwardRefExoticComponent & React.RefAttributes>; export declare const TableBody: React.ForwardRefExoticComponent & React.RefAttributes>; /** * Row selection checkboxes have no visible label by design, so an accessible * name is required — either `aria-label` or label `children` on the Checkbox. */ export type TableRowSelection = React.ComponentProps & ({ 'aria-label': string; } | { children: React.ReactNode; }); /** * A body row that opens to show more under it. The toggle is a real * disclosure button in the row's first cell, named for the row. */ export interface TableRowExpansion { /** * The toggle's accessible name. Name the row, not the action — "Details * for run 4821" — since every row has one and "Expand" twelve times says * nothing. */ 'aria-label': string; /** What opens under the row, in one cell across every column. */ content: React.ReactNode; /** Controlled: whether it is open. */ isExpanded?: boolean; /** Uncontrolled: whether it starts open. */ defaultExpanded?: boolean; onExpandedChange?: (isExpanded: boolean) => void; } /** The head row's cell over the toggles. Its name is visually hidden. */ export interface TableHeadExpansion { /** Names the toggle column for a screen reader: "Details". */ label: string; } export interface TableRowProps extends React.HTMLAttributes { isSelected?: boolean; /** * Makes the row expandable — Figma's `Show Expander`. In ``, a * `TableRowExpansion`: a leading toggle cell, and when open, a second row * under this one holding `content`. In ``, a `TableHeadExpansion`: * the header cell over the toggles, so the columns still line up. */ expansion?: TableRowExpansion | TableHeadExpansion; /** * Renders a leading `Checkbox` cell — Figma's `Show Selection`. Takes the * checkbox's own props directly rather than a boolean, since a selectable * row needs `checked`/`onChange` wiring, not just a decorative box. * * Inside `` the cell is a `` (select-all). Inside * `` it is a ``. */ selection?: TableRowSelection; } export declare const TableRow: React.ForwardRefExoticComponent>; export type TableCellAlign = 'leading' | 'trailing' | 'center'; /** * A sortable column's state. `none` means sortable but not the current sort — * the column shows the neutral indicator and no `aria-sort`. */ export type TableSortDirection = 'ascending' | 'descending' | 'none'; export type TableCellScope = 'col' | 'row' | 'colgroup' | 'rowgroup'; export interface TableCellProps extends Omit, 'align'> { /** Renders `` instead of `` — Figma's header cell, `surface/page` * fill included. */ header?: boolean; /** * `` scope. Inferred when omitted: `col` in ``, `row` in * ``. Pass explicitly when the inference is wrong (e.g. a column * header rendered outside ``). */ scope?: TableCellScope; align?: TableCellAlign; /** Figma's `Type=Link` — recolours the content to `text/link` / * `icon/primary` rather than the body defaults. */ variant?: 'default' | 'link'; /** Figma's per-cell `Show Divider` — a column rule, not a row rule. */ showDivider?: boolean; /** Figma's `Leading Icon` / `Trailing Icon` slots on `Cell Text`. */ icon?: React.ReactNode; trailingIcon?: React.ReactNode; /** * Makes a header cell a sort control. Set it on every sortable column: * `ascending` or `descending` on the one the rows are sorted by, `none` on * the rest. Header cells only — ignored on a body cell. `useTableSort` * returns this and `onSort` for each column. */ sortDirection?: TableSortDirection; /** * Called when the header is activated. The table does not reorder rows: * sorting is the caller's, since only it knows whether the data is local * or paged from a server. */ onSort?: () => void; /** * Makes a header cell's column resizable: a handle on its trailing edge, * dragged or moved with the arrow keys. Header cells only. `useTableColumns` * returns this for each column through `headerProps`. */ resize?: TableCellResize; children?: React.ReactNode; } /** A resizable column's width, its limits, and what to do when it changes. */ export interface TableCellResize { /** In pixels; `undefined` sizes the column to its content. */ width: number | undefined; minWidth: number; maxWidth: number; /** Called with the new width, or `undefined` on a double-click: back to * the column's own width. */ onResize: (width: number | undefined) => void; /** The handle's name: "Resize Agent". It names the column, since every * resizable header has one. */ 'aria-label': string; } /** * One component covers Figma's `Table Cell` + `Cell Text`: the two are never * used apart in the design (`Table Cell` always wraps exactly one `Cell * Text`), so splitting them into two exported components would only add API * surface for a composition nothing ever varies independently. * * `header` decides `` vs `` directly rather than a `type` prop that * could disagree with where the cell actually sits — a `` rendered inside * `` is still a header cell to the browser and to CSS either way. */ export declare const TableCell: React.ForwardRefExoticComponent>; //# sourceMappingURL=Table.d.ts.map