@databiosphere/findable-ui 33.0.0 → 34.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. package/.release-please-manifest.json +1 -1
  2. package/CHANGELOG.md +18 -0
  3. package/jest.config.js +4 -0
  4. package/lib/common/entities.d.ts +3 -1
  5. package/lib/components/DataDictionary/components/Entities/entities.d.ts +1 -1
  6. package/lib/components/DataDictionary/components/Entities/entities.js +3 -2
  7. package/lib/components/DataDictionary/components/Entities/types.d.ts +3 -4
  8. package/lib/components/DataDictionary/components/Entity/entity.d.ts +1 -1
  9. package/lib/components/DataDictionary/components/Entity/entity.js +12 -6
  10. package/lib/components/DataDictionary/components/Entity/entity.styles.js +7 -1
  11. package/lib/components/DataDictionary/components/Entity/types.d.ts +4 -4
  12. package/lib/components/DataDictionary/components/Entity/utils.d.ts +9 -0
  13. package/lib/components/DataDictionary/components/Entity/utils.js +18 -0
  14. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.d.ts +4 -0
  15. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.js +9 -0
  16. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/types.d.ts +5 -0
  17. package/lib/components/DataDictionary/components/Filters/components/ColumnFilters/types.js +1 -0
  18. package/lib/components/DataDictionary/components/Filters/filters.d.ts +4 -0
  19. package/lib/components/DataDictionary/components/Filters/filters.js +7 -0
  20. package/lib/components/DataDictionary/components/Filters/filters.styles.d.ts +7 -0
  21. package/lib/components/DataDictionary/components/Filters/filters.styles.js +13 -0
  22. package/lib/components/DataDictionary/components/Filters/stories/constants.d.ts +4 -0
  23. package/lib/components/DataDictionary/components/Filters/stories/constants.js +25 -0
  24. package/lib/components/DataDictionary/components/Filters/stories/filters.stories.d.ts +6 -0
  25. package/lib/components/DataDictionary/components/Filters/stories/filters.stories.js +31 -0
  26. package/lib/components/DataDictionary/components/Filters/stories/hook.d.ts +5 -0
  27. package/lib/components/DataDictionary/components/Filters/stories/hook.js +5 -0
  28. package/lib/components/DataDictionary/components/Filters/stories/types.d.ts +4 -0
  29. package/lib/components/DataDictionary/components/Filters/stories/types.js +1 -0
  30. package/lib/components/DataDictionary/components/Filters/types.d.ts +5 -0
  31. package/lib/components/DataDictionary/components/Filters/types.js +1 -0
  32. package/lib/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.js +3 -1
  33. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.d.ts +2 -0
  34. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.js +5 -0
  35. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.d.ts +5 -0
  36. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.js +24 -0
  37. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/types.d.ts +5 -0
  38. package/lib/components/DataDictionary/components/Layout/components/FiltersLayout/types.js +1 -0
  39. package/lib/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.js +1 -1
  40. package/lib/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.js +1 -0
  41. package/lib/components/DataDictionary/components/Layout/constants.d.ts +4 -0
  42. package/lib/components/DataDictionary/components/Layout/constants.js +4 -0
  43. package/lib/components/DataDictionary/components/Outline/utils.d.ts +5 -5
  44. package/lib/components/DataDictionary/components/Outline/utils.js +23 -6
  45. package/lib/components/DataDictionary/components/Table/hook.d.ts +3 -3
  46. package/lib/components/DataDictionary/components/Table/hook.js +11 -3
  47. package/lib/components/DataDictionary/components/Table/options/columnFilters/constants.d.ts +2 -0
  48. package/lib/components/DataDictionary/components/Table/options/columnFilters/constants.js +8 -0
  49. package/lib/components/DataDictionary/components/Table/options/columnFilters/hook.d.ts +6 -0
  50. package/lib/components/DataDictionary/components/Table/options/columnFilters/hook.js +14 -0
  51. package/lib/components/DataDictionary/components/Table/options/expanded/constants.d.ts +2 -0
  52. package/lib/components/DataDictionary/components/Table/options/expanded/constants.js +5 -0
  53. package/lib/components/DataDictionary/components/Table/options/faceted/constants.d.ts +2 -0
  54. package/lib/components/DataDictionary/components/Table/options/faceted/constants.js +6 -0
  55. package/lib/components/DataDictionary/components/Table/options/grouping/constants.d.ts +2 -0
  56. package/lib/components/DataDictionary/components/Table/options/grouping/constants.js +5 -0
  57. package/lib/components/DataDictionary/components/Table/options/hook.d.ts +1 -1
  58. package/lib/components/DataDictionary/components/Table/options/hook.js +17 -0
  59. package/lib/components/DataDictionary/components/Table/options/visibility/constants.d.ts +2 -0
  60. package/lib/components/DataDictionary/components/Table/options/visibility/constants.js +3 -0
  61. package/lib/components/DataDictionary/components/Table/table.d.ts +1 -1
  62. package/lib/components/DataDictionary/components/Table/table.js +2 -2
  63. package/lib/components/DataDictionary/components/Table/types.d.ts +4 -1
  64. package/lib/components/DataDictionary/components/Table/utils.d.ts +18 -0
  65. package/lib/components/DataDictionary/components/Table/utils.js +27 -0
  66. package/lib/components/DataDictionary/dataDictionary.d.ts +1 -1
  67. package/lib/components/DataDictionary/dataDictionary.js +8 -6
  68. package/lib/components/DataDictionary/hooks/UseDataDictionary/hook.js +16 -5
  69. package/lib/components/DataDictionary/hooks/UseDataDictionary/types.d.ts +5 -4
  70. package/lib/components/DataDictionary/types.d.ts +1 -0
  71. package/lib/components/Detail/components/Table/components/TableBody/tableBody.d.ts +8 -2
  72. package/lib/components/Detail/components/Table/components/TableBody/tableBody.js +2 -2
  73. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.d.ts +8 -2
  74. package/lib/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.js +2 -2
  75. package/lib/components/Detail/components/Table/components/TableRows/tableRows.d.ts +8 -2
  76. package/lib/components/Detail/components/Table/components/TableRows/tableRows.js +2 -2
  77. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
  78. package/lib/components/Filter/components/FilterList/filterList.styles.d.ts +2 -0
  79. package/lib/components/Filter/components/FilterList/filterList.styles.js +28 -15
  80. package/lib/components/Filter/components/SearchAllFiltersSearch/searchAllFiltersSearch.styles.d.ts +1 -1
  81. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +1 -1
  82. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +1 -1
  83. package/lib/components/Layout/components/Outline/components/ContentsTab/contentsTab.styles.d.ts +1 -1
  84. package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
  85. package/lib/components/Login/components/Button/button.styles.d.ts +1 -1
  86. package/lib/components/Table/common/utils.d.ts +6 -0
  87. package/lib/components/Table/common/utils.js +14 -0
  88. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.d.ts +7 -0
  89. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.js +33 -0
  90. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.d.ts +3 -0
  91. package/lib/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.js +19 -0
  92. package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.d.ts +2 -0
  93. package/lib/components/Table/components/TableFeatures/ColumnFilter/constants.js +14 -0
  94. package/lib/components/Table/components/TableFeatures/ColumnFilter/types.d.ts +7 -0
  95. package/lib/components/Table/components/TableFeatures/ColumnFilter/types.js +1 -0
  96. package/lib/components/Table/components/TableFeatures/ColumnFilter/utils.d.ts +6 -0
  97. package/lib/components/Table/components/TableFeatures/ColumnFilter/utils.js +23 -0
  98. package/lib/components/Table/featureOptions/facetedColumn/utils.d.ts +6 -0
  99. package/lib/components/Table/featureOptions/facetedColumn/utils.js +9 -0
  100. package/lib/components/common/ButtonGroup/constants.d.ts +2 -0
  101. package/lib/components/common/ButtonGroup/constants.js +11 -0
  102. package/lib/components/common/Tabs/tabs.styles.d.ts +1 -1
  103. package/lib/mocks/@storybook/addon-actions.d.ts +9 -0
  104. package/lib/mocks/@storybook/addon-actions.js +9 -0
  105. package/lib/providers/exploreState/entities.d.ts +1 -1
  106. package/lib/providers/exploreState.js +10 -10
  107. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.d.ts +10 -0
  108. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/handlers.js +18 -0
  109. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.d.ts +1 -0
  110. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/hook.js +33 -0
  111. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.d.ts +11 -0
  112. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/types.js +5 -0
  113. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/utils.d.ts +34 -0
  114. package/lib/providers/exploreStateSync/hooks/UseMetaCommands/utils.js +59 -0
  115. package/lib/providers/exploreStateSync/provider.d.ts +19 -0
  116. package/lib/providers/exploreStateSync/provider.js +22 -0
  117. package/lib/styles/common/mui/buttonGroup.d.ts +13 -0
  118. package/lib/styles/common/mui/buttonGroup.js +34 -0
  119. package/lib/styles/common/mui/typography.js +2 -0
  120. package/lib/tests/mui/constants.d.ts +1 -0
  121. package/lib/tests/mui/constants.js +1 -0
  122. package/lib/tests/utils.d.ts +6 -0
  123. package/lib/tests/utils.js +8 -0
  124. package/lib/theme/common/components.d.ts +0 -6
  125. package/lib/theme/common/components.js +17 -31
  126. package/lib/theme/components/index.d.ts +1 -0
  127. package/lib/theme/components/index.js +1 -0
  128. package/lib/theme/components/muiButtonGroup.d.ts +2 -0
  129. package/lib/theme/components/muiButtonGroup.js +76 -0
  130. package/lib/theme/theme.js +1 -1
  131. package/lib/views/ExploreView/exploreView.js +2 -1
  132. package/package.json +1 -1
  133. package/src/common/entities.ts +3 -1
  134. package/src/components/DataDictionary/components/Entities/entities.tsx +5 -9
  135. package/src/components/DataDictionary/components/Entities/types.ts +3 -4
  136. package/src/components/DataDictionary/components/Entity/entity.styles.ts +9 -1
  137. package/src/components/DataDictionary/components/Entity/entity.tsx +18 -8
  138. package/src/components/DataDictionary/components/Entity/types.ts +4 -4
  139. package/src/components/DataDictionary/components/Entity/utils.ts +25 -0
  140. package/src/components/DataDictionary/components/Filters/components/ColumnFilters/columnFilters.tsx +21 -0
  141. package/src/components/DataDictionary/components/Filters/components/ColumnFilters/types.ts +6 -0
  142. package/src/components/DataDictionary/components/Filters/filters.styles.ts +14 -0
  143. package/src/components/DataDictionary/components/Filters/filters.tsx +16 -0
  144. package/src/components/DataDictionary/components/Filters/stories/constants.ts +31 -0
  145. package/src/components/DataDictionary/components/Filters/stories/filters.stories.tsx +42 -0
  146. package/src/components/DataDictionary/components/Filters/stories/hook.ts +9 -0
  147. package/src/components/DataDictionary/components/Filters/stories/types.ts +3 -0
  148. package/src/components/DataDictionary/components/Filters/types.ts +6 -0
  149. package/src/components/DataDictionary/components/Layout/components/EntitiesLayout/entitiesLayout.styles.ts +4 -1
  150. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.styles.ts +27 -0
  151. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/filtersLayout.tsx +10 -0
  152. package/src/components/DataDictionary/components/Layout/components/FiltersLayout/types.ts +6 -0
  153. package/src/components/DataDictionary/components/Layout/components/OutlineLayout/outlineLayout.styles.ts +1 -1
  154. package/src/components/DataDictionary/components/Layout/components/TitleLayout/titleLayout.styles.ts +1 -0
  155. package/src/components/DataDictionary/components/Layout/constants.ts +4 -0
  156. package/src/components/DataDictionary/components/Outline/utils.ts +35 -13
  157. package/src/components/DataDictionary/components/Table/hook.ts +17 -5
  158. package/src/components/DataDictionary/components/Table/options/columnFilters/constants.ts +16 -0
  159. package/src/components/DataDictionary/components/Table/options/columnFilters/hook.ts +32 -0
  160. package/src/components/DataDictionary/components/Table/options/expanded/constants.ts +13 -0
  161. package/src/components/DataDictionary/components/Table/options/faceted/constants.ts +14 -0
  162. package/src/components/DataDictionary/components/Table/options/grouping/constants.ts +9 -0
  163. package/src/components/DataDictionary/components/Table/options/hook.ts +26 -3
  164. package/src/components/DataDictionary/components/Table/options/visibility/constants.ts +5 -0
  165. package/src/components/DataDictionary/components/Table/table.tsx +2 -0
  166. package/src/components/DataDictionary/components/Table/types.ts +8 -1
  167. package/src/components/DataDictionary/components/Table/utils.ts +40 -0
  168. package/src/components/DataDictionary/dataDictionary.tsx +9 -5
  169. package/src/components/DataDictionary/hooks/UseDataDictionary/hook.ts +19 -5
  170. package/src/components/DataDictionary/hooks/UseDataDictionary/types.ts +5 -4
  171. package/src/components/DataDictionary/types.ts +1 -0
  172. package/src/components/Detail/components/Table/components/TableBody/tableBody.tsx +14 -3
  173. package/src/components/Detail/components/Table/components/TableRows/components/CollapsableRows/collapsableRows.tsx +9 -2
  174. package/src/components/Detail/components/Table/components/TableRows/tableRows.tsx +9 -2
  175. package/src/components/Filter/components/FilterList/filterList.styles.ts +34 -15
  176. package/src/components/Table/common/utils.ts +16 -0
  177. package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.styles.ts +23 -0
  178. package/src/components/Table/components/TableFeatures/ColumnFilter/columnFilter.tsx +98 -0
  179. package/src/components/Table/components/TableFeatures/ColumnFilter/constants.ts +16 -0
  180. package/src/components/Table/components/TableFeatures/ColumnFilter/types.ts +10 -0
  181. package/src/components/Table/components/TableFeatures/ColumnFilter/utils.ts +27 -0
  182. package/src/components/Table/featureOptions/facetedColumn/utils.ts +14 -0
  183. package/src/components/common/ButtonGroup/constants.ts +13 -0
  184. package/src/mocks/@storybook/addon-actions.ts +10 -0
  185. package/src/providers/exploreState/entities.ts +1 -1
  186. package/src/providers/exploreState.tsx +10 -11
  187. package/src/providers/exploreStateSync/hooks/UseMetaCommands/handlers.ts +25 -0
  188. package/src/providers/exploreStateSync/hooks/UseMetaCommands/hook.ts +38 -0
  189. package/src/providers/exploreStateSync/hooks/UseMetaCommands/types.ts +13 -0
  190. package/src/providers/exploreStateSync/hooks/UseMetaCommands/utils.ts +69 -0
  191. package/src/providers/exploreStateSync/provider.tsx +29 -0
  192. package/src/styles/common/mui/buttonGroup.ts +46 -0
  193. package/src/styles/common/mui/typography.ts +2 -0
  194. package/src/tests/mui/constants.ts +1 -0
  195. package/src/tests/utils.ts +9 -0
  196. package/src/theme/common/components.ts +17 -32
  197. package/src/theme/components/index.ts +1 -0
  198. package/src/theme/components/muiButtonGroup.ts +79 -0
  199. package/src/theme/theme.ts +1 -1
  200. package/src/views/ExploreView/exploreView.tsx +3 -2
  201. package/tests/dataDictionaryColumnFilters.test.tsx +101 -0
  202. package/lib/providers/exploreState/hooks/UseMetaCommands/actions.d.ts +0 -13
  203. package/lib/providers/exploreState/hooks/UseMetaCommands/actions.js +0 -24
  204. package/lib/providers/exploreState/hooks/UseMetaCommands/types.d.ts +0 -4
  205. package/lib/providers/exploreState/hooks/UseMetaCommands/types.js +0 -5
  206. package/lib/providers/exploreState/hooks/UseMetaCommands/useMetaCommands.d.ts +0 -2
  207. package/lib/providers/exploreState/hooks/UseMetaCommands/useMetaCommands.js +0 -21
  208. package/lib/providers/exploreState/hooks/UseMetaCommands/utils.d.ts +0 -9
  209. package/lib/providers/exploreState/hooks/UseMetaCommands/utils.js +0 -25
  210. package/src/providers/exploreState/hooks/UseMetaCommands/actions.ts +0 -29
  211. package/src/providers/exploreState/hooks/UseMetaCommands/types.ts +0 -4
  212. package/src/providers/exploreState/hooks/UseMetaCommands/useMetaCommands.ts +0 -27
  213. package/src/providers/exploreState/hooks/UseMetaCommands/utils.ts +0 -33
