@bigbinary/neeto-image-uploader-frontend 2.3.9 → 2.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AssetLibrary.js +5 -5
- package/dist/BasicImageUploader.js +3 -3
- package/dist/ImageUploader.js +6 -6
- package/dist/{ImageWithFallback-1ddf3f25.js → ImageWithFallback-Dz9cyV2n.js} +16 -26
- package/dist/{ImageWithFallback-1ddf3f25.js.map → ImageWithFallback-Dz9cyV2n.js.map} +1 -1
- package/dist/{ImageWithFallback-933ea4b1.js → ImageWithFallback-c9ANE1IE.js} +2 -2
- package/dist/{ImageWithFallback-933ea4b1.js.map → ImageWithFallback-c9ANE1IE.js.map} +1 -1
- package/dist/cjs/AssetLibrary.js +5 -5
- package/dist/cjs/BasicImageUploader.js +8 -16
- package/dist/cjs/BasicImageUploader.js.map +1 -1
- package/dist/cjs/ImageUploader.js +17 -28
- package/dist/cjs/ImageUploader.js.map +1 -1
- package/dist/cjs/hooks.js +4 -6
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/index.js +7 -9
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils.js +1 -3
- package/dist/cjs/utils.js.map +1 -1
- package/dist/hooks.js +4 -4
- package/dist/{index-cf7e4b89.js → index-BtHfh_eu.js} +2 -3
- package/dist/{index-cf7e4b89.js.map → index-BtHfh_eu.js.map} +1 -1
- package/dist/{index-9fdcdfac.js → index-By7BkNOh.js} +69 -96
- package/dist/index-By7BkNOh.js.map +1 -0
- package/dist/{index-8605e11c.js → index-CZjb2iXB.js} +2 -3
- package/dist/{index-8605e11c.js.map → index-CZjb2iXB.js.map} +1 -1
- package/dist/{index-a3668c72.js → index-vkjNhoF3.js} +7 -11
- package/dist/index-vkjNhoF3.js.map +1 -0
- package/dist/index.js +7 -7
- package/dist/{query-dcc7b81b.js → query-B0eDmse7.js} +1 -1
- package/dist/{query-dcc7b81b.js.map → query-B0eDmse7.js.map} +1 -1
- package/dist/{query-3c31bf92.js → query-B7ahlELA.js} +1 -1
- package/dist/{query-3c31bf92.js.map → query-B7ahlELA.js.map} +1 -1
- package/dist/{useImageUploader-49fd1436.js → useImageUploader-Bm9TukCy.js} +16 -24
- package/dist/useImageUploader-Bm9TukCy.js.map +1 -0
- package/dist/{useImageUploader-9c1a27d0.js → useImageUploader-RX88_Cp-.js} +4 -4
- package/dist/{useImageUploader-9c1a27d0.js.map → useImageUploader-RX88_Cp-.js.map} +1 -1
- package/dist/{useProfileImageUpload-faa539d7.js → useProfileImageUpload-KpvcwEqx.js} +3 -3
- package/dist/{useProfileImageUpload-faa539d7.js.map → useProfileImageUpload-KpvcwEqx.js.map} +1 -1
- package/dist/{useProfileImageUpload-9c1d2b0f.js → useProfileImageUpload-UUrg2Lkw.js} +19 -26
- package/dist/useProfileImageUpload-UUrg2Lkw.js.map +1 -0
- package/dist/{utils-fa0fa918.js → utils-B5WMTXlT.js} +3 -3
- package/dist/{utils-fa0fa918.js.map → utils-B5WMTXlT.js.map} +1 -1
- package/dist/{utils-ede1695e.js → utils-tPaqWDxV.js} +7 -13
- package/dist/{utils-ede1695e.js.map → utils-tPaqWDxV.js.map} +1 -1
- package/dist/utils.js +1 -1
- package/package.json +11 -11
- package/dist/index-9fdcdfac.js.map +0 -1
- package/dist/index-a3668c72.js.map +0 -1
- package/dist/useImageUploader-49fd1436.js.map +0 -1
- package/dist/useProfileImageUpload-9c1d2b0f.js.map +0 -1
|
@@ -14,9 +14,9 @@ var Toastr = require('@bigbinary/neetoui/Toastr');
|
|
|
14
14
|
var Typography = require('@bigbinary/neetoui/Typography');
|
|
15
15
|
var ramda = require('ramda');
|
|
16
16
|
var reactI18next = require('react-i18next');
|
|
17
|
-
var utils = require('./utils-
|
|
18
|
-
var useImageUploader = require('./useImageUploader-
|
|
19
|
-
var index = require('./index-
|
|
17
|
+
var utils = require('./utils-tPaqWDxV.js');
|
|
18
|
+
var useImageUploader = require('./useImageUploader-Bm9TukCy.js');
|
|
19
|
+
var index = require('./index-BtHfh_eu.js');
|
|
20
20
|
var classnames = require('classnames');
|
|
21
21
|
var LeftArrow = require('@bigbinary/neeto-icons/LeftArrow');
|
|
22
22
|
var reactQuery = require('@tanstack/react-query');
|
|
@@ -26,7 +26,7 @@ var utils$1 = require('@bigbinary/neeto-commons-frontend/utils');
|
|
|
26
26
|
var Input = require('@bigbinary/neetoui/Input');
|
|
27
27
|
var Switch = require('@bigbinary/neetoui/Switch');
|
|
28
28
|
var jsxRuntime = require('react/jsx-runtime');
|
|
29
|
-
var query = require('./query-
|
|
29
|
+
var query = require('./query-B7ahlELA.js');
|
|
30
30
|
var MenuHorizontal = require('@bigbinary/neeto-icons/MenuHorizontal');
|
|
31
31
|
var constants = require('@bigbinary/neeto-team-members-frontend/constants');
|
|
32
32
|
var Alert = require('@bigbinary/neetoui/Alert');
|
|
@@ -34,29 +34,6 @@ var Dropdown = require('@bigbinary/neetoui/Dropdown');
|
|
|
34
34
|
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
|
|
35
35
|
var _regeneratorRuntime = require('@babel/runtime/regenerator');
|
|
36
36
|
|
|
37
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
38
|
-
|
|
39
|
-
var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties$1);
|
|
40
|
-
var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
|
|
41
|
-
var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
|
|
42
|
-
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
43
|
-
var NeetoUIModal__default = /*#__PURE__*/_interopDefaultLegacy(NeetoUIModal);
|
|
44
|
-
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
45
|
-
var Tab__default = /*#__PURE__*/_interopDefaultLegacy(Tab);
|
|
46
|
-
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
47
|
-
var Toastr__default = /*#__PURE__*/_interopDefaultLegacy(Toastr);
|
|
48
|
-
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
49
|
-
var classnames__default = /*#__PURE__*/_interopDefaultLegacy(classnames);
|
|
50
|
-
var LeftArrow__default = /*#__PURE__*/_interopDefaultLegacy(LeftArrow);
|
|
51
|
-
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
52
|
-
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
53
|
-
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
54
|
-
var MenuHorizontal__default = /*#__PURE__*/_interopDefaultLegacy(MenuHorizontal);
|
|
55
|
-
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
56
|
-
var Dropdown__default = /*#__PURE__*/_interopDefaultLegacy(Dropdown);
|
|
57
|
-
var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
|
|
58
|
-
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
|
|
59
|
-
|
|
60
37
|
var constructCloudflareImageURL = function constructCloudflareImageURL(url) {
|
|
61
38
|
var domain = window.location.host.split(".").slice(-2).join(".");
|
|
62
39
|
return url.replace("https://imagedelivery.net", "https://images.".concat(domain, "/cdn-cgi/imagedelivery"));
|
|
@@ -109,24 +86,22 @@ function getAugmentedNamespace(n) {
|
|
|
109
86
|
|
|
110
87
|
var ReactCrop_min = {exports: {}};
|
|
111
88
|
|
|
112
|
-
ReactCrop_min.exports;
|
|
113
|
-
|
|
114
89
|
(function (module, exports) {
|
|
115
|
-
!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})()));
|
|
116
|
-
} (ReactCrop_min
|
|
90
|
+
!function(e,t){module.exports=t(require$$0);}(commonjsGlobal,(e=>(()=>{var t={899:t=>{t.exports=e;}},n={};function o(e){var r=n[e];if(void 0!==r)return r.exports;var i=n[e]={exports:{}};return t[e](i,i.exports,o),i.exports}o.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return o.d(t,{a:t}),t},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]});},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});};var r={};return (()=>{o.r(r),o.d(r,{Component:()=>u,areCropsEqual:()=>h,centerCrop:()=>d,clamp:()=>a,containCrop:()=>p,convertToPercentCrop:()=>c,convertToPixelCrop:()=>l,default:()=>u,defaultCrop:()=>i,makeAspectCrop:()=>s,nudgeCrop:()=>g});var e=o(899),t=o.n(e);function n(e){var t,o,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(o=n(e[t]))&&(r&&(r+=" "),r+=o);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}const i={x:0,y:0,width:0,height:0,unit:"px"};function a(e,t,n){return Math.min(Math.max(e,t),n)}function h(e,t){return e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit}function s(e,t,n,o){const r=l(e,n,o);return e.width&&(r.height=r.width/t),e.height&&(r.width=r.height*t),r.y+r.height>o&&(r.height=o-r.y,r.width=r.height*t),r.x+r.width>n&&(r.width=n-r.x,r.height=r.width/t),"%"===e.unit?c(r,n,o):r}function d(e,t,n){const o=l(e,t,n);return o.x=(t-o.width)/2,o.y=(n-o.height)/2,"%"===e.unit?c(o,t,n):o}function c(e,t,n){return "%"===e.unit?{...i,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function l(e,t,n){return e.unit?"px"===e.unit?{...i,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...i,...e,unit:"px"}}function p(e,t,n,o,r,i=0,a=0,h=o,s=r){const d={...e};let c=Math.min(i,o),l=Math.min(a,r),p=Math.min(h,o),g=Math.min(s,r);t&&(t>1?(c=a?a*t:c,l=c/t,p=h*t):(l=i?i/t:l,c=l*t,g=s/t)),d.y<0&&(d.height=Math.max(d.height+d.y,l),d.y=0),d.x<0&&(d.width=Math.max(d.width+d.x,c),d.x=0);const w=o-(d.x+d.width);w<0&&(d.x=Math.min(d.x,o-c),d.width+=w);const u=r-(d.y+d.height);if(u<0&&(d.y=Math.min(d.y,r-l),d.height+=u),d.width<c&&("sw"!==n&&"nw"!=n||(d.x-=c-d.width),d.width=c),d.height<l&&("nw"!==n&&"ne"!=n||(d.y-=l-d.height),d.height=l),d.width>p&&("sw"!==n&&"nw"!=n||(d.x-=p-d.width),d.width=p),d.height>g&&("nw"!==n&&"ne"!=n||(d.y-=g-d.height),d.height=g),t){const e=d.width/d.height;if(e<t){const e=Math.max(d.width/t,l);"nw"!==n&&"ne"!=n||(d.y-=e-d.height),d.height=e;}else if(e>t){const e=Math.max(d.height*t,c);"sw"!==n&&"nw"!=n||(d.x-=e-d.width),d.width=e;}}return d}function g(e,t,n,o){const r={...e};return "ArrowLeft"===t?"nw"===o?(r.x-=n,r.y-=n,r.width+=n,r.height+=n):"w"===o?(r.x-=n,r.width+=n):"sw"===o?(r.x-=n,r.width+=n,r.height+=n):"ne"===o?(r.y+=n,r.width-=n,r.height-=n):"e"===o?r.width-=n:"se"===o&&(r.width-=n,r.height-=n):"ArrowRight"===t&&("nw"===o?(r.x+=n,r.y+=n,r.width-=n,r.height-=n):"w"===o?(r.x+=n,r.width-=n):"sw"===o?(r.x+=n,r.width-=n,r.height-=n):"ne"===o?(r.y-=n,r.width+=n,r.height+=n):"e"===o?r.width+=n:"se"===o&&(r.width+=n,r.height+=n)),"ArrowUp"===t?"nw"===o?(r.x-=n,r.y-=n,r.width+=n,r.height+=n):"n"===o?(r.y-=n,r.height+=n):"ne"===o?(r.y-=n,r.width+=n,r.height+=n):"sw"===o?(r.x+=n,r.width-=n,r.height-=n):"s"===o?r.height-=n:"se"===o&&(r.width-=n,r.height-=n):"ArrowDown"===t&&("nw"===o?(r.x+=n,r.y+=n,r.width-=n,r.height-=n):"n"===o?(r.y+=n,r.height-=n):"ne"===o?(r.y+=n,r.width-=n,r.height-=n):"sw"===o?(r.x-=n,r.width+=n,r.height+=n):"s"===o?r.height+=n:"se"===o&&(r.width+=n,r.height+=n)),r}const w={capture:!0,passive:!1};class u extends e.PureComponent{constructor(){super(...arguments),this.docMoveBound=!1,this.mouseDownOnCrop=!1,this.dragStarted=!1,this.evData={startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0},this.componentRef=(0, e.createRef)(),this.mediaRef=(0, e.createRef)(),this.initChangeCalled=!1,this.state={cropIsActive:!1,newCropIsBeingDrawn:!1},this.onCropPointerDown=e=>{const{crop:t,disabled:n}=this.props,o=this.getBox();if(!t)return;const r=l(t,o.width,o.height);if(n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const i=e.target.dataset.ord,a=Boolean(i);let h=e.clientX,s=e.clientY,d=r.x,c=r.y;if(i){const t=e.clientX-o.x,n=e.clientY-o.y;let a=0,l=0;"ne"===i||"e"==i?(a=t-(r.x+r.width),l=n-r.y,d=r.x,c=r.y+r.height):"se"===i||"s"===i?(a=t-(r.x+r.width),l=n-(r.y+r.height),d=r.x,c=r.y):"sw"===i||"w"==i?(a=t-r.x,l=n-(r.y+r.height),d=r.x+r.width,c=r.y):"nw"!==i&&"n"!=i||(a=t-r.x,l=n-r.y,d=r.x+r.width,c=r.y+r.height),h=d+o.x+a,s=c+o.y+l;}this.evData={startClientX:h,startClientY:s,startCropX:d,startCropY:c,clientX:e.clientX,clientY:e.clientY,isResize:a,ord:i},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0});},this.onComponentPointerDown=e=>{const{crop:t,disabled:n,locked:o,keepSelection:r,onChange:i}=this.props,a=this.getBox();if(n||o||r&&t)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=e.clientX-a.x,s=e.clientY-a.y,d={unit:"px",x:h,y:s,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:s,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,i(l(d,a.width,a.height),c(d,a.width,a.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0});},this.onDocPointerMove=e=>{const{crop:t,disabled:n,onChange:o,onDragStart:r}=this.props,i=this.getBox();if(n||!t||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,r&&r(e));const{evData:a}=this;let s;a.clientX=e.clientX,a.clientY=e.clientY,s=a.isResize?this.resizeCrop():this.dragCrop(),h(t,s)||o(l(s,i.width,i.height),c(s,i.width,i.height));},this.onComponentKeyDown=e=>{const{crop:t,disabled:n,onChange:o,onComplete:r}=this.props,i=this.getBox();if(n)return;const h=e.key;let s=!1;if(!t)return;const d=this.makePixelCrop(),p=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?u.nudgeStepLarge:e.shiftKey?u.nudgeStepMedium:u.nudgeStep;if("ArrowLeft"===h?(d.x-=p,s=!0):"ArrowRight"===h?(d.x+=p,s=!0):"ArrowUp"===h?(d.y-=p,s=!0):"ArrowDown"===h&&(d.y+=p,s=!0),s){e.cancelable&&e.preventDefault(),d.x=a(d.x,0,i.width-d.width),d.y=a(d.y,0,i.height-d.height);const t=l(d,i.width,i.height),n=c(d,i.width,i.height);o(t,n),r&&r(t,n);}},this.onHandlerKeyDown=(e,t)=>{const{aspect:n=0,crop:o,disabled:r,minWidth:i=0,minHeight:a=0,maxWidth:s,maxHeight:d,onChange:w,onComplete:m}=this.props,y=this.getBox();if(r||!o)return;if("ArrowUp"!==e.key&&"ArrowDown"!==e.key&&"ArrowLeft"!==e.key&&"ArrowRight"!==e.key)return;e.stopPropagation(),e.preventDefault();const x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?u.nudgeStepLarge:e.shiftKey?u.nudgeStepMedium:u.nudgeStep,C=p(g(l(o,y.width,y.height),e.key,x,t),n,t,y.width,y.height,i,a,s,d);if(!h(o,C)){const e=c(C,y.width,y.height);w(C,e),m&&m(C,e);}},this.onDocPointerDone=e=>{const{crop:t,disabled:n,onComplete:o,onDragEnd:r}=this.props,i=this.getBox();this.unbindDocMove(),!n&&t&&this.mouseDownOnCrop&&(this.mouseDownOnCrop=!1,this.dragStarted=!1,r&&r(e),o&&o(l(t,i.width,i.height),c(t,i.width,i.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}));},this.onDragFocus=e=>{var t;null===(t=this.componentRef.current)||void 0===t||t.scrollTo(0,0);};}get document(){return document}getBox(){const e=this.mediaRef.current;if(!e)return {x:0,y:0,width:0,height:0};const{x:t,y:n,width:o,height:r}=e.getBoundingClientRect();return {x:t,y:n,width:o,height:r}}componentDidUpdate(e){const{crop:t,onComplete:n}=this.props;if(n&&!e.crop&&t){const{width:e,height:o}=this.getBox();e&&o&&n(l(t,e,o),c(t,e,o));}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect();}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,w),this.document.addEventListener("pointerup",this.onDocPointerDone,w),this.document.addEventListener("pointercancel",this.onDocPointerDone,w),this.docMoveBound=!0);}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,w),this.document.removeEventListener("pointerup",this.onDocPointerDone,w),this.document.removeEventListener("pointercancel",this.onDocPointerDone,w),this.docMoveBound=!1);}getCropStyle(){const{crop:e}=this.props;if(e)return {top:`${e.y}${e.unit}`,left:`${e.x}${e.unit}`,width:`${e.width}${e.unit}`,height:`${e.height}${e.unit}`}}dragCrop(){const{evData:e}=this,t=this.getBox(),n=this.makePixelCrop(),o=e.clientX-e.startClientX,r=e.clientY-e.startClientY;return n.x=a(e.startCropX+o,0,t.width-n.width),n.y=a(e.startCropY+r,0,t.height-n.height),n}getPointRegion(e){const{evData:t}=this,n=t.clientX-e.x,o=t.clientY-e.y<t.startCropY;return n<t.startCropX?o?"nw":"sw":o?"ne":"se"}resizeCrop(){const{evData:e}=this,t=this.getBox(),{aspect:n=0,minWidth:o=0,minHeight:r=0,maxWidth:i,maxHeight:a}=this.props,h=this.getPointRegion(t),s=this.makePixelCrop(),d=e.ord?e.ord:h,c=e.clientX-e.startClientX,l=e.clientY-e.startClientY,g={unit:"px",x:0,y:0,width:0,height:0};"ne"===h?(g.x=e.startCropX,g.width=c,n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(l),g.y=e.startCropY-g.height)):"se"===h?(g.x=e.startCropX,g.y=e.startCropY,g.width=c,g.height=n?g.width/n:l):"sw"===h?(g.x=e.startCropX+c,g.y=e.startCropY,g.width=Math.abs(c),g.height=n?g.width/n:l):"nw"===h&&(g.x=e.startCropX+c,g.width=Math.abs(c),n?(g.height=g.width/n,g.y=e.startCropY-g.height):(g.height=Math.abs(l),g.y=e.startCropY+l));const w=p(g,n,h,t.width,t.height,o,r,i,a);return n||u.xyOrds.indexOf(d)>-1?(s.x=w.x,s.y=w.y,s.width=w.width,s.height=w.height):u.xOrds.indexOf(d)>-1?(s.x=w.x,s.width=w.width):u.yOrds.indexOf(d)>-1&&(s.y=w.y,s.height=w.height),s}createCropSelection(){const{ariaLabels:e=u.defaultProps.ariaLabels,disabled:n,locked:o,renderSelectionAddon:r,ruleOfThirds:i,crop:a}=this.props,h=this.getCropStyle();if(a)return t().createElement("div",{style:h,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!o&&t().createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},t().createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),t().createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"nw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"n"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"ne"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"e"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"se"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"s"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"sw"),role:"button"}),t().createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:e=>this.onHandlerKeyDown(e,"w"),role:"button"})),r&&t().createElement("div",{className:"ReactCrop__selection-addon",onMouseDown:e=>e.stopPropagation()},r(this.state)),i&&t().createElement(t().Fragment,null,t().createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),t().createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(){const e={...i,...this.props.crop||{}},t=this.getBox();return l(e,t.width,t.height)}render(){const{aspect:e,children:o,circularCrop:r,className:i,crop:a,disabled:h,locked:s,style:d,ruleOfThirds:c}=this.props,{cropIsActive:l,newCropIsBeingDrawn:p}=this.state,g=a?this.createCropSelection():null,w=function(){for(var e,t,o=0,r="";o<arguments.length;)(e=arguments[o++])&&(t=n(e))&&(r&&(r+=" "),r+=t);return r}("ReactCrop",i,{"ReactCrop--active":l,"ReactCrop--disabled":h,"ReactCrop--locked":s,"ReactCrop--new-crop":p,"ReactCrop--fixed-aspect":a&&e,"ReactCrop--circular-crop":a&&r,"ReactCrop--rule-of-thirds":a&&c,"ReactCrop--invisible-crop":!this.dragStarted&&a&&!a.width&&!a.height});return t().createElement("div",{ref:this.componentRef,className:w,style:d},t().createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},o),g)}}u.xOrds=["e","w"],u.yOrds=["n","s"],u.xyOrds=["nw","ne","se","sw"],u.nudgeStep=1,u.nudgeStepMedium=10,u.nudgeStepLarge=100,u.defaultProps={ariaLabels:{cropArea:"Use the arrow keys to move the crop selection area",nwDragHandle:"Use the arrow keys to move the north west drag handle to change the crop selection area",nDragHandle:"Use the up and down arrow keys to move the north drag handle to change the crop selection area",neDragHandle:"Use the arrow keys to move the north east drag handle to change the crop selection area",eDragHandle:"Use the up and down arrow keys to move the east drag handle to change the crop selection area",seDragHandle:"Use the arrow keys to move the south east drag handle to change the crop selection area",sDragHandle:"Use the up and down arrow keys to move the south drag handle to change the crop selection area",swDragHandle:"Use the arrow keys to move the south west drag handle to change the crop selection area",wDragHandle:"Use the up and down arrow keys to move the west drag handle to change the crop selection area"}};})(),r})()));
|
|
91
|
+
} (ReactCrop_min));
|
|
117
92
|
|
|
118
93
|
var ReactCrop_minExports = ReactCrop_min.exports;
|
|
119
94
|
var ReactCrop = /*@__PURE__*/getDefaultExportFromCjs(ReactCrop_minExports);
|
|
120
95
|
|
|
121
96
|
var cropImage = function cropImage(payload) {
|
|
122
|
-
return
|
|
97
|
+
return axios.post("neeto_image_uploader_engine/development/crop_image", payload);
|
|
123
98
|
};
|
|
124
99
|
var developmentApi = {
|
|
125
100
|
cropImage: cropImage
|
|
126
101
|
};
|
|
127
102
|
|
|
128
103
|
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; }
|
|
129
|
-
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) {
|
|
104
|
+
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(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; }
|
|
130
105
|
var useCropImage = function useCropImage(options) {
|
|
131
106
|
return reactQuery.useMutation(_objectSpread$4({
|
|
132
107
|
mutationFn: developmentApi.cropImage
|
|
@@ -272,11 +247,11 @@ var Controls = function Controls(_ref) {
|
|
|
272
247
|
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));
|
|
273
248
|
};
|
|
274
249
|
var _useState = require$$0.useState(getActualCropHeight(crop.height)),
|
|
275
|
-
_useState2 =
|
|
250
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
276
251
|
height = _useState2[0],
|
|
277
252
|
setHeight = _useState2[1];
|
|
278
253
|
var _useState3 = require$$0.useState(getActualCropWidth(crop.width)),
|
|
279
|
-
_useState4 =
|
|
254
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
280
255
|
width = _useState4[0],
|
|
281
256
|
setWidth = _useState4[1];
|
|
282
257
|
var _useImageControls = useImageControls({
|
|
@@ -310,7 +285,7 @@ var Controls = function Controls(_ref) {
|
|
|
310
285
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
311
286
|
className: "flex flex-col p-4 md:w-2/6 ",
|
|
312
287
|
children: [!hideControls && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
313
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
288
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
314
289
|
checked: isFullImage,
|
|
315
290
|
className: "flex-grow-0",
|
|
316
291
|
label: t("neetoImageUploader.labels.selectOriginalImage"),
|
|
@@ -319,28 +294,28 @@ var Controls = function Controls(_ref) {
|
|
|
319
294
|
return !isFullImage;
|
|
320
295
|
});
|
|
321
296
|
}
|
|
322
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
297
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Switch, {
|
|
323
298
|
checked: isAspectRatioLocked,
|
|
324
299
|
className: "mt-4 flex-grow-0",
|
|
325
300
|
disabled: isFullImage,
|
|
326
301
|
label: t("neetoImageUploader.labels.lockAspectRatio"),
|
|
327
302
|
onChange: onToggleAspectRatioLock
|
|
328
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
303
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
329
304
|
className: "mb-2 mt-6",
|
|
330
305
|
style: "body2",
|
|
331
306
|
children: t("neetoImageUploader.imageEditor.aspectRatio")
|
|
332
307
|
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
333
308
|
className: "flex gap-4 self-start",
|
|
334
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
309
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
335
310
|
"data-cy": "aspect-ratio-width-input",
|
|
336
311
|
disabled: isFullImage,
|
|
337
312
|
size: "small",
|
|
338
313
|
type: "number",
|
|
339
314
|
value: aspectRatio.width,
|
|
340
315
|
onChange: utils$1.withEventTargetValue(handleAspectWidthChange)
|
|
341
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
316
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
342
317
|
children: " : "
|
|
343
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
318
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
344
319
|
"data-cy": "aspect-ratio-height-input",
|
|
345
320
|
disabled: isFullImage,
|
|
346
321
|
size: "small",
|
|
@@ -349,21 +324,21 @@ var Controls = function Controls(_ref) {
|
|
|
349
324
|
onChange: utils$1.withEventTargetValue(handleAspectHeightChange)
|
|
350
325
|
})]
|
|
351
326
|
})]
|
|
352
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
327
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
353
328
|
className: "mt-4 flex-grow-0",
|
|
354
329
|
disabled: isFullImage,
|
|
355
330
|
label: t("neetoImageUploader.labels.width"),
|
|
356
331
|
type: "number",
|
|
357
332
|
value: Math.round(width),
|
|
358
333
|
onChange: utils$1.withEventTargetValue(setWidth)
|
|
359
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
334
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
360
335
|
className: "mt-4 flex-grow-0",
|
|
361
336
|
disabled: isFullImage,
|
|
362
337
|
label: t("neetoImageUploader.labels.height"),
|
|
363
338
|
type: "number",
|
|
364
339
|
value: Math.round(height),
|
|
365
340
|
onChange: utils$1.withEventTargetValue(setHeight)
|
|
366
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
341
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
367
342
|
className: "mt-6 self-start",
|
|
368
343
|
"data-cy": "neeto-image-uploader-crop-submit-button",
|
|
369
344
|
label: t("neetoImageUploader.labels.done"),
|
|
@@ -383,22 +358,22 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
383
358
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
384
359
|
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
|
|
385
360
|
var _useState = require$$0.useState(true),
|
|
386
|
-
_useState2 =
|
|
361
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
387
362
|
isAspectRatioLocked = _useState2[0],
|
|
388
363
|
setIsAspectRatioLocked = _useState2[1];
|
|
389
364
|
var _useState3 = require$$0.useState(false),
|
|
390
|
-
_useState4 =
|
|
365
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
391
366
|
isFullImage = _useState4[0],
|
|
392
367
|
setIsFullImage = _useState4[1];
|
|
393
368
|
var _useState5 = require$$0.useState({
|
|
394
369
|
width: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) || 16,
|
|
395
370
|
height: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height) || 9
|
|
396
371
|
}),
|
|
397
|
-
_useState6 =
|
|
372
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
398
373
|
aspectRatio = _useState6[0],
|
|
399
374
|
setAspectRatio = _useState6[1];
|
|
400
375
|
var _useState7 = require$$0.useState(utils.DEFAULT_CROP_CONFIG),
|
|
401
|
-
_useState8 =
|
|
376
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
402
377
|
crop = _useState8[0],
|
|
403
378
|
setCrop = _useState8[1];
|
|
404
379
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -447,10 +422,10 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
447
422
|
};
|
|
448
423
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
449
424
|
className: "flex h-full flex-col gap-4 px-8 py-12",
|
|
450
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
425
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button, {
|
|
451
426
|
className: "self-start",
|
|
452
427
|
"data-cy": "image-editor-back-button",
|
|
453
|
-
icon:
|
|
428
|
+
icon: LeftArrow,
|
|
454
429
|
iconPosition: "left",
|
|
455
430
|
style: "text",
|
|
456
431
|
onClick: handleReset
|
|
@@ -459,7 +434,7 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
459
434
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
460
435
|
id: "imageEditor",
|
|
461
436
|
ref: wrapperRef,
|
|
462
|
-
className:
|
|
437
|
+
className: classnames("flex", "h-full w-full md:w-4/6", "justify-around", "neeto-ui-bg-gray-200", {
|
|
463
438
|
"items-center": utils.isItemsCenter({
|
|
464
439
|
wrapperRef: wrapperRef,
|
|
465
440
|
imageRef: imageRef
|
|
@@ -507,7 +482,7 @@ var fetch = function fetch(_ref) {
|
|
|
507
482
|
url = _ref.url,
|
|
508
483
|
page = _ref.page,
|
|
509
484
|
per = _ref.per;
|
|
510
|
-
return
|
|
485
|
+
return axios.get(url, {
|
|
511
486
|
params: {
|
|
512
487
|
searchTerm: searchTerm,
|
|
513
488
|
page: page,
|
|
@@ -516,7 +491,7 @@ var fetch = function fetch(_ref) {
|
|
|
516
491
|
});
|
|
517
492
|
};
|
|
518
493
|
var bulkDestroy = function bulkDestroy(imageIds, url) {
|
|
519
|
-
return
|
|
494
|
+
return axios["delete"](url, {
|
|
520
495
|
params: {
|
|
521
496
|
imageIds: imageIds
|
|
522
497
|
}
|
|
@@ -528,7 +503,7 @@ var imagesApi = {
|
|
|
528
503
|
};
|
|
529
504
|
|
|
530
505
|
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; }
|
|
531
|
-
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) {
|
|
506
|
+
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(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; }
|
|
532
507
|
var useFetchAssets = function useFetchAssets(_ref) {
|
|
533
508
|
var searchTerm = _ref.searchTerm,
|
|
534
509
|
url = _ref.url,
|
|
@@ -951,15 +926,13 @@ var bricks = function bricks() {
|
|
|
951
926
|
|
|
952
927
|
var bricks_module = /*#__PURE__*/Object.freeze({
|
|
953
928
|
__proto__: null,
|
|
954
|
-
|
|
929
|
+
default: bricks
|
|
955
930
|
});
|
|
956
931
|
|
|
957
932
|
var require$$2 = /*@__PURE__*/getAugmentedNamespace(bricks_module);
|
|
958
933
|
|
|
959
934
|
var InfiniteScroll = {exports: {}};
|
|
960
935
|
|
|
961
|
-
InfiniteScroll.exports;
|
|
962
|
-
|
|
963
936
|
(function (module, exports) {
|
|
964
937
|
|
|
965
938
|
Object.defineProperty(exports, "__esModule", {
|
|
@@ -968,7 +941,7 @@ InfiniteScroll.exports;
|
|
|
968
941
|
|
|
969
942
|
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; }; }();
|
|
970
943
|
|
|
971
|
-
var _react = require$$
|
|
944
|
+
var _react = require$$0;
|
|
972
945
|
|
|
973
946
|
var _react2 = _interopRequireDefault(_react);
|
|
974
947
|
|
|
@@ -1273,7 +1246,7 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
1273
1246
|
|
|
1274
1247
|
var _class, _temp2;
|
|
1275
1248
|
|
|
1276
|
-
var _react = require$$
|
|
1249
|
+
var _react = require$$0;
|
|
1277
1250
|
|
|
1278
1251
|
var _react2 = _interopRequireDefault(_react);
|
|
1279
1252
|
|
|
@@ -1433,8 +1406,8 @@ _default = lib.default = MasonryInfiniteScroller;
|
|
|
1433
1406
|
var css = ".niu-unsplash-container {\n height: calc(75vh - 220px) !important;\n max-height: 355px;\n}\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}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX2ltYWdlLWxpYnJhcnkuc2NzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2Fic3RyYWN0cy9fdmFyaWFibGVzLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0E7RUFDRSxxQ0FBQTtFQUNBLGlCQ0NrQztBREhwQztBQUlFO0VBQ0UsWUFBQTtFQUNBLFdBQUE7RUFDQSxvQkFBQTtLQUFBLGlCQUFBO0VBQ0EsbUVBQUE7RUFDQSxzQ0FBQTtFQUNBLGtCQUFBO0VBQ0EsZUFBQTtBQUZKIiwic291cmNlc0NvbnRlbnQiOlsiLy9BYnN0cmFjdHNcbkBpbXBvcnQgXCIuLi9hYnN0cmFjdHMvdmFyaWFibGVzXCI7XG5cbi5uaXUtdW5zcGxhc2gtY29udGFpbmVyIHtcbiAgaGVpZ2h0OiBjYWxjKCN7JG5pdS1tb2RhbC1oZWlnaHR9IC0gI3skbml1LW1vZGFsLWhlYWRlci1oZWlnaHR9KSAhaW1wb3J0YW50O1xuICBtYXgtaGVpZ2h0OiAkbml1LXVuc3BsYXNoLWNvbnRhaW5lci1tYXgtaGVpZ2h0O1xuXG4gIGltZyB7XG4gICAgaGVpZ2h0OiAxMDAlO1xuICAgIHdpZHRoOiAxMDAlO1xuICAgIG9iamVjdC1maXQ6IGNvdmVyO1xuICAgIGFuaW1hdGlvbjogZmFkZS1pbiAxLjJzIDFzIGN1YmljLWJlemllcigwLjM5LCAwLjU3NSwgMC41NjUsIDEpIGJvdGg7XG4gICAgYm9yZGVyLXJhZGl1czogdmFyKC0tbmVldG8tdWktcm91bmRlZCk7XG4gICAgcG9zaXRpb246IHJlbGF0aXZlO1xuICAgIGN1cnNvcjogcG9pbnRlcjtcbiAgfVxufVxuIiwiJG5pdS1tb2RhbC13aWR0aDogOTV2dztcbiRuaXUtbW9kYWwtaGVpZ2h0OiA3NXZoO1xuJG5pdS1tb2RhbC1tYXgtd2lkdGg6IDExNTJweDtcbiRuaXUtbW9kYWwtbWF4LWhlaWdodDogNTc2cHg7XG4kbml1LW1vZGFsLWhlYWRlci1oZWlnaHQ6IDIyMHB4O1xuXG4kbml1LXVuc3BsYXNoLWNvbnRhaW5lci1tYXgtaGVpZ2h0OiAzNTVweDtcbiJdfQ== */";
|
|
1434
1407
|
n(css,{});
|
|
1435
1408
|
|
|
1436
|
-
var Menu =
|
|
1437
|
-
MenuItem =
|
|
1409
|
+
var Menu = Dropdown.Menu,
|
|
1410
|
+
MenuItem = Dropdown.MenuItem;
|
|
1438
1411
|
var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
1439
1412
|
var _ref$hasMore = _ref.hasMore,
|
|
1440
1413
|
hasMore = _ref$hasMore === void 0 ? false : _ref$hasMore,
|
|
@@ -1452,7 +1425,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1452
1425
|
isOpen: false,
|
|
1453
1426
|
imageIds: []
|
|
1454
1427
|
}),
|
|
1455
|
-
_useState2 =
|
|
1428
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1456
1429
|
deleteConfirmation = _useState2[0],
|
|
1457
1430
|
setDeleteConfirmation = _useState2[1];
|
|
1458
1431
|
var isMenuButtonEnabled = initializers.globalProps.assetsUploaderService !== index.CLOUD_FLARE;
|
|
@@ -1471,7 +1444,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1471
1444
|
}, [deleteConfirmation.imageIds]);
|
|
1472
1445
|
var Loader = /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1473
1446
|
className: "flex justify-center",
|
|
1474
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1447
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
1475
1448
|
});
|
|
1476
1449
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1477
1450
|
className: "niu-unsplash-container mr-2 max-w-full overflow-x-hidden overflow-y-scroll",
|
|
@@ -1513,11 +1486,11 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1513
1486
|
children: [image === null || image === void 0 ? void 0 : (_image$user2 = image.user) === null || _image$user2 === void 0 ? void 0 : _image$user2.name, " | ", " ", t("neetoImageUploader.labels.unsplash")]
|
|
1514
1487
|
})]
|
|
1515
1488
|
}), tab === utils.TABS[0].key && /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1516
|
-
children: [utils$1.hasPermission(constants.VIEW_ROLES_PERMISSION) && isMenuButtonEnabled && /*#__PURE__*/jsxRuntime.jsx(
|
|
1489
|
+
children: [utils$1.hasPermission(constants.VIEW_ROLES_PERMISSION) && isMenuButtonEnabled && /*#__PURE__*/jsxRuntime.jsx(Dropdown, {
|
|
1517
1490
|
buttonSize: "small",
|
|
1518
1491
|
buttonStyle: "tertiary",
|
|
1519
1492
|
"data-cy": "image-library-image-options-".concat(index),
|
|
1520
|
-
icon:
|
|
1493
|
+
icon: MenuHorizontal,
|
|
1521
1494
|
buttonProps: {
|
|
1522
1495
|
className:
|
|
1523
1496
|
// eslint-disable-next-line @bigbinary/neeto/use-neetoui-classes
|
|
@@ -1547,7 +1520,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1547
1520
|
})
|
|
1548
1521
|
}, image.id);
|
|
1549
1522
|
})
|
|
1550
|
-
}), /*#__PURE__*/jsxRuntime.jsx(
|
|
1523
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Alert, {
|
|
1551
1524
|
isOpen: deleteConfirmation.isOpen,
|
|
1552
1525
|
isSubmitting: isPending,
|
|
1553
1526
|
message: t("neetoImageUploader.deleteConfirmation.message"),
|
|
@@ -1583,7 +1556,7 @@ var Images = function Images(_ref) {
|
|
|
1583
1556
|
isLoading = _useFetchAssets.isLoading,
|
|
1584
1557
|
isError = _useFetchAssets.isError;
|
|
1585
1558
|
if (isError) {
|
|
1586
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
1559
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1587
1560
|
className: "mt-9 flex justify-center",
|
|
1588
1561
|
style: "body2",
|
|
1589
1562
|
children: t("neetoImageUploader.unsplash.errorMessage")
|
|
@@ -1592,7 +1565,7 @@ var Images = function Images(_ref) {
|
|
|
1592
1565
|
if (isLoading) {
|
|
1593
1566
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1594
1567
|
className: "flex justify-around",
|
|
1595
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1568
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
1596
1569
|
});
|
|
1597
1570
|
}
|
|
1598
1571
|
return /*#__PURE__*/require$$0.createElement(InfiniteScroller, {
|
|
@@ -1605,11 +1578,11 @@ var Images = function Images(_ref) {
|
|
|
1605
1578
|
});
|
|
1606
1579
|
};
|
|
1607
1580
|
|
|
1608
|
-
var newAxiosInstance =
|
|
1581
|
+
var newAxiosInstance = axios.create();
|
|
1609
1582
|
var searchUnsplashImages = function searchUnsplashImages(_ref) {
|
|
1610
1583
|
var pageNo = _ref.pageNo,
|
|
1611
1584
|
query = _ref.query;
|
|
1612
|
-
return
|
|
1585
|
+
return axios.get("neeto_image_uploader_engine/unsplash/fetch", {
|
|
1613
1586
|
params: {
|
|
1614
1587
|
page: pageNo,
|
|
1615
1588
|
per_page: 30,
|
|
@@ -1627,7 +1600,7 @@ var unsplashApi = {
|
|
|
1627
1600
|
};
|
|
1628
1601
|
|
|
1629
1602
|
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; }
|
|
1630
|
-
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) {
|
|
1603
|
+
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(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; }
|
|
1631
1604
|
var UNSPLASH_LIST = query.QUERY_KEYS.UNSPLASH_LIST;
|
|
1632
1605
|
var useFetchUnsplashImages = function useFetchUnsplashImages(_ref) {
|
|
1633
1606
|
var query$1 = _ref.query;
|
|
@@ -1660,7 +1633,7 @@ var useFetchUnsplashImages = function useFetchUnsplashImages(_ref) {
|
|
|
1660
1633
|
};
|
|
1661
1634
|
|
|
1662
1635
|
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; }
|
|
1663
|
-
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) {
|
|
1636
|
+
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(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; }
|
|
1664
1637
|
var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
1665
1638
|
var debouncedQuery = _ref.debouncedQuery,
|
|
1666
1639
|
setSelectedImage = _ref.setSelectedImage,
|
|
@@ -1692,9 +1665,9 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
1692
1665
|
}),
|
|
1693
1666
|
uploadFile = _useImageUploader.uploadFile;
|
|
1694
1667
|
var handleUnsplashImageSelect = /*#__PURE__*/function () {
|
|
1695
|
-
var _ref2 =
|
|
1668
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(image) {
|
|
1696
1669
|
var _image$urls, response, file;
|
|
1697
|
-
return
|
|
1670
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1698
1671
|
while (1) switch (_context.prev = _context.next) {
|
|
1699
1672
|
case 0:
|
|
1700
1673
|
_context.prev = 0;
|
|
@@ -1712,7 +1685,7 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
1712
1685
|
case 9:
|
|
1713
1686
|
_context.prev = 9;
|
|
1714
1687
|
_context.t0 = _context["catch"](0);
|
|
1715
|
-
|
|
1688
|
+
Toastr.error(_context.t0);
|
|
1716
1689
|
setActiveTab(utils.TABS[0].key);
|
|
1717
1690
|
setIsUploading(false);
|
|
1718
1691
|
case 14:
|
|
@@ -1739,7 +1712,7 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
1739
1712
|
isError = _useFetchUnsplashImag.isError,
|
|
1740
1713
|
isLoading = _useFetchUnsplashImag.isLoading;
|
|
1741
1714
|
if (isError) {
|
|
1742
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
1715
|
+
return /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1743
1716
|
className: "mt-9 flex justify-center",
|
|
1744
1717
|
style: "body2",
|
|
1745
1718
|
children: t("neetoImageUploader.unsplash.errorMessage")
|
|
@@ -1748,7 +1721,7 @@ var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
|
1748
1721
|
if (isLoading) {
|
|
1749
1722
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1750
1723
|
className: "flex justify-around",
|
|
1751
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1724
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
1752
1725
|
});
|
|
1753
1726
|
}
|
|
1754
1727
|
return /*#__PURE__*/require$$0.createElement(InfiniteScroller, {
|
|
@@ -1768,7 +1741,7 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
1768
1741
|
setIsUploading = _ref.setIsUploading,
|
|
1769
1742
|
setActiveTab = _ref.setActiveTab;
|
|
1770
1743
|
var _useState = require$$0.useState(""),
|
|
1771
|
-
_useState2 =
|
|
1744
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1772
1745
|
query = _useState2[0],
|
|
1773
1746
|
setQuery = _useState2[1];
|
|
1774
1747
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -1780,7 +1753,7 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
1780
1753
|
}, [tab]);
|
|
1781
1754
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1782
1755
|
className: "w-full pb-2 pl-6 pt-1",
|
|
1783
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
1756
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input, {
|
|
1784
1757
|
autoFocus: true,
|
|
1785
1758
|
className: "mb-4 mr-6",
|
|
1786
1759
|
"data-cy": "niu-unsplash-image-picker-search-input",
|
|
@@ -1807,7 +1780,7 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
1807
1780
|
|
|
1808
1781
|
var _excluded = ["key"];
|
|
1809
1782
|
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; }
|
|
1810
|
-
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) {
|
|
1783
|
+
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(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; }
|
|
1811
1784
|
var Modal = function Modal(_ref) {
|
|
1812
1785
|
var isOpen = _ref.isOpen,
|
|
1813
1786
|
_ref$onClose = _ref.onClose,
|
|
@@ -1819,15 +1792,15 @@ var Modal = function Modal(_ref) {
|
|
|
1819
1792
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
1820
1793
|
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
|
|
1821
1794
|
var _useState = require$$0.useState(utils.TABS[0].key),
|
|
1822
|
-
_useState2 =
|
|
1795
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
1823
1796
|
activeTab = _useState2[0],
|
|
1824
1797
|
setActiveTab = _useState2[1];
|
|
1825
1798
|
var _useState3 = require$$0.useState({}),
|
|
1826
|
-
_useState4 =
|
|
1799
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
1827
1800
|
selectedImage = _useState4[0],
|
|
1828
1801
|
setSelectedImage = _useState4[1];
|
|
1829
1802
|
var _useState5 = require$$0.useState(false),
|
|
1830
|
-
_useState6 =
|
|
1803
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
1831
1804
|
isUploading = _useState6[0],
|
|
1832
1805
|
setIsUploading = _useState6[1];
|
|
1833
1806
|
var _useTranslation = reactI18next.useTranslation(),
|
|
@@ -1887,7 +1860,7 @@ var Modal = function Modal(_ref) {
|
|
|
1887
1860
|
signedId: image.signedId
|
|
1888
1861
|
});
|
|
1889
1862
|
},
|
|
1890
|
-
onError:
|
|
1863
|
+
onError: Toastr.error
|
|
1891
1864
|
});
|
|
1892
1865
|
}
|
|
1893
1866
|
};
|
|
@@ -1915,18 +1888,18 @@ var Modal = function Modal(_ref) {
|
|
|
1915
1888
|
require$$0.useEffect(function () {
|
|
1916
1889
|
setActiveTab(utils.TABS[0].key);
|
|
1917
1890
|
}, [isOpen]);
|
|
1918
|
-
return /*#__PURE__*/jsxRuntime.jsxs(
|
|
1891
|
+
return /*#__PURE__*/jsxRuntime.jsxs(NeetoUIModal, {
|
|
1919
1892
|
isOpen: isOpen,
|
|
1920
1893
|
className: "niu-modal",
|
|
1921
1894
|
size: "large",
|
|
1922
1895
|
onClose: handleCloseModal,
|
|
1923
1896
|
children: [isUploading && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1924
1897
|
className: "neeto-ui-bg-gray-400 absolute inset-0 z-50 flex h-full items-center justify-center opacity-50",
|
|
1925
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1898
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner, {})
|
|
1926
1899
|
}), utils.isNilOrEmpty(selectedImage) && isDragActive && /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({
|
|
1927
1900
|
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"
|
|
1928
1901
|
}, getRootProps()), {}, {
|
|
1929
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1902
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1930
1903
|
children: t("neetoImageUploader.common.dropHere")
|
|
1931
1904
|
})
|
|
1932
1905
|
})), !utils.isNilOrEmpty(selectedImage) ? /*#__PURE__*/jsxRuntime.jsx(ImageEditor, {
|
|
@@ -1944,8 +1917,8 @@ var Modal = function Modal(_ref) {
|
|
|
1944
1917
|
return event.stopPropagation();
|
|
1945
1918
|
}
|
|
1946
1919
|
})), {}, {
|
|
1947
|
-
children: [/*#__PURE__*/jsxRuntime.jsx(
|
|
1948
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1920
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(NeetoUIModal.Header, {
|
|
1921
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1949
1922
|
style: "h2",
|
|
1950
1923
|
children: t("neetoImageUploader.common.imageLibrary")
|
|
1951
1924
|
})
|
|
@@ -1955,10 +1928,10 @@ var Modal = function Modal(_ref) {
|
|
|
1955
1928
|
className: "flex flex-col items-center justify-between gap-2 sm:flex-row",
|
|
1956
1929
|
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1957
1930
|
className: "flex gap-2",
|
|
1958
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1931
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Tab, {
|
|
1959
1932
|
size: "small",
|
|
1960
1933
|
children: utils.TABS.map(function (tab) {
|
|
1961
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
1934
|
+
return /*#__PURE__*/jsxRuntime.jsx(Tab.Item, {
|
|
1962
1935
|
active: activeTab === tab.key,
|
|
1963
1936
|
"data-cy": tab.dataCy,
|
|
1964
1937
|
onClick: function onClick() {
|
|
@@ -1972,8 +1945,8 @@ var Modal = function Modal(_ref) {
|
|
|
1972
1945
|
className: "flex gap-2",
|
|
1973
1946
|
children: options.map(function (_ref2) {
|
|
1974
1947
|
var key = _ref2.key,
|
|
1975
|
-
otherProps =
|
|
1976
|
-
return /*#__PURE__*/require$$0.createElement(
|
|
1948
|
+
otherProps = _objectWithoutProperties$1(_ref2, _excluded);
|
|
1949
|
+
return /*#__PURE__*/require$$0.createElement(Button, _objectSpread(_objectSpread({}, otherProps), {}, {
|
|
1977
1950
|
key: key,
|
|
1978
1951
|
size: "small"
|
|
1979
1952
|
}));
|
|
@@ -1985,9 +1958,9 @@ var Modal = function Modal(_ref) {
|
|
|
1985
1958
|
setIsUploading: setIsUploading,
|
|
1986
1959
|
setSelectedImage: setSelectedImage,
|
|
1987
1960
|
tab: activeTab
|
|
1988
|
-
}), ramda.equals(activeTab, utils.TABS[1].key) && /*#__PURE__*/jsxRuntime.jsx(
|
|
1961
|
+
}), ramda.equals(activeTab, utils.TABS[1].key) && /*#__PURE__*/jsxRuntime.jsx(NeetoUIModal.Footer, {
|
|
1989
1962
|
className: "flex items-center justify-center gap-2",
|
|
1990
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
1963
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography, {
|
|
1991
1964
|
style: "body2",
|
|
1992
1965
|
children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
|
|
1993
1966
|
i18nKey: "neetoImageUploader.unsplash.poweredByUnsplash",
|
|
@@ -2007,4 +1980,4 @@ var Modal = function Modal(_ref) {
|
|
|
2007
1980
|
|
|
2008
1981
|
exports.Modal = Modal;
|
|
2009
1982
|
exports.constructCloudflareImageURL = constructCloudflareImageURL;
|
|
2010
|
-
//# sourceMappingURL=index-
|
|
1983
|
+
//# sourceMappingURL=index-By7BkNOh.js.map
|