@hitachivantara/app-shell-ui 1.9.1 → 1.10.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/dist/esm/components/AppShell/AppShell.mjs +10 -0
- package/dist/esm/components/AppShellProvider/AppShellProvider.mjs +112 -0
- package/dist/esm/components/AppShellRoutes/AppShellRoutes.mjs +118 -0
- package/dist/esm/components/AppShellViewProvider/{AppShellViewProvider.js → AppShellViewProvider.mjs} +3 -8
- package/dist/esm/components/CustomHooksInitializer/{CustomHooksInitializer.js → CustomHooksInitializer.mjs} +2 -2
- package/dist/esm/components/GlobalStyles/GlobalStyles.mjs +16 -0
- package/dist/esm/components/GlobalStyles/index.mjs +4 -0
- package/dist/esm/components/IconUiKit/IconUiKit.mjs +10 -0
- package/dist/esm/components/IconUiKit/index.mjs +6 -0
- package/dist/esm/components/SnackbarProvider/SnackbarProvider.mjs +24 -0
- package/dist/esm/components/hoc/{withClickAwayListener.js → withClickAwayListener.mjs} +6 -3
- package/dist/esm/components/hoc/{withGlobalProvider.js → withGlobalProvider.mjs} +25 -13
- package/dist/esm/components/layout/BrandLogo/{BrandLogo.js → BrandLogo.mjs} +7 -11
- package/dist/esm/components/layout/BrandLogo/Logos/Hitachi.mjs +30 -0
- package/dist/esm/components/layout/BrandLogo/Logos/Lumada.mjs +48 -0
- package/dist/esm/components/layout/BrandLogo/Logos/Pentaho.mjs +30 -0
- package/dist/esm/components/layout/Header/Header.mjs +88 -0
- package/dist/esm/components/layout/Header/HeaderActions/{DynamicAction/DynamicAction.js → DynamicAction.mjs} +12 -15
- package/dist/esm/components/layout/Header/HeaderActions/HeaderActions.mjs +25 -0
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/AppSwitcherToggle.mjs +83 -0
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/index.mjs +4 -0
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.mjs +14 -0
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/{ColorModeSwitcher/ColorModeSwitcher.js → ColorModeSwitcher.mjs} +12 -13
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.mjs +28 -0
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/index.mjs +4 -0
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/InternalAction/InternalAction.mjs +39 -0
- package/dist/esm/components/layout/Header/HeaderActions/index.mjs +4 -0
- package/dist/esm/components/layout/Header/styles.mjs +10 -0
- package/dist/esm/components/layout/Loading/Loading.mjs +8 -0
- package/dist/esm/components/layout/Loading/styles.mjs +14 -0
- package/dist/esm/components/layout/Main/Main.mjs +48 -0
- package/dist/esm/components/layout/Main/styles.mjs +14 -0
- package/dist/esm/components/layout/VerticalNavigation/NavigationCollapse.mjs +34 -0
- package/dist/esm/components/layout/VerticalNavigation/{NavigationHeader.js → NavigationHeader.mjs} +4 -6
- package/dist/esm/components/layout/VerticalNavigation/VerticalNavigation.mjs +98 -0
- package/dist/esm/components/layout/VerticalNavigation/styles.mjs +55 -0
- package/dist/esm/{lib/hooks/useClearLocationState.js → hooks/useClearLocationState.mjs} +6 -10
- package/dist/esm/hooks/useCustomEventListener.mjs +31 -0
- package/dist/esm/{lib/hooks/useLocalStorage.js → hooks/useLocalStorage.mjs} +1 -4
- package/dist/esm/{lib/hooks/useNavigationMenuItems.js → hooks/useNavigationMenuItems.mjs} +16 -21
- package/dist/esm/{lib/hooks/useNotificationsEventListener.js → hooks/useNotificationsEventListener.mjs} +5 -16
- package/dist/esm/{lib/hooks/useThemeEventListener.js → hooks/useThemeEventListener.mjs} +5 -16
- package/dist/esm/{lib/i18n/index.js → i18n/index.mjs} +10 -8
- package/dist/esm/i18n/localization/en.json.mjs +17 -0
- package/dist/esm/i18n/localization/pt.json.mjs +17 -0
- package/dist/esm/index.mjs +4 -0
- package/dist/esm/pages/ErrorPage/ErrorPage.mjs +41 -0
- package/dist/esm/pages/ErrorPage/Footer.mjs +60 -0
- package/dist/esm/pages/ErrorPage/styles.mjs +41 -0
- package/dist/esm/pages/GenericError/GenericError.mjs +21 -0
- package/dist/esm/pages/LoadingPage/LoadingPage.mjs +18 -0
- package/dist/esm/pages/LoadingPage/index.mjs +4 -0
- package/dist/esm/pages/LoadingPage/styles.mjs +23 -0
- package/dist/esm/pages/NotFound/NotFound.mjs +19 -0
- package/dist/esm/pages/NotFound/index.mjs +4 -0
- package/dist/esm/pages/Root/Root.mjs +20 -0
- package/dist/esm/providers/BannerProvider.mjs +126 -0
- package/dist/esm/providers/LayoutProvider.mjs +36 -0
- package/dist/esm/providers/{NavigationProvider.js → NavigationProvider.mjs} +48 -34
- package/dist/esm/utils/CombinedProviders.mjs +23 -0
- package/dist/esm/{lib/utils/navigationUtil.js → utils/navigationUtil.mjs} +5 -15
- package/dist/types/index.d.ts +27 -0
- package/package.json +37 -48
- package/LICENSE +0 -201
- package/dist/dts/index.d.ts +0 -9
- package/dist/esm/components/AppShell/AppShell.js +0 -10
- package/dist/esm/components/AppShellProvider/AppShellProvider.js +0 -84
- package/dist/esm/components/AppShellRoutes/AppShellRoutes.js +0 -94
- package/dist/esm/components/GlobalStyles/GlobalStyles.js +0 -18
- package/dist/esm/components/GlobalStyles/index.js +0 -4
- package/dist/esm/components/IconUiKit/IconUiKit.js +0 -12
- package/dist/esm/components/IconUiKit/index.js +0 -6
- package/dist/esm/components/SnackbarProvider/SnackbarProvider.js +0 -22
- package/dist/esm/components/layout/BrandLogo/Logos/Hitachi.js +0 -11
- package/dist/esm/components/layout/BrandLogo/Logos/Lumada.js +0 -16
- package/dist/esm/components/layout/BrandLogo/Logos/Pentaho.js +0 -11
- package/dist/esm/components/layout/Header/Header.js +0 -72
- package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/index.js +0 -4
- package/dist/esm/components/layout/Header/HeaderActions/HeaderActions.js +0 -18
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/AppSwitcherToggle.js +0 -69
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/index.js +0 -4
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.js +0 -19
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/index.js +0 -4
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.js +0 -28
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/index.js +0 -4
- package/dist/esm/components/layout/Header/HeaderActions/InternalActions/InternalAction/InternalAction.js +0 -36
- package/dist/esm/components/layout/Header/HeaderActions/index.js +0 -4
- package/dist/esm/components/layout/Header/styles.js +0 -21
- package/dist/esm/components/layout/Loading/Loading.js +0 -10
- package/dist/esm/components/layout/Loading/styles.js +0 -36
- package/dist/esm/components/layout/Main/Main.js +0 -38
- package/dist/esm/components/layout/Main/styles.js +0 -36
- package/dist/esm/components/layout/VerticalNavigation/NavigationCollapse.js +0 -25
- package/dist/esm/components/layout/VerticalNavigation/VerticalNavigation.js +0 -75
- package/dist/esm/components/layout/VerticalNavigation/styles.js +0 -79
- package/dist/esm/index.js +0 -4
- package/dist/esm/lib/hooks/useCustomEventListener.js +0 -23
- package/dist/esm/lib/i18n/localization/en.json.js +0 -59
- package/dist/esm/lib/i18n/localization/pt.json.js +0 -59
- package/dist/esm/lib/utils/CombinedProviders.js +0 -22
- package/dist/esm/lib/utils/textUtil.js +0 -6
- package/dist/esm/pages/ErrorPage/ErrorPage.js +0 -31
- package/dist/esm/pages/ErrorPage/Footer/Footer.js +0 -53
- package/dist/esm/pages/ErrorPage/Footer/styles.js +0 -22
- package/dist/esm/pages/ErrorPage/styles.js +0 -64
- package/dist/esm/pages/GenericError/GenericError.js +0 -18
- package/dist/esm/pages/LoadingPage/LoadingPage.js +0 -14
- package/dist/esm/pages/LoadingPage/index.js +0 -4
- package/dist/esm/pages/LoadingPage/styles.js +0 -27
- package/dist/esm/pages/NotFound/NotFound.js +0 -15
- package/dist/esm/pages/NotFound/index.js +0 -4
- package/dist/esm/pages/Root/Root.js +0 -22
- package/dist/esm/providers/BannerProvider.js +0 -108
- package/dist/esm/providers/LayoutProvider.js +0 -27
- package/dist/esm/providers/hooks/useBannerContext.js +0 -12
- package/dist/esm/providers/hooks/useLayoutContext.js +0 -12
- package/dist/esm/providers/hooks/useNavigationContext.js +0 -12
- /package/dist/esm/{lib/hooks/useResizeObserver.js → hooks/useResizeObserver.mjs} +0 -0
- /package/dist/esm/pages/GenericError/{500.svg.js → 500.svg.mjs} +0 -0
- /package/dist/esm/pages/NotFound/{404.svg.js → 404.svg.mjs} +0 -0
- /package/dist/esm/{lib/utils/basePathUtils.js → utils/basePathUtils.mjs} +0 -0
- /package/dist/esm/{lib/utils/documentUtil.js → utils/documentUtil.mjs} +0 -0
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useState, useEffect, lazy, Suspense } from "react";
|
|
3
|
-
const DynamicAction = ({
|
|
4
|
-
bundle,
|
|
5
|
-
...others
|
|
6
|
-
}) => {
|
|
3
|
+
const DynamicAction = ({ bundle, ...others }) => {
|
|
7
4
|
const [loadError, setLoadError] = useState(null);
|
|
8
5
|
useEffect(() => {
|
|
9
6
|
setLoadError(null);
|
|
10
7
|
}, [bundle]);
|
|
11
|
-
const Action = lazy(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
default: () => null
|
|
19
|
-
}
|
|
20
|
-
|
|
8
|
+
const Action = lazy(
|
|
9
|
+
() => import(
|
|
10
|
+
/* @vite-ignore */
|
|
11
|
+
bundle
|
|
12
|
+
).catch((error) => {
|
|
13
|
+
console.error(error);
|
|
14
|
+
setLoadError(error);
|
|
15
|
+
return { default: () => null };
|
|
16
|
+
})
|
|
17
|
+
);
|
|
21
18
|
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: !loadError && /* @__PURE__ */ jsx(Action, { ...others }) });
|
|
22
19
|
};
|
|
23
20
|
const DynamicAction$1 = memo(DynamicAction);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useHvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
3
|
+
import { HvHeaderActions } from "@hitachivantara/uikit-react-core";
|
|
4
|
+
import DynamicAction from "./DynamicAction.mjs";
|
|
5
|
+
import InternalAction, { internalActions } from "./InternalActions/InternalAction/InternalAction.mjs";
|
|
6
|
+
const HeaderActions = () => {
|
|
7
|
+
const { header } = useHvAppShellConfig();
|
|
8
|
+
return /* @__PURE__ */ jsx(HvHeaderActions, { children: header?.actions.map((action, index) => {
|
|
9
|
+
const headerActionKey = `${action.bundle}${index}`;
|
|
10
|
+
const Component = internalActions.find(
|
|
11
|
+
(a) => a.bundle === action.bundle
|
|
12
|
+
) ? InternalAction : DynamicAction;
|
|
13
|
+
return /* @__PURE__ */ jsx(
|
|
14
|
+
Component,
|
|
15
|
+
{
|
|
16
|
+
bundle: action.bundle,
|
|
17
|
+
...action.config
|
|
18
|
+
},
|
|
19
|
+
headerActionKey
|
|
20
|
+
);
|
|
21
|
+
}) });
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
HeaderActions as default
|
|
25
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useId } from "react";
|
|
3
|
+
import { createPortal } from "react-dom";
|
|
4
|
+
import { useTranslation } from "react-i18next";
|
|
5
|
+
import { ClickAwayListener } from "@mui/material";
|
|
6
|
+
import { CONFIG_TRANSLATIONS_NAMESPACE, useHvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
7
|
+
import { HvIconButton, theme, HvAppSwitcher, HvTypography } from "@hitachivantara/uikit-react-core";
|
|
8
|
+
import createAppContainerElement from "../../../../../../utils/documentUtil.mjs";
|
|
9
|
+
import IconUiKit from "../../../../../IconUiKit/index.mjs";
|
|
10
|
+
import StyledIconWrapper from "../../../styles.mjs";
|
|
11
|
+
import StyledAppShellPanelWrapper from "./styles.mjs";
|
|
12
|
+
import BrandLogo from "../../../../BrandLogo/BrandLogo.mjs";
|
|
13
|
+
const AppSwitcherToggle = ({
|
|
14
|
+
title,
|
|
15
|
+
apps,
|
|
16
|
+
showLogo = false
|
|
17
|
+
}) => {
|
|
18
|
+
const { t } = useTranslation(void 0, { keyPrefix: "header.appSwitcher" });
|
|
19
|
+
const { t: tConfig } = useTranslation(CONFIG_TRANSLATIONS_NAMESPACE);
|
|
20
|
+
const [isPanelOpen, setIsPanelOpen] = useState(false);
|
|
21
|
+
const appSwitcherPanelId = useId();
|
|
22
|
+
const appShellConfig = useHvAppShellConfig();
|
|
23
|
+
const createAppsList = () => {
|
|
24
|
+
return apps ? apps.map((app) => ({
|
|
25
|
+
name: tConfig(app.label),
|
|
26
|
+
description: app.description ? tConfig(app.description).toString() : void 0,
|
|
27
|
+
url: app.url.includes(":") ? app.url : tConfig(app.url).toString(),
|
|
28
|
+
target: app.target === "NEW" ? "_blank" : "_top",
|
|
29
|
+
iconElement: app.icon && /* @__PURE__ */ jsx(IconUiKit, { name: app.icon.name })
|
|
30
|
+
})) : [];
|
|
31
|
+
};
|
|
32
|
+
const closeAppSwitcherPanel = () => {
|
|
33
|
+
setIsPanelOpen(false);
|
|
34
|
+
};
|
|
35
|
+
const handleAppSwitcherPanelItemClicked = () => {
|
|
36
|
+
closeAppSwitcherPanel();
|
|
37
|
+
};
|
|
38
|
+
const handleAppSwitcherButtonClick = () => {
|
|
39
|
+
setIsPanelOpen(!isPanelOpen);
|
|
40
|
+
};
|
|
41
|
+
if (!apps || apps.length === 0) {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
const finalTitle = title ? tConfig(title) : t("title");
|
|
45
|
+
return /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: closeAppSwitcherPanel, children: /* @__PURE__ */ jsxs("div", { style: { display: "flex", margin: 0 }, children: [
|
|
46
|
+
/* @__PURE__ */ jsxs(
|
|
47
|
+
HvIconButton,
|
|
48
|
+
{
|
|
49
|
+
title: finalTitle,
|
|
50
|
+
"aria-label": finalTitle,
|
|
51
|
+
"aria-expanded": isPanelOpen,
|
|
52
|
+
onClick: handleAppSwitcherButtonClick,
|
|
53
|
+
...isPanelOpen && { "aria-controls": appSwitcherPanelId },
|
|
54
|
+
children: [
|
|
55
|
+
/* @__PURE__ */ jsx(IconUiKit, { name: "AppSwitcher" }),
|
|
56
|
+
showLogo && /* @__PURE__ */ jsx(StyledIconWrapper, { style: { paddingRight: theme.space.xs }, children: /* @__PURE__ */ jsx(BrandLogo, { logo: appShellConfig.logo }) })
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
isPanelOpen && createPortal(
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
62
|
+
StyledAppShellPanelWrapper,
|
|
63
|
+
{
|
|
64
|
+
id: appSwitcherPanelId,
|
|
65
|
+
role: "region",
|
|
66
|
+
"aria-label": t("ariaLabel"),
|
|
67
|
+
children: /* @__PURE__ */ jsx(
|
|
68
|
+
HvAppSwitcher,
|
|
69
|
+
{
|
|
70
|
+
applications: createAppsList(),
|
|
71
|
+
onActionClickedCallback: handleAppSwitcherPanelItemClicked,
|
|
72
|
+
header: /* @__PURE__ */ jsx(HvTypography, { variant: "label", children: finalTitle })
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
),
|
|
77
|
+
createAppContainerElement()
|
|
78
|
+
)
|
|
79
|
+
] }) });
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
AppSwitcherToggle as default
|
|
83
|
+
};
|
package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.mjs
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { theme } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
const StyledAppShellPanelWrapper = styled("div")({
|
|
4
|
+
position: "fixed",
|
|
5
|
+
maxHeight: `calc(100vh - ${theme.header.height})`,
|
|
6
|
+
top: theme.header.height,
|
|
7
|
+
right: 0,
|
|
8
|
+
display: "flex",
|
|
9
|
+
boxShadow: theme.colors.shadow,
|
|
10
|
+
zIndex: `calc(${theme.zIndices.banner} - 1)`
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
StyledAppShellPanelWrapper as default
|
|
14
|
+
};
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { jsx } from "
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useTranslation } from "react-i18next";
|
|
3
|
-
import { useTheme, HvIconButton } from "@hitachivantara/uikit-react-core";
|
|
4
3
|
import { HvAppShellEventThemeTrigger } from "@hitachivantara/app-shell-events";
|
|
5
|
-
import
|
|
4
|
+
import { useTheme, HvIconButton } from "@hitachivantara/uikit-react-core";
|
|
5
|
+
import IconUiKit from "../../../../IconUiKit/index.mjs";
|
|
6
6
|
const ColorModeSwitcher = () => {
|
|
7
|
-
const {
|
|
8
|
-
t
|
|
9
|
-
} = useTranslation(void 0, {
|
|
7
|
+
const { t } = useTranslation(void 0, {
|
|
10
8
|
keyPrefix: "header.colorModeSwitcher"
|
|
11
9
|
});
|
|
12
|
-
const {
|
|
13
|
-
colorModes
|
|
14
|
-
} = useTheme();
|
|
10
|
+
const { colorModes } = useTheme();
|
|
15
11
|
const changeColorModeHandler = () => {
|
|
16
|
-
const customEvent = new CustomEvent(
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
const customEvent = new CustomEvent(
|
|
13
|
+
HvAppShellEventThemeTrigger,
|
|
14
|
+
{
|
|
15
|
+
detail: {
|
|
16
|
+
colorMode: void 0
|
|
17
|
+
}
|
|
19
18
|
}
|
|
20
|
-
|
|
19
|
+
);
|
|
21
20
|
globalThis.dispatchEvent(customEvent);
|
|
22
21
|
};
|
|
23
22
|
return colorModes.length > 1 ? /* @__PURE__ */ jsx(HvIconButton, { onClick: changeColorModeHandler, title: t("ariaLabel"), children: /* @__PURE__ */ jsx(IconUiKit, { name: "ThemeSwitcher" }) }) : null;
|
package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.mjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { CONFIG_TRANSLATIONS_NAMESPACE } from "@hitachivantara/app-shell-shared";
|
|
4
|
+
import { HvIconButton } from "@hitachivantara/uikit-react-core";
|
|
5
|
+
import IconUiKit from "../../../../../IconUiKit/index.mjs";
|
|
6
|
+
const HelpButton = ({ url, description }) => {
|
|
7
|
+
const { t } = useTranslation(void 0, { keyPrefix: "header.helpUrl" });
|
|
8
|
+
const { t: tConfig } = useTranslation(CONFIG_TRANSLATIONS_NAMESPACE);
|
|
9
|
+
if (!url) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
const finalUrl = url.includes(":") ? url : tConfig(url);
|
|
13
|
+
const finalDescription = description ? tConfig(description) : t("documentationLink");
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
HvIconButton,
|
|
16
|
+
{
|
|
17
|
+
component: "a",
|
|
18
|
+
href: finalUrl,
|
|
19
|
+
target: "_blank",
|
|
20
|
+
title: finalDescription,
|
|
21
|
+
rel: "noopener,noreferrer",
|
|
22
|
+
children: /* @__PURE__ */ jsx(IconUiKit, { name: "Help" })
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
HelpButton as default
|
|
28
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, lazy, Suspense } from "react";
|
|
3
|
+
const internalActions = [
|
|
4
|
+
{
|
|
5
|
+
bundle: "@hv/theming-client/colorModeSwitcher.js",
|
|
6
|
+
component: () => import("../ColorModeSwitcher.mjs").then((module) => ({
|
|
7
|
+
default: module.default
|
|
8
|
+
}))
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
bundle: "@hv/help-client/button.js",
|
|
12
|
+
component: () => import("../HelpButton/index.mjs").then((module) => ({
|
|
13
|
+
default: module.default
|
|
14
|
+
}))
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
bundle: "@hv/app-switcher-client/toggle.js",
|
|
18
|
+
component: () => import("../AppSwitcherToggle/index.mjs").then((module) => ({
|
|
19
|
+
default: module.default
|
|
20
|
+
}))
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
const InternalAction = ({ bundle, ...others }) => {
|
|
24
|
+
const { component } = internalActions.find(
|
|
25
|
+
(internalAction) => internalAction.bundle === bundle
|
|
26
|
+
) ?? {};
|
|
27
|
+
if (!component) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
const Action = lazy(
|
|
31
|
+
() => component()
|
|
32
|
+
);
|
|
33
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Action, { ...others }) });
|
|
34
|
+
};
|
|
35
|
+
const InternalAction$1 = memo(InternalAction);
|
|
36
|
+
export {
|
|
37
|
+
InternalAction$1 as default,
|
|
38
|
+
internalActions
|
|
39
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
import { HvLoading } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
const StyledLoading = styled(HvLoading)({
|
|
4
|
+
display: "flex",
|
|
5
|
+
alignItems: "center",
|
|
6
|
+
width: "100%",
|
|
7
|
+
height: "100%"
|
|
8
|
+
});
|
|
9
|
+
styled("main")({
|
|
10
|
+
flex: 1
|
|
11
|
+
});
|
|
12
|
+
export {
|
|
13
|
+
StyledLoading
|
|
14
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { css } from "@emotion/css";
|
|
3
|
+
import { useTheme, theme } from "@hitachivantara/uikit-react-core";
|
|
4
|
+
import { useLayoutContext } from "../../../providers/LayoutProvider.mjs";
|
|
5
|
+
import { useNavigationContext } from "../../../providers/NavigationProvider.mjs";
|
|
6
|
+
import { StyledContainer, StyledMain } from "./styles.mjs";
|
|
7
|
+
import VerticalNavigation from "../VerticalNavigation/VerticalNavigation.mjs";
|
|
8
|
+
const Main = ({ children }) => {
|
|
9
|
+
const {
|
|
10
|
+
hasVerticalNavigation,
|
|
11
|
+
verticalNavigationMode,
|
|
12
|
+
showHeaderSubMenu,
|
|
13
|
+
isCompactMode,
|
|
14
|
+
switchVerticalNavigationMode
|
|
15
|
+
} = useNavigationContext();
|
|
16
|
+
const { bannerMaxHeight, verticalNavigationWidth } = useLayoutContext();
|
|
17
|
+
const { activeTheme } = useTheme();
|
|
18
|
+
const isPentahoTheme = activeTheme?.name === "pentahoPlus";
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
StyledContainer,
|
|
21
|
+
{
|
|
22
|
+
style: {
|
|
23
|
+
["--vNavWidth"]: `${verticalNavigationWidth}px`,
|
|
24
|
+
["--headerHeight"]: showHeaderSubMenu && !isCompactMode ? `calc(${theme.header.height} + ${theme.header.secondLevelHeight})` : theme.header.height
|
|
25
|
+
},
|
|
26
|
+
children: [
|
|
27
|
+
hasVerticalNavigation && verticalNavigationMode !== "CLOSED" && /* @__PURE__ */ jsx(
|
|
28
|
+
VerticalNavigation,
|
|
29
|
+
{
|
|
30
|
+
onClickAway: isCompactMode ? switchVerticalNavigationMode : void 0
|
|
31
|
+
}
|
|
32
|
+
),
|
|
33
|
+
/* @__PURE__ */ jsx(
|
|
34
|
+
StyledMain,
|
|
35
|
+
{
|
|
36
|
+
className: isPentahoTheme ? void 0 : css({
|
|
37
|
+
paddingTop: bannerMaxHeight ? `calc(${bannerMaxHeight}px + ${theme.space.xs})` : void 0
|
|
38
|
+
}),
|
|
39
|
+
children
|
|
40
|
+
}
|
|
41
|
+
)
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
export {
|
|
47
|
+
Main as default
|
|
48
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import styled from "@emotion/styled";
|
|
2
|
+
const StyledContainer = styled.div({
|
|
3
|
+
display: "flex",
|
|
4
|
+
minHeight: "100vh",
|
|
5
|
+
paddingTop: "var(--headerHeight)"
|
|
6
|
+
});
|
|
7
|
+
const StyledMain = styled.main({
|
|
8
|
+
flex: 1,
|
|
9
|
+
width: "calc(100% - var(--vNavWidth))"
|
|
10
|
+
});
|
|
11
|
+
export {
|
|
12
|
+
StyledContainer,
|
|
13
|
+
StyledMain
|
|
14
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useTranslation } from "react-i18next";
|
|
3
|
+
import { cx } from "@emotion/css";
|
|
4
|
+
import { HvTypography, HvButton } from "@hitachivantara/uikit-react-core";
|
|
5
|
+
import { Start, End } from "@hitachivantara/uikit-react-icons";
|
|
6
|
+
import { classes } from "./styles.mjs";
|
|
7
|
+
const NavigationCollapse = ({ onClick, isOpen }) => {
|
|
8
|
+
const { t } = useTranslation(void 0, { keyPrefix: "verticalNavigation" });
|
|
9
|
+
return /* @__PURE__ */ jsxs("div", { className: classes.navigationCollapse, children: [
|
|
10
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
11
|
+
HvTypography,
|
|
12
|
+
{
|
|
13
|
+
variant: "label",
|
|
14
|
+
className: classes.navigationCollapseText,
|
|
15
|
+
children: t("collapseAction")
|
|
16
|
+
}
|
|
17
|
+
),
|
|
18
|
+
/* @__PURE__ */ jsx(
|
|
19
|
+
HvButton,
|
|
20
|
+
{
|
|
21
|
+
className: cx(classes.navigationCollapseButton, {
|
|
22
|
+
[classes.navigationCollapseAlignRight]: isOpen
|
|
23
|
+
}),
|
|
24
|
+
"aria-label": isOpen ? t("ariaLabelCollapse") : t("ariaLabelExpand"),
|
|
25
|
+
icon: true,
|
|
26
|
+
onClick,
|
|
27
|
+
children: isOpen ? /* @__PURE__ */ jsx(Start, {}) : /* @__PURE__ */ jsx(End, {})
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
NavigationCollapse
|
|
34
|
+
};
|
package/dist/esm/components/layout/VerticalNavigation/{NavigationHeader.js → NavigationHeader.mjs}
RENAMED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { jsxs, jsx } from "
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useHvAppShellConfig } from "@hitachivantara/app-shell-shared";
|
|
3
3
|
import { AppSwitcher } from "@hitachivantara/uikit-react-icons";
|
|
4
|
-
import { classes } from "./styles.
|
|
5
|
-
import BrandLogo from "../BrandLogo/BrandLogo.
|
|
6
|
-
const NavigationHeader = ({
|
|
7
|
-
isOpen
|
|
8
|
-
}) => {
|
|
4
|
+
import { classes } from "./styles.mjs";
|
|
5
|
+
import BrandLogo from "../BrandLogo/BrandLogo.mjs";
|
|
6
|
+
const NavigationHeader = ({ isOpen }) => {
|
|
9
7
|
const appShellConfig = useHvAppShellConfig();
|
|
10
8
|
return /* @__PURE__ */ jsxs("div", { className: classes.navigationHeader, children: [
|
|
11
9
|
/* @__PURE__ */ jsx(AppSwitcher, {}),
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { useTranslation } from "react-i18next";
|
|
4
|
+
import { cx } from "@emotion/css";
|
|
5
|
+
import { useHvNavigation } from "@hitachivantara/app-shell-navigation";
|
|
6
|
+
import { useTheme, HvVerticalNavigation, HvVerticalNavigationHeader, HvVerticalNavigationTree, HvVerticalNavigationActions } from "@hitachivantara/uikit-react-core";
|
|
7
|
+
import { useResizeObserver } from "../../../hooks/useResizeObserver.mjs";
|
|
8
|
+
import { useLayoutContext } from "../../../providers/LayoutProvider.mjs";
|
|
9
|
+
import { useNavigationContext } from "../../../providers/NavigationProvider.mjs";
|
|
10
|
+
import withClickAwayListener from "../../hoc/withClickAwayListener.mjs";
|
|
11
|
+
import { NavigationCollapse } from "./NavigationCollapse.mjs";
|
|
12
|
+
import { NavigationHeader } from "./NavigationHeader.mjs";
|
|
13
|
+
import { classes } from "./styles.mjs";
|
|
14
|
+
const VerticalNavigation = () => {
|
|
15
|
+
const { t } = useTranslation(void 0, { keyPrefix: "verticalNavigation" });
|
|
16
|
+
const {
|
|
17
|
+
selectedMenuItemId,
|
|
18
|
+
rootMenuItemId,
|
|
19
|
+
verticalNavigationItems,
|
|
20
|
+
isCompactMode,
|
|
21
|
+
verticalNavigationMode,
|
|
22
|
+
switchVerticalNavigationMode
|
|
23
|
+
} = useNavigationContext();
|
|
24
|
+
const { setVerticalNavigationWidth } = useLayoutContext();
|
|
25
|
+
const { navigate } = useHvNavigation();
|
|
26
|
+
const { activeTheme } = useTheme();
|
|
27
|
+
const ref = useRef(null);
|
|
28
|
+
const open = verticalNavigationMode === "EXPANDED";
|
|
29
|
+
const isPentahoTheme = activeTheme?.name === "pentahoPlus";
|
|
30
|
+
const changeHandler = (event, selectedItem) => {
|
|
31
|
+
event.preventDefault();
|
|
32
|
+
if (selectedItem.href) {
|
|
33
|
+
navigate(selectedItem.href, {
|
|
34
|
+
state: { selectedItemId: selectedItem.id }
|
|
35
|
+
});
|
|
36
|
+
if (isCompactMode) {
|
|
37
|
+
switchVerticalNavigationMode();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
useResizeObserver(ref, (width) => {
|
|
42
|
+
setVerticalNavigationWidth(isCompactMode ? 0 : width);
|
|
43
|
+
});
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
HvVerticalNavigation,
|
|
46
|
+
{
|
|
47
|
+
ref,
|
|
48
|
+
className: cx(classes.root, {
|
|
49
|
+
[classes.pentaho]: isPentahoTheme && !isCompactMode,
|
|
50
|
+
[classes.compact]: isCompactMode
|
|
51
|
+
}),
|
|
52
|
+
open,
|
|
53
|
+
useIcons: true,
|
|
54
|
+
slider: isCompactMode,
|
|
55
|
+
children: [
|
|
56
|
+
isPentahoTheme ? /* @__PURE__ */ jsx(NavigationHeader, { isOpen: open }) : /* @__PURE__ */ jsx(
|
|
57
|
+
HvVerticalNavigationHeader,
|
|
58
|
+
{
|
|
59
|
+
title: t("title"),
|
|
60
|
+
onCollapseButtonClick: !isCompactMode ? switchVerticalNavigationMode : void 0,
|
|
61
|
+
collapseButtonProps: {
|
|
62
|
+
"aria-label": t(open ? "ariaLabelCollapse" : "ariaLabelExpand"),
|
|
63
|
+
"aria-expanded": open
|
|
64
|
+
},
|
|
65
|
+
backButtonProps: {
|
|
66
|
+
"aria-label": t("ariaLabelHeaderBackButton")
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
HvVerticalNavigationTree,
|
|
72
|
+
{
|
|
73
|
+
mode: "navigation",
|
|
74
|
+
collapsible: true,
|
|
75
|
+
"aria-label": t("ariaLabelNavigationTree"),
|
|
76
|
+
selected: selectedMenuItemId,
|
|
77
|
+
onChange: changeHandler,
|
|
78
|
+
data: verticalNavigationItems,
|
|
79
|
+
classes: { navigationPopup: classes.popup },
|
|
80
|
+
sliderForwardButtonAriaLabel: t("ariaLabelSliderForwardButton")
|
|
81
|
+
},
|
|
82
|
+
rootMenuItemId
|
|
83
|
+
),
|
|
84
|
+
isPentahoTheme ? /* @__PURE__ */ jsx(
|
|
85
|
+
NavigationCollapse,
|
|
86
|
+
{
|
|
87
|
+
onClick: () => switchVerticalNavigationMode(),
|
|
88
|
+
isOpen: open
|
|
89
|
+
}
|
|
90
|
+
) : /* @__PURE__ */ jsx(HvVerticalNavigationActions, {})
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
};
|
|
95
|
+
const VerticalNavigation$1 = withClickAwayListener(VerticalNavigation);
|
|
96
|
+
export {
|
|
97
|
+
VerticalNavigation$1 as default
|
|
98
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { css } from "@emotion/css";
|
|
2
|
+
import { theme, verticalNavigationTreeClasses } from "@hitachivantara/uikit-react-core";
|
|
3
|
+
const classes = {
|
|
4
|
+
root: css({
|
|
5
|
+
height: `calc(100vh - ${theme.header.height})`,
|
|
6
|
+
top: theme.header.height,
|
|
7
|
+
zIndex: theme.zIndices.overlay,
|
|
8
|
+
position: "sticky"
|
|
9
|
+
}),
|
|
10
|
+
/** full-height Vertical Navigation */
|
|
11
|
+
pentaho: css({
|
|
12
|
+
height: "100dvh",
|
|
13
|
+
marginTop: `calc(-1 * var(--headerHeight))`,
|
|
14
|
+
top: 0
|
|
15
|
+
}),
|
|
16
|
+
compact: css({
|
|
17
|
+
position: "fixed",
|
|
18
|
+
top: theme.header.height
|
|
19
|
+
}),
|
|
20
|
+
popup: css({
|
|
21
|
+
maxHeight: `calc(100vh - ${theme.header.height})`,
|
|
22
|
+
overflowY: "auto",
|
|
23
|
+
boxShadow: theme.colors.shadow,
|
|
24
|
+
[`& .${verticalNavigationTreeClasses.popup}`]: { boxShadow: "none" }
|
|
25
|
+
}),
|
|
26
|
+
navigationHeader: css({
|
|
27
|
+
display: "flex",
|
|
28
|
+
width: "100%",
|
|
29
|
+
alignItems: "center",
|
|
30
|
+
"& svg path": {
|
|
31
|
+
fill: theme.colors.base_light
|
|
32
|
+
},
|
|
33
|
+
gap: theme.space.xs
|
|
34
|
+
}),
|
|
35
|
+
navigationCollapse: css({
|
|
36
|
+
position: "absolute",
|
|
37
|
+
bottom: 0,
|
|
38
|
+
display: "flex",
|
|
39
|
+
width: "100%",
|
|
40
|
+
alignItems: "center",
|
|
41
|
+
justifyContent: "center"
|
|
42
|
+
}),
|
|
43
|
+
navigationCollapseButton: css({
|
|
44
|
+
color: "inherit"
|
|
45
|
+
}),
|
|
46
|
+
navigationCollapseAlignRight: css({
|
|
47
|
+
marginLeft: "auto"
|
|
48
|
+
}),
|
|
49
|
+
navigationCollapseText: css({
|
|
50
|
+
color: "inherit"
|
|
51
|
+
})
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
classes
|
|
55
|
+
};
|
|
@@ -3,16 +3,12 @@ import { useLocation, useBeforeUnload } from "react-router-dom";
|
|
|
3
3
|
import { useHvNavigation } from "@hitachivantara/app-shell-navigation";
|
|
4
4
|
const useClearLocationState = () => {
|
|
5
5
|
const location = useLocation();
|
|
6
|
-
const {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
navigate
|
|
11
|
-
|
|
12
|
-
}, {
|
|
13
|
-
replace: true
|
|
14
|
-
});
|
|
15
|
-
}, [location, navigate]));
|
|
6
|
+
const { navigate } = useHvNavigation();
|
|
7
|
+
useBeforeUnload(
|
|
8
|
+
useCallback(() => {
|
|
9
|
+
navigate({ ...location }, { replace: true });
|
|
10
|
+
}, [location, navigate])
|
|
11
|
+
);
|
|
16
12
|
};
|
|
17
13
|
export {
|
|
18
14
|
useClearLocationState as default
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { HvAppShellEventNotificationTrigger, HvAppShellEventThemeTrigger } from "@hitachivantara/app-shell-events";
|
|
3
|
+
import useNotificationsEventListener from "./useNotificationsEventListener.mjs";
|
|
4
|
+
import useThemeEventListener from "./useThemeEventListener.mjs";
|
|
5
|
+
const useCustomEventListener = () => {
|
|
6
|
+
const { handleNotificationEvent } = useNotificationsEventListener();
|
|
7
|
+
const { handleThemeEvent } = useThemeEventListener();
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
globalThis.addEventListener(
|
|
10
|
+
HvAppShellEventNotificationTrigger,
|
|
11
|
+
handleNotificationEvent
|
|
12
|
+
);
|
|
13
|
+
globalThis.addEventListener(
|
|
14
|
+
HvAppShellEventThemeTrigger,
|
|
15
|
+
handleThemeEvent
|
|
16
|
+
);
|
|
17
|
+
return () => {
|
|
18
|
+
globalThis.removeEventListener(
|
|
19
|
+
HvAppShellEventNotificationTrigger,
|
|
20
|
+
handleNotificationEvent
|
|
21
|
+
);
|
|
22
|
+
globalThis.removeEventListener(
|
|
23
|
+
HvAppShellEventThemeTrigger,
|
|
24
|
+
handleThemeEvent
|
|
25
|
+
);
|
|
26
|
+
};
|
|
27
|
+
}, [handleNotificationEvent, handleThemeEvent]);
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
useCustomEventListener as default
|
|
31
|
+
};
|