@databiosphere/findable-ui 12.0.0 → 14.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 (185) hide show
  1. package/.github/workflows/release-please.yml +48 -0
  2. package/.github/workflows/run-checks.yml +41 -15
  3. package/.prettierignore +1 -0
  4. package/CHANGELOG.md +49 -0
  5. package/jest.config.js +1 -1
  6. package/lib/common/analytics/entities.d.ts +10 -9
  7. package/lib/common/analytics/entities.js +2 -4
  8. package/lib/components/Export/common/tracking.d.ts +12 -3
  9. package/lib/components/Export/common/tracking.js +23 -13
  10. package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.d.ts +1 -1
  11. package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.js +2 -16
  12. package/lib/components/Export/components/ExportMethod/exportMethod.d.ts +2 -1
  13. package/lib/components/Export/components/ExportMethod/exportMethod.js +2 -3
  14. package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.js +6 -3
  15. package/lib/components/Export/components/ExportToTerra/exportToTerra.js +9 -1
  16. package/lib/components/Export/components/ManifestDownload/manifestDownload.js +7 -1
  17. package/lib/components/Index/components/Hero/components/ExportButton/exportButton.js +1 -1
  18. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.d.ts +2 -2
  19. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.js +1 -1
  20. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.styles.js +0 -1
  21. package/lib/components/Links/components/Link/link.d.ts +2 -3
  22. package/lib/components/Links/components/Link/link.js +1 -2
  23. package/lib/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.js +1 -3
  24. package/lib/components/TempError/tempError.d.ts +2 -2
  25. package/lib/components/TempError/tempError.js +4 -4
  26. package/lib/components/common/Alert/alert.d.ts +4 -12
  27. package/lib/components/common/Alert/alert.js +5 -7
  28. package/lib/components/common/Alert/alert.styles.d.ts +1 -11
  29. package/lib/components/common/Alert/alert.styles.js +18 -24
  30. package/lib/components/common/Alert/constants.d.ts +2 -0
  31. package/lib/components/common/Alert/constants.js +27 -0
  32. package/lib/components/common/Alert/hooks/useTransition/types.d.ts +5 -0
  33. package/lib/components/common/Alert/hooks/useTransition/types.js +1 -0
  34. package/lib/components/common/Alert/hooks/useTransition/useTransition.d.ts +7 -0
  35. package/lib/components/common/Alert/hooks/useTransition/useTransition.js +20 -0
  36. package/lib/components/common/Banner/banner.d.ts +4 -7
  37. package/lib/components/common/Banner/banner.js +4 -3
  38. package/lib/components/common/Banner/banner.styles.d.ts +3 -0
  39. package/lib/components/common/Banner/banner.styles.js +28 -0
  40. package/lib/components/common/Banner/components/CookieBanner/constants.d.ts +2 -0
  41. package/lib/components/common/Banner/components/CookieBanner/constants.js +7 -0
  42. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.d.ts +3 -3
  43. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.js +17 -31
  44. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.styles.d.ts +1 -1
  45. package/lib/components/common/Banner/components/CookieBanner/cookieBanner.styles.js +2 -16
  46. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.d.ts +3 -7
  47. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.js +6 -4
  48. package/lib/components/common/Banner/components/SystemIndexing/systemIndexing.d.ts +3 -8
  49. package/lib/components/common/Banner/components/SystemIndexing/systemIndexing.js +6 -8
  50. package/lib/components/common/Banner/components/SystemStatus/systemStatus.d.ts +3 -8
  51. package/lib/components/common/Banner/components/SystemStatus/systemStatus.js +6 -8
  52. package/lib/components/common/Banner/constants.d.ts +2 -0
  53. package/lib/components/common/Banner/constants.js +9 -0
  54. package/lib/components/common/Breadcrumbs/breadcrumbs.d.ts +2 -2
  55. package/lib/components/common/Breadcrumbs/breadcrumbs.js +3 -4
  56. package/lib/components/common/Paper/paper.styles.js +18 -12
  57. package/lib/components/types.d.ts +10 -0
  58. package/lib/components/types.js +1 -0
  59. package/lib/config/entities.d.ts +0 -1
  60. package/lib/entity/api/service.js +16 -18
  61. package/lib/entity/common/client.d.ts +6 -10
  62. package/lib/entity/common/client.js +21 -31
  63. package/lib/entity/common/service.js +6 -8
  64. package/lib/entity/common/utils.d.ts +4 -4
  65. package/lib/entity/common/utils.js +3 -3
  66. package/lib/hooks/useLocalStorage/useLocalStorage.d.ts +1 -1
  67. package/lib/hooks/useLocalStorage/useLocalStorage.js +1 -1
  68. package/lib/shared/utils.d.ts +0 -5
  69. package/lib/shared/utils.js +0 -8
  70. package/lib/styles/common/constants/size.d.ts +5 -0
  71. package/lib/styles/common/constants/size.js +6 -0
  72. package/lib/styles/common/mui/alert.d.ts +4 -0
  73. package/lib/styles/common/mui/alert.js +20 -0
  74. package/lib/styles/common/mui/icon.d.ts +2 -0
  75. package/lib/styles/common/mui/icon.js +6 -0
  76. package/lib/theme/common/components.d.ts +0 -12
  77. package/lib/theme/common/components.js +17 -157
  78. package/lib/theme/components/index.d.ts +2 -0
  79. package/lib/theme/components/index.js +2 -0
  80. package/lib/theme/components/muiAlert.d.ts +2 -0
  81. package/lib/theme/components/muiAlert.js +121 -0
  82. package/lib/theme/components/muiAlertTitle.d.ts +2 -0
  83. package/lib/theme/components/muiAlertTitle.js +12 -0
  84. package/lib/theme/theme.js +3 -2
  85. package/package.json +7 -6
  86. package/src/common/analytics/entities.ts +9 -8
  87. package/src/common/analytics/readme-analytics.md +19 -7
  88. package/src/components/Export/common/tracking.ts +26 -16
  89. package/src/components/Export/components/DownloadCurlCommand/downloadCurlCommand.tsx +2 -30
  90. package/src/components/Export/components/ExportMethod/exportMethod.tsx +14 -4
  91. package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx +16 -18
  92. package/src/components/Export/components/ExportToTerra/exportToTerra.tsx +11 -1
  93. package/src/components/Export/components/ManifestDownload/manifestDownload.tsx +9 -1
  94. package/src/components/Index/components/Hero/components/ExportButton/exportButton.tsx +5 -1
  95. package/src/components/Layout/components/Header/components/Content/components/Logo/logo.styles.ts +0 -1
  96. package/src/components/Layout/components/Header/components/Content/components/Logo/logo.tsx +3 -2
  97. package/src/components/Links/components/Link/link.tsx +17 -16
  98. package/src/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.tsx +1 -2
  99. package/src/components/TempError/tempError.tsx +10 -9
  100. package/src/components/common/Alert/alert.styles.ts +22 -25
  101. package/src/components/common/Alert/alert.tsx +14 -35
  102. package/src/components/common/Alert/constants.ts +29 -0
  103. package/src/components/common/Alert/hooks/useTransition/types.ts +5 -0
  104. package/src/components/common/Alert/hooks/useTransition/useTransition.ts +25 -0
  105. package/src/components/common/Banner/banner.styles.ts +29 -0
  106. package/src/components/common/Banner/banner.tsx +11 -18
  107. package/src/components/common/Banner/components/CookieBanner/constants.ts +9 -0
  108. package/src/components/common/Banner/components/CookieBanner/cookieBanner.styles.ts +2 -16
  109. package/src/components/common/Banner/components/CookieBanner/cookieBanner.tsx +36 -64
  110. package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.tsx +12 -17
  111. package/src/components/common/Banner/components/SystemIndexing/systemIndexing.tsx +11 -22
  112. package/src/components/common/Banner/components/SystemStatus/systemStatus.tsx +11 -22
  113. package/src/components/common/Banner/constants.ts +11 -0
  114. package/src/components/common/Breadcrumbs/breadcrumbs.tsx +6 -10
  115. package/src/components/common/Paper/paper.styles.ts +18 -12
  116. package/src/components/types.ts +13 -0
  117. package/src/config/entities.ts +0 -1
  118. package/src/entity/api/service.ts +24 -27
  119. package/src/entity/common/client.ts +22 -40
  120. package/src/entity/common/service.ts +8 -10
  121. package/src/entity/common/utils.ts +4 -6
  122. package/src/hooks/useLocalStorage/useLocalStorage.ts +2 -2
  123. package/src/shared/utils.ts +0 -9
  124. package/src/styles/common/constants/size.ts +5 -0
  125. package/src/styles/common/mui/alert.ts +24 -0
  126. package/src/styles/common/mui/icon.ts +8 -0
  127. package/src/theme/common/components.ts +16 -159
  128. package/src/theme/components/index.ts +2 -0
  129. package/src/theme/components/muiAlert.ts +123 -0
  130. package/src/theme/components/muiAlertTitle.ts +14 -0
  131. package/src/theme/theme.ts +3 -2
  132. package/tests/authentication.test.ts +7 -1
  133. package/tests/azulFileDownload.test.tsx +9 -3
  134. package/tests/fetchApi.test.ts +93 -0
  135. package/tests/tsconfig.json +1 -0
  136. package/tests/useFileLocation.test.ts +6 -2
  137. package/types/data-explorer-ui.d.ts +6 -5
  138. package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +0 -8
  139. package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +0 -36
  140. package/lib/components/Index/components/TitleCell/titleCell.d.ts +0 -6
  141. package/lib/components/Index/components/TitleCell/titleCell.js +0 -10
  142. package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +0 -3
  143. package/lib/components/Index/components/TitleCell/titleCell.styles.js +0 -6
  144. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +0 -6
  145. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +0 -13
  146. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +0 -36
  147. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +0 -9
  148. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +0 -5
  149. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +0 -10
  150. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +0 -36
  151. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +0 -9
  152. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +0 -2
  153. package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +0 -37
  154. package/lib/components/common/Alert/alert.stories.d.ts +0 -6
  155. package/lib/components/common/Alert/alert.stories.js +0 -36
  156. package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +0 -4
  157. package/lib/components/common/Alert/components/AlertText/alertText.styles.js +0 -19
  158. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +0 -7
  159. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +0 -5
  160. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +0 -3
  161. package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +0 -19
  162. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +0 -10
  163. package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +0 -16
  164. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +0 -3
  165. package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +0 -21
  166. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +0 -5
  167. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +0 -10
  168. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +0 -3
  169. package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +0 -9
  170. package/lib/hooks/useCategoryConfigs.d.ts +0 -6
  171. package/lib/hooks/useCategoryConfigs.js +0 -17
  172. package/lib/hooks/useEntityListRelatedView.d.ts +0 -15
  173. package/lib/hooks/useEntityListRelatedView.js +0 -62
  174. package/lib/hooks/useMenu.d.ts +0 -10
  175. package/lib/hooks/useMenu.js +0 -17
  176. package/lib/hooks/useMenuWithPosition.d.ts +0 -14
  177. package/lib/hooks/useMenuWithPosition.js +0 -33
  178. package/src/components/Index/components/TitleCell/titleCell.styles.ts +0 -7
  179. package/src/components/Index/components/TitleCell/titleCell.tsx +0 -22
  180. package/src/components/common/Alert/alert.stories.tsx +0 -41
  181. package/src/components/common/Alert/components/AlertText/alertText.styles.ts +0 -20
  182. package/src/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.ts +0 -20
  183. package/src/components/common/Banner/components/BannerPrimary/bannerPrimary.tsx +0 -27
  184. package/src/components/common/Banner/components/DismissibleBanner/dismissibleBanner.tsx +0 -44
  185. package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.ts +0 -22
