@gem-sdk/components 2.0.0-dev.693 → 2.0.0-dev.694

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 (176) hide show
  1. package/dist/cjs/builder.js +6 -12
  2. package/dist/cjs/index.js +32 -34
  3. package/dist/cjs/index.liquid.js +10 -16
  4. package/dist/cjs/next.js +1 -3
  5. package/dist/cjs/product/components/ProductImagesV2/common/common.js +2 -1
  6. package/dist/cjs/product/index.js +4 -6
  7. package/dist/cjs/product/next.js +0 -4
  8. package/dist/cjs/setting.js +76 -78
  9. package/dist/esm/builder.js +0 -6
  10. package/dist/esm/index.js +0 -1
  11. package/dist/esm/index.liquid.js +0 -3
  12. package/dist/esm/next.js +1 -3
  13. package/dist/esm/product/components/ProductImagesV2/common/common.js +2 -1
  14. package/dist/esm/product/index.js +24 -26
  15. package/dist/esm/product/next.js +0 -4
  16. package/dist/esm/setting.js +0 -2
  17. package/dist/types/index.d.ts +116 -551
  18. package/package.json +1 -1
  19. package/dist/cjs/product/components/ProductImagesV3/common/common.js +0 -360
  20. package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +0 -192
  21. package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -26
  22. package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +0 -94
  23. package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +0 -303
  24. package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +0 -95
  25. package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -59
  26. package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +0 -266
  27. package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -63
  28. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -36
  29. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -109
  30. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -139
  31. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -100
  32. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -77
  33. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -300
  34. package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -44
  35. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -83
  36. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -182
  37. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -30
  38. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -239
  39. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -28
  40. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -144
  41. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -14
  42. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -54
  43. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -53
  44. package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -55
  45. package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -41
  46. package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -134
  47. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -203
  48. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -87
  49. package/dist/cjs/product/components/ProductImagesV3/index.js +0 -291
  50. package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +0 -153
  51. package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +0 -252
  52. package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +0 -251
  53. package/dist/cjs/product/setting/product-image-v3/ProductImages.js +0 -74
  54. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -388
  55. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -519
  56. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +0 -337
  57. package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -118
  58. package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -119
  59. package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +0 -237
  60. package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +0 -491
  61. package/dist/cjs/swiper-carousel/arrow/Arrow.js +0 -52
  62. package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +0 -46
  63. package/dist/cjs/swiper-carousel/arrow/common/common.js +0 -119
  64. package/dist/cjs/swiper-carousel/arrow/common/getClass.js +0 -50
  65. package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +0 -84
  66. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +0 -34
  67. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -38
  68. package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +0 -29
  69. package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +0 -79
  70. package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -22
  71. package/dist/cjs/swiper-carousel/components/common/carousel.js +0 -98
  72. package/dist/cjs/swiper-carousel/components/const/index.js +0 -5
  73. package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -34
  74. package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +0 -42
  75. package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -105
  76. package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -15
  77. package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +0 -45
  78. package/dist/cjs/swiper-carousel/dots/Dots.js +0 -51
  79. package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +0 -26
  80. package/dist/cjs/swiper-carousel/dots/common/common.js +0 -28
  81. package/dist/cjs/swiper-carousel/dots/common/getClass.js +0 -40
  82. package/dist/cjs/swiper-carousel/dots/common/getStyle.js +0 -33
  83. package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +0 -21
  84. package/dist/cjs/swiper-carousel/index.js +0 -17
  85. package/dist/cjs/swiper-carousel/next.js +0 -22
  86. package/dist/cjs/swiper-carousel/root/Swiper.js +0 -128
  87. package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +0 -104
  88. package/dist/cjs/swiper-carousel/root/common/getAttr.js +0 -25
  89. package/dist/cjs/swiper-carousel/root/common/getClass.js +0 -135
  90. package/dist/cjs/swiper-carousel/root/common/getData.js +0 -56
  91. package/dist/cjs/swiper-carousel/root/common/getStyle.js +0 -66
  92. package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +0 -482
  93. package/dist/cjs/swiper-carousel/setting/Swiper.js +0 -42
  94. package/dist/cjs/swiper-carousel/setting/SwiperItem.js +0 -40
  95. package/dist/cjs/swiper-carousel/setting/configs/presets.js +0 -87
  96. package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +0 -822
  97. package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +0 -718
  98. package/dist/esm/product/components/ProductImagesV3/common/common.js +0 -344
  99. package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +0 -189
  100. package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -24
  101. package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +0 -83
  102. package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +0 -292
  103. package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +0 -92
  104. package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -53
  105. package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +0 -251
  106. package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -59
  107. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -32
  108. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -105
  109. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -135
  110. package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -96
  111. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -73
  112. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -296
  113. package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -40
  114. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -79
  115. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -178
  116. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -26
  117. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -235
  118. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -24
  119. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -140
  120. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -12
  121. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -52
  122. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -51
  123. package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -53
  124. package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -39
  125. package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -132
  126. package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -201
  127. package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -85
  128. package/dist/esm/product/components/ProductImagesV3/index.js +0 -287
  129. package/dist/esm/product/components/ProductImagesV3/index.liquid.js +0 -149
  130. package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +0 -248
  131. package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +0 -248
  132. package/dist/esm/product/setting/product-image-v3/ProductImages.js +0 -70
  133. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -384
  134. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -516
  135. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +0 -335
  136. package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -116
  137. package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -117
  138. package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +0 -235
  139. package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +0 -489
  140. package/dist/esm/swiper-carousel/arrow/Arrow.js +0 -48
  141. package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +0 -42
  142. package/dist/esm/swiper-carousel/arrow/common/common.js +0 -111
  143. package/dist/esm/swiper-carousel/arrow/common/getClass.js +0 -48
  144. package/dist/esm/swiper-carousel/arrow/common/getStyle.js +0 -82
  145. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +0 -30
  146. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -34
  147. package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +0 -27
  148. package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +0 -77
  149. package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -20
  150. package/dist/esm/swiper-carousel/components/common/carousel.js +0 -93
  151. package/dist/esm/swiper-carousel/components/const/index.js +0 -3
  152. package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -30
  153. package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +0 -35
  154. package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -103
  155. package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -13
  156. package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +0 -43
  157. package/dist/esm/swiper-carousel/dots/Dots.js +0 -47
  158. package/dist/esm/swiper-carousel/dots/Dots.liquid.js +0 -22
  159. package/dist/esm/swiper-carousel/dots/common/common.js +0 -26
  160. package/dist/esm/swiper-carousel/dots/common/getClass.js +0 -38
  161. package/dist/esm/swiper-carousel/dots/common/getStyle.js +0 -31
  162. package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +0 -19
  163. package/dist/esm/swiper-carousel/index.js +0 -15
  164. package/dist/esm/swiper-carousel/next.js +0 -18
  165. package/dist/esm/swiper-carousel/root/Swiper.js +0 -124
  166. package/dist/esm/swiper-carousel/root/Swiper.liquid.js +0 -100
  167. package/dist/esm/swiper-carousel/root/common/getAttr.js +0 -23
  168. package/dist/esm/swiper-carousel/root/common/getClass.js +0 -133
  169. package/dist/esm/swiper-carousel/root/common/getData.js +0 -54
  170. package/dist/esm/swiper-carousel/root/common/getStyle.js +0 -64
  171. package/dist/esm/swiper-carousel/root/hook/useCarousel.js +0 -480
  172. package/dist/esm/swiper-carousel/setting/Swiper.js +0 -38
  173. package/dist/esm/swiper-carousel/setting/SwiperItem.js +0 -36
  174. package/dist/esm/swiper-carousel/setting/configs/presets.js +0 -85
  175. package/dist/esm/swiper-carousel/setting/configs/settingV2.js +0 -818
  176. package/dist/esm/swiper-carousel/setting/configs/uiV2.js +0 -713
