@learningpool/ui 1.6.0-beta.3 → 1.6.0-beta.5
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 +39 -0
- package/components/navigation/MobileNavigation/MobileNavigation.js +188 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +28 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +124 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +827 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +33 -0
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +24 -0
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +148 -0
- package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +392 -0
- package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +44 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.d.ts +19 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +91 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.d.ts +15 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +26 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.d.ts +112 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +66 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.d.ts +126 -0
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +71 -0
- package/components/navigation/MobileNavigation/MobileNavigationMotion.d.ts +141 -0
- package/components/navigation/MobileNavigation/MobileNavigationMotion.js +109 -0
- package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +10 -0
- package/components/navigation/MobileNavigation/MobileNavigationSearch.js +52 -0
- package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +257 -0
- package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.js +20 -0
- package/components/navigation/MobileNavigation/MobileNavigationStyles.d.ts +405 -0
- package/components/navigation/MobileNavigation/MobileNavigationStyles.js +104 -0
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +2 -0
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +32 -0
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +2 -0
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +26 -0
- package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.d.ts +36 -0
- package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.js +10 -0
- package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +1 -0
- package/components/navigation/VerticalNavigation/VerticalNavigation.js +27 -24
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +1 -1
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +1 -1
- package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +4 -2
- package/utils/constants.d.ts +6 -0
- package/utils/constants.js +6 -0
- package/utils/helpers.d.ts +6 -0
- package/utils/helpers.js +17 -0
- package/utils/hooks.d.ts +1 -0
- package/utils/hooks.js +29 -0
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { motion } from 'framer-motion';
|
|
14
|
+
var Path = function (props) { return (_jsx(motion.path, __assign({ fill: 'transparent', strokeWidth: '3', stroke: 'inherit', strokeLinecap: 'round' }, props))); };
|
|
15
|
+
export var ToggleX = function () {
|
|
16
|
+
return (_jsxs("svg", __assign({ width: "40", height: "40", viewBox: "0 0 50 50" }, { children: [_jsx(Path, { variants: {
|
|
17
|
+
closed: { d: 'M 10 15 L 40 15' },
|
|
18
|
+
open: { d: 'M 15 15 L 35 35' }
|
|
19
|
+
} }), _jsx(Path, { d: 'M 10 25 L 40 25', variants: {
|
|
20
|
+
closed: { opacity: 1, scale: 1 },
|
|
21
|
+
open: { opacity: 0, scale: 0 }
|
|
22
|
+
} }), _jsx(Path, { variants: {
|
|
23
|
+
closed: { d: 'M 10 35 L 40 35' },
|
|
24
|
+
open: { d: 'M 15 35 L 35 15' }
|
|
25
|
+
} })] })));
|
|
26
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledButtonBase: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
4
|
+
centerRipple?: boolean | undefined;
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
disableRipple?: boolean | undefined;
|
|
9
|
+
disableTouchRipple?: boolean | undefined;
|
|
10
|
+
focusRipple?: boolean | undefined;
|
|
11
|
+
focusVisibleClassName?: string | undefined;
|
|
12
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
13
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
14
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
15
|
+
tabIndex?: number | undefined;
|
|
16
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
17
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
18
|
+
} & Omit<{
|
|
19
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
20
|
+
centerRipple?: boolean | undefined;
|
|
21
|
+
children?: import("react").ReactNode;
|
|
22
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
disableRipple?: boolean | undefined;
|
|
25
|
+
disableTouchRipple?: boolean | undefined;
|
|
26
|
+
focusRipple?: boolean | undefined;
|
|
27
|
+
focusVisibleClassName?: string | undefined;
|
|
28
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
29
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
30
|
+
sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
|
|
31
|
+
tabIndex?: number | undefined;
|
|
32
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
33
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
34
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
|
|
35
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
36
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "sx" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { ButtonBase } from '../../../index';
|
|
6
|
+
import { styled } from '@mui/material/styles';
|
|
7
|
+
export var StyledButtonBase = styled(ButtonBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n stroke: ", ";\n padding: 0px;\n min-width: 80px;\n max-width: 168px;\n height: 56px;\n"], ["\n stroke: ", ";\n padding: 0px;\n min-width: 80px;\n max-width: 168px;\n height: 56px;\n"])), function (props) { return props.theme.palette.mode === 'dark'
|
|
8
|
+
? props.theme.palette.primary.contrastText
|
|
9
|
+
: props.theme.palette.text.primary; });
|
|
10
|
+
var templateObject_1;
|
|
@@ -14,6 +14,7 @@ interface VerticalNavigationProps {
|
|
|
14
14
|
isDrawerOpen?: boolean;
|
|
15
15
|
isPersistent?: boolean;
|
|
16
16
|
setIsPersistent?: any;
|
|
17
|
+
appRootID?: string;
|
|
17
18
|
}
|
|
18
19
|
declare const VerticalNavigation: (props: VerticalNavigationProps) => React.ReactElement;
|
|
19
20
|
export default VerticalNavigation;
|
|
@@ -12,7 +12,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import React, { useEffect } from 'react';
|
|
14
14
|
import { useTheme } from '@mui/material/styles';
|
|
15
|
-
import { Avatar,
|
|
15
|
+
import { Avatar, List, Tooltip } from '../../../index';
|
|
16
16
|
import { Box } from '@mui/material';
|
|
17
17
|
import { StreamSuiteLogo, NotchSVG, NotchExtendSVG } from '../../../assets/Images';
|
|
18
18
|
import { AppSwitcher } from '@learningpool/app-switcher';
|
|
@@ -22,10 +22,12 @@ import { DRAWER_WIDTH, DrawerHeader, DrawerToggle, DrawerToggleHitboxContent, St
|
|
|
22
22
|
import { ListItem, ListItemButton, ListItemIcon, ListItemText } from './VerticalNavigationItem/VerticalNavigationItemStyles';
|
|
23
23
|
import AvatarPanel from './AvatarPanel';
|
|
24
24
|
import { motion } from '../../../utils/theme';
|
|
25
|
+
import { handleAvatarInitials } from '../../../utils/helpers';
|
|
26
|
+
import { DEFAULT_REACT_APP_ID } from '../../../utils/constants';
|
|
25
27
|
var VerticalNavigation = function (props) {
|
|
26
28
|
var _a, _b;
|
|
27
29
|
var theme = useTheme();
|
|
28
|
-
var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, hasStreamHome = props.hasStreamHome, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, streamHomeAccessToken = props.streamHomeAccessToken;
|
|
30
|
+
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, streamHomeAccessToken = props.streamHomeAccessToken;
|
|
29
31
|
var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
|
|
30
32
|
var propIsPersistent = typeof (props === null || props === void 0 ? void 0 : props.isPersistent) === 'boolean' ? props.isPersistent : undefined;
|
|
31
33
|
var avatarName = (_a = props === null || props === void 0 ? void 0 : props.avatarName) !== null && _a !== void 0 ? _a : 'Avatar name';
|
|
@@ -36,6 +38,18 @@ var VerticalNavigation = function (props) {
|
|
|
36
38
|
useEffect(function () { return setIsDrawerOpen(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false); }, [propIsDrawerOpen]);
|
|
37
39
|
useEffect(function () { return setIsDrawerOpen(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false); }, [propIsPersistent]);
|
|
38
40
|
useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [avatarName]);
|
|
41
|
+
// This fixes an issue with how MUI handles the modal and aria-hidden.
|
|
42
|
+
// When open, the Modal adds aria-hidden="true" to a top-level element,
|
|
43
|
+
// which causes some screen readers to annouce the elements as "blank".
|
|
44
|
+
// This fix just overrides the default aria-hidden attribute.
|
|
45
|
+
//
|
|
46
|
+
// https://github.com/mui/material-ui/issues/19450
|
|
47
|
+
useEffect(function () {
|
|
48
|
+
if (isDrawerOpen) {
|
|
49
|
+
var root = window.document.getElementById(appRootID !== null && appRootID !== void 0 ? appRootID : DEFAULT_REACT_APP_ID);
|
|
50
|
+
root === null || root === void 0 ? void 0 : root.removeAttribute('aria-hidden');
|
|
51
|
+
}
|
|
52
|
+
}, [isDrawerOpen]);
|
|
39
53
|
var handleIsPersistent = function () {
|
|
40
54
|
var _a, _b;
|
|
41
55
|
if (props === null || props === void 0 ? void 0 : props.setIsPersistent) {
|
|
@@ -45,18 +59,6 @@ var VerticalNavigation = function (props) {
|
|
|
45
59
|
}
|
|
46
60
|
setIsPersistent(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false);
|
|
47
61
|
};
|
|
48
|
-
var handleAvatarInitials = function (avatarName) {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
var firstInitial = avatarName.split('')[0] || '';
|
|
51
|
-
var secondInitial = '';
|
|
52
|
-
if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
|
|
53
|
-
firstInitial = avatarName.split(' ')[0][0];
|
|
54
|
-
if (((_b = avatarName.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
55
|
-
secondInitial = avatarName === null || avatarName === void 0 ? void 0 : avatarName.split(' ')[1][0];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
return "".concat(firstInitial).concat(secondInitial);
|
|
59
|
-
};
|
|
60
62
|
var _e = React.useState((_b = handleAvatarInitials(avatarName)) !== null && _b !== void 0 ? _b : 'AN'), avatarInitials = _e[0], setAvatarInitials = _e[1];
|
|
61
63
|
var toggleDrawer = function (open) { return function (event) {
|
|
62
64
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
@@ -99,7 +101,7 @@ var VerticalNavigation = function (props) {
|
|
|
99
101
|
fill: theme.palette.mode === 'dark'
|
|
100
102
|
? theme.palette.primary.contrastText
|
|
101
103
|
: theme.palette.primary.main
|
|
102
|
-
} })) })), _jsx(ListItemText, { primary: logoText !== null && logoText !== void 0 ? logoText : '', isDrawerOpen: isDrawerOpen || isPersistent })] })) })), _jsxs("div", __assign({ className: 'wrapper' }, { 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 ? 'Close Navigation
|
|
104
|
+
} })) })), _jsx(ListItemText, { primary: logoText !== null && logoText !== void 0 ? logoText : '', isDrawerOpen: isDrawerOpen || isPersistent })] })) })), _jsxs("div", __assign({ className: 'wrapper' }, { 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 ? 'Close Navigation' : 'Open Navigation', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation" }, { children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
|
|
103
105
|
? (_jsx(ChevronLeft, { style: {
|
|
104
106
|
fontSize: '1.75rem',
|
|
105
107
|
height: '1.75rem',
|
|
@@ -120,7 +122,7 @@ var VerticalNavigation = function (props) {
|
|
|
120
122
|
top: '50%',
|
|
121
123
|
transform: 'translate(50%, -50%)',
|
|
122
124
|
width: '50px'
|
|
123
|
-
} }), _jsxs(DrawerToggle, __assign({ onClick: handleIsPersistent, "aria-label": isDrawerOpen ? 'Close Navigation
|
|
125
|
+
} }), _jsxs(DrawerToggle, __assign({ onClick: handleIsPersistent, "aria-label": isDrawerOpen ? 'Close Navigation' : 'Open Navigation', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", style: {
|
|
124
126
|
display: 'none',
|
|
125
127
|
position: 'fixed',
|
|
126
128
|
top: '50%',
|
|
@@ -171,7 +173,7 @@ var VerticalNavigation = function (props) {
|
|
|
171
173
|
backgroundColor: theme.palette.mode === 'dark'
|
|
172
174
|
? theme.palette.primary.main
|
|
173
175
|
: theme.palette.background.paper
|
|
174
|
-
} }, { children: _jsxs(StyledNavSecondary, __assign({ "aria-label": 'Secondary
|
|
176
|
+
} }, { children: _jsxs(StyledNavSecondary, __assign({ "aria-label": 'Secondary' }, { children: [_jsx(StyledDivider, { isDrawerOpen: isDrawerOpen || isPersistent }), _jsxs(List, __assign({ style: {
|
|
175
177
|
width: DRAWER_WIDTH.Expanded,
|
|
176
178
|
backgroundColor: theme.palette.mode === 'dark'
|
|
177
179
|
? theme.palette.primary.main
|
|
@@ -186,7 +188,7 @@ var VerticalNavigation = function (props) {
|
|
|
186
188
|
justifyContent: 'center'
|
|
187
189
|
} }, { children: _jsx(AppSwitcher, { apiKey: streamHomeApiKey !== null && streamHomeApiKey !== void 0 ? streamHomeApiKey : '', baseUrl: streamHomeBaseUrl !== null && streamHomeBaseUrl !== void 0 ? streamHomeBaseUrl : '', token: streamHomeAccessToken !== null && streamHomeAccessToken !== void 0 ? streamHomeAccessToken : '' }) })) })), _jsx(ListItemText, { primary: 'App switcher', isDrawerOpen: isDrawerOpen || isPersistent })] })) })))
|
|
188
190
|
: null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_jsx(VerticalNavigationItem, __assign({}, item, { index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true }))); }), avatarName
|
|
189
|
-
? (_jsx(VerticalNavigationItem, { label: avatarName, icon: _jsx(Avatar, __assign({ style: {
|
|
191
|
+
? (_jsx(VerticalNavigationItem, { label: avatarName, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, __assign({ style: {
|
|
190
192
|
// backgroundColor: mainTheme.colorButtonText,
|
|
191
193
|
// color: mainTheme.colorButton,
|
|
192
194
|
fontSize: '0.75rem',
|
|
@@ -200,12 +202,13 @@ var VerticalNavigation = function (props) {
|
|
|
200
202
|
transition: "max-height 225ms ".concat(motion.easeInOut, " 0ms !important")
|
|
201
203
|
}, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, { avatarName: avatarName }), isDrawerOpen: isDrawerOpen }))
|
|
202
204
|
: null] }))] })) }))] }))); };
|
|
203
|
-
return (_jsxs(StyledAside, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
|
|
205
|
+
return (_jsxs(StyledAside, __assign({ "aria-label": "Site navigation" }, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
|
|
204
206
|
display: isPersistent ? 'none' : 'block'
|
|
205
|
-
} }), _jsx(
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
} }), _jsx(StyledDrawer, __assign({ id: 'vertical-navigation', anchor: 'left', open: isDrawerOpen || isPersistent, onClose: toggleDrawer(false), variant: isDrawerOpen ? 'temporary' : 'permanent', ModalProps: {
|
|
208
|
+
keepMounted: true,
|
|
209
|
+
disablePortal: true,
|
|
210
|
+
open: isDrawerOpen,
|
|
211
|
+
onClose: toggleDrawer(false)
|
|
212
|
+
} }, { children: listContent() }))] })));
|
|
210
213
|
};
|
|
211
214
|
export default VerticalNavigation;
|
package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js
CHANGED
|
@@ -71,7 +71,7 @@ var VerticalNavigationItem = function (props) {
|
|
|
71
71
|
? null
|
|
72
72
|
: handlePopoverOpen(event); }, onBlur: function () { return fullHeightFlyout
|
|
73
73
|
? null
|
|
74
|
-
: handlePopoverClose(); }, "aria-expanded": (children && children.length > 0)
|
|
74
|
+
: handlePopoverClose(); }, "aria-expanded": (children && children.length > 0) || fullHeightFlyout ? open : null, "aria-current": isActive ? 'page' : null, role: (children && children.length > 0) || fullHeightFlyout ? '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, sx: {
|
|
75
75
|
'& .MuiTypography-root': {
|
|
76
76
|
fontSize: isSecondary ? '14px' : 'inherit'
|
|
77
77
|
}
|
|
@@ -18,7 +18,7 @@ var VerticalNavigationItemFlyoutMenu = function (props) {
|
|
|
18
18
|
var _a = React.useState(false), flyoutHovered = _a[0], setFlyoutHovered = _a[1];
|
|
19
19
|
var open = flyoutHovered || (props === null || props === void 0 ? void 0 : props.open);
|
|
20
20
|
if (fullHeightFlyout && content) {
|
|
21
|
-
return (_jsx(FullHeightFlyoutMenuPaper, __assign({ isDrawerOpen: isDrawerOpen, open: open }, { children: _jsxs(FullHeightFlyoutMenuWrapper, __assign({ open: open }, { children: [_jsx(FlyoutNotchMask, {}), _jsx(NotchMini, { tabIndex: -1, style: { bottom: '24px' } }), content] })) })));
|
|
21
|
+
return (_jsx(FullHeightFlyoutMenuPaper, __assign({ isDrawerOpen: isDrawerOpen, open: open, id: "avatar-panel" }, { children: _jsxs(FullHeightFlyoutMenuWrapper, __assign({ open: open }, { children: [_jsx(FlyoutNotchMask, {}), _jsx(NotchMini, { tabIndex: -1, style: { bottom: '24px' } }), content] })) })));
|
|
22
22
|
}
|
|
23
23
|
return (_jsx(FlyoutMenuPaper, __assign({ isDrawerOpen: isDrawerOpen, open: open, anchorEl: anchorEl !== null && anchorEl !== void 0 ? anchorEl : undefined, onMouseEnter: function () { return setFlyoutHovered(true); }, onMouseLeave: function () { return setFlyoutHovered(false); }, onFocus: function () { return setFlyoutHovered(true); }, onBlur: function () { return setFlyoutHovered(false); } }, { children: _jsxs(FlyoutMenuWrap, __assign({ open: open }, { children: [_jsx(NotchMini, { style: { top: '12px' } }), _jsx(FlyoutMenuHeader, { children: label }), _jsx(FlyoutMenuList, __assign({ "aria-label": label, open: open }, { children: children === null || children === void 0 ? void 0 : children.map(function (childItem) { return (_jsx(FlyoutMenuItem, { children: _jsx(FlyoutMenuButton
|
|
24
24
|
// @ts-expect-error
|
|
@@ -80,7 +80,7 @@ export var NotchSeemMask = styled(Box)(templateObject_12 || (templateObject_12 =
|
|
|
80
80
|
: props.theme.palette.background.paper; });
|
|
81
81
|
export var StyledDrawer = styled(Drawer, {
|
|
82
82
|
shouldForwardProp: function (prop) { return prop !== 'open'; }
|
|
83
|
-
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible;\n width: ", ";\n
|
|
83
|
+
})(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible !important;\n width: ", ";\n [theme.breakpoints.up('sm')] {\n width: ", ";\n }\n }\n"], ["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible !important;\n width: ", ";\n [theme.breakpoints.up('sm')] {\n width: ", ";\n }\n }\n"])), motion.easeInOut, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) { return props.theme.breakpoints.values.sm; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(8), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) {
|
|
84
84
|
return props.theme.palette.mode === 'dark'
|
|
85
85
|
? props.theme.palette.primary.contrastText
|
|
86
86
|
: props.theme.palette.getContrastText(props.theme.palette.background.paper);
|
package/index.d.ts
CHANGED
|
@@ -128,4 +128,5 @@ export { default as List } from './components/datadisplay/List/List';
|
|
|
128
128
|
export { default as Tooltip } from './components/datadisplay/Tooltip/Tooltip';
|
|
129
129
|
export { default as SideInSide } from './components/pages/SideInSide/SideInSide';
|
|
130
130
|
export { default as ErrorPage } from './components/pages/ErrorPage/ErrorPage';
|
|
131
|
+
export { default as MobileNavigation } from './components/navigation/MobileNavigation/MobileNavigation';
|
|
131
132
|
export { default as VerticalNavigation } from './components/navigation/VerticalNavigation/VerticalNavigation';
|
package/index.js
CHANGED
|
@@ -140,4 +140,5 @@ export { default as Tooltip } from './components/datadisplay/Tooltip/Tooltip';
|
|
|
140
140
|
export { default as SideInSide } from './components/pages/SideInSide/SideInSide';
|
|
141
141
|
export { default as ErrorPage } from './components/pages/ErrorPage/ErrorPage';
|
|
142
142
|
// Stream Suite components
|
|
143
|
+
export { default as MobileNavigation } from './components/navigation/MobileNavigation/MobileNavigation';
|
|
143
144
|
export { default as VerticalNavigation } from './components/navigation/VerticalNavigation/VerticalNavigation';
|
package/package.json
CHANGED
|
@@ -9,14 +9,15 @@
|
|
|
9
9
|
"components",
|
|
10
10
|
"ui"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.6.0-beta.
|
|
12
|
+
"version": "1.6.0-beta.5",
|
|
13
13
|
"private": false,
|
|
14
14
|
"main": "index.js",
|
|
15
15
|
"module": "index.js",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@emotion/react": "^11.7.1",
|
|
18
18
|
"@emotion/styled": "^11.6.0",
|
|
19
|
-
"@learningpool/
|
|
19
|
+
"@learningpool/design-tokens": "^1.1.0-beta.7",
|
|
20
|
+
"@learningpool/app-switcher": "1.1.0-beta.4",
|
|
20
21
|
"@mui/icons-material": "^5.8.4",
|
|
21
22
|
"@mui/material": "^5.8.5",
|
|
22
23
|
"@mui/x-data-grid": "^5.12.3",
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
"anysort": "^2.0.0",
|
|
29
30
|
"eslint-plugin-n": "^15.2.4",
|
|
30
31
|
"focus-trap-react": "^8.11.0",
|
|
32
|
+
"framer-motion": "^6.5.1",
|
|
31
33
|
"tss-react": "^3.3.6",
|
|
32
34
|
"typescript": "^4.6.2",
|
|
33
35
|
"web-vitals": "^2.1.4"
|
package/utils/helpers.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Accepts a string and returns 2 characters (max) as initials e.g. AN from Avatar Name
|
|
3
|
+
* @param avatarName string - Expected full name but accepts any string
|
|
4
|
+
* @returns string
|
|
5
|
+
*/
|
|
6
|
+
export var handleAvatarInitials = function (avatarName) {
|
|
7
|
+
var _a, _b;
|
|
8
|
+
var firstInitial = avatarName.split('')[0] || '';
|
|
9
|
+
var secondInitial = '';
|
|
10
|
+
if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
|
|
11
|
+
firstInitial = avatarName.split(' ')[0][0];
|
|
12
|
+
if (((_b = avatarName.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
13
|
+
secondInitial = avatarName === null || avatarName === void 0 ? void 0 : avatarName.split(' ')[1][0];
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return "".concat(firstInitial).concat(secondInitial);
|
|
17
|
+
};
|
package/utils/hooks.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useCurrentWidth: () => number;
|
package/utils/hooks.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
var getWidth = function () {
|
|
3
|
+
var _a, _b;
|
|
4
|
+
return (_b = (_a = window.innerWidth) !== null && _a !== void 0 ? _a : document.documentElement.clientWidth) !== null && _b !== void 0 ? _b : document.body.clientWidth;
|
|
5
|
+
};
|
|
6
|
+
export var useCurrentWidth = function () {
|
|
7
|
+
// save current window width in the state object
|
|
8
|
+
var _a = useState(getWidth()), width = _a[0], setWidth = _a[1];
|
|
9
|
+
// in this case useEffect will execute only once because
|
|
10
|
+
// it does not have any dependencies.
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
// timeoutId for debounce mechanism
|
|
13
|
+
var timeoutId;
|
|
14
|
+
var resizeListener = function () {
|
|
15
|
+
// prevent execution of previous setTimeout
|
|
16
|
+
clearTimeout(timeoutId);
|
|
17
|
+
// change width from the state object after 150 milliseconds
|
|
18
|
+
timeoutId = setTimeout(function () { return setWidth(getWidth()); }, 150);
|
|
19
|
+
};
|
|
20
|
+
// set resize listener
|
|
21
|
+
window.addEventListener('resize', resizeListener);
|
|
22
|
+
// clean up function
|
|
23
|
+
return function () {
|
|
24
|
+
// remove resize listener
|
|
25
|
+
window.removeEventListener('resize', resizeListener);
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return width;
|
|
29
|
+
};
|