@gem-sdk/components 2.0.0-dev.723 → 2.0.0-dev.725
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.js +0 -5
- package/dist/cjs/banner/components/common/common.js +25 -9
- package/dist/cjs/banner/components/common/getClasses.js +3 -1
- package/dist/cjs/banner/components/common/getStyle.js +0 -1
- package/dist/cjs/product/components/ProductVariants/hooks/useGpVariants.js +3 -2
- package/dist/cjs/product/components/ProductWrap/hook/useProductSetting.js +2 -1
- package/dist/cjs/product/setting/product-variant/configs/uiV2.js +1 -10
- package/dist/esm/banner/components/HeroBannerItem.js +1 -6
- package/dist/esm/banner/components/common/common.js +26 -10
- package/dist/esm/banner/components/common/getClasses.js +4 -2
- package/dist/esm/banner/components/common/getStyle.js +2 -3
- package/dist/esm/product/components/ProductVariants/hooks/useGpVariants.js +3 -2
- package/dist/esm/product/components/ProductWrap/hook/useProductSetting.js +2 -1
- package/dist/esm/product/setting/product-variant/configs/uiV2.js +1 -10
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -56,11 +56,6 @@ const HeroBannerItem = (props)=>{
|
|
|
56
56
|
});
|
|
57
57
|
const backgroundStyle = system.createStyle({
|
|
58
58
|
...common.getBackgroundImageHeroBanner(background, enableLazyImage, isNotLiquid),
|
|
59
|
-
...core.getGradientBgrStyleByDevice(background, {
|
|
60
|
-
desktop: true,
|
|
61
|
-
tablet: true,
|
|
62
|
-
mobile: true
|
|
63
|
-
}),
|
|
64
59
|
...getStyle.getBackgroundStyle(styles, enableParallax, transform)
|
|
65
60
|
});
|
|
66
61
|
const containBackgroundClasses = system.createClass({
|
|
@@ -68,14 +68,24 @@ const imagePlaceholder = (background)=>{
|
|
|
68
68
|
mobile: helpers.createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
|
-
const
|
|
71
|
+
const getBgImageByScreen = (background, device, enableLazyImage, isNotLiquid)=>{
|
|
72
|
+
if (!background) return '';
|
|
72
73
|
const srcSet = getBgImage(background);
|
|
74
|
+
const backgroundByDevice = core.getResponsiveValueByScreen(background, device);
|
|
75
|
+
if (enableLazyImage && !isNotLiquid) return `url(${imagePlaceholder(background)[device]})`;
|
|
76
|
+
if (backgroundByDevice?.color?.includes(core.GRADIENT_BGR_KEY)) {
|
|
77
|
+
if (backgroundByDevice.type !== 'image') return `${backgroundByDevice.color}`;
|
|
78
|
+
return `url(${getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device, isNotLiquid)})${backgroundByDevice?.color ? `, ${backgroundByDevice.color}` : ''}`;
|
|
79
|
+
}
|
|
80
|
+
if (backgroundByDevice?.type === 'image') return `url(${getSrcSet.getImageSrc(core.getResponsiveValueByScreen(srcSet, device), device, isNotLiquid)})`;
|
|
81
|
+
};
|
|
82
|
+
const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNotLiquid = false)=>{
|
|
83
|
+
if (!background) return;
|
|
73
84
|
let result = {};
|
|
74
85
|
core.DEVICES.forEach((device)=>{
|
|
75
|
-
const bg = core.getValueByDevice(background, device);
|
|
76
86
|
result = {
|
|
77
87
|
...result,
|
|
78
|
-
[device]:
|
|
88
|
+
[device]: getBgImageByScreen(background, device, enableLazyImage, isNotLiquid)
|
|
79
89
|
};
|
|
80
90
|
});
|
|
81
91
|
return core.makeStyleResponsive('bgi', result);
|
|
@@ -96,11 +106,6 @@ const getAttachmentDevice = (background)=>{
|
|
|
96
106
|
});
|
|
97
107
|
return result;
|
|
98
108
|
};
|
|
99
|
-
const bgiEnableByDevice = (background)=>({
|
|
100
|
-
desktop: getEnableBgImageByDevice('desktop', background),
|
|
101
|
-
tablet: getEnableBgImageByDevice('tablet', background),
|
|
102
|
-
mobile: getEnableBgImageByDevice('mobile', background)
|
|
103
|
-
});
|
|
104
109
|
const horizontalAlign = (layout, contentPosition1Col, contentPosition2Col)=>mapContentPositionToHorizontal(getContentPosition(layout, contentPosition1Col, contentPosition2Col));
|
|
105
110
|
const scrollToContentBanner = (e)=>(e?.target)?.closest('div.gp-hero-banner-row')?.scrollTo(0, 0);
|
|
106
111
|
const getDataVideoHeroBannerResponsive = (nameDevice, data)=>{
|
|
@@ -379,6 +384,17 @@ const getClassSpaceBetween = (setting, contentPosition1Col, contentPosition2Col)
|
|
|
379
384
|
'mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end': settingRes.mobile?.cols?.length === 1 && contentPositionMobile === 'bottom'
|
|
380
385
|
};
|
|
381
386
|
};
|
|
387
|
+
const getClassSpaceBetweenLeftRight = (settingLayout)=>{
|
|
388
|
+
const settingLayoutResponsive = getResponsiveSetting(settingLayout);
|
|
389
|
+
const isLayoutDistributedDesktop = settingLayoutResponsive?.desktop?.type == 'left-distributed' || settingLayoutResponsive?.desktop?.type == 'right-distributed';
|
|
390
|
+
const isLayoutDistributedTablet = settingLayoutResponsive?.tablet?.type == 'left-distributed' || settingLayoutResponsive?.tablet?.type == 'right-distributed';
|
|
391
|
+
const isLayoutDistributedMobile = settingLayoutResponsive?.mobile?.type == 'left-distributed' || settingLayoutResponsive?.mobile?.type == 'right-distributed';
|
|
392
|
+
return {
|
|
393
|
+
'gp-h-full [&>*]:!gp-justify-between': isLayoutDistributedDesktop,
|
|
394
|
+
'tablet:gp-h-full tablet:[&>*]:!gp-justify-between': isLayoutDistributedTablet,
|
|
395
|
+
'mobile:gp-h-full mobile:[&>*]:!gp-justify-between': isLayoutDistributedMobile
|
|
396
|
+
};
|
|
397
|
+
};
|
|
382
398
|
const getClassForStretchContent = (verticalAlign)=>{
|
|
383
399
|
let result = {
|
|
384
400
|
desktop: 'none',
|
|
@@ -482,7 +498,6 @@ const getBannerLink = (setting)=>{
|
|
|
482
498
|
return link;
|
|
483
499
|
};
|
|
484
500
|
|
|
485
|
-
exports.bgiEnableByDevice = bgiEnableByDevice;
|
|
486
501
|
exports.debounce = debounce;
|
|
487
502
|
exports.fallbackImg = fallbackImg;
|
|
488
503
|
exports.getAspectRatioSettings = getAspectRatioSettings;
|
|
@@ -495,6 +510,7 @@ exports.getClassContentPosition = getClassContentPosition;
|
|
|
495
510
|
exports.getClassForContentByFitContent = getClassForContentByFitContent;
|
|
496
511
|
exports.getClassForStretchContent = getClassForStretchContent;
|
|
497
512
|
exports.getClassSpaceBetween = getClassSpaceBetween;
|
|
513
|
+
exports.getClassSpaceBetweenLeftRight = getClassSpaceBetweenLeftRight;
|
|
498
514
|
exports.getClipPath = getClipPath;
|
|
499
515
|
exports.getContentPosition = getContentPosition;
|
|
500
516
|
exports.getDataVideoHeroBannerResponsive = getDataVideoHeroBannerResponsive;
|
|
@@ -46,10 +46,12 @@ const getRowClasses = (styles, setting)=>{
|
|
|
46
46
|
const fitContentClass = common.getClassForContentByFitContent(sizeSetting, background);
|
|
47
47
|
const stretchContentClass = common.getClassForStretchContent(verticalAlign);
|
|
48
48
|
const layoutClass = common.getClassSpaceBetween(setting?.layout || {}, styles?.contentPosition1Col || {}, styles?.contentPosition2Col || {});
|
|
49
|
+
const layoutDistributedClass = common.getClassSpaceBetweenLeftRight(setting?.layout || {});
|
|
49
50
|
const classList = `gp-hero-banner-row gp-transition-all gp-duration-300 group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))] ${fitContentClass} ${stretchContentClass}`;
|
|
50
51
|
return {
|
|
51
52
|
...composeClasses(classList),
|
|
52
|
-
...layoutClass
|
|
53
|
+
...layoutClass,
|
|
54
|
+
...layoutDistributedClass
|
|
53
55
|
};
|
|
54
56
|
};
|
|
55
57
|
const getAdaptiveClasses = ()=>{
|
|
@@ -98,7 +98,6 @@ const getBackgroundStyle = (styles, enableParallax, transform)=>{
|
|
|
98
98
|
ignoreBgAttachment: true,
|
|
99
99
|
ignoreBackgroundImage: true
|
|
100
100
|
}),
|
|
101
|
-
...core.getGradientBgrStyleByDevice(background, common.bgiEnableByDevice(background)),
|
|
102
101
|
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
103
102
|
'--scale': `${hoverEffectScale || 100}%`,
|
|
104
103
|
...core.makeStyleResponsive('pos', common.getAttachmentDevice(background)),
|
|
@@ -22,14 +22,15 @@ const useGpVariants = (props, variants)=>{
|
|
|
22
22
|
});
|
|
23
23
|
const mode = core.useEditorMode();
|
|
24
24
|
const { selectedOptions, setSelectedOption, forceSelectedOption } = core.useSelectedOption();
|
|
25
|
-
const { setHasPreSelected } = core.useHasPreSelected();
|
|
25
|
+
const { setHasPreSelected, hasPreSelected: productHasPreSelected } = core.useHasPreSelected();
|
|
26
26
|
const [variantId, setVariantId] = React.useState('');
|
|
27
27
|
React.useEffect(()=>{
|
|
28
28
|
const url = new URL(window.location.href);
|
|
29
29
|
const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
|
|
30
|
-
setHasPreSelected(hasPreSelected || !!variantParam);
|
|
30
|
+
if (productHasPreSelected === undefined) setHasPreSelected(hasPreSelected || !!variantParam);
|
|
31
31
|
}, [
|
|
32
32
|
hasPreSelected,
|
|
33
|
+
productHasPreSelected,
|
|
33
34
|
setHasPreSelected
|
|
34
35
|
]);
|
|
35
36
|
React.useEffect(()=>{
|
|
@@ -33,7 +33,8 @@ const useProductSetting = (props)=>{
|
|
|
33
33
|
quantity,
|
|
34
34
|
readOnly,
|
|
35
35
|
isSyncProduct,
|
|
36
|
-
key: `uid-${product?.id}-${initialVariantId ?? ''}
|
|
36
|
+
key: `uid-${product?.id}-${initialVariantId ?? ''}`,
|
|
37
|
+
hasPreSelected: productSetting?.hasPreSelected
|
|
37
38
|
}), [
|
|
38
39
|
initialVariantId,
|
|
39
40
|
isSyncProduct,
|
|
@@ -487,22 +487,13 @@ const SettingUIV2 = [
|
|
|
487
487
|
}
|
|
488
488
|
},
|
|
489
489
|
{
|
|
490
|
-
label: {
|
|
491
|
-
en: 'Default option'
|
|
492
|
-
},
|
|
493
|
-
setting: {
|
|
494
|
-
id: 'hasPreSelected'
|
|
495
|
-
}
|
|
496
|
-
},
|
|
497
|
-
{
|
|
498
|
-
conditionDisplay: 'hasPreSelected == true',
|
|
499
490
|
layout: 'vertical',
|
|
500
491
|
setting: {
|
|
501
492
|
id: 'selectVariantDefault'
|
|
502
493
|
}
|
|
503
494
|
},
|
|
504
495
|
{
|
|
505
|
-
conditionDisplay: 'hasPreSelected == false',
|
|
496
|
+
conditionDisplay: 'productSetting?.hasPreSelected === false || (productSetting?.hasPreSelected === undefined && hasPreSelected == false)',
|
|
506
497
|
label: {
|
|
507
498
|
en: 'Blank option text'
|
|
508
499
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import Row from '../../grid/row/Row.js';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { useEditorMode,
|
|
5
|
+
import { useEditorMode, filterToolbarPreview, getAspectRatioGlobalSize } from '@gem-sdk/core';
|
|
6
6
|
import { createStyle, createClass } from '@gem-sdk/system';
|
|
7
7
|
import AdaptiveImage from '../../image/components/AdaptiveImage.js';
|
|
8
8
|
import HTML5Embed from '../../video/components/HTML5Embed.js';
|
|
@@ -52,11 +52,6 @@ const HeroBannerItem = (props)=>{
|
|
|
52
52
|
});
|
|
53
53
|
const backgroundStyle = createStyle({
|
|
54
54
|
...getBackgroundImageHeroBanner(background, enableLazyImage, isNotLiquid),
|
|
55
|
-
...getGradientBgrStyleByDevice(background, {
|
|
56
|
-
desktop: true,
|
|
57
|
-
tablet: true,
|
|
58
|
-
mobile: true
|
|
59
|
-
}),
|
|
60
55
|
...getBackgroundStyle(styles, enableParallax, transform)
|
|
61
56
|
});
|
|
62
57
|
const containBackgroundClasses = createClass({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getResponsiveValueByScreen, getAspectRatioGlobalSize, makeStyleResponsive, DEVICES, getValueByDevice, cls } from '@gem-sdk/core';
|
|
1
|
+
import { getResponsiveValueByScreen, getAspectRatioGlobalSize, makeStyleResponsive, DEVICES, getValueByDevice, GRADIENT_BGR_KEY, cls } from '@gem-sdk/core';
|
|
2
2
|
import { getImageSrc } from '../../../image/helpers/getSrcSet.js';
|
|
3
3
|
import { HREF_TO_SALES_PAGE } from '../../../constant.js';
|
|
4
4
|
import { createBlurDataURL } from '../../../image/components/common/helpers.js';
|
|
@@ -66,14 +66,24 @@ const imagePlaceholder = (background)=>{
|
|
|
66
66
|
mobile: createBlurDataURL(srcSet?.mobile?.width ?? srcSet?.tablet?.width ?? srcSet?.desktop?.width ?? 0, srcSet?.mobile?.height ?? srcSet?.tablet?.height ?? srcSet?.desktop?.width ?? 0)
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
const
|
|
69
|
+
const getBgImageByScreen = (background, device, enableLazyImage, isNotLiquid)=>{
|
|
70
|
+
if (!background) return '';
|
|
70
71
|
const srcSet = getBgImage(background);
|
|
72
|
+
const backgroundByDevice = getResponsiveValueByScreen(background, device);
|
|
73
|
+
if (enableLazyImage && !isNotLiquid) return `url(${imagePlaceholder(background)[device]})`;
|
|
74
|
+
if (backgroundByDevice?.color?.includes(GRADIENT_BGR_KEY)) {
|
|
75
|
+
if (backgroundByDevice.type !== 'image') return `${backgroundByDevice.color}`;
|
|
76
|
+
return `url(${getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid)})${backgroundByDevice?.color ? `, ${backgroundByDevice.color}` : ''}`;
|
|
77
|
+
}
|
|
78
|
+
if (backgroundByDevice?.type === 'image') return `url(${getImageSrc(getResponsiveValueByScreen(srcSet, device), device, isNotLiquid)})`;
|
|
79
|
+
};
|
|
80
|
+
const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNotLiquid = false)=>{
|
|
81
|
+
if (!background) return;
|
|
71
82
|
let result = {};
|
|
72
83
|
DEVICES.forEach((device)=>{
|
|
73
|
-
const bg = getValueByDevice(background, device);
|
|
74
84
|
result = {
|
|
75
85
|
...result,
|
|
76
|
-
[device]:
|
|
86
|
+
[device]: getBgImageByScreen(background, device, enableLazyImage, isNotLiquid)
|
|
77
87
|
};
|
|
78
88
|
});
|
|
79
89
|
return makeStyleResponsive('bgi', result);
|
|
@@ -94,11 +104,6 @@ const getAttachmentDevice = (background)=>{
|
|
|
94
104
|
});
|
|
95
105
|
return result;
|
|
96
106
|
};
|
|
97
|
-
const bgiEnableByDevice = (background)=>({
|
|
98
|
-
desktop: getEnableBgImageByDevice('desktop', background),
|
|
99
|
-
tablet: getEnableBgImageByDevice('tablet', background),
|
|
100
|
-
mobile: getEnableBgImageByDevice('mobile', background)
|
|
101
|
-
});
|
|
102
107
|
const horizontalAlign = (layout, contentPosition1Col, contentPosition2Col)=>mapContentPositionToHorizontal(getContentPosition(layout, contentPosition1Col, contentPosition2Col));
|
|
103
108
|
const scrollToContentBanner = (e)=>(e?.target)?.closest('div.gp-hero-banner-row')?.scrollTo(0, 0);
|
|
104
109
|
const getDataVideoHeroBannerResponsive = (nameDevice, data)=>{
|
|
@@ -377,6 +382,17 @@ const getClassSpaceBetween = (setting, contentPosition1Col, contentPosition2Col)
|
|
|
377
382
|
'mobile:!gp-content-stretch mobile:[&>*]:!gp-justify-end': settingRes.mobile?.cols?.length === 1 && contentPositionMobile === 'bottom'
|
|
378
383
|
};
|
|
379
384
|
};
|
|
385
|
+
const getClassSpaceBetweenLeftRight = (settingLayout)=>{
|
|
386
|
+
const settingLayoutResponsive = getResponsiveSetting(settingLayout);
|
|
387
|
+
const isLayoutDistributedDesktop = settingLayoutResponsive?.desktop?.type == 'left-distributed' || settingLayoutResponsive?.desktop?.type == 'right-distributed';
|
|
388
|
+
const isLayoutDistributedTablet = settingLayoutResponsive?.tablet?.type == 'left-distributed' || settingLayoutResponsive?.tablet?.type == 'right-distributed';
|
|
389
|
+
const isLayoutDistributedMobile = settingLayoutResponsive?.mobile?.type == 'left-distributed' || settingLayoutResponsive?.mobile?.type == 'right-distributed';
|
|
390
|
+
return {
|
|
391
|
+
'gp-h-full [&>*]:!gp-justify-between': isLayoutDistributedDesktop,
|
|
392
|
+
'tablet:gp-h-full tablet:[&>*]:!gp-justify-between': isLayoutDistributedTablet,
|
|
393
|
+
'mobile:gp-h-full mobile:[&>*]:!gp-justify-between': isLayoutDistributedMobile
|
|
394
|
+
};
|
|
395
|
+
};
|
|
380
396
|
const getClassForStretchContent = (verticalAlign)=>{
|
|
381
397
|
let result = {
|
|
382
398
|
desktop: 'none',
|
|
@@ -480,4 +496,4 @@ const getBannerLink = (setting)=>{
|
|
|
480
496
|
return link;
|
|
481
497
|
};
|
|
482
498
|
|
|
483
|
-
export {
|
|
499
|
+
export { debounce, fallbackImg, getAspectRatioSettings, getAttachmentDevice, getBackgroundImageHeroBanner, getBannerLink, getBgImage, getClassAlignBanner, getClassContentPosition, getClassForContentByFitContent, getClassForStretchContent, getClassSpaceBetween, getClassSpaceBetweenLeftRight, getClipPath, getContentPosition, getDataVideoHeroBannerResponsive, getDisplayStyleByFitContent, getEnableBgImageByDevice, getPercentageVisible, getResponsiveSetting, getStyleAspectRatioHeroBannerCustom, getStyleHeroBannerBg, getVisibilityStyle, getWidth, horizontalAlign, imagePlaceholder, isScaleImage, mapContentPositionToHorizontal, scrollToContentBanner, showVideoType };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getGlobalColorStateClass, getValueByDevice } from '@gem-sdk/core';
|
|
2
|
-
import { getClassAlignBanner, getResponsiveSetting, getClassContentPosition, getContentPosition, getClassForContentByFitContent, getClassForStretchContent, getClassSpaceBetween } from './common.js';
|
|
2
|
+
import { getClassAlignBanner, getResponsiveSetting, getClassContentPosition, getContentPosition, getClassForContentByFitContent, getClassForStretchContent, getClassSpaceBetween, getClassSpaceBetweenLeftRight } from './common.js';
|
|
3
3
|
|
|
4
4
|
function composeClasses(classList) {
|
|
5
5
|
return classList.split(' ').reduce((acc, item)=>{
|
|
@@ -44,10 +44,12 @@ const getRowClasses = (styles, setting)=>{
|
|
|
44
44
|
const fitContentClass = getClassForContentByFitContent(sizeSetting, background);
|
|
45
45
|
const stretchContentClass = getClassForStretchContent(verticalAlign);
|
|
46
46
|
const layoutClass = getClassSpaceBetween(setting?.layout || {}, styles?.contentPosition1Col || {}, styles?.contentPosition2Col || {});
|
|
47
|
+
const layoutDistributedClass = getClassSpaceBetweenLeftRight(setting?.layout || {});
|
|
47
48
|
const classList = `gp-hero-banner-row gp-transition-all gp-duration-300 group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))] ${fitContentClass} ${stretchContentClass}`;
|
|
48
49
|
return {
|
|
49
50
|
...composeClasses(classList),
|
|
50
|
-
...layoutClass
|
|
51
|
+
...layoutClass,
|
|
52
|
+
...layoutDistributedClass
|
|
51
53
|
};
|
|
52
54
|
};
|
|
53
55
|
const getAdaptiveClasses = ()=>{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { makeStyleResponsive, getHeightByShapeGlobalSize, makeStyleWithDefault, getWidthByShapeGlobalSize, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleShadow, getGlobalColorStateStyle, makeStyleState, getResponsiveStylePadding, getStyleBackgroundByDevice
|
|
2
|
-
import { getVisibilityStyle, getStyleAspectRatioHeroBannerCustom, getAspectRatioSettings, getDisplayStyleByFitContent, getStyleHeroBannerBg,
|
|
1
|
+
import { makeStyleResponsive, getHeightByShapeGlobalSize, makeStyleWithDefault, getWidthByShapeGlobalSize, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleShadow, getGlobalColorStateStyle, makeStyleState, getResponsiveStylePadding, getStyleBackgroundByDevice } from '@gem-sdk/core';
|
|
2
|
+
import { getVisibilityStyle, getStyleAspectRatioHeroBannerCustom, getAspectRatioSettings, getDisplayStyleByFitContent, getStyleHeroBannerBg, getAttachmentDevice, getClipPath, getResponsiveSetting } from './common.js';
|
|
3
3
|
|
|
4
4
|
function filterTruthyStyles(styles) {
|
|
5
5
|
return Object.fromEntries(Object.entries(styles || {}).filter(([, value])=>!!value));
|
|
@@ -96,7 +96,6 @@ const getBackgroundStyle = (styles, enableParallax, transform)=>{
|
|
|
96
96
|
ignoreBgAttachment: true,
|
|
97
97
|
ignoreBackgroundImage: true
|
|
98
98
|
}),
|
|
99
|
-
...getGradientBgrStyleByDevice(background, bgiEnableByDevice(background)),
|
|
100
99
|
'--duration': `${hoverEffectDuration ?? 0}s`,
|
|
101
100
|
'--scale': `${hoverEffectScale || 100}%`,
|
|
102
101
|
...makeStyleResponsive('pos', getAttachmentDevice(background)),
|
|
@@ -20,14 +20,15 @@ const useGpVariants = (props, variants)=>{
|
|
|
20
20
|
});
|
|
21
21
|
const mode = useEditorMode();
|
|
22
22
|
const { selectedOptions, setSelectedOption, forceSelectedOption } = useSelectedOption();
|
|
23
|
-
const { setHasPreSelected } = useHasPreSelected();
|
|
23
|
+
const { setHasPreSelected, hasPreSelected: productHasPreSelected } = useHasPreSelected();
|
|
24
24
|
const [variantId, setVariantId] = useState('');
|
|
25
25
|
useEffect(()=>{
|
|
26
26
|
const url = new URL(window.location.href);
|
|
27
27
|
const variantParam = url.searchParams.get(VARIANT_PARAM_PATH);
|
|
28
|
-
setHasPreSelected(hasPreSelected || !!variantParam);
|
|
28
|
+
if (productHasPreSelected === undefined) setHasPreSelected(hasPreSelected || !!variantParam);
|
|
29
29
|
}, [
|
|
30
30
|
hasPreSelected,
|
|
31
|
+
productHasPreSelected,
|
|
31
32
|
setHasPreSelected
|
|
32
33
|
]);
|
|
33
34
|
useEffect(()=>{
|
|
@@ -31,7 +31,8 @@ const useProductSetting = (props)=>{
|
|
|
31
31
|
quantity,
|
|
32
32
|
readOnly,
|
|
33
33
|
isSyncProduct,
|
|
34
|
-
key: `uid-${product?.id}-${initialVariantId ?? ''}
|
|
34
|
+
key: `uid-${product?.id}-${initialVariantId ?? ''}`,
|
|
35
|
+
hasPreSelected: productSetting?.hasPreSelected
|
|
35
36
|
}), [
|
|
36
37
|
initialVariantId,
|
|
37
38
|
isSyncProduct,
|
|
@@ -485,22 +485,13 @@ const SettingUIV2 = [
|
|
|
485
485
|
}
|
|
486
486
|
},
|
|
487
487
|
{
|
|
488
|
-
label: {
|
|
489
|
-
en: 'Default option'
|
|
490
|
-
},
|
|
491
|
-
setting: {
|
|
492
|
-
id: 'hasPreSelected'
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
{
|
|
496
|
-
conditionDisplay: 'hasPreSelected == true',
|
|
497
488
|
layout: 'vertical',
|
|
498
489
|
setting: {
|
|
499
490
|
id: 'selectVariantDefault'
|
|
500
491
|
}
|
|
501
492
|
},
|
|
502
493
|
{
|
|
503
|
-
conditionDisplay: 'hasPreSelected == false',
|
|
494
|
+
conditionDisplay: 'productSetting?.hasPreSelected === false || (productSetting?.hasPreSelected === undefined && hasPreSelected == false)',
|
|
504
495
|
label: {
|
|
505
496
|
en: 'Blank option text'
|
|
506
497
|
},
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.725",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
28
|
+
"@gem-sdk/core": "2.0.0-dev.725",
|
|
29
29
|
"@gem-sdk/styles": "2.0.0-dev.703",
|
|
30
30
|
"@gem-sdk/system": "2.0.0-dev.695",
|
|
31
31
|
"@types/react-transition-group": "^4.4.5",
|