@bigbinary/neeto-image-uploader-frontend 4.0.3 → 4.0.5

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.
Files changed (101) hide show
  1. package/dist/.ready +1 -1
  2. package/dist/AssetLibrary.js +12 -9
  3. package/dist/AssetLibrary.js.map +1 -1
  4. package/dist/BasicImageUploader.js +4 -2
  5. package/dist/BasicImageUploader.js.map +1 -1
  6. package/dist/ImageForm.js +7 -4
  7. package/dist/ImageForm.js.map +1 -1
  8. package/dist/ImageUploader.js +9 -6
  9. package/dist/ImageUploader.js.map +1 -1
  10. package/dist/ImageWithFallback-BhUgmP7t.js +61 -0
  11. package/dist/ImageWithFallback-BhUgmP7t.js.map +1 -0
  12. package/dist/{ImageWithFallback-Bq5rs1yf.js → ImageWithFallback-D1ClfJLn.js} +4 -4
  13. package/dist/{ImageWithFallback-Bq5rs1yf.js.map → ImageWithFallback-D1ClfJLn.js.map} +1 -1
  14. package/dist/ImageWithFallback-MfA03icL.js +59 -0
  15. package/dist/ImageWithFallback-MfA03icL.js.map +1 -0
  16. package/dist/cjs/AssetLibrary.js +10 -7
  17. package/dist/cjs/AssetLibrary.js.map +1 -1
  18. package/dist/cjs/BasicImageUploader.js +5 -3
  19. package/dist/cjs/BasicImageUploader.js.map +1 -1
  20. package/dist/cjs/ImageForm.js +9 -6
  21. package/dist/cjs/ImageForm.js.map +1 -1
  22. package/dist/cjs/ImageUploader.js +14 -11
  23. package/dist/cjs/ImageUploader.js.map +1 -1
  24. package/dist/cjs/hooks.js +1 -1
  25. package/dist/cjs/index.js +9 -6
  26. package/dist/cjs/index.js.map +1 -1
  27. package/dist/cjs/v2/AssetLibrary.js +40 -0
  28. package/dist/cjs/v2/AssetLibrary.js.map +1 -0
  29. package/dist/cjs/v2/BasicImageUploader.js +71 -0
  30. package/dist/cjs/v2/BasicImageUploader.js.map +1 -0
  31. package/dist/cjs/v2/ImageForm.js +324 -0
  32. package/dist/cjs/v2/ImageForm.js.map +1 -0
  33. package/dist/cjs/v2/ImageUploader.js +246 -0
  34. package/dist/cjs/v2/ImageUploader.js.map +1 -0
  35. package/dist/cjs/v2/hooks.js +27 -0
  36. package/dist/cjs/v2/hooks.js.map +1 -0
  37. package/dist/cjs/v2/index.js +61 -0
  38. package/dist/cjs/v2/index.js.map +1 -0
  39. package/dist/cjs/v2/utils.js +9 -0
  40. package/dist/cjs/v2/utils.js.map +1 -0
  41. package/dist/constants-Csle2bxb.js +56 -0
  42. package/dist/constants-Csle2bxb.js.map +1 -0
  43. package/dist/constants-DI8wBtC-.js +68 -0
  44. package/dist/constants-DI8wBtC-.js.map +1 -0
  45. package/dist/hooks.js +3 -3
  46. package/dist/{imagekit.esm-CXW6c1fP.js → imagekit.esm-IYQEzBnD.js} +2 -2
  47. package/dist/{imagekit.esm-CXW6c1fP.js.map → imagekit.esm-IYQEzBnD.js.map} +1 -1
  48. package/dist/index-CBorETxd.js +972 -0
  49. package/dist/index-CBorETxd.js.map +1 -0
  50. package/dist/index-CiB5LGGR.js +950 -0
  51. package/dist/index-CiB5LGGR.js.map +1 -0
  52. package/dist/index-EgJf9LfL.js +947 -0
  53. package/dist/index-EgJf9LfL.js.map +1 -0
  54. package/dist/index-krkZ4CNS.js +969 -0
  55. package/dist/index-krkZ4CNS.js.map +1 -0
  56. package/dist/index.js +10 -7
  57. package/dist/index.js.map +1 -1
  58. package/dist/{useImageUploader-BLOdyAwv.js → useImageUploader-D8luC4Qw.js} +2 -2
  59. package/dist/{useImageUploader-BLOdyAwv.js.map → useImageUploader-D8luC4Qw.js.map} +1 -1
  60. package/dist/{useProfileImageUpload-CiGxDpEx.js → useProfileImageUpload-CbjVfcfI.js} +3 -3
  61. package/dist/{useProfileImageUpload-CiGxDpEx.js.map → useProfileImageUpload-CbjVfcfI.js.map} +1 -1
  62. package/dist/{useProfileImageUpload-DkmUBjtt.js → useProfileImageUpload-DbanXK57.js} +6 -6
  63. package/dist/useProfileImageUpload-DbanXK57.js.map +1 -0
  64. package/dist/useUnsplashApi-CNeNh58q.js +1065 -0
  65. package/dist/useUnsplashApi-CNeNh58q.js.map +1 -0
  66. package/dist/useUnsplashApi-D_ekWD8p.js +1057 -0
  67. package/dist/useUnsplashApi-D_ekWD8p.js.map +1 -0
  68. package/dist/useUploadDropzone-8Xa8PI-1.js +56 -0
  69. package/dist/useUploadDropzone-8Xa8PI-1.js.map +1 -0
  70. package/dist/useUploadDropzone-DMv8VMRF.js +58 -0
  71. package/dist/useUploadDropzone-DMv8VMRF.js.map +1 -0
  72. package/dist/utils-BTmA9hHb.js +364 -0
  73. package/dist/utils-BTmA9hHb.js.map +1 -0
  74. package/dist/{utils-BYMSmzRM.js → utils-CbaXwRPJ.js} +33 -74
  75. package/dist/utils-CbaXwRPJ.js.map +1 -0
  76. package/dist/{utils-C0TymZ5r.js → utils-DwOJkJSn.js} +41 -83
  77. package/dist/utils-DwOJkJSn.js.map +1 -0
  78. package/dist/utils-DyCNC3w5.js +347 -0
  79. package/dist/utils-DyCNC3w5.js.map +1 -0
  80. package/dist/v2/AssetLibrary.js +34 -0
  81. package/dist/v2/AssetLibrary.js.map +1 -0
  82. package/dist/v2/BasicImageUploader.js +69 -0
  83. package/dist/v2/BasicImageUploader.js.map +1 -0
  84. package/dist/v2/ImageForm.js +322 -0
  85. package/dist/v2/ImageForm.js.map +1 -0
  86. package/dist/v2/ImageUploader.js +244 -0
  87. package/dist/v2/ImageUploader.js.map +1 -0
  88. package/dist/v2/hooks.js +19 -0
  89. package/dist/v2/hooks.js.map +1 -0
  90. package/dist/v2/index.js +48 -0
  91. package/dist/v2/index.js.map +1 -0
  92. package/dist/v2/utils.js +3 -0
  93. package/dist/v2/utils.js.map +1 -0
  94. package/package.json +49 -37
  95. package/dist/index-BuYEdyOT.js +0 -2413
  96. package/dist/index-BuYEdyOT.js.map +0 -1
  97. package/dist/index-Dpyvz0h1.js +0 -2410
  98. package/dist/index-Dpyvz0h1.js.map +0 -1
  99. package/dist/useProfileImageUpload-DkmUBjtt.js.map +0 -1
  100. package/dist/utils-BYMSmzRM.js.map +0 -1
  101. package/dist/utils-C0TymZ5r.js.map +0 -1
