@mailstep/design-system 0.6.34 → 0.6.36

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.34",
3
+ "version": "0.6.36",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -4,19 +4,15 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
4
4
  };
5
5
  import { jsx as _jsx } from "react/jsx-runtime";
6
6
  import React from 'react';
7
- import styled, { useTheme } from '@xstyled/styled-components';
8
- import { th } from '@xstyled/system';
7
+ import styled from '@xstyled/styled-components';
9
8
  import get from 'lodash/fp/get';
10
- import Icon from '../../../../Elements/Icon/Icon';
9
+ import { ToastError, ToastSuccess } from '../../../../Elements/Icon';
11
10
  var Center = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n justify-content: center;\n width: 100%;\n"], ["\n display: flex;\n justify-content: center;\n width: 100%;\n"])));
12
11
  var BoolIcon = function (_a) {
13
12
  var rowData = _a.rowData, column = _a.column;
14
- var theme = useTheme();
15
13
  var value = get(column.name, rowData);
16
- var icon = value ? 'check' : 'false';
17
- var colorName = value ? 'green' : 'lightGray3';
18
- var themeColor = th.color(colorName)({ theme: theme });
19
- return (_jsx(Center, { children: _jsx(Icon, { icon: icon, fill: themeColor, size: "14px" }) }));
14
+ var icon = value ? _jsx(ToastSuccess, {}) : _jsx(ToastError, {});
15
+ return _jsx(Center, { children: icon });
20
16
  };
21
17
  export var BoolIconCell = React.memo(BoolIcon);
22
18
  var templateObject_1;
@@ -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 { SvgProps } from '../types';
2
+ import { FC } from 'react';
3
+ export declare const ToastError: 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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export var ToastError = function (props) { return (_jsxs("svg", __assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "#A3B3C1" }, props, { children: [_jsx("g", { clipPath: "url(#clip0_1818_912)", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 15.5C12.1421 15.5 15.5 12.1421 15.5 8C15.5 3.85786 12.1421 0.5 8 0.5C3.85786 0.5 0.5 3.85786 0.5 8C0.5 12.1421 3.85786 15.5 8 15.5ZM5.19458 5.19477C5.48748 4.90187 5.96235 4.90187 6.25524 5.19477L8.16626 7.10578L10.0773 5.19477C10.3702 4.90187 10.845 4.90187 11.1379 5.19477C11.4308 5.48766 11.4308 5.96253 11.1379 6.25543L9.22692 8.16644L11.1379 10.0774C11.4308 10.3703 11.4308 10.8452 11.1379 11.1381C10.845 11.431 10.3702 11.431 10.0773 11.1381L8.16626 9.2271L6.25525 11.1381C5.96236 11.431 5.48749 11.431 5.19459 11.1381C4.9017 10.8452 4.9017 10.3703 5.19459 10.0774L7.1056 8.16644L5.19458 6.25543C4.90169 5.96253 4.90169 5.48766 5.19458 5.19477Z" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_1818_912", children: _jsx("rect", { width: "15", height: "15", fill: "white", transform: "translate(0.5 0.5)" }) }) })] }))); };
@@ -0,0 +1,3 @@
1
+ import { SvgProps } from '../types';
2
+ import { FC } from 'react';
3
+ export declare const ToastSuccess: 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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ export var ToastSuccess = function (props) { return (_jsxs("svg", __assign({ width: "16", height: "16", viewBox: "0 0 16 16", fill: "#00A445" }, props, { children: [_jsx("g", { clipPath: "url(#clip0_1818_895)", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8 15.5C12.1421 15.5 15.5 12.1421 15.5 8C15.5 3.85786 12.1421 0.5 8 0.5C3.85786 0.5 0.5 3.85786 0.5 8C0.5 12.1421 3.85786 15.5 8 15.5ZM11.6081 6.3074C11.916 5.97153 11.8933 5.44966 11.5575 5.14178C11.2216 4.8339 10.6997 4.85659 10.3918 5.19246L6.87498 9.02902L5.60813 7.647C5.30025 7.31113 4.77838 7.28844 4.4425 7.59633C4.10663 7.90421 4.08394 8.42608 4.39183 8.76195L6.26683 10.8074C6.42309 10.9779 6.64372 11.0749 6.87498 11.0749C7.10623 11.0749 7.32687 10.9779 7.48313 10.8074L11.6081 6.3074Z" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_1818_895", children: _jsx("rect", { width: "15", height: "15", fill: "white", transform: "translate(0.5 0.5)" }) }) })] }))); };
@@ -57,3 +57,5 @@ export { ArrowDown } from './ArrowDown';
57
57
  export { ArrowUp } from './ArrowUp';
58
58
  export { Desktop } from './Desktop';
59
59
  export { Message } from './Message';
60
+ export { ToastSuccess } from './ToastSuccess';
61
+ export { ToastError } from './ToastError';
@@ -57,3 +57,5 @@ export { ArrowDown } from './ArrowDown';
57
57
  export { ArrowUp } from './ArrowUp';
58
58
  export { Desktop } from './Desktop';
59
59
  export { Message } from './Message';
60
+ export { ToastSuccess } from './ToastSuccess';
61
+ export { ToastError } from './ToastError';