@learningpool/ui 1.9.0 → 1.10.1
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/navigation/MobileNavigation/MobileNavigation.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +2 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +33 -7
- package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +2 -34
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +35 -17
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +1 -5
- package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +2 -2
- package/lang/en-us.d.ts +3 -0
- package/lang/en-us.js +4 -1
- package/package.json +1 -1
- package/types/components/navigation/VerticalNavigation.d.ts +3 -0
- package/types/components/navigation/VerticalNavigationAvatar.d.ts +1 -0
|
@@ -34,6 +34,7 @@ interface MobileNavigationProps {
|
|
|
34
34
|
avatarPanelOnClickMainAction?: any;
|
|
35
35
|
avatarPanelMainActionString?: string;
|
|
36
36
|
avatarPanelSettingItems?: Array<IAvatarMenuItemProps>;
|
|
37
|
+
avatarPanelShowHelpLinks?: boolean;
|
|
37
38
|
}
|
|
38
39
|
declare const MobileNavigation: (props: MobileNavigationProps) => React.ReactElement;
|
|
39
40
|
export default MobileNavigation;
|
|
@@ -11,6 +11,7 @@ export interface ISwipeableTemporaryAvatarProps {
|
|
|
11
11
|
setIsAvatarOpen?: any;
|
|
12
12
|
mobileNavDirection?: string;
|
|
13
13
|
setMobileNavDirection?: any;
|
|
14
|
+
localization?: any;
|
|
14
15
|
dataAttributes?: any;
|
|
15
16
|
avatarPanelLogoutString?: string;
|
|
16
17
|
avatarPanelOnClickSwitchDirection?: any;
|
|
@@ -24,6 +25,7 @@ export interface ISwipeableTemporaryAvatarProps {
|
|
|
24
25
|
avatarPanelMainActionString?: string;
|
|
25
26
|
avatarPanelSettingItems?: Array<IAvatarMenuItemProps>;
|
|
26
27
|
avatarPanelInvertNavString?: string;
|
|
28
|
+
avatarPanelShowHelpLinks?: boolean;
|
|
27
29
|
}
|
|
28
30
|
declare const SwipeableTemporaryAvatar: (props: ISwipeableTemporaryAvatarProps) => React.ReactElement;
|
|
29
31
|
export default SwipeableTemporaryAvatar;
|
|
@@ -30,12 +30,15 @@ import ToggleOnIcon from '@mui/icons-material/ToggleOn';
|
|
|
30
30
|
import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
|
|
31
31
|
import { animated } from '@react-spring/web';
|
|
32
32
|
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
33
|
+
import { defaultMessages } from '../../../lang/en-us';
|
|
34
|
+
import { Help, Lightbulb, Phone } from '@mui/icons-material';
|
|
33
35
|
var SwipeableTemporaryAvatar = function (props) {
|
|
34
|
-
var _a, _b, _c, _d;
|
|
36
|
+
var _a, _b, _c, _d, _e;
|
|
35
37
|
var theme = useTheme();
|
|
36
|
-
var avatarName = props.avatarName, mobileNavDirection = props.mobileNavDirection, avatarPanelLogoutString = props.avatarPanelLogoutString, isAvatarOpen = props.isAvatarOpen, setIsAvatarOpen = props.setIsAvatarOpen, setMobileNavDirection = props.setMobileNavDirection, avatarPanelOnClickSwitchDirection = props.avatarPanelOnClickSwitchDirection, avatarPanelOnClickLogout = props.avatarPanelOnClickLogout, avatarPanelOnClickViewProfile = props.avatarPanelOnClickViewProfile, avatarPanelViewProfileString = props.avatarPanelViewProfileString, avatarPanelOnClickEditProfile = props.avatarPanelOnClickEditProfile, avatarPanelEditProfileString = props.avatarPanelEditProfileString, avatarPanelMenuItems = props.avatarPanelMenuItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelInvertNavString = props.avatarPanelInvertNavString, dataAttributes = props.dataAttributes;
|
|
38
|
+
var avatarName = props.avatarName, mobileNavDirection = props.mobileNavDirection, avatarPanelLogoutString = props.avatarPanelLogoutString, isAvatarOpen = props.isAvatarOpen, setIsAvatarOpen = props.setIsAvatarOpen, setMobileNavDirection = props.setMobileNavDirection, avatarPanelOnClickSwitchDirection = props.avatarPanelOnClickSwitchDirection, avatarPanelOnClickLogout = props.avatarPanelOnClickLogout, avatarPanelOnClickViewProfile = props.avatarPanelOnClickViewProfile, avatarPanelViewProfileString = props.avatarPanelViewProfileString, avatarPanelOnClickEditProfile = props.avatarPanelOnClickEditProfile, avatarPanelEditProfileString = props.avatarPanelEditProfileString, avatarPanelMenuItems = props.avatarPanelMenuItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelInvertNavString = props.avatarPanelInvertNavString, dataAttributes = props.dataAttributes, localization = props.localization, avatarPanelShowHelpLinks = props.avatarPanelShowHelpLinks;
|
|
39
|
+
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
37
40
|
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
38
|
-
var
|
|
41
|
+
var _f = React.useState(isAvatarOpen !== null && isAvatarOpen !== void 0 ? isAvatarOpen : false), isOpen = _f[0], setIsOpen = _f[1];
|
|
39
42
|
React.useEffect(function () { return handleOpenState(isAvatarOpen); }, [isAvatarOpen]);
|
|
40
43
|
var handleOpenState = function (open) {
|
|
41
44
|
setIsOpen(open);
|
|
@@ -51,12 +54,19 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
51
54
|
handleOpenState(open);
|
|
52
55
|
};
|
|
53
56
|
};
|
|
54
|
-
var
|
|
57
|
+
var _g = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _g[0], setAvatarInitials = _g[1];
|
|
55
58
|
useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [avatarName]);
|
|
56
59
|
var handleOnClickSwitchDirection = function () {
|
|
57
60
|
setMobileNavDirection(mobileNavDirection === 'rtl' ? 'ltr' : 'rtl');
|
|
58
61
|
avatarPanelOnClickSwitchDirection && avatarPanelOnClickSwitchDirection();
|
|
59
62
|
};
|
|
63
|
+
// Add default helpful links below avatarPanelSettingItems,
|
|
64
|
+
// these can be toggled on/off with the avatarPanelShowHelpLinks prop
|
|
65
|
+
var defaultHelpLinks = [
|
|
66
|
+
{ label: messages['help-center'], icon: _jsx(Help, {}), onClick: function () { return window.open('https://learningpool.zendesk.com', '_blank'); } },
|
|
67
|
+
{ label: messages['feature-request'], icon: _jsx(Lightbulb, {}), onClick: function () { return window.open('https://app.smartsheet.com/b/form/823248624a324630a904e825098ca816', '_blank'); } },
|
|
68
|
+
{ label: messages['contact-us'], icon: _jsx(Phone, {}), onClick: function () { return window.open('https://learningpool.com/support', '_blank'); } }
|
|
69
|
+
];
|
|
60
70
|
// Workaround to handle the react-spring calls without
|
|
61
71
|
// adding additional hook calls on prop or state changes
|
|
62
72
|
// --
|
|
@@ -71,7 +81,7 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
71
81
|
'avatarPanelOnClickMainAction',
|
|
72
82
|
'mobileNavDirection'
|
|
73
83
|
];
|
|
74
|
-
var totalItems = __spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), additionalItems, true);
|
|
84
|
+
var totalItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), defaultHelpLinks !== null && defaultHelpLinks !== void 0 ? defaultHelpLinks : [], true), additionalItems, true);
|
|
75
85
|
var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index, !isAvatarOpen); }));
|
|
76
86
|
return (_jsx(StyledSwipeableAvatar, __assign({ "data-id": dataIds.MobileNavAvatarPanel, anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
|
|
77
87
|
keepMounted: true
|
|
@@ -118,7 +128,7 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
118
128
|
component: animated.button, style: animationRefs.current[((_b = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _b !== void 0 ? _b : 0) + 3], disablePadding: true, variant: 'outlined', color: 'inherit', size: 'medium', onClick: function () {
|
|
119
129
|
handleOpenState(false);
|
|
120
130
|
avatarPanelOnClickMainAction();
|
|
121
|
-
} }, { children: avatarPanelMainActionString })), _jsxs(List, __assign({ style: { marginBottom: theme.spacing(2) } }, { children: [avatarPanelSettingItems &&
|
|
131
|
+
} }, { children: avatarPanelMainActionString })), _jsxs(List, __assign({ style: { marginBottom: theme.spacing(2), marginTop: theme.spacing(2) } }, { children: [avatarPanelSettingItems &&
|
|
122
132
|
avatarPanelSettingItems.length > 0 &&
|
|
123
133
|
avatarPanelSettingItems.map(function (avatarMenuItem, index) {
|
|
124
134
|
var _a;
|
|
@@ -134,7 +144,23 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
134
144
|
} }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
135
145
|
minWidth: theme.spacing(5)
|
|
136
146
|
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) })));
|
|
137
|
-
}),
|
|
147
|
+
}), avatarPanelShowHelpLinks && defaultHelpLinks &&
|
|
148
|
+
defaultHelpLinks.length > 0 &&
|
|
149
|
+
defaultHelpLinks.map(function (avatarMenuItem, index) {
|
|
150
|
+
var _a, _b;
|
|
151
|
+
return (_jsx(ListItem, __assign({ component: animated.div, style: animationRefs.current[((_a = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _a !== void 0 ? _a : 0) + ((_b = avatarPanelSettingItems === null || avatarPanelSettingItems === void 0 ? void 0 : avatarPanelSettingItems.length) !== null && _b !== void 0 ? _b : 0) + index + 3], disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
152
|
+
// TODO: figure out if these are links or buttons
|
|
153
|
+
// @ts-expect-error
|
|
154
|
+
, __assign({
|
|
155
|
+
// TODO: figure out if these are links or buttons
|
|
156
|
+
// @ts-expect-error
|
|
157
|
+
component: Link, role: 'link', onClick: function () {
|
|
158
|
+
handleOpenState(false);
|
|
159
|
+
avatarMenuItem.onClick();
|
|
160
|
+
} }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
161
|
+
minWidth: theme.spacing(5)
|
|
162
|
+
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) })));
|
|
163
|
+
}), avatarPanelOnClickSwitchDirection && (_jsx(ListItem, __assign({ component: animated.div, style: __assign({ marginTop: avatarPanelShowHelpLinks ? theme.spacing(2) : 0 }, 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) + ((_e = defaultHelpLinks === null || defaultHelpLinks === void 0 ? void 0 : defaultHelpLinks.length) !== null && _e !== void 0 ? _e : 0) + 4]), disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
138
164
|
// TODO: figure out if these are links or buttons
|
|
139
165
|
// @ts-expect-error
|
|
140
166
|
, __assign({
|
|
@@ -1,36 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
logo?: string;
|
|
5
|
-
logoText?: string;
|
|
6
|
-
logoOnClick?: any;
|
|
7
|
-
items?: IVerticalNavigationItemProps[];
|
|
8
|
-
secondaryItems?: IVerticalNavigationItemProps[];
|
|
9
|
-
hasStreamHome?: boolean;
|
|
10
|
-
streamHomeAccessToken?: string;
|
|
11
|
-
streamHomeBaseUrl?: string;
|
|
12
|
-
streamHomeApiKey?: string;
|
|
13
|
-
streamHomeApplications?: IApplication[];
|
|
14
|
-
avatarName?: string;
|
|
15
|
-
isDrawerOpen?: boolean;
|
|
16
|
-
isPersistent?: boolean;
|
|
17
|
-
setIsPersistent?: any;
|
|
18
|
-
appRootID?: string;
|
|
19
|
-
localization?: any;
|
|
20
|
-
dataAttributes?: any;
|
|
21
|
-
hasAvatar?: boolean;
|
|
22
|
-
avatarPanelLogoutString?: string;
|
|
23
|
-
avatarPanelOnClickSwitchDirection?: any;
|
|
24
|
-
avatarPanelOnClickLogout?: any;
|
|
25
|
-
avatarPanelOnClickViewProfile?: any;
|
|
26
|
-
avatarPanelViewProfileString?: string;
|
|
27
|
-
avatarPanelOnClickEditProfile?: any;
|
|
28
|
-
avatarPanelEditProfileString?: string;
|
|
29
|
-
avatarPanelMenuItems?: Array<IAvatarMenuItemProps>;
|
|
30
|
-
avatarPanelOnClickMainAction?: any;
|
|
31
|
-
avatarPanelMainActionString?: string;
|
|
32
|
-
avatarPanelSettingItems?: Array<IAvatarMenuItemProps>;
|
|
33
|
-
avatarPanelFootnote?: any;
|
|
34
|
-
}
|
|
35
|
-
declare const VerticalNavigation: (props: VerticalNavigationProps) => React.ReactElement;
|
|
2
|
+
import { IVerticalNavigationProps } from '../../../types';
|
|
3
|
+
declare const VerticalNavigation: (props: IVerticalNavigationProps) => React.ReactElement;
|
|
36
4
|
export default VerticalNavigation;
|
|
@@ -26,21 +26,28 @@ import { useTheme } from '@mui/material/styles';
|
|
|
26
26
|
import EditIcon from '@mui/icons-material/Edit';
|
|
27
27
|
import LogoutIcon from '@mui/icons-material/Logout';
|
|
28
28
|
import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
|
|
29
|
-
import { Person, Settings } from '@mui/icons-material';
|
|
29
|
+
import { Help, Lightbulb, Person, Phone, Settings } from '@mui/icons-material';
|
|
30
30
|
import { animated } from '@react-spring/web';
|
|
31
31
|
import { FlyoutMenuItemText } from './VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles';
|
|
32
32
|
import { defaultMessages } from '../../../lang/en-us';
|
|
33
33
|
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
34
34
|
var AvatarPanel = function (props) {
|
|
35
|
-
var _a, _b, _c, _d;
|
|
35
|
+
var _a, _b, _c, _d, _e;
|
|
36
36
|
var theme = useTheme();
|
|
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,
|
|
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, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelFootnote = props.avatarPanelFootnote, isAvatarOpen = props.isAvatarOpen, localization = props.localization, dataAttributes = props.dataAttributes, avatarPanelShowHelpLinks = props.avatarPanelShowHelpLinks;
|
|
38
38
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
39
39
|
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
40
40
|
useEffect(function () {
|
|
41
41
|
setAvatarInitials(handleAvatarInitials(avatarName));
|
|
42
42
|
}, [avatarName]);
|
|
43
|
-
var
|
|
43
|
+
var _f = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _f[0], setAvatarInitials = _f[1];
|
|
44
|
+
// Add default helpful links below avatarPanelSettingItems,
|
|
45
|
+
// these can be toggled on/off with the avatarPanelShowHelpLinks prop
|
|
46
|
+
var defaultHelpLinks = [
|
|
47
|
+
{ label: messages['help-center'], icon: _jsx(Help, {}), onClick: function () { return window.open('https://learningpool.zendesk.com/', '_blank'); } },
|
|
48
|
+
{ label: messages['feature-request'], icon: _jsx(Lightbulb, {}), onClick: function () { return window.open('https://app.smartsheet.com/b/form/823248624a324630a904e825098ca816', '_blank'); } },
|
|
49
|
+
{ label: messages['contact-us'], icon: _jsx(Phone, {}), onClick: function () { return window.open('https://learningpool.com/support/', '_blank'); } }
|
|
50
|
+
];
|
|
44
51
|
// Workaround to handle the react-spring calls without
|
|
45
52
|
// adding additional hook calls on prop or state changes
|
|
46
53
|
// --
|
|
@@ -55,7 +62,7 @@ var AvatarPanel = function (props) {
|
|
|
55
62
|
'avatarPanelOnClickMainAction',
|
|
56
63
|
'avatarPanelFootnote'
|
|
57
64
|
];
|
|
58
|
-
var totalItems = __spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), additionalItems, true);
|
|
65
|
+
var totalItems = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), defaultHelpLinks !== null && defaultHelpLinks !== void 0 ? defaultHelpLinks : [], true), additionalItems, true);
|
|
59
66
|
var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index, !isAvatarOpen); }));
|
|
60
67
|
return (_jsxs(StyledBox, { children: [avatarPanelOnClickLogout && (_jsx(StyledButton
|
|
61
68
|
// @ts-expect-error
|
|
@@ -82,19 +89,30 @@ var AvatarPanel = function (props) {
|
|
|
82
89
|
// @ts-expect-error
|
|
83
90
|
, __assign({
|
|
84
91
|
// @ts-expect-error
|
|
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 })),
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
// TODO: figure out if these are links or buttons
|
|
91
|
-
// @ts-expect-error
|
|
92
|
-
, __assign({
|
|
92
|
+
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 })), _jsxs(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: { marginBottom: theme.spacing(2), marginTop: theme.spacing(2) } }, { children: [avatarPanelSettingItems &&
|
|
93
|
+
avatarPanelSettingItems.length > 0 &&
|
|
94
|
+
avatarPanelSettingItems.map(function (avatarMenuItem, index) {
|
|
95
|
+
var _a;
|
|
96
|
+
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
|
|
93
97
|
// TODO: figure out if these are links or buttons
|
|
94
98
|
// @ts-expect-error
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
, __assign({
|
|
100
|
+
// TODO: figure out if these are links or buttons
|
|
101
|
+
// @ts-expect-error
|
|
102
|
+
component: Link, role: 'link', onClick: avatarMenuItem.onClick }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
103
|
+
minWidth: theme.spacing(5)
|
|
104
|
+
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }), "".concat(avatarMenuItem.label, " - ").concat(index)));
|
|
105
|
+
}), avatarPanelShowHelpLinks && defaultHelpLinks &&
|
|
106
|
+
defaultHelpLinks.length > 0 &&
|
|
107
|
+
defaultHelpLinks.map(function (avatarMenuItem, index) {
|
|
108
|
+
var _a, _b;
|
|
109
|
+
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) + ((_b = avatarPanelSettingItems === null || avatarPanelSettingItems === void 0 ? void 0 : avatarPanelSettingItems.length) !== null && _b !== void 0 ? _b : 0) + index + 3], disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
110
|
+
// @ts-expect-error
|
|
111
|
+
, __assign({
|
|
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) + ((_e = defaultHelpLinks === null || defaultHelpLinks === void 0 ? void 0 : defaultHelpLinks.length) !== null && _e !== void 0 ? _e : 0) + 4] }, { children: avatarPanelFootnote && avatarPanelFootnote }))] }));
|
|
99
117
|
};
|
|
100
118
|
export default AvatarPanel;
|
package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js
CHANGED
|
@@ -100,11 +100,7 @@ var VerticalNavigationItem = function (props) {
|
|
|
100
100
|
? null
|
|
101
101
|
: handlePopoverOpen(event); }, onMouseLeave: function () { return (hasCustomContent || fullHeightFlyout || isDrawerOpen)
|
|
102
102
|
? null
|
|
103
|
-
: handlePopoverClose(); }, onFocus: function (event) { return handleKeyDown(event); }, onBlur: function (event) { return handleKeyDown(event); }, "aria-current": isActive ? 'page' : null, "aria-expanded": (children && children.length > 0) || fullHeightFlyout || hasCustomContent ? open : null, role: (children && children.length > 0) || fullHeightFlyout || hasCustomContent ? 'button' : 'link' }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: (_a = (children && children.length > 0)) !== null && _a !== void 0 ? _a : isDrawerOpen, disableFocusListener: (_b = (children && children.length > 0)) !== null && _b !== void 0 ? _b : isDrawerOpen, disableTouchListener: (_c = (children && children.length > 0)) !== null && _c !== void 0 ? _c : isDrawerOpen, title: label, placement: theme.direction === 'rtl' ? 'left' : 'right', enterDelay: tooltipDelay.start, leaveDelay: tooltipDelay.end }, { children: _jsx(ListItemIcon, __assign({ "aria-hidden": true }, { children: icon !== null && icon !== void 0 ? icon : _jsx(MailIcon, {}) })) })), _jsx(ListItemText, { primary: label, isDrawerOpen: isDrawerOpen, index: index,
|
|
104
|
-
'& .MuiTypography-root': {
|
|
105
|
-
fontSize: isSecondary ? '14px' : 'inherit'
|
|
106
|
-
}
|
|
107
|
-
} })] }), label), children && children.length > 0 && isDrawerOpen && (_jsx(Collapse, __assign({ component: 'div', in: isDrawerOpen }, { children: _jsx(List, __assign({ "aria-label": label, disablePadding: true }, { children: children.map(function (childItem, index) { return (_jsx(ListItem, __assign({ disablePadding: true, isDrawerOpen: isDrawerOpen }, { children: _jsxs(ListItemButtonChild
|
|
103
|
+
: handlePopoverClose(); }, onFocus: function (event) { return handleKeyDown(event); }, onBlur: function (event) { return handleKeyDown(event); }, "aria-current": isActive ? 'page' : null, "aria-expanded": (children && children.length > 0) || fullHeightFlyout || hasCustomContent ? open : null, role: (children && children.length > 0) || fullHeightFlyout || hasCustomContent ? 'button' : 'link' }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: (_a = (children && children.length > 0)) !== null && _a !== void 0 ? _a : isDrawerOpen, disableFocusListener: (_b = (children && children.length > 0)) !== null && _b !== void 0 ? _b : isDrawerOpen, disableTouchListener: (_c = (children && children.length > 0)) !== null && _c !== void 0 ? _c : isDrawerOpen, title: label, placement: theme.direction === 'rtl' ? 'left' : 'right', enterDelay: tooltipDelay.start, leaveDelay: tooltipDelay.end }, { children: _jsx(ListItemIcon, __assign({ "aria-hidden": true }, { children: icon !== null && icon !== void 0 ? icon : _jsx(MailIcon, {}) })) })), _jsx(ListItemText, { primary: label, isDrawerOpen: isDrawerOpen, index: index })] }), label), children && children.length > 0 && isDrawerOpen && (_jsx(Collapse, __assign({ component: 'div', in: isDrawerOpen }, { children: _jsx(List, __assign({ "aria-label": label, disablePadding: true }, { children: children.map(function (childItem, index) { return (_jsx(ListItem, __assign({ disablePadding: true, isDrawerOpen: isDrawerOpen }, { children: _jsxs(ListItemButtonChild
|
|
108
104
|
// @ts-expect-error
|
|
109
105
|
, __assign({
|
|
110
106
|
// @ts-expect-error
|
|
@@ -35,7 +35,7 @@ export var StyledNav = styled('nav')(templateObject_5 || (templateObject_5 = __m
|
|
|
35
35
|
export var StyledNavSecondary = styled('nav')(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background-color: ", ";\n display: flex;\n flex: 1 auto;\n flex-direction: column;\n justify-content: flex-end;\n margin-top: auto;\n overflow: hidden;\n"], ["\n background-color: ", ";\n display: flex;\n flex: 1 auto;\n flex-direction: column;\n justify-content: flex-end;\n margin-top: auto;\n overflow: hidden;\n"])), function (props) { return getNavigationBackground(props.theme); });
|
|
36
36
|
export var StyledDivider = styled('div', {
|
|
37
37
|
shouldForwardProp: function (prop) { return prop !== 'isDrawerOpen'; }
|
|
38
|
-
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n background-color: ", ";\n\n :before {\n background-color: ", ";\n border-radius: 55px;\n content: \"\";\n display: block;\n height: 2px;\n margin: auto;\n transition: all ", "ms ", ";\n width: 66%;\n }\n"], ["\n background-color: ", ";\n\n :before {\n background-color: ", ";\n border-radius: 55px;\n content: \"\";\n display: block;\n height: 2px;\n margin: auto;\n transition: all ", "ms ", ";\n width: 66%;\n }\n"])), function (props) { return getNavigationBackground(props.theme); }, function (props) { return getOffsetNavigationBackground(props.theme, 0.
|
|
38
|
+
})(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n background-color: ", ";\n\n :before {\n background-color: ", ";\n border-radius: 55px;\n content: \"\";\n display: block;\n height: 2px;\n margin: auto;\n transition: all ", "ms ", ";\n width: 66%;\n }\n"], ["\n background-color: ", ";\n\n :before {\n background-color: ", ";\n border-radius: 55px;\n content: \"\";\n display: block;\n height: 2px;\n margin: auto;\n transition: all ", "ms ", ";\n width: 66%;\n }\n"])), function (props) { return getNavigationBackground(props.theme); }, function (props) { return getOffsetNavigationBackground(props.theme, 0.05); }, function (props) { return props.theme.transitions.duration.enteringScreen; }, function (props) { return props.theme.transitions.easing.easeOut; });
|
|
39
39
|
export var DrawerShadow = styled(Box, {
|
|
40
40
|
shouldForwardProp: function (prop) { return prop !== 'isDrawerOpen'; }
|
|
41
41
|
})(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n background: rgba(0, 0, 0, 0.125);\n content: \"\";\n display: block;\n filter: blur(13px);\n height: 100%;\n left: ", ";\n right: ", ";\n position: fixed;\n top: 0;\n transition-duration: ", "ms;\n transition-property: left right;\n transition-timing-function: ", ";\n visibility: visible;\n width: 40px;\n\n @media (min-width: ", ") {\n left: ", ";\n right: ", ";\n }\n"], ["\n background: rgba(0, 0, 0, 0.125);\n content: \"\";\n display: block;\n filter: blur(13px);\n height: 100%;\n left: ", ";\n right: ", ";\n position: fixed;\n top: 0;\n transition-duration: ", "ms;\n transition-property: left right;\n transition-timing-function: ", ";\n visibility: visible;\n width: 40px;\n\n @media (min-width: ", ") {\n left: ", ";\n right: ", ";\n }\n"])), function (props) { return props.theme.direction === 'ltr'
|
|
@@ -53,5 +53,5 @@ export var NotchBackgroundClip = styled(Box)(templateObject_11 || (templateObjec
|
|
|
53
53
|
export var NotchSeemMask = styled(Box)(templateObject_12 || (templateObject_12 = __makeTemplateObject(["\n background-color: ", ";\n height: 90px;\n position: absolute;\n left: ", ";\n right: ", ";\n top: -2px;\n width: calc(100% - ", "px);\n"], ["\n background-color: ", ";\n height: 90px;\n position: absolute;\n left: ", ";\n right: ", ";\n top: -2px;\n width: calc(100% - ", "px);\n"])), function (props) { return getNavigationBackground(props.theme); }, function (props) { return props.theme.direction === 'rtl' ? "".concat(NOTCH.Width, "px") : 'auto'; }, function (props) { return props.theme.direction === 'ltr' ? "".concat(NOTCH.Width, "px") : 'auto'; }, NOTCH.Width);
|
|
54
54
|
export var StyledDrawer = styled(Drawer, {
|
|
55
55
|
shouldForwardProp: function (prop) { return prop !== 'open'; }
|
|
56
|
-
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width ", "ms ", ";\n white-space: nowrap;\n width: ", ";\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n left: ", ";\n right: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width ", "ms ", ";\n visibility: visible !important;\n width: ", ";\n }\n"], ["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width ", "ms ", ";\n white-space: nowrap;\n width: ", ";\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n left: ", ";\n right: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width ", "ms ", ";\n visibility: visible !important;\n width: ", ";\n }\n"])), function (props) { return props.theme.transitions.duration.enteringScreen; }, function (props) { return props.theme.transitions.easing.easeOut; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) { return getNavigationContrastText(props.theme); }, function (props) { return (props.theme.direction === 'ltr' ? 0 : 'auto'); }, function (props) { return (props.theme.direction === 'rtl' ? 0 : 'auto'); }, function (props) { return props.theme.transitions.duration.enteringScreen; }, function (props) { return props.theme.transitions.easing.easeOut; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); });
|
|
56
|
+
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width ", "ms ", ";\n white-space: nowrap;\n width: ", ";\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n left: ", ";\n right: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width ", "ms ", ";\n visibility: visible !important;\n width: ", ";\n }\n\n .MuiTypography-root {\n color: inherit;\n }\n"], ["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width ", "ms ", ";\n white-space: nowrap;\n width: ", ";\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n left: ", ";\n right: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width ", "ms ", ";\n visibility: visible !important;\n width: ", ";\n }\n\n .MuiTypography-root {\n color: inherit;\n }\n"])), function (props) { return props.theme.transitions.duration.enteringScreen; }, function (props) { return props.theme.transitions.easing.easeOut; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) { return getNavigationContrastText(props.theme); }, function (props) { return (props.theme.direction === 'ltr' ? 0 : 'auto'); }, function (props) { return (props.theme.direction === 'rtl' ? 0 : 'auto'); }, function (props) { return props.theme.transitions.duration.enteringScreen; }, function (props) { return props.theme.transitions.easing.easeOut; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); });
|
|
57
57
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13;
|
package/lang/en-us.d.ts
CHANGED
package/lang/en-us.js
CHANGED
|
@@ -22,5 +22,8 @@ export var defaultMessages = {
|
|
|
22
22
|
greeting: 'Hi',
|
|
23
23
|
logout: 'Logout',
|
|
24
24
|
'view-profile': 'View Profile',
|
|
25
|
-
'edit-profile': 'Edit Profile'
|
|
25
|
+
'edit-profile': 'Edit Profile',
|
|
26
|
+
'help-center': 'Help Centre',
|
|
27
|
+
'feature-request': 'Feature Request',
|
|
28
|
+
'contact-us': 'Contact Us'
|
|
26
29
|
};
|
package/package.json
CHANGED
|
@@ -33,6 +33,8 @@ export interface IVerticalNavigationProps {
|
|
|
33
33
|
isPersistent?: boolean;
|
|
34
34
|
setIsPersistent?: any;
|
|
35
35
|
appRootID?: string;
|
|
36
|
+
localization?: any;
|
|
37
|
+
dataAttributes?: any;
|
|
36
38
|
hasAvatar?: boolean;
|
|
37
39
|
avatarPanelLogoutString?: string;
|
|
38
40
|
avatarPanelOnClickSwitchDirection?: any;
|
|
@@ -46,4 +48,5 @@ export interface IVerticalNavigationProps {
|
|
|
46
48
|
avatarPanelMainActionString?: string;
|
|
47
49
|
avatarPanelSettingItems?: Array<IAvatarMenuItemProps>;
|
|
48
50
|
avatarPanelFootnote?: any;
|
|
51
|
+
avatarPanelShowHelpLinks?: boolean;
|
|
49
52
|
}
|