import type { ColumnDef, ColumnFiltersState, SortingState, VisibilityState, } from "@tanstack/react-table" import type React from "react" export type { ColumnDef, ColumnFiltersState, SortingState, VisibilityState } // Custom column type with width support export type DataTableColumn = ColumnDef & { width?: number | string fixed?: "left" | "right" // Support for fixed columns } export type TableActionVariant = | "default" | "destructive" | "outline" | "secondary" | "ghost" | "link" export interface DataTableFilter { key: string label: string options: { value: string; label: string }[] value?: string[] onValueChange?: (value: string[]) => void } export interface DataTableRowAction { label: string onClick: (selectedRows: TData[]) => void variant?: TableActionVariant disabled?: boolean } // New interface for individual row actions export interface DataTableRowItemAction { label: string onClick: (row: TData) => void variant?: TableActionVariant disabled?: boolean icon?: string | React.ReactNode // Icon name for the action or custom React node } export interface TableRowAction { label: string onClick: () => void variant?: TableActionVariant disabled?: boolean } export interface TableRowSelectionProps { selectedCount: number totalCount: number onSelectAll?: () => void onClearSelection?: () => void actions?: TableRowAction[] className?: string } export interface DataTableToolbarColumn { id: string label: string visible: boolean toggle: () => void canHide: boolean } export interface DataTableProps { columns: DataTableColumn[] data: TData[] // Server-side search configuration searchValue?: string onSearchChange?: (value: string) => void searchPlaceholder?: string filters?: DataTableFilter[] selectedRowActions?: DataTableRowAction[] rowActions?: DataTableRowItemAction[] pageSize?: number pageSizeOptions?: number[] showPageSizeSelector?: boolean className?: string emptyMessage?: string tableClassName?: string headerClassName?: string rowClassName?: string | ((row: any) => string) cellClassName?: string | ((cell: any) => string) footerClassName?: string footer?: React.ReactNode // Toolbar visibility control showToolbar?: boolean showSearchInput?: boolean showFilters?: boolean showColumnVisibility?: boolean showResetButton?: boolean // External reset control onReset?: () => void // Row selection control rowSelection?: Record onRowSelectionChange?: (selection: Record, selectedRows: TData[]) => void showBuiltInSelection?: boolean // Controlled/server-side props sorting?: SortingState onSortingChange?: (sorting: SortingState) => void columnFilters?: ColumnFiltersState onColumnFiltersChange?: (filters: ColumnFiltersState) => void columnVisibility?: VisibilityState onColumnVisibilityChange?: (visibility: VisibilityState) => void globalFilter?: string onGlobalFilterChange?: (value: string) => void pageIndex?: number onPageIndexChange?: (pageIndex: number) => void pageSizeControlled?: number onPageSizeChange?: (pageSize: number) => void totalItems?: number isLoading?: boolean } export interface TableToolbarProps { searchValue?: string onSearchChange?: (value: string) => void searchPlaceholder?: string filters?: { key: string label: string options: { value: string; label: string }[] value?: string[] onValueChange?: (value: string[]) => void }[] className?: string columns?: DataTableToolbarColumn[] onReset?: () => void showResetButton?: boolean }