@@ -0,0 +1,364 @@
1
+ 'use strict';
2
+
3
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var require$$0 = require('react');
5
+ var classnames = require('classnames');
6
+ var neetoCist = require('@bigbinary/neeto-cist');
7
+ var Button = require('@bigbinary/neetoui/Button');
8
+ var Typography = require('@bigbinary/neetoui/Typography');
9
+ var ProgressBar = require('@bigbinary/neetoui/ProgressBar');
10
+ var ramda = require('ramda');
11
+ var reactI18next = require('react-i18next');
12
+ var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
13
+ var useUploadDropzone = require('./useUploadDropzone-DMv8VMRF.js');
14
+ var imagekit_esm = require('./imagekit.esm-CisvUNYU.js');
15
+ var jsxRuntime = require('react/jsx-runtime');
16
+
17
+ var DEFAULT_ALLOWED_IMAGE_TYPES = {
18
+ "image/png": [".png"],
19
+ "image/jpg": [".jpg", ".jpeg"],
20
+ "image/gif": [".gif"],
21
+ "image/svg+xml": [".svg"]
22
+ };
23
+ var DEFAULT_UPLOAD_CONFIG = {
24
+ maxImageSize: initializers.globalProps.endUserUploadedFileSizeLimitInMb,
25
+ allowedImageTypes: DEFAULT_ALLOWED_IMAGE_TYPES
26
+ };
27
+ var OPTION_KEYS = {
28
+ asset: "asset",
29
+ remove: "remove"
30
+ };
31
+
32
+ var getAllowedTypes = function getAllowedTypes(uploadConfig) {
33
+ return ramda.pipe(ramda.values, ramda.flatten, ramda.map(function (extension) {
34
+ return extension.slice(1);
35
+ }), ramda.map(ramda.toUpper), ramda.join(", "))(uploadConfig.allowedImageTypes);
36
+ };
37
+
38
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
39
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
40
+ var ImageDirectUpload = /*#__PURE__*/require$$0.forwardRef(function (_ref, ref) {
41
+ var _ref$uploadConfig = _ref.uploadConfig,
42
+ uploadConfig = _ref$uploadConfig === void 0 ? DEFAULT_UPLOAD_CONFIG : _ref$uploadConfig,
43
+ _ref$onDrop = _ref.onDrop,
44
+ onDrop = _ref$onDrop === void 0 ? neetoCist.noop : _ref$onDrop,
45
+ _ref$isDisabled = _ref.isDisabled,
46
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
47
+ setIsAssetLibraryOpen = _ref.setIsAssetLibraryOpen,
48
+ _ref$defaultImageSize = _ref.defaultImageSize,
49
+ defaultImageSize = _ref$defaultImageSize === void 0 ? {} : _ref$defaultImageSize,
50
+ _ref$isUploadDisabled = _ref.isUploadDisabled,
51
+ isUploadDisabled = _ref$isUploadDisabled === void 0 ? false : _ref$isUploadDisabled,
52
+ setImage = _ref.setImage;
53
+ var _useUploadDropzone = useUploadDropzone.useUploadDropzone({
54
+ uploadConfig: uploadConfig,
55
+ onDrop: onDrop,
56
+ setImage: setImage
57
+ }),
58
+ getRootProps = _useUploadDropzone.getRootProps,
59
+ getInputProps = _useUploadDropzone.getInputProps,
60
+ isDragActive = _useUploadDropzone.isDragActive,
61
+ open = _useUploadDropzone.open,
62
+ uploadProgress = _useUploadDropzone.uploadProgress,
63
+ setUploadProgress = _useUploadDropzone.setUploadProgress;
64
+ require$$0.useImperativeHandle(ref, function () {
65
+ return {
66
+ upload: function upload(file) {
67
+ return onDrop(file, setUploadProgress, setImage);
68
+ }
69
+ };
70
+ });
71
+ var shouldShowProgress = !!(uploadProgress && !ramda.equals(uploadProgress, 1));
72
+ return /*#__PURE__*/jsxRuntime.jsx("div", _objectSpread(_objectSpread({}, getRootProps()), {}, {
73
+ className: classnames(imagekit_esm.DROPZONE_ROOT_DIV_CLASSNAME, {
74
+ "neeto-ui-border-gray-300": !isDragActive,
75
+ "neeto-ui-border-gray-700": isDragActive
76
+ }),
77
+ children: shouldShowProgress ? /*#__PURE__*/jsxRuntime.jsx(ProgressBar, {
78
+ progressPercentage: uploadProgress,
79
+ progressValue: "".concat(uploadProgress, "%")
80
+ }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
81
+ className: "flex flex-col space-y-1",
82
+ children: [!isDisabled && /*#__PURE__*/jsxRuntime.jsx(Typography, {
83
+ className: "neeto-ui-text-gray-800 text-center leading-4",
84
+ style: "body2",
85
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
86
+ i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
87
+ components: {
88
+ span: /*#__PURE__*/jsxRuntime.jsx(Button, {
89
+ "data-testid": "neeto-image-uploader-browse-text",
90
+ style: "link",
91
+ onClick: function onClick(event) {
92
+ event.stopPropagation();
93
+ open();
94
+ }
95
+ })
96
+ }
97
+ })
98
+ }), setIsAssetLibraryOpen && /*#__PURE__*/jsxRuntime.jsx(Typography, {
99
+ style: "body2",
100
+ className: classnames("text-center leading-4", {
101
+ "pointer-events-none": isUploadDisabled
102
+ }),
103
+ onClick: function onClick(e) {
104
+ e.stopPropagation();
105
+ setIsAssetLibraryOpen(true);
106
+ },
107
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
108
+ i18nKey: "neetoImageUploader.imageUpload.upload",
109
+ components: {
110
+ span: /*#__PURE__*/jsxRuntime.jsx(Button, {
111
+ "data-testid": "open-asset-library-button",
112
+ style: "link"
113
+ })
114
+ }
115
+ })
116
+ }), /*#__PURE__*/jsxRuntime.jsx("input", _objectSpread(_objectSpread({}, getInputProps()), {}, {
117
+ "data-testid": "neeto-image-uploader-file-input",
118
+ disabled: isDisabled || isUploadDisabled
119
+ })), /*#__PURE__*/jsxRuntime.jsx(Typography, {
120
+ className: "neeto-ui-text-gray-700 text-center leading-4",
121
+ "data-testid": "neeto-image-uploader-restriction-message",
122
+ lineHeight: "snug",
123
+ style: "nano",
124
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
125
+ i18nKey: "neetoImageUploader.imageUpload.restrictionMessage",
126
+ values: {
127
+ fileTypes: getAllowedTypes(uploadConfig),
128
+ size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
129
+ }
130
+ })
131
+ }), neetoCist.isPresent(defaultImageSize) && /*#__PURE__*/jsxRuntime.jsx(Typography, {
132
+ className: "neeto-ui-text-gray-700 text-center leading-4",
133
+ "data-testid": "neeto-image-uploader-ideal-image-size-info-text",
134
+ lineHeight: "snug",
135
+ style: "nano",
136
+ children: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
137
+ i18nKey: "neetoImageUploader.imageUpload.idealImageSizeInfo",
138
+ values: _objectSpread({}, defaultImageSize)
139
+ })
140
+ })]
141
+ })
142
+ }));
143
+ });
144
+ ImageDirectUpload.displayName = "ImageDirectUpload";
145
+
146
+ var getWholeNumberAspectRatio = function getWholeNumberAspectRatio(_ref) {
147
+ var width = _ref.width,
148
+ height = _ref.height;
149
+ if (width === height) return {
150
+ width: 1,
151
+ height: 1
152
+ };
153
+ var _gcd = function gcd(a, b) {
154
+ return b === 0 ? a : _gcd(b, a % b);
155
+ };
156
+
157
+ // Multiplying by 1000 is a temporary fix to prevent height and width with fractions (eg: 100.91).
158
+ var divisor = _gcd(width * 1000, height * 1000);
159
+ return {
160
+ width: width / divisor,
161
+ height: height / divisor
162
+ };
163
+ };
164
+ var getCropValues = function getCropValues(_ref2) {
165
+ var crop = _ref2.crop,
166
+ imageRef = _ref2.imageRef;
167
+ var naturalWidth = imageRef.current.naturalWidth;
168
+ var naturalHeight = imageRef.current.naturalHeight;
169
+ return {
170
+ x: crop.x / 100 * naturalWidth,
171
+ y: crop.y / 100 * naturalHeight,
172
+ width: crop.width / 100 * naturalWidth,
173
+ height: crop.height / 100 * naturalHeight
174
+ };
175
+ };
176
+ var getImageKitCroppedURL = function getImageKitCroppedURL(_ref3) {
177
+ var imageURL = _ref3.imageURL,
178
+ crop = _ref3.crop,
179
+ imageRef = _ref3.imageRef;
180
+ var imagekit = new imagekit_esm.ImageKit({
181
+ urlEndpoint: initializers.globalProps.imagekit.urlEndpoint
182
+ });
183
+ var _getCropValues = getCropValues({
184
+ crop: crop,
185
+ imageRef: imageRef
186
+ }),
187
+ x = _getCropValues.x,
188
+ y = _getCropValues.y,
189
+ height = _getCropValues.height,
190
+ width = _getCropValues.width;
191
+ var transformation = [{
192
+ cropMode: "extract",
193
+ x: x,
194
+ y: y,
195
+ height: height,
196
+ width: width
197
+ }];
198
+ return imagekit.url({
199
+ src: imageURL,
200
+ transformation: transformation
201
+ });
202
+ };
203
+ var isNilOrEmpty = function isNilOrEmpty(value) {
204
+ return ramda.isNil(value) || ramda.isEmpty(value);
205
+ };
206
+ var isNotNilOrEmpty = function isNotNilOrEmpty(value) {
207
+ return !isNilOrEmpty(value);
208
+ };
209
+ var isItemsCenter = function isItemsCenter(_ref4) {
210
+ var imageRef = _ref4.imageRef,
211
+ wrapperRef = _ref4.wrapperRef;
212
+ var _ref5 = imageRef.current || {},
213
+ imageHeight = _ref5.height,
214
+ imageWidth = _ref5.width;
215
+ var wrapperHeight = (wrapperRef.current || {}).clientHeight;
216
+ if (imageHeight < imageWidth && imageHeight < wrapperHeight - 1) {
217
+ // Landscape images smaller than wrapper dimensions
218
+ return true;
219
+ }
220
+ if (imageHeight === imageWidth && imageHeight < wrapperHeight - 1) {
221
+ // Square images smaller than wrapper dimensions
222
+ return true;
223
+ }
224
+ return imageHeight > imageWidth && imageHeight < wrapperHeight - 1;
225
+ };
226
+ var calculateCloudFlareImageCroppedValues = function calculateCloudFlareImageCroppedValues(_ref6) {
227
+ var image = _ref6.image,
228
+ crop = _ref6.crop;
229
+ var naturalWidth = image.metadata.width;
230
+ var naturalHeight = image.metadata.height;
231
+ var sourceX = crop.x / 100 * naturalWidth;
232
+ var sourceY = crop.y / 100 * naturalHeight;
233
+ var sourceWidth = crop.width / 100 * naturalWidth;
234
+ var sourceHeight = crop.height / 100 * naturalHeight;
235
+ var distanceFromRight = Math.abs(naturalWidth - (sourceX + sourceWidth));
236
+ var distanceFromBottom = Math.abs(naturalHeight - (sourceY + sourceHeight));
237
+ return {
238
+ top: sourceY,
239
+ right: distanceFromRight,
240
+ bottom: distanceFromBottom,
241
+ left: sourceX
242
+ };
243
+ };
244
+ var getCloudFlareCroppedURL = function getCloudFlareCroppedURL(_ref7) {
245
+ var image = _ref7.image,
246
+ crop = _ref7.crop;
247
+ var _calculateCloudFlareI = calculateCloudFlareImageCroppedValues({
248
+ image: image,
249
+ crop: crop
250
+ }),
251
+ top = _calculateCloudFlareI.top,
252
+ right = _calculateCloudFlareI.right,
253
+ bottom = _calculateCloudFlareI.bottom,
254
+ left = _calculateCloudFlareI.left;
255
+ var trimValues = "".concat(top, ";").concat(right, ";").concat(bottom, ";").concat(left);
256
+ return image.url.replace("public", "trim=".concat(trimValues));
257
+ };
258
+ var getAspectRatio = function getAspectRatio(_ref8) {
259
+ var fixedAspectRatio = _ref8.fixedAspectRatio,
260
+ imageSize = _ref8.imageSize;
261
+ if (neetoCist.isPresent(fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) && neetoCist.isPresent(fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height)) {
262
+ return fixedAspectRatio;
263
+ }
264
+ if (neetoCist.isPresent(imageSize === null || imageSize === void 0 ? void 0 : imageSize.width) && neetoCist.isPresent(imageSize === null || imageSize === void 0 ? void 0 : imageSize.height)) {
265
+ return getWholeNumberAspectRatio(imageSize);
266
+ }
267
+ return {
268
+ width: 16,
269
+ height: 9
270
+ };
271
+ };
272
+ var getPixels = function getPixels(percentage, pixel) {
273
+ return Math.round(percentage / 100 * pixel);
274
+ };
275
+ var getPercentage = function getPercentage(crop, full) {
276
+ return crop / full * 100;
277
+ };
278
+ var getInitialCropSize = function getInitialCropSize(_ref9) {
279
+ var image = _ref9.image,
280
+ aspectRatioFactor = _ref9.aspectRatioFactor,
281
+ maxCropWidth = _ref9.maxCropWidth;
282
+ var imageWidth = image.naturalWidth,
283
+ imageHeight = image.naturalHeight;
284
+ var imageAspectRatio = imageWidth / imageHeight;
285
+ var maxCropHeight = maxCropWidth / aspectRatioFactor;
286
+ var cropWidth, cropHeight;
287
+ if (imageAspectRatio > aspectRatioFactor) {
288
+ cropWidth = Math.min(maxCropWidth, imageWidth);
289
+ cropHeight = cropWidth / aspectRatioFactor;
290
+ } else if (imageHeight < maxCropHeight) {
291
+ cropWidth = imageWidth;
292
+ cropHeight = imageHeight;
293
+ } else {
294
+ cropHeight = Math.min(maxCropHeight, imageHeight);
295
+ cropWidth = cropHeight * aspectRatioFactor;
296
+ }
297
+ return {
298
+ cropWidth: cropWidth,
299
+ cropHeight: cropHeight
300
+ };
301
+ };
302
+ var getHeightFromAspectRatio = function getHeightFromAspectRatio(width, aspectRatio) {
303
+ return Math.round(width * aspectRatio.height / aspectRatio.width);
304
+ };
305
+ var getWidthFromAspectRatio = function getWidthFromAspectRatio(height, aspectRatio) {
306
+ return Math.round(height * aspectRatio.width / aspectRatio.height);
307
+ };
308
+ var getWrapperRefStyles = function getWrapperRefStyles(wrapperRef, imageRef) {
309
+ var _ref10 = imageRef.current || {},
310
+ _ref10$naturalHeight = _ref10.naturalHeight,
311
+ naturalHeight = _ref10$naturalHeight === void 0 ? 100 : _ref10$naturalHeight,
312
+ _ref10$naturalWidth = _ref10.naturalWidth,
313
+ naturalWidth = _ref10$naturalWidth === void 0 ? 100 : _ref10$naturalWidth;
314
+ var _ref11 = wrapperRef.current || {},
315
+ _ref11$clientHeight = _ref11.clientHeight,
316
+ clientHeight = _ref11$clientHeight === void 0 ? 100 : _ref11$clientHeight,
317
+ _ref11$clientWidth = _ref11.clientWidth,
318
+ clientWidth = _ref11$clientWidth === void 0 ? 100 : _ref11$clientWidth;
319
+ if (naturalWidth <= clientWidth && naturalHeight <= clientHeight) {
320
+ return {
321
+ maxWidth: naturalWidth
322
+ };
323
+ } else if (naturalWidth > clientWidth && naturalHeight <= clientHeight) {
324
+ return {
325
+ maxWidth: clientWidth
326
+ };
327
+ } else if (naturalWidth <= clientWidth && naturalHeight > clientHeight) {
328
+ var _maxWidth = naturalWidth / naturalHeight * clientHeight;
329
+ return {
330
+ maxWidth: _maxWidth
331
+ };
332
+ }
333
+
334
+ // landscape
335
+ if (naturalWidth > naturalHeight) {
336
+ return {
337
+ maxWidth: clientWidth
338
+ };
339
+ }
340
+
341
+ // portrait
342
+ var maxWidth = naturalWidth / naturalHeight * clientHeight;
343
+ return {
344
+ maxWidth: maxWidth
345
+ };
346
+ };
347
+
348
+ exports.DEFAULT_UPLOAD_CONFIG = DEFAULT_UPLOAD_CONFIG;
349
+ exports.ImageDirectUpload = ImageDirectUpload;
350
+ exports.OPTION_KEYS = OPTION_KEYS;
351
+ exports.getAspectRatio = getAspectRatio;
352
+ exports.getCloudFlareCroppedURL = getCloudFlareCroppedURL;
353
+ exports.getCropValues = getCropValues;
354
+ exports.getHeightFromAspectRatio = getHeightFromAspectRatio;
355
+ exports.getImageKitCroppedURL = getImageKitCroppedURL;
356
+ exports.getInitialCropSize = getInitialCropSize;
357
+ exports.getPercentage = getPercentage;
358
+ exports.getPixels = getPixels;
359
+ exports.getWidthFromAspectRatio = getWidthFromAspectRatio;
360
+ exports.getWrapperRefStyles = getWrapperRefStyles;
361
+ exports.isItemsCenter = isItemsCenter;
362
+ exports.isNilOrEmpty = isNilOrEmpty;
363
+ exports.isNotNilOrEmpty = isNotNilOrEmpty;
364
+ //# sourceMappingURL=utils-BTmA9hHb.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils-BTmA9hHb.js","sources":["../app/javascript/src/components/ImageUploader/constants.js","../app/javascript/src/components/ImageUploader/utils.js","../app/javascript/src/components/common/ImageDirectUpload.jsx","../app/javascript/src/components/ImageEditor/utils.js"],"sourcesContent":["import { globalProps } from \"neetocommons/initializers\";\n\nexport const DEFAULT_ALLOWED_IMAGE_TYPES = {\n \"image/png\": [\".png\"],\n \"image/jpg\": [\".jpg\", \".jpeg\"],\n \"image/gif\": [\".gif\"],\n \"image/svg+xml\": [\".svg\"],\n};\n\nexport const DEFAULT_UPLOAD_CONFIG = {\n maxImageSize: globalProps.endUserUploadedFileSizeLimitInMb,\n allowedImageTypes: DEFAULT_ALLOWED_IMAGE_TYPES,\n};\n\nexport const OPTION_KEYS = { asset: \"asset\", remove: \"remove\" };\n","import { flatten, pipe, join, map, toUpper, values } from \"ramda\";\n\nexport const getAllowedTypes = uploadConfig =>\n pipe(\n values,\n flatten,\n map(extension => extension.slice(1)),\n map(toUpper),\n join(\", \")\n )(uploadConfig.allowedImageTypes);\n","import { forwardRef, useImperativeHandle } from \"react\";\n\nimport classnames from \"classnames\";\nimport { noop, isPresent } from \"neetocist\";\nimport { Button, Typography, ProgressBar } from \"neetoui\";\nimport { equals } from \"ramda\";\nimport { Trans } from \"react-i18next\";\n\nimport { DEFAULT_UPLOAD_CONFIG } from \"components/ImageUploader/constants\";\nimport { getAllowedTypes } from \"components/ImageUploader/utils\";\nimport useUploadDropzone from \"hooks/useUploadDropzone\";\n\nimport { DROPZONE_ROOT_DIV_CLASSNAME } from \"./constants\";\n\nconst ImageDirectUpload = forwardRef(\n (\n {\n uploadConfig = DEFAULT_UPLOAD_CONFIG,\n onDrop = noop,\n isDisabled = false,\n setIsAssetLibraryOpen,\n defaultImageSize = {},\n isUploadDisabled = false,\n setImage,\n },\n ref\n ) => {\n const {\n getRootProps,\n getInputProps,\n isDragActive,\n open,\n uploadProgress,\n setUploadProgress,\n } = useUploadDropzone({ uploadConfig, onDrop, setImage });\n\n useImperativeHandle(ref, () => ({\n upload: file => onDrop(file, setUploadProgress, setImage),\n }));\n\n const shouldShowProgress = !!(uploadProgress && !equals(uploadProgress, 1));\n\n return (\n <div\n {...getRootProps()}\n className={classnames(DROPZONE_ROOT_DIV_CLASSNAME, {\n \"neeto-ui-border-gray-300\": !isDragActive,\n \"neeto-ui-border-gray-700\": isDragActive,\n })}\n >\n {shouldShowProgress ? (\n <ProgressBar\n progressPercentage={uploadProgress}\n progressValue={`${uploadProgress}%`}\n />\n ) : (\n <div className=\"flex flex-col space-y-1\">\n {!isDisabled && (\n <Typography\n className=\"neeto-ui-text-gray-800 text-center leading-4\"\n style=\"body2\"\n >\n <Trans\n i18nKey=\"neetoImageUploader.imageUpload.dragAndDropOrBrowseFile\"\n components={{\n span: (\n <Button\n data-testid=\"neeto-image-uploader-browse-text\"\n style=\"link\"\n onClick={event => {\n event.stopPropagation();\n open();\n }}\n />\n ),\n }}\n />\n </Typography>\n )}\n {setIsAssetLibraryOpen && (\n <Typography\n style=\"body2\"\n className={classnames(\"text-center leading-4\", {\n \"pointer-events-none\": isUploadDisabled,\n })}\n onClick={e => {\n e.stopPropagation();\n setIsAssetLibraryOpen(true);\n }}\n >\n <Trans\n i18nKey=\"neetoImageUploader.imageUpload.upload\"\n components={{\n span: (\n <Button\n data-testid=\"open-asset-library-button\"\n style=\"link\"\n />\n ),\n }}\n />\n </Typography>\n )}\n <input\n {...getInputProps()}\n data-testid=\"neeto-image-uploader-file-input\"\n disabled={isDisabled || isUploadDisabled}\n />\n <Typography\n className=\"neeto-ui-text-gray-700 text-center leading-4\"\n data-testid=\"neeto-image-uploader-restriction-message\"\n lineHeight=\"snug\"\n style=\"nano\"\n >\n <Trans\n i18nKey=\"neetoImageUploader.imageUpload.restrictionMessage\"\n values={{\n fileTypes: getAllowedTypes(uploadConfig),\n size: uploadConfig?.maxImageSize,\n }}\n />\n </Typography>\n {isPresent(defaultImageSize) && (\n <Typography\n className=\"neeto-ui-text-gray-700 text-center leading-4\"\n data-testid=\"neeto-image-uploader-ideal-image-size-info-text\"\n lineHeight=\"snug\"\n style=\"nano\"\n >\n <Trans\n i18nKey=\"neetoImageUploader.imageUpload.idealImageSizeInfo\"\n values={{ ...defaultImageSize }}\n />\n </Typography>\n )}\n </div>\n )}\n </div>\n );\n }\n);\n\nImageDirectUpload.displayName = \"ImageDirectUpload\";\n\nexport default ImageDirectUpload;\n","import ImageKit from \"imagekit-javascript\";\nimport { isPresent } from \"neetocist\";\nimport { globalProps } from \"neetocommons/initializers\";\nimport { isEmpty, isNil } from \"ramda\";\n\nconst getWholeNumberAspectRatio = ({ width, height }) => {\n if (width === height) return { width: 1, height: 1 };\n\n const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b));\n\n // Multiplying by 1000 is a temporary fix to prevent height and width with fractions (eg: 100.91).\n const divisor = gcd(width * 1000, height * 1000);\n\n return { width: width / divisor, height: height / divisor };\n};\n\nexport const getCropValues = ({ crop, imageRef }) => {\n const naturalWidth = imageRef.current.naturalWidth;\n const naturalHeight = imageRef.current.naturalHeight;\n\n return {\n x: (crop.x / 100) * naturalWidth,\n y: (crop.y / 100) * naturalHeight,\n width: (crop.width / 100) * naturalWidth,\n height: (crop.height / 100) * naturalHeight,\n };\n};\n\nexport const getImageKitCroppedURL = ({ imageURL, crop, imageRef }) => {\n const imagekit = new ImageKit({\n urlEndpoint: globalProps.imagekit.urlEndpoint,\n });\n const { x, y, height, width } = getCropValues({ crop, imageRef });\n\n const transformation = [{ cropMode: \"extract\", x, y, height, width }];\n\n return imagekit.url({ src: imageURL, transformation });\n};\n\nexport const isNilOrEmpty = value => isNil(value) || isEmpty(value);\nexport const isNotNilOrEmpty = value => !isNilOrEmpty(value);\n\nexport const isItemsCenter = ({ imageRef, wrapperRef }) => {\n const { height: imageHeight, width: imageWidth } = imageRef.current || {};\n const wrapperHeight = (wrapperRef.current || {}).clientHeight;\n\n if (imageHeight < imageWidth && imageHeight < wrapperHeight - 1) {\n // Landscape images smaller than wrapper dimensions\n return true;\n }\n\n if (imageHeight === imageWidth && imageHeight < wrapperHeight - 1) {\n // Square images smaller than wrapper dimensions\n return true;\n }\n\n return imageHeight > imageWidth && imageHeight < wrapperHeight - 1;\n};\n\nexport const calculateCloudFlareImageCroppedValues = ({ image, crop }) => {\n const naturalWidth = image.metadata.width;\n const naturalHeight = image.metadata.height;\n\n const sourceX = (crop.x / 100) * naturalWidth;\n const sourceY = (crop.y / 100) * naturalHeight;\n const sourceWidth = (crop.width / 100) * naturalWidth;\n const sourceHeight = (crop.height / 100) * naturalHeight;\n\n const distanceFromRight = Math.abs(naturalWidth - (sourceX + sourceWidth));\n const distanceFromBottom = Math.abs(naturalHeight - (sourceY + sourceHeight));\n\n return {\n top: sourceY,\n right: distanceFromRight,\n bottom: distanceFromBottom,\n left: sourceX,\n };\n};\n\nexport const getCloudFlareCroppedURL = ({ image, crop }) => {\n const { top, right, bottom, left } = calculateCloudFlareImageCroppedValues({\n image,\n crop,\n });\n const trimValues = `${top};${right};${bottom};${left}`;\n\n return image.url.replace(\"public\", `trim=${trimValues}`);\n};\n\nexport const getAspectRatio = ({ fixedAspectRatio, imageSize }) => {\n if (\n isPresent(fixedAspectRatio?.width) &&\n isPresent(fixedAspectRatio?.height)\n ) {\n return fixedAspectRatio;\n }\n\n if (isPresent(imageSize?.width) && isPresent(imageSize?.height)) {\n return getWholeNumberAspectRatio(imageSize);\n }\n\n return { width: 16, height: 9 };\n};\n\nexport const getPixels = (percentage, pixel) =>\n Math.round((percentage / 100) * pixel);\n\nexport const getPercentage = (crop, full) => (crop / full) * 100;\n\nexport const getInitialCropSize = ({\n image,\n aspectRatioFactor,\n maxCropWidth,\n}) => {\n const { naturalWidth: imageWidth, naturalHeight: imageHeight } = image;\n const imageAspectRatio = imageWidth / imageHeight;\n const maxCropHeight = maxCropWidth / aspectRatioFactor;\n\n let cropWidth, cropHeight;\n\n if (imageAspectRatio > aspectRatioFactor) {\n cropWidth = Math.min(maxCropWidth, imageWidth);\n cropHeight = cropWidth / aspectRatioFactor;\n } else if (imageHeight < maxCropHeight) {\n cropWidth = imageWidth;\n cropHeight = imageHeight;\n } else {\n cropHeight = Math.min(maxCropHeight, imageHeight);\n cropWidth = cropHeight * aspectRatioFactor;\n }\n\n return { cropWidth, cropHeight };\n};\n\nexport const getHeightFromAspectRatio = (width, aspectRatio) =>\n Math.round((width * aspectRatio.height) / aspectRatio.width);\n\nexport const getWidthFromAspectRatio = (height, aspectRatio) =>\n Math.round((height * aspectRatio.width) / aspectRatio.height);\n\nexport const getWrapperRefStyles = (wrapperRef, imageRef) => {\n const { naturalHeight = 100, naturalWidth = 100 } = imageRef.current || {};\n const { clientHeight = 100, clientWidth = 100 } = wrapperRef.current || {};\n\n if (naturalWidth <= clientWidth && naturalHeight <= clientHeight) {\n return { maxWidth: naturalWidth };\n } else if (naturalWidth > clientWidth && naturalHeight <= clientHeight) {\n return { maxWidth: clientWidth };\n } else if (naturalWidth <= clientWidth && naturalHeight > clientHeight) {\n const maxWidth = (naturalWidth / naturalHeight) * clientHeight;\n\n return { maxWidth };\n }\n\n // landscape\n if (naturalWidth > naturalHeight) {\n return { maxWidth: clientWidth };\n }\n\n // portrait\n const maxWidth = (naturalWidth / naturalHeight) * clientHeight;\n\n return { maxWidth };\n};\n"],"names":["DEFAULT_ALLOWED_IMAGE_TYPES","DEFAULT_UPLOAD_CONFIG","maxImageSize","globalProps","endUserUploadedFileSizeLimitInMb","allowedImageTypes","OPTION_KEYS","asset","remove","getAllowedTypes","uploadConfig","pipe","values","flatten","map","extension","slice","toUpper","join","ImageDirectUpload","forwardRef","_ref","ref","_ref$uploadConfig","_ref$onDrop","onDrop","noop","_ref$isDisabled","isDisabled","setIsAssetLibraryOpen","_ref$defaultImageSize","defaultImageSize","_ref$isUploadDisabled","isUploadDisabled","setImage","_useUploadDropzone","useUploadDropzone","getRootProps","getInputProps","isDragActive","open","uploadProgress","setUploadProgress","useImperativeHandle","upload","file","shouldShowProgress","equals","_jsx","_objectSpread","className","classnames","DROPZONE_ROOT_DIV_CLASSNAME","children","ProgressBar","progressPercentage","progressValue","concat","_jsxs","Typography","style","Trans","i18nKey","components","span","Button","onClick","event","stopPropagation","e","disabled","lineHeight","fileTypes","size","isPresent","displayName","getWholeNumberAspectRatio","width","height","gcd","a","b","divisor","getCropValues","_ref2","crop","imageRef","naturalWidth","current","naturalHeight","x","y","getImageKitCroppedURL","_ref3","imageURL","imagekit","ImageKit","urlEndpoint","_getCropValues","transformation","cropMode","url","src","isNilOrEmpty","value","isNil","isEmpty","isNotNilOrEmpty","isItemsCenter","_ref4","wrapperRef","_ref5","imageHeight","imageWidth","wrapperHeight","clientHeight","calculateCloudFlareImageCroppedValues","_ref6","image","metadata","sourceX","sourceY","sourceWidth","sourceHeight","distanceFromRight","Math","abs","distanceFromBottom","top","right","bottom","left","getCloudFlareCroppedURL","_ref7","_calculateCloudFlareI","trimValues","replace","getAspectRatio","_ref8","fixedAspectRatio","imageSize","getPixels","percentage","pixel","round","getPercentage","full","getInitialCropSize","_ref9","aspectRatioFactor","maxCropWidth","imageAspectRatio","maxCropHeight","cropWidth","cropHeight","min","getHeightFromAspectRatio","aspectRatio","getWidthFromAspectRatio","getWrapperRefStyles","_ref10","_ref10$naturalHeight","_ref10$naturalWidth","_ref11","_ref11$clientHeight","_ref11$clientWidth","clientWidth","maxWidth"],"mappings":";;;;;;;;;;;;;;;;AAEO,IAAMA,2BAA2B,GAAG;EACzC,WAAW,EAAE,CAAC,MAAM,CAAC;AACrB,EAAA,WAAW,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC;EAC9B,WAAW,EAAE,CAAC,MAAM,CAAC;EACrB,eAAe,EAAE,CAAC,MAAM;AAC1B,CAAC;AAEM,IAAMC,qBAAqB,GAAG;EACnCC,YAAY,EAAEC,wBAAW,CAACC,gCAAgC;AAC1DC,EAAAA,iBAAiB,EAAEL;AACrB;AAEO,IAAMM,WAAW,GAAG;AAAEC,EAAAA,KAAK,EAAE,OAAO;AAAEC,E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,mBAAA,KAAA,MAAA,GAAG,GAAG,GAAAA,mBAAA;IAAAC,kBAAA,GAAAF,MAAA,CAAEG,WAAW;AAAXA,IAAAA,WAAW,GAAAD,kBAAA,KAAA,MAAA,GAAG,GAAG,GAAAA,kBAAA;AAE7C,EAAA,IAAI9E,YAAY,IAAI+E,WAAW,IAAI7E,aAAa,IAAI0B,YAAY,EAAE;IAChE,OAAO;AAAEoD,MAAAA,QAAQ,EAAEhF;KAAc;EACnC,CAAC,MAAM,IAAIA,YAAY,GAAG+E,WAAW,IAAI7E,aAAa,IAAI0B,YAAY,EAAE;IACtE,OAAO;AAAEoD,MAAAA,QAAQ,EAAED;KAAa;EAClC,CAAC,MAAM,IAAI/E,YAAY,IAAI+E,WAAW,IAAI7E,aAAa,GAAG0B,YAAY,EAAE;AACtE,IAAA,IAAMoD,SAAQ,GAAIhF,YAAY,GAAGE,aAAa,GAAI0B,YAAY;IAE9D,OAAO;AAAEoD,MAAAA,QAAQ,EAARA;KAAU;AACrB,EAAA;;AAEA;EACA,IAAIhF,YAAY,GAAGE,aAAa,EAAE;IAChC,OAAO;AAAE8E,MAAAA,QAAQ,EAAED;KAAa;AAClC,EAAA;;AAEA;AACA,EAAA,IAAMC,QAAQ,GAAIhF,YAAY,GAAGE,aAAa,GAAI0B,YAAY;EAE9D,OAAO;AAAEoD,IAAAA,QAAQ,EAARA;GAAU;AACrB;;;;;;;;;;;;;;;;;;;"}
@@ -1,19 +1,15 @@
1
1
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import { useState, forwardRef, useImperativeHandle } from 'react';
2
+ import { forwardRef, useImperativeHandle } from 'react';
3
+ import { Progress, Typography, Button } from '@bigbinary/neeto-atoms';
3
4
  import classnames from 'classnames';
