@databiosphere/findable-ui 11.0.0 → 12.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 (36) hide show
  1. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.d.ts +2 -1
  2. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.js +3 -2
  3. package/lib/components/Layout/components/BackPage/components/BackPageHero/backPageHero.styles.js +3 -3
  4. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.d.ts +6 -0
  5. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.js +5 -0
  6. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.styles.d.ts +4 -0
  7. package/lib/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.styles.js +13 -0
  8. package/lib/components/Layout/components/Header/common/entities.d.ts +1 -0
  9. package/lib/components/Layout/components/Header/common/utils.d.ts +9 -1
  10. package/lib/components/Layout/components/Header/common/utils.js +16 -1
  11. package/lib/components/Layout/components/Header/hooks/useHeaderVisibility.js +2 -1
  12. package/lib/components/common/Button/components/CallToActionButton/callToActionButton.d.ts +3 -1
  13. package/lib/components/common/Button/components/CallToActionButton/callToActionButton.js +2 -2
  14. package/lib/components/common/Markdown/markdown.d.ts +3 -1
  15. package/lib/components/common/Markdown/markdown.js +3 -2
  16. package/lib/theme/common/palette.d.ts +35 -129
  17. package/lib/theme/common/palette.js +57 -69
  18. package/package.json +5 -5
  19. package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.styles.ts +3 -3
  20. package/src/components/Layout/components/BackPage/components/BackPageHero/backPageHero.tsx +5 -1
  21. package/src/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.styles.ts +14 -0
  22. package/src/components/Layout/components/BackPage/components/BackPageHero/components/Actions/actions.tsx +13 -0
  23. package/src/components/Layout/components/Header/common/entities.ts +1 -0
  24. package/src/components/Layout/components/Header/common/utils.ts +23 -1
  25. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +1 -1
  26. package/src/components/Layout/components/Header/hooks/useHeaderVisibility.ts +3 -1
  27. package/src/components/common/Button/components/CallToActionButton/callToActionButton.tsx +5 -0
  28. package/src/components/common/Code/code.tsx +1 -1
  29. package/src/components/common/CopyToClipboard/copyToClipboard.tsx +1 -1
  30. package/src/components/common/Markdown/markdown.tsx +8 -2
  31. package/src/components/common/Section/components/CollapsableSection/collapsableSection.tsx +1 -1
  32. package/src/hooks/useFileManifest/useRequestFileManifest.ts +1 -1
  33. package/src/hooks/useRequestFileLocation.ts +1 -1
  34. package/src/hooks/useResizeObserver.ts +1 -1
  35. package/src/hooks/useWindowResize.ts +1 -1
  36. package/src/theme/common/palette.ts +57 -57
@@ -5,10 +5,11 @@ import { CallToAction } from "../../../../../common/Button/components/CallToActi
5
5
  * Back page hero component comprising breadcrumbs, title, status and tabs.
6
6
  */
7
7
  export interface BackPageHeroProps {
8
+ actions?: ReactNode;
8
9
  breadcrumbs?: Breadcrumb[];
9
10
  callToAction?: CallToAction;
10
11
  children?: ReactNode;
11
12
  subTitle?: ReactNode;
12
13
  title?: ReactNode;
13
14
  }
14
- export declare const BackPageHero: ({ breadcrumbs, callToAction, children, subTitle, title, }: BackPageHeroProps) => JSX.Element;
15
+ export declare const BackPageHero: ({ actions, breadcrumbs, callToAction, children, subTitle, title, }: BackPageHeroProps) => JSX.Element;
@@ -3,14 +3,15 @@ import { Breadcrumbs, } from "../../../../../common/Breadcrumbs/breadcrumbs";
3
3
  import { Title } from "../../../../../common/Title/title";
4
4
  import { BackPageHeroHeadline, CallToActionButton, HeroHeader, } from "./backPageHero.styles";
5
5
  import { SubTitle } from "./components/SubTitle/subTitle";
6
- export const BackPageHero = ({ breadcrumbs, callToAction, children, subTitle, title, }) => {
7
- const HeroHeadline = callToAction ? BackPageHeroHeadline : Fragment;
6
+ export const BackPageHero = ({ actions, breadcrumbs, callToAction, children, subTitle, title, }) => {
7
+ const HeroHeadline = actions || callToAction ? BackPageHeroHeadline : Fragment;
8
8
  return (React.createElement(React.Fragment, null,
9
9
  (breadcrumbs || title) && (React.createElement(HeroHeadline, null,
10
10
  React.createElement(HeroHeader, { gap: 1 },
11
11
  breadcrumbs && React.createElement(Breadcrumbs, { breadcrumbs: breadcrumbs }),
12
12
  title && React.createElement(Title, { title: title }),
13
13
  React.createElement(SubTitle, { subTitle: subTitle })),
14
+ actions,
14
15
  callToAction && React.createElement(CallToActionButton, { callToAction: callToAction }))),
15
16
  children));
16
17
  };
@@ -1,6 +1,6 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Stack } from "@mui/material";
3
- import { TABLET } from "../../../../../../theme/common/breakpoints";
3
+ import { mediaTabletUp } from "../../../../../../styles/common/mixins/breakpoints";
4
4
  import { CallToActionButton as CTAButton } from "../../../../../common/Button/components/CallToActionButton/callToActionButton";
5
5
  export const BackPageHeroHeadline = styled.div `
6
6
  display: contents;
@@ -9,7 +9,7 @@ export const BackPageHeroHeadline = styled.div `
9
9
  grid-column: 1 / -1; // Title and breadcrumbs consume full width of available grid.
10
10
  }
11
11
 