@@ -1,39 +1,18 @@
1
- import {
2
- AlertTitle,
3
- Alert as MAlert,
4
- AlertProps as MAlertProps,
5
- } from "@mui/material";
6
- import React, { ReactNode } from "react";
1
+ import { AlertProps } from "@mui/material";
2
+ import React, { forwardRef } from "react";
3
+ import { BaseComponentProps } from "../../types";
4
+ import { StyledAlert } from "./alert.styles";
7
5
 
8
- export interface AlertProps {
9
- children?: ReactNode;
10
- className?: string;
11
- color?: MAlertProps["color"];
12
- icon?: MAlertProps["icon"];
13
- severity: MAlertProps["severity"];
14
- title?: ReactNode;
15
- variant?: MAlertProps["variant"];
16
- }
17
-
18
- export const Alert = ({
19
- children,
20
- className,
21
- color,
22
- icon,
23
- severity,
24
- title,
25
- variant = "standard",
26
- }: AlertProps): JSX.Element => {
6
+ export const Alert = forwardRef<
7
+ HTMLDivElement,
8
+ AlertProps & BaseComponentProps
9
+ >(function Alert(
10
+ { children, className, ...props }: AlertProps & BaseComponentProps,
11
+ ref
12
+ ): JSX.Element {
27
13
  return (
28
- <MAlert
29
- className={className}
30
- color={color}
31
- icon={icon}
32
- severity={severity}
33
- variant={variant}
34
- >
35
- {title && <AlertTitle>{title}</AlertTitle>}
14
+ <StyledAlert className={className} ref={ref} {...props}>
36
15
  {children}
37
- </MAlert>
16
+ </StyledAlert>
38
17
  );
39
- };
18
+ });
@@ -0,0 +1,29 @@
1
+ import { AlertProps } from "@mui/material";
2
+ import { COLOR, SEVERITY, VARIANT } from "../../../styles/common/mui/alert";
3
+
4
+ export const ALERT_PROPS: Record<string, Partial<AlertProps>> = {
5
+ FILLED_INK: {
6
+ color: COLOR.INK,
7
+ variant: VARIANT.FILLED,
8
+ },
9
+ FILLED_PRIMARY: {
10
+ color: COLOR.PRIMARY,
11
+ variant: VARIANT.FILLED,
12
+ },
13
+ FILLED_SMOKE: {
14
+ color: COLOR.SMOKE,
15
+ variant: VARIANT.FILLED,
16
+ },
17
+ STANDARD_ERROR: {
18
+ severity: SEVERITY.ERROR,
19
+ },
20
+ STANDARD_INFO: {
21
+ severity: SEVERITY.INFO,
22
+ },
23
+ STANDARD_SUCCESS: {
24
+ severity: SEVERITY.SUCCESS,
25
+ },
26
+ STANDARD_WARNING: {
27
+ severity: SEVERITY.WARNING,
28
+ },
29
+ };
@@ -0,0 +1,5 @@
1
+ export interface UseTransition {
2
+ isIn: boolean;
3
+ onEnter: () => void;
4
+ onExit: () => void;
5
+ }
@@ -0,0 +1,25 @@
1
+ import { useCallback, useState } from "react";
2
+ import { UseTransition } from "./types";
3
+
4
+ /**
5
+ * Hook to manage transition state for alert component wrapped in a transition component.
6
+ * @param initialState - Initial state of the transition.
7
+ * @returns transition state and handlers.
8
+ */
9
+ export const useTransition = (initialState?: boolean): UseTransition => {
10
+ const [isIn, setIsIn] = useState<boolean>(initialState || false);
11
+
12
+ const onEnter = useCallback((): void => {
13
+ setIsIn(true);
14
+ }, []);
15
+
16
+ const onExit = useCallback((): void => {
17
+ setIsIn(false);
18
+ }, []);
19
+
20
+ return {
21
+ isIn,
22
+ onEnter,
23
+ onExit,
24
+ };
25
+ };
@@ -0,0 +1,29 @@
1
+ import styled from "@emotion/styled";
2
+ import { Alert } from "@mui/material";
3
+ import { mediaDesktopUp } from "../../../styles/common/mixins/breakpoints";
4
+ import { textBodySmall400 } from "../../../styles/common/mixins/fonts";
5
+
6
+ export const StyledAlert = styled(Alert)`
7
+ justify-content: center;
8
+ padding: 8px 12px;
9
+ text-align: center;
10
+
11
+ .MuiAlert-message {
12
+ ${textBodySmall400};
13
+ align-self: center;
14
+ flex: 1;
15
+
16
+ .MuiLink-root {
17
+ color: inherit;
18
+ }
19
+ }
20
+
21
+ .MuiAlert-action {
22
+ margin: -8px;
23
+ padding: 0;
24
+ }
25
+
26
+ ${mediaDesktopUp} {
27
+ padding: 8px 16px;
28
+ }
29
+ `;
@@ -1,22 +1,15 @@
1
- import { Alert as MAlert, AlertProps as MAlertProps } from "@mui/material";
2
- import React, { forwardRef, ReactNode } from "react";
1
+ import { AlertProps } from "@mui/material";
2
+ import React, { forwardRef } from "react";
3
+ import { BaseComponentProps } from "../../types";
4
+ import { StyledAlert } from "./banner.styles";
5
+ import { ALERT_PROPS } from "./constants";
3
6
 
