@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.
Files changed (201) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +22 -0
  3. package/lib/common/entities.d.ts +8 -0
  4. package/lib/common/entities.js +4 -1
  5. package/lib/components/DataDictionary/components/Description/description.js +2 -2
  6. package/lib/components/DataDictionary/components/Description/description.styles.d.ts +1 -1
  7. package/lib/components/DataDictionary/components/Description/description.styles.js +2 -2
  8. package/lib/components/DataDictionary/components/Entity/entity.styles.js +5 -0
  9. package/lib/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.js +4 -1
  10. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.js +6 -1
  11. package/lib/components/DataDictionary/components/Filters/filters.styles.js +0 -5
  12. package/lib/components/DataDictionary/components/Filters/stories/constants.d.ts +1 -0
  13. package/lib/components/DataDictionary/components/Filters/stories/constants.js +1 -0
  14. package/lib/components/DataDictionary/components/Filters/stories/filters.stories.js +9 -3
  15. package/lib/components/DataDictionary/components/Filters/stories/utils.d.ts +7 -0
  16. package/lib/components/DataDictionary/components/Filters/stories/utils.js +12 -0
  17. package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.js +2 -2
  18. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.js +6 -2
  19. package/lib/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.js +2 -2
  20. package/lib/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.js +6 -2
  21. package/lib/components/DataDictionary/components/Table/table.js +7 -4
  22. package/lib/components/DataDictionary/components/Table/table.styles.d.ts +1 -1
  23. package/lib/components/DataDictionary/components/Table/table.styles.js +2 -2
  24. package/lib/components/DataDictionary/components/Title/title.styles.js +2 -2
  25. package/lib/components/DataDictionary/dataDictionary.styles.d.ts +0 -1
  26. package/lib/components/DataDictionary/dataDictionary.styles.js +8 -8
  27. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -2
  28. package/lib/components/Filter/components/Filter/filter.d.ts +3 -2
  29. package/lib/components/Filter/components/Filter/filter.js +13 -11
  30. package/lib/components/Filter/components/Filter/filter.styles.d.ts +3 -5
  31. package/lib/components/Filter/components/Filter/filter.styles.js +16 -19
  32. package/lib/components/Filter/components/Filter/stories/args.js +3 -2
  33. package/lib/components/Filter/components/FilterLabel/filterLabel.d.ts +3 -1
  34. package/lib/components/Filter/components/FilterLabel/filterLabel.js +3 -3
  35. package/lib/components/Filter/components/FilterLabel/filterLabel.stories.d.ts +3 -1
  36. package/lib/components/Filter/components/FilterLabel/filterLabel.stories.js +2 -0
  37. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +3 -6
  38. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.js +16 -13
  39. package/lib/components/Filter/components/FilterList/filterList.styles.d.ts +1 -1
  40. package/lib/components/Filter/components/FilterList/filterList.styles.js +1 -1
  41. package/lib/components/Filter/components/FilterMenu/filterMenu.d.ts +3 -2
  42. package/lib/components/Filter/components/FilterMenu/filterMenu.js +11 -11
  43. package/lib/components/Filter/components/FilterMenu/filterMenu.stories.d.ts +3 -2
  44. package/lib/components/Filter/components/FilterMenu/filterMenu.stories.js +2 -1
  45. package/lib/components/Filter/components/FilterMenu/filterMenu.styles.d.ts +2 -6
  46. package/lib/components/Filter/components/FilterMenu/filterMenu.styles.js +7 -17
  47. package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.d.ts +3 -1
  48. package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.js +3 -3
  49. package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.d.ts +3 -2
  50. package/lib/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.js +9 -5
  51. package/lib/components/Filter/components/FilterRange/filterRange.d.ts +1 -1
  52. package/lib/components/Filter/components/FilterRange/filterRange.js +7 -8
  53. package/lib/components/Filter/components/FilterRange/filterRange.styles.d.ts +2 -1
  54. package/lib/components/Filter/components/FilterRange/filterRange.styles.js +20 -16
  55. package/lib/components/Filter/components/FilterRange/stories/args.js +2 -1
  56. package/lib/components/Filter/components/FilterRange/types.d.ts +2 -1
  57. package/lib/components/Filter/components/Filters/filters.d.ts +5 -2
  58. package/lib/components/Filter/components/Filters/filters.js +7 -8
  59. package/lib/components/Filter/components/Filters/filters.styles.d.ts +6 -5
  60. package/lib/components/Filter/components/Filters/filters.styles.js +11 -11
  61. package/lib/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.js +2 -2
  62. package/lib/components/Filter/components/VariableSizeList/VariableSizeList.d.ts +3 -2
  63. package/lib/components/Filter/components/VariableSizeList/VariableSizeList.js +9 -8
  64. package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.d.ts +3 -0
  65. package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.js +24 -0
  66. package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.d.ts +6 -0
  67. package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.js +1 -0
  68. package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.d.ts +14 -0
  69. package/lib/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.js +67 -0
  70. package/lib/components/Filter/components/controls/Controls/controls.d.ts +6 -0
  71. package/lib/components/Filter/components/controls/Controls/controls.js +14 -0
  72. package/lib/components/Filter/components/controls/Controls/controls.styles.d.ts +7 -0
  73. package/lib/components/Filter/components/controls/Controls/controls.styles.js +9 -0
  74. package/lib/components/Filter/components/surfaces/drawer/Drawer/constants.d.ts +2 -0
  75. package/lib/components/Filter/components/surfaces/drawer/Drawer/constants.js +5 -0
  76. package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.d.ts +2 -0
  77. package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.js +17 -0
  78. package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.d.ts +3 -0
  79. package/lib/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.js +19 -0
  80. package/lib/components/Filter/components/surfaces/drawer/Drawer/types.d.ts +7 -0
  81. package/lib/components/Filter/components/surfaces/drawer/Drawer/types.js +1 -0
  82. package/lib/components/Filter/components/surfaces/drawer/components/Button/button.d.ts +7 -0
  83. package/lib/components/Filter/components/surfaces/drawer/components/Button/button.js +16 -0
  84. package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.d.ts +6 -0
  85. package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.js +14 -0
  86. package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.d.ts +5 -0
  87. package/lib/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.js +12 -0
  88. package/lib/components/Filter/components/surfaces/drawer/components/IconButton/constants.d.ts +3 -0
  89. package/lib/components/Filter/components/surfaces/drawer/components/IconButton/constants.js +9 -0
  90. package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.d.ts +6 -0
  91. package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.js +13 -0
  92. package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.d.ts +5 -0
  93. package/lib/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.js +9 -0
  94. package/lib/components/Filter/components/surfaces/types.d.ts +11 -0
  95. package/lib/components/Filter/components/surfaces/types.js +5 -0
  96. package/lib/components/Filter/components/views/select/SelectListItem/selectListItem.d.ts +3 -0
  97. package/lib/components/Filter/components/views/select/SelectListItem/selectListItem.js +9 -0
  98. package/lib/components/Filter/components/views/select/SelectListItem/types.d.ts +12 -0
  99. package/lib/components/Filter/components/views/select/SelectListItem/types.js +1 -0
  100. package/lib/components/Filter/components/views/select/components/Checkbox/checkbox.d.ts +3 -0
  101. package/lib/components/Filter/components/views/select/components/Checkbox/checkbox.js +7 -0
  102. package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.d.ts +7 -0
  103. package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.js +5 -0
  104. package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.d.ts +5 -0
  105. package/lib/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.js +11 -0
  106. package/lib/components/Filter/components/views/select/components/ListItemText/components/Count/count.d.ts +3 -0
  107. package/lib/components/Filter/components/views/select/components/ListItemText/components/Count/count.js +6 -0
  108. package/lib/components/Filter/components/views/select/components/ListItemText/components/Term/term.d.ts +3 -0
  109. package/lib/components/Filter/components/views/select/components/ListItemText/components/Term/term.js +6 -0
  110. package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.d.ts +3 -0
  111. package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.js +26 -0
  112. package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.styles.d.ts +3 -0
  113. package/lib/components/Filter/components/views/select/components/ListItemText/listItemText.styles.js +12 -0
  114. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.js +23 -8
  115. package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.js +5 -0
  116. package/lib/components/common/Button/constants.js +4 -0
  117. package/lib/components/common/Drawer/provider/provider.d.ts +2 -4
  118. package/lib/components/common/Drawer/provider/provider.js +4 -2
  119. package/lib/components/common/Drawer/provider/types.d.ts +5 -1
  120. package/lib/hooks/useCategoryFilter.d.ts +2 -2
  121. package/lib/styles/common/mixins/breakpoints.d.ts +2 -0
  122. package/lib/styles/common/mixins/breakpoints.js +2 -0
  123. package/lib/styles/common/mui/typography.js +2 -0
  124. package/lib/utils/typeGuards.d.ts +6 -0
  125. package/lib/utils/typeGuards.js +8 -0
  126. package/lib/views/ExploreView/exploreView.js +4 -1
  127. package/package.json +1 -1
  128. package/src/common/entities.ts +10 -0
  129. package/src/components/DataDictionary/components/Description/description.styles.ts +2 -2
  130. package/src/components/DataDictionary/components/Description/description.tsx +3 -6
  131. package/src/components/DataDictionary/components/Entity/entity.styles.ts +5 -0
  132. package/src/components/DataDictionary/components/Filters/components/ColumnFilterTags/columnFilterTags.tsx +4 -1
  133. package/src/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.tsx +12 -1
  134. package/src/components/DataDictionary/components/Filters/filters.styles.ts +0 -5
  135. package/src/components/DataDictionary/components/Filters/stories/constants.ts +2 -0
  136. package/src/components/DataDictionary/components/Filters/stories/filters.stories.tsx +11 -4
  137. package/src/components/DataDictionary/components/Filters/stories/utils.ts +15 -0
  138. package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.ts +2 -2
  139. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.ts +9 -2
  140. package/src/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.ts +2 -2
  141. package/src/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.ts +9 -2
  142. package/src/components/DataDictionary/components/Table/table.styles.ts +2 -2
  143. package/src/components/DataDictionary/components/Table/table.tsx +8 -4
  144. package/src/components/DataDictionary/components/Title/title.styles.ts +2 -2
  145. package/src/components/DataDictionary/dataDictionary.styles.ts +11 -9
  146. package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +1 -1
  147. package/src/components/Filter/components/Filter/filter.styles.ts +18 -20
  148. package/src/components/Filter/components/Filter/filter.tsx +17 -19
  149. package/src/components/Filter/components/Filter/stories/args.ts +3 -2
  150. package/src/components/Filter/components/FilterLabel/filterLabel.stories.tsx +2 -0
  151. package/src/components/Filter/components/FilterLabel/filterLabel.styles.ts +20 -19
  152. package/src/components/Filter/components/FilterLabel/filterLabel.tsx +7 -3
  153. package/src/components/Filter/components/FilterList/filterList.styles.ts +1 -1
  154. package/src/components/Filter/components/FilterMenu/filterMenu.stories.tsx +2 -1
  155. package/src/components/Filter/components/FilterMenu/filterMenu.styles.ts +9 -18
  156. package/src/components/Filter/components/FilterMenu/filterMenu.tsx +15 -19
  157. package/src/components/Filter/components/FilterMenuSearch/filterMenuSearch.styles.ts +11 -5
  158. package/src/components/Filter/components/FilterMenuSearch/filterMenuSearch.tsx +5 -1
  159. package/src/components/Filter/components/FilterRange/filterRange.styles.ts +25 -19
  160. package/src/components/Filter/components/FilterRange/filterRange.tsx +8 -12
  161. package/src/components/Filter/components/FilterRange/stories/args.ts +2 -1
  162. package/src/components/Filter/components/FilterRange/types.ts +2 -1
  163. package/src/components/Filter/components/Filters/filters.styles.ts +16 -16
  164. package/src/components/Filter/components/Filters/filters.tsx +19 -13
  165. package/src/components/Filter/components/SearchAllFilters/components/VariableSizeList/VariableSizeList.tsx +2 -2
  166. package/src/components/Filter/components/VariableSizeList/VariableSizeList.tsx +10 -9
  167. package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/columnFiltersAdapter.tsx +44 -0
  168. package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/types.ts +7 -0
  169. package/src/components/Filter/components/adapters/tanstack/ColumnFiltersAdapter/utils.ts +90 -0
  170. package/src/components/Filter/components/controls/Controls/controls.styles.ts +10 -0
  171. package/src/components/Filter/components/controls/Controls/controls.tsx +31 -0
  172. package/src/components/Filter/components/surfaces/drawer/Drawer/constants.ts +7 -0
  173. package/src/components/Filter/components/surfaces/drawer/Drawer/drawer.styles.ts +20 -0
  174. package/src/components/Filter/components/surfaces/drawer/Drawer/drawer.tsx +46 -0
  175. package/src/components/Filter/components/surfaces/drawer/Drawer/types.ts +11 -0
  176. package/src/components/Filter/components/surfaces/drawer/components/Button/button.tsx +40 -0
  177. package/src/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.styles.ts +13 -0
  178. package/src/components/Filter/components/surfaces/drawer/components/ButtonBase/buttonBase.tsx +25 -0
  179. package/src/components/Filter/components/surfaces/drawer/components/IconButton/constants.ts +12 -0
  180. package/src/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.styles.ts +10 -0
  181. package/src/components/Filter/components/surfaces/drawer/components/IconButton/iconButton.tsx +28 -0
  182. package/src/components/Filter/components/surfaces/types.ts +13 -0
  183. package/src/components/Filter/components/views/select/SelectListItem/selectListItem.tsx +19 -0
  184. package/src/components/Filter/components/views/select/SelectListItem/types.ts +14 -0
  185. package/src/components/Filter/components/views/select/components/Checkbox/checkbox.tsx +19 -0
  186. package/src/components/Filter/components/views/select/components/ListItemButton/listItemButton.styles.ts +12 -0
  187. package/src/components/Filter/components/views/select/components/ListItemButton/listItemButton.tsx +25 -0
  188. package/src/components/Filter/components/views/select/components/ListItemText/components/Count/count.tsx +20 -0
  189. package/src/components/Filter/components/views/select/components/ListItemText/components/Term/term.tsx +19 -0
  190. package/src/components/Filter/components/views/select/components/ListItemText/listItemText.styles.ts +13 -0
  191. package/src/components/Filter/components/views/select/components/ListItemText/listItemText.tsx +48 -0
  192. package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.tsx +34 -35
  193. package/src/components/Table/components/TableFeatures/ColumnFilter/constants.ts +5 -0
  194. package/src/components/common/Button/constants.ts +4 -0
  195. package/src/components/common/Drawer/provider/provider.tsx +7 -8
  196. package/src/components/common/Drawer/provider/types.ts +6 -4
  197. package/src/hooks/useCategoryFilter.ts +2 -1
  198. package/src/styles/common/mixins/breakpoints.ts +6 -0
  199. package/src/styles/common/mui/typography.ts +2 -0
  200. package/src/utils/typeGuards.ts +8 -0
  201. 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 { List as FilterList } from "../FilterList/filterList.styles";
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, isFilterDrawer, itemSize = LIST_ITEM_HEIGHT, matchedItems, onFilter, overscanCount = MAX_DISPLAYABLE_LIST_ITEMS * 2, width = "100%", }) => {
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, isFilterDrawer, windowHeight, outerRef.current));
28
- }, [initHeight, isFilterDrawer, matchedItems, windowHeight]);
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: FilterList, itemCount: matchedItems.length, itemData: {
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 isFilterDrawer - True if filter is displayed in filter drawer.
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, isFilterDrawer, windowHeight, outerListElem) {
54
- if (isFilterDrawer && outerListElem) {
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,3 @@
1
+ import { RowData } from "@tanstack/react-table";
2
+ import { ColumnFiltersAdapterProps } from "./types";
3
+ export declare const ColumnFiltersAdapter: <T extends RowData>({ renderSurface, table, }: ColumnFiltersAdapterProps<T>) => JSX.Element | null;
@@ -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,6 @@
1
+ import { RowData, Table } from "@tanstack/react-table";
2
+ import { SurfaceProps } from "../../../surfaces/types";
3
+ export interface ColumnFiltersAdapterProps<T extends RowData> {
4
+ renderSurface: (props: SurfaceProps) => JSX.Element | null;
5
+ table: Table<T>;
6
+ }
@@ -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,9 @@
1
+ import styled from "@emotion/styled";
2
+ import { Grid } from "@mui/material";
3
+ export const StyledGrid = styled(Grid) `
4
+ display: grid;
5
+ gap: 8px 0;
6
+ grid-template-columns: 1fr auto;
7
+ margin: 8px 0;
8
+ padding: 0 16px;
9
+ `;
@@ -0,0 +1,2 @@
1
+ import { DrawerProps } from "@mui/material";
2
+ export declare const DRAWER_PROPS: DrawerProps;
@@ -0,0 +1,5 @@
1
+ export const DRAWER_PROPS = {
2
+ closeAfterTransition: true,
3
+ disableRestoreFocus: true,
4
+ elevation: 1,
5
+ };
@@ -0,0 +1,2 @@
1
+ import { DrawerProps } from "./types";
2
+ export declare const Drawer: ({ Button, categoryFilters, className, count, onFilter, ...props }: DrawerProps) => JSX.Element | null;
@@ -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,3 @@
1
+ export declare const StyledDrawer: import("@emotion/styled").StyledComponent<import("@mui/material").DrawerProps & {
2
+ theme?: import("@emotion/react").Theme;
3
+ }, {}, {}>;
@@ -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,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
+ };
@@ -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
+ }, {}, {}>;
@@ -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,3 @@
1
+ import { IconButtonProps, SvgIconProps } from "@mui/material";
2
+ export declare const ICON_BUTTON_PROPS: IconButtonProps;
3
+ export declare const SVG_ICON_PROPS: SvgIconProps;
@@ -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
+ };
@@ -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
+ }, {}, {}>;
@@ -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,5 @@
1
+ export var SURFACE_TYPE;
2
+ (function (SURFACE_TYPE) {
3
+ SURFACE_TYPE["DRAWER"] = "DRAWER";
4
+ SURFACE_TYPE["MENU"] = "MENU";
5
+ })(SURFACE_TYPE || (SURFACE_TYPE = {}));
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { SelectListItemProps } from "./types";
3
+ export declare const SelectListItem: React.ForwardRefExoticComponent<SelectListItemProps & React.RefAttributes<HTMLDivElement>>;
@@ -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,3 @@
1
+ import { CheckboxProps } from "@mui/material";
2
+ import { BaseComponentProps } from "../../../../../../types";
3
+ export declare const Checkbox: ({ className, ...props }: BaseComponentProps & CheckboxProps) => JSX.Element;
@@ -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
+ };
@@ -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>>;
@@ -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,3 @@
1
+ import { TypographyProps } from "@mui/material";
2
+ import { BaseComponentProps, TestIdProps } from "../../../../../../../../types";
3
+ export declare const Count: ({ className, testId, ...props }: BaseComponentProps & TestIdProps & TypographyProps) => JSX.Element;
@@ -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,3 @@
1
+ import { TypographyProps } from "@mui/material";
2
+ import { BaseComponentProps, TestIdProps } from "../../../../../../../../types";
3
+ export declare const Term: ({ className, testId, ...props }: BaseComponentProps & TestIdProps & TypographyProps) => JSX.Element;
@@ -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,3 @@
1
+ import { ListItemTextProps } from "@mui/material";
2
+ import { BaseComponentProps } from "../../../../../../types";
3
+ export declare const ListItemText: ({ className, primary, secondary, ...props }: BaseComponentProps & ListItemTextProps) => JSX.Element;
@@ -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
+ }, {}, {}>;