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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/components/navigation/MobileNavigation/MobileNavigation.d.ts +39 -0
  2. package/components/navigation/MobileNavigation/MobileNavigation.js +188 -0
  3. package/components/navigation/MobileNavigation/MobileNavigationAvatar.d.ts +28 -0
  4. package/components/navigation/MobileNavigation/MobileNavigationAvatar.js +124 -0
  5. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.d.ts +827 -0
  6. package/components/navigation/MobileNavigation/MobileNavigationAvatarStyles.js +33 -0
  7. package/components/navigation/MobileNavigation/MobileNavigationDrawer.d.ts +24 -0
  8. package/components/navigation/MobileNavigation/MobileNavigationDrawer.js +148 -0
  9. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.d.ts +392 -0
  10. package/components/navigation/MobileNavigation/MobileNavigationDrawerStyles.js +44 -0
  11. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.d.ts +19 -0
  12. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItem.js +91 -0
  13. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.d.ts +15 -0
  14. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenu.js +26 -0
  15. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.d.ts +112 -0
  16. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemFlyoutMenuStyles.js +66 -0
  17. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.d.ts +126 -0
  18. package/components/navigation/MobileNavigation/MobileNavigationItem/MobileNavigationItemStyles.js +71 -0
  19. package/components/navigation/MobileNavigation/MobileNavigationMotion.d.ts +141 -0
  20. package/components/navigation/MobileNavigation/MobileNavigationMotion.js +109 -0
  21. package/components/navigation/MobileNavigation/MobileNavigationSearch.d.ts +10 -0
  22. package/components/navigation/MobileNavigation/MobileNavigationSearch.js +52 -0
  23. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.d.ts +257 -0
  24. package/components/navigation/MobileNavigation/MobileNavigationSearchStyles.js +20 -0
  25. package/components/navigation/MobileNavigation/MobileNavigationStyles.d.ts +405 -0
  26. package/components/navigation/MobileNavigation/MobileNavigationStyles.js +104 -0
  27. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.d.ts +2 -0
  28. package/components/navigation/MobileNavigation/MobileNavigationToggleSearchX.js +32 -0
  29. package/components/navigation/MobileNavigation/MobileNavigationToggleX.d.ts +2 -0
  30. package/components/navigation/MobileNavigation/MobileNavigationToggleX.js +26 -0
  31. package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.d.ts +36 -0
  32. package/components/navigation/MobileNavigation/MobileNavigationToggleXStyles.js +10 -0
  33. package/components/navigation/VerticalNavigation/VerticalNavigation.js +1 -12
  34. package/components/navigation/VerticalNavigation/VerticalNavigationStyles.js +1 -1
  35. package/index.d.ts +1 -0
  36. package/index.js +1 -0
  37. package/package.json +3 -2
  38. package/utils/constants.d.ts +5 -0
  39. package/utils/constants.js +5 -0
  40. package/utils/helpers.d.ts +6 -0
  41. package/utils/helpers.js +17 -0
  42. package/utils/hooks.d.ts +1 -0
  43. package/utils/hooks.js +29 -0