12
- ${({ theme }) => theme.breakpoints.up(TABLET)} {
12
+ ${mediaTabletUp} {
13
13
  display: flex;
14
14
  flex: 1;
15
15
  gap: 88px;
@@ -26,7 +26,7 @@ export const CallToActionButton = styled(CTAButton) `
26
26
  align-self: center;
27
27
  justify-self: flex-start;
28
28
 
29
- ${({ theme }) => theme.breakpoints.up(TABLET)} {
29
+ ${mediaTabletUp} {
30
30
  justify-self: flex-end;
31
31
  }
32
32
  `;
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ export interface ActionsProps {
3
+ children: ReactNode;
4
+ className?: string;
5
+ }
6
+ export declare const Actions: ({ children, className }: ActionsProps) => JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from "react";
2
+ import { BackPageHeroActions } from "./actions.styles";
3
+ export const Actions = ({ children, className }) => {
4
+ return (React.createElement(BackPageHeroActions, { className: className }, children));
5
+ };
@@ -0,0 +1,4 @@
1
+ export declare const BackPageHeroActions: import("@emotion/styled").StyledComponent<{
2
+ theme?: import("@emotion/react").Theme;
3
+ as?: React.ElementType;
4
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
@@ -0,0 +1,13 @@
1
+ import styled from "@emotion/styled";
2
+ import { mediaTabletUp } from "../../../../../../../../styles/common/mixins/breakpoints";
3
+ export const BackPageHeroActions = styled.div `
4
+ align-items: center;
5
+ align-self: center;
6
+ display: flex;
7
+ gap: 16px;
8
+ justify-self: flex-start;
9
+
10
+ ${mediaTabletUp} {
11
+ justify-self: flex-end;
12
+ }
13
+ `;
@@ -13,4 +13,5 @@ export declare enum SELECTED_MATCH {
13
13
  }
14
14
  export interface SocialMedia {
15
15
  socials: Social[];
16
+ visible?: Partial<Record<BreakpointKey, boolean>>;
16
17
  }
@@ -1,6 +1,7 @@
1
1
  import { Breakpoint } from "@mui/material";
2
+ import { UseBreakpoint } from "../../../../../hooks/useBreakpoint";
2
3
  import { NavLinkItem } from "../components/Content/components/Navigation/navigation";
3
- import { Navigation } from "./entities";
4
+ import { Navigation, SocialMedia } from "./entities";
4
5
  /**
5
6
  * Returns the configured menu navigation links.
6
7
  * @param navigation - Navigation links.
@@ -14,3 +15,10 @@ export declare function getMenuNavigationLinks(navigation?: Navigation): NavLink
14
15
  * @returns navigation links.
15
16
  */
16
17
  export declare function getNavigationLinks(navigationLinks?: NavLinkItem[], breakpoint?: Breakpoint): NavLinkItem[];
18
+ /**
19
+ * Returns true if the social media is visible at the current breakpoint.
20
+ * @param bp - Breakpoint.
21
+ * @param socialMedia - Social media.
22
+ * @returns true.
23
+ */
24
+ export declare function isSocialsVisible(bp: Pick<UseBreakpoint, "breakpoint" | "lgUp">, socialMedia?: SocialMedia): boolean;
@@ -1,5 +1,5 @@
1
1
  import { isClientSideNavigation } from "../../../../Links/common/utils";
2
- import { SELECTED_MATCH } from "./entities";
2
+ import { SELECTED_MATCH, } from "./entities";
3
3
  /**
4
4
  * Adds to the set of selected patterns, for the navigation link, at the current breakpoint.
5
5
  * @param setOfPatterns - Set of selected patterns.
@@ -126,6 +126,21 @@ function isLinkVisible(navLinkItem, breakpoint) {
126
126
  return true; // Default is visible.
127
127
  return navLinkItem.visible[breakpoint] !== false;
128
128
  }
129
+ /**
130
+ * Returns true if the social media is visible at the current breakpoint.
131
+ * @param bp - Breakpoint.
132
+ * @param socialMedia - Social media.
133
+ * @returns true.
134
+ */
135
+ export function isSocialsVisible(bp, socialMedia) {
136
+ if (!socialMedia)
137
+ return false;
138
+ if (!bp.breakpoint)
139
+ return false;
140
+ if (!socialMedia.visible)
141
+ return bp.lgUp;
142
+ return socialMedia.visible[bp.breakpoint] !== false;
143
+ }
129
144
  /**
130
145
  * Returns the navigation link with the selected matches, for the current breakpoint.
131
146
  * @param navLinkItem - Navigation link.
@@ -1,4 +1,5 @@
1
1
  import { useBreakpoint } from "../../../../../hooks/useBreakpoint";
2
+ import { isSocialsVisible } from "../common/utils";
2
3
  /**
3
4
  * Returns header component visibility for header related rendering logic.
4
5
  * @param headerProps - Header component props.
@@ -25,7 +26,7 @@ export const useHeaderVisibility = (headerProps) => {
25
26
  const isNavigationIn = smUp;
26
27
  const isMenuIn = hasMenu;
27
28
  const isSloganIn = hasSlogan && mdUp;
28
- const isSocialsIn = hasSocials && lgUp;
29
+ const isSocialsIn = hasSocials && isSocialsVisible({ breakpoint, lgUp }, socialMedia);
29
30
  // Determines navigation visibility.
30
31
  const isCenterNavigationIn = isNavigationIn && hasNavItemsC;
31
32
  const isLeftNavigationIn = isNavigationIn && hasNavItemsL;
@@ -1,3 +1,4 @@
1
+ import { ButtonProps } from "@mui/material";
1
2
  import { ElementType } from "react";
2
3
  import { ANCHOR_TARGET } from "../../../../Links/common/entities";
3
4
  export interface CallToAction {
@@ -7,8 +8,9 @@ export interface CallToAction {
7
8
  }
8
9
  export interface CallToActionButtonProps {
9
10
  ButtonElType?: ElementType;
11
+ buttonProps?: Partial<ButtonProps>;
10
12
  callToAction: CallToAction;
11
13
  className?: string;
12
14
  disabled?: boolean;
13
15
  }
14
- export declare const CallToActionButton: ({ ButtonElType: Button, callToAction, className, disabled, }: CallToActionButtonProps) => JSX.Element;
16
+ export declare const CallToActionButton: ({ ButtonElType: Button, buttonProps, callToAction, className, disabled, }: CallToActionButtonProps) => JSX.Element;
@@ -3,9 +3,9 @@ import React from "react";
3
3
  import { ANCHOR_TARGET, REL_ATTRIBUTE, } from "../../../../Links/common/entities";
4
4
  import { isClientSideNavigation } from "../../../../Links/common/utils";
5
5
  import { ButtonPrimary } from "../ButtonPrimary/buttonPrimary";
6
- export const CallToActionButton = ({ ButtonElType: Button = ButtonPrimary, callToAction, className, disabled = false, }) => {
6
+ export const CallToActionButton = ({ ButtonElType: Button = ButtonPrimary, buttonProps, callToAction, className, disabled = false, }) => {
7
7
  const { label, target, url } = callToAction;
8
8
  const isInternal = isClientSideNavigation(url);
9
9
  return isInternal ? (React.createElement(NLink, { href: url, legacyBehavior: true, passHref: true },
10
- React.createElement(Button, { className: className, disabled: disabled, href: "passHref", rel: REL_ATTRIBUTE.NO_OPENER, target: target || ANCHOR_TARGET.SELF }, label))) : (React.createElement(Button, { className: className, disabled: disabled, href: url, rel: REL_ATTRIBUTE.NO_OPENER_NO_REFERRER, target: target || ANCHOR_TARGET.BLANK }, label));
10
+ React.createElement(Button, { className: className, disabled: disabled, href: "passHref", rel: REL_ATTRIBUTE.NO_OPENER, target: target || ANCHOR_TARGET.SELF, ...buttonProps }, label))) : (React.createElement(Button, { className: className, disabled: disabled, href: url, rel: REL_ATTRIBUTE.NO_OPENER_NO_REFERRER, target: target || ANCHOR_TARGET.BLANK, ...buttonProps }, label));
11
11
  };
@@ -1,4 +1,6 @@
1
+ import { BoxProps as MBoxProps } from "@mui/material";
1
2
  export interface MarkdownProps {
2
3
  content: string;
4
+ sx?: MBoxProps["sx"];
3
5
  }
4
- export declare const Markdown: ({ content }: MarkdownProps) => JSX.Element;
6
+ export declare const Markdown: ({ content, sx }: MarkdownProps) => JSX.Element;
@@ -1,6 +1,7 @@
1
1
  // TODO deprecate component if possible (see MDXMarkdown)
2
+ import { Box as MBox } from "@mui/material";
2
3
  import DOMPurify from "isomorphic-dompurify";
3
4
  import React from "react";
4
- export const Markdown = ({ content }) => {
5
- return (React.createElement("div", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(content) } }));
5
+ export const Markdown = ({ content, sx }) => {
6
+ return (React.createElement(MBox, { component: "div", dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(content) }, sx: { minWidth: 0, wordBreak: "break-word", ...sx } }));
6
7
  };
@@ -1,142 +1,49 @@
1
1
  import { PaletteColorOptions } from "@mui/material";
2
2
  import { CommonColors, TypeBackground, TypeText } from "@mui/material/styles";
3
- /**
4
- * Palette "Alert"
5
- */
6
- declare enum ALERT {
7
- LIGHT = "#FED3D1",
8
- LIGHTEST = "#FFF4F4",
9
- MAIN = "#B42318"
10
- }
11
- /**
12
- * Palette "Background"
13
- */
14
- declare enum BACKGROUND {
15
- DEFAULT = "#F6F6F7"
16
- }
17
- /**
18
- * Palette "Info"
19
- */
20
- declare enum INFO {
21
- CONTRAST_TEXT = "#00729C",
22
- LIGHT = "#97D6EA",
23
- LIGHTEST = "#F2FAFC",
24
- MAIN = "#00729C"
25
- }
26
- /**
27
- * Palette "Ink"
28
- */
29
- declare enum INK {
30
- LIGHT = "#637381",
31
- MAIN = "#212B36"
32
- }
33
- /**
34
- * Palette "Primary"
35
- */
36
- declare enum PRIMARY {
37
- DARK = "#005EA9",
38
- LIGHTEST = "#E6EFF6",
39
- MAIN = "#1C7CC7"
40
- }
41
- /**
42
- * Palette "Smoke"
43
- */
44
- declare enum SMOKE {
45
- DARK = "#C4CDD5",
46
- LIGHT = "#F6F6F7",
47
- LIGHTEST = "#FAFBFB",
48
- MAIN = "#E1E3E5"
49
- }
50
- /**
51
- * Palette "Success"
52
- */
53
- declare enum SUCCESS {
54
- LIGHT = "#AEE9D1",
55
- LIGHTEST = "#F1F8F5",
56
- MAIN = "#287555"
57
- }
58
- /**
59
- * Palette "Text"
60
- */
61
- declare enum TEXT {
62
- PRIMARY = "#212B36"
63
- }
64
- /**
65
- * Palette "Warning"
66
- */
67
- declare enum WARNING {
68
- CONTRAST_TEXT = "#B54708",
69
- LIGHT = "#FFD79D",
70
- LIGHTEST = "#FFFAEB",
71
- MAIN = "#B54708"
72
- }
73
- /**
74
- * Default "Black"
75
- */
76
- declare enum BLACK {
77
- DEFAULT = "#000000"
78
- }
79
- /**
80
- * Default "White"
81
- */
82
- declare enum WHITE {
83
- DEFAULT = "#ffffff"
84
- }
85
- /**
86
- * Color alpha
87
- */
88
- declare enum ALPHA {
89
- A04 = "0a",
90
- A08 = "14",
91
- A32 = "52",
92
- A60 = "99",
93
- A64 = "a3",
94
- A80 = "cc"
95
- }
96
3
  /**
97
4
  * Color constants
98
5
  */
99
- export declare const alertLight = ALERT.LIGHT;
100
- export declare const alertLightest = ALERT.LIGHTEST;
101
- export declare const alertMain = ALERT.MAIN;
102
- export declare const backgroundDefault = BACKGROUND.DEFAULT;
103
- export declare const infoContrastText = INFO.CONTRAST_TEXT;
104
- export declare const infoLight = INFO.LIGHT;
105
- export declare const infoLightest = INFO.LIGHTEST;
106
- export declare const infoMain = INFO.CONTRAST_TEXT;
107
- export declare const inkLight = INK.LIGHT;
108
- export declare const inkMain = INK.MAIN;
109
- export declare const primaryDark = PRIMARY.DARK;
110
- export declare const primaryLightest = PRIMARY.LIGHTEST;
111
- export declare const primaryMain = PRIMARY.MAIN;
112
- export declare const smokeDark = SMOKE.DARK;
113
- export declare const smokeLight = SMOKE.LIGHT;
114
- export declare const smokeLightest = SMOKE.LIGHTEST;
115
- export declare const smokeMain = SMOKE.MAIN;
116
- export declare const successLight = SUCCESS.LIGHT;
117
- export declare const successLightest = SUCCESS.LIGHTEST;
118
- export declare const successMain = SUCCESS.MAIN;
119
- export declare const textPrimary = TEXT.PRIMARY;
120
- export declare const warningContrastText = WARNING.CONTRAST_TEXT;
121
- export declare const warningLight = WARNING.LIGHT;
122
- export declare const warningLightest = WARNING.LIGHTEST;
123
- export declare const warningMain = WARNING.CONTRAST_TEXT;
124
- export declare const black = BLACK.DEFAULT;
125
- export declare const white = WHITE.DEFAULT;
6
+ export declare const alertLight: string;
7
+ export declare const alertLightest: string;
8
+ export declare const alertMain: string;
9
+ export declare const backgroundDefault: string;
10
+ export declare const infoContrastText: string;
11
+ export declare const infoLight: string;
12
+ export declare const infoLightest: string;
13
+ export declare const infoMain: string;
14
+ export declare const inkLight: string;
15
+ export declare const inkMain: string;
16
+ export declare const primaryDark: string;
17
+ export declare const primaryLightest: string;
18
+ export declare const primaryMain: string;
19
+ export declare const smokeDark: string;
20
+ export declare const smokeLight: string;
21
+ export declare const smokeLightest: string;
22
+ export declare const smokeMain: string;
23
+ export declare const successLight: string;
24
+ export declare const successLightest: string;
25
+ export declare const successMain: string;
26
+ export declare const textPrimary: string;
27
+ export declare const warningContrastText: string;
28
+ export declare const warningLight: string;
29
+ export declare const warningLightest: string;
30
+ export declare const warningMain: string;
31
+ export declare const black: string;
32
+ export declare const white: string;
126
33
  /**
127
34
  * Color alpha constants
128
35
  */
129
- export declare const alpha04 = ALPHA.A04;
130
- export declare const alpha08 = ALPHA.A08;
131
- export declare const alpha32 = ALPHA.A32;
132
- export declare const alpha60 = ALPHA.A60;
133
- export declare const alpha64 = ALPHA.A64;
134
- export declare const alpha80 = ALPHA.A80;
36
+ export declare const alpha04: string;
37
+ export declare const alpha08: string;
38
+ export declare const alpha32: string;
39
+ export declare const alpha60: string;
40
+ export declare const alpha64: string;
41
+ export declare const alpha80: string;
135
42
  /**
136
43
  * Shades
137
44
  */
138
- export declare const black04 = "#0000000a";
139
- export declare const black08 = "#00000014";
45
+ export declare const black04: string;
46
+ export declare const black08: string;
140
47
  /**
141
48
  * Palette Option "Alert"
142
49
  */
@@ -177,4 +84,3 @@ export declare const text: Pick<TypeText, "primary">;
177
84
  * Palette Option "Warning"
178
85
  */
179
86
  export declare const warning: PaletteColorOptions;
180
- export {};
@@ -1,108 +1,96 @@
1
1
  /**
2
2
  * Palette "Alert"
3
3
  */
4
- var ALERT;
5
- (function (ALERT) {
6
- ALERT["LIGHT"] = "#FED3D1";
7
- ALERT["LIGHTEST"] = "#FFF4F4";
8
- ALERT["MAIN"] = "#B42318";
9
- })(ALERT || (ALERT = {}));
4
+ const ALERT = {
5
+ LIGHT: "#FED3D1",
6
+ LIGHTEST: "#FFF4F4",
7
+ MAIN: "#B42318",
8
+ };
10
9
  /**
11
10
  * Palette "Background"
12
11
  */
13
- var BACKGROUND;
14
- (function (BACKGROUND) {
15
- BACKGROUND["DEFAULT"] = "#F6F6F7";
16
- })(BACKGROUND || (BACKGROUND = {}));
12
+ const BACKGROUND = {
13
+ DEFAULT: "#F6F6F7",
14
+ };
17
15
  /**
18
16
  * Palette "Info"
19
17
  */
20
- var INFO;
21
- (function (INFO) {
22
- INFO["CONTRAST_TEXT"] = "#00729C";
23
- INFO["LIGHT"] = "#97D6EA";
24
- INFO["LIGHTEST"] = "#F2FAFC";
25
- INFO["MAIN"] = "#00729C";
26
- })(INFO || (INFO = {}));
18
+ const INFO = {
19
+ CONTRAST_TEXT: "#00729C",
20
+ LIGHT: "#97D6EA",
21
+ LIGHTEST: "#F2FAFC",
22
+ MAIN: "#00729C",
23
+ };
27
24
  /**
28
25
  * Palette "Ink"
29
26
  */
30
- var INK;
31
- (function (INK) {
32
- INK["LIGHT"] = "#637381";
33
- INK["MAIN"] = "#212B36";
34
- })(INK || (INK = {}));
27
+ const INK = {
28
+ LIGHT: "#637381",
29
+ MAIN: "#212B36",
30
+ };
35
31
  /**
36
32
  * Palette "Primary"
37
33
  */
38
- var PRIMARY;
39
- (function (PRIMARY) {
40
- PRIMARY["DARK"] = "#005EA9";
41
- PRIMARY["LIGHTEST"] = "#E6EFF6";
42
- PRIMARY["MAIN"] = "#1C7CC7";
43
- })(PRIMARY || (PRIMARY = {}));
34
+ const PRIMARY = {
35
+ DARK: "#005EA9",
36
+ LIGHTEST: "#E6EFF6",
37
+ MAIN: "#1C7CC7",
38
+ };
44
39
  /**
45
40
  * Palette "Smoke"
46
41
  */
47
- var SMOKE;
48
- (function (SMOKE) {
49
- SMOKE["DARK"] = "#C4CDD5";
50
- SMOKE["LIGHT"] = "#F6F6F7";
51
- SMOKE["LIGHTEST"] = "#FAFBFB";
52
- SMOKE["MAIN"] = "#E1E3E5";
53
- })(SMOKE || (SMOKE = {}));
42
+ const SMOKE = {
43
+ DARK: "#C4CDD5",
44
+ LIGHT: "#F6F6F7",
45
+ LIGHTEST: "#FAFBFB",
46
+ MAIN: "#E1E3E5",
47
+ };
54
48
  /**
55
49
  * Palette "Success"
56
50
  */
57
- var SUCCESS;
58
- (function (SUCCESS) {
59
- SUCCESS["LIGHT"] = "#AEE9D1";
60
- SUCCESS["LIGHTEST"] = "#F1F8F5";
61
- SUCCESS["MAIN"] = "#287555";
62
- })(SUCCESS || (SUCCESS = {}));
51
+ const SUCCESS = {
52
+ LIGHT: "#AEE9D1",
53
+ LIGHTEST: "#F1F8F5",
54
+ MAIN: "#287555",
55
+ };
63
56
  /**
64
57
  * Palette "Text"
65
58
  */
66
- var TEXT;
67
- (function (TEXT) {
68
- TEXT["PRIMARY"] = "#212B36";
69
- })(TEXT || (TEXT = {}));
59
+ const TEXT = {
60
+ PRIMARY: "#212B36",
61
+ };
70
62
  /**
71
63
  * Palette "Warning"
72
64
  */
73
- var WARNING;
74
- (function (WARNING) {
75
- WARNING["CONTRAST_TEXT"] = "#B54708";
76
- WARNING["LIGHT"] = "#FFD79D";
77
- WARNING["LIGHTEST"] = "#FFFAEB";
78
- WARNING["MAIN"] = "#B54708";
79
- })(WARNING || (WARNING = {}));
65
+ const WARNING = {
66
+ CONTRAST_TEXT: "#B54708",
67
+ LIGHT: "#FFD79D",
68
+ LIGHTEST: "#FFFAEB",
69
+ MAIN: "#B54708",
70
+ };
80
71
  /**
81
72
  * Default "Black"
82
73
  */
83
- var BLACK;
84
- (function (BLACK) {
85
- BLACK["DEFAULT"] = "#000000";
86
- })(BLACK || (BLACK = {}));
74
+ const BLACK = {
75
+ DEFAULT: "#000000",
76
+ };
87
77
  /**
88
78
  * Default "White"
89
79
  */
90
- var WHITE;
91
- (function (WHITE) {
92
- WHITE["DEFAULT"] = "#ffffff";
93
- })(WHITE || (WHITE = {}));
80
+ const WHITE = {
81
+ DEFAULT: "#ffffff",
82
+ };
94
83
  /**
95
84
  * Color alpha
96
85
  */
97
- var ALPHA;
98
- (function (ALPHA) {
99
- ALPHA["A04"] = "0a";
100
- ALPHA["A08"] = "14";
101
- ALPHA["A32"] = "52";
102
- ALPHA["A60"] = "99";
103
- ALPHA["A64"] = "a3";
104
- ALPHA["A80"] = "cc";
105
- })(ALPHA || (ALPHA = {}));
86
+ const ALPHA = {
87
+ A04: "0a",
88
+ A08: "14",
89
+ A32: "52",
90
+ A60: "99",
91
+ A64: "a3",
92
+ A80: "cc",
93
+ };
106
94
  /**
107
95
  * Color constants
108
96
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "11.0.0",
3
+ "version": "12.0.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -42,9 +42,9 @@
42
42
  "@types/react-gtm-module": "^2.0.1",
43
43
  "@types/react-window": "^1.8.5",
44
44
  "@types/uuid": "8.3.4",
45
- "@typescript-eslint/eslint-plugin": "^5.49.0",
45
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
46
46
  "eslint": "^8.33.0",
47
- "eslint-config-next": "^14.1.0",
47
+ "eslint-config-next": "^14.2.13",
48
48
  "eslint-config-prettier": "^8.6.0",
49
49
  "eslint-plugin-eslint-comments": "^3.2.0",
50
50
  "eslint-plugin-jsdoc": "^48.1.0",
@@ -53,14 +53,14 @@
53
53
  "eslint-plugin-sonarjs": "^0.18.0",
54
54
  "eslint-plugin-sort-destructure-keys": "^1.4.0",
55
55
  "eslint-plugin-storybook": "^0.8.0",
56
- "eslint-plugin-typescript-sort-keys": "^2.3.0",
56
+ "eslint-plugin-typescript-sort-keys": "^3.2.0",
57
57
  "husky": "^8.0.3",
58
58
  "jest": "^29.4.1",
59
59
  "jest-environment-jsdom": "^29.4.1",
60
60
  "prettier": "^2.8.3",
61
61
  "prettier-plugin-organize-imports": "^3.2.2",
62
62
  "storybook": "^7.6.17",
63
- "ts-jest": "^29.0.5",
63
+ "ts-jest": "^29.2.5",
64
64
  "typescript": "^5.5.4"
65
65
  },
66
66
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Stack } from "@mui/material";
3
- import { TABLET } from "../../../../../../theme/common/breakpoints";
3
+ import { mediaTabletUp } from "../../../../../../styles/common/mixins/breakpoints";
4
4
  import { CallToActionButton as CTAButton } from "../../../../../common/Button/components/CallToActionButton/callToActionButton";
5
5
 
6
6
  export const BackPageHeroHeadline = styled.div`
@@ -10,7 +10,7 @@ export const BackPageHeroHeadline = styled.div`
10
10
  grid-column: 1 / -1; // Title and breadcrumbs consume full width of available grid.
11
11
  }
12
12
 
13
- ${({ theme }) => theme.breakpoints.up(TABLET)} {
13
+ ${mediaTabletUp} {
14
14
  display: flex;
15
15
  flex: 1;
16
16
  gap: 88px;
@@ -29,7 +29,7 @@ export const CallToActionButton = styled(CTAButton)`
29
29
  align-self: center;
30
30
  justify-self: flex-start;
31
31
 
32
- ${({ theme }) => theme.breakpoints.up(TABLET)} {
32
+ ${mediaTabletUp} {
33
33
  justify-self: flex-end;
34
34
  }
35
35
  `;
@@ -17,6 +17,7 @@ import { SubTitle } from "./components/SubTitle/subTitle";
17
17
  */
18
18
 
19
19
  export interface BackPageHeroProps {
20
+ actions?: ReactNode;
20
21
  breadcrumbs?: Breadcrumb[];
21
22
  callToAction?: CallToAction;
22
23
  children?: ReactNode;
@@ -25,13 +26,15 @@ export interface BackPageHeroProps {
25
26
  }
26
27
 
27
28
  export const BackPageHero = ({
29
+ actions,
28
30
  breadcrumbs,
29
31
  callToAction,
30
32
  children,
31
33
  subTitle,
32
34
  title,
33
35
  }: BackPageHeroProps): JSX.Element => {
34
- const HeroHeadline = callToAction ? BackPageHeroHeadline : Fragment;
36
+ const HeroHeadline =
37
+ actions || callToAction ? BackPageHeroHeadline : Fragment;
35
38
  return (
36
39
  <>
37
40
  {(breadcrumbs || title) && (
@@ -41,6 +44,7 @@ export const BackPageHero = ({
41
44
  {title && <Title title={title} />}
42
45
  <SubTitle subTitle={subTitle} />
43
46
  </HeroHeader>
47
+ {actions}
44
48
  {callToAction && <CallToActionButton callToAction={callToAction} />}
45
49
  </HeroHeadline>
46
50
  )}
@@ -0,0 +1,14 @@
1
+ import styled from "@emotion/styled";
2
+ import { mediaTabletUp } from "../../../../../../../../styles/common/mixins/breakpoints";
3
+
4
+ export const BackPageHeroActions = styled.div`
5
+ align-items: center;
6
+ align-self: center;
7
+ display: flex;
8
+ gap: 16px;
9
+ justify-self: flex-start;
10
+
11
+ ${mediaTabletUp} {
12
+ justify-self: flex-end;
13
+ }
14
+ `;
@@ -0,0 +1,13 @@
1
+ import React, { ReactNode } from "react";
2
+ import { BackPageHeroActions } from "./actions.styles";
3
+
4
+ export interface ActionsProps {
5
+ children: ReactNode;
6
+ className?: string;
7
+ }
8
+
9
+ export const Actions = ({ children, className }: ActionsProps): JSX.Element => {
10
+ return (
11
+ <BackPageHeroActions className={className}>{children}</BackPageHeroActions>
12
+ );
13
+ };
@@ -19,4 +19,5 @@ export enum SELECTED_MATCH {
19
19
 
20
20
  export interface SocialMedia {
21
21
  socials: Social[];
22
+ visible?: Partial<Record<BreakpointKey, boolean>>;
22
23
  }
@@ -1,7 +1,13 @@
1
1
  import { Breakpoint } from "@mui/material";
2
+ import { UseBreakpoint } from "../../../../../hooks/useBreakpoint";
2
3
  import { isClientSideNavigation } from "../../../../Links/common/utils";
3
4
  import { NavLinkItem } from "../components/Content/components/Navigation/navigation";
4
- import { Navigation, SELECTED_MATCH, SelectedMatch } from "./entities";
5
+ import {
6
+ Navigation,
7
+ SELECTED_MATCH,
8
+ SelectedMatch,
9
+ SocialMedia,
10
+ } from "./entities";
5
11
 
6
12
  /**
7
13
  * Adds to the set of selected patterns, for the navigation link, at the current breakpoint.
@@ -141,6 +147,22 @@ function isLinkVisible(
141
147
  return navLinkItem.visible[breakpoint] !== false;
142
148
  }
143
149
 
150
+ /**
151
+ * Returns true if the social media is visible at the current breakpoint.
152
+ * @param bp - Breakpoint.
153
+ * @param socialMedia - Social media.
154
+ * @returns true.
155
+ */
156
+ export function isSocialsVisible(
157
+ bp: Pick<UseBreakpoint, "breakpoint" | "lgUp">,
158
+ socialMedia?: SocialMedia
159
+ ): boolean {
160
+ if (!socialMedia) return false;
161
+ if (!bp.breakpoint) return false;
162
+ if (!socialMedia.visible) return bp.lgUp;
163
+ return socialMedia.visible[bp.breakpoint] !== false;
164
+ }
165
+
144
166
  /**
145
167
  * Returns the navigation link with the selected matches, for the current breakpoint.
146
168
  * @param navLinkItem - Navigation link.
@@ -46,7 +46,7 @@ export const NavigationMenu = ({
46
46
  const MenuItem = isSubMenu ? StyledMenuItem : Fragment;
47
47
 
48
48
  useEffect(() => {
49
- return () => {
49
+ return (): void => {
50
50
  if (isSubMenu || !open) return;
51
51
  onDisableScrollLock();
52
52
  };
@@ -1,4 +1,5 @@
1
1
  import { useBreakpoint } from "../../../../../hooks/useBreakpoint";
2
+ import { isSocialsVisible } from "../common/utils";
2
3
  import { HeaderProps } from "../header";
3
4
 
4
5
  export interface UseHeaderVisibility {
@@ -53,7 +54,8 @@ export const useHeaderVisibility = (
53
54
  const isNavigationIn = smUp;
54
55
  const isMenuIn = hasMenu;
55
56
  const isSloganIn = hasSlogan && mdUp;
56
- const isSocialsIn = hasSocials && lgUp;
57
+ const isSocialsIn =
58
+ hasSocials && isSocialsVisible({ breakpoint, lgUp }, socialMedia);
57
59
  // Determines navigation visibility.
58
60
  const isCenterNavigationIn = isNavigationIn && hasNavItemsC;
59
61
  const isLeftNavigationIn = isNavigationIn && hasNavItemsL;
@@ -1,3 +1,4 @@
1
+ import { ButtonProps } from "@mui/material";
1
2
  import NLink from "next/link";
2
3
  import React, { ElementType } from "react";
3
4
  import {
@@ -15,6 +16,7 @@ export interface CallToAction {
15
16
 
16
17
  export interface CallToActionButtonProps {
17
18
  ButtonElType?: ElementType;
19
+ buttonProps?: Partial<ButtonProps>;
18
20
  callToAction: CallToAction;
19
21
  className?: string;
20
22
  disabled?: boolean;
@@ -22,6 +24,7 @@ export interface CallToActionButtonProps {
22
24
 
23
25
  export const CallToActionButton = ({
24
26
  ButtonElType: Button = ButtonPrimary,
27
+ buttonProps,
25
28
  callToAction,
26
29
  className,
27
30
  disabled = false,
@@ -36,6 +39,7 @@ export const CallToActionButton = ({
36
39
  href="passHref"
37
40
  rel={REL_ATTRIBUTE.NO_OPENER}
38
41
  target={target || ANCHOR_TARGET.SELF}
42
+ {...buttonProps}
39
43
  >
40
44
  {label}
41
45
  </Button>
@@ -47,6 +51,7 @@ export const CallToActionButton = ({
47
51
  href={url}
48
52
  rel={REL_ATTRIBUTE.NO_OPENER_NO_REFERRER}
49
53
  target={target || ANCHOR_TARGET.BLANK}
54
+ {...buttonProps}
50
55
  >
51
56
  {label}
52
57
  </Button>
@@ -22,7 +22,7 @@ export const Code = ({ className, code }: CodeProps): JSX.Element => {
22
22
  const copiedTimeout = setTimeout(() => {
23
23
  setCopied(false);
24
24
  }, 2000);
25
- return () => clearTimeout(copiedTimeout);
25
+ return (): void => clearTimeout(copiedTimeout);
26
26
  }
27
27
  }, [copied]);
28
28
 
@@ -27,7 +27,7 @@ export const CopyToClipboard = ({
27
27
  const tooltipTimeout = setTimeout(() => {
28
28
  setShowTooltip(false);
29
29
  }, 2000);
30
- return () => clearTimeout(tooltipTimeout);
30
+ return (): void => clearTimeout(tooltipTimeout);
31
31
  }
32
32
  }, [showTooltip]);
33
33
 
@@ -1,13 +1,19 @@
1
1
  // TODO deprecate component if possible (see MDXMarkdown)
2
+ import { Box as MBox, BoxProps as MBoxProps } from "@mui/material";
2
3
  import DOMPurify from "isomorphic-dompurify";
3
4
  import React from "react";
4
5
 
5
6
  export interface MarkdownProps {
6
7
  content: string;
8
+ sx?: MBoxProps["sx"];
7
9
  }
8
10
 
9
- export const Markdown = ({ content }: MarkdownProps): JSX.Element => {
11
+ export const Markdown = ({ content, sx }: MarkdownProps): JSX.Element => {
10
12
  return (
11
- <div dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }} />
13
+ <MBox
14
+ component="div"
15
+ dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }}
16
+ sx={{ minWidth: 0, wordBreak: "break-word", ...sx }}
17
+ />
12
18
  );
13
19
  };
@@ -54,7 +54,7 @@ export const CollapsableSection = ({
54
54
  const duration = setTimeout(() => {
55
55
  setTransitionDuration("auto");
56
56
  }, 100);
57
- return () => {
57
+ return (): void => {
58
58
  clearTimeout(duration);
59
59
  };
60
60
  } else {
@@ -31,7 +31,7 @@ export const useRequestFileManifest = (
31
31
  },
32
32
  type: FileManifestActionKind.FetchFileManifest,
33
33
  });
34
- return () => {
34
+ return (): void => {
35
35
  fileManifestDispatch({
36
36
  payload: undefined,
37
37
  type: FileManifestActionKind.ClearFileManifest,
@@ -140,7 +140,7 @@ export const useRequestFileLocation = (
140
140
 
141
141
  useEffect(() => {
142
142
  active.current = true;
143
- return () => {
143
+ return (): void => {
144
144
  active.current = false;
145
145
  };
146
146
  }, []);
@@ -42,7 +42,7 @@ export function useResizeObserver(
42
42
  const observer = observerRef.current;
43
43
  const observedEl = ref.current;
44
44
  observer.observe(observedEl);
45
- return () => {
45
+ return (): void => {
46
46
  observer.unobserve(observedEl);
47
47
  };
48
48
  }, [onResize, ref]);
@@ -26,7 +26,7 @@ export const useWindowResize = (timeout = 200): WindowSize => {
26
26
  };
27
27
  // Add resize event listener.
28
28
  window.addEventListener("resize", onResize);
29
- return () => {
29
+ return (): void => {
30
30
  // Remove resize event listener.
31
31
  window.removeEventListener("resize", onResize);
32
32
  // Clear timeout.
@@ -4,107 +4,107 @@ import { CommonColors, TypeBackground, TypeText } from "@mui/material/styles";
4
4
  /**
5
5
  * Palette "Alert"
6
6
  */
7
- enum ALERT {
8
- LIGHT = "#FED3D1",
9
- LIGHTEST = "#FFF4F4",
10
- MAIN = "#B42318",
11
- }
7
+ const ALERT = {
8
+ LIGHT: "#FED3D1",
9
+ LIGHTEST: "#FFF4F4",
10
+ MAIN: "#B42318",
11
+ };
12
12
 
13
13
  /**
14
14
  * Palette "Background"
15
15
  */
16
- enum BACKGROUND {
17
- DEFAULT = "#F6F6F7",
18
- }
16
+ const BACKGROUND = {
17
+ DEFAULT: "#F6F6F7",
18
+ };
19
19
 
20
20
  /**
21
21
  * Palette "Info"
22
22
  */
23
- enum INFO {
24
- CONTRAST_TEXT = "#00729C",
25
- LIGHT = "#97D6EA",
26
- LIGHTEST = "#F2FAFC",
27
- MAIN = "#00729C",
28
- }
23
+ const INFO = {
24
+ CONTRAST_TEXT: "#00729C",
25
+ LIGHT: "#97D6EA",
26
+ LIGHTEST: "#F2FAFC",
27
+ MAIN: "#00729C",
28
+ };
29
29
 
30
30
  /**
31
31
  * Palette "Ink"
32
32
  */
33
- enum INK {
34
- LIGHT = "#637381",
35
- MAIN = "#212B36",
36
- }
33
+ const INK = {
34
+ LIGHT: "#637381",
35
+ MAIN: "#212B36",
36
+ };
37
37
 
38
38
  /**
39
39
  * Palette "Primary"
40
40
  */
41
- enum PRIMARY {
42
- DARK = "#005EA9",
43
- LIGHTEST = "#E6EFF6",
44
- MAIN = "#1C7CC7",
45
- }
41
+ const PRIMARY = {
42
+ DARK: "#005EA9",
43
+ LIGHTEST: "#E6EFF6",
44
+ MAIN: "#1C7CC7",
45
+ };
46
46
 
47
47
  /**
48
48
  * Palette "Smoke"
49
49
  */
50
- enum SMOKE {
51
- DARK = "#C4CDD5",
52
- LIGHT = "#F6F6F7",
53
- LIGHTEST = "#FAFBFB",
54
- MAIN = "#E1E3E5",
55
- }
50
+ const SMOKE = {
51
+ DARK: "#C4CDD5",
52
+ LIGHT: "#F6F6F7",
53
+ LIGHTEST: "#FAFBFB",
54
+ MAIN: "#E1E3E5",
55
+ };
56
56
 
57
57
  /**
58
58
  * Palette "Success"
59
59
  */
60
- enum SUCCESS {
61
- LIGHT = "#AEE9D1",
62
- LIGHTEST = "#F1F8F5",
63
- MAIN = "#287555",
64
- }
60
+ const SUCCESS = {
61
+ LIGHT: "#AEE9D1",
62
+ LIGHTEST: "#F1F8F5",
63
+ MAIN: "#287555",
64
+ };
65
65
 
66
66
  /**
67
67
  * Palette "Text"
68
68
  */
69
- enum TEXT {
70
- PRIMARY = "#212B36",
71
- }
69
+ const TEXT = {
70
+ PRIMARY: "#212B36",
71
+ };
72
72
 
73
73
  /**
74
74
  * Palette "Warning"
75
75
  */
76
- enum WARNING {
77
- CONTRAST_TEXT = "#B54708",
78
- LIGHT = "#FFD79D",
79
- LIGHTEST = "#FFFAEB",
80
- MAIN = "#B54708",
81
- }
76
+ const WARNING = {
77
+ CONTRAST_TEXT: "#B54708",
78
+ LIGHT: "#FFD79D",
79
+ LIGHTEST: "#FFFAEB",
80
+ MAIN: "#B54708",
81
+ };
82
82
 
83
83
  /**
84
84
  * Default "Black"
85
85
  */
86
- enum BLACK {
87
- DEFAULT = "#000000",
88
- }
86
+ const BLACK = {
87
+ DEFAULT: "#000000",
88
+ };
89
89
 
90
90
  /**
91
91
  * Default "White"
92
92
  */
93
- enum WHITE {
94
- DEFAULT = "#ffffff",
95
- }
93
+ const WHITE = {
94
+ DEFAULT: "#ffffff",
95
+ };
96
96
 
97
97
  /**
98
98
  * Color alpha
99
99
  */
100
- enum ALPHA {
101
- A04 = "0a",
102
- A08 = "14",
103
- A32 = "52",
104
- A60 = "99",
105
- A64 = "a3",
106
- A80 = "cc",
107
- }
100
+ const ALPHA = {
101
+ A04: "0a",
102
+ A08: "14",
103
+ A32: "52",
104
+ A60: "99",
105
+ A64: "a3",
106
+ A80: "cc",
107
+ };
108
108
 
109
109
  /**
110
110
  * Color constants