@hitachivantara/app-shell-ui 1.5.0 → 1.6.1

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 (144) hide show
  1. package/dist/esm/components/AppShell/AppShell.js +8 -6
  2. package/dist/esm/components/AppShellProvider/AppShellProvider.js +80 -56
  3. package/dist/esm/components/AppShellRoutes/AppShellRoutes.js +74 -65
  4. package/dist/esm/components/AppShellViewProvider/AppShellViewProvider.js +13 -13
  5. package/dist/esm/components/CustomHooksInitializer/CustomHooksInitializer.js +9 -5
  6. package/dist/esm/components/GlobalStyles/GlobalStyles.js +8 -8
  7. package/dist/esm/components/GlobalStyles/index.js +2 -3
  8. package/dist/esm/components/IconUiKit/IconUiKit.js +10 -8
  9. package/dist/esm/components/IconUiKit/index.js +4 -5
  10. package/dist/esm/components/hoc/withClickAwayListener.js +19 -12
  11. package/dist/esm/components/hoc/withGlobalProvider.js +30 -25
  12. package/dist/esm/components/layout/Header/BrandLogo/BrandLogo.js +27 -16
  13. package/dist/esm/components/layout/Header/BrandLogo/Logos/Hitachi.js +12 -0
  14. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada.js +17 -0
  15. package/dist/esm/components/layout/Header/BrandLogo/Logos/Pentaho.js +12 -0
  16. package/dist/esm/components/layout/Header/Header.js +54 -42
  17. package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/DynamicAction.js +22 -18
  18. package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/index.js +2 -3
  19. package/dist/esm/components/layout/Header/HeaderActions/HeaderActions.js +17 -14
  20. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/AppSwitcherToggle.js +59 -40
  21. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/index.js +2 -3
  22. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.js +6 -6
  23. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/ColorModeSwitcher.js +19 -17
  24. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/index.js +2 -3
  25. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.js +23 -20
  26. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/index.js +2 -3
  27. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/InternalAction/InternalAction.js +23 -21
  28. package/dist/esm/components/layout/Header/HeaderActions/index.js +2 -3
  29. package/dist/esm/components/layout/Header/styles.js +7 -7
  30. package/dist/esm/components/layout/Loading/Loading.js +9 -7
  31. package/dist/esm/components/layout/Loading/styles.js +20 -8
  32. package/dist/esm/components/layout/Main/Main.js +23 -22
  33. package/dist/esm/components/layout/Main/styles.js +17 -8
  34. package/dist/esm/components/layout/VerticalNavigation/VerticalNavigation.js +67 -49
  35. package/dist/esm/components/layout/VerticalNavigation/styles.js +15 -16
  36. package/dist/esm/index.js +2 -3
  37. package/dist/esm/lib/hooks/useClearLocationState.js +14 -14
  38. package/dist/esm/lib/hooks/useCustomEventListener.js +19 -14
  39. package/dist/esm/lib/hooks/useLocalStorage.js +22 -16
  40. package/dist/esm/lib/hooks/useNavigationMenuItems.js +36 -28
  41. package/dist/esm/lib/hooks/useNotificationsEventListener.js +47 -37
  42. package/dist/esm/lib/hooks/useThemeEventListener.js +25 -20
  43. package/dist/esm/lib/i18n/index.js +23 -19
  44. package/dist/esm/lib/i18n/localization/en.json.js +18 -15
  45. package/dist/esm/lib/i18n/localization/pt.json.js +18 -15
  46. package/dist/esm/lib/utils/CombinedProviders.js +19 -14
  47. package/dist/esm/lib/utils/basePathUtils.js +4 -3
  48. package/dist/esm/lib/utils/documentUtil.js +10 -6
  49. package/dist/esm/lib/utils/navigationUtil.js +65 -38
  50. package/dist/esm/lib/utils/textUtil.js +4 -3
  51. package/dist/esm/pages/ErrorPage/ErrorPage.js +24 -24
  52. package/dist/esm/pages/ErrorPage/Footer/Footer.js +47 -31
  53. package/dist/esm/pages/ErrorPage/Footer/styles.js +8 -8
  54. package/dist/esm/pages/ErrorPage/styles.js +25 -15
  55. package/dist/esm/pages/GenericError/500.svg.js +2 -3
  56. package/dist/esm/pages/GenericError/GenericError.js +13 -13
  57. package/dist/esm/pages/LoadingPage/LoadingPage.js +12 -12
  58. package/dist/esm/pages/LoadingPage/index.js +2 -3
  59. package/dist/esm/pages/LoadingPage/styles.js +15 -9
  60. package/dist/esm/pages/NotFound/404.svg.js +2 -3
  61. package/dist/esm/pages/NotFound/NotFound.js +11 -11
  62. package/dist/esm/pages/NotFound/index.js +2 -3
  63. package/dist/esm/pages/Root/Root.js +22 -22
  64. package/dist/esm/providers/BannerProvider.js +67 -57
  65. package/dist/esm/providers/LayoutProvider.js +19 -16
  66. package/dist/esm/providers/NavigationProvider.js +87 -55
  67. package/dist/esm/providers/hooks/useBannerContext.js +9 -7
  68. package/dist/esm/providers/hooks/useLayoutContext.js +9 -7
  69. package/dist/esm/providers/hooks/useNavigationContext.js +9 -7
  70. package/package.json +5 -5
  71. package/dist/esm/components/AppShell/AppShell.js.map +0 -1
  72. package/dist/esm/components/AppShellProvider/AppShellProvider.js.map +0 -1
  73. package/dist/esm/components/AppShellRoutes/AppShellRoutes.js.map +0 -1
  74. package/dist/esm/components/AppShellViewProvider/AppShellViewProvider.js.map +0 -1
  75. package/dist/esm/components/CustomHooksInitializer/CustomHooksInitializer.js.map +0 -1
  76. package/dist/esm/components/GlobalStyles/GlobalStyles.js.map +0 -1
  77. package/dist/esm/components/GlobalStyles/index.js.map +0 -1
  78. package/dist/esm/components/IconUiKit/IconUiKit.js.map +0 -1
  79. package/dist/esm/components/IconUiKit/index.js.map +0 -1
  80. package/dist/esm/components/hoc/withClickAwayListener.js.map +0 -1
  81. package/dist/esm/components/hoc/withGlobalProvider.js.map +0 -1
  82. package/dist/esm/components/layout/Header/BrandLogo/BrandLogo.js.map +0 -1
  83. package/dist/esm/components/layout/Header/BrandLogo/Logos/Hitachi/Hitachi.js +0 -10
  84. package/dist/esm/components/layout/Header/BrandLogo/Logos/Hitachi/Hitachi.js.map +0 -1
  85. package/dist/esm/components/layout/Header/BrandLogo/Logos/Hitachi/styles.js +0 -28
  86. package/dist/esm/components/layout/Header/BrandLogo/Logos/Hitachi/styles.js.map +0 -1
  87. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada/Lumada.js +0 -15
  88. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada/Lumada.js.map +0 -1
  89. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada/styles.js +0 -34
  90. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada/styles.js.map +0 -1
  91. package/dist/esm/components/layout/Header/Header.js.map +0 -1
  92. package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/DynamicAction.js.map +0 -1
  93. package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/index.js.map +0 -1
  94. package/dist/esm/components/layout/Header/HeaderActions/HeaderActions.js.map +0 -1
  95. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/AppSwitcherToggle.js.map +0 -1
  96. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/index.js.map +0 -1
  97. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.js.map +0 -1
  98. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/ColorModeSwitcher.js.map +0 -1
  99. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/index.js.map +0 -1
  100. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.js.map +0 -1
  101. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/index.js.map +0 -1
  102. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/InternalAction/InternalAction.js.map +0 -1
  103. package/dist/esm/components/layout/Header/HeaderActions/index.js.map +0 -1
  104. package/dist/esm/components/layout/Header/styles.js.map +0 -1
  105. package/dist/esm/components/layout/Loading/Loading.js.map +0 -1
  106. package/dist/esm/components/layout/Loading/styles.js.map +0 -1
  107. package/dist/esm/components/layout/Main/Main.js.map +0 -1
  108. package/dist/esm/components/layout/Main/styles.js.map +0 -1
  109. package/dist/esm/components/layout/VerticalNavigation/VerticalNavigation.js.map +0 -1
  110. package/dist/esm/components/layout/VerticalNavigation/styles.js.map +0 -1
  111. package/dist/esm/index.js.map +0 -1
  112. package/dist/esm/lib/hooks/useClearLocationState.js.map +0 -1
  113. package/dist/esm/lib/hooks/useCustomEventListener.js.map +0 -1
  114. package/dist/esm/lib/hooks/useLocalStorage.js.map +0 -1
  115. package/dist/esm/lib/hooks/useNavigationMenuItems.js.map +0 -1
  116. package/dist/esm/lib/hooks/useNotificationsEventListener.js.map +0 -1
  117. package/dist/esm/lib/hooks/useThemeEventListener.js.map +0 -1
  118. package/dist/esm/lib/i18n/index.js.map +0 -1
  119. package/dist/esm/lib/i18n/localization/en.json.js.map +0 -1
  120. package/dist/esm/lib/i18n/localization/pt.json.js.map +0 -1
  121. package/dist/esm/lib/utils/CombinedProviders.js.map +0 -1
  122. package/dist/esm/lib/utils/basePathUtils.js.map +0 -1
  123. package/dist/esm/lib/utils/documentUtil.js.map +0 -1
  124. package/dist/esm/lib/utils/navigationUtil.js.map +0 -1
  125. package/dist/esm/lib/utils/textUtil.js.map +0 -1
  126. package/dist/esm/pages/ErrorPage/ErrorPage.js.map +0 -1
  127. package/dist/esm/pages/ErrorPage/Footer/Footer.js.map +0 -1
  128. package/dist/esm/pages/ErrorPage/Footer/styles.js.map +0 -1
  129. package/dist/esm/pages/ErrorPage/styles.js.map +0 -1
  130. package/dist/esm/pages/GenericError/500.svg.js.map +0 -1
  131. package/dist/esm/pages/GenericError/GenericError.js.map +0 -1
  132. package/dist/esm/pages/LoadingPage/LoadingPage.js.map +0 -1
  133. package/dist/esm/pages/LoadingPage/index.js.map +0 -1
  134. package/dist/esm/pages/LoadingPage/styles.js.map +0 -1
  135. package/dist/esm/pages/NotFound/404.svg.js.map +0 -1
  136. package/dist/esm/pages/NotFound/NotFound.js.map +0 -1
  137. package/dist/esm/pages/NotFound/index.js.map +0 -1
  138. package/dist/esm/pages/Root/Root.js.map +0 -1
  139. package/dist/esm/providers/BannerProvider.js.map +0 -1
  140. package/dist/esm/providers/LayoutProvider.js.map +0 -1
  141. package/dist/esm/providers/NavigationProvider.js.map +0 -1
  142. package/dist/esm/providers/hooks/useBannerContext.js.map +0 -1
  143. package/dist/esm/providers/hooks/useLayoutContext.js.map +0 -1
  144. package/dist/esm/providers/hooks/useNavigationContext.js.map +0 -1
