@mailstep/design-system 0.6.35 → 0.6.37

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.35",
3
+ "version": "0.6.37",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -3,10 +3,9 @@ export type Props = {
3
3
  children?: React.ReactNode;
4
4
  label?: string | number | JSX.Element;
5
5
  color?: string;
6
- size?: string | number;
6
+ size?: 'small' | 'default';
7
7
  childWidth?: string | number;
8
8
  topPosition?: boolean;
9
- fontSize?: number;
10
9
  };
11
- declare const Badge: ({ children, color, size, fontSize, label, childWidth, topPosition }: Props) => JSX.Element;
10
+ declare const Badge: ({ children, color, size, label, childWidth, topPosition }: Props) => JSX.Element;
12
11
  export default Badge;
@@ -5,21 +5,25 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
5
5
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
6
  import styled, { css, useTheme } from '@xstyled/styled-components';
7
7
  import { th } from '@xstyled/styled-components';
8
- var Circle = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n color: white;\n background-color: ", ";\n border-radius: 50%;\n width: ", ";\n height: ", ";\n\n .label {\n font-family: ", ";\n font-weight: 600;\n vertical-align: middle;\n text-align: center;\n font-size: ", ";\n }\n\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(", ");\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 2px;\n color: white;\n background-color: ", ";\n border-radius: 50%;\n width: ", ";\n height: ", ";\n\n .label {\n font-family: ", ";\n font-weight: 600;\n vertical-align: middle;\n text-align: center;\n font-size: ", ";\n }\n\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(", ");\n"])), function (_a) {
9
- var color = _a.color;
10
- return color;
11
- }, function (_a) {
8
+ import { useMemo } from 'react';
9
+ var Circle = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n min-width: 12px;\n display: flex;\n align-items: center;\n height: ", ";\n padding: ", ";\n color: white;\n gap: 10px;\n background-color: ", ";\n border-radius: 29px;\n line-height: 15.6px;\n font-family: ", ";\n font-size: ", ";\n font-weight: semiBold;\n position: absolute;\n top: ", ";\n left: ", ";\n z-index: 1;\n"], ["\n min-width: 12px;\n display: flex;\n align-items: center;\n height: ", ";\n padding: ", ";\n color: white;\n gap: 10px;\n background-color: ", ";\n border-radius: 29px;\n line-height: 15.6px;\n font-family: ", ";\n font-size: ", ";\n font-weight: semiBold;\n position: absolute;\n top: ", ";\n left: ", ";\n z-index: 1;\n"])), function (_a) {
12
10
  var size = _a.size;
13
- return size;
11
+ return (size === 'small' ? '16px' : '24px');
14
12
  }, function (_a) {
15
13
  var size = _a.size;
16
- return size;
14
+ return (size === 'small' ? '0 5px' : '3px 8px');
15
+ }, function (_a) {
16
+ var color = _a.color;
17
+ return color;
17
18
  }, th('fonts.primary'), function (_a) {
18
- var fontSize = _a.fontSize;
19
- return "".concat(fontSize, "px");
19
+ var size = _a.size;
20
+ return (size === 'small' ? '12px' : '14px');
21
+ }, function (_a) {
22
+ var topPosition = _a.topPosition;
23
+ return topPosition && '-15%';
20
24
  }, function (_a) {
21
25
  var topPosition = _a.topPosition;
22
- return (topPosition ? '75%, -75%' : '50%, -50%');
26
+ return (topPosition ? '50%' : '100%');
23
27
  });
24
28
  var RelativeWrap = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n ", ";\n"], ["\n position: relative;\n ", ";\n"])), function (_a) {
25
29
  var width = _a.width;
@@ -27,14 +31,16 @@ var RelativeWrap = styled.div(templateObject_3 || (templateObject_3 = __makeTemp
27
31
  ? css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: ", ";\n "], ["\n width: ", ";\n "])), width) : '';
28
32
  });
