@learningpool/ui 1.6.0-beta.9 → 1.6.0
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 +26 -0
- package/components/landmarks/Header/Header.js +75 -0
- package/components/landmarks/Header/HeaderActionButtons.d.ts +3 -0
- package/components/landmarks/Header/HeaderActionButtons.js +66 -0
- package/components/landmarks/Header/HeaderStyles.d.ts +55 -0
- package/components/landmarks/Header/HeaderStyles.js +13 -0
- package/components/navigation/MobileNavigation/MobileNavigation.d.ts +1 -2
- package/components/navigation/MobileNavigation/MobileNavigation.js +29 -82
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +1 -1
- package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +26 -8
- package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +3 -4
- package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +3 -3
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.d.ts +1 -1
- package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.d.ts +1 -1
- package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.d.ts +3 -0
- package/components/navigation/MobileNavigation/MobileNavigationNotchIndicator.js +31 -0
- package/components/navigation/MobileNavigation/MobileNavigationStyles.d.ts +0 -254
- package/components/navigation/MobileNavigation/MobileNavigationStyles.js +19 -24
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +2 -1
- package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +2 -1
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +2 -1
- package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +2 -1
- package/components/navigation/VerticalNavigation/VerticalNavigation.d.ts +3 -3
- package/components/navigation/VerticalNavigation/VerticalNavigation.js +5 -10
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.d.ts +1 -21
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatar.js +4 -4
- package/components/navigation/VerticalNavigation/VerticalNavigationAvatarStyles.js +3 -3
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.d.ts +1 -16
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItem.js +27 -23
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.d.ts +1 -1
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenu.js +1 -1
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemFlyoutMenuStyles.d.ts +1 -1
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.d.ts +1 -3
- package/components/navigation/VerticalNavigation/VerticalNavigationItem/VerticalNavigationItemStyles.js +3 -5
- package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +2 -2
- package/components/stream/AppSwitcher/AppSwitcher.d.ts +1 -9
- package/components/stream/AppSwitcher/AppSwitcher.js +6 -6
- package/components/stream/AppSwitcher/AppSwitcherStyles.d.ts +2 -2
- package/components/stream/AppSwitcher/AppSwitcherStyles.js +16 -16
- package/components/stream/AppSwitcher/constants.js +2 -2
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +2 -2
- package/types/components/navigation/VerticalNavigation.d.ts +49 -0
- package/types/components/navigation/VerticalNavigation.js +1 -0
- package/types/components/navigation/VerticalNavigationAvatar.d.ts +22 -0
- package/types/components/navigation/VerticalNavigationAvatar.js +1 -0
- package/types/components/stream/AppSwitcher.d.ts +9 -0
- package/types/components/stream/AppSwitcher.js +1 -0
- package/types/index.d.ts +3 -0
- package/types/index.js +3 -0
- package/utils/constants.d.ts +1 -0
- package/utils/constants.js +3 -0
- package/utils/theme.d.ts +2 -2
- package/utils/theme.js +3 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface AdditionalButtonItemProps {
|
|
3
|
+
label: string;
|
|
4
|
+
onClick?: any;
|
|
5
|
+
icon?: React.ReactElement;
|
|
6
|
+
hide?: boolean;
|
|
7
|
+
}
|
|
8
|
+
interface BreadcrumbItemProps {
|
|
9
|
+
label: string;
|
|
10
|
+
href: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
}
|
|
13
|
+
interface HeaderProps {
|
|
14
|
+
title: string;
|
|
15
|
+
titleComponent?: React.ElementType<any>;
|
|
16
|
+
maxCharactersPerLine?: number;
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
callToAction?: any;
|
|
19
|
+
callToActionComponent?: 'button' | 'link' | string;
|
|
20
|
+
additionalButtons?: AdditionalButtonItemProps[];
|
|
21
|
+
isSticky?: boolean;
|
|
22
|
+
breadcrumbItems?: BreadcrumbItemProps[];
|
|
23
|
+
maxBreadcumbItems?: number;
|
|
24
|
+
}
|
|
25
|
+
declare const Header: (props: HeaderProps) => React.ReactElement;
|
|
26
|
+
export default Header;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
+
import { useEffect } from 'react';
|
|
25
|
+
import Button from '@mui/material/Button';
|
|
26
|
+
import Link from '@mui/material/Link';
|
|
27
|
+
import Typography from '@mui/material/Typography';
|
|
28
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
29
|
+
import useTheme from '@mui/material/styles/useTheme';
|
|
30
|
+
import HeaderActionButtons from './HeaderActionButtons';
|
|
31
|
+
import { StyledAdditionalButtonsContainer, StyledBreadcrumbs, StyledHeaderPrimary, StyledHeaderSecondary, StyledPaper } from './HeaderStyles';
|
|
32
|
+
import { DEFAULT_MAX_CHARACTERS_PER_LINE } from '../../../utils/constants';
|
|
33
|
+
var Header = function (props) {
|
|
34
|
+
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 additionalButtons = props.additionalButtons;
|
|
37
|
+
var theme = useTheme();
|
|
38
|
+
var isMediumAndUp = useMediaQuery(theme.breakpoints.up('md'));
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
if (!callToAction) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
callToAction.hide = isMediumAndUp;
|
|
44
|
+
// No additional buttons exist so CallToAction is the only item in the list
|
|
45
|
+
if (!additionalButtons || additionalButtons.length === 0) {
|
|
46
|
+
if (callToAction) {
|
|
47
|
+
additionalButtons = [];
|
|
48
|
+
additionalButtons.push(callToAction);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Additional buttons exist so add the CallToAction as the first item in the list
|
|
53
|
+
if (additionalButtons && additionalButtons.length > 0) {
|
|
54
|
+
var callToActionIndex = additionalButtons.indexOf(callToAction);
|
|
55
|
+
var hasCallToActionInArray = callToActionIndex !== -1;
|
|
56
|
+
if (!hasCallToActionInArray) {
|
|
57
|
+
// Add the CallToAction item to the top of the Menu
|
|
58
|
+
additionalButtons.splice(0, 0, callToAction);
|
|
59
|
+
}
|
|
60
|
+
if (hasCallToActionInArray) {
|
|
61
|
+
// Show or hide the CallToAction item based on 'isMediumAndUp'
|
|
62
|
+
additionalButtons[callToActionIndex].hide = callToAction.hide;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [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) {
|
|
67
|
+
var _a;
|
|
68
|
+
return (_jsx(Link, __assign({ underline: 'hover', color: (_a = breadcrumbItem.color) !== null && _a !== void 0 ? _a : 'inherit', href: breadcrumbItem.href }, { children: breadcrumbItem.label })));
|
|
69
|
+
}) }))), _jsx(Typography, __assign({ component: titleComponent !== null && titleComponent !== void 0 ? titleComponent : 'h1',
|
|
70
|
+
// 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 }) }))] })] })));
|
|
74
|
+
};
|
|
75
|
+
export default Header;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useState } from 'react';
|
|
14
|
+
import Icon from '@mui/material/Icon';
|
|
15
|
+
import Menu from '@mui/material/Menu';
|
|
16
|
+
import MenuItem from '@mui/material/MenuItem';
|
|
17
|
+
import IconButton from '@mui/material/IconButton';
|
|
18
|
+
import Tooltip from '@mui/material/Tooltip';
|
|
19
|
+
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
|
20
|
+
var MAX_ICONS = 0;
|
|
21
|
+
var HeaderActionButtons = function (props) {
|
|
22
|
+
var options = props.options, styles = props.styles, forceListView = props.forceListView;
|
|
23
|
+
var _a = useState(null), anchorEl = _a[0], setAnchorEl = _a[1];
|
|
24
|
+
var handleClick = function (event) {
|
|
25
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
26
|
+
setAnchorEl(event.currentTarget);
|
|
27
|
+
};
|
|
28
|
+
var handleClose = function (event) {
|
|
29
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
30
|
+
setAnchorEl(null);
|
|
31
|
+
};
|
|
32
|
+
var handleOptionClick = function (event, option) {
|
|
33
|
+
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
34
|
+
option === null || option === void 0 ? void 0 : option.onClick();
|
|
35
|
+
handleClose(event);
|
|
36
|
+
};
|
|
37
|
+
if (!options) {
|
|
38
|
+
console.log('Did you mean to pass items using the `options` parameter?');
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
// Show icon buttons if less than MAX_ICONS
|
|
42
|
+
if (options.length <= MAX_ICONS && !forceListView) {
|
|
43
|
+
return (_jsx("div", __assign({ style: styles }, { children: options.map(function (option) {
|
|
44
|
+
var label = option.label, icon = option.icon, onClick = option.onClick;
|
|
45
|
+
var handleOptionClick = onClick;
|
|
46
|
+
return (_jsx(Tooltip, __assign({ title: label, "aria-label": label, placement: 'bottom', enterDelay: 500, enterNextDelay: 50, leaveDelay: 50, disableInteractive: true }, { children: _jsx(IconButton, __assign({ size: 'small', "aria-label": label, onClick: handleOptionClick }, { children: _jsx(Icon, { children: icon }) })) }), label));
|
|
47
|
+
}) })));
|
|
48
|
+
}
|
|
49
|
+
// Show menu and v-ellipsis if more than MAX_ICONS
|
|
50
|
+
return (_jsxs("div", __assign({ style: styles }, { children: [_jsx(IconButton, __assign({ "aria-label": 'more', "aria-haspopup": 'true', onClick: handleClick }, { children: _jsx(MoreVertIcon, {}) })), _jsx(Menu, __assign({ id: 'actionButtonMenu', anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, anchorOrigin: {
|
|
51
|
+
vertical: 'bottom',
|
|
52
|
+
horizontal: 'center'
|
|
53
|
+
},
|
|
54
|
+
// getContentAnchorEl={null}
|
|
55
|
+
transformOrigin: {
|
|
56
|
+
vertical: 'top',
|
|
57
|
+
horizontal: 'center'
|
|
58
|
+
} }, { children: options.map(function (option) {
|
|
59
|
+
var label = option.label, isDisabled = option.isDisabled, actionKey = option.actionKey, hide = option.hide;
|
|
60
|
+
if (hide) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return (_jsx(MenuItem, __assign({ onClick: function (event) { return handleOptionClick(event, option); }, "aria-label": label, disabled: isDisabled }, { children: label }), actionKey));
|
|
64
|
+
}) }))] })));
|
|
65
|
+
};
|
|
66
|
+
export default HeaderActionButtons;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const StyledPaper: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
children?: import("react").ReactNode;
|
|
4
|
+
classes?: Partial<import("@mui/material").PaperClasses> | undefined;
|
|
5
|
+
elevation?: number | undefined;
|
|
6
|
+
square?: boolean | undefined;
|
|
7
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
8
|
+
variant?: "outlined" | "elevation" | undefined;
|
|
9
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
11
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "variant" | "square" | "elevation"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
12
|
+
export declare const StyledBreadcrumbs: import("@emotion/styled").StyledComponent<{
|
|
13
|
+
children?: import("react").ReactNode;
|
|
14
|
+
classes?: Partial<import("@mui/material").BreadcrumbsClasses> | undefined;
|
|
15
|
+
expandText?: string | undefined;
|
|
16
|
+
itemsAfterCollapse?: number | undefined;
|
|
17
|
+
itemsBeforeCollapse?: number | undefined;
|
|
18
|
+
maxItems?: number | undefined;
|
|
19
|
+
separator?: import("react").ReactNode;
|
|
20
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
21
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "key" | keyof import("react").HTMLAttributes<HTMLElement>> & {
|
|
22
|
+
ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
23
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "separator" | "sx" | "expandText" | "itemsAfterCollapse" | "itemsBeforeCollapse" | "maxItems"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
24
|
+
export declare const StyledHeaderPrimary: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
25
|
+
children?: import("react").ReactNode;
|
|
26
|
+
component?: import("react").ElementType<any> | undefined;
|
|
27
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
28
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
29
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
30
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
31
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "ref" | "children" | "sx" | "component" | ("p" | "color" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint")> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
32
|
+
export declare const StyledHeaderSecondary: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
33
|
+
children?: import("react").ReactNode;
|
|
34
|
+
component?: import("react").ElementType<any> | undefined;
|
|
35
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
36
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
37
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
38
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
39
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "ref" | "children" | "sx" | "component" | ("p" | "color" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint")> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
40
|
+
export declare const StyledAdditionalButtonsContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
41
|
+
children?: import("react").ReactNode;
|
|
42
|
+
component?: import("react").ElementType<any> | undefined;
|
|
43
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
44
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
45
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
46
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
47
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "ref" | "children" | "sx" | "component" | ("p" | "color" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint")> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
48
|
+
export declare const StyledBox: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
49
|
+
children?: import("react").ReactNode;
|
|
50
|
+
component?: import("react").ElementType<any> | undefined;
|
|
51
|
+
ref?: import("react").Ref<unknown> | undefined;
|
|
52
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
53
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
54
|
+
ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
|
|
55
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "ref" | "children" | "sx" | "component" | ("p" | "color" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxShadow" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "zIndex" | "border" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint")> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
|
|
2
|
+
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
|
+
return cooked;
|
|
4
|
+
};
|
|
5
|
+
import { Box, Paper } from '../../../index';
|
|
6
|
+
import { Breadcrumbs, styled } from '@mui/material';
|
|
7
|
+
export var StyledPaper = styled(Paper)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n flex-direction: ", ";\n position: relative;\n width: 100%;\n\n &.is-sticky {\n position: sticky;\n top: 0;\n z-index: 1;\n }\n"], ["\n display: flex;\n flex-direction: ", ";\n position: relative;\n width: 100%;\n\n &.is-sticky {\n position: sticky;\n top: 0;\n z-index: 1;\n }\n"])), function (props) { return props.theme.direction === 'ltr' ? 'row' : 'row-reverse'; });
|
|
8
|
+
export var StyledBreadcrumbs = styled(Breadcrumbs)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n font-size: ", ";\n margin-bottom: 0.5rem;\n\n ol {\n flex-direction: ", ";\n }\n"], ["\n font-size: ", ";\n margin-bottom: 0.5rem;\n\n ol {\n flex-direction: ", ";\n }\n"])), function (props) { return props.theme.typography.subtitle2.fontSize; }, function (props) { return props.theme.direction === 'ltr' ? 'row' : 'row-reverse'; });
|
|
9
|
+
export var StyledHeaderPrimary = styled(Box)(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-items: ", ";\n display: flex;\n flex: 1 auto;\n flex-direction: column;\n padding: 1rem;\n padding-inline-start: 2rem;\n\n h1,\n h4 {\n font-size: clamp(1.125rem, 3.25vw, 2.75rem);\n text-align: ", ";\n }\n"], ["\n align-items: ", ";\n display: flex;\n flex: 1 auto;\n flex-direction: column;\n padding: 1rem;\n padding-inline-start: 2rem;\n\n h1,\n h4 {\n font-size: clamp(1.125rem, 3.25vw, 2.75rem);\n text-align: ", ";\n }\n"])), function (props) { return props.theme.direction === 'ltr' ? 'flex-start' : 'flex-end'; }, function (props) { return props.theme.direction === 'ltr' ? 'left' : 'right'; });
|
|
10
|
+
export var StyledHeaderSecondary = styled(Box)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: center;\n display: flex;\n flex-direction: ", ";\n justify-content: flex-end;\n padding: 1rem;\n padding-inline-end: 2rem;\n\n button,\n a {\n white-space: nowrap;\n }\n"], ["\n align-items: center;\n display: flex;\n flex-direction: ", ";\n justify-content: flex-end;\n padding: 1rem;\n padding-inline-end: 2rem;\n\n button,\n a {\n white-space: nowrap;\n }\n"])), function (props) { return props.theme.direction === 'ltr' ? 'row' : 'row-reverse'; });
|
|
11
|
+
export var StyledAdditionalButtonsContainer = styled(Box)(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n margin-inline-start: ", ";\n margin-inline-end: ", ";\n"], ["\n margin-inline-start: ", ";\n margin-inline-end: ", ";\n"])), function (props) { return props.theme.direction === 'ltr' ? '0.5rem' : '0'; }, function (props) { return props.theme.direction === 'rtl' ? '0.5rem' : '0'; });
|
|
12
|
+
export var StyledBox = styled(Box)(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: ", ";\n"], ["\n background: ", ";\n"])), function (props) { return props.theme.palette.background.default; });
|
|
13
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
|
|
@@ -15,8 +15,6 @@ interface MobileNavigationProps {
|
|
|
15
15
|
isDrawerOpen?: boolean;
|
|
16
16
|
isSearchOpen?: boolean;
|
|
17
17
|
isAvatarOpen?: boolean;
|
|
18
|
-
isPersistent?: boolean;
|
|
19
|
-
setIsPersistent?: any;
|
|
20
18
|
hideAvatarInitials?: boolean;
|
|
21
19
|
showNotchIndicator?: boolean;
|
|
22
20
|
hasSearch?: boolean;
|
|
@@ -24,6 +22,7 @@ interface MobileNavigationProps {
|
|
|
24
22
|
searchPanelDefaultValue?: string;
|
|
25
23
|
searchPanelOnClickSearch?: any;
|
|
26
24
|
hasAvatar?: boolean;
|
|
25
|
+
avatarPanelLogoutString?: string;
|
|
27
26
|
avatarPanelOnClickSwitchDirection?: any;
|
|
28
27
|
avatarPanelOnClickLogout?: any;
|
|
29
28
|
avatarPanelOnClickViewProfile?: any;
|
|
@@ -20,42 +20,33 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
}
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
|
-
import { jsx as _jsx,
|
|
23
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
24
|
import React, { useEffect } from 'react';
|
|
25
|
-
import { Person
|
|
26
|
-
import { StyledBottomNavigationAction, StyledPaper, StyledBottomNavigation
|
|
25
|
+
import { Person } from '@mui/icons-material';
|
|
26
|
+
import { StyledBottomNavigationAction, StyledPaper, StyledBottomNavigation } from './MobileNavigationStyles';
|
|
27
27
|
import { StyledAvatar } from './MobileNavigationAvatarStyles';
|
|
28
28
|
import SwipeableTemporaryDrawer from './MobileNavigationDrawer';
|
|
29
29
|
import SwipeableTemporarySearch from './MobileNavigationSearch';
|
|
30
30
|
import SwipeableTemporaryAvatar from './MobileNavigationAvatar';
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import { slice } from 'lodash';
|
|
31
|
+
import NotchIndicator from './MobileNavigationNotchIndicator';
|
|
32
|
+
import ToggleX from './MobileNavigationToggleX';
|
|
33
|
+
import ToggleSearchX from './MobileNavigationToggleSearchX';
|
|
35
34
|
import { motion } from 'framer-motion';
|
|
36
35
|
import { MOBILE_NAV_PANEL_TYPES } from '../../../utils/constants';
|
|
37
36
|
import { handleAvatarInitials } from '../../../utils/helpers';
|
|
38
37
|
var MobileNavigation = function (props) {
|
|
39
|
-
var _a, _b
|
|
38
|
+
var _a, _b;
|
|
40
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"]);
|
|
41
40
|
var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
|
|
42
41
|
var propIsSearchOpen = typeof (props === null || props === void 0 ? void 0 : props.isSearchOpen) === 'boolean' ? props.isSearchOpen : undefined;
|
|
43
42
|
var propIsAvatarOpen = typeof (props === null || props === void 0 ? void 0 : props.isAvatarOpen) === 'boolean' ? props.isAvatarOpen : undefined;
|
|
44
43
|
var avatarName = (_a = props === null || props === void 0 ? void 0 : props.avatarName) !== null && _a !== void 0 ? _a : 'Avatar name';
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var priorityItems = slice(items, 0, maxMobilePrimaryItems);
|
|
50
|
-
var _g = React.useState(0), value = _g[0], setValue = _g[1];
|
|
51
|
-
var _h = React.useState(0), mobileNotchPosition = _h[0], setMobileNotchPosition = _h[1];
|
|
52
|
-
var windowWidth = useCurrentWidth();
|
|
44
|
+
var _c = React.useState(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false), isDrawerOpen = _c[0], setIsDrawerOpen = _c[1];
|
|
45
|
+
var _d = React.useState(propIsSearchOpen !== null && propIsSearchOpen !== void 0 ? propIsSearchOpen : false), isSearchOpen = _d[0], setIsSearchOpen = _d[1];
|
|
46
|
+
var _e = React.useState(propIsAvatarOpen !== null && propIsAvatarOpen !== void 0 ? propIsAvatarOpen : false), isAvatarOpen = _e[0], setIsAvatarOpen = _e[1];
|
|
47
|
+
var _f = React.useState(0), value = _f[0], setValue = _f[1];
|
|
53
48
|
var currentDirection = window.localStorage.getItem('@learningpool/ui/store/mobile-navigation-direction');
|
|
54
|
-
var
|
|
55
|
-
useEffect(function () {
|
|
56
|
-
window.localStorage.setItem('@learningpool/ui/store/mobile-navigation-direction', mobileNavDirection);
|
|
57
|
-
positionMobileNotch();
|
|
58
|
-
}, [mobileNavDirection]);
|
|
49
|
+
var _g = React.useState(currentDirection !== null && currentDirection !== void 0 ? currentDirection : 'ltr'), mobileNavDirection = _g[0], setMobileNavDirection = _g[1];
|
|
59
50
|
useEffect(function () { return setIsDrawerOpen(propIsDrawerOpen !== null && propIsDrawerOpen !== void 0 ? propIsDrawerOpen : false); }, [propIsDrawerOpen]);
|
|
60
51
|
useEffect(function () { return setIsSearchOpen(propIsSearchOpen !== null && propIsSearchOpen !== void 0 ? propIsSearchOpen : false); }, [propIsSearchOpen]);
|
|
61
52
|
useEffect(function () { return setIsAvatarOpen(propIsAvatarOpen !== null && propIsAvatarOpen !== void 0 ? propIsAvatarOpen : false); }, [propIsAvatarOpen]);
|
|
@@ -69,7 +60,7 @@ var MobileNavigation = function (props) {
|
|
|
69
60
|
}
|
|
70
61
|
hideNotch();
|
|
71
62
|
}, [isDrawerOpen, isSearchOpen, isAvatarOpen]);
|
|
72
|
-
var
|
|
63
|
+
var _h = React.useState((_b = handleAvatarInitials(avatarName)) !== null && _b !== void 0 ? _b : 'AN'), avatarInitials = _h[0], setAvatarInitials = _h[1];
|
|
73
64
|
var toggleDrawer = function (open, action) { return function (event) {
|
|
74
65
|
event === null || event === void 0 ? void 0 : event.stopPropagation();
|
|
75
66
|
if (event.type === 'keydown') {
|
|
@@ -90,6 +81,7 @@ var MobileNavigation = function (props) {
|
|
|
90
81
|
}
|
|
91
82
|
case MOBILE_NAV_PANEL_TYPES.AVATAR: {
|
|
92
83
|
setIsAvatarOpen(open !== null && open !== void 0 ? open : !isAvatarOpen);
|
|
84
|
+
setValue(2);
|
|
93
85
|
break;
|
|
94
86
|
}
|
|
95
87
|
default: {
|
|
@@ -99,22 +91,6 @@ var MobileNavigation = function (props) {
|
|
|
99
91
|
}
|
|
100
92
|
}
|
|
101
93
|
}; };
|
|
102
|
-
var NOTCH = {
|
|
103
|
-
Height: 50,
|
|
104
|
-
Width: 50
|
|
105
|
-
};
|
|
106
|
-
var BOTTOM_NAVIGATION_ITEM_DOM_ELEMENTS = document.querySelectorAll('.MuiBottomNavigationAction-root, .bottom-navigation-item');
|
|
107
|
-
var positionMobileNotch = function () {
|
|
108
|
-
var _a;
|
|
109
|
-
var selectedDOMRect = (_a = BOTTOM_NAVIGATION_ITEM_DOM_ELEMENTS[value]) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
110
|
-
setMobileNotchPosition(selectedDOMRect ? selectedDOMRect.left + (selectedDOMRect.width / 2) - (NOTCH.Width / 2) : mobileNotchPosition);
|
|
111
|
-
};
|
|
112
|
-
useEffect(function () { return positionMobileNotch(); }, [
|
|
113
|
-
value,
|
|
114
|
-
windowWidth,
|
|
115
|
-
// Fix notch position if scrollbar is hidden/shown
|
|
116
|
-
(_c = BOTTOM_NAVIGATION_ITEM_DOM_ELEMENTS[value]) === null || _c === void 0 ? void 0 : _c.getBoundingClientRect()
|
|
117
|
-
]);
|
|
118
94
|
var variantsPaper = {
|
|
119
95
|
open: {
|
|
120
96
|
opacity: 1
|
|
@@ -134,50 +110,21 @@ var MobileNavigation = function (props) {
|
|
|
134
110
|
}
|
|
135
111
|
}
|
|
136
112
|
};
|
|
137
|
-
return (_jsxs(_Fragment, { children: [_jsx(SwipeableTemporaryDrawer, __assign({ isDrawerOpen: isDrawerOpen, setIsDrawerOpen: setIsDrawerOpen, items: items, secondaryItems: secondaryItems, label: 'Primary' }, rest)), hasSearch && (_jsx(SwipeableTemporarySearch, __assign({
|
|
113
|
+
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))), _jsx(StyledPaper, __assign({ elevation: 3,
|
|
138
114
|
// @ts-expect-error
|
|
139
|
-
component: motion.div, animate: 'open', variants: variantsPaper, initial: { opacity: 0 },
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
type: 'spring',
|
|
154
|
-
// mass: 0.5,
|
|
155
|
-
bounce: 0.25
|
|
156
|
-
// stiffness: 50
|
|
157
|
-
},
|
|
158
|
-
y: {
|
|
159
|
-
delay: 0.25,
|
|
160
|
-
// duration: 0.5,
|
|
161
|
-
type: 'spring',
|
|
162
|
-
// mass: 0.5,
|
|
163
|
-
bounce: 0
|
|
164
|
-
}
|
|
165
|
-
// duration: 0.5
|
|
166
|
-
} }, { children: [_jsx(StyledNotchShadow, {}), _jsx(StyledNotchSVG, __assign({ viewBox: "0 0 22 85", xmlns: "http://www.w3.org/2000/svg" }, { children: _jsx(motion.path, { d: "M0 0V85V76.0381C0.774 69.7533 4.9101 64.7829 7.5488 63.5975C7.668 63.5518 7.7867 63.5052 7.9049 63.4576C16.1679 60.1279 22 52.035 22 42.5799C22 33.1612 16.2126 25.0941 8 21.7408C7.8723 21.6887 7.7441 21.6377 7.6153 21.5879C4.8325 20.3142 0.4173 14.8748 0 8.13255V0Z" }) })), _jsx(StyledNotchShadowMask, {})] })), _jsxs(StyledBottomNavigation, __assign({ value: value, onChange: function (event, newValue) { return setValue(newValue); },
|
|
167
|
-
// @ts-expect-error
|
|
168
|
-
component: motion.div, animate: 'open', variants: variantsContainer, style: {
|
|
169
|
-
flexDirection: mobileNavDirection && mobileNavDirection === 'rtl' ? 'row-reverse' : 'row'
|
|
170
|
-
} }, { children: [_jsx(StyledBottomNavigationAction, { icon: _jsx(ToggleX, {}), onClick: toggleDrawer(!isDrawerOpen, MOBILE_NAV_PANEL_TYPES.DRAWER),
|
|
171
|
-
// @ts-expect-error
|
|
172
|
-
component: motion.div, animate: isDrawerOpen ? 'open' : 'closed', variants: variantsButtons, "aria-label": isDrawerOpen ? 'Close drawer panel' : 'Open drawer panel', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: {
|
|
173
|
-
marginInlineStart: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'auto' : 'initial',
|
|
174
|
-
marginInlineEnd: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'initial' : 'auto'
|
|
175
|
-
} }), hasSearch && (_jsx(StyledBottomNavigationAction, { icon: _jsx(ToggleSearchX, {}), onClick: toggleDrawer(!isSearchOpen, MOBILE_NAV_PANEL_TYPES.SEARCH),
|
|
176
|
-
// @ts-expect-error
|
|
177
|
-
component: motion.div, animate: isSearchOpen ? 'open' : 'closed', variants: variantsButtons, "aria-label": isSearchOpen ? 'Close search panel' : 'Open search panel', "aria-expanded": isSearchOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu' })), hasAvatar && (_jsx(StyledBottomNavigationAction, { onClick: toggleDrawer(!isAvatarOpen, MOBILE_NAV_PANEL_TYPES.AVATAR), icon: !hideAvatarInitials
|
|
178
|
-
? _jsx(StyledAvatar, { children: avatarInitials })
|
|
179
|
-
: value === (priorityItems ? priorityItems.length + 1 : 1) ? _jsx(Person, {}) : _jsx(PersonOutline, {}),
|
|
180
|
-
// @ts-expect-error
|
|
181
|
-
component: motion.button, variants: variantsButtons, "aria-label": isAvatarOpen ? 'Close Profile Menu' : 'Open Profile Menu', "aria-expanded": isAvatarOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu' }))] }))] }))] }));
|
|
115
|
+
component: motion.div, animate: 'open', variants: variantsPaper, initial: { opacity: 0 } }, { children: _jsxs(StyledBottomNavigation, __assign({ value: value, onChange: function (event, newValue) { return setValue(newValue); },
|
|
116
|
+
// @ts-expect-error
|
|
117
|
+
component: motion.div, animate: 'open', variants: variantsContainer, style: {
|
|
118
|
+
flexDirection: mobileNavDirection && mobileNavDirection === 'rtl' ? 'row-reverse' : 'row'
|
|
119
|
+
} }, { children: [_jsx(StyledBottomNavigationAction, { icon: (_jsxs(_Fragment, { children: [_jsx(ToggleX, {}), showNotchIndicator && value === 0 && _jsx(NotchIndicator, {})] })), onClick: toggleDrawer(!isDrawerOpen, MOBILE_NAV_PANEL_TYPES.DRAWER),
|
|
120
|
+
// @ts-expect-error
|
|
121
|
+
component: motion.div, animate: isDrawerOpen ? 'open' : 'closed', variants: variantsButtons, "aria-label": isDrawerOpen ? 'Close drawer panel' : 'Open drawer panel', "aria-expanded": isDrawerOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu', style: {
|
|
122
|
+
marginInlineStart: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'auto' : 'initial',
|
|
123
|
+
marginInlineEnd: (hasSearch || hasAvatar) && (mobileNavDirection && mobileNavDirection === 'rtl') ? 'initial' : 'auto'
|
|
124
|
+
} }), hasSearch && (_jsx(StyledBottomNavigationAction, { icon: (_jsxs(_Fragment, { children: [_jsx(ToggleSearchX, {}), showNotchIndicator && value === 1 && _jsx(NotchIndicator, {})] })), onClick: toggleDrawer(!isSearchOpen, MOBILE_NAV_PANEL_TYPES.SEARCH),
|
|
125
|
+
// @ts-expect-error
|
|
126
|
+
component: motion.div, animate: isSearchOpen ? 'open' : 'closed', variants: variantsButtons, "aria-label": isSearchOpen ? 'Close search panel' : 'Open search panel', "aria-expanded": isSearchOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu' })), hasAvatar && (_jsx(StyledBottomNavigationAction, { onClick: toggleDrawer(!isAvatarOpen, MOBILE_NAV_PANEL_TYPES.AVATAR), icon: (_jsxs(_Fragment, { children: [!hideAvatarInitials ? _jsx(StyledAvatar, { children: avatarInitials }) : _jsx(Person, {}), showNotchIndicator && value === 2 && _jsx(NotchIndicator, {})] })),
|
|
127
|
+
// @ts-expect-error
|
|
128
|
+
component: motion.button, variants: variantsButtons, "aria-label": isAvatarOpen ? 'Close Profile Menu' : 'Open Profile Menu', "aria-expanded": isAvatarOpen ? 'true' : 'false', "aria-controls": 'mobile-nav-menu' }))] })) }))] }));
|
|
182
129
|
};
|
|
183
130
|
export default MobileNavigation;
|
|
@@ -7,11 +7,11 @@ export interface IAvatarMenuItemProps {
|
|
|
7
7
|
export interface ISwipeableTemporaryAvatarProps {
|
|
8
8
|
avatarName: string;
|
|
9
9
|
editProfileText?: string;
|
|
10
|
-
logoutText?: string;
|
|
11
10
|
isAvatarOpen: boolean;
|
|
12
11
|
setIsAvatarOpen?: any;
|
|
13
12
|
mobileNavDirection?: string;
|
|
14
13
|
setMobileNavDirection?: any;
|
|
14
|
+
avatarPanelLogoutString?: string;
|
|
15
15
|
avatarPanelOnClickSwitchDirection?: any;
|
|
16
16
|
avatarPanelOnClickLogout?: any;
|
|
17
17
|
avatarPanelOnClickViewProfile?: any;
|
|
@@ -11,7 +11,7 @@ var __assign = (this && this.__assign) || function () {
|
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import React, { useEffect } from 'react';
|
|
14
|
-
import { Box, ButtonGroup,
|
|
14
|
+
import { Box, ButtonGroup, Button, Link, List, ListItem, ListItemIcon, ListItemText } from '../../../index';
|
|
15
15
|
import { StyledSwipeableAvatar, StyledBox, StyledBoxProfile, StyledAvatarName, StyledAvatar, StyledOutlineButton, StyledBoxProfileEdit, StyledListItemButton } from './MobileNavigationAvatarStyles';
|
|
16
16
|
import { useTheme } from '@mui/material/styles';
|
|
17
17
|
import EditIcon from '@mui/icons-material/Edit';
|
|
@@ -24,7 +24,7 @@ import { handleAvatarInitials } from '../../../utils/helpers';
|
|
|
24
24
|
var SwipeableTemporaryAvatar = function (props) {
|
|
25
25
|
var _a;
|
|
26
26
|
var theme = useTheme();
|
|
27
|
-
var avatarName = props.avatarName, mobileNavDirection = props.mobileNavDirection, 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;
|
|
28
28
|
var _b = React.useState(isAvatarOpen !== null && isAvatarOpen !== void 0 ? isAvatarOpen : false), isOpen = _b[0], setIsOpen = _b[1];
|
|
29
29
|
React.useEffect(function () { return handleOpenState(isAvatarOpen); }, [isAvatarOpen]);
|
|
30
30
|
var handleOpenState = function (open) {
|
|
@@ -49,7 +49,7 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
49
49
|
};
|
|
50
50
|
return (_jsx(StyledSwipeableAvatar, __assign({ anchor: 'bottom', open: isOpen, onClose: toggleAvatar(false), hideBackdrop: true, ModalProps: {
|
|
51
51
|
keepMounted: true
|
|
52
|
-
} }, { children: _jsxs(StyledBox, __assign({ animate: isAvatarOpen ? 'open' : 'closed', variants: motionParent }, { children: [avatarPanelOnClickLogout && (_jsx(
|
|
52
|
+
} }, { children: _jsxs(StyledBox, __assign({ animate: isAvatarOpen ? 'open' : 'closed', variants: motionParent }, { children: [avatarPanelOnClickLogout && (_jsx(Button
|
|
53
53
|
// @ts-expect-error
|
|
54
54
|
, __assign({
|
|
55
55
|
// @ts-expect-error
|
|
@@ -58,14 +58,23 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
58
58
|
position: 'absolute',
|
|
59
59
|
right: theme.direction === 'rtl' ? 'auto' : theme.spacing(1),
|
|
60
60
|
top: theme.spacing(1)
|
|
61
|
-
}, onClick:
|
|
61
|
+
}, onClick: function () {
|
|
62
|
+
handleOpenState(false);
|
|
63
|
+
avatarPanelOnClickLogout();
|
|
64
|
+
}, startIcon: _jsx(LogoutIcon, {}), variant: 'text', color: 'inherit' }, { children: avatarPanelLogoutString !== null && avatarPanelLogoutString !== void 0 ? avatarPanelLogoutString : 'Logout' }))), _jsxs(Box, __assign({ style: {
|
|
62
65
|
alignItems: 'center',
|
|
63
66
|
display: 'flex',
|
|
64
67
|
flexDirection: 'column'
|
|
65
68
|
} }, { children: [_jsxs(StyledBoxProfile, __assign({ variants: motionFadeInUp }, { 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({ variants: motionFadeInUp, style: {
|
|
66
69
|
flexDirection: 'row',
|
|
67
70
|
marginBottom: theme.spacing(1)
|
|
68
|
-
} }, { children: _jsxs(ButtonGroup, __assign({ variant: "contained", "aria-label": "split button" }, { children: [_jsx(Button, __assign({ variant: 'contained', color: 'primary', size: 'medium', onClick:
|
|
71
|
+
} }, { children: _jsxs(ButtonGroup, __assign({ variant: "contained", "aria-label": "split button" }, { children: [_jsx(Button, __assign({ variant: 'contained', color: 'primary', size: 'medium', onClick: function () {
|
|
72
|
+
handleOpenState(false);
|
|
73
|
+
avatarPanelOnClickViewProfile();
|
|
74
|
+
} }, { children: avatarPanelViewProfileString !== null && avatarPanelViewProfileString !== void 0 ? avatarPanelViewProfileString : 'View Profile' })), avatarPanelOnClickEditProfile && (_jsx(Button, __assign({ size: 'medium', "aria-label": avatarPanelEditProfileString !== null && avatarPanelEditProfileString !== void 0 ? avatarPanelEditProfileString : 'Edit Profile', onClick: function () {
|
|
75
|
+
handleOpenState(false);
|
|
76
|
+
avatarPanelOnClickEditProfile();
|
|
77
|
+
} }, { children: _jsx(EditIcon, {}) })))] })) })))] })), _jsxs(Box, __assign({ style: {
|
|
69
78
|
alignItems: 'center',
|
|
70
79
|
display: 'flex',
|
|
71
80
|
flexDirection: 'column'
|
|
@@ -79,13 +88,19 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
79
88
|
, __assign({
|
|
80
89
|
// TODO: figure out if these are links or buttons
|
|
81
90
|
// @ts-expect-error
|
|
82
|
-
component: Link, role: 'link', onClick:
|
|
91
|
+
component: Link, role: 'link', onClick: function () {
|
|
92
|
+
handleOpenState(false);
|
|
93
|
+
avatarMenuItem.onClick();
|
|
94
|
+
} }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
83
95
|
minWidth: theme.spacing(5)
|
|
84
96
|
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }))); }) }))), avatarPanelOnClickMainAction && _jsx(StyledOutlineButton
|
|
85
97
|
// @ts-expect-error
|
|
86
98
|
, __assign({
|
|
87
99
|
// @ts-expect-error
|
|
88
|
-
component: motion.button, variants: motionFadeInUp, disablePadding: true, variant: 'outlined', color: 'primary', size: 'medium', onClick:
|
|
100
|
+
component: motion.button, variants: motionFadeInUp, disablePadding: true, variant: 'outlined', color: 'primary', size: 'medium', onClick: function () {
|
|
101
|
+
handleOpenState(false);
|
|
102
|
+
avatarPanelOnClickMainAction();
|
|
103
|
+
} }, { children: avatarPanelMainActionString })), _jsxs(List, __assign({ style: { marginBottom: theme.spacing(2) } }, { children: [avatarPanelSettingItems &&
|
|
89
104
|
avatarPanelSettingItems.length > 0 &&
|
|
90
105
|
avatarPanelSettingItems.map(function (avatarMenuItem) { return (_jsx(ListItem, __assign({ component: motion.div, variants: motionFadeInUp, whileHover: motionWhileHover, whileTap: motionWhileTap, disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
91
106
|
// TODO: figure out if these are links or buttons
|
|
@@ -93,7 +108,10 @@ var SwipeableTemporaryAvatar = function (props) {
|
|
|
93
108
|
, __assign({
|
|
94
109
|
// TODO: figure out if these are links or buttons
|
|
95
110
|
// @ts-expect-error
|
|
96
|
-
component: Link, role: 'link', onClick:
|
|
111
|
+
component: Link, role: 'link', onClick: function () {
|
|
112
|
+
handleOpenState(false);
|
|
113
|
+
avatarMenuItem.onClick();
|
|
114
|
+
} }, { children: [_jsx(ListItemIcon, __assign({ "aria-hidden": true, style: {
|
|
97
115
|
minWidth: theme.spacing(5)
|
|
98
116
|
} }, { children: avatarMenuItem.icon })), _jsx(ListItemText, { primary: avatarMenuItem.label })] })) }))); }), avatarPanelOnClickSwitchDirection && (_jsx(ListItem, __assign({ component: motion.div, variants: motionFadeInUp, whileHover: motionWhileHover, whileTap: motionWhileTap, disablePadding: true }, { children: _jsxs(StyledListItemButton
|
|
99
117
|
// TODO: figure out if these are links or buttons
|
|
@@ -17,14 +17,13 @@ import { StyledSwipeableDrawer, StyledBox, StyledListItem, StyledDivider, Styled
|
|
|
17
17
|
import { StreamSuiteLogo } from '../../../assets/Images';
|
|
18
18
|
import { motion } from 'framer-motion';
|
|
19
19
|
export default function SwipeableTemporaryDrawer(props) {
|
|
20
|
-
var isDrawerOpen = props.isDrawerOpen, setIsDrawerOpen = props.setIsDrawerOpen, items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick
|
|
20
|
+
var isDrawerOpen = props.isDrawerOpen, setIsDrawerOpen = props.setIsDrawerOpen, items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick;
|
|
21
21
|
var theme = useTheme();
|
|
22
22
|
var _a = React.useState(isDrawerOpen !== null && isDrawerOpen !== void 0 ? isDrawerOpen : false), isOpen = _a[0], setIsOpen = _a[1];
|
|
23
23
|
React.useEffect(function () { return handleOpenState(isDrawerOpen); }, [isDrawerOpen]);
|
|
24
24
|
var handleOpenState = function (open) {
|
|
25
25
|
setIsOpen(open);
|
|
26
26
|
setIsDrawerOpen(open);
|
|
27
|
-
console.log(children);
|
|
28
27
|
};
|
|
29
28
|
var toggleDrawer = function (open) {
|
|
30
29
|
return function (event) {
|
|
@@ -108,7 +107,7 @@ export default function SwipeableTemporaryDrawer(props) {
|
|
|
108
107
|
};
|
|
109
108
|
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, animate: isDrawerOpen ? 'open' : 'closed', variants: variantsLogo, whileHover: { scale: 1.02 }, whileTap: { scale: 0.95 } }, { children: [logo
|
|
110
109
|
? typeof logo === 'string'
|
|
111
|
-
? (_jsx("img", { height:
|
|
110
|
+
? (_jsx("img", { height: 38, width: 38, src: logo, alt: logoText !== null && logoText !== void 0 ? logoText : 'Site Logo' }))
|
|
112
111
|
: logo
|
|
113
112
|
: (_jsx(StreamSuiteLogo, { style: {
|
|
114
113
|
fill: theme.palette.mode === 'dark'
|
|
@@ -132,7 +131,7 @@ export default function SwipeableTemporaryDrawer(props) {
|
|
|
132
131
|
// @ts-expect-error
|
|
133
132
|
, __assign({
|
|
134
133
|
// @ts-expect-error
|
|
135
|
-
component: motion.button, variants: variantsLi, whileHover: { scale: 1.02 }, whileTap: { scale: 0.95 } },
|
|
134
|
+
component: motion.button, variants: variantsLi, whileHover: { scale: 1.02 }, whileTap: { scale: 0.95 } }, childItem, { children: _jsx(StyledChildListItemText, { primary: childItem.label }, childItem.label) })) }), childItem.label)); }) })))] }), label));
|
|
136
135
|
}) })), secondaryItems && secondaryItems.length > 0 && (_jsxs(_Fragment, { children: [_jsx(motion.div, __assign({ animate: isDrawerOpen ? 'open' : 'closed', variants: variantsDivider }, { children: _jsx(StyledDivider, {}) })), _jsx(StyledListSecondaryList
|
|
137
136
|
// @ts-expect-error
|
|
138
137
|
, __assign({
|