import { type CategorizedFilters, type FilterGenerator, type TransformedSortingOptions } from "./FilterBarProps.type"; /** * Generates the list of filters based on the data (see this as what you'd like to be filtered in your component). * * @param dataToGenerateFiltersFrom - The data (list of entities) that will be used to create the filters. * @param groupers a list of functions used to create the filters dropdown * @returns {CategorisedFilters} a list of filters properly grouped. */ export declare function getFilterGroups(dataToGenerateFiltersFrom: T, groupers: FilterGenerator[]): CategorizedFilters; /** * * @param filterKey the key of the categorized filter (eg. color, size, brand) - which one of them are you gonna check. * @param categorizedFilters the array of categorized filters the FilterBar component needs * @param attributeGetter the getter to retrieve the attribute to be filtered on, this allow maximum flexibility on how to process * filters on any level of nesting if necessary. * @returns a predicate to be used in the filter function * @example * * const sizeFilterPredicate = createFilterPredicate("size", filtersOptions, (item) => item.meta.size); * const filteredBySize = items.filter(sizeFilterPredicate); * */ export declare const createFilterPredicate: (filterKey: string, categorizedFilters: CategorizedFilters, attributeGetter: (item: T) => string) => (item: T) => boolean; /** * Creates a sorting function to be used on a specific object attribute. * * @param getter the getter function to retrieve the attribute used in the sorting * @param order if ascending or descending * @returns the sorting comparer function to be used in Array.sort */ export declare const createSortingComparer: (getter: (item: T) => string | number, order?: "asc" | "desc") => ((itemA: T, itemB: T) => number); export declare const applySorting: (sortable: T, sortingOptions: TransformedSortingOptions) => T;