import { type OnChangeFn, type Updater } from '@tanstack/react-table'; import { type TableFeature, type TableOptions } from '../hooks/useTable/types.js'; /** * @public */ export interface DataTableV2ColumnFontStyleBaseProps { /** * Callback that is called when the FontStyle state of the table or any column is changed. */ onFontStyleChange?: (fontStyle: DataTableV2ColumnFontStyleState) => void; } /** * @public */ export interface DataTableV2ColumnFontStyleControlledProps extends DataTableV2ColumnFontStyleBaseProps { /** * Lets you control the FontStyle state of the entire table or individual columns. * `boolean` values will affect the whole table, whereas `Record` values will let you assign * FontStyles to individual columns. * @example * ```typescript * FontStyle={{ [column.id]: 'code'|'text' }} // to control the FontStyle on individual columns. * ``` */ fontStyle?: DataTableV2ColumnFontStyleState; /** * Lets you set FontStyle state initially of the entire table or individual columns. * `boolean` values will affect the whole table, whereas `Record` values will let you assign * FontStyles to individual columns. * @example * ```typescript * defaultFontStyle={{ [column.id]: 'code'|'text' }} // to control the FontStyle on individual columns. * ``` */ defaultFontStyle?: never; } /** * @public */ export interface DataTableV2ColumnFontStyleUncontrolledProps extends DataTableV2ColumnFontStyleBaseProps { /** * Lets you control the FontStyle state of the entire table or individual columns. * `boolean` values will affect the whole table, whereas `Record` values will let you assign * FontStyles to individual columns. * @example * ```typescript * FontStyle={{ [column.id]: 'code'|'text' }} // to control the FontStyle on individual columns. * ``` */ fontStyle?: never; /** * Lets you set FontStyle state initially of the entire table or individual columns. * `boolean` values will affect the whole table, whereas `Record` values will let you assign * FontStyles to individual columns. * @example * ```typescript * defaultFontStyle={{ [column.id]: 'code'|'text' }} // to control the FontStyle on individual columns. * ``` */ defaultFontStyle?: DataTableV2ColumnFontStyleState; } /** * Interface defining the props on the DataTableV2 that control the font style feature. * @public */ export type DataTableV2ColumnFontStyleProps = DataTableV2ColumnFontStyleControlledProps | DataTableV2ColumnFontStyleUncontrolledProps; /** * Defines the shape of the FontStyle state within the tanstack tables state. * @public */ export type DataTableV2ColumnFontStyleState = Record; /** * Extension interface to extend the tanstack table state with the FontStyle state. * @internal */ export interface DataTableV2ColumnFontStyleTableState { /** * Table state extension for FontStyle */ columnFontStyle: DataTableV2ColumnFontStyleState; } /** * Extension interface to extend the useTable hook options with the FontStyle options. * @internal */ export interface DataTableV2ColumnFontStyleOptions { /** * Enables ćolumn font style as a feature on the table. */ enableFontStyle?: boolean; /** * Exposes the onFontStyleChange function to the Table options. */ onColumnFontStyleChange?: OnChangeFn; } /** * Extension interface to extend the types of the tanstack table instance. * @internal */ export interface DataTableV2ColumnFontStyleInstance { /** * Helper function to update the global table states `columnFontStyle` portion. */ setColumnFontStyle: (updater: Updater) => void; } /** * Extension interface to extend the types exposed on the tanstack column instance. * @internal */ export interface DataTableV2ColumnFontStyleColumn { /** * Return a boolean value that will represent the current fontStyle state of a column. */ getFontStyle: () => 'text' | 'code'; /** * Toggles the fontStyle property of the column * @param value - If a value is provided, this function behaves like a setter instead of a toggle. */ toggleFontStyle: (value?: 'text' | 'code') => void; } /** * Feature implementation for FontStyle. This contains the logic that will be given * to the tanstack table. The implementing interface is important as these are * the function that will be called by the tanstack table core during render. * @internal */ export declare const DataTableV2ColumnFontStyle: TableFeature; /** * Configuration hook for the DataTableV2 FontStyle feature. * @internal */ export declare function useColumnFontStyle(props: DataTableV2ColumnFontStyleProps, options: TableOptions): void;