@bigbinary/neeto-image-uploader-frontend 2.3.33 → 2.3.35
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/ar.json +7 -3
- package/app/javascript/src/translations/bg.json +7 -3
- package/app/javascript/src/translations/ca.json +7 -3
- package/app/javascript/src/translations/cs.json +7 -3
- package/app/javascript/src/translations/da.json +7 -3
- package/app/javascript/src/translations/de.json +7 -3
- package/app/javascript/src/translations/es-MX.json +7 -3
- package/app/javascript/src/translations/es.json +7 -3
- package/app/javascript/src/translations/et.json +7 -3
- package/app/javascript/src/translations/fi.json +7 -3
- package/app/javascript/src/translations/fil.json +7 -3
- package/app/javascript/src/translations/fr.json +7 -3
- package/app/javascript/src/translations/he.json +7 -3
- package/app/javascript/src/translations/hi.json +7 -3
- package/app/javascript/src/translations/hr.json +7 -3
- package/app/javascript/src/translations/id.json +7 -3
- package/app/javascript/src/translations/it.json +7 -3
- package/app/javascript/src/translations/ja.json +7 -3
- package/app/javascript/src/translations/ko.json +7 -3
- package/app/javascript/src/translations/nl.json +7 -3
- package/app/javascript/src/translations/pl.json +7 -3
- package/app/javascript/src/translations/pt-BR.json +7 -3
- package/app/javascript/src/translations/pt.json +7 -3
- package/app/javascript/src/translations/ro.json +7 -3
- package/app/javascript/src/translations/ru.json +7 -3
- package/app/javascript/src/translations/sk.json +7 -3
- package/app/javascript/src/translations/sl.json +7 -3
- package/app/javascript/src/translations/sv.json +7 -3
- package/app/javascript/src/translations/th.json +7 -3
- package/app/javascript/src/translations/tr.json +7 -3
- package/app/javascript/src/translations/uk.json +7 -3
- package/app/javascript/src/translations/vi.json +7 -3
- package/app/javascript/src/translations/zh-CN.json +7 -3
- package/app/javascript/src/translations/zh-TW.json +7 -3
- package/dist/AssetLibrary.js +2 -2
- package/dist/BasicImageUploader.js +4 -4
- package/dist/BasicImageUploader.js.map +1 -1
- package/dist/ImageForm.js +13 -13
- package/dist/ImageForm.js.map +1 -1
- package/dist/ImageUploader.js +7 -7
- package/dist/ImageUploader.js.map +1 -1
- package/dist/cjs/AssetLibrary.js +2 -2
- package/dist/cjs/BasicImageUploader.js +4 -4
- package/dist/cjs/BasicImageUploader.js.map +1 -1
- package/dist/cjs/ImageForm.js +13 -13
- package/dist/cjs/ImageForm.js.map +1 -1
- package/dist/cjs/ImageUploader.js +7 -7
- package/dist/cjs/ImageUploader.js.map +1 -1
- package/dist/cjs/index.js +2 -2
- package/dist/{index-ph4UeLLc.js → index-Bd796sPX.js} +28 -18
- package/dist/index-Bd796sPX.js.map +1 -0
- package/dist/{index-BH0wqq_n.js → index-oS3UYUfo.js} +28 -18
- package/dist/index-oS3UYUfo.js.map +1 -0
- package/dist/index.js +2 -2
- package/dist/{utils-DMz4D2SB.js → utils-BjNaSuOu.js} +13 -9
- package/dist/utils-BjNaSuOu.js.map +1 -0
- package/dist/{utils-CVOvfMWy.js → utils-Um4BP0zx.js} +13 -9
- package/dist/utils-Um4BP0zx.js.map +1 -0
- package/package.json +15 -15
- package/types.d.ts +1 -1
- package/dist/index-BH0wqq_n.js.map +0 -1
- package/dist/index-ph4UeLLc.js.map +0 -1
- package/dist/utils-CVOvfMWy.js.map +0 -1
- package/dist/utils-DMz4D2SB.js.map +0 -1
|
@@ -10,7 +10,7 @@ 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 { i 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 getWrapperRefStyles, m as getCloudFlareCroppedURL, n as getImageKitCroppedURL, o as getCropValues, p as IMAGES_PER_PAGE, q as INFINITE_SCROLLER_SIZES, r as INFINITE_SCROLLER_STYLE, T as TABS, A as ASSETS_DESTROY_URL, s as ASSETS_FETCH_URL, U as UNSPLASH_DEFAULT_NAME, t as UNSPLASH_DEFAULT_REQUEST_CONFIG, D as DEFAULT_UPLOAD_CONFIG, u as useUploadDropzone, v as UNSPLASH_URL, b as ImageDirectUpload } from './utils-
|
|
13
|
+
import { i 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 getWrapperRefStyles, m as getCloudFlareCroppedURL, n as getImageKitCroppedURL, o as getCropValues, p as IMAGES_PER_PAGE, q as INFINITE_SCROLLER_SIZES, r as INFINITE_SCROLLER_STYLE, T as TABS, A as ASSETS_DESTROY_URL, s as ASSETS_FETCH_URL, U as UNSPLASH_DEFAULT_NAME, t as UNSPLASH_DEFAULT_REQUEST_CONFIG, D as DEFAULT_UPLOAD_CONFIG, u as useUploadDropzone, v as UNSPLASH_URL, b as ImageDirectUpload } from './utils-BjNaSuOu.js';
|
|
14
14
|
import { u as useImageUploader, a as useCreateBlob, g as generateASCIIFileName } from './useImageUploader-BhXn2rPO.js';
|
|
15
15
|
import { I as IS_DEVELOPMENT_OR_HEROKU_ENV, C as CLOUD_FLARE } from './index-1joql7CE.js';
|
|
16
16
|
import classnames from 'classnames';
|
|
@@ -523,7 +523,7 @@ var Controls = withT(function (_ref) {
|
|
|
523
523
|
})]
|
|
524
524
|
}), /*#__PURE__*/jsx(Button, {
|
|
525
525
|
className: "mt-6 self-start",
|
|
526
|
-
"data-
|
|
526
|
+
"data-testid": "neeto-image-uploader-crop-submit-button",
|
|
527
527
|
label: t("neetoImageUploader.labels.done"),
|
|
528
528
|
disabled: isNilOrEmpty(imageRef.current) && (crop.width <= 0 || crop.height <= 0),
|
|
529
529
|
onClick: handleSubmit
|
|
@@ -700,6 +700,14 @@ var useImageControls = function useImageControls(_ref) {
|
|
|
700
700
|
var imageWidth = image.naturalWidth,
|
|
701
701
|
imageHeight = image.naturalHeight;
|
|
702
702
|
var maxCropWidth = (_defaultImageSize$wid = defaultImageSize.width) !== null && _defaultImageSize$wid !== void 0 ? _defaultImageSize$wid : imageWidth;
|
|
703
|
+
var aspectRatio = getAspectRatio({
|
|
704
|
+
fixedAspectRatio: fixedAspectRatio,
|
|
705
|
+
imageSize: {
|
|
706
|
+
width: imageWidth,
|
|
707
|
+
height: imageHeight
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
var aspectRatioFactor = aspectRatio.width / aspectRatio.height;
|
|
703
711
|
var _getInitialCropSize = getInitialCropSize({
|
|
704
712
|
image: image,
|
|
705
713
|
aspectRatioFactor: aspectRatioFactor,
|
|
@@ -711,8 +719,10 @@ var useImageControls = function useImageControls(_ref) {
|
|
|
711
719
|
cropWidth: cropWidth,
|
|
712
720
|
cropHeight: cropHeight,
|
|
713
721
|
width: imageWidth,
|
|
714
|
-
height: imageHeight
|
|
722
|
+
height: imageHeight,
|
|
723
|
+
aspectRatio: aspectRatioFactor
|
|
715
724
|
});
|
|
725
|
+
setAspectRatio(aspectRatio);
|
|
716
726
|
setCrop(crop);
|
|
717
727
|
setHeight(getPixels(crop.height, imageHeight));
|
|
718
728
|
setWidth(getPixels(crop.width, imageWidth));
|
|
@@ -815,7 +825,7 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
815
825
|
className: "flex h-full flex-col gap-4 px-8 py-12",
|
|
816
826
|
children: [/*#__PURE__*/jsx(Button, {
|
|
817
827
|
className: "self-start",
|
|
818
|
-
"data-
|
|
828
|
+
"data-testid": "image-editor-back-button",
|
|
819
829
|
icon: LeftArrow,
|
|
820
830
|
iconPosition: "left",
|
|
821
831
|
style: "text",
|
|
@@ -840,12 +850,12 @@ var ImageEditor = function ImageEditor(_ref) {
|
|
|
840
850
|
onComplete: handleCropChange,
|
|
841
851
|
children: [/*#__PURE__*/jsx("img", {
|
|
842
852
|
alt: t("neetoImageUploader.common.image"),
|
|
843
|
-
"data-
|
|
853
|
+
"data-testid": "image-editor-uploaded-image",
|
|
844
854
|
ref: imageRef,
|
|
845
855
|
src: image === null || image === void 0 ? void 0 : image.url,
|
|
846
856
|
onLoad: handleImageLoad
|
|
847
857
|
}), /*#__PURE__*/jsxs(Typography, {
|
|
848
|
-
className: "neeto-ui-typography neeto-ui-text-nano neeto-ui-bg-gray-500 absolute bottom-0
|
|
858
|
+
className: "neeto-ui-typography neeto-ui-text-nano neeto-ui-bg-gray-500 absolute bottom-0 end-0 z-10",
|
|
849
859
|
style: "nano",
|
|
850
860
|
children: [imageWidth, "x", imageHeight]
|
|
851
861
|
})]
|
|
@@ -1866,7 +1876,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1866
1876
|
children: /*#__PURE__*/jsx(Spinner, {})
|
|
1867
1877
|
});
|
|
1868
1878
|
return /*#__PURE__*/jsxs("div", {
|
|
1869
|
-
className: "niu-unsplash-container
|
|
1879
|
+
className: "niu-unsplash-container me-2 max-w-full overflow-x-hidden overflow-y-scroll",
|
|
1870
1880
|
children: [/*#__PURE__*/jsx(_default, {
|
|
1871
1881
|
hasMore: hasMore,
|
|
1872
1882
|
loadMore: loadMore,
|
|
@@ -1880,7 +1890,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1880
1890
|
children: images.map(function (image, index) {
|
|
1881
1891
|
var _image$urls, _image$user, _image$user2;
|
|
1882
1892
|
return /*#__PURE__*/jsx("div", {
|
|
1883
|
-
className: "float-
|
|
1893
|
+
className: "float-start w-1/2 pb-4 pe-4 md:w-1/4",
|
|
1884
1894
|
children: /*#__PURE__*/jsx("div", {
|
|
1885
1895
|
className: "relative w-full",
|
|
1886
1896
|
style: {
|
|
@@ -1888,17 +1898,17 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1888
1898
|
},
|
|
1889
1899
|
children: /*#__PURE__*/jsxs("div", {
|
|
1890
1900
|
className: "neeto-ui-rounded-sm neeto-ui-bg-gray-100 group absolute h-full w-full",
|
|
1891
|
-
"data-
|
|
1901
|
+
"data-testid": "library-image-card",
|
|
1892
1902
|
id: "unsplashImage".concat(image.id),
|
|
1893
1903
|
children: [tab === TABS[2].key && /*#__PURE__*/jsxs(Fragment, {
|
|
1894
1904
|
children: [/*#__PURE__*/jsx("img", {
|
|
1895
|
-
"data-
|
|
1905
|
+
"data-testid": "niu-unsplash-image-".concat(index),
|
|
1896
1906
|
src: image === null || image === void 0 || (_image$urls = image.urls) === null || _image$urls === void 0 ? void 0 : _image$urls.regular,
|
|
1897
1907
|
onClick: function onClick() {
|
|
1898
1908
|
return handleUnsplashImageSelect(image);
|
|
1899
1909
|
}
|
|
1900
1910
|
}), /*#__PURE__*/jsxs("a", {
|
|
1901
|
-
className: "neeto-ui-text-gray-100 absolute bottom-2
|
|
1911
|
+
className: "neeto-ui-text-gray-100 absolute bottom-2 start-2 m-auto text-xs underline opacity-0 group-hover:opacity-100",
|
|
1902
1912
|
href: "https://unsplash.com/@".concat(image === null || image === void 0 || (_image$user = image.user) === null || _image$user === void 0 ? void 0 : _image$user.username),
|
|
1903
1913
|
rel: "noreferrer",
|
|
1904
1914
|
target: "_blank",
|
|
@@ -1908,16 +1918,16 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1908
1918
|
children: [hasPermission(VIEW_ROLES_PERMISSION) && isMenuButtonEnabled && /*#__PURE__*/jsx(Dropdown, {
|
|
1909
1919
|
buttonSize: "small",
|
|
1910
1920
|
buttonStyle: "tertiary",
|
|
1911
|
-
"data-
|
|
1921
|
+
"data-testid": "image-library-image-options-".concat(index),
|
|
1912
1922
|
icon: MenuHorizontal,
|
|
1913
1923
|
buttonProps: {
|
|
1914
1924
|
className:
|
|
1915
1925
|
// eslint-disable-next-line @bigbinary/neeto/use-neetoui-classes
|
|
1916
|
-
"absolute
|
|
1926
|
+
"absolute end-2 top-2 z-1 rounded-full"
|
|
1917
1927
|
},
|
|
1918
1928
|
children: /*#__PURE__*/jsx(Menu, {
|
|
1919
1929
|
children: /*#__PURE__*/jsx(MenuItem.Button, {
|
|
1920
|
-
"data-
|
|
1930
|
+
"data-testid": "image-library-image-delete",
|
|
1921
1931
|
onClick: function onClick() {
|
|
1922
1932
|
return setDeleteConfirmation({
|
|
1923
1933
|
isOpen: true,
|
|
@@ -1928,7 +1938,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
|
|
|
1928
1938
|
})
|
|
1929
1939
|
})
|
|
1930
1940
|
}), /*#__PURE__*/jsx("img", {
|
|
1931
|
-
"data-
|
|
1941
|
+
"data-testid": "niu-library-image-".concat(index),
|
|
1932
1942
|
src: image === null || image === void 0 ? void 0 : image.url,
|
|
1933
1943
|
onClick: function onClick() {
|
|
1934
1944
|
return setSelectedImage(image);
|
|
@@ -2153,7 +2163,7 @@ var ImageLibrary = function ImageLibrary(_ref) {
|
|
|
2153
2163
|
children: [/*#__PURE__*/jsx(Input, {
|
|
2154
2164
|
autoFocus: true,
|
|
2155
2165
|
className: "mb-4",
|
|
2156
|
-
"data-
|
|
2166
|
+
"data-testid": "niu-unsplash-image-picker-search-input",
|
|
2157
2167
|
name: "text",
|
|
2158
2168
|
placeholder: inputPlaceHolder,
|
|
2159
2169
|
value: query,
|
|
@@ -2339,7 +2349,7 @@ var Modal = function Modal(_ref) {
|
|
|
2339
2349
|
children: TABS.map(function (tab) {
|
|
2340
2350
|
return /*#__PURE__*/jsx(Tab.Item, {
|
|
2341
2351
|
active: activeTab === tab.key,
|
|
2342
|
-
"data-
|
|
2352
|
+
"data-testid": tab.dataTestid,
|
|
2343
2353
|
onClick: function onClick() {
|
|
2344
2354
|
return setActiveTab(tab.key);
|
|
2345
2355
|
},
|
|
@@ -2368,4 +2378,4 @@ var Modal = function Modal(_ref) {
|
|
|
2368
2378
|
};
|
|
2369
2379
|
|
|
2370
2380
|
export { Modal as M, constructCloudflareImageURL as c };
|
|
2371
|
-
//# sourceMappingURL=index-
|
|
2381
|
+
//# sourceMappingURL=index-oS3UYUfo.js.map
|