@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
@@ -0,0 +1,10 @@
1
+ import styled from "@emotion/styled";
2
+ import { Chip } from "@mui/material";
3
+ import { inkLight } from "../../../../../../styles/common/mixins/colors";
4
+
5
+ export const StyledChip = styled(Chip)`
6
+ border-radius: 4px;
7
+ .MuiChip-label {
8
+ color: ${inkLight};
9
+ }
10
+ `;
@@ -0,0 +1,31 @@
1
+ import { Tooltip } from "@mui/material";
2
+ import React from "react";
3
+ import { BaseComponentProps } from "../../../../../types";
4
+ import { Title } from "./components/Tooltip/components/Title/title";
5
+ import { CHIP_PROPS, TOOLTIP_PROPS } from "./constants";
6
+ import { VersionInfoProps } from "./types";
7
+
8
+ import { getLabel } from "./utils";
9
+ import { StyledChip } from "./versionInfo.styles";
10
+
11
+ export const VersionInfo = ({
12
+ chipProps,
13
+ className,
14
+ tooltipProps,
15
+ versionInfo,
16
+ }: BaseComponentProps & VersionInfoProps): JSX.Element | null => {
17
+ return (
18
+ <Tooltip
19
+ {...TOOLTIP_PROPS}
20
+ title={<Title versionInfo={versionInfo} />}
21
+ {...tooltipProps}
22
+ >
23
+ <StyledChip
24
+ {...CHIP_PROPS}
25
+ className={className}
26
+ label={getLabel(versionInfo)}
27
+ {...chipProps}
28
+ />
29
+ </Tooltip>
30
+ );
31
+ };
@@ -6,10 +6,11 @@ import { NavLinkItem } from "../Header/components/Content/components/Navigation/
6
6
  import { AppBar, Link, Links, Socials } from "./footer.styles";
7
7
 
8
8
  export interface FooterProps {
9
- Branding: ReactNode;
9
+ Branding?: ReactNode;
10
10
  className?: string;
11
11
  navLinks?: NavLinkItem[];
12
12
  socials?: Social[];
13
+ versionInfo?: ReactNode;
13
14
  }
14
15
 
