@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.
Files changed (180) hide show
  1. package/dist/cjs/builder.js +12 -6
  2. package/dist/cjs/collection/components/collection-paginator/common/styles.js +3 -4
  3. package/dist/cjs/collection/components/collection-paginator/components/CollectionPaginator.liquid.js +2 -1
  4. package/dist/cjs/collection/setting/collection-paginator/configs/settings.js +2 -3
  5. package/dist/cjs/index.js +34 -32
  6. package/dist/cjs/index.liquid.js +16 -10
  7. package/dist/cjs/next.js +3 -1
  8. package/dist/cjs/product/components/ProductImagesV3/common/common.js +360 -0
  9. package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +192 -0
  10. package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +26 -0
  11. package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +94 -0
  12. package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +303 -0
  13. package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +95 -0
  14. package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +59 -0
  15. package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +266 -0
  16. package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +63 -0
  17. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +36 -0
  18. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +109 -0
  19. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +139 -0
  20. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +100 -0
  21. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +77 -0
  22. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +300 -0
  23. package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +44 -0
  24. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +83 -0
  25. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +182 -0
  26. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +30 -0
  27. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +239 -0
  28. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +28 -0
  29. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +144 -0
  30. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +14 -0
  31. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +54 -0
  32. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +53 -0
  33. package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +55 -0
  34. package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +41 -0
  35. package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +134 -0
  36. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +203 -0
  37. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +87 -0
  38. package/dist/cjs/product/components/ProductImagesV3/index.js +291 -0
  39. package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +153 -0
  40. package/dist/cjs/product/index.js +6 -4
  41. package/dist/cjs/product/next.js +4 -0
  42. package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +252 -0
  43. package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +251 -0
  44. package/dist/cjs/product/setting/product-image-v3/ProductImages.js +74 -0
  45. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +388 -0
  46. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +518 -0
  47. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +336 -0
  48. package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +118 -0
  49. package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +119 -0
  50. package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +237 -0
  51. package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +491 -0
  52. package/dist/cjs/setting.js +97 -95
  53. package/dist/cjs/swiper-carousel/arrow/Arrow.js +52 -0
  54. package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +46 -0
  55. package/dist/cjs/swiper-carousel/arrow/common/common.js +119 -0
  56. package/dist/cjs/swiper-carousel/arrow/common/getClass.js +50 -0
  57. package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +84 -0
  58. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +34 -0
  59. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +38 -0
  60. package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +29 -0
  61. package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +79 -0
  62. package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +22 -0
  63. package/dist/cjs/swiper-carousel/components/common/carousel.js +98 -0
  64. package/dist/cjs/swiper-carousel/components/const/index.js +5 -0
  65. package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +34 -0
  66. package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +42 -0
  67. package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +105 -0
  68. package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +15 -0
  69. package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +45 -0
  70. package/dist/cjs/swiper-carousel/dots/Dots.js +51 -0
  71. package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +26 -0
  72. package/dist/cjs/swiper-carousel/dots/common/common.js +28 -0
  73. package/dist/cjs/swiper-carousel/dots/common/getClass.js +40 -0
  74. package/dist/cjs/swiper-carousel/dots/common/getStyle.js +33 -0
  75. package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +21 -0
  76. package/dist/cjs/swiper-carousel/index.js +17 -0
  77. package/dist/cjs/swiper-carousel/next.js +22 -0
  78. package/dist/cjs/swiper-carousel/root/Swiper.js +128 -0
  79. package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +104 -0
  80. package/dist/cjs/swiper-carousel/root/common/getAttr.js +25 -0
  81. package/dist/cjs/swiper-carousel/root/common/getClass.js +135 -0
  82. package/dist/cjs/swiper-carousel/root/common/getData.js +56 -0
  83. package/dist/cjs/swiper-carousel/root/common/getStyle.js +64 -0
  84. package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +482 -0
  85. package/dist/cjs/swiper-carousel/setting/Swiper.js +42 -0
  86. package/dist/cjs/swiper-carousel/setting/SwiperItem.js +40 -0
  87. package/dist/cjs/swiper-carousel/setting/configs/presets.js +87 -0
  88. package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +819 -0
  89. package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +718 -0
  90. package/dist/esm/builder.js +6 -0
  91. package/dist/esm/collection/components/collection-paginator/common/styles.js +3 -4
  92. package/dist/esm/collection/components/collection-paginator/components/CollectionPaginator.liquid.js +2 -1
  93. package/dist/esm/collection/setting/collection-paginator/configs/settings.js +2 -3
  94. package/dist/esm/index.js +1 -0
  95. package/dist/esm/index.liquid.js +3 -0
  96. package/dist/esm/next.js +3 -1
  97. package/dist/esm/product/components/ProductImagesV3/common/common.js +344 -0
  98. package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +189 -0
  99. package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +24 -0
  100. package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +83 -0
  101. package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +292 -0
  102. package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +92 -0
  103. package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +53 -0
  104. package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +251 -0
  105. package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +59 -0
  106. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +32 -0
  107. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +105 -0
  108. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +135 -0
  109. package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +96 -0
  110. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +73 -0
  111. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +296 -0
  112. package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +40 -0
  113. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +79 -0
  114. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +178 -0
  115. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +26 -0
  116. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +235 -0
  117. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +24 -0
  118. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +140 -0
  119. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +12 -0
  120. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +52 -0
  121. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +51 -0
  122. package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +53 -0
  123. package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +39 -0
  124. package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +132 -0
  125. package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +201 -0
  126. package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +85 -0
  127. package/dist/esm/product/components/ProductImagesV3/index.js +287 -0
  128. package/dist/esm/product/components/ProductImagesV3/index.liquid.js +149 -0
  129. package/dist/esm/product/index.js +26 -24
  130. package/dist/esm/product/next.js +4 -0
  131. package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +248 -0
  132. package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +248 -0
  133. package/dist/esm/product/setting/product-image-v3/ProductImages.js +70 -0
  134. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +384 -0
  135. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +515 -0
  136. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +334 -0
  137. package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +116 -0
  138. package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +117 -0
  139. package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +235 -0
  140. package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +489 -0
  141. package/dist/esm/setting.js +2 -0
  142. package/dist/esm/swiper-carousel/arrow/Arrow.js +48 -0
  143. package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +42 -0
  144. package/dist/esm/swiper-carousel/arrow/common/common.js +111 -0
  145. package/dist/esm/swiper-carousel/arrow/common/getClass.js +48 -0
  146. package/dist/esm/swiper-carousel/arrow/common/getStyle.js +82 -0
  147. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +30 -0
  148. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +34 -0
  149. package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +27 -0
  150. package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +77 -0
  151. package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +20 -0
  152. package/dist/esm/swiper-carousel/components/common/carousel.js +93 -0
  153. package/dist/esm/swiper-carousel/components/const/index.js +3 -0
  154. package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +30 -0
  155. package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +35 -0
  156. package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +103 -0
  157. package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +13 -0
  158. package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +43 -0
  159. package/dist/esm/swiper-carousel/dots/Dots.js +47 -0
  160. package/dist/esm/swiper-carousel/dots/Dots.liquid.js +22 -0
  161. package/dist/esm/swiper-carousel/dots/common/common.js +26 -0
  162. package/dist/esm/swiper-carousel/dots/common/getClass.js +38 -0
  163. package/dist/esm/swiper-carousel/dots/common/getStyle.js +31 -0
  164. package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +19 -0
  165. package/dist/esm/swiper-carousel/index.js +15 -0
  166. package/dist/esm/swiper-carousel/next.js +18 -0
  167. package/dist/esm/swiper-carousel/root/Swiper.js +124 -0
  168. package/dist/esm/swiper-carousel/root/Swiper.liquid.js +100 -0
  169. package/dist/esm/swiper-carousel/root/common/getAttr.js +23 -0
  170. package/dist/esm/swiper-carousel/root/common/getClass.js +133 -0
  171. package/dist/esm/swiper-carousel/root/common/getData.js +54 -0
  172. package/dist/esm/swiper-carousel/root/common/getStyle.js +62 -0
  173. package/dist/esm/swiper-carousel/root/hook/useCarousel.js +480 -0
  174. package/dist/esm/swiper-carousel/setting/Swiper.js +38 -0
  175. package/dist/esm/swiper-carousel/setting/SwiperItem.js +36 -0
  176. package/dist/esm/swiper-carousel/setting/configs/presets.js +85 -0
  177. package/dist/esm/swiper-carousel/setting/configs/settingV2.js +815 -0
  178. package/dist/esm/swiper-carousel/setting/configs/uiV2.js +713 -0
  179. package/dist/types/index.d.ts +551 -116
  180. package/package.json +2 -2
