@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.cjs.js
CHANGED
|
@@ -2,48 +2,51 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var require$$0 = require('react');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
var neetoCist = require('@bigbinary/neeto-cist');
|
|
8
8
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
9
|
-
var
|
|
9
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
10
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
10
11
|
var ramda = require('ramda');
|
|
11
12
|
var reactI18next = require('react-i18next');
|
|
12
13
|
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
|
|
13
14
|
var i18next = require('i18next');
|
|
15
|
+
var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
16
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
17
|
+
var Dropdown = require('@bigbinary/neetoui/Dropdown');
|
|
18
|
+
var NeetoUIModal = require('@bigbinary/neetoui/Modal');
|
|
19
|
+
var Tab = require('@bigbinary/neetoui/Tab');
|
|
20
|
+
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
21
|
+
var reactQuery = require('@tanstack/react-query');
|
|
14
22
|
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
15
|
-
var reactQuery = require('react-query');
|
|
16
23
|
var axios = require('axios');
|
|
17
24
|
var activestorage = require('@rails/activestorage');
|
|
18
25
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
26
|
+
var Input = require('@bigbinary/neetoui/Input');
|
|
27
|
+
var Switch = require('@bigbinary/neetoui/Switch');
|
|
19
28
|
|
|
20
29
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
30
|
|
|
22
|
-
var
|
|
31
|
+
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
23
32
|
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
33
|
+
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
34
|
+
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
24
35
|
var i18next__default = /*#__PURE__*/_interopDefaultLegacy(i18next);
|
|
36
|
+
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
37
|
+
var Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(Dropdown);
|
|
38
|
+
var NeetoUIModal__default = /*#__PURE__*/_interopDefaultLegacy(NeetoUIModal);
|
|
39
|
+
var Tab__default = /*#__PURE__*/_interopDefaultLegacy(Tab);
|
|
40
|
+
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
25
41
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
42
|
+
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
43
|
+
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
26
44
|
|
|
27
45
|
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}}
|
|
28
46
|
|
|
29
47
|
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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9yZWFjdC1pbWFnZS1jcm9wL2Rpc3QvUmVhY3RDcm9wLmNzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX21vZGFsLnNjc3MiLCJhcHAvamF2YXNjcmlwdC9zdHlsZXNoZWV0cy9hcHBsaWNhdGlvbi5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaGVldHMvY29tcG9uZW50cy9faW1hZ2UtbGlicmFyeS5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3R5bGVzaG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lcjtcbiAgfVxufVxuIiwiJG5pdS1tb2RhbC13aWR0aDogOTV2dztcbiRuaXUtbW9kYWwtaGVpZ2h0OiA3NXZoO1xuJG5pdS1tb2RhbC1tYXgtd2lkdGg6IDExNTJweDtcbiRuaXUtbW9kYWwtbWF4LWhlaWdodDogNTc2cHg7XG4kbml1LW1vZGFsLWhlYWRlci1oZWlnaHQ6IDIyMHB4O1xuXG4kbml1LXVuc3BsYXNoLWNvbnRhaW5lci1tYXgtaGVpZ2h0OiAzNTVweDtcbiIsIi5SZWFjdENyb3Age1xuICAuUmVhY3RDcm9wX19jaGlsZC13cmFwcGVyIHtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBoZWlnaHQ6IDEwMCU7XG5cbiAgICBpbWcge1xuICAgICAgaGVpZ2h0OiBhdXRvO1xuICAgICAgd2lkdGg6IGF1dG87XG4gICAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgICBtYXgtaGVpZ2h0OiAxMDAlO1xuICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgfVxuICB9XG59XG4iXX0= */";
|
|
30
48
|
n(css,{});
|
|
31
49
|
|
|
32
|
-
function _extends$1() {
|
|
33
|
-
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
34
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
35
|
-
var source = arguments[i];
|
|
36
|
-
for (var key in source) {
|
|
37
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
38
|
-
target[key] = source[key];
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return target;
|
|
43
|
-
};
|
|
44
|
-
return _extends$1.apply(this, arguments);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
50
|
function _typeof$2(o) {
|
|
48
51
|
"@babel/helpers - typeof";
|
|
49
52
|
|
|
@@ -739,9 +742,9 @@ function _iterableToArray$1(iter) { if (typeof Symbol !== "undefined" && iter[Sy
|
|
|
739
742
|
|
|
740
743
|
function _arrayWithoutHoles$1(arr) { if (Array.isArray(arr)) return _arrayLikeToArray$1(arr); }
|
|
741
744
|
|
|
742
|
-
function ownKeys$
|
|
745
|
+
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; }
|
|
743
746
|
|
|
744
|
-
function _objectSpread$
|
|
747
|
+
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; }
|
|
745
748
|
|
|
746
749
|
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; }
|
|
747
750
|
|
|
@@ -958,7 +961,7 @@ function pickerOptionsFromAccept(accept) {
|
|
|
958
961
|
mimeType = _ref5[0],
|
|
959
962
|
ext = _ref5[1];
|
|
960
963
|
|
|
961
|
-
return _objectSpread$
|
|
964
|
+
return _objectSpread$b(_objectSpread$b({}, agg), {}, _defineProperty$2({}, mimeType, ext));
|
|
962
965
|
}, {});
|
|
963
966
|
return [{
|
|
964
967
|
// description is required due to https://crbug.com/1264708
|
|
@@ -1071,9 +1074,9 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
|
|
|
1071
1074
|
|
|
1072
1075
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
1073
1076
|
|
|
1074
|
-
function ownKeys$
|
|
1077
|
+
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; }
|
|
1075
1078
|
|
|
1076
|
-
function _objectSpread$
|
|
1079
|
+
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; }
|
|
1077
1080
|
|
|
1078
1081
|
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; }
|
|
1079
1082
|
|
|
@@ -1095,7 +1098,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
1095
1098
|
* ```
|
|
1096
1099
|
*/
|
|
1097
1100
|
|
|
1098
|
-
var Dropzone = /*#__PURE__*/
|
|
1101
|
+
var Dropzone = /*#__PURE__*/require$$0.forwardRef(function (_ref, ref) {
|
|
1099
1102
|
var children = _ref.children,
|
|
1100
1103
|
params = _objectWithoutProperties$1(_ref, _excluded$5);
|
|
1101
1104
|
|
|
@@ -1103,13 +1106,13 @@ var Dropzone = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
1103
1106
|
open = _useDropzone.open,
|
|
1104
1107
|
props = _objectWithoutProperties$1(_useDropzone, _excluded2);
|
|
1105
1108
|
|
|
1106
|
-
|
|
1109
|
+
require$$0.useImperativeHandle(ref, function () {
|
|
1107
1110
|
return {
|
|
1108
1111
|
open: open
|
|
1109
1112
|
};
|
|
1110
1113
|
}, [open]); // TODO: Figure out why react-styleguidist cannot create docs if we don't return a jsx element
|
|
1111
1114
|
|
|
1112
|
-
return /*#__PURE__*/
|
|
1115
|
+
return /*#__PURE__*/require$$0__default["default"].createElement(require$$0.Fragment, null, children(_objectSpread$a(_objectSpread$a({}, props), {}, {
|
|
1113
1116
|
open: open
|
|
1114
1117
|
})));
|
|
1115
1118
|
});
|
|
@@ -1482,7 +1485,7 @@ var initialState = {
|
|
|
1482
1485
|
function useDropzone() {
|
|
1483
1486
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1484
1487
|
|
|
1485
|
-
var _defaultProps$props = _objectSpread$
|
|
1488
|
+
var _defaultProps$props = _objectSpread$a(_objectSpread$a({}, defaultProps), props),
|
|
1486
1489
|
accept = _defaultProps$props.accept,
|
|
1487
1490
|
disabled = _defaultProps$props.disabled,
|
|
1488
1491
|
getFilesFromEvent = _defaultProps$props.getFilesFromEvent,
|
|
@@ -1508,16 +1511,16 @@ function useDropzone() {
|
|
|
1508
1511
|
onError = _defaultProps$props.onError,
|
|
1509
1512
|
validator = _defaultProps$props.validator;
|
|
1510
1513
|
|
|
1511
|
-
var acceptAttr =
|
|
1514
|
+
var acceptAttr = require$$0.useMemo(function () {
|
|
1512
1515
|
return acceptPropAsAcceptAttr(accept);
|
|
1513
1516
|
}, [accept]);
|
|
1514
|
-
var pickerTypes =
|
|
1517
|
+
var pickerTypes = require$$0.useMemo(function () {
|
|
1515
1518
|
return pickerOptionsFromAccept(accept);
|
|
1516
1519
|
}, [accept]);
|
|
1517
|
-
var onFileDialogOpenCb =
|
|
1520
|
+
var onFileDialogOpenCb = require$$0.useMemo(function () {
|
|
1518
1521
|
return typeof onFileDialogOpen === "function" ? onFileDialogOpen : noop;
|
|
1519
1522
|
}, [onFileDialogOpen]);
|
|
1520
|
-
var onFileDialogCancelCb =
|
|
1523
|
+
var onFileDialogCancelCb = require$$0.useMemo(function () {
|
|
1521
1524
|
return typeof onFileDialogCancel === "function" ? onFileDialogCancel : noop;
|
|
1522
1525
|
}, [onFileDialogCancel]);
|
|
1523
1526
|
/**
|
|
@@ -1525,17 +1528,17 @@ function useDropzone() {
|
|
|
1525
1528
|
* @type {React.MutableRefObject<HTMLElement>}
|
|
1526
1529
|
*/
|
|
1527
1530
|
|
|
1528
|
-
var rootRef =
|
|
1529
|
-
var inputRef =
|
|
1531
|
+
var rootRef = require$$0.useRef(null);
|
|
1532
|
+
var inputRef = require$$0.useRef(null);
|
|
1530
1533
|
|
|
1531
|
-
var _useReducer =
|
|
1534
|
+
var _useReducer = require$$0.useReducer(reducer, initialState),
|
|
1532
1535
|
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
1533
1536
|
state = _useReducer2[0],
|
|
1534
1537
|
dispatch = _useReducer2[1];
|
|
1535
1538
|
|
|
1536
1539
|
var isFocused = state.isFocused,
|
|
1537
1540
|
isFileDialogActive = state.isFileDialogActive;
|
|
1538
|
-
var fsAccessApiWorksRef =
|
|
1541
|
+
var fsAccessApiWorksRef = require$$0.useRef(typeof window !== "undefined" && window.isSecureContext && useFsAccessApi && canUseFileSystemAccessAPI()); // Update file dialog active state when the window is focused on
|
|
1539
1542
|
|
|
1540
1543
|
var onWindowFocus = function onWindowFocus() {
|
|
1541
1544
|
// Execute the timeout only if the file dialog is opened in the browser
|
|
@@ -1555,13 +1558,13 @@ function useDropzone() {
|
|
|
1555
1558
|
}
|
|
1556
1559
|
};
|
|
1557
1560
|
|
|
1558
|
-
|
|
1561
|
+
require$$0.useEffect(function () {
|
|
1559
1562
|
window.addEventListener("focus", onWindowFocus, false);
|
|
1560
1563
|
return function () {
|
|
1561
1564
|
window.removeEventListener("focus", onWindowFocus, false);
|
|
1562
1565
|
};
|
|
1563
1566
|
}, [inputRef, isFileDialogActive, onFileDialogCancelCb, fsAccessApiWorksRef]);
|
|
1564
|
-
var dragTargetsRef =
|
|
1567
|
+
var dragTargetsRef = require$$0.useRef([]);
|
|
1565
1568
|
|
|
1566
1569
|
var onDocumentDrop = function onDocumentDrop(event) {
|
|
1567
1570
|
if (rootRef.current && rootRef.current.contains(event.target)) {
|
|
@@ -1573,7 +1576,7 @@ function useDropzone() {
|
|
|
1573
1576
|
dragTargetsRef.current = [];
|
|
1574
1577
|
};
|
|
1575
1578
|
|
|
1576
|
-
|
|
1579
|
+
require$$0.useEffect(function () {
|
|
1577
1580
|
if (preventDropOnDocument) {
|
|
1578
1581
|
document.addEventListener("dragover", onDocumentDragOver, false);
|
|
1579
1582
|
document.addEventListener("drop", onDocumentDrop, false);
|
|
@@ -1587,14 +1590,14 @@ function useDropzone() {
|
|
|
1587
1590
|
};
|
|
1588
1591
|
}, [rootRef, preventDropOnDocument]); // Auto focus the root when autoFocus is true
|
|
1589
1592
|
|
|
1590
|
-
|
|
1593
|
+
require$$0.useEffect(function () {
|
|
1591
1594
|
if (!disabled && autoFocus && rootRef.current) {
|
|
1592
1595
|
rootRef.current.focus();
|
|
1593
1596
|
}
|
|
1594
1597
|
|
|
1595
1598
|
return function () {};
|
|
1596
1599
|
}, [rootRef, autoFocus, disabled]);
|
|
1597
|
-
var onErrCb =
|
|
1600
|
+
var onErrCb = require$$0.useCallback(function (e) {
|
|
1598
1601
|
if (onError) {
|
|
1599
1602
|
onError(e);
|
|
1600
1603
|
} else {
|
|
@@ -1602,7 +1605,7 @@ function useDropzone() {
|
|
|
1602
1605
|
console.error(e);
|
|
1603
1606
|
}
|
|
1604
1607
|
}, [onError]);
|
|
1605
|
-
var onDragEnterCb =
|
|
1608
|
+
var onDragEnterCb = require$$0.useCallback(function (event) {
|
|
1606
1609
|
event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
|
|
1607
1610
|
|
|
1608
1611
|
event.persist();
|
|
@@ -1641,7 +1644,7 @@ function useDropzone() {
|
|
|
1641
1644
|
});
|
|
1642
1645
|
}
|
|
1643
1646
|
}, [getFilesFromEvent, onDragEnter, onErrCb, noDragEventsBubbling, acceptAttr, minSize, maxSize, multiple, maxFiles, validator]);
|
|
1644
|
-
var onDragOverCb =
|
|
1647
|
+
var onDragOverCb = require$$0.useCallback(function (event) {
|
|
1645
1648
|
event.preventDefault();
|
|
1646
1649
|
event.persist();
|
|
1647
1650
|
stopPropagation(event);
|
|
@@ -1661,7 +1664,7 @@ function useDropzone() {
|
|
|
1661
1664
|
|
|
1662
1665
|
return false;
|
|
1663
1666
|
}, [onDragOver, noDragEventsBubbling]);
|
|
1664
|
-
var onDragLeaveCb =
|
|
1667
|
+
var onDragLeaveCb = require$$0.useCallback(function (event) {
|
|
1665
1668
|
event.preventDefault();
|
|
1666
1669
|
event.persist();
|
|
1667
1670
|
stopPropagation(event); // Only deactivate once the dropzone and all children have been left
|
|
@@ -1694,7 +1697,7 @@ function useDropzone() {
|
|
|
1694
1697
|
onDragLeave(event);
|
|
1695
1698
|
}
|
|
1696
1699
|
}, [rootRef, onDragLeave, noDragEventsBubbling]);
|
|
1697
|
-
var setFiles =
|
|
1700
|
+
var setFiles = require$$0.useCallback(function (files, event) {
|
|
1698
1701
|
var acceptedFiles = [];
|
|
1699
1702
|
var fileRejections = [];
|
|
1700
1703
|
files.forEach(function (file) {
|
|
@@ -1757,7 +1760,7 @@ function useDropzone() {
|
|
|
1757
1760
|
onDropAccepted(acceptedFiles, event);
|
|
1758
1761
|
}
|
|
1759
1762
|
}, [dispatch, multiple, acceptAttr, minSize, maxSize, maxFiles, onDrop, onDropAccepted, onDropRejected, validator]);
|
|
1760
|
-
var onDropCb =
|
|
1763
|
+
var onDropCb = require$$0.useCallback(function (event) {
|
|
1761
1764
|
event.preventDefault(); // Persist here because we need the event later after getFilesFromEvent() is done
|
|
1762
1765
|
|
|
1763
1766
|
event.persist();
|
|
@@ -1781,7 +1784,7 @@ function useDropzone() {
|
|
|
1781
1784
|
});
|
|
1782
1785
|
}, [getFilesFromEvent, setFiles, onErrCb, noDragEventsBubbling]); // Fn for opening the file dialog programmatically
|
|
1783
1786
|
|
|
1784
|
-
var openFileDialog =
|
|
1787
|
+
var openFileDialog = require$$0.useCallback(function () {
|
|
1785
1788
|
// No point to use FS access APIs if context is not secure
|
|
1786
1789
|
// https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts#feature_detection
|
|
1787
1790
|
if (fsAccessApiWorksRef.current) {
|
|
@@ -1835,7 +1838,7 @@ function useDropzone() {
|
|
|
1835
1838
|
}
|
|
1836
1839
|
}, [dispatch, onFileDialogOpenCb, onFileDialogCancelCb, useFsAccessApi, setFiles, onErrCb, pickerTypes, multiple]); // Cb to open the file dialog when SPACE/ENTER occurs on the dropzone
|
|
1837
1840
|
|
|
1838
|
-
var onKeyDownCb =
|
|
1841
|
+
var onKeyDownCb = require$$0.useCallback(function (event) {
|
|
1839
1842
|
// Ignore keyboard events bubbling up the DOM tree
|
|
1840
1843
|
if (!rootRef.current || !rootRef.current.isEqualNode(event.target)) {
|
|
1841
1844
|
return;
|
|
@@ -1847,18 +1850,18 @@ function useDropzone() {
|
|
|
1847
1850
|
}
|
|
1848
1851
|
}, [rootRef, openFileDialog]); // Update focus state for the dropzone
|
|
1849
1852
|
|
|
1850
|
-
var onFocusCb =
|
|
1853
|
+
var onFocusCb = require$$0.useCallback(function () {
|
|
1851
1854
|
dispatch({
|
|
1852
1855
|
type: "focus"
|
|
1853
1856
|
});
|
|
1854
1857
|
}, []);
|
|
1855
|
-
var onBlurCb =
|
|
1858
|
+
var onBlurCb = require$$0.useCallback(function () {
|
|
1856
1859
|
dispatch({
|
|
1857
1860
|
type: "blur"
|
|
1858
1861
|
});
|
|
1859
1862
|
}, []); // Cb to open the file dialog when click occurs on the dropzone
|
|
1860
1863
|
|
|
1861
|
-
var onClickCb =
|
|
1864
|
+
var onClickCb = require$$0.useCallback(function () {
|
|
1862
1865
|
if (noClick) {
|
|
1863
1866
|
return;
|
|
1864
1867
|
} // In IE11/Edge the file-browser dialog is blocking, therefore, use setTimeout()
|
|
@@ -1891,7 +1894,7 @@ function useDropzone() {
|
|
|
1891
1894
|
}
|
|
1892
1895
|
};
|
|
1893
1896
|
|
|
1894
|
-
var getRootProps =
|
|
1897
|
+
var getRootProps = require$$0.useMemo(function () {
|
|
1895
1898
|
return function () {
|
|
1896
1899
|
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1897
1900
|
_ref2$refKey = _ref2.refKey,
|
|
@@ -1907,7 +1910,7 @@ function useDropzone() {
|
|
|
1907
1910
|
onDrop = _ref2.onDrop,
|
|
1908
1911
|
rest = _objectWithoutProperties$1(_ref2, _excluded3);
|
|
1909
1912
|
|
|
1910
|
-
return _objectSpread$
|
|
1913
|
+
return _objectSpread$a(_objectSpread$a(_defineProperty$1({
|
|
1911
1914
|
onKeyDown: composeKeyboardHandler(composeEventHandlers(onKeyDown, onKeyDownCb)),
|
|
1912
1915
|
onFocus: composeKeyboardHandler(composeEventHandlers(onFocus, onFocusCb)),
|
|
1913
1916
|
onBlur: composeKeyboardHandler(composeEventHandlers(onBlur, onBlurCb)),
|
|
@@ -1922,10 +1925,10 @@ function useDropzone() {
|
|
|
1922
1925
|
} : {}), rest);
|
|
1923
1926
|
};
|
|
1924
1927
|
}, [rootRef, onKeyDownCb, onFocusCb, onBlurCb, onClickCb, onDragEnterCb, onDragOverCb, onDragLeaveCb, onDropCb, noKeyboard, noDrag, disabled]);
|
|
1925
|
-
var onInputElementClick =
|
|
1928
|
+
var onInputElementClick = require$$0.useCallback(function (event) {
|
|
1926
1929
|
event.stopPropagation();
|
|
1927
1930
|
}, []);
|
|
1928
|
-
var getInputProps =
|
|
1931
|
+
var getInputProps = require$$0.useMemo(function () {
|
|
1929
1932
|
return function () {
|
|
1930
1933
|
var _ref3 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
1931
1934
|
_ref3$refKey = _ref3.refKey,
|
|
@@ -1946,10 +1949,10 @@ function useDropzone() {
|
|
|
1946
1949
|
tabIndex: -1
|
|
1947
1950
|
}, refKey, inputRef);
|
|
1948
1951
|
|
|
1949
|
-
return _objectSpread$
|
|
1952
|
+
return _objectSpread$a(_objectSpread$a({}, inputProps), rest);
|
|
1950
1953
|
};
|
|
1951
1954
|
}, [inputRef, accept, multiple, onDropCb, disabled]);
|
|
1952
|
-
return _objectSpread$
|
|
1955
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1953
1956
|
isFocused: isFocused && !disabled,
|
|
1954
1957
|
getRootProps: getRootProps,
|
|
1955
1958
|
getInputProps: getInputProps,
|
|
@@ -1968,40 +1971,40 @@ function reducer(state, action) {
|
|
|
1968
1971
|
/* istanbul ignore next */
|
|
1969
1972
|
switch (action.type) {
|
|
1970
1973
|
case "focus":
|
|
1971
|
-
return _objectSpread$
|
|
1974
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1972
1975
|
isFocused: true
|
|
1973
1976
|
});
|
|
1974
1977
|
|
|
1975
1978
|
case "blur":
|
|
1976
|
-
return _objectSpread$
|
|
1979
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1977
1980
|
isFocused: false
|
|
1978
1981
|
});
|
|
1979
1982
|
|
|
1980
1983
|
case "openDialog":
|
|
1981
|
-
return _objectSpread$
|
|
1984
|
+
return _objectSpread$a(_objectSpread$a({}, initialState), {}, {
|
|
1982
1985
|
isFileDialogActive: true
|
|
1983
1986
|
});
|
|
1984
1987
|
|
|
1985
1988
|
case "closeDialog":
|
|
1986
|
-
return _objectSpread$
|
|
1989
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1987
1990
|
isFileDialogActive: false
|
|
1988
1991
|
});
|
|
1989
1992
|
|
|
1990
1993
|
case "setDraggedFiles":
|
|
1991
|
-
return _objectSpread$
|
|
1994
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1992
1995
|
isDragActive: action.isDragActive,
|
|
1993
1996
|
isDragAccept: action.isDragAccept,
|
|
1994
1997
|
isDragReject: action.isDragReject
|
|
1995
1998
|
});
|
|
1996
1999
|
|
|
1997
2000
|
case "setFiles":
|
|
1998
|
-
return _objectSpread$
|
|
2001
|
+
return _objectSpread$a(_objectSpread$a({}, state), {}, {
|
|
1999
2002
|
acceptedFiles: action.acceptedFiles,
|
|
2000
2003
|
fileRejections: action.fileRejections
|
|
2001
2004
|
});
|
|
2002
2005
|
|
|
2003
2006
|
case "reset":
|
|
2004
|
-
return _objectSpread$
|
|
2007
|
+
return _objectSpread$a({}, initialState);
|
|
2005
2008
|
|
|
2006
2009
|
default:
|
|
2007
2010
|
return state;
|
|
@@ -2021,7 +2024,7 @@ var handleDropRejected = function handleDropRejected(fileRejections) {
|
|
|
2021
2024
|
var errors = _ref.errors;
|
|
2022
2025
|
return errors.map(function (_ref2) {
|
|
2023
2026
|
var code = _ref2.code;
|
|
2024
|
-
return
|
|
2027
|
+
return Toastr__default["default"].error(FILE_ERRORS[code] || i18next.t("neetoImageUploader.imageUpload.genericError"));
|
|
2025
2028
|
});
|
|
2026
2029
|
});
|
|
2027
2030
|
};
|
|
@@ -2033,7 +2036,7 @@ var useUploadDropzone = function useUploadDropzone(_ref) {
|
|
|
2033
2036
|
maxImageSize: 0
|
|
2034
2037
|
} : _ref$uploadConfig,
|
|
2035
2038
|
_onDrop = _ref.onDrop;
|
|
2036
|
-
var _useState =
|
|
2039
|
+
var _useState = require$$0.useState(0),
|
|
2037
2040
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
2038
2041
|
uploadProgress = _useState2[0],
|
|
2039
2042
|
setUploadProgress = _useState2[1];
|
|
@@ -2063,19 +2066,24 @@ var ProgressBar = function ProgressBar(_ref) {
|
|
|
2063
2066
|
var _ref$progressPercenta = _ref.progressPercentage,
|
|
2064
2067
|
progressPercentage = _ref$progressPercenta === void 0 ? 0 : _ref$progressPercenta,
|
|
2065
2068
|
progressValue = _ref.progressValue;
|
|
2066
|
-
return /*#__PURE__*/
|
|
2067
|
-
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"
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2069
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2070
|
+
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",
|
|
2071
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2072
|
+
className: "neeto-ui-bg-gray-200 neeto-ui-rounded-full w-full overflow-hidden dark:bg-gray-700",
|
|
2073
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2074
|
+
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",
|
|
2075
|
+
"data-cy": "neeto-image-uploader-progress-bar",
|
|
2076
|
+
style: {
|
|
2077
|
+
width: "".concat(progressPercentage, "%")
|
|
2078
|
+
},
|
|
2079
|
+
children: progressValue
|
|
2080
|
+
})
|
|
2081
|
+
})
|
|
2082
|
+
});
|
|
2077
2083
|
};
|
|
2078
2084
|
|
|
2085
|
+
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; }
|
|
2086
|
+
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; }
|
|
2079
2087
|
var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
2080
2088
|
var _ref$uploadConfig = _ref.uploadConfig,
|
|
2081
2089
|
uploadConfig = _ref$uploadConfig === void 0 ? DEFAULT_UPLOAD_CONFIG : _ref$uploadConfig,
|
|
@@ -2093,72 +2101,79 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
|
|
|
2093
2101
|
isDragActive = _useUploadDropzone.isDragActive,
|
|
2094
2102
|
uploadProgress = _useUploadDropzone.uploadProgress;
|
|
2095
2103
|
var shouldShowProgress = !!(uploadProgress && !ramda.equals(uploadProgress, 1));
|
|
2096
|
-
return shouldShowProgress ? /*#__PURE__*/
|
|
2104
|
+
return shouldShowProgress ? /*#__PURE__*/jsxRuntime.jsx(ProgressBar, {
|
|
2097
2105
|
progressPercentage: uploadProgress,
|
|
2098
2106
|
progressValue: "".concat(uploadProgress, "%")
|
|
2099
|
-
}) : /*#__PURE__*/
|
|
2107
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$9(_objectSpread$9({}, getRootProps()), {}, {
|
|
2100
2108
|
className: classnames__default["default"](DROPZONE_ROOT_DIV_CLASSNAME, {
|
|
2101
2109
|
"neeto-ui-border-gray-300": !isDragActive,
|
|
2102
2110
|
"neeto-ui-border-gray-700": isDragActive
|
|
2111
|
+
}),
|
|
2112
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2113
|
+
className: "flex flex-col space-y-1",
|
|
2114
|
+
children: [!isDisabled && /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
2115
|
+
className: "neeto-ui-text-gray-800 text-center leading-4",
|
|
2116
|
+
style: "body2",
|
|
2117
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
2118
|
+
i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
|
|
2119
|
+
components: {
|
|
2120
|
+
span: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2121
|
+
className: "neeto-ui-text-primary-500",
|
|
2122
|
+
"data-cy": "neeto-image-uploader-browse-text"
|
|
2123
|
+
})
|
|
2124
|
+
}
|
|
2125
|
+
})
|
|
2126
|
+
}), setIsAssetLibraryOpen && /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
2127
|
+
className: "text-center leading-4",
|
|
2128
|
+
style: "body2",
|
|
2129
|
+
onClick: function onClick(e) {
|
|
2130
|
+
e.stopPropagation();
|
|
2131
|
+
setIsAssetLibraryOpen(true);
|
|
2132
|
+
},
|
|
2133
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
2134
|
+
i18nKey: "neetoImageUploader.imageUpload.selectImagefromImageLibrary",
|
|
2135
|
+
components: {
|
|
2136
|
+
span: /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
2137
|
+
className: "neeto-ui-text-primary-500",
|
|
2138
|
+
"data-cy": "open-asset-library-button"
|
|
2139
|
+
})
|
|
2140
|
+
}
|
|
2141
|
+
})
|
|
2142
|
+
}), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread$9(_objectSpread$9({}, getInputProps()), {}, {
|
|
2143
|
+
"data-cy": "neeto-image-uploader-file-input",
|
|
2144
|
+
disabled: isDisabled
|
|
2145
|
+
})), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
2146
|
+
className: "neeto-ui-text-gray-700 text-center leading-4",
|
|
2147
|
+
"data-cy": "neeto-image-uploader-restriction-message",
|
|
2148
|
+
lineHeight: "snug",
|
|
2149
|
+
style: "nano",
|
|
2150
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
2151
|
+
i18nKey: "neetoImageUploader.imageUpload.restrictionMessage",
|
|
2152
|
+
values: {
|
|
2153
|
+
fileTypes: getAllowedTypes(uploadConfig),
|
|
2154
|
+
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
|
|
2155
|
+
}
|
|
2156
|
+
})
|
|
2157
|
+
})]
|
|
2103
2158
|
})
|
|
2104
|
-
})
|
|
2105
|
-
className: "flex flex-col space-y-1"
|
|
2106
|
-
}, !isDisabled && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
2107
|
-
className: "neeto-ui-text-gray-800 text-center leading-4",
|
|
2108
|
-
style: "body2"
|
|
2109
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
2110
|
-
i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
|
|
2111
|
-
components: {
|
|
2112
|
-
span: /*#__PURE__*/React__default["default"].createElement("span", {
|
|
2113
|
-
className: "neeto-ui-text-primary-500",
|
|
2114
|
-
"data-cy": "neeto-image-uploader-browse-text"
|
|
2115
|
-
})
|
|
2116
|
-
}
|
|
2117
|
-
})), setIsAssetLibraryOpen && /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
2118
|
-
className: "text-center leading-4",
|
|
2119
|
-
style: "body2",
|
|
2120
|
-
onClick: function onClick(e) {
|
|
2121
|
-
e.stopPropagation();
|
|
2122
|
-
setIsAssetLibraryOpen(true);
|
|
2123
|
-
}
|
|
2124
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
2125
|
-
i18nKey: "neetoImageUploader.imageUpload.selectImagefromImageLibrary",
|
|
2126
|
-
components: {
|
|
2127
|
-
span: /*#__PURE__*/React__default["default"].createElement("span", {
|
|
2128
|
-
className: "neeto-ui-text-primary-500",
|
|
2129
|
-
"data-cy": "open-asset-library-button"
|
|
2130
|
-
})
|
|
2131
|
-
}
|
|
2132
|
-
})), /*#__PURE__*/React__default["default"].createElement("input", _extends$1({}, getInputProps(), {
|
|
2133
|
-
"data-cy": "neeto-image-uploader-file-input",
|
|
2134
|
-
disabled: isDisabled
|
|
2135
|
-
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
2136
|
-
className: "neeto-ui-text-gray-700 text-center leading-4",
|
|
2137
|
-
"data-cy": "neeto-image-uploader-restriction-message",
|
|
2138
|
-
lineHeight: "snug",
|
|
2139
|
-
style: "nano"
|
|
2140
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
2141
|
-
i18nKey: "neetoImageUploader.imageUpload.restrictionMessage",
|
|
2142
|
-
values: {
|
|
2143
|
-
fileTypes: getAllowedTypes(uploadConfig),
|
|
2144
|
-
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
|
|
2145
|
-
}
|
|
2146
|
-
}))));
|
|
2159
|
+
}));
|
|
2147
2160
|
};
|
|
2148
2161
|
|
|
2149
2162
|
var _excluded$4 = ["className"];
|
|
2163
|
+
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; }
|
|
2164
|
+
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; }
|
|
2150
2165
|
var ImagePlaceholder = function ImagePlaceholder(_ref) {
|
|
2151
2166
|
var _ref$className = _ref.className,
|
|
2152
2167
|
className = _ref$className === void 0 ? "" : _ref$className,
|
|
2153
2168
|
props = _objectWithoutProperties$2(_ref, _excluded$4);
|
|
2154
|
-
return /*#__PURE__*/
|
|
2169
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$8({
|
|
2155
2170
|
className: classnames__default["default"]("neeto-ui-bg-gray-200", _defineProperty$3({}, className, className))
|
|
2156
2171
|
}, props));
|
|
2157
2172
|
};
|
|
2158
2173
|
|
|
2159
2174
|
var _excluded$3 = ["src", "className", "fallback"];
|
|
2160
|
-
function ownKeys$
|
|
2161
|
-
function _objectSpread$
|
|
2175
|
+
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; }
|
|
2176
|
+
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; }
|
|
2162
2177
|
var ImageWithFallback = function ImageWithFallback(_ref) {
|
|
2163
2178
|
var src = _ref.src,
|
|
2164
2179
|
_ref$className = _ref.className,
|
|
@@ -2166,24 +2181,24 @@ var ImageWithFallback = function ImageWithFallback(_ref) {
|
|
|
2166
2181
|
_ref$fallback = _ref.fallback,
|
|
2167
2182
|
Fallback = _ref$fallback === void 0 ? ImagePlaceholder : _ref$fallback,
|
|
2168
2183
|
props = _objectWithoutProperties$2(_ref, _excluded$3);
|
|
2169
|
-
var _useState =
|
|
2184
|
+
var _useState = require$$0.useState(false),
|
|
2170
2185
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
2171
2186
|
isLoaded = _useState2[0],
|
|
2172
2187
|
setIsLoaded = _useState2[1];
|
|
2173
|
-
|
|
2188
|
+
require$$0.useEffect(function () {
|
|
2174
2189
|
var img = new Image();
|
|
2175
2190
|
img.onload = function () {
|
|
2176
2191
|
setIsLoaded(true);
|
|
2177
2192
|
};
|
|
2178
2193
|
img.src = src;
|
|
2179
2194
|
}, [src]);
|
|
2180
|
-
return isLoaded ? /*#__PURE__*/
|
|
2195
|
+
return isLoaded ? /*#__PURE__*/jsxRuntime.jsx("img", _objectSpread$7(_objectSpread$7({}, _objectSpread$7({
|
|
2181
2196
|
src: src
|
|
2182
|
-
}, props), {
|
|
2197
|
+
}, props)), {}, {
|
|
2183
2198
|
className: "h-full w-auto object-contain"
|
|
2184
|
-
})) : /*#__PURE__*/
|
|
2199
|
+
})) : /*#__PURE__*/jsxRuntime.jsx(Fallback, _objectSpread$7({}, _objectSpread$7({
|
|
2185
2200
|
className: className
|
|
2186
|
-
}, props));
|
|
2201
|
+
}, props)));
|
|
2187
2202
|
};
|
|
2188
2203
|
|
|
2189
2204
|
var IS_DEVELOPMENT_OR_HEROKU_ENV = process.env.RAILS_ENV === "development" || process.env.RAILS_ENV === "heroku";
|
|
@@ -2292,7 +2307,7 @@ function _defineProperty(obj, key, value) {
|
|
|
2292
2307
|
return obj;
|
|
2293
2308
|
}
|
|
2294
2309
|
|
|
2295
|
-
function ownKeys$
|
|
2310
|
+
function ownKeys$7(object, enumerableOnly) {
|
|
2296
2311
|
var keys = Object.keys(object);
|
|
2297
2312
|
|
|
2298
2313
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -2311,13 +2326,13 @@ function _objectSpread2(target) {
|
|
|
2311
2326
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
2312
2327
|
|
|
2313
2328
|
if (i % 2) {
|
|
2314
|
-
ownKeys$
|
|
2329
|
+
ownKeys$7(Object(source), true).forEach(function (key) {
|
|
2315
2330
|
_defineProperty(target, key, source[key]);
|
|
2316
2331
|
});
|
|
2317
2332
|
} else if (Object.getOwnPropertyDescriptors) {
|
|
2318
2333
|
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
2319
2334
|
} else {
|
|
2320
|
-
ownKeys$
|
|
2335
|
+
ownKeys$7(Object(source)).forEach(function (key) {
|
|
2321
2336
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2322
2337
|
});
|
|
2323
2338
|
}
|
|
@@ -2890,8 +2905,8 @@ var isItemsCenter = function isItemsCenter(_ref4) {
|
|
|
2890
2905
|
};
|
|
2891
2906
|
|
|
2892
2907
|
var _excluded$2 = ["src", "className", "imageFallbackProps", "onDrop", "isDisabled", "onRemove"];
|
|
2893
|
-
function ownKeys$
|
|
2894
|
-
function _objectSpread$
|
|
2908
|
+
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; }
|
|
2909
|
+
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; }
|
|
2895
2910
|
var BasicImageUploader = function BasicImageUploader(_ref) {
|
|
2896
2911
|
var _ref$src = _ref.src,
|
|
2897
2912
|
src = _ref$src === void 0 ? "" : _ref$src,
|
|
@@ -2909,29 +2924,31 @@ var BasicImageUploader = function BasicImageUploader(_ref) {
|
|
|
2909
2924
|
_ref$onRemove = _ref.onRemove,
|
|
2910
2925
|
onRemove = _ref$onRemove === void 0 ? neetoCist.noop : _ref$onRemove,
|
|
2911
2926
|
props = _objectWithoutProperties$2(_ref, _excluded$2);
|
|
2912
|
-
return /*#__PURE__*/
|
|
2927
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
2913
2928
|
className: classnames__default["default"](className, {
|
|
2914
2929
|
"cursor-pointer": true,
|
|
2915
2930
|
"cursor-not-allowed": isDisabled,
|
|
2916
2931
|
"opacity-70": isDisabled && isNilOrEmpty(src)
|
|
2917
|
-
})
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2932
|
+
}),
|
|
2933
|
+
children: isNotNilOrEmpty(src) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
2934
|
+
className: IMAGE_WRAPPER_CLASSNAME,
|
|
2935
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ImageWithFallback, _objectSpread$6(_objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, imageFallbackProps), {}, {
|
|
2936
|
+
src: src
|
|
2937
|
+
})), {}, {
|
|
2938
|
+
"data-cy": "uploaded-image"
|
|
2939
|
+
})), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
2940
|
+
className: "absolute right-3 top-3",
|
|
2941
|
+
"data-cy": "basic-image-uploader-remove-button",
|
|
2942
|
+
disabled: isDisabled,
|
|
2943
|
+
icon: neetoIcons.Delete,
|
|
2944
|
+
size: "small",
|
|
2945
|
+
onClick: onRemove
|
|
2946
|
+
})]
|
|
2947
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ImageDirectUpload, _objectSpread$6({}, _objectSpread$6(_objectSpread$6({}, props), {}, {
|
|
2948
|
+
isDisabled: isDisabled,
|
|
2949
|
+
onDrop: onDrop
|
|
2950
|
+
})))
|
|
2951
|
+
});
|
|
2935
2952
|
};
|
|
2936
2953
|
|
|
2937
2954
|
var create = function create(payload) {
|
|
@@ -2963,10 +2980,10 @@ var ASSETS_STALE_TIME = 900000; // 15 mins
|
|
|
2963
2980
|
|
|
2964
2981
|
var UNSPLASH_STALE_TIME = 900000;
|
|
2965
2982
|
|
|
2966
|
-
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; }
|
|
2967
|
-
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; }
|
|
2983
|
+
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; }
|
|
2984
|
+
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; }
|
|
2968
2985
|
var useCreateBlob = function useCreateBlob(options) {
|
|
2969
|
-
return reactUtils.useMutationWithInvalidation(directUploadsApi.create, _objectSpread({
|
|
2986
|
+
return reactUtils.useMutationWithInvalidation(directUploadsApi.create, _objectSpread$5({
|
|
2970
2987
|
keysToInvalidate: [QUERY_KEYS.ASSETS_LIST]
|
|
2971
2988
|
}, options));
|
|
2972
2989
|
};
|
|
@@ -3402,7 +3419,7 @@ var useImageUploader = function useImageUploader(_ref) {
|
|
|
3402
3419
|
setIsUploading(false);
|
|
3403
3420
|
});
|
|
3404
3421
|
} catch (error) {
|
|
3405
|
-
|
|
3422
|
+
Toastr__default["default"].error(error);
|
|
3406
3423
|
}
|
|
3407
3424
|
};
|
|
3408
3425
|
var productionUpload = /*#__PURE__*/function () {
|
|
@@ -3436,7 +3453,7 @@ var useImageUploader = function useImageUploader(_ref) {
|
|
|
3436
3453
|
case 10:
|
|
3437
3454
|
_context.prev = 10;
|
|
3438
3455
|
_context.t0 = _context["catch"](0);
|
|
3439
|
-
|
|
3456
|
+
Toastr__default["default"].error(_context.t0);
|
|
3440
3457
|
case 13:
|
|
3441
3458
|
case "end":
|
|
3442
3459
|
return _context.stop();
|
|
@@ -3503,7 +3520,7 @@ var ReactCrop_min = {exports: {}};
|
|
|
3503
3520
|
ReactCrop_min.exports;
|
|
3504
3521
|
|
|
3505
3522
|
(function (module, exports) {
|
|
3506
|
-
!function(e,t){module.exports=t(React__default["default"]);}(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})()));
|
|
3523
|
+
!function(e,t){module.exports=t(require$$0__default["default"]);}(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})()));
|
|
3507
3524
|
} (ReactCrop_min, ReactCrop_min.exports));
|
|
3508
3525
|
|
|
3509
3526
|
var ReactCrop_minExports = ReactCrop_min.exports;
|
|
@@ -3516,8 +3533,12 @@ var developmentApi = {
|
|
|
3516
3533
|
cropImage: cropImage
|
|
3517
3534
|
};
|
|
3518
3535
|
|
|
3536
|
+
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; }
|
|
3537
|
+
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; }
|
|
3519
3538
|
var useCropImage = function useCropImage(options) {
|
|
3520
|
-
return reactQuery.useMutation(
|
|
3539
|
+
return reactQuery.useMutation(_objectSpread$4({
|
|
3540
|
+
mutationFn: developmentApi.cropImage
|
|
3541
|
+
}, options));
|
|
3521
3542
|
};
|
|
3522
3543
|
|
|
3523
3544
|
var useImageControls = function useImageControls(_ref) {
|
|
@@ -3546,17 +3567,18 @@ var useImageControls = function useImageControls(_ref) {
|
|
|
3546
3567
|
}
|
|
3547
3568
|
};
|
|
3548
3569
|
var handleWidthChange = function handleWidthChange(width) {
|
|
3549
|
-
var
|
|
3550
|
-
|
|
3570
|
+
var cropWidth = Number(width);
|
|
3571
|
+
var displayWidth = cropWidth * imageRef.current.width / imageRef.current.naturalWidth;
|
|
3572
|
+
if (displayWidth > 0 && Math.trunc(crop.x) + displayWidth <= imageRef.current.width) {
|
|
3551
3573
|
if (isAspectRatioLocked) {
|
|
3552
|
-
var
|
|
3553
|
-
|
|
3554
|
-
width:
|
|
3555
|
-
height:
|
|
3574
|
+
var displayHeight = displayWidth / (aspectRatio.width / aspectRatio.height);
|
|
3575
|
+
displayHeight + Math.trunc(crop.y) <= imageRef.current.height && setCrop(ramda.mergeRight(crop, {
|
|
3576
|
+
width: displayWidth,
|
|
3577
|
+
height: displayHeight
|
|
3556
3578
|
}));
|
|
3557
3579
|
} else {
|
|
3558
3580
|
setCrop(ramda.mergeRight(crop, {
|
|
3559
|
-
width:
|
|
3581
|
+
width: displayWidth
|
|
3560
3582
|
}));
|
|
3561
3583
|
}
|
|
3562
3584
|
} else {
|
|
@@ -3564,17 +3586,18 @@ var useImageControls = function useImageControls(_ref) {
|
|
|
3564
3586
|
}
|
|
3565
3587
|
};
|
|
3566
3588
|
var handleHeightChange = function handleHeightChange(height) {
|
|
3567
|
-
var
|
|
3568
|
-
|
|
3589
|
+
var cropHeight = Number(height);
|
|
3590
|
+
var displayHeight = cropHeight * imageRef.current.height / imageRef.current.naturalHeight;
|
|
3591
|
+
if (displayHeight > 0 && Math.trunc(crop.y) + displayHeight <= imageRef.current.height) {
|
|
3569
3592
|
if (isAspectRatioLocked) {
|
|
3570
|
-
var
|
|
3571
|
-
|
|
3572
|
-
height:
|
|
3573
|
-
width:
|
|
3593
|
+
var displayWidth = displayHeight * aspectRatio.width / aspectRatio.height;
|
|
3594
|
+
displayWidth + Math.trunc(crop.x) <= imageRef.current.width && setCrop(ramda.mergeRight(crop, {
|
|
3595
|
+
height: displayHeight,
|
|
3596
|
+
width: displayWidth
|
|
3574
3597
|
}));
|
|
3575
3598
|
} else {
|
|
3576
3599
|
setCrop(ramda.mergeRight(crop, {
|
|
3577
|
-
height:
|
|
3600
|
+
height: displayHeight
|
|
3578
3601
|
}));
|
|
3579
3602
|
}
|
|
3580
3603
|
} else {
|
|
@@ -3645,11 +3668,19 @@ var Controls = function Controls(_ref) {
|
|
|
3645
3668
|
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls;
|
|
3646
3669
|
var _useTranslation = reactI18next.useTranslation(),
|
|
3647
3670
|
t = _useTranslation.t;
|
|
3648
|
-
var
|
|
3671
|
+
var getActualCropHeight = function getActualCropHeight(cropHeight) {
|
|
3672
|
+
var _imageRef$current, _imageRef$current2;
|
|
3673
|
+
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));
|
|
3674
|
+
};
|
|
3675
|
+
var getActualCropWidth = function getActualCropWidth(cropHeight) {
|
|
3676
|
+
var _imageRef$current3, _imageRef$current4;
|
|
3677
|
+
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));
|
|
3678
|
+
};
|
|
3679
|
+
var _useState = require$$0.useState(getActualCropHeight(crop.height)),
|
|
3649
3680
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
3650
3681
|
height = _useState2[0],
|
|
3651
3682
|
setHeight = _useState2[1];
|
|
3652
|
-
var _useState3 =
|
|
3683
|
+
var _useState3 = require$$0.useState(getActualCropWidth(crop.width)),
|
|
3653
3684
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
3654
3685
|
width = _useState4[0],
|
|
3655
3686
|
setWidth = _useState4[1];
|
|
@@ -3671,73 +3702,80 @@ var Controls = function Controls(_ref) {
|
|
|
3671
3702
|
handleAspectHeightChange = _useImageControls.handleAspectHeightChange;
|
|
3672
3703
|
var debouncedHeight = reactUtils.useDebounce(height, 800);
|
|
3673
3704
|
var debouncedWidth = reactUtils.useDebounce(width, 800);
|
|
3674
|
-
|
|
3705
|
+
require$$0.useEffect(function () {
|
|
3675
3706
|
handleHeightChange(debouncedHeight);
|
|
3676
3707
|
}, [debouncedHeight]);
|
|
3677
|
-
|
|
3708
|
+
require$$0.useEffect(function () {
|
|
3678
3709
|
handleWidthChange(debouncedWidth);
|
|
3679
3710
|
}, [debouncedWidth]);
|
|
3680
|
-
|
|
3681
|
-
setHeight(crop.height
|
|
3682
|
-
setWidth(crop.width
|
|
3711
|
+
require$$0.useEffect(function () {
|
|
3712
|
+
setHeight(getActualCropHeight(crop.height));
|
|
3713
|
+
setWidth(getActualCropWidth(crop.width));
|
|
3683
3714
|
}, [crop]);
|
|
3684
|
-
return /*#__PURE__*/
|
|
3685
|
-
className: "flex flex-col p-4 md:w-2/6 "
|
|
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
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3715
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3716
|
+
className: "flex flex-col p-4 md:w-2/6 ",
|
|
3717
|
+
children: [!hideControls && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
3718
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch__default["default"], {
|
|
3719
|
+
checked: isFullImage,
|
|
3720
|
+
className: "flex-grow-0",
|
|
3721
|
+
label: t("neetoImageUploader.labels.selectOriginalImage"),
|
|
3722
|
+
onChange: function onChange() {
|
|
3723
|
+
return setIsFullImage(function (isFullImage) {
|
|
3724
|
+
return !isFullImage;
|
|
3725
|
+
});
|
|
3726
|
+
}
|
|
3727
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Switch__default["default"], {
|
|
3728
|
+
checked: isAspectRatioLocked,
|
|
3729
|
+
className: "mt-4 flex-grow-0",
|
|
3730
|
+
disabled: isFullImage,
|
|
3731
|
+
label: t("neetoImageUploader.labels.lockAspectRatio"),
|
|
3732
|
+
onChange: onToggleAspectRatioLock
|
|
3733
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
3734
|
+
className: "mb-2 mt-6",
|
|
3735
|
+
style: "body2",
|
|
3736
|
+
children: t("neetoImageUploader.imageEditor.aspectRatio")
|
|
3737
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3738
|
+
className: "flex gap-4 self-start",
|
|
3739
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
3740
|
+
"data-cy": "aspect-ratio-width-input",
|
|
3741
|
+
disabled: isFullImage,
|
|
3742
|
+
size: "small",
|
|
3743
|
+
type: "number",
|
|
3744
|
+
value: aspectRatio.width,
|
|
3745
|
+
onChange: utils.withEventTargetValue(handleAspectWidthChange)
|
|
3746
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
3747
|
+
children: " : "
|
|
3748
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
3749
|
+
"data-cy": "aspect-ratio-height-input",
|
|
3750
|
+
disabled: isFullImage,
|
|
3751
|
+
size: "small",
|
|
3752
|
+
type: "number",
|
|
3753
|
+
value: aspectRatio.height,
|
|
3754
|
+
onChange: utils.withEventTargetValue(handleAspectHeightChange)
|
|
3755
|
+
})]
|
|
3756
|
+
})]
|
|
3757
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
3758
|
+
className: "mt-4 flex-grow-0",
|
|
3759
|
+
disabled: isFullImage,
|
|
3760
|
+
label: t("neetoImageUploader.labels.width"),
|
|
3761
|
+
type: "number",
|
|
3762
|
+
value: Math.round(width),
|
|
3763
|
+
onChange: utils.withEventTargetValue(setWidth)
|
|
3764
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
3765
|
+
className: "mt-4 flex-grow-0",
|
|
3766
|
+
disabled: isFullImage,
|
|
3767
|
+
label: t("neetoImageUploader.labels.height"),
|
|
3768
|
+
type: "number",
|
|
3769
|
+
value: Math.round(height),
|
|
3770
|
+
onChange: utils.withEventTargetValue(setHeight)
|
|
3771
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
3772
|
+
className: "mt-6 self-start",
|
|
3773
|
+
"data-cy": "neeto-image-uploader-crop-submit-button",
|
|
3774
|
+
label: t("neetoImageUploader.labels.done"),
|
|
3775
|
+
disabled: isNilOrEmpty(imageRef.current) && (crop.width <= 0 || crop.height <= 0),
|
|
3776
|
+
onClick: handleSubmit
|
|
3777
|
+
})]
|
|
3778
|
+
});
|
|
3741
3779
|
};
|
|
3742
3780
|
|
|
3743
3781
|
var ImageEditor = function ImageEditor(_ref) {
|
|
@@ -3749,22 +3787,22 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
3749
3787
|
signedId = _ref$signedId === void 0 ? "" : _ref$signedId,
|
|
3750
3788
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
3751
3789
|
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
|
|
3752
|
-
var _useState =
|
|
3790
|
+
var _useState = require$$0.useState(true),
|
|
3753
3791
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
3754
3792
|
isAspectRatioLocked = _useState2[0],
|
|
3755
3793
|
setIsAspectRatioLocked = _useState2[1];
|
|
3756
|
-
var _useState3 =
|
|
3794
|
+
var _useState3 = require$$0.useState(false),
|
|
3757
3795
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
3758
3796
|
isFullImage = _useState4[0],
|
|
3759
3797
|
setIsFullImage = _useState4[1];
|
|
3760
|
-
var _useState5 =
|
|
3798
|
+
var _useState5 = require$$0.useState({
|
|
3761
3799
|
width: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) || 16,
|
|
3762
3800
|
height: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height) || 9
|
|
3763
3801
|
}),
|
|
3764
3802
|
_useState6 = _slicedToArray$2(_useState5, 2),
|
|
3765
3803
|
aspectRatio = _useState6[0],
|
|
3766
3804
|
setAspectRatio = _useState6[1];
|
|
3767
|
-
var _useState7 =
|
|
3805
|
+
var _useState7 = require$$0.useState(DEFAULT_CROP_CONFIG),
|
|
3768
3806
|
_useState8 = _slicedToArray$2(_useState7, 2),
|
|
3769
3807
|
crop = _useState8[0],
|
|
3770
3808
|
setCrop = _useState8[1];
|
|
@@ -3772,8 +3810,8 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
3772
3810
|
t = _useTranslation.t;
|
|
3773
3811
|
var _useCropImage = useCropImage(),
|
|
3774
3812
|
cropImage = _useCropImage.mutate;
|
|
3775
|
-
var imageRef =
|
|
3776
|
-
var wrapperRef =
|
|
3813
|
+
var imageRef = require$$0.useRef(null);
|
|
3814
|
+
var wrapperRef = require$$0.useRef(null);
|
|
3777
3815
|
var cropAspectRatio = neetoCist.isPresent(fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) && neetoCist.isPresent(fixedAspectRatio.height) ? (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) / (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height) : 16 / 9;
|
|
3778
3816
|
var processCrop = function processCrop() {
|
|
3779
3817
|
if (isFullImage) {
|
|
@@ -3808,57 +3846,61 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
3808
3846
|
url: newURL
|
|
3809
3847
|
}));
|
|
3810
3848
|
};
|
|
3811
|
-
return /*#__PURE__*/
|
|
3812
|
-
className: "flex h-full flex-col gap-4 px-8 py-12"
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3849
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3850
|
+
className: "flex h-full flex-col gap-4 px-8 py-12",
|
|
3851
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
3852
|
+
className: "self-start",
|
|
3853
|
+
"data-cy": "image-editor-back-button",
|
|
3854
|
+
icon: neetoIcons.LeftArrow,
|
|
3855
|
+
iconPosition: "left",
|
|
3856
|
+
style: "text",
|
|
3857
|
+
onClick: handleReset
|
|
3858
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
3859
|
+
className: "flex h-full w-full flex-col gap-2 overflow-y-scroll md:flex-row md:overflow-y-auto",
|
|
3860
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
3861
|
+
id: "imageEditor",
|
|
3862
|
+
ref: wrapperRef,
|
|
3863
|
+
className: classnames__default["default"]("flex", "h-full w-full md:w-4/6", "justify-around", "neeto-ui-bg-gray-200", {
|
|
3864
|
+
"items-center": isItemsCenter({
|
|
3865
|
+
wrapperRef: wrapperRef,
|
|
3866
|
+
imageRef: imageRef
|
|
3867
|
+
})
|
|
3868
|
+
}),
|
|
3869
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ReactCrop, {
|
|
3870
|
+
crop: isFullImage ? null : crop,
|
|
3871
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
3872
|
+
aspect: isAspectRatioLocked ? aspectRatio.width / aspectRatio.height : 0,
|
|
3873
|
+
onChange: setCrop,
|
|
3874
|
+
onComplete: setCrop,
|
|
3875
|
+
children: /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
3876
|
+
alt: t("neetoImageUploader.common.image"),
|
|
3877
|
+
"data-cy": "image-editor-uploaded-image",
|
|
3878
|
+
ref: imageRef,
|
|
3879
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
3880
|
+
onLoad: function onLoad(e) {
|
|
3881
|
+
return onImageLoaded({
|
|
3882
|
+
image: e.target,
|
|
3883
|
+
setCrop: setCrop,
|
|
3884
|
+
cropAspectRatio: cropAspectRatio
|
|
3885
|
+
});
|
|
3886
|
+
}
|
|
3887
|
+
})
|
|
3888
|
+
})
|
|
3889
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Controls, {
|
|
3890
|
+
aspectRatio: aspectRatio,
|
|
3891
|
+
crop: crop,
|
|
3892
|
+
handleSubmit: handleSubmit,
|
|
3893
|
+
imageRef: imageRef,
|
|
3894
|
+
isAspectRatioLocked: isAspectRatioLocked,
|
|
3895
|
+
isFullImage: isFullImage,
|
|
3896
|
+
setAspectRatio: setAspectRatio,
|
|
3845
3897
|
setCrop: setCrop,
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
handleSubmit: handleSubmit,
|
|
3853
|
-
imageRef: imageRef,
|
|
3854
|
-
isAspectRatioLocked: isAspectRatioLocked,
|
|
3855
|
-
isFullImage: isFullImage,
|
|
3856
|
-
setAspectRatio: setAspectRatio,
|
|
3857
|
-
setCrop: setCrop,
|
|
3858
|
-
setIsFullImage: setIsFullImage,
|
|
3859
|
-
hideControls: neetoCist.isPresent(fixedAspectRatio),
|
|
3860
|
-
setAspectRatioLocked: setIsAspectRatioLocked
|
|
3861
|
-
})));
|
|
3898
|
+
setIsFullImage: setIsFullImage,
|
|
3899
|
+
hideControls: neetoCist.isPresent(fixedAspectRatio),
|
|
3900
|
+
setAspectRatioLocked: setIsAspectRatioLocked
|
|
3901
|
+
})]
|
|
3902
|
+
})]
|
|
3903
|
+
});
|
|
3862
3904
|
};
|
|
3863
3905
|
|
|
3864
3906
|
var fetch = function fetch(_ref) {
|
|
@@ -3878,20 +3920,24 @@ var imagesApi = {
|
|
|
3878
3920
|
fetch: fetch
|
|
3879
3921
|
};
|
|
3880
3922
|
|
|
3923
|
+
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; }
|
|
3924
|
+
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; }
|
|
3881
3925
|
var useFetchAssets = function useFetchAssets(_ref) {
|
|
3882
3926
|
var searchTerm = _ref.searchTerm,
|
|
3883
3927
|
url = _ref.url,
|
|
3884
3928
|
page = _ref.page,
|
|
3885
3929
|
per = _ref.per;
|
|
3886
3930
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
3887
|
-
return reactQuery.useQuery(
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3931
|
+
return reactQuery.useQuery(_objectSpread$3({
|
|
3932
|
+
queryKey: [QUERY_KEYS.ASSETS_LIST],
|
|
3933
|
+
queryFn: function queryFn() {
|
|
3934
|
+
return imagesApi.fetch({
|
|
3935
|
+
searchTerm: searchTerm,
|
|
3936
|
+
url: url,
|
|
3937
|
+
page: page,
|
|
3938
|
+
per: per
|
|
3939
|
+
});
|
|
3940
|
+
},
|
|
3895
3941
|
staleTime: ASSETS_STALE_TIME
|
|
3896
3942
|
}, options));
|
|
3897
3943
|
};
|
|
@@ -4192,7 +4238,7 @@ InfiniteScroll.exports;
|
|
|
4192
4238
|
|
|
4193
4239
|
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; }; }();
|
|
4194
4240
|
|
|
4195
|
-
var _react =
|
|
4241
|
+
var _react = require$$0__default["default"];
|
|
4196
4242
|
|
|
4197
4243
|
var _react2 = _interopRequireDefault(_react);
|
|
4198
4244
|
|
|
@@ -4497,7 +4543,7 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
4497
4543
|
|
|
4498
4544
|
var _class, _temp2;
|
|
4499
4545
|
|
|
4500
|
-
var _react =
|
|
4546
|
+
var _react = require$$0__default["default"];
|
|
4501
4547
|
|
|
4502
4548
|
var _react2 = _interopRequireDefault(_react);
|
|
4503
4549
|
|
|
@@ -4667,72 +4713,80 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
4667
4713
|
handleUnsplashImageSelect = _ref$handleUnsplashIm === void 0 ? neetoCist.noop : _ref$handleUnsplashIm;
|
|
4668
4714
|
var _useTranslation = reactI18next.useTranslation(),
|
|
4669
4715
|
t = _useTranslation.t;
|
|
4670
|
-
var Loader = /*#__PURE__*/
|
|
4671
|
-
className: "flex justify-center"
|
|
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
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4716
|
+
var Loader = /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4717
|
+
className: "flex justify-center",
|
|
4718
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
|
|
4719
|
+
});
|
|
4720
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4721
|
+
className: "niu-unsplash-container mr-2 max-w-full overflow-x-hidden overflow-y-scroll",
|
|
4722
|
+
children: /*#__PURE__*/jsxRuntime.jsx(_default, {
|
|
4723
|
+
hasMore: hasMore,
|
|
4724
|
+
loadMore: loadMore,
|
|
4725
|
+
pack: true,
|
|
4726
|
+
position: true,
|
|
4727
|
+
className: "w-full",
|
|
4728
|
+
loader: Loader,
|
|
4729
|
+
sizes: INFINITE_SCROLLER_SIZES,
|
|
4730
|
+
style: INFINITE_SCROLLER_STYLE,
|
|
4731
|
+
useWindow: false,
|
|
4732
|
+
children: images.map(function (image, index) {
|
|
4733
|
+
var _image$urls, _image$user, _image$user2;
|
|
4734
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4735
|
+
className: "float-left w-1/2 pb-4 pr-4 md:w-1/4",
|
|
4736
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
4737
|
+
className: "relative w-full",
|
|
4738
|
+
style: {
|
|
4739
|
+
paddingBottom: "".concat(image.height / image.width * 100, "%")
|
|
4740
|
+
},
|
|
4741
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
4742
|
+
className: "neeto-ui-rounded-sm neeto-ui-bg-gray-100 group absolute h-full w-full",
|
|
4743
|
+
id: "unsplashImage".concat(image.id),
|
|
4744
|
+
children: [tab === TABS[1].key && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
4745
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("img", {
|
|
4746
|
+
"data-cy": "niu-unsplash-image-".concat(index),
|
|
4747
|
+
src: image === null || image === void 0 || (_image$urls = image.urls) === null || _image$urls === void 0 ? void 0 : _image$urls.regular,
|
|
4748
|
+
onClick: function onClick() {
|
|
4749
|
+
return handleUnsplashImageSelect(image);
|
|
4750
|
+
}
|
|
4751
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("a", {
|
|
4752
|
+
className: "neeto-ui-text-gray-100 absolute bottom-2 left-2 m-auto text-xs underline opacity-0 group-hover:opacity-100",
|
|
4753
|
+
href: "https://unsplash.com/@".concat(image === null || image === void 0 || (_image$user = image.user) === null || _image$user === void 0 ? void 0 : _image$user.username),
|
|
4754
|
+
rel: "noreferrer",
|
|
4755
|
+
target: "_blank",
|
|
4756
|
+
children: [image === null || image === void 0 || (_image$user2 = image.user) === null || _image$user2 === void 0 ? void 0 : _image$user2.name, " | ", " ", t("neetoImageUploader.labels.unsplash")]
|
|
4757
|
+
})]
|
|
4758
|
+
}), tab === TABS[0].key && /*#__PURE__*/jsxRuntime.jsx("img", {
|
|
4759
|
+
"data-cy": "niu-library-image-".concat(index),
|
|
4760
|
+
src: image === null || image === void 0 ? void 0 : image.url,
|
|
4761
|
+
onClick: function onClick() {
|
|
4762
|
+
return setSelectedImage(image);
|
|
4763
|
+
}
|
|
4764
|
+
})]
|
|
4765
|
+
})
|
|
4766
|
+
})
|
|
4767
|
+
}, image.id);
|
|
4768
|
+
})
|
|
4769
|
+
})
|
|
4770
|
+
});
|
|
4717
4771
|
};
|
|
4718
4772
|
|
|
4719
4773
|
var Images = function Images(_ref) {
|
|
4720
4774
|
var query = _ref.query,
|
|
4721
4775
|
debouncedQuery = _ref.debouncedQuery,
|
|
4722
4776
|
setSelectedImage = _ref.setSelectedImage;
|
|
4723
|
-
var _useState =
|
|
4777
|
+
var _useState = require$$0.useState(true),
|
|
4724
4778
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
4725
4779
|
hasMore = _useState2[0],
|
|
4726
4780
|
setHasMore = _useState2[1];
|
|
4727
|
-
var _useState3 =
|
|
4781
|
+
var _useState3 = require$$0.useState([]),
|
|
4728
4782
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
4729
4783
|
images = _useState4[0],
|
|
4730
4784
|
setImages = _useState4[1];
|
|
4731
|
-
var _useState5 =
|
|
4785
|
+
var _useState5 = require$$0.useState(1),
|
|
4732
4786
|
_useState6 = _slicedToArray$2(_useState5, 2),
|
|
4733
4787
|
pageNo = _useState6[0],
|
|
4734
4788
|
setPageNo = _useState6[1];
|
|
4735
|
-
var _useState7 =
|
|
4789
|
+
var _useState7 = require$$0.useState(false),
|
|
4736
4790
|
_useState8 = _slicedToArray$2(_useState7, 2),
|
|
4737
4791
|
error = _useState8[0],
|
|
4738
4792
|
setError = _useState8[1];
|
|
@@ -4766,20 +4820,21 @@ var Images = function Images(_ref) {
|
|
|
4766
4820
|
refetch();
|
|
4767
4821
|
}
|
|
4768
4822
|
}, 500);
|
|
4769
|
-
|
|
4823
|
+
require$$0.useEffect(function () {
|
|
4770
4824
|
setPageNo(1);
|
|
4771
4825
|
}, [query]);
|
|
4772
|
-
|
|
4826
|
+
require$$0.useEffect(function () {
|
|
4773
4827
|
setImages([]);
|
|
4774
4828
|
refetch();
|
|
4775
4829
|
}, [debouncedQuery]);
|
|
4776
4830
|
if (error) {
|
|
4777
|
-
return /*#__PURE__*/
|
|
4831
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
4778
4832
|
className: "mt-9 flex justify-center",
|
|
4779
|
-
style: "body2"
|
|
4780
|
-
|
|
4833
|
+
style: "body2",
|
|
4834
|
+
children: t("neetoImageUploader.unsplash.errorMessage")
|
|
4835
|
+
});
|
|
4781
4836
|
}
|
|
4782
|
-
return /*#__PURE__*/
|
|
4837
|
+
return /*#__PURE__*/jsxRuntime.jsx(InfiniteScroller, {
|
|
4783
4838
|
hasMore: hasMore,
|
|
4784
4839
|
images: images,
|
|
4785
4840
|
loadMore: loadMore,
|
|
@@ -4809,17 +4864,21 @@ var unsplashApi = {
|
|
|
4809
4864
|
getUnsplashImage: getUnsplashImage
|
|
4810
4865
|
};
|
|
4811
4866
|
|
|
4867
|
+
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; }
|
|
4868
|
+
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; }
|
|
4812
4869
|
var UNSPLASH_LIST = QUERY_KEYS.UNSPLASH_LIST;
|
|
4813
4870
|
var useFetchUnsplashImages = function useFetchUnsplashImages(_ref) {
|
|
4814
4871
|
var pageNo = _ref.pageNo,
|
|
4815
4872
|
query = _ref.query;
|
|
4816
4873
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4817
|
-
return reactQuery.useQuery(
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4874
|
+
return reactQuery.useQuery(_objectSpread$2({
|
|
4875
|
+
queryKey: [UNSPLASH_LIST],
|
|
4876
|
+
queryFn: function queryFn() {
|
|
4877
|
+
return unsplashApi.searchUnsplashImages({
|
|
4878
|
+
pageNo: pageNo,
|
|
4879
|
+
query: query
|
|
4880
|
+
});
|
|
4881
|
+
},
|
|
4823
4882
|
staleTime: UNSPLASH_STALE_TIME
|
|
4824
4883
|
}, options));
|
|
4825
4884
|
};
|
|
@@ -4872,19 +4931,19 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
4872
4931
|
setSelectedImage = _ref.setSelectedImage,
|
|
4873
4932
|
setIsUploading = _ref.setIsUploading,
|
|
4874
4933
|
setActiveTab = _ref.setActiveTab;
|
|
4875
|
-
var _useState =
|
|
4934
|
+
var _useState = require$$0.useState(true),
|
|
4876
4935
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
4877
4936
|
hasMore = _useState2[0],
|
|
4878
4937
|
setHasMore = _useState2[1];
|
|
4879
|
-
var _useState3 =
|
|
4938
|
+
var _useState3 = require$$0.useState([]),
|
|
4880
4939
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
4881
4940
|
images = _useState4[0],
|
|
4882
4941
|
setImages = _useState4[1];
|
|
4883
|
-
var _useState5 =
|
|
4942
|
+
var _useState5 = require$$0.useState(1),
|
|
4884
4943
|
_useState6 = _slicedToArray$2(_useState5, 2),
|
|
4885
4944
|
pageNo = _useState6[0],
|
|
4886
4945
|
setPageNo = _useState6[1];
|
|
4887
|
-
var _useState7 =
|
|
4946
|
+
var _useState7 = require$$0.useState(false),
|
|
4888
4947
|
_useState8 = _slicedToArray$2(_useState7, 2),
|
|
4889
4948
|
error = _useState8[0],
|
|
4890
4949
|
setError = _useState8[1];
|
|
@@ -4934,7 +4993,7 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
4934
4993
|
case 19:
|
|
4935
4994
|
_context.prev = 19;
|
|
4936
4995
|
_context.t1 = _context["catch"](0);
|
|
4937
|
-
|
|
4996
|
+
Toastr__default["default"].error(_context.t1);
|
|
4938
4997
|
setActiveTab(TABS[0].key);
|
|
4939
4998
|
case 23:
|
|
4940
4999
|
_context.prev = 23;
|
|
@@ -4971,21 +5030,22 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
4971
5030
|
refetch();
|
|
4972
5031
|
}
|
|
4973
5032
|
}, 500);
|
|
4974
|
-
|
|
5033
|
+
require$$0.useEffect(function () {
|
|
4975
5034
|
setPageNo(1);
|
|
4976
5035
|
}, [query]);
|
|
4977
|
-
|
|
5036
|
+
require$$0.useEffect(function () {
|
|
4978
5037
|
setPageNo(1);
|
|
4979
5038
|
setImages([]);
|
|
4980
5039
|
refetch();
|
|
4981
5040
|
}, [debouncedQuery]);
|
|
4982
5041
|
if (error) {
|
|
4983
|
-
return /*#__PURE__*/
|
|
5042
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
4984
5043
|
className: "mt-9 flex justify-center",
|
|
4985
|
-
style: "body2"
|
|
4986
|
-
|
|
5044
|
+
style: "body2",
|
|
5045
|
+
children: t("neetoImageUploader.unsplash.errorMessage")
|
|
5046
|
+
});
|
|
4987
5047
|
}
|
|
4988
|
-
return /*#__PURE__*/
|
|
5048
|
+
return /*#__PURE__*/jsxRuntime.jsx(InfiniteScroller, {
|
|
4989
5049
|
handleUnsplashImageSelect: handleUnsplashImageSelect,
|
|
4990
5050
|
hasMore: hasMore,
|
|
4991
5051
|
images: images,
|
|
@@ -4999,7 +5059,7 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
4999
5059
|
tab = _ref.tab,
|
|
5000
5060
|
setIsUploading = _ref.setIsUploading,
|
|
5001
5061
|
setActiveTab = _ref.setActiveTab;
|
|
5002
|
-
var _useState =
|
|
5062
|
+
var _useState = require$$0.useState(""),
|
|
5003
5063
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
5004
5064
|
query = _useState2[0],
|
|
5005
5065
|
setQuery = _useState2[1];
|
|
@@ -5007,36 +5067,39 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
5007
5067
|
t = _useTranslation.t;
|
|
5008
5068
|
var debouncedQuery = reactUtils.useDebounce(query, 400);
|
|
5009
5069
|
var inputPlaceHolder = ramda.equals(tab, TABS[1].key) ? t("neetoImageUploader.placeholders.searchImageFromWeb") : t("neetoImageUploader.placeholders.searchImage");
|
|
5010
|
-
|
|
5070
|
+
require$$0.useEffect(function () {
|
|
5011
5071
|
setQuery("");
|
|
5012
5072
|
}, [tab]);
|
|
5013
|
-
return /*#__PURE__*/
|
|
5014
|
-
className: "w-full pb-2 pl-6 pt-1"
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5073
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5074
|
+
className: "w-full pb-2 pl-6 pt-1",
|
|
5075
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
5076
|
+
autoFocus: true,
|
|
5077
|
+
className: "mb-4 mr-6",
|
|
5078
|
+
"data-cy": "niu-unsplash-image-picker-search-input",
|
|
5079
|
+
name: "text",
|
|
5080
|
+
placeholder: inputPlaceHolder,
|
|
5081
|
+
value: query,
|
|
5082
|
+
onChange: function onChange(_ref2) {
|
|
5083
|
+
var value = _ref2.target.value;
|
|
5084
|
+
return setQuery(value);
|
|
5085
|
+
}
|
|
5086
|
+
}), tab === TABS[0].key ? /*#__PURE__*/jsxRuntime.jsx(Images, {
|
|
5087
|
+
debouncedQuery: debouncedQuery,
|
|
5088
|
+
query: query,
|
|
5089
|
+
setSelectedImage: setSelectedImage
|
|
5090
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(UnsplashLibrary, {
|
|
5091
|
+
debouncedQuery: debouncedQuery,
|
|
5092
|
+
query: query,
|
|
5093
|
+
setActiveTab: setActiveTab,
|
|
5094
|
+
setIsUploading: setIsUploading,
|
|
5095
|
+
setSelectedImage: setSelectedImage
|
|
5096
|
+
})]
|
|
5097
|
+
});
|
|
5037
5098
|
};
|
|
5038
5099
|
|
|
5039
5100
|
var _excluded$1 = ["key"];
|
|
5101
|
+
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; }
|
|
5102
|
+
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; }
|
|
5040
5103
|
var Modal = function Modal(_ref) {
|
|
5041
5104
|
var isOpen = _ref.isOpen,
|
|
5042
5105
|
_ref$onClose = _ref.onClose,
|
|
@@ -5047,15 +5110,15 @@ var Modal = function Modal(_ref) {
|
|
|
5047
5110
|
uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig,
|
|
5048
5111
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
5049
5112
|
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
|
|
5050
|
-
var _useState =
|
|
5113
|
+
var _useState = require$$0.useState(TABS[0].key),
|
|
5051
5114
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
5052
5115
|
activeTab = _useState2[0],
|
|
5053
5116
|
setActiveTab = _useState2[1];
|
|
5054
|
-
var _useState3 =
|
|
5117
|
+
var _useState3 = require$$0.useState({}),
|
|
5055
5118
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
5056
5119
|
selectedImage = _useState4[0],
|
|
5057
5120
|
setSelectedImage = _useState4[1];
|
|
5058
|
-
var _useState5 =
|
|
5121
|
+
var _useState5 = require$$0.useState(false),
|
|
5059
5122
|
_useState6 = _slicedToArray$2(_useState5, 2),
|
|
5060
5123
|
isUploading = _useState6[0],
|
|
5061
5124
|
setIsUploading = _useState6[1];
|
|
@@ -5090,7 +5153,7 @@ var Modal = function Modal(_ref) {
|
|
|
5090
5153
|
signedId: image.signedId
|
|
5091
5154
|
});
|
|
5092
5155
|
},
|
|
5093
|
-
onError:
|
|
5156
|
+
onError: Toastr__default["default"].error
|
|
5094
5157
|
});
|
|
5095
5158
|
}
|
|
5096
5159
|
handleCloseModal();
|
|
@@ -5116,84 +5179,104 @@ var Modal = function Modal(_ref) {
|
|
|
5116
5179
|
key: "local",
|
|
5117
5180
|
onClick: openFileUploadDialog
|
|
5118
5181
|
}]);
|
|
5119
|
-
|
|
5182
|
+
require$$0.useEffect(function () {
|
|
5120
5183
|
setActiveTab(TABS[0].key);
|
|
5121
5184
|
}, [isOpen]);
|
|
5122
|
-
return /*#__PURE__*/
|
|
5185
|
+
return /*#__PURE__*/jsxRuntime.jsxs(NeetoUIModal__default["default"], {
|
|
5123
5186
|
isOpen: isOpen,
|
|
5124
5187
|
className: "niu-modal",
|
|
5125
5188
|
size: "large",
|
|
5126
|
-
onClose: handleCloseModal
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
return setSelectedImage({});
|
|
5136
|
-
},
|
|
5137
|
-
image: selectedImage,
|
|
5138
|
-
signedId: selectedImage === null || selectedImage === void 0 ? void 0 : selectedImage.signedId
|
|
5139
|
-
}) : /*#__PURE__*/React__default["default"].createElement("div", _extends$1({
|
|
5140
|
-
className: "h-full flex-col"
|
|
5141
|
-
}, getRootProps({
|
|
5142
|
-
onClick: function onClick(event) {
|
|
5143
|
-
return event.stopPropagation();
|
|
5144
|
-
}
|
|
5145
|
-
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Header, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5146
|
-
style: "h2"
|
|
5147
|
-
}, t("neetoImageUploader.common.imageLibrary"))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5148
|
-
className: "px-6 py-2"
|
|
5149
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5150
|
-
className: "flex flex-col items-center justify-between gap-2 sm:flex-row"
|
|
5151
|
-
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5152
|
-
className: "flex gap-2"
|
|
5153
|
-
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Tab, {
|
|
5154
|
-
size: "small"
|
|
5155
|
-
}, TABS.map(function (tab) {
|
|
5156
|
-
return /*#__PURE__*/React__default["default"].createElement(neetoui.Tab.Item, {
|
|
5157
|
-
active: activeTab === tab.key,
|
|
5158
|
-
"data-cy": tab.dataCy,
|
|
5159
|
-
key: tab.key,
|
|
5160
|
-
onClick: function onClick() {
|
|
5161
|
-
return setActiveTab(tab.key);
|
|
5162
|
-
}
|
|
5163
|
-
}, tab.label);
|
|
5164
|
-
}))), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
5165
|
-
className: "flex gap-2"
|
|
5166
|
-
}, options.map(function (_ref2) {
|
|
5167
|
-
var key = _ref2.key,
|
|
5168
|
-
otherProps = _objectWithoutProperties$2(_ref2, _excluded$1);
|
|
5169
|
-
return /*#__PURE__*/React__default["default"].createElement(neetoui.Button, _extends$1({}, otherProps, {
|
|
5170
|
-
key: key,
|
|
5171
|
-
size: "small"
|
|
5172
|
-
}));
|
|
5173
|
-
})))), /*#__PURE__*/React__default["default"].createElement(ImageLibrary, {
|
|
5174
|
-
setActiveTab: setActiveTab,
|
|
5175
|
-
setIsUploading: setIsUploading,
|
|
5176
|
-
setSelectedImage: setSelectedImage,
|
|
5177
|
-
tab: activeTab
|
|
5178
|
-
}), ramda.equals(activeTab, TABS[1].key) && /*#__PURE__*/React__default["default"].createElement(neetoui.Modal.Footer, {
|
|
5179
|
-
className: "flex items-center justify-center gap-2"
|
|
5180
|
-
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5181
|
-
style: "body2"
|
|
5182
|
-
}, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
5183
|
-
i18nKey: "neetoImageUploader.unsplash.poweredByUnsplash",
|
|
5184
|
-
components: {
|
|
5185
|
-
a: /*#__PURE__*/React__default["default"].createElement("a", {
|
|
5186
|
-
href: UNSPLASH_URL,
|
|
5187
|
-
rel: "noreferrer",
|
|
5188
|
-
target: "_blank"
|
|
5189
|
+
onClose: handleCloseModal,
|
|
5190
|
+
children: [isUploading && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5191
|
+
className: "neeto-ui-bg-gray-400 absolute inset-0 z-50 flex h-full items-center justify-center opacity-50",
|
|
5192
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
|
|
5193
|
+
}), isNilOrEmpty(selectedImage) && isDragActive && /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread$1(_objectSpread$1({
|
|
5194
|
+
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"
|
|
5195
|
+
}, getRootProps()), {}, {
|
|
5196
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
5197
|
+
children: t("neetoImageUploader.common.dropHere")
|
|
5189
5198
|
})
|
|
5190
|
-
}
|
|
5191
|
-
|
|
5199
|
+
})), !isNilOrEmpty(selectedImage) ? /*#__PURE__*/jsxRuntime.jsx(ImageEditor, {
|
|
5200
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
5201
|
+
handleImageEditComplete: handleImageEditComplete,
|
|
5202
|
+
handleReset: function handleReset() {
|
|
5203
|
+
return setSelectedImage({});
|
|
5204
|
+
},
|
|
5205
|
+
image: selectedImage,
|
|
5206
|
+
signedId: selectedImage === null || selectedImage === void 0 ? void 0 : selectedImage.signedId
|
|
5207
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs("div", _objectSpread$1(_objectSpread$1({
|
|
5208
|
+
className: "h-full flex-col"
|
|
5209
|
+
}, getRootProps({
|
|
5210
|
+
onClick: function onClick(event) {
|
|
5211
|
+
return event.stopPropagation();
|
|
5212
|
+
}
|
|
5213
|
+
})), {}, {
|
|
5214
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(NeetoUIModal__default["default"].Header, {
|
|
5215
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
5216
|
+
style: "h2",
|
|
5217
|
+
children: t("neetoImageUploader.common.imageLibrary")
|
|
5218
|
+
})
|
|
5219
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5220
|
+
className: "px-6 py-2",
|
|
5221
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5222
|
+
className: "flex flex-col items-center justify-between gap-2 sm:flex-row",
|
|
5223
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5224
|
+
className: "flex gap-2",
|
|
5225
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Tab__default["default"], {
|
|
5226
|
+
size: "small",
|
|
5227
|
+
children: TABS.map(function (tab) {
|
|
5228
|
+
return /*#__PURE__*/jsxRuntime.jsx(Tab__default["default"].Item, {
|
|
5229
|
+
active: activeTab === tab.key,
|
|
5230
|
+
"data-cy": tab.dataCy,
|
|
5231
|
+
onClick: function onClick() {
|
|
5232
|
+
return setActiveTab(tab.key);
|
|
5233
|
+
},
|
|
5234
|
+
children: tab.label
|
|
5235
|
+
}, tab.key);
|
|
5236
|
+
})
|
|
5237
|
+
})
|
|
5238
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
5239
|
+
className: "flex gap-2",
|
|
5240
|
+
children: options.map(function (_ref2) {
|
|
5241
|
+
var key = _ref2.key,
|
|
5242
|
+
otherProps = _objectWithoutProperties$2(_ref2, _excluded$1);
|
|
5243
|
+
return /*#__PURE__*/require$$0.createElement(Button__default["default"], _objectSpread$1(_objectSpread$1({}, otherProps), {}, {
|
|
5244
|
+
key: key,
|
|
5245
|
+
size: "small"
|
|
5246
|
+
}));
|
|
5247
|
+
})
|
|
5248
|
+
})]
|
|
5249
|
+
})
|
|
5250
|
+
}), /*#__PURE__*/jsxRuntime.jsx(ImageLibrary, {
|
|
5251
|
+
setActiveTab: setActiveTab,
|
|
5252
|
+
setIsUploading: setIsUploading,
|
|
5253
|
+
setSelectedImage: setSelectedImage,
|
|
5254
|
+
tab: activeTab
|
|
5255
|
+
}), ramda.equals(activeTab, TABS[1].key) && /*#__PURE__*/jsxRuntime.jsx(NeetoUIModal__default["default"].Footer, {
|
|
5256
|
+
className: "flex items-center justify-center gap-2",
|
|
5257
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
5258
|
+
style: "body2",
|
|
5259
|
+
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
5260
|
+
i18nKey: "neetoImageUploader.unsplash.poweredByUnsplash",
|
|
5261
|
+
components: {
|
|
5262
|
+
a: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
5263
|
+
href: UNSPLASH_URL,
|
|
5264
|
+
rel: "noreferrer",
|
|
5265
|
+
target: "_blank"
|
|
5266
|
+
})
|
|
5267
|
+
}
|
|
5268
|
+
})
|
|
5269
|
+
})
|
|
5270
|
+
})]
|
|
5271
|
+
})), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread$1({}, getInputProps()))]
|
|
5272
|
+
});
|
|
5192
5273
|
};
|
|
5193
5274
|
|
|
5194
5275
|
var _excluded = ["key", "label"];
|
|
5195
|
-
var
|
|
5196
|
-
|
|
5276
|
+
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; }
|
|
5277
|
+
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; }
|
|
5278
|
+
var Menu = Dropdown__default["default"].Menu,
|
|
5279
|
+
MenuItem = Dropdown__default["default"].MenuItem;
|
|
5197
5280
|
var ImageUploader = function ImageUploader(_ref) {
|
|
5198
5281
|
var _ref$onUploadComplete = _ref.onUploadComplete,
|
|
5199
5282
|
onUploadComplete = _ref$onUploadComplete === void 0 ? neetoCist.noop : _ref$onUploadComplete,
|
|
@@ -5205,11 +5288,11 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
5205
5288
|
uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig,
|
|
5206
5289
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
5207
5290
|
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
|
|
5208
|
-
var _useState =
|
|
5291
|
+
var _useState = require$$0.useState(false),
|
|
5209
5292
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
5210
5293
|
isAssetLibraryOpen = _useState2[0],
|
|
5211
5294
|
setIsAssetLibraryOpen = _useState2[1];
|
|
5212
|
-
var _useState3 =
|
|
5295
|
+
var _useState3 = require$$0.useState({
|
|
5213
5296
|
url: src
|
|
5214
5297
|
}),
|
|
5215
5298
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
@@ -5270,7 +5353,7 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
5270
5353
|
};
|
|
5271
5354
|
createBlob(payload, {
|
|
5272
5355
|
onSuccess: handleSuccess,
|
|
5273
|
-
onError:
|
|
5356
|
+
onError: Toastr__default["default"].error
|
|
5274
5357
|
});
|
|
5275
5358
|
};
|
|
5276
5359
|
var _useImageUploader = useImageUploader({
|
|
@@ -5290,53 +5373,58 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
5290
5373
|
onClick: handleDelete,
|
|
5291
5374
|
"data-cy": "image-uploader-remove-button"
|
|
5292
5375
|
}];
|
|
5293
|
-
return /*#__PURE__*/
|
|
5376
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5294
5377
|
className: classnames__default["default"](className, {
|
|
5295
5378
|
"cursor-pointer": true
|
|
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
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5379
|
+
}),
|
|
5380
|
+
children: [isNotNilOrEmpty(image.url) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
5381
|
+
className: IMAGE_WRAPPER_CLASSNAME,
|
|
5382
|
+
"data-cy": "image-uploader-wrapper",
|
|
5383
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(ImageWithFallback, {
|
|
5384
|
+
className: "h-full w-full",
|
|
5385
|
+
"data-cy": "uploaded-image",
|
|
5386
|
+
src: image.url
|
|
5387
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Dropdown__default["default"], {
|
|
5388
|
+
buttonProps: {
|
|
5389
|
+
className: "absolute right-3 top-3"
|
|
5390
|
+
},
|
|
5391
|
+
buttonSize: "small",
|
|
5392
|
+
buttonStyle: "primary",
|
|
5393
|
+
icon: neetoIcons.MenuHorizontal,
|
|
5394
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Menu, {
|
|
5395
|
+
children: options.map(function (_ref2) {
|
|
5396
|
+
var key = _ref2.key,
|
|
5397
|
+
label = _ref2.label,
|
|
5398
|
+
otherProps = _objectWithoutProperties$2(_ref2, _excluded);
|
|
5399
|
+
return /*#__PURE__*/require$$0.createElement(MenuItem.Button, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
5400
|
+
key: key
|
|
5401
|
+
}), label);
|
|
5402
|
+
})
|
|
5403
|
+
})
|
|
5404
|
+
})]
|
|
5405
|
+
}) : /*#__PURE__*/jsxRuntime.jsx(ImageDirectUpload, {
|
|
5406
|
+
setIsAssetLibraryOpen: setIsAssetLibraryOpen,
|
|
5407
|
+
isDisabled: neetoCist.isPresent(fixedAspectRatio),
|
|
5408
|
+
uploadConfig: uploadConfigWithDefaults,
|
|
5409
|
+
onDrop: uploadFile
|
|
5410
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Modal, {
|
|
5411
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
5412
|
+
isOpen: isAssetLibraryOpen,
|
|
5413
|
+
uploadConfig: uploadConfigWithDefaults,
|
|
5414
|
+
onClose: function onClose() {
|
|
5415
|
+
return setIsAssetLibraryOpen(false);
|
|
5416
|
+
},
|
|
5417
|
+
onUploadComplete: handleImageSelectionFromLibrary
|
|
5418
|
+
})]
|
|
5419
|
+
});
|
|
5332
5420
|
};
|
|
5333
5421
|
|
|
5334
5422
|
var useImageUpload = function useImageUpload() {
|
|
5335
|
-
var _useState =
|
|
5423
|
+
var _useState = require$$0.useState(0),
|
|
5336
5424
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
5337
5425
|
uploadProgress = _useState2[0],
|
|
5338
5426
|
setUploadProgress = _useState2[1];
|
|
5339
|
-
var _useState3 =
|
|
5427
|
+
var _useState3 = require$$0.useState(false),
|
|
5340
5428
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
5341
5429
|
isUploading = _useState4[0],
|
|
5342
5430
|
setIsUploading = _useState4[1];
|
|
@@ -5372,7 +5460,7 @@ var useImageUpload = function useImageUpload() {
|
|
|
5372
5460
|
}));
|
|
5373
5461
|
});
|
|
5374
5462
|
} catch (error) {
|
|
5375
|
-
|
|
5463
|
+
Toastr__default["default"].error(error);
|
|
5376
5464
|
} finally {
|
|
5377
5465
|
setIsUploading(false);
|
|
5378
5466
|
}
|
|
@@ -5411,14 +5499,14 @@ var useImageUpload = function useImageUpload() {
|
|
|
5411
5499
|
};
|
|
5412
5500
|
createBlob(payload, {
|
|
5413
5501
|
onSuccess: onUploadComplete,
|
|
5414
|
-
onError:
|
|
5502
|
+
onError: Toastr__default["default"].error
|
|
5415
5503
|
});
|
|
5416
5504
|
_context.next = 13;
|
|
5417
5505
|
break;
|
|
5418
5506
|
case 10:
|
|
5419
5507
|
_context.prev = 10;
|
|
5420
5508
|
_context.t0 = _context["catch"](0);
|
|
5421
|
-
|
|
5509
|
+
Toastr__default["default"].error(_context.t0);
|
|
5422
5510
|
case 13:
|
|
5423
5511
|
_context.prev = 13;
|
|
5424
5512
|
setIsUploading(false);
|
|
@@ -5477,11 +5565,11 @@ var useImageUpload = function useImageUpload() {
|
|
|
5477
5565
|
var useProfileImageUpload = function useProfileImageUpload(_ref) {
|
|
5478
5566
|
var _ref$uploadConfig = _ref.uploadConfig,
|
|
5479
5567
|
uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig;
|
|
5480
|
-
var _useState =
|
|
5568
|
+
var _useState = require$$0.useState(0),
|
|
5481
5569
|
_useState2 = _slicedToArray$2(_useState, 2),
|
|
5482
5570
|
uploadProgress = _useState2[0],
|
|
5483
5571
|
setUploadProgress = _useState2[1];
|
|
5484
|
-
var _useState3 =
|
|
5572
|
+
var _useState3 = require$$0.useState(false),
|
|
5485
5573
|
_useState4 = _slicedToArray$2(_useState3, 2),
|
|
5486
5574
|
isUploading = _useState4[0],
|
|
5487
5575
|
setIsUploading = _useState4[1];
|
|
@@ -5529,7 +5617,7 @@ var useProfileImageUpload = function useProfileImageUpload(_ref) {
|
|
|
5529
5617
|
_context.prev = 9;
|
|
5530
5618
|
_context.t0 = _context["catch"](0);
|
|
5531
5619
|
errorMessage = ramda.equals(_context.t0.message, i18next.t("neetoImageUploader.errors.sdkKeysMissing")) ? i18next.t("neetoImageUploader.errors.imagekitKeysMissing") : _context.t0.message;
|
|
5532
|
-
|
|
5620
|
+
Toastr__default["default"].error(errorMessage);
|
|
5533
5621
|
case 13:
|
|
5534
5622
|
_context.prev = 13;
|
|
5535
5623
|
setIsUploading(false);
|