@learningpool/ui 1.6.6 → 1.6.7
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.
|
@@ -38,18 +38,18 @@ import { DEFAULT_REACT_APP_ID } from '../../../utils/constants';
|
|
|
38
38
|
import { animated } from '@react-spring/web';
|
|
39
39
|
import { defaultMessages } from '../../../lang/en-us';
|
|
40
40
|
var VerticalNavigation = function (props) {
|
|
41
|
-
var _a
|
|
41
|
+
var _a;
|
|
42
42
|
var theme = useTheme();
|
|
43
|
-
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, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications"]);
|
|
43
|
+
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"]);
|
|
44
44
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
45
45
|
var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
|
|
46
46
|
var propIsPersistent = typeof (props === null || props === void 0 ? void 0 : props.isPersistent) === 'boolean' ? props.isPersistent : undefined;
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
47
|
+
var hasAvatar = (_a = props === null || props === void 0 ? void 0 : props.hasAvatar) !== null && _a !== void 0 ? _a : true;
|
|
48
|
+
var _b = React.useState(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false), isDrawerOpen = _b[0], setIsDrawerOpen = _b[1];
|
|
49
|
+
var _c = React.useState(false), isAvatarOpen = _c[0], setIsAvatarOpen = _c[1];
|
|
50
|
+
var _d = React.useState(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false), isPersistent = _d[0], setIsPersistent = _d[1];
|
|
51
51
|
// Controls whether the application panel is open or not.
|
|
52
|
-
var
|
|
52
|
+
var _e = React.useState(false), isAppSwitcherOpen = _e[0], setIsAppSwitcherOpen = _e[1];
|
|
53
53
|
/**
|
|
54
54
|
* Toggles display of the Stream suite application dialog.
|
|
55
55
|
*/
|
|
@@ -60,7 +60,6 @@ var VerticalNavigation = function (props) {
|
|
|
60
60
|
var logoWidth = 38;
|
|
61
61
|
useEffect(function () { return setIsDrawerOpen(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false); }, [propIsDrawerOpen]);
|
|
62
62
|
useEffect(function () { return setIsDrawerOpen(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false); }, [propIsPersistent]);
|
|
63
|
-
useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [avatarName]);
|
|
64
63
|
// This fixes an issue with how MUI handles the modal and aria-hidden.
|
|
65
64
|
// When open, the Modal adds aria-hidden="true" to a top-level element,
|
|
66
65
|
// which causes some screen readers to annouce the elements as "blank".
|
|
@@ -82,7 +81,6 @@ var VerticalNavigation = function (props) {
|
|
|
82
81
|
}
|
|
83
82
|
setIsPersistent(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false);
|
|
84
83
|
};
|
|
85
|
-
var _g = React.useState((_b = handleAvatarInitials(avatarName)) !== null && _b !== void 0 ? _b : 'AN'), avatarInitials = _g[0], setAvatarInitials = _g[1];
|
|
86
84
|
var toggleDrawer = function (open) { return function (event) {
|
|
87
85
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
88
86
|
if (event.type === 'keydown') {
|
|
@@ -211,14 +209,14 @@ var VerticalNavigation = function (props) {
|
|
|
211
209
|
: theme.palette.background.paper
|
|
212
210
|
} }, { children: [hasStreamHome
|
|
213
211
|
? (_jsx(VerticalNavigationItem, { 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: useFadeIn(animationCount, incrementAnimationCount) }))
|
|
214
|
-
: null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_jsx(VerticalNavigationItem, __assign({}, item, { index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: useFadeIn(animationCount, incrementAnimationCount) }))); }), avatarName
|
|
212
|
+
: null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_jsx(VerticalNavigationItem, __assign({}, item, { index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: useFadeIn(animationCount, incrementAnimationCount) }))); }), hasAvatar && avatarName
|
|
215
213
|
? (_jsx(VerticalNavigationItem, { label: avatarName, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, __assign({ style: {
|
|
216
214
|
// backgroundColor: mainTheme.colorButtonText,
|
|
217
215
|
// color: mainTheme.colorButton,
|
|
218
216
|
fontSize: '0.75rem',
|
|
219
217
|
height: 32,
|
|
220
218
|
width: 32
|
|
221
|
-
} }, { children:
|
|
219
|
+
} }, { children: handleAvatarInitials(avatarName) })), style: __assign({ maxHeight: isDrawerOpen ? '200px' : '48px', overflow: 'hidden', padding: 0, minHeight: 52, transition: "max-height 225ms ".concat(motion.easeInOut, " 0ms !important") }, useFadeIn(animationCount, incrementAnimationCount)), onClick: function () { return setIsAvatarOpen(!isAvatarOpen); }, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, __assign({ avatarName: avatarName, isAvatarOpen: isAvatarOpen, localization: localization }, rest)), isDrawerOpen: isDrawerOpen }))
|
|
222
220
|
: null] }))] })) }))] }))); };
|
|
223
221
|
return (_jsxs(StyledAside, __assign({ "aria-label": messages['site-navigation'] }, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
|
|
224
222
|
display: isPersistent ? 'none' : 'block'
|