@gem-sdk/components 2.0.0-dev.473 → 2.0.0-dev.475

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 (38) hide show
  1. package/dist/cjs/carousel/setting/configs/settingV2.js +732 -728
  2. package/dist/cjs/carousel/setting/configs/uiV2.js +304 -298
  3. package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +1 -10
  4. package/dist/cjs/product/components/ProductList/ProductListGridLayout.js +11 -6
  5. package/dist/cjs/product/components/ProductList/ProductListItem.liquid.js +3 -0
  6. package/dist/cjs/product/components/ProductList/common/getStyle.js +33 -1
  7. package/dist/cjs/product/components/ProductList/common/index.js +2 -25
  8. package/dist/cjs/product/components/ProductProperties/ProductProperties.js +16 -0
  9. package/dist/cjs/product/components/ProductVariants/common/base/classes.js +3 -3
  10. package/dist/cjs/product/components/ProductVariants/components/base/base.liquid.js +4 -1
  11. package/dist/cjs/product/components/ProductVariants/components/variants/index.liquid.js +4 -1
  12. package/dist/cjs/product/components/ProductVariants/index.liquid.js +1 -1
  13. package/dist/cjs/product/setting/ProductList.js +1 -3
  14. package/dist/cjs/product/setting/product-list/configs/settingsV2.js +17 -203
  15. package/dist/cjs/product/setting/product-list/configs/uiV2.js +100 -137
  16. package/dist/cjs/product/setting/product-variant/configs/uiV2.js +17 -0
  17. package/dist/cjs/text/components/Text.liquid.js +4 -1
  18. package/dist/esm/carousel/setting/configs/settingV2.js +731 -729
  19. package/dist/esm/carousel/setting/configs/uiV2.js +302 -299
  20. package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +3 -12
  21. package/dist/esm/product/components/ProductList/ProductListGridLayout.js +11 -6
  22. package/dist/esm/product/components/ProductList/ProductListItem.liquid.js +3 -0
  23. package/dist/esm/product/components/ProductList/common/getStyle.js +34 -2
  24. package/dist/esm/product/components/ProductList/common/index.js +2 -25
  25. package/dist/esm/product/components/ProductProperties/ProductProperties.js +16 -0
  26. package/dist/esm/product/components/ProductVariants/common/base/classes.js +3 -3
  27. package/dist/esm/product/components/ProductVariants/components/base/base.liquid.js +4 -1
  28. package/dist/esm/product/components/ProductVariants/components/variants/index.liquid.js +4 -1
  29. package/dist/esm/product/components/ProductVariants/index.liquid.js +1 -1
  30. package/dist/esm/product/setting/ProductList.js +1 -3
  31. package/dist/esm/product/setting/product-list/configs/settingsV2.js +17 -203
  32. package/dist/esm/product/setting/product-list/configs/uiV2.js +100 -137
  33. package/dist/esm/product/setting/product-variant/configs/uiV2.js +17 -0
  34. package/dist/esm/text/components/Text.liquid.js +4 -1
  35. package/dist/types/index.d.ts +3 -6
  36. package/package.json +2 -2
  37. package/dist/cjs/product/setting/product-list/configs/settings.js +0 -496
  38. package/dist/esm/product/setting/product-list/configs/settings.js +0 -494
@@ -1,10 +1,12 @@
1
- import { makeStyleResponsive, getStyleBackgroundByDevice, getResponsiveValueByScreen } from '@gem-sdk/core';
1
+ import { makeGlobalSize, makeStyleResponsive, getStyleBackgroundByDevice, getResponsiveValueByScreen, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleShadow, getGradientBgrStyleByDevice } from '@gem-sdk/core';
2
2
  import { createStyle } from '@gem-sdk/system';
3
3
  import { getInitialWidthForCarouselItem } from '../../../../carousel/components/common/carousel.js';
4
4
  import { createStyleObject } from '../../../../grid/row/commons/helpers.js';
5
5
 
6
6
  const getStyle = (props)=>{
7
7
  const { setting, styles, style } = props;
8
+ const { background } = setting ?? {};
9
+ const itemPadding = makeGlobalSize(styles?.itemPadding);
8
10
  const productListStyle = createStyle({
9
11
  ...style,
10
12
  ...makeStyleResponsive('bgc', styles?.backgroundColor),
@@ -33,12 +35,42 @@ const getStyle = (props)=>{
33
35
  slidesToShow: setting?.slidesToShow
34
36
  })
35
37
  });
