@learningpool/ui 1.15.4 → 1.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/assets/Images.js +7 -18
  2. package/components/atoms/Autocomplete/Autocomplete.js +3 -14
  3. package/components/atoms/Button/Button.js +2 -13
  4. package/components/atoms/Checkbox/Checkbox.js +3 -26
  5. package/components/atoms/IconButton/IconButton.js +2 -13
  6. package/components/atoms/Radio/Radio.js +3 -26
  7. package/components/atoms/Select/Select.js +3 -26
  8. package/components/atoms/Slider/Slider.js +3 -26
  9. package/components/atoms/Switch/Switch.js +3 -26
  10. package/components/atoms/TextField/TextField.js +2 -13
  11. package/components/atoms/ToggleButton/ToggleButton.js +3 -26
  12. package/components/datadisplay/Avatar/Avatar.js +13 -28
  13. package/components/datadisplay/Chip/Chip.js +3 -26
  14. package/components/datadisplay/List/List.js +2 -13
  15. package/components/feedback/Alert/Alert.js +3 -26
  16. package/components/landmarks/Header/Header.js +15 -41
  17. package/components/landmarks/Header/HeaderActionButtons.d.ts +1 -2
  18. package/components/landmarks/Header/HeaderActionButtons.js +22 -33
  19. package/components/landmarks/Header/HeaderStyles.js +54 -11
  20. package/components/navigation/Drawer/Drawer.js +5 -31
  21. package/components/navigation/MobileNavigation/MobileNavigation.js +70 -82
  22. package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +75 -83
  23. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +102 -52
  24. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +71 -13
  25. package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +1 -1
  26. package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +41 -68
  27. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +34 -18
  28. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +133 -20
  29. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +22 -45
  30. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +8 -19
  31. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +151 -52
  32. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +171 -50
  33. package/components/navigation/MobileNavigation/MobileNavigationMotion.js +11 -11
  34. package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +11 -15
  35. package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +1 -2
  36. package/components/navigation/MobileNavigation/MobileNavigationSearch.js +25 -34
  37. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +34 -18
  38. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.js +47 -9
  39. package/components/navigation/MobileNavigation/MobileNavigationStyles.js +262 -66
  40. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +21 -20
  41. package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +21 -20
  42. package/components/navigation/VerticalNavigation/VerticalNavigation.js +150 -185
  43. package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +50 -61
  44. package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.d.ts +102 -52
  45. package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.js +86 -14
  46. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +27 -51
  47. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +15 -28
  48. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.js +135 -39
  49. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.js +167 -29
  50. package/components/navigation/VerticalNavigation/VerticalNavigationMotion.js +11 -11
  51. package/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +34 -18
  52. package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +236 -42
  53. package/components/navigation/helpers.d.ts +1 -2
  54. package/components/navigation/helpers.js +28 -32
  55. package/components/pages/ErrorPage/ErrorPage.js +6 -17
  56. package/components/pages/ErrorPage/ErrorPageStyles.js +13 -18
  57. package/components/pages/SideInSide/SideInSide.js +12 -23
  58. package/components/pages/SideInSide/SideInSideStyles.js +6 -6
  59. package/components/stream/AppHub/AppHub.js +13 -42
  60. package/components/stream/AppHub/AppHubAdvertStyles.js +24 -8
  61. package/components/stream/AppHub/AppHubBannerAdvert.d.ts +1 -2
  62. package/components/stream/AppHub/AppHubBannerAdvert.js +10 -20
  63. package/components/stream/AppHub/AppHubCustom.js +8 -19
  64. package/components/stream/AppHub/AppHubCustomStyles.d.ts +1 -1
  65. package/components/stream/AppHub/AppHubCustomStyles.js +78 -18
  66. package/components/stream/AppHub/AppHubProduct.js +26 -48
  67. package/components/stream/AppHub/AppHubProductStyles.js +104 -19
  68. package/components/stream/AppHub/AppHubStyles.js +31 -11
  69. package/components/stream/AppHub/constants.d.ts +1 -2
  70. package/components/stream/AppHub/constants.js +14 -14
  71. package/components/stream/AppSwitcher/AppSwitcher.js +225 -316
  72. package/components/stream/AppSwitcher/AppSwitcherItem.js +11 -22
  73. package/components/stream/AppSwitcher/AppSwitcherStyles.js +337 -42
  74. package/components/stream/AppSwitcher/AppSwitcherStylesStandalone.js +255 -21
  75. package/components/stream/AppSwitcher/PromotionalCampaignItem.js +7 -19
  76. package/components/stream/AppSwitcher/constants.d.ts +1 -0
  77. package/components/stream/AppSwitcher/constants.js +6 -5
  78. package/lang/en-us.d.ts +1 -0
  79. package/lang/en-us.js +2 -1
  80. package/package.json +7 -2
  81. package/utils/constants.d.ts +7 -0
  82. package/utils/constants.js +11 -4
  83. package/utils/dataAttributes.js +1 -1
  84. package/utils/helpers.js +33 -40
  85. package/utils/hooks.js +10 -11
  86. package/utils/theme.js +26 -19
@@ -1,36 +1,5 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
- var __rest = (this && this.__rest) || function (s, e) {
13
- var t = {};
14
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
- t[p] = s[p];
16
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
- t[p[i]] = s[p[i]];
20
- }
21
- return t;
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
- };
32
- import { createElement as _createElement } from "react";
33
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { createElement as _createElement } from "@emotion/react";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
34
3
  import React, { useEffect } from 'react';
