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

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 +4 -4
  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,48 +0,0 @@
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 };
@@ -1,82 +0,0 @@
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 };
@@ -1,30 +0,0 @@
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 };
@@ -1,34 +0,0 @@
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 };
@@ -1,27 +0,0 @@
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 };
@@ -1,77 +0,0 @@
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 };
@@ -1,20 +0,0 @@
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 };
@@ -1,93 +0,0 @@
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 };
@@ -1,3 +0,0 @@
1
- const DOT_CONTAINER_SELECTOR = 'gp-carousel-dot-container';
2
-
3
- export { DOT_CONTAINER_SELECTOR };
@@ -1,30 +0,0 @@
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 };
@@ -1,35 +0,0 @@
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 };
@@ -1,103 +0,0 @@
1
- const AutoPlayPlugin = (slider)=>{
2
- let autoplay = slider.options.autoplay ?? {};
3
- let timeout;
4
- let mouseOver = false;
5
- let inViewport = false;
6
- let observer = null;
7
- // Thêm sự kiện cho dot nếu có
8
- const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
9
- // Callback của IntersectionObserver
10
- function handleIntersection(entries) {
11
- entries.forEach((entry)=>{
12
- // Với threshold 0, chỉ cần một phần bất kỳ hiển thị sẽ đánh dấu isIntersecting
13
- inViewport = entry.isIntersecting;
14
- if (inViewport) {
15
- nextTimeout();
16
- } else {
17
- clearNextTimeout();
18
- }
19
- });
20
- }
21
- function initIntersectionObserver() {
22
- // Nếu đã có observer hoặc không có container thì không khởi tạo lại
23
- if (observer || !slider.container) return;
24
- observer = new IntersectionObserver(handleIntersection, {
25
- root: null,
26
- threshold: 0
27
- });
28
- observer.observe(slider.container);
29
- }
30
- function clearNextTimeout() {
31
- clearTimeout(timeout);
32
- }
33
- function nextTimeout() {
34
- clearNextTimeout();
35
- timeout = setTimeout(()=>{
36
- // Nếu đang hover, autoplay bị tắt hoặc slider không trong viewport thì không chuyển slide
37
- if (mouseOver || !autoplay.enable || !inViewport) return;
38
- slider.next();
39
- }, autoplay.delay ?? 2000);
40
- }
41
- function onMouseOver() {
42
- mouseOver = true;
43
- clearNextTimeout();
44
- }
45
- function onMouseOut() {
46
- mouseOver = false;
47
- nextTimeout();
48
- }
49
- slider.on('created', ()=>{
50
- $dots?.addEventListener('mouseover', onMouseOver);
51
- $dots?.addEventListener('mouseout', onMouseOut);
52
- // Nếu tùy chọn pauseOnHover bật thì thêm sự kiện hover cho container slider
53
- if (autoplay.pauseOnHover && slider.container) {
54
- slider.container.addEventListener('mouseover', onMouseOver);
55
- slider.container.addEventListener('mouseout', onMouseOut);
56
- }
57
- if (autoplay.enable) {
58
- initIntersectionObserver();
59
- nextTimeout();
60
- }
61
- });
62
- slider.on('dragStarted', clearNextTimeout);
63
- slider.on('animationEnded', nextTimeout);
64
- slider.on('updated', (newOptions)=>{
65
- autoplay = newOptions.options?.autoplay ?? {};
66
- if (autoplay.enable) {
67
- initIntersectionObserver();
68
- nextTimeout();
69
- }
70
- });
71
- slider.on('optionsChanged', (newOptions)=>{
72
- if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover && slider.container) {
73
- if (newOptions.options.autoplay?.pauseOnHover) {
74
- slider.container.addEventListener('mouseover', onMouseOver);
75
- slider.container.addEventListener('mouseout', onMouseOut);
76
- } else {
77
- slider.container.removeEventListener('mouseover', onMouseOver);
78
- slider.container.removeEventListener('mouseout', onMouseOut);
79
- mouseOver = false;
80
- }
81
- }
82
- autoplay = newOptions.options.autoplay ?? {};
83
- if (autoplay.enable) {
84
- initIntersectionObserver();
85
- nextTimeout();
86
- }
87
- });
88
- slider.on('destroyed', ()=>{
89
- if (slider.container) {
90
- slider.container.removeEventListener('mouseover', onMouseOver);
91
- slider.container.removeEventListener('mouseout', onMouseOut);
92
- }
93
- $dots?.removeEventListener('mouseover', onMouseOver);
94
- $dots?.removeEventListener('mouseout', onMouseOut);
95
- clearNextTimeout();
96
- if (observer) {
97
- observer.disconnect();
98
- observer = null;
99
- }
100
- });
101
- };
102
-
103
- export { AutoPlayPlugin };
@@ -1,13 +0,0 @@
1
- //Solution from https://github.com/rcbyr/keen-slider/issues/255
2
- const FixSliderMoveBackwards = (slider)=>{
3
- slider.on('animationEnded', (slider)=>{
4
- const { rel, progress } = slider.track.details;
5
- if (rel === 0 && progress !== 0) {
6
- slider.moveToIdx(0, true, {
7
- duration: 0
8
- });
9
- }
10
- });
11
- };
12
-
13
- export { FixSliderMoveBackwards };
@@ -1,43 +0,0 @@
1
- const MutationPlugin = (slider)=>{
2
- const observer = new MutationObserver((mutations)=>{
3
- mutations.forEach(()=>{
4
- slider.update();
5
- });
6
- });
7
- const config = {
8
- childList: true
9
- };
10
- const resizeObserver = new ResizeObserver(function() {
11
- resetStyleOfSlides(slider);
12
- slider.update();
13
- });
14
- const resetStyleOfSlides = (slider)=>{
15
- if (slider.options.vertical) {
16
- removeMinMaxWidthOfSlides(slider);
17
- return;
18
- }
19
- removeMinMaxHeightOfSlides(slider);
20
- };
21
- const removeMinMaxWidthOfSlides = (slider)=>{
22
- slider.slides.forEach((slide)=>{
23
- slide.style.maxWidth = '';
24
- slide.style.minWidth = '';
25
- });
26
- };
27
- const removeMinMaxHeightOfSlides = (slider)=>{
28
- slider.slides.forEach((slide)=>{
29
- slide.style.maxHeight = '';
30
- slide.style.minHeight = '';
31
- });
32
- };
33
- slider.on('created', ()=>{
34
- resizeObserver.observe(slider.container);
35
- observer.observe(slider.container, config);
36
- });
37
- slider.on('destroyed', ()=>{
38
- resizeObserver.unobserve(slider.container);
39
- observer.disconnect();
40
- });
41
- };
42
-
43
- export { MutationPlugin };