@databiosphere/findable-ui 8.0.2 → 9.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 (126) hide show
  1. package/lib/components/Export/components/ExportToTerra/components/ExportToTerraReady/exportToTerraReady.js +2 -2
  2. package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.js +2 -2
  3. package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/ConnectTerraToNIHAccount/connectTerraToNIHAccount.js +2 -2
  4. package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/CreateTerraAccount/createTerraAccount.js +2 -2
  5. package/lib/components/Filter/components/Filter/filter.js +2 -3
  6. package/lib/components/Filter/components/Filter/filter.styles.d.ts +3 -0
  7. package/lib/components/Filter/components/Filter/filter.styles.js +8 -1
  8. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
  9. package/lib/components/Index/components/AzulFileDownload/azulFileDownload.js +5 -5
  10. package/lib/components/Index/components/AzulFileDownload/azulFileDownload.styles.d.ts +3 -0
  11. package/lib/components/Index/components/AzulFileDownload/azulFileDownload.styles.js +5 -0
  12. package/lib/components/Layout/components/ContentLayout/contentLayout.js +5 -3
  13. package/lib/components/Layout/components/ContentLayout/contentLayout.styles.d.ts +4 -0
  14. package/lib/components/Layout/components/ContentLayout/contentLayout.styles.js +7 -2
  15. package/lib/components/Layout/components/Footer/footer.js +1 -2
  16. package/lib/components/Layout/components/Footer/footer.styles.js +6 -1
  17. package/lib/components/Layout/components/Header/common/entities.d.ts +4 -0
  18. package/lib/components/Layout/components/Header/common/entities.js +5 -1
  19. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +1 -1
  20. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.js +9 -7
  21. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/constants.d.ts +4 -0
  22. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/constants.js +4 -0
  23. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/utils.d.ts +8 -0
  24. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/utils.js +12 -0
  25. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.js +23 -7
  26. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.js +4 -3
  27. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +1 -1
  28. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.js +2 -5
  29. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.styles.d.ts +3 -0
  30. package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.styles.js +11 -0
  31. package/lib/components/Layout/components/Header/components/Content/components/Navigation/common/utils.d.ts +15 -0
  32. package/lib/components/Layout/components/Header/components/Content/components/Navigation/common/utils.js +23 -0
  33. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationButtonLabel/navigationButtonLabel.d.ts +5 -0
  34. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationButtonLabel/navigationButtonLabel.js +5 -0
  35. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +3 -4
  36. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.styles.d.ts +3 -0
  37. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.styles.js +23 -2
  38. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.d.ts +4 -0
  39. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.js +19 -0
  40. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.d.ts +2 -1
  41. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +20 -19
  42. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.d.ts +30 -0
  43. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.js +16 -1
  44. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.js +13 -7
  45. package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.d.ts +2 -0
  46. package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.js +11 -6
  47. package/lib/components/Layout/components/Header/components/Content/components/Slogan/slogan.styles.js +3 -1
  48. package/lib/components/Layout/components/Header/header.styles.js +7 -0
  49. package/lib/components/Layout/components/Nav/nav.styles.js +6 -0
  50. package/lib/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.js +2 -3
  51. package/lib/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.styles.d.ts +3 -0
  52. package/lib/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.styles.js +8 -1
  53. package/lib/components/Layout/components/Sidebar/components/SidebarPositioner/sidebarPositioner.styles.js +1 -1
  54. package/lib/components/Layout/components/Sidebar/sidebar.styles.js +2 -1
  55. package/lib/components/Links/common/entities.d.ts +4 -0
  56. package/lib/components/Links/common/entities.js +5 -0
  57. package/lib/components/Links/common/utils.js +1 -1
  58. package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +2 -2
  59. package/lib/components/Links/components/Link/link.d.ts +1 -1
  60. package/lib/components/Links/components/Link/link.js +5 -5
  61. package/lib/components/Table/components/Pagination/pagination.js +3 -3
  62. package/lib/components/common/Button/components/CallToActionButton/callToActionButton.js +2 -2
  63. package/lib/components/common/Button/components/HelpIconButton/helpIconButton.js +3 -3
  64. package/lib/components/common/Card/components/CardActionArea/cardActionArea.js +2 -2
  65. package/lib/components/common/IconButton/iconButton.styles.d.ts +0 -15
  66. package/lib/components/common/IconButton/iconButton.styles.js +0 -82
  67. package/lib/components/common/Socials/socials.d.ts +1 -1
  68. package/lib/components/common/Socials/socials.js +4 -5
  69. package/lib/components/common/Socials/socials.styles.d.ts +1 -0
  70. package/lib/components/common/Socials/socials.styles.js +9 -0
  71. package/lib/hooks/useMenuWithPosition.d.ts +14 -0
  72. package/lib/hooks/useMenuWithPosition.js +33 -0
  73. package/lib/theme/common/components.js +59 -1
  74. package/package.json +1 -1
  75. package/src/components/Export/components/ExportToTerra/components/ExportToTerraReady/exportToTerraReady.tsx +9 -2
  76. package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.tsx +9 -2
  77. package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/ConnectTerraToNIHAccount/connectTerraToNIHAccount.tsx +5 -2
  78. package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/CreateTerraAccount/createTerraAccount.tsx +9 -2
  79. package/src/components/Filter/components/Filter/filter.styles.ts +9 -1
  80. package/src/components/Filter/components/Filter/filter.tsx +2 -3
  81. package/src/components/Index/components/AzulFileDownload/azulFileDownload.styles.ts +6 -0
  82. package/src/components/Index/components/AzulFileDownload/azulFileDownload.tsx +13 -12
  83. package/src/components/Layout/components/ContentLayout/contentLayout.styles.ts +9 -6
  84. package/src/components/Layout/components/ContentLayout/contentLayout.tsx +9 -4
  85. package/src/components/Layout/components/Footer/footer.styles.ts +6 -1
  86. package/src/components/Layout/components/Footer/footer.tsx +1 -8
  87. package/src/components/Layout/components/Header/common/entities.ts +5 -0
  88. package/src/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.tsx +23 -20
  89. package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/constants.ts +4 -0
  90. package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/utils.ts +17 -0
  91. package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.ts +7 -3
  92. package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.tsx +41 -16
  93. package/src/components/Layout/components/Header/components/Content/components/Logo/logo.styles.ts +12 -0
  94. package/src/components/Layout/components/Header/components/Content/components/Logo/logo.tsx +6 -18
  95. package/src/components/Layout/components/Header/components/Content/components/Navigation/common/utils.ts +27 -0
  96. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationButtonLabel/navigationButtonLabel.tsx +22 -0
  97. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.styles.ts +27 -2
  98. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.tsx +8 -5
  99. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.ts +23 -0
  100. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.ts +17 -1
  101. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +25 -23
  102. package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.tsx +26 -5
  103. package/src/components/Layout/components/Header/components/Content/components/Navigation/navigation.tsx +29 -6
  104. package/src/components/Layout/components/Header/components/Content/components/Slogan/slogan.styles.ts +3 -1
  105. package/src/components/Layout/components/Header/header.styles.ts +7 -0
  106. package/src/components/Layout/components/Nav/nav.styles.ts +6 -0
  107. package/src/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.styles.ts +12 -1
  108. package/src/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.tsx +2 -7
  109. package/src/components/Layout/components/Sidebar/components/SidebarPositioner/sidebarPositioner.styles.ts +1 -1
  110. package/src/components/Layout/components/Sidebar/sidebar.styles.ts +2 -1
  111. package/src/components/Links/common/entities.ts +5 -0
  112. package/src/components/Links/common/utils.ts +1 -1
  113. package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +2 -1
  114. package/src/components/Links/components/Link/link.tsx +12 -4
  115. package/src/components/Table/components/Pagination/pagination.tsx +5 -3
  116. package/src/components/common/Button/components/CallToActionButton/callToActionButton.tsx +6 -3
  117. package/src/components/common/Button/components/HelpIconButton/helpIconButton.tsx +6 -3
  118. package/src/components/common/Card/components/CardActionArea/cardActionArea.tsx +9 -2
  119. package/src/components/common/IconButton/iconButton.styles.ts +0 -88
  120. package/src/components/common/Socials/socials.styles.ts +10 -0
  121. package/src/components/common/Socials/socials.tsx +12 -10
  122. package/src/hooks/useMenuWithPosition.ts +49 -0
  123. package/src/theme/common/components.ts +59 -0
  124. package/types/data-explorer-ui.d.ts +1 -0
  125. package/src/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.tsx +0 -15
  126. package/src/components/common/IconButton/components/LoadingIconButton/loadingIconButton.tsx +0 -15
