@trafilea/afrodita-components 6.17.0 → 6.17.2

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 CHANGED
@@ -1910,6 +1910,8 @@ declare type ThemeComponent = {
1910
1910
  button: {
1911
1911
  borderRadius: string;
1912
1912
  };
1913
+ width?: string;
1914
+ height?: string;
1913
1915
  };
1914
1916
  copyrightText: {
1915
1917
  fontSize: string;
@@ -2111,6 +2113,41 @@ declare type ThemeAssets = {
2111
2113
  width: string;
2112
2114
  height: string;
2113
2115
  };
2116
+ tyImage?: {
2117
+ url: string;
2118
+ width: string;
2119
+ height: string;
2120
+ };
2121
+ appleImage?: {
2122
+ url: string;
2123
+ width: string;
2124
+ height: string;
2125
+ };
2126
+ spotifyImage?: {
2127
+ url: string;
2128
+ width: string;
2129
+ height: string;
2130
+ };
2131
+ instagramImage?: {
2132
+ url: string;
2133
+ width: string;
2134
+ height: string;
2135
+ };
2136
+ facebookImage?: {
2137
+ url: string;
2138
+ width: string;
2139
+ height: string;
2140
+ };
2141
+ pinterestImage?: {
2142
+ url: string;
2143
+ width: string;
2144
+ height: string;
2145
+ };
2146
+ youtubeImage?: {
2147
+ url: string;
2148
+ width: string;
2149
+ height: string;
2150
+ };
2114
2151
  };
2115
2152
  [key: string]: any;
2116
2153
  };
@@ -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(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));
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: {}};
@@ -13545,8 +13545,6 @@ var ImageProductSlide$1 = function (_a) {
13545
13545
  var content = _a.content, topTag = _a.topTag, topRightTag = _a.topRightTag, bottomTag = _a.bottomTag, testId = _a.testId, _c = _a.position, position = _c === void 0 ? 'vertical' : _c, borderRadiusVariant = _a.borderRadiusVariant, ctaText = _a.ctaText, ctaAction = _a.ctaAction, hideCTA = _a.hideCTA, withZoom = _a.withZoom;
13546
13546
  var source = content === null || content === void 0 ? void 0 : content.url;
13547
13547
  var isVideo = (_b = content === null || content === void 0 ? void 0 : content.isVideo) !== null && _b !== void 0 ? _b : false;
13548
- console.log(ctaText);
13549
- console.log(hideCTA);
13550
13548
  return (jsxs$1(Container$J, __assign$1({ "data-testid": testId, className: "stylefor".concat(position), borderRadiusVariant: borderRadiusVariant }, { children: [!isVideo && (jsxs$1(Fragment$2, { children: [withZoom ? (jsx$1(InnerImageZoom, { src: source, zoomSrc: source, zoomType: "hover", imgAttributes: {
13551
13549
  alt: content.alt,
13552
13550
  style: { objectFit: 'cover', objectPosition: 'center' },
@@ -13556,33 +13554,31 @@ var ImageProductSlide$1 = function (_a) {
13556
13554
  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
13555
  var templateObject_1$W;
13558
13556
 
13559
- var getActiveContent = function (preserveOrder, activeIndex, selectedValue, images) {
13560
- var initialContent = images === null || images === void 0 ? void 0 : images[0];
13561
- if (preserveOrder && (images === null || images === void 0 ? void 0 : images[activeIndex])) {
13562
- initialContent = images === null || images === void 0 ? void 0 : images[activeIndex];
13557
+ var getInitialIndex = function (images, selectedValue) {
13558
+ if (selectedValue) {
13559
+ var index = images.indexOf(selectedValue);
13560
+ return index > -1 ? index : 0;
13563
13561
  }
13564
- else if (preserveOrder && !(images === null || images === void 0 ? void 0 : images[activeIndex])) {
13565
- // Fallback in case image does not exist at the index
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
-
13562
+ return 0;
13563
+ };
13574
13564
  var ProductGallery = function (_a) {
13575
13565
  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(0), activeIndex = _g[0], setActiveIndex = _g[1];
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);
13566
+ var _g = useState(getInitialIndex(images, selectedValue)), activeIndex = _g[0], setActiveIndex = _g[1];
13579
13567
  useEffect(function () {
13580
- setSelectedImage(initialValue);
13581
- }, [initialValue]);
13582
- var updateActiveContent = function (value, index) {
13583
- hasToPreserveOrder ? setActiveIndex(index) : setSelectedImage(value);
13568
+ if (selectedValue && !hasToPreserveOrder) {
13569
+ var index = images.indexOf(selectedValue);
13570
+ if (index > -1) {
13571
+ setActiveIndex(index);
13572
+ }
13573
+ }
13574
+ }, [selectedValue, hasToPreserveOrder]);
13575
+ if (images.length === 0)
13576
+ return null;
13577
+ var onContentChange = function (index) {
13578
+ setActiveIndex(index);
13584
13579
  };
13585
- 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));
13580
+ var selectedImage = images[activeIndex];
13581
+ 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
13582
  };
13587
13583
 
13588
13584
  var getStylesBySize$5 = function (size) {