@gem-sdk/components 2.0.0-dev.261 → 2.0.0-dev.265
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/banner/components/HeroBannerItem.liquid.js +3 -2
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +3 -2
- package/dist/cjs/grid/row/setting/configs/settings.js +9 -83
- package/dist/cjs/grid/section/setting/configs/settings.js +13 -75
- package/dist/cjs/icon-list-hoz/setting/configs/settings.js +4 -17
- package/dist/cjs/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
- package/dist/cjs/post-purchase/line/setting/configs/settings.js +3 -1
- package/dist/cjs/post-purchase/line/setting/configs/uiV2.js +2 -1
- package/dist/cjs/post-purchase/link/components/PostPurchaseLink.js +23 -14
- package/dist/cjs/post-purchase/link/components/common/getClasses.js +7 -1
- package/dist/cjs/post-purchase/link/setting/configs/settings.js +21 -14
- package/dist/cjs/post-purchase/product/common/getClasses.js +45 -0
- package/dist/cjs/post-purchase/product/common/getStyles.js +43 -0
- package/dist/cjs/post-purchase/product/components/product-image/FeatureImage.js +32 -42
- package/dist/cjs/post-purchase/product/components/product-image/ImageListCarousel.js +6 -65
- package/dist/cjs/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
- package/dist/cjs/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +42 -0
- package/dist/cjs/post-purchase/product/components/product-image/ItemGridPostPurchase.js +42 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +29 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +35 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +22 -0
- package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +75 -0
- package/dist/cjs/post-purchase/product/components/product-image/index.js +41 -43
- package/dist/cjs/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
- package/dist/cjs/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
- package/dist/cjs/post-purchase/product/constants/index.js +36 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useCarousel.js +14 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +32 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +43 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +32 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +60 -0
- package/dist/cjs/post-purchase/product/hooks/product-image/useSlideCarousel.js +35 -0
- package/dist/cjs/post-purchase/product/settings/product-description/settingV2.js +6 -9
- package/dist/cjs/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
- package/dist/cjs/post-purchase/product/settings/product-image/ProductGalleryImage.js +0 -118
- package/dist/cjs/post-purchase/product/settings/product-image/ProductImages.js +8 -79
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v1.js +163 -0
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +375 -0
- package/dist/cjs/post-purchase/product/settings/product-image/uiV1.js +42 -0
- package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +235 -0
- package/dist/cjs/post-purchase/product/settings/product-price/uiV2.js +0 -3
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
- package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
- package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
- package/dist/cjs/post-purchase/product/settings/product-title/settingV2.js +6 -9
- package/dist/cjs/post-purchase/text/settings/text/settingV2.js +0 -7
- package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -2
- package/dist/cjs/product/setting/product/configs/presets.js +1 -1
- package/dist/cjs/product/setting/product/configs/settings.js +4 -20
- package/dist/cjs/setting.js +2 -1
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -2
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +3 -2
- package/dist/esm/grid/row/setting/configs/settings.js +9 -83
- package/dist/esm/grid/section/setting/configs/settings.js +13 -75
- package/dist/esm/icon-list-hoz/setting/configs/settings.js +4 -17
- package/dist/esm/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
- package/dist/esm/post-purchase/line/setting/configs/settings.js +3 -1
- package/dist/esm/post-purchase/line/setting/configs/uiV2.js +2 -1
- package/dist/esm/post-purchase/link/components/PostPurchaseLink.js +25 -16
- package/dist/esm/post-purchase/link/components/common/getClasses.js +7 -2
- package/dist/esm/post-purchase/link/setting/configs/settings.js +21 -14
- package/dist/esm/post-purchase/product/common/getClasses.js +37 -1
- package/dist/esm/post-purchase/product/common/getStyles.js +39 -1
- package/dist/esm/post-purchase/product/components/product-image/FeatureImage.js +32 -42
- package/dist/esm/post-purchase/product/components/product-image/ImageListCarousel.js +7 -66
- package/dist/esm/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
- package/dist/esm/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +40 -0
- package/dist/esm/post-purchase/product/components/product-image/ItemGridPostPurchase.js +40 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +27 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +33 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +19 -0
- package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +73 -0
- package/dist/esm/post-purchase/product/components/product-image/index.js +42 -44
- package/dist/esm/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
- package/dist/esm/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
- package/dist/esm/post-purchase/product/constants/index.js +34 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useCarousel.js +12 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +30 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +41 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +30 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +58 -0
- package/dist/esm/post-purchase/product/hooks/product-image/useSlideCarousel.js +33 -0
- package/dist/esm/post-purchase/product/settings/product-description/settingV2.js +6 -9
- package/dist/esm/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
- package/dist/esm/post-purchase/product/settings/product-image/ProductGalleryImage.js +1 -118
- package/dist/esm/post-purchase/product/settings/product-image/ProductImages.js +8 -79
- package/dist/esm/post-purchase/product/settings/product-image/setting-v1.js +161 -0
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +373 -0
- package/dist/esm/post-purchase/product/settings/product-image/uiV1.js +40 -0
- package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +233 -0
- package/dist/esm/post-purchase/product/settings/product-price/uiV2.js +0 -3
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
- package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
- package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
- package/dist/esm/post-purchase/product/settings/product-title/settingV2.js +6 -9
- package/dist/esm/post-purchase/text/settings/text/settingV2.js +0 -7
- package/dist/esm/product/components/FileUpload/components/common/index.js +3 -2
- package/dist/esm/product/setting/product/configs/presets.js +1 -1
- package/dist/esm/product/setting/product/configs/settings.js +4 -20
- package/dist/esm/setting.js +2 -1
- package/dist/types/index.d.ts +12 -5
- package/package.json +4 -4
- package/dist/cjs/post-purchase/product/components/product-image/Arrow.js +0 -60
- package/dist/cjs/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -78
- package/dist/esm/post-purchase/product/components/product-image/Arrow.js +0 -58
- package/dist/esm/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -76
|
@@ -1,71 +1,12 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { ArrowPostPurchase } from './Arrow.js';
|
|
6
|
-
import { CarouselPostPurchase } from './CarouselPostPurchase.js';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { CarouselProvider } from './carousel-post-purchase/CarouselPostPurchaseContext.js';
|
|
4
|
+
import { CarouselWrapperPostPurchase } from './carousel-post-purchase/CarouselWrapperPostPurchase.js';
|
|
7
5
|
|
|
8
|
-
const ImageListCarousel = (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
const { ilObjectFit, ilAspectRatio, ilItemPerSlide, ilSpacing, layoutType } = settings || {};
|
|
14
|
-
const [moveToIdx, setMoveToIdx] = useState(0);
|
|
15
|
-
const itemGap = postPurchaseSpacing[ilSpacing || 'none'];
|
|
16
|
-
const itemPerRow = ()=>{
|
|
17
|
-
const itemPerRowDefault = 5;
|
|
18
|
-
let itemPerRow = itemPerRowDefault;
|
|
19
|
-
switch(layoutType){
|
|
20
|
-
case 'bottom-center':
|
|
21
|
-
itemPerRow = ilItemPerSlide || itemPerRowDefault;
|
|
22
|
-
break;
|
|
23
|
-
case 'two-col':
|
|
24
|
-
itemPerRow = 2;
|
|
25
|
-
break;
|
|
26
|
-
default:
|
|
27
|
-
itemPerRow = ilItemPerSlide || itemPerRowDefault;
|
|
28
|
-
}
|
|
29
|
-
return itemPerRow;
|
|
30
|
-
};
|
|
31
|
-
const maxIdx = productImages.length - Number(ilItemPerSlide || 0);
|
|
32
|
-
const vertical = layoutType === 'bottom-center' ? false : true;
|
|
33
|
-
return /*#__PURE__*/ jsx("div", {
|
|
34
|
-
className: "",
|
|
35
|
-
children: /*#__PURE__*/ jsxs("div", {
|
|
36
|
-
className: "gp-flex gp-items-center gp-justify-center",
|
|
37
|
-
style: {
|
|
38
|
-
flexDirection: layoutType === 'bottom-center' ? 'row' : 'column',
|
|
39
|
-
gap: parseInt(itemGap || '0px')
|
|
40
|
-
},
|
|
41
|
-
children: [
|
|
42
|
-
/*#__PURE__*/ jsx(ArrowPostPurchase, {
|
|
43
|
-
moveToIdx: moveToIdx,
|
|
44
|
-
setMoveToIdx: setMoveToIdx,
|
|
45
|
-
maxIdx: maxIdx,
|
|
46
|
-
type: "prev",
|
|
47
|
-
navigation: settings?.ilNavigation,
|
|
48
|
-
vertical: vertical,
|
|
49
|
-
layoutType: layoutType
|
|
50
|
-
}),
|
|
51
|
-
/*#__PURE__*/ jsx(CarouselPostPurchase, {
|
|
52
|
-
productImages: productImages,
|
|
53
|
-
moveToIdx: moveToIdx,
|
|
54
|
-
itemPerRow: itemPerRow(),
|
|
55
|
-
ilBorder: settings?.ilBorder,
|
|
56
|
-
ilAspectRatio: ilAspectRatio,
|
|
57
|
-
ilObjectFit: ilObjectFit
|
|
58
|
-
}),
|
|
59
|
-
/*#__PURE__*/ jsx(ArrowPostPurchase, {
|
|
60
|
-
moveToIdx: moveToIdx,
|
|
61
|
-
setMoveToIdx: setMoveToIdx,
|
|
62
|
-
maxIdx: maxIdx,
|
|
63
|
-
type: "next",
|
|
64
|
-
navigation: settings?.ilNavigation,
|
|
65
|
-
vertical: vertical,
|
|
66
|
-
layoutType: layoutType
|
|
67
|
-
})
|
|
68
|
-
]
|
|
6
|
+
const ImageListCarousel = (props)=>{
|
|
7
|
+
return /*#__PURE__*/ jsx(CarouselProvider, {
|
|
8
|
+
children: /*#__PURE__*/ jsx(CarouselWrapperPostPurchase, {
|
|
9
|
+
...props
|
|
69
10
|
})
|
|
70
11
|
});
|
|
71
12
|
};
|
|
@@ -1,81 +1,37 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import PostPurchaseImage from '../../../image/components/Image.js';
|
|
5
3
|
import { postPurchaseSpacing } from '../../../utils/helper.js';
|
|
6
|
-
import {
|
|
4
|
+
import { createClass, createStyle } from '@gem-sdk/system';
|
|
5
|
+
import { getImageGridClass } from '../../common/getClasses.js';
|
|
6
|
+
import { getImageGridStyle } from '../../common/getStyles.js';
|
|
7
|
+
import { ItemGridPostPurchase } from './ItemGridPostPurchase.js';
|
|
8
|
+
import { useSlideCarousel } from '../../hooks/product-image/useSlideCarousel.js';
|
|
7
9
|
|
|
8
10
|
const ImageListGrid = ({ styles, setting, productImages })=>{
|
|
9
11
|
const settings = {
|
|
10
12
|
...styles,
|
|
11
13
|
...setting
|
|
12
14
|
};
|
|
13
|
-
const { ilObjectFit, ilAspectRatio, layoutType, ilNumberPerRow, ilSpacing } = settings;
|
|
14
|
-
const itemGap =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
itemPerRow = ilNumberPerRow || itemPerRowDefault;
|
|
25
|
-
break;
|
|
26
|
-
case 'two-col':
|
|
27
|
-
itemPerRow = 2;
|
|
28
|
-
break;
|
|
29
|
-
case 'one-col':
|
|
30
|
-
itemPerRow = 1;
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
itemPerRow = itemPerRowDefault;
|
|
34
|
-
}
|
|
35
|
-
return itemPerRow;
|
|
36
|
-
}, [
|
|
37
|
-
ilNumberPerRow,
|
|
38
|
-
layoutType
|
|
39
|
-
]);
|
|
40
|
-
const setProductFeaturedImage = useProductStore((s)=>s.setProductFeaturedImage);
|
|
41
|
-
const featuredImageGlobal = useFeaturedImageGlobal();
|
|
15
|
+
const { ilObjectFit, ilAspectRatio, layoutType, ilNumberPerRow, ilSpacing, ilBorder } = settings;
|
|
16
|
+
const itemGap = postPurchaseSpacing[ilSpacing || 'none'];
|
|
17
|
+
const { itemSlideGrid } = useSlideCarousel({
|
|
18
|
+
layoutType,
|
|
19
|
+
ilNumberPerRow
|
|
20
|
+
});
|
|
21
|
+
const gridClass = createClass(getImageGridClass());
|
|
22
|
+
const gridStyle = createStyle(getImageGridStyle({
|
|
23
|
+
gap: itemGap,
|
|
24
|
+
itemSlide: itemSlideGrid
|
|
25
|
+
}));
|
|
42
26
|
return /*#__PURE__*/ jsx("div", {
|
|
43
|
-
className:
|
|
44
|
-
style:
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
},
|
|
52
|
-
children: productImages?.map((image)=>{
|
|
53
|
-
const source = {
|
|
54
|
-
src: image.src,
|
|
55
|
-
alt: ''
|
|
56
|
-
};
|
|
57
|
-
return /*#__PURE__*/ jsx("div", {
|
|
58
|
-
"aria-hidden": "true",
|
|
59
|
-
className: `gp-w-full gp-border gp-border-transparent ${featuredImageGlobal?.id === image?.id && settings?.ilBorder !== 'none' ? '!gp-border-[#d9d9d9]' : ''}`,
|
|
60
|
-
onClick: ()=>{
|
|
61
|
-
setProductFeaturedImage(image);
|
|
62
|
-
},
|
|
63
|
-
children: /*#__PURE__*/ jsx(PostPurchaseImage, {
|
|
64
|
-
setting: {
|
|
65
|
-
srcSet: {
|
|
66
|
-
desktop: source,
|
|
67
|
-
mobile: source,
|
|
68
|
-
tablet: source
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
styles: {
|
|
72
|
-
aspectRatio: ilAspectRatio,
|
|
73
|
-
objectFit: ilObjectFit,
|
|
74
|
-
enableBorder: 'none'
|
|
75
|
-
}
|
|
76
|
-
}, image?.src)
|
|
77
|
-
}, image?.src);
|
|
78
|
-
})
|
|
27
|
+
className: gridClass,
|
|
28
|
+
style: gridStyle,
|
|
29
|
+
children: productImages?.map((image)=>/*#__PURE__*/ jsx(ItemGridPostPurchase, {
|
|
30
|
+
image: image,
|
|
31
|
+
border: ilBorder,
|
|
32
|
+
aspectRatio: ilAspectRatio,
|
|
33
|
+
objectFit: ilObjectFit
|
|
34
|
+
}, image.src))
|
|
79
35
|
});
|
|
80
36
|
};
|
|
81
37
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useFeaturedImageGlobal, useProductStore } from '@gem-sdk/core';
|
|
4
|
+
import { PostPurchaseImage } from '../../../image/next.js';
|
|
5
|
+
import { createClass } from '@gem-sdk/system';
|
|
6
|
+
import { getItemCarouselPostPurchaseClass } from '../../common/getClasses.js';
|
|
7
|
+
|
|
8
|
+
const ItemCarouselPostPurchase = (props)=>{
|
|
9
|
+
const { image, border, aspectRatio, objectFit } = props;
|
|
10
|
+
const featuredImageGlobal = useFeaturedImageGlobal();
|
|
11
|
+
const setProductFeaturedImage = useProductStore((s)=>s.setProductFeaturedImage);
|
|
12
|
+
const classes = createClass(getItemCarouselPostPurchaseClass({
|
|
13
|
+
border: image?.id === featuredImageGlobal?.id && border !== 'none'
|
|
14
|
+
}));
|
|
15
|
+
const source = {
|
|
16
|
+
src: image?.src || 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
|
|
17
|
+
alt: ''
|
|
18
|
+
};
|
|
19
|
+
return /*#__PURE__*/ jsx("div", {
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
className: classes,
|
|
22
|
+
onClick: ()=>setProductFeaturedImage(image),
|
|
23
|
+
children: /*#__PURE__*/ jsx(PostPurchaseImage, {
|
|
24
|
+
setting: {
|
|
25
|
+
srcSet: {
|
|
26
|
+
desktop: source,
|
|
27
|
+
mobile: source,
|
|
28
|
+
tablet: source
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
styles: {
|
|
32
|
+
aspectRatio: aspectRatio,
|
|
33
|
+
objectFit: objectFit,
|
|
34
|
+
enableBorder: 'none'
|
|
35
|
+
}
|
|
36
|
+
}, image?.src)
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { ItemCarouselPostPurchase };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useFeaturedImageGlobal, useProductStore } from '@gem-sdk/core';
|
|
4
|
+
import { PostPurchaseImage } from '../../../image/next.js';
|
|
5
|
+
import { createClass } from '@gem-sdk/system';
|
|
6
|
+
import { getItemCarouselPostPurchaseClass } from '../../common/getClasses.js';
|
|
7
|
+
|
|
8
|
+
const ItemGridPostPurchase = (props)=>{
|
|
9
|
+
const { image, border, aspectRatio, objectFit } = props;
|
|
10
|
+
const featuredImageGlobal = useFeaturedImageGlobal();
|
|
11
|
+
const setProductFeaturedImage = useProductStore((s)=>s.setProductFeaturedImage);
|
|
12
|
+
const source = {
|
|
13
|
+
src: image.src,
|
|
14
|
+
alt: ''
|
|
15
|
+
};
|
|
16
|
+
const classes = createClass(getItemCarouselPostPurchaseClass({
|
|
17
|
+
border: image?.id === featuredImageGlobal?.id && border !== 'none'
|
|
18
|
+
}));
|
|
19
|
+
return /*#__PURE__*/ jsx("div", {
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
className: classes,
|
|
22
|
+
onClick: ()=>setProductFeaturedImage(image),
|
|
23
|
+
children: /*#__PURE__*/ jsx(PostPurchaseImage, {
|
|
24
|
+
setting: {
|
|
25
|
+
srcSet: {
|
|
26
|
+
desktop: source,
|
|
27
|
+
mobile: source,
|
|
28
|
+
tablet: source
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
styles: {
|
|
32
|
+
aspectRatio: aspectRatio,
|
|
33
|
+
objectFit: objectFit,
|
|
34
|
+
enableBorder: 'none'
|
|
35
|
+
}
|
|
36
|
+
}, image?.src)
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { ItemGridPostPurchase };
|
package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { createClass } from '@gem-sdk/system';
|
|
4
|
+
import { getNavigationClass } from '../../../common/getClasses.js';
|
|
5
|
+
import '@gem-sdk/core';
|
|
6
|
+
import { useNavigationCarouselPostPurchase } from '../../../hooks/product-image/useNavigationCarouselPostPurchase.js';
|
|
7
|
+
|
|
8
|
+
const ArrowPostPurchase = (props)=>{
|
|
9
|
+
const { type, navigation, vertical, hidden = false } = props;
|
|
10
|
+
const { imgSrc, handleClick, disabled } = useNavigationCarouselPostPurchase({
|
|
11
|
+
type,
|
|
12
|
+
vertical
|
|
13
|
+
});
|
|
14
|
+
const classes = createClass(getNavigationClass());
|
|
15
|
+
if (navigation === 'none' || hidden) return null;
|
|
16
|
+
return /*#__PURE__*/ jsx("button", {
|
|
17
|
+
className: classes,
|
|
18
|
+
disabled: disabled,
|
|
19
|
+
onClick: handleClick,
|
|
20
|
+
children: /*#__PURE__*/ jsx("img", {
|
|
21
|
+
src: imgSrc,
|
|
22
|
+
alt: `gp-arrow-${type}`
|
|
23
|
+
})
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export { ArrowPostPurchase };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { ItemCarouselPostPurchase } from '../ItemCarouselPostPurchase.js';
|
|
4
|
+
import { createClass } from '@gem-sdk/system';
|
|
5
|
+
import { getItemCarouseEmptyPostPurchaseClass } from '../../../common/getClasses.js';
|
|
6
|
+
import '@gem-sdk/core';
|
|
7
|
+
import { useListCarousel } from '../../../hooks/product-image/useListCarousel.js';
|
|
8
|
+
|
|
9
|
+
const CarouselPostPurchase = (props)=>{
|
|
10
|
+
const { productImages, itemPerRow, border, aspectRatio, objectFit } = props;
|
|
11
|
+
const { listRender } = useListCarousel({
|
|
12
|
+
productImages,
|
|
13
|
+
itemPerRow
|
|
14
|
+
});
|
|
15
|
+
const itemEmptyClass = createClass(getItemCarouseEmptyPostPurchaseClass());
|
|
16
|
+
return /*#__PURE__*/ jsx(Fragment, {
|
|
17
|
+
children: listRender?.map((image, index)=>{
|
|
18
|
+
if (!image) {
|
|
19
|
+
return /*#__PURE__*/ jsx("div", {
|
|
20
|
+
className: itemEmptyClass
|
|
21
|
+
}, index);
|
|
22
|
+
}
|
|
23
|
+
return /*#__PURE__*/ jsx(ItemCarouselPostPurchase, {
|
|
24
|
+
image: image,
|
|
25
|
+
border: border,
|
|
26
|
+
objectFit: objectFit,
|
|
27
|
+
aspectRatio: aspectRatio
|
|
28
|
+
}, image.id);
|
|
29
|
+
})
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export { CarouselPostPurchase };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useState, createContext } from 'react';
|
|
3
|
+
|
|
4
|
+
const CarouselPostPurchaseContext = /*#__PURE__*/ createContext(undefined);
|
|
5
|
+
const CarouselProvider = ({ children })=>{
|
|
6
|
+
const [moveToIdx, setMoveToIdx] = useState(0);
|
|
7
|
+
const [maxIdx, setMaxIdx] = useState(0);
|
|
8
|
+
return /*#__PURE__*/ jsx(CarouselPostPurchaseContext.Provider, {
|
|
9
|
+
value: {
|
|
10
|
+
moveToIdx,
|
|
11
|
+
setMoveToIdx,
|
|
12
|
+
maxIdx,
|
|
13
|
+
setMaxIdx
|
|
14
|
+
},
|
|
15
|
+
children: children
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { CarouselPostPurchaseContext, CarouselProvider };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { postPurchaseSpacing } from '../../../../utils/helper.js';
|
|
5
|
+
import { getImageListClass } from '../../../common/getClasses.js';
|
|
6
|
+
import { getImageListStyle } from '../../../common/getStyles.js';
|
|
7
|
+
import { createClass, createStyle } from '@gem-sdk/system';
|
|
8
|
+
import { ArrowPostPurchase } from './Arrow.js';
|
|
9
|
+
import { CarouselPostPurchase } from './CarouselPostPurchase.js';
|
|
10
|
+
import { useCarousel } from '../../../hooks/product-image/useCarousel.js';
|
|
11
|
+
|
|
12
|
+
// ImageListCarousel.tsx
|
|
13
|
+
|
|
14
|
+
const CarouselWrapperPostPurchase = ({ styles, setting, productImages, objectFit = 'cover', aspectRatio, itemPerSlide = 1, spacing, navigation = 'none', vertical = false, border = 'none', idxActive })=>{
|
|
15
|
+
const settings = {
|
|
16
|
+
...styles,
|
|
17
|
+
...setting
|
|
18
|
+
};
|
|
19
|
+
const { layoutType } = settings || {};
|
|
20
|
+
const { setMoveToIdx, setMaxIdx } = useCarousel();
|
|
21
|
+
const itemGap = postPurchaseSpacing[spacing || 'none'] ?? '0px';
|
|
22
|
+
const isHiddenIcon = layoutType === 'one-col' ? true : false;
|
|
23
|
+
const classes = createClass(getImageListClass());
|
|
24
|
+
const style = createStyle(getImageListStyle({
|
|
25
|
+
gap: itemGap,
|
|
26
|
+
vertical
|
|
27
|
+
}));
|
|
28
|
+
useEffect(()=>{
|
|
29
|
+
const newMaxIdx = productImages.length - Number(itemPerSlide || 0);
|
|
30
|
+
setMaxIdx(newMaxIdx);
|
|
31
|
+
}, [
|
|
32
|
+
productImages.length,
|
|
33
|
+
itemPerSlide,
|
|
34
|
+
setMaxIdx
|
|
35
|
+
]);
|
|
36
|
+
useEffect(()=>{
|
|
37
|
+
if (!idxActive) return;
|
|
38
|
+
if (itemPerSlide === 1) setMoveToIdx(idxActive);
|
|
39
|
+
}, [
|
|
40
|
+
idxActive,
|
|
41
|
+
itemPerSlide,
|
|
42
|
+
setMoveToIdx
|
|
43
|
+
]);
|
|
44
|
+
return /*#__PURE__*/ jsx("div", {
|
|
45
|
+
children: /*#__PURE__*/ jsxs("div", {
|
|
46
|
+
className: classes,
|
|
47
|
+
style: style,
|
|
48
|
+
children: [
|
|
49
|
+
/*#__PURE__*/ jsx(ArrowPostPurchase, {
|
|
50
|
+
type: "prev",
|
|
51
|
+
navigation: navigation,
|
|
52
|
+
vertical: vertical,
|
|
53
|
+
hidden: isHiddenIcon
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ jsx(CarouselPostPurchase, {
|
|
56
|
+
productImages: productImages,
|
|
57
|
+
itemPerRow: itemPerSlide,
|
|
58
|
+
border: border,
|
|
59
|
+
aspectRatio: aspectRatio,
|
|
60
|
+
objectFit: objectFit
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ jsx(ArrowPostPurchase, {
|
|
63
|
+
type: "next",
|
|
64
|
+
navigation: navigation,
|
|
65
|
+
vertical: vertical,
|
|
66
|
+
hidden: isHiddenIcon
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { CarouselWrapperPostPurchase };
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import { useProduct
|
|
4
|
+
import { useProduct } from '@gem-sdk/core';
|
|
5
5
|
import FeatureImageWithGalleryImage from './layouts/FeatureImageWithGalleryImage.js';
|
|
6
|
-
import { getPostPurchaseAlignClasses } from '../../helpers/index.js';
|
|
7
6
|
import FeatureImage from './FeatureImage.js';
|
|
8
7
|
import OnlyGalleryImage from './layouts/OnlyGalleryImage.js';
|
|
8
|
+
import { createClass, createStyle } from '@gem-sdk/system';
|
|
9
|
+
import { getProductImageClass } from '../../common/getClasses.js';
|
|
9
10
|
|
|
10
11
|
const PostPurchaseProductImages = (props)=>{
|
|
11
|
-
const { setting, styles, builderProps, builderAttrs, style, children
|
|
12
|
+
const { setting, styles, builderProps, builderAttrs, style, children } = props;
|
|
12
13
|
const settings = {
|
|
13
14
|
...setting,
|
|
14
15
|
...styles
|
|
15
16
|
};
|
|
16
|
-
const { layoutType } = settings;
|
|
17
|
-
const extraClass = advanced?.cssClass;
|
|
17
|
+
const { layoutType = 'bottom-center' } = settings;
|
|
18
18
|
const product = useProduct();
|
|
19
19
|
const getProductGallery = (product)=>{
|
|
20
20
|
return product?.medias?.edges.filter((item)=>![
|
|
@@ -50,48 +50,46 @@ const PostPurchaseProductImages = (props)=>{
|
|
|
50
50
|
}, [
|
|
51
51
|
product
|
|
52
52
|
]);
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
53
|
+
const renderLayout = ()=>{
|
|
54
|
+
if ([
|
|
55
|
+
'bottom-center',
|
|
56
|
+
'left',
|
|
57
|
+
'right'
|
|
58
|
+
].includes(layoutType)) return /*#__PURE__*/ jsx(FeatureImageWithGalleryImage, {
|
|
59
|
+
gallery: gallery,
|
|
60
|
+
builderProps: builderProps,
|
|
61
|
+
setting: setting,
|
|
62
|
+
styles: styles
|
|
63
|
+
});
|
|
64
|
+
if ([
|
|
65
|
+
'one-col',
|
|
66
|
+
'two-col'
|
|
67
|
+
].includes(layoutType)) return /*#__PURE__*/ jsx(OnlyGalleryImage, {
|
|
68
|
+
gallery: gallery,
|
|
69
|
+
builderProps: builderProps,
|
|
70
|
+
setting: setting,
|
|
71
|
+
styles: styles
|
|
72
|
+
});
|
|
73
|
+
return /*#__PURE__*/ jsx(FeatureImage, {
|
|
74
|
+
gallery: gallery,
|
|
75
|
+
styles: styles,
|
|
76
|
+
setting: setting
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const alignClass = createClass(getProductImageClass({
|
|
80
|
+
align: settings?.align
|
|
81
|
+
}));
|
|
82
|
+
const containerStyle = createStyle({
|
|
83
|
+
...style
|
|
84
|
+
});
|
|
68
85
|
return /*#__PURE__*/ jsxs("div", {
|
|
69
86
|
...builderAttrs,
|
|
70
|
-
className:
|
|
71
|
-
style:
|
|
72
|
-
...style
|
|
73
|
-
},
|
|
87
|
+
className: alignClass,
|
|
88
|
+
style: containerStyle,
|
|
74
89
|
children: [
|
|
75
|
-
/*#__PURE__*/
|
|
76
|
-
className:
|
|
77
|
-
children:
|
|
78
|
-
isShowFeatureImageWithGallery && /*#__PURE__*/ jsx(FeatureImageWithGalleryImage, {
|
|
79
|
-
gallery: gallery,
|
|
80
|
-
builderProps: builderProps,
|
|
81
|
-
setting: setting,
|
|
82
|
-
styles: styles
|
|
83
|
-
}),
|
|
84
|
-
isShowOnlyFeatureImage && /*#__PURE__*/ jsx(FeatureImage, {
|
|
85
|
-
styles: styles,
|
|
86
|
-
setting: setting
|
|
87
|
-
}),
|
|
88
|
-
isShowOnlyGalleryImage && /*#__PURE__*/ jsx(OnlyGalleryImage, {
|
|
89
|
-
gallery: gallery,
|
|
90
|
-
builderProps: builderProps,
|
|
91
|
-
setting: setting,
|
|
92
|
-
styles: styles
|
|
93
|
-
})
|
|
94
|
-
]
|
|
90
|
+
/*#__PURE__*/ jsx("div", {
|
|
91
|
+
className: alignClass,
|
|
92
|
+
children: renderLayout()
|
|
95
93
|
}),
|
|
96
94
|
children
|
|
97
95
|
]
|
|
@@ -1,75 +1,39 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
import { cls, makeStyle } from '@gem-sdk/core';
|
|
5
|
-
import { postPurchaseSpacing } from '../../../../utils/helper.js';
|
|
6
3
|
import FeatureImage from '../FeatureImage.js';
|
|
7
4
|
import OnlyGalleryImage from './OnlyGalleryImage.js';
|
|
5
|
+
import { createStyle, createClass } from '@gem-sdk/system';
|
|
6
|
+
import { getFeatureImageClass, getProductImageLayoutClass } from '../../../common/getClasses.js';
|
|
7
|
+
import { getProductImageLayoutStyle, getAlignStyle } from '../../../common/getStyles.js';
|
|
8
|
+
import { useProductImagePostPurchase } from '../../../hooks/product-image/useProductImagePostPurchase.js';
|
|
8
9
|
|
|
9
10
|
const FeatureImageWithGalleryImage = (productImageProps)=>{
|
|
10
|
-
const { setting, styles,
|
|
11
|
+
const { setting, styles, gallery } = productImageProps;
|
|
11
12
|
const settings = {
|
|
12
13
|
...setting,
|
|
13
14
|
...styles
|
|
14
15
|
};
|
|
15
|
-
const { layoutType } = settings;
|
|
16
|
-
const isShowGalleryImages =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
if (isShowGalleryImages) {
|
|
26
|
-
const ratioLayout = layoutType === 'left' ? settings.ratioLayoutLeft : settings.ratioLayoutRight;
|
|
27
|
-
const isHorizontalLayout = [
|
|
28
|
-
'left',
|
|
29
|
-
'right'
|
|
30
|
-
].includes(layoutType || '');
|
|
31
|
-
if (isHorizontalLayout && ratioLayout) {
|
|
32
|
-
result = {
|
|
33
|
-
...result,
|
|
34
|
-
'--gtc': `minmax(0, ${ratioLayout[0]}fr) minmax(0, ${ratioLayout[1]}fr)`
|
|
35
|
-
};
|
|
36
|
-
Object.assign(result, {
|
|
37
|
-
'--gtr': 'fit-content(0)'
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return result;
|
|
42
|
-
}, [
|
|
43
|
-
isShowGalleryImages,
|
|
44
|
-
layoutType,
|
|
45
|
-
settings.ratioLayoutLeft,
|
|
46
|
-
settings.ratioLayoutRight
|
|
47
|
-
]);
|
|
48
|
-
const itemGap = useMemo(()=>{
|
|
49
|
-
if (layoutType === 'bottom-center') {
|
|
50
|
-
return postPurchaseSpacing[settings?.spacingVertical || 'none'];
|
|
51
|
-
}
|
|
52
|
-
return settings?.spacingHoz;
|
|
53
|
-
}, [
|
|
16
|
+
const { layoutType = 'bottom-center' } = settings;
|
|
17
|
+
const { itemGap, gridLayout, isShowGalleryImages } = useProductImagePostPurchase({
|
|
18
|
+
imageList: gallery,
|
|
19
|
+
setting
|
|
20
|
+
});
|
|
21
|
+
const containerStyle = createStyle(getProductImageLayoutStyle({
|
|
22
|
+
gap: itemGap
|
|
23
|
+
}, gridLayout));
|
|
24
|
+
const style = createStyle(getAlignStyle({
|
|
54
25
|
layoutType,
|
|
55
|
-
settings?.
|
|
56
|
-
|
|
57
|
-
|
|
26
|
+
align: settings?.align
|
|
27
|
+
}));
|
|
28
|
+
const classes = createClass(getFeatureImageClass());
|
|
29
|
+
const containerClasses = createClass(getProductImageLayoutClass());
|
|
58
30
|
return /*#__PURE__*/ jsxs("div", {
|
|
59
|
-
className:
|
|
60
|
-
style:
|
|
61
|
-
...gridLayout,
|
|
62
|
-
...makeStyle({
|
|
63
|
-
gg: itemGap
|
|
64
|
-
})
|
|
65
|
-
},
|
|
31
|
+
className: containerClasses,
|
|
32
|
+
style: containerStyle,
|
|
66
33
|
children: [
|
|
67
34
|
/*#__PURE__*/ jsx("div", {
|
|
68
|
-
className:
|
|
69
|
-
style:
|
|
70
|
-
'--o': layoutType === 'left' ? `1` : '0',
|
|
71
|
-
'--jc': styles?.align === 'left' ? 'flex-start' : styles?.align === 'right' ? 'flex-end' : 'center'
|
|
72
|
-
},
|
|
35
|
+
className: classes,
|
|
36
|
+
style: style,
|
|
73
37
|
children: /*#__PURE__*/ jsx(FeatureImage, {
|
|
74
38
|
...productImageProps
|
|
75
39
|
})
|