kui-crm 0.0.66 → 0.0.67
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 +11 -8
- package/cjs/index.js.map +1 -1
- package/index.d.ts +3 -1
- package/index.js +11 -8
- package/index.js.map +1 -1
- package/package.json +1 -1
package/cjs/index.js
CHANGED
|
@@ -2670,16 +2670,17 @@ var StyledContainer = styled__default["default"].div(templateObject_2 || (templa
|
|
|
2670
2670
|
var StyledBackdrop = styled__default["default"].div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 56px;\n height: 56px;\n border-radius: 8px;\n background: rgba(0, 0, 0, 0.1);\n backdrop-filter: blur(4px);\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 56px;\n height: 56px;\n border-radius: 8px;\n background: rgba(0, 0, 0, 0.1);\n backdrop-filter: blur(4px);\n display: flex;\n justify-content: center;\n align-items: center;\n pointer-events: none;\n"])));
|
|
2671
2671
|
var templateObject_1$1, templateObject_2, templateObject_3;
|
|
2672
2672
|
|
|
2673
|
-
var
|
|
2673
|
+
var defaultImageWidth = 64;
|
|
2674
2674
|
var AdaptiveImagesBlock = React.forwardRef(function (props) {
|
|
2675
|
-
var images = props.images, endComponent = props.endComponent, onDelete = props.onDelete, otherProps = __rest(props, ["images", "endComponent", "onDelete"]);
|
|
2675
|
+
var images = props.images, endComponent = props.endComponent, onDelete = props.onDelete, imageWidth = props.imageWidth, otherProps = __rest(props, ["images", "endComponent", "onDelete", "imageWidth"]);
|
|
2676
2676
|
var ref = React.useRef(null);
|
|
2677
2677
|
var _a = React.useState(0), selectedImage = _a[0], setSelectedImage = _a[1];
|
|
2678
2678
|
var _b = kuiUtils.useToggle(), isModalOpen = _b[0], handleModalOpen = _b[1], handleModalClose = _b[2];
|
|
2679
|
-
var _c = React.useState(0),
|
|
2680
|
-
var staticCards = endComponent ?
|
|
2681
|
-
var
|
|
2682
|
-
var
|
|
2679
|
+
var _c = React.useState(0), displayedCardsCount = _c[0], setDisplayedCardsCount = _c[1];
|
|
2680
|
+
var staticCards = endComponent ? 1 : 0;
|
|
2681
|
+
var blurImage = images.slice(displayedCardsCount - staticCards, displayedCardsCount - staticCards + 1);
|
|
2682
|
+
var displayedImagesCount = displayedCardsCount - staticCards - blurImage.length;
|
|
2683
|
+
var displayedImages = images.slice(0, displayedImagesCount);
|
|
2683
2684
|
var notDisplayedImagesCount = images.slice(displayedImagesCount).length;
|
|
2684
2685
|
var handleClick = function (index) {
|
|
2685
2686
|
setSelectedImage(index);
|
|
@@ -2688,13 +2689,15 @@ var AdaptiveImagesBlock = React.forwardRef(function (props) {
|
|
|
2688
2689
|
React.useEffect(function () {
|
|
2689
2690
|
var handleResize = ___default["default"].debounce(function () {
|
|
2690
2691
|
var _a;
|
|
2691
|
-
|
|
2692
|
+
var blockWidth = Number((_a = ref.current) === null || _a === void 0 ? void 0 : _a.clientWidth);
|
|
2693
|
+
var maxDisplayedImagesCount = Math.floor(blockWidth / (imageWidth || defaultImageWidth));
|
|
2694
|
+
setDisplayedCardsCount(maxDisplayedImagesCount);
|
|
2692
2695
|
}, 16);
|
|
2693
2696
|
window.addEventListener("resize", handleResize);
|
|
2694
2697
|
handleResize();
|
|
2695
2698
|
return function () { return window.removeEventListener("resize", handleResize); };
|
|
2696
2699
|
}, [ref]);
|
|
2697
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Wrapper, __assign({ container: true, ref: ref, spacing: 1, justify: "space-between" }, otherProps, { children: [displayedImages.map(function (image, index) { return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCard, { url: image.smallImageUrl, index: index, onClick: handleClick }) }), image.smallImageUrl)); }), blurImage.length
|
|
2700
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs(Wrapper, __assign({ container: true, ref: ref, spacing: 1, justify: blurImage.length ? "space-between" : "flex-start" }, otherProps, { children: [displayedImages.map(function (image, index) { return (jsxRuntime.jsx(kuiBasic.Grid, __assign({ item: true }, { children: jsxRuntime.jsx(ImageCard, { url: image.smallImageUrl, index: index, onClick: handleClick }) }), 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 }) }))), 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 }) }))), endComponent] })), jsxRuntime.jsx(GalleryWithThumbnails, { images: images, activeSlide: selectedImage, isOpen: isModalOpen, handleClose: handleModalClose, onDelete: onDelete })] }));
|
|
2698
2701
|
});
|
|
2699
2702
|
var Wrapper = styled__default["default"](kuiBasic.Grid)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n overflow: hidden;\n flex-wrap: nowrap;\n"], ["\n overflow: hidden;\n flex-wrap: nowrap;\n"])));
|
|
2700
2703
|
var templateObject_1;
|