@learningpool/ui 1.8.6 → 1.8.8

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 (23) hide show
  1. package/components/landmarks/Header/Header.d.ts +1 -0
  2. package/components/landmarks/Header/Header.js +7 -5
  3. package/components/navigation/MobileNavigation/MobileNavigation.d.ts +1 -0
  4. package/components/navigation/MobileNavigation/MobileNavigation.js +8 -6
  5. package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +1 -0
  6. package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +51 -34
  7. package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +1 -0
  8. package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +52 -29
  9. package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +1 -0
  10. package/components/navigation/MobileNavigation/MobileNavigationSearch.js +5 -3
  11. package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +1 -0
  12. package/components/navigation/VerticalNavigation/VerticalNavigation.js +135 -107
  13. package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +46 -20
  14. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +1 -0
  15. package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +6 -4
  16. package/components/stream/AppSwitcher/AppSwitcher.d.ts +1 -0
  17. package/components/stream/AppSwitcher/AppSwitcher.js +9 -7
  18. package/package.json +1 -1
  19. package/types/components/navigation/VerticalNavigationAvatar.d.ts +1 -0
  20. package/utils/dataAttributes.d.ts +57 -0
  21. package/utils/dataAttributes.js +61 -0
  22. package/utils/helpers.d.ts +12 -9
  23. package/utils/helpers.js +41 -21
@@ -19,6 +19,7 @@ interface HeaderProps {
19
19
  callToActionComponent?: 'button' | 'link' | string;
20
20
  additionalButtons?: AdditionalButtonItemProps[];
21
21
  isSticky?: boolean;
22
+ dataAttributes?: any;
22
23
  breadcrumbItems?: BreadcrumbItemProps[];
23
24
  maxBreadcumbItems?: number;
24
25
  }
