@mailstep/design-system 0.4.0 → 0.4.1-beta.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 +1 -1
- package/ui/Blocks/ImageList/ImageList.js +1 -1
- package/ui/Blocks/ImageList/stories/ImageList.stories.d.ts +13 -0
- package/ui/Blocks/ImageList/stories/ImageList.stories.js +40 -0
- package/ui/Blocks/LightBox/LightBox.js +2 -2
- package/ui/Blocks/LightBox/stories/LightBox.stories.d.ts +11 -0
- package/ui/Blocks/LightBox/stories/LightBox.stories.js +20 -0
- package/ui/Blocks/LightBox/styles.d.ts +1 -0
- package/ui/Blocks/LightBox/styles.js +2 -1
- package/ui/Blocks/LightBox/types.d.ts +3 -0
- package/ui/Blocks/Modal/Modal.js +1 -1
- package/ui/Blocks/Modal/stories/Modal.stories.js +1 -1
- package/ui/Blocks/Modal/styles.js +1 -1
- package/ui/index.es.js +421 -413
- package/ui/index.umd.js +130 -128
package/package.json
CHANGED
|
@@ -24,6 +24,6 @@ export var ImageList = function (_a) {
|
|
|
24
24
|
var _b = useLightBox(), isLightBoxOpen = _b.isLightBoxOpen, onCloseLightBox = _b.onCloseLightBox, onOpenLightBox = _b.onOpenLightBox, lightBoxData = _b.lightBoxData;
|
|
25
25
|
return (_jsxs(x.div, { display: "flex", alignItems: "flex-end", children: [_jsx(AddPhoto, { onImageUpload: onImageUpload, isDisabled: isDisabled }), images && (_jsx(ImageListContainer, __assign({ ref: ref }, events, { children: images.map(function (item, index) {
|
|
26
26
|
var _a, _b;
|
|
27
|
-
return (_jsx(ImageElement, { imageUrl: (_a = item.smallUrl) !== null && _a !== void 0 ? _a : item.url, onImageRemove: onImageRemove === null || onImageRemove === void 0 ? void 0 : onImageRemove(item.id), onOpenLightBox: onOpenLightBox(index), isDisabled: isDisabled }, (_b = item.id) !== null && _b !== void 0 ? _b : index));
|
|
27
|
+
return (_jsx(ImageElement, { imageUrl: (_a = item.smallUrl) !== null && _a !== void 0 ? _a : item.url, onImageRemove: onImageRemove === null || onImageRemove === void 0 ? void 0 : onImageRemove(item.id), onOpenLightBox: onOpenLightBox(index), isDisabled: isDisabled, label: item === null || item === void 0 ? void 0 : item.label }, (_b = item.id) !== null && _b !== void 0 ? _b : index));
|
|
28
28
|
}) }))), _jsx(LightBox, { initialSlide: lightBoxData === null || lightBoxData === void 0 ? void 0 : lightBoxData.initialSlide, isLightBoxOpen: isLightBoxOpen, onCloseLightBox: onCloseLightBox, lightBoxAction: lightBoxAction, lightBoxActionTitle: lightBoxActionTitle, images: images })] }));
|
|
29
29
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import("react").FC<import("../types").ImageListProps>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
argTypes: {};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const ImageListDefault: Story;
|
|
12
|
+
export declare const ImageListDisabled: Story;
|
|
13
|
+
export declare const ImageListWithItemDescription: Story;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { ImageList } from '../ImageList';
|
|
13
|
+
var meta = {
|
|
14
|
+
title: 'Blocks/ImageList',
|
|
15
|
+
component: ImageList,
|
|
16
|
+
tags: ['autodocs'],
|
|
17
|
+
argTypes: {},
|
|
18
|
+
};
|
|
19
|
+
export default meta;
|
|
20
|
+
var images = [
|
|
21
|
+
{ id: '1', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/400/400' },
|
|
22
|
+
{ id: '1', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/400/400' },
|
|
23
|
+
];
|
|
24
|
+
export var ImageListDefault = {
|
|
25
|
+
args: {
|
|
26
|
+
images: images,
|
|
27
|
+
isDisabled: false,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
export var ImageListDisabled = {
|
|
31
|
+
args: {
|
|
32
|
+
images: images,
|
|
33
|
+
isDisabled: true,
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
export var ImageListWithItemDescription = {
|
|
37
|
+
args: {
|
|
38
|
+
images: images.map(function (img) { return (__assign(__assign({}, img), { label: 'Lorem Ipsum', date: '24.12.2024', description: 'Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aspernatur explicabo harum' })); }),
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Button } from '../../Elements/Button';
|
|
3
3
|
import Modal from '../Modal';
|
|
4
4
|
import { Swiper, SwiperSlide } from 'swiper/react';
|
|
5
|
-
import { Container, Image, ButtonContainer } from './styles';
|
|
5
|
+
import { Container, Image, ButtonContainer, Description } 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
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
|
-
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));
|
|
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.date || item.description) && (_jsxs(Description, { children: [item.date, " ", item.description] })), !!item.withLightBoxAction && lightBoxAction && lightBoxActionTitle && (_jsx(ButtonContainer, { children: _jsx(Button, { onClick: lightBoxAction(item.id), appearance: "primaryLight", children: lightBoxActionTitle }) }))] }) }, item.id));
|
|
13
13
|
}) }) }));
|
|
14
14
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { StoryObj } from '@storybook/react';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: import("react").FC<import("../types").LightBoxProps>;
|
|
6
|
+
tags: string[];
|
|
7
|
+
argTypes: {};
|
|
8
|
+
};
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof meta>;
|
|
11
|
+
export declare const LightBoxDefault: Story;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LightBox } from '../LightBox';
|
|
2
|
+
var meta = {
|
|
3
|
+
title: 'Blocks/LightBox',
|
|
4
|
+
component: LightBox,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
argTypes: {},
|
|
7
|
+
};
|
|
8
|
+
export default meta;
|
|
9
|
+
var images = [
|
|
10
|
+
{ id: '1', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/400/400', date: '1.12.2024', description: 'Lorem ipsum' },
|
|
11
|
+
{ id: '2', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/400/400', description: 'Lorem ipsum' },
|
|
12
|
+
{ id: '3', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/400/400', date: '1.12.2024' },
|
|
13
|
+
{ id: '3', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/400/400' },
|
|
14
|
+
];
|
|
15
|
+
export var LightBoxDefault = {
|
|
16
|
+
args: {
|
|
17
|
+
images: images,
|
|
18
|
+
isLightBoxOpen: true
|
|
19
|
+
},
|
|
20
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export declare const Container: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
2
2
|
export declare const Image: import("styled-components").StyledComponent<"img", import("@xstyled/system").Theme, {}, never>;
|
|
3
3
|
export declare const ButtonContainer: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
4
|
+
export declare const Description: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -6,4 +6,5 @@ import styled from '@xstyled/styled-components';
|
|
|
6
6
|
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n position: relative;\n"], ["\n width: 100%;\n height: 100%;\n position: relative;\n"])));
|
|
7
7
|
export var Image = styled.img(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n"], ["\n width: 100%;\n height: 100%;\n"])));
|
|
8
8
|
export var ButtonContainer = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n width: 100%;\n display: flex;\n justify-content: center;\n position: absolute;\n bottom: -60px;\n"], ["\n width: 100%;\n display: flex;\n justify-content: center;\n position: absolute;\n bottom: -60px;\n"])));
|
|
9
|
-
var
|
|
9
|
+
export var Description = styled.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n padding: 10px;\n"], ["\n padding: 10px;\n"])));
|
|
10
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
@@ -10,8 +10,11 @@ export type UseLightBoxHookType = () => {
|
|
|
10
10
|
export interface ImageData {
|
|
11
11
|
id: string;
|
|
12
12
|
url?: string;
|
|
13
|
+
label?: string;
|
|
14
|
+
date?: string;
|
|
13
15
|
smallUrl?: string;
|
|
14
16
|
originalUrl?: string;
|
|
17
|
+
description?: string | null;
|
|
15
18
|
withLightBoxAction?: boolean;
|
|
16
19
|
}
|
|
17
20
|
export interface LightBoxProps {
|
package/ui/Blocks/Modal/Modal.js
CHANGED
|
@@ -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, "$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 }))] }) })),
|
|
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 }))] }) })), 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' }))] }))] }) }) }));
|
|
36
36
|
});
|
|
@@ -71,7 +71,7 @@ export var ModalWithWhiteBg = {
|
|
|
71
71
|
};
|
|
72
72
|
export var ModalWithoutHeader = {
|
|
73
73
|
args: {
|
|
74
|
-
children: _jsx(_Fragment, { children: "Modal without header" }),
|
|
74
|
+
children: _jsx(_Fragment, { children: "This is content of the Modal without header" }),
|
|
75
75
|
title: 'Modal title',
|
|
76
76
|
width: 'narrow',
|
|
77
77
|
hasHeader: false,
|
|
@@ -65,5 +65,5 @@ export var ContentContainer = styled.div(templateObject_13 || (templateObject_13
|
|
|
65
65
|
});
|
|
66
66
|
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"])));
|
|
67
67
|
export var ButtonsContainer = styled.div(templateObject_15 || (templateObject_15 = __makeTemplateObject(["\n padding: 1.5rem;\n text-align: right;\n > * {\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 padding: 1.5rem;\n text-align: right;\n > * {\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"])));
|
|
68
|
-
export var CloseButton = styled.div(templateObject_16 || (templateObject_16 = __makeTemplateObject(["\n position: absolute;\n background-color: bgLightGray1;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n
|
|
68
|
+
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"])));
|
|
69
69
|
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;
|