@gem-sdk/core 1.12.0-next.46 → 1.12.0-next.49
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/helpers/make-style.js +2 -6
- package/dist/cjs/helpers/typography.js +5 -5
- package/dist/cjs/hooks/useFormatMoney.js +0 -3
- package/dist/esm/helpers/make-style.js +2 -6
- package/dist/esm/helpers/typography.js +5 -5
- package/dist/esm/hooks/useFormatMoney.js +0 -3
- package/package.json +1 -1
|
@@ -63,10 +63,8 @@ const makeWidth = (widthValue, fullWidthValue)=>{
|
|
|
63
63
|
const fullWidthVal = fullWidthValue?.[deviceValue] === undefined ? fullWidthValue?.['desktop'] : fullWidthValue?.[deviceValue];
|
|
64
64
|
if (fullWidthVal) {
|
|
65
65
|
return '100%';
|
|
66
|
-
} else if (fullWidthVal === false) {
|
|
67
|
-
return widthVal ?? widthVal;
|
|
68
66
|
} else {
|
|
69
|
-
return widthVal;
|
|
67
|
+
return widthVal || 'unset';
|
|
70
68
|
}
|
|
71
69
|
};
|
|
72
70
|
return {
|
|
@@ -81,10 +79,8 @@ const makeHeight = (heighValue, autoHeight)=>{
|
|
|
81
79
|
const isAuto = autoHeight?.[deviceValue];
|
|
82
80
|
if (isAuto) {
|
|
83
81
|
return 'auto';
|
|
84
|
-
} else if (isAuto === false) {
|
|
85
|
-
return heightVal ?? heightVal;
|
|
86
82
|
} else {
|
|
87
|
-
return heightVal;
|
|
83
|
+
return heightVal || 'unset';
|
|
88
84
|
}
|
|
89
85
|
};
|
|
90
86
|
return {
|
|
@@ -43,9 +43,9 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
43
43
|
if (!value) return {};
|
|
44
44
|
return makeStyle.removeNullUndefined({
|
|
45
45
|
...makeStyle.makeStyle({
|
|
46
|
-
fs: !attrs?.italic
|
|
46
|
+
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
47
47
|
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily}, ${value.fontFamily})` : undefined,
|
|
48
|
-
weight: !attrs?.bold
|
|
48
|
+
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
49
49
|
ls: value?.letterSpacing,
|
|
50
50
|
lh: value?.lineHeight
|
|
51
51
|
}),
|
|
@@ -56,8 +56,8 @@ const composeTypographyAttr = (attrs)=>{
|
|
|
56
56
|
if (!attrs) return {};
|
|
57
57
|
return makeStyle.removeNullUndefined({
|
|
58
58
|
...makeStyle.makeStyle({
|
|
59
|
-
fs: attrs?.italic
|
|
60
|
-
weight: attrs?.bold
|
|
59
|
+
fs: attrs?.italic ? 'italic' : undefined,
|
|
60
|
+
weight: attrs?.bold ? 'bold' : undefined,
|
|
61
61
|
c: colors.getSingleColorVariable(attrs?.color),
|
|
62
62
|
tt: attrs?.transform,
|
|
63
63
|
tdl: attrs?.underline ? 'underline' : undefined
|
|
@@ -70,7 +70,7 @@ const composeTypographyClassName = (typo, typography)=>{
|
|
|
70
70
|
const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
71
71
|
if (typo) {
|
|
72
72
|
return {
|
|
73
|
-
...composeTypographyV2(typo.custom),
|
|
73
|
+
...composeTypographyV2(typo.custom, typo.attrs),
|
|
74
74
|
...!disableAttr && composeTypographyAttr(typo.attrs)
|
|
75
75
|
};
|
|
76
76
|
}
|
|
@@ -8,9 +8,6 @@ const useFormatMoney = (amount, withCurrency)=>{
|
|
|
8
8
|
let value = '';
|
|
9
9
|
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
10
10
|
const formatString = format || '${{amount}}';
|
|
11
|
-
if (typeof cents == 'string') {
|
|
12
|
-
cents = cents.replace('.', '');
|
|
13
|
-
}
|
|
14
11
|
/**
|
|
15
12
|
* check default
|
|
16
13
|
* @param opt opt
|
|
@@ -61,10 +61,8 @@ const makeWidth = (widthValue, fullWidthValue)=>{
|
|
|
61
61
|
const fullWidthVal = fullWidthValue?.[deviceValue] === undefined ? fullWidthValue?.['desktop'] : fullWidthValue?.[deviceValue];
|
|
62
62
|
if (fullWidthVal) {
|
|
63
63
|
return '100%';
|
|
64
|
-
} else if (fullWidthVal === false) {
|
|
65
|
-
return widthVal ?? widthVal;
|
|
66
64
|
} else {
|
|
67
|
-
return widthVal;
|
|
65
|
+
return widthVal || 'unset';
|
|
68
66
|
}
|
|
69
67
|
};
|
|
70
68
|
return {
|
|
@@ -79,10 +77,8 @@ const makeHeight = (heighValue, autoHeight)=>{
|
|
|
79
77
|
const isAuto = autoHeight?.[deviceValue];
|
|
80
78
|
if (isAuto) {
|
|
81
79
|
return 'auto';
|
|
82
|
-
} else if (isAuto === false) {
|
|
83
|
-
return heightVal ?? heightVal;
|
|
84
80
|
} else {
|
|
85
|
-
return heightVal;
|
|
81
|
+
return heightVal || 'unset';
|
|
86
82
|
}
|
|
87
83
|
};
|
|
88
84
|
return {
|
|
@@ -41,9 +41,9 @@ const composeTypographyV2 = (value, attrs)=>{
|
|
|
41
41
|
if (!value) return {};
|
|
42
42
|
return removeNullUndefined({
|
|
43
43
|
...makeStyle({
|
|
44
|
-
fs: !attrs?.italic
|
|
44
|
+
fs: !attrs?.italic ? value?.fontStyle : undefined,
|
|
45
45
|
ff: value?.fontFamily ? `var(--g-font-${value.fontFamily}, ${value.fontFamily})` : undefined,
|
|
46
|
-
weight: !attrs?.bold
|
|
46
|
+
weight: !attrs?.bold ? value?.fontWeight : undefined,
|
|
47
47
|
ls: value?.letterSpacing,
|
|
48
48
|
lh: value?.lineHeight
|
|
49
49
|
}),
|
|
@@ -54,8 +54,8 @@ const composeTypographyAttr = (attrs)=>{
|
|
|
54
54
|
if (!attrs) return {};
|
|
55
55
|
return removeNullUndefined({
|
|
56
56
|
...makeStyle({
|
|
57
|
-
fs: attrs?.italic
|
|
58
|
-
weight: attrs?.bold
|
|
57
|
+
fs: attrs?.italic ? 'italic' : undefined,
|
|
58
|
+
weight: attrs?.bold ? 'bold' : undefined,
|
|
59
59
|
c: getSingleColorVariable(attrs?.color),
|
|
60
60
|
tt: attrs?.transform,
|
|
61
61
|
tdl: attrs?.underline ? 'underline' : undefined
|
|
@@ -68,7 +68,7 @@ const composeTypographyClassName = (typo, typography)=>{
|
|
|
68
68
|
const composeTypographyStyle = (typo, typography, disableAttr)=>{
|
|
69
69
|
if (typo) {
|
|
70
70
|
return {
|
|
71
|
-
...composeTypographyV2(typo.custom),
|
|
71
|
+
...composeTypographyV2(typo.custom, typo.attrs),
|
|
72
72
|
...!disableAttr && composeTypographyAttr(typo.attrs)
|
|
73
73
|
};
|
|
74
74
|
}
|
|
@@ -6,9 +6,6 @@ const useFormatMoney = (amount, withCurrency)=>{
|
|
|
6
6
|
let value = '';
|
|
7
7
|
const placeholderRegex = /\{\{\s*(\w+)\s*\}\}/;
|
|
8
8
|
const formatString = format || '${{amount}}';
|
|
9
|
-
if (typeof cents == 'string') {
|
|
10
|
-
cents = cents.replace('.', '');
|
|
11
|
-
}
|
|
12
9
|
/**
|
|
13
10
|
* check default
|
|
14
11
|
* @param opt opt
|