4
- import { noop, isPresent } from '@bigbinary/neeto-cist';
5
- import Button from '@bigbinary/neetoui/Button';
6
- import Typography from '@bigbinary/neetoui/Typography';
7
- import ProgressBar from '@bigbinary/neetoui/ProgressBar';
5
+ import { isPresent, noop } from '@bigbinary/neeto-cist';
8
6
  import { pipe, values, flatten, map, toUpper, join, equals, isNil, isEmpty } from 'ramda';
9
7
  import { Trans } from 'react-i18next';
10
- import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
11
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
12
- import { useDropzone } from 'react-dropzone';
8
+ import { u as useUploadDropzone } from './useUploadDropzone-8Xa8PI-1.js';
9
+ import { globalProps } from '@bigbinary/neeto-commons-frontend/v2/initializers';
13
10
  import i18next, { t } from 'i18next';
14
- import Toastr from '@bigbinary/neetoui/Toastr';
15
- import { F as FILE_ERRORS, D as DROPZONE_ROOT_DIV_CLASSNAME, C as CLOUD_FLARE, b as IMAGE_UPLOADER_BASE_URL, I as IS_DEVELOPMENT_OR_HEROKU_ENV, a as ImageKit } from './imagekit.esm-CXW6c1fP.js';
16
11
  import { jsx, jsxs } from 'react/jsx-runtime';
