@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.
Files changed (106) hide show
  1. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +3 -2
  2. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +3 -2
  3. package/dist/cjs/grid/row/setting/configs/settings.js +9 -83
  4. package/dist/cjs/grid/section/setting/configs/settings.js +13 -75
  5. package/dist/cjs/icon-list-hoz/setting/configs/settings.js +4 -17
  6. package/dist/cjs/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
  7. package/dist/cjs/post-purchase/line/setting/configs/settings.js +3 -1
  8. package/dist/cjs/post-purchase/line/setting/configs/uiV2.js +2 -1
  9. package/dist/cjs/post-purchase/link/components/PostPurchaseLink.js +23 -14
  10. package/dist/cjs/post-purchase/link/components/common/getClasses.js +7 -1
  11. package/dist/cjs/post-purchase/link/setting/configs/settings.js +21 -14
  12. package/dist/cjs/post-purchase/product/common/getClasses.js +45 -0
  13. package/dist/cjs/post-purchase/product/common/getStyles.js +43 -0
  14. package/dist/cjs/post-purchase/product/components/product-image/FeatureImage.js +32 -42
  15. package/dist/cjs/post-purchase/product/components/product-image/ImageListCarousel.js +6 -65
  16. package/dist/cjs/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
  17. package/dist/cjs/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +42 -0
  18. package/dist/cjs/post-purchase/product/components/product-image/ItemGridPostPurchase.js +42 -0
  19. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +29 -0
  20. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +35 -0
  21. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +22 -0
  22. package/dist/cjs/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +75 -0
  23. package/dist/cjs/post-purchase/product/components/product-image/index.js +41 -43
  24. package/dist/cjs/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
  25. package/dist/cjs/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
  26. package/dist/cjs/post-purchase/product/constants/index.js +36 -0
  27. package/dist/cjs/post-purchase/product/hooks/product-image/useCarousel.js +14 -0
  28. package/dist/cjs/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +32 -0
  29. package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +43 -0
  30. package/dist/cjs/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +32 -0
  31. package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +60 -0
  32. package/dist/cjs/post-purchase/product/hooks/product-image/useSlideCarousel.js +35 -0
  33. package/dist/cjs/post-purchase/product/settings/product-description/settingV2.js +6 -9
  34. package/dist/cjs/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
  35. package/dist/cjs/post-purchase/product/settings/product-image/ProductGalleryImage.js +0 -118
  36. package/dist/cjs/post-purchase/product/settings/product-image/ProductImages.js +8 -79
  37. package/dist/cjs/post-purchase/product/settings/product-image/setting-v1.js +163 -0
  38. package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +375 -0
  39. package/dist/cjs/post-purchase/product/settings/product-image/uiV1.js +42 -0
  40. package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +235 -0
  41. package/dist/cjs/post-purchase/product/settings/product-price/uiV2.js +0 -3
  42. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
  43. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
  44. package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
  45. package/dist/cjs/post-purchase/product/settings/product-title/settingV2.js +6 -9
  46. package/dist/cjs/post-purchase/text/settings/text/settingV2.js +0 -7
  47. package/dist/cjs/product/components/FileUpload/components/common/index.js +3 -2
  48. package/dist/cjs/product/setting/product/configs/presets.js +1 -1
  49. package/dist/cjs/product/setting/product/configs/settings.js +4 -20
  50. package/dist/cjs/setting.js +2 -1
  51. package/dist/esm/banner/components/HeroBannerItem.liquid.js +3 -2
  52. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +3 -2
  53. package/dist/esm/grid/row/setting/configs/settings.js +9 -83
  54. package/dist/esm/grid/section/setting/configs/settings.js +13 -75
  55. package/dist/esm/icon-list-hoz/setting/configs/settings.js +4 -17
  56. package/dist/esm/post-purchase/advanced-list/setting/configs/uiV2.js +3 -15
  57. package/dist/esm/post-purchase/line/setting/configs/settings.js +3 -1
  58. package/dist/esm/post-purchase/line/setting/configs/uiV2.js +2 -1
  59. package/dist/esm/post-purchase/link/components/PostPurchaseLink.js +25 -16
  60. package/dist/esm/post-purchase/link/components/common/getClasses.js +7 -2
  61. package/dist/esm/post-purchase/link/setting/configs/settings.js +21 -14
  62. package/dist/esm/post-purchase/product/common/getClasses.js +37 -1
  63. package/dist/esm/post-purchase/product/common/getStyles.js +39 -1
  64. package/dist/esm/post-purchase/product/components/product-image/FeatureImage.js +32 -42
  65. package/dist/esm/post-purchase/product/components/product-image/ImageListCarousel.js +7 -66
  66. package/dist/esm/post-purchase/product/components/product-image/ImageListGrid.js +24 -68
  67. package/dist/esm/post-purchase/product/components/product-image/ItemCarouselPostPurchase.js +40 -0
  68. package/dist/esm/post-purchase/product/components/product-image/ItemGridPostPurchase.js +40 -0
  69. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/Arrow.js +27 -0
  70. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchase.js +33 -0
  71. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselPostPurchaseContext.js +19 -0
  72. package/dist/esm/post-purchase/product/components/product-image/carousel-post-purchase/CarouselWrapperPostPurchase.js +73 -0
  73. package/dist/esm/post-purchase/product/components/product-image/index.js +42 -44
  74. package/dist/esm/post-purchase/product/components/product-image/layouts/FeatureImageWithGalleryImage.js +22 -58
  75. package/dist/esm/post-purchase/product/components/product-image/layouts/OnlyGalleryImage.js +19 -12
  76. package/dist/esm/post-purchase/product/constants/index.js +34 -0
  77. package/dist/esm/post-purchase/product/hooks/product-image/useCarousel.js +12 -0
  78. package/dist/esm/post-purchase/product/hooks/product-image/useFeatureImagePostPurchase.js +30 -0
  79. package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +41 -0
  80. package/dist/esm/post-purchase/product/hooks/product-image/useNavigationCarouselPostPurchase.js +30 -0
  81. package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +58 -0
  82. package/dist/esm/post-purchase/product/hooks/product-image/useSlideCarousel.js +33 -0
  83. package/dist/esm/post-purchase/product/settings/product-description/settingV2.js +6 -9
  84. package/dist/esm/post-purchase/product/settings/product-image/ProductFeatureImage.js +41 -0
  85. package/dist/esm/post-purchase/product/settings/product-image/ProductGalleryImage.js +1 -118
  86. package/dist/esm/post-purchase/product/settings/product-image/ProductImages.js +8 -79
  87. package/dist/esm/post-purchase/product/settings/product-image/setting-v1.js +161 -0
  88. package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +373 -0
  89. package/dist/esm/post-purchase/product/settings/product-image/uiV1.js +40 -0
  90. package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +233 -0
  91. package/dist/esm/post-purchase/product/settings/product-price/uiV2.js +0 -3
  92. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +10 -6
  93. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +2 -2
  94. package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +3 -1
  95. package/dist/esm/post-purchase/product/settings/product-title/settingV2.js +6 -9
  96. package/dist/esm/post-purchase/text/settings/text/settingV2.js +0 -7
  97. package/dist/esm/product/components/FileUpload/components/common/index.js +3 -2
  98. package/dist/esm/product/setting/product/configs/presets.js +1 -1
  99. package/dist/esm/product/setting/product/configs/settings.js +4 -20
  100. package/dist/esm/setting.js +2 -1
  101. package/dist/types/index.d.ts +12 -5
  102. package/package.json +4 -4
  103. package/dist/cjs/post-purchase/product/components/product-image/Arrow.js +0 -60
  104. package/dist/cjs/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -78
  105. package/dist/esm/post-purchase/product/components/product-image/Arrow.js +0 -58
  106. package/dist/esm/post-purchase/product/components/product-image/CarouselPostPurchase.js +0 -76
