@gem-sdk/components 2.0.0-dev.492 → 2.0.0-dev.495
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/setting/configs/ArticleTag/presets.js +1 -1
- package/dist/cjs/dialog/setting/configs/settings.js +5 -2
- package/dist/cjs/product/components/ProductPrice/common/getTextData.js +5 -3
- package/dist/cjs/stock-counter/components/StockCounter.js +1 -1
- package/dist/cjs/stock-counter/components/StockCounter.liquid.js +1 -1
- package/dist/cjs/stock-counter/components/common/getAttrs.js +4 -2
- package/dist/cjs/stock-counter/components/common/getStyles.js +2 -2
- package/dist/cjs/stock-counter/setting/configs/settingsV2.js +3 -0
- package/dist/cjs/text/components/common/getStyle.js +8 -1
- package/dist/esm/article/setting/configs/ArticleTag/presets.js +1 -1
- package/dist/esm/dialog/setting/configs/settings.js +5 -2
- package/dist/esm/product/components/ProductPrice/common/getTextData.js +5 -3
- package/dist/esm/stock-counter/components/StockCounter.js +1 -1
- package/dist/esm/stock-counter/components/StockCounter.liquid.js +1 -1
- package/dist/esm/stock-counter/components/common/getAttrs.js +4 -2
- package/dist/esm/stock-counter/components/common/getStyles.js +3 -3
- package/dist/esm/stock-counter/setting/configs/settingsV2.js +3 -0
- package/dist/esm/text/components/common/getStyle.js +8 -1
- package/dist/types/index.d.ts +6 -0
- package/package.json +1 -1
|
@@ -203,8 +203,11 @@ const DialogSettings = [
|
|
|
203
203
|
label: 'SVG Icon',
|
|
204
204
|
type: 'icon',
|
|
205
205
|
default: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
|
|
206
|
-
|
|
207
|
-
</svg
|
|
206
|
+
<path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
|
|
207
|
+
</svg>`,
|
|
208
|
+
compoDefaultValue: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
|
|
209
|
+
<path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
|
|
210
|
+
</svg>`
|
|
208
211
|
},
|
|
209
212
|
{
|
|
210
213
|
id: 'btnWidth',
|
|
@@ -24,15 +24,17 @@ const getTextProps = (props, text)=>{
|
|
|
24
24
|
};
|
|
25
25
|
return {
|
|
26
26
|
id: `p-price-${builderProps?.uid}`,
|
|
27
|
-
styles
|
|
27
|
+
styles: {
|
|
28
|
+
...styles,
|
|
29
|
+
lineThrough: isComparePrice && styles?.lineThrough
|
|
30
|
+
},
|
|
28
31
|
setting: {
|
|
29
32
|
text: text ?? `${isComparePrice ? priceCompare() : defaultPrice()}`,
|
|
30
33
|
excludeFlex: true
|
|
31
34
|
},
|
|
32
35
|
className: core.cls('gp-price', {
|
|
33
36
|
'gp-money': !isComparePrice,
|
|
34
|
-
'gp-product-compare-price': isComparePrice
|
|
35
|
-
'gp-line-through': isComparePrice && styles?.lineThrough
|
|
37
|
+
'gp-product-compare-price': isComparePrice
|
|
36
38
|
}, colorClass, classNames)
|
|
37
39
|
};
|
|
38
40
|
};
|
|
@@ -54,7 +54,7 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
|
|
57
|
-
return system.
|
|
57
|
+
return system.createAttr({
|
|
58
58
|
...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
|
|
59
59
|
});
|
|
60
60
|
};
|
|
@@ -54,7 +54,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
54
54
|
});
|
|
55
55
|
};
|
|
56
56
|
const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
|
|
57
|
-
return system.
|
|
57
|
+
return system.createAttr({
|
|
58
58
|
...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
|
|
59
59
|
});
|
|
60
60
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
4
|
-
const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
|
|
4
|
+
const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock, remaining, source } = setting ?? {};
|
|
5
5
|
const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
|
|
6
6
|
const mainColor = textColor || 'brand';
|
|
7
7
|
const typoColor = typo?.attrs?.color;
|
|
@@ -20,7 +20,9 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
|
20
20
|
color: mainColor,
|
|
21
21
|
hiddenCounterWhenOutOfStock,
|
|
22
22
|
oosTextColor,
|
|
23
|
-
typoColor
|
|
23
|
+
typoColor,
|
|
24
|
+
remaining,
|
|
25
|
+
source
|
|
24
26
|
}).replaceAll(`"`, '"')
|
|
25
27
|
};
|
|
26
28
|
};
|
|
@@ -13,7 +13,7 @@ const getProgressBarStyles = (styles, setting)=>{
|
|
|
13
13
|
]));
|
|
14
14
|
}
|
|
15
15
|
return {
|
|
16
|
-
...core.makeStyleResponsive('h', convertedProgressBarHeight, 'px'),
|
|
16
|
+
...core.makeStyleResponsive('h', core.makeWidth(convertedProgressBarHeight), 'px'),
|
|
17
17
|
...core.makeStyle({
|
|
18
18
|
bg: 'linear-gradient(90deg, #eee 50%, transparent 50%)',
|
|
19
19
|
bgc: core.getSingleColorVariable(color),
|
|
@@ -43,7 +43,7 @@ const getIconStyles = (styles, setting, isOutOfStock)=>{
|
|
|
43
43
|
...core.makeStyle({
|
|
44
44
|
c: core.getSingleColorVariable(isOutOfStock ? oosIconColor : iconColor)
|
|
45
45
|
}),
|
|
46
|
-
...core.makeStyleResponsive('w', iconSize, 'px')
|
|
46
|
+
...core.makeStyleResponsive('w', core.makeWidth(iconSize), 'px')
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
const getTextStyles = (styles, isOutOfStock)=>{
|
|
@@ -15,6 +15,7 @@ const StockCounterSettingsV2 = [
|
|
|
15
15
|
itemPerRow: 2,
|
|
16
16
|
itemSpacing: 'large',
|
|
17
17
|
popoverLabel: 'Type',
|
|
18
|
+
enableItemOpacity: true,
|
|
18
19
|
options: [
|
|
19
20
|
{
|
|
20
21
|
label: 'Full',
|
|
@@ -233,6 +234,8 @@ const StockCounterSettingsV2 = [
|
|
|
233
234
|
units: [
|
|
234
235
|
'%'
|
|
235
236
|
],
|
|
237
|
+
showDefaultUnit: true,
|
|
238
|
+
isNumber: true,
|
|
236
239
|
useOnlyUnitInit: true
|
|
237
240
|
}
|
|
238
241
|
]
|
|
@@ -28,6 +28,10 @@ const getContainerStyle = (styles, setting)=>{
|
|
|
28
28
|
};
|
|
29
29
|
const getTextStyle = (styles, setting)=>{
|
|
30
30
|
const composeGlobalSize = core.makeGlobalSize(setting?.globalSize);
|
|
31
|
+
const tdlStyle = [
|
|
32
|
+
styles?.lineThrough && 'line-through',
|
|
33
|
+
styles?.typo?.attrs?.underline && 'underline'
|
|
34
|
+
].filter(Boolean);
|
|
31
35
|
const composeStyles = {
|
|
32
36
|
...composeGlobalSize?.width?.['--w'] ? composeGlobalSize.width : {
|
|
33
37
|
'--w': '100%'
|
|
@@ -52,7 +56,10 @@ const getTextStyle = (styles, setting)=>{
|
|
|
52
56
|
...core.getStyleBackgroundByDevice(setting?.background),
|
|
53
57
|
...composeGlobalSize.padding,
|
|
54
58
|
...core.getGradientBgrStyleByDevice(setting?.background),
|
|
55
|
-
overflow: 'hidden'
|
|
59
|
+
overflow: 'hidden',
|
|
60
|
+
...core.makeStyle({
|
|
61
|
+
tdl: tdlStyle.join(' ')
|
|
62
|
+
})
|
|
56
63
|
};
|
|
57
64
|
return filterTruthyStyles(composeStyles);
|
|
58
65
|
};
|
|
@@ -201,8 +201,11 @@ const DialogSettings = [
|
|
|
201
201
|
label: 'SVG Icon',
|
|
202
202
|
type: 'icon',
|
|
203
203
|
default: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
|
|
204
|
-
|
|
205
|
-
</svg
|
|
204
|
+
<path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
|
|
205
|
+
</svg>`,
|
|
206
|
+
compoDefaultValue: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
|
|
207
|
+
<path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
|
|
208
|
+
</svg>`
|
|
206
209
|
},
|
|
207
210
|
{
|
|
208
211
|
id: 'btnWidth',
|
|
@@ -22,15 +22,17 @@ const getTextProps = (props, text)=>{
|
|
|
22
22
|
};
|
|
23
23
|
return {
|
|
24
24
|
id: `p-price-${builderProps?.uid}`,
|
|
25
|
-
styles
|
|
25
|
+
styles: {
|
|
26
|
+
...styles,
|
|
27
|
+
lineThrough: isComparePrice && styles?.lineThrough
|
|
28
|
+
},
|
|
26
29
|
setting: {
|
|
27
30
|
text: text ?? `${isComparePrice ? priceCompare() : defaultPrice()}`,
|
|
28
31
|
excludeFlex: true
|
|
29
32
|
},
|
|
30
33
|
className: cls('gp-price', {
|
|
31
34
|
'gp-money': !isComparePrice,
|
|
32
|
-
'gp-product-compare-price': isComparePrice
|
|
33
|
-
'gp-line-through': isComparePrice && styles?.lineThrough
|
|
35
|
+
'gp-product-compare-price': isComparePrice
|
|
34
36
|
}, colorClass, classNames)
|
|
35
37
|
};
|
|
36
38
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
2
|
-
const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
|
|
2
|
+
const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock, remaining, source } = setting ?? {};
|
|
3
3
|
const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
|
|
4
4
|
const mainColor = textColor || 'brand';
|
|
5
5
|
const typoColor = typo?.attrs?.color;
|
|
@@ -18,7 +18,9 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
|
|
|
18
18
|
color: mainColor,
|
|
19
19
|
hiddenCounterWhenOutOfStock,
|
|
20
20
|
oosTextColor,
|
|
21
|
-
typoColor
|
|
21
|
+
typoColor,
|
|
22
|
+
remaining,
|
|
23
|
+
source
|
|
22
24
|
}).replaceAll(`"`, '"')
|
|
23
25
|
};
|
|
24
26
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyleResponsive, makeStyle, getSingleColorVariable,
|
|
1
|
+
import { makeStyleResponsive, makeWidth, makeStyle, getSingleColorVariable, composeTypographyStyle, getStyleShadow } from '@gem-sdk/core';
|
|
2
2
|
|
|
3
3
|
const getProgressBarStyles = (styles, setting)=>{
|
|
4
4
|
const { progressBarHeight, color } = styles ?? {};
|
|
@@ -11,7 +11,7 @@ const getProgressBarStyles = (styles, setting)=>{
|
|
|
11
11
|
]));
|
|
12
12
|
}
|
|
13
13
|
return {
|
|
14
|
-
...makeStyleResponsive('h', convertedProgressBarHeight, 'px'),
|
|
14
|
+
...makeStyleResponsive('h', makeWidth(convertedProgressBarHeight), 'px'),
|
|
15
15
|
...makeStyle({
|
|
16
16
|
bg: 'linear-gradient(90deg, #eee 50%, transparent 50%)',
|
|
17
17
|
bgc: getSingleColorVariable(color),
|
|
@@ -41,7 +41,7 @@ const getIconStyles = (styles, setting, isOutOfStock)=>{
|
|
|
41
41
|
...makeStyle({
|
|
42
42
|
c: getSingleColorVariable(isOutOfStock ? oosIconColor : iconColor)
|
|
43
43
|
}),
|
|
44
|
-
...makeStyleResponsive('w', iconSize, 'px')
|
|
44
|
+
...makeStyleResponsive('w', makeWidth(iconSize), 'px')
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
47
|
const getTextStyles = (styles, isOutOfStock)=>{
|
|
@@ -13,6 +13,7 @@ const StockCounterSettingsV2 = [
|
|
|
13
13
|
itemPerRow: 2,
|
|
14
14
|
itemSpacing: 'large',
|
|
15
15
|
popoverLabel: 'Type',
|
|
16
|
+
enableItemOpacity: true,
|
|
16
17
|
options: [
|
|
17
18
|
{
|
|
18
19
|
label: 'Full',
|
|
@@ -231,6 +232,8 @@ const StockCounterSettingsV2 = [
|
|
|
231
232
|
units: [
|
|
232
233
|
'%'
|
|
233
234
|
],
|
|
235
|
+
showDefaultUnit: true,
|
|
236
|
+
isNumber: true,
|
|
234
237
|
useOnlyUnitInit: true
|
|
235
238
|
}
|
|
236
239
|
]
|
|
@@ -26,6 +26,10 @@ const getContainerStyle = (styles, setting)=>{
|
|
|
26
26
|
};
|
|
27
27
|
const getTextStyle = (styles, setting)=>{
|
|
28
28
|
const composeGlobalSize = makeGlobalSize(setting?.globalSize);
|
|
29
|
+
const tdlStyle = [
|
|
30
|
+
styles?.lineThrough && 'line-through',
|
|
31
|
+
styles?.typo?.attrs?.underline && 'underline'
|
|
32
|
+
].filter(Boolean);
|
|
29
33
|
const composeStyles = {
|
|
30
34
|
...composeGlobalSize?.width?.['--w'] ? composeGlobalSize.width : {
|
|
31
35
|
'--w': '100%'
|
|
@@ -50,7 +54,10 @@ const getTextStyle = (styles, setting)=>{
|
|
|
50
54
|
...getStyleBackgroundByDevice(setting?.background),
|
|
51
55
|
...composeGlobalSize.padding,
|
|
52
56
|
...getGradientBgrStyleByDevice(setting?.background),
|
|
53
|
-
overflow: 'hidden'
|
|
57
|
+
overflow: 'hidden',
|
|
58
|
+
...makeStyle({
|
|
59
|
+
tdl: tdlStyle.join(' ')
|
|
60
|
+
})
|
|
54
61
|
};
|
|
55
62
|
return filterTruthyStyles(composeStyles);
|
|
56
63
|
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -131,6 +131,7 @@ type TextProps = BasePropsWrap<{
|
|
|
131
131
|
shapeRounded?: ObjectDevices$1<CornerRadius>;
|
|
132
132
|
shapeBoxShadow?: ObjectDevices$1<ShadowProps$1>;
|
|
133
133
|
isForceValue?: boolean;
|
|
134
|
+
lineThrough?: boolean;
|
|
134
135
|
}> & Omit<React.ComponentPropsWithoutRef<'p'>, ''>;
|
|
135
136
|
|
|
136
137
|
declare const Text$2: React.ForwardRefExoticComponent<_gem_sdk_core.BaseProps<{
|
|
@@ -180,6 +181,7 @@ declare const Text$2: React.ForwardRefExoticComponent<_gem_sdk_core.BaseProps<{
|
|
|
180
181
|
shapeRounded?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.CornerRadius>> | undefined;
|
|
181
182
|
shapeBoxShadow?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.ShadowProps>> | undefined;
|
|
182
183
|
isForceValue?: boolean | undefined;
|
|
184
|
+
lineThrough?: boolean | undefined;
|
|
183
185
|
}, Record<string, any>> & {
|
|
184
186
|
builderAttrs?: Record<string, any> | undefined;
|
|
185
187
|
style?: React.CSSProperties | undefined;
|
|
@@ -5830,6 +5832,7 @@ declare const _default$2: {
|
|
|
5830
5832
|
shapeRounded?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.CornerRadius>> | undefined;
|
|
5831
5833
|
shapeBoxShadow?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.ShadowProps>> | undefined;
|
|
5832
5834
|
isForceValue?: boolean | undefined;
|
|
5835
|
+
lineThrough?: boolean | undefined;
|
|
5833
5836
|
}, Record<string, any>> & {
|
|
5834
5837
|
builderAttrs?: Record<string, any> | undefined;
|
|
5835
5838
|
style?: React.CSSProperties | undefined;
|
|
@@ -6343,6 +6346,7 @@ declare const Text: ({ id, styles, builderAttrs, style, setting, advanced, build
|
|
|
6343
6346
|
shapeRounded?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.CornerRadius>> | undefined;
|
|
6344
6347
|
shapeBoxShadow?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.ShadowProps>> | undefined;
|
|
6345
6348
|
isForceValue?: boolean | undefined;
|
|
6349
|
+
lineThrough?: boolean | undefined;
|
|
6346
6350
|
}, Record<string, any>> & {
|
|
6347
6351
|
builderAttrs?: Record<string, any> | undefined;
|
|
6348
6352
|
style?: React.CSSProperties | undefined;
|
|
@@ -6441,6 +6445,7 @@ declare const ProductTag: ({ setting, styles, builderProps, advanced, pageContex
|
|
|
6441
6445
|
shapeRounded?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.CornerRadius>> | undefined;
|
|
6442
6446
|
shapeBoxShadow?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.ShadowProps>> | undefined;
|
|
6443
6447
|
isForceValue?: boolean | undefined;
|
|
6448
|
+
lineThrough?: boolean | undefined;
|
|
6444
6449
|
} & {
|
|
6445
6450
|
textAlign?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.AlignProp>> | undefined;
|
|
6446
6451
|
backgroundColor?: _gem_sdk_core.ColorValueType | undefined;
|
|
@@ -7477,6 +7482,7 @@ declare const _default$1: {
|
|
|
7477
7482
|
shapeRounded?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.CornerRadius>> | undefined;
|
|
7478
7483
|
shapeBoxShadow?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.ShadowProps>> | undefined;
|
|
7479
7484
|
isForceValue?: boolean | undefined;
|
|
7485
|
+
lineThrough?: boolean | undefined;
|
|
7480
7486
|
}, Record<string, any>> & {
|
|
7481
7487
|
builderAttrs?: Record<string, any> | undefined;
|
|
7482
7488
|
style?: React.CSSProperties | undefined;
|