@databiosphere/findable-ui 10.1.0 → 10.2.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/Filter/components/Filter/filter.js +1 -1
- package/lib/components/Filter/components/Filter/filter.styles.js +2 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.d.ts +2 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.js +2 -2
- package/lib/components/Filter/components/FilterLabel/filterLabel.stories.js +2 -0
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +5 -1
- package/lib/components/Filter/components/FilterLabel/filterLabel.styles.js +20 -5
- package/lib/components/Filter/components/FilterTags/filterTags.styles.js +2 -7
- package/lib/components/Filter/components/Filters/filters.js +2 -11
- package/lib/components/Filter/components/Filters/filters.styles.d.ts +0 -1
- package/lib/components/Filter/components/Filters/filters.styles.js +10 -16
- package/lib/components/Layout/components/Header/components/Content/components/Actions/actions.styles.js +2 -7
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.d.ts +16 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.js +27 -4
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.js +7 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/common/constants.d.ts +2 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/common/constants.js +7 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.js +4 -4
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.d.ts +1 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.js +7 -8
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +36 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.js +7 -0
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/search.d.ts +16 -2
- package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/search.js +24 -3
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/common/constants.d.ts +2 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/common/constants.js +7 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.d.ts +2 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +4 -3
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.d.ts +2 -4
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.js +11 -17
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.d.ts +4 -4
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +28 -19
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.d.ts +10 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.js +48 -46
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/common/constants.d.ts +2 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/common/constants.js +3 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.js +2 -2
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.d.ts +1 -0
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.js +3 -5
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.d.ts +5 -1
- package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.js +8 -11
- package/lib/components/Layout/components/Header/header.js +9 -5
- package/lib/components/Layout/components/Header/header.styles.js +2 -1
- package/lib/components/Layout/components/Header/hooks/useHeaderVisibility.d.ts +1 -0
- package/lib/components/Layout/components/Header/hooks/useHeaderVisibility.js +10 -5
- package/lib/components/common/CustomIcon/components/InProgressIcon/inProgressIcon.d.ts +6 -0
- package/lib/components/common/CustomIcon/components/InProgressIcon/inProgressIcon.js +9 -0
- package/lib/components/common/Menu/hooks/useMenu.d.ts +4 -2
- package/lib/components/common/Menu/hooks/useMenu.js +10 -0
- package/lib/hooks/useBreakpoint.js +9 -8
- package/lib/utils/replaceParameters.d.ts +10 -0
- package/lib/utils/replaceParameters.js +16 -0
- package/package.json +1 -1
- package/src/components/Layout/components/Header/components/Content/components/Actions/actions.styles.ts +2 -7
- package/src/utils/replaceParameters.ts +23 -0
|
@@ -48,7 +48,7 @@ export const Filter = ({ categorySection, categoryView, closeAncestor, isFilterD
|
|
|
48
48
|
trackFilterOpened?.({ category: categoryView.key });
|
|
49
49
|
};
|
|
50
50
|
return (React.createElement(React.Fragment, null,
|
|
51
|
-
React.createElement(FilterLabel, { count: categoryView.values.length, disabled: categoryView.isDisabled, label: categoryView.label, onClick: onOpenFilter }),
|
|
51
|
+
React.createElement(FilterLabel, { count: categoryView.values.length, disabled: categoryView.isDisabled, isOpen: isOpen, label: categoryView.label, onClick: onOpenFilter }),
|
|
52
52
|
React.createElement(FilterPopover, { anchorPosition: anchorPosition, anchorReference: "anchorPosition", marginThreshold: 0, onClose: onCloseFilters, open: isOpen, slotProps: slotProps, TransitionComponent: TransitionComponent, transitionDuration: TransitionDuration },
|
|
53
53
|
isOpen && isFilterDrawer && (React.createElement(IconButton, { Icon: CloseRounded, onClick: onCloseFilters, size: "medium" })),
|
|
54
54
|
React.createElement(FilterMenu, { categorySection: categorySection, categoryKey: categoryView.key, categoryLabel: categoryView.label, isFilterDrawer: isFilterDrawer, onFilter: onFilter, onCloseFilter: onCloseFilter, values: categoryView.values })),
|
|
@@ -5,13 +5,14 @@ import { smokeLight, white } from "../../../../styles/common/mixins/colors";
|
|
|
5
5
|
import { IconButton as DXIconButton } from "../../../common/IconButton/iconButton";
|
|
6
6
|
export const FilterPopover = styled(Popover) `
|
|
7
7
|
.MuiPaper-menu {
|
|
8
|
-
margin: 0;
|
|
8
|
+
margin: 4px 0;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
${mediaDesktopSmallDown} {
|
|
12
12
|
.MuiPaper-root {
|
|
13
13
|
background-color: ${smokeLight};
|
|
14
14
|
height: 100%;
|
|
15
|
+
margin: 0;
|
|
15
16
|
max-height: 100%;
|
|
16
17
|
overflow: visible; // required; allows backdrop button to render outside of drawer container.
|
|
17
18
|
}
|
|
@@ -2,7 +2,8 @@ import { MouseEvent } from "react";
|
|
|
2
2
|
export interface FilterLabelProps {
|
|
3
3
|
count?: number;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
+
isOpen: boolean;
|
|
5
6
|
label: string;
|
|
6
7
|
onClick: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
7
8
|
}
|
|
8
|
-
export declare const FilterLabel: ({ count, disabled, label, onClick, }: FilterLabelProps) => JSX.Element;
|
|
9
|
+
export declare const FilterLabel: ({ count, disabled, isOpen, label, onClick, }: FilterLabelProps) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ArrowDropDownRoundedIcon from "@mui/icons-material/ArrowDropDownRounded";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FilterLabel as Label } from "./filterLabel.styles";
|
|
4
|
-
export const FilterLabel = ({ count, disabled = false, label, onClick, }) => {
|
|
4
|
+
export const FilterLabel = ({ count, disabled = false, isOpen, label, onClick, }) => {
|
|
5
5
|
const filterLabel = count ? `${label}\xa0(${count})` : label; // When the count is present, a non-breaking space is used to prevent it from being on its own line
|
|
6
|
-
return (React.createElement(Label, { color: "inherit", disabled: disabled, endIcon: React.createElement(ArrowDropDownRoundedIcon, { fontSize: "small" }), fullWidth: true, onClick: onClick }, filterLabel));
|
|
6
|
+
return (React.createElement(Label, { color: "inherit", disabled: disabled, endIcon: React.createElement(ArrowDropDownRoundedIcon, { fontSize: "small" }), fullWidth: true, isOpen: isOpen, onClick: onClick }, filterLabel));
|
|
7
7
|
};
|
|
@@ -4,6 +4,7 @@ export default {
|
|
|
4
4
|
argTypes: {
|
|
5
5
|
count: { control: "number" },
|
|
6
6
|
disabled: { control: "boolean" },
|
|
7
|
+
isOpen: { control: "boolean" },
|
|
7
8
|
label: { control: "text" },
|
|
8
9
|
},
|
|
9
10
|
component: FilterLabel,
|
|
@@ -18,5 +19,6 @@ export const FilterLabelStory = FilterLabelTemplate.bind({});
|
|
|
18
19
|
FilterLabelStory.args = {
|
|
19
20
|
count: 123,
|
|
20
21
|
disabled: false,
|
|
22
|
+
isOpen: false,
|
|
21
23
|
label: "Label",
|
|
22
24
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
interface Props {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
}
|
|
2
5
|
export declare const FilterLabel: import("@emotion/styled").StyledComponent<{
|
|
3
6
|
children?: import("react").ReactNode;
|
|
4
7
|
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
@@ -33,4 +36,5 @@ export declare const FilterLabel: import("@emotion/styled").StyledComponent<{
|
|
|
33
36
|
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
34
37
|
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "sx" | "variant" | "href" | "disabled" | "action" | "size" | "fullWidth" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & {
|
|
35
38
|
theme?: import("@emotion/react").Theme | undefined;
|
|
36
|
-
}, {}, {}>;
|
|
39
|
+
} & Props, {}, {}>;
|
|
40
|
+
export {};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
+
import { css } from "@emotion/react";
|
|
1
2
|
import styled from "@emotion/styled";
|
|
2
3
|
import { Button } from "@mui/material";
|
|
3
4
|
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
4
|
-
|
|
5
|
+
import { inkLight, smokeMain } from "../../../../styles/common/mixins/colors";
|
|
6
|
+
export const FilterLabel = styled(Button, {
|
|
7
|
+
shouldForwardProp: (prop) => prop !== "isOpen",
|
|
8
|
+
}) `
|
|
5
9
|
font-weight: inherit;
|
|
6
10
|
gap: 0;
|
|
7
11
|
justify-content: space-between;
|
|
8
|
-
padding: 10px
|
|
12
|
+
padding: 10px 8px;
|
|
9
13
|
text-transform: none;
|
|
10
14
|
text-align: left;
|
|
11
15
|
|
|
12
16
|
:hover {
|
|
13
|
-
background-color:
|
|
17
|
+
background-color: ${smokeMain};
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
&.Mui-disabled {
|
|
@@ -18,16 +22,27 @@ export const FilterLabel = styled(Button) `
|
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
& .MuiButton-endIcon {
|
|
25
|
+
color: ${inkLight};
|
|
21
26
|
margin-right: -4px;
|
|
22
27
|
transform: rotate(-90deg);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
${mediaDesktopSmallUp} {
|
|
26
|
-
padding: 6px
|
|
31
|
+
padding: 6px 8px;
|
|
27
32
|
|
|
28
33
|
& .MuiButton-endIcon {
|
|
29
|
-
margin-right: 0;
|
|
30
34
|
transform: unset;
|
|
31
35
|
}
|
|
32
36
|
}
|
|
37
|
+
|
|
38
|
+
${(props) => props.isOpen &&
|
|
39
|
+
css `
|
|
40
|
+
background-color: ${smokeMain(props)};
|
|
41
|
+
|
|
42
|
+
${mediaDesktopSmallUp(props)} {
|
|
43
|
+
& .MuiButton-endIcon {
|
|
44
|
+
transform: rotate(180deg);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`};
|
|
33
48
|
`;
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
|
-
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
3
2
|
export const FilterTags = styled.span `
|
|
4
3
|
display: flex;
|
|
5
4
|
flex-wrap: wrap;
|
|
6
5
|
gap: 4px;
|
|
7
|
-
margin
|
|
8
|
-
padding: 0
|
|
6
|
+
margin: 4px 0 8px;
|
|
7
|
+
padding: 0 8px;
|
|
9
8
|
|
|
10
9
|
&:last-child {
|
|
11
10
|
margin-bottom: 0;
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
${mediaDesktopSmallUp} {
|
|
15
|
-
padding: 0;
|
|
16
|
-
}
|
|
17
12
|
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Divider } from "@mui/material";
|
|
2
|
-
import React, { Fragment, useEffect,
|
|
2
|
+
import React, { Fragment, useEffect, useRef, useState } from "react";
|
|
3
3
|
import { BREAKPOINT_FN_NAME, useBreakpointHelper, } from "../../../../hooks/useBreakpointHelper";
|
|
4
4
|
import { useWindowResize } from "../../../../hooks/useWindowResize";
|
|
5
5
|
import { DESKTOP_SM } from "../../../../theme/common/breakpoints";
|
|
@@ -39,11 +39,10 @@ export const Filters = ({ categoryFilters, closeAncestor, disabled = false, onFi
|
|
|
39
39
|
const { height: windowHeight } = useWindowResize();
|
|
40
40
|
const filterListRef = useRef(null);
|
|
41
41
|
const [height, setHeight] = useState(0);
|
|
42
|
-
const isLabeled = useMemo(() => isCategoryViewsLabeled(categoryFilters), [categoryFilters]);
|
|
43
42
|
useEffect(() => {
|
|
44
43
|
setHeight(calculateListHeight(windowHeight, filterListRef.current));
|
|
45
44
|
}, [windowHeight]);
|
|
46
|
-
return (React.createElement(FilterList, { disabled: disabled, height: height,
|
|
45
|
+
return (React.createElement(FilterList, { disabled: disabled, height: height, ref: filterListRef }, categoryFilters.map(({ categoryViews, label }, i) => (React.createElement(Fragment, { key: i },
|
|
47
46
|
i !== 0 && React.createElement(Divider, null),
|
|
48
47
|
label && React.createElement(CategoryViewsLabel, null, label),
|
|
49
48
|
categoryViews.map((categoryView) => (React.createElement(Filter, { key: categoryView.key, categorySection: label, categoryView: categoryView, closeAncestor: closeAncestor, isFilterDrawer: isFilterDrawer, onFilter: onFilter, trackFilterOpened: trackFilterOpened, tags: renderFilterTags(categoryView, onFilter) }))))))));
|
|
@@ -57,11 +56,3 @@ export const Filters = ({ categoryFilters, closeAncestor, disabled = false, onFi
|
|
|
57
56
|
function calculateListHeight(windowHeight, filterListEl) {
|
|
58
57
|
return windowHeight - (filterListEl?.getBoundingClientRect()?.top ?? 0);
|
|
59
58
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Returns true if any category views are labelled.
|
|
62
|
-
* @param categoryFilters - Category filters.
|
|
63
|
-
* @returns true if any category views are labelled.
|
|
64
|
-
*/
|
|
65
|
-
function isCategoryViewsLabeled(categoryFilters) {
|
|
66
|
-
return categoryFilters.some(({ label }) => label);
|
|
67
|
-
}
|
|
@@ -2,16 +2,14 @@ import { css } from "@emotion/react";
|
|
|
2
2
|
import styled from "@emotion/styled";
|
|
3
3
|
import { mediaDesktopSmallUp } from "../../../../styles/common/mixins/breakpoints";
|
|
4
4
|
import { inkLight, inkMain } from "../../../../styles/common/mixins/colors";
|
|
5
|
-
import {
|
|
6
|
-
export const Filters = styled("div"
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
${(props) => (props.isBaseStyle ? textBody500(props) : textBody400(props))};
|
|
10
|
-
color: ${(props) => (props.isBaseStyle ? inkMain(props) : inkLight(props))};
|
|
5
|
+
import { textBody500, textUppercase500, } from "../../../../styles/common/mixins/fonts";
|
|
6
|
+
export const Filters = styled("div") `
|
|
7
|
+
${textBody500};
|
|
8
|
+
color: ${inkMain};
|
|
11
9
|
height: ${({ height }) => height}px;
|
|
12
10
|
margin: 8px 0;
|
|
13
11
|
overflow: auto;
|
|
14
|
-
padding: 0
|
|
12
|
+
padding: 0 8px 8px;
|
|
15
13
|
|
|
16
14
|
// Filters are globally "disabled".
|
|
17
15
|
${({ disabled }) => disabled &&
|
|
@@ -20,21 +18,17 @@ export const Filters = styled("div", {
|
|
|
20
18
|
`};
|
|
21
19
|
|
|
22
20
|
.MuiDivider-root {
|
|
23
|
-
margin: 8px
|
|
21
|
+
margin: 8px;
|
|
24
22
|
}
|
|
25
23
|
|
|
26
24
|
${mediaDesktopSmallUp} {
|
|
27
25
|
height: unset;
|
|
28
26
|
overflow: unset;
|
|
29
|
-
padding: 0
|
|
27
|
+
padding: 0 8px;
|
|
30
28
|
}
|
|
31
29
|
`;
|
|
32
30
|
export const CategoryViewsLabel = styled("div") `
|
|
33
|
-
${
|
|
34
|
-
color: ${
|
|
35
|
-
padding: 8px
|
|
36
|
-
|
|
37
|
-
${mediaDesktopSmallUp} {
|
|
38
|
-
padding: 8px 0;
|
|
39
|
-
}
|
|
31
|
+
${textUppercase500};
|
|
32
|
+
color: ${inkLight};
|
|
33
|
+
padding: 8px;
|
|
40
34
|
`;
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import styled from "@emotion/styled";
|
|
2
|
-
import { DESKTOP_SM } from "../../../../../../../../theme/common/breakpoints";
|
|
3
2
|
export const HeaderActions = styled.div `
|
|
4
3
|
align-items: center;
|
|
5
4
|
display: flex;
|
|
6
|
-
flex:
|
|
5
|
+
flex: none;
|
|
7
6
|
gap: 8px;
|
|
8
|
-
justify-content:
|
|
9
|
-
|
|
10
|
-
${({ theme }) => theme.breakpoints.up(DESKTOP_SM)} {
|
|
11
|
-
flex: none;
|
|
12
|
-
}
|
|
7
|
+
justify-content: inherit;
|
|
13
8
|
`;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
import { ButtonProps as MButtonProps, IconButtonProps as MIconButtonProps } from "@mui/material";
|
|
2
|
+
import { ElementType } from "react";
|
|
2
3
|
export interface AuthenticationProps {
|
|
3
4
|
authenticationEnabled?: boolean;
|
|
5
|
+
Button: ElementType<MButtonProps> | ElementType<MIconButtonProps>;
|
|
4
6
|
closeMenu: () => void;
|
|
5
7
|
}
|
|
6
|
-
export declare const Authentication: ({ authenticationEnabled, closeMenu, }: AuthenticationProps) => JSX.Element;
|
|
8
|
+
export declare const Authentication: ({ authenticationEnabled, Button, closeMenu, }: AuthenticationProps) => JSX.Element | null;
|
|
9
|
+
/**
|
|
10
|
+
* Renders authentication button.
|
|
11
|
+
* @param props - Button props.
|
|
12
|
+
* @returns button.
|
|
13
|
+
*/
|
|
14
|
+
export declare function renderButton(props: MButtonProps): JSX.Element;
|
|
15
|
+
/**
|
|
16
|
+
* Renders authentication icon button.
|
|
17
|
+
* @param props - Button props.
|
|
18
|
+
* @returns icon button.
|
|
19
|
+
*/
|
|
20
|
+
export declare function renderIconButton(props: MIconButtonProps): JSX.Element;
|
|
@@ -1,14 +1,37 @@
|
|
|
1
|
+
import LoginRoundedIcon from "@mui/icons-material/LoginRounded";
|
|
2
|
+
import { IconButton as MIconButton, } from "@mui/material";
|
|
1
3
|
import { useRouter } from "next/router";
|
|
2
4
|
import React, { useCallback } from "react";
|
|
3
5
|
import { useAuthentication } from "../../../../../../../../../../hooks/useAuthentication/useAuthentication";
|
|
4
6
|
import { AuthenticationMenu } from "./components/AuthenticationMenu/authenticationMenu";
|
|
5
|
-
import {
|
|
6
|
-
export const Authentication = ({ authenticationEnabled, closeMenu, }) => {
|
|
7
|
+
import { StyledButton } from "./components/Button/button.styles";
|
|
8
|
+
export const Authentication = ({ authenticationEnabled, Button, closeMenu, }) => {
|
|
7
9
|
const { isAuthenticated, requestAuthentication, userProfile } = useAuthentication();
|
|
8
10
|
const router = useRouter();
|
|
9
11
|
const onLogout = useCallback(() => {
|
|
10
12
|
location.href = router.basePath;
|
|
11
13
|
}, [router]);
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
if (!authenticationEnabled)
|
|
15
|
+
return null;
|
|
16
|
+
return (React.createElement(React.Fragment, null, isAuthenticated && userProfile ? (React.createElement(AuthenticationMenu, { onLogout: onLogout, userProfile: userProfile })) : (React.createElement(Button, { onClick: () => {
|
|
17
|
+
requestAuthentication();
|
|
18
|
+
closeMenu();
|
|
19
|
+
} }))));
|
|
14
20
|
};
|
|
21
|
+
/**
|
|
22
|
+
* Renders authentication button.
|
|
23
|
+
* @param props - Button props.
|
|
24
|
+
* @returns button.
|
|
25
|
+
*/
|
|
26
|
+
export function renderButton(props) {
|
|
27
|
+
return (React.createElement(StyledButton, { startIcon: React.createElement(LoginRoundedIcon, null), variant: "nav", ...props }, "Sign in"));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Renders authentication icon button.
|
|
31
|
+
* @param props - Button props.
|
|
32
|
+
* @returns icon button.
|
|
33
|
+
*/
|
|
34
|
+
export function renderIconButton(props) {
|
|
35
|
+
return (React.createElement(MIconButton, { color: "ink", ...props },
|
|
36
|
+
React.createElement(LoginRoundedIcon, null)));
|
|
37
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledButton: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "info" | "success" | "warning" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableElevation?: boolean | undefined;
|
|
8
|
+
disableFocusRipple?: boolean | undefined;
|
|
9
|
+
endIcon?: import("react").ReactNode;
|
|
10
|
+
fullWidth?: boolean | undefined;
|
|
11
|
+
href?: string | undefined;
|
|
12
|
+
size?: "large" | "medium" | "small" | undefined;
|
|
13
|
+
startIcon?: import("react").ReactNode;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
variant?: "nav" | "text" | "outlined" | "contained" | "activeNav" | "backNav" | undefined;
|
|
16
|
+
} & Omit<{
|
|
17
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
|
+
centerRipple?: boolean | undefined;
|
|
19
|
+
children?: import("react").ReactNode;
|
|
20
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableRipple?: boolean | undefined;
|
|
23
|
+
disableTouchRipple?: boolean | undefined;
|
|
24
|
+
focusRipple?: boolean | undefined;
|
|
25
|
+
focusVisibleClassName?: string | undefined;
|
|
26
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
27
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
28
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
29
|
+
tabIndex?: number | undefined;
|
|
30
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
31
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
32
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
33
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
34
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "sx" | "variant" | "href" | "disabled" | "action" | "size" | "fullWidth" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & {
|
|
35
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
36
|
+
}, {}, {}>;
|
|
@@ -4,8 +4,8 @@ import React, { Fragment } from "react";
|
|
|
4
4
|
import { Left, Right } from "../../../../../../../../header.styles";
|
|
5
5
|
import { Announcements } from "../../../../../../../Announcements/announcements";
|
|
6
6
|
import { Actions } from "../../../../actions";
|
|
7
|
-
import { Authentication } from "../../../Authentication/authentication";
|
|
8
|
-
import { Search } from "../../../Search/search";
|
|
7
|
+
import { Authentication, renderIconButton as renderAuthenticationIconButton, } from "../../../Authentication/authentication";
|
|
8
|
+
import { renderIconButton as renderSearchIconButton, Search, } from "../../../Search/search";
|
|
9
9
|
export const Toolbar = ({ actions, announcements, authenticationEnabled, logo, onClose, searchEnabled, searchURL, }) => {
|
|
10
10
|
return (React.createElement(Fragment, null,
|
|
11
11
|
React.createElement(Announcements, { announcements: announcements }),
|
|
@@ -13,8 +13,8 @@ export const Toolbar = ({ actions, announcements, authenticationEnabled, logo, o
|
|
|
13
13
|
React.createElement(Left, null, logo),
|
|
14
14
|
React.createElement(Right, null,
|
|
15
15
|
React.createElement(Actions, null,
|
|
16
|
-
React.createElement(Search, { closeMenu: onClose, searchEnabled: searchEnabled, searchURL: searchURL }),
|
|
17
|
-
React.createElement(Authentication, { authenticationEnabled: authenticationEnabled, closeMenu: onClose }),
|
|
16
|
+
React.createElement(Search, { Button: renderSearchIconButton, closeMenu: onClose, searchEnabled: searchEnabled, searchURL: searchURL }),
|
|
17
|
+
React.createElement(Authentication, { authenticationEnabled: authenticationEnabled, Button: renderAuthenticationIconButton, closeMenu: onClose }),
|
|
18
18
|
actions,
|
|
19
19
|
React.createElement(IconButton, { color: "ink", onClick: onClose },
|
|
20
20
|
React.createElement(CloseRoundedIcon, null)))))));
|
|
@@ -1,33 +1,32 @@
|
|
|
1
1
|
import MenuRoundedIcon from "@mui/icons-material/MenuRounded";
|
|
2
2
|
import { Dialog as MDialog, Fade, IconButton } from "@mui/material";
|
|
3
3
|
import React, { forwardRef, Fragment, useEffect } from "react";
|
|
4
|
-
import { useBreakpoint } from "../../../../../../../../../../hooks/useBreakpoint";
|
|
5
4
|
import { getMenuNavigationLinks } from "../../../../../../common/utils";
|
|
6
5
|
import { AppBar } from "../../../../../../header.styles";
|
|
7
6
|
import { Content } from "../../../../content.styles";
|
|
8
7
|
import { Slogan } from "../../../Slogan/slogan";
|
|
8
|
+
import { DIALOG_PROPS } from "./common/constants";
|
|
9
9
|
import { Navigation } from "./components/Content/components/Navigation/navigation.styles";
|
|
10
10
|
import { Socials } from "./components/Content/components/Socials/socials.styles";
|
|
11
11
|
import { Toolbar } from "./components/Toolbar/toolbar";
|
|
12
|
-
export const Menu = forwardRef(function HeaderMenu({ closeMenu, headerProps, open, openMenu, pathname, style }, ref) {
|
|
12
|
+
export const Menu = forwardRef(function HeaderMenu({ closeMenu, headerProps, isMenuIn, open, openMenu, pathname, style, }, ref) {
|
|
13
13
|
const { navigation, slogan, socialMedia } = headerProps;
|
|
14
|
-
const { smDown } = useBreakpoint();
|
|
15
14
|
// Set drawer open state to false on change of media breakpoint from small desktop "md" and up.
|
|
16
15
|
useEffect(() => {
|
|
17
|
-
if (
|
|
16
|
+
if (isMenuIn)
|
|
18
17
|
return;
|
|
19
18
|
closeMenu();
|
|
20
|
-
}, [closeMenu,
|
|
21
|
-
if (!
|
|
19
|
+
}, [closeMenu, isMenuIn]);
|
|
20
|
+
if (!isMenuIn)
|
|
22
21
|
return null;
|
|
23
22
|
return (React.createElement(Fragment, null,
|
|
24
23
|
React.createElement(IconButton, { color: "ink", onClick: openMenu, ref: ref, style: style },
|
|
25
24
|
React.createElement(MenuRoundedIcon, null)),
|
|
26
|
-
React.createElement(MDialog, {
|
|
25
|
+
React.createElement(MDialog, { ...DIALOG_PROPS, onClose: closeMenu, open: open, TransitionComponent: Fade, transitionDuration: isMenuIn ? 600 : 0 },
|
|
27
26
|
React.createElement(AppBar, { component: "div", elevation: 0 },
|
|
28
27
|
React.createElement(Toolbar, { onClose: closeMenu, ...headerProps })),
|
|
29
28
|
React.createElement(Content, null,
|
|
30
29
|
slogan && React.createElement(Slogan, { slogan: slogan }),
|
|
31
|
-
React.createElement(Navigation, { closeAncestor: closeMenu, headerProps: headerProps, links: getMenuNavigationLinks(navigation), pathname: pathname }),
|
|
30
|
+
React.createElement(Navigation, { closeAncestor: closeMenu, headerProps: headerProps, isMenuIn: isMenuIn, links: getMenuNavigationLinks(navigation), pathname: pathname }),
|
|
32
31
|
socialMedia && (React.createElement(Socials, { buttonSize: "xlarge", socials: socialMedia.socials }))))));
|
|
33
32
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledButton: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
|
|
5
|
+
color?: "inherit" | "primary" | "secondary" | "error" | "info" | "success" | "warning" | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
disableElevation?: boolean | undefined;
|
|
8
|
+
disableFocusRipple?: boolean | undefined;
|
|
9
|
+
endIcon?: import("react").ReactNode;
|
|
10
|
+
fullWidth?: boolean | undefined;
|
|
11
|
+
href?: string | undefined;
|
|
12
|
+
size?: "large" | "medium" | "small" | undefined;
|
|
13
|
+
startIcon?: import("react").ReactNode;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
variant?: "nav" | "text" | "outlined" | "contained" | "activeNav" | "backNav" | undefined;
|
|
16
|
+
} & Omit<{
|
|
17
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
|
+
centerRipple?: boolean | undefined;
|
|
19
|
+
children?: import("react").ReactNode;
|
|
20
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableRipple?: boolean | undefined;
|
|
23
|
+
disableTouchRipple?: boolean | undefined;
|
|
24
|
+
focusRipple?: boolean | undefined;
|
|
25
|
+
focusVisibleClassName?: string | undefined;
|
|
26
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
27
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
28
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
29
|
+
tabIndex?: number | undefined;
|
|
30
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
31
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
32
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
33
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
34
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "sx" | "variant" | "href" | "disabled" | "action" | "size" | "fullWidth" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "startIcon"> & {
|
|
35
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
36
|
+
}, {}, {}>;
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { ButtonProps as MButtonProps, IconButtonProps as MIconButtonProps } from "@mui/material";
|
|
2
|
+
import { ElementType } from "react";
|
|
2
3
|
export interface SearchProps {
|
|
4
|
+
Button: ElementType<MButtonProps> | ElementType<MIconButtonProps>;
|
|
3
5
|
closeMenu: () => void;
|
|
4
6
|
searchEnabled?: boolean;
|
|
5
7
|
searchURL?: string;
|
|
6
8
|
}
|
|
7
|
-
export declare const Search: ({ closeMenu, searchEnabled, searchURL, }: SearchProps) => JSX.Element;
|
|
9
|
+
export declare const Search: ({ Button, closeMenu, searchEnabled, searchURL, }: SearchProps) => JSX.Element | null;
|
|
10
|
+
/**
|
|
11
|
+
* Renders search button.
|
|
12
|
+
* @param props - Button props.
|
|
13
|
+
* @returns button.
|
|
14
|
+
*/
|
|
15
|
+
export declare function renderButton(props: MButtonProps): JSX.Element;
|
|
16
|
+
/**
|
|
17
|
+
* Renders search icon button.
|
|
18
|
+
* @param props - Button props.
|
|
19
|
+
* @returns icon button.
|
|
20
|
+
*/
|
|
21
|
+
export declare function renderIconButton(props: MIconButtonProps): JSX.Element;
|
|
@@ -1,9 +1,30 @@
|
|
|
1
|
+
import { IconButton as MIconButton, } from "@mui/material";
|
|
1
2
|
import React, { useState } from "react";
|
|
3
|
+
import { SearchIcon } from "../../../../../../../../../common/CustomIcon/components/SearchIcon/searchIcon";
|
|
4
|
+
import { StyledButton } from "./components/Button/button.styles";
|
|
2
5
|
import SearchBar from "./components/SearchBar/searchBar";
|
|
3
|
-
|
|
4
|
-
export const Search = ({ closeMenu, searchEnabled, searchURL, }) => {
|
|
6
|
+
export const Search = ({ Button, closeMenu, searchEnabled, searchURL, }) => {
|
|
5
7
|
const [searchOpen, setSearchOpen] = useState(false);
|
|
8
|
+
if (!searchEnabled)
|
|
9
|
+
return null;
|
|
6
10
|
return (React.createElement(React.Fragment, null,
|
|
7
|
-
|
|
11
|
+
React.createElement(Button, { onClick: () => setSearchOpen(true) }),
|
|
8
12
|
React.createElement(SearchBar, { closeMenu: closeMenu, closeSearch: () => setSearchOpen(false), searchOpen: searchOpen, searchURL: searchURL })));
|
|
9
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* Renders search button.
|
|
16
|
+
* @param props - Button props.
|
|
17
|
+
* @returns button.
|
|
18
|
+
*/
|
|
19
|
+
export function renderButton(props) {
|
|
20
|
+
return (React.createElement(StyledButton, { startIcon: React.createElement(SearchIcon, null), variant: "nav", ...props }, "Search"));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Renders search icon button.
|
|
24
|
+
* @param props - Button props.
|
|
25
|
+
* @returns icon button.
|
|
26
|
+
*/
|
|
27
|
+
export function renderIconButton(props) {
|
|
28
|
+
return (React.createElement(MIconButton, { color: "ink", ...props },
|
|
29
|
+
React.createElement(SearchIcon, { fontSize: "medium" })));
|
|
30
|
+
}
|
|
@@ -4,9 +4,10 @@ import { MenuItem } from "../NavigationMenuItems/navigationMenuItems";
|
|
|
4
4
|
export interface NavigationDrawerProps {
|
|
5
5
|
closeAncestor?: () => void;
|
|
6
6
|
headerProps?: HeaderProps;
|
|
7
|
+
isMenuIn: boolean;
|
|
7
8
|
isSelected?: boolean;
|
|
8
9
|
menuItems: MenuItem[];
|
|
9
10
|
menuLabel: ReactNode;
|
|
10
11
|
pathname?: string;
|
|
11
12
|
}
|
|
12
|
-
export declare const NavigationDrawer: ({ closeAncestor, headerProps, isSelected, menuItems, menuLabel, pathname, }: NavigationDrawerProps) => JSX.Element;
|
|
13
|
+
export declare const NavigationDrawer: ({ closeAncestor, headerProps, isMenuIn, isSelected, menuItems, menuLabel, pathname, }: NavigationDrawerProps) => JSX.Element;
|
|
@@ -6,9 +6,10 @@ import { useDialog } from "../../../../../../../../../common/Dialog/hooks/useDia
|
|
|
6
6
|
import { AppBar } from "../../../../../../header.styles";
|
|
7
7
|
import { DrawerNavigation as Navigation } from "../../../Actions/components/Menu/components/Content/components/Navigation/navigation.styles";
|
|
8
8
|
import { Toolbar } from "../../../Actions/components/Menu/components/Toolbar/toolbar";
|
|
9
|
+
import { DIALOG_PROPS } from "./common/constants";
|
|
9
10
|
import { Slide } from "./components/Slide/slide";
|
|
10
11
|
import { Button as BackButton, Content, Dialog, } from "./navigationDrawer.styles";
|
|
11
|
-
export const NavigationDrawer = ({ closeAncestor, headerProps, isSelected = false, menuItems, menuLabel, pathname, }) => {
|
|
12
|
+
export const NavigationDrawer = ({ closeAncestor, headerProps, isMenuIn, isSelected = false, menuItems, menuLabel, pathname, }) => {
|
|
12
13
|
const { onClose, onOpen, open } = useDialog();
|
|
13
14
|
const closeDrawers = useCallback(() => {
|
|
14
15
|
onClose();
|
|
@@ -16,10 +17,10 @@ export const NavigationDrawer = ({ closeAncestor, headerProps, isSelected = fals
|
|
|
16
17
|
}, [closeAncestor, onClose]);
|
|
17
18
|
return (React.createElement(React.Fragment, null,
|
|
18
19
|
React.createElement(Button, { EndIcon: ArrowDropDownRoundedIcon, onClick: onOpen, variant: isSelected ? "activeNav" : "nav" }, menuLabel),
|
|
19
|
-
React.createElement(Dialog, {
|
|
20
|
+
React.createElement(Dialog, { ...DIALOG_PROPS, onClose: closeDrawers, open: open, TransitionComponent: Slide },
|
|
20
21
|
React.createElement(AppBar, { component: "div", elevation: 1 },
|
|
21
22
|
React.createElement(Toolbar, { onClose: closeDrawers, ...headerProps })),
|
|
22
23
|
React.createElement(Content, null,
|
|
23
24
|
React.createElement(BackButton, { fullWidth: true, onClick: onClose, StartIcon: BackArrowIcon, variant: "backNav" }, menuLabel),
|
|
24
|
-
React.createElement(Navigation, { closeAncestor: closeDrawers, headerProps: headerProps, links: menuItems, pathname: pathname })))));
|
|
25
|
+
React.createElement(Navigation, { closeAncestor: closeDrawers, headerProps: headerProps, isMenuIn: isMenuIn, links: menuItems, pathname: pathname })))));
|
|
25
26
|
};
|