kui-crm 0.0.285 → 0.0.287

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/cjs/index.js CHANGED
@@ -3852,12 +3852,14 @@ var AdaptiveImagesBlock = React.forwardRef(function (props) {
3852
3852
  var _b = kuiUtils.useToggle(), isModalOpen = _b[0], handleModalOpen = _b[1], handleModalClose = _b[2];
3853
3853
  var _c = React.useState(0), displayedCardsCount = _c[0], setDisplayedCardsCount = _c[1];
3854
3854
  var staticCards = endComponent ? 1 : 0;
3855
+ if (onAdd) {
3856
+ staticCards += 1;
3857
+ }
3855
3858
  var blurImage = images.slice(displayedCardsCount - staticCards, displayedCardsCount - staticCards + 1);
3856
3859
  var displayedImagesCount = displayedCardsCount - staticCards - blurImage.length;
3857
3860
  var displayedImages = images.slice(0, displayedImagesCount);
3858
3861
  var notDisplayedImagesCount = images.slice(displayedImagesCount).length;
3859
- var withFlatWidth = displayedImages.length + staticCards + blurImage.length >=
3860
- displayedCardsCount;
3862
+ var stretchToFullWidth = displayedImages.length >= displayedImagesCount;
3861
3863
  var realImageWidth = imageWidth || defaultImageWidth;
3862
3864
  var handleClick = function (index) {
3863
3865
  setSelectedImage(index);
@@ -3868,14 +3870,17 @@ var AdaptiveImagesBlock = React.forwardRef(function (props) {
3868
3870
  var _a;
3869
3871
  var isMobile = window.innerWidth <= 900;
3870
3872
  var blockWidth = Number((_a = ref.current) === null || _a === void 0 ? void 0 : _a.clientWidth);
3871
- var maxDisplayedImagesCount = Math.floor(blockWidth / (isMobile ? mobileWidth || realImageWidth : realImageWidth));
3873
+ var imageRealWidth = isMobile
3874
+ ? mobileWidth || realImageWidth
3875
+ : realImageWidth;
3876
+ var maxDisplayedImagesCount = Math.floor((blockWidth + 8) / (imageRealWidth + 8));
3872
3877
  setDisplayedCardsCount(maxDisplayedImagesCount);
3873
3878
  }, 16);
3874
3879
  window.addEventListener("resize", handleResize);
3875
3880
  handleResize();
3876
3881
  return function () { return window.removeEventListener("resize", handleResize); };
3877
3882
  }, [ref]);
3878
- return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Wrapper$1, __assign({ container: true, ref: ref, spacing: 1, justify: withFlatWidth ? "space-between" : "flex-start" }, otherProps, { children: [onAdd && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(StyledButton$4, __assign({ isCircle: true, size: "l", variant: "grayLight", onClick: onAdd, disabled: disabled }, { children: jsxRuntime.jsx(kuiIcon.PlusIcon, { width: 18, height: 18 }) })) }))), displayedImages.map(function (image, index) { return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCard, { url: image.smallImageUrl, index: index, onClick: handleClick, width: realImageWidth, mobileWidth: mobileWidth, onDelete: onDelete }) }), image.smallImageUrl)); }), !!blurImage.length && !!notDisplayedImagesCount && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCardWithBackdrop, { url: blurImage[0].smallImageUrl, count: notDisplayedImagesCount, index: displayedImages.length, onClick: handleClick, width: realImageWidth, mobileWidth: mobileWidth }) }))), blurImage.length > 0 && notDisplayedImagesCount === 0 && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCard, { url: blurImage[0].smallImageUrl, index: displayedImages.length, onClick: handleClick, width: realImageWidth, mobileWidth: mobileWidth, onDelete: onDelete }) }))), endComponent] })), jsxRuntime.jsx(GalleryWithThumbnails, { images: images, activeSlide: selectedImage, isOpen: isModalOpen, handleClose: handleModalClose, onDelete: onDelete })] }));
3883
+ return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Wrapper$1, __assign({ container: true, ref: ref, spacing: 1, justify: stretchToFullWidth ? "space-between" : "flex-start" }, otherProps, { children: [onAdd && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(StyledButton$4, __assign({ isCircle: true, size: "l", variant: "grayLight", onClick: onAdd, disabled: disabled }, { children: jsxRuntime.jsx(kuiIcon.PlusIcon, { width: 18, height: 18 }) })) }))), displayedImages.map(function (image, index) { return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCard, { url: image.smallImageUrl, index: index, onClick: handleClick, width: realImageWidth, mobileWidth: mobileWidth, onDelete: onDelete }) }), image.smallImageUrl)); }), !!blurImage.length && !!notDisplayedImagesCount && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCardWithBackdrop, { url: blurImage[0].smallImageUrl, count: notDisplayedImagesCount, index: displayedImages.length, onClick: handleClick, width: realImageWidth, mobileWidth: mobileWidth }) }))), blurImage.length > 0 && notDisplayedImagesCount === 0 && (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCard, { url: blurImage[0].smallImageUrl, index: displayedImages.length, onClick: handleClick, width: realImageWidth, mobileWidth: mobileWidth, onDelete: onDelete }) }))), endComponent] })), jsxRuntime.jsx(GalleryWithThumbnails, { images: images, activeSlide: selectedImage, isOpen: isModalOpen, handleClose: handleModalClose, onDelete: onDelete })] }));
3879
3884
  });
3880
3885
  var Wrapper$1 = styled__default["default"](kuiBasic.Grid)(templateObject_1$o || (templateObject_1$o = __makeTemplateObject(["\n overflow: hidden;\n flex-wrap: nowrap;\n"], ["\n overflow: hidden;\n flex-wrap: nowrap;\n"])));
3881
3886
  var StyledButton$4 = styled__default["default"](kuiBasic.Button)(templateObject_2$f || (templateObject_2$f = __makeTemplateObject(["\n border-radius: 8px;\n box-shadow: none !important;\n"], ["\n border-radius: 8px;\n box-shadow: none !important;\n"])));