@learningpool/ui 1.11.4 → 1.12.1

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.
@@ -49,10 +49,11 @@ import { animated } from '@react-spring/web';
49
49
  import { defaultMessages } from '../../../lang/en-us';
50
50
  import { defaultAttributes } from '../../../utils/dataAttributes';
51
51
  import { getDefaultSupportLinks, getNavigationBackground, getNavigationContrastText } from '../helpers';
52
+ import { Constants } from '../../stream/AppSwitcher/constants';
52
53
  var VerticalNavigation = function (props) {
53
54
  var _a;
54
55
  var theme = useTheme();
55
- var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, dataAttributes = props.dataAttributes, showSupportLinks = props.showSupportLinks, avatarPanelShowHelpLinks = props.avatarPanelShowHelpLinks, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName", "dataAttributes", "showSupportLinks", "avatarPanelShowHelpLinks"]);
56
+ var items = props.items, secondaryItems = props.secondaryItems, logo = props.logo, logoText = props.logoText, logoOnClick = props.logoOnClick, appRootID = props.appRootID, hasStreamHome = props.hasStreamHome, hideStreamHomeButton = props.hideStreamHomeButton, StreamHomeUrl = props.StreamHomeUrl, streamHomeApiKey = props.streamHomeApiKey, streamHomeBaseUrl = props.streamHomeBaseUrl, localization = props.localization, streamHomeAccessToken = props.streamHomeAccessToken, streamHomeApplications = props.streamHomeApplications, avatarName = props.avatarName, dataAttributes = props.dataAttributes, showSupportLinks = props.showSupportLinks, avatarPanelShowHelpLinks = props.avatarPanelShowHelpLinks, rest = __rest(props, ["items", "secondaryItems", "logo", "logoText", "logoOnClick", "appRootID", "hasStreamHome", "hideStreamHomeButton", "StreamHomeUrl", "streamHomeApiKey", "streamHomeBaseUrl", "localization", "streamHomeAccessToken", "streamHomeApplications", "avatarName", "dataAttributes", "showSupportLinks", "avatarPanelShowHelpLinks"]);
56
57
  var messages = __assign(__assign({}, defaultMessages), localization);
57
58
  var dataIds = __assign(__assign({}, defaultAttributes), dataAttributes);
58
59
  var propIsDrawerOpen = typeof (props === null || props === void 0 ? void 0 : props.isDrawerOpen) === 'boolean' ? props.isDrawerOpen : undefined;
@@ -223,7 +224,7 @@ var VerticalNavigation = function (props) {
223
224
  var _a;
224
225
  return (_createElement(VerticalNavigationItem, __assign({}, item, { "data-id": dataIds.VerticalNavigationSecondaryListItem, key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + index + 1] })));
225
226
  }), hasStreamHome
