@databiosphere/findable-ui 13.0.1 → 15.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 (205) hide show
  1. package/.github/workflows/release-please.yml +3 -6
  2. package/.release-please-manifest.json +3 -0
  3. package/CHANGELOG.md +43 -0
  4. package/lib/common/analytics/entities.d.ts +18 -7
  5. package/lib/common/analytics/entities.js +5 -3
  6. package/lib/components/Export/common/tracking.d.ts +19 -3
  7. package/lib/components/Export/common/tracking.js +37 -12
  8. package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.js +3 -17
  9. package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.js +6 -3
  10. package/lib/components/Export/components/ExportToTerra/exportToTerra.d.ts +1 -1
  11. package/lib/components/Export/components/ExportToTerra/exportToTerra.js +11 -3
  12. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.d.ts +1 -1
  13. package/lib/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.js +2 -2
  14. package/lib/components/Export/components/ManifestDownload/manifestDownload.d.ts +1 -1
  15. package/lib/components/Export/components/ManifestDownload/manifestDownload.js +9 -3
  16. package/lib/components/Filter/components/FilterTag/filterTag.styles.d.ts +1 -1
  17. package/lib/components/Index/components/AzulFileDownload/azulFileDownload.d.ts +4 -1
  18. package/lib/components/Index/components/AzulFileDownload/azulFileDownload.js +3 -1
  19. package/lib/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/constants.d.ts +2 -0
  20. package/lib/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/constants.js +3 -0
  21. package/lib/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/title.d.ts +2 -0
  22. package/lib/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/title.js +27 -0
  23. package/lib/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/utils.d.ts +15 -0
  24. package/lib/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/utils.js +26 -0
  25. package/lib/components/Layout/components/Footer/components/VersionInfo/constants.d.ts +3 -0
  26. package/lib/components/Layout/components/Footer/components/VersionInfo/constants.js +27 -0
  27. package/lib/components/Layout/components/Footer/components/VersionInfo/types.d.ts +12 -0
  28. package/lib/components/Layout/components/Footer/components/VersionInfo/types.js +1 -0
  29. package/lib/components/Layout/components/Footer/components/VersionInfo/utils.d.ts +19 -0
  30. package/lib/components/Layout/components/Footer/components/VersionInfo/utils.js +29 -0
  31. package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.d.ts +3 -0
  32. package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.js +10 -0
  33. package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.styles.d.ts +5 -0
  34. package/lib/components/Layout/components/Footer/components/VersionInfo/versionInfo.styles.js +9 -0
  35. package/lib/components/Layout/components/Footer/footer.d.ts +3 -2
  36. package/lib/components/Layout/components/Footer/footer.js +4 -3
  37. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.d.ts +2 -2
  38. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.js +1 -1
  39. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.styles.js +0 -1
  40. package/lib/components/Layout/components/Outline/components/ContentsTab/contentsTab.styles.d.ts +1 -1
  41. package/lib/components/Layout/components/Outline/outline.styles.d.ts +1 -1
  42. package/lib/components/Links/components/Link/link.d.ts +2 -3
  43. package/lib/components/Links/components/Link/link.js +1 -2
  44. package/lib/components/Support/components/SupportRequest/components/Dialog/dialog.styles.js +5 -0
  45. package/lib/components/Support/components/ViewSupport/viewSupport.styles.js +5 -0
  46. package/lib/components/Table/common/utils.js +0 -1
  47. package/lib/components/common/Alert/alert.d.ts +4 -12
  48. package/lib/components/common/Alert/alert.js +5 -7
  49. package/lib/components/common/Alert/alert.styles.d.ts +1 -11
  50. package/lib/components/common/Alert/alert.styles.js +18 -24
  51. package/lib/components/common/Alert/constants.d.ts +2 -0
  52. package/lib/components/common/Alert/constants.js +27 -0
  53. package/lib/components/common/Alert/hooks/useTransition/types.d.ts +5 -0
  54. package/lib/components/common/Alert/hooks/useTransition/types.js +1 -0
  55. package/lib/components/common/Alert/hooks/useTransition/useTransition.d.ts +7 -0
  56. package/lib/components/common/Alert/hooks/useTransition/useTransition.js +20 -0
  57. package/lib/components/common/Banner/banner.d.ts +4 -7
  58. package/lib/components/common/Banner/banner.js +4 -3
  59. package/lib/components/common/Banner/banner.styles.d.ts +3 -0
  60. package/lib/components/common/Banner/banner.styles.js +28 -0
  61. package/lib/components/common/Banner/components/CookieBanner/constants.d.ts +2 -0
  62. package/lib/components/common/Banner/components/CookieBanner/constants.js +7 -0
  63. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.d.ts +3 -3
  64. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.js +17 -31
  65. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.styles.d.ts +1 -1
  66. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.styles.js +2 -16
  67. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.d.ts +3 -7
  68. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.js +6 -4
  69. package/lib/components/common/Banner/components/SystemIndexing/systemIndexing.d.ts +3 -8
  70. package/lib/components/common/Banner/components/SystemIndexing/systemIndexing.js +6 -8
  71. package/lib/components/common/Banner/components/SystemStatus/systemStatus.d.ts +3 -8
  72. package/lib/components/common/Banner/components/SystemStatus/systemStatus.js +6 -8
  73. package/lib/components/common/Banner/constants.d.ts +2 -0
  74. package/lib/components/common/Banner/constants.js +9 -0
  75. package/lib/components/common/Breadcrumbs/breadcrumbs.d.ts +2 -2
  76. package/lib/components/common/Breadcrumbs/breadcrumbs.js +3 -4
  77. package/lib/components/common/Paper/paper.styles.js +18 -12
  78. package/lib/components/common/Tabs/tabs.styles.d.ts +1 -1
  79. package/lib/components/types.d.ts +10 -0
  80. package/lib/components/types.js +1 -0
  81. package/lib/config/entities.d.ts +1 -0
  82. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.d.ts +1 -1
  83. package/lib/hooks/useFileManifest/common/buildFileManifestRequestURL.js +3 -2
  84. package/lib/hooks/useFileManifest/common/entities.d.ts +5 -5
  85. package/lib/hooks/useFileManifest/common/entities.js +7 -6
  86. package/lib/hooks/useFileManifest/useRequestFileManifest.d.ts +3 -1
  87. package/lib/hooks/useFileManifest/useRequestFileManifest.js +4 -1
  88. package/lib/hooks/useLocalStorage/useLocalStorage.d.ts +1 -1
  89. package/lib/hooks/useLocalStorage/useLocalStorage.js +1 -1
  90. package/lib/providers/fileManifestState/actions.d.ts +9 -0
  91. package/lib/providers/fileManifestState/actions.js +19 -0
  92. package/lib/providers/fileManifestState/constants.d.ts +4 -0
  93. package/lib/providers/fileManifestState/constants.js +25 -0
  94. package/lib/providers/fileManifestState/utils.d.ts +34 -0
  95. package/lib/providers/fileManifestState/utils.js +80 -0
  96. package/lib/providers/fileManifestState.d.ts +5 -19
  97. package/lib/providers/fileManifestState.js +17 -37
  98. package/lib/styles/common/constants/size.d.ts +5 -0
  99. package/lib/styles/common/constants/size.js +6 -0
  100. package/lib/styles/common/mui/alert.d.ts +4 -0
  101. package/lib/styles/common/mui/alert.js +20 -0
  102. package/lib/styles/common/mui/chip.d.ts +11 -0
  103. package/lib/styles/common/mui/chip.js +25 -0
  104. package/lib/styles/common/mui/icon.d.ts +2 -0
  105. package/lib/styles/common/mui/icon.js +6 -0
  106. package/lib/theme/common/components.d.ts +0 -12
  107. package/lib/theme/common/components.js +33 -157
  108. package/lib/theme/components/index.d.ts +2 -0
  109. package/lib/theme/components/index.js +2 -0
  110. package/lib/theme/components/muiAlert.d.ts +2 -0
  111. package/lib/theme/components/muiAlert.js +121 -0
  112. package/lib/theme/components/muiAlertTitle.d.ts +2 -0
  113. package/lib/theme/components/muiAlertTitle.js +12 -0
  114. package/lib/theme/theme.js +3 -2
  115. package/lib/views/ExportView/exportView.js +1 -1
  116. package/package.json +4 -4
  117. package/release-please-config.json +23 -0
  118. package/src/common/analytics/entities.ts +17 -6
  119. package/src/common/analytics/readme-analytics.md +9 -7
  120. package/src/components/Export/common/tracking.ts +46 -16
  121. package/src/components/Export/components/DownloadCurlCommand/downloadCurlCommand.tsx +4 -30
  122. package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx +16 -18
  123. package/src/components/Export/components/ExportToTerra/exportToTerra.tsx +18 -2
  124. package/src/components/Export/components/ManifestDownload/components/ManifestDownloadEntity/manifestDownloadEntity.tsx +7 -1
  125. package/src/components/Export/components/ManifestDownload/manifestDownload.tsx +11 -1
  126. package/src/components/Index/components/AzulFileDownload/azulFileDownload.tsx +8 -0
  127. package/src/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/constants.ts +5 -0
  128. package/src/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/title.tsx +53 -0
  129. package/src/components/Layout/components/Footer/components/VersionInfo/components/Tooltip/components/Title/utils.ts +31 -0
  130. package/src/components/Layout/components/Footer/components/VersionInfo/constants.ts +30 -0
  131. package/src/components/Layout/components/Footer/components/VersionInfo/types.ts +14 -0
  132. package/src/components/Layout/components/Footer/components/VersionInfo/utils.ts +32 -0
  133. package/src/components/Layout/components/Footer/components/VersionInfo/versionInfo.styles.ts +10 -0
  134. package/src/components/Layout/components/Footer/components/VersionInfo/versionInfo.tsx +31 -0
  135. package/src/components/Layout/components/Footer/footer.tsx +5 -2
  136. package/src/components/Layout/components/Header/components/Content/components/Logo/logo.styles.ts +0 -1
  137. package/src/components/Layout/components/Header/components/Content/components/Logo/logo.tsx +3 -2
  138. package/src/components/Links/components/Link/link.tsx +17 -16
  139. package/src/components/Support/components/SupportRequest/components/Dialog/dialog.styles.ts +5 -0
  140. package/src/components/Support/components/ViewSupport/viewSupport.styles.ts +5 -0
  141. package/src/components/Table/common/utils.ts +0 -1
  142. package/src/components/common/Alert/alert.styles.ts +22 -25
  143. package/src/components/common/Alert/alert.tsx +14 -35
  144. package/src/components/common/Alert/constants.ts +29 -0
  145. package/src/components/common/Alert/hooks/useTransition/types.ts +5 -0
  146. package/src/components/common/Alert/hooks/useTransition/useTransition.ts +25 -0
  147. package/src/components/common/Banner/banner.styles.ts +29 -0
  148. package/src/components/common/Banner/banner.tsx +11 -18
  149. package/src/components/common/Banner/components/CookieBanner/constants.ts +9 -0
  150. package/src/components/common/Banner/components/CookieBanner/cookieBanner.styles.ts +2 -16
  151. package/src/components/common/Banner/components/CookieBanner/cookieBanner.tsx +36 -64
  152. package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.tsx +12 -17
  153. package/src/components/common/Banner/components/SystemIndexing/systemIndexing.tsx +11 -22
  154. package/src/components/common/Banner/components/SystemStatus/systemStatus.tsx +11 -22
  155. package/src/components/common/Banner/constants.ts +11 -0
  156. package/src/components/common/Breadcrumbs/breadcrumbs.tsx +6 -10
  157. package/src/components/common/Paper/paper.styles.ts +18 -12
  158. package/src/components/types.ts +13 -0
  159. package/src/config/entities.ts +1 -0
  160. package/src/hooks/useFileManifest/common/buildFileManifestRequestURL.ts +3 -4
  161. package/src/hooks/useFileManifest/common/entities.ts +5 -6
  162. package/src/hooks/useFileManifest/useRequestFileManifest.ts +5 -0
  163. package/src/hooks/useLocalStorage/useLocalStorage.ts +2 -2
  164. package/src/providers/fileManifestState/actions.ts +34 -0
  165. package/src/providers/fileManifestState/constants.ts +31 -0
  166. package/src/providers/fileManifestState/utils.ts +108 -0
  167. package/src/providers/fileManifestState.tsx +30 -58
  168. package/src/styles/common/constants/size.ts +5 -0
  169. package/src/styles/common/mui/alert.ts +24 -0
  170. package/src/styles/common/mui/chip.ts +36 -0
  171. package/src/styles/common/mui/icon.ts +8 -0
  172. package/src/theme/common/components.ts +32 -159
  173. package/src/theme/components/index.ts +2 -0
  174. package/src/theme/components/muiAlert.ts +123 -0
  175. package/src/theme/components/muiAlertTitle.ts +14 -0
  176. package/src/theme/theme.ts +3 -2
  177. package/src/views/ExportView/exportView.tsx +1 -1
  178. package/tests/azulFileDownload.test.tsx +11 -6
  179. package/tests/fileManifestRequestFilters.test.ts +160 -0
  180. package/tests/updateFilesFacetsStatus.test.ts +84 -0
  181. package/types/data-explorer-ui.d.ts +6 -5
  182. package/lib/components/Index/components/TitleCell/titleCell.d.ts +0 -6
  183. package/lib/components/Index/components/TitleCell/titleCell.js +0 -10
  184. package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +0 -3
  185. package/lib/components/Index/components/TitleCell/titleCell.styles.js +0 -6
  186. package/lib/components/common/Alert/alert.stories.d.ts +0 -6
  187. package/lib/components/common/Alert/alert.stories.js +0 -36
  188. package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +0 -4
  189. package/lib/components/common/Alert/components/AlertText/alertText.styles.js +0 -19
  190. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +0 -7
  191. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +0 -5
  192. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +0 -3
  193. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +0 -19
  194. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +0 -10
  195. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +0 -16
  196. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +0 -3
  197. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +0 -21
  198. package/src/components/Index/components/TitleCell/titleCell.styles.ts +0 -7
  199. package/src/components/Index/components/TitleCell/titleCell.tsx +0 -22
  200. package/src/components/common/Alert/alert.stories.tsx +0 -41
  201. package/src/components/common/Alert/components/AlertText/alertText.styles.ts +0 -20
  202. package/src/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.ts +0 -20
  203. package/src/components/common/Banner/components/BannerPrimary/bannerPrimary.tsx +0 -27
  204. package/src/components/common/Banner/components/DismissibleBanner/dismissibleBanner.tsx +0 -44
  205. package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.ts +0 -22