@@ -1,105 +0,0 @@
1
- 'use strict';
2
-
3
- const AutoPlayPlugin = (slider)=>{
4
- let autoplay = slider.options.autoplay ?? {};
5
- let timeout;
6
- let mouseOver = false;
7
- let inViewport = false;
8
- let observer = null;
9
- // Thêm sự kiện cho dot nếu có
10
- const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
11
- // Callback của IntersectionObserver
12
- function handleIntersection(entries) {
13
- entries.forEach((entry)=>{
14
- // Với threshold 0, chỉ cần một phần bất kỳ hiển thị sẽ đánh dấu isIntersecting
15
- inViewport = entry.isIntersecting;
16
- if (inViewport) {
17
- nextTimeout();
18
- } else {
19
- clearNextTimeout();
20
- }
21
- });
22
- }
23
- function initIntersectionObserver() {
24
- // Nếu đã có observer hoặc không có container thì không khởi tạo lại
25
- if (observer || !slider.container) return;
26
- observer = new IntersectionObserver(handleIntersection, {
27
- root: null,
28
- threshold: 0
29
- });
30
- observer.observe(slider.container);
31
- }
32
- function clearNextTimeout() {
33
- clearTimeout(timeout);
34
- }
35
- function nextTimeout() {
36
- clearNextTimeout();
37
- timeout = setTimeout(()=>{
38
- // Nếu đang hover, autoplay bị tắt hoặc slider không trong viewport thì không chuyển slide
39
- if (mouseOver || !autoplay.enable || !inViewport) return;
40
- slider.next();
41
- }, autoplay.delay ?? 2000);
42
- }
43
- function onMouseOver() {
44
- mouseOver = true;
45
- clearNextTimeout();
46
- }
47
- function onMouseOut() {
48
- mouseOver = false;
49
- nextTimeout();
50
- }
51
- slider.on('created', ()=>{
52
- $dots?.addEventListener('mouseover', onMouseOver);
53
- $dots?.addEventListener('mouseout', onMouseOut);
54
- // Nếu tùy chọn pauseOnHover bật thì thêm sự kiện hover cho container slider
55
- if (autoplay.pauseOnHover && slider.container) {
56
- slider.container.addEventListener('mouseover', onMouseOver);
57
- slider.container.addEventListener('mouseout', onMouseOut);
58
- }
59
- if (autoplay.enable) {
60
- initIntersectionObserver();
61
- nextTimeout();
62
- }
63
- });
64
- slider.on('dragStarted', clearNextTimeout);
65
- slider.on('animationEnded', nextTimeout);
66
- slider.on('updated', (newOptions)=>{
67
- autoplay = newOptions.options?.autoplay ?? {};
68
- if (autoplay.enable) {
69
- initIntersectionObserver();
70
- nextTimeout();
71
- }
72
- });
73
- slider.on('optionsChanged', (newOptions)=>{
74
- if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover && slider.container) {
75
- if (newOptions.options.autoplay?.pauseOnHover) {
76
- slider.container.addEventListener('mouseover', onMouseOver);
77
- slider.container.addEventListener('mouseout', onMouseOut);
78
- } else {
79
- slider.container.removeEventListener('mouseover', onMouseOver);
80
- slider.container.removeEventListener('mouseout', onMouseOut);
81
- mouseOver = false;
82
- }
83
- }
84
- autoplay = newOptions.options.autoplay ?? {};
85
- if (autoplay.enable) {
86
- initIntersectionObserver();
87
- nextTimeout();
88
- }
89
- });
90
- slider.on('destroyed', ()=>{
91
- if (slider.container) {
92
- slider.container.removeEventListener('mouseover', onMouseOver);
93
- slider.container.removeEventListener('mouseout', onMouseOut);
94
- }
95
- $dots?.removeEventListener('mouseover', onMouseOver);
96
- $dots?.removeEventListener('mouseout', onMouseOut);
97
- clearNextTimeout();
98
- if (observer) {
99
- observer.disconnect();
100
- observer = null;
101
- }
102
- });
103
- };
104
-
105
- exports.AutoPlayPlugin = AutoPlayPlugin;
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- //Solution from https://github.com/rcbyr/keen-slider/issues/255
4
- const FixSliderMoveBackwards = (slider)=>{
5
- slider.on('animationEnded', (slider)=>{
6
- const { rel, progress } = slider.track.details;
7
- if (rel === 0 && progress !== 0) {
8
- slider.moveToIdx(0, true, {
9
- duration: 0
10
- });
11
- }
12
- });
13
- };
14
-
15
- exports.FixSliderMoveBackwards = FixSliderMoveBackwards;
@@ -1,45 +0,0 @@
1
- 'use strict';
2
-
3
- const MutationPlugin = (slider)=>{
4
- const observer = new MutationObserver((mutations)=>{
5
- mutations.forEach(()=>{
6
- slider.update();
7
- });
8
- });
9
- const config = {
10
- childList: true
11
- };
12
- const resizeObserver = new ResizeObserver(function() {
13
- resetStyleOfSlides(slider);
14
- slider.update();
15
- });
16
- const resetStyleOfSlides = (slider)=>{
17
- if (slider.options.vertical) {
18
- removeMinMaxWidthOfSlides(slider);
19
- return;
20
- }
21
- removeMinMaxHeightOfSlides(slider);
22
- };
23
- const removeMinMaxWidthOfSlides = (slider)=>{
24
- slider.slides.forEach((slide)=>{
25
- slide.style.maxWidth = '';
26
- slide.style.minWidth = '';
27
- });
28
- };
29
- const removeMinMaxHeightOfSlides = (slider)=>{
30
- slider.slides.forEach((slide)=>{
31
- slide.style.maxHeight = '';
32
- slide.style.minHeight = '';
33
- });
34
- };
35
- slider.on('created', ()=>{
36
- resizeObserver.observe(slider.container);
37
- observer.observe(slider.container, config);
38
- });
39
- slider.on('destroyed', ()=>{
40
- resizeObserver.unobserve(slider.container);
41
- observer.disconnect();
42
- });
43
- };
44
-
45
- exports.MutationPlugin = MutationPlugin;
@@ -1,51 +0,0 @@
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 common = require('./common/common.js');
9
- var getClass = require('./common/getClass.js');
10
- var getStyle = require('./common/getStyle.js');
11
- var useDotsSetting = require('./hook/useDotsSetting.js');
12
- var system = require('@gem-sdk/system');
13
-
14
- const Dots = (props)=>{
15
- const { onHandleClick, dotSize, dotActiveColor, dotColor } = props;
16
- const { isLoop, checkIsActive } = useDotsSetting.useDotsSetting(props);
17
- const { checkHidden, getDotItems } = common.getData(props);
18
- const dotItems = getDotItems(isLoop);
19
- const { dotClass } = getClass.getDotClass(props);
20
- const { dotStyle } = getStyle.getDotStyle(props, 'react');
21
- const renderDotItems = ()=>{
22
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
23
- children: dotItems?.map((idx)=>{
24
- const isActive = checkIsActive(idx);
25
- return /*#__PURE__*/ jsxRuntime.jsx("button", {
26
- "aria-label": "Dot",
27
- onClick: ()=>{
28
- onHandleClick && onHandleClick(idx, isLoop);
29
- },
30
- style: {
31
- ...core.makeStyleResponsiveByScreen('w', dotSize, 'px'),
32
- ...isActive ? core.getGlobalColorResponsiveStyle('bg', dotActiveColor) : core.getGlobalColorResponsiveStyle('bg', dotColor)
33
- },
34
- className: core.cls('gp-aspect-square gp-w-3 gp-rounded-full gp-shadow-md', {
35
- 'gem-slider-dot-active': isActive,
36
- 'gem-slider-dot-inactive': !isActive
37
- })
38
- }, idx);
39
- })
40
- });
41
- };
42
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
43
- children: system.If(!checkHidden(dotItems), /*#__PURE__*/ jsxRuntime.jsx("div", {
44
- className: dotClass,
45
- style: dotStyle,
46
- children: renderDotItems()
47
- }))
48
- });
49
- };
50
-
51
- exports.default = Dots;
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@gem-sdk/core');
6
- var getClass = require('./common/getClass.js');
7
- var getStyle = require('./common/getStyle.js');
8
- var system = require('@gem-sdk/system');
9
- var common = require('./common/common.js');
10
-
11
- const Dots = (props)=>{
12
- const isLoop = core.getResponsiveValueByScreen(props.loop, 'desktop', false);
13
- const { checkHidden, getDotItems } = common.getData(props);
14
- const dotItems = getDotItems(isLoop);
15
- const { dotClass } = getClass.getDotClass(props);
16
- const { dotStyle } = getStyle.getDotStyle(props);
17
- return core.template`
18
- ${system.If(!checkHidden(dotItems), core.template`
19
- <div class="${dotClass}" style="${dotStyle}">
20
- <!-- item render by js -->
21
- </div>
22
- `)}
23
- `;
24
- };
25
-
26
- exports.default = Dots;
@@ -1,28 +0,0 @@
1
- 'use strict';
2
-
3
- require('@gem-sdk/core');
4
-
5
- const getData = (props)=>{
6
- const { hiddenWhenOnlyOne } = props;
7
- const getDotItems = (isLoop)=>{
8
- const { enabledSneakPeak, totalSlideItem = 0, numberOfFullWidthShow = 0, slideItemsPerPage = 0 } = props;
9
- if (enabledSneakPeak) {
10
- return Array.from({
11
- length: isLoop ? totalSlideItem : totalSlideItem - numberOfFullWidthShow + 1
12
- }, (_, i)=>i);
13
- } else {
14
- return Array.from({
15
- length: isLoop ? totalSlideItem : Math.ceil(totalSlideItem / slideItemsPerPage)
16
- }, (_, i)=>i);
17
- }
18
- };
19
- const checkHidden = (totalDots)=>{
20
- return hiddenWhenOnlyOne && totalDots?.length < 2;
21
- };
22
- return {
23
- checkHidden,
24
- getDotItems
25
- };
26
- };
27
-
28
- exports.getData = getData;
@@ -1,40 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
- var system = require('@gem-sdk/system');
5
- var index = require('../../components/const/index.js');
6
-
7
- const getDotClass = (props)=>{
8
- const { dotStyle, vertical, className, uniqueComponentId } = props;
9
- const getDisplayClass = ()=>{
10
- const devices = [
11
- 'desktop',
12
- 'tablet',
13
- 'mobile'
14
- ];
15
- const result = {};
16
- devices.forEach((device)=>{
17
- const dotStyleSetting = core.getResponsiveValueByScreen(dotStyle, device);
18
- const verticalSetting = core.getResponsiveValueByScreen(vertical, device);
19
- const deviceType = device === 'desktop' ? '' : `${device}:`;
20
- result[`${deviceType}gp-absolute`] = dotStyleSetting === 'inside';
21
- result[`${deviceType}gp-static`] = dotStyleSetting !== 'inside';
22
- result[`${deviceType}gp-flex-row ${deviceType}gp-left-0 ${deviceType}gp-right-0`] = !verticalSetting;
23
- result[`${deviceType}gp-flex-col ${deviceType}gp-ml-2 ${deviceType}gp-w-fit ${deviceType}gp-h-full`] = !!verticalSetting;
24
- });
25
- return result;
26
- };
27
- const dotClass = system.createClass({
28
- [`${index.DOT_CONTAINER_SELECTOR} ${index.DOT_CONTAINER_SELECTOR}-${uniqueComponentId}`]: true,
29
- ['gp-z-2 gp-flex gp-flex-1 gp-items-center gp-justify-center gp-gap-2 gp-text-center']: true,
30
- ...className && {
31
- [className]: true
32
- },
33
- ...getDisplayClass()
34
- });
35
- return {
36
- dotClass
37
- };
38
- };
39
-
40
- exports.getDotClass = getDotClass;
@@ -1,33 +0,0 @@
1
- 'use strict';
2
-
3
- var system = require('@gem-sdk/system');
4
- var core = require('@gem-sdk/core');
5
-
6
- const getDotStyle = (props, componentType)=>{
7
- const { dotStyle: style, dotGapToCarousel, vertical } = props;
8
- const isReactComp = componentType === 'react';
9
- const getStyleDisplayDots = ()=>{
10
- const devices = [
11
- 'desktop',
12
- 'tablet',
13
- 'mobile'
14
- ];
15
- const result = {};
16
- devices.forEach((device)=>{
17
- const dotStyleSetting = core.getResponsiveValueByScreen(style, device);
18
- const deviceType = device === 'desktop' ? '' : `${device}`;
19
- result[`--d${deviceType.length === 0 ? '' : '-' + deviceType}`] = dotStyleSetting && dotStyleSetting !== 'none' ? 'flex' : 'none';
20
- });
21
- return result;
22
- };
23
- const dotStyleObj = {
24
- ...core.makeDotGapToCarouselStyle(style, dotGapToCarousel, vertical),
25
- ...getStyleDisplayDots()
26
- };
27
- const dotStyle = isReactComp ? system.createStyleReact(dotStyleObj) : system.createStyle(dotStyleObj);
28
- return {
29
- dotStyle
30
- };
31
- };
32
-
33
- exports.getDotStyle = getDotStyle;
@@ -1,21 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
-
5
- const useDotsSetting = (props)=>{
6
- const { loop, enabledSneakPeak, slideItemsPerPage = 1, currentSlide = 1 } = props;
7
- const currentDevice = core.useCurrentDevice();
8
- const isLoop = core.getResponsiveValueByScreen(loop, currentDevice, false);
9
- const checkIsActive = (idx)=>{
10
- if (enabledSneakPeak) {
11
- return idx === currentSlide;
12
- }
13
- return idx === (isLoop ? currentSlide : Math.ceil(currentSlide / slideItemsPerPage));
14
- };
15
- return {
16
- isLoop,
17
- checkIsActive
18
- };
19
- };
20
-
21
- exports.useDotsSetting = useDotsSetting;
@@ -1,17 +0,0 @@
1
- 'use strict';
2
-
3
- require('react/jsx-runtime');
4
- require('@gem-sdk/core');
5
- require('react');
6
- require('@gem-sdk/system');
7
- require('@gem-sdk/keen-slider/react');
8
- require('next/link');
9
- var Swiper$1 = require('./setting/Swiper.js');
10
- var SwiperItem$1 = require('./setting/SwiperItem.js');
11
-
12
- const swiperCarouselSetting = {
13
- SwiperCarousel: Swiper$1.default,
14
- SwiperCarouselItem: SwiperItem$1.default
15
- };
16
-
17
- exports.swiperCarouselSetting = swiperCarouselSetting;
@@ -1,22 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var dynamic = require('next/dynamic');
6
- var Loading = require('../common/components/Loading.js');
7
- require('react/jsx-runtime');
8
- require('react');
9
- require('@gem-sdk/core');
10
-
11
- const SwiperCarousel = dynamic(()=>Promise.resolve().then(function () { return require('./root/Swiper.js'); }), {
12
- loading: Loading.default
13
- });
14
- const SwiperCarouselItem = dynamic(()=>Promise.resolve().then(function () { return require('./carousel-item/SwiperItem.js'); }), {
15
- loading: Loading.default
16
- });
17
- var swiperCarousel = {
18
- SwiperCarousel,
19
- SwiperCarouselItem
20
- };
21
-
22
- exports.default = swiperCarousel;
@@ -1,128 +0,0 @@
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 Dots = require('../dots/Dots.js');
10
- var Arrow = require('../arrow/Arrow.js');
11
- var common = require('../arrow/common/common.js');
12
- var useCarousel = require('./hook/useCarousel.js');
13
- var getClass = require('./common/getClass.js');
14
- var getStyle = require('./common/getStyle.js');
15
- var getAttr = require('./common/getAttr.js');
16
- var getData = require('./common/getData.js');
17
-
18
- const Carousel = /*#__PURE__*/ React.forwardRef((props, ref)=>{
19
- const { children, builderAttrs, builderProps, styles, isHiddenArrowWhenDisabled = true, hiddenDotWhenOnlyOne, elmRef } = props;
20
- const setting = common.mappingNavigationCarousel(props.setting);
21
- const renderData = {
22
- ...props,
23
- setting
24
- };
25
- const { arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', roundedArrow, arrowIconSize, arrowCustomColor, arrowBorder, arrowShadow, showWhenHover } = setting ?? {};
26
- const { totalSlideItem, isInfinity, slider, currentSlide, localRef, showNavigation, isRenderDots, handleDotClick, getItemsPerPage, sliderRef, handleNextAndPrevSlide, dispatchEventSelectSlide, getNumberOfFullWidthShow } = useCarousel.useCarousel(renderData, ref);
27
- const { loopConfig, arrowShowConfig } = getData.getData(renderData);
28
- const { rootClassRender, wrapperClassRender, wrapperInnerClass, sliderClass } = getClass.getClass(renderData);
29
- const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle } = getStyle.getStyle(renderData);
30
- const { rootAttrRender, sliderAttr } = getAttr.getAttr(renderData);
31
- const currentDevice = core.useCurrentDevice();
32
- const enabledSneakPeak = setting?.sneakPeak?.[currentDevice];
33
- const renderArrow = (position)=>{
34
- const isNext = position === 'next';
35
- return /*#__PURE__*/ jsxRuntime.jsx(Arrow.default, {
36
- uid: builderProps?.uid,
37
- custom: setting?.arrowCustom ?? '',
38
- showArrow: arrowShowConfig,
39
- arrowButtonSize: arrowButtonSize || {},
40
- arrowIconSize: arrowIconSize || {},
41
- arrowBackgroundColor: arrowBackgroundColor || '',
42
- arrowCustomColor: arrowCustomColor,
43
- gapToEachSize: arrowGapToEachSide,
44
- showWhenHover: showWhenHover,
45
- arrowBorder: arrowBorder || {},
46
- arrowCorner: roundedArrow || {},
47
- arrowShadow: arrowShadow || {},
48
- onClick: (e)=>{
49
- e.stopPropagation();
50
- handleNextAndPrevSlide(position);
51
- },
52
- left: !isNext,
53
- disabled: !isInfinity && slider?.track?.details?.abs === 0,
54
- vertical: setting?.vertical,
55
- isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
56
- rootId: props?.parentClass
57
- });
58
- };
59
- const renderChildren = ()=>{
60
- return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
61
- children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx("div", {
62
- children: "No Slider"
63
- }) : React.Children.map(core.filterToolbarPreview(children), (child, index)=>{
64
- if (/*#__PURE__*/ React.isValidElement(child)) {
65
- return /*#__PURE__*/ jsxRuntime.jsx(child.type, {
66
- ...child.props,
67
- index: index,
68
- parentSettings: setting,
69
- parentStyle: styles,
70
- background: setting?.background,
71
- parentUid: builderProps?.uid,
72
- dispatchEventSelectSlide: dispatchEventSelectSlide
73
- });
74
- }
75
- return null;
76
- })
77
- });
78
- };
79
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
80
- ref: elmRef,
81
- ...rootAttrRender,
82
- className: rootClassRender,
83
- style: rootStyleRender,
84
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
85
- ref: localRef,
86
- ...builderAttrs,
87
- className: wrapperClassRender,
88
- style: wrapperStyleRender,
89
- children: [
90
- /*#__PURE__*/ jsxRuntime.jsxs("div", {
91
- className: wrapperInnerClass,
92
- style: wrapperInnerStyle,
93
- children: [
94
- showNavigation && renderArrow('prev'),
95
- /*#__PURE__*/ jsxRuntime.jsx("div", {
96
- ref: sliderRef,
97
- ...sliderAttr,
98
- className: sliderClass,
99
- children: renderChildren()
100
- }),
101
- showNavigation && renderArrow('next')
102
- ]
103
- }),
104
- isRenderDots && /*#__PURE__*/ jsxRuntime.jsx(Dots.default, {
105
- showDots: setting?.dot,
106
- dotStyle: setting?.dotStyle,
107
- totalSlideItem: totalSlideItem,
108
- slideItemsPerPage: getItemsPerPage(),
109
- currentSlide: currentSlide,
110
- enabledSneakPeak: enabledSneakPeak,
111
- vertical: setting?.vertical,
112
- loop: loopConfig,
113
- dotColor: setting?.dotColor,
114
- dotGapToCarousel: setting?.dotGapToCarousel,
115
- dotSize: setting?.dotSize,
116
- dotActiveColor: setting?.dotActiveColor,
117
- hiddenWhenOnlyOne: hiddenDotWhenOnlyOne,
118
- sneakPeakType: setting?.sneakPeakType,
119
- numberOfFullWidthShow: getNumberOfFullWidthShow(currentDevice),
120
- onHandleClick: handleDotClick
121
- }),
122
- core.filterToolbarPreview(children, true)
123
- ]
124
- })
125
- });
126
- });
127
-
128
- exports.default = Carousel;
@@ -1,104 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var core = require('@gem-sdk/core');
6
- var Arrow_liquid = require('../arrow/Arrow.liquid.js');
7
- var helpers = require('../../helpers.js');
8
- var Dots_liquid = require('../dots/Dots.liquid.js');
9
- var common = require('../arrow/common/common.js');
10
- var getData = require('./common/getData.js');
11
- var getClass = require('./common/getClass.js');
12
- var getStyle = require('./common/getStyle.js');
13
- var getAttr = require('./common/getAttr.js');
14
-
15
- const Carousel = (props)=>{
16
- const { children, builderAttrs, builderProps, styles, isHiddenArrowWhenDisabled = true, hiddenDotWhenOnlyOne, rootId, rawChildren, conditionAppendJs } = props;
17
- const setting = common.mappingNavigationCarousel(props.setting);
18
- const renderData = {
19
- ...props,
20
- setting
21
- };
22
- const { arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', roundedArrow, arrowIconSize, arrowCustomColor, arrowBorder, arrowShadow, showWhenHover } = setting ?? {};
23
- const { uniqueComponentId, loopConfig, arrowShowConfig, stateData } = getData.getData(renderData);
24
- const { rootClassRender, wrapperClassRender, wrapperInnerClass, sliderClass } = getClass.getClass(renderData);
25
- const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle, sliderStyle } = getStyle.getStyle(renderData);
26
- const { rootAttrRender, sliderAttr } = getAttr.getAttr(renderData);
27
- const renderJS = ()=>{
28
- return core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-swiper.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-swiper.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
29
- };
30
- const renderArrow = (position)=>{
31
- const isNext = position === 'next';
32
- return Arrow_liquid.default({
33
- uid: builderProps?.uid,
34
- componentId: uniqueComponentId,
35
- custom: setting?.arrowCustom ?? '',
36
- showArrow: arrowShowConfig,
37
- arrowButtonSize: arrowButtonSize || {},
38
- arrowIconSize: arrowIconSize || {},
39
- arrowBackgroundColor: arrowBackgroundColor ?? '',
40
- arrowCustomColor: arrowCustomColor,
41
- gapToEachSize: arrowGapToEachSide,
42
- showWhenHover: showWhenHover,
43
- arrowBorder: arrowBorder || {},
44
- arrowCorner: roundedArrow || {},
45
- arrowShadow: arrowShadow || {},
46
- left: !isNext,
47
- onClick: (e)=>{
48
- e.stopPropagation();
49
- },
50
- vertical: setting?.vertical,
51
- isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
52
- rootId: rootId
53
- });
54
- };
55
- const renderChildren = ()=>{
56
- return core.template`
57
- ${rawChildren?.length ? core.WrapRenderChildren({
58
- uid: builderProps?.uid ?? '',
59
- customProps: rawChildren[0]?.customProps
60
- }, rawChildren.map((child, index)=>{
61
- if (child) {
62
- return core.template`${core.RenderChildren({
63
- ...child,
64
- index,
65
- parentSettings: setting,
66
- parentStyle: styles,
67
- background: setting?.background,
68
- parentUid: builderProps?.uid
69
- })}`;
70
- }
71
- })) : children ?? `<div>${helpers.getStaticLocale('Carousel', 'no_slider')}</div>`}`;
72
- };
73
- return core.template /* liquid */ `
74
- <gp-swiper gp-data='${stateData}' ${rootAttrRender} style="${rootStyleRender}" class="${rootClassRender}">
75
- <div
76
- ${builderAttrs}
77
- class="${wrapperClassRender}"
78
- style="${wrapperStyleRender}"
79
- >
80
- <div ${sliderAttr} class="${wrapperInnerClass}" style="${wrapperInnerStyle}">
81
- ${renderArrow('prev')}
82
- <div class="${sliderClass}" style="${sliderStyle}">
83
- ${renderChildren()}
84
- </div>
85
- ${renderArrow('next')}
86
- </div>
87
- ${Dots_liquid.default({
88
- loop: loopConfig,
89
- showDots: setting?.dot,
90
- dotStyle: setting?.dotStyle,
91
- dotGapToCarousel: setting?.dotGapToCarousel,
92
- dotSize: setting?.dotSize,
93
- vertical: setting?.vertical,
94
- uniqueComponentId: uniqueComponentId,
95
- hiddenWhenOnlyOne: hiddenDotWhenOnlyOne
96
- })}
97
- </div>
98
- </gp-swiper>
99
- ${conditionAppendJs ? `{% if ${conditionAppendJs} %} ${renderJS()} {% endif %}` : renderJS()}
100
-
101
- `;
102
- };
103
-
104
- exports.default = Carousel;
@@ -1,25 +0,0 @@
1
- 'use strict';
2
-
3
- var system = require('@gem-sdk/system');
4
- var getData = require('./getData.js');
5
-
6
- const getAttr = (props)=>{
7
- const { rootAttrs, builderProps, rootId } = props;
8
- const { uniqueComponentId } = getData.getData(props);
9
- const rootAttrRender = system.createAttr({
10
- 'data-id': `${builderProps?.uid}`,
11
- id: `gp-root-carousel-${uniqueComponentId}`,
12
- ...rootAttrs
13
- });
14
- const sliderAttr = system.createAttr({
15
- ...(builderProps?.uid || rootId) && {
16
- id: `gp-swiper-${uniqueComponentId}`
17
- }
18
- });
19
- return {
20
- rootAttrRender,
21
- sliderAttr
22
- };
23
- };
24
-
25
- exports.getAttr = getAttr;