@gem-sdk/components 2.0.0-dev.622 → 2.0.0-dev.623
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/dist/cjs/builder.js +12 -6
- package/dist/cjs/index.js +34 -32
- package/dist/cjs/index.liquid.js +16 -10
- package/dist/cjs/next.js +3 -1
- package/dist/cjs/product/components/ProductImagesV3/common/common.js +360 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +192 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +26 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +94 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +303 -0
- package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +95 -0
- package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +59 -0
- package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +266 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +63 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +36 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +109 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +139 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +100 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +77 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +300 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +44 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +83 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +182 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +30 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +239 -0
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +28 -0
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +144 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +14 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +54 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +53 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +55 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +41 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +134 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +203 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +87 -0
- package/dist/cjs/product/components/ProductImagesV3/index.js +291 -0
- package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +153 -0
- package/dist/cjs/product/index.js +6 -4
- package/dist/cjs/product/next.js +4 -0
- package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +252 -0
- package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +251 -0
- package/dist/cjs/product/setting/product-image-v3/ProductImages.js +74 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +388 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +518 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +336 -0
- package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +118 -0
- package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +119 -0
- package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +237 -0
- package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +491 -0
- package/dist/cjs/setting.js +97 -95
- package/dist/cjs/swiper-carousel/arrow/Arrow.js +52 -0
- package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +46 -0
- package/dist/cjs/swiper-carousel/arrow/common/common.js +119 -0
- package/dist/cjs/swiper-carousel/arrow/common/getClass.js +50 -0
- package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +84 -0
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +34 -0
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +38 -0
- package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +29 -0
- package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +79 -0
- package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +22 -0
- package/dist/cjs/swiper-carousel/components/common/carousel.js +98 -0
- package/dist/cjs/swiper-carousel/components/const/index.js +5 -0
- package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +34 -0
- package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +42 -0
- package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +105 -0
- package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +15 -0
- package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +45 -0
- package/dist/cjs/swiper-carousel/dots/Dots.js +51 -0
- package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +26 -0
- package/dist/cjs/swiper-carousel/dots/common/common.js +28 -0
- package/dist/cjs/swiper-carousel/dots/common/getClass.js +40 -0
- package/dist/cjs/swiper-carousel/dots/common/getStyle.js +33 -0
- package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +21 -0
- package/dist/cjs/swiper-carousel/index.js +17 -0
- package/dist/cjs/swiper-carousel/next.js +22 -0
- package/dist/cjs/swiper-carousel/root/Swiper.js +128 -0
- package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +104 -0
- package/dist/cjs/swiper-carousel/root/common/getAttr.js +25 -0
- package/dist/cjs/swiper-carousel/root/common/getClass.js +135 -0
- package/dist/cjs/swiper-carousel/root/common/getData.js +56 -0
- package/dist/cjs/swiper-carousel/root/common/getStyle.js +64 -0
- package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +482 -0
- package/dist/cjs/swiper-carousel/setting/Swiper.js +42 -0
- package/dist/cjs/swiper-carousel/setting/SwiperItem.js +40 -0
- package/dist/cjs/swiper-carousel/setting/configs/presets.js +87 -0
- package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +819 -0
- package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +718 -0
- package/dist/esm/builder.js +6 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.liquid.js +3 -0
- package/dist/esm/next.js +3 -1
- package/dist/esm/product/components/ProductImagesV3/common/common.js +344 -0
- package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +189 -0
- package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +24 -0
- package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +83 -0
- package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +292 -0
- package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +92 -0
- package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +53 -0
- package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +251 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +59 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +32 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +105 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +135 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +96 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +73 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +296 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +40 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +79 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +178 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +26 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +235 -0
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +24 -0
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +140 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +12 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +52 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +51 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +53 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +39 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +132 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +201 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +85 -0
- package/dist/esm/product/components/ProductImagesV3/index.js +287 -0
- package/dist/esm/product/components/ProductImagesV3/index.liquid.js +149 -0
- package/dist/esm/product/index.js +26 -24
- package/dist/esm/product/next.js +4 -0
- package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +248 -0
- package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +248 -0
- package/dist/esm/product/setting/product-image-v3/ProductImages.js +70 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +384 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +515 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +334 -0
- package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +116 -0
- package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +117 -0
- package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +235 -0
- package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +489 -0
- package/dist/esm/setting.js +2 -0
- package/dist/esm/swiper-carousel/arrow/Arrow.js +48 -0
- package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +42 -0
- package/dist/esm/swiper-carousel/arrow/common/common.js +111 -0
- package/dist/esm/swiper-carousel/arrow/common/getClass.js +48 -0
- package/dist/esm/swiper-carousel/arrow/common/getStyle.js +82 -0
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +30 -0
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +34 -0
- package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +27 -0
- package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +77 -0
- package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +20 -0
- package/dist/esm/swiper-carousel/components/common/carousel.js +93 -0
- package/dist/esm/swiper-carousel/components/const/index.js +3 -0
- package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +30 -0
- package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +35 -0
- package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +103 -0
- package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +13 -0
- package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +43 -0
- package/dist/esm/swiper-carousel/dots/Dots.js +47 -0
- package/dist/esm/swiper-carousel/dots/Dots.liquid.js +22 -0
- package/dist/esm/swiper-carousel/dots/common/common.js +26 -0
- package/dist/esm/swiper-carousel/dots/common/getClass.js +38 -0
- package/dist/esm/swiper-carousel/dots/common/getStyle.js +31 -0
- package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +19 -0
- package/dist/esm/swiper-carousel/index.js +15 -0
- package/dist/esm/swiper-carousel/next.js +18 -0
- package/dist/esm/swiper-carousel/root/Swiper.js +124 -0
- package/dist/esm/swiper-carousel/root/Swiper.liquid.js +100 -0
- package/dist/esm/swiper-carousel/root/common/getAttr.js +23 -0
- package/dist/esm/swiper-carousel/root/common/getClass.js +133 -0
- package/dist/esm/swiper-carousel/root/common/getData.js +54 -0
- package/dist/esm/swiper-carousel/root/common/getStyle.js +62 -0
- package/dist/esm/swiper-carousel/root/hook/useCarousel.js +480 -0
- package/dist/esm/swiper-carousel/setting/Swiper.js +38 -0
- package/dist/esm/swiper-carousel/setting/SwiperItem.js +36 -0
- package/dist/esm/swiper-carousel/setting/configs/presets.js +85 -0
- package/dist/esm/swiper-carousel/setting/configs/settingV2.js +815 -0
- package/dist/esm/swiper-carousel/setting/configs/uiV2.js +713 -0
- package/dist/types/index.d.ts +551 -116
- package/package.json +2 -2
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var common = require('./common.js');
|
|
4
|
+
|
|
5
|
+
const handleMouseMove = (event, setting)=>{
|
|
6
|
+
const isEnableRoomEffect = setting?.hoverEffect === 'zoom' && setting?.zoomType === 'default';
|
|
7
|
+
const isEnableGlassEffect = setting?.hoverEffect === 'zoom' && setting?.zoomType === 'glasses';
|
|
8
|
+
const isEnableShowOtherImage = setting?.hoverEffect === 'other';
|
|
9
|
+
const isEnableHoverEffect = setting?.hoverEffect !== 'none';
|
|
10
|
+
if (!isEnableHoverEffect) return;
|
|
11
|
+
const featureImageDom = event.currentTarget.querySelector('img');
|
|
12
|
+
const featureImageHoverDom = event.currentTarget.querySelector('img.hover-image');
|
|
13
|
+
const zoomLens = event.currentTarget.querySelector('.room-len');
|
|
14
|
+
const imagePosition = featureImageDom?.getBoundingClientRect();
|
|
15
|
+
const slideWidth = featureImageDom?.clientWidth || 0;
|
|
16
|
+
const slideHeight = featureImageDom?.clientHeight || 0;
|
|
17
|
+
const zoom = common.convertUnitToNumber(setting?.zoom, 0);
|
|
18
|
+
const zoomValue = !zoom || zoom < 100 ? 1 : zoom / 100 || 1;
|
|
19
|
+
const zoomSize = (slideWidth || 1) * (setting?.hoverEffect === 'other' ? 1 : zoomValue);
|
|
20
|
+
const zoomSizeHeight = (slideHeight || 1) * (setting?.hoverEffect === 'other' ? 1 : zoomValue);
|
|
21
|
+
const imageOffsetX = event.clientX - imagePosition?.x;
|
|
22
|
+
const imageOffsetY = event.clientY - imagePosition?.y;
|
|
23
|
+
isEnableShowOtherImage && displayOtherImage({
|
|
24
|
+
featureImageHoverDom
|
|
25
|
+
});
|
|
26
|
+
isEnableRoomEffect && event.clientX >= imagePosition?.x && event.clientX <= imagePosition.right && event.clientY >= imagePosition?.y && event.clientY <= imagePosition.bottom && displayZoomImage({
|
|
27
|
+
featureImageDom,
|
|
28
|
+
featureImageHoverDom,
|
|
29
|
+
zoomSize,
|
|
30
|
+
zoomSizeHeight,
|
|
31
|
+
slideWidth,
|
|
32
|
+
imageOffsetX,
|
|
33
|
+
imageOffsetY,
|
|
34
|
+
isEnableShowOtherImage
|
|
35
|
+
});
|
|
36
|
+
isEnableGlassEffect && displayZoomLen({
|
|
37
|
+
zoomLens,
|
|
38
|
+
zoomSize,
|
|
39
|
+
zoomValue,
|
|
40
|
+
imagePosition,
|
|
41
|
+
slideWidth,
|
|
42
|
+
slideHeight,
|
|
43
|
+
imageOffsetX,
|
|
44
|
+
imageOffsetY
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
const displayOtherImage = ({ featureImageHoverDom })=>{
|
|
48
|
+
if (!featureImageHoverDom) return;
|
|
49
|
+
featureImageHoverDom.style.opacity = '1';
|
|
50
|
+
featureImageHoverDom.style.top = '0px';
|
|
51
|
+
featureImageHoverDom.style.left = '0px';
|
|
52
|
+
featureImageHoverDom.style.width = '100%';
|
|
53
|
+
};
|
|
54
|
+
const displayZoomLen = ({ zoomLens, zoomSize, zoomValue, slideWidth, slideHeight, imageOffsetX, imageOffsetY })=>{
|
|
55
|
+
if (!zoomLens) return;
|
|
56
|
+
zoomLens.style.opacity = '1';
|
|
57
|
+
const w = zoomLens.offsetWidth / 2;
|
|
58
|
+
const h = zoomLens.offsetHeight / 2;
|
|
59
|
+
const imageHeight = slideHeight || 1;
|
|
60
|
+
if (imageOffsetX > slideWidth - w / zoomValue) {
|
|
61
|
+
imageOffsetX = slideWidth - w / zoomValue;
|
|
62
|
+
}
|
|
63
|
+
if (imageOffsetX < w / zoomValue) {
|
|
64
|
+
imageOffsetX = w / zoomValue;
|
|
65
|
+
}
|
|
66
|
+
if (imageOffsetY > imageHeight - h / zoomValue) {
|
|
67
|
+
imageOffsetY = imageHeight - h / zoomValue;
|
|
68
|
+
}
|
|
69
|
+
if (imageOffsetY < h / zoomValue) {
|
|
70
|
+
imageOffsetY = h / zoomValue;
|
|
71
|
+
}
|
|
72
|
+
zoomLens.style.top = imageOffsetY - h + 'px';
|
|
73
|
+
zoomLens.style.left = imageOffsetX - w + 'px';
|
|
74
|
+
zoomLens.style.backgroundSize = zoomSize + 'px ' + imageHeight * zoomValue + 'px';
|
|
75
|
+
zoomLens.style.backgroundPosition = `-${imageOffsetX * zoomValue - w}px -${imageOffsetY * zoomValue - h}px`;
|
|
76
|
+
};
|
|
77
|
+
const displayZoomImage = ({ featureImageDom, featureImageHoverDom, zoomSize, zoomSizeHeight, slideWidth, imageOffsetX, imageOffsetY, isEnableShowOtherImage = false })=>{
|
|
78
|
+
if (!featureImageHoverDom) return;
|
|
79
|
+
featureImageHoverDom.style.width = `${zoomSize}px`;
|
|
80
|
+
if (!isEnableShowOtherImage) featureImageHoverDom.style.height = `${zoomSizeHeight}px`;
|
|
81
|
+
featureImageHoverDom.style.opacity = '1';
|
|
82
|
+
const x = imageOffsetX / featureImageDom?.offsetWidth;
|
|
83
|
+
const y = imageOffsetY / featureImageDom?.offsetHeight;
|
|
84
|
+
featureImageHoverDom.style.top = (featureImageDom?.offsetHeight - featureImageHoverDom.offsetHeight) * y + 'px';
|
|
85
|
+
featureImageHoverDom.style.left = (slideWidth - zoomSize) * x + 'px';
|
|
86
|
+
};
|
|
87
|
+
const handleMouseOut = (event)=>{
|
|
88
|
+
const featureImageHoverDom = event.currentTarget.querySelector('img.hover-image');
|
|
89
|
+
const zoomLens = event.currentTarget.querySelector('.room-len');
|
|
90
|
+
featureImageHoverDom && (featureImageHoverDom.style.opacity = '0');
|
|
91
|
+
zoomLens && (zoomLens.style.opacity = '0');
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
exports.handleMouseMove = handleMouseMove;
|
|
95
|
+
exports.handleMouseOut = handleMouseOut;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const devices = [
|
|
6
|
+
'desktop',
|
|
7
|
+
'tablet',
|
|
8
|
+
'mobile'
|
|
9
|
+
];
|
|
10
|
+
const isFeatureMedia = (contentType)=>{
|
|
11
|
+
if (!contentType) return false;
|
|
12
|
+
return [
|
|
13
|
+
'EXTERNAL_VIDEO',
|
|
14
|
+
'MODEL_3D',
|
|
15
|
+
'VIDEO'
|
|
16
|
+
].includes(contentType);
|
|
17
|
+
};
|
|
18
|
+
const getZoomLenClass = ()=>{
|
|
19
|
+
return `!gp-flex gp-absolute gp-opacity-0 gp-h-[150px] gp-w-[150px] gp-cursor-none gp-rounded-full gp-bg-no-repeat gp-shadow-glasses gp-bg-white gp-pointer-events-none`;
|
|
20
|
+
};
|
|
21
|
+
const getZoomImageClass = ()=>{
|
|
22
|
+
return `gp-absolute gp-left-0 gp-top-0 gp-opacity-0 gp-transition-opacity gp-bg-white gp-pointer-events-none`;
|
|
23
|
+
};
|
|
24
|
+
const getDotStyleForOnlyFeaturedImage = (setting)=>{
|
|
25
|
+
let result = {};
|
|
26
|
+
devices.forEach((device)=>{
|
|
27
|
+
const position = core.getResponsiveValueByScreen(setting.position, device);
|
|
28
|
+
const dotStyle = core.getResponsiveValueByScreen(setting.dotStyle, device);
|
|
29
|
+
result = {
|
|
30
|
+
...result,
|
|
31
|
+
[device]: position === 'only-feature' ? dotStyle : 'none'
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
const checkRenderFeaturedCarousel = (setting)=>{
|
|
37
|
+
const devices = [
|
|
38
|
+
'desktop',
|
|
39
|
+
'mobile',
|
|
40
|
+
'tablet'
|
|
41
|
+
];
|
|
42
|
+
let isShow = false;
|
|
43
|
+
devices.forEach((device)=>{
|
|
44
|
+
const show = checkShowCarousel(setting, device);
|
|
45
|
+
if (checkShowCarousel(setting, device)) {
|
|
46
|
+
isShow = show;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return isShow;
|
|
50
|
+
};
|
|
51
|
+
const checkShowCarousel = (setting, device)=>{
|
|
52
|
+
return core.getResponsiveValueByScreen(setting.position, device) !== 'only-feature' || core.getResponsiveValueByScreen(setting.ftNavigationPosition, device) !== 'none' || core.getResponsiveValueByScreen(setting.ftDotStyle, device) !== 'none' || core.getResponsiveValueByScreen(setting.ftLoop, device) === true || setting.ftDragToScroll === true;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.checkRenderFeaturedCarousel = checkRenderFeaturedCarousel;
|
|
56
|
+
exports.getDotStyleForOnlyFeaturedImage = getDotStyleForOnlyFeaturedImage;
|
|
57
|
+
exports.getZoomImageClass = getZoomImageClass;
|
|
58
|
+
exports.getZoomLenClass = getZoomLenClass;
|
|
59
|
+
exports.isFeatureMedia = isFeatureMedia;
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var common = require('./common.js');
|
|
5
|
+
var productFeaturedImage = require('../../ProductImages/common/productFeaturedImage.js');
|
|
6
|
+
|
|
7
|
+
const getZoomDisplay = (largeViewInPopup)=>{
|
|
8
|
+
return common.getDisplayStyle((device)=>!core.getResponsiveValueByScreen(largeViewInPopup, device), 'flex');
|
|
9
|
+
};
|
|
10
|
+
const HORIZONTAL_LAYOUT = [
|
|
11
|
+
'right',
|
|
12
|
+
'left',
|
|
13
|
+
'inside-left',
|
|
14
|
+
'inside-right'
|
|
15
|
+
];
|
|
16
|
+
const sizeSettingDefaultForNewLayout = {
|
|
17
|
+
desktop: {
|
|
18
|
+
shape: 'square',
|
|
19
|
+
shapeValue: '1/1',
|
|
20
|
+
width: '20%',
|
|
21
|
+
height: undefined,
|
|
22
|
+
shapeLinked: true
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const getCarouselVerticalConfigByPosition = (position)=>{
|
|
26
|
+
const devices = [
|
|
27
|
+
'desktop',
|
|
28
|
+
'mobile',
|
|
29
|
+
'tablet'
|
|
30
|
+
];
|
|
31
|
+
let result = {};
|
|
32
|
+
devices.forEach((device)=>{
|
|
33
|
+
const positionDevice = core.getResponsiveValueByScreen(position, device);
|
|
34
|
+
const isHorizontalLayout = HORIZONTAL_LAYOUT.includes(positionDevice);
|
|
35
|
+
if (isHorizontalLayout) result = {
|
|
36
|
+
...result,
|
|
37
|
+
[device]: true
|
|
38
|
+
};
|
|
39
|
+
else result = {
|
|
40
|
+
...result,
|
|
41
|
+
[device]: false
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
const getMinHeightByPosition = (position, navigationPosition)=>{
|
|
47
|
+
const devices = [
|
|
48
|
+
'desktop',
|
|
49
|
+
'mobile',
|
|
50
|
+
'tablet'
|
|
51
|
+
];
|
|
52
|
+
const vertical = getCarouselVerticalConfigByPosition(position);
|
|
53
|
+
const result = {};
|
|
54
|
+
devices.forEach((device)=>{
|
|
55
|
+
const navigationStyle = core.getResponsiveValueByScreen(navigationPosition, device);
|
|
56
|
+
const deviceType = device === 'desktop' ? '' : `${device}:`;
|
|
57
|
+
result[`${deviceType}!gp-min-h-0`] = !!vertical[device] && navigationStyle === 'outside';
|
|
58
|
+
result[`${deviceType}!gp-min-h-full`] = !(vertical[device] && navigationStyle === 'outside');
|
|
59
|
+
});
|
|
60
|
+
return core.cls({
|
|
61
|
+
...result
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const getEditorMinHeightClass = (device, position, navigationPosition)=>{
|
|
65
|
+
const vertical = getCarouselVerticalConfigByPosition(position);
|
|
66
|
+
const navigationStyle = core.getResponsiveValueByScreen(navigationPosition, device);
|
|
67
|
+
return vertical[device] && navigationStyle === 'outside' ? '!gp-min-h-0' : '!gp-min-h-full';
|
|
68
|
+
};
|
|
69
|
+
const getAllowDotConfig = ()=>{
|
|
70
|
+
return {
|
|
71
|
+
desktop: false,
|
|
72
|
+
tablet: false,
|
|
73
|
+
mobile: false
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const getDotStyleConfig = ()=>{
|
|
77
|
+
return {
|
|
78
|
+
desktop: 'none',
|
|
79
|
+
tablet: 'none',
|
|
80
|
+
mobile: 'none'
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
const getSettingWidthForGridItem = (setting)=>{
|
|
84
|
+
let result = {};
|
|
85
|
+
const DEVICES = [
|
|
86
|
+
'desktop',
|
|
87
|
+
'mobile',
|
|
88
|
+
'tablet'
|
|
89
|
+
];
|
|
90
|
+
DEVICES.forEach((device)=>{
|
|
91
|
+
const widthDevice = core.getResponsiveValueByScreen(setting.shapeByLayout, device)?.width;
|
|
92
|
+
const itemSpacingDevice = core.getResponsiveValueByScreen(setting.itemSpacing, device);
|
|
93
|
+
let itemPerLine = 0;
|
|
94
|
+
if (widthDevice?.includes('%')) {
|
|
95
|
+
itemPerLine = 100 / parseInt(widthDevice);
|
|
96
|
+
}
|
|
97
|
+
result = {
|
|
98
|
+
...result,
|
|
99
|
+
[device]: itemPerLine ? `calc(${widthDevice} - ${itemSpacingDevice} * ${itemPerLine - 1} / ${itemPerLine})` : widthDevice
|
|
100
|
+
};
|
|
101
|
+
});
|
|
102
|
+
return result;
|
|
103
|
+
};
|
|
104
|
+
const getSettingWidthForCarouselItem = (setting)=>{
|
|
105
|
+
let result = {};
|
|
106
|
+
const DEVICES = [
|
|
107
|
+
'desktop',
|
|
108
|
+
'mobile',
|
|
109
|
+
'tablet'
|
|
110
|
+
];
|
|
111
|
+
DEVICES.forEach((device)=>{
|
|
112
|
+
const layout = core.getResponsiveValueByScreen(setting.position, device);
|
|
113
|
+
const isLayoutBottom = layout === 'bottom-center';
|
|
114
|
+
const itemWidth = core.getResponsiveValueByScreen(setting.shapeByLayout, device)?.width;
|
|
115
|
+
result = {
|
|
116
|
+
...result,
|
|
117
|
+
[device]: isLayoutBottom && itemWidth?.includes('px') ? itemWidth : '100%'
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
return result;
|
|
121
|
+
};
|
|
122
|
+
const getSettingMinWidthForCarouselItem = (setting)=>{
|
|
123
|
+
let result = {};
|
|
124
|
+
const DEVICES = [
|
|
125
|
+
'desktop',
|
|
126
|
+
'mobile',
|
|
127
|
+
'tablet'
|
|
128
|
+
];
|
|
129
|
+
DEVICES.forEach((device)=>{
|
|
130
|
+
const layout = core.getResponsiveValueByScreen(setting.position, device);
|
|
131
|
+
const spacing = productFeaturedImage.convertUnitToNumber(core.getResponsiveValueByScreen(setting.spacing, device), 5);
|
|
132
|
+
const isLayoutBottom = layout === 'bottom-center' || layout === 'inside-bottom';
|
|
133
|
+
const itemWidth = core.getResponsiveValueByScreen(setting.shapeByLayout, device)?.width;
|
|
134
|
+
let value = '100%';
|
|
135
|
+
if (isLayoutBottom) {
|
|
136
|
+
const itemsPerSlide = 100 / productFeaturedImage.convertUnitToNumber(itemWidth, 20);
|
|
137
|
+
value = itemWidth?.includes('px') ? itemWidth : itemWidth?.includes('%') ? `calc(${itemWidth} - ${(itemsPerSlide - 1) * spacing / itemsPerSlide}px)` : '100%';
|
|
138
|
+
}
|
|
139
|
+
result = {
|
|
140
|
+
...result,
|
|
141
|
+
[device]: value
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
return result;
|
|
145
|
+
};
|
|
146
|
+
const checkDisplayGalleryByWidth = (setting)=>{
|
|
147
|
+
let result = {
|
|
148
|
+
desktop: true,
|
|
149
|
+
tablet: true,
|
|
150
|
+
mobile: true
|
|
151
|
+
};
|
|
152
|
+
const DEVICES = [
|
|
153
|
+
'desktop',
|
|
154
|
+
'mobile',
|
|
155
|
+
'tablet'
|
|
156
|
+
];
|
|
157
|
+
DEVICES.forEach((device)=>{
|
|
158
|
+
const itemWidth = core.getResponsiveValueByScreen(setting.shapeByLayout, device)?.width ?? '100%';
|
|
159
|
+
const isDisplay = parseInt(itemWidth) !== 0;
|
|
160
|
+
result = {
|
|
161
|
+
...result,
|
|
162
|
+
[device]: isDisplay
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
return result;
|
|
166
|
+
};
|
|
167
|
+
const getSliderPerShowConfig = (shapeByLayout, position)=>{
|
|
168
|
+
let result = {
|
|
169
|
+
desktop: 'auto',
|
|
170
|
+
tablet: 'auto',
|
|
171
|
+
mobile: 'auto'
|
|
172
|
+
};
|
|
173
|
+
const DEVICES = [
|
|
174
|
+
'desktop',
|
|
175
|
+
'mobile',
|
|
176
|
+
'tablet'
|
|
177
|
+
];
|
|
178
|
+
DEVICES.forEach((device)=>{
|
|
179
|
+
const layout = core.getResponsiveValueByScreen(position, device);
|
|
180
|
+
const isLayoutBottom = layout === 'bottom-center' || layout === 'inside-bottom';
|
|
181
|
+
const itemWidth = core.getResponsiveValueByScreen(shapeByLayout, device)?.width;
|
|
182
|
+
let itemPerShow = 'auto';
|
|
183
|
+
if (itemWidth?.includes('%')) {
|
|
184
|
+
itemPerShow = parseInt(itemWidth) < 100 ? 100 / parseInt(itemWidth) : 'auto';
|
|
185
|
+
}
|
|
186
|
+
result = {
|
|
187
|
+
...result,
|
|
188
|
+
[device]: isLayoutBottom ? itemPerShow : 'auto'
|
|
189
|
+
};
|
|
190
|
+
});
|
|
191
|
+
return result;
|
|
192
|
+
};
|
|
193
|
+
const getShapeByLayout = (setting, position)=>{
|
|
194
|
+
let shapeByLayout = {};
|
|
195
|
+
const DEVICES = [
|
|
196
|
+
'desktop',
|
|
197
|
+
'mobile',
|
|
198
|
+
'tablet'
|
|
199
|
+
];
|
|
200
|
+
DEVICES.forEach((device)=>{
|
|
201
|
+
const layout = core.getResponsiveValueByScreen(position, device);
|
|
202
|
+
switch(layout){
|
|
203
|
+
case 'bottom-center':
|
|
204
|
+
case 'bottom-left':
|
|
205
|
+
shapeByLayout = {
|
|
206
|
+
...shapeByLayout,
|
|
207
|
+
[device]: core.getResponsiveValueByScreen(setting.shapeForBottom, device)
|
|
208
|
+
};
|
|
209
|
+
break;
|
|
210
|
+
case 'inside-bottom':
|
|
211
|
+
shapeByLayout = {
|
|
212
|
+
...shapeByLayout,
|
|
213
|
+
[device]: core.getResponsiveValueByScreen(setting.shapeForInsideBottom ?? sizeSettingDefaultForNewLayout, device)
|
|
214
|
+
};
|
|
215
|
+
break;
|
|
216
|
+
case 'left':
|
|
217
|
+
case 'right':
|
|
218
|
+
shapeByLayout = {
|
|
219
|
+
...shapeByLayout,
|
|
220
|
+
[device]: core.getResponsiveValueByScreen(setting.shape, device)
|
|
221
|
+
};
|
|
222
|
+
break;
|
|
223
|
+
case 'inside-left':
|
|
224
|
+
case 'inside-right':
|
|
225
|
+
shapeByLayout = {
|
|
226
|
+
...shapeByLayout,
|
|
227
|
+
[device]: core.getResponsiveValueByScreen(setting.shapeForInside ?? sizeSettingDefaultForNewLayout, device)
|
|
228
|
+
};
|
|
229
|
+
break;
|
|
230
|
+
case 'only-feature':
|
|
231
|
+
shapeByLayout = {
|
|
232
|
+
...shapeByLayout,
|
|
233
|
+
[device]: core.getResponsiveValueByScreen(setting.shapeForFtOnly, device)
|
|
234
|
+
};
|
|
235
|
+
break;
|
|
236
|
+
case 'one-col':
|
|
237
|
+
shapeByLayout = {
|
|
238
|
+
...shapeByLayout,
|
|
239
|
+
[device]: core.getResponsiveValueByScreen(setting.shapeFor1Col, device)
|
|
240
|
+
};
|
|
241
|
+
break;
|
|
242
|
+
case 'two-col':
|
|
243
|
+
shapeByLayout = {
|
|
244
|
+
...shapeByLayout,
|
|
245
|
+
[device]: core.getResponsiveValueByScreen(setting.shapeFor2Col, device)
|
|
246
|
+
};
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
return shapeByLayout;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
exports.HORIZONTAL_LAYOUT = HORIZONTAL_LAYOUT;
|
|
254
|
+
exports.checkDisplayGalleryByWidth = checkDisplayGalleryByWidth;
|
|
255
|
+
exports.getAllowDotConfig = getAllowDotConfig;
|
|
256
|
+
exports.getCarouselVerticalConfigByPosition = getCarouselVerticalConfigByPosition;
|
|
257
|
+
exports.getDotStyleConfig = getDotStyleConfig;
|
|
258
|
+
exports.getEditorMinHeightClass = getEditorMinHeightClass;
|
|
259
|
+
exports.getMinHeightByPosition = getMinHeightByPosition;
|
|
260
|
+
exports.getSettingMinWidthForCarouselItem = getSettingMinWidthForCarouselItem;
|
|
261
|
+
exports.getSettingWidthForCarouselItem = getSettingWidthForCarouselItem;
|
|
262
|
+
exports.getSettingWidthForGridItem = getSettingWidthForGridItem;
|
|
263
|
+
exports.getShapeByLayout = getShapeByLayout;
|
|
264
|
+
exports.getSliderPerShowConfig = getSliderPerShowConfig;
|
|
265
|
+
exports.getZoomDisplay = getZoomDisplay;
|
|
266
|
+
exports.sizeSettingDefaultForNewLayout = sizeSettingDefaultForNewLayout;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
const MediaIcon = ({ contentType })=>{
|
|
9
|
+
const isVideoSource = contentType == 'VIDEO' || contentType == 'EXTERNAL_VIDEO';
|
|
10
|
+
const isModel3D = contentType == 'MODEL_3D';
|
|
11
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
12
|
+
children: (isVideoSource || isModel3D) && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
13
|
+
className: "gp-absolute gp-bottom-0 gp-right-0 gp-pb-[15px] gp-pr-[15px]",
|
|
14
|
+
children: [
|
|
15
|
+
isVideoSource && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
16
|
+
width: "24",
|
|
17
|
+
height: "24",
|
|
18
|
+
viewBox: "0 0 24 24",
|
|
19
|
+
fill: "none",
|
|
20
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
23
|
+
opacity: "0.9",
|
|
24
|
+
width: "24",
|
|
25
|
+
height: "24",
|
|
26
|
+
rx: "3",
|
|
27
|
+
fill: "#212121"
|
|
28
|
+
}),
|
|
29
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
30
|
+
d: "M17.6869 12.2646L17.6868 12.2646L6.78379 18.4464C6.78378 18.4464 6.78376 18.4464 6.78374 18.4464C6.52931 18.5903 6.1665 18.4179 6.1665 18.0416V5.95844C6.1665 5.58218 6.52917 5.40981 6.7836 5.55354C6.78366 5.55357 6.78373 5.55361 6.78379 5.55365L17.6868 11.7354L17.6869 11.7354C17.8819 11.846 17.8819 12.154 17.6869 12.2646Z",
|
|
31
|
+
stroke: "#F9F9F9",
|
|
32
|
+
strokeMiterlimit: "10"
|
|
33
|
+
})
|
|
34
|
+
]
|
|
35
|
+
}),
|
|
36
|
+
isModel3D && /*#__PURE__*/ jsxRuntime.jsxs("svg", {
|
|
37
|
+
width: "24",
|
|
38
|
+
height: "24",
|
|
39
|
+
viewBox: "0 0 24 24",
|
|
40
|
+
fill: "none",
|
|
41
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsxRuntime.jsx("rect", {
|
|
44
|
+
opacity: "0.9",
|
|
45
|
+
width: "24",
|
|
46
|
+
height: "24",
|
|
47
|
+
rx: "3",
|
|
48
|
+
fill: "#212121"
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
51
|
+
fillRule: "evenodd",
|
|
52
|
+
clipRule: "evenodd",
|
|
53
|
+
d: "M11.7441 4.57034C11.9017 4.47655 12.098 4.47655 12.2555 4.57034L18.5889 8.33957C18.7404 8.42971 18.8332 8.59296 18.8332 8.76923V15.2308C18.8332 15.407 18.7404 15.5703 18.5889 15.6604L12.2555 19.4297C12.098 19.5234 11.9017 19.5234 11.7441 19.4297L5.41079 15.6604C5.25932 15.5703 5.1665 15.407 5.1665 15.2308V8.76923C5.1665 8.59296 5.25932 8.42971 5.41079 8.33957L11.7441 4.57034ZM6.1665 9.64865V14.9465L11.4998 18.1206V12.8227L6.1665 9.64865ZM12.4998 12.8227V18.1206L17.8332 14.9465V9.64865L12.4998 12.8227ZM17.3555 8.76923L11.9998 11.9566L6.64417 8.76923L11.9998 5.58185L17.3555 8.76923Z",
|
|
54
|
+
fill: "#F9F9F9"
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.default = MediaIcon;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
require('next/link');
|
|
8
|
+
require('@gem-sdk/core');
|
|
9
|
+
var Video = require('../../../../../video/components/Video.js');
|
|
10
|
+
|
|
11
|
+
const ProductFeatureVideo = (props)=>{
|
|
12
|
+
const { url, aspectRatio } = props;
|
|
13
|
+
const videoType = React.useMemo(()=>{
|
|
14
|
+
if (url.includes('youtu.be')) return 'youtube';
|
|
15
|
+
if (url.includes('vimeo')) return 'vimeo';
|
|
16
|
+
return 'html5';
|
|
17
|
+
}, [
|
|
18
|
+
url
|
|
19
|
+
]);
|
|
20
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
21
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(Video.default, {
|
|
22
|
+
setting: {
|
|
23
|
+
type: videoType,
|
|
24
|
+
html5Url: url,
|
|
25
|
+
youtubeUrl: url,
|
|
26
|
+
vimeoUrl: url,
|
|
27
|
+
preload: true,
|
|
28
|
+
controls: true,
|
|
29
|
+
aspectRatio
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var ProductFeatureVideo$1 = /*#__PURE__*/ React.memo(ProductFeatureVideo);
|
|
35
|
+
|
|
36
|
+
exports.default = ProductFeatureVideo$1;
|
package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var core = require('@gem-sdk/core');
|
|
8
|
+
var hoverAction = require('../../common/hoverAction.js');
|
|
9
|
+
var getProductImagesStyles = require('../../composables/getProductImagesStyles.js');
|
|
10
|
+
var getProductImagesClassName = require('../../composables/getProductImagesClassName.js');
|
|
11
|
+
var getProductImagesAttr = require('../../composables/getProductImagesAttr.js');
|
|
12
|
+
var system = require('@gem-sdk/system');
|
|
13
|
+
var getStyle = require('../../common/getStyle.js');
|
|
14
|
+
var Carousel = require('../../../../../carousel/root/Carousel.js');
|
|
15
|
+
var CarouselItem = require('../../../../../carousel/carousel-item/CarouselItem.js');
|
|
16
|
+
var ProductFeaturedImageOnly = require('./ProductFeaturedImageOnly.js');
|
|
17
|
+
var useProductFeaturedImageCarousel = require('../../hooks/useProductFeaturedImageCarousel.js');
|
|
18
|
+
|
|
19
|
+
const ProductFeaturedImageCarousel = (props)=>{
|
|
20
|
+
const { productImages, imgRef, onHandleClick, onClickArrow, onHandleLoaded, onHandleUpdateActiveIndex, builderPropUID, builderPropsClass, children, parentUid, ...setting } = props;
|
|
21
|
+
const { ref, imageActive, imageActiveIndex, imageShowWhenHover, enableOpenLightBox, filteredProductImages, isRenderFeatureCarousel, genRandomKey, getAspectRatioFinal, emitUpdateActiveIndex } = useProductFeaturedImageCarousel.useProductFeaturedImageCarousel(props);
|
|
22
|
+
const currentDevice = core.useCurrentDevice();
|
|
23
|
+
const { galleryItemClasses, featureImageOnlyOneImageClasses } = getProductImagesClassName.getProductImagesClassName(setting);
|
|
24
|
+
const { featuredImageCarouselStyle, featureImageCarouselItemStyle } = getProductImagesStyles.getProductImagesStyles(setting);
|
|
25
|
+
const featureImageOnlyOneImageStyle = system.createStyle({
|
|
26
|
+
...getStyle.getFeaturedImageOnlyOneImageStyle({
|
|
27
|
+
setting,
|
|
28
|
+
options: {
|
|
29
|
+
enableRadius: true,
|
|
30
|
+
enableHeight: true
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
const { featuredImageCarouselSettingAttrs } = getProductImagesAttr.getProductImagesAttr(setting);
|
|
35
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
36
|
+
ref: ref,
|
|
37
|
+
"data-slot": "children",
|
|
38
|
+
className: "product-feature-image",
|
|
39
|
+
children: isRenderFeatureCarousel ? /*#__PURE__*/ jsxRuntime.jsxs(Carousel.default, {
|
|
40
|
+
parentClass: builderPropsClass,
|
|
41
|
+
elmRef: imgRef,
|
|
42
|
+
setting: featuredImageCarouselSettingAttrs,
|
|
43
|
+
styles: featuredImageCarouselStyle,
|
|
44
|
+
builderProps: {
|
|
45
|
+
uid: builderPropUID
|
|
46
|
+
},
|
|
47
|
+
isHiddenArrowWhenDisabled: true,
|
|
48
|
+
onLoaded: (status)=>onHandleLoaded && onHandleLoaded(status),
|
|
49
|
+
onChangeActive: (index)=>emitUpdateActiveIndex(index),
|
|
50
|
+
onClickArrow: ()=>onClickArrow && onClickArrow(genRandomKey()),
|
|
51
|
+
moveToIdx: imageActiveIndex,
|
|
52
|
+
disableMarginAuto: true,
|
|
53
|
+
onHandleChangeSlideByInteraction: (idx)=>{
|
|
54
|
+
const length = filteredProductImages?.length ?? 0;
|
|
55
|
+
const index = idx >= length ? 0 : idx;
|
|
56
|
+
onHandleClick(filteredProductImages?.[index]?.id ?? '', enableOpenLightBox);
|
|
57
|
+
},
|
|
58
|
+
children: [
|
|
59
|
+
children,
|
|
60
|
+
filteredProductImages?.map((image)=>{
|
|
61
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CarouselItem.default, {
|
|
62
|
+
contentType: "productImage",
|
|
63
|
+
className: galleryItemClasses('gp-ft-image-item'),
|
|
64
|
+
onClickItem: ()=>{
|
|
65
|
+
const clickEffect = core.getResponsiveValueByScreen(setting?.ftClickOpenLightBox, currentDevice);
|
|
66
|
+
if (clickEffect !== 'none') onHandleClick(image?.id ?? '', enableOpenLightBox);
|
|
67
|
+
},
|
|
68
|
+
style: featureImageCarouselItemStyle,
|
|
69
|
+
onMouseMove: (e)=>hoverAction.handleMouseMove(e, setting),
|
|
70
|
+
onMouseOut: (e)=>hoverAction.handleMouseOut(e),
|
|
71
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ProductFeaturedImageOnly.default, {
|
|
72
|
+
image: image,
|
|
73
|
+
imageShowWhenHover: imageShowWhenHover,
|
|
74
|
+
setting: setting,
|
|
75
|
+
aspectRatio: getAspectRatioFinal()
|
|
76
|
+
})
|
|
77
|
+
}, image?.id);
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
81
|
+
ref: imgRef,
|
|
82
|
+
className: "gp-flex gp-w-full",
|
|
83
|
+
style: {
|
|
84
|
+
...core.makeStyleResponsive('jc', setting?.align)
|
|
85
|
+
},
|
|
86
|
+
"data-id": builderPropUID,
|
|
87
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
88
|
+
"aria-hidden": "true",
|
|
89
|
+
className: featureImageOnlyOneImageClasses,
|
|
90
|
+
style: featureImageOnlyOneImageStyle,
|
|
91
|
+
onMouseMove: (e)=>hoverAction.handleMouseMove(e, setting),
|
|
92
|
+
onMouseOut: (e)=>hoverAction.handleMouseOut(e),
|
|
93
|
+
onBlur: ()=>void 0,
|
|
94
|
+
onClick: ()=>{
|
|
95
|
+
onHandleClick(imageActive?.id ?? '', enableOpenLightBox);
|
|
96
|
+
},
|
|
97
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ProductFeaturedImageOnly.default, {
|
|
98
|
+
image: imageActive,
|
|
99
|
+
imageShowWhenHover: imageShowWhenHover,
|
|
100
|
+
setting: setting,
|
|
101
|
+
aspectRatio: getAspectRatioFinal(imageActive)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
});
|
|
106
|
+
};
|
|
107
|
+
var ProductFeaturedImageCarousel$1 = /*#__PURE__*/ React.memo(ProductFeaturedImageCarousel);
|
|
108
|
+
|
|
109
|
+
exports.default = ProductFeaturedImageCarousel$1;
|