29
33
  var Badge = function (_a) {
30
- var children = _a.children, _b = _a.color, color = _b === void 0 ? 'red2' : _b, _c = _a.size, size = _c === void 0 ? 6 : _c, _d = _a.fontSize, fontSize = _d === void 0 ? 10 : _d, 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;
31
35
  var theme = useTheme();
32
36
  var themeColor = th.color(color)({ theme: theme });
33
- var themeSize = th.fontSize(size)({ theme: theme });
37
+ var badgeLabel = useMemo(function () {
38
+ return typeof label === 'number' ? (label >= 100 ? '99+' : label) : label;
39
+ }, [label]);
34
40
  if (!label || (typeof label === 'number' && label <= 0)) {
35
41
  return _jsx(_Fragment, { children: children });
36
42
  }
37
- return (_jsxs(RelativeWrap, { width: childWidth, children: [_jsx(Circle, { color: themeColor, size: themeSize, topPosition: topPosition, fontSize: fontSize, children: _jsx("div", { className: "label", children: label }) }), children] }));
43
+ return (_jsxs(RelativeWrap, { width: childWidth, children: [_jsx(Circle, { color: themeColor, size: size, topPosition: topPosition, children: _jsx("div", { className: "label", children: badgeLabel }) }), children] }));
38
44
  };
39
45
  export default Badge;
40
46
  var templateObject_1, templateObject_2, templateObject_3;
@@ -2,11 +2,12 @@
2
2
  import type { StoryObj } from '@storybook/react';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ children, color, size, fontSize, label, childWidth, topPosition }: import("../Badge").Props) => JSX.Element;
5
+ component: ({ children, color, size, label, childWidth, topPosition }: 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
- export declare const Primary: Story;
12
- export declare const Colored: Story;
11
+ export declare const Default: Story;
12
+ export declare const DefaultWithLabel: Story;
13
+ export declare const SmallWithLabel: Story;
@@ -6,19 +6,28 @@ var meta = {
6
6
  argTypes: {},
7
7
  };
8
8
  export default meta;
9
- export var Primary = {
9
+ export var Default = {
10
10
  args: {
11
11
  children: '😀',
12
- size: 1,
12
+ size: 'default',
13
13
  childWidth: '30px',
14
14
  },
15
15
  };
16
- export var Colored = {
16
+ export var DefaultWithLabel = {
17
+ args: {
18
+ children: '😀',
19
+ label: '10',
20
+ size: 'default',
21
+ childWidth: '30px',
22
+ },
23
+ };
24
+ export var SmallWithLabel = {
17
25
  args: {
18
26
  children: '😃',
19
27
  label: '10',
20
- size: 4,
28
+ size: 'small',
21
29
  color: 'darkGreen',
30
+ topPosition: true,
22
31
  childWidth: '50px',
23
32
  },
24
33
  };
@@ -0,0 +1,3 @@
1
+ import { type FC } from 'react';
2
+ import { SvgProps } from '../types';
3
+ export declare const ArrowForward: FC<SvgProps>;
@@ -0,0 +1,13 @@
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 } from "react/jsx-runtime";
13
+ export var ArrowForward = function (props) { return (_jsx("svg", __assign({ width: "7", height: "11", viewBox: "0 0 7 11", fill: "#A3B3C1" }, props, { children: _jsx("path", { d: "M0.244995 9.565L1.13 10.45L6.08 5.5L1.13 0.550003L0.244995 1.435L4.31 5.5L0.244995 9.565Z" }) }))); };
@@ -59,3 +59,4 @@ export { Desktop } from './Desktop';
59
59
  export { Message } from './Message';
60
60
  export { ToastSuccess } from './ToastSuccess';
61
61
  export { ToastError } from './ToastError';
62
+ export { ArrowForward } from './ArrowForward';
@@ -59,3 +59,4 @@ export { Desktop } from './Desktop';
59
59
  export { Message } from './Message';
60
60
  export { ToastSuccess } from './ToastSuccess';
61
61
  export { ToastError } from './ToastError';
62
+ export { ArrowForward } from './ArrowForward';