@equinor/fusion-react-filter 2.1.0-filter.7 → 2.1.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.
- 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 -6
- package/dist/FilterProvider.js.map +1 -1
- package/dist/actions.d.ts +3 -3
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +1 -0
- package/dist/actions.js.map +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 -47
- package/dist/components/filter/FilterOptionHeader.js.map +1 -1
- 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 -4
- package/dist/components/filter/checkbox/CheckboxFilter.js.map +1 -1
- 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 -18
- package/dist/components/filter/checkbox/CheckboxFilter.style.js.map +1 -1
- 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 -10
- package/dist/components/filter/checkbox/CheckboxFilterOption.js.map +1 -1
- 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 -39
- package/dist/components/filter/checkbox/CheckboxFilterOption.style.js.map +1 -1
- 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 -7
- package/dist/components/filter/checkbox/CheckboxFilterOptionAll.js.map +1 -1
- 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 -7
- package/dist/components/filter/checkbox/CheckboxFilterOptions.js.map +1 -1
- 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 -4
- package/dist/components/filter/checkbox/CheckboxFilterProvider.js.map +1 -1
- 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.map +1 -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.map +1 -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/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 -7
- package/dist/components/filter/search/SearchFilter.js.map +1 -1
- package/dist/components/filter/types.d.ts +1 -1
- package/dist/components/filter/types.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js.map +1 -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 -7
- package/dist/components/misc/ClearFilterButton.js.map +1 -1
- 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 -9
- package/dist/components/misc/FilterContainer.js.map +1 -1
- 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 -21
- package/dist/components/misc/SelectionChips.js.map +1 -1
- package/dist/components/panel/FilterPanel.d.ts +9 -3
- package/dist/components/panel/FilterPanel.d.ts.map +1 -1
- package/dist/components/panel/FilterPanel.js +29 -18
- package/dist/components/panel/FilterPanel.js.map +1 -1
- 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 -27
- package/dist/components/panel/FilterPanelBar.js.map +1 -1
- 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 -3
- package/dist/components/panel/FilterPanelFilters.js.map +1 -1
- 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 -3
- package/dist/components/panel/FilterPanelProvider.js.map +1 -1
- 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 -4
- package/dist/components/panel/FilterPanelSelector.js.map +1 -1
- package/dist/context.d.ts +1 -2
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -0
- package/dist/context.js.map +1 -1
- package/dist/hooks/useClearFilter.d.ts.map +1 -1
- package/dist/hooks/useClearFilter.js +4 -3
- package/dist/hooks/useClearFilter.js.map +1 -1
- package/dist/hooks/useFilter.d.ts +1 -1
- package/dist/hooks/useFilter.d.ts.map +1 -1
- package/dist/hooks/useFilter.js.map +1 -1
- package/dist/hooks/useFilterData.d.ts +4 -4
- package/dist/hooks/useFilterData.d.ts.map +1 -1
- package/dist/hooks/useFilterData.js +5 -2
- package/dist/hooks/useFilterData.js.map +1 -1
- package/dist/hooks/useFilterSelection.d.ts +1 -1
- package/dist/hooks/useFilterSelection.d.ts.map +1 -1
- package/dist/hooks/useFilterSelection.js +4 -2
- package/dist/hooks/useFilterSelection.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/options/FilterOptionProvider.d.ts +3 -3
- package/dist/options/FilterOptionProvider.d.ts.map +1 -1
- package/dist/options/FilterOptionProvider.js +2 -2
- package/dist/options/FilterOptionProvider.js.map +1 -1
- package/dist/options/actions.d.ts +2 -2
- package/dist/options/actions.d.ts.map +1 -1
- package/dist/options/actions.js.map +1 -1
- package/dist/options/context.d.ts +1 -2
- package/dist/options/context.d.ts.map +1 -1
- package/dist/options/context.js +2 -1
- package/dist/options/context.js.map +1 -1
- 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 -1
- package/dist/options/create-options.js.map +1 -1
- package/dist/options/index.d.ts +1 -1
- package/dist/options/index.d.ts.map +1 -1
- package/dist/options/index.js +1 -1
- package/dist/options/index.js.map +1 -1
- package/dist/options/reducer.d.ts +11 -11
- package/dist/options/reducer.d.ts.map +1 -1
- package/dist/options/reducer.js +1 -0
- package/dist/options/reducer.js.map +1 -1
- package/dist/options/search/filter-option-match.d.ts.map +1 -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 -1
- package/dist/options/search/filter-option-search.js.map +1 -1
- package/dist/options/search/types.d.ts +2 -2
- package/dist/options/search/types.d.ts.map +1 -1
- package/dist/options/search/useFilterOptionSearch.d.ts +1 -4
- package/dist/options/search/useFilterOptionSearch.d.ts.map +1 -1
- package/dist/options/types.d.ts +11 -11
- package/dist/options/types.d.ts.map +1 -1
- package/dist/reducers.d.ts +34 -34
- package/dist/reducers.d.ts.map +1 -1
- package/dist/reducers.js +4 -1
- package/dist/reducers.js.map +1 -1
- package/dist/types.d.ts +12 -12
- package/dist/types.d.ts.map +1 -1
- package/options/package.json +2 -2
- package/package.json +30 -20
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Equinor
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/components/package.json
CHANGED
package/dist/FilterProvider.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import { type PropsWithChildren, type ReactElement } from 'react';
|
|
2
2
|
import type { Filter } from './types';
|
|
3
|
-
export
|
|
3
|
+
export type FilterProviderProps<TSelections extends Record<string, unknown>, TData> = {
|
|
4
4
|
data: TData[];
|
|
5
5
|
initialSelection?: TSelections;
|
|
6
6
|
initialFilters?: Record<string, Filter<TData, TSelections>>;
|
|
7
7
|
};
|
|
8
|
-
export declare const FilterProvider: <TSelections extends Record<string, any>, TData extends Record<string, any> = Record<string, any>>(props:
|
|
8
|
+
export declare const FilterProvider: <TSelections extends Record<string, any>, TData extends Record<string, any> = Record<string, any>>(props: PropsWithChildren<FilterProviderProps<TSelections, TData>>) => ReactElement;
|
|
9
9
|
export default FilterProvider;
|
|
10
10
|
//# sourceMappingURL=FilterProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterProvider.d.ts","sourceRoot":"","sources":["../src/FilterProvider.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FilterProvider.d.ts","sourceRoot":"","sources":["../src/FilterProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAIlB,MAAM,OAAO,CAAC;AAYf,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,mBAAmB,CAAC,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,KAAK,IAAI;IACpF,IAAI,EAAE,KAAK,EAAE,CAAC;IACd,gBAAgB,CAAC,EAAE,WAAW,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC;CAC7D,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,CAE3B,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAEvC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAEvD,KAAK,EAAE,iBAAiB,CAAC,mBAAmB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,KAC9D,YA4CJ,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/FilterProvider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useLayoutEffect, useState } from 'react';
|
|
2
|
+
import { useLayoutEffect, useMemo, useState, } from 'react';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import { useObservable,
|
|
4
|
+
import { useObservable, useObservableSubscription } from '@equinor/fusion-observable/react';
|
|
5
5
|
import { createSelectionReducer, createDataReducer, createFilterReducer } from './reducers';
|
|
6
6
|
import { Provider } from './context';
|
|
7
7
|
import { actions } from './actions';
|
|
@@ -12,19 +12,20 @@ export const FilterProvider = (props) => {
|
|
|
12
12
|
const source$ = useObservable(createDataReducer(data), data);
|
|
13
13
|
const selection$ = useObservable(createSelectionReducer(initialSelection), initialSelection);
|
|
14
14
|
const filter$ = useObservable(createFilterReducer({}), initialFilters);
|
|
15
|
+
const filterData$ = useMemo(() => filterData(source$, filter$, selection$), [source$, filter$, selection$]);
|
|
15
16
|
const [data$] = useState(new BehaviorSubject(data));
|
|
16
|
-
|
|
17
|
-
const context = {
|
|
17
|
+
useObservableSubscription(filterData$, data$);
|
|
18
|
+
const context = useMemo(() => ({
|
|
18
19
|
source$,
|
|
19
20
|
filter$,
|
|
20
21
|
selection$,
|
|
21
22
|
data$,
|
|
22
23
|
/** type issues, might fix later */
|
|
23
|
-
};
|
|
24
|
+
}), [source$, filter$, selection$, data$]);
|
|
24
25
|
useLayoutEffect(() => {
|
|
25
26
|
source$.next(actions.source.update(data));
|
|
26
27
|
}, [source$, data]);
|
|
27
|
-
return _jsx(Provider,
|
|
28
|
+
return _jsx(Provider, { value: context, children: children });
|
|
28
29
|
};
|
|
29
30
|
export default FilterProvider;
|
|
30
31
|
//# sourceMappingURL=FilterProvider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterProvider.js","sourceRoot":"","sources":["../src/FilterProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FilterProvider.js","sourceRoot":"","sources":["../src/FilterProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAGL,eAAe,EACf,OAAO,EACP,QAAQ,GACT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAE5F,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO;AACP,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AASnD,MAAM,CAAC,MAAM,cAAc,GAOP,CAMlB,KAAiE,EACnD,EAAE;IAChB,MAAM,EACJ,IAAI,EACJ,gBAAgB,GAAG,EAAiB,EACpC,cAAc,GAAG,EAA4C,EAC7D,QAAQ,GACT,GAAG,KAAK,CAAC;IACV,MAAM,OAAO,GAAG,aAAa,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC;IAC7D,MAAM,UAAU,GAAG,aAAa,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAC7F,MAAM,OAAO,GAAG,aAAa,CAAC,mBAAmB,CAAC,EAAE,CAAC,EAAE,cAAc,CAAC,CAAC;IAEvE,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAC9C,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,CAC/B,CAAC;IAEF,MAAM,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC,CAAC;IAE7D,yBAAyB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAE9C,MAAM,OAAO,GAAG,OAAO,CACrB,GAAG,EAAE,CACH,CAAC;QACC,OAAO;QACP,OAAO;QACP,UAAU;QACV,KAAK;QACL,mCAAmC;KACpC,CAA6B,EAChC,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,CACtC,CAAC;IAEF,eAAe,CAAC,GAAG,EAAE;QACnB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,OAAO,KAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YAAG,QAAQ,GAAY,CAAC;AACzD,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
package/dist/actions.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionType } from 'typesafe-actions';
|
|
1
|
+
import { type ActionType } from 'typesafe-actions';
|
|
2
2
|
import type { Filter } from './types';
|
|
3
|
-
export
|
|
3
|
+
export type SelectionValues<TValue = unknown> = Record<string, TValue>;
|
|
4
4
|
export declare const filter: {
|
|
5
5
|
add: import("typesafe-actions").PayloadActionCreator<"@FILTER/FILTERS_ADD", Filter<any, any>>;
|
|
6
6
|
remove: import("typesafe-actions").PayloadActionCreator<"@FILTER/FILTERS_REMOVE", string>;
|
|
@@ -29,6 +29,6 @@ export declare const actions: {
|
|
|
29
29
|
update: import("typesafe-actions").PayloadActionCreator<"@FILTER/SOURCE_UPDATE", unknown>;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
export
|
|
32
|
+
export type Actions = ActionType<typeof actions>;
|
|
33
33
|
export default actions;
|
|
34
34
|
//# sourceMappingURL=actions.d.ts.map
|
package/dist/actions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,UAAU,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,MAAM,eAAe,CAAC,MAAM,GAAG,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,MAAM;;;CAIlB,CAAC;AAEF,eAAO,MAAM,SAAS;;;;;CAKrB,CAAC;AAEF,eAAO,MAAM,MAAM;;CAElB,CAAC;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;CAInB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;AAEjD,eAAe,OAAO,CAAC"}
|
package/dist/actions.js
CHANGED
package/dist/actions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,MAAM,kBAAkB,CAAC;AAKjE,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,oFAAoF;IACpF,GAAG,EAAE,YAAY,CAAC,qBAAqB,CAAC,EAAoB;IAC5D,MAAM,EAAE,YAAY,CAAC,wBAAwB,CAAC,EAAU;CACzD,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,GAAG,EAAE,YAAY,CAAC,uBAAuB,CAAC,EAAmB;IAC7D,OAAO,EAAE,YAAY,CAAC,2BAA2B,CAAC,EAAmB;IACrE,KAAK,EAAE,YAAY,CAAC,yBAAyB,CAAC,EAAQ;IACtD,MAAM,EAAE,YAAY,CAAC,0BAA0B,CAAC,EAAqB;CACtE,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,MAAM,EAAE,YAAY,CAAC,uBAAuB,CAAC,EAAW;CACzD,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,MAAM;IACN,SAAS;IACT,MAAM;CACP,CAAC;AAIF,eAAe,OAAO,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
type FilterHeaderProps = {
|
|
3
|
+
readonly title: string;
|
|
3
4
|
};
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const FilterOptionHeader: (props: FilterHeaderProps) => JSX.Element;
|
|
5
|
+
export declare const FilterOptionHeader: (props: FilterHeaderProps) => ReactElement;
|
|
6
6
|
export default FilterOptionHeader;
|
|
7
7
|
//# sourceMappingURL=FilterOptionHeader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterOptionHeader.d.ts","sourceRoot":"","sources":["../../../src/components/filter/FilterOptionHeader.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterOptionHeader.d.ts","sourceRoot":"","sources":["../../../src/components/filter/FilterOptionHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,YAAY,EAAqC,MAAM,OAAO,CAAC;AAY7F,KAAK,iBAAiB,GAAG;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;AA2CF,eAAO,MAAM,kBAAkB,GAAI,OAAO,iBAAiB,KAAG,YAuD7D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,55 +1,59 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useObservableState, useSelector } from '@equinor/fusion-react-observable';
|
|
3
|
-
import { Icon } from '@equinor/fusion-react-icon';
|
|
4
|
-
import { TextInput } from '@equinor/fusion-react-textinput';
|
|
5
|
-
import { useFilterOptionContext, useFilterOptionSearch } from '../../options';
|
|
6
|
-
import { clsx, createStyles, makeStyles } from '@equinor/fusion-react-styles';
|
|
7
2
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
3
|
+
import { useObservableState, useObservableSelector } from '@equinor/fusion-observable/react';
|
|
4
|
+
import { TextField, Icon } from '@equinor/eds-core-react';
|
|
5
|
+
import { useFilterOptionContext, useFilterOptionSearch } from '../../options';
|
|
6
|
+
import { search, chevron_right } from '@equinor/eds-icons';
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
9
|
+
Icon.add({ search, chevron_right });
|
|
10
|
+
const Styled = {
|
|
11
|
+
Root: styled.div `
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
`,
|
|
15
|
+
Header: styled.header `
|
|
16
|
+
color: ${tokens.typography.table.cell_header.color};
|
|
17
|
+
font-family: ${tokens.typography.table.cell_header.fontFamily};
|
|
18
|
+
font-size: ${tokens.typography.table.cell_header.fontSize};
|
|
19
|
+
font-weight: ${tokens.typography.table.cell_header.fontWeight};
|
|
20
|
+
line-height: ${tokens.typography.table.cell_header.lineHeight};
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
${({ $showSearch }) => $showSearch && 'display: none;'}
|
|
23
|
+
`,
|
|
24
|
+
Counter: styled.span `
|
|
25
|
+
display: ${({ $noCount }) => ($noCount ? 'none' : 'inline-flex')};
|
|
26
|
+
gap: 1px;
|
|
27
|
+
color: ${tokens.typography.input.helper.color};
|
|
28
|
+
font-family: ${tokens.typography.input.helper.fontFamily};
|
|
29
|
+
font-size: ${tokens.typography.input.helper.fontSize};
|
|
30
|
+
font-weight: ${tokens.typography.input.helper.fontWeight};
|
|
31
|
+
letter-spacing: ${tokens.typography.input.helper.letterSpacing};
|
|
32
|
+
line-height: ${tokens.typography.input.helper.lineHeight};
|
|
33
|
+
margin-left: ${tokens.spacings.comfortable.small};
|
|
34
|
+
`,
|
|
35
|
+
IconBtn: styled(Icon) `
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
margin-left: auto;
|
|
38
|
+
`,
|
|
39
|
+
SearchField: styled(TextField) `
|
|
40
|
+
margin-top: 4px;
|
|
41
|
+
flex: ${({ $showSearch }) => ($showSearch ? '1 1 auto' : 'none')};
|
|
42
|
+
${({ $showSearch }) => !$showSearch &&
|
|
43
|
+
`
|
|
44
|
+
max-width: 0;
|
|
45
|
+
overflow: hidden;
|
|
46
|
+
`}
|
|
47
|
+
`,
|
|
48
|
+
};
|
|
44
49
|
export const FilterOptionHeader = (props) => {
|
|
45
50
|
const { title } = props;
|
|
46
51
|
const [showSearch, setShowSearch] = useState(false);
|
|
47
52
|
const { setQuery, query$ } = useFilterOptionSearch();
|
|
48
53
|
const searchRef = useRef(null);
|
|
49
54
|
const { options$, selection$ } = useFilterOptionContext();
|
|
50
|
-
const optionCount = Object.keys(useObservableState(options$) || {}).length;
|
|
51
|
-
const selectedCount = useObservableState(
|
|
52
|
-
const styles = useStyles();
|
|
55
|
+
const optionCount = Object.keys(useObservableState(options$).value || {}).length;
|
|
56
|
+
const { value: selectedCount } = useObservableState(useObservableSelector(selection$, (x) => (x ?? new Set()).size > 0));
|
|
53
57
|
const onIconClick = () => {
|
|
54
58
|
if (showSearch) {
|
|
55
59
|
setQuery('');
|
|
@@ -60,10 +64,14 @@ export const FilterOptionHeader = (props) => {
|
|
|
60
64
|
setShowSearch(!showSearch);
|
|
61
65
|
};
|
|
62
66
|
useLayoutEffect(() => {
|
|
63
|
-
const subscription = query$.subscribe((x) =>
|
|
67
|
+
const subscription = query$.subscribe((x) => {
|
|
68
|
+
if (searchRef.current) {
|
|
69
|
+
searchRef.current.value = x;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
64
72
|
return () => subscription.unsubscribe();
|
|
65
|
-
}, [
|
|
66
|
-
return (_jsxs(
|
|
73
|
+
}, [query$]);
|
|
74
|
+
return (_jsxs(Styled.Root, { children: [_jsx(Styled.SearchField, { id: title, ref: searchRef, "$showSearch": showSearch, type: "search", placeholder: title, onInput: (e) => setQuery(e.currentTarget.value), inputIcon: _jsx(Icon, { name: "search", size: 16 }, "thumbs") }), _jsxs(Styled.Header, { "$showSearch": showSearch, children: [_jsx("span", { children: title }), _jsxs(Styled.Counter, { "$noCount": !selectedCount, children: [_jsx("span", { children: "(" }), _jsx("span", { children: selectedCount }), _jsx("span", { children: "/" }), _jsx("span", { children: optionCount }), _jsx("span", { children: ")" })] })] }), _jsx(Styled.IconBtn, { name: showSearch ? 'chevron_right' : 'search', size: 16, onClick: onIconClick })] }));
|
|
67
75
|
};
|
|
68
76
|
export default FilterOptionHeader;
|
|
69
77
|
//# sourceMappingURL=FilterOptionHeader.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterOptionHeader.js","sourceRoot":"","sources":["../../../src/components/filter/FilterOptionHeader.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"FilterOptionHeader.js","sourceRoot":"","sources":["../../../src/components/filter/FilterOptionHeader.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
import type { FilterOptionBuilder, FilterOptionSelector } from '../../../options';
|
|
2
3
|
import type { FilterComponent } from '../types';
|
|
3
|
-
|
|
4
|
+
import type { CheckboxOption } from './types';
|
|
5
|
+
import type { FilterFn } from '../../../types';
|
|
6
|
+
export type CheckboxFilterProps<TData extends Record<string, any> = Record<string, any>> = FilterComponent & {
|
|
4
7
|
/** either name of property of data type or a function that selects value */
|
|
5
|
-
selector?: Extract<keyof TData, string> | string | FilterOptionSelector<TData>;
|
|
8
|
+
readonly selector?: Extract<keyof TData, string> | string | FilterOptionSelector<TData>;
|
|
6
9
|
/** show option for selecting all */
|
|
7
|
-
enableAll?: boolean;
|
|
10
|
+
readonly enableAll?: boolean;
|
|
8
11
|
/** initial selection */
|
|
9
|
-
initial?: Set<string>;
|
|
12
|
+
readonly initial?: Set<string>;
|
|
13
|
+
readonly filter?: {
|
|
14
|
+
filterFn: FilterFn<TData, Set<string>>;
|
|
15
|
+
optionFn: FilterOptionBuilder<TData, CheckboxOption, string>;
|
|
16
|
+
};
|
|
17
|
+
readonly sortFn?: <T extends {
|
|
18
|
+
label: string;
|
|
19
|
+
}>(a: T, b: T) => number;
|
|
10
20
|
};
|
|
11
21
|
/**
|
|
12
22
|
* Component for displaying multi-select filter with checkboxes
|
|
13
23
|
*/
|
|
14
|
-
export declare const CheckboxFilter: (props: CheckboxFilterProps) =>
|
|
24
|
+
export declare const CheckboxFilter: <TData extends Record<string, any> = Record<string, any>>(props: CheckboxFilterProps<TData>) => ReactElement;
|
|
15
25
|
export default CheckboxFilter;
|
|
16
26
|
//# sourceMappingURL=CheckboxFilter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckboxFilter.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAElF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,MAAM,MAAM,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,IACrF,eAAe,GAAG;IAChB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,MAAM,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;IACxF,oCAAoC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,wBAAwB;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAI/B,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;QACvC,QAAQ,EAAE,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;KAC9D,CAAC;IACF,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;AAEJ;;GAEG;AAEH,eAAO,MAAM,cAAc,GAAI,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACpF,OAAO,mBAAmB,CAAC,KAAK,CAAC,KAChC,YAaF,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -3,14 +3,14 @@ import { FilterOptionHeader } from '../FilterOptionHeader';
|
|
|
3
3
|
import { CheckboxFilterProvider } from './CheckboxFilterProvider';
|
|
4
4
|
import CheckboxFilterOptions from './CheckboxFilterOptions';
|
|
5
5
|
import CheckboxFilterOptionAll from './CheckboxFilterOptionAll';
|
|
6
|
-
import
|
|
6
|
+
import { Styled } from './CheckboxFilter.style';
|
|
7
7
|
/**
|
|
8
8
|
* Component for displaying multi-select filter with checkboxes
|
|
9
9
|
*/
|
|
10
|
+
// biome-ignore lint/suspicious/noExplicitAny: we need any here to avoid type errors
|
|
10
11
|
export const CheckboxFilter = (props) => {
|
|
11
|
-
const { enableAll, ...args } = props;
|
|
12
|
-
|
|
13
|
-
return (_jsx(CheckboxFilterProvider, Object.assign({}, args, { children: _jsxs("div", Object.assign({ className: styles.root }, { children: [_jsx(FilterOptionHeader, { title: args.title }, void 0), _jsxs("div", Object.assign({ className: styles.items }, { children: [enableAll && _jsx(CheckboxFilterOptionAll, {}, void 0), _jsx(CheckboxFilterOptions, {}, void 0)] }), void 0)] }), void 0) }), void 0));
|
|
12
|
+
const { enableAll, sortFn, ...args } = props;
|
|
13
|
+
return (_jsx(CheckboxFilterProvider, { ...args, children: _jsxs(Styled.Root, { children: [_jsx(FilterOptionHeader, { title: args.title }), _jsxs(Styled.Items, { "$layout": "column", children: [enableAll && _jsx(CheckboxFilterOptionAll, {}), _jsx(CheckboxFilterOptions, { sortFn: sortFn })] })] }) }));
|
|
14
14
|
};
|
|
15
15
|
export default CheckboxFilter;
|
|
16
16
|
//# sourceMappingURL=CheckboxFilter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilter.js","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"CheckboxFilter.js","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,qBAAqB,MAAM,yBAAyB,CAAC;AAC5D,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAEhE,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAuBhD;;GAEG;AACH,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAiC,EACnB,EAAE;IAChB,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC7C,OAAO,CACL,KAAC,sBAAsB,OAAK,IAAI,YAC9B,MAAC,MAAM,CAAC,IAAI,eACV,KAAC,kBAAkB,IAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAI,EACzC,MAAC,MAAM,CAAC,KAAK,eAAS,QAAQ,aAC3B,SAAS,IAAI,KAAC,uBAAuB,KAAG,EACzC,KAAC,qBAAqB,IAAC,MAAM,EAAE,MAAM,GAAI,IAC5B,IACH,GACS,CAC1B,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export declare const Styled: {
|
|
2
|
+
Root: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>>> & string;
|
|
3
|
+
Items: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$layout"> & {
|
|
4
|
+
$layout: "column" | "row";
|
|
5
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$layout"> & {
|
|
6
|
+
$layout: "column" | "row";
|
|
7
|
+
}, never>>> & string;
|
|
8
|
+
Title: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
9
|
+
};
|
|
5
10
|
//# sourceMappingURL=CheckboxFilter.style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilter.style.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxFilter.style.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;;iBAMY,QAAQ,GAAG,KAAK;;iBAAhB,QAAQ,GAAG,KAAK;;;CAY9C,CAAC"}
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { tokens } from '@equinor/eds-tokens';
|
|
3
|
+
export const Styled = {
|
|
4
|
+
Root: styled.div `
|
|
5
|
+
display: flex;
|
|
6
|
+
flex-flow: column;
|
|
7
|
+
min-width: 150px;
|
|
8
|
+
`,
|
|
9
|
+
Items: styled.div `
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-flow: ${({ $layout }) => $layout};
|
|
12
|
+
overflow-y: auto;
|
|
13
|
+
`,
|
|
14
|
+
Title: styled.span `
|
|
15
|
+
color: ${tokens.typography.heading.h3.color};
|
|
16
|
+
font-family: ${tokens.typography.heading.h3.fontFamily};
|
|
17
|
+
font-size: ${tokens.typography.heading.h3.fontSize};
|
|
18
|
+
font-weight: ${tokens.typography.heading.h3.fontWeight};
|
|
19
|
+
line-height: ${tokens.typography.heading.h3.lineHeight};
|
|
20
|
+
`,
|
|
21
|
+
};
|
|
19
22
|
//# sourceMappingURL=CheckboxFilter.style.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilter.style.js","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.style.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"CheckboxFilter.style.js","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilter.style.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC,GAAG,CAAA;;;;GAIf;IACD,KAAK,EAAE,MAAM,CAAC,GAAG,CAA+B;;iBAEjC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;;GAEtC;IACD,KAAK,EAAE,MAAM,CAAC,IAAI,CAAA;aACP,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,KAAK;mBAC5B,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU;iBACzC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ;mBACnC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU;mBACvC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU;GACvD;CACF,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { type ReactElement, type HTMLAttributes } from 'react';
|
|
1
2
|
import type { CheckboxOption } from './types';
|
|
2
|
-
export
|
|
3
|
-
name: string;
|
|
4
|
-
checked?: boolean;
|
|
5
|
-
indeterminate?: boolean;
|
|
6
|
-
count: string | number;
|
|
7
|
-
onOptionChange: (item: {
|
|
3
|
+
export type CheckboxFilterOptionProps = Partial<HTMLAttributes<HTMLDivElement>> & Omit<CheckboxOption, 'totalCount'> & {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly checked?: boolean;
|
|
6
|
+
readonly indeterminate?: boolean;
|
|
7
|
+
readonly count: string | number;
|
|
8
|
+
readonly onOptionChange: (item: {
|
|
8
9
|
name: string;
|
|
9
10
|
selected?: boolean;
|
|
10
11
|
}) => void;
|
|
11
12
|
};
|
|
12
|
-
export declare const CheckboxFilterOption: (props: CheckboxFilterOptionProps) =>
|
|
13
|
+
export declare const CheckboxFilterOption: (props: CheckboxFilterOptionProps) => ReactElement;
|
|
13
14
|
export default CheckboxFilterOption;
|
|
14
15
|
//# sourceMappingURL=CheckboxFilterOption.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilterOption.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOption.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxFilterOption.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOption.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,YAAY,EAAE,KAAK,cAAc,EAAkB,MAAM,OAAO,CAAC;AAK5F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,yBAAyB,GAAG,OAAO,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC,GAC7E,IAAI,CAAC,cAAc,EAAE,YAAY,CAAC,GAAG;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IACjC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,QAAQ,CAAC,cAAc,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CAC/E,CAAC;AAEJ,eAAO,MAAM,oBAAoB,GAAI,OAAO,yBAAyB,KAAG,YA+BvE,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useStyles } from './CheckboxFilterOption.style';
|
|
3
|
+
import { Checkbox } from '@equinor/eds-core-react';
|
|
4
|
+
import { Styled } from './CheckboxFilterOption.style';
|
|
6
5
|
export const CheckboxFilterOption = (props) => {
|
|
7
6
|
const { name, label, count, checked, indeterminate, inactive, hide, onOptionChange, className, ...args } = props;
|
|
8
|
-
const onCheckboxClick = useCallback((e) => e.stopPropagation(), []);
|
|
9
7
|
const onCheckboxInput = useCallback(({ currentTarget: { name, checked } }) => {
|
|
10
|
-
return onOptionChange({ name, selected:
|
|
8
|
+
return onOptionChange({ name, selected: checked });
|
|
11
9
|
}, [onOptionChange]);
|
|
12
|
-
|
|
13
|
-
e.currentTarget.firstChild.click();
|
|
14
|
-
}, []);
|
|
15
|
-
const styles = useStyles();
|
|
16
|
-
return (_jsxs("div", Object.assign({}, args, { className: clsx(className, styles.root, inactive && styles.inactive, hide && styles.hide), onClick: onClick }, { children: [_jsx(Checkbox, { className: styles.checkbox, name: name, checked: checked, onInput: onCheckboxInput, onClick: onCheckboxClick, indeterminate: indeterminate }, void 0), _jsx("span", Object.assign({ className: styles.label }, { children: label }), void 0), _jsx("span", Object.assign({ className: styles.counter }, { children: count }), void 0)] }), void 0));
|
|
10
|
+
return (_jsxs(Styled.Root, { ...args, className: className, "$inactive": inactive, "$hide": hide, children: [_jsx(Checkbox, { name: name, checked: checked, onChange: onCheckboxInput, indeterminate: indeterminate, label: label }), _jsx(Styled.Counter, { children: count })] }));
|
|
17
11
|
};
|
|
18
12
|
export default CheckboxFilterOption;
|
|
19
13
|
//# sourceMappingURL=CheckboxFilterOption.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilterOption.js","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOption.tsx"],"names":[],"mappings":";AAAA,
|
|
1
|
+
{"version":3,"file":"CheckboxFilterOption.js","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOption.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAA0D,MAAM,OAAO,CAAC;AAE5F,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAYtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAgC,EAAgB,EAAE;IACrF,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,KAAK,EACL,OAAO,EACP,aAAa,EACb,QAAQ,EACR,IAAI,EACJ,cAAc,EACd,SAAS,EACT,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IACV,MAAM,eAAe,GAAG,WAAW,CACjC,CAAC,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAA+B,EAAE,EAAE;QACpE,OAAO,cAAc,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;IACrD,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IACF,OAAO,CACL,MAAC,MAAM,CAAC,IAAI,OAAK,IAAI,EAAE,SAAS,EAAE,SAAS,eAAa,QAAQ,WAAS,IAAI,aAC3E,KAAC,QAAQ,IACP,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,eAAe,EACzB,aAAa,EAAE,aAAa,EAC5B,KAAK,EAAE,KAAK,GACZ,EACF,KAAC,MAAM,CAAC,OAAO,cAAE,KAAK,GAAkB,IAC5B,CACf,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
1
|
+
export declare const Styled: {
|
|
2
|
+
Root: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$inactive" | "$hide"> & {
|
|
3
|
+
$inactive?: boolean;
|
|
4
|
+
$hide?: boolean;
|
|
5
|
+
}, never> & Partial<Pick<import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "$inactive" | "$hide"> & {
|
|
6
|
+
$inactive?: boolean;
|
|
7
|
+
$hide?: boolean;
|
|
8
|
+
}, never>>> & string;
|
|
9
|
+
Counter: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never> & Partial<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, never>>> & string;
|
|
10
|
+
};
|
|
3
11
|
//# sourceMappingURL=CheckboxFilterOption.style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxFilterOption.style.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOption.style.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CheckboxFilterOption.style.d.ts","sourceRoot":"","sources":["../../../../src/components/filter/checkbox/CheckboxFilterOption.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,MAAM;;oBACc,OAAO;gBAAU,OAAO;;oBAAxB,OAAO;gBAAU,OAAO;;;CAmCxD,CAAC"}
|