import type { TablePlugin } from '../../types';
import type { PowerSearchConfig, PowerSearchFilter } from '../../../PowerSearch/types';
/** Union of all filter value types (text=string, number=number, enum/list=string[]) */
export type TableFilterValue = string | number | string[];
/**
 * Reference to a PowerSearch field.
 * Instead of defining the filter inline, point to a field in a shared
 * `PowerSearchConfig`. The plugin resolves the operator's value type
 * and renders the appropriate control.
 *
 * - **String form** — field key only, uses the field's `defaultOperator`:
 *   `filter: 'status'`
 *
 * - **Object form** — field key + explicit operator:
 *   `filter: { field: 'status', operator: 'is_not' }`
 *
 * Both require `searchConfig` on the plugin config.
 */
export interface TableFilterFieldRef {
    /** Key of the PowerSearchField in the searchConfig. */
    field: string;
    /**
     * Key of the operator on that field. When omitted, uses the field's
     * `defaultOperator` or the first operator.
     */
    operator?: string;
}
/**
 * Convert table filter state to PowerSearchFilter[] for use with `applyFilters`.
 *
 * Maps each non-empty entry in the filter state to a `PowerSearchFilter`,
 * resolving the field and operator from the column config + searchConfig.
 * This bridges the table filtering UI with PowerSearch's client-side
 * filter engine — define filters once, apply everywhere.
 *
 * @example
 * ```
 * const { config, applyFilters } = usePowerSearchConfig(defs);
 * const searchFilters = toSearchFilters(filters, columns, config);
 * const filteredData = applyFilters(searchFilters, data);
 * ```
 */
export declare function toSearchFilters<_T extends Record<string, unknown>>(filters: TableFilterState, columns: ReadonlyArray<{
    key: string;
    filter?: TableFilterFieldRef | string;
}>, searchConfig: PowerSearchConfig): PowerSearchFilter[];
/**
 * Complete filter state — a map from column key to filter value.
 * Missing keys or `undefined` values mean "no filter applied" for that column.
 *
 * @example
 * ```
 * const filters: TableFilterState = {
 *   name: 'alice',
 *   status: 'active',
 *   tags: ['admin', 'user'],
 * };
 * ```
 */
export type TableFilterState = Record<string, TableFilterValue | undefined>;
/**
 * Display variant for the filter UI.
 *
 * - `'popover'` — filter icon in header; clicking opens a popover with the filter control
 * - `'inline'` — filter control rendered directly below header text inside the header cell
 * - `'inline-compact'` — same as inline but with compact-sized controls
 */
export type TableFilterVariant = 'popover' | 'inline' | 'inline-compact';
/**
 * Configuration for useTableFiltering.
 *
 * @example
 * ```
 * const {filters, onFilterChange} = useTableFilterState();
 * const filterPlugin = useTableFiltering({
 *   filters,
 *   onFilterChange,
 *   variant: 'inline',
 * });
 * <Table plugins={{ filter: filterPlugin }} columns={columns} data={data} />
 * ```
 */
export interface UseTableFilteringConfig {
    /** Current filter state — map from column key to filter value. */
    filters: TableFilterState;
    /** Called when the user changes a filter value. `null` clears the filter. */
    onFilterChange: (columnKey: string, value: TableFilterValue | null) => void;
    /**
     * Display variant for filter controls.
     *
     * @default 'popover'
     */
    variant?: TableFilterVariant;
    /**
     * PowerSearch configuration that defines the available filter fields.
     * Columns reference fields by key; the plugin resolves the operator's
     * value type and renders the matching control.
     *
     * Use `createPowerSearchConfig` or `usePowerSearchConfig` to build this
     * from field definitions — the same config can be shared with
     * `PowerSearch` for a unified filtering experience.
     */
    searchConfig: PowerSearchConfig;
}
/**
 * useTableFiltering — table plugin for column filtering.
 *
 * Returns a stable TablePlugin that transforms header cells to add
 * filter controls. Follows the headless pattern: consumer owns filter state,
 * plugin provides UI and interaction.
 *
 * Filter types are configured per-column via the `filter` field on
 * TableColumn. The plugin reads filter config from columns and
 * renders the appropriate control (text input, selector, etc.).
 *
 * @template T - Row data type
 *
 * @example
 * ```
 * const {filters, onFilterChange} = useTableFilterState();
 * const filterPlugin = useTableFiltering({
 *   filters,
 *   onFilterChange,
 *   variant: 'popover',
 * });
 * <Table
 *   data={users}
 *   columns={[
 *     { key: 'name', header: 'Name', filter: 'name' },
 *     { key: 'status', header: 'Status', filter: 'status' },
 *   ]}
 *   plugins={{ filter: filterPlugin }}
 * />
 * ```
 */
export declare function useTableFiltering<T extends Record<string, unknown>>(config: UseTableFilteringConfig): TablePlugin<T>;
//# sourceMappingURL=useTableFiltering.d.ts.map