@gem-sdk/components 2.0.0-dev.456 → 2.0.0-dev.458
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/button/setting/configs/settings.js +2 -1
- package/dist/cjs/code/components/CSSCode.js +1 -0
- package/dist/cjs/code/setting/config/setting.js +38 -2
- package/dist/cjs/code/setting/config/uiV2.js +30 -8
- package/dist/cjs/coupon/common/classes.js +16 -2
- package/dist/cjs/coupon/common/index.js +2 -2
- package/dist/cjs/coupon/common/styles.js +44 -26
- package/dist/cjs/coupon/components/Coupon.js +3 -6
- package/dist/cjs/coupon/components/Coupon.liquid.js +4 -7
- package/dist/cjs/coupon/setting/config/settings.js +198 -124
- package/dist/cjs/coupon/setting/config/uiV2.js +349 -142
- package/dist/cjs/product/components/FileUpload/components/config/uiV2.js +15 -0
- package/dist/esm/button/setting/configs/settings.js +2 -1
- package/dist/esm/code/components/CSSCode.js +1 -0
- package/dist/esm/code/setting/config/setting.js +38 -2
- package/dist/esm/code/setting/config/uiV2.js +30 -8
- package/dist/esm/coupon/common/classes.js +16 -2
- package/dist/esm/coupon/common/index.js +2 -2
- package/dist/esm/coupon/common/styles.js +45 -26
- package/dist/esm/coupon/components/Coupon.js +5 -8
- package/dist/esm/coupon/components/Coupon.liquid.js +6 -9
- package/dist/esm/coupon/setting/config/settings.js +198 -124
- package/dist/esm/coupon/setting/config/uiV2.js +349 -142
- package/dist/esm/product/components/FileUpload/components/config/uiV2.js +15 -0
- package/dist/types/index.d.ts +4 -1
- package/package.json +1 -1
|
@@ -4,14 +4,29 @@ const SettingCode = [
|
|
|
4
4
|
{
|
|
5
5
|
id: 'setting',
|
|
6
6
|
controls: [
|
|
7
|
+
{
|
|
8
|
+
id: 'contentBanner',
|
|
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',
|
|
15
|
+
type: 'input',
|
|
16
|
+
default: 'Custom code'
|
|
17
|
+
},
|
|
7
18
|
{
|
|
8
19
|
id: 'editorData',
|
|
9
20
|
type: 'customCodeEditor'
|
|
10
21
|
},
|
|
22
|
+
{
|
|
23
|
+
id: 'speedParallax',
|
|
24
|
+
type: 'customCodeEditor'
|
|
25
|
+
},
|
|
11
26
|
{
|
|
12
27
|
id: 'background',
|
|
13
|
-
type: 'background',
|
|
14
|
-
|
|
28
|
+
type: 'background-media',
|
|
29
|
+
ignoreReRender: true,
|
|
15
30
|
devices: {
|
|
16
31
|
desktop: {
|
|
17
32
|
default: {
|
|
@@ -31,6 +46,27 @@ const SettingCode = [
|
|
|
31
46
|
attachment: 'scroll'
|
|
32
47
|
}
|
|
33
48
|
}
|
|
49
|
+
},
|
|
50
|
+
compoDefaultValue: {
|
|
51
|
+
desktop: {
|
|
52
|
+
default: {
|
|
53
|
+
type: 'color',
|
|
54
|
+
color: '#DDDDDD',
|
|
55
|
+
image: {
|
|
56
|
+
src: 'https://ucarecdn.com/5e27d43d-eb1e-4e71-b7e1-4158f3071bb6/-/format/auto/',
|
|
57
|
+
width: 1200,
|
|
58
|
+
height: 480
|
|
59
|
+
},
|
|
60
|
+
size: 'cover',
|
|
61
|
+
position: {
|
|
62
|
+
x: 50,
|
|
63
|
+
y: 50
|
|
64
|
+
},
|
|
65
|
+
repeat: 'no-repeat',
|
|
66
|
+
attachment: 'scroll',
|
|
67
|
+
preload: false
|
|
68
|
+
}
|
|
69
|
+
}
|
|
34
70
|
}
|
|
35
71
|
},
|
|
36
72
|
{
|
|
@@ -2,21 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
const SettingUIV2 = [
|
|
4
4
|
{
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
controls: [
|
|
6
|
+
{
|
|
7
|
+
setting: {
|
|
8
|
+
id: 'contentBanner'
|
|
9
|
+
},
|
|
10
|
+
layout: 'vertical'
|
|
11
11
|
}
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
label: {
|
|
16
|
+
en: 'Custom code'
|
|
12
17
|
},
|
|
13
18
|
controls: [
|
|
14
19
|
{
|
|
15
|
-
type: 'control',
|
|
16
20
|
setting: {
|
|
17
21
|
id: 'editorData'
|
|
18
22
|
},
|
|
19
|
-
|
|
23
|
+
label: {
|
|
24
|
+
en: 'Code'
|
|
25
|
+
}
|
|
20
26
|
}
|
|
21
27
|
]
|
|
22
28
|
},
|
|
@@ -44,6 +50,22 @@ const SettingUIV2 = [
|
|
|
44
50
|
}
|
|
45
51
|
]
|
|
46
52
|
},
|
|
53
|
+
{
|
|
54
|
+
label: {
|
|
55
|
+
en: 'Configuration'
|
|
56
|
+
},
|
|
57
|
+
controls: [
|
|
58
|
+
{
|
|
59
|
+
type: 'control',
|
|
60
|
+
setting: {
|
|
61
|
+
id: 'name'
|
|
62
|
+
},
|
|
63
|
+
label: {
|
|
64
|
+
en: 'Name'
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
47
69
|
{
|
|
48
70
|
controls: [
|
|
49
71
|
{
|
|
@@ -2,8 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@gem-sdk/core');
|
|
4
4
|
|
|
5
|
-
const getActiveClasses = (
|
|
6
|
-
|
|
5
|
+
const getActiveClasses = (backgroundColor, text)=>{
|
|
6
|
+
const breakpoints = {
|
|
7
|
+
desktop: '',
|
|
8
|
+
tablet: 'tablet:',
|
|
9
|
+
mobile: 'mobile:'
|
|
10
|
+
};
|
|
11
|
+
const generateClass = (type, device, value)=>value ? `${breakpoints[device]}[_&button]:data-[active=true]:!gp-${type}-[${value}]` : '';
|
|
12
|
+
const classes = [
|
|
13
|
+
generateClass('bg', 'desktop', backgroundColor?.desktop?.active),
|
|
14
|
+
generateClass('bg', 'tablet', backgroundColor?.tablet?.active),
|
|
15
|
+
generateClass('bg', 'mobile', backgroundColor?.mobile?.active),
|
|
16
|
+
generateClass('text', 'desktop', text?.desktop?.active),
|
|
17
|
+
generateClass('text', 'tablet', text?.tablet?.active),
|
|
18
|
+
generateClass('text', 'mobile', text?.mobile?.active)
|
|
19
|
+
].filter(Boolean).join(' ');
|
|
20
|
+
return core.composeClasses(core.cls('gp-coupon', classes));
|
|
7
21
|
};
|
|
8
22
|
|
|
9
23
|
exports.getActiveClasses = getActiveClasses;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const getButtonSetting = (setting, label, htmlType)=>{
|
|
4
|
-
const { iconSvg, iconAlign, couponLayout, translate, shouldClearSpace } = setting ?? {};
|
|
4
|
+
const { iconSvg, iconAlign, couponLayout, translate, shouldClearSpace, iconVisible } = setting ?? {};
|
|
5
5
|
return {
|
|
6
6
|
label,
|
|
7
7
|
htmlType,
|
|
8
8
|
iconAlign,
|
|
9
9
|
iconSvg,
|
|
10
|
-
iconVisible: couponLayout === 'icon',
|
|
10
|
+
iconVisible: couponLayout === 'icon' && iconVisible,
|
|
11
11
|
translate,
|
|
12
12
|
shouldClearSpace
|
|
13
13
|
};
|
|
@@ -2,10 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
var core = require('@gem-sdk/core');
|
|
4
4
|
|
|
5
|
-
const getButtonStyles = (styles
|
|
5
|
+
const getButtonStyles = (styles)=>{
|
|
6
6
|
return {
|
|
7
|
-
...styles
|
|
8
|
-
hasBoxShadowBtn: removedActiveShadow
|
|
7
|
+
...styles
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
10
|
const getButtonStyle = (style, styles)=>{
|
|
@@ -14,33 +13,52 @@ const getButtonStyle = (style, styles)=>{
|
|
|
14
13
|
...core.makeStyleResponsive('ta', styles?.align)
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
${core.composeBorderCss(borderActive)}
|
|
22
|
-
}
|
|
23
|
-
.gp-coupon[data-active="true"] .${uid} {
|
|
24
|
-
${core.composeCornerCss(cornerActive, true)}
|
|
25
|
-
}
|
|
26
|
-
.gp-coupon[data-active="true"] .${uid} {
|
|
27
|
-
box-shadow: ${styles?.hasBoxShadowBtn?.active ? core.getStyleShadow({
|
|
28
|
-
value: styles?.boxShadowBtn?.active,
|
|
29
|
-
state: 'active',
|
|
30
|
-
styleAppliedFor: 'box-shadow',
|
|
31
|
-
isEnableShadow: true
|
|
32
|
-
})['--shadow'] : 'none'}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
};
|
|
36
|
-
const removedActiveShadow = (styles)=>{
|
|
16
|
+
const getResponsiveSetting = (setting)=>{
|
|
17
|
+
const desktop = setting.desktop;
|
|
18
|
+
const tablet = setting.tablet ? setting.tablet : desktop;
|
|
19
|
+
const mobile = setting.mobile ? setting.mobile : tablet;
|
|
37
20
|
return {
|
|
38
|
-
|
|
39
|
-
|
|
21
|
+
desktop,
|
|
22
|
+
tablet,
|
|
23
|
+
mobile
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const getInnerBorderCornerCss = (data)=>{
|
|
27
|
+
const { uid, styles } = data;
|
|
28
|
+
const borderBtnV2 = getResponsiveSetting(styles?.borderBtnV2 || {});
|
|
29
|
+
const roundedBtnV2 = getResponsiveSetting(styles?.roundedBtnV2 || {});
|
|
30
|
+
const boxShadowBtnV2 = getResponsiveSetting(styles?.boxShadowBtnV2 || {});
|
|
31
|
+
const getShadowValue = (value)=>value ? core.getStyleShadow({
|
|
32
|
+
value,
|
|
33
|
+
state: 'active',
|
|
34
|
+
styleAppliedFor: 'box-shadow',
|
|
35
|
+
isEnableShadow: true
|
|
36
|
+
})['--shadow'] : 'none';
|
|
37
|
+
const breakpoints = {
|
|
38
|
+
desktop: '',
|
|
39
|
+
tablet: '@media only screen and (max-width: 1024px) and (min-width: 768px)',
|
|
40
|
+
mobile: '@media only screen and (max-width: 768px)'
|
|
41
|
+
};
|
|
42
|
+
const generateStyles = (device)=>{
|
|
43
|
+
const mediaQuery = breakpoints[device] ? `${breakpoints[device]} {` : '';
|
|
44
|
+
const closeMediaQuery = mediaQuery ? '}' : '';
|
|
45
|
+
return `
|
|
46
|
+
${mediaQuery}
|
|
47
|
+
.gp-coupon[data-active="true"] .${uid} {
|
|
48
|
+
${core.composeBorderCss(borderBtnV2?.[device]?.active)} !important;
|
|
49
|
+
${core.composeCornerCss(roundedBtnV2?.[device]?.active)} !important;
|
|
50
|
+
box-shadow: ${getShadowValue(boxShadowBtnV2?.[device]?.active)} !important;
|
|
51
|
+
}
|
|
52
|
+
${closeMediaQuery}
|
|
53
|
+
`;
|
|
40
54
|
};
|
|
55
|
+
return [
|
|
56
|
+
generateStyles('desktop'),
|
|
57
|
+
generateStyles('tablet'),
|
|
58
|
+
generateStyles('mobile')
|
|
59
|
+
].join('\n').trim();
|
|
41
60
|
};
|
|
42
61
|
|
|
43
62
|
exports.getButtonStyle = getButtonStyle;
|
|
44
63
|
exports.getButtonStyles = getButtonStyles;
|
|
45
64
|
exports.getInnerBorderCornerCss = getInnerBorderCornerCss;
|
|
46
|
-
exports.removedActiveShadow = removedActiveShadow;
|
|
@@ -12,14 +12,11 @@ var useCoupon = require('../hooks/useCoupon.js');
|
|
|
12
12
|
var classes = require('../common/classes.js');
|
|
13
13
|
|
|
14
14
|
const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1, advanced, children })=>{
|
|
15
|
-
const {
|
|
15
|
+
const { backgroundColorV2, textColorHover } = styles$1 ?? {};
|
|
16
16
|
const { mode, changeStateILP, defaultLabelState, dataActive } = useCoupon.default(setting);
|
|
17
|
-
const
|
|
18
|
-
const composeCouponComponentClasses = system.createClass(classes.getActiveClasses(backgroundColor?.active, textColor?.active));
|
|
17
|
+
const composeCouponComponentClasses = system.createClass(classes.getActiveClasses(backgroundColorV2, textColorHover));
|
|
19
18
|
const computedInnerBorderCornerCss = styles.getInnerBorderCornerCss({
|
|
20
19
|
uid: builderProps?.uid,
|
|
21
|
-
borderActive: borderBtn?.active,
|
|
22
|
-
cornerActive: roundedBtn?.active,
|
|
23
20
|
styles: styles$1
|
|
24
21
|
});
|
|
25
22
|
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
@@ -44,7 +41,7 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1,
|
|
|
44
41
|
...styles.getButtonStyle(style, styles$1)
|
|
45
42
|
},
|
|
46
43
|
styles: {
|
|
47
|
-
...styles.getButtonStyles(styles$1
|
|
44
|
+
...styles.getButtonStyles(styles$1)
|
|
48
45
|
},
|
|
49
46
|
children: children
|
|
50
47
|
})
|
|
@@ -11,20 +11,17 @@ var styles = require('../common/styles.js');
|
|
|
11
11
|
var classes = require('../common/classes.js');
|
|
12
12
|
|
|
13
13
|
const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1, advanced, pageContext })=>{
|
|
14
|
-
const {
|
|
14
|
+
const { backgroundColorV2, textColorHover } = styles$1 ?? {};
|
|
15
15
|
const { defaultLabel, clickedLabel, copyContent } = setting ?? {};
|
|
16
|
-
const computedRemovedActiveShadow = system.createStyle(styles.removedActiveShadow(styles$1));
|
|
17
16
|
const composeContextState = system.createStateOrContext({
|
|
18
17
|
defaultLabel,
|
|
19
18
|
clickedLabel,
|
|
20
19
|
copyContent,
|
|
21
20
|
uid: builderProps?.uid
|
|
22
21
|
});
|
|
23
|
-
const composeCouponComponentClasses = system.createClass(classes.getActiveClasses(
|
|
22
|
+
const composeCouponComponentClasses = system.createClass(classes.getActiveClasses(backgroundColorV2, textColorHover));
|
|
24
23
|
const computedInnerBorderCornerCss = styles.getInnerBorderCornerCss({
|
|
25
24
|
uid: builderProps?.uid,
|
|
26
|
-
borderActive: borderBtn?.active,
|
|
27
|
-
cornerActive: roundedBtn?.active,
|
|
28
25
|
styles: styles$1
|
|
29
26
|
});
|
|
30
27
|
const renderScript = ()=>{
|
|
@@ -40,13 +37,13 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles: styles$1,
|
|
|
40
37
|
},
|
|
41
38
|
builderAttrs: builderAttrs,
|
|
42
39
|
setting: {
|
|
43
|
-
...index.getButtonSetting(setting, defaultLabel, '
|
|
40
|
+
...index.getButtonSetting(setting, defaultLabel, 'button')
|
|
44
41
|
},
|
|
45
42
|
style: {
|
|
46
43
|
...styles.getButtonStyle(style, styles$1)
|
|
47
44
|
},
|
|
48
45
|
styles: {
|
|
49
|
-
...styles.getButtonStyles(styles$1
|
|
46
|
+
...styles.getButtonStyles(styles$1)
|
|
50
47
|
},
|
|
51
48
|
advanced,
|
|
52
49
|
pageContext
|