226
- ? (_jsx(VerticalNavigationItem, { "data-id": dataIds.VerticalNavigationAppSwitcherToggle, label: messages['app-switcher'], icon: _jsx(Apps, {}), onClick: handleToggleAppsClick, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, setIsAppSwitcherOpen: setIsAppSwitcherOpen, applications: streamHomeApplications, apiKey: streamHomeApiKey !== null && streamHomeApiKey !== void 0 ? streamHomeApiKey : '', baseUrl: streamHomeBaseUrl !== null && streamHomeBaseUrl !== void 0 ? streamHomeBaseUrl : '', token: streamHomeAccessToken !== null && streamHomeAccessToken !== void 0 ? streamHomeAccessToken : '', isDrawerOpen: isDrawerOpen })), isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, hasCustomContent: true, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + ((_b = defaultSupportLinks === null || defaultSupportLinks === void 0 ? void 0 : defaultSupportLinks.length) !== null && _b !== void 0 ? _b : 0) + 1] }))
227
+ ? (_jsx(VerticalNavigationItem, { "data-id": dataIds.VerticalNavigationAppSwitcherToggle, label: messages['app-switcher'], icon: _jsx(Apps, {}), onClick: handleToggleAppsClick, content: (_jsx(AppSwitcher, { isAppSwitcherOpen: isAppSwitcherOpen, setIsAppSwitcherOpen: setIsAppSwitcherOpen, applications: streamHomeApplications, apiKey: streamHomeApiKey !== null && streamHomeApiKey !== void 0 ? streamHomeApiKey : '', baseUrl: streamHomeBaseUrl !== null && streamHomeBaseUrl !== void 0 ? streamHomeBaseUrl : '', token: streamHomeAccessToken !== null && streamHomeAccessToken !== void 0 ? streamHomeAccessToken : '', isDrawerOpen: isDrawerOpen, hideStreamHomeButton: hideStreamHomeButton || false, StreamHomeUrl: StreamHomeUrl !== null && StreamHomeUrl !== void 0 ? StreamHomeUrl : Constants.DefaultStreamHomeUrl })), isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, hasCustomContent: true, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + ((_b = defaultSupportLinks === null || defaultSupportLinks === void 0 ? void 0 : defaultSupportLinks.length) !== null && _b !== void 0 ? _b : 0) + 1] }))
227
228
  : null, secondaryItems && secondaryItems.length > 0 && secondaryItems.map(function (item, index) {
228
229
  var _a, _b;
229
230
  return (_createElement(VerticalNavigationItem, __assign({}, item, { "data-id": dataIds.VerticalNavigationSecondaryListItem, key: "".concat(item.label, " - ").concat(index), index: index, isDrawerOpen: isDrawerOpen || isPersistent, isSecondary: true, style: animationRefs.current[((_a = items === null || items === void 0 ? void 0 : items.length) !== null && _a !== void 0 ? _a : 0) + ((_b = defaultSupportLinks === null || defaultSupportLinks === void 0 ? void 0 : defaultSupportLinks.length) !== null && _b !== void 0 ? _b : 0) + index + 1] })));
@@ -22,6 +22,8 @@ interface IProps {
22
22
  setIsAppSwitcherOpen?: any;
23
23
  isDrawerOpen?: boolean;
24
24
  dataAttributes?: any;
25
+ StreamHomeUrl?: string;
26
+ hideStreamHomeButton?: boolean;
25
27
  }
26
28
  declare const AppSwitcher: {
27
29
  (props: IProps): ReactElement | null;
@@ -51,9 +51,10 @@ import PropTypes from 'prop-types';
51
51
  import jwtDecode from 'jwt-decode';
52
52
  import * as queryString from 'query-string';
53
53
  import AppSwitcherItem, { LogoVariants } from './AppSwitcherItem';
54
- import { AppListHeader, AppListItem, AppOrganisationCount, StyledSVG, BackButton, MenuContent, OrganisationLink, OrganisationList, SearchBox, SearchContent, SelectedOrganisation, AppSwitcherPanel } from './AppSwitcherStyles';
54
+ import { AppListHeader, AppListItem, AppOrganisationCount, StyledSVG, BackButton, MenuContent, OrganisationLink, OrganisationList, SearchBox, SearchContent, SelectedOrganisation, AppSwitcherPanel, StyleHomeButton } from './AppSwitcherStyles';
55
55
  import { Constants } from './constants';
56
56
  import { defaultAttributes } from '../../../utils/dataAttributes';
57
+ import ChevronRightIcon from '@mui/icons-material/ChevronRight';
57
58
  var AppSwitcher = function (props) {
58
59
  var _a;
59
60
  var isAppSwitcherOpen = props.isAppSwitcherOpen, setIsAppSwitcherOpen = props.setIsAppSwitcherOpen, isDrawerOpen = props.isDrawerOpen, localization = props.localization, dataAttributes = props.dataAttributes, _b = props.apiKey, apiKey = _b === void 0 ? '' : _b, baseUrl = props.baseUrl;
@@ -269,7 +270,8 @@ var AppSwitcher = function (props) {
269
270
  display: isAppSwitcherOpen ? 'block' : 'none',
270
271
  left: isDrawerOpen ? Constants.DrawerWidth.Expanded : Constants.DrawerWidth.Collapsed - 3
271
272
  }, role: 'dialog', "aria-label": "App Switcher", onKeyDown: handleKeyDown, "data-id": dataIds.AppSwitcherContainer }, { children: [activeTab === Constants.Tabs.ListApplications
272
- ? (_jsxs("div", { children: [_jsxs(AppListHeader, __assign({ "data-id": dataIds.AppSwitcherHeader }, { children: [_jsx("svg", { children: _jsx("image", { xlinkHref: "".concat(Constants.AssetsUrl, "suite/logo/latest/icon.svg"), width: "24", height: "24" }) }), messages['your-apps']] })), _jsx(MenuContent, __assign({ style: {
273
+ ? (_jsxs("div", { children: [_jsxs(AppListHeader, __assign({ "data-id": dataIds.AppSwitcherHeader }, { children: [messages['your-apps'], !props.hideStreamHomeButton &&
274
+ _jsx(StyleHomeButton, __assign({ "aria-label": messages['go-to-hub'], endIcon: _jsx(ChevronRightIcon, {}), onClick: function (e) { var _a; return window.open((_a = props.StreamHomeUrl) !== null && _a !== void 0 ? _a : Constants.DefaultStreamHomeUrl); } }, { children: messages['go-to-hub'] }))] })), _jsx(MenuContent, __assign({ style: {
273
275
  display: activeTab === 1 ? 'flex' : 'none'
274
276
  }, "data-id": dataIds.AppSwitcherList }, { children: applications.map(function (_a) {
275
277
  var applicationId = _a.applicationId, applicationName = _a.applicationName, shortName = _a.shortName, customName = _a.customName, internalName = _a.internalName, url = _a.url, children = _a.children;
@@ -15,3 +15,36 @@ export declare const StyledSVG: import("@emotion/styled").StyledComponent<import
15
15
  export declare const OrganisationList: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
16
16
  export declare const OrganisationLink: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, {}>;
17
17
  export declare const StyledLogoSVG: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGSVGElement>, {}>;
18
+ export declare const StyleHomeButton: import("@emotion/styled").StyledComponent<{
19
+ children?: import("react").ReactNode;
20
+ classes?: Partial<import("@mui/material/Button").ButtonClasses> | undefined;
21
+ color?: "inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning" | undefined;
22
+ disabled?: boolean | undefined;
23
+ disableElevation?: boolean | undefined;
24
+ disableFocusRipple?: boolean | undefined;
25
+ endIcon?: import("react").ReactNode;
26
+ fullWidth?: boolean | undefined;
27
+ href?: string | undefined;
28
+ size?: "small" | "large" | "medium" | undefined;
29
+ startIcon?: import("react").ReactNode;
30
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
31
+ variant?: "text" | "outlined" | "contained" | undefined;
32
+ } & Omit<{
33
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
34
+ centerRipple?: boolean | undefined;
35
+ children?: import("react").ReactNode;
36
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
37
+ disabled?: boolean | undefined;
38
+ disableRipple?: boolean | undefined;
39
+ disableTouchRipple?: boolean | undefined;
40
+ focusRipple?: boolean | undefined;
41
+ focusVisibleClassName?: string | undefined;
42
+ LinkComponent?: import("react").ElementType<any> | undefined;
43
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
44
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
45
+ tabIndex?: number | undefined;
46
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
47
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
48
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
49
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
50
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "sx" | "variant" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "href" | "size" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -3,6 +3,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  return cooked;
4
4
  };
5
5
  import { styled } from '@mui/material/styles';
6
+ import Button from '@mui/material/Button';
6
7
  export var AppSwitcherPanel = styled('div')(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n border-radius: 0 4px 4px 0;\n bottom: 0;\n box-shadow: ", ";\n box-sizing: border-box;\n font-family: 'Roboto';\n height: 450px;\n left: ", ";\n right: ", ";\n overflow: auto;\n overflow-x: hidden;\n padding: 1rem 1.5rem;\n position: fixed;\n width: 360px;\n z-index: 1;\n\n & > div {\n padding-bottom: 3rem;\n }\n"], ["\n background-color: ", ";\n border-radius: 0 4px 4px 0;\n bottom: 0;\n box-shadow: ", ";\n box-sizing: border-box;\n font-family: 'Roboto';\n height: 450px;\n left: ", ";\n right: ", ";\n overflow: auto;\n overflow-x: hidden;\n padding: 1rem 1.5rem;\n position: fixed;\n width: 360px;\n z-index: 1;\n\n & > div {\n padding-bottom: 3rem;\n }\n"])), function (props) { return props.theme.palette.mode === 'dark'
7
8
  ? props.theme.palette.primary.dark
8
9
  : '#E6EAF0'; }, function (props) { return props.theme.direction === 'ltr'
@@ -11,7 +12,7 @@ export var AppSwitcherPanel = styled('div')(templateObject_1 || (templateObject_
11
12
  export var List = styled('ul')(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n"], ["\n"])));
12
13
  export var MenuContent = styled('div')(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n align-items: flex-start;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n margin-top: 1rem;\n"], ["\n align-items: flex-start;\n flex-direction: row;\n flex-wrap: wrap;\n justify-content: flex-start;\n margin-top: 1rem;\n"])));
13
14
  export var SearchContent = styled('div')(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n align-items: flex-start;\n box-sizing: border-box;\n flex-direction: column;\n justify-content: flex-start;\n padding: 1rem 1rem 2rem;\n"], ["\n align-items: flex-start;\n box-sizing: border-box;\n flex-direction: column;\n justify-content: flex-start;\n padding: 1rem 1rem 2rem;\n"])));
14
- export var AppListHeader = styled('div')(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n align-items: center;\n color: ", ";\n display: flex;\n font-size: 1.2rem;\n font-weight: normal;\n justify-content: flex-start;\n padding: 1rem 1.25rem 0;\n\n & svg {\n height: 24px;\n margin-inline-end: 0.5rem;\n width: 24px;\n }\n"], ["\n align-items: center;\n color: ", ";\n display: flex;\n font-size: 1.2rem;\n font-weight: normal;\n justify-content: flex-start;\n padding: 1rem 1.25rem 0;\n\n & svg {\n height: 24px;\n margin-inline-end: 0.5rem;\n width: 24px;\n }\n"])), function (props) { return props.theme.palette.mode === 'dark'
15
+ export var AppListHeader = styled('div')(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n align-items: center;\n color: ", ";\n display: flex;\n font-weight: normal;\n justify-content: space-between;\n padding: 1rem 1.25rem 0;\n\n & svg {\n height: 24px;\n margin-inline-end: 0.5rem;\n width: 24px;\n }\n"], ["\n align-items: center;\n color: ", ";\n display: flex;\n font-weight: normal;\n justify-content: space-between;\n padding: 1rem 1.25rem 0;\n\n & svg {\n height: 24px;\n margin-inline-end: 0.5rem;\n width: 24px;\n }\n"])), function (props) { return props.theme.palette.mode === 'dark'
15
16
  ? props.theme.palette.primary.contrastText
16
17
  : '#555'; });
17
18
  export var AppListItem = styled('div')(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n align-items: center;\n align-self: stretch;\n box-sizing: border-box;\n flex-direction: column;\n flex: 0 0 ", "%;\n height: 104px;\n overflow: visible;\n padding: 0.25rem;\n position: relative;\n\n &:hover {\n background-color: transparent;\n }\n"], ["\n align-items: center;\n align-self: stretch;\n box-sizing: border-box;\n flex-direction: column;\n flex: 0 0 ", "%;\n height: 104px;\n overflow: visible;\n padding: 0.25rem;\n position: relative;\n\n &:hover {\n background-color: transparent;\n }\n"])), 100 / 3);
@@ -47,4 +48,5 @@ export var StyledLogoSVG = styled('svg')(templateObject_16 || (templateObject_16
47
48
  : '#E6EAF0'; }, function (props) { return props.theme.palette.mode === 'dark'
48
49
  ? props.theme.palette.primary.dark
49
50
  : '#E6EAF0'; });
50
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16;
51
+ export var StyleHomeButton = styled(Button)(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n align-items: center;\n color: #00538e;\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n text-decoration: none;\n text-transform: none;\n\n &:hover {\n background-color: transparent;\n }\n"], ["\n align-items: center;\n color: #00538e;\n display: flex;\n flex-wrap: wrap;\n margin: 0;\n padding: 0;\n text-decoration: none;\n text-transform: none;\n\n &:hover {\n background-color: transparent;\n }\n"])));
52
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
@@ -19,6 +19,7 @@ export declare const Constants: Readonly<{
19
19
  DefaultMessages: {
20
20
  'app-switcher': string;
21
21
  'your-apps': string;
22
+ 'go-to-hub': string;
22
23
  'custom-apps': string;
23
24
  'add-item': string;
24
25
  'lp-apps': string;
@@ -35,6 +36,7 @@ export declare const Constants: Readonly<{
35
36
  Collapsed: number;
36
37
  Expanded: number;
37
38
  };
39
+ DefaultStreamHomeUrl: "https://home.learningpool.com";
38
40
  }>;
39
41
  export declare const applications: ({
40
42
  applicationId: number;
@@ -19,6 +19,7 @@ export var Constants = Object.freeze({
19
19
  DefaultMessages: {
20
20
  'app-switcher': 'App Switcher',
21
21
  'your-apps': 'Your Apps',
22
+ 'go-to-hub': 'Go to Hub',
22
23
  'custom-apps': 'Explore Custom Apps',
23
24
  'add-item': 'Add item',
24
25
  'lp-apps': 'Explore Learning Pool Apps',
@@ -34,7 +35,8 @@ export var Constants = Object.freeze({
34
35
  DrawerWidth: {
35
36
  Collapsed: 60,
36
37
  Expanded: 300
37
- }
38
+ },
39
+ DefaultStreamHomeUrl: 'https://home.learningpool.com'
38
40
  });
39
41
  export var applications = [
40
42
  { applicationId: 1, applicationName: 'Stream LXP', shortName: 'LXP', internalName: 'stream', url: 'https://learningpool.com' },
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "components",
10
10
  "ui"
11
11
  ],
12
- "version": "1.11.4",
12
+ "version": "1.12.1",
13
13
  "private": false,
14
14
  "main": "index.js",
15
15
  "module": "index.js",
@@ -24,6 +24,8 @@ export interface IVerticalNavigationProps {
24
24
  items?: IVerticalNavigationItemProps[];
25
25
  secondaryItems?: IVerticalNavigationItemProps[];
26
26
  hasStreamHome?: boolean;
27
+ hideStreamHomeButton?: boolean;
28
+ StreamHomeUrl?: string;
27
29
  streamHomeAccessToken?: string;
28
30
  streamHomeBaseUrl?: string;
29
31
  streamHomeApiKey?: string;