@databiosphere/findable-ui 8.0.3 → 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.
- package/lib/components/Export/components/ExportToTerra/components/ExportToTerraReady/exportToTerraReady.js +2 -2
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.js +2 -2
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/ConnectTerraToNIHAccount/connectTerraToNIHAccount.js +2 -2
- package/lib/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/CreateTerraAccount/createTerraAccount.js +2 -2
- package/lib/components/Filter/components/Filter/filter.js +2 -3
- package/lib/components/Filter/components/Filter/filter.styles.d.ts +3 -0
- package/lib/components/Filter/components/Filter/filter.styles.js +8 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +1 -1
- package/lib/components/Index/components/AzulFileDownload/azulFileDownload.js +5 -5
- package/lib/components/Index/components/AzulFileDownload/azulFileDownload.styles.d.ts +3 -0
- package/lib/components/Index/components/AzulFileDownload/azulFileDownload.styles.js +5 -0
- package/lib/components/Layout/components/ContentLayout/contentLayout.js +5 -3
- package/lib/components/Layout/components/ContentLayout/contentLayout.styles.d.ts +4 -0
- package/lib/components/Layout/components/ContentLayout/contentLayout.styles.js +7 -2
- package/lib/components/Layout/components/Footer/footer.js +1 -2
- package/lib/components/Layout/components/Footer/footer.styles.js +6 -1
- package/lib/components/Layout/components/Header/common/entities.d.ts +4 -0
- package/lib/components/Layout/components/Header/common/entities.js +5 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/RequestAuthentication/requestAuthentication.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/constants.d.ts +4 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/constants.js +4 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/utils.d.ts +8 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/utils.js +12 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.js +23 -7
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.js +4 -3
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchButton/searchButton.styles.d.ts +1 -1
- package/lib/components/Layout/components/Header/components/Content/components/Logo/logo.styles.js +1 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/common/utils.d.ts +9 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/common/utils.js +13 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationButtonLabel/navigationButtonLabel.d.ts +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationButtonLabel/navigationButtonLabel.js +5 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +3 -4
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.styles.d.ts +3 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.styles.js +23 -2
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.d.ts +4 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.js +19 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.d.ts +2 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +20 -19
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.d.ts +30 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.js +16 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.js +12 -7
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.d.ts +2 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.js +9 -7
- package/lib/components/Layout/components/Header/header.styles.js +1 -0
- package/lib/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.js +2 -3
- package/lib/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.styles.d.ts +3 -0
- package/lib/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.styles.js +8 -1
- package/lib/components/Layout/components/Sidebar/components/SidebarPositioner/sidebarPositioner.styles.js +1 -1
- package/lib/components/Layout/components/Sidebar/sidebar.styles.js +2 -1
- package/lib/components/Links/common/entities.d.ts +4 -0
- package/lib/components/Links/common/entities.js +5 -0
- package/lib/components/Links/common/utils.js +1 -1
- package/lib/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.js +2 -2
- package/lib/components/Links/components/Link/link.d.ts +1 -1
- package/lib/components/Links/components/Link/link.js +5 -5
- package/lib/components/Table/components/Pagination/pagination.js +3 -3
- package/lib/components/common/Button/components/CallToActionButton/callToActionButton.js +2 -2
- package/lib/components/common/Button/components/HelpIconButton/helpIconButton.js +3 -3
- package/lib/components/common/Card/components/CardActionArea/cardActionArea.js +2 -2
- package/lib/components/common/IconButton/iconButton.styles.d.ts +0 -15
- package/lib/components/common/IconButton/iconButton.styles.js +0 -82
- package/lib/components/common/Socials/socials.d.ts +1 -1
- package/lib/components/common/Socials/socials.js +4 -5
- package/lib/components/common/Socials/socials.styles.d.ts +1 -0
- package/lib/components/common/Socials/socials.styles.js +9 -0
- package/lib/hooks/useMenuWithPosition.d.ts +14 -0
- package/lib/hooks/useMenuWithPosition.js +33 -0
- package/lib/theme/common/components.js +59 -1
- package/package.json +1 -1
- package/src/components/Export/components/ExportToTerra/components/ExportToTerraReady/exportToTerraReady.tsx +9 -2
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/AcceptTerraTOS/acceptTerraTOS.tsx +9 -2
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/ConnectTerraToNIHAccount/connectTerraToNIHAccount.tsx +5 -2
- package/src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/FormStep/components/CreateTerraAccount/createTerraAccount.tsx +9 -2
- package/src/components/Filter/components/Filter/filter.styles.ts +9 -1
- package/src/components/Filter/components/Filter/filter.tsx +2 -3
- package/src/components/Index/components/AzulFileDownload/azulFileDownload.styles.ts +6 -0
- package/src/components/Index/components/AzulFileDownload/azulFileDownload.tsx +13 -12
- package/src/components/Layout/components/ContentLayout/contentLayout.styles.ts +9 -6
- package/src/components/Layout/components/ContentLayout/contentLayout.tsx +9 -4
- package/src/components/Layout/components/Footer/footer.styles.ts +6 -1
- package/src/components/Layout/components/Footer/footer.tsx +1 -8
- package/src/components/Layout/components/Header/common/entities.ts +5 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/constants.ts +4 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/common/utils.ts +17 -0
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.styles.ts +7 -3
- package/src/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/SearchBar/searchBar.tsx +41 -16
- package/src/components/Layout/components/Header/components/Content/components/Logo/logo.styles.ts +1 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/common/utils.ts +15 -1
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationButtonLabel/navigationButtonLabel.tsx +22 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.styles.ts +27 -2
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.tsx +8 -5
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.ts +23 -0
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.ts +17 -1
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.tsx +25 -23
- package/src/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.tsx +25 -5
- package/src/components/Layout/components/Header/components/Content/components/Navigation/navigation.tsx +24 -6
- package/src/components/Layout/components/Header/header.styles.ts +1 -0
- package/src/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.styles.ts +12 -1
- package/src/components/Layout/components/Sidebar/components/SidebarDrawer/sidebarDrawer.tsx +2 -7
- package/src/components/Layout/components/Sidebar/components/SidebarPositioner/sidebarPositioner.styles.ts +1 -1
- package/src/components/Layout/components/Sidebar/sidebar.styles.ts +2 -1
- package/src/components/Links/common/entities.ts +5 -0
- package/src/components/Links/common/utils.ts +1 -1
- package/src/components/Links/components/Link/components/ExploreViewLink/exploreViewLink.tsx +2 -1
- package/src/components/Links/components/Link/link.tsx +12 -4
- package/src/components/Table/components/Pagination/pagination.tsx +5 -3
- package/src/components/common/Button/components/CallToActionButton/callToActionButton.tsx +6 -3
- package/src/components/common/Button/components/HelpIconButton/helpIconButton.tsx +6 -3
- package/src/components/common/Card/components/CardActionArea/cardActionArea.tsx +9 -2
- package/src/components/common/IconButton/iconButton.styles.ts +0 -88
- package/src/components/common/Socials/socials.styles.ts +10 -0
- package/src/components/common/Socials/socials.tsx +12 -10
- package/src/hooks/useMenuWithPosition.ts +49 -0
- package/src/theme/common/components.ts +59 -0
- package/types/data-explorer-ui.d.ts +1 -0
- package/src/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.tsx +0 -15
- package/src/components/common/IconButton/components/LoadingIconButton/loadingIconButton.tsx +0 -15
|
@@ -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 {
|
|
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=
|
|
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=
|
|
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 {
|
|
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(
|
|
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 {
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
|
|
33
|
+
IconButton = StyledIconButton,
|
|
32
34
|
socials,
|
|
33
35
|
style,
|
|
34
36
|
}: SocialsProps,
|
|
35
37
|
ref
|
|
36
38
|
): JSX.Element {
|
|
37
39
|
return (
|
|
38
|
-
<
|
|
40
|
+
<StyledSocials className={className} ref={ref} style={style}>
|
|
39
41
|
{socials.map(({ Icon, url }, i) => (
|
|
40
|
-
<
|
|
42
|
+
<IconButton
|
|
41
43
|
key={i}
|
|
42
44
|
href={url}
|
|
43
|
-
rel=
|
|
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
|
-
</
|
|
50
|
+
</IconButton>
|
|
49
51
|
))}
|
|
50
|
-
</
|
|
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
|
},
|
package/src/components/common/IconButton/components/LoadingIconButton/loadingIconButton.stories.tsx
DELETED
|
@@ -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
|
-
};
|