35
4
  import { useTheme } from '@mui/material/styles';
36
5
  import { Avatar, List, Tooltip } from '../../../index';
@@ -48,30 +17,29 @@ import { ListItemText } from './VerticalNavigationItem/VerticalNavigationItemSty
48
17
  import AvatarPanel from './VerticalNavigationAvatar';
49
18
  import { motion } from '../../../utils/theme';
50
19
  import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
51
- import { DEFAULT_REACT_APP_ID } from '../../../utils/constants';
20
+ import { DEFAULT_REACT_APP_ID, EVENT_KEYS } from '../../../utils/constants';
52
21
  import { animated } from '@react-spring/web';
53
22
  import { defaultMessages } from '../../../lang/en-us';
54
23
  import { defaultAttributes } from '../../../utils/dataAttributes';
55
24
  import { getDefaultSupportLinks, getNavigationBackground, getNavigationContrastText } from '../helpers';
56
25
  import { Constants } from '../../stream/AppSwitcher/constants';
57
- var VerticalNavigation = function (props) {
58
- var _a;
59
- var theme = useTheme();
60
- var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, hideStreamHomeButton = props.hideStreamHomeButton, StreamHomeUrl = props.StreamHomeUrl, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, dataAttributes = props.dataAttributes, showSupportLinks = props.showSupportLinks, hidePromotionalCampaign = props.hidePromotionalCampaign, avatarPanelShowHelpLinks = props.avatarPanelShowHelpLinks, promotionalCampaigns = props.promotionalCampaigns, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "hideStreamHomeButton", "StreamHomeUrl", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName", "dataAttributes", "showSupportLinks", "hidePromotionalCampaign", "avatarPanelShowHelpLinks", "promotionalCampaigns"]);
61
- var messages = __assign(__assign({}, defaultMessages), localization);
62
- var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
63
- var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
64
- var propIsPersistent = typeof (props === null || props === void 0 ? void 0 : props.isPersistent) === 'boolean' ? props.isPersistent : undefined;
65
- var hasAvatar = (_a = props === null || props === void 0 ? void 0 : props.hasAvatar) !== null && _a !== void 0 ? _a : true;
66
- var _b = React.useState(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false), isDrawerOpen = _b[0], setIsDrawerOpen = _b[1];
67
- var _c = React.useState(false), isAvatarOpen = _c[0], setIsAvatarOpen = _c[1];
68
- var _d = React.useState(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false), isPersistent = _d[0], setIsPersistent = _d[1];
26
+ const VerticalNavigation = (props) => {
27
+ const theme = useTheme();
28
+ const { items, secondaryItems, logo, logoText, logoOnClick, appRootID, hasStreamHome, hideStreamHomeButton, StreamHomeUrl, streamHomeApiKey, streamHomeBaseUrl, localization, streamHomeAccessToken, streamHomeApplications, avatarName, dataAttributes, showSupportLinks, hidePromotionalCampaign, avatarPanelShowHelpLinks, promotionalCampaigns, ...rest } = props;
29
+ const messages = { ...defaultMessages, ...localization };
30
+ const dataIds = { ...defaultAttributes, ...dataAttributes };
31
+ const propIsDrawerOpen = typeof props?.isDrawerOpen === 'boolean' ? props.isDrawerOpen : undefined;
32
+ const propIsPersistent = typeof props?.isPersistent === 'boolean' ? props.isPersistent : undefined;
33
+ const hasAvatar = props?.hasAvatar ?? true;
34
+ const [isDrawerOpen, setIsDrawerOpen] = React.useState(propIsDrawerOpen ?? false);
35
+ const [isAvatarOpen, setIsAvatarOpen] = React.useState(false);
36
+ const [isPersistent, setIsPersistent] = React.useState(propIsPersistent ?? false);
69
37
  // Controls whether the application panel is open or not.
70
- var _e = React.useState(false), isAppSwitcherOpen = _e[0], setIsAppSwitcherOpen = _e[1];
38
+ const [isAppSwitcherOpen, setIsAppSwitcherOpen] = React.useState(false);
71
39
  /**
72
40
  * Toggles display of the Stream suite application dialog.
73
41
  */
74
- var handleToggleAppSwitcher = function () {
42
+ const handleToggleAppSwitcher = () => {
75
43
  if (isAvatarOpen) {
76
44
  setIsAvatarOpen(false);
77
45
  }
@@ -80,17 +48,17 @@ var VerticalNavigation = function (props) {
80
48
  /**
81
49
  * Toggles display of the avatar dialog.
82
50
  */
83
- var handleToggleAvatarPanel = function () {
51
+ const handleToggleAvatarPanel = () => {
84
52
  if (isAppSwitcherOpen) {
85
53
  setIsAppSwitcherOpen(false);
86
54
  }
87
55
  setIsAvatarOpen(!isAvatarOpen);
88
56
  };
89
- var logoHeight = 38;
90
- var logoWidth = 38;
91
- useEffect(function () { return setIsDrawerOpen(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false); }, [propIsDrawerOpen]);
92
- useEffect(function () { return setIsDrawerOpen(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false); }, [propIsPersistent]);
93
- useEffect(function () {
57
+ const logoHeight = 38;
58
+ const logoWidth = 38;
59
+ useEffect(() => setIsDrawerOpen(propIsDrawerOpen ?? false), [propIsDrawerOpen]);
60
+ useEffect(() => setIsDrawerOpen(propIsPersistent ?? false), [propIsPersistent]);
61
+ useEffect(() => {
94
62
  if (!avatarName || !hasAvatar) {
95
63
  setIsAvatarOpen(false);
96
64
  }
@@ -101,33 +69,32 @@ var VerticalNavigation = function (props) {
101
69
  // This fix just overrides the default aria-hidden attribute.
102
70
  //
103
71
  // https://github.com/mui/material-ui/issues/19450
104
- useEffect(function () {
72
+ useEffect(() => {
105
73
  if (isDrawerOpen) {
106
- var root = window.document.getElementById(appRootID !== null && appRootID !== void 0 ? appRootID : DEFAULT_REACT_APP_ID);
107
- root === null || root === void 0 ? void 0 : root.removeAttribute('aria-hidden');
74
+ const root = window.document.getElementById(appRootID ?? DEFAULT_REACT_APP_ID);
75
+ root?.removeAttribute('aria-hidden');
108
76
  }
109
77
  }, [isDrawerOpen]);
110
- var handleIsPersistent = function () {
111
- var _a, _b;
112
- if (props === null || props === void 0 ? void 0 : props.setIsPersistent) {
113
- props.setIsPersistent((_a = !propIsPersistent) !== null && _a !== void 0 ? _a : false);
114
- setIsPersistent((_b = !propIsPersistent) !== null && _b !== void 0 ? _b : false);
78
+ const handleIsPersistent = () => {
79
+ if (props?.setIsPersistent) {
80
+ props.setIsPersistent(!propIsPersistent ?? false);
81
+ setIsPersistent(!propIsPersistent ?? false);
115
82
  return;
116
83
  }
117
- setIsPersistent(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false);
84
+ setIsPersistent(propIsPersistent ?? false);
118
85
  };
119
- var toggleDrawer = function (open) { return function (event) {
120
- event === null || event === void 0 ? void 0 : event.stopPropagation();
121
- if (event.type === 'keydown') {
122
- if (event.key === 'Tab' || event.key === 'Shift') {
86
+ const toggleDrawer = (open) => (event) => {
87
+ event?.stopPropagation();
88
+ if (event.type === EVENT_KEYS.Keydown) {
89
+ if (event.key === EVENT_KEYS.Tab || event.key === EVENT_KEYS.Shift) {
123
90
  return;
124
91
  }
125
92
  }
126
93
  setIsAppSwitcherOpen(false);
127
- setIsDrawerOpen(open !== null && open !== void 0 ? open : !isDrawerOpen);
128
- }; };
94
+ setIsDrawerOpen(open ?? !isDrawerOpen);
95
+ };
129
96
  // Default support links, these can be toggled on/off via the showSupportLinks
130
- var defaultSupportLinks = getDefaultSupportLinks(messages);
97
+ const defaultSupportLinks = getDefaultSupportLinks(messages);
131
98
  // Workaround to handle the react-spring calls without
132
99
  // adding additional hook calls on prop or state changes
133
100
  // --
@@ -135,123 +102,121 @@ var VerticalNavigation = function (props) {
135
102
  // this way the number of hook calls never changes
136
103
  // --
137
104
  // First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
138
- var additionalItems = ['hasStreamHome', 'hasAvatar', 'avatarName'];
139
- var totalItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], items !== null && items !== void 0 ? items : [], true), defaultSupportLinks !== null && defaultSupportLinks !== void 0 ? defaultSupportLinks : [], true), secondaryItems !== null && secondaryItems !== void 0 ? secondaryItems : [], true), additionalItems, true);
140
- var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index); }));
141
- var listContent = function () {
142
- var _a, _b, _c, _d, _e;
143
- return (_jsxs(Box, __assign({ sx: {
105
+ const additionalItems = ['hasStreamHome', 'hasAvatar', 'avatarName'];
106
+ const totalItems = [...items ?? [], ...defaultSupportLinks ?? [], ...secondaryItems ?? [], ...additionalItems];
107
+ const animationRefs = React.useRef(totalItems && totalItems.map((item, index) => useFadeIn(index)));
108
+ const listContent = () => (_jsxs(Box, { sx: {
109
+ display: 'flex',
110
+ flex: '1 auto',
111
+ flexDirection: 'column',
112
+ justifyContent: 'flex-start',
113
+ '.wrapper': {
144
114
  display: 'flex',
145
- flex: '1 auto',
146
- flexDirection: 'column',
147
- justifyContent: 'flex-start',
148
- '.wrapper': {
149
- display: 'flex',
150
- position: 'relative'
151
- },
152
- '.wrapper > :not(:first-of-type)': {
153
- position: 'absolute',
154
- right: 0,
155
- background: 'transparent',
156
- fontSize: 0
157
- }
158
- }, 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
159
- ? typeof logo === 'string'
160
- ? (_jsx("img", { src: logo, height: "".concat(logoHeight, "px"), width: "".concat(logoWidth, "px"), style: {
161
- marginInlineEnd: '16px'
162
- }, alt: logoText !== null && logoText !== void 0 ? logoText : messages['site-logo'] }))
163
- : logo
164
- : (_jsx(StreamSuiteLogo, { style: {
165
- height: "".concat(logoHeight, "px"),
166
- width: "".concat(logoWidth, "px"),
167
- marginInlineEnd: '16px',
168
- fill: getNavigationContrastText(theme)
169
- } })) })), _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,
170
- // @ts-expect-error
171
- component: animated.button, style: animationRefs.current[0] }, { children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
172
- ? (_jsx(ChevronLeftIcon, { style: {
173
- fill: getNavigationContrastText(theme),
174
- fontSize: '1.75rem',
175
- height: '1.75rem',
176
- width: '1.75rem'
115
+ position: 'relative'
116
+ },
117
+ '.wrapper > :not(:first-of-type)': {
118
+ position: 'absolute',
119
+ right: 0,
120
+ background: 'transparent',
121
+ fontSize: 0
122
+ }
123
+ }, className: 'grid-container', children: [_jsx("div", { className: 'wrapper', style: { backgroundColor: getNavigationBackground(theme) }, "data-id": dataIds.VerticalNavigationBrand, children: _jsxs(DrawerHeader, { onClick: logoOnClick ?? null, isDrawerOpen: isDrawerOpen || isPersistent, style: animationRefs.current[0], children: [_jsx(Tooltip, { disableHoverListener: isDrawerOpen || isPersistent, disableFocusListener: isDrawerOpen || isPersistent, disableTouchListener: isDrawerOpen || isPersistent, title: logoText ?? '', placement: theme.direction === 'rtl' ? 'left' : 'right', children: logo
124
+ ? typeof logo === 'string'
125
+ ? (_jsx("img", { src: logo, height: `${logoHeight}px`, width: `${logoWidth}px`, style: {
126
+ marginInlineEnd: '16px'
127
+ }, alt: logoText ?? messages['site-logo'] }))
128
+ : logo
129
+ : (_jsx(StreamSuiteLogo, { style: {
130
+ height: `${logoHeight}px`,
131
+ width: `${logoWidth}px`,
132
+ marginInlineEnd: '16px',
133
+ fill: getNavigationContrastText(theme)
134
+ } })) }), _jsx(ListItemText, { primary: logoText ?? '', isDrawerOpen: isDrawerOpen || isPersistent })] }) }), _jsxs("div", { className: 'wrapper', "data-id": dataIds.VerticalNavigationToggle, children: [_jsxs(NotchContainer, { sx: { height: '85px', position: 'relative !important' }, children: [_jsx(NotchBackground, {}), !isPersistent && _jsx(NotchBackgroundClip, {}), _jsx(NotchSeemMask, {})] }), !isPersistent && _jsx(DrawerToggle, { onClick: toggleDrawer(!isDrawerOpen), "aria-label": isDrawerOpen ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", isDrawerOpen: isDrawerOpen,
135
+ // @ts-ignore
136
+ component: animated.button, style: animationRefs.current[0], children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
137
+ ? (_jsx(ChevronLeftIcon, { style: {
138
+ fill: getNavigationContrastText(theme),
139
+ fontSize: '1.75rem',
140
+ height: '1.75rem',
141
+ width: '1.75rem'
142
+ } }))
143
+ : (_jsx(ChevronRightIcon, { style: {
144
+ fill: getNavigationContrastText(theme),
145
+ fontSize: '1.75rem',
146
+ height: '1.75rem',
147
+ width: '1.75rem'
148
+ } })) }) }), _jsx(Box, { style: {
149
+ borderRadius: '50%',
150
+ boxShadow: '5px 0 15px 0 rgb(0 0 0 / 10%)',
151
+ display: 'none',
152
+ height: '50px',
153
+ left: '12px',
154
+ position: 'fixed',
155
+ right: 'auto !important',
156
+ top: '50%',
157
+ transform: 'translate(50%, -50%)',
158
+ width: '50px'
159
+ } }), _jsxs(DrawerToggle, { onClick: handleIsPersistent, "aria-label": isDrawerOpen ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", style: {
160
+ display: 'none',
161
+ position: 'fixed',
162
+ top: '50%',
163
+ transform: 'translate(50%, -50%)',
164
+ zIndex: 10
165
+ }, children: [_jsx(NotchExtendSVG, { style: {
166
+ display: 'block',
167
+ fill: getNavigationBackground(theme),
168
+ height: '165px',
169
+ left: '-12px',
170
+ padding: '0',
171
+ position: 'absolute',
172
+ top: '-61px',
173
+ transition: 'none',
174
+ width: '90px',
175
+ zIndex: '-1'
176
+ } }), _jsx(DrawerToggleHitboxContent, { style: {
177
+ background: 'transparent',
178
+ boxShadow: 'none',
179
+ fontSize: '1.3rem',
180
+ height: '1.3rem',
181
+ padding: theme.spacing(1),
182
+ width: '1.3rem'
183
+ }, children: isPersistent
184
+ ? (_jsx(PushPinIcon, { style: {
185
+ fontSize: '1.3rem',
186
+ height: '1.3rem',
187
+ width: '1.3rem'
177
188
  } }))
178
- : (_jsx(ChevronRightIcon, { style: {
179
- fill: getNavigationContrastText(theme),
180
- fontSize: '1.75rem',
181
- height: '1.75rem',
182
- width: '1.75rem'
183
- } })) }) })), _jsx(Box, { style: {
184
- borderRadius: '50%',
185
- boxShadow: '5px 0 15px 0 rgb(0 0 0 / 10%)',
186
- display: 'none',
187
- height: '50px',
188
- left: '12px',
189
- position: 'fixed',
190
- right: 'auto !important',
191
- top: '50%',
192
- transform: 'translate(50%, -50%)',
193
- width: '50px'
194
- } }), _jsxs(DrawerToggle, __assign({ onClick: handleIsPersistent, "aria-label": isDrawerOpen ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", style: {
195
- display: 'none',
196
- position: 'fixed',
197
- top: '50%',
198
- transform: 'translate(50%, -50%)',
199
- zIndex: 10
200
- } }, { children: [_jsx(NotchExtendSVG, { style: {
201
- display: 'block',
202
- fill: getNavigationBackground(theme),
203
- height: '165px',
204
- left: '-12px',
205
- padding: '0',
206
- position: 'absolute',
207
- top: '-61px',
208
- transition: 'none',
209
- width: '90px',
210
- zIndex: '-1'
211
- } }), _jsx(DrawerToggleHitboxContent, __assign({ style: {
212
- background: 'transparent',
213
- boxShadow: 'none',
214
- fontSize: '1.3rem',
215
- height: '1.3rem',
216
- padding: theme.spacing(1),
217
- width: '1.3rem'
218
- } }, { children: isPersistent
219
- ? (_jsx(PushPinIcon, { style: {
220
- fontSize: '1.3rem',
221
- height: '1.3rem',
222
- width: '1.3rem'
223
- } }))
224
- : (_jsx(PushPinIcon, { style: {
225
- fontSize: '1.3rem',
226
- height: '1.3rem',
227
- width: '1.3rem'
228
- } })) }))] }))] })), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsx("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationPrimary, style: {
229
- backgroundColor: getNavigationBackground(theme),
230
- flex: '1 1px',
231
- marginTop: '-1px',
232
- overflow: 'auto',
233
- position: 'relative',
234
- zIndex: 10
235
- } }, { children: _jsx(StyledNav, __assign({ tabIndex: -1, "aria-label": 'Primary' }, { children: _jsx(List, __assign({ "data-id": dataIds.VerticalNavigationPrimaryList, style: {
236
- height: '100%',
237
- width: DRAWER_WIDTH.Expanded,
238
- marginTop: "-".concat(theme.spacing(0.5), " !important")
239
- } }, { 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: [(showSupportLinks || avatarPanelShowHelpLinks) && defaultSupportLinks && defaultSupportLinks.length > 0 && defaultSupportLinks.map(function (item, index) {
240
- var _a;
241
- 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] })));
242
- }), hasStreamHome
243
- ? (_jsx(VerticalNavigationItem, { id: dataIds.VerticalNavigationAppSwitcherToggle, "data-id": dataIds.VerticalNavigationAppSwitcherToggle, label: messages['app-switcher'], icon: _jsx(AppsIcon, {}), onClick: handleToggleAppSwitcher, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, handleToggleAppSwitcher: handleToggleAppSwitcher, 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, hideStreamHomeButton: hideStreamHomeButton || false, StreamHomeUrl: StreamHomeUrl !== null && StreamHomeUrl !== void 0 ? StreamHomeUrl : Constants.DefaultStreamHomeUrl, hidePromotionalCampaign: hidePromotionalCampaign !== null && hidePromotionalCampaign !== void 0 ? hidePromotionalCampaign : false, promotionalCampaigns: promotionalCampaigns })), 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) + ((_b = defaultSupportLinks === null || defaultSupportLinks === void 0 ? void 0 : defaultSupportLinks.length) !== null && _b !== void 0 ? _b : 0) + 1], isContentOpen: isAppSwitcherOpen }))
244
- : null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) {
245
- var _a, _b;
246
- 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) + ((_b = defaultSupportLinks === null || defaultSupportLinks === void 0 ? void 0 : defaultSupportLinks.length) !== null && _b !== void 0 ? _b : 0) + index + 1] })));
247
- }), hasAvatar && avatarName && (_jsx(VerticalNavigationItem, { label: avatarName, id: dataIds.VerticalNavigationAvatarToggle, "data-id": dataIds.VerticalNavigationAvatarToggle, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, __assign({ style: {
248
- fontSize: '0.75rem',
249
- height: 32,
250
- width: 32
251
- } }, { 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[((_c = items === null || items === void 0 ? void 0 : items.length) !== null && _c !== void 0 ? _c : 0) + ((_d = defaultSupportLinks === null || defaultSupportLinks === void 0 ? void 0 : defaultSupportLinks.length) !== null && _d !== void 0 ? _d : 0) + ((_e = secondaryItems === null || secondaryItems === void 0 ? void 0 : secondaryItems.length) !== null && _e !== void 0 ? _e : 0) + 2]), onClick: handleToggleAvatarPanel, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, __assign({ avatarName: avatarName, isAvatarOpen: isAvatarOpen, localization: localization, handleToggleAvatarPanel: handleToggleAvatarPanel }, rest)), isDrawerOpen: isDrawerOpen, isContentOpen: isAvatarOpen }))] }))] })) }))] })));
252
- };
253
- 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: {
189
+ : (_jsx(PushPinIcon, { style: {
190
+ fontSize: '1.3rem',
191
+ height: '1.3rem',
192
+ width: '1.3rem'
193
+ } })) })] })] }), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsx("div", { className: 'wrapper', "data-id": dataIds.VerticalNavigationPrimary, style: {
194
+ backgroundColor: getNavigationBackground(theme),
195
+ flex: '1 1px',
196
+ marginTop: '-1px',
197
+ overflow: 'auto',
198
+ position: 'relative',
199
+ zIndex: 10
200
+ }, children: _jsx(StyledNav, { tabIndex: -1, "aria-label": 'Primary', children: _jsx(List, { "data-id": dataIds.VerticalNavigationPrimaryList, style: {
201
+ height: '100%',
202
+ width: DRAWER_WIDTH.Expanded,
203
+ marginTop: `-${theme.spacing(0.5)} !important`
204
+ }, children: items && items.length > 0 && items.map((item, index) => (_createElement(VerticalNavigationItem, { ...item, "data-id": dataIds.VerticalNavigationPrimaryListItem, key: `${item.label} - ${index}`, index: index, isDrawerOpen: isDrawerOpen || isPersistent, style: animationRefs.current[index] }))) }) }) }), _jsx("div", { className: 'wrapper', "data-id": dataIds.VerticalNavigationSecondary, style: { backgroundColor: getNavigationBackground(theme) }, children: _jsxs(StyledNavSecondary, { "aria-label": 'Secondary', children: [_jsx(StyledDivider, { isDrawerOpen: isDrawerOpen || isPersistent }), _jsxs(List, { "data-id": dataIds.VerticalNavigationSecondaryList, style: { width: DRAWER_WIDTH.Expanded }, children: [(showSupportLinks || avatarPanelShowHelpLinks) && defaultSupportLinks && defaultSupportLinks.length > 0 && defaultSupportLinks.map((item, index) => (_createElement(VerticalNavigationItem, { ...item, "data-id": dataIds.VerticalNavigationSecondaryListItem, key: `${item.label} - ${index}`, index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: animationRefs.current[(items?.length ?? 0) + index + 1] }))), hasStreamHome
205
+ ? (_jsx(VerticalNavigationItem, { id: dataIds.VerticalNavigationAppSwitcherToggle, "data-id": dataIds.VerticalNavigationAppSwitcherToggle, label: messages['app-switcher'], icon: _jsx(AppsIcon, {}), onClick: handleToggleAppSwitcher, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, handleToggleAppSwitcher: handleToggleAppSwitcher, applications: streamHomeApplications, apiKey: streamHomeApiKey ?? '', baseUrl: streamHomeBaseUrl ?? '', token: streamHomeAccessToken ?? '', isDrawerOpen: isDrawerOpen, hideStreamHomeButton: hideStreamHomeButton || false, StreamHomeUrl: StreamHomeUrl ?? Constants.DefaultStreamHomeUrl, hidePromotionalCampaign: hidePromotionalCampaign ?? false, promotionalCampaigns: promotionalCampaigns })), isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, hasCustomContent: true, style: animationRefs.current[(items?.length ?? 0) + (defaultSupportLinks?.length ?? 0) + 1], isContentOpen: isAppSwitcherOpen }))
206
+ : null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map((item, index) => (_createElement(VerticalNavigationItem, { ...item, "data-id": dataIds.VerticalNavigationSecondaryListItem, key: `${item.label} - ${index}`, index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: animationRefs.current[(items?.length ?? 0) + (defaultSupportLinks?.length ?? 0) + index + 1] }))), hasAvatar && avatarName && (_jsx(VerticalNavigationItem, { label: avatarName, id: dataIds.VerticalNavigationAvatarToggle, "data-id": dataIds.VerticalNavigationAvatarToggle, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, { style: {
207
+ fontSize: '0.75rem',
208
+ height: 32,
209
+ width: 32
210
+ }, children: handleAvatarInitials(avatarName) }), style: {
211
+ maxHeight: isDrawerOpen ? '200px' : '48px',
212
+ overflow: 'hidden',
213
+ padding: 0,
214
+ minHeight: 52,
215
+ transition: `max-height 225ms ${motion.easeInOut} 0ms !important`,
216
+ ...animationRefs.current[(items?.length ?? 0) + (defaultSupportLinks?.length ?? 0) + (secondaryItems?.length ?? 0) + 2]
217
+ }, onClick: handleToggleAvatarPanel, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, { avatarName: avatarName, isAvatarOpen: isAvatarOpen, localization: localization, handleToggleAvatarPanel: handleToggleAvatarPanel, ...rest }), isDrawerOpen: isDrawerOpen, isContentOpen: isAvatarOpen }))] })] }) })] }));
218
+ return (_jsxs(StyledAside, { "aria-label": messages['site-navigation'], "data-id": dataIds.VerticalNavigationContainer, children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
254
219
  display: isPersistent ? 'none' : 'block'
255
- } }), _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() })) }))] })));
220
+ } }), _jsx(Modal, { "aria-hidden": false, keepMounted: true, disablePortal: true, open: isDrawerOpen, onClose: toggleDrawer(false), children: _jsx(StyledDrawer, { id: 'vertical-navigation', anchor: 'left', open: isDrawerOpen || isPersistent, onClose: toggleDrawer(false), variant: 'permanent', children: listContent() }) })] }));
256
221
  };
