@gem-sdk/components 2.0.0-dev.369 → 2.0.0-dev.371

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 (142) hide show
  1. package/dist/cjs/article/components/ArticleDate.js +0 -1
  2. package/dist/cjs/article/components/ArticleReadMore.liquid.js +1 -1
  3. package/dist/cjs/article/setting/configs/ArticleContent/settings.js +1 -1
  4. package/dist/cjs/article/setting/configs/ArticleContent/uiV2.js +11 -1
  5. package/dist/cjs/article/setting/configs/ArticleExcerpt/settings.js +1 -1
  6. package/dist/cjs/article/setting/configs/ArticleImage/settings.js +5 -4
  7. package/dist/cjs/article/setting/configs/ArticleImage/uiV2.js +48 -4
  8. package/dist/cjs/article/setting/configs/ArticleReadMore/settings.js +96 -64
  9. package/dist/cjs/article/setting/configs/ArticleReadMore/uiV2.js +380 -97
  10. package/dist/cjs/builder.js +2 -2
  11. package/dist/cjs/button/setting/configs/settings.js +0 -14
  12. package/dist/cjs/carousel/arrow/Arrow.js +52 -0
  13. package/dist/cjs/carousel/arrow/Arrow.liquid.js +46 -0
  14. package/dist/cjs/carousel/{components/common/arrow.js → arrow/common/common.js} +13 -11
  15. package/dist/cjs/carousel/arrow/common/getClass.js +50 -0
  16. package/dist/cjs/carousel/arrow/common/getStyle.js +84 -0
  17. package/dist/cjs/carousel/carousel-item/CarouselItem.js +32 -0
  18. package/dist/cjs/carousel/carousel-item/CarouselItem.liquid.js +38 -0
  19. package/dist/cjs/carousel/carousel-item/common/getClass.js +29 -0
  20. package/dist/cjs/carousel/{components/CarouselItem.liquid.js → carousel-item/common/getStyle.js} +30 -47
  21. package/dist/cjs/carousel/carousel-item/hook/useCarouseItem.js +14 -0
  22. package/dist/cjs/carousel/components/const/index.js +5 -0
  23. package/dist/cjs/carousel/dots/Dots.js +51 -0
  24. package/dist/cjs/carousel/dots/Dots.liquid.js +26 -0
  25. package/dist/cjs/carousel/dots/common/common.js +46 -0
  26. package/dist/cjs/carousel/dots/common/getClass.js +40 -0
  27. package/dist/cjs/carousel/dots/common/getStyle.js +33 -0
  28. package/dist/cjs/carousel/dots/hook/useDotsSetting.js +21 -0
  29. package/dist/cjs/carousel/index.js +1 -2
  30. package/dist/cjs/carousel/next.js +2 -2
  31. package/dist/cjs/carousel/root/Carousel.js +129 -0
  32. package/dist/cjs/carousel/root/Carousel.liquid.js +104 -0
  33. package/dist/cjs/carousel/root/common/getAttr.js +25 -0
  34. package/dist/cjs/carousel/root/common/getClass.js +135 -0
  35. package/dist/cjs/carousel/root/common/getData.js +56 -0
  36. package/dist/cjs/carousel/root/common/getStyle.js +64 -0
  37. package/dist/cjs/carousel/{components/Carousel.js → root/hook/useCarousel.js} +153 -321
  38. package/dist/cjs/carousel/setting/Carousel.js +8 -1555
  39. package/dist/cjs/carousel/setting/configs/presets.js +380 -0
  40. package/dist/cjs/carousel/setting/configs/settingV2.js +771 -0
  41. package/dist/cjs/carousel/setting/configs/uiV1.js +434 -0
  42. package/dist/cjs/carousel/setting/configs/uiV2.js +627 -0
  43. package/dist/cjs/common/components/NoDataState.js +5 -5
  44. package/dist/cjs/grid/row/commons/common.js +3 -3
  45. package/dist/cjs/index.js +2 -2
  46. package/dist/cjs/index.liquid.js +2 -2
  47. package/dist/cjs/product/components/ProductImages/ProductGalleryCarousel.js +2 -2
  48. package/dist/cjs/product/components/ProductImages/ProductImagesLightBox.js +2 -2
  49. package/dist/cjs/product/components/ProductImages/liquid/ProductGalleryCarousel.liquid.js +5 -3
  50. package/dist/cjs/product/components/ProductImagesV2/common/getAttr.js +1 -0
  51. package/dist/cjs/product/components/ProductImagesV2/common/productFeaturedImage.js +1 -1
  52. package/dist/cjs/product/components/ProductImagesV2/common/productGallery.js +1 -1
  53. package/dist/cjs/product/components/ProductImagesV2/components/child/ProductFeaturedImageCarousel.js +5 -5
  54. package/dist/cjs/product/components/ProductImagesV2/components/feature-gallery/FeatureImageWithGallery.liquid.js +8 -4
  55. package/dist/cjs/product/components/ProductImagesV2/components/gallery-carousel/GalleryCarousel.js +2 -2
  56. package/dist/cjs/product/components/ProductImagesV2/components/gallery-carousel/GalleryCarousel.liquid.js +6 -3
  57. package/dist/cjs/product/components/ProductImagesV2/components/lightbox/ProductImagesLightBox.js +2 -2
  58. package/dist/cjs/product/components/ProductImagesV2/hooks/useProductFeaturedImageCarousel.js +3 -3
  59. package/dist/cjs/product/components/ProductList/ProductListCarouselLayout.js +2 -2
  60. package/dist/cjs/product/components/ProductList/ProductListCarouselLayout.liquid.js +5 -3
  61. package/dist/cjs/product/components/ProductList/common/index.js +5 -5
  62. package/dist/cjs/product/components/ProductVariants/common/main/getAttr.js +1 -1
  63. package/dist/cjs/text/components/Text.js +3 -3
  64. package/dist/esm/article/components/ArticleDate.js +0 -1
  65. package/dist/esm/article/components/ArticleReadMore.liquid.js +1 -1
  66. package/dist/esm/article/setting/configs/ArticleContent/settings.js +1 -1
  67. package/dist/esm/article/setting/configs/ArticleContent/uiV2.js +11 -1
  68. package/dist/esm/article/setting/configs/ArticleExcerpt/settings.js +1 -1
  69. package/dist/esm/article/setting/configs/ArticleImage/settings.js +5 -4
  70. package/dist/esm/article/setting/configs/ArticleImage/uiV2.js +48 -4
  71. package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +96 -64
  72. package/dist/esm/article/setting/configs/ArticleReadMore/uiV2.js +380 -97
  73. package/dist/esm/builder.js +2 -2
  74. package/dist/esm/button/setting/configs/settings.js +0 -14
  75. package/dist/esm/carousel/arrow/Arrow.js +48 -0
  76. package/dist/esm/carousel/arrow/Arrow.liquid.js +42 -0
  77. package/dist/esm/carousel/{components/common/arrow.js → arrow/common/common.js} +12 -10
  78. package/dist/esm/carousel/arrow/common/getClass.js +48 -0
  79. package/dist/esm/carousel/arrow/common/getStyle.js +82 -0
  80. package/dist/esm/carousel/carousel-item/CarouselItem.js +28 -0
  81. package/dist/esm/carousel/carousel-item/CarouselItem.liquid.js +34 -0
  82. package/dist/esm/carousel/carousel-item/common/getClass.js +27 -0
  83. package/dist/esm/carousel/{components/CarouselItem.liquid.js → carousel-item/common/getStyle.js} +31 -46
  84. package/dist/esm/carousel/carousel-item/hook/useCarouseItem.js +12 -0
  85. package/dist/esm/carousel/components/const/index.js +3 -0
  86. package/dist/esm/carousel/dots/Dots.js +47 -0
  87. package/dist/esm/carousel/dots/Dots.liquid.js +22 -0
  88. package/dist/esm/carousel/dots/common/common.js +43 -0
  89. package/dist/esm/carousel/dots/common/getClass.js +38 -0
  90. package/dist/esm/carousel/dots/common/getStyle.js +31 -0
  91. package/dist/esm/carousel/dots/hook/useDotsSetting.js +19 -0
  92. package/dist/esm/carousel/index.js +1 -2
  93. package/dist/esm/carousel/next.js +2 -2
  94. package/dist/esm/carousel/root/Carousel.js +125 -0
  95. package/dist/esm/carousel/root/Carousel.liquid.js +100 -0
  96. package/dist/esm/carousel/root/common/getAttr.js +23 -0
  97. package/dist/esm/carousel/root/common/getClass.js +133 -0
  98. package/dist/esm/carousel/root/common/getData.js +54 -0
  99. package/dist/esm/carousel/root/common/getStyle.js +62 -0
  100. package/dist/esm/carousel/{components/Carousel.js → root/hook/useCarousel.js} +150 -316
  101. package/dist/esm/carousel/setting/Carousel.js +8 -1555
  102. package/dist/esm/carousel/setting/configs/presets.js +378 -0
  103. package/dist/esm/carousel/setting/configs/settingV2.js +769 -0
  104. package/dist/esm/carousel/setting/configs/uiV1.js +432 -0
  105. package/dist/esm/carousel/setting/configs/uiV2.js +625 -0
  106. package/dist/esm/common/components/NoDataState.js +6 -6
  107. package/dist/esm/grid/row/commons/common.js +1 -1
  108. package/dist/esm/index.js +2 -2
  109. package/dist/esm/index.liquid.js +2 -2
  110. package/dist/esm/product/components/ProductImages/ProductGalleryCarousel.js +2 -2
  111. package/dist/esm/product/components/ProductImages/ProductImagesLightBox.js +2 -2
  112. package/dist/esm/product/components/ProductImages/liquid/ProductGalleryCarousel.liquid.js +5 -3
  113. package/dist/esm/product/components/ProductImagesV2/common/getAttr.js +1 -0
  114. package/dist/esm/product/components/ProductImagesV2/common/productFeaturedImage.js +1 -1
  115. package/dist/esm/product/components/ProductImagesV2/common/productGallery.js +1 -1
  116. package/dist/esm/product/components/ProductImagesV2/components/child/ProductFeaturedImageCarousel.js +5 -5
  117. package/dist/esm/product/components/ProductImagesV2/components/feature-gallery/FeatureImageWithGallery.liquid.js +8 -4
  118. package/dist/esm/product/components/ProductImagesV2/components/gallery-carousel/GalleryCarousel.js +2 -2
  119. package/dist/esm/product/components/ProductImagesV2/components/gallery-carousel/GalleryCarousel.liquid.js +6 -3
  120. package/dist/esm/product/components/ProductImagesV2/components/lightbox/ProductImagesLightBox.js +2 -2
  121. package/dist/esm/product/components/ProductImagesV2/hooks/useProductFeaturedImageCarousel.js +3 -3
  122. package/dist/esm/product/components/ProductList/ProductListCarouselLayout.js +2 -2
  123. package/dist/esm/product/components/ProductList/ProductListCarouselLayout.liquid.js +5 -3
  124. package/dist/esm/product/components/ProductList/common/index.js +3 -3
  125. package/dist/esm/product/components/ProductVariants/common/main/getAttr.js +1 -1
  126. package/dist/esm/text/components/Text.js +4 -4
  127. package/dist/types/index.d.ts +165 -68
  128. package/package.json +3 -3
  129. package/dist/cjs/carousel/components/Arrow.js +0 -110
  130. package/dist/cjs/carousel/components/Arrow.liquid.js +0 -103
  131. package/dist/cjs/carousel/components/Carousel.liquid.js +0 -256
  132. package/dist/cjs/carousel/components/CarouselItem.js +0 -88
  133. package/dist/cjs/carousel/components/Dots.js +0 -69
  134. package/dist/cjs/carousel/components/Dots.liquid.js +0 -23
  135. package/dist/cjs/carousel/components/common/dots.js +0 -57
  136. package/dist/esm/carousel/components/Arrow.js +0 -106
  137. package/dist/esm/carousel/components/Arrow.liquid.js +0 -99
  138. package/dist/esm/carousel/components/Carousel.liquid.js +0 -252
  139. package/dist/esm/carousel/components/CarouselItem.js +0 -84
  140. package/dist/esm/carousel/components/Dots.js +0 -65
  141. package/dist/esm/carousel/components/Dots.liquid.js +0 -19
  142. package/dist/esm/carousel/components/common/dots.js +0 -53
