@gem-sdk/components 2.0.0-dev.472 → 2.0.0-dev.474
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/product/components/ProductDiscountTag/index.liquid.js +1 -10
- package/dist/cjs/product/components/ProductProperties/ProductProperties.js +16 -0
- package/dist/cjs/product/components/ProductVariants/common/base/classes.js +3 -3
- package/dist/cjs/product/components/ProductVariants/components/base/base.liquid.js +4 -1
- package/dist/cjs/product/components/ProductVariants/components/variants/index.liquid.js +4 -1
- package/dist/cjs/product/components/ProductVariants/index.liquid.js +1 -1
- package/dist/cjs/product/setting/product-variant/configs/uiV2.js +17 -0
- package/dist/cjs/sticky/components/common/styles.js +5 -2
- package/dist/cjs/sticky/components/hooks/useSticky.js +5 -2
- package/dist/cjs/text/components/Text.liquid.js +4 -1
- package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +3 -12
- package/dist/esm/product/components/ProductProperties/ProductProperties.js +16 -0
- package/dist/esm/product/components/ProductVariants/common/base/classes.js +3 -3
- package/dist/esm/product/components/ProductVariants/components/base/base.liquid.js +4 -1
- package/dist/esm/product/components/ProductVariants/components/variants/index.liquid.js +4 -1
- package/dist/esm/product/components/ProductVariants/index.liquid.js +1 -1
- package/dist/esm/product/setting/product-variant/configs/uiV2.js +17 -0
- package/dist/esm/sticky/components/common/styles.js +5 -2
- package/dist/esm/sticky/components/hooks/useSticky.js +5 -2
- package/dist/esm/text/components/Text.liquid.js +4 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -38,13 +38,6 @@ const ProductTag = ({ setting, styles, builderProps, advanced, pageContext })=>{
|
|
|
38
38
|
const jsURL = core.isLocalEnv ? `{{ 'gp-product-tag.js' | asset_url }}` : `${core.baseAssetURL}/assets-v2/gp-product-tag.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
|
|
39
39
|
return `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${jsURL}" defer="defer"></script>`;
|
|
40
40
|
};
|
|
41
|
-
const stateData = system.createStateOrContext({
|
|
42
|
-
setting: JSON.stringify(setting).replaceAll("'", ''').replace(/</g, '<').replace(/>/g, '>'),
|
|
43
|
-
id: builderProps?.uid,
|
|
44
|
-
locale: '{{shop.locale}}',
|
|
45
|
-
currency: '{{shop.currency}}',
|
|
46
|
-
moneyFormat: `{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
|
|
47
|
-
});
|
|
48
41
|
return core.template`
|
|
49
42
|
{% liquid
|
|
50
43
|
assign price = variant.price | times: 1.0
|
|
@@ -63,10 +56,8 @@ const ProductTag = ({ setting, styles, builderProps, advanced, pageContext })=>{
|
|
|
63
56
|
style="${rootStyle}"
|
|
64
57
|
data-id="${builderProps?.uid}"
|
|
65
58
|
data-disabled="{%- if priceSave > 0 -%} false {%- else -%} true {%- endif -%}"
|
|
66
|
-
gp-data="
|
|
59
|
+
gp-data='{"setting":${JSON.stringify(setting).replaceAll("'", ''')}, "id": "${builderProps?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat": "{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}"}'
|
|
67
60
|
price-save="{{priceSave}}"
|
|
68
|
-
data-prefix="${pageContext?.isPreviewing ? prefixVal : `{{${prefixVal}}}`}"
|
|
69
|
-
data-suffix="${pageContext?.isPreviewing ? suffixVal : `{{${suffixVal}}}`}"
|
|
70
61
|
>
|
|
71
62
|
<div class="${containerClass}" style="${containerStyle}">
|
|
72
63
|
<div class="${wrapperTextClass}" style="${wrapperTextStyle}">
|
|
@@ -152,6 +152,19 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
|
|
|
152
152
|
required,
|
|
153
153
|
requiredMessage
|
|
154
154
|
]);
|
|
155
|
+
const checkRequireCheckbox = React.useCallback((value)=>{
|
|
156
|
+
if (!required) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
if (!value || value.length <= 0) {
|
|
160
|
+
return {
|
|
161
|
+
message: requiredMessage
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
}, [
|
|
165
|
+
required,
|
|
166
|
+
requiredMessage
|
|
167
|
+
]);
|
|
155
168
|
const handleChange = (e)=>{
|
|
156
169
|
setIsDirty(true);
|
|
157
170
|
if (type === 'checkbox') {
|
|
@@ -191,6 +204,7 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
|
|
|
191
204
|
case 'email':
|
|
192
205
|
return checkEmail(value);
|
|
193
206
|
case 'checkbox':
|
|
207
|
+
return checkRequireCheckbox(checkboxValue);
|
|
194
208
|
case 'radio':
|
|
195
209
|
case 'dropdown':
|
|
196
210
|
return checkRequire(value);
|
|
@@ -212,6 +226,8 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
|
|
|
212
226
|
isDirty,
|
|
213
227
|
type,
|
|
214
228
|
checkEmail,
|
|
229
|
+
checkRequireCheckbox,
|
|
230
|
+
checkboxValue,
|
|
215
231
|
checkRequire,
|
|
216
232
|
checkInput
|
|
217
233
|
]);
|
|
@@ -12,7 +12,7 @@ const getWrapperClass = (props)=>{
|
|
|
12
12
|
},
|
|
13
13
|
[appendTypoClass]: true,
|
|
14
14
|
'gp-p-[4px]': isColorType,
|
|
15
|
-
'before:gp-absolute before:gp-top-[50%] before:gp-z-1 before:gp-block before:gp-w-full before:-gp-rotate-45 before:gp-border-t before:gp-border-[#A1A1A1] before:gp-bg-[#333]
|
|
15
|
+
'before:gp-absolute before:gp-top-[50%] before:gp-z-1 before:gp-block before:gp-w-full before:-gp-rotate-45 before:gp-border-t before:gp-border-[#A1A1A1] before:gp-bg-[#333]': soldOutMarkLine && !available && !isColorType
|
|
16
16
|
});
|
|
17
17
|
const staticClasses = `gp-relative gp-flex gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden gp-w-full gp-h-full data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed
|
|
18
18
|
data-[hidden='false']:gp-flex`;
|
|
@@ -39,9 +39,9 @@ const getTextClass = ({ optionTypo, optionTypography, isColorType, isUploadImage
|
|
|
39
39
|
};
|
|
40
40
|
const getColorClass = ({ soldOutMarkLine, available })=>{
|
|
41
41
|
const dynamicClasses = core.cls({
|
|
42
|
-
'before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border
|
|
42
|
+
'before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border': soldOutMarkLine && !available
|
|
43
43
|
});
|
|
44
|
-
const staticClasses = `color gp-relative gp-h-full gp-w-full gp-overflow-hidden gp-min-w-fit gp-flex gp-color-circle
|
|
44
|
+
const staticClasses = `color gp-relative gp-h-full gp-w-full gp-overflow-hidden gp-min-w-fit gp-flex gp-color-circle`;
|
|
45
45
|
const combinedClasses = `${staticClasses} ${dynamicClasses}`.trim();
|
|
46
46
|
return core.composeClasses(combinedClasses);
|
|
47
47
|
};
|
|
@@ -79,7 +79,10 @@ const BaseVariant = (props)=>{
|
|
|
79
79
|
return renderText();
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
const wrapperClasses = system.createClass(classes.getWrapperClass(
|
|
82
|
+
const wrapperClasses = system.createClass(classes.getWrapperClass({
|
|
83
|
+
...props,
|
|
84
|
+
available: true
|
|
85
|
+
}));
|
|
83
86
|
const wrapperAttrs = system.createAttr(attrs.getWrapperAttr(props, 'Liquid'));
|
|
84
87
|
const wrapperActiveStyle = system.createStyle(styles.getWrapperStyleActive(props));
|
|
85
88
|
const wrapperNormalAndHoverStyle = system.createStyle(styles.getWrapperStyleNormalAndHover(props));
|
|
@@ -94,7 +94,10 @@ const VariantItem = (props)=>{
|
|
|
94
94
|
})}
|
|
95
95
|
`;
|
|
96
96
|
};
|
|
97
|
-
const labelClass = system.createClass(classes.getVariantItemLabelClass(
|
|
97
|
+
const labelClass = system.createClass(classes.getVariantItemLabelClass({
|
|
98
|
+
...props,
|
|
99
|
+
available: true
|
|
100
|
+
}));
|
|
98
101
|
const tooltipClass = system.createClass(classes.getTooltipClass());
|
|
99
102
|
const tooltipSvgClass = system.createClass(classes.getTooltipSvgClass());
|
|
100
103
|
const variantOptionClass = system.createClass(classes.getVariantOptionClass());
|
|
@@ -166,7 +166,7 @@ const ProductVariants = (props)=>{
|
|
|
166
166
|
${system.LiquidFor(`item in items`, `
|
|
167
167
|
${system.Liquid(`{%- assign itemPreset = item | split:'($1)' -%}`)}
|
|
168
168
|
${system.LiquidIf(`itemPreset[0] == optionName`, system.Liquid(`{%- assign type = itemPreset[1] -%}`))}
|
|
169
|
-
${system.LiquidIf(`itemPreset[0] == base`, system.Liquid(`{%- assign type = itemPreset[1] -%}`))}
|
|
169
|
+
${system.LiquidIf(`itemPreset[0] == "base"`, system.Liquid(`{%- assign type = itemPreset[1] -%}`))}
|
|
170
170
|
`)}
|
|
171
171
|
${system.Liquid(`{%- assign optionRendered = true -%}`)}
|
|
172
172
|
${system.LiquidFor(`value in values`, index_liquid.default({
|
|
@@ -16,6 +16,23 @@ const SettingUIV2 = [
|
|
|
16
16
|
}
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
|
+
{
|
|
20
|
+
controls: [
|
|
21
|
+
{
|
|
22
|
+
label: {
|
|
23
|
+
en: 'Product source'
|
|
24
|
+
},
|
|
25
|
+
controlConfig: {
|
|
26
|
+
id: 'gp-to-product',
|
|
27
|
+
type: 'product-source'
|
|
28
|
+
},
|
|
29
|
+
layout: 'vertical',
|
|
30
|
+
options: {
|
|
31
|
+
labelVariant: 'primary'
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
19
36
|
{
|
|
20
37
|
label: {
|
|
21
38
|
en: 'Option gap'
|
|
@@ -9,12 +9,15 @@ const getDisplayStyle = (device, display, position)=>{
|
|
|
9
9
|
const style = {
|
|
10
10
|
[`--top${device}`]: 'auto',
|
|
11
11
|
[`--${position + device}`]: '0',
|
|
12
|
-
[`--pos${device}`]: getCSSPosition(position)
|
|
12
|
+
[`--pos${device}`]: getCSSPosition(position, device)
|
|
13
13
|
};
|
|
14
14
|
if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
|
|
15
15
|
return style;
|
|
16
16
|
};
|
|
17
|
-
const getCSSPosition = (position)=>{
|
|
17
|
+
const getCSSPosition = (position, device)=>{
|
|
18
|
+
if (device === '-mobile') {
|
|
19
|
+
return 'fixed';
|
|
20
|
+
}
|
|
18
21
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
19
22
|
};
|
|
20
23
|
const displayConditionStyle = (display, position)=>{
|
|
@@ -10,7 +10,10 @@ const useSticky = (setting)=>{
|
|
|
10
10
|
const w = core.makeStyleResponsive('w', width);
|
|
11
11
|
const sidebarMode = core.usePageStore((s)=>s.sidebarMode === 'interaction');
|
|
12
12
|
const currentDevice = core.useCurrentDevice();
|
|
13
|
-
const getCSSPosition = (position)=>{
|
|
13
|
+
const getCSSPosition = (position, isMobile)=>{
|
|
14
|
+
if (isMobile) {
|
|
15
|
+
return 'fixed';
|
|
16
|
+
}
|
|
14
17
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
15
18
|
};
|
|
16
19
|
const getCSSAlignByDevice = (position, device)=>{
|
|
@@ -59,7 +62,7 @@ const useSticky = (setting)=>{
|
|
|
59
62
|
return {
|
|
60
63
|
[`--pos`]: getCSSPosition(position?.desktop),
|
|
61
64
|
[`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
|
|
62
|
-
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
|
|
65
|
+
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop, true)
|
|
63
66
|
};
|
|
64
67
|
}, [
|
|
65
68
|
position?.desktop,
|
|
@@ -9,9 +9,12 @@ var getStyle = require('./common/getStyle.js');
|
|
|
9
9
|
var getDisplayText = require('./common/getDisplayText.js');
|
|
10
10
|
var getClasses = require('./common/getClasses.js');
|
|
11
11
|
|
|
12
|
-
const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs })=>{
|
|
12
|
+
const Text = ({ id, styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs })=>{
|
|
13
13
|
const { htmlTag: Element = 'div', excludeFlex } = setting ?? {};
|
|
14
14
|
const attrs = system.createAttr({
|
|
15
|
+
...id && {
|
|
16
|
+
id
|
|
17
|
+
},
|
|
15
18
|
...getAttr.getAttr({
|
|
16
19
|
uid: builderProps?.uidInteraction ?? builderProps?.uid ?? ''
|
|
17
20
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { template,
|
|
1
|
+
import { template, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import { getDynamicSourceLocales, getSettingPreloadData } from '../../../helpers.js';
|
|
3
3
|
import Text from '../../../text/components/Text.liquid.js';
|
|
4
|
-
import { createStyle, createClass,
|
|
4
|
+
import { createStyle, createClass, LiquidIf, Liquid, If } from '@gem-sdk/system';
|
|
5
5
|
import { getWrapperTextClass, getContainerClass, getProductTagClass } from './common/getClasses.js';
|
|
6
6
|
import { getRootClass, getWrapperTextStyle, getContainerStyle } from './common/getStyle.js';
|
|
7
7
|
|
|
@@ -34,13 +34,6 @@ const ProductTag = ({ setting, styles, builderProps, advanced, pageContext })=>{
|
|
|
34
34
|
const jsURL = isLocalEnv ? `{{ 'gp-product-tag.js' | asset_url }}` : `${baseAssetURL}/assets-v2/gp-product-tag.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;
|
|
35
35
|
return `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${jsURL}" defer="defer"></script>`;
|
|
36
36
|
};
|
|
37
|
-
const stateData = createStateOrContext({
|
|
38
|
-
setting: JSON.stringify(setting).replaceAll("'", ''').replace(/</g, '<').replace(/>/g, '>'),
|
|
39
|
-
id: builderProps?.uid,
|
|
40
|
-
locale: '{{shop.locale}}',
|
|
41
|
-
currency: '{{shop.currency}}',
|
|
42
|
-
moneyFormat: `{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}`
|
|
43
|
-
});
|
|
44
37
|
return template`
|
|
45
38
|
{% liquid
|
|
46
39
|
assign price = variant.price | times: 1.0
|
|
@@ -59,10 +52,8 @@ const ProductTag = ({ setting, styles, builderProps, advanced, pageContext })=>{
|
|
|
59
52
|
style="${rootStyle}"
|
|
60
53
|
data-id="${builderProps?.uid}"
|
|
61
54
|
data-disabled="{%- if priceSave > 0 -%} false {%- else -%} true {%- endif -%}"
|
|
62
|
-
gp-data="
|
|
55
|
+
gp-data='{"setting":${JSON.stringify(setting).replaceAll("'", ''')}, "id": "${builderProps?.uid}", "locale": "{{shop.locale}}", "currency": "{{shop.currency}}", "moneyFormat": "{{ ${setting?.moneyWithCurrentFormat ? 'shop.money_with_currency_format' : 'shop.money_format'} | replace: '"', '\\"' | escape }}"}'
|
|
63
56
|
price-save="{{priceSave}}"
|
|
64
|
-
data-prefix="${pageContext?.isPreviewing ? prefixVal : `{{${prefixVal}}}`}"
|
|
65
|
-
data-suffix="${pageContext?.isPreviewing ? suffixVal : `{{${suffixVal}}}`}"
|
|
66
57
|
>
|
|
67
58
|
<div class="${containerClass}" style="${containerStyle}">
|
|
68
59
|
<div class="${wrapperTextClass}" style="${wrapperTextStyle}">
|
|
@@ -148,6 +148,19 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
|
|
|
148
148
|
required,
|
|
149
149
|
requiredMessage
|
|
150
150
|
]);
|
|
151
|
+
const checkRequireCheckbox = useCallback((value)=>{
|
|
152
|
+
if (!required) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (!value || value.length <= 0) {
|
|
156
|
+
return {
|
|
157
|
+
message: requiredMessage
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}, [
|
|
161
|
+
required,
|
|
162
|
+
requiredMessage
|
|
163
|
+
]);
|
|
151
164
|
const handleChange = (e)=>{
|
|
152
165
|
setIsDirty(true);
|
|
153
166
|
if (type === 'checkbox') {
|
|
@@ -187,6 +200,7 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
|
|
|
187
200
|
case 'email':
|
|
188
201
|
return checkEmail(value);
|
|
189
202
|
case 'checkbox':
|
|
203
|
+
return checkRequireCheckbox(checkboxValue);
|
|
190
204
|
case 'radio':
|
|
191
205
|
case 'dropdown':
|
|
192
206
|
return checkRequire(value);
|
|
@@ -208,6 +222,8 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
|
|
|
208
222
|
isDirty,
|
|
209
223
|
type,
|
|
210
224
|
checkEmail,
|
|
225
|
+
checkRequireCheckbox,
|
|
226
|
+
checkboxValue,
|
|
211
227
|
checkRequire,
|
|
212
228
|
checkInput
|
|
213
229
|
]);
|
|
@@ -10,7 +10,7 @@ const getWrapperClass = (props)=>{
|
|
|
10
10
|
},
|
|
11
11
|
[appendTypoClass]: true,
|
|
12
12
|
'gp-p-[4px]': isColorType,
|
|
13
|
-
'before:gp-absolute before:gp-top-[50%] before:gp-z-1 before:gp-block before:gp-w-full before:-gp-rotate-45 before:gp-border-t before:gp-border-[#A1A1A1] before:gp-bg-[#333]
|
|
13
|
+
'before:gp-absolute before:gp-top-[50%] before:gp-z-1 before:gp-block before:gp-w-full before:-gp-rotate-45 before:gp-border-t before:gp-border-[#A1A1A1] before:gp-bg-[#333]': soldOutMarkLine && !available && !isColorType
|
|
14
14
|
});
|
|
15
15
|
const staticClasses = `gp-relative gp-flex gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden gp-w-full gp-h-full data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed
|
|
16
16
|
data-[hidden='false']:gp-flex`;
|
|
@@ -37,9 +37,9 @@ const getTextClass = ({ optionTypo, optionTypography, isColorType, isUploadImage
|
|
|
37
37
|
};
|
|
38
38
|
const getColorClass = ({ soldOutMarkLine, available })=>{
|
|
39
39
|
const dynamicClasses = cls({
|
|
40
|
-
'before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border
|
|
40
|
+
'before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border': soldOutMarkLine && !available
|
|
41
41
|
});
|
|
42
|
-
const staticClasses = `color gp-relative gp-h-full gp-w-full gp-overflow-hidden gp-min-w-fit gp-flex gp-color-circle
|
|
42
|
+
const staticClasses = `color gp-relative gp-h-full gp-w-full gp-overflow-hidden gp-min-w-fit gp-flex gp-color-circle`;
|
|
43
43
|
const combinedClasses = `${staticClasses} ${dynamicClasses}`.trim();
|
|
44
44
|
return composeClasses(combinedClasses);
|
|
45
45
|
};
|
|
@@ -75,7 +75,10 @@ const BaseVariant = (props)=>{
|
|
|
75
75
|
return renderText();
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
const wrapperClasses = createClass(getWrapperClass(
|
|
78
|
+
const wrapperClasses = createClass(getWrapperClass({
|
|
79
|
+
...props,
|
|
80
|
+
available: true
|
|
81
|
+
}));
|
|
79
82
|
const wrapperAttrs = createAttr(getWrapperAttr(props, 'Liquid'));
|
|
80
83
|
const wrapperActiveStyle = createStyle(getWrapperStyleActive(props));
|
|
81
84
|
const wrapperNormalAndHoverStyle = createStyle(getWrapperStyleNormalAndHover(props));
|
|
@@ -90,7 +90,10 @@ const VariantItem = (props)=>{
|
|
|
90
90
|
})}
|
|
91
91
|
`;
|
|
92
92
|
};
|
|
93
|
-
const labelClass = createClass(getVariantItemLabelClass(
|
|
93
|
+
const labelClass = createClass(getVariantItemLabelClass({
|
|
94
|
+
...props,
|
|
95
|
+
available: true
|
|
96
|
+
}));
|
|
94
97
|
const tooltipClass = createClass(getTooltipClass());
|
|
95
98
|
const tooltipSvgClass = createClass(getTooltipSvgClass());
|
|
96
99
|
const variantOptionClass = createClass(getVariantOptionClass());
|
|
@@ -162,7 +162,7 @@ const ProductVariants = (props)=>{
|
|
|
162
162
|
${LiquidFor(`item in items`, `
|
|
163
163
|
${Liquid(`{%- assign itemPreset = item | split:'($1)' -%}`)}
|
|
164
164
|
${LiquidIf(`itemPreset[0] == optionName`, Liquid(`{%- assign type = itemPreset[1] -%}`))}
|
|
165
|
-
${LiquidIf(`itemPreset[0] == base`, Liquid(`{%- assign type = itemPreset[1] -%}`))}
|
|
165
|
+
${LiquidIf(`itemPreset[0] == "base"`, Liquid(`{%- assign type = itemPreset[1] -%}`))}
|
|
166
166
|
`)}
|
|
167
167
|
${Liquid(`{%- assign optionRendered = true -%}`)}
|
|
168
168
|
${LiquidFor(`value in values`, VariantItem({
|
|
@@ -14,6 +14,23 @@ const SettingUIV2 = [
|
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
},
|
|
17
|
+
{
|
|
18
|
+
controls: [
|
|
19
|
+
{
|
|
20
|
+
label: {
|
|
21
|
+
en: 'Product source'
|
|
22
|
+
},
|
|
23
|
+
controlConfig: {
|
|
24
|
+
id: 'gp-to-product',
|
|
25
|
+
type: 'product-source'
|
|
26
|
+
},
|
|
27
|
+
layout: 'vertical',
|
|
28
|
+
options: {
|
|
29
|
+
labelVariant: 'primary'
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
},
|
|
17
34
|
{
|
|
18
35
|
label: {
|
|
19
36
|
en: 'Option gap'
|
|
@@ -7,12 +7,15 @@ const getDisplayStyle = (device, display, position)=>{
|
|
|
7
7
|
const style = {
|
|
8
8
|
[`--top${device}`]: 'auto',
|
|
9
9
|
[`--${position + device}`]: '0',
|
|
10
|
-
[`--pos${device}`]: getCSSPosition(position)
|
|
10
|
+
[`--pos${device}`]: getCSSPosition(position, device)
|
|
11
11
|
};
|
|
12
12
|
if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
|
|
13
13
|
return style;
|
|
14
14
|
};
|
|
15
|
-
const getCSSPosition = (position)=>{
|
|
15
|
+
const getCSSPosition = (position, device)=>{
|
|
16
|
+
if (device === '-mobile') {
|
|
17
|
+
return 'fixed';
|
|
18
|
+
}
|
|
16
19
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
17
20
|
};
|
|
18
21
|
const displayConditionStyle = (display, position)=>{
|
|
@@ -6,7 +6,10 @@ const useSticky = (setting)=>{
|
|
|
6
6
|
const w = makeStyleResponsive('w', width);
|
|
7
7
|
const sidebarMode = usePageStore((s)=>s.sidebarMode === 'interaction');
|
|
8
8
|
const currentDevice = useCurrentDevice();
|
|
9
|
-
const getCSSPosition = (position)=>{
|
|
9
|
+
const getCSSPosition = (position, isMobile)=>{
|
|
10
|
+
if (isMobile) {
|
|
11
|
+
return 'fixed';
|
|
12
|
+
}
|
|
10
13
|
return position == 'top' ? 'sticky' : 'fixed';
|
|
11
14
|
};
|
|
12
15
|
const getCSSAlignByDevice = (position, device)=>{
|
|
@@ -55,7 +58,7 @@ const useSticky = (setting)=>{
|
|
|
55
58
|
return {
|
|
56
59
|
[`--pos`]: getCSSPosition(position?.desktop),
|
|
57
60
|
[`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
|
|
58
|
-
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
|
|
61
|
+
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop, true)
|
|
59
62
|
};
|
|
60
63
|
}, [
|
|
61
64
|
position?.desktop,
|
|
@@ -5,9 +5,12 @@ import { getStyle, getContainerStyle, getTextStyle } from './common/getStyle.js'
|
|
|
5
5
|
import { getDisplayText } from './common/getDisplayText.js';
|
|
6
6
|
import { getClasses, getTextClasses } from './common/getClasses.js';
|
|
7
7
|
|
|
8
|
-
const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs })=>{
|
|
8
|
+
const Text = ({ id, styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs })=>{
|
|
9
9
|
const { htmlTag: Element = 'div', excludeFlex } = setting ?? {};
|
|
10
10
|
const attrs = createAttr({
|
|
11
|
+
...id && {
|
|
12
|
+
id
|
|
13
|
+
},
|
|
11
14
|
...getAttr({
|
|
12
15
|
uid: builderProps?.uidInteraction ?? builderProps?.uid ?? ''
|
|
13
16
|
}),
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6293,7 +6293,7 @@ declare const MarqueeItem: ({ builderProps, itemBackgroundColor, itemBorderStyle
|
|
|
6293
6293
|
|
|
6294
6294
|
declare const Marquee: ({ children, style, builderAttrs, rawChildren, advanced, ...props }: MarqueeProps) => string;
|
|
6295
6295
|
|
|
6296
|
-
declare const Text: ({ styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs, }: _gem_sdk_core.BaseProps<{
|
|
6296
|
+
declare const Text: ({ id, styles, builderAttrs, style, setting, advanced, builderProps, className, isText, pageContext, elementAttrs, }: _gem_sdk_core.BaseProps<{
|
|
6297
6297
|
text?: string | number | undefined;
|
|
6298
6298
|
translate?: string | undefined;
|
|
6299
6299
|
htmlTag?: React.ElementType<any> | undefined;
|
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.474",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"update-img-src-3rd": "node ./scripts/update-img-src-3rd.js"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
26
|
+
"@gem-sdk/core": "2.0.0-dev.474",
|
|
27
27
|
"@gem-sdk/styles": "2.0.0-dev.464",
|
|
28
28
|
"@gem-sdk/system": "2.0.0-dev.464",
|
|
29
29
|
"@types/react-transition-group": "^4.4.5"
|