@gem-sdk/components 2.1.27-staging.1 → 2.1.27
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/article/components/ArticleImage.js +1 -2
- package/dist/cjs/banner/components/hero-banner/index.liquid.js +7 -4
- package/dist/cjs/carousel/components/Carousel.liquid.js +2 -3
- package/dist/cjs/common/const.js +1 -1
- package/dist/cjs/helpers.js +1 -1
- package/dist/cjs/image/components/AdaptiveImage.liquid.js +5 -6
- package/dist/cjs/image/components/Image.js +2 -22
- package/dist/cjs/image/components/Image.liquid.js +4 -6
- package/dist/cjs/image/components/NextImage.liquid.js +3 -4
- package/dist/cjs/image-comparison/components/CompareImage.liquid.js +3 -7
- package/dist/cjs/post-purchase/product/components/ProductOffer.js +1 -5
- package/dist/cjs/product/components/Product.liquid.js +2 -3
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +5 -6
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
- package/dist/cjs/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
- package/dist/cjs/product/components/ProductVariants/index.liquid.js +18 -11
- package/dist/cjs/product/components/ProductVariants/variants/Base.liquid.js +0 -1
- package/dist/cjs/product/components/ProductVariants/variants/Dropdown.liquid.js +12 -26
- package/dist/cjs/product/components/ProductVariants/variants/DropdownGroup.liquid.js +37 -4
- package/dist/cjs/tab/hooks/useTabInteraction.js +9 -13
- package/dist/cjs/text/components/Text.js +1 -0
- package/dist/cjs/video/components/HTML5Embed.js +2 -2
- package/dist/cjs/video/components/HTML5Embed.liquid.js +3 -6
- package/dist/cjs/video/components/LiteYouTubeEmbed.liquid.js +3 -5
- package/dist/esm/article/components/ArticleImage.js +1 -2
- package/dist/esm/banner/components/hero-banner/index.liquid.js +7 -4
- package/dist/esm/carousel/components/Carousel.liquid.js +2 -3
- package/dist/esm/common/const.js +1 -1
- package/dist/esm/helpers.js +1 -1
- package/dist/esm/image/components/AdaptiveImage.liquid.js +5 -6
- package/dist/esm/image/components/Image.js +3 -23
- package/dist/esm/image/components/Image.liquid.js +4 -6
- package/dist/esm/image/components/NextImage.liquid.js +3 -4
- package/dist/esm/image-comparison/components/CompareImage.liquid.js +3 -7
- package/dist/esm/post-purchase/product/components/ProductOffer.js +1 -5
- package/dist/esm/product/components/Product.liquid.js +2 -3
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js +5 -6
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryCarousel.liquid.js +2 -2
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductGalleryGrid.liquid.js +4 -4
- package/dist/esm/product/components/ProductImagesV2/liquid/ProductImages.liquid.js +4 -4
- package/dist/esm/product/components/ProductVariants/index.liquid.js +19 -12
- package/dist/esm/product/components/ProductVariants/variants/Base.liquid.js +0 -1
- package/dist/esm/product/components/ProductVariants/variants/Dropdown.liquid.js +12 -26
- package/dist/esm/product/components/ProductVariants/variants/DropdownGroup.liquid.js +37 -4
- package/dist/esm/tab/hooks/useTabInteraction.js +10 -14
- package/dist/esm/text/components/Text.js +1 -0
- package/dist/esm/video/components/HTML5Embed.js +2 -2
- package/dist/esm/video/components/HTML5Embed.liquid.js +3 -6
- package/dist/esm/video/components/LiteYouTubeEmbed.liquid.js +3 -5
- package/dist/types/index.d.ts +6 -23
- package/package.json +3 -3
- package/dist/cjs/image/components/NoDataImage.js +0 -133
- package/dist/cjs/product/components/ProductVariants/variants/combine/index.js +0 -47
- package/dist/esm/image/components/NoDataImage.js +0 -129
- package/dist/esm/product/components/ProductVariants/variants/combine/index.js +0 -44
|
@@ -14,7 +14,7 @@ var NextImage_liquid = require('../../../image/components/NextImage.liquid.js');
|
|
|
14
14
|
var getSrcSet = require('../../../image/helpers/getSrcSet.js');
|
|
15
15
|
var helpers$1 = require('../../../image/components/helpers.js');
|
|
16
16
|
|
|
17
|
-
const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced,
|
|
17
|
+
const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, children, rawChildren, advanced, enableLazyloadImage = true })=>{
|
|
18
18
|
const { link, layout, verticalAlign, order, alignBanner, alt, title } = setting ?? {};
|
|
19
19
|
const { background, overlayEnable, overlayColor, overlayOpacity, verticalGutter, contentWidth, hoverEffect, hoverEffectDuration, hoverEffectScale, cornerBg, borderBg, hasActiveShadow, shadowBg, sizeSetting, contentPadding } = styles ?? {};
|
|
20
20
|
const enableParallax = setting?.enableParallax || false;
|
|
@@ -43,6 +43,9 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
43
43
|
} else if (data.videoType === 'html5') {
|
|
44
44
|
delete data.video;
|
|
45
45
|
}
|
|
46
|
+
if (data.type !== 'image') {
|
|
47
|
+
delete data.image;
|
|
48
|
+
}
|
|
46
49
|
}
|
|
47
50
|
return background;
|
|
48
51
|
};
|
|
@@ -131,7 +134,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
131
134
|
tablet: helpers$1.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0),
|
|
132
135
|
mobile: helpers$1.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
|
|
133
136
|
};
|
|
134
|
-
const enableLazyLoad = !setting?.preload &&
|
|
137
|
+
const enableLazyLoad = !setting?.preload && enableLazyloadImage;
|
|
135
138
|
const renderInnerHeroBanner = ()=>{
|
|
136
139
|
return core.template /* liquid */ `
|
|
137
140
|
<div
|
|
@@ -181,7 +184,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
181
184
|
alt,
|
|
182
185
|
title,
|
|
183
186
|
imagePlaceholder,
|
|
184
|
-
|
|
187
|
+
enableLazyloadImage
|
|
185
188
|
})}
|
|
186
189
|
<div class="${core.cls('gp-absolute gp-w-full gp-h-full')}">
|
|
187
190
|
<div
|
|
@@ -224,7 +227,7 @@ const HeroBanner = ({ builderAttrs, builderProps, setting, styles, style, childr
|
|
|
224
227
|
alt: `lazy image ${device}`,
|
|
225
228
|
className: `gp-absolute gp-top-0 gp-invisible gp-w-full gp_lazyload gp-h-full gp_lazyforbg ${device === 'tablet' ? 'gp_lazybg_tl' : ''} ${device === 'mobile' ? 'gp_lazybg_mb' : ''}`,
|
|
226
229
|
isDisableAspectStyle: true,
|
|
227
|
-
|
|
230
|
+
enableLazyloadImage
|
|
228
231
|
}));
|
|
229
232
|
}).join('') : ''}
|
|
230
233
|
</div></div>
|
|
@@ -13,7 +13,7 @@ const DEVICES = [
|
|
|
13
13
|
'tablet',
|
|
14
14
|
'desktop'
|
|
15
15
|
];
|
|
16
|
-
const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs,
|
|
16
|
+
const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId, rootAttr, rootClass, wrapperClass, rootStyles, children, rawChildren, isHiddenArrowWhenDisabled = true, advanced, disableMarginAuto, conditionAppendJs, ...props })=>{
|
|
17
17
|
const setting = arrow.mappingNavigationCarousel(props.setting);
|
|
18
18
|
const styleHeight = core.makeStyleResponsive('h', core.getHeightByShapeGlobalSize(styles?.sizeSetting));
|
|
19
19
|
const styleWidth = core.makeStyleWithDefault('w', core.getWidthByShapeGlobalSize(styles?.sizeSetting, true), {
|
|
@@ -112,8 +112,7 @@ const Carousel = ({ builderAttrs, builderProps, style, styles, moveToIdx, rootId
|
|
|
112
112
|
setting,
|
|
113
113
|
styles,
|
|
114
114
|
moveToIdx,
|
|
115
|
-
isHiddenArrowWhenDisabled
|
|
116
|
-
ftShapeProductImage
|
|
115
|
+
isHiddenArrowWhenDisabled
|
|
117
116
|
}).replaceAll("'", ''')}' style="${{
|
|
118
117
|
...core.makeStyleResponsive('jc', styles?.align),
|
|
119
118
|
...rootStyles
|
package/dist/cjs/common/const.js
CHANGED
package/dist/cjs/helpers.js
CHANGED
|
@@ -47,7 +47,7 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, i
|
|
|
47
47
|
locale += ` | replace: '$locationOrigin', locationOrigin`;
|
|
48
48
|
}
|
|
49
49
|
if (isReplaceInventoryQuantity) {
|
|
50
|
-
locale += ` | replace: '<$quantity$>', inventory_quantity`;
|
|
50
|
+
locale += ` | replace: '<$quantity$>', inventory_quantity | replace: '<$quantity$>', inventory_quantity`;
|
|
51
51
|
}
|
|
52
52
|
if (isCapitalize) {
|
|
53
53
|
locale = `${locale} | downcase`;
|
|
@@ -6,7 +6,7 @@ var core = require('@gem-sdk/core');
|
|
|
6
6
|
var getSrcSet = require('../helpers/getSrcSet.js');
|
|
7
7
|
var helpers = require('./helpers.js');
|
|
8
8
|
|
|
9
|
-
const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder,
|
|
9
|
+
const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className, pictureClass, style, imagePlaceholder, enableLazyloadImage = true, ...props })=>{
|
|
10
10
|
const fallBackImage = 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif';
|
|
11
11
|
const srcDesktop = getSrcSet.getImageSrc(srcSet?.desktop, 'desktop') || fallBackImage;
|
|
12
12
|
const srcTablet = (getSrcSet.getImageSrc(srcSet?.tablet, 'tablet') ?? getSrcSet.getImageSrc(srcSet?.desktop, 'tablet')) || fallBackImage;
|
|
@@ -31,17 +31,16 @@ const AdaptiveImage = ({ srcSet, priority, alt, aspectRatio, layout, className,
|
|
|
31
31
|
}}"
|
|
32
32
|
/>
|
|
33
33
|
`, core.template`
|
|
34
|
-
${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${
|
|
35
|
-
${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${
|
|
34
|
+
${srcMobile ? `<source media="(max-width: 767px)" data-srcSet="${srcMobile}" srcset="${enableLazyloadImage ? imagePlaceholder?.['mobile'] ?? helpers.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcMobile}" />` : ''}
|
|
35
|
+
${srcTablet ? `<source media="(max-width: 1024px)" data-srcSet="${srcTablet}" srcset="${enableLazyloadImage ? imagePlaceholder?.['tablet'] ?? helpers.createBlurDataURL(srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.tablet?.height ?? srcSet?.desktop?.height ?? 0) : srcTablet}" />` : ''}
|
|
36
36
|
<img
|
|
37
37
|
${{
|
|
38
38
|
...props
|
|
39
39
|
}}
|
|
40
40
|
class="${core.cls(className, {
|
|
41
|
-
gp_lazyload:
|
|
42
|
-
gp_force_load: pageContext?.isOptimizePlan
|
|
41
|
+
gp_lazyload: enableLazyloadImage
|
|
43
42
|
})}"
|
|
44
|
-
src="${
|
|
43
|
+
src="${enableLazyloadImage ? imagePlaceholder?.['desktop'] ?? helpers.createBlurDataURL(srcSet?.desktop?.width ?? 0, srcSet?.desktop?.height ?? 0) : srcDesktop}"
|
|
45
44
|
data-src="${srcDesktop}"
|
|
46
45
|
width="100%"
|
|
47
46
|
alt="${alt}"
|
|
@@ -8,13 +8,10 @@ var Link = require('../../link/components/Link.js');
|
|
|
8
8
|
var AdaptiveImage = require('./AdaptiveImage.js');
|
|
9
9
|
var NextImage = require('./NextImage.js');
|
|
10
10
|
var helpers = require('./helpers.js');
|
|
11
|
-
var NoDataImage = require('./NoDataImage.js');
|
|
12
|
-
var React = require('react');
|
|
13
11
|
|
|
14
12
|
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, children, onClick, onLoad })=>{
|
|
15
13
|
const { image, imageLink, srcSet, isNotLazyload } = setting ?? {};
|
|
16
14
|
const { customAspectRadio } = styles ?? {};
|
|
17
|
-
const currentDevice = core.useCurrentDevice();
|
|
18
15
|
const { shape } = styles ?? {};
|
|
19
16
|
const WrapLink = imageLink?.link ? Link.default : 'div';
|
|
20
17
|
const opacity = {
|
|
@@ -59,18 +56,6 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
59
56
|
custom: customAspectRadio
|
|
60
57
|
})
|
|
61
58
|
};
|
|
62
|
-
const isShowNoDataState = React.useMemo(()=>{
|
|
63
|
-
if (setting?.disableNoDataState) return false;
|
|
64
|
-
if (currentDevice === 'mobile') return !setting?.srcSet?.mobile?.src && !setting?.srcSet?.tablet?.src && !setting?.srcSet?.desktop?.src;
|
|
65
|
-
if (currentDevice === 'tablet') return !setting?.srcSet?.tablet?.src && !setting?.srcSet?.desktop?.src;
|
|
66
|
-
return !setting?.srcSet?.desktop?.src;
|
|
67
|
-
}, [
|
|
68
|
-
currentDevice,
|
|
69
|
-
setting?.disableNoDataState,
|
|
70
|
-
setting?.srcSet?.desktop?.src,
|
|
71
|
-
setting?.srcSet?.mobile?.src,
|
|
72
|
-
setting?.srcSet?.tablet?.src
|
|
73
|
-
]);
|
|
74
59
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
75
60
|
...builderAttrs,
|
|
76
61
|
"data-id": builderProps?.uid,
|
|
@@ -98,15 +83,10 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
98
83
|
...core.makeStyleResponsive('jc', styles?.align)
|
|
99
84
|
},
|
|
100
85
|
children: [
|
|
101
|
-
|
|
102
|
-
style: {
|
|
103
|
-
...imageWidth,
|
|
104
|
-
...imageHeight
|
|
105
|
-
}
|
|
106
|
-
}) : setting?.isAdaptive ? /*#__PURE__*/ jsxRuntime.jsx(AdaptiveImage.default, {
|
|
86
|
+
setting?.isAdaptive ? /*#__PURE__*/ jsxRuntime.jsx(AdaptiveImage.default, {
|
|
107
87
|
srcSet: setting.srcSet,
|
|
108
88
|
pictureClass: "gp-contents",
|
|
109
|
-
className: core.cls(className, 'gp-
|
|
89
|
+
className: core.cls(className, 'gp-w-full gp-max-w-full', core.handleConvertClassColor(styles?.borderImg)),
|
|
110
90
|
alt: setting.alt,
|
|
111
91
|
style: {
|
|
112
92
|
...imageWidth,
|
|
@@ -7,7 +7,7 @@ var AdaptiveImage_liquid = require('./AdaptiveImage.liquid.js');
|
|
|
7
7
|
var NextImage_liquid = require('./NextImage.liquid.js');
|
|
8
8
|
var helpers = require('../../helpers.js');
|
|
9
9
|
|
|
10
|
-
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced,
|
|
10
|
+
const Image = ({ styles, className, setting, builderAttrs, builderProps, style, advanced, enableLazyloadImage = true })=>{
|
|
11
11
|
const { imageLink, isNotLazyload } = setting ?? {};
|
|
12
12
|
const { shape } = styles ?? {};
|
|
13
13
|
const { Wrap: WrapLink, urlData } = helpers.getInsertLinkData('div', imageLink);
|
|
@@ -34,7 +34,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
34
34
|
}}
|
|
35
35
|
data-id="${builderProps?.uid}"
|
|
36
36
|
role="presentation"
|
|
37
|
-
class="${core.cls('gp-group/image', builderProps?.uid, advanced?.cssClass
|
|
37
|
+
class="${core.cls('gp-group/image', builderProps?.uid, advanced?.cssClass)}"
|
|
38
38
|
style="${{
|
|
39
39
|
...style,
|
|
40
40
|
...core.makeStyleResponsive('ta', styles?.align)
|
|
@@ -76,8 +76,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
76
76
|
aspectRatio: core.getAspectRatioGlobalSize(styles?.shape),
|
|
77
77
|
layout: styles?.objectFit,
|
|
78
78
|
priority: setting?.priority,
|
|
79
|
-
|
|
80
|
-
pageContext
|
|
79
|
+
enableLazyloadImage
|
|
81
80
|
}) : NextImage_liquid.default({
|
|
82
81
|
...setting?.image,
|
|
83
82
|
priority: setting?.priority,
|
|
@@ -106,8 +105,7 @@ const Image = ({ styles, className, setting, builderAttrs, builderProps, style,
|
|
|
106
105
|
layout: styles?.objectFit
|
|
107
106
|
},
|
|
108
107
|
isNotLazyload,
|
|
109
|
-
|
|
110
|
-
pageContext
|
|
108
|
+
enableLazyloadImage
|
|
111
109
|
})}
|
|
112
110
|
</${WrapLink}>
|
|
113
111
|
</div>`;
|
|
@@ -7,7 +7,7 @@ var getSrcSet = require('../helpers/getSrcSet.js');
|
|
|
7
7
|
var index = require('../../product/components/ProductVariants/index.js');
|
|
8
8
|
var helpers = require('./helpers.js');
|
|
9
9
|
|
|
10
|
-
const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png', srcIsLiquidCode, alt = 'Alt image', width = 2237, height = 1678, backupFileKey, backupFilePath, storage, style, priority, vw, className, base64, baseSrc, isDisableAspectStyle, isDisableObjectFit, customAttrs, customLazyload, isNotLazyload,
|
|
10
|
+
const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f08-f6665179f02f/-/format/auto/-/quality/lighter/placeholder-1.png', srcIsLiquidCode, alt = 'Alt image', width = 2237, height = 1678, backupFileKey, backupFilePath, storage, style, priority, vw, className, base64, baseSrc, isDisableAspectStyle, isDisableObjectFit, customAttrs, customLazyload, isNotLazyload, enableLazyloadImage = true, srcset, sizes, ...props })=>{
|
|
11
11
|
const { aspectRatio, layout, qualityPercent, qualityType } = setting ?? {};
|
|
12
12
|
const newBackupFilekey = backupFileKey ? getSrcSet.getNewBackupFileKey(backupFileKey ?? '', src) : '';
|
|
13
13
|
const srcImage = srcIsLiquidCode ? baseSrc : getSrcSet.getImageSrc({
|
|
@@ -97,13 +97,12 @@ const NextImage = ({ setting, src = 'https://ucarecdn.com/465c7cbb-f087-4d1d-8f0
|
|
|
97
97
|
${customAttrs}
|
|
98
98
|
draggable="false"
|
|
99
99
|
class="${core.cls(className, {
|
|
100
|
-
gp_lazyload: !customLazyload &&
|
|
101
|
-
gp_force_load: pageContext?.isOptimizePlan
|
|
100
|
+
gp_lazyload: !customLazyload && enableLazyloadImage
|
|
102
101
|
})}"
|
|
103
102
|
${{
|
|
104
103
|
'data-src': srcImage,
|
|
105
104
|
'data-srcset': srcSetImg,
|
|
106
|
-
src:
|
|
105
|
+
src: enableLazyloadImage ? imagePlaceholder : srcImage,
|
|
107
106
|
width,
|
|
108
107
|
height,
|
|
109
108
|
alt,
|
|
@@ -11,7 +11,7 @@ var helpers$1 = require('../../helpers.js');
|
|
|
11
11
|
var helpers = require('./common/helpers.js');
|
|
12
12
|
|
|
13
13
|
const CompareImage = (props)=>{
|
|
14
|
-
const { handle = null, handleSize = 40, hover = false, leftImage, leftImageAlt = '', leftImageTitle = '', leftImageCss = {}, leftImageLabel = null, onSliderPositionChange, rightImage, rightImageAlt = '', rightImageTitle = '', rightImageCss = {}, rightImageLabel = null, sliderLineColor = '#ffffff', sliderLineWidth = 2, sliderPositionPercentage = 0.5, vertical = false, enableLabel = false, componentUid = '', styles, advanced, builderData, preload = false,
|
|
14
|
+
const { handle = null, handleSize = 40, hover = false, leftImage, leftImageAlt = '', leftImageTitle = '', leftImageCss = {}, leftImageLabel = null, onSliderPositionChange, rightImage, rightImageAlt = '', rightImageTitle = '', rightImageCss = {}, rightImageLabel = null, sliderLineColor = '#ffffff', sliderLineWidth = 2, sliderPositionPercentage = 0.5, vertical = false, enableLabel = false, componentUid = '', styles, advanced, builderData, preload = false, pageContext, translate } = props;
|
|
15
15
|
const horizontal = !vertical;
|
|
16
16
|
const leftRatio = (leftImage?.width ?? 0) / (leftImage?.height ?? 1);
|
|
17
17
|
const rightRatio = (rightImage?.width ?? 0) / (rightImage?.height ?? 1);
|
|
@@ -271,9 +271,7 @@ const CompareImage = (props)=>{
|
|
|
271
271
|
style: {
|
|
272
272
|
...initStyles.rightImage,
|
|
273
273
|
...core.makeStyleResponsive('objf', styles?.imageScale)
|
|
274
|
-
}
|
|
275
|
-
enableLazyLoadImage,
|
|
276
|
-
pageContext
|
|
274
|
+
}
|
|
277
275
|
})}
|
|
278
276
|
${NextImage_liquid.default({
|
|
279
277
|
customAttrs: {
|
|
@@ -289,9 +287,7 @@ const CompareImage = (props)=>{
|
|
|
289
287
|
style: {
|
|
290
288
|
...initStyles.rightImage,
|
|
291
289
|
...core.makeStyleResponsive('objf', styles?.imageScale)
|
|
292
|
-
}
|
|
293
|
-
enableLazyLoadImage,
|
|
294
|
-
pageContext
|
|
290
|
+
}
|
|
295
291
|
})}
|
|
296
292
|
<div id="image-comparison-slider-${componentUid}" style="${{
|
|
297
293
|
...initStyles.slider
|
|
@@ -69,12 +69,8 @@ const PostPurchaseProductOffer = ({ styles, builderAttrs, builderProps, children
|
|
|
69
69
|
};
|
|
70
70
|
const getClassNameForItem = (index)=>{
|
|
71
71
|
let className = '';
|
|
72
|
-
ProductVariant.DEVICES.
|
|
72
|
+
ProductVariant.DEVICES.map((device)=>{
|
|
73
73
|
const key = device === 'desktop' ? '' : `${device}:`;
|
|
74
|
-
if (device === 'mobile') {
|
|
75
|
-
className += ` mobile:gp-col-span-2`;
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
74
|
if (productOfferLayout?.[device] === '1col' && index % 3 === 0 || (totalProduct || 0) <= 1) {
|
|
79
75
|
className += ` ${key}gp-col-span-2`;
|
|
80
76
|
}
|
|
@@ -9,7 +9,6 @@ var helpers = require('../../helpers.js');
|
|
|
9
9
|
const PRODUCT_ID_LATEST = 'latest';
|
|
10
10
|
const PREFIX_PRODUCT_ID = 'gid://shopify/Product/';
|
|
11
11
|
const PREFIX_PRODUCT_VARIANT_ID = 'gid://shopify/ProductVariant/';
|
|
12
|
-
const PREFIX_PRODUCT_OPTION_VALUE_ID = 'gid://shopify/ProductOptionValue/';
|
|
13
12
|
const STATIC_PRODUCT_STATUS = 'static';
|
|
14
13
|
const DYNAMIC_PRODUCT_STATUS = 'dynamic';
|
|
15
14
|
const Product = ({ children, setting, styles, style, builderProps, rawChildren, advanced })=>{
|
|
@@ -25,8 +24,8 @@ const Product = ({ children, setting, styles, style, builderProps, rawChildren,
|
|
|
25
24
|
const formatProductId = productSetting?.productId?.replace(PREFIX_PRODUCT_ID, '').toLowerCase() || PRODUCT_ID_LATEST;
|
|
26
25
|
const formatVariantId = initVariantId?.replace(PREFIX_PRODUCT_VARIANT_ID, '') || '';
|
|
27
26
|
const productStatus = productSetting?.productStatus ?? STATIC_PRODUCT_STATUS;
|
|
28
|
-
const preSelectedOptionIds = productSetting?.selectedOptions?.map((option)=>option?.valueBaseID?.replace(PREFIX_PRODUCT_OPTION_VALUE_ID, ''));
|
|
29
27
|
return core.template /* liquid */ `
|
|
28
|
+
|
|
30
29
|
{%- assign gpBkProduct = product -%}
|
|
31
30
|
${productStatus !== DYNAMIC_PRODUCT_STATUS ? `
|
|
32
31
|
{%- liquid
|
|
@@ -101,7 +100,7 @@ const Product = ({ children, setting, styles, style, builderProps, rawChildren,
|
|
|
101
100
|
{%- endif -%}
|
|
102
101
|
<gp-product data-uid="${builderProps?.uid}" data-id="${builderProps?.uid}" style="${{
|
|
103
102
|
...advancedStyle
|
|
104
|
-
}}" class="${advanced?.cssClass}" gp-context='{"productId": {{ product.id }}, "
|
|
103
|
+
}}" class="${advanced?.cssClass}" gp-context='{"productId": {{ product.id }}, "isSyncProduct": "${isSyncProduct}", "variantSelected": {{ variant | json | escape }}, "inventoryQuantity": {{ variant.inventory_quantity }}, "quantity": 1, "formId": "{{ product_form_id }}" }'
|
|
105
104
|
gp-data='{"variantSelected": {{ variant | json | escape }}, "quantity": 1, "productUrl":{{ product.url | json | escape }}, "productHandle":{{ product.handle | json | escape }}, "collectionUrl": {{ collection.url | json | escape }}, "collectionHandle": {{ collection.handle | json | escape }}}'>
|
|
106
105
|
<product-form class="product-form">
|
|
107
106
|
{%- form 'product', product, id: product_form_id, class: 'form contents', data-type: 'add-to-cart-form', autocomplete: 'off' -%}
|
package/dist/cjs/product/components/ProductImagesV2/liquid/ProductFeaturedImageCarousel.liquid.js
CHANGED
|
@@ -13,7 +13,7 @@ var NextImage_liquid = require('../../../../image/components/NextImage.liquid.js
|
|
|
13
13
|
var Video_liquid = require('../../../../image/components/Video.liquid.js');
|
|
14
14
|
var _function = require('../../../helpers/function.js');
|
|
15
15
|
|
|
16
|
-
const ProductFeaturedImageCarousel = ({ builderPropUID, children,
|
|
16
|
+
const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyloadImage, ...setting })=>{
|
|
17
17
|
const ftAspectRatio = common.getAspectRatio(setting.ftShape);
|
|
18
18
|
const getStyleFeaturedImageDisplay = ()=>{
|
|
19
19
|
return common.getDisplayStyle((device)=>![
|
|
@@ -153,7 +153,7 @@ const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyLoad
|
|
|
153
153
|
},
|
|
154
154
|
priority: setting?.preload,
|
|
155
155
|
className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${className}`,
|
|
156
|
-
|
|
156
|
+
enableLazyloadImage
|
|
157
157
|
})}`;
|
|
158
158
|
};
|
|
159
159
|
const renderNoImage = ()=>{
|
|
@@ -171,7 +171,7 @@ const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyLoad
|
|
|
171
171
|
},
|
|
172
172
|
priority: setting?.preload,
|
|
173
173
|
className: `gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none`,
|
|
174
|
-
|
|
174
|
+
enableLazyloadImage
|
|
175
175
|
})}`;
|
|
176
176
|
};
|
|
177
177
|
const getValueFromValueContainUnit = (value)=>{
|
|
@@ -398,11 +398,10 @@ const ProductFeaturedImageCarousel = ({ builderPropUID, children, enableLazyLoad
|
|
|
398
398
|
},
|
|
399
399
|
className: `gp-w-full featured-image-only !gp-rounded-none`,
|
|
400
400
|
customLazyload: true,
|
|
401
|
-
|
|
401
|
+
enableLazyloadImage
|
|
402
402
|
})}
|
|
403
403
|
{%- endif -%}
|
|
404
|
-
|
|
405
|
-
ftShapeProductImage: setting?.ftShape
|
|
404
|
+
`
|
|
406
405
|
})}
|
|
407
406
|
`;
|
|
408
407
|
};
|
|
@@ -10,7 +10,7 @@ var common = require('../common/common.js');
|
|
|
10
10
|
var productGallery = require('../common/productGallery.js');
|
|
11
11
|
var _function = require('../../../helpers/function.js');
|
|
12
12
|
|
|
13
|
-
const ProductGalleryCarousel = ({ builderPropUID, children,
|
|
13
|
+
const ProductGalleryCarousel = ({ builderPropUID, children, enableLazyloadImage, ...setting })=>{
|
|
14
14
|
const getCarouselDisplay = ()=>{
|
|
15
15
|
const isDisplayCarousel = (type, position, device)=>{
|
|
16
16
|
const layout = core.getResponsiveValueByScreen(position, device);
|
|
@@ -90,7 +90,7 @@ const ProductGalleryCarousel = ({ builderPropUID, children, enableLazyLoadImage,
|
|
|
90
90
|
customLazyload: true,
|
|
91
91
|
style: style,
|
|
92
92
|
className: '!gp-rounded-none gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 gp-cursor-pointer',
|
|
93
|
-
|
|
93
|
+
enableLazyloadImage
|
|
94
94
|
})}`;
|
|
95
95
|
};
|
|
96
96
|
const aspectRatioToPaddingBottom = ()=>{
|
|
@@ -12,7 +12,7 @@ var Modal3d_liquid = require('../../../../image/components/Modal3d.liquid.js');
|
|
|
12
12
|
var Video_liquid = require('../../../../image/components/Video.liquid.js');
|
|
13
13
|
var HTML5Embed_liquid = require('../../../../video/components/HTML5Embed.liquid.js');
|
|
14
14
|
|
|
15
|
-
const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children,
|
|
15
|
+
const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazyloadImage, ...setting })=>{
|
|
16
16
|
const getGridDisplay = ()=>{
|
|
17
17
|
const isDisplayGrid = (type, position, device)=>{
|
|
18
18
|
const layout = core.getResponsiveValueByScreen(position, device);
|
|
@@ -101,7 +101,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
101
101
|
style: style,
|
|
102
102
|
className: '!gp-rounded-none',
|
|
103
103
|
customLazyload: false,
|
|
104
|
-
|
|
104
|
+
enableLazyloadImage
|
|
105
105
|
})}
|
|
106
106
|
${setting?.galleryHoverEffect !== 'none' ? `<div class="${core.cls('zoom-element !gp-max-w-none', productFeaturedImage.getZoomImageClass())}">
|
|
107
107
|
${NextImage_liquid.default({
|
|
@@ -115,7 +115,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
115
115
|
style: style,
|
|
116
116
|
className: '!gp-rounded-none gp-w-full gp-h-full',
|
|
117
117
|
customLazyload: false,
|
|
118
|
-
|
|
118
|
+
enableLazyloadImage
|
|
119
119
|
})}
|
|
120
120
|
</div>` : ''}
|
|
121
121
|
${setting?.galleryHoverEffect == 'zoom' && setting?.galleryZoomType == 'glasses' ? `
|
|
@@ -298,7 +298,7 @@ const ProductGalleryGrid = ({ builderPropUID, wrapperStyle, children, enableLazy
|
|
|
298
298
|
},
|
|
299
299
|
className: '!gp-rounded-none',
|
|
300
300
|
customLazyload: false,
|
|
301
|
-
|
|
301
|
+
enableLazyloadImage
|
|
302
302
|
})}`;
|
|
303
303
|
};
|
|
304
304
|
return core.template`
|
|
@@ -11,7 +11,7 @@ var helpers = require('../../../../helpers.js');
|
|
|
11
11
|
var productGallery = require('../common/productGallery.js');
|
|
12
12
|
|
|
13
13
|
const ProductImages = (productImageProps)=>{
|
|
14
|
-
const { setting, styles, builderProps, style, advanced, rawChildren, pageContext,
|
|
14
|
+
const { setting, styles, builderProps, style, advanced, rawChildren, pageContext, enableLazyloadImage } = productImageProps;
|
|
15
15
|
const settings = {
|
|
16
16
|
...setting,
|
|
17
17
|
...styles
|
|
@@ -116,7 +116,7 @@ const ProductImages = (productImageProps)=>{
|
|
|
116
116
|
builderPropUID: `gp-carousel-${builderProps?.uid}`,
|
|
117
117
|
...settings,
|
|
118
118
|
children: renderProductBadge(),
|
|
119
|
-
|
|
119
|
+
enableLazyloadImage
|
|
120
120
|
})}
|
|
121
121
|
${common.shouldSkipLiquidRenderForSingleImage(settings?.position, core.template`
|
|
122
122
|
<div
|
|
@@ -132,7 +132,7 @@ const ProductImages = (productImageProps)=>{
|
|
|
132
132
|
${ProductGalleryCarousel_liquid.default({
|
|
133
133
|
builderPropUID: `gp-gallery-${builderProps?.uid}`,
|
|
134
134
|
...settings,
|
|
135
|
-
|
|
135
|
+
enableLazyloadImage
|
|
136
136
|
})}
|
|
137
137
|
</div>
|
|
138
138
|
${ProductGalleryGrid_liquid.default({
|
|
@@ -142,7 +142,7 @@ const ProductImages = (productImageProps)=>{
|
|
|
142
142
|
},
|
|
143
143
|
children: renderProductBadge(),
|
|
144
144
|
...settings,
|
|
145
|
-
|
|
145
|
+
enableLazyloadImage
|
|
146
146
|
})}
|
|
147
147
|
`)}
|
|
148
148
|
</div>
|
|
@@ -97,9 +97,15 @@ const ProductVariants = ({ builderProps, style, styles, setting, advanced })=>{
|
|
|
97
97
|
<div
|
|
98
98
|
option-name="{{option.name | escape}}"
|
|
99
99
|
class="${core.cls('gp-flex variant-inside', {
|
|
100
|
-
|
|
100
|
+
'gp-flex-col': layout?.desktop === 'vertical',
|
|
101
|
+
'gp-flex-row': layout?.desktop === 'horizontal',
|
|
102
|
+
'tablet:gp-flex-row': layout?.tablet === 'horizontal',
|
|
103
|
+
'tablet:gp-flex-col': layout?.tablet === 'vertical',
|
|
104
|
+
'mobile:gp-flex-row': layout?.mobile === 'horizontal',
|
|
105
|
+
'mobile:gp-flex-col': layout?.mobile === 'vertical'
|
|
106
|
+
}, {
|
|
101
107
|
..._function.getAlignClasses(layout, align)
|
|
102
|
-
})}"
|
|
108
|
+
})} {% if hiddenPresetOptions contains option.name %} gp-hidden {% endif %}"
|
|
103
109
|
|
|
104
110
|
>
|
|
105
111
|
{% assign showVariantClass = 'variant-display' %}
|
|
@@ -131,7 +137,15 @@ const ProductVariants = ({ builderProps, style, styles, setting, advanced })=>{
|
|
|
131
137
|
<div
|
|
132
138
|
variant-option-name="{{option.name | escape}}"
|
|
133
139
|
class="${core.cls({
|
|
134
|
-
|
|
140
|
+
'gp-justify-start': align?.desktop === 'left',
|
|
141
|
+
'gp-justify-center': align?.desktop === 'center',
|
|
142
|
+
'gp-justify-end': align?.desktop === 'right',
|
|
143
|
+
'tablet:gp-justify-start': align?.tablet === 'left',
|
|
144
|
+
'tablet:gp-justify-center': align?.tablet === 'center',
|
|
145
|
+
'tablet:gp-justify-end': align?.tablet === 'right',
|
|
146
|
+
'mobile:gp-justify-start': align?.mobile === 'left',
|
|
147
|
+
'mobile:gp-justify-center': align?.mobile === 'center',
|
|
148
|
+
'mobile:gp-justify-end': align?.mobile === 'right'
|
|
135
149
|
}, 'gp-flex gp-w-full gp-flex-wrap gp-items-center variant-option-group')}"
|
|
136
150
|
style="${{
|
|
137
151
|
...core.makeStyle({
|
|
@@ -314,10 +328,6 @@ const ProductVariants = ({ builderProps, style, styles, setting, advanced })=>{
|
|
|
314
328
|
`;
|
|
315
329
|
};
|
|
316
330
|
return core.template`
|
|
317
|
-
{%- assign total_combinations = 1 -%}
|
|
318
|
-
{%- for option in product.options_with_values -%}
|
|
319
|
-
{%- assign total_combinations = total_combinations | times: option.values.size -%}
|
|
320
|
-
{%- endfor -%}
|
|
321
331
|
<gp-product-variants
|
|
322
332
|
data-id="${uid}"
|
|
323
333
|
class="${advanced?.cssClass}"
|
|
@@ -333,10 +343,7 @@ const ProductVariants = ({ builderProps, style, styles, setting, advanced })=>{
|
|
|
333
343
|
"moneyFormat": {{shop.money_format | json | escape}},
|
|
334
344
|
"productId": {{product.id | json | escape}},
|
|
335
345
|
"productUrl": {{product.url | json | escape}},
|
|
336
|
-
"
|
|
337
|
-
"displayState": ${JSON.stringify(advancedDisplay)},
|
|
338
|
-
"totalVariantCombinations": {{total_combinations}},
|
|
339
|
-
"firstAvailableVariant": {{product.selected_or_first_available_variant | json | escape}}
|
|
346
|
+
"displayState":${JSON.stringify(advancedDisplay)}
|
|
340
347
|
}
|
|
341
348
|
'>
|
|
342
349
|
{%- assign options = product.options_with_values -%}
|
|
@@ -156,7 +156,6 @@ const BaseVariant = ({ optionTransform, optionTypography, optionBgColor, optionT
|
|
|
156
156
|
option-data="{{option.name | escape}}"
|
|
157
157
|
option-value="{{value | escape}}"
|
|
158
158
|
option-position="{{option.position}}"
|
|
159
|
-
data-gp-option-available="{{value.available}}"
|
|
160
159
|
option-type="${type || 'rectangle_list'}"
|
|
161
160
|
data-disabled="{%- if option_disabled == true -%} disabled {%- endif -%}"
|
|
162
161
|
data-hidden='true'
|
|
@@ -18,15 +18,6 @@ const DropdownVariant = ({ variantGroup, blankText, swatchAutoWidth, swatchHeigh
|
|
|
18
18
|
};
|
|
19
19
|
const appendTypoClass = core.composeTypographyClassName(optionTypo, optionTypography);
|
|
20
20
|
const appendTypoStyle = core.composeTypographyStyle(optionTypo, optionTypography);
|
|
21
|
-
const composeSelectOptionAttrs = `
|
|
22
|
-
option-data="{{option.name | escape}}"
|
|
23
|
-
option-value="{{value | escape}}"
|
|
24
|
-
data-gp-option-value-id="{{value.id}}"
|
|
25
|
-
data-gp-option-available="{{value.available}}"
|
|
26
|
-
value="{{value | escape}}"
|
|
27
|
-
class="option-value-wrapper"
|
|
28
|
-
key="{{value | escape}}"
|
|
29
|
-
`;
|
|
30
21
|
return core.template /* liquid */ `
|
|
31
22
|
<select
|
|
32
23
|
aria-label={{option.name | escape}}
|
|
@@ -82,42 +73,37 @@ const DropdownVariant = ({ variantGroup, blankText, swatchAutoWidth, swatchHeigh
|
|
|
82
73
|
-%}
|
|
83
74
|
${isSoldOutMark ? `{%- if option_disabled == true -%}
|
|
84
75
|
{%- if value == selectedValue -%}
|
|
85
|
-
<option disabled ${!hasPreSelected ? '' : 'selected'}
|
|
76
|
+
<option disabled ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
|
|
86
77
|
option-position="{{option.position}}"
|
|
87
|
-
|
|
78
|
+
option-value="{{value | escape}}" value="{{value | escape}}" class="option-value-wrapper" key="{{value | escape}}">
|
|
88
79
|
{{value}}
|
|
89
80
|
</option>
|
|
90
81
|
{% else %}
|
|
91
|
-
<option
|
|
92
|
-
|
|
93
|
-
${composeSelectOptionAttrs}>
|
|
82
|
+
<option disabled option-data="{{option.name | escape}}"
|
|
83
|
+
option-value="{{value | escape}}" value="{{value | escape}}" class="option-value-wrapper" key="{{value | escape}}">
|
|
94
84
|
{{value}}
|
|
95
85
|
</option>
|
|
96
86
|
{%- endif -%}
|
|
97
87
|
{%- else -%}
|
|
98
88
|
{%- if value == selectedValue -%}
|
|
99
|
-
<option ${!hasPreSelected ? '' : 'selected'}
|
|
100
|
-
option-position="{{option.position}}"
|
|
101
|
-
${composeSelectOptionAttrs}>
|
|
89
|
+
<option ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
|
|
90
|
+
option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
|
|
102
91
|
{{value}}
|
|
103
92
|
</option>
|
|
104
93
|
{% else %}
|
|
105
|
-
<option
|
|
106
|
-
|
|
107
|
-
option-position="{{option.position}}">
|
|
94
|
+
<option option-data="{{option.name | escape}}"
|
|
95
|
+
option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
|
|
108
96
|
{{value}}
|
|
109
97
|
</option>
|
|
110
98
|
{%- endif -%}
|
|
111
99
|
{%- endif -%}` : `{%- if value == selectedValue -%}
|
|
112
|
-
<option ${!hasPreSelected ? '' : 'selected'}
|
|
113
|
-
|
|
114
|
-
option-position="{{option.position}}">
|
|
100
|
+
<option ${!hasPreSelected ? '' : 'selected'} option-data="{{option.name | escape}}"
|
|
101
|
+
option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
|
|
115
102
|
{{value}}
|
|
116
103
|
</option>
|
|
117
104
|
{% else %}
|
|
118
|
-
<option
|
|
119
|
-
|
|
120
|
-
option-position="{{option.position}}">
|
|
105
|
+
<option option-data="{{option.name | escape}}"
|
|
106
|
+
option-value="{{value | escape}}" option-position="{{option.position}}" class="option-value-wrapper" value="{{value | escape}}" key="{{value | escape}}">
|
|
121
107
|
{{value}}
|
|
122
108
|
</option>
|
|
123
109
|
{%- endif -%}`}
|