@@ -11,7 +11,10 @@ export const AppBar = styled(MAppBar)`
11
11
  }
12
12
 
13
13
  .MuiToolbar-root {
14
+ display: grid;
14
15
  gap: 16px;
16
+ grid-template-areas: "left center right";
17
+ grid-template-columns: 1fr auto 1fr;
15
18
  height: ${HEADER_HEIGHT}px;
16
19
  min-height: unset;
17
20
  }
@@ -26,6 +29,7 @@ const group = css`
26
29
  export const Left = styled.div`
27
30
  ${group};
28
31
  gap: 16px;
32
+ grid-area: left;
29
33
  justify-content: flex-start;
30
34
 
31
35
  .MuiButton-navPrimary {
@@ -37,10 +41,13 @@ export const Left = styled.div`
37
41
 
38
42
  export const Center = styled.div`
39
43
  ${group};
44
+ grid-area: center;
40
45
  justify-content: center;
41
46
  `;
42
47
 
43
48
  export const Right = styled.div`
44
49
  ${group};
50
+ gap: 8px;
51
+ grid-area: right;
45
52
  justify-content: flex-end;
46
53
  `;
@@ -51,5 +51,11 @@ export const List = styled(MList)`
51
51
  }
52
52
  }
53
53
  }
54
+
55
+ &:first-of-type {
56
+ .MuiListItemButton-root.Mui-disabled {
57
+ margin-top: 0;
58
+ }
59
+ }
54
60
  }
55
61
  `;
