@mailstep/design-system 0.7.58 → 0.7.59-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mailstep/design-system",
3
- "version": "0.7.58",
3
+ "version": "0.7.59-beta.0",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -1,3 +1,3 @@
1
- import { TabContentProps } from './types';
2
- import { ReactElement } from 'react';
1
+ import type { ReactElement } from 'react';
2
+ import type { TabContentProps } from './types';
3
3
  export declare const TabContent: ({ activeTab, value, children }: TabContentProps) => ReactElement | null;
@@ -1,2 +1,2 @@
1
- import { TabsProps } from './types';
2
- export declare const Tabs: ({ tabsDefinition, activeTab, onTabSwitch, mb, mt }: TabsProps) => JSX.Element;
1
+ import type { TabsProps } from './types';
2
+ export declare const Tabs: ({ tabsDefinition, activeTab, onTabSwitch, mb, mt, minTabWidth }: TabsProps) => JSX.Element;
@@ -1,19 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useCallback } from 'react';
3
- import { RoundedWrap, StyledImageBox, Tab as StyledTab, StyledTabWrapper, TabPanel } from './styles';
4
- import { Text } from '../../Elements/Text';
5
3
  import { Icon } from '../../Elements/Icon';
4
+ import { Text } from '../../Elements/Text';
5
+ import { RoundedWrap, StyledImageBox, Tab as StyledTab, StyledTabWrapper, TabPanel } from './styles';
6
6
  var Tab = function (_a) {
7
- var tabDefinition = _a.tabDefinition, value = _a.value, isActive = _a.isActive, onTabSwitch = _a.onTabSwitch;
7
+ var tabDefinition = _a.tabDefinition, value = _a.value, isActive = _a.isActive, onTabSwitch = _a.onTabSwitch, minWidth = _a.minWidth;
8
8
  var icon = tabDefinition.icon, label = tabDefinition.label, badgeCount = tabDefinition.badgeCount, disabled = tabDefinition.disabled;
9
9
  var handleOnClick = useCallback(function () {
10
10
  onTabSwitch(value);
11
11
  }, [onTabSwitch, value]);
12
- return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick: !disabled ? handleOnClick : undefined, active: isActive, disabled: disabled, children: [icon && (_jsx(StyledImageBox, { children: _jsx(Icon, { icon: icon }) })), _jsx(Text, { children: label }), badgeCount === 0 || (badgeCount && badgeCount > 0) && (_jsx(RoundedWrap, { children: _jsx(Text, { variant: "medium", children: badgeCount }) }))] }) }));
12
+ return (_jsx(StyledTabWrapper, { children: _jsxs(StyledTab, { onClick: !disabled ? handleOnClick : undefined, active: isActive, disabled: disabled, minWidth: minWidth, children: [icon && (_jsx(StyledImageBox, { children: _jsx(Icon, { icon: icon }) })), _jsx(Text, { children: label }), badgeCount === 0 ||
13
+ (badgeCount && badgeCount > 0 && (_jsx(RoundedWrap, { children: _jsx(Text, { variant: "medium", children: badgeCount }) })))] }) }));
13
14
  };
14
15
  export var Tabs = function (_a) {
15
- var tabsDefinition = _a.tabsDefinition, activeTab = _a.activeTab, onTabSwitch = _a.onTabSwitch, mb = _a.mb, mt = _a.mt;
16
+ var tabsDefinition = _a.tabsDefinition, activeTab = _a.activeTab, onTabSwitch = _a.onTabSwitch, mb = _a.mb, mt = _a.mt, minTabWidth = _a.minTabWidth;
16
17
  return (_jsx(TabPanel, { "$mb": mb, "$mt": mt, children: tabsDefinition.map(function (item, index) {
17
- return _jsx(Tab, { value: index, tabDefinition: item, isActive: index === activeTab, onTabSwitch: onTabSwitch }, index);
18
+ return (_jsx(Tab, { value: index, tabDefinition: item, isActive: index === activeTab, minWidth: minTabWidth, onTabSwitch: onTabSwitch }, index));
18
19
  }) }));
19
20
  };
@@ -2,7 +2,7 @@
2
2
  import { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ tabsDefinition, activeTab, onTabSwitch, mb, mt }: import("../types").TabsProps) => JSX.Element;
5
+ component: ({ tabsDefinition, activeTab, onTabSwitch, mb, mt, minTabWidth }: import("../types").TabsProps) => JSX.Element;
6
6
  tags: string[];
7
7
  argTypes: {};
8
8
  };
@@ -5,6 +5,7 @@ export declare const RoundedWrap: import("styled-components").StyledComponent<"d
5
5
  export declare const Tab: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
