@bigbinary/neeto-image-uploader-frontend 1.4.11 → 1.4.13
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/app/javascript/src/translations/en.json +1 -1
- package/dist/index.cjs.js +17 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +18 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"genericError": "Something went wrong!.",
|
|
48
48
|
"fileSizeError": "File size is too large",
|
|
49
49
|
"fileTypeError": "File type is not supported",
|
|
50
|
-
"
|
|
50
|
+
"allowedConfig": " Only {{fileTypes}} files are supported. Maximum allowed size {{size}} MB.",
|
|
51
51
|
"uploadedImage": "Uploaded Image"
|
|
52
52
|
}
|
|
53
53
|
}
|
package/dist/index.cjs.js
CHANGED
|
@@ -2664,8 +2664,8 @@ var directUploadsApi = {
|
|
|
2664
2664
|
};
|
|
2665
2665
|
|
|
2666
2666
|
var QUERY_KEYS = {
|
|
2667
|
-
|
|
2668
|
-
UNSPLASH_LIST: "unsplash-list"
|
|
2667
|
+
ASSETS_LIST: "neeto-image-uploader-assets-list",
|
|
2668
|
+
UNSPLASH_LIST: "neeto-image-uploader-unsplash-list"
|
|
2669
2669
|
};
|
|
2670
2670
|
var ASSETS_STALE_TIME = 900000; // 15 mins
|
|
2671
2671
|
|
|
@@ -4957,12 +4957,11 @@ var assetsApi = {
|
|
|
4957
4957
|
fetch: fetch
|
|
4958
4958
|
};
|
|
4959
4959
|
|
|
4960
|
-
var ASSETS_LIST = QUERY_KEYS.ASSETS_LIST;
|
|
4961
4960
|
var useFetchAssets = function useFetchAssets(_ref) {
|
|
4962
4961
|
var search = _ref.search,
|
|
4963
4962
|
url = _ref.url;
|
|
4964
4963
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4965
|
-
return reactQuery.useQuery([ASSETS_LIST, search], function () {
|
|
4964
|
+
return reactQuery.useQuery([QUERY_KEYS.ASSETS_LIST, search], function () {
|
|
4966
4965
|
return assetsApi.fetch({
|
|
4967
4966
|
search: search,
|
|
4968
4967
|
url: url
|
|
@@ -6193,6 +6192,10 @@ var Modal = function Modal(_ref) {
|
|
|
6193
6192
|
})), /*#__PURE__*/React__default["default"].createElement("input", getInputProps()));
|
|
6194
6193
|
};
|
|
6195
6194
|
|
|
6195
|
+
var getAllowedTypes = function getAllowedTypes(uploadConfig) {
|
|
6196
|
+
return ramda.pipe(ramda.values, ramda.flatten, ramda.join(", "))(uploadConfig.allowedImageTypes);
|
|
6197
|
+
};
|
|
6198
|
+
|
|
6196
6199
|
var ImageUpload = function ImageUpload(_ref) {
|
|
6197
6200
|
var getRootProps = _ref.getRootProps,
|
|
6198
6201
|
getInputProps = _ref.getInputProps,
|
|
@@ -6212,7 +6215,8 @@ var ImageUpload = function ImageUpload(_ref) {
|
|
|
6212
6215
|
i18nKey: "neetoImageUploader.imageUpload.dragAndDropOrBrowseFile",
|
|
6213
6216
|
components: {
|
|
6214
6217
|
span: /*#__PURE__*/React__default["default"].createElement("span", {
|
|
6215
|
-
className: "neeto-ui-text-primary-500"
|
|
6218
|
+
className: "neeto-ui-text-primary-500",
|
|
6219
|
+
"data-cy": "upload-button"
|
|
6216
6220
|
})
|
|
6217
6221
|
}
|
|
6218
6222
|
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -6229,13 +6233,16 @@ var ImageUpload = function ImageUpload(_ref) {
|
|
|
6229
6233
|
className: "neeto-ui-text-primary-500"
|
|
6230
6234
|
})
|
|
6231
6235
|
}
|
|
6232
|
-
})), /*#__PURE__*/React__default["default"].createElement("input",
|
|
6236
|
+
})), /*#__PURE__*/React__default["default"].createElement("input", _extends$1({}, getInputProps(), {
|
|
6237
|
+
"data-cy": "image-upload-input"
|
|
6238
|
+
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
6233
6239
|
className: "text-center leading-4",
|
|
6234
6240
|
style: "body3"
|
|
6235
6241
|
}, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
6236
|
-
i18nKey: "neetoImageUploader.imageUpload.
|
|
6242
|
+
i18nKey: "neetoImageUploader.imageUpload.allowedConfig",
|
|
6237
6243
|
values: {
|
|
6238
|
-
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
|
|
6244
|
+
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize,
|
|
6245
|
+
fileTypes: getAllowedTypes(uploadConfig)
|
|
6239
6246
|
}
|
|
6240
6247
|
}))));
|
|
6241
6248
|
};
|
|
@@ -6371,8 +6378,7 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
6371
6378
|
}),
|
|
6372
6379
|
getRootProps = _useDropzoneWithValid.getRootProps,
|
|
6373
6380
|
getInputProps = _useDropzoneWithValid.getInputProps,
|
|
6374
|
-
uploadProgress = _useDropzoneWithValid.uploadProgress
|
|
6375
|
-
inputRef = _useDropzoneWithValid.inputRef;
|
|
6381
|
+
uploadProgress = _useDropzoneWithValid.uploadProgress;
|
|
6376
6382
|
if (isUploading) {
|
|
6377
6383
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6378
6384
|
className: className
|
|
@@ -6397,15 +6403,6 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
6397
6403
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6398
6404
|
className: "flex items-stretch justify-center gap-2"
|
|
6399
6405
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6400
|
-
label: t("neetoImageUploader.imageUpload.change"),
|
|
6401
|
-
style: "link",
|
|
6402
|
-
onClick: function onClick() {
|
|
6403
|
-
var _inputRef$current;
|
|
6404
|
-
return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();
|
|
6405
|
-
}
|
|
6406
|
-
}), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6407
|
-
className: "neeto-ui-bg-gray-300 w-px"
|
|
6408
|
-
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6409
6406
|
label: t("neetoImageUploader.imageUpload.assets"),
|
|
6410
6407
|
style: "link",
|
|
6411
6408
|
onClick: setIsAssetLibraryOpen
|
|
@@ -6413,6 +6410,7 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
6413
6410
|
className: "neeto-ui-bg-gray-300 w-px"
|
|
6414
6411
|
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6415
6412
|
className: "bg-transparent p-0",
|
|
6413
|
+
"data-cy": "attachment-remove-button",
|
|
6416
6414
|
label: t("neetoImageUploader.imageUpload.delete"),
|
|
6417
6415
|
style: "danger-text",
|
|
6418
6416
|
onClick: handleDelete
|