@bigbinary/neeto-image-uploader-frontend 1.5.25 → 1.6.0-beta1
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/dist/index.cjs.js +615 -527
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +529 -450
- package/dist/index.js.map +1 -1
- package/package.json +15 -14
package/dist/index.js
CHANGED
|
@@ -1,38 +1,32 @@
|
|
|
1
|
-
import
|
|
1
|
+
import require$$0, { useMemo, useRef, useReducer, useEffect, useCallback, forwardRef, useImperativeHandle, Fragment, useState, createElement } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { noop as noop$1, keysToCamelCase, findBy, isPresent } from '@bigbinary/neeto-cist';
|
|
4
4
|
import { Delete, LeftArrow, MenuHorizontal } from '@bigbinary/neeto-icons';
|
|
5
|
-
import
|
|
5
|
+
import Button from '@bigbinary/neetoui/Button';
|
|
6
|
+
import Typography from '@bigbinary/neetoui/Typography';
|
|
6
7
|
import { pipe, values, flatten as flatten$1, map, toUpper, join, equals, isNil, isEmpty, mergeRight, mergeLeft, concat, __, inc, mergeDeepRight } from 'ramda';
|
|
7
8
|
import { Trans, useTranslation } from 'react-i18next';
|
|
8
9
|
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
9
10
|
import i18next, { t as t$1 } from 'i18next';
|
|
11
|
+
import Toastr from '@bigbinary/neetoui/Toastr';
|
|
12
|
+
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
13
|
+
import Dropdown from '@bigbinary/neetoui/Dropdown';
|
|
14
|
+
import NeetoUIModal from '@bigbinary/neetoui/Modal';
|
|
15
|
+
import Tab from '@bigbinary/neetoui/Tab';
|
|
16
|
+
import Spinner from '@bigbinary/neetoui/Spinner';
|
|
17
|
+
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
10
18
|
import { useMutationWithInvalidation, useDebounce, useFuncDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
11
|
-
import { useMutation, useQuery } from 'react-query';
|
|
12
19
|
import axios from 'axios';
|
|
13
20
|
import { DirectUpload } from '@rails/activestorage';
|
|
14
21
|
import { withEventTargetValue } from '@bigbinary/neeto-commons-frontend/utils';
|
|
22
|
+
import Input from '@bigbinary/neetoui/Input';
|
|
23
|
+
import Switch from '@bigbinary/neetoui/Switch';
|
|
15
24
|
|
|
16
25
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
17
26
|
|
|
18
27
|
var css = ".ReactCrop{position:relative;display:inline-block;cursor:crosshair;overflow:hidden;max-width:100%}.ReactCrop *,.ReactCrop *::before,.ReactCrop *::after{box-sizing:border-box}.ReactCrop--disabled,.ReactCrop--locked{cursor:inherit}.ReactCrop__child-wrapper{max-height:inherit}.ReactCrop__child-wrapper>img,.ReactCrop__child-wrapper>video{display:block;max-width:100%;max-height:inherit}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>img,.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__child-wrapper>video{touch-action:none}.ReactCrop:not(.ReactCrop--disabled) .ReactCrop__crop-selection{touch-action:none}.ReactCrop__crop-selection{position:absolute;top:0;left:0;transform:translate3d(0, 0, 0);cursor:move;box-shadow:0 0 0 9999em rgba(0,0,0,.5);border:1px dashed #fff}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%;box-shadow:0px 0px 1px 1px #fff,0 0 0 9999em rgba(0,0,0,.5)}.ReactCrop__crop-selection:focus{outline:none;border-color:blue;border-style:solid}.ReactCrop--invisible-crop .ReactCrop__crop-selection{display:none}.ReactCrop__rule-of-thirds-vt::before,.ReactCrop__rule-of-thirds-vt::after,.ReactCrop__rule-of-thirds-hz::before,.ReactCrop__rule-of-thirds-hz::after{content:\"\";display:block;position:absolute;background-color:rgba(255,255,255,.4)}.ReactCrop__rule-of-thirds-vt::before,.ReactCrop__rule-of-thirds-vt::after{width:1px;height:100%}.ReactCrop__rule-of-thirds-vt::before{left:33.3333333333%}.ReactCrop__rule-of-thirds-vt::after{left:66.6666666667%}.ReactCrop__rule-of-thirds-hz::before,.ReactCrop__rule-of-thirds-hz::after{width:100%;height:1px}.ReactCrop__rule-of-thirds-hz::before{top:33.3333333333%}.ReactCrop__rule-of-thirds-hz::after{top:66.6666666667%}.ReactCrop__drag-handle{position:absolute}.ReactCrop__drag-handle::after{position:absolute;content:\"\";display:block;width:10px;height:10px;background-color:rgba(0,0,0,.2);border:1px solid rgba(255,255,255,.7);outline:1px solid rgba(0,0,0,0)}.ReactCrop__drag-handle:focus::after{border-color:blue;background:#2dbfff}.ReactCrop .ord-nw{top:0;left:0;margin-top:-5px;margin-left:-5px;cursor:nw-resize}.ReactCrop .ord-nw::after{top:0;left:0}.ReactCrop .ord-n{top:0;left:50%;margin-top:-5px;margin-left:-5px;cursor:n-resize}.ReactCrop .ord-n::after{top:0}.ReactCrop .ord-ne{top:0;right:0;margin-top:-5px;margin-right:-5px;cursor:ne-resize}.ReactCrop .ord-ne::after{top:0;right:0}.ReactCrop .ord-e{top:50%;right:0;margin-top:-5px;margin-right:-5px;cursor:e-resize}.ReactCrop .ord-e::after{right:0}.ReactCrop .ord-se{bottom:0;right:0;margin-bottom:-5px;margin-right:-5px;cursor:se-resize}.ReactCrop .ord-se::after{bottom:0;right:0}.ReactCrop .ord-s{bottom:0;left:50%;margin-bottom:-5px;margin-left:-5px;cursor:s-resize}.ReactCrop .ord-s::after{bottom:0}.ReactCrop .ord-sw{bottom:0;left:0;margin-bottom:-5px;margin-left:-5px;cursor:sw-resize}.ReactCrop .ord-sw::after{bottom:0;left:0}.ReactCrop .ord-w{top:50%;left:0;margin-top:-5px;margin-left:-5px;cursor:w-resize}.ReactCrop .ord-w::after{left:0}.ReactCrop__disabled .ReactCrop__drag-handle{cursor:inherit}.ReactCrop__drag-bar{position:absolute}.ReactCrop__drag-bar.ord-n{top:0;left:0;width:100%;height:6px;margin-top:-3px}.ReactCrop__drag-bar.ord-e{right:0;top:0;width:6px;height:100%;margin-right:-3px}.ReactCrop__drag-bar.ord-s{bottom:0;left:0;width:100%;height:6px;margin-bottom:-3px}.ReactCrop__drag-bar.ord-w{top:0;left:0;width:6px;height:100%;margin-left:-3px}.ReactCrop--new-crop .ReactCrop__drag-bar,.ReactCrop--new-crop .ReactCrop__drag-handle,.ReactCrop--fixed-aspect .ReactCrop__drag-bar{display:none}.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-n,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-e,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-s,.ReactCrop--fixed-aspect .ReactCrop__drag-handle.ord-w{display:none}@media(pointer: coarse){.ReactCrop .ord-n,.ReactCrop .ord-e,.ReactCrop .ord-s,.ReactCrop .ord-w{display:none}.ReactCrop__drag-handle{width:24px;height:24px}}.niu-modal {\n width: 95vw !important;\n height: 75vh !important;\n max-width: 1152px !important;\n max-height: 576px !important;\n position: relative !important;\n}.niu-unsplash-container {\n height: calc(75vh - 220px) !important;\n max-height: 355px;\n}.niu-unsplash-container img {\n height: 100%;\n width: 100%;\n -o-object-fit: cover;\n object-fit: cover;\n animation: fade-in 1.2s 1s cubic-bezier(0.39, 0.575, 0.565, 1) both;\n border-radius: var(--neeto-ui-rounded);\n position: relative;\n cursor: pointer;\n}.ReactCrop .ReactCrop__child-wrapper {\n width: 100%;\n height: 100%;\n}.ReactCrop .ReactCrop__child-wrapper img {\n height: auto;\n width: auto;\n max-width: 100%;\n max-height: 100%;\n display: block;\n}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9yZWFjdC1pbWFnZS1jcm9wL2Rpc3QvUmVhY3RDcm9wLmNzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX21vZGFsLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zdHlsZXNoZWV0cy9hcHBsaWNhdGlvbi5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvY29tcG9uZW50cy9faW1hZ2UtbGlicmFyeS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvYWJzdHJhY3RzL192YXJpYWJsZXMuc2NzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3JlYWN0LWNyb3Auc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxXQUFXLGlCQUFpQixDQUFDLG9CQUFvQixDQUFDLGdCQUFnQixDQUFDLGVBQWUsQ0FBQyxjQUFjLENBQUMsc0RBQXNELHFCQUFxQixDQUFDLHdDQUF3QyxjQUFjLENBQUMsMEJBQTBCLGtCQUFrQixDQUFDLDhEQUE4RCxhQUFhLENBQUMsY0FBYyxDQUFDLGtCQUFrQixDQUFDLHdJQUF3SSxpQkFBaUIsQ0FBQyxnRUFBZ0UsaUJBQWlCLENBQUMsMkJBQTJCLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsOEJBQThCLENBQUMsV0FBVyxDQUFDLHNDQUFzQyxDQUFDLHNCQUFzQixDQUFDLGdEQUFn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xheTogYmxvY2s7XG4gICAgfVxuICB9XG59XG4iXX0= */";
|
|
19
28
|
n(css,{});
|
|
20
29
|
|
|
21
|
-
function _extends$1() {
|
|
22
|
-
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
23
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
24
|
-
var source = arguments[i];
|
|
25
|
-
for (var key in source) {
|
|
26
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
27
|
-
target[key] = source[key];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
return target;
|
|
32
|
-
};
|
|
33
|
-
return _extends$1.apply(this, arguments);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
30
|
function _typeof$2(o) {
|
|
37
31
|
"@babel/helpers - typeof";
|
|
38
32
|
|
|
@@ -728,9 +722,9 @@ function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Sy
|
|
|
728
722
|
|
|
729
723
|
function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
|
|
730
724
|
|
|
731
|
-
function ownKeys$
|
|
725
|
+
function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
732
726
|
|
|
733
|
-
function _objectSpread$
|
|
727
|
+
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$c(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
734
728
|
|
|
735
729
|
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
736
730
|
|
|
@@ -947,7 +941,7 @@ function pickerOptionsFromAccept(accept) {
|
|
|
947
941
|
mimeType = _ref5[0],
|
|
948
942
|
ext = _ref5[1];
|
|
949
943
|
|
|
950
|
-
return _objectSpread$
|
|
944
|
+
return _objectSpread$b(_objectSpread$b({}, agg), {}, _defineProperty$2({}, mimeType, ext));
|
|
951
945
|
}, {});
|
|
952
946
|
return [{
|
|
953
947
|
// description is required due to https://crbug.com/1264708
|
|
@@ -1060,9 +1054,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
1060
1054
|
|
|
1061
1055
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1062
1056
|
|
|
1063
|
-
function ownKeys$
|
|
1057
|
+
function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1064
1058
|
|
|
1065
|
-
function _objectSpread$
|
|
1059
|
+
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$b(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1066
1060
|
|
|
1067
1061
|
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1068
1062
|
|
|
@@ -1098,7 +1092,7 @@ var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
1098
1092
|
};
|
|
1099
1093
|
}, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
|
|
1100
1094
|
|
|
1101
|
-
return /*#__PURE__*/
|
|
1095
|
+
return /*#__PURE__*/require$$0.createElement(Fragment, null, children(_objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
1102
1096
|
open: open
|
|
1103
1097
|
})));
|
|
1104
1098
|
});
|
|
@@ -1471,7 +1465,7 @@ var initialState = {
|
|
|
1471
1465
|
function useDropzone() {
|
|
1472
1466
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1473
1467
|
|
|
1474
|
-
var _defaultProps$props = _objectSpread$
|
|
1468
|
+
var _defaultProps$props = _objectSpread$a(_objectSpread$a({}, defaultProps), props),
|
|
1475
1469
|
accept = _defaultProps$props.accept,
|
|
1476
1470
|
disabled = _defaultProps$props.disabled,
|
|
1477
1471
|
getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
|
|
@@ -1896,7 +1890,7 @@ function useDropzone() {
|
|
|
1896
1890
|
onDrop = _ref2.onDrop,
|
|
1897
1891
|
rest = _objectWithoutProperties$1(_ref2, _excluded3);
|
|
1898
1892
|
|
|
1899
|
-
return _objectSpread$
|
|
1893
|
+
return _objectSpread$a(_objectSpread$a(_defineProperty$1({
|
|
1900
1894
|
onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
|
|
1901
1895
|
onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
|
|
1902
1896
|
onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
|
|
@@ -1935,10 +1929,10 @@ function useDropzone() {
|
|
|
1935
1929
|
tabIndex: -1
|
|
1936
1930
|
}, refKey, inputRef);
|
|
1937
1931
|
|
|
1938
|
-
return _objectSpread$
|
|
1932
|
+
return _objectSpread$a(_objectSpread$a({}, inputProps), rest);
|
|
1939
1933
|
};
|
|
1940
1934
|
}, [inputRef, accept, multiple, onDropCb, disabled]);
|
|
1941
|
-
return _objectSpread$
|
|
1935
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1942
1936
|
isFocused: isFocused && !disabled,
|
|
1943
1937
|
getRootProps: getRootProps,
|
|
1944
1938
|
getInputProps: getInputProps,
|
|
@@ -1957,40 +1951,40 @@ function reducer(state, action) {
|
|
|
1957
1951
|
/* istanbul ignore next */
|
|
1958
1952
|
switch (action.type) {
|
|
1959
1953
|
case "focus":
|
|
1960
|
-
return _objectSpread$
|
|
1954
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1961
1955
|
isFocused: true
|
|
1962
1956
|
});
|
|
1963
1957
|
|
|
1964
1958
|
case "blur":
|
|
1965
|
-
return _objectSpread$
|
|
1959
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1966
1960
|
isFocused: false
|
|
1967
1961
|
});
|
|
1968
1962
|
|
|
1969
1963
|
case "openDialog":
|
|
1970
|
-
return _objectSpread$
|
|
1964
|
+
return _objectSpread$a(_objectSpread$a({}, initialState), {}, {
|
|
1971
1965
|
isFileDialogActive: true
|
|
1972
1966
|
});
|
|
1973
1967
|
|
|
1974
1968
|
case "closeDialog":
|
|
1975
|
-
return _objectSpread$
|
|
1969
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1976
1970
|
isFileDialogActive: false
|
|
1977
1971
|
});
|
|
1978
1972
|
|
|
1979
1973
|
case "setDraggedFiles":
|
|
1980
|
-
return _objectSpread$
|
|
1974
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1981
1975
|
isDragActive: action.isDragActive,
|
|
1982
1976
|
isDragAccept: action.isDragAccept,
|
|
1983
1977
|
isDragReject: action.isDragReject
|
|
1984
1978
|
});
|
|
1985
1979
|
|
|
1986
1980
|
case "setFiles":
|
|
1987
|
-
return _objectSpread$
|
|
1981
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1988
1982
|
acceptedFiles: action.acceptedFiles,
|
|
1989
1983
|
fileRejections: action.fileRejections
|
|
1990
1984
|
});
|
|
1991
1985
|
|
|
1992
1986
|
case "reset":
|
|
1993
|
-
return _objectSpread$
|
|
1987
|
+
return _objectSpread$a({}, initialState);
|
|
1994
1988
|
|
|
1995
1989
|
default:
|
|
1996
1990
|
return state;
|
|
@@ -2052,19 +2046,24 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
2052
2046
|
var _ref$progressPercenta = _ref.progressPercentage,
|
|
2053
2047
|
progressPercentage = _ref$progressPercenta === void 0 ? 0 : _ref$progressPercenta,
|
|
2054
2048
|
progressValue = _ref.progressValue;
|
|
2055
|
-
return /*#__PURE__*/
|
|
2056
|
-
className: "neeto-ui-border-primary-600 hover:neeto-ui-bg-gray-100 neeto-ui-rounded-lg flex h-full cursor-pointer items-center justify-center gap-3 border border-dashed p-5 transition-all duration-300 ease-in-out"
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2049
|
+
return /*#__PURE__*/jsx("div", {
|
|
2050
|
+
className: "neeto-ui-border-primary-600 hover:neeto-ui-bg-gray-100 neeto-ui-rounded-lg flex h-full cursor-pointer items-center justify-center gap-3 border border-dashed p-5 transition-all duration-300 ease-in-out",
|
|
2051
|
+
children: /*#__PURE__*/jsx("div", {
|
|
2052
|
+
className: "neeto-ui-bg-gray-200 neeto-ui-rounded-full w-full overflow-hidden dark:bg-gray-700",
|
|
2053
|
+
children: /*#__PURE__*/jsx("div", {
|
|
2054
|
+
className: "neeto-ui-bg-primary-600 text-2xs neeto-ui-text-primary-100 neeto-ui-rounded-full flex h-3 animate-pulse items-center justify-center font-medium leading-none transition-all duration-300 ease-in-out",
|
|
2055
|
+
"data-cy": "neeto-image-uploader-progress-bar",
|
|
2056
|
+
style: {
|
|
2057
|
+
width: "".concat(progressPercentage, "%")
|
|
2058
|
+
},
|
|
2059
|
+
children: progressValue
|
|
2060
|
+
})
|
|
2061
|
+
})
|
|
2062
|
+
});
|
|
2066
2063
|
};
|
|
2067
2064
|
|
|
2065
|
+
function ownKeys$a(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2066
|
+
function _objectSpread$9(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$a(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$a(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2068
2067
|
var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
2069
2068
|
var _ref$uploadConfig = _ref.uploadConfig,
|
|
2070
2069
|
uploadConfig = _ref$uploadConfig === void 0 ? DEFAULT_UPLOAD_CONFIG : _ref$uploadConfig,
|
|
@@ -2082,72 +2081,79 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
|
2082
2081
|
isDragActive = _useUploadDropzone.isDragActive,
|
|
2083
2082
|
uploadProgress = _useUploadDropzone.uploadProgress;
|
|
2084
2083
|
var shouldShowProgress = !!(uploadProgress && !equals(uploadProgress, 1));
|
|
2085
|
-
return shouldShowProgress ? /*#__PURE__*/
|
|
2084
|
+
return shouldShowProgress ? /*#__PURE__*/jsx(ProgressBar, {
|
|
2086
2085
|
progressPercentage: uploadProgress,
|
|
2087
2086
|
progressValue: "".concat(uploadProgress, "%")
|
|
2088
|
-
}) : /*#__PURE__*/
|
|
2087
|
+
}) : /*#__PURE__*/jsx("div", _objectSpread$9(_objectSpread$9({}, getRootProps()), {}, {
|
|
2089
2088
|
className: classnames(DROPZONE_ROOT_DIV_CLASSNAME, {
|
|
2090
2089
|
"neeto-ui-border-gray-300": !isDragActive,
|
|
2091
2090
|
"neeto-ui-border-gray-700": isDragActive
|
|
2091
|
+
}),
|
|
2092
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
2093
|
+
className: "flex flex-col space-y-1",
|
|
2094
|
+
children: [!isDisabled && /*#__PURE__*/jsx(Typography, {
|
|
2095
|
+
className: "neeto-ui-text-gray-800 text-center leading-4",
|
|
2096
|
+
style: "body2",
|
|
2097
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
2098
|
+
i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
|
|
2099
|
+
components: {
|
|
2100
|
+
span: /*#__PURE__*/jsx("span", {
|
|
2101
|
+
className: "neeto-ui-text-primary-500",
|
|
2102
|
+
"data-cy": "neeto-image-uploader-browse-text"
|
|
2103
|
+
})
|
|
2104
|
+
}
|
|
2105
|
+
})
|
|
2106
|
+
}), setIsAssetLibraryOpen && /*#__PURE__*/jsx(Typography, {
|
|
2107
|
+
className: "text-center leading-4",
|
|
2108
|
+
style: "body2",
|
|
2109
|
+
onClick: function onClick(e) {
|
|
2110
|
+
e.stopPropagation();
|
|
2111
|
+
setIsAssetLibraryOpen(true);
|
|
2112
|
+
},
|
|
2113
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
2114
|
+
i18nKey: "neetoImageUploader.imageUpload.selectImagefromImageLibrary",
|
|
2115
|
+
components: {
|
|
2116
|
+
span: /*#__PURE__*/jsx("span", {
|
|
2117
|
+
className: "neeto-ui-text-primary-500",
|
|
2118
|
+
"data-cy": "open-asset-library-button"
|
|
2119
|
+
})
|
|
2120
|
+
}
|
|
2121
|
+
})
|
|
2122
|
+
}), /*#__PURE__*/jsx("input", _objectSpread$9(_objectSpread$9({}, getInputProps()), {}, {
|
|
2123
|
+
"data-cy": "neeto-image-uploader-file-input",
|
|
2124
|
+
disabled: isDisabled
|
|
2125
|
+
})), /*#__PURE__*/jsx(Typography, {
|
|
2126
|
+
className: "neeto-ui-text-gray-700 text-center leading-4",
|
|
2127
|
+
"data-cy": "neeto-image-uploader-restriction-message",
|
|
2128
|
+
lineHeight: "snug",
|
|
2129
|
+
style: "nano",
|
|
2130
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
2131
|
+
i18nKey: "neetoImageUploader.imageUpload.restrictionMessage",
|
|
2132
|
+
values: {
|
|
2133
|
+
fileTypes: getAllowedTypes(uploadConfig),
|
|
2134
|
+
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
|
|
2135
|
+
}
|
|
2136
|
+
})
|
|
2137
|
+
})]
|
|
2092
2138
|
})
|
|
2093
|
-
})
|
|
2094
|
-
className: "flex flex-col space-y-1"
|
|
2095
|
-
}, !isDisabled && /*#__PURE__*/React.createElement(Typography, {
|
|
2096
|
-
className: "neeto-ui-text-gray-800 text-center leading-4",
|
|
2097
|
-
style: "body2"
|
|
2098
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
2099
|
-
i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
|
|
2100
|
-
components: {
|
|
2101
|
-
span: /*#__PURE__*/React.createElement("span", {
|
|
2102
|
-
className: "neeto-ui-text-primary-500",
|
|
2103
|
-
"data-cy": "neeto-image-uploader-browse-text"
|
|
2104
|
-
})
|
|
2105
|
-
}
|
|
2106
|
-
})), setIsAssetLibraryOpen && /*#__PURE__*/React.createElement(Typography, {
|
|
2107
|
-
className: "text-center leading-4",
|
|
2108
|
-
style: "body2",
|
|
2109
|
-
onClick: function onClick(e) {
|
|
2110
|
-
e.stopPropagation();
|
|
2111
|
-
setIsAssetLibraryOpen(true);
|
|
2112
|
-
}
|
|
2113
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
2114
|
-
i18nKey: "neetoImageUploader.imageUpload.selectImagefromImageLibrary",
|
|
2115
|
-
components: {
|
|
2116
|
-
span: /*#__PURE__*/React.createElement("span", {
|
|
2117
|
-
className: "neeto-ui-text-primary-500",
|
|
2118
|
-
"data-cy": "open-asset-library-button"
|
|
2119
|
-
})
|
|
2120
|
-
}
|
|
2121
|
-
})), /*#__PURE__*/React.createElement("input", _extends$1({}, getInputProps(), {
|
|
2122
|
-
"data-cy": "neeto-image-uploader-file-input",
|
|
2123
|
-
disabled: isDisabled
|
|
2124
|
-
})), /*#__PURE__*/React.createElement(Typography, {
|
|
2125
|
-
className: "neeto-ui-text-gray-700 text-center leading-4",
|
|
2126
|
-
"data-cy": "neeto-image-uploader-restriction-message",
|
|
2127
|
-
lineHeight: "snug",
|
|
2128
|
-
style: "nano"
|
|
2129
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
2130
|
-
i18nKey: "neetoImageUploader.imageUpload.restrictionMessage",
|
|
2131
|
-
values: {
|
|
2132
|
-
fileTypes: getAllowedTypes(uploadConfig),
|
|
2133
|
-
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
|
|
2134
|
-
}
|
|
2135
|
-
}))));
|
|
2139
|
+
}));
|
|
2136
2140
|
};
|
|
2137
2141
|
|
|
2138
2142
|
var _excluded$4 = ["className"];
|
|
2143
|
+
function ownKeys$9(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2144
|
+
function _objectSpread$8(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$9(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$9(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2139
2145
|
var ImagePlaceholder = function ImagePlaceholder(_ref) {
|
|
2140
2146
|
var _ref$className = _ref.className,
|
|
2141
2147
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
2142
2148
|
props = _objectWithoutProperties$2(_ref, _excluded$4);
|
|
2143
|
-
return /*#__PURE__*/
|
|
2149
|
+
return /*#__PURE__*/jsx("div", _objectSpread$8({
|
|
2144
2150
|
className: classnames("neeto-ui-bg-gray-200", _defineProperty$3({}, className, className))
|
|
2145
2151
|
}, props));
|
|
2146
2152
|
};
|
|
2147
2153
|
|
|
2148
2154
|
var _excluded$3 = ["src", "className", "fallback"];
|
|
2149
|
-
function ownKeys$
|
|
2150
|
-
function _objectSpread$
|
|
2155
|
+
function ownKeys$8(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2156
|
+
function _objectSpread$7(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$8(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$8(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2151
2157
|
var ImageWithFallback = function ImageWithFallback(_ref) {
|
|
2152
2158
|
var src = _ref.src,
|
|
2153
2159
|
_ref$className = _ref.className,
|
|
@@ -2166,13 +2172,13 @@ var ImageWithFallback = function ImageWithFallback(_ref) {
|
|
|
2166
2172
|
};
|
|
2167
2173
|
img.src = src;
|
|
2168
2174
|
}, [src]);
|
|
2169
|
-
return isLoaded ? /*#__PURE__*/
|
|
2175
|
+
return isLoaded ? /*#__PURE__*/jsx("img", _objectSpread$7(_objectSpread$7({}, _objectSpread$7({
|
|
2170
2176
|
src: src
|
|
2171
|
-
}, props), {
|
|
2177
|
+
}, props)), {}, {
|
|
2172
2178
|
className: "h-full w-auto object-contain"
|
|
2173
|
-
})) : /*#__PURE__*/
|
|
2179
|
+
})) : /*#__PURE__*/jsx(Fallback, _objectSpread$7({}, _objectSpread$7({
|
|
2174
2180
|
className: className
|
|
2175
|
-
}, props));
|
|
2181
|
+
}, props)));
|
|
2176
2182
|
};
|
|
2177
2183
|
|
|
2178
2184
|
var IS_DEVELOPMENT_OR_HEROKU_ENV = process.env.RAILS_ENV === "development" || process.env.RAILS_ENV === "heroku";
|
|
@@ -2281,7 +2287,7 @@ function _defineProperty(obj, key, value) {
|
|
|
2281
2287
|
return obj;
|
|
2282
2288
|
}
|
|
2283
2289
|
|
|
2284
|
-
function ownKeys$
|
|
2290
|
+
function ownKeys$7(object, enumerableOnly) {
|
|
2285
2291
|
var keys = Object.keys(object);
|
|
2286
2292
|
|
|
2287
2293
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -2300,13 +2306,13 @@ function _objectSpread2(target) {
|
|
|
2300
2306
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2301
2307
|
|
|
2302
2308
|
if (i % 2) {
|
|
2303
|
-
ownKeys$
|
|
2309
|
+
ownKeys$7(Object(source), true).forEach(function (key) {
|
|
2304
2310
|
_defineProperty(target, key, source[key]);
|
|
2305
2311
|
});
|
|
2306
2312
|
} else if (Object.getOwnPropertyDescriptors) {
|
|
2307
2313
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2308
2314
|
} else {
|
|
2309
|
-
ownKeys$
|
|
2315
|
+
ownKeys$7(Object(source)).forEach(function (key) {
|
|
2310
2316
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2311
2317
|
});
|
|
2312
2318
|
}
|
|
@@ -2879,8 +2885,8 @@ var isItemsCenter = function isItemsCenter(_ref4) {
|
|
|
2879
2885
|
};
|
|
2880
2886
|
|
|
2881
2887
|
var _excluded$2 = ["src", "className", "imageFallbackProps", "onDrop", "isDisabled", "onRemove"];
|
|
2882
|
-
function ownKeys$
|
|
2883
|
-
function _objectSpread$
|
|
2888
|
+
function ownKeys$6(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2889
|
+
function _objectSpread$6(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$6(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$6(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2884
2890
|
var BasicImageUploader = function BasicImageUploader(_ref) {
|
|
2885
2891
|
var _ref$src = _ref.src,
|
|
2886
2892
|
src = _ref$src === void 0 ? "" : _ref$src,
|
|
@@ -2898,29 +2904,31 @@ var BasicImageUploader = function BasicImageUploader(_ref) {
|
|
|
2898
2904
|
_ref$onRemove = _ref.onRemove,
|
|
2899
2905
|
onRemove = _ref$onRemove === void 0 ? noop$1 : _ref$onRemove,
|
|
2900
2906
|
props = _objectWithoutProperties$2(_ref, _excluded$2);
|
|
2901
|
-
return /*#__PURE__*/
|
|
2907
|
+
return /*#__PURE__*/jsx("div", {
|
|
2902
2908
|
className: classnames(className, {
|
|
2903
2909
|
"cursor-pointer": true,
|
|
2904
2910
|
"cursor-not-allowed": isDisabled,
|
|
2905
2911
|
"opacity-70": isDisabled && isNilOrEmpty(src)
|
|
2906
|
-
})
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2912
|
+
}),
|
|
2913
|
+
children: isNotNilOrEmpty(src) ? /*#__PURE__*/jsxs("div", {
|
|
2914
|
+
className: IMAGE_WRAPPER_CLASSNAME,
|
|
2915
|
+
children: [/*#__PURE__*/jsx(ImageWithFallback, _objectSpread$6(_objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, imageFallbackProps), {}, {
|
|
2916
|
+
src: src
|
|
2917
|
+
})), {}, {
|
|
2918
|
+
"data-cy": "uploaded-image"
|
|
2919
|
+
})), /*#__PURE__*/jsx(Button, {
|
|
2920
|
+
className: "absolute right-3 top-3",
|
|
2921
|
+
"data-cy": "basic-image-uploader-remove-button",
|
|
2922
|
+
disabled: isDisabled,
|
|
2923
|
+
icon: Delete,
|
|
2924
|
+
size: "small",
|
|
2925
|
+
onClick: onRemove
|
|
2926
|
+
})]
|
|
2927
|
+
}) : /*#__PURE__*/jsx(ImageDirectUpload, _objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
2928
|
+
isDisabled: isDisabled,
|
|
2929
|
+
onDrop: onDrop
|
|
2930
|
+
})))
|
|
2931
|
+
});
|
|
2924
2932
|
};
|
|
2925
2933
|
|
|
2926
2934
|
var create = function create(payload) {
|
|
@@ -2952,10 +2960,10 @@ var ASSETS_STALE_TIME = 900000; // 15 mins
|
|
|
2952
2960
|
|
|
2953
2961
|
var UNSPLASH_STALE_TIME = 900000;
|
|
2954
2962
|
|
|
2955
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2956
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2963
|
+
function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
2964
|
+
function _objectSpread$5(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$5(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$5(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2957
2965
|
var useCreateBlob = function useCreateBlob(options) {
|
|
2958
|
-
return useMutationWithInvalidation(directUploadsApi.create, _objectSpread({
|
|
2966
|
+
return useMutationWithInvalidation(directUploadsApi.create, _objectSpread$5({
|
|
2959
2967
|
keysToInvalidate: [QUERY_KEYS.ASSETS_LIST]
|
|
2960
2968
|
}, options));
|
|
2961
2969
|
};
|
|
@@ -3492,7 +3500,7 @@ var ReactCrop_min = {exports: {}};
|
|
|
3492
3500
|
ReactCrop_min.exports;
|
|
3493
3501
|
|
|
3494
3502
|
(function (module, exports) {
|
|
3495
|
-
!function(e,t){module.exports=t(React);}(commonjsGlobal,(e=>(()=>{var t={899:t=>{t.exports=e;}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]});},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});};var r={};return (()=>{o.r(r),o.d(r,{Component:()=>u,areCropsEqual:()=>h,centerCrop:()=>d,clamp:()=>a,containCrop:()=>p,convertToPercentCrop:()=>c,convertToPixelCrop:()=>l,default:()=>u,defaultCrop:()=>i,makeAspectCrop:()=>s,nudgeCrop:()=>g});var e=o(899),t=o.n(e);function n(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=n(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const i={x:0,y:0,width:0,height:0,unit:"px"};function a(e,t,n){return Math.min(Math.max(e,t),n)}function h(e,t){return e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit}function s(e,t,n,o){const r=l(e,n,o);return e.width&&(r.height=r.width/t),e.height&&(r.width=r.height*t),r.y+r.height>o&&(r.height=o-r.y,r.width=r.height*t),r.x+r.width>n&&(r.width=n-r.x,r.height=r.width/t),"%"===e.unit?c(r,n,o):r}function d(e,t,n){const o=l(e,t,n);return o.x=(t-o.width)/2,o.y=(n-o.height)/2,"%"===e.unit?c(o,t,n):o}function c(e,t,n){return "%"===e.unit?{...i,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function l(e,t,n){return e.unit?"px"===e.unit?{...i,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...i,...e,unit:"px"}}function p(e,t,n,o,r,i=0,a=0,h=o,s=r){const d={...e};let c=Math.min(i,o),l=Math.min(a,r),p=Math.min(h,o),g=Math.min(s,r);t&&(t>1?(c=a?a*t:c,l=c/t,p=h*t):(l=i?i/t:l,c=l*t,g=s/t)),d.y<0&&(d.height=Math.max(d.height+d.y,l),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,c),d.x=0);const w=o-(d.x+d.width);w<0&&(d.x=Math.min(d.x,o-c),d.width+=w);const u=r-(d.y+d.height);if(u<0&&(d.y=Math.min(d.y,r-l),d.height+=u),d.width<c&&("sw"!==n&&"nw"!=n||(d.x-=c-d.width),d.width=c),d.height<l&&("nw"!==n&&"ne"!=n||(d.y-=l-d.height),d.height=l),d.width>p&&("sw"!==n&&"nw"!=n||(d.x-=p-d.width),d.width=p),d.height>g&&("nw"!==n&&"ne"!=n||(d.y-=g-d.height),d.height=g),t){const e=d.width/d.height;if(e<t){const e=Math.max(d.width/t,l);"nw"!==n&&"ne"!=n||(d.y-=e-d.height),d.height=e;}else if(e>t){const e=Math.max(d.height*t,c);"sw"!==n&&"nw"!=n||(d.x-=e-d.width),d.width=e;}}return d}function g(e,t,n,o){const r={...e};return "ArrowLeft"===t?"nw"===o?(r.x-=n,r.y-=n,r.width+=n,r.height+=n):"w"===o?(r.x-=n,r.width+=n):"sw"===o?(r.x-=n,r.width+=n,r.height+=n):"ne"===o?(r.y+=n,r.width-=n,r.height-=n):"e"===o?r.width-=n:"se"===o&&(r.width-=n,r.height-=n):"ArrowRight"===t&&("nw"===o?(r.x+=n,r.y+=n,r.width-=n,r.height-=n):"w"===o?(r.x+=n,r.width-=n):"sw"===o?(r.x+=n,r.width-=n,r.height-=n):"ne"===o?(r.y-=n,r.width+=n,r.height+=n):"e"===o?r.width+=n:"se"===o&&(r.width+=n,r.height+=n)),"ArrowUp"===t?"nw"===o?(r.x-=n,r.y-=n,r.width+=n,r.height+=n):"n"===o?(r.y-=n,r.height+=n):"ne"===o?(r.y-=n,r.width+=n,r.height+=n):"sw"===o?(r.x+=n,r.width-=n,r.height-=n):"s"===o?r.height-=n:"se"===o&&(r.width-=n,r.height-=n):"ArrowDown"===t&&("nw"===o?(r.x+=n,r.y+=n,r.width-=n,r.height-=n):"n"===o?(r.y+=n,r.height-=n):"ne"===o?(r.y+=n,r.width-=n,r.height-=n):"sw"===o?(r.x-=n,r.width+=n,r.height+=n):"s"===o?r.height+=n:"se"===o&&(r.width+=n,r.height+=n)),r}const w={capture:!0,passive:!1};class u extends e.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=(0, e.createRef)(),this.mediaRef=(0, e.createRef)(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{const{crop:t,disabled:n}=this.props,o=this.getBox();if(!t)return;const r=l(t,o.width,o.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const i=e.target.dataset.ord,a=Boolean(i);let h=e.clientX,s=e.clientY,d=r.x,c=r.y;if(i){const t=e.clientX-o.x,n=e.clientY-o.y;let a=0,l=0;"ne"===i||"e"==i?(a=t-(r.x+r.width),l=n-r.y,d=r.x,c=r.y+r.height):"se"===i||"s"===i?(a=t-(r.x+r.width),l=n-(r.y+r.height),d=r.x,c=r.y):"sw"===i||"w"==i?(a=t-r.x,l=n-(r.y+r.height),d=r.x+r.width,c=r.y):"nw"!==i&&"n"!=i||(a=t-r.x,l=n-r.y,d=r.x+r.width,c=r.y+r.height),h=d+o.x+a,s=c+o.y+l;}this.evData={startClientX:h,startClientY:s,startCropX:d,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:i},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0});},this.onComponentPointerDown=e=>{const{crop:t,disabled:n,locked:o,keepSelection:r,onChange:i}=this.props,a=this.getBox();if(n||o||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=e.clientX-a.x,s=e.clientY-a.y,d={unit:"px",x:h,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,i(l(d,a.width,a.height),c(d,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0});},this.onDocPointerMove=e=>{const{crop:t,disabled:n,onChange:o,onDragStart:r}=this.props,i=this.getBox();if(n||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,r&&r(e));const{evData:a}=this;let s;a.clientX=e.clientX,a.clientY=e.clientY,s=a.isResize?this.resizeCrop():this.dragCrop(),h(t,s)||o(l(s,i.width,i.height),c(s,i.width,i.height));},this.onComponentKeyDown=e=>{const{crop:t,disabled:n,onChange:o,onComplete:r}=this.props,i=this.getBox();if(n)return;const h=e.key;let s=!1;if(!t)return;const d=this.makePixelCrop(),p=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?u.nudgeStepLarge:e.shiftKey?u.nudgeStepMedium:u.nudgeStep;if("ArrowLeft"===h?(d.x-=p,s=!0):"ArrowRight"===h?(d.x+=p,s=!0):"ArrowUp"===h?(d.y-=p,s=!0):"ArrowDown"===h&&(d.y+=p,s=!0),s){e.cancelable&&e.preventDefault(),d.x=a(d.x,0,i.width-d.width),d.y=a(d.y,0,i.height-d.height);const t=l(d,i.width,i.height),n=c(d,i.width,i.height);o(t,n),r&&r(t,n);}},this.onHandlerKeyDown=(e,t)=>{const{aspect:n=0,crop:o,disabled:r,minWidth:i=0,minHeight:a=0,maxWidth:s,maxHeight:d,onChange:w,onComplete:m}=this.props,y=this.getBox();if(r||!o)return;if("ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.stopPropagation(),e.preventDefault();const x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?u.nudgeStepLarge:e.shiftKey?u.nudgeStepMedium:u.nudgeStep,C=p(g(l(o,y.width,y.height),e.key,x,t),n,t,y.width,y.height,i,a,s,d);if(!h(o,C)){const e=c(C,y.width,y.height);w(C,e),m&&m(C,e);}},this.onDocPointerDone=e=>{const{crop:t,disabled:n,onComplete:o,onDragEnd:r}=this.props,i=this.getBox();this.unbindDocMove(),!n&&t&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),o&&o(l(t,i.width,i.height),c(t,i.width,i.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}));},this.onDragFocus=e=>{var t;null===(t=this.componentRef.current)||void 0===t||t.scrollTo(0,0);};}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return {x:0,y:0,width:0,height:0};const{x:t,y:n,width:o,height:r}=e.getBoundingClientRect();return {x:t,y:n,width:o,height:r}}componentDidUpdate(e){const{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){const{width:e,height:o}=this.getBox();e&&o&&n(l(t,e,o),c(t,e,o));}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect();}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,w),this.document.addEventListener("pointerup",this.onDocPointerDone,w),this.document.addEventListener("pointercancel",this.onDocPointerDone,w),this.docMoveBound=!0);}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,w),this.document.removeEventListener("pointerup",this.onDocPointerDone,w),this.document.removeEventListener("pointercancel",this.onDocPointerDone,w),this.docMoveBound=!1);}getCropStyle(){const{crop:e}=this.props;if(e)return {top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(),o=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return n.x=a(e.startCropX+o,0,t.width-n.width),n.y=a(e.startCropY+r,0,t.height-n.height),n}getPointRegion(e){const{evData:t}=this,n=t.clientX-e.x,o=t.clientY-e.y<t.startCropY;return n<t.startCropX?o?"nw":"sw":o?"ne":"se"}resizeCrop(){const{evData:e}=this,t=this.getBox(),{aspect:n=0,minWidth:o=0,minHeight:r=0,maxWidth:i,maxHeight:a}=this.props,h=this.getPointRegion(t),s=this.makePixelCrop(),d=e.ord?e.ord:h,c=e.clientX-e.startClientX,l=e.clientY-e.startClientY,g={unit:"px",x:0,y:0,width:0,height:0};"ne"===h?(g.x=e.startCropX,g.width=c,n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(l),g.y=e.startCropY-g.height)):"se"===h?(g.x=e.startCropX,g.y=e.startCropY,g.width=c,g.height=n?g.width/n:l):"sw"===h?(g.x=e.startCropX+c,g.y=e.startCropY,g.width=Math.abs(c),g.height=n?g.width/n:l):"nw"===h&&(g.x=e.startCropX+c,g.width=Math.abs(c),n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(l),g.y=e.startCropY+l));const w=p(g,n,h,t.width,t.height,o,r,i,a);return n||u.xyOrds.indexOf(d)>-1?(s.x=w.x,s.y=w.y,s.width=w.width,s.height=w.height):u.xOrds.indexOf(d)>-1?(s.x=w.x,s.width=w.width):u.yOrds.indexOf(d)>-1&&(s.y=w.y,s.height=w.height),s}createCropSelection(){const{ariaLabels:e=u.defaultProps.ariaLabels,disabled:n,locked:o,renderSelectionAddon:r,ruleOfThirds:i,crop:a}=this.props,h=this.getCropStyle();if(a)return t().createElement("div",{style:h,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!o&&t().createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t().createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),r&&t().createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:e=>e.stopPropagation()},r(this.state)),i&&t().createElement(t().Fragment,null,t().createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t().createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(){const e={...i,...this.props.crop||{}},t=this.getBox();return l(e,t.width,t.height)}render(){const{aspect:e,children:o,circularCrop:r,className:i,crop:a,disabled:h,locked:s,style:d,ruleOfThirds:c}=this.props,{cropIsActive:l,newCropIsBeingDrawn:p}=this.state,g=a?this.createCropSelection():null,w=function(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}("ReactCrop",i,{"ReactCrop--active":l,"ReactCrop--disabled":h,"ReactCrop--locked":s,"ReactCrop--new-crop":p,"ReactCrop--fixed-aspect":a&&e,"ReactCrop--circular-crop":a&&r,"ReactCrop--rule-of-thirds":a&&c,"ReactCrop--invisible-crop":!this.dragStarted&&a&&!a.width&&!a.height});return t().createElement("div",{ref:this.componentRef,className:w,style:d},t().createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},o),g)}}u.xOrds=["e","w"],u.yOrds=["n","s"],u.xyOrds=["nw","ne","se","sw"],u.nudgeStep=1,u.nudgeStepMedium=10,u.nudgeStepLarge=100,u.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};})(),r})()));
|
|
3503
|
+
!function(e,t){module.exports=t(require$$0);}(commonjsGlobal,(e=>(()=>{var t={899:t=>{t.exports=e;}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]});},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});};var r={};return (()=>{o.r(r),o.d(r,{Component:()=>u,areCropsEqual:()=>h,centerCrop:()=>d,clamp:()=>a,containCrop:()=>p,convertToPercentCrop:()=>c,convertToPixelCrop:()=>l,default:()=>u,defaultCrop:()=>i,makeAspectCrop:()=>s,nudgeCrop:()=>g});var e=o(899),t=o.n(e);function n(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=n(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const i={x:0,y:0,width:0,height:0,unit:"px"};function a(e,t,n){return Math.min(Math.max(e,t),n)}function h(e,t){return e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit}function s(e,t,n,o){const r=l(e,n,o);return e.width&&(r.height=r.width/t),e.height&&(r.width=r.height*t),r.y+r.height>o&&(r.height=o-r.y,r.width=r.height*t),r.x+r.width>n&&(r.width=n-r.x,r.height=r.width/t),"%"===e.unit?c(r,n,o):r}function d(e,t,n){const o=l(e,t,n);return o.x=(t-o.width)/2,o.y=(n-o.height)/2,"%"===e.unit?c(o,t,n):o}function c(e,t,n){return "%"===e.unit?{...i,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function l(e,t,n){return e.unit?"px"===e.unit?{...i,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...i,...e,unit:"px"}}function p(e,t,n,o,r,i=0,a=0,h=o,s=r){const d={...e};let c=Math.min(i,o),l=Math.min(a,r),p=Math.min(h,o),g=Math.min(s,r);t&&(t>1?(c=a?a*t:c,l=c/t,p=h*t):(l=i?i/t:l,c=l*t,g=s/t)),d.y<0&&(d.height=Math.max(d.height+d.y,l),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,c),d.x=0);const w=o-(d.x+d.width);w<0&&(d.x=Math.min(d.x,o-c),d.width+=w);const u=r-(d.y+d.height);if(u<0&&(d.y=Math.min(d.y,r-l),d.height+=u),d.width<c&&("sw"!==n&&"nw"!=n||(d.x-=c-d.width),d.width=c),d.height<l&&("nw"!==n&&"ne"!=n||(d.y-=l-d.height),d.height=l),d.width>p&&("sw"!==n&&"nw"!=n||(d.x-=p-d.width),d.width=p),d.height>g&&("nw"!==n&&"ne"!=n||(d.y-=g-d.height),d.height=g),t){const e=d.width/d.height;if(e<t){const e=Math.max(d.width/t,l);"nw"!==n&&"ne"!=n||(d.y-=e-d.height),d.height=e;}else if(e>t){const e=Math.max(d.height*t,c);"sw"!==n&&"nw"!=n||(d.x-=e-d.width),d.width=e;}}return d}function g(e,t,n,o){const r={...e};return "ArrowLeft"===t?"nw"===o?(r.x-=n,r.y-=n,r.width+=n,r.height+=n):"w"===o?(r.x-=n,r.width+=n):"sw"===o?(r.x-=n,r.width+=n,r.height+=n):"ne"===o?(r.y+=n,r.width-=n,r.height-=n):"e"===o?r.width-=n:"se"===o&&(r.width-=n,r.height-=n):"ArrowRight"===t&&("nw"===o?(r.x+=n,r.y+=n,r.width-=n,r.height-=n):"w"===o?(r.x+=n,r.width-=n):"sw"===o?(r.x+=n,r.width-=n,r.height-=n):"ne"===o?(r.y-=n,r.width+=n,r.height+=n):"e"===o?r.width+=n:"se"===o&&(r.width+=n,r.height+=n)),"ArrowUp"===t?"nw"===o?(r.x-=n,r.y-=n,r.width+=n,r.height+=n):"n"===o?(r.y-=n,r.height+=n):"ne"===o?(r.y-=n,r.width+=n,r.height+=n):"sw"===o?(r.x+=n,r.width-=n,r.height-=n):"s"===o?r.height-=n:"se"===o&&(r.width-=n,r.height-=n):"ArrowDown"===t&&("nw"===o?(r.x+=n,r.y+=n,r.width-=n,r.height-=n):"n"===o?(r.y+=n,r.height-=n):"ne"===o?(r.y+=n,r.width-=n,r.height-=n):"sw"===o?(r.x-=n,r.width+=n,r.height+=n):"s"===o?r.height+=n:"se"===o&&(r.width+=n,r.height+=n)),r}const w={capture:!0,passive:!1};class u extends e.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=(0, e.createRef)(),this.mediaRef=(0, e.createRef)(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{const{crop:t,disabled:n}=this.props,o=this.getBox();if(!t)return;const r=l(t,o.width,o.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const i=e.target.dataset.ord,a=Boolean(i);let h=e.clientX,s=e.clientY,d=r.x,c=r.y;if(i){const t=e.clientX-o.x,n=e.clientY-o.y;let a=0,l=0;"ne"===i||"e"==i?(a=t-(r.x+r.width),l=n-r.y,d=r.x,c=r.y+r.height):"se"===i||"s"===i?(a=t-(r.x+r.width),l=n-(r.y+r.height),d=r.x,c=r.y):"sw"===i||"w"==i?(a=t-r.x,l=n-(r.y+r.height),d=r.x+r.width,c=r.y):"nw"!==i&&"n"!=i||(a=t-r.x,l=n-r.y,d=r.x+r.width,c=r.y+r.height),h=d+o.x+a,s=c+o.y+l;}this.evData={startClientX:h,startClientY:s,startCropX:d,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:i},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0});},this.onComponentPointerDown=e=>{const{crop:t,disabled:n,locked:o,keepSelection:r,onChange:i}=this.props,a=this.getBox();if(n||o||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=e.clientX-a.x,s=e.clientY-a.y,d={unit:"px",x:h,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,i(l(d,a.width,a.height),c(d,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0});},this.onDocPointerMove=e=>{const{crop:t,disabled:n,onChange:o,onDragStart:r}=this.props,i=this.getBox();if(n||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,r&&r(e));const{evData:a}=this;let s;a.clientX=e.clientX,a.clientY=e.clientY,s=a.isResize?this.resizeCrop():this.dragCrop(),h(t,s)||o(l(s,i.width,i.height),c(s,i.width,i.height));},this.onComponentKeyDown=e=>{const{crop:t,disabled:n,onChange:o,onComplete:r}=this.props,i=this.getBox();if(n)return;const h=e.key;let s=!1;if(!t)return;const d=this.makePixelCrop(),p=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?u.nudgeStepLarge:e.shiftKey?u.nudgeStepMedium:u.nudgeStep;if("ArrowLeft"===h?(d.x-=p,s=!0):"ArrowRight"===h?(d.x+=p,s=!0):"ArrowUp"===h?(d.y-=p,s=!0):"ArrowDown"===h&&(d.y+=p,s=!0),s){e.cancelable&&e.preventDefault(),d.x=a(d.x,0,i.width-d.width),d.y=a(d.y,0,i.height-d.height);const t=l(d,i.width,i.height),n=c(d,i.width,i.height);o(t,n),r&&r(t,n);}},this.onHandlerKeyDown=(e,t)=>{const{aspect:n=0,crop:o,disabled:r,minWidth:i=0,minHeight:a=0,maxWidth:s,maxHeight:d,onChange:w,onComplete:m}=this.props,y=this.getBox();if(r||!o)return;if("ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.stopPropagation(),e.preventDefault();const x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?u.nudgeStepLarge:e.shiftKey?u.nudgeStepMedium:u.nudgeStep,C=p(g(l(o,y.width,y.height),e.key,x,t),n,t,y.width,y.height,i,a,s,d);if(!h(o,C)){const e=c(C,y.width,y.height);w(C,e),m&&m(C,e);}},this.onDocPointerDone=e=>{const{crop:t,disabled:n,onComplete:o,onDragEnd:r}=this.props,i=this.getBox();this.unbindDocMove(),!n&&t&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),o&&o(l(t,i.width,i.height),c(t,i.width,i.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}));},this.onDragFocus=e=>{var t;null===(t=this.componentRef.current)||void 0===t||t.scrollTo(0,0);};}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return {x:0,y:0,width:0,height:0};const{x:t,y:n,width:o,height:r}=e.getBoundingClientRect();return {x:t,y:n,width:o,height:r}}componentDidUpdate(e){const{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){const{width:e,height:o}=this.getBox();e&&o&&n(l(t,e,o),c(t,e,o));}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect();}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,w),this.document.addEventListener("pointerup",this.onDocPointerDone,w),this.document.addEventListener("pointercancel",this.onDocPointerDone,w),this.docMoveBound=!0);}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,w),this.document.removeEventListener("pointerup",this.onDocPointerDone,w),this.document.removeEventListener("pointercancel",this.onDocPointerDone,w),this.docMoveBound=!1);}getCropStyle(){const{crop:e}=this.props;if(e)return {top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(),o=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return n.x=a(e.startCropX+o,0,t.width-n.width),n.y=a(e.startCropY+r,0,t.height-n.height),n}getPointRegion(e){const{evData:t}=this,n=t.clientX-e.x,o=t.clientY-e.y<t.startCropY;return n<t.startCropX?o?"nw":"sw":o?"ne":"se"}resizeCrop(){const{evData:e}=this,t=this.getBox(),{aspect:n=0,minWidth:o=0,minHeight:r=0,maxWidth:i,maxHeight:a}=this.props,h=this.getPointRegion(t),s=this.makePixelCrop(),d=e.ord?e.ord:h,c=e.clientX-e.startClientX,l=e.clientY-e.startClientY,g={unit:"px",x:0,y:0,width:0,height:0};"ne"===h?(g.x=e.startCropX,g.width=c,n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(l),g.y=e.startCropY-g.height)):"se"===h?(g.x=e.startCropX,g.y=e.startCropY,g.width=c,g.height=n?g.width/n:l):"sw"===h?(g.x=e.startCropX+c,g.y=e.startCropY,g.width=Math.abs(c),g.height=n?g.width/n:l):"nw"===h&&(g.x=e.startCropX+c,g.width=Math.abs(c),n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(l),g.y=e.startCropY+l));const w=p(g,n,h,t.width,t.height,o,r,i,a);return n||u.xyOrds.indexOf(d)>-1?(s.x=w.x,s.y=w.y,s.width=w.width,s.height=w.height):u.xOrds.indexOf(d)>-1?(s.x=w.x,s.width=w.width):u.yOrds.indexOf(d)>-1&&(s.y=w.y,s.height=w.height),s}createCropSelection(){const{ariaLabels:e=u.defaultProps.ariaLabels,disabled:n,locked:o,renderSelectionAddon:r,ruleOfThirds:i,crop:a}=this.props,h=this.getCropStyle();if(a)return t().createElement("div",{style:h,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!o&&t().createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t().createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),r&&t().createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:e=>e.stopPropagation()},r(this.state)),i&&t().createElement(t().Fragment,null,t().createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t().createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(){const e={...i,...this.props.crop||{}},t=this.getBox();return l(e,t.width,t.height)}render(){const{aspect:e,children:o,circularCrop:r,className:i,crop:a,disabled:h,locked:s,style:d,ruleOfThirds:c}=this.props,{cropIsActive:l,newCropIsBeingDrawn:p}=this.state,g=a?this.createCropSelection():null,w=function(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}("ReactCrop",i,{"ReactCrop--active":l,"ReactCrop--disabled":h,"ReactCrop--locked":s,"ReactCrop--new-crop":p,"ReactCrop--fixed-aspect":a&&e,"ReactCrop--circular-crop":a&&r,"ReactCrop--rule-of-thirds":a&&c,"ReactCrop--invisible-crop":!this.dragStarted&&a&&!a.width&&!a.height});return t().createElement("div",{ref:this.componentRef,className:w,style:d},t().createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},o),g)}}u.xOrds=["e","w"],u.yOrds=["n","s"],u.xyOrds=["nw","ne","se","sw"],u.nudgeStep=1,u.nudgeStepMedium=10,u.nudgeStepLarge=100,u.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};})(),r})()));
|
|
3496
3504
|
} (ReactCrop_min, ReactCrop_min.exports));
|
|
3497
3505
|
|
|
3498
3506
|
var ReactCrop_minExports = ReactCrop_min.exports;
|
|
@@ -3505,8 +3513,12 @@ var developmentApi = {
|
|
|
3505
3513
|
cropImage: cropImage
|
|
3506
3514
|
};
|
|
3507
3515
|
|
|
3516
|
+
function ownKeys$4(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3517
|
+
function _objectSpread$4(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$4(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$4(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3508
3518
|
var useCropImage = function useCropImage(options) {
|
|
3509
|
-
return useMutation(
|
|
3519
|
+
return useMutation(_objectSpread$4({
|
|
3520
|
+
mutationFn: developmentApi.cropImage
|
|
3521
|
+
}, options));
|
|
3510
3522
|
};
|
|
3511
3523
|
|
|
3512
3524
|
var useImageControls = function useImageControls(_ref) {
|
|
@@ -3535,17 +3547,18 @@ var useImageControls = function useImageControls(_ref) {
|
|
|
3535
3547
|
}
|
|
3536
3548
|
};
|
|
3537
3549
|
var handleWidthChange = function handleWidthChange(width) {
|
|
3538
|
-
var
|
|
3539
|
-
|
|
3550
|
+
var cropWidth = Number(width);
|
|
3551
|
+
var displayWidth = cropWidth * imageRef.current.width / imageRef.current.naturalWidth;
|
|
3552
|
+
if (displayWidth > 0 && Math.trunc(crop.x) + displayWidth <= imageRef.current.width) {
|
|
3540
3553
|
if (isAspectRatioLocked) {
|
|
3541
|
-
var
|
|
3542
|
-
|
|
3543
|
-
width:
|
|
3544
|
-
height:
|
|
3554
|
+
var displayHeight = displayWidth / (aspectRatio.width / aspectRatio.height);
|
|
3555
|
+
displayHeight + Math.trunc(crop.y) <= imageRef.current.height && setCrop(mergeRight(crop, {
|
|
3556
|
+
width: displayWidth,
|
|
3557
|
+
height: displayHeight
|
|
3545
3558
|
}));
|
|
3546
3559
|
} else {
|
|
3547
3560
|
setCrop(mergeRight(crop, {
|
|
3548
|
-
width:
|
|
3561
|
+
width: displayWidth
|
|
3549
3562
|
}));
|
|
3550
3563
|
}
|
|
3551
3564
|
} else {
|
|
@@ -3553,17 +3566,18 @@ var useImageControls = function useImageControls(_ref) {
|
|
|
3553
3566
|
}
|
|
3554
3567
|
};
|
|
3555
3568
|
var handleHeightChange = function handleHeightChange(height) {
|
|
3556
|
-
var
|
|
3557
|
-
|
|
3569
|
+
var cropHeight = Number(height);
|
|
3570
|
+
var displayHeight = cropHeight * imageRef.current.height / imageRef.current.naturalHeight;
|
|
3571
|
+
if (displayHeight > 0 && Math.trunc(crop.y) + displayHeight <= imageRef.current.height) {
|
|
3558
3572
|
if (isAspectRatioLocked) {
|
|
3559
|
-
var
|
|
3560
|
-
|
|
3561
|
-
height:
|
|
3562
|
-
width:
|
|
3573
|
+
var displayWidth = displayHeight * aspectRatio.width / aspectRatio.height;
|
|
3574
|
+
displayWidth + Math.trunc(crop.x) <= imageRef.current.width && setCrop(mergeRight(crop, {
|
|
3575
|
+
height: displayHeight,
|
|
3576
|
+
width: displayWidth
|
|
3563
3577
|
}));
|
|
3564
3578
|
} else {
|
|
3565
3579
|
setCrop(mergeRight(crop, {
|
|
3566
|
-
height:
|
|
3580
|
+
height: displayHeight
|
|
3567
3581
|
}));
|
|
3568
3582
|
}
|
|
3569
3583
|
} else {
|
|
@@ -3634,11 +3648,19 @@ var Controls = function Controls(_ref) {
|
|
|
3634
3648
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls;
|
|
3635
3649
|
var _useTranslation = useTranslation(),
|
|
3636
3650
|
t = _useTranslation.t;
|
|
3637
|
-
var
|
|
3651
|
+
var getActualCropHeight = function getActualCropHeight(cropHeight) {
|
|
3652
|
+
var _imageRef$current, _imageRef$current2;
|
|
3653
|
+
return cropHeight * (((_imageRef$current = imageRef.current) === null || _imageRef$current === void 0 ? void 0 : _imageRef$current.naturalHeight) / ((_imageRef$current2 = imageRef.current) === null || _imageRef$current2 === void 0 ? void 0 : _imageRef$current2.height));
|
|
3654
|
+
};
|
|
3655
|
+
var getActualCropWidth = function getActualCropWidth(cropHeight) {
|
|
3656
|
+
var _imageRef$current3, _imageRef$current4;
|
|
3657
|
+
return cropHeight * (((_imageRef$current3 = imageRef.current) === null || _imageRef$current3 === void 0 ? void 0 : _imageRef$current3.naturalWidth) / ((_imageRef$current4 = imageRef.current) === null || _imageRef$current4 === void 0 ? void 0 : _imageRef$current4.width));
|
|
3658
|
+
};
|
|
3659
|
+
var _useState = useState(getActualCropHeight(crop.height)),
|
|
3638
3660
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
3639
3661
|
height = _useState2[0],
|
|
3640
3662
|
setHeight = _useState2[1];
|
|
3641
|
-
var _useState3 = useState(crop.width
|
|
3663
|
+
var _useState3 = useState(getActualCropWidth(crop.width)),
|
|
3642
3664
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
3643
3665
|
width = _useState4[0],
|
|
3644
3666
|
setWidth = _useState4[1];
|
|
@@ -3667,66 +3689,73 @@ var Controls = function Controls(_ref) {
|
|
|
3667
3689
|
handleWidthChange(debouncedWidth);
|
|
3668
3690
|
}, [debouncedWidth]);
|
|
3669
3691
|
useEffect(function () {
|
|
3670
|
-
setHeight(crop.height
|
|
3671
|
-
setWidth(crop.width
|
|
3692
|
+
setHeight(getActualCropHeight(crop.height));
|
|
3693
|
+
setWidth(getActualCropWidth(crop.width));
|
|
3672
3694
|
}, [crop]);
|
|
3673
|
-
return /*#__PURE__*/
|
|
3674
|
-
className: "flex flex-col p-4 md:w-2/6 "
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
|
|
3696
|
-
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3695
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3696
|
+
className: "flex flex-col p-4 md:w-2/6 ",
|
|
3697
|
+
children: [!hideControls && /*#__PURE__*/jsxs(Fragment$1, {
|
|
3698
|
+
children: [/*#__PURE__*/jsx(Switch, {
|
|
3699
|
+
checked: isFullImage,
|
|
3700
|
+
className: "flex-grow-0",
|
|
3701
|
+
label: t("neetoImageUploader.labels.selectOriginalImage"),
|
|
3702
|
+
onChange: function onChange() {
|
|
3703
|
+
return setIsFullImage(function (isFullImage) {
|
|
3704
|
+
return !isFullImage;
|
|
3705
|
+
});
|
|
3706
|
+
}
|
|
3707
|
+
}), /*#__PURE__*/jsx(Switch, {
|
|
3708
|
+
checked: isAspectRatioLocked,
|
|
3709
|
+
className: "mt-4 flex-grow-0",
|
|
3710
|
+
disabled: isFullImage,
|
|
3711
|
+
label: t("neetoImageUploader.labels.lockAspectRatio"),
|
|
3712
|
+
onChange: onToggleAspectRatioLock
|
|
3713
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
3714
|
+
className: "mb-2 mt-6",
|
|
3715
|
+
style: "body2",
|
|
3716
|
+
children: t("neetoImageUploader.imageEditor.aspectRatio")
|
|
3717
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
3718
|
+
className: "flex gap-4 self-start",
|
|
3719
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
3720
|
+
"data-cy": "aspect-ratio-width-input",
|
|
3721
|
+
disabled: isFullImage,
|
|
3722
|
+
size: "small",
|
|
3723
|
+
type: "number",
|
|
3724
|
+
value: aspectRatio.width,
|
|
3725
|
+
onChange: withEventTargetValue(handleAspectWidthChange)
|
|
3726
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
3727
|
+
children: " : "
|
|
3728
|
+
}), /*#__PURE__*/jsx(Input, {
|
|
3729
|
+
"data-cy": "aspect-ratio-height-input",
|
|
3730
|
+
disabled: isFullImage,
|
|
3731
|
+
size: "small",
|
|
3732
|
+
type: "number",
|
|
3733
|
+
value: aspectRatio.height,
|
|
3734
|
+
onChange: withEventTargetValue(handleAspectHeightChange)
|
|
3735
|
+
})]
|
|
3736
|
+
})]
|
|
3737
|
+
}), /*#__PURE__*/jsx(Input, {
|
|
3738
|
+
className: "mt-4 flex-grow-0",
|
|
3739
|
+
disabled: isFullImage,
|
|
3740
|
+
label: t("neetoImageUploader.labels.width"),
|
|
3741
|
+
type: "number",
|
|
3742
|
+
value: Math.round(width),
|
|
3743
|
+
onChange: withEventTargetValue(setWidth)
|
|
3744
|
+
}), /*#__PURE__*/jsx(Input, {
|
|
3745
|
+
className: "mt-4 flex-grow-0",
|
|
3746
|
+
disabled: isFullImage,
|
|
3747
|
+
label: t("neetoImageUploader.labels.height"),
|
|
3748
|
+
type: "number",
|
|
3749
|
+
value: Math.round(height),
|
|
3750
|
+
onChange: withEventTargetValue(setHeight)
|
|
3751
|
+
}), /*#__PURE__*/jsx(Button, {
|
|
3752
|
+
className: "mt-6 self-start",
|
|
3753
|
+
"data-cy": "neeto-image-uploader-crop-submit-button",
|
|
3754
|
+
label: t("neetoImageUploader.labels.done"),
|
|
3755
|
+
disabled: isNilOrEmpty(imageRef.current) && (crop.width <= 0 || crop.height <= 0),
|
|
3756
|
+
onClick: handleSubmit
|
|
3757
|
+
})]
|
|
3758
|
+
});
|
|
3730
3759
|
};
|
|
3731
3760
|
|
|
3732
3761
|
var ImageEditor = function ImageEditor(_ref) {
|
|
@@ -3797,57 +3826,61 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
3797
3826
|
url: newURL
|
|
3798
3827
|
}));
|
|
3799
3828
|
};
|
|
3800
|
-
return /*#__PURE__*/
|
|
3801
|
-
className: "flex h-full flex-col gap-4 px-8 py-12"
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3829
|
+
return /*#__PURE__*/jsxs("div", {
|
|
3830
|
+
className: "flex h-full flex-col gap-4 px-8 py-12",
|
|
3831
|
+
children: [/*#__PURE__*/jsx(Button, {
|
|
3832
|
+
className: "self-start",
|
|
3833
|
+
"data-cy": "image-editor-back-button",
|
|
3834
|
+
icon: LeftArrow,
|
|
3835
|
+
iconPosition: "left",
|
|
3836
|
+
style: "text",
|
|
3837
|
+
onClick: handleReset
|
|
3838
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
3839
|
+
className: "flex h-full w-full flex-col gap-2 overflow-y-scroll md:flex-row md:overflow-y-auto",
|
|
3840
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
3841
|
+
id: "imageEditor",
|
|
3842
|
+
ref: wrapperRef,
|
|
3843
|
+
className: classnames("flex", "h-full w-full md:w-4/6", "justify-around", "neeto-ui-bg-gray-200", {
|
|
3844
|
+
"items-center": isItemsCenter({
|
|
3845
|
+
wrapperRef: wrapperRef,
|
|
3846
|
+
imageRef: imageRef
|
|
3847
|
+
})
|
|
3848
|
+
}),
|
|
3849
|
+
children: /*#__PURE__*/jsx(ReactCrop, {
|
|
3850
|
+
crop: isFullImage ? null : crop,
|
|
3851
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
3852
|
+
aspect: isAspectRatioLocked ? aspectRatio.width / aspectRatio.height : 0,
|
|
3853
|
+
onChange: setCrop,
|
|
3854
|
+
onComplete: setCrop,
|
|
3855
|
+
children: /*#__PURE__*/jsx("img", {
|
|
3856
|
+
alt: t("neetoImageUploader.common.image"),
|
|
3857
|
+
"data-cy": "image-editor-uploaded-image",
|
|
3858
|
+
ref: imageRef,
|
|
3859
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
3860
|
+
onLoad: function onLoad(e) {
|
|
3861
|
+
return onImageLoaded({
|
|
3862
|
+
image: e.target,
|
|
3863
|
+
setCrop: setCrop,
|
|
3864
|
+
cropAspectRatio: cropAspectRatio
|
|
3865
|
+
});
|
|
3866
|
+
}
|
|
3867
|
+
})
|
|
3868
|
+
})
|
|
3869
|
+
}), /*#__PURE__*/jsx(Controls, {
|
|
3870
|
+
aspectRatio: aspectRatio,
|
|
3871
|
+
crop: crop,
|
|
3872
|
+
handleSubmit: handleSubmit,
|
|
3873
|
+
imageRef: imageRef,
|
|
3874
|
+
isAspectRatioLocked: isAspectRatioLocked,
|
|
3875
|
+
isFullImage: isFullImage,
|
|
3876
|
+
setAspectRatio: setAspectRatio,
|
|
3834
3877
|
setCrop: setCrop,
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
handleSubmit: handleSubmit,
|
|
3842
|
-
imageRef: imageRef,
|
|
3843
|
-
isAspectRatioLocked: isAspectRatioLocked,
|
|
3844
|
-
isFullImage: isFullImage,
|
|
3845
|
-
setAspectRatio: setAspectRatio,
|
|
3846
|
-
setCrop: setCrop,
|
|
3847
|
-
setIsFullImage: setIsFullImage,
|
|
3848
|
-
hideControls: isPresent(fixedAspectRatio),
|
|
3849
|
-
setAspectRatioLocked: setIsAspectRatioLocked
|
|
3850
|
-
})));
|
|
3878
|
+
setIsFullImage: setIsFullImage,
|
|
3879
|
+
hideControls: isPresent(fixedAspectRatio),
|
|
3880
|
+
setAspectRatioLocked: setIsAspectRatioLocked
|
|
3881
|
+
})]
|
|
3882
|
+
})]
|
|
3883
|
+
});
|
|
3851
3884
|
};
|
|
3852
3885
|
|
|
3853
3886
|
var fetch = function fetch(_ref) {
|
|
@@ -3867,20 +3900,24 @@ var imagesApi = {
|
|
|
3867
3900
|
fetch: fetch
|
|
3868
3901
|
};
|
|
3869
3902
|
|
|
3903
|
+
function ownKeys$3(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3904
|
+
function _objectSpread$3(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$3(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$3(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
3870
3905
|
var useFetchAssets = function useFetchAssets(_ref) {
|
|
3871
3906
|
var searchTerm = _ref.searchTerm,
|
|
3872
3907
|
url = _ref.url,
|
|
3873
3908
|
page = _ref.page,
|
|
3874
3909
|
per = _ref.per;
|
|
3875
3910
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3876
|
-
return useQuery(
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3911
|
+
return useQuery(_objectSpread$3({
|
|
3912
|
+
queryKey: [QUERY_KEYS.ASSETS_LIST],
|
|
3913
|
+
queryFn: function queryFn() {
|
|
3914
|
+
return imagesApi.fetch({
|
|
3915
|
+
searchTerm: searchTerm,
|
|
3916
|
+
url: url,
|
|
3917
|
+
page: page,
|
|
3918
|
+
per: per
|
|
3919
|
+
});
|
|
3920
|
+
},
|
|
3884
3921
|
staleTime: ASSETS_STALE_TIME
|
|
3885
3922
|
}, options));
|
|
3886
3923
|
};
|
|
@@ -4181,7 +4218,7 @@ InfiniteScroll.exports;
|
|
|
4181
4218
|
|
|
4182
4219
|
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
4183
4220
|
|
|
4184
|
-
var _react =
|
|
4221
|
+
var _react = require$$0;
|
|
4185
4222
|
|
|
4186
4223
|
var _react2 = _interopRequireDefault(_react);
|
|
4187
4224
|
|
|
@@ -4486,7 +4523,7 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
4486
4523
|
|
|
4487
4524
|
var _class, _temp2;
|
|
4488
4525
|
|
|
4489
|
-
var _react =
|
|
4526
|
+
var _react = require$$0;
|
|
4490
4527
|
|
|
4491
4528
|
var _react2 = _interopRequireDefault(_react);
|
|
4492
4529
|
|
|
@@ -4656,53 +4693,61 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
4656
4693
|
handleUnsplashImageSelect = _ref$handleUnsplashIm === void 0 ? noop$1 : _ref$handleUnsplashIm;
|
|
4657
4694
|
var _useTranslation = useTranslation(),
|
|
4658
4695
|
t = _useTranslation.t;
|
|
4659
|
-
var Loader = /*#__PURE__*/
|
|
4660
|
-
className: "flex justify-center"
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4696
|
+
var Loader = /*#__PURE__*/jsx("div", {
|
|
4697
|
+
className: "flex justify-center",
|
|
4698
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
4699
|
+
});
|
|
4700
|
+
return /*#__PURE__*/jsx("div", {
|
|
4701
|
+
className: "niu-unsplash-container mr-2 max-w-full overflow-x-hidden overflow-y-scroll",
|
|
4702
|
+
children: /*#__PURE__*/jsx(_default, {
|
|
4703
|
+
hasMore: hasMore,
|
|
4704
|
+
loadMore: loadMore,
|
|
4705
|
+
pack: true,
|
|
4706
|
+
position: true,
|
|
4707
|
+
className: "w-full",
|
|
4708
|
+
loader: Loader,
|
|
4709
|
+
sizes: INFINITE_SCROLLER_SIZES,
|
|
4710
|
+
style: INFINITE_SCROLLER_STYLE,
|
|
4711
|
+
useWindow: false,
|
|
4712
|
+
children: images.map(function (image, index) {
|
|
4713
|
+
var _image$urls, _image$user, _image$user2;
|
|
4714
|
+
return /*#__PURE__*/jsx("div", {
|
|
4715
|
+
className: "float-left w-1/2 pb-4 pr-4 md:w-1/4",
|
|
4716
|
+
children: /*#__PURE__*/jsx("div", {
|
|
4717
|
+
className: "relative w-full",
|
|
4718
|
+
style: {
|
|
4719
|
+
paddingBottom: "".concat(image.height / image.width * 100, "%")
|
|
4720
|
+
},
|
|
4721
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
4722
|
+
className: "neeto-ui-rounded-sm neeto-ui-bg-gray-100 group absolute h-full w-full",
|
|
4723
|
+
id: "unsplashImage".concat(image.id),
|
|
4724
|
+
children: [tab === TABS[1].key && /*#__PURE__*/jsxs(Fragment$1, {
|
|
4725
|
+
children: [/*#__PURE__*/jsx("img", {
|
|
4726
|
+
"data-cy": "niu-unsplash-image-".concat(index),
|
|
4727
|
+
src: image === null || image === void 0 || (_image$urls = image.urls) === null || _image$urls === void 0 ? void 0 : _image$urls.regular,
|
|
4728
|
+
onClick: function onClick() {
|
|
4729
|
+
return handleUnsplashImageSelect(image);
|
|
4730
|
+
}
|
|
4731
|
+
}), /*#__PURE__*/jsxs("a", {
|
|
4732
|
+
className: "neeto-ui-text-gray-100 absolute bottom-2 left-2 m-auto text-xs underline opacity-0 group-hover:opacity-100",
|
|
4733
|
+
href: "https://unsplash.com/@".concat(image === null || image === void 0 || (_image$user = image.user) === null || _image$user === void 0 ? void 0 : _image$user.username),
|
|
4734
|
+
rel: "noreferrer",
|
|
4735
|
+
target: "_blank",
|
|
4736
|
+
children: [image === null || image === void 0 || (_image$user2 = image.user) === null || _image$user2 === void 0 ? void 0 : _image$user2.name, " | ", " ", t("neetoImageUploader.labels.unsplash")]
|
|
4737
|
+
})]
|
|
4738
|
+
}), tab === TABS[0].key && /*#__PURE__*/jsx("img", {
|
|
4739
|
+
"data-cy": "niu-library-image-".concat(index),
|
|
4740
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
4741
|
+
onClick: function onClick() {
|
|
4742
|
+
return setSelectedImage(image);
|
|
4743
|
+
}
|
|
4744
|
+
})]
|
|
4745
|
+
})
|
|
4746
|
+
})
|
|
4747
|
+
}, image.id);
|
|
4748
|
+
})
|
|
4749
|
+
})
|
|
4750
|
+
});
|
|
4706
4751
|
};
|
|
4707
4752
|
|
|
4708
4753
|
var Images = function Images(_ref) {
|
|
@@ -4763,12 +4808,13 @@ var Images = function Images(_ref) {
|
|
|
4763
4808
|
refetch();
|
|
4764
4809
|
}, [debouncedQuery]);
|
|
4765
4810
|
if (error) {
|
|
4766
|
-
return /*#__PURE__*/
|
|
4811
|
+
return /*#__PURE__*/jsx(Typography, {
|
|
4767
4812
|
className: "mt-9 flex justify-center",
|
|
4768
|
-
style: "body2"
|
|
4769
|
-
|
|
4813
|
+
style: "body2",
|
|
4814
|
+
children: t("neetoImageUploader.unsplash.errorMessage")
|
|
4815
|
+
});
|
|
4770
4816
|
}
|
|
4771
|
-
return /*#__PURE__*/
|
|
4817
|
+
return /*#__PURE__*/jsx(InfiniteScroller, {
|
|
4772
4818
|
hasMore: hasMore,
|
|
4773
4819
|
images: images,
|
|
4774
4820
|
loadMore: loadMore,
|
|
@@ -4798,17 +4844,21 @@ var unsplashApi = {
|
|
|
4798
4844
|
getUnsplashImage: getUnsplashImage
|
|
4799
4845
|
};
|
|
4800
4846
|
|
|
4847
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
4848
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4801
4849
|
var UNSPLASH_LIST = QUERY_KEYS.UNSPLASH_LIST;
|
|
4802
4850
|
var useFetchUnsplashImages = function useFetchUnsplashImages(_ref) {
|
|
4803
4851
|
var pageNo = _ref.pageNo,
|
|
4804
4852
|
query = _ref.query;
|
|
4805
4853
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4806
|
-
return useQuery(
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4854
|
+
return useQuery(_objectSpread$2({
|
|
4855
|
+
queryKey: [UNSPLASH_LIST],
|
|
4856
|
+
queryFn: function queryFn() {
|
|
4857
|
+
return unsplashApi.searchUnsplashImages({
|
|
4858
|
+
pageNo: pageNo,
|
|
4859
|
+
query: query
|
|
4860
|
+
});
|
|
4861
|
+
},
|
|
4812
4862
|
staleTime: UNSPLASH_STALE_TIME
|
|
4813
4863
|
}, options));
|
|
4814
4864
|
};
|
|
@@ -4969,12 +5019,13 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
4969
5019
|
refetch();
|
|
4970
5020
|
}, [debouncedQuery]);
|
|
4971
5021
|
if (error) {
|
|
4972
|
-
return /*#__PURE__*/
|
|
5022
|
+
return /*#__PURE__*/jsx(Typography, {
|
|
4973
5023
|
className: "mt-9 flex justify-center",
|
|
4974
|
-
style: "body2"
|
|
4975
|
-
|
|
5024
|
+
style: "body2",
|
|
5025
|
+
children: t("neetoImageUploader.unsplash.errorMessage")
|
|
5026
|
+
});
|
|
4976
5027
|
}
|
|
4977
|
-
return /*#__PURE__*/
|
|
5028
|
+
return /*#__PURE__*/jsx(InfiniteScroller, {
|
|
4978
5029
|
handleUnsplashImageSelect: handleUnsplashImageSelect,
|
|
4979
5030
|
hasMore: hasMore,
|
|
4980
5031
|
images: images,
|
|
@@ -4999,33 +5050,36 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
4999
5050
|
useEffect(function () {
|
|
5000
5051
|
setQuery("");
|
|
5001
5052
|
}, [tab]);
|
|
5002
|
-
return /*#__PURE__*/
|
|
5003
|
-
className: "w-full pb-2 pl-6 pt-1"
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5053
|
+
return /*#__PURE__*/jsxs("div", {
|
|
5054
|
+
className: "w-full pb-2 pl-6 pt-1",
|
|
5055
|
+
children: [/*#__PURE__*/jsx(Input, {
|
|
5056
|
+
autoFocus: true,
|
|
5057
|
+
className: "mb-4 mr-6",
|
|
5058
|
+
"data-cy": "niu-unsplash-image-picker-search-input",
|
|
5059
|
+
name: "text",
|
|
5060
|
+
placeholder: inputPlaceHolder,
|
|
5061
|
+
value: query,
|
|
5062
|
+
onChange: function onChange(_ref2) {
|
|
5063
|
+
var value = _ref2.target.value;
|
|
5064
|
+
return setQuery(value);
|
|
5065
|
+
}
|
|
5066
|
+
}), tab === TABS[0].key ? /*#__PURE__*/jsx(Images, {
|
|
5067
|
+
debouncedQuery: debouncedQuery,
|
|
5068
|
+
query: query,
|
|
5069
|
+
setSelectedImage: setSelectedImage
|
|
5070
|
+
}) : /*#__PURE__*/jsx(UnsplashLibrary, {
|
|
5071
|
+
debouncedQuery: debouncedQuery,
|
|
5072
|
+
query: query,
|
|
5073
|
+
setActiveTab: setActiveTab,
|
|
5074
|
+
setIsUploading: setIsUploading,
|
|
5075
|
+
setSelectedImage: setSelectedImage
|
|
5076
|
+
})]
|
|
5077
|
+
});
|
|
5026
5078
|
};
|
|
5027
5079
|
|
|
5028
5080
|
var _excluded$1 = ["key"];
|
|
5081
|
+
function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5082
|
+
function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5029
5083
|
var Modal = function Modal(_ref) {
|
|
5030
5084
|
var isOpen = _ref.isOpen,
|
|
5031
5085
|
_ref$onClose = _ref.onClose,
|
|
@@ -5108,79 +5162,99 @@ var Modal = function Modal(_ref) {
|
|
|
5108
5162
|
useEffect(function () {
|
|
5109
5163
|
setActiveTab(TABS[0].key);
|
|
5110
5164
|
}, [isOpen]);
|
|
5111
|
-
return /*#__PURE__*/
|
|
5165
|
+
return /*#__PURE__*/jsxs(NeetoUIModal, {
|
|
5112
5166
|
isOpen: isOpen,
|
|
5113
5167
|
className: "niu-modal",
|
|
5114
5168
|
size: "large",
|
|
5115
|
-
onClose: handleCloseModal
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
return setSelectedImage({});
|
|
5125
|
-
},
|
|
5126
|
-
image: selectedImage,
|
|
5127
|
-
signedId: selectedImage === null || selectedImage === void 0 ? void 0 : selectedImage.signedId
|
|
5128
|
-
}) : /*#__PURE__*/React.createElement("div", _extends$1({
|
|
5129
|
-
className: "h-full flex-col"
|
|
5130
|
-
}, getRootProps({
|
|
5131
|
-
onClick: function onClick(event) {
|
|
5132
|
-
return event.stopPropagation();
|
|
5133
|
-
}
|
|
5134
|
-
})), /*#__PURE__*/React.createElement(Modal$1.Header, null, /*#__PURE__*/React.createElement(Typography, {
|
|
5135
|
-
style: "h2"
|
|
5136
|
-
}, t("neetoImageUploader.common.imageLibrary"))), /*#__PURE__*/React.createElement("div", {
|
|
5137
|
-
className: "px-6 py-2"
|
|
5138
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
5139
|
-
className: "flex flex-col items-center justify-between gap-2 sm:flex-row"
|
|
5140
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
5141
|
-
className: "flex gap-2"
|
|
5142
|
-
}, /*#__PURE__*/React.createElement(Tab, {
|
|
5143
|
-
size: "small"
|
|
5144
|
-
}, TABS.map(function (tab) {
|
|
5145
|
-
return /*#__PURE__*/React.createElement(Tab.Item, {
|
|
5146
|
-
active: activeTab === tab.key,
|
|
5147
|
-
"data-cy": tab.dataCy,
|
|
5148
|
-
key: tab.key,
|
|
5149
|
-
onClick: function onClick() {
|
|
5150
|
-
return setActiveTab(tab.key);
|
|
5151
|
-
}
|
|
5152
|
-
}, tab.label);
|
|
5153
|
-
}))), /*#__PURE__*/React.createElement("div", {
|
|
5154
|
-
className: "flex gap-2"
|
|
5155
|
-
}, options.map(function (_ref2) {
|
|
5156
|
-
var key = _ref2.key,
|
|
5157
|
-
otherProps = _objectWithoutProperties$2(_ref2, _excluded$1);
|
|
5158
|
-
return /*#__PURE__*/React.createElement(Button, _extends$1({}, otherProps, {
|
|
5159
|
-
key: key,
|
|
5160
|
-
size: "small"
|
|
5161
|
-
}));
|
|
5162
|
-
})))), /*#__PURE__*/React.createElement(ImageLibrary, {
|
|
5163
|
-
setActiveTab: setActiveTab,
|
|
5164
|
-
setIsUploading: setIsUploading,
|
|
5165
|
-
setSelectedImage: setSelectedImage,
|
|
5166
|
-
tab: activeTab
|
|
5167
|
-
}), equals(activeTab, TABS[1].key) && /*#__PURE__*/React.createElement(Modal$1.Footer, {
|
|
5168
|
-
className: "flex items-center justify-center gap-2"
|
|
5169
|
-
}, /*#__PURE__*/React.createElement(Typography, {
|
|
5170
|
-
style: "body2"
|
|
5171
|
-
}, /*#__PURE__*/React.createElement(Trans, {
|
|
5172
|
-
i18nKey: "neetoImageUploader.unsplash.poweredByUnsplash",
|
|
5173
|
-
components: {
|
|
5174
|
-
a: /*#__PURE__*/React.createElement("a", {
|
|
5175
|
-
href: UNSPLASH_URL,
|
|
5176
|
-
rel: "noreferrer",
|
|
5177
|
-
target: "_blank"
|
|
5169
|
+
onClose: handleCloseModal,
|
|
5170
|
+
children: [isUploading && /*#__PURE__*/jsx("div", {
|
|
5171
|
+
className: "neeto-ui-bg-gray-400 absolute inset-0 z-50 flex h-full items-center justify-center opacity-50",
|
|
5172
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
5173
|
+
}), isNilOrEmpty(selectedImage) && isDragActive && /*#__PURE__*/jsx("div", _objectSpread$1(_objectSpread$1({
|
|
5174
|
+
className: "neeto-ui-rounded-xl neeto-ui-bg-gray-400 absolute flex h-full w-full flex-col items-center justify-around border-4 border-dashed border-gray-900 opacity-40"
|
|
5175
|
+
}, getRootProps()), {}, {
|
|
5176
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
5177
|
+
children: t("neetoImageUploader.common.dropHere")
|
|
5178
5178
|
})
|
|
5179
|
-
}
|
|
5180
|
-
|
|
5179
|
+
})), !isNilOrEmpty(selectedImage) ? /*#__PURE__*/jsx(ImageEditor, {
|
|
5180
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
5181
|
+
handleImageEditComplete: handleImageEditComplete,
|
|
5182
|
+
handleReset: function handleReset() {
|
|
5183
|
+
return setSelectedImage({});
|
|
5184
|
+
},
|
|
5185
|
+
image: selectedImage,
|
|
5186
|
+
signedId: selectedImage === null || selectedImage === void 0 ? void 0 : selectedImage.signedId
|
|
5187
|
+
}) : /*#__PURE__*/jsxs("div", _objectSpread$1(_objectSpread$1({
|
|
5188
|
+
className: "h-full flex-col"
|
|
5189
|
+
}, getRootProps({
|
|
5190
|
+
onClick: function onClick(event) {
|
|
5191
|
+
return event.stopPropagation();
|
|
5192
|
+
}
|
|
5193
|
+
})), {}, {
|
|
5194
|
+
children: [/*#__PURE__*/jsx(NeetoUIModal.Header, {
|
|
5195
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
5196
|
+
style: "h2",
|
|
5197
|
+
children: t("neetoImageUploader.common.imageLibrary")
|
|
5198
|
+
})
|
|
5199
|
+
}), /*#__PURE__*/jsx("div", {
|
|
5200
|
+
className: "px-6 py-2",
|
|
5201
|
+
children: /*#__PURE__*/jsxs("div", {
|
|
5202
|
+
className: "flex flex-col items-center justify-between gap-2 sm:flex-row",
|
|
5203
|
+
children: [/*#__PURE__*/jsx("div", {
|
|
5204
|
+
className: "flex gap-2",
|
|
5205
|
+
children: /*#__PURE__*/jsx(Tab, {
|
|
5206
|
+
size: "small",
|
|
5207
|
+
children: TABS.map(function (tab) {
|
|
5208
|
+
return /*#__PURE__*/jsx(Tab.Item, {
|
|
5209
|
+
active: activeTab === tab.key,
|
|
5210
|
+
"data-cy": tab.dataCy,
|
|
5211
|
+
onClick: function onClick() {
|
|
5212
|
+
return setActiveTab(tab.key);
|
|
5213
|
+
},
|
|
5214
|
+
children: tab.label
|
|
5215
|
+
}, tab.key);
|
|
5216
|
+
})
|
|
5217
|
+
})
|
|
5218
|
+
}), /*#__PURE__*/jsx("div", {
|
|
5219
|
+
className: "flex gap-2",
|
|
5220
|
+
children: options.map(function (_ref2) {
|
|
5221
|
+
var key = _ref2.key,
|
|
5222
|
+
otherProps = _objectWithoutProperties$2(_ref2, _excluded$1);
|
|
5223
|
+
return /*#__PURE__*/createElement(Button, _objectSpread$1(_objectSpread$1({}, otherProps), {}, {
|
|
5224
|
+
key: key,
|
|
5225
|
+
size: "small"
|
|
5226
|
+
}));
|
|
5227
|
+
})
|
|
5228
|
+
})]
|
|
5229
|
+
})
|
|
5230
|
+
}), /*#__PURE__*/jsx(ImageLibrary, {
|
|
5231
|
+
setActiveTab: setActiveTab,
|
|
5232
|
+
setIsUploading: setIsUploading,
|
|
5233
|
+
setSelectedImage: setSelectedImage,
|
|
5234
|
+
tab: activeTab
|
|
5235
|
+
}), equals(activeTab, TABS[1].key) && /*#__PURE__*/jsx(NeetoUIModal.Footer, {
|
|
5236
|
+
className: "flex items-center justify-center gap-2",
|
|
5237
|
+
children: /*#__PURE__*/jsx(Typography, {
|
|
5238
|
+
style: "body2",
|
|
5239
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
5240
|
+
i18nKey: "neetoImageUploader.unsplash.poweredByUnsplash",
|
|
5241
|
+
components: {
|
|
5242
|
+
a: /*#__PURE__*/jsx("a", {
|
|
5243
|
+
href: UNSPLASH_URL,
|
|
5244
|
+
rel: "noreferrer",
|
|
5245
|
+
target: "_blank"
|
|
5246
|
+
})
|
|
5247
|
+
}
|
|
5248
|
+
})
|
|
5249
|
+
})
|
|
5250
|
+
})]
|
|
5251
|
+
})), /*#__PURE__*/jsx("input", _objectSpread$1({}, getInputProps()))]
|
|
5252
|
+
});
|
|
5181
5253
|
};
|
|
5182
5254
|
|
|
5183
5255
|
var _excluded = ["key", "label"];
|
|
5256
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5257
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty$3(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
5184
5258
|
var Menu = Dropdown.Menu,
|
|
5185
5259
|
MenuItem = Dropdown.MenuItem;
|
|
5186
5260
|
var ImageUploader = function ImageUploader(_ref) {
|
|
@@ -5279,45 +5353,50 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
5279
5353
|
onClick: handleDelete,
|
|
5280
5354
|
"data-cy": "image-uploader-remove-button"
|
|
5281
5355
|
}];
|
|
5282
|
-
return /*#__PURE__*/
|
|
5356
|
+
return /*#__PURE__*/jsxs("div", {
|
|
5283
5357
|
className: classnames(className, {
|
|
5284
5358
|
"cursor-pointer": true
|
|
5285
|
-
})
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5359
|
+
}),
|
|
5360
|
+
children: [isNotNilOrEmpty(image.url) ? /*#__PURE__*/jsxs("div", {
|
|
5361
|
+
className: IMAGE_WRAPPER_CLASSNAME,
|
|
5362
|
+
"data-cy": "image-uploader-wrapper",
|
|
5363
|
+
children: [/*#__PURE__*/jsx(ImageWithFallback, {
|
|
5364
|
+
className: "h-full w-full",
|
|
5365
|
+
"data-cy": "uploaded-image",
|
|
5366
|
+
src: image.url
|
|
5367
|
+
}), /*#__PURE__*/jsx(Dropdown, {
|
|
5368
|
+
buttonProps: {
|
|
5369
|
+
className: "absolute right-3 top-3"
|
|
5370
|
+
},
|
|
5371
|
+
buttonSize: "small",
|
|
5372
|
+
buttonStyle: "primary",
|
|
5373
|
+
icon: MenuHorizontal,
|
|
5374
|
+
children: /*#__PURE__*/jsx(Menu, {
|
|
5375
|
+
children: options.map(function (_ref2) {
|
|
5376
|
+
var key = _ref2.key,
|
|
5377
|
+
label = _ref2.label,
|
|
5378
|
+
otherProps = _objectWithoutProperties$2(_ref2, _excluded);
|
|
5379
|
+
return /*#__PURE__*/createElement(MenuItem.Button, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
5380
|
+
key: key
|
|
5381
|
+
}), label);
|
|
5382
|
+
})
|
|
5383
|
+
})
|
|
5384
|
+
})]
|
|
5385
|
+
}) : /*#__PURE__*/jsx(ImageDirectUpload, {
|
|
5386
|
+
setIsAssetLibraryOpen: setIsAssetLibraryOpen,
|
|
5387
|
+
isDisabled: isPresent(fixedAspectRatio),
|
|
5388
|
+
uploadConfig: uploadConfigWithDefaults,
|
|
5389
|
+
onDrop: uploadFile
|
|
5390
|
+
}), /*#__PURE__*/jsx(Modal, {
|
|
5391
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
5392
|
+
isOpen: isAssetLibraryOpen,
|
|
5393
|
+
uploadConfig: uploadConfigWithDefaults,
|
|
5394
|
+
onClose: function onClose() {
|
|
5395
|
+
return setIsAssetLibraryOpen(false);
|
|
5396
|
+
},
|
|
5397
|
+
onUploadComplete: handleImageSelectionFromLibrary
|
|
5398
|
+
})]
|
|
5399
|
+
});
|
|
5321
5400
|
};
|
|
5322
5401
|
|
|
5323
5402
|
var useImageUpload = function useImageUpload() {
|