@mailstep/design-system 0.6.82-beta.0 → 0.6.82
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 +2 -2
- package/ui/Blocks/ImageList/components/AddPhoto/index.d.ts +1 -0
- package/ui/Blocks/ImageList/components/AddPhoto/index.js +4 -4
- package/ui/Blocks/ImageList/components/AddPhoto/styles.d.ts +1 -0
- package/ui/Blocks/ImageList/components/AddPhoto/styles.js +4 -1
- package/ui/Blocks/ImageList/hooks/useOnElementClick.js +0 -2
- package/ui/Blocks/ImageList/styles.d.ts +1 -0
- package/ui/Blocks/ImageList/styles.js +4 -1
- package/ui/index.es.js +14881 -14377
- package/ui/index.umd.js +619 -617
package/package.json
CHANGED
|
@@ -27,8 +27,8 @@ export var ImageList = function (_a) {
|
|
|
27
27
|
var _b = useLightBox(), isLightBoxOpen = _b.isLightBoxOpen, onCloseLightBox = _b.onCloseLightBox, onOpenLightBox = _b.onOpenLightBox, lightBoxData = _b.lightBoxData;
|
|
28
28
|
var _c = useOnElementClick({ onImageClick: onImageClick, onOpenLightBox: onOpenLightBox, selectable: selectable }), handleOnClick = _c.handleOnClick, selected = _c.selected;
|
|
29
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) {
|
|
30
|
+
return (_jsxs(x.div, { display: "flex", alignItems: "center", children: [_jsx(AddPhoto, { onImageUpload: onImageUpload, isDisabled: isDisabled, hasRemove: !!onImageRemove }), hasControls && (_jsx(Control, { onClick: moveList(-1), isLeft: true, isDisabled: position === 0, hasRemove: !!onImageRemove, children: _jsx(Icon, { icon: "lessThen", size: "24px" }) })), images && (_jsx(ImageListContainer, __assign({ ref: ref }, events, { children: images.map(function (item, index) {
|
|
31
31
|
var _a, _b;
|
|
32
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), onClick: handleOnClick(item, index), isDisabled: isDisabled, label: item === null || item === void 0 ? void 0 : item.label, selected: index === selected, visible: !max || (index >= position && index < position + max) }, (_b = item.id) !== null && _b !== void 0 ? _b : index));
|
|
33
|
-
}) }))), hasControls && (_jsx(Control, { onClick: moveList(1), isDisabled: !!images && !!max && position >= (images === null || images === void 0 ? void 0 : images.length) - max, children: _jsx(Icon, { icon: "greaterThan", size: "24px" }) })), _jsx(LightBox, { initialSlide: lightBoxData === null || lightBoxData === void 0 ? void 0 : lightBoxData.initialSlide, isLightBoxOpen: isLightBoxOpen, onCloseLightBox: onCloseLightBox, lightBoxAction: lightBoxAction, lightBoxActionTitle: lightBoxActionTitle, images: images })] }));
|
|
33
|
+
}) }))), hasControls && (_jsx(Control, { onClick: moveList(1), isDisabled: !!images && !!max && position >= (images === null || images === void 0 ? void 0 : images.length) - max, hasRemove: !!onImageRemove, children: _jsx(Icon, { icon: "greaterThan", size: "24px" }) })), _jsx(LightBox, { initialSlide: lightBoxData === null || lightBoxData === void 0 ? void 0 : lightBoxData.initialSlide, isLightBoxOpen: isLightBoxOpen, onCloseLightBox: onCloseLightBox, lightBoxAction: lightBoxAction, lightBoxActionTitle: lightBoxActionTitle, images: images })] }));
|
|
34
34
|
};
|
|
@@ -36,10 +36,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
38
38
|
import { useCallback } from 'react';
|
|
39
|
-
import { Container, HiddenInput } from './styles';
|
|
40
39
|
import { AddPhoto as AddPhotoIcon } from '../../../../Elements/Icon/icons/AddPhoto';
|
|
40
|
+
import { Container, HiddenInput } from './styles';
|
|
41
41
|
export var AddPhoto = function (_a) {
|
|
42
|
-
var onImageUpload = _a.onImageUpload, isDisabled = _a.isDisabled;
|
|
42
|
+
var onImageUpload = _a.onImageUpload, isDisabled = _a.isDisabled, hasRemove = _a.hasRemove;
|
|
43
43
|
var handleImageUpload = useCallback(function (event) {
|
|
44
44
|
var _a, _b;
|
|
45
45
|
if (!((_b = (_a = event.target) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]))
|
|
@@ -53,7 +53,7 @@ export var AddPhoto = function (_a) {
|
|
|
53
53
|
case 0: return [4 /*yield*/, (onImageUpload === null || onImageUpload === void 0 ? void 0 : onImageUpload({
|
|
54
54
|
base64image: (_a = reader.result) === null || _a === void 0 ? void 0 : _a.split(',').pop(),
|
|
55
55
|
base64WithDataDeclaration: reader.result,
|
|
56
|
-
file: (_b = event.target.files) === null || _b === void 0 ? void 0 : _b[0]
|
|
56
|
+
file: (_b = event.target.files) === null || _b === void 0 ? void 0 : _b[0]
|
|
57
57
|
}))];
|
|
58
58
|
case 1:
|
|
59
59
|
_c.sent();
|
|
@@ -64,5 +64,5 @@ export var AddPhoto = function (_a) {
|
|
|
64
64
|
}, [onImageUpload]);
|
|
65
65
|
if (!onImageUpload)
|
|
66
66
|
return null;
|
|
67
|
-
return (_jsxs(Container, { isDisabled: isDisabled, children: [_jsx(HiddenInput, { disabled: isDisabled, onChange: handleImageUpload, type: "file", accept: "image/*;capture=camera", capture: "environment" }), _jsx(AddPhotoIcon, { width: "36", height: "36" })] }));
|
|
67
|
+
return (_jsxs(Container, { isDisabled: isDisabled, hasRemove: hasRemove, children: [_jsx(HiddenInput, { disabled: isDisabled, onChange: handleImageUpload, type: "file", accept: "image/*;capture=camera", capture: "environment" }), _jsx(AddPhotoIcon, { width: "36", height: "36" })] }));
|
|
68
68
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const Container: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
2
2
|
isDisabled?: boolean | undefined;
|
|
3
|
+
hasRemove?: boolean | undefined;
|
|
3
4
|
}, never>;
|
|
4
5
|
export declare const HiddenInput: import("styled-components").StyledComponent<"input", import("@xstyled/system").Theme, {}, never>;
|
|
@@ -3,9 +3,12 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
return cooked;
|
|
4
4
|
};
|
|
5
5
|
import styled, { th } from '@xstyled/styled-components';
|
|
6
|
-
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n flex-shrink: 0;\n transition: all 0.2s linear;\n height: 85px !important;\n width: 85px !important;\n border-radius: ", ";\n border: ", ";\n border-color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin-right: 15px;\n opacity: ", ";\n"], ["\n position: relative;\n flex-shrink: 0;\n transition: all 0.2s linear;\n height: 85px !important;\n width: 85px !important;\n border-radius: ", ";\n border: ", ";\n border-color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin-right: 15px;\n opacity: ", ";\n"])), th.radius('lg'), th.border('mediumSlim'), th.color('red1'), function (_a) {
|
|
6
|
+
export var Container = styled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n flex-shrink: 0;\n transition: all 0.2s linear;\n height: 85px !important;\n width: 85px !important;\n border-radius: ", ";\n border: ", ";\n border-color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin-right: 15px;\n opacity: ", ";\n margin-top: ", ";\n"], ["\n position: relative;\n flex-shrink: 0;\n transition: all 0.2s linear;\n height: 85px !important;\n width: 85px !important;\n border-radius: ", ";\n border: ", ";\n border-color: ", ";\n display: flex;\n justify-content: center;\n align-items: center;\n cursor: pointer;\n margin-right: 15px;\n opacity: ", ";\n margin-top: ", ";\n"])), th.radius('lg'), th.border('mediumSlim'), th.color('red1'), function (_a) {
|
|
7
7
|
var isDisabled = _a.isDisabled;
|
|
8
8
|
return (isDisabled ? 0.6 : 1);
|
|
9
|
+
}, function (_a) {
|
|
10
|
+
var hasRemove = _a.hasRemove;
|
|
11
|
+
return (hasRemove ? '15px' : '');
|
|
9
12
|
});
|
|
10
13
|
export var HiddenInput = styled.input(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n opacity: 0;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n"], ["\n opacity: 0;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n"])));
|
|
11
14
|
var templateObject_1, templateObject_2;
|
|
@@ -4,11 +4,9 @@ export var useOnElementClick = function (_a) {
|
|
|
4
4
|
var _b = useState(-1), selected = _b[0], setSelected = _b[1];
|
|
5
5
|
var handleOnClick = useCallback(function (item, index) { return function () {
|
|
6
6
|
if (onImageClick) {
|
|
7
|
-
console.log('test 2');
|
|
8
7
|
onImageClick(item);
|
|
9
8
|
}
|
|
10
9
|
else {
|
|
11
|
-
console.log('test 3');
|
|
12
10
|
onOpenLightBox(index)();
|
|
13
11
|
}
|
|
14
12
|
if (selectable) {
|
|
@@ -2,4 +2,5 @@ export declare const ImageListContainer: import("styled-components").StyledCompo
|
|
|
2
2
|
export declare const Control: import("styled-components").StyledComponent<"div", import("@xstyled/system").Theme, {
|
|
3
3
|
isLeft?: boolean | undefined;
|
|
4
4
|
isDisabled: boolean;
|
|
5
|
+
hasRemove?: boolean | undefined;
|
|
5
6
|
}, never>;
|
|
@@ -4,9 +4,12 @@ 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
|
-
export var Control = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 24px;\n margin-right: ", ";\n cursor: pointer;\n display: flex;\n transition: all 0.4s;\n\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"], ["\n width: 24px;\n margin-right: ", ";\n cursor: pointer;\n display: flex;\n transition: all 0.4s;\n\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"])), function (_a) {
|
|
7
|
+
export var Control = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 24px;\n margin-right: ", ";\n margin-top: ", ";\n cursor: pointer;\n display: flex;\n transition: all 0.4s;\n\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"], ["\n width: 24px;\n margin-right: ", ";\n margin-top: ", ";\n cursor: pointer;\n display: flex;\n transition: all 0.4s;\n\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n"])), function (_a) {
|
|
8
8
|
var isLeft = _a.isLeft;
|
|
9
9
|
return (isLeft ? '15px' : 0);
|
|
10
|
+
}, function (_a) {
|
|
11
|
+
var hasRemove = _a.hasRemove;
|
|
12
|
+
return (hasRemove ? '15px' : 0);
|
|
10
13
|
}, function (_a) {
|
|
11
14
|
var isDisabled = _a.isDisabled;
|
|
12
15
|
return (isDisabled ? 'gray' : 'black');
|