@gem-sdk/components 2.0.0-dev.457 → 2.0.0-dev.460

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.
Files changed (34) hide show
  1. package/dist/cjs/breadcrumb/components/Breadcrumb.js +1 -0
  2. package/dist/cjs/breadcrumb/components/Breadcrumb.liquid.js +1 -0
  3. package/dist/cjs/breadcrumb/setting/configs/settings.js +29 -2
  4. package/dist/cjs/breadcrumb/setting/configs/uiV2.js +230 -114
  5. package/dist/cjs/button/setting/configs/settings.js +2 -1
  6. package/dist/cjs/coupon/common/classes.js +16 -2
  7. package/dist/cjs/coupon/common/index.js +2 -2
  8. package/dist/cjs/coupon/common/styles.js +44 -26
  9. package/dist/cjs/coupon/components/Coupon.js +3 -6
  10. package/dist/cjs/coupon/components/Coupon.liquid.js +4 -7
  11. package/dist/cjs/coupon/setting/config/settings.js +194 -131
  12. package/dist/cjs/coupon/setting/config/uiV2.js +349 -142
  13. package/dist/cjs/product/components/FileUpload/components/config/uiV2.js +15 -0
  14. package/dist/cjs/product/setting/product/configs/settings.js +1 -1
  15. package/dist/cjs/sticky/components/Sticky.js +0 -2
  16. package/dist/cjs/sticky/components/Sticky.liquid.js +1 -2
  17. package/dist/esm/breadcrumb/components/Breadcrumb.js +2 -1
  18. package/dist/esm/breadcrumb/components/Breadcrumb.liquid.js +2 -1
  19. package/dist/esm/breadcrumb/setting/configs/settings.js +29 -2
  20. package/dist/esm/breadcrumb/setting/configs/uiV2.js +230 -114
  21. package/dist/esm/button/setting/configs/settings.js +2 -1
  22. package/dist/esm/coupon/common/classes.js +16 -2
  23. package/dist/esm/coupon/common/index.js +2 -2
  24. package/dist/esm/coupon/common/styles.js +45 -26
  25. package/dist/esm/coupon/components/Coupon.js +5 -8
  26. package/dist/esm/coupon/components/Coupon.liquid.js +6 -9
  27. package/dist/esm/coupon/setting/config/settings.js +194 -131
  28. package/dist/esm/coupon/setting/config/uiV2.js +349 -142
  29. package/dist/esm/product/components/FileUpload/components/config/uiV2.js +15 -0
  30. package/dist/esm/product/setting/product/configs/settings.js +1 -1
  31. package/dist/esm/sticky/components/Sticky.js +2 -4
  32. package/dist/esm/sticky/components/Sticky.liquid.js +1 -2
  33. package/dist/types/index.d.ts +1 -0
  34. package/package.json +2 -2
@@ -1,9 +1,8 @@
1
1
  import { makeStyleResponsive, composeBorderCss, composeCornerCss, getStyleShadow } from '@gem-sdk/core';
2
2
 
