@mailstep/design-system 0.6.80-beta.3 → 0.6.81-beta.0
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 +5 -10
- package/ui/Blocks/ImageList/components/ImageElement/index.d.ts +1 -3
- package/ui/Blocks/ImageList/components/ImageElement/index.js +5 -4
- package/ui/Blocks/ImageList/components/ImageElement/styles.d.ts +1 -7
- package/ui/Blocks/ImageList/components/ImageElement/styles.js +3 -17
- package/ui/Blocks/ImageList/stories/ImageList.stories.d.ts +0 -2
- package/ui/Blocks/ImageList/stories/ImageList.stories.js +2 -21
- package/ui/Blocks/ImageList/styles.d.ts +0 -4
- package/ui/Blocks/ImageList/styles.js +1 -11
- package/ui/Blocks/ImageList/types.d.ts +0 -3
- package/ui/Elements/Text/types.d.ts +0 -1
- package/ui/Forms/Input/Input.js +1 -1
- package/ui/index.es.js +6031 -6114
- package/ui/index.umd.js +363 -387
- package/ui/Blocks/ImageList/hooks/useControls.d.ts +0 -11
- package/ui/Blocks/ImageList/hooks/useControls.js +0 -15
- package/ui/Blocks/ImageList/hooks/useOnElementClick.d.ts +0 -12
- package/ui/Blocks/ImageList/hooks/useOnElementClick.js +0 -20
package/package.json
CHANGED
|
@@ -12,23 +12,18 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useRef } from 'react';
|
|
14
14
|
import { useDraggable } from 'react-use-draggable-scroll';
|
|
15
|
-
import Icon from '../../Elements/Icon/Icon';
|
|
16
15
|
import LightBox, { useLightBox } from '../LightBox';
|
|
17
16
|
import { AddPhoto } from './components/AddPhoto';
|
|
18
17
|
import { ImageElement } from './components/ImageElement';
|
|
19
|
-
import { useControls } from './hooks/useControls';
|
|
20
|
-
import { useOnElementClick } from './hooks/useOnElementClick';
|
|
21
18
|
import { x } from '@xstyled/styled-components';
|
|
22
|
-
import { ImageListContainer
|
|
19
|
+
import { ImageListContainer } from './styles';
|
|
23
20
|
export var ImageList = function (_a) {
|
|
24
|
-
var onImageUpload = _a.onImageUpload, onImageRemove = _a.onImageRemove,
|
|
21
|
+
var onImageUpload = _a.onImageUpload, onImageRemove = _a.onImageRemove, lightBoxAction = _a.lightBoxAction, lightBoxActionTitle = _a.lightBoxActionTitle, images = _a.images, isDisabled = _a.isDisabled;
|
|
25
22
|
var ref = useRef();
|
|
26
23
|
var events = useDraggable(ref, { isMounted: !!(images === null || images === void 0 ? void 0 : images.length) }).events;
|
|
27
24
|
var _b = useLightBox(), isLightBoxOpen = _b.isLightBoxOpen, onCloseLightBox = _b.onCloseLightBox, onOpenLightBox = _b.onOpenLightBox, lightBoxData = _b.lightBoxData;
|
|
28
|
-
|
|
29
|
-
var _d = useControls({ max: max, total: images === null || images === void 0 ? void 0 : images.length }), hasControls = _d.hasControls, position = _d.position, moveList = _d.moveList;
|
|
30
|
-
return (_jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsx(AddPhoto, { onImageUpload: onImageUpload, isDisabled: isDisabled }), hasControls && (_jsx(Control, { onClick: moveList(-1), isLeft: true, isDisabled: position === 0, children: _jsx(Icon, { icon: "lessThen", size: "24px" }) })), images && (_jsx(ImageListContainer, __assign({ ref: ref }, events, { children: images.map(function (item, index) {
|
|
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) {
|
|
31
26
|
var _a, _b;
|
|
32
|
-
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),
|
|
33
|
-
}) }))),
|
|
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
|
+
}) }))), _jsx(LightBox, { initialSlide: lightBoxData === null || lightBoxData === void 0 ? void 0 : lightBoxData.initialSlide, isLightBoxOpen: isLightBoxOpen, onCloseLightBox: onCloseLightBox, lightBoxAction: lightBoxAction, lightBoxActionTitle: lightBoxActionTitle, images: images })] }));
|
|
34
29
|
};
|
|
@@ -2,11 +2,9 @@ import { type FC } from 'react';
|
|
|
2
2
|
interface ImageElementProps {
|
|
3
3
|
label?: string;
|
|
4
4
|
onImageRemove?: () => void;
|
|
5
|
-
|
|
5
|
+
onOpenLightBox: () => void;
|
|
6
6
|
imageUrl: string | undefined;
|
|
7
7
|
isDisabled?: boolean;
|
|
8
|
-
selected?: boolean;
|
|
9
|
-
visible: boolean;
|
|
10
8
|
}
|
|
11
9
|
export declare const ImageElement: FC<ImageElementProps>;
|
|
12
10
|
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Image } from './styles';
|
|
3
3
|
import { ImageTag } from '../ImageTag';
|
|
4
|
-
import {
|
|
4
|
+
import { CloseButton } from '../CloseButton';
|
|
5
|
+
import { x } from '@xstyled/styled-components';
|
|
5
6
|
export var ImageElement = function (_a) {
|
|
6
|
-
var label = _a.label, onImageRemove = _a.onImageRemove, isDisabled = _a.isDisabled,
|
|
7
|
+
var label = _a.label, onImageRemove = _a.onImageRemove, isDisabled = _a.isDisabled, onOpenLightBox = _a.onOpenLightBox, imageUrl = _a.imageUrl;
|
|
7
8
|
if (!imageUrl)
|
|
8
9
|
return null;
|
|
9
|
-
return (_jsxs(
|
|
10
|
+
return (_jsxs(x.div, { position: "relative", pr: "15px", pt: "15px", w: "100px", h: "100px", children: [_jsx(Image, { src: imageUrl, alt: "", width: "85px", height: "85px", onClick: onOpenLightBox }), onImageRemove && _jsx(CloseButton, { onImageRemove: onImageRemove, isDisabled: isDisabled }), _jsx(ImageTag, { label: label })] }));
|
|
10
11
|
};
|
|
@@ -1,8 +1,2 @@
|
|
|
1
1
|
export declare const Container: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
2
|
-
export declare const Image: import("styled-components").StyledComponent<"img", import("@xstyled/system").Theme, {
|
|
3
|
-
selected?: boolean | undefined;
|
|
4
|
-
}, never>;
|
|
5
|
-
export declare const ImageWrapper: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
6
|
-
visible: boolean;
|
|
7
|
-
hasImageRemove: boolean;
|
|
8
|
-
}, never>;
|
|
2
|
+
export declare const Image: import("styled-components").StyledComponent<"img", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -2,21 +2,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
2
2
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
|
-
import styled from '@xstyled/styled-components';
|
|
6
|
-
import { th } from '@xstyled/system';
|
|
5
|
+
import styled, { th } from '@xstyled/styled-components';
|
|
7
6
|
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject([""], [""])));
|
|
8
|
-
export var Image = styled.img(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: ", ";\n
|
|
9
|
-
|
|
10
|
-
return (selected ? "3px solid" : '0');
|
|
11
|
-
});
|
|
12
|
-
export var ImageWrapper = styled.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n padding-right: ", ";\n padding-top: ", ";\n width: 100px;\n height: 100px;\n display: ", ";\n user-select: none;\n"], ["\n position: relative;\n padding-right: ", ";\n padding-top: ", ";\n width: 100px;\n height: 100px;\n display: ", ";\n user-select: none;\n"])), function (_a) {
|
|
13
|
-
var hasImageRemove = _a.hasImageRemove;
|
|
14
|
-
return (hasImageRemove ? '15px' : '0');
|
|
15
|
-
}, function (_a) {
|
|
16
|
-
var hasImageRemove = _a.hasImageRemove;
|
|
17
|
-
return (hasImageRemove ? '15px' : '0');
|
|
18
|
-
}, function (_a) {
|
|
19
|
-
var visible = _a.visible;
|
|
20
|
-
return (visible ? 'block' : 'none');
|
|
21
|
-
});
|
|
22
|
-
var templateObject_1, templateObject_2, templateObject_3;
|
|
7
|
+
export var Image = styled.img(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n border-radius: ", ";\n"], ["\n border-radius: ", ";\n"])), th.radius('lg'));
|
|
8
|
+
var templateObject_1, templateObject_2;
|
|
@@ -11,5 +11,3 @@ type Story = StoryObj<typeof meta>;
|
|
|
11
11
|
export declare const ImageListDefault: Story;
|
|
12
12
|
export declare const ImageListDisabled: Story;
|
|
13
13
|
export declare const ImageListWithItemDescription: Story;
|
|
14
|
-
export declare const ImageListSelectable: Story;
|
|
15
|
-
export declare const ImageListLimited: Story;
|
|
@@ -18,14 +18,8 @@ var meta = {
|
|
|
18
18
|
};
|
|
19
19
|
export default meta;
|
|
20
20
|
var images = [
|
|
21
|
-
{ id: '1', smallUrl: 'https://picsum.photos/200/300', url: 'https://picsum.photos/
|
|
22
|
-
{ id: '
|
|
23
|
-
{ id: '3', smallUrl: 'https://picsum.photos/200/500', url: 'https://picsum.photos/200/500' },
|
|
24
|
-
{ id: '4', smallUrl: 'https://picsum.photos/200/700', url: 'https://picsum.photos/200/700' },
|
|
25
|
-
{ id: '5', smallUrl: 'https://picsum.photos/200/800', url: 'https://picsum.photos/200/800' },
|
|
26
|
-
{ id: '6', smallUrl: 'https://picsum.photos/100/300', url: 'https://picsum.photos/100/300' },
|
|
27
|
-
{ id: '7', smallUrl: 'https://picsum.photos/100/400', url: 'https://picsum.photos/100/400' },
|
|
28
|
-
{ id: '8', smallUrl: 'https://picsum.photos/100/500', url: 'https://picsum.photos/100/500' },
|
|
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' },
|
|
29
23
|
];
|
|
30
24
|
export var ImageListDefault = {
|
|
31
25
|
args: {
|
|
@@ -45,16 +39,3 @@ export var ImageListWithItemDescription = {
|
|
|
45
39
|
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' })); }),
|
|
46
40
|
},
|
|
47
41
|
};
|
|
48
|
-
export var ImageListSelectable = {
|
|
49
|
-
args: {
|
|
50
|
-
images: images,
|
|
51
|
-
selectable: true,
|
|
52
|
-
},
|
|
53
|
-
};
|
|
54
|
-
export var ImageListLimited = {
|
|
55
|
-
args: {
|
|
56
|
-
images: images,
|
|
57
|
-
selectable: true,
|
|
58
|
-
max: 3,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
@@ -1,5 +1 @@
|
|
|
1
1
|
export declare const ImageListContainer: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {}, never>;
|
|
2
|
-
export declare const Control: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
3
|
-
isLeft?: boolean | undefined;
|
|
4
|
-
isDisabled: boolean;
|
|
5
|
-
}, never>;
|
|
@@ -4,14 +4,4 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
4
4
|
};
|
|
5
5
|
import styled from '@xstyled/styled-components';
|
|
6
6
|
export var ImageListContainer = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n overflow-x: scroll;\n -ms-overflow-style: none;\n scrollbar-width: none;\n position: relative;\n\n &::-webkit-scrollbar {\n display: none;\n }\n"], ["\n display: flex;\n overflow-x: scroll;\n -ms-overflow-style: none;\n scrollbar-width: none;\n position: relative;\n\n &::-webkit-scrollbar {\n display: none;\n }\n"])));
|
|
7
|
-
|
|
8
|
-
var isLeft = _a.isLeft;
|
|
9
|
-
return (isLeft ? '15px' : 0);
|
|
10
|
-
}, function (_a) {
|
|
11
|
-
var isDisabled = _a.isDisabled;
|
|
12
|
-
return (isDisabled ? 'gray' : 'black');
|
|
13
|
-
}, function (_a) {
|
|
14
|
-
var isDisabled = _a.isDisabled;
|
|
15
|
-
return (isDisabled ? 'gray' : 'red1');
|
|
16
|
-
});
|
|
17
|
-
var templateObject_1, templateObject_2;
|
|
7
|
+
var templateObject_1;
|
|
@@ -8,10 +8,7 @@ export interface ImageListProps {
|
|
|
8
8
|
images: ImageData[] | undefined;
|
|
9
9
|
onImageUpload?: (props: ImageUploadProps) => Promise<void>;
|
|
10
10
|
onImageRemove?: (id?: string) => () => void;
|
|
11
|
-
onImageClick?: (item: ImageData) => void;
|
|
12
11
|
lightBoxAction?: (id?: string) => () => Promise<void>;
|
|
13
12
|
lightBoxActionTitle?: string;
|
|
14
13
|
isDisabled?: boolean;
|
|
15
|
-
selectable?: boolean;
|
|
16
|
-
max?: number;
|
|
17
14
|
}
|
package/ui/Forms/Input/Input.js
CHANGED
|
@@ -43,7 +43,7 @@ export var Input = function (_a) {
|
|
|
43
43
|
var ref = (inputRef || internalRef);
|
|
44
44
|
useEffect(function () {
|
|
45
45
|
var _a;
|
|
46
|
-
forceFocus && !disabled && !isLoading && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
46
|
+
(forceFocus || autoFocus) && !disabled && !isLoading && ((_a = ref === null || ref === void 0 ? void 0 : ref.current) === null || _a === void 0 ? void 0 : _a.focus());
|
|
47
47
|
}, [disabled, forceFocus, isLoading]);
|
|
48
48
|
var handleBlur = useCallback(function (event) {
|
|
49
49
|
var _a, _b, _c, _d, _e;
|