@hitachivantara/app-shell-ui 1.13.6 → 2.0.0-next.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 (67) hide show
  1. package/dist/components/AppShellProvider/AppShellProvider.js +105 -0
  2. package/dist/{esm/hooks → hooks}/useNotificationsEventListener.js +2 -2
  3. package/dist/{esm/hooks → hooks}/useThemeEventListener.js +4 -5
  4. package/dist/index.d.ts +9 -0
  5. package/dist/{esm/pages → pages}/ErrorPage/ErrorPage.js +1 -1
  6. package/dist/{esm/providers → providers}/BannerProvider.js +1 -1
  7. package/dist/types/index.d.ts +4 -9
  8. package/package.json +13 -13
  9. package/dist/esm/components/AppShellProvider/AppShellProvider.js +0 -115
  10. /package/dist/{esm/components → components}/AppShell/AppShell.js +0 -0
  11. /package/dist/{esm/components → components}/AppShellRoutes/AppShellRoutes.js +0 -0
  12. /package/dist/{esm/components → components}/AppShellViewProvider/AppShellViewProvider.js +0 -0
  13. /package/dist/{esm/components → components}/CustomHooksInitializer/CustomHooksInitializer.js +0 -0
  14. /package/dist/{esm/components → components}/GlobalStyles/GlobalStyles.js +0 -0
  15. /package/dist/{esm/components → components}/GlobalStyles/index.js +0 -0
  16. /package/dist/{esm/components → components}/IconUiKit/IconUiKit.js +0 -0
  17. /package/dist/{esm/components → components}/IconUiKit/index.js +0 -0
  18. /package/dist/{esm/components → components}/SnackbarProvider/SnackbarProvider.js +0 -0
  19. /package/dist/{esm/components → components}/hoc/withClickAwayListener.js +0 -0
  20. /package/dist/{esm/components → components}/hoc/withGlobalProvider.js +0 -0
  21. /package/dist/{esm/components → components}/layout/BrandLogo/BrandLogo.js +0 -0
  22. /package/dist/{esm/components → components}/layout/BrandLogo/logos.js +0 -0
  23. /package/dist/{esm/components → components}/layout/Header/Header.js +0 -0
  24. /package/dist/{esm/components → components}/layout/Header/HeaderActions/DynamicAction.js +0 -0
  25. /package/dist/{esm/components → components}/layout/Header/HeaderActions/HeaderActions.js +0 -0
  26. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/AppSwitcherToggle.js +0 -0
  27. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/index.js +0 -0
  28. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/AppSwitcherToggle/styles.js +0 -0
  29. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/ColorModeSwitcher.js +0 -0
  30. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/HelpButton/HelpButton.js +0 -0
  31. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/HelpButton/index.js +0 -0
  32. /package/dist/{esm/components → components}/layout/Header/HeaderActions/InternalActions/InternalAction/InternalAction.js +0 -0
  33. /package/dist/{esm/components → components}/layout/Header/HeaderActions/index.js +0 -0
  34. /package/dist/{esm/components → components}/layout/Header/styles.js +0 -0
  35. /package/dist/{esm/components → components}/layout/Loading/Loading.js +0 -0
  36. /package/dist/{esm/components → components}/layout/Loading/styles.js +0 -0
  37. /package/dist/{esm/components → components}/layout/Main/Main.js +0 -0
  38. /package/dist/{esm/components → components}/layout/Main/styles.js +0 -0
  39. /package/dist/{esm/components → components}/layout/VerticalNavigation/NavigationCollapse.js +0 -0
  40. /package/dist/{esm/components → components}/layout/VerticalNavigation/NavigationHeader.js +0 -0
  41. /package/dist/{esm/components → components}/layout/VerticalNavigation/VerticalNavigation.js +0 -0
  42. /package/dist/{esm/components → components}/layout/VerticalNavigation/styles.js +0 -0
  43. /package/dist/{esm/hooks → hooks}/useClearLocationState.js +0 -0
  44. /package/dist/{esm/hooks → hooks}/useCustomEventListener.js +0 -0
  45. /package/dist/{esm/hooks → hooks}/useLocalStorage.js +0 -0
  46. /package/dist/{esm/hooks → hooks}/useNavigationMenuItems.js +0 -0
  47. /package/dist/{esm/hooks → hooks}/useResizeObserver.js +0 -0
  48. /package/dist/{esm/i18n → i18n}/index.js +0 -0
  49. /package/dist/{esm/i18n → i18n}/localization/en.json.js +0 -0
  50. /package/dist/{esm/i18n → i18n}/localization/pt.json.js +0 -0
  51. /package/dist/{esm/index.js → index.js} +0 -0
  52. /package/dist/{esm/pages → pages}/ErrorPage/Footer.js +0 -0
  53. /package/dist/{esm/pages → pages}/ErrorPage/styles.js +0 -0
  54. /package/dist/{esm/pages → pages}/GenericError/500.svg.js +0 -0
  55. /package/dist/{esm/pages → pages}/GenericError/GenericError.js +0 -0
  56. /package/dist/{esm/pages → pages}/LoadingPage/LoadingPage.js +0 -0
  57. /package/dist/{esm/pages → pages}/LoadingPage/index.js +0 -0
  58. /package/dist/{esm/pages → pages}/LoadingPage/styles.js +0 -0
  59. /package/dist/{esm/pages → pages}/NotFound/404.svg.js +0 -0
  60. /package/dist/{esm/pages → pages}/NotFound/NotFound.js +0 -0
  61. /package/dist/{esm/pages → pages}/NotFound/index.js +0 -0
  62. /package/dist/{esm/pages → pages}/Root/Root.js +0 -0
  63. /package/dist/{esm/providers → providers}/LayoutProvider.js +0 -0
  64. /package/dist/{esm/providers → providers}/NavigationProvider.js +0 -0
  65. /package/dist/{esm/utils → utils}/CombinedProviders.js +0 -0
  66. /package/dist/{esm/utils → utils}/documentUtil.js +0 -0
  67. /package/dist/{esm/utils → utils}/navigationUtil.js +0 -0