3
- const getButtonStyles = (styles, removedActiveShadow)=>{
3
+ const getButtonStyles = (styles)=>{
4
4
  return {
5
- ...styles,
6
- hasBoxShadowBtn: removedActiveShadow
5
+ ...styles
7
6
  };
8
7
  };
9
8
  const getButtonStyle = (style, styles)=>{
@@ -12,30 +11,50 @@ const getButtonStyle = (style, styles)=>{
12
11
  ...makeStyleResponsive('ta', styles?.align)
13
12
  };
14
13
  };
15
- const getInnerBorderCornerCss = (data)=>{
16
- const { borderActive, cornerActive, uid, styles } = data;
17
- return `
18
- .gp-coupon[data-active="true"] .${uid}::before {
19
- ${composeBorderCss(borderActive)}
20
- }
21
- .gp-coupon[data-active="true"] .${uid} {
22
- ${composeCornerCss(cornerActive, true)}
23
- }
24
- .gp-coupon[data-active="true"] .${uid} {
25
- box-shadow: ${styles?.hasBoxShadowBtn?.active ? getStyleShadow({
26
- value: styles?.boxShadowBtn?.active,
27
- state: 'active',
28
- styleAppliedFor: 'box-shadow',
29
- isEnableShadow: true
30
- })['--shadow'] : 'none'}
31
- }
32
- `;
33
- };
34
- const removedActiveShadow = (styles)=>{
14
+ const getResponsiveSetting = (setting)=>{
15
+ const desktop = setting.desktop;
16
+ const tablet = setting.tablet ? setting.tablet : desktop;
17
+ const mobile = setting.mobile ? setting.mobile : tablet;
35
18
  return {
36
- hover: styles?.hasBoxShadowBtn?.hover,
37
- normal: styles?.hasBoxShadowBtn?.normal
19
+ desktop,
20
+ tablet,
21
+ mobile
22
+ };
23
+ };
24
+ const getInnerBorderCornerCss = (data)=>{
25
+ const { uid, styles } = data;
26
+ const borderBtnV2 = getResponsiveSetting(styles?.borderBtnV2 || {});
27
+ const roundedBtnV2 = getResponsiveSetting(styles?.roundedBtnV2 || {});
28
+ const boxShadowBtnV2 = getResponsiveSetting(styles?.boxShadowBtnV2 || {});
29
+ const getShadowValue = (value)=>value ? getStyleShadow({
30
+ value,
31
+ state: 'active',
32
+ styleAppliedFor: 'box-shadow',
33
+ isEnableShadow: true
34
+ })['--shadow'] : 'none';
35
+ const breakpoints = {
36
+ desktop: '',
37
+ tablet: '@media only screen and (max-width: 1024px) and (min-width: 768px)',
38
+ mobile: '@media only screen and (max-width: 768px)'
39
+ };
40
+ const generateStyles = (device)=>{
41
+ const mediaQuery = breakpoints[device] ? `${breakpoints[device]} {` : '';
42
+ const closeMediaQuery = mediaQuery ? '}' : '';
43
+ return `
44
+ ${mediaQuery}
45
+ .gp-coupon[data-active="true"] .${uid} {
46
+ ${composeBorderCss(borderBtnV2?.[device]?.active)} !important;
47
+ ${composeCornerCss(roundedBtnV2?.[device]?.active)} !important;
48
+ box-shadow: ${getShadowValue(boxShadowBtnV2?.[device]?.active)} !important;
49
+ }
50
+ ${closeMediaQuery}
51
+ `;
38
52
  };
53
+ return [
54
+ generateStyles('desktop'),
55
+ generateStyles('tablet'),
56
+ generateStyles('mobile')
57
+ ].join('\n').trim();
39
58
  };
40
59
 
41
- export { getButtonStyle, getButtonStyles, getInnerBorderCornerCss, removedActiveShadow };
60
+ export { getButtonStyle, getButtonStyles, getInnerBorderCornerCss };
@@ -1,21 +1,18 @@
1
1
  'use client';
2
2
  import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { createStyle, createClass } from '@gem-sdk/system';
3
+ import { createClass } from '@gem-sdk/system';
4
4
  import Button from '../../button/components/Button.js';
5
5
  import { getButtonSetting } from '../common/index.js';
6
- import { removedActiveShadow, getInnerBorderCornerCss, getButtonStyle, getButtonStyles } from '../common/styles.js';
6
+ import { getInnerBorderCornerCss, getButtonStyle, getButtonStyles } from '../common/styles.js';
7
7
  import useCoupon from '../hooks/useCoupon.js';
8
8
  import { getActiveClasses } from '../common/classes.js';
9
9
 
10
10
  const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced, children })=>{
11
- const { borderBtn, roundedBtn, backgroundColor, textColor } = styles ?? {};
11
+ const { backgroundColorV2, textColorHover } = styles ?? {};
12
12
  const { mode, changeStateILP, defaultLabelState, dataActive } = useCoupon(setting);
13
- const computedRemovedActiveShadow = createStyle(removedActiveShadow(styles));
14
- const composeCouponComponentClasses = createClass(getActiveClasses(backgroundColor?.active, textColor?.active));
13
+ const composeCouponComponentClasses = createClass(getActiveClasses(backgroundColorV2, textColorHover));
15
14
  const computedInnerBorderCornerCss = getInnerBorderCornerCss({
16
15
  uid: builderProps?.uid,
17
- borderActive: borderBtn?.active,
18
- cornerActive: roundedBtn?.active,
19
16
  styles
20
17
  });
21
18
  return /*#__PURE__*/ jsxs("div", {
@@ -40,7 +37,7 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
40
37
  ...getButtonStyle(style, styles)
41
38
  },
42
39
  styles: {
43
- ...getButtonStyles(styles, computedRemovedActiveShadow)
40
+ ...getButtonStyles(styles)
44
41
  },
45
42
  children: children
46
43
  })
