@mailstep/design-system 0.6.0 → 0.6.1

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.0",
3
+ "version": "0.6.1",
4
4
  "license": "ISC",
5
5
  "type": "module",
6
6
  "main": "./ui/index.js",
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { memo, useCallback, useMemo, useEffect } from 'react';
3
3
  import { Icon, Cancel } from '../../Elements/Icon';
4
4
  import { H2, H5 } from '../../Elements/Typography';
5
- import { DialogOverlay, DialogWindow, HeaderContainer, ButtonsContainer, ContentContainer, TitleContainer, CloseButton, } from './styles';
5
+ import { DialogOverlay, DialogWindow, HeaderContainer, ButtonsContainer, ContentContainer, TitleContainer, CloseButton, ButtonsWrapper, } from './styles';
6
6
  import { x } from '@xstyled/styled-components';
7
7
  import { Button } from '../../Elements/Button';
8
8
  import { Portal } from '../../Elements/Portal';
@@ -32,5 +32,5 @@ export var Modal = memo(function (_a) {
32
32
  if (!isShown) {
33
33
  return null;
34
34
  }
35
- return (_jsx(Portal, { children: _jsx(DialogOverlay, { backgroundColor: overlayColor, children: _jsxs(DialogWindow, { ref: dialogRef, style: dialogStyle, "$backgroundColor": background, top: top, "data-cy": "dialogWindow", onClick: closeEverywhere ? closeDialog : undefined, "$minWidth": minWidth, "$minHeight": minHeight, "$maxWidth": maxWidth, "$maxHeight": maxHeight, variant: variant, children: [title && hasHeader && (_jsx(HeaderContainer, { variant: variant, children: _jsxs(TitleContainer, { children: [titleIcon && (_jsx(x.div, { as: "span", className: "icon", children: typeof titleIcon === 'string' ? _jsx(Icon, { icon: titleIcon, fill: "blue2" }) : titleIcon })), variant == 'default' ? (_jsx(H2, { mt: 0, mb: 0, variant: "bold", children: title })) : (_jsx(H5, { mt: 0, mb: 0, variant: "bold", children: title }))] }) })), withCloseIcon && (_jsx(CloseButton, { onClick: closeDialog, "data-cy": "dialogCloseBtn", children: _jsx(Cancel, { width: "11px", height: "11px" }) })), _jsx(ContentContainer, { variant: variant, children: children }), hasFooter && (onExtraAction || onCancel || onConfirm) && (_jsxs(ButtonsContainer, { hasSpaceBetween: !!onExtraAction, children: [onExtraAction && (_jsx(Button, { type: "button", onClick: onExtraAction, isLoading: isLoading, "data-cy": "extraActionBtn", appearance: "ghostDanger", children: extraActionLabel })), _jsxs(x.div, { children: [onCancel && (_jsx(Button, { type: "button", onClick: onCancel, isLoading: isLoading, "data-cy": "cancelBtn", appearance: "primaryLight", children: cancelLabel ? cancelLabel : 'Cancel' })), onConfirm && (_jsx(Button, { type: "button", onClick: onDialogConfirmClick, isLoading: isLoading, disabled: isConfirmDisabled, "data-cy": "submitBtn", children: confirmLabel ? confirmLabel : 'Submit' }))] })] }))] }) }) }));
35
+ return (_jsx(Portal, { children: _jsx(DialogOverlay, { backgroundColor: overlayColor, children: _jsxs(DialogWindow, { ref: dialogRef, style: dialogStyle, "$backgroundColor": background, top: top, "data-cy": "dialogWindow", onClick: closeEverywhere ? closeDialog : undefined, "$minWidth": minWidth, "$minHeight": minHeight, "$maxWidth": maxWidth, "$maxHeight": maxHeight, variant: variant, children: [title && hasHeader && (_jsx(HeaderContainer, { variant: variant, children: _jsxs(TitleContainer, { children: [titleIcon && (_jsx(x.div, { as: "span", className: "icon", children: typeof titleIcon === 'string' ? _jsx(Icon, { icon: titleIcon, fill: "blue2" }) : titleIcon })), variant == 'default' ? (_jsx(H2, { mt: 0, mb: 0, variant: "bold", children: title })) : (_jsx(H5, { mt: 0, mb: 0, variant: "bold", children: title }))] }) })), withCloseIcon && (_jsx(CloseButton, { onClick: closeDialog, "data-cy": "dialogCloseBtn", children: _jsx(Cancel, { width: "11px", height: "11px" }) })), _jsx(ContentContainer, { variant: variant, children: children }), hasFooter && (onExtraAction || onCancel || onConfirm) && (_jsxs(ButtonsContainer, { hasSpaceBetween: !!onExtraAction, children: [onExtraAction && (_jsx(Button, { type: "button", onClick: onExtraAction, isLoading: isLoading, "data-cy": "extraActionBtn", appearance: "ghostDanger", children: extraActionLabel })), _jsxs(ButtonsWrapper, { hasExtraAction: !!onExtraAction, hasBothButtons: !!onCancel && !!onConfirm, children: [onCancel && (_jsx(Button, { type: "button", onClick: onCancel, isLoading: isLoading, "data-cy": "cancelBtn", appearance: "primaryLight", children: cancelLabel ? cancelLabel : 'Cancel' })), onConfirm && (_jsx(Button, { type: "button", onClick: onDialogConfirmClick, isLoading: isLoading, disabled: isConfirmDisabled, "data-cy": "submitBtn", children: confirmLabel ? confirmLabel : 'Submit' }))] })] }))] }) }) }));
36
36
  });
