import React from 'react'; import { useControlled } from '../use-controlled'; export type ColumnVisibility = Record; type _Row = Record; type NestedKeys = { [K in keyof Row]: K extends string ? Row[K] extends object ? `${ParentKey}${K}` | NestedKeys : `${ParentKey}${K}` : never; }[keyof Row]; type AccessorValueType = Acc extends `${infer ParentObject}.${infer NestedKey}` ? AccessorValueType : BeforeDotObject[Acc & keyof BeforeDotObject]; type TableColumnProps = { identifier: string; header: string | ((data: Row[]) => React.ReactNode); visibility?: boolean; visibilityTitle?: string; hideable?: boolean; classNames?: { th?: string; td?: string; }; }; export type TableColumn = ({ accessor: K; cell?: (val: AccessorValueType, row: Row, data: Row[]) => React.ReactNode; } & TableColumnProps) | ({ accessor?: undefined; cell?: (row: Row, data: Row[]) => React.ReactNode; } & TableColumnProps); type TableColumns = { [K in NestedKeys]: TableColumn; }[NestedKeys][]; type GetRowKey = (row: R) => string; export interface TableRootProps { data: R[]; columns: TableColumns; getRowKey?: GetRowKey; children?: React.ReactNode; columnVisibility?: ColumnVisibility; onColumnVisibilityChange?: (value: ColumnVisibility) => void; } interface RootContext { data: _Row[]; columns: TableColumns<_Row>; getRowKey?: GetRowKey<_Row>; columnVisibility: ColumnVisibility; setColumnVisibility: ReturnType>[1]; } declare const useTableCtx: (consumerName: string) => RootContext; export { useTableCtx }; export declare const TableRoot: (props: TableRootProps) => React.ReactNode; //# sourceMappingURL=table-root.d.ts.map