@@ -1,26 +1,23 @@
1
1
  import { template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import Button from '../../button/components/Button.liquid.js';
3
3
  import { getSettingPreloadData } from '../../helpers.js';
4
- import { createStyle, createStateOrContext, createClass } from '@gem-sdk/system';
4
+ import { createStateOrContext, createClass } from '@gem-sdk/system';
5
5
  import { getButtonSetting } from '../common/index.js';
6
- import { removedActiveShadow, getInnerBorderCornerCss, getButtonStyle, getButtonStyles } from '../common/styles.js';
6
+ import { getInnerBorderCornerCss, getButtonStyle, getButtonStyles } from '../common/styles.js';
7
7
  import { getActiveClasses } from '../common/classes.js';
8
8
 
9
9
  const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced, pageContext })=>{
10
- const { backgroundColor, textColor, borderBtn, roundedBtn } = styles ?? {};
10
+ const { backgroundColorV2, textColorHover } = styles ?? {};
11
11
  const { defaultLabel, clickedLabel, copyContent } = setting ?? {};
12
- const computedRemovedActiveShadow = createStyle(removedActiveShadow(styles));
13
12
  const composeContextState = createStateOrContext({
14
13
  defaultLabel,
15
14
  clickedLabel,
16
15
  copyContent,
17
16
  uid: builderProps?.uid
18
17
  });
19
- const composeCouponComponentClasses = createClass(getActiveClasses(backgroundColor?.active, textColor?.active));
18
+ const composeCouponComponentClasses = createClass(getActiveClasses(backgroundColorV2, textColorHover));
20
19
  const computedInnerBorderCornerCss = getInnerBorderCornerCss({
21
20
  uid: builderProps?.uid,
22
- borderActive: borderBtn?.active,
23
- cornerActive: roundedBtn?.active,
24
21
  styles
25
22
  });
26
23
  const renderScript = ()=>{
@@ -36,13 +33,13 @@ const Coupon = ({ setting, builderProps, builderAttrs, style, styles, advanced,
36
33
  },
37
34
  builderAttrs: builderAttrs,
38
35
  setting: {
39
- ...getButtonSetting(setting, defaultLabel, 'submit')
36
+ ...getButtonSetting(setting, defaultLabel, 'button')
40
37
  },
41
38
  style: {
42
39
  ...getButtonStyle(style, styles)
43
40
  },
44
41
  styles: {
45
- ...getButtonStyles(styles, computedRemovedActiveShadow)
42
+ ...getButtonStyles(styles)
46
43
  },
47
44
  advanced,
48
45
  pageContext
@@ -50,7 +50,7 @@ const CouponSettings = [
50
50
  id: 'iconVisible',
51
51
  label: 'Icon Visible',
52
52
  type: 'toggle',
53
- default: false
53
+ default: true
54
54
  },
55
55
  {
56
56
  id: 'iconSvg',
@@ -126,50 +126,86 @@ const CouponSettings = [
126
126
  id: 'style',
127
127
  controls: [
128
128
  {
129
- id: 'borderBtn',
130
- type: 'border',
131
- label: 'Border',
132
- emptyOnClear: true,
133
- default: {
134
- normal: {
135
- borderType: 'none',
136
- border: 'none',
137
- isCustom: false,
138
- borderWidth: '1px',
139
- width: '1px 1px 1px 1px'
140
- },
141
- hover: {
142
- isCustom: false,
143
- borderType: 'none',
144
- border: 'none',
145
- borderWidth: '1px',
146
- width: '1px 1px 1px 1px'
147
- }
148
- },
149
- state: {
150
- hover: true,
151
- normal: true,
152
- active: true
153
- }
129
+ id: 'enableTextStyle',
130
+ label: '',
131
+ type: 'toggle',
132
+ default: true
154
133
  },
134
+ // {
135
+ // id: 'borderBtn',
136
+ // type: 'border',
137
+ // label: 'Border',
138
+ // emptyOnClear: true,
139
+ // default: {
140
+ // normal: {
141
+ // borderType: 'none',
142
+ // border: 'none',
143
+ // isCustom: false,
144
+ // borderWidth: '1px',
145
+ // width: '1px 1px 1px 1px',
146
+ // },
147
+ // hover: {
148
+ // isCustom: false,
149
+ // borderType: 'none',
150
+ // border: 'none',
151
+ // borderWidth: '1px',
152
+ // width: '1px 1px 1px 1px',
153
+ // },
154
+ // // active: {
155
+ // // isCustom: false,
156
+ // // borderType: 'none',
157
+ // // border: 'none',
158
+ // // borderWidth: '1px',
159
+ // // width: '1px 1px 1px 1px',
160
+ // // },
161
+ // },
162
+ // state: {
163
+ // hover: true,
164
+ // normal: true,
165
+ // active: true,
166
+ // },
167
+ // },
168
+ // {
169
+ // id: 'backgroundColor',
170
+ // type: 'background-color-picker',
171
+ // label: 'Background Color',
172
+ // default: {
173
+ // normal: 'brand',
174
+ // hover: 'highlight',
175
+ // active: '#00A042',
176
+ // },
177
+ // state: {
178
+ // hover: true,
179
+ // normal: true,
180
+ // active: true,
181
+ // },
182
+ // },
155
183
  {
156
- id: 'backgroundColor',
157
- type: 'colorpicker',
158
- label: 'Background Color',
159
- default: {
160
- normal: 'brand',
161
- hover: '#4D4D4D',
162
- active: '#00A042'
184
+ id: 'backgroundColorV2',
185
+ type: 'color-picker-v2',
186
+ devices: {
187
+ desktop: {
188
+ default: {
189
+ normal: 'brand',
190
+ hover: 'highlight',
191
+ active: '#00A042'
192
+ }
193
+ }
163
194
  },
164
- state: {
165
- hover: true,
166
- normal: true,
167
- active: true
168
- }
195
+ compoDefaultValue: {
196
+ desktop: {
197
+ default: {
198
+ normal: 'brand',
199
+ hover: 'highlight',
200
+ active: '#00A042'
201
+ }
202
+ }
203
+ },
204
+ enableGradient: true
169
205
  },
170
206
  {
171
207
  id: 'textColor',
172
- type: 'colorpicker',
208
+ type: 'color-picker-v2',
173
209
  label: 'Text Color',
174
210
  default: {
175
211
  normal: 'text-3'
@@ -181,56 +217,25 @@ const CouponSettings = [
181
217
  }
182
218
  },
183
219
  {
184
- id: 'hasBoxShadowBtn',
185
- type: 'toggle',
186
- label: 'Enable Button Shadow',
187
- default: {
188
- normal: false,
189
- hover: false
190
- },
191
- state: {
192
- normal: true,
193
- hover: true
194
- }
195
- },
196
- {
197
- id: 'boxShadowBtn',
198
- type: 'boxShadow',
199
- label: 'Button Shadow',
200
- hideOnState: {
201
- normal: true,
202
- hover: true,
203
- active: true
204
- },
205
- default: {
206
- normal: {
207
- type: 'shadow-1',
208
- distance: '4px',
209
- blur: '12px',
210
- spread: '0px',
211
- color: 'rgba(0, 0, 0, 0.20)',
212
- angle: 90
220
+ id: 'textColorHover',
221
+ type: 'color-picker-v2',
222
+ devices: {
223
+ desktop: {
224
+ default: {
225
+ hover: 'text-3',
226
+ active: 'text-3'
227
+ }
213
228
  }
214
229
  },
215
- state: {
216
- normal: true,
217
- hover: true,
218
- active: true
219
- }
220
- },
221
- {
222
- id: 'roundedBtn',
223
- type: 'radius-preset',
224
- label: 'Border Radius',
225
- default: {
226
- normal: {
227
- radiusType: 'small'
230
+ compoDefaultValue: {
231
+ desktop: {
232
+ default: {
233
+ hover: 'text-3',
234
+ active: 'text-3'
235
+ }
228
236
  }
229
237
  },
230
- state: {
231
- hover: true,
232
- normal: true
233
- }
238
+ enableGradient: true
234
239
  },
235
240
  {
236
241
  id: 'align',
@@ -266,9 +271,6 @@ const CouponSettings = [
266
271
  default: {
267
272
  type: 'paragraph-1'
268
273
  },
269
- hiddenSetting: {
270
- color: true
271
- },
272
274
  ignoreReRender: true
273
275
  },
274
276
  {
@@ -357,10 +359,12 @@ const CouponSettings = [
357
359
  },
358
360
  {
359
361
  id: 'iconSpacing',
360
- type: 'input:unit',
362
+ type: 'input:slider',
361
363
  units: [
362
364
  'px'
363
365
  ],
366
+ step: 1,
367
+ max: 40,
364
368
  devices: {
365
369
  desktop: {
366
370
  default: '8px'
@@ -377,43 +381,14 @@ const CouponSettings = [
377
381
  height: 'Auto',
378
382
  padding: {
379
383
  type: 'medium',
380
- top: '8px',
381
- bottom: '8px',
384
+ top: '12px',
385
+ bottom: '12px',
382
386
  left: '24px',
383
387
  right: '24px'
384
388
  }
385
389
  }
386
390
  }
387
391
  },
388
- settingConfig: {
389
- width: {
390
- displayOptions: [
391
- 'full',
392
- 'auto',
393
- 'small',
394
- 'large',
395
- 'medium'
396
- ],
397
- sizeConfig: {
398
- small: '100px',
399
- medium: '116px',
400
- large: '132px'
401
- }
402
- },
403
- height: {
404
- displayOptions: [
405
- 'auto',
406
- 'small',
407
- 'large',
408
- 'medium'
409
- ],
410
- sizeConfig: {
411
- small: '28px',
412
- medium: '36px',
413
- large: '44px'
414
- }
415
- }
416
- },
417
392
  hiddenSettings: [
418
393
  'shape',
419
394
  'gap'
@@ -448,6 +423,105 @@ const CouponSettings = [
448
423
  default: 'left'
449
424
  }
450
425
  }
426
+ },
427
+ {
428
+ id: 'borderBtnV2',
429
+ type: 'border-v2',
430
+ devices: {
431
+ desktop: {
432
+ default: {
433
+ normal: {
434
+ borderType: 'none',
435
+ border: 'none',
436
+ borderWidth: '1px',
437
+ width: '1px 1px 1px 1px',
438
+ color: '#121212',
439
+ isCustom: true
440
+ },
441
+ hover: {
442
+ borderType: 'none',
443
+ border: 'none',
444
+ borderWidth: '1px',
445
+ width: '1px 1px 1px 1px',
446
+ color: '#121212',
447
+ isCustom: true
448
+ }
449
+ }
450
+ }
451
+ },
452
+ compoDefaultValue: {
453
+ desktop: {
454
+ default: {
455
+ normal: {
456
+ border: 'solid',
457
+ color: '#121212',
458
+ width: '1px',
459
+ borderWidth: '1px'
460
+ },
461
+ hover: {
462
+ border: 'solid',
463
+ color: '#121212',
464
+ width: '1px',
465
+ borderWidth: '1px'
466
+ }
467
+ }
468
+ }
469
+ }
470
+ },
471
+ {
472
+ id: 'roundedBtnV2',
473
+ type: 'corner-v2',
474
+ devices: {
475
+ desktop: {
476
+ default: {
477
+ normal: {
478
+ btrr: '0px',
479
+ bblr: '0px',
480
+ bbrr: '0px',
481
+ btlr: '0px',
482
+ radiusType: 'none'
483
+ }
484
+ }
485
+ }
486
+ },
487
+ compoDefaultValue: {
488
+ desktop: {
489
+ default: {
490
+ normal: {
491
+ btrr: '8px',
492
+ bblr: '8px',
493
+ bbrr: '8px',
494
+ btlr: '8px',
495
+ radiusType: 'rounded'
496
+ }
497
+ }
498
+ }
499
+ }
500
+ },
501
+ {
502
+ id: 'boxShadowBtnV2',
503
+ type: 'shadow-v2',
504
+ devices: {
505
+ desktop: {
506
+ default: {
507
+ normal: {}
508
+ }
509
+ }
510
+ },
511
+ compoDefaultValue: {
512
+ desktop: {
513
+ default: {
514
+ normal: {
515
+ type: 'shadow-1',
516
+ distance: '4px',
517
+ blur: '4px',
518
+ spread: '0px',
519
+ color: '#121212',
520
+ angle: 45
521
+ }
522
+ }
523
+ }
524
+ }
451
525
  }
452
526
  ]
453
527
  }
@@ -611,17 +685,6 @@ const CouponPresets = [
611
685
  }
612
686
  }
613
687
  },
614
- rounded: {
615
- desktop: {
616
- normal: {
617
- btrr: '3px',
618
- bblr: '3px',
619
- bbrr: '3px',
620
- btlr: '3px',
621
- radiusType: 'custom'
622
- }
623
- }
624
- },
625
688
  hasBoxShadow: {
626
689
  desktop: {
627
690
  normal: false