@@ -1,33 +1,22 @@
1
- import { AlertProps as MAlertProps } from "@mui/material";
2
- import React, { Fragment, ReactNode } from "react";
1
+ import { AlertProps, Fade } from "@mui/material";
2
+ import React from "react";
3
3
  import { useSystemStatus } from "../../../../../hooks/useSystemStatus";
4
- import { BannerPrimary } from "../BannerPrimary/bannerPrimary";
5
-
6
- export interface SystemIndexingProps extends Omit<MAlertProps, "title"> {
7
- children?: ReactNode;
8
- className?: string;
9
- title?: ReactNode;
10
- }
4
+ import { BaseComponentProps, ContentProps } from "../../../../types";
5
+ import { Banner } from "../../banner";
11
6
 
12
7
  export const SystemIndexing = ({
13
8
  children,
14
9
  className,
15
- title = "Data indexing in progress. Downloads and exports are disabled as search results may be incomplete.",
10
+ content,
16
11
  ...props
17
- }: SystemIndexingProps): JSX.Element => {
12
+ }: AlertProps & BaseComponentProps & ContentProps): JSX.Element => {
18
13
  const systemStatus = useSystemStatus();
19
14
  const { indexing, loading, ok } = systemStatus;
20
- const showAlert = !loading && ok && indexing;
21
15
  return (
22
- <Fragment>
23
- {showAlert && (
24
- <BannerPrimary className={className} {...props}>
25
- <Fragment>
26
- {title}
27
- {children}
28
- </Fragment>
29
- </BannerPrimary>
30
- )}
31
- </Fragment>
16
+ <Fade in={!loading && ok && indexing} unmountOnExit>
17
+ <Banner className={className} {...props}>
18
+ {content || children}
19
+ </Banner>
20
+ </Fade>
32
21
  );
33
22
  };
