@trackunit/filters-filter-bar 0.0.1-alpha-d272aa10e1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +22 -0
  2. package/index.cjs.d.ts +1 -0
  3. package/index.cjs.js +18864 -0
  4. package/index.esm.js +18845 -0
  5. package/package.json +29 -0
  6. package/src/index.d.ts +1 -0
  7. package/src/lib/FilterBar.d.ts +25 -0
  8. package/src/lib/components/DefaultCheckboxFilter.d.ts +8 -0
  9. package/src/lib/components/DefaultDateRangeFilter.d.ts +9 -0
  10. package/src/lib/components/DefaultFilterTypes.d.ts +53 -0
  11. package/src/lib/components/DefaultMinMaxFilter.d.ts +17 -0
  12. package/src/lib/components/DefaultRadioFilter.d.ts +9 -0
  13. package/src/lib/components/DynamicFilterList.d.ts +63 -0
  14. package/src/lib/components/Filter.d.ts +23 -0
  15. package/src/lib/components/FilterHeader.d.ts +64 -0
  16. package/src/lib/components/FilterResults.d.ts +14 -0
  17. package/src/lib/components/ResetFiltersButton.d.ts +26 -0
  18. package/src/lib/components/StarredFilters.d.ts +25 -0
  19. package/src/lib/components/StarredFiltersMenu.d.ts +29 -0
  20. package/src/lib/components/VirtualizedList.d.ts +26 -0
  21. package/src/lib/components/index.d.ts +9 -0
  22. package/src/lib/hooks/useFilterBar.d.ts +59 -0
  23. package/src/lib/hooks/useGroupFilters.d.ts +23 -0
  24. package/src/lib/index.d.ts +6 -0
  25. package/src/lib/types/FilterTypes.d.ts +219 -0
  26. package/src/lib/utils/FilterEvents.d.ts +17 -0
  27. package/src/lib/utils/capitalize.d.ts +7 -0
  28. package/src/lib/utils/createInitialState.d.ts +21 -0
  29. package/src/lib/utils/getCountryName.d.ts +10 -0
  30. package/src/lib/utils/mergeFilters.d.ts +8 -0
  31. package/src/lib/utils/reduceFilterText.d.ts +7 -0
  32. package/src/lib/utils/toggleFilterValue.d.ts +7 -0
  33. package/src/lib/utils/validateFilter.d.ts +10 -0
  34. package/src/translation.d.ts +34 -0
  35. package/translation.cjs.js +243 -0
  36. package/translation.cjs10.js +243 -0
  37. package/translation.cjs11.js +243 -0
  38. package/translation.cjs12.js +243 -0
  39. package/translation.cjs13.js +243 -0
  40. package/translation.cjs14.js +243 -0
  41. package/translation.cjs15.js +243 -0
  42. package/translation.cjs16.js +243 -0
  43. package/translation.cjs17.js +243 -0
  44. package/translation.cjs2.js +243 -0
  45. package/translation.cjs3.js +243 -0
  46. package/translation.cjs4.js +243 -0
  47. package/translation.cjs5.js +243 -0
  48. package/translation.cjs6.js +243 -0
  49. package/translation.cjs7.js +243 -0
  50. package/translation.cjs8.js +243 -0
  51. package/translation.cjs9.js +243 -0
  52. package/translation.esm.js +241 -0
  53. package/translation.esm10.js +241 -0
  54. package/translation.esm11.js +241 -0
  55. package/translation.esm12.js +241 -0
  56. package/translation.esm13.js +241 -0
  57. package/translation.esm14.js +241 -0
  58. package/translation.esm15.js +241 -0
  59. package/translation.esm16.js +241 -0
  60. package/translation.esm17.js +241 -0
  61. package/translation.esm2.js +241 -0
  62. package/translation.esm3.js +241 -0
  63. package/translation.esm4.js +241 -0
  64. package/translation.esm5.js +241 -0
  65. package/translation.esm6.js +241 -0
  66. package/translation.esm7.js +241 -0
  67. package/translation.esm8.js +241 -0
  68. package/translation.esm9.js +241 -0