@@ -0,0 +1,7 @@
1
+ import { Button, MenuProps } from "@mui/material";
2
+ import { Column, RowData } from "@tanstack/react-table";
3
+ import { BaseComponentProps } from "../../../../types";
4
+ export interface ColumnFilterProps<T extends RowData> extends BaseComponentProps, Omit<MenuProps, "anchorEl" | "onClose" | "open"> {
5
+ Button?: typeof Button;
6
+ column: Column<T>;
7
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns an updater function for column filter.
3
+ * @param value - Value.
4
+ * @returns An updater function that returns the new filter value.
5
+ */
6
+ export declare function updater(value: unknown): (old: unknown[] | undefined) => unknown[] | undefined;
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Returns an updater function for column filter.
3
+ * @param value - Value.
4
+ * @returns An updater function that returns the new filter value.
5
+ */
6
+ export function updater(value) {
7
+ return (old) => {
8
+ // If no old value, return new value.
9
+ if (!old)
10
+ return [value];
11
+ // If value already exists, remove it.
12
+ if (old.includes(value)) {
13
+ // Filter out the value.
14
+ const next = old.filter((v) => v !== value);
15
+ // If no values remain, return undefined.
16
+ if (next.length === 0)
17
+ return undefined;
18
+ return next;
19
+ }
20
+ // Otherwise, add the value.
21
+ return [...old, value];
22
+ };
23
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Sorts Map entries by key.
3
+ * @param facetedValues - Map of faceted values.
4
+ * @returns Sorted array of [key, value] entries.
5
+ */
6
+ export declare function getSortedFacetedValues(facetedValues: Map<unknown, number>): [unknown, number][];
@@ -0,0 +1,9 @@
1
+ import { COLLATOR_CASE_INSENSITIVE } from "../../../../common/constants";
2
+ /**
3
+ * Sorts Map entries by key.
4
+ * @param facetedValues - Map of faceted values.
5
+ * @returns Sorted array of [key, value] entries.
6
+ */
7
+ export function getSortedFacetedValues(facetedValues) {
8
+ return [...facetedValues].sort((a, b) => COLLATOR_CASE_INSENSITIVE.compare(String(a), String(b)));
9
+ }
@@ -0,0 +1,2 @@
1
+ import { ButtonGroupProps } from "@mui/material";
2
+ export declare const BUTTON_GROUP_PROPS: Record<string, Partial<ButtonGroupProps>>;
@@ -0,0 +1,11 @@
1
+ import { BUTTON_GROUP_PROPS as MUI_BUTTON_GROUP_PROPS } from "../../../styles/common/mui/buttonGroup";
2
+ export const BUTTON_GROUP_PROPS = {
3
+ PRIMARY_CONTAINED: {
4
+ color: MUI_BUTTON_GROUP_PROPS.COLOR.PRIMARY,
5
+ variant: MUI_BUTTON_GROUP_PROPS.VARIANT.CONTAINED,
6
+ },
7
+ SECONDARY_OUTLINED: {
8
+ color: MUI_BUTTON_GROUP_PROPS.COLOR.SECONDARY,
9
+ variant: MUI_BUTTON_GROUP_PROPS.VARIANT.OUTLINED,
10
+ },
11
+ };
@@ -9,7 +9,7 @@ export declare const TabScrollFuzz: import("@emotion/styled").StyledComponent<{
9
9
  } & Props, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
10
10
  export declare const Tab: import("@emotion/styled").StyledComponent<import("@mui/material").TabOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
11
11
  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;
12
- }, "label" | "style" | "className" | "classes" | "tabIndex" | "children" | "sx" | "disabled" | "value" | "action" | "icon" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "wrapped" | "iconPosition"> & {
12
+ }, "label" | "style" | "className" | "classes" | "tabIndex" | "children" | "sx" | "disabled" | "value" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "icon" | "wrapped" | "iconPosition"> & {
13
13
  theme?: import("@emotion/react").Theme;
14
14
  }, {}, {}>;
15
15
  export {};
@@ -0,0 +1,9 @@
1
+ import { jest } from "@jest/globals";
2
+ /**
3
+ * Mock for Storybook's @storybook/addon-actions function.
4
+ * The mock keeps the same function signature as the real Storybook action,
5
+ * does not trigger any Storybook logic, and simply returns a Jest mock function
6
+ * for use in tests.
7
+ * @returns A Jest mock function.
8
+ */
9
+ export declare const action: () => jest.Mock;
@@ -0,0 +1,9 @@
1
+ import { jest } from "@jest/globals";
2
+ /**
3
+ * Mock for Storybook's @storybook/addon-actions function.
4
+ * The mock keeps the same function signature as the real Storybook action,
5
+ * does not trigger any Storybook logic, and simply returns a Jest mock function
6
+ * for use in tests.
7
+ * @returns A Jest mock function.
8
+ */
9
+ export const action = () => jest.fn();
@@ -4,7 +4,7 @@ import { CategoryView } from "../../common/categories/views/types";
4
4
  import { CategoryValueKey, SelectCategory, SelectedFilter } from "../../common/entities";
5
5
  import { RowPreviewState } from "../../components/Table/features/RowPreview/entities";
6
6
  import { CategoryGroup, CategoryGroupConfig, EntityPath, SavedFilter } from "../../config/entities";
7
- import { META_COMMAND } from "./hooks/UseMetaCommands/types";
7
+ import { META_COMMAND } from "../exploreStateSync/hooks/UseMetaCommands/types";
8
8
  export interface EntityPageState {
9
9
  categoryGroupConfigKey: CategoryGroupConfigKey;
10
10
  columnVisibility: VisibilityState;
@@ -8,11 +8,10 @@ import { syncStateFromUrlAction } from "./exploreState/actions/syncStateFromUrl/
8
8
  import { updateGroupingAction } from "./exploreState/actions/updateGrouping/action";
9
9
  import { updateColumnVisibilityAction } from "./exploreState/actions/updateVisibility/action";
10
10
  import { useBeforePopState } from "./exploreState/hooks/UseBeforePopState/useBeforePopState";
11
- import { META_COMMAND } from "./exploreState/hooks/UseMetaCommands/types";
12
- import { useMetaCommands } from "./exploreState/hooks/UseMetaCommands/useMetaCommands";
13
11
  import { DEFAULT_PAGINATION_STATE, INITIAL_STATE, } from "./exploreState/initializer/constants";
14
12
  import { initReducerArguments } from "./exploreState/initializer/utils";
15
13
  import { buildEntityStateSavedFilterState, buildNextSavedFilterState, closeRowPreview, getEntityCategoryGroupConfigKey, getEntityState, getEntityStateSavedProperty, getFilterCount, patchEntityListItems, resetPage, updateEntityPageState, updateEntityPageStateWithCommonCategoryGroupConfigKey, updateEntityStateByCategoryGroupConfigKey, updateSelectColumnVisibility, } from "./exploreState/utils";
14
+ import { META_COMMAND } from "./exploreStateSync/hooks/UseMetaCommands/types";
16
15
  /**
17
16
  * Explore state context for storing and using filter-related and explore state.
18
17
  */
@@ -56,8 +55,6 @@ export function ExploreStateProvider({ children, entityListType, }) {
56
55
  type: ExploreActionKind.ResetExploreResponse,
57
56
  });
58
57
  }, [exploreDispatch, token]);
59
- // Meta-command related side effects.
60
- useMetaCommands({ exploreDispatch, exploreState });
61
58
  // Before pop state related side effects (forward / backward navigation by browser buttons).
62
59
  useBeforePopState({ exploreDispatch, exploreState });
63
60
  return (React.createElement(ExploreStateContext.Provider, { value: exploreContextValue }, children));
@@ -118,7 +115,7 @@ function exploreReducer(state, action, exploreContext) {
118
115
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { grouping, rowPreview, rowSelection, sorting }),
119
116
  filterCount: getFilterCount(filterState),
120
117
  filterState,
121
- meta: { command: META_COMMAND.NAVIGATE_TO_FILTERS },
118
+ meta: { command: META_COMMAND.STATE_TO_URL_PUSH },
122
119
  paginationState: resetPage(state.paginationState),
123
120
  rowPreview,
124
121
  };
@@ -141,7 +138,7 @@ function exploreReducer(state, action, exploreContext) {
141
138
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { rowPreview, rowSelection }),
142
139
  filterCount,
143
140
  filterState,
144
- meta: { command: META_COMMAND.NAVIGATE_TO_FILTERS },
141
+ meta: { command: META_COMMAND.STATE_TO_URL_PUSH },
145
142
  paginationState: resetPage(state.paginationState),
146
143
  rowPreview,
147
144
  };
@@ -233,8 +230,11 @@ function exploreReducer(state, action, exploreContext) {
233
230
  **/
234
231
  case ExploreActionKind.SelectEntityType: {
235
232
  if (payload === state.tabValue) {
236
- // Update meta to match command "REPLACE_TO_FILTERS" - facilitates navigation to filters on return back to entity from elsewhere.
237
- return { ...state, meta: { command: META_COMMAND.REPLACE_TO_FILTERS } };
233
+ // Update meta to match command "STATE_TO_URL_REPLACE" - facilitates navigation to filters on return back to entity from elsewhere.
234
+ return {
235
+ ...state,
236
+ meta: { command: META_COMMAND.STATE_TO_URL_REPLACE },
237
+ };
238
238
  }
239
239
  const entityState = getEntityState(state, getEntityCategoryGroupConfigKey(payload, state.entityPageState));
240
240
  const rowPreview = closeRowPreview(state.rowPreview); // Close row preview, without updating the entity page state row preview.
@@ -246,7 +246,7 @@ function exploreReducer(state, action, exploreContext) {
246
246
  filterState: entityState.filterState,
247
247
  listItems: [],
248
248
  loading: true,
249
- meta: { command: META_COMMAND.REPLACE_TO_FILTERS },
249
+ meta: { command: META_COMMAND.STATE_TO_URL_REPLACE },
250
250
  paginationState: { ...resetPage(state.paginationState), rows: 0 },
251
251
  rowPreview,
252
252
  tabValue: payload,
@@ -324,7 +324,7 @@ function exploreReducer(state, action, exploreContext) {
324
324
  entityPageState: updateEntityPageStateWithCommonCategoryGroupConfigKey(state, { rowPreview, rowSelection }),
325
325
  filterCount: getFilterCount(filterState),
326
326
  filterState,
327
- meta: { command: META_COMMAND.NAVIGATE_TO_FILTERS },
327
+ meta: { command: META_COMMAND.STATE_TO_URL_PUSH },
328
328
  paginationState: resetPage(state.paginationState),
329
329
  rowPreview,
330
330
  };
@@ -0,0 +1,10 @@
1
+ import { NextRouter } from "next/router";
2
+ import { ExploreQueryState } from "./types";
3
+ /**
4
+ * Updates the URL query parameters based on state.
5
+ * Pushes or replaces the query to the router.
6
+ * @param state - State -- partial explore state.
7
+ * @param currentQuery - Query -- current.
8
+ * @param method - "push" or "replace".
9
+ */
10
+ export declare function updateUrlFromState(state: ExploreQueryState, currentQuery: NextRouter["query"], method?: "push" | "replace"): void;
@@ -0,0 +1,18 @@
1
+ import Router from "next/router";
2
+ import { buildQuery, stringifyQuery } from "./utils";
3
+ /**
4
+ * Updates the URL query parameters based on state.
5
+ * Pushes or replaces the query to the router.
6
+ * @param state - State -- partial explore state.
7
+ * @param currentQuery - Query -- current.
8
+ * @param method - "push" or "replace".
9
+ */
10
+ export function updateUrlFromState(state, currentQuery, method = "push") {
11
+ // Build the next query.
12
+ const query = buildQuery(state);
13
+ // Do nothing if the next query is the same as the current query.
14
+ if (stringifyQuery(query) === stringifyQuery(currentQuery))
15
+ return;
16
+ // Push or replace the query to the router.
17
+ Router[method]({ query }, undefined, { shallow: true });
18
+ }
@@ -0,0 +1 @@
1
+ export declare const useMetaCommands: () => void;
@@ -0,0 +1,33 @@
1
+ import { useRouter } from "next/router";
2
+ import { useEffect, useMemo } from "react";
3
+ import { useExploreState } from "../../../../hooks/useExploreState";
4
+ import { clearMeta } from "../../../exploreState/actions/clearMeta/dispatch";
5
+ import { updateUrlFromState } from "./handlers";
6
+ import { META_COMMAND } from "./types";
7
+ import { getQueryState } from "./utils";
8
+ export const useMetaCommands = () => {
9
+ const { exploreDispatch, exploreState } = useExploreState();
10
+ // Router must be ready before executing any meta-command side effects.
11
+ const { isReady, query } = useRouter();
12
+ // Command.
13
+ const command = exploreState.meta?.command;
14
+ // Extract relevant state to update URL.
15
+ const state = useMemo(() => getQueryState(exploreState), [exploreState]);
16
+ useEffect(() => {
17
+ // Do nothing if the router is not ready.
18
+ if (!isReady)
19
+ return;
20
+ switch (command) {
21
+ case META_COMMAND.STATE_TO_URL_PUSH:
22
+ updateUrlFromState(state, query);
23
+ exploreDispatch(clearMeta());
24
+ break;
25
+ case META_COMMAND.STATE_TO_URL_REPLACE:
26
+ updateUrlFromState(state, query, "replace");
27
+ exploreDispatch(clearMeta());
28
+ break;
29
+ default:
30
+ break;
31
+ }
32
+ }, [command, exploreDispatch, isReady, query, state]);
33
+ };
@@ -0,0 +1,11 @@
1
+ import { ExploreState } from "../../../exploreState";
2
+ export interface ExploreQueryState {
3
+ catalog: ExploreState["catalogState"];
4
+ entityListType: ExploreState["tabValue"];
5
+ ff: ExploreState["featureFlagState"];
6
+ filter: ExploreState["filterState"];
7
+ }
8
+ export declare enum META_COMMAND {
9
+ STATE_TO_URL_PUSH = "STATE_TO_URL_PUSH",
10
+ STATE_TO_URL_REPLACE = "STATE_TO_URL_REPLACE"
11
+ }
@@ -0,0 +1,5 @@
1
+ export var META_COMMAND;
2
+ (function (META_COMMAND) {
3
+ META_COMMAND["STATE_TO_URL_PUSH"] = "STATE_TO_URL_PUSH";
4
+ META_COMMAND["STATE_TO_URL_REPLACE"] = "STATE_TO_URL_REPLACE";
5
+ })(META_COMMAND || (META_COMMAND = {}));
@@ -0,0 +1,34 @@
1
+ import { NextRouter } from "next/router";
2
+ import { ExploreState } from "../../../exploreState";
3
+ import { ExploreQueryState } from "./types";
4
+ /**
5
+ * Builds a query object from state.
6
+ * State values are expected to be undefined, string, or an array.
7
+ * Undefined values and empty arrays are not included in the query.
8
+ * @param state - State -- partial explore state.
9
+ * @returns A query object.
10
+ */
11
+ export declare function buildQuery(state: ExploreQueryState): NextRouter["query"];
12
+ /**
13
+ * Extracts URL-relevant values from the ExploreState for query parameter synchronization.
14
+ *
15
+ * This function maps specific properties from the full ExploreState to the
16
+ * ExploreQueryState interface, which contains only the subset of state that
17
+ * should be synchronized with the URL.
18
+ *
19
+ * The extracted properties are:
20
+ * - catalog: Current catalog selection (string | undefined)
21
+ * - entityListType: Current active tab value (string)
22
+ * - ff: Feature flag state (string | undefined)
23
+ * - filter: Applied filters (SelectedFilter[])
24
+ *
25
+ * @param exploreState - Explore state.
26
+ * @returns Subset of state used for URL query parameters.
27
+ */
28
+ export declare function getQueryState(exploreState: ExploreState): ExploreQueryState;
29
+ /**
30
+ * Returns a sorted string representation of a query object.
31
+ * @param query - Query object.
32
+ * @returns Sorted string representation of the query object.
33
+ */
34
+ export declare function stringifyQuery(query: NextRouter["query"]): string;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Builds a query object from state.
3
+ * State values are expected to be undefined, string, or an array.
4
+ * Undefined values and empty arrays are not included in the query.
5
+ * @param state - State -- partial explore state.
6
+ * @returns A query object.
7
+ */
8
+ export function buildQuery(state) {
9
+ const query = {};
10
+ for (const [key, value] of Object.entries(state)) {
11
+ // Handle the undefined case.
12
+ if (value === undefined)
13
+ continue;
14
+ // Handle the string case.
15
+ if (typeof value === "string") {
16
+ query[key] = value;
17
+ continue;
18
+ }
19
+ // Handle the array case.
20
+ if (value.length === 0)
21
+ continue;
22
+ query[key] = JSON.stringify(value);
23
+ }
24
+ return query;
25
+ }
26
+ /**
27
+ * Extracts URL-relevant values from the ExploreState for query parameter synchronization.
28
+ *
29
+ * This function maps specific properties from the full ExploreState to the
30
+ * ExploreQueryState interface, which contains only the subset of state that
31
+ * should be synchronized with the URL.
32
+ *
33
+ * The extracted properties are:
34
+ * - catalog: Current catalog selection (string | undefined)
35
+ * - entityListType: Current active tab value (string)
36
+ * - ff: Feature flag state (string | undefined)
37
+ * - filter: Applied filters (SelectedFilter[])
38
+ *
39
+ * @param exploreState - Explore state.
40
+ * @returns Subset of state used for URL query parameters.
41
+ */
42
+ export function getQueryState(exploreState) {
43
+ return {
44
+ catalog: exploreState.catalogState,
45
+ entityListType: exploreState.tabValue,
46
+ ff: exploreState.featureFlagState,
47
+ filter: exploreState.filterState,
48
+ };
49
+ }
50
+ /**
51
+ * Returns a sorted string representation of a query object.
52
+ * @param query - Query object.
53
+ * @returns Sorted string representation of the query object.
54
+ */
55
+ export function stringifyQuery(query) {
56
+ return JSON.stringify(Object.keys(query)
57
+ .sort()
58
+ .reduce((acc, key) => ({ ...acc, [key]: query[key] }), {}));
59
+ }
@@ -0,0 +1,19 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Synchronizes the ExploreView component's state with the Next.js URL.
4
+ *
5
+ * Listens for reducer meta-commands (`STATE_TO_URL_PUSH`/`STATE_TO_URL_REPLACE`)
6
+ * and updates the URL accordingly using router methods.
7
+ *
8
+ * Usage:
9
+ * ```tsx
10
+ * <ExploreStateProvider>
11
+ * <ExploreStateSyncProvider>
12
+ * <ExploreView />
13
+ * </ExploreStateSyncProvider>
14
+ * </ExploreStateProvider>
15
+ * ```
16
+ */
17
+ export declare function ExploreStateSyncProvider({ children, }: {
18
+ children: ReactNode;
19
+ }): JSX.Element;
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { useMetaCommands } from "./hooks/UseMetaCommands/hook";
3
+ /**
4
+ * Synchronizes the ExploreView component's state with the Next.js URL.
5
+ *
6
+ * Listens for reducer meta-commands (`STATE_TO_URL_PUSH`/`STATE_TO_URL_REPLACE`)
7
+ * and updates the URL accordingly using router methods.
8
+ *
9
+ * Usage:
10
+ * ```tsx
11
+ * <ExploreStateProvider>
12
+ * <ExploreStateSyncProvider>
13
+ * <ExploreView />
14
+ * </ExploreStateSyncProvider>
15
+ * </ExploreStateProvider>
16
+ * ```
17
+ */
18
+ export function ExploreStateSyncProvider({ children, }) {
19
+ // Meta-command related side effects.
20
+ useMetaCommands();
21
+ return React.createElement(React.Fragment, null, children);
22
+ }
@@ -0,0 +1,13 @@
1
+ import { ButtonGroupProps } from "@mui/material";
2
+ type ButtonGroupPropsOptions = {
3
+ CLASSES: typeof CLASSES;
4
+ COLOR: typeof COLOR;
5
+ SIZE: typeof SIZE;
6
+ VARIANT: typeof VARIANT;
7
+ };
8
+ declare const CLASSES: Record<string, ButtonGroupProps["classes"]>;
9
+ declare const COLOR: Record<string, ButtonGroupProps["color"]>;
10
+ declare const SIZE: Record<string, ButtonGroupProps["size"]>;
11
+ declare const VARIANT: Record<string, ButtonGroupProps["variant"]>;
12
+ export declare const BUTTON_GROUP_PROPS: ButtonGroupPropsOptions;
13
+ export {};
@@ -0,0 +1,34 @@
1
+ import { buttonGroupClasses } from "@mui/material";
2
+ const CLASSES = {
3
+ COLOR_PRIMARY: buttonGroupClasses.colorPrimary,
4
+ COLOR_SECONDARY: buttonGroupClasses.colorSecondary,
5
+ CONTAINED: buttonGroupClasses.contained,
6
+ GROUPED: buttonGroupClasses.grouped,
7
+ OUTLINED: buttonGroupClasses.outlined,
8
+ ROOT: buttonGroupClasses.root,
9
+ };
10
+ const COLOR = {
11
+ ERROR: "error",
12
+ INFO: "info",
13
+ INHERIT: "inherit",
14
+ PRIMARY: "primary",
15
+ SECONDARY: "secondary",
16
+ SUCCESS: "success",
17
+ WARNING: "warning",
18
+ };
19
+ const SIZE = {
20
+ LARGE: "large",
21
+ MEDIUM: "medium",
22
+ SMALL: "small",
23
+ };
24
+ const VARIANT = {
25
+ CONTAINED: "contained",
26
+ OUTLINED: "outlined",
27
+ TEXT: "text",
28
+ };
29
+ export const BUTTON_GROUP_PROPS = {
30
+ CLASSES,
31
+ COLOR,
32
+ SIZE,
33
+ VARIANT,
34
+ };
@@ -3,11 +3,13 @@ const COLOR = {
3
3
  INHERIT: "inherit",
4
4
  INK_LIGHT: "ink.light",
5
5
  INK_MAIN: "ink.main",
6
+ PRIMARY: "primary",
6
7
  };
7
8
  const VARIANT = {
8
9
  INHERIT: "inherit",
9
10
  TEXT_BODY_400: "text-body-400",
10
11
  TEXT_BODY_400_2_LINES: "text-body-400-2lines",
12
+ TEXT_BODY_500: "text-body-500",
11
13
  TEXT_BODY_SMALL_400: "text-body-small-400",
12
14
  TEXT_HEADING_LARGE: "text-heading-large",
13
15
  TEXT_HEADING_SMALL: "text-heading-small",
@@ -1,5 +1,6 @@
1
1
  export declare const MUI_CLASSES: {
2
2
  ACTIVE: string;
3
3
  COMPLETED: string;
4
+ DISABLED: string;
4
5
  SELECTED: string;
5
6
  };
@@ -1,5 +1,6 @@
1
1
  export const MUI_CLASSES = {
2
2
  ACTIVE: "Mui-active",
3
3
  COMPLETED: "Mui-completed",
4
+ DISABLED: "Mui-disabled",
4
5
  SELECTED: "Mui-selected",
5
6
  };
@@ -16,6 +16,12 @@ export declare function getLabelText<T extends HTMLElement = HTMLElement>(text:
16
16
  * @returns RegExp.
17
17
  */
18
18
  export declare function getStartsWithRegex(text: string): RegExp;
19
+ /**
20
+ * Retrieves an element by its role.
21
+ * @param role - The role of the element.
22
+ * @returns The element.
23
+ */
24
+ export declare function getRole<T extends HTMLElement = HTMLElement>(role: string): T;
19
25
  /**
20
26
  * Retrieves an element by its text content.
21
27
  * @param text - The text content of the element.
@@ -24,6 +24,14 @@ export function getLabelText(text) {
24
24
  export function getStartsWithRegex(text) {
25
25
  return new RegExp(`^${escapeRegExp(text)}`);
26
26
  }
27
+ /**
28
+ * Retrieves an element by its role.
29
+ * @param role - The role of the element.
30
+ * @returns The element.
31
+ */
32
+ export function getRole(role) {
33
+ return screen.getByRole(role);
34
+ }
27
35
  /**
28
36
  * Retrieves an element by its text content.
29
37
  * @param text - The text content of the element.
@@ -40,12 +40,6 @@ export declare const MuiButton: (theme: Theme) => Components["MuiButton"];
40
40
  * @returns MuiButtonBase component theme styles.
41
41
  */
42
42
  export declare const MuiButtonBase: (theme: Theme) => Components["MuiButtonBase"];
43
- /**
44
- * MuiButtonGroup Component
45
- * @param theme - Theme.
46
- * @returns MuiButtonGroup component theme styles.
47
- */
48
- export declare const MuiButtonGroup: (theme: Theme) => Components["MuiButtonGroup"];
49
43
  /**
50
44
  * MuiCard Component
51
45
  */
@@ -2,6 +2,7 @@ import { DropDownIcon } from "../../components/common/Form/components/Select/com
2
2
  import { COLOR_MIXES } from "../../styles/common/constants/colorMixes";
3
3
  import { PALETTE } from "../../styles/common/constants/palette";
4
4
  import { SHADOWS } from "../../styles/common/constants/shadows";
5
+ import { BUTTON_PROPS } from "../../styles/common/mui/button";
5
6
  import { CHIP_PROPS } from "../../styles/common/mui/chip";
6
7
  import { desktopUp, mobileUp, tabletUp } from "./breakpoints";
7
8
  import { TEXT_BODY_400, TEXT_BODY_400_2_LINES, TEXT_BODY_500, TEXT_BODY_SMALL_400, TEXT_BODY_SMALL_500, TEXT_HEADING, TEXT_HEADING_SMALL, } from "./typography";
@@ -183,6 +184,22 @@ export const MuiButton = (theme) => {
183
184
  },
184
185
  endIcon: {
185
186
  margin: 0,
187
+ variants: [
188
+ {
189
+ props: { size: BUTTON_PROPS.SIZE.MEDIUM },
190
+ style: {
191
+ marginLeft: -6,
192
+ marginRight: -6,
193
+ },
194
+ },
195
+ {
196
+ props: { size: BUTTON_PROPS.SIZE.SMALL },
197
+ style: {
198
+ marginLeft: -6,
199
+ marginRight: -6,
200
+ },
201
+ },
202
+ ],
186
203
  },
187
204
  outlinedSecondary: {
188
205
  backgroundColor: "transparent",
@@ -298,37 +315,6 @@ export const MuiButtonBase = (theme) => {
298
315
  },
299
316
  };
300
317
  };
301
- /**
302
- * MuiButtonGroup Component
303
- * @param theme - Theme.
304
- * @returns MuiButtonGroup component theme styles.
305
- */
306
- export const MuiButtonGroup = (theme) => {
307
- return {
308
- defaultProps: {
309
- disableElevation: true,
310
- disableRipple: true,
311
- },
312
- styleOverrides: {
313
- grouped: {
314
- minWidth: 0,
315
- padding: "6px 8px",
316
- },
317
- groupedContainedPrimary: {
318
- borderColor: theme.palette.primary.dark,
319
- boxShadow: `0 1px 0 0 ${theme.palette.primary.dark}`,
320
- // eslint-disable-next-line sort-keys -- disabling key order for readability
321
- "&:hover": {
322
- boxShadow: `0 1px 0 0 ${theme.palette.primary.dark}`,
323
- },
324
- // eslint-disable-next-line sort-keys -- disabling key order for readability
325
- "&:active": {
326
- boxShadow: "none",
327
- },
328
- },
329
- },
330
- };
331
- };
332
318
  /**
333
319
  * MuiCard Component
334
320
  */
@@ -1,3 +1,4 @@
1
1
  export { MuiAlert } from "./muiAlert";
2
2
  export { MuiAlertTitle } from "./muiAlertTitle";
3
+ export { MuiButtonGroup } from "./muiButtonGroup";
3
4
  export { MuiTableCell } from "./muiTableCell";
@@ -1,3 +1,4 @@
1
1
  export { MuiAlert } from "./muiAlert";
2
2
  export { MuiAlertTitle } from "./muiAlertTitle";
3
+ export { MuiButtonGroup } from "./muiButtonGroup";
3
4
  export { MuiTableCell } from "./muiTableCell";
@@ -0,0 +1,2 @@
1
+ import { Components } from "@mui/material";
2
+ export declare const MuiButtonGroup: Components["MuiButtonGroup"];