@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
@@ -1,99 +0,0 @@
1
- import { makeGlobalSizeWidthResponsive, makeGlobalSizeHeightResponsive, makeStyleResponsive, getPaddingGlobalSize, template, cls, makeStyle, composeCornerCss, composeBorderCss } from '@gem-sdk/core';
2
- import { getClassArrowRotate, getClassArrowDisplay, getClassArrowPosition, getArrowDisplayStyle, getResponsiveSetting } from './common/arrow.js';
3
-
4
- const Arrow = ({ showArrow, left, vertical, disabled, controlOverContent, custom, onClick, className, isHiddenWhenDisabled, arrowCustomColor, arrowButtonSize, arrowIconSize, arrowBackgroundColor, gapToEachSize, showWhenHover, arrowBorder, arrowCorner, componentId, uid, rootId, ...passProps })=>{
5
- const arrowType = getResponsiveSetting(showArrow || {});
6
- const arrowBorderStyle = getResponsiveSetting(arrowBorder || {});
7
- const arrowCornerStyle = getResponsiveSetting(arrowCorner || {});
8
- const iconSizeResponsive = getResponsiveSetting(arrowIconSize || {});
9
- const buttonWidth = makeGlobalSizeWidthResponsive(arrowButtonSize);
10
- const buttonHeight = makeGlobalSizeHeightResponsive(arrowButtonSize);
11
- const iconWidth = makeStyleResponsive('w', iconSizeResponsive, 'px');
12
- const iconHeight = makeStyleResponsive('h', iconSizeResponsive, 'px');
13
- const buttonPadding = getPaddingGlobalSize(arrowButtonSize);
14
- const buttonContent = template`<div
15
- class="${cls('gp-flex gp-items-center gp-justify-center [&>svg]:gp-h-full [&>svg]:gp-w-full', {
16
- ...getClassArrowRotate(Boolean(left), vertical)
17
- })}"
18
- style="${{
19
- ...makeStyle({
20
- c: arrowCustomColor
21
- }),
22
- ...iconWidth,
23
- ...iconHeight
24
- }}"
25
- >
26
- ${!!custom && custom !== '' ? custom ?? '' : `<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">
27
- <path d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z" />
28
- </svg>`}
29
- </div>`;
30
- const classAction = left ? 'gp-carousel-action-back gem-slider-previous' : 'gp-carousel-action-next gem-slider-next';
31
- const innerBorderCss = `
32
- ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid} {
33
- ${composeCornerCss(arrowCornerStyle.desktop)}
34
- }
35
- ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid}::before {
36
- content: '';
37
- height: 100%;
38
- width: 100%;
39
- position: absolute;
40
- pointer-events: none;
41
- z-index: 10;
42
- ${composeBorderCss(arrowBorderStyle.desktop)}
43
- ${composeCornerCss(arrowCornerStyle.desktop)}
44
- }
45
- @media only screen and (max-width: 1024px) and (min-width: 768px) {
46
- ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid} {
47
- ${composeCornerCss(arrowCornerStyle.tablet)}
48
- }
49
- ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid}::before {
50
- ${composeBorderCss(arrowBorderStyle.tablet)}
51
- ${composeCornerCss(arrowCornerStyle.tablet)}
52
- }
53
- }
54
- @media only screen and (max-width: 768px) {
55
- ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid} {
56
- ${composeCornerCss(arrowCornerStyle.mobile)}
57
- }
58
- ${rootId ? '.' + rootId : ''}.gp-carousel-arrow-${uid}::before {
59
- ${composeBorderCss(arrowBorderStyle.mobile)}
60
- ${composeCornerCss(arrowCornerStyle.mobile)}
61
- }
62
- }
63
- `;
64
- return template`
65
- <button
66
- type="button"
67
- aria-label='Carousel ${left ? 'Back' : 'Next'} Arrow'
68
- class="${cls('gp-z-1', rootId ? rootId : '', classAction, className, componentId, 'gp-carousel-arrow-' + uid + ' gp-items-center gp-justify-center gp-overflow-hidden gp-shrink-0 ', {
69
- hidden: isHiddenWhenDisabled && disabled,
70
- 'gp-cursor-default gp-text-gray-300': disabled,
71
- 'gp-cursor-pointer gp-text-gray-500': !disabled,
72
- '!gp-invisible group-hover/carousel:!gp-visible': showWhenHover,
73
- ...getClassArrowDisplay(arrowType, vertical)
74
- })}"
75
- style="${{
76
- ...makeStyle(getClassArrowPosition({
77
- vertical,
78
- arrowType,
79
- gapToEachSize: gapToEachSize || '',
80
- left: Boolean(left)
81
- })),
82
- ...makeStyleResponsive('d', getArrowDisplayStyle(arrowType)),
83
- 'background-color': arrowBackgroundColor,
84
- ...buttonWidth,
85
- ...buttonHeight,
86
- ...buttonPadding
87
- }}"
88
- onClick={onClick}
89
- ${{
90
- ...passProps
91
- }}
92
- >
93
- ${buttonContent}
94
- <style>${innerBorderCss}</style>
95
- </button>
96
- `;
97
- };
98
-
99
- export { Arrow as default };
@@ -1,252 +0,0 @@
1
- import { makeStyleResponsive, getHeightByShapeGlobalSize, makeStyleWithDefault, getWidthByShapeGlobalSize, template, cls, getResponsiveValueByScreen, makeContainerWidthOrHeight, WrapRenderChildren, RenderChildren, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
- import Arrow from './Arrow.liquid.js';
3
- import Dots from './Dots.liquid.js';
4
- import { mappingNavigationCarousel } from './common/arrow.js';
5
- import { getStaticLocale, getSettingPreloadData } from '../../helpers.js';
6
-
7
- const DEVICES = [
8
- 'mobile',
9
- 'tablet',
10
- 'desktop'
11
- ];
12
- const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs, ...props })=>{
13
- const setting = mappingNavigationCarousel(props.setting);
14
- const styleHeight = makeStyleResponsive('h', getHeightByShapeGlobalSize(styles?.sizeSetting));
15
- const styleWidth = makeStyleWithDefault('w', getWidthByShapeGlobalSize(styles?.sizeSetting, true), {
16
- desktop: '--g-ct-w',
17
- tablet: '--g-ct-w',
18
- mobile: '--g-ct-w'
19
- });
20
- const getDisplayOfWrapper = ()=>{
21
- let result = {};
22
- DEVICES.forEach((device)=>{
23
- result = {
24
- ...result,
25
- [`${device === 'desktop' ? '' : `${device}:`}gp-flex`]: setting?.vertical?.[device],
26
- [`${device === 'desktop' ? '' : `${device}:`}gp-block`]: !setting?.vertical?.[device]
27
- };
28
- });
29
- return result;
30
- };
31
- const { navigationStyle, navigationEnable = {
32
- desktop: true
33
- }, arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', arrowBorder, roundedArrow, arrowIconSize, arrowCustomColor, showWhenHover, enableAction = {
34
- desktop: true
35
- } } = setting ?? {};
36
- const getLoopSetting = ()=>{
37
- let result = setting?.loop;
38
- DEVICES.forEach((device)=>{
39
- result = {
40
- ...result,
41
- [device]: getResponsiveValueByScreen(enableAction) ? result?.[device] : false
42
- };
43
- });
44
- return result;
45
- };
46
- const getHeight = ()=>{
47
- let result = {};
48
- DEVICES.forEach((device)=>{
49
- result = {
50
- ...result,
51
- [`${device === 'desktop' ? '' : `${device}:`}gp-h-full`]: setting?.vertical?.[device],
52
- [`${device === 'desktop' ? '' : `${device}:`}gp-flex-1`]: setting?.vertical?.[device]
53
- };
54
- });
55
- return result;
56
- };
57
- const getArrowType = ()=>{
58
- let result = navigationStyle;
59
- DEVICES.forEach((device)=>{
60
- result = {
61
- ...result,
62
- [device]: getResponsiveValueByScreen(navigationEnable, device) ? result?.[device] : 'none'
63
- };
64
- });
65
- return result;
66
- };
67
- const uniqueComponentId = `${rootId || builderProps?.uid}-{{section.id}}`;
68
- const makeVerticalWrapClass = ()=>{
69
- let result = {};
70
- DEVICES.forEach((device)=>{
71
- if (setting?.vertical?.[device]) {
72
- result = {
73
- ...result,
74
- [`${device === 'desktop' ? '' : `${device}:`}!gp-flex-wrap`]: setting?.vertical?.[device]
75
- };
76
- } else {
77
- result = {
78
- ...result,
79
- [`${device === 'desktop' ? '' : `${device}:`}!gp-flex-nowrap`]: !setting?.vertical?.[device]
80
- };
81
- }
82
- });
83
- return result;
84
- };
85
- const makeVerticalMinHeightClass = ()=>{
86
- let result = {};
87
- DEVICES.forEach((device)=>{
88
- if (setting?.vertical?.[device]) {
89
- result = {
90
- ...result,
91
- [`${device === 'desktop' ? '' : `${device}:`}!gp-min-h-0`]: setting?.vertical?.[device]
92
- };
93
- } else {
94
- result = {
95
- ...result,
96
- [`${device === 'desktop' ? '' : `${device}:`}!gp-min-h-full`]: !setting?.vertical?.[device]
97
- };
98
- }
99
- });
100
- return result;
101
- };
102
- const makeFlexColClass = ()=>{
103
- let result = {};
104
- DEVICES.forEach((device)=>{
105
- result = {
106
- ...result,
107
- [`${device === 'desktop' ? '' : `${device}:`}!gp-flex-col`]: setting?.vertical?.[device],
108
- [`${device === 'desktop' ? '' : `${device}:`}!gp-flex-row`]: !setting?.vertical?.[device]
109
- };
110
- });
111
- return result;
112
- };
113
- const makeSpacing = ()=>{
114
- let result = {};
115
- DEVICES.forEach((device)=>{
116
- const isVertical = getResponsiveValueByScreen(setting?.vertical, device);
117
- const spacing = getResponsiveValueByScreen(styles?.spacing, device);
118
- const key = isVertical ? `--rg${device !== 'desktop' ? `-${device}` : ''}` : `--cg${device !== 'desktop' ? `-${device}` : ''}`;
119
- result = {
120
- ...result,
121
- [key]: `${spacing}px`
122
- };
123
- });
124
- return result;
125
- };
126
- const renderJS = ()=>{
127
- return RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-carousel-v2.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-carousel-v2.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
128
- };
129
- return template /* liquid */ `
130
- <gp-carousel data-id="${builderProps?.uid}" ${rootAttr} id="gp-root-carousel-${uniqueComponentId}" class="${rootClass} ${advanced?.cssClass} gp-group/carousel gp-flex" gp-data='${JSON.stringify({
131
- id: uniqueComponentId,
132
- setting,
133
- styles,
134
- moveToIdx,
135
- isHiddenArrowWhenDisabled
136
- }).replaceAll("'", '&#039;')}' style="${{
137
- ...makeStyleResponsive('jc', styles?.align),
138
- ...rootStyles
139
- }}">
140
- <div class="gp-hidden gp-aspect-square gp-w-[12px] gp-rounded-full gp-shadow-md"></div>
141
- <div
142
- ${{
143
- ...builderAttrs
144
- }}
145
- class="${cls('gp-relative gp-my-0 tablet:gp-px-0 gp-max-w-full mobile:gp-px-0 gp-carousel-wrapper', {
146
- ...getDisplayOfWrapper(),
147
- '!gp-flex': getResponsiveValueByScreen(setting?.vertical, 'desktop'),
148
- 'tablet:!gp-flex': getResponsiveValueByScreen(setting?.vertical, 'tablet'),
149
- 'mobile:!gp-flex': getResponsiveValueByScreen(setting?.vertical, 'mobile')
150
- }, builderProps?.uid, wrapperClass)}"
151
- style="${{
152
- ...style,
153
- ...styleWidth,
154
- ...styleHeight
155
- }}"
156
- >
157
- <div
158
- class="${cls('gp-h-full gp-relative gp-mx-auto gp-flex gp-items-center gp-justify-between', {
159
- ...getHeight(),
160
- ...makeFlexColClass()
161
- })}"
162
- style="${{
163
- ...makeContainerWidthOrHeight({
164
- vertical: setting?.vertical,
165
- dotStyle: setting?.dotStyle
166
- }),
167
- gap: arrowGapToEachSide + 'px'
168
- }}"
169
- >
170
- ${Arrow({
171
- uid: builderProps?.uid,
172
- componentId: uniqueComponentId,
173
- custom: setting?.arrowCustom || '',
174
- showArrow: getArrowType(),
175
- arrowButtonSize: arrowButtonSize || {},
176
- arrowIconSize: arrowIconSize || {},
177
- arrowBackgroundColor: arrowBackgroundColor || '',
178
- arrowCustomColor: arrowCustomColor,
179
- gapToEachSize: arrowGapToEachSide,
180
- showWhenHover: showWhenHover,
181
- arrowBorder: arrowBorder || {},
182
- arrowCorner: roundedArrow || {},
183
- left: true,
184
- onClick: (e)=>{
185
- e.stopPropagation();
186
- },
187
- vertical: setting?.vertical,
188
- isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
189
- rootId: rootId
190
- })}
191
- <div ${(builderProps?.uid || rootId) && `id="gp-carousel-${uniqueComponentId}"`} class="${cls('gem-slider gp-h-full gp-overflow-hidden gp-select-none', {
192
- ...makeVerticalWrapClass(),
193
- ...makeVerticalMinHeightClass()
194
- })}"
195
- style="${{
196
- ...makeSpacing()
197
- }}">
198
- ${rawChildren?.length ? WrapRenderChildren({
199
- uid: builderProps?.uid || '',
200
- customProps: rawChildren[0]?.customProps
201
- }, rawChildren.map((child, index)=>{
202
- if (child) {
203
- return template`${RenderChildren({
204
- ...child,
205
- index,
206
- parentSettings: setting,
207
- parentStyle: styles,
208
- background: setting?.background,
209
- parentUid: builderProps?.uid
210
- })}`;
211
- }
212
- })) : children ?? `<div>${getStaticLocale('Carousel', 'no_slider')}</div>`}
213
- </div>
214
- ${Arrow({
215
- uid: builderProps?.uid,
216
- componentId: uniqueComponentId,
217
- custom: setting?.arrowCustom || '',
218
- showArrow: getArrowType(),
219
- arrowButtonSize: arrowButtonSize || {},
220
- arrowIconSize: arrowIconSize || {},
221
- arrowBackgroundColor: arrowBackgroundColor || '',
222
- arrowCustomColor: arrowCustomColor,
223
- gapToEachSize: arrowGapToEachSide,
224
- showWhenHover: showWhenHover,
225
- arrowBorder: arrowBorder || {},
226
- arrowCorner: roundedArrow || {},
227
- left: false,
228
- onClick: (e)=>{
229
- e.stopPropagation();
230
- },
231
- vertical: setting?.vertical,
232
- isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
233
- rootId: rootId
234
- })}
235
- </div>
236
- ${Dots({
237
- loop: getLoopSetting(),
238
- showDots: setting?.dot,
239
- dotStyle: setting?.dotStyle,
240
- dotGapToCarousel: setting?.dotGapToCarousel,
241
- dotSize: setting?.dotSize,
242
- vertical: setting?.vertical,
243
- className: `gp-carousel-dot-container gp-carousel-dot-container-${uniqueComponentId}`
244
- })}
245
- </div>
246
- </gp-carousel>
247
- ${conditionAppendJs ? `{% if ${conditionAppendJs} %} ${renderJS()} {% endif %}` : renderJS()}
248
-
249
- `;
250
- };
251
-
252
- export { Carousel as default };
@@ -1,84 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { makeGlobalSize, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleShadow, cls, getStyleBackgroundByDevice, isEmptyChildren } from '@gem-sdk/core';
4
- import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
5
- import { useMemo } from 'react';
6
- import { getInitialWidthForCarouselItem } from './common/carousel.js';
7
-
8
- const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, builderProps, parentStyle, parentSettings, background, contentType = 'normalItem', index = 0, onClickItem, dispatchEventSelectSlide, ...passProps })=>{
9
- const itemPadding = makeGlobalSize(parentStyle?.itemPadding);
10
- const styleByContentType = useMemo(()=>{
11
- const delList = [
12
- '--radius'
13
- ];
14
- const filterStyles = {
15
- ...passProps.style
16
- };
17
- delList.forEach((element)=>{
18
- delete filterStyles?.[element];
19
- });
20
- if (contentType === 'productImage') return filterStyles;
21
- return {
22
- ...filterStyles,
23
- ...makeStyle({
24
- bs: parentStyle?.borderContent?.border,
25
- bw: parentStyle?.borderContent?.width,
26
- bc: getSingleColorVariable(parentStyle?.borderContent?.color)
27
- }),
28
- ...getRadiusStyleActiveState({
29
- ...parentStyle?.roundedContent,
30
- active: {
31
- ...parentStyle?.roundedContent || {},
32
- radiusType: 'custom'
33
- }
34
- })
35
- };
36
- }, [
37
- contentType,
38
- parentStyle,
39
- passProps.style
40
- ]);
41
- const itemShadowStyle = getStyleShadow({
42
- value: parentStyle?.carouselShadow,
43
- styleAppliedFor: 'box-shadow',
44
- isEnableShadow: parentStyle?.hasActiveShadow
45
- });
46
- const handleClick = (e)=>{
47
- onClickItem && onClickItem(e);
48
- dispatchEventSelectSlide && dispatchEventSelectSlide(index);
49
- };
50
- return /*#__PURE__*/ jsx("div", {
51
- ...builderAttrs,
52
- ...passProps,
53
- className: cls(builderProps?.uid, passProps.className),
54
- style: {
55
- ...getInitialWidthForCarouselItem({
56
- spacing: parentStyle?.spacing,
57
- slidesToShow: parentSettings?.itemNumber ?? parentSettings?.slidesToShow,
58
- sneakPeak: parentSettings?.sneakPeak,
59
- sneakPeakType: parentSettings?.sneakPeakType,
60
- sneakPeakOffsetCenter: parentSettings?.sneakPeakOffsetCenter,
61
- sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward,
62
- vertical: parentSettings?.vertical
63
- }),
64
- ...styleByContentType,
65
- ...getStyleBackgroundByDevice(background, {
66
- ignoreBackgroundImage: true,
67
- ignoreBackgroundImageProperties: true,
68
- ignoreBgAttachment: true
69
- }),
70
- ...itemPadding && itemPadding.padding
71
- },
72
- onClick: handleClick,
73
- "aria-hidden": true,
74
- children: /*#__PURE__*/ jsx("div", {
75
- className: "gp-h-full gp-w-full",
76
- style: {
77
- ...itemShadowStyle
78
- },
79
- children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
80
- })
81
- });
82
- };
83
-
84
- export { CarouselItem as default };
@@ -1,65 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { useCurrentDevice, getResponsiveValueByScreen, cls, makeStyle, makeDotGapToCarouselStyle, makeStyleResponsiveByScreen, getGlobalColorResponsiveStyle } from '@gem-sdk/core';
4
- import { useMemo } from 'react';
5
- import { getStyleDots, getDotDisplay } from './common/dots.js';
6
-
7
- const Dots = ({ onHandleClick, totalSlideItem, slideItemsPerPage, currentSlide, className, loop, showDots, dotStyle, dotGapToCarousel, dotSize, controlOverContent, vertical, dotActiveColor, dotColor, hiddenWhenOnlyOne, enabledSneakPeak, sneakPeakType, numberOfFullWidthShow, ...passProps })=>{
8
- const currentDevice = useCurrentDevice();
9
- const isLoop = getResponsiveValueByScreen(loop, currentDevice, false);
10
- const dotItems = useMemo(()=>{
11
- if (enabledSneakPeak) {
12
- return Array.from({
13
- length: isLoop ? totalSlideItem : totalSlideItem - (numberOfFullWidthShow || 0) + 1
14
- }, (_, i)=>i);
15
- } else {
16
- return Array.from({
17
- length: isLoop ? totalSlideItem : Math.ceil(totalSlideItem / slideItemsPerPage)
18
- }, (_, i)=>i);
19
- }
20
- }, [
21
- isLoop,
22
- totalSlideItem,
23
- slideItemsPerPage,
24
- enabledSneakPeak,
25
- numberOfFullWidthShow
26
- ]);
27
- const getClass = ()=>{
28
- return {
29
- ...getDotDisplay(dotStyle, vertical)
30
- };
31
- };
32
- const getActive = (idx)=>{
33
- if (enabledSneakPeak) {
34
- return idx === currentSlide;
35
- }
36
- return idx === (isLoop ? currentSlide : Math.ceil(currentSlide / slideItemsPerPage));
37
- };
38
- return /*#__PURE__*/ jsx("div", {
39
- className: cls(`gp-z-2 gp-flex-1 gp-items-center gp-justify-center gp-gap-2 gp-text-center`, className, getClass()),
40
- ...passProps,
41
- style: {
42
- ...makeStyle(getStyleDots(dotStyle)),
43
- ...makeDotGapToCarouselStyle(dotStyle, dotGapToCarousel, vertical)
44
- },
45
- children: (!hiddenWhenOnlyOne || dotItems?.length > 1) && dotItems?.map((idx)=>{
46
- const isActive = getActive(idx);
47
- return /*#__PURE__*/ jsx("button", {
48
- "aria-label": "Dot",
49
- onClick: ()=>{
50
- onHandleClick(idx, isLoop);
51
- },
52
- style: {
53
- ...makeStyleResponsiveByScreen('w', dotSize, 'px'),
54
- ...isActive ? getGlobalColorResponsiveStyle('bg', dotActiveColor) : getGlobalColorResponsiveStyle('bg', dotColor)
55
- },
56
- className: cls('gp-aspect-square gp-w-3 gp-rounded-full gp-shadow-md', {
57
- 'gem-slider-dot-active': isActive,
58
- 'gem-slider-dot-inactive': !isActive
59
- })
60
- }, idx);
61
- })
62
- });
63
- };
64
-
65
- export { Dots as default };
@@ -1,19 +0,0 @@
1
- import { template, cls, makeDotGapToCarouselStyle, makeStyle } from '@gem-sdk/core';
2
- import { getStyleDots, getDotDisplay } from './common/dots.js';
3
-
4
- const Dots = ({ className, loop, showDots, dotStyle, dotGapToCarousel, dotSize, controlOverContent, vertical, ...passProps })=>{
5
- const getClass = ()=>{
6
- return {
7
- ...getDotDisplay(dotStyle, vertical)
8
- };
9
- };
10
- return template`<div
11
- class="${cls('gp-items-center gp-justify-center gp-gap-2 gp-text-center', className, getClass())}"
12
- style="${{
13
- ...makeDotGapToCarouselStyle(dotStyle, dotGapToCarousel, vertical),
14
- ...makeStyle(getStyleDots(dotStyle))
15
- }}"
16
- ${passProps}></div>`;
17
- };
18
-
19
- export { Dots as default };
@@ -1,53 +0,0 @@
1
- import { getResponsiveValueByScreen } from '@gem-sdk/core';
2
-
3
- const getUpdatedDotStyle = (dot, dotStyle)=>{
4
- const devices = [
5
- 'desktop',
6
- 'tablet',
7
- 'mobile'
8
- ];
9
- let result = {};
10
- devices.forEach((device)=>{
11
- const dotSetting = getResponsiveValueByScreen(dot, device);
12
- const dotStyleSetting = getResponsiveValueByScreen(dotStyle, device);
13
- result = {
14
- ...result,
15
- [device]: dotSetting ? dotStyleSetting : 'none'
16
- };
17
- });
18
- return result;
19
- };
20
- const getDotDisplay = (dotStyle, vertical)=>{
21
- const devices = [
22
- 'desktop',
23
- 'tablet',
24
- 'mobile'
25
- ];
26
- const result = {};
27
- devices.forEach((device)=>{
28
- const dotStyleSetting = getResponsiveValueByScreen(dotStyle, device);
29
- const verticalSetting = getResponsiveValueByScreen(vertical, device);
30
- const deviceType = device === 'desktop' ? '' : `${device}:`;
31
- result[`${deviceType}gp-absolute`] = dotStyleSetting === 'inside';
32
- result[`${deviceType}gp-static`] = dotStyleSetting !== 'inside';
33
- result[`${deviceType}gp-flex-row ${deviceType}gp-left-0 ${deviceType}gp-right-0`] = !verticalSetting;
34
- result[`${deviceType}gp-flex-col ${deviceType}gp-ml-2 ${deviceType}gp-w-fit ${deviceType}gp-h-full`] = !!verticalSetting;
35
- });
36
- return result;
37
- };
38
- const getStyleDots = (dotStyle)=>{
39
- const devices = [
40
- 'desktop',
41
- 'tablet',
42
- 'mobile'
43
- ];
44
- const result = {};
45
- devices.forEach((device)=>{
46
- const dotStyleSetting = getResponsiveValueByScreen(dotStyle, device);
47
- const deviceType = device === 'desktop' ? '' : `${device}`;
48
- result[`d${deviceType.length === 0 ? '' : '-' + deviceType}`] = dotStyleSetting && dotStyleSetting !== 'none' ? 'flex' : 'none';
49
- });
50
- return result;
51
- };
52
-
53
- export { getDotDisplay, getStyleDots, getUpdatedDotStyle };