@databiosphere/findable-ui 40.0.0 → 41.0.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/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +22 -0
- package/lib/common/entities.d.ts +8 -0
- package/lib/common/entities.js +4 -1
- package/lib/components/DataDictionary/components/Description/description.js +2 -2
- package/lib/components/DataDictionary/components/Description/description.styles.d.ts +1 -1
- package/lib/components/DataDictionary/components/Description/description.styles.js +2 -2
- package/lib/components/DataDictionary/components/Entity/entity.styles.js +5 -0
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.js +4 -1
- package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.js +6 -1
- package/lib/components/DataDictionary/components/Filters/filters.styles.js +0 -5
- package/lib/components/DataDictionary/components/Filters/stories/constants.d.ts +1 -0
- package/lib/components/DataDictionary/components/Filters/stories/constants.js +1 -0
- package/lib/components/DataDictionary/components/Filters/stories/filters.stories.js +9 -3
- package/lib/components/DataDictionary/components/Filters/stories/utils.d.ts +7 -0
- package/lib/components/DataDictionary/components/Filters/stories/utils.js +12 -0
- package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.js +2 -2
- package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.js +6 -2
- package/lib/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.js +2 -2
- package/lib/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.js +6 -2
- package/lib/components/DataDictionary/components/Table/table.js +7 -4
- package/lib/components/DataDictionary/components/Table/table.styles.d.ts +1 -1
- package/lib/components/DataDictionary/components/Table/table.styles.js +2 -2
- package/lib/components/DataDictionary/components/Title/title.styles.js +2 -2
- package/lib/components/DataDictionary/dataDictionary.styles.d.ts +0 -1
- package/lib/components/DataDictionary/dataDictionary.styles.js +8 -8
- package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -2
- package/lib/components/Filter/components/Filter/filter.d.ts +3 -2
- package/lib/components/Filter/components/Filter/filter.js +13 -11
- package/lib/components/Filter/components/Filter/filter.styles.d.ts +3 -5
- package/lib/components/Filter/components/Filter/filter.styles.js +16 -19
- package/lib/components/Filter/components/Filter/stories/args.js +3 -2
- package/lib/components/Filter/components/FilterLabel/filterLabel.d.ts +3 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.js +3 -3
- package/lib/components/Filter/components/FilterLabel/filterLabel.stories.d.ts +3 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.stories.js +2 -0
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +3 -6
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.js +16 -13
- package/lib/components/Filter/components/FilterList/filterList.styles.d.ts +1 -1
- package/lib/components/Filter/components/FilterList/filterList.styles.js +1 -1
- package/lib/components/Filter/components/FilterMenu/filterMenu.d.ts +3 -2
- package/lib/components/Filter/components/FilterMenu/filterMenu.js +11 -11
- package/lib/components/Filter/components/FilterMenu/filterMenu.stories.d.ts +3 -2
- package/lib/components/Filter/components/FilterMenu/filterMenu.stories.js +2 -1
- package/lib/components/Filter/components/FilterMenu/filterMenu.styles.d.ts +2 -6
- package/lib/components/Filter/components/FilterMenu/filterMenu.styles.js +7 -17
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.d.ts +3 -1
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.js +3 -3
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.d.ts +3 -2
- package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.js +9 -5
- package/lib/components/Filter/components/FilterRange/filterRange.d.ts +1 -1
- package/lib/components/Filter/components/FilterRange/filterRange.js +7 -8
- package/lib/components/Filter/components/FilterRange/filterRange.styles.d.ts +2 -1
- package/lib/components/Filter/components/FilterRange/filterRange.styles.js +20 -16
- package/lib/components/Filter/components/FilterRange/stories/args.js +2 -1
- package/lib/components/Filter/components/FilterRange/types.d.ts +2 -1
- package/lib/components/Filter/components/Filters/filters.d.ts +5 -2
- package/lib/components/Filter/components/Filters/filters.js +7 -8
- package/lib/components/Filter/components/Filters/filters.styles.d.ts +6 -5
- package/lib/components/Filter/components/Filters/filters.styles.js +11 -11
- package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.js +2 -2
- package/lib/components/Filter/components/VariableSizeList/VariableSizeList.d.ts +3 -2
- package/lib/components/Filter/components/VariableSizeList/VariableSizeList.js +9 -8
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.d.ts +3 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.js +24 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.d.ts +6 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.js +1 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.d.ts +14 -0
- package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.js +67 -0
- package/lib/components/Filter/components/controls/Controls/controls.d.ts +6 -0
- package/lib/components/Filter/components/controls/Controls/controls.js +14 -0
- package/lib/components/Filter/components/controls/Controls/controls.styles.d.ts +7 -0
- package/lib/components/Filter/components/controls/Controls/controls.styles.js +9 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/constants.d.ts +2 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/constants.js +5 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.d.ts +2 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.js +17 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.d.ts +3 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.js +19 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/types.d.ts +7 -0
- package/lib/components/Filter/components/surfaces/drawer/Drawer/types.js +1 -0
- package/lib/components/Filter/components/surfaces/drawer/components/Button/button.d.ts +7 -0
- package/lib/components/Filter/components/surfaces/drawer/components/Button/button.js +16 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.d.ts +6 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.js +14 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.d.ts +5 -0
- package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.js +12 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/constants.d.ts +3 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/constants.js +9 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.d.ts +6 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.js +13 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.d.ts +5 -0
- package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.js +9 -0
- package/lib/components/Filter/components/surfaces/types.d.ts +11 -0
- package/lib/components/Filter/components/surfaces/types.js +5 -0
- package/lib/components/Filter/components/views/select/SelectListItem/selectListItem.d.ts +3 -0
- package/lib/components/Filter/components/views/select/SelectListItem/selectListItem.js +9 -0
- package/lib/components/Filter/components/views/select/SelectListItem/types.d.ts +12 -0
- package/lib/components/Filter/components/views/select/SelectListItem/types.js +1 -0
- package/lib/components/Filter/components/views/select/components/Checkbox/checkbox.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/Checkbox/checkbox.js +7 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.d.ts +7 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.js +5 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.d.ts +5 -0
- package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.js +11 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Count/count.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Count/count.js +6 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Term/term.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/components/Term/term.js +6 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.js +26 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.styles.d.ts +3 -0
- package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.styles.js +12 -0
- package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.js +23 -8
- package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.js +5 -0
- package/lib/components/common/Button/constants.js +4 -0
- package/lib/components/common/Drawer/provider/provider.d.ts +2 -4
- package/lib/components/common/Drawer/provider/provider.js +4 -2
- package/lib/components/common/Drawer/provider/types.d.ts +5 -1
- package/lib/hooks/useCategoryFilter.d.ts +2 -2
- package/lib/styles/common/mixins/breakpoints.d.ts +2 -0
- package/lib/styles/common/mixins/breakpoints.js +2 -0
- package/lib/styles/common/mui/typography.js +2 -0
- package/lib/utils/typeGuards.d.ts +6 -0
- package/lib/utils/typeGuards.js +8 -0
- package/lib/views/ExploreView/exploreView.js +4 -1
- package/package.json +1 -1
- package/src/common/entities.ts +10 -0
- package/src/components/DataDictionary/components/Description/description.styles.ts +2 -2
- package/src/components/DataDictionary/components/Description/description.tsx +3 -6
- package/src/components/DataDictionary/components/Entity/entity.styles.ts +5 -0
- package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.tsx +4 -1
- package/src/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.tsx +12 -1
- package/src/components/DataDictionary/components/Filters/filters.styles.ts +0 -5
- package/src/components/DataDictionary/components/Filters/stories/constants.ts +2 -0
- package/src/components/DataDictionary/components/Filters/stories/filters.stories.tsx +11 -4
- package/src/components/DataDictionary/components/Filters/stories/utils.ts +15 -0
- package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.ts +2 -2
- package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.ts +9 -2
- package/src/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.ts +2 -2
- package/src/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.ts +9 -2
- package/src/components/DataDictionary/components/Table/table.styles.ts +2 -2
- package/src/components/DataDictionary/components/Table/table.tsx +8 -4
- package/src/components/DataDictionary/components/Title/title.styles.ts +2 -2
- package/src/components/DataDictionary/dataDictionary.styles.ts +11 -9
- package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -1
- package/src/components/Filter/components/Filter/filter.styles.ts +18 -20
- package/src/components/Filter/components/Filter/filter.tsx +17 -19
- package/src/components/Filter/components/Filter/stories/args.ts +3 -2
- package/src/components/Filter/components/FilterLabel/filterLabel.stories.tsx +2 -0
- package/src/components/Filter/components/FilterLabel/filterLabel.styles.ts +20 -19
- package/src/components/Filter/components/FilterLabel/filterLabel.tsx +7 -3
- package/src/components/Filter/components/FilterList/filterList.styles.ts +1 -1
- package/src/components/Filter/components/FilterMenu/filterMenu.stories.tsx +2 -1
- package/src/components/Filter/components/FilterMenu/filterMenu.styles.ts +9 -18
- package/src/components/Filter/components/FilterMenu/filterMenu.tsx +15 -19
- package/src/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.ts +11 -5
- package/src/components/Filter/components/FilterMenuSearch/filterMenuSearch.tsx +5 -1
- package/src/components/Filter/components/FilterRange/filterRange.styles.ts +25 -19
- package/src/components/Filter/components/FilterRange/filterRange.tsx +8 -12
- package/src/components/Filter/components/FilterRange/stories/args.ts +2 -1
- package/src/components/Filter/components/FilterRange/types.ts +2 -1
- package/src/components/Filter/components/Filters/filters.styles.ts +16 -16
- package/src/components/Filter/components/Filters/filters.tsx +19 -13
- package/src/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.tsx +2 -2
- package/src/components/Filter/components/VariableSizeList/VariableSizeList.tsx +10 -9
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.tsx +44 -0
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.ts +7 -0
- package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.ts +90 -0
- package/src/components/Filter/components/controls/Controls/controls.styles.ts +10 -0
- package/src/components/Filter/components/controls/Controls/controls.tsx +31 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/constants.ts +7 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.ts +20 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/drawer.tsx +46 -0
- package/src/components/Filter/components/surfaces/drawer/Drawer/types.ts +11 -0
- package/src/components/Filter/components/surfaces/drawer/components/Button/button.tsx +40 -0
- package/src/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.ts +13 -0
- package/src/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.tsx +25 -0
- package/src/components/Filter/components/surfaces/drawer/components/IconButton/constants.ts +12 -0
- package/src/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.ts +10 -0
- package/src/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.tsx +28 -0
- package/src/components/Filter/components/surfaces/types.ts +13 -0
- package/src/components/Filter/components/views/select/SelectListItem/selectListItem.tsx +19 -0
- package/src/components/Filter/components/views/select/SelectListItem/types.ts +14 -0
- package/src/components/Filter/components/views/select/components/Checkbox/checkbox.tsx +19 -0
- package/src/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.ts +12 -0
- package/src/components/Filter/components/views/select/components/ListItemButton/listItemButton.tsx +25 -0
- package/src/components/Filter/components/views/select/components/ListItemText/components/Count/count.tsx +20 -0
- package/src/components/Filter/components/views/select/components/ListItemText/components/Term/term.tsx +19 -0
- package/src/components/Filter/components/views/select/components/ListItemText/listItemText.styles.ts +13 -0
- package/src/components/Filter/components/views/select/components/ListItemText/listItemText.tsx +48 -0
- package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.tsx +34 -35
- package/src/components/Table/components/TableFeatures/ColumnFilter/constants.ts +5 -0
- package/src/components/common/Button/constants.ts +4 -0
- package/src/components/common/Drawer/provider/provider.tsx +7 -8
- package/src/components/common/Drawer/provider/types.ts +6 -4
- package/src/hooks/useCategoryFilter.ts +2 -1
- package/src/styles/common/mixins/breakpoints.ts +6 -0
- package/src/styles/common/mui/typography.ts +2 -0
- package/src/utils/typeGuards.ts +8 -0
- package/src/views/ExploreView/exploreView.tsx +4 -0
|
@@ -2,8 +2,9 @@ import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
|
2
2
|
import { VariableSizeList as List, } from "react-window";
|
|
3
3
|
import { useWindowResize } from "../../../../hooks/useWindowResize";
|
|
4
4
|
import { LIST_ITEM_HEIGHT, LIST_MARGIN, MAX_DISPLAYABLE_LIST_ITEMS, MAX_LIST_HEIGHT_PX, } from "../../common/constants";
|
|
5
|
-
import {
|
|
5
|
+
import { StyledList } from "../FilterList/filterList.styles";
|
|
6
6
|
import VariableSizeListItem from "../VariableSizeListItem/variableSizeListItem";
|
|
7
|
+
import { SURFACE_TYPE } from "../surfaces/types";
|
|
7
8
|
/**
|
|
8
9
|
* Build variable list item element.
|
|
9
10
|
* @param props - Variable size list child component props i.e. list index, style.
|
|
@@ -14,7 +15,7 @@ function renderListItem(props) {
|
|
|
14
15
|
const { categoryKey, categorySection, matchedItems, onFilter, onUpdateItemSizeByItemKey, } = data;
|
|
15
16
|
return (React.createElement(VariableSizeListItem, { categorySection: categorySection, categoryKey: categoryKey, matchedItem: matchedItems[index], onFilter: onFilter, onUpdateItemSizeByItemKey: onUpdateItemSizeByItemKey, style: style }));
|
|
16
17
|
}
|
|
17
|
-
export const VariableSizeList = ({ categoryKey, categorySection, height: initHeight = MAX_LIST_HEIGHT_PX,
|
|
18
|
+
export const VariableSizeList = ({ categoryKey, categorySection, height: initHeight = MAX_LIST_HEIGHT_PX, itemSize = LIST_ITEM_HEIGHT, matchedItems, onFilter, overscanCount = MAX_DISPLAYABLE_LIST_ITEMS * 2, surfaceType, width = "100%", }) => {
|
|
18
19
|
const { height: windowHeight } = useWindowResize();
|
|
19
20
|
const [height, setHeight] = useState(initHeight);
|
|
20
21
|
const itemSizeByItemKeyRef = useRef(new Map());
|
|
@@ -24,14 +25,14 @@ export const VariableSizeList = ({ categoryKey, categorySection, height: initHei
|
|
|
24
25
|
const onUpdateItemSizeByItemKey = useCallback((key, size) => updateItemSizeByItemKey(itemSizeByItemKeyRef.current, key, size), []);
|
|
25
26
|
// Sets height of list.
|
|
26
27
|
useEffect(() => {
|
|
27
|
-
setHeight(calculateListHeight(initHeight, matchedItems, itemSizeByItemKeyRef.current,
|
|
28
|
-
}, [initHeight,
|
|
28
|
+
setHeight(calculateListHeight(initHeight, matchedItems, itemSizeByItemKeyRef.current, surfaceType, windowHeight, outerRef.current));
|
|
29
|
+
}, [initHeight, matchedItems, surfaceType, windowHeight]);
|
|
29
30
|
// Clears VariableSizeList cache (offsets and measurements) when values are updated (filtered).
|
|
30
31
|
// Facilitates correct positioning of list items when list is updated.
|
|
31
32
|
useEffect(() => {
|
|
32
33
|
listRef.current?.resetAfterIndex(0);
|
|
33
34
|
}, [matchedItems]);
|
|
34
|
-
return (React.createElement(List, { height: height, outerRef: outerRef, innerElementType:
|
|
35
|
+
return (React.createElement(List, { height: height, outerRef: outerRef, innerElementType: StyledList, itemCount: matchedItems.length, itemData: {
|
|
35
36
|
categoryKey,
|
|
36
37
|
categorySection,
|
|
37
38
|
matchedItems,
|
|
@@ -45,13 +46,13 @@ export const VariableSizeList = ({ categoryKey, categorySection, height: initHei
|
|
|
45
46
|
* @param height - Specified height of list.
|
|
46
47
|
* @param matchedItems - Set of search results for category value view models in the given category.
|
|
47
48
|
* @param itemSizeByItemKey - Map of item size by item key.
|
|
48
|
-
* @param
|
|
49
|
+
* @param surfaceType - Surface type is "Drawer" or "Menu".
|
|
49
50
|
* @param windowHeight - Window height.
|
|
50
51
|
* @param outerListElem - Outer list element to reference list position from.
|
|
51
52
|
* @returns calculated height.
|
|
52
53
|
*/
|
|
53
|
-
function calculateListHeight(height, matchedItems, itemSizeByItemKey,
|
|
54
|
-
if (
|
|
54
|
+
function calculateListHeight(height, matchedItems, itemSizeByItemKey, surfaceType, windowHeight, outerListElem) {
|
|
55
|
+
if (surfaceType === SURFACE_TYPE.DRAWER && outerListElem) {
|
|
55
56
|
return windowHeight - outerListElem.getBoundingClientRect().top;
|
|
56
57
|
}
|
|
57
58
|
if (matchedItems.length > MAX_DISPLAYABLE_LIST_ITEMS) {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useCallback } from "react";
|
|
2
|
+
import { CLEAR_ALL, } from "../../../../../../common/entities";
|
|
3
|
+
import { updater } from "../../../../../Table/components/TableFeatures/ColumnFilter/utils";
|
|
4
|
+
import { buildColumnFilters, getColumnFiltersCount } from "./utils";
|
|
5
|
+
export const ColumnFiltersAdapter = ({ renderSurface, table, }) => {
|
|
6
|
+
const categoryFilters = buildColumnFilters(table);
|
|
7
|
+
const count = getColumnFiltersCount(table);
|
|
8
|
+
const onFilter = useCallback((categoryKey, selectedCategoryValue,
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- `selected` is not required by TanStack adapter.
|
|
10
|
+
_selected) => {
|
|
11
|
+
if (categoryKey === CLEAR_ALL) {
|
|
12
|
+
table.resetColumnFilters();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
table
|
|
16
|
+
.getColumn(categoryKey)
|
|
17
|
+
?.setFilterValue(updater(selectedCategoryValue));
|
|
18
|
+
}, [table]);
|
|
19
|
+
return renderSurface({
|
|
20
|
+
categoryFilters,
|
|
21
|
+
count,
|
|
22
|
+
onFilter,
|
|
23
|
+
});
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RowData, Table } from "@tanstack/react-table";
|
|
2
|
+
import { SurfaceProps } from "../../../surfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Adapter for TanStack table column filters to category filters.
|
|
5
|
+
* @param table - Table.
|
|
6
|
+
* @returns Category filters.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildColumnFilters<T extends RowData>(table: Table<T>): SurfaceProps["categoryFilters"];
|
|
9
|
+
/**
|
|
10
|
+
* Adapter for TanStack table column filters to selected count.
|
|
11
|
+
* @param table - Table.
|
|
12
|
+
* @returns Selected count.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getColumnFiltersCount<T extends RowData>(table: Table<T>): number;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getColumnHeader } from "../../../../../Table/common/utils";
|
|
2
|
+
import { getSortedFacetedValues } from "../../../../../Table/featureOptions/facetedColumn/utils";
|
|
3
|
+
/**
|
|
4
|
+
* Adapter for TanStack table column filters to category filters.
|
|
5
|
+
* @param table - Table.
|
|
6
|
+
* @returns Category filters.
|
|
7
|
+
*/
|
|
8
|
+
export function buildColumnFilters(table) {
|
|
9
|
+
// Build the category views; single category filter.
|
|
10
|
+
const categoryViews = table
|
|
11
|
+
.getAllColumns()
|
|
12
|
+
.filter((column) => column.getCanFilter())
|
|
13
|
+
.map(mapColumnToCategoryView);
|
|
14
|
+
return [{ categoryViews }];
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Adapter for TanStack table column filters to selected count.
|
|
18
|
+
* @param table - Table.
|
|
19
|
+
* @returns Selected count.
|
|
20
|
+
*/
|
|
21
|
+
export function getColumnFiltersCount(table) {
|
|
22
|
+
return table
|
|
23
|
+
.getState()
|
|
24
|
+
.columnFilters.reduce((acc, columnFilter) => acc + columnFilter.value.length, 0);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Adapter for TanStack column to category view.
|
|
28
|
+
* Currently supports only select category views.
|
|
29
|
+
* @param column - Column.
|
|
30
|
+
* @returns Category view.
|
|
31
|
+
*/
|
|
32
|
+
function mapColumnToCategoryView(column) {
|
|
33
|
+
const facetedUniqueValues = column.getFacetedUniqueValues();
|
|
34
|
+
const isDisabled = facetedUniqueValues.size === 0;
|
|
35
|
+
const values = mapColumnToSelectCategoryValueView(column);
|
|
36
|
+
return {
|
|
37
|
+
annotation: undefined,
|
|
38
|
+
enableChartView: false,
|
|
39
|
+
isDisabled,
|
|
40
|
+
key: column.id,
|
|
41
|
+
label: getColumnHeader(column),
|
|
42
|
+
values,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Adapter for TanStack column to select category value view.
|
|
47
|
+
* @param column - Column.
|
|
48
|
+
* @returns Select category value view.
|
|
49
|
+
*/
|
|
50
|
+
function mapColumnToSelectCategoryValueView(column) {
|
|
51
|
+
// Get the faceted unique values and sort them.
|
|
52
|
+
const facetedUniqueValues = column.getFacetedUniqueValues();
|
|
53
|
+
const sortedFacetsValues = getSortedFacetedValues(facetedUniqueValues);
|
|
54
|
+
// Selected values for the column.
|
|
55
|
+
const filterValue = (column.getFilterValue() || []);
|
|
56
|
+
// Build the select category values.
|
|
57
|
+
const selectCategoryValues = [];
|
|
58
|
+
for (const [label, count] of sortedFacetsValues) {
|
|
59
|
+
selectCategoryValues.push({
|
|
60
|
+
count,
|
|
61
|
+
key: String(label),
|
|
62
|
+
label: String(label),
|
|
63
|
+
selected: filterValue.includes(label),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return selectCategoryValues;
|
|
67
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { BaseComponentProps } from "../../../../types";
|
|
2
|
+
import { SurfaceProps } from "../../surfaces/types";
|
|
3
|
+
/**
|
|
4
|
+
* Renders filter title and "Clear All" button.
|
|
5
|
+
*/
|
|
6
|
+
export declare const Controls: ({ className, onFilter, }: BaseComponentProps & Pick<SurfaceProps, "onFilter">) => JSX.Element | null;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Button as MButton, Typography } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CLEAR_ALL } from "../../../../../common/entities";
|
|
4
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../styles/common/mui/typography";
|
|
5
|
+
import { BUTTON_PROPS } from "../../../../common/Button/constants";
|
|
6
|
+
import { StyledGrid } from "./controls.styles";
|
|
7
|
+
/**
|
|
8
|
+
* Renders filter title and "Clear All" button.
|
|
9
|
+
*/
|
|
10
|
+
export const Controls = ({ className, onFilter, }) => {
|
|
11
|
+
return (React.createElement(StyledGrid, { className: className, container: true },
|
|
12
|
+
React.createElement(Typography, { variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_LARGE_500 }, "Filters"),
|
|
13
|
+
React.createElement(MButton, { ...BUTTON_PROPS.PRIMARY_TEXT, onClick: () => onFilter(CLEAR_ALL, undefined, false) }, "Clear All")));
|
|
14
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const StyledGrid: import("@emotion/styled").StyledComponent<import("@mui/material").GridBaseProps & {
|
|
2
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme>;
|
|
3
|
+
} & import("@mui/system").SystemProps<import("@mui/material").Theme> & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
4
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
5
|
+
}, "sx" | ("p" | "order" | "bottom" | "height" | "left" | "right" | "top" | "width" | "color" | "fontSize" | "display" | "fontFamily" | "fontStyle" | "fontWeight" | "letterSpacing" | "overflow" | "visibility" | "bgcolor" | "border" | "boxShadow" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "boxSizing" | "columnGap" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "justifyContent" | "justifyItems" | "justifySelf" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "whiteSpace" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "padding" | "paddingBlock" | "paddingInline" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | keyof import("@mui/material").GridBaseProps> & {
|
|
6
|
+
theme?: import("@emotion/react").Theme;
|
|
7
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { Fragment } from "react";
|
|
2
|
+
import { DrawerProvider } from "../../../../../common/Drawer/provider/provider";
|
|
3
|
+
import { Controls } from "../../../controls/Controls/controls";
|
|
4
|
+
import { Filters } from "../../../Filters/filters";
|
|
5
|
+
import { SURFACE_TYPE } from "../../types";
|
|
6
|
+
import { Button as BaseButton } from "../components/Button/button";
|
|
7
|
+
import { IconButton } from "../components/IconButton/iconButton";
|
|
8
|
+
import { DRAWER_PROPS } from "./constants";
|
|
9
|
+
import { StyledDrawer } from "./drawer.styles";
|
|
10
|
+
export const Drawer = ({ Button = BaseButton, categoryFilters, className, count, onFilter, ...props /* MuiDrawerProps */ }) => {
|
|
11
|
+
return (React.createElement(DrawerProvider, null, ({ onClose, open }) => (React.createElement(Fragment, null,
|
|
12
|
+
React.createElement(Button, { count: count }),
|
|
13
|
+
React.createElement(StyledDrawer, { ...DRAWER_PROPS, className: className, onClose: onClose, open: open, ...props },
|
|
14
|
+
React.createElement(IconButton, null),
|
|
15
|
+
React.createElement(Controls, { onFilter: onFilter }),
|
|
16
|
+
React.createElement(Filters, { categoryFilters: categoryFilters, onFilter: onFilter, surfaceType: SURFACE_TYPE.DRAWER }))))));
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { Drawer } from "@mui/material";
|
|
3
|
+
import { PALETTE } from "../../../../../../styles/common/constants/palette";
|
|
4
|
+
export const StyledDrawer = styled(Drawer) `
|
|
5
|
+
&.MuiDrawer-root {
|
|
6
|
+
.MuiPaper-root {
|
|
7
|
+
background-color: ${PALETTE.SMOKE_LIGHT};
|
|
8
|
+
max-height: 100vh;
|
|
9
|
+
padding: 16px 0;
|
|
10
|
+
width: 312px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
+ .MuiDrawer-root {
|
|
14
|
+
.MuiBackdrop-root {
|
|
15
|
+
background-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DrawerProps as MDrawerProps } from "@mui/material";
|
|
2
|
+
import { BaseComponentProps } from "../../../../../types";
|
|
3
|
+
import { SurfaceProps } from "../../types";
|
|
4
|
+
import { Button } from "../components/Button/button";
|
|
5
|
+
export interface DrawerProps extends BaseComponentProps, Omit<MDrawerProps, "children">, SurfaceProps {
|
|
6
|
+
Button?: typeof Button;
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ButtonProps } from "@mui/material";
|
|
2
|
+
import { BaseComponentProps } from "../../../../../../types";
|
|
3
|
+
import { FilterCountChipProps } from "../../../../FilterCountChip/types";
|
|
4
|
+
/**
|
|
5
|
+
* Opens facet-filters drawer.
|
|
6
|
+
*/
|
|
7
|
+
export declare const Button: ({ className, count, ...props }: BaseComponentProps & ButtonProps & Pick<FilterCountChipProps, "count">) => JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FilterListRounded } from "@mui/icons-material";
|
|
2
|
+
import { Button as MButton } from "@mui/material";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { SVG_ICON_PROPS } from "../../../../../../../styles/common/mui/svgIcon";
|
|
5
|
+
import { BUTTON_PROPS } from "../../../../../../common/Button/constants";
|
|
6
|
+
import { useDrawer } from "../../../../../../common/Drawer/provider/hook";
|
|
7
|
+
import { FilterCountChip } from "../../../../FilterCountChip/filterCountChip";
|
|
8
|
+
/**
|
|
9
|
+
* Opens facet-filters drawer.
|
|
10
|
+
*/
|
|
11
|
+
export const Button = ({ className, count = 0, ...props }) => {
|
|
12
|
+
const { onOpen } = useDrawer();
|
|
13
|
+
return (React.createElement(MButton, { ...BUTTON_PROPS.SECONDARY_CONTAINED, className: className, onClick: onOpen, startIcon: React.createElement(FilterListRounded, { color: SVG_ICON_PROPS.COLOR.INK_LIGHT, fontSize: SVG_ICON_PROPS.FONT_SIZE.SMALL }), ...props },
|
|
14
|
+
"Filter",
|
|
15
|
+
React.createElement(FilterCountChip, { count: count })));
|
|
16
|
+
};
|
package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ButtonProps } from "@mui/material";
|
|
2
|
+
import { BaseComponentProps } from "../../../../../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Closes facet-filter drawer.
|
|
5
|
+
*/
|
|
6
|
+
export declare const ButtonBase: ({ children, className, ...props }: BaseComponentProps & ButtonProps) => JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SVG_ICON_PROPS } from "../../../../../../../styles/common/mui/svgIcon";
|
|
3
|
+
import { SouthIcon } from "../../../../../../common/CustomIcon/components/SouthIcon/southIcon";
|
|
4
|
+
import { useDrawer } from "../../../../../../common/Drawer/provider/hook";
|
|
5
|
+
import { StyledButtonBase } from "./buttonBase.styles";
|
|
6
|
+
/**
|
|
7
|
+
* Closes facet-filter drawer.
|
|
8
|
+
*/
|
|
9
|
+
export const ButtonBase = ({ children, className, ...props }) => {
|
|
10
|
+
const { onClose } = useDrawer();
|
|
11
|
+
return (React.createElement(StyledButtonBase, { className: className, onClick: onClose, ...props },
|
|
12
|
+
React.createElement(SouthIcon, { fontSize: SVG_ICON_PROPS.FONT_SIZE.SMALL }),
|
|
13
|
+
children));
|
|
14
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledButtonBase: import("@emotion/styled").StyledComponent<import("@mui/material").ButtonBaseOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
3
|
+
}, "style" | "className" | "classes" | "children" | "sx" | "tabIndex" | "disabled" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & {
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
}, {}, {}>;
|
package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { ButtonBase } from "@mui/material";
|
|
3
|
+
import { textBodyLarge500 } from "../../../../../../../styles/common/mixins/fonts";
|
|
4
|
+
export const StyledButtonBase = styled(ButtonBase) `
|
|
5
|
+
${textBodyLarge500}
|
|
6
|
+
align-items: center;
|
|
7
|
+
display: flex;
|
|
8
|
+
gap: 8px;
|
|
9
|
+
justify-content: flex-start;
|
|
10
|
+
padding: 12px 16px;
|
|
11
|
+
width: 100%;
|
|
12
|
+
`;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ICON_BUTTON_PROPS as MUI_ICON_BUTTON_PROPS } from "../../../../../../../styles/common/mui/iconButton";
|
|
2
|
+
import { SVG_ICON_PROPS as MUI_SVG_ICON_PROPS } from "../../../../../../../styles/common/mui/svgIcon";
|
|
3
|
+
export const ICON_BUTTON_PROPS = {
|
|
4
|
+
color: MUI_ICON_BUTTON_PROPS.COLOR.INHERIT,
|
|
5
|
+
size: MUI_ICON_BUTTON_PROPS.SIZE.MEDIUM,
|
|
6
|
+
};
|
|
7
|
+
export const SVG_ICON_PROPS = {
|
|
8
|
+
fontSize: MUI_SVG_ICON_PROPS.FONT_SIZE.SMALL,
|
|
9
|
+
};
|
package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { IconButtonProps } from "@mui/material";
|
|
2
|
+
import { BaseComponentProps } from "../../../../../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Closes facet-filters drawer.
|
|
5
|
+
*/
|
|
6
|
+
export declare const IconButton: ({ className, ...props }: BaseComponentProps & IconButtonProps) => JSX.Element | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CloseRounded } from "@mui/icons-material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useDrawer } from "../../../../../../common/Drawer/provider/hook";
|
|
4
|
+
import { ICON_BUTTON_PROPS, SVG_ICON_PROPS } from "./constants";
|
|
5
|
+
import { StyledIconButton } from "./iconButton.styles";
|
|
6
|
+
/**
|
|
7
|
+
* Closes facet-filters drawer.
|
|
8
|
+
*/
|
|
9
|
+
export const IconButton = ({ className, ...props /* MuiIconButtonProps */ }) => {
|
|
10
|
+
const { onClose } = useDrawer();
|
|
11
|
+
return (React.createElement(StyledIconButton, { ...ICON_BUTTON_PROPS, className: className, onClick: onClose, ...props },
|
|
12
|
+
React.createElement(CloseRounded, { ...SVG_ICON_PROPS })));
|
|
13
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledIconButton: import("@emotion/styled").StyledComponent<import("@mui/material").IconButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
3
|
+
}, "style" | "size" | "className" | "classes" | "children" | "color" | "sx" | "tabIndex" | "disabled" | "action" | "loading" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "loadingIndicator" | "edge"> & {
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
}, {}, {}>;
|
package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { IconButton } from "@mui/material";
|
|
3
|
+
import { PALETTE } from "../../../../../../../styles/common/constants/palette";
|
|
4
|
+
export const StyledIconButton = styled(IconButton) `
|
|
5
|
+
color: ${PALETTE.COMMON_WHITE};
|
|
6
|
+
left: calc(100% + 4px);
|
|
7
|
+
position: absolute;
|
|
8
|
+
top: 4px;
|
|
9
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { OnFilterFn } from "../../../../hooks/useCategoryFilter";
|
|
2
|
+
import { CategoryFilter } from "../Filters/filters";
|
|
3
|
+
export interface SurfaceProps {
|
|
4
|
+
categoryFilters: CategoryFilter[];
|
|
5
|
+
count?: number;
|
|
6
|
+
onFilter: OnFilterFn;
|
|
7
|
+
}
|
|
8
|
+
export declare enum SURFACE_TYPE {
|
|
9
|
+
DRAWER = "DRAWER",
|
|
10
|
+
MENU = "MENU"
|
|
11
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { Checkbox } from "../components/Checkbox/checkbox";
|
|
3
|
+
import { ListItemButton } from "../components/ListItemButton/listItemButton";
|
|
4
|
+
import { ListItemText } from "../components/ListItemText/listItemText";
|
|
5
|
+
export const SelectListItem = forwardRef(function SelectListItem({ slotProps }, ref) {
|
|
6
|
+
return (React.createElement(ListItemButton, { ref: ref, ...slotProps.listItemButton },
|
|
7
|
+
React.createElement(Checkbox, { ...slotProps.checkbox }),
|
|
8
|
+
React.createElement(ListItemText, { ...slotProps.listItemText })));
|
|
9
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { Checkbox } from "../components/Checkbox/checkbox";
|
|
3
|
+
import { ListItemButton } from "../components/ListItemButton/listItemButton";
|
|
4
|
+
import { ListItemText } from "../components/ListItemText/listItemText";
|
|
5
|
+
export interface SelectListItemProps {
|
|
6
|
+
slotProps: SlotProps;
|
|
7
|
+
}
|
|
8
|
+
export interface SlotProps {
|
|
9
|
+
checkbox: ComponentProps<typeof Checkbox>;
|
|
10
|
+
listItemButton: ComponentProps<typeof ListItemButton>;
|
|
11
|
+
listItemText: ComponentProps<typeof ListItemText>;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Checkbox as MCheckbox } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { CheckedIcon } from "../../../../../../common/CustomIcon/components/CheckedIcon/checkedIcon";
|
|
4
|
+
import { UncheckedIcon } from "../../../../../../common/CustomIcon/components/UncheckedIcon/uncheckedIcon";
|
|
5
|
+
export const Checkbox = ({ className, ...props /* MuiCheckboxProps */ }) => {
|
|
6
|
+
return (React.createElement(MCheckbox, { className: className, checkedIcon: React.createElement(CheckedIcon, null), icon: React.createElement(UncheckedIcon, null), ...props }));
|
|
7
|
+
};
|
package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BaseComponentProps, TestIdProps } from "../../../../../../types";
|
|
3
|
+
export declare const ListItemButton: React.ForwardRefExoticComponent<Omit<BaseComponentProps & import("@mui/material").ListItemButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
4
|
+
ref?: ((instance: HTMLDivElement | null) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
5
|
+
}, "style" | "className" | "classes" | "children" | "sx" | "tabIndex" | "autoFocus" | "disabled" | "action" | "selected" | "alignItems" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "dense" | "disableGutters" | "divider"> & {
|
|
6
|
+
component?: React.ElementType;
|
|
7
|
+
} & TestIdProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { StyledListItemButton } from "./listItemButton.styles";
|
|
3
|
+
export const ListItemButton = forwardRef(function ListItemButton({ className, testId, ...props /* MuiListItemButtonProps */ }, ref) {
|
|
4
|
+
return (React.createElement(StyledListItemButton, { className: className, "data-testid": testId, ref: ref, ...props }));
|
|
5
|
+
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const StyledListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
2
|
+
ref?: ((instance: HTMLDivElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
3
|
+
}, "style" | "className" | "classes" | "children" | "sx" | "tabIndex" | "autoFocus" | "disabled" | "action" | "selected" | "alignItems" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "dense" | "disableGutters" | "divider"> & {
|
|
4
|
+
theme?: import("@emotion/react").Theme;
|
|
5
|
+
}, {}, {}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { ListItemButton } from "@mui/material";
|
|
3
|
+
import { PALETTE } from "../../../../../../../styles/common/constants/palette";
|
|
4
|
+
export const StyledListItemButton = styled(ListItemButton) `
|
|
5
|
+
gap: 8px;
|
|
6
|
+
|
|
7
|
+
&.Mui-disabled {
|
|
8
|
+
color: ${PALETTE.SMOKE_MAIN};
|
|
9
|
+
opacity: 1;
|
|
10
|
+
}
|
|
11
|
+
`;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Typography } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../../../../../styles/common/mui/typography";
|
|
4
|
+
export const Count = ({ className, testId, ...props /* MuiTypographyProps */ }) => {
|
|
5
|
+
return (React.createElement(Typography, { className: className, color: TYPOGRAPHY_PROPS.COLOR.INK_LIGHT, "data-testid": testId, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_SMALL_400, ...props }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Typography } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TYPOGRAPHY_PROPS } from "../../../../../../../../../styles/common/mui/typography";
|
|
4
|
+
export const Term = ({ className, testId, ...props /* MuiTypographyProps */ }) => {
|
|
5
|
+
return (React.createElement(Typography, { className: className, "data-testid": testId, variant: TYPOGRAPHY_PROPS.VARIANT.TEXT_BODY_400, ...props }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { isValueString } from "../../../../../../../utils/typeGuards";
|
|
3
|
+
import { Count } from "./components/Count/count";
|
|
4
|
+
import { Term } from "./components/Term/term";
|
|
5
|
+
import { StyledListItemText } from "./listItemText.styles";
|
|
6
|
+
export const ListItemText = ({ className, primary, secondary, ...props /* MuiListItemTextProps */ }) => {
|
|
7
|
+
return (React.createElement(StyledListItemText, { className: className, disableTypography: true, primary: renderPrimary(primary), secondary: renderSecondary(secondary), ...props }));
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Render the primary prop for the ListItemText component.
|
|
11
|
+
* Default fallback for "string" values is <Term> component.
|
|
12
|
+
* @param primary - Primary prop.
|
|
13
|
+
* @returns primary prop.
|
|
14
|
+
*/
|
|
15
|
+
function renderPrimary(primary) {
|
|
16
|
+
return isValueString(primary) ? React.createElement(Term, null, primary) : primary;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Render the secondary prop for the ListItemText component.
|
|
20
|
+
* Default fallback for "string" values is <Count> component.
|
|
21
|
+
* @param secondary - Secondary prop.
|
|
22
|
+
* @returns secondary prop.
|
|
23
|
+
*/
|
|
24
|
+
function renderSecondary(secondary) {
|
|
25
|
+
return isValueString(secondary) ? React.createElement(Count, null, secondary) : secondary;
|
|
26
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const StyledListItemText: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemTextProps<import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>, import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements>> & {
|
|
2
|
+
theme?: import("@emotion/react").Theme;
|
|
3
|
+
}, {}, {}>;
|