@@ -0,0 +1,111 @@
1
+ import { getResponsiveValueByScreen } from '@gem-sdk/core';
2
+
3
+ const devices = [
4
+ 'desktop',
5
+ 'tablet',
6
+ 'mobile'
7
+ ];
8
+ const getResponsiveSetting = (setting)=>{
9
+ const desktop = setting.desktop;
10
+ const tablet = setting.tablet ? setting.tablet : desktop;
11
+ const mobile = setting.mobile ? setting.mobile : tablet;
12
+ return {
13
+ desktop,
14
+ tablet,
15
+ mobile
16
+ };
17
+ };
18
+ const getArrowPositionStyle = ({ vertical, arrowType, gapToEachSize, left })=>{
19
+ const result = {};
20
+ devices.forEach((item)=>{
21
+ const verticalResponsive = getResponsiveValueByScreen(vertical, item, false);
22
+ const deviceType = item === 'desktop' ? '' : `-${item}`;
23
+ if (!verticalResponsive) {
24
+ result[`left${deviceType}`] = arrowType[item] === 'inside' && left ? gapToEachSize + 'px' : 'initial';
25
+ result[`top${deviceType}`] = left ? 'initial' : '';
26
+ result[`right${deviceType}`] = arrowType[item] === 'inside' && !left ? gapToEachSize + 'px' : 'initial';
27
+ result[`bottom${deviceType}`] = !left ? 'initial' : '';
28
+ } else {
29
+ result[`top${deviceType}`] = arrowType[item] === 'inside' && left ? gapToEachSize + 'px' : 'initial';
30
+ result[`left${deviceType}`] = left ? 'initial' : '';
31
+ result[`bottom${deviceType}`] = arrowType[item] === 'inside' && !left ? gapToEachSize + 'px' : 'initial';
32
+ result[`right${deviceType}`] = !left ? 'initial' : '';
33
+ }
34
+ });
35
+ return result;
36
+ };
37
+ const getClassArrowRotate = (left, vertical)=>{
38
+ const result = {};
39
+ devices.forEach((item)=>{
40
+ const verticalResponsive = getResponsiveValueByScreen(vertical, item, false);
41
+ const deviceType = item === 'desktop' ? '' : `${item}:`;
42
+ result[`${deviceType}gp-rotate-[-90deg]`] = left && !!verticalResponsive;
43
+ result[`${deviceType}gp-rotate-90`] = !left && !!verticalResponsive;
44
+ result[`${deviceType}gp-rotate-180`] = left && !verticalResponsive;
45
+ result[`${deviceType}gp-rotate-0`] = !left && !verticalResponsive;
46
+ });
47
+ return result;
48
+ };
49
+ const getClassArrowDisplay = (arrowType, vertical)=>{
50
+ const result = {};
51
+ devices.forEach((device)=>{
52
+ const verticalResponsive = getResponsiveValueByScreen(vertical, device, false);
53
+ const deviceRes = device === 'desktop' ? '' : `${device}:`;
54
+ result[`${deviceRes}!gp-flex ${deviceRes}!gp-absolute ${deviceRes}gp-z-2`] = arrowType[device] === 'inside' || !!verticalResponsive;
55
+ result[`${deviceRes}!gp-flex ${deviceRes}!gp-relative `] = arrowType[device] === 'outside';
56
+ result[`${deviceRes}!gp-hidden`] = arrowType[device] === 'none';
57
+ });
58
+ return result;
59
+ };
60
+ const getArrowDisplayStyle = (arrowType)=>{
61
+ let result = {};
62
+ devices.forEach((device)=>{
63
+ const arrowTypeResponsive = getResponsiveValueByScreen(arrowType, device, 'none');
64
+ result = {
65
+ ...result,
66
+ [device]: arrowTypeResponsive === 'none' ? 'none' : 'flex'
67
+ };
68
+ });
69
+ return result;
70
+ };
71
+ const mappingNavigationCarousel = (setting)=>{
72
+ const generateValueByDevices = (value)=>{
73
+ const newValue = {
74
+ ...value
75
+ };
76
+ const deviceNotExits = devices.filter((x)=>!Object.keys(newValue).includes(x));
77
+ deviceNotExits.forEach((el)=>{
78
+ if (el === 'tablet') {
79
+ newValue[el] = newValue['desktop'];
80
+ }
81
+ if (el === 'mobile') {
82
+ newValue[el] = newValue['tablet'];
83
+ }
84
+ });
85
+ return newValue;
86
+ };
87
+ if (setting?.layout === 'vertical') {
88
+ const { controlOverContent, arrow } = setting;
89
+ const newArrow = generateValueByDevices(arrow);
90
+ const newControlOverContent = generateValueByDevices(controlOverContent);
91
+ const navigationStyle = {};
92
+ devices.forEach((el)=>{
93
+ if (!newArrow[el]) navigationStyle[el] = 'none';
94
+ else if (newArrow[el] && newControlOverContent[el]) navigationStyle[el] = 'inside';
95
+ else navigationStyle[el] = 'outside';
96
+ });
97
+ return {
98
+ ...setting,
99
+ navigationStyle
100
+ };
101
+ }
102
+ return setting;
103
+ };
104
+ const getData = (props)=>{
105
+ const isRenderCustomIcon = !!props.custom && props.custom !== '';
106
+ return {
107
+ isRenderCustomIcon
108
+ };
109
+ };
110
+
111
+ export { getArrowDisplayStyle, getArrowPositionStyle, getClassArrowDisplay, getClassArrowRotate, getData, getResponsiveSetting, mappingNavigationCarousel };
@@ -0,0 +1,48 @@
1
+ import { createClass } from '@gem-sdk/system';
2
+ import { getClassArrowDisplay, getClassArrowRotate, getResponsiveSetting } from './common.js';
3
+
4
+ const getClass = (props)=>{
5
+ const { className, componentId, rootId, left, uid, isHiddenWhenDisabled, disabled, showWhenHover, showArrow, vertical } = props;
6
+ const idClass = 'gp-carousel-arrow-' + uid;
7
+ const arrowType = getResponsiveSetting(showArrow || {});
8
+ const classAction = left ? 'gp-carousel-action-back gem-slider-previous' : 'gp-carousel-action-next gem-slider-next';
9
+ const buttonClass = createClass({
10
+ ...{
11
+ 'gp-z-1 gp-items-center gp-justify-center gp-overflow-hidden gp-shrink-0': true
12
+ },
13
+ ...{
14
+ [idClass]: true
15
+ },
16
+ ...className && {
17
+ [className]: true
18
+ },
19
+ ...componentId && {
20
+ [componentId]: true
21
+ },
22
+ ...rootId && {
23
+ [rootId]: true
24
+ },
25
+ ...classAction && {
26
+ [classAction]: true
27
+ },
28
+ ...{
29
+ hidden: isHiddenWhenDisabled && disabled,
30
+ 'gp-cursor-default gp-text-gray-300': disabled,
31
+ 'gp-cursor-pointer gp-text-gray-500': !disabled,
32
+ '!gp-invisible group-hover/carousel:!gp-visible': showWhenHover,
33
+ ...getClassArrowDisplay(arrowType, vertical)
34
+ }
35
+ });
36
+ const buttonContentClass = createClass({
37
+ ...{
38
+ 'gp-flex gp-items-center gp-justify-center [&>svg]:gp-h-full [&>svg]:gp-w-full': true
39
+ },
40
+ ...getClassArrowRotate(Boolean(left), vertical)
41
+ });
42
+ return {
43
+ buttonClass,
44
+ buttonContentClass
45
+ };
46
+ };
47
+
48
+ export { getClass };
@@ -0,0 +1,82 @@
1
+ import { createStyleReact, createStyle } from '@gem-sdk/system';
2
+ import { getResponsiveStyleShadowWithoutState, getPaddingGlobalSize, makeGlobalSizeWidthResponsive, makeGlobalSizeHeightResponsive, makeStyleResponsive, makeStyle, composeCornerCss, composeBorderCss } from '@gem-sdk/core';
3
+ import { getArrowDisplayStyle, getArrowPositionStyle, getResponsiveSetting } from './common.js';
4
+
5
+ const getStyle = (props, type = 'liquid')=>{
6
+ const { uid, vertical, showArrow, gapToEachSize, left, arrowBackgroundColor, arrowButtonSize, rootId, arrowBorder, arrowCorner, arrowCustomColor, arrowIconSize, arrowShadow } = props;
7
+ const arrowShadowStyle = getResponsiveStyleShadowWithoutState(arrowShadow, 'box-shadow', arrowShadow);
8
+ const arrowBorderStyle = getResponsiveSetting(arrowBorder || {});
9
+ const arrowCornerStyle = getResponsiveSetting(arrowCorner || {});
10
+ const buttonPadding = getPaddingGlobalSize(arrowButtonSize);
11
+ const iconSizeResponsive = getResponsiveSetting(arrowIconSize || {});
12
+ const arrowType = getResponsiveSetting(showArrow || {});
13
+ const buttonWidth = makeGlobalSizeWidthResponsive(arrowButtonSize);
14
+ const buttonHeight = makeGlobalSizeHeightResponsive(arrowButtonSize);
15
+ const iconWidth = makeStyleResponsive('w', iconSizeResponsive, 'px');
16
+ const iconHeight = makeStyleResponsive('h', iconSizeResponsive, 'px');
17
+ const display = makeStyleResponsive('d', getArrowDisplayStyle(arrowType));
18
+ const position = makeStyle(getArrowPositionStyle({
19
+ vertical,
20
+ arrowType,
21
+ gapToEachSize: gapToEachSize ?? '',
22
+ left: Boolean(left)
23
+ }));
24
+ const buttonStyleObj = {
25
+ 'background-color': arrowBackgroundColor ?? '',
26
+ ...display,
27
+ ...position,
28
+ ...buttonWidth,
29
+ ...buttonHeight,
30
+ ...buttonPadding,
31
+ ...arrowShadowStyle
32
+ };
33
+ const buttonContentStyleObj = {
34
+ ...makeStyle({
35
+ c: arrowCustomColor
36
+ }),
37
+ ...iconWidth,
38
+ ...iconHeight
39
+ };
40
+ const buttonStyle = type === 'react' ? createStyleReact(buttonStyleObj) : createStyle(buttonStyleObj);
41
+ const buttonContentStyle = type === 'react' ? createStyleReact(buttonContentStyleObj) : createStyle(buttonContentStyleObj);
42
+ const innerBorderCss = `
43
+ ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid} {
44
+ ${composeCornerCss(arrowCornerStyle.desktop)}
45
+ }
46
+ ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid}::before {
47
+ content: '';
48
+ height: 100%;
49
+ width: 100%;
50
+ position: absolute;
51
+ pointer-events: none;
52
+ z-index: 10;
53
+ ${composeBorderCss(arrowBorderStyle.desktop)}
54
+ ${composeCornerCss(arrowCornerStyle.desktop)}
55
+ }
56
+ @media only screen and (max-width: 1024px) and (min-width: 768px) {
57
+ ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid} {
58
+ ${composeCornerCss(arrowCornerStyle.tablet)}
59
+ }
60
+ ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid}::before {
61
+ ${composeBorderCss(arrowBorderStyle.tablet)}
62
+ ${composeCornerCss(arrowCornerStyle.tablet)}
63
+ }
64
+ }
65
+ @media only screen and (max-width: 768px) {
66
+ ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid} {
67
+ ${composeCornerCss(arrowCornerStyle.mobile)}
68
+ }
69
+ ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid}::before {
70
+ ${composeBorderCss(arrowBorderStyle.mobile)}
71
+ ${composeCornerCss(arrowCornerStyle.mobile)}
72
+ }
73
+ }
74
+ `;
75
+ return {
76
+ buttonStyle,
77
+ buttonContentStyle,
78
+ innerBorderCss
79
+ };
80
+ };
81
+
82
+ export { getStyle };
@@ -0,0 +1,30 @@
1
+ 'use client';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { isEmptyChildren } from '@gem-sdk/core';
4
+ import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
5
+ import { getStyle } from './common/getStyle.js';
6
+ import { getClass } from './common/getClass.js';
7
+ import { useCarouselItem } from './hook/useCarouseItem.js';
8
+
9
+ const CarouselItem = (props)=>{
10
+ const { children, builderAttrs } = props;
11
+ const { handleClick, handleMouseMove, handleMouseOut } = useCarouselItem(props);
12
+ const { carouselItemStyle, carouselItemInnerStyle } = getStyle(props);
13
+ const { carouselItemClass, carouselItemInnerClass } = getClass(props);
14
+ return /*#__PURE__*/ jsx("div", {
15
+ ...builderAttrs,
16
+ "aria-hidden": true,
17
+ className: carouselItemClass,
18
+ style: carouselItemStyle,
19
+ onClick: handleClick,
20
+ onMouseMove: handleMouseMove,
21
+ onMouseLeave: handleMouseOut,
22
+ children: /*#__PURE__*/ jsx("div", {
23
+ className: carouselItemInnerClass,
24
+ style: carouselItemInnerStyle,
25
+ children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
26
+ })
27
+ });
28
+ };
29
+
30
+ export { CarouselItem as default };
@@ -0,0 +1,34 @@
1
+ import { template } from '@gem-sdk/core';
2
+ import { getStyle } from './common/getStyle.js';
3
+ import { getClass } from './common/getClass.js';
4
+
5
+ const CarouselItem = (props)=>{
6
+ const { builderAttrs, index, children } = props;
7
+ const { carouselItemStyle, carouselItemInnerStyle } = getStyle(props);
8
+ const { carouselItemClass, carouselItemInnerClass } = getClass(props);
9
+ return template`
10
+ <div
11
+ ${{
12
+ ...builderAttrs
13
+ }}
14
+ class="${carouselItemClass}"
15
+ style="${carouselItemStyle}"
16
+ data-index="${index}"
17
+ grid-index="{{forloop.index}}"
18
+ external-id="{{media.external_id}}"
19
+ media-type="{{media.media_type}}"
20
+ media-poster="{{media.preview_image.src}}"
21
+ media-source-url="{{media.sources.first.url}}"
22
+ media-last-source-url="{{mediaSourceUrl}}"
23
+ >
24
+ <div
25
+ class="${carouselItemInnerClass}"
26
+ style="${carouselItemInnerStyle}"
27
+ >
28
+ ${children}
29
+ </div>
30
+ </div>
31
+ `;
32
+ };
33
+
34
+ export { CarouselItem as default };
@@ -0,0 +1,27 @@
1
+ import { createClass } from '@gem-sdk/system';
2
+
3
+ const getClass = (props)=>{
4
+ const { parentId, parentUid, builderProps, className } = props;
5
+ const carouselItemClass = createClass({
6
+ [`gem-slider-item gp-w-full`]: true,
7
+ [`gem-slider-item-${parentId || parentUid}`]: true,
8
+ ...parentUid && {
9
+ [`gp-child-item-${parentUid}`]: true
10
+ },
11
+ ...builderProps?.uid && {
12
+ [builderProps?.uid]: true
13
+ },
14
+ ...className && {
15
+ [className]: true
16
+ }
17
+ });
18
+ const carouselItemInnerClass = createClass({
19
+ 'gp-h-full gp-w-full': true
20
+ });
21
+ return {
22
+ carouselItemClass,
23
+ carouselItemInnerClass
24
+ };
25
+ };
26
+
27
+ export { getClass };
@@ -0,0 +1,77 @@
1
+ import { makeGlobalSize, getStyleBackgroundByDevice, getGradientBgrStyleByDevice, makeStyleResponsive, getStyleShadow, makeStyle, getSingleColorVariable, getRadiusStyleActiveState } from '@gem-sdk/core';
2
+ import { getInitialWidthForCarouselItem, getCarouselSneakPeakTranslate } from '../../components/common/carousel.js';
3
+ import { createStyle } from '@gem-sdk/system';
4
+
5
+ const getStyle = (props)=>{
6
+ const { style, contentType, parentStyle, parentSettings, background, customStyle, index } = props;
7
+ const itemPadding = makeGlobalSize(parentStyle?.itemPadding);
8
+ const styleByContentType = ()=>{
9
+ const delList = [
10
+ '--radius'
11
+ ];
12
+ delList.forEach((element)=>{
13
+ delete style?.[element];
14
+ });
15
+ if (contentType === 'productImage') return style;
16
+ return {
17
+ ...style,
18
+ ...makeStyle({
19
+ bs: parentStyle?.borderContent?.border,
20
+ bw: parentStyle?.borderContent?.width,
21
+ bc: getSingleColorVariable(parentStyle?.borderContent?.color)
22
+ }),
23
+ ...getRadiusStyleActiveState({
24
+ ...parentStyle?.roundedContent,
25
+ active: {
26
+ ...parentStyle?.roundedContent || {},
27
+ radiusType: 'custom'
28
+ }
29
+ })
30
+ };
31
+ };
32
+ const getCarouselItemStyle = {
33
+ ...customStyle,
34
+ ...itemPadding && itemPadding.padding,
35
+ ...getInitialWidthForCarouselItem({
36
+ spacing: parentStyle?.spacing,
37
+ slidesToShow: parentSettings?.itemNumber ?? parentSettings?.slidesToShow,
38
+ sneakPeak: parentSettings?.sneakPeak,
39
+ sneakPeakType: parentSettings?.sneakPeakType,
40
+ sneakPeakOffsetCenter: parentSettings?.sneakPeakOffsetCenter,
41
+ sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward,
42
+ vertical: parentSettings?.vertical
43
+ }),
44
+ ...getStyleBackgroundByDevice(background),
45
+ ...getGradientBgrStyleByDevice(background, {
46
+ desktop: true,
47
+ tablet: true,
48
+ mobile: true
49
+ }),
50
+ ...makeStyleResponsive('ml', getCarouselSneakPeakTranslate({
51
+ index,
52
+ spacing: parentStyle?.spacing,
53
+ slidesToShow: parentSettings?.itemNumber ?? parentSettings?.slidesToShow,
54
+ sneakPeak: parentSettings?.sneakPeak,
55
+ sneakPeakType: parentSettings?.sneakPeakType,
56
+ sneakPeakOffsetCenter: parentSettings?.sneakPeakOffsetCenter,
57
+ sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward
58
+ }))
59
+ };
60
+ const carouselItemInnerStyle = createStyle({
61
+ ...getStyleShadow({
62
+ value: parentStyle?.carouselShadow,
63
+ styleAppliedFor: 'box-shadow',
64
+ isEnableShadow: parentStyle?.hasActiveShadow
65
+ })
66
+ });
67
+ const carouselItemStyle = createStyle({
68
+ ...getCarouselItemStyle,
69
+ ...styleByContentType()
70
+ });
71
+ return {
72
+ carouselItemStyle,
73
+ carouselItemInnerStyle
74
+ };
75
+ };
76
+
77
+ export { getStyle };
@@ -0,0 +1,20 @@
1
+ const useCarouselItem = (props)=>{
2
+ const { onClickItem, onMouseMove, onMouseOut, dispatchEventSelectSlide, index = 0 } = props;
3
+ const handleClick = (e)=>{
4
+ onClickItem && onClickItem(e);
5
+ dispatchEventSelectSlide && dispatchEventSelectSlide(index);
6
+ };
7
+ const handleMouseMove = (e)=>{
8
+ onMouseMove && onMouseMove(e);
9
+ };
10
+ const handleMouseOut = (e)=>{
11
+ onMouseOut && onMouseOut(e);
12
+ };
13
+ return {
14
+ handleClick,
15
+ handleMouseMove,
16
+ handleMouseOut
17
+ };
18
+ };
19
+
20
+ export { useCarouselItem };
@@ -0,0 +1,93 @@
1
+ import { makeStyleResponsive, makeWidth, getResponsiveValueByScreen } from '@gem-sdk/core';
2
+ import { convertUnitToNumber } from '../../../helpers.js';
3
+
4
+ const DEVICES = [
5
+ 'desktop',
6
+ 'mobile',
7
+ 'tablet'
8
+ ];
9
+ const getInitialWidthForCarouselItem = (setting)=>{
10
+ let result = {};
11
+ DEVICES.forEach((device)=>{
12
+ if (!setting?.vertical?.[device]) {
13
+ const className = {
14
+ ...makeStyleResponsive('minw', makeWidth(getWidthForCarouselItem({
15
+ spacing: setting?.spacing,
16
+ slidesToShow: setting?.slidesToShow,
17
+ sneakPeak: setting?.sneakPeak,
18
+ sneakPeakType: setting?.sneakPeakType,
19
+ sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
20
+ sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
21
+ }))),
22
+ ...makeStyleResponsive('maxw', makeWidth(getWidthForCarouselItem({
23
+ spacing: setting?.spacing,
24
+ slidesToShow: setting?.slidesToShow,
25
+ sneakPeak: setting?.sneakPeak,
26
+ sneakPeakType: setting?.sneakPeakType,
27
+ sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
28
+ sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
29
+ })))
30
+ };
31
+ result = {
32
+ ...result,
33
+ ...className
34
+ };
35
+ }
36
+ });
37
+ return result;
38
+ };
39
+ const getSlideToShow = (setting)=>{
40
+ const result = {};
41
+ DEVICES.forEach((device)=>{
42
+ const enableSneakPeak = getResponsiveValueByScreen(setting.sneakPeak, device);
43
+ const offset = enableSneakPeak ? getResponsiveValueByScreen(setting.sneakPeakType, device) === 'center' ? getResponsiveValueByScreen(setting.sneakPeakOffsetCenter, device) ?? 0 : getResponsiveValueByScreen(setting.sneakPeakOffsetForward, device) ?? 0 : 0;
44
+ const itemNumberByDevice = getResponsiveValueByScreen(setting.slidesToShow, device) || 1;
45
+ const rx = getResponsiveValueByScreen(setting.sneakPeakType, device) === 'center' ? -2 : -1;
46
+ result[device] = itemNumberByDevice === 'auto' ? itemNumberByDevice : itemNumberByDevice + offset / 100 * rx;
47
+ });
48
+ return result;
49
+ };
50
+ const getCarouselSneakPeakTranslate = (setting)=>{
51
+ let result = {};
52
+ DEVICES.forEach((device)=>{
53
+ const spacing = convertUnitToNumber(getResponsiveValueByScreen(setting.spacing, device), 44);
54
+ const sneakPeak = getResponsiveValueByScreen(setting.sneakPeak, device, false);
55
+ const sneakPeakType = getResponsiveValueByScreen(setting.sneakPeakType, device);
56
+ const slidesToShow = convertUnitToNumber(getResponsiveValueByScreen(sneakPeak ? getSlideToShow({
57
+ slidesToShow: setting?.slidesToShow,
58
+ sneakPeak: setting?.sneakPeak,
59
+ sneakPeakType: setting?.sneakPeakType,
60
+ sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
61
+ sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
62
+ }) : setting.slidesToShow, device), 4);
63
+ const offset = 1.5;
64
+ const itemSpacing = spacing * ((setting.index ?? 0) + 1);
65
+ const itemWidth = `100% / ${slidesToShow} - ${(slidesToShow - 1) * spacing / slidesToShow}px + ${itemSpacing}px`;
66
+ result = {
67
+ ...result,
68
+ [device]: sneakPeak && sneakPeakType === 'center' && setting.index === 0 ? `calc((${itemWidth}) * ${offset} - (${itemWidth}))` : `0px`
69
+ };
70
+ });
71
+ return result;
72
+ };
73
+ const getWidthForCarouselItem = (setting)=>{
74
+ let result = {};
75
+ DEVICES.forEach((device)=>{
76
+ const spacing = convertUnitToNumber(getResponsiveValueByScreen(setting.spacing, device), 44);
77
+ const sneakPeak = getResponsiveValueByScreen(setting.sneakPeak, device, false);
78
+ const slidesToShow = convertUnitToNumber(getResponsiveValueByScreen(sneakPeak ? getSlideToShow({
79
+ slidesToShow: setting?.slidesToShow,
80
+ sneakPeak: setting?.sneakPeak,
81
+ sneakPeakType: setting?.sneakPeakType,
82
+ sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
83
+ sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
84
+ }) : setting.slidesToShow, device), 4);
85
+ result = {
86
+ ...result,
87
+ [device]: `calc(100% / ${slidesToShow} - ${(slidesToShow - 1) * spacing / slidesToShow}px)`
88
+ };
89
+ });
90
+ return result;
91
+ };
92
+
93
+ export { getCarouselSneakPeakTranslate, getInitialWidthForCarouselItem, getSlideToShow, getWidthForCarouselItem };
@@ -0,0 +1,3 @@
1
+ const DOT_CONTAINER_SELECTOR = 'gp-carousel-dot-container';
2
+
3
+ export { DOT_CONTAINER_SELECTOR };
@@ -0,0 +1,30 @@
1
+ import { useRef, useState, useEffect } from 'react';
2
+
3
+ const useTrackPreviewPause = (runPreview)=>{
4
+ const trackerRef = useRef(undefined);
5
+ const [isFirstPreviewClicked, setIsFirstPreviewClicked] = useState(false);
6
+ useEffect(()=>{
7
+ if (isFirstPreviewClicked) return;
8
+ if (!trackerRef.current) {
9
+ trackerRef.current = JSON.stringify({
10
+ isFirstPreviewClicked,
11
+ runPreview
12
+ });
13
+ return;
14
+ }
15
+ if (!isFirstPreviewClicked && trackerRef.current !== JSON.stringify({
16
+ isFirstPreviewClicked,
17
+ runPreview
18
+ })) {
19
+ setIsFirstPreviewClicked(true);
20
+ }
21
+ }, [
22
+ isFirstPreviewClicked,
23
+ runPreview
24
+ ]);
25
+ return {
26
+ isFirstPreviewClicked
27
+ };
28
+ };
29
+
30
+ export { useTrackPreviewPause as default };
@@ -0,0 +1,35 @@
1
+ // Easing formula from https://easings.net/#
2
+ const CAROUSEL_ANIMATION = {
3
+ EASE_IN: {
4
+ value: 'ease-in',
5
+ formula: (t)=>t * t * t
6
+ },
7
+ EASE_OUT: {
8
+ value: 'ease-out',
9
+ formula: (t)=>1 - Math.pow(1 - t, 3)
10
+ },
11
+ EASE_IN_OUT: {
12
+ value: 'ease-in-out',
13
+ formula: (t)=>t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2
14
+ },
15
+ DEFAULT: {
16
+ value: 'default',
17
+ formula: (t)=>1 + --t * t * t * t * t
18
+ }
19
+ };
20
+ const DEFAULT_PLAY_SPEED = 500;
21
+ const AnimationPlugin = (slider)=>{
22
+ let timeout;
23
+ let previousAnimation = slider.options.animation ?? {};
24
+ slider.on('beforeOptionsChanged', (newOption)=>{
25
+ clearTimeout(timeout);
26
+ timeout = setTimeout(()=>{
27
+ if (newOption.options.animation && JSON.stringify(newOption.options.animation) !== JSON.stringify(previousAnimation)) {
28
+ previousAnimation = newOption.options.animation;
29
+ slider.update(newOption.options);
30
+ }
31
+ }, 200);
32
+ });
33
+ };
34
+
35
+ export { AnimationPlugin, CAROUSEL_ANIMATION, DEFAULT_PLAY_SPEED, AnimationPlugin as default };