@trafilea/afrodita-components 6.17.0 → 6.17.1
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/build/index.esm.js +21 -23
- package/build/index.esm.js.map +1 -1
- package/build/index.js +21 -23
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -11871,7 +11871,7 @@ var ImagePreviewList = function (_a) {
|
|
|
11871
11871
|
arrowWidth: 0.75,
|
|
11872
11872
|
arrowHeight: 1.25,
|
|
11873
11873
|
arrowPadding: 1.625,
|
|
11874
|
-
}, adaptiveHeight: true, dots: false, slidesToShow: 4 }, { children: images.map(function (item, index) { return (jsx$1(Button$6, __assign$1({ onClick: function () { return onClick(
|
|
11874
|
+
}, adaptiveHeight: true, dots: false, slidesToShow: 4 }, { children: images.map(function (item, index) { return (jsx$1(Button$6, __assign$1({ onClick: function () { return onClick(index); } }, { children: jsx$1(ImageSmallPreview, { imageUrl: (item === null || item === void 0 ? void 0 : item.alt.includes('-video')) ? item === null || item === void 0 ? void 0 : item.thumbnailUrl : item === null || item === void 0 ? void 0 : item.url, alt: item.alt, selected: item.key === selectedImage.key, borderRadiusVariant: borderRadiusVariant, previewImgBorderColor: previewImgBorderColor }, void 0) }), item.key)); }) }), void 0) }), void 0)) : (images.map(function (item, index) { return (jsx$1(Button$6, __assign$1({ onClick: function () { return onClick(index); } }, { children: jsx$1(ImageSmallPreview, { imageUrl: (item === null || item === void 0 ? void 0 : item.alt.includes('-video')) ? item === null || item === void 0 ? void 0 : item.thumbnailUrl : item === null || item === void 0 ? void 0 : item.url, alt: item.alt, selected: item.key === selectedImage.key, borderRadiusVariant: borderRadiusVariant, previewImgBorderColor: previewImgBorderColor }, void 0) }), item.key)); })) }), void 0), hasOverflowArrows && (jsxs$1(ArrowsContainer, __assign$1({ role: "navigation" }, { children: [jsx$1(ArrowPrev, { onClick: handleScrollVerticalPrev }, void 0), jsx$1(ArrowNext, { onClick: handleScrollVerticalNext }, void 0)] }), void 0))] }, void 0));
|
|
11875
11875
|
};
|
|
11876
11876
|
|
|
11877
11877
|
var propTypes = {exports: {}};
|
|
@@ -13556,33 +13556,31 @@ var ImageProductSlide$1 = function (_a) {
|
|
|
13556
13556
|
var Container$I = newStyled.div(templateObject_1$W || (templateObject_1$W = __makeTemplateObject(["\n display: grid;\n grid-template-columns: minmax(6rem, max-content) 1fr;\n grid-column-gap: 20px;\n max-height: 50rem;\n width: 100%;\n"], ["\n display: grid;\n grid-template-columns: minmax(6rem, max-content) 1fr;\n grid-column-gap: 20px;\n max-height: 50rem;\n width: 100%;\n"])));
|
|
13557
13557
|
var templateObject_1$W;
|
|
13558
13558
|
|
|
13559
|
-
var
|
|
13560
|
-
|
|
13561
|
-
|
|
13562
|
-
|
|
13559
|
+
var getInitialIndex = function (images, selectedValue) {
|
|
13560
|
+
if (selectedValue) {
|
|
13561
|
+
var index = images.indexOf(selectedValue);
|
|
13562
|
+
return index > -1 ? index : 0;
|
|
13563
13563
|
}
|
|
13564
|
-
|
|
13565
|
-
|
|
13566
|
-
initialContent = images === null || images === void 0 ? void 0 : images[0];
|
|
13567
|
-
}
|
|
13568
|
-
else if (selectedValue && images.includes(selectedValue)) {
|
|
13569
|
-
initialContent = selectedValue;
|
|
13570
|
-
}
|
|
13571
|
-
return initialContent;
|
|
13572
|
-
};
|
|
13573
|
-
|
|
13564
|
+
return 0;
|
|
13565
|
+
};
|
|
13574
13566
|
var ProductGallery = function (_a) {
|
|
13575
13567
|
var images = _a.images, selectedValue = _a.selectedValue, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, previewListDataTestId = _a.previewListDataTestId, thumbnailPosition = _a.thumbnailPosition, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b, previewImgBorderColor = _a.previewImgBorderColor, ctaText = _a.ctaText, ctaAction = _a.ctaAction, _c = _a.hideCTA, hideCTA = _c === void 0 ? true : _c, _d = _a.hasOverflowArrows, hasOverflowArrows = _d === void 0 ? false : _d, _e = _a.withZoom, withZoom = _e === void 0 ? true : _e, _f = _a.hasToPreserveOrder, hasToPreserveOrder = _f === void 0 ? false : _f;
|
|
13576
|
-
var _g = useState(
|
|
13577
|
-
var _h = useState(selectedValue !== null && selectedValue !== void 0 ? selectedValue : images === null || images === void 0 ? void 0 : images[0]), selectedImage = _h[0], setSelectedImage = _h[1];
|
|
13578
|
-
var initialValue = getActiveContent(hasToPreserveOrder, activeIndex, selectedImage, images);
|
|
13568
|
+
var _g = useState(getInitialIndex(images, selectedValue)), activeIndex = _g[0], setActiveIndex = _g[1];
|
|
13579
13569
|
useEffect(function () {
|
|
13580
|
-
|
|
13581
|
-
|
|
13582
|
-
|
|
13583
|
-
|
|
13570
|
+
if (selectedValue && !hasToPreserveOrder) {
|
|
13571
|
+
var index = images.indexOf(selectedValue);
|
|
13572
|
+
if (index > -1) {
|
|
13573
|
+
setActiveIndex(index);
|
|
13574
|
+
}
|
|
13575
|
+
}
|
|
13576
|
+
}, [selectedValue, hasToPreserveOrder]);
|
|
13577
|
+
if (images.length === 0)
|
|
13578
|
+
return null;
|
|
13579
|
+
var onContentChange = function (index) {
|
|
13580
|
+
setActiveIndex(index);
|
|
13584
13581
|
};
|
|
13585
|
-
|
|
13582
|
+
var selectedImage = images[activeIndex];
|
|
13583
|
+
return (jsxs$1(Container$I, { children: [jsx$1(ImagePreviewList, { images: images, selectedImage: selectedImage, dataTestId: previewListDataTestId, onClick: onContentChange, position: thumbnailPosition, borderRadiusVariant: borderRadiusVariant, previewImgBorderColor: previewImgBorderColor, hasOverflowArrows: hasOverflowArrows }, void 0), jsx$1(ImageProductSlide$1, { content: selectedImage, topTag: topTag, topRightTag: topRightTag, bottomTag: bottomTag, testId: productImageDataTestId, position: thumbnailPosition, borderRadiusVariant: borderRadiusVariant, ctaText: ctaText, ctaAction: ctaAction, hideCTA: hideCTA, withZoom: withZoom }, void 0)] }, void 0));
|
|
13586
13584
|
};
|
|
13587
13585
|
|
|
13588
13586
|
var getStylesBySize$5 = function (size) {
|