@gem-sdk/components 2.0.0-dev.622 → 2.0.0-dev.624
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 +12 -6
- package/dist/cjs/collection/components/collection-paginator/common/styles.js +3 -4
- package/dist/cjs/collection/components/collection-paginator/components/CollectionPaginator.liquid.js +2 -1
- package/dist/cjs/collection/setting/collection-paginator/configs/settings.js +2 -3
- package/dist/cjs/index.js +34 -32
- package/dist/cjs/index.liquid.js +16 -10
- package/dist/cjs/next.js +3 -1
- package/dist/cjs/product/components/ProductImagesV3/common/common.js +360 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +192 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +26 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +94 -0
- package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +303 -0
- package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +95 -0
- package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +59 -0
- package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +266 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +63 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +36 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +109 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +139 -0
- package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +100 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +77 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +300 -0
- package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +44 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +83 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +182 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +30 -0
- package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +239 -0
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +28 -0
- package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +144 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +14 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +54 -0
- package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +53 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +55 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +41 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +134 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +203 -0
- package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +87 -0
- package/dist/cjs/product/components/ProductImagesV3/index.js +291 -0
- package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +153 -0
- package/dist/cjs/product/index.js +6 -4
- package/dist/cjs/product/next.js +4 -0
- package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +252 -0
- package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +251 -0
- package/dist/cjs/product/setting/product-image-v3/ProductImages.js +74 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +388 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +518 -0
- package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +336 -0
- package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +118 -0
- package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +119 -0
- package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +237 -0
- package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +491 -0
- package/dist/cjs/setting.js +97 -95
- package/dist/cjs/swiper-carousel/arrow/Arrow.js +52 -0
- package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +46 -0
- package/dist/cjs/swiper-carousel/arrow/common/common.js +119 -0
- package/dist/cjs/swiper-carousel/arrow/common/getClass.js +50 -0
- package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +84 -0
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +34 -0
- package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +38 -0
- package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +29 -0
- package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +79 -0
- package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +22 -0
- package/dist/cjs/swiper-carousel/components/common/carousel.js +98 -0
- package/dist/cjs/swiper-carousel/components/const/index.js +5 -0
- package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +34 -0
- package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +42 -0
- package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +105 -0
- package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +15 -0
- package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +45 -0
- package/dist/cjs/swiper-carousel/dots/Dots.js +51 -0
- package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +26 -0
- package/dist/cjs/swiper-carousel/dots/common/common.js +28 -0
- package/dist/cjs/swiper-carousel/dots/common/getClass.js +40 -0
- package/dist/cjs/swiper-carousel/dots/common/getStyle.js +33 -0
- package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +21 -0
- package/dist/cjs/swiper-carousel/index.js +17 -0
- package/dist/cjs/swiper-carousel/next.js +22 -0
- package/dist/cjs/swiper-carousel/root/Swiper.js +128 -0
- package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +104 -0
- package/dist/cjs/swiper-carousel/root/common/getAttr.js +25 -0
- package/dist/cjs/swiper-carousel/root/common/getClass.js +135 -0
- package/dist/cjs/swiper-carousel/root/common/getData.js +56 -0
- package/dist/cjs/swiper-carousel/root/common/getStyle.js +64 -0
- package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +482 -0
- package/dist/cjs/swiper-carousel/setting/Swiper.js +42 -0
- package/dist/cjs/swiper-carousel/setting/SwiperItem.js +40 -0
- package/dist/cjs/swiper-carousel/setting/configs/presets.js +87 -0
- package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +819 -0
- package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +718 -0
- package/dist/esm/builder.js +6 -0
- package/dist/esm/collection/components/collection-paginator/common/styles.js +3 -4
- package/dist/esm/collection/components/collection-paginator/components/CollectionPaginator.liquid.js +2 -1
- package/dist/esm/collection/setting/collection-paginator/configs/settings.js +2 -3
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.liquid.js +3 -0
- package/dist/esm/next.js +3 -1
- package/dist/esm/product/components/ProductImagesV3/common/common.js +344 -0
- package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +189 -0
- package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +24 -0
- package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +83 -0
- package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +292 -0
- package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +92 -0
- package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +53 -0
- package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +251 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +59 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +32 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +105 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +135 -0
- package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +96 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +73 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +296 -0
- package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +40 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +79 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +178 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +26 -0
- package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +235 -0
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +24 -0
- package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +140 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +12 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +52 -0
- package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +51 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +53 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +39 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +132 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +201 -0
- package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +85 -0
- package/dist/esm/product/components/ProductImagesV3/index.js +287 -0
- package/dist/esm/product/components/ProductImagesV3/index.liquid.js +149 -0
- package/dist/esm/product/index.js +26 -24
- package/dist/esm/product/next.js +4 -0
- package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +248 -0
- package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +248 -0
- package/dist/esm/product/setting/product-image-v3/ProductImages.js +70 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +384 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +515 -0
- package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +334 -0
- package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +116 -0
- package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +117 -0
- package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +235 -0
- package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +489 -0
- package/dist/esm/setting.js +2 -0
- package/dist/esm/swiper-carousel/arrow/Arrow.js +48 -0
- package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +42 -0
- package/dist/esm/swiper-carousel/arrow/common/common.js +111 -0
- package/dist/esm/swiper-carousel/arrow/common/getClass.js +48 -0
- package/dist/esm/swiper-carousel/arrow/common/getStyle.js +82 -0
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +30 -0
- package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +34 -0
- package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +27 -0
- package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +77 -0
- package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +20 -0
- package/dist/esm/swiper-carousel/components/common/carousel.js +93 -0
- package/dist/esm/swiper-carousel/components/const/index.js +3 -0
- package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +30 -0
- package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +35 -0
- package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +103 -0
- package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +13 -0
- package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +43 -0
- package/dist/esm/swiper-carousel/dots/Dots.js +47 -0
- package/dist/esm/swiper-carousel/dots/Dots.liquid.js +22 -0
- package/dist/esm/swiper-carousel/dots/common/common.js +26 -0
- package/dist/esm/swiper-carousel/dots/common/getClass.js +38 -0
- package/dist/esm/swiper-carousel/dots/common/getStyle.js +31 -0
- package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +19 -0
- package/dist/esm/swiper-carousel/index.js +15 -0
- package/dist/esm/swiper-carousel/next.js +18 -0
- package/dist/esm/swiper-carousel/root/Swiper.js +124 -0
- package/dist/esm/swiper-carousel/root/Swiper.liquid.js +100 -0
- package/dist/esm/swiper-carousel/root/common/getAttr.js +23 -0
- package/dist/esm/swiper-carousel/root/common/getClass.js +133 -0
- package/dist/esm/swiper-carousel/root/common/getData.js +54 -0
- package/dist/esm/swiper-carousel/root/common/getStyle.js +62 -0
- package/dist/esm/swiper-carousel/root/hook/useCarousel.js +480 -0
- package/dist/esm/swiper-carousel/setting/Swiper.js +38 -0
- package/dist/esm/swiper-carousel/setting/SwiperItem.js +36 -0
- package/dist/esm/swiper-carousel/setting/configs/presets.js +85 -0
- package/dist/esm/swiper-carousel/setting/configs/settingV2.js +815 -0
- package/dist/esm/swiper-carousel/setting/configs/uiV2.js +713 -0
- package/dist/types/index.d.ts +551 -116
- package/package.json +2 -2
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var carousel = require('../../components/common/carousel.js');
|
|
5
|
+
var system = require('@gem-sdk/system');
|
|
6
|
+
|
|
7
|
+
const getStyle = (props)=>{
|
|
8
|
+
const { style, contentType, parentStyle, parentSettings, background, customStyle, index } = props;
|
|
9
|
+
const itemPadding = core.makeGlobalSize(parentStyle?.itemPadding);
|
|
10
|
+
const styleByContentType = ()=>{
|
|
11
|
+
const delList = [
|
|
12
|
+
'--radius'
|
|
13
|
+
];
|
|
14
|
+
delList.forEach((element)=>{
|
|
15
|
+
delete style?.[element];
|
|
16
|
+
});
|
|
17
|
+
if (contentType === 'productImage') return style;
|
|
18
|
+
return {
|
|
19
|
+
...style,
|
|
20
|
+
...core.makeStyle({
|
|
21
|
+
bs: parentStyle?.borderContent?.border,
|
|
22
|
+
bw: parentStyle?.borderContent?.width,
|
|
23
|
+
bc: core.getSingleColorVariable(parentStyle?.borderContent?.color)
|
|
24
|
+
}),
|
|
25
|
+
...core.getRadiusStyleActiveState({
|
|
26
|
+
...parentStyle?.roundedContent,
|
|
27
|
+
active: {
|
|
28
|
+
...parentStyle?.roundedContent || {},
|
|
29
|
+
radiusType: 'custom'
|
|
30
|
+
}
|
|
31
|
+
})
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
const getCarouselItemStyle = {
|
|
35
|
+
...customStyle,
|
|
36
|
+
...itemPadding && itemPadding.padding,
|
|
37
|
+
...carousel.getInitialWidthForCarouselItem({
|
|
38
|
+
spacing: parentStyle?.spacing,
|
|
39
|
+
slidesToShow: parentSettings?.itemNumber ?? parentSettings?.slidesToShow,
|
|
40
|
+
sneakPeak: parentSettings?.sneakPeak,
|
|
41
|
+
sneakPeakType: parentSettings?.sneakPeakType,
|
|
42
|
+
sneakPeakOffsetCenter: parentSettings?.sneakPeakOffsetCenter,
|
|
43
|
+
sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward,
|
|
44
|
+
vertical: parentSettings?.vertical
|
|
45
|
+
}),
|
|
46
|
+
...core.getStyleBackgroundByDevice(background),
|
|
47
|
+
...core.getGradientBgrStyleByDevice(background, {
|
|
48
|
+
desktop: true,
|
|
49
|
+
tablet: true,
|
|
50
|
+
mobile: true
|
|
51
|
+
}),
|
|
52
|
+
...core.makeStyleResponsive('ml', carousel.getCarouselSneakPeakTranslate({
|
|
53
|
+
index,
|
|
54
|
+
spacing: parentStyle?.spacing,
|
|
55
|
+
slidesToShow: parentSettings?.itemNumber ?? parentSettings?.slidesToShow,
|
|
56
|
+
sneakPeak: parentSettings?.sneakPeak,
|
|
57
|
+
sneakPeakType: parentSettings?.sneakPeakType,
|
|
58
|
+
sneakPeakOffsetCenter: parentSettings?.sneakPeakOffsetCenter,
|
|
59
|
+
sneakPeakOffsetForward: parentSettings?.sneakPeakOffsetForward
|
|
60
|
+
}))
|
|
61
|
+
};
|
|
62
|
+
const carouselItemInnerStyle = system.createStyle({
|
|
63
|
+
...core.getStyleShadow({
|
|
64
|
+
value: parentStyle?.carouselShadow,
|
|
65
|
+
styleAppliedFor: 'box-shadow',
|
|
66
|
+
isEnableShadow: parentStyle?.hasActiveShadow
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
const carouselItemStyle = system.createStyle({
|
|
70
|
+
...getCarouselItemStyle,
|
|
71
|
+
...styleByContentType()
|
|
72
|
+
});
|
|
73
|
+
return {
|
|
74
|
+
carouselItemStyle,
|
|
75
|
+
carouselItemInnerStyle
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
exports.getStyle = getStyle;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const useCarouselItem = (props)=>{
|
|
4
|
+
const { onClickItem, onMouseMove, onMouseOut, dispatchEventSelectSlide, index = 0 } = props;
|
|
5
|
+
const handleClick = (e)=>{
|
|
6
|
+
onClickItem && onClickItem(e);
|
|
7
|
+
dispatchEventSelectSlide && dispatchEventSelectSlide(index);
|
|
8
|
+
};
|
|
9
|
+
const handleMouseMove = (e)=>{
|
|
10
|
+
onMouseMove && onMouseMove(e);
|
|
11
|
+
};
|
|
12
|
+
const handleMouseOut = (e)=>{
|
|
13
|
+
onMouseOut && onMouseOut(e);
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
handleClick,
|
|
17
|
+
handleMouseMove,
|
|
18
|
+
handleMouseOut
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.useCarouselItem = useCarouselItem;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var helpers = require('../../../helpers.js');
|
|
5
|
+
|
|
6
|
+
const DEVICES = [
|
|
7
|
+
'desktop',
|
|
8
|
+
'mobile',
|
|
9
|
+
'tablet'
|
|
10
|
+
];
|
|
11
|
+
const getInitialWidthForCarouselItem = (setting)=>{
|
|
12
|
+
let result = {};
|
|
13
|
+
DEVICES.forEach((device)=>{
|
|
14
|
+
if (!setting?.vertical?.[device]) {
|
|
15
|
+
const className = {
|
|
16
|
+
...core.makeStyleResponsive('minw', core.makeWidth(getWidthForCarouselItem({
|
|
17
|
+
spacing: setting?.spacing,
|
|
18
|
+
slidesToShow: setting?.slidesToShow,
|
|
19
|
+
sneakPeak: setting?.sneakPeak,
|
|
20
|
+
sneakPeakType: setting?.sneakPeakType,
|
|
21
|
+
sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
|
|
22
|
+
sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
|
|
23
|
+
}))),
|
|
24
|
+
...core.makeStyleResponsive('maxw', core.makeWidth(getWidthForCarouselItem({
|
|
25
|
+
spacing: setting?.spacing,
|
|
26
|
+
slidesToShow: setting?.slidesToShow,
|
|
27
|
+
sneakPeak: setting?.sneakPeak,
|
|
28
|
+
sneakPeakType: setting?.sneakPeakType,
|
|
29
|
+
sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
|
|
30
|
+
sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
|
|
31
|
+
})))
|
|
32
|
+
};
|
|
33
|
+
result = {
|
|
34
|
+
...result,
|
|
35
|
+
...className
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
const getSlideToShow = (setting)=>{
|
|
42
|
+
const result = {};
|
|
43
|
+
DEVICES.forEach((device)=>{
|
|
44
|
+
const enableSneakPeak = core.getResponsiveValueByScreen(setting.sneakPeak, device);
|
|
45
|
+
const offset = enableSneakPeak ? core.getResponsiveValueByScreen(setting.sneakPeakType, device) === 'center' ? core.getResponsiveValueByScreen(setting.sneakPeakOffsetCenter, device) ?? 0 : core.getResponsiveValueByScreen(setting.sneakPeakOffsetForward, device) ?? 0 : 0;
|
|
46
|
+
const itemNumberByDevice = core.getResponsiveValueByScreen(setting.slidesToShow, device) || 1;
|
|
47
|
+
const rx = core.getResponsiveValueByScreen(setting.sneakPeakType, device) === 'center' ? -2 : -1;
|
|
48
|
+
result[device] = itemNumberByDevice === 'auto' ? itemNumberByDevice : itemNumberByDevice + offset / 100 * rx;
|
|
49
|
+
});
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
const getCarouselSneakPeakTranslate = (setting)=>{
|
|
53
|
+
let result = {};
|
|
54
|
+
DEVICES.forEach((device)=>{
|
|
55
|
+
const spacing = helpers.convertUnitToNumber(core.getResponsiveValueByScreen(setting.spacing, device), 44);
|
|
56
|
+
const sneakPeak = core.getResponsiveValueByScreen(setting.sneakPeak, device, false);
|
|
57
|
+
const sneakPeakType = core.getResponsiveValueByScreen(setting.sneakPeakType, device);
|
|
58
|
+
const slidesToShow = helpers.convertUnitToNumber(core.getResponsiveValueByScreen(sneakPeak ? getSlideToShow({
|
|
59
|
+
slidesToShow: setting?.slidesToShow,
|
|
60
|
+
sneakPeak: setting?.sneakPeak,
|
|
61
|
+
sneakPeakType: setting?.sneakPeakType,
|
|
62
|
+
sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
|
|
63
|
+
sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
|
|
64
|
+
}) : setting.slidesToShow, device), 4);
|
|
65
|
+
const offset = 1.5;
|
|
66
|
+
const itemSpacing = spacing * ((setting.index ?? 0) + 1);
|
|
67
|
+
const itemWidth = `100% / ${slidesToShow} - ${(slidesToShow - 1) * spacing / slidesToShow}px + ${itemSpacing}px`;
|
|
68
|
+
result = {
|
|
69
|
+
...result,
|
|
70
|
+
[device]: sneakPeak && sneakPeakType === 'center' && setting.index === 0 ? `calc((${itemWidth}) * ${offset} - (${itemWidth}))` : `0px`
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
return result;
|
|
74
|
+
};
|
|
75
|
+
const getWidthForCarouselItem = (setting)=>{
|
|
76
|
+
let result = {};
|
|
77
|
+
DEVICES.forEach((device)=>{
|
|
78
|
+
const spacing = helpers.convertUnitToNumber(core.getResponsiveValueByScreen(setting.spacing, device), 44);
|
|
79
|
+
const sneakPeak = core.getResponsiveValueByScreen(setting.sneakPeak, device, false);
|
|
80
|
+
const slidesToShow = helpers.convertUnitToNumber(core.getResponsiveValueByScreen(sneakPeak ? getSlideToShow({
|
|
81
|
+
slidesToShow: setting?.slidesToShow,
|
|
82
|
+
sneakPeak: setting?.sneakPeak,
|
|
83
|
+
sneakPeakType: setting?.sneakPeakType,
|
|
84
|
+
sneakPeakOffsetCenter: setting?.sneakPeakOffsetCenter,
|
|
85
|
+
sneakPeakOffsetForward: setting?.sneakPeakOffsetForward
|
|
86
|
+
}) : setting.slidesToShow, device), 4);
|
|
87
|
+
result = {
|
|
88
|
+
...result,
|
|
89
|
+
[device]: `calc(100% / ${slidesToShow} - ${(slidesToShow - 1) * spacing / slidesToShow}px)`
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
return result;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.getCarouselSneakPeakTranslate = getCarouselSneakPeakTranslate;
|
|
96
|
+
exports.getInitialWidthForCarouselItem = getInitialWidthForCarouselItem;
|
|
97
|
+
exports.getSlideToShow = getSlideToShow;
|
|
98
|
+
exports.getWidthForCarouselItem = getWidthForCarouselItem;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
const useTrackPreviewPause = (runPreview)=>{
|
|
8
|
+
const trackerRef = React.useRef(undefined);
|
|
9
|
+
const [isFirstPreviewClicked, setIsFirstPreviewClicked] = React.useState(false);
|
|
10
|
+
React.useEffect(()=>{
|
|
11
|
+
if (isFirstPreviewClicked) return;
|
|
12
|
+
if (!trackerRef.current) {
|
|
13
|
+
trackerRef.current = JSON.stringify({
|
|
14
|
+
isFirstPreviewClicked,
|
|
15
|
+
runPreview
|
|
16
|
+
});
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!isFirstPreviewClicked && trackerRef.current !== JSON.stringify({
|
|
20
|
+
isFirstPreviewClicked,
|
|
21
|
+
runPreview
|
|
22
|
+
})) {
|
|
23
|
+
setIsFirstPreviewClicked(true);
|
|
24
|
+
}
|
|
25
|
+
}, [
|
|
26
|
+
isFirstPreviewClicked,
|
|
27
|
+
runPreview
|
|
28
|
+
]);
|
|
29
|
+
return {
|
|
30
|
+
isFirstPreviewClicked
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
exports.default = useTrackPreviewPause;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
// Easing formula from https://easings.net/#
|
|
6
|
+
const CAROUSEL_ANIMATION = {
|
|
7
|
+
EASE_IN: {
|
|
8
|
+
value: 'ease-in',
|
|
9
|
+
formula: (t)=>t * t * t
|
|
10
|
+
},
|
|
11
|
+
EASE_OUT: {
|
|
12
|
+
value: 'ease-out',
|
|
13
|
+
formula: (t)=>1 - Math.pow(1 - t, 3)
|
|
14
|
+
},
|
|
15
|
+
EASE_IN_OUT: {
|
|
16
|
+
value: 'ease-in-out',
|
|
17
|
+
formula: (t)=>t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2
|
|
18
|
+
},
|
|
19
|
+
DEFAULT: {
|
|
20
|
+
value: 'default',
|
|
21
|
+
formula: (t)=>1 + --t * t * t * t * t
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const DEFAULT_PLAY_SPEED = 500;
|
|
25
|
+
const AnimationPlugin = (slider)=>{
|
|
26
|
+
let timeout;
|
|
27
|
+
let previousAnimation = slider.options.animation ?? {};
|
|
28
|
+
slider.on('beforeOptionsChanged', (newOption)=>{
|
|
29
|
+
clearTimeout(timeout);
|
|
30
|
+
timeout = setTimeout(()=>{
|
|
31
|
+
if (newOption.options.animation && JSON.stringify(newOption.options.animation) !== JSON.stringify(previousAnimation)) {
|
|
32
|
+
previousAnimation = newOption.options.animation;
|
|
33
|
+
slider.update(newOption.options);
|
|
34
|
+
}
|
|
35
|
+
}, 200);
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.AnimationPlugin = AnimationPlugin;
|
|
40
|
+
exports.CAROUSEL_ANIMATION = CAROUSEL_ANIMATION;
|
|
41
|
+
exports.DEFAULT_PLAY_SPEED = DEFAULT_PLAY_SPEED;
|
|
42
|
+
exports.default = AnimationPlugin;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const AutoPlayPlugin = (slider)=>{
|
|
4
|
+
let autoplay = slider.options.autoplay ?? {};
|
|
5
|
+
let timeout;
|
|
6
|
+
let mouseOver = false;
|
|
7
|
+
let inViewport = false;
|
|
8
|
+
let observer = null;
|
|
9
|
+
// Thêm sự kiện cho dot nếu có
|
|
10
|
+
const $dots = slider?.container?.closest('[data-component-type="component"]')?.querySelector('.carousel-dots');
|
|
11
|
+
// Callback của IntersectionObserver
|
|
12
|
+
function handleIntersection(entries) {
|
|
13
|
+
entries.forEach((entry)=>{
|
|
14
|
+
// Với threshold 0, chỉ cần một phần bất kỳ hiển thị sẽ đánh dấu isIntersecting
|
|
15
|
+
inViewport = entry.isIntersecting;
|
|
16
|
+
if (inViewport) {
|
|
17
|
+
nextTimeout();
|
|
18
|
+
} else {
|
|
19
|
+
clearNextTimeout();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function initIntersectionObserver() {
|
|
24
|
+
// Nếu đã có observer hoặc không có container thì không khởi tạo lại
|
|
25
|
+
if (observer || !slider.container) return;
|
|
26
|
+
observer = new IntersectionObserver(handleIntersection, {
|
|
27
|
+
root: null,
|
|
28
|
+
threshold: 0
|
|
29
|
+
});
|
|
30
|
+
observer.observe(slider.container);
|
|
31
|
+
}
|
|
32
|
+
function clearNextTimeout() {
|
|
33
|
+
clearTimeout(timeout);
|
|
34
|
+
}
|
|
35
|
+
function nextTimeout() {
|
|
36
|
+
clearNextTimeout();
|
|
37
|
+
timeout = setTimeout(()=>{
|
|
38
|
+
// Nếu đang hover, autoplay bị tắt hoặc slider không trong viewport thì không chuyển slide
|
|
39
|
+
if (mouseOver || !autoplay.enable || !inViewport) return;
|
|
40
|
+
slider.next();
|
|
41
|
+
}, autoplay.delay ?? 2000);
|
|
42
|
+
}
|
|
43
|
+
function onMouseOver() {
|
|
44
|
+
mouseOver = true;
|
|
45
|
+
clearNextTimeout();
|
|
46
|
+
}
|
|
47
|
+
function onMouseOut() {
|
|
48
|
+
mouseOver = false;
|
|
49
|
+
nextTimeout();
|
|
50
|
+
}
|
|
51
|
+
slider.on('created', ()=>{
|
|
52
|
+
$dots?.addEventListener('mouseover', onMouseOver);
|
|
53
|
+
$dots?.addEventListener('mouseout', onMouseOut);
|
|
54
|
+
// Nếu tùy chọn pauseOnHover bật thì thêm sự kiện hover cho container slider
|
|
55
|
+
if (autoplay.pauseOnHover && slider.container) {
|
|
56
|
+
slider.container.addEventListener('mouseover', onMouseOver);
|
|
57
|
+
slider.container.addEventListener('mouseout', onMouseOut);
|
|
58
|
+
}
|
|
59
|
+
if (autoplay.enable) {
|
|
60
|
+
initIntersectionObserver();
|
|
61
|
+
nextTimeout();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
slider.on('dragStarted', clearNextTimeout);
|
|
65
|
+
slider.on('animationEnded', nextTimeout);
|
|
66
|
+
slider.on('updated', (newOptions)=>{
|
|
67
|
+
autoplay = newOptions.options?.autoplay ?? {};
|
|
68
|
+
if (autoplay.enable) {
|
|
69
|
+
initIntersectionObserver();
|
|
70
|
+
nextTimeout();
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
slider.on('optionsChanged', (newOptions)=>{
|
|
74
|
+
if (newOptions.options.autoplay?.pauseOnHover !== autoplay.pauseOnHover && slider.container) {
|
|
75
|
+
if (newOptions.options.autoplay?.pauseOnHover) {
|
|
76
|
+
slider.container.addEventListener('mouseover', onMouseOver);
|
|
77
|
+
slider.container.addEventListener('mouseout', onMouseOut);
|
|
78
|
+
} else {
|
|
79
|
+
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
80
|
+
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
81
|
+
mouseOver = false;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
autoplay = newOptions.options.autoplay ?? {};
|
|
85
|
+
if (autoplay.enable) {
|
|
86
|
+
initIntersectionObserver();
|
|
87
|
+
nextTimeout();
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
slider.on('destroyed', ()=>{
|
|
91
|
+
if (slider.container) {
|
|
92
|
+
slider.container.removeEventListener('mouseover', onMouseOver);
|
|
93
|
+
slider.container.removeEventListener('mouseout', onMouseOut);
|
|
94
|
+
}
|
|
95
|
+
$dots?.removeEventListener('mouseover', onMouseOver);
|
|
96
|
+
$dots?.removeEventListener('mouseout', onMouseOut);
|
|
97
|
+
clearNextTimeout();
|
|
98
|
+
if (observer) {
|
|
99
|
+
observer.disconnect();
|
|
100
|
+
observer = null;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
exports.AutoPlayPlugin = AutoPlayPlugin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
//Solution from https://github.com/rcbyr/keen-slider/issues/255
|
|
4
|
+
const FixSliderMoveBackwards = (slider)=>{
|
|
5
|
+
slider.on('animationEnded', (slider)=>{
|
|
6
|
+
const { rel, progress } = slider.track.details;
|
|
7
|
+
if (rel === 0 && progress !== 0) {
|
|
8
|
+
slider.moveToIdx(0, true, {
|
|
9
|
+
duration: 0
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.FixSliderMoveBackwards = FixSliderMoveBackwards;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const MutationPlugin = (slider)=>{
|
|
4
|
+
const observer = new MutationObserver((mutations)=>{
|
|
5
|
+
mutations.forEach(()=>{
|
|
6
|
+
slider.update();
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
const config = {
|
|
10
|
+
childList: true
|
|
11
|
+
};
|
|
12
|
+
const resizeObserver = new ResizeObserver(function() {
|
|
13
|
+
resetStyleOfSlides(slider);
|
|
14
|
+
slider.update();
|
|
15
|
+
});
|
|
16
|
+
const resetStyleOfSlides = (slider)=>{
|
|
17
|
+
if (slider.options.vertical) {
|
|
18
|
+
removeMinMaxWidthOfSlides(slider);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
removeMinMaxHeightOfSlides(slider);
|
|
22
|
+
};
|
|
23
|
+
const removeMinMaxWidthOfSlides = (slider)=>{
|
|
24
|
+
slider.slides.forEach((slide)=>{
|
|
25
|
+
slide.style.maxWidth = '';
|
|
26
|
+
slide.style.minWidth = '';
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
const removeMinMaxHeightOfSlides = (slider)=>{
|
|
30
|
+
slider.slides.forEach((slide)=>{
|
|
31
|
+
slide.style.maxHeight = '';
|
|
32
|
+
slide.style.minHeight = '';
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
slider.on('created', ()=>{
|
|
36
|
+
resizeObserver.observe(slider.container);
|
|
37
|
+
observer.observe(slider.container, config);
|
|
38
|
+
});
|
|
39
|
+
slider.on('destroyed', ()=>{
|
|
40
|
+
resizeObserver.unobserve(slider.container);
|
|
41
|
+
observer.disconnect();
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
exports.MutationPlugin = MutationPlugin;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var core = require('@gem-sdk/core');
|
|
8
|
+
var common = require('./common/common.js');
|
|
9
|
+
var getClass = require('./common/getClass.js');
|
|
10
|
+
var getStyle = require('./common/getStyle.js');
|
|
11
|
+
var useDotsSetting = require('./hook/useDotsSetting.js');
|
|
12
|
+
var system = require('@gem-sdk/system');
|
|
13
|
+
|
|
14
|
+
const Dots = (props)=>{
|
|
15
|
+
const { onHandleClick, dotSize, dotActiveColor, dotColor } = props;
|
|
16
|
+
const { isLoop, checkIsActive } = useDotsSetting.useDotsSetting(props);
|
|
17
|
+
const { checkHidden, getDotItems } = common.getData(props);
|
|
18
|
+
const dotItems = getDotItems(isLoop);
|
|
19
|
+
const { dotClass } = getClass.getDotClass(props);
|
|
20
|
+
const { dotStyle } = getStyle.getDotStyle(props, 'react');
|
|
21
|
+
const renderDotItems = ()=>{
|
|
22
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
23
|
+
children: dotItems?.map((idx)=>{
|
|
24
|
+
const isActive = checkIsActive(idx);
|
|
25
|
+
return /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
26
|
+
"aria-label": "Dot",
|
|
27
|
+
onClick: ()=>{
|
|
28
|
+
onHandleClick && onHandleClick(idx, isLoop);
|
|
29
|
+
},
|
|
30
|
+
style: {
|
|
31
|
+
...core.makeStyleResponsiveByScreen('w', dotSize, 'px'),
|
|
32
|
+
...isActive ? core.getGlobalColorResponsiveStyle('bg', dotActiveColor) : core.getGlobalColorResponsiveStyle('bg', dotColor)
|
|
33
|
+
},
|
|
34
|
+
className: core.cls('gp-aspect-square gp-w-3 gp-rounded-full gp-shadow-md', {
|
|
35
|
+
'gem-slider-dot-active': isActive,
|
|
36
|
+
'gem-slider-dot-inactive': !isActive
|
|
37
|
+
})
|
|
38
|
+
}, idx);
|
|
39
|
+
})
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
43
|
+
children: system.If(!checkHidden(dotItems), /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
44
|
+
className: dotClass,
|
|
45
|
+
style: dotStyle,
|
|
46
|
+
children: renderDotItems()
|
|
47
|
+
}))
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.default = Dots;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@gem-sdk/core');
|
|
6
|
+
var getClass = require('./common/getClass.js');
|
|
7
|
+
var getStyle = require('./common/getStyle.js');
|
|
8
|
+
var system = require('@gem-sdk/system');
|
|
9
|
+
var common = require('./common/common.js');
|
|
10
|
+
|
|
11
|
+
const Dots = (props)=>{
|
|
12
|
+
const isLoop = core.getResponsiveValueByScreen(props.loop, 'desktop', false);
|
|
13
|
+
const { checkHidden, getDotItems } = common.getData(props);
|
|
14
|
+
const dotItems = getDotItems(isLoop);
|
|
15
|
+
const { dotClass } = getClass.getDotClass(props);
|
|
16
|
+
const { dotStyle } = getStyle.getDotStyle(props);
|
|
17
|
+
return core.template`
|
|
18
|
+
${system.If(!checkHidden(dotItems), core.template`
|
|
19
|
+
<div class="${dotClass}" style="${dotStyle}">
|
|
20
|
+
<!-- item render by js -->
|
|
21
|
+
</div>
|
|
22
|
+
`)}
|
|
23
|
+
`;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
exports.default = Dots;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getData = (props)=>{
|
|
6
|
+
const { hiddenWhenOnlyOne } = props;
|
|
7
|
+
const getDotItems = (isLoop)=>{
|
|
8
|
+
const { enabledSneakPeak, totalSlideItem = 0, numberOfFullWidthShow = 0, slideItemsPerPage = 0 } = props;
|
|
9
|
+
if (enabledSneakPeak) {
|
|
10
|
+
return Array.from({
|
|
11
|
+
length: isLoop ? totalSlideItem : totalSlideItem - numberOfFullWidthShow + 1
|
|
12
|
+
}, (_, i)=>i);
|
|
13
|
+
} else {
|
|
14
|
+
return Array.from({
|
|
15
|
+
length: isLoop ? totalSlideItem : Math.ceil(totalSlideItem / slideItemsPerPage)
|
|
16
|
+
}, (_, i)=>i);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const checkHidden = (totalDots)=>{
|
|
20
|
+
return hiddenWhenOnlyOne && totalDots?.length < 2;
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
checkHidden,
|
|
24
|
+
getDotItems
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.getData = getData;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var system = require('@gem-sdk/system');
|
|
5
|
+
var index = require('../../components/const/index.js');
|
|
6
|
+
|
|
7
|
+
const getDotClass = (props)=>{
|
|
8
|
+
const { dotStyle, vertical, className, uniqueComponentId } = props;
|
|
9
|
+
const getDisplayClass = ()=>{
|
|
10
|
+
const devices = [
|
|
11
|
+
'desktop',
|
|
12
|
+
'tablet',
|
|
13
|
+
'mobile'
|
|
14
|
+
];
|
|
15
|
+
const result = {};
|
|
16
|
+
devices.forEach((device)=>{
|
|
17
|
+
const dotStyleSetting = core.getResponsiveValueByScreen(dotStyle, device);
|
|
18
|
+
const verticalSetting = core.getResponsiveValueByScreen(vertical, device);
|
|
19
|
+
const deviceType = device === 'desktop' ? '' : `${device}:`;
|
|
20
|
+
result[`${deviceType}gp-absolute`] = dotStyleSetting === 'inside';
|
|
21
|
+
result[`${deviceType}gp-static`] = dotStyleSetting !== 'inside';
|
|
22
|
+
result[`${deviceType}gp-flex-row ${deviceType}gp-left-0 ${deviceType}gp-right-0`] = !verticalSetting;
|
|
23
|
+
result[`${deviceType}gp-flex-col ${deviceType}gp-ml-2 ${deviceType}gp-w-fit ${deviceType}gp-h-full`] = !!verticalSetting;
|
|
24
|
+
});
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
const dotClass = system.createClass({
|
|
28
|
+
[`${index.DOT_CONTAINER_SELECTOR} ${index.DOT_CONTAINER_SELECTOR}-${uniqueComponentId}`]: true,
|
|
29
|
+
['gp-z-2 gp-flex gp-flex-1 gp-items-center gp-justify-center gp-gap-2 gp-text-center']: true,
|
|
30
|
+
...className && {
|
|
31
|
+
[className]: true
|
|
32
|
+
},
|
|
33
|
+
...getDisplayClass()
|
|
34
|
+
});
|
|
35
|
+
return {
|
|
36
|
+
dotClass
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
exports.getDotClass = getDotClass;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var system = require('@gem-sdk/system');
|
|
4
|
+
var core = require('@gem-sdk/core');
|
|
5
|
+
|
|
6
|
+
const getDotStyle = (props, componentType)=>{
|
|
7
|
+
const { dotStyle: style, dotGapToCarousel, vertical } = props;
|
|
8
|
+
const isReactComp = componentType === 'react';
|
|
9
|
+
const getStyleDisplayDots = ()=>{
|
|
10
|
+
const devices = [
|
|
11
|
+
'desktop',
|
|
12
|
+
'tablet',
|
|
13
|
+
'mobile'
|
|
14
|
+
];
|
|
15
|
+
const result = {};
|
|
16
|
+
devices.forEach((device)=>{
|
|
17
|
+
const dotStyleSetting = core.getResponsiveValueByScreen(style, device);
|
|
18
|
+
const deviceType = device === 'desktop' ? '' : `${device}`;
|
|
19
|
+
result[`--d${deviceType.length === 0 ? '' : '-' + deviceType}`] = dotStyleSetting && dotStyleSetting !== 'none' ? 'flex' : 'none';
|
|
20
|
+
});
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
const dotStyleObj = {
|
|
24
|
+
...core.makeDotGapToCarouselStyle(style, dotGapToCarousel, vertical),
|
|
25
|
+
...getStyleDisplayDots()
|
|
26
|
+
};
|
|
27
|
+
const dotStyle = isReactComp ? system.createStyleReact(dotStyleObj) : system.createStyle(dotStyleObj);
|
|
28
|
+
return {
|
|
29
|
+
dotStyle
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
exports.getDotStyle = getDotStyle;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const useDotsSetting = (props)=>{
|
|
6
|
+
const { loop, enabledSneakPeak, slideItemsPerPage = 1, currentSlide = 1 } = props;
|
|
7
|
+
const currentDevice = core.useCurrentDevice();
|
|
8
|
+
const isLoop = core.getResponsiveValueByScreen(loop, currentDevice, false);
|
|
9
|
+
const checkIsActive = (idx)=>{
|
|
10
|
+
if (enabledSneakPeak) {
|
|
11
|
+
return idx === currentSlide;
|
|
12
|
+
}
|
|
13
|
+
return idx === (isLoop ? currentSlide : Math.ceil(currentSlide / slideItemsPerPage));
|
|
14
|
+
};
|
|
15
|
+
return {
|
|
16
|
+
isLoop,
|
|
17
|
+
checkIsActive
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.useDotsSetting = useDotsSetting;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
require('react/jsx-runtime');
|
|
4
|
+
require('@gem-sdk/core');
|
|
5
|
+
require('react');
|
|
6
|
+
require('@gem-sdk/system');
|
|
7
|
+
require('@gem-sdk/keen-slider/react');
|
|
8
|
+
require('next/link');
|
|
9
|
+
var Swiper$1 = require('./setting/Swiper.js');
|
|
10
|
+
var SwiperItem$1 = require('./setting/SwiperItem.js');
|
|
11
|
+
|
|
12
|
+
const swiperCarouselSetting = {
|
|
13
|
+
SwiperCarousel: Swiper$1.default,
|
|
14
|
+
SwiperCarouselItem: SwiperItem$1.default
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.swiperCarouselSetting = swiperCarouselSetting;
|