@learningpool/ui 1.6.0-beta.2 → 1.6.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/assets/Images.d.ts +9 -0
  2. package/assets/Images.js +4 -1
  3. package/components/navigation/MobileNavigation/MobileNavigation.d.ts +39 -0
  4. package/components/navigation/MobileNavigation/MobileNavigation.js +188 -0
  5. package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +28 -0
  6. package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +124 -0
  7. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +827 -0
  8. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +33 -0
  9. package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +24 -0
  10. package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +148 -0
  11. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +392 -0
  12. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +44 -0
  13. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.d.ts +19 -0
  14. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +91 -0
  15. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.d.ts +15 -0
  16. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +26 -0
  17. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.d.ts +112 -0
  18. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +66 -0
  19. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.d.ts +126 -0
  20. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +71 -0
  21. package/components/navigation/MobileNavigation/MobileNavigationMotion.d.ts +141 -0
  22. package/components/navigation/MobileNavigation/MobileNavigationMotion.js +109 -0
  23. package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +10 -0
  24. package/components/navigation/MobileNavigation/MobileNavigationSearch.js +52 -0
  25. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +257 -0
  26. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.js +20 -0
  27. package/components/navigation/MobileNavigation/MobileNavigationStyles.d.ts +405 -0
  28. package/components/navigation/MobileNavigation/MobileNavigationStyles.js +104 -0
  29. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +2 -0
  30. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +32 -0
  31. package/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +2 -0
  32. package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +26 -0
  33. package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.d.ts +36 -0
  34. package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.js +10 -0
  35. package/components/navigation/VerticalNavigation/AvatarPanel.d.ts +8 -0
  36. package/components/navigation/VerticalNavigation/AvatarPanel.js +97 -0
  37. package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +8 -10
  38. package/components/navigation/VerticalNavigation/VerticalNavigation.js +156 -93
  39. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.d.ts +18 -0
  40. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +91 -0
  41. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +15 -0
  42. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +29 -0
  43. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.d.ts +112 -0
  44. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.js +66 -0
  45. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.d.ts +126 -0
  46. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.js +71 -0
  47. package/components/navigation/VerticalNavigation/VerticalNavigationStyles.d.ts +31 -90
  48. package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +71 -258
  49. package/index.d.ts +1 -0
  50. package/index.js +1 -0
  51. package/package.json +3 -2
  52. package/utils/constants.d.ts +5 -0
  53. package/utils/constants.js +5 -0
  54. package/utils/helpers.d.ts +6 -0
  55. package/utils/helpers.js +17 -0
  56. package/utils/hooks.d.ts +1 -0
  57. package/utils/hooks.js +29 -0
  58. package/utils/theme.d.ts +4 -0
  59. package/utils/theme.js +4 -0
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ToggleX: () => React.ReactElement;
@@ -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;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface IAvatarPanelProps {
3
+ avatarName: string;
4
+ editProfileText?: string;
5
+ logoutText?: string;
6
+ }
7
+ declare const AvatarPanel: (props: IAvatarPanelProps) => React.ReactElement;
8
+ export default AvatarPanel;
@@ -0,0 +1,97 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __rest = (this && this.__rest) || function (s, e) {
13
+ var t = {};
14
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15
+ t[p] = s[p];
16
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
17
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
18
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
19
+ t[p[i]] = s[p[i]];
20
+ }
21
+ return t;
22
+ };
23
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
+ import React, { useEffect } from 'react';
25
+ import { Avatar, Box, Typography, IconButton, Button, Link, List, ListItem, ListItemButton, ListItemIcon, ListItemText, Tooltip } from '../../../index';
26
+ import { useTheme } from '@mui/material/styles';
27
+ import EditIcon from '@mui/icons-material/Edit';
28
+ import GroupIcon from '@mui/icons-material/Group';
29
+ import BarChartIcon from '@mui/icons-material/BarChart';
30
+ import ArchiveIcon from '@mui/icons-material/Archive';
31
+ import LogoutIcon from '@mui/icons-material/Logout';
32
+ import { tooltipDelay } from '../../../utils/theme';
33
+ var AvatarPanel = function (props) {
34
+ var _a;
35
+ var theme = useTheme();
36
+ var avatarName = props.avatarName, editProfileText = props.editProfileText, logoutText = props.logoutText, rest = __rest(props, ["avatarName", "editProfileText", "logoutText"]);
37
+ useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [
38
+ avatarName
39
+ ]);
40
+ var handleAvatarInitials = function (avatar) {
41
+ var _a, _b;
42
+ var firstInitial = avatar.split('')[0] || '';
43
+ var secondInitial = '';
44
+ if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
45
+ firstInitial = avatarName.split(' ')[0][0];
46
+ if (((_b = avatar.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
47
+ secondInitial = avatar === null || avatar === void 0 ? void 0 : avatar.split(' ')[1][0];
48
+ }
49
+ }
50
+ return "".concat(firstInitial).concat(secondInitial);
51
+ };
52
+ var _b = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _b[0], setAvatarInitials = _b[1];
53
+ return (_jsxs(Box, __assign({ style: {
54
+ alignItems: 'center',
55
+ backgroundColor: theme.palette.mode === 'dark'
56
+ ? theme.palette.primary.dark
57
+ : '#E6EAF0',
58
+ boxSizing: 'border-box',
59
+ display: 'flex',
60
+ flexDirection: 'column',
61
+ height: '100%',
62
+ justifyContent: 'space-between',
63
+ overflow: 'hidden',
64
+ padding: theme.spacing(2),
65
+ width: '100%',
66
+ zIndex: '1'
67
+ } }, rest, { children: [_jsx(Tooltip, __assign({ title: logoutText !== null && logoutText !== void 0 ? logoutText : 'Log out', placement: 'bottom', enterDelay: tooltipDelay.start, leaveDelay: tooltipDelay.end }, { children: _jsx(IconButton, __assign({ style: {
68
+ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto',
69
+ position: 'absolute',
70
+ right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1),
71
+ top: theme.spacing(1)
72
+ } }, { children: _jsx(LogoutIcon, {}) })) })), _jsxs(Box, __assign({ style: {
73
+ alignItems: 'center',
74
+ display: 'flex',
75
+ flexDirection: 'column'
76
+ } }, { children: [_jsx(Avatar, __assign({ style: {
77
+ fontSize: '3.75rem',
78
+ height: 150,
79
+ marginBottom: theme.spacing(2),
80
+ width: 150
81
+ } }, { children: avatarInitials })), _jsxs(Typography, __assign({ component: "h3", variant: "h4", style: {
82
+ marginBottom: theme.spacing(2)
83
+ } }, { children: [_jsx("span", __assign({ style: { fontWeight: 300 } }, { children: "Hi," })), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })), _jsxs(Box, __assign({ style: {
84
+ marginBottom: theme.spacing(1)
85
+ } }, { children: [_jsx(Button, __assign({ variant: 'contained', color: 'primary', size: 'medium', style: { marginRight: '0.5rem' } }, { children: "View Profile" })), _jsx(Tooltip, __assign({ title: editProfileText !== null && editProfileText !== void 0 ? editProfileText : 'Edit profile', placement: 'bottom', enterDelay: tooltipDelay.start, leaveDelay: tooltipDelay.end }, { children: _jsx(IconButton, { children: _jsx(EditIcon, {}) }) }))] }))] })), _jsxs(Box, __assign({ style: {
86
+ alignItems: 'center',
87
+ display: 'flex',
88
+ flexDirection: 'column'
89
+ } }, { children: [_jsxs(List, __assign({ style: { marginBottom: theme.spacing(2) } }, { children: [_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ component: Link, role: 'link' }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
90
+ minWidth: theme.spacing(5)
91
+ } }, { children: _jsx(GroupIcon, {}) })), _jsx(ListItemText, { children: "My Team" })] })) })), _jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ component: Link, role: 'link' }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
92
+ minWidth: theme.spacing(5)
93
+ } }, { children: _jsx(BarChartIcon, {}) })), _jsx(ListItemText, { children: "My Reports" })] })) })), _jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ component: Link, role: 'link' }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
94
+ minWidth: theme.spacing(5)
95
+ } }, { children: _jsx(ArchiveIcon, {}) })), _jsx(ListItemText, { children: "Archived Playlists" })] })) }))] })), _jsx(Button, __assign({ variant: 'outlined', color: 'primary', size: 'medium' }, { children: "Admin Portal" }))] }))] })));
96
+ };
97
+ export default AvatarPanel;
@@ -1,21 +1,19 @@
1
1
  import React from 'react';
