@gem-sdk/components 2.0.0-dev.622 → 2.0.0-dev.624
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/collection/components/collection-paginator/common/styles.js +3 -4
- package/dist/cjs/collection/components/collection-paginator/components/CollectionPaginator.liquid.js +2 -1
- package/dist/cjs/collection/setting/collection-paginator/configs/settings.js +2 -3
- 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/collection/components/collection-paginator/common/styles.js +3 -4
- package/dist/esm/collection/components/collection-paginator/components/CollectionPaginator.liquid.js +2 -1
- package/dist/esm/collection/setting/collection-paginator/configs/settings.js +2 -3
- 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
package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var core = require('@gem-sdk/core');
|
|
8
|
+
var React = require('react');
|
|
9
|
+
var NextImage = require('../../../../../image/components/NextImage.js');
|
|
10
|
+
var MediaIcon = require('./MediaIcon.js');
|
|
11
|
+
var productFeaturedImage = require('../../common/productFeaturedImage.js');
|
|
12
|
+
var ProductFeatureVideo = require('./ProductFeatureVideo.js');
|
|
13
|
+
|
|
14
|
+
const defaultImage = {
|
|
15
|
+
src: 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
|
|
16
|
+
id: `noImageError`,
|
|
17
|
+
width: 480,
|
|
18
|
+
height: 480,
|
|
19
|
+
alt: `no image`,
|
|
20
|
+
contentType: 'IMAGE'
|
|
21
|
+
};
|
|
22
|
+
const ProductFeaturedImageOnly = ({ image, imageShowWhenHover, setting, aspectRatio })=>{
|
|
23
|
+
const product = core.useProduct();
|
|
24
|
+
const currentDevice = core.useCurrentDevice();
|
|
25
|
+
const storefrontUrl = core.useShopStore((state)=>state.storefrontUrl);
|
|
26
|
+
const mode = core.useEditorMode();
|
|
27
|
+
const isClickEffect = React.useMemo(()=>core.getResponsiveValueByScreen(setting.ftClickOpenLightBox, currentDevice) !== 'none', [
|
|
28
|
+
currentDevice,
|
|
29
|
+
setting.ftClickOpenLightBox
|
|
30
|
+
]);
|
|
31
|
+
const isRenderVideo = React.useMemo(()=>mode !== 'edit' && [
|
|
32
|
+
'VIDEO',
|
|
33
|
+
'EXTERNAL_VIDEO'
|
|
34
|
+
].includes(image?.contentType || '') && !isClickEffect, [
|
|
35
|
+
mode,
|
|
36
|
+
image?.contentType,
|
|
37
|
+
isClickEffect
|
|
38
|
+
]);
|
|
39
|
+
const renderImage = React.useMemo(()=>{
|
|
40
|
+
if (!image) return defaultImage;
|
|
41
|
+
return {
|
|
42
|
+
...image,
|
|
43
|
+
src: isRenderVideo ? image.src : productFeaturedImage.isFeatureMedia(image?.contentType) ? image?.previewImage : image.src
|
|
44
|
+
};
|
|
45
|
+
}, [
|
|
46
|
+
image,
|
|
47
|
+
isRenderVideo
|
|
48
|
+
]);
|
|
49
|
+
const shopifyProductLink = React.useMemo(()=>{
|
|
50
|
+
if (!storefrontUrl) return `#`;
|
|
51
|
+
const url = new URL(storefrontUrl);
|
|
52
|
+
if (product) {
|
|
53
|
+
return `${url.protocol}//${url.host}/products/${product.handle}`;
|
|
54
|
+
}
|
|
55
|
+
return `#`;
|
|
56
|
+
}, [
|
|
57
|
+
storefrontUrl,
|
|
58
|
+
product
|
|
59
|
+
]);
|
|
60
|
+
const handleProductLink = (children)=>{
|
|
61
|
+
if (core.getResponsiveValueByScreen(setting.ftClickOpenLightBox, currentDevice) === 'product-link') return /*#__PURE__*/ jsxRuntime.jsx("a", {
|
|
62
|
+
title: product?.title,
|
|
63
|
+
href: shopifyProductLink,
|
|
64
|
+
className: "gp-w-full",
|
|
65
|
+
children: children
|
|
66
|
+
});
|
|
67
|
+
return children;
|
|
68
|
+
};
|
|
69
|
+
const isRenderHoverImage = React.useMemo(()=>setting?.hoverEffect !== 'none' && !productFeaturedImage.isFeatureMedia(renderImage?.contentType), [
|
|
70
|
+
renderImage?.contentType,
|
|
71
|
+
setting?.hoverEffect
|
|
72
|
+
]);
|
|
73
|
+
const isZoomImage = React.useMemo(()=>setting?.hoverEffect == 'zoom' && setting?.zoomType == 'glasses' && !productFeaturedImage.isFeatureMedia(renderImage?.contentType), [
|
|
74
|
+
renderImage?.contentType,
|
|
75
|
+
setting?.hoverEffect,
|
|
76
|
+
setting?.zoomType
|
|
77
|
+
]);
|
|
78
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
79
|
+
children: handleProductLink(/*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
80
|
+
children: isRenderVideo ? /*#__PURE__*/ jsxRuntime.jsx(ProductFeatureVideo.default, {
|
|
81
|
+
type: renderImage?.contentType,
|
|
82
|
+
url: renderImage.src ?? '',
|
|
83
|
+
aspectRatio: aspectRatio
|
|
84
|
+
}) : /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ jsxRuntime.jsx(NextImage.default, {
|
|
87
|
+
draggable: "false",
|
|
88
|
+
src: renderImage.src,
|
|
89
|
+
width: renderImage?.width,
|
|
90
|
+
height: renderImage?.height,
|
|
91
|
+
alt: renderImage?.alt,
|
|
92
|
+
setting: {
|
|
93
|
+
aspectRatio: aspectRatio,
|
|
94
|
+
layout: setting?.ftLayout
|
|
95
|
+
},
|
|
96
|
+
priority: setting?.preload,
|
|
97
|
+
className: "featured-image-only",
|
|
98
|
+
style: {
|
|
99
|
+
width: '100%',
|
|
100
|
+
height: '100%',
|
|
101
|
+
cursor: 'pointer'
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ jsxRuntime.jsx(MediaIcon.default, {
|
|
105
|
+
contentType: renderImage?.contentType ?? ''
|
|
106
|
+
}),
|
|
107
|
+
isRenderHoverImage && /*#__PURE__*/ jsxRuntime.jsx(NextImage.default, {
|
|
108
|
+
draggable: "false",
|
|
109
|
+
src: setting?.hoverEffect === 'other' ? imageShowWhenHover?.src : renderImage.src,
|
|
110
|
+
width: setting?.hoverEffect === 'other' ? imageShowWhenHover?.width : renderImage.width,
|
|
111
|
+
height: setting?.hoverEffect === 'other' ? imageShowWhenHover?.height : renderImage.height,
|
|
112
|
+
alt: setting?.hoverEffect === 'other' ? imageShowWhenHover?.alt : renderImage.alt,
|
|
113
|
+
setting: {
|
|
114
|
+
layout: setting.ftLayout,
|
|
115
|
+
aspectRatio: aspectRatio
|
|
116
|
+
},
|
|
117
|
+
style: {
|
|
118
|
+
width: '100%',
|
|
119
|
+
height: '100%'
|
|
120
|
+
},
|
|
121
|
+
className: core.cls('hover-image featured-image-only !gp-max-w-none', productFeaturedImage.getZoomImageClass()),
|
|
122
|
+
priority: setting?.preload
|
|
123
|
+
}),
|
|
124
|
+
isZoomImage && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
125
|
+
className: core.cls(productFeaturedImage.getZoomLenClass(), 'room-len'),
|
|
126
|
+
style: {
|
|
127
|
+
...core.makeStyle({
|
|
128
|
+
bgi: `url("${renderImage?.src}")`
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
})
|
|
134
|
+
}))
|
|
135
|
+
});
|
|
136
|
+
};
|
|
137
|
+
var ProductFeaturedImageOnly$1 = /*#__PURE__*/ React.memo(ProductFeaturedImageOnly);
|
|
138
|
+
|
|
139
|
+
exports.default = ProductFeaturedImageOnly$1;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var core = require('@gem-sdk/core');
|
|
7
|
+
var React = require('react');
|
|
8
|
+
var common = require('../../common/common.js');
|
|
9
|
+
var NextImage = require('../../../../../image/components/NextImage.js');
|
|
10
|
+
var ButtonOpenLightBox = require('../lightbox/ButtonOpenLightBox.js');
|
|
11
|
+
var MediaIcon = require('./MediaIcon.js');
|
|
12
|
+
var productFeaturedImage = require('../../common/productFeaturedImage.js');
|
|
13
|
+
var hoverAction = require('../../common/hoverAction.js');
|
|
14
|
+
var getProductImagesClassName = require('../../composables/getProductImagesClassName.js');
|
|
15
|
+
var getProductImagesStyles = require('../../composables/getProductImagesStyles.js');
|
|
16
|
+
var useProductGalleryGrid = require('../../hooks/useProductGalleryGrid.js');
|
|
17
|
+
|
|
18
|
+
const ProductGalleryGrid = (props)=>{
|
|
19
|
+
const { builderPropUID, productImages, onHandleClick, activeIndexFormFeatureImage, children, isHiddenInteraction, ...setting } = props;
|
|
20
|
+
const { isDisplay, shapeByLayout, imageActiveIndex, enableOpenLightBox, isEnableBorderActive, filteredProductImages } = useProductGalleryGrid.useProductGalleryGrid(props);
|
|
21
|
+
const currentDevice = core.useCurrentDevice();
|
|
22
|
+
const { galleryGridWrapperClasses, galleryItemClasses } = getProductImagesClassName.getProductImagesClassName(setting);
|
|
23
|
+
const { galleryGridStyles, galleryGridItemStyles } = getProductImagesStyles.getProductImagesStyles(setting);
|
|
24
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
25
|
+
children: isDisplay && /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
26
|
+
"data-slot": "children",
|
|
27
|
+
"data-id": builderPropUID,
|
|
28
|
+
className: galleryGridWrapperClasses,
|
|
29
|
+
style: galleryGridStyles,
|
|
30
|
+
"gp-data-hidden": `${isHiddenInteraction}`,
|
|
31
|
+
children: [
|
|
32
|
+
filteredProductImages?.map((image, index)=>{
|
|
33
|
+
const canActive = index === imageActiveIndex;
|
|
34
|
+
const imageSrc = productFeaturedImage.isFeatureMedia(image.contentType) ? image.previewImage : image.src;
|
|
35
|
+
return(// eslint-disable-next-line jsx-a11y/mouse-events-have-key-events
|
|
36
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
37
|
+
"aria-hidden": true,
|
|
38
|
+
className: galleryItemClasses(`gem-slider-item-${builderPropUID}
|
|
39
|
+
${canActive && isEnableBorderActive ? 'gem-slider-item-active' : ''}`),
|
|
40
|
+
onClick: ()=>onHandleClick(image?.id || '', enableOpenLightBox),
|
|
41
|
+
style: galleryGridItemStyles,
|
|
42
|
+
onMouseMove: (e)=>hoverAction.handleMouseMove(e, {
|
|
43
|
+
hoverEffect: setting.galleryHoverEffect,
|
|
44
|
+
zoom: setting.galleryZoom,
|
|
45
|
+
zoomType: setting.galleryZoomType
|
|
46
|
+
}),
|
|
47
|
+
onMouseOut: (e)=>hoverAction.handleMouseOut(e),
|
|
48
|
+
"data-border": canActive && !!setting?.borderActive ? 'active' : 'deactive',
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ jsxRuntime.jsx(NextImage.default, {
|
|
51
|
+
src: imageSrc,
|
|
52
|
+
width: image?.width,
|
|
53
|
+
height: image?.height,
|
|
54
|
+
alt: image?.alt,
|
|
55
|
+
setting: {
|
|
56
|
+
aspectRatio: common.getAspectRatio(shapeByLayout),
|
|
57
|
+
layout: setting?.layout
|
|
58
|
+
},
|
|
59
|
+
style: {
|
|
60
|
+
width: '100%',
|
|
61
|
+
height: '100%'
|
|
62
|
+
}
|
|
63
|
+
}, image?.id),
|
|
64
|
+
/*#__PURE__*/ jsxRuntime.jsx(MediaIcon.default, {
|
|
65
|
+
contentType: image?.contentType || ''
|
|
66
|
+
}),
|
|
67
|
+
setting?.galleryHoverEffect !== 'none' && !productFeaturedImage.isFeatureMedia(image?.contentType) && /*#__PURE__*/ jsxRuntime.jsx(NextImage.default, {
|
|
68
|
+
src: imageSrc,
|
|
69
|
+
width: image?.width,
|
|
70
|
+
height: image?.height,
|
|
71
|
+
alt: image?.alt,
|
|
72
|
+
setting: {
|
|
73
|
+
layout: setting.layout,
|
|
74
|
+
aspectRatio: common.getAspectRatio(shapeByLayout)
|
|
75
|
+
},
|
|
76
|
+
className: core.cls('hover-image !gp-max-w-none', productFeaturedImage.getZoomImageClass())
|
|
77
|
+
}),
|
|
78
|
+
setting?.galleryHoverEffect == 'zoom' && setting?.galleryZoomType == 'glasses' && [
|
|
79
|
+
'one-col',
|
|
80
|
+
'two-col'
|
|
81
|
+
].includes(core.getResponsiveValueByScreen(setting.position, currentDevice) || '') && !productFeaturedImage.isFeatureMedia(image?.contentType) && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
82
|
+
className: core.cls(productFeaturedImage.getZoomLenClass(), 'room-len'),
|
|
83
|
+
style: {
|
|
84
|
+
...core.makeStyle({
|
|
85
|
+
bgi: `url("${image?.src}")`
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
}),
|
|
89
|
+
core.getResponsiveValueByScreen(setting?.clickOpenLightBox, currentDevice) && /*#__PURE__*/ jsxRuntime.jsx(ButtonOpenLightBox.default, {})
|
|
90
|
+
]
|
|
91
|
+
}, image?.id));
|
|
92
|
+
}),
|
|
93
|
+
children
|
|
94
|
+
]
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
var ProductGalleryGrid$1 = /*#__PURE__*/ React.memo(ProductGalleryGrid);
|
|
99
|
+
|
|
100
|
+
exports.default = ProductGalleryGrid$1;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var core = require('@gem-sdk/core');
|
|
7
|
+
var GalleryCarousel = require('../gallery-carousel/GalleryCarousel.js');
|
|
8
|
+
var ProductGalleryGrid = require('../child/ProductGalleryGrid.js');
|
|
9
|
+
var ProductFeaturedImageCarousel = require('../child/ProductFeaturedImageCarousel.js');
|
|
10
|
+
var getProductImagesStyles = require('../../composables/getProductImagesStyles.js');
|
|
11
|
+
var getProductImagesClassName = require('../../composables/getProductImagesClassName.js');
|
|
12
|
+
var useFeatureImageWithGallery = require('../../hooks/useFeatureImageWithGallery.js');
|
|
13
|
+
|
|
14
|
+
const FeatureImageWithGallery = (props)=>{
|
|
15
|
+
const { setting, styles, builderProps, gallery, onHandleClickImage, priorityFeatureImage, children, noDataChildren } = props;
|
|
16
|
+
const settings = {
|
|
17
|
+
...setting,
|
|
18
|
+
...styles
|
|
19
|
+
};
|
|
20
|
+
const { isShowCarousel, featureImageHeight, featureWrapperImage, onClickFeatureArrow, activeIndexFromFeatureImage, setOnClickFeatureArrow, onHandleLoadedFeatureImage, setActiveIndexFromFeatureImage } = useFeatureImageWithGallery.useFeatureImageWithGallery(props);
|
|
21
|
+
if (gallery?.[0]?.id === 'noImageError') {
|
|
22
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
23
|
+
children: noDataChildren
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const { ftImageGalleryClasses, imageGalleryWrapperClasses } = getProductImagesClassName.getProductImagesClassName(props);
|
|
27
|
+
const { wrapperFeaturedImageStyle, featureImageStyle, galleryImageStyle } = getProductImagesStyles.getProductImagesStyles(settings, {
|
|
28
|
+
gallery,
|
|
29
|
+
featureImageHeight
|
|
30
|
+
});
|
|
31
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
32
|
+
className: core.cls('gp-grid gp-w-full gp-relative'),
|
|
33
|
+
style: wrapperFeaturedImageStyle,
|
|
34
|
+
children: [
|
|
35
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
36
|
+
className: ftImageGalleryClasses,
|
|
37
|
+
style: featureImageStyle,
|
|
38
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(ProductFeaturedImageCarousel.default, {
|
|
39
|
+
imgRef: featureWrapperImage,
|
|
40
|
+
productImages: gallery,
|
|
41
|
+
...settings,
|
|
42
|
+
onHandleClick: (imageID, enableOpenLightBox)=>onHandleClickImage(imageID || '', enableOpenLightBox),
|
|
43
|
+
onHandleLoaded: onHandleLoadedFeatureImage,
|
|
44
|
+
onHandleUpdateActiveIndex: setActiveIndexFromFeatureImage,
|
|
45
|
+
onClickArrow: (randomKey)=>setOnClickFeatureArrow(randomKey),
|
|
46
|
+
builderPropUID: builderProps?.uid,
|
|
47
|
+
builderPropsClass: `gp-product-images-feature-${builderProps?.uid}`,
|
|
48
|
+
children: children
|
|
49
|
+
})
|
|
50
|
+
}),
|
|
51
|
+
gallery.length > 1 && /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
52
|
+
className: imageGalleryWrapperClasses,
|
|
53
|
+
style: galleryImageStyle,
|
|
54
|
+
children: isShowCarousel ? /*#__PURE__*/ jsxRuntime.jsx(GalleryCarousel.default, {
|
|
55
|
+
productImages: gallery,
|
|
56
|
+
position: settings?.position,
|
|
57
|
+
...settings,
|
|
58
|
+
builderPropUID: builderProps?.uid,
|
|
59
|
+
onHandleClick: (imageID, enableOpenLightBox)=>onHandleClickImage(imageID || '', enableOpenLightBox),
|
|
60
|
+
activeIndexFormFeatureImage: activeIndexFromFeatureImage,
|
|
61
|
+
priorityFeatureImage: priorityFeatureImage,
|
|
62
|
+
onClickFeatureArrow: onClickFeatureArrow,
|
|
63
|
+
builderPropsClass: `gp-product-images-gallery-${builderProps?.uid}`
|
|
64
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx(ProductGalleryGrid.default, {
|
|
65
|
+
productImages: gallery,
|
|
66
|
+
...settings,
|
|
67
|
+
builderPropUID: builderProps?.uid,
|
|
68
|
+
onHandleClick: (imageID, enableOpenLightBox)=>onHandleClickImage(imageID || '', enableOpenLightBox),
|
|
69
|
+
activeIndexFormFeatureImage: activeIndexFromFeatureImage,
|
|
70
|
+
isHiddenInteraction: true
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
exports.default = FeatureImageWithGallery;
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@gem-sdk/core');
|
|
6
|
+
var common = require('../../common/common.js');
|
|
7
|
+
var productFeaturedImage = require('../../common/productFeaturedImage.js');
|
|
8
|
+
var HTML5Embed_liquid = require('../../../../../video/components/HTML5Embed.liquid.js');
|
|
9
|
+
var Modal3d_liquid = require('../../../../../image/components/Modal3d.liquid.js');
|
|
10
|
+
var NextImage_liquid = require('../../../../../image/components/NextImage.liquid.js');
|
|
11
|
+
var Video_liquid = require('../../../../../image/components/Video.liquid.js');
|
|
12
|
+
var _function = require('../../../../helpers/function.js');
|
|
13
|
+
var getProductImagesStyles = require('../../composables/getProductImagesStyles.js');
|
|
14
|
+
var getProductImagesClassName = require('../../composables/getProductImagesClassName.js');
|
|
15
|
+
var getProductImagesAttr = require('../../composables/getProductImagesAttr.js');
|
|
16
|
+
var system = require('@gem-sdk/system');
|
|
17
|
+
var SwiperItem_liquid = require('../../../../../swiper-carousel/carousel-item/SwiperItem.liquid.js');
|
|
18
|
+
var Swiper_liquid = require('../../../../../swiper-carousel/root/Swiper.liquid.js');
|
|
19
|
+
|
|
20
|
+
const FeatureImageWithGallery = ({ builderPropUID, children, enableLazyLoadImage, ...setting })=>{
|
|
21
|
+
const { featuredImageCarouselClasses, galleryItemClasses, featuredCarouselItemClasses } = getProductImagesClassName.getProductImagesClassName(setting);
|
|
22
|
+
const { featuredImageCarouselStyle, featureImageStyle, featureImageCarouselOnlyOneImageStyle, featureImageOnlyOneImageStyle, featureImageCarouselItemStyle } = getProductImagesStyles.getProductImagesStyles(setting);
|
|
23
|
+
const { featuredImageCarouselSettingAttrs } = getProductImagesAttr.getProductImagesAttr(setting);
|
|
24
|
+
const ftAspectRatio = common.getAspectRatio(setting.ftShape);
|
|
25
|
+
const renderFeatured = ()=>{
|
|
26
|
+
return `
|
|
27
|
+
{% case featureMedia.media_type %}
|
|
28
|
+
{% when 'image' %}
|
|
29
|
+
${renderImageWithHoverAction()}
|
|
30
|
+
{% when 'external_video' %}
|
|
31
|
+
{% assign mediaSourceVideo = featureMedia | external_video_url %}
|
|
32
|
+
${renderExternalVideo()}
|
|
33
|
+
{% when 'video' %}
|
|
34
|
+
{% assign mediaSourceVideo = featureMedia.sources.last.url %}
|
|
35
|
+
${renderVideo()}
|
|
36
|
+
{% when 'model' %}
|
|
37
|
+
${renderModel3d()}
|
|
38
|
+
{% else %}
|
|
39
|
+
${renderNoImage()}
|
|
40
|
+
{% endcase %}
|
|
41
|
+
`;
|
|
42
|
+
};
|
|
43
|
+
const renderModel3d = ()=>{
|
|
44
|
+
return Modal3d_liquid.default({
|
|
45
|
+
src: system.LiquidIf(`featureMedia.sources.first.url contains '.glb'`, `{{ featureMedia.sources.first.url }}`, `{{featureMedia.sources.last.url}}`),
|
|
46
|
+
alt: '{{featureMedia.preview_image.alt}}',
|
|
47
|
+
poster: `{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}`,
|
|
48
|
+
cameraControls: true,
|
|
49
|
+
arStatus: 'not-presenting',
|
|
50
|
+
style: {
|
|
51
|
+
width: '100%'
|
|
52
|
+
},
|
|
53
|
+
aspectRatio: ftAspectRatio
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const renderExternalVideo = ()=>{
|
|
57
|
+
return Video_liquid.default({
|
|
58
|
+
src: `{{mediaSourceVideo}}`,
|
|
59
|
+
alt: '{{featureMedia.alt}}',
|
|
60
|
+
autoplay: false,
|
|
61
|
+
allowfullscreen: true,
|
|
62
|
+
controls: true,
|
|
63
|
+
style: {
|
|
64
|
+
width: '100%',
|
|
65
|
+
height: '100%'
|
|
66
|
+
},
|
|
67
|
+
aspectRatio: ftAspectRatio
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const renderVideo = ()=>{
|
|
71
|
+
return HTML5Embed_liquid.default({
|
|
72
|
+
src: `{{mediaSourceVideo}}`,
|
|
73
|
+
title: '{{featureMedia.alt}}',
|
|
74
|
+
autoplay: false,
|
|
75
|
+
controls: true,
|
|
76
|
+
style: {
|
|
77
|
+
width: '100%',
|
|
78
|
+
'max-height': '100%'
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
const renderImageWithHoverAction = ()=>{
|
|
83
|
+
return core.template`
|
|
84
|
+
${renderFeaturedImageOnly(core.cls('gp-w-full gp-transition-opacity', {
|
|
85
|
+
'group-hover:gp-opacity-0': setting.hoverEffect == 'other'
|
|
86
|
+
}, `{{shouldHidden}}`))}
|
|
87
|
+
${system.If(setting?.hoverEffect !== 'none', `<div class="${core.cls('zoom-element !gp-max-w-none', productFeaturedImage.getZoomImageClass())}">
|
|
88
|
+
${renderFeaturedImageOnly('image-zoom', true)}
|
|
89
|
+
</div>`, ' ')}
|
|
90
|
+
${system.If(setting?.hoverEffect == 'zoom' && setting?.zoomType == 'glasses', `<div class="${core.cls('zoom-lens-element', productFeaturedImage.getZoomLenClass())}" style="opacity: 0; background-image: url('{{ featureMedia.src | img_url: "1024x1024"}}')"></div>`, ' ')}
|
|
91
|
+
`;
|
|
92
|
+
};
|
|
93
|
+
const renderFeaturedImageOnly = (className, hasHoverEffect)=>{
|
|
94
|
+
return core.template`
|
|
95
|
+
{% assign src = featureMedia.src %}
|
|
96
|
+
${system.If(hasHoverEffect && setting.hoverEffect == 'other', `{% assign otherImage = product.media[${setting.otherImage}] %}
|
|
97
|
+
{% assign src = otherImage.src %}
|
|
98
|
+
${system.LiquidIf(`otherImage.media_type != 'image'`, `{% assign src = otherImage.preview_image.src %}`)}
|
|
99
|
+
`)}
|
|
100
|
+
${NextImage_liquid.default({
|
|
101
|
+
srcIsLiquidCode: true,
|
|
102
|
+
src: system.LiquidIf(`src != null`, common.getSrcImage('src'), `{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}`),
|
|
103
|
+
id: system.LiquidIf(`featureMedia != null`, `{{featureMedia.id}}`),
|
|
104
|
+
width: `{{featureMedia.width}}`,
|
|
105
|
+
height: `{{featureMedia.height}}`,
|
|
106
|
+
alt: `{{featureMedia.alt}}`,
|
|
107
|
+
srcset: `${common.getSrcImage('src')}`,
|
|
108
|
+
baseSrc: `{{src | image_url}}`,
|
|
109
|
+
sizes: `(max-width: 768px) 50vw, 100vw`,
|
|
110
|
+
setting: {
|
|
111
|
+
layout: setting?.ftLayout,
|
|
112
|
+
aspectRatio: ftAspectRatio,
|
|
113
|
+
qualityType: setting?.qualityType,
|
|
114
|
+
qualityPercent: setting?.qualityPercent
|
|
115
|
+
},
|
|
116
|
+
priority: setting?.preload,
|
|
117
|
+
className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${className}`,
|
|
118
|
+
enableLazyLoadImage
|
|
119
|
+
})}`;
|
|
120
|
+
};
|
|
121
|
+
const renderNoImage = ()=>{
|
|
122
|
+
return core.template`
|
|
123
|
+
${NextImage_liquid.default({
|
|
124
|
+
srcIsLiquidCode: true,
|
|
125
|
+
src: 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
|
|
126
|
+
alt: `No Image`,
|
|
127
|
+
sizes: `(max-width: 768px) 50vw, 100vw`,
|
|
128
|
+
setting: {
|
|
129
|
+
layout: setting?.ftLayout,
|
|
130
|
+
aspectRatio: ftAspectRatio,
|
|
131
|
+
qualityType: setting?.qualityType,
|
|
132
|
+
qualityPercent: setting?.qualityPercent
|
|
133
|
+
},
|
|
134
|
+
priority: setting?.preload,
|
|
135
|
+
className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none`,
|
|
136
|
+
enableLazyLoadImage
|
|
137
|
+
})}`;
|
|
138
|
+
};
|
|
139
|
+
const paddingBottomValue = common.getPaddingBottomByShapeSetting(setting.ftShape);
|
|
140
|
+
const renderCarouselGalleryItem = (className)=>{
|
|
141
|
+
return `
|
|
142
|
+
${system.Liquid(`{% assign productImageWidth = 0 %}
|
|
143
|
+
{% case featureMedia.media_type %}
|
|
144
|
+
{% when 'image' %}
|
|
145
|
+
{% assign productImageWidth = featureMedia.width %}
|
|
146
|
+
{% else %}
|
|
147
|
+
{% assign productImageWidth = featureMedia.preview_image.width %}
|
|
148
|
+
{% endcase %}`)}
|
|
149
|
+
${SwiperItem_liquid.default({
|
|
150
|
+
id: '{{section.id}}-{{imageID}}',
|
|
151
|
+
contentType: 'productImage',
|
|
152
|
+
className: `${galleryItemClasses(`gp-ft-image-item ${className}`)}`,
|
|
153
|
+
parentId: `${builderPropUID}-{{section.id}}-{{product.id}}`,
|
|
154
|
+
style: featureImageCarouselItemStyle,
|
|
155
|
+
customStyle: {
|
|
156
|
+
width: '{{productImageWidth}}px'
|
|
157
|
+
},
|
|
158
|
+
children: `
|
|
159
|
+
<div
|
|
160
|
+
class="gp-w-full gp-relative ${system.LiquidIf(`featureMedia == null or featureMedia.media_type == 'image'`, `{{ 'gp-h-0' }}`, `{{ 'gp-h-full !gp-pb-0' }}`)}"
|
|
161
|
+
style="${_function.getStyleOfObject(core.makeStyleResponsive('pb', paddingBottomValue))} ${system.LiquidIf(`featureMedia.media_type == 'video' or featureMedia.media_type == 'external_video'`, `{{ 'display: flex; align-items: center; justify-content: center' }}`)}"
|
|
162
|
+
>
|
|
163
|
+
${renderFeatured()}
|
|
164
|
+
</div>
|
|
165
|
+
`
|
|
166
|
+
})}`;
|
|
167
|
+
};
|
|
168
|
+
const isRenderFeatureCarousel = productFeaturedImage.checkRenderFeaturedCarousel(setting);
|
|
169
|
+
const FEATURE_IMAGE_WRAPPER_CLASS = 'gp-featured-image-wrapper';
|
|
170
|
+
const carouselChildren = system.LiquidIf(`product.media.size > 0`, `${system.LiquidFor(`media in product.media`, `${children || ''} {% assign largestRatio = 0 %}
|
|
171
|
+
${system.LiquidFor(`featureMedia in product.media`, `{% assign height = featureMedia.height | times: 1.0 %}
|
|
172
|
+
{% assign width = featureMedia.width | times: 1.0 %}
|
|
173
|
+
{% assign ratio = height | divided_by: width %}
|
|
174
|
+
${system.LiquidIf(`ratio > largestRatio`, `{% assign largestRatio = ratio %}`)}`)}
|
|
175
|
+
${system.LiquidFor(`featureMedia in product.media`, `${system.LiquidIf(`featureMedia.media_type == 'image'`, `${system.LiquidFor(`image in product.images`, system.LiquidIf(`image.src == featureMedia.src`, `{% assign imageID = image.id %}{% break %}`))}`, `{% assign imageID = '' %}`)}
|
|
176
|
+
${renderCarouselGalleryItem()}`)}`)}`, NextImage_liquid.default({
|
|
177
|
+
src: `{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}`,
|
|
178
|
+
id: `noImageError`,
|
|
179
|
+
width: `480`,
|
|
180
|
+
height: `480`,
|
|
181
|
+
alt: `no image`,
|
|
182
|
+
priority: setting?.preload,
|
|
183
|
+
setting: {
|
|
184
|
+
layout: setting?.ftLayout,
|
|
185
|
+
aspectRatio: ftAspectRatio,
|
|
186
|
+
qualityType: setting?.qualityType,
|
|
187
|
+
qualityPercent: setting?.qualityPercent
|
|
188
|
+
},
|
|
189
|
+
style: {
|
|
190
|
+
height: '100%'
|
|
191
|
+
},
|
|
192
|
+
className: `gp-w-full featured-image-only !gp-rounded-none`,
|
|
193
|
+
customLazyload: true,
|
|
194
|
+
enableLazyLoadImage
|
|
195
|
+
}));
|
|
196
|
+
const renderFeatureImageCarousel = ()=>{
|
|
197
|
+
return `
|
|
198
|
+
${Swiper_liquid.default({
|
|
199
|
+
builderProps: {
|
|
200
|
+
uid: builderPropUID
|
|
201
|
+
},
|
|
202
|
+
rootId: `ft-${builderPropUID}-{{section.id}}-{{product.id}}`,
|
|
203
|
+
conditionAppendJs: 'product.media.size > 1',
|
|
204
|
+
wrapperClass: FEATURE_IMAGE_WRAPPER_CLASS,
|
|
205
|
+
rootClass: `${featuredImageCarouselClasses}`,
|
|
206
|
+
rootAttrs: {
|
|
207
|
+
type: 'gp-feature-image-carousel',
|
|
208
|
+
'product-id': '{{product.id}}',
|
|
209
|
+
'product-media': '{{product.media.size}}'
|
|
210
|
+
},
|
|
211
|
+
isHiddenArrowWhenDisabled: true,
|
|
212
|
+
setting: featuredImageCarouselSettingAttrs,
|
|
213
|
+
rootStyles: featureImageStyle,
|
|
214
|
+
styles: featuredImageCarouselStyle,
|
|
215
|
+
style: {
|
|
216
|
+
playSpeed: 600
|
|
217
|
+
},
|
|
218
|
+
disableMarginAuto: true,
|
|
219
|
+
children: carouselChildren
|
|
220
|
+
})}
|
|
221
|
+
`;
|
|
222
|
+
};
|
|
223
|
+
const getVariantByPreDisplay = ()=>{
|
|
224
|
+
switch(setting?.preDisplay){
|
|
225
|
+
case '1st-images':
|
|
226
|
+
return `
|
|
227
|
+
{% assign featureMedia = product.media.first %}
|
|
228
|
+
`;
|
|
229
|
+
case '1st-3d-mode':
|
|
230
|
+
return system.LiquidFor(`media in product.media`, system.LiquidIf(`media.media_type == 'model'`, `{% assign featureMedia = media %}{% break %}`));
|
|
231
|
+
case '1st-video':
|
|
232
|
+
return system.LiquidFor(`media in product.media`, system.LiquidIf(`media.media_type == 'video' or media.media_type == 'external_video'`, `{% assign featureMedia = media %}{% break %}`));
|
|
233
|
+
default:
|
|
234
|
+
return `
|
|
235
|
+
{% assign featureMedia = variant.featured_media %}
|
|
236
|
+
{% unless featureMedia %}
|
|
237
|
+
{% assign featureMedia = product.featured_media %}
|
|
238
|
+
{% endunless %}
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
const renderFeatureImageCarouselOnlyOneImage = ()=>{
|
|
243
|
+
return system.Liquid(`
|
|
244
|
+
{% assign featureMedia = variant.featured_media %}
|
|
245
|
+
{% unless featureMedia %}
|
|
246
|
+
{% assign featureMedia = product.featured_media %}
|
|
247
|
+
{% endunless %}
|
|
248
|
+
${system.LiquidIf(`product.media.size > 1`, getVariantByPreDisplay())}
|
|
249
|
+
{% assign largestRatio = 0 %}
|
|
250
|
+
{% assign height = featureMedia.height | times: 1.0 %}
|
|
251
|
+
{% assign width = featureMedia.width | times: 1.0 %}
|
|
252
|
+
{% assign ratio = height | divided_by: width %}
|
|
253
|
+
${system.LiquidIf(`ratio > largestRatio`, `{% assign largestRatio = ratio %}`)}
|
|
254
|
+
{% assign productImageWidth = 0 %}
|
|
255
|
+
{% case featureMedia.media_type %}
|
|
256
|
+
{% when 'image' %}
|
|
257
|
+
{% assign productImageWidth = featureMedia.width %}
|
|
258
|
+
{% else %}
|
|
259
|
+
{% assign productImageWidth = featureMedia.preview_image.width %}
|
|
260
|
+
{% endcase %}
|
|
261
|
+
${system.LiquidIf(`featureMedia == null`, `{% assign productImageWidth = 1600 %}`)}
|
|
262
|
+
<div
|
|
263
|
+
class='gp-feature-image-carousel gp-feature-image-only'
|
|
264
|
+
style="${_function.getStyleOfObject(featureImageStyle)}"
|
|
265
|
+
>
|
|
266
|
+
<div
|
|
267
|
+
class="gp-relative"
|
|
268
|
+
style="${_function.getStyleOfObject(featureImageOnlyOneImageStyle)}"
|
|
269
|
+
>
|
|
270
|
+
${children}
|
|
271
|
+
<div
|
|
272
|
+
type="gp-feature-image-only"
|
|
273
|
+
product-id="{{product.id}}"
|
|
274
|
+
product-media="{{product.media.size}}"
|
|
275
|
+
class="${featuredCarouselItemClasses(FEATURE_IMAGE_WRAPPER_CLASS)}
|
|
276
|
+
style="${_function.getStyleOfObject(featureImageCarouselOnlyOneImageStyle)}"
|
|
277
|
+
>
|
|
278
|
+
<div
|
|
279
|
+
class="gp-w-full gp-relative ${system.LiquidIf(`featureMedia == null or featureMedia.media_type == 'image'`, `{{ 'gp-h-0' }}`, `{{ 'gp-h-full !gp-pb-0' }}`)}"
|
|
280
|
+
style="${_function.getStyleOfObject(core.makeStyleResponsive('pb', paddingBottomValue))} ${system.LiquidIf(`featureMedia.media_type == 'video' or featureMedia.media_type == 'external_video'`, `{{ 'display: flex; align-items: center; justify-content: center' }}`)}"
|
|
281
|
+
>
|
|
282
|
+
${renderFeatured()}
|
|
283
|
+
</div>
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
</div>
|
|
287
|
+
`);
|
|
288
|
+
};
|
|
289
|
+
return system.Liquid(`
|
|
290
|
+
{% capture featureImageOnlyOne %}
|
|
291
|
+
${renderFeatureImageCarouselOnlyOneImage()}
|
|
292
|
+
{% endcapture %}
|
|
293
|
+
${system.LiquidIf(`product.media.size > 1`, `
|
|
294
|
+
${system.If(isRenderFeatureCarousel, renderFeatureImageCarousel(), ' ')}
|
|
295
|
+
${system.If(!isRenderFeatureCarousel, `{{ featureImageOnlyOne }}`, ' ')}
|
|
296
|
+
`, `{{ featureImageOnlyOne }}`)}
|
|
297
|
+
`);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
exports.default = FeatureImageWithGallery;
|
package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var ProductFeaturedImageCarousel = require('../child/ProductFeaturedImageCarousel.js');
|
|
8
|
+
var getProductImagesClassName = require('../../composables/getProductImagesClassName.js');
|
|
9
|
+
var getProductImagesStyles = require('../../composables/getProductImagesStyles.js');
|
|
10
|
+
|
|
11
|
+
const OnlyFeatureImage = (productImageProps)=>{
|
|
12
|
+
const { setting, styles, gallery, builderProps, noDataChildren, onHandleClickImage, children } = productImageProps;
|
|
13
|
+
const settings = {
|
|
14
|
+
...setting,
|
|
15
|
+
...styles
|
|
16
|
+
};
|
|
17
|
+
if (gallery?.[0]?.id === 'noImageError') {
|
|
18
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
19
|
+
children: noDataChildren
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
23
|
+
const { featureImageOnlyOneImageClasses } = getProductImagesClassName.getProductImagesClassName(settings);
|
|
24
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
25
|
+
const { featureImageStyle } = getProductImagesStyles.getProductImagesStyles(settings);
|
|
26
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
27
|
+
className: featureImageOnlyOneImageClasses,
|
|
28
|
+
style: featureImageStyle,
|
|
29
|
+
children: [
|
|
30
|
+
/*#__PURE__*/ jsxRuntime.jsx(ProductFeaturedImageCarousel.default, {
|
|
31
|
+
productImages: gallery,
|
|
32
|
+
...settings,
|
|
33
|
+
onHandleClick: (imageID, enableOpenLightBox)=>{
|
|
34
|
+
onHandleClickImage(imageID || '', enableOpenLightBox);
|
|
35
|
+
},
|
|
36
|
+
builderPropUID: builderProps?.uid,
|
|
37
|
+
builderPropsClass: `gp-product-images-gallery-${builderProps?.uid}`
|
|
38
|
+
}),
|
|
39
|
+
children
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
exports.default = OnlyFeatureImage;
|