@gem-sdk/components 2.0.0-dev.743 → 2.0.0-dev.746

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/cjs/builder.js +2 -2
  2. package/dist/cjs/carousel/components/item/CarouselItem.js +2 -1
  3. package/dist/cjs/carousel/components/root/Carousel.liquid.js +3 -3
  4. package/dist/cjs/carousel/components/root/CarouselWithSwiper.js +131 -0
  5. package/dist/cjs/carousel/components/root/CustomSwiper.js +62 -0
  6. package/dist/cjs/carousel/components/root/common/classes.js +2 -2
  7. package/dist/cjs/carousel/components/root/common/styles.js +2 -0
  8. package/dist/cjs/carousel/components/root/load-swiper.js +32 -0
  9. package/dist/cjs/carousel/hooks/useCarouselWithSwiper.js +343 -0
  10. package/dist/cjs/carousel/index.js +3 -3
  11. package/dist/cjs/index.js +2 -2
  12. package/dist/cjs/product/components/product-images/ProductGalleryCarousel.js +2 -2
  13. package/dist/cjs/product/components/product-images/ProductImagesLightBox.js +2 -2
  14. package/dist/cjs/product/components/product-images-v2/ProductImagesV2.liquid.js +3 -3
  15. package/dist/cjs/product/components/product-images-v2/components/child/ProductFeaturedImageCarousel.js +2 -2
  16. package/dist/cjs/product/components/product-images-v2/components/gallery-carousel/GalleryCarousel.js +2 -2
  17. package/dist/cjs/product/components/product-images-v2/components/lightbox/ProductImagesLightBox.js +2 -2
  18. package/dist/cjs/product/components/product-list/ProductListCarouselLayout.js +2 -2
  19. package/dist/cjs/product/index.js +1 -1
  20. package/dist/esm/builder.js +2 -2
  21. package/dist/esm/carousel/components/item/CarouselItem.js +2 -1
  22. package/dist/esm/carousel/components/root/Carousel.liquid.js +3 -3
  23. package/dist/esm/carousel/components/root/CarouselWithSwiper.js +127 -0
  24. package/dist/esm/carousel/components/root/CustomSwiper.js +59 -0
  25. package/dist/esm/carousel/components/root/common/classes.js +2 -2
  26. package/dist/esm/carousel/components/root/common/styles.js +2 -0
  27. package/dist/esm/carousel/components/root/load-swiper.js +3 -0
  28. package/dist/esm/carousel/hooks/useCarouselWithSwiper.js +341 -0
  29. package/dist/esm/carousel/index.js +1 -1
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/product/components/product-images/ProductGalleryCarousel.js +2 -2
  32. package/dist/esm/product/components/product-images/ProductImagesLightBox.js +2 -2
  33. package/dist/esm/product/components/product-images-v2/ProductImagesV2.liquid.js +3 -3
  34. package/dist/esm/product/components/product-images-v2/components/child/ProductFeaturedImageCarousel.js +2 -2
  35. package/dist/esm/product/components/product-images-v2/components/gallery-carousel/GalleryCarousel.js +2 -2
  36. package/dist/esm/product/components/product-images-v2/components/lightbox/ProductImagesLightBox.js +2 -2
  37. package/dist/esm/product/components/product-list/ProductListCarouselLayout.js +2 -2
  38. package/dist/esm/product/index.js +1 -1
  39. package/dist/types/index.d.ts +2 -2
  40. package/package.json +2 -2
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 Carousel = require('./carousel/components/root/Carousel.js');
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 = Carousel.default;
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 Carousel = require('../../../carousel/components/root/Carousel.js');
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(Carousel.default, {
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 Carousel = require('../../../carousel/components/root/Carousel.js');
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(Carousel.default, {
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-v2
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-v2>
152
- ${system.If(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-images-v2.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-images-v2.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
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 Carousel = require('../../../../../carousel/components/root/Carousel.js');
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(Carousel.default, {
39
+ children: isRenderFeatureCarousel ? /*#__PURE__*/ jsxRuntime.jsxs(CarouselWithSwiper.default, {
40
40
  parentClass: builderPropsClass,
41
41
  elmRef: imgRef,
42
42
  setting: featuredImageCarouselSettingAttrs,
@@ -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 Carousel = require('../../../../../carousel/components/root/Carousel.js');
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(Carousel.default, {
30
+ children: isDisplay && /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
31
31
  parentClass: builderPropsClass,
32
32
  rootClass: builderPropsClass,
33
33
  setting: galleryCarouselSettingAttrs,
@@ -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 Carousel = require('../../../../../carousel/components/root/Carousel.js');
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(Carousel.default, {
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 Carousel = require('../../../carousel/components/root/Carousel.js');
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(Carousel.default, {
22
+ return /*#__PURE__*/ jsxRuntime.jsx(CarouselWithSwiper.default, {
23
23
  advanced: advanced,
24
24
  builderProps: {
25
25
  uid: builderProps?.uid
@@ -11,7 +11,7 @@ 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');
14
+ require('../carousel/components/root/CustomSwiper.js');
15
15
  require('../modal/components/confirm.js');
16
16
  require('react-dom');
17
17
  require('../video/components/Video.js');
@@ -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 Carousel from './carousel/components/root/Carousel.js';
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("div", {
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-v2.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-carousel-v2.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
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 ${sliderAttr} class="${sliderClass}" style="${sliderStyle}">
78
+ <div class="${sliderClass}" style="${sliderStyle}">
79
79
  ${renderChildren()}
80
80
  </div>
81
81
  ${renderArrow('next')}
@@ -0,0 +1,127 @@
1
+ 'use client';
2
+ import { jsx, jsxs } from 'react/jsx-runtime';
3
+ import { useCurrentDevice, isEmptyChildren, filterToolbarPreview } from '@gem-sdk/core';
4
+ import { forwardRef, useState, useCallback, Children, isValidElement } from 'react';
5
+ import { mappingNavigationCarousel } from '../arrow/common/helpers.js';
6
+ import { useCarouselWithSwiper } from '../../hooks/useCarouselWithSwiper.js';
7
+ import { getData } from './common/helpers.js';
8
+ import { getClass } from './common/classes.js';
9
+ import { getStyle } from './common/styles.js';
10
+ import { getAttr } from './common/attrs.js';
11
+ import Arrow from '../arrow/Arrow.js';
12
+ import Dots from '../dot/Dots.js';
13
+ import { Swiper } from './CustomSwiper.js';
14
+
15
+ const CarouselWithSwiper = /*#__PURE__*/ forwardRef((props, ref)=>{
16
+ const { children, builderAttrs, builderProps, styles, isHiddenArrowWhenDisabled = true, hiddenDotWhenOnlyOne, elmRef } = props;
17
+ const setting = mappingNavigationCarousel(props.setting);
18
+ const renderData = {
19
+ ...props,
20
+ setting
21
+ };
22
+ const [swiperInstance, setSwiperInstance] = useState(null);
23
+ const { arrowButtonSize, arrowBackgroundColor, arrowGapToEachSide = '16', roundedArrow, arrowIconSize, arrowCustomColor, arrowBorder, arrowShadow, showWhenHover } = setting ?? {};
24
+ const { isInfinity, localRef, sliderSettings, totalSlideItem, currentSlide, isRenderDots, showNavigation, handleDotClick, getItemsPerPage, handleNextAndPrevSlide, dispatchEventSelectSlide, getNumberOfFullWidthShow } = useCarouselWithSwiper(renderData, ref, swiperInstance);
25
+ const { loopConfig, arrowShowConfig } = getData(renderData);
26
+ const { rootClassRender, wrapperClassRender, wrapperInnerClass, sliderClass } = getClass(renderData);
27
+ const { rootStyleRender, wrapperStyleRender, wrapperInnerStyle } = getStyle(renderData);
28
+ const { rootAttrRender, sliderAttr } = getAttr(renderData);
29
+ const currentDevice = useCurrentDevice();
30
+ const enabledSneakPeak = setting?.sneakPeak?.[currentDevice];
31
+ const renderArrow = (position)=>{
32
+ const isNext = position === 'next';
33
+ const slidesPerView = getItemsPerPage();
34
+ const isDisable = isNext ? !isInfinity && currentSlide >= totalSlideItem - Math.floor(slidesPerView) : !isInfinity && currentSlide === 0;
35
+ return /*#__PURE__*/ jsx(Arrow, {
36
+ uid: builderProps?.uid,
37
+ custom: setting?.arrowCustom ?? '',
38
+ showArrow: arrowShowConfig,
39
+ arrowButtonSize: arrowButtonSize || {},
40
+ arrowIconSize: arrowIconSize || {},
41
+ arrowBackgroundColor: arrowBackgroundColor || '',
42
+ arrowCustomColor: arrowCustomColor,
43
+ gapToEachSize: arrowGapToEachSide,
44
+ showWhenHover: showWhenHover,
45
+ arrowBorder: arrowBorder || {},
46
+ arrowCorner: roundedArrow || {},
47
+ arrowShadow: arrowShadow || {},
48
+ onClick: (e)=>{
49
+ e.stopPropagation();
50
+ handleNextAndPrevSlide(position);
51
+ },
52
+ left: !isNext,
53
+ disabled: isDisable,
54
+ vertical: setting?.vertical,
55
+ isHiddenWhenDisabled: isHiddenArrowWhenDisabled,
56
+ rootId: props?.parentClass
57
+ });
58
+ };
59
+ const handleSliderReady = useCallback((swiper)=>{
60
+ setSwiperInstance(swiper);
61
+ }, []);
62
+ return /*#__PURE__*/ jsx("div", {
63
+ ref: elmRef,
64
+ ...rootAttrRender,
65
+ className: rootClassRender,
66
+ style: rootStyleRender,
67
+ children: /*#__PURE__*/ jsxs("div", {
68
+ ref: localRef,
69
+ ...builderAttrs,
70
+ className: wrapperClassRender,
71
+ style: wrapperStyleRender,
72
+ children: [
73
+ /*#__PURE__*/ jsxs("div", {
74
+ className: wrapperInnerClass,
75
+ style: wrapperInnerStyle,
76
+ children: [
77
+ showNavigation && renderArrow('prev'),
78
+ /*#__PURE__*/ jsx(Swiper, {
79
+ ...sliderAttr,
80
+ ...sliderSettings,
81
+ sliderClass: sliderClass,
82
+ onSwiperReady: handleSliderReady,
83
+ totalSlides: totalSlideItem,
84
+ children: isEmptyChildren(children) ? /*#__PURE__*/ jsx("div", {
85
+ children: "No Slider"
86
+ }) : Children.map(filterToolbarPreview(children), (child)=>{
87
+ if (/*#__PURE__*/ isValidElement(child)) {
88
+ return /*#__PURE__*/ jsx(child.type, {
89
+ ...child.props,
90
+ parentSettings: setting,
91
+ parentStyle: styles,
92
+ background: setting?.background,
93
+ parentUid: builderProps?.uid,
94
+ dispatchEventSelectSlide: dispatchEventSelectSlide
95
+ });
96
+ }
97
+ return null;
98
+ })
99
+ }),
100
+ showNavigation && renderArrow('next')
101
+ ]
102
+ }),
103
+ isRenderDots && /*#__PURE__*/ jsx(Dots, {
104
+ dotStyle: setting?.dotStyle,
105
+ dotGapToCarousel: setting?.dotGapToCarousel,
106
+ vertical: setting?.vertical,
107
+ showDots: setting?.dot,
108
+ slideItemsPerPage: getItemsPerPage(),
109
+ enabledSneakPeak: enabledSneakPeak,
110
+ dotColor: setting?.dotColor,
111
+ dotActiveColor: setting?.dotActiveColor,
112
+ dotSize: setting?.dotSize,
113
+ sneakPeakType: setting?.sneakPeakType,
114
+ totalSlideItem: totalSlideItem,
115
+ hiddenWhenOnlyOne: hiddenDotWhenOnlyOne,
116
+ currentSlide: currentSlide,
117
+ loop: loopConfig,
118
+ numberOfFullWidthShow: getNumberOfFullWidthShow(currentDevice),
119
+ onHandleClick: handleDotClick
120
+ }),
121
+ filterToolbarPreview(children, true)
122
+ ]
123
+ })
124
+ });
125
+ });
126
+
127
+ export { CarouselWithSwiper as default };
@@ -0,0 +1,59 @@
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { useRef, useEffect } from 'react';
3
+
4
+ const preloadSwiperModule = import('./load-swiper.js');
5
+ function Swiper(props) {
6
+ const swiperRef = useRef(null);
7
+ const { children, totalSlides, onSwiperReady, sliderClass, ...sliderSetting } = props;
8
+ const pauseOnMouseEnter = typeof props.autoplay === 'object' && props.autoplay !== null ? props.autoplay.pauseOnMouseEnter : undefined;
9
+ useEffect(()=>{
10
+ const loadSwiper = async ()=>{
11
+ const swiperModule = await preloadSwiperModule;
12
+ swiperModule.register();
13
+ Object.assign(swiperRef.current, sliderSetting);
14
+ swiperRef.current.initialize();
15
+ onSwiperReady?.(swiperRef.current.swiper);
16
+ };
17
+ loadSwiper();
18
+ }, []);
19
+ useEffect(()=>{
20
+ if (swiperRef.current?.swiper) {
21
+ const swiperInstance = swiperRef.current.swiper;
22
+ swiperInstance.destroy(true, true);
23
+ Object.assign(swiperRef.current, sliderSetting);
24
+ swiperRef.current.initialize();
25
+ onSwiperReady?.(swiperRef.current.swiper);
26
+ }
27
+ }, [
28
+ sliderSetting.dir,
29
+ sliderSetting.loop,
30
+ pauseOnMouseEnter,
31
+ sliderSetting.slidesPerView,
32
+ onSwiperReady,
33
+ totalSlides
34
+ ]);
35
+ useEffect(()=>{
36
+ const swiperInstance = swiperRef.current?.swiper;
37
+ if (!swiperInstance) return;
38
+ Object.assign(swiperInstance.params, sliderSetting);
39
+ swiperInstance.update();
40
+ }, [
41
+ sliderSetting
42
+ ]);
43
+ return /*#__PURE__*/ jsx("swiper-container", {
44
+ init: false,
45
+ className: sliderClass,
46
+ ref: swiperRef,
47
+ children: children
48
+ });
49
+ }
50
+ function SwiperSlide(props) {
51
+ const { children, className, ...rest } = props;
52
+ return /*#__PURE__*/ jsx("swiper-slide", {
53
+ ...rest,
54
+ className: className,
55
+ children: children
56
+ });
57
+ }
58
+
59
+ export { Swiper, SwiperSlide };
@@ -96,7 +96,7 @@ const getClass = (props)=>{
96
96
  ...getDisplayOfWrapper()
97
97
  });
98
98
  const wrapperInnerClass = createClass({
99
- 'gp-relative gp-flex gp-items-center gp-justify-between': true,
99
+ 'gp-relative gp-overflow-hidden gp-flex gp-items-center gp-justify-between': true,
100
100
  '!gp-h-full': fullHeight,
101
101
  ...getWrapperInnerHeight(),
102
102
  ...makeFlexColClass()
@@ -114,7 +114,7 @@ const getClass = (props)=>{
114
114
  }
115
115
  });
116
116
  const sliderClass = createClass({
117
- 'gem-slider gp-h-full gp-overflow-hidden gp-select-none': true,
117
+ 'gem-slider-wrapper gp-flex gp-content-start gp-h-full gp-select-none': true,
118
118
  [sliderSelector]: true,
119
119
  ...slidesClass && {
120
120
  [slidesClass]: true
@@ -49,6 +49,8 @@ const getStyle = (props)=>{
49
49
  ...rootStyles
50
50
  });
51
51
  const sliderStyle = createStyle({
52
+ ...styleWidth,
53
+ ...styleHeight,
52
54
  ...makeSpacing()
53
55
  });
54
56
  return {
@@ -0,0 +1,3 @@
1
+ export { register } from 'swiper/element/bundle';
2
+ export { Swiper } from 'swiper';
3
+ export { Autoplay, Navigation, Pagination, Thumbs } from 'swiper/modules';