@@ -1,33 +1,22 @@
1
- import { AlertProps as MAlertProps } from "@mui/material";
2
- import React, { Fragment, ReactNode } from "react";
1
+ import { AlertProps, Fade } from "@mui/material";
2
+ import React from "react";
3
3
  import { useSystemStatus } from "../../../../../hooks/useSystemStatus";
4
- import { BannerPrimary } from "../BannerPrimary/bannerPrimary";
5
-
6
- export interface SystemStatusProps extends Omit<MAlertProps, "title"> {
7
- children?: ReactNode;
8
- className?: string;
9
- title?: ReactNode;
10
- }
4
+ import { BaseComponentProps, ContentProps } from "../../../../types";
5
+ import { Banner } from "../../banner";
11
6
 
12
7
  export const SystemStatus = ({
13
8
  children,
14
9
  className,
15
- title = "One or more of the system components are currently unavailable. Functionality may be degraded.",
10
+ content,
16
11
  ...props
17
- }: SystemStatusProps): JSX.Element => {
12
+ }: AlertProps & BaseComponentProps & ContentProps): JSX.Element => {
18
13
  const systemStatus = useSystemStatus();
19
14
  const { loading, ok } = systemStatus;
20
- const showAlert = !loading && !ok;
21
15
  return (
22
- <Fragment>
23
- {showAlert && (
24
- <BannerPrimary className={className} {...props}>
25
- <Fragment>
26
- {title}
27
- {children}
28
- </Fragment>
29
- </BannerPrimary>
30
- )}
31
- </Fragment>
16
+ <Fade in={!loading && !ok} unmountOnExit>
17
+ <Banner className={className} {...props}>
18
+ {content || children}
19
+ </Banner>
20
+ </Fade>
32
21
  );
33
22
  };
