@trafilea/afrodita-components 5.0.0-beta.165 → 5.0.0-beta.167

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
@@ -2331,8 +2331,9 @@ interface ProductGalleryMobileProps {
2331
2331
  bottomTag?: JSX.Element;
2332
2332
  productImageDataTestId?: string;
2333
2333
  borderRadiusVariant?: boolean;
2334
+ selectedValue?: ImageType;
2334
2335
  }
2335
- declare const ProductGalleryMobile: ({ images, customClick, topTag, bottomTag, productImageDataTestId, borderRadiusVariant, }: ProductGalleryMobileProps) => JSX.Element;
2336
+ declare const ProductGalleryMobile: ({ images, customClick, topTag, bottomTag, productImageDataTestId, borderRadiusVariant, selectedValue, }: ProductGalleryMobileProps) => JSX.Element;
2336
2337
 
2337
2338
  interface RadioProps {
2338
2339
  name: string;
@@ -13231,7 +13231,7 @@ var settings = {
13231
13231
  initialSlide: 0,
13232
13232
  };
13233
13233
  var ImageProductWithTags = function (_a) {
13234
- var images = _a.images, _b = _a.customClick, customClick = _b === void 0 ? false : _b, topTag = _a.topTag, bottomTag = _a.bottomTag, testId = _a.testId, borderRadiusVariant = _a.borderRadiusVariant;
13234
+ var images = _a.images, _b = _a.customClick, customClick = _b === void 0 ? false : _b, topTag = _a.topTag, bottomTag = _a.bottomTag, testId = _a.testId, borderRadiusVariant = _a.borderRadiusVariant, selectedValue = _a.selectedValue;
13235
13235
  var slick = useRef(null);
13236
13236
  var sliderWrapper = useRef(null);
13237
13237
  usePreventVerticalScroll(sliderWrapper);
@@ -13239,6 +13239,15 @@ var ImageProductWithTags = function (_a) {
13239
13239
  var _a;
13240
13240
  (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(i);
13241
13241
  }, [slick]);
13242
+ useEffect(function () {
13243
+ var _a;
13244
+ if (selectedValue) {
13245
+ var matchingIndex = images.findIndex(function (image) { return image.imageUrl === selectedValue.imageUrl; });
13246
+ if (matchingIndex) {
13247
+ (_a = slick.current) === null || _a === void 0 ? void 0 : _a.slickGoTo(matchingIndex);
13248
+ }
13249
+ }
13250
+ }, [images, selectedValue]);
13242
13251
  return (jsxs$1(Fragment$1, { children: [customClick && (jsx$1("div", __assign$1({ style: { display: 'flex', marginBottom: '20px', gap: '10px' } }, { children: images.map(function (_, i) { return (jsx$1(ButtonPrimary, { onClick: function () { return onButtonClick(i); }, text: String(i + 1), inline: true }, i)); }) }), void 0)), jsx$1(Container$h, __assign$1({ "data-testid": testId, borderRadiusVariant: borderRadiusVariant, ref: sliderWrapper }, { children: jsx$1(Slider, __assign$1({}, settings, { ref: slick }, { children: images.map(function (image) {
13243
13252
  return (jsxs$1("div", { children: [jsx$1(InnerImageZoom, { src: image.imageUrl, zoomSrc: image.imageUrl, zoomType: "hover", imgAttributes: { alt: image.alt, width: '100%', height: '510px' }, height: 510, fullscreenOnMobile: true, className: "zoomWrapper" }, void 0), jsx$1(TopTagContainer, __assign$1({ borderRadiusVariant: borderRadiusVariant, "data-testid": "topTag" }, { children: topTag }), void 0), jsx$1(BottomTagContainer, __assign$1({ "data-testid": "bottomTag" }, { children: bottomTag }), void 0)] }, image.key));
13244
13253
  }) }), void 0) }), void 0)] }, void 0));
@@ -13280,8 +13289,8 @@ var templateObject_1$m, templateObject_2$f, templateObject_3$f;
13280
13289
 
13281
13290
  var Container$g = 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"])));
13282
13291
  var ProductGalleryMobile = function (_a) {
13283
- var images = _a.images, customClick = _a.customClick, topTag = _a.topTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b;
13284
- return (jsx$1(Container$g, { children: jsx$1(ImageProductWithTags, { images: images, customClick: customClick, topTag: topTag, bottomTag: bottomTag, testId: productImageDataTestId, borderRadiusVariant: borderRadiusVariant }, void 0) }, void 0));
13292
+ var images = _a.images, customClick = _a.customClick, topTag = _a.topTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId, _b = _a.borderRadiusVariant, borderRadiusVariant = _b === void 0 ? false : _b, selectedValue = _a.selectedValue;
13293
+ return (jsx$1(Container$g, { children: jsx$1(ImageProductWithTags, { images: images, customClick: customClick, topTag: topTag, bottomTag: bottomTag, testId: productImageDataTestId, borderRadiusVariant: borderRadiusVariant, selectedValue: selectedValue }, void 0) }, void 0));
13285
13294
  };
13286
13295
  var templateObject_1$l;
13287
13296