@bigbinary/neeto-image-uploader-frontend 1.5.22 → 1.5.24

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/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo, useRef, useReducer, useEffect, useCallback, forwardRef, useImperativeHandle, Fragment, useState } from 'react';
2
2
  import classnames from 'classnames';
3
- import { noop as noop$1, keysToCamelCase, findBy } from '@bigbinary/neeto-cist';
3
+ import { noop as noop$1, keysToCamelCase, findBy, isPresent } from '@bigbinary/neeto-cist';
4
4
  import { Delete, LeftArrow, MenuHorizontal } from '@bigbinary/neeto-icons';
5
5
  import { Toastr, Typography, Button, Switch, Input, Spinner, Modal as Modal$1, Tab, Dropdown } from '@bigbinary/neetoui';
6
6
  import { pipe, values, flatten as flatten$1, map, toUpper, join, equals, isNil, isEmpty, mergeRight, mergeLeft, concat, __, inc, mergeDeepRight } from 'ramda';
@@ -1035,7 +1035,7 @@ function isExt(v) {
1035
1035
  * @typedef {"file-invalid-type"|"file-too-large"|"file-too-small"|"too-many-files"} ErrorCode
1036
1036
  */
1037
1037
 
1038
- var _excluded$3 = ["children"],
1038
+ var _excluded$5 = ["children"],
1039
1039
  _excluded2 = ["open"],
1040
1040
  _excluded3 = ["refKey", "role", "onKeyDown", "onFocus", "onBlur", "onClick", "onDragEnter", "onDragOver", "onDragLeave", "onDrop"],
1041
1041
  _excluded4 = ["refKey", "onChange", "onClick"];
@@ -1086,7 +1086,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
1086
1086
 
1087
1087
  var Dropzone = /*#__PURE__*/forwardRef(function (_ref, ref) {
1088
1088
  var children = _ref.children,
1089
- params = _objectWithoutProperties$1(_ref, _excluded$3);
1089
+ params = _objectWithoutProperties$1(_ref, _excluded$5);
1090
1090
 
1091
1091
  var _useDropzone = useDropzone(params),
1092
1092
  open = _useDropzone.open,
@@ -2058,6 +2058,7 @@ var ProgressBar = function ProgressBar(_ref) {
2058
2058
  className: "neeto-ui-bg-gray-200 neeto-ui-rounded-full w-full overflow-hidden dark:bg-gray-700"
2059
2059
  }, /*#__PURE__*/React.createElement("div", {
2060
2060
  className: "neeto-ui-bg-primary-600 text-2xs neeto-ui-text-primary-100 neeto-ui-rounded-full flex h-3 animate-pulse items-center justify-center font-medium leading-none transition-all duration-300 ease-in-out",
2061
+ "data-cy": "neeto-image-uploader-progress-bar",
2061
2062
  style: {
2062
2063
  width: "".concat(progressPercentage, "%")
2063
2064
  }
@@ -2091,7 +2092,7 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
2091
2092
  })
2092
2093
  }), /*#__PURE__*/React.createElement("div", {
2093
2094
  className: "flex flex-col space-y-1"
2094
- }, /*#__PURE__*/React.createElement(Typography, {
2095
+ }, !isDisabled && /*#__PURE__*/React.createElement(Typography, {
2095
2096
  className: "neeto-ui-text-gray-800 text-center leading-4",
2096
2097
  style: "body2"
2097
2098
  }, /*#__PURE__*/React.createElement(Trans, {
@@ -2122,6 +2123,7 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
2122
2123
  disabled: isDisabled
2123
2124
  })), /*#__PURE__*/React.createElement(Typography, {
2124
2125
  className: "neeto-ui-text-gray-700 text-center leading-4",
2126
+ "data-cy": "neeto-image-uploader-restriction-message",
2125
2127
  lineHeight: "snug",
2126
2128
  style: "nano"
2127
2129
  }, /*#__PURE__*/React.createElement(Trans, {
@@ -2133,17 +2135,17 @@ var ImageDirectUpload = function ImageDirectUpload(_ref) {
2133
2135
  }))));
2134
2136
  };
2135
2137
 
2136
- var _excluded$2 = ["className"];
2138
+ var _excluded$4 = ["className"];
2137
2139
  var ImagePlaceholder = function ImagePlaceholder(_ref) {
2138
2140
  var _ref$className = _ref.className,
2139
2141
  className = _ref$className === void 0 ? "" : _ref$className,
2140
- props = _objectWithoutProperties$2(_ref, _excluded$2);
2142
+ props = _objectWithoutProperties$2(_ref, _excluded$4);
2141
2143
  return /*#__PURE__*/React.createElement("div", _extends$1({
2142
2144
  className: classnames("neeto-ui-bg-gray-200", _defineProperty$3({}, className, className))
2143
2145
  }, props));
2144
2146
  };
2145
2147
 
2146
- var _excluded$1 = ["src", "className", "fallback"];
2148
+ var _excluded$3 = ["src", "className", "fallback"];
2147
2149
  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; }
2148
2150
  function _objectSpread$2(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$3(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; }
2149
2151
  var ImageWithFallback = function ImageWithFallback(_ref) {
@@ -2152,7 +2154,7 @@ var ImageWithFallback = function ImageWithFallback(_ref) {
2152
2154
  className = _ref$className === void 0 ? "h-full w-full" : _ref$className,
2153
2155
  _ref$fallback = _ref.fallback,
2154
2156
  Fallback = _ref$fallback === void 0 ? ImagePlaceholder : _ref$fallback,
2155
- props = _objectWithoutProperties$2(_ref, _excluded$1);
2157
+ props = _objectWithoutProperties$2(_ref, _excluded$3);
2156
2158
  var _useState = useState(false),
2157
2159
  _useState2 = _slicedToArray$2(_useState, 2),
2158
2160
  isLoaded = _useState2[0],
@@ -2187,10 +2189,12 @@ var UNSPLASH_DEFAULT_REQUEST_CONFIG = {
2187
2189
  };
2188
2190
  var TABS = [{
2189
2191
  label: i18next.t("neetoImageUploader.labels.myImages"),
2190
- key: "images"
2192
+ key: "images",
2193
+ dataCy: "neeto-image-uploader-my-images-tab"
2191
2194
  }, {
2192
2195
  label: i18next.t("neetoImageUploader.labels.searchTheWeb"),
2193
- key: "unsplash"
2196
+ key: "unsplash",
2197
+ dataCy: "neeto-image-uploader-unsplash-tab"
2194
2198
  }];
2195
2199
  var OPTIONS = [{
2196
2200
  key: "local",
@@ -2827,11 +2831,12 @@ var isNotNilOrEmpty = function isNotNilOrEmpty(value) {
2827
2831
  };
2828
2832
  var onImageLoaded = function onImageLoaded(_ref3) {
2829
2833
  var image = _ref3.image,
2830
- setCrop = _ref3.setCrop;
2834
+ setCrop = _ref3.setCrop,
2835
+ _ref3$cropAspectRatio = _ref3.cropAspectRatio,
2836
+ cropAspectRatio = _ref3$cropAspectRatio === void 0 ? 16 / 9 : _ref3$cropAspectRatio;
2831
2837
  var width = image.width,
2832
2838
  height = image.height;
2833
2839
  var imageAspectRatio = width / height;
2834
- var cropAspectRatio = 16 / 9;
2835
2840
  var maxCropWidth = 250;
2836
2841
  var maxCropHeight = maxCropWidth / cropAspectRatio;
2837
2842
  var cropWidth, cropHeight;
@@ -2873,7 +2878,7 @@ var isItemsCenter = function isItemsCenter(_ref4) {
2873
2878
  return imageHeight > imageWidth && imageHeight < wrapperHeight - 1;
2874
2879
  };
2875
2880
 
2876
- var _excluded = ["src", "className", "imageFallbackProps", "onDrop", "isDisabled", "onRemove"];
2881
+ var _excluded$2 = ["src", "className", "imageFallbackProps", "onDrop", "isDisabled", "onRemove"];
2877
2882
  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; }
2878
2883
  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$3(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; }
2879
2884
  var BasicImageUploader = function BasicImageUploader(_ref) {
@@ -2892,7 +2897,7 @@ var BasicImageUploader = function BasicImageUploader(_ref) {
2892
2897
  isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
2893
2898
  _ref$onRemove = _ref.onRemove,
2894
2899
  onRemove = _ref$onRemove === void 0 ? noop$1 : _ref$onRemove,
2895
- props = _objectWithoutProperties$2(_ref, _excluded);
2900
+ props = _objectWithoutProperties$2(_ref, _excluded$2);
2896
2901
  return /*#__PURE__*/React.createElement("div", {
2897
2902
  className: classnames(className, {
2898
2903
  "cursor-pointer": true,
@@ -3624,7 +3629,9 @@ var Controls = function Controls(_ref) {
3624
3629
  setCrop = _ref.setCrop,
3625
3630
  imageRef = _ref.imageRef,
3626
3631
  isFullImage = _ref.isFullImage,
3627
- setIsFullImage = _ref.setIsFullImage;
3632
+ setIsFullImage = _ref.setIsFullImage,
3633
+ _ref$hideControls = _ref.hideControls,
3634
+ hideControls = _ref$hideControls === void 0 ? false : _ref$hideControls;
3628
3635
  var _useTranslation = useTranslation(),
3629
3636
  t = _useTranslation.t;
3630
3637
  var _useState = useState(crop.height.toFixed(0)),
@@ -3665,7 +3672,7 @@ var Controls = function Controls(_ref) {
3665
3672
  }, [crop]);
3666
3673
  return /*#__PURE__*/React.createElement("div", {
3667
3674
  className: "flex flex-col p-4 md:w-2/6 "
3668
- }, /*#__PURE__*/React.createElement(Switch, {
3675
+ }, !hideControls && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Switch, {
3669
3676
  checked: isFullImage,
3670
3677
  className: "flex-grow-0",
3671
3678
  label: t("neetoImageUploader.labels.selectOriginalImage"),
@@ -3683,21 +3690,23 @@ var Controls = function Controls(_ref) {
3683
3690
  }), /*#__PURE__*/React.createElement(Typography, {
3684
3691
  className: "mb-2 mt-6",
3685
3692
  style: "body2"
3686
- }, t("neetoImageUploader.imageEditor.aspetRatio")), /*#__PURE__*/React.createElement("div", {
3693
+ }, t("neetoImageUploader.imageEditor.aspectRatio")), /*#__PURE__*/React.createElement("div", {
3687
3694
  className: "flex gap-4 self-start"
3688
3695
  }, /*#__PURE__*/React.createElement(Input, {
3696
+ "data-cy": "aspect-ratio-width-input",
3689
3697
  disabled: isFullImage,
3690
3698
  size: "small",
3691
3699
  type: "number",
3692
3700
  value: aspectRatio.width,
3693
3701
  onChange: withEventTargetValue(handleAspectWidthChange)
3694
3702
  }), /*#__PURE__*/React.createElement(Typography, null, " : "), /*#__PURE__*/React.createElement(Input, {
3703
+ "data-cy": "aspect-ratio-height-input",
3695
3704
  disabled: isFullImage,
3696
3705
  size: "small",
3697
3706
  type: "number",
3698
3707
  value: aspectRatio.height,
3699
3708
  onChange: withEventTargetValue(handleAspectHeightChange)
3700
- })), /*#__PURE__*/React.createElement(Input, {
3709
+ }))), /*#__PURE__*/React.createElement(Input, {
3701
3710
  className: "mt-4 flex-grow-0",
3702
3711
  disabled: isFullImage,
3703
3712
  label: t("neetoImageUploader.labels.width"),
@@ -3713,6 +3722,7 @@ var Controls = function Controls(_ref) {
3713
3722
  onChange: withEventTargetValue(setHeight)
3714
3723
  }), /*#__PURE__*/React.createElement(Button, {
3715
3724
  className: "mt-6 self-start",
3725
+ "data-cy": "neeto-image-uploader-crop-submit-button",
3716
3726
  label: t("neetoImageUploader.labels.done"),
3717
3727
  disabled: isNilOrEmpty(imageRef.current) && (crop.width <= 0 || crop.height <= 0),
3718
3728
  onClick: handleSubmit
@@ -3725,7 +3735,9 @@ var ImageEditor = function ImageEditor(_ref) {
3725
3735
  _ref$handleImageEditC = _ref.handleImageEditComplete,
3726
3736
  handleImageEditComplete = _ref$handleImageEditC === void 0 ? noop$1 : _ref$handleImageEditC,
3727
3737
  _ref$signedId = _ref.signedId,
3728
- signedId = _ref$signedId === void 0 ? "" : _ref$signedId;
3738
+ signedId = _ref$signedId === void 0 ? "" : _ref$signedId,
3739
+ _ref$fixedAspectRatio = _ref.fixedAspectRatio,
3740
+ fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
3729
3741
  var _useState = useState(true),
3730
3742
  _useState2 = _slicedToArray$2(_useState, 2),
3731
3743
  isAspectRatioLocked = _useState2[0],
@@ -3735,8 +3747,8 @@ var ImageEditor = function ImageEditor(_ref) {
3735
3747
  isFullImage = _useState4[0],
3736
3748
  setIsFullImage = _useState4[1];
3737
3749
  var _useState5 = useState({
3738
- width: 16,
3739
- height: 9
3750
+ width: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) || 16,
3751
+ height: (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height) || 9
3740
3752
  }),
3741
3753
  _useState6 = _slicedToArray$2(_useState5, 2),
3742
3754
  aspectRatio = _useState6[0],
@@ -3751,6 +3763,7 @@ var ImageEditor = function ImageEditor(_ref) {
3751
3763
  cropImage = _useCropImage.mutate;
3752
3764
  var imageRef = useRef(null);
3753
3765
  var wrapperRef = useRef(null);
3766
+ var cropAspectRatio = isPresent(fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) && isPresent(fixedAspectRatio.height) ? (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.width) / (fixedAspectRatio === null || fixedAspectRatio === void 0 ? void 0 : fixedAspectRatio.height) : 16 / 9;
3754
3767
  var processCrop = function processCrop() {
3755
3768
  if (isFullImage) {
3756
3769
  handleImageEditComplete(image);
@@ -3788,12 +3801,13 @@ var ImageEditor = function ImageEditor(_ref) {
3788
3801
  className: "flex h-full flex-col gap-4 px-8 py-12"
3789
3802
  }, /*#__PURE__*/React.createElement(Button, {
3790
3803
  className: "self-start",
3804
+ "data-cy": "image-editor-back-button",
3791
3805
  icon: LeftArrow,
3792
3806
  iconPosition: "left",
3793
3807
  style: "text",
3794
3808
  onClick: handleReset
3795
3809
  }), /*#__PURE__*/React.createElement("div", {
3796
- className: "flex h-full w-full flex-col gap-2 overflow-y-scroll md:flex-row md:overflow-y-auto"
3810
+ className: "flex h-full w-full flex-col gap-2 overflow-y-scroll md:flex-row md:overflow-y-auto"
3797
3811
  }, /*#__PURE__*/React.createElement("div", {
3798
3812
  id: "imageEditor",
3799
3813
  ref: wrapperRef,
@@ -3811,12 +3825,14 @@ var ImageEditor = function ImageEditor(_ref) {
3811
3825
  onComplete: setCrop
3812
3826
  }, /*#__PURE__*/React.createElement("img", {
3813
3827
  alt: t("neetoImageUploader.common.image"),
3828
+ "data-cy": "image-editor-uploaded-image",
3814
3829
  ref: imageRef,
3815
3830
  src: image === null || image === void 0 ? void 0 : image.url,
3816
3831
  onLoad: function onLoad(e) {
3817
3832
  return onImageLoaded({
3818
3833
  image: e.target,
3819
- setCrop: setCrop
3834
+ setCrop: setCrop,
3835
+ cropAspectRatio: cropAspectRatio
3820
3836
  });
3821
3837
  }
3822
3838
  }))), /*#__PURE__*/React.createElement(Controls, {
@@ -3829,6 +3845,7 @@ var ImageEditor = function ImageEditor(_ref) {
3829
3845
  setAspectRatio: setAspectRatio,
3830
3846
  setCrop: setCrop,
3831
3847
  setIsFullImage: setIsFullImage,
3848
+ hideControls: isPresent(fixedAspectRatio),
3832
3849
  setAspectRatioLocked: setIsAspectRatioLocked
3833
3850
  })));
3834
3851
  };
@@ -4654,7 +4671,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
4654
4671
  sizes: INFINITE_SCROLLER_SIZES,
4655
4672
  style: INFINITE_SCROLLER_STYLE,
4656
4673
  useWindow: false
4657
- }, images.map(function (image) {
4674
+ }, images.map(function (image, index) {
4658
4675
  var _image$urls, _image$user, _image$user2;
4659
4676
  return /*#__PURE__*/React.createElement("div", {
4660
4677
  className: "float-left w-1/2 pb-4 pr-4 md:w-1/4",
@@ -4668,7 +4685,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
4668
4685
  className: "neeto-ui-rounded-sm neeto-ui-bg-gray-100 group absolute h-full w-full",
4669
4686
  id: "unsplashImage".concat(image.id)
4670
4687
  }, tab === TABS[1].key && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("img", {
4671
- "data-cy": "niu-library-image-".concat(image === null || image === void 0 ? void 0 : image.id),
4688
+ "data-cy": "niu-unsplash-image-".concat(index),
4672
4689
  src: image === null || image === void 0 || (_image$urls = image.urls) === null || _image$urls === void 0 ? void 0 : _image$urls.regular,
4673
4690
  onClick: function onClick() {
4674
4691
  return handleUnsplashImageSelect(image);
@@ -4679,7 +4696,7 @@ var InfiniteScroller = function InfiniteScroller(_ref) {
4679
4696
  rel: "noreferrer",
4680
4697
  target: "_blank"
4681
4698
  }, image === null || image === void 0 || (_image$user2 = image.user) === null || _image$user2 === void 0 ? void 0 : _image$user2.name, " | ", " ", t("neetoImageUploader.labels.unsplash"))), tab === TABS[0].key && /*#__PURE__*/React.createElement("img", {
4682
- "data-cy": "niu-library-image-".concat(image === null || image === void 0 ? void 0 : image.fileId),
4699
+ "data-cy": "niu-library-image-".concat(index),
4683
4700
  src: image === null || image === void 0 ? void 0 : image.url,
4684
4701
  onClick: function onClick() {
4685
4702
  return setSelectedImage(image);
@@ -5008,6 +5025,7 @@ var ImageLibrary = function ImageLibrary(_ref) {
5008
5025
  }));
5009
5026
  };
5010
5027
 
5028
+ var _excluded$1 = ["key"];
5011
5029
  var Modal = function Modal(_ref) {
5012
5030
  var isOpen = _ref.isOpen,
5013
5031
  _ref$onClose = _ref.onClose,
@@ -5015,7 +5033,9 @@ var Modal = function Modal(_ref) {
5015
5033
  _ref$onUploadComplete = _ref.onUploadComplete,
5016
5034
  onUploadComplete = _ref$onUploadComplete === void 0 ? noop$1 : _ref$onUploadComplete,
5017
5035
  _ref$uploadConfig = _ref.uploadConfig,
5018
- uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig;
5036
+ uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig,
5037
+ _ref$fixedAspectRatio = _ref.fixedAspectRatio,
5038
+ fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
5019
5039
  var _useState = useState(TABS[0].key),
5020
5040
  _useState2 = _slicedToArray$2(_useState, 2),
5021
5041
  activeTab = _useState2[0],
@@ -5098,6 +5118,7 @@ var Modal = function Modal(_ref) {
5098
5118
  }, /*#__PURE__*/React.createElement(Spinner, null)), isNilOrEmpty(selectedImage) && isDragActive && /*#__PURE__*/React.createElement("div", _extends$1({
5099
5119
  className: "neeto-ui-rounded-xl neeto-ui-bg-gray-400 absolute flex h-full w-full flex-col items-center justify-around border-4 border-dashed border-gray-900 opacity-40"
5100
5120
  }, getRootProps()), /*#__PURE__*/React.createElement(Typography, null, t("neetoImageUploader.common.dropHere"))), !isNilOrEmpty(selectedImage) ? /*#__PURE__*/React.createElement(ImageEditor, {
5121
+ fixedAspectRatio: fixedAspectRatio,
5101
5122
  handleImageEditComplete: handleImageEditComplete,
5102
5123
  handleReset: function handleReset() {
5103
5124
  return setSelectedImage({});
@@ -5123,6 +5144,7 @@ var Modal = function Modal(_ref) {
5123
5144
  }, TABS.map(function (tab) {
5124
5145
  return /*#__PURE__*/React.createElement(Tab.Item, {
5125
5146
  active: activeTab === tab.key,
5147
+ "data-cy": tab.dataCy,
5126
5148
  key: tab.key,
5127
5149
  onClick: function onClick() {
5128
5150
  return setActiveTab(tab.key);
@@ -5132,16 +5154,11 @@ var Modal = function Modal(_ref) {
5132
5154
  className: "flex gap-2"
5133
5155
  }, options.map(function (_ref2) {
5134
5156
  var key = _ref2.key,
5135
- label = _ref2.label,
5136
- onClick = _ref2.onClick,
5137
- style = _ref2.style;
5138
- return /*#__PURE__*/React.createElement(Button, {
5139
- label: label,
5140
- onClick: onClick,
5141
- style: style,
5157
+ otherProps = _objectWithoutProperties$2(_ref2, _excluded$1);
5158
+ return /*#__PURE__*/React.createElement(Button, _extends$1({}, otherProps, {
5142
5159
  key: key,
5143
5160
  size: "small"
5144
- });
5161
+ }));
5145
5162
  })))), /*#__PURE__*/React.createElement(ImageLibrary, {
5146
5163
  setActiveTab: setActiveTab,
5147
5164
  setIsUploading: setIsUploading,
@@ -5163,6 +5180,7 @@ var Modal = function Modal(_ref) {
5163
5180
  })))), /*#__PURE__*/React.createElement("input", getInputProps()));
5164
5181
  };
5165
5182
 
5183
+ var _excluded = ["key", "label"];
5166
5184
  var Menu = Dropdown.Menu,
5167
5185
  MenuItem = Dropdown.MenuItem;
5168
5186
  var ImageUploader = function ImageUploader(_ref) {
@@ -5173,7 +5191,9 @@ var ImageUploader = function ImageUploader(_ref) {
5173
5191
  _ref$src = _ref.src,
5174
5192
  src = _ref$src === void 0 ? "" : _ref$src,
5175
5193
  _ref$uploadConfig = _ref.uploadConfig,
5176
- uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig;
5194
+ uploadConfig = _ref$uploadConfig === void 0 ? {} : _ref$uploadConfig,
5195
+ _ref$fixedAspectRatio = _ref.fixedAspectRatio,
5196
+ fixedAspectRatio = _ref$fixedAspectRatio === void 0 ? {} : _ref$fixedAspectRatio;
5177
5197
  var _useState = useState(false),
5178
5198
  _useState2 = _slicedToArray$2(_useState, 2),
5179
5199
  isAssetLibraryOpen = _useState2[0],
@@ -5264,7 +5284,8 @@ var ImageUploader = function ImageUploader(_ref) {
5264
5284
  "cursor-pointer": true
5265
5285
  })
5266
5286
  }, isNotNilOrEmpty(image.url) ? /*#__PURE__*/React.createElement("div", {
5267
- className: IMAGE_WRAPPER_CLASSNAME
5287
+ className: IMAGE_WRAPPER_CLASSNAME,
5288
+ "data-cy": "image-uploader-wrapper"
5268
5289
  }, /*#__PURE__*/React.createElement(ImageWithFallback, {
5269
5290
  className: "h-full w-full",
5270
5291
  "data-cy": "uploaded-image",
@@ -5279,16 +5300,17 @@ var ImageUploader = function ImageUploader(_ref) {
5279
5300
  }, /*#__PURE__*/React.createElement(Menu, null, options.map(function (_ref2) {
5280
5301
  var key = _ref2.key,
5281
5302
  label = _ref2.label,
5282
- onClick = _ref2.onClick;
5283
- return /*#__PURE__*/React.createElement(MenuItem.Button, {
5284
- onClick: onClick,
5303
+ otherProps = _objectWithoutProperties$2(_ref2, _excluded);
5304
+ return /*#__PURE__*/React.createElement(MenuItem.Button, _extends$1({}, otherProps, {
5285
5305
  key: key
5286
- }, label);
5306
+ }), label);
5287
5307
  })))) : /*#__PURE__*/React.createElement(ImageDirectUpload, {
5288
5308
  setIsAssetLibraryOpen: setIsAssetLibraryOpen,
5309
+ isDisabled: isPresent(fixedAspectRatio),
5289
5310
  uploadConfig: uploadConfigWithDefaults,
5290
5311
  onDrop: uploadFile
5291
5312
  }), /*#__PURE__*/React.createElement(Modal, {
5313
+ fixedAspectRatio: fixedAspectRatio,
5292
5314
  isOpen: isAssetLibraryOpen,
5293
5315
  uploadConfig: uploadConfigWithDefaults,
5294
5316
  onClose: function onClose() {