@@ -1,27 +1,32 @@
1
- import { useTheme as h } from "@hitachivantara/uikit-react-core";
2
- import m from "./useLocalStorage.js";
3
- const u = () => {
1
+ import { useTheme } from "@hitachivantara/uikit-react-core";
2
+ import useLocalStorage from "./useLocalStorage.js";
3
+ const useThemeEventListener = () => {
4
4
  const {
5
- selectedTheme: s,
6
- changeTheme: d,
7
- selectedMode: r,
8
- colorModes: o
9
- } = h(), {
10
- setStoredValue: c
11
- } = m("COLOR_MODE"), l = () => {
12
- const e = (o.indexOf(r) + 1) % o.length;
13
- return o[e];
5
+ selectedTheme,
6
+ changeTheme,
7
+ selectedMode,
8
+ colorModes
9
+ } = useTheme();
10
+ const {
11
+ setStoredValue
12
+ } = useLocalStorage("COLOR_MODE");
13
+ const getNextColorMode = () => {
14
+ const index = colorModes.indexOf(selectedMode);
15
+ const nextIndex = (index + 1) % colorModes.length;
16
+ return colorModes[nextIndex];
17
+ };
18
+ const handleThemeEvent = (event) => {
19
+ const {
20
+ colorMode
21
+ } = event.detail;
22
+ const newColorMode = !colorMode || colorModes.indexOf(colorMode) === -1 ? getNextColorMode() : colorMode;
23
+ changeTheme(selectedTheme, newColorMode);
24
+ setStoredValue(newColorMode);
14
25
  };
15
26
  return {
16
- handleThemeEvent: (t) => {
17
- const {
18
- colorMode: e
19
- } = t.detail, n = !e || o.indexOf(e) === -1 ? l() : e;
20
- d(s, n), c(n);
21
- }
27
+ handleThemeEvent
22
28
  };
23
29
  };
24
30
  export {
25
- u as default
31
+ useThemeEventListener as default
26
32
  };
27
- //# sourceMappingURL=useThemeEventListener.js.map
@@ -1,29 +1,33 @@
1
- import s from "i18next";
2
- import { initReactI18next as d } from "react-i18next";
3
- import u from "i18next-browser-languagedetector";
4
- import i from "./localization/en.json.js";
5
- import l from "./localization/pt.json.js";
6
- const t = "appShell", x = (e, n, r) => {
7
- Object.entries(n).forEach((o) => {
8
- const [a, c] = o;
9
- e.addResourceBundle(a, r ?? t, c);
1
+ import i18next from "i18next";
2
+ import { initReactI18next } from "react-i18next";
3
+ import LanguageDetector from "i18next-browser-languagedetector";
4
+ import en from "./localization/en.json.js";
5
+ import pt from "./localization/pt.json.js";
6
+ const APP_SHELL_NAMESPACE = "appShell";
7
+ const addResourceBundles = (i18nInstance, bundles, namespace) => {
8
+ Object.entries(bundles).forEach((entry) => {
9
+ const [key, value] = entry;
10
+ i18nInstance.addResourceBundle(key, namespace ?? APP_SHELL_NAMESPACE, value);
10
11
  });
11
- }, B = () => {
12
- const e = s.createInstance();
13
- return e.use(u).use(d).init({
14
- defaultNS: t,
12
+ };
13
+ const createI18Next = () => {
14
+ const newInstance = i18next.createInstance();
15
+ newInstance.use(LanguageDetector).use(initReactI18next).init({
16
+ defaultNS: APP_SHELL_NAMESPACE,
15
17
  fallbackLng: "en",
16
18
  detection: {
17
19
  order: ["navigator"]
18
20
  },
19
21
  resources: {}
20
- }), e.addResourceBundle("en", t, i), e.addResourceBundle("pt", t, l), {
21
- i18n: e
22
+ });
23
+ newInstance.addResourceBundle("en", APP_SHELL_NAMESPACE, en);
24
+ newInstance.addResourceBundle("pt", APP_SHELL_NAMESPACE, pt);
25
+ return {
26
+ i18n: newInstance
22
27
  };
23
28
  };
24
29
  export {
25
- t as APP_SHELL_NAMESPACE,
26
- x as addResourceBundles,
27
- B as default
30
+ APP_SHELL_NAMESPACE,
31
+ addResourceBundles,
32
+ createI18Next as default
28
33
  };
29
- //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- const a = {
1
+ const errors = {
2
2
  missing: {
3
3
  configuration: "Missing or incomplete configuration."
4
4
  },
@@ -13,7 +13,8 @@ const a = {
13
13
  image_description: "500 Generic error"
14
14
  },
15
15
  footer: "Click <navigate>here</navigate> to go back to the {{label}} page."
16
- }, e = {
16
+ };
17
+ const header = {
17
18
  helpUrl: {
18
19
  documentationLink: "Documentation link"
19
20
  },
@@ -28,28 +29,30 @@ const a = {
28
29
  colorModeSwitcher: {
29
30
  ariaLabel: "Switch color mode"
30
31
  }
31
- }, i = {
32
+ };
33
+ const verticalNavigation = {
32
34
  ariaLabelNavigationTree: "Vertical navigation",
33
35
  ariaLabelCollapse: "Collapse vertical navigation",
34
36
  ariaLabelExpand: "Expand vertical navigation",
35
37
  title: "Menu",
36
38
  ariaLabelSliderForwardButton: "Navigate to submenu",
37
39
  ariaLabelHeaderBackButton: "Back"
38
- }, o = {
40
+ };
41
+ const notifications = {
39
42
  banner: {
40
43
  close: "Close banner"
41
44
  }
42
- }, n = {
43
- errors: a,
44
- header: e,
45
- verticalNavigation: i,
46
- notifications: o
45
+ };
46
+ const en = {
47
+ errors,
48
+ header,
49
+ verticalNavigation,
50
+ notifications
47
51
  };
48
52
  export {
49
- n as default,
50
- a as errors,
51
- e as header,
52
- o as notifications,
53
- i as verticalNavigation
53
+ en as default,
54
+ errors,
55
+ header,
56
+ notifications,
57
+ verticalNavigation
54
58
  };
55
- //# sourceMappingURL=en.json.js.map
@@ -1,4 +1,4 @@
1
- const a = {
1
+ const errors = {
2
2
  missing: {
3
3
  configuration: "Configuração em falta ou incompleta."
4
4
  },
@@ -13,7 +13,8 @@ const a = {
13
13
  image_description: "500 Erro genérico"
14
14
  },
15
15
  footer: "Carregue <navigate>aqui</navigate> para voltar à página {{label}}."
16
- }, e = {
16
+ };
17
+ const header = {
17
18
  helpUrl: {
18
19
  documentationLink: "Link de documentação"
19
20
  },
@@ -28,28 +29,30 @@ const a = {
28
29
  colorModeSwitcher: {
29
30
  ariaLabel: "Alternar modo de cor"
30
31
  }
31
- }, o = {
32
+ };
33
+ const verticalNavigation = {
32
34
  ariaLabelNavigationTree: "Navegação vertical",
33
35
  ariaLabelCollapse: "Recolher navegação vertical",
34
36
  ariaLabelExpand: "Expandir navegação vertical",
35
37
  title: "Menu",
36
38
  ariaLabelSliderForwardButton: "Navegar para submenu",
37
39
  ariaLabelHeaderBackButton: "Voltar"
38
- }, i = {
40
+ };
41
+ const notifications = {
39
42
  banner: {
40
43
  close: "Fechar barra de notificação"
41
44
  }
42
- }, r = {
43
- errors: a,
44
- header: e,
45
- verticalNavigation: o,
46
- notifications: i
45
+ };
46
+ const pt = {
47
+ errors,
48
+ header,
49
+ verticalNavigation,
50
+ notifications
47
51
  };
48
52
  export {
49
- r as default,
50
- a as errors,
51
- e as header,
52
- i as notifications,
53
- o as verticalNavigation
53
+ pt as default,
54
+ errors,
55
+ header,
56
+ notifications,
57
+ verticalNavigation
54
58
  };
55
- //# sourceMappingURL=pt.json.js.map
@@ -1,18 +1,23 @@
1
- import { jsx as n } from "@emotion/react/jsx-runtime";
2
- import { useCallback as m } from "react";
3
- const u = ({
4
- providers: e,
5
- children: o
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useCallback } from "react";
3
+ const CombinedProviders = ({
4
+ providers,
5
+ children: mainChildren
6
6
  }) => {
7
- const i = m(({
8
- children: t
7
+ const Combined = useCallback(({
8
+ children
9
9
  }) => {
10
- let r = t;
11
- return e && e.length > 0 && (r = e.reduceRight((l, c) => /* @__PURE__ */ n(c, { children: l }), t)), r;
12
- }, [e]);
13
- return /* @__PURE__ */ n(i, { children: o });
14
- }, a = u;
10
+ let result = children;
11
+ if (providers && providers.length > 0) {
12
+ result = providers.reduceRight((Acc, Curr) => {
13
+ return /* @__PURE__ */ jsx(Curr, { children: Acc });
14
+ }, children);
15
+ }
16
+ return result;
17
+ }, [providers]);
18
+ return /* @__PURE__ */ jsx(Combined, { children: mainChildren });
19
+ };
20
+ const CombinedProviders$1 = CombinedProviders;
15
21
  export {
16
- a as default
22
+ CombinedProviders$1 as default
17
23
  };
18
- //# sourceMappingURL=CombinedProviders.js.map
@@ -1,5 +1,6 @@
1
- const t = (e) => (e == null ? void 0 : e.baseUrl) ?? "/";
1
+ const getBasePath = (config) => {
2
+ return config?.baseUrl ?? "/";
3
+ };
2
4
  export {
3
- t as default
5
+ getBasePath as default
4
6
  };
5
- //# sourceMappingURL=basePathUtils.js.map
@@ -1,9 +1,13 @@
1
- const a = (t) => {
2
- const n = "app-shell-panel-container";
3
- let e = document.getElementById(t ?? n);
4
- return e || (e = document.createElement("div"), e.id = n, document.body.appendChild(e)), e;
1
+ const createAppContainerElement = (id) => {
2
+ const panelContainerId = "app-shell-panel-container";
3
+ let panelContainerElement = document.getElementById(id ?? panelContainerId);
4
+ if (!panelContainerElement) {
5
+ panelContainerElement = document.createElement("div");
6
+ panelContainerElement.id = panelContainerId;
7
+ document.body.appendChild(panelContainerElement);
8
+ }
9
+ return panelContainerElement;
5
10
  };
6
11
  export {
7
- a as default
12
+ createAppContainerElement as default
8
13
  };
9
- //# sourceMappingURL=documentUtil.js.map
@@ -1,41 +1,68 @@
1
- import { jsx as a } from "@emotion/react/jsx-runtime";
2
- import f from "../../components/IconUiKit/index.js";
3
- const l = (e, t, n) => n !== void 0 && n <= 0 ? [] : (t == null ? void 0 : t.reduce((r, o) => {
4
- var i;
5
- const d = n !== void 0 ? n - 1 : void 0, s = {
6
- ...o,
7
- icon: o.icon ? /* @__PURE__ */ a(f, { name: ((i = o.icon) == null ? void 0 : i.name) || "" }) : null,
8
- data: o.data ? l(e, o.data, d) : void 0
9
- };
10
- return r.push(s), r;
11
- }, [])) ?? [], c = (e, t) => {
12
- let n = null;
13
- return e.some((r) => {
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import IconUiKit from "../../components/IconUiKit/index.js";
3
+ const createNavigationMenuItems = (t, menuItems, maxDepth) => {
4
+ if (maxDepth !== void 0 && maxDepth <= 0) {
5
+ return [];
6
+ }
7
+ return menuItems?.reduce((accumulator, currentValue) => {
8
+ const updatedDepth = maxDepth !== void 0 ? maxDepth - 1 : void 0;
9
+ const navItem = {
10
+ ...currentValue,
11
+ icon: currentValue.icon ? /* @__PURE__ */ jsx(IconUiKit, { name: currentValue.icon?.name || "" }) : null,
12
+ data: currentValue.data ? createNavigationMenuItems(t, currentValue.data, updatedDepth) : void 0
13
+ };
14
+ accumulator.push(navItem);
15
+ return accumulator;
16
+ }, []) ?? [];
17
+ };
18
+ const findItemById = (data, itemId) => {
19
+ let foundItem = null;
20
+ data.some((obj) => {
14
21
  const {
15
- id: o,
16
- data: d
17
- } = r;
18
- return o === t ? (n = r, !0) : d && d.length > 0 ? (n = c(d, t), n !== null) : !1;
19
- }), n;
20
- }, h = (e) => {
21
- const t = e.split("/");
22
- let n;
23
- return t[0].startsWith("@") ? n = `${t[0]}/${t[1]}` : [n] = t, n;
24
- }, p = (e) => e.map((t) => {
25
- const {
26
- href: n,
27
- data: r,
28
- ...o
29
- } = t;
30
- return r && r.length > 0 ? {
31
- ...o,
32
- data: p(r)
33
- } : t;
34
- });
22
+ id: objId,
23
+ data: childData
24
+ } = obj;
25
+ if (objId === itemId) {
26
+ foundItem = obj;
27
+ return true;
28
+ }
29
+ if (childData && childData.length > 0) {
30
+ foundItem = findItemById(childData, itemId);
31
+ return foundItem !== null;
32
+ }
33
+ return false;
34
+ });
35
+ return foundItem;
36
+ };
37
+ const getAppIdFromBundle = (bundle) => {
38
+ const bundleTokens = bundle.split("/");
39
+ let appId;
40
+ if (bundleTokens[0].startsWith("@")) {
41
+ appId = `${bundleTokens[0]}/${bundleTokens[1]}`;
42
+ } else {
43
+ [appId] = bundleTokens;
44
+ }
45
+ return appId;
46
+ };
47
+ const removeHrefFromMenuItemsWithChildren = (items) => {
48
+ return items.map((item) => {
49
+ const {
50
+ href,
51
+ data,
52
+ ...rest
53
+ } = item;
54
+ if (data && data.length > 0) {
55
+ return {
56
+ ...rest,
57
+ data: removeHrefFromMenuItemsWithChildren(data)
58
+ };
59
+ }
60
+ return item;
61
+ });
62
+ };
35
63
  export {
36
- l as createNavigationMenuItems,
37
- c as findItemById,
38
- h as getAppIdFromBundle,
39
- p as removeHrefFromMenuItemsWithChildren
64
+ createNavigationMenuItems,
65
+ findItemById,
66
+ getAppIdFromBundle,
67
+ removeHrefFromMenuItemsWithChildren
40
68
  };
41
- //# sourceMappingURL=navigationUtil.js.map
@@ -1,5 +1,6 @@
1
- const t = (e, n) => e.includes(n);
1
+ const includesString = (value, searchParam) => {
2
+ return value.includes(searchParam);
3
+ };
2
4
  export {
3
- t as default
5
+ includesString as default
4
6
  };
5
- //# sourceMappingURL=textUtil.js.map
@@ -1,30 +1,30 @@
1
- import { jsxs as t, jsx as r } from "@emotion/react/jsx-runtime";
2
- import { HvTypography as a } from "@hitachivantara/uikit-react-core";
3
- import d from "../../providers/hooks/useNavigationContext.js";
4
- import { StyledErrorPage as g, StyledTitleWrapper as c, StyledImageWrapper as f } from "./styles.js";
5
- import u from "./Footer/Footer.js";
6
- const h = ({
7
- code: e = void 0,
8
- title: i,
9
- background: l,
10
- backgroundLabel: m,
11
- fullPage: n = !1,
12
- includeFooter: p = !0
1
+ import { jsxs, jsx } from "@emotion/react/jsx-runtime";
2
+ import { HvTypography } from "@hitachivantara/uikit-react-core";
3
+ import useNavigationContext from "../../providers/hooks/useNavigationContext.js";
4
+ import { StyledErrorPage, StyledTitleWrapper, StyledImageWrapper } from "./styles.js";
5
+ import Footer from "./Footer/Footer.js";
6
+ const ErrorPage = ({
7
+ code = void 0,
8
+ title,
9
+ background,
10
+ backgroundLabel,
11
+ fullPage = false,
12
+ includeFooter = true
13
13
  }) => {
14
14
  const {
15
- isCompactMode: o,
16
- showHeaderSubMenu: s
17
- } = d();
18
- return /* @__PURE__ */ t(g, { showHeaderSubMenu: s, isCompactMode: o, fullPage: n, children: [
19
- /* @__PURE__ */ t(c, { children: [
20
- e && /* @__PURE__ */ r(a, { variant: "title1", children: e }),
21
- /* @__PURE__ */ r(a, { variant: o ? "xsTitle" : "display", children: i })
15
+ isCompactMode,
16
+ showHeaderSubMenu
17
+ } = useNavigationContext();
18
+ return /* @__PURE__ */ jsxs(StyledErrorPage, { showHeaderSubMenu, isCompactMode, fullPage, children: [
19
+ /* @__PURE__ */ jsxs(StyledTitleWrapper, { children: [
20
+ code && /* @__PURE__ */ jsx(HvTypography, { variant: "title1", children: code }),
21
+ /* @__PURE__ */ jsx(HvTypography, { variant: isCompactMode ? "xsTitle" : "display", children: title })
22
22
  ] }),
23
- /* @__PURE__ */ r(f, { backgroundImage: l, role: "img", "aria-label": m }),
24
- p && /* @__PURE__ */ r(u, {})
23
+ /* @__PURE__ */ jsx(StyledImageWrapper, { backgroundImage: background, role: "img", "aria-label": backgroundLabel }),
24
+ includeFooter && /* @__PURE__ */ jsx(Footer, {})
25
25
  ] });
26
- }, E = h;
26
+ };
27
+ const ErrorPage$1 = ErrorPage;
27
28
  export {
28
- E as default
29
+ ErrorPage$1 as default
29
30
  };
30
- //# sourceMappingURL=ErrorPage.js.map
@@ -1,38 +1,54 @@
1
- import { jsx as r } from "@emotion/react/jsx-runtime";
2
- import { useTranslation as u, Trans as h } from "react-i18next";
3
- import { useErrorBoundary as v } from "react-error-boundary";
4
- import { HvTypography as i } from "@hitachivantara/uikit-react-core";
5
- import { useHvAppShellConfig as g } from "@hitachivantara/app-shell-shared";
6
- import { useHvNavigation as d } from "@hitachivantara/app-shell-navigation";
7
- import y from "../../../providers/hooks/useNavigationContext.js";
8
- import b from "./styles.js";
9
- const F = () => {
1
+ import { jsx } from "@emotion/react/jsx-runtime";
2
+ import { useTranslation, Trans } from "react-i18next";
3
+ import { useErrorBoundary } from "react-error-boundary";
4
+ import { HvTypography } from "@hitachivantara/uikit-react-core";
5
+ import { useHvAppShellConfig } from "@hitachivantara/app-shell-shared";
6
+ import { useHvNavigation } from "@hitachivantara/app-shell-navigation";
7
+ import useNavigationContext from "../../../providers/hooks/useNavigationContext.js";
8
+ import StyledFooterWrapper from "./styles.js";
9
+ const Footer = () => {
10
10
  const {
11
- t: a
12
- } = u(), {
13
- navigate: s
14
- } = d(), {
15
- navigationMode: l
16
- } = g(), {
17
- resetBoundary: m
18
- } = v(), {
19
- items: e,
20
- verticalNavigationItems: n,
21
- isCompactMode: p
22
- } = y(), t = !p && l !== "ONLY_LEFT" ? e.length > 0 ? e[0] : null : n.length > 0 ? n[0] : null, c = (f) => {
23
- if (f.preventDefault(), t != null && t.href) {
24
- m();
25
- let o = t.href;
26
- o.startsWith(".") && (o = o.substring(1)), s(o);
11
+ t
12
+ } = useTranslation();
13
+ const {
14
+ navigate
15
+ } = useHvNavigation();
16
+ const {
17
+ navigationMode
18
+ } = useHvAppShellConfig();
19
+ const {
20
+ resetBoundary
21
+ } = useErrorBoundary();
22
+ const {
23
+ items,
24
+ verticalNavigationItems,
25
+ isCompactMode
26
+ } = useNavigationContext();
27
+ const getFirstMenuItem = () => {
28
+ if (!isCompactMode && navigationMode !== "ONLY_LEFT") {
29
+ return items.length > 0 ? items[0] : null;
27
30
  }
31
+ return verticalNavigationItems.length > 0 ? verticalNavigationItems[0] : null;
28
32
  };
29
- return t && /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(i, { variant: "body", children: /* @__PURE__ */ r(h, { t: a, i18nKey: "errors.footer", values: {
30
- label: t.label
33
+ const firstMenuItem = getFirstMenuItem();
34
+ const handleClick = (event) => {
35
+ event.preventDefault();
36
+ if (firstMenuItem?.href) {
37
+ resetBoundary();
38
+ let path = firstMenuItem.href;
39
+ if (path.startsWith(".")) {
40
+ path = path.substring(1);
41
+ }
42
+ navigate(path);
43
+ }
44
+ };
45
+ return firstMenuItem && /* @__PURE__ */ jsx(StyledFooterWrapper, { children: /* @__PURE__ */ jsx(HvTypography, { variant: "body", children: /* @__PURE__ */ jsx(Trans, { t, i18nKey: "errors.footer", values: {
46
+ label: firstMenuItem.label
31
47
  }, components: {
32
- navigate: /* @__PURE__ */ r(i, { link: !0, component: "a", href: t.href, variant: "label", onClick: c, children: t.label })
48
+ navigate: /* @__PURE__ */ jsx(HvTypography, { link: true, component: "a", href: firstMenuItem.href, variant: "label", onClick: handleClick, children: firstMenuItem.label })
33
49
  } }) }) });
34
- }, I = F;
50
+ };
51
+ const Footer$1 = Footer;
35
52
  export {
36
- I as default
53
+ Footer$1 as default
37
54
  };
38
- //# sourceMappingURL=Footer.js.map
@@ -1,8 +1,8 @@
1
- import e from "@emotion/styled/base";
2
- function t() {
1
+ import _styled from "@emotion/styled/base";
2
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() {
3
3
  return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop).";
4
4
  }
5
- const c = /* @__PURE__ */ e("div", process.env.NODE_ENV === "production" ? {
5
+ const FooterWrapper = /* @__PURE__ */ _styled("div", process.env.NODE_ENV === "production" ? {
6
6
  target: "e1bsjpnp0"
7
7
  } : {
8
8
  target: "e1bsjpnp0",
@@ -14,10 +14,10 @@ const c = /* @__PURE__ */ e("div", process.env.NODE_ENV === "production" ? {
14
14
  name: "1azakc",
15
15
  styles: "text-align:center",
16
16
  map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi9fX3cvaHYtYXBwLXNoZWxsL2h2LWFwcC1zaGVsbC9jbGllbnQvcGFja2FnZXMvYXBwLXNoZWxsLXVpL3NyYy9wYWdlcy9FcnJvclBhZ2UvRm9vdGVyL3N0eWxlcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFFdUMiLCJmaWxlIjoiL19fdy9odi1hcHAtc2hlbGwvaHYtYXBwLXNoZWxsL2NsaWVudC9wYWNrYWdlcy9hcHAtc2hlbGwtdWkvc3JjL3BhZ2VzL0Vycm9yUGFnZS9Gb290ZXIvc3R5bGVzLnRzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHN0eWxlZCBmcm9tIFwiQGVtb3Rpb24vc3R5bGVkXCI7XHJcblxyXG5leHBvcnQgY29uc3QgRm9vdGVyV3JhcHBlciA9IHN0eWxlZC5kaXZgXHJcbiAgdGV4dC1hbGlnbjogY2VudGVyO1xyXG5gO1xyXG5cclxuZXhwb3J0IGRlZmF1bHQgRm9vdGVyV3JhcHBlcjtcclxuIl19 */",
17
- toString: t
18
- }), a = c;
17
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
18
+ });
19
+ const StyledFooterWrapper = FooterWrapper;
19
20
  export {
20
- c as FooterWrapper,
21
- a as default
21
+ FooterWrapper,
22
+ StyledFooterWrapper as default
22
23
  };
23
- //# sourceMappingURL=styles.js.map