@gem-sdk/components 2.0.0-dev.693 → 2.0.0-dev.694
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/builder.js +6 -12
- package/dist/cjs/index.js +32 -34
- package/dist/cjs/index.liquid.js +10 -16
- package/dist/cjs/next.js +1 -3
- package/dist/cjs/product/components/ProductImagesV2/common/common.js +2 -1
- package/dist/cjs/product/index.js +4 -6
- package/dist/cjs/product/next.js +0 -4
- package/dist/cjs/setting.js +76 -78
- package/dist/esm/builder.js +0 -6
- package/dist/esm/index.js +0 -1
- package/dist/esm/index.liquid.js +0 -3
- package/dist/esm/next.js +1 -3
- package/dist/esm/product/components/ProductImagesV2/common/common.js +2 -1
- package/dist/esm/product/index.js +24 -26
- package/dist/esm/product/next.js +0 -4
- package/dist/esm/setting.js +0 -2
- package/dist/types/index.d.ts +116 -551
- package/package.json +1 -1
- package/dist/cjs/product/components/ProductImagesV3/common/common.js +0 -360
- package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +0 -192
- package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -26
- package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +0 -94
- package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +0 -303
- package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +0 -95
- package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -59
- package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +0 -266
- package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -63
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -36
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -109
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -139
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -100
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -77
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -300
- package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -44
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -83
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -182
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -30
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -239
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -28
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -144
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -14
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -54
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -53
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -55
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -41
- package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -134
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -203
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -87
- package/dist/cjs/product/components/ProductImagesV3/index.js +0 -291
- package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +0 -153
- package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +0 -252
- package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +0 -251
- package/dist/cjs/product/setting/product-image-v3/ProductImages.js +0 -74
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -388
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -519
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +0 -337
- package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -118
- package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -119
- package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +0 -237
- package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +0 -491
- package/dist/cjs/swiper-carousel/arrow/Arrow.js +0 -52
- package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +0 -46
- package/dist/cjs/swiper-carousel/arrow/common/common.js +0 -119
- package/dist/cjs/swiper-carousel/arrow/common/getClass.js +0 -50
- package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +0 -84
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +0 -34
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -38
- package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +0 -29
- package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +0 -79
- package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -22
- package/dist/cjs/swiper-carousel/components/common/carousel.js +0 -98
- package/dist/cjs/swiper-carousel/components/const/index.js +0 -5
- package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -34
- package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +0 -42
- package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -105
- package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -15
- package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +0 -45
- package/dist/cjs/swiper-carousel/dots/Dots.js +0 -51
- package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +0 -26
- package/dist/cjs/swiper-carousel/dots/common/common.js +0 -28
- package/dist/cjs/swiper-carousel/dots/common/getClass.js +0 -40
- package/dist/cjs/swiper-carousel/dots/common/getStyle.js +0 -33
- package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +0 -21
- package/dist/cjs/swiper-carousel/index.js +0 -17
- package/dist/cjs/swiper-carousel/next.js +0 -22
- package/dist/cjs/swiper-carousel/root/Swiper.js +0 -128
- package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +0 -104
- package/dist/cjs/swiper-carousel/root/common/getAttr.js +0 -25
- package/dist/cjs/swiper-carousel/root/common/getClass.js +0 -135
- package/dist/cjs/swiper-carousel/root/common/getData.js +0 -56
- package/dist/cjs/swiper-carousel/root/common/getStyle.js +0 -66
- package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +0 -482
- package/dist/cjs/swiper-carousel/setting/Swiper.js +0 -42
- package/dist/cjs/swiper-carousel/setting/SwiperItem.js +0 -40
- package/dist/cjs/swiper-carousel/setting/configs/presets.js +0 -87
- package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +0 -822
- package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +0 -718
- package/dist/esm/product/components/ProductImagesV3/common/common.js +0 -344
- package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +0 -189
- package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -24
- package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +0 -83
- package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +0 -292
- package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +0 -92
- package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -53
- package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +0 -251
- package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -59
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -32
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -105
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -135
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -96
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -73
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -296
- package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -40
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -79
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -178
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -26
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -235
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -24
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -140
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -12
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -52
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -51
- package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -53
- package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -39
- package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -132
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -201
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -85
- package/dist/esm/product/components/ProductImagesV3/index.js +0 -287
- package/dist/esm/product/components/ProductImagesV3/index.liquid.js +0 -149
- package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +0 -248
- package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +0 -248
- package/dist/esm/product/setting/product-image-v3/ProductImages.js +0 -70
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -384
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -516
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +0 -335
- package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -116
- package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -117
- package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +0 -235
- package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +0 -489
- package/dist/esm/swiper-carousel/arrow/Arrow.js +0 -48
- package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +0 -42
- package/dist/esm/swiper-carousel/arrow/common/common.js +0 -111
- package/dist/esm/swiper-carousel/arrow/common/getClass.js +0 -48
- package/dist/esm/swiper-carousel/arrow/common/getStyle.js +0 -82
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +0 -30
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -34
- package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +0 -27
- package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +0 -77
- package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -20
- package/dist/esm/swiper-carousel/components/common/carousel.js +0 -93
- package/dist/esm/swiper-carousel/components/const/index.js +0 -3
- package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -30
- package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +0 -35
- package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -103
- package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -13
- package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +0 -43
- package/dist/esm/swiper-carousel/dots/Dots.js +0 -47
- package/dist/esm/swiper-carousel/dots/Dots.liquid.js +0 -22
- package/dist/esm/swiper-carousel/dots/common/common.js +0 -26
- package/dist/esm/swiper-carousel/dots/common/getClass.js +0 -38
- package/dist/esm/swiper-carousel/dots/common/getStyle.js +0 -31
- package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +0 -19
- package/dist/esm/swiper-carousel/index.js +0 -15
- package/dist/esm/swiper-carousel/next.js +0 -18
- package/dist/esm/swiper-carousel/root/Swiper.js +0 -124
- package/dist/esm/swiper-carousel/root/Swiper.liquid.js +0 -100
- package/dist/esm/swiper-carousel/root/common/getAttr.js +0 -23
- package/dist/esm/swiper-carousel/root/common/getClass.js +0 -133
- package/dist/esm/swiper-carousel/root/common/getData.js +0 -54
- package/dist/esm/swiper-carousel/root/common/getStyle.js +0 -64
- package/dist/esm/swiper-carousel/root/hook/useCarousel.js +0 -480
- package/dist/esm/swiper-carousel/setting/Swiper.js +0 -38
- package/dist/esm/swiper-carousel/setting/SwiperItem.js +0 -36
- package/dist/esm/swiper-carousel/setting/configs/presets.js +0 -85
- package/dist/esm/swiper-carousel/setting/configs/settingV2.js +0 -818
- package/dist/esm/swiper-carousel/setting/configs/uiV2.js +0 -713
|
@@ -1,47 +0,0 @@
|
|
|
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 };
|
|
@@ -1,22 +0,0 @@
|
|
|
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 };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import '@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
|
-
|
|
26
|
-
export { getData };
|
|
@@ -1,38 +0,0 @@
|
|
|
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 };
|
|
@@ -1,31 +0,0 @@
|
|
|
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 };
|
|
@@ -1,19 +0,0 @@
|
|
|
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,15 +0,0 @@
|
|
|
1
|
-
import 'react/jsx-runtime';
|
|
2
|
-
import '@gem-sdk/core';
|
|
3
|
-
import 'react';
|
|
4
|
-
import '@gem-sdk/system';
|
|
5
|
-
import '@gem-sdk/keen-slider/react';
|
|
6
|
-
import 'next/link';
|
|
7
|
-
import config from './setting/Swiper.js';
|
|
8
|
-
import config$1 from './setting/SwiperItem.js';
|
|
9
|
-
|
|
10
|
-
const swiperCarouselSetting = {
|
|
11
|
-
SwiperCarousel: config,
|
|
12
|
-
SwiperCarouselItem: config$1
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { swiperCarouselSetting };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import dynamic from 'next/dynamic';
|
|
2
|
-
import Loading from '../common/components/Loading.js';
|
|
3
|
-
import 'react/jsx-runtime';
|
|
4
|
-
import 'react';
|
|
5
|
-
import '@gem-sdk/core';
|
|
6
|
-
|
|
7
|
-
const SwiperCarousel = dynamic(()=>import('./root/Swiper.js'), {
|
|
8
|
-
loading: Loading
|
|
9
|
-
});
|
|
10
|
-
const SwiperCarouselItem = dynamic(()=>import('./carousel-item/SwiperItem.js'), {
|
|
11
|
-
loading: Loading
|
|
12
|
-
});
|
|
13
|
-
var swiperCarousel = {
|
|
14
|
-
SwiperCarousel,
|
|
15
|
-
SwiperCarouselItem
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export { swiperCarousel as default };
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useCurrentDevice, filterToolbarPreview, isEmptyChildren } from '@gem-sdk/core';
|
|
4
|
-
import { forwardRef, Children, isValidElement } from 'react';
|
|
5
|
-
import Dots from '../dots/Dots.js';
|
|
6
|
-
import Arrow from '../arrow/Arrow.js';
|
|
7
|
-
import { mappingNavigationCarousel } from '../arrow/common/common.js';
|
|
8
|
-
import { useCarousel } from './hook/useCarousel.js';
|
|
9
|
-
import { getClass } from './common/getClass.js';
|
|
10
|
-
import { getStyle } from './common/getStyle.js';
|
|
11
|
-
import { getAttr } from './common/getAttr.js';
|
|
12
|
-
import { getData } from './common/getData.js';
|
|
13
|
-
|
|
14
|
-
const Carousel = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
15
|
-
const { children, builderAttrs, builderProps, styles, isHiddenArrowWhenDisabled = true, hiddenDotWhenOnlyOne, elmRef } = props;
|
|
16
|
-
const setting = mappingNavigationCarousel(props.setting);
|
|
17
|
-
const renderData = {
|
|
18
|
-
...props,
|
|
19
|
-
setting
|
|
20
|
-
};
|
|
21
|
-
const { arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', roundedArrow, arrowIconSize, arrowCustomColor, arrowBorder, arrowShadow, showWhenHover } = setting ?? {};
|
|
22
|
-
const { totalSlideItem, isInfinity, slider, currentSlide, localRef, showNavigation, isRenderDots, handleDotClick, getItemsPerPage, sliderRef, handleNextAndPrevSlide, dispatchEventSelectSlide, getNumberOfFullWidthShow } = useCarousel(renderData, ref);
|
|
23
|
-
const { loopConfig, arrowShowConfig } = getData(renderData);
|
|
24
|
-
const { rootClassRender, wrapperClassRender, wrapperInnerClass, sliderClass } = getClass(renderData);
|
|
25
|
-
const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle } = getStyle(renderData);
|
|
26
|
-
const { rootAttrRender, sliderAttr } = getAttr(renderData);
|
|
27
|
-
const currentDevice = useCurrentDevice();
|
|
28
|
-
const enabledSneakPeak = setting?.sneakPeak?.[currentDevice];
|
|
29
|
-
const renderArrow = (position)=>{
|
|
30
|
-
const isNext = position === 'next';
|
|
31
|
-
return /*#__PURE__*/ jsx(Arrow, {
|
|
32
|
-
uid: builderProps?.uid,
|
|
33
|
-
custom: setting?.arrowCustom ?? '',
|
|
34
|
-
showArrow: arrowShowConfig,
|
|
35
|
-
arrowButtonSize: arrowButtonSize || {},
|
|
36
|
-
arrowIconSize: arrowIconSize || {},
|
|
37
|
-
arrowBackgroundColor: arrowBackgroundColor || '',
|
|
38
|
-
arrowCustomColor: arrowCustomColor,
|
|
39
|
-
gapToEachSize: arrowGapToEachSide,
|
|
40
|
-
showWhenHover: showWhenHover,
|
|
41
|
-
arrowBorder: arrowBorder || {},
|
|
42
|
-
arrowCorner: roundedArrow || {},
|
|
43
|
-
arrowShadow: arrowShadow || {},
|
|
44
|
-
onClick: (e)=>{
|
|
45
|
-
e.stopPropagation();
|
|
46
|
-
handleNextAndPrevSlide(position);
|
|
47
|
-
},
|
|
48
|
-
left: !isNext,
|
|
49
|
-
disabled: !isInfinity && slider?.track?.details?.abs === 0,
|
|
50
|
-
vertical: setting?.vertical,
|
|
51
|
-
isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
|
|
52
|
-
rootId: props?.parentClass
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
const renderChildren = ()=>{
|
|
56
|
-
return /*#__PURE__*/ jsx(Fragment, {
|
|
57
|
-
children: isEmptyChildren(children) ? /*#__PURE__*/ jsx("div", {
|
|
58
|
-
children: "No Slider"
|
|
59
|
-
}) : Children.map(filterToolbarPreview(children), (child, index)=>{
|
|
60
|
-
if (/*#__PURE__*/ isValidElement(child)) {
|
|
61
|
-
return /*#__PURE__*/ jsx(child.type, {
|
|
62
|
-
...child.props,
|
|
63
|
-
index: index,
|
|
64
|
-
parentSettings: setting,
|
|
65
|
-
parentStyle: styles,
|
|
66
|
-
background: setting?.background,
|
|
67
|
-
parentUid: builderProps?.uid,
|
|
68
|
-
dispatchEventSelectSlide: dispatchEventSelectSlide
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
})
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
return /*#__PURE__*/ jsx("div", {
|
|
76
|
-
ref: elmRef,
|
|
77
|
-
...rootAttrRender,
|
|
78
|
-
className: rootClassRender,
|
|
79
|
-
style: rootStyleRender,
|
|
80
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
81
|
-
ref: localRef,
|
|
82
|
-
...builderAttrs,
|
|
83
|
-
className: wrapperClassRender,
|
|
84
|
-
style: wrapperStyleRender,
|
|
85
|
-
children: [
|
|
86
|
-
/*#__PURE__*/ jsxs("div", {
|
|
87
|
-
className: wrapperInnerClass,
|
|
88
|
-
style: wrapperInnerStyle,
|
|
89
|
-
children: [
|
|
90
|
-
showNavigation && renderArrow('prev'),
|
|
91
|
-
/*#__PURE__*/ jsx("div", {
|
|
92
|
-
ref: sliderRef,
|
|
93
|
-
...sliderAttr,
|
|
94
|
-
className: sliderClass,
|
|
95
|
-
children: renderChildren()
|
|
96
|
-
}),
|
|
97
|
-
showNavigation && renderArrow('next')
|
|
98
|
-
]
|
|
99
|
-
}),
|
|
100
|
-
isRenderDots && /*#__PURE__*/ jsx(Dots, {
|
|
101
|
-
showDots: setting?.dot,
|
|
102
|
-
dotStyle: setting?.dotStyle,
|
|
103
|
-
totalSlideItem: totalSlideItem,
|
|
104
|
-
slideItemsPerPage: getItemsPerPage(),
|
|
105
|
-
currentSlide: currentSlide,
|
|
106
|
-
enabledSneakPeak: enabledSneakPeak,
|
|
107
|
-
vertical: setting?.vertical,
|
|
108
|
-
loop: loopConfig,
|
|
109
|
-
dotColor: setting?.dotColor,
|
|
110
|
-
dotGapToCarousel: setting?.dotGapToCarousel,
|
|
111
|
-
dotSize: setting?.dotSize,
|
|
112
|
-
dotActiveColor: setting?.dotActiveColor,
|
|
113
|
-
hiddenWhenOnlyOne: hiddenDotWhenOnlyOne,
|
|
114
|
-
sneakPeakType: setting?.sneakPeakType,
|
|
115
|
-
numberOfFullWidthShow: getNumberOfFullWidthShow(currentDevice),
|
|
116
|
-
onHandleClick: handleDotClick
|
|
117
|
-
}),
|
|
118
|
-
filterToolbarPreview(children, true)
|
|
119
|
-
]
|
|
120
|
-
})
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
export { Carousel as default };
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { template, RenderIf, isLocalEnv, baseAssetURL, WrapRenderChildren, RenderChildren } from '@gem-sdk/core';
|
|
2
|
-
import Arrow from '../arrow/Arrow.liquid.js';
|
|
3
|
-
import { getSettingPreloadData, getStaticLocale } from '../../helpers.js';
|
|
4
|
-
import Dots from '../dots/Dots.liquid.js';
|
|
5
|
-
import { mappingNavigationCarousel } from '../arrow/common/common.js';
|
|
6
|
-
import { getData } from './common/getData.js';
|
|
7
|
-
import { getClass } from './common/getClass.js';
|
|
8
|
-
import { getStyle } from './common/getStyle.js';
|
|
9
|
-
import { getAttr } from './common/getAttr.js';
|
|
10
|
-
|
|
11
|
-
const Carousel = (props)=>{
|
|
12
|
-
const { children, builderAttrs, builderProps, styles, isHiddenArrowWhenDisabled = true, hiddenDotWhenOnlyOne, rootId, rawChildren, conditionAppendJs } = props;
|
|
13
|
-
const setting = mappingNavigationCarousel(props.setting);
|
|
14
|
-
const renderData = {
|
|
15
|
-
...props,
|
|
16
|
-
setting
|
|
17
|
-
};
|
|
18
|
-
const { arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', roundedArrow, arrowIconSize, arrowCustomColor, arrowBorder, arrowShadow, showWhenHover } = setting ?? {};
|
|
19
|
-
const { uniqueComponentId, loopConfig, arrowShowConfig, stateData } = getData(renderData);
|
|
20
|
-
const { rootClassRender, wrapperClassRender, wrapperInnerClass, sliderClass } = getClass(renderData);
|
|
21
|
-
const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle, sliderStyle } = getStyle(renderData);
|
|
22
|
-
const { rootAttrRender, sliderAttr } = getAttr(renderData);
|
|
23
|
-
const renderJS = ()=>{
|
|
24
|
-
return RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-swiper.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-swiper.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
|
|
25
|
-
};
|
|
26
|
-
const renderArrow = (position)=>{
|
|
27
|
-
const isNext = position === 'next';
|
|
28
|
-
return Arrow({
|
|
29
|
-
uid: builderProps?.uid,
|
|
30
|
-
componentId: uniqueComponentId,
|
|
31
|
-
custom: setting?.arrowCustom ?? '',
|
|
32
|
-
showArrow: arrowShowConfig,
|
|
33
|
-
arrowButtonSize: arrowButtonSize || {},
|
|
34
|
-
arrowIconSize: arrowIconSize || {},
|
|
35
|
-
arrowBackgroundColor: arrowBackgroundColor ?? '',
|
|
36
|
-
arrowCustomColor: arrowCustomColor,
|
|
37
|
-
gapToEachSize: arrowGapToEachSide,
|
|
38
|
-
showWhenHover: showWhenHover,
|
|
39
|
-
arrowBorder: arrowBorder || {},
|
|
40
|
-
arrowCorner: roundedArrow || {},
|
|
41
|
-
arrowShadow: arrowShadow || {},
|
|
42
|
-
left: !isNext,
|
|
43
|
-
onClick: (e)=>{
|
|
44
|
-
e.stopPropagation();
|
|
45
|
-
},
|
|
46
|
-
vertical: setting?.vertical,
|
|
47
|
-
isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
|
|
48
|
-
rootId: rootId
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
|
-
const renderChildren = ()=>{
|
|
52
|
-
return template`
|
|
53
|
-
${rawChildren?.length ? WrapRenderChildren({
|
|
54
|
-
uid: builderProps?.uid ?? '',
|
|
55
|
-
customProps: rawChildren[0]?.customProps
|
|
56
|
-
}, rawChildren.map((child, index)=>{
|
|
57
|
-
if (child) {
|
|
58
|
-
return template`${RenderChildren({
|
|
59
|
-
...child,
|
|
60
|
-
index,
|
|
61
|
-
parentSettings: setting,
|
|
62
|
-
parentStyle: styles,
|
|
63
|
-
background: setting?.background,
|
|
64
|
-
parentUid: builderProps?.uid
|
|
65
|
-
})}`;
|
|
66
|
-
}
|
|
67
|
-
})) : children ?? `<div>${getStaticLocale('Carousel', 'no_slider')}</div>`}`;
|
|
68
|
-
};
|
|
69
|
-
return template /* liquid */ `
|
|
70
|
-
<gp-swiper gp-data='${stateData}' ${rootAttrRender} style="${rootStyleRender}" class="${rootClassRender}">
|
|
71
|
-
<div
|
|
72
|
-
${builderAttrs}
|
|
73
|
-
class="${wrapperClassRender}"
|
|
74
|
-
style="${wrapperStyleRender}"
|
|
75
|
-
>
|
|
76
|
-
<div ${sliderAttr} class="${wrapperInnerClass}" style="${wrapperInnerStyle}">
|
|
77
|
-
${renderArrow('prev')}
|
|
78
|
-
<div class="${sliderClass}" style="${sliderStyle}">
|
|
79
|
-
${renderChildren()}
|
|
80
|
-
</div>
|
|
81
|
-
${renderArrow('next')}
|
|
82
|
-
</div>
|
|
83
|
-
${Dots({
|
|
84
|
-
loop: loopConfig,
|
|
85
|
-
showDots: setting?.dot,
|
|
86
|
-
dotStyle: setting?.dotStyle,
|
|
87
|
-
dotGapToCarousel: setting?.dotGapToCarousel,
|
|
88
|
-
dotSize: setting?.dotSize,
|
|
89
|
-
vertical: setting?.vertical,
|
|
90
|
-
uniqueComponentId: uniqueComponentId,
|
|
91
|
-
hiddenWhenOnlyOne: hiddenDotWhenOnlyOne
|
|
92
|
-
})}
|
|
93
|
-
</div>
|
|
94
|
-
</gp-swiper>
|
|
95
|
-
${conditionAppendJs ? `{% if ${conditionAppendJs} %} ${renderJS()} {% endif %}` : renderJS()}
|
|
96
|
-
|
|
97
|
-
`;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
export { Carousel as default };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createAttr } from '@gem-sdk/system';
|
|
2
|
-
import { getData } from './getData.js';
|
|
3
|
-
|
|
4
|
-
const getAttr = (props)=>{
|
|
5
|
-
const { rootAttrs, builderProps, rootId } = props;
|
|
6
|
-
const { uniqueComponentId } = getData(props);
|
|
7
|
-
const rootAttrRender = createAttr({
|
|
8
|
-
'data-id': `${builderProps?.uid}`,
|
|
9
|
-
id: `gp-root-carousel-${uniqueComponentId}`,
|
|
10
|
-
...rootAttrs
|
|
11
|
-
});
|
|
12
|
-
const sliderAttr = createAttr({
|
|
13
|
-
...(builderProps?.uid || rootId) && {
|
|
14
|
-
id: `gp-swiper-${uniqueComponentId}`
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return {
|
|
18
|
-
rootAttrRender,
|
|
19
|
-
sliderAttr
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { getAttr };
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { getResponsiveValueByScreen } from '@gem-sdk/core';
|
|
2
|
-
import { createClass } from '@gem-sdk/system';
|
|
3
|
-
import { getData } from './getData.js';
|
|
4
|
-
|
|
5
|
-
const getClass = (props)=>{
|
|
6
|
-
const DEVICES = [
|
|
7
|
-
'mobile',
|
|
8
|
-
'tablet',
|
|
9
|
-
'desktop'
|
|
10
|
-
];
|
|
11
|
-
const { setting, builderProps, wrapperClass, rootClass, advanced, fullHeight, slidesClass } = props;
|
|
12
|
-
const { sliderSelector } = getData(props);
|
|
13
|
-
const getDisplayOfWrapper = ()=>{
|
|
14
|
-
let result = {};
|
|
15
|
-
DEVICES.forEach((device)=>{
|
|
16
|
-
const devicePrefix = device === 'desktop' ? '' : `${device}:`;
|
|
17
|
-
result = {
|
|
18
|
-
...result,
|
|
19
|
-
[`${devicePrefix}gp-flex`]: setting?.vertical?.[device],
|
|
20
|
-
[`${devicePrefix}gp-block`]: !setting?.vertical?.[device]
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
const getWrapperInnerHeight = ()=>{
|
|
26
|
-
let result = {};
|
|
27
|
-
DEVICES.forEach((device)=>{
|
|
28
|
-
const devicePrefix = device === 'desktop' ? '' : `${device}:`;
|
|
29
|
-
result = {
|
|
30
|
-
...result,
|
|
31
|
-
[`${devicePrefix}gp-h-full`]: setting?.vertical?.[device],
|
|
32
|
-
[`${devicePrefix}gp-flex-1`]: setting?.vertical?.[device]
|
|
33
|
-
};
|
|
34
|
-
});
|
|
35
|
-
return result;
|
|
36
|
-
};
|
|
37
|
-
const makeFlexColClass = ()=>{
|
|
38
|
-
let result = {};
|
|
39
|
-
DEVICES.forEach((device)=>{
|
|
40
|
-
const devicePrefix = device === 'desktop' ? '' : `${device}:`;
|
|
41
|
-
result = {
|
|
42
|
-
...result,
|
|
43
|
-
[`${devicePrefix}!gp-flex-col`]: setting?.vertical?.[device],
|
|
44
|
-
[`${devicePrefix}!gp-flex-row`]: !setting?.vertical?.[device]
|
|
45
|
-
};
|
|
46
|
-
});
|
|
47
|
-
return result;
|
|
48
|
-
};
|
|
49
|
-
const makeVerticalWrapClass = ()=>{
|
|
50
|
-
let result = {};
|
|
51
|
-
DEVICES.forEach((device)=>{
|
|
52
|
-
const devicePrefix = device === 'desktop' ? '' : `${device}:`;
|
|
53
|
-
if (setting?.vertical?.[device]) {
|
|
54
|
-
result = {
|
|
55
|
-
...result,
|
|
56
|
-
[`${devicePrefix}!gp-flex-wrap`]: setting?.vertical?.[device]
|
|
57
|
-
};
|
|
58
|
-
} else {
|
|
59
|
-
result = {
|
|
60
|
-
...result,
|
|
61
|
-
[`${devicePrefix}!gp-flex-nowrap`]: !setting?.vertical?.[device]
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
return result;
|
|
66
|
-
};
|
|
67
|
-
const makeVerticalMinHeightClass = ()=>{
|
|
68
|
-
let result = {};
|
|
69
|
-
DEVICES.forEach((device)=>{
|
|
70
|
-
const devicePrefix = device === 'desktop' ? '' : `${device}:`;
|
|
71
|
-
if (setting?.vertical?.[device]) {
|
|
72
|
-
result = {
|
|
73
|
-
...result,
|
|
74
|
-
[`${devicePrefix}!gp-min-h-0`]: setting?.vertical?.[device]
|
|
75
|
-
};
|
|
76
|
-
} else {
|
|
77
|
-
result = {
|
|
78
|
-
...result,
|
|
79
|
-
[`${devicePrefix}!gp-min-h-full`]: !setting?.vertical?.[device]
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
return result;
|
|
84
|
-
};
|
|
85
|
-
const wrapperClassRender = createClass({
|
|
86
|
-
...builderProps?.uid && {
|
|
87
|
-
[builderProps.uid]: true
|
|
88
|
-
},
|
|
89
|
-
...wrapperClass && {
|
|
90
|
-
[wrapperClass]: true
|
|
91
|
-
},
|
|
92
|
-
'gp-relative gp-my-0 tablet:gp-px-0 gp-max-w-full mobile:gp-px-0 gp-carousel-wrapper': true,
|
|
93
|
-
'!gp-flex': getResponsiveValueByScreen(setting?.vertical, 'desktop'),
|
|
94
|
-
'tablet:!gp-flex': getResponsiveValueByScreen(setting?.vertical, 'tablet'),
|
|
95
|
-
'mobile:!gp-flex': getResponsiveValueByScreen(setting?.vertical, 'mobile'),
|
|
96
|
-
...getDisplayOfWrapper()
|
|
97
|
-
});
|
|
98
|
-
const wrapperInnerClass = createClass({
|
|
99
|
-
'gp-relative gp-overflow-hidden gp-flex gp-items-center gp-justify-between': true,
|
|
100
|
-
'!gp-h-full': fullHeight,
|
|
101
|
-
...getWrapperInnerHeight(),
|
|
102
|
-
...makeFlexColClass()
|
|
103
|
-
});
|
|
104
|
-
const rootClassRender = createClass({
|
|
105
|
-
'gp-group/carousel gp-w-full gp-flex': true,
|
|
106
|
-
'!gp-flex-col': getResponsiveValueByScreen(setting?.vertical, 'desktop'),
|
|
107
|
-
'tablet:!flex-col': getResponsiveValueByScreen(setting?.vertical, 'tablet'),
|
|
108
|
-
'mobile:!flex-col': getResponsiveValueByScreen(setting?.vertical, 'mobile'),
|
|
109
|
-
...rootClass && {
|
|
110
|
-
[rootClass]: true
|
|
111
|
-
},
|
|
112
|
-
...advanced?.cssClass && {
|
|
113
|
-
[advanced.cssClass]: true
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
const sliderClass = createClass({
|
|
117
|
-
'gp-swiper-wrapper gp-flex gp-h-full gp-select-none': true,
|
|
118
|
-
[sliderSelector]: true,
|
|
119
|
-
...slidesClass && {
|
|
120
|
-
[slidesClass]: true
|
|
121
|
-
},
|
|
122
|
-
...makeVerticalWrapClass(),
|
|
123
|
-
...makeVerticalMinHeightClass()
|
|
124
|
-
});
|
|
125
|
-
return {
|
|
126
|
-
rootClassRender,
|
|
127
|
-
wrapperClassRender,
|
|
128
|
-
wrapperInnerClass,
|
|
129
|
-
sliderClass
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
export { getClass };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { getResponsiveValueByScreen } from '@gem-sdk/core';
|
|
2
|
-
import { createStateOrContext } from '@gem-sdk/system';
|
|
3
|
-
|
|
4
|
-
const getData = (props)=>{
|
|
5
|
-
const DEVICES = [
|
|
6
|
-
'mobile',
|
|
7
|
-
'tablet',
|
|
8
|
-
'desktop'
|
|
9
|
-
];
|
|
10
|
-
const { setting, rootId, builderProps, styles, moveToIdx, isHiddenArrowWhenDisabled } = props;
|
|
11
|
-
const uniqueComponentId = rootId ?? builderProps?.uid;
|
|
12
|
-
const sliderSelector = `gp-carousel-slider-${builderProps?.uid}`;
|
|
13
|
-
const { enableAction = {
|
|
14
|
-
desktop: true
|
|
15
|
-
}, navigationStyle, navigationEnable = {
|
|
16
|
-
desktop: true
|
|
17
|
-
} } = setting ?? {};
|
|
18
|
-
const getLoopSetting = ()=>{
|
|
19
|
-
let result = setting?.loop;
|
|
20
|
-
DEVICES.forEach((device)=>{
|
|
21
|
-
result = {
|
|
22
|
-
...result,
|
|
23
|
-
[device]: getResponsiveValueByScreen(enableAction) ? result?.[device] : false
|
|
24
|
-
};
|
|
25
|
-
});
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
const getArrowType = ()=>{
|
|
29
|
-
let result = navigationStyle;
|
|
30
|
-
DEVICES.forEach((device)=>{
|
|
31
|
-
result = {
|
|
32
|
-
...result,
|
|
33
|
-
[device]: getResponsiveValueByScreen(navigationEnable, device) ? result?.[device] : 'none'
|
|
34
|
-
};
|
|
35
|
-
});
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
const stateData = createStateOrContext({
|
|
39
|
-
id: uniqueComponentId,
|
|
40
|
-
moveToIdx,
|
|
41
|
-
isHiddenArrowWhenDisabled,
|
|
42
|
-
setting,
|
|
43
|
-
styles
|
|
44
|
-
});
|
|
45
|
-
return {
|
|
46
|
-
loopConfig: getLoopSetting(),
|
|
47
|
-
stateData: JSON.stringify(stateData).replaceAll("'", '''),
|
|
48
|
-
uniqueComponentId,
|
|
49
|
-
arrowShowConfig: getArrowType(),
|
|
50
|
-
sliderSelector
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export { getData };
|