12
+ import { C as CLOUD_FLARE, a as IMAGE_UPLOADER_BASE_URL, I as IS_DEVELOPMENT_OR_HEROKU_ENV, b as ImageKit } from './imagekit.esm-IYQEzBnD.js';
17
13
 
18
14
  var DEFAULT_ALLOWED_IMAGE_TYPES = {
19
15
  "image/png": [".png"],
@@ -36,51 +32,13 @@ var getAllowedTypes = function getAllowedTypes(uploadConfig) {
36
32
  }), map(toUpper), join(", "))(uploadConfig.allowedImageTypes);
37
33
  };
38
34
 
39
- var handleDropRejected = function handleDropRejected(fileRejections) {
40
- fileRejections.map(function (_ref) {
41
- var errors = _ref.errors;
42
- return errors.map(function (_ref2) {
43
- var code = _ref2.code;
44
- return Toastr.error(FILE_ERRORS[code] || t("neetoImageUploader.imageUpload.genericError"));
45
- });
46
- });
47
- };
48
-
49
- var useUploadDropzone = function useUploadDropzone(_ref) {
50
- var _ref$uploadConfig = _ref.uploadConfig,
51
- uploadConfig = _ref$uploadConfig === void 0 ? {
52
- allowedImageTypes: [],
53
- maxImageSize: 0
54
- } : _ref$uploadConfig,
55
- _onDrop = _ref.onDrop,
56
- _ref$setImage = _ref.setImage,
57
- setImage = _ref$setImage === void 0 ? noop : _ref$setImage;
58
- var _useState = useState(0),
59
- _useState2 = _slicedToArray(_useState, 2),
60
- uploadProgress = _useState2[0],
61
- setUploadProgress = _useState2[1];
62
- var _useDropzone = useDropzone({
63
- onDrop: function onDrop(acceptedFiles) {
64
- return _onDrop(acceptedFiles[0], setUploadProgress, setImage);
65
- },
66
- accept: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.allowedImageTypes,
67
- multiple: false,
68
- maxSize: uploadConfig.maxImageSize * 1048576,
69
- onDropRejected: handleDropRejected
70
- }),
71
- getRootProps = _useDropzone.getRootProps,
72
- getInputProps = _useDropzone.getInputProps,
73
- isDragActive = _useDropzone.isDragActive,
74
- open = _useDropzone.open;
75
- return {
76
- getRootProps: getRootProps,
77
- getInputProps: getInputProps,
78
- isDragActive: isDragActive,
79
- open: open,
80
- uploadProgress: uploadProgress,
81
- setUploadProgress: setUploadProgress
82
- };
83
- };
35
+ var DROPZONE_ROOT_DIV_CLASSNAME = "border-primary hover:bg-muted neeto-ui-rounded-lg flex h-full w-full flex-col items-center justify-center gap-3 border border-dashed p-4 transition-all duration-300 ease-in-out relative";
36
+ ({
37
+ "file-invalid-type": t("neetoImageUploader.imageUpload.fileTypeError"),
38
+ "file-too-large": t("neetoImageUploader.imageUpload.fileSizeError"),
39
+ "file-dimension-too-large": t("neetoImageUploader.imageUpload.fileDimensionError"),
40
+ "file-resolution-too-large": t("neetoImageUploader.imageUpload.fileResolutionError")
41
+ });
84
42
 
