@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
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var core = require('@gem-sdk/core');
|
|
5
|
+
var useTrackPreviewPause = require('./useTrackPreviewPause.js');
|
|
6
|
+
|
|
7
|
+
const useCarouselWithSwiper = (props, ref, swiperInstance)=>{
|
|
8
|
+
const { builderProps, moveToIdx, styles, setting, isHiddenArrowWhenDisabled = true, elmRef, onClickArrow, onHandleChangeSlideByInteraction } = props;
|
|
9
|
+
const { loop, navigationEnable = {
|
|
10
|
+
desktop: true
|
|
11
|
+
}, navigationStyle } = setting ?? {};
|
|
12
|
+
const [totalSlideItem, setTotalSlideItem] = React.useState(0);
|
|
13
|
+
const [currentSlide, setCurrentSlide] = React.useState(setting?.defaultCurrentSlider ?? 0);
|
|
14
|
+
const isInfinity = React.useMemo(()=>{
|
|
15
|
+
return core.getResponsiveValueByScreen(loop, 'desktop', false);
|
|
16
|
+
}, [
|
|
17
|
+
loop
|
|
18
|
+
]);
|
|
19
|
+
const { isFirstPreviewClicked } = useTrackPreviewPause.default(setting?.runPreview);
|
|
20
|
+
// const { sliderSelector } = getData(props);
|
|
21
|
+
const localRef = React.useRef();
|
|
22
|
+
// const isRunningAnimation = useRef(false);
|
|
23
|
+
const previousIndex = React.useRef(moveToIdx ?? 0);
|
|
24
|
+
const isRenderDots = React.useMemo(()=>!!totalSlideItem && swiperInstance && core.getResponsiveValueByScreen(setting?.dot), [
|
|
25
|
+
swiperInstance,
|
|
26
|
+
setting?.dot,
|
|
27
|
+
totalSlideItem
|
|
28
|
+
]);
|
|
29
|
+
let delayTimeout;
|
|
30
|
+
const currentDevice = core.useCurrentDevice();
|
|
31
|
+
const mode = core.useEditorMode();
|
|
32
|
+
const { onListener, saveToElementInteractionData, getInteractionPreviousData, trigger } = core.useInteraction();
|
|
33
|
+
const getItemNumberFromOldData = React.useCallback(()=>{
|
|
34
|
+
if (!setting?.slidesToShow) return null;
|
|
35
|
+
const result = {};
|
|
36
|
+
core.DEVICES.forEach((device)=>{
|
|
37
|
+
const value = core.getResponsiveValueByScreen(setting?.slidesToShow, device);
|
|
38
|
+
result[device] = value ? value === 'auto' ? 4 : Math.floor(value) : 0;
|
|
39
|
+
});
|
|
40
|
+
return result;
|
|
41
|
+
}, [
|
|
42
|
+
setting?.slidesToShow
|
|
43
|
+
]);
|
|
44
|
+
const getSlideToShowFromOldData = React.useCallback(()=>{
|
|
45
|
+
if (!setting?.slidesToShow) return null;
|
|
46
|
+
const result = {};
|
|
47
|
+
core.DEVICES.forEach((device)=>{
|
|
48
|
+
const value = core.getResponsiveValueByScreen(setting?.slidesToShow, device);
|
|
49
|
+
result[device] = value ? value === 'auto' ? 4 : value : 0;
|
|
50
|
+
});
|
|
51
|
+
return result;
|
|
52
|
+
}, [
|
|
53
|
+
setting?.slidesToShow
|
|
54
|
+
]);
|
|
55
|
+
const showNavigation = React.useMemo(()=>{
|
|
56
|
+
const navigationEnableByDevice = core.getResponsiveValueByScreen(navigationEnable, currentDevice);
|
|
57
|
+
const navigationStyleByDevice = core.getResponsiveValueByScreen(navigationStyle, currentDevice);
|
|
58
|
+
return swiperInstance && navigationEnableByDevice && navigationStyleByDevice !== 'none';
|
|
59
|
+
}, [
|
|
60
|
+
swiperInstance,
|
|
61
|
+
navigationEnable,
|
|
62
|
+
navigationStyle,
|
|
63
|
+
currentDevice
|
|
64
|
+
]);
|
|
65
|
+
const slidesToShow = React.useMemo(()=>{
|
|
66
|
+
const oldData = getSlideToShowFromOldData();
|
|
67
|
+
if (oldData) {
|
|
68
|
+
return oldData;
|
|
69
|
+
}
|
|
70
|
+
const result = {};
|
|
71
|
+
core.DEVICES.forEach((device)=>{
|
|
72
|
+
const enableSneakPeak = core.getResponsiveValueByScreen(setting?.sneakPeak, device);
|
|
73
|
+
const offset = enableSneakPeak ? core.getResponsiveValueByScreen(setting?.sneakPeakType, device) === 'center' ? core.getResponsiveValueByScreen(setting?.sneakPeakOffsetCenter, device) ?? 0 : core.getResponsiveValueByScreen(setting?.sneakPeakOffsetForward, device) ?? 0 : 0;
|
|
74
|
+
const rx = core.getResponsiveValueByScreen(setting?.sneakPeakType, device) === 'center' ? -2 : -1;
|
|
75
|
+
const itemNumberByDevice = core.getResponsiveValueByScreen(setting?.itemNumber, device);
|
|
76
|
+
result[device] = typeof itemNumberByDevice === 'number' ? itemNumberByDevice + offset / 100 * rx : 'auto';
|
|
77
|
+
});
|
|
78
|
+
return result;
|
|
79
|
+
}, [
|
|
80
|
+
getSlideToShowFromOldData,
|
|
81
|
+
setting?.itemNumber,
|
|
82
|
+
setting?.sneakPeak,
|
|
83
|
+
setting?.sneakPeakOffsetCenter,
|
|
84
|
+
setting?.sneakPeakOffsetForward,
|
|
85
|
+
setting?.sneakPeakType
|
|
86
|
+
]);
|
|
87
|
+
const itemNumber = React.useMemo(()=>{
|
|
88
|
+
const oldData = getItemNumberFromOldData();
|
|
89
|
+
return oldData || setting?.itemNumber;
|
|
90
|
+
}, [
|
|
91
|
+
getItemNumberFromOldData,
|
|
92
|
+
setting?.itemNumber
|
|
93
|
+
]);
|
|
94
|
+
const getNumberOfFullWidthShow = React.useCallback((device)=>{
|
|
95
|
+
const sneakPeekTypeByNumber = core.getResponsiveValueByScreen(setting?.sneakPeakType, device) === 'center' ? 2 : 1;
|
|
96
|
+
return typeof core.getResponsiveValueByScreen(itemNumber, device, 4) === 'number' ? core.getResponsiveValueByScreen(itemNumber, device, 4) - sneakPeekTypeByNumber : undefined;
|
|
97
|
+
}, [
|
|
98
|
+
setting?.sneakPeakType,
|
|
99
|
+
itemNumber
|
|
100
|
+
]);
|
|
101
|
+
const getItemsPerPage = ()=>{
|
|
102
|
+
const items = core.getResponsiveValueByScreen(slidesToShow, currentDevice, 1) === 'auto' ? 1 : core.getResponsiveValueByScreen(slidesToShow, currentDevice, 1);
|
|
103
|
+
return items ?? 1;
|
|
104
|
+
};
|
|
105
|
+
const getIndexSlideItemBy = (pageIdx)=>{
|
|
106
|
+
let indexPage = pageIdx * getItemsPerPage();
|
|
107
|
+
if (indexPage >= totalSlideItem - getItemsPerPage()) {
|
|
108
|
+
indexPage = totalSlideItem - getItemsPerPage();
|
|
109
|
+
}
|
|
110
|
+
return indexPage;
|
|
111
|
+
};
|
|
112
|
+
const getAllowTouchMove = (screen)=>{
|
|
113
|
+
const value = mode === 'edit' ? {
|
|
114
|
+
[screen]: false
|
|
115
|
+
} : setting?.enableDrag;
|
|
116
|
+
return core.getResponsiveValueByScreen(value, screen);
|
|
117
|
+
};
|
|
118
|
+
const handleDotClick = (idx, isLoop)=>{
|
|
119
|
+
const index = setting?.sneakPeak?.[currentDevice] ? idx : isLoop ? idx : getIndexSlideItemBy(idx);
|
|
120
|
+
swiperInstance?.slideToLoop(index);
|
|
121
|
+
previousIndex.current = index;
|
|
122
|
+
};
|
|
123
|
+
React.useImperativeHandle(ref, ()=>({
|
|
124
|
+
nextSlideInteraction,
|
|
125
|
+
previousSlideInteraction,
|
|
126
|
+
moveToSlideInteraction
|
|
127
|
+
}));
|
|
128
|
+
const dispatchEventSelectSlide = (index)=>{
|
|
129
|
+
trigger({
|
|
130
|
+
event: 'gp:rollback:select-slide',
|
|
131
|
+
selector: `[data-id="${builderProps?.uid}"]`,
|
|
132
|
+
element: elmRef?.current
|
|
133
|
+
});
|
|
134
|
+
trigger({
|
|
135
|
+
event: 'gp:select-slide',
|
|
136
|
+
selector: `[data-id="${builderProps?.uid}"]`,
|
|
137
|
+
data: index,
|
|
138
|
+
element: elmRef?.current
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
const moveToIdxInteraction = (idx)=>{
|
|
142
|
+
swiperInstance?.slideTo(idx);
|
|
143
|
+
onHandleChangeSlideByInteraction && onHandleChangeSlideByInteraction(idx);
|
|
144
|
+
};
|
|
145
|
+
const handleDirectionalSlide = (params, direction)=>{
|
|
146
|
+
const { key, data, isRollback, element } = params;
|
|
147
|
+
const currentIndex = Math.max(swiperInstance?.activeIndex ?? 0, 0);
|
|
148
|
+
if (isRollback && data === undefined) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (isRollback) {
|
|
152
|
+
if (direction === 'specific') {
|
|
153
|
+
const { previousData } = getInteractionPreviousData(element, key);
|
|
154
|
+
moveToIdxInteraction(Number(previousData));
|
|
155
|
+
} else {
|
|
156
|
+
// For next/previous, move in opposite direction during rollback
|
|
157
|
+
const newIndex = direction === 'next' ? currentIndex - 1 : currentIndex + 1;
|
|
158
|
+
moveToIdxInteraction(newIndex);
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
// Save current state and move to new position
|
|
163
|
+
const indexToSave = direction === 'specific' ? Math.max(previousIndex.current, 0) : currentIndex;
|
|
164
|
+
saveToElementInteractionData(element, key, indexToSave.toString());
|
|
165
|
+
const targetIndex = direction === 'specific' ? Number(data) : direction === 'next' ? currentIndex + 1 : currentIndex - 1;
|
|
166
|
+
moveToIdxInteraction(targetIndex);
|
|
167
|
+
};
|
|
168
|
+
const nextSlideInteraction = (params)=>{
|
|
169
|
+
handleDirectionalSlide(params, 'next');
|
|
170
|
+
};
|
|
171
|
+
const previousSlideInteraction = (params)=>{
|
|
172
|
+
handleDirectionalSlide(params, 'previous');
|
|
173
|
+
};
|
|
174
|
+
const moveToSlideInteraction = (params)=>{
|
|
175
|
+
handleDirectionalSlide(params, 'specific');
|
|
176
|
+
};
|
|
177
|
+
const slidesPerView = getItemsPerPage();
|
|
178
|
+
const sliderSettings = React.useMemo(()=>{
|
|
179
|
+
return {
|
|
180
|
+
speed: styles?.playSpeed === 0 ? 1 : styles?.playSpeed ?? 500,
|
|
181
|
+
dir: setting?.rtl ? 'rtl' : 'ltr',
|
|
182
|
+
slidesPerView,
|
|
183
|
+
spaceBetween: core.getResponsiveValueByScreen(styles?.spacing, currentDevice),
|
|
184
|
+
loop: core.getResponsiveValueByScreen(loop, currentDevice, false),
|
|
185
|
+
breakpoints: {
|
|
186
|
+
0: {
|
|
187
|
+
allowTouchMove: getAllowTouchMove('mobile'),
|
|
188
|
+
centeredSlides: core.getResponsiveValueByScreen(setting?.sneakPeakType, 'mobile') === 'center'
|
|
189
|
+
},
|
|
190
|
+
768: {
|
|
191
|
+
allowTouchMove: getAllowTouchMove('tablet'),
|
|
192
|
+
centeredSlides: core.getResponsiveValueByScreen(setting?.sneakPeakType, 'tablet') === 'center'
|
|
193
|
+
},
|
|
194
|
+
1025: {
|
|
195
|
+
allowTouchMove: getAllowTouchMove('desktop'),
|
|
196
|
+
centeredSlides: core.getResponsiveValueByScreen(setting?.sneakPeakType, 'desktop') === 'center'
|
|
197
|
+
}
|
|
198
|
+
},
|
|
199
|
+
autoplay: {
|
|
200
|
+
delay: (setting?.autoplayTimeout ?? 1) * 1000,
|
|
201
|
+
pauseOnMouseEnter: setting?.pauseOnHover
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
}, [
|
|
205
|
+
styles?.playSpeed,
|
|
206
|
+
setting?.rtl,
|
|
207
|
+
styles?.spacing,
|
|
208
|
+
currentDevice,
|
|
209
|
+
loop,
|
|
210
|
+
slidesPerView,
|
|
211
|
+
setting?.sneakPeakType,
|
|
212
|
+
setting?.pauseOnHover,
|
|
213
|
+
setting?.autoplayTimeout
|
|
214
|
+
]);
|
|
215
|
+
React.useEffect(()=>{
|
|
216
|
+
const selector = `[data-id="${builderProps?.uid}"]`;
|
|
217
|
+
onListener({
|
|
218
|
+
event: 'gp:change-next-slide',
|
|
219
|
+
selector,
|
|
220
|
+
elementRef: localRef
|
|
221
|
+
}, (params)=>{
|
|
222
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
223
|
+
nextSlideInteraction({
|
|
224
|
+
element: localRef.current,
|
|
225
|
+
data,
|
|
226
|
+
isRollback,
|
|
227
|
+
key: uniqueStorageKey
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
onListener({
|
|
231
|
+
event: 'gp:change-previous-slide',
|
|
232
|
+
selector,
|
|
233
|
+
elementRef: localRef
|
|
234
|
+
}, (params)=>{
|
|
235
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
236
|
+
previousSlideInteraction({
|
|
237
|
+
element: localRef.current,
|
|
238
|
+
data,
|
|
239
|
+
isRollback,
|
|
240
|
+
key: uniqueStorageKey
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
onListener({
|
|
244
|
+
event: 'gp:change-image-step',
|
|
245
|
+
selector,
|
|
246
|
+
elementRef: localRef
|
|
247
|
+
}, (params)=>{
|
|
248
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
249
|
+
moveToSlideInteraction({
|
|
250
|
+
element: localRef.current,
|
|
251
|
+
data,
|
|
252
|
+
isRollback,
|
|
253
|
+
key: uniqueStorageKey
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
onListener({
|
|
257
|
+
event: 'gp:change-index-slide',
|
|
258
|
+
selector
|
|
259
|
+
}, (params)=>{
|
|
260
|
+
const element = document.querySelector(selector);
|
|
261
|
+
const { data, isRollback, uniqueStorageKey } = params || {};
|
|
262
|
+
moveToSlideInteraction({
|
|
263
|
+
element,
|
|
264
|
+
data,
|
|
265
|
+
isRollback,
|
|
266
|
+
key: uniqueStorageKey
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}, []);
|
|
270
|
+
const handleNextAndPrevSlide = (action)=>{
|
|
271
|
+
action === 'next' ? swiperInstance?.slideNext() : swiperInstance?.slidePrev();
|
|
272
|
+
if (onClickArrow) {
|
|
273
|
+
delayTimeout && clearTimeout(delayTimeout);
|
|
274
|
+
delayTimeout = setTimeout(()=>onClickArrow && onClickArrow(), 500);
|
|
275
|
+
}
|
|
276
|
+
};
|
|
277
|
+
React.useEffect(()=>{
|
|
278
|
+
if (typeof moveToIdx == 'number') {
|
|
279
|
+
previousIndex.current = moveToIdx;
|
|
280
|
+
swiperInstance?.slideTo(moveToIdx);
|
|
281
|
+
}
|
|
282
|
+
}, [
|
|
283
|
+
swiperInstance,
|
|
284
|
+
moveToIdx,
|
|
285
|
+
isHiddenArrowWhenDisabled
|
|
286
|
+
]);
|
|
287
|
+
React.useEffect(()=>{
|
|
288
|
+
if (!swiperInstance) return;
|
|
289
|
+
const updateState = ()=>{
|
|
290
|
+
const { realIndex, slides } = swiperInstance;
|
|
291
|
+
setCurrentSlide(realIndex);
|
|
292
|
+
setTotalSlideItem(slides?.length);
|
|
293
|
+
};
|
|
294
|
+
updateState();
|
|
295
|
+
swiperInstance.on('slideChange', updateState);
|
|
296
|
+
return ()=>{
|
|
297
|
+
swiperInstance?.off('slideChange', updateState);
|
|
298
|
+
};
|
|
299
|
+
}, [
|
|
300
|
+
swiperInstance
|
|
301
|
+
]);
|
|
302
|
+
React.useEffect(()=>{
|
|
303
|
+
if (swiperInstance?.wrapperEl) {
|
|
304
|
+
swiperInstance.wrapperEl.style.transitionTimingFunction = setting?.animationMode ?? 'ease';
|
|
305
|
+
}
|
|
306
|
+
}, [
|
|
307
|
+
swiperInstance,
|
|
308
|
+
setting?.animationMode
|
|
309
|
+
]);
|
|
310
|
+
React.useEffect(()=>{
|
|
311
|
+
if (!swiperInstance) return;
|
|
312
|
+
if (swiperInstance.autoplay) {
|
|
313
|
+
const shouldRunAutoplay = mode === 'edit' ? isFirstPreviewClicked ? setting?.runPreview && setting?.autoplay : false : setting?.autoplay;
|
|
314
|
+
if (shouldRunAutoplay) {
|
|
315
|
+
swiperInstance.autoplay.start();
|
|
316
|
+
} else {
|
|
317
|
+
swiperInstance.autoplay.stop();
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}, [
|
|
321
|
+
swiperInstance,
|
|
322
|
+
setting?.autoplay,
|
|
323
|
+
mode,
|
|
324
|
+
isFirstPreviewClicked,
|
|
325
|
+
setting?.runPreview
|
|
326
|
+
]);
|
|
327
|
+
return {
|
|
328
|
+
isInfinity,
|
|
329
|
+
sliderSettings,
|
|
330
|
+
totalSlideItem,
|
|
331
|
+
currentSlide,
|
|
332
|
+
localRef,
|
|
333
|
+
isRenderDots,
|
|
334
|
+
showNavigation,
|
|
335
|
+
handleDotClick,
|
|
336
|
+
getItemsPerPage,
|
|
337
|
+
handleNextAndPrevSlide,
|
|
338
|
+
dispatchEventSelectSlide,
|
|
339
|
+
getNumberOfFullWidthShow
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
exports.useCarouselWithSwiper = useCarouselWithSwiper;
|
|
@@ -5,12 +5,11 @@ require('@gem-sdk/core');
|
|
|
5
5
|
require('react');
|
|
6
6
|
require('@gem-sdk/system');
|
|
7
7
|
require('next/link');
|
|
8
|
-
require('
|
|
9
|
-
var Carousel$1 = require('./settings/Carousel.js');
|
|
8
|
+
var Carousel = require('./settings/Carousel.js');
|
|
10
9
|
var CarouselItem$1 = require('./settings/CarouselItem.js');
|
|
11
10
|
|
|
12
11
|
const carouselSetting = {
|
|
13
|
-
Carousel: Carousel
|
|
12
|
+
Carousel: Carousel.default,
|
|
14
13
|
CarouselItem: CarouselItem$1.default
|
|
15
14
|
};
|
|
16
15
|
|
package/dist/cjs/index.js
CHANGED
|
@@ -81,7 +81,7 @@ var ArticleReadMore = require('./article/components/ArticleReadMore.js');
|
|
|
81
81
|
var HeroBanner = require('./hero-banner/components/HeroBanner.js');
|
|
82
82
|
var Breadcrumb = require('./breadcrumb/components/Breadcrumb.js');
|
|
83
83
|
var Button = require('./button/components/Button.js');
|
|
84
|
-
var
|
|
84
|
+
var CarouselWithSwiper = require('./carousel/components/root/CarouselWithSwiper.js');
|
|
85
85
|
var CarouselItem = require('./carousel/components/item/CarouselItem.js');
|
|
86
86
|
var Cart = require('./cart/components/Cart.js');
|
|
87
87
|
var CartList = require('./cart/components/CartList.js');
|
|
@@ -420,7 +420,7 @@ exports.ArticleReadMore = ArticleReadMore.default;
|
|
|
420
420
|
exports.HeroBanner = HeroBanner.default;
|
|
421
421
|
exports.Breadcrumb = Breadcrumb.default;
|
|
422
422
|
exports.Button = Button.default;
|
|
423
|
-
exports.Carousel =
|
|
423
|
+
exports.Carousel = CarouselWithSwiper.default;
|
|
424
424
|
exports.CarouselItem = CarouselItem.default;
|
|
425
425
|
exports.Cart = Cart.default;
|
|
426
426
|
exports.CartList = CartList.default;
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var
|
|
8
|
+
var CarouselWithSwiper = require('../../../carousel/components/root/CarouselWithSwiper.js');
|
|
9
9
|
var CarouselItem = require('../../../carousel/components/item/CarouselItem.js');
|
|
10
10
|
var core = require('@gem-sdk/core');
|
|
11
11
|
var helpers = require('./common/helpers.js');
|
|
@@ -63,7 +63,7 @@ const ProductGalleryCarousel = ({ builderPropUID, productImages, onHandleClick,
|
|
|
63
63
|
setting?.aspectRatio,
|
|
64
64
|
aspectHeight
|
|
65
65
|
]);
|
|
66
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
66
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
|
|
67
67
|
setting: {
|
|
68
68
|
loop: setting?.loop,
|
|
69
69
|
slidesToShow: slidePerShow,
|
|
@@ -5,7 +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
|
|
8
|
+
var CarouselWithSwiper = require('../../../carousel/components/root/CarouselWithSwiper.js');
|
|
9
9
|
var CarouselItem = require('../../../carousel/components/item/CarouselItem.js');
|
|
10
10
|
var NextImage = require('../../../image/components/NextImage.js');
|
|
11
11
|
require('../../../modal/components/confirm.js');
|
|
@@ -43,7 +43,7 @@ const ProductImagesLightBox = ({ builderPropUID, productImages, open, imageRatio
|
|
|
43
43
|
onClose: ()=>onHandleClose(),
|
|
44
44
|
disableIframeClickEvent: true,
|
|
45
45
|
contentClass: "mobile:!gp-w-[100%] gp-px-2",
|
|
46
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
46
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
|
|
47
47
|
setting: {
|
|
48
48
|
loop: loopControl,
|
|
49
49
|
slidesToShow: {
|
|
@@ -126,7 +126,7 @@ const ProductImages = (props)=>{
|
|
|
126
126
|
{% assign featured_image = product.featured_image %}
|
|
127
127
|
${system.LiquidIf(`variant != null and variant.featured_image != null`, `{% assign featured_image = variant.featured_image %}`)}
|
|
128
128
|
`)}
|
|
129
|
-
<gp-product-images-
|
|
129
|
+
<gp-product-images-v3
|
|
130
130
|
gp-data='${gpData}'
|
|
131
131
|
${{
|
|
132
132
|
...gpProductImagesAttrs
|
|
@@ -148,8 +148,8 @@ const ProductImages = (props)=>{
|
|
|
148
148
|
})}
|
|
149
149
|
${system.If(!isOnlyFeatureAllDevices, system.LiquidIf('product.media.size > 1', renderProductGalleryImages()))}
|
|
150
150
|
</div>
|
|
151
|
-
</gp-product-images-
|
|
152
|
-
${system.If(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-images-
|
|
151
|
+
</gp-product-images-v3>
|
|
152
|
+
${system.If(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-images-v3.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-images-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
153
153
|
`;
|
|
154
154
|
};
|
|
155
155
|
|
|
@@ -11,7 +11,7 @@ var getProductImagesClassName = require('../../composables/getProductImagesClass
|
|
|
11
11
|
var getProductImagesAttr = require('../../composables/getProductImagesAttr.js');
|
|
12
12
|
var system = require('@gem-sdk/system');
|
|
13
13
|
var styles = require('../../common/styles.js');
|
|
14
|
-
var
|
|
14
|
+
var CarouselWithSwiper = require('../../../../../carousel/components/root/CarouselWithSwiper.js');
|
|
15
15
|
var CarouselItem = require('../../../../../carousel/components/item/CarouselItem.js');
|
|
16
16
|
var ProductFeaturedImageOnly = require('./ProductFeaturedImageOnly.js');
|
|
17
17
|
var useProductFeaturedImageCarousel = require('../../hooks/useProductFeaturedImageCarousel.js');
|
|
@@ -36,7 +36,7 @@ const ProductFeaturedImageCarousel = (props)=>{
|
|
|
36
36
|
ref: ref,
|
|
37
37
|
"data-slot": "children",
|
|
38
38
|
className: "product-feature-image",
|
|
39
|
-
children: isRenderFeatureCarousel ? /*#__PURE__*/ jsxRuntime.jsxs(
|
|
39
|
+
children: isRenderFeatureCarousel ? /*#__PURE__*/ jsxRuntime.jsxs(CarouselWithSwiper.default, {
|
|
40
40
|
parentClass: builderPropsClass,
|
|
41
41
|
elmRef: imgRef,
|
|
42
42
|
setting: featuredImageCarouselSettingAttrs,
|
package/dist/cjs/product/components/product-images-v2/components/gallery-carousel/GalleryCarousel.js
CHANGED
|
@@ -13,7 +13,7 @@ var productFeaturedImage = require('../../common/productFeaturedImage.js');
|
|
|
13
13
|
var MediaIcon = require('../child/MediaIcon.js');
|
|
14
14
|
var ButtonOpenLightBox = require('../lightbox/ButtonOpenLightBox.js');
|
|
15
15
|
var NextImage = require('../../../../../image/components/NextImage.js');
|
|
16
|
-
var
|
|
16
|
+
var CarouselWithSwiper = require('../../../../../carousel/components/root/CarouselWithSwiper.js');
|
|
17
17
|
var CarouselItem = require('../../../../../carousel/components/item/CarouselItem.js');
|
|
18
18
|
var useGalleryCarousel = require('../../hooks/useGalleryCarousel.js');
|
|
19
19
|
var system = require('@gem-sdk/system');
|
|
@@ -27,7 +27,7 @@ const ProductGalleryCarousel = (props)=>{
|
|
|
27
27
|
const { galleryCarouselStyle, galleryCarouselItemStyle } = getProductImagesStyles.getProductImagesStyles(setting);
|
|
28
28
|
const { moveToIdx, isDisplay, shapeByLayout, isEnableBorderActive, isShowButtonLightbox, filteredProductImages, handleClickCarouselItem } = useGalleryCarousel.useGalleryCarousel(props);
|
|
29
29
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
30
|
-
children: isDisplay && /*#__PURE__*/ jsxRuntime.jsx(
|
|
30
|
+
children: isDisplay && /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
|
|
31
31
|
parentClass: builderPropsClass,
|
|
32
32
|
rootClass: builderPropsClass,
|
|
33
33
|
setting: galleryCarouselSettingAttrs,
|
package/dist/cjs/product/components/product-images-v2/components/lightbox/ProductImagesLightBox.js
CHANGED
|
@@ -5,7 +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
|
|
8
|
+
var CarouselWithSwiper = require('../../../../../carousel/components/root/CarouselWithSwiper.js');
|
|
9
9
|
var CarouselItem = require('../../../../../carousel/components/item/CarouselItem.js');
|
|
10
10
|
var NextImage = require('../../../../../image/components/NextImage.js');
|
|
11
11
|
require('../../../../../modal/components/confirm.js');
|
|
@@ -53,7 +53,7 @@ const ProductImagesLightBox = ({ builderPropUID, productImages, open, imageRatio
|
|
|
53
53
|
},
|
|
54
54
|
disableIframeClickEvent: true,
|
|
55
55
|
contentClass: "mobile:!gp-w-[100%] gp-px-2 gp-pb-10",
|
|
56
|
-
children: /*#__PURE__*/ jsxRuntime.jsx(
|
|
56
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
|
|
57
57
|
setting: {
|
|
58
58
|
loop: loopControl,
|
|
59
59
|
slidesToShow: {
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
|
-
var
|
|
7
|
+
var CarouselWithSwiper = require('../../../carousel/components/root/CarouselWithSwiper.js');
|
|
8
8
|
var CarouselItem = require('../../../carousel/components/item/CarouselItem.js');
|
|
9
9
|
var ChildrenDroppable = require('../../../grid/components/ChildrenDroppable.js');
|
|
10
10
|
var helpers = require('./common/helpers.js');
|
|
@@ -19,7 +19,7 @@ const ProductListCarouselLayout = (props)=>{
|
|
|
19
19
|
const { productListAttr, getAttrProductItemEditor } = attrs.getAttr(props);
|
|
20
20
|
const { carouselItemStyle } = styles.getStyle(props);
|
|
21
21
|
const { carouselClass, productItemClass } = classes.getClass(props);
|
|
22
|
-
return /*#__PURE__*/ jsxRuntime.jsx(
|
|
22
|
+
return /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
|
|
23
23
|
advanced: advanced,
|
|
24
24
|
builderProps: {
|
|
25
25
|
uid: builderProps?.uid
|
|
@@ -11,7 +11,6 @@ require('../notification/components/Notice.js');
|
|
|
11
11
|
require('./components/product-button/types.js');
|
|
12
12
|
require('./components/product-variants/components/variants/index.js');
|
|
13
13
|
require('next/image');
|
|
14
|
-
require('@gem-sdk/keen-slider/react');
|
|
15
14
|
require('../modal/components/confirm.js');
|
|
16
15
|
require('react-dom');
|
|
17
16
|
require('../video/components/Video.js');
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { template } from '@gem-sdk/core';
|
|
2
|
+
import { getStaticLocale } from '../../../helpers.js';
|
|
2
3
|
|
|
3
4
|
const BreadcrumbHomeTemplate = ({ composePageClasses, breadcrumbChildItemStyles })=>{
|
|
4
5
|
return template`
|
|
5
6
|
<a class="${composePageClasses}" style="${breadcrumbChildItemStyles}" href="{{ routes.root_url }}">
|
|
6
|
-
|
|
7
|
+
${getStaticLocale('Breadcrumb', 'home')}
|
|
7
8
|
</a>`;
|
|
8
9
|
};
|
|
9
10
|
|
package/dist/esm/builder.js
CHANGED
|
@@ -132,7 +132,7 @@ import ArticleReadMore from './article/components/ArticleReadMore.js';
|
|
|
132
132
|
import HeroBanner from './hero-banner/components/HeroBanner.js';
|
|
133
133
|
import Breadcrumb from './breadcrumb/components/Breadcrumb.js';
|
|
134
134
|
import Button from './button/components/Button.js';
|
|
135
|
-
import
|
|
135
|
+
import CarouselWithSwiper from './carousel/components/root/CarouselWithSwiper.js';
|
|
136
136
|
import CarouselItem from './carousel/components/item/CarouselItem.js';
|
|
137
137
|
import Cart from './cart/components/Cart.js';
|
|
138
138
|
import CartList from './cart/components/CartList.js';
|
|
@@ -280,7 +280,7 @@ var builder = {
|
|
|
280
280
|
HeroBanner,
|
|
281
281
|
Breadcrumb,
|
|
282
282
|
Button,
|
|
283
|
-
Carousel,
|
|
283
|
+
Carousel: CarouselWithSwiper,
|
|
284
284
|
CarouselItem,
|
|
285
285
|
Cart,
|
|
286
286
|
CartList,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { isEmptyChildren } from '@gem-sdk/core';
|
|
4
|
+
import { SwiperSlide } from '../root/CustomSwiper.js';
|
|
4
5
|
import { getStyle } from './common/styles.js';
|
|
5
6
|
import { getClass } from './common/classes.js';
|
|
6
7
|
import { useCarouselItem } from '../../hooks/useCarouseItem.js';
|
|
@@ -11,7 +12,7 @@ const CarouselItem = (props)=>{
|
|
|
11
12
|
const { handleClick, handleMouseMove, handleMouseOut } = useCarouselItem(props);
|
|
12
13
|
const { carouselItemStyle, carouselItemInnerStyle } = getStyle(props);
|
|
13
14
|
const { carouselItemClass, carouselItemInnerClass } = getClass(props);
|
|
14
|
-
return /*#__PURE__*/ jsx(
|
|
15
|
+
return /*#__PURE__*/ jsx(SwiperSlide, {
|
|
15
16
|
...builderAttrs,
|
|
16
17
|
"aria-hidden": true,
|
|
17
18
|
className: carouselItemClass,
|
|
@@ -21,7 +21,7 @@ const Carousel = (props)=>{
|
|
|
21
21
|
const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle, sliderStyle } = getStyle(renderData);
|
|
22
22
|
const { rootAttrRender, sliderAttr } = getAttr(renderData);
|
|
23
23
|
const renderJS = ()=>{
|
|
24
|
-
return RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-carousel-
|
|
24
|
+
return RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-carousel-v3.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-carousel-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
|
|
25
25
|
};
|
|
26
26
|
const renderArrow = (position)=>{
|
|
27
27
|
const isNext = position === 'next';
|
|
@@ -73,9 +73,9 @@ const Carousel = (props)=>{
|
|
|
73
73
|
class="${wrapperClassRender}"
|
|
74
74
|
style="${wrapperStyleRender}"
|
|
75
75
|
>
|
|
76
|
-
<div class="${wrapperInnerClass}" style="${wrapperInnerStyle}">
|
|
76
|
+
<div ${sliderAttr} class="${wrapperInnerClass}" style="${wrapperInnerStyle}">
|
|
77
77
|
${renderArrow('prev')}
|
|
78
|
-
<div
|
|
78
|
+
<div class="${sliderClass}" style="${sliderStyle}">
|
|
79
79
|
${renderChildren()}
|
|
80
80
|
</div>
|
|
81
81
|
${renderArrow('next')}
|