@laerdal/life-react-components 1.8.0-dev.14.full → 1.8.0-dev.16
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/Button/Iconbutton.cjs +6 -2
- package/dist/Button/Iconbutton.cjs.map +1 -1
- package/dist/Button/Iconbutton.d.ts +1 -0
- package/dist/Button/Iconbutton.js +6 -2
- package/dist/Button/Iconbutton.js.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs +107 -176
- package/dist/GlobalNavigationBar/GlobalNavigationBar.cjs.map +1 -1
- package/dist/GlobalNavigationBar/GlobalNavigationBar.d.ts +13 -27
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js +106 -176
- package/dist/GlobalNavigationBar/GlobalNavigationBar.js.map +1 -1
- package/dist/GlobalNavigationBar/Logo.cjs +3 -5
- 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/NavigationHelper.cjs +38 -0
- package/dist/GlobalNavigationBar/NavigationHelper.cjs.map +1 -0
- package/dist/GlobalNavigationBar/NavigationHelper.d.ts +4 -0
- package/dist/GlobalNavigationBar/NavigationHelper.js +27 -0
- package/dist/GlobalNavigationBar/NavigationHelper.js.map +1 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs +127 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.d.ts +15 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js +98 -0
- package/dist/GlobalNavigationBar/desktop/DesktopActions.js.map +1 -0
- package/dist/GlobalNavigationBar/{ExtendedMainMenu.cjs → desktop/ExtendedMainMenu.cjs} +7 -9
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/{ExtendedMainMenu.d.ts → desktop/ExtendedMainMenu.d.ts} +2 -2
- package/dist/GlobalNavigationBar/{ExtendedMainMenu.js → desktop/ExtendedMainMenu.js} +6 -6
- package/dist/GlobalNavigationBar/desktop/ExtendedMainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/{MainMenu.cjs → desktop/MainMenu.cjs} +17 -21
- package/dist/GlobalNavigationBar/desktop/MainMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/MainMenu.d.ts +8 -0
- package/dist/GlobalNavigationBar/{MainMenu.js → desktop/MainMenu.js} +17 -21
- package/dist/GlobalNavigationBar/desktop/MainMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/{RightSideNav.cjs → desktop/RightSideNav.cjs} +22 -26
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/RightSideNav.d.ts +8 -0
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +59 -0
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +204 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.d.ts +7 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +163 -0
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -0
- package/dist/GlobalNavigationBar/index.cjs +15 -18
- 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 +15 -21
- package/dist/GlobalNavigationBar/mobile/CommonStyles.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/CommonStyles.d.ts +3 -6
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js +14 -15
- package/dist/GlobalNavigationBar/mobile/CommonStyles.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs +114 -221
- package/dist/GlobalNavigationBar/mobile/MobileMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenu.d.ts +6 -25
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js +113 -216
- package/dist/GlobalNavigationBar/mobile/MobileMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs +221 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.d.ts +11 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js +184 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuContent.js.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs +160 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.cjs.map +1 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.d.ts +12 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js +139 -0
- package/dist/GlobalNavigationBar/mobile/MobileMenuHeader.js.map +1 -0
- package/dist/GlobalNavigationBar/types.cjs +6 -0
- package/dist/GlobalNavigationBar/types.cjs.map +1 -0
- package/dist/GlobalNavigationBar/types.d.ts +120 -0
- package/dist/GlobalNavigationBar/types.js +2 -0
- package/dist/GlobalNavigationBar/types.js.map +1 -0
- package/dist/InputFields/NumberField.cjs +16 -6
- package/dist/InputFields/NumberField.cjs.map +1 -1
- package/dist/InputFields/NumberField.js +17 -7
- package/dist/InputFields/NumberField.js.map +1 -1
- package/dist/MenuItem/MenuItem.cjs +16 -10
- package/dist/MenuItem/MenuItem.cjs.map +1 -1
- package/dist/MenuItem/MenuItem.d.ts +3 -3
- package/dist/MenuItem/MenuItem.js +14 -8
- package/dist/MenuItem/MenuItem.js.map +1 -1
- package/dist/ProfileButton/ProfileButton.cjs +105 -0
- package/dist/ProfileButton/ProfileButton.cjs.map +1 -0
- package/dist/ProfileButton/ProfileButton.d.ts +14 -0
- package/dist/ProfileButton/ProfileButton.js +79 -0
- package/dist/ProfileButton/ProfileButton.js.map +1 -0
- package/dist/ProfileButton/index.cjs +16 -0
- package/dist/ProfileButton/index.cjs.map +1 -0
- package/dist/ProfileButton/index.d.ts +1 -0
- package/dist/ProfileButton/index.js +2 -0
- package/dist/ProfileButton/index.js.map +1 -0
- package/dist/Switcher/MobileSwitcherMenu.cjs +24 -78
- package/dist/Switcher/MobileSwitcherMenu.cjs.map +1 -1
- package/dist/Switcher/MobileSwitcherMenu.d.ts +6 -5
- package/dist/Switcher/MobileSwitcherMenu.js +26 -70
- package/dist/Switcher/MobileSwitcherMenu.js.map +1 -1
- package/dist/Table/Table.cjs +22 -22
- package/dist/Table/Table.cjs.map +1 -1
- package/dist/Table/Table.js +22 -22
- package/dist/Table/Table.js.map +1 -1
- package/dist/common/StackState.cjs +47 -0
- package/dist/common/StackState.cjs.map +1 -0
- package/dist/common/StackState.d.ts +7 -0
- package/dist/common/StackState.js +30 -0
- package/dist/common/StackState.js.map +1 -0
- package/dist/hooks/useClickOutside.cjs +6 -2
- package/dist/hooks/useClickOutside.cjs.map +1 -1
- package/dist/hooks/useClickOutside.d.ts +1 -1
- package/dist/hooks/useClickOutside.js +6 -2
- package/dist/hooks/useClickOutside.js.map +1 -1
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.ts +0 -32
- package/dist/types.js.map +1 -1
- package/package.json +10 -8
- package/dist/GlobalNavigationBar/Actions.cjs +0 -185
- package/dist/GlobalNavigationBar/Actions.cjs.map +0 -1
- package/dist/GlobalNavigationBar/Actions.d.ts +0 -13
- package/dist/GlobalNavigationBar/Actions.js +0 -160
- package/dist/GlobalNavigationBar/Actions.js.map +0 -1
- package/dist/GlobalNavigationBar/Avatar.cjs +0 -104
- package/dist/GlobalNavigationBar/Avatar.cjs.map +0 -1
- package/dist/GlobalNavigationBar/Avatar.d.ts +0 -15
- package/dist/GlobalNavigationBar/Avatar.js +0 -77
- package/dist/GlobalNavigationBar/Avatar.js.map +0 -1
- package/dist/GlobalNavigationBar/ExtendedMainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/ExtendedMainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/MainMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/MainMenu.d.ts +0 -8
- package/dist/GlobalNavigationBar/MainMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/RightSideNav.cjs.map +0 -1
- package/dist/GlobalNavigationBar/RightSideNav.d.ts +0 -8
- package/dist/GlobalNavigationBar/RightSideNav.js +0 -61
- package/dist/GlobalNavigationBar/RightSideNav.js.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs +0 -112
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.cjs.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.d.ts +0 -11
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js +0 -86
- package/dist/GlobalNavigationBar/UserMenu/MenuLink.js.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs +0 -178
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.d.ts +0 -16
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js +0 -146
- package/dist/GlobalNavigationBar/UserMenu/MobileUserMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs +0 -168
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.d.ts +0 -15
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js +0 -135
- package/dist/GlobalNavigationBar/UserMenu/UserMenu.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs +0 -49
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.d.ts +0 -6
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js +0 -27
- package/dist/GlobalNavigationBar/mobile/ExitMenuButton.js.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs +0 -91
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.cjs.map +0 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.d.ts +0 -13
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js +0 -70
- package/dist/GlobalNavigationBar/mobile/MobileActionMenu.js.map +0 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
|
|
18
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
19
|
+
|
|
20
|
+
var _breakpoints = _interopRequireDefault(require("../../styles/breakpoints"));
|
|
21
|
+
|
|
22
|
+
var _Button = require("../../Button");
|
|
23
|
+
|
|
24
|
+
var _icons = require("../../icons");
|
|
25
|
+
|
|
26
|
+
var _styles = require("../../styles");
|
|
27
|
+
|
|
28
|
+
var _ProfileButton = require("../../ProfileButton");
|
|
29
|
+
|
|
30
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
31
|
+
|
|
32
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
33
|
+
|
|
34
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
35
|
+
|
|
36
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
37
|
+
|
|
38
|
+
var MobileMenuHeaderActions = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n"])));
|
|
39
|
+
|
|
40
|
+
var MobileMenuHeaderLabel = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n ", "\n ", " {\n ", "\n }\n"])), (0, _styles.ComponentXSStyling)(_styles.ComponentTextStyle.Bold, _styles.COLORS.neutral_600), _styles.BREAKPOINTS.SMALL, (0, _styles.ComponentSStyling)(_styles.ComponentTextStyle.Bold, _styles.COLORS.neutral_600));
|
|
41
|
+
|
|
42
|
+
var MobileMenuHeaderWrapper = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ", " {\n padding: 4px 8px;\n }\n\n ", " {\n display: none;\n }\n"])), _breakpoints.default.SMALL, _breakpoints.default.MEDIUM);
|
|
43
|
+
|
|
44
|
+
var MobileMenuHeader = function MobileMenuHeader(_ref) {
|
|
45
|
+
var onGoBack = _ref.onGoBack,
|
|
46
|
+
onClose = _ref.onClose,
|
|
47
|
+
label = _ref.label,
|
|
48
|
+
profile = _ref.profile,
|
|
49
|
+
buttons = _ref.buttons,
|
|
50
|
+
onSubMenuOpen = _ref.onSubMenuOpen;
|
|
51
|
+
|
|
52
|
+
var buildProfileSubMenu = function buildProfileSubMenu() {
|
|
53
|
+
var _profile$signOut, _profile$signOut2, _profile$signOut3, _profile$signOut4;
|
|
54
|
+
|
|
55
|
+
return !!profile ? {
|
|
56
|
+
type: 'group',
|
|
57
|
+
label: profile.label,
|
|
58
|
+
header: {
|
|
59
|
+
header: profile.user.firstName + ' ' + profile.user.lastName,
|
|
60
|
+
note: profile.user.email,
|
|
61
|
+
link: profile.user.link
|
|
62
|
+
},
|
|
63
|
+
action: {
|
|
64
|
+
label: (_profile$signOut = profile.signOut) === null || _profile$signOut === void 0 ? void 0 : _profile$signOut.label,
|
|
65
|
+
action: (_profile$signOut2 = profile.signOut) === null || _profile$signOut2 === void 0 ? void 0 : _profile$signOut2.action,
|
|
66
|
+
icon: (_profile$signOut3 = profile.signOut) === null || _profile$signOut3 === void 0 ? void 0 : _profile$signOut3.icon,
|
|
67
|
+
disabled: (_profile$signOut4 = profile.signOut) === null || _profile$signOut4 === void 0 ? void 0 : _profile$signOut4.disabled
|
|
68
|
+
},
|
|
69
|
+
items: profile.sections.map(function (a) {
|
|
70
|
+
return _objectSpread(_objectSpread({}, a), {}, {
|
|
71
|
+
type: 'section'
|
|
72
|
+
});
|
|
73
|
+
})
|
|
74
|
+
} : undefined;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
var renderItem = function renderItem(item, index) {
|
|
78
|
+
var _profile$user$firstNa, _profile$user, _profile$user$firstNa2, _profile$user$lastNam, _profile$user2, _profile$user2$lastNa;
|
|
79
|
+
|
|
80
|
+
switch (item.type) {
|
|
81
|
+
case 'profile':
|
|
82
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProfileButton.ProfileButton, {
|
|
83
|
+
onClick: function onClick(e) {
|
|
84
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
85
|
+
item.action ? item.action(e === null || e === void 0 ? void 0 : e.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu());
|
|
86
|
+
},
|
|
87
|
+
icon: !profile && /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SystemIcons.User, {}),
|
|
88
|
+
initials: ((_profile$user$firstNa = profile === null || profile === void 0 ? void 0 : (_profile$user = profile.user) === null || _profile$user === void 0 ? void 0 : (_profile$user$firstNa2 = _profile$user.firstName) === null || _profile$user$firstNa2 === void 0 ? void 0 : _profile$user$firstNa2.charAt(0)) !== null && _profile$user$firstNa !== void 0 ? _profile$user$firstNa : '') + ((_profile$user$lastNam = profile === null || profile === void 0 ? void 0 : (_profile$user2 = profile.user) === null || _profile$user2 === void 0 ? void 0 : (_profile$user2$lastNa = _profile$user2.lastName) === null || _profile$user2$lastNa === void 0 ? void 0 : _profile$user2$lastNa.charAt(0)) !== null && _profile$user$lastNam !== void 0 ? _profile$user$lastNam : '')
|
|
89
|
+
}, index);
|
|
90
|
+
|
|
91
|
+
case 'submenu':
|
|
92
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
93
|
+
disabled: item.disabled,
|
|
94
|
+
variant: 'secondary',
|
|
95
|
+
shape: 'circular',
|
|
96
|
+
action: function action(e) {
|
|
97
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
98
|
+
onSubMenuOpen && onSubMenuOpen(item.menu);
|
|
99
|
+
},
|
|
100
|
+
children: item.icon
|
|
101
|
+
}, index);
|
|
102
|
+
|
|
103
|
+
case 'action':
|
|
104
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
105
|
+
disabled: item.disabled,
|
|
106
|
+
variant: 'secondary',
|
|
107
|
+
shape: 'circular',
|
|
108
|
+
action: function action(e) {
|
|
109
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
110
|
+
item.action && item.action(e === null || e === void 0 ? void 0 : e.target) && onClose();
|
|
111
|
+
},
|
|
112
|
+
children: item.icon
|
|
113
|
+
}, index);
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(MobileMenuHeaderWrapper, {
|
|
118
|
+
children: [onGoBack && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
119
|
+
action: function action(e) {
|
|
120
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
121
|
+
onGoBack();
|
|
122
|
+
},
|
|
123
|
+
variant: 'secondary',
|
|
124
|
+
shape: 'circular',
|
|
125
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SystemIcons.ArrowLineLeft, {})
|
|
126
|
+
}), buttons === null || buttons === void 0 ? void 0 : buttons.filter(function (a) {
|
|
127
|
+
return a.placement === 'left';
|
|
128
|
+
}).map(renderItem), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(MobileMenuHeaderLabel, {
|
|
129
|
+
children: label
|
|
130
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(MobileMenuHeaderActions, {
|
|
131
|
+
children: [buttons === null || buttons === void 0 ? void 0 : buttons.filter(function (a) {
|
|
132
|
+
return a.placement !== 'left';
|
|
133
|
+
}).map(renderItem), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
134
|
+
style: {
|
|
135
|
+
marginLeft: '8px'
|
|
136
|
+
},
|
|
137
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
138
|
+
variant: 'secondary',
|
|
139
|
+
action: function action(e) {
|
|
140
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
141
|
+
onClose();
|
|
142
|
+
},
|
|
143
|
+
shape: 'circular',
|
|
144
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.SystemIcons.Close, {})
|
|
145
|
+
})
|
|
146
|
+
})]
|
|
147
|
+
})]
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
MobileMenuHeader.propTypes = {
|
|
152
|
+
onGoBack: _propTypes.default.func,
|
|
153
|
+
onClose: _propTypes.default.func.isRequired,
|
|
154
|
+
label: _propTypes.default.string,
|
|
155
|
+
buttons: _propTypes.default.array,
|
|
156
|
+
onSubMenuOpen: _propTypes.default.func
|
|
157
|
+
};
|
|
158
|
+
var _default = MobileMenuHeader;
|
|
159
|
+
exports.default = _default;
|
|
160
|
+
//# sourceMappingURL=MobileMenuHeader.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenuHeader.tsx"],"names":["MobileMenuHeaderActions","styled","div","MobileMenuHeaderLabel","ComponentTextStyle","Bold","COLORS","neutral_600","BREAKPOINTS","SMALL","MobileMenuHeaderWrapper","Breakpoints","MEDIUM","MobileMenuHeader","onGoBack","onClose","label","profile","buttons","onSubMenuOpen","buildProfileSubMenu","type","header","user","firstName","lastName","note","email","link","action","signOut","icon","disabled","items","sections","map","a","undefined","renderItem","item","index","e","nativeEvent","stopImmediatePropagation","target","charAt","menu","filter","placement","marginLeft"],"mappings":";;;;;;;;;;;;;;;AAAA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,uBAAuB,GAAGC,0BAAOC,GAAV,yKAA7B;;AAMA,IAAMC,qBAAqB,GAAGF,0BAAOC,GAAV,yHACvB,gCAAmBE,2BAAmBC,IAAtC,EAA4CC,eAAOC,WAAnD,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,GAA7C,CAAiDG,UAAjD,CAbJ,EAgBItB,KAAK,iBACL,qBAAC,qBAAD;AAAA,gBAAwBA;AAAxB,MAjBJ,eAmBE,sBAAC,uBAAD;AAAA,iBAEIE,OAFJ,aAEIA,OAFJ,uBAEIA,OAAO,CAAE6B,MAAT,CAAgB,UAAAX,CAAC;AAAA,eAAIA,CAAC,CAACY,SAAF,KAAgB,MAApB;AAAA,OAAjB,EAA6Cb,GAA7C,CAAiDG,UAAjD,CAFJ,EAMIvB,OAAO,iBACP;AAAK,QAAA,KAAK,EAAE;AAACkC,UAAAA,UAAU,EAAE;AAAb,SAAZ;AAAA,+BACE,qBAAC,kBAAD;AAAY,UAAA,OAAO,EAAE,WAArB;AACY,UAAA,MAAM,EAAE,gBAAAR,CAAC,EAAI;AACXA,YAAAA,CAAC,SAAD,IAAAA,CAAC,WAAD,YAAAA,CAAC,CAAEC,WAAH,CAAeC,wBAAf;AACA5B,YAAAA,OAAO;AACR,WAJb;AAKY,UAAA,KAAK,EAAE,UALnB;AAAA,iCAME,qBAAC,kBAAD,CAAa,KAAb;AANF;AADF,QAPJ;AAAA,MAnBF;AAAA,IADF;AA0CD,CAxGD;;;AAXED,EAAAA,Q;AACAC,EAAAA,O;AACAC,EAAAA,K;AAGAE,EAAAA,O;AAEAC,EAAAA,a;;eA+GaN,gB","sourcesContent":["import React, {useImperativeHandle} from 'react';\nimport {\n MenuAccountInfo, MobileMenuButtonTypes,\n MenuIconButton,\n MenuIconSubMenuButton,\n MenuNavigationItemTypeGroup,\n MenuProfileButton, ProfileMenu, MenuNavigationCustomSubMenu\n} from '../types';\nimport styled from 'styled-components';\nimport Breakpoints from '../../styles/breakpoints';\nimport {IconButton} from '../../Button';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling} from '../../styles';\nimport {ProfileButton} from '../../ProfileButton';\n\nconst MobileMenuHeaderActions = styled.div`\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n`;\nconst MobileMenuHeaderLabel = styled.div`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst MobileMenuHeaderWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ${Breakpoints.SMALL} {\n padding: 4px 8px;\n }\n\n ${Breakpoints.MEDIUM} {\n display: none;\n }\n`\n\ninterface MobileMenuHeaderProps {\n onGoBack?: () => void;\n onClose: () => void;\n label?: string;\n\n profile?: ProfileMenu\n buttons?: MobileMenuButtonTypes[];\n\n onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;\n}\n\n\nconst MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps> = ({\n onGoBack,\n onClose,\n label,\n profile,\n buttons,\n onSubMenuOpen\n }) => {\n\n const buildProfileSubMenu = () => !!profile ? {\n type: 'group',\n label: profile.label,\n header: {\n header: profile.user.firstName + ' ' + profile.user.lastName,\n note: profile.user.email,\n link: profile.user.link\n },\n action: {\n label: profile.signOut?.label,\n action: profile.signOut?.action,\n icon: profile.signOut?.icon,\n disabled: profile.signOut?.disabled\n },\n items: profile.sections.map(a => ({...a, type: 'section'}))\n } as MenuNavigationItemTypeGroup : undefined\n\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile':\n return <ProfileButton key={index}\n onClick={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action ? item.action(e?.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu())\n }}\n icon={!profile && <SystemIcons.User/>}\n initials={(profile?.user?.firstName?.charAt(0) ?? '') + (profile?.user?.lastName?.charAt(0) ?? '')}/>\n case 'submenu':\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onSubMenuOpen && onSubMenuOpen(item.menu)\n }}>\n {item.icon}\n </IconButton>\n case 'action':\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action && item.action(e?.target) && onClose();\n }}>\n {item.icon}\n </IconButton>\n }\n }\n\n return (\n <MobileMenuHeaderWrapper>\n {\n onGoBack &&\n <IconButton action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onGoBack();\n }}\n variant={'secondary'}\n shape={'circular'}>\n <SystemIcons.ArrowLineLeft/>\n </IconButton>\n }\n {\n buttons?.filter(a => a.placement === 'left').map(renderItem)\n }\n {\n label &&\n <MobileMenuHeaderLabel>{label}</MobileMenuHeaderLabel>\n }\n <MobileMenuHeaderActions>\n {\n buttons?.filter(a => a.placement !== 'left').map(renderItem)\n }\n\n {\n onClose &&\n <div style={{marginLeft: '8px'}}>\n <IconButton variant={'secondary'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onClose();\n }}\n shape={'circular'}>\n <SystemIcons.Close/>\n </IconButton>\n </div>\n }\n </MobileMenuHeaderActions>\n\n </MobileMenuHeaderWrapper>\n )\n};\n\n\nexport default MobileMenuHeader;\n"],"file":"MobileMenuHeader.cjs"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { MobileMenuButtonTypes, MenuNavigationItemTypeGroup, ProfileMenu, MenuNavigationCustomSubMenu } from '../types';
|
|
3
|
+
interface MobileMenuHeaderProps {
|
|
4
|
+
onGoBack?: () => void;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
label?: string;
|
|
7
|
+
profile?: ProfileMenu;
|
|
8
|
+
buttons?: MobileMenuButtonTypes[];
|
|
9
|
+
onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;
|
|
10
|
+
}
|
|
11
|
+
declare const MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps>;
|
|
12
|
+
export default MobileMenuHeader;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
3
|
+
import _pt from "prop-types";
|
|
4
|
+
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3;
|
|
6
|
+
|
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
8
|
+
|
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10
|
+
|
|
11
|
+
import React from 'react';
|
|
12
|
+
import styled from 'styled-components';
|
|
13
|
+
import Breakpoints from '../../styles/breakpoints';
|
|
14
|
+
import { IconButton } from '../../Button';
|
|
15
|
+
import { SystemIcons } from '../../icons';
|
|
16
|
+
import { BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling } from '../../styles';
|
|
17
|
+
import { ProfileButton } from '../../ProfileButton';
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
|
+
var MobileMenuHeaderActions = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n"])));
|
|
21
|
+
var MobileMenuHeaderLabel = styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n ", "\n ", " {\n ", "\n }\n"])), ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600), BREAKPOINTS.SMALL, ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600));
|
|
22
|
+
var MobileMenuHeaderWrapper = styled.div(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ", " {\n padding: 4px 8px;\n }\n\n ", " {\n display: none;\n }\n"])), Breakpoints.SMALL, Breakpoints.MEDIUM);
|
|
23
|
+
|
|
24
|
+
var MobileMenuHeader = function MobileMenuHeader(_ref) {
|
|
25
|
+
var onGoBack = _ref.onGoBack,
|
|
26
|
+
onClose = _ref.onClose,
|
|
27
|
+
label = _ref.label,
|
|
28
|
+
profile = _ref.profile,
|
|
29
|
+
buttons = _ref.buttons,
|
|
30
|
+
onSubMenuOpen = _ref.onSubMenuOpen;
|
|
31
|
+
|
|
32
|
+
var buildProfileSubMenu = function buildProfileSubMenu() {
|
|
33
|
+
var _profile$signOut, _profile$signOut2, _profile$signOut3, _profile$signOut4;
|
|
34
|
+
|
|
35
|
+
return !!profile ? {
|
|
36
|
+
type: 'group',
|
|
37
|
+
label: profile.label,
|
|
38
|
+
header: {
|
|
39
|
+
header: profile.user.firstName + ' ' + profile.user.lastName,
|
|
40
|
+
note: profile.user.email,
|
|
41
|
+
link: profile.user.link
|
|
42
|
+
},
|
|
43
|
+
action: {
|
|
44
|
+
label: (_profile$signOut = profile.signOut) === null || _profile$signOut === void 0 ? void 0 : _profile$signOut.label,
|
|
45
|
+
action: (_profile$signOut2 = profile.signOut) === null || _profile$signOut2 === void 0 ? void 0 : _profile$signOut2.action,
|
|
46
|
+
icon: (_profile$signOut3 = profile.signOut) === null || _profile$signOut3 === void 0 ? void 0 : _profile$signOut3.icon,
|
|
47
|
+
disabled: (_profile$signOut4 = profile.signOut) === null || _profile$signOut4 === void 0 ? void 0 : _profile$signOut4.disabled
|
|
48
|
+
},
|
|
49
|
+
items: profile.sections.map(function (a) {
|
|
50
|
+
return _objectSpread(_objectSpread({}, a), {}, {
|
|
51
|
+
type: 'section'
|
|
52
|
+
});
|
|
53
|
+
})
|
|
54
|
+
} : undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
var renderItem = function renderItem(item, index) {
|
|
58
|
+
var _profile$user$firstNa, _profile$user, _profile$user$firstNa2, _profile$user$lastNam, _profile$user2, _profile$user2$lastNa;
|
|
59
|
+
|
|
60
|
+
switch (item.type) {
|
|
61
|
+
case 'profile':
|
|
62
|
+
return /*#__PURE__*/_jsx(ProfileButton, {
|
|
63
|
+
onClick: function onClick(e) {
|
|
64
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
65
|
+
item.action ? item.action(e === null || e === void 0 ? void 0 : e.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu());
|
|
66
|
+
},
|
|
67
|
+
icon: !profile && /*#__PURE__*/_jsx(SystemIcons.User, {}),
|
|
68
|
+
initials: ((_profile$user$firstNa = profile === null || profile === void 0 ? void 0 : (_profile$user = profile.user) === null || _profile$user === void 0 ? void 0 : (_profile$user$firstNa2 = _profile$user.firstName) === null || _profile$user$firstNa2 === void 0 ? void 0 : _profile$user$firstNa2.charAt(0)) !== null && _profile$user$firstNa !== void 0 ? _profile$user$firstNa : '') + ((_profile$user$lastNam = profile === null || profile === void 0 ? void 0 : (_profile$user2 = profile.user) === null || _profile$user2 === void 0 ? void 0 : (_profile$user2$lastNa = _profile$user2.lastName) === null || _profile$user2$lastNa === void 0 ? void 0 : _profile$user2$lastNa.charAt(0)) !== null && _profile$user$lastNam !== void 0 ? _profile$user$lastNam : '')
|
|
69
|
+
}, index);
|
|
70
|
+
|
|
71
|
+
case 'submenu':
|
|
72
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
73
|
+
disabled: item.disabled,
|
|
74
|
+
variant: 'secondary',
|
|
75
|
+
shape: 'circular',
|
|
76
|
+
action: function action(e) {
|
|
77
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
78
|
+
onSubMenuOpen && onSubMenuOpen(item.menu);
|
|
79
|
+
},
|
|
80
|
+
children: item.icon
|
|
81
|
+
}, index);
|
|
82
|
+
|
|
83
|
+
case 'action':
|
|
84
|
+
return /*#__PURE__*/_jsx(IconButton, {
|
|
85
|
+
disabled: item.disabled,
|
|
86
|
+
variant: 'secondary',
|
|
87
|
+
shape: 'circular',
|
|
88
|
+
action: function action(e) {
|
|
89
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
90
|
+
item.action && item.action(e === null || e === void 0 ? void 0 : e.target) && onClose();
|
|
91
|
+
},
|
|
92
|
+
children: item.icon
|
|
93
|
+
}, index);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return /*#__PURE__*/_jsxs(MobileMenuHeaderWrapper, {
|
|
98
|
+
children: [onGoBack && /*#__PURE__*/_jsx(IconButton, {
|
|
99
|
+
action: function action(e) {
|
|
100
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
101
|
+
onGoBack();
|
|
102
|
+
},
|
|
103
|
+
variant: 'secondary',
|
|
104
|
+
shape: 'circular',
|
|
105
|
+
children: /*#__PURE__*/_jsx(SystemIcons.ArrowLineLeft, {})
|
|
106
|
+
}), buttons === null || buttons === void 0 ? void 0 : buttons.filter(function (a) {
|
|
107
|
+
return a.placement === 'left';
|
|
108
|
+
}).map(renderItem), label && /*#__PURE__*/_jsx(MobileMenuHeaderLabel, {
|
|
109
|
+
children: label
|
|
110
|
+
}), /*#__PURE__*/_jsxs(MobileMenuHeaderActions, {
|
|
111
|
+
children: [buttons === null || buttons === void 0 ? void 0 : buttons.filter(function (a) {
|
|
112
|
+
return a.placement !== 'left';
|
|
113
|
+
}).map(renderItem), onClose && /*#__PURE__*/_jsx("div", {
|
|
114
|
+
style: {
|
|
115
|
+
marginLeft: '8px'
|
|
116
|
+
},
|
|
117
|
+
children: /*#__PURE__*/_jsx(IconButton, {
|
|
118
|
+
variant: 'secondary',
|
|
119
|
+
action: function action(e) {
|
|
120
|
+
e === null || e === void 0 ? void 0 : e.nativeEvent.stopImmediatePropagation();
|
|
121
|
+
onClose();
|
|
122
|
+
},
|
|
123
|
+
shape: 'circular',
|
|
124
|
+
children: /*#__PURE__*/_jsx(SystemIcons.Close, {})
|
|
125
|
+
})
|
|
126
|
+
})]
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
MobileMenuHeader.propTypes = {
|
|
132
|
+
onGoBack: _pt.func,
|
|
133
|
+
onClose: _pt.func.isRequired,
|
|
134
|
+
label: _pt.string,
|
|
135
|
+
buttons: _pt.array,
|
|
136
|
+
onSubMenuOpen: _pt.func
|
|
137
|
+
};
|
|
138
|
+
export default MobileMenuHeader;
|
|
139
|
+
//# sourceMappingURL=MobileMenuHeader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/GlobalNavigationBar/mobile/MobileMenuHeader.tsx"],"names":["React","styled","Breakpoints","IconButton","SystemIcons","BREAKPOINTS","COLORS","ComponentSStyling","ComponentTextStyle","ComponentXSStyling","ProfileButton","MobileMenuHeaderActions","div","MobileMenuHeaderLabel","Bold","neutral_600","SMALL","MobileMenuHeaderWrapper","MEDIUM","MobileMenuHeader","onGoBack","onClose","label","profile","buttons","onSubMenuOpen","buildProfileSubMenu","type","header","user","firstName","lastName","note","email","link","action","signOut","icon","disabled","items","sections","map","a","undefined","renderItem","item","index","e","nativeEvent","stopImmediatePropagation","target","charAt","menu","filter","placement","marginLeft"],"mappings":";;;;;;;;;;AAAA,OAAOA,KAAP,MAAyC,OAAzC;AAQA,OAAOC,MAAP,MAAmB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AA+GF,eAAeN,gBAAf","sourcesContent":["import React, {useImperativeHandle} from 'react';\nimport {\n MenuAccountInfo, MobileMenuButtonTypes,\n MenuIconButton,\n MenuIconSubMenuButton,\n MenuNavigationItemTypeGroup,\n MenuProfileButton, ProfileMenu, MenuNavigationCustomSubMenu\n} from '../types';\nimport styled from 'styled-components';\nimport Breakpoints from '../../styles/breakpoints';\nimport {IconButton} from '../../Button';\nimport {SystemIcons} from '../../icons';\nimport {BREAKPOINTS, COLORS, ComponentSStyling, ComponentTextStyle, ComponentXSStyling} from '../../styles';\nimport {ProfileButton} from '../../ProfileButton';\n\nconst MobileMenuHeaderActions = styled.div`\n flex: 1;\n justify-content: flex-end;\n display: flex;\n flex-direction: row;\n`;\nconst MobileMenuHeaderLabel = styled.div`\n ${ComponentXSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n ${BREAKPOINTS.SMALL} {\n ${ComponentSStyling(ComponentTextStyle.Bold, COLORS.neutral_600)}\n }\n`;\n\nconst MobileMenuHeaderWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n padding: 0 4px;\n\n ${Breakpoints.SMALL} {\n padding: 4px 8px;\n }\n\n ${Breakpoints.MEDIUM} {\n display: none;\n }\n`\n\ninterface MobileMenuHeaderProps {\n onGoBack?: () => void;\n onClose: () => void;\n label?: string;\n\n profile?: ProfileMenu\n buttons?: MobileMenuButtonTypes[];\n\n onSubMenuOpen?: (item?: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu) => void;\n}\n\n\nconst MobileMenuHeader: React.FunctionComponent<MobileMenuHeaderProps> = ({\n onGoBack,\n onClose,\n label,\n profile,\n buttons,\n onSubMenuOpen\n }) => {\n\n const buildProfileSubMenu = () => !!profile ? {\n type: 'group',\n label: profile.label,\n header: {\n header: profile.user.firstName + ' ' + profile.user.lastName,\n note: profile.user.email,\n link: profile.user.link\n },\n action: {\n label: profile.signOut?.label,\n action: profile.signOut?.action,\n icon: profile.signOut?.icon,\n disabled: profile.signOut?.disabled\n },\n items: profile.sections.map(a => ({...a, type: 'section'}))\n } as MenuNavigationItemTypeGroup : undefined\n\n\n const renderItem = (item: MobileMenuButtonTypes, index: number) => {\n switch (item.type) {\n case 'profile':\n return <ProfileButton key={index}\n onClick={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action ? item.action(e?.target) && onClose() : onSubMenuOpen && onSubMenuOpen(buildProfileSubMenu())\n }}\n icon={!profile && <SystemIcons.User/>}\n initials={(profile?.user?.firstName?.charAt(0) ?? '') + (profile?.user?.lastName?.charAt(0) ?? '')}/>\n case 'submenu':\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onSubMenuOpen && onSubMenuOpen(item.menu)\n }}>\n {item.icon}\n </IconButton>\n case 'action':\n return <IconButton key={index}\n disabled={item.disabled}\n variant={'secondary'}\n shape={'circular'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n item.action && item.action(e?.target) && onClose();\n }}>\n {item.icon}\n </IconButton>\n }\n }\n\n return (\n <MobileMenuHeaderWrapper>\n {\n onGoBack &&\n <IconButton action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onGoBack();\n }}\n variant={'secondary'}\n shape={'circular'}>\n <SystemIcons.ArrowLineLeft/>\n </IconButton>\n }\n {\n buttons?.filter(a => a.placement === 'left').map(renderItem)\n }\n {\n label &&\n <MobileMenuHeaderLabel>{label}</MobileMenuHeaderLabel>\n }\n <MobileMenuHeaderActions>\n {\n buttons?.filter(a => a.placement !== 'left').map(renderItem)\n }\n\n {\n onClose &&\n <div style={{marginLeft: '8px'}}>\n <IconButton variant={'secondary'}\n action={e => {\n e?.nativeEvent.stopImmediatePropagation();\n onClose();\n }}\n shape={'circular'}>\n <SystemIcons.Close/>\n </IconButton>\n </div>\n }\n </MobileMenuHeaderActions>\n\n </MobileMenuHeaderWrapper>\n )\n};\n\n\nexport default MobileMenuHeader;\n"],"file":"MobileMenuHeader.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.cjs"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HyperlinkProps } from '../HyperLink/HyperLink';
|
|
3
|
+
export interface MenuHyperLinkProps extends Pick<HyperlinkProps, 'id' | 'href' | 'onClick' | 'target'> {
|
|
4
|
+
label: string;
|
|
5
|
+
icon?: React.ReactElement;
|
|
6
|
+
}
|
|
7
|
+
export interface MenuButton {
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
action: () => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface MenuGroupFooter {
|
|
14
|
+
header: string;
|
|
15
|
+
note?: string;
|
|
16
|
+
link?: MenuHyperLinkProps;
|
|
17
|
+
}
|
|
18
|
+
export interface MenuGroupHeader {
|
|
19
|
+
header: string;
|
|
20
|
+
note?: string;
|
|
21
|
+
link?: MenuHyperLinkProps;
|
|
22
|
+
}
|
|
23
|
+
export interface MenuAccountInfo {
|
|
24
|
+
firstName: string;
|
|
25
|
+
lastName: string;
|
|
26
|
+
email: string;
|
|
27
|
+
link?: MenuHyperLinkProps;
|
|
28
|
+
}
|
|
29
|
+
export interface ProfileMenu {
|
|
30
|
+
label?: string;
|
|
31
|
+
user: MenuAccountInfo;
|
|
32
|
+
sections: MenuNavigationSection[];
|
|
33
|
+
signOut?: MenuButton;
|
|
34
|
+
}
|
|
35
|
+
export interface MenuIconSubMenuButton {
|
|
36
|
+
type: 'submenu';
|
|
37
|
+
icon: React.ReactNode;
|
|
38
|
+
menu: MenuNavigationItemTypeGroup | MenuNavigationCustomSubMenu;
|
|
39
|
+
placement?: 'left' | 'right';
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
}
|
|
42
|
+
export interface MenuIconButton {
|
|
43
|
+
type: 'action';
|
|
44
|
+
icon: React.ReactNode;
|
|
45
|
+
action: (button?: EventTarget) => boolean | void;
|
|
46
|
+
placement?: 'left' | 'right';
|
|
47
|
+
disabled?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface MenuProfileButton {
|
|
50
|
+
type: 'profile';
|
|
51
|
+
action?: (button?: EventTarget) => boolean | void;
|
|
52
|
+
placement?: 'left' | 'right';
|
|
53
|
+
disabled?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export interface MenuSwitcherButton {
|
|
56
|
+
type: 'switcher';
|
|
57
|
+
placement?: 'left' | 'right';
|
|
58
|
+
disabled?: boolean;
|
|
59
|
+
action?: (button?: EventTarget) => boolean | void;
|
|
60
|
+
}
|
|
61
|
+
export declare type DesktopMenuButtonTypes = MenuIconButton | MenuProfileButton | MenuSwitcherButton;
|
|
62
|
+
export declare type MobileMenuButtonTypes = MenuIconSubMenuButton | MenuIconButton | MenuProfileButton | MenuSwitcherButton;
|
|
63
|
+
export interface MobileNavigationMenuProps {
|
|
64
|
+
label?: string;
|
|
65
|
+
buttons?: MobileMenuButtonTypes[];
|
|
66
|
+
header?: MenuGroupHeader;
|
|
67
|
+
items?: (MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup)[];
|
|
68
|
+
footer?: MenuGroupFooter;
|
|
69
|
+
action?: MenuButton;
|
|
70
|
+
}
|
|
71
|
+
export interface DesktopNavigationMenuProps {
|
|
72
|
+
buttons?: DesktopMenuButtonTypes[];
|
|
73
|
+
items: MenuNavigationItemTypeItem[];
|
|
74
|
+
action?: MenuButton;
|
|
75
|
+
reverseRightSideOrder?: boolean;
|
|
76
|
+
}
|
|
77
|
+
export interface MenuNavigationGroup<T = (MenuNavigationItem | MenuNavigationSection | MenuNavigationGroup)> {
|
|
78
|
+
label: string;
|
|
79
|
+
note?: string;
|
|
80
|
+
buttons?: MobileMenuButtonTypes[];
|
|
81
|
+
header?: MenuGroupHeader;
|
|
82
|
+
items: T[];
|
|
83
|
+
footer?: MenuGroupFooter;
|
|
84
|
+
action?: MenuButton;
|
|
85
|
+
}
|
|
86
|
+
export declare type MenuNavigationItem = {
|
|
87
|
+
icon?: React.ReactNode;
|
|
88
|
+
to: string;
|
|
89
|
+
exact?: boolean;
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
external?: boolean;
|
|
92
|
+
action?: () => void;
|
|
93
|
+
label: string;
|
|
94
|
+
note?: string;
|
|
95
|
+
pinned?: boolean;
|
|
96
|
+
};
|
|
97
|
+
export interface MenuNavigationSection<T = MenuNavigationItem> {
|
|
98
|
+
divider?: boolean;
|
|
99
|
+
pinned?: boolean;
|
|
100
|
+
label?: string;
|
|
101
|
+
items: T[];
|
|
102
|
+
}
|
|
103
|
+
export declare type MenuNavigationItemTypeItem = MenuNavigationItem & {
|
|
104
|
+
type?: 'item';
|
|
105
|
+
};
|
|
106
|
+
export declare type MenuNavigationItemTypeGroup = MenuNavigationGroup<MenuNavigationItemTypeItem | MenuNavigationItemTypeGroup | MenuNavigationItemTypeSection> & {
|
|
107
|
+
type: 'group';
|
|
108
|
+
icon?: React.ReactNode;
|
|
109
|
+
pinned?: boolean;
|
|
110
|
+
disabled?: boolean;
|
|
111
|
+
};
|
|
112
|
+
export declare type MenuNavigationItemTypeSection = MenuNavigationSection<MenuNavigationItemTypeItem> & {
|
|
113
|
+
type: 'section';
|
|
114
|
+
};
|
|
115
|
+
export declare type MenuNavigationCustomSubMenu = {
|
|
116
|
+
type: 'custom';
|
|
117
|
+
label?: string;
|
|
118
|
+
buttons?: MobileMenuButtonTypes[];
|
|
119
|
+
custom: () => React.ReactNode;
|
|
120
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[],"file":"types.js"}
|
|
@@ -39,7 +39,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
39
39
|
|
|
40
40
|
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)([""])));
|
|
41
41
|
|
|
42
|
-
var LabelContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: 4px;\n color: ", ";\n display: flex;\n ", "\n"])), _styles.COLORS.neutral_500, (
|
|
42
|
+
var LabelContainer = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n margin-bottom: 4px;\n color: ", ";\n display: flex;\n ", "\n"])), _styles.COLORS.neutral_500, function (props) {
|
|
43
|
+
return props.size === _types.Size.Small ? (0, _typography.ComponentXXSStyling)(_typography.ComponentTextStyle.Regular, null) : (0, _typography.ComponentXSStyling)(_typography.ComponentTextStyle.Regular, null);
|
|
44
|
+
});
|
|
43
45
|
|
|
44
46
|
var LabelText = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)([""])));
|
|
45
47
|
|
|
@@ -59,23 +61,25 @@ var PrefixContainer = _styledComponents.default.div(_templateObject6 || (_templa
|
|
|
59
61
|
return props.size === _types.Size.Small ? (0, _typography.ComponentSStyling)(_typography.ComponentTextStyle.Regular, null) : (0, _typography.ComponentMStyling)(_typography.ComponentTextStyle.Regular, null);
|
|
60
62
|
});
|
|
61
63
|
|
|
62
|
-
var OperatorWrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin:", ";\n svg {\n height: 14px;\n width: 14px;\n }\n .divider {\n
|
|
64
|
+
var OperatorWrapper = _styledComponents.default.div(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin:", ";\n svg {\n height: 14px;\n width: 14px;\n }\n .divider {\n margin: 16px 0;\n background: ", ";\n width: 1px;\n }\n"])), function (props) {
|
|
63
65
|
return props.size === _types.Size.Medium ? '4px 0' : '';
|
|
64
|
-
}, _styles.COLORS.neutral_200
|
|
66
|
+
}, _styles.COLORS.neutral_200);
|
|
65
67
|
|
|
66
|
-
var NumberInput = _styledComponents.default.input(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n width: 100
|
|
68
|
+
var NumberInput = _styledComponents.default.input(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n width: 100%; \n height: ", "; \n border: none;\n color: ", ";\n padding: 0; \n ", "\n\n &:hover, &:focus, &:active {\n outline: none;\n }\n"])), function (props) {
|
|
67
69
|
return props.fieldSize === _types.Size.Small ? '20px' : '24px';
|
|
68
70
|
}, _styles.COLORS.neutral_500, function (props) {
|
|
69
71
|
return props.fieldSize === _types.Size.Small ? (0, _typography.ComponentSStyling)(_typography.ComponentTextStyle.Italic, null) : (0, _typography.ComponentMStyling)(_typography.ComponentTextStyle.Italic, null);
|
|
70
72
|
});
|
|
71
73
|
|
|
72
|
-
var NoteLabel = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", " \n"])), _styles.COLORS.neutral_500, (
|
|
74
|
+
var NoteLabel = _styledComponents.default.div(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n ", " \n"])), _styles.COLORS.neutral_500, function (props) {
|
|
75
|
+
return props.size === _types.Size.Small ? (0, _typography.ComponentXXSStyling)(_typography.ComponentTextStyle.Regular, null) : (0, _typography.ComponentXSStyling)(_typography.ComponentTextStyle.Regular, null);
|
|
76
|
+
});
|
|
73
77
|
|
|
74
78
|
var NoteIcon = _styledComponents.default.div(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n svg {\n height: 16px;\n }\n"])));
|
|
75
79
|
|
|
76
80
|
var NoteContainer = _styledComponents.default.div(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n margin-top: 5px;\n\n &.valid {\n ", " {\n color: ", ";\n }\n\n ", " {\n svg path {\n fill: ", ";\n }\n }\n }\n\n &.invalid {\n ", " {\n color: ", ";\n }\n\n ", " {\n svg path {\n fill: ", ";\n }\n }\n }\n"])), NoteLabel, _styles.COLORS.correct_500, NoteIcon, _styles.COLORS.correct_500, NoteLabel, _styles.COLORS.critical_500, NoteIcon, _styles.COLORS.critical_500);
|
|
77
81
|
|
|
78
|
-
var InputContainer = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n min-width:
|
|
82
|
+
var InputContainer = _styledComponents.default.div(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n min-width: 160px;\n height: ", ";\n display: flex;\n border: 0;\n border-radius: 4px;\n box-shadow: inset 0px 0px 0px 1px ", ";\n\n &:hover:not(.disabled):not(.readOnly):not(.valid):not(.invalid) {\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n\n &:focus-within:not(.disabled):not(.readOnly):not(.valid):not(.invalid) {\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n\n &:active:not(.disabled):not(.readOnly):not(.valid):not(.invalid) {\n box-shadow: inset 0px 0px 0px 2px ", ";\n }\n\n &.disabled {\n border: 1px solid ", ";\n cursor: not-allowed;\n \n ", "{\n color: ", ";\n }\n\n ", "{\n color: ", ";\n cursor: not-allowed;\n pointer-events: none;\n }\n }\n\n &.readOnly {\n background: ", ";\n border: 1px solid ", ";\n cursor: not-allowed;\n\n ", "{\n background: ", ";\n cursor: not-allowed;\n pointer-events: none;\n }\n }\n\n &.valid {\n border: 2px solid ", ";\n box-shadow: none;\n }\n\n &.invalid {\n border: 2px solid ", ";\n box-shadow: none;\n }\n"])), function (props) {
|
|
79
83
|
return props.size === _types.Size.Small ? '48px' : '56px';
|
|
80
84
|
}, _styles.COLORS.neutral_400, _styles.COLORS.primary_700, _styles.COLORS.primary_800, _styles.COLORS.primary_800, _styles.COLORS.neutral_100, PrefixContainer, _styles.COLORS.neutral_300, NumberInput, _styles.COLORS.neutral_300, _styles.COLORS.neutral_100, _styles.COLORS.neutral_300, NumberInput, _styles.COLORS.neutral_100, _styles.COLORS.correct_400, _styles.COLORS.critical_400);
|
|
81
85
|
|
|
@@ -176,14 +180,17 @@ var NumberField = function NumberField(_ref) {
|
|
|
176
180
|
|
|
177
181
|
var isLocked = function isLocked(input, operator) {
|
|
178
182
|
var val = decimalPrecision ? parseFloat(input) : parseInt(input);
|
|
183
|
+
val = isNaN(val) && userInput === '' ? 0 : val;
|
|
179
184
|
var operatorState = false;
|
|
180
185
|
if (operator === 'add' && maxValue) operatorState = val < maxValue ? false : true;
|
|
181
186
|
if (operator === 'subtract' && minValue) operatorState = val > minValue ? false : true;
|
|
187
|
+
if (operator === 'subtract' && !minValue && !allowNegative) operatorState = val > 0 ? false : true;
|
|
182
188
|
return operatorState;
|
|
183
189
|
};
|
|
184
190
|
|
|
185
191
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
|
186
192
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(LabelContainer, {
|
|
193
|
+
size: size,
|
|
187
194
|
children: [required && /*#__PURE__*/(0, _jsxRuntime.jsx)(LabelIcon, {
|
|
188
195
|
size: size,
|
|
189
196
|
"data-testid": 'labelIcon',
|
|
@@ -219,6 +226,7 @@ var NumberField = function NumberField(_ref) {
|
|
|
219
226
|
"data-testid": 'operators',
|
|
220
227
|
size: size,
|
|
221
228
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
229
|
+
tabIndex: -1,
|
|
222
230
|
variant: "secondary",
|
|
223
231
|
shape: "square",
|
|
224
232
|
action: function action() {
|
|
@@ -232,6 +240,7 @@ var NumberField = function NumberField(_ref) {
|
|
|
232
240
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
233
241
|
className: "divider"
|
|
234
242
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.IconButton, {
|
|
243
|
+
tabIndex: -1,
|
|
235
244
|
variant: "secondary",
|
|
236
245
|
shape: "square",
|
|
237
246
|
action: function action() {
|
|
@@ -249,6 +258,7 @@ var NumberField = function NumberField(_ref) {
|
|
|
249
258
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(NoteIcon, {
|
|
250
259
|
children: noteIcon
|
|
251
260
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(NoteLabel, {
|
|
261
|
+
size: size,
|
|
252
262
|
children: note
|
|
253
263
|
})]
|
|
254
264
|
})]
|