@@ -0,0 +1,2 @@
1
+ import * as React from 'react';
2
+ export declare const ToggleX: () => React.ReactElement;
@@ -0,0 +1,26 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { motion } from 'framer-motion';
14
+ var Path = function (props) { return (_jsx(motion.path, __assign({ fill: 'transparent', strokeWidth: '3', stroke: 'inherit', strokeLinecap: 'round' }, props))); };
15
+ export var ToggleX = function () {
16
+ return (_jsxs("svg", __assign({ width: "40", height: "40", viewBox: "0 0 50 50" }, { children: [_jsx(Path, { variants: {
17
+ closed: { d: 'M 10 15 L 40 15' },
18
+ open: { d: 'M 15 15 L 35 35' }
19
+ } }), _jsx(Path, { d: 'M 10 25 L 40 25', variants: {
20
+ closed: { opacity: 1, scale: 1 },
21
+ open: { opacity: 0, scale: 0 }
22
+ } }), _jsx(Path, { variants: {
23
+ closed: { d: 'M 10 35 L 40 35' },
24
+ open: { d: 'M 15 35 L 35 15' }
25
+ } })] })));
26
+ };
@@ -0,0 +1,36 @@
1
+ /// <reference types="react" />
2
+ export declare const StyledButtonBase: import("@emotion/styled").StyledComponent<{
3
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
4
+ centerRipple?: boolean | undefined;
5
+ children?: import("react").ReactNode;
6
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
7
+ disabled?: boolean | undefined;
8
+ disableRipple?: boolean | undefined;
9
+ disableTouchRipple?: boolean | undefined;
10
+ focusRipple?: boolean | undefined;
11
+ focusVisibleClassName?: string | undefined;
12
+ LinkComponent?: import("react").ElementType<any> | undefined;
13
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
14
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
15
+ tabIndex?: number | undefined;
16
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
17
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
18
+ } & Omit<{
19
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
20
+ centerRipple?: boolean | undefined;
21
+ children?: import("react").ReactNode;
22
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
23
+ disabled?: boolean | undefined;
24
+ disableRipple?: boolean | undefined;
25
+ disableTouchRipple?: boolean | undefined;
26
+ focusRipple?: boolean | undefined;
27
+ focusVisibleClassName?: string | undefined;
28
+ LinkComponent?: import("react").ElementType<any> | undefined;
29
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
30
+ sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
31
+ tabIndex?: number | undefined;
32
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
33
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
34
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
35
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
36
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "sx" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
@@ -0,0 +1,10 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ import { ButtonBase } from '../../../index';
6
+ import { styled } from '@mui/material/styles';
7
+ export var StyledButtonBase = styled(ButtonBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n stroke: ", ";\n padding: 0px;\n min-width: 80px;\n max-width: 168px;\n height: 56px;\n"], ["\n stroke: ", ";\n padding: 0px;\n min-width: 80px;\n max-width: 168px;\n height: 56px;\n"])), function (props) { return props.theme.palette.mode === 'dark'
8
+ ? props.theme.palette.primary.contrastText
9
+ : props.theme.palette.text.primary; });
10
+ var templateObject_1;
@@ -22,6 +22,7 @@ import { DRAWER_WIDTH, DrawerHeader, DrawerToggle, DrawerToggleHitboxContent, St
22
22
  import { ListItem, ListItemButton, ListItemIcon, ListItemText } from './VerticalNavigationItem/VerticalNavigationItemStyles';
23
23
  import AvatarPanel from './AvatarPanel';
24
24
  import { motion } from '../../../utils/theme';
25
+ import { handleAvatarInitials } from '../../../utils/helpers';
25
26
  var VerticalNavigation = function (props) {
26
27
  var _a, _b;
27
28
  var theme = useTheme();
@@ -45,18 +46,6 @@ var VerticalNavigation = function (props) {
45
46
  }
46
47
  setIsPersistent(propIsPersistent !== null && propIsPersistent !== void 0 ? propIsPersistent : false);
47
48
  };
48
- var handleAvatarInitials = function (avatarName) {
49
- var _a, _b;
50
- var firstInitial = avatarName.split('')[0] || '';
51
- var secondInitial = '';
52
- if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
53
- firstInitial = avatarName.split(' ')[0][0];
54
- if (((_b = avatarName.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
55
- secondInitial = avatarName === null || avatarName === void 0 ? void 0 : avatarName.split(' ')[1][0];
56
- }
57
- }
58
- return "".concat(firstInitial).concat(secondInitial);
59
- };
60
49
  var _e = React.useState((_b = handleAvatarInitials(avatarName)) !== null && _b !== void 0 ? _b : 'AN'), avatarInitials = _e[0], setAvatarInitials = _e[1];
61
50
  var toggleDrawer = function (open) { return function (event) {
62
51
  event === null || event === void 0 ? void 0 : event.stopPropagation();
@@ -80,7 +80,7 @@ export var NotchSeemMask = styled(Box)(templateObject_12 || (templateObject_12 =
80
80
  : props.theme.palette.background.paper; });
81
81
  export var StyledDrawer = styled(Drawer, {
82
82
  shouldForwardProp: function (prop) { return prop !== 'open'; }
83
- })(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible;\n width: ", ";\n \n [theme.breakpoints.up('sm')] {\n width: ", ";\n }\n }\n"], ["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible;\n width: ", ";\n \n [theme.breakpoints.up('sm')] {\n width: ", ";\n }\n }\n"])), motion.easeInOut, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) { return props.theme.breakpoints.values.sm; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(8), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) {
83
+ })(templateObject_13 || (templateObject_13 = __makeTemplateObject(["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible;\n width: ", ";\n [theme.breakpoints.up('sm')] {\n width: ", ";\n }\n }\n"], ["\n box-shadow: none;\n box-sizing: border-box;\n flexshrink: 0;\n overflow-x: visible;\n transition: width 225ms ", " 0ms !important;\n white-space: nowrap;\n width: ", ";\n\n @media (min-width: ", ") {\n width: ", ";\n }\n\n .MuiDrawer-paper {\n background: transparent none;\n border: 0;\n box-shadow: none;\n color: ", ";\n overflow: visible !important;\n overflow-x: visible;\n transform: translateX(0) !important;\n transition: width 225ms ", " 0ms !important;\n visibility: visible;\n width: ", ";\n [theme.breakpoints.up('sm')] {\n width: ", ";\n }\n }\n"])), motion.easeInOut, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(7), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) { return props.theme.breakpoints.values.sm; }, function (props) { return !props.open ? "calc(".concat(props.theme.spacing(8), " + 1px)") : "".concat(DRAWER_WIDTH.Expanded, "px"); }, function (props) {
84
84
  return props.theme.palette.mode === 'dark'
85
85
  ? props.theme.palette.primary.contrastText
86
86
  : props.theme.palette.getContrastText(props.theme.palette.background.paper);
package/index.d.ts CHANGED
@@ -128,4 +128,5 @@ export { default as List } from './components/datadisplay/List/List';
128
128
  export { default as Tooltip } from './components/datadisplay/Tooltip/Tooltip';
129
129
  export { default as SideInSide } from './components/pages/SideInSide/SideInSide';
130
130
  export { default as ErrorPage } from './components/pages/ErrorPage/ErrorPage';
131
+ export { default as MobileNavigation } from './components/navigation/MobileNavigation/MobileNavigation';
131
132
  export { default as VerticalNavigation } from './components/navigation/VerticalNavigation/VerticalNavigation';
package/index.js CHANGED
@@ -140,4 +140,5 @@ export { default as Tooltip } from './components/datadisplay/Tooltip/Tooltip';
140
140
  export { default as SideInSide } from './components/pages/SideInSide/SideInSide';
141
141
  export { default as ErrorPage } from './components/pages/ErrorPage/ErrorPage';
142
142
  // Stream Suite components
143
+ export { default as MobileNavigation } from './components/navigation/MobileNavigation/MobileNavigation';
143
144
  export { default as VerticalNavigation } from './components/navigation/VerticalNavigation/VerticalNavigation';
package/package.json CHANGED
@@ -9,14 +9,14 @@
9
9
  "components",
10
10
  "ui"
11
11
  ],
12
- "version": "1.6.0-beta.3",
12
+ "version": "1.6.0-beta.4",
13
13
  "private": false,
14
14
  "main": "index.js",
15
15
  "module": "index.js",
16
16
  "dependencies": {
17
17
  "@emotion/react": "^11.7.1",
18
18
  "@emotion/styled": "^11.6.0",
19
- "@learningpool/app-switcher": "1.1.0-beta.2",
19
+ "@learningpool/app-switcher": "1.1.0-beta.4",
20
20
  "@mui/icons-material": "^5.8.4",
21
21
  "@mui/material": "^5.8.5",
22
22
  "@mui/x-data-grid": "^5.12.3",
@@ -28,6 +28,7 @@
28
28
  "anysort": "^2.0.0",
29
29
  "eslint-plugin-n": "^15.2.4",
30
30
  "focus-trap-react": "^8.11.0",
31
+ "framer-motion": "^6.5.1",
31
32
  "tss-react": "^3.3.6",
32
33
  "typescript": "^4.6.2",
33
34
  "web-vitals": "^2.1.4"
@@ -0,0 +1,5 @@
1
+ export declare const MOBILE_NAV_PANEL_TYPES: {
2
+ DRAWER: string;
3
+ SEARCH: string;
4
+ AVATAR: string;
5
+ };
@@ -0,0 +1,5 @@
1
+ export var MOBILE_NAV_PANEL_TYPES = {
2
+ DRAWER: 'drawer',
3
+ SEARCH: 'search',
4
+ AVATAR: 'avatar'
5
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Accepts a string and returns 2 characters (max) as initials e.g. AN from Avatar Name
3
+ * @param avatarName string - Expected full name but accepts any string
4
+ * @returns string
5
+ */
6
+ export declare const handleAvatarInitials: (avatarName: string) => string;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Accepts a string and returns 2 characters (max) as initials e.g. AN from Avatar Name
3
+ * @param avatarName string - Expected full name but accepts any string
4
+ * @returns string
5
+ */
6
+ export var handleAvatarInitials = function (avatarName) {
7
+ var _a, _b;
8
+ var firstInitial = avatarName.split('')[0] || '';
9
+ var secondInitial = '';
10
+ if (((_a = avatarName.split(' ')) === null || _a === void 0 ? void 0 : _a.length) > 1) {
11
+ firstInitial = avatarName.split(' ')[0][0];
12
+ if (((_b = avatarName.split(' ')[1]) === null || _b === void 0 ? void 0 : _b.length) > 0) {
13
+ secondInitial = avatarName === null || avatarName === void 0 ? void 0 : avatarName.split(' ')[1][0];
14
+ }
15
+ }
16
+ return "".concat(firstInitial).concat(secondInitial);
17
+ };
@@ -0,0 +1 @@
1
+ export declare const useCurrentWidth: () => number;
package/utils/hooks.js ADDED
@@ -0,0 +1,29 @@
1
+ import { useState, useEffect } from 'react';
2
+ var getWidth = function () {
3
+ var _a, _b;
4
+ return (_b = (_a = window.innerWidth) !== null && _a !== void 0 ? _a : document.documentElement.clientWidth) !== null && _b !== void 0 ? _b : document.body.clientWidth;
5
+ };
6
+ export var useCurrentWidth = function () {
7
+ // save current window width in the state object
8
+ var _a = useState(getWidth()), width = _a[0], setWidth = _a[1];
9
+ // in this case useEffect will execute only once because
10
+ // it does not have any dependencies.
11
+ useEffect(function () {
12
+ // timeoutId for debounce mechanism
13
+ var timeoutId;
14
+ var resizeListener = function () {
15
+ // prevent execution of previous setTimeout
16
+ clearTimeout(timeoutId);
17
+ // change width from the state object after 150 milliseconds
18
+ timeoutId = setTimeout(function () { return setWidth(getWidth()); }, 150);
19
+ };
20
+ // set resize listener
21
+ window.addEventListener('resize', resizeListener);
22
+ // clean up function
23
+ return function () {
24
+ // remove resize listener
25
+ window.removeEventListener('resize', resizeListener);
26
+ };
27
+ }, []);
28
+ return width;
29
+ };