@gem-sdk/components 2.0.0-dev.470 → 2.0.0-dev.472

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.
@@ -5,19 +5,6 @@ require('react/jsx-runtime');
5
5
  require('react');
6
6
  var _const = require('../../../common/const.js');
7
7
 
8
- const getCSSAlignByDevice = (position, device)=>{
9
- return {
10
- [`--left${device}`]: position == 'top' ? '0' : '50%',
11
- [`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
12
- };
13
- };
14
- const getCSSAlign = (position)=>{
15
- return {
16
- ...getCSSAlignByDevice(position?.desktop, ''),
17
- ...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
18
- ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
19
- };
20
- };
21
8
  const getDisplayStyle = (device, display, position)=>{
22
9
  const style = {
23
10
  [`--top${device}`]: 'auto',
@@ -38,16 +25,26 @@ const displayConditionStyle = (display, position)=>{
38
25
  };
39
26
  };
40
27
  const getContainerStyles = (args)=>{
41
- const { style, width, position, display } = args;
28
+ const { style, position, display } = args;
42
29
  return {
43
30
  margin: '0 auto',
44
31
  ...getStylePadding(style),
45
- ...core.makeStyleResponsive('w', width),
46
32
  ...displayConditionStyle(display, position),
47
- ...getCSSAlign(position),
48
33
  'z-index': _const.ELEMENT_Z_INDEX.STICKY
49
34
  };
50
35
  };
36
+ const getContentStyles = (args)=>{
37
+ const { style, width, background } = args;
38
+ return {
39
+ ...core.makeStyle({
40
+ m: '0 auto'
41
+ }),
42
+ ...core.makeStyleResponsive('w', width),
43
+ ...filterStyles(style),
44
+ ...core.getGradientBgrStyleByDevice(background),
45
+ ...core.getStyleBackgroundByDevice(background)
46
+ };
47
+ };
51
48
  const getStylePadding = (style)=>{
52
49
  const keepList = [
53
50
  '--pt',
@@ -98,5 +95,6 @@ const filterStyles = (style)=>{
98
95
  exports.displayConditionStyle = displayConditionStyle;
99
96
  exports.filterStyles = filterStyles;
100
97
  exports.getContainerStyles = getContainerStyles;
98
+ exports.getContentStyles = getContentStyles;
101
99
  exports.getDisplayStyle = getDisplayStyle;
102
100
  exports.getStylePadding = getStylePadding;
@@ -134,15 +134,22 @@ const CarouselSettingsV2 = [
134
134
  {
135
135
  id: 'dotStyle',
136
136
  label: 'Dot style',
137
- type: 'option:value',
137
+ type: 'option:illustration',
138
+ iconViewBox: '0 0 77 48',
139
+ enableItemBackground: true,
140
+ enableTooltip: true,
138
141
  options: [
139
142
  {
140
143
  label: 'Inside',
141
- value: 'inside'
144
+ value: 'inside',
145
+ type: 'carousel-dot',
146
+ svgName: 'gp-carousel-dot-inside'
142
147
  },
143
148
  {
144
149
  label: 'Outside',
145
- value: 'outside'
150
+ value: 'outside',
151
+ type: 'carousel-dot',
152
+ svgName: 'gp-carousel-dot-outside'
146
153
  }
147
154
  ],
148
155
  devices: {
@@ -402,7 +409,9 @@ const CarouselSettingsV2 = [
402
409
  {
403
410
  id: 'arrowGapToEachSide',
404
411
  label: 'Gap to each side',
405
- type: 'input:number',
412
+ type: 'input:slider',
413
+ min: 0,
414
+ max: 120,
406
415
  default: '16'
407
416
  },
408
417
  {
@@ -594,12 +603,16 @@ const CarouselSettingsV2 = [
594
603
  {
595
604
  id: 'playSpeed',
596
605
  label: 'Slide speed',
597
- type: 'input:unit',
606
+ type: 'input:slider',
598
607
  useOnlyUnitInit: true,
599
- min: 1,
608
+ min: 100,
609
+ max: 5000,
610
+ step: 50,
600
611
  units: [
601
612
  'ms'
602
613
  ],
614
+ showDefaultUnit: true,
615
+ isNumber: true,
603
616
  default: 500
604
617
  },
605
618
  {
@@ -71,6 +71,21 @@ const SettingUIV2 = [
71
71
  }
72
72
  ]
73
73
  },
74
+ {
75
+ label: {
76
+ en: 'Item spacing'
77
+ },
78
+ controls: [
79
+ {
80
+ label: {
81
+ en: 'Gap'
82
+ },
83
+ setting: {
84
+ id: 'spacing'
85
+ }
86
+ }
87
+ ]
88
+ },
74
89
  {
75
90
  label: {
76
91
  en: 'Item style'
@@ -107,86 +122,75 @@ const SettingUIV2 = [
107
122
  setting: {
108
123
  id: 'background'
109
124
  }
110
- },
111
- {
112
- label: {
113
- en: 'Border'
114
- },
115
- setting: {
116
- id: 'borderContent'
117
- }
118
- },
119
- {
120
- label: {
121
- en: 'Corner'
122
- },
123
- setting: {
124
- id: 'roundedContent'
125
- }
126
- },
127
- {
128
- label: {
129
- en: 'Shadow'
130
- },
131
- setting: {
132
- id: 'carouselShadow'
125
+ }
126
+ ],
127
+ moreSettings: {
128
+ controls: [
129
+ {
130
+ label: {
131
+ en: 'Border'
132
+ },
133
+ setting: {
134
+ id: 'borderContent'
135
+ }
133
136
  },
134
- options: {
135
- updateFields: [
136
- {
137
- field: 'enable',
138
- settingId: 'hasActiveShadow'
139
- }
140
- ]
137
+ {
138
+ label: {
139
+ en: 'Corner'
140
+ },
141
+ setting: {
142
+ id: 'roundedContent'
143
+ }
141
144
  },
142
- controlChangeTrigger: {
143
- settings: [
144
- {
145
- condition: `carouselShadow.enable === true`,
146
- source: [
147
- 'carouselShadow'
148
- ],
149
- action: {
150
- controlId: 'hasActiveShadow',
151
- groupType: 'style',
152
- controlType: 'style',
153
- newValue: true
145
+ {
146
+ label: {
147
+ en: 'Shadow'
148
+ },
149
+ setting: {
150
+ id: 'carouselShadow'
151
+ },
152
+ options: {
153
+ updateFields: [
154
+ {
155
+ field: 'enable',
156
+ settingId: 'hasActiveShadow'
154
157
  }
155
- },
156
- {
157
- condition: `carouselShadow.enable === false`,
158
- source: [
159
- 'carouselShadow'
160
- ],
161
- action: {
162
- controlId: 'hasActiveShadow',
163
- groupType: 'style',
164
- controlType: 'style',
165
- newValue: false
158
+ ]
159
+ },
160
+ controlChangeTrigger: {
161
+ settings: [
162
+ {
163
+ condition: `carouselShadow.enable === true`,
164
+ source: [
165
+ 'carouselShadow'
166
+ ],
167
+ action: {
168
+ controlId: 'hasActiveShadow',
169
+ groupType: 'style',
170
+ controlType: 'style',
171
+ newValue: true
172
+ }
173
+ },
174
+ {
175
+ condition: `carouselShadow.enable === false`,
176
+ source: [
177
+ 'carouselShadow'
178
+ ],
179
+ action: {
180
+ controlId: 'hasActiveShadow',
181
+ groupType: 'style',
182
+ controlType: 'style',
183
+ newValue: false
184
+ }
166
185
  }
186
+ ],
187
+ options: {
188
+ noRecordHistory: true
167
189
  }
168
- ],
169
- options: {
170
- noRecordHistory: true
171
190
  }
172
191
  }
173
- }
174
- ]
175
- },
176
- {
177
- label: {
178
- en: 'Item spacing'
179
- },
180
- controls: [
181
- {
182
- label: {
183
- en: 'Gap'
184
- },
185
- setting: {
186
- id: 'spacing'
187
- }
188
- }
189
- ]
192
+ ]
193
+ }
190
194
  },
191
195
  {
192
196
  controls: [
@@ -205,7 +209,7 @@ const SettingUIV2 = [
205
209
  {
206
210
  conditionDisplay: `navigationEnable === true`,
207
211
  label: {
208
- en: 'Layout'
212
+ en: 'Position'
209
213
  },
210
214
  setting: {
211
215
  id: 'navigationStyle'
@@ -247,7 +251,8 @@ const SettingUIV2 = [
247
251
  label: {
248
252
  en: 'Size'
249
253
  },
250
- fixedValue: 'Edit...',
254
+ fixedValue: 'Edit',
255
+ iconName: 'polaris-measurement-size',
251
256
  controls: [
252
257
  {
253
258
  setting: {
@@ -320,7 +325,7 @@ const SettingUIV2 = [
320
325
  {
321
326
  conditionDisplay: `navigationEnable === true`,
322
327
  label: {
323
- en: 'Gap to each'
328
+ en: 'Gap to edge'
324
329
  },
325
330
  setting: {
326
331
  id: 'arrowGapToEachSide'
@@ -355,7 +360,16 @@ const SettingUIV2 = [
355
360
  {
356
361
  conditionDisplay: `dot === true`,
357
362
  label: {
358
- en: 'Active color'
363
+ en: 'Position'
364
+ },
365
+ setting: {
366
+ id: 'dotStyle'
367
+ }
368
+ },
369
+ {
370
+ conditionDisplay: `dot === true`,
371
+ label: {
372
+ en: 'Active icon'
359
373
  },
360
374
  setting: {
361
375
  id: 'dotActiveColor'
@@ -364,7 +378,7 @@ const SettingUIV2 = [
364
378
  {
365
379
  conditionDisplay: `dot === true`,
366
380
  label: {
367
- en: 'Inactive color'
381
+ en: 'Inactive icon'
368
382
  },
369
383
  setting: {
370
384
  id: 'dotColor'
@@ -378,26 +392,99 @@ const SettingUIV2 = [
378
392
  setting: {
379
393
  id: 'dotSize'
380
394
  }
395
+ },
396
+ {
397
+ conditionDisplay: `dot === true`,
398
+ label: {
399
+ en: 'Gap to edge'
400
+ },
401
+ setting: {
402
+ id: 'dotGapToCarousel'
403
+ }
404
+ }
405
+ ]
406
+ },
407
+ {
408
+ label: {
409
+ en: 'Slide effect'
410
+ },
411
+ controls: [
412
+ {
413
+ label: {
414
+ en: 'Slide direction'
415
+ },
416
+ setting: {
417
+ id: 'rtl'
418
+ }
419
+ },
420
+ {
421
+ label: {
422
+ en: 'Autoplay'
423
+ },
424
+ setting: {
425
+ id: 'autoplay'
426
+ }
427
+ },
428
+ {
429
+ label: {
430
+ en: 'Time out'
431
+ },
432
+ setting: {
433
+ id: 'autoplayTimeout'
434
+ },
435
+ conditionDisplay: 'autoplay === true'
436
+ },
437
+ {
438
+ label: {
439
+ en: 'Pause On Hover'
440
+ },
441
+ setting: {
442
+ id: 'pauseOnHover'
443
+ },
444
+ conditionDisplay: 'autoplay == true'
445
+ },
446
+ {
447
+ label: {
448
+ en: 'Preview'
449
+ },
450
+ setting: {
451
+ id: 'runPreview'
452
+ },
453
+ conditionDisplay: 'autoplay === true'
454
+ },
455
+ {
456
+ label: {
457
+ en: 'Infinity loop'
458
+ },
459
+ setting: {
460
+ id: 'loop'
461
+ }
381
462
  }
382
463
  ],
383
464
  moreSettings: {
384
465
  controls: [
385
466
  {
386
- conditionDisplay: `dot === true`,
387
467
  label: {
388
- en: 'Gap to bottom'
468
+ en: 'Drag / swipe'
389
469
  },
390
470
  setting: {
391
- id: 'dotGapToCarousel'
471
+ id: 'enableDrag'
392
472
  }
393
473
  },
394
474
  {
395
- conditionDisplay: `dot === true`,
396
475
  label: {
397
- en: 'Position'
476
+ en: 'Slide speed'
477
+ },
478
+ setting: {
479
+ id: 'playSpeed'
480
+ }
481
+ },
482
+ {
483
+ label: {
484
+ en: 'Animation'
398
485
  },
399
486
  setting: {
400
- id: 'dotStyle'
487
+ id: 'animationMode'
401
488
  }
402
489
  }
403
490
  ]
@@ -413,6 +500,43 @@ const SettingUIV2 = [
413
500
  id: 'sizeSetting'
414
501
  },
415
502
  layout: 'vertical'
503
+ },
504
+ {
505
+ label: {
506
+ en: 'Padding'
507
+ },
508
+ conditionDisplay: `pageType != "POST_PURCHASE"`,
509
+ controlConfig: {
510
+ id: 'padding',
511
+ type: 'padding-v2',
512
+ linkWithSetting: {
513
+ name: 'spacing-setting',
514
+ field: 'padding'
515
+ }
516
+ }
517
+ }
518
+ ]
519
+ },
520
+ {
521
+ label: {
522
+ en: 'Background'
523
+ },
524
+ controls: [
525
+ {
526
+ label: {
527
+ en: 'Color'
528
+ },
529
+ setting: {
530
+ id: 'backgroundColor'
531
+ }
532
+ },
533
+ {
534
+ label: {
535
+ en: 'Image'
536
+ },
537
+ setting: {
538
+ id: 'backgroundImage'
539
+ }
416
540
  }
417
541
  ]
418
542
  },
@@ -495,115 +619,6 @@ const SettingUIV2 = [
495
619
  }
496
620
  ]
497
621
  },
498
- {
499
- label: {
500
- en: 'Background'
501
- },
502
- controls: [
503
- {
504
- label: {
505
- en: 'Color'
506
- },
507
- setting: {
508
- id: 'backgroundColor'
509
- }
510
- },
511
- {
512
- label: {
513
- en: 'Image'
514
- },
515
- setting: {
516
- id: 'backgroundImage'
517
- }
518
- }
519
- ]
520
- },
521
- {
522
- label: {
523
- en: 'Slide effect'
524
- },
525
- controls: [
526
- {
527
- label: {
528
- en: 'Slide direction'
529
- },
530
- setting: {
531
- id: 'rtl'
532
- }
533
- },
534
- {
535
- label: {
536
- en: 'Autoplay'
537
- },
538
- setting: {
539
- id: 'autoplay'
540
- }
541
- },
542
- {
543
- label: {
544
- en: 'Time out'
545
- },
546
- setting: {
547
- id: 'autoplayTimeout'
548
- },
549
- conditionDisplay: 'autoplay === true'
550
- },
551
- {
552
- label: {
553
- en: 'Pause On Hover'
554
- },
555
- setting: {
556
- id: 'pauseOnHover'
557
- },
558
- conditionDisplay: 'autoplay == true'
559
- },
560
- {
561
- label: {
562
- en: 'Preview'
563
- },
564
- setting: {
565
- id: 'runPreview'
566
- },
567
- conditionDisplay: 'autoplay === true'
568
- },
569
- {
570
- label: {
571
- en: 'Infinity loop'
572
- },
573
- setting: {
574
- id: 'loop'
575
- }
576
- }
577
- ],
578
- moreSettings: {
579
- controls: [
580
- {
581
- label: {
582
- en: 'Drag / swipe'
583
- },
584
- setting: {
585
- id: 'enableDrag'
586
- }
587
- },
588
- {
589
- label: {
590
- en: 'Slide speed'
591
- },
592
- setting: {
593
- id: 'playSpeed'
594
- }
595
- },
596
- {
597
- label: {
598
- en: 'Animation'
599
- },
600
- setting: {
601
- id: 'animationMode'
602
- }
603
- }
604
- ]
605
- }
606
- },
607
622
  {
608
623
  controls: [
609
624
  {
@@ -1,26 +1,37 @@
1
1
  'use client';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
- import { cls, getStyleBackgroundByDevice, isEmptyChildren } from '@gem-sdk/core';
3
+ import { isEmptyChildren } from '@gem-sdk/core';
4
4
  import Head from 'next/head';
5
5
  import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
6
6
  import 'react';
7
7
  import { ELEMENT_Z_INDEX } from '../../common/const.js';
8
8
  import useSticky from './hooks/useSticky.js';
9
- import { createStyle } from '@gem-sdk/system';
10
- import { getStylePadding, filterStyles } from './common/styles.js';
9
+ import { createStyle, createClass } from '@gem-sdk/system';
10
+ import { getStylePadding, getContentStyles } from './common/styles.js';
11
+ import { getContainerClasses } from './common/classes.js';
11
12
 
12
- const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
13
- const { background, preloadBgImage } = setting ?? {};
14
- const { w, positionStyle, displayStyle, getCSSAlign } = useSticky(setting);
13
+ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
14
+ const { background, preloadBgImage, width, isScrollToTop } = setting ?? {};
15
+ const { w, positionStyle, displayStyle } = useSticky(setting);
15
16
  const computedContainerStyles = createStyle({
16
17
  margin: '0 auto',
17
18
  ...w,
18
19
  ...displayStyle,
19
20
  ...getStylePadding(style),
20
21
  ...positionStyle,
21
- ...getCSSAlign,
22
22
  zIndex: ELEMENT_Z_INDEX.STICKY
23
23
  });
24
+ const computedContentStyles = createStyle(getContentStyles({
25
+ width,
26
+ style,
27
+ background
28
+ }));
29
+ const computedContainerClasses = createClass(getContainerClasses({
30
+ uid: builderProps?.uid,
31
+ isScrollToTop,
32
+ cssClass: advanced?.cssClass,
33
+ isLiquid: false
34
+ }));
24
35
  return /*#__PURE__*/ jsxs(Fragment, {
25
36
  children: [
26
37
  !!preloadBgImage && /*#__PURE__*/ jsxs(Head, {
@@ -43,15 +54,14 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
43
54
  ]
44
55
  }),
45
56
  /*#__PURE__*/ jsx("div", {
46
- className: cls('sticky-wrapper', builderProps?.uid),
57
+ className: computedContainerClasses,
47
58
  id: builderProps?.uid,
48
59
  style: computedContainerStyles,
49
60
  children: /*#__PURE__*/ jsx("div", {
50
61
  ...builderAttrs,
51
62
  "data-id": builderProps?.uid,
52
63
  style: {
53
- ...filterStyles(style),
54
- ...getStyleBackgroundByDevice(background)
64
+ ...computedContentStyles
55
65
  },
56
66
  children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
57
67
  })