@@ -32,7 +32,7 @@ export var ModalTopPosition = {
32
32
  title: 'Modal default version',
33
33
  children: _jsx(_Fragment, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed condimentum id eros ac consequat." }),
34
34
  variant: 'default',
35
- top: '0'
35
+ top: '0',
36
36
  },
37
37
  };
38
38
  export var ModalWithCloseAndConfirmBtns = {
@@ -40,6 +40,10 @@ export var ModalWithCloseAndConfirmBtns = {
40
40
  children: _jsx(_Fragment, { children: "Modal with narrow width" }),
41
41
  title: 'Modal title',
42
42
  width: 'narrow',
43
+ withCloseIcon: true,
44
+ onCancel: function () { return console.log('Cancel'); },
45
+ onConfirm: function () { return console.log('Confirm'); },
46
+ onExtraAction: undefined,
43
47
  },
44
48
  };
45
49
  export var ModalWithoutCloseButton = {
@@ -21,4 +21,8 @@ export declare const TitleContainer: import("styled-components").StyledComponent
21
21
  export declare const ButtonsContainer: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
22
22
  hasSpaceBetween: boolean;
23
23
  }, never>;
24
+ export declare const ButtonsWrapper: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
25
+ hasExtraAction: boolean;
26
+ hasBothButtons: boolean;
27
+ }, never>;
24
28
  export declare const CloseButton: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
@@ -67,9 +67,16 @@ export var ContentContainer = styled.div(templateObject_13 || (templateObject_13
67
67
  return variantStyles(Component.ContentContainer, variant);
68
68
  });
69
69
  export var TitleContainer = styled.div(templateObject_14 || (templateObject_14 = __makeTemplateObject(["\n display: flex;\n flex-flow: row;\n align-items: center;\n color: typoPrimary;\n padding-right: 34px;\n\n > div:first-of-type {\n margin-right: 0.5em;\n display: block;\n }\n\n .icon {\n font-size: 24px;\n margin-right: 15px;\n display: flex;\n\n @media (max-width: 576px) {\n font-size: 18px;\n margin-right: 12px;\n }\n }\n"], ["\n display: flex;\n flex-flow: row;\n align-items: center;\n color: typoPrimary;\n padding-right: 34px;\n\n > div:first-of-type {\n margin-right: 0.5em;\n display: block;\n }\n\n .icon {\n font-size: 24px;\n margin-right: 15px;\n display: flex;\n\n @media (max-width: 576px) {\n font-size: 18px;\n margin-right: 12px;\n }\n }\n"])));
70
- export var ButtonsContainer = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n > div > * {\n margin: 0 0.5em;\n }\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n > div > * {\n margin: 0 0.5em;\n }\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"])), th.color('lightGray6'), function (_a) {
70
+ export var ButtonsContainer = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"], ["\n display: flex;\n align-items: center;\n padding: 1.5rem;\n border-top: 1px solid ", ";\n text-align: right;\n justify-content: ", ";\n\n @media (max-width: 576px) {\n display: flex;\n justify-content: space-around;\n padding: 32px 18px 18px;\n\n > * {\n margin: 0;\n }\n }\n"])), th.color('lightGray6'), function (_a) {
71
71
  var hasSpaceBetween = _a.hasSpaceBetween;
72
72
  return (hasSpaceBetween ? 'space-between' : 'flex-end');
73
73
  });
