@learningpool/ui 1.15.5 → 1.16.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/assets/Images.js +7 -18
- package/components/atoms/Autocomplete/Autocomplete.js +3 -14
- package/components/atoms/Button/Button.js +2 -13
- package/components/atoms/Checkbox/Checkbox.js +3 -26
- package/components/atoms/IconButton/IconButton.js +2 -13
- package/components/atoms/Radio/Radio.js +3 -26
- package/components/atoms/Select/Select.js +3 -26
- package/components/atoms/Slider/Slider.js +3 -26
- package/components/atoms/Switch/Switch.js +3 -26
- package/components/atoms/TextField/TextField.js +2 -13
- package/components/atoms/ToggleButton/ToggleButton.js +3 -26
- package/components/datadisplay/Avatar/Avatar.js +13 -28
- package/components/datadisplay/Chip/Chip.js +3 -26
- package/components/datadisplay/List/List.js +2 -13
- package/components/feedback/Alert/Alert.js +3 -26
- package/components/landmarks/Header/Header.js +15 -41
- package/components/landmarks/Header/HeaderActionButtons.d.ts +1 -2
- package/components/landmarks/Header/HeaderActionButtons.js +22 -33
- package/components/landmarks/Header/HeaderStyles.js +54 -11
- package/components/navigation/Drawer/Drawer.js +5 -31
- package/components/navigation/MobileNavigation/MobileNavigation.js +70 -82
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +75 -83
- package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +102 -52
- package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +71 -13
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +1 -1
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +41 -68
- package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +34 -18
- package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +133 -20
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +22 -45
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +8 -19
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +151 -52
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +171 -50
- package/components/navigation/MobileNavigation/MobileNavigationMotion.js +11 -11
- package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +11 -15
- package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +1 -2
- package/components/navigation/MobileNavigation/MobileNavigationSearch.js +25 -34
- package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +34 -18
- package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.js +47 -9
- package/components/navigation/MobileNavigation/MobileNavigationStyles.js +262 -66
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +21 -20
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +21 -20
- package/components/navigation/VerticalNavigation/VerticalNavigation.js +150 -185
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +50 -61
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.d.ts +102 -52
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.js +86 -14
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +27 -51
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +15 -28
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.js +135 -39
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.js +167 -29
- package/components/navigation/VerticalNavigation/VerticalNavigationMotion.js +11 -11
- package/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +34 -18
- package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +236 -42
- package/components/navigation/helpers.d.ts +1 -2
- package/components/navigation/helpers.js +28 -32
- package/components/pages/ErrorPage/ErrorPage.js +6 -17
- package/components/pages/ErrorPage/ErrorPageStyles.js +13 -18
- package/components/pages/SideInSide/SideInSide.js +12 -23
- package/components/pages/SideInSide/SideInSideStyles.js +6 -6
- package/components/stream/AppHub/AppHub.js +13 -42
- package/components/stream/AppHub/AppHubAdvertStyles.js +24 -8
- package/components/stream/AppHub/AppHubBannerAdvert.d.ts +1 -2
- package/components/stream/AppHub/AppHubBannerAdvert.js +9 -20
- package/components/stream/AppHub/AppHubCustom.js +8 -19
- package/components/stream/AppHub/AppHubCustomStyles.d.ts +1 -1
- package/components/stream/AppHub/AppHubCustomStyles.js +78 -18
- package/components/stream/AppHub/AppHubProduct.js +26 -48
- package/components/stream/AppHub/AppHubProductStyles.js +104 -19
- package/components/stream/AppHub/AppHubStyles.js +31 -11
- package/components/stream/AppHub/constants.d.ts +1 -2
- package/components/stream/AppHub/constants.js +14 -14
- package/components/stream/AppSwitcher/AppSwitcher.js +225 -316
- package/components/stream/AppSwitcher/AppSwitcherItem.js +11 -22
- package/components/stream/AppSwitcher/AppSwitcherStyles.js +337 -42
- package/components/stream/AppSwitcher/AppSwitcherStylesStandalone.js +255 -21
- package/components/stream/AppSwitcher/PromotionalCampaignItem.js +7 -19
- package/components/stream/AppSwitcher/constants.js +3 -3
- package/lang/en-us.js +1 -1
- package/package.json +7 -2
- package/utils/constants.d.ts +7 -0
- package/utils/constants.js +11 -4
- package/utils/dataAttributes.js +1 -1
- package/utils/helpers.js +33 -40
- package/utils/hooks.js +10 -11
- package/utils/theme.js +26 -19
|
@@ -1,24 +1,4 @@
|
|
|
1
|
-
|
|
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, ButtonGroup, Button, Link, List, ListItem, ListItemIcon, ListItemText } from '../../../index';
|
|
24
4
|
import { StyledSwipeableAvatar, StyledBox, StyledBoxProfile, StyledAvatarName, StyledAvatar, StyledOutlineButton, StyledBoxProfileEdit, StyledListItemButton } from './MobileNavigationAvatarStyles';
|
|
@@ -31,31 +11,29 @@ import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
|
|
|
31
11
|
import { animated } from '@react-spring/web';
|
|
32
12
|
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
33
13
|
import { defaultMessages } from '../../../lang/en-us';
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
React.useEffect(
|
|
42
|
-
|
|
14
|
+
import { EVENT_KEYS } from '../../../utils/constants';
|
|
15
|
+
const SwipeableTemporaryAvatar = (props) => {
|
|
16
|
+
const theme = useTheme();
|
|
17
|
+
const { avatarName, mobileNavDirection, avatarPanelLogoutString, isAvatarOpen, setIsAvatarOpen, setMobileNavDirection, avatarPanelOnClickSwitchDirection, avatarPanelOnClickLogout, avatarPanelOnClickViewProfile, avatarPanelViewProfileString, avatarPanelOnClickEditProfile, avatarPanelEditProfileString, avatarPanelMenuItems, avatarPanelOnClickMainAction, avatarPanelMainActionString, avatarPanelSettingItems, avatarPanelInvertNavString, dataAttributes, localization } = props;
|
|
18
|
+
const messages = { ...defaultMessages, ...localization };
|
|
19
|
+
const dataIds = { ...defaultAttributes, ...dataAttributes };
|
|
20
|
+
const [isOpen, setIsOpen] = React.useState(isAvatarOpen ?? false);
|
|
21
|
+
React.useEffect(() => handleOpenState(isAvatarOpen), [isAvatarOpen]);
|
|
22
|
+
const handleOpenState = (open) => {
|
|
43
23
|
setIsOpen(open);
|
|
44
24
|
setIsAvatarOpen(open);
|
|
45
25
|
};
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
handleOpenState(open);
|
|
54
|
-
};
|
|
26
|
+
const toggleAvatar = (open) => (event) => {
|
|
27
|
+
if (event && event.type === EVENT_KEYS.Keydown &&
|
|
28
|
+
(event.key === EVENT_KEYS.Tab ||
|
|
29
|
+
event.key === EVENT_KEYS.Shift)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
handleOpenState(open);
|
|
55
33
|
};
|
|
56
|
-
|
|
57
|
-
useEffect(
|
|
58
|
-
|
|
34
|
+
const [avatarInitials, setAvatarInitials] = React.useState(handleAvatarInitials(avatarName) ?? 'AN');
|
|
35
|
+
useEffect(() => setAvatarInitials(handleAvatarInitials(avatarName)), [avatarName]);
|
|
36
|
+
const handleOnClickSwitchDirection = () => {
|
|
59
37
|
setMobileNavDirection(mobileNavDirection === 'rtl' ? 'ltr' : 'rtl');
|
|
60
38
|
avatarPanelOnClickSwitchDirection && avatarPanelOnClickSwitchDirection();
|
|
61
39
|
};
|
|
@@ -66,86 +44,100 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
66
44
|
// this way the number of hook calls never changes
|
|
67
45
|
// --
|
|
68
46
|
// First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
|
|
69
|
-
|
|
47
|
+
const additionalItems = [
|
|
70
48
|
'avatarPanelOnClickLogout',
|
|
71
49
|
'avatarName',
|
|
72
50
|
'avatarPanelOnClickViewProfile',
|
|
73
51
|
'avatarPanelOnClickMainAction',
|
|
74
52
|
'mobileNavDirection'
|
|
75
53
|
];
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
const totalItems = [
|
|
55
|
+
...avatarPanelMenuItems ?? [],
|
|
56
|
+
...avatarPanelSettingItems ?? [],
|
|
57
|
+
...additionalItems
|
|
58
|
+
];
|
|
59
|
+
const animationRefs = React.useRef(totalItems && totalItems.map((item, index) => useFadeIn(index, !isAvatarOpen)));
|
|
60
|
+
return (_jsx(StyledSwipeableAvatar, { "data-id": dataIds.MobileNavAvatarPanel, anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
|
|
79
61
|
keepMounted: true
|
|
80
|
-
}
|
|
81
|
-
// @ts-
|
|
82
|
-
,
|
|
83
|
-
// @ts-
|
|
84
|
-
component: animated.button, style:
|
|
62
|
+
}, children: _jsxs(StyledBox, { children: [avatarPanelOnClickLogout && (_jsx(Button
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
, {
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
component: animated.button, style: {
|
|
67
|
+
left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto',
|
|
68
|
+
position: 'absolute',
|
|
69
|
+
right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1),
|
|
70
|
+
top: theme.spacing(1),
|
|
71
|
+
...animationRefs.current[0]
|
|
72
|
+
}, onClick: () => {
|
|
85
73
|
handleOpenState(false);
|
|
86
74
|
avatarPanelOnClickLogout();
|
|
87
|
-
}, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit'
|
|
75
|
+
}, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit', children: avatarPanelLogoutString ?? 'Logout' })), _jsxs(Box, { "data-id": dataIds.MobileNavAvatarProfile, style: {
|
|
88
76
|
alignItems: 'center',
|
|
89
77
|
display: 'flex',
|
|
90
78
|
flexDirection: 'column'
|
|
91
|
-
}
|
|
79
|
+
}, children: [_jsxs(StyledBoxProfile, { style: animationRefs.current[1], children: [_jsx(StyledAvatar, { style: { marginRight: '0.5rem' }, children: avatarInitials }), _jsxs(StyledAvatarName, { children: [_jsx("span", { style: { fontWeight: 300 }, children: "Hi," }), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })] }), avatarPanelOnClickViewProfile && (_jsx(StyledBoxProfileEdit, { style: {
|
|
80
|
+
flexDirection: 'row',
|
|
81
|
+
marginBottom: theme.spacing(1),
|
|
82
|
+
...animationRefs.current[2]
|
|
83
|
+
}, children: _jsxs(ButtonGroup, { variant: 'outlined', "aria-label": "split button", children: [_jsx(StyledOutlineButton, { variant: 'outlined', color: 'inherit', size: 'medium', onClick: () => {
|
|
92
84
|
handleOpenState(false);
|
|
93
85
|
avatarPanelOnClickViewProfile();
|
|
94
|
-
}
|
|
86
|
+
}, children: avatarPanelViewProfileString ?? 'View Profile' }), avatarPanelOnClickEditProfile && (_jsx(StyledOutlineButton, { size: 'medium', variant: 'outlined', color: 'inherit', "aria-label": avatarPanelEditProfileString ?? 'Edit Profile', onClick: () => {
|
|
95
87
|
handleOpenState(false);
|
|
96
88
|
avatarPanelOnClickEditProfile();
|
|
97
|
-
}
|
|
89
|
+
}, children: _jsx(EditIcon, {}) }))] }) }))] }), _jsxs(Box, { style: {
|
|
98
90
|
alignItems: 'center',
|
|
99
91
|
display: 'flex',
|
|
100
92
|
flexDirection: 'column'
|
|
101
|
-
}
|
|
93
|
+
}, children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, { style: {
|
|
102
94
|
marginInlineStart: '3rem',
|
|
103
95
|
marginBottom: theme.spacing(2),
|
|
104
96
|
maxWidth: '18rem'
|
|
105
|
-
}
|
|
97
|
+
}, children: avatarPanelMenuItems.map((avatarMenuItem, index) => (_jsx(ListItem, { component: animated.div, style: animationRefs.current[index + 2], disablePadding: true, children: _jsxs(StyledListItemButton
|
|
106
98
|
// TODO: figure out if these are links or buttons
|
|
107
99
|
// @ts-expect-error
|
|
108
|
-
,
|
|
100
|
+
, {
|
|
109
101
|
// TODO: figure out if these are links or buttons
|
|
110
102
|
// @ts-expect-error
|
|
111
|
-
component: Link, role: 'link', onClick:
|
|
103
|
+
component: Link, role: 'link', onClick: () => {
|
|
112
104
|
handleOpenState(false);
|
|
113
105
|
avatarMenuItem.onClick();
|
|
114
|
-
}
|
|
106
|
+
}, children: [_jsx(ListItemIcon, { "aria-hidden": true, style: {
|
|
115
107
|
minWidth: theme.spacing(5)
|
|
116
|
-
}
|
|
117
|
-
// @ts-
|
|
118
|
-
,
|
|
119
|
-
// @ts-
|
|
120
|
-
component: animated.button, style: animationRefs.current[(
|
|
108
|
+
}, children: avatarMenuItem.icon }), _jsx(ListItemText, { primary: avatarMenuItem.label })] }) }))) })), avatarPanelOnClickMainAction && _jsx(StyledOutlineButton
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
, {
|
|
111
|
+
// @ts-ignore
|
|
112
|
+
component: animated.button, style: animationRefs.current[(avatarPanelMenuItems?.length ?? 0) + 3], disablePadding: true, variant: 'outlined', color: 'inherit', size: 'medium', onClick: () => {
|
|
121
113
|
handleOpenState(false);
|
|
122
114
|
avatarPanelOnClickMainAction();
|
|
123
|
-
}
|
|
115
|
+
}, children: avatarPanelMainActionString }), _jsxs(List, { style: { marginBottom: theme.spacing(2), marginTop: theme.spacing(2) }, children: [avatarPanelSettingItems &&
|
|
124
116
|
avatarPanelSettingItems.length > 0 &&
|
|
125
|
-
avatarPanelSettingItems.map(
|
|
126
|
-
|
|
127
|
-
|
|
117
|
+
avatarPanelSettingItems.map((avatarMenuItem, index) => (_jsx(ListItem, { component: animated.div, style: animationRefs.current[(avatarPanelMenuItems?.length ?? 0) + index + 3], disablePadding: true, children: _jsxs(StyledListItemButton
|
|
118
|
+
// TODO: figure out if these are links or buttons
|
|
119
|
+
// @ts-expect-error
|
|
120
|
+
, {
|
|
128
121
|
// TODO: figure out if these are links or buttons
|
|
129
122
|
// @ts-expect-error
|
|
130
|
-
,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
avatarMenuItem.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}), avatarPanelOnClickSwitchDirection && (_jsx(ListItem, __assign({ component: animated.div, style: __assign({ marginTop: 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) + 4]), disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
123
|
+
component: Link, role: 'link', onClick: () => {
|
|
124
|
+
handleOpenState(false);
|
|
125
|
+
avatarMenuItem.onClick();
|
|
126
|
+
}, children: [_jsx(ListItemIcon, { "aria-hidden": true, style: {
|
|
127
|
+
minWidth: theme.spacing(5)
|
|
128
|
+
}, children: avatarMenuItem.icon }), _jsx(ListItemText, { primary: avatarMenuItem.label })] }) }))), avatarPanelOnClickSwitchDirection && (_jsx(ListItem, { component: animated.div, style: {
|
|
129
|
+
marginTop: 0,
|
|
130
|
+
...animationRefs.current[(avatarPanelMenuItems?.length ?? 0) + (avatarPanelSettingItems?.length ?? 0) + 4]
|
|
131
|
+
}, disablePadding: true, children: _jsxs(StyledListItemButton
|
|
140
132
|
// TODO: figure out if these are links or buttons
|
|
141
133
|
// @ts-expect-error
|
|
142
|
-
,
|
|
134
|
+
, {
|
|
143
135
|
// TODO: figure out if these are links or buttons
|
|
144
136
|
// @ts-expect-error
|
|
145
|
-
component: Link, role: 'link', onClick: handleOnClickSwitchDirection
|
|
137
|
+
component: Link, role: 'link', onClick: handleOnClickSwitchDirection, children: [_jsx(ListItemText, { primary: avatarPanelInvertNavString ?? messages['invert-navigation-bar'] }), _jsx(ListItemIcon, { "aria-hidden": true, style: {
|
|
146
138
|
minWidth: theme.spacing(5),
|
|
147
139
|
marginInlineStart: '0.5rem'
|
|
148
|
-
}
|
|
140
|
+
}, children: mobileNavDirection === 'ltr'
|
|
149
141
|
? (_jsx(ToggleOffIcon, { style: {
|
|
150
142
|
boxSizing: 'border-box',
|
|
151
143
|
height: '2em',
|
|
@@ -157,6 +149,6 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
157
149
|
height: '2em',
|
|
158
150
|
padding: '0.15em',
|
|
159
151
|
width: '2em'
|
|
160
|
-
} })) })
|
|
152
|
+
} })) })] }) }))] })] })] }) }));
|
|
161
153
|
};
|
|
162
154
|
export default SwipeableTemporaryAvatar;
|