@@ -15,7 +15,7 @@ const getResponsiveSetting = (setting)=>{
15
15
  mobile
16
16
  };
17
17
  };
18
- const getClassArrowPosition = ({ vertical, arrowType, gapToEachSize, left })=>{
18
+ const getArrowPositionStyle = ({ vertical, arrowType, gapToEachSize, left })=>{
19
19
  const result = {};
20
20
  devices.forEach((item)=>{
21
21
  const verticalResponsive = getResponsiveValueByScreen(vertical, item, false);
@@ -46,13 +46,9 @@ const getClassArrowRotate = (left, vertical)=>{
46
46
  });
47
47
  return result;
48
48
  };
49
- const getArrowRotate = (left, vertical)=>{
50
- const rotation = left ? vertical ? '[-90deg]' : '180' : vertical ? '90' : '0';
51
- return `gp-rotate-${rotation}`;
52
- };
53
49
  const getClassArrowDisplay = (arrowType, vertical)=>{
54
50
  const result = {};
55
- devices.map((device)=>{
51
+ devices.forEach((device)=>{
56
52
  const verticalResponsive = getResponsiveValueByScreen(vertical, device, false);
57
53
  const deviceRes = device === 'desktop' ? '' : `${device}:`;
58
54
  result[`${deviceRes}!gp-flex ${deviceRes}!gp-absolute ${deviceRes}gp-z-2`] = arrowType[device] === 'inside' || !!verticalResponsive;
@@ -63,7 +59,7 @@ const getClassArrowDisplay = (arrowType, vertical)=>{
63
59
  };
64
60
  const getArrowDisplayStyle = (arrowType)=>{
65
61
  let result = {};
66
- devices.map((device)=>{
62
+ devices.forEach((device)=>{
67
63
  const arrowTypeResponsive = getResponsiveValueByScreen(arrowType, device, 'none');
68
64
  result = {
69
65
  ...result,
@@ -90,7 +86,7 @@ const mappingNavigationCarousel = (setting)=>{
90
86
  ...value
91
87
  };
92
88
  const deviceNotExits = devices.filter((x)=>!Object.keys(newValue).includes(x));
93
- deviceNotExits.map((el)=>{
89
+ deviceNotExits.forEach((el)=>{
94
90
  if (el === 'tablet') {
95
91
  newValue[el] = newValue['desktop'];
96
92
  }
@@ -105,7 +101,7 @@ const mappingNavigationCarousel = (setting)=>{
105
101
  const newArrow = generateValueByDevices(arrow);
106
102
  const newControlOverContent = generateValueByDevices(controlOverContent);
107
103
  const navigationStyle = {};
108
- devices.map((el)=>{
104
+ devices.forEach((el)=>{
109
105
  if (!newArrow[el]) navigationStyle[el] = 'none';
110
106
  else if (newArrow[el] && newControlOverContent[el]) navigationStyle[el] = 'inside';
111
107
  else navigationStyle[el] = 'outside';
@@ -117,5 +113,11 @@ const mappingNavigationCarousel = (setting)=>{
117
113
  }
118
114
  return setting;
119
115
  };
116
+ const getData = (props)=>{
117
+ const isRenderCustomIcon = !!props.custom && props.custom !== '';
118
+ return {
119
+ isRenderCustomIcon
120
+ };
121
+ };
120
122
 
121
- export { getArrowDisplayStyle, getArrowRotate, getClassArrowDisplay, getClassArrowPosition, getClassArrowRotate, getResponsiveSetting, getUpdatedArrowDisplay, mappingNavigationCarousel };
123
+ export { getArrowDisplayStyle, getArrowPositionStyle, getClassArrowDisplay, getClassArrowRotate, getData, getResponsiveSetting, getUpdatedArrowDisplay, 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,28 @@
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 } = useCarouselItem(props);
12
+ const { carouselItemStyle, carouselItemInnerStyle } = getStyle(props);
13
+ const { carouselItemClass, carouselItemInnerClass } = getClass(props);
14
+ return /*#__PURE__*/ jsx("div", {
15
+ ...builderAttrs,
16
+ className: carouselItemClass,
17
+ style: carouselItemStyle,
18
+ onClick: handleClick,
19
+ "aria-hidden": true,
20
+ children: /*#__PURE__*/ jsx("div", {
21
+ className: carouselItemInnerClass,
22
+ style: carouselItemInnerStyle,
23
+ children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
24
+ })
25
+ });
26
+ };
27
+
28
+ 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 };
@@ -1,7 +1,9 @@
1
- import { makeGlobalSize, getStyleShadow, template, getStyleBackgroundByDevice, makeStyleResponsive, cls, makeStyle, getSingleColorVariable, getRadiusStyleActiveState } from '@gem-sdk/core';
2
- import { getInitialWidthForCarouselItem, getCarouselSneakPeakTranslate } from './common/carousel.js';
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';
3
4
 
4
- const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, builderProps, style, className, parentId, parentStyle, parentSettings, background, index, customStyle, parentUid, contentType = 'normalItem', ...passProps })=>{
5
+ const getStyle = (props)=>{
6
+ const { style, contentType, parentStyle, parentSettings, background, customStyle, index } = props;
5
7
  const itemPadding = makeGlobalSize(parentStyle?.itemPadding);
6
8
  const styleByContentType = ()=>{
7
9
  const delList = [
@@ -27,32 +29,9 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
27
29
  })
28
30
  };
29
31
  };
30
- const itemShadowStyle = getStyleShadow({
31
- value: parentStyle?.carouselShadow,
32
- styleAppliedFor: 'box-shadow',
33
- isEnableShadow: parentStyle?.hasActiveShadow
34
- });
35
- return template`
36
- <div
37
- media-type="{{media.media_type}}"
38
- media-poster="{{media.preview_image.src}}"
39
- media-source-url="{{media.sources.first.url}}"
40
- media-last-source-url="{{mediaSourceUrl}}"
41
- external-id="{{media.external_id}}"
42
- grid-index="{{forloop.index}}"
43
- ${{
44
- ...builderAttrs
45
- }}
46
- ${{
47
- ...passProps
48
- }}
49
- style="${{
32
+ const getCarouselItemStyle = {
50
33
  ...customStyle,
51
- ...getStyleBackgroundByDevice(background, {
52
- ignoreBackgroundImage: true,
53
- ignoreBackgroundImageProperties: true,
54
- ignoreBgAttachment: true
55
- }),
34
+ ...itemPadding && itemPadding.padding,
56
35
  ...getInitialWidthForCarouselItem({
57
36
  spacing: parentStyle?.spacing,
58
37
  slidesToShow: parentSettings?.itemNumber ?? parentSettings?.slidesToShow,
@@ -62,7 +41,12 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
62
41
  sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward,
63
42
  vertical: parentSettings?.vertical
64
43
  }),
65
- ...styleByContentType(),
44
+ ...getStyleBackgroundByDevice(background),
45
+ ...getGradientBgrStyleByDevice(background, {
46
+ desktop: true,
47
+ tablet: true,
48
+ mobile: true
49
+ }),
66
50
  ...makeStyleResponsive('ml', getCarouselSneakPeakTranslate({
67
51
  index,
68
52
  spacing: parentStyle?.spacing,
@@ -71,22 +55,23 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
71
55
  sneakPeakType: parentSettings?.sneakPeakType,
72
56
  sneakPeakOffsetCenter: parentSettings?.sneakPeakOffsetCenter,
73
57
  sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward
74
- })),
75
- ...itemPadding && itemPadding.padding
76
- }}"
77
- class="${cls(`gem-slider-item gp-w-full gem-slider-item-${parentId || ''} gp-child-item-${parentUid}`, builderProps?.uid, className)}"
78
- data-index="${index}"
79
- >
80
- <div
81
- class="gp-w-full"
82
- style="${{
83
- ...itemShadowStyle
84
- }}"
85
- >
86
- ${children}
87
- </div>
88
- </div>
89
- `;
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
+ };
90
75
  };
91
76
 
92
- export { CarouselItem as default };
77
+ export { getStyle };
@@ -0,0 +1,12 @@
1
+ const useCarouselItem = (props)=>{
2
+ const { onClickItem, dispatchEventSelectSlide, index = 0 } = props;
3
+ const handleClick = (e)=>{
4
+ onClickItem && onClickItem(e);
5
+ dispatchEventSelectSlide && dispatchEventSelectSlide(index);
6
+ };
7
+ return {
8
+ handleClick
9
+ };
10
+ };
11
+
12
+ export { useCarouselItem };
@@ -0,0 +1,3 @@
1
+ const DOT_CONTAINER_SELECTOR = 'gp-carousel-dot-container';
2
+
3
+ export { DOT_CONTAINER_SELECTOR };
@@ -0,0 +1,47 @@
1
+ 'use client';
2
+ import { jsx, Fragment } from 'react/jsx-runtime';
3
+ import { makeStyleResponsiveByScreen, getGlobalColorResponsiveStyle, cls } from '@gem-sdk/core';
4
+ import { getData } from './common/common.js';
5
+ import { getDotClass } from './common/getClass.js';
6
+ import { getDotStyle } from './common/getStyle.js';
7
+ import { useDotsSetting } from './hook/useDotsSetting.js';
8
+ import { If } from '@gem-sdk/system';
9
+
10
+ const Dots = (props)=>{
11
+ const { onHandleClick, dotSize, dotActiveColor, dotColor } = props;
12
+ const { isLoop, checkIsActive } = useDotsSetting(props);
13
+ const { checkHidden, getDotItems } = getData(props);
14
+ const dotItems = getDotItems(isLoop);
15
+ const { dotClass } = getDotClass(props);
16
+ const { dotStyle } = getDotStyle(props, 'react');
17
+ const renderDotItems = ()=>{
18
+ return /*#__PURE__*/ jsx(Fragment, {
19
+ children: dotItems?.map((idx)=>{
20
+ const isActive = checkIsActive(idx);
21
+ return /*#__PURE__*/ jsx("button", {
22
+ "aria-label": "Dot",
23
+ onClick: ()=>{
24
+ onHandleClick && onHandleClick(idx, isLoop);
25
+ },
26
+ style: {
27
+ ...makeStyleResponsiveByScreen('w', dotSize, 'px'),
28
+ ...isActive ? getGlobalColorResponsiveStyle('bg', dotActiveColor) : getGlobalColorResponsiveStyle('bg', dotColor)
29
+ },
30
+ className: cls('gp-aspect-square gp-w-3 gp-rounded-full gp-shadow-md', {
31
+ 'gem-slider-dot-active': isActive,
32
+ 'gem-slider-dot-inactive': !isActive
33
+ })
34
+ }, idx);
35
+ })
36
+ });
37
+ };
38
+ return /*#__PURE__*/ jsx(Fragment, {
39
+ children: If(!checkHidden(dotItems), /*#__PURE__*/ jsx("div", {
40
+ className: dotClass,
41
+ style: dotStyle,
42
+ children: renderDotItems()
43
+ }))
44
+ });
45
+ };
46
+
47
+ export { Dots as default };
@@ -0,0 +1,22 @@
1
+ import { getResponsiveValueByScreen, template } from '@gem-sdk/core';
2
+ import { getDotClass } from './common/getClass.js';
3
+ import { getDotStyle } from './common/getStyle.js';
4
+ import { If } from '@gem-sdk/system';
5
+ import { getData } from './common/common.js';
6
+
7
+ const Dots = (props)=>{
8
+ const isLoop = getResponsiveValueByScreen(props.loop, 'desktop', false);
9
+ const { checkHidden, getDotItems } = getData(props);
10
+ const dotItems = getDotItems(isLoop);
11
+ const { dotClass } = getDotClass(props);
12
+ const { dotStyle } = getDotStyle(props);
13
+ return template`
14
+ ${If(!checkHidden(dotItems), template`
15
+ <div class="${dotClass}" style="${dotStyle}">
16
+ <!-- item render by js -->
17
+ </div>
18
+ `)}
19
+ `;
20
+ };
21
+
22
+ export { Dots as default };
@@ -0,0 +1,43 @@
1
+ import { getResponsiveValueByScreen } from '@gem-sdk/core';
2
+
3
+ const getData = (props)=>{
4
+ const { hiddenWhenOnlyOne } = props;
5
+ const getDotItems = (isLoop)=>{
6
+ const { enabledSneakPeak, totalSlideItem = 0, numberOfFullWidthShow = 0, slideItemsPerPage = 0 } = props;
7
+ if (enabledSneakPeak) {
8
+ return Array.from({
9
+ length: isLoop ? totalSlideItem : totalSlideItem - numberOfFullWidthShow + 1
10
+ }, (_, i)=>i);
11
+ } else {
12
+ return Array.from({
13
+ length: isLoop ? totalSlideItem : Math.ceil(totalSlideItem / slideItemsPerPage)
14
+ }, (_, i)=>i);
15
+ }
16
+ };
17
+ const checkHidden = (totalDots)=>{
18
+ return hiddenWhenOnlyOne && totalDots?.length < 2;
19
+ };
20
+ return {
21
+ checkHidden,
22
+ getDotItems
23
+ };
24
+ };
25
+ const getUpdatedDotStyle = (dot, dotStyle)=>{
26
+ const devices = [
27
+ 'desktop',
28
+ 'tablet',
29
+ 'mobile'
30
+ ];
31
+ let result = {};
32
+ devices.forEach((device)=>{
33
+ const dotSetting = getResponsiveValueByScreen(dot, device);
34
+ const dotStyleSetting = getResponsiveValueByScreen(dotStyle, device);
35
+ result = {
36
+ ...result,
37
+ [device]: dotSetting ? dotStyleSetting : 'none'
38
+ };
39
+ });
40
+ return result;
41
+ };
42
+
43
+ export { getData, getUpdatedDotStyle };
@@ -0,0 +1,38 @@
1
+ import { getResponsiveValueByScreen } from '@gem-sdk/core';
2
+ import { createClass } from '@gem-sdk/system';
3
+ import { DOT_CONTAINER_SELECTOR } from '../../components/const/index.js';
4
+
5
+ const getDotClass = (props)=>{
6
+ const { dotStyle, vertical, className, uniqueComponentId } = props;
7
+ const getDisplayClass = ()=>{
8
+ const devices = [
9
+ 'desktop',
10
+ 'tablet',
11
+ 'mobile'
12
+ ];
13
+ const result = {};
14
+ devices.forEach((device)=>{
15
+ const dotStyleSetting = getResponsiveValueByScreen(dotStyle, device);
16
+ const verticalSetting = getResponsiveValueByScreen(vertical, device);
17
+ const deviceType = device === 'desktop' ? '' : `${device}:`;
18
+ result[`${deviceType}gp-absolute`] = dotStyleSetting === 'inside';
19
+ result[`${deviceType}gp-static`] = dotStyleSetting !== 'inside';
20
+ result[`${deviceType}gp-flex-row ${deviceType}gp-left-0 ${deviceType}gp-right-0`] = !verticalSetting;
21
+ result[`${deviceType}gp-flex-col ${deviceType}gp-ml-2 ${deviceType}gp-w-fit ${deviceType}gp-h-full`] = !!verticalSetting;
22
+ });
23
+ return result;
24
+ };
25
+ const dotClass = createClass({
26
+ [`${DOT_CONTAINER_SELECTOR} ${DOT_CONTAINER_SELECTOR}-${uniqueComponentId}`]: true,
27
+ ['gp-z-2 gp-flex gp-flex-1 gp-items-center gp-justify-center gp-gap-2 gp-text-center']: true,
28
+ ...className && {
29
+ [className]: true
30
+ },
31
+ ...getDisplayClass()
32
+ });
33
+ return {
34
+ dotClass
35
+ };
36
+ };
37
+
38
+ export { getDotClass };
@@ -0,0 +1,31 @@
1
+ import { createStyleReact, createStyle } from '@gem-sdk/system';
2
+ import { makeDotGapToCarouselStyle, getResponsiveValueByScreen } from '@gem-sdk/core';
3
+
4
+ const getDotStyle = (props, componentType)=>{
5
+ const { dotStyle: style, dotGapToCarousel, vertical } = props;
6
+ const isReactComp = componentType === 'react';
7
+ const getStyleDisplayDots = ()=>{
8
+ const devices = [
9
+ 'desktop',
10
+ 'tablet',
11
+ 'mobile'
12
+ ];
13
+ const result = {};
14
+ devices.forEach((device)=>{
15
+ const dotStyleSetting = getResponsiveValueByScreen(style, device);
16
+ const deviceType = device === 'desktop' ? '' : `${device}`;
17
+ result[`d${deviceType.length === 0 ? '' : '-' + deviceType}`] = dotStyleSetting && dotStyleSetting !== 'none' ? 'flex' : 'none';
18
+ });
19
+ return result;
20
+ };
21
+ const dotStyleObj = {
22
+ ...makeDotGapToCarouselStyle(style, dotGapToCarousel, vertical),
23
+ ...getStyleDisplayDots()
24
+ };
25
+ const dotStyle = isReactComp ? createStyleReact(dotStyleObj) : createStyle(dotStyleObj);
26
+ return {
27
+ dotStyle
28
+ };
29
+ };
30
+
31
+ export { getDotStyle };
@@ -0,0 +1,19 @@
1
+ import { useCurrentDevice, getResponsiveValueByScreen } from '@gem-sdk/core';
2
+
3
+ const useDotsSetting = (props)=>{
4
+ const { loop, enabledSneakPeak, slideItemsPerPage = 1, currentSlide = 1 } = props;
5
+ const currentDevice = useCurrentDevice();
6
+ const isLoop = getResponsiveValueByScreen(loop, currentDevice, false);
7
+ const checkIsActive = (idx)=>{
8
+ if (enabledSneakPeak) {
9
+ return idx === currentSlide;
10
+ }
11
+ return idx === (isLoop ? currentSlide : Math.ceil(currentSlide / slideItemsPerPage));
12
+ };
13
+ return {
14
+ isLoop,
15
+ checkIsActive
16
+ };
17
+ };
18
+
19
+ export { useDotsSetting };
@@ -1,10 +1,9 @@
1
1
  import 'react/jsx-runtime';
2
2
  import '@gem-sdk/core';
3
3
  import 'react';
4
- import '@gem-sdk/keen-slider/react';
5
4
  import '@gem-sdk/system';
5
+ import '@gem-sdk/keen-slider/react';
6
6
  import 'next/link';
7
- import '../product/components/ProductVariants/components/variants/index.js';
8
7
  import config from './setting/Carousel.js';
9
8
  import config$1 from './setting/CarouselItem.js';
10
9
 
@@ -4,10 +4,10 @@ import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import '@gem-sdk/core';
6
6
 
7
- const Carousel = dynamic(()=>import('./components/Carousel.js'), {
7
+ const Carousel = dynamic(()=>import('./root/Carousel.js'), {
8
8
  loading: Loading
9
9
  });
10
- const CarouselItem = dynamic(()=>import('./components/CarouselItem.js'), {
10
+ const CarouselItem = dynamic(()=>import('./carousel-item/CarouselItem.js'), {
11
11
  loading: Loading
12
12
  });
13
13
  var carousel = {