@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.
Files changed (174) hide show
  1. package/dist/cjs/builder.js +12 -6
  2. package/dist/cjs/index.js +34 -32
  3. package/dist/cjs/index.liquid.js +16 -10
  4. package/dist/cjs/next.js +3 -1
  5. package/dist/cjs/product/components/ProductImagesV3/common/common.js +360 -0
  6. package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +192 -0
  7. package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +26 -0
  8. package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +94 -0
  9. package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +303 -0
  10. package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +95 -0
  11. package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +59 -0
  12. package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +266 -0
  13. package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +63 -0
  14. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +36 -0
  15. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +109 -0
  16. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +139 -0
  17. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +100 -0
  18. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +77 -0
  19. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +300 -0
  20. package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +44 -0
  21. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +83 -0
  22. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +182 -0
  23. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +30 -0
  24. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +239 -0
  25. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +28 -0
  26. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +144 -0
  27. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +14 -0
  28. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +54 -0
  29. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +53 -0
  30. package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +55 -0
  31. package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +41 -0
  32. package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +134 -0
  33. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +203 -0
  34. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +87 -0
  35. package/dist/cjs/product/components/ProductImagesV3/index.js +291 -0
  36. package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +153 -0
  37. package/dist/cjs/product/index.js +6 -4
  38. package/dist/cjs/product/next.js +4 -0
  39. package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +252 -0
  40. package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +251 -0
  41. package/dist/cjs/product/setting/product-image-v3/ProductImages.js +74 -0
  42. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +388 -0
  43. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +518 -0
  44. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +336 -0
  45. package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +118 -0
  46. package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +119 -0
  47. package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +237 -0
  48. package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +491 -0
  49. package/dist/cjs/setting.js +97 -95
  50. package/dist/cjs/swiper-carousel/arrow/Arrow.js +52 -0
  51. package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +46 -0
  52. package/dist/cjs/swiper-carousel/arrow/common/common.js +119 -0
  53. package/dist/cjs/swiper-carousel/arrow/common/getClass.js +50 -0
  54. package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +84 -0
  55. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +34 -0
  56. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +38 -0
  57. package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +29 -0
  58. package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +79 -0
  59. package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +22 -0
  60. package/dist/cjs/swiper-carousel/components/common/carousel.js +98 -0
  61. package/dist/cjs/swiper-carousel/components/const/index.js +5 -0
  62. package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +34 -0
  63. package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +42 -0
  64. package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +105 -0
  65. package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +15 -0
  66. package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +45 -0
  67. package/dist/cjs/swiper-carousel/dots/Dots.js +51 -0
  68. package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +26 -0
  69. package/dist/cjs/swiper-carousel/dots/common/common.js +28 -0
  70. package/dist/cjs/swiper-carousel/dots/common/getClass.js +40 -0
  71. package/dist/cjs/swiper-carousel/dots/common/getStyle.js +33 -0
  72. package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +21 -0
  73. package/dist/cjs/swiper-carousel/index.js +17 -0
  74. package/dist/cjs/swiper-carousel/next.js +22 -0
  75. package/dist/cjs/swiper-carousel/root/Swiper.js +128 -0
  76. package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +104 -0
  77. package/dist/cjs/swiper-carousel/root/common/getAttr.js +25 -0
  78. package/dist/cjs/swiper-carousel/root/common/getClass.js +135 -0
  79. package/dist/cjs/swiper-carousel/root/common/getData.js +56 -0
  80. package/dist/cjs/swiper-carousel/root/common/getStyle.js +64 -0
  81. package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +482 -0
  82. package/dist/cjs/swiper-carousel/setting/Swiper.js +42 -0
  83. package/dist/cjs/swiper-carousel/setting/SwiperItem.js +40 -0
  84. package/dist/cjs/swiper-carousel/setting/configs/presets.js +87 -0
  85. package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +819 -0
  86. package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +718 -0
  87. package/dist/esm/builder.js +6 -0
  88. package/dist/esm/index.js +1 -0
  89. package/dist/esm/index.liquid.js +3 -0
  90. package/dist/esm/next.js +3 -1
  91. package/dist/esm/product/components/ProductImagesV3/common/common.js +344 -0
  92. package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +189 -0
  93. package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +24 -0
  94. package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +83 -0
  95. package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +292 -0
  96. package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +92 -0
  97. package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +53 -0
  98. package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +251 -0
  99. package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +59 -0
  100. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +32 -0
  101. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +105 -0
  102. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +135 -0
  103. package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +96 -0
  104. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +73 -0
  105. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +296 -0
  106. package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +40 -0
  107. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +79 -0
  108. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +178 -0
  109. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +26 -0
  110. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +235 -0
  111. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +24 -0
  112. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +140 -0
  113. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +12 -0
  114. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +52 -0
  115. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +51 -0
  116. package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +53 -0
  117. package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +39 -0
  118. package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +132 -0
  119. package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +201 -0
  120. package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +85 -0
  121. package/dist/esm/product/components/ProductImagesV3/index.js +287 -0
  122. package/dist/esm/product/components/ProductImagesV3/index.liquid.js +149 -0
  123. package/dist/esm/product/index.js +26 -24
  124. package/dist/esm/product/next.js +4 -0
  125. package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +248 -0
  126. package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +248 -0
  127. package/dist/esm/product/setting/product-image-v3/ProductImages.js +70 -0
  128. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +384 -0
  129. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +515 -0
  130. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +334 -0
  131. package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +116 -0
  132. package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +117 -0
  133. package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +235 -0
  134. package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +489 -0
  135. package/dist/esm/setting.js +2 -0
  136. package/dist/esm/swiper-carousel/arrow/Arrow.js +48 -0
  137. package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +42 -0
  138. package/dist/esm/swiper-carousel/arrow/common/common.js +111 -0
  139. package/dist/esm/swiper-carousel/arrow/common/getClass.js +48 -0
  140. package/dist/esm/swiper-carousel/arrow/common/getStyle.js +82 -0
  141. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +30 -0
  142. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +34 -0
  143. package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +27 -0
  144. package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +77 -0
  145. package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +20 -0
  146. package/dist/esm/swiper-carousel/components/common/carousel.js +93 -0
  147. package/dist/esm/swiper-carousel/components/const/index.js +3 -0
  148. package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +30 -0
  149. package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +35 -0
  150. package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +103 -0
  151. package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +13 -0
  152. package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +43 -0
  153. package/dist/esm/swiper-carousel/dots/Dots.js +47 -0
  154. package/dist/esm/swiper-carousel/dots/Dots.liquid.js +22 -0
  155. package/dist/esm/swiper-carousel/dots/common/common.js +26 -0
  156. package/dist/esm/swiper-carousel/dots/common/getClass.js +38 -0
  157. package/dist/esm/swiper-carousel/dots/common/getStyle.js +31 -0
  158. package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +19 -0
  159. package/dist/esm/swiper-carousel/index.js +15 -0
  160. package/dist/esm/swiper-carousel/next.js +18 -0
  161. package/dist/esm/swiper-carousel/root/Swiper.js +124 -0
  162. package/dist/esm/swiper-carousel/root/Swiper.liquid.js +100 -0
  163. package/dist/esm/swiper-carousel/root/common/getAttr.js +23 -0
  164. package/dist/esm/swiper-carousel/root/common/getClass.js +133 -0
  165. package/dist/esm/swiper-carousel/root/common/getData.js +54 -0
  166. package/dist/esm/swiper-carousel/root/common/getStyle.js +62 -0
  167. package/dist/esm/swiper-carousel/root/hook/useCarousel.js +480 -0
  168. package/dist/esm/swiper-carousel/setting/Swiper.js +38 -0
  169. package/dist/esm/swiper-carousel/setting/SwiperItem.js +36 -0
  170. package/dist/esm/swiper-carousel/setting/configs/presets.js +85 -0
  171. package/dist/esm/swiper-carousel/setting/configs/settingV2.js +815 -0
  172. package/dist/esm/swiper-carousel/setting/configs/uiV2.js +713 -0
  173. package/dist/types/index.d.ts +551 -116
  174. package/package.json +2 -2