6
6
  active: boolean;
7
7
  disabled?: boolean | undefined;
8
+ minWidth?: string | string[] | undefined;
8
9
  }, never>;
9
10
  export declare const TabPanel: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
10
11
  $mb?: string | undefined;
@@ -7,10 +7,13 @@ export var StyledImageBox = styled(x.div)(templateObject_1 || (templateObject_1
7
7
  export var StyledTabWrapper = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: flex;\n flex-direction: row;\n align-items: center;\n position: relative;\n"], ["\n display: flex;\n flex-direction: row;\n align-items: center;\n position: relative;\n"])));
8
8
  export var RoundedWrap = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n display: flex !important;\n justify-content: center;\n align-items: center;\n height: 23px;\n background-color: ", ";\n border-radius: 29px;\n padding: 3px 10px;\n margin-left: 8px;\n"], ["\n display: flex !important;\n justify-content: center;\n align-items: center;\n height: 23px;\n background-color: ", ";\n border-radius: 29px;\n padding: 3px 10px;\n margin-left: 8px;\n"])), th.color('lightGray7'));
9
9
  var activeTab = css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n color: ", ";\n\n &:after {\n content: '';\n position: absolute;\n bottom: 2;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 4px;\n border-radius: 6px 6px 0px 0px;\n }\n & > div {\n display: inline;\n color: ", ";\n }\n"], ["\n color: ", ";\n\n &:after {\n content: '';\n position: absolute;\n bottom: 2;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 4px;\n border-radius: 6px 6px 0px 0px;\n }\n & > div {\n display: inline;\n color: ", ";\n }\n"])), th.color('red1'), th.color('red1'), th.color('typoPrimary'));
10
- export var Tab = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n padding: 0 8px 12px;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n letter-spacing: 0.03em;\n min-width: 100px;\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: 120px;\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n padding: 0 8px 12px;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n letter-spacing: 0.03em;\n min-width: 100px;\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: 120px;\n }\n"])), function (_a) {
10
+ export var Tab = styled.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n padding: 0 12px 12px;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n letter-spacing: 0.03em;\n min-width: ", ";\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: ", ";\n }\n"], ["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n cursor: ", ";\n padding: 0 12px 12px;\n transition: 200ms;\n color: ", ";\n font-weight: bold;\n font-size: 14px;\n letter-spacing: 0.03em;\n min-width: ", ";\n\n & > div {\n display: none;\n }\n &:not(:last-child) {\n margin-right: 0.5rem;\n }\n\n :hover {\n color: ", ";\n }\n\n :active {\n ", ";\n }\n\n ", ";\n\n @media (min-width: 400px) {\n min-width: ", ";\n }\n"])), function (_a) {
11
11
  var disabled = _a.disabled;
12
12
  return (disabled ? 'auto' : 'pointer');
13
13
  }, th.color('gray'), function (_a) {
14
+ var minWidth = _a.minWidth;
15
+ return minWidth ? (Array.isArray(minWidth) ? minWidth[0] : minWidth) : '100px';
16
+ }, function (_a) {
14
17
  var disabled = _a.disabled;
15
18
  return th.color(disabled ? 'gray' : 'typoPrimary');
16
19
  }, function (_a) {
@@ -19,6 +22,9 @@ export var Tab = styled.div(templateObject_5 || (templateObject_5 = __makeTempla
19
22
  }, function (_a) {
20
23
  var active = _a.active;
21
24
  return (active ? activeTab : '');
25
+ }, function (_a) {
26
+ var minWidth = _a.minWidth;
27
+ return minWidth ? (Array.isArray(minWidth) ? minWidth[1] : minWidth) : '120px';
22
28
  });
23
29
  export var TabPanel = styled.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n overflow: auto;\n width: fit-content;\n position: relative;\n margin-bottom: ", ";\n margin-top: ", ";\n align-items: stretch;\n\n &:after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 2px;\n }\n"], ["\n display: flex;\n align-items: center;\n overflow: auto;\n width: fit-content;\n position: relative;\n margin-bottom: ", ";\n margin-top: ", ";\n align-items: stretch;\n\n &:after {\n content: '';\n position: absolute;\n bottom: 0;\n left: 0;\n right: 0;\n background-color: ", ";\n height: 2px;\n }\n"])), function (_a) {
24
30
  var _b = _a.$mb, $mb = _b === void 0 ? 0 : _b;
@@ -12,12 +12,14 @@ export type TabsProps = {
12
12
  onTabSwitch: (tab: number) => void;
13
13
  mb?: string;
14
14
  mt?: string;
15
+ minTabWidth?: string | string[];
15
16
  };
16
17
  export type TabElementProps = {
17
18
  tabDefinition: TabDefinition;
18
19
  value: number;
19
20
  isActive: boolean;
20
21
  onTabSwitch: (tab: number) => void;
22
+ minWidth?: string | string[];
21
23
  };
22
24
  export type UseTabsHook = (tabDefinitions: TabDefinition[]) => {
23
25
  activeTab: number;
package/ui/index.es.js CHANGED
@@ -49634,13 +49634,15 @@ const Ewe = /* @__PURE__ */ ti(Iwe), kwe = at`
49634
49634
  cursor: ${({
49635
49635
  disabled: e
49636
49636
  }) => e ? "auto" : "pointer"};
49637
- padding: 0 8px 12px;
49637
+ padding: 0 12px 12px;
49638
49638
  transition: 200ms;
49639
49639
  color: ${V.color("gray")};
49640
49640
  font-weight: bold;
49641
49641
  font-size: 14px;
49642
49642
  letter-spacing: 0.03em;
49643
- min-width: 100px;
49643
+ min-width: ${({
49644
+ minWidth: e
49645
+ }) => e ? Array.isArray(e) ? e[0] : e : "100px"};
49644
49646
 
49645
49647
  & > div {
49646
49648
  display: none;
@@ -49666,7 +49668,9 @@ const Ewe = /* @__PURE__ */ ti(Iwe), kwe = at`
49666
49668
  }) => e ? Ak : ""};
49667
49669
 
49668
49670
  @media (min-width: 400px) {
49669
- min-width: 120px;
49671
+ min-width: ${({
49672
+ minWidth: e
49673
+ }) => e ? Array.isArray(e) ? e[1] : e : "120px"};
49670
49674
  }
49671
49675
  `, Vwe = _.div`
49672
49676
  display: flex;
@@ -49695,28 +49699,30 @@ const Ewe = /* @__PURE__ */ ti(Iwe), kwe = at`
49695
49699
  tabDefinition: e,
49696
49700
  value: t,
49697
49701
  isActive: n,
49698
- onTabSwitch: r
49702
+ onTabSwitch: r,
49703
+ minWidth: i
49699
49704
  }) => {
49700
49705
  const {
49701
- icon: i,
49702
- label: o,
49703
- badgeCount: l,
49704
- disabled: c
49705
- } = e, d = de(() => {
49706
+ icon: o,
49707
+ label: l,
49708
+ badgeCount: c,
49709
+ disabled: d
49710
+ } = e, f = de(() => {
49706
49711
  r(t);
49707
49712
  }, [r, t]);
49708
- return /* @__PURE__ */ p.jsx(Nwe, { children: /* @__PURE__ */ p.jsxs(Bwe, { onClick: c ? void 0 : d, active: n, disabled: c, children: [
49709
- i && /* @__PURE__ */ p.jsx(Dwe, { children: /* @__PURE__ */ p.jsx(bt, { icon: i }) }),
49710
- /* @__PURE__ */ p.jsx(T7, { children: o }),
49711
- l === 0 || l && l > 0 && /* @__PURE__ */ p.jsx(jwe, { children: /* @__PURE__ */ p.jsx(T7, { variant: "medium", children: l }) })
49713
+ return /* @__PURE__ */ p.jsx(Nwe, { children: /* @__PURE__ */ p.jsxs(Bwe, { onClick: d ? void 0 : f, active: n, disabled: d, minWidth: i, children: [
49714
+ o && /* @__PURE__ */ p.jsx(Dwe, { children: /* @__PURE__ */ p.jsx(bt, { icon: o }) }),
49715
+ /* @__PURE__ */ p.jsx(T7, { children: l }),
49716
+ c === 0 || c && c > 0 && /* @__PURE__ */ p.jsx(jwe, { children: /* @__PURE__ */ p.jsx(T7, { variant: "medium", children: c }) })
49712
49717
  ] }) });
49713
49718
  }, EIe = ({
49714
49719
  tabsDefinition: e,
49715
49720
  activeTab: t,
49716
49721
  onTabSwitch: n,
49717
49722
  mb: r,
49718
- mt: i
49719
- }) => /* @__PURE__ */ p.jsx(Vwe, { $mb: r, $mt: i, children: e.map((o, l) => /* @__PURE__ */ p.jsx(Fwe, { value: l, tabDefinition: o, isActive: l === t, onTabSwitch: n }, l)) }), kIe = ({
49723
+ mt: i,
49724
+ minTabWidth: o
49725
+ }) => /* @__PURE__ */ p.jsx(Vwe, { $mb: r, $mt: i, children: e.map((l, c) => /* @__PURE__ */ p.jsx(Fwe, { value: c, tabDefinition: l, isActive: c === t, minWidth: o, onTabSwitch: n }, c)) }), kIe = ({
49720
49726
  activeTab: e,
49721
49727
  value: t,
49722
49728
  children: n
package/ui/index.umd.js CHANGED
@@ -4033,13 +4033,13 @@ function print() { __p += __j.call(arguments, '') }
4033
4033
  align-items: center;
4034
4034
  justify-content: center;
4035
4035
  cursor: ${({disabled:e})=>e?"auto":"pointer"};
4036
- padding: 0 8px 12px;
4036
+ padding: 0 12px 12px;
4037
4037
  transition: 200ms;
4038
4038
  color: ${F.color("gray")};
4039
4039
  font-weight: bold;
4040
4040
  font-size: 14px;
4041
4041
  letter-spacing: 0.03em;
4042
- min-width: 100px;
4042
+ min-width: ${({minWidth:e})=>e?Array.isArray(e)?e[0]:e:"100px"};
4043
4043
 
4044
4044
  & > div {
4045
4045
  display: none;
@@ -4059,7 +4059,7 @@ function print() { __p += __j.call(arguments, '') }
4059
4059
  ${({active:e})=>e?Lj:""};
4060
4060
 
4061
4061
  @media (min-width: 400px) {
4062
- min-width: 120px;
4062
+ min-width: ${({minWidth:e})=>e?Array.isArray(e)?e[1]:e:"120px"};
4063
4063
  }
4064
4064
  `,_xe=Z.div`
4065
4065
  display: flex;
@@ -4080,7 +4080,7 @@ function print() { __p += __j.call(arguments, '') }
4080
4080
  background-color: ${F.color("bgLightGray1")};
4081
4081
  height: 2px;
4082
4082
  }
4083
- `,Zxe=({tabDefinition:e,value:t,isActive:n,onTabSwitch:r})=>{const{icon:i,label:o,badgeCount:l,disabled:c}=e,d=C.useCallback(()=>{r(t)},[r,t]);return p.jsx(zxe,{children:p.jsxs(Gxe,{onClick:c?void 0:d,active:n,disabled:c,children:[i&&p.jsx(Hxe,{children:p.jsx(ht,{icon:i})}),p.jsx(Gg,{children:o}),l===0||l&&l>0&&p.jsx(Wxe,{children:p.jsx(Gg,{variant:"medium",children:l})})]})})},Uxe=({tabsDefinition:e,activeTab:t,onTabSwitch:n,mb:r,mt:i})=>p.jsx(_xe,{$mb:r,$mt:i,children:e.map((o,l)=>p.jsx(Zxe,{value:l,tabDefinition:o,isActive:l===t,onTabSwitch:n},l))}),Yxe=({activeTab:e,value:t,children:n})=>e===t?n:null,Jxe=e=>{const t=e.map(l=>l.default).indexOf(!0),n=t===-1?0:t,[r,i]=C.useState(n),o=C.useCallback(l=>{i(l)},[]);return{activeTab:r,onTabSwitch:o}},Xxe=on(Re.div)`
4083
+ `,Zxe=({tabDefinition:e,value:t,isActive:n,onTabSwitch:r,minWidth:i})=>{const{icon:o,label:l,badgeCount:c,disabled:d}=e,f=C.useCallback(()=>{r(t)},[r,t]);return p.jsx(zxe,{children:p.jsxs(Gxe,{onClick:d?void 0:f,active:n,disabled:d,minWidth:i,children:[o&&p.jsx(Hxe,{children:p.jsx(ht,{icon:o})}),p.jsx(Gg,{children:l}),c===0||c&&c>0&&p.jsx(Wxe,{children:p.jsx(Gg,{variant:"medium",children:c})})]})})},Uxe=({tabsDefinition:e,activeTab:t,onTabSwitch:n,mb:r,mt:i,minTabWidth:o})=>p.jsx(_xe,{$mb:r,$mt:i,children:e.map((l,c)=>p.jsx(Zxe,{value:c,tabDefinition:l,isActive:c===t,minWidth:o,onTabSwitch:n},c))}),Yxe=({activeTab:e,value:t,children:n})=>e===t?n:null,Jxe=e=>{const t=e.map(l=>l.default).indexOf(!0),n=t===-1?0:t,[r,i]=C.useState(n),o=C.useCallback(l=>{i(l)},[]);return{activeTab:r,onTabSwitch:o}},Xxe=on(Re.div)`
4084
4084
  width: calc(100vw - 20px);
4085
4085
  display: flex;
4086
4086
  min-height: 48px;