@learningpool/ui 1.8.6 → 1.8.8
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/components/landmarks/Header/Header.d.ts +1 -0
- package/components/landmarks/Header/Header.js +7 -5
- package/components/navigation/MobileNavigation/MobileNavigation.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigation.js +8 -6
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +51 -34
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +52 -29
- package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationSearch.js +5 -3
- package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +1 -0
- package/components/navigation/VerticalNavigation/VerticalNavigation.js +135 -107
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +46 -20
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +1 -0
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +6 -4
- package/components/stream/AppSwitcher/AppSwitcher.d.ts +1 -0
- package/components/stream/AppSwitcher/AppSwitcher.js +9 -7
- package/package.json +1 -1
- package/types/components/navigation/VerticalNavigationAvatar.d.ts +1 -0
- package/utils/dataAttributes.d.ts +57 -0
- package/utils/dataAttributes.js +61 -0
- package/utils/helpers.d.ts +12 -9
- package/utils/helpers.js +41 -21
|
@@ -20,6 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
23
32
|
import { createElement as _createElement } from "react";
|
|
24
33
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
34
|
import React, { useEffect } from 'react';
|
|
@@ -38,12 +47,14 @@ import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
|
|
|
38
47
|
import { DEFAULT_REACT_APP_ID } from '../../../utils/constants';
|
|
39
48
|
import { animated } from '@react-spring/web';
|
|
40
49
|
import { defaultMessages } from '../../../lang/en-us';
|
|
50
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
41
51
|
import { getNavigationBackground, getNavigationContrastText } from '../helpers';
|
|
42
52
|
var VerticalNavigation = function (props) {
|
|
43
53
|
var _a;
|
|
44
54
|
var theme = useTheme();
|
|
45
|
-
var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName"]);
|
|
55
|
+
var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, dataAttributes = props.dataAttributes, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName", "dataAttributes"]);
|
|
46
56
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
57
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
47
58
|
var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
|
|
48
59
|
var propIsPersistent = typeof (props === null || props === void 0 ? void 0 : props.isPersistent) === 'boolean' ? props.isPersistent : undefined;
|
|
49
60
|
var hasAvatar = (_a = props === null || props === void 0 ? void 0 : props.hasAvatar) !== null && _a !== void 0 ? _a : true;
|
|
@@ -62,6 +73,11 @@ var VerticalNavigation = function (props) {
|
|
|
62
73
|
var logoWidth = 38;
|
|
63
74
|
useEffect(function () { return setIsDrawerOpen(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false); }, [propIsDrawerOpen]);
|
|
64
75
|
useEffect(function () { return setIsDrawerOpen(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false); }, [propIsPersistent]);
|
|
76
|
+
useEffect(function () {
|
|
77
|
+
if (!avatarName || !hasAvatar) {
|
|
78
|
+
setIsAvatarOpen(false);
|
|
79
|
+
}
|
|
80
|
+
}, [avatarName, hasAvatar]);
|
|
65
81
|
// This fixes an issue with how MUI handles the modal and aria-hidden.
|
|
66
82
|
// When open, the Modal adds aria-hidden="true" to a top-level element,
|
|
67
83
|
// which causes some screen readers to annouce the elements as "blank".
|
|
@@ -93,114 +109,126 @@ var VerticalNavigation = function (props) {
|
|
|
93
109
|
setIsAppSwitcherOpen(false);
|
|
94
110
|
setIsDrawerOpen(open !== null && open !== void 0 ? open : !isDrawerOpen);
|
|
95
111
|
}; };
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
112
|
+
// Workaround to handle the react-spring calls without
|
|
113
|
+
// adding additional hook calls on prop or state changes
|
|
114
|
+
// --
|
|
115
|
+
// Store the total possible number of animations in a ref
|
|
116
|
+
// this way the number of hook calls never changes
|
|
117
|
+
// --
|
|
118
|
+
// First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
|
|
119
|
+
var additionalItems = ['hasStreamHome', 'hasAvatar', 'avatarName'];
|
|
120
|
+
var totalItems = __spreadArray(__spreadArray(__spreadArray([], items !== null && items !== void 0 ? items : [], true), secondaryItems !== null && secondaryItems !== void 0 ? secondaryItems : [], true), additionalItems, true);
|
|
121
|
+
var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index); }));
|
|
122
|
+
var listContent = function () {
|
|
123
|
+
var _a, _b, _c;
|
|
124
|
+
return (_jsxs(Box, __assign({ sx: {
|
|
106
125
|
display: 'flex',
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
height: "".concat(logoHeight, "px"),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
width: '1.75rem'
|
|
140
|
-
} })) }) })), _jsx(Box, { style: {
|
|
141
|
-
borderRadius: '50%',
|
|
142
|
-
boxShadow: '5px 0 15px 0 rgb(0 0 0 / 10%)',
|
|
143
|
-
display: 'none',
|
|
144
|
-
height: '50px',
|
|
145
|
-
left: '12px',
|
|
146
|
-
position: 'fixed',
|
|
147
|
-
right: 'auto !important',
|
|
148
|
-
top: '50%',
|
|
149
|
-
transform: 'translate(50%, -50%)',
|
|
150
|
-
width: '50px'
|
|
151
|
-
} }), _jsxs(DrawerToggle, __assign({ onClick: handleIsPersistent, "aria-label": isDrawerOpen ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", style: {
|
|
152
|
-
display: 'none',
|
|
153
|
-
position: 'fixed',
|
|
154
|
-
top: '50%',
|
|
155
|
-
transform: 'translate(50%, -50%)',
|
|
156
|
-
zIndex: 10
|
|
157
|
-
} }, { children: [_jsx(NotchExtendSVG, { style: {
|
|
158
|
-
display: 'block',
|
|
159
|
-
fill: getNavigationBackground(theme),
|
|
160
|
-
height: '165px',
|
|
161
|
-
left: '-12px',
|
|
162
|
-
padding: '0',
|
|
163
|
-
position: 'absolute',
|
|
164
|
-
top: '-61px',
|
|
165
|
-
transition: 'none',
|
|
166
|
-
width: '90px',
|
|
167
|
-
zIndex: '-1'
|
|
168
|
-
} }), _jsx(DrawerToggleHitboxContent, __assign({ style: {
|
|
169
|
-
background: 'transparent',
|
|
170
|
-
boxShadow: 'none',
|
|
171
|
-
fontSize: '1.3rem',
|
|
172
|
-
height: '1.3rem',
|
|
173
|
-
padding: theme.spacing(1),
|
|
174
|
-
width: '1.3rem'
|
|
175
|
-
} }, { children: isPersistent
|
|
176
|
-
? (_jsx(PushPin, { style: {
|
|
177
|
-
fontSize: '1.3rem',
|
|
178
|
-
height: '1.3rem',
|
|
179
|
-
width: '1.3rem'
|
|
126
|
+
flex: '1 auto',
|
|
127
|
+
flexDirection: 'column',
|
|
128
|
+
justifyContent: 'flex-start',
|
|
129
|
+
'.wrapper': {
|
|
130
|
+
display: 'flex',
|
|
131
|
+
position: 'relative'
|
|
132
|
+
},
|
|
133
|
+
'.wrapper > :not(:first-of-type)': {
|
|
134
|
+
position: 'absolute',
|
|
135
|
+
right: 0,
|
|
136
|
+
background: 'transparent',
|
|
137
|
+
fontSize: 0
|
|
138
|
+
}
|
|
139
|
+
}, className: 'grid-container' }, { children: [_jsx("div", __assign({ className: 'wrapper', style: { backgroundColor: getNavigationBackground(theme) }, "data-id": dataIds.VerticalNavigationBrand }, { children: _jsxs(DrawerHeader, __assign({ onClick: logoOnClick !== null && logoOnClick !== void 0 ? logoOnClick : null, isDrawerOpen: isDrawerOpen || isPersistent, style: animationRefs.current[0] }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen || isPersistent, disableFocusListener: isDrawerOpen || isPersistent, disableTouchListener: isDrawerOpen || isPersistent, title: logoText !== null && logoText !== void 0 ? logoText : '', placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: logo
|
|
140
|
+
? typeof logo === 'string'
|
|
141
|
+
? (_jsx("img", { src: logo, height: "".concat(logoHeight, "px"), width: "".concat(logoWidth, "px"), style: {
|
|
142
|
+
marginInlineEnd: '16px'
|
|
143
|
+
}, alt: logoText !== null && logoText !== void 0 ? logoText : messages['site-logo'] }))
|
|
144
|
+
: logo
|
|
145
|
+
: (_jsx(StreamSuiteLogo, { style: {
|
|
146
|
+
height: "".concat(logoHeight, "px"),
|
|
147
|
+
width: "".concat(logoWidth, "px"),
|
|
148
|
+
marginInlineEnd: '16px',
|
|
149
|
+
fill: getNavigationContrastText(theme)
|
|
150
|
+
} })) })), _jsx(ListItemText, { primary: logoText !== null && logoText !== void 0 ? logoText : '', isDrawerOpen: isDrawerOpen || isPersistent })] })) })), _jsxs("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationToggle }, { children: [_jsxs(NotchContainer, __assign({ sx: { height: '85px', position: 'relative !important' } }, { children: [_jsx(NotchBackground, {}), !isPersistent && _jsx(NotchBackgroundClip, {}), _jsx(NotchSeemMask, {})] })), !isPersistent && _jsx(DrawerToggle, __assign({ onClick: toggleDrawer(!isDrawerOpen), "aria-label": isDrawerOpen ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", isDrawerOpen: isDrawerOpen,
|
|
151
|
+
// @ts-expect-error
|
|
152
|
+
component: animated.button, style: animationRefs.current[0] }, { children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
|
|
153
|
+
? (_jsx(ChevronLeft, { style: {
|
|
154
|
+
fill: getNavigationContrastText(theme),
|
|
155
|
+
fontSize: '1.75rem',
|
|
156
|
+
height: '1.75rem',
|
|
157
|
+
width: '1.75rem'
|
|
180
158
|
} }))
|
|
181
|
-
: (_jsx(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
159
|
+
: (_jsx(ChevronRight, { style: {
|
|
160
|
+
fill: getNavigationContrastText(theme),
|
|
161
|
+
fontSize: '1.75rem',
|
|
162
|
+
height: '1.75rem',
|
|
163
|
+
width: '1.75rem'
|
|
164
|
+
} })) }) })), _jsx(Box, { style: {
|
|
165
|
+
borderRadius: '50%',
|
|
166
|
+
boxShadow: '5px 0 15px 0 rgb(0 0 0 / 10%)',
|
|
167
|
+
display: 'none',
|
|
168
|
+
height: '50px',
|
|
169
|
+
left: '12px',
|
|
170
|
+
position: 'fixed',
|
|
171
|
+
right: 'auto !important',
|
|
172
|
+
top: '50%',
|
|
173
|
+
transform: 'translate(50%, -50%)',
|
|
174
|
+
width: '50px'
|
|
175
|
+
} }), _jsxs(DrawerToggle, __assign({ onClick: handleIsPersistent, "aria-label": isDrawerOpen ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", style: {
|
|
176
|
+
display: 'none',
|
|
177
|
+
position: 'fixed',
|
|
178
|
+
top: '50%',
|
|
179
|
+
transform: 'translate(50%, -50%)',
|
|
180
|
+
zIndex: 10
|
|
181
|
+
} }, { children: [_jsx(NotchExtendSVG, { style: {
|
|
182
|
+
display: 'block',
|
|
183
|
+
fill: getNavigationBackground(theme),
|
|
184
|
+
height: '165px',
|
|
185
|
+
left: '-12px',
|
|
186
|
+
padding: '0',
|
|
187
|
+
position: 'absolute',
|
|
188
|
+
top: '-61px',
|
|
189
|
+
transition: 'none',
|
|
190
|
+
width: '90px',
|
|
191
|
+
zIndex: '-1'
|
|
192
|
+
} }), _jsx(DrawerToggleHitboxContent, __assign({ style: {
|
|
193
|
+
background: 'transparent',
|
|
194
|
+
boxShadow: 'none',
|
|
195
|
+
fontSize: '1.3rem',
|
|
196
|
+
height: '1.3rem',
|
|
197
|
+
padding: theme.spacing(1),
|
|
198
|
+
width: '1.3rem'
|
|
199
|
+
} }, { children: isPersistent
|
|
200
|
+
? (_jsx(PushPin, { style: {
|
|
201
|
+
fontSize: '1.3rem',
|
|
202
|
+
height: '1.3rem',
|
|
203
|
+
width: '1.3rem'
|
|
204
|
+
} }))
|
|
205
|
+
: (_jsx(PushPin, { style: {
|
|
206
|
+
fontSize: '1.3rem',
|
|
207
|
+
height: '1.3rem',
|
|
208
|
+
width: '1.3rem'
|
|
209
|
+
} })) }))] }))] })), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsx("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationPrimary, style: {
|
|
210
|
+
backgroundColor: getNavigationBackground(theme),
|
|
211
|
+
flex: '1 1px',
|
|
212
|
+
marginTop: '-1px',
|
|
213
|
+
overflow: 'auto',
|
|
214
|
+
position: 'relative',
|
|
215
|
+
zIndex: 10
|
|
216
|
+
} }, { children: _jsx(StyledNav, __assign({ tabIndex: -1, "aria-label": 'Primary' }, { children: _jsx(List, __assign({ "data-id": dataIds.VerticalNavigationPrimaryList, style: {
|
|
217
|
+
height: '100%',
|
|
218
|
+
width: DRAWER_WIDTH.Expanded,
|
|
219
|
+
marginTop: "-".concat(theme.spacing(0.5), " !important")
|
|
220
|
+
} }, { children: items && items.length > 0 && items.map(function (item, index) { return (_createElement(VerticalNavigationItem, __assign({}, item, { "data-id": dataIds.VerticalNavigationPrimaryListItem, key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, style: animationRefs.current[index] }))); }) })) })) })), _jsx("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationSecondary, style: { backgroundColor: getNavigationBackground(theme) } }, { children: _jsxs(StyledNavSecondary, __assign({ "aria-label": 'Secondary' }, { children: [_jsx(StyledDivider, { isDrawerOpen: isDrawerOpen || isPersistent }), _jsxs(List, __assign({ "data-id": dataIds.VerticalNavigationSecondaryList, style: { width: DRAWER_WIDTH.Expanded } }, { children: [hasStreamHome
|
|
221
|
+
? (_jsx(VerticalNavigationItem, { "data-id": dataIds.VerticalNavigationAppSwitcherToggle, label: messages['app-switcher'], icon: _jsx(Apps, {}), onClick: handleToggleAppsClick, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, setIsAppSwitcherOpen: setIsAppSwitcherOpen, applications: streamHomeApplications, apiKey: streamHomeApiKey !== null && streamHomeApiKey !== void 0 ? streamHomeApiKey : '', baseUrl: streamHomeBaseUrl !== null && streamHomeBaseUrl !== void 0 ? streamHomeBaseUrl : '', token: streamHomeAccessToken !== null && streamHomeAccessToken !== void 0 ? streamHomeAccessToken : '', isDrawerOpen: isDrawerOpen })), isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, hasCustomContent: true, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + 1] }))
|
|
222
|
+
: null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) {
|
|
223
|
+
var _a;
|
|
224
|
+
return (_createElement(VerticalNavigationItem, __assign({}, item, { "data-id": dataIds.VerticalNavigationSecondaryListItem, key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + index + 1] })));
|
|
225
|
+
}), hasAvatar && avatarName && (_jsx(VerticalNavigationItem, { label: avatarName, "data-id": dataIds.VerticalNavigationAvatarToggle, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, __assign({ style: {
|
|
226
|
+
fontSize: '0.75rem',
|
|
227
|
+
height: 32,
|
|
228
|
+
width: 32
|
|
229
|
+
} }, { children: handleAvatarInitials(avatarName) })), style: __assign({ maxHeight: isDrawerOpen ? '200px' : '48px', overflow: 'hidden', padding: 0, minHeight: 52, transition: "max-height 225ms ".concat(motion.easeInOut, " 0ms !important") }, animationRefs.current[((_b = items === null || items === void 0 ? void 0 : items.length) !== null && _b !== void 0 ? _b : 0) + ((_c = secondaryItems === null || secondaryItems === void 0 ? void 0 : secondaryItems.length) !== null && _c !== void 0 ? _c : 0) + 2]), onClick: function () { return setIsAvatarOpen(!isAvatarOpen); }, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, __assign({ avatarName: avatarName, isAvatarOpen: isAvatarOpen, localization: localization }, rest)), isDrawerOpen: isDrawerOpen }))] }))] })) }))] })));
|
|
230
|
+
};
|
|
231
|
+
return (_jsxs(StyledAside, __assign({ "aria-label": messages['site-navigation'], "data-id": dataIds.VerticalNavigationContainer }, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
|
|
204
232
|
display: isPersistent ? 'none' : 'block'
|
|
205
233
|
} }), _jsx(Modal, __assign({ "aria-hidden": false, keepMounted: true, disablePortal: true, open: isDrawerOpen, onClose: toggleDrawer(false) }, { children: _jsx(StyledDrawer, __assign({ id: 'vertical-navigation', anchor: 'left', open: isDrawerOpen || isPersistent, onClose: toggleDrawer(false), variant: 'permanent' }, { children: listContent() })) }))] })));
|
|
206
234
|
};
|
|
@@ -9,6 +9,15 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
12
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
22
|
import React, { useEffect } from 'react';
|
|
14
23
|
import { Box, Link, List, ListItem, ListItemIcon, ListItemText } from '../../../index';
|
|
@@ -16,40 +25,54 @@ import { StyledBox, StyledBoxProfile, StyledButton, StyledAvatarName, StyledAvat
|
|
|
16
25
|
import { useTheme } from '@mui/material/styles';
|
|
17
26
|
import EditIcon from '@mui/icons-material/Edit';
|
|
18
27
|
import LogoutIcon from '@mui/icons-material/Logout';
|
|
19
|
-
import { handleAvatarInitials,
|
|
28
|
+
import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
|
|
20
29
|
import { Person, Settings } from '@mui/icons-material';
|
|
21
30
|
import { animated } from '@react-spring/web';
|
|
22
31
|
import { FlyoutMenuItemText } from './VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles';
|
|
23
32
|
import { defaultMessages } from '../../../lang/en-us';
|
|
33
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
24
34
|
var AvatarPanel = function (props) {
|
|
25
|
-
var _a;
|
|
35
|
+
var _a, _b, _c, _d;
|
|
26
36
|
var theme = useTheme();
|
|
27
|
-
var avatarName = props.avatarName, avatarPanelOnClickLogout = props.avatarPanelOnClickLogout, avatarPanelLogoutString = props.avatarPanelLogoutString, avatarPanelOnClickViewProfile = props.avatarPanelOnClickViewProfile, avatarPanelViewProfileString = props.avatarPanelViewProfileString, avatarPanelOnClickEditProfile = props.avatarPanelOnClickEditProfile, avatarPanelEditProfileString = props.avatarPanelEditProfileString, avatarPanelMenuItems = props.avatarPanelMenuItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelFootnote = props.avatarPanelFootnote, isAvatarOpen = props.isAvatarOpen, localization = props.localization;
|
|
37
|
+
var avatarName = props.avatarName, avatarPanelOnClickLogout = props.avatarPanelOnClickLogout, avatarPanelLogoutString = props.avatarPanelLogoutString, avatarPanelOnClickViewProfile = props.avatarPanelOnClickViewProfile, avatarPanelViewProfileString = props.avatarPanelViewProfileString, avatarPanelOnClickEditProfile = props.avatarPanelOnClickEditProfile, avatarPanelEditProfileString = props.avatarPanelEditProfileString, avatarPanelMenuItems = props.avatarPanelMenuItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelFootnote = props.avatarPanelFootnote, isAvatarOpen = props.isAvatarOpen, localization = props.localization, dataAttributes = props.dataAttributes;
|
|
28
38
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
39
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
29
40
|
useEffect(function () {
|
|
30
41
|
setAvatarInitials(handleAvatarInitials(avatarName));
|
|
31
42
|
}, [avatarName]);
|
|
32
|
-
var
|
|
33
|
-
//
|
|
34
|
-
//
|
|
35
|
-
|
|
36
|
-
|
|
43
|
+
var _e = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _e[0], setAvatarInitials = _e[1];
|
|
44
|
+
// Workaround to handle the react-spring calls without
|
|
45
|
+
// adding additional hook calls on prop or state changes
|
|
46
|
+
// --
|
|
47
|
+
// Store the total possible number of animations in a ref
|
|
48
|
+
// this way the number of hook calls never changes
|
|
49
|
+
// --
|
|
50
|
+
// First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
|
|
51
|
+
var additionalItems = [
|
|
52
|
+
'avatarPanelOnClickLogout',
|
|
53
|
+
'avatarName',
|
|
54
|
+
'avatarPanelOnClickViewProfile',
|
|
55
|
+
'avatarPanelOnClickMainAction',
|
|
56
|
+
'avatarPanelFootnote'
|
|
57
|
+
];
|
|
58
|
+
var totalItems = __spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), additionalItems, true);
|
|
59
|
+
var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index, !isAvatarOpen); }));
|
|
37
60
|
return (_jsxs(StyledBox, { children: [avatarPanelOnClickLogout && (_jsx(StyledButton
|
|
38
61
|
// @ts-expect-error
|
|
39
62
|
, __assign({
|
|
40
63
|
// @ts-expect-error
|
|
41
|
-
component: animated.button, style: __assign({ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto', position: 'absolute', right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1), top: theme.spacing(1) },
|
|
64
|
+
component: animated.button, style: __assign({ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto', position: 'absolute', right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1), top: theme.spacing(1) }, animationRefs.current[0]), onClick: avatarPanelOnClickLogout, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : messages.logout }))), _jsxs(Box, __assign({ "data-id": dataIds.VerticalNavigationAvatarProfile, style: {
|
|
42
65
|
alignItems: 'center',
|
|
43
66
|
display: 'flex',
|
|
44
67
|
flexDirection: 'column'
|
|
45
|
-
} }, { children: [_jsxs(StyledBoxProfile, __assign({ style:
|
|
68
|
+
} }, { children: [_jsxs(StyledBoxProfile, __assign({ style: animationRefs.current[1] }, { children: [_jsx(StyledAvatar, __assign({ style: { marginInlineEnd: '0.5rem' } }, { children: avatarInitials })), _jsxs(StyledAvatarName, { children: [_jsx("span", __assign({ style: { fontWeight: 300 } }, { children: messages.greeting })), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })] })), avatarPanelOnClickViewProfile && (_jsx(StyledBoxProfileEdit, __assign({ style: __assign({ marginBottom: theme.spacing(2) }, animationRefs.current[2]) }, { children: _jsxs(StyledButtonGroup, __assign({ variant: 'outlined', "aria-label": "split button" }, { children: [_jsx(StyledButton, __assign({ variant: 'outlined', color: 'inherit', size: 'medium', onClick: avatarPanelOnClickViewProfile, startIcon: _jsx(Person, {}) }, { children: avatarPanelViewProfileString !== null && avatarPanelViewProfileString !== void 0 ? avatarPanelViewProfileString : messages['view-profile'] })), avatarPanelOnClickEditProfile && (_jsx(StyledButton, __assign({ variant: 'outlined', color: 'inherit', size: 'medium', "aria-label": avatarPanelEditProfileString !== null && avatarPanelEditProfileString !== void 0 ? avatarPanelEditProfileString : messages['edit-profile'], onClick: avatarPanelOnClickEditProfile }, { children: _jsx(EditIcon, {}) })))] })) })))] })), _jsxs(Box, __assign({ style: {
|
|
46
69
|
alignItems: 'center',
|
|
47
70
|
display: 'flex',
|
|
48
71
|
flexDirection: 'column'
|
|
49
|
-
} }, { children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, __assign({ style: {
|
|
72
|
+
} }, { children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: {
|
|
50
73
|
marginBottom: theme.spacing(2),
|
|
51
74
|
maxWidth: '14rem'
|
|
52
|
-
} }, { children: avatarPanelMenuItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ component: animated.div, style:
|
|
75
|
+
} }, { children: avatarPanelMenuItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ "data-id": dataIds.VerticalNavigationFlyoutListItem, component: animated.div, style: animationRefs.current[index + 2], disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
53
76
|
// TODO: figure out if these are links or buttons
|
|
54
77
|
// @ts-expect-error
|
|
55
78
|
, __assign({
|
|
@@ -59,16 +82,19 @@ var AvatarPanel = function (props) {
|
|
|
59
82
|
// @ts-expect-error
|
|
60
83
|
, __assign({
|
|
61
84
|
// @ts-expect-error
|
|
62
|
-
component: animated.button, style:
|
|
85
|
+
component: animated.button, style: animationRefs.current[((_b = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _b !== void 0 ? _b : 0) + 3], variant: 'outlined', color: 'inherit', size: 'medium', onClick: avatarPanelOnClickMainAction, startIcon: _jsx(Settings, {}) }, { children: avatarPanelMainActionString })), _jsx(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: { marginBottom: theme.spacing(2) } }, { children: avatarPanelSettingItems &&
|
|
63
86
|
avatarPanelSettingItems.length > 0 &&
|
|
64
|
-
avatarPanelSettingItems.map(function (avatarMenuItem, index) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
, __assign({
|
|
87
|
+
avatarPanelSettingItems.map(function (avatarMenuItem, index) {
|
|
88
|
+
var _a;
|
|
89
|
+
return (_jsx(ListItem, __assign({ "data-id": dataIds.VerticalNavigationFlyoutListItem, component: animated.div, style: animationRefs.current[((_a = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _a !== void 0 ? _a : 0) + index + 3], disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
68
90
|
// TODO: figure out if these are links or buttons
|
|
69
91
|
// @ts-expect-error
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
92
|
+
, __assign({
|
|
93
|
+
// TODO: figure out if these are links or buttons
|
|
94
|
+
// @ts-expect-error
|
|
95
|
+
component: Link, role: 'link', onClick: avatarMenuItem.onClick }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
96
|
+
minWidth: theme.spacing(5)
|
|
97
|
+
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }), "".concat(avatarMenuItem.label, " - ").concat(index)));
|
|
98
|
+
}) }))] })), _jsx(Box, __assign({ "data-id": dataIds.VerticalNavigationFlyoutFootnote, className: 'avatar-panel-footnote', style: animationRefs.current[((_c = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _c !== void 0 ? _c : 0) + ((_d = avatarPanelSettingItems === null || avatarPanelSettingItems === void 0 ? void 0 : avatarPanelSettingItems.length) !== null && _d !== void 0 ? _d : 0) + 4] }, { children: avatarPanelFootnote && avatarPanelFootnote }))] }));
|
|
73
99
|
};
|
|
74
100
|
export default AvatarPanel;
|
|
@@ -13,10 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { forwardRef } from 'react';
|
|
14
14
|
import { Link } from '../../../../index';
|
|
15
15
|
import { FullHeightFlyoutMenuPaper, FullHeightFlyoutMenuWrapper, FlyoutNotchMask, NotchMini, FlyoutMenuHeader, FlyoutMenuPaper, FlyoutMenuWrap, FlyoutMenuList, FlyoutMenuButton, FlyoutMenuItem, FlyoutMenuItemText } from './VerticalNavigationItemFlyoutMenuStyles';
|
|
16
|
+
import { defaultAttributes } from '../../../../utils/dataAttributes';
|
|
16
17
|
var VerticalNavigationItemFlyoutMenu = forwardRef(function (props, ref) {
|
|
17
|
-
var label = props.label, children = props.children, isDrawerOpen = props.isDrawerOpen, fullHeightFlyout = props.fullHeightFlyout, open = props.open, parentItemRef = props.parentItemRef, content = props.content, anchorEl = props.anchorEl, setAnchorEl = props.setAnchorEl, setIsFlyoutHovered = props.setIsFlyoutHovered;
|
|
18
|
+
var label = props.label, children = props.children, isDrawerOpen = props.isDrawerOpen, fullHeightFlyout = props.fullHeightFlyout, open = props.open, parentItemRef = props.parentItemRef, dataAttributes = props.dataAttributes, content = props.content, anchorEl = props.anchorEl, setAnchorEl = props.setAnchorEl, setIsFlyoutHovered = props.setIsFlyoutHovered;
|
|
19
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
18
20
|
if (fullHeightFlyout && content) {
|
|
19
|
-
return (_jsx(FullHeightFlyoutMenuPaper, __assign({ isDrawerOpen: isDrawerOpen, open: open, id: "avatar-panel" }, { children: _jsxs(FullHeightFlyoutMenuWrapper, __assign({ open: open }, { children: [_jsx(FlyoutNotchMask, {}), _jsx(NotchMini, { tabIndex: -1, style: { bottom: '24px' } }), content] })) })));
|
|
21
|
+
return (_jsx(FullHeightFlyoutMenuPaper, __assign({ isDrawerOpen: isDrawerOpen, open: open, id: "avatar-panel", "data-id": dataIds.VerticalNavigationAvatarPanel }, { children: _jsxs(FullHeightFlyoutMenuWrapper, __assign({ open: open }, { children: [_jsx(FlyoutNotchMask, {}), _jsx(NotchMini, { tabIndex: -1, style: { bottom: '24px' } }), content] })) })));
|
|
20
22
|
}
|
|
21
23
|
var handleKeyDown = function (event) {
|
|
22
24
|
if (!event) {
|
|
@@ -32,10 +34,10 @@ var VerticalNavigationItemFlyoutMenu = forwardRef(function (props, ref) {
|
|
|
32
34
|
}, CLOSE_SUBMENU_DELAY);
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
|
-
return (_jsx(FlyoutMenuPaper, __assign({ ref: ref, isDrawerOpen: isDrawerOpen, open: open, anchorEl: anchorEl !== null && anchorEl !== void 0 ? anchorEl : undefined, onMouseEnter: function () { return setIsFlyoutHovered(true); }, onMouseLeave: function () { return setIsFlyoutHovered(false); }, onFocus: function () { return setIsFlyoutHovered(true); }, onBlur: function () { return setIsFlyoutHovered(false); } }, { children: _jsxs(FlyoutMenuWrap, __assign({ open: open }, { children: [_jsx(NotchMini, { style: { top: '12px' } }), _jsx(FlyoutMenuHeader, { children: label }), _jsx(FlyoutMenuList, __assign({ "aria-label": label, open: open }, { children: children === null || children === void 0 ? void 0 : children.map(function (childItem, index) { return (_jsx(FlyoutMenuItem, { children: _jsx(FlyoutMenuButton
|
|
37
|
+
return (_jsx(FlyoutMenuPaper, __assign({ ref: ref, "data-id": dataIds.VerticalNavigationFlyout, isDrawerOpen: isDrawerOpen, open: open, anchorEl: anchorEl !== null && anchorEl !== void 0 ? anchorEl : undefined, onMouseEnter: function () { return setIsFlyoutHovered(true); }, onMouseLeave: function () { return setIsFlyoutHovered(false); }, onFocus: function () { return setIsFlyoutHovered(true); }, onBlur: function () { return setIsFlyoutHovered(false); } }, { children: _jsxs(FlyoutMenuWrap, __assign({ open: open }, { children: [_jsx(NotchMini, { style: { top: '12px' } }), _jsx(FlyoutMenuHeader, { children: label }), _jsx(FlyoutMenuList, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, "aria-label": label, open: open }, { children: children === null || children === void 0 ? void 0 : children.map(function (childItem, index) { return (_jsx(FlyoutMenuItem, __assign({ "data-id": dataIds.VerticalNavigationFlyoutListItem }, { children: _jsx(FlyoutMenuButton
|
|
36
38
|
// @ts-expect-error
|
|
37
39
|
, __assign({
|
|
38
40
|
// @ts-expect-error
|
|
39
|
-
component: Link, role: 'link', onClick: childItem.onClick, onFocus: function (event) { return handleKeyDown(event); }, onBlur: function (event) { return handleKeyDown(event); } }, { children: _jsx(FlyoutMenuItemText, { primary: childItem.label }) }), childItem.label) }, "".concat(childItem.label, " - ").concat(index))); }) }))] })) })));
|
|
41
|
+
component: Link, role: 'link', onClick: childItem.onClick, onFocus: function (event) { return handleKeyDown(event); }, onBlur: function (event) { return handleKeyDown(event); } }, { children: _jsx(FlyoutMenuItemText, { primary: childItem.label }) }), childItem.label) }), "".concat(childItem.label, " - ").concat(index))); }) }))] })) })));
|
|
40
42
|
});
|
|
41
43
|
export default VerticalNavigationItemFlyoutMenu;
|
|
@@ -55,9 +55,10 @@ import AppSwitcherItem, { LogoVariants } from './AppSwitcherItem';
|
|
|
55
55
|
import { AppListHeader, AppListItem, AppOrganisationCount, StyledSVG, BackButton, MenuContent, OrganisationLink, OrganisationList, SearchBox, SearchContent, SelectedOrganisation, AppSwitcherPanel } from './AppSwitcherStyles';
|
|
56
56
|
import { Constants } from './constants';
|
|
57
57
|
import { DRAWER_WIDTH } from '../../navigation/VerticalNavigation/VerticalNavigationStyles';
|
|
58
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
58
59
|
var AppSwitcher = function (props) {
|
|
59
60
|
var _a;
|
|
60
|
-
var isAppSwitcherOpen = props.isAppSwitcherOpen, setIsAppSwitcherOpen = props.setIsAppSwitcherOpen, isDrawerOpen = props.isDrawerOpen, localization = props.localization, _b = props.apiKey, apiKey = _b === void 0 ? '' : _b, baseUrl = props.baseUrl;
|
|
61
|
+
var isAppSwitcherOpen = props.isAppSwitcherOpen, setIsAppSwitcherOpen = props.setIsAppSwitcherOpen, isDrawerOpen = props.isDrawerOpen, localization = props.localization, dataAttributes = props.dataAttributes, _b = props.apiKey, apiKey = _b === void 0 ? '' : _b, baseUrl = props.baseUrl;
|
|
61
62
|
var token = props.token;
|
|
62
63
|
// Holds the applications which are displayed.
|
|
63
64
|
var _c = useState([]), applications = _c[0], setApplications = _c[1];
|
|
@@ -70,6 +71,7 @@ var AppSwitcher = function (props) {
|
|
|
70
71
|
// Stores any org filter text (on the second tab).
|
|
71
72
|
var _g = useState(''), searchString = _g[0], setSearchString = _g[1];
|
|
72
73
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
74
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
73
75
|
var userId = (_a = props.userId) !== null && _a !== void 0 ? _a : '';
|
|
74
76
|
/**
|
|
75
77
|
* Handles closing of the application dialog.
|
|
@@ -264,20 +266,20 @@ var AppSwitcher = function (props) {
|
|
|
264
266
|
return (_jsxs(AppSwitcherPanel, __assign({ id: "app-switcher-menu", style: {
|
|
265
267
|
display: isAppSwitcherOpen ? 'block' : 'none',
|
|
266
268
|
left: isDrawerOpen ? DRAWER_WIDTH.Expanded : DRAWER_WIDTH.Collapsed - 3
|
|
267
|
-
}, role: 'dialog', "aria-label": "App Switcher", onKeyDown: handleKeyDown }, { children: [activeTab === Constants.Tabs.ListApplications
|
|
268
|
-
? (_jsxs("div", { children: [_jsxs(AppListHeader, { children: [_jsx("svg", { children: _jsx("image", { xlinkHref: "".concat(Constants.AssetsUrl, "suite/logo/latest/icon.svg"), width: "24", height: "24" }) }), messages['your-apps']] }), _jsx(MenuContent, __assign({ style: {
|
|
269
|
+
}, role: 'dialog', "aria-label": "App Switcher", onKeyDown: handleKeyDown, "data-id": dataIds.AppSwitcherContainer }, { children: [activeTab === Constants.Tabs.ListApplications
|
|
270
|
+
? (_jsxs("div", { children: [_jsxs(AppListHeader, __assign({ "data-id": dataIds.AppSwitcherHeader }, { children: [_jsx("svg", { children: _jsx("image", { xlinkHref: "".concat(Constants.AssetsUrl, "suite/logo/latest/icon.svg"), width: "24", height: "24" }) }), messages['your-apps']] })), _jsx(MenuContent, __assign({ style: {
|
|
269
271
|
display: activeTab === 1 ? 'flex' : 'none'
|
|
270
|
-
} }, { children: applications.map(function (_a) {
|
|
272
|
+
}, "data-id": dataIds.AppSwitcherList }, { children: applications.map(function (_a) {
|
|
271
273
|
var applicationId = _a.applicationId, applicationName = _a.applicationName, shortName = _a.shortName, customName = _a.customName, internalName = _a.internalName, url = _a.url, children = _a.children;
|
|
272
|
-
return (_jsxs(AppListItem, { children: [url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, url: url, handleGoToAppClick: handleGoToAppClick })), !url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, handleGoToAppClick: handleGoToAppClick, applicationId: applicationId })), children && (_jsx(AppOrganisationCount, { children: children.length }))] }, applicationId));
|
|
274
|
+
return (_jsxs(AppListItem, __assign({ "data-id": dataIds.AppSwitcherItem }, { children: [url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, url: url, handleGoToAppClick: handleGoToAppClick })), !url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, handleGoToAppClick: handleGoToAppClick, applicationId: applicationId })), children && (_jsx(AppOrganisationCount, __assign({ "data-id": dataIds.AppSwitcherOrgCount }, { children: children.length })))] }), applicationId));
|
|
273
275
|
}) }))] }))
|
|
274
276
|
: null, activeTab === Constants.Tabs.ListOrgs
|
|
275
277
|
? (_jsxs(SearchContent, __assign({ style: {
|
|
276
278
|
display: activeTab === 2 ? 'flex' : 'none'
|
|
277
|
-
} }, { children: [_jsxs(BackButton, __assign({ onClick: function () {
|
|
279
|
+
}, "data-id": dataIds.AppSwitcherOrgPanel }, { children: [_jsxs(BackButton, __assign({ onClick: function () {
|
|
278
280
|
setActiveTab(Constants.Tabs.ListApplications);
|
|
279
281
|
setSearchString('');
|
|
280
|
-
} }, { children: [_jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronLeftIcon" }, { children: _jsx("path", { d: "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) })), messages['back-to']] })), _jsxs(SelectedOrganisation, { children: [renderApplicationLogo(activeApplication === null || activeApplication === void 0 ? void 0 : activeApplication.internalName, LogoVariants.Solid), _jsx("span", { children: activeApplication ? activeApplication.applicationName : '' })] }), _jsx(SearchBox, { id: "app-switcher-search-org", type: 'text', value: searchString, onChange: handleSearchChange, placeholder: messages.search }), _jsx(OrganisationList, { children: filteredOrgs === null || filteredOrgs === void 0 ? void 0 : filteredOrgs.filter(function (o) { return o.name.toLowerCase().includes(searchString.toLowerCase()); }).map(function (org, i) { return (_jsxs(OrganisationLink, __assign({ href: org.url, target: "_blank" }, { children: [org.name, _jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronRightIcon" }, { children: _jsx("path", { d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) }))] }), i)); }) })] })))
|
|
282
|
+
}, "data-id": dataIds.AppSwitcherOrgBackButton }, { children: [_jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronLeftIcon" }, { children: _jsx("path", { d: "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) })), messages['back-to']] })), _jsxs(SelectedOrganisation, __assign({ "data-id": dataIds.AppSwitcherOrgHeader }, { children: [renderApplicationLogo(activeApplication === null || activeApplication === void 0 ? void 0 : activeApplication.internalName, LogoVariants.Solid), _jsx("span", { children: activeApplication ? activeApplication.applicationName : '' })] })), _jsx(SearchBox, { id: "app-switcher-search-org", type: 'text', value: searchString, onChange: handleSearchChange, placeholder: messages.search, "data-id": dataIds.AppSwitcherOrgSearch }), _jsx(OrganisationList, __assign({ "data-id": dataIds.AppSwitcherOrgList }, { children: filteredOrgs === null || filteredOrgs === void 0 ? void 0 : filteredOrgs.filter(function (o) { return o.name.toLowerCase().includes(searchString.toLowerCase()); }).map(function (org, i) { return (_jsxs(OrganisationLink, __assign({ href: org.url, target: "_blank", "data-id": dataIds.AppSwitcherOrgItem }, { children: [org.name, _jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronRightIcon" }, { children: _jsx("path", { d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) }))] }), i)); }) }))] })))
|
|
281
283
|
: null] })));
|
|
282
284
|
};
|
|
283
285
|
AppSwitcher.propTypes = {
|
package/package.json
CHANGED