@crystaldesign/widget-library 25.8.0-beta.24 → 25.8.0-beta.25
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/build/esm/index.js +21 -3
- package/build/types/widget-library/src/components/Gallery/index.d.ts.map +1 -1
- package/build/types/widget-library/src/components/Gallery/types.d.ts +1 -0
- package/build/types/widget-library/src/components/Gallery/types.d.ts.map +1 -1
- package/build/types/widget-library/src/components/Gallery/useGallery.d.ts.map +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -722,6 +722,10 @@ function useGallery(_ref) {
|
|
|
722
722
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
723
723
|
currentMediaIndex = _useState6[0],
|
|
724
724
|
setCurrentMediaIndex = _useState6[1];
|
|
725
|
+
var _useState7 = useState(false),
|
|
726
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
727
|
+
swiperIsInitialized = _useState8[0],
|
|
728
|
+
setSwiperIsInitialized = _useState8[1];
|
|
725
729
|
var medias = useMedia({
|
|
726
730
|
products: products,
|
|
727
731
|
functionTypes: functionTypes,
|
|
@@ -739,8 +743,13 @@ function useGallery(_ref) {
|
|
|
739
743
|
return media.productId === currentProductId;
|
|
740
744
|
});
|
|
741
745
|
if (mediaIndex !== -1 && mediaIndex !== currentMediaIndex) {
|
|
746
|
+
var _swiper$params;
|
|
742
747
|
setCurrentMediaIndex(mediaIndex);
|
|
743
|
-
swiper
|
|
748
|
+
if (swiper !== null && swiper !== void 0 && (_swiper$params = swiper.params) !== null && _swiper$params !== void 0 && _swiper$params.loop) {
|
|
749
|
+
swiper === null || swiper === void 0 || swiper.slideToLoop(mediaIndex);
|
|
750
|
+
} else {
|
|
751
|
+
swiper === null || swiper === void 0 || swiper.slideTo(mediaIndex);
|
|
752
|
+
}
|
|
744
753
|
}
|
|
745
754
|
}
|
|
746
755
|
}, [currentProductId]);
|
|
@@ -766,7 +775,13 @@ function useGallery(_ref) {
|
|
|
766
775
|
}),
|
|
767
776
|
sirvLoaded = _useSirv.sirvLoaded;
|
|
768
777
|
var onSlideChange = function onSlideChange(swiper) {
|
|
769
|
-
if (swiper.
|
|
778
|
+
if (swiper.el.classList.contains('gallery-main-nested-swiper')) return;
|
|
779
|
+
|
|
780
|
+
// Ensure the onSlideChange logic is not executed during the initial setup of the Swiper instance.
|
|
781
|
+
if (!swiperIsInitialized) {
|
|
782
|
+
setSwiperIsInitialized(true);
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
770
785
|
var newMediaIndex = swiper.realIndex;
|
|
771
786
|
var media = medias[newMediaIndex];
|
|
772
787
|
setCurrentMediaIndex(newMediaIndex);
|
|
@@ -1097,6 +1112,8 @@ var Gallery = function Gallery(props) {
|
|
|
1097
1112
|
url: arUrl,
|
|
1098
1113
|
htmlArElement: htmlArElement === null || htmlArElement === void 0 ? void 0 : htmlArElement.current
|
|
1099
1114
|
}), /*#__PURE__*/jsx(Swiper, _objectSpread(_objectSpread({
|
|
1115
|
+
nested: props.nestedSwiper // for popup
|
|
1116
|
+
,
|
|
1100
1117
|
onSwiper: setSwiper,
|
|
1101
1118
|
resizeObserver: false,
|
|
1102
1119
|
onSlideChange: onSlideChange,
|
|
@@ -1107,9 +1124,10 @@ var Gallery = function Gallery(props) {
|
|
|
1107
1124
|
swiper: thumbsSwiper && !thumbsSwiper.destroyed ? thumbsSwiper : null
|
|
1108
1125
|
},
|
|
1109
1126
|
modules: [Navigation, Thumbs, Pagination],
|
|
1110
|
-
className:
|
|
1127
|
+
className: classNames('gallery-main', props.nestedSwiper ? 'gallery-main-popup-swiper' : ''),
|
|
1111
1128
|
speed: props.disableAnimation ? 0 : 500
|
|
1112
1129
|
}, props.config.sliderProp), {}, {
|
|
1130
|
+
loop: true,
|
|
1113
1131
|
children: medias.map(function (media, i) {
|
|
1114
1132
|
return /*#__PURE__*/jsx(SwiperSlide, {
|
|
1115
1133
|
id: 'gallery media index ' + i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,cAAc,SAAS,CAAC;AAKxB,eAAO,MAAM,OAAO,UAAW,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AASvC,cAAc,SAAS,CAAC;AAKxB,eAAO,MAAM,OAAO,UAAW,YAAY,sBAwD1C,CAAC"}
|
|
@@ -23,6 +23,7 @@ export interface GalleryProps {
|
|
|
23
23
|
setCurrentProductId?: (id: string) => void;
|
|
24
24
|
disableAnimation?: boolean;
|
|
25
25
|
setCurrentMedia?: (m: MediaWithProductIndex) => void;
|
|
26
|
+
nestedSwiper?: boolean;
|
|
26
27
|
}
|
|
27
28
|
export interface MediaWithProductIndex extends Media {
|
|
28
29
|
productIndex: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,WAAW,aAAc,SAAQ,iBAAiB,EAAE,eAAe;IACvE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,cAAc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;CAClC;AAED,MAAM,WAAW,kBAAmB,SAAQ,iBAAiB;IAC3D,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACrD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAsB,SAAQ,KAAK;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGallery.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/useGallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,MAAM,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAC3D,gBAAgB,EAChB,mBAAmB,GACpB,EAAE,YAAY;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useGallery.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Gallery/useGallery.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAI9D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,QAAQ,EACR,MAAM,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,oBAAoB,EAAE,EAC3D,gBAAgB,EAChB,mBAAmB,GACpB,EAAE,YAAY;;;;;;;;4BAsCkB,WAAW;EAgC3C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/widget-library",
|
|
3
|
-
"version": "25.8.0-beta.
|
|
3
|
+
"version": "25.8.0-beta.25",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"storybook": "storybook dev -p 6006",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"suiteName": "widget-library",
|
|
37
37
|
"outputDirectory": "./test-reports"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "f943b7dca14cc72485be12cf4b6ec230b3678292"
|
|
40
40
|
}
|