@learningpool/ui 1.8.6 → 1.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/landmarks/Header/Header.d.ts +1 -0
- package/components/landmarks/Header/Header.js +7 -5
- package/components/navigation/MobileNavigation/MobileNavigation.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigation.js +8 -6
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +5 -3
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +11 -9
- package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +1 -0
- package/components/navigation/MobileNavigation/MobileNavigationSearch.js +5 -3
- package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +1 -0
- package/components/navigation/VerticalNavigation/VerticalNavigation.js +11 -9
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +9 -7
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +1 -0
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +6 -4
- package/components/stream/AppSwitcher/AppSwitcher.d.ts +1 -0
- package/components/stream/AppSwitcher/AppSwitcher.js +9 -7
- package/package.json +1 -1
- package/types/components/navigation/VerticalNavigationAvatar.d.ts +1 -0
- package/utils/dataAttributes.d.ts +57 -0
- package/utils/dataAttributes.js +61 -0
|
@@ -30,12 +30,14 @@ import useTheme from '@mui/material/styles/useTheme';
|
|
|
30
30
|
import HeaderActionButtons from './HeaderActionButtons';
|
|
31
31
|
import { StyledAdditionalButtonsContainer, StyledBreadcrumbs, StyledHeaderPrimary, StyledHeaderSecondary, StyledPaper } from './HeaderStyles';
|
|
32
32
|
import { DEFAULT_MAX_CHARACTERS_PER_LINE } from '../../../utils/constants';
|
|
33
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
33
34
|
var Header = function (props) {
|
|
34
35
|
var _a, _b;
|
|
35
|
-
var title = props.title, subtitle = props.subtitle, breadcrumbItems = props.breadcrumbItems, maxBreadcumbItems = props.maxBreadcumbItems, callToAction = props.callToAction, callToActionComponent = props.callToActionComponent, isSticky = props.isSticky, titleComponent = props.titleComponent, maxCharactersPerLine = props.maxCharactersPerLine, rest = __rest(props, ["title", "subtitle", "breadcrumbItems", "maxBreadcumbItems", "callToAction", "callToActionComponent", "isSticky", "titleComponent", "maxCharactersPerLine"]);
|
|
36
|
+
var title = props.title, subtitle = props.subtitle, breadcrumbItems = props.breadcrumbItems, maxBreadcumbItems = props.maxBreadcumbItems, callToAction = props.callToAction, callToActionComponent = props.callToActionComponent, isSticky = props.isSticky, titleComponent = props.titleComponent, maxCharactersPerLine = props.maxCharactersPerLine, dataAttributes = props.dataAttributes, rest = __rest(props, ["title", "subtitle", "breadcrumbItems", "maxBreadcumbItems", "callToAction", "callToActionComponent", "isSticky", "titleComponent", "maxCharactersPerLine", "dataAttributes"]);
|
|
36
37
|
var additionalButtons = props.additionalButtons;
|
|
37
38
|
var theme = useTheme();
|
|
38
39
|
var isMediumAndUp = useMediaQuery(theme.breakpoints.up('md'));
|
|
40
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
39
41
|
useEffect(function () {
|
|
40
42
|
if (!callToAction) {
|
|
41
43
|
return;
|
|
@@ -63,13 +65,13 @@ var Header = function (props) {
|
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
}, [props.additionalButtons, isMediumAndUp]);
|
|
66
|
-
return (_jsxs(StyledPaper, __assign({}, rest, { elevation: 0, className: "".concat(isSticky && 'is-sticky') }, { children: [_jsxs(StyledHeaderPrimary, { children: [breadcrumbItems && breadcrumbItems.length > 0 && (_jsx(StyledBreadcrumbs, __assign({ maxItems: maxBreadcumbItems !== null && maxBreadcumbItems !== void 0 ? maxBreadcumbItems : 2, "aria-label": 'breadcrumb', separator: theme.direction === 'ltr' ? '/' : '\\' }, { children: breadcrumbItems.map(function (breadcrumbItem) {
|
|
68
|
+
return (_jsxs(StyledPaper, __assign({}, rest, { elevation: 0, className: "".concat(isSticky && 'is-sticky'), "data-id": dataIds.HeaderContainer }, { children: [_jsxs(StyledHeaderPrimary, { children: [breadcrumbItems && breadcrumbItems.length > 0 && (_jsx(StyledBreadcrumbs, __assign({ maxItems: maxBreadcumbItems !== null && maxBreadcumbItems !== void 0 ? maxBreadcumbItems : 2, "aria-label": 'breadcrumb', separator: theme.direction === 'ltr' ? '/' : '\\', "data-id": dataIds.HeaderBreadcrumb }, { children: breadcrumbItems.map(function (breadcrumbItem) {
|
|
67
69
|
var _a;
|
|
68
70
|
return (_jsx(Link, __assign({ underline: 'hover', color: (_a = breadcrumbItem.color) !== null && _a !== void 0 ? _a : 'inherit', href: breadcrumbItem.href }, { children: breadcrumbItem.label })));
|
|
69
71
|
}) }))), _jsx(Typography, __assign({ component: titleComponent !== null && titleComponent !== void 0 ? titleComponent : 'h1',
|
|
70
72
|
// Good support for 'ch' https://caniuse.com/ch-unit
|
|
71
|
-
style: { maxWidth: "".concat(maxCharactersPerLine !== null && maxCharactersPerLine !== void 0 ? maxCharactersPerLine : DEFAULT_MAX_CHARACTERS_PER_LINE, "ch") } }, { children: title })), subtitle && (_jsx(Typography, __assign({ component: 'h2', variant: 'subtitle1', color: theme.palette.text.secondary, style: { maxWidth: "".concat(maxCharactersPerLine !== null && maxCharactersPerLine !== void 0 ? maxCharactersPerLine : DEFAULT_MAX_CHARACTERS_PER_LINE, "ch") } }, { children: subtitle })))] }), _jsxs(StyledHeaderSecondary, { children: [isMediumAndUp && callToAction && (callToActionComponent && callToActionComponent === 'link'
|
|
72
|
-
? _jsx(Button, __assign({ href: '#', startIcon: (_a = callToAction.icon) !== null && _a !== void 0 ? _a : null }, { children: callToAction.label }))
|
|
73
|
-
: _jsx(Button, __assign({ startIcon: (_b = callToAction.icon) !== null && _b !== void 0 ? _b : null, variant: 'contained' }, { children: callToAction.label }))), additionalButtons && additionalButtons.length > 0 && (_jsx(StyledAdditionalButtonsContainer, { children: _jsx(HeaderActionButtons, { forceListView: true, options: additionalButtons }) }))] })] })));
|
|
73
|
+
style: { maxWidth: "".concat(maxCharactersPerLine !== null && maxCharactersPerLine !== void 0 ? maxCharactersPerLine : DEFAULT_MAX_CHARACTERS_PER_LINE, "ch") }, "data-id": dataIds.HeaderTitle }, { children: title })), subtitle && (_jsx(Typography, __assign({ component: 'h2', variant: 'subtitle1', color: theme.palette.text.secondary, style: { maxWidth: "".concat(maxCharactersPerLine !== null && maxCharactersPerLine !== void 0 ? maxCharactersPerLine : DEFAULT_MAX_CHARACTERS_PER_LINE, "ch") }, "data-id": dataIds.HeaderSubtitle }, { children: subtitle })))] }), _jsxs(StyledHeaderSecondary, __assign({ "data-id": dataIds.HeaderActions }, { children: [isMediumAndUp && callToAction && (callToActionComponent && callToActionComponent === 'link'
|
|
74
|
+
? _jsx(Button, __assign({ "data-id": dataIds.HeaderActionsMain, href: '#', startIcon: (_a = callToAction.icon) !== null && _a !== void 0 ? _a : null }, { children: callToAction.label }))
|
|
75
|
+
: _jsx(Button, __assign({ "data-id": dataIds.HeaderActionsMain, startIcon: (_b = callToAction.icon) !== null && _b !== void 0 ? _b : null, variant: 'contained' }, { children: callToAction.label }))), additionalButtons && additionalButtons.length > 0 && (_jsx(StyledAdditionalButtonsContainer, { children: _jsx(HeaderActionButtons, { "data-id": dataIds.HeaderActionsSecondary, forceListView: true, options: additionalButtons }) }))] }))] })));
|
|
74
76
|
};
|
|
75
77
|
export default Header;
|
|
@@ -34,9 +34,10 @@ import { MOBILE_NAV_PANEL_TYPES } from '../../../utils/constants';
|
|
|
34
34
|
import { handleAvatarInitials } from '../../../utils/helpers';
|
|
35
35
|
import { useSpring, animated, useSpringRef, config } from '@react-spring/web';
|
|
36
36
|
import { useCurrentWidth } from '../../../utils/hooks';
|
|
37
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
37
38
|
var MobileNavigation = function (props) {
|
|
38
39
|
var _a, _b, _c;
|
|
39
|
-
var items = props.items, secondaryItems = props.secondaryItems, hideAvatarInitials = props.hideAvatarInitials, hasSearch = props.hasSearch, hasAvatar = props.hasAvatar, showNotchIndicator = props.showNotchIndicator, rest = __rest(props, ["items", "secondaryItems", "hideAvatarInitials", "hasSearch", "hasAvatar", "showNotchIndicator"]);
|
|
40
|
+
var items = props.items, secondaryItems = props.secondaryItems, hideAvatarInitials = props.hideAvatarInitials, dataAttributes = props.dataAttributes, hasSearch = props.hasSearch, hasAvatar = props.hasAvatar, showNotchIndicator = props.showNotchIndicator, rest = __rest(props, ["items", "secondaryItems", "hideAvatarInitials", "dataAttributes", "hasSearch", "hasAvatar", "showNotchIndicator"]);
|
|
40
41
|
var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
|
|
41
42
|
var propIsSearchOpen = typeof (props === null || props === void 0 ? void 0 : props.isSearchOpen) === 'boolean' ? props.isSearchOpen : undefined;
|
|
42
43
|
var propIsAvatarOpen = typeof (props === null || props === void 0 ? void 0 : props.isAvatarOpen) === 'boolean' ? props.isAvatarOpen : undefined;
|
|
@@ -45,6 +46,7 @@ var MobileNavigation = function (props) {
|
|
|
45
46
|
var _e = React.useState(propIsSearchOpen !== null && propIsSearchOpen !== void 0 ? propIsSearchOpen : false), isSearchOpen = _e[0], setIsSearchOpen = _e[1];
|
|
46
47
|
var _f = React.useState(propIsAvatarOpen !== null && propIsAvatarOpen !== void 0 ? propIsAvatarOpen : false), isAvatarOpen = _f[0], setIsAvatarOpen = _f[1];
|
|
47
48
|
var _g = React.useState(0), value = _g[0], setValue = _g[1];
|
|
49
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
48
50
|
var currentDirection = window.localStorage.getItem('@learningpool/ui/store/mobile-navigation-direction');
|
|
49
51
|
var _h = React.useState(currentDirection !== null && currentDirection !== void 0 ? currentDirection : 'ltr'), mobileNavDirection = _h[0], setMobileNavDirection = _h[1];
|
|
50
52
|
var _j = React.useState(0), mobileNotchPosition = _j[0], setMobileNotchPosition = _j[1];
|
|
@@ -160,15 +162,15 @@ var MobileNavigation = function (props) {
|
|
|
160
162
|
var MobileNavigationPaperAnimation = useSpring(animationConfig.MobileNavigationPaper);
|
|
161
163
|
var MobileNavigationAnimation = useSpring(animationConfig.MobileNavigation);
|
|
162
164
|
var MobileNavigationButtonAnimation = useSpring(animationConfig.MobileNavigationButton);
|
|
163
|
-
return (_jsxs(_Fragment, { children: [_jsx(SwipeableTemporaryDrawer, __assign({ isDrawerOpen: isDrawerOpen, setIsDrawerOpen: setIsDrawerOpen, items: items, secondaryItems: secondaryItems, label: 'Primary' }, rest)), hasSearch && (_jsx(SwipeableTemporarySearch, __assign({ isSearchOpen: isSearchOpen, setIsSearchOpen: setIsSearchOpen }, rest))), hasAvatar && (_jsx(SwipeableTemporaryAvatar, __assign({ isAvatarOpen: isAvatarOpen, setIsAvatarOpen: setIsAvatarOpen, avatarName: avatarName, mobileNavDirection: mobileNavDirection, setMobileNavDirection: setMobileNavDirection }, rest))), _jsxs(StyledPaper, __assign({ elevation: 3,
|
|
165
|
+
return (_jsxs(_Fragment, { children: [_jsx(SwipeableTemporaryDrawer, __assign({ isDrawerOpen: isDrawerOpen, setIsDrawerOpen: setIsDrawerOpen, items: items, secondaryItems: secondaryItems, label: 'Primary' }, rest)), hasSearch && (_jsx(SwipeableTemporarySearch, __assign({ "data-id": dataIds.MobileNavSearchPanel, isSearchOpen: isSearchOpen, setIsSearchOpen: setIsSearchOpen }, rest))), hasAvatar && (_jsx(SwipeableTemporaryAvatar, __assign({ "data-id": dataIds.MobileNavAvatarPanel, isAvatarOpen: isAvatarOpen, setIsAvatarOpen: setIsAvatarOpen, avatarName: avatarName, mobileNavDirection: mobileNavDirection, setMobileNavDirection: setMobileNavDirection }, rest))), _jsxs(StyledPaper, __assign({ elevation: 3,
|
|
164
166
|
// @ts-expect-error
|
|
165
|
-
component: animated.div, style: MobileNavigationPaperAnimation, ref: navBarRef }, { children: [showNotchIndicator && _jsx(NotchIndicator, __assign({}, animationConfig.MobileNavigationNotch)), _jsxs(StyledBottomNavigation, __assign({ value: value,
|
|
167
|
+
component: animated.div, style: MobileNavigationPaperAnimation, ref: navBarRef, "data-id": dataIds.MobileNavContainer }, { children: [showNotchIndicator && _jsx(NotchIndicator, __assign({}, animationConfig.MobileNavigationNotch)), _jsxs(StyledBottomNavigation, __assign({ value: value,
|
|
166
168
|
// @ts-expect-error
|
|
167
|
-
component: animated.div, style: __assign({ flexDirection: mobileNavDirection && mobileNavDirection === 'rtl' ? 'row-reverse' : 'row' }, MobileNavigationAnimation) }, { children: [_jsx(StyledBottomNavigationAction, { icon: _jsx(ToggleX, { isOpen: isDrawerOpen }), onClick: toggleDrawer(!isDrawerOpen, MOBILE_NAV_PANEL_TYPES.DRAWER),
|
|
169
|
+
component: animated.div, style: __assign({ flexDirection: mobileNavDirection && mobileNavDirection === 'rtl' ? 'row-reverse' : 'row' }, MobileNavigationAnimation) }, { children: [_jsx(StyledBottomNavigationAction, { "data-id": dataIds.MobileNavDrawerToggle, icon: _jsx(ToggleX, { isOpen: isDrawerOpen }), onClick: toggleDrawer(!isDrawerOpen, MOBILE_NAV_PANEL_TYPES.DRAWER),
|
|
168
170
|
// @ts-expect-error
|
|
169
|
-
component: animated.div, "aria-label": isDrawerOpen ? 'Close drawer panel' : 'Open drawer panel', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: __assign({ marginInlineStart: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'auto' : 'initial', marginInlineEnd: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'initial' : 'auto' }, MobileNavigationButtonAnimation) }), hasSearch && (_jsx(StyledBottomNavigationAction, { icon: _jsx(ToggleSearchX, { isOpen: isSearchOpen }), onClick: toggleDrawer(!isSearchOpen, MOBILE_NAV_PANEL_TYPES.SEARCH),
|
|
171
|
+
component: animated.div, "aria-label": isDrawerOpen ? 'Close drawer panel' : 'Open drawer panel', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: __assign({ marginInlineStart: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'auto' : 'initial', marginInlineEnd: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'initial' : 'auto' }, MobileNavigationButtonAnimation) }), hasSearch && (_jsx(StyledBottomNavigationAction, { "data-id": dataIds.MobileNavSearchToggle, icon: _jsx(ToggleSearchX, { isOpen: isSearchOpen }), onClick: toggleDrawer(!isSearchOpen, MOBILE_NAV_PANEL_TYPES.SEARCH),
|
|
170
172
|
// @ts-expect-error
|
|
171
|
-
component: animated.div, "aria-label": isSearchOpen ? 'Close search panel' : 'Open search panel', "aria-expanded": isSearchOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: MobileNavigationButtonAnimation })), hasAvatar && (_jsx(StyledBottomNavigationAction, { onClick: toggleDrawer(!isAvatarOpen, MOBILE_NAV_PANEL_TYPES.AVATAR), icon: !hideAvatarInitials ? _jsx(StyledAvatar, { children: avatarInitials }) : _jsx(Person, {}),
|
|
173
|
+
component: animated.div, "aria-label": isSearchOpen ? 'Close search panel' : 'Open search panel', "aria-expanded": isSearchOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: MobileNavigationButtonAnimation })), hasAvatar && (_jsx(StyledBottomNavigationAction, { "data-id": dataIds.MobileNavAvatarToggle, onClick: toggleDrawer(!isAvatarOpen, MOBILE_NAV_PANEL_TYPES.AVATAR), icon: !hideAvatarInitials ? _jsx(StyledAvatar, { children: avatarInitials }) : _jsx(Person, {}),
|
|
172
174
|
// @ts-expect-error
|
|
173
175
|
component: animated.button, "aria-label": isAvatarOpen ? 'Close Profile Menu' : 'Open Profile Menu', "aria-expanded": isAvatarOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: MobileNavigationButtonAnimation }))] }))] }))] }));
|
|
174
176
|
};
|
|
@@ -11,6 +11,7 @@ export interface ISwipeableTemporaryAvatarProps {
|
|
|
11
11
|
setIsAvatarOpen?: any;
|
|
12
12
|
mobileNavDirection?: string;
|
|
13
13
|
setMobileNavDirection?: any;
|
|
14
|
+
dataAttributes?: any;
|
|
14
15
|
avatarPanelLogoutString?: string;
|
|
15
16
|
avatarPanelOnClickSwitchDirection?: any;
|
|
16
17
|
avatarPanelOnClickLogout?: any;
|
|
@@ -20,10 +20,12 @@ import ToggleOffIcon from '@mui/icons-material/ToggleOff';
|
|
|
20
20
|
import ToggleOnIcon from '@mui/icons-material/ToggleOn';
|
|
21
21
|
import { handleAvatarInitials, useStaggerAnimation } from '../../../utils/helpers';
|
|
22
22
|
import { animated } from '@react-spring/web';
|
|
23
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
23
24
|
var SwipeableTemporaryAvatar = function (props) {
|
|
24
25
|
var _a;
|
|
25
26
|
var theme = useTheme();
|
|
26
|
-
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;
|
|
27
|
+
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;
|
|
28
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
27
29
|
var _b = React.useState(isAvatarOpen !== null && isAvatarOpen !== void 0 ? isAvatarOpen : false), isOpen = _b[0], setIsOpen = _b[1];
|
|
28
30
|
React.useEffect(function () { return handleOpenState(isAvatarOpen); }, [isAvatarOpen]);
|
|
29
31
|
var handleOpenState = function (open) {
|
|
@@ -50,7 +52,7 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
50
52
|
// see STAGGER_ITEMS_DELAY in helpers.js
|
|
51
53
|
var animationCount = 1;
|
|
52
54
|
var incrementAnimationCount = function () { return animationCount++; };
|
|
53
|
-
return (_jsx(StyledSwipeableAvatar, __assign({ anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
|
|
55
|
+
return (_jsx(StyledSwipeableAvatar, __assign({ "data-id": dataIds.MobileNavAvatarPanel, anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
|
|
54
56
|
keepMounted: true
|
|
55
57
|
} }, { children: _jsxs(StyledBox, { children: [avatarPanelOnClickLogout && (_jsx(Button
|
|
56
58
|
// @ts-expect-error
|
|
@@ -59,7 +61,7 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
59
61
|
component: animated.button, style: __assign({ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto', position: 'absolute', right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1), top: theme.spacing(1) }, useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)), onClick: function () {
|
|
60
62
|
handleOpenState(false);
|
|
61
63
|
avatarPanelOnClickLogout();
|
|
62
|
-
}, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : 'Logout' }))), _jsxs(Box, __assign({ style: {
|
|
64
|
+
}, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : 'Logout' }))), _jsxs(Box, __assign({ "data-id": dataIds.MobileNavAvatarProfile, style: {
|
|
63
65
|
alignItems: 'center',
|
|
64
66
|
display: 'flex',
|
|
65
67
|
flexDirection: 'column'
|
|
@@ -20,5 +20,6 @@ export interface ISwipeableTemporaryDrawerProps {
|
|
|
20
20
|
logoOnClick?: any;
|
|
21
21
|
label: string;
|
|
22
22
|
children?: ISwipeableTemporaryDrawerProps[];
|
|
23
|
+
dataAttributes?: any;
|
|
23
24
|
}
|
|
24
25
|
export default function SwipeableTemporaryDrawer(props: ISwipeableTemporaryDrawerProps): JSX.Element;
|
|
@@ -18,10 +18,12 @@ import { StreamSuiteLogo } from '../../../assets/Images';
|
|
|
18
18
|
import { animated } from '@react-spring/web';
|
|
19
19
|
import { useStaggerAnimation } from '../../../utils/helpers';
|
|
20
20
|
import { getOffsetNavigationContrastText } from '../helpers';
|
|
21
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
21
22
|
export default function SwipeableTemporaryDrawer(props) {
|
|
22
|
-
var isDrawerOpen = props.isDrawerOpen, setIsDrawerOpen = props.setIsDrawerOpen, items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick;
|
|
23
|
+
var isDrawerOpen = props.isDrawerOpen, setIsDrawerOpen = props.setIsDrawerOpen, items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, dataAttributes = props.dataAttributes;
|
|
23
24
|
var theme = useTheme();
|
|
24
25
|
var _a = React.useState(isDrawerOpen !== null && isDrawerOpen !== void 0 ? isDrawerOpen : false), isOpen = _a[0], setIsOpen = _a[1];
|
|
26
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
25
27
|
React.useEffect(function () { return handleOpenState(isDrawerOpen); }, [isDrawerOpen]);
|
|
26
28
|
var handleOpenState = function (open) {
|
|
27
29
|
setIsOpen(open);
|
|
@@ -41,30 +43,30 @@ export default function SwipeableTemporaryDrawer(props) {
|
|
|
41
43
|
// see STAGGER_ITEMS_DELAY in helpers.js
|
|
42
44
|
var animationCount = 1;
|
|
43
45
|
var incrementAnimationCount = function () { return animationCount++; };
|
|
44
|
-
var list = function () { return (_jsxs(StyledBox, __assign({ onClick: toggleDrawer(false), onKeyDown: toggleDrawer(false) }, { children: [_jsxs(StyledDrawerLogo, __assign({ onClick: logoOnClick !== null && logoOnClick !== void 0 ? logoOnClick : null, style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: [logo
|
|
46
|
+
var list = function () { return (_jsxs(StyledBox, __assign({ onClick: toggleDrawer(false), onKeyDown: toggleDrawer(false) }, { children: [_jsxs(StyledDrawerLogo, __assign({ "data-id": dataIds.MobileNavDrawerBrand, onClick: logoOnClick !== null && logoOnClick !== void 0 ? logoOnClick : null, style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: [logo
|
|
45
47
|
? typeof logo === 'string'
|
|
46
48
|
? (_jsx("img", { height: 38, width: 38, src: logo, alt: logoText !== null && logoText !== void 0 ? logoText : 'Site Logo' }))
|
|
47
49
|
: logo
|
|
48
50
|
: (_jsx(StreamSuiteLogo, { style: {
|
|
49
51
|
fill: getOffsetNavigationContrastText(theme)
|
|
50
|
-
} })), _jsx(StyledDrawerLogoText, __assign({ variant: 'body1' }, { children: logoText !== null && logoText !== void 0 ? logoText : 'Site Logo' }))] })), _jsx(List, { children: items && items.length > 0 && items.map(function (item, index) {
|
|
52
|
+
} })), _jsx(StyledDrawerLogoText, __assign({ variant: 'body1' }, { children: logoText !== null && logoText !== void 0 ? logoText : 'Site Logo' }))] })), _jsx(List, __assign({ "data-id": dataIds.MobileNavDrawerPrimaryList }, { children: items && items.length > 0 && items.map(function (item, index) {
|
|
51
53
|
var label = item.label, children = item.children;
|
|
52
|
-
return (_jsxs(StyledListItem, __assign({ disablePadding: true,
|
|
54
|
+
return (_jsxs(StyledListItem, __assign({ "data-id": dataIds.MobileNavDrawerPrimaryItem, disablePadding: true,
|
|
53
55
|
// @ts-expect-error
|
|
54
56
|
component: animated.li, style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: [_jsx(StyledListItemButton
|
|
55
57
|
// whileHover={{ scale: 1.02 }}
|
|
56
58
|
// whileTap={{ scale: 0.95 }}
|
|
57
|
-
, __assign({}, item, { children: _jsx(StyledListItemText, { primary: label }) })), children && children.length > 0 && (_jsx(StyledChildList, __assign({ "aria-label": label }, { children: children.map(function (childItem) { return (_jsx(StyledChildListItem, { children: _jsx(StyledChildListItemButton
|
|
59
|
+
, __assign({}, item, { children: _jsx(StyledListItemText, { primary: label }) })), children && children.length > 0 && (_jsx(StyledChildList, __assign({ "data-id": dataIds.MobileNavDrawerPrimaryChildList, "aria-label": label }, { children: children.map(function (childItem) { return (_jsx(StyledChildListItem, __assign({ "data-id": dataIds.MobileNavDrawerPrimaryChildItem }, { children: _jsx(StyledChildListItemButton
|
|
58
60
|
// whileHover={{ scale: 1.02 }}
|
|
59
61
|
// whileTap={{ scale: 0.95 }}
|
|
60
|
-
, __assign({}, childItem, { children: _jsx(StyledChildListItemText, { primary: childItem.label }, childItem.label) })) }, childItem.label)); }) })))] }), label));
|
|
61
|
-
}) }), secondaryItems && secondaryItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(animated.div, __assign({ style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: _jsx(StyledDivider, {}) })), _jsx(StyledListSecondaryList, { children: secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_jsx(StyledListSecondaryItem, __assign({ disablePadding: true,
|
|
62
|
+
, __assign({}, childItem, { children: _jsx(StyledChildListItemText, { primary: childItem.label }, childItem.label) })) }), childItem.label)); }) })))] }), label));
|
|
63
|
+
}) })), secondaryItems && secondaryItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(animated.div, __assign({ style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: _jsx(StyledDivider, {}) })), _jsx(StyledListSecondaryList, __assign({ "data-id": dataIds.MobileNavDrawerSecondaryList }, { children: secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_jsx(StyledListSecondaryItem, __assign({ "data-id": dataIds.MobileNavDrawerSecondaryItem, disablePadding: true,
|
|
62
64
|
// @ts-expect-error
|
|
63
65
|
component: animated.li, style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: _jsx(StyledListSecondaryButton
|
|
64
66
|
// whileHover={{ scale: 1.02 }}
|
|
65
67
|
// whileTap={{ scale: 0.95, boxShadow: '0 6px 15px rgb(36 37 38 / 0%);' }}
|
|
66
|
-
, __assign({}, item, { children: _jsx(ListItemText, { primary: item.label }) })) }), item.label)); }) })] }))] }))); };
|
|
67
|
-
return (_jsx("aside", { children: _jsx(StyledSwipeableDrawer, __assign({ anchor: 'bottom', open: isOpen, onClose: toggleDrawer(false), hideBackdrop: true, ModalProps: {
|
|
68
|
+
, __assign({}, item, { children: _jsx(ListItemText, { primary: item.label }) })) }), item.label)); }) }))] }))] }))); };
|
|
69
|
+
return (_jsx("aside", { children: _jsx(StyledSwipeableDrawer, __assign({ "data-id": dataIds.MobileNavDrawerPanel, anchor: 'bottom', open: isOpen, onClose: toggleDrawer(false), hideBackdrop: true, ModalProps: {
|
|
68
70
|
keepMounted: true
|
|
69
71
|
} }, { children: list() })) }));
|
|
70
72
|
}
|
|
@@ -5,6 +5,7 @@ interface ISwipeableTemporarySearch {
|
|
|
5
5
|
searchPanelPlaceholder?: string;
|
|
6
6
|
searchPanelDefaultValue?: string;
|
|
7
7
|
searchPanelOnClickSearch?: any;
|
|
8
|
+
dataAttributes?: any;
|
|
8
9
|
}
|
|
9
10
|
export default function SwipeableTemporarySearch(props: ISwipeableTemporarySearch): JSX.Element;
|
|
10
11
|
export {};
|
|
@@ -15,10 +15,12 @@ import { FormControl, InputAdornment, Stack, IconButton } from '../../../index';
|
|
|
15
15
|
import { StyledBox, StyledSwipeableSearch, StyledOutlinedInput, StyledOutlinedInputLabel } from './MobileNavigationSearchStyles';
|
|
16
16
|
import Search from '@mui/icons-material/Search';
|
|
17
17
|
import { animated, config, useSpring } from '@react-spring/web';
|
|
18
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
18
19
|
export default function SwipeableTemporarySearch(props) {
|
|
19
|
-
var isSearchOpen = props.isSearchOpen, setIsSearchOpen = props.setIsSearchOpen, searchPanelPlaceholder = props.searchPanelPlaceholder, searchPanelDefaultValue = props.searchPanelDefaultValue, searchPanelOnClickSearch = props.searchPanelOnClickSearch;
|
|
20
|
+
var isSearchOpen = props.isSearchOpen, setIsSearchOpen = props.setIsSearchOpen, searchPanelPlaceholder = props.searchPanelPlaceholder, searchPanelDefaultValue = props.searchPanelDefaultValue, searchPanelOnClickSearch = props.searchPanelOnClickSearch, dataAttributes = props.dataAttributes;
|
|
20
21
|
var _a = React.useState(isSearchOpen !== null && isSearchOpen !== void 0 ? isSearchOpen : false), isOpen = _a[0], setIsOpen = _a[1];
|
|
21
22
|
var _b = React.useState(searchPanelDefaultValue !== null && searchPanelDefaultValue !== void 0 ? searchPanelDefaultValue : ''), searchValue = _b[0], setSearchValue = _b[1];
|
|
23
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
22
24
|
React.useEffect(function () { return handleOpenState(isSearchOpen); }, [isSearchOpen]);
|
|
23
25
|
var handleOpenState = function (open) {
|
|
24
26
|
setIsOpen(open);
|
|
@@ -42,7 +44,7 @@ export default function SwipeableTemporarySearch(props) {
|
|
|
42
44
|
// Pass search value into the onClick function
|
|
43
45
|
searchPanelOnClickSearch && searchPanelOnClickSearch(searchValue);
|
|
44
46
|
};
|
|
45
|
-
return (_jsx(StyledSwipeableSearch, __assign({ anchor: 'bottom', open: isOpen, onClose: toggleSearch(false), onOpen: toggleSearch(true), swipeAreaWidth: 44, variant: 'persistent', ModalProps: {
|
|
47
|
+
return (_jsx(StyledSwipeableSearch, __assign({ "data-id": dataIds.MobileNavSearchPanel, anchor: 'bottom', open: isOpen, onClose: toggleSearch(false), onOpen: toggleSearch(true), swipeAreaWidth: 44, variant: 'persistent', ModalProps: {
|
|
46
48
|
keepMounted: true
|
|
47
49
|
} }, { children: _jsx(StyledBox, { children: _jsx(Stack, __assign({ spacing: 2 }, { children: _jsx(animated.div, __assign({ style: useSpring({
|
|
48
50
|
from: { opacity: 0, y: 10 },
|
|
@@ -50,5 +52,5 @@ export default function SwipeableTemporarySearch(props) {
|
|
|
50
52
|
delay: isSearchOpen ? 100 : 0,
|
|
51
53
|
reverse: !isSearchOpen,
|
|
52
54
|
config: __assign(__assign({}, config.default), { mass: 1 })
|
|
53
|
-
}) }, { children: _jsxs(FormControl, __assign({ fullWidth: true, variant: 'outlined', color: 'secondary' }, { children: [_jsx(StyledOutlinedInputLabel, __assign({ htmlFor: 'mobile-nav-search' }, { children: searchPanelPlaceholder !== null && searchPanelPlaceholder !== void 0 ? searchPanelPlaceholder : 'Search' })), _jsx(StyledOutlinedInput, { label: searchPanelPlaceholder !== null && searchPanelPlaceholder !== void 0 ? searchPanelPlaceholder : 'Search', id: 'mobile-nav-search', endAdornment: _jsx(InputAdornment, __assign({ position: 'end' }, { children: _jsx(IconButton, __assign({ "aria-label": 'Search', edge: 'end', onClick: handleSearch }, { children: _jsx(Search, {}) })) })), onKeyDown: handleSearch, value: searchValue, onChange: function (event) { var _a; return setSearchValue((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value); } })] })) })) })) }) })));
|
|
55
|
+
}) }, { children: _jsxs(FormControl, __assign({ fullWidth: true, variant: 'outlined', color: 'secondary', "data-id": dataIds.MobileNavSearchForm }, { children: [_jsx(StyledOutlinedInputLabel, __assign({ htmlFor: 'mobile-nav-search' }, { children: searchPanelPlaceholder !== null && searchPanelPlaceholder !== void 0 ? searchPanelPlaceholder : 'Search' })), _jsx(StyledOutlinedInput, { label: searchPanelPlaceholder !== null && searchPanelPlaceholder !== void 0 ? searchPanelPlaceholder : 'Search', id: 'mobile-nav-search', endAdornment: _jsx(InputAdornment, __assign({ position: 'end' }, { children: _jsx(IconButton, __assign({ "aria-label": 'Search', edge: 'end', onClick: handleSearch }, { children: _jsx(Search, {}) })) })), onKeyDown: handleSearch, value: searchValue, onChange: function (event) { var _a; return setSearchValue((_a = event === null || event === void 0 ? void 0 : event.target) === null || _a === void 0 ? void 0 : _a.value); } })] })) })) })) }) })));
|
|
54
56
|
}
|
|
@@ -38,12 +38,14 @@ import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
|
|
|
38
38
|
import { DEFAULT_REACT_APP_ID } from '../../../utils/constants';
|
|
39
39
|
import { animated } from '@react-spring/web';
|
|
40
40
|
import { defaultMessages } from '../../../lang/en-us';
|
|
41
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
41
42
|
import { getNavigationBackground, getNavigationContrastText } from '../helpers';
|
|
42
43
|
var VerticalNavigation = function (props) {
|
|
43
44
|
var _a;
|
|
44
45
|
var theme = useTheme();
|
|
45
|
-
var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName"]);
|
|
46
|
+
var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, dataAttributes = props.dataAttributes, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName", "dataAttributes"]);
|
|
46
47
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
48
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
47
49
|
var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
|
|
48
50
|
var propIsPersistent = typeof (props === null || props === void 0 ? void 0 : props.isPersistent) === 'boolean' ? props.isPersistent : undefined;
|
|
49
51
|
var hasAvatar = (_a = props === null || props === void 0 ? void 0 : props.hasAvatar) !== null && _a !== void 0 ? _a : true;
|
|
@@ -112,7 +114,7 @@ var VerticalNavigation = function (props) {
|
|
|
112
114
|
background: 'transparent',
|
|
113
115
|
fontSize: 0
|
|
114
116
|
}
|
|
115
|
-
}, className: 'grid-container' }, { children: [_jsx("div", __assign({ className: 'wrapper', style: { backgroundColor: getNavigationBackground(theme) } }, { children: _jsxs(DrawerHeader, __assign({ onClick: logoOnClick !== null && logoOnClick !== void 0 ? logoOnClick : null, isDrawerOpen: isDrawerOpen || isPersistent, style: useFadeIn(animationCount, incrementAnimationCount) }, { 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
|
|
117
|
+
}, className: 'grid-container' }, { children: [_jsx("div", __assign({ className: 'wrapper', style: { backgroundColor: getNavigationBackground(theme) }, "data-id": dataIds.VerticalNavigationBrand }, { children: _jsxs(DrawerHeader, __assign({ onClick: logoOnClick !== null && logoOnClick !== void 0 ? logoOnClick : null, isDrawerOpen: isDrawerOpen || isPersistent, style: useFadeIn(animationCount, incrementAnimationCount) }, { 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
|
|
116
118
|
? typeof logo === 'string'
|
|
117
119
|
? (_jsx("img", { src: logo, height: "".concat(logoHeight, "px"), width: "".concat(logoWidth, "px"), style: {
|
|
118
120
|
marginInlineEnd: '16px'
|
|
@@ -123,7 +125,7 @@ var VerticalNavigation = function (props) {
|
|
|
123
125
|
width: "".concat(logoWidth, "px"),
|
|
124
126
|
marginInlineEnd: '16px',
|
|
125
127
|
fill: getNavigationContrastText(theme)
|
|
126
|
-
} })) })), _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 ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", isDrawerOpen: isDrawerOpen,
|
|
128
|
+
} })) })), _jsx(ListItemText, { primary: logoText !== null && logoText !== void 0 ? logoText : '', isDrawerOpen: isDrawerOpen || isPersistent })] })) })), _jsxs("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationToggle }, { 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 ? messages['close-navigation'] : messages['open-navigation'], "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": "vertical-navigation", isDrawerOpen: isDrawerOpen,
|
|
127
129
|
// @ts-expect-error
|
|
128
130
|
component: animated.button, style: useFadeIn(animationCount, incrementAnimationCount) }, { children: _jsx(DrawerToggleHitboxContent, { children: isDrawerOpen
|
|
129
131
|
? (_jsx(ChevronLeft, { style: {
|
|
@@ -182,25 +184,25 @@ var VerticalNavigation = function (props) {
|
|
|
182
184
|
fontSize: '1.3rem',
|
|
183
185
|
height: '1.3rem',
|
|
184
186
|
width: '1.3rem'
|
|
185
|
-
} })) }))] }))] })), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsx("div", __assign({ className: 'wrapper', style: {
|
|
187
|
+
} })) }))] }))] })), _jsx(NotchSVG, { style: { height: '0', position: 'absolute', width: '0' } }), _jsx("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationPrimary, style: {
|
|
186
188
|
backgroundColor: getNavigationBackground(theme),
|
|
187
189
|
flex: '1 1px',
|
|
188
190
|
marginTop: '-1px',
|
|
189
191
|
overflow: 'auto',
|
|
190
192
|
position: 'relative',
|
|
191
193
|
zIndex: 10
|
|
192
|
-
} }, { children: _jsx(StyledNav, __assign({ tabIndex: -1, "aria-label": 'Primary' }, { children: _jsx(List, __assign({ style: {
|
|
194
|
+
} }, { children: _jsx(StyledNav, __assign({ tabIndex: -1, "aria-label": 'Primary' }, { children: _jsx(List, __assign({ "data-id": dataIds.VerticalNavigationPrimaryList, style: {
|
|
193
195
|
height: '100%',
|
|
194
196
|
width: DRAWER_WIDTH.Expanded,
|
|
195
197
|
marginTop: "-".concat(theme.spacing(0.5), " !important")
|
|
196
|
-
} }, { children: items && items.length > 0 && items.map(function (item, index) { return (_createElement(VerticalNavigationItem, __assign({}, item, { key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, style: useFadeIn(animationCount, incrementAnimationCount) }))); }) })) })) })), _jsx("div", __assign({ className: 'wrapper', style: { backgroundColor: getNavigationBackground(theme) } }, { children: _jsxs(StyledNavSecondary, __assign({ "aria-label": 'Secondary' }, { children: [_jsx(StyledDivider, { isDrawerOpen: isDrawerOpen || isPersistent }), _jsxs(List, __assign({ style: { width: DRAWER_WIDTH.Expanded } }, { children: [hasStreamHome
|
|
197
|
-
? (_jsx(VerticalNavigationItem, { label: messages['app-switcher'], icon: _jsx(Apps, {}), onClick: handleToggleAppsClick, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, setIsAppSwitcherOpen: setIsAppSwitcherOpen, applications: streamHomeApplications, apiKey: streamHomeApiKey !== null && streamHomeApiKey !== void 0 ? streamHomeApiKey : '', baseUrl: streamHomeBaseUrl !== null && streamHomeBaseUrl !== void 0 ? streamHomeBaseUrl : '', token: streamHomeAccessToken !== null && streamHomeAccessToken !== void 0 ? streamHomeAccessToken : '', isDrawerOpen: isDrawerOpen })), isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, hasCustomContent: true, style: useFadeIn(animationCount, incrementAnimationCount) }))
|
|
198
|
-
: null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_createElement(VerticalNavigationItem, __assign({}, item, { key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: useFadeIn(animationCount, incrementAnimationCount) }))); }), hasAvatar && avatarName && (_jsx(VerticalNavigationItem, { label: avatarName, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, __assign({ style: {
|
|
198
|
+
} }, { children: items && items.length > 0 && items.map(function (item, index) { return (_createElement(VerticalNavigationItem, __assign({}, item, { "data-id": dataIds.VerticalNavigationPrimaryListItem, key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, style: useFadeIn(animationCount, incrementAnimationCount) }))); }) })) })) })), _jsx("div", __assign({ className: 'wrapper', "data-id": dataIds.VerticalNavigationSecondary, style: { backgroundColor: getNavigationBackground(theme) } }, { children: _jsxs(StyledNavSecondary, __assign({ "aria-label": 'Secondary' }, { children: [_jsx(StyledDivider, { isDrawerOpen: isDrawerOpen || isPersistent }), _jsxs(List, __assign({ "data-id": dataIds.VerticalNavigationSecondaryList, style: { width: DRAWER_WIDTH.Expanded } }, { children: [hasStreamHome
|
|
199
|
+
? (_jsx(VerticalNavigationItem, { "data-id": dataIds.VerticalNavigationAppSwitcherToggle, label: messages['app-switcher'], icon: _jsx(Apps, {}), onClick: handleToggleAppsClick, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, setIsAppSwitcherOpen: setIsAppSwitcherOpen, applications: streamHomeApplications, apiKey: streamHomeApiKey !== null && streamHomeApiKey !== void 0 ? streamHomeApiKey : '', baseUrl: streamHomeBaseUrl !== null && streamHomeBaseUrl !== void 0 ? streamHomeBaseUrl : '', token: streamHomeAccessToken !== null && streamHomeAccessToken !== void 0 ? streamHomeAccessToken : '', isDrawerOpen: isDrawerOpen })), isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, hasCustomContent: true, style: useFadeIn(animationCount, incrementAnimationCount) }))
|
|
200
|
+
: null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) { return (_createElement(VerticalNavigationItem, __assign({}, item, { "data-id": dataIds.VerticalNavigationSecondaryListItem, key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: useFadeIn(animationCount, incrementAnimationCount) }))); }), hasAvatar && avatarName && (_jsx(VerticalNavigationItem, { label: avatarName, "data-id": dataIds.VerticalNavigationAvatarToggle, "aria-controls": 'avatar-panel', icon: _jsx(Avatar, __assign({ style: {
|
|
199
201
|
fontSize: '0.75rem',
|
|
200
202
|
height: 32,
|
|
201
203
|
width: 32
|
|
202
204
|
} }, { children: handleAvatarInitials(avatarName) })), style: __assign({ maxHeight: isDrawerOpen ? '200px' : '48px', overflow: 'hidden', padding: 0, minHeight: 52, transition: "max-height 225ms ".concat(motion.easeInOut, " 0ms !important") }, useFadeIn(animationCount, incrementAnimationCount)), onClick: function () { return setIsAvatarOpen(!isAvatarOpen); }, hasFlyout: true, fullHeightFlyout: true, content: _jsx(AvatarPanel, __assign({ avatarName: avatarName, isAvatarOpen: isAvatarOpen, localization: localization }, rest)), isDrawerOpen: isDrawerOpen }))] }))] })) }))] }))); };
|
|
203
|
-
return (_jsxs(StyledAside, __assign({ "aria-label": messages['site-navigation'] }, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
|
|
205
|
+
return (_jsxs(StyledAside, __assign({ "aria-label": messages['site-navigation'], "data-id": dataIds.VerticalNavigationContainer }, { children: [_jsx(DrawerShadow, { className: 'drawerShadow', "aria-hidden": 'true', isDrawerOpen: isDrawerOpen || isPersistent, style: {
|
|
204
206
|
display: isPersistent ? 'none' : 'block'
|
|
205
207
|
} }), _jsx(Modal, __assign({ "aria-hidden": false, keepMounted: true, disablePortal: true, open: isDrawerOpen, onClose: toggleDrawer(false) }, { children: _jsx(StyledDrawer, __assign({ id: 'vertical-navigation', anchor: 'left', open: isDrawerOpen || isPersistent, onClose: toggleDrawer(false), variant: 'permanent' }, { children: listContent() })) }))] })));
|
|
206
208
|
};
|
|
@@ -21,11 +21,13 @@ import { Person, Settings } from '@mui/icons-material';
|
|
|
21
21
|
import { animated } from '@react-spring/web';
|
|
22
22
|
import { FlyoutMenuItemText } from './VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles';
|
|
23
23
|
import { defaultMessages } from '../../../lang/en-us';
|
|
24
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
24
25
|
var AvatarPanel = function (props) {
|
|
25
26
|
var _a;
|
|
26
27
|
var theme = useTheme();
|
|
27
|
-
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, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelFootnote = props.avatarPanelFootnote, isAvatarOpen = props.isAvatarOpen, localization = props.localization;
|
|
28
|
+
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, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelFootnote = props.avatarPanelFootnote, isAvatarOpen = props.isAvatarOpen, localization = props.localization, dataAttributes = props.dataAttributes;
|
|
28
29
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
30
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
29
31
|
useEffect(function () {
|
|
30
32
|
setAvatarInitials(handleAvatarInitials(avatarName));
|
|
31
33
|
}, [avatarName]);
|
|
@@ -38,7 +40,7 @@ var AvatarPanel = function (props) {
|
|
|
38
40
|
// @ts-expect-error
|
|
39
41
|
, __assign({
|
|
40
42
|
// @ts-expect-error
|
|
41
|
-
component: animated.button, style: __assign({ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto', position: 'absolute', right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1), top: theme.spacing(1) }, useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount)), onClick: avatarPanelOnClickLogout, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : messages.logout }))), _jsxs(Box, __assign({ style: {
|
|
43
|
+
component: animated.button, style: __assign({ left: theme.direction === 'rtl' ? theme.spacing(1) : 'auto', position: 'absolute', right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1), top: theme.spacing(1) }, useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount)), onClick: avatarPanelOnClickLogout, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : messages.logout }))), _jsxs(Box, __assign({ "data-id": dataIds.VerticalNavigationAvatarProfile, style: {
|
|
42
44
|
alignItems: 'center',
|
|
43
45
|
display: 'flex',
|
|
44
46
|
flexDirection: 'column'
|
|
@@ -46,10 +48,10 @@ var AvatarPanel = function (props) {
|
|
|
46
48
|
alignItems: 'center',
|
|
47
49
|
display: 'flex',
|
|
48
50
|
flexDirection: 'column'
|
|
49
|
-
} }, { children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, __assign({ style: {
|
|
51
|
+
} }, { children: [avatarPanelMenuItems && avatarPanelMenuItems.length > 0 && (_jsx(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: {
|
|
50
52
|
marginBottom: theme.spacing(2),
|
|
51
53
|
maxWidth: '14rem'
|
|
52
|
-
} }, { children: avatarPanelMenuItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ component: animated.div, style: useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount), disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
54
|
+
} }, { children: avatarPanelMenuItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ "data-id": dataIds.VerticalNavigationFlyoutListItem, component: animated.div, style: useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount), disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
53
55
|
// TODO: figure out if these are links or buttons
|
|
54
56
|
// @ts-expect-error
|
|
55
57
|
, __assign({
|
|
@@ -59,9 +61,9 @@ var AvatarPanel = function (props) {
|
|
|
59
61
|
// @ts-expect-error
|
|
60
62
|
, __assign({
|
|
61
63
|
// @ts-expect-error
|
|
62
|
-
component: animated.button, style: useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount), variant: 'outlined', color: 'inherit', size: 'medium', onClick: avatarPanelOnClickMainAction, startIcon: _jsx(Settings, {}) }, { children: avatarPanelMainActionString })), _jsx(List, __assign({ style: { marginBottom: theme.spacing(2) } }, { children: avatarPanelSettingItems &&
|
|
64
|
+
component: animated.button, style: useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount), variant: 'outlined', color: 'inherit', size: 'medium', onClick: avatarPanelOnClickMainAction, startIcon: _jsx(Settings, {}) }, { children: avatarPanelMainActionString })), _jsx(List, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, style: { marginBottom: theme.spacing(2) } }, { children: avatarPanelSettingItems &&
|
|
63
65
|
avatarPanelSettingItems.length > 0 &&
|
|
64
|
-
avatarPanelSettingItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ component: animated.div, style: useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount), disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
66
|
+
avatarPanelSettingItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ "data-id": dataIds.VerticalNavigationFlyoutListItem, component: animated.div, style: useStaggerAnimation(isAvatarOpen, animationCount, incrementAnimationCount), disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
65
67
|
// TODO: figure out if these are links or buttons
|
|
66
68
|
// @ts-expect-error
|
|
67
69
|
, __assign({
|
|
@@ -69,6 +71,6 @@ var AvatarPanel = function (props) {
|
|
|
69
71
|
// @ts-expect-error
|
|
70
72
|
component: Link, role: 'link', onClick: avatarMenuItem.onClick }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
71
73
|
minWidth: theme.spacing(5)
|
|
72
|
-
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }), "".concat(avatarMenuItem.label, " - ").concat(index))); }) }))] })), _jsx(Box, __assign({ className: 'avatar-panel-footnote' }, { children: avatarPanelFootnote && avatarPanelFootnote }))] }));
|
|
74
|
+
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }), "".concat(avatarMenuItem.label, " - ").concat(index))); }) }))] })), _jsx(Box, __assign({ "data-id": dataIds.VerticalNavigationFlyoutFootnote, className: 'avatar-panel-footnote' }, { children: avatarPanelFootnote && avatarPanelFootnote }))] }));
|
|
73
75
|
};
|
|
74
76
|
export default AvatarPanel;
|
|
@@ -13,10 +13,12 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
13
13
|
import { forwardRef } from 'react';
|
|
14
14
|
import { Link } from '../../../../index';
|
|
15
15
|
import { FullHeightFlyoutMenuPaper, FullHeightFlyoutMenuWrapper, FlyoutNotchMask, NotchMini, FlyoutMenuHeader, FlyoutMenuPaper, FlyoutMenuWrap, FlyoutMenuList, FlyoutMenuButton, FlyoutMenuItem, FlyoutMenuItemText } from './VerticalNavigationItemFlyoutMenuStyles';
|
|
16
|
+
import { defaultAttributes } from '../../../../utils/dataAttributes';
|
|
16
17
|
var VerticalNavigationItemFlyoutMenu = forwardRef(function (props, ref) {
|
|
17
|
-
var label = props.label, children = props.children, isDrawerOpen = props.isDrawerOpen, fullHeightFlyout = props.fullHeightFlyout, open = props.open, parentItemRef = props.parentItemRef, content = props.content, anchorEl = props.anchorEl, setAnchorEl = props.setAnchorEl, setIsFlyoutHovered = props.setIsFlyoutHovered;
|
|
18
|
+
var label = props.label, children = props.children, isDrawerOpen = props.isDrawerOpen, fullHeightFlyout = props.fullHeightFlyout, open = props.open, parentItemRef = props.parentItemRef, dataAttributes = props.dataAttributes, content = props.content, anchorEl = props.anchorEl, setAnchorEl = props.setAnchorEl, setIsFlyoutHovered = props.setIsFlyoutHovered;
|
|
19
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
18
20
|
if (fullHeightFlyout && content) {
|
|
19
|
-
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] })) })));
|
|
21
|
+
return (_jsx(FullHeightFlyoutMenuPaper, __assign({ isDrawerOpen: isDrawerOpen, open: open, id: "avatar-panel", "data-id": dataIds.VerticalNavigationAvatarPanel }, { children: _jsxs(FullHeightFlyoutMenuWrapper, __assign({ open: open }, { children: [_jsx(FlyoutNotchMask, {}), _jsx(NotchMini, { tabIndex: -1, style: { bottom: '24px' } }), content] })) })));
|
|
20
22
|
}
|
|
21
23
|
var handleKeyDown = function (event) {
|
|
22
24
|
if (!event) {
|
|
@@ -32,10 +34,10 @@ var VerticalNavigationItemFlyoutMenu = forwardRef(function (props, ref) {
|
|
|
32
34
|
}, CLOSE_SUBMENU_DELAY);
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
|
-
return (_jsx(FlyoutMenuPaper, __assign({ ref: ref, isDrawerOpen: isDrawerOpen, open: open, anchorEl: anchorEl !== null && anchorEl !== void 0 ? anchorEl : undefined, onMouseEnter: function () { return setIsFlyoutHovered(true); }, onMouseLeave: function () { return setIsFlyoutHovered(false); }, onFocus: function () { return setIsFlyoutHovered(true); }, onBlur: function () { return setIsFlyoutHovered(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, index) { return (_jsx(FlyoutMenuItem, { children: _jsx(FlyoutMenuButton
|
|
37
|
+
return (_jsx(FlyoutMenuPaper, __assign({ ref: ref, "data-id": dataIds.VerticalNavigationFlyout, isDrawerOpen: isDrawerOpen, open: open, anchorEl: anchorEl !== null && anchorEl !== void 0 ? anchorEl : undefined, onMouseEnter: function () { return setIsFlyoutHovered(true); }, onMouseLeave: function () { return setIsFlyoutHovered(false); }, onFocus: function () { return setIsFlyoutHovered(true); }, onBlur: function () { return setIsFlyoutHovered(false); } }, { children: _jsxs(FlyoutMenuWrap, __assign({ open: open }, { children: [_jsx(NotchMini, { style: { top: '12px' } }), _jsx(FlyoutMenuHeader, { children: label }), _jsx(FlyoutMenuList, __assign({ "data-id": dataIds.VerticalNavigationFlyoutList, "aria-label": label, open: open }, { children: children === null || children === void 0 ? void 0 : children.map(function (childItem, index) { return (_jsx(FlyoutMenuItem, __assign({ "data-id": dataIds.VerticalNavigationFlyoutListItem }, { children: _jsx(FlyoutMenuButton
|
|
36
38
|
// @ts-expect-error
|
|
37
39
|
, __assign({
|
|
38
40
|
// @ts-expect-error
|
|
39
|
-
component: Link, role: 'link', onClick: childItem.onClick, onFocus: function (event) { return handleKeyDown(event); }, onBlur: function (event) { return handleKeyDown(event); } }, { children: _jsx(FlyoutMenuItemText, { primary: childItem.label }) }), childItem.label) }, "".concat(childItem.label, " - ").concat(index))); }) }))] })) })));
|
|
41
|
+
component: Link, role: 'link', onClick: childItem.onClick, onFocus: function (event) { return handleKeyDown(event); }, onBlur: function (event) { return handleKeyDown(event); } }, { children: _jsx(FlyoutMenuItemText, { primary: childItem.label }) }), childItem.label) }), "".concat(childItem.label, " - ").concat(index))); }) }))] })) })));
|
|
40
42
|
});
|
|
41
43
|
export default VerticalNavigationItemFlyoutMenu;
|
|
@@ -55,9 +55,10 @@ import AppSwitcherItem, { LogoVariants } from './AppSwitcherItem';
|
|
|
55
55
|
import { AppListHeader, AppListItem, AppOrganisationCount, StyledSVG, BackButton, MenuContent, OrganisationLink, OrganisationList, SearchBox, SearchContent, SelectedOrganisation, AppSwitcherPanel } from './AppSwitcherStyles';
|
|
56
56
|
import { Constants } from './constants';
|
|
57
57
|
import { DRAWER_WIDTH } from '../../navigation/VerticalNavigation/VerticalNavigationStyles';
|
|
58
|
+
import { defaultAttributes } from '../../../utils/dataAttributes';
|
|
58
59
|
var AppSwitcher = function (props) {
|
|
59
60
|
var _a;
|
|
60
|
-
var isAppSwitcherOpen = props.isAppSwitcherOpen, setIsAppSwitcherOpen = props.setIsAppSwitcherOpen, isDrawerOpen = props.isDrawerOpen, localization = props.localization, _b = props.apiKey, apiKey = _b === void 0 ? '' : _b, baseUrl = props.baseUrl;
|
|
61
|
+
var isAppSwitcherOpen = props.isAppSwitcherOpen, setIsAppSwitcherOpen = props.setIsAppSwitcherOpen, isDrawerOpen = props.isDrawerOpen, localization = props.localization, dataAttributes = props.dataAttributes, _b = props.apiKey, apiKey = _b === void 0 ? '' : _b, baseUrl = props.baseUrl;
|
|
61
62
|
var token = props.token;
|
|
62
63
|
// Holds the applications which are displayed.
|
|
63
64
|
var _c = useState([]), applications = _c[0], setApplications = _c[1];
|
|
@@ -70,6 +71,7 @@ var AppSwitcher = function (props) {
|
|
|
70
71
|
// Stores any org filter text (on the second tab).
|
|
71
72
|
var _g = useState(''), searchString = _g[0], setSearchString = _g[1];
|
|
72
73
|
var messages = __assign(__assign({}, defaultMessages), localization);
|
|
74
|
+
var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
|
|
73
75
|
var userId = (_a = props.userId) !== null && _a !== void 0 ? _a : '';
|
|
74
76
|
/**
|
|
75
77
|
* Handles closing of the application dialog.
|
|
@@ -264,20 +266,20 @@ var AppSwitcher = function (props) {
|
|
|
264
266
|
return (_jsxs(AppSwitcherPanel, __assign({ id: "app-switcher-menu", style: {
|
|
265
267
|
display: isAppSwitcherOpen ? 'block' : 'none',
|
|
266
268
|
left: isDrawerOpen ? DRAWER_WIDTH.Expanded : DRAWER_WIDTH.Collapsed - 3
|
|
267
|
-
}, role: 'dialog', "aria-label": "App Switcher", onKeyDown: handleKeyDown }, { children: [activeTab === Constants.Tabs.ListApplications
|
|
268
|
-
? (_jsxs("div", { children: [_jsxs(AppListHeader, { children: [_jsx("svg", { children: _jsx("image", { xlinkHref: "".concat(Constants.AssetsUrl, "suite/logo/latest/icon.svg"), width: "24", height: "24" }) }), messages['your-apps']] }), _jsx(MenuContent, __assign({ style: {
|
|
269
|
+
}, role: 'dialog', "aria-label": "App Switcher", onKeyDown: handleKeyDown, "data-id": dataIds.AppSwitcherContainer }, { children: [activeTab === Constants.Tabs.ListApplications
|
|
270
|
+
? (_jsxs("div", { children: [_jsxs(AppListHeader, __assign({ "data-id": dataIds.AppSwitcherHeader }, { children: [_jsx("svg", { children: _jsx("image", { xlinkHref: "".concat(Constants.AssetsUrl, "suite/logo/latest/icon.svg"), width: "24", height: "24" }) }), messages['your-apps']] })), _jsx(MenuContent, __assign({ style: {
|
|
269
271
|
display: activeTab === 1 ? 'flex' : 'none'
|
|
270
|
-
} }, { children: applications.map(function (_a) {
|
|
272
|
+
}, "data-id": dataIds.AppSwitcherList }, { children: applications.map(function (_a) {
|
|
271
273
|
var applicationId = _a.applicationId, applicationName = _a.applicationName, shortName = _a.shortName, customName = _a.customName, internalName = _a.internalName, url = _a.url, children = _a.children;
|
|
272
|
-
return (_jsxs(AppListItem, { children: [url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, url: url, handleGoToAppClick: handleGoToAppClick })), !url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, handleGoToAppClick: handleGoToAppClick, applicationId: applicationId })), children && (_jsx(AppOrganisationCount, { children: children.length }))] }, applicationId));
|
|
274
|
+
return (_jsxs(AppListItem, __assign({ "data-id": dataIds.AppSwitcherItem }, { children: [url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, url: url, handleGoToAppClick: handleGoToAppClick })), !url && (_jsx(AppSwitcherItem, { internalName: internalName, shortName: shortName, customName: customName, handleGoToAppClick: handleGoToAppClick, applicationId: applicationId })), children && (_jsx(AppOrganisationCount, __assign({ "data-id": dataIds.AppSwitcherOrgCount }, { children: children.length })))] }), applicationId));
|
|
273
275
|
}) }))] }))
|
|
274
276
|
: null, activeTab === Constants.Tabs.ListOrgs
|
|
275
277
|
? (_jsxs(SearchContent, __assign({ style: {
|
|
276
278
|
display: activeTab === 2 ? 'flex' : 'none'
|
|
277
|
-
} }, { children: [_jsxs(BackButton, __assign({ onClick: function () {
|
|
279
|
+
}, "data-id": dataIds.AppSwitcherOrgPanel }, { children: [_jsxs(BackButton, __assign({ onClick: function () {
|
|
278
280
|
setActiveTab(Constants.Tabs.ListApplications);
|
|
279
281
|
setSearchString('');
|
|
280
|
-
} }, { children: [_jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronLeftIcon" }, { children: _jsx("path", { d: "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) })), messages['back-to']] })), _jsxs(SelectedOrganisation, { children: [renderApplicationLogo(activeApplication === null || activeApplication === void 0 ? void 0 : activeApplication.internalName, LogoVariants.Solid), _jsx("span", { children: activeApplication ? activeApplication.applicationName : '' })] }), _jsx(SearchBox, { id: "app-switcher-search-org", type: 'text', value: searchString, onChange: handleSearchChange, placeholder: messages.search }), _jsx(OrganisationList, { children: filteredOrgs === null || filteredOrgs === void 0 ? void 0 : filteredOrgs.filter(function (o) { return o.name.toLowerCase().includes(searchString.toLowerCase()); }).map(function (org, i) { return (_jsxs(OrganisationLink, __assign({ href: org.url, target: "_blank" }, { children: [org.name, _jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronRightIcon" }, { children: _jsx("path", { d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) }))] }), i)); }) })] })))
|
|
282
|
+
}, "data-id": dataIds.AppSwitcherOrgBackButton }, { children: [_jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronLeftIcon" }, { children: _jsx("path", { d: "M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z" }) })), messages['back-to']] })), _jsxs(SelectedOrganisation, __assign({ "data-id": dataIds.AppSwitcherOrgHeader }, { children: [renderApplicationLogo(activeApplication === null || activeApplication === void 0 ? void 0 : activeApplication.internalName, LogoVariants.Solid), _jsx("span", { children: activeApplication ? activeApplication.applicationName : '' })] })), _jsx(SearchBox, { id: "app-switcher-search-org", type: 'text', value: searchString, onChange: handleSearchChange, placeholder: messages.search, "data-id": dataIds.AppSwitcherOrgSearch }), _jsx(OrganisationList, __assign({ "data-id": dataIds.AppSwitcherOrgList }, { children: filteredOrgs === null || filteredOrgs === void 0 ? void 0 : filteredOrgs.filter(function (o) { return o.name.toLowerCase().includes(searchString.toLowerCase()); }).map(function (org, i) { return (_jsxs(OrganisationLink, __assign({ href: org.url, target: "_blank", "data-id": dataIds.AppSwitcherOrgItem }, { children: [org.name, _jsx(StyledSVG, __assign({ className: "MuiSvgIcon-root MuiSvgIcon-fontSizeMedium MuiBox-root css-1om0hkc", focusable: "false", "aria-hidden": "true", viewBox: "0 0 24 24", "data-testid": "ChevronRightIcon" }, { children: _jsx("path", { d: "M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" }) }))] }), i)); }) }))] })))
|
|
281
283
|
: null] })));
|
|
282
284
|
};
|
|
283
285
|
AppSwitcher.propTypes = {
|
package/package.json
CHANGED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export declare const defaultAttributes: {
|
|
2
|
+
VerticalNavigationContainer: string;
|
|
3
|
+
VerticalNavigationBrand: string;
|
|
4
|
+
VerticalNavigationToggle: string;
|
|
5
|
+
VerticalNavigationPrimary: string;
|
|
6
|
+
VerticalNavigationPrimaryList: string;
|
|
7
|
+
VerticalNavigationPrimaryListItem: string;
|
|
8
|
+
VerticalNavigationSecondary: string;
|
|
9
|
+
VerticalNavigationSecondaryList: string;
|
|
10
|
+
VerticalNavigationSecondaryListItem: string;
|
|
11
|
+
VerticalNavigationFlyout: string;
|
|
12
|
+
VerticalNavigationFlyoutList: string;
|
|
13
|
+
VerticalNavigationFlyoutListItem: string;
|
|
14
|
+
VerticalNavigationAppSwitcherToggle: string;
|
|
15
|
+
VerticalNavigationAvatarToggle: string;
|
|
16
|
+
VerticalNavigationAvatarPanel: string;
|
|
17
|
+
VerticalNavigationAvatarProfile: string;
|
|
18
|
+
VerticalNavigationAvatarList: string;
|
|
19
|
+
VerticalNavigationAvatarListItem: string;
|
|
20
|
+
VerticalNavigationAvatarFootnote: string;
|
|
21
|
+
MobileNavContainer: string;
|
|
22
|
+
MobileNavDrawerToggle: string;
|
|
23
|
+
MobileNavDrawerPanel: string;
|
|
24
|
+
MobileNavDrawerBrand: string;
|
|
25
|
+
MobileNavDrawerPrimaryList: string;
|
|
26
|
+
MobileNavDrawerPrimaryItem: string;
|
|
27
|
+
MobileNavDrawerPrimaryChildList: string;
|
|
28
|
+
MobileNavDrawerPrimaryChildItem: string;
|
|
29
|
+
MobileNavDrawerSecondaryList: string;
|
|
30
|
+
MobileNavDrawerSecondaryItem: string;
|
|
31
|
+
MobileNavSearchToggle: string;
|
|
32
|
+
MobileNavSearchPanel: string;
|
|
33
|
+
MobileNavSearchForm: string;
|
|
34
|
+
MobileNavAvatarToggle: string;
|
|
35
|
+
MobileNavAvatarPanel: string;
|
|
36
|
+
MobileNavAvatarProfile: string;
|
|
37
|
+
MobileNavAvatarList: string;
|
|
38
|
+
MobileNavAvatarItem: string;
|
|
39
|
+
AppSwitcherContainer: string;
|
|
40
|
+
AppSwitcherHeader: string;
|
|
41
|
+
AppSwitcherList: string;
|
|
42
|
+
AppSwitcherItem: string;
|
|
43
|
+
AppSwitcherOrgCount: string;
|
|
44
|
+
AppSwitcherOrgPanel: string;
|
|
45
|
+
AppSwitcherOrgBackButton: string;
|
|
46
|
+
AppSwitcherOrgHeader: string;
|
|
47
|
+
AppSwitcherOrgSearch: string;
|
|
48
|
+
AppSwitcherOrgList: string;
|
|
49
|
+
AppSwitcherOrgItem: string;
|
|
50
|
+
HeaderContainer: string;
|
|
51
|
+
HeaderBreadcrumb: string;
|
|
52
|
+
HeaderTitle: string;
|
|
53
|
+
HeaderSubtitle: string;
|
|
54
|
+
HeaderActions: string;
|
|
55
|
+
HeaderActionsMain: string;
|
|
56
|
+
HeaderActionsSecondary: string;
|
|
57
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export var defaultAttributes = {
|
|
2
|
+
// VerticalNavigation data IDs
|
|
3
|
+
VerticalNavigationContainer: 'vertnav-container',
|
|
4
|
+
VerticalNavigationBrand: 'vertnav-brand',
|
|
5
|
+
VerticalNavigationToggle: 'vertnav-toggle',
|
|
6
|
+
VerticalNavigationPrimary: 'vertnav-primary',
|
|
7
|
+
VerticalNavigationPrimaryList: 'vertnav-primary-list',
|
|
8
|
+
VerticalNavigationPrimaryListItem: 'vertnav-primary-list-item',
|
|
9
|
+
VerticalNavigationSecondary: 'vertnav-secondary',
|
|
10
|
+
VerticalNavigationSecondaryList: 'vertnav-secondary-list',
|
|
11
|
+
VerticalNavigationSecondaryListItem: 'vertnav-secondary-list-item',
|
|
12
|
+
VerticalNavigationFlyout: 'vertnav-flyout',
|
|
13
|
+
VerticalNavigationFlyoutList: 'vertnav-flyout-list',
|
|
14
|
+
VerticalNavigationFlyoutListItem: 'vertnav-flyout-list-item',
|
|
15
|
+
VerticalNavigationAppSwitcherToggle: 'vertnav-appSwitcher-toggle',
|
|
16
|
+
VerticalNavigationAvatarToggle: 'vertnav-avatar-toggle',
|
|
17
|
+
VerticalNavigationAvatarPanel: 'vertnav-avatar-panel',
|
|
18
|
+
VerticalNavigationAvatarProfile: 'vertnav-avatar-profile',
|
|
19
|
+
VerticalNavigationAvatarList: 'vertnav-avatar-list',
|
|
20
|
+
VerticalNavigationAvatarListItem: 'vertnav-avatar-list-item',
|
|
21
|
+
VerticalNavigationAvatarFootnote: 'vertnav-avatar-footnote',
|
|
22
|
+
// MobileNavigation data IDs
|
|
23
|
+
MobileNavContainer: 'mobilenav-container',
|
|
24
|
+
MobileNavDrawerToggle: 'mobilenav-drawer-toggle',
|
|
25
|
+
MobileNavDrawerPanel: 'mobilenav-drawer-panel',
|
|
26
|
+
MobileNavDrawerBrand: 'mobilenav-drawer-brand',
|
|
27
|
+
MobileNavDrawerPrimaryList: 'mobilenav-drawer-primary-list',
|
|
28
|
+
MobileNavDrawerPrimaryItem: 'mobilenav-drawer-primary-item',
|
|
29
|
+
MobileNavDrawerPrimaryChildList: 'mobilenav-drawer-primary-child-list',
|
|
30
|
+
MobileNavDrawerPrimaryChildItem: 'mobilenav-drawer-primary-child-item',
|
|
31
|
+
MobileNavDrawerSecondaryList: 'mobilenav-drawer-secondary-list',
|
|
32
|
+
MobileNavDrawerSecondaryItem: 'mobilenav-drawer-secondary-item',
|
|
33
|
+
MobileNavSearchToggle: 'mobilenav-search-toggle',
|
|
34
|
+
MobileNavSearchPanel: 'mobilenav-search-panel',
|
|
35
|
+
MobileNavSearchForm: 'mobilenav-search-form',
|
|
36
|
+
MobileNavAvatarToggle: 'mobilenav-avatar-toggle',
|
|
37
|
+
MobileNavAvatarPanel: 'mobilenav-avatar-panel',
|
|
38
|
+
MobileNavAvatarProfile: 'mobilenav-avatar-profile',
|
|
39
|
+
MobileNavAvatarList: 'mobilenav-avatar-list',
|
|
40
|
+
MobileNavAvatarItem: 'mobilenav-avatar-item',
|
|
41
|
+
// AppSwitcher data IDs
|
|
42
|
+
AppSwitcherContainer: 'appswitcher-container',
|
|
43
|
+
AppSwitcherHeader: 'appswitcher-header',
|
|
44
|
+
AppSwitcherList: 'appswitcher-list',
|
|
45
|
+
AppSwitcherItem: 'appswitcher-item',
|
|
46
|
+
AppSwitcherOrgCount: 'appswitcher-org-count',
|
|
47
|
+
AppSwitcherOrgPanel: 'appswitcher-org-panel',
|
|
48
|
+
AppSwitcherOrgBackButton: 'appswitcher-org-back-button',
|
|
49
|
+
AppSwitcherOrgHeader: 'appswitcher-org-header',
|
|
50
|
+
AppSwitcherOrgSearch: 'appswitcher-org-search',
|
|
51
|
+
AppSwitcherOrgList: 'appswitcher-org-list',
|
|
52
|
+
AppSwitcherOrgItem: 'appswitcher-org-item',
|
|
53
|
+
// Header data IDs
|
|
54
|
+
HeaderContainer: 'header-container',
|
|
55
|
+
HeaderBreadcrumb: 'header-breadcrumb',
|
|
56
|
+
HeaderTitle: 'header-title',
|
|
57
|
+
HeaderSubtitle: 'header-subtitle',
|
|
58
|
+
HeaderActions: 'header-actions',
|
|
59
|
+
HeaderActionsMain: 'header-actions-main',
|
|
60
|
+
HeaderActionsSecondary: 'header-actions-secondary'
|
|
61
|
+
};
|