@@ -21,24 +21,31 @@ const PostPurchaseLinkSettings = [
21
21
  },
22
22
  {
23
23
  id: 'width',
24
- type: 'input:unit-width',
24
+ type: 'dropdown:input',
25
25
  label: 'Width',
26
- min: 0,
26
+ inputType: 'number',
27
27
  units: [
28
28
  'px',
29
29
  '%'
30
30
  ],
31
+ hideUnit: false,
31
32
  devices: {
32
33
  desktop: {
33
34
  default: '100%'
35
+ }
36
+ },
37
+ displayOptions: [
38
+ {
39
+ label: 'Full',
40
+ value: '100%',
41
+ showValue: true
34
42
  },
35
- tablet: {
36
- default: '100%'
37
- },
38
- mobile: {
39
- default: '100%'
43
+ {
44
+ label: 'Default',
45
+ value: '1200px',
46
+ showValue: true
40
47
  }
41
- }
48
+ ]
42
49
  }
43
50
  ]
44
51
  },
@@ -95,22 +102,22 @@ const PostPurchaseLinkSettings = [
95
102
  type: 'option:value',
96
103
  options: [
97
104
  {
98
- label: 'Left',
99
105
  value: 'left',
100
106
  type: 'text',
101
- tooltip: 'Align left'
107
+ tooltip: 'Align left',
108
+ iconName: 'polaris-text-align-left'
102
109
  },
103
110
  {
104
- label: 'Center',
105
111
  value: 'center',
106
112
  type: 'text',
107
- tooltip: 'Align center'
113
+ tooltip: 'Align center',
114
+ iconName: 'polaris-text-align-center'
108
115
  },
109
116
  {
110
- label: 'Right',
111
117
  value: 'right',
112
118
  type: 'text',
113
- tooltip: 'Align right'
119
+ tooltip: 'Align right',
120
+ iconName: 'polaris-text-align-right'
114
121
  }
115
122
  ],
116
123
  default: 'left'
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@gem-sdk/core');
4
+ var index = require('../helpers/index.js');
4
5
 
5
6
  const getContainerClasses = ({ uid })=>{
6
7
  return {
@@ -8,5 +9,49 @@ const getContainerClasses = ({ uid })=>{
8
9
  ...core.composeClasses('gp-flex gp-w-full')
9
10
  };
10
11
  };
12
+ const getNavigationClass = ()=>{
13
+ return core.composeClasses('gp-w-[24px] gp-h-[24px] gp-shrink-0 gp-flex gp-items-center gp-justify-center');
14
+ };
15
+ const getItemCarouselPostPurchaseClass = (settings)=>{
16
+ const classList = 'gp-w-full gp-border';
17
+ return {
18
+ ...core.composeClasses(classList),
19
+ '!gp-border-[#d9d9d9]': settings?.border,
20
+ 'gp-border-transparent': !settings?.border
21
+ };
22
+ };
23
+ const getItemCarouseEmptyPostPurchaseClass = ()=>{
24
+ return core.composeClasses('gp-w-full');
25
+ };
26
+ const getImageListClass = ()=>{
27
+ return core.composeClasses('gp-flex gp-items-center gp-justify-center');
28
+ };
29
+ const getImageGridClass = ()=>{
30
+ return core.composeClasses('gp-grid gp-h-fit gp-w-full gp-flex-wrap');
31
+ };
32
+ const getProductImageClass = (settings)=>{
33
+ return {
34
+ ...core.composeClasses('gp-flex'),
35
+ [index.getPostPurchaseAlignClasses(settings?.align)]: true
36
+ };
37
+ };
38
+ const getProductImageLayoutClass = ()=>{
39
+ return core.composeClasses('gp-grid gp-w-full');
40
+ };
41
+ const getFeatureImageClass = ()=>{
42
+ return core.composeClasses('gp-flex gp-justify-center gp-h-fit gp-w-full');
43
+ };
44
+ const getOnlyFeatureLayoutClass = ()=>{
45
+ return core.composeClasses('gp-flex gp-h-fit gp-max-w-full');
46
+ };
11
47
 
12
48
  exports.getContainerClasses = getContainerClasses;
49
+ exports.getFeatureImageClass = getFeatureImageClass;
50
+ exports.getImageGridClass = getImageGridClass;
51
+ exports.getImageListClass = getImageListClass;
52
+ exports.getItemCarouseEmptyPostPurchaseClass = getItemCarouseEmptyPostPurchaseClass;
53
+ exports.getItemCarouselPostPurchaseClass = getItemCarouselPostPurchaseClass;
54
+ exports.getNavigationClass = getNavigationClass;
55
+ exports.getOnlyFeatureLayoutClass = getOnlyFeatureLayoutClass;
56
+ exports.getProductImageClass = getProductImageClass;
57
+ exports.getProductImageLayoutClass = getProductImageLayoutClass;
@@ -1,10 +1,53 @@
1
1
  'use strict';
2
2
 
3
+ var core = require('@gem-sdk/core');
4
+
3
5
  const getContainerStyles = ({ style, hasDiscount })=>{
4
6
  return {
5
7
  ...style,
6
8
  opacity: hasDiscount ? 1 : 0.2
7
9
  };
8
10
  };
11
+ const getFeatureImageStyle = (settings)=>{
12
+ return {
13
+ ...core.makeStyleResponsive('w', settings?.ftWidth)
14
+ };
15
+ };
16
+ const getImageListStyle = (settings)=>{
17
+ return {
18
+ flexDirection: settings?.vertical ? 'column' : 'row',
19
+ gap: parseInt(settings?.gap)
20
+ };
21
+ };
22
+ const getImageGridStyle = (settings, style)=>{
23
+ return {
24
+ ...style,
25
+ ...core.makeStyle({
26
+ gg: settings?.gap
27
+ }),
28
+ ...core.makeStyle({
29
+ gtc: `repeat(${settings?.itemSlide}, 1fr)`
30
+ })
31
+ };
32
+ };
33
+ const getProductImageLayoutStyle = (settings, style)=>{
34
+ return {
35
+ ...style,
36
+ ...core.makeStyle({
37
+ gg: settings?.gap
38
+ })
39
+ };
40
+ };
41
+ const getAlignStyle = (settings)=>{
42
+ return {
43
+ '--o': settings?.layoutType === 'left' ? `1` : '0',
44
+ '--jc': settings?.align === 'left' ? 'flex-start' : settings?.align === 'right' ? 'flex-end' : 'center'
45
+ };
46
+ };
9
47
 
48
+ exports.getAlignStyle = getAlignStyle;
10
49
  exports.getContainerStyles = getContainerStyles;
50
+ exports.getFeatureImageStyle = getFeatureImageStyle;
51
+ exports.getImageGridStyle = getImageGridStyle;
52
+ exports.getImageListStyle = getImageListStyle;
53
+ exports.getProductImageLayoutStyle = getProductImageLayoutStyle;
@@ -4,54 +4,44 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var core = require('@gem-sdk/core');
8
- var Image = require('../../../image/components/Image.js');
9
- var React = require('react');
7
+ var ImageListCarousel = require('./ImageListCarousel.js');
8
+ var system = require('@gem-sdk/system');
9
+ require('@gem-sdk/core');
10
+ var getStyles = require('../../common/getStyles.js');
11
+ var useFeatureImagePostPurchase = require('../../hooks/product-image/useFeatureImagePostPurchase.js');
12
+ var useSlideCarousel = require('../../hooks/product-image/useSlideCarousel.js');
10
13
 
11
- const FeatureImage = ({ styles, setting })=>{
12
- const { ftAspectRatio, ftObjectFit } = styles || {};
14
+ const FeatureImage = (productImageProps)=>{
15
+ const { styles, setting, gallery } = productImageProps;
13
16
  const settings = {
14
17
  ...setting,
15
18
  ...styles
16
19
  };
17
- const featuredImageGlobal = core.useFeaturedImageGlobal();
18
- const setProductFeaturedImage = core.useProductStore((store)=>store.setProductFeaturedImage);
19
- const currentVariant = core.useCurrentVariant();
20
- React.useEffect(()=>{
21
- if (currentVariant?.media && currentVariant.media.contentType === 'IMAGE') {
22
- setProductFeaturedImage(currentVariant.media);
23
- }
24
- }, [
25
- currentVariant,
26
- setProductFeaturedImage
27
- ]);
28
- const source = {
29
- src: featuredImageGlobal?.src || 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
30
- alt: 'Feature Image'
31
- };
32
- const width = core.makeStyleResponsive('w', settings?.ftWidth);
20
+ const { ftNavigation = 'none', ftBorder = 'none', ftItemPerSlide = 1, ftSpacing = 'xtight', ftDisplayType, layoutType, ftAspectRatio, ftObjectFit, ftWidth } = settings;
21
+ const { idxActive } = useFeatureImagePostPurchase.useFeatureImagePostPurchase({
22
+ gallery
23
+ });
24
+ const { itemSlideList } = useSlideCarousel.useSlideCarousel({
25
+ ftItemPerSlide,
26
+ layoutType
27
+ });
28
+ const navigation = ftDisplayType === 'slider' ? ftNavigation : 'none';
29
+ const style = system.createStyle(getStyles.getFeatureImageStyle({
30
+ ftWidth
31
+ }));
33
32
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
34
- style: {
35
- ...width
36
- },
37
- children: /*#__PURE__*/ jsxRuntime.jsx(Image.default, {
38
- setting: {
39
- srcSet: {
40
- desktop: source,
41
- mobile: source,
42
- tablet: source
43
- }
44
- },
45
- styles: {
46
- aspectRatio: ftAspectRatio,
47
- objectFit: ftObjectFit,
48
- width: {
49
- desktop: '100%',
50
- mobile: '100%',
51
- tablet: '100%'
52
- },
53
- enableBorder: 'none'
54
- }
33
+ style: style,
34
+ children: /*#__PURE__*/ jsxRuntime.jsx(ImageListCarousel.default, {
35
+ ...productImageProps,
36
+ productImages: gallery,
37
+ aspectRatio: ftAspectRatio,
38
+ objectFit: ftObjectFit,
39
+ spacing: ftSpacing,
40
+ navigation: navigation,
41
+ vertical: false,
42
+ border: ftBorder,
43
+ itemPerSlide: itemSlideList,
44
+ idxActive: idxActive
55
45
  })
56
46
  });
57
47
  };
@@ -4,72 +4,13 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var React = require('react');
8
- var helper = require('../../../utils/helper.js');
9
- var Arrow = require('./Arrow.js');
10
- var CarouselPostPurchase = require('./CarouselPostPurchase.js');
7
+ var CarouselPostPurchaseContext = require('./carousel-post-purchase/CarouselPostPurchaseContext.js');
8
+ var CarouselWrapperPostPurchase = require('./carousel-post-purchase/CarouselWrapperPostPurchase.js');
11
9
 
12
- const ImageListCarousel = ({ styles, setting, productImages })=>{
13
- const settings = {
14
- ...styles,
15
- ...setting
16
- };
17
- const { ilObjectFit, ilAspectRatio, ilItemPerSlide, ilSpacing, layoutType } = settings || {};
18
- const [moveToIdx, setMoveToIdx] = React.useState(0);
19
- const itemGap = helper.postPurchaseSpacing[ilSpacing || 'none'];
20
- const itemPerRow = ()=>{
21
- const itemPerRowDefault = 5;
22
- let itemPerRow = itemPerRowDefault;
23
- switch(layoutType){
24
- case 'bottom-center':
25
- itemPerRow = ilItemPerSlide || itemPerRowDefault;
26
- break;
27
- case 'two-col':
28
- itemPerRow = 2;
29
- break;
30
- default:
31
- itemPerRow = ilItemPerSlide || itemPerRowDefault;
32
- }
33
- return itemPerRow;
34
- };
35
- const maxIdx = productImages.length - Number(ilItemPerSlide || 0);
36
- const vertical = layoutType === 'bottom-center' ? false : true;
37
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
38
- className: "",
39
- children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
40
- className: "gp-flex gp-items-center gp-justify-center",
41
- style: {
42
- flexDirection: layoutType === 'bottom-center' ? 'row' : 'column',
43
- gap: parseInt(itemGap || '0px')
44
- },
45
- children: [
46
- /*#__PURE__*/ jsxRuntime.jsx(Arrow.ArrowPostPurchase, {
47
- moveToIdx: moveToIdx,
48
- setMoveToIdx: setMoveToIdx,
49
- maxIdx: maxIdx,
50
- type: "prev",
51
- navigation: settings?.ilNavigation,
52
- vertical: vertical,
53
- layoutType: layoutType
54
- }),
55
- /*#__PURE__*/ jsxRuntime.jsx(CarouselPostPurchase.CarouselPostPurchase, {
56
- productImages: productImages,
57
- moveToIdx: moveToIdx,
58
- itemPerRow: itemPerRow(),
59
- ilBorder: settings?.ilBorder,
60
- ilAspectRatio: ilAspectRatio,
61
- ilObjectFit: ilObjectFit
62
- }),
63
- /*#__PURE__*/ jsxRuntime.jsx(Arrow.ArrowPostPurchase, {
64
- moveToIdx: moveToIdx,
65
- setMoveToIdx: setMoveToIdx,
66
- maxIdx: maxIdx,
67
- type: "next",
68
- navigation: settings?.ilNavigation,
69
- vertical: vertical,
70
- layoutType: layoutType
71
- })
72
- ]
10
+ const ImageListCarousel = (props)=>{
11
+ return /*#__PURE__*/ jsxRuntime.jsx(CarouselPostPurchaseContext.CarouselProvider, {
12
+ children: /*#__PURE__*/ jsxRuntime.jsx(CarouselWrapperPostPurchase.CarouselWrapperPostPurchase, {
13
+ ...props
73
14
  })
74
15
  });
75
16
  };
@@ -4,82 +4,38 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var React = require('react');
8
- var Image = require('../../../image/components/Image.js');
9
7
  var helper = require('../../../utils/helper.js');
10
- var core = require('@gem-sdk/core');
8
+ var system = require('@gem-sdk/system');
9
+ var getClasses = require('../../common/getClasses.js');
10
+ var getStyles = require('../../common/getStyles.js');
11
+ var ItemGridPostPurchase = require('./ItemGridPostPurchase.js');
12
+ var useSlideCarousel = require('../../hooks/product-image/useSlideCarousel.js');
11
13
 
12
14
  const ImageListGrid = ({ styles, setting, productImages })=>{
13
15
  const settings = {
14
16
  ...styles,
15
17
  ...setting
16
18
  };
17
- const { ilObjectFit, ilAspectRatio, layoutType, ilNumberPerRow, ilSpacing } = settings;
18
- const itemGap = React.useMemo(()=>{
19
- return helper.postPurchaseSpacing[ilSpacing || 'none'];
20
- }, [
21
- ilSpacing
22
- ]);
23
- const itemSlide = React.useMemo(()=>{
24
- const itemPerRowDefault = 5;
25
- let itemPerRow = itemPerRowDefault;
26
- switch(layoutType){
27
- case 'bottom-center':
28
- itemPerRow = ilNumberPerRow || itemPerRowDefault;
29
- break;
30
- case 'two-col':
31
- itemPerRow = 2;
32
- break;
33
- case 'one-col':
34
- itemPerRow = 1;
35
- break;
36
- default:
37
- itemPerRow = itemPerRowDefault;
38
- }
39
- return itemPerRow;
40
- }, [
41
- ilNumberPerRow,
42
- layoutType
43
- ]);
44
- const setProductFeaturedImage = core.useProductStore((s)=>s.setProductFeaturedImage);
45
- const featuredImageGlobal = core.useFeaturedImageGlobal();
19
+ const { ilObjectFit, ilAspectRatio, layoutType, ilNumberPerRow, ilSpacing, ilBorder } = settings;
20
+ const itemGap = helper.postPurchaseSpacing[ilSpacing || 'none'];
21
+ const { itemSlideGrid } = useSlideCarousel.useSlideCarousel({
22
+ layoutType,
23
+ ilNumberPerRow
24
+ });
25
+ const gridClass = system.createClass(getClasses.getImageGridClass());
26
+ const gridStyle = system.createStyle(getStyles.getImageGridStyle({
27
+ gap: itemGap,
28
+ itemSlide: itemSlideGrid
29
+ }));
46
30
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
47
- className: "gp-grid gp-h-fit gp-w-full gp-flex-wrap",
48
- style: {
49
- ...core.makeStyle({
50
- gg: itemGap
51
- }),
52
- ...core.makeStyle({
53
- gtc: `repeat(${itemSlide}, 1fr)`
54
- })
55
- },
56
- children: productImages?.map((image)=>{
57
- const source = {
58
- src: image.src,
59
- alt: ''
60
- };
61
- return /*#__PURE__*/ jsxRuntime.jsx("div", {
62
- "aria-hidden": "true",
63
- className: `gp-w-full gp-border gp-border-transparent ${featuredImageGlobal?.id === image?.id && settings?.ilBorder !== 'none' ? '!gp-border-[#d9d9d9]' : ''}`,
64
- onClick: ()=>{
65
- setProductFeaturedImage(image);
66
- },
67
- children: /*#__PURE__*/ jsxRuntime.jsx(Image.default, {
68
- setting: {
69
- srcSet: {
70
- desktop: source,
71
- mobile: source,
72
- tablet: source
73
- }
74
- },
75
- styles: {
76
- aspectRatio: ilAspectRatio,
77
- objectFit: ilObjectFit,
78
- enableBorder: 'none'
79
- }
80
- }, image?.src)
81
- }, image?.src);
82
- })
31
+ className: gridClass,
32
+ style: gridStyle,
33
+ children: productImages?.map((image)=>/*#__PURE__*/ jsxRuntime.jsx(ItemGridPostPurchase.ItemGridPostPurchase, {
34
+ image: image,
35
+ border: ilBorder,
36
+ aspectRatio: ilAspectRatio,
37
+ objectFit: ilObjectFit
38
+ }, image.src))
83
39
  });
84
40
  };
85
41
 
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var core = require('@gem-sdk/core');
6
+ var next = require('../../../image/next.js');
7
+ var system = require('@gem-sdk/system');
8
+ var getClasses = require('../../common/getClasses.js');
9
+
10
+ const ItemCarouselPostPurchase = (props)=>{
11
+ const { image, border, aspectRatio, objectFit } = props;
12
+ const featuredImageGlobal = core.useFeaturedImageGlobal();
13
+ const setProductFeaturedImage = core.useProductStore((s)=>s.setProductFeaturedImage);
14
+ const classes = system.createClass(getClasses.getItemCarouselPostPurchaseClass({
15
+ border: image?.id === featuredImageGlobal?.id && border !== 'none'
16
+ }));
17
+ const source = {
18
+ src: image?.src || 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif',
19
+ alt: ''
20
+ };
21
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
22
+ "aria-hidden": "true",
23
+ className: classes,
24
+ onClick: ()=>setProductFeaturedImage(image),
25
+ children: /*#__PURE__*/ jsxRuntime.jsx(next.PostPurchaseImage, {
26
+ setting: {
27
+ srcSet: {
28
+ desktop: source,
29
+ mobile: source,
30
+ tablet: source
31
+ }
32
+ },
33
+ styles: {
34
+ aspectRatio: aspectRatio,
35
+ objectFit: objectFit,
36
+ enableBorder: 'none'
37
+ }
38
+ }, image?.src)
39
+ });
40
+ };
41
+
42
+ exports.ItemCarouselPostPurchase = ItemCarouselPostPurchase;
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var core = require('@gem-sdk/core');
6
+ var next = require('../../../image/next.js');
7
+ var system = require('@gem-sdk/system');
8
+ var getClasses = require('../../common/getClasses.js');
9
+
10
+ const ItemGridPostPurchase = (props)=>{
11
+ const { image, border, aspectRatio, objectFit } = props;
12
+ const featuredImageGlobal = core.useFeaturedImageGlobal();
13
+ const setProductFeaturedImage = core.useProductStore((s)=>s.setProductFeaturedImage);
14
+ const source = {
15
+ src: image.src,
16
+ alt: ''
17
+ };
18
+ const classes = system.createClass(getClasses.getItemCarouselPostPurchaseClass({
19
+ border: image?.id === featuredImageGlobal?.id && border !== 'none'
20
+ }));
21
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
22
+ "aria-hidden": "true",
23
+ className: classes,
24
+ onClick: ()=>setProductFeaturedImage(image),
25
+ children: /*#__PURE__*/ jsxRuntime.jsx(next.PostPurchaseImage, {
26
+ setting: {
27
+ srcSet: {
28
+ desktop: source,
29
+ mobile: source,
30
+ tablet: source
31
+ }
32
+ },
33
+ styles: {
34
+ aspectRatio: aspectRatio,
35
+ objectFit: objectFit,
36
+ enableBorder: 'none'
37
+ }
38
+ }, image?.src)
39
+ });
40
+ };
41
+
42
+ exports.ItemGridPostPurchase = ItemGridPostPurchase;
@@ -0,0 +1,29 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var system = require('@gem-sdk/system');
6
+ var getClasses = require('../../../common/getClasses.js');
7
+ require('@gem-sdk/core');
8
+ var useNavigationCarouselPostPurchase = require('../../../hooks/product-image/useNavigationCarouselPostPurchase.js');
9
+
10
+ const ArrowPostPurchase = (props)=>{
11
+ const { type, navigation, vertical, hidden = false } = props;
12
+ const { imgSrc, handleClick, disabled } = useNavigationCarouselPostPurchase.useNavigationCarouselPostPurchase({
13
+ type,
14
+ vertical
15
+ });
16
+ const classes = system.createClass(getClasses.getNavigationClass());
17
+ if (navigation === 'none' || hidden) return null;
18
+ return /*#__PURE__*/ jsxRuntime.jsx("button", {
19
+ className: classes,
20
+ disabled: disabled,
21
+ onClick: handleClick,
22
+ children: /*#__PURE__*/ jsxRuntime.jsx("img", {
23
+ src: imgSrc,
24
+ alt: `gp-arrow-${type}`
25
+ })
26
+ });
27
+ };
28
+
29
+ exports.ArrowPostPurchase = ArrowPostPurchase;
@@ -0,0 +1,35 @@
1
+ 'use client';
2
+ 'use strict';
3
+
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+ var ItemCarouselPostPurchase = require('../ItemCarouselPostPurchase.js');
6
+ var system = require('@gem-sdk/system');
7
+ var getClasses = require('../../../common/getClasses.js');
8
+ require('@gem-sdk/core');
9
+ var useListCarousel = require('../../../hooks/product-image/useListCarousel.js');
10
+
11
+ const CarouselPostPurchase = (props)=>{
12
+ const { productImages, itemPerRow, border, aspectRatio, objectFit } = props;
13
+ const { listRender } = useListCarousel.useListCarousel({
14
+ productImages,
15
+ itemPerRow
16
+ });
17
+ const itemEmptyClass = system.createClass(getClasses.getItemCarouseEmptyPostPurchaseClass());
18
+ return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
19
+ children: listRender?.map((image, index)=>{
20
+ if (!image) {
21
+ return /*#__PURE__*/ jsxRuntime.jsx("div", {
22
+ className: itemEmptyClass
23
+ }, index);
24
+ }
25
+ return /*#__PURE__*/ jsxRuntime.jsx(ItemCarouselPostPurchase.ItemCarouselPostPurchase, {
26
+ image: image,
27
+ border: border,
28
+ objectFit: objectFit,
29
+ aspectRatio: aspectRatio
30
+ }, image.id);
31
+ })
32
+ });
33
+ };
34
+
35
+ exports.CarouselPostPurchase = CarouselPostPurchase;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ var jsxRuntime = require('react/jsx-runtime');
4
+ var React = require('react');
5
+
6
+ const CarouselPostPurchaseContext = /*#__PURE__*/ React.createContext(undefined);
7
+ const CarouselProvider = ({ children })=>{
8
+ const [moveToIdx, setMoveToIdx] = React.useState(0);
9
+ const [maxIdx, setMaxIdx] = React.useState(0);
10
+ return /*#__PURE__*/ jsxRuntime.jsx(CarouselPostPurchaseContext.Provider, {
11
+ value: {
12
+ moveToIdx,
13
+ setMoveToIdx,
14
+ maxIdx,
15
+ setMaxIdx
16
+ },
17
+ children: children
18
+ });
19
+ };
20
+
21
+ exports.CarouselPostPurchaseContext = CarouselPostPurchaseContext;
22
+ exports.CarouselProvider = CarouselProvider;