@cashub/ui 0.13.9 → 0.13.10
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/cropper/Cropper.js +22 -2
- package/cropper/CropperModalHandler.js +10 -2
- package/cropper/subComponent/CropImageModal.js +10 -2
- package/dropzone/ImageDropzone.js +9 -1
- package/package.json +1 -1
- package/styles/theme/index.js +6 -3
- package/styles/theme/light.theme.js +3 -3
- package/styles/theme/white.theme.js +2 -2
package/cropper/Cropper.js
CHANGED
|
@@ -25,7 +25,11 @@ var CropperWrapper = function CropperWrapper(_ref) {
|
|
|
25
25
|
cropBoxResizable = _ref$cropBoxResizable === void 0 ? false : _ref$cropBoxResizable,
|
|
26
26
|
onInitialized = _ref.onInitialized,
|
|
27
27
|
_ref$dragMode = _ref.dragMode,
|
|
28
|
-
dragMode = _ref$dragMode === void 0 ? 'move' : _ref$dragMode
|
|
28
|
+
dragMode = _ref$dragMode === void 0 ? 'move' : _ref$dragMode,
|
|
29
|
+
minCroppedWidth = _ref.minCroppedWidth,
|
|
30
|
+
minCroppedHeight = _ref.minCroppedHeight,
|
|
31
|
+
maxCroppedWidth = _ref.maxCroppedWidth,
|
|
32
|
+
maxCroppedHeight = _ref.maxCroppedHeight;
|
|
29
33
|
var imageRef = (0, _react.useRef)(null);
|
|
30
34
|
(0, _react.useEffect)(function () {
|
|
31
35
|
var node = imageRef.current;
|
|
@@ -37,9 +41,25 @@ var CropperWrapper = function CropperWrapper(_ref) {
|
|
|
37
41
|
initialAspectRatio: 9 / 16,
|
|
38
42
|
background: true,
|
|
39
43
|
cropBoxResizable: cropBoxResizable,
|
|
44
|
+
minCroppedWidth: minCroppedWidth,
|
|
45
|
+
minCroppedHeight: minCroppedHeight,
|
|
46
|
+
maxCroppedWidth: maxCroppedWidth,
|
|
47
|
+
maxCroppedHeight: maxCroppedHeight,
|
|
40
48
|
data: {
|
|
41
49
|
width: width,
|
|
42
50
|
height: height
|
|
51
|
+
},
|
|
52
|
+
crop: function crop(event) {
|
|
53
|
+
var width = Math.round(event.detail.width);
|
|
54
|
+
var height = Math.round(event.detail.height);
|
|
55
|
+
|
|
56
|
+
if (width < minCroppedWidth || height < minCroppedHeight || width > maxCroppedWidth || height > maxCroppedHeight) {
|
|
57
|
+
cropper.setData({
|
|
58
|
+
width: Math.max(minCroppedWidth, Math.min(maxCroppedWidth, width)),
|
|
59
|
+
height: Math.max(minCroppedHeight, Math.min(maxCroppedHeight, height))
|
|
60
|
+
});
|
|
61
|
+
node.textContent = JSON.stringify(cropper.getData(true));
|
|
62
|
+
}
|
|
43
63
|
}
|
|
44
64
|
});
|
|
45
65
|
|
|
@@ -53,7 +73,7 @@ var CropperWrapper = function CropperWrapper(_ref) {
|
|
|
53
73
|
|
|
54
74
|
node === null || node === void 0 ? void 0 : (_node$cropper = node.cropper) === null || _node$cropper === void 0 ? void 0 : _node$cropper.destroy();
|
|
55
75
|
};
|
|
56
|
-
}, [onInitialized, dragMode, width, height]);
|
|
76
|
+
}, [onInitialized, dragMode, width, height, cropBoxResizable, minCroppedWidth, minCroppedHeight, maxCroppedWidth, maxCroppedHeight]);
|
|
57
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
58
78
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
59
79
|
src: src,
|
|
@@ -21,7 +21,11 @@ var CropperModalHandler = function CropperModalHandler(_ref) {
|
|
|
21
21
|
_ref$cropBoxResizable = _ref.cropBoxResizable,
|
|
22
22
|
cropBoxResizable = _ref$cropBoxResizable === void 0 ? false : _ref$cropBoxResizable,
|
|
23
23
|
onCrop = _ref.onCrop,
|
|
24
|
-
_onClose = _ref.onClose
|
|
24
|
+
_onClose = _ref.onClose,
|
|
25
|
+
minCroppedWidth = _ref.minCroppedWidth,
|
|
26
|
+
minCroppedHeight = _ref.minCroppedHeight,
|
|
27
|
+
maxCroppedWidth = _ref.maxCroppedWidth,
|
|
28
|
+
maxCroppedHeight = _ref.maxCroppedHeight;
|
|
25
29
|
(0, _TitleModal.default)({
|
|
26
30
|
size: 'normal',
|
|
27
31
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CropImageModal.default, {
|
|
@@ -33,7 +37,11 @@ var CropperModalHandler = function CropperModalHandler(_ref) {
|
|
|
33
37
|
height: height,
|
|
34
38
|
cropBoxResizable: cropBoxResizable,
|
|
35
39
|
onCrop: onCrop,
|
|
36
|
-
onClose: _onClose
|
|
40
|
+
onClose: _onClose,
|
|
41
|
+
minCroppedWidth: minCroppedWidth,
|
|
42
|
+
minCroppedHeight: minCroppedHeight,
|
|
43
|
+
maxCroppedWidth: maxCroppedWidth,
|
|
44
|
+
maxCroppedHeight: maxCroppedHeight
|
|
37
45
|
}),
|
|
38
46
|
onClose: function onClose(dismiss) {
|
|
39
47
|
if (dismiss === true && _onClose) {
|
|
@@ -45,7 +45,11 @@ var CropImageModal = function CropImageModal(_ref) {
|
|
|
45
45
|
cropBoxResizable = _ref$cropBoxResizable === void 0 ? false : _ref$cropBoxResizable,
|
|
46
46
|
onCrop = _ref.onCrop,
|
|
47
47
|
onClose = _ref.onClose,
|
|
48
|
-
close = _ref.close
|
|
48
|
+
close = _ref.close,
|
|
49
|
+
minCroppedWidth = _ref.minCroppedWidth,
|
|
50
|
+
minCroppedHeight = _ref.minCroppedHeight,
|
|
51
|
+
maxCroppedWidth = _ref.maxCroppedWidth,
|
|
52
|
+
maxCroppedHeight = _ref.maxCroppedHeight;
|
|
49
53
|
|
|
50
54
|
var _useTranslation = (0, _reactI18next.useTranslation)(),
|
|
51
55
|
t = _useTranslation.t;
|
|
@@ -92,7 +96,11 @@ var CropImageModal = function CropImageModal(_ref) {
|
|
|
92
96
|
width: width,
|
|
93
97
|
height: height,
|
|
94
98
|
cropBoxResizable: cropBoxResizable,
|
|
95
|
-
onInitialized: handleInitialized
|
|
99
|
+
onInitialized: handleInitialized,
|
|
100
|
+
minCroppedWidth: minCroppedWidth,
|
|
101
|
+
minCroppedHeight: minCroppedHeight,
|
|
102
|
+
maxCroppedWidth: maxCroppedWidth,
|
|
103
|
+
maxCroppedHeight: maxCroppedHeight
|
|
96
104
|
})
|
|
97
105
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_TitleModal.default.Footer, {
|
|
98
106
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ButtonGroup.default, {
|
|
@@ -54,6 +54,10 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
54
54
|
width = _ref$width === void 0 ? 180 : _ref$width,
|
|
55
55
|
_ref$height = _ref.height,
|
|
56
56
|
height = _ref$height === void 0 ? 320 : _ref$height,
|
|
57
|
+
minCroppedWidth = _ref.minCroppedWidth,
|
|
58
|
+
minCroppedHeight = _ref.minCroppedHeight,
|
|
59
|
+
maxCroppedWidth = _ref.maxCroppedWidth,
|
|
60
|
+
maxCroppedHeight = _ref.maxCroppedHeight,
|
|
57
61
|
_ref$fixedSize = _ref.fixedSize,
|
|
58
62
|
fixedSize = _ref$fixedSize === void 0 ? true : _ref$fixedSize,
|
|
59
63
|
maxFiles = _ref.maxFiles,
|
|
@@ -182,6 +186,10 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
182
186
|
src: file.url,
|
|
183
187
|
width: width,
|
|
184
188
|
height: height,
|
|
189
|
+
minCroppedWidth: minCroppedWidth,
|
|
190
|
+
minCroppedHeight: minCroppedHeight,
|
|
191
|
+
maxCroppedWidth: maxCroppedWidth,
|
|
192
|
+
maxCroppedHeight: maxCroppedHeight,
|
|
185
193
|
cropBoxResizable: cropper.cropBoxResizable ? cropper.cropBoxResizable : false,
|
|
186
194
|
onCrop: function onCrop(croppedSrc) {
|
|
187
195
|
var croppedImageFile = (0, _utils.dataURLtoFile)(croppedSrc, file.name);
|
|
@@ -195,7 +203,7 @@ var ImageDropzone = function ImageDropzone(_ref) {
|
|
|
195
203
|
});
|
|
196
204
|
}
|
|
197
205
|
});
|
|
198
|
-
}, [width, height, cropper]);
|
|
206
|
+
}, [width, height, cropper, minCroppedWidth, minCroppedHeight, maxCroppedWidth, maxCroppedHeight]);
|
|
199
207
|
|
|
200
208
|
var previewItem = function previewItem() {
|
|
201
209
|
return files.map(function (file, index) {
|
package/package.json
CHANGED
package/styles/theme/index.js
CHANGED
|
@@ -5,15 +5,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _white = _interopRequireDefault(require("./white.theme"));
|
|
9
9
|
|
|
10
10
|
var _light = _interopRequireDefault(require("./light.theme"));
|
|
11
11
|
|
|
12
|
+
var _dark = _interopRequireDefault(require("./dark.theme"));
|
|
13
|
+
|
|
12
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
15
|
|
|
14
16
|
var themes = {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
White: _white.default,
|
|
18
|
+
Light: _light.default,
|
|
19
|
+
Dark: _dark.default
|
|
17
20
|
};
|
|
18
21
|
var _default = themes;
|
|
19
22
|
exports.default = _default;
|
|
@@ -16,10 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
16
16
|
var colorStyle = {
|
|
17
17
|
colorWhite: '#ffffff',
|
|
18
18
|
colorDark: '#353351',
|
|
19
|
-
colorGrey: '#
|
|
19
|
+
colorGrey: '#989cad',
|
|
20
20
|
colorPrimary: '#3661ec',
|
|
21
|
-
colorSuccess: '#
|
|
22
|
-
colorWarning: '#
|
|
21
|
+
colorSuccess: '#48d5cc',
|
|
22
|
+
colorWarning: '#feb444',
|
|
23
23
|
colorDanger: '#F495A1',
|
|
24
24
|
colorHover: 'rgba(54, 97, 236, 0.2)',
|
|
25
25
|
colorActive: 'rgba(54, 97, 236, 0.2)',
|
|
@@ -16,10 +16,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
16
16
|
var colorStyle = {
|
|
17
17
|
colorWhite: '#ffffff',
|
|
18
18
|
colorDark: '#353351',
|
|
19
|
-
colorGrey: '#
|
|
19
|
+
colorGrey: '#b7bbcd',
|
|
20
20
|
colorPrimary: '#345FEB',
|
|
21
21
|
colorSuccess: '#11D8CD',
|
|
22
|
-
colorWarning: '#
|
|
22
|
+
colorWarning: '#feb444',
|
|
23
23
|
colorDanger: '#F495A1',
|
|
24
24
|
colorHover: 'rgba(52, 95, 235, 0.2)',
|
|
25
25
|
colorActive: 'rgba(52, 95, 235, 0.2)',
|