@gem-sdk/components 2.0.0-dev.742 → 2.0.0-dev.745
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/breadcrumb/components/templates/home.js +2 -1
- package/dist/cjs/breadcrumb/settings/Breadcrumb.js +8 -1
- package/dist/cjs/builder.js +2 -2
- package/dist/cjs/carousel/components/item/CarouselItem.js +2 -1
- package/dist/cjs/carousel/components/root/Carousel.liquid.js +3 -3
- package/dist/cjs/carousel/components/root/CarouselWithSwiper.js +131 -0
- package/dist/cjs/carousel/components/root/CustomSwiper.js +62 -0
- package/dist/cjs/carousel/components/root/common/classes.js +2 -2
- package/dist/cjs/carousel/components/root/common/styles.js +2 -0
- package/dist/cjs/carousel/components/root/load-swiper.js +32 -0
- package/dist/cjs/carousel/hooks/useCarouselWithSwiper.js +343 -0
- package/dist/cjs/carousel/index.js +2 -3
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/product/components/product-images/ProductGalleryCarousel.js +2 -2
- package/dist/cjs/product/components/product-images/ProductImagesLightBox.js +2 -2
- package/dist/cjs/product/components/product-images-v2/ProductImagesV2.liquid.js +3 -3
- package/dist/cjs/product/components/product-images-v2/components/child/ProductFeaturedImageCarousel.js +2 -2
- package/dist/cjs/product/components/product-images-v2/components/gallery-carousel/GalleryCarousel.js +2 -2
- package/dist/cjs/product/components/product-images-v2/components/lightbox/ProductImagesLightBox.js +2 -2
- package/dist/cjs/product/components/product-list/ProductListCarouselLayout.js +2 -2
- package/dist/cjs/product/index.js +0 -1
- package/dist/esm/breadcrumb/components/templates/home.js +2 -1
- package/dist/esm/breadcrumb/settings/Breadcrumb.js +8 -1
- package/dist/esm/builder.js +2 -2
- package/dist/esm/carousel/components/item/CarouselItem.js +2 -1
- package/dist/esm/carousel/components/root/Carousel.liquid.js +3 -3
- package/dist/esm/carousel/components/root/CarouselWithSwiper.js +127 -0
- package/dist/esm/carousel/components/root/CustomSwiper.js +59 -0
- package/dist/esm/carousel/components/root/common/classes.js +2 -2
- package/dist/esm/carousel/components/root/common/styles.js +2 -0
- package/dist/esm/carousel/components/root/load-swiper.js +3 -0
- package/dist/esm/carousel/hooks/useCarouselWithSwiper.js +341 -0
- package/dist/esm/carousel/index.js +0 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/product/components/product-images/ProductGalleryCarousel.js +2 -2
- package/dist/esm/product/components/product-images/ProductImagesLightBox.js +2 -2
- package/dist/esm/product/components/product-images-v2/ProductImagesV2.liquid.js +3 -3
- package/dist/esm/product/components/product-images-v2/components/child/ProductFeaturedImageCarousel.js +2 -2
- package/dist/esm/product/components/product-images-v2/components/gallery-carousel/GalleryCarousel.js +2 -2
- package/dist/esm/product/components/product-images-v2/components/lightbox/ProductImagesLightBox.js +2 -2
- package/dist/esm/product/components/product-list/ProductListCarouselLayout.js +2 -2
- package/dist/esm/product/index.js +0 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +2 -2
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var core = require('@gem-sdk/core');
|
|
4
|
+
var helpers = require('../../../helpers.js');
|
|
4
5
|
|
|
5
6
|
const BreadcrumbHomeTemplate = ({ composePageClasses, breadcrumbChildItemStyles })=>{
|
|
6
7
|
return core.template`
|
|
7
8
|
<a class="${composePageClasses}" style="${breadcrumbChildItemStyles}" href="{{ routes.root_url }}">
|
|
8
|
-
|
|
9
|
+
${helpers.getStaticLocale('Breadcrumb', 'home')}
|
|
9
10
|
</a>`;
|
|
10
11
|
};
|
|
11
12
|
|
package/dist/cjs/builder.js
CHANGED
|
@@ -136,7 +136,7 @@ var ArticleReadMore = require('./article/components/ArticleReadMore.js');
|
|
|
136
136
|
var HeroBanner = require('./hero-banner/components/HeroBanner.js');
|
|
137
137
|
var Breadcrumb = require('./breadcrumb/components/Breadcrumb.js');
|
|
138
138
|
var Button = require('./button/components/Button.js');
|
|
139
|
-
var
|
|
139
|
+
var CarouselWithSwiper = require('./carousel/components/root/CarouselWithSwiper.js');
|
|
140
140
|
var CarouselItem = require('./carousel/components/item/CarouselItem.js');
|
|
141
141
|
var Cart = require('./cart/components/Cart.js');
|
|
142
142
|
var CartList = require('./cart/components/CartList.js');
|
|
@@ -284,7 +284,7 @@ var builder = {
|
|
|
284
284
|
HeroBanner: HeroBanner.default,
|
|
285
285
|
Breadcrumb: Breadcrumb.default,
|
|
286
286
|
Button: Button.default,
|
|
287
|
-
Carousel:
|
|
287
|
+
Carousel: CarouselWithSwiper.default,
|
|
288
288
|
CarouselItem: CarouselItem.default,
|
|
289
289
|
Cart: Cart.default,
|
|
290
290
|
CartList: CartList.default,
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
|
+
var CustomSwiper = require('../root/CustomSwiper.js');
|
|
8
9
|
var styles = require('./common/styles.js');
|
|
9
10
|
var classes = require('./common/classes.js');
|
|
10
11
|
var useCarouseItem = require('../../hooks/useCarouseItem.js');
|
|
@@ -15,7 +16,7 @@ const CarouselItem = (props)=>{
|
|
|
15
16
|
const { handleClick, handleMouseMove, handleMouseOut } = useCarouseItem.useCarouselItem(props);
|
|
16
17
|
const { carouselItemStyle, carouselItemInnerStyle } = styles.getStyle(props);
|
|
17
18
|
const { carouselItemClass, carouselItemInnerClass } = classes.getClass(props);
|
|
18
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
19
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CustomSwiper.SwiperSlide, {
|
|
19
20
|
...builderAttrs,
|
|
20
21
|
"aria-hidden": true,
|
|
21
22
|
className: carouselItemClass,
|
|
@@ -25,7 +25,7 @@ const Carousel = (props)=>{
|
|
|
25
25
|
const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle, sliderStyle } = styles.getStyle(renderData);
|
|
26
26
|
const { rootAttrRender, sliderAttr } = attrs.getAttr(renderData);
|
|
27
27
|
const renderJS = ()=>{
|
|
28
|
-
return core.RenderIf(core.isLocalEnv, `<script ${helpers$2.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-carousel-
|
|
28
|
+
return core.RenderIf(core.isLocalEnv, `<script ${helpers$2.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-carousel-v3.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers$2.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-carousel-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
|
|
29
29
|
};
|
|
30
30
|
const renderArrow = (position)=>{
|
|
31
31
|
const isNext = position === 'next';
|
|
@@ -77,9 +77,9 @@ const Carousel = (props)=>{
|
|
|
77
77
|
class="${wrapperClassRender}"
|
|
78
78
|
style="${wrapperStyleRender}"
|
|
79
79
|
>
|
|
80
|
-
<div class="${wrapperInnerClass}" style="${wrapperInnerStyle}">
|
|
80
|
+
<div ${sliderAttr} class="${wrapperInnerClass}" style="${wrapperInnerStyle}">
|
|
81
81
|
${renderArrow('prev')}
|
|
82
|
-
<div
|
|
82
|
+
<div class="${sliderClass}" style="${sliderStyle}">
|
|
83
83
|
${renderChildren()}
|
|
84
84
|
</div>
|
|
85
85
|
${renderArrow('next')}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 React = require('react');
|
|
9
|
+
var helpers = require('../arrow/common/helpers.js');
|
|
10
|
+
var useCarouselWithSwiper = require('../../hooks/useCarouselWithSwiper.js');
|
|
11
|
+
var helpers$1 = require('./common/helpers.js');
|
|
12
|
+
var classes = require('./common/classes.js');
|
|
13
|
+
var styles = require('./common/styles.js');
|
|
14
|
+
var attrs = require('./common/attrs.js');
|
|
15
|
+
var Arrow = require('../arrow/Arrow.js');
|
|
16
|
+
var Dots = require('../dot/Dots.js');
|
|
17
|
+
var CustomSwiper = require('./CustomSwiper.js');
|
|
18
|
+
|
|
19
|
+
const CarouselWithSwiper = /*#__PURE__*/ React.forwardRef((props, ref)=>{
|
|
20
|
+
const { children, builderAttrs, builderProps, styles: styles$1, isHiddenArrowWhenDisabled = true, hiddenDotWhenOnlyOne, elmRef } = props;
|
|
21
|
+
const setting = helpers.mappingNavigationCarousel(props.setting);
|
|
22
|
+
const renderData = {
|
|
23
|
+
...props,
|
|
24
|
+
setting
|
|
25
|
+
};
|
|
26
|
+
const [swiperInstance, setSwiperInstance] = React.useState(null);
|
|
27
|
+
const { arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', roundedArrow, arrowIconSize, arrowCustomColor, arrowBorder, arrowShadow, showWhenHover } = setting ?? {};
|
|
28
|
+
const { isInfinity, localRef, sliderSettings, totalSlideItem, currentSlide, isRenderDots, showNavigation, handleDotClick, getItemsPerPage, handleNextAndPrevSlide, dispatchEventSelectSlide, getNumberOfFullWidthShow } = useCarouselWithSwiper.useCarouselWithSwiper(renderData, ref, swiperInstance);
|
|
29
|
+
const { loopConfig, arrowShowConfig } = helpers$1.getData(renderData);
|
|
30
|
+
const { rootClassRender, wrapperClassRender, wrapperInnerClass, sliderClass } = classes.getClass(renderData);
|
|
31
|
+
const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle } = styles.getStyle(renderData);
|
|
32
|
+
const { rootAttrRender, sliderAttr } = attrs.getAttr(renderData);
|
|
33
|
+
const currentDevice = core.useCurrentDevice();
|
|
34
|
+
const enabledSneakPeak = setting?.sneakPeak?.[currentDevice];
|
|
35
|
+
const renderArrow = (position)=>{
|
|
36
|
+
const isNext = position === 'next';
|
|
37
|
+
const slidesPerView = getItemsPerPage();
|
|
38
|
+
const isDisable = isNext ? !isInfinity && currentSlide >= totalSlideItem - Math.floor(slidesPerView) : !isInfinity && currentSlide === 0;
|
|
39
|
+
return /*#__PURE__*/ jsxRuntime.jsx(Arrow.default, {
|
|
40
|
+
uid: builderProps?.uid,
|
|
41
|
+
custom: setting?.arrowCustom ?? '',
|
|
42
|
+
showArrow: arrowShowConfig,
|
|
43
|
+
arrowButtonSize: arrowButtonSize || {},
|
|
44
|
+
arrowIconSize: arrowIconSize || {},
|
|
45
|
+
arrowBackgroundColor: arrowBackgroundColor || '',
|
|
46
|
+
arrowCustomColor: arrowCustomColor,
|
|
47
|
+
gapToEachSize: arrowGapToEachSide,
|
|
48
|
+
showWhenHover: showWhenHover,
|
|
49
|
+
arrowBorder: arrowBorder || {},
|
|
50
|
+
arrowCorner: roundedArrow || {},
|
|
51
|
+
arrowShadow: arrowShadow || {},
|
|
52
|
+
onClick: (e)=>{
|
|
53
|
+
e.stopPropagation();
|
|
54
|
+
handleNextAndPrevSlide(position);
|
|
55
|
+
},
|
|
56
|
+
left: !isNext,
|
|
57
|
+
disabled: isDisable,
|
|
58
|
+
vertical: setting?.vertical,
|
|
59
|
+
isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
|
|
60
|
+
rootId: props?.parentClass
|
|
61
|
+
});
|
|
62
|
+
};
|
|
63
|
+
const handleSliderReady = React.useCallback((swiper)=>{
|
|
64
|
+
setSwiperInstance(swiper);
|
|
65
|
+
}, []);
|
|
66
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
67
|
+
ref: elmRef,
|
|
68
|
+
...rootAttrRender,
|
|
69
|
+
className: rootClassRender,
|
|
70
|
+
style: rootStyleRender,
|
|
71
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
72
|
+
ref: localRef,
|
|
73
|
+
...builderAttrs,
|
|
74
|
+
className: wrapperClassRender,
|
|
75
|
+
style: wrapperStyleRender,
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
78
|
+
className: wrapperInnerClass,
|
|
79
|
+
style: wrapperInnerStyle,
|
|
80
|
+
children: [
|
|
81
|
+
showNavigation && renderArrow('prev'),
|
|
82
|
+
/*#__PURE__*/ jsxRuntime.jsx(CustomSwiper.Swiper, {
|
|
83
|
+
...sliderAttr,
|
|
84
|
+
...sliderSettings,
|
|
85
|
+
sliderClass: sliderClass,
|
|
86
|
+
onSwiperReady: handleSliderReady,
|
|
87
|
+
totalSlides: totalSlideItem,
|
|
88
|
+
children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
89
|
+
children: "No Slider"
|
|
90
|
+
}) : React.Children.map(core.filterToolbarPreview(children), (child)=>{
|
|
91
|
+
if (/*#__PURE__*/ React.isValidElement(child)) {
|
|
92
|
+
return /*#__PURE__*/ jsxRuntime.jsx(child.type, {
|
|
93
|
+
...child.props,
|
|
94
|
+
parentSettings: setting,
|
|
95
|
+
parentStyle: styles$1,
|
|
96
|
+
background: setting?.background,
|
|
97
|
+
parentUid: builderProps?.uid,
|
|
98
|
+
dispatchEventSelectSlide: dispatchEventSelectSlide
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
showNavigation && renderArrow('next')
|
|
105
|
+
]
|
|
106
|
+
}),
|
|
107
|
+
isRenderDots && /*#__PURE__*/ jsxRuntime.jsx(Dots.default, {
|
|
108
|
+
dotStyle: setting?.dotStyle,
|
|
109
|
+
dotGapToCarousel: setting?.dotGapToCarousel,
|
|
110
|
+
vertical: setting?.vertical,
|
|
111
|
+
showDots: setting?.dot,
|
|
112
|
+
slideItemsPerPage: getItemsPerPage(),
|
|
113
|
+
enabledSneakPeak: enabledSneakPeak,
|
|
114
|
+
dotColor: setting?.dotColor,
|
|
115
|
+
dotActiveColor: setting?.dotActiveColor,
|
|
116
|
+
dotSize: setting?.dotSize,
|
|
117
|
+
sneakPeakType: setting?.sneakPeakType,
|
|
118
|
+
totalSlideItem: totalSlideItem,
|
|
119
|
+
hiddenWhenOnlyOne: hiddenDotWhenOnlyOne,
|
|
120
|
+
currentSlide: currentSlide,
|
|
121
|
+
loop: loopConfig,
|
|
122
|
+
numberOfFullWidthShow: getNumberOfFullWidthShow(currentDevice),
|
|
123
|
+
onHandleClick: handleDotClick
|
|
124
|
+
}),
|
|
125
|
+
core.filterToolbarPreview(children, true)
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
exports.default = CarouselWithSwiper;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function Swiper(props) {
|
|
7
|
+
const swiperRef = React.useRef(null);
|
|
8
|
+
const { children, totalSlides, onSwiperReady, sliderClass, ...sliderSetting } = props;
|
|
9
|
+
const pauseOnMouseEnter = typeof props.autoplay === 'object' && props.autoplay !== null ? props.autoplay.pauseOnMouseEnter : undefined;
|
|
10
|
+
React.useEffect(()=>{
|
|
11
|
+
const loadSwiper = async ()=>{
|
|
12
|
+
const { register } = await Promise.resolve().then(function () { return require('./load-swiper.js'); });
|
|
13
|
+
register();
|
|
14
|
+
};
|
|
15
|
+
loadSwiper();
|
|
16
|
+
Object.assign(swiperRef.current, sliderSetting);
|
|
17
|
+
swiperRef.current.initialize();
|
|
18
|
+
const instance = swiperRef.current.swiper;
|
|
19
|
+
onSwiperReady?.(instance);
|
|
20
|
+
}, []);
|
|
21
|
+
React.useEffect(()=>{
|
|
22
|
+
if (swiperRef.current?.swiper) {
|
|
23
|
+
const swiperInstance = swiperRef.current.swiper;
|
|
24
|
+
swiperInstance.destroy(true, true);
|
|
25
|
+
Object.assign(swiperRef.current, sliderSetting);
|
|
26
|
+
swiperRef.current.initialize();
|
|
27
|
+
onSwiperReady?.(swiperRef.current.swiper);
|
|
28
|
+
}
|
|
29
|
+
}, [
|
|
30
|
+
sliderSetting.dir,
|
|
31
|
+
sliderSetting.loop,
|
|
32
|
+
pauseOnMouseEnter,
|
|
33
|
+
sliderSetting.slidesPerView,
|
|
34
|
+
onSwiperReady,
|
|
35
|
+
totalSlides
|
|
36
|
+
]);
|
|
37
|
+
React.useEffect(()=>{
|
|
38
|
+
const swiperInstance = swiperRef.current?.swiper;
|
|
39
|
+
if (!swiperInstance) return;
|
|
40
|
+
Object.assign(swiperInstance.params, sliderSetting);
|
|
41
|
+
swiperInstance.update();
|
|
42
|
+
}, [
|
|
43
|
+
sliderSetting
|
|
44
|
+
]);
|
|
45
|
+
return /*#__PURE__*/ jsxRuntime.jsx("swiper-container", {
|
|
46
|
+
init: false,
|
|
47
|
+
className: sliderClass,
|
|
48
|
+
ref: swiperRef,
|
|
49
|
+
children: children
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function SwiperSlide(props) {
|
|
53
|
+
const { children, className, ...rest } = props;
|
|
54
|
+
return /*#__PURE__*/ jsxRuntime.jsx("swiper-slide", {
|
|
55
|
+
...rest,
|
|
56
|
+
className: className,
|
|
57
|
+
children: children
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
exports.Swiper = Swiper;
|
|
62
|
+
exports.SwiperSlide = SwiperSlide;
|
|
@@ -98,7 +98,7 @@ const getClass = (props)=>{
|
|
|
98
98
|
...getDisplayOfWrapper()
|
|
99
99
|
});
|
|
100
100
|
const wrapperInnerClass = system.createClass({
|
|
101
|
-
'gp-relative gp-flex gp-items-center gp-justify-between': true,
|
|
101
|
+
'gp-relative gp-overflow-hidden gp-flex gp-items-center gp-justify-between': true,
|
|
102
102
|
'!gp-h-full': fullHeight,
|
|
103
103
|
...getWrapperInnerHeight(),
|
|
104
104
|
...makeFlexColClass()
|
|
@@ -116,7 +116,7 @@ const getClass = (props)=>{
|
|
|
116
116
|
}
|
|
117
117
|
});
|
|
118
118
|
const sliderClass = system.createClass({
|
|
119
|
-
'gem-slider gp-
|
|
119
|
+
'gem-slider-wrapper gp-flex gp-content-start gp-h-full gp-select-none': true,
|
|
120
120
|
[sliderSelector]: true,
|
|
121
121
|
...slidesClass && {
|
|
122
122
|
[slidesClass]: true
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var bundle = require('swiper/element/bundle');
|
|
4
|
+
var swiper = require('swiper');
|
|
5
|
+
var modules = require('swiper/modules');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(exports, 'register', {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function () { return bundle.register; }
|
|
12
|
+
});
|
|
13
|
+
Object.defineProperty(exports, 'Swiper', {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return swiper.Swiper; }
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, 'Autoplay', {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return modules.Autoplay; }
|
|
20
|
+
});
|
|
21
|
+
Object.defineProperty(exports, 'Navigation', {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function () { return modules.Navigation; }
|
|
24
|
+
});
|
|
25
|
+
Object.defineProperty(exports, 'Pagination', {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () { return modules.Pagination; }
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, 'Thumbs', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return modules.Thumbs; }
|
|
32
|
+
});
|