38
+ const getProductItemStyle = {
39
+ ...itemPadding && itemPadding.padding,
40
+ ...makeStyle({
41
+ bs: styles?.borderContent?.border,
42
+ bw: styles?.borderContent?.width,
43
+ bc: getSingleColorVariable(styles?.borderContent?.color)
44
+ }),
45
+ ...getRadiusStyleActiveState({
46
+ ...styles?.roundedContent,
47
+ active: {
48
+ ...styles?.roundedContent || {},
49
+ radiusType: 'custom'
50
+ }
51
+ }),
52
+ ...getStyleShadow({
53
+ value: styles?.carouselShadow,
54
+ styleAppliedFor: 'box-shadow',
55
+ isEnableShadow: styles?.hasActiveShadow
56
+ }),
57
+ ...getStyleBackgroundByDevice(background),
58
+ ...getGradientBgrStyleByDevice(background, {
59
+ desktop: true,
60
+ tablet: true,
61
+ mobile: true
62
+ })
63
+ };
64
+ const productItemStyle = createStyle({
65
+ ...getProductItemStyle
66
+ });
36
67
  return {
37
68
  gridLayoutStyle,
38
69
  carouselItemStyle,
39
70
  productListStyle,
40
71
  productListWrapStyle,
41
- productListContentStyle
72
+ productListContentStyle,
73
+ productItemStyle
42
74
  };
43
75
  };
44
76
 