4
- export interface BannerProps extends MAlertProps {
5
- children: ReactNode;
6
- className?: string;
7
- }
8
-
9
- export const Banner = forwardRef<HTMLDivElement, BannerProps>(function Banner(
10
- {
11
- children,
12
- className,
13
- ...props /* Spread props to allow for Mui AlertProps specific prop overrides. */
14
- }: BannerProps,
7
+ export const Banner = forwardRef<
8
+ HTMLDivElement,
9
+ AlertProps & BaseComponentProps
10
+ >(function Alert(
11
+ { ...props }: AlertProps & BaseComponentProps,
15
12
  ref
16
13
  ): JSX.Element {
17
- return (
18
- <MAlert className={className} ref={ref} {...props}>
19
- {children}
20
- </MAlert>
21
- );
14
+ return <StyledAlert {...ALERT_PROPS} ref={ref} {...props} />;
22
15
  });
@@ -0,0 +1,9 @@
1
+ import { AlertProps } from "@mui/material";
2
+ import { COLOR, VARIANT } from "../../../../../styles/common/mui/alert";
3
+
4
+ export const ALERT_PROPS: Partial<AlertProps> = {
5
+ color: COLOR.INK,
6
+ elevation: 2,
7
+ icon: false,
8
+ variant: VARIANT.FILLED,
9
+ };
@@ -1,34 +1,20 @@
1
1
  import styled from "@emotion/styled";
2
+ import { Alert } from "@mui/material";
2
3
  import { mediaTabletUp } from "../../../../../styles/common/mixins/breakpoints";
3
- import { white } from "../../../../../styles/common/mixins/colors";
4
4
  import { textBody400 } from "../../../../../styles/common/mixins/fonts";
5
- import { shadows02 } from "../../../../../styles/common/mixins/shadows";
6
- import { Banner } from "../../banner";
7
5
 
8
- export const CookieBanner = styled(Banner)`
6
+ export const StyledAlert = styled(Alert)`
9
7
  bottom: 0;
10
- box-shadow: ${shadows02};
11
- color: ${white};
12
8
  flex-direction: column;
13
9
  gap: 16px;
14
10
  left: 0;
15
11
  margin: 8px;
16
- padding: 16px;
17
12
  position: fixed;
18
13
  width: calc(100vw - 16px);
19
14
  z-index: 1100; // Above support fab, below support form.
20
15
 
21
16
  .MuiAlert-message {
22
17
  ${textBody400};
23
-
24
- .MuiLink-root {
25
- color: inherit;
26
- text-decoration: underline;
27
-
28
- &:hover {
29
- text-decoration: none;
30
- }
31
- }
32
18
  }
33
19
 
34
20
  .MuiAlert-action {
@@ -1,14 +1,16 @@
1
- import { ButtonProps, AlertProps as MAlertProps } from "@mui/material";
2
- import React, { forwardRef, Fragment, ReactNode } from "react";
1
+ import { AlertProps, Button, Fade } from "@mui/material";
2
+ import React, { Fragment, ReactNode, useEffect } from "react";
3
3
  import { FLAG } from "../../../../../hooks/useFeatureFlag/common/entities";
4
4
  import { setLocalStorage } from "../../../../../hooks/useLocalStorage/common/utils";
5
5
  import { useLocalStorage } from "../../../../../hooks/useLocalStorage/useLocalStorage";
6
- import { ButtonPrimary } from "../../../Button/components/ButtonPrimary/buttonPrimary";
7
- import { DismissibleBanner } from "../DismissibleBanner/dismissibleBanner";
8
- import { CookieBanner as Banner } from "./cookieBanner.styles";
6
+ import { BaseComponentProps } from "../../../../types";
7
+ import { useTransition } from "../../../Alert/hooks/useTransition/useTransition";
8
+ import { ALERT_PROPS } from "./constants";
9
+ import { StyledAlert } from "./cookieBanner.styles";
9
10
 
10
- export interface CookieBannerProps extends MAlertProps {
11
- className?: string;
11
+ export interface CookieBannerProps
12
+ extends Omit<AlertProps, "children">,
13
+ BaseComponentProps {
12
14
  localStorageKey: string;
13
15
  message?: ReactNode;
14
16
  secondaryAction?: ReactNode;
@@ -20,66 +22,36 @@ export const CookieBanner = ({
20
22
  message,
21
23
  secondaryAction,
22
24
  }: CookieBannerProps): JSX.Element => {
25
+ const { isIn, onEnter, onExit } = useTransition();
23
26
  const localStorage = useLocalStorage(localStorageKey);
24
- const isCookieAccepted = localStorage === FLAG.TRUE;
25
27
 
26
- // Callback fired when the banner requests to be closed.
27
- const onDismiss = (): void => {
28
- setLocalStorage(localStorageKey, FLAG.TRUE);
29
- };
28
+ useEffect(() => {
29
+ if (localStorage === null) onEnter();
30
+ }, [localStorage, onEnter]);
30
31
 
31
32
  return (
32
- <DismissibleBanner
33
- Alert={Alert}
34
- className={className}
35
- onDismiss={onDismiss}
36
- open={!isCookieAccepted}
37
- slots={{
38
- closeButton: (props) => renderCloseButton(props, secondaryAction),
39
- }}
40
- >
41
- {message}
42
- </DismissibleBanner>
33
+ <Fade in={isIn} unmountOnExit>
34
+ <StyledAlert
35
+ {...ALERT_PROPS}
36
+ action={
37
+ <Fragment>
38
+ <Button
39
+ color="primary"
40
+ onClick={(): void => {
41
+ setLocalStorage(localStorageKey, FLAG.TRUE);
42
+ onExit();
43
+ }}
44
+ variant="contained"
45
+ >
46
+ Ok, Got It
47
+ </Button>
48
+ {secondaryAction}
49
+ </Fragment>
50
+ }
51
+ className={className}
52
+ >
53
+ {message}
54
+ </StyledAlert>
55
+ </Fade>
43
56
  );
44
57
  };
45
-
46
- /**
47
- * Return the cookie banner alert.
48
- * @param props - Alert props e.g. "onClick" to close banner.
49
- * @returns alert element.
50
- */
51
- const Alert = forwardRef<HTMLDivElement, MAlertProps>(function Alert(
52
- { ...props },
53
- ref
54
- ): JSX.Element {
55
- return (
56
- <Banner
57
- color="ink"
58
- elevation={2}
59
- icon={false}
60
- ref={ref}
61
- variant="filled"
62
- {...props}
63
- >
64
- {props.children}
65
- </Banner>
66
- );
67
- });
68
-
69
- /**
70
- * Returns the close action component(s).
71
- * @param buttonProps - Button props e.g. "onClick" to close banner.
72
- * @param secondaryAction - Secondary action component.
73
- * @returns close button element(s).
74
- */
75
- function renderCloseButton(
76
- buttonProps: ButtonProps,
77
- secondaryAction?: ReactNode
78
- ): JSX.Element {
79
- return (
80
- <Fragment>
81
- <ButtonPrimary onClick={buttonProps.onClick}>Ok, Got It</ButtonPrimary>
82
- {secondaryAction}
83
- </Fragment>
84
- );
85
- }
@@ -1,26 +1,21 @@
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 { useSessionTimeout } from "../../../../../hooks/useSessionTimeout";
4
- import { Banner } from "./sessionTimeout.styles";
5
-
6
- export interface SessionTimeoutProps extends Omit<MAlertProps, "title"> {
7
- className?: string;
8
- title?: ReactNode;
9
- }
4
+ import { BaseComponentProps, ContentProps } from "../../../../types";
5
+ import { Banner } from "../../banner";
10
6
 
11
7
  export const SessionTimeout = ({
8
+ children,
12
9
  className,
13
- title = "For your security, you have been logged out due to 15 minutes of inactivity.",
10
+ content,
14
11
  ...props
15
- }: SessionTimeoutProps): JSX.Element => {
12
+ }: AlertProps & BaseComponentProps & ContentProps): JSX.Element => {
16
13
  const { clearSessionTimeout, isSessionTimeout } = useSessionTimeout();
17
14
  return (
18
- <Fragment>
19
- {isSessionTimeout && (
20
- <Banner className={className} onClose={clearSessionTimeout} {...props}>
21
- {title}
22
- </Banner>
23
- )}
24
- </Fragment>
15
+ <Fade in={isSessionTimeout} unmountOnExit>
16
+ <Banner className={className} onClose={clearSessionTimeout} {...props}>
17
+ {content || children}
18
+ </Banner>
19
+ </Fade>
25
20
  );
26
21
  };
@@ -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
+ }
@@ -139,7 +139,6 @@ export interface DataSourceConfig {
139
139
  defaultParams?: {
140
140
  catalog: string;
141
141
  };
142
- entityURL?: string;
143
142
  url: string;
144
143
  }
145
144