257
222
  export default VerticalNavigation;
@@ -1,24 +1,4 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
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
- };
21
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
22
2
  import React, { useEffect } from 'react';
23
3
  import { Box, Link, List, ListItem, ListItemIcon, ListItemText } from '../../../index';
24
4
  import { StyledBox, StyledBoxProfile, StyledButton, StyledAvatarName, StyledAvatar, StyledBoxProfileEdit, StyledListItemButton, StyledButtonGroup } from './VerticalNavigationAvatarStyles';
@@ -32,33 +12,32 @@ import { animated } from '@react-spring/web';
32
12
  import { FlyoutMenuItemText } from './VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles';
33
13
  import { defaultMessages } from '../../../lang/en-us';
34
14
  import { defaultAttributes } from '../../../utils/dataAttributes';
35
- var AvatarPanel = function (props) {
36
- var _a, _b, _c, _d;
37
- var theme = useTheme();
38
- 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, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelFootnote = props.avatarPanelFootnote, isAvatarOpen = props.isAvatarOpen, localization = props.localization, dataAttributes = props.dataAttributes, handleToggleAvatarPanel = props.handleToggleAvatarPanel;
39
- var messages = __assign(__assign({}, defaultMessages), localization);
40
- var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
41
- var handleAvatarClick = function (event) {
42
- var avatarPanelId = document.getElementById(defaultAttributes.VerticalNavigationAvatarToggle);
15
+ const AvatarPanel = (props) => {
16
+ const theme = useTheme();
17
+ const { avatarName, avatarPanelOnClickLogout, avatarPanelLogoutString, avatarPanelOnClickViewProfile, avatarPanelViewProfileString, avatarPanelOnClickEditProfile, avatarPanelEditProfileString, avatarPanelMenuItems, avatarPanelSettingItems, avatarPanelOnClickMainAction, avatarPanelMainActionString, avatarPanelFootnote, isAvatarOpen, localization, dataAttributes, handleToggleAvatarPanel } = props;
18
+ const messages = { ...defaultMessages, ...localization };
19
+ const dataIds = { ...defaultAttributes, ...dataAttributes };
20
+ const handleAvatarClick = (event) => {
21
+ const avatarPanelId = document.getElementById(defaultAttributes.VerticalNavigationAvatarToggle);
43
22
  // Not allow the onClick to toggle event when clicking away from the ref
44
- if (avatarPanelId === null || avatarPanelId === void 0 ? void 0 : avatarPanelId.contains(event.target)) {
23
+ if (avatarPanelId?.contains(event.target)) {
45
24
  return;
46
25
  }
47
26
  // Toggle the panel when you're clicking away from the ref
48
27
  handleToggleAvatarPanel();
49
28
  };
50
- useEffect(function () {
29
+ useEffect(() => {
51
30
  setAvatarInitials(handleAvatarInitials(avatarName));
52
31
  }, [avatarName]);
53
- useEffect(function () {
32
+ useEffect(() => {
54
33
  if (isAvatarOpen) {
55
34
  document.addEventListener('mousedown', handleAvatarClick);
56
35
  }
57
- return function () {
36
+ return () => {
58
37
  document.removeEventListener('mousedown', handleAvatarClick);
59
38
  };
60
39
  }, [isAvatarOpen]);
61
- var _e = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _e[0], setAvatarInitials = _e[1];
40
+ const [avatarInitials, setAvatarInitials] = React.useState(handleAvatarInitials(avatarName) ?? 'AN');
62
41
  // Workaround to handle the react-spring calls without
63
42
  // adding additional hook calls on prop or state changes
64
43
  // --
@@ -66,53 +45,63 @@ var AvatarPanel = function (props) {
66
45
  // this way the number of hook calls never changes
67
46
  // --
68
47
  // First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
69
- var additionalItems = [
48
+ const additionalItems = [
70
49
  'avatarPanelOnClickLogout',
71
50
  'avatarName',
72
51
  'avatarPanelOnClickViewProfile',
73
52
  'avatarPanelOnClickMainAction',
74
53
  'avatarPanelFootnote'
75
54
  ];
76
- var totalItems = __spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), additionalItems, true);
77
- var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index, !isAvatarOpen); }));
78
- return (_jsxs(StyledBox, __assign({ onMouseDown: function (event) { return event.stopPropagation(); } }, { children: [avatarPanelOnClickLogout && (_jsx(StyledButton
79
- // @ts-expect-error
80
- , __assign({
81
- // @ts-expect-error
82
- 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: {
55
+ const totalItems = [
56
+ ...avatarPanelMenuItems ?? [],
57
+ ...avatarPanelSettingItems ?? [],
58
+ ...additionalItems
59
+ ];
60
+ const animationRefs = React.useRef(totalItems && totalItems.map((item, index) => useFadeIn(index, !isAvatarOpen)));
61
+ return (_jsxs(StyledBox, { onMouseDown: (event) => event.stopPropagation(), children: [avatarPanelOnClickLogout && (_jsx(StyledButton
62
+ // @ts-ignore
63
+ , {
64
+ // @ts-ignore
65
+ component: animated.button, style: {
66
+ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto',
67
+ position: 'absolute',
68
+ right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1),
69
+ top: theme.spacing(1),
70
+ ...animationRefs.current[0]
71
+ }, onClick: avatarPanelOnClickLogout, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit', children: avatarPanelLogoutString ?? messages.logout })), _jsxs(Box, { "data-id": dataIds.VerticalNavigationAvatarProfile, style: {
83
72
  alignItems: 'center',
84
73
  display: 'flex',
85
74
  flexDirection: 'column'
86
- } }, { 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(PersonIcon, {}) }, { 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: {
75
+ }, children: [_jsxs(StyledBoxProfile, { style: animationRefs.current[1], children: [_jsx(StyledAvatar, { style: { marginInlineEnd: '0.5rem' }, children: avatarInitials }), _jsxs(StyledAvatarName, { children: [_jsx("span", { style: { fontWeight: 300 }, children: messages.greeting }), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })] }), avatarPanelOnClickViewProfile && (_jsx(StyledBoxProfileEdit, { style: {
76
+ marginBottom: theme.spacing(2),
77
+ ...animationRefs.current[2]
78
+ }, children: _jsxs(StyledButtonGroup, { variant: 'outlined', "aria-label": "split button", children: [_jsx(StyledButton, { variant: 'outlined', color: 'inherit', size: 'medium', onClick: avatarPanelOnClickViewProfile, startIcon: _jsx(PersonIcon, {}), children: avatarPanelViewProfileString ?? messages['view-profile'] }), avatarPanelOnClickEditProfile && (_jsx(StyledButton, { variant: 'outlined', color: 'inherit', size: 'medium', "aria-label": avatarPanelEditProfileString ?? messages['edit-profile'], onClick: avatarPanelOnClickEditProfile, children: _jsx(EditIcon, {}) }))] }) }))] }), _jsxs(Box, { style: {
87
79
  alignItems: 'center',
88
80
  display: 'flex',
89
81
  flexDirection: 'column'
90
- } }, { children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: {
82
+ }, children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, { "data-id": dataIds.VerticalNavigationFlyoutList, style: {
91
83
  marginBottom: theme.spacing(2),
92
84
  maxWidth: '14rem'
93
- } }, { 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
85
+ }, children: avatarPanelMenuItems.map((avatarMenuItem, index) => (_jsx(ListItem, { "data-id": dataIds.VerticalNavigationFlyoutListItem, component: animated.div, style: animationRefs.current[index + 2], disablePadding: true, children: _jsxs(StyledListItemButton
94
86
  // TODO: figure out if these are links or buttons
95
87
  // @ts-expect-error
96
- , __assign({
88
+ , {
97
89
  // TODO: figure out if these are links or buttons
98
90
  // @ts-expect-error
99
- component: Link, role: 'link', onClick: avatarMenuItem.onClick }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: { minWidth: theme.spacing(5) } }, { children: avatarMenuItem.icon })), _jsx(FlyoutMenuItemText, { primary: avatarMenuItem.label })] })) }), "".concat(avatarMenuItem.label, " - ").concat(index))); }) }))), avatarPanelOnClickMainAction && _jsx(StyledButton
100
- // @ts-expect-error
101
- , __assign({
102
- // @ts-expect-error
103
- 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(SettingsIcon, {}) }, { children: avatarPanelMainActionString })), _jsx(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: { marginBottom: theme.spacing(2), marginTop: theme.spacing(2) } }, { children: avatarPanelSettingItems &&
91
+ component: Link, role: 'link', onClick: avatarMenuItem.onClick, children: [_jsx(ListItemIcon, { "aria-hidden": true, style: { minWidth: theme.spacing(5) }, children: avatarMenuItem.icon }), _jsx(FlyoutMenuItemText, { primary: avatarMenuItem.label })] }) }, `${avatarMenuItem.label} - ${index}`))) })), avatarPanelOnClickMainAction && _jsx(StyledButton
92
+ // @ts-ignore
93
+ , {
94
+ // @ts-ignore
95
+ component: animated.button, style: animationRefs.current[(avatarPanelMenuItems?.length ?? 0) + 3], variant: 'outlined', color: 'inherit', size: 'medium', onClick: avatarPanelOnClickMainAction, startIcon: _jsx(SettingsIcon, {}), children: avatarPanelMainActionString }), _jsx(List, { "data-id": dataIds.VerticalNavigationFlyoutList, style: { marginBottom: theme.spacing(2), marginTop: theme.spacing(2) }, children: avatarPanelSettingItems &&
104
96
  avatarPanelSettingItems.length > 0 &&
105
- avatarPanelSettingItems.map(function (avatarMenuItem, index) {
106
- var _a;
107
- 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
97
+ avatarPanelSettingItems.map((avatarMenuItem, index) => (_jsx(ListItem, { "data-id": dataIds.VerticalNavigationFlyoutListItem, component: animated.div, style: animationRefs.current[(avatarPanelMenuItems?.length ?? 0) + index + 3], disablePadding: true, children: _jsxs(StyledListItemButton
98
+ // TODO: figure out if these are links or buttons
99
+ // @ts-expect-error
100
+ , {
108
101
  // TODO: figure out if these are links or buttons
109
102
  // @ts-expect-error
110
- , __assign({
111
- // TODO: figure out if these are links or buttons
112
- // @ts-expect-error
113
- component: Link, role: 'link', onClick: avatarMenuItem.onClick }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
114
- minWidth: theme.spacing(5)
115
- } }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }), "".concat(avatarMenuItem.label, " - ").concat(index)));
116
- }) }))] })), _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 }))] })));
103
+ component: Link, role: 'link', onClick: avatarMenuItem.onClick, children: [_jsx(ListItemIcon, { "aria-hidden": true, style: {
104
+ minWidth: theme.spacing(5)
105
+ }, children: avatarMenuItem.icon }), _jsx(ListItemText, { primary: avatarMenuItem.label })] }) }, `${avatarMenuItem.label} - ${index}`))) })] }), _jsx(Box, { "data-id": dataIds.VerticalNavigationFlyoutFootnote, className: 'avatar-panel-footnote', style: animationRefs.current[(avatarPanelMenuItems?.length ?? 0) + (avatarPanelSettingItems?.length ?? 0) + 4], children: avatarPanelFootnote && avatarPanelFootnote })] }));
117
106
  };
118
107
  export default AvatarPanel;