@bigbinary/neeto-image-uploader-frontend 2.3.11 → 2.3.14
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/README.md +1 -0
- package/app/javascript/src/translations/en.json +2 -1
- package/dist/AssetLibrary.js +2 -2
- package/dist/BasicImageUploader.js +1 -1
- package/dist/BasicImageUploader.js.map +1 -1
- package/dist/ImageUploader.js +7 -3
- package/dist/ImageUploader.js.map +1 -1
- package/dist/ImageWithFallback-Csv6Oivd.js.map +1 -1
- package/dist/{ImageWithFallback-DeznMgbx.js → ImageWithFallback-DzT_N2Su.js} +4 -4
- package/dist/{ImageWithFallback-DeznMgbx.js.map → ImageWithFallback-DzT_N2Su.js.map} +1 -1
- package/dist/cjs/AssetLibrary.js +2 -2
- package/dist/cjs/BasicImageUploader.js +2 -2
- package/dist/cjs/BasicImageUploader.js.map +1 -1
- package/dist/cjs/ImageUploader.js +12 -8
- package/dist/cjs/ImageUploader.js.map +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +4 -4
- package/dist/cjs/utils.js.map +1 -1
- package/dist/{index-FbPHXCzL.js → index-2Z-tiNdY.js} +724 -289
- package/dist/index-2Z-tiNdY.js.map +1 -0
- package/dist/{index-BkKE5xo-.js → index-BsGnAVUR.js} +732 -297
- package/dist/index-BsGnAVUR.js.map +1 -0
- package/dist/index-BtHfh_eu.js.map +1 -1
- package/dist/index-CZjb2iXB.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/query-B0eDmse7.js.map +1 -1
- package/dist/query-B7ahlELA.js.map +1 -1
- package/dist/useImageUploader-Bm9TukCy.js.map +1 -1
- package/dist/useImageUploader-RX88_Cp-.js.map +1 -1
- package/dist/{useProfileImageUpload-UUrg2Lkw.js → useProfileImageUpload-C6Gat9NR.js} +6 -6
- package/dist/useProfileImageUpload-C6Gat9NR.js.map +1 -0
- package/dist/useProfileImageUpload-KpvcwEqx.js.map +1 -1
- package/dist/{utils-BxC_k1lu.js → utils-C58No1u2.js} +108 -62
- package/dist/utils-C58No1u2.js.map +1 -0
- package/dist/{utils-WEbpTEyB.js → utils-CFUW0P-E.js} +102 -61
- package/dist/utils-CFUW0P-E.js.map +1 -0
- package/dist/utils.js.map +1 -1
- package/package.json +57 -54
- package/types.d.ts +1 -0
- package/dist/index-BkKE5xo-.js.map +0 -1
- package/dist/index-FbPHXCzL.js.map +0 -1
- package/dist/useProfileImageUpload-UUrg2Lkw.js.map +0 -1
- package/dist/utils-BxC_k1lu.js.map +0 -1
- package/dist/utils-WEbpTEyB.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
2
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
3
|
-
import
|
|
3
|
+
import g, { PureComponent, createRef, useState, useRef, useCallback, createElement, useEffect } from 'react';
|
|
4
4
|
import { isPresent, noop } from '@bigbinary/neeto-cist';
|
|
5
5
|
import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
|
|
6
6
|
import NeetoUIModal from '@bigbinary/neetoui/Modal';
|
|
@@ -10,15 +10,15 @@ import Toastr from '@bigbinary/neetoui/Toastr';
|
|
|
10
10
|
import Typography from '@bigbinary/neetoui/Typography';
|
|
11
11
|
import { mergeRight, identity, prop, equals } from 'ramda';
|
|
12
12
|
import { useTranslation, Trans } from 'react-i18next';
|
|
13
|
-
import { b as isNilOrEmpty, c as DEFAULT_CROP_CONFIG, d as
|
|
14
|
-
import {
|
|
13
|
+
import { b as isNilOrEmpty, c as DEFAULT_CROP_CONFIG, g as getAspectRatio, d as getPixels, e as getHeightFromAspectRatio, f as getWidthFromAspectRatio, h as getInitialCropSize, j as getPercentage, k as isItemsCenter, l as getCloudFlareCroppedURL, m as getImageKitCroppedURL, n as getCropValues, o as IMAGES_PER_PAGE, p as INFINITE_SCROLLER_SIZES, q as INFINITE_SCROLLER_STYLE, T as TABS, A as ASSETS_DESTROY_URL, r as ASSETS_FETCH_URL, U as UNSPLASH_DEFAULT_NAME, s as UNSPLASH_DEFAULT_REQUEST_CONFIG, D as DEFAULT_UPLOAD_CONFIG, u as useUploadDropzone, t as UNSPLASH_URL, a as ImageDirectUpload } from './utils-CFUW0P-E.js';
|
|
14
|
+
import { u as useImageUploader, a as useCreateBlob, g as generateASCIIFileName } from './useImageUploader-RX88_Cp-.js';
|
|
15
15
|
import { I as IS_DEVELOPMENT_OR_HEROKU_ENV, C as CLOUD_FLARE } from './index-CZjb2iXB.js';
|
|
16
16
|
import classnames from 'classnames';
|
|
17
17
|
import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
|
|
18
18
|
import Button from '@bigbinary/neetoui/Button';
|
|
19
19
|
import { useMutation, useInfiniteQuery, useQueryClient, keepPreviousData } from '@tanstack/react-query';
|
|
20
20
|
import axios from 'axios';
|
|
21
|
-
import { useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
21
|
+
import { withT, useFuncDebounce, useDebounce } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
22
22
|
import { withEventTargetValue, hasPermission } from '@bigbinary/neeto-commons-frontend/utils';
|
|
23
23
|
import Input from '@bigbinary/neetoui/Input';
|
|
24
24
|
import Switch from '@bigbinary/neetoui/Switch';
|
|
@@ -42,45 +42,415 @@ var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r
|
|
|
42
42
|
var css$2 = ".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}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX21vZGFsLnNjc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBR0E7RUFDRSxzQkFBQTtFQUNBLHVCQUFBO0VBQ0EsNEJBQUE7RUFDQSw0QkFBQTtFQUNBLDZCQUFBO0FBRkYiLCJzb3VyY2VzQ29udGVudCI6WyIvL0Fic3RyYWN0c1xuQGltcG9ydCBcIi4uL2Fic3RyYWN0cy92YXJpYWJsZXNcIjtcblxuLm5pdS1tb2RhbCB7XG4gIHdpZHRoOiAkbml1LW1vZGFsLXdpZHRoICFpbXBvcnRhbnQ7XG4gIGhlaWdodDogJG5pdS1tb2RhbC1oZWlnaHQgIWltcG9ydGFudDtcbiAgbWF4LXdpZHRoOiAkbml1LW1vZGFsLW1heC13aWR0aCAhaW1wb3J0YW50O1xuICBtYXgtaGVpZ2h0OiAkbml1LW1vZGFsLW1heC1oZWlnaHQgIWltcG9ydGFudDtcbiAgcG9zaXRpb246IHJlbGF0aXZlICFpbXBvcnRhbnQ7XG59XG4iXX0= */";
|
|
43
43
|
n(css$2,{});
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const M = {
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
width: 0,
|
|
49
|
+
height: 0,
|
|
50
|
+
unit: "px"
|
|
51
|
+
}, f = (s, t, e) => Math.min(Math.max(s, t), e), S = (...s) => s.filter((t) => t && typeof t == "string").join(" "), P = (s, t) => s === t || s.width === t.width && s.height === t.height && s.x === t.x && s.y === t.y && s.unit === t.unit;
|
|
52
|
+
function H(s, t, e, o) {
|
|
53
|
+
const i = y(s, e, o);
|
|
54
|
+
return s.width && (i.height = i.width / t), s.height && (i.width = i.height * t), i.y + i.height > o && (i.height = o - i.y, i.width = i.height * t), i.x + i.width > e && (i.width = e - i.x, i.height = i.width / t), s.unit === "%" ? D(i, e, o) : i;
|
|
49
55
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var f = n.default;
|
|
54
|
-
if (typeof f == "function") {
|
|
55
|
-
var a = function a () {
|
|
56
|
-
if (this instanceof a) {
|
|
57
|
-
return Reflect.construct(f, arguments, this.constructor);
|
|
58
|
-
}
|
|
59
|
-
return f.apply(this, arguments);
|
|
60
|
-
};
|
|
61
|
-
a.prototype = f.prototype;
|
|
62
|
-
} else a = {};
|
|
63
|
-
Object.defineProperty(a, '__esModule', {value: true});
|
|
64
|
-
Object.keys(n).forEach(function (k) {
|
|
65
|
-
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
66
|
-
Object.defineProperty(a, k, d.get ? d : {
|
|
67
|
-
enumerable: true,
|
|
68
|
-
get: function () {
|
|
69
|
-
return n[k];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
return a;
|
|
56
|
+
function N(s, t, e) {
|
|
57
|
+
const o = y(s, t, e);
|
|
58
|
+
return o.x = (t - o.width) / 2, o.y = (e - o.height) / 2, s.unit === "%" ? D(o, t, e) : o;
|
|
74
59
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
!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})()));
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
60
|
+
function D(s, t, e) {
|
|
61
|
+
return s.unit === "%" ? { ...M, ...s, unit: "%" } : {
|
|
62
|
+
unit: "%",
|
|
63
|
+
x: s.x ? s.x / t * 100 : 0,
|
|
64
|
+
y: s.y ? s.y / e * 100 : 0,
|
|
65
|
+
width: s.width ? s.width / t * 100 : 0,
|
|
66
|
+
height: s.height ? s.height / e * 100 : 0
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function y(s, t, e) {
|
|
70
|
+
return s.unit ? s.unit === "px" ? { ...M, ...s, unit: "px" } : {
|
|
71
|
+
unit: "px",
|
|
72
|
+
x: s.x ? s.x * t / 100 : 0,
|
|
73
|
+
y: s.y ? s.y * e / 100 : 0,
|
|
74
|
+
width: s.width ? s.width * t / 100 : 0,
|
|
75
|
+
height: s.height ? s.height * e / 100 : 0
|
|
76
|
+
} : { ...M, ...s, unit: "px" };
|
|
77
|
+
}
|
|
78
|
+
function X(s, t, e, o, i, n = 0, a = 0, w = o, h = i) {
|
|
79
|
+
const r = { ...s };
|
|
80
|
+
let c = Math.min(n, o), d = Math.min(a, i), p = Math.min(w, o), l = Math.min(h, i);
|
|
81
|
+
t && (t > 1 ? (c = a ? a * t : c, d = c / t, p = w * t) : (d = n ? n / t : d, c = d * t, l = h / t)), r.y < 0 && (r.height = Math.max(r.height + r.y, d), r.y = 0), r.x < 0 && (r.width = Math.max(r.width + r.x, c), r.x = 0);
|
|
82
|
+
const u = o - (r.x + r.width);
|
|
83
|
+
u < 0 && (r.x = Math.min(r.x, o - c), r.width += u);
|
|
84
|
+
const C = i - (r.y + r.height);
|
|
85
|
+
if (C < 0 && (r.y = Math.min(r.y, i - d), r.height += C), r.width < c && ((e === "sw" || e == "nw") && (r.x -= c - r.width), r.width = c), r.height < d && ((e === "nw" || e == "ne") && (r.y -= d - r.height), r.height = d), r.width > p && ((e === "sw" || e == "nw") && (r.x -= p - r.width), r.width = p), r.height > l && ((e === "nw" || e == "ne") && (r.y -= l - r.height), r.height = l), t) {
|
|
86
|
+
const R = r.width / r.height;
|
|
87
|
+
if (R < t) {
|
|
88
|
+
const x = Math.max(r.width / t, d);
|
|
89
|
+
(e === "nw" || e == "ne") && (r.y -= x - r.height), r.height = x;
|
|
90
|
+
} else if (R > t) {
|
|
91
|
+
const x = Math.max(r.height * t, c);
|
|
92
|
+
(e === "sw" || e == "nw") && (r.x -= x - r.width), r.width = x;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return r;
|
|
96
|
+
}
|
|
97
|
+
function K(s, t, e, o) {
|
|
98
|
+
const i = { ...s };
|
|
99
|
+
return t === "ArrowLeft" ? o === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : o === "w" ? (i.x -= e, i.width += e) : o === "sw" ? (i.x -= e, i.width += e, i.height += e) : o === "ne" ? (i.y += e, i.width -= e, i.height -= e) : o === "e" ? i.width -= e : o === "se" && (i.width -= e, i.height -= e) : t === "ArrowRight" && (o === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : o === "w" ? (i.x += e, i.width -= e) : o === "sw" ? (i.x += e, i.width -= e, i.height -= e) : o === "ne" ? (i.y -= e, i.width += e, i.height += e) : o === "e" ? i.width += e : o === "se" && (i.width += e, i.height += e)), t === "ArrowUp" ? o === "nw" ? (i.x -= e, i.y -= e, i.width += e, i.height += e) : o === "n" ? (i.y -= e, i.height += e) : o === "ne" ? (i.y -= e, i.width += e, i.height += e) : o === "sw" ? (i.x += e, i.width -= e, i.height -= e) : o === "s" ? i.height -= e : o === "se" && (i.width -= e, i.height -= e) : t === "ArrowDown" && (o === "nw" ? (i.x += e, i.y += e, i.width -= e, i.height -= e) : o === "n" ? (i.y += e, i.height -= e) : o === "ne" ? (i.y += e, i.width -= e, i.height -= e) : o === "sw" ? (i.x -= e, i.width += e, i.height += e) : o === "s" ? i.height += e : o === "se" && (i.width += e, i.height += e)), i;
|
|
100
|
+
}
|
|
101
|
+
const b = { capture: !0, passive: !1 }, v = class m extends PureComponent {
|
|
102
|
+
constructor() {
|
|
103
|
+
super(...arguments), this.docMoveBound = !1, this.mouseDownOnCrop = !1, this.dragStarted = !1, this.evData = {
|
|
104
|
+
startClientX: 0,
|
|
105
|
+
startClientY: 0,
|
|
106
|
+
startCropX: 0,
|
|
107
|
+
startCropY: 0,
|
|
108
|
+
clientX: 0,
|
|
109
|
+
clientY: 0,
|
|
110
|
+
isResize: !0
|
|
111
|
+
}, this.componentRef = createRef(), this.mediaRef = createRef(), this.initChangeCalled = !1, this.state = {
|
|
112
|
+
cropIsActive: !1,
|
|
113
|
+
newCropIsBeingDrawn: !1
|
|
114
|
+
}, this.onCropPointerDown = (t) => {
|
|
115
|
+
const { crop: e, disabled: o } = this.props, i = this.getBox();
|
|
116
|
+
if (!e)
|
|
117
|
+
return;
|
|
118
|
+
const n = y(e, i.width, i.height);
|
|
119
|
+
if (o)
|
|
120
|
+
return;
|
|
121
|
+
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
122
|
+
const a = t.target.dataset.ord, w = !!a;
|
|
123
|
+
let h = t.clientX, r = t.clientY, c = n.x, d = n.y;
|
|
124
|
+
if (a) {
|
|
125
|
+
const p = t.clientX - i.x, l = t.clientY - i.y;
|
|
126
|
+
let u = 0, C = 0;
|
|
127
|
+
a === "ne" || a == "e" ? (u = p - (n.x + n.width), C = l - n.y, c = n.x, d = n.y + n.height) : a === "se" || a === "s" ? (u = p - (n.x + n.width), C = l - (n.y + n.height), c = n.x, d = n.y) : a === "sw" || a == "w" ? (u = p - n.x, C = l - (n.y + n.height), c = n.x + n.width, d = n.y) : (a === "nw" || a == "n") && (u = p - n.x, C = l - n.y, c = n.x + n.width, d = n.y + n.height), h = c + i.x + u, r = d + i.y + C;
|
|
128
|
+
}
|
|
129
|
+
this.evData = {
|
|
130
|
+
startClientX: h,
|
|
131
|
+
startClientY: r,
|
|
132
|
+
startCropX: c,
|
|
133
|
+
startCropY: d,
|
|
134
|
+
clientX: t.clientX,
|
|
135
|
+
clientY: t.clientY,
|
|
136
|
+
isResize: w,
|
|
137
|
+
ord: a
|
|
138
|
+
}, this.mouseDownOnCrop = !0, this.setState({ cropIsActive: !0 });
|
|
139
|
+
}, this.onComponentPointerDown = (t) => {
|
|
140
|
+
const { crop: e, disabled: o, locked: i, keepSelection: n, onChange: a } = this.props, w = this.getBox();
|
|
141
|
+
if (o || i || n && e)
|
|
142
|
+
return;
|
|
143
|
+
t.cancelable && t.preventDefault(), this.bindDocMove(), this.componentRef.current.focus({ preventScroll: !0 });
|
|
144
|
+
const h = t.clientX - w.x, r = t.clientY - w.y, c = {
|
|
145
|
+
unit: "px",
|
|
146
|
+
x: h,
|
|
147
|
+
y: r,
|
|
148
|
+
width: 0,
|
|
149
|
+
height: 0
|
|
150
|
+
};
|
|
151
|
+
this.evData = {
|
|
152
|
+
startClientX: t.clientX,
|
|
153
|
+
startClientY: t.clientY,
|
|
154
|
+
startCropX: h,
|
|
155
|
+
startCropY: r,
|
|
156
|
+
clientX: t.clientX,
|
|
157
|
+
clientY: t.clientY,
|
|
158
|
+
isResize: !0
|
|
159
|
+
}, this.mouseDownOnCrop = !0, a(y(c, w.width, w.height), D(c, w.width, w.height)), this.setState({ cropIsActive: !0, newCropIsBeingDrawn: !0 });
|
|
160
|
+
}, this.onDocPointerMove = (t) => {
|
|
161
|
+
const { crop: e, disabled: o, onChange: i, onDragStart: n } = this.props, a = this.getBox();
|
|
162
|
+
if (o || !e || !this.mouseDownOnCrop)
|
|
163
|
+
return;
|
|
164
|
+
t.cancelable && t.preventDefault(), this.dragStarted || (this.dragStarted = !0, n && n(t));
|
|
165
|
+
const { evData: w } = this;
|
|
166
|
+
w.clientX = t.clientX, w.clientY = t.clientY;
|
|
167
|
+
let h;
|
|
168
|
+
w.isResize ? h = this.resizeCrop() : h = this.dragCrop(), P(e, h) || i(
|
|
169
|
+
y(h, a.width, a.height),
|
|
170
|
+
D(h, a.width, a.height)
|
|
171
|
+
);
|
|
172
|
+
}, this.onComponentKeyDown = (t) => {
|
|
173
|
+
const { crop: e, disabled: o, onChange: i, onComplete: n } = this.props;
|
|
174
|
+
if (o)
|
|
175
|
+
return;
|
|
176
|
+
const a = t.key;
|
|
177
|
+
let w = !1;
|
|
178
|
+
if (!e)
|
|
179
|
+
return;
|
|
180
|
+
const h = this.getBox(), r = this.makePixelCrop(h), d = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? m.nudgeStepLarge : t.shiftKey ? m.nudgeStepMedium : m.nudgeStep;
|
|
181
|
+
if (a === "ArrowLeft" ? (r.x -= d, w = !0) : a === "ArrowRight" ? (r.x += d, w = !0) : a === "ArrowUp" ? (r.y -= d, w = !0) : a === "ArrowDown" && (r.y += d, w = !0), w) {
|
|
182
|
+
t.cancelable && t.preventDefault(), r.x = f(r.x, 0, h.width - r.width), r.y = f(r.y, 0, h.height - r.height);
|
|
183
|
+
const p = y(r, h.width, h.height), l = D(r, h.width, h.height);
|
|
184
|
+
i(p, l), n && n(p, l);
|
|
185
|
+
}
|
|
186
|
+
}, this.onHandlerKeyDown = (t, e) => {
|
|
187
|
+
const {
|
|
188
|
+
aspect: o = 0,
|
|
189
|
+
crop: i,
|
|
190
|
+
disabled: n,
|
|
191
|
+
minWidth: a = 0,
|
|
192
|
+
minHeight: w = 0,
|
|
193
|
+
maxWidth: h,
|
|
194
|
+
maxHeight: r,
|
|
195
|
+
onChange: c,
|
|
196
|
+
onComplete: d
|
|
197
|
+
} = this.props, p = this.getBox();
|
|
198
|
+
if (n || !i)
|
|
199
|
+
return;
|
|
200
|
+
if (t.key === "ArrowUp" || t.key === "ArrowDown" || t.key === "ArrowLeft" || t.key === "ArrowRight")
|
|
201
|
+
t.stopPropagation(), t.preventDefault();
|
|
202
|
+
else
|
|
203
|
+
return;
|
|
204
|
+
const u = (navigator.platform.match("Mac") ? t.metaKey : t.ctrlKey) ? m.nudgeStepLarge : t.shiftKey ? m.nudgeStepMedium : m.nudgeStep, C = y(i, p.width, p.height), R = K(C, t.key, u, e), x = X(
|
|
205
|
+
R,
|
|
206
|
+
o,
|
|
207
|
+
e,
|
|
208
|
+
p.width,
|
|
209
|
+
p.height,
|
|
210
|
+
a,
|
|
211
|
+
w,
|
|
212
|
+
h,
|
|
213
|
+
r
|
|
214
|
+
);
|
|
215
|
+
if (!P(i, x)) {
|
|
216
|
+
const Y = D(x, p.width, p.height);
|
|
217
|
+
c(x, Y), d && d(x, Y);
|
|
218
|
+
}
|
|
219
|
+
}, this.onDocPointerDone = (t) => {
|
|
220
|
+
const { crop: e, disabled: o, onComplete: i, onDragEnd: n } = this.props, a = this.getBox();
|
|
221
|
+
this.unbindDocMove(), !(o || !e) && this.mouseDownOnCrop && (this.mouseDownOnCrop = !1, this.dragStarted = !1, n && n(t), i && i(y(e, a.width, a.height), D(e, a.width, a.height)), this.setState({ cropIsActive: !1, newCropIsBeingDrawn: !1 }));
|
|
222
|
+
}, this.onDragFocus = (t) => {
|
|
223
|
+
var e;
|
|
224
|
+
(e = this.componentRef.current) == null || e.scrollTo(0, 0);
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
get document() {
|
|
228
|
+
return document;
|
|
229
|
+
}
|
|
230
|
+
// We unfortunately get the bounding box every time as x+y changes
|
|
231
|
+
// due to scrolling.
|
|
232
|
+
getBox() {
|
|
233
|
+
const t = this.mediaRef.current;
|
|
234
|
+
if (!t)
|
|
235
|
+
return { x: 0, y: 0, width: 0, height: 0 };
|
|
236
|
+
const { x: e, y: o, width: i, height: n } = t.getBoundingClientRect();
|
|
237
|
+
return { x: e, y: o, width: i, height: n };
|
|
238
|
+
}
|
|
239
|
+
componentDidUpdate(t) {
|
|
240
|
+
const { crop: e, onComplete: o } = this.props;
|
|
241
|
+
if (o && !t.crop && e) {
|
|
242
|
+
const { width: i, height: n } = this.getBox();
|
|
243
|
+
i && n && o(y(e, i, n), D(e, i, n));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
componentWillUnmount() {
|
|
247
|
+
this.resizeObserver && this.resizeObserver.disconnect();
|
|
248
|
+
}
|
|
249
|
+
bindDocMove() {
|
|
250
|
+
this.docMoveBound || (this.document.addEventListener("pointermove", this.onDocPointerMove, b), this.document.addEventListener("pointerup", this.onDocPointerDone, b), this.document.addEventListener("pointercancel", this.onDocPointerDone, b), this.docMoveBound = !0);
|
|
251
|
+
}
|
|
252
|
+
unbindDocMove() {
|
|
253
|
+
this.docMoveBound && (this.document.removeEventListener("pointermove", this.onDocPointerMove, b), this.document.removeEventListener("pointerup", this.onDocPointerDone, b), this.document.removeEventListener("pointercancel", this.onDocPointerDone, b), this.docMoveBound = !1);
|
|
254
|
+
}
|
|
255
|
+
getCropStyle() {
|
|
256
|
+
const { crop: t } = this.props;
|
|
257
|
+
if (t)
|
|
258
|
+
return {
|
|
259
|
+
top: `${t.y}${t.unit}`,
|
|
260
|
+
left: `${t.x}${t.unit}`,
|
|
261
|
+
width: `${t.width}${t.unit}`,
|
|
262
|
+
height: `${t.height}${t.unit}`
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
dragCrop() {
|
|
266
|
+
const { evData: t } = this, e = this.getBox(), o = this.makePixelCrop(e), i = t.clientX - t.startClientX, n = t.clientY - t.startClientY;
|
|
267
|
+
return o.x = f(t.startCropX + i, 0, e.width - o.width), o.y = f(t.startCropY + n, 0, e.height - o.height), o;
|
|
268
|
+
}
|
|
269
|
+
getPointRegion(t, e, o, i) {
|
|
270
|
+
const { evData: n } = this, a = n.clientX - t.x, w = n.clientY - t.y;
|
|
271
|
+
let h;
|
|
272
|
+
i && e ? h = e === "nw" || e === "n" || e === "ne" : h = w < n.startCropY;
|
|
273
|
+
let r;
|
|
274
|
+
return o && e ? r = e === "nw" || e === "w" || e === "sw" : r = a < n.startCropX, r ? h ? "nw" : "sw" : h ? "ne" : "se";
|
|
275
|
+
}
|
|
276
|
+
resolveMinDimensions(t, e, o = 0, i = 0) {
|
|
277
|
+
let n = Math.min(o, t.width), a = Math.min(i, t.height);
|
|
278
|
+
return !e || !n && !a ? [n, a] : e > 1 ? n ? [n, n / e] : [a * e, a] : a ? [a * e, a] : [n, n / e];
|
|
279
|
+
}
|
|
280
|
+
resizeCrop() {
|
|
281
|
+
const { evData: t } = this, { aspect: e = 0, maxWidth: o, maxHeight: i } = this.props, n = this.getBox(), [a, w] = this.resolveMinDimensions(n, e, this.props.minWidth, this.props.minHeight);
|
|
282
|
+
let h = this.makePixelCrop(n), r = this.getPointRegion(n, t.ord, a, w);
|
|
283
|
+
const c = t.ord || r;
|
|
284
|
+
let d = t.clientX - t.startClientX, p = t.clientY - t.startClientY;
|
|
285
|
+
(a && c === "nw" || c === "w" || c === "sw") && (d = Math.min(d, -a)), (w && c === "nw" || c === "n" || c === "ne") && (p = Math.min(p, -w));
|
|
286
|
+
const l = {
|
|
287
|
+
unit: "px",
|
|
288
|
+
x: 0,
|
|
289
|
+
y: 0,
|
|
290
|
+
width: 0,
|
|
291
|
+
height: 0
|
|
292
|
+
};
|
|
293
|
+
r === "ne" ? (l.x = t.startCropX, l.width = d, e ? (l.height = l.width / e, l.y = t.startCropY - l.height) : (l.height = Math.abs(p), l.y = t.startCropY - l.height)) : r === "se" ? (l.x = t.startCropX, l.y = t.startCropY, l.width = d, e ? l.height = l.width / e : l.height = p) : r === "sw" ? (l.x = t.startCropX + d, l.y = t.startCropY, l.width = Math.abs(d), e ? l.height = l.width / e : l.height = p) : r === "nw" && (l.x = t.startCropX + d, l.width = Math.abs(d), e ? (l.height = l.width / e, l.y = t.startCropY - l.height) : (l.height = Math.abs(p), l.y = t.startCropY + p));
|
|
294
|
+
const u = X(
|
|
295
|
+
l,
|
|
296
|
+
e,
|
|
297
|
+
r,
|
|
298
|
+
n.width,
|
|
299
|
+
n.height,
|
|
300
|
+
a,
|
|
301
|
+
w,
|
|
302
|
+
o,
|
|
303
|
+
i
|
|
304
|
+
);
|
|
305
|
+
return e || m.xyOrds.indexOf(c) > -1 ? h = u : m.xOrds.indexOf(c) > -1 ? (h.x = u.x, h.width = u.width) : m.yOrds.indexOf(c) > -1 && (h.y = u.y, h.height = u.height), h.x = f(h.x, 0, n.width - h.width), h.y = f(h.y, 0, n.height - h.height), h;
|
|
306
|
+
}
|
|
307
|
+
createCropSelection() {
|
|
308
|
+
const {
|
|
309
|
+
ariaLabels: t = m.defaultProps.ariaLabels,
|
|
310
|
+
disabled: e,
|
|
311
|
+
locked: o,
|
|
312
|
+
renderSelectionAddon: i,
|
|
313
|
+
ruleOfThirds: n,
|
|
314
|
+
crop: a
|
|
315
|
+
} = this.props, w = this.getCropStyle();
|
|
316
|
+
if (a)
|
|
317
|
+
return /* @__PURE__ */ g.createElement(
|
|
318
|
+
"div",
|
|
319
|
+
{
|
|
320
|
+
style: w,
|
|
321
|
+
className: "ReactCrop__crop-selection",
|
|
322
|
+
onPointerDown: this.onCropPointerDown,
|
|
323
|
+
"aria-label": t.cropArea,
|
|
324
|
+
tabIndex: 0,
|
|
325
|
+
onKeyDown: this.onComponentKeyDown,
|
|
326
|
+
role: "group"
|
|
327
|
+
},
|
|
328
|
+
!e && !o && /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__drag-elements", onFocus: this.onDragFocus }, /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__drag-bar ord-n", "data-ord": "n" }), /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__drag-bar ord-e", "data-ord": "e" }), /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__drag-bar ord-s", "data-ord": "s" }), /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__drag-bar ord-w", "data-ord": "w" }), /* @__PURE__ */ g.createElement(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
className: "ReactCrop__drag-handle ord-nw",
|
|
332
|
+
"data-ord": "nw",
|
|
333
|
+
tabIndex: 0,
|
|
334
|
+
"aria-label": t.nwDragHandle,
|
|
335
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "nw"),
|
|
336
|
+
role: "button"
|
|
337
|
+
}
|
|
338
|
+
), /* @__PURE__ */ g.createElement(
|
|
339
|
+
"div",
|
|
340
|
+
{
|
|
341
|
+
className: "ReactCrop__drag-handle ord-n",
|
|
342
|
+
"data-ord": "n",
|
|
343
|
+
tabIndex: 0,
|
|
344
|
+
"aria-label": t.nDragHandle,
|
|
345
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "n"),
|
|
346
|
+
role: "button"
|
|
347
|
+
}
|
|
348
|
+
), /* @__PURE__ */ g.createElement(
|
|
349
|
+
"div",
|
|
350
|
+
{
|
|
351
|
+
className: "ReactCrop__drag-handle ord-ne",
|
|
352
|
+
"data-ord": "ne",
|
|
353
|
+
tabIndex: 0,
|
|
354
|
+
"aria-label": t.neDragHandle,
|
|
355
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "ne"),
|
|
356
|
+
role: "button"
|
|
357
|
+
}
|
|
358
|
+
), /* @__PURE__ */ g.createElement(
|
|
359
|
+
"div",
|
|
360
|
+
{
|
|
361
|
+
className: "ReactCrop__drag-handle ord-e",
|
|
362
|
+
"data-ord": "e",
|
|
363
|
+
tabIndex: 0,
|
|
364
|
+
"aria-label": t.eDragHandle,
|
|
365
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "e"),
|
|
366
|
+
role: "button"
|
|
367
|
+
}
|
|
368
|
+
), /* @__PURE__ */ g.createElement(
|
|
369
|
+
"div",
|
|
370
|
+
{
|
|
371
|
+
className: "ReactCrop__drag-handle ord-se",
|
|
372
|
+
"data-ord": "se",
|
|
373
|
+
tabIndex: 0,
|
|
374
|
+
"aria-label": t.seDragHandle,
|
|
375
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "se"),
|
|
376
|
+
role: "button"
|
|
377
|
+
}
|
|
378
|
+
), /* @__PURE__ */ g.createElement(
|
|
379
|
+
"div",
|
|
380
|
+
{
|
|
381
|
+
className: "ReactCrop__drag-handle ord-s",
|
|
382
|
+
"data-ord": "s",
|
|
383
|
+
tabIndex: 0,
|
|
384
|
+
"aria-label": t.sDragHandle,
|
|
385
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "s"),
|
|
386
|
+
role: "button"
|
|
387
|
+
}
|
|
388
|
+
), /* @__PURE__ */ g.createElement(
|
|
389
|
+
"div",
|
|
390
|
+
{
|
|
391
|
+
className: "ReactCrop__drag-handle ord-sw",
|
|
392
|
+
"data-ord": "sw",
|
|
393
|
+
tabIndex: 0,
|
|
394
|
+
"aria-label": t.swDragHandle,
|
|
395
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "sw"),
|
|
396
|
+
role: "button"
|
|
397
|
+
}
|
|
398
|
+
), /* @__PURE__ */ g.createElement(
|
|
399
|
+
"div",
|
|
400
|
+
{
|
|
401
|
+
className: "ReactCrop__drag-handle ord-w",
|
|
402
|
+
"data-ord": "w",
|
|
403
|
+
tabIndex: 0,
|
|
404
|
+
"aria-label": t.wDragHandle,
|
|
405
|
+
onKeyDown: (h) => this.onHandlerKeyDown(h, "w"),
|
|
406
|
+
role: "button"
|
|
407
|
+
}
|
|
408
|
+
)),
|
|
409
|
+
i && /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__selection-addon", onMouseDown: (h) => h.stopPropagation() }, i(this.state)),
|
|
410
|
+
n && /* @__PURE__ */ g.createElement(g.Fragment, null, /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__rule-of-thirds-hz" }), /* @__PURE__ */ g.createElement("div", { className: "ReactCrop__rule-of-thirds-vt" }))
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
makePixelCrop(t) {
|
|
414
|
+
const e = { ...M, ...this.props.crop || {} };
|
|
415
|
+
return y(e, t.width, t.height);
|
|
416
|
+
}
|
|
417
|
+
render() {
|
|
418
|
+
const { aspect: t, children: e, circularCrop: o, className: i, crop: n, disabled: a, locked: w, style: h, ruleOfThirds: r } = this.props, { cropIsActive: c, newCropIsBeingDrawn: d } = this.state, p = n ? this.createCropSelection() : null, l = S(
|
|
419
|
+
"ReactCrop",
|
|
420
|
+
i,
|
|
421
|
+
c && "ReactCrop--active",
|
|
422
|
+
a && "ReactCrop--disabled",
|
|
423
|
+
w && "ReactCrop--locked",
|
|
424
|
+
d && "ReactCrop--new-crop",
|
|
425
|
+
n && t && "ReactCrop--fixed-aspect",
|
|
426
|
+
n && o && "ReactCrop--circular-crop",
|
|
427
|
+
n && r && "ReactCrop--rule-of-thirds",
|
|
428
|
+
!this.dragStarted && n && !n.width && !n.height && "ReactCrop--invisible-crop",
|
|
429
|
+
o && "ReactCrop--no-animate"
|
|
430
|
+
);
|
|
431
|
+
return /* @__PURE__ */ g.createElement("div", { ref: this.componentRef, className: l, style: h }, /* @__PURE__ */ g.createElement("div", { ref: this.mediaRef, className: "ReactCrop__child-wrapper", onPointerDown: this.onComponentPointerDown }, e), p);
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
v.xOrds = ["e", "w"];
|
|
435
|
+
v.yOrds = ["n", "s"];
|
|
436
|
+
v.xyOrds = ["nw", "ne", "se", "sw"];
|
|
437
|
+
v.nudgeStep = 1;
|
|
438
|
+
v.nudgeStepMedium = 10;
|
|
439
|
+
v.nudgeStepLarge = 100;
|
|
440
|
+
v.defaultProps = {
|
|
441
|
+
ariaLabels: {
|
|
442
|
+
cropArea: "Use the arrow keys to move the crop selection area",
|
|
443
|
+
nwDragHandle: "Use the arrow keys to move the north west drag handle to change the crop selection area",
|
|
444
|
+
nDragHandle: "Use the up and down arrow keys to move the north drag handle to change the crop selection area",
|
|
445
|
+
neDragHandle: "Use the arrow keys to move the north east drag handle to change the crop selection area",
|
|
446
|
+
eDragHandle: "Use the up and down arrow keys to move the east drag handle to change the crop selection area",
|
|
447
|
+
seDragHandle: "Use the arrow keys to move the south east drag handle to change the crop selection area",
|
|
448
|
+
sDragHandle: "Use the up and down arrow keys to move the south drag handle to change the crop selection area",
|
|
449
|
+
swDragHandle: "Use the arrow keys to move the south west drag handle to change the crop selection area",
|
|
450
|
+
wDragHandle: "Use the up and down arrow keys to move the west drag handle to change the crop selection area"
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
let I = v;
|
|
84
454
|
|
|
85
455
|
var cropImage = function cropImage(payload) {
|
|
86
456
|
return axios.post("neeto_image_uploader_engine/development/crop_image", payload);
|
|
@@ -89,188 +459,36 @@ var developmentApi = {
|
|
|
89
459
|
cropImage: cropImage
|
|
90
460
|
};
|
|
91
461
|
|
|
92
|
-
function ownKeys$
|
|
93
|
-
function _objectSpread$
|
|
462
|
+
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; }
|
|
463
|
+
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; }
|
|
94
464
|
var useCropImage = function useCropImage(options) {
|
|
95
|
-
return useMutation(_objectSpread$
|
|
465
|
+
return useMutation(_objectSpread$3({
|
|
96
466
|
mutationFn: developmentApi.cropImage
|
|
97
467
|
}, options));
|
|
98
468
|
};
|
|
99
469
|
|
|
100
|
-
var css$1 = ".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}}.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9yZWFjdC1pbWFnZS1jcm9wL2Rpc3QvUmVhY3RDcm9wLmNzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3JlYWN0LWNyb3Auc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxXQUFXLGlCQUFpQixDQUFDLG9CQUFvQixDQUFDLGdCQUFnQixDQUFDLGVBQWUsQ0FBQyxjQUFjLENBQUMsc0RBQXNELHFCQUFxQixDQUFDLHdDQUF3QyxjQUFjLENBQUMsMEJBQTBCLGtCQUFrQixDQUFDLDhEQUE4RCxhQUFhL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kbGUub3JkLWUsLlJlYWN0Q3JvcC0tZml4ZWQtYXNwZWN0IC5SZWFjdENyb3BfX2RyYWctaGFuZGxlLm9yZC1zLC5SZWFjdENyb3AtLWZpeGVkLWFzcGVjdCAuUmVhY3RDcm9wX19kcmFnLWhhbmRsZS5vcmQtd3tkaXNwbGF5Om5vbmV9QG1lZGlhKHBvaW50ZXI6IGNvYXJzZSl7LlJlYWN0Q3JvcCAub3JkLW4sLlJlYWN0Q3JvcCAub3JkLWUsLlJlYWN0Q3JvcCAub3JkLXMsLlJlYWN0Q3JvcCAub3JkLXd7ZGlzcGxheTpub25lfS5SZWFjdENyb3BfX2RyYWctaGFuZGxle3dpZHRoOjI0cHg7aGVpZ2h0OjI0cHh9fVxuIiwiQGltcG9ydCBcInJlYWN0LWltYWdlLWNyb3AvZGlzdC9SZWFjdENyb3AuY3NzXCI7XG5cbi5SZWFjdENyb3Age1xuICAuUmVhY3RDcm9wX19jaGlsZC13cmFwcGVyIHtcbiAgICB3aWR0aDogMTAwJTtcbiAgICBoZWlnaHQ6IDEwMCU7XG5cbiAgICBpbWcge1xuICAgICAgaGVpZ2h0OiBhdXRvO1xuICAgICAgd2lkdGg6IGF1dG87XG4gICAgICBtYXgtd2lkdGg6IDEwMCU7XG4gICAgICBtYXgtaGVpZ2h0OiAxMDAlO1xuICAgICAgZGlzcGxheTogYmxvY2s7XG4gICAgfVxuICB9XG59XG4iXX0= */";
|
|
470
|
+
var css$1 = ".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:translateZ(0);cursor:move;box-shadow:0 0 0 9999em #00000080}.ReactCrop--disabled .ReactCrop__crop-selection{cursor:inherit}.ReactCrop--circular-crop .ReactCrop__crop-selection{border-radius:50%}.ReactCrop--no-animate .ReactCrop__crop-selection{outline:1px dashed white}.ReactCrop__crop-selection:not(.ReactCrop--no-animate .ReactCrop__crop-selection){animation:marching-ants 1s;background-image:linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to right,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%),linear-gradient(to bottom,#fff 50%,#444 50%);background-size:10px 1px,10px 1px,1px 10px,1px 10px;background-position:0 0,0 100%,0 0,100% 0;background-repeat:repeat-x,repeat-x,repeat-y,repeat-y;color:#fff;animation-play-state:running;animation-timing-function:linear;animation-iteration-count:infinite}@keyframes marching-ants{0%{background-position:0 0,0 100%,0 0,100% 0}to{background-position:20px 0,-20px 100%,0 -20px,100% 20px}}.ReactCrop__crop-selection:focus{outline:none;border-color:#00f;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:#fff6}.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:#0003;border:1px solid rgba(255,255,255,.7);outline:1px solid transparent}.ReactCrop__drag-handle:focus:after{border-color:#00f;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,.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}}.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9yZWFjdC1pbWFnZS1jcm9wL2Rpc3QvUmVhY3RDcm9wLmNzcyIsImFwcC9qYXZhc2NyaXB0L3N0eWxlc2hlZXRzL2NvbXBvbmVudHMvX3JlYWN0LWNyb3Auc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxXQUFXLGlCQUFpQixDQUFDLG9CQUFvQixDQUFDLGdCQUFnQixDQUFDLGVBQWUsQ0FBQyxjQUFjLENBQUMsb0RBQW9ELHFCQUFxQixDQUFDLHdDQUF3QyxjQUFjLENBQUMsMEJBQTBCLGtCQUFrQixDQUFDLDhEQUE4RCxhQUFhLENBQUMsY0FBYyxDQUFDLGtCQUFrQixDQUFDLHdJQUF3SSxpQkFBaUIsQ0FBQyxnRUFBZ0UsaUJBQWlCLENBQUMsMkJBQTJCLGlCQUFpQixDQUFDLEtBQUssQ0FBQyxNQUFNLENBQUMsdUJBQXVCLENBQUMsV0FBVyxDQUFDLGlDQUFpQyxDQUFDLGdEQUFnRCxjQUFjLENBQUMscURBQXFELGlCQUFpQixDQUFDLGtEQUFrRCx3QkFBd0IsQ0FBQyxrRkFBa0YsMEJBQTBCLENBQUMsa01BQWtNLENBQUMsbURBQW1ELENBQUMseUNBQXlDLENBQUMscURBQ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O1xuXG4uUmVhY3RDcm9wIHtcbiAgLlJlYWN0Q3JvcF9fY2hpbGQtd3JhcHBlciB7XG4gICAgd2lkdGg6IDEwMCU7XG4gICAgaGVpZ2h0OiAxMDAlO1xuXG4gICAgaW1nIHtcbiAgICAgIGhlaWdodDogYXV0bztcbiAgICAgIHdpZHRoOiBhdXRvO1xuICAgICAgbWF4LXdpZHRoOiAxMDAlO1xuICAgICAgbWF4LWhlaWdodDogMTAwJTtcbiAgICAgIGRpc3BsYXk6IGJsb2NrO1xuICAgIH1cbiAgfVxufVxuIl19 */";
|
|
101
471
|
n(css$1,{});
|
|
102
472
|
|
|
103
|
-
var
|
|
104
|
-
var
|
|
105
|
-
|
|
106
|
-
setCrop = _ref.setCrop,
|
|
107
|
-
_ref$crop = _ref.crop,
|
|
108
|
-
crop = _ref$crop === void 0 ? {} : _ref$crop,
|
|
473
|
+
var Controls = withT(function (_ref) {
|
|
474
|
+
var _imageRef$current, _imageRef$current2;
|
|
475
|
+
var t = _ref.t,
|
|
109
476
|
aspectRatio = _ref.aspectRatio,
|
|
110
|
-
imageRef = _ref.imageRef,
|
|
111
|
-
setAspectRatio = _ref.setAspectRatio,
|
|
112
|
-
setHeight = _ref.setHeight,
|
|
113
|
-
setWidth = _ref.setWidth;
|
|
114
|
-
var onToggleAspectRatioLock = function onToggleAspectRatioLock() {
|
|
115
|
-
setAspectRatioLocked(function (isAspectRatioLocked) {
|
|
116
|
-
return !isAspectRatioLocked;
|
|
117
|
-
});
|
|
118
|
-
if (!isAspectRatioLocked) {
|
|
119
|
-
var newHeight = crop.width / (aspectRatio.width / aspectRatio.height);
|
|
120
|
-
var newWidth = crop.height * (aspectRatio.width / aspectRatio.height);
|
|
121
|
-
newWidth + Math.trunc(crop.x) <= imageRef.current.width ? setCrop(mergeRight(crop, {
|
|
122
|
-
width: newWidth
|
|
123
|
-
})) : setCrop(mergeRight(crop, {
|
|
124
|
-
height: newHeight
|
|
125
|
-
}));
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
var handleWidthChange = function handleWidthChange(width) {
|
|
129
|
-
var cropWidth = Number(width);
|
|
130
|
-
var displayWidth = cropWidth * imageRef.current.width / imageRef.current.naturalWidth;
|
|
131
|
-
if (displayWidth > 0 && Math.trunc(crop.x) + displayWidth <= imageRef.current.width) {
|
|
132
|
-
if (isAspectRatioLocked) {
|
|
133
|
-
var displayHeight = displayWidth / (aspectRatio.width / aspectRatio.height);
|
|
134
|
-
displayHeight + Math.trunc(crop.y) <= imageRef.current.height && setCrop(mergeRight(crop, {
|
|
135
|
-
width: displayWidth,
|
|
136
|
-
height: displayHeight
|
|
137
|
-
}));
|
|
138
|
-
} else {
|
|
139
|
-
setCrop(mergeRight(crop, {
|
|
140
|
-
width: displayWidth
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
setWidth(crop.width.toFixed(2));
|
|
145
|
-
}
|
|
146
|
-
};
|
|
147
|
-
var handleHeightChange = function handleHeightChange(height) {
|
|
148
|
-
var cropHeight = Number(height);
|
|
149
|
-
var displayHeight = cropHeight * imageRef.current.height / imageRef.current.naturalHeight;
|
|
150
|
-
if (displayHeight > 0 && Math.trunc(crop.y) + displayHeight <= imageRef.current.height) {
|
|
151
|
-
if (isAspectRatioLocked) {
|
|
152
|
-
var displayWidth = displayHeight * aspectRatio.width / aspectRatio.height;
|
|
153
|
-
displayWidth + Math.trunc(crop.x) <= imageRef.current.width && setCrop(mergeRight(crop, {
|
|
154
|
-
height: displayHeight,
|
|
155
|
-
width: displayWidth
|
|
156
|
-
}));
|
|
157
|
-
} else {
|
|
158
|
-
setCrop(mergeRight(crop, {
|
|
159
|
-
height: displayHeight
|
|
160
|
-
}));
|
|
161
|
-
}
|
|
162
|
-
} else {
|
|
163
|
-
setHeight(crop.height.toFixed(2));
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
|
-
var handleAspectWidthChange = function handleAspectWidthChange(aspectWidth) {
|
|
167
|
-
if (aspectWidth <= 0) {
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
if (!isAspectRatioLocked) {
|
|
171
|
-
setAspectRatio(mergeRight(aspectRatio, {
|
|
172
|
-
width: aspectWidth
|
|
173
|
-
}));
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
var newWidth = crop.height * (aspectWidth / aspectRatio.height);
|
|
177
|
-
if (newWidth + Math.trunc(crop.x) <= imageRef.current.width) {
|
|
178
|
-
setCrop(mergeRight(crop, {
|
|
179
|
-
width: newWidth
|
|
180
|
-
}));
|
|
181
|
-
setAspectRatio(mergeRight(aspectRatio, {
|
|
182
|
-
width: aspectWidth
|
|
183
|
-
}));
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
|
-
var handleAspectHeightChange = function handleAspectHeightChange(aspectHeight) {
|
|
187
|
-
if (aspectHeight <= 0) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
if (!isAspectRatioLocked) {
|
|
191
|
-
setAspectRatio(mergeRight(aspectRatio, {
|
|
192
|
-
height: aspectHeight
|
|
193
|
-
}));
|
|
194
|
-
return;
|
|
195
|
-
}
|
|
196
|
-
var newHeight = crop.width / (aspectRatio.width / aspectHeight);
|
|
197
|
-
if (newHeight + Math.trunc(crop.y) <= imageRef.current.height) {
|
|
198
|
-
setCrop(mergeRight(crop, {
|
|
199
|
-
height: newHeight
|
|
200
|
-
}));
|
|
201
|
-
setAspectRatio(mergeRight(aspectRatio, {
|
|
202
|
-
height: aspectHeight
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
};
|
|
206
|
-
return {
|
|
207
|
-
onToggleAspectRatioLock: onToggleAspectRatioLock,
|
|
208
|
-
handleWidthChange: handleWidthChange,
|
|
209
|
-
handleHeightChange: handleHeightChange,
|
|
210
|
-
handleAspectWidthChange: handleAspectWidthChange,
|
|
211
|
-
handleAspectHeightChange: handleAspectHeightChange
|
|
212
|
-
};
|
|
213
|
-
};
|
|
214
|
-
|
|
215
|
-
var Controls = function Controls(_ref) {
|
|
216
|
-
var aspectRatio = _ref.aspectRatio,
|
|
217
477
|
isAspectRatioLocked = _ref.isAspectRatioLocked,
|
|
218
478
|
crop = _ref.crop,
|
|
219
479
|
handleSubmit = _ref.handleSubmit,
|
|
220
|
-
setAspectRatio = _ref.setAspectRatio,
|
|
221
|
-
setAspectRatioLocked = _ref.setAspectRatioLocked,
|
|
222
|
-
setCrop = _ref.setCrop,
|
|
223
480
|
imageRef = _ref.imageRef,
|
|
224
481
|
isFullImage = _ref.isFullImage,
|
|
225
482
|
setIsFullImage = _ref.setIsFullImage,
|
|
226
483
|
_ref$hideControls = _ref.hideControls,
|
|
227
|
-
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
var _imageRef$current3, _imageRef$current4;
|
|
236
|
-
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));
|
|
237
|
-
};
|
|
238
|
-
var _useState = useState(getActualCropHeight(crop.height)),
|
|
239
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
240
|
-
height = _useState2[0],
|
|
241
|
-
setHeight = _useState2[1];
|
|
242
|
-
var _useState3 = useState(getActualCropWidth(crop.width)),
|
|
243
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
244
|
-
width = _useState4[0],
|
|
245
|
-
setWidth = _useState4[1];
|
|
246
|
-
var _useImageControls = useImageControls({
|
|
247
|
-
isAspectRatioLocked: isAspectRatioLocked,
|
|
248
|
-
setAspectRatioLocked: setAspectRatioLocked,
|
|
249
|
-
setCrop: setCrop,
|
|
250
|
-
crop: crop,
|
|
251
|
-
aspectRatio: aspectRatio,
|
|
252
|
-
imageRef: imageRef,
|
|
253
|
-
setAspectRatio: setAspectRatio,
|
|
254
|
-
setHeight: setHeight,
|
|
255
|
-
setWidth: setWidth
|
|
256
|
-
}),
|
|
257
|
-
onToggleAspectRatioLock = _useImageControls.onToggleAspectRatioLock,
|
|
258
|
-
handleWidthChange = _useImageControls.handleWidthChange,
|
|
259
|
-
handleHeightChange = _useImageControls.handleHeightChange,
|
|
260
|
-
handleAspectWidthChange = _useImageControls.handleAspectWidthChange,
|
|
261
|
-
handleAspectHeightChange = _useImageControls.handleAspectHeightChange;
|
|
262
|
-
var debouncedHeight = useDebounce(height, 800);
|
|
263
|
-
var debouncedWidth = useDebounce(width, 800);
|
|
264
|
-
useEffect(function () {
|
|
265
|
-
handleHeightChange(debouncedHeight);
|
|
266
|
-
}, [debouncedHeight]);
|
|
267
|
-
useEffect(function () {
|
|
268
|
-
handleWidthChange(debouncedWidth);
|
|
269
|
-
}, [debouncedWidth]);
|
|
270
|
-
useEffect(function () {
|
|
271
|
-
setHeight(getActualCropHeight(crop.height));
|
|
272
|
-
setWidth(getActualCropWidth(crop.width));
|
|
273
|
-
}, [crop]);
|
|
484
|
+
hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls,
|
|
485
|
+
onToggleAspectRatioLock = _ref.onToggleAspectRatioLock,
|
|
486
|
+
handleWidthChange = _ref.handleWidthChange,
|
|
487
|
+
handleHeightChange = _ref.handleHeightChange,
|
|
488
|
+
handleAspectWidthChange = _ref.handleAspectWidthChange,
|
|
489
|
+
handleAspectHeightChange = _ref.handleAspectHeightChange,
|
|
490
|
+
width = _ref.width,
|
|
491
|
+
height = _ref.height;
|
|
274
492
|
return /*#__PURE__*/jsxs("div", {
|
|
275
493
|
className: "flex flex-col space-y-6 p-4 md:w-2/6",
|
|
276
494
|
children: [!hideControls && /*#__PURE__*/jsxs(Fragment, {
|
|
@@ -323,9 +541,10 @@ var Controls = function Controls(_ref) {
|
|
|
323
541
|
}), /*#__PURE__*/jsx(Input, {
|
|
324
542
|
className: "w-32 flex-grow-0",
|
|
325
543
|
disabled: isFullImage,
|
|
544
|
+
max: (_imageRef$current = imageRef.current) === null || _imageRef$current === void 0 ? void 0 : _imageRef$current.naturalWidth,
|
|
326
545
|
type: "number",
|
|
327
|
-
value:
|
|
328
|
-
onChange: withEventTargetValue(
|
|
546
|
+
value: width,
|
|
547
|
+
onChange: withEventTargetValue(handleWidthChange)
|
|
329
548
|
})]
|
|
330
549
|
}), /*#__PURE__*/jsxs("div", {
|
|
331
550
|
className: "flex w-full items-start gap-2",
|
|
@@ -335,9 +554,10 @@ var Controls = function Controls(_ref) {
|
|
|
335
554
|
}), /*#__PURE__*/jsx(Input, {
|
|
336
555
|
className: "w-32 flex-grow-0",
|
|
337
556
|
disabled: isFullImage,
|
|
557
|
+
max: (_imageRef$current2 = imageRef.current) === null || _imageRef$current2 === void 0 ? void 0 : _imageRef$current2.naturalHeight,
|
|
338
558
|
type: "number",
|
|
339
|
-
value:
|
|
340
|
-
onChange: withEventTargetValue(
|
|
559
|
+
value: height,
|
|
560
|
+
onChange: withEventTargetValue(handleHeightChange)
|
|
341
561
|
})]
|
|
342
562
|
}), /*#__PURE__*/jsx(Button, {
|
|
343
563
|
className: "mt-6 self-start",
|
|
@@ -347,9 +567,212 @@ var Controls = function Controls(_ref) {
|
|
|
347
567
|
onClick: handleSubmit
|
|
348
568
|
})]
|
|
349
569
|
});
|
|
570
|
+
});
|
|
571
|
+
|
|
572
|
+
var useImageControls = function useImageControls(_ref) {
|
|
573
|
+
var _imageRef$current;
|
|
574
|
+
var imageRef = _ref.imageRef,
|
|
575
|
+
fixedAspectRatio = _ref.fixedAspectRatio,
|
|
576
|
+
defaultImageSize = _ref.defaultImageSize;
|
|
577
|
+
var _ref2 = (_imageRef$current = imageRef.current) !== null && _imageRef$current !== void 0 ? _imageRef$current : {},
|
|
578
|
+
imageWidth = _ref2.naturalWidth,
|
|
579
|
+
imageHeight = _ref2.naturalHeight;
|
|
580
|
+
var _useState = useState(true),
|
|
581
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
582
|
+
isAspectRatioLocked = _useState2[0],
|
|
583
|
+
setIsAspectRatioLocked = _useState2[1];
|
|
584
|
+
var _useState3 = useState(DEFAULT_CROP_CONFIG),
|
|
585
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
586
|
+
crop = _useState4[0],
|
|
587
|
+
setCrop = _useState4[1];
|
|
588
|
+
var _useState5 = useState(getAspectRatio({
|
|
589
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
590
|
+
imageSize: defaultImageSize
|
|
591
|
+
})),
|
|
592
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
593
|
+
aspectRatio = _useState6[0],
|
|
594
|
+
setAspectRatio = _useState6[1];
|
|
595
|
+
var _useState7 = useState(getPixels(crop.height, imageHeight)),
|
|
596
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
597
|
+
height = _useState8[0],
|
|
598
|
+
setHeight = _useState8[1];
|
|
599
|
+
var _useState9 = useState(getPixels(crop.width, imageWidth)),
|
|
600
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
601
|
+
width = _useState10[0],
|
|
602
|
+
setWidth = _useState10[1];
|
|
603
|
+
var aspectRatioFactor = aspectRatio.width / aspectRatio.height;
|
|
604
|
+
var buildCropValues = function buildCropValues(_ref3) {
|
|
605
|
+
var cropWidth = _ref3.cropWidth,
|
|
606
|
+
cropHeight = _ref3.cropHeight,
|
|
607
|
+
_ref3$width = _ref3.width,
|
|
608
|
+
width = _ref3$width === void 0 ? imageWidth : _ref3$width,
|
|
609
|
+
_ref3$height = _ref3.height,
|
|
610
|
+
height = _ref3$height === void 0 ? imageHeight : _ref3$height,
|
|
611
|
+
_ref3$aspectRatio = _ref3.aspectRatio,
|
|
612
|
+
aspectRatio = _ref3$aspectRatio === void 0 ? aspectRatioFactor : _ref3$aspectRatio;
|
|
613
|
+
var aspectCrop = H({
|
|
614
|
+
unit: "%",
|
|
615
|
+
width: getPercentage(cropWidth, width),
|
|
616
|
+
height: getPercentage(cropHeight, height)
|
|
617
|
+
}, aspectRatio, width, height);
|
|
618
|
+
return N(aspectCrop, width, height);
|
|
619
|
+
};
|
|
620
|
+
var onToggleAspectRatioLock = function onToggleAspectRatioLock() {
|
|
621
|
+
setIsAspectRatioLocked(function (isAspectRatioLocked) {
|
|
622
|
+
return !isAspectRatioLocked;
|
|
623
|
+
});
|
|
624
|
+
};
|
|
625
|
+
var handleWidthChange = function handleWidthChange(width) {
|
|
626
|
+
var adjustedWidth = Math.min(width, imageWidth);
|
|
627
|
+
setWidth(adjustedWidth);
|
|
628
|
+
handleWidthResize(adjustedWidth);
|
|
629
|
+
};
|
|
630
|
+
var handleHeightChange = function handleHeightChange(height) {
|
|
631
|
+
var adjustedHeight = Math.min(height, imageHeight);
|
|
632
|
+
setHeight(adjustedHeight);
|
|
633
|
+
handleHeighthResize(height);
|
|
634
|
+
};
|
|
635
|
+
var handleResize = function handleResize(cropWidth, cropHeight) {
|
|
636
|
+
var aspectRatio = aspectRatioFactor;
|
|
637
|
+
if (!isAspectRatioLocked) {
|
|
638
|
+
var imageSize = {
|
|
639
|
+
width: cropWidth,
|
|
640
|
+
height: cropHeight
|
|
641
|
+
};
|
|
642
|
+
var newAspectRatio = getAspectRatio({
|
|
643
|
+
imageSize: imageSize
|
|
644
|
+
});
|
|
645
|
+
aspectRatio = newAspectRatio.width / newAspectRatio.height;
|
|
646
|
+
setAspectRatio(newAspectRatio);
|
|
647
|
+
}
|
|
648
|
+
var newCrop = buildCropValues({
|
|
649
|
+
cropWidth: cropWidth,
|
|
650
|
+
cropHeight: cropHeight,
|
|
651
|
+
aspectRatio: aspectRatio
|
|
652
|
+
});
|
|
653
|
+
setCrop(newCrop);
|
|
654
|
+
setWidth(cropWidth);
|
|
655
|
+
setHeight(cropHeight);
|
|
656
|
+
};
|
|
657
|
+
var handleWidthResize = useFuncDebounce(function (width) {
|
|
658
|
+
var cropWidth = Number(width);
|
|
659
|
+
var cropHeight = Number(height);
|
|
660
|
+
if (isAspectRatioLocked) {
|
|
661
|
+
cropHeight = getHeightFromAspectRatio(cropWidth, aspectRatio);
|
|
662
|
+
if (cropHeight > imageHeight) {
|
|
663
|
+
cropHeight = imageHeight;
|
|
664
|
+
cropWidth = getWidthFromAspectRatio(cropHeight, aspectRatio);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
handleResize(cropWidth, cropHeight);
|
|
668
|
+
}, 300);
|
|
669
|
+
var handleHeighthResize = useFuncDebounce(function (height) {
|
|
670
|
+
var cropWidth = Number(width);
|
|
671
|
+
var cropHeight = Number(height);
|
|
672
|
+
if (isAspectRatioLocked) {
|
|
673
|
+
cropWidth = getWidthFromAspectRatio(cropHeight, aspectRatio);
|
|
674
|
+
if (cropWidth > imageWidth) {
|
|
675
|
+
cropWidth = imageWidth;
|
|
676
|
+
cropHeight = getHeightFromAspectRatio(cropWidth, aspectRatio);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
handleResize(cropWidth, cropHeight);
|
|
680
|
+
}, 300);
|
|
681
|
+
var handleAspectWidthChange = function handleAspectWidthChange(aspectWidth) {
|
|
682
|
+
if (aspectWidth <= 0) return;
|
|
683
|
+
var newWidth = crop.width * (aspectWidth / aspectRatio.width);
|
|
684
|
+
var updatedAspectWidth = aspectWidth;
|
|
685
|
+
if (newWidth > 100) {
|
|
686
|
+
newWidth = 100;
|
|
687
|
+
updatedAspectWidth = Math.round(newWidth / crop.width * aspectRatio.width);
|
|
688
|
+
}
|
|
689
|
+
var newWidthInPixels = getPixels(newWidth, imageWidth);
|
|
690
|
+
var newCrop = buildCropValues({
|
|
691
|
+
cropWidth: newWidthInPixels,
|
|
692
|
+
cropHeight: height,
|
|
693
|
+
aspectRatio: updatedAspectWidth / aspectRatio.height
|
|
694
|
+
});
|
|
695
|
+
setCrop(newCrop);
|
|
696
|
+
setAspectRatio(mergeRight(aspectRatio, {
|
|
697
|
+
width: updatedAspectWidth
|
|
698
|
+
}));
|
|
699
|
+
setWidth(newWidthInPixels);
|
|
700
|
+
};
|
|
701
|
+
var handleAspectHeightChange = function handleAspectHeightChange(aspectHeight) {
|
|
702
|
+
if (aspectHeight <= 0) return;
|
|
703
|
+
var newHeight = crop.height * (aspectHeight / aspectRatio.height);
|
|
704
|
+
var updatedAspectHeight = aspectHeight;
|
|
705
|
+
if (newHeight > 100) {
|
|
706
|
+
newHeight = 100;
|
|
707
|
+
updatedAspectHeight = Math.round(newHeight / crop.height * aspectRatio.height);
|
|
708
|
+
}
|
|
709
|
+
var newHeightInPixels = getPixels(newHeight, imageHeight);
|
|
710
|
+
var newCrop = buildCropValues({
|
|
711
|
+
cropWidth: width,
|
|
712
|
+
cropHeight: newHeightInPixels,
|
|
713
|
+
aspectRatio: aspectRatio.width / updatedAspectHeight
|
|
714
|
+
});
|
|
715
|
+
setCrop(newCrop);
|
|
716
|
+
setAspectRatio(mergeRight(aspectRatio, {
|
|
717
|
+
height: updatedAspectHeight
|
|
718
|
+
}));
|
|
719
|
+
setHeight(newHeightInPixels);
|
|
720
|
+
};
|
|
721
|
+
var handleCropChange = function handleCropChange(pixelCrop, percentageCrop) {
|
|
722
|
+
if (!isAspectRatioLocked) {
|
|
723
|
+
var _aspectRatio = getAspectRatio({
|
|
724
|
+
imageSize: {
|
|
725
|
+
width: Math.round(pixelCrop.width),
|
|
726
|
+
height: Math.round(pixelCrop.height)
|
|
727
|
+
}
|
|
728
|
+
});
|
|
729
|
+
setAspectRatio(_aspectRatio);
|
|
730
|
+
}
|
|
731
|
+
setHeight(getPixels(percentageCrop.height, imageHeight));
|
|
732
|
+
setWidth(getPixels(percentageCrop.width, imageWidth));
|
|
733
|
+
setCrop(percentageCrop);
|
|
734
|
+
};
|
|
735
|
+
var handleImageLoad = function handleImageLoad(_ref4) {
|
|
736
|
+
var _defaultImageSize$wid;
|
|
737
|
+
var image = _ref4.target;
|
|
738
|
+
var imageWidth = image.naturalWidth,
|
|
739
|
+
imageHeight = image.naturalHeight;
|
|
740
|
+
var maxCropWidth = (_defaultImageSize$wid = defaultImageSize.width) !== null && _defaultImageSize$wid !== void 0 ? _defaultImageSize$wid : imageWidth;
|
|
741
|
+
var _getInitialCropSize = getInitialCropSize({
|
|
742
|
+
image: image,
|
|
743
|
+
aspectRatioFactor: aspectRatioFactor,
|
|
744
|
+
maxCropWidth: maxCropWidth
|
|
745
|
+
}),
|
|
746
|
+
cropWidth = _getInitialCropSize.cropWidth,
|
|
747
|
+
cropHeight = _getInitialCropSize.cropHeight;
|
|
748
|
+
var crop = buildCropValues({
|
|
749
|
+
cropWidth: cropWidth,
|
|
750
|
+
cropHeight: cropHeight,
|
|
751
|
+
width: imageWidth,
|
|
752
|
+
height: imageHeight
|
|
753
|
+
});
|
|
754
|
+
setCrop(crop);
|
|
755
|
+
setHeight(getPixels(crop.height, imageHeight));
|
|
756
|
+
setWidth(getPixels(crop.width, imageWidth));
|
|
757
|
+
};
|
|
758
|
+
return {
|
|
759
|
+
onToggleAspectRatioLock: onToggleAspectRatioLock,
|
|
760
|
+
handleWidthChange: handleWidthChange,
|
|
761
|
+
handleHeightChange: handleHeightChange,
|
|
762
|
+
handleAspectWidthChange: handleAspectWidthChange,
|
|
763
|
+
handleAspectHeightChange: handleAspectHeightChange,
|
|
764
|
+
aspectRatio: aspectRatio,
|
|
765
|
+
width: width,
|
|
766
|
+
crop: crop,
|
|
767
|
+
height: height,
|
|
768
|
+
handleImageLoad: handleImageLoad,
|
|
769
|
+
handleCropChange: handleCropChange,
|
|
770
|
+
isAspectRatioLocked: isAspectRatioLocked
|
|
771
|
+
};
|
|
350
772
|
};
|
|
351
773
|
|
|
352
774
|
var ImageEditor = function ImageEditor(_ref) {
|
|
775
|
+
var _imageRef$current;
|
|
353
776
|
var image = _ref.image,
|
|
354
777
|
handleReset = _ref.handleReset,
|
|
355
778
|
_ref$handleImageEditC = _ref.handleImageEditComplete,
|
|
@@ -357,33 +780,39 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
357
780
|
_ref$signedId = _ref.signedId,
|
|
358
781
|
signedId = _ref$signedId === void 0 ? "" : _ref$signedId,
|
|
359
782
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
360
|
-
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio
|
|
361
|
-
|
|
783
|
+
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio,
|
|
784
|
+
_ref$defaultImageSize = _ref.defaultImageSize,
|
|
785
|
+
defaultImageSize = _ref$defaultImageSize === void 0 ? {} : _ref$defaultImageSize;
|
|
786
|
+
var imageRef = useRef(null);
|
|
787
|
+
var wrapperRef = useRef(null);
|
|
788
|
+
var _ref2 = (_imageRef$current = imageRef.current) !== null && _imageRef$current !== void 0 ? _imageRef$current : {},
|
|
789
|
+
imageWidth = _ref2.naturalWidth,
|
|
790
|
+
imageHeight = _ref2.naturalHeight;
|
|
791
|
+
var _useState = useState(false),
|
|
362
792
|
_useState2 = _slicedToArray(_useState, 2),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
var _useState3 = useState(false),
|
|
366
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
367
|
-
isFullImage = _useState4[0],
|
|
368
|
-
setIsFullImage = _useState4[1];
|
|
369
|
-
var _useState5 = useState({
|
|
370
|
-
width: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) || 16,
|
|
371
|
-
height: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height) || 9
|
|
372
|
-
}),
|
|
373
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
374
|
-
aspectRatio = _useState6[0],
|
|
375
|
-
setAspectRatio = _useState6[1];
|
|
376
|
-
var _useState7 = useState(DEFAULT_CROP_CONFIG),
|
|
377
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
378
|
-
crop = _useState8[0],
|
|
379
|
-
setCrop = _useState8[1];
|
|
793
|
+
isFullImage = _useState2[0],
|
|
794
|
+
setIsFullImage = _useState2[1];
|
|
380
795
|
var _useTranslation = useTranslation(),
|
|
381
796
|
t = _useTranslation.t;
|
|
382
797
|
var _useCropImage = useCropImage(),
|
|
383
798
|
cropImage = _useCropImage.mutate;
|
|
384
|
-
var
|
|
385
|
-
|
|
386
|
-
|
|
799
|
+
var _useImageControls = useImageControls({
|
|
800
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
801
|
+
defaultImageSize: defaultImageSize,
|
|
802
|
+
imageRef: imageRef
|
|
803
|
+
}),
|
|
804
|
+
onToggleAspectRatioLock = _useImageControls.onToggleAspectRatioLock,
|
|
805
|
+
handleWidthChange = _useImageControls.handleWidthChange,
|
|
806
|
+
handleHeightChange = _useImageControls.handleHeightChange,
|
|
807
|
+
handleAspectWidthChange = _useImageControls.handleAspectWidthChange,
|
|
808
|
+
handleAspectHeightChange = _useImageControls.handleAspectHeightChange,
|
|
809
|
+
aspectRatio = _useImageControls.aspectRatio,
|
|
810
|
+
width = _useImageControls.width,
|
|
811
|
+
height = _useImageControls.height,
|
|
812
|
+
handleImageLoad = _useImageControls.handleImageLoad,
|
|
813
|
+
handleCropChange = _useImageControls.handleCropChange,
|
|
814
|
+
crop = _useImageControls.crop,
|
|
815
|
+
isAspectRatioLocked = _useImageControls.isAspectRatioLocked;
|
|
387
816
|
var processCrop = function processCrop() {
|
|
388
817
|
if (isFullImage) {
|
|
389
818
|
handleImageEditComplete(image);
|
|
@@ -409,7 +838,6 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
409
838
|
return;
|
|
410
839
|
}
|
|
411
840
|
var newURL = globalProps.assetsUploaderService === CLOUD_FLARE ? getCloudFlareCroppedURL({
|
|
412
|
-
imageRef: imageRef,
|
|
413
841
|
image: image,
|
|
414
842
|
crop: crop
|
|
415
843
|
}) : getImageKitCroppedURL({
|
|
@@ -435,44 +863,46 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
435
863
|
children: [/*#__PURE__*/jsx("div", {
|
|
436
864
|
id: "imageEditor",
|
|
437
865
|
ref: wrapperRef,
|
|
438
|
-
className: classnames("flex", "h-full w-full md:w-4/6", "justify-around", "neeto-ui-bg-gray-200", {
|
|
866
|
+
className: classnames("flex", "h-full w-full md:w-4/6", "justify-around", "neeto-ui-bg-gray-200", "relative", {
|
|
439
867
|
"items-center": isItemsCenter({
|
|
440
868
|
wrapperRef: wrapperRef,
|
|
441
869
|
imageRef: imageRef
|
|
442
870
|
})
|
|
443
871
|
}),
|
|
444
|
-
children: /*#__PURE__*/
|
|
872
|
+
children: /*#__PURE__*/jsxs(I, {
|
|
445
873
|
crop: isFullImage ? null : crop,
|
|
446
874
|
src: image === null || image === void 0 ? void 0 : image.url,
|
|
447
875
|
aspect: isAspectRatioLocked ? aspectRatio.width / aspectRatio.height : 0,
|
|
448
|
-
onChange:
|
|
449
|
-
onComplete:
|
|
450
|
-
children: /*#__PURE__*/jsx("img", {
|
|
876
|
+
onChange: handleCropChange,
|
|
877
|
+
onComplete: handleCropChange,
|
|
878
|
+
children: [/*#__PURE__*/jsx("img", {
|
|
451
879
|
alt: t("neetoImageUploader.common.image"),
|
|
452
880
|
"data-cy": "image-editor-uploaded-image",
|
|
453
881
|
ref: imageRef,
|
|
454
882
|
src: image === null || image === void 0 ? void 0 : image.url,
|
|
455
|
-
onLoad:
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
})
|
|
883
|
+
onLoad: handleImageLoad
|
|
884
|
+
}), /*#__PURE__*/jsxs(Typography, {
|
|
885
|
+
className: "neeto-ui-typography neeto-ui-text-nano neeto-ui-bg-gray-500 absolute bottom-0 right-0 z-10",
|
|
886
|
+
style: "nano",
|
|
887
|
+
children: [imageWidth, "x", imageHeight]
|
|
888
|
+
})]
|
|
463
889
|
})
|
|
464
890
|
}), /*#__PURE__*/jsx(Controls, {
|
|
465
891
|
aspectRatio: aspectRatio,
|
|
466
892
|
crop: crop,
|
|
893
|
+
handleAspectHeightChange: handleAspectHeightChange,
|
|
894
|
+
handleAspectWidthChange: handleAspectWidthChange,
|
|
895
|
+
handleHeightChange: handleHeightChange,
|
|
467
896
|
handleSubmit: handleSubmit,
|
|
897
|
+
handleWidthChange: handleWidthChange,
|
|
898
|
+
height: height,
|
|
468
899
|
imageRef: imageRef,
|
|
469
900
|
isAspectRatioLocked: isAspectRatioLocked,
|
|
470
901
|
isFullImage: isFullImage,
|
|
471
|
-
|
|
472
|
-
setCrop: setCrop,
|
|
902
|
+
onToggleAspectRatioLock: onToggleAspectRatioLock,
|
|
473
903
|
setIsFullImage: setIsFullImage,
|
|
474
|
-
|
|
475
|
-
|
|
904
|
+
width: width,
|
|
905
|
+
hideControls: isPresent(fixedAspectRatio)
|
|
476
906
|
})]
|
|
477
907
|
})]
|
|
478
908
|
});
|
|
@@ -503,14 +933,14 @@ var imagesApi = {
|
|
|
503
933
|
bulkDestroy: bulkDestroy
|
|
504
934
|
};
|
|
505
935
|
|
|
506
|
-
function ownKeys$
|
|
507
|
-
function _objectSpread$
|
|
936
|
+
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; }
|
|
937
|
+
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; }
|
|
508
938
|
var useFetchAssets = function useFetchAssets(_ref) {
|
|
509
939
|
var searchTerm = _ref.searchTerm,
|
|
510
940
|
url = _ref.url,
|
|
511
941
|
per = _ref.per;
|
|
512
942
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
513
|
-
return useInfiniteQuery(_objectSpread$
|
|
943
|
+
return useInfiniteQuery(_objectSpread$2({
|
|
514
944
|
queryKey: [QUERY_KEYS.ASSETS_LIST, searchTerm],
|
|
515
945
|
queryFn: function queryFn(_ref2) {
|
|
516
946
|
var _ref2$pageParam = _ref2.pageParam,
|
|
@@ -558,6 +988,31 @@ var useBulkDestroyAssets = function useBulkDestroyAssets(url) {
|
|
|
558
988
|
});
|
|
559
989
|
};
|
|
560
990
|
|
|
991
|
+
function getAugmentedNamespace(n) {
|
|
992
|
+
if (n.__esModule) return n;
|
|
993
|
+
var f = n.default;
|
|
994
|
+
if (typeof f == "function") {
|
|
995
|
+
var a = function a () {
|
|
996
|
+
if (this instanceof a) {
|
|
997
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
998
|
+
}
|
|
999
|
+
return f.apply(this, arguments);
|
|
1000
|
+
};
|
|
1001
|
+
a.prototype = f.prototype;
|
|
1002
|
+
} else a = {};
|
|
1003
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
1004
|
+
Object.keys(n).forEach(function (k) {
|
|
1005
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
1006
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
1007
|
+
enumerable: true,
|
|
1008
|
+
get: function () {
|
|
1009
|
+
return n[k];
|
|
1010
|
+
}
|
|
1011
|
+
});
|
|
1012
|
+
});
|
|
1013
|
+
return a;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
561
1016
|
var lib = {};
|
|
562
1017
|
|
|
563
1018
|
var propTypes = {exports: {}};
|
|
@@ -942,7 +1397,7 @@ var InfiniteScroll = {exports: {}};
|
|
|
942
1397
|
|
|
943
1398
|
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; }; }();
|
|
944
1399
|
|
|
945
|
-
var _react =
|
|
1400
|
+
var _react = g;
|
|
946
1401
|
|
|
947
1402
|
var _react2 = _interopRequireDefault(_react);
|
|
948
1403
|
|
|
@@ -1247,7 +1702,7 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
1247
1702
|
|
|
1248
1703
|
var _class, _temp2;
|
|
1249
1704
|
|
|
1250
|
-
var _react =
|
|
1705
|
+
var _react = g;
|
|
1251
1706
|
|
|
1252
1707
|
var _react2 = _interopRequireDefault(_react);
|
|
1253
1708
|
|
|
@@ -1475,16 +1930,16 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1475
1930
|
children: [tab === TABS[2].key && /*#__PURE__*/jsxs(Fragment, {
|
|
1476
1931
|
children: [/*#__PURE__*/jsx("img", {
|
|
1477
1932
|
"data-cy": "niu-unsplash-image-".concat(index),
|
|
1478
|
-
src: image === null || image === void 0
|
|
1933
|
+
src: image === null || image === void 0 || (_image$urls = image.urls) === null || _image$urls === void 0 ? void 0 : _image$urls.regular,
|
|
1479
1934
|
onClick: function onClick() {
|
|
1480
1935
|
return handleUnsplashImageSelect(image);
|
|
1481
1936
|
}
|
|
1482
1937
|
}), /*#__PURE__*/jsxs("a", {
|
|
1483
1938
|
className: "neeto-ui-text-gray-100 absolute bottom-2 left-2 m-auto text-xs underline opacity-0 group-hover:opacity-100",
|
|
1484
|
-
href: "https://unsplash.com/@".concat(image === null || image === void 0
|
|
1939
|
+
href: "https://unsplash.com/@".concat(image === null || image === void 0 || (_image$user = image.user) === null || _image$user === void 0 ? void 0 : _image$user.username),
|
|
1485
1940
|
rel: "noreferrer",
|
|
1486
1941
|
target: "_blank",
|
|
1487
|
-
children: [image === null || image === void 0
|
|
1942
|
+
children: [image === null || image === void 0 || (_image$user2 = image.user) === null || _image$user2 === void 0 ? void 0 : _image$user2.name, " | ", " ", t("neetoImageUploader.labels.unsplash")]
|
|
1488
1943
|
})]
|
|
1489
1944
|
}), tab === TABS[1].key && /*#__PURE__*/jsxs(Fragment, {
|
|
1490
1945
|
children: [hasPermission(VIEW_ROLES_PERMISSION) && isMenuButtonEnabled && /*#__PURE__*/jsx(Dropdown, {
|
|
@@ -1600,13 +2055,13 @@ var unsplashApi = {
|
|
|
1600
2055
|
getUnsplashImage: getUnsplashImage
|
|
1601
2056
|
};
|
|
1602
2057
|
|
|
1603
|
-
function ownKeys$
|
|
1604
|
-
function _objectSpread$
|
|
2058
|
+
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; }
|
|
2059
|
+
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; }
|
|
1605
2060
|
var UNSPLASH_LIST = QUERY_KEYS.UNSPLASH_LIST;
|
|
1606
2061
|
var useFetchUnsplashImages = function useFetchUnsplashImages(_ref) {
|
|
1607
2062
|
var query = _ref.query;
|
|
1608
2063
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1609
|
-
return useInfiniteQuery(_objectSpread$
|
|
2064
|
+
return useInfiniteQuery(_objectSpread$1({
|
|
1610
2065
|
queryKey: [UNSPLASH_LIST, {
|
|
1611
2066
|
query: query
|
|
1612
2067
|
}],
|
|
@@ -1633,35 +2088,13 @@ var useFetchUnsplashImages = function useFetchUnsplashImages(_ref) {
|
|
|
1633
2088
|
}, options));
|
|
1634
2089
|
};
|
|
1635
2090
|
|
|
1636
|
-
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; }
|
|
1637
|
-
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; }
|
|
1638
2091
|
var UnsplashLibrary = function UnsplashLibrary(_ref) {
|
|
1639
2092
|
var debouncedQuery = _ref.debouncedQuery,
|
|
1640
2093
|
setSelectedImage = _ref.setSelectedImage,
|
|
1641
2094
|
setIsUploading = _ref.setIsUploading,
|
|
1642
2095
|
setActiveTab = _ref.setActiveTab;
|
|
1643
|
-
var _useCreateBlob = useCreateBlob(),
|
|
1644
|
-
createBlob = _useCreateBlob.mutate;
|
|
1645
|
-
var handleBlobCreation = function handleBlobCreation(image) {
|
|
1646
|
-
var payload = {
|
|
1647
|
-
filename: generateASCIIFileName(image.filename),
|
|
1648
|
-
content_type: image.contentType,
|
|
1649
|
-
byte_size: image.byteSize,
|
|
1650
|
-
checksum: image.checksum,
|
|
1651
|
-
metadata: _objectSpread$1(_objectSpread$1({}, image.metadata), {}, {
|
|
1652
|
-
url: constructCloudflareImageURL(image.url),
|
|
1653
|
-
isCropped: false
|
|
1654
|
-
}),
|
|
1655
|
-
service_name: "cloudflare_image"
|
|
1656
|
-
};
|
|
1657
|
-
createBlob(payload);
|
|
1658
|
-
};
|
|
1659
|
-
var handleUploadComplete = function handleUploadComplete(image) {
|
|
1660
|
-
globalProps.assetsUploaderService === CLOUD_FLARE && handleBlobCreation(image);
|
|
1661
|
-
setSelectedImage(image);
|
|
1662
|
-
};
|
|
1663
2096
|
var _useImageUploader = useImageUploader({
|
|
1664
|
-
onUploadComplete:
|
|
2097
|
+
onUploadComplete: setSelectedImage,
|
|
1665
2098
|
setIsUploading: setIsUploading
|
|
1666
2099
|
}),
|
|
1667
2100
|
uploadFile = _useImageUploader.uploadFile;
|
|
@@ -1790,7 +2223,9 @@ var Modal = function Modal(_ref) {
|
|
|
1790
2223
|
_ref$uploadConfig = _ref.uploadConfig,
|
|
1791
2224
|
uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig,
|
|
1792
2225
|
_ref$fixedAspectRatio = _ref.fixedAspectRatio,
|
|
1793
|
-
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio
|
|
2226
|
+
fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio,
|
|
2227
|
+
_ref$defaultImageSize = _ref.defaultImageSize,
|
|
2228
|
+
defaultImageSize = _ref$defaultImageSize === void 0 ? {} : _ref$defaultImageSize;
|
|
1794
2229
|
var _useState = useState(TABS[0].key),
|
|
1795
2230
|
_useState2 = _slicedToArray(_useState, 2),
|
|
1796
2231
|
activeTab = _useState2[0],
|
|
@@ -1886,7 +2321,6 @@ var Modal = function Modal(_ref) {
|
|
|
1886
2321
|
children: /*#__PURE__*/jsx("div", {
|
|
1887
2322
|
className: "h-full w-full overflow-y-auto",
|
|
1888
2323
|
children: /*#__PURE__*/jsx(ImageDirectUpload, {
|
|
1889
|
-
isDisabled: isPresent(fixedAspectRatio),
|
|
1890
2324
|
uploadConfig: uploadConfigWithDefaults,
|
|
1891
2325
|
onDrop: uploadFile
|
|
1892
2326
|
})
|
|
@@ -1915,6 +2349,7 @@ var Modal = function Modal(_ref) {
|
|
|
1915
2349
|
children: t("neetoImageUploader.common.dropHere")
|
|
1916
2350
|
})
|
|
1917
2351
|
})), !isNilOrEmpty(selectedImage) ? /*#__PURE__*/jsx(ImageEditor, {
|
|
2352
|
+
defaultImageSize: defaultImageSize,
|
|
1918
2353
|
fixedAspectRatio: fixedAspectRatio,
|
|
1919
2354
|
handleImageEditComplete: handleImageEditComplete,
|
|
1920
2355
|
handleReset: function handleReset() {
|
|
@@ -1970,4 +2405,4 @@ var Modal = function Modal(_ref) {
|
|
|
1970
2405
|
};
|
|
1971
2406
|
|
|
1972
2407
|
export { Modal as M, constructCloudflareImageURL as c };
|
|
1973
|
-
//# sourceMappingURL=index-
|
|
2408
|
+
//# sourceMappingURL=index-2Z-tiNdY.js.map
|