@@ -0,0 +1,11 @@
1
+ import { AlertProps } from "@mui/material";
2
+ import { COLOR, VARIANT } from "../../../styles/common/mui/alert";
3
+ import { FlatPaper } from "../Paper/paper.styles";
4
+
5
+ export const ALERT_PROPS: Partial<AlertProps> = {
6
+ color: COLOR.PRIMARY,
7
+ component: FlatPaper,
8
+ elevation: 0,
9
+ icon: false,
10
+ variant: VARIANT.FILLED,
11
+ };
@@ -1,20 +1,16 @@
1
1
  import ChevronRightRoundedIcon from "@mui/icons-material/ChevronRightRounded";
2
- import {
3
- Link as BreadcrumbLink,
4
- Breadcrumbs as MBreadcrumbs,
5
- Typography,
6
- } from "@mui/material";
7
- import Link from "next/link";
2
+ import { Link, Breadcrumbs as MBreadcrumbs, Typography } from "@mui/material";
3
+ import NLink from "next/link";
8
4
  import React, { ReactNode } from "react";
5
+ import { BaseComponentProps } from "../../types";
9
6
 
10
7
  export interface Breadcrumb {
11
8
  path: string;
12
9
  text: ReactNode;
13
10
  }
14
11
 
15
- export interface BreadcrumbsProps {
12
+ export interface BreadcrumbsProps extends BaseComponentProps {
16
13
  breadcrumbs: Breadcrumb[];
17
- className?: string;
18
14
  Separator?: ReactNode;
19
15
  }
20
16
 
@@ -29,8 +25,8 @@ export const Breadcrumbs = ({
29
25
  <MBreadcrumbs className={className} separator={Separator}>
30
26
  {breadcrumbs.map(({ path, text }, b) =>
31
27
  path ? (
32
- <Link key={`${path}${b}`} href={path} legacyBehavior passHref>
33
- <BreadcrumbLink>{text}</BreadcrumbLink>
28
+ <Link component={NLink} key={b} href={path}>
29
+ {text}
34
30
  </Link>
35
31
  ) : (
36
32
  <Typography key={`${path}${b}`} maxWidth={180} noWrap>
@@ -7,11 +7,13 @@ import { Paper } from "./paper";
7
7
  * e.g. the entire width of mobile viewports.
8
8
  */
9
9
  export const FlatPaper = styled(Paper)`
10
- align-self: stretch;
11
- border-left: none;
12
- border-radius: 0;
13
- border-right: none;
14
- box-shadow: none;
10
+ & {
11
+ align-self: stretch;
12
+ border-left: none;
13
+ border-radius: 0;
14
+ border-right: none;
15
+ box-shadow: none;
16
+ }
15
17
  `;
16
18
 
17
19
  /**
@@ -19,8 +21,10 @@ export const FlatPaper = styled(Paper)`
19
21
  * To use RoundedPaper, wrap the styled paper around a single child element e.g. "Section" or "Sections" component. TODO
20
22
  */
21
23
  export const RoundedPaper = styled(Paper)`
22
- align-self: stretch;
23
- border-radius: 8px;
24
+ & {
25
+ align-self: stretch;
26
+ border-radius: 8px;
27
+ }
24
28
  `;
25
29
 
26
30
  /* eslint-disable valid-jsdoc -- disable require param */
@@ -30,11 +34,13 @@ export const RoundedPaper = styled(Paper)`
30
34
  */
31
35
  /* eslint-enable valid-jsdoc -- disable require param */
32
36
  export const FluidPaper = styled(RoundedPaper)`
33
- ${({ theme }) => theme.breakpoints.down(TABLET)} {
34
- border-left: none;
35
- border-radius: 0;
36
- border-right: none;
37
- box-shadow: none;
37
+ & {
38
+ ${({ theme }) => theme.breakpoints.down(TABLET)} {
39
+ border-left: none;
40
+ border-radius: 0;
41
+ border-right: none;
42
+ box-shadow: none;
43
+ }
38
44
  }
39
45
  `;
40
46
 
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from "react";
2
+
3
+ export interface BaseComponentProps {
4
+ className?: string;
5
+ }
6
+
7
+ export interface ContentProps {
8
+ content?: ReactNode;
9
+ }
10
+
11
+ export interface TestIdProps {
12
+ testId?: string;
13
+ }
@@ -360,6 +360,7 @@ export interface SiteConfig {
360
360
  explorerTitle: HeroTitle;
361
361
  export?: ExportConfig;
362
362
  exportToTerraUrl?: string; // TODO(cc) revist location; possibly nest inside "export"?
363
+ gitHubUrl?: string;
363
364
  layout: {
364
365
  floating?: FloatingConfig;
365
366
  footer: FooterProps;
@@ -20,13 +20,12 @@ export interface FileManifestRequestURL {
20
20
  */
21
21
  export const buildFileManifestRequestURL = (
22
22
  url: string,
23
- filters: Filters,
23
+ filters: Filters | undefined,
24
24
  catalog: string,
25
25
  manifestFormat: ManifestDownloadFormat | undefined
26
26
  ): FileManifestRequestURL | undefined => {
27
- if (!manifestFormat) {
28
- return;
29
- }
27
+ if (!manifestFormat) return;
28
+ if (!filters) return;
30
29
 
31
30
  // Build request params.
32
31
  const requestParams = new URLSearchParams({
@@ -37,21 +37,20 @@ export interface FileFacet {
37
37
  export enum FILE_MANIFEST_TYPE {
38
38
  BULK_DOWNLOAD = "BULK_DOWNLOAD",
39
39
  DOWNLOAD_MANIFEST = "DOWNLOAD_MANIFEST",
40
- ENITY_EXPORT_TO_TERRA = "ENITY_EXPORT_TO_TERRA",
41
40
  ENTITY_BULK_DOWNLOAD = "ENTITY_BULK_DOWNLOAD",
42
41
  ENTITY_DOWNLOAD_MANIFEST = "ENTITY_DOWNLOAD_MANIFEST",
42
+ ENTITY_EXPORT_TO_TERRA = "ENTITY_EXPORT_TO_TERRA",
43
43
  EXPORT_TO_TERRA = "EXPORT_TO_TERRA",
44
44
  }
45
45
 
46
46
  export type FileManifestType = FILE_MANIFEST_TYPE;
47
47
 
48
- export enum FILE_MANIFEST_STATE_STATUS {
49
- ACTIVE = "ACTIVE",
50
- INACTIVE = "INACTIVE",
48
+ export enum FILES_FACETS_STATUS {
49
+ COMPLETED = "COMPLETED",
50
+ IN_PROGRESS = "IN_PROGRESS",
51
+ NOT_STARTED = "NOT_STARTED",
51
52
  }
52
53
 
53
- export type FileManifestStateStatus = FILE_MANIFEST_STATE_STATUS;
54
-
55
54
  export type SelectedSearchTermsBySearchKey = Map<
56
55
  CategoryKey,
57
56
  Set<CategoryValueKey>
@@ -3,14 +3,17 @@ import { ManifestDownloadFormat } from "../../apis/azul/common/entities";
3
3
  import { Filters } from "../../common/entities";
4
4
  import { FileManifestActionKind } from "../../providers/fileManifestState";
5
5
  import { useFileManifestState } from "../useFileManifestState";
6
+ import { FileManifestType } from "./common/entities";
6
7
 
7
8
  /**
8
9
  * Initializes and fetches file manifest comprising file facets and summary for the given file manifest format.
10
+ * @param fileManifestType - File manifest type.
9
11
  * @param fileManifestFormat - File manifest format.
10
12
  * @param initialFilters - Filters to initialize file manifest request.
11
13
  * @param fileSummaryFacetName - File summary facet name.
12
14
  */
13
15
  export const useRequestFileManifest = (
16
+ fileManifestType: FileManifestType | undefined,
14
17
  fileManifestFormat: ManifestDownloadFormat | undefined,
15
18
  initialFilters: Filters | undefined = [],
16
19
  fileSummaryFacetName?: string
@@ -26,6 +29,7 @@ export const useRequestFileManifest = (
26
29
  fileManifestDispatch({
27
30
  payload: {
28
31
  fileManifestFormat,
32
+ fileManifestType,
29
33
  fileSummaryFacetName,
30
34
  filters: initFilters,
31
35
  },
@@ -40,6 +44,7 @@ export const useRequestFileManifest = (
40
44
  }, [
41
45
  fileManifestDispatch,
42
46
  fileManifestFormat,
47
+ fileManifestType,
43
48
  fileSummaryFacetName,
44
49
  initFilters,
45
50
  ]);
@@ -6,8 +6,8 @@ import { getLocalStorage } from "./common/utils";
6
6
  * @param key - Local storage key.
7
7
  * @returns local storage value.
8
8
  */
9
- export function useLocalStorage(key: string): string | null {
10
- const [value, setValue] = useState<string | null>(null);
9
+ export function useLocalStorage(key: string): string | null | undefined {
10
+ const [value, setValue] = useState<string | null>();
11
11
 
12
12
  useEffect(() => {
13
13
  setValue(getLocalStorage(key));
@@ -0,0 +1,34 @@
1
+ import { buildFileManifestRequestURL } from "../../hooks/useFileManifest/common/buildFileManifestRequestURL";
2
+ import {
3
+ FileManifestContext,
4
+ FileManifestState,
5
+ UpdateFileManifestPayload,
6
+ } from "../fileManifestState";
7
+ import { getRequestFilters, updateFilesFacetsStatus } from "./utils";
8
+
9
+ /**
10
+ * Update file manifest action.
11
+ * @param state - State.
12
+ * @param payload - Payload.
13
+ * @param context - Context.
14
+ * @returns state.
15
+ */
16
+ export function updateFileManifestAction(
17
+ state: FileManifestState,
18
+ payload: UpdateFileManifestPayload,
19
+ context: FileManifestContext
20
+ ): FileManifestState {
21
+ const { catalog, URL } = context;
22
+ const filesFacetsStatus = updateFilesFacetsStatus(state, payload);
23
+ const nextState = { ...state, ...payload, filesFacetsStatus };
24
+ const fileManifestRequest = buildFileManifestRequestURL(
25
+ URL,
26
+ getRequestFilters(nextState),
27
+ catalog,
28
+ nextState.fileManifestFormat
29
+ );
30
+ return {
31
+ ...nextState,
32
+ ...fileManifestRequest,
33
+ };
34
+ }
@@ -0,0 +1,31 @@
1
+ import {
2
+ FILE_MANIFEST_TYPE,
3
+ FILES_FACETS_STATUS,
4
+ } from "../../hooks/useFileManifest/common/entities";
5
+ import { FileManifestState } from "../fileManifestState";
6
+
7
+ export const ENTITIES_FILE_MANIFEST_TYPES: FILE_MANIFEST_TYPE[] = [
8
+ FILE_MANIFEST_TYPE.BULK_DOWNLOAD,
9
+ FILE_MANIFEST_TYPE.DOWNLOAD_MANIFEST,
10
+ FILE_MANIFEST_TYPE.EXPORT_TO_TERRA,
11
+ ];
12
+
13
+ export const FILE_MANIFEST_STATE: FileManifestState = {
14
+ fileManifestFormat: undefined,
15
+ fileManifestType: undefined,
16
+ fileSummary: undefined,
17
+ fileSummaryFacetName: undefined,
18
+ fileSummaryFilters: [],
19
+ filesFacets: [],
20
+ filesFacetsStatus: FILES_FACETS_STATUS.NOT_STARTED,
21
+ filters: [],
22
+ isEnabled: false,
23
+ isFacetsLoading: false,
24
+ isFacetsSuccess: false,
25
+ isFileSummaryLoading: false,
26
+ isLoading: false,
27
+ isSummaryLoading: false,
28
+ requestParams: undefined,
29
+ requestURL: undefined,
30
+ summary: undefined,
31
+ };
@@ -0,0 +1,108 @@
1
+ import { Filters } from "../../common/entities";
2
+ import {
3
+ FileFacet,
4
+ FILES_FACETS_STATUS,
5
+ } from "../../hooks/useFileManifest/common/entities";
6
+ import { findFacet } from "../../hooks/useFileManifest/common/utils";
7
+ import {
8
+ FileManifestState,
9
+ UpdateFileManifestPayload,
10
+ } from "../fileManifestState";
11
+ import { ENTITIES_FILE_MANIFEST_TYPES } from "./constants";
12
+
13
+ /**
14
+ * Generates the filters for a request URL based on the file manifest state.
15
+ * If all terms in a facet are selected, the corresponding facet is excluded.
16
+ * @param state - File manifest state.
17
+ * @returns filters for the request URL.
18
+ */
19
+ export function getRequestFilters(
20
+ state: FileManifestState
21
+ ): Filters | undefined {
22
+ if (state.filesFacetsStatus !== FILES_FACETS_STATUS.COMPLETED) return;
23
+ // Determine if the filters are user-selected.
24
+ if (isFiltersUserSelected(state)) {
25
+ return state.filters;
26
+ }
27
+ for (const filter of state.filters) {
28
+ const facet = findFacet(state.filesFacets, filter.categoryKey);
29
+ if (!facet) return [filter]; // The entity identifier related filter will not have a corresponding term facet.
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Returns true if filter values for each selected facet are partially selected.
35
+ * @param filters - Selected filters.
36
+ * @param filesFacets - Files facets.
37
+ * @returns true if the filters are partially selected.
38
+ */
39
+ function isFiltersPartiallySelected(
40
+ filters: Filters,
41
+ filesFacets: FileFacet[]
42
+ ): boolean {
43
+ for (const { categoryKey, value } of filters) {
44
+ const facet = findFacet(filesFacets, categoryKey);
45
+ if (!facet) continue; // Continue; the entity identifier related filter will not have a corresponding term facet.
46
+ if (value.length < facet.termCount) return true;
47
+ }
48
+ return false;
49
+ }
50
+
51
+ /**
52
+ * Returns true if the filters are user-selected, when:
53
+ * - The file manifest type is not set.
54
+ * - The file manifest type is an entity list related type.
55
+ * - Filter values for each selected facet are partially selected.
56
+ * @param state - File manifest state.
57
+ * @returns true if the filters are user-selected.
58
+ */
59
+ export function isFiltersUserSelected(state: FileManifestState): boolean {
60
+ if (!state.fileManifestType) return true;
61
+ if (ENTITIES_FILE_MANIFEST_TYPES.includes(state.fileManifestType))
62
+ return true;
63
+ return isFiltersPartiallySelected(state.filters, state.filesFacets);
64
+ }
65
+
66
+ /**
67
+ * Transitions the files facets' status.
68
+ * @param shouldTransition - True if transitioning, false otherwise.
69
+ * @param nextStatus - Next files facets' status.
70
+ * @param currentStatus - Current files facets' status.
71
+ * @returns files facets' status.
72
+ */
73
+ export function transitionFilesFacetsStatus(
74
+ shouldTransition: boolean,
75
+ nextStatus: FILES_FACETS_STATUS,
76
+ currentStatus: FILES_FACETS_STATUS
77
+ ): FILES_FACETS_STATUS {
78
+ return shouldTransition ? nextStatus : currentStatus;
79
+ }
80
+
81
+ /**
82
+ * Returns the updated files facets' status.
83
+ * @param state - File manifest state.
84
+ * @param payload - Update file manifest payload.
85
+ * @returns files facets' status.
86
+ */
87
+ export function updateFilesFacetsStatus(
88
+ state: FileManifestState,
89
+ payload: UpdateFileManifestPayload
90
+ ): FILES_FACETS_STATUS {
91
+ if (state.filesFacetsStatus === FILES_FACETS_STATUS.NOT_STARTED) {
92
+ // If the current status is NOT_STARTED, transition to IN_PROGRESS if facets are loading.
93
+ return transitionFilesFacetsStatus(
94
+ payload.isFacetsLoading,
95
+ FILES_FACETS_STATUS.IN_PROGRESS,
96
+ FILES_FACETS_STATUS.NOT_STARTED
97
+ );
98
+ }
99
+ if (state.filesFacetsStatus === FILES_FACETS_STATUS.IN_PROGRESS) {
100
+ // If the current status is IN_PROGRESS, transition to COMPLETED if facets are successfully loaded.
101
+ return transitionFilesFacetsStatus(
102
+ payload.isFacetsSuccess,
103
+ FILES_FACETS_STATUS.COMPLETED,
104
+ FILES_FACETS_STATUS.IN_PROGRESS
105
+ );
106
+ }
107
+ return FILES_FACETS_STATUS.COMPLETED;
108
+ }
@@ -19,36 +19,26 @@ import {
19
19
  import { useCatalog } from "../hooks/useCatalog";
20
20
  import { buildNextFilterState } from "../hooks/useCategoryFilter";
21
21
  import { buildFileManifestRequestURL } from "../hooks/useFileManifest/common/buildFileManifestRequestURL";
22
- import { FileFacet } from "../hooks/useFileManifest/common/entities";
22
+ import {
23
+ FileFacet,
24
+ FileManifestType,
25
+ FILES_FACETS_STATUS,
26
+ } from "../hooks/useFileManifest/common/entities";
23
27
  import { useFetchFilesFacets } from "../hooks/useFileManifest/useFetchFilesFacets";
24
28
  import { useFetchSummary } from "../hooks/useFileManifest/useFetchSummary";
25
29
  import { useFileManifestURL } from "../hooks/useFileManifest/useFileManifestURL";
26
-
27
- // Default file manifest state.
28
- export const DEFAULT_FILE_MANIFEST_STATE = {
29
- fileManifestFormat: undefined,
30
- fileSummary: undefined,
31
- fileSummaryFacetName: undefined,
32
- fileSummaryFilters: [],
33
- filesFacets: [],
34
- filters: [],
35
- isEnabled: false,
36
- isFacetsLoading: false,
37
- isFacetsSuccess: false,
38
- isFileSummaryLoading: false,
39
- isLoading: false,
40
- isSummaryLoading: false,
41
- requestParams: undefined,
42
- requestURL: undefined,
43
- summary: undefined,
44
- };
30
+ import { updateFileManifestAction } from "./fileManifestState/actions";
31
+ import { FILE_MANIFEST_STATE } from "./fileManifestState/constants";
32
+ import { getRequestFilters } from "./fileManifestState/utils";
45
33
 
46
34
  /**
47
35
  * File manifest state.
48
36
  */
49
37
  export type FileManifestState = {
50
38
  fileManifestFormat?: ManifestDownloadFormat;
39
+ fileManifestType?: FileManifestType;
51
40
  filesFacets: FileFacet[];
41
+ filesFacetsStatus: FILES_FACETS_STATUS;
52
42
  fileSummary?: AzulSummaryResponse;
53
43
  fileSummaryFacetName?: string;
54
44
  fileSummaryFilters: Filters;
@@ -76,7 +66,7 @@ export const FileManifestStateContext =
76
66
  createContext<FileManifestStateContextProps>({
77
67
  // eslint-disable-next-line @typescript-eslint/no-empty-function -- allow dummy function for default state.
78
68
  fileManifestDispatch: () => {},
79
- fileManifestState: DEFAULT_FILE_MANIFEST_STATE,
69
+ fileManifestState: FILE_MANIFEST_STATE,
80
70
  });
81
71
 
82
72
  export interface FileManifestStateProps {
@@ -96,7 +86,7 @@ export function FileManifestStateProvider({
96
86
  const [fileManifestState, fileManifestDispatch] = useReducer(
97
87
  (s: FileManifestState, a: FileManifestAction) =>
98
88
  fileManifestReducer(s, a, { URL, catalog }),
99
- DEFAULT_FILE_MANIFEST_STATE
89
+ FILE_MANIFEST_STATE
100
90
  );
101
91
 
102
92
  const { fileSummaryFacetName, fileSummaryFilters, filters, isEnabled } =
@@ -233,6 +223,7 @@ type UpdateFiltersCategoryAction = {
233
223
  */
234
224
  type FetchFileManifestPayload = {
235
225
  fileManifestFormat?: ManifestDownloadFormat;
226
+ fileManifestType?: FileManifestType;
236
227
  fileSummaryFacetName?: string;
237
228
  filters: Filters;
238
229
  };
@@ -240,7 +231,7 @@ type FetchFileManifestPayload = {
240
231
  /**
241
232
  * Update file manifest payload.
242
233
  */
243
- type UpdateFileManifestPayload = {
234
+ export type UpdateFileManifestPayload = {
244
235
  filesFacets: FileFacet[];
245
236
  fileSummary?: AzulSummaryResponse;
246
237
  isFacetsLoading: boolean;
@@ -288,6 +279,7 @@ function fileManifestReducer(
288
279
  return {
289
280
  ...state,
290
281
  fileManifestFormat: undefined,
282
+ filesFacetsStatus: FILES_FACETS_STATUS.NOT_STARTED,
291
283
  isEnabled: false,
292
284
  requestParams: undefined,
293
285
  requestURL: undefined,
@@ -300,35 +292,29 @@ function fileManifestReducer(
300
292
  payload.filters,
301
293
  payload.fileSummaryFacetName
302
294
  );
303
- // Build request params and request URL.
304
- const { requestParams, requestURL } =
305
- buildFileManifestRequestURL(
306
- URL,
307
- payload.filters,
308
- catalog,
309
- payload.fileManifestFormat
310
- ) || {};
311
295
  return {
312
296
  ...state,
313
297
  ...payload,
314
298
  fileSummaryFilters,
315
299
  isEnabled: true,
316
- requestParams,
317
- requestURL,
300
+ requestParams: undefined,
301
+ requestURL: undefined,
318
302
  };
319
303
  }
320
304
  // Updates file manifest.
321
305
  case FileManifestActionKind.UpdateFileManifest: {
322
- return {
323
- ...state,
324
- ...payload,
325
- };
306
+ return updateFileManifestAction(state, payload, fileManifestContext);
326
307
  }
327
308
  // Updates file manifest format.
328
309
  case FileManifestActionKind.UpdateFileManifestFormat: {
329
310
  // Build request params and request URL.
330
311
  const { requestParams, requestURL } =
331
- buildFileManifestRequestURL(URL, state.filters, catalog, payload) || {};
312
+ buildFileManifestRequestURL(
313
+ URL,
314
+ getRequestFilters(state),
315
+ catalog,
316
+ payload
317
+ ) || {};
332
318
  return {
333
319
  ...state,
334
320
  fileManifestFormat: payload,
@@ -350,20 +336,13 @@ function fileManifestReducer(
350
336
  filters,
351
337
  state.fileSummaryFacetName
352
338
  );
353
- // Build request params and request URL.
354
- const { requestParams, requestURL } =
355
- buildFileManifestRequestURL(
356
- URL,
357
- filters,
358
- catalog,
359
- state.fileManifestFormat
360
- ) || {};
361
339
  return {
362
340
  ...state,
363
341
  fileSummaryFilters,
342
+ filesFacetsStatus: FILES_FACETS_STATUS.NOT_STARTED,
364
343
  filters,
365
- requestParams,
366
- requestURL,
344
+ requestParams: undefined,
345
+ requestURL: undefined,
367
346
  };
368
347
  }
369
348
  // Updates selected file manifest filters by category.
@@ -379,20 +358,13 @@ function fileManifestReducer(
379
358
  filters,
380
359
  state.fileSummaryFacetName
381
360
  );
382
- // Build request params and request URL.
383
- const { requestParams, requestURL } =
384
- buildFileManifestRequestURL(
385
- URL,
386
- filters,
387
- catalog,
388
- state.fileManifestFormat
389
- ) || {};
390
361
  return {
391
362
  ...state,
392
363
  fileSummaryFilters,
364
+ filesFacetsStatus: FILES_FACETS_STATUS.NOT_STARTED,
393
365
  filters,
394
- requestParams,
395
- requestURL,
366
+ requestParams: undefined,
367
+ requestURL: undefined,
396
368
  };
397
369
  }
398
370
  default:
@@ -0,0 +1,5 @@
1
+ export enum SIZE {
2
+ LARGE = "large",
3
+ MEDIUM = "medium",
4
+ SMALL = "small",
5
+ }