import { type ComponentProps, type PropsWithChildren, type ReactNode } from 'react'; import type { ColumnDef, OnChangeFn, RowModel, Table, TableFeature, TableOptions } from '../../hooks/useTable/types.js'; import type { DataTableV2RowData } from '../../public.api.js'; /** * Props for the `DataTableV2.ExpandableRow` template slot. * @public */ export interface DataTableV2ExpandableRowBaseProps { /** * Define a render function as the child of this slot selection to * control what is rendered in the expanded row section. */ children: (params: { row: TData; }) => ReactNode; /** * Callback triggered when the state of the expanded row is changed. */ onExpandedRowsChange?: (expandedRows: Record) => void; /** * Allows you to disable individual rows from expanding by returning true from the * passed function. */ disableExpand?: (row: TData) => boolean; } /** * @public */ export interface DataTableV2ExpandableRowControlledProps extends DataTableV2ExpandableRowBaseProps { /** * Controlled state for the expanded rows of the DataTableV2. */ expandedRows?: true | Record; /** * Uncontrolled state for the expanded rows of the DataTableV2. */ defaultExpandedRows?: never; } /** * @public */ export interface DataTableV2ExpandableRowUncontrolledProps extends DataTableV2ExpandableRowBaseProps { /** * Controlled state for the expanded rows of the DataTableV2. */ expandedRows?: never; /** * Uncontrolled state for the expanded rows of the DataTableV2. */ defaultExpandedRows?: true | Record; } /** * @public */ export type DataTableV2ExpandableRowProps = DataTableV2ExpandableRowControlledProps | DataTableV2ExpandableRowUncontrolledProps; /** * DataTableV2 slot selection for expandable rows. * @public */ export declare function DataTableV2ExpandableRowTemplate(props: DataTableV2ExpandableRowProps): null; /** * Wrapper helper props for the DataTableV2.ExpandableRow. * @public */ export interface DataTableV2ExpandableRowWrapperProps extends PropsWithChildren, ComponentProps<'div'> { } /** * Wrapper helper for the DataTableV2.ExpandableRow that will automatically sync * specific style properties like row padding for rowDensity variant settings. * @public */ export declare function DataTableV2ExpandableRowWrapper(props: DataTableV2ExpandableRowWrapperProps): import("react/jsx-runtime.js").JSX.Element; /** * Structure for the expanded row state of the DataTableV2. * @internal */ type DataTableV2RowDetailState = true | Record; /** * Extensions interface for the tanstack table state. * @internal */ export interface DataTableV2RowDetailsState { rowDetails?: DataTableV2RowDetailState; } /** * Extension interface to extend the types from the tanstack table options. * @internal */ export interface DataTableV2RowDetailsOptions { /** * Determines if the row details feature is enabled for this table instance. */ enableRowDetails?: true; /** * Stores the rowDetails template for rendering in the expandable. */ rowDetailsTemplate?: (params: { row: TData; }) => ReactNode; /** * Callback when the row details state changes. */ onRowDetailsOpenChange?: OnChangeFn; /** * RowModel option for the extended Details row model. */ getRowDetailsRowModel?: (table: Table) => () => RowModel; /** * Callback to check if a row is disabled or not. */ rowDetailsDisableRow?: (row: TData) => boolean; } /** * Symbol used to identify a row as a details row. * @internal */ export declare const DETAILS_ROW_IDENTIFIER: unique symbol; /** * Appended to row id of cloned expanded row. * @internal */ export declare const ROW_EXPANDED_ID_SUFFIX = "-expanded"; /** * Symbol used to identify a rows parity. * @internal */ export declare const DETAILS_ROW_PARITY: unique symbol; /** * Extension interface to extend the types from the tanstack table instance. * @internal */ export interface DataTableV2RowDetailsInstance { /** * Internal identification id for the table instance to connect aria-controls * between the expander button and the row details. * @internal */ _rowDetailsTableId: string; /** * Internal storage for the row model including the row details rows. * @internal */ _getRowDetailsRowModel?: () => RowModel; /** * Allows access to the row details model if available. */ getRowDetailsRowModel: () => RowModel; /** * Allows access to the row model coming before the row details. */ getPreRowDetailsRowModel: () => RowModel; } /** * @internal * Extension interface to extend the types from the tanstack table instance. */ export interface DataTableV2RowDetailsRow { /** * Determines if the details row for a particular row is open. */ getIsDetailsOpen: () => boolean; /** * Determines if the details for this row can be shown. */ getCanOpenDetails: () => boolean; /** * Control command to toggle the state of the rowDetails. */ toggleDetails: () => void; /** * Defines the grid position for the row details row. */ getRowDetailsGridPosition: () => { gridColumnStart: number; gridColumnEnd: number | `span ${number}`; }; /** * Returns the aria control id to connect the expanding button to the * row details wrapper. */ getRowDetailsAriaControlsId: () => string; /** * Identifier for the row parity in case of details row this is set * in the row model. * @internal */ [DETAILS_ROW_PARITY]?: 'even' | 'odd'; /** * Identifier if the row is a details row. * @internal */ [DETAILS_ROW_IDENTIFIER]?: boolean; } /** * Row details feature for the DataTableV2. * @internal */ export declare const DataTableV2RowDetails: TableFeature; /** * Helper function to identify the ROW_DETAILS_COLUMN * @internal */ export declare function isRowDetailsColumnDef(column: ColumnDef): boolean; /** * Column definition for the row details column. * @internal */ export declare const ROW_DETAILS_COLUMN: ColumnDef; /** * Configuration hook for subrows of the DataTableV2. * @internal */ export declare function useRowDetails(props: PropsWithChildren, options: TableOptions): void; export {};