@mailstep/design-system 0.4.0-beta.1 → 0.4.0-beta.3
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/README.md +6 -0
- package/package.json +1 -1
- package/ui/Blocks/LightBox/LightBox.js +2 -2
- package/ui/Blocks/Modal/Modal.js +2 -3
- package/ui/Blocks/Modal/index.d.ts +0 -1
- package/ui/Blocks/Modal/index.js +0 -1
- package/ui/Blocks/Modal/stories/Modal.stories.js +4 -3
- package/ui/Blocks/Modal/styles.js +1 -2
- package/ui/Blocks/Modal/types.d.ts +1 -5
- package/ui/Blocks/Modal/types.js +1 -6
- package/ui/Elements/Icon/icons/Cancel.js +1 -1
- package/ui/index.es.js +3218 -3221
- package/ui/index.umd.js +166 -166
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '../../Elements/Button';
|
|
3
|
-
import Modal
|
|
3
|
+
import Modal from '../Modal';
|
|
4
4
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
5
5
|
import { Container, Image, ButtonContainer } from './styles';
|
|
6
6
|
export var LightBox = function (_a) {
|
|
7
7
|
var isLightBoxOpen = _a.isLightBoxOpen, onCloseLightBox = _a.onCloseLightBox, lightBoxAction = _a.lightBoxAction, lightBoxActionTitle = _a.lightBoxActionTitle, images = _a.images, _b = _a.initialSlide, initialSlide = _b === void 0 ? 0 : _b;
|
|
8
8
|
if (!(images === null || images === void 0 ? void 0 : images.length))
|
|
9
9
|
return null;
|
|
10
|
-
return (_jsx(Modal, { isShown: isLightBoxOpen, onClose: onCloseLightBox, variant:
|
|
10
|
+
return (_jsx(Modal, { isShown: isLightBoxOpen, onClose: onCloseLightBox, variant: "mobileFullscreen", children: _jsx(Swiper, { initialSlide: initialSlide, slidesPerView: 1, autoHeight: true, children: images.map(function (item) {
|
|
11
11
|
var _a;
|
|
12
12
|
return (_jsx(SwiperSlide, { children: _jsxs(Container, { children: [_jsx(Image, { src: (_a = item.originalUrl) !== null && _a !== void 0 ? _a : item.url, loading: "lazy", alt: "" }), !!item.withLightBoxAction && lightBoxAction && lightBoxActionTitle && (_jsx(ButtonContainer, { children: _jsx(Button, { onClick: lightBoxAction(item.id), appearance: "primaryLight", children: lightBoxActionTitle }) }))] }) }, item.id));
|
|
13
13
|
}) }) }));
|
package/ui/Blocks/Modal/Modal.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useMemo, useEffect } from 'react';
|
|
3
|
-
import { Variant } from './types';
|
|
4
3
|
import { Icon, Cancel } from '../../Elements/Icon';
|
|
5
4
|
import { H2, H5 } from '../../Elements/Typography';
|
|
6
5
|
import { DialogOverlay, DialogWindow, HeaderContainer, ButtonsContainer, ContentContainer, TitleContainer, CloseButton, } from './styles';
|
|
@@ -10,7 +9,7 @@ import { Portal } from '../../Elements/Portal';
|
|
|
10
9
|
import { useClickOutside } from './hooks/useClickOutside';
|
|
11
10
|
import { widthMap } from './utils';
|
|
12
11
|
export var Modal = memo(function (_a) {
|
|
13
|
-
var children = _a.children, _b = _a.isShown, isShown = _b === void 0 ? true : _b, onCancel = _a.onCancel, title = _a.title, titleIcon = _a.titleIcon, onConfirm = _a.onConfirm, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, isLoading = _a.isLoading, isConfirmDisabled = _a.isConfirmDisabled, _c = _a.width, width = _c === void 0 ? 'narrow' : _c, onClose = _a.onClose, _d = _a.hasFooter, hasFooter = _d === void 0 ? true : _d, _e = _a.hasHeader, hasHeader = _e === void 0 ? true : _e, _f = _a.whiteBg, whiteBg = _f === void 0 ? false : _f, _g = _a.ignoreClickOutside, ignoreClickOutside = _g === void 0 ? false : _g, _h = _a.closeEverywhere, closeEverywhere = _h === void 0 ? false : _h, _j = _a.withCloseIcon, withCloseIcon = _j === void 0 ? true : _j, overlayColor = _a.overlayColor, minWidth = _a.minWidth, minHeight = _a.minHeight, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, _k = _a.variant, variant = _k === void 0 ?
|
|
12
|
+
var children = _a.children, _b = _a.isShown, isShown = _b === void 0 ? true : _b, onCancel = _a.onCancel, title = _a.title, titleIcon = _a.titleIcon, onConfirm = _a.onConfirm, confirmLabel = _a.confirmLabel, cancelLabel = _a.cancelLabel, isLoading = _a.isLoading, isConfirmDisabled = _a.isConfirmDisabled, _c = _a.width, width = _c === void 0 ? 'narrow' : _c, onClose = _a.onClose, _d = _a.hasFooter, hasFooter = _d === void 0 ? true : _d, _e = _a.hasHeader, hasHeader = _e === void 0 ? true : _e, _f = _a.whiteBg, whiteBg = _f === void 0 ? false : _f, _g = _a.ignoreClickOutside, ignoreClickOutside = _g === void 0 ? false : _g, _h = _a.closeEverywhere, closeEverywhere = _h === void 0 ? false : _h, _j = _a.withCloseIcon, withCloseIcon = _j === void 0 ? true : _j, overlayColor = _a.overlayColor, minWidth = _a.minWidth, minHeight = _a.minHeight, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, _k = _a.variant, variant = _k === void 0 ? 'compact' : _k;
|
|
14
13
|
var closeDialog = useCallback(function () {
|
|
15
14
|
if (onClose) {
|
|
16
15
|
onClose();
|
|
@@ -33,5 +32,5 @@ export var Modal = memo(function (_a) {
|
|
|
33
32
|
if (!isShown) {
|
|
34
33
|
return null;
|
|
35
34
|
}
|
|
36
|
-
return (_jsx(Portal, { children: _jsx(DialogOverlay, { backgroundColor: overlayColor, children: _jsxs(DialogWindow, { ref: dialogRef, style: dialogStyle, "$whiteBg": whiteBg, "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 ==
|
|
35
|
+
return (_jsx(Portal, { children: _jsx(DialogOverlay, { backgroundColor: overlayColor, children: _jsxs(DialogWindow, { ref: dialogRef, style: dialogStyle, "$whiteBg": whiteBg, "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 }))] }) })), hasHeader && !closeEverywhere && withCloseIcon && (_jsx(CloseButton, { onClick: closeDialog, "data-cy": "dialogCloseBtn", children: _jsx(Cancel, { width: "11px", height: "11px" }) })), _jsx(ContentContainer, { variant: variant, children: children }), hasFooter && (onCancel || onConfirm) && (_jsxs(ButtonsContainer, { 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' }))] }))] }) }) }));
|
|
37
36
|
});
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Modal } from './Modal';
|
|
2
2
|
export { useModal } from './hooks/useModal';
|
|
3
3
|
export { useClickOutside } from './hooks/useClickOutside';
|
|
4
|
-
export { Variant } from './types';
|
|
5
4
|
export type { ControlProps, ModalProps, ModalData } from './types';
|
|
6
5
|
export default Modal;
|
package/ui/Blocks/Modal/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import Modal
|
|
2
|
+
import Modal from '../';
|
|
3
3
|
var meta = {
|
|
4
4
|
title: 'Blocks/Modal',
|
|
5
5
|
component: Modal,
|
|
@@ -11,19 +11,20 @@ export var Default = {
|
|
|
11
11
|
args: {
|
|
12
12
|
title: 'Modal default version',
|
|
13
13
|
children: _jsx(_Fragment, { children: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed condimentum id eros ac consequat." }),
|
|
14
|
+
variant: 'default',
|
|
14
15
|
},
|
|
15
16
|
};
|
|
16
17
|
export var Compact = {
|
|
17
18
|
args: {
|
|
18
19
|
title: 'Modal title',
|
|
19
20
|
children: _jsx(_Fragment, { children: "Modal compact version" }),
|
|
20
|
-
variant:
|
|
21
|
+
variant: 'compact',
|
|
21
22
|
},
|
|
22
23
|
};
|
|
23
24
|
export var MobileFullscreen = {
|
|
24
25
|
args: {
|
|
25
26
|
children: _jsx(_Fragment, { children: "Mobile full screen version without title" }),
|
|
26
|
-
variant:
|
|
27
|
+
variant: 'mobileFullscreen',
|
|
27
28
|
},
|
|
28
29
|
};
|
|
29
30
|
export var ModalWithCloseAndConfirmBtns = {
|
|
@@ -4,7 +4,6 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import styled, { css, th } from '@xstyled/styled-components';
|
|
6
6
|
import { createRgba } from '../../utils';
|
|
7
|
-
import { Variant } from './types';
|
|
8
7
|
var Component;
|
|
9
8
|
(function (Component) {
|
|
10
9
|
Component["Header"] = "header";
|
|
@@ -13,7 +12,7 @@ var Component;
|
|
|
13
12
|
Component["Title"] = "title";
|
|
14
13
|
})(Component || (Component = {}));
|
|
15
14
|
var variantStyles = function (component, variant) {
|
|
16
|
-
if (variant === void 0) { variant =
|
|
15
|
+
if (variant === void 0) { variant = 'default'; }
|
|
17
16
|
return ({
|
|
18
17
|
header: {
|
|
19
18
|
default: css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 20px;\n border-bottom: 1px solid ", ";\n @media (min-width: 576px) {\n padding: 30px;\n border-bottom: 0;\n }\n "], ["\n padding: 20px;\n border-bottom: 1px solid ", ";\n @media (min-width: 576px) {\n padding: 30px;\n border-bottom: 0;\n }\n "])), th.color('lightGray6')),
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { MutableRefObject } from 'react';
|
|
2
|
-
export
|
|
3
|
-
Default = "default",
|
|
4
|
-
Compact = "compact",
|
|
5
|
-
MobileFullscreen = "mobileFullscreen"
|
|
6
|
-
}
|
|
2
|
+
export type Variant = 'default' | 'compact' | 'mobileFullscreen';
|
|
7
3
|
export type Width = 'wide' | 'mediumLarge' | 'medium' | 'narrow' | 'auto';
|
|
8
4
|
export interface ModalProps {
|
|
9
5
|
isShown?: boolean;
|
package/ui/Blocks/Modal/types.js
CHANGED
|
@@ -10,4 +10,4 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
export var Cancel = function (props) { return (_jsx("svg", __assign({ width: "11", height: "11", viewBox: "0 0 11 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: _jsx("path", { id: "cancel",
|
|
13
|
+
export var Cancel = function (props) { return (_jsx("svg", __assign({ width: "11", height: "11", viewBox: "0 0 11 11", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, props, { children: _jsx("path", { id: "cancel", fillRule: "evenodd", clipRule: "evenodd", d: "M1.61873 0.375917C1.26726 0.0244455 0.697412 0.0244455 0.34594 0.375917C-0.00553197 0.727389 -0.00553197 1.29724 0.34594 1.64871L4.21225 5.51502L0.34594 9.38133C-0.00553159 9.7328 -0.00553156 10.3026 0.34594 10.6541C0.697412 11.0056 1.26726 11.0056 1.61873 10.6541L5.48504 6.78781L9.35135 10.6541C9.70282 11.0056 10.2727 11.0056 10.6241 10.6541C10.9756 10.3026 10.9756 9.7328 10.6241 9.38133L6.75783 5.51502L10.6241 1.64871C10.9756 1.29724 10.9756 0.727391 10.6241 0.375919C10.2727 0.024447 9.70282 0.024447 9.35135 0.375919L5.48504 4.24223L1.61873 0.375917Z", fill: "#22394E" }) }))); };
|