@@ -1,7 +1,11 @@
1
1
  import styled from "@emotion/styled";
2
2
  import { Popover as MPopover } from "@mui/material";
3
3
  import { mediaDesktopSmallDown } from "../../../../../../styles/common/mixins/breakpoints";
4
- import { smokeLight } from "../../../../../../styles/common/mixins/colors";
4
+ import {
5
+ smokeLight,
6
+ white,
7
+ } from "../../../../../../styles/common/mixins/colors";
8
+ import { IconButton as DXIconButton } from "../../../../../common/IconButton/iconButton";
5
9
 
6
10
  export const TemporarySidebar = styled(MPopover)`
7
11
  &.MuiPopover-root {
@@ -17,3 +21,10 @@ export const TemporarySidebar = styled(MPopover)`
17
21
  }
18
22
  }
19
23
  `;
24
+
25
+ export const IconButton = styled(DXIconButton)`
26
+ color: ${white};
27
+ left: calc(100% + 4px);
28
+ position: absolute;
29
+ top: 4px;
30
+ `;
@@ -1,9 +1,8 @@
1
1
  import { CloseRounded } from "@mui/icons-material";
2
2
  import { PopoverPosition, PopoverProps } from "@mui/material";
3
3
  import React, { ReactNode } from "react";
4
- import { CloseDrawerIconButton } from "../../../../../common/IconButton/iconButton.styles";
5
4
  import { DrawerTransition } from "../../../../../Filter/components/Filter/components/DrawerTransition/drawerTransition";
6
- import { TemporarySidebar } from "./sidebarDrawer.styles";
5
+ import { IconButton, TemporarySidebar } from "./sidebarDrawer.styles";
7
6
 
8
7
  const DEFAULT_POSITION: PopoverPosition = { left: 0, top: 0 };
9
8
  const DRAWER_SLOT_PROPS: PopoverProps["slotProps"] = {
@@ -34,11 +33,7 @@ export const SidebarDrawer = ({
34
33
  TransitionComponent={DrawerTransition}
35
34
  transitionDuration={drawerOpen ? 250 : 300}
36
35
  >
37
- <CloseDrawerIconButton
38
- Icon={CloseRounded}
39
- onClick={onDrawerClose}
40
- size="medium"
41
- />
36
+ <IconButton Icon={CloseRounded} onClick={onDrawerClose} size="medium" />
42
37
  {children}
43
38
  </TemporarySidebar>
44
39
  );
@@ -11,7 +11,7 @@ export const SidebarPositioner = styled("div")<Props>`
11
11
  padding: 16px 0;
12
12
 
