@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.
- package/.github/workflows/release-please.yml +48 -0
- package/.github/workflows/run-checks.yml +41 -15
- package/.prettierignore +1 -0
- package/CHANGELOG.md +49 -0
- package/jest.config.js +1 -1
- package/lib/common/analytics/entities.d.ts +10 -9
- package/lib/common/analytics/entities.js +2 -4
- package/lib/components/Export/common/tracking.d.ts +12 -3
- package/lib/components/Export/common/tracking.js +23 -13
- package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.d.ts +1 -1
- package/lib/components/Export/components/DownloadCurlCommand/downloadCurlCommand.js +2 -16
- package/lib/components/Export/components/ExportMethod/exportMethod.d.ts +2 -1
- package/lib/components/Export/components/ExportMethod/exportMethod.js +2 -3
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.js +6 -3
- package/lib/components/Export/components/ExportToTerra/exportToTerra.js +9 -1
- package/lib/components/Export/components/ManifestDownload/manifestDownload.js +7 -1
- package/lib/components/Index/components/Hero/components/ExportButton/exportButton.js +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.d.ts +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.js +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.styles.js +0 -1
- package/lib/components/Links/components/Link/link.d.ts +2 -3
- package/lib/components/Links/components/Link/link.js +1 -2
- package/lib/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.js +1 -3
- package/lib/components/TempError/tempError.d.ts +2 -2
- package/lib/components/TempError/tempError.js +4 -4
- package/lib/components/common/Alert/alert.d.ts +4 -12
- package/lib/components/common/Alert/alert.js +5 -7
- package/lib/components/common/Alert/alert.styles.d.ts +1 -11
- package/lib/components/common/Alert/alert.styles.js +18 -24
- package/lib/components/common/Alert/constants.d.ts +2 -0
- package/lib/components/common/Alert/constants.js +27 -0
- package/lib/components/common/Alert/hooks/useTransition/types.d.ts +5 -0
- package/lib/components/common/Alert/hooks/useTransition/types.js +1 -0
- package/lib/components/common/Alert/hooks/useTransition/useTransition.d.ts +7 -0
- package/lib/components/common/Alert/hooks/useTransition/useTransition.js +20 -0
- package/lib/components/common/Banner/banner.d.ts +4 -7
- package/lib/components/common/Banner/banner.js +4 -3
- package/lib/components/common/Banner/banner.styles.d.ts +3 -0
- package/lib/components/common/Banner/banner.styles.js +28 -0
- package/lib/components/common/Banner/components/CookieBanner/constants.d.ts +2 -0
- package/lib/components/common/Banner/components/CookieBanner/constants.js +7 -0
- package/lib/components/common/Banner/components/CookieBanner/cookieBanner.d.ts +3 -3
- package/lib/components/common/Banner/components/CookieBanner/cookieBanner.js +17 -31
- package/lib/components/common/Banner/components/CookieBanner/cookieBanner.styles.d.ts +1 -1
- package/lib/components/common/Banner/components/CookieBanner/cookieBanner.styles.js +2 -16
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.d.ts +3 -7
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.js +6 -4
- package/lib/components/common/Banner/components/SystemIndexing/systemIndexing.d.ts +3 -8
- package/lib/components/common/Banner/components/SystemIndexing/systemIndexing.js +6 -8
- package/lib/components/common/Banner/components/SystemStatus/systemStatus.d.ts +3 -8
- package/lib/components/common/Banner/components/SystemStatus/systemStatus.js +6 -8
- package/lib/components/common/Banner/constants.d.ts +2 -0
- package/lib/components/common/Banner/constants.js +9 -0
- package/lib/components/common/Breadcrumbs/breadcrumbs.d.ts +2 -2
- package/lib/components/common/Breadcrumbs/breadcrumbs.js +3 -4
- package/lib/components/common/Paper/paper.styles.js +18 -12
- package/lib/components/types.d.ts +10 -0
- package/lib/components/types.js +1 -0
- package/lib/config/entities.d.ts +0 -1
- package/lib/entity/api/service.js +16 -18
- package/lib/entity/common/client.d.ts +6 -10
- package/lib/entity/common/client.js +21 -31
- package/lib/entity/common/service.js +6 -8
- package/lib/entity/common/utils.d.ts +4 -4
- package/lib/entity/common/utils.js +3 -3
- package/lib/hooks/useLocalStorage/useLocalStorage.d.ts +1 -1
- package/lib/hooks/useLocalStorage/useLocalStorage.js +1 -1
- package/lib/shared/utils.d.ts +0 -5
- package/lib/shared/utils.js +0 -8
- package/lib/styles/common/constants/size.d.ts +5 -0
- package/lib/styles/common/constants/size.js +6 -0
- package/lib/styles/common/mui/alert.d.ts +4 -0
- package/lib/styles/common/mui/alert.js +20 -0
- package/lib/styles/common/mui/icon.d.ts +2 -0
- package/lib/styles/common/mui/icon.js +6 -0
- package/lib/theme/common/components.d.ts +0 -12
- package/lib/theme/common/components.js +17 -157
- package/lib/theme/components/index.d.ts +2 -0
- package/lib/theme/components/index.js +2 -0
- package/lib/theme/components/muiAlert.d.ts +2 -0
- package/lib/theme/components/muiAlert.js +121 -0
- package/lib/theme/components/muiAlertTitle.d.ts +2 -0
- package/lib/theme/components/muiAlertTitle.js +12 -0
- package/lib/theme/theme.js +3 -2
- package/package.json +7 -6
- package/src/common/analytics/entities.ts +9 -8
- package/src/common/analytics/readme-analytics.md +19 -7
- package/src/components/Export/common/tracking.ts +26 -16
- package/src/components/Export/components/DownloadCurlCommand/downloadCurlCommand.tsx +2 -30
- package/src/components/Export/components/ExportMethod/exportMethod.tsx +14 -4
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx +16 -18
- package/src/components/Export/components/ExportToTerra/exportToTerra.tsx +11 -1
- package/src/components/Export/components/ManifestDownload/manifestDownload.tsx +9 -1
- package/src/components/Index/components/Hero/components/ExportButton/exportButton.tsx +5 -1
- package/src/components/Layout/components/Header/components/Content/components/Logo/logo.styles.ts +0 -1
- package/src/components/Layout/components/Header/components/Content/components/Logo/logo.tsx +3 -2
- package/src/components/Links/components/Link/link.tsx +17 -16
- package/src/components/Support/components/SupportRequest/components/SupportRequestForm/supportRequestForm.tsx +1 -2
- package/src/components/TempError/tempError.tsx +10 -9
- package/src/components/common/Alert/alert.styles.ts +22 -25
- package/src/components/common/Alert/alert.tsx +14 -35
- package/src/components/common/Alert/constants.ts +29 -0
- package/src/components/common/Alert/hooks/useTransition/types.ts +5 -0
- package/src/components/common/Alert/hooks/useTransition/useTransition.ts +25 -0
- package/src/components/common/Banner/banner.styles.ts +29 -0
- package/src/components/common/Banner/banner.tsx +11 -18
- package/src/components/common/Banner/components/CookieBanner/constants.ts +9 -0
- package/src/components/common/Banner/components/CookieBanner/cookieBanner.styles.ts +2 -16
- package/src/components/common/Banner/components/CookieBanner/cookieBanner.tsx +36 -64
- package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.tsx +12 -17
- package/src/components/common/Banner/components/SystemIndexing/systemIndexing.tsx +11 -22
- package/src/components/common/Banner/components/SystemStatus/systemStatus.tsx +11 -22
- package/src/components/common/Banner/constants.ts +11 -0
- package/src/components/common/Breadcrumbs/breadcrumbs.tsx +6 -10
- package/src/components/common/Paper/paper.styles.ts +18 -12
- package/src/components/types.ts +13 -0
- package/src/config/entities.ts +0 -1
- package/src/entity/api/service.ts +24 -27
- package/src/entity/common/client.ts +22 -40
- package/src/entity/common/service.ts +8 -10
- package/src/entity/common/utils.ts +4 -6
- package/src/hooks/useLocalStorage/useLocalStorage.ts +2 -2
- package/src/shared/utils.ts +0 -9
- package/src/styles/common/constants/size.ts +5 -0
- package/src/styles/common/mui/alert.ts +24 -0
- package/src/styles/common/mui/icon.ts +8 -0
- package/src/theme/common/components.ts +16 -159
- package/src/theme/components/index.ts +2 -0
- package/src/theme/components/muiAlert.ts +123 -0
- package/src/theme/components/muiAlertTitle.ts +14 -0
- package/src/theme/theme.ts +3 -2
- package/tests/authentication.test.ts +7 -1
- package/tests/azulFileDownload.test.tsx +9 -3
- package/tests/fetchApi.test.ts +93 -0
- package/tests/tsconfig.json +1 -0
- package/tests/useFileLocation.test.ts +6 -2
- package/types/data-explorer-ui.d.ts +6 -5
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.d.ts +0 -8
- package/lib/components/Detail/components/Table/components/TableHead/tableHead.js +0 -36
- package/lib/components/Index/components/TitleCell/titleCell.d.ts +0 -6
- package/lib/components/Index/components/TitleCell/titleCell.js +0 -10
- package/lib/components/Index/components/TitleCell/titleCell.styles.d.ts +0 -3
- package/lib/components/Index/components/TitleCell/titleCell.styles.js +0 -6
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.d.ts +0 -6
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.js +0 -13
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +0 -36
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.js +0 -9
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.d.ts +0 -5
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.js +0 -10
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +0 -36
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.js +0 -9
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.d.ts +0 -2
- package/lib/components/Table/components/EntityViewToggle/entityViewToggle.js +0 -37
- package/lib/components/common/Alert/alert.stories.d.ts +0 -6
- package/lib/components/common/Alert/alert.stories.js +0 -36
- package/lib/components/common/Alert/components/AlertText/alertText.styles.d.ts +0 -4
- package/lib/components/common/Alert/components/AlertText/alertText.styles.js +0 -19
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.d.ts +0 -7
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.js +0 -5
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.d.ts +0 -3
- package/lib/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.js +0 -19
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.d.ts +0 -10
- package/lib/components/common/Banner/components/DismissibleBanner/dismissibleBanner.js +0 -16
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.d.ts +0 -3
- package/lib/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.js +0 -21
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.d.ts +0 -5
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.js +0 -10
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.d.ts +0 -3
- package/lib/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.js +0 -9
- package/lib/hooks/useCategoryConfigs.d.ts +0 -6
- package/lib/hooks/useCategoryConfigs.js +0 -17
- package/lib/hooks/useEntityListRelatedView.d.ts +0 -15
- package/lib/hooks/useEntityListRelatedView.js +0 -62
- package/lib/hooks/useMenu.d.ts +0 -10
- package/lib/hooks/useMenu.js +0 -17
- package/lib/hooks/useMenuWithPosition.d.ts +0 -14
- package/lib/hooks/useMenuWithPosition.js +0 -33
- package/src/components/Index/components/TitleCell/titleCell.styles.ts +0 -7
- package/src/components/Index/components/TitleCell/titleCell.tsx +0 -22
- package/src/components/common/Alert/alert.stories.tsx +0 -41
- package/src/components/common/Alert/components/AlertText/alertText.styles.ts +0 -20
- package/src/components/common/Banner/components/BannerPrimary/bannerPrimary.styles.ts +0 -20
- package/src/components/common/Banner/components/BannerPrimary/bannerPrimary.tsx +0 -27
- package/src/components/common/Banner/components/DismissibleBanner/dismissibleBanner.tsx +0 -44
- package/src/components/common/Banner/components/SessionTimeout/sessionTimeout.styles.ts +0 -22
|
@@ -1,39 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
<
|
|
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
|
-
</
|
|
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,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 {
|
|
2
|
-
import React, { forwardRef
|
|
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
|
|
5
|
-
|
|
6
|
-
|
|
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
|
});
|
|
@@ -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
|
|
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 {
|
|
2
|
-
import 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 {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
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
|
|
11
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (localStorage === null) onEnter();
|
|
30
|
+
}, [localStorage, onEnter]);
|
|
30
31
|
|
|
31
32
|
return (
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
2
|
-
import React
|
|
1
|
+
import { AlertProps, Fade } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { useSessionTimeout } from "../../../../../hooks/useSessionTimeout";
|
|
4
|
-
import {
|
|
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
|
-
|
|
10
|
+
content,
|
|
14
11
|
...props
|
|
15
|
-
}:
|
|
12
|
+
}: AlertProps & BaseComponentProps & ContentProps): JSX.Element => {
|
|
16
13
|
const { clearSessionTimeout, isSessionTimeout } = useSessionTimeout();
|
|
17
14
|
return (
|
|
18
|
-
<
|
|
19
|
-
{
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
|
2
|
-
import React
|
|
1
|
+
import { AlertProps, Fade } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { useSystemStatus } from "../../../../../hooks/useSystemStatus";
|
|
4
|
-
import {
|
|
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
|
-
|
|
10
|
+
content,
|
|
16
11
|
...props
|
|
17
|
-
}:
|
|
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
|
-
<
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
|
2
|
-
import React
|
|
1
|
+
import { AlertProps, Fade } from "@mui/material";
|
|
2
|
+
import React from "react";
|
|
3
3
|
import { useSystemStatus } from "../../../../../hooks/useSystemStatus";
|
|
4
|
-
import {
|
|
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
|
-
|
|
10
|
+
content,
|
|
16
11
|
...props
|
|
17
|
-
}:
|
|
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
|
-
<
|
|
23
|
-
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
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
|
|
33
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
23
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|