package/package.json ADDED
@@ -0,0 +1,29 @@
1
+ {
2
+ "name": "@trackunit/filters-filter-bar",
3
+ "version": "0.0.1-alpha-d272aa10e1.0",
4
+ "repository": "https://github.com/Trackunit/manager",
5
+ "license": "SEE LICENSE IN LICENSE.txt",
6
+ "engines": {
7
+ "node": ">=18.x"
8
+ },
9
+ "dependencies": {
10
+ "@trackunit/i18n-library-translation": "0.0.80-alpha-d272aa10e1.0",
11
+ "@trackunit/iris-app-api": "0.0.118-alpha-d272aa10e1.0",
12
+ "@trackunit/iris-app-runtime-core-api": "0.3.73-alpha-d272aa10e1.0",
13
+ "@trackunit/react-components": "0.1.166-alpha-d272aa10e1.0",
14
+ "@trackunit/react-core-contexts-api": "0.2.61-alpha-d272aa10e1.0",
15
+ "@trackunit/react-core-contexts-test": "0.1.114-alpha-d272aa10e1.0",
16
+ "@trackunit/react-core-hooks": "0.2.100-alpha-d272aa10e1.0",
17
+ "@trackunit/react-filter-components": "0.0.213-alpha-d272aa10e1.0",
18
+ "@trackunit/react-form-components": "0.0.155-alpha-d272aa10e1.0",
19
+ "@trackunit/shared-utils": "0.0.10-alpha-d272aa10e1.0",
20
+ "dequal": "2.0.3",
21
+ "lodash": "4.17.21",
22
+ "react": "18.2.0",
23
+ "react-router-dom": "6.11.2",
24
+ "react-virtual": "2.10.4"
25
+ },
26
+ "module": "./index.esm.js",
27
+ "main": "./index.cjs.js",
28
+ "peerDependencies": {}
29
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./lib";
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { FilterBarConfig, FilterBarDefinition, FilterMapActions, FilterMapGetter } from "./types/FilterTypes";
3
+ interface FilterBarProps<TFilterBarDefinition extends FilterBarDefinition> {
4
+ /**
5
+ * If you want some of the filters to be hidden, but still programmatically enabled
6
+ */
7
+ hiddenFilters?: string[];
8
+ /**
9
+ * CSS class name for styling purposes
10
+ */
11
+ className?: string;
12
+ /**
13
+ * The definition of the filter bar
14
+ */
15
+ filterBarDefinition: TFilterBarDefinition;
16
+ /**
17
+ * Configuration and actions for the filter bar
18
+ */
19
+ filterBarConfig: FilterBarConfig<TFilterBarDefinition> & FilterMapActions & FilterMapGetter;
20
+ }
21
+ /**
22
+ * The FilterBar component serves as a wrapper for managing filters.
23
+ */
24
+ export declare const FilterBar: <TFilterBarDefinition extends FilterBarDefinition>({ hiddenFilters, className, filterBarDefinition, filterBarConfig, }: FilterBarProps<TFilterBarDefinition>) => JSX.Element;
25
+ export {};
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import { DefaultFilterProps } from "./DefaultFilterTypes";
3
+ /**
4
+ * `DefaultCheckboxFilter` is a React component for handling checkbox filters.
5
+ *
6
+ * @param {DefaultFilterProps<string[]>} props - The properties required for the `DefaultCheckboxFilter` component.
7
+ */
8
+ export declare const DefaultCheckboxFilter: ({ filterDefinition, filterBarActions, options, loading, filterName, customSearch, showTooltip, setValue, }: DefaultFilterProps<string[]>) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { DateRangeValue } from "../types/FilterTypes";
3
+ import { DefaultFilterProps } from "./DefaultFilterTypes";
4
+ /**
5
+ * `DefaultDateRangeFilter` is a React component for handling date range filters.
6
+ *
7
+ * @param {DefaultFilterProps<DateRangeValue>} props - The properties required for the `DefaultDateRangeFilter` component.
8
+ */
9
+ export declare const DefaultDateRangeFilter: ({ filterDefinition, filterName, value, setValue, }: DefaultFilterProps<DateRangeValue>) => JSX.Element;
@@ -0,0 +1,53 @@
1
+ import { ReactNode } from "react";
2
+ import { FilterName, FilterViewProps } from "../types/FilterTypes";
3
+ export interface FilterOption {
4
+ /**
5
+ * The displayed label for this option
6
+ */
7
+ label: string;
8
+ /**
9
+ * The value used internally as the filter - this value is supplied to the backend
10
+ */
11
+ key: string;
12
+ /**
13
+ * Optional count for this option (show how many records that are available for this option)
14
+ */
15
+ count?: number;
16
+ /**
17
+ * Show a component together with the label
18
+ */
19
+ prefix?: ReactNode;
20
+ }
21
+ export interface DefaultFilterProps<TReturnType> extends FilterViewProps<TReturnType> {
22
+ /**
23
+ * An array of filter options to be displayed.
24
+ */
25
+ options: FilterOption[];
26
+ /**
27
+ * Indicates whether the filter is in a loading state.
28
+ */
29
+ loading?: boolean;
30
+ /**
31
+ * A flag indicating whether tooltips should be displayed for the filter options.
32
+ */
33
+ showTooltip?: boolean;
34
+ /**
35
+ * A custom filter name, if provided.
36
+ */
37
+ filterName?: `${Capitalize<FilterName>}Filter`;
38
+ /**
39
+ * By default, searches client side on all options. Override with this to support for server side searching
40
+ */
41
+ customSearch?: {
42
+ /**
43
+ * Current search string
44
+ */
45
+ value: string;
46
+ /**
47
+ * Callback when search string changed
48
+ *
49
+ * @param value Updated search string
50
+ */
51
+ onChange: (value: string) => void;
52
+ };
53
+ }
@@ -0,0 +1,17 @@
1
+ import { ReactElement } from "react";
2
+ import { MinMaxFilterValue } from "../types/FilterTypes";
3
+ import { DefaultFilterProps } from "./DefaultFilterTypes";
4
+ interface DefaultMinMaxFilterProps extends DefaultFilterProps<MinMaxFilterValue> {
5
+ /**
6
+ * The unit of measurement associated with the filter values
7
+ */
8
+ unit: string | null | undefined;
9
+ }
10
+ /**
11
+ * `DefaultMinMaxFilter` is a React component designed to handle a filter with minimum and maximum values.
12
+ *
13
+ * @param {DefaultMinMaxFilterProps} props - The properties required for the `DefaultMinMaxFilter` component.
14
+ * @returns {ReactElement} The rendered `DefaultMinMaxFilter` component.
15
+ */
16
+ export declare const DefaultMinMaxFilter: ({ filterDefinition, filterName, value, setValue, filterBarActions, unit, }: DefaultMinMaxFilterProps) => ReactElement;
17
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ValueName } from "../types/FilterTypes";
3
+ import { DefaultFilterProps } from "./DefaultFilterTypes";
4
+ /**
5
+ * DefaultRadioFilter is a React component that renders a filter with radio button options based on the provided props.
6
+ *
7
+ * @returns {JSX.Element} - Returns the DefaultRadioFilter component.
8
+ */
9
+ export declare const DefaultRadioFilter: ({ filterDefinition, filterBarActions, options, loading, filterName, customSearch, showTooltip, }: DefaultFilterProps<ValueName[]>) => JSX.Element;
@@ -0,0 +1,63 @@
1
+ import { ReactNode } from "react";
2
+ interface DynamicFilterListProps {
3
+ /**
4
+ * The type of input element to use in the list.
5
+ */
6
+ type?: "CheckBox" | "Radio";
7
+ /**
8
+ * The total number of rows in the filter list.
9
+ */
10
+ rowCount: number;
11
+ /**
12
+ * A function that maps a row's index to a unique key.
13
+ *
14
+ * @param {number} rowIndex - The index of the row.
15
+ * @returns {string} - A unique key for the row.
16
+ */
17
+ keyMapper: (rowIndex: number) => string;
18
+ /**
19
+ * A function that maps a row's index to a label.
20
+ *
21
+ * @param {number} rowIndex - The index of the row.
22
+ * @returns {string} - The label for the row.
23
+ */
24
+ labelMapper: (rowIndex: number) => string;
25
+ /**
26
+ * An optional function that maps a row's index to a prefix element.
27
+ *
28
+ * @param {number} rowIndex - The index of the row.
29
+ * @returns {ReactNode} - The prefix element for the row.
30
+ */
31
+ prefixMapper?: (rowIndex: number) => ReactNode;
32
+ /**
33
+ * An optional callback function called when a row's input element value changes.
34
+ *
35
+ * @param {number} rowIndex - The index of the row.
36
+ */
37
+ onChange?: (rowIndex: number) => void;
38
+ /**
39
+ * A function that determines whether a row's input element is checked.
40
+ *
41
+ * @param {number} rowIndex - The index of the row.
42
+ * @returns {boolean} - `true` if the input element should be checked, `false` otherwise.
43
+ */
44
+ checked: (rowIndex: number) => boolean;
45
+ /**
46
+ * A function that returns the count associated with a row, if applicable.
47
+ *
48
+ * @param {number} rowIndex - The index of the row.
49
+ * @returns {number|undefined} - The count for the row, or `undefined` if not applicable.
50
+ */
51
+ count: (rowIndex: number) => number | undefined;
52
+ /**
53
+ * A flag indicating whether tooltips should be displayed for the rows.
54
+ */
55
+ showTooltip?: boolean;
56
+ }
57
+ /**
58
+ * DynamicFilterList is a React component that displays a list of dynamic filters with options like CheckBoxes or Radio buttons.
59
+ *
60
+ * @returns {JSX.Element} - Returns the DynamicFilterList component.
61
+ */
62
+ export declare const DynamicFilterList: ({ rowCount, keyMapper, labelMapper, prefixMapper, onChange, checked, count, showTooltip, type, }: DynamicFilterListProps) => JSX.Element;
63
+ export {};
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { FilterDefinition, FilterMapActions, FilterMapGetter, FilterState } from "../types/FilterTypes";
3
+ interface FilterProps {
4
+ /**
5
+ * The definition of the filter.
6
+ */
7
+ filter: FilterDefinition;
8
+ /**
9
+ * The state of the filter.
10
+ */
11
+ filterState: FilterState<{}>;
12
+ /**
13
+ * Actions and getters for the filter bar.
14
+ */
15
+ filterBarActions: FilterMapActions & FilterMapGetter;
16
+ }
17
+ /**
18
+ * Filter is a React component that renders a filter element based on the provided filter definition and state.
19
+ *
20
+ * @returns {JSX.Element} - Returns the Filter component.
21
+ */
22
+ export declare const Filter: ({ filter, filterBarActions, filterState }: FilterProps) => JSX.Element;
23
+ export {};
@@ -0,0 +1,64 @@
1
+ /// <reference types="react" />
2
+ import { FilterTranslation } from "../types/FilterTypes";
3
+ interface FilterHeaderCommonProps {
4
+ loading?: boolean;
5
+ /**
6
+ * the filter key
7
+ */
8
+ /**
9
+ * The filter key, a unique identifier for the filter.
10
+ */
11
+ filterKey: string;
12
+ /**
13
+ * The title and translation for the filter.
14
+ */
15
+ title: FilterTranslation;
16
+ /**
17
+ * An optional callback function to reset the filter.
18
+ */
19
+ onResetFilter?: () => void;
20
+ /**
21
+ * A function to reset an individual filter to its initial state.
22
+ *
23
+ * @param {string} key - The key of the filter to reset.
24
+ */
25
+ resetIndividualFilterToInitialState: (key: string) => void;
26
+ /**
27
+ * A function to check if the filter has changed.
28
+ *
29
+ * @param {string} key - The key of the filter to check.
30
+ * @returns {boolean} - `true` if the filter has changed, `false` otherwise.
31
+ */
32
+ filterHasChanged(key: string): boolean;
33
+ }
34
+ interface FilterSearchProps {
35
+ /**
36
+ * The current search value.
37
+ */
38
+ value: string;
39
+ /**
40
+ * A callback function to handle changes in the search value.
41
+ *
42
+ * @param {string} value - The updated search value.
43
+ */
44
+ onChange: (value: string) => void;
45
+ /**
46
+ * An optional count value, indicating the number of search results.
47
+ */
48
+ count?: number;
49
+ }
50
+ type FilterHeaderWithSearchProps = {
51
+ searchEnabled?: false;
52
+ searchProps?: never;
53
+ } | {
54
+ searchEnabled: true;
55
+ searchProps: FilterSearchProps;
56
+ };
57
+ type FilterHeaderProps = FilterHeaderCommonProps & FilterHeaderWithSearchProps;
58
+ /**
59
+ * FilterHeader is a React component that renders the header for a filter, including search functionality and reset options.
60
+ *
61
+ * @returns {JSX.Element} - Returns the FilterHeader component.
62
+ */
63
+ export declare const FilterHeader: ({ filterKey, title, searchEnabled, searchProps, filterHasChanged, resetIndividualFilterToInitialState, onResetFilter, loading, }: FilterHeaderProps) => JSX.Element;
64
+ export {};
@@ -0,0 +1,14 @@
1
+ /// <reference types="react" />
2
+ interface Props<T> {
3
+ results: T[] | undefined | null;
4
+ loading?: boolean;
5
+ children: (results: T[]) => JSX.Element;
6
+ }
7
+ /**
8
+ * Wrapper around results for filters.
9
+ * Shows spinner if loading,
10
+ * shows no results if length or array is 0
11
+ * otherwise it calls children as a render prop
12
+ */
13
+ export declare const FilterResults: <T extends string | object>({ results, loading, children }: Props<T>) => JSX.Element | null;
14
+ export {};
@@ -0,0 +1,26 @@
1
+ import { ReactElement } from "react";
2
+ interface ResetFiltersProps {
3
+ /**
4
+ * A function that checks if a filter is included by its key.
5
+ *
6
+ * @param key - The key of the filter to check.
7
+ * @returns `true` if the filter is included, `false` otherwise.
8
+ */
9
+ isFilterIncludedByKey: (key: string) => boolean;
10
+ /**
11
+ * A function that resets the filters to their initial state.
12
+ */
13
+ resetFiltersToInitialState: () => void;
14
+ /**
15
+ * Indicates whether filters have been applied.
16
+ * If `true`, filters have been applied; if `false`, no filters are applied.
17
+ */
18
+ filtersHaveBeenApplied: boolean;
19
+ }
20
+ /**
21
+ * ResetFiltersButton is a React component that provides a button for resetting filters.
22
+ *
23
+ * @returns {ReactElement | null} The rendered ResetFiltersButton component, or null if no filters have been applied.
24
+ */
25
+ export declare const ResetFiltersButton: ({ isFilterIncludedByKey, filtersHaveBeenApplied, resetFiltersToInitialState, }: ResetFiltersProps) => ReactElement | null;
26
+ export {};
@@ -0,0 +1,25 @@
1
+ /// <reference types="react" />
2
+ import { FilterBarConfig, FilterBarDefinition, FilterMapActions, FilterMapGetter } from "../types/FilterTypes";
3
+ interface StarredFiltersProps<TFilterBarDefinition extends FilterBarDefinition> {
4
+ /**
5
+ * Configuration for the filter bar, including actions and getters.
6
+ * This is parameterized by the specific filter bar definition type.
7
+ */
8
+ filterBarConfig: FilterBarConfig<TFilterBarDefinition> & FilterMapActions & FilterMapGetter;
9
+ /**
10
+ * The definition of the filter bar, specifying its structure and filters.
11
+ */
12
+ filterBarDefinition: FilterBarDefinition;
13
+ /**
14
+ * If you want some of the filters to be hidden, but still programmatically enabled
15
+ */
16
+ hiddenFilters?: string[];
17
+ }
18
+ /**
19
+ * StarredFilters is a React component that displays a list of starred filters based on the provided filter bar configuration.
20
+ *
21
+ * @template TFilterBarDefinition - The type representing the filter bar definition.
22
+ * @returns {JSX.Element} - Returns the StarredFilters component.
23
+ */
24
+ export declare const StarredFilters: <TFilterBarDefinition extends FilterBarDefinition>({ filterBarDefinition, filterBarConfig, hiddenFilters, }: StarredFiltersProps<TFilterBarDefinition>) => JSX.Element;
25
+ export {};
@@ -0,0 +1,29 @@
1
+ /// <reference types="react" />
2
+ import { FilterBarDefinition } from "../types/FilterTypes";
3
+ interface Props {
4
+ /**
5
+ * An array of keys representing the starred filters.
6
+ */
7
+ starredFilterKeys: string[];
8
+ /**
9
+ * If you want some of the filters to be hidden, but still programmatically enabled
10
+ */
11
+ hiddenFilters?: string[];
12
+ /**
13
+ * A callback function used to update the starred filters.
14
+ *
15
+ * @param filterKey - The key of the filter to be updated.
16
+ */
17
+ updateStarredFilters: (filterKey: string) => void;
18
+ /**
19
+ * The definition of the filter bar, including its structure and available filter options.
20
+ */
21
+ filterBarDefinition: FilterBarDefinition;
22
+ }
23
+ /**
24
+ * StarredFiltersMenu is a React component that displays a menu of starred filters within a filter bar.
25
+ *
26
+ * @returns {JSX.Element} - Returns the StarredFiltersMenu component.
27
+ */
28
+ export declare const StarredFiltersMenu: ({ filterBarDefinition, updateStarredFilters, starredFilterKeys, hiddenFilters, }: Props) => JSX.Element;
29
+ export {};
@@ -0,0 +1,26 @@
1
+ import { RefObject } from "react";
2
+ interface VirtualizedListProps<T> {
3
+ /**
4
+ * A reference to the parent container element that holds the virtualized list.
5
+ */
6
+ parentRef: RefObject<T>;
7
+ /**
8
+ * The total number of items in the virtualized list.
9
+ */
10
+ count: number;
11
+ /**
12
+ * A function that takes an index and returns the JSX element to be rendered for that index.
13
+ *
14
+ * @param index - The index of the item to render.
15
+ * @returns The JSX element representing the item at the specified index.
16
+ */
17
+ children: (index: number) => JSX.Element;
18
+ }
19
+ /**
20
+ * Render a virtualized list of items
21
+ *
22
+ * @template T - The type of data items in the list.
23
+ * @returns {JSX.Element} - Returns the virtualized list component.
24
+ */
25
+ export declare const VirtualizedList: <T extends {}>({ parentRef, count, children }: VirtualizedListProps<T>) => JSX.Element;
26
+ export {};
@@ -0,0 +1,9 @@
1
+ export * from "./DefaultCheckboxFilter";
2
+ export * from "./DefaultDateRangeFilter";
3
+ export * from "./DefaultFilterTypes";
4
+ export * from "./DefaultMinMaxFilter";
5
+ export * from "./DefaultRadioFilter";
6
+ export * from "./DynamicFilterList";
7
+ export * from "./FilterHeader";
8
+ export * from "./FilterResults";
9
+ export * from "./StarredFilters";
@@ -0,0 +1,59 @@
1
+ import { BooleanValue, BoundingBox, DateRangeValue, FilterBarDefinition, FilterStateValues, FilterValueType, InitialState, MinMaxFilterValue, NumberValue, ValueName } from "../types/FilterTypes";
2
+ export interface FilterBarProps<TFilterBarDefinition extends FilterBarDefinition> {
3
+ /**
4
+ * The name of the filter bar.
5
+ */
6
+ name: string;
7
+ /**
8
+ * An optional callback function that gets called when filter values change.
9
+ */
10
+ onValuesChange?: (values: FilterStateValues<TFilterBarDefinition>) => void;
11
+ /**
12
+ * An optional initial state for the filter bar.
13
+ */
14
+ initialState?: InitialState<TFilterBarDefinition>;
15
+ /**
16
+ * The filters that should potentially be used in the filter bar
17
+ */
18
+ filterBarDefinition: TFilterBarDefinition;
19
+ }
20
+ /**
21
+ * Custom hook for managing a filter bar's state and actions.
22
+ *
23
+ * @template TFilterBarDefinition - A generic type for the filter bar definition.
24
+ * @returns {object} An object containing filter bar configuration and actions.
25
+ */
26
+ export declare const useFilterBar: <TFilterBarDefinition extends FilterBarDefinition>({ name, onValuesChange, filterBarDefinition, initialState, }: FilterBarProps<TFilterBarDefinition>) => {
27
+ filterBarConfig: {
28
+ getFilterName: () => string;
29
+ objectArrayIncludesValue: (key: string, value: string) => boolean;
30
+ getValuesByKey: (key: string) => FilterValueType;
31
+ arrayIncludesValue: (key: string, value: string) => boolean;
32
+ filtersHaveBeenApplied: boolean;
33
+ filterHasChanged(key: string): boolean;
34
+ isFilterIncludedByKey(key: string): boolean;
35
+ /**
36
+ * An optional initial state for the filter bar.
37
+ */
38
+ updateStarredFilters: (filterkey: string) => void;
39
+ toggleArrayValue: (key: string, value: string) => void;
40
+ setStringValue: (key: string, value: string) => void;
41
+ setArrayValue: (key: string, value: string[]) => void;
42
+ setBoundingBox: (boundingBox: BoundingBox) => void;
43
+ setNumberValue: (key: string, value: NumberValue) => void;
44
+ setBooleanValue: (key: string, value: BooleanValue) => void;
45
+ setDateRange: (key: string, value: DateRangeValue) => void;
46
+ setMinMaxValue: (key: string, minMaxValue: MinMaxFilterValue) => void;
47
+ setArrayObjectValue: (key: string, value: ValueName[]) => void;
48
+ toggleArrayObjectValue: (key: string, value: ValueName) => void;
49
+ resetFiltersToInitialState: () => void;
50
+ resetIndividualFilterToInitialState: (key: string) => void;
51
+ name: string;
52
+ initialState: InitialState<TFilterBarDefinition>;
53
+ filterNames: Extract<keyof TFilterBarDefinition, string>[];
54
+ starredFilterKeys: Extract<keyof TFilterBarDefinition, string>[];
55
+ values: FilterStateValues<TFilterBarDefinition>;
56
+ setters: import("../types/FilterTypes").FilterStateSetters<TFilterBarDefinition>;
57
+ };
58
+ filterBarDefinition: TFilterBarDefinition;
59
+ };
@@ -0,0 +1,23 @@
1
+ import { FilterDefinition } from "../types/FilterTypes";
2
+ interface GroupOfFilters {
3
+ /**
4
+ * A unique key that identifies the group of filters.
5
+ */
6
+ key: string;
7
+ /**
8
+ * An array of filter definitions that belong to this group.
9
+ */
10
+ filters: FilterDefinition[];
11
+ }
12
+ interface UseGroupFiltersReturnType {
13
+ filtersGrouped: GroupOfFilters[];
14
+ }
15
+ /**
16
+ * Custom React hook for grouping and filtering a list of filters.
17
+ *
18
+ * @param {FilterDefinition[]} filterDefinitions - The list of filter definitions to group and filter.
19
+ * @param {string[]} hiddenFilters - An array of filter keys representing filters to be hidden.
20
+ * @returns {UseGroupFiltersReturnType} An object containing the grouped filters.
21
+ */
22
+ export declare const useStarredGroupFilters: (filterDefinitions: FilterDefinition[], hiddenFilters: string[]) => UseGroupFiltersReturnType;
23
+ export {};
@@ -0,0 +1,6 @@
1
+ export * from "./FilterBar";
2
+ export * from "./components";
3
+ export * from "./hooks/useFilterBar";
4
+ export * from "./types/FilterTypes";
5
+ export * from "./utils/mergeFilters";
6
+ export * from "./utils/toggleFilterValue";