@@ -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;
@@ -17,6 +17,7 @@ interface MobileNavigationProps {
17
17
  isAvatarOpen?: boolean;
18
18
  hideAvatarInitials?: boolean;
19
19
  showNotchIndicator?: boolean;
20
+ dataAttributes?: any;
20
21
  hasSearch?: boolean;
21
22
  searchPanelPlaceholder?: string;
22
23
  searchPanelDefaultValue?: string;
@@ -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;
@@ -9,6 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
12
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
22
  import React, { useEffect } from 'react';
14
23
  import { Box, ButtonGroup, Button, Link, List, ListItem, ListItemIcon, ListItemText } from '../../../index';
@@ -18,13 +27,15 @@ import EditIcon from '@mui/icons-material/Edit';
18
27
  import LogoutIcon from '@mui/icons-material/Logout';
19
28
  import ToggleOffIcon from '@mui/icons-material/ToggleOff';
20
29
  import ToggleOnIcon from '@mui/icons-material/ToggleOn';
21
- import { handleAvatarInitials, useStaggerAnimation } from '../../../utils/helpers';
30
+ import { handleAvatarInitials, useFadeIn } from '../../../utils/helpers';
22
31
  import { animated } from '@react-spring/web';
32
+ import { defaultAttributes } from '../../../utils/dataAttributes';
23
33
  var SwipeableTemporaryAvatar = function (props) {
24
- var _a;
34
+ var _a, _b, _c, _d;
25
35
  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 _b = React.useState(isAvatarOpen !== null && isAvatarOpen !== void 0 ? isAvatarOpen : false), isOpen = _b[0], setIsOpen = _b[1];
36
+ var avatarName = props.avatarName, mobileNavDirection = props.mobileNavDirection, avatarPanelLogoutString = props.avatarPanelLogoutString, isAvatarOpen = props.isAvatarOpen, setIsAvatarOpen = props.setIsAvatarOpen, setMobileNavDirection = props.setMobileNavDirection, avatarPanelOnClickSwitchDirection = props.avatarPanelOnClickSwitchDirection, avatarPanelOnClickLogout = props.avatarPanelOnClickLogout, avatarPanelOnClickViewProfile = props.avatarPanelOnClickViewProfile, avatarPanelViewProfileString = props.avatarPanelViewProfileString, avatarPanelOnClickEditProfile = props.avatarPanelOnClickEditProfile, avatarPanelEditProfileString = props.avatarPanelEditProfileString, avatarPanelMenuItems = props.avatarPanelMenuItems, avatarPanelOnClickMainAction = props.avatarPanelOnClickMainAction, avatarPanelMainActionString = props.avatarPanelMainActionString, avatarPanelSettingItems = props.avatarPanelSettingItems, avatarPanelInvertNavString = props.avatarPanelInvertNavString, dataAttributes = props.dataAttributes;
37
+ var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
38
+ var _e = React.useState(isAvatarOpen !== null && isAvatarOpen !== void 0 ? isAvatarOpen : false), isOpen = _e[0], setIsOpen = _e[1];
28
39
  React.useEffect(function () { return handleOpenState(isAvatarOpen); }, [isAvatarOpen]);
29
40
  var handleOpenState = function (open) {
30
41
  setIsOpen(open);
@@ -40,30 +51,42 @@ var SwipeableTemporaryAvatar = function (props) {
40
51
  handleOpenState(open);
41
52
  };
42
53
  };
43
- var _c = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _c[0], setAvatarInitials = _c[1];
54
+ var _f = React.useState((_a = handleAvatarInitials(avatarName)) !== null && _a !== void 0 ? _a : 'AN'), avatarInitials = _f[0], setAvatarInitials = _f[1];
44
55
  useEffect(function () { return setAvatarInitials(handleAvatarInitials(avatarName)); }, [avatarName]);
45
56
  var handleOnClickSwitchDirection = function () {
46
57
  setMobileNavDirection(mobileNavDirection === 'rtl' ? 'ltr' : 'rtl');
47
58
  avatarPanelOnClickSwitchDirection && avatarPanelOnClickSwitchDirection();
48
59
  };
49
- // First item starts at 70ms
50
- // see STAGGER_ITEMS_DELAY in helpers.js
51
- var animationCount = 1;
52
- var incrementAnimationCount = function () { return animationCount++; };
53
- return (_jsx(StyledSwipeableAvatar, __assign({ anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
60
+ // Workaround to handle the react-spring calls without
61
+ // adding additional hook calls on prop or state changes
62
+ // --
63
+ // Store the total possible number of animations in a ref
64
+ // this way the number of hook calls never changes
65
+ // --
66
+ // First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
67
+ var additionalItems = [
68
+ 'avatarPanelOnClickLogout',
69
+ 'avatarName',
70
+ 'avatarPanelOnClickViewProfile',
71
+ 'avatarPanelOnClickMainAction',
72
+ 'mobileNavDirection'
73
+ ];
74
+ var totalItems = __spreadArray(__spreadArray(__spreadArray([], avatarPanelMenuItems !== null && avatarPanelMenuItems !== void 0 ? avatarPanelMenuItems : [], true), avatarPanelSettingItems !== null && avatarPanelSettingItems !== void 0 ? avatarPanelSettingItems : [], true), additionalItems, true);
75
+ var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index, !isAvatarOpen); }));
76
+ return (_jsx(StyledSwipeableAvatar, __assign({ "data-id": dataIds.MobileNavAvatarPanel, anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
54
77
  keepMounted: true
55
78
  } }, { children: _jsxs(StyledBox, { children: [avatarPanelOnClickLogout && (_jsx(Button
56
79
  // @ts-expect-error
57
80
  , __assign({
58
81
  // @ts-expect-error
59
- 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 () {
82
+ 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) }, animationRefs.current[0]), onClick: function () {
60
83
  handleOpenState(false);
61
84
  avatarPanelOnClickLogout();
62
- }, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : 'Logout' }))), _jsxs(Box, __assign({ style: {
85
+ }, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : 'Logout' }))), _jsxs(Box, __assign({ "data-id": dataIds.MobileNavAvatarProfile, style: {
63
86
  alignItems: 'center',
64
87
  display: 'flex',
65
88
  flexDirection: 'column'
66
- } }, { children: [_jsxs(StyledBoxProfile, __assign({ style: useStaggerAnimation(isOpen, animationCount, incrementAnimationCount) }, { children: [_jsx(StyledAvatar, __assign({ style: { marginRight: '0.5rem' } }, { children: avatarInitials })), _jsxs(StyledAvatarName, { children: [_jsx("span", __assign({ style: { fontWeight: 300 } }, { children: "Hi," })), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })] })), avatarPanelOnClickViewProfile && (_jsx(StyledBoxProfileEdit, __assign({ style: __assign({ flexDirection: 'row', marginBottom: theme.spacing(1) }, useStaggerAnimation(isOpen, animationCount, incrementAnimationCount)) }, { children: _jsxs(ButtonGroup, __assign({ variant: 'outlined', "aria-label": "split button" }, { children: [_jsx(StyledOutlineButton, __assign({ variant: 'outlined', color: 'inherit', size: 'medium', onClick: function () {
89
+ } }, { children: [_jsxs(StyledBoxProfile, __assign({ style: animationRefs.current[1] }, { children: [_jsx(StyledAvatar, __assign({ style: { marginRight: '0.5rem' } }, { children: avatarInitials })), _jsxs(StyledAvatarName, { children: [_jsx("span", __assign({ style: { fontWeight: 300 } }, { children: "Hi," })), " ", _jsx("strong", { children: avatarName.split(' ')[0] })] })] })), avatarPanelOnClickViewProfile && (_jsx(StyledBoxProfileEdit, __assign({ style: __assign({ flexDirection: 'row', marginBottom: theme.spacing(1) }, animationRefs.current[2]) }, { children: _jsxs(ButtonGroup, __assign({ variant: 'outlined', "aria-label": "split button" }, { children: [_jsx(StyledOutlineButton, __assign({ variant: 'outlined', color: 'inherit', size: 'medium', onClick: function () {
67
90
  handleOpenState(false);
68
91
  avatarPanelOnClickViewProfile();
69
92
  } }, { children: avatarPanelViewProfileString !== null && avatarPanelViewProfileString !== void 0 ? avatarPanelViewProfileString : 'View Profile' })), avatarPanelOnClickEditProfile && (_jsx(StyledOutlineButton, __assign({ size: 'medium', variant: 'outlined', color: 'inherit', "aria-label": avatarPanelEditProfileString !== null && avatarPanelEditProfileString !== void 0 ? avatarPanelEditProfileString : 'Edit Profile', onClick: function () {
@@ -77,10 +100,7 @@ var SwipeableTemporaryAvatar = function (props) {
77
100
  marginInlineStart: '3rem',
78
101
  marginBottom: theme.spacing(2),
79
102
  maxWidth: '18rem'
80
- } }, { children: avatarPanelMenuItems.map(function (avatarMenuItem) { return (_jsx(ListItem, __assign({ component: animated.div, style: useStaggerAnimation(isOpen, animationCount, incrementAnimationCount),
81
- // whileHover={motionWhileHover}
82
- // whileTap={motionWhileTap}
83
- disablePadding: true }, { children: _jsxs(StyledListItemButton
103
+ } }, { children: avatarPanelMenuItems.map(function (avatarMenuItem, index) { return (_jsx(ListItem, __assign({ component: animated.div, style: animationRefs.current[index + 2], disablePadding: true }, { children: _jsxs(StyledListItemButton
84
104
  // TODO: figure out if these are links or buttons
85
105
  // @ts-expect-error
86
106
  , __assign({
@@ -95,29 +115,26 @@ var SwipeableTemporaryAvatar = function (props) {
95
115
  // @ts-expect-error
96
116
  , __assign({
97
117
  // @ts-expect-error
98
- component: animated.button, style: useStaggerAnimation(isOpen, animationCount, incrementAnimationCount), disablePadding: true, variant: 'outlined', color: 'inherit', size: 'medium', onClick: function () {
118
+ component: animated.button, style: animationRefs.current[((_b = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _b !== void 0 ? _b : 0) + 3], disablePadding: true, variant: 'outlined', color: 'inherit', size: 'medium', onClick: function () {
99
119
  handleOpenState(false);
100
120
  avatarPanelOnClickMainAction();
101
121
  } }, { children: avatarPanelMainActionString })), _jsxs(List, __assign({ style: { marginBottom: theme.spacing(2) } }, { children: [avatarPanelSettingItems &&
102
122
  avatarPanelSettingItems.length > 0 &&
103
- avatarPanelSettingItems.map(function (avatarMenuItem) { return (_jsx(ListItem, __assign({ component: animated.div, style: useStaggerAnimation(isOpen, animationCount, incrementAnimationCount),
104
- // whileHover={motionWhileHover}
105
- // whileTap={motionWhileTap}
106
- disablePadding: true }, { children: _jsxs(StyledListItemButton
107
- // TODO: figure out if these are links or buttons
108
- // @ts-expect-error
109
- , __assign({
123
+ avatarPanelSettingItems.map(function (avatarMenuItem, index) {
124
+ var _a;
125
+ return (_jsx(ListItem, __assign({ component: animated.div, style: animationRefs.current[((_a = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _a !== void 0 ? _a : 0) + index + 3], disablePadding: true }, { children: _jsxs(StyledListItemButton
110
126
  // TODO: figure out if these are links or buttons
111
127
  // @ts-expect-error
112
- component: Link, role: 'link', onClick: function () {
113
- handleOpenState(false);
114
- avatarMenuItem.onClick();
115
- } }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
116
- minWidth: theme.spacing(5)
117
- } }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }))); }), avatarPanelOnClickSwitchDirection && (_jsx(ListItem, __assign({ component: animated.div, style: useStaggerAnimation(isOpen, animationCount, incrementAnimationCount),
118
- // whileHover={motionWhileHover}
119
- // whileTap={motionWhileTap}
120
- disablePadding: true }, { children: _jsxs(StyledListItemButton
128
+ , __assign({
129
+ // TODO: figure out if these are links or buttons
130
+ // @ts-expect-error
131
+ component: Link, role: 'link', onClick: function () {
132
+ handleOpenState(false);
133
+ avatarMenuItem.onClick();
134
+ } }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
135
+ minWidth: theme.spacing(5)
136
+ } }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) })));
137
+ }), avatarPanelOnClickSwitchDirection && (_jsx(ListItem, __assign({ component: animated.div, style: animationRefs.current[((_c = avatarPanelMenuItems === null || avatarPanelMenuItems === void 0 ? void 0 : avatarPanelMenuItems.length) !== null && _c !== void 0 ? _c : 0) + ((_d = avatarPanelSettingItems === null || avatarPanelSettingItems === void 0 ? void 0 : avatarPanelSettingItems.length) !== null && _d !== void 0 ? _d : 0) + 4], disablePadding: true }, { children: _jsxs(StyledListItemButton
121
138
  // TODO: figure out if these are links or buttons
122
139
  // @ts-expect-error
123
140
  , __assign({
@@ -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;
@@ -9,6 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
+ if (ar || !(i in from)) {
15
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
+ ar[i] = from[i];
17
+ }
18
+ }
19
+ return to.concat(ar || Array.prototype.slice.call(from));
20
+ };
12
21
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
13
22
  import * as React from 'react';
14
23
  import { useTheme } from '@mui/material/styles';
@@ -16,12 +25,14 @@ import { List, ListItemText } from '../../../index';
16
25
  import { StyledSwipeableDrawer, StyledBox, StyledListItem, StyledDivider, StyledListSecondaryItem, StyledDrawerLogo, StyledDrawerLogoText, StyledListSecondaryList, StyledListItemText, StyledListSecondaryButton, StyledChildList, StyledChildListItem, StyledChildListItemText, StyledListItemButton, StyledChildListItemButton } from './MobileNavigationDrawerStyles';
17
26
  import { StreamSuiteLogo } from '../../../assets/Images';
18
27
  import { animated } from '@react-spring/web';
19
- import { useStaggerAnimation } from '../../../utils/helpers';
28
+ import { useFadeIn } from '../../../utils/helpers';
20
29
  import { getOffsetNavigationContrastText } from '../helpers';
30
+ import { defaultAttributes } from '../../../utils/dataAttributes';
21
31
  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;
32
+ 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
33
  var theme = useTheme();
24
34
  var _a = React.useState(isDrawerOpen !== null && isDrawerOpen !== void 0 ? isDrawerOpen : false), isOpen = _a[0], setIsOpen = _a[1];
35
+ var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
25
36
  React.useEffect(function () { return handleOpenState(isDrawerOpen); }, [isDrawerOpen]);
26
37
  var handleOpenState = function (open) {
27
38
  setIsOpen(open);
@@ -37,34 +48,46 @@ export default function SwipeableTemporaryDrawer(props) {
37
48
  handleOpenState(open);
38
49
  };
39
50
  };
40
- // First item starts at 70ms
41
- // see STAGGER_ITEMS_DELAY in helpers.js
42
- var animationCount = 1;
43
- 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
45
- ? typeof logo === 'string'
46
- ? (_jsx("img", { height: 38, width: 38, src: logo, alt: logoText !== null && logoText !== void 0 ? logoText : 'Site Logo' }))
47
- : logo
48
- : (_jsx(StreamSuiteLogo, { style: {
49
- 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) {
51
- var label = item.label, children = item.children;
52
- return (_jsxs(StyledListItem, __assign({ disablePadding: true,
53
- // @ts-expect-error
54
- component: animated.li, style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: [_jsx(StyledListItemButton
55
- // whileHover={{ scale: 1.02 }}
56
- // 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
58
- // whileHover={{ scale: 1.02 }}
59
- // 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,
51
+ // Workaround to handle the react-spring calls without
52
+ // adding additional hook calls on prop or state changes
53
+ // --
54
+ // Store the total possible number of animations in a ref
55
+ // this way the number of hook calls never changes
56
+ // --
57
+ // First item starts at 70ms, see STAGGER_ITEMS_DELAY in helpers.js
58
+ var additionalItems = ['logo', 'divider'];
59
+ var totalItems = __spreadArray(__spreadArray(__spreadArray([], items !== null && items !== void 0 ? items : [], true), secondaryItems !== null && secondaryItems !== void 0 ? secondaryItems : [], true), additionalItems, true);
60
+ var animationRefs = React.useRef(totalItems && totalItems.map(function (item, index) { return useFadeIn(index, !isOpen); }));
61
+ var list = function () {
62
+ var _a;
63
+ 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: animationRefs.current[0] }, { children: [logo
64
+ ? typeof logo === 'string'
65
+ ? (_jsx("img", { height: 38, width: 38, src: logo, alt: logoText !== null && logoText !== void 0 ? logoText : 'Site Logo' }))
66
+ : logo
67
+ : (_jsx(StreamSuiteLogo, { style: {
68
+ fill: getOffsetNavigationContrastText(theme)
69
+ } })), _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) {
70
+ var label = item.label, children = item.children;
71
+ return (_jsxs(StyledListItem, __assign({ "data-id": dataIds.MobileNavDrawerPrimaryItem, disablePadding: true,
62
72
  // @ts-expect-error
63
- component: animated.li, style: useStaggerAnimation(isDrawerOpen, animationCount, incrementAnimationCount) }, { children: _jsx(StyledListSecondaryButton
64
- // whileHover={{ scale: 1.02 }}
65
- // 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: {
73
+ component: animated.li, style: animationRefs.current[index] }, { children: [_jsx(StyledListItemButton
74
+ // whileHover={{ scale: 1.02 }}
75
+ // whileTap={{ scale: 0.95 }}
76
+ , __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
77
+ // whileHover={{ scale: 1.02 }}
78
+ // whileTap={{ scale: 0.95 }}
79
+ , __assign({}, childItem, { children: _jsx(StyledChildListItemText, { primary: childItem.label }, childItem.label) })) }), childItem.label)); }) })))] }), label));
80
+ }) })), secondaryItems && secondaryItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(animated.div, __assign({ style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + 1] }, { children: _jsx(StyledDivider, {}) })), _jsx(StyledListSecondaryList, __assign({ "data-id": dataIds.MobileNavDrawerSecondaryList }, { children: secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) {
81
+ var _a;
82
+ return (_jsx(StyledListSecondaryItem, __assign({ "data-id": dataIds.MobileNavDrawerSecondaryItem, disablePadding: true,
83
+ // @ts-expect-error
84
+ component: animated.li, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + index + 2] }, { children: _jsx(StyledListSecondaryButton
85
+ // whileHover={{ scale: 1.02 }}
86
+ // whileTap={{ scale: 0.95, boxShadow: '0 6px 15px rgb(36 37 38 / 0%);' }}
87
+ , __assign({}, item, { children: _jsx(ListItemText, { primary: item.label }) })) }), item.label));
88
+ }) }))] }))] })));
89
+ };
90
+ return (_jsx("aside", { children: _jsx(StyledSwipeableDrawer, __assign({ "data-id": dataIds.MobileNavDrawerPanel, anchor: 'bottom', open: isOpen, onClose: toggleDrawer(false), hideBackdrop: true, ModalProps: {
68
91
  keepMounted: true
69
92
  } }, { children: list() })) }));
70
93
  }
@@ -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
  }
@@ -17,6 +17,7 @@ interface VerticalNavigationProps {
17
17
  setIsPersistent?: any;
18
18
  appRootID?: string;
19
19
  localization?: any;
20
+ dataAttributes?: any;
20
21
  hasAvatar?: boolean;
21
22
  avatarPanelLogoutString?: string;
22
23
  avatarPanelOnClickSwitchDirection?: any;