2
- interface VerticalNaviationItemProps {
3
- label: string;
4
- icon: React.ReactElement;
5
- onClick?: any;
6
- isActive?: boolean;
7
- }
8
- interface VerticalNaviationProps {
2
+ import { IVerticalNavigationItemProps } from './VerticalNavigationItem/VerticalNavigationItem';
3
+ interface VerticalNavigationProps {
9
4
  logo?: string;
10
5
  logoText?: string;
11
- items?: VerticalNaviationItemProps[];
12
- secondaryItems?: VerticalNaviationItemProps[];
6
+ logoOnClick?: any;
7
+ items?: IVerticalNavigationItemProps[];
8
+ secondaryItems?: IVerticalNavigationItemProps[];
13
9
  hasStreamHome?: boolean;
14
10
  streamHomeAccessToken?: string;
15
11
  streamHomeBaseUrl?: string;
16
12
  streamHomeApiKey?: string;
17
13
  avatarName?: string;
18
14
  isDrawerOpen?: boolean;
15
+ isPersistent?: boolean;
16
+ setIsPersistent?: any;
19
17
  }
20
- declare const VerticalNavigation: (props: VerticalNaviationProps) => React.ReactElement;
18
+ declare const VerticalNavigation: (props: VerticalNavigationProps) => React.ReactElement;
21
19
  export default VerticalNavigation;
@@ -11,44 +11,42 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import React, { useEffect } from 'react';
14
- import { styled, useTheme } from '@mui/material/styles';
15
- import useMediaQuery from '@mui/material/useMediaQuery';
16
- import { Avatar, Drawer, Modal, List, Tooltip } from '../../../index';
17
- import { Box, Link } from '@mui/material';
18
- import MailIcon from '@mui/icons-material/Mail';
19
- import { StreamSuiteLogo, NotchSVG } from '../../../assets/Images';
14
+ import { useTheme } from '@mui/material/styles';
15
+ import { Avatar, Modal, List, Tooltip } from '../../../index';
16
+ import { Box } from '@mui/material';
17
+ import { StreamSuiteLogo, NotchSVG, NotchExtendSVG } from '../../../assets/Images';
20
18
  import { AppSwitcher } from '@learningpool/app-switcher';
21
- import { ChevronLeft, ChevronRight } from '@mui/icons-material';
22
- import { DRAWER_WIDTH, DrawerHeader, ListItem, DrawerToggle, DrawerToggleHitboxContent, ListItemButton, ListItemAvatar, ListItemIcon, ListItemText, StyledNav, DrawerShadow, StyledAside, NotchContainer, NotchBackground, NotchBackgroundClip, NotchSeemMask, paperStyles, closedMixin, openedMixin } from './VerticalNavigationStyles';
23
- var StyledDrawer = styled(Drawer)(function (_a) {
24
- var theme = _a.theme, open = _a.open;
25
- return (__assign(__assign({ boxShadow: 'none', boxSizing: 'border-box', flexShrink: 0, whiteSpace: 'nowrap', width: DRAWER_WIDTH.Expanded }, (open && __assign(__assign({}, openedMixin()), { '& .MuiDrawer-paper': __assign(__assign({}, paperStyles(theme)), openedMixin()) }))), (!open && __assign(__assign({}, closedMixin(theme)), { '& .MuiDrawer-paper': __assign(__assign({}, paperStyles(theme)), closedMixin(theme)) }))));
26
- });
19
+ import { ChevronLeft, ChevronRight, PushPin } from '@mui/icons-material';
20
+ import VerticalNavigationItem from './VerticalNavigationItem/VerticalNavigationItem';
21
+ import { DRAWER_WIDTH, DrawerHeader, DrawerToggle, DrawerToggleHitboxContent, StyledDivider, StyledNav, StyledNavSecondary, DrawerShadow, StyledAside, NotchContainer, NotchBackground, NotchBackgroundClip, NotchSeemMask, StyledDrawer } from './VerticalNavigationStyles';
22
+ import { ListItem, ListItemButton, ListItemIcon, ListItemText } from './VerticalNavigationItem/VerticalNavigationItemStyles';
23
+ import AvatarPanel from './AvatarPanel';
24
+ import { motion } from '../../../utils/theme';
25
+ import { handleAvatarInitials } from '../../../utils/helpers';
27
26
  var VerticalNavigation = function (props) {
28
27
  var _a, _b;
29
28
  var theme = useTheme();
30
- var items = props.items, secondaryItems = props.secondaryItems, hasStreamHome = props.hasStreamHome, logo = props.logo, logoText = props.logoText, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, streamHomeAccessToken = props.streamHomeAccessToken;
29
+ 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;
31
30
  var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
31
+ var propIsPersistent = typeof (props === null || props === void 0 ? void 0 : props.isPersistent) === 'boolean' ? props.isPersistent : undefined;
32
32
  var avatarName = (_a = props === null || props === void 0 ? void 0 : props.avatarName) !== null && _a !== void 0 ? _a : 'Avatar name';
33
33
  var _c = React.useState(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false), isDrawerOpen = _c[0], setIsDrawerOpen = _c[1];
34
- var isMediumAndUp = useMediaQuery(theme.breakpoints.up('sm'));
35
- var logoHeight = isMediumAndUp ? '46px' : '38px';
36
- var logoWidth = isMediumAndUp ? '46px' : '38px';
34
+ var _d = React.useState(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false), isPersistent = _d[0], setIsPersistent = _d[1];
35
+ var logoHeight = 38;
36
+ var logoWidth = 38;
37
37
  useEffect(function () { return setIsDrawerOpen(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false); }, [propIsDrawerOpen]);
38
+ useEffect(function () { return setIsDrawerOpen(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false); }, [propIsPersistent]);
38
39
  useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [avatarName]);
39
- var handleAvatarInitials = function (avatarName) {
40
+ var handleIsPersistent = function () {
40
41
  var _a, _b;
41
- var firstInitial = avatarName.split('')[0] || '';
42
- var secondInitial = '';
43
- if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
44
- firstInitial = avatarName.split(' ')[0][0];
45
- if (((_b = avatarName.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
46
- secondInitial = avatarName === null || avatarName === void 0 ? void 0 : avatarName.split(' ')[1][0];
47
- }
42
+ if (props === null || props === void 0 ? void 0 : props.setIsPersistent) {
43
+ props.setIsPersistent((_a = !propIsPersistent) !== null && _a !== void 0 ? _a : false);
44
+ setIsPersistent((_b = !propIsPersistent) !== null && _b !== void 0 ? _b : false);
45
+ return;
48
46
  }
49
- return "".concat(firstInitial).concat(secondInitial);
47
+ setIsPersistent(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false);
50
48
  };
51
- var _d = React.useState((_b = handleAvatarInitials(avatarName)) !== null && _b !== void 0 ? _b : 'AN'), avatarInitials = _d[0], setAvatarInitials = _d[1];
49
+ var _e = React.useState((_b = handleAvatarInitials(avatarName)) !== null && _b !== void 0 ? _b : 'AN'), avatarInitials = _e[0], setAvatarInitials = _e[1];
52
50
  var toggleDrawer = function (open) { return function (event) {
53
51
  event === null || event === void 0 ? void 0 : event.stopPropagation();
54
52
  if (event.type === 'keydown') {
@@ -62,76 +60,141 @@ var VerticalNavigation = function (props) {
62
60
  display: 'flex',
63
61
  flex: '1 auto',
64
62
  flexDirection: 'column',
65
- justifyContent: 'flex-start'
66
- } }, { children: [_jsxs(DrawerHeader, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen, disableFocusListener: isDrawerOpen, disableTouchListener: isDrawerOpen, title: logoText !== null && logoText !== void 0 ? logoText : '', placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: logo
67
- ? typeof logo === 'string'
68
- ? (_jsx("img", { src: logo, height: logoHeight, width: logoWidth, style: {
69
- marginRight: isMediumAndUp ? '20px' : '24px'
70
- }, alt: "Site Logo" }))
71
- : logo
72
- : (_jsx(StreamSuiteLogo, { style: {
73
- height: logoHeight,
74
- width: logoWidth,
75
- marginRight: isMediumAndUp ? '20px' : '24px',
63
+ justifyContent: 'flex-start',
64
+ '.wrapper': {
65
+ display: 'flex',
66
+ position: 'relative'
67
+ },
68
+ '.wrapper > :not(:first-child)': {
69
+ position: 'absolute',
70
+ right: 0,
71
+ background: 'transparent',
72
+ fontSize: 0
73
+ }
74
+ }, className: 'grid-container' }, { children: [_jsx("div", __assign({ className: 'wrapper', style: {
75
+ backgroundColor: theme.palette.mode === 'dark'
76
+ ? theme.palette.primary.main
77
+ : theme.palette.background.paper
78
+ } }, { children: _jsxs(DrawerHeader, __assign({ onClick: logoOnClick !== null && logoOnClick !== void 0 ? logoOnClick : null, isDrawerOpen: isDrawerOpen || isPersistent }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen || isPersistent, disableFocusListener: isDrawerOpen || isPersistent, disableTouchListener: isDrawerOpen || isPersistent, title: logoText !== null && logoText !== void 0 ? logoText : '', placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: logo
79
+ ? typeof logo === 'string'
80
+ ? (_jsx("img", { src: logo, height: "".concat(logoHeight, "px"), width: "".concat(logoWidth, "px"), style: {
81
+ marginRight: '16px'
82
+ }, alt: "Site Logo" }))
83
+ : logo
84
+ : (_jsx(StreamSuiteLogo, { style: {
85
+ height: "".concat(logoHeight, "px"),
86
+ width: "".concat(logoWidth, "px"),
87
+ marginRight: '16px',
88
+ fill: theme.palette.mode === 'dark'
89
+ ? theme.palette.primary.contrastText
90
+ : theme.palette.primary.main
91
+ } })) })), _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 Menus' : 'Open Navigation Menus', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation" }, { children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
92
+ ? (_jsx(ChevronLeft, { style: {
93
+ fontSize: '1.75rem',
94
+ height: '1.75rem',
95
+ width: '1.75rem'
96
+ } }))
97
+ : (_jsx(ChevronRight, { style: {
98
+ fontSize: '1.75rem',
99
+ height: '1.75rem',
100
+ width: '1.75rem'
101
+ } })) }) })), _jsx(Box, { style: {
102
+ borderRadius: '50%',
103
+ boxShadow: '5px 0 15px 0 rgb(0 0 0 / 10%)',
104
+ display: 'none',
105
+ height: '50px',
106
+ left: '12px',
107
+ position: 'fixed',
108
+ right: 'auto !important',
109
+ top: '50%',
110
+ transform: 'translate(50%, -50%)',
111
+ width: '50px'
112
+ } }), _jsxs(DrawerToggle, __assign({ onClick: handleIsPersistent, "aria-label": isDrawerOpen ? 'Close Navigation Menus' : 'Open Navigation Menus', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", style: {
113
+ display: 'none',
114
+ position: 'fixed',
115
+ top: '50%',
116
+ transform: 'translate(50%, -50%)',
117
+ zIndex: 10
118
+ } }, { children: [_jsx(NotchExtendSVG, { style: {
119
+ display: 'block',
76
120
  fill: theme.palette.mode === 'dark'
77
- ? theme.palette.primary.contrastText
78
- : theme.palette.primary.main
79
- } })) })), _jsx(ListItemText, { primary: logoText !== null && logoText !== void 0 ? logoText : '', isDrawerOpen: isDrawerOpen })] }), _jsxs(NotchContainer, { children: [_jsx(NotchBackground, {}), _jsx(NotchBackgroundClip, {}), _jsx(NotchSeemMask, {})] }), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsxs(StyledNav, { children: [_jsx(List, __assign({ sx: {
121
+ ? theme.palette.primary.main
122
+ : theme.palette.background.paper,
123
+ height: '165px',
124
+ left: '-12px',
125
+ padding: '0',
126
+ position: 'absolute',
127
+ top: '-61px',
128
+ transition: 'none',
129
+ width: '90px',
130
+ zIndex: '-1'
131
+ } }), _jsx(DrawerToggleHitboxContent, __assign({ style: {
132
+ background: 'transparent',
133
+ boxShadow: 'none',
134
+ fontSize: '1.3rem',
135
+ height: '1.3rem',
136
+ padding: theme.spacing(1),
137
+ width: '1.3rem'
138
+ } }, { children: isPersistent
139
+ ? (_jsx(PushPin, { style: {
140
+ fontSize: '1.3rem',
141
+ height: '1.3rem',
142
+ width: '1.3rem'
143
+ } }))
144
+ : (_jsx(PushPin, { style: {
145
+ fontSize: '1.3rem',
146
+ height: '1.3rem',
147
+ width: '1.3rem'
148
+ } })) }))] }))] })), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsx("div", __assign({ className: 'wrapper', style: {
149
+ backgroundColor: theme.palette.mode === 'dark'
150
+ ? theme.palette.primary.main
151
+ : theme.palette.background.paper,
152
+ flex: '1 1px',
153
+ overflow: 'auto',
154
+ position: 'relative'
155
+ } }, { children: _jsx(StyledNav, __assign({ tabIndex: -1, "aria-label": 'Primary' }, { children: _jsx(List, __assign({ style: {
80
156
  height: '100%',
81
157
  width: DRAWER_WIDTH.Expanded,
82
- marginTop: "-".concat(theme.spacing(0.5))
83
- } }, { children: items && items.length > 0 && items.map(function (item, index) {
84
- var _a;
85
- return (_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton
86
- // @ts-expect-error
87
- , __assign({
88
- // @ts-expect-error
89
- component: Link, onClick: item.onClick, isActive: item.isActive, isDrawerOpen: isDrawerOpen }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen, disableFocusListener: isDrawerOpen, disableTouchListener: isDrawerOpen, title: item.label, placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: _jsx(ListItemIcon, __assign({ "aria-hidden": true }, { children: (_a = item.icon) !== null && _a !== void 0 ? _a : _jsx(MailIcon, {}) })) })), _jsx(ListItemText, { primary: item.label, isDrawerOpen: isDrawerOpen, index: index })] }), item.label) })));
90
- }) })), _jsxs(List, __assign({ sx: {
91
- width: DRAWER_WIDTH.Expanded,
92
- marginTop: 'auto',
93
- backgroundColor: theme.palette.mode === 'dark'
94
- ? theme.palette.primary.main
95
- : theme.palette.background.paper
96
- } }, { children: [hasStreamHome
97
- ? (_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton, __assign({ sx: {
98
- minHeight: 48,
99
- justifyContent: isDrawerOpen ? 'initial' : 'center'
100
- } }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen, disableFocusListener: isDrawerOpen, disableTouchListener: isDrawerOpen, title: 'App switcher', placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: _jsx(ListItemIcon, __assign({ sx: {
101
- minWidth: 0,
102
- mr: isDrawerOpen ? 2.5 : 'auto',
103
- justifyContent: 'center'
104
- } }, { 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 })] })) })))
105
- : null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) {
106
- var _a;
107
- return (_jsx(ListItem, __assign({ disablePadding: true }, { children: _jsxs(ListItemButton
108
- // @ts-expect-error
109
- , __assign({
110
- // @ts-expect-error
111
- component: Link, onClick: item.onClick, isActive: item.isActive, isDrawerOpen: isDrawerOpen, index: index }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen, disableFocusListener: isDrawerOpen, disableTouchListener: isDrawerOpen, title: item.label, placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: _jsx(ListItemIcon, __assign({ "aria-hidden": true }, { children: (_a = item.icon) !== null && _a !== void 0 ? _a : _jsx(MailIcon, {}) })) })), _jsx(ListItemText, { primary: item.label, isDrawerOpen: isDrawerOpen })] }), item.label) })));
112
- }), avatarName
113
- ? (_jsx(ListItem, __assign({ disablePadding: true, sx: {
114
- overflow: 'hidden'
115
- } }, { children: _jsxs(ListItemAvatar, __assign({ isDrawerOpen: isDrawerOpen, component: Link }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen, disableFocusListener: isDrawerOpen, disableTouchListener: isDrawerOpen, title: avatarName, placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: _jsx(ListItemIcon, __assign({ "aria-hidden": true, sx: { mr: 3 } }, { children: _jsx(Avatar, __assign({ sx: {
116
- bgcolor: theme.palette.mode === 'dark'
117
- ? theme.palette.primary.contrastText
118
- : theme.palette.primary.main
119
- } }, { children: avatarInitials })) })) })), _jsx(ListItemText, { primary: avatarName, isDrawerOpen: isDrawerOpen })] })) })))
120
- : null] }))] })] }))); };
121
- return (_jsxs(StyledAside, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen }), _jsx(Modal, __assign({ "aria-hidden": false, keepMounted: true, disablePortal: true, open: isDrawerOpen, onClose: toggleDrawer(false) }, { children: _jsxs(StyledDrawer, __assign({ "aria-label": 'Navigation Menu', id: 'vertical-navigation', anchor: 'left', open: isDrawerOpen, onClose: toggleDrawer(false), ModalProps: {
158
+ marginTop: "-".concat(theme.spacing(0.5), " !important")
159
+ } }, { children: items && items.length > 0 && items.map(function (item, index) { return (_jsx(VerticalNavigationItem, __assign({}, item, { index: index, isDrawerOpen: isDrawerOpen || isPersistent }))); }) })) })) })), _jsx("div", __assign({ className: 'wrapper', style: {
160
+ backgroundColor: theme.palette.mode === 'dark'
161
+ ? theme.palette.primary.main
162
+ : theme.palette.background.paper
163
+ } }, { children: _jsxs(StyledNavSecondary, __assign({ "aria-label": 'Secondary navigation menu' }, { children: [_jsx(StyledDivider, { isDrawerOpen: isDrawerOpen || isPersistent }), _jsxs(List, __assign({ style: {
164
+ width: DRAWER_WIDTH.Expanded,
165
+ backgroundColor: theme.palette.mode === 'dark'
166
+ ? theme.palette.primary.main
167
+ : theme.palette.background.paper
168
+ } }, { children: [hasStreamHome
169
+ ? (_jsx(ListItem, __assign({ disablePadding: true, isDrawerOpen: isDrawerOpen || isPersistent }, { children: _jsxs(ListItemButton, __assign({ sx: {
170
+ minHeight: 48,
171
+ justifyContent: isDrawerOpen || isPersistent ? 'initial' : 'center'
172
+ } }, { children: [_jsx(Tooltip, __assign({ disableHoverListener: isDrawerOpen || isPersistent, disableFocusListener: isDrawerOpen || isPersistent, disableTouchListener: isDrawerOpen || isPersistent, title: 'App switcher', placement: theme.direction === 'rtl' ? 'left' : 'right' }, { children: _jsx(ListItemIcon, __assign({ sx: {
173
+ minWidth: 0,
174
+ mr: isDrawerOpen || isPersistent ? 2.5 : 'auto',
175
+ justifyContent: 'center'
176
+ } }, { 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 })] })) })))
177
+ : null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_jsx(VerticalNavigationItem, __assign({}, item, { index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true }))); }), avatarName
178
+ ? (_jsx(VerticalNavigationItem, { label: avatarName, icon: _jsx(Avatar, __assign({ style: {
179
+ // backgroundColor: mainTheme.colorButtonText,
180
+ // color: mainTheme.colorButton,
181
+ fontSize: '0.75rem',
182
+ height: 22,
183
+ width: 22
184
+ } }, { children: avatarInitials })), style: {
185
+ maxHeight: isDrawerOpen ? '200px' : '48px',
186
+ overflow: 'hidden',
187
+ padding: 0,
188
+ minHeight: 52,
189
+ transition: "max-height 225ms ".concat(motion.easeInOut, " 0ms !important")
190
+ }, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, { avatarName: avatarName }), isDrawerOpen: isDrawerOpen }))
191
+ : null] }))] })) }))] }))); };
192
+ return (_jsxs(StyledAside, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
193
+ display: isPersistent ? 'none' : 'block'
194
+ } }), _jsx(Modal, __assign({ "aria-hidden": false, keepMounted: true, disablePortal: true, open: isDrawerOpen || isPersistent, onClose: toggleDrawer(false), hideBackdrop: isPersistent, disableScrollLock: isPersistent, disableEnforceFocus: isPersistent, style: {
195
+ right: isPersistent ? 'auto' : 0 // @TODO: rtl support
196
+ } }, { children: _jsx(StyledDrawer, __assign({ "aria-label": 'Navigation Menus', id: 'vertical-navigation', anchor: 'left', open: isDrawerOpen || isPersistent, onClose: toggleDrawer(false), ModalProps: {
122
197
  keepMounted: true
123
- }, variant: 'permanent' }, { children: [_jsx(DrawerToggle, __assign({ onClick: toggleDrawer(!isDrawerOpen), "aria-label": isDrawerOpen ? 'Close Navigation Menu' : 'Open Navigation Menu', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", sx: {
124
- left: isDrawerOpen ? "".concat(DRAWER_WIDTH.Expanded - 21, "px") : (isMediumAndUp ? '44px' : '36px')
125
- } }, { children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
126
- ? (_jsx(ChevronLeft, { sx: {
127
- fontSize: '1.75rem',
128
- height: '1.75rem',
129
- width: '1.75rem'
130
- } }))
131
- : (_jsx(ChevronRight, { sx: {
132
- fontSize: '1.75rem',
133
- height: '1.75rem',
134
- width: '1.75rem'
135
- } })) }) })), listContent()] })) }))] }));
198
+ }, variant: 'permanent' }, { children: listContent() })) }))] }));
136
199
  };
137
200
  export default VerticalNavigation;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ export interface IVerticalNavigationItemProps {
3
+ label: string;
4
+ icon: React.ReactElement;
5
+ onClick?: any;
6
+ isActive?: boolean;
7
+ children?: IVerticalNavigationItemProps[];
8
+ isDrawerOpen?: boolean;
9
+ index?: number;
10
+ isSecondary?: boolean;
11
+ hasFlyout?: boolean;
12
+ fullHeightFlyout?: boolean;
13
+ content?: React.ReactElement;
14
+ style?: any;
15
+ open?: boolean;
16
+ }
17
+ declare const VerticalNavigationItem: (props: IVerticalNavigationItemProps) => React.ReactElement;
18
+ export default VerticalNavigationItem;