@hitachivantara/app-shell-ui 1.6.0 → 1.6.2

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 (139) 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 +11 -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 -17
  13. package/dist/esm/components/layout/Header/BrandLogo/Logos/Hitachi.js +10 -8
  14. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada.js +15 -13
  15. package/dist/esm/components/layout/Header/BrandLogo/Logos/Pentaho.js +10 -8
  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 +57 -46
  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.js.map +0 -1
  84. package/dist/esm/components/layout/Header/BrandLogo/Logos/Lumada.js.map +0 -1
  85. package/dist/esm/components/layout/Header/BrandLogo/Logos/Pentaho.js.map +0 -1
  86. package/dist/esm/components/layout/Header/Header.js.map +0 -1
  87. package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/DynamicAction.js.map +0 -1
  88. package/dist/esm/components/layout/Header/HeaderActions/DynamicAction/index.js.map +0 -1
  89. package/dist/esm/components/layout/Header/HeaderActions/HeaderActions.js.map +0 -1
  90. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/AppSwitcherToggle.js.map +0 -1
  91. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/index.js.map +0 -1
  92. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.js.map +0 -1
  93. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/ColorModeSwitcher.js.map +0 -1
  94. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher/index.js.map +0 -1
  95. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.js.map +0 -1
  96. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/HelpButton/index.js.map +0 -1
  97. package/dist/esm/components/layout/Header/HeaderActions/InternalActions/InternalAction/InternalAction.js.map +0 -1
  98. package/dist/esm/components/layout/Header/HeaderActions/index.js.map +0 -1
  99. package/dist/esm/components/layout/Header/styles.js.map +0 -1
  100. package/dist/esm/components/layout/Loading/Loading.js.map +0 -1
  101. package/dist/esm/components/layout/Loading/styles.js.map +0 -1
  102. package/dist/esm/components/layout/Main/Main.js.map +0 -1
  103. package/dist/esm/components/layout/Main/styles.js.map +0 -1
  104. package/dist/esm/components/layout/VerticalNavigation/VerticalNavigation.js.map +0 -1
  105. package/dist/esm/components/layout/VerticalNavigation/styles.js.map +0 -1
  106. package/dist/esm/index.js.map +0 -1
  107. package/dist/esm/lib/hooks/useClearLocationState.js.map +0 -1
  108. package/dist/esm/lib/hooks/useCustomEventListener.js.map +0 -1
  109. package/dist/esm/lib/hooks/useLocalStorage.js.map +0 -1
  110. package/dist/esm/lib/hooks/useNavigationMenuItems.js.map +0 -1
  111. package/dist/esm/lib/hooks/useNotificationsEventListener.js.map +0 -1
  112. package/dist/esm/lib/hooks/useThemeEventListener.js.map +0 -1
  113. package/dist/esm/lib/i18n/index.js.map +0 -1
  114. package/dist/esm/lib/i18n/localization/en.json.js.map +0 -1
  115. package/dist/esm/lib/i18n/localization/pt.json.js.map +0 -1
  116. package/dist/esm/lib/utils/CombinedProviders.js.map +0 -1
  117. package/dist/esm/lib/utils/basePathUtils.js.map +0 -1
  118. package/dist/esm/lib/utils/documentUtil.js.map +0 -1
  119. package/dist/esm/lib/utils/navigationUtil.js.map +0 -1
  120. package/dist/esm/lib/utils/textUtil.js.map +0 -1
  121. package/dist/esm/pages/ErrorPage/ErrorPage.js.map +0 -1
  122. package/dist/esm/pages/ErrorPage/Footer/Footer.js.map +0 -1
  123. package/dist/esm/pages/ErrorPage/Footer/styles.js.map +0 -1
  124. package/dist/esm/pages/ErrorPage/styles.js.map +0 -1
  125. package/dist/esm/pages/GenericError/500.svg.js.map +0 -1
  126. package/dist/esm/pages/GenericError/GenericError.js.map +0 -1
  127. package/dist/esm/pages/LoadingPage/LoadingPage.js.map +0 -1
  128. package/dist/esm/pages/LoadingPage/index.js.map +0 -1
  129. package/dist/esm/pages/LoadingPage/styles.js.map +0 -1
  130. package/dist/esm/pages/NotFound/404.svg.js.map +0 -1
  131. package/dist/esm/pages/NotFound/NotFound.js.map +0 -1
  132. package/dist/esm/pages/NotFound/index.js.map +0 -1
  133. package/dist/esm/pages/Root/Root.js.map +0 -1
  134. package/dist/esm/providers/BannerProvider.js.map +0 -1
  135. package/dist/esm/providers/LayoutProvider.js.map +0 -1
  136. package/dist/esm/providers/NavigationProvider.js.map +0 -1
  137. package/dist/esm/providers/hooks/useBannerContext.js.map +0 -1
  138. package/dist/esm/providers/hooks/useLayoutContext.js.map +0 -1
  139. package/dist/esm/providers/hooks/useNavigationContext.js.map +0 -1