@@ -0,0 +1,73 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { cls } from '@gem-sdk/core';
3
+ import ProductGalleryCarousel from '../gallery-carousel/GalleryCarousel.js';
4
+ import ProductGalleryGrid from '../child/ProductGalleryGrid.js';
5
+ import ProductFeaturedImageCarousel from '../child/ProductFeaturedImageCarousel.js';
6
+ import { getProductImagesStyles } from '../../composables/getProductImagesStyles.js';
7
+ import { getProductImagesClassName } from '../../composables/getProductImagesClassName.js';
8
+ import { useFeatureImageWithGallery } from '../../hooks/useFeatureImageWithGallery.js';
9
+
10
+ const FeatureImageWithGallery = (props)=>{
11
+ const { setting, styles, builderProps, gallery, onHandleClickImage, priorityFeatureImage, children, noDataChildren } = props;
12
+ const settings = {
13
+ ...setting,
14
+ ...styles
15
+ };
16
+ const { isShowCarousel, featureImageHeight, featureWrapperImage, onClickFeatureArrow, activeIndexFromFeatureImage, setOnClickFeatureArrow, onHandleLoadedFeatureImage, setActiveIndexFromFeatureImage } = useFeatureImageWithGallery(props);
17
+ if (gallery?.[0]?.id === 'noImageError') {
18
+ return /*#__PURE__*/ jsx(Fragment, {
19
+ children: noDataChildren
20
+ });
21
+ }
22
+ const { ftImageGalleryClasses, imageGalleryWrapperClasses } = getProductImagesClassName(props);
23
+ const { wrapperFeaturedImageStyle, featureImageStyle, galleryImageStyle } = getProductImagesStyles(settings, {
24
+ gallery,
25
+ featureImageHeight
26
+ });
27
+ return /*#__PURE__*/ jsxs("div", {
28
+ className: cls('gp-grid gp-w-full gp-relative'),
29
+ style: wrapperFeaturedImageStyle,
30
+ children: [
31
+ /*#__PURE__*/ jsx("div", {
32
+ className: ftImageGalleryClasses,
33
+ style: featureImageStyle,
34
+ children: /*#__PURE__*/ jsx(ProductFeaturedImageCarousel, {
35
+ imgRef: featureWrapperImage,
36
+ productImages: gallery,
37
+ ...settings,
38
+ onHandleClick: (imageID, enableOpenLightBox)=>onHandleClickImage(imageID || '', enableOpenLightBox),
39
+ onHandleLoaded: onHandleLoadedFeatureImage,
40
+ onHandleUpdateActiveIndex: setActiveIndexFromFeatureImage,
41
+ onClickArrow: (randomKey)=>setOnClickFeatureArrow(randomKey),
42
+ builderPropUID: builderProps?.uid,
43
+ builderPropsClass: `gp-product-images-feature-${builderProps?.uid}`,
44
+ children: children
45
+ })
46
+ }),
47
+ gallery.length > 1 && /*#__PURE__*/ jsx("div", {
48
+ className: imageGalleryWrapperClasses,
49
+ style: galleryImageStyle,
50
+ children: isShowCarousel ? /*#__PURE__*/ jsx(ProductGalleryCarousel, {
51
+ productImages: gallery,
52
+ position: settings?.position,
53
+ ...settings,
54
+ builderPropUID: builderProps?.uid,
55
+ onHandleClick: (imageID, enableOpenLightBox)=>onHandleClickImage(imageID || '', enableOpenLightBox),
56
+ activeIndexFormFeatureImage: activeIndexFromFeatureImage,
57
+ priorityFeatureImage: priorityFeatureImage,
58
+ onClickFeatureArrow: onClickFeatureArrow,
59
+ builderPropsClass: `gp-product-images-gallery-${builderProps?.uid}`
60
+ }) : /*#__PURE__*/ jsx(ProductGalleryGrid, {
61
+ productImages: gallery,
62
+ ...settings,
63
+ builderPropUID: builderProps?.uid,
64
+ onHandleClick: (imageID, enableOpenLightBox)=>onHandleClickImage(imageID || '', enableOpenLightBox),
65
+ activeIndexFormFeatureImage: activeIndexFromFeatureImage,
66
+ isHiddenInteraction: true
67
+ })
68
+ })
69
+ ]
70
+ });
71
+ };
72
+
73
+ export { FeatureImageWithGallery as default };
@@ -0,0 +1,296 @@
1
+ import { makeStyleResponsive, template, cls } from '@gem-sdk/core';
2
+ import { getAspectRatio, getPaddingBottomByShapeSetting, getSrcImage } from '../../common/common.js';
3
+ import { checkRenderFeaturedCarousel, getZoomImageClass, getZoomLenClass } from '../../common/productFeaturedImage.js';
4
+ import HTML5Embed from '../../../../../video/components/HTML5Embed.liquid.js';
5
+ import Model3d from '../../../../../image/components/Modal3d.liquid.js';
6
+ import NextImage from '../../../../../image/components/NextImage.liquid.js';
7
+ import Video from '../../../../../image/components/Video.liquid.js';
8
+ import { getStyleOfObject } from '../../../../helpers/function.js';
9
+ import { getProductImagesStyles } from '../../composables/getProductImagesStyles.js';
10
+ import { getProductImagesClassName } from '../../composables/getProductImagesClassName.js';
11
+ import { getProductImagesAttr } from '../../composables/getProductImagesAttr.js';
12
+ import { LiquidIf, LiquidFor, Liquid, If } from '@gem-sdk/system';
13
+ import CarouselItem from '../../../../../swiper-carousel/carousel-item/SwiperItem.liquid.js';
14
+ import Carousel from '../../../../../swiper-carousel/root/Swiper.liquid.js';
15
+
16
+ const FeatureImageWithGallery = ({ builderPropUID, children, enableLazyLoadImage, ...setting })=>{
17
+ const { featuredImageCarouselClasses, galleryItemClasses, featuredCarouselItemClasses } = getProductImagesClassName(setting);
18
+ const { featuredImageCarouselStyle, featureImageStyle, featureImageCarouselOnlyOneImageStyle, featureImageOnlyOneImageStyle, featureImageCarouselItemStyle } = getProductImagesStyles(setting);
19
+ const { featuredImageCarouselSettingAttrs } = getProductImagesAttr(setting);
20
+ const ftAspectRatio = getAspectRatio(setting.ftShape);
21
+ const renderFeatured = ()=>{
22
+ return `
23
+ {% case featureMedia.media_type %}
24
+ {% when 'image' %}
25
+ ${renderImageWithHoverAction()}
26
+ {% when 'external_video' %}
27
+ {% assign mediaSourceVideo = featureMedia | external_video_url %}
28
+ ${renderExternalVideo()}
29
+ {% when 'video' %}
30
+ {% assign mediaSourceVideo = featureMedia.sources.last.url %}
31
+ ${renderVideo()}
32
+ {% when 'model' %}
33
+ ${renderModel3d()}
34
+ {% else %}
35
+ ${renderNoImage()}
36
+ {% endcase %}
37
+ `;
38
+ };
39
+ const renderModel3d = ()=>{
40
+ return Model3d({
41
+ src: LiquidIf(`featureMedia.sources.first.url contains '.glb'`, `{{ featureMedia.sources.first.url }}`, `{{featureMedia.sources.last.url}}`),
42
+ alt: '{{featureMedia.preview_image.alt}}',
43
+ poster: `{{featureMedia.preview_image.src | product_img_url: '1024x1024'}}`,
44
+ cameraControls: true,
45
+ arStatus: 'not-presenting',
46
+ style: {
47
+ width: '100%'
48
+ },
49
+ aspectRatio: ftAspectRatio
50
+ });
51
+ };
52
+ const renderExternalVideo = ()=>{
53
+ return Video({
54
+ src: `{{mediaSourceVideo}}`,
55
+ alt: '{{featureMedia.alt}}',
56
+ autoplay: false,
57
+ allowfullscreen: true,
58
+ controls: true,
59
+ style: {
60
+ width: '100%',
61
+ height: '100%'
62
+ },
63
+ aspectRatio: ftAspectRatio
64
+ });
65
+ };
66
+ const renderVideo = ()=>{
67
+ return HTML5Embed({
68
+ src: `{{mediaSourceVideo}}`,
69
+ title: '{{featureMedia.alt}}',
70
+ autoplay: false,
71
+ controls: true,
72
+ style: {
73
+ width: '100%',
74
+ 'max-height': '100%'
75
+ }
76
+ });
77
+ };
78
+ const renderImageWithHoverAction = ()=>{
79
+ return template`
80
+ ${renderFeaturedImageOnly(cls('gp-w-full gp-transition-opacity', {
81
+ 'group-hover:gp-opacity-0': setting.hoverEffect == 'other'
82
+ }, `{{shouldHidden}}`))}
83
+ ${If(setting?.hoverEffect !== 'none', `<div class="${cls('zoom-element !gp-max-w-none', getZoomImageClass())}">
84
+ ${renderFeaturedImageOnly('image-zoom', true)}
85
+ </div>`, ' ')}
86
+ ${If(setting?.hoverEffect == 'zoom' && setting?.zoomType == 'glasses', `<div class="${cls('zoom-lens-element', getZoomLenClass())}" style="opacity: 0; background-image: url('{{ featureMedia.src | img_url: "1024x1024"}}')"></div>`, ' ')}
87
+ `;
88
+ };
89
+ const renderFeaturedImageOnly = (className, hasHoverEffect)=>{
90
+ return template`
91
+ {% assign src = featureMedia.src %}
92
+ ${If(hasHoverEffect && setting.hoverEffect == 'other', `{% assign otherImage = product.media[${setting.otherImage}] %}
93
+ {% assign src = otherImage.src %}
94
+ ${LiquidIf(`otherImage.media_type != 'image'`, `{% assign src = otherImage.preview_image.src %}`)}
95
+ `)}
96
+ ${NextImage({
97
+ srcIsLiquidCode: true,
98
+ src: LiquidIf(`src != null`, getSrcImage('src'), `{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}`),
99
+ id: LiquidIf(`featureMedia != null`, `{{featureMedia.id}}`),
100
+ width: `{{featureMedia.width}}`,
101
+ height: `{{featureMedia.height}}`,
102
+ alt: `{{featureMedia.alt}}`,
103
+ srcset: `${getSrcImage('src')}`,
104
+ baseSrc: `{{src | image_url}}`,
105
+ sizes: `(max-width: 768px) 50vw, 100vw`,
106
+ setting: {
107
+ layout: setting?.ftLayout,
108
+ aspectRatio: ftAspectRatio,
109
+ qualityType: setting?.qualityType,
110
+ qualityPercent: setting?.qualityPercent
111
+ },
112
+ priority: setting?.preload,
113
+ 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}`,
114
+ enableLazyLoadImage
115
+ })}`;
116
+ };
117
+ const renderNoImage = ()=>{
118
+ return template`
119
+ ${NextImage({
120
+ srcIsLiquidCode: true,
121
+ src: 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
122
+ alt: `No Image`,
123
+ sizes: `(max-width: 768px) 50vw, 100vw`,
124
+ setting: {
125
+ layout: setting?.ftLayout,
126
+ aspectRatio: ftAspectRatio,
127
+ qualityType: setting?.qualityType,
128
+ qualityPercent: setting?.qualityPercent
129
+ },
130
+ priority: setting?.preload,
131
+ className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none`,
132
+ enableLazyLoadImage
133
+ })}`;
134
+ };
135
+ const paddingBottomValue = getPaddingBottomByShapeSetting(setting.ftShape);
136
+ const renderCarouselGalleryItem = (className)=>{
137
+ return `
138
+ ${Liquid(`{% assign productImageWidth = 0 %}
139
+ {% case featureMedia.media_type %}
140
+ {% when 'image' %}
141
+ {% assign productImageWidth = featureMedia.width %}
142
+ {% else %}
143
+ {% assign productImageWidth = featureMedia.preview_image.width %}
144
+ {% endcase %}`)}
145
+ ${CarouselItem({
146
+ id: '{{section.id}}-{{imageID}}',
147
+ contentType: 'productImage',
148
+ className: `${galleryItemClasses(`gp-ft-image-item ${className}`)}`,
149
+ parentId: `${builderPropUID}-{{section.id}}-{{product.id}}`,
150
+ style: featureImageCarouselItemStyle,
151
+ customStyle: {
152
+ width: '{{productImageWidth}}px'
153
+ },
154
+ children: `
155
+ <div
156
+ class="gp-w-full gp-relative ${LiquidIf(`featureMedia == null or featureMedia.media_type == 'image'`, `{{ 'gp-h-0' }}`, `{{ 'gp-h-full !gp-pb-0' }}`)}"
157
+ style="${getStyleOfObject(makeStyleResponsive('pb', paddingBottomValue))} ${LiquidIf(`featureMedia.media_type == 'video' or featureMedia.media_type == 'external_video'`, `{{ 'display: flex; align-items: center; justify-content: center' }}`)}"
158
+ >
159
+ ${renderFeatured()}
160
+ </div>
161
+ `
162
+ })}`;
163
+ };
164
+ const isRenderFeatureCarousel = checkRenderFeaturedCarousel(setting);
165
+ const FEATURE_IMAGE_WRAPPER_CLASS = 'gp-featured-image-wrapper';
166
+ const carouselChildren = LiquidIf(`product.media.size > 0`, `${LiquidFor(`media in product.media`, `${children || ''} {% assign largestRatio = 0 %}
167
+ ${LiquidFor(`featureMedia in product.media`, `{% assign height = featureMedia.height | times: 1.0 %}
168
+ {% assign width = featureMedia.width | times: 1.0 %}
169
+ {% assign ratio = height | divided_by: width %}
170
+ ${LiquidIf(`ratio > largestRatio`, `{% assign largestRatio = ratio %}`)}`)}
171
+ ${LiquidFor(`featureMedia in product.media`, `${LiquidIf(`featureMedia.media_type == 'image'`, `${LiquidFor(`image in product.images`, LiquidIf(`image.src == featureMedia.src`, `{% assign imageID = image.id %}{% break %}`))}`, `{% assign imageID = '' %}`)}
172
+ ${renderCarouselGalleryItem()}`)}`)}`, NextImage({
173
+ src: `{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}`,
174
+ id: `noImageError`,
175
+ width: `480`,
176
+ height: `480`,
177
+ alt: `no image`,
178
+ priority: setting?.preload,
179
+ setting: {
180
+ layout: setting?.ftLayout,
181
+ aspectRatio: ftAspectRatio,
182
+ qualityType: setting?.qualityType,
183
+ qualityPercent: setting?.qualityPercent
184
+ },
185
+ style: {
186
+ height: '100%'
187
+ },
188
+ className: `gp-w-full featured-image-only !gp-rounded-none`,
189
+ customLazyload: true,
190
+ enableLazyLoadImage
191
+ }));
192
+ const renderFeatureImageCarousel = ()=>{
193
+ return `
194
+ ${Carousel({
195
+ builderProps: {
196
+ uid: builderPropUID
197
+ },
198
+ rootId: `ft-${builderPropUID}-{{section.id}}-{{product.id}}`,
199
+ conditionAppendJs: 'product.media.size > 1',
200
+ wrapperClass: FEATURE_IMAGE_WRAPPER_CLASS,
201
+ rootClass: `${featuredImageCarouselClasses}`,
202
+ rootAttrs: {
203
+ type: 'gp-feature-image-carousel',
204
+ 'product-id': '{{product.id}}',
205
+ 'product-media': '{{product.media.size}}'
206
+ },
207
+ isHiddenArrowWhenDisabled: true,
208
+ setting: featuredImageCarouselSettingAttrs,
209
+ rootStyles: featureImageStyle,
210
+ styles: featuredImageCarouselStyle,
211
+ style: {
212
+ playSpeed: 600
213
+ },
214
+ disableMarginAuto: true,
215
+ children: carouselChildren
216
+ })}
217
+ `;
218
+ };
219
+ const getVariantByPreDisplay = ()=>{
220
+ switch(setting?.preDisplay){
221
+ case '1st-images':
222
+ return `
223
+ {% assign featureMedia = product.media.first %}
224
+ `;
225
+ case '1st-3d-mode':
226
+ return LiquidFor(`media in product.media`, LiquidIf(`media.media_type == 'model'`, `{% assign featureMedia = media %}{% break %}`));
227
+ case '1st-video':
228
+ return LiquidFor(`media in product.media`, LiquidIf(`media.media_type == 'video' or media.media_type == 'external_video'`, `{% assign featureMedia = media %}{% break %}`));
229
+ default:
230
+ return `
231
+ {% assign featureMedia = variant.featured_media %}
232
+ {% unless featureMedia %}
233
+ {% assign featureMedia = product.featured_media %}
234
+ {% endunless %}
235
+ `;
236
+ }
237
+ };
238
+ const renderFeatureImageCarouselOnlyOneImage = ()=>{
239
+ return Liquid(`
240
+ {% assign featureMedia = variant.featured_media %}
241
+ {% unless featureMedia %}
242
+ {% assign featureMedia = product.featured_media %}
243
+ {% endunless %}
244
+ ${LiquidIf(`product.media.size > 1`, getVariantByPreDisplay())}
245
+ {% assign largestRatio = 0 %}
246
+ {% assign height = featureMedia.height | times: 1.0 %}
247
+ {% assign width = featureMedia.width | times: 1.0 %}
248
+ {% assign ratio = height | divided_by: width %}
249
+ ${LiquidIf(`ratio > largestRatio`, `{% assign largestRatio = ratio %}`)}
250
+ {% assign productImageWidth = 0 %}
251
+ {% case featureMedia.media_type %}
252
+ {% when 'image' %}
253
+ {% assign productImageWidth = featureMedia.width %}
254
+ {% else %}
255
+ {% assign productImageWidth = featureMedia.preview_image.width %}
256
+ {% endcase %}
257
+ ${LiquidIf(`featureMedia == null`, `{% assign productImageWidth = 1600 %}`)}
258
+ <div
259
+ class='gp-feature-image-carousel gp-feature-image-only'
260
+ style="${getStyleOfObject(featureImageStyle)}"
261
+ >
262
+ <div
263
+ class="gp-relative"
264
+ style="${getStyleOfObject(featureImageOnlyOneImageStyle)}"
265
+ >
266
+ ${children}
267
+ <div
268
+ type="gp-feature-image-only"
269
+ product-id="{{product.id}}"
270
+ product-media="{{product.media.size}}"
271
+ class="${featuredCarouselItemClasses(FEATURE_IMAGE_WRAPPER_CLASS)}
272
+ style="${getStyleOfObject(featureImageCarouselOnlyOneImageStyle)}"
273
+ >
274
+ <div
275
+ class="gp-w-full gp-relative ${LiquidIf(`featureMedia == null or featureMedia.media_type == 'image'`, `{{ 'gp-h-0' }}`, `{{ 'gp-h-full !gp-pb-0' }}`)}"
276
+ style="${getStyleOfObject(makeStyleResponsive('pb', paddingBottomValue))} ${LiquidIf(`featureMedia.media_type == 'video' or featureMedia.media_type == 'external_video'`, `{{ 'display: flex; align-items: center; justify-content: center' }}`)}"
277
+ >
278
+ ${renderFeatured()}
279
+ </div>
280
+ </div>
281
+ </div>
282
+ </div>
283
+ `);
284
+ };
285
+ return Liquid(`
286
+ {% capture featureImageOnlyOne %}
287
+ ${renderFeatureImageCarouselOnlyOneImage()}
288
+ {% endcapture %}
289
+ ${LiquidIf(`product.media.size > 1`, `
290
+ ${If(isRenderFeatureCarousel, renderFeatureImageCarousel(), ' ')}
291
+ ${If(!isRenderFeatureCarousel, `{{ featureImageOnlyOne }}`, ' ')}
292
+ `, `{{ featureImageOnlyOne }}`)}
293
+ `);
294
+ };
295
+
296
+ export { FeatureImageWithGallery as default };
@@ -0,0 +1,40 @@
1
+ 'use client';
2
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
3
+ import ProductFeaturedImageCarousel from '../child/ProductFeaturedImageCarousel.js';
4
+ import { getProductImagesClassName } from '../../composables/getProductImagesClassName.js';
5
+ import { getProductImagesStyles } from '../../composables/getProductImagesStyles.js';
6
+
7
+ const OnlyFeatureImage = (productImageProps)=>{
8
+ const { setting, styles, gallery, builderProps, noDataChildren, onHandleClickImage, children } = productImageProps;
9
+ const settings = {
10
+ ...setting,
11
+ ...styles
12
+ };
13
+ if (gallery?.[0]?.id === 'noImageError') {
14
+ return /*#__PURE__*/ jsx(Fragment, {
15
+ children: noDataChildren
16
+ });
17
+ }
18
+ // eslint-disable-next-line react-hooks/rules-of-hooks
19
+ const { featureImageOnlyOneImageClasses } = getProductImagesClassName(settings);
20
+ // eslint-disable-next-line react-hooks/rules-of-hooks
21
+ const { featureImageStyle } = getProductImagesStyles(settings);
22
+ return /*#__PURE__*/ jsxs("div", {
23
+ className: featureImageOnlyOneImageClasses,
24
+ style: featureImageStyle,
25
+ children: [
26
+ /*#__PURE__*/ jsx(ProductFeaturedImageCarousel, {
27
+ productImages: gallery,
28
+ ...settings,
29
+ onHandleClick: (imageID, enableOpenLightBox)=>{
30
+ onHandleClickImage(imageID || '', enableOpenLightBox);
31
+ },
32
+ builderPropUID: builderProps?.uid,
33
+ builderPropsClass: `gp-product-images-gallery-${builderProps?.uid}`
34
+ }),
35
+ children
36
+ ]
37
+ });
38
+ };
39
+
40
+ export { OnlyFeatureImage as default };
@@ -0,0 +1,79 @@
1
+ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
2
+ import { useCurrentDevice } from '@gem-sdk/core';
3
+ import { getAspectRatio } from '../../common/common.js';
4
+ import { getEditorMinHeightClass } from '../../common/productGallery.js';
5
+ import { getProductImagesClassName } from '../../composables/getProductImagesClassName.js';
6
+ import { getProductImagesStyles } from '../../composables/getProductImagesStyles.js';
7
+ import { getProductImagesAttr } from '../../composables/getProductImagesAttr.js';
8
+ import { isFeatureMedia } from '../../common/productFeaturedImage.js';
9
+ import MediaIcon from '../child/MediaIcon.js';
10
+ import ButtonOpenLightBox from '../lightbox/ButtonOpenLightBox.js';
11
+ import NextImage from '../../../../../image/components/NextImage.js';
12
+ import Carousel from '../../../../../carousel/root/Carousel.js';
13
+ import CarouselItem from '../../../../../carousel/carousel-item/CarouselItem.js';
14
+ import { useGalleryCarousel } from '../../hooks/useGalleryCarousel.js';
15
+ import { If } from '@gem-sdk/system';
16
+
17
+ const ProductGalleryCarousel = (props)=>{
18
+ const { builderPropUID, productImages, // onHandleClick,
19
+ activeIndexFormFeatureImage, onClickFeatureArrow, builderPropsClass, arrow, priorityFeatureImage, ...setting } = props;
20
+ const currentDevice = useCurrentDevice();
21
+ const { galleryItemClasses } = getProductImagesClassName(setting);
22
+ const { galleryCarouselSettingAttrs } = getProductImagesAttr(setting);
23
+ const { galleryCarouselStyle, galleryCarouselItemStyle } = getProductImagesStyles(setting);
24
+ const { moveToIdx, isDisplay, shapeByLayout, isEnableBorderActive, isShowButtonLightbox, filteredProductImages, handleClickCarouselItem } = useGalleryCarousel(props);
25
+ return /*#__PURE__*/ jsx(Fragment, {
26
+ children: isDisplay && /*#__PURE__*/ jsx(Carousel, {
27
+ parentClass: builderPropsClass,
28
+ rootClass: builderPropsClass,
29
+ setting: galleryCarouselSettingAttrs,
30
+ styles: galleryCarouselStyle,
31
+ slidesClass: getEditorMinHeightClass(currentDevice, setting.position, setting.navigationPosition),
32
+ builderProps: {
33
+ uid: `${builderPropUID}-carousel`
34
+ },
35
+ moveToIdx: moveToIdx,
36
+ isHiddenArrowWhenDisabled: true,
37
+ disableMarginAuto: true,
38
+ children: filteredProductImages?.map((image, index)=>{
39
+ const canActive = index === moveToIdx;
40
+ const imageSrc = isFeatureMedia(image.contentType) ? image.previewImage : image.src;
41
+ return /*#__PURE__*/ jsxs(CarouselItem, {
42
+ contentType: "productImage",
43
+ className: galleryItemClasses(`gp-gallery-image-item gem-slider-item-${builderPropUID} ${canActive && isEnableBorderActive ? 'gem-slider-item-active' : ''}`),
44
+ onClickItem: ()=>handleClickCarouselItem(image?.id),
45
+ style: galleryCarouselItemStyle,
46
+ "data-id": image?.id,
47
+ "data-border": canActive && !!setting?.borderActive ? 'active' : 'deactive',
48
+ children: [
49
+ /*#__PURE__*/ jsx(NextImage, {
50
+ draggable: "false",
51
+ src: imageSrc,
52
+ width: image?.width,
53
+ height: image?.height,
54
+ alt: image?.alt,
55
+ setting: {
56
+ aspectRatio: getAspectRatio(shapeByLayout),
57
+ layout: setting?.layout,
58
+ qualityPercent: setting?.qualityPercent,
59
+ qualityType: setting?.qualityType
60
+ },
61
+ style: {
62
+ width: '100%',
63
+ height: '100%',
64
+ cursor: 'pointer'
65
+ },
66
+ className: "product-list-image"
67
+ }),
68
+ /*#__PURE__*/ jsx(MediaIcon, {
69
+ contentType: image?.contentType || ''
70
+ }),
71
+ If(isShowButtonLightbox, /*#__PURE__*/ jsx(ButtonOpenLightBox, {}))
72
+ ]
73
+ }, image?.id);
74
+ })
75
+ })
76
+ });
77
+ };
78
+
79
+ export { ProductGalleryCarousel as default };