@equinor/echo-framework 0.9.10 → 0.9.13

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.
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- export declare type LayoutKey = 'main' | 'camera' | 'nativePdf' | 'colorLayout' | undefined;
2
+ export declare type LayoutKey = 'main' | 'nativePdf' | 'colorLayout' | undefined;
3
3
  export interface LayoutProps {
4
4
  layoutKey?: string;
5
5
  children: React.ReactNode;
@@ -1,12 +1,9 @@
1
1
  import React from 'react';
2
- export declare enum BarButtonVariants {
3
- Home = "home",
4
- Search = "search",
5
- Camera = "camera",
6
- Menu = "menu"
7
- }
8
2
  interface EchoBottomBarProps {
9
3
  isBottomBarVisible: boolean;
4
+ activeAppMenuItem: string;
5
+ updateActiveAppMenuItem: (newActiveAppMenuItem: string) => void;
10
6
  }
11
7
  export declare const EchoBarComponent: React.FC<EchoBottomBarProps>;
12
- export default EchoBarComponent;
8
+ declare const _default: React.NamedExoticComponent<EchoBottomBarProps>;
9
+ export default _default;
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  interface CorePanelsProps {
3
3
  children: React.ReactNode;
4
+ isLeftAndRightPanelHidden?: boolean;
4
5
  Legend?: React.FC;
5
6
  }
6
7
  export declare const EchoContent: React.FC<CorePanelsProps>;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ interface EchoUiContextState {
3
+ activeAppMenuItem: string;
4
+ updateActiveAppMenuItem: (newActiveAppMenuItem: string) => void;
5
+ }
6
+ export declare const useEchoUiContext: () => EchoUiContextState;
7
+ interface EchoUiContextProviderProps {
8
+ children: React.ReactNode;
9
+ }
10
+ export declare const EchoUiContextProvider: React.FC<EchoUiContextProviderProps>;
11
+ export {};
@@ -2,3 +2,4 @@ export * from './EchoBarComponent';
2
2
  export * from './EchoContent';
3
3
  export * from './EchoContentPanels';
4
4
  export * from './EchoEventHandler';
5
+ export * from './EchoUserInterfaceContextProvider';
@@ -1,14 +1,12 @@
1
1
  import { DataInformation } from '@equinor/echo-components';
2
- import { DeviceOrientation, SetActiveCommPackNo, SetActiveMcPackNo, SetActiveTagNo, TagData } from './../types/hookLibrary';
2
+ import { SetActiveCommPackNo, SetActiveMcPackNo, SetActiveTagNo, TagData } from './../types/hookLibrary';
3
3
  export declare enum RegisteredHookName {
4
4
  useSetActiveTagNo = "useSetActiveTagNo",
5
5
  useContextMenuDataInfo = "useContextMenuDataInfo",
6
6
  useTagData = "useTagData",
7
7
  useIsContextMenuInfoLoading = "useIsContextMenuInfoLoading",
8
8
  useSetActiveCommPackNo = "useSetActiveCommPackNo",
9
- useSetActiveMcPackNo = "useSetActiveMcPackNo",
10
- useDeviceOrientation = "useDeviceOrientation",
11
- useInternalLinkToScan = "useInternalLinkToScan"
9
+ useSetActiveMcPackNo = "useSetActiveMcPackNo"
12
10
  }
13
11
  export declare const HookLibrary: Readonly<{
14
12
  /**
@@ -48,13 +46,4 @@ export declare const HookLibrary: Readonly<{
48
46
  * @returns {SetActiveMcPackNo}
49
47
  */
50
48
  useSetActiveMcPackNo: () => SetActiveMcPackNo;
51
- /**
52
- * Hook for detecting device orientation from native devices.
53
- * @returns {DeviceOrientation}
54
- */
55
- useDeviceOrientation: () => DeviceOrientation;
56
- /**
57
- * Hook for opening camera.
58
- */
59
- useInternalLinkToScan: () => (params?: string) => void;
60
49
  }>;
@@ -1,17 +1,13 @@
1
- import { DeviceOrientation, ScreenOrientation } from '../types/hookLibrary';
1
+ import { ScreenOrientation } from '../types/hookLibrary';
2
2
  /**
3
3
  * Provides screen values for current screen.
4
4
  *
5
- * @returns {Object} response
6
- * @returns {boolean} response.isWeb If Echo is used on web or on the device.
7
- * @returns {DeviceOrientation} response.screenOrientationDevice
8
- * @returns {ScreenOrientation} response.screenOrientationWeb
5
+ * @returns {boolean} response.isScreenMobileSize If the device screen is small or not
6
+ * @returns {ScreenOrientation} response.screenOrientation
9
7
  */
10
8
  declare type DeviceValues = {
11
- isWeb: boolean;
12
9
  isScreenMobileSize: boolean;
13
- screenOrientationDevice: DeviceOrientation;
14
- screenOrientationWeb: ScreenOrientation;
10
+ screenOrientation: ScreenOrientation;
15
11
  };
16
12
  export declare function useScreenValues(): DeviceValues;
17
13
  export {};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * Get the current size of the browser window.
3
- * @returns {width?: number; height?: number} Width and height of the current browser window size.
4
- * Returns undefined if there is no window object (for example: executed on server side)
3
+ * @returns {width?: number; height?: number} Width and height of the current browser size.
4
+
5
5
  */
6
6
  export declare function useWindowSize(): {
7
- width?: number;
8
- height?: number;
7
+ width: number;
8
+ height: number;
9
9
  };
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export * from './theme/themeConst';
15
15
  export type { EchoHubPlant } from './types/echoHubPlant';
16
16
  export * from './types/eventTypes';
17
17
  export * from './types/extensions';
18
- export type { DeviceOrientation, SetActiveTagNo, TagData } from './types/hookLibrary';
18
+ export type { SetActiveTagNo, TagData } from './types/hookLibrary';
19
19
  export { LegendStatus, LegendType } from './types/legend';
20
20
  export type { ModelPermissions } from './types/modelPermissions';
21
21
  export { PingableSources } from './types/pingableSources';
@@ -39,13 +39,10 @@ declare const EchoFramework: Readonly<{
39
39
  useEchoHistory(): (path: string, params?: {
40
40
  [key: string]: string;
41
41
  } | undefined, state?: any) => void;
42
- useIsCompactLayout(isLandscape: boolean): boolean;
43
42
  useScreenOrientation(): import("./types/hookLibrary").ScreenOrientation;
44
43
  useScreenValues(): {
45
- isWeb: boolean;
46
- isMobileWidth: boolean;
47
- screenOrientationDevice: import("./types/hookLibrary").DeviceOrientation;
48
- screenOrientationWeb: import("./types/hookLibrary").ScreenOrientation;
44
+ isScreenMobileSize: boolean;
45
+ screenOrientation: import("./types/hookLibrary").ScreenOrientation;
49
46
  };
50
47
  useTagDetails({ instCode, tagNo }: {
51
48
  tagNo: string;
@@ -61,8 +58,6 @@ declare const EchoFramework: Readonly<{
61
58
  useIsContextMenuInfoLoading: () => boolean;
62
59
  useSetActiveCommPackNo: () => import("./types/hookLibrary").SetActiveCommPackNo;
63
60
  useSetActiveMcPackNo: () => import("./types/hookLibrary").SetActiveMcPackNo;
64
- useDeviceOrientation: () => import("./types/hookLibrary").DeviceOrientation;
65
- useInternalLinkToScan: () => (params?: string | undefined) => void;
66
61
  }>;
67
62
  EchopediaComponentLibrary: Readonly<{
68
63
  getTagItem: () => import("react").FunctionComponent<any>;
@@ -56,6 +56,8 @@ require('../searchMenu/searchMenu.module.css.js');
56
56
 
57
57
  require('../../coreApplication/EchoEventHandler.module.css.js');
58
58
 
59
+ var EchoUserInterfaceContextProvider = require('../../coreApplication/EchoUserInterfaceContextProvider.js');
60
+
59
61
  var layout_module = require('./layout.module.css.js');
60
62
 
61
63
  function _interopDefaultLegacy(e) {
@@ -73,20 +75,26 @@ var Layout = function Layout(_ref) {
73
75
  children = _ref.children;
74
76
 
75
77
  var _useScreenValues$useS = useScreenValues.useScreenValues(),
76
- isWeb = _useScreenValues$useS.isWeb,
77
78
  isScreenMobileSize = _useScreenValues$useS.isScreenMobileSize,
78
- screenOrientationDevice = _useScreenValues$useS.screenOrientationDevice,
79
- screenOrientationWeb = _useScreenValues$useS.screenOrientationWeb;
79
+ screenOrientation = _useScreenValues$useS.screenOrientation;
80
+
81
+ var _EchoUserInterfaceCon = EchoUserInterfaceContextProvider.useEchoUiContext(),
82
+ activeAppMenuItem = _EchoUserInterfaceCon.activeAppMenuItem,
83
+ updateActiveAppMenuItem = _EchoUserInterfaceCon.updateActiveAppMenuItem;
80
84
 
81
- var ModuleLayoutClassNames = index["default"](layout_module["default"].deviceOrientation, (_index$default = {}, _defineProperty(_index$default, layout_module["default"].mainLayoutWrapper, layoutKey === 'main'), _defineProperty(_index$default, layout_module["default"].colorLayout, layoutKey === 'colorLayout'), _defineProperty(_index$default, layout_module["default"].pdfViewerNative, layoutKey === 'nativePdf'), _defineProperty(_index$default, layout_module["default"].cameraLayout, layoutKey === 'camera'), _defineProperty(_index$default, layout_module["default"].defaultLayout, layoutKey === undefined), _index$default));
85
+ var ModuleLayoutClassNames = index["default"](layout_module["default"].deviceOrientation, (_index$default = {}, _defineProperty(_index$default, layout_module["default"].mainLayoutWrapper, layoutKey === 'main'), _defineProperty(_index$default, layout_module["default"].colorLayout, layoutKey === 'colorLayout'), _defineProperty(_index$default, layout_module["default"].pdfViewerNative, layoutKey === 'nativePdf'), _defineProperty(_index$default, layout_module["default"].defaultLayout, layoutKey === undefined), _index$default));
82
86
  return /*#__PURE__*/React__default["default"].createElement("div", {
83
87
  className: layout_module["default"].echoContentContainer
84
- }, (isWeb && screenOrientationWeb === 'landscape' || screenOrientationDevice.landscape) && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
85
- isBottomBarVisible: isScreenMobileSize
88
+ }, screenOrientation === 'landscape' && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
89
+ isBottomBarVisible: isScreenMobileSize,
90
+ activeAppMenuItem: activeAppMenuItem,
91
+ updateActiveAppMenuItem: updateActiveAppMenuItem
86
92
  }), /*#__PURE__*/React__default["default"].createElement("div", {
87
93
  className: ModuleLayoutClassNames
88
- }, children), (isWeb && screenOrientationWeb === 'portrait' || screenOrientationDevice.portrait) && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
89
- isBottomBarVisible: isScreenMobileSize
94
+ }, children), screenOrientation === 'portrait' && /*#__PURE__*/React__default["default"].createElement(EchoBarComponent.EchoBarComponent, {
95
+ isBottomBarVisible: isScreenMobileSize,
96
+ activeAppMenuItem: activeAppMenuItem,
97
+ updateActiveAppMenuItem: updateActiveAppMenuItem
90
98
  }));
91
99
  };
92
100
 
@@ -26,8 +26,6 @@ var React = require('react');
26
26
 
27
27
  require('react-router-dom');
28
28
 
29
- require('../../../hooks/hookLibrary.js');
30
-
31
29
  var useTagDetails = require('../../../hooks/useTagDetails.js');
32
30
 
33
31
  var externalLinkButton = require('../../externalLinkButton/externalLinkButton.js');
@@ -70,7 +70,7 @@ var CorePanelLeft = function CorePanelLeft(_ref) {
70
70
  className: corePanelLeft_module["default"].drawer,
71
71
  style: panelUI.panel
72
72
  }, activePanel && PanelContent ? /*#__PURE__*/React__default["default"].createElement(PanelContent, null) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null)), /*#__PURE__*/React__default["default"].createElement("div", {
73
- className: corePanelLeft_module["default"].buttonContainer,
73
+ className: corePanelLeft_module["default"].buttonContainer + ' ' + "".concat(isPanelActive ? corePanelLeft_module["default"].buttonContainerActive : corePanelLeft_module["default"].buttonContainerClosed),
74
74
  style: panelUI.panelButton
75
75
  }, panels.map(function (panel, i) {
76
76
  var Icon = panel.icon;
@@ -6,13 +6,15 @@ Object.defineProperty(exports, '__esModule', {
6
6
 
7
7
  var styleInject_es = require('../../../node_modules/style-inject/dist/style-inject.es.js');
8
8
 
9
- var css_248z = ".corePanelLeft-module_wrapper__d2Omx{height:100%;left:-550px;max-width:550px;position:fixed;top:0;transition:all .4s ease-in-out;width:550px;z-index:2}@media screen and (max-width:550px){.corePanelLeft-module_wrapperClosed__Zd1CL{left:-75vw;max-width:75vw;width:75vw}.corePanelLeft-module_active__-A3TW{width:100%}}.corePanelLeft-module_active__-A3TW{left:0;z-index:var(--echo-framework-z-level-panel-left)}@media screen and (max-width:892px) and (orientation:portrait){.corePanelLeft-module_wrapper__d2Omx{height:calc(100% - 48px)}}@media screen and (max-width:1078px) and (orientation:landscape){.corePanelLeft-module_active__-A3TW{left:48px}}.corePanelLeft-module_drawer__Wdb3G{background-color:#fff;border-left:2px solid #f7f7f7;box-shadow:0 6px 4px #00000040;display:flex;flex-direction:column;height:100%;opacity:0;overflow-y:hidden;position:relative;transition:opacity .4s ease-in-out;width:auto}.corePanelLeft-module_active__-A3TW .corePanelLeft-module_drawer__Wdb3G{opacity:1}.corePanelLeft-module_buttonContainer__bs-Uu{display:flex;flex-direction:column;position:absolute;right:-70px;top:0}@media screen and (max-width:1078px) and (orientation:landscape){.corePanelLeft-module_buttonContainer__bs-Uu{right:-118px}}.corePanelLeft-module_button__SqyKk{margin-left:var(--medium);margin-top:var(--small)}";
9
+ var css_248z = ".corePanelLeft-module_wrapper__d2Omx{height:100%;left:-550px;max-width:550px;position:fixed;top:0;transition:all .4s ease-in-out;width:550px;z-index:2}@media screen and (max-width:550px){.corePanelLeft-module_wrapperClosed__Zd1CL{left:-75vw;max-width:75vw;padding:env(safe-area-inset-top,56px) env(safe-area-inset-right,56px) env(safe-area-inset-bottom,56px) env(safe-area-inset-left,56px);width:75vw}.corePanelLeft-module_active__-A3TW{width:100%}}.corePanelLeft-module_active__-A3TW{left:0;z-index:var(--echo-framework-z-level-panel-left)}@media screen and (max-width:892px) and (orientation:portrait){.corePanelLeft-module_wrapper__d2Omx{height:calc(100% - 48px)}}@media screen and (max-width:1078px) and (orientation:landscape){.corePanelLeft-module_active__-A3TW{left:48px;padding:env(safe-area-inset-top,56px) env(safe-area-inset-right,56px) env(safe-area-inset-bottom,56px) env(safe-area-inset-left,56px)}}.corePanelLeft-module_drawer__Wdb3G{background-color:#fff;border-left:2px solid #f7f7f7;box-shadow:0 6px 4px #00000040;display:flex;flex-direction:column;height:100%;opacity:0;overflow-y:hidden;position:relative;transition:opacity .4s ease-in-out;width:auto}.corePanelLeft-module_active__-A3TW .corePanelLeft-module_drawer__Wdb3G{opacity:1}.corePanelLeft-module_buttonContainer__bs-Uu{display:flex;flex-direction:column;position:absolute;right:-70px;top:0}@media screen and (max-width:1078px) and (orientation:landscape){.corePanelLeft-module_buttonContainerActive__oAcAV{right:calc(-70px + env(safe-area-inset-right, 20px))}.corePanelLeft-module_buttonContainerClosed__55yp-{right:calc(-118px - env(safe-area-inset-right, 20px))}}.corePanelLeft-module_button__SqyKk{margin-left:var(--medium);margin-top:var(--small)}";
10
10
  var style = {
11
11
  "wrapper": "corePanelLeft-module_wrapper__d2Omx",
12
12
  "wrapperClosed": "corePanelLeft-module_wrapperClosed__Zd1CL",
13
13
  "active": "corePanelLeft-module_active__-A3TW",
14
14
  "drawer": "corePanelLeft-module_drawer__Wdb3G",
15
15
  "buttonContainer": "corePanelLeft-module_buttonContainer__bs-Uu",
16
+ "buttonContainerActive": "corePanelLeft-module_buttonContainerActive__oAcAV",
17
+ "buttonContainerClosed": "corePanelLeft-module_buttonContainerClosed__55yp-",
16
18
  "button": "corePanelLeft-module_button__SqyKk"
17
19
  };
18
20
  styleInject_es["default"](css_248z);
@@ -6,7 +6,7 @@ Object.defineProperty(exports, '__esModule', {
6
6
 
7
7
  var styleInject_es = require('../../../node_modules/style-inject/dist/style-inject.es.js');
8
8
 
9
- var css_248z = ".corePanelRight-module_wrapper__YN3Zr{height:100%;max-width:550px;position:fixed;right:-352px;top:0;transition:all .4s ease-in-out;width:352px;z-index:2}.corePanelRight-module_active__RIMQt{right:0;z-index:var(--echo-framework-z-level-panel-main)}@media screen and (max-width:550px){.corePanelRight-module_active__RIMQt{width:100%}}@media screen and (max-width:892px) and (orientation:portrait){.corePanelRight-module_wrapper__YN3Zr{height:calc(100% - 48px)}}@media screen and (max-width:1078px) and (orientation:landscape){.corePanelRight-module_wrapper__YN3Zr{left:-352px}.corePanelRight-module_active__RIMQt{left:48px;z-index:var(--echo-framework-z-level-panel-main)}}.corePanelRight-module_drawer__1-ucH{background-color:#fff;border-left:2px solid #f7f7f7;box-shadow:0 6px 4px #00000040;display:flex;flex-direction:column;height:100%;opacity:0;overflow-y:auto;position:relative;transition:opacity .4s ease-in-out;width:auto}.corePanelRight-module_active__RIMQt .corePanelRight-module_drawer__1-ucH{opacity:1}.corePanelRight-module_buttonContainer__62imJ{display:flex;flex-direction:column;left:-90px;position:absolute;top:0}.corePanelRight-module_button__WBdfZ{margin-left:var(--medium);margin-top:var(--small)}";
9
+ var css_248z = ".corePanelRight-module_wrapper__YN3Zr{height:100%;max-width:550px;position:fixed;right:-352px;top:0;transition:all .4s ease-in-out;width:352px;z-index:2}.corePanelRight-module_active__RIMQt{right:0;z-index:var(--echo-framework-z-level-panel-main)}@media screen and (max-width:550px){.corePanelRight-module_active__RIMQt{width:100%}}@media screen and (max-width:892px) and (orientation:portrait){.corePanelRight-module_wrapper__YN3Zr{height:calc(100% - 48px)}}@media screen and (max-width:1078px) and (orientation:landscape){.corePanelRight-module_wrapper__YN3Zr{left:-352px}.corePanelRight-module_active__RIMQt{left:48px;padding:env(safe-area-inset-top,20px) env(safe-area-inset-right,20px) env(safe-area-inset-bottom,20px) env(safe-area-inset-left,20px);z-index:var(--echo-framework-z-level-panel-main)}}.corePanelRight-module_drawer__1-ucH{background-color:#fff;border-left:2px solid #f7f7f7;box-shadow:0 6px 4px #00000040;display:flex;flex-direction:column;height:100%;opacity:0;overflow-y:auto;position:relative;transition:opacity .4s ease-in-out;width:auto}.corePanelRight-module_active__RIMQt .corePanelRight-module_drawer__1-ucH{opacity:1}.corePanelRight-module_buttonContainer__62imJ{display:flex;flex-direction:column;left:-90px;position:absolute;top:0}.corePanelRight-module_button__WBdfZ{margin-left:var(--medium);margin-top:var(--small)}";
10
10
  var style = {
11
11
  "wrapper": "corePanelRight-module_wrapper__YN3Zr",
12
12
  "active": "corePanelRight-module_active__RIMQt",
@@ -32,8 +32,6 @@ var React = require('react');
32
32
 
33
33
  var reactRouterDom = require('react-router-dom');
34
34
 
35
- var hookLibrary = require('../hooks/hookLibrary.js');
36
-
37
35
  var logo_ee = require('../icons/logo_ee.js');
38
36
 
39
37
  var EchoContent_module = require('./EchoContent.module.css.js');
@@ -48,24 +46,12 @@ var EchoUtils__default = /*#__PURE__*/_interopDefaultLegacy(EchoUtils);
48
46
 
49
47
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
50
48
 
51
- exports.BarButtonVariants = void 0;
52
-
53
- (function (BarButtonVariants) {
54
- BarButtonVariants["Home"] = "home";
55
- BarButtonVariants["Search"] = "search";
56
- BarButtonVariants["Camera"] = "camera";
57
- BarButtonVariants["Menu"] = "menu";
58
- })(exports.BarButtonVariants || (exports.BarButtonVariants = {}));
59
-
60
49
  var EchoBarComponent = function EchoBarComponent(_ref) {
61
- var isBottomBarVisible = _ref.isBottomBarVisible;
50
+ var isBottomBarVisible = _ref.isBottomBarVisible,
51
+ activeAppMenuItem = _ref.activeAppMenuItem,
52
+ updateActiveAppMenuItem = _ref.updateActiveAppMenuItem;
62
53
  var useStateSafe = EchoUtils__default["default"].Hooks.useStateSafe;
63
54
 
64
- var _React$useState = React.useState(''),
65
- _React$useState2 = _slicedToArray(_React$useState, 2),
66
- activeKey = _React$useState2[0],
67
- setActiveKey = _React$useState2[1];
68
-
69
55
  var _useStateSafe = useStateSafe(false),
70
56
  _useStateSafe2 = _slicedToArray(_useStateSafe, 2),
71
57
  isSyncing = _useStateSafe2[0],
@@ -74,20 +60,16 @@ var EchoBarComponent = function EchoBarComponent(_ref) {
74
60
  var _EchoCore$usePanels = EchoCore.usePanels(),
75
61
  setActivePanel = _EchoCore$usePanels.setActivePanel,
76
62
  activePanel = _EchoCore$usePanels.activePanel;
77
- /* Use this call once the new camera is ready */
78
- // const goToInternalLink = useInternalLink();
79
- // goToInternalLink(InternalApplicationLinks.OnlineCamera);
80
-
81
63
 
82
- var goToCameraLink = hookLibrary.HookLibrary.useInternalLinkToScan();
64
+ var goToInternalLink = EchoCore.useInternalLink();
83
65
 
84
66
  var _EchoCore$usePlantSet = EchoCore.usePlantSettings(),
85
67
  selectedInstCode = _EchoCore$usePlantSet.instCode;
86
68
 
87
69
  var history = reactRouterDom.useHistory();
88
70
  React.useEffect(function () {
89
- var unSubscribeSyncing = echoBase.eventHub.subscribe('isSyncing', function (active) {
90
- setIsSyncing(active);
71
+ var unSubscribeSyncing = echoBase.eventHub.subscribe('isSyncing', function (syncing) {
72
+ setIsSyncing(syncing);
91
73
  });
92
74
  return function () {
93
75
  unSubscribeSyncing();
@@ -97,28 +79,29 @@ var EchoBarComponent = function EchoBarComponent(_ref) {
97
79
  var onClickButton = function onClickButton(key) {
98
80
  setActivePanel('');
99
81
 
100
- if (key === activeKey) {
101
- if (key === exports.BarButtonVariants.Menu || exports.BarButtonVariants.Search) {
82
+ if (key === activeAppMenuItem) {
83
+ if (key === 'menu' || key === 'search') {
84
+ updateActiveAppMenuItem('');
102
85
  setActivePanel('');
103
86
  } else {
104
- history.goBack();
87
+ goToInternalLink("/");
105
88
  }
106
89
 
107
- setActiveKey('');
90
+ updateActiveAppMenuItem('');
108
91
  } else {
109
- setActiveKey(key);
92
+ updateActiveAppMenuItem(key);
110
93
 
111
94
  switch (key) {
112
- case exports.BarButtonVariants.Home:
95
+ case 'home':
113
96
  return history.push("/?instCode=".concat(selectedInstCode));
114
97
 
115
- case exports.BarButtonVariants.Search:
98
+ case 'search':
116
99
  return setActivePanel(EchoCore.ECHO_CORE_SEARCH);
117
100
 
118
- case exports.BarButtonVariants.Camera:
119
- return goToCameraLink();
101
+ case 'camera':
102
+ return goToInternalLink("newcamera");
120
103
 
121
- case exports.BarButtonVariants.Menu:
104
+ case 'menu':
122
105
  return setActivePanel(EchoCore.ECHO_CORE_MAIN);
123
106
 
124
107
  default:
@@ -126,7 +109,7 @@ var EchoBarComponent = function EchoBarComponent(_ref) {
126
109
  }
127
110
  }
128
111
 
129
- setActiveKey('');
112
+ updateActiveAppMenuItem('');
130
113
  };
131
114
 
132
115
  var EchoIcon = logo_ee.icon;
@@ -139,34 +122,34 @@ var EchoBarComponent = function EchoBarComponent(_ref) {
139
122
  }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
140
123
  variant: "ghost_icon",
141
124
  onClick: function onClick() {
142
- return onClickButton(exports.BarButtonVariants.Home);
125
+ return onClickButton('home');
143
126
  }
144
127
  }, /*#__PURE__*/React__default["default"].createElement(EchoIcon, null))), /*#__PURE__*/React__default["default"].createElement("div", {
145
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'search' && activePanel === 'echoCoreSearch' ? EchoContent_module["default"].activeBottomBarButton : '')
128
+ className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeAppMenuItem === 'search' && activePanel === 'echoCoreSearch' ? EchoContent_module["default"].activeBottomBarButton : '')
146
129
  }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
147
130
  variant: "ghost_icon",
148
131
  onClick: function onClick() {
149
- return onClickButton(exports.BarButtonVariants.Search);
132
+ return onClickButton('search');
150
133
  }
151
134
  }, /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
152
135
  name: 'search',
153
136
  color: echoComponents.themeConst.echoText
154
137
  }))), /*#__PURE__*/React__default["default"].createElement("div", {
155
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'camera' && EchoContent_module["default"].activeBottomBarButton)
138
+ className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeAppMenuItem === 'camera' ? EchoContent_module["default"].activeBottomBarButton : '')
156
139
  }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
157
140
  variant: "ghost_icon",
158
141
  onClick: function onClick() {
159
- return onClickButton(exports.BarButtonVariants.Camera);
142
+ return onClickButton('camera');
160
143
  }
161
144
  }, /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
162
145
  name: 'camera',
163
146
  color: echoComponents.themeConst.echoText
164
147
  }))), /*#__PURE__*/React__default["default"].createElement("div", {
165
- className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeKey === 'menu' && activePanel === 'echoCoreMain' ? EchoContent_module["default"].activeBottomBarButton : '')
148
+ className: "".concat(EchoContent_module["default"].barButtons, " ").concat(activeAppMenuItem === 'menu' && activePanel === 'echoCoreMain' ? EchoContent_module["default"].activeBottomBarButton : '')
166
149
  }, /*#__PURE__*/React__default["default"].createElement(edsCoreReact.Button, {
167
150
  variant: "ghost_icon",
168
151
  onClick: function onClick() {
169
- return onClickButton(exports.BarButtonVariants.Menu);
152
+ return onClickButton('menu');
170
153
  }
171
154
  }, isSyncing ? /*#__PURE__*/React__default["default"].createElement(echoComponents.Icon, {
172
155
  className: EchoContent_module["default"].spinningIcon,
@@ -179,4 +162,3 @@ var EchoBarComponent = function EchoBarComponent(_ref) {
179
162
  };
180
163
 
181
164
  exports.EchoBarComponent = EchoBarComponent;
182
- exports["default"] = EchoBarComponent;
@@ -36,16 +36,17 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
36
36
 
37
37
  var EchoContent = function EchoContent(_ref) {
38
38
  var children = _ref.children,
39
+ isLeftAndRightPanelHidden = _ref.isLeftAndRightPanelHidden,
39
40
  Legend = _ref.Legend;
40
41
 
41
42
  var _useScreenValues$useS = useScreenValues.useScreenValues(),
42
43
  isScreenMobileSize = _useScreenValues$useS.isScreenMobileSize;
43
44
 
44
- return /*#__PURE__*/React__default["default"].createElement(EchoCore.ModuleContextProvider, null, /*#__PURE__*/React__default["default"].createElement(corePanelLeft["default"], {
45
+ return /*#__PURE__*/React__default["default"].createElement(EchoCore.ModuleContextProvider, null, !isLeftAndRightPanelHidden && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(corePanelLeft["default"], {
45
46
  isToggleButtonVisible: !isScreenMobileSize
46
47
  }), /*#__PURE__*/React__default["default"].createElement(corePanelRight["default"], {
47
48
  isToggleButtonVisible: !isScreenMobileSize
48
- }), children, Legend && /*#__PURE__*/React__default["default"].createElement(Legend, null));
49
+ })), children, Legend && /*#__PURE__*/React__default["default"].createElement(Legend, null));
49
50
  };
50
51
 
51
52
  exports.EchoContent = EchoContent;
@@ -0,0 +1,66 @@
1
+ 'use strict';
2
+
3
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
+
5
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
6
+
7
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
8
+
9
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
10
+
11
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
12
+
13
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
+
15
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
16
+
17
+ Object.defineProperty(exports, '__esModule', {
18
+ value: true
19
+ });
20
+
21
+ var React = require('react');
22
+
23
+ function _interopDefaultLegacy(e) {
24
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
25
+ 'default': e
26
+ };
27
+ }
28
+
29
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
30
+
31
+ var EchoUiContext = /*#__PURE__*/React__default["default"].createContext({
32
+ activeAppMenuItem: '',
33
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars -- need to match interface
34
+ updateActiveAppMenuItem: function updateActiveAppMenuItem(newActiveAppMenuItem) {
35
+ throw new Error('Echo UI Context not initialized');
36
+ }
37
+ });
38
+
39
+ var useEchoUiContext = function useEchoUiContext() {
40
+ return React__default["default"].useContext(EchoUiContext);
41
+ };
42
+
43
+ var EchoUiContextProvider = function EchoUiContextProvider(_ref) {
44
+ var children = _ref.children;
45
+
46
+ var _React__default$defau = React__default["default"].useState(''),
47
+ _React__default$defau2 = _slicedToArray(_React__default$defau, 2),
48
+ activeAppMenuItem = _React__default$defau2[0],
49
+ setActiveAppMenuItem = _React__default$defau2[1];
50
+
51
+ var updateActiveAppMenuItem = React__default["default"].useCallback(function (newActiveAppMenuItem) {
52
+ return setActiveAppMenuItem(newActiveAppMenuItem);
53
+ }, []);
54
+ var value = React__default["default"].useMemo(function () {
55
+ return {
56
+ activeAppMenuItem: activeAppMenuItem,
57
+ updateActiveAppMenuItem: updateActiveAppMenuItem
58
+ };
59
+ }, [activeAppMenuItem, updateActiveAppMenuItem]);
60
+ return /*#__PURE__*/React__default["default"].createElement(EchoUiContext.Provider, {
61
+ value: value
62
+ }, children);
63
+ };
64
+
65
+ exports.EchoUiContextProvider = EchoUiContextProvider;
66
+ exports.useEchoUiContext = useEchoUiContext;
@@ -25,8 +25,6 @@ exports.RegisteredHookName = void 0;
25
25
  RegisteredHookName["useIsContextMenuInfoLoading"] = "useIsContextMenuInfoLoading";
26
26
  RegisteredHookName["useSetActiveCommPackNo"] = "useSetActiveCommPackNo";
27
27
  RegisteredHookName["useSetActiveMcPackNo"] = "useSetActiveMcPackNo";
28
- RegisteredHookName["useDeviceOrientation"] = "useDeviceOrientation";
29
- RegisteredHookName["useInternalLinkToScan"] = "useInternalLinkToScan";
30
28
  })(exports.RegisteredHookName || (exports.RegisteredHookName = {}));
31
29
 
32
30
  var HookLibrary = Object.freeze({
@@ -83,21 +81,6 @@ var HookLibrary = Object.freeze({
83
81
  */
84
82
  useSetActiveMcPackNo: function useSetActiveMcPackNo() {
85
83
  return EchoCore__default["default"].echoHookRegistry.getHookByName(exports.RegisteredHookName.useSetActiveMcPackNo)();
86
- },
87
-
88
- /**
89
- * Hook for detecting device orientation from native devices.
90
- * @returns {DeviceOrientation}
91
- */
92
- useDeviceOrientation: function useDeviceOrientation() {
93
- return EchoCore__default["default"].echoHookRegistry.getHookByName(exports.RegisteredHookName.useDeviceOrientation)();
94
- },
95
-
96
- /**
97
- * Hook for opening camera.
98
- */
99
- useInternalLinkToScan: function useInternalLinkToScan() {
100
- return EchoCore__default["default"].echoHookRegistry.getHookByName(exports.RegisteredHookName.useInternalLinkToScan)();
101
84
  }
102
85
  });
103
86
  exports.HookLibrary = HookLibrary;
@@ -34,7 +34,7 @@ function useIsCompactLayout(isLandscape) {
34
34
  setIsMobileWidth = _React$useState2[1]; //This calculation is connected to the viewport metatag in index.html
35
35
 
36
36
 
37
- var scaledClientWidth = !!windowSize.width && windowSize.width * 0.86;
37
+ var scaledClientWidth = windowSize.width * 0.86;
38
38
  var roundedClientWidth = Math.ceil(scaledClientWidth);
39
39
  var smallScreenPortrait = roundedClientWidth < 768 && !isLandscape;
40
40
  var smallScreenLandscape = roundedClientWidth < 928 && isLandscape;
@@ -12,8 +12,6 @@ require('react-router-dom');
12
12
 
13
13
  var useScreenOrientation = require('./useScreenOrientation.js');
14
14
 
15
- var hookLibrary = require('./hookLibrary.js');
16
-
17
15
  var useIsCompactLayout = require('./useIsCompactLayout.js');
18
16
 
19
17
  require('@equinor/echo-utils');
@@ -26,22 +24,11 @@ require('../services/echopediaAnalyticsModule/echopediaAnalyticsModule.js');
26
24
 
27
25
  function useScreenValues() {
28
26
  var screenOrientation = useScreenOrientation.useScreenOrientation();
29
-
30
- var _hookLibrary$HookLibr = hookLibrary.HookLibrary.useDeviceOrientation(),
31
- landscape = _hookLibrary$HookLibr.landscape,
32
- portrait = _hookLibrary$HookLibr.portrait;
33
-
34
- var isWeb = !landscape && !portrait;
35
- var isLandscapeWeb = screenOrientation === 'landscape';
36
- var isScreenMobileSize = useIsCompactLayout.useIsCompactLayout(isWeb ? isLandscapeWeb : landscape);
27
+ var isLandscape = screenOrientation === 'landscape';
28
+ var isScreenMobileSize = useIsCompactLayout.useIsCompactLayout(isLandscape);
37
29
  return {
38
- isWeb: isWeb,
39
30
  isScreenMobileSize: isScreenMobileSize,
40
- screenOrientationDevice: {
41
- landscape: landscape,
42
- portrait: portrait
43
- },
44
- screenOrientationWeb: screenOrientation
31
+ screenOrientation: screenOrientation
45
32
  };
46
33
  }
47
34
 
@@ -20,8 +20,8 @@ var React = require('react'); // useWindowSize from usehooks.com
20
20
 
21
21
  /**
22
22
  * Get the current size of the browser window.
23
- * @returns {width?: number; height?: number} Width and height of the current browser window size.
24
- * Returns undefined if there is no window object (for example: executed on server side)
23
+ * @returns {width?: number; height?: number} Width and height of the current browser size.
24
+
25
25
  */
26
26
 
27
27
 
package/dist/src/index.js CHANGED
@@ -88,6 +88,8 @@ var EchoContentPanels = require('./coreApplication/EchoContentPanels.js');
88
88
 
89
89
  var EchoEventHandler = require('./coreApplication/EchoEventHandler.js');
90
90
 
91
+ var EchoUserInterfaceContextProvider = require('./coreApplication/EchoUserInterfaceContextProvider.js');
92
+
91
93
  var toastActions = require('./services/eventHubActions/toastActions.js');
92
94
 
93
95
  var themeConst = require('./theme/themeConst.js');
@@ -185,17 +187,13 @@ exports.EchoRoutes = routes.EchoRoutes;
185
187
  exports.TagNumber = tagNumber.TagNumber;
186
188
  exports.Toaster = toaster.Toaster;
187
189
  exports.Toasters = toasters.Toasters;
188
- Object.defineProperty(exports, 'BarButtonVariants', {
189
- enumerable: true,
190
- get: function get() {
191
- return EchoBarComponent.BarButtonVariants;
192
- }
193
- });
194
190
  exports.EchoBarComponent = EchoBarComponent.EchoBarComponent;
195
191
  exports.EchoContent = EchoContent.EchoContent;
196
192
  exports.mainMenu = EchoContentPanels.mainMenu;
197
193
  exports.searchPanel = EchoContentPanels.searchPanel;
198
194
  exports.EchoEventHandler = EchoEventHandler.EchoEventHandler;
195
+ exports.EchoUiContextProvider = EchoUserInterfaceContextProvider.EchoUiContextProvider;
196
+ exports.useEchoUiContext = EchoUserInterfaceContextProvider.useEchoUiContext;
199
197
  exports.displayToast = toastActions.displayToast;
200
198
  exports.themeConst = themeConst.themeConst;
201
199
  Object.defineProperty(exports, 'ExtendableComponentName', {
@@ -30,15 +30,19 @@ require('@equinor/echo-components');
30
30
 
31
31
  require('../node_modules/classnames/index.js');
32
32
 
33
- var EchoBarComponent = require('./coreApplication/EchoBarComponent.js');
33
+ require('@equinor/echo-base');
34
34
 
35
- require('./components/panel/corePanelLeft.js');
35
+ require('@equinor/echo-utils');
36
36
 
37
- require('./components/panel/corePanelRight.js');
37
+ require('@equinor/eds-core-react');
38
38
 
39
39
  require('react-router-dom');
40
40
 
41
- require('@equinor/eds-core-react');
41
+ require('./coreApplication/EchoContent.module.css.js');
42
+
43
+ require('./components/panel/corePanelLeft.js');
44
+
45
+ require('./components/panel/corePanelRight.js');
42
46
 
43
47
  require('./components/pageMenu/accordionItem.module.css.js');
44
48
 
@@ -48,8 +52,6 @@ require('./components/pageMenu/pageMenu.module.css.js');
48
52
 
49
53
  require('./components/pageMenu/pageMenuDrawerItem.module.css.js');
50
54
 
51
- require('@equinor/echo-base');
52
-
53
55
  require('./components/pageMenu/settings/settings.module.css.js');
54
56
 
55
57
  require('./services/api/api-manager.js');
@@ -66,8 +68,6 @@ var externalLinkButton = require('./components/externalLinkButton/externalLinkBu
66
68
 
67
69
  require('./services/echopediaAnalyticsModule/echopediaAnalyticsModule.js');
68
70
 
69
- require('@equinor/echo-utils');
70
-
71
71
  var pingableSources = require('./types/pingableSources.js');
72
72
 
73
73
  var index = require('./components/contextualAppLinks/index.js');
@@ -155,13 +155,6 @@ exports.getLegendStatusColor = legendUtils.getLegendStatusColor;
155
155
  exports.legendTypeToLegendStatus = legendUtils.legendTypeToLegendStatus;
156
156
  exports.valueToEnum = legendUtils.valueToEnum;
157
157
  exports.goToExternalLink = navigationUtils.goToExternalLink;
158
- Object.defineProperty(exports, 'BarButtonVariants', {
159
- enumerable: true,
160
- get: function get() {
161
- return EchoBarComponent.BarButtonVariants;
162
- }
163
- });
164
- exports.EchoBarComponent = EchoBarComponent.EchoBarComponent;
165
158
  exports.ExternalLinkButton = externalLinkButton.ExternalLinkButton;
166
159
  Object.defineProperty(exports, 'ExternalLinkButtonStyle', {
167
160
  enumerable: true,
@@ -2,8 +2,4 @@ export declare type SetActiveTagNo = (tagNo: string, activeTagTab?: string, acti
2
2
  export declare type TagData = [(tagNo: string, instCode: string) => void];
3
3
  export declare type SetActiveCommPackNo = (commPackNo: string, activeCommPackProject: string, activeCommPackTab?: string, activeCommPackSubTab?: string) => void;
4
4
  export declare type SetActiveMcPackNo = (mcPackNo: string, activeMcPackProject: string, activeMcPackTab?: string, activeMcPackSubTab?: string) => void;
5
- export interface DeviceOrientation {
6
- portrait: boolean;
7
- landscape: boolean;
8
- }
9
5
  export declare type ScreenOrientation = 'landscape' | 'portrait' | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/echo-framework",
3
- "version": "0.9.10",
3
+ "version": "0.9.13",
4
4
  "description": "Modules and components for EchoWeb, utilizing EchoCore",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/index.d.ts",