@gem-sdk/components 2.0.0-dev.457 → 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',
@@ -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
@@ -52,7 +52,7 @@ const CouponSettings = [
52
52
  id: 'iconVisible',
53
53
  label: 'Icon Visible',
54
54
  type: 'toggle',
55
- default: false
55
+ default: true
56
56
  },
57
57
  {
58
58
  id: 'iconSvg',
@@ -128,50 +128,86 @@ const CouponSettings = [
128
128
  id: 'style',
129
129
  controls: [
130
130
  {
131
- id: 'borderBtn',
132
- type: 'border',
133
- label: 'Border',
134
- emptyOnClear: true,
135
- default: {
136
- normal: {
137
- borderType: 'none',
138
- border: 'none',
139
- isCustom: false,
140
- borderWidth: '1px',
141
- width: '1px 1px 1px 1px'
142
- },
143
- hover: {
144
- isCustom: false,
145
- borderType: 'none',
146
- border: 'none',
147
- borderWidth: '1px',
148
- width: '1px 1px 1px 1px'
149
- }
150
- },
151
- state: {
152
- hover: true,
153
- normal: true,
154
- active: true
155
- }
131
+ id: 'enableTextStyle',
132
+ label: '',
133
+ type: 'toggle',
134
+ default: true
156
135
  },
136
+ // {
137
+ // id: 'borderBtn',
138
+ // type: 'border',
139
+ // label: 'Border',
140
+ // emptyOnClear: true,
141
+ // default: {
142
+ // normal: {
143
+ // borderType: 'none',
144
+ // border: 'none',
145
+ // isCustom: false,
146
+ // borderWidth: '1px',
147
+ // width: '1px 1px 1px 1px',
148
+ // },
149
+ // hover: {
150
+ // isCustom: false,
151
+ // borderType: 'none',
152
+ // border: 'none',
153
+ // borderWidth: '1px',
154
+ // width: '1px 1px 1px 1px',
155
+ // },
156
+ // // active: {
157
+ // // isCustom: false,
158
+ // // borderType: 'none',
159
+ // // border: 'none',
160
+ // // borderWidth: '1px',
161
+ // // width: '1px 1px 1px 1px',
162
+ // // },
163
+ // },
164
+ // state: {
165
+ // hover: true,
166
+ // normal: true,
167
+ // active: true,
168
+ // },
169
+ // },
170
+ // {
171
+ // id: 'backgroundColor',
172
+ // type: 'background-color-picker',
173
+ // label: 'Background Color',
174
+ // default: {
175
+ // normal: 'brand',
176
+ // hover: 'highlight',
177
+ // active: '#00A042',
178
+ // },
179
+ // state: {
180
+ // hover: true,
181
+ // normal: true,
182
+ // active: true,
183
+ // },
184
+ // },
157
185
  {
158
- id: 'backgroundColor',
159
- type: 'colorpicker',
160
- label: 'Background Color',
161
- default: {
162
- normal: 'brand',
163
- hover: '#4D4D4D',
164
- active: '#00A042'
186
+ id: 'backgroundColorV2',
187
+ type: 'color-picker-v2',
188
+ devices: {
189
+ desktop: {
190
+ default: {
191
+ normal: 'brand',
192
+ hover: 'highlight',
193
+ active: '#00A042'
194
+ }
195
+ }
165
196
  },
166
- state: {
167
- hover: true,
168
- normal: true,
169
- active: true
170
- }
197
+ compoDefaultValue: {
198
+ desktop: {
199
+ default: {
200
+ normal: 'brand',
201
+ hover: 'highlight',
202
+ active: '#00A042'
203
+ }
204
+ }
205
+ },
206
+ enableGradient: true
171
207
  },
172
208
  {
173
209
  id: 'textColor',
174
- type: 'colorpicker',
210
+ type: 'color-picker-v2',
175
211
  label: 'Text Color',
176
212
  default: {
177
213
  normal: 'text-3'
@@ -183,56 +219,25 @@ const CouponSettings = [
183
219
  }
184
220
  },
185
221
  {
186
- id: 'hasBoxShadowBtn',
187
- type: 'toggle',
188
- label: 'Enable Button Shadow',
189
- default: {
190
- normal: false,
191
- hover: false
192
- },
193
- state: {
194
- normal: true,
195
- hover: true
196
- }
197
- },
198
- {
199
- id: 'boxShadowBtn',
200
- type: 'boxShadow',
201
- label: 'Button Shadow',
202
- hideOnState: {
203
- normal: true,
204
- hover: true,
205
- active: true
206
- },
207
- default: {
208
- normal: {
209
- type: 'shadow-1',
210
- distance: '4px',
211
- blur: '12px',
212
- spread: '0px',
213
- color: 'rgba(0, 0, 0, 0.20)',
214
- angle: 90
222
+ id: 'textColorHover',
223
+ type: 'color-picker-v2',
224
+ devices: {
225
+ desktop: {
226
+ default: {
227
+ hover: 'text-3',
228
+ active: 'text-3'
229
+ }
215
230
  }
216
231
  },
217
- state: {
218
- normal: true,
219
- hover: true,
220
- active: true
221
- }
222
- },
223
- {
224
- id: 'roundedBtn',
225
- type: 'radius-preset',
226
- label: 'Border Radius',
227
- default: {
228
- normal: {
229
- radiusType: 'small'
232
+ compoDefaultValue: {
233
+ desktop: {
234
+ default: {
235
+ hover: 'text-3',
236
+ active: 'text-3'
237
+ }
230
238
  }
231
239
  },
232
- state: {
233
- hover: true,
234
- normal: true
235
- }
240
+ enableGradient: true
236
241
  },
237
242
  {
238
243
  id: 'align',
@@ -268,9 +273,6 @@ const CouponSettings = [
268
273
  default: {
269
274
  type: 'paragraph-1'
270
275
  },
271
- hiddenSetting: {
272
- color: true
273
- },
274
276
  ignoreReRender: true
275
277
  },
276
278
  {
@@ -359,10 +361,12 @@ const CouponSettings = [
359
361
  },
360
362
  {
361
363
  id: 'iconSpacing',
362
- type: 'input:unit',
364
+ type: 'input:slider',
363
365
  units: [
364
366
  'px'
365
367
  ],
368
+ step: 1,
369
+ max: 40,
366
370
  devices: {
367
371
  desktop: {
368
372
  default: '8px'
@@ -379,43 +383,14 @@ const CouponSettings = [
379
383
  height: 'Auto',
380
384
  padding: {
381
385
  type: 'medium',
382
- top: '8px',
383
- bottom: '8px',
386
+ top: '12px',
387
+ bottom: '12px',
384
388
  left: '24px',
385
389
  right: '24px'
386
390
  }
387
391
  }
388
392
  }
389
393
  },
390
- settingConfig: {
391
- width: {
392
- displayOptions: [
393
- 'full',
394
- 'auto',
395
- 'small',
396
- 'large',
397
- 'medium'
398
- ],
399
- sizeConfig: {
400
- small: '100px',
401
- medium: '116px',
402
- large: '132px'
403
- }
404
- },
405
- height: {
406
- displayOptions: [
407
- 'auto',
408
- 'small',
409
- 'large',
410
- 'medium'
411
- ],
412
- sizeConfig: {
413
- small: '28px',
414
- medium: '36px',
415
- large: '44px'
416
- }
417
- }
418
- },
419
394
  hiddenSettings: [
420
395
  'shape',
421
396
  'gap'
@@ -450,6 +425,105 @@ const CouponSettings = [
450
425
  default: 'left'
451
426
  }
452
427
  }
428
+ },
429
+ {
430
+ id: 'borderBtnV2',
431
+ type: 'border-v2',
432
+ devices: {
433
+ desktop: {
434
+ default: {
435
+ normal: {
436
+ borderType: 'none',
437
+ border: 'none',
438
+ borderWidth: '1px',
439
+ width: '1px 1px 1px 1px',
440
+ color: '#121212',
441
+ isCustom: true
442
+ },
443
+ hover: {
444
+ borderType: 'none',
445
+ border: 'none',
446
+ borderWidth: '1px',
447
+ width: '1px 1px 1px 1px',
448
+ color: '#121212',
449
+ isCustom: true
450
+ }
451
+ }
452
+ }
453
+ },
454
+ compoDefaultValue: {
455
+ desktop: {
456
+ default: {
457
+ normal: {
458
+ border: 'solid',
459
+ color: '#121212',
460
+ width: '1px',
461
+ borderWidth: '1px'
462
+ },
463
+ hover: {
464
+ border: 'solid',
465
+ color: '#121212',
466
+ width: '1px',
467
+ borderWidth: '1px'
468
+ }
469
+ }
470
+ }
471
+ }
472
+ },
473
+ {
474
+ id: 'roundedBtnV2',
475
+ type: 'corner-v2',
476
+ devices: {
477
+ desktop: {
478
+ default: {
479
+ normal: {
480
+ btrr: '0px',
481
+ bblr: '0px',
482
+ bbrr: '0px',
483
+ btlr: '0px',
484
+ radiusType: 'none'
485
+ }
486
+ }
487
+ }
488
+ },
489
+ compoDefaultValue: {
490
+ desktop: {
491
+ default: {
492
+ normal: {
493
+ btrr: '8px',
494
+ bblr: '8px',
495
+ bbrr: '8px',
496
+ btlr: '8px',
497
+ radiusType: 'rounded'
498
+ }
499
+ }
500
+ }
501
+ }
502
+ },
503
+ {
504
+ id: 'boxShadowBtnV2',
505
+ type: 'shadow-v2',
506
+ devices: {
507
+ desktop: {
508
+ default: {
509
+ normal: {}
510
+ }
511
+ }
512
+ },
513
+ compoDefaultValue: {
514
+ desktop: {
515
+ default: {
516
+ normal: {
517
+ type: 'shadow-1',
518
+ distance: '4px',
519
+ blur: '4px',
520
+ spread: '0px',
521
+ color: '#121212',
522
+ angle: 45
523
+ }
524
+ }
525
+ }
526
+ }
453
527
  }
454
528
  ]
455
529
  }
@@ -616,10 +690,10 @@ const CouponPresets = [
616
690
  rounded: {
617
691
  desktop: {
618
692
  normal: {
619
- btrr: '3px',
620
- bblr: '3px',
621
- bbrr: '3px',
622
- btlr: '3px',
693
+ btrr: '0px',
694
+ bblr: '0px',
695
+ bbrr: '0px',
696
+ btlr: '0px',
623
697
  radiusType: 'custom'
624
698
  }
625
699
  }