15
16
  export const Footer = ({
@@ -17,6 +18,7 @@ export const Footer = ({
17
18
  className,
18
19
  navLinks,
19
20
  socials,
21
+ versionInfo,
20
22
  }: FooterProps): JSX.Element => {
21
23
  return (
22
24
  <AppBar
@@ -27,7 +29,7 @@ export const Footer = ({
27
29
  >
28
30
  <Toolbar variant="dense">
29
31
  {Branding}
30
- {(navLinks || socials) && (
32
+ {(navLinks || socials || versionInfo) && (
31
33
  <Links>
32
34
  {navLinks &&
33
35
  navLinks.map(({ label, target = ANCHOR_TARGET.SELF, url }, i) => (
@@ -39,6 +41,7 @@ export const Footer = ({
39
41
  />
40
42
  ))}
41
43
  {socials && <Socials buttonSize="small" socials={socials} />}
44
+ {versionInfo}
42
45
  </Links>
43
46
  )}
44
47
  </Toolbar>
@@ -4,7 +4,6 @@ import { Link } from "../../../../../../../Links/components/Link/link";
4
4
  export const StyledLink = styled(Link)`
5
5
  &.MuiLink-root {
6
6
  flex: none;
7
- text-decoration: none !important;
8
7
  img {
9
8
  margin: 0;
10
9
  }
@@ -4,11 +4,11 @@ import {
4
4
  StaticImage,
5
5
  } from "../../../../../../../common/StaticImage/staticImage";
6
6
  import { ANCHOR_TARGET } from "../../../../../../../Links/common/entities";
7
+ import { BaseComponentProps } from "../../../../../../../types";
7
8
  import { StyledLink } from "./logo.styles";
8
9
 
9
- export interface LogoProps {
10
+ export interface LogoProps extends BaseComponentProps {
10
11
  alt: string;
11
- className?: string;
12
12
  height?: number;
13
13
  link: string;
14
14
  src: ImageSrc;
@@ -30,6 +30,7 @@ export const Logo = ({
30
30
  className={className}
31
31
  label={<StaticImage alt={alt} height={height} src={src} width={width} />}
32
32
  target={target}
33
+ underline="none"
33
34
  url={link}
34
35
  />
35
36
  );
@@ -8,6 +8,7 @@ import React, { ReactNode } from "react";
8
8
  import { isValidUrl } from "../../../../common/utils";
9
9
  import { CopyToClipboard } from "../../../common/CopyToClipboard/copyToClipboard";
10
10
  import { TypographyProps } from "../../../common/Typography/common/entities";
11
+ import { BaseComponentProps } from "../../../types";
11
12
  import { ANCHOR_TARGET, REL_ATTRIBUTE, Url } from "../../common/entities";
12
13
  import {
13
14
  isClientSideNavigation,
@@ -16,11 +17,11 @@ import {
16
17
  } from "../../common/utils";
17
18
  import { ExploreViewLink } from "./components/ExploreViewLink/exploreViewLink";
18
19
 
19
- export interface LinkProps {
20
- className?: string;
20
+ export interface LinkProps
21
+ extends BaseComponentProps,
22
+ Omit<MLinkProps, "children" | "component"> {
21
23
  copyable?: boolean;
22
24
  label: ReactNode /* link label may be an element */;
23
- noWrap?: MLinkProps["noWrap"];
24
25
  onClick?: () => void;
25
26
  target?: ANCHOR_TARGET;
26
27
  TypographyProps?: TypographyProps;
@@ -55,19 +56,19 @@ export const Link = ({
55
56
  /* Client-side navigation */
56
57
  return (
57
58
  <>
58
- <NLink href={url} legacyBehavior passHref>
59
- <MLink
60
- className={className}
61
- rel={REL_ATTRIBUTE.NO_OPENER}
62
- noWrap={noWrap}
63
- target={target || ANCHOR_TARGET.SELF}
64
- onClick={onClick}
65
- {...TypographyProps}
66
- {...props}
67
- >
68
- {label}
69
- </MLink>
70
- </NLink>
59
+ <MLink
60
+ className={className}
61
+ component={NLink}
62
+ href={url}
63
+ noWrap={noWrap}
64
+ onClick={onClick}
65
+ rel={REL_ATTRIBUTE.NO_OPENER}
66
+ target={target || ANCHOR_TARGET.SELF}
67
+ {...TypographyProps}
68
+ {...props}
69
+ >
70
+ {label}
71
+ </MLink>
71
72
  {copyable && <CopyToClipboard copyStr={url} />}
72
73
  </>
73
74
  );
@@ -1,5 +1,6 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Fab as MFab, Popover as MPopover } from "@mui/material";
3
+ import { mediaTabletUp } from "../../../../../../styles/common/mixins/breakpoints";
3
4
  import { smokeMain } from "../../../../../../styles/common/mixins/colors";
4
5
  import { shadows02 } from "../../../../../../styles/common/mixins/shadows";
5
6
  import { tabletUp } from "../../../../../../theme/common/breakpoints";
@@ -15,6 +16,10 @@ export const Fab = styled(MFab)<Props>`
15
16
  position: fixed;
16
17
  right: 16px;
17
18
  z-index: ${({ open }) => (open ? 1350 : 1050)}; // Above backdrop component.
19
+
20
+ ${mediaTabletUp} {
21
+ bottom: 72px;
22
+ }
18
23
  `;
19
24
 
20
25
  export const Popover = styled(MPopover)`
@@ -1,4 +1,5 @@
1
1
  import styled from "@emotion/styled";
2
+ import { mediaTabletUp } from "../../../../styles/common/mixins/breakpoints";
2
3
  import {
3
4
  primaryDark,
4
5
  primaryMain,
@@ -27,4 +28,8 @@ export const Fab = styled("a")`
27
28
  &:hover {
28
29
  background-color: ${primaryDark};
29
30
  }
31
+
32
+ ${mediaTabletUp} {
33
+ bottom: 72px;
34
+ }
30
35
  `;
@@ -344,7 +344,6 @@ export function getTableStatePagination(
344
344
  * @returns list of headers.
345
345
  */
346
346
  function getHeadersTableData<T extends RowData>(rows: Row<T>[]): TableData[] {
347
- console.log(rows[0].getAllCells());
348
347
  return rows[0]
349
348
  .getAllCells()
350
349
  .filter((cell) => cell.column.id !== ACCESSOR_KEYS.SELECT)
@@ -1,28 +1,25 @@
1
+ import { css } from "@emotion/react";
1
2
  import styled from "@emotion/styled";
2
- import { TABLET } from "../../../theme/common/breakpoints";
3
- import { Alert } from "./alert";
3
+ import { Alert } from "@mui/material";
4
+ import { SIZE } from "../../../styles/common/constants/size";
5
+ import {
6
+ textBody4002Lines,
7
+ textBodyLarge500,
8
+ } from "../../../styles/common/mixins/fonts";
4
9
 
5
- /**
6
- * Flat alert - typically used when in full stretch or full "bleed" across a container.
7
- * e.g. the entire width of mobile viewports.
8
- */
9
- export const FlatAlert = styled(Alert)`
10
- border-left: none;
11
- border-radius: 0;
12
- border-right: none;
13
- box-shadow: none;
14
- `;
15
-
16
- /* eslint-disable valid-jsdoc -- disable require param */
17
- /**
18
- * Fluid alert - typically used to transition between flat paper (mobile) and rounded paper (tablet or desktop).
19
- */
20
- /* eslint-enable valid-jsdoc -- disable require param */
21
- export const FluidAlert = styled(Alert)`
22
- ${({ theme }) => theme.breakpoints.down(TABLET)} {
23
- border-left: none;
24
- border-radius: 0;
25
- border-right: none;
26
- box-shadow: none;
27
- }
10
+ export const StyledAlert = styled(Alert)`
11
+ ${(props) =>
12
+ props.size === SIZE.LARGE &&
13
+ css`
14
+ padding: 20px;
15
+ .MuiAlert-icon {
16
+ padding: 2px 0;
17
+ }
18
+ .MuiAlert-message {
19
+ ${textBody4002Lines(props)};
20
+ .MuiAlertTitle-root {
21
+ ${textBodyLarge500(props)};
22
+ }
23
+ }
24
+ `}
28
25
  `;
@@ -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
  };