@bigbinary/neeto-image-uploader-frontend 1.4.11 → 1.4.12
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 +11 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +12 -18
- 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,
|
|
@@ -6233,9 +6236,10 @@ var ImageUpload = function ImageUpload(_ref) {
|
|
|
6233
6236
|
className: "text-center leading-4",
|
|
6234
6237
|
style: "body3"
|
|
6235
6238
|
}, /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
6236
|
-
i18nKey: "neetoImageUploader.imageUpload.
|
|
6239
|
+
i18nKey: "neetoImageUploader.imageUpload.allowedConfig",
|
|
6237
6240
|
values: {
|
|
6238
|
-
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize
|
|
6241
|
+
size: uploadConfig === null || uploadConfig === void 0 ? void 0 : uploadConfig.maxImageSize,
|
|
6242
|
+
fileTypes: getAllowedTypes(uploadConfig)
|
|
6239
6243
|
}
|
|
6240
6244
|
}))));
|
|
6241
6245
|
};
|
|
@@ -6371,8 +6375,7 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
6371
6375
|
}),
|
|
6372
6376
|
getRootProps = _useDropzoneWithValid.getRootProps,
|
|
6373
6377
|
getInputProps = _useDropzoneWithValid.getInputProps,
|
|
6374
|
-
uploadProgress = _useDropzoneWithValid.uploadProgress
|
|
6375
|
-
inputRef = _useDropzoneWithValid.inputRef;
|
|
6378
|
+
uploadProgress = _useDropzoneWithValid.uploadProgress;
|
|
6376
6379
|
if (isUploading) {
|
|
6377
6380
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6378
6381
|
className: className
|
|
@@ -6397,15 +6400,6 @@ var ImageUploader = function ImageUploader(_ref) {
|
|
|
6397
6400
|
})), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6398
6401
|
className: "flex items-stretch justify-center gap-2"
|
|
6399
6402
|
}, /*#__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
6403
|
label: t("neetoImageUploader.imageUpload.assets"),
|
|
6410
6404
|
style: "link",
|
|
6411
6405
|
onClick: setIsAssetLibraryOpen
|