@pagamio/frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
35 lines (34 loc) • 1.06 kB
TypeScript
import type { ChangeEvent } from 'react';
import React from 'react';
type FilterValue = string | string[] | Date | null | undefined;
interface FilterDefinition {
name: string;
placeholder?: string;
type?: 'select' | 'multi-select' | 'date' | 'date-range';
options?: Array<{
label: string;
value: string;
}>;
rangeKeys?: {
start: string;
end: string;
};
}
interface FilterComponentProps {
filters: FilterDefinition[];
searctInputPlaceHolder?: string;
showApplyFilterButton?: boolean;
showClearFilters: boolean;
showApplyFilters?: boolean;
selectedFilters: Record<string, FilterValue>;
showSearch?: boolean;
searchQuery?: string;
isNarrow: boolean;
children?: React.ReactNode;
handleFilterChange: (name: string, value: FilterValue) => void;
handleApplyFilters: () => void;
resetFilters: () => void;
onSearch?: (e: ChangeEvent<HTMLInputElement>) => void;
}
declare const FilterComponent: React.FC<FilterComponentProps>;
export default FilterComponent;