@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
@@ -0,0 +1 @@
1
+ export declare const URL_OBJECT_KEYS: string[];
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.URL_OBJECT_KEYS = void 0;
4
+ exports.URL_OBJECT_KEYS = ["href", "query"];
@@ -1,4 +1,12 @@
1
+ /// <reference types="node" />
2
+ import { UrlObject } from "url";
1
3
  export declare enum ANCHOR_TARGET {
2
4
  BLANK = "_blank",
3
5
  SELF = "_self"
4
6
  }
7
+ export declare type StrictUrlObject = Omit<UrlObject, "href" | "query"> & {
8
+ href: string;
9
+ query: string;
10
+ };
11
+ export declare type Url = string | UrlObjectWithHrefAndQuery;
12
+ export declare type UrlObjectWithHrefAndQuery = Pick<StrictUrlObject, "href" | "query">;
@@ -1,6 +1,19 @@
1
+ import { Url, UrlObjectWithHrefAndQuery } from "./entities";
1
2
  /**
2
3
  * Returns true if the given link is an internal link.
3
4
  * @param link - Link.
4
5
  * @returns true if the given link is an internal link.
5
6
  */
6
7
  export declare function isClientSideNavigation(link: string): boolean;
8
+ /**
9
+ * Returns true if the given url is a URL object with href and query.
10
+ * @param value - URL.
11
+ * @returns true if the given url is a URL object with href and query.
12
+ */
13
+ export declare function isURLObjectWithHrefAndQuery(value: Url): value is UrlObjectWithHrefAndQuery;
14
+ /**
15
+ * Returns true if the given url is a string.
16
+ * @param value - URL.
17
+ * @returns true if the given url is a string.
18
+ */
19
+ export declare function isURLString(value: Url): value is string;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isClientSideNavigation = void 0;
3
+ exports.isURLString = exports.isURLObjectWithHrefAndQuery = exports.isClientSideNavigation = void 0;
4
+ const constants_1 = require("./constants");
4
5
  /**
5
6
  * Returns true if the given link is an internal link.
6
7
  * @param link - Link.
@@ -10,3 +11,22 @@ function isClientSideNavigation(link) {
10
11
  return /^\/(?!\/)/.test(link);
11
12
  }
12
13
  exports.isClientSideNavigation = isClientSideNavigation;
14
+ /**
15
+ * Returns true if the given url is a URL object with href and query.
16
+ * @param value - URL.
17
+ * @returns true if the given url is a URL object with href and query.
18
+ */
19
+ function isURLObjectWithHrefAndQuery(value) {
20
+ return (typeof value !== "string" &&
21
+ Object.entries(value).every(([key, value]) => constants_1.URL_OBJECT_KEYS.includes(key) && !!value));
22
+ }
23
+ exports.isURLObjectWithHrefAndQuery = isURLObjectWithHrefAndQuery;
24
+ /**
25
+ * Returns true if the given url is a string.
26
+ * @param value - URL.
27
+ * @returns true if the given url is a string.
28
+ */
29
+ function isURLString(value) {
30
+ return typeof value === "string";
31
+ }
32
+ exports.isURLString = isURLString;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { UrlObjectWithHrefAndQuery } from "../../../../common/entities";
3
+ import { LinkProps } from "../../link";
4
+ export interface ExploreViewLinkProps extends Omit<LinkProps, "copyable" | "noWrap" | "url"> {
5
+ url: UrlObjectWithHrefAndQuery;
6
+ }
7
+ export declare const ExploreViewLink: ({ className, label, onClick, target, url, }: ExploreViewLinkProps) => JSX.Element;
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __importDefault = (this && this.__importDefault) || function (mod) {
26
+ return (mod && mod.__esModule) ? mod : { "default": mod };
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.ExploreViewLink = void 0;
30
+ const link_1 = __importDefault(require("next/link"));
31
+ const react_1 = __importStar(require("react"));
32
+ const useExploreState_1 = require("../../../../../../hooks/useExploreState");
33
+ const exploreState_1 = require("../../../../../../providers/exploreState");
34
+ const entities_1 = require("../../../../common/entities");
35
+ const PARAM_FILTER = "filter";
36
+ const ExploreViewLink = ({ className, label, onClick, target = entities_1.ANCHOR_TARGET.SELF, url, }) => {
37
+ const { exploreDispatch, exploreState } = (0, useExploreState_1.useExploreState)();
38
+ if (!isValidExploreURL(url, exploreState)) {
39
+ throwError(url);
40
+ }
41
+ const onNavigate = (0, react_1.useCallback)(() => {
42
+ const entityListType = getEntityListType(url.href);
43
+ const filters = getSelectedFilters(url.query);
44
+ exploreDispatch({
45
+ payload: { entityListType, filters },
46
+ type: exploreState_1.ExploreActionKind.UpdateEntityFilters,
47
+ });
48
+ onClick === null || onClick === void 0 ? void 0 : onClick();
49
+ }, [exploreDispatch, onClick, url]);
50
+ return (react_1.default.createElement(link_1.default, { className: className, href: url.href, onClick: onNavigate, rel: "noopener", target: target }, label));
51
+ };
52
+ exports.ExploreViewLink = ExploreViewLink;
53
+ /**
54
+ * Returns the entity list type "entityListType" inferred from the given href.
55
+ * @param href - Href.
56
+ * @returns entity list type.
57
+ */
58
+ function getEntityListType(href) {
59
+ return href.substring(1);
60
+ }
61
+ /**
62
+ * Returns the selected filters from the given query.
63
+ * @param query - Query.
64
+ * @returns selected filters.
65
+ */
66
+ function getSelectedFilters(query) {
67
+ const decodedQuery = decodeURIComponent(query);
68
+ const parsedQuery = JSON.parse(decodedQuery);
69
+ return parsedQuery[PARAM_FILTER];
70
+ }
71
+ /**
72
+ * Returns true if the given value is a SelectedFilter.
73
+ * @param value - Value.
74
+ * @returns true if the given value is a SelectedFilter.
75
+ */
76
+ function isSelectedFilter(value) {
77
+ return (typeof value === "object" &&
78
+ value !== null &&
79
+ "categoryKey" in value &&
80
+ "value" in value);
81
+ }
82
+ /**
83
+ * Returns true if the given query string is a valid JSON string.
84
+ * @param query - Query string.
85
+ * @returns true if the given query string is a valid JSON string.
86
+ */
87
+ function isValidJsonString(query) {
88
+ try {
89
+ JSON.parse(query);
90
+ return true;
91
+ }
92
+ catch (e) {
93
+ return false;
94
+ }
95
+ }
96
+ /**
97
+ * Returns true if the given explore link is valid.
98
+ * @param url - Explore link URL.
99
+ * @param exploreState - Explore state.
100
+ * @returns true if the given explore link is valid.
101
+ */
102
+ function isValidExploreURL(url, exploreState) {
103
+ const validHref = isValidHref(url, exploreState);
104
+ const validQuery = isValidQuery(url);
105
+ return validHref && validQuery;
106
+ }
107
+ /**
108
+ * Returns true if the given href is a configured key in the explore state's entityPageState.
109
+ * @param url - Explore link URL.
110
+ * @param exploreState - Explore state.
111
+ * @returns true if the given href is configured in the explore state.
112
+ */
113
+ function isValidHref(url, exploreState) {
114
+ const { entityPageState } = exploreState;
115
+ const { href } = url;
116
+ return href.startsWith("/") && href.substring(1) in entityPageState;
117
+ }
118
+ /**
119
+ * Returns true if the given explore query is valid.
120
+ * @param url - Explore link URL.
121
+ * @returns true if the given explore query is valid.
122
+ */
123
+ function isValidQuery(url) {
124
+ const { query } = url;
125
+ // Decode and parse the query.
126
+ const decodedQuery = decodeURIComponent(query);
127
+ // Query should be a valid JSON string.
128
+ if (isValidJsonString(decodedQuery)) {
129
+ const parsedQuery = JSON.parse(decodedQuery);
130
+ // Query should contain "filter" key.
131
+ if (PARAM_FILTER in parsedQuery) {
132
+ const filters = parsedQuery[PARAM_FILTER];
133
+ // Filter should be an array.
134
+ if (Array.isArray(filters)) {
135
+ // Filter should contain only SelectedFilter objects.
136
+ return filters.every(isSelectedFilter);
137
+ }
138
+ }
139
+ }
140
+ return false;
141
+ }
142
+ /**
143
+ * Throws an error with the given URL object.
144
+ * @param url - URL object.
145
+ */
146
+ function throwError(url) {
147
+ throw new Error(`Invalid explore URL href or query: ${url.href}, ${url.query}`);
148
+ }
@@ -1,6 +1,6 @@
1
1
  import { LinkProps as MLinkProps } from "@mui/material";
2
2
  import { ReactNode } from "react";
3
- import { ANCHOR_TARGET } from "../../common/entities";
3
+ import { ANCHOR_TARGET, Url } from "../../common/entities";
4
4
  export interface LinkProps {
5
5
  className?: string;
6
6
  copyable?: boolean;
@@ -8,6 +8,6 @@ export interface LinkProps {
8
8
  noWrap?: MLinkProps["noWrap"];
9
9
  onClick?: () => void;
10
10
  target?: ANCHOR_TARGET;
11
- url: string;
11
+ url: Url;
12
12
  }
13
13
  export declare const Link: ({ className, copyable, label, noWrap, onClick, target, url, }: LinkProps) => JSX.Element;
@@ -11,12 +11,28 @@ const utils_1 = require("../../../../common/utils");
11
11
  const copyToClipboard_1 = require("../../../common/CopyToClipboard/copyToClipboard");
12
12
  const entities_1 = require("../../common/entities");
13
13
  const utils_2 = require("../../common/utils");
14
+ const exploreViewLink_1 = require("./components/ExploreViewLink/exploreViewLink");
14
15
  const Link = ({ className, copyable = false, label, noWrap = false, onClick, target, url, }) => {
15
- return (react_1.default.createElement(react_1.default.Fragment, null, (0, utils_2.isClientSideNavigation)(url) ? (react_1.default.createElement(react_1.default.Fragment, null,
16
- react_1.default.createElement(link_1.default, { href: url, legacyBehavior: true, passHref: true },
17
- react_1.default.createElement(material_1.Link, { className: className, rel: "noopener", noWrap: noWrap, target: target || entities_1.ANCHOR_TARGET.SELF, onClick: onClick }, label)),
18
- copyable && react_1.default.createElement(copyToClipboard_1.CopyToClipboard, { copyStr: url }))) : (0, utils_1.isValidUrl)(url) ? (react_1.default.createElement(react_1.default.Fragment, null,
19
- react_1.default.createElement(material_1.Link, { className: className, href: url, rel: "noopener noreferrer", noWrap: noWrap, target: target || entities_1.ANCHOR_TARGET.BLANK, onClick: onClick }, label),
20
- copyable && react_1.default.createElement(copyToClipboard_1.CopyToClipboard, { copyStr: url }))) : (label)));
16
+ if ((0, utils_2.isURLObjectWithHrefAndQuery)(url)) {
17
+ /* Internal navigation - explore link */
18
+ return (react_1.default.createElement(exploreViewLink_1.ExploreViewLink, { className: className, label: label, onClick: onClick, target: target, url: url }));
19
+ }
20
+ if ((0, utils_2.isURLString)(url)) {
21
+ if ((0, utils_2.isClientSideNavigation)(url)) {
22
+ /* Client-side navigation */
23
+ return (react_1.default.createElement(react_1.default.Fragment, null,
24
+ react_1.default.createElement(link_1.default, { href: url, legacyBehavior: true, passHref: true },
25
+ react_1.default.createElement(material_1.Link, { className: className, rel: "noopener", noWrap: noWrap, target: target || entities_1.ANCHOR_TARGET.SELF, onClick: onClick }, label)),
26
+ copyable && react_1.default.createElement(copyToClipboard_1.CopyToClipboard, { copyStr: url })));
27
+ }
28
+ if ((0, utils_1.isValidUrl)(url)) {
29
+ /* External navigation */
30
+ return (react_1.default.createElement(react_1.default.Fragment, null,
31
+ react_1.default.createElement(material_1.Link, { className: className, href: url, noWrap: noWrap, onClick: onClick, rel: "noopener noreferrer", target: target || entities_1.ANCHOR_TARGET.BLANK }, label),
32
+ copyable && react_1.default.createElement(copyToClipboard_1.CopyToClipboard, { copyStr: url })));
33
+ }
34
+ }
35
+ /* Invalid URL */
36
+ return react_1.default.createElement(react_1.default.Fragment, null, label);
21
37
  };
22
38
  exports.Link = Link;
@@ -0,0 +1,7 @@
1
+ import { CircularProgressProps as MCircularProgressProps } from "@mui/material";
2
+ import { ElementType } from "react";
3
+ export interface CircularProgressProps extends MCircularProgressProps {
4
+ className?: string;
5
+ Track?: ElementType<CircularProgressProps>;
6
+ }
7
+ export declare const CircularProgress: ({ className, value, Track, ...props }: CircularProgressProps) => JSX.Element;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.CircularProgress = void 0;
18
+ const material_1 = require("@mui/material");
19
+ const react_1 = __importDefault(require("react"));
20
+ const circularProgress_styles_1 = require("./circularProgress.styles");
21
+ const circularProgressTrack_1 = require("./components/CircularProgressTrack/circularProgressTrack");
22
+ const CircularProgress = (_a) => {
23
+ var { className, value, Track = circularProgressTrack_1.CircularProgressTrack } = _a, props = __rest(_a, ["className", "value", "Track"]) /* Spread props to allow for CircularProgress specific props e.g. "disableShrink". */;
24
+ return (react_1.default.createElement(circularProgress_styles_1.ProgressPositioner, { className: className },
25
+ react_1.default.createElement(Track, Object.assign({}, props)),
26
+ react_1.default.createElement(material_1.CircularProgress, Object.assign({ value: value }, props))));
27
+ };
28
+ exports.CircularProgress = CircularProgress;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const ProgressPositioner: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ProgressPositioner = void 0;
7
+ const styled_1 = __importDefault(require("@emotion/styled"));
8
+ exports.ProgressPositioner = styled_1.default.div `
9
+ display: flex;
10
+ position: relative; /* positions track */
11
+ `;
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import { CircularProgressProps as MCircularProgressProps } from "@mui/material";
3
+ export interface CircularProgressTrackProps extends MCircularProgressProps {
4
+ className?: string;
5
+ track?: boolean;
6
+ }
7
+ export declare const CircularProgressTrack: ({ className, track, value, ...props }: CircularProgressTrackProps) => JSX.Element;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.CircularProgressTrack = void 0;
38
+ const react_1 = __importStar(require("react"));
39
+ const circularProgressTrack_styles_1 = require("./circularProgressTrack.styles");
40
+ const CircularProgressTrack = (_a) => {
41
+ var { className, track = true, value = 100 } = _a, props = __rest(_a, ["className", "track", "value"]) /* Spread props to allow for CircularProgress specific props e.g. "disableShrink". */;
42
+ return (react_1.default.createElement(react_1.Fragment, null, track && (react_1.default.createElement(circularProgressTrack_styles_1.CircularProgress, Object.assign({ className: className, value: value }, props)))));
43
+ };
44
+ exports.CircularProgressTrack = CircularProgressTrack;
@@ -0,0 +1,3 @@
1
+ export declare const CircularProgress: import("@emotion/styled").StyledComponent<import("@mui/material").CircularProgressProps & {
2
+ theme?: import("@emotion/react").Theme | undefined;
3
+ }, {}, {}>;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.CircularProgress = void 0;
7
+ const styled_1 = __importDefault(require("@emotion/styled"));
8
+ const material_1 = require("@mui/material");
9
+ const colors_1 = require("../../../../../../../styles/common/mixins/colors");
10
+ exports.CircularProgress = (0, styled_1.default)(material_1.CircularProgress) `
11
+ color: ${colors_1.smokeLight};
12
+ left: 0;
13
+ position: absolute;
14
+ top: 0;
15
+ z-index: 0;
16
+
17
+ &.MuiCircularProgress-colorAlert {
18
+ color: ${colors_1.alertLight};
19
+ }
20
+
21
+ &.MuiCircularProgress-colorInfo {
22
+ color: ${colors_1.infoLight};
23
+ }
24
+
25
+ &.MuiCircularProgress-colorSuccess {
26
+ color: ${colors_1.successLight};
27
+ }
28
+
29
+ &.MuiCircularProgress-colorWarning {
30
+ color: ${colors_1.warningLight};
31
+ }
32
+ `;
@@ -1,5 +1,7 @@
1
+ import { CategoryGroup } from "../../../config/entities";
1
2
  import { ExploreState, PaginationState } from "../../exploreState";
2
3
  import { EntityState } from "../entities";
4
+ export declare const DEFAULT_CATEGORY_GROUP_SAVED_FILTERS: CategoryGroup;
3
5
  export declare const DEFAULT_ENTITY_STATE: EntityState;
4
6
  export declare const DEFAULT_PAGINATION_STATE: PaginationState;
5
7
  export declare const INITIAL_STATE: ExploreState;
@@ -1,6 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.INITIAL_STATE = exports.DEFAULT_PAGINATION_STATE = exports.DEFAULT_ENTITY_STATE = void 0;
3
+ exports.INITIAL_STATE = exports.DEFAULT_PAGINATION_STATE = exports.DEFAULT_ENTITY_STATE = exports.DEFAULT_CATEGORY_GROUP_SAVED_FILTERS = void 0;
4
+ const constants_1 = require("../constants");
5
+ exports.DEFAULT_CATEGORY_GROUP_SAVED_FILTERS = {
6
+ categoryConfigs: [
7
+ { key: constants_1.SELECT_CATEGORY_KEY.SAVED_FILTERS, label: "Saved Filters" },
8
+ ],
9
+ };
4
10
  exports.DEFAULT_ENTITY_STATE = {
5
11
  categoryViews: [],
6
12
  filterState: [],
@@ -16,14 +16,7 @@ function buildCategoryGroups(categoryGroupConfig) {
16
16
  const { categoryGroups, savedFilters } = categoryGroupConfig;
17
17
  if (!savedFilters)
18
18
  return categoryGroups;
19
- const clonedCategoryGroups = [...categoryGroups];
20
- const savedFiltersCategoryGroup = {
21
- categoryConfigs: [
22
- { key: constants_2.SELECT_CATEGORY_KEY.SAVED_FILTERS, label: "Saved Filters" },
23
- ],
24
- };
25
- clonedCategoryGroups.unshift(savedFiltersCategoryGroup);
26
- return clonedCategoryGroups;
19
+ return [constants_3.DEFAULT_CATEGORY_GROUP_SAVED_FILTERS, ...categoryGroups];
27
20
  }
28
21
  /**
29
22
  * Returns the saved filters as select categories.
@@ -1,5 +1,5 @@
1
1
  import { ColumnSort, RowSelectionState, VisibilityState } from "@tanstack/react-table";
2
- import { CategoryKey, CategoryValueKey, PaginationDirectionType, SelectCategory } from "../../../common/entities";
2
+ import { CategoryKey, CategoryValueKey, PaginationDirectionType, SelectCategory, SelectedFilter } from "../../../common/entities";
3
3
  import { ENTITY_VIEW, ListItems, PaginationResponse, RelatedListItems } from "../../exploreState";
4
4
  import { ListItem } from "../entities";
5
5
  /**
@@ -48,6 +48,13 @@ export declare type ToggleEntityViewPayload = ENTITY_VIEW;
48
48
  * Update column visibility payload.
49
49
  */
50
50
  export declare type UpdateColumnVisibilityPayload = VisibilityState;
51
+ /**
52
+ * Update entity filters payload.
53
+ */
54
+ export interface UpdateEntityFiltersPayload {
55
+ entityListType: string;
56
+ filters: SelectedFilter[];
57
+ }
51
58
  /**
52
59
  * Update entity view access payload.
53
60
  */
@@ -70,9 +70,10 @@ export declare function resetPage(paginationState: PaginationState): PaginationS
70
70
  /**
71
71
  * Resets row selection for the current entity and entities that share the same category group config key.
72
72
  * @param state - Explore state.
73
+ * @param categoryGroupConfigKey - Category group config key.
73
74
  * @returns entity page state mapper with row selection reset.
74
75
  */
75
- export declare function resetRowSelection(state: ExploreState): EntityPageStateMapper;
76
+ export declare function resetRowSelection(state: ExploreState, categoryGroupConfigKey?: string): EntityPageStateMapper;
76
77
  /**
77
78
  * Updates entity page state for the given entity path.
78
79
  * @param entityPath - Entity path.
@@ -93,9 +94,10 @@ export declare function updateEntityPageStateSorting(state: ExploreState, sortin
93
94
  * Updates entity state by category group config key.
94
95
  * @param state - Explore state.
95
96
  * @param nextEntityState - Partial next entity state.
97
+ * @param categoryGroupConfigKey - Category group config key.
96
98
  * @returns updated entity state by category group config key.
97
99
  */
98
- export declare function updateEntityStateByCategoryGroupConfigKey(state: ExploreState, nextEntityState: Partial<EntityState>): void;
100
+ export declare function updateEntityStateByCategoryGroupConfigKey(state: ExploreState, nextEntityState: Partial<EntityState>, categoryGroupConfigKey?: string): void;
99
101
  /**
100
102
  * Updates the entity page state for each entity with row selection enabled,
101
103
  * by updating the visibility of the "select" column based on user access and resetting row selection state.
@@ -118,10 +118,10 @@ exports.resetPage = resetPage;
118
118
  /**
119
119
  * Resets row selection for the current entity and entities that share the same category group config key.
120
120
  * @param state - Explore state.
121
+ * @param categoryGroupConfigKey - Category group config key.
121
122
  * @returns entity page state mapper with row selection reset.
122
123
  */
123
- function resetRowSelection(state) {
124
- const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState);
124
+ function resetRowSelection(state, categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState)) {
125
125
  return Object.entries(state.entityPageState).reduce((acc, [entityPath, entityPageState]) => {
126
126
  if (entityPageState.categoryGroupConfigKey === categoryGroupConfigKey) {
127
127
  return Object.assign(Object.assign({}, acc), { [entityPath]: Object.assign(Object.assign({}, entityPageState), { rowSelection: {} }) });
@@ -173,10 +173,10 @@ exports.updateEntityPageStateSorting = updateEntityPageStateSorting;
173
173
  * Updates entity state by category group config key.
174
174
  * @param state - Explore state.
175
175
  * @param nextEntityState - Partial next entity state.
176
+ * @param categoryGroupConfigKey - Category group config key.
176
177
  * @returns updated entity state by category group config key.
177
178
  */
178
- function updateEntityStateByCategoryGroupConfigKey(state, nextEntityState) {
179
- const categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState);
179
+ function updateEntityStateByCategoryGroupConfigKey(state, nextEntityState, categoryGroupConfigKey = getEntityCategoryGroupConfigKey(state.tabValue, state.entityPageState)) {
180
180
  const entityState = getEntityState(state, categoryGroupConfigKey);
181
181
  if (entityState) {
182
182
  setEntityStateByCategoryGroupConfigKey(categoryGroupConfigKey, state, Object.assign(Object.assign({}, entityState), nextEntityState));
@@ -3,7 +3,7 @@ import { AzulSearchIndex } from "../apis/azul/common/entities";
3
3
  import { SelectCategoryView, SelectedFilter } from "../common/entities";
4
4
  import { CategoryGroup, SiteConfig } from "../config/entities";
5
5
  import { EntityPageStateMapper, EntityStateByCategoryGroupConfigKey, ListItem } from "./exploreState/entities";
6
- import { ApplySavedFilterPayload, PaginateTablePayload, PatchExploreResponsePayload, ProcessExploreResponsePayload, ProcessRelatedResponsePayload, ResetExploreResponsePayload, ToggleEntityViewPayload, UpdateColumnVisibilityPayload, UpdateEntityViewAccessPayload, UpdateFilterPayload, UpdateRowSelectionPayload, UpdateSortingPayload } from "./exploreState/payloads/entities";
6
+ import { ApplySavedFilterPayload, PaginateTablePayload, PatchExploreResponsePayload, ProcessExploreResponsePayload, ProcessRelatedResponsePayload, ResetExploreResponsePayload, ToggleEntityViewPayload, UpdateColumnVisibilityPayload, UpdateEntityFiltersPayload, UpdateEntityViewAccessPayload, UpdateFilterPayload, UpdateRowSelectionPayload, UpdateSortingPayload } from "./exploreState/payloads/entities";
7
7
  export declare type CatalogState = string | undefined;
8
8
  /**
9
9
  * Entity view.
@@ -114,6 +114,7 @@ export declare enum ExploreActionKind {
114
114
  SelectEntityType = "SELECT_ENTITY_TYPE",
115
115
  ToggleEntityView = "TOGGLE_ENTITY_VIEW",
116
116
  UpdateColumnVisibility = "UPDATE_COLUMN_VISIBILITY",
117
+ UpdateEntityFilters = "UPDATE_ENTITY_FILTERS",
117
118
  UpdateEntityViewAccess = "UPDATE_ENTITY_VIEW_ACCESS",
118
119
  UpdateFilter = "UPDATE_FILTER",
119
120
  UpdateRowSelection = "UPDATE_ROW_SELECTION",
@@ -122,7 +123,7 @@ export declare enum ExploreActionKind {
122
123
  /**
123
124
  * Explore action.
124
125
  */
125
- export declare type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ProcessRelatedResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | ToggleEntityViewAction | UpdateColumnVisibilityAction | UpdateEntityViewAccessAction | UpdateFilterAction | UpdateRowSelectionAction | UpdateSortingAction;
126
+ export declare type ExploreAction = ApplySavedFilterAction | ClearFiltersAction | PaginateTableAction | PatchExploreResponseAction | ProcessExploreResponseAction | ProcessRelatedResponseAction | ResetExploreResponseAction | ResetStateAction | SelectEntityTypeAction | ToggleEntityViewAction | UpdateColumnVisibilityAction | UpdateEntityFiltersAction | UpdateEntityViewAccessAction | UpdateFilterAction | UpdateRowSelectionAction | UpdateSortingAction;
126
127
  /**
127
128
  * Apply saved filter action.
128
129
  */
@@ -200,6 +201,13 @@ declare type UpdateColumnVisibilityAction = {
200
201
  payload: UpdateColumnVisibilityPayload;
201
202
  type: ExploreActionKind.UpdateColumnVisibility;
202
203
  };
204
+ /**
205
+ * Update entity filters action.
206
+ */
207
+ declare type UpdateEntityFiltersAction = {
208
+ payload: UpdateEntityFiltersPayload;
209
+ type: ExploreActionKind.UpdateEntityFilters;
210
+ };
203
211
  /**
204
212
  * Update entity view access action.
205
213
  */
@@ -104,6 +104,7 @@ var ExploreActionKind;
104
104
  ExploreActionKind["SelectEntityType"] = "SELECT_ENTITY_TYPE";
105
105
  ExploreActionKind["ToggleEntityView"] = "TOGGLE_ENTITY_VIEW";
106
106
  ExploreActionKind["UpdateColumnVisibility"] = "UPDATE_COLUMN_VISIBILITY";
107
+ ExploreActionKind["UpdateEntityFilters"] = "UPDATE_ENTITY_FILTERS";
107
108
  ExploreActionKind["UpdateEntityViewAccess"] = "UPDATE_ENTITY_VIEW_ACCESS";
108
109
  ExploreActionKind["UpdateFilter"] = "UPDATE_FILTER";
109
110
  ExploreActionKind["UpdateRowSelection"] = "UPDATE_ROW_SELECTION";
@@ -224,6 +225,18 @@ function exploreReducer(state, action, exploreContext) {
224
225
  case ExploreActionKind.UpdateColumnVisibility: {
225
226
  return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.updateEntityPageState)(state.tabValue, state.entityPageState, { columnsVisibility: payload }) });
226
227
  }
228
+ /**
229
+ * Update entity filters.
230
+ */
231
+ case ExploreActionKind.UpdateEntityFilters: {
232
+ const { entityListType, filters: filterState } = payload;
233
+ const categoryGroupConfigKey = (0, utils_2.getEntityCategoryGroupConfigKey)(entityListType, state.entityPageState);
234
+ (0, utils_2.updateEntityStateByCategoryGroupConfigKey)(state, {
235
+ filterState,
236
+ savedFilterState: [], // Clear saved filter state.
237
+ }, categoryGroupConfigKey);
238
+ return Object.assign(Object.assign({}, state), { entityPageState: (0, utils_2.resetRowSelection)(state, categoryGroupConfigKey) });
239
+ }
227
240
  /**
228
241
  * Update entity view access
229
242
  **/