import React from 'react'; /** Which way a column sorts, as `aria-sort` names it. */ export type SortDirection = 'ascending' | 'descending' | 'none'; /** `comfortable` gives each row room; `compact` fits many rows in little * height, such as a key and value list or a dashboard card's runs; `dense` * sets small type in tight rows, for a panel of figures. */ export type TableDensity = 'comfortable' | 'compact' | 'dense'; /** What a list row asks of the cell in a place, through whatever component of the host's renders * it: its column's classes, content to show after its own, or that it shows stacked, under the * first cell's, as a line in place of a cell. */ export interface CellPlacement { className?: string | undefined; after?: React.ReactNode; stacked?: boolean | undefined; /** A stacked value joined to the one before it on its line, after a dot. */ joined?: boolean | undefined; } /** A stacked column's value on the line under a row's name: it flows inline with the others and * wraps between them, never inside a value, which truncates if it is wider than the line. Its * 4px clip margin, as a cell's, lets a status lamp's glow at its edge show whole. One * whose content renders nothing, such as a host's status component for a row with no status, * takes no room, so the line's gap doesn't indent the value after it. */ export declare const STACKED_ITEM = "flex min-w-0 max-w-full items-center whitespace-nowrap empty:hidden [&>*]:min-w-0 [&>*]:overflow-clip [&>*]:text-ellipsis [&>*]:[overflow-clip-margin:4px]"; /** A joined stacked value's dot, part of the value so a value that renders nothing leaves none: * 6px either side of it, where the line keeps 12px between values. */ export declare const STACKED_JOINED = "-ml-1.5 before:pr-1.5 before:content-['\u00B7'] before:text-(--theme-muted-text-color)"; /** Whether a cell's content shows anything: an empty string, like a missing value, doesn't. */ export declare function hasContent(children: React.ReactNode): boolean; /** Set by a list row around each of its cells; a `Table.Item` takes what it asks. */ export declare const CellPlacementContext: React.Context; interface ItemProps extends React.TdHTMLAttributes { /** Lets the text wrap; by default a cell keeps to one line. */ wrap?: boolean; } declare function Item({ wrap, children, className, ...tdProps }: ItemProps): React.JSX.Element | null; interface HeaderProps { children?: React.ReactNode; className?: string | undefined; style?: React.CSSProperties | undefined; colSpan?: number | undefined; /** Which way the column sorts now. With `onSort`, the header is a button * that shows it; `none` for a sortable column that isn't the sorted one. */ sort?: SortDirection | undefined; /** Sorts by this column, or flips its direction. */ onSort?: (() => void) | undefined; /** Classes on the sort button, such as ones that hide it where `aside` takes its place. */ sortClassName?: string | undefined; /** After the title, outside its sort button: another control the header holds. */ aside?: React.ReactNode; /** False sets the title in sentence case instead of small capitals. The * table's `caps` by default. */ caps?: boolean | undefined; } declare function Header({ children, className, style, colSpan, sort, onSort, sortClassName, aside, caps, }: HeaderProps): React.JSX.Element; interface TableProps { children?: React.ReactNode; density?: TableDensity | undefined; /** Each column's width, in order, such as `['20%', '8rem', undefined]`; a * column left undefined takes what the others leave. With * `table-fixed` in `className`, the widths hold whatever the cells hold. */ columns?: readonly (string | undefined)[] | undefined; /** False sets every header in sentence case, as a small table in a card * reads best; a header's own `caps` still wins. */ caps?: boolean | undefined; /** Drops the outer side padding of the first and last columns and the * header's fill, for a table inside something already padded, such as a * card: it reads as part of the card, its titles in line with the card's * other content and set apart by the rule under them. */ flush?: boolean | undefined; /** Rules a line between columns as well as rows, for a grid of figures to * read across and down. */ columnDividers?: boolean | undefined; borderless?: boolean; /** When false, drops the theme-panel background. */ panel?: boolean; className?: string; tbodyClassName?: string | undefined; theadClassName?: string; wrapperClassName?: string; roundedTop?: boolean; rounded?: boolean; roundedBottom?: boolean; isLoading?: boolean; /** The header row stays in view while the rows scroll under it. It sticks * to the nearest scrolling ancestor, just below whatever that ancestor * already pins at its top, such as a page header, a toolbar or tabs, which * it finds and follows by itself; in a box that scrolls on its own it pins * at the box's top. So the table no longer scrolls or clips on its own: a * box that scrolls itself is all a sticky header can stick to. Its ancestor * scrolls it sideways as well as down. Rows pass under the header, so a * `theadClassName` of your own needs a background. */ stickyHeader?: boolean | undefined; /** Forwarded to the ``, for attributes that must sit on the element owning * the rows — `role='grid'`, aria-activedescendant, aria-rowcount. `className` is * excluded because it is spread after the table's own classes; use the * `className` prop, which merges. */ tableProps?: Omit, 'className'> & { 'aria-activedescendant'?: string; 'aria-rowcount'?: number; }; } /** The class of the table's row bodies, for a section that renders bodies of its own. Null * outside a section, where a section can't add a body. */ export declare const TableBodyContext: React.Context<{ className: string | undefined; } | null>; /** Rows of values under a row of column titles. Put `Table.Header`s first among * the children, then ``s of `Table.Item`s. */ export declare function Table({ density, columns, caps, flush, columnDividers, borderless, panel, className, wrapperClassName, tbodyClassName, theadClassName, children, roundedTop, rounded, roundedBottom, isLoading, stickyHeader, tableProps, }: TableProps): React.JSX.Element; export declare namespace Table { export { Header }; export { Item }; } export {};