@equinor/fusion-react-filter 2.1.0-filter.8 → 2.1.1
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.
- package/LICENSE +21 -0
- package/components/package.json +1 -1
- package/dist/FilterProvider.d.ts +3 -3
- package/dist/FilterProvider.d.ts.map +1 -1
- package/dist/FilterProvider.js +7 -7
- package/dist/actions.d.ts +3 -3
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +1 -1
- package/dist/components/filter/FilterOptionHeader.d.ts +4 -4
- package/dist/components/filter/FilterOptionHeader.d.ts.map +1 -1
- package/dist/components/filter/FilterOptionHeader.js +55 -48
- package/dist/components/filter/checkbox/CheckboxFilter.d.ts +16 -6
- package/dist/components/filter/checkbox/CheckboxFilter.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilter.js +4 -5
- package/dist/components/filter/checkbox/CheckboxFilter.style.d.ts +9 -4
- package/dist/components/filter/checkbox/CheckboxFilter.style.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilter.style.js +21 -19
- package/dist/components/filter/checkbox/CheckboxFilterOption.d.ts +8 -7
- package/dist/components/filter/checkbox/CheckboxFilterOption.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilterOption.js +4 -11
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.d.ts +10 -2
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.js +37 -41
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.d.ts +2 -1
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.js +7 -8
- package/dist/components/filter/checkbox/CheckboxFilterOptions.d.ts +7 -1
- package/dist/components/filter/checkbox/CheckboxFilterOptions.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilterOptions.js +6 -8
- package/dist/components/filter/checkbox/CheckboxFilterProvider.d.ts +9 -5
- package/dist/components/filter/checkbox/CheckboxFilterProvider.d.ts.map +1 -1
- package/dist/components/filter/checkbox/CheckboxFilterProvider.js +12 -5
- package/dist/components/filter/checkbox/context.d.ts +1 -1
- package/dist/components/filter/checkbox/context.d.ts.map +1 -1
- package/dist/components/filter/checkbox/context.js +0 -1
- package/dist/components/filter/checkbox/index.d.ts +1 -1
- package/dist/components/filter/checkbox/index.d.ts.map +1 -1
- package/dist/components/filter/checkbox/index.js +0 -1
- package/dist/components/filter/checkbox/types.d.ts +2 -2
- package/dist/components/filter/checkbox/types.d.ts.map +1 -1
- package/dist/components/filter/checkbox/types.js +0 -1
- package/dist/components/filter/index.js +0 -1
- package/dist/components/filter/search/SearchFilter.d.ts +6 -5
- package/dist/components/filter/search/SearchFilter.d.ts.map +1 -1
- package/dist/components/filter/search/SearchFilter.js +9 -8
- package/dist/components/filter/search/index.js +0 -1
- package/dist/components/filter/types.d.ts +1 -1
- package/dist/components/filter/types.d.ts.map +1 -1
- package/dist/components/filter/types.js +0 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +0 -1
- package/dist/components/misc/ClearFilterButton.d.ts +6 -4
- package/dist/components/misc/ClearFilterButton.d.ts.map +1 -1
- package/dist/components/misc/ClearFilterButton.js +8 -8
- package/dist/components/misc/FilterContainer.d.ts +7 -6
- package/dist/components/misc/FilterContainer.d.ts.map +1 -1
- package/dist/components/misc/FilterContainer.js +13 -14
- package/dist/components/misc/SelectionChips.d.ts +5 -4
- package/dist/components/misc/SelectionChips.d.ts.map +1 -1
- package/dist/components/misc/SelectionChips.js +29 -22
- package/dist/components/misc/index.js +0 -1
- package/dist/components/panel/FilterPanel.d.ts +7 -3
- package/dist/components/panel/FilterPanel.d.ts.map +1 -1
- package/dist/components/panel/FilterPanel.js +29 -30
- package/dist/components/panel/FilterPanelBar.d.ts +6 -2
- package/dist/components/panel/FilterPanelBar.d.ts.map +1 -1
- package/dist/components/panel/FilterPanelBar.js +29 -28
- package/dist/components/panel/FilterPanelFilters.d.ts +4 -4
- package/dist/components/panel/FilterPanelFilters.d.ts.map +1 -1
- package/dist/components/panel/FilterPanelFilters.js +4 -4
- package/dist/components/panel/FilterPanelProvider.d.ts +12 -12
- package/dist/components/panel/FilterPanelProvider.d.ts.map +1 -1
- package/dist/components/panel/FilterPanelProvider.js +4 -4
- package/dist/components/panel/FilterPanelSelector.d.ts +3 -3
- package/dist/components/panel/FilterPanelSelector.d.ts.map +1 -1
- package/dist/components/panel/FilterPanelSelector.js +4 -5
- package/dist/components/panel/index.js +0 -1
- package/dist/context.d.ts +1 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/hooks/index.js +0 -1
- package/dist/hooks/useClearFilter.d.ts.map +1 -1
- package/dist/hooks/useClearFilter.js +4 -4
- package/dist/hooks/useFilter.d.ts +1 -1
- package/dist/hooks/useFilter.d.ts.map +1 -1
- package/dist/hooks/useFilter.js +0 -1
- package/dist/hooks/useFilterData.d.ts +4 -4
- package/dist/hooks/useFilterData.d.ts.map +1 -1
- package/dist/hooks/useFilterData.js +5 -3
- package/dist/hooks/useFilterSelection.d.ts +1 -1
- package/dist/hooks/useFilterSelection.d.ts.map +1 -1
- package/dist/hooks/useFilterSelection.js +4 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/options/FilterOptionProvider.d.ts +3 -3
- package/dist/options/FilterOptionProvider.d.ts.map +1 -1
- package/dist/options/FilterOptionProvider.js +2 -3
- package/dist/options/actions.d.ts +2 -2
- package/dist/options/actions.d.ts.map +1 -1
- package/dist/options/actions.js +0 -1
- package/dist/options/context.d.ts +1 -2
- package/dist/options/context.d.ts.map +1 -1
- package/dist/options/context.js +2 -2
- package/dist/options/create-options.d.ts +1 -1
- package/dist/options/create-options.d.ts.map +1 -1
- package/dist/options/create-options.js +3 -2
- package/dist/options/index.d.ts +1 -1
- package/dist/options/index.d.ts.map +1 -1
- package/dist/options/index.js +1 -2
- package/dist/options/reducer.d.ts +11 -11
- package/dist/options/reducer.d.ts.map +1 -1
- package/dist/options/reducer.js +1 -1
- package/dist/options/search/filter-option-match.d.ts.map +1 -1
- package/dist/options/search/filter-option-match.js +0 -1
- package/dist/options/search/filter-option-search.d.ts +1 -4
- package/dist/options/search/filter-option-search.d.ts.map +1 -1
- package/dist/options/search/filter-option-search.js +3 -2
- package/dist/options/search/index.js +0 -1
- package/dist/options/search/types.d.ts +2 -2
- package/dist/options/search/types.d.ts.map +1 -1
- package/dist/options/search/types.js +0 -1
- package/dist/options/search/useFilterOptionSearch.d.ts +1 -4
- package/dist/options/search/useFilterOptionSearch.d.ts.map +1 -1
- package/dist/options/search/useFilterOptionSearch.js +0 -1
- package/dist/options/types.d.ts +11 -11
- package/dist/options/types.d.ts.map +1 -1
- package/dist/options/types.js +0 -1
- package/dist/reducers.d.ts +34 -34
- package/dist/reducers.d.ts.map +1 -1
- package/dist/reducers.js +4 -2
- package/dist/types.d.ts +12 -12
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/options/package.json +2 -2
- package/package.json +30 -20
- package/dist/FilterProvider.js.map +0 -1
- package/dist/actions.js.map +0 -1
- package/dist/components/filter/FilterOptionHeader.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilter.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilter.style.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilterOption.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilterOptions.js.map +0 -1
- package/dist/components/filter/checkbox/CheckboxFilterProvider.js.map +0 -1
- package/dist/components/filter/checkbox/context.js.map +0 -1
- package/dist/components/filter/checkbox/index.js.map +0 -1
- package/dist/components/filter/checkbox/types.js.map +0 -1
- package/dist/components/filter/index.js.map +0 -1
- package/dist/components/filter/search/SearchFilter.js.map +0 -1
- package/dist/components/filter/search/index.js.map +0 -1
- package/dist/components/filter/types.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/misc/ClearFilterButton.js.map +0 -1
- package/dist/components/misc/FilterContainer.js.map +0 -1
- package/dist/components/misc/SelectionChips.js.map +0 -1
- package/dist/components/misc/index.js.map +0 -1
- package/dist/components/panel/FilterPanel.js.map +0 -1
- package/dist/components/panel/FilterPanelBar.js.map +0 -1
- package/dist/components/panel/FilterPanelFilters.js.map +0 -1
- package/dist/components/panel/FilterPanelProvider.js.map +0 -1
- package/dist/components/panel/FilterPanelSelector.js.map +0 -1
- package/dist/components/panel/index.js.map +0 -1
- package/dist/context.js.map +0 -1
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/useClearFilter.js.map +0 -1
- package/dist/hooks/useFilter.js.map +0 -1
- package/dist/hooks/useFilterData.js.map +0 -1
- package/dist/hooks/useFilterSelection.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/options/FilterOptionProvider.js.map +0 -1
- package/dist/options/actions.js.map +0 -1
- package/dist/options/context.js.map +0 -1
- package/dist/options/create-options.js.map +0 -1
- package/dist/options/index.js.map +0 -1
- package/dist/options/reducer.js.map +0 -1
- package/dist/options/search/filter-option-match.js.map +0 -1
- package/dist/options/search/filter-option-search.js.map +0 -1
- package/dist/options/search/index.js.map +0 -1
- package/dist/options/search/types.js.map +0 -1
- package/dist/options/search/useFilterOptionSearch.js.map +0 -1
- package/dist/options/types.js.map +0 -1
- package/dist/reducers.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
type CheckboxFilterOptionsProps = {
|
|
3
|
+
readonly sortFn?: <T extends {
|
|
4
|
+
label: string;
|
|
5
|
+
}>(a: T, b: T) => number;
|
|
6
|
+
};
|
|
7
|
+
export declare const CheckboxFilterOptions: ({ sortFn }: CheckboxFilterOptionsProps) => ReactElement;
|
|
2
8
|
export default CheckboxFilterOptions;
|
|
3
9
|
//# sourceMappingURL=CheckboxFilterOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilterOptions.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOptions.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxFilterOptions.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOptions.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,OAAO,CAAC;AAUvD,KAAK,0BAA0B,GAAG;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;CACvE,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,YAAY,0BAA0B,KAAG,YAyC9E,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
-
import { useObservableRef, useObservableState } from '@equinor/fusion-react
|
|
3
|
+
import { useObservableRef, useObservableState } from '@equinor/fusion-observable/react';
|
|
4
4
|
import { useCheckboxFilterOptionContext } from './context';
|
|
5
5
|
import { CheckboxFilterOption } from './CheckboxFilterOption';
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
export const CheckboxFilterOptions = () => {
|
|
6
|
+
const defaultSortFn = (a, b) => a.label.localeCompare(b.label);
|
|
7
|
+
export const CheckboxFilterOptions = ({ sortFn }) => {
|
|
9
8
|
const context = useCheckboxFilterOptionContext();
|
|
10
|
-
const data = useObservableState(context.options$);
|
|
9
|
+
const { value: data } = useObservableState(context.options$);
|
|
11
10
|
const selectionRef = useObservableRef(context.selection$);
|
|
12
11
|
const onOptionChange = useCallback((item) => {
|
|
13
12
|
const selection = new Set(selectionRef.current || []);
|
|
@@ -30,8 +29,7 @@ export const CheckboxFilterOptions = () => {
|
|
|
30
29
|
inactive: !value.count,
|
|
31
30
|
hide: value.hide,
|
|
32
31
|
}))
|
|
33
|
-
.sort(sortFn);
|
|
34
|
-
return (_jsx(_Fragment, { children: itemProps.map((props) => (_jsx(CheckboxFilterOption,
|
|
32
|
+
.sort(sortFn ?? defaultSortFn);
|
|
33
|
+
return (_jsx(_Fragment, { children: itemProps.map((props) => (_jsx(CheckboxFilterOption, { ...props }, props.name))) }));
|
|
35
34
|
};
|
|
36
35
|
export default CheckboxFilterOptions;
|
|
37
|
-
//# sourceMappingURL=CheckboxFilterOptions.js.map
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
import { FilterOptionBuilder, FilterOptionSelector } from '../../../options/types';
|
|
1
|
+
import { type ReactElement, type PropsWithChildren } from 'react';
|
|
2
|
+
import type { FilterOptionBuilder, FilterOptionSelector } from '../../../options/types';
|
|
3
3
|
import type { CheckboxOption } from './types';
|
|
4
|
-
|
|
4
|
+
import type { FilterFn } from '../../../types';
|
|
5
|
+
export type CheckboxFilterProviderProps<TData extends Record<string, any>, TOption extends CheckboxOption = CheckboxOption> = {
|
|
5
6
|
filterKey: string;
|
|
6
7
|
title?: string;
|
|
7
|
-
|
|
8
|
+
filter?: {
|
|
9
|
+
filterFn: FilterFn<TData, Set<string>>;
|
|
10
|
+
optionFn: FilterOptionBuilder<TData, TOption, string>;
|
|
11
|
+
};
|
|
8
12
|
selector?: Extract<keyof TData, string> | string | FilterOptionSelector<TData>;
|
|
9
13
|
initial?: Set<string>;
|
|
10
14
|
};
|
|
11
|
-
export declare const CheckboxFilterProvider: <TData extends Record<string, any>, TOptions extends CheckboxOption = CheckboxOption>(props:
|
|
15
|
+
export declare const CheckboxFilterProvider: <TData extends Record<string, any>, TOptions extends CheckboxOption = CheckboxOption>(props: PropsWithChildren<CheckboxFilterProviderProps<TData, TOptions>>) => ReactElement;
|
|
12
16
|
export default CheckboxFilterProviderProps;
|
|
13
17
|
//# sourceMappingURL=CheckboxFilterProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilterProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterProvider.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CheckboxFilterProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAW,MAAM,OAAO,CAAC;AAI3E,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAExF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAU/C,MAAM,MAAM,2BAA2B,CAErC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjC,OAAO,SAAS,cAAc,GAAG,cAAc,IAC7C;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE;QACP,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,QAAQ,EAAE,mBAAmB,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;KACvD,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IAC/E,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,CAEnC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACjC,QAAQ,SAAS,cAAc,GAAG,cAAc,EAEhD,KAAK,EAAE,iBAAiB,CAAC,2BAA2B,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,KACnE,YA8BJ,CAAC;AAEF,eAAe,2BAA2B,CAAC"}
|
|
@@ -3,14 +3,21 @@ import { useMemo } from 'react';
|
|
|
3
3
|
import { FilterOptionProvider } from '../../../options/FilterOptionProvider';
|
|
4
4
|
import { propertySelector } from '../../../options/create-options';
|
|
5
5
|
const createFilterFn = (selector) => (data, selection) => {
|
|
6
|
-
return selection.size
|
|
6
|
+
return selection.size
|
|
7
|
+
? data.filter((x) => selection.has(selector(x).key))
|
|
8
|
+
: data;
|
|
7
9
|
};
|
|
8
10
|
export const CheckboxFilterProvider = (props) => {
|
|
9
|
-
const { filterKey, selector = filterKey,
|
|
11
|
+
const { filterKey, selector = filterKey, title, initial, filter, children } = props;
|
|
10
12
|
const selectorFn = useMemo(() => typeof selector === 'function'
|
|
11
13
|
? selector
|
|
12
14
|
: propertySelector(selector || selector), [selector]);
|
|
13
|
-
const filterFn = useMemo(() =>
|
|
14
|
-
|
|
15
|
+
const filterFn = useMemo(() => {
|
|
16
|
+
if (filter?.filterFn)
|
|
17
|
+
return filter.filterFn;
|
|
18
|
+
if (!selectorFn)
|
|
19
|
+
throw Error('Could not create filter. Please provide either filterFn or filterSelector.');
|
|
20
|
+
return createFilterFn(selectorFn);
|
|
21
|
+
}, [selectorFn, filter?.filterFn]);
|
|
22
|
+
return (_jsx(FilterOptionProvider, { selector: selectorFn, optionBuilder: filter?.optionFn, filter: { key: filterKey, title, initial, filterFn }, children: children }));
|
|
15
23
|
};
|
|
16
|
-
//# sourceMappingURL=CheckboxFilterProvider.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FilterOptionContext } from '../../../options';
|
|
1
|
+
import { type FilterOptionContext } from '../../../options';
|
|
2
2
|
import type { CheckboxOption } from './types';
|
|
3
3
|
export declare const useCheckboxFilterOptionContext: <TOption extends CheckboxOption = CheckboxOption, TValue = string>() => FilterOptionContext<TOption, TValue>;
|
|
4
4
|
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0B,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,8BAA8B,GACzC,OAAO,SAAS,cAAc,GAAG,cAAc,EAC/C,MAAM,GAAG,MAAM,OACZ,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAA8C,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CheckboxFilter, CheckboxFilterProps, default } from './CheckboxFilter';
|
|
1
|
+
export { CheckboxFilter, type CheckboxFilterProps, default } from './CheckboxFilter';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { type TextFieldProps } from '@equinor/eds-core-react';
|
|
2
3
|
import type { FilterFn } from '../../../types';
|
|
3
|
-
export
|
|
4
|
+
export type SearchFilterProps<TData> = Omit<TextFieldProps, 'onInput' | 'ref' | 'id'> & {
|
|
4
5
|
/** identifier for filter */
|
|
5
|
-
filterKey: string;
|
|
6
|
+
readonly filterKey: string;
|
|
6
7
|
/** function for filtering by provided query */
|
|
7
|
-
filterFn?: FilterFn<TData, string>;
|
|
8
|
+
readonly filterFn?: FilterFn<TData, string>;
|
|
8
9
|
};
|
|
9
10
|
/**
|
|
10
11
|
* Simple text filter
|
|
@@ -12,6 +13,6 @@ export declare type SearchFilterProps<TData> = Omit<TextInputProps, 'onInput' |
|
|
|
12
13
|
* __NOTE__ if not `filterFn` provided, default will be created, this filter is brute and
|
|
13
14
|
* `JSON.stringify` provided data object, this might not be optimal for heavy data sets.
|
|
14
15
|
*/
|
|
15
|
-
export declare const SearchFilter: <TData>(props: SearchFilterProps<TData>) =>
|
|
16
|
+
export declare const SearchFilter: <TData>(props: SearchFilterProps<TData>) => ReactElement;
|
|
16
17
|
export default SearchFilter;
|
|
17
18
|
//# sourceMappingURL=SearchFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/search/SearchFilter.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/search/SearchFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EAKlB,MAAM,OAAO,CAAC;AAIf,OAAO,EAAa,KAAK,cAAc,EAAQ,MAAM,yBAAyB,CAAC;AAI/E,OAAO,KAAK,EAAU,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAavD,MAAM,MAAM,iBAAiB,CAAC,KAAK,IAAI,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,KAAK,GAAG,IAAI,CAAC,GAAG;IACtF,4BAA4B;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,+CAA+C;IAC/C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,KAAK,EAAG,OAAO,iBAAiB,CAAC,KAAK,CAAC,KAAG,YAgDtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useMemo, useRef } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { useCallback, useMemo, useRef, } from 'react';
|
|
3
|
+
import { useObservableSelector } from '@equinor/fusion-observable/react';
|
|
4
|
+
import { TextField, Icon } from '@equinor/eds-core-react';
|
|
5
5
|
import { useFilter, useFilterSelection } from '../../../hooks';
|
|
6
|
+
import { search } from '@equinor/eds-icons';
|
|
7
|
+
Icon.add({ search });
|
|
6
8
|
const defaultMatcher = (data, query) => {
|
|
7
9
|
/** early escape, no filter */
|
|
8
10
|
if (!query)
|
|
9
11
|
return data;
|
|
10
12
|
const matcher = new RegExp(query, 'i');
|
|
11
|
-
return data.filter((x) => !!JSON.stringify(Object.values(x)).match(matcher));
|
|
13
|
+
return data.filter((x) => !!JSON.stringify(Object.values(x ?? {})).match(matcher));
|
|
12
14
|
};
|
|
13
15
|
/**
|
|
14
16
|
* Simple text filter
|
|
@@ -32,16 +34,15 @@ export const SearchFilter = (props) => {
|
|
|
32
34
|
setSelection(e.currentTarget.value);
|
|
33
35
|
}, [setSelection]);
|
|
34
36
|
/** subscribe to changes in the filter selection */
|
|
35
|
-
|
|
37
|
+
useObservableSelector(
|
|
36
38
|
/** create an observable selection for filter */
|
|
37
39
|
useFilterSelection(props.filterKey),
|
|
38
40
|
/** update value of text input when selection changes */
|
|
39
41
|
useCallback((query) => {
|
|
40
42
|
if (inputRef.current) {
|
|
41
|
-
inputRef.current.value = query || '';
|
|
43
|
+
inputRef.current.value = query ? Array.from(query)[0] || '' : '';
|
|
42
44
|
}
|
|
43
45
|
}, []));
|
|
44
|
-
return _jsx(
|
|
46
|
+
return (_jsx(TextField, { id: filterKey, ref: inputRef, onInput: onInput, type: "search", inputIcon: _jsx(Icon, { name: "search" }), ...args }));
|
|
45
47
|
};
|
|
46
48
|
export default SearchFilter;
|
|
47
|
-
//# sourceMappingURL=SearchFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/filter/types.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/filter/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG;IAC5B,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { FilterComponent, CheckboxFilter, FilterOptionHeader, SearchFilter } from './filter';
|
|
2
2
|
export { ClearFilterButton, FilterContainer, SelectionChips } from './misc';
|
|
3
|
-
export { FilterPanel } from './panel';
|
|
3
|
+
export { FilterPanel, FilterPanelProps } from './panel';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { type ReactElement, type ForwardedRef, type PropsWithChildren } from 'react';
|
|
2
|
+
import { type ButtonProps } from '@equinor/eds-core-react';
|
|
3
|
+
export type ClearFilterButtonProps = PropsWithChildren<Omit<ButtonProps, 'onClick'> & {
|
|
4
|
+
ref?: ForwardedRef<HTMLButtonElement>;
|
|
5
|
+
}>;
|
|
3
6
|
/**
|
|
4
7
|
* Component for resetting filter values.
|
|
5
8
|
* uses the `useClearFilter` hook
|
|
6
|
-
* inherits `ButtonProps` from `@equinor/fusion-react-button`
|
|
7
9
|
*/
|
|
8
|
-
export declare const ClearFilterButton: (props: ClearFilterButtonProps) =>
|
|
10
|
+
export declare const ClearFilterButton: (props: ClearFilterButtonProps) => ReactElement;
|
|
9
11
|
export default ClearFilterButton;
|
|
10
12
|
//# sourceMappingURL=ClearFilterButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClearFilterButton.d.ts","sourceRoot":"","sources":["../../../src/components/misc/ClearFilterButton.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClearFilterButton.d.ts","sourceRoot":"","sources":["../../../src/components/misc/ClearFilterButton.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAIlG,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAInE,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CACpD,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC,CAAA;CAAE,CACzE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,sBAAsB,KAAG,YA0BjE,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useForwardRef } from '@equinor/fusion-react-utils';
|
|
4
|
-
import {
|
|
5
|
-
import { Button } from '@equinor/
|
|
4
|
+
import { useObservableSubscription } from '@equinor/fusion-observable/react';
|
|
5
|
+
import { Button } from '@equinor/eds-core-react';
|
|
6
6
|
import { useClearFilter } from '../../hooks/useClearFilter';
|
|
7
7
|
/**
|
|
8
8
|
* Component for resetting filter values.
|
|
9
9
|
* uses the `useClearFilter` hook
|
|
10
|
-
* inherits `ButtonProps` from `@equinor/fusion-react-button`
|
|
11
10
|
*/
|
|
12
11
|
export const ClearFilterButton = (props) => {
|
|
13
|
-
const {
|
|
12
|
+
const { children, ...args } = props;
|
|
14
13
|
const { clear, changed$ } = useClearFilter();
|
|
15
14
|
const ref = useForwardRef(props.ref);
|
|
16
15
|
/** Subscribe to changes and toggle `disable` of button */
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
useObservableSubscription(changed$, useCallback((changed) => {
|
|
17
|
+
if (ref.current) {
|
|
18
|
+
ref.current.disabled = !Object.keys(changed).length;
|
|
19
|
+
}
|
|
19
20
|
}, [ref]));
|
|
20
21
|
/** Reset filters on click */
|
|
21
22
|
const onClick = useCallback(() => clear(), [clear]);
|
|
22
|
-
return _jsx(Button,
|
|
23
|
+
return (_jsx(Button, { variant: "ghost", ...args, ref, onClick, children: children ?? 'Clear Filter' }));
|
|
23
24
|
};
|
|
24
25
|
export default ClearFilterButton;
|
|
25
|
-
//# sourceMappingURL=ClearFilterButton.js.map
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import type { ReactElement, PropsWithChildren, HTMLAttributes } from 'react';
|
|
2
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
3
|
+
type SpacingKey = keyof typeof tokens.spacings.comfortable;
|
|
4
|
+
type StyleProps = {
|
|
5
|
+
readonly spacing?: SpacingKey;
|
|
5
6
|
};
|
|
6
|
-
export
|
|
7
|
+
export type FilterContainerProps = HTMLAttributes<HTMLDivElement> & StyleProps;
|
|
7
8
|
/**
|
|
8
9
|
* Components for displaying filters
|
|
9
10
|
*/
|
|
10
|
-
export declare const FilterContainer: (props:
|
|
11
|
+
export declare const FilterContainer: (props: PropsWithChildren<FilterContainerProps>) => ReactElement;
|
|
11
12
|
export default FilterContainer;
|
|
12
13
|
//# sourceMappingURL=FilterContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterContainer.d.ts","sourceRoot":"","sources":["../../../src/components/misc/FilterContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FilterContainer.d.ts","sourceRoot":"","sources":["../../../src/components/misc/FilterContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE7E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,KAAK,UAAU,GAAG,MAAM,OAAO,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC;AAa3D,KAAK,UAAU,GAAG;IAChB,QAAQ,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG,UAAU,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,iBAAiB,CAAC,oBAAoB,CAAC,KAAG,YAOhF,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
4
|
+
const Styled = {
|
|
5
|
+
Root: styled.div `
|
|
6
|
+
display: inline-flex;
|
|
7
|
+
flex: auto;
|
|
8
|
+
gap: ${({ $spacing }) => tokens.spacings.comfortable[$spacing || 'medium']};
|
|
9
|
+
& > * {
|
|
10
|
+
flex: 1;
|
|
11
|
+
}
|
|
12
|
+
`,
|
|
13
|
+
};
|
|
13
14
|
/**
|
|
14
15
|
* Components for displaying filters
|
|
15
16
|
*/
|
|
16
17
|
export const FilterContainer = (props) => {
|
|
17
18
|
const { children, className, spacing, ...args } = props;
|
|
18
|
-
|
|
19
|
-
return (_jsx("div", Object.assign({ className: clsx(styles.root, className) }, args, { children: children }), void 0));
|
|
19
|
+
return (_jsx(Styled.Root, { className: className, "$spacing": spacing, ...args, children: children }));
|
|
20
20
|
};
|
|
21
21
|
export default FilterContainer;
|
|
22
|
-
//# sourceMappingURL=FilterContainer.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { type HTMLAttributes, type ReactElement } from 'react';
|
|
2
|
+
import { type ChipElementProps } from '@equinor/fusion-wc-chip';
|
|
3
|
+
export type SelectionChipsProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
readonly chips: Pick<ChipElementProps, 'variant'>;
|
|
4
5
|
};
|
|
5
|
-
export declare const SelectionChips: (props: SelectionChipsProps) =>
|
|
6
|
+
export declare const SelectionChips: (props: SelectionChipsProps) => ReactElement;
|
|
6
7
|
//# sourceMappingURL=SelectionChips.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionChips.d.ts","sourceRoot":"","sources":["../../../src/components/misc/SelectionChips.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectionChips.d.ts","sourceRoot":"","sources":["../../../src/components/misc/SelectionChips.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,YAAY,EAKlB,MAAM,OAAO,CAAC;AAIf,OAAa,EAAoB,KAAK,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AA0CxF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACjE,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,OAAO,mBAAmB,KAAG,YAsD3D,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState, } from 'react';
|
|
4
3
|
import { combineLatest, of } from 'rxjs';
|
|
5
4
|
import { switchMap } from 'rxjs/operators';
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
5
|
+
import { useObservableSubscription } from '@equinor/fusion-observable/react';
|
|
6
|
+
import Chip from '@equinor/fusion-wc-chip';
|
|
8
7
|
import { useFilterContext } from '../../hooks';
|
|
9
8
|
import { actions } from '../../actions';
|
|
10
|
-
import
|
|
9
|
+
import styled from 'styled-components';
|
|
10
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
11
|
+
Chip;
|
|
11
12
|
/** method for extracting selection to array */
|
|
13
|
+
// biome-ignore lint/suspicious/noExplicitAny: selection can be any type from the filter context
|
|
12
14
|
const formatSelection = (selection) => {
|
|
13
15
|
switch (true) {
|
|
14
16
|
case selection === undefined:
|
|
@@ -24,20 +26,21 @@ const formatSelection = (selection) => {
|
|
|
24
26
|
return [];
|
|
25
27
|
}
|
|
26
28
|
};
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
29
|
+
const Styled = {
|
|
30
|
+
Root: styled.div `
|
|
31
|
+
display: flex;
|
|
32
|
+
gap: ${tokens.spacings.comfortable.small};
|
|
33
|
+
`,
|
|
34
|
+
Chip: styled.span `
|
|
35
|
+
margin-right: ${tokens.spacings.comfortable.small};
|
|
36
|
+
`,
|
|
37
|
+
};
|
|
36
38
|
export const SelectionChips = (props) => {
|
|
37
39
|
const { chips, className, ...args } = props;
|
|
38
40
|
const { filter$, selection$ } = useFilterContext();
|
|
39
41
|
const [items, setItems] = useState([]);
|
|
40
|
-
|
|
42
|
+
const ref = useRef(null);
|
|
43
|
+
useObservableSubscription(useMemo(() =>
|
|
41
44
|
/** Observe filter and selection changes */
|
|
42
45
|
combineLatest([filter$, selection$]).pipe(switchMap(([filters, selections]) => {
|
|
43
46
|
const items = Object.values(filters)
|
|
@@ -51,12 +54,16 @@ export const SelectionChips = (props) => {
|
|
|
51
54
|
.filter((x) => !!x.title && !!x.selection.length);
|
|
52
55
|
return of(items);
|
|
53
56
|
})), [filter$, selection$]), setItems);
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const el = ref.current;
|
|
59
|
+
if (el) {
|
|
60
|
+
const handler = (e) => {
|
|
61
|
+
const value = e.target.value;
|
|
62
|
+
selection$.next(actions.selection.remove(String(value)));
|
|
63
|
+
};
|
|
64
|
+
el.addEventListener('remove', handler);
|
|
65
|
+
return () => el.removeEventListener('remove', handler);
|
|
66
|
+
}
|
|
56
67
|
}, [selection$]);
|
|
57
|
-
|
|
58
|
-
return (_jsx("div", Object.assign({}, args, { className: clsx(styles.root, className) }, { children: items?.map((x) => (_createElement(Chip, { ...chips, key: x.key, value: x.key, onRemove: onRemove, removable: true },
|
|
59
|
-
_jsxs("span", { children: [x.title, " "] }, void 0),
|
|
60
|
-
_jsx("span", Object.assign({ slot: "graphic", className: styles.chip }, { children: x.selection.length }), void 0)))) }), void 0));
|
|
68
|
+
return (_jsx(Styled.Root, { ...args, className: className, ref: ref, children: items?.map((x) => (_jsxs("fwc-chip", { value: x.key, removable: true, variant: chips.variant, children: [_jsxs("span", { children: [x.title, " "] }), _jsx(Styled.Chip, { slot: "graphic", children: x.selection.length })] }, x.key))) }));
|
|
61
69
|
};
|
|
62
|
-
//# sourceMappingURL=SelectionChips.js.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { type PropsWithChildren, type HTMLAttributes, type ReactElement } from 'react';
|
|
2
|
+
import type { FilterFn } from '../../types';
|
|
3
|
+
type StyleClasses = {
|
|
2
4
|
/** filter panel */
|
|
3
5
|
root: string;
|
|
4
6
|
/** filter container */
|
|
5
7
|
filters: string;
|
|
6
8
|
};
|
|
7
|
-
export
|
|
9
|
+
export type FilterPanelProps<TData> = HTMLAttributes<HTMLDivElement> & {
|
|
8
10
|
/** Show filter bar */
|
|
9
11
|
showBar?: boolean;
|
|
10
12
|
/** Show selector for filters */
|
|
@@ -20,10 +22,12 @@ export declare type FilterPanelProps = JSX.IntrinsicElements['div'] & {
|
|
|
20
22
|
selectedFilters?: string[];
|
|
21
23
|
/** style classes */
|
|
22
24
|
classes?: Partial<StyleClasses>;
|
|
25
|
+
/** method to use for search bar */
|
|
26
|
+
searchFn?: FilterFn<TData, string>;
|
|
23
27
|
};
|
|
24
28
|
/**
|
|
25
29
|
* Base component for displaying filter components and controllers
|
|
26
30
|
*/
|
|
27
|
-
export declare const FilterPanel: (props:
|
|
31
|
+
export declare const FilterPanel: <TData>(props: PropsWithChildren<FilterPanelProps<TData>>) => ReactElement;
|
|
28
32
|
export default FilterPanel;
|
|
29
33
|
//# sourceMappingURL=FilterPanel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterPanel.d.ts","sourceRoot":"","sources":["../../../src/components/panel/FilterPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterPanel.d.ts","sourceRoot":"","sources":["../../../src/components/panel/FilterPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAajG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AA0B5C,KAAK,YAAY,GAAG;IAClB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,KAAK,IAAI,cAAc,CAAC,cAAc,CAAC,GAAG;IACrE,sBAAsB;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,gCAAgC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,gDAAgD;IAChD,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAE3B,oBAAoB;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IAEhC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;CACpC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,CAAC,KAAK,EAC9B,KAAK,EAAE,iBAAiB,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,KAC9C,YA4BJ,CAAC;AAEF,eAAe,WAAW,CAAC"}
|