// Type-only definitions for dynamic column builders. The actual // `getDynamicColumns` implementation is host-owned (it renders design-system // specific primitives like Badge/Avatar/MediaGallery tied to the host's // shadcn theme). Hosts pass their implementation into via the // `getDynamicColumns` prop. import type { ColumnDef } from '@tanstack/react-table' import type { TableMetadata } from './types' export interface FilterOption { label: string value: string icon?: string color?: string /** Occurrence count for `facet` options (rendered muted, right-aligned). */ count?: number } export interface ColumnFilterConfig { filterType: 'select' | 'boolean' | 'date_range' | 'number_range' | 'text' | 'facet' | string filterKey: string options: FilterOption[] selectedValues: string[] onFilterChange: (filterKey: string, values: string[]) => void loading?: boolean searchEndpoint?: string /** * Lazy option loader for `facet` filters — resolves the column's distinct * values + counts from the `/facets` endpoint. Passed straight through to * `ColumnFilterControl.loadOptions`. */ loadOptions?: (q?: string) => Promise } /** Signature for the host-provided `getDynamicColumns` factory. */ export type GetDynamicColumns = ( metadata: TableMetadata, handleAction: (action: string, row: any) => void, t: (key: string, options?: any) => string, language: string, columnFilterConfigs: Map, timeZone?: string, currency?: string, ) => ColumnDef[] /** Signature for the host-provided `DynamicIcon` renderer. */ export type DynamicIconComponent = React.ComponentType<{ name: string; className?: string }>