@gem-sdk/components 2.0.0-dev.489 → 2.0.0-dev.490
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/setting/uiV2.js +3 -2
- package/dist/cjs/stock-counter/components/StockCounter.js +5 -7
- package/dist/cjs/stock-counter/components/StockCounter.liquid.js +9 -15
- package/dist/cjs/stock-counter/components/common/getAttrs.js +5 -2
- package/dist/cjs/stock-counter/components/common/getClasses.js +3 -10
- package/dist/esm/banner/setting/uiV2.js +3 -2
- package/dist/esm/stock-counter/components/StockCounter.js +6 -8
- package/dist/esm/stock-counter/components/StockCounter.liquid.js +9 -15
- package/dist/esm/stock-counter/components/common/getAttrs.js +5 -2
- package/dist/esm/stock-counter/components/common/getClasses.js +3 -10
- package/package.json +1 -1
|
@@ -267,14 +267,15 @@ const SettingUIV2 = [
|
|
|
267
267
|
type: 'combo',
|
|
268
268
|
comboType: 'color',
|
|
269
269
|
getValueFromSettingID: 'overlayColor.hover',
|
|
270
|
-
defaultValueWhenClear: '
|
|
270
|
+
defaultValueWhenClear: 'transparent',
|
|
271
|
+
compoDefaultValue: '#121212',
|
|
271
272
|
controls: [
|
|
272
273
|
{
|
|
273
274
|
setting: {
|
|
274
275
|
id: 'overlayColor',
|
|
275
276
|
state: 'hover'
|
|
276
277
|
},
|
|
277
|
-
|
|
278
|
+
compoDefaultValue: '#121212 ',
|
|
278
279
|
label: {
|
|
279
280
|
en: 'Color'
|
|
280
281
|
}
|
|
@@ -58,11 +58,9 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
58
58
|
...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
-
const textClasses = (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
};
|
|
61
|
+
const textClasses = system.createClass({
|
|
62
|
+
...getClasses.getTextClasses(styles)
|
|
63
|
+
});
|
|
66
64
|
const textStyles = (isOutOfStock)=>{
|
|
67
65
|
return system.createStyle({
|
|
68
66
|
...getStyles.getTextStyles(styles, isOutOfStock)
|
|
@@ -121,13 +119,13 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
121
119
|
dangerouslySetInnerHTML: {
|
|
122
120
|
__html: getMessage()
|
|
123
121
|
},
|
|
124
|
-
className: textClasses
|
|
122
|
+
className: textClasses,
|
|
125
123
|
style: textStyles(true)
|
|
126
124
|
}) : /*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
127
125
|
dangerouslySetInnerHTML: {
|
|
128
126
|
__html: getMessage()
|
|
129
127
|
},
|
|
130
|
-
className: textClasses
|
|
128
|
+
className: textClasses,
|
|
131
129
|
style: textStyles(false)
|
|
132
130
|
}))
|
|
133
131
|
]
|
|
@@ -61,12 +61,10 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
61
61
|
const progressBarAttrs = system.createAttr({
|
|
62
62
|
...getAttrs.getLiquidProgressBarAttrs()
|
|
63
63
|
});
|
|
64
|
-
const textClasses = (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
});
|
|
69
|
-
};
|
|
64
|
+
const textClasses = system.createClass({
|
|
65
|
+
...getClasses.getTextClasses(styles),
|
|
66
|
+
...core.composeClasses('gp-stock-counter-mark')
|
|
67
|
+
});
|
|
70
68
|
const textStyles = (isOutOfStock)=>{
|
|
71
69
|
return system.createStyle({
|
|
72
70
|
...getStyles.getTextStyles(styles, isOutOfStock)
|
|
@@ -138,27 +136,23 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
138
136
|
</div>`)}
|
|
139
137
|
`)}
|
|
140
138
|
${core.RenderIf(showText, core.template`
|
|
141
|
-
{
|
|
142
|
-
<p
|
|
139
|
+
${system.LiquidIf('is_out_of_stock', core.template`<p
|
|
143
140
|
${{
|
|
144
141
|
...textAttrs
|
|
145
142
|
}}
|
|
146
|
-
class="${textClasses
|
|
143
|
+
class="${textClasses}"
|
|
147
144
|
style="${textStyles(true)}"
|
|
148
145
|
>
|
|
149
146
|
${liquidTextContent}
|
|
150
|
-
</p
|
|
151
|
-
{% else %}
|
|
152
|
-
<p
|
|
147
|
+
</p>`, core.template`<p
|
|
153
148
|
${{
|
|
154
149
|
...textAttrs
|
|
155
150
|
}}
|
|
156
|
-
class="${textClasses
|
|
151
|
+
class="${textClasses}"
|
|
157
152
|
style="${textStyles(false)}"
|
|
158
153
|
>
|
|
159
154
|
${liquidTextContent}
|
|
160
|
-
</p
|
|
161
|
-
{% endif %}
|
|
155
|
+
</p>`)}
|
|
162
156
|
`)}
|
|
163
157
|
|
|
164
158
|
</div>
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
4
4
|
const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
|
|
5
|
-
const { displayProgressBar, textColor } = styles ?? {};
|
|
5
|
+
const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
|
|
6
6
|
const mainColor = textColor || 'brand';
|
|
7
|
+
const typoColor = typo?.attrs?.color;
|
|
7
8
|
return {
|
|
8
9
|
'data-id': builderProps?.uid ?? '',
|
|
9
10
|
'data-visible': '{{ should_display }}',
|
|
@@ -17,7 +18,9 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
|
17
18
|
continueSelling,
|
|
18
19
|
unlimitedQuantityMessage,
|
|
19
20
|
color: mainColor,
|
|
20
|
-
hiddenCounterWhenOutOfStock
|
|
21
|
+
hiddenCounterWhenOutOfStock,
|
|
22
|
+
oosTextColor,
|
|
23
|
+
typoColor
|
|
21
24
|
}).replaceAll(`"`, '"')
|
|
22
25
|
};
|
|
23
26
|
};
|
|
@@ -38,16 +38,9 @@ const getIconClasses = ()=>{
|
|
|
38
38
|
...core.composeClasses('gp-shrink-0 gp-bg-[length:60px_100%]')
|
|
39
39
|
};
|
|
40
40
|
};
|
|
41
|
-
const getTextClasses = (styles
|
|
42
|
-
const { typo
|
|
43
|
-
const
|
|
44
|
-
...typo,
|
|
45
|
-
attrs: {
|
|
46
|
-
...typo?.attrs,
|
|
47
|
-
color: isOutOfStock ? oosTextColor : typo?.attrs?.color
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const appendTypoClass = core.composeTypographyClassName(displayTypo, styles?.typography);
|
|
41
|
+
const getTextClasses = (styles)=>{
|
|
42
|
+
const { typo } = styles ?? {};
|
|
43
|
+
const appendTypoClass = core.composeTypographyClassName(typo, styles?.typography);
|
|
51
44
|
return {
|
|
52
45
|
...core.composeClasses(appendTypoClass)
|
|
53
46
|
};
|
|
@@ -265,14 +265,15 @@ const SettingUIV2 = [
|
|
|
265
265
|
type: 'combo',
|
|
266
266
|
comboType: 'color',
|
|
267
267
|
getValueFromSettingID: 'overlayColor.hover',
|
|
268
|
-
defaultValueWhenClear: '
|
|
268
|
+
defaultValueWhenClear: 'transparent',
|
|
269
|
+
compoDefaultValue: '#121212',
|
|
269
270
|
controls: [
|
|
270
271
|
{
|
|
271
272
|
setting: {
|
|
272
273
|
id: 'overlayColor',
|
|
273
274
|
state: 'hover'
|
|
274
275
|
},
|
|
275
|
-
|
|
276
|
+
compoDefaultValue: '#121212 ',
|
|
276
277
|
label: {
|
|
277
278
|
en: 'Color'
|
|
278
279
|
}
|
|
@@ -3,7 +3,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useRef, useEffect } from 'react';
|
|
4
4
|
import { useStockCounterInteraction } from '../hooks/useStockCounterInteraction.js';
|
|
5
5
|
import { getInlineCss } from './common/getInlineCss.js';
|
|
6
|
-
import { getProgressBarClasses, getContainerClasses, getWrapperIconClasses, getIconClasses,
|
|
6
|
+
import { getProgressBarClasses, getContainerClasses, getWrapperIconClasses, getIconClasses, getTextClasses, getWrapperClasses } from './common/getClasses.js';
|
|
7
7
|
import { getProgressBarStyles, getContainerStyles, getWrapperStyles, getIconStyles, getTextStyles } from './common/getStyles.js';
|
|
8
8
|
import 'next/link';
|
|
9
9
|
import '@gem-sdk/core';
|
|
@@ -54,11 +54,9 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
54
54
|
...getIconAttrs(isOutOfStockIcon, isVisible)
|
|
55
55
|
});
|
|
56
56
|
};
|
|
57
|
-
const textClasses = (
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
});
|
|
61
|
-
};
|
|
57
|
+
const textClasses = createClass({
|
|
58
|
+
...getTextClasses(styles)
|
|
59
|
+
});
|
|
62
60
|
const textStyles = (isOutOfStock)=>{
|
|
63
61
|
return createStyle({
|
|
64
62
|
...getTextStyles(styles, isOutOfStock)
|
|
@@ -117,13 +115,13 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
117
115
|
dangerouslySetInnerHTML: {
|
|
118
116
|
__html: getMessage()
|
|
119
117
|
},
|
|
120
|
-
className: textClasses
|
|
118
|
+
className: textClasses,
|
|
121
119
|
style: textStyles(true)
|
|
122
120
|
}) : /*#__PURE__*/ jsx("p", {
|
|
123
121
|
dangerouslySetInnerHTML: {
|
|
124
122
|
__html: getMessage()
|
|
125
123
|
},
|
|
126
|
-
className: textClasses
|
|
124
|
+
className: textClasses,
|
|
127
125
|
style: textStyles(false)
|
|
128
126
|
}))
|
|
129
127
|
]
|
|
@@ -57,12 +57,10 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
57
57
|
const progressBarAttrs = createAttr({
|
|
58
58
|
...getLiquidProgressBarAttrs()
|
|
59
59
|
});
|
|
60
|
-
const textClasses = (
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
65
|
-
};
|
|
60
|
+
const textClasses = createClass({
|
|
61
|
+
...getTextClasses(styles),
|
|
62
|
+
...composeClasses('gp-stock-counter-mark')
|
|
63
|
+
});
|
|
66
64
|
const textStyles = (isOutOfStock)=>{
|
|
67
65
|
return createStyle({
|
|
68
66
|
...getTextStyles(styles, isOutOfStock)
|
|
@@ -134,27 +132,23 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
134
132
|
</div>`)}
|
|
135
133
|
`)}
|
|
136
134
|
${RenderIf(showText, template`
|
|
137
|
-
{
|
|
138
|
-
<p
|
|
135
|
+
${LiquidIf('is_out_of_stock', template`<p
|
|
139
136
|
${{
|
|
140
137
|
...textAttrs
|
|
141
138
|
}}
|
|
142
|
-
class="${textClasses
|
|
139
|
+
class="${textClasses}"
|
|
143
140
|
style="${textStyles(true)}"
|
|
144
141
|
>
|
|
145
142
|
${liquidTextContent}
|
|
146
|
-
</p
|
|
147
|
-
{% else %}
|
|
148
|
-
<p
|
|
143
|
+
</p>`, template`<p
|
|
149
144
|
${{
|
|
150
145
|
...textAttrs
|
|
151
146
|
}}
|
|
152
|
-
class="${textClasses
|
|
147
|
+
class="${textClasses}"
|
|
153
148
|
style="${textStyles(false)}"
|
|
154
149
|
>
|
|
155
150
|
${liquidTextContent}
|
|
156
|
-
</p
|
|
157
|
-
{% endif %}
|
|
151
|
+
</p>`)}
|
|
158
152
|
`)}
|
|
159
153
|
|
|
160
154
|
</div>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
2
2
|
const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
|
|
3
|
-
const { displayProgressBar, textColor } = styles ?? {};
|
|
3
|
+
const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
|
|
4
4
|
const mainColor = textColor || 'brand';
|
|
5
|
+
const typoColor = typo?.attrs?.color;
|
|
5
6
|
return {
|
|
6
7
|
'data-id': builderProps?.uid ?? '',
|
|
7
8
|
'data-visible': '{{ should_display }}',
|
|
@@ -15,7 +16,9 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
|
15
16
|
continueSelling,
|
|
16
17
|
unlimitedQuantityMessage,
|
|
17
18
|
color: mainColor,
|
|
18
|
-
hiddenCounterWhenOutOfStock
|
|
19
|
+
hiddenCounterWhenOutOfStock,
|
|
20
|
+
oosTextColor,
|
|
21
|
+
typoColor
|
|
19
22
|
}).replaceAll(`"`, '"')
|
|
20
23
|
};
|
|
21
24
|
};
|
|
@@ -36,16 +36,9 @@ const getIconClasses = ()=>{
|
|
|
36
36
|
...composeClasses('gp-shrink-0 gp-bg-[length:60px_100%]')
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
const getTextClasses = (styles
|
|
40
|
-
const { typo
|
|
41
|
-
const
|
|
42
|
-
...typo,
|
|
43
|
-
attrs: {
|
|
44
|
-
...typo?.attrs,
|
|
45
|
-
color: isOutOfStock ? oosTextColor : typo?.attrs?.color
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
const appendTypoClass = composeTypographyClassName(displayTypo, styles?.typography);
|
|
39
|
+
const getTextClasses = (styles)=>{
|
|
40
|
+
const { typo } = styles ?? {};
|
|
41
|
+
const appendTypoClass = composeTypographyClassName(typo, styles?.typography);
|
|
49
42
|
return {
|
|
50
43
|
...composeClasses(appendTypoClass)
|
|
51
44
|
};
|