@@ -1,33 +1,41 @@
1
- import { useContext as c, useMemo as f, useEffect as p } from "react";
2
- import { useLocation as g } from "react-router-dom";
3
- import { useHvAppShellConfig as v, HvAppShellRuntimeContext as M, CONFIG_TRANSLATIONS_NAMESPACE as I, useHvMenuItems as N } from "@hitachivantara/app-shell-shared";
4
- import { useHvNavigation as d } from "@hitachivantara/app-shell-navigation";
5
- import { createNavigationMenuItems as l } from "../utils/navigationUtil.js";
6
- const A = 2, H = () => {
1
+ import { useContext, useMemo, useEffect } from "react";
2
+ import { useLocation } from "react-router-dom";
3
+ import { useHvAppShellConfig, HvAppShellRuntimeContext, CONFIG_TRANSLATIONS_NAMESPACE, useHvMenuItems } from "@hitachivantara/app-shell-shared";
4
+ import { useHvNavigation } from "@hitachivantara/app-shell-navigation";
5
+ import { createNavigationMenuItems } from "../utils/navigationUtil.js";
6
+ const MAX_TOP_MENU_DEPTH = 2;
7
+ const useNavigationMenuItems = () => {
7
8
  const {
8
- pathname: s
9
- } = g(), {
10
- navigationMode: m
11
- } = v(), {
12
- navigate: i
13
- } = d(), {
14
- i18n: e
15
- } = c(M) ?? {}, a = f(() => (e == null ? void 0 : e.getFixedT(e.language, I)) ?? // should not happen, but fallback if the i18n instance is not available
16
- ((o) => o), [e]), {
17
- items: t,
18
- selectedMenuItemId: n,
19
- rootMenuItemId: u
20
- } = N(), r = l(a, t, m === "ONLY_TOP" ? A : void 0);
21
- return p(() => {
22
- var o;
23
- !n && s === "/" && ((o = t[0]) != null && o.href) && i(t[0].href);
24
- }, [s, t, i, n]), {
25
- items: r,
26
- selectedMenuItemId: n,
27
- rootMenuItemId: u
9
+ pathname
10
+ } = useLocation();
11
+ const {
12
+ navigationMode
13
+ } = useHvAppShellConfig();
14
+ const {
15
+ navigate
16
+ } = useHvNavigation();
17
+ const {
18
+ i18n
19
+ } = useContext(HvAppShellRuntimeContext) ?? {};
20
+ const tConfig = useMemo(() => i18n?.getFixedT(i18n.language, CONFIG_TRANSLATIONS_NAMESPACE) ?? // should not happen, but fallback if the i18n instance is not available
21
+ ((l) => l), [i18n]);
22
+ const {
23
+ items,
24
+ selectedMenuItemId,
25
+ rootMenuItemId
26
+ } = useHvMenuItems();
27
+ const navigationMenuItemsTmp = createNavigationMenuItems(tConfig, items, navigationMode === "ONLY_TOP" ? MAX_TOP_MENU_DEPTH : void 0);
28
+ useEffect(() => {
29
+ if (!selectedMenuItemId && pathname === "/" && items[0]?.href) {
30
+ navigate(items[0].href);
31
+ }
32
+ }, [pathname, items, navigate, selectedMenuItemId]);
33
+ return {
34
+ items: navigationMenuItemsTmp,
35
+ selectedMenuItemId,
36
+ rootMenuItemId
28
37
  };
29
38
  };
30
39
  export {
31
- H as default
40
+ useNavigationMenuItems as default
32
41
  };
33
- //# sourceMappingURL=useNavigationMenuItems.js.map
@@ -1,45 +1,55 @@
1
- import { useHvSnackbar as f } from "@hitachivantara/uikit-react-core";
2
- import u from "../../providers/hooks/useBannerContext.js";
3
- const k = () => {
1
+ import { useHvSnackbar } from "@hitachivantara/uikit-react-core";
2
+ import useBannerContext from "../../providers/hooks/useBannerContext.js";
3
+ const useNotificationsEventListener = () => {
4
4
  const {
5
- enqueueSnackbar: o
6
- } = f(), {
7
- show: s
8
- } = u(), i = (a) => {
5
+ enqueueSnackbar
6
+ } = useHvSnackbar();
7
+ const {
8
+ show
9
+ } = useBannerContext();
10
+ const handleCustomEventSnackbar = (notification) => {
9
11
  const {
10
- message: n,
11
- variant: r,
12
- actions: t,
13
- actionsCallback: l
14
- } = a;
15
- let e;
16
- t && (e = {
17
- action: Array.isArray(t) ? t[0] : t,
18
- actionCallback: l
19
- }), n && o(n, {
20
- variant: r ?? "default",
21
- snackbarContentProps: e
22
- });
23
- }, c = (a) => {
24
- a.message && s(a);
12
+ message,
13
+ variant,
14
+ actions,
15
+ actionsCallback
16
+ } = notification;
17
+ let snackbarContentProps;
18
+ if (actions) {
19
+ snackbarContentProps = {
20
+ action: Array.isArray(actions) ? actions[0] : actions,
21
+ actionCallback: actionsCallback
22
+ };
23
+ }
24
+ if (message) {
25
+ enqueueSnackbar(message, {
26
+ variant: variant ?? "default",
27
+ snackbarContentProps
28
+ });
29
+ }
25
30
  };
26
- return {
27
- handleNotificationEvent: (a) => {
28
- const n = a.detail;
29
- switch (n.type) {
30
- case "snackbar":
31
- i(n);
32
- break;
33
- case "banner":
34
- c(n);
35
- break;
36
- default:
37
- console.warn("Invalid notification type", n.type);
38
- }
31
+ const handleCustomEventBanner = (notification) => {
32
+ if (notification.message) {
33
+ show(notification);
39
34
  }
40
35
  };
36
+ const handleNotificationEvent = (event) => {
37
+ const notificationEvent = event.detail;
38
+ switch (notificationEvent.type) {
39
+ case "snackbar":
40
+ handleCustomEventSnackbar(notificationEvent);
41
+ break;
42
+ case "banner":
43
+ handleCustomEventBanner(notificationEvent);
44
+ break;
45
+ default:
46
+ console.warn("Invalid notification type", notificationEvent.type);
47
+ }
48
+ };
49
+ return {
50
+ handleNotificationEvent
51
+ };
41
52
  };
42
53
  export {
43
- k as default
54
+ useNotificationsEventListener as default
44
55
  };
45
- //# sourceMappingURL=useNotificationsEventListener.js.map
@@ -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