13
13
  ${mediaDesktopSmallUp} {
14
- height: ${({ headerHeight }) => `calc(100vh - ${headerHeight}px)`};
14
+ max-height: 100vh;
15
15
  overflow: auto;
16
16
  padding: ${({ headerHeight }) => headerHeight}px 0 0;
17
17
  position: sticky;
@@ -1,8 +1,9 @@
1
1
  import styled from "@emotion/styled";
2
+ import { smokeMain } from "../../../../styles/common/mixins/colors";
2
3
 
3
4
  export const Sidebar = styled.div`
4
5
  align-self: stretch;
5
- border-right: 1px solid ${({ theme }) => theme.palette.smoke.main};
6
+ border-right: 1px solid ${smokeMain};
6
7
  box-sizing: content-box;
7
8
  width: 264px;
8
9
  `;
@@ -5,6 +5,11 @@ export enum ANCHOR_TARGET {
5
5
  SELF = "_self",
6
6
  }
7
7
 
8
+ export enum REL_ATTRIBUTE {
9
+ NO_OPENER = "noopener",
10
+ NO_OPENER_NO_REFERRER = "noopener noreferrer",
11
+ }
12
+
8
13
  export type StrictUrlObject = Omit<UrlObject, "href" | "query"> & {
9
14
  href: string;
10
15
  query: string;
@@ -7,7 +7,7 @@ import { Url, UrlObjectWithHrefAndQuery } from "./entities";
7
7
  * @returns true if the given link is an internal link.
8
8
  */
9
9
  export function isClientSideNavigation(link: string): boolean {
10
- return /^\/(?!\/)/.test(link);
10
+ return /^\/(?!\/)|^#/.test(link);
11
11
  }
12
12
 
13
13
  /**
@@ -10,6 +10,7 @@ import {
10
10
  } from "../../../../../../providers/exploreState";
11
11
  import {
12
12
  ANCHOR_TARGET,
13
+ REL_ATTRIBUTE,
13
14
  UrlObjectWithHrefAndQuery,
14
15
  } from "../../../../common/entities";
15
16
  import { LinkProps } from "../../link";
@@ -51,7 +52,7 @@ export const ExploreViewLink = ({
51
52
  className={className}
52
53
  href={url.href}
53
54
  onClick={onNavigate}
54
- rel="noopener"
55
+ rel={REL_ATTRIBUTE.NO_OPENER}
55
56
  target={target}
56
57
  >
57
58
  {label}
@@ -8,7 +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 { ANCHOR_TARGET, Url } from "../../common/entities";
11
+ import { ANCHOR_TARGET, REL_ATTRIBUTE, Url } from "../../common/entities";
12
12
  import {
13
13
  isClientSideNavigation,
14
14
  isURLObjectWithHrefAndQuery,
@@ -36,6 +36,7 @@ export const Link = ({
36
36
  target,
37
37
  TypographyProps,
38
38
  url,
39
+ ...props /* Spread props to allow for specific MuiLink prop overrides. */
39
40
  }: LinkProps): JSX.Element => {
40
41
  if (isURLObjectWithHrefAndQuery(url)) {
41
42
  /* Internal navigation - explore link */
@@ -57,11 +58,12 @@ export const Link = ({
57
58
  <NLink href={url} legacyBehavior passHref>
58
59
  <MLink
59
60
  className={className}
60
- rel="noopener"
61
+ rel={REL_ATTRIBUTE.NO_OPENER}
61
62
  noWrap={noWrap}
62
63
  target={target || ANCHOR_TARGET.SELF}
63
64
  onClick={onClick}
64
65
  {...TypographyProps}
66
+ {...props}
65
67
  >
66
68
  {label}
67
69
  </MLink>
@@ -79,9 +81,10 @@ export const Link = ({
79
81
  href={url}
80
82
  noWrap={noWrap}
81
83
  onClick={onClick}
82
- rel="noopener noreferrer"
84
+ rel={REL_ATTRIBUTE.NO_OPENER_NO_REFERRER}
83
85
  target={target || ANCHOR_TARGET.BLANK}
84
86
  {...TypographyProps}
87
+ {...props}
85
88
  >
86
89
  {label}
87
90
  </MLink>
@@ -92,7 +95,12 @@ export const Link = ({
92
95
  }
93
96
  /* Invalid URL */
94
97
  return (
95
- <MTypography component="span" variant="inherit" {...TypographyProps}>
98
+ <MTypography
99
+ component="span"
100
+ variant="inherit"
101
+ {...TypographyProps}
102
+ {...props}
103
+ >
96
104
  {label}
97
105
  </MTypography>
98
106
  );
@@ -2,7 +2,7 @@ import EastRoundedIcon from "@mui/icons-material/EastRounded";
2
2
  import WestRoundedIcon from "@mui/icons-material/WestRounded";
3
3
  import { Typography } from "@mui/material";
4
4
  import React from "react";
5
- import { IconButtonSecondary } from "../../../common/IconButton/iconButton.styles";
5
+ import { IconButton } from "../../../common/IconButton/iconButton";
6
6
  import { Stack } from "../../../common/Stack/stack";
7
7
  import { Pagination as TablePagination } from "./pagination.styles";
8
8
 
@@ -32,12 +32,14 @@ export const Pagination = ({
32
32
  </Typography>
33
33
  </div>
34
34
  <Stack direction="row" gap={2}>
35
- <IconButtonSecondary
35
+ <IconButton
36
+ color="secondary"
36
37
  disabled={!canPreviousPage}
37
38
  Icon={WestRoundedIcon}
38
39
  onClick={onPreviousPage}
39
40
  />
40
- <IconButtonSecondary
41
+ <IconButton
42
+ color="secondary"
41
43
  disabled={!canNextPage}
42
44
  Icon={EastRoundedIcon}
43
45
  onClick={onNextPage}
@@ -1,6 +1,9 @@
1
1
  import NLink from "next/link";
2
2
  import React, { ElementType } from "react";
3
- import { ANCHOR_TARGET } from "../../../../Links/common/entities";
3
+ import {
4
+ ANCHOR_TARGET,
5
+ REL_ATTRIBUTE,
6
+ } from "../../../../Links/common/entities";
4
7
  import { isClientSideNavigation } from "../../../../Links/common/utils";
5
8
  import { ButtonPrimary } from "../ButtonPrimary/buttonPrimary";
6
9
 
@@ -31,7 +34,7 @@ export const CallToActionButton = ({
31
34
  className={className}
32
35
  disabled={disabled}
33
36
  href="passHref"
34
- rel="noopener"
37
+ rel={REL_ATTRIBUTE.NO_OPENER}
35
38
  target={target || ANCHOR_TARGET.SELF}
36
39
  >
37
40
  {label}
@@ -42,7 +45,7 @@ export const CallToActionButton = ({
42
45
  className={className}
43
46
  disabled={disabled}
44
47
  href={url}
45
- rel="noopener noreferrer"
48
+ rel={REL_ATTRIBUTE.NO_OPENER_NO_REFERRER}
46
49
  target={target || ANCHOR_TARGET.BLANK}
47
50
  >
48
51
  {label}
@@ -1,7 +1,10 @@
1
1
  import { SvgIconProps } from "@mui/material";
2
2
  import Link from "next/link";
3
3
  import React from "react";
4
- import { ANCHOR_TARGET } from "../../../../Links/common/entities";
4
+ import {
5
+ ANCHOR_TARGET,
6
+ REL_ATTRIBUTE,
7
+ } from "../../../../Links/common/entities";
5
8
  import { isClientSideNavigation } from "../../../../Links/common/utils";
6
9
  import { HelpIcon } from "../../../CustomIcon/components/HelpIcon/helpIcon";
7
10
  import { HelpIconButton as Button } from "./helpIconButton.styles";
@@ -22,7 +25,7 @@ export const HelpIconButton = ({
22
25
  <Link href={url} legacyBehavior passHref>
23
26
  <Button
24
27
  href="passHref"
25
- rel="noopener"
28
+ rel={REL_ATTRIBUTE.NO_OPENER}
26
29
  target={target || ANCHOR_TARGET.SELF}
27
30
  >
28
31
  <HelpIcon fontSize={size} />
@@ -31,7 +34,7 @@ export const HelpIconButton = ({
31
34
  ) : (
32
35
  <Button
33
36
  href={url}
34
- rel="noopener noreferrer"
37
+ rel={REL_ATTRIBUTE.NO_OPENER_NO_REFERRER}
35
38
  target={target || ANCHOR_TARGET.BLANK}
36
39
  >
37
40
  <HelpIcon fontSize={size} />
@@ -1,7 +1,10 @@
1
1
  import { CardActionArea as MCardActionArea } from "@mui/material";
2
2
  import { useRouter } from "next/router";
3
3
  import React, { ReactNode } from "react";
4
- import { ANCHOR_TARGET } from "../../../../Links/common/entities";
4
+ import {
5
+ ANCHOR_TARGET,
6
+ REL_ATTRIBUTE,
7
+ } from "../../../../Links/common/entities";
5
8
  import { isClientSideNavigation } from "../../../../Links/common/utils";
6
9
 
7
10
  export interface CardActionAreaProps {
@@ -22,7 +25,11 @@ export const CardActionArea = ({
22
25
  if (isClientSideNavigation(url)) {
23
26
  push(url);
24
27
  } else {
25
- window.open(url, ANCHOR_TARGET.BLANK, "noopener noreferrer");
28
+ window.open(
29
+ url,
30
+ ANCHOR_TARGET.BLANK,
31
+ REL_ATTRIBUTE.NO_OPENER_NO_REFERRER
32
+ );
26
33
  }
27
34
  }
28
35
  };
@@ -2,7 +2,6 @@ import { css } from "@emotion/react";
2
2
  import styled from "@emotion/styled";
3
3
  import { IconButton as MIconButton } from "@mui/material";
4
4
  import { smokeLightest } from "../../../styles/common/mixins/colors";
5
- import { IconButton } from "./iconButton";
6
5
 
7
6
  interface Props {
8
7
  open: boolean;
@@ -19,90 +18,3 @@ export const Button = styled(MIconButton, {
19
18
  }
20
19
  `}
21
20
  `;
22
-
23
- // Primary icon button.
24
- export const IconButtonPrimary = styled(IconButton)`
25
- background-color: ${({ theme }) => theme.palette.primary.main};
26
- box-shadow: 0 1px 0 0 ${({ theme }) => theme.palette.primary.dark};
27
- color: ${({ theme }) => theme.palette.common.white};
28
-
29
- // Medium sized primary icon button.
30
- &.MuiIconButton-sizeMedium {
31
- padding: 6px 8px; // Overrides medium sized button theme top and bottom padding.
32
- }
33
-
34
- &:active,
35
- &:hover {
36
- background-color: ${({ theme }) => theme.palette.primary.dark};
37
- }
38
-
39
- &:active {
40
- box-shadow: none;
41
- }
42
-
43
- &.Mui-disabled {
44
- background-color: ${({ theme }) => theme.palette.primary.main};
45
- color: ${({ theme }) => theme.palette.common.white};
46
- opacity: 0.5;
47
- }
48
- `;
49
-
50
- // Secondary icon button.
51
- export const IconButtonSecondary = styled(IconButton)`
52
- background-color: ${({ theme }) => theme.palette.common.white};
53
- box-shadow: inset 0 0 0 1px ${({ theme }) => theme.palette.smoke.dark},
54
- 0px 1px 0px 0px rgba(0, 0, 0, 0.08);
55
- color: ${({ theme }) => theme.palette.ink.main};
56
-
57
- &:active, &:hover {
58
- background-color: ${({ theme }) => theme.palette.smoke.lightest};
59
- }
60
-
61
- &:active {
62
- box-shadow: inset 0 0 0 1px ${({ theme }) => theme.palette.smoke.dark};
63
- }
64
-
65
- &:disabled {
66
- color: inherit;
67
- opacity: 0.5;
68
- }
69
- }
70
- `;
71
-
72
- // Mock icon button.
73
- export const MockIconButtonPrimary = styled.span`
74
- background-color: ${({ theme }) => theme.palette.primary.main};
75
- border-radius: 4px;
76
- box-shadow: 0 1px 0 0 ${({ theme }) => theme.palette.primary.dark};
77
- color: ${({ theme }) => theme.palette.common.white};
78
- display: flex;
79
- flex: none;
80
- height: 32px;
81
- padding: 6px 8px;
82
- `;
83
-
84
- // Drawer backdrop close icon button.
85
- export const CloseDrawerIconButton = styled(IconButton)`
86
- color: ${({ theme }) => theme.palette.common.white};
87
- left: calc(100% + 4px);
88
- position: absolute;
89
- top: 4px;
90
- `;
91
-
92
- // Socials icon button.
93
- export const IconButtonSocials = styled(MIconButton)`
94
- color: ${({ theme }) => theme.palette.ink.light};
95
-
96
- &:hover {
97
- background-color: ${({ theme }) => theme.palette.smoke.light};
98
- }
99
- ` as typeof MIconButton;
100
-
101
- // Socials icon button - footer component.
102
- export const IconButtonSocialsFooter = styled(MIconButton)`
103
- color: ${({ theme }) => theme.palette.ink.light};
104
-
105
- &:hover {
106
- background-color: ${({ theme }) => theme.palette.smoke.main};
107
- }
108
- ` as typeof MIconButton;
@@ -1,5 +1,15 @@
1
1
  import styled from "@emotion/styled";
2
+ import { IconButton as MIconButton } from "@mui/material";
3
+ import { inkLight, smokeLight } from "../../../styles/common/mixins/colors";
2
4
 
3
5
  export const Socials = styled.div`
4
6
  display: flex;
5
7
  `;
8
+
9
+ export const IconButton = styled(MIconButton)`
10
+ color: ${inkLight};
11
+
12
+ &:hover {
13
+ background-color: ${smokeLight};
14
+ }
15
+ ` as typeof MIconButton;
@@ -5,9 +5,11 @@ import React, {
5
5
  forwardRef,
6
6
  ReactNode,
7
7
  } from "react";
8
- import { ANCHOR_TARGET } from "../../Links/common/entities";
9
- import { IconButtonSocials } from "../IconButton/iconButton.styles";
10
- import { Socials as IconButtons } from "./socials.styles";
8
+ import { ANCHOR_TARGET, REL_ATTRIBUTE } from "../../Links/common/entities";
9
+ import {
10
+ IconButton as StyledIconButton,
11
+ Socials as StyledSocials,
12
+ } from "./socials.styles";
11
13
 
12
14
  export interface Social {
13
15
  Icon: ElementType;
@@ -18,7 +20,7 @@ export interface Social {
18
20
  export interface SocialsProps {
19
21
  buttonSize?: MIconButtonProps["size"];
20
22
  className?: string;
21
- IconButtonElType?: ElementType;
23
+ IconButton?: ElementType;
22
24
  socials: Social[];
23
25
  style?: CSSProperties; // Required for Fade component. See https://mui.com/material-ui/transitions/#child-requirement.
24
26
  }
@@ -28,26 +30,26 @@ export const Socials = forwardRef<HTMLDivElement, SocialsProps>(
28
30
  {
29
31
  buttonSize = "medium",
30
32
  className,
31
- IconButtonElType = IconButtonSocials,
33
+ IconButton = StyledIconButton,
32
34
  socials,
33
35
  style,
34
36
  }: SocialsProps,
35
37
  ref
36
38
  ): JSX.Element {
37
39
  return (
38
- <IconButtons className={className} ref={ref} style={style}>
40
+ <StyledSocials className={className} ref={ref} style={style}>
39
41
  {socials.map(({ Icon, url }, i) => (
40
- <IconButtonElType
42
+ <IconButton
41
43
  key={i}
42
44
  href={url}
43
- rel="noopener noreferrer"
45
+ rel={REL_ATTRIBUTE.NO_OPENER_NO_REFERRER}
44
46
  size={buttonSize}
45
47
  target={ANCHOR_TARGET.BLANK}
46
48
  >
47
49
  <Icon fontSize="small" />
48
- </IconButtonElType>
50
+ </IconButton>
49
51
  ))}
50
- </IconButtons>
52
+ </StyledSocials>
51
53
  );
52
54
  }
53
55
  );
@@ -0,0 +1,49 @@
1
+ import { MenuProps as MMenuProps } from "@mui/material";
2
+ import { MouseEvent, useCallback, useMemo, useState } from "react";
3
+
4
+ export interface UseMenuWithPosition {
5
+ anchorEl: MMenuProps["anchorEl"];
6
+ onClose: () => void;
7
+ onOpen: (event: MouseEvent<HTMLElement>) => void;
8
+ onToggleOpen: (event: MouseEvent<HTMLElement>) => void;
9
+ open: boolean;
10
+ }
11
+
12
+ /**
13
+ * Menu functionality for menu dropdown, with menu position.
14
+ * @returns menu functionality.
15
+ */
16
+ export const useMenuWithPosition = (): UseMenuWithPosition => {
17
+ const [anchorEl, setAnchorEl] = useState<MMenuProps["anchorEl"]>(null);
18
+ const open = useMemo(() => Boolean(anchorEl), [anchorEl]);
19
+
20
+ // Closes header menu.
21
+ const onClose = useCallback((): void => {
22
+ setAnchorEl(null);
23
+ }, []);
24
+
25
+ // Opens header menu.
26
+ const onOpen = useCallback((event: MouseEvent<HTMLElement>): void => {
27
+ setAnchorEl(event.currentTarget);
28
+ }, []);
29
+
30
+ // Toggles menu open/close.
31
+ const onToggleOpen = useCallback(
32
+ (event: MouseEvent<HTMLElement>): void => {
33
+ if (open) {
34
+ setAnchorEl(null);
35
+ } else {
36
+ setAnchorEl(event.currentTarget);
37
+ }
38
+ },
39
+ [open]
40
+ );
41
+
42
+ return {
43
+ anchorEl,
44
+ onClose,
45
+ onOpen,
46
+ onToggleOpen,
47
+ open,
48
+ };
49
+ };
@@ -23,6 +23,7 @@ import {
23
23
  TEXT_BODY_SMALL_400,
24
24
  TEXT_BODY_SMALL_500,
25
25
  TEXT_HEADING,
26
+ TEXT_HEADING_SMALL,
26
27
  } from "./typography";
27
28
 
28
29
  // Constants
@@ -427,6 +428,22 @@ export const MuiButton = (theme: Theme): Components["MuiButton"] => {
427
428
  },
428
429
  },
429
430
  },
431
+ {
432
+ props: {
433
+ variant: "backNav", // associated with "nav" variant.
434
+ },
435
+ style: {
436
+ ...theme.typography[TEXT_HEADING_SMALL],
437
+ color: theme.palette.ink.main,
438
+ minWidth: 0,
439
+ textTransform: "capitalize",
440
+ whiteSpace: "nowrap",
441
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
442
+ "&:hover": {
443
+ backgroundColor: theme.palette.smoke.light,
444
+ },
445
+ },
446
+ },
430
447
  {
431
448
  props: {
432
449
  variant: "nav",
@@ -874,12 +891,54 @@ export const MuiIconButton = (theme: Theme): Components["MuiIconButton"] => {
874
891
  disableRipple: true,
875
892
  },
876
893
  styleOverrides: {
894
+ colorPrimary: {
895
+ backgroundColor: theme.palette.primary.main,
896
+ boxShadow: `0 1px 0 0 ${theme.palette.primary.dark}`,
897
+ color: theme.palette.common.white,
898
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
899
+ "&.Mui-disabled": {
900
+ backgroundColor: theme.palette.primary.main,
901
+ color: theme.palette.common.white,
902
+ opacity: 0.5,
903
+ },
904
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
905
+ "&:hover": {
906
+ backgroundColor: theme.palette.primary.dark,
907
+ },
908
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
909
+ "&:active": {
910
+ backgroundColor: theme.palette.primary.dark,
911
+ boxShadow: "none",
912
+ },
913
+ },
914
+ colorSecondary: {
915
+ backgroundColor: theme.palette.common.white,
916
+ boxShadow: `inset 0 0 0 1px ${theme.palette.smoke.dark}, 0 1px 0 0 ${black08}`,
917
+ color: theme.palette.ink.main,
918
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
919
+ "&.Mui-disabled": {
920
+ color: "inherit",
921
+ opacity: 0.5,
922
+ },
923
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
924
+ "&:hover": {
925
+ backgroundColor: theme.palette.smoke.lightest,
926
+ },
927
+ // eslint-disable-next-line sort-keys -- disabling key order for readability
928
+ "&:active": {
929
+ backgroundColor: theme.palette.smoke.lightest,
930
+ boxShadow: `inset 0 0 0 1px ${theme.palette.smoke.dark}`,
931
+ },
932
+ },
877
933
  root: {
878
934
  borderRadius: 4,
879
935
  },
880
936
  sizeLarge: {
881
937
  padding: 10,
882
938
  },
939
+ sizeMedium: {
940
+ padding: "6px 8px",
941
+ },
883
942
  sizeSmall: {
884
943
  padding: 6,
885
944
  },
@@ -60,6 +60,7 @@ declare module "@mui/material/styles" {
60
60
  declare module "@mui/material/Button" {
61
61
  interface ButtonPropsVariantOverrides {
62
62
  activeNav: true;
63
+ backNav: true;
63
64
  nav: true;
64
65
  }
65
66
  }
@@ -1,15 +0,0 @@
1
- import { ComponentMeta, ComponentStory } from "@storybook/react";
2
- import React from "react";
3
- import { LoadingIconButton } from "./loadingIconButton";
4
-
5
- export default {
6
- component: LoadingIconButton,
7
- title: "Components/Common/IconButton/Download",
8
- } as ComponentMeta<typeof LoadingIconButton>;
9
-
10
- const LoadingIconButtonTemplate: ComponentStory<
11
- typeof LoadingIconButton
12
- > = () => <LoadingIconButton />;
13
-
14
- export const LoadingIconButtonStory = LoadingIconButtonTemplate.bind({});
15
- LoadingIconButtonStory.args = {};
@@ -1,15 +0,0 @@
1
- import React from "react";
2
- import { LoadingIcon } from "../../../CustomIcon/components/LoadingIcon/loadingIcon";
3
- import { MockIconButtonPrimary } from "../../iconButton.styles";
4
-
5
- /**
6
- * Mock "loading" icon button - a placeholder element styled like a primary icon button without the use of a button element.
7
- */
8
-
9
- export const LoadingIconButton = (): JSX.Element => {
10
- return (
11
- <MockIconButtonPrimary>
12
- <LoadingIcon fontSize="small" />
13
- </MockIconButtonPrimary>
14
- );
15
- };