@laerdal/life-react-components 1.8.0-dev.16 → 1.8.0-dev.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/GlobalNavigationBar/Actions.cjs +185 -0
- package/dist/GlobalNavigationBar/Actions.cjs.map +1 -0
- package/dist/GlobalNavigationBar/Actions.d.ts +13 -0
- package/dist/GlobalNavigationBar/Actions.js +160 -0
- package/dist/GlobalNavigationBar/Actions.js.map +1 -0
- package/dist/GlobalNavigationBar/Avatar.cjs +104 -0
- package/dist/GlobalNavigationBar/Avatar.cjs.map +1 -0
- package/dist/GlobalNavigationBar/Avatar.d.ts +15 -0
- package/dist/GlobalNavigationBar/Avatar.js +77 -0
- package/dist/GlobalNavigationBar/Avatar.js.map +1 -0
- package/dist/GlobalNavigationBar/{desktop/ExtendedMainMenu.cjs → ExtendedMainMenu.cjs} +9 -7
- package/dist/GlobalNavigationBar/ExtendedMainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/{desktop/ExtendedMainMenu.d.ts → ExtendedMainMenu.d.ts} +2 -2
- package/dist/GlobalNavigationBar/{desktop/ExtendedMainMenu.js → ExtendedMainMenu.js} +6 -6
- package/dist/GlobalNavigationBar/ExtendedMainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +176 -107
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +27 -13
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +176 -106
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.cjs +5 -3
- package/dist/GlobalNavigationBar/Logo.cjs.map +1 -1
- package/dist/GlobalNavigationBar/Logo.js +1 -1
- package/dist/GlobalNavigationBar/Logo.js.map +1 -1
- package/dist/GlobalNavigationBar/{desktop/MainMenu.cjs → MainMenu.cjs} +21 -17
- package/dist/GlobalNavigationBar/MainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/MainMenu.d.ts +8 -0
- package/dist/GlobalNavigationBar/{desktop/MainMenu.js → MainMenu.js} +21 -17
- package/dist/GlobalNavigationBar/MainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/{desktop/RightSideNav.cjs → RightSideNav.cjs} +26 -22
- package/dist/GlobalNavigationBar/RightSideNav.cjs.map +1 -0
- package/dist/GlobalNavigationBar/RightSideNav.d.ts +8 -0
- package/dist/GlobalNavigationBar/RightSideNav.js +61 -0
- package/dist/GlobalNavigationBar/RightSideNav.js.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs +112 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.d.ts +11 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js +86 -0
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs +178 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.d.ts +16 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js +146 -0
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs +168 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.d.ts +15 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js +135 -0
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/index.cjs +18 -15
- package/dist/GlobalNavigationBar/index.cjs.map +1 -1
- package/dist/GlobalNavigationBar/index.d.ts +2 -2
- package/dist/GlobalNavigationBar/index.js +2 -2
- package/dist/GlobalNavigationBar/index.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs +21 -15
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.d.ts +6 -3
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js +15 -14
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs +49 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.d.ts +6 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js +27 -0
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs +91 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.d.ts +13 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js +70 -0
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +221 -114
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +25 -6
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js +216 -113
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/MenuItem/MenuItem.cjs +10 -16
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.d.ts +3 -3
- package/dist/MenuItem/MenuItem.js +8 -14
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +11 -20
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -1
- package/dist/ProfileButton/ProfileButton.d.ts +1 -3
- package/dist/ProfileButton/ProfileButton.js +10 -18
- package/dist/ProfileButton/ProfileButton.js.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.cjs +78 -24
- package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.d.ts +5 -6
- package/dist/Switcher/MobileSwitcherMenu.js +70 -26
- package/dist/Switcher/MobileSwitcherMenu.js.map +1 -1
- package/dist/Tile/TileBody.cjs +1 -1
- package/dist/Tile/TileBody.cjs.map +1 -1
- package/dist/Tile/TileBody.js +1 -1
- package/dist/Tile/TileBody.js.map +1 -1
- package/dist/Tile/TileCommonItems.cjs +1 -1
- package/dist/Tile/TileCommonItems.cjs.map +1 -1
- package/dist/Tile/TileCommonItems.js +1 -1
- package/dist/Tile/TileCommonItems.js.map +1 -1
- package/dist/Tile/TileFooter.cjs +1 -1
- package/dist/Tile/TileFooter.cjs.map +1 -1
- package/dist/Tile/TileFooter.js +1 -1
- package/dist/Tile/TileFooter.js.map +1 -1
- package/dist/Tile/TileHeader.cjs +1 -1
- package/dist/Tile/TileHeader.cjs.map +1 -1
- package/dist/Tile/TileHeader.js +2 -2
- package/dist/Tile/TileHeader.js.map +1 -1
- package/dist/hooks/useClickOutside.cjs +2 -6
- package/dist/hooks/useClickOutside.cjs.map +1 -1
- package/dist/hooks/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside.js +2 -6
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +32 -0
- package/dist/types.js.map +1 -1
- package/package.json +8 -10
- package/dist/GlobalNavigationBar/NavigationHelper.cjs +0 -38
- package/dist/GlobalNavigationBar/NavigationHelper.cjs.map +0 -1
- package/dist/GlobalNavigationBar/NavigationHelper.d.ts +0 -4
- package/dist/GlobalNavigationBar/NavigationHelper.js +0 -27
- package/dist/GlobalNavigationBar/NavigationHelper.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +0 -127
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/DesktopActions.d.ts +0 -15
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +0 -98
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +0 -8
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +0 -8
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +0 -59
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +0 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +0 -204
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.d.ts +0 -7
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +0 -163
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs +0 -221
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.d.ts +0 -11
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js +0 -184
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +0 -160
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.d.ts +0 -12
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +0 -139
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js.map +0 -1
- package/dist/GlobalNavigationBar/types.cjs +0 -6
- package/dist/GlobalNavigationBar/types.cjs.map +0 -1
- package/dist/GlobalNavigationBar/types.d.ts +0 -120
- package/dist/GlobalNavigationBar/types.js +0 -2
- package/dist/GlobalNavigationBar/types.js.map +0 -1
- package/dist/common/StackState.cjs +0 -47
- package/dist/common/StackState.cjs.map +0 -1
- package/dist/common/StackState.d.ts +0 -7
- package/dist/common/StackState.js +0 -30
- package/dist/common/StackState.js.map +0 -1
|
@@ -1,153 +1,256 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
1
2
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
3
|
import _pt from "prop-types";
|
|
3
4
|
|
|
4
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
|
|
5
6
|
|
|
6
7
|
import * as React from 'react';
|
|
7
8
|
import styled from 'styled-components';
|
|
8
|
-
import { BREAKPOINTS, COLORS,
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
9
|
+
import { BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles } from '../../styles';
|
|
10
|
+
import Actions from '../Actions';
|
|
11
|
+
import { Close, Notification, SwitchApp } from '../../icons/systemicons/SystemIcons';
|
|
12
|
+
import MobileActionMenu from './MobileActionMenu';
|
|
13
|
+
import { MenuSection, MenuSectionList, MenuWrapper, Right, RowLayout } from './CommonStyles';
|
|
14
|
+
import { NavLink, useLocation } from 'react-router-dom';
|
|
15
|
+
import { SwitcherMenuItem } from '../../Switcher';
|
|
16
|
+
import Avatar, { AvatarContainer } from '../Avatar';
|
|
17
|
+
import MobileUserMenu from '../UserMenu/MobileUserMenu';
|
|
11
18
|
import { IconButton } from '../../Button';
|
|
12
19
|
import { LaerdalLogo } from '../../assets';
|
|
13
|
-
import
|
|
14
|
-
import MobileMenuContent from './MobileMenuContent';
|
|
15
|
-
import { useMediaQuery } from 'react-responsive';
|
|
16
|
-
import { useStackState } from '../../common/StackState';
|
|
20
|
+
import { ComponentMStyling, ComponentXSStyling } from '../../styles/typography';
|
|
17
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
-
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
-
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
23
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
+
var SwitchButton = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n \n padding: 0;\n border: 0;\n margin: 0 auto 0 12px;\n line-height: 48px;\n"])), ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600));
|
|
25
|
+
var BottomPinnedSection = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n left: 0;\n width: 100%;\n bottom: 0;\n border-top: 1px solid ", ";\n"])), COLORS.neutral_200);
|
|
26
|
+
var FirstRowLayout = styled(RowLayout)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n margin-top: 10px;\n padding: 12px;\n"])));
|
|
27
|
+
var BottomRowLayout = styled(RowLayout)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n margin: 8px auto 0 0;\n width: 95%;\n height: 48px;\n ", " {\n height: 56px;\n }\n"])), BREAKPOINTS.SMALL);
|
|
28
|
+
var StyledNavItem = styled(SwitcherMenuItem)(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n padding: 0 0 0 20px;\n margin: 0 2px;\n\n display: flex;\n align-items: center;\n text-align: center;\n position: relative;\n\n ", "\n text-decoration: none;\n\n svg {\n margin-right: 16px;\n }\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 4px;\n background-color: transparent;\n }\n\n &.active:not(.disabled) {\n font-weight: bold;\n &:after {\n background-color: ", ";\n }\n\n color: ", ";\n svg path {\n fill: ", ";\n }\n }\n\n &.disabled {\n color: ", ";\n background-color: ", ";\n }\n\n &:hover:not(.disabled) {\n color: ", ";\n background-color: ", ";\n\n svg path {\n fill: ", ";\n }\n }\n\n &:active:not(.disabled) {\n color: ", ";\n background-color: ", ";\n &:after {\n background-color: ", ";\n }\n svg path {\n fill: ", ";\n }\n }\n\n &:focus:not(.disabled) {\n ", "\n }\n"])), ComponentMStyling(ComponentTextStyle.Regular, COLORS.black), COLORS.primary_500, COLORS.primary_800, COLORS.primary_800, COLORS.neutral_300, COLORS.neutral_100, COLORS.primary_600, COLORS.primary_20, COLORS.primary_600, COLORS.primary_800, COLORS.primary_100, COLORS.primary_500, COLORS.primary_800, focusStyles);
|
|
29
|
+
var SwitcherButton = styled.div(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n display: flex;\n margin-left: auto;\n\n line-height: 48px;\n button:last-child {\n margin: 0 !important;\n }\n"])));
|
|
24
30
|
|
|
25
31
|
var MobileMenu = function MobileMenu(_ref) {
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
32
|
+
var clickMenuAction = _ref.clickMenuAction,
|
|
33
|
+
navigationOptions = _ref.navigationOptions,
|
|
34
|
+
actions = _ref.actions,
|
|
35
|
+
firstName = _ref.firstName,
|
|
36
|
+
lastName = _ref.lastName,
|
|
37
|
+
email = _ref.email,
|
|
38
|
+
signout = _ref.signout,
|
|
39
|
+
notifications = _ref.notifications,
|
|
40
|
+
accountSection = _ref.accountSection,
|
|
41
|
+
organizationSection = _ref.organizationSection,
|
|
42
|
+
supportSection = _ref.supportSection,
|
|
43
|
+
switcherAction = _ref.switcherAction,
|
|
44
|
+
accountMenuHeader = _ref.accountMenuHeader,
|
|
45
|
+
signOutLabel = _ref.signOutLabel,
|
|
46
|
+
organizationName = _ref.organizationName,
|
|
47
|
+
useUserMenu = _ref.useUserMenu,
|
|
48
|
+
showUserMenu = _ref.showUserMenu,
|
|
49
|
+
setShowUserMenu = _ref.setShowUserMenu;
|
|
37
50
|
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
pop = _useStackState.pop,
|
|
43
|
-
peek = _useStackState.peek;
|
|
51
|
+
var _React$useState = React.useState(false),
|
|
52
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
53
|
+
showNotificationMenu = _React$useState2[0],
|
|
54
|
+
setShowNotificationMenu = _React$useState2[1];
|
|
44
55
|
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
56
|
+
var notificationMenuRef = React.useRef(null);
|
|
57
|
+
var userMenuRef = React.useRef(null);
|
|
58
|
+
var userRef = React.useRef(null);
|
|
48
59
|
var location = useLocation();
|
|
49
60
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
label: menu.label,
|
|
56
|
-
buttons: menu.buttons
|
|
57
|
-
},
|
|
58
|
-
content: {
|
|
59
|
-
header: menu.header,
|
|
60
|
-
items: menu.items,
|
|
61
|
-
footer: menu.footer,
|
|
62
|
-
action: menu.action
|
|
63
|
-
},
|
|
64
|
-
footer: false
|
|
65
|
-
});
|
|
66
|
-
break;
|
|
61
|
+
if (actions !== null && actions !== void 0 && actions.user) {
|
|
62
|
+
actions.user = function () {
|
|
63
|
+
return setShowUserMenu(true);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
if (actions !== null && actions !== void 0 && actions.notification) {
|
|
68
|
+
actions.notification = function () {
|
|
69
|
+
return setShowNotificationMenu(true);
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var fireAction = function fireAction(action) {
|
|
74
|
+
var _ref$current;
|
|
75
|
+
|
|
76
|
+
var ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
77
|
+
ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.blur();
|
|
78
|
+
!!action && action();
|
|
79
|
+
};
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
var isPressingEnter = function isPressingEnter(e) {
|
|
82
|
+
if (e.key === 'Enter') {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
return true;
|
|
81
86
|
}
|
|
87
|
+
|
|
88
|
+
return false;
|
|
82
89
|
};
|
|
83
90
|
|
|
84
91
|
React.useEffect(function () {
|
|
85
|
-
|
|
92
|
+
clickMenuAction();
|
|
86
93
|
}, [location]);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
buttons: buttons
|
|
94
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
95
|
+
children: [(actions === null || actions === void 0 ? void 0 : actions.notification) && /*#__PURE__*/_jsx(MenuWrapper, {
|
|
96
|
+
ref: notificationMenuRef,
|
|
97
|
+
className: showNotificationMenu ? 'open' : '',
|
|
98
|
+
isVisible: showNotificationMenu,
|
|
99
|
+
children: /*#__PURE__*/_jsx(MobileActionMenu, {
|
|
100
|
+
name: "Notifications",
|
|
101
|
+
clickMenuAction: function clickMenuAction() {
|
|
102
|
+
return setShowNotificationMenu(false);
|
|
97
103
|
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
footer: footer,
|
|
102
|
-
action: action
|
|
104
|
+
navigationOptions: notifications,
|
|
105
|
+
actionList: {
|
|
106
|
+
notification: function notification() {}
|
|
103
107
|
}
|
|
104
|
-
})
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
108
|
+
})
|
|
109
|
+
}), (actions === null || actions === void 0 ? void 0 : actions.user) && /*#__PURE__*/_jsx(MenuWrapper, {
|
|
110
|
+
ref: userMenuRef,
|
|
111
|
+
className: showUserMenu ? 'open' : '',
|
|
112
|
+
isVisible: showUserMenu,
|
|
113
|
+
children: /*#__PURE__*/_jsx(MobileUserMenu, {
|
|
114
|
+
accountMenuHeader: accountMenuHeader,
|
|
115
|
+
firstName: firstName,
|
|
116
|
+
lastName: lastName,
|
|
117
|
+
email: email,
|
|
118
|
+
organizationName: organizationName,
|
|
119
|
+
clickMenuAction: clickMenuAction,
|
|
120
|
+
accountSection: accountSection,
|
|
121
|
+
organizationSection: organizationSection,
|
|
122
|
+
supportSection: supportSection,
|
|
123
|
+
signOut: signout,
|
|
124
|
+
signOutLabel: signOutLabel
|
|
125
|
+
})
|
|
126
|
+
}), /*#__PURE__*/_jsxs(FirstRowLayout, {
|
|
127
|
+
children: [firstName && lastName && /*#__PURE__*/_jsx(AvatarContainer, {
|
|
128
|
+
id: "avatarContainer",
|
|
129
|
+
ref: userRef,
|
|
130
|
+
onClick: actions === null || actions === void 0 ? void 0 : actions.user,
|
|
131
|
+
onKeyDown: function onKeyDown(e) {
|
|
132
|
+
return isPressingEnter(e) ? fireAction(actions === null || actions === void 0 ? void 0 : actions.user, userRef) : null;
|
|
133
|
+
},
|
|
134
|
+
inMobileMenu: true,
|
|
135
|
+
hideOnLowWidth: false,
|
|
136
|
+
children: /*#__PURE__*/_jsx(Avatar, {
|
|
137
|
+
size: 36,
|
|
138
|
+
firstName: firstName,
|
|
139
|
+
lastName: lastName,
|
|
140
|
+
color: COLORS.primary_500,
|
|
141
|
+
profileMenuLink: "#TODO"
|
|
142
|
+
})
|
|
143
|
+
}), (actions === null || actions === void 0 ? void 0 : actions.notification) && /*#__PURE__*/_jsx(IconButton, {
|
|
144
|
+
variant: 'secondary',
|
|
145
|
+
shape: 'circular',
|
|
146
|
+
hideOnLowWidth: false,
|
|
147
|
+
isInMobileMenu: true,
|
|
148
|
+
action: function action() {
|
|
149
|
+
return fireAction(actions === null || actions === void 0 ? void 0 : actions.notification);
|
|
150
|
+
},
|
|
151
|
+
onKeyPress: function onKeyPress(e) {
|
|
152
|
+
return isPressingEnter(e) ? fireAction(actions === null || actions === void 0 ? void 0 : actions.notification) : null;
|
|
153
|
+
},
|
|
154
|
+
children: /*#__PURE__*/_jsx(Notification, {
|
|
155
|
+
size: "24px"
|
|
156
|
+
})
|
|
157
|
+
}), /*#__PURE__*/_jsxs(Right, {
|
|
158
|
+
children: [/*#__PURE__*/_jsx(Actions, {
|
|
159
|
+
actions: actions,
|
|
160
|
+
firstName: firstName,
|
|
161
|
+
lastName: lastName,
|
|
162
|
+
isInMobileMenu: true,
|
|
163
|
+
hideOnLowWidth: false,
|
|
164
|
+
useUserMenu: useUserMenu,
|
|
165
|
+
setShowUserMenu: setShowUserMenu
|
|
132
166
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
133
|
-
variant:
|
|
134
|
-
shape:
|
|
135
|
-
id: "globalNavAppsButton",
|
|
167
|
+
variant: "secondary",
|
|
168
|
+
shape: "circular",
|
|
136
169
|
action: function action() {
|
|
137
|
-
return
|
|
170
|
+
return clickMenuAction();
|
|
138
171
|
},
|
|
139
|
-
|
|
172
|
+
isInMobileMenu: true,
|
|
173
|
+
children: /*#__PURE__*/_jsx(Close, {
|
|
140
174
|
size: "24px"
|
|
141
175
|
})
|
|
142
176
|
})]
|
|
143
177
|
})]
|
|
178
|
+
}), /*#__PURE__*/_jsx(MenuSection, {
|
|
179
|
+
children: /*#__PURE__*/_jsx(MenuSectionList, {
|
|
180
|
+
children: navigationOptions === null || navigationOptions === void 0 ? void 0 : navigationOptions.map(function (no) {
|
|
181
|
+
return /*#__PURE__*/_jsx("li", {
|
|
182
|
+
children: /*#__PURE__*/_jsx(StyledNavItem, {
|
|
183
|
+
as: NavLink,
|
|
184
|
+
exact: no === null || no === void 0 ? void 0 : no.exact,
|
|
185
|
+
to: no.to,
|
|
186
|
+
onClick: function onClick() {
|
|
187
|
+
if (no !== null && no !== void 0 && no.onClick) {
|
|
188
|
+
no === null || no === void 0 ? void 0 : no.onClick();
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
children: no.label
|
|
192
|
+
})
|
|
193
|
+
}, no.label);
|
|
194
|
+
})
|
|
195
|
+
})
|
|
196
|
+
}), /*#__PURE__*/_jsx(BottomPinnedSection, {
|
|
197
|
+
children: /*#__PURE__*/_jsx(MenuSection, {
|
|
198
|
+
style: {
|
|
199
|
+
padding: '0 12px 12px 12px',
|
|
200
|
+
margin: '0'
|
|
201
|
+
},
|
|
202
|
+
children: /*#__PURE__*/_jsx(MenuSectionList, {
|
|
203
|
+
children: /*#__PURE__*/_jsxs(BottomRowLayout, {
|
|
204
|
+
children: [/*#__PURE__*/_jsx(LaerdalLogo, {}), switcherAction && /*#__PURE__*/_jsxs(SwitcherButton, {
|
|
205
|
+
children: [/*#__PURE__*/_jsx(SwitchButton, {
|
|
206
|
+
onClick: function onClick() {
|
|
207
|
+
return switcherAction();
|
|
208
|
+
},
|
|
209
|
+
children: "Switch site"
|
|
210
|
+
}), ' ', /*#__PURE__*/_jsx(IconButton, {
|
|
211
|
+
variant: 'secondary',
|
|
212
|
+
shape: 'circular',
|
|
213
|
+
hideOnLowWidth: false,
|
|
214
|
+
isInMobileMenu: true,
|
|
215
|
+
id: "globalNavAppsButton",
|
|
216
|
+
action: function action() {
|
|
217
|
+
return switcherAction();
|
|
218
|
+
},
|
|
219
|
+
onKeyPress: function onKeyPress(e) {
|
|
220
|
+
return isPressingEnter(e) ? switcherAction() : null;
|
|
221
|
+
},
|
|
222
|
+
children: /*#__PURE__*/_jsx(SwitchApp, {
|
|
223
|
+
size: "24px"
|
|
224
|
+
})
|
|
225
|
+
})]
|
|
226
|
+
})]
|
|
227
|
+
})
|
|
228
|
+
})
|
|
229
|
+
})
|
|
144
230
|
})]
|
|
145
231
|
});
|
|
146
232
|
};
|
|
147
233
|
|
|
148
234
|
MobileMenu.propTypes = {
|
|
149
|
-
|
|
150
|
-
|
|
235
|
+
name: _pt.string.isRequired,
|
|
236
|
+
navigationOptions: _pt.array,
|
|
237
|
+
secondaryNavigationOptions: _pt.array,
|
|
238
|
+
clickMenuAction: _pt.func.isRequired,
|
|
239
|
+
firstName: _pt.string.isRequired,
|
|
240
|
+
lastName: _pt.string.isRequired,
|
|
241
|
+
email: _pt.string.isRequired,
|
|
242
|
+
signout: _pt.func,
|
|
243
|
+
isAuthenticated: _pt.bool,
|
|
244
|
+
notifications: _pt.array,
|
|
245
|
+
switcherAction: _pt.func,
|
|
246
|
+
accountSection: _pt.array,
|
|
247
|
+
organizationSection: _pt.array,
|
|
248
|
+
supportSection: _pt.array,
|
|
249
|
+
accountMenuHeader: _pt.string.isRequired,
|
|
250
|
+
signOutLabel: _pt.string.isRequired,
|
|
251
|
+
organizationName: _pt.string.isRequired,
|
|
252
|
+
showUserMenu: _pt.bool.isRequired,
|
|
253
|
+
setShowUserMenu: _pt.func.isRequired
|
|
151
254
|
};
|
|
152
255
|
export default MobileMenu;
|
|
153
256
|
//# sourceMappingURL=MobileMenu.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","Z_INDEXES","SwitchApp","useLocation","IconButton","LaerdalLogo","MobileMenuHeader","MobileMenuContent","useMediaQuery","useStackState","Wrapper","div","off_canvas","SMALL","SwitcherLabel","MobileFooter","neutral_200","Bold","neutral_600","CustomContent","MobileMenu","show","profile","buttons","label","header","items","footer","action","onClose","reset","length","push","pop","peek","isMediumScreen","query","MEDIUM","replace","location","onSubMenuOpen","menu","type","content","customContent","custom","useEffect","setTimeout","current","switcher","find","a","undefined"],"mappings":";;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AACA,SAAQC,WAAR,EAAqBC,MAArB,EAA6BC,iBAA7B,EAAgDC,kBAAhD,EAAoEC,kBAApE,EAAwFC,SAAxF,QAAwG,cAAxG;AACA,SAAQC,SAAR,QAAwB,qCAAxB;AACA,SAAQC,WAAR,QAA0B,kBAA1B;AACA,SAAQC,UAAR,QAAyB,cAAzB;AACA,SAAQC,WAAR,QAA0B,cAA1B;AAiBA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,iBAAP,MAA8B,qBAA9B;AACA,SAAQC,aAAR,QAA4B,kBAA5B;AACA,SAAQC,aAAR,QAA4B,yBAA5B;;;;AAEA,IAAMC,OAAO,GAAGf,MAAM,CAACgB,GAAV,uPAEAV,SAAS,CAACW,UAFV,EAUThB,WAAW,CAACiB,KAVH,CAAb;AAeA,IAAMC,aAAa,GAAGnB,MAAM,CAACgB,GAAV,+FAAnB;AAIA,IAAMI,YAAY,GAAGpB,MAAM,CAACgB,GAAV,iTAOQd,MAAM,CAACmB,WAPf,EASdhB,kBAAkB,CAACD,kBAAkB,CAACkB,IAApB,EAA0BpB,MAAM,CAACqB,WAAjC,CATJ,EAUdtB,WAAW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B,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEL,OAAT,CAAiBf,MAH5C;AAImB,MAAA,aAAa,EAAEY;AAJlC,MARvB,EAeI,CAAAQ,OAAO,SAAP,IAAAA,OAAO,WAAP,YAAAA,OAAO,CAAErB,MAAT,kBACA,MAAC,YAAD;AAAA,8BACE,KAAC,WAAD,KADF,EAEGsB,QAAQ,iBACP;AAAA,gCACE,KAAC,aAAD;AAAe,UAAA,SAAS,EAAE,mBAA1B;AAAA;AAAA,UADF,eAEE,KAAC,UAAD;AACE,UAAA,OAAO,EAAE,WADX;AAEE,UAAA,KAAK,EAAE,UAFT;AAGE,UAAA,EAAE,EAAC,qBAHL;AAIE,UAAA,MAAM,EAAE;AAAA,mBAAMA,QAAQ,CAACrB,MAAT,IAAmBqB,QAAQ,CAACrB,MAAT,EAAnB,IAAwCC,OAAO,EAArD;AAAA,WAJV;AAAA,iCAKE,KAAC,SAAD;AAAW,YAAA,IAAI,EAAC;AAAhB;AALF,UAFF;AAAA,QAHJ;AAAA,MAhBJ;AAAA,IADF;AAoCD,CAvHD;;;AAnBER,EAAAA,I;AACAQ,EAAAA,O;;AA2IF,eAAeT,UAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling, Z_INDEXES} from '../../styles';\nimport {SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport {useLocation} from 'react-router-dom';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {\n MenuAccountInfo,\n MenuButton,\n MenuNavigationItemTypeGroup,\n MenuGroupFooter,\n MenuGroupHeader,\n MenuIconButton,\n MenuNavigationItemTypeItem,\n MobileNavigationMenuProps,\n ProfileMenu,\n MenuNavigationItemTypeSection,\n MenuIconSubMenuButton,\n MobileMenuButtonTypes,\n MenuSwitcherButton,\n MenuNavigationCustomSubMenu\n} from '../types';\nimport MobileMenuHeader from './MobileMenuHeader';\nimport MobileMenuContent from './MobileMenuContent';\nimport {useMediaQuery} from 'react-responsive';\nimport {useStackState} from '../../common/StackState';\n\nconst Wrapper = styled.div`\n width: 320px;\n z-index: ${Z_INDEXES.off_canvas};\n height: 100%;\n box-sizing: border-box;\n\n display: flex;\n flex-direction: column;\n gap: 8px;\n\n ${BREAKPOINTS.SMALL} {\n width: 400px;\n }\n`;\n\nconst SwitcherLabel = styled.div`\n margin-left: auto;\n`;\n\nconst MobileFooter = styled.div`\n display: flex;\n align-items: center;\n box-sizing: border-box;\n height: 48px;\n\n padding: 0 4px 0 16px;\n border-top: 1px solid ${COLORS.neutral_200};\n\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n padding: 4px 8px 4px 16px;\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst CustomContent = styled.div`\n width: 100%;\n box-sizing: border-box;\n flex-flow: column;\n display: flex;\n flex: 1;\n overflow: hidden;\n`;\n\ntype Props = MobileNavigationMenuProps & {\n profile?: ProfileMenu;\n show?: boolean;\n onClose: () => void;\n};\n\ninterface MenuState {\n header: {\n label?: string;\n buttons?: MobileMenuButtonTypes[];\n }\n content?: {\n header?: MenuGroupHeader;\n items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection)[];\n footer?: MenuGroupFooter;\n action?: MenuButton;\n },\n customContent?: () => React.ReactNode;\n footer?: boolean;\n}\n\nconst MobileMenu = ({\n show,\n profile,\n buttons,\n label,\n header,\n items,\n footer,\n action,\n onClose,\n }: Props) => {\n\n const {reset, length, push, pop, peek} = useStackState<MenuState>();\n\n const isMediumScreen = useMediaQuery({query: BREAKPOINTS.MEDIUM.replace('@media ', '')});\n\n const location = useLocation();\n\n const onSubMenuOpen = (menu?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => {\n\n switch (menu?.type) {\n case 'group':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n content: {\n header: menu.header,\n items: menu.items,\n footer: menu.footer,\n action: menu.action\n },\n footer: false\n });\n break;\n case 'custom':\n push({\n header: {\n label: menu.label,\n buttons: menu.buttons,\n },\n customContent: menu.custom,\n footer: false\n });\n break;\n default:\n break;\n }\n\n };\n\n React.useEffect(() => {\n onClose();\n }, [location]);\n\n React.useEffect(() => {\n isMediumScreen && onClose()\n }, [isMediumScreen]);\n\n React.useEffect(() => {\n setTimeout(() => {\n reset({\n footer: true,\n header: {\n label: label,\n buttons: buttons,\n },\n content: {\n header: header,\n items: items,\n footer: footer,\n action: action\n }\n })\n }, 300)\n }, [show])\n\n\n const current = peek();\n\n const switcher = current?.header?.buttons?.find(a => a.type === 'switcher') as MenuSwitcherButton;\n\n return (\n <Wrapper>\n <MobileMenuHeader buttons={current?.header.buttons}\n onGoBack={length > 1 ? pop : undefined}\n onSubMenuOpen={onSubMenuOpen}\n profile={profile}\n label={current?.header.label}\n onClose={onClose}/>\n {current?.customContent && <CustomContent>{current?.customContent()}</CustomContent>}\n {current?.content && <MobileMenuContent header={current?.content.header}\n items={current?.content.items}\n footer={current?.content.footer}\n action={current?.content.action}\n onSubMenuOpen={onSubMenuOpen}/>}\n\n {\n current?.footer &&\n <MobileFooter>\n <LaerdalLogo/>\n {switcher &&\n <>\n <SwitcherLabel className={'globalNav-toggler'}>Switch site</SwitcherLabel>\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n id=\"globalNavAppsButton\"\n action={() => switcher.action && switcher.action() && onClose()}>\n <SwitchApp size=\"24px\"/>\n </IconButton>\n </>\n }\n\n </MobileFooter>\n }\n </Wrapper>\n );\n};\n\nexport default MobileMenu;\n"],"file":"MobileMenu.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenu.tsx"],"names":["React","styled","BREAKPOINTS","COLORS","ComponentTextStyle","focusStyles","Actions","Close","Notification","SwitchApp","MobileActionMenu","MenuSection","MenuSectionList","MenuWrapper","Right","RowLayout","NavLink","useLocation","SwitcherMenuItem","Avatar","AvatarContainer","MobileUserMenu","IconButton","LaerdalLogo","ComponentMStyling","ComponentXSStyling","SwitchButton","span","Bold","neutral_600","BottomPinnedSection","div","neutral_200","FirstRowLayout","BottomRowLayout","SMALL","StyledNavItem","Regular","black","primary_500","primary_800","neutral_300","neutral_100","primary_600","primary_20","primary_100","SwitcherButton","MobileMenu","clickMenuAction","navigationOptions","actions","firstName","lastName","email","signout","notifications","accountSection","organizationSection","supportSection","switcherAction","accountMenuHeader","signOutLabel","organizationName","useUserMenu","showUserMenu","setShowUserMenu","useState","showNotificationMenu","setShowNotificationMenu","notificationMenuRef","useRef","userMenuRef","userRef","location","user","notification","fireAction","action","ref","undefined","current","blur","isPressingEnter","e","key","preventDefault","stopPropagation","useEffect","map","no","exact","to","onClick","label","padding","margin","name","secondaryNavigationOptions","isAuthenticated"],"mappings":";;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,OAAOC,MAAP,MAAmB,mBAAnB;AAEA,SAAQC,WAAR,EAAqBC,MAArB,EAA6BC,kBAA7B,EAAiDC,WAAjD,QAAmE,cAAnE;AAEA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAAQC,KAAR,EAAeC,YAAf,EAA6BC,SAA7B,QAA6C,qCAA7C;AACA,OAAOC,gBAAP,MAA6B,oBAA7B;AACA,SAAQC,WAAR,EAAqBC,eAArB,EAAsCC,WAAtC,EAAmDC,KAAnD,EAA0DC,SAA1D,QAA0E,gBAA1E;AACA,SAAQC,OAAR,EAAiBC,WAAjB,QAAmC,kBAAnC;AACA,SAAQC,gBAAR,QAA+B,gBAA/B;AACA,OAAOC,MAAP,IAAgBC,eAAhB,QAAsC,WAAtC;AACA,OAAOC,cAAP,MAA2B,4BAA3B;AACA,SAAQC,UAAR,QAAyB,cAAzB;AACA,SAAQC,WAAR,QAA0B,cAA1B;AACA,SAAQC,iBAAR,EAA2BC,kBAA3B,QAAoD,y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,a;AACAI,EAAAA,c;AACAH,EAAAA,c;AACAC,EAAAA,mB;AACAC,EAAAA,c;AACAE,EAAAA,iB;AACAC,EAAAA,Y;AACAC,EAAAA,gB;AAEAE,EAAAA,Y;AACAC,EAAAA,e;;AA4KF,eAAelB,UAAf","sourcesContent":["import * as React from 'react';\nimport styled from 'styled-components';\n\nimport {BREAKPOINTS, COLORS, ComponentTextStyle, focusStyles} from '../../styles';\nimport {ActionOptions, NavButton, NavOption, UserMenuItem} from '../../types';\nimport Actions from '../Actions';\nimport {Close, Notification, SwitchApp} from '../../icons/systemicons/SystemIcons';\nimport MobileActionMenu from './MobileActionMenu';\nimport {MenuSection, MenuSectionList, MenuWrapper, Right, RowLayout} from './CommonStyles';\nimport {NavLink, useLocation} from 'react-router-dom';\nimport {SwitcherMenuItem} from '../../Switcher';\nimport Avatar, {AvatarContainer} from '../Avatar';\nimport MobileUserMenu from '../UserMenu/MobileUserMenu';\nimport {IconButton} from '../../Button';\nimport {LaerdalLogo} from '../../assets';\nimport {ComponentMStyling, ComponentXSStyling} from '../../styles/typography';\n\nconst SwitchButton = styled.span`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n \n padding: 0;\n border: 0;\n margin: 0 auto 0 12px;\n line-height: 48px;\n`;\n\nconst BottomPinnedSection = styled.div`\n position: absolute;\n left: 0;\n width: 100%;\n bottom: 0;\n border-top: 1px solid ${COLORS.neutral_200};\n`;\n\nconst FirstRowLayout = styled(RowLayout)`\n margin-top: 10px;\n padding: 12px;\n`;\n\nconst BottomRowLayout = styled(RowLayout)`\n margin: 8px auto 0 0;\n width: 95%;\n height: 48px;\n ${BREAKPOINTS.SMALL} {\n height: 56px;\n }\n`;\n\nconst StyledNavItem = styled(SwitcherMenuItem)`\n padding: 0 0 0 20px;\n margin: 0 2px;\n\n display: flex;\n align-items: center;\n text-align: center;\n position: relative;\n\n ${ComponentMStyling(ComponentTextStyle.Regular, COLORS.black)}\n text-decoration: none;\n\n svg {\n margin-right: 16px;\n }\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n left: 0;\n top: 0;\n bottom: 0;\n width: 4px;\n background-color: transparent;\n }\n\n &.active:not(.disabled) {\n font-weight: bold;\n &:after {\n background-color: ${COLORS.primary_500};\n }\n\n color: ${COLORS.primary_800};\n svg path {\n fill: ${COLORS.primary_800};\n }\n }\n\n &.disabled {\n color: ${COLORS.neutral_300};\n background-color: ${COLORS.neutral_100};\n }\n\n &:hover:not(.disabled) {\n color: ${COLORS.primary_600};\n background-color: ${COLORS.primary_20};\n\n svg path {\n fill: ${COLORS.primary_600};\n }\n }\n\n &:active:not(.disabled) {\n color: ${COLORS.primary_800};\n background-color: ${COLORS.primary_100};\n &:after {\n background-color: ${COLORS.primary_500};\n }\n svg path {\n fill: ${COLORS.primary_800};\n }\n }\n\n &:focus:not(.disabled) {\n ${focusStyles}\n }\n`;\nconst SwitcherButton = styled.div`\n display: flex;\n margin-left: auto;\n\n line-height: 48px;\n button:last-child {\n margin: 0 !important;\n }\n`;\n\ntype Props = {\n name: string;\n navigationOptions?: NavOption[];\n secondaryNavigationOptions?: NavOption[];\n secondaryButton?: NavButton;\n actions?: ActionOptions;\n clickMenuAction: () => void;\n firstName: string;\n lastName: string;\n email: string;\n signout?: (e: any) => void;\n isAuthenticated?: boolean;\n notifications?: NavOption[];\n switcherAction?: () => void;\n accountSection?: UserMenuItem[];\n organizationSection?: UserMenuItem[];\n supportSection?: UserMenuItem[];\n accountMenuHeader: string;\n signOutLabel: string;\n organizationName: string;\n useUserMenu: boolean | undefined;\n showUserMenu: boolean;\n setShowUserMenu: (show: boolean) => void;\n};\n\nconst MobileMenu = ({\n clickMenuAction,\n navigationOptions,\n actions,\n firstName,\n lastName,\n email,\n signout,\n notifications,\n accountSection,\n organizationSection,\n supportSection,\n switcherAction,\n accountMenuHeader,\n signOutLabel,\n organizationName,\n useUserMenu,\n showUserMenu,\n setShowUserMenu,\n}: Props) => {\n const [showNotificationMenu, setShowNotificationMenu] = React.useState<boolean>(false);\n const notificationMenuRef = React.useRef(null);\n const userMenuRef = React.useRef(null);\n const userRef = React.useRef(null);\n\n const location = useLocation();\n\n if (actions?.user) {\n actions.user = () => setShowUserMenu(true);\n }\n if (actions?.notification) {\n actions.notification = () => setShowNotificationMenu(true);\n }\n\n const fireAction = (action: (() => void) | undefined, ref: React.MutableRefObject<HTMLButtonElement | null> | undefined = undefined) => {\n ref?.current?.blur();\n !!action && action();\n };\n\n const isPressingEnter = (e: any) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.stopPropagation();\n return true;\n }\n return false;\n };\n\n React.useEffect(() => {\n clickMenuAction();\n }, [location]);\n\n return (\n <>\n {actions?.notification && (\n <MenuWrapper ref={notificationMenuRef} className={showNotificationMenu ? 'open' : ''} isVisible={showNotificationMenu}>\n <MobileActionMenu\n name=\"Notifications\"\n clickMenuAction={() => setShowNotificationMenu(false)}\n navigationOptions={notifications}\n actionList={{\n notification: () => {},\n }}\n />\n </MenuWrapper>\n )}\n {actions?.user && (\n <MenuWrapper ref={userMenuRef} className={showUserMenu ? 'open' : ''} isVisible={showUserMenu}>\n <MobileUserMenu\n accountMenuHeader={accountMenuHeader}\n firstName={firstName}\n lastName={lastName}\n email={email}\n organizationName={organizationName}\n clickMenuAction={clickMenuAction}\n accountSection={accountSection}\n organizationSection={organizationSection}\n supportSection={supportSection}\n signOut={signout}\n signOutLabel={signOutLabel}\n />\n </MenuWrapper>\n )}\n <FirstRowLayout>\n {firstName && lastName && (\n <AvatarContainer\n id=\"avatarContainer\"\n ref={userRef}\n onClick={actions?.user}\n onKeyDown={(e: any) => (isPressingEnter(e) ? fireAction(actions?.user, userRef) : null)}\n inMobileMenu={true}\n hideOnLowWidth={false}>\n <Avatar size={36} firstName={firstName} lastName={lastName} color={COLORS.primary_500} profileMenuLink=\"#TODO\" />\n </AvatarContainer>\n )}\n {actions?.notification && (\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n hideOnLowWidth={false}\n isInMobileMenu={true}\n action={() => fireAction(actions?.notification)}\n onKeyPress={(e: any) => (isPressingEnter(e) ? fireAction(actions?.notification) : null)}>\n <Notification size=\"24px\" />\n </IconButton>\n )}\n <Right>\n <Actions\n actions={actions}\n firstName={firstName}\n lastName={lastName}\n isInMobileMenu={true}\n hideOnLowWidth={false}\n useUserMenu={useUserMenu}\n setShowUserMenu={setShowUserMenu}\n />\n <IconButton variant=\"secondary\" shape=\"circular\" action={() => clickMenuAction()} isInMobileMenu={true}>\n <Close size=\"24px\" />\n </IconButton>\n </Right>\n </FirstRowLayout>\n <MenuSection>\n <MenuSectionList>\n {navigationOptions?.map((no) => (\n <li key={no.label}>\n <StyledNavItem\n as={NavLink}\n exact={no?.exact}\n to={no.to}\n onClick={() => {\n if (no?.onClick) {\n no?.onClick();\n }\n }}>\n {no.label}\n </StyledNavItem>\n </li>\n ))}\n </MenuSectionList>\n </MenuSection>\n\n <BottomPinnedSection>\n <MenuSection style={{ padding: '0 12px 12px 12px', margin: '0' }}>\n <MenuSectionList>\n <BottomRowLayout>\n <LaerdalLogo />\n {switcherAction && (\n <SwitcherButton>\n <SwitchButton onClick={() => switcherAction()}>Switch site</SwitchButton>{' '}\n <IconButton\n variant={'secondary'}\n shape={'circular'}\n hideOnLowWidth={false}\n isInMobileMenu={true}\n id=\"globalNavAppsButton\"\n action={() => switcherAction()}\n onKeyPress={(e: any) => (isPressingEnter(e) ? switcherAction() : null)}>\n <SwitchApp size=\"24px\" />\n </IconButton>\n </SwitcherButton>\n )}\n </BottomRowLayout>\n </MenuSectionList>\n </MenuSection>\n </BottomPinnedSection>\n </>\n );\n};\n\nexport default MobileMenu;\n"],"file":"MobileMenu.js"}
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.default = exports.
|
|
10
|
+
exports.default = exports.LockedIconContainer = exports.ItemLabel = exports.ItemIcon = exports.ItemContent = exports.DropdownButtonCSS = exports.DropdownButton = void 0;
|
|
11
11
|
|
|
12
12
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
13
|
|
|
@@ -49,11 +49,11 @@ var ItemIcon = _styledComponents.default.div(_templateObject3 || (_templateObjec
|
|
|
49
49
|
|
|
50
50
|
exports.ItemIcon = ItemIcon;
|
|
51
51
|
|
|
52
|
-
var
|
|
52
|
+
var LockedIconContainer = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n\n"])));
|
|
53
53
|
|
|
54
|
-
exports.
|
|
54
|
+
exports.LockedIconContainer = LockedIconContainer;
|
|
55
55
|
|
|
56
|
-
var ItemContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon,
|
|
56
|
+
var ItemContent = _styledComponents.default.div(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ", " {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ", " {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ", " {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n"])), ItemLabel, ItemIcon, LockedIconContainer);
|
|
57
57
|
|
|
58
58
|
exports.ItemContent = ItemContent;
|
|
59
59
|
|
|
@@ -68,11 +68,10 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
68
68
|
var active = _ref.active,
|
|
69
69
|
item = _ref.item,
|
|
70
70
|
onClickHandler = _ref.onClickHandler,
|
|
71
|
-
|
|
72
|
-
size = _ref
|
|
71
|
+
key = _ref.key,
|
|
72
|
+
size = _ref.size,
|
|
73
73
|
className = _ref.className,
|
|
74
74
|
tabIndex = _ref.tabIndex,
|
|
75
|
-
iconRight = _ref.iconRight,
|
|
76
75
|
id = _ref.id;
|
|
77
76
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(DropdownButton, {
|
|
78
77
|
type: "button",
|
|
@@ -100,29 +99,24 @@ var MenuItem = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
100
99
|
},
|
|
101
100
|
children: item.noteLabel
|
|
102
101
|
})]
|
|
103
|
-
}), item.locked && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
102
|
+
}), item.locked && /*#__PURE__*/(0, _jsxRuntime.jsx)(LockedIconContainer, {
|
|
104
103
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SystemIcons.LockedOn, {
|
|
105
104
|
color: _styles.COLORS.neutral_400,
|
|
106
105
|
className: "extraMargin",
|
|
107
106
|
size: "24px"
|
|
108
107
|
})
|
|
109
|
-
}), !item.locked && !!iconRight && /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemIconRight, {
|
|
110
|
-
children: /*#__PURE__*/React.cloneElement(iconRight, {
|
|
111
|
-
className: 'extraMargin',
|
|
112
|
-
size: '24px'
|
|
113
|
-
})
|
|
114
108
|
})]
|
|
115
109
|
})]
|
|
116
110
|
})]
|
|
117
|
-
});
|
|
111
|
+
}, key);
|
|
118
112
|
});
|
|
119
113
|
MenuItem.propTypes = {
|
|
120
114
|
onClickHandler: _propTypes.default.func.isRequired,
|
|
121
115
|
active: _propTypes.default.bool.isRequired,
|
|
122
116
|
id: _propTypes.default.string.isRequired,
|
|
117
|
+
key: _propTypes.default.string.isRequired,
|
|
123
118
|
className: _propTypes.default.string,
|
|
124
|
-
tabIndex: _propTypes.default.number
|
|
125
|
-
iconRight: _propTypes.default.element
|
|
119
|
+
tabIndex: _propTypes.default.number
|
|
126
120
|
};
|
|
127
121
|
var _default = MenuItem;
|
|
128
122
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","
|
|
1
|
+
{"version":3,"sources":["../../src/MenuItem/MenuItem.tsx"],"names":["DropdownButton","styled","button","props","DropdownButtonCSS","size","ItemLabel","div","ItemIcon","LockedIconContainer","ItemContent","css","Size","Small","ComponentTextStyle","Regular","COLORS","neutral_600","Medium","Large","white","CommonInteractionStyling","neutral_20","primary_500","neutral_500","primary_20","primary_600","primary_100","primary_800","neutral_200","MenuItem","React","forwardRef","ref","active","item","onClickHandler","key","className","tabIndex","id","disabled","locked","defaultOnMouseDownHandler","showDividerAbove","icon","displayLabel","value","noteLabel","fontSize","lineHeight","neutral_400"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;;;AAaO,IAAMA,cAAc,GAAGC,0BAAOC,MAAV,8FACvB,UAACC,KAAD;AAAA,SAAWC,iBAAiB,CAACD,KAAK,CAACE,IAAP,CAA5B;AAAA,CADuB,CAApB;;;;AAIA,IAAMC,SAAS,GAAGL,0BAAOM,GAAV,qFAAf;;;;AACA,IAAMC,QAAQ,GAAGP,0BAAOM,GAAV,qFAAd;;;;AAEA,IAAME,mBAAmB,GAAGR,0BAAOM,GAAV,yFAAzB;;;;AAIA,IAAMG,WAAW,GAAGT,0BAAOM,GAAV,wiBAMlBD,SANkB,EAalBE,QAbkB,EAqBlBC,mBArBkB,CAAjB;;;;AA+BA,IAAML,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,IAAD,EAAiB;AAChD,aAAOM,qBA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c;AACAF,EAAAA,M;AACAM,EAAAA,E;AACAH,EAAAA,G;AAEAC,EAAAA,S;AACAC,EAAAA,Q;;eAyKYT,Q","sourcesContent":["import * as React from 'react';\nimport {Link} from 'react-router-dom';\nimport styled, { css } from 'styled-components';\nimport {BREAKPOINTS, COLORS, ComponentTextStyle} from '../styles';\nimport {ChevronRight, LockedOn} from '../icons/systemicons/SystemIcons';\nimport {Product, Size} from '../types';\nimport {ComponentLStyling, ComponentMStyling, ComponentSStyling} from '../styles/typography';\nimport { DropdownItem } from '../Dropdown/DropdownContent';\nimport {CommonInteractionStyling, defaultOnMouseDownHandler} from '../common';\n\nexport interface MenuItemProps {\n item: DropdownItem;\n onClickHandler: (e: any) => void;\n active: boolean;\n id: string;\n key: string;\n size?: Size;\n className?: string;\n tabIndex?: number;\n}\n\nexport const DropdownButton = styled.button<{ size?: Size }>`\n ${(props) => DropdownButtonCSS(props.size)}\n`;\n\nexport const ItemLabel = styled.div``;\nexport const ItemIcon = styled.div``;\n\nexport const LockedIconContainer = styled.div`\n\n`;\n\nexport const ItemContent = styled.div`\n margin: auto 0 auto 16px;\n display: flex;\n align-items: center;\n flex-grow: 2;\n\n ${ItemLabel} {\n flex: 1 0 calc(100% - 40px);\n display: flex;\n flex-direction: row;\n align-items: center;\n }\n\n ${ItemIcon} {\n margin-right: 6px;\n svg {\n display: block;\n margin: auto;\n }\n }\n\n ${LockedIconContainer} {\n flex-grow: 2;\n\n .extraMargin {\n margin-left: calc(100% - 24px);\n }\n }\n`;\n\n\nexport const DropdownButtonCSS = (size?: Size) => {\n return css`\n ${size == Size.Small && ComponentSStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Medium && ComponentMStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n ${size == Size.Large && ComponentLStyling(ComponentTextStyle.Regular, COLORS.neutral_600)}\n\n position: relative;\n text-decoration: none;\n display: flex;\n flex-direction: row;\n align-items: center;\n min-height: ${size == Size.Large ? '64px' : size == Size.Medium ? '56px' : '48px'};\n background-color: ${COLORS.white};\n border: none;\n cursor: pointer;\n background: transparent;\n width: 100%;\n text-align: left;\n\n span {\n margin: auto 0 auto 16px;\n line-height: 48px;\n }\n\n ${CommonInteractionStyling};\n\n &.active {\n background: ${COLORS.neutral_20};\n\n &::after {\n position: absolute;\n content: ' ';\n width: 4px;\n top: 6px;\n bottom: 6px;\n left: 4px;\n background-color: ${COLORS.primary_500};\n\n border-radius: 4px;\n }\n }\n\n\n &.locked {\n background-color: transparent;\n cursor: not-allowed;\n color: ${COLORS.neutral_500};\n }\n\n &.active:hover, &.active-hover-state {\n background-color: ${COLORS.primary_20};\n\n svg {\n color: ${COLORS.primary_600};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &.active:active, &.active-active-state {\n background-color: ${COLORS.primary_100};\n\n svg {\n color: ${COLORS.primary_800};\n }\n\n &::after {\n background-color: ${COLORS.primary_500};\n }\n }\n\n &:disabled, &.disabled-state {\n background-color: transparent !important;\n cursor: not-allowed;\n color: ${COLORS.neutral_200} !important;\n }\n\n &.dropdown-hover:not(:disabled) {\n background-color: ${COLORS.primary_20};\n color: ${COLORS.primary_600};\n }\n `;\n};\n\nconst MenuItem = React.forwardRef<HTMLButtonElement, MenuItemProps>(({\n active,\n item,\n onClickHandler,\n key,\n size,\n className,\n tabIndex,\n id }: MenuItemProps, ref) => {\n return (\n <DropdownButton\n type=\"button\"\n size={size}\n disabled={item.disabled || item.locked}\n tabIndex={tabIndex}\n onMouseDown={defaultOnMouseDownHandler}\n ref={ref}\n onClick={onClickHandler}\n className={ className + ' ' + (item.locked ? 'locked' : '') + ' ' + (item.showDividerAbove ? 'show-divider-above' : '') + ' ' + (active ? 'active' : '')}\n key={key}\n id={id}>\n {item.showDividerAbove && <div className=\"divider\" />}\n <ItemContent>\n {item.icon && <ItemIcon>{item.icon}</ItemIcon>}\n <ItemLabel>\n <div>\n <div>{item.displayLabel ?? item.value}</div>\n {item.noteLabel && <div style={{ fontSize: '12px', lineHeight: '16px' }}>{item.noteLabel}</div>}\n </div>\n {item.locked && <LockedIconContainer>\n <LockedOn color={COLORS.neutral_400} className=\"extraMargin\" size=\"24px\" />\n </LockedIconContainer>}\n </ItemLabel>\n </ItemContent>\n </DropdownButton>\n );\n});\n\nexport default MenuItem;\n"],"file":"MenuItem.cjs"}
|
|
@@ -3,20 +3,20 @@ import { Size } from '../types';
|
|
|
3
3
|
import { DropdownItem } from '../Dropdown/DropdownContent';
|
|
4
4
|
export interface MenuItemProps {
|
|
5
5
|
item: DropdownItem;
|
|
6
|
-
onClickHandler: (e:
|
|
6
|
+
onClickHandler: (e: any) => void;
|
|
7
7
|
active: boolean;
|
|
8
8
|
id: string;
|
|
9
|
+
key: string;
|
|
9
10
|
size?: Size;
|
|
10
11
|
className?: string;
|
|
11
12
|
tabIndex?: number;
|
|
12
|
-
iconRight?: React.ReactElement;
|
|
13
13
|
}
|
|
14
14
|
export declare const DropdownButton: import("styled-components").StyledComponent<"button", any, {
|
|
15
15
|
size?: Size | undefined;
|
|
16
16
|
}, never>;
|
|
17
17
|
export declare const ItemLabel: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
18
18
|
export declare const ItemIcon: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
19
|
-
export declare const
|
|
19
|
+
export declare const LockedIconContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
20
20
|
export declare const ItemContent: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
21
21
|
export declare const DropdownButtonCSS: (size?: Size | undefined) => import("styled-components").FlattenSimpleInterpolation;
|
|
22
22
|
declare const MenuItem: React.ForwardRefExoticComponent<MenuItemProps & React.RefAttributes<HTMLButtonElement>>;
|