import * as react from 'react'; import { FC, ReactNode } from 'react'; type RowDataBase = Record; /** Definition for a column in the table. */ interface ColumnDefinition { /** The unique identifier for the column. Used as the key in the data. */ id: keyof RowData; /** The text title to display in the header. */ title: string; } interface TabulusOptions { /** How to align the table within its parent. */ align: 'center' | 'left' | 'right'; } // TODO: Make the generic types work correctly? /** Props passed to the Tabulus component as well as contexts and hooks. */ interface TabulusProps { /** Definition array for the table columns. */ readonly columns: Array>; /** The data to display in the table. */ readonly data: Array; /** Unique ID for the table. */ readonly id: string; /** User options for the table to override defaults. */ readonly options?: Partial; // TODO: Write these props /** Callbacks to run when events are triggered. */ readonly events?: Record; } declare const Tabulus: FC; /** Value of the `TableManager` context that is provided to consumers. */ interface TableManagerValue extends TabulusProps { /** Whether the context has been initialised. */ initialized: boolean; /** The rows to display on the table. */ rows: RowData[]; } /** Props to be passed in to the Context provider. */ interface TableManagerProviderProps extends Omit, 'id'> { /** Children of the provider that will have access to the context value. */ readonly children: ReactNode; /** The ID of the table this manager belongs to. */ readonly tableId: string; } /** * Context for storing and providing table functions and values to the tables below. * This is an internal context for use with our standard components. * * @private */ declare const TableManager: react.Context>; declare const TableManagerProvider: FC; /** Value of the `TableManager` context that is provided to consumers. */ interface TabulusContextValue extends TabulusProps {} /** Props to be passed in to the Context provider. */ interface TabulusContextProviderProps extends TabulusProps { /** Children of the provider that will have access to the context value. */ readonly children: ReactNode; } declare const TabulusContext: react.Context>; declare const TabulusContextProvider: FC; declare const useTabulus: ({ columns: baseColumns, data: baseData, id, options: userOptions, }: TabulusProps) => { columns: ColumnDefinition[]; data: RowData[]; options: TabulusOptions; tableId: string; }; declare const useTabulusContext: () => TabulusContextValue; declare const useTabulusRegistry: () => void; export { TableManager, TableManagerProvider, Tabulus, TabulusContext, TabulusContextProvider, type TabulusProps, useTabulus, useTabulusContext, useTabulusRegistry };