74
- export var CloseButton = styled.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"], ["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"])));
75
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16;
74
+ export var ButtonsWrapper = styled.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n width: ", ";\n display: flex;\n justify-content: inherit;\n column-gap: 8px;\n\n @media (max-width: 576px) {\n & > button {\n width: ", ";\n }\n }\n"], ["\n width: ", ";\n display: flex;\n justify-content: inherit;\n column-gap: 8px;\n\n @media (max-width: 576px) {\n & > button {\n width: ", ";\n }\n }\n"])), function (_a) {
75
+ var hasExtraAction = _a.hasExtraAction;
76
+ return (hasExtraAction ? 'auto' : '100%');
77
+ }, function (_a) {
78
+ var hasBothButtons = _a.hasBothButtons;
79
+ return (hasBothButtons ? '50%' : 'auto');
80
+ });
81
+ export var CloseButton = styled.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"], ["\n position: absolute;\n z-index: 2;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n top: 11px;\n right: 20px;\n width: 34px;\n height: 34px;\n"])));
82
+ var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8, templateObject_9, templateObject_10, templateObject_11, templateObject_12, templateObject_13, templateObject_14, templateObject_15, templateObject_16, templateObject_17;
@@ -11,7 +11,7 @@ var ErrorWrap = styled.div(templateObject_2 || (templateObject_2 = __makeTemplat
11
11
  var StyledWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n .inline {\n margin-top: 1;\n svg {\n margin-right: 2;\n }\n }\n .tooltip {\n ", "\n svg {\n position: absolute;\n top: 0;\n right: 0;\n }\n }\n"], ["\n .inline {\n margin-top: 1;\n svg {\n margin-right: 2;\n }\n }\n .tooltip {\n ", "\n svg {\n position: absolute;\n top: 0;\n right: 0;\n }\n }\n"])), tooltip);
12
12
  var ErrorMessage = function (_a) {
13
13
  var children = _a.children, appearance = _a.appearance;
14
- return (_jsx(StyledWrapper, { children: _jsxs(ErrorWrap, { className: appearance, children: [_jsx(Icon, { icon: "danger" }), _jsx("span", { children: children })] }) }));
14
+ return (_jsx(StyledWrapper, { children: _jsxs(ErrorWrap, { className: appearance, children: [_jsx(Icon, { icon: "deleteX" }), _jsx("span", { children: children })] }) }));
15
15
  };
16
16
  export default ErrorMessage;
17
17
  var templateObject_1, templateObject_2, templateObject_3;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
1
+ import { ReactNode } from 'react';
2
2
  export type TextProps = {
3
- children?: string | number | JSX.Element | (JSX.Element | undefined)[];
3
+ children?: ReactNode | ReactNode[];
4
4
  fontSize?: number;
5
5
  fontWeight?: string;
6
6
  variant?: 'normal' | 'medium' | 'semiBold' | 'bold';
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo } from 'react';
2
+ import { memo, useId } from 'react';
3
3
  import { CheckboxWrap, CheckIcon, FakeInput, Label } from './styles';
4
4
  import { th, useTheme } from '@xstyled/styled-components';
5
5
  var Checkbox = function (_a) {
6
6
  var name = _a.name, label = _a.label, onChange = _a.onChange, checked = _a.checked, defaultChecked = _a.defaultChecked, _b = _a.size, size = _b === void 0 ? 4 : _b, className = _a.className, disabled = _a.disabled, inputRef = _a.inputRef, readOnly = _a.readOnly, _c = _a.minusIcon, minusIcon = _c === void 0 ? false : _c;
7
7
  var theme = useTheme();
8
8
  var themeSize = th.fontSize(size)({ theme: theme });
9
- return (_jsxs(CheckboxWrap, { size: themeSize, className: className, children: [_jsx("input", { type: "checkbox", ref: inputRef, name: name, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: onChange, value: "", readOnly: readOnly, "data-cy": name && "".concat(name, "Checkbox") }), _jsx(FakeInput, { size: themeSize, children: _jsx(CheckIcon, { icon: minusIcon ? 'minus' : 'check', size: themeSize }) }), label && _jsx(Label, { children: label })] }));
9
+ var id = useId();
10
+ return (_jsxs(CheckboxWrap, { size: themeSize, className: className, children: [_jsx("input", { type: "checkbox", ref: inputRef, name: name, checked: checked, defaultChecked: defaultChecked, disabled: disabled, onChange: onChange, value: "", readOnly: readOnly, "data-cy": name && "".concat(name, "Checkbox"), id: id }), _jsx(FakeInput, { size: themeSize, children: _jsx(CheckIcon, { icon: minusIcon ? 'minus' : 'check', size: themeSize }) }), label && _jsx(Label, { htmlFor: id, children: label })] }));
10
11
  };
11
12
  export default memo(Checkbox);
@@ -9,7 +9,7 @@ export default meta;
9
9
  export var CheckboxChecked = {
10
10
  args: {
11
11
  checked: true,
12
- onChange: function () { },
12
+ onChange: function () { return console.log('Clicked'); },
13
13
  label: 'Checked',
14
14
  },
15
15
  };
@@ -8,4 +8,4 @@ export declare const CheckIcon: import("styled-components").StyledComponent<({ i
8
8
  export declare const CheckboxWrap: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
9
9
  size: string | number;
10
10
  }, never>;
11
- export declare const Label: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
11
+ export declare const Label: import("styled-components").StyledComponent<"label", import("@xstyled/system").Theme, {}, never>;
@@ -22,5 +22,5 @@ export var CheckboxWrap = styled.div(templateObject_3 || (templateObject_3 = __m
22
22
  var size = _a.size;
23
23
  return size;
24
24
  });
25
- export var Label = styled.span(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"], ["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"])));
25
+ export var Label = styled.label(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"], ["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"])));
26
26
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -22,8 +22,11 @@ var __rest = (this && this.__rest) || function (s, e) {
22
22
  };
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import { CenterDot, Item, Label, PaintoverLayer, StyledRadio, Wrapper } from './styles';
25
+ import { useId } from 'react';
25
26
  var RadioButton = function (_a) {
26
27
  var label = _a.label, id = _a.id, name = _a.name, _b = _a.disabled, disabled = _b === void 0 ? false : _b, onChange = _a.onChange, rest = __rest(_a, ["label", "id", "name", "disabled", "onChange"]);
27
- return (_jsxs(Wrapper, { children: [_jsxs(Item, { children: [_jsx(StyledRadio, __assign({ type: "radio", id: id, name: name, disabled: disabled, onChange: onChange }, rest)), _jsx(PaintoverLayer, { disabled: disabled, children: _jsx(CenterDot, {}) })] }), label && _jsx(Label, { children: label })] }));
28
+ var customId = useId();
29
+ var inputId = id || customId;
30
+ return (_jsxs(Wrapper, { children: [_jsxs(Item, { children: [_jsx(StyledRadio, __assign({ type: "radio", id: inputId, name: name, disabled: disabled, onChange: onChange }, rest)), _jsx(PaintoverLayer, { disabled: disabled, children: _jsx(CenterDot, {}) })] }), label && _jsx(Label, { htmlFor: inputId, children: label })] }));
28
31
  };
29
32
  export default RadioButton;
@@ -7,4 +7,4 @@ export declare const CenterDot: import("styled-components").StyledComponent<"spa
7
7
  export declare const StyledRadio: import("styled-components").StyledComponent<"input", import("@xstyled/system").Theme, {
8
8
  disabled: boolean;
9
9
  }, never>;
10
- export declare const Label: import("styled-components").StyledComponent<"span", import("@xstyled/system").Theme, {}, never>;
10
+ export declare const Label: import("styled-components").StyledComponent<"label", import("@xstyled/system").Theme, {}, never>;
@@ -11,5 +11,5 @@ export var StyledRadio = styled.input(templateObject_5 || (templateObject_5 = __
11
11
  var disabled = _a.disabled;
12
12
  return (disabled ? 'default' : 'pointer');
13
13
  });
14
- export var Label = styled.span(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"], ["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"])));
14
+ export var Label = styled.label(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"], ["\n margin: 0;\n margin-left: 8px;\n font-size: 14px;\n"])));
15
15
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6;
package/ui/index.d.ts CHANGED
@@ -18,7 +18,6 @@ import Line from './Elements/Line';
18
18
  import Link from './Elements/Link';
19
19
  import Logo from './Elements/Logo';
20
20
  import Pagination from './Elements/Pagination';
21
- import Paragraph from './Elements/Paragraph';
22
21
  import Portal from './Elements/Portal';
23
22
  import ProgressBar from './Elements/ProgressBar';
24
23
  import SimpleLink from './Elements/SimpleLink';
@@ -41,7 +40,7 @@ import MultiSelect from './Elements/MultiSelect';
41
40
  import Select from './Elements/Select';
42
41
  import DropdownSelect from './Elements/DropdownSelect';
43
42
  import TextArea from './Forms/TextArea';
44
- export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Paragraph, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, };
43
+ export { DropdownSelect, DatePicker, CommonGrid, Popover, SingleSelect, MultiSelect, Select, Card, CornerDialog, ImageList, LightBox, Modal, Tabs, Alert, Avatar, Badge, BorderedBox, Button, Dropdown, ErrorMessage, Icon, Image, Label, Line, Link, Logo, Pagination, Portal, ProgressBar, SimpleLink, SpaceAround, Spinner, Tag, Toast, Toggle, Typography, Checkbox, Input, RadioButton, ThemeProvider, utils, TextArea, };
45
44
  export * from './Blocks/CornerDialog';
46
45
  export * from './Blocks/ImageList';
47
46
  export * from './Blocks/LightBox';
@@ -62,7 +61,6 @@ export * from './Elements/Line';
62
61
  export * from './Elements/Link';
63
62
  export * from './Elements/Logo';
64
63
  export * from './Elements/Pagination';
65
- export * from './Elements/Paragraph';
66
64
  export * from './Elements/Portal';
67
65
  export * from './Elements/ProgressBar';
68
66
  export * from './Elements/SimpleLink';