@mailstep/design-system 0.8.46 → 0.8.47

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.8.46",
3
+ "version": "0.8.47",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -4,6 +4,7 @@ import type { HeaderVariant } from '../../../../types';
4
4
  type MenuItemProps = {
5
5
  item: MenuItemType;
6
6
  variant?: HeaderVariant;
7
+ iconsBreakpoint?: string;
7
8
  };
8
9
  export declare const MenuItem: FC<MenuItemProps>;
9
10
  export {};
@@ -1,10 +1,10 @@
1
1
  import Icon from "../../../../../../Elements/Icon/Icon.js";
2
- import { MenuItemDropdownArrow, MenuItemLabel, MenuItemsListItem, SubMenuItemRow, SubMenuList } from "../../styles.js";
2
+ import { MenuItemDropdownArrow, MenuItemIcon, MenuItemLabel, MenuItemsListItem, SubMenuItemRow, SubMenuList } from "../../styles.js";
3
3
  import { isItemActive, isLinkExactActive } from "./utils/isItemActive.js";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { Link, useLocation } from "react-router-dom";
6
6
  //#region packages/ui/Blocks/Header/components/MenuItems/components/MenuItem/index.tsx
7
- const MenuItem = ({ item, variant = "light" }) => {
7
+ const MenuItem = ({ item, variant = "light", iconsBreakpoint }) => {
8
8
  const hasSubmenu = Array.isArray(item.items) && item.items.length > 0;
9
9
  const { pathname, search } = useLocation();
10
10
  const isActive = isItemActive(pathname, item);
@@ -14,10 +14,20 @@ const MenuItem = ({ item, variant = "light" }) => {
14
14
  $isActive: isActive,
15
15
  children: [/* @__PURE__ */ jsxs(MenuItemLabel, {
16
16
  onClick: item.onClick,
17
- children: [item.link && !hasSubmenu ? /* @__PURE__ */ jsx(Link, {
18
- to: item.link,
19
- children: item.title
20
- }) : /* @__PURE__ */ jsx("span", { children: item.title }), hasSubmenu && /* @__PURE__ */ jsx(MenuItemDropdownArrow, { children: /* @__PURE__ */ jsx(Icon, { icon: "goDown" }) })]
17
+ children: [
18
+ item.icon && /* @__PURE__ */ jsx(MenuItemIcon, {
19
+ $iconsBreakpoint: iconsBreakpoint,
20
+ children: typeof item.icon === "string" ? /* @__PURE__ */ jsx(Icon, {
21
+ icon: item.icon,
22
+ size: 18
23
+ }) : item.icon
24
+ }),
25
+ item.link && !hasSubmenu ? /* @__PURE__ */ jsx(Link, {
26
+ to: item.link,
27
+ children: item.title
28
+ }) : /* @__PURE__ */ jsx("span", { children: item.title }),
29
+ hasSubmenu && /* @__PURE__ */ jsx(MenuItemDropdownArrow, { children: /* @__PURE__ */ jsx(Icon, { icon: "goDown" }) })
30
+ ]
21
31
  }), hasSubmenu && /* @__PURE__ */ jsx(SubMenuList, { children: item.items?.map((subItem, key) => /* @__PURE__ */ jsx(SubMenuItemRow, {
22
32
  pointer: !!subItem.onClick,
23
33
  onClick: subItem.onClick,
@@ -4,6 +4,7 @@ import type { HeaderVariant } from '../../types';
4
4
  type MenuItemsProps = {
5
5
  items?: MenuItemType[];
6
6
  variant?: HeaderVariant;
7
+ iconsBreakpoint?: string;
7
8
  };
8
9
  export declare const MenuItems: FC<MenuItemsProps>;
9
10
  export {};
@@ -2,10 +2,11 @@ import { MenuItemsList } from "./styles.js";
2
2
  import { MenuItem } from "./components/MenuItem/index.js";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  //#region packages/ui/Blocks/Header/components/MenuItems/index.tsx
5
- const MenuItems = ({ items, variant = "light" }) => {
5
+ const MenuItems = ({ items, variant = "light", iconsBreakpoint }) => {
6
6
  return /* @__PURE__ */ jsx(MenuItemsList, { children: items?.map((item, key) => /* @__PURE__ */ jsx(MenuItem, {
7
7
  item,
8
- variant
8
+ variant,
9
+ iconsBreakpoint
9
10
  }, key)) });
10
11
  };
11
12
  //#endregion
@@ -7,6 +7,9 @@ export declare const MenuItemsListItem: import("styled-components").StyledCompon
7
7
  $isActive?: boolean;
8
8
  }, never>;
9
9
  export declare const MenuItemLabel: import("styled-components").StyledComponent<"div", import("@xstyled/styled-components").Theme, {}, never>;
10
+ export declare const MenuItemIcon: import("styled-components").StyledComponent<"span", import("@xstyled/styled-components").Theme, {
11
+ $iconsBreakpoint?: string;
12
+ }, never>;
10
13
  export declare const MenuItemDropdownArrow: import("styled-components").StyledComponent<"span", import("@xstyled/styled-components").Theme, {}, never>;
11
14
  export declare const SubMenuItemRow: import("styled-components").StyledComponent<"li", import("@xstyled/styled-components").Theme, {
12
15
  pointer?: boolean;
@@ -1,4 +1,4 @@
1
- import styled$1, { th } from "@xstyled/styled-components";
1
+ import styled$1, { css, th } from "@xstyled/styled-components";
2
2
  //#region packages/ui/Blocks/Header/components/MenuItems/styles.ts
3
3
  const MenuItemsList = styled$1.ul`
4
4
  display: flex;
@@ -76,6 +76,19 @@ const MenuItemLabel = styled$1.div`
76
76
  user-select: none;
77
77
  height: 100%;
78
78
  `;
79
+ const MenuItemIcon = styled$1.span`
80
+ display: inline-flex;
81
+ align-items: center;
82
+ justify-content: center;
83
+ flex-shrink: 0;
84
+ ${({ $iconsBreakpoint }) => $iconsBreakpoint && css`
85
+ display: none;
86
+
87
+ @media (min-width: ${$iconsBreakpoint}) {
88
+ display: inline-flex;
89
+ }
90
+ `}
91
+ `;
79
92
  const MenuItemDropdownArrow = styled$1.span`
80
93
  display: inline-flex;
81
94
  align-items: center;
@@ -121,4 +134,4 @@ const SubMenuItemRow = styled$1.li`
121
134
  }
122
135
  `;
123
136
  //#endregion
124
- export { MenuItemDropdownArrow, MenuItemLabel, MenuItemsList, MenuItemsListItem, SubMenuItemRow, SubMenuList };
137
+ export { MenuItemDropdownArrow, MenuItemIcon, MenuItemLabel, MenuItemsList, MenuItemsListItem, SubMenuItemRow, SubMenuList };
@@ -27,6 +27,7 @@ type Props = {
27
27
  height?: string;
28
28
  smallLogoBreakpoint?: string;
29
29
  mobileMenuBreakpoint?: string;
30
+ menuIconsBreakpoint?: string;
30
31
  languageItems?: LanguageItem[];
31
32
  showLanguageWithTitle?: boolean;
32
33
  languageFlagWrapBackgroundColor?: string;
@@ -11,7 +11,7 @@ import { useCallback, useState } from "react";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { Link } from "react-router-dom";
13
13
  //#region packages/ui/Blocks/Header/index.tsx
14
- const Header = ({ isMobileMenuOpen, homeLink, logo, logoVariant, logoVariantSmall, logoWidth = "145px", logoSmallWidth = "45px", logoSrc, logoSrcWidth, user, currentLanguage, hasUserMenu = false, leftMenuItems, rightMenuItems, rightSideStart, userMenuOverride, withInitials = false, withChevron = false, withName = false, variant = "light", height = "60px", smallLogoBreakpoint = "1801px", mobileMenuBreakpoint = "1024px", showLanguageWithTitle, languageFlagWrapBackgroundColor, languageItems: languageItems$1 = languageItems, withLanguageSwitch = true, ignoreClickOutsideClosest, onOpenMobileSideMenu, onChangeLanguage, onLogout }) => {
14
+ const Header = ({ isMobileMenuOpen, homeLink, logo, logoVariant, logoVariantSmall, logoWidth = "145px", logoSmallWidth = "45px", logoSrc, logoSrcWidth, user, currentLanguage, hasUserMenu = false, leftMenuItems, rightMenuItems, rightSideStart, userMenuOverride, withInitials = false, withChevron = false, withName = false, variant = "light", height = "60px", smallLogoBreakpoint = "1801px", mobileMenuBreakpoint = "1024px", menuIconsBreakpoint, showLanguageWithTitle, languageFlagWrapBackgroundColor, languageItems: languageItems$1 = languageItems, withLanguageSwitch = true, ignoreClickOutsideClosest, onOpenMobileSideMenu, onChangeLanguage, onLogout }) => {
15
15
  const { handleChangeLanguage } = useChangeLanguage({ onChangeLanguage });
16
16
  const hasLeftMenu = Array.isArray(leftMenuItems) && leftMenuItems.length > 0;
17
17
  const hasInternalMobileMenu = hasLeftMenu && !onOpenMobileSideMenu;
@@ -62,14 +62,16 @@ const Header = ({ isMobileMenuOpen, homeLink, logo, logoVariant, logoVariantSmal
62
62
  $mobileMenuBreakpoint: mobileMenuBreakpoint,
63
63
  children: /* @__PURE__ */ jsx(MenuItems, {
64
64
  items: leftMenuItems,
65
- variant
65
+ variant,
66
+ iconsBreakpoint: menuIconsBreakpoint
66
67
  })
67
68
  })
68
69
  ] }), /* @__PURE__ */ jsxs(RightSide, { children: [
69
70
  rightSideStart,
70
71
  !!rightMenuItems?.length && /* @__PURE__ */ jsx(MenuItems, {
71
72
  items: rightMenuItems,
72
- variant
73
+ variant,
74
+ iconsBreakpoint: menuIconsBreakpoint
73
75
  }),
74
76
  withLanguageSwitch && /* @__PURE__ */ jsx(LanguageWrapper, { children: /* @__PURE__ */ jsx(LanguageSwitch_default, {
75
77
  languageItems: languageItems$1,
@@ -25,6 +25,7 @@ declare const meta: {
25
25
  height?: string;
26
26
  smallLogoBreakpoint?: string;
27
27
  mobileMenuBreakpoint?: string;
28
+ menuIconsBreakpoint?: string;
28
29
  languageItems?: import("../../LanguageSwitch").LanguageItem[];
29
30
  showLanguageWithTitle?: boolean;
30
31
  languageFlagWrapBackgroundColor?: string;
@@ -9,7 +9,7 @@ const getInitials = (user) => {
9
9
  if (initials) return initials;
10
10
  return (user?.username ?? "?").slice(0, 2).toUpperCase();
11
11
  };
12
- const Avatar = ({ user, src, size = 34, colorFront, colorBack, className, hoverColorBack, onClick, withInitials, withChevron, withName }) => {
12
+ const Avatar = ({ user, src, size = 34, colorFront, colorBack, className, hoverColorBack, onClick, withInitials, withChevron, withName, children }) => {
13
13
  return /* @__PURE__ */ jsxs(AvatarWrap, {
14
14
  onClick,
15
15
  children: [
@@ -29,7 +29,7 @@ const Avatar = ({ user, src, size = 34, colorFront, colorBack, className, hoverC
29
29
  !src && !withInitials && /* @__PURE__ */ jsx(Profile, { stroke: colorFront })
30
30
  ]
31
31
  }),
32
- withName && user?.username,
32
+ /* @__PURE__ */ jsxs("div", { children: [withName && user?.username, children] }),
33
33
  withChevron && /* @__PURE__ */ jsx(Chevron, { children: /* @__PURE__ */ jsx(Icon, {
34
34
  icon: "goDown",
35
35
  fill: "white",
@@ -1,3 +1,4 @@
1
+ import { type ReactNode } from 'react';
1
2
  export type Props = {
2
3
  user?: {
3
4
  firstName?: string;
@@ -15,4 +16,5 @@ export type Props = {
15
16
  withInitials?: boolean;
16
17
  withChevron?: boolean;
17
18
  withName?: boolean;
19
+ children?: ReactNode;
18
20
  };
@@ -14,6 +14,7 @@ import { faPaperclip } from "@fortawesome/pro-light-svg-icons/faPaperclip";
14
14
  import { faStopwatch } from "@fortawesome/pro-light-svg-icons/faStopwatch";
15
15
  import { faArrowRightToBracket } from "@fortawesome/pro-regular-svg-icons/faArrowRightToBracket";
16
16
  import { faBell } from "@fortawesome/pro-regular-svg-icons/faBell";
17
+ import { faBolt } from "@fortawesome/pro-regular-svg-icons/faBolt";
17
18
  import { faBox } from "@fortawesome/pro-regular-svg-icons/faBox";
18
19
  import { faCalendar } from "@fortawesome/pro-regular-svg-icons/faCalendar";
19
20
  import { faCalendarPlus } from "@fortawesome/pro-regular-svg-icons/faCalendarPlus";
@@ -143,6 +144,7 @@ const iconDictionary = {
143
144
  paperPlane: faPaperPlane,
144
145
  flaskRoundPotion: faFlaskRoundPotion,
145
146
  batteryBolt: faBatteryBolt,
147
+ bolt: faBolt,
146
148
  ellipsisVertical: faEllipsisVertical,
147
149
  greaterThanEqual: faGreaterThanEqual,
148
150
  home: faHome,
@@ -265,8 +267,8 @@ const Icon = ({ icon, fill, stroke, style = "normal", size, width, height, class
265
267
  $colorSecondary: colorSecondary,
266
268
  $fixedWidth: fixedWidth,
267
269
  children: IconComponent ? /* @__PURE__ */ jsx(IconComponent, {
268
- fill: colorFill,
269
- stroke: colorStroke,
270
+ ...colorFill ? { fill: colorFill } : {},
271
+ ...colorStroke ? { stroke: colorStroke } : {},
270
272
  onClick,
271
273
  cursor: cursor ?? (onClick ? "pointer" : void 0),
272
274
  ...width ?? size ? { width: width ?? size } : {},
@@ -1,3 +1,3 @@
1
1
  import { type FC } from 'react';
2
- import { SvgProps } from '../types';
2
+ import { type SvgProps } from '../types';
3
3
  export declare const Inventory: FC<SvgProps>;
@@ -5,7 +5,7 @@ const Inventory = (props) => /* @__PURE__ */ jsxs("svg", {
5
5
  height: "22",
6
6
  viewBox: "0 0 22 22",
7
7
  fill: "none",
8
- stroke: "#A3B3C1",
8
+ stroke: "currentColor",
9
9
  ...props,
10
10
  children: [/* @__PURE__ */ jsxs("g", {
11
11
  clipPath: "url(#clip0_7_1616)",
@@ -1,3 +1,3 @@
1
1
  import { type FC } from 'react';
2
- import { SvgProps } from '../types';
2
+ import { type SvgProps } from '../types';
3
3
  export declare const Return: FC<SvgProps>;
@@ -5,7 +5,7 @@ const Return = (props) => /* @__PURE__ */ jsxs("svg", {
5
5
  height: "22",
6
6
  viewBox: "0 0 22 22",
7
7
  fill: "none",
8
- stroke: "#A3B3C1",
8
+ stroke: "currentColor",
9
9
  ...props,
10
10
  children: [/* @__PURE__ */ jsx("path", {
11
11
  d: "M6 8.78947V13.7105L11.1 15.5M6 8.78947L11.1 10.5789M6 8.78947L11.1 7L16.2 8.34211M11.1 15.5V10.5789M11.1 15.5L16.2 13.7105V8.34211M11.1 10.5789L16.2 8.34211",