@@ -11,39 +11,16 @@ const getData = (props)=>{
11
11
  const navigationStyle = getUpdatedArrowDisplay(setting?.arrow, setting?.controlOverContent);
12
12
  const dotStyle = getUpdatedDotStyle(setting?.dot, setting?.dotStyle);
13
13
  const carouselConfigSetting = {
14
- dotStyle,
15
- navigationStyle,
16
- loop: setting?.loop,
17
- slidesToShow: setting?.slidesToShow,
18
- dot: setting?.dot,
19
14
  dotSize: {
20
15
  desktop: 12
21
16
  },
22
17
  dotGapToCarousel: {
23
18
  desktop: 16
24
19
  },
25
- arrowCustom: setting?.arrowCustom,
26
- controlOverContent: setting?.controlOverContent,
27
- enableDrag: {
28
- desktop: setting?.dragToScroll,
29
- tablet: setting?.dragToScroll,
30
- mobile: setting?.dragToScroll
31
- },
32
- speed: setting?.speed,
33
- dotActiveColor: setting?.dotActiveColor,
34
- dotColor: setting?.dotColor,
35
- autoplay: setting?.autoplay,
36
- pauseOnHover: setting?.pauseOnHover,
37
- autoplayTimeout: setting?.autoplayTimeout,
38
- arrowCustomColor: setting?.arrowCustomColor,
39
- arrowButtonSize: {
40
- desktop: {
41
- width: '24px',
42
- height: '24px'
43
- }
44
- }
20
+ ...setting
45
21
  };
46
22
  const carouselConfigStyle = {
23
+ ...styles,
47
24
  sizeSetting: {
48
25
  ...getSizeSetting({
49
26
  adaptiveHeight: styles?.adaptiveHeight,
@@ -148,6 +148,19 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
148
148
  required,
149
149
  requiredMessage
150
150
  ]);
151
+ const checkRequireCheckbox = useCallback((value)=>{
152
+ if (!required) {
153
+ return;
154
+ }
155
+ if (!value || value.length <= 0) {
156
+ return {
157
+ message: requiredMessage
158
+ };
159
+ }
160
+ }, [
161
+ required,
162
+ requiredMessage
163
+ ]);
151
164
  const handleChange = (e)=>{
152
165
  setIsDirty(true);
153
166
  if (type === 'checkbox') {
@@ -187,6 +200,7 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
187
200
  case 'email':
188
201
  return checkEmail(value);
189
202
  case 'checkbox':
203
+ return checkRequireCheckbox(checkboxValue);
190
204
  case 'radio':
191
205
  case 'dropdown':
192
206
  return checkRequire(value);
@@ -208,6 +222,8 @@ const ProductProperties = ({ setting, styles, builderProps })=>{
208
222
  isDirty,
209
223
  type,
210
224
  checkEmail,
225
+ checkRequireCheckbox,
226
+ checkboxValue,
211
227
  checkRequire,
212
228
  checkInput
213
229
  ]);
@@ -10,7 +10,7 @@ const getWrapperClass = (props)=>{
10
10
  },
11
11
  [appendTypoClass]: true,
12
12
  'gp-p-[4px]': isColorType,
13
- 'before:gp-absolute before:gp-top-[50%] before:gp-z-1 before:gp-block before:gp-w-full before:-gp-rotate-45 before:gp-border-t before:gp-border-[#A1A1A1] before:gp-bg-[#333] before:gp-content-[""]': soldOutMarkLine && !available && !isColorType
13
+ 'before:gp-absolute before:gp-top-[50%] before:gp-z-1 before:gp-block before:gp-w-full before:-gp-rotate-45 before:gp-border-t before:gp-border-[#A1A1A1] before:gp-bg-[#333]': soldOutMarkLine && !available && !isColorType
14
14
  });
15
15
  const staticClasses = `gp-relative gp-flex gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden gp-w-full gp-h-full data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed
16
16
  data-[hidden='false']:gp-flex`;
@@ -37,9 +37,9 @@ const getTextClass = ({ optionTypo, optionTypography, isColorType, isUploadImage
37
37
  };
38
38
  const getColorClass = ({ soldOutMarkLine, available })=>{
39
39
  const dynamicClasses = cls({
40
- 'before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border before:gp-content-[""]': soldOutMarkLine && !available
40
+ 'before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border': soldOutMarkLine && !available
41
41
  });
42
- const staticClasses = `color gp-relative gp-h-full gp-w-full gp-overflow-hidden gp-min-w-fit gp-flex gp-color-circle before:gp-absolute before:gp-top-[50%] before:gp-block before:gp-w-full before:gp--rotate-45 before:gp-border before:gp-content-[""]`;
42
+ const staticClasses = `color gp-relative gp-h-full gp-w-full gp-overflow-hidden gp-min-w-fit gp-flex gp-color-circle`;
43
43
  const combinedClasses = `${staticClasses} ${dynamicClasses}`.trim();
44
44
  return composeClasses(combinedClasses);
45
45
  };
@@ -75,7 +75,10 @@ const BaseVariant = (props)=>{
75
75
  return renderText();
76
76
  }
77
77
  };
78
- const wrapperClasses = createClass(getWrapperClass(props));
78
+ const wrapperClasses = createClass(getWrapperClass({
79
+ ...props,
80
+ available: true
81
+ }));
79
82
  const wrapperAttrs = createAttr(getWrapperAttr(props, 'Liquid'));
80
83
  const wrapperActiveStyle = createStyle(getWrapperStyleActive(props));
81
84
  const wrapperNormalAndHoverStyle = createStyle(getWrapperStyleNormalAndHover(props));
@@ -90,7 +90,10 @@ const VariantItem = (props)=>{
90
90
  })}
91
91
  `;
92
92
  };
93
- const labelClass = createClass(getVariantItemLabelClass(props));
93
+ const labelClass = createClass(getVariantItemLabelClass({
94
+ ...props,
95
+ available: true
96
+ }));
94
97
  const tooltipClass = createClass(getTooltipClass());
95
98
  const tooltipSvgClass = createClass(getTooltipSvgClass());
96
99
  const variantOptionClass = createClass(getVariantOptionClass());
@@ -162,7 +162,7 @@ const ProductVariants = (props)=>{
162
162
  ${LiquidFor(`item in items`, `
163
163
  ${Liquid(`{%- assign itemPreset = item | split:'($1)' -%}`)}
164
164
  ${LiquidIf(`itemPreset[0] == optionName`, Liquid(`{%- assign type = itemPreset[1] -%}`))}
