@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.
@@ -424,7 +424,8 @@ const ButtonSettings = [
424
424
  hover: 'text-3'
425
425
  }
426
426
  }
427
- }
427
+ },
428
+ enableGradient: true
428
429
  },
429
430
  {
430
431
  id: 'transform',
@@ -1,3 +1,4 @@
1
+ 'use client';
1
2
  'use strict';
2
3
 
3
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -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
- label: 'Background',
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
- messageConfig: {
6
- type: 'info',
7
- message: 'You can insert HTML, CSS, JavaScript or Liquid code.',
8
- link: {
9
- label: 'Learn more',
10
- url: 'https://help.gempages.net/articles/custom-code-element?utm_source=element-setting-tips#custom-code'
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
- layout: 'vertical'
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 = (backgroundColorActive, textActive)=>{
6
- return core.composeClasses(core.cls('gp-coupon', backgroundColorActive ? `[&_button]:data-[active=true]:!gp-bg-[${backgroundColorActive}]` : '', textActive ? `[&_button]:data-[active=true]:!gp-text-[${textActive}]` : ''));
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, removedActiveShadow)=>{
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 getInnerBorderCornerCss = (data)=>{
18
- const { borderActive, cornerActive, uid, styles } = data;
19
- return `
20
- .gp-coupon[data-active="true"] .${uid}::before {
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
- hover: styles?.hasBoxShadowBtn?.hover,
39
- normal: styles?.hasBoxShadowBtn?.normal
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 { borderBtn, roundedBtn, backgroundColor, textColor } = styles$1 ?? {};
15
+ const { backgroundColorV2, textColorHover } = styles$1 ?? {};
16
16
  const { mode, changeStateILP, defaultLabelState, dataActive } = useCoupon.default(setting);
17
- const computedRemovedActiveShadow = system.createStyle(styles.removedActiveShadow(styles$1));
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, computedRemovedActiveShadow)
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 { backgroundColor, textColor, borderBtn, roundedBtn } = styles$1 ?? {};
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(backgroundColor?.active, textColor?.active));
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, 'submit')
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, computedRemovedActiveShadow)
46
+ ...styles.getButtonStyles(styles$1)
50
47
  },
51
48
  advanced,
52
49
  pageContext