@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.
Files changed (56) hide show
  1. package/lib/components/Filter/components/Filter/filter.js +1 -1
  2. package/lib/components/Filter/components/Filter/filter.styles.js +2 -1
  3. package/lib/components/Filter/components/FilterLabel/filterLabel.d.ts +2 -1
  4. package/lib/components/Filter/components/FilterLabel/filterLabel.js +2 -2
  5. package/lib/components/Filter/components/FilterLabel/filterLabel.stories.js +2 -0
  6. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.d.ts +5 -1
  7. package/lib/components/Filter/components/FilterLabel/filterLabel.styles.js +20 -5
  8. package/lib/components/Filter/components/FilterTags/filterTags.styles.js +2 -7
  9. package/lib/components/Filter/components/Filters/filters.js +2 -11
  10. package/lib/components/Filter/components/Filters/filters.styles.d.ts +0 -1
  11. package/lib/components/Filter/components/Filters/filters.styles.js +10 -16
  12. package/lib/components/Layout/components/Header/components/Content/components/Actions/actions.styles.js +2 -7
  13. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.d.ts +16 -2
  14. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/authentication.js +27 -4
  15. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.d.ts +36 -0
  16. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Authentication/components/Button/button.styles.js +7 -0
  17. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/common/constants.d.ts +2 -0
  18. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/common/constants.js +7 -0
  19. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/components/Toolbar/toolbar.js +4 -4
  20. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.d.ts +1 -0
  21. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Menu/menu.js +7 -8
  22. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.d.ts +36 -0
  23. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/components/Button/button.styles.js +7 -0
  24. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/search.d.ts +16 -2
  25. package/lib/components/Layout/components/Header/components/Content/components/Actions/components/Search/search.js +24 -3
  26. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/common/constants.d.ts +2 -0
  27. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/common/constants.js +7 -0
  28. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.d.ts +2 -1
  29. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationDrawer/navigationDrawer.js +4 -3
  30. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.d.ts +2 -4
  31. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/common/constants.js +11 -17
  32. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.d.ts +4 -4
  33. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.js +28 -19
  34. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.d.ts +10 -1
  35. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenu/navigationMenu.styles.js +48 -46
  36. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/common/constants.d.ts +2 -0
  37. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/common/constants.js +3 -0
  38. package/lib/components/Layout/components/Header/components/Content/components/Navigation/components/NavigationMenuItems/navigationMenuItems.js +2 -2
  39. package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.d.ts +1 -0
  40. package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.js +3 -5
  41. package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.d.ts +5 -1
  42. package/lib/components/Layout/components/Header/components/Content/components/Navigation/navigation.styles.js +8 -11
  43. package/lib/components/Layout/components/Header/header.js +9 -5
  44. package/lib/components/Layout/components/Header/header.styles.js +2 -1
  45. package/lib/components/Layout/components/Header/hooks/useHeaderVisibility.d.ts +1 -0
  46. package/lib/components/Layout/components/Header/hooks/useHeaderVisibility.js +10 -5
  47. package/lib/components/common/CustomIcon/components/InProgressIcon/inProgressIcon.d.ts +6 -0
  48. package/lib/components/common/CustomIcon/components/InProgressIcon/inProgressIcon.js +9 -0
  49. package/lib/components/common/Menu/hooks/useMenu.d.ts +4 -2
  50. package/lib/components/common/Menu/hooks/useMenu.js +10 -0
  51. package/lib/hooks/useBreakpoint.js +9 -8
  52. package/lib/utils/replaceParameters.d.ts +10 -0
  53. package/lib/utils/replaceParameters.js +16 -0
  54. package/package.json +1 -1
  55. package/src/components/Layout/components/Header/components/Content/components/Actions/actions.styles.ts +2 -7
  56. package/src/utils/replaceParameters.ts +23 -0
