@trafilea/afrodita-components 6.16.4 → 6.16.5
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.d.ts +3 -1
- package/build/index.esm.js +34 -12
- package/build/index.esm.js.map +1 -1
- package/build/index.js +34 -12
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -2652,8 +2652,9 @@ interface ProductGalleryProps {
|
|
|
2652
2652
|
hideCTA?: boolean;
|
|
2653
2653
|
hasOverflowArrows?: boolean;
|
|
2654
2654
|
withZoom?: boolean;
|
|
2655
|
+
hasToPreserveOrder?: boolean;
|
|
2655
2656
|
}
|
|
2656
|
-
declare const ProductGallery: ({ images, selectedValue, topTag, topRightTag, bottomTag, productImageDataTestId, previewListDataTestId, thumbnailPosition, borderRadiusVariant, previewImgBorderColor, ctaText, ctaAction, hideCTA, hasOverflowArrows, withZoom, }: ProductGalleryProps) => JSX.Element;
|
|
2657
|
+
declare const ProductGallery: ({ images, selectedValue, topTag, topRightTag, bottomTag, productImageDataTestId, previewListDataTestId, thumbnailPosition, borderRadiusVariant, previewImgBorderColor, ctaText, ctaAction, hideCTA, hasOverflowArrows, withZoom, hasToPreserveOrder, }: ProductGalleryProps) => JSX.Element;
|
|
2657
2658
|
|
|
2658
2659
|
interface IconButtonProps {
|
|
2659
2660
|
children: React__default.ReactNode;
|
|
@@ -2780,6 +2781,7 @@ interface ProductGalleryMobileProps$3 {
|
|
|
2780
2781
|
productImageDataTestId?: string;
|
|
2781
2782
|
borderRadiusVariant?: boolean;
|
|
2782
2783
|
selectedValue?: ContentType;
|
|
2784
|
+
hasToPreserveOrder?: boolean;
|
|
2783
2785
|
}
|
|
2784
2786
|
declare const ProductGalleryMobile: React__default.FC<ProductGalleryMobileProps$3>;
|
|
2785
2787
|
|
package/build/index.esm.js
CHANGED
|
@@ -11864,11 +11864,11 @@ var ImagePreviewList = function (_a) {
|
|
|
11864
11864
|
var element = document.querySelector(".imageListContainer");
|
|
11865
11865
|
element.scrollBy(0, 200);
|
|
11866
11866
|
};
|
|
11867
|
-
return (jsxs$1(Fragment$2, { children: [jsx$1(Container$L, __assign$1({ "data-testid": dataTestId, position: position, className: hasOverflowArrows ? 'imageListContainer' : position, hasOverflowArrows: hasOverflowArrows }, { children: position == 'horizontal' ? (jsx$1("div", __assign$1({ style: { maxWidth: '360px' } }, { children: jsx$1(SliderNavigation, __assign$1({ speed: 200, infinite: false, arrows: {
|
|
11867
|
+
return (jsxs$1(Fragment$2, { children: [jsx$1(Container$L, __assign$1({ role: "list", "data-testid": dataTestId, position: position, className: hasOverflowArrows ? 'imageListContainer' : position, hasOverflowArrows: hasOverflowArrows }, { children: position == 'horizontal' ? (jsx$1("div", __assign$1({ style: { maxWidth: '360px' } }, { children: jsx$1(SliderNavigation, __assign$1({ speed: 200, infinite: false, arrows: {
|
|
11868
11868
|
arrowWidth: 0.75,
|
|
11869
11869
|
arrowHeight: 1.25,
|
|
11870
11870
|
arrowPadding: 1.625,
|
|
11871
|
-
}, adaptiveHeight: true, dots: false, slidesToShow: 4 }, { children: images.map(function (item) { return (jsx$1(Button$6, __assign$1({ onClick: function () { return onClick(item); } }, { 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) { return (jsx$1(Button$6, __assign$1({ onClick: function () { return onClick(item); } }, { 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, { children: [jsx$1(ArrowPrev, { onClick: handleScrollVerticalPrev }, void 0), jsx$1(ArrowNext, { onClick: handleScrollVerticalNext }, void 0)] }, void 0))] }, void 0));
|
|
11871
|
+
}, adaptiveHeight: true, dots: false, slidesToShow: 4 }, { children: images.map(function (item, index) { return (jsx$1(Button$6, __assign$1({ onClick: function () { return onClick(item, 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(item, 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));
|
|
11872
11872
|
};
|
|
11873
11873
|
var templateObject_1$_, templateObject_2$G, templateObject_3$x, templateObject_4$n, templateObject_5$h, templateObject_6$e, templateObject_7$a, templateObject_8$9;
|
|
11874
11874
|
|
|
@@ -13540,17 +13540,34 @@ var ImageProductSlide$1 = function (_a) {
|
|
|
13540
13540
|
};
|
|
13541
13541
|
var templateObject_1$X, templateObject_2$D, templateObject_3$v, templateObject_4$l, templateObject_5$f;
|
|
13542
13542
|
|
|
13543
|
+
var getActiveContent = function (preserveOrder, activeIndex, selectedValue, images) {
|
|
13544
|
+
var initialContent = images === null || images === void 0 ? void 0 : images[0];
|
|
13545
|
+
if (preserveOrder && (images === null || images === void 0 ? void 0 : images[activeIndex])) {
|
|
13546
|
+
initialContent = images === null || images === void 0 ? void 0 : images[activeIndex];
|
|
13547
|
+
}
|
|
13548
|
+
else if (preserveOrder && !(images === null || images === void 0 ? void 0 : images[activeIndex])) {
|
|
13549
|
+
// Fallback in case image does not exist at the index
|
|
13550
|
+
initialContent = images === null || images === void 0 ? void 0 : images[0];
|
|
13551
|
+
}
|
|
13552
|
+
else if (selectedValue && images.includes(selectedValue)) {
|
|
13553
|
+
initialContent = selectedValue;
|
|
13554
|
+
}
|
|
13555
|
+
return initialContent;
|
|
13556
|
+
};
|
|
13557
|
+
|
|
13543
13558
|
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: fit-content;\n"], ["\n display: grid;\n grid-template-columns: minmax(6rem, max-content) 1fr;\n grid-column-gap: 20px;\n max-height: 50rem;\n width: fit-content;\n"])));
|
|
13544
13559
|
var ProductGallery = function (_a) {
|
|
13545
|
-
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 ? false : _c, _d = _a.hasOverflowArrows, hasOverflowArrows = _d === void 0 ? false : _d, _e = _a.withZoom, withZoom = _e === void 0 ? true : _e;
|
|
13546
|
-
var
|
|
13547
|
-
var
|
|
13560
|
+
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 ? false : _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;
|
|
13561
|
+
var _g = useState(0), activeIndex = _g[0], setActiveIndex = _g[1];
|
|
13562
|
+
var _h = useState(selectedValue !== null && selectedValue !== void 0 ? selectedValue : images === null || images === void 0 ? void 0 : images[0]), selectedImage = _h[0], setSelectedImage = _h[1];
|
|
13563
|
+
var initialValue = getActiveContent(hasToPreserveOrder, activeIndex, selectedImage, images);
|
|
13548
13564
|
useEffect(function () {
|
|
13549
13565
|
setSelectedImage(initialValue);
|
|
13550
13566
|
}, [initialValue]);
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13567
|
+
var updateActiveContent = function (value, index) {
|
|
13568
|
+
hasToPreserveOrder ? setActiveIndex(index) : setSelectedImage(value);
|
|
13569
|
+
};
|
|
13570
|
+
return (jsxs$1(Container$I, { children: [jsx$1(ImagePreviewList, { images: images, selectedImage: selectedImage, dataTestId: previewListDataTestId, onClick: updateActiveContent, 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));
|
|
13554
13571
|
};
|
|
13555
13572
|
var templateObject_1$W;
|
|
13556
13573
|
|
|
@@ -13956,7 +13973,7 @@ var settings$1 = {
|
|
|
13956
13973
|
initialSlide: 0,
|
|
13957
13974
|
};
|
|
13958
13975
|
var ImageProductSlide = function (_a) {
|
|
13959
|
-
var contents = _a.contents, _b = _a.customClick, customClick = _b === void 0 ? false : _b, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, testId = _a.testId, borderRadiusVariant = _a.borderRadiusVariant, selectedValue = _a.selectedValue;
|
|
13976
|
+
var contents = _a.contents, _b = _a.customClick, customClick = _b === void 0 ? false : _b, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, testId = _a.testId, borderRadiusVariant = _a.borderRadiusVariant, selectedValue = _a.selectedValue, onChange = _a.onChange;
|
|
13960
13977
|
var slick = useRef(null);
|
|
13961
13978
|
var sliderWrapper = useRef(null);
|
|
13962
13979
|
useRef(null);
|
|
@@ -13997,6 +14014,7 @@ var ImageProductSlide = function (_a) {
|
|
|
13997
14014
|
// If autoplay is true and iframe is the active slide, play the video
|
|
13998
14015
|
var autoplay = (_a = activeSlide === null || activeSlide === void 0 ? void 0 : activeSlide.url) === null || _a === void 0 ? void 0 : _a.includes('autoplay=1');
|
|
13999
14016
|
autoplay ? _playVideo() : _stopVideo();
|
|
14017
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
14000
14018
|
} }, settings$1, { nextArrow: jsx$1(NavButtonContainer$2, { children: jsx$1(Button$4, { children: jsx$1(Icon.Arrows.ChevronRight, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), prevArrow: jsx$1(NavButtonContainer$2, { children: jsx$1(Button$4, { children: jsx$1(Icon.Arrows.ChevronLeft, { height: 2.125, width: 1.25, fill: "#292929" }, void 0) }, void 0) }, void 0), ref: slick }, { children: contents.map(function (content) {
|
|
14001
14019
|
var _a;
|
|
14002
14020
|
var source = content === null || content === void 0 ? void 0 : content.url;
|
|
@@ -14008,8 +14026,10 @@ var templateObject_1$M, templateObject_2$w, templateObject_3$r, templateObject_4
|
|
|
14008
14026
|
|
|
14009
14027
|
var Container$A = newStyled.div(templateObject_1$L || (templateObject_1$L = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n height: fit-content;\n position: relative;\n max-width: 450px;\n"], ["\n display: flex;\n flex-direction: column;\n height: fit-content;\n position: relative;\n max-width: 450px;\n"])));
|
|
14010
14028
|
var ProductGalleryMobile = function (_a) {
|
|
14011
|
-
var images = _a.images, customClick = _a.customClick, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b, selectedValue = _a.selectedValue;
|
|
14012
|
-
|
|
14029
|
+
var images = _a.images, customClick = _a.customClick, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b, selectedValue = _a.selectedValue, _c = _a.hasToPreserveOrder, hasToPreserveOrder = _c === void 0 ? false : _c;
|
|
14030
|
+
var _d = useState(0), activeIndex = _d[0], setActiveIndex = _d[1];
|
|
14031
|
+
var selectedContent = hasToPreserveOrder ? images === null || images === void 0 ? void 0 : images[activeIndex] : selectedValue;
|
|
14032
|
+
return (jsx$1(Container$A, __assign$1({ "data-testid": "product-gallery-mobile-v1" }, { children: jsx$1(ImageProductSlide, { contents: images, customClick: customClick, topTag: topTag, topRightTag: topRightTag, bottomTag: bottomTag, testId: productImageDataTestId, borderRadiusVariant: borderRadiusVariant, selectedValue: selectedContent, onChange: function (index) { return setActiveIndex(index); } }, void 0) }), void 0));
|
|
14013
14033
|
};
|
|
14014
14034
|
var templateObject_1$L;
|
|
14015
14035
|
|
|
@@ -19456,7 +19476,9 @@ var templateObject_1$e, templateObject_2$a;
|
|
|
19456
19476
|
var SizeSelector = function (_a) {
|
|
19457
19477
|
var _b;
|
|
19458
19478
|
var label = _a.label, sizes = _a.sizes, selectedValue = _a.selectedValue, onChange = _a.onChange, onClickSizeTip = _a.onClickSizeTip, _c = _a.inline, inline = _c === void 0 ? false : _c, width = _a.width, _d = _a.hasSizeGuide, hasSizeGuide = _d === void 0 ? false : _d, sizeTipReferences = _a.sizeTipReferences;
|
|
19459
|
-
var activeSizeTip =
|
|
19479
|
+
var activeSizeTip = hasSizeGuide
|
|
19480
|
+
? sizeTipReferences === null || sizeTipReferences === void 0 ? void 0 : sizeTipReferences.find(function (sizeTip) { return (sizeTip === null || sizeTip === void 0 ? void 0 : sizeTip.size) === (selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label); })
|
|
19481
|
+
: null;
|
|
19460
19482
|
return (jsxs("div", __assign$1({ css: {
|
|
19461
19483
|
display: 'flex',
|
|
19462
19484
|
flexDirection: inline ? 'row' : 'column',
|