85
43
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
86
44
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -118,23 +76,24 @@ var ImageDirectUpload = /*#__PURE__*/forwardRef(function (_ref, ref) {
118
76
  var shouldShowProgress = !!(uploadProgress && !equals(uploadProgress, 1));
119
77
  return /*#__PURE__*/jsx("div", _objectSpread(_objectSpread({}, getRootProps()), {}, {
120
78
  className: classnames(DROPZONE_ROOT_DIV_CLASSNAME, {
121
- "neeto-ui-border-gray-300": !isDragActive,
122
- "neeto-ui-border-gray-700": isDragActive
79
+ "border-border": !isDragActive,
80
+ "border-foreground": isDragActive
123
81
  }),
124
- children: shouldShowProgress ? /*#__PURE__*/jsx(ProgressBar, {
125
- progressPercentage: uploadProgress,
126
- progressValue: "".concat(uploadProgress, "%")
82
+ children: shouldShowProgress ? /*#__PURE__*/jsx(Progress, {
83
+ progressValue: "".concat(uploadProgress, "%"),
84
+ value: uploadProgress
127
85
  }) : /*#__PURE__*/jsxs("div", {
128
86
  className: "flex flex-col space-y-1",
129
87
  children: [!isDisabled && /*#__PURE__*/jsx(Typography, {
130
- className: "neeto-ui-text-gray-800 text-center leading-4",
131
- style: "body2",
88
+ className: "text-center leading-4",
89
+ color: "default",
90
+ variant: "body2",
132
91
  children: /*#__PURE__*/jsx(Trans, {
133
92
  i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
134
93
  components: {
135
94
  span: /*#__PURE__*/jsx(Button, {
136
95
  "data-testid": "neeto-image-uploader-browse-text",
137
- style: "link",
96
+ variant: "link",
138
97
  onClick: function onClick(event) {
139
98
  event.stopPropagation();
140
99
  open();
@@ -143,7 +102,7 @@ var ImageDirectUpload = /*#__PURE__*/forwardRef(function (_ref, ref) {
143
102
  }
144
103
  })
145
104
  }), setIsAssetLibraryOpen && /*#__PURE__*/jsx(Typography, {
146
- style: "body2",
105
+ variant: "body2",
147
106
  className: classnames("text-center leading-4", {
148
107
  "pointer-events-none": isUploadDisabled
149
108
  }),
@@ -156,7 +115,7 @@ var ImageDirectUpload = /*#__PURE__*/forwardRef(function (_ref, ref) {
156
115
  components: {
157
116
  span: /*#__PURE__*/jsx(Button, {
158
117
  "data-testid": "open-asset-library-button",
159
- style: "link"
118
+ variant: "link"
160
119
  })
161
120
  }
162
121
  })
@@ -164,10 +123,10 @@ var ImageDirectUpload = /*#__PURE__*/forwardRef(function (_ref, ref) {
164
123
  "data-testid": "neeto-image-uploader-file-input",
165
124
  disabled: isDisabled || isUploadDisabled
166
125
  })), /*#__PURE__*/jsx(Typography, {
167
- className: "neeto-ui-text-gray-700 text-center leading-4",
126
+ className: "text-center leading-4",
127
+ color: "muted",
168
128
  "data-testid": "neeto-image-uploader-restriction-message",
169
- lineHeight: "snug",
170
- style: "nano",
129
+ variant: "nano",
171
130
  children: /*#__PURE__*/jsx(Trans, {
172
131
  i18nKey: "neetoImageUploader.imageUpload.restrictionMessage",
173
132
  values: {
@@ -176,10 +135,10 @@ var ImageDirectUpload = /*#__PURE__*/forwardRef(function (_ref, ref) {
176
135
  }
177
136
  })
178
137
  }), isPresent(defaultImageSize) && /*#__PURE__*/jsx(Typography, {
179
- className: "neeto-ui-text-gray-700 text-center leading-4",
138
+ className: "text-center leading-4",
139
+ color: "muted",
180
140
  "data-testid": "neeto-image-uploader-ideal-image-size-info-text",
181
- lineHeight: "snug",
182
- style: "nano",
141
+ variant: "nano",
183
142
  children: /*#__PURE__*/jsx(Trans, {
184
143
  i18nKey: "neetoImageUploader.imageUpload.idealImageSizeInfo",
185
144
  values: _objectSpread({}, defaultImageSize)
@@ -238,7 +197,7 @@ var INFINITE_SCROLLER_STYLE = {
238
197
  var IMAGE_UPLOAD_SERVICE_URL = globalProps.assetsUploaderService === CLOUD_FLARE ? "".concat(IMAGE_UPLOADER_BASE_URL, "/cloudflare_images") : "".concat(IMAGE_UPLOADER_BASE_URL, "/imagekit/fetch");
239
198
  var ASSETS_FETCH_URL = IS_DEVELOPMENT_OR_HEROKU_ENV ? "".concat(IMAGE_UPLOADER_BASE_URL, "/development/fetch") : IMAGE_UPLOAD_SERVICE_URL;
240
199
  var ASSETS_DESTROY_URL = IS_DEVELOPMENT_OR_HEROKU_ENV ? "".concat(IMAGE_UPLOADER_BASE_URL, "/development/bulk_destroy") : "".concat(IMAGE_UPLOADER_BASE_URL, "/imagekit/bulk_destroy");
241
- var IMAGE_WRAPPER_CLASSNAME = "neeto-ui-border-gray-300 neeto-ui-bg-gray-100 hover:neeto-ui-bg-gray-200 neeto-ui-rounded-lg relative flex h-full w-full flex-col items-center justify-center gap-5 border border-dashed p-2 transition-all duration-300 ease-in-out";
200
+ var IMAGE_WRAPPER_CLASSNAME = "border-border bg-muted hover:bg-muted/80 neeto-ui-rounded-lg relative flex h-full w-full flex-col items-center justify-center gap-5 border border-dashed p-2 transition-all duration-300 ease-in-out";
242
201
 
243
202
  var getWholeNumberAspectRatio = function getWholeNumberAspectRatio(_ref) {
244
203
  var width = _ref.width,
@@ -442,5 +401,5 @@ var getWrapperRefStyles = function getWrapperRefStyles(wrapperRef, imageRef) {
442
401
  };
443
402
  };
444
403
 
445
- export { ASSETS_DESTROY_URL as A, DEFAULT_UPLOAD_CONFIG as D, IMAGE_WRAPPER_CLASSNAME as I, OPTION_KEYS as O, TABS as T, UNSPLASH_DEFAULT_NAME as U, ImageDirectUpload as a, isNilOrEmpty as b, DEFAULT_CROP_CONFIG as c, getPixels as d, getHeightFromAspectRatio as e, getWidthFromAspectRatio as f, getAspectRatio as g, getInitialCropSize as h, isNotNilOrEmpty as i, getPercentage as j, getWrapperRefStyles as k, isItemsCenter as l, getCloudFlareCroppedURL as m, getImageKitCroppedURL as n, getCropValues as o, IMAGES_PER_PAGE as p, INFINITE_SCROLLER_STYLE as q, INFINITE_SCROLLER_SIZES as r, ASSETS_FETCH_URL as s, UNSPLASH_DEFAULT_REQUEST_CONFIG as t, useUploadDropzone as u, UNSPLASH_URL as v };
446
- //# sourceMappingURL=utils-BYMSmzRM.js.map
404
+ export { ASSETS_DESTROY_URL as A, DEFAULT_UPLOAD_CONFIG as D, IMAGE_WRAPPER_CLASSNAME as I, OPTION_KEYS as O, TABS as T, UNSPLASH_DEFAULT_NAME as U, ImageDirectUpload as a, isNilOrEmpty as b, DEFAULT_CROP_CONFIG as c, getPixels as d, getHeightFromAspectRatio as e, getWidthFromAspectRatio as f, getAspectRatio as g, getInitialCropSize as h, isNotNilOrEmpty as i, getPercentage as j, getWrapperRefStyles as k, isItemsCenter as l, getCloudFlareCroppedURL as m, getImageKitCroppedURL as n, getCropValues as o, INFINITE_SCROLLER_STYLE as p, INFINITE_SCROLLER_SIZES as q, IMAGES_PER_PAGE as r, ASSETS_FETCH_URL as s, UNSPLASH_DEFAULT_REQUEST_CONFIG as t, UNSPLASH_URL as u };
405
+ //# sourceMappingURL=utils-CbaXwRPJ.js.map