goobs-frontend
Version:
A comprehensive React-based libary for building modern web applications
32 lines • 1.22 kB
TypeScript
import { ColumnDef, RowData } from '../types';
import { SearchbarProps } from '../../Field/Search';
interface UseSearchbarProps {
columns: ColumnDef[];
rows: RowData[];
/** Optional: merges the parent's SearchbarProps, so we pass them through. */
searchbarProps?: Omit<SearchbarProps, 'onChange' | 'value'>;
/** If provided, we update column visibility (e.g. via Jotai). */
updateVisibility?: (action: {
type: 'save';
newState: Record<string, boolean>;
}) => void;
}
/**
* A custom hook that manages:
* - Local searchValue state
* - Splitting that searchValue into "tags"
* - Filtering rows based on search terms
* - Determining which columns should be visible
* - Optionally updating column visibility
*/
export declare const useSearchbar: ({ columns, rows, searchbarProps, updateVisibility, }: UseSearchbarProps) => {
searchValue: string;
setSearchValue: import('react').Dispatch<import('react').SetStateAction<string>>;
handleSearchChange: (value: string) => void;
filteredRows: RowData[];
visibleColumns: Set<string>;
tags: string[];
updatedSearchbarProps: SearchbarProps;
};
export {};
//# sourceMappingURL=useToolbarSearchbar.d.ts.map