165
- ${LiquidIf(`itemPreset[0] == base`, Liquid(`{%- assign type = itemPreset[1] -%}`))}
165
+ ${LiquidIf(`itemPreset[0] == "base"`, Liquid(`{%- assign type = itemPreset[1] -%}`))}
166
166
  `)}
167
167
  ${Liquid(`{%- assign optionRendered = true -%}`)}
168
168
  ${LiquidFor(`value in values`, VariantItem({
@@ -1,6 +1,5 @@
1
1
  import { ProductListPreset } from './product-list/configs/presets.js';
2
2
  import { SettingUIV1 } from './product-list/configs/uiV1.js';
3
- import { ProductListSettings } from './product-list/configs/settings.js';
4
3
  import { ProductListSettingsV2 } from './product-list/configs/settingsV2.js';
5
4
  import { SettingUIV2 } from './product-list/configs/uiV2.js';
6
5
 
@@ -15,8 +14,7 @@ const config = {
15
14
  <path d="M7.96712 33.8834C7.59893 33.8834 7.30046 33.5849 7.30046 33.2168V32.1358C7.30046 31.7676 7.59893 31.4692 7.96712 31.4692H36.3481C36.7163 31.4692 37.0147 31.7676 37.0147 32.1358V33.2168C37.0147 33.5849 36.7163 33.8834 36.3481 33.8834H7.96712Z" fill="currentColor"/>
16
15
  </svg>
17
16
  `,
18
- settings: ProductListSettings,
19
- settingsV2: ProductListSettingsV2,
17
+ settings: ProductListSettingsV2,
20
18
  ui: SettingUIV1,
21
19
  uiV2: SettingUIV2,
22
20
  presets: ProductListPreset,
@@ -1,3 +1,5 @@
1
+ import { CarouselSettingsV2Setting, CarouselSettingsV2Style } from '../../../../carousel/setting/configs/settingV2.js';
2
+
1
3
  const ProductListSettingsV2 = [
2
4
  {
3
5
  id: 'setting',
@@ -46,186 +48,6 @@ const ProductListSettingsV2 = [
46
48
  default: 4,
47
49
  ignoreMax: true
48
50
  },
49
- {
50
- id: 'dot',
51
- label: 'Dot',
52
- type: 'toggle',
53
- devices: {
54
- desktop: {
55
- default: false
56
- }
57
- }
58
- },
59
- {
60
- id: 'dotStyle',
61
- label: 'Dot style',
62
- type: 'option:illustration',
63
- iconViewBox: '0 0 77 48',
64
- enableItemBackground: true,
65
- enableTooltip: true,
66
- options: [
67
- {
68
- label: 'Inside',
69
- value: 'inside',
70
- type: 'carousel-dot',
71
- svgName: 'gp-carousel-dot-inside'
72
- },
73
- {
74
- label: 'Outside',
75
- value: 'outside',
76
- type: 'carousel-dot',
77
- svgName: 'gp-carousel-dot-outside'
78
- }
79
- ],
80
- devices: {
81
- desktop: {
82
- default: 'inside'
83
- }
84
- }
85
- },
86
- {
87
- id: 'dotSize',
88
- label: 'Dots size',
89
- type: 'input:stepper',
90
- min: 1,
91
- devices: {
92
- desktop: {
93
- default: 12
94
- }
95
- }
96
- },
97
- {
98
- id: 'dotGapToCarousel',
99
- label: 'Gap to carousel',
100
- type: 'input:unit',
101
- useOnlyUnitInit: true,
102
- units: [
103
- 'px'
104
- ],
105
- min: 0,
106
- devices: {
107
- desktop: {
108
- default: 16
109
- }
110
- }
111
- },
112
- {
113
- id: 'dotColor',
114
- label: 'Dot color',
115
- type: 'color-picker-v2',
116
- devices: {
117
- desktop: {
118
- default: 'bg-1'
119
- }
120
- }
121
- },
122
- {
123
- id: 'dotActiveColor',
124
- label: 'Dot color active',
125
- type: 'color-picker-v2',
126
- devices: {
127
- desktop: {
128
- default: 'line-3'
129
- }
130
- }
131
- },
132
- {
133
- id: 'arrow',
134
- label: 'Next/Prev Arrow',
135
- type: 'toggle',
136
- devices: {
137
- desktop: {
138
- default: false
139
- }
140
- }
141
- },
142
- {
143
- id: 'arrowCustom',
144
- label: 'Custom Arrow',
145
- type: 'icon',
146
- default: '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"></path></svg>'
147
- },
148
- {
149
- id: 'arrowCustomColor',
150
- label: 'Icon color',
151
- type: 'color-picker-v2',
152
- default: '#000000'
153
- },
154
- {
155
- id: 'controlOverContent',
156
- label: 'Control Over Content',
157
- devices: {
158
- desktop: {
159
- default: false
160
- }
161
- },
162
- type: 'option:illustration',
163
- enableTooltip: true,
164
- options: [
165
- {
166
- label: 'Display inside navigation',
167
- value: true,
168
- iconName: 'slide-control-inside',
169
- svgName: 'gp-slide-control-inside'
170
- },
171
- {
172
- label: 'Display outside navigation',
173
- value: false,
174
- iconName: 'slide-control-outside',
175
- svgName: 'gp-slide-control-outside'
176
- }
177
- ]
178
- },
179
- {
180
- id: 'loop',
181
- label: 'Loop',
182
- type: 'toggle',
183
- devices: {
184
- desktop: {
185
- default: false
186
- }
187
- }
188
- },
189
- {
190
- id: 'speed',
191
- label: 'Speed(s)',
192
- type: 'input:stepper',
193
- min: 0,
194
- max: 60,
195
- default: 2,
196
- hide: true
197
- },
198
- {
199
- id: 'dragToScroll',
200
- label: 'Drag to scroll',
201
- type: 'toggle',
202
- default: false
203
- },
204
- {
205
- id: 'autoplay',
206
- label: 'Autoplay',
207
- type: 'toggle',
208
- default: false
209
- },
210
- {
211
- id: 'pauseOnHover',
212
- label: 'Pause On Hover',
213
- type: 'toggle',
214
- default: true,
215
- hide: true
216
- },
217
- {
218
- id: 'autoplayTimeout',
219
- label: 'Timeout(s)',
220
- type: 'range',
221
- min: 1,
222
- max: 10,
223
- step: 0.1,
224
- default: 2,
225
- hide: true,
226
- hideUnit: true,
227
- useOnlyUnitInit: true
228
- },
229
51
  {
230
52
  id: 'sameHeight',
231
53
  label: 'Enable same height',
@@ -241,7 +63,8 @@ const ProductListSettingsV2 = [
241
63
  }
242
64
  ],
243
65
  default: true
244
- }
66
+ },
67
+ ...CarouselSettingsV2Setting
245
68
  ]