@@ -0,0 +1,105 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useContext, useState, useEffect, useMemo } from "react";
3
+ import { I18nContext } from "react-i18next";
4
+ import { HvAppShellContext, HvAppShellRuntimeContext, HvAppShellCombinedProvidersContext, CONFIG_TRANSLATIONS_NAMESPACE } from "@hitachivantara/app-shell-shared";
5
+ import { themes, HvProvider } from "@hitachivantara/uikit-react-core";
6
+ import useLocalStorage from "../../hooks/useLocalStorage.js";
7
+ import { addResourceBundles } from "../../i18n/index.js";
8
+ const AppShellProvider = ({
9
+ children,
10
+ config: localConfig,
11
+ configUrl
12
+ }) => {
13
+ const { i18n } = useContext(I18nContext);
14
+ const { value: storedColorModeValue } = useLocalStorage("COLOR_MODE");
15
+ const [loadedConfig, setLoadedConfig] = useState(void 0);
16
+ const [hasError, setHasError] = useState(false);
17
+ useEffect(() => {
18
+ if (localConfig || !configUrl) return;
19
+ fetch(new URL(configUrl)).then((result) => result.json()).then((data) => setLoadedConfig(data)).catch((e) => {
20
+ console.error(`Failed to obtain the context from: ${configUrl}`, e);
21
+ setLoadedConfig(void 0);
22
+ setHasError(true);
23
+ });
24
+ }, [localConfig, configUrl]);
25
+ const theConfig = useMemo(
26
+ () => localConfig ?? loadedConfig,
27
+ [localConfig, loadedConfig]
28
+ );
29
+ if (hasError) {
30
+ throw Error("Failed to obtain the configuration");
31
+ }
32
+ if (theConfig?.translations) {
33
+ addResourceBundles(
34
+ i18n,
35
+ theConfig.translations,
36
+ CONFIG_TRANSLATIONS_NAMESPACE
37
+ );
38
+ }
39
+ const [theme, setTheme] = useState();
40
+ const [providers, setProviders] = useState();
41
+ useEffect(() => {
42
+ const theme2 = theConfig?.theming?.theme;
43
+ if (!theme2) return;
44
+ if (themes[theme2]) {
45
+ setTheme(themes[theme2]);
46
+ return;
47
+ }
48
+ import(
49
+ /* @vite-ignore */
50
+ theme2
51
+ ).then((module) => {
52
+ setTheme(module.default);
53
+ }).catch((e) => {
54
+ console.error(`Import of theme bundle ${theme2} failed! ${e}`);
55
+ });
56
+ }, [theConfig?.theming?.theme]);
57
+ useEffect(() => {
58
+ if (!theConfig?.providers) return;
59
+ Promise.all(
60
+ theConfig.providers.map((provider) => {
61
+ return import(
62
+ /* @vite-ignore */
63
+ provider.bundle
64
+ ).then((module) => ({
65
+ component: module.default,
66
+ config: provider.config
67
+ })).catch((e) => {
68
+ console.error(
69
+ `Import of provider '${provider.bundle}' failed! ${e}`
70
+ );
71
+ });
72
+ })
73
+ ).then(
74
+ (loadedProviders) => setProviders(loadedProviders.filter((provider) => !!provider))
75
+ ).catch((e) => {
76
+ console.error(`Import of providers failed!`, e);
77
+ });
78
+ }, [theConfig?.providers]);
79
+ const runtimeContext = useMemo(
80
+ () => ({
81
+ i18n
82
+ }),
83
+ [i18n]
84
+ );
85
+ const providersContext = useMemo(
86
+ () => ({
87
+ providers
88
+ }),
89
+ [providers]
90
+ );
91
+ if (!theConfig || theConfig.theming?.theme && !theme || theConfig.providers != null && providers === void 0) {
92
+ return null;
93
+ }
94
+ return /* @__PURE__ */ jsx(HvAppShellContext.Provider, { value: theConfig, children: /* @__PURE__ */ jsx(HvAppShellRuntimeContext.Provider, { value: runtimeContext, children: /* @__PURE__ */ jsx(
95
+ HvProvider,
96
+ {
97
+ theme,
98
+ colorMode: storedColorModeValue ?? theConfig.theming?.colorMode,
99
+ children: /* @__PURE__ */ jsx(HvAppShellCombinedProvidersContext.Provider, { value: providersContext, children })
100
+ }
101
+ ) }) });
102
+ };
103
+ export {
104
+ AppShellProvider as default
105
+ };
@@ -4,12 +4,12 @@ const useNotificationsEventListener = () => {
4
4
  const { enqueueSnackbar } = useHvSnackbar();
5
5
  const { show } = useBannerContext();
6
6
  const handleCustomEventSnackbar = (notification) => {
7
- const { message, variant, actions, actionsCallback } = notification;
7
+ const { message, variant, actions, onAction } = notification;
8
8
  let snackbarContentProps;
9
9
  if (actions) {
10
10
  snackbarContentProps = {
11
11
  action: Array.isArray(actions) ? actions[0] : actions,
12
- actionCallback: actionsCallback
12
+ onAction
13
13
  };
14
14
  }
15
15
  if (message) {
@@ -1,17 +1,16 @@
1
1
  import { useTheme } from "@hitachivantara/uikit-react-core";
2
2
  import useLocalStorage from "./useLocalStorage.js";
3
3
  const useThemeEventListener = () => {
4
- const { selectedTheme, changeTheme, selectedMode, colorModes } = useTheme();
4
+ const { selectedMode, colorModes, changeMode } = useTheme();
5
5
  const { setStoredValue } = useLocalStorage("COLOR_MODE");
6
6
  const getNextColorMode = () => {
7
- const index = colorModes.indexOf(selectedMode);
8
- const nextIndex = (index + 1) % colorModes.length;
9
- return colorModes[nextIndex];
7
+ const nextIndex = colorModes.indexOf(selectedMode) + 1;
8
+ return colorModes[nextIndex % colorModes.length];
10
9
  };
11
10
  const handleThemeEvent = (event) => {
12
11
  const { colorMode } = event.detail;
13
12
  const newColorMode = !colorMode || colorModes.indexOf(colorMode) === -1 ? getNextColorMode() : colorMode;
14
- changeTheme(selectedTheme, newColorMode);
13
+ changeMode(newColorMode);
15
14
  setStoredValue(newColorMode);
16
15
  };
17
16
  return { handleThemeEvent };
@@ -0,0 +1,9 @@
1
+ import { JSX as JSX_2 } from 'react/jsx-runtime';
2
+
3
+ declare const _default: {
4
+ ({ ...wrappedProps }: any): JSX_2.Element;
5
+ displayName: string;
6
+ };
7
+ export default _default;
8
+
9
+ export { }
@@ -21,7 +21,7 @@ const ErrorPage = ({
21
21
  children: [
22
22
  /* @__PURE__ */ jsxs(StyledTitleWrapper, { children: [
23
23
  code && /* @__PURE__ */ jsx(HvTypography, { variant: "title1", children: code }),
24
- /* @__PURE__ */ jsx(HvTypography, { variant: isCompactMode ? "xsTitle" : "display", children: title })
24
+ /* @__PURE__ */ jsx(HvTypography, { variant: isCompactMode ? "title3" : "display", children: title })
25
25
  ] }),
26
26
  /* @__PURE__ */ jsx(
27
27
  StyledImageWrapper,
@@ -100,7 +100,7 @@ const BannerProvider = ({ children }) => {
100
100
  label: banner.message,
101
101
  showIcon: true,
102
102
  actions: banner.actions,
103
- actionsCallback: banner.actionsCallback,
103
+ onAction: banner.onAction,
104
104
  bannerContentProps: {
105
105
  actionProps: { "aria-label": t("close") }
106
106
  },
@@ -1,9 +1,4 @@
1
- import { JSX as JSX_2 } from 'react/jsx-runtime';
2
-
3
- declare const _default: {
4
- ({ ...wrappedProps }: any): JSX_2.Element;
5
- displayName: string;
6
- };
7
- export default _default;
8
-
9
- export { }
1
+ export {}
2
+ import hitachivantaraappShellUi from '../packages/app-shell-ui/src/index'
3
+ export default hitachivantaraappShellUi
4
+ export {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hitachivantara/app-shell-ui",
3
- "version": "1.13.6",
3
+ "version": "2.0.0-next.1",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "author": "Hitachi Vantara UI Kit Team",
@@ -18,13 +18,13 @@
18
18
  "@emotion/css": "^11.10.5",
19
19
  "@emotion/react": "^11.10.5",
20
20
  "@emotion/styled": "^11.10.5",
21
- "@hitachivantara/app-shell-events": "^1.1.2",
22
- "@hitachivantara/app-shell-navigation": "^1.4.16",
23
- "@hitachivantara/app-shell-services": "^1.1.2",
24
- "@hitachivantara/app-shell-shared": "^1.7.6",
25
- "@hitachivantara/uikit-react-core": "^5.106.1",
26
- "@hitachivantara/uikit-react-icons": "^5.16.6",
27
- "@mui/material": "^5.16.14",
21
+ "@hitachivantara/app-shell-events": "^2.0.0-next.1",
22
+ "@hitachivantara/app-shell-navigation": "^2.0.0-next.1",
23
+ "@hitachivantara/app-shell-services": "^2.0.0-next.1",
24
+ "@hitachivantara/app-shell-shared": "^2.0.0-next.1",
25
+ "@hitachivantara/uikit-react-core": "^6.0.0-next.2",
26
+ "@hitachivantara/uikit-react-icons": "^6.0.0-next.2",
27
+ "@mui/material": "^7.0.2",
28
28
  "i18next": "^24.2.2",
29
29
  "i18next-browser-languagedetector": "^8.0.3",
30
30
  "react-error-boundary": "^4.0.10",
@@ -44,15 +44,15 @@
44
44
  "access": "public",
45
45
  "directory": "package"
46
46
  },
47
- "gitHead": "7d60bff02f58ff47ae19146532553882c2e4b732",
47
+ "gitHead": "0b07240fb2ef75e046d8e6aaf0ff71bf2415c73f",
48
48
  "exports": {
49
49
  ".": {
50
- "types": "./dist/types/index.d.ts",
51
- "import": "./dist/esm/index.js",
52
- "default": "./dist/esm/index.js"
50
+ "types": "./dist/index.d.ts",
51
+ "import": "./dist/index.js",
52
+ "default": "./dist/index.js"
53
53
  },
54
54
  "./package.json": "./package.json"
55
55
  },
56
56
  "types": "./dist/types/index.d.ts",
57
- "module": "dist/esm/index.js"
57
+ "module": "dist/index.js"
58
58
  }
@@ -1,115 +0,0 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useContext, useState, useEffect, useMemo } from "react";
3
- import { I18nContext } from "react-i18next";
4
- import { HvAppShellContext, HvAppShellRuntimeContext, HvAppShellCombinedProvidersContext, CONFIG_TRANSLATIONS_NAMESPACE } from "@hitachivantara/app-shell-shared";
5
- import { themes, HvProvider } from "@hitachivantara/uikit-react-core";
6
- import useLocalStorage from "../../hooks/useLocalStorage.js";
7
- import { addResourceBundles } from "../../i18n/index.js";
8
- const AppShellProvider = ({
9
- children,
10
- config: localConfig,
11
- configUrl
12
- }) => {
13
- const { i18n } = useContext(I18nContext);
14
- const { value: storedColorModeValue } = useLocalStorage("COLOR_MODE");
15
- const [loadedConfig, setLoadedConfig] = useState(void 0);
16
- const [hasError, setHasError] = useState(false);
17
- useEffect(() => {
18
- if (!localConfig && configUrl) {
19
- fetch(new URL(configUrl)).then((result) => {
20
- return result.json();
21
- }).then((data) => setLoadedConfig(data)).catch((e) => {
22
- console.error(
23
- `It was not possible to obtain the context from: ${configUrl}`,
24
- e
25
- );
26
- setLoadedConfig(void 0);
27
- setHasError(true);
28
- });
29
- }
30
- }, [localConfig, configUrl]);
31
- const theConfig = useMemo(
32
- () => localConfig ?? loadedConfig,
33
- [localConfig, loadedConfig]
34
- );
35
- if (hasError) {
36
- throw Error("It was not possible to obtain the configuration");
37
- }
38
- if (theConfig?.translations) {
39
- addResourceBundles(
40
- i18n,
41
- theConfig.translations,
42
- CONFIG_TRANSLATIONS_NAMESPACE
43
- );
44
- }
45
- const [themes$1, setThemes] = useState(void 0);
46
- const [providers, setProviders] = useState(void 0);
47
- useEffect(() => {
48
- if (theConfig?.theming?.themes) {
49
- Promise.all(
50
- theConfig.theming.themes?.map((bundle) => {
51
- return themes[bundle] ?? import(
52
- /* @vite-ignore */
53
- bundle
54
- ).then((module) => module.default).catch((e) => {
55
- console.error(`Import of theme bundle ${bundle} failed! ${e}`);
56
- });
57
- })
58
- ).then((loadedThemes) => {
59
- setThemes(loadedThemes.filter((theme) => !!theme));
60
- }).catch((e) => {
61
- console.error(`Import of themes failed! ${e}`);
62
- });
63
- }
64
- }, [theConfig?.theming?.themes]);
65
- useEffect(() => {
66
- if (theConfig?.providers) {
67
- Promise.all(
68
- theConfig.providers.map((provider) => {
69
- return import(
70
- /* @vite-ignore */
71
- provider.bundle
72
- ).then((module) => ({
73
- component: module.default,
74
- config: provider.config
75
- })).catch((e) => {
76
- console.error(
77
- `Import of provider '${provider.bundle}' failed! ${e}`
78
- );
79
- });
80
- })
81
- ).then(
82
- (loadedProviders) => setProviders(loadedProviders.filter((provider) => !!provider))
83
- ).catch((e) => {
84
- console.error(`Import of providers failed!`, e);
85
- });
86
- }
87
- }, [theConfig?.providers]);
88
- const runtimeContext = useMemo(
89
- () => ({
90
- i18n
91
- }),
92
- [i18n]
93
- );
94
- const providersContext = useMemo(
95
- () => ({
96
- providers
97
- }),
98
- [providers]
99
- );
100
- if (!theConfig || theConfig.theming?.themes && !themes$1 || theConfig.providers != null && providers === void 0) {
101
- return null;
102
- }
103
- return /* @__PURE__ */ jsx(HvAppShellContext.Provider, { value: theConfig, children: /* @__PURE__ */ jsx(HvAppShellRuntimeContext.Provider, { value: runtimeContext, children: /* @__PURE__ */ jsx(
104
- HvProvider,
105
- {
106
- themes: themes$1,
107
- theme: theConfig.theming?.theme,
108
- colorMode: storedColorModeValue ?? theConfig.theming?.colorMode,
109
- children: /* @__PURE__ */ jsx(HvAppShellCombinedProvidersContext.Provider, { value: providersContext, children })
110
- }
111
- ) }) });
112
- };
113
- export {
114
- AppShellProvider as default
115
- };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes