@mailstep/design-system 0.6.49 → 0.6.50

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.6.49",
3
+ "version": "0.6.50",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -6,6 +6,7 @@ export type Props = {
6
6
  size?: 'small' | 'default';
7
7
  childWidth?: string | number;
8
8
  topPosition?: boolean;
9
+ horizontalPosition?: 'middle' | 'right';
9
10
  };
10
- declare const Badge: ({ children, color, size, label, childWidth, topPosition }: Props) => JSX.Element;
11
+ declare const Badge: ({ children, color, size, label, childWidth, topPosition, horizontalPosition }: Props) => JSX.Element;
11
12
  export default Badge;
@@ -22,8 +22,8 @@ var Circle = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateOb
22
22
  var topPosition = _a.topPosition;
23
23
  return topPosition && '-15%';
24
24
  }, function (_a) {
25
- var topPosition = _a.topPosition;
26
- return (topPosition ? '50%' : '100%');
25
+ var horizontalPosition = _a.horizontalPosition;
26
+ return (horizontalPosition === 'middle' ? '50%' : '100%');
27
27
  });
28
28
  var RelativeWrap = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n ", ";\n"], ["\n position: relative;\n ", ";\n"])), function (_a) {
29
29
  var width = _a.width;
@@ -31,7 +31,7 @@ var RelativeWrap = styled.div(templateObject_3 || (templateObject_3 = __makeTemp
31
31
  ? css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), width) : '';
32
32
  });
33
33
  var Badge = function (_a) {
34
- var children = _a.children, _b = _a.color, color = _b === void 0 ? 'red1' : _b, _c = _a.size, size = _c === void 0 ? 'default' : _c, label = _a.label, childWidth = _a.childWidth, topPosition = _a.topPosition;
34
+ var children = _a.children, _b = _a.color, color = _b === void 0 ? 'red1' : _b, _c = _a.size, size = _c === void 0 ? 'default' : _c, label = _a.label, childWidth = _a.childWidth, topPosition = _a.topPosition, _d = _a.horizontalPosition, horizontalPosition = _d === void 0 ? 'middle' : _d;
35
35
  var theme = useTheme();
36
36
  var themeColor = th.color(color)({ theme: theme });
37
37
  var badgeLabel = useMemo(function () {
@@ -40,7 +40,7 @@ var Badge = function (_a) {
40
40
  if (!label || (typeof label === 'number' && label <= 0)) {
41
41
  return _jsx(_Fragment, { children: children });
42
42
  }
43
- return (_jsxs(RelativeWrap, { width: childWidth, children: [_jsx(Circle, { color: themeColor, size: size, topPosition: topPosition, children: _jsx("div", { className: "label", children: badgeLabel }) }), children] }));
43
+ return (_jsxs(RelativeWrap, { width: childWidth, children: [_jsx(Circle, { color: themeColor, size: size, topPosition: topPosition, horizontalPosition: horizontalPosition, children: _jsx("div", { className: "label", children: badgeLabel }) }), children] }));
44
44
  };
45
45
  export default Badge;
46
46
  var templateObject_1, templateObject_2, templateObject_3;
@@ -2,12 +2,12 @@
2
2
  import type { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ children, color, size, label, childWidth, topPosition }: import("../Badge").Props) => JSX.Element;
5
+ component: ({ children, color, size, label, childWidth, topPosition, horizontalPosition }: import("../Badge").Props) => JSX.Element;
6
6
  tags: string[];
7
7
  argTypes: {};
8
8
  };
9
9
  export default meta;
10
10
  type Story = StoryObj<typeof meta>;
11
11
  export declare const Default: Story;
12
- export declare const DefaultWithLabel: Story;
12
+ export declare const DefaultWithLabelAndRightHorizontalPosition: Story;
13
13
  export declare const SmallWithLabel: Story;
@@ -3,23 +3,24 @@ var meta = {
3
3
  title: 'Elements/Badge',
4
4
  component: Badge,
5
5
  tags: ['autodocs'],
6
- argTypes: {},
6
+ argTypes: {}
7
7
  };
8
8
  export default meta;
9
9
  export var Default = {
10
10
  args: {
11
11
  children: '😀',
12
12
  size: 'default',
13
- childWidth: '30px',
14
- },
13
+ childWidth: '30px'
14
+ }
15
15
  };
16
- export var DefaultWithLabel = {
16
+ export var DefaultWithLabelAndRightHorizontalPosition = {
17
17
  args: {
18
18
  children: '😀',
19
19
  label: '10',
20
20
  size: 'default',
21
- childWidth: '30px',
22
- },
21
+ horizontalPosition: 'right',
22
+ childWidth: '30px'
23
+ }
23
24
  };
24
25
  export var SmallWithLabel = {
25
26
  args: {
@@ -28,6 +29,6 @@ export var SmallWithLabel = {
28
29
  size: 'small',
29
30
  color: 'darkGreen',
30
31
  topPosition: true,
31
- childWidth: '50px',
32
- },
32
+ childWidth: '30px'
33
+ }
33
34
  };
package/ui/index.es.js CHANGED
@@ -16912,8 +16912,8 @@ const Hle = Ti(ft.div)`
16912
16912
  topPosition: e
16913
16913
  }) => e && "-15%"};
16914
16914
  left: ${({
16915
- topPosition: e
16916
- }) => e ? "50%" : "100%"};
16915
+ horizontalPosition: e
16916
+ }) => e === "middle" ? "50%" : "100%"};
16917
16917
  z-index: 1;
16918
16918
  `, nce = ie.div`
16919
16919
  position: relative;
@@ -16928,13 +16928,14 @@ const Hle = Ti(ft.div)`
16928
16928
  size: r = "default",
16929
16929
  label: n,
16930
16930
  childWidth: i,
16931
- topPosition: o
16931
+ topPosition: o,
16932
+ horizontalPosition: l = "middle"
16932
16933
  }) => {
16933
- const l = Ct(), c = te.color(t)({
16934
- theme: l
16935
- }), u = at(() => typeof n == "number" && n >= 100 ? "99+" : n, [n]);
16934
+ const c = Ct(), u = te.color(t)({
16935
+ theme: c
16936
+ }), f = at(() => typeof n == "number" && n >= 100 ? "99+" : n, [n]);
16936
16937
  return !n || typeof n == "number" && n <= 0 ? /* @__PURE__ */ b.jsx(b.Fragment, { children: e }) : /* @__PURE__ */ b.jsxs(nce, { width: i, children: [
16937
- /* @__PURE__ */ b.jsx(rce, { color: c, size: r, topPosition: o, children: /* @__PURE__ */ b.jsx("div", { className: "label", children: u }) }),
16938
+ /* @__PURE__ */ b.jsx(rce, { color: u, size: r, topPosition: o, horizontalPosition: l, children: /* @__PURE__ */ b.jsx("div", { className: "label", children: f }) }),
16938
16939
  e
16939
16940
  ] });
16940
16941
  }, ice = ie(ft.div)`
package/ui/index.umd.js CHANGED
@@ -1665,14 +1665,14 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1665
1665
  font-weight: semiBold;
1666
1666
  position: absolute;
1667
1667
  top: ${({topPosition:e})=>e&&"-15%"};
1668
- left: ${({topPosition:e})=>e?"50%":"100%"};
1668
+ left: ${({horizontalPosition:e})=>e==="middle"?"50%":"100%"};
1669
1669
  z-index: 1;
1670
1670
  `,Jue=ae.div`
1671
1671
  position: relative;
1672
1672
  ${({width:e})=>e?wt`
1673
1673
  width: ${e};
1674
1674
  `:""};
1675
- `,Xue=({children:e,color:t="red1",size:r="default",label:n,childWidth:i,topPosition:o})=>{const l=mt(),u=re.color(t)({theme:l}),c=I.useMemo(()=>typeof n=="number"&&n>=100?"99+":n,[n]);return!n||typeof n=="number"&&n<=0?b.jsx(b.Fragment,{children:e}):b.jsxs(Jue,{width:i,children:[b.jsx(Uue,{color:u,size:r,topPosition:o,children:b.jsx("div",{className:"label",children:c})}),e]})},que=ae(ot.div)`
1675
+ `,Xue=({children:e,color:t="red1",size:r="default",label:n,childWidth:i,topPosition:o,horizontalPosition:l="middle"})=>{const u=mt(),c=re.color(t)({theme:u}),f=I.useMemo(()=>typeof n=="number"&&n>=100?"99+":n,[n]);return!n||typeof n=="number"&&n<=0?b.jsx(b.Fragment,{children:e}):b.jsxs(Jue,{width:i,children:[b.jsx(Uue,{color:c,size:r,topPosition:o,horizontalPosition:l,children:b.jsx("div",{className:"label",children:f})}),e]})},que=ae(ot.div)`
1676
1676
  display: flex;
1677
1677
  box-sizing: border-box;
1678
1678
  flex-direction: column;