246
69
  },
247
70
  {
@@ -249,17 +72,22 @@ const ProductListSettingsV2 = [
249
72
  controls: [
250
73
  {
251
74
  id: 'layout',
252
- type: 'segment',
253
75
  label: 'Layout',
76
+ type: 'layout-selector',
77
+ iconViewBox: '0 0 78 52',
78
+ itemPerRow: 2,
79
+ itemSpacing: 'large',
254
80
  default: 'grid',
255
81
  options: [
256
82
  {
257
83
  label: 'Grid',
258
- value: 'grid'
84
+ value: 'grid',
85
+ iconName: 'gp-grid-layout'
259
86
  },
260
87
  {
261
88
  label: 'Slider',
262
- value: 'slider'
89
+ value: 'slider',
90
+ iconName: 'gp-slider-layout'
263
91
  }
264
92
  ]
265
93
  },
@@ -302,7 +130,7 @@ const ProductListSettingsV2 = [
302
130
  ],
303
131
  devices: {
304
132
  desktop: {
305
- default: '400px'
133
+ default: 'auto'
306
134
  }
307
135
  },
308
136
  displayOptions: [
@@ -337,25 +165,10 @@ const ProductListSettingsV2 = [
337
165
  ],
338
166
  devices: {
339
167
  desktop: {
340
- default: '8px'
168
+ default: '16px'
341
169
  },
342
170
  mobile: {
343
- default: '8px'
344
- }
345
- }
346
- },
347
- {
348
- id: 'spacing',
349
- label: 'Item Spacing',
350
- type: 'input:unit',
351
- min: 0,
352
- useOnlyUnitInit: true,
353
- units: [
354
- 'px'
355
- ],
356
- devices: {
357
- desktop: {
358
- default: 44
171
+ default: '16px'
359
172
  }
360
173
  }
361
174
  },
@@ -431,7 +244,8 @@ const ProductListSettingsV2 = [
431
244
  default: 'center'
432
245
  }
433
246
  }
434
- }
247
+ },
248
+ ...CarouselSettingsV2Style
435
249
  ]
436
250
  }
437
251
  ];