@mailstep/design-system 0.6.65-beta.0 → 0.6.65-beta.2
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/package.json +1 -1
- package/ui/Blocks/Header/components/MenuItems/components/MenuItem/index.d.ts +1 -1
- package/ui/Blocks/Header/components/MenuItems/components/MenuItem/index.js +1 -1
- package/ui/Blocks/Header/components/MenuItems/index.d.ts +1 -1
- package/ui/Blocks/Header/components/MenuItems/styles.js +1 -1
- package/ui/Blocks/Header/components/UserMenu/index.d.ts +1 -1
- package/ui/Blocks/Header/index.d.ts +4 -3
- package/ui/Blocks/Header/stories/Header.stories.d.ts +3 -3
- package/ui/Blocks/Header/stories/Header.stories.js +11 -8
- package/ui/Blocks/SideMenu/SideMenu.js +4 -1
- package/ui/index.es.js +1 -1
- package/ui/index.umd.js +1 -1
package/package.json
CHANGED
|
@@ -3,5 +3,5 @@ import { Link } from 'react-router-dom';
|
|
|
3
3
|
import { MenuItemsListItem } from '../../styles';
|
|
4
4
|
export var MenuItem = function (_a) {
|
|
5
5
|
var item = _a.item;
|
|
6
|
-
return
|
|
6
|
+
return _jsx(MenuItemsListItem, { children: item.link ? _jsx(Link, { to: item.link, children: item.title }) : item.title });
|
|
7
7
|
};
|
|
@@ -4,5 +4,5 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import styled from '@xstyled/styled-components';
|
|
6
6
|
export var MenuItemsList = styled.ul(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: none;\n gap: 10px;\n\n @media (min-width: 1024px) {\n display: flex;\n }\n"], ["\n display: none;\n gap: 10px;\n\n @media (min-width: 1024px) {\n display: flex;\n }\n"])));
|
|
7
|
-
export var MenuItemsListItem = styled.li(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n a {\n text-decoration: none;\n color: red1;\n
|
|
7
|
+
export var MenuItemsListItem = styled.li(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n a {\n text-decoration: none;\n border-color: red1;\n color: typoPrimary;\n }\n\n a:hover {\n border-bottom: 1px solid;\n color: red1;\n }\n"], ["\n a {\n text-decoration: none;\n border-color: red1;\n color: typoPrimary;\n }\n\n a:hover {\n border-bottom: 1px solid;\n color: red1;\n }\n"])));
|
|
8
8
|
var templateObject_1, templateObject_2;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import type { Brand, Variant } from '../../Elements/Logo';
|
|
3
|
-
import type {
|
|
3
|
+
import type { MenuItemType } from '../SideMenu/types';
|
|
4
|
+
import type { User } from './types';
|
|
4
5
|
type Props = {
|
|
5
6
|
homeLink: string;
|
|
6
7
|
isMobileMenuOpen?: boolean;
|
|
7
8
|
logo: Brand;
|
|
8
9
|
logoVariant: Variant;
|
|
9
|
-
user?: User;
|
|
10
|
+
user?: User | null;
|
|
10
11
|
currentLanguage?: string;
|
|
11
12
|
hasUserMenu?: boolean;
|
|
12
|
-
rightMenuItems?:
|
|
13
|
+
rightMenuItems?: MenuItemType[];
|
|
13
14
|
onOpenMobileSideMenu?: () => void;
|
|
14
15
|
onChangeLanguage?: (language: string) => void;
|
|
15
16
|
onLogout?: () => void;
|
|
@@ -6,10 +6,10 @@ declare const meta: {
|
|
|
6
6
|
isMobileMenuOpen?: boolean | undefined;
|
|
7
7
|
logo: import("../../..").Brand;
|
|
8
8
|
logoVariant: import("../../..").Variant;
|
|
9
|
-
user?: import("../types").User | undefined;
|
|
9
|
+
user?: import("../types").User | null | undefined;
|
|
10
10
|
currentLanguage?: string | undefined;
|
|
11
11
|
hasUserMenu?: boolean | undefined;
|
|
12
|
-
rightMenuItems?: import("
|
|
12
|
+
rightMenuItems?: import("../../SideMenu").MenuItemType[] | undefined;
|
|
13
13
|
onOpenMobileSideMenu?: (() => void) | undefined;
|
|
14
14
|
onChangeLanguage?: ((language: string) => void) | undefined;
|
|
15
15
|
onLogout?: (() => void) | undefined;
|
|
@@ -20,6 +20,6 @@ declare const meta: {
|
|
|
20
20
|
export default meta;
|
|
21
21
|
export declare const HeaderBasic: () => JSX.Element;
|
|
22
22
|
export declare const HeaderWithUser: () => JSX.Element;
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const HeaderWithRightLinks: () => JSX.Element;
|
|
24
24
|
export declare const HeaderWithLanguageSwitch: () => JSX.Element;
|
|
25
25
|
export declare const HeaderWithAllItems: () => JSX.Element;
|
|
@@ -15,24 +15,27 @@ var user = {
|
|
|
15
15
|
};
|
|
16
16
|
var menuItems = [
|
|
17
17
|
{
|
|
18
|
-
|
|
18
|
+
id: 'aboutUs',
|
|
19
|
+
title: 'About us',
|
|
19
20
|
link: 'http://mailstep.com'
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
|
-
|
|
23
|
+
id: 'trackingPage',
|
|
24
|
+
title: 'Tracking package',
|
|
23
25
|
link: 'http://mailstep.com/tracking'
|
|
24
26
|
},
|
|
25
27
|
{
|
|
26
|
-
|
|
28
|
+
id: 'customerService',
|
|
29
|
+
title: 'Customer service',
|
|
27
30
|
link: 'http://mailstep.com/cc'
|
|
28
31
|
}
|
|
29
32
|
];
|
|
30
33
|
export default meta;
|
|
31
|
-
export var HeaderBasic = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "
|
|
32
|
-
export var HeaderWithUser = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "
|
|
33
|
-
export var
|
|
34
|
-
export var HeaderWithLanguageSwitch = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "
|
|
34
|
+
export var HeaderBasic = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "mailstep", logoVariant: "black" }) })); };
|
|
35
|
+
export var HeaderWithUser = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "mailstep", logoVariant: "black", hasUserMenu: true, user: user }) })); };
|
|
36
|
+
export var HeaderWithRightLinks = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "mailstep", logoVariant: "black", rightMenuItems: menuItems }) })); };
|
|
37
|
+
export var HeaderWithLanguageSwitch = function () { return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "mailstep", logoVariant: "black", currentLanguage: "cs" }) })); };
|
|
35
38
|
export var HeaderWithAllItems = function () {
|
|
36
39
|
var _a = useState(false), isMobileMenuOpen = _a[0], setIsMobileMenuOpen = _a[1];
|
|
37
|
-
return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "
|
|
40
|
+
return (_jsx(LinguiContainer, { children: _jsx(Header, { homeLink: "/", logo: "mailstep", logoVariant: "black", currentLanguage: "cs", rightMenuItems: menuItems, hasUserMenu: true, user: user, isMobileMenuOpen: isMobileMenuOpen, onOpenMobileSideMenu: function () { return setIsMobileMenuOpen(function (state) { return !state; }); } }) }));
|
|
38
41
|
};
|
|
@@ -19,6 +19,9 @@ var SideMenu = function (_a) {
|
|
|
19
19
|
var menuItems = _a.menuItems, isCompact = _a.isCompact, setIsCompact = _a.setIsCompact, isLeftMenuOpen = _a.isLeftMenuOpen, onCloseLeftMenu = _a.onCloseLeftMenu, _b = _a.variant, variant = _b === void 0 ? 'dark' : _b, children = _a.children;
|
|
20
20
|
var lightMode = variant === 'light';
|
|
21
21
|
var pickerRef = useClickOutside({ onClose: onCloseLeftMenu });
|
|
22
|
-
return (_jsx(LeftMenuProvider, { children: _jsxs(Container, { isLeftMenuOpen: isLeftMenuOpen, children: [_jsxs(TopLevelWrap, { isCompact: isCompact, isLeftMenuOpen: isLeftMenuOpen, ref: pickerRef, lightMode: lightMode, children: [_jsx(ScrollWrap, { children: _jsxs(BodyWrap, { isCompact: isCompact, children: [menuItems.map(function (item, index) {
|
|
22
|
+
return (_jsx(LeftMenuProvider, { children: _jsxs(Container, { isLeftMenuOpen: isLeftMenuOpen, children: [_jsxs(TopLevelWrap, { isCompact: isCompact, isLeftMenuOpen: isLeftMenuOpen, ref: pickerRef, lightMode: lightMode, children: [_jsx(ScrollWrap, { children: _jsxs(BodyWrap, { isCompact: isCompact, children: [menuItems.map(function (item, index) {
|
|
23
|
+
var _a;
|
|
24
|
+
return (_jsx(MenuItem, __assign({ isCompact: isCompact, isLeftMenuOpen: isLeftMenuOpen, onCloseLeftMenu: onCloseLeftMenu, lightMode: lightMode, separator: !!item.separator }, item), "".concat((_a = item.id) !== null && _a !== void 0 ? _a : item.title, "-").concat(index)));
|
|
25
|
+
}), children] }) }), _jsx(FooterRow, { isCompact: isCompact, setIsCompact: setIsCompact, lightMode: lightMode })] }), _jsx(Overlay, {})] }) }));
|
|
23
26
|
};
|
|
24
27
|
export default SideMenu;
|
package/ui/index.es.js
CHANGED
|
@@ -51479,7 +51479,7 @@ const NEe = q.img`
|
|
|
51479
51479
|
return /* @__PURE__ */ g.jsx(JIe, { children: /* @__PURE__ */ g.jsxs(KIe, { isLeftMenuOpen: n, children: [
|
|
51480
51480
|
/* @__PURE__ */ g.jsxs(nke, { isCompact: t, isLeftMenuOpen: n, ref: u, lightMode: c, children: [
|
|
51481
51481
|
/* @__PURE__ */ g.jsx(ike, { children: /* @__PURE__ */ g.jsxs(ake, { isCompact: t, children: [
|
|
51482
|
-
e.map((f, p) => /* @__PURE__ */ g.jsx(pke, { isCompact: t, isLeftMenuOpen: n, onCloseLeftMenu: i, lightMode: c, separator: !!f.separator, ...f }, `${f.id}-${p}`)),
|
|
51482
|
+
e.map((f, p) => /* @__PURE__ */ g.jsx(pke, { isCompact: t, isLeftMenuOpen: n, onCloseLeftMenu: i, lightMode: c, separator: !!f.separator, ...f }, `${f.id ?? f.title}-${p}`)),
|
|
51483
51483
|
l
|
|
51484
51484
|
] }) }),
|
|
51485
51485
|
/* @__PURE__ */ g.jsx(XIe, { isCompact: t, setIsCompact: r, lightMode: c })
|
package/ui/index.umd.js
CHANGED
|
@@ -3882,7 +3882,7 @@ ${ee.current.stack}
|
|
|
3882
3882
|
@media (min-width: 1024px) {
|
|
3883
3883
|
display: block;
|
|
3884
3884
|
}
|
|
3885
|
-
`,iOe=({items:e,childRef:t,parentRef:r,isLeftMenuOpen:n,onCloseLeftMenu:i,lightMode:o})=>g.jsx(i1,{children:g.jsx(WF,{innerRef:t,referenceElement:r.current,placement:"right-start",children:({ref:l,style:u})=>g.jsx(nOe,{ref:l,style:u,onClick:i,isLeftMenuOpen:n,children:g.jsx(Qke,{$lightMode:o,children:e==null?void 0:e.map((c,f)=>g.jsx(rOe,{...c,lightMode:o},`${f}`))})})})}),aOe=()=>{const e=I.useContext(KV);if(!e)throw new Error("useLeftMenuContext context must be use inside LeftMenuProvider");return e},oOe=({parentRef:e})=>{const t=I.useRef(null),[r,n]=I.useState(!1),i=I.useCallback(()=>{n(!0)},[]),o=I.useCallback(l=>{var u,c;!((u=e.current)!=null&&u.contains(l.target))&&!((c=t.current)!=null&&c.contains(l.target))&&n(!1)},[e]);return I.useEffect(()=>(document.addEventListener("mouseover",o),()=>{document.removeEventListener("mouseover",o)}),[o]),{isHovering:r,handleMouseOver:i,ref:t}},sOe=/\?$/,$V=({icon:e,title:t,link:r="",items:n,id:i,isSubitem:o,isCompact:l,lightMode:u=!1,separator:c=!1,isLeftMenuOpen:f,onCloseLeftMenu:A})=>{const p=I.useMemo(()=>n&&(n==null?void 0:n.length)>0,[n]),{expandedItem:v,expandItem:m}=aOe(),y=v===i,w=I.useCallback(()=>{p&&m(y?null:i),!p&&!u&&A&&A()},[p,m,y,i,u,A]),E=I.useMemo(()=>r.startsWith("https://")?{to:{pathname:r},target:"_blank"}:{to:r},[r]),x=l?TM:G6,k=y&&!l,P=I.useRef(null),{ref:T,isHovering:L,handleMouseOver:F}=oOe({parentRef:P});let V=o?"nestedlevel":"toplevel";y&&(V+=" expanded"),c&&(V+=" separator");const z=I.useCallback((Z,Y)=>{const R=!!(n!=null&&n.find(te=>{var _;return((_=te.link)==null?void 0:_.replace(sOe,""))===Y.pathname})),W=!!Ih(Y.pathname,{path:Z==null?void 0:Z.path}),j=Y.pathname.startsWith(r.slice(0,-1))&&Y.pathname.includes("/settings/");return W||R||j},[n,r]);return g.jsxs(g.Fragment,{children:[c&&g.jsx(Xke,{}),g.jsxs(Jke,{ref:P,$isCompact:l,$lightMode:u,hasChildren:p,isHovering:L,children:[g.jsxs(Jc,{...E,onMouseOver:F,exact:!0,activeClassName:p?"selected":void 0,onClick:w,$isCompact:l,className:V,isActive:z,$lightMode:u,children:[g.jsxs(S9,{$isCompact:l,isSubitem:o,children:[!o&&e&&g.jsx(o1,{className:"mainIcon",$isCompact:l,children:typeof e=="string"?g.jsx(kt,{icon:e,fill:"none"}):e}),g.jsx(x,{variant:"semiBold",mt:0,mb:0,children:g.jsx(Kke,{children:t})})]}),!l&&p&&g.jsx(E9,{icon:"goDown",$lightMode:u})]}),L&&l&&p&&!k&&g.jsx(iOe,{items:n,childRef:T,parentRef:P,isLeftMenuOpen:f,onCloseLeftMenu:A,lightMode:u})]}),p&&k&&g.jsx(Yke,{children:n==null?void 0:n.map((Z,Y)=>g.jsx($V,{isCompact:l,lightMode:u,...Z,onCloseLeftMenu:A,isSubitem:!0},`${Y}`))})]})},lOe=I.memo($V),uOe=({menuItems:e,isCompact:t,setIsCompact:r,isLeftMenuOpen:n,onCloseLeftMenu:i,variant:o="dark",children:l})=>{const u=o==="light",c=Fo({onClose:i});return g.jsx(_ke,{children:g.jsxs(Zke,{isLeftMenuOpen:n,children:[g.jsxs(qke,{isCompact:t,isLeftMenuOpen:n,ref:c,lightMode:u,children:[g.jsx($ke,{children:g.jsxs(eOe,{isCompact:t,children:[e.map((f,A)=>g.jsx(lOe,{isCompact:t,isLeftMenuOpen:n,onCloseLeftMenu:i,lightMode:u,separator:!!f.separator,...f},`${f.id}-${A}`)),l]})}),g.jsx(Gke,{isCompact:t,setIsCompact:r,lightMode:u})]}),g.jsx(tOe,{})]})})},cOe=q.div`
|
|
3885
|
+
`,iOe=({items:e,childRef:t,parentRef:r,isLeftMenuOpen:n,onCloseLeftMenu:i,lightMode:o})=>g.jsx(i1,{children:g.jsx(WF,{innerRef:t,referenceElement:r.current,placement:"right-start",children:({ref:l,style:u})=>g.jsx(nOe,{ref:l,style:u,onClick:i,isLeftMenuOpen:n,children:g.jsx(Qke,{$lightMode:o,children:e==null?void 0:e.map((c,f)=>g.jsx(rOe,{...c,lightMode:o},`${f}`))})})})}),aOe=()=>{const e=I.useContext(KV);if(!e)throw new Error("useLeftMenuContext context must be use inside LeftMenuProvider");return e},oOe=({parentRef:e})=>{const t=I.useRef(null),[r,n]=I.useState(!1),i=I.useCallback(()=>{n(!0)},[]),o=I.useCallback(l=>{var u,c;!((u=e.current)!=null&&u.contains(l.target))&&!((c=t.current)!=null&&c.contains(l.target))&&n(!1)},[e]);return I.useEffect(()=>(document.addEventListener("mouseover",o),()=>{document.removeEventListener("mouseover",o)}),[o]),{isHovering:r,handleMouseOver:i,ref:t}},sOe=/\?$/,$V=({icon:e,title:t,link:r="",items:n,id:i,isSubitem:o,isCompact:l,lightMode:u=!1,separator:c=!1,isLeftMenuOpen:f,onCloseLeftMenu:A})=>{const p=I.useMemo(()=>n&&(n==null?void 0:n.length)>0,[n]),{expandedItem:v,expandItem:m}=aOe(),y=v===i,w=I.useCallback(()=>{p&&m(y?null:i),!p&&!u&&A&&A()},[p,m,y,i,u,A]),E=I.useMemo(()=>r.startsWith("https://")?{to:{pathname:r},target:"_blank"}:{to:r},[r]),x=l?TM:G6,k=y&&!l,P=I.useRef(null),{ref:T,isHovering:L,handleMouseOver:F}=oOe({parentRef:P});let V=o?"nestedlevel":"toplevel";y&&(V+=" expanded"),c&&(V+=" separator");const z=I.useCallback((Z,Y)=>{const R=!!(n!=null&&n.find(te=>{var _;return((_=te.link)==null?void 0:_.replace(sOe,""))===Y.pathname})),W=!!Ih(Y.pathname,{path:Z==null?void 0:Z.path}),j=Y.pathname.startsWith(r.slice(0,-1))&&Y.pathname.includes("/settings/");return W||R||j},[n,r]);return g.jsxs(g.Fragment,{children:[c&&g.jsx(Xke,{}),g.jsxs(Jke,{ref:P,$isCompact:l,$lightMode:u,hasChildren:p,isHovering:L,children:[g.jsxs(Jc,{...E,onMouseOver:F,exact:!0,activeClassName:p?"selected":void 0,onClick:w,$isCompact:l,className:V,isActive:z,$lightMode:u,children:[g.jsxs(S9,{$isCompact:l,isSubitem:o,children:[!o&&e&&g.jsx(o1,{className:"mainIcon",$isCompact:l,children:typeof e=="string"?g.jsx(kt,{icon:e,fill:"none"}):e}),g.jsx(x,{variant:"semiBold",mt:0,mb:0,children:g.jsx(Kke,{children:t})})]}),!l&&p&&g.jsx(E9,{icon:"goDown",$lightMode:u})]}),L&&l&&p&&!k&&g.jsx(iOe,{items:n,childRef:T,parentRef:P,isLeftMenuOpen:f,onCloseLeftMenu:A,lightMode:u})]}),p&&k&&g.jsx(Yke,{children:n==null?void 0:n.map((Z,Y)=>g.jsx($V,{isCompact:l,lightMode:u,...Z,onCloseLeftMenu:A,isSubitem:!0},`${Y}`))})]})},lOe=I.memo($V),uOe=({menuItems:e,isCompact:t,setIsCompact:r,isLeftMenuOpen:n,onCloseLeftMenu:i,variant:o="dark",children:l})=>{const u=o==="light",c=Fo({onClose:i});return g.jsx(_ke,{children:g.jsxs(Zke,{isLeftMenuOpen:n,children:[g.jsxs(qke,{isCompact:t,isLeftMenuOpen:n,ref:c,lightMode:u,children:[g.jsx($ke,{children:g.jsxs(eOe,{isCompact:t,children:[e.map((f,A)=>g.jsx(lOe,{isCompact:t,isLeftMenuOpen:n,onCloseLeftMenu:i,lightMode:u,separator:!!f.separator,...f},`${f.id??f.title}-${A}`)),l]})}),g.jsx(Gke,{isCompact:t,setIsCompact:r,lightMode:u})]}),g.jsx(tOe,{})]})})},cOe=q.div`
|
|
3886
3886
|
border-radius: 50%;
|
|
3887
3887
|
border: 8px solid ${H.color("red1")};
|
|
3888
3888
|
color: ${H.color("red1")};
|