@gem-sdk/components 2.0.0-dev.584 → 2.0.0-dev.585
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/code/components/CSSCode.js +1 -1
- package/dist/cjs/code/hooks/useCSSCode.js +20 -11
- package/dist/cjs/code/setting/config/setting.js +2 -14
- package/dist/cjs/code/setting/config/uiV2.js +5 -19
- package/dist/cjs/coupon/setting/config/settings.js +2 -4
- package/dist/esm/code/components/CSSCode.js +1 -1
- package/dist/esm/code/hooks/useCSSCode.js +20 -11
- package/dist/esm/code/setting/config/setting.js +2 -14
- package/dist/esm/code/setting/config/uiV2.js +5 -19
- package/dist/esm/coupon/setting/config/settings.js +2 -4
- package/dist/types/index.d.ts +1 -2
- package/package.json +1 -1
|
@@ -12,7 +12,7 @@ var classes = require('../common/classes.js');
|
|
|
12
12
|
|
|
13
13
|
const CSSCode = ({ setting, style, advanced, builderAttrs, builderProps, children })=>{
|
|
14
14
|
const { editorData } = advanced;
|
|
15
|
-
const { handleDoubleClickCustomCode, htmlPlainText, mode } = useCSSCode.default(advanced);
|
|
15
|
+
const { handleDoubleClickCustomCode, htmlPlainText, mode } = useCSSCode.default(advanced, setting);
|
|
16
16
|
const composeCodeStyle = system.createStyle(styles.getCodeStyle(style, setting, false));
|
|
17
17
|
const composeCodeClasses = system.createClass(classes.getCodeClasses(builderProps?.uid, mode !== 'edit' && !editorData?.html, advanced?.cssClass));
|
|
18
18
|
return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
@@ -15,15 +15,18 @@ const ALLOWED_EMPTY_TAG = [
|
|
|
15
15
|
'PICTURE',
|
|
16
16
|
'VIDEO'
|
|
17
17
|
];
|
|
18
|
-
const useCSSCode = (advanced)=>{
|
|
18
|
+
const useCSSCode = (advanced, setting)=>{
|
|
19
19
|
const mode = core.useEditorMode();
|
|
20
|
-
const { editorData } = advanced;
|
|
20
|
+
const { editorData } = advanced || {};
|
|
21
|
+
const { customLabel } = setting || {};
|
|
21
22
|
const getEmptyContent = React.useCallback((css, javascript, html)=>{
|
|
22
|
-
return
|
|
23
|
-
<
|
|
24
|
-
|
|
23
|
+
return `
|
|
24
|
+
<p class="gp-text-center gp-text-sm gp-py-4 gp-leading-6 gp-text-light-500 gp-flex gp-flex-col gp-gap-[4px]">
|
|
25
|
+
<span>${customLabel || 'Custom Code'}</span>
|
|
26
|
+
${css || javascript || html ? '<span class="gp-text-[#676767] gp-text-12 gp-leading-5">Preview or Publish the page to see the content.</span>' : ``}
|
|
27
|
+
</p>`;
|
|
25
28
|
}, [
|
|
26
|
-
|
|
29
|
+
customLabel
|
|
27
30
|
]);
|
|
28
31
|
const getHtmlContent = (html, javascript)=>{
|
|
29
32
|
const $element = document.createElement('div');
|
|
@@ -67,9 +70,14 @@ const useCSSCode = (advanced)=>{
|
|
|
67
70
|
if (mode === 'edit') {
|
|
68
71
|
const { empty, hasScript } = getHtmlContent(editorData?.html || '', editorData?.javascript || '');
|
|
69
72
|
if (hasScript) {
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
</
|
|
73
|
+
return `
|
|
74
|
+
<div class="gp-py-4 gp-bg-[#eee] gp-font-[sans-serif] gp-flex gp-flex-col gp-gap-[4px]" >
|
|
75
|
+
<span class="gp-text-center">${customLabel || 'Custom Code'}</span>
|
|
76
|
+
<p class="gp-text-center gp-text-sm gp-leading-[21px] gp-text-[#676767] ">
|
|
77
|
+
Preview or Publish the page to see the content
|
|
78
|
+
</p>
|
|
79
|
+
</div>
|
|
80
|
+
`;
|
|
73
81
|
}
|
|
74
82
|
if (empty) {
|
|
75
83
|
return getEmptyContent(editorData?.css || '', editorData?.javascript || '', editorData?.html || '');
|
|
@@ -78,10 +86,11 @@ const useCSSCode = (advanced)=>{
|
|
|
78
86
|
}
|
|
79
87
|
return editorData?.html?.trim();
|
|
80
88
|
}, [
|
|
81
|
-
|
|
89
|
+
mode,
|
|
82
90
|
editorData?.html,
|
|
83
91
|
editorData?.javascript,
|
|
84
|
-
|
|
92
|
+
editorData?.css,
|
|
93
|
+
customLabel,
|
|
85
94
|
getEmptyContent
|
|
86
95
|
]);
|
|
87
96
|
const handleDoubleClickCustomCode = (e)=>{
|
|
@@ -5,13 +5,7 @@ const SettingCode = [
|
|
|
5
5
|
id: 'setting',
|
|
6
6
|
controls: [
|
|
7
7
|
{
|
|
8
|
-
id: '
|
|
9
|
-
type: 'banner',
|
|
10
|
-
message: `You can insert HTML, CSS, JavaScript or Liquid code <a class="no-underline text-primary-250" target="_blank" href="https://help.gempages.net/articles/custom-code-element?utm_source=element-setting-tips#custom-code">Learn more</a>`,
|
|
11
|
-
closable: true
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
id: 'name',
|
|
8
|
+
id: 'customLabel',
|
|
15
9
|
type: 'input',
|
|
16
10
|
default: 'Custom code'
|
|
17
11
|
},
|
|
@@ -51,7 +45,7 @@ const SettingCode = [
|
|
|
51
45
|
desktop: {
|
|
52
46
|
default: {
|
|
53
47
|
type: 'color',
|
|
54
|
-
color: '
|
|
48
|
+
color: 'bg-1',
|
|
55
49
|
image: {
|
|
56
50
|
src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
|
|
57
51
|
width: 1200,
|
|
@@ -95,12 +89,6 @@ const SettingCode = [
|
|
|
95
89
|
default: 'left'
|
|
96
90
|
}
|
|
97
91
|
}
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
id: 'preloadBgImage',
|
|
101
|
-
type: 'toggle',
|
|
102
|
-
label: 'Preload',
|
|
103
|
-
default: false
|
|
104
92
|
}
|
|
105
93
|
]
|
|
106
94
|
},
|
|
@@ -2,14 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
const SettingUIV2 = [
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
layout: 'vertical'
|
|
11
|
-
}
|
|
12
|
-
]
|
|
5
|
+
messageConfig: {
|
|
6
|
+
type: 'info',
|
|
7
|
+
message: `You can insert HTML, CSS, JavaScript or Liquid code <a class="text-white" target="_blank" href="https://help.gempages.net/articles/custom-code-element?utm_source=element-setting-tips#custom-code">Learn more</a>`
|
|
8
|
+
}
|
|
13
9
|
},
|
|
14
10
|
{
|
|
15
11
|
label: {
|
|
@@ -37,16 +33,6 @@ const SettingUIV2 = [
|
|
|
37
33
|
en: 'Background'
|
|
38
34
|
},
|
|
39
35
|
layout: 'vertical'
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
label: {
|
|
43
|
-
en: 'Preload'
|
|
44
|
-
},
|
|
45
|
-
type: 'control',
|
|
46
|
-
setting: {
|
|
47
|
-
id: 'preloadBgImage'
|
|
48
|
-
},
|
|
49
|
-
conditionDisplay: 'background.type == "image"'
|
|
50
36
|
}
|
|
51
37
|
]
|
|
52
38
|
},
|
|
@@ -58,7 +44,7 @@ const SettingUIV2 = [
|
|
|
58
44
|
{
|
|
59
45
|
type: 'control',
|
|
60
46
|
setting: {
|
|
61
|
-
id: '
|
|
47
|
+
id: 'customLabel'
|
|
62
48
|
},
|
|
63
49
|
label: {
|
|
64
50
|
en: 'Name'
|
|
@@ -202,8 +202,7 @@ const CouponSettings = [
|
|
|
202
202
|
active: '#00A042'
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
|
-
}
|
|
206
|
-
enableGradient: true
|
|
205
|
+
}
|
|
207
206
|
},
|
|
208
207
|
{
|
|
209
208
|
id: 'textColor',
|
|
@@ -236,8 +235,7 @@ const CouponSettings = [
|
|
|
236
235
|
active: 'text-3'
|
|
237
236
|
}
|
|
238
237
|
}
|
|
239
|
-
}
|
|
240
|
-
enableGradient: true
|
|
238
|
+
}
|
|
241
239
|
},
|
|
242
240
|
{
|
|
243
241
|
id: 'align',
|
|
@@ -8,7 +8,7 @@ import { getCodeClasses } from '../common/classes.js';
|
|
|
8
8
|
|
|
9
9
|
const CSSCode = ({ setting, style, advanced, builderAttrs, builderProps, children })=>{
|
|
10
10
|
const { editorData } = advanced;
|
|
11
|
-
const { handleDoubleClickCustomCode, htmlPlainText, mode } = useCSSCode(advanced);
|
|
11
|
+
const { handleDoubleClickCustomCode, htmlPlainText, mode } = useCSSCode(advanced, setting);
|
|
12
12
|
const composeCodeStyle = createStyle(getCodeStyle(style, setting, false));
|
|
13
13
|
const composeCodeClasses = createClass(getCodeClasses(builderProps?.uid, mode !== 'edit' && !editorData?.html, advanced?.cssClass));
|
|
14
14
|
return /*#__PURE__*/ jsxs(Fragment, {
|
|
@@ -11,15 +11,18 @@ const ALLOWED_EMPTY_TAG = [
|
|
|
11
11
|
'PICTURE',
|
|
12
12
|
'VIDEO'
|
|
13
13
|
];
|
|
14
|
-
const useCSSCode = (advanced)=>{
|
|
14
|
+
const useCSSCode = (advanced, setting)=>{
|
|
15
15
|
const mode = useEditorMode();
|
|
16
|
-
const { editorData } = advanced;
|
|
16
|
+
const { editorData } = advanced || {};
|
|
17
|
+
const { customLabel } = setting || {};
|
|
17
18
|
const getEmptyContent = useCallback((css, javascript, html)=>{
|
|
18
|
-
return
|
|
19
|
-
<
|
|
20
|
-
|
|
19
|
+
return `
|
|
20
|
+
<p class="gp-text-center gp-text-sm gp-py-4 gp-leading-6 gp-text-light-500 gp-flex gp-flex-col gp-gap-[4px]">
|
|
21
|
+
<span>${customLabel || 'Custom Code'}</span>
|
|
22
|
+
${css || javascript || html ? '<span class="gp-text-[#676767] gp-text-12 gp-leading-5">Preview or Publish the page to see the content.</span>' : ``}
|
|
23
|
+
</p>`;
|
|
21
24
|
}, [
|
|
22
|
-
|
|
25
|
+
customLabel
|
|
23
26
|
]);
|
|
24
27
|
const getHtmlContent = (html, javascript)=>{
|
|
25
28
|
const $element = document.createElement('div');
|
|
@@ -63,9 +66,14 @@ const useCSSCode = (advanced)=>{
|
|
|
63
66
|
if (mode === 'edit') {
|
|
64
67
|
const { empty, hasScript } = getHtmlContent(editorData?.html || '', editorData?.javascript || '');
|
|
65
68
|
if (hasScript) {
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
</
|
|
69
|
+
return `
|
|
70
|
+
<div class="gp-py-4 gp-bg-[#eee] gp-font-[sans-serif] gp-flex gp-flex-col gp-gap-[4px]" >
|
|
71
|
+
<span class="gp-text-center">${customLabel || 'Custom Code'}</span>
|
|
72
|
+
<p class="gp-text-center gp-text-sm gp-leading-[21px] gp-text-[#676767] ">
|
|
73
|
+
Preview or Publish the page to see the content
|
|
74
|
+
</p>
|
|
75
|
+
</div>
|
|
76
|
+
`;
|
|
69
77
|
}
|
|
70
78
|
if (empty) {
|
|
71
79
|
return getEmptyContent(editorData?.css || '', editorData?.javascript || '', editorData?.html || '');
|
|
@@ -74,10 +82,11 @@ const useCSSCode = (advanced)=>{
|
|
|
74
82
|
}
|
|
75
83
|
return editorData?.html?.trim();
|
|
76
84
|
}, [
|
|
77
|
-
|
|
85
|
+
mode,
|
|
78
86
|
editorData?.html,
|
|
79
87
|
editorData?.javascript,
|
|
80
|
-
|
|
88
|
+
editorData?.css,
|
|
89
|
+
customLabel,
|
|
81
90
|
getEmptyContent
|
|
82
91
|
]);
|
|
83
92
|
const handleDoubleClickCustomCode = (e)=>{
|
|
@@ -3,13 +3,7 @@ const SettingCode = [
|
|
|
3
3
|
id: 'setting',
|
|
4
4
|
controls: [
|
|
5
5
|
{
|
|
6
|
-
id: '
|
|
7
|
-
type: 'banner',
|
|
8
|
-
message: `You can insert HTML, CSS, JavaScript or Liquid code <a class="no-underline text-primary-250" target="_blank" href="https://help.gempages.net/articles/custom-code-element?utm_source=element-setting-tips#custom-code">Learn more</a>`,
|
|
9
|
-
closable: true
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
id: 'name',
|
|
6
|
+
id: 'customLabel',
|
|
13
7
|
type: 'input',
|
|
14
8
|
default: 'Custom code'
|
|
15
9
|
},
|
|
@@ -49,7 +43,7 @@ const SettingCode = [
|
|
|
49
43
|
desktop: {
|
|
50
44
|
default: {
|
|
51
45
|
type: 'color',
|
|
52
|
-
color: '
|
|
46
|
+
color: 'bg-1',
|
|
53
47
|
image: {
|
|
54
48
|
src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
|
|
55
49
|
width: 1200,
|
|
@@ -93,12 +87,6 @@ const SettingCode = [
|
|
|
93
87
|
default: 'left'
|
|
94
88
|
}
|
|
95
89
|
}
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
id: 'preloadBgImage',
|
|
99
|
-
type: 'toggle',
|
|
100
|
-
label: 'Preload',
|
|
101
|
-
default: false
|
|
102
90
|
}
|
|
103
91
|
]
|
|
104
92
|
},
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
const SettingUIV2 = [
|
|
2
2
|
{
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
layout: 'vertical'
|
|
9
|
-
}
|
|
10
|
-
]
|
|
3
|
+
messageConfig: {
|
|
4
|
+
type: 'info',
|
|
5
|
+
message: `You can insert HTML, CSS, JavaScript or Liquid code <a class="text-white" target="_blank" href="https://help.gempages.net/articles/custom-code-element?utm_source=element-setting-tips#custom-code">Learn more</a>`
|
|
6
|
+
}
|
|
11
7
|
},
|
|
12
8
|
{
|
|
13
9
|
label: {
|
|
@@ -35,16 +31,6 @@ const SettingUIV2 = [
|
|
|
35
31
|
en: 'Background'
|
|
36
32
|
},
|
|
37
33
|
layout: 'vertical'
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: {
|
|
41
|
-
en: 'Preload'
|
|
42
|
-
},
|
|
43
|
-
type: 'control',
|
|
44
|
-
setting: {
|
|
45
|
-
id: 'preloadBgImage'
|
|
46
|
-
},
|
|
47
|
-
conditionDisplay: 'background.type == "image"'
|
|
48
34
|
}
|
|
49
35
|
]
|
|
50
36
|
},
|
|
@@ -56,7 +42,7 @@ const SettingUIV2 = [
|
|
|
56
42
|
{
|
|
57
43
|
type: 'control',
|
|
58
44
|
setting: {
|
|
59
|
-
id: '
|
|
45
|
+
id: 'customLabel'
|
|
60
46
|
},
|
|
61
47
|
label: {
|
|
62
48
|
en: 'Name'
|
|
@@ -200,8 +200,7 @@ const CouponSettings = [
|
|
|
200
200
|
active: '#00A042'
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
}
|
|
204
|
-
enableGradient: true
|
|
203
|
+
}
|
|
205
204
|
},
|
|
206
205
|
{
|
|
207
206
|
id: 'textColor',
|
|
@@ -234,8 +233,7 @@ const CouponSettings = [
|
|
|
234
233
|
active: 'text-3'
|
|
235
234
|
}
|
|
236
235
|
}
|
|
237
|
-
}
|
|
238
|
-
enableGradient: true
|
|
236
|
+
}
|
|
239
237
|
},
|
|
240
238
|
{
|
|
241
239
|
id: 'align',
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1213,9 +1213,8 @@ type CSSCodeProps = BasePropsWrap<{
|
|
|
1213
1213
|
background?: ObjectDevices$1<BackgroundMedia>;
|
|
1214
1214
|
preloadBgImage?: boolean;
|
|
1215
1215
|
align?: ObjectDevices$1<AlignProp>;
|
|
1216
|
-
|
|
1216
|
+
customLabel?: string;
|
|
1217
1217
|
speedParallax?: any;
|
|
1218
|
-
contentBanner?: string;
|
|
1219
1218
|
}> & {
|
|
1220
1219
|
advanced?: any;
|
|
1221
1220
|
children?: React.ReactNode;
|