@gem-sdk/components 2.0.0-dev.503 → 2.0.0-dev.505

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 (23) hide show
  1. package/dist/cjs/carousel/root/hook/useCarousel.js +3 -11
  2. package/dist/cjs/dialog/components/Dialog.liquid.js +8 -8
  3. package/dist/cjs/form/components/contact/Contact.js +3 -0
  4. package/dist/cjs/form/components/contact/Contact.liquid.js +3 -1
  5. package/dist/cjs/form/components/contact/common/composeClass.js +12 -0
  6. package/dist/cjs/form/components/newsletter/Newsletter.js +3 -0
  7. package/dist/cjs/form/components/newsletter/Newsletter.liquid.js +3 -1
  8. package/dist/cjs/form/components/newsletter/common/composeClasses.js +1 -1
  9. package/dist/cjs/product/components/ProductBundle/setting/ProductBundleDiscount.js +26 -20
  10. package/dist/cjs/product/components/ProductBundle/setting/uiV2.js +156 -72
  11. package/dist/cjs/select/Select.js +1 -1
  12. package/dist/esm/carousel/root/hook/useCarousel.js +1 -9
  13. package/dist/esm/dialog/components/Dialog.liquid.js +8 -8
  14. package/dist/esm/form/components/contact/Contact.js +4 -1
  15. package/dist/esm/form/components/contact/Contact.liquid.js +4 -2
  16. package/dist/esm/form/components/contact/common/composeClass.js +10 -0
  17. package/dist/esm/form/components/newsletter/Newsletter.js +4 -1
  18. package/dist/esm/form/components/newsletter/Newsletter.liquid.js +3 -1
  19. package/dist/esm/form/components/newsletter/common/composeClasses.js +1 -1
  20. package/dist/esm/product/components/ProductBundle/setting/ProductBundleDiscount.js +26 -20
  21. package/dist/esm/product/components/ProductBundle/setting/uiV2.js +156 -72
  22. package/dist/esm/select/Select.js +1 -1
  23. package/package.json +3 -3
@@ -26,11 +26,6 @@ const useCarousel = (props, ref)=>{
26
26
  const isRunningAnimation = React.useRef(false);
27
27
  const previousIndex = React.useRef(moveToIdx ?? 0);
28
28
  let delayTimeout;
29
- const DEVICES = [
30
- 'desktop',
31
- 'tablet',
32
- 'mobile'
33
- ];
34
29
  const currentDevice = core.useCurrentDevice();
35
30
  const mode = core.useEditorMode();
36
31
  const { isFirstPreviewClicked } = useTrackPreviewPause.default(setting?.runPreview);
@@ -38,25 +33,23 @@ const useCarousel = (props, ref)=>{
38
33
  const getItemNumberFromOldData = React.useCallback(()=>{
39
34
  if (!setting?.slidesToShow) return null;
40
35
  const result = {};
41
- DEVICES.forEach((device)=>{
36
+ core.DEVICES.forEach((device)=>{
42
37
  const value = core.getResponsiveValueByScreen(setting?.slidesToShow, device);
43
38
  result[device] = value ? value === 'auto' ? 4 : Math.floor(value) : 0;
44
39
  });
45
40
  return result;
46
41
  }, [
47
- DEVICES,
48
42
  setting?.slidesToShow
49
43
  ]);
50
44
  const getSlideToShowFromOldData = React.useCallback(()=>{
51
45
  if (!setting?.slidesToShow) return null;
52
46
  const result = {};
53
- DEVICES.forEach((device)=>{
47
+ core.DEVICES.forEach((device)=>{
54
48
  const value = core.getResponsiveValueByScreen(setting?.slidesToShow, device);
55
49
  result[device] = value ? value === 'auto' ? 4 : value : 0;
56
50
  });
57
51
  return result;
58
52
  }, [
59
- DEVICES,
60
53
  setting?.slidesToShow
61
54
  ]);
62
55
  const slidesToShow = React.useMemo(()=>{
@@ -65,7 +58,7 @@ const useCarousel = (props, ref)=>{
65
58
  return oldData;
66
59
  }
67
60
  const result = {};
68
- DEVICES.forEach((device)=>{
61
+ core.DEVICES.forEach((device)=>{
69
62
  const enableSneakPeak = core.getResponsiveValueByScreen(setting?.sneakPeak, device);
70
63
  const offset = enableSneakPeak ? core.getResponsiveValueByScreen(setting?.sneakPeakType, device) === 'center' ? core.getResponsiveValueByScreen(setting?.sneakPeakOffsetCenter, device) ?? 0 : core.getResponsiveValueByScreen(setting?.sneakPeakOffsetForward, device) ?? 0 : 0;
71
64
  const rx = core.getResponsiveValueByScreen(setting?.sneakPeakType, device) === 'center' ? -2 : -1;
@@ -74,7 +67,6 @@ const useCarousel = (props, ref)=>{
74
67
  });
75
68
  return result;
76
69
  }, [
77
- DEVICES,
78
70
  getSlideToShowFromOldData,
79
71
  setting?.itemNumber,
80
72
  setting?.sneakPeak,
@@ -106,18 +106,18 @@ const Dialog = (props)=>{
106
106
  return core.RenderIf(core.isLocalEnv, `<script src="{{ 'gp-dialog.js' | asset_url }}" defer="defer"></script>`, `<script src="${core.baseAssetURL}/assets-v2/gp-dialog.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
107
107
  };
108
108
  return core.template /* liquid */ `
109
- <gp-dialog
109
+ <gp-dialog
110
110
  ${{
111
111
  ...attrs
112
112
  }}
113
- class="${helpers.getSettingPreloadData('gps-lazy')}"
114
- style="${wrapperDialogStyle}"
113
+ class="${helpers.getSettingPreloadData('gps-lazy')}"
114
+ style="${wrapperDialogStyle}"
115
115
  data-gp-setting='${JSON.stringify(stateData)}'>
116
- <dialog
116
+ <dialog
117
117
  aria-label="${name}"
118
118
  ${{
119
119
  ...containAttrs
120
- }}
120
+ }}
121
121
  class="${containClasses}"
122
122
  style="${containStyle}"
123
123
  >
@@ -126,7 +126,7 @@ const Dialog = (props)=>{
126
126
  <div
127
127
  ${{
128
128
  ...overlayAttrs
129
- }}
129
+ }}
130
130
  class="${overlayClasses}"
131
131
  style="${overlayStyle}"
132
132
  aria-hidden=true
@@ -145,7 +145,7 @@ const Dialog = (props)=>{
145
145
  <button
146
146
  ${{
147
147
  ...closeAttrs
148
- }}
148
+ }}
149
149
  type="button"
150
150
  tabindex="-1"
151
151
  class="${buttonContentClasses}"
@@ -155,7 +155,7 @@ const Dialog = (props)=>{
155
155
  ${iconSvg ?? `<svg viewBox="0 0 12 12" fill="currentColor" style={svgContentStyle}>
156
156
  <path d="M7.1,6l4.5,4.5l-1.1,1.1L6,7.1l-4.5,4.5l-1.1-1.1L4.9,6L0.5,1.5l1.1-1.1L6,4.9l4.5-4.5l1.1,1.1L7.1,6z"></path>
157
157
  </svg>`}
158
- </span>
158
+ </span>
159
159
  </button>
160
160
  <div
161
161
  aria-label="Dialog body"
@@ -9,6 +9,7 @@ var ChildrenDroppable = require('../../../grid/components/ChildrenDroppable.js')
9
9
  var composeStyles = require('./common/composeStyles.js');
10
10
  var system = require('@gem-sdk/system');
11
11
  var composeAttrs = require('../newsletter/common/composeAttrs.js');
12
+ var composeClass = require('./common/composeClass.js');
12
13
 
13
14
  const ContactForm = ({ children, styles, setting, style, builderAttrs, builderProps })=>{
14
15
  const containerStyle = system.createStyle(composeStyles.composeContainerStyles(setting, styles, style));
@@ -17,7 +18,9 @@ const ContactForm = ({ children, styles, setting, style, builderAttrs, builderPr
17
18
  uid: builderProps?.uid || ''
18
19
  }, setting)
19
20
  });
21
+ const classContainer = system.createClass(composeClass.composeContainerClasses());
20
22
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
23
+ className: classContainer,
21
24
  ...attrs,
22
25
  ...builderAttrs,
23
26
  style: containerStyle,
@@ -6,11 +6,13 @@ var core = require('@gem-sdk/core');
6
6
  var Newsletter_liquid = require('../newsletter/Newsletter.liquid.js');
7
7
  var composeStyles = require('./common/composeStyles.js');
8
8
  var system = require('@gem-sdk/system');
9
+ var composeClass = require('./common/composeClass.js');
9
10
 
10
11
  const ContactForm = ({ builderProps, setting, children, style, advanced, pageContext, styles })=>{
11
12
  const containerStyle = system.createStyle(composeStyles.composeContainerStyles(setting, styles));
13
+ const classContainer = system.createClass(composeClass.composeContainerClasses());
12
14
  return core.template`
13
- <div style="${containerStyle}">
15
+ <div class="${classContainer}" style="${containerStyle}">
14
16
  ${Newsletter_liquid.default({
15
17
  builderProps: builderProps,
16
18
  setting: setting,
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var common = require('../../../helpers/common.js');
4
+
5
+ const composeClasses = (styles)=>common.filterTruthy(styles);
6
+ const composeContainerClasses = ()=>{
7
+ return composeClasses({
8
+ 'gp-mx-auto': true
9
+ });
10
+ };
11
+
12
+ exports.composeContainerClasses = composeContainerClasses;
@@ -9,6 +9,7 @@ var ChildrenDroppable = require('../../../grid/components/ChildrenDroppable.js')
9
9
  var system = require('@gem-sdk/system');
10
10
  var composeStyles = require('../contact/common/composeStyles.js');
11
11
  var composeAttrs = require('./common/composeAttrs.js');
12
+ var composeClass = require('../contact/common/composeClass.js');
12
13
 
13
14
  const getAttr = ({ uid })=>{
14
15
  return {
@@ -22,7 +23,9 @@ const Newsletter = ({ children, setting, styles, style, builderAttrs, builderPro
22
23
  uid: builderProps?.uid || ''
23
24
  }, setting)
24
25
  });
26
+ const classContainer = system.createClass(composeClass.composeContainerClasses());
25
27
  return /*#__PURE__*/ jsxRuntime.jsx("div", {
28
+ className: classContainer,
26
29
  ...attrs,
27
30
  ...builderAttrs,
28
31
  style: containerStyle,
@@ -9,6 +9,7 @@ var system = require('@gem-sdk/system');
9
9
  var composeStyles = require('./common/composeStyles.js');
10
10
  var composeClasses = require('./common/composeClasses.js');
11
11
  var composeStyles$1 = require('../contact/common/composeStyles.js');
12
+ var composeClass = require('../contact/common/composeClass.js');
12
13
 
13
14
  const Newsletter = ({ builderProps, setting, children, style, formType, advanced, pageContext, styles })=>{
14
15
  const errorMessage = helpers.getDynamicSourceLocales({
@@ -38,8 +39,9 @@ const Newsletter = ({ builderProps, setting, children, style, formType, advanced
38
39
  const popoverAttrs = composeAttrs.composePopoverAttrs(builderProps);
39
40
  const generatedPopoverStyles = composeStyles.popoverStyles(builderProps);
40
41
  const containerStyle = system.createStyle(composeStyles$1.composeContainerStyles(setting, styles));
42
+ const classContainer = system.createClass(composeClass.composeContainerClasses());
41
43
  return core.template`
42
- <div style="${containerStyle}">
44
+ <div class="${classContainer}" style="${containerStyle}">
43
45
  <gp-form
44
46
  ${{
45
47
  ...containerAttrs
@@ -5,7 +5,7 @@ var common = require('../../../helpers/common.js');
5
5
  const composeClasses = (styles)=>common.filterTruthy(styles);
6
6
  const composeFormClasses = ()=>{
7
7
  return composeClasses({
8
- 'gp-form-message gp-hidden gp-top-[27px] gp-fixed gp-rounded gp-p-[16px] gp-text-[14px] gp-leading-normal': true
8
+ 'gp-form-message gp-hidden gp-top-[27px] gp-fixed gp-rounded gp-p-[16px] gp-text-[14px] gp-leading-normal gp-z-[100]': true
9
9
  });
10
10
  };
11
11
 
@@ -43,8 +43,18 @@ const config = {
43
43
  },
44
44
  {
45
45
  id: 'hideNoDiscountItem',
46
- type: 'toggle',
47
- default: false
46
+ default: false,
47
+ type: 'select',
48
+ options: [
49
+ {
50
+ label: 'All bundle',
51
+ value: false
52
+ },
53
+ {
54
+ label: 'Hide all no-discount bundles',
55
+ value: true
56
+ }
57
+ ]
48
58
  },
49
59
  {
50
60
  id: 'bundleItems',
@@ -58,8 +68,18 @@ const config = {
58
68
  },
59
69
  {
60
70
  id: 'useProductCompareAtPrice',
61
- type: 'toggle',
62
- default: false
71
+ default: false,
72
+ type: 'select',
73
+ options: [
74
+ {
75
+ label: 'Total product price',
76
+ value: false
77
+ },
78
+ {
79
+ label: 'Total product compare-at price',
80
+ value: true
81
+ }
82
+ ]
63
83
  },
64
84
  {
65
85
  id: 'selectItemDefault',
@@ -137,7 +157,7 @@ const config = {
137
157
  },
138
158
  {
139
159
  id: 'iconSize',
140
- type: 'input:number',
160
+ type: 'input:stepper',
141
161
  devices: {
142
162
  desktop: {
143
163
  default: 18
@@ -351,21 +371,7 @@ const config = {
351
371
  {
352
372
  id: 'boxShadowBundle',
353
373
  type: 'shadow-v2',
354
- hideOnState: {
355
- normal: true,
356
- hover: true,
357
- active: true
358
- },
359
- default: {
360
- normal: {
361
- type: 'shadow-1',
362
- distance: '4px',
363
- blur: '12px',
364
- spread: '0px',
365
- color: 'rgba(0, 0, 0, 0.20)',
366
- angle: 90
367
- }
368
- },
374
+ default: {},
369
375
  state: {
370
376
  normal: true,
371
377
  hover: true,
@@ -17,30 +17,6 @@ const ControlUIV2 = [
17
17
  }
18
18
  ]
19
19
  },
20
- {
21
- controls: [
22
- {
23
- label: {
24
- en: 'Use product compare-at price'
25
- },
26
- setting: {
27
- id: 'useProductCompareAtPrice'
28
- }
29
- }
30
- ]
31
- },
32
- {
33
- controls: [
34
- {
35
- label: {
36
- en: 'Hide no-discount items'
37
- },
38
- setting: {
39
- id: 'hideNoDiscountItem'
40
- }
41
- }
42
- ]
43
- },
44
20
  {
45
21
  label: {
46
22
  en: 'Item gap'
@@ -189,28 +165,57 @@ const ControlUIV2 = [
189
165
  }
190
166
  },
191
167
  {
192
- type: 'control',
193
168
  label: {
194
169
  en: 'Shadow'
195
170
  },
196
171
  setting: {
197
- id: 'hasBoxShadowBundle',
172
+ id: 'boxShadowBundle',
198
173
  state: 'normal'
199
- }
200
- },
201
- {
202
- type: 'group',
203
- conditionDisplay: 'hasBoxShadowBundle.normal == true',
204
- controls: [
205
- {
206
- type: 'control',
207
- layout: 'vertical',
208
- setting: {
209
- id: 'boxShadowBundle',
174
+ },
175
+ options: {
176
+ updateFields: [
177
+ {
178
+ field: 'normal.enable',
179
+ settingId: 'hasBoxShadowBundle',
210
180
  state: 'normal'
211
181
  }
182
+ ]
183
+ },
184
+ controlChangeTrigger: {
185
+ settings: [
186
+ {
187
+ condition: `boxShadowBundle.normal.enable === true`,
188
+ source: [
189
+ 'boxShadowBundle',
190
+ 'hasBoxShadowBundle'
191
+ ],
192
+ action: {
193
+ controlId: 'hasBoxShadowBundle',
194
+ groupType: 'style',
195
+ controlType: 'style',
196
+ state: 'normal',
197
+ newValue: true
198
+ }
199
+ },
200
+ {
201
+ condition: `boxShadowBundle.normal.enable === false`,
202
+ source: [
203
+ 'boxShadowBundle',
204
+ 'hasBoxShadowBundle'
205
+ ],
206
+ action: {
207
+ controlId: 'hasBoxShadowBundle',
208
+ groupType: 'style',
209
+ controlType: 'style',
210
+ state: 'normal',
211
+ newValue: false
212
+ }
213
+ }
214
+ ],
215
+ options: {
216
+ noRecordHistory: true
212
217
  }
213
- ]
218
+ }
214
219
  }
215
220
  ]
216
221
  },
@@ -261,28 +266,57 @@ const ControlUIV2 = [
261
266
  }
262
267
  },
263
268
  {
264
- type: 'control',
265
269
  label: {
266
270
  en: 'Shadow'
267
271
  },
268
272
  setting: {
269
- id: 'hasBoxShadowBundle',
273
+ id: 'boxShadowBundle',
270
274
  state: 'hover'
271
- }
272
- },
273
- {
274
- type: 'group',
275
- conditionDisplay: 'hasBoxShadowBundle.hover == true',
276
- controls: [
277
- {
278
- type: 'control',
279
- setting: {
280
- id: 'boxShadowBundle',
275
+ },
276
+ options: {
277
+ updateFields: [
278
+ {
279
+ field: 'hover.enable',
280
+ settingId: 'hasBoxShadowBundle',
281
281
  state: 'hover'
282
+ }
283
+ ]
284
+ },
285
+ controlChangeTrigger: {
286
+ settings: [
287
+ {
288
+ condition: `boxShadowBundle.hover.enable === true`,
289
+ source: [
290
+ 'boxShadowBundle',
291
+ 'hasBoxShadowBundle'
292
+ ],
293
+ action: {
294
+ controlId: 'hasBoxShadowBundle',
295
+ groupType: 'style',
296
+ controlType: 'style',
297
+ state: 'hover',
298
+ newValue: true
299
+ }
282
300
  },
283
- layout: 'vertical'
301
+ {
302
+ condition: `boxShadowBundle.hover.enable === false`,
303
+ source: [
304
+ 'boxShadowBundle',
305
+ 'hasBoxShadowBundle'
306
+ ],
307
+ action: {
308
+ controlId: 'hasBoxShadowBundle',
309
+ groupType: 'style',
310
+ controlType: 'style',
311
+ state: 'hover',
312
+ newValue: false
313
+ }
314
+ }
315
+ ],
316
+ options: {
317
+ noRecordHistory: true
284
318
  }
285
- ]
319
+ }
286
320
  }
287
321
  ]
288
322
  },
@@ -333,28 +367,57 @@ const ControlUIV2 = [
333
367
  }
334
368
  },
335
369
  {
336
- type: 'control',
337
370
  label: {
338
371
  en: 'Shadow'
339
372
  },
340
373
  setting: {
341
- id: 'hasBoxShadowBundle',
374
+ id: 'boxShadowBundle',
342
375
  state: 'active'
343
- }
344
- },
345
- {
346
- type: 'group',
347
- conditionDisplay: 'hasBoxShadowBundle.active == true',
348
- controls: [
349
- {
350
- type: 'control',
351
- setting: {
352
- id: 'boxShadowBundle',
376
+ },
377
+ options: {
378
+ updateFields: [
379
+ {
380
+ field: 'active.enable',
381
+ settingId: 'hasBoxShadowBundle',
353
382
  state: 'active'
383
+ }
384
+ ]
385
+ },
386
+ controlChangeTrigger: {
387
+ settings: [
388
+ {
389
+ condition: `boxShadowBundle.active.enable === true`,
390
+ source: [
391
+ 'boxShadowBundle',
392
+ 'hasBoxShadowBundle'
393
+ ],
394
+ action: {
395
+ controlId: 'hasBoxShadowBundle',
396
+ groupType: 'style',
397
+ controlType: 'style',
398
+ state: 'active',
399
+ newValue: true
400
+ }
354
401
  },
355
- layout: 'vertical'
402
+ {
403
+ condition: `boxShadowBundle.active.enable === false`,
404
+ source: [
405
+ 'boxShadowBundle',
406
+ 'hasBoxShadowBundle'
407
+ ],
408
+ action: {
409
+ controlId: 'hasBoxShadowBundle',
410
+ groupType: 'style',
411
+ controlType: 'style',
412
+ state: 'active',
413
+ newValue: false
414
+ }
415
+ }
416
+ ],
417
+ options: {
418
+ noRecordHistory: true
356
419
  }
357
- ]
420
+ }
358
421
  }
359
422
  ]
360
423
  }
@@ -689,21 +752,39 @@ const ControlUIV2 = [
689
752
  ]
690
753
  },
691
754
  {
755
+ label: {
756
+ en: 'Display condition'
757
+ },
692
758
  controls: [
693
759
  {
694
- type: 'control',
695
760
  label: {
696
- en: 'Display condition'
761
+ en: 'Default item'
697
762
  },
698
- options: {
699
- labelVariant: 'primary',
700
- toggleStyle: 'switch'
763
+ setting: {
764
+ id: 'hasPreSelectItem'
701
765
  }
702
766
  },
703
767
  {
704
768
  layout: 'vertical',
705
769
  setting: {
706
770
  id: 'selectItemDefault'
771
+ },
772
+ conditionDisplay: 'hasPreSelectItem == true'
773
+ },
774
+ {
775
+ label: {
776
+ en: 'Compare price'
777
+ },
778
+ setting: {
779
+ id: 'useProductCompareAtPrice'
780
+ }
781
+ },
782
+ {
783
+ label: {
784
+ en: 'Display item'
785
+ },
786
+ setting: {
787
+ id: 'hideNoDiscountItem'
707
788
  }
708
789
  }
709
790
  ]
@@ -714,11 +795,14 @@ const ControlUIV2 = [
714
795
  label: {
715
796
  en: 'Align'
716
797
  },
798
+ conditionEnable: '!(parseInt(size.width) >= 100 && size.width?.includes("%"))',
717
799
  setting: {
718
800
  id: 'align'
719
801
  },
720
802
  options: {
721
- labelVariant: 'primary'
803
+ labelVariant: 'primary',
804
+ fullWidth: true,
805
+ disableMessage: `Align is not supported when width is 100%`
722
806
  }
723
807
  }
724
808
  ]
@@ -18,7 +18,7 @@ const Select = ({ builderProps, setting = {}, className, style })=>{
18
18
  let totalOptions = [];
19
19
  try {
20
20
  totalOptions = JSON.parse(options);
21
- } catch (error) {
21
+ } catch (_error) {
22
22
  // console.log(error);
23
23
  }
24
24
  if (totalOptions.length) {
@@ -2,7 +2,7 @@ import { useKeenSlider } from '@gem-sdk/keen-slider/react';
2
2
  import { AutoPlayPlugin } from '../../components/plugins/AutoPlayPlugin.js';
3
3
  import { CAROUSEL_ANIMATION, DEFAULT_PLAY_SPEED, AnimationPlugin } from '../../components/plugins/AnimationPlugin.js';
4
4
  import { useState, useRef, useCallback, useMemo, useImperativeHandle, useEffect } from 'react';
5
- import { useCurrentDevice, useEditorMode, useInteraction, getResponsiveValueByScreen } from '@gem-sdk/core';
5
+ import { useCurrentDevice, useEditorMode, useInteraction, DEVICES, getResponsiveValueByScreen } from '@gem-sdk/core';
6
6
  import { MutationPlugin } from '../../components/plugins/MutationPlugin.js';
7
7
  import { FixSliderMoveBackwards } from '../../components/plugins/FixSliderMoveBackwards.js';
8
8
  import useTrackPreviewPause from '../../components/hooks/useTrackPreviewPause.js';
@@ -24,11 +24,6 @@ const useCarousel = (props, ref)=>{
24
24
  const isRunningAnimation = useRef(false);
25
25
  const previousIndex = useRef(moveToIdx ?? 0);
26
26
  let delayTimeout;
27
- const DEVICES = [
28
- 'desktop',
29
- 'tablet',
30
- 'mobile'
31
- ];
32
27
  const currentDevice = useCurrentDevice();
33
28
  const mode = useEditorMode();
34
29
  const { isFirstPreviewClicked } = useTrackPreviewPause(setting?.runPreview);
@@ -42,7 +37,6 @@ const useCarousel = (props, ref)=>{
42
37
  });
43
38
  return result;
44
39
  }, [
45
- DEVICES,
46
40
  setting?.slidesToShow
47
41
  ]);
48
42
  const getSlideToShowFromOldData = useCallback(()=>{
@@ -54,7 +48,6 @@ const useCarousel = (props, ref)=>{
54
48
  });
55
49
  return result;
56
50
  }, [
57
- DEVICES,
58
51
  setting?.slidesToShow
59
52
  ]);
60
53
  const slidesToShow = useMemo(()=>{
@@ -72,7 +65,6 @@ const useCarousel = (props, ref)=>{
72
65
  });
73
66
  return result;
74
67
  }, [
75
- DEVICES,
76
68
  getSlideToShowFromOldData,
77
69
  setting?.itemNumber,
78
70
  setting?.sneakPeak,
@@ -102,18 +102,18 @@ const Dialog = (props)=>{
102
102
  return RenderIf(isLocalEnv, `<script src="{{ 'gp-dialog.js' | asset_url }}" defer="defer"></script>`, `<script src="${baseAssetURL}/assets-v2/gp-dialog.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`);
103
103
  };
104
104
  return template /* liquid */ `
105
- <gp-dialog
105
+ <gp-dialog
106
106
  ${{
107
107
  ...attrs
108
108
  }}
109
- class="${getSettingPreloadData('gps-lazy')}"
110
- style="${wrapperDialogStyle}"
109
+ class="${getSettingPreloadData('gps-lazy')}"
110
+ style="${wrapperDialogStyle}"
111
111
  data-gp-setting='${JSON.stringify(stateData)}'>
112
- <dialog
112
+ <dialog
113
113
  aria-label="${name}"
114
114
  ${{
115
115
  ...containAttrs
116
- }}
116
+ }}
117
117
  class="${containClasses}"
118
118
  style="${containStyle}"
119
119
  >
@@ -122,7 +122,7 @@ const Dialog = (props)=>{
122
122
  <div
123
123
  ${{
124
124
  ...overlayAttrs
125
- }}
125
+ }}
126
126
  class="${overlayClasses}"
127
127
  style="${overlayStyle}"
128
128
  aria-hidden=true
@@ -141,7 +141,7 @@ const Dialog = (props)=>{
141
141
  <button
142
142
  ${{
143
143
  ...closeAttrs
144
- }}
144
+ }}
145
145
  type="button"
146
146
  tabindex="-1"
147
147
  class="${buttonContentClasses}"
@@ -151,7 +151,7 @@ const Dialog = (props)=>{
151
151
  ${iconSvg ?? `<svg viewBox="0 0 12 12" fill="currentColor" style={svgContentStyle}>
152
152
  <path d="M7.1,6l4.5,4.5l-1.1,1.1L6,7.1l-4.5,4.5l-1.1-1.1L4.9,6L0.5,1.5l1.1-1.1L6,4.9l4.5-4.5l1.1,1.1L7.1,6z"></path>
153
153
  </svg>`}
154
- </span>
154
+ </span>
155
155
  </button>
156
156
  <div
157
157
  aria-label="Dialog body"
@@ -3,8 +3,9 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { isEmptyChildren } from '@gem-sdk/core';
4
4
  import ChildrenDroppable from '../../../grid/components/ChildrenDroppable.js';
5
5
  import { composeContainerStyles } from './common/composeStyles.js';
6
- import { createStyle, createAttr } from '@gem-sdk/system';
6
+ import { createStyle, createAttr, createClass } from '@gem-sdk/system';
7
7
  import { composeContainerAttrs } from '../newsletter/common/composeAttrs.js';
8
+ import { composeContainerClasses } from './common/composeClass.js';
8
9
 
9
10
  const ContactForm = ({ children, styles, setting, style, builderAttrs, builderProps })=>{
10
11
  const containerStyle = createStyle(composeContainerStyles(setting, styles, style));
@@ -13,7 +14,9 @@ const ContactForm = ({ children, styles, setting, style, builderAttrs, builderPr
13
14
  uid: builderProps?.uid || ''
14
15
  }, setting)
15
16
  });
17
+ const classContainer = createClass(composeContainerClasses());
16
18
  return /*#__PURE__*/ jsx("div", {
19
+ className: classContainer,
17
20
  ...attrs,
18
21
  ...builderAttrs,
19
22
  style: containerStyle,
@@ -1,12 +1,14 @@
1
1
  import { template } from '@gem-sdk/core';
2
2
  import Newsletter from '../newsletter/Newsletter.liquid.js';
3
3
  import { composeContainerStyles } from './common/composeStyles.js';
4
- import { createStyle } from '@gem-sdk/system';
4
+ import { createStyle, createClass } from '@gem-sdk/system';
5
+ import { composeContainerClasses } from './common/composeClass.js';
5
6
 
6
7
  const ContactForm = ({ builderProps, setting, children, style, advanced, pageContext, styles })=>{
7
8
  const containerStyle = createStyle(composeContainerStyles(setting, styles));
9
+ const classContainer = createClass(composeContainerClasses());
8
10
  return template`
9
- <div style="${containerStyle}">
11
+ <div class="${classContainer}" style="${containerStyle}">
10
12
  ${Newsletter({
11
13
  builderProps: builderProps,
12
14
  setting: setting,
@@ -0,0 +1,10 @@
1
+ import { filterTruthy } from '../../../helpers/common.js';
2
+
3
+ const composeClasses = (styles)=>filterTruthy(styles);
4
+ const composeContainerClasses = ()=>{
5
+ return composeClasses({
6
+ 'gp-mx-auto': true
7
+ });
8
+ };
9
+
10
+ export { composeContainerClasses };
@@ -2,9 +2,10 @@
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { isEmptyChildren } from '@gem-sdk/core';
4
4
  import ChildrenDroppable from '../../../grid/components/ChildrenDroppable.js';
5
- import { createStyle, createAttr } from '@gem-sdk/system';
5
+ import { createStyle, createAttr, createClass } from '@gem-sdk/system';
6
6
  import { composeContainerStyles } from '../contact/common/composeStyles.js';
7
7
  import { composeContainerAttrs } from './common/composeAttrs.js';
8
+ import { composeContainerClasses } from '../contact/common/composeClass.js';
8
9
 
9
10
  const getAttr = ({ uid })=>{
10
11
  return {
@@ -18,7 +19,9 @@ const Newsletter = ({ children, setting, styles, style, builderAttrs, builderPro
18
19
  uid: builderProps?.uid || ''
19
20
  }, setting)
20
21
  });
22
+ const classContainer = createClass(composeContainerClasses());
21
23
  return /*#__PURE__*/ jsx("div", {
24
+ className: classContainer,
22
25
  ...attrs,
23
26
  ...builderAttrs,
24
27
  style: containerStyle,
@@ -5,6 +5,7 @@ import { createStyle, createClass } from '@gem-sdk/system';
5
5
  import { composeContainerStylesForm, composeFormStyles, popoverStyles } from './common/composeStyles.js';
6
6
  import { composeFormClasses } from './common/composeClasses.js';
7
7
  import { composeContainerStyles } from '../contact/common/composeStyles.js';
8
+ import { composeContainerClasses } from '../contact/common/composeClass.js';
8
9
 
9
10
  const Newsletter = ({ builderProps, setting, children, style, formType, advanced, pageContext, styles })=>{
10
11
  const errorMessage = getDynamicSourceLocales({
@@ -34,8 +35,9 @@ const Newsletter = ({ builderProps, setting, children, style, formType, advanced
34
35
  const popoverAttrs = composePopoverAttrs(builderProps);
35
36
  const generatedPopoverStyles = popoverStyles(builderProps);
36
37
  const containerStyle = createStyle(composeContainerStyles(setting, styles));
38
+ const classContainer = createClass(composeContainerClasses());
37
39
  return template`
38
- <div style="${containerStyle}">
40
+ <div class="${classContainer}" style="${containerStyle}">
39
41
  <gp-form
40
42
  ${{
41
43
  ...containerAttrs
@@ -3,7 +3,7 @@ import { filterTruthy } from '../../../helpers/common.js';
3
3
  const composeClasses = (styles)=>filterTruthy(styles);
4
4
  const composeFormClasses = ()=>{
5
5
  return composeClasses({
6
- 'gp-form-message gp-hidden gp-top-[27px] gp-fixed gp-rounded gp-p-[16px] gp-text-[14px] gp-leading-normal': true
6
+ 'gp-form-message gp-hidden gp-top-[27px] gp-fixed gp-rounded gp-p-[16px] gp-text-[14px] gp-leading-normal gp-z-[100]': true
7
7
  });
8
8
  };
9
9
 
@@ -39,8 +39,18 @@ const config = {
39
39
  },
40
40
  {
41
41
  id: 'hideNoDiscountItem',
42
- type: 'toggle',
43
- default: false
42
+ default: false,
43
+ type: 'select',
44
+ options: [
45
+ {
46
+ label: 'All bundle',
47
+ value: false
48
+ },
49
+ {
50
+ label: 'Hide all no-discount bundles',
51
+ value: true
52
+ }
53
+ ]
44
54
  },
45
55
  {
46
56
  id: 'bundleItems',
@@ -54,8 +64,18 @@ const config = {
54
64
  },
55
65
  {
56
66
  id: 'useProductCompareAtPrice',
57
- type: 'toggle',
58
- default: false
67
+ default: false,
68
+ type: 'select',
69
+ options: [
70
+ {
71
+ label: 'Total product price',
72
+ value: false
73
+ },
74
+ {
75
+ label: 'Total product compare-at price',
76
+ value: true
77
+ }
78
+ ]
59
79
  },
60
80
  {
61
81
  id: 'selectItemDefault',
@@ -133,7 +153,7 @@ const config = {
133
153
  },
134
154
  {
135
155
  id: 'iconSize',
136
- type: 'input:number',
156
+ type: 'input:stepper',
137
157
  devices: {
138
158
  desktop: {
139
159
  default: 18
@@ -347,21 +367,7 @@ const config = {
347
367
  {
348
368
  id: 'boxShadowBundle',
349
369
  type: 'shadow-v2',
350
- hideOnState: {
351
- normal: true,
352
- hover: true,
353
- active: true
354
- },
355
- default: {
356
- normal: {
357
- type: 'shadow-1',
358
- distance: '4px',
359
- blur: '12px',
360
- spread: '0px',
361
- color: 'rgba(0, 0, 0, 0.20)',
362
- angle: 90
363
- }
364
- },
370
+ default: {},
365
371
  state: {
366
372
  normal: true,
367
373
  hover: true,
@@ -13,30 +13,6 @@ const ControlUIV2 = [
13
13
  }
14
14
  ]
15
15
  },
16
- {
17
- controls: [
18
- {
19
- label: {
20
- en: 'Use product compare-at price'
21
- },
22
- setting: {
23
- id: 'useProductCompareAtPrice'
24
- }
25
- }
26
- ]
27
- },
28
- {
29
- controls: [
30
- {
31
- label: {
32
- en: 'Hide no-discount items'
33
- },
34
- setting: {
35
- id: 'hideNoDiscountItem'
36
- }
37
- }
38
- ]
39
- },
40
16
  {
41
17
  label: {
42
18
  en: 'Item gap'
@@ -185,28 +161,57 @@ const ControlUIV2 = [
185
161
  }
186
162
  },
187
163
  {
188
- type: 'control',
189
164
  label: {
190
165
  en: 'Shadow'
191
166
  },
192
167
  setting: {
193
- id: 'hasBoxShadowBundle',
168
+ id: 'boxShadowBundle',
194
169
  state: 'normal'
195
- }
196
- },
197
- {
198
- type: 'group',
199
- conditionDisplay: 'hasBoxShadowBundle.normal == true',
200
- controls: [
201
- {
202
- type: 'control',
203
- layout: 'vertical',
204
- setting: {
205
- id: 'boxShadowBundle',
170
+ },
171
+ options: {
172
+ updateFields: [
173
+ {
174
+ field: 'normal.enable',
175
+ settingId: 'hasBoxShadowBundle',
206
176
  state: 'normal'
207
177
  }
178
+ ]
179
+ },
180
+ controlChangeTrigger: {
181
+ settings: [
182
+ {
183
+ condition: `boxShadowBundle.normal.enable === true`,
184
+ source: [
185
+ 'boxShadowBundle',
186
+ 'hasBoxShadowBundle'
187
+ ],
188
+ action: {
189
+ controlId: 'hasBoxShadowBundle',
190
+ groupType: 'style',
191
+ controlType: 'style',
192
+ state: 'normal',
193
+ newValue: true
194
+ }
195
+ },
196
+ {
197
+ condition: `boxShadowBundle.normal.enable === false`,
198
+ source: [
199
+ 'boxShadowBundle',
200
+ 'hasBoxShadowBundle'
201
+ ],
202
+ action: {
203
+ controlId: 'hasBoxShadowBundle',
204
+ groupType: 'style',
205
+ controlType: 'style',
206
+ state: 'normal',
207
+ newValue: false
208
+ }
209
+ }
210
+ ],
211
+ options: {
212
+ noRecordHistory: true
208
213
  }
209
- ]
214
+ }
210
215
  }
211
216
  ]
212
217
  },
@@ -257,28 +262,57 @@ const ControlUIV2 = [
257
262
  }
258
263
  },
259
264
  {
260
- type: 'control',
261
265
  label: {
262
266
  en: 'Shadow'
263
267
  },
264
268
  setting: {
265
- id: 'hasBoxShadowBundle',
269
+ id: 'boxShadowBundle',
266
270
  state: 'hover'
267
- }
268
- },
269
- {
270
- type: 'group',
271
- conditionDisplay: 'hasBoxShadowBundle.hover == true',
272
- controls: [
273
- {
274
- type: 'control',
275
- setting: {
276
- id: 'boxShadowBundle',
271
+ },
272
+ options: {
273
+ updateFields: [
274
+ {
275
+ field: 'hover.enable',
276
+ settingId: 'hasBoxShadowBundle',
277
277
  state: 'hover'
278
+ }
279
+ ]
280
+ },
281
+ controlChangeTrigger: {
282
+ settings: [
283
+ {
284
+ condition: `boxShadowBundle.hover.enable === true`,
285
+ source: [
286
+ 'boxShadowBundle',
287
+ 'hasBoxShadowBundle'
288
+ ],
289
+ action: {
290
+ controlId: 'hasBoxShadowBundle',
291
+ groupType: 'style',
292
+ controlType: 'style',
293
+ state: 'hover',
294
+ newValue: true
295
+ }
278
296
  },
279
- layout: 'vertical'
297
+ {
298
+ condition: `boxShadowBundle.hover.enable === false`,
299
+ source: [
300
+ 'boxShadowBundle',
301
+ 'hasBoxShadowBundle'
302
+ ],
303
+ action: {
304
+ controlId: 'hasBoxShadowBundle',
305
+ groupType: 'style',
306
+ controlType: 'style',
307
+ state: 'hover',
308
+ newValue: false
309
+ }
310
+ }
311
+ ],
312
+ options: {
313
+ noRecordHistory: true
280
314
  }
281
- ]
315
+ }
282
316
  }
283
317
  ]
284
318
  },
@@ -329,28 +363,57 @@ const ControlUIV2 = [
329
363
  }
330
364
  },
331
365
  {
332
- type: 'control',
333
366
  label: {
334
367
  en: 'Shadow'
335
368
  },
336
369
  setting: {
337
- id: 'hasBoxShadowBundle',
370
+ id: 'boxShadowBundle',
338
371
  state: 'active'
339
- }
340
- },
341
- {
342
- type: 'group',
343
- conditionDisplay: 'hasBoxShadowBundle.active == true',
344
- controls: [
345
- {
346
- type: 'control',
347
- setting: {
348
- id: 'boxShadowBundle',
372
+ },
373
+ options: {
374
+ updateFields: [
375
+ {
376
+ field: 'active.enable',
377
+ settingId: 'hasBoxShadowBundle',
349
378
  state: 'active'
379
+ }
380
+ ]
381
+ },
382
+ controlChangeTrigger: {
383
+ settings: [
384
+ {
385
+ condition: `boxShadowBundle.active.enable === true`,
386
+ source: [
387
+ 'boxShadowBundle',
388
+ 'hasBoxShadowBundle'
389
+ ],
390
+ action: {
391
+ controlId: 'hasBoxShadowBundle',
392
+ groupType: 'style',
393
+ controlType: 'style',
394
+ state: 'active',
395
+ newValue: true
396
+ }
350
397
  },
351
- layout: 'vertical'
398
+ {
399
+ condition: `boxShadowBundle.active.enable === false`,
400
+ source: [
401
+ 'boxShadowBundle',
402
+ 'hasBoxShadowBundle'
403
+ ],
404
+ action: {
405
+ controlId: 'hasBoxShadowBundle',
406
+ groupType: 'style',
407
+ controlType: 'style',
408
+ state: 'active',
409
+ newValue: false
410
+ }
411
+ }
412
+ ],
413
+ options: {
414
+ noRecordHistory: true
352
415
  }
353
- ]
416
+ }
354
417
  }
355
418
  ]
356
419
  }
@@ -685,21 +748,39 @@ const ControlUIV2 = [
685
748
  ]
686
749
  },
687
750
  {
751
+ label: {
752
+ en: 'Display condition'
753
+ },
688
754
  controls: [
689
755
  {
690
- type: 'control',
691
756
  label: {
692
- en: 'Display condition'
757
+ en: 'Default item'
693
758
  },
694
- options: {
695
- labelVariant: 'primary',
696
- toggleStyle: 'switch'
759
+ setting: {
760
+ id: 'hasPreSelectItem'
697
761
  }
698
762
  },
699
763
  {
700
764
  layout: 'vertical',
701
765
  setting: {
702
766
  id: 'selectItemDefault'
767
+ },
768
+ conditionDisplay: 'hasPreSelectItem == true'
769
+ },
770
+ {
771
+ label: {
772
+ en: 'Compare price'
773
+ },
774
+ setting: {
775
+ id: 'useProductCompareAtPrice'
776
+ }
777
+ },
778
+ {
779
+ label: {
780
+ en: 'Display item'
781
+ },
782
+ setting: {
783
+ id: 'hideNoDiscountItem'
703
784
  }
704
785
  }
705
786
  ]
@@ -710,11 +791,14 @@ const ControlUIV2 = [
710
791
  label: {
711
792
  en: 'Align'
712
793
  },
794
+ conditionEnable: '!(parseInt(size.width) >= 100 && size.width?.includes("%"))',
713
795
  setting: {
714
796
  id: 'align'
715
797
  },
716
798
  options: {
717
- labelVariant: 'primary'
799
+ labelVariant: 'primary',
800
+ fullWidth: true,
801
+ disableMessage: `Align is not supported when width is 100%`
718
802
  }
719
803
  }
720
804
  ]
@@ -14,7 +14,7 @@ const Select = ({ builderProps, setting = {}, className, style })=>{
14
14
  let totalOptions = [];
15
15
  try {
16
16
  totalOptions = JSON.parse(options);
17
- } catch (error) {
17
+ } catch (_error) {
18
18
  // console.log(error);
19
19
  }
20
20
  if (totalOptions.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.503",
3
+ "version": "2.0.0-dev.505",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -23,9 +23,9 @@
23
23
  "update-img-src-3rd": "node ./scripts/update-img-src-3rd.js"
24
24
  },
25
25
  "devDependencies": {
26
- "@gem-sdk/core": "2.0.0-dev.503",
26
+ "@gem-sdk/core": "2.0.0-dev.504",
27
27
  "@gem-sdk/styles": "2.0.0-dev.501",
28
- "@gem-sdk/system": "2.0.0-dev.464",
28
+ "@gem-sdk/system": "2.0.0-dev.504",
29
29
  "@types/react-transition-group": "^4.4.5"
30
30
  },
31
31
  "dependencies": {