@gem-sdk/components 2.0.0-dev.488 → 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/grid/section/setting/configs/settings.js +4 -4
- package/dist/cjs/grid/section/setting/configs/uiV2.js +3 -0
- package/dist/cjs/icon-list/setting/configs/ItemTemplate.js +4 -4
- package/dist/cjs/icon-list/setting/configs/uiV2.js +3 -1
- 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/grid/section/setting/configs/settings.js +4 -4
- package/dist/esm/grid/section/setting/configs/uiV2.js +3 -0
- package/dist/esm/icon-list/setting/configs/ItemTemplate.js +4 -4
- package/dist/esm/icon-list/setting/configs/uiV2.js +3 -1
- 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
|
}
|
|
@@ -197,7 +197,7 @@ const SectionSettings = [
|
|
|
197
197
|
'px'
|
|
198
198
|
],
|
|
199
199
|
min: 0,
|
|
200
|
-
max:
|
|
200
|
+
max: 120,
|
|
201
201
|
devices: {
|
|
202
202
|
desktop: {
|
|
203
203
|
default: '32px'
|
|
@@ -211,7 +211,7 @@ const SectionSettings = [
|
|
|
211
211
|
'px'
|
|
212
212
|
],
|
|
213
213
|
min: 0,
|
|
214
|
-
max:
|
|
214
|
+
max: 120,
|
|
215
215
|
devices: {
|
|
216
216
|
desktop: {
|
|
217
217
|
default: '0px'
|
|
@@ -222,7 +222,7 @@ const SectionSettings = [
|
|
|
222
222
|
id: 'columnGap',
|
|
223
223
|
type: 'input:slider',
|
|
224
224
|
min: 0,
|
|
225
|
-
max:
|
|
225
|
+
max: 120,
|
|
226
226
|
step: 1,
|
|
227
227
|
units: [
|
|
228
228
|
'%'
|
|
@@ -263,7 +263,7 @@ const SectionSettings = [
|
|
|
263
263
|
desktop: {
|
|
264
264
|
default: {
|
|
265
265
|
type: 'color',
|
|
266
|
-
color: '#
|
|
266
|
+
color: '#DDDDDD',
|
|
267
267
|
image: {
|
|
268
268
|
src: 'https://ucarecdn.com/5e27d43d-eb1e-4e71-b7e1-4158f3071bb6/-/format/auto/',
|
|
269
269
|
width: 1200,
|
|
@@ -26,8 +26,8 @@ const itemChildrenTemplateImage = (src)=>({
|
|
|
26
26
|
styles: {
|
|
27
27
|
shape: {
|
|
28
28
|
desktop: {
|
|
29
|
-
height: '
|
|
30
|
-
width: '
|
|
29
|
+
height: '40px',
|
|
30
|
+
width: '40px',
|
|
31
31
|
shape: 'square',
|
|
32
32
|
shapeLinked: true,
|
|
33
33
|
shapeValue: '1/1'
|
|
@@ -288,8 +288,8 @@ const itemControlTemplateImage = {
|
|
|
288
288
|
styles: {
|
|
289
289
|
shape: {
|
|
290
290
|
desktop: {
|
|
291
|
-
height: '
|
|
292
|
-
width: '
|
|
291
|
+
height: '40px',
|
|
292
|
+
width: '40px',
|
|
293
293
|
shape: 'square',
|
|
294
294
|
shapeLinked: true,
|
|
295
295
|
shapeValue: '1/1'
|
|
@@ -293,12 +293,14 @@ const SettingUIV2 = [
|
|
|
293
293
|
label: {
|
|
294
294
|
en: 'Align'
|
|
295
295
|
},
|
|
296
|
+
conditionEnable: '!(parseInt(globalSize.width) >= 100 && globalSize.width?.includes("%"))',
|
|
296
297
|
setting: {
|
|
297
298
|
id: 'align'
|
|
298
299
|
},
|
|
299
300
|
options: {
|
|
300
301
|
labelVariant: 'primary',
|
|
301
|
-
fullWidth: true
|
|
302
|
+
fullWidth: true,
|
|
303
|
+
disableMessage: `Align is not supported when width is 100%`
|
|
302
304
|
}
|
|
303
305
|
}
|
|
304
306
|
]
|
|
@@ -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
|
}
|
|
@@ -195,7 +195,7 @@ const SectionSettings = [
|
|
|
195
195
|
'px'
|
|
196
196
|
],
|
|
197
197
|
min: 0,
|
|
198
|
-
max:
|
|
198
|
+
max: 120,
|
|
199
199
|
devices: {
|
|
200
200
|
desktop: {
|
|
201
201
|
default: '32px'
|
|
@@ -209,7 +209,7 @@ const SectionSettings = [
|
|
|
209
209
|
'px'
|
|
210
210
|
],
|
|
211
211
|
min: 0,
|
|
212
|
-
max:
|
|
212
|
+
max: 120,
|
|
213
213
|
devices: {
|
|
214
214
|
desktop: {
|
|
215
215
|
default: '0px'
|
|
@@ -220,7 +220,7 @@ const SectionSettings = [
|
|
|
220
220
|
id: 'columnGap',
|
|
221
221
|
type: 'input:slider',
|
|
222
222
|
min: 0,
|
|
223
|
-
max:
|
|
223
|
+
max: 120,
|
|
224
224
|
step: 1,
|
|
225
225
|
units: [
|
|
226
226
|
'%'
|
|
@@ -261,7 +261,7 @@ const SectionSettings = [
|
|
|
261
261
|
desktop: {
|
|
262
262
|
default: {
|
|
263
263
|
type: 'color',
|
|
264
|
-
color: '#
|
|
264
|
+
color: '#DDDDDD',
|
|
265
265
|
image: {
|
|
266
266
|
src: 'https://ucarecdn.com/5e27d43d-eb1e-4e71-b7e1-4158f3071bb6/-/format/auto/',
|
|
267
267
|
width: 1200,
|
|
@@ -24,8 +24,8 @@ const itemChildrenTemplateImage = (src)=>({
|
|
|
24
24
|
styles: {
|
|
25
25
|
shape: {
|
|
26
26
|
desktop: {
|
|
27
|
-
height: '
|
|
28
|
-
width: '
|
|
27
|
+
height: '40px',
|
|
28
|
+
width: '40px',
|
|
29
29
|
shape: 'square',
|
|
30
30
|
shapeLinked: true,
|
|
31
31
|
shapeValue: '1/1'
|
|
@@ -286,8 +286,8 @@ const itemControlTemplateImage = {
|
|
|
286
286
|
styles: {
|
|
287
287
|
shape: {
|
|
288
288
|
desktop: {
|
|
289
|
-
height: '
|
|
290
|
-
width: '
|
|
289
|
+
height: '40px',
|
|
290
|
+
width: '40px',
|
|
291
291
|
shape: 'square',
|
|
292
292
|
shapeLinked: true,
|
|
293
293
|
shapeValue: '1/1'
|
|
@@ -291,12 +291,14 @@ const SettingUIV2 = [
|
|
|
291
291
|
label: {
|
|
292
292
|
en: 'Align'
|
|
293
293
|
},
|
|
294
|
+
conditionEnable: '!(parseInt(globalSize.width) >= 100 && globalSize.width?.includes("%"))',
|
|
294
295
|
setting: {
|
|
295
296
|
id: 'align'
|
|
296
297
|
},
|
|
297
298
|
options: {
|
|
298
299
|
labelVariant: 'primary',
|
|
299
|
-
fullWidth: true
|
|
300
|
+
fullWidth: true,
|
|
301
|
+
disableMessage: `Align is not supported when width is 100%`
|
|
300
302
|
}
|
|
301
303
|
}
|
|
302
304
|
]
|
|
@@ -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
|
};
|