@@ -1,4 +1,2 @@
1
- import { MenuProps as MMenuProps } from "@mui/material";
2
- export declare const MENU_ANCHOR_ORIGIN_LEFT_BOTTOM: MMenuProps["anchorOrigin"];
3
- export declare const MENU_ANCHOR_ORIGIN_RIGHT_TOP: MMenuProps["anchorOrigin"];
4
- export declare const MENU_PROPS: Partial<MMenuProps>;
1
+ import { PopperProps as MPopperProps } from "@mui/material";
2
+ export declare const POPPER_PROPS: Partial<MPopperProps>;
@@ -1,19 +1,13 @@
1
- export const MENU_ANCHOR_ORIGIN_LEFT_BOTTOM = {
2
- horizontal: "left",
3
- vertical: "bottom",
4
- };
5
- export const MENU_ANCHOR_ORIGIN_RIGHT_TOP = {
6
- horizontal: "right",
7
- vertical: "top",
8
- };
9
- export const MENU_PROPS = {
10
- slotProps: {
11
- paper: {
12
- variant: "menu",
1
+ export const POPPER_PROPS = {
2
+ modifiers: [
3
+ {
4
+ name: "flip",
5
+ options: {
6
+ padding: 16,
7
+ },
13
8
  },
14
- },
15
- transformOrigin: {
16
- horizontal: "left",
17
- vertical: "top",
18
- },
9
+ ],
10
+ placement: "bottom-start",
11
+ role: "presentation",
12
+ transition: true,
19
13
  };
@@ -1,13 +1,13 @@
1
- import { MenuProps as MMenuProps } from "@mui/material";
1
+ import { PopperProps as MPopperProps } from "@mui/material";
2
2
  import { ReactNode } from "react";
3
3
  import { MenuItem } from "../NavigationMenuItems/navigationMenuItems";
4
4
  export interface NavLinkMenuProps {
5
- anchorOrigin?: MMenuProps["anchorOrigin"];
6
5
  closeAncestor?: () => void;
7
- disablePortal?: boolean;
8
6
  isSelected?: boolean;
7
+ isSubMenu?: boolean;
9
8
  menuItems: MenuItem[];
10
9
  menuLabel: ReactNode;
11
10
  pathname?: string;
11
+ popperProps?: Partial<MPopperProps>;
12
12
  }
13
- export declare const NavigationMenu: ({ anchorOrigin, closeAncestor, disablePortal, isSelected, menuItems, menuLabel, pathname, }: NavLinkMenuProps) => JSX.Element;
13
+ export declare const NavigationMenu: ({ closeAncestor, isSelected, isSubMenu, menuItems, menuLabel, pathname, popperProps, }: NavLinkMenuProps) => JSX.Element;
@@ -1,25 +1,34 @@
1
1
  import ArrowDropDownRoundedIcon from "@mui/icons-material/ArrowDropDownRounded";
2
- import React, { Fragment } from "react";
3
- import { useBreakpoint } from "../../../../../../../../../../hooks/useBreakpoint";
2
+ import { ClickAwayListener as MClickAwayListener, Grow, MenuList as MMenuList, Paper as MPaper, } from "@mui/material";
3
+ import React, { Fragment, useEffect } from "react";
4
4
  import { useMenu } from "../../../../../../../../../common/Menu/hooks/useMenu";
5
5
  import { NavigationButtonLabel } from "../NavigationButtonLabel/navigationButtonLabel";
6
6
  import { NavigationMenuItems, } from "../NavigationMenuItems/navigationMenuItems";
7
- import { MENU_ANCHOR_ORIGIN_LEFT_BOTTOM, MENU_PROPS } from "./common/constants";
8
- import { Button, Menu, StyledMenuItem } from "./navigationMenu.styles";
9
- export const NavigationMenu = ({ anchorOrigin = MENU_ANCHOR_ORIGIN_LEFT_BOTTOM, closeAncestor, disablePortal, isSelected = false, menuItems, menuLabel, pathname, }) => {
10
- const { mdUp } = useBreakpoint();
11
- const { anchorEl, onClose, onToggleOpen, open } = useMenu();
12
- const MenuItem = disablePortal ? StyledMenuItem : Fragment;
13
- const menuItemProps = disablePortal ? { onMouseLeave: onClose } : {};
14
- return (React.createElement(MenuItem, { ...menuItemProps },
15
- React.createElement(Button, { EndIcon: ArrowDropDownRoundedIcon, isActive: open, onClick: onToggleOpen, variant: isSelected ? "activeNav" : "nav" },
7
+ import { POPPER_PROPS } from "./common/constants";
8
+ import { Button, StyledMenuItem, StyledPopper } from "./navigationMenu.styles";
9
+ export const NavigationMenu = ({ closeAncestor, isSelected = false, isSubMenu = false, menuItems, menuLabel, pathname, popperProps, }) => {
10
+ const { anchorEl, onClose, onDisableScrollLock, onEnableScrollLock, onOpen, open, } = useMenu();
11
+ const MenuItem = isSubMenu ? StyledMenuItem : Fragment;
12
+ useEffect(() => {
13
+ return () => {
14
+ if (isSubMenu || !open)
15
+ return;
16
+ onDisableScrollLock();
17
+ };
18
+ }, [isSubMenu, onDisableScrollLock, open]);
19
+ return (React.createElement(MenuItem, null,
20
+ React.createElement(Button, { EndIcon: ArrowDropDownRoundedIcon, isActive: open, onClick: onOpen, variant: isSelected ? "activeNav" : "nav" },
16
21
  React.createElement(NavigationButtonLabel, { label: menuLabel })),
17
- React.createElement(Menu, { ...MENU_PROPS, anchorEl: anchorEl, anchorOrigin: anchorOrigin, disablePortal: disablePortal, onClose: () => {
18
- onClose();
19
- closeAncestor?.();
20
- }, open: mdUp && open },
21
- React.createElement(NavigationMenuItems, { closeMenu: () => {
22
- onClose();
23
- closeAncestor?.();
24
- }, menuItems: menuItems, pathname: pathname }))));
22
+ React.createElement(StyledPopper, { ...POPPER_PROPS, ...popperProps, anchorEl: anchorEl, open: open }, ({ TransitionProps }) => (React.createElement(Grow, { ...TransitionProps, onEntered: () => {
23
+ if (isSubMenu)
24
+ return;
25
+ onEnableScrollLock();
26
+ } },
27
+ React.createElement(MPaper, { variant: "menu" },
28
+ React.createElement(MClickAwayListener, { onClickAway: onClose },
29
+ React.createElement(MMenuList, null,
30
+ React.createElement(NavigationMenuItems, { closeMenu: () => {
31
+ onClose();
32
+ closeAncestor?.();
33
+ }, menuItems: menuItems, pathname: pathname })))))))));
25
34
  };
@@ -2,7 +2,16 @@
2
2
  interface Props {
3
3
  isActive: boolean;
4
4
  }
5
- export declare const Menu: import("@emotion/styled").StyledComponent<import("@mui/material").MenuProps & {
5
+ export declare const StyledPopper: import("@emotion/styled").StyledComponent<Omit<import("@mui/base").PopperProps<"div">, "direction"> & {
6
+ component?: import("react").ElementType<any> | undefined;
7
+ components?: {
8
+ Root?: import("react").ElementType<any> | undefined;
9
+ } | undefined;
10
+ componentsProps?: {
11
+ root?: import("@mui/base").SlotComponentProps<"div", import("@mui/base").PopperRootSlotPropsOverrides, import("@mui/base").PopperOwnProps> | undefined;
12
+ } | undefined;
13
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
14
+ } & import("react").RefAttributes<HTMLDivElement> & {
6
15
  theme?: import("@emotion/react").Theme | undefined;
7
16
  }, {}, {}>;
8
17
  export declare const Button: import("@emotion/styled").StyledComponent<Omit<import("../../../../../../../../../common/Button/button").ButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement> & {
@@ -1,75 +1,77 @@
1
1
  import { css } from "@emotion/react";
2
2
  import styled from "@emotion/styled";
3
- import { Menu as MMenu, MenuItem as MMenuItem } from "@mui/material";
3
+ import { MenuItem as MMenuItem, Popper as MPopper } from "@mui/material";
4
4
  import { inkLight, smokeLight, smokeMain, } from "../../../../../../../../../../styles/common/mixins/colors";
5
5
  import { Button as DXButton } from "../../../../../../../../../common/Button/button";
6
- export const Menu = styled(MMenu) `
6
+ export const StyledPopper = styled(MPopper) `
7
+ z-index: 1300;
8
+
7
9
  .MuiPaper-menu {
8
10
  border-color: ${smokeMain};
9
11
  margin: 4px 0;
12
+ max-height: calc(100vh - 96px);
10
13
  max-width: 324px;
11
14
  min-width: 204px;
12
- }
15
+ overflow-y: auto;
13
16
 
14
- .MuiList-root {
15
- .MuiMenuItem-root {
16
- gap: 8px;
17
- margin: 0;
17
+ .MuiList-root {
18
+ display: flex;
19
+ flex-direction: column;
18
20
 
19
- .MuiListItemIcon-root {
20
- align-self: flex-start;
21
- min-width: unset;
22
- }
21
+ .MuiMenuItem-root {
22
+ gap: 8px;
23
+ margin: 0;
23
24
 
24
- .MuiListItemText-root {
25
- display: grid;
26
- gap: 4px;
27
- white-space: normal;
25
+ .MuiListItemIcon-root {
26
+ align-self: flex-start;
27
+ min-width: unset;
28
+ }
28
29
 
29
- .MuiListItemText-primary {
30
- align-items: center;
31
- display: flex;
30
+ .MuiListItemText-root {
31
+ display: grid;
32
32
  gap: 4px;
33
- min-width: 0;
33
+ white-space: normal;
34
+
35
+ .MuiListItemText-primary {
36
+ align-items: center;
37
+ display: flex;
38
+ gap: 4px;
39
+ min-width: 0;
40
+ }
41
+
42
+ .MuiListItemText-secondary {
43
+ color: ${inkLight};
44
+ white-space: normal;
45
+ }
34
46
  }
35
47
 
36
- .MuiListItemText-secondary {
48
+ &.Mui-disabled {
37
49
  color: ${inkLight};
38
- white-space: normal;
50
+ opacity: 1;
39
51
  }
40
- }
41
52
 
42
- &.Mui-disabled {
43
- color: ${inkLight};
44
- opacity: 1;
53
+ &.Mui-selected {
54
+ background-color: ${smokeLight};
55
+ }
45
56
  }
46
57
 
47
- &.Mui-selected {
48
- background-color: ${smokeLight};
49
- }
50
- }
58
+ .MuiButton-activeNav,
59
+ .MuiButton-nav {
60
+ font-weight: 400;
61
+ justify-content: space-between;
62
+ width: 100%;
51
63
 
52
- .MuiButton-activeNav,
53
- .MuiButton-nav {
54
- font-weight: 400;
55
- justify-content: space-between;
56
- width: 100%;
57
-
58
- .MuiButton-endIcon {
59
- margin-left: -6px;
60
- margin-right: -6px;
64
+ .MuiButton-endIcon {
65
+ margin-left: -6px;
66
+ margin-right: -6px;
67
+ }
61
68
  }
62
- }
63
69
 
64
- .MuiDivider-root {
65
- margin: 8px 0;
70
+ .MuiDivider-root {
71
+ margin: 8px 0;
72
+ }
66
73
  }
67
74
  }
68
-
69
- .MuiPopover-root {
70
- cursor: default;
71
- z-index: -1;
72
- }
73
75
  `;
74
76
  export const Button = styled(DXButton, {
75
77
  shouldForwardProp: (prop) => prop !== "isActive",
@@ -0,0 +1,2 @@
1
+ import { PopperProps as MPopperProps } from "@mui/material";
2
+ export declare const POPPER_PROPS: Partial<MPopperProps>;
@@ -5,11 +5,11 @@ import { TEXT_BODY_400, TEXT_BODY_500, TEXT_BODY_SMALL_400_2_LINES, TEXT_UPPERCA
5
5
  import { ANCHOR_TARGET, REL_ATTRIBUTE, } from "../../../../../../../../../Links/common/entities";
6
6
  import { isClientSideNavigation } from "../../../../../../../../../Links/common/utils";
7
7
  import { isNavigationLinkSelected } from "../../common/utils";
8
- import { MENU_ANCHOR_ORIGIN_RIGHT_TOP } from "../NavigationMenu/common/constants";
9
8
  import { NavigationMenu } from "../NavigationMenu/navigationMenu";
9
+ import { POPPER_PROPS } from "./common/constants";
10
10
  export const NavigationMenuItems = ({ closeMenu, menuItems, pathname, }) => {
11
11
  const router = useRouter();
12
- return (React.createElement(React.Fragment, null, menuItems.map(({ description, divider, icon, label, menuItems: nestedMenuItems, selectedPatterns, target = ANCHOR_TARGET.SELF, url, }, i) => nestedMenuItems ? (React.createElement(NavigationMenu, { key: i, anchorOrigin: MENU_ANCHOR_ORIGIN_RIGHT_TOP, closeAncestor: closeMenu, disablePortal: true, menuItems: nestedMenuItems, menuLabel: label, pathname: pathname })) : (React.createElement(Fragment, { key: i },
12
+ return (React.createElement(React.Fragment, null, menuItems.map(({ description, divider, icon, label, menuItems: nestedMenuItems, selectedPatterns, target = ANCHOR_TARGET.SELF, url, }, i) => nestedMenuItems ? (React.createElement(NavigationMenu, { key: i, closeAncestor: closeMenu, isSelected: isNavigationLinkSelected(pathname, selectedPatterns), isSubMenu: true, menuItems: nestedMenuItems, menuLabel: label, pathname: pathname, popperProps: POPPER_PROPS })) : (React.createElement(Fragment, { key: i },
13
13
  React.createElement(MMenuItem, { disabled: !url, onClick: () => {
14
14
  closeMenu();
15
15
  isClientSideNavigation(url)
@@ -19,6 +19,7 @@ export interface NavigationProps {
19
19
  className?: string;
20
20
  closeAncestor?: () => void;
21
21
  headerProps?: HeaderProps;
22
+ isMenuIn?: boolean;
22
23
  links: NavLinkItem[];
23
24
  pathname?: string;
24
25
  style?: CSSProperties;
@@ -1,7 +1,6 @@
1
1
  import { Button, Divider } from "@mui/material";
2
2
  import { useRouter } from "next/router";
3
3
  import React, { forwardRef, Fragment } from "react";
4
- import { useBreakpoint } from "../../../../../../../../hooks/useBreakpoint";
5
4
  import { ANCHOR_TARGET, REL_ATTRIBUTE, } from "../../../../../../../Links/common/entities";
6
5
  import { isClientSideNavigation } from "../../../../../../../Links/common/utils";
7
6
  import { isNavigationLinkSelected } from "./common/utils";
@@ -9,11 +8,10 @@ import { NavigationButtonLabel } from "./components/NavigationButtonLabel/naviga
9
8
  import { NavigationDrawer } from "./components/NavigationDrawer/navigationDrawer";
10
9
  import { NavigationMenu } from "./components/NavigationMenu/navigationMenu";
11
10
  import { Navigation as Links } from "./navigation.styles";
12
- export const Navigation = forwardRef(function Navigation({ className, closeAncestor, headerProps, links, pathname, style, }, ref) {
13
- const { mdUp } = useBreakpoint();
11
+ export const Navigation = forwardRef(function Navigation({ className, closeAncestor, headerProps, isMenuIn = false, links, pathname, style, }, ref) {
14
12
  const router = useRouter();
15
- return (React.createElement(Links, { ref: ref, className: className, style: style }, links.map(({ divider, label, menuItems, selectedPatterns, target = ANCHOR_TARGET.SELF, url, }, i) => menuItems ? (React.createElement(Fragment, { key: i },
16
- mdUp ? (React.createElement(NavigationMenu, { closeAncestor: closeAncestor, isSelected: isNavigationLinkSelected(pathname, selectedPatterns), menuItems: menuItems, menuLabel: label, pathname: pathname })) : (React.createElement(NavigationDrawer, { closeAncestor: closeAncestor, headerProps: headerProps, isSelected: isNavigationLinkSelected(pathname, selectedPatterns), menuItems: menuItems, menuLabel: label, pathname: pathname })),
13
+ return (React.createElement(Links, { ref: ref, className: className, isMenuIn: isMenuIn, style: style }, links.map(({ divider, label, menuItems, selectedPatterns, target = ANCHOR_TARGET.SELF, url, }, i) => menuItems ? (React.createElement(Fragment, { key: i },
14
+ isMenuIn ? (React.createElement(NavigationDrawer, { closeAncestor: closeAncestor, headerProps: headerProps, isMenuIn: isMenuIn, isSelected: isNavigationLinkSelected(pathname, selectedPatterns), menuItems: menuItems, menuLabel: label, pathname: pathname })) : (React.createElement(NavigationMenu, { closeAncestor: closeAncestor, isSelected: isNavigationLinkSelected(pathname, selectedPatterns), menuItems: menuItems, menuLabel: label, pathname: pathname })),
17
15
  divider && React.createElement(Divider, null))) : (React.createElement(Fragment, { key: i },
18
16
  React.createElement(Button, { disabled: !url, onClick: () => {
19
17
  closeAncestor?.();
@@ -1,5 +1,9 @@
1
1
  /// <reference types="react" />
2
+ interface Props {
3
+ isMenuIn: boolean;
4
+ }
2
5
  export declare const Navigation: import("@emotion/styled").StyledComponent<{
3
6
  theme?: import("@emotion/react").Theme | undefined;
4
7
  as?: import("react").ElementType<any> | undefined;
5
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
8
+ } & Props, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
9
+ export {};
@@ -1,17 +1,18 @@
1
+ import { css } from "@emotion/react";
1
2
  import styled from "@emotion/styled";
2
- import { mediaDesktopSmallUp } from "../../../../../../../../styles/common/mixins/breakpoints";
3
3
  import { textBody500 } from "../../../../../../../../styles/common/mixins/fonts";
4
4
  export const Navigation = styled("div") `
5
5
  display: flex;
6
- flex: 1;
6
+ flex: unset;
7
7
  flex-direction: row;
8
8
  gap: 8px;
9
- justify-content: flex-start;
9
+ justify-content: inherit;
10
10
 
11
- ${mediaDesktopSmallUp} {
12
- flex: unset;
13
- justify-content: inherit;
14
- }
11
+ ${({ isMenuIn }) => isMenuIn &&
12
+ css `
13
+ flex: 1;
14
+ justify-content: flex-start;
15
+ `};
15
16
 
16
17
  .MuiButton-activeNav,
17
18
  .MuiButton-nav {
@@ -26,9 +27,5 @@ export const Navigation = styled("div") `
26
27
 
27
28
  .MuiDivider-root {
28
29
  margin: 8px 0;
29
-
30
- ${mediaDesktopSmallUp} {
31
- display: none;
32
- }
33
30
  }
34
31
  `;
@@ -4,9 +4,9 @@ import React from "react";
4
4
  import { APP_BAR_PROPS, FADE_TRANSITION_PROPS, TOOLBAR_PROPS, } from "./common/constants";
5
5
  import { Announcements } from "./components/Announcements/announcements";
6
6
  import { Actions } from "./components/Content/components/Actions/actions";
7
- import { Authentication } from "./components/Content/components/Actions/components/Authentication/authentication";
7
+ import { Authentication, renderButton as renderAuthenticationButton, renderIconButton as renderAuthenticationIconButton, } from "./components/Content/components/Actions/components/Authentication/authentication";
8
8
  import { Menu } from "./components/Content/components/Actions/components/Menu/menu";
9
- import { Search } from "./components/Content/components/Actions/components/Search/search";
9
+ import { renderButton as renderSearchButton, renderIconButton as renderSearchIconButton, Search, } from "./components/Content/components/Actions/components/Search/search";
10
10
  import { Navigation as DXNavigation } from "./components/Content/components/Navigation/navigation";
11
11
  import { Slogan } from "./components/Content/components/Slogan/slogan";
12
12
  import { Divider } from "./components/Content/components/Slogan/slogan.styles";
@@ -44,8 +44,12 @@ export const Header = ({ ...headerProps }) => {
44
44
  isIn.isRightNavigationIn && (React.createElement(DXNavigation, { ...navigationProps, links: navItemsR })),
45
45
  isIn.isSocialsIn && (React.createElement(Socials, { buttonSize: "small", socials: socialMedia?.socials || [] })),
46
46
  isIn.isActionsIn && (React.createElement(Actions, null,
47
- React.createElement(Search, { closeMenu: onClose, searchEnabled: searchEnabled, searchURL: searchURL }),
48
- React.createElement(Authentication, { authenticationEnabled: authenticationEnabled, closeMenu: onClose }),
47
+ React.createElement(Search, { Button: ({ ...props }) => isIn.isMenuIn
48
+ ? renderSearchIconButton(props)
49
+ : renderSearchButton(props), closeMenu: onClose, searchEnabled: searchEnabled, searchURL: searchURL }),
50
+ React.createElement(Authentication, { Button: ({ ...props }) => isIn.isMenuIn
51
+ ? renderAuthenticationIconButton(props)
52
+ : renderAuthenticationButton(props), authenticationEnabled: authenticationEnabled, closeMenu: onClose }),
49
53
  actions,
50
- React.createElement(Menu, { ...navigationProps, closeMenu: onClose, open: open, openMenu: onOpen }))))))));
54
+ React.createElement(Menu, { ...navigationProps, closeMenu: onClose, isMenuIn: isIn.isMenuIn, open: open, openMenu: onOpen }))))))));
51
55
  };
@@ -1,9 +1,10 @@
1
1
  import { css } from "@emotion/react";
2
2
  import styled from "@emotion/styled";
3
3
  import { AppBar as MAppBar } from "@mui/material";
4
+ import { smokeMain } from "../../../../styles/common/mixins/colors";
4
5
  import { HEADER_HEIGHT } from "./common/constants";
5
6
  export const AppBar = styled(MAppBar) `
6
- border-bottom: 1px solid ${({ theme }) => theme.palette.smoke.main};
7
+ border-bottom: 1px solid ${smokeMain};
7
8
 
8
9
  &.MuiPaper-elevation0 {
9
10
  border-bottom: 1px solid transparent;
@@ -6,6 +6,7 @@ export interface UseHeaderVisibility {
6
6
  isCenterNavigationIn: boolean;
7
7
  isLeftGroupIn: boolean;
8
8
  isLeftNavigationIn: boolean;
9
+ isMenuIn: boolean;
9
10
  isRightGroupIn: boolean;
10
11
  isRightNavigationIn: boolean;
11
12
  isSloganIn: boolean;
@@ -5,21 +5,25 @@ import { useBreakpoint } from "../../../../../hooks/useBreakpoint";
5
5
  * @returns header component visibility.
6
6
  */
7
7
  export const useHeaderVisibility = (headerProps) => {
8
- const { lgUp, mdUp } = useBreakpoint();
8
+ const { breakpoint, lgUp, mdUp, smDown, smUp } = useBreakpoint();
9
9
  // Header configuration.
10
10
  const { actions, authenticationEnabled, logo, navigation: [navItemsL, navItemsC, navItemsR] = [], searchEnabled, slogan, socialMedia, } = headerProps;
11
+ // Breakpoint.
12
+ const hasBreakpoint = Boolean(breakpoint);
11
13
  // Header content.
12
14
  const hasActions = Boolean(actions);
13
15
  const hasLogo = Boolean(logo);
14
- const hasMenu = !mdUp;
16
+ const hasMenu = smDown;
15
17
  const hasNavItemsC = Boolean(navItemsC && navItemsC.length > 0);
16
18
  const hasNavItemsL = Boolean(navItemsL && navItemsL.length > 0);
17
19
  const hasNavItemsR = Boolean(navItemsR && navItemsR.length > 0);
18
20
  const hasSlogan = Boolean(slogan);
19
21
  const hasSocials = Boolean(socialMedia);
20
22
  // Determines header content visibility.
21
- const isActionsIn = hasActions || searchEnabled || authenticationEnabled || hasMenu;
22
- const isNavigationIn = mdUp;
23
+ const isActionsIn = (hasActions || searchEnabled || authenticationEnabled || hasMenu) &&
24
+ hasBreakpoint;
25
+ const isNavigationIn = smUp;
26
+ const isMenuIn = hasMenu;
23
27
  const isSloganIn = hasSlogan && mdUp;
24
28
  const isSocialsIn = hasSocials && lgUp;
25
29
  // Determines navigation visibility.
@@ -27,7 +31,7 @@ export const useHeaderVisibility = (headerProps) => {
27
31
  const isLeftNavigationIn = isNavigationIn && hasNavItemsL;
28
32
  const isRightNavigationIn = isNavigationIn && hasNavItemsR;
29
33
  // Determines group visibility.
30
- const isLeftGroupIn = hasLogo || isSocialsIn || isLeftNavigationIn;
34
+ const isLeftGroupIn = hasLogo || isSloganIn || isLeftNavigationIn;
31
35
  const isCenterGroupIn = isCenterNavigationIn;
32
36
  const isRightGroupIn = isRightNavigationIn || isSocialsIn || isActionsIn;
33
37
  return {
@@ -37,6 +41,7 @@ export const useHeaderVisibility = (headerProps) => {
37
41
  isCenterNavigationIn,
38
42
  isLeftGroupIn,
39
43
  isLeftNavigationIn,
44
+ isMenuIn,
40
45
  isRightGroupIn,
41
46
  isRightNavigationIn,
42
47
  isSloganIn,
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { CustomSVGIconProps } from "../../common/entities";
3
+ /**
4
+ * Custom in-progress icon.
5
+ */
6
+ export declare const InProgressIcon: ({ fontSize, viewBox, ...props }: CustomSVGIconProps) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { SvgIcon } from "@mui/material";
2
+ import React from "react";
3
+ /**
4
+ * Custom in-progress icon.
5
+ */
6
+ export const InProgressIcon = ({ fontSize = "xsmall", viewBox = "0 0 18 18", ...props /* Spread props to allow for Mui SvgIconProps specific prop overrides e.g. "htmlColor". */ }) => {
7
+ return (React.createElement(SvgIcon, { fontSize: fontSize, viewBox: viewBox, ...props },
8
+ React.createElement("path", { d: "M9 16.5C7.9625 16.5 6.9875 16.3031 6.075 15.9094C5.1625 15.5156 4.36875 14.9812 3.69375 14.3062C3.01875 13.6312 2.48437 12.8375 2.09062 11.925C1.69687 11.0125 1.5 10.0375 1.5 9C1.5 7.9625 1.69687 6.9875 2.09062 6.075C2.48437 5.1625 3.01875 4.36875 3.69375 3.69375C4.36875 3.01875 5.1625 2.48437 6.075 2.09062C6.9875 1.69687 7.9625 1.5 9 1.5C10.0375 1.5 11.0125 1.69687 11.925 2.09062C12.8375 2.48437 13.6312 3.01875 14.3062 3.69375C14.9812 4.36875 15.5156 5.1625 15.9094 6.075C16.3031 6.9875 16.5 7.9625 16.5 9C16.5 10.0375 16.3031 11.0125 15.9094 11.925C15.5156 12.8375 14.9812 13.6312 14.3062 14.3062C13.6312 14.9812 12.8375 15.5156 11.925 15.9094C11.0125 16.3031 10.0375 16.5 9 16.5ZM9 15C9.8 15 10.5687 14.85 11.3062 14.55C12.0437 14.25 12.6937 13.8187 13.2562 13.2562L9 9V3C7.325 3 5.90625 3.58125 4.74375 4.74375C3.58125 5.90625 3 7.325 3 9C3 10.675 3.58125 12.0937 4.74375 13.2562C5.90625 14.4187 7.325 15 9 15Z", fill: "currentColor" })));
9
+ };
@@ -1,8 +1,10 @@
1
- import { MenuProps as MMenuProps } from "@mui/material";
1
+ import { PopperProps as MPopperProps } from "@mui/material";
2
2
  import { MouseEvent } from "react";
3
3
  export interface UseMenu {
4
- anchorEl: MMenuProps["anchorEl"];
4
+ anchorEl: MPopperProps["anchorEl"];
5
5
  onClose: () => void;
6
+ onDisableScrollLock: () => void;
7
+ onEnableScrollLock: () => void;
6
8
  onOpen: (event: MouseEvent<HTMLElement>) => void;
7
9
  onToggleOpen: (event: MouseEvent<HTMLElement>) => void;
8
10
  open: boolean;
@@ -10,6 +10,14 @@ export const useMenu = () => {
10
10
  const onClose = useCallback(() => {
11
11
  setAnchorEl(null);
12
12
  }, []);
13
+ // Disables scroll lock.
14
+ const onDisableScrollLock = useCallback(() => {
15
+ document.body.style.removeProperty("overflow");
16
+ }, []);
17
+ // Enables scroll lock.
18
+ const onEnableScrollLock = useCallback(() => {
19
+ document.body.style.setProperty("overflow", "hidden");
20
+ }, []);
13
21
  // Opens menu.
14
22
  const onOpen = useCallback((event) => {
15
23
  setAnchorEl(event.currentTarget);
@@ -26,6 +34,8 @@ export const useMenu = () => {
26
34
  return {
27
35
  anchorEl,
28
36
  onClose,
37
+ onDisableScrollLock,
38
+ onEnableScrollLock,
29
39
  onOpen,
30
40
  onToggleOpen,
31
41
  open,
@@ -1,3 +1,4 @@
1
+ import { BREAKPOINT_FN_NAME, useBreakpointHelper } from "./useBreakpointHelper";
1
2
  import { useCurrentBreakpoint, } from "./useCurrentBreakpoint";
2
3
  export const useBreakpoint = () => {
3
4
  const breakpoint = useCurrentBreakpoint();
@@ -7,15 +8,15 @@ export const useBreakpoint = () => {
7
8
  const md = breakpoint === "md";
8
9
  const lg = breakpoint === "lg";
9
10
  // Current breakpoint, down.
10
- const xsDown = xs;
11
- const smDown = xs || sm;
12
- const mdDown = xs || sm || md;
13
- const lgDown = xs || sm || md || lg;
11
+ const xsDown = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, "xs");
12
+ const smDown = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, "sm");
13
+ const mdDown = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, "md");
14
+ const lgDown = useBreakpointHelper(BREAKPOINT_FN_NAME.DOWN, "lg");
14
15
  // Current breakpoint, up.
15
- const xsUp = xs || sm || md || lg;
16
- const smUp = sm || md || lg;
17
- const mdUp = md || lg;
18
- const lgUp = lg;
16
+ const xsUp = useBreakpointHelper(BREAKPOINT_FN_NAME.UP, "xs");
17
+ const smUp = useBreakpointHelper(BREAKPOINT_FN_NAME.UP, "sm");
18
+ const mdUp = useBreakpointHelper(BREAKPOINT_FN_NAME.UP, "md");
19
+ const lgUp = useBreakpointHelper(BREAKPOINT_FN_NAME.UP, "lg");
19
20
  return {
20
21
  breakpoint,
21
22
  lg,
@@ -0,0 +1,10 @@
1
+ export interface Parameter {
2
+ [key: string]: string;
3
+ }
4
+ /**
5
+ * Replaces path parameters in the given URL string e.g. "/{portalURL}/overview" with the corresponding value.
6
+ * @param str - URL string, with parameters.
7
+ * @param parameter - Parameter.
8
+ * @returns string with parameters replaced.
9
+ */
10
+ export declare function replaceParameters(str: string, parameter: Parameter): string;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Replaces path parameters in the given URL string e.g. "/{portalURL}/overview" with the corresponding value.
3
+ * @param str - URL string, with parameters.
4
+ * @param parameter - Parameter.
5
+ * @returns string with parameters replaced.
6
+ */
7
+ export function replaceParameters(str, parameter) {
8
+ const result = Object.entries(parameter).reduce((acc, [parameterKey, parameterValue]) => {
9
+ const regex = new RegExp(`\\{${parameterKey}}`, "g");
10
+ return acc.replace(regex, parameterValue);
11
+ }, str);
12
+ if (/\{\w+}/.test(result)) {
13
+ throw new Error(`URL still contains path parameters: ${result}`);
14
+ }
15
+ return result;
16
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@databiosphere/findable-ui",
3
- "version": "10.1.0",
3
+ "version": "10.2.0",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -1,14 +1,9 @@
1
1
  import styled from "@emotion/styled";
2
- import { DESKTOP_SM } from "../../../../../../../../theme/common/breakpoints";
3
2
 
4
3
  export const HeaderActions = styled.div`
5
4
  align-items: center;
6
5
  display: flex;
7
- flex: 1;
6
+ flex: none;
8
7
  gap: 8px;
9
- justify-content: flex-end;
10
-
11
- ${({ theme }) => theme.breakpoints.up(DESKTOP_SM)} {
12
- flex: none;
13
- }
8
+ justify-content: inherit;
14
9
  `;