@databiosphere/findable-ui 3.1.0 → 3.2.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 (49) hide show
  1. package/lib/components/Links/common/constants.d.ts +1 -0
  2. package/lib/components/Links/common/constants.js +4 -0
  3. package/lib/components/Links/common/entities.d.ts +8 -0
  4. package/lib/components/Links/common/utils.d.ts +13 -0
  5. package/lib/components/Links/common/utils.js +21 -1
  6. package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.d.ts +7 -0
  7. package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +148 -0
  8. package/lib/components/Links/components/Link/link.d.ts +2 -2
  9. package/lib/components/Links/components/Link/link.js +22 -6
  10. package/lib/components/common/Progress/components/CircularProgress/circularProgress.d.ts +7 -0
  11. package/lib/components/common/Progress/components/CircularProgress/circularProgress.js +28 -0
  12. package/lib/components/common/Progress/components/CircularProgress/circularProgress.styles.d.ts +5 -0
  13. package/lib/components/common/Progress/components/CircularProgress/circularProgress.styles.js +11 -0
  14. package/lib/components/common/Progress/components/CircularProgress/components/CircularProgressTrack/circularProgressTrack.d.ts +7 -0
  15. package/lib/components/common/Progress/components/CircularProgress/components/CircularProgressTrack/circularProgressTrack.js +44 -0
  16. package/lib/components/common/Progress/components/CircularProgress/components/CircularProgressTrack/circularProgressTrack.styles.d.ts +3 -0
  17. package/lib/components/common/Progress/components/CircularProgress/components/CircularProgressTrack/circularProgressTrack.styles.js +32 -0
  18. package/lib/providers/exploreState/initializer/constants.d.ts +2 -0
  19. package/lib/providers/exploreState/initializer/constants.js +7 -1
  20. package/lib/providers/exploreState/initializer/utils.js +1 -8
  21. package/lib/providers/exploreState/payloads/entities.d.ts +8 -1
  22. package/lib/providers/exploreState/utils.d.ts +4 -2
  23. package/lib/providers/exploreState/utils.js +4 -4
  24. package/lib/providers/exploreState.d.ts +10 -2
  25. package/lib/providers/exploreState.js +13 -0
  26. package/lib/styles/common/mixins/colors.d.ts +3 -3
  27. package/lib/styles/common/mixins/colors.js +7 -7
  28. package/lib/theme/common/components.d.ts +6 -0
  29. package/lib/theme/common/components.js +31 -1
  30. package/lib/theme/theme.js +1 -0
  31. package/package.json +1 -1
  32. package/src/components/Links/common/constants.ts +1 -0
  33. package/src/components/Links/common/entities.ts +11 -0
  34. package/src/components/Links/common/utils.ts +28 -0
  35. package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +172 -0
  36. package/src/components/Links/components/Link/link.tsx +36 -14
  37. package/src/components/common/Progress/components/CircularProgress/circularProgress.styles.ts +6 -0
  38. package/src/components/common/Progress/components/CircularProgress/circularProgress.tsx +26 -0
  39. package/src/components/common/Progress/components/CircularProgress/components/CircularProgressTrack/circularProgressTrack.styles.ts +33 -0
  40. package/src/components/common/Progress/components/CircularProgress/components/CircularProgressTrack/circularProgressTrack.tsx +23 -0
  41. package/src/providers/exploreState/initializer/constants.ts +8 -0
  42. package/src/providers/exploreState/initializer/utils.ts +6 -9
  43. package/src/providers/exploreState/payloads/entities.ts +8 -0
  44. package/src/providers/exploreState/utils.ts +11 -7
  45. package/src/providers/exploreState.tsx +33 -0
  46. package/src/styles/common/mixins/colors.ts +6 -6
  47. package/src/theme/common/components.ts +32 -0
  48. package/src/theme/theme.ts +1 -0
  49. package/types/data-explorer-ui.d.ts +10 -0
@@ -158,13 +158,16 @@ export function resetPage(paginationState: PaginationState): PaginationState {
158
158
  /**
159
159
  * Resets row selection for the current entity and entities that share the same category group config key.
160
160
  * @param state - Explore state.
161
+ * @param categoryGroupConfigKey - Category group config key.
161
162
  * @returns entity page state mapper with row selection reset.
162
163
  */
163
- export function resetRowSelection(state: ExploreState): EntityPageStateMapper {
164
- const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
164
+ export function resetRowSelection(
165
+ state: ExploreState,
166
+ categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
165
167
  state.tabValue,
166
168
  state.entityPageState
167
- );
169
+ )
170
+ ): EntityPageStateMapper {
168
171
  return Object.entries(state.entityPageState).reduce(
169
172
  (acc, [entityPath, entityPageState]) => {
170
173
  if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
@@ -247,16 +250,17 @@ export function updateEntityPageStateSorting(
247
250
  * Updates entity state by category group config key.
248
251
  * @param state - Explore state.
249
252
  * @param nextEntityState - Partial next entity state.
253
+ * @param categoryGroupConfigKey - Category group config key.
250
254
  * @returns updated entity state by category group config key.
251
255
  */
252
256
  export function updateEntityStateByCategoryGroupConfigKey(
253
257
  state: ExploreState,
254
- nextEntityState: Partial<EntityState>
255
- ): void {
256
- const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
258
+ nextEntityState: Partial<EntityState>,
259
+ categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
257
260
  state.tabValue,
258
261
  state.entityPageState
259
- );
262
+ )
263
+ ): void {
260
264
  const entityState = getEntityState(state, categoryGroupConfigKey);
261
265
  if (entityState) {
262
266
  setEntityStateByCategoryGroupConfigKey(categoryGroupConfigKey, state, {
@@ -36,6 +36,7 @@ import {
36
36
  ResetExploreResponsePayload,
37
37
  ToggleEntityViewPayload,
38
38
  UpdateColumnVisibilityPayload,
39
+ UpdateEntityFiltersPayload,
39
40
  UpdateEntityViewAccessPayload,
40
41
  UpdateFilterPayload,
41
42
  UpdateRowSelectionPayload,
@@ -239,6 +240,7 @@ export enum ExploreActionKind {
239
240
  SelectEntityType = "SELECT_ENTITY_TYPE",
240
241
  ToggleEntityView = "TOGGLE_ENTITY_VIEW",
241
242
  UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
243
+ UpdateEntityFilters = "UPDATE_ENTITY_FILTERS",
242
244
  UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
243
245
  UpdateFilter = "UPDATE_FILTER",
244
246
  UpdateRowSelection = "UPDATE_ROW_SELECTION",
@@ -260,6 +262,7 @@ export type ExploreAction =
260
262
  | SelectEntityTypeAction
261
263
  | ToggleEntityViewAction
262
264
  | UpdateColumnVisibilityAction
265
+ | UpdateEntityFiltersAction
263
266
  | UpdateEntityViewAccessAction
264
267
  | UpdateFilterAction
265
268
  | UpdateRowSelectionAction
@@ -353,6 +356,14 @@ type UpdateColumnVisibilityAction = {
353
356
  type: ExploreActionKind.UpdateColumnVisibility;
354
357
  };
355
358
 
359
+ /**
360
+ * Update entity filters action.
361
+ */
362
+ type UpdateEntityFiltersAction = {
363
+ payload: UpdateEntityFiltersPayload;
364
+ type: ExploreActionKind.UpdateEntityFilters;
365
+ };
366
+
356
367
  /**
357
368
  * Update entity view access action.
358
369
  */
@@ -586,6 +597,28 @@ function exploreReducer(
586
597
  ),
587
598
  };
588
599
  }
600
+ /**
601
+ * Update entity filters.
602
+ */
603
+ case ExploreActionKind.UpdateEntityFilters: {
604
+ const { entityListType, filters: filterState } = payload;
605
+ const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(
606
+ entityListType,
607
+ state.entityPageState
608
+ );
609
+ updateEntityStateByCategoryGroupConfigKey(
610
+ state,
611
+ {
612
+ filterState,
613
+ savedFilterState: [], // Clear saved filter state.
614
+ },
615
+ categoryGroupConfigKey
616
+ );
617
+ return {
618
+ ...state,
619
+ entityPageState: resetRowSelection(state, categoryGroupConfigKey),
620
+ };
621
+ }
589
622
  /**
590
623
  * Update entity view access
591
624
  **/
@@ -2,6 +2,8 @@ import { CommonColors, PaletteColor } from "@mui/material/styles/createPalette";
2
2
  import { ThemeProps } from "../../../theme/theme";
3
3
 
4
4
  // Alert
5
+ export const alertLight = ({ theme }: ThemeProps): PaletteColor["light"] =>
6
+ theme.palette.alert.light;
5
7
  export const alertLightest = ({
6
8
  theme,
7
9
  }: ThemeProps): PaletteColor["lightest"] => theme.palette.alert.lightest;
@@ -13,8 +15,6 @@ export const errorMain = ({ theme }: ThemeProps): PaletteColor["main"] =>
13
15
  theme.palette.error.main;
14
16
 
15
17
  // Info
16
- export const infoDark = ({ theme }: ThemeProps): PaletteColor["dark"] =>
17
- theme.palette.info.dark;
18
18
  export const infoLight = ({ theme }: ThemeProps): PaletteColor["light"] =>
19
19
  theme.palette.info.light;
20
20
  export const infoLightest = ({ theme }: ThemeProps): PaletteColor["lightest"] =>
@@ -23,12 +23,8 @@ export const infoMain = ({ theme }: ThemeProps): PaletteColor["main"] =>
23
23
  theme.palette.info.main;
24
24
 
25
25
  // Ink
26
- export const inkDark = ({ theme }: ThemeProps): PaletteColor["dark"] =>
27
- theme.palette.ink.dark;
28
26
  export const inkLight = ({ theme }: ThemeProps): PaletteColor["light"] =>
29
27
  theme.palette.ink.light;
30
- export const inkLightest = ({ theme }: ThemeProps): PaletteColor["lightest"] =>
31
- theme.palette.ink.lightest;
32
28
  export const inkMain = ({ theme }: ThemeProps): PaletteColor["main"] =>
33
29
  theme.palette.ink.main;
34
30
 
@@ -50,6 +46,8 @@ export const smokeMain = ({ theme }: ThemeProps): PaletteColor["main"] =>
50
46
  theme.palette.smoke.main;
51
47
 
52
48
  // Success
49
+ export const successLight = ({ theme }: ThemeProps): PaletteColor["light"] =>
50
+ theme.palette.success.light;
53
51
  export const successLightest = ({
54
52
  theme,
55
53
  }: ThemeProps): PaletteColor["lightest"] => theme.palette.success.lightest;
@@ -57,6 +55,8 @@ export const successMain = ({ theme }: ThemeProps): PaletteColor["main"] =>
57
55
  theme.palette.success.main;
58
56
 
59
57
  // Warning
58
+ export const warningLight = ({ theme }: ThemeProps): PaletteColor["light"] =>
59
+ theme.palette.warning.light;
60
60
  export const warningLightest = ({
61
61
  theme,
62
62
  }: ThemeProps): PaletteColor["lightest"] => theme.palette.warning.lightest;
@@ -615,6 +615,33 @@ export const MuiChip = (theme: Theme): Components["MuiChip"] => {
615
615
  };
616
616
  };
617
617
 
618
+ /**
619
+ * MuiCircularProgress Component
620
+ * @param theme - Theme.
621
+ * @returns MuiCircularProgress component theme styles.
622
+ */
623
+ export const MuiCircularProgress = (
624
+ theme: Theme
625
+ ): Components["MuiCircularProgress"] => {
626
+ return {
627
+ styleOverrides: {
628
+ circle: {
629
+ strokeLinecap: "round",
630
+ },
631
+ },
632
+ variants: [
633
+ {
634
+ props: {
635
+ color: "alert",
636
+ },
637
+ style: {
638
+ color: theme.palette.alert.main,
639
+ },
640
+ },
641
+ ],
642
+ };
643
+ };
644
+
618
645
  /**
619
646
  * MuiCssBaseline Component
620
647
  * @param theme - Theme.
@@ -943,6 +970,11 @@ export const MuiLink: Components["MuiLink"] = {
943
970
  defaultProps: {
944
971
  underline: "hover",
945
972
  },
973
+ styleOverrides: {
974
+ root: {
975
+ cursor: "pointer",
976
+ },
977
+ },
946
978
  };
947
979
 
948
980
  /**
@@ -83,6 +83,7 @@ export function createAppTheme(customOptions?: ThemeOptions): Theme {
83
83
  MuiCard: C.MuiCard,
84
84
  MuiCheckbox: C.MuiCheckbox(theme),
85
85
  MuiChip: C.MuiChip(theme),
86
+ MuiCircularProgress: C.MuiCircularProgress(theme),
86
87
  MuiCssBaseline: C.MuiCssBaseline(theme),
87
88
  MuiDialog: C.MuiDialog(theme),
88
89
  MuiDialogActions: C.MuiDialogActions,
@@ -3,6 +3,7 @@ import type {} from "@mui/material/Alert";
3
3
  import type {} from "@mui/material/Button";
4
4
  import type {} from "@mui/material/Checkbox";
5
5
  import type {} from "@mui/material/Chip";
6
+ import type {} from "@mui/material/CircularProgress";
6
7
  import type {} from "@mui/material/IconButton";
7
8
  import type {} from "@mui/material/Paper";
8
9
  import type {} from "@mui/material/styles";
@@ -54,6 +55,15 @@ declare module "@mui/material/Button" {
54
55
  }
55
56
  }
56
57
 
58
+ /**
59
+ * CircularProgress prop options.
60
+ */
61
+ declare module "@mui/material/CircularProgress" {
62
+ interface CircularProgressPropsColorOverrides {
63
+ alert: true;
64
+ }
65
+ }
66
+
57
67
  /**
58
68
  * Checkbox prop options.
59
69
  */