@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.js
CHANGED
|
@@ -11897,7 +11897,7 @@ var ImagePreviewList = function (_a) {
|
|
|
11897
11897
|
arrowWidth: 0.75,
|
|
11898
11898
|
arrowHeight: 1.25,
|
|
11899
11899
|
arrowPadding: 1.625,
|
|
11900
|
-
}, adaptiveHeight: true, dots: false, slidesToShow: 4 }, { children: images.map(function (item, index) { return (jsxRuntime.jsx(Button$6, __assign$1({ onClick: function () { return onClick(
|
|
11900
|
+
}, adaptiveHeight: true, dots: false, slidesToShow: 4 }, { children: images.map(function (item, index) { return (jsxRuntime.jsx(Button$6, __assign$1({ onClick: function () { return onClick(index); } }, { children: jsxRuntime.jsx(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 (jsxRuntime.jsx(Button$6, __assign$1({ onClick: function () { return onClick(index); } }, { children: jsxRuntime.jsx(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 && (jsxRuntime.jsxs(ArrowsContainer, __assign$1({ role: "navigation" }, { children: [jsxRuntime.jsx(ArrowPrev, { onClick: handleScrollVerticalPrev }, void 0), jsxRuntime.jsx(ArrowNext, { onClick: handleScrollVerticalNext }, void 0)] }), void 0))] }, void 0));
|
|
11901
11901
|
};
|
|
11902
11902
|
|
|
11903
11903
|
var propTypes = {exports: {}};
|
|
@@ -13582,33 +13582,31 @@ var ImageProductSlide$1 = function (_a) {
|
|
|
13582
13582
|
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"])));
|
|
13583
13583
|
var templateObject_1$W;
|
|
13584
13584
|
|
|
13585
|
-
var
|
|
13586
|
-
|
|
13587
|
-
|
|
13588
|
-
|
|
13585
|
+
var getInitialIndex = function (images, selectedValue) {
|
|
13586
|
+
if (selectedValue) {
|
|
13587
|
+
var index = images.indexOf(selectedValue);
|
|
13588
|
+
return index > -1 ? index : 0;
|
|
13589
13589
|
}
|
|
13590
|
-
|
|
13591
|
-
|
|
13592
|
-
initialContent = images === null || images === void 0 ? void 0 : images[0];
|
|
13593
|
-
}
|
|
13594
|
-
else if (selectedValue && images.includes(selectedValue)) {
|
|
13595
|
-
initialContent = selectedValue;
|
|
13596
|
-
}
|
|
13597
|
-
return initialContent;
|
|
13598
|
-
};
|
|
13599
|
-
|
|
13590
|
+
return 0;
|
|
13591
|
+
};
|
|
13600
13592
|
var ProductGallery = function (_a) {
|
|
13601
13593
|
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;
|
|
13602
|
-
var _g = React$2.useState(
|
|
13603
|
-
var _h = React$2.useState(selectedValue !== null && selectedValue !== void 0 ? selectedValue : images === null || images === void 0 ? void 0 : images[0]), selectedImage = _h[0], setSelectedImage = _h[1];
|
|
13604
|
-
var initialValue = getActiveContent(hasToPreserveOrder, activeIndex, selectedImage, images);
|
|
13594
|
+
var _g = React$2.useState(getInitialIndex(images, selectedValue)), activeIndex = _g[0], setActiveIndex = _g[1];
|
|
13605
13595
|
React$2.useEffect(function () {
|
|
13606
|
-
|
|
13607
|
-
|
|
13608
|
-
|
|
13609
|
-
|
|
13596
|
+
if (selectedValue && !hasToPreserveOrder) {
|
|
13597
|
+
var index = images.indexOf(selectedValue);
|
|
13598
|
+
if (index > -1) {
|
|
13599
|
+
setActiveIndex(index);
|
|
13600
|
+
}
|
|
13601
|
+
}
|
|
13602
|
+
}, [selectedValue, hasToPreserveOrder]);
|
|
13603
|
+
if (images.length === 0)
|
|
13604
|
+
return null;
|
|
13605
|
+
var onContentChange = function (index) {
|
|
13606
|
+
setActiveIndex(index);
|
|
13610
13607
|
};
|
|
13611
|
-
|
|
13608
|
+
var selectedImage = images[activeIndex];
|
|
13609
|
+
return (jsxRuntime.jsxs(Container$I, { children: [jsxRuntime.jsx(ImagePreviewList, { images: images, selectedImage: selectedImage, dataTestId: previewListDataTestId, onClick: onContentChange, position: thumbnailPosition, borderRadiusVariant: borderRadiusVariant, previewImgBorderColor: previewImgBorderColor, hasOverflowArrows: hasOverflowArrows }, void 0), jsxRuntime.jsx(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));
|
|
13612
13610
|
};
|
|
13613
13611
|
|
|
13614
13612
|
var getStylesBySize$5 = function (size) {
|