@gem-sdk/components 2.0.0-dev.703 → 2.0.0-dev.704

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 (32) hide show
  1. package/dist/cjs/article/setting/configs/ArticleReadMore/settings.js +86 -134
  2. package/dist/cjs/button/components/common/helpers.js +2 -9
  3. package/dist/cjs/button/components/common/styles.js +14 -81
  4. package/dist/cjs/button/setting/configs/settings.js +85 -133
  5. package/dist/cjs/coupon/common/classes.js +3 -12
  6. package/dist/cjs/coupon/common/styles.js +7 -17
  7. package/dist/cjs/coupon/setting/config/settings.js +60 -100
  8. package/dist/cjs/form/setting/submit-button/configs/settings.js +103 -250
  9. package/dist/cjs/product/components/DynamicCheckout/common/styles.js +12 -12
  10. package/dist/cjs/product/components/ProductButton/common/styles.js +4 -14
  11. package/dist/cjs/product/components/ProductImagesV2/common/common.js +1 -1
  12. package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +86 -134
  13. package/dist/cjs/product/setting/product-button/configs/settings.js +142 -222
  14. package/dist/cjs/product/setting/product-view-more/configs/settings.js +100 -148
  15. package/dist/cjs/third-party/setting/Selleasy/index.js +5 -5
  16. package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +86 -134
  17. package/dist/esm/button/components/common/helpers.js +2 -9
  18. package/dist/esm/button/components/common/styles.js +16 -81
  19. package/dist/esm/button/setting/configs/settings.js +85 -133
  20. package/dist/esm/coupon/common/classes.js +3 -12
  21. package/dist/esm/coupon/common/styles.js +7 -17
  22. package/dist/esm/coupon/setting/config/settings.js +60 -100
  23. package/dist/esm/form/setting/submit-button/configs/settings.js +103 -250
  24. package/dist/esm/product/components/DynamicCheckout/common/styles.js +12 -12
  25. package/dist/esm/product/components/ProductButton/common/styles.js +4 -14
  26. package/dist/esm/product/components/ProductImagesV2/common/common.js +1 -1
  27. package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +86 -134
  28. package/dist/esm/product/setting/product-button/configs/settings.js +142 -222
  29. package/dist/esm/product/setting/product-view-more/configs/settings.js +100 -148
  30. package/dist/esm/third-party/setting/Selleasy/index.js +5 -5
  31. package/dist/types/index.d.ts +23 -23
  32. package/package.json +2 -2
@@ -1,9 +1,5 @@
1
- import { makeStyleResponsive, getStyleShadowState, composeRadius, makeGlobalSize, composeTypographyStyle, makeStyleResponsiveState, getStyleShadow, getStyleBackgroundImageByDevice, getGlobalColorStateResponsiveStyle, getSingleColorVariable, composeBorderCss, composeCornerCss } from '@gem-sdk/core';
1
+ import { makeStyleResponsive, getStyleShadowState, composeRadius, makeGlobalSize, composeTypographyStyle, makeStyleState, getStyleShadow, getStyleBackgroundImage, getGlobalColorStateStyle, composeBorderCss, composeCornerCss } from '@gem-sdk/core';
2
2
 
3
- const MEDIA_QUERIES = {
4
- TABLET: '@media only screen and (max-width: 1024px) and (min-width: 768px)',
5
- MOBILE: '@media only screen and (max-width: 767px)'
6
- };
7
3
  const getButtonWrapperStyles = (style, styles)=>({
8
4
  ...style,
9
5
  ...makeStyleResponsive('ta', styles?.align)
@@ -30,9 +26,7 @@ const isEnableShadowStateForDevice = (deviceStyles)=>({
30
26
  const getShadowStyles = (styles)=>{
31
27
  const { boxShadowBtnV2 } = styles || {};
32
28
  return {
33
- ...getStyleShadowState(boxShadowBtnV2?.desktop, 'box-shadow', isEnableShadowStateForDevice(boxShadowBtnV2?.desktop)),
34
- ...getStyleShadowState(boxShadowBtnV2?.tablet, 'box-shadow', isEnableShadowStateForDevice(boxShadowBtnV2?.tablet), 'tablet'),
35
- ...getStyleShadowState(boxShadowBtnV2?.mobile, 'box-shadow', isEnableShadowStateForDevice(boxShadowBtnV2?.mobile), 'mobile')
29
+ ...getStyleShadowState(boxShadowBtnV2, 'box-shadow', isEnableShadowStateForDevice(boxShadowBtnV2))
36
30
  };
37
31
  };
38
32
  const getRadiusStyles = (styles)=>composeRadius(styles?.roundedBtnV2);
@@ -61,7 +55,7 @@ const getTypographyStyles = (styles)=>{
61
55
  delete otherProps['--c'];
62
56
  return {
63
57
  textColorStyle: {
64
- ...makeStyleResponsiveState('c', processResponsiveHoverColors(styles?.textColorHover)),
58
+ ...makeStyleState('c', styles?.textColorHover),
65
59
  ...colorObj
66
60
  },
67
61
  withoutTextColorStyles: otherProps
@@ -77,90 +71,31 @@ const getTypoStyles = (styles)=>{
77
71
  })
78
72
  };
79
73
  };
80
- /**
81
- * Process hover color for a single device
82
- */ const processDeviceHoverColor = (deviceStyle)=>{
83
- if (!deviceStyle?.hover) return deviceStyle;
84
- return {
85
- ...deviceStyle,
86
- hover: getSingleColorVariable(deviceStyle.hover)
87
- };
88
- };
89
- /**
90
- * Process hover colors for all responsive devices
91
- */ const processResponsiveHoverColors = (responsiveStyle)=>{
92
- if (!responsiveStyle) return {};
93
- const devices = [
94
- 'desktop',
95
- 'tablet',
96
- 'mobile'
97
- ];
98
- return devices.reduce((acc, device)=>{
99
- const processedStyle = processDeviceHoverColor(responsiveStyle[device]);
100
- if (processedStyle) {
101
- acc[device] = processedStyle;
102
- }
103
- return acc;
104
- }, {});
105
- };
106
74
  const getBackgroundStyles = (styles)=>{
107
75
  return {
108
- ...getStyleBackgroundImageByDevice(styles?.backgroundImage),
109
- ...getGlobalColorStateResponsiveStyle('bg', styles?.backgroundColorV2)
76
+ ...getStyleBackgroundImage(styles?.backgroundImage),
77
+ ...getGlobalColorStateStyle('bg', styles?.backgroundColorV2)
110
78
  };
111
79
  };
112
80
  const getCustomCssStyles = ({ styles, uid, builderAttrs })=>{
113
81
  if (!uid) return '';
114
82
  const { borderBtnV2, roundedBtnV2 } = styles ?? {};
115
- const borderCornerStyles = {
116
- desktop: generateBorderCornerStyles({
117
- uid,
118
- device: 'desktop',
119
- borderBtn: borderBtnV2,
120
- roundedBtn: roundedBtnV2,
121
- builderAttrs
122
- }),
123
- tablet: generateBorderCornerStyles({
124
- uid,
125
- device: 'tablet',
126
- borderBtn: borderBtnV2,
127
- roundedBtn: roundedBtnV2,
128
- builderAttrs
129
- }),
130
- mobile: generateBorderCornerStyles({
131
- uid,
132
- device: 'mobile',
133
- borderBtn: borderBtnV2,
134
- roundedBtn: roundedBtnV2,
135
- builderAttrs
136
- })
137
- };
83
+ const borderCornerStyles = generateBorderCornerStyles({
84
+ uid,
85
+ borderBtn: borderBtnV2,
86
+ roundedBtn: roundedBtnV2,
87
+ builderAttrs
88
+ });
138
89
  return `
139
- ${borderCornerStyles.desktop.normalStyles}
140
- ${borderCornerStyles.desktop.hoverStyles}
141
-
142
- ${MEDIA_QUERIES.TABLET} {
143
- ${borderCornerStyles.tablet.normalStyles}
144
- ${borderCornerStyles.tablet.hoverStyles}
145
- }
146
-
147
- ${MEDIA_QUERIES.MOBILE} {
148
- ${borderCornerStyles.mobile.normalStyles}
149
- ${borderCornerStyles.mobile.hoverStyles}
150
- }
90
+ ${borderCornerStyles.normalStyles}
91
+ ${borderCornerStyles.hoverStyles}
151
92
  `.trim();
152
93
  };
153
- const generateBorderCornerStyles = ({ uid, device, borderBtn, roundedBtn, builderAttrs })=>{
94
+ const generateBorderCornerStyles = ({ uid, borderBtn, roundedBtn, builderAttrs })=>{
154
95
  const tag = builderAttrs?.['data-component-tag'];
155
96
  const getResponsiveStyles = ({ styleObj, state })=>{
156
97
  if (!styleObj) return undefined;
157
- if (device === 'mobile') {
158
- return styleObj.mobile?.[state] || styleObj.tablet?.[state] || styleObj.desktop?.[state];
159
- }
160
- if (device === 'tablet') {
161
- return styleObj.tablet?.[state] || styleObj.desktop?.[state];
162
- }
163
- return styleObj.desktop?.[state];
98
+ return styleObj?.[state];
164
99
  };
165
100
  const normalBorder = getResponsiveStyles({
166
101
  styleObj: borderBtn,
@@ -213,4 +148,4 @@ const generateBorderCornerStyles = ({ uid, device, borderBtn, roundedBtn, builde
213
148
  };
214
149
  };
215
150
 
216
- export { generateBorderCornerStyles, getButtonIconStyles, getButtonStyles, getButtonWrapperStyles, getCustomCssStyles, getRadiusStyles, getShadowStyles, getTypoStyles, processDeviceHoverColor, processResponsiveHoverColors };
151
+ export { generateBorderCornerStyles, getButtonIconStyles, getButtonStyles, getButtonWrapperStyles, getCustomCssStyles, getRadiusStyles, getShadowStyles, getTypoStyles };
@@ -124,44 +124,36 @@ const ButtonSettings = [
124
124
  {
125
125
  id: 'borderBtnV2',
126
126
  type: 'border-v2',
127
- devices: {
128
- desktop: {
129
- default: {
130
- normal: {
131
- borderType: 'none',
132
- border: 'none',
133
- borderWidth: '1px',
134
- width: '1px 1px 1px 1px',
135
- color: '#121212',
136
- isCustom: true
137
- },
138
- hover: {
139
- borderType: 'none',
140
- border: 'none',
141
- borderWidth: '1px',
142
- width: '1px 1px 1px 1px',
143
- color: '#121212',
144
- isCustom: true
145
- }
146
- }
127
+ default: {
128
+ normal: {
129
+ borderType: 'none',
130
+ border: 'none',
131
+ borderWidth: '1px',
132
+ width: '1px 1px 1px 1px',
133
+ color: '#121212',
134
+ isCustom: true
135
+ },
136
+ hover: {
137
+ borderType: 'none',
138
+ border: 'none',
139
+ borderWidth: '1px',
140
+ width: '1px 1px 1px 1px',
141
+ color: '#121212',
142
+ isCustom: true
147
143
  }
148
144
  },
149
145
  compoDefaultValue: {
150
- desktop: {
151
- default: {
152
- normal: {
153
- border: 'solid',
154
- color: '#121212',
155
- width: '1px',
156
- borderWidth: '1px'
157
- },
158
- hover: {
159
- border: 'solid',
160
- color: '#121212',
161
- width: '1px',
162
- borderWidth: '1px'
163
- }
164
- }
146
+ normal: {
147
+ border: 'solid',
148
+ color: '#121212',
149
+ width: '1px',
150
+ borderWidth: '1px'
151
+ },
152
+ hover: {
153
+ border: 'solid',
154
+ color: '#121212',
155
+ width: '1px',
156
+ borderWidth: '1px'
165
157
  }
166
158
  }
167
159
  },
@@ -186,30 +178,22 @@ const ButtonSettings = [
186
178
  {
187
179
  id: 'roundedBtnV2',
188
180
  type: 'corner-v2',
189
- devices: {
190
- desktop: {
191
- default: {
192
- normal: {
193
- btrr: '0px',
194
- bblr: '0px',
195
- bbrr: '0px',
196
- btlr: '0px',
197
- radiusType: 'none'
198
- }
199
- }
181
+ default: {
182
+ normal: {
183
+ btrr: '0px',
184
+ bblr: '0px',
185
+ bbrr: '0px',
186
+ btlr: '0px',
187
+ radiusType: 'none'
200
188
  }
201
189
  },
202
190
  compoDefaultValue: {
203
- desktop: {
204
- default: {
205
- normal: {
206
- btrr: '8px',
207
- bblr: '8px',
208
- bbrr: '8px',
209
- btlr: '8px',
210
- radiusType: 'rounded'
211
- }
212
- }
191
+ normal: {
192
+ btrr: '8px',
193
+ bblr: '8px',
194
+ bbrr: '8px',
195
+ btlr: '8px',
196
+ radiusType: 'rounded'
213
197
  }
214
198
  }
215
199
  },
@@ -266,46 +250,30 @@ const ButtonSettings = [
266
250
  {
267
251
  id: 'boxShadowBtnV2',
268
252
  type: 'shadow-v2',
269
- devices: {
270
- desktop: {
271
- default: {
272
- normal: {}
273
- }
274
- }
253
+ default: {
254
+ normal: {}
275
255
  },
276
256
  compoDefaultValue: {
277
- desktop: {
278
- default: {
279
- normal: {
280
- type: 'shadow-1',
281
- distance: '4px',
282
- blur: '4px',
283
- spread: '0px',
284
- color: '#121212',
285
- angle: 45
286
- }
287
- }
257
+ normal: {
258
+ type: 'shadow-1',
259
+ distance: '4px',
260
+ blur: '4px',
261
+ spread: '0px',
262
+ color: '#121212',
263
+ angle: 45
288
264
  }
289
265
  }
290
266
  },
291
267
  {
292
268
  id: 'backgroundColorV2',
293
269
  type: 'color-picker-v2',
294
- devices: {
295
- desktop: {
296
- default: {
297
- normal: 'brand',
298
- hover: 'highlight'
299
- }
300
- }
270
+ default: {
271
+ normal: 'brand',
272
+ hover: 'highlight'
301
273
  },
302
274
  compoDefaultValue: {
303
- desktop: {
304
- default: {
305
- normal: 'brand',
306
- hover: 'highlight'
307
- }
308
- }
275
+ normal: 'brand',
276
+ hover: 'highlight'
309
277
  },
310
278
  enableGradient: true
311
279
  },
@@ -325,44 +293,36 @@ const ButtonSettings = [
325
293
  {
326
294
  id: 'backgroundImage',
327
295
  type: 'background-image',
328
- devices: {
329
- desktop: {
330
- default: {
331
- normal: {}
332
- }
333
- }
296
+ default: {
297
+ normal: {}
334
298
  },
335
299
  compoDefaultValue: {
336
- desktop: {
337
- default: {
338
- normal: {
339
- size: 'cover',
340
- position: {
341
- x: 50,
342
- y: 50
343
- },
344
- repeat: 'no-repeat',
345
- attachment: 'scroll',
346
- image: {
347
- src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
348
- width: 1200,
349
- height: 480
350
- }
351
- },
352
- hover: {
353
- size: 'cover',
354
- position: {
355
- x: 50,
356
- y: 50
357
- },
358
- repeat: 'no-repeat',
359
- attachment: 'scroll',
360
- image: {
361
- src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
362
- width: 1200,
363
- height: 480
364
- }
365
- }
300
+ normal: {
301
+ size: 'cover',
302
+ position: {
303
+ x: 50,
304
+ y: 50
305
+ },
306
+ repeat: 'no-repeat',
307
+ attachment: 'scroll',
308
+ image: {
309
+ src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
310
+ width: 1200,
311
+ height: 480
312
+ }
313
+ },
314
+ hover: {
315
+ size: 'cover',
316
+ position: {
317
+ x: 50,
318
+ y: 50
319
+ },
320
+ repeat: 'no-repeat',
321
+ attachment: 'scroll',
322
+ image: {
323
+ src: 'https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/',
324
+ width: 1200,
325
+ height: 480
366
326
  }
367
327
  }
368
328
  }
@@ -423,19 +383,11 @@ const ButtonSettings = [
423
383
  {
424
384
  id: 'textColorHover',
425
385
  type: 'color-picker-v2',
426
- devices: {
427
- desktop: {
428
- default: {
429
- hover: 'text-3'
430
- }
431
- }
386
+ default: {
387
+ hover: 'text-3'
432
388
  },
433
389
  compoDefaultValue: {
434
- desktop: {
435
- default: {
436
- hover: 'text-3'
437
- }
438
- }
390
+ hover: 'text-3'
439
391
  },
440
392
  enableGradient: true
441
393
  },
@@ -1,19 +1,10 @@
1
1
  import { composeClasses, cls } from '@gem-sdk/core';
2
2
 
3
3
  const getActiveClasses = (backgroundColor, text)=>{
4
- const breakpoints = {
5
- desktop: '',
6
- tablet: 'tablet:',
7
- mobile: 'mobile:'
8
- };
9
- const generateClass = (type, device, value)=>value ? `${breakpoints[device]}[&_button]:data-[active=true]:!gp-${type}-[${value}]` : '';
4
+ const generateClass = (type, value)=>value ? `[&_button]:data-[active=true]:!gp-${type}-[${value}]` : '';
10
5
  const classes = [
11
- generateClass('bg', 'desktop', backgroundColor?.desktop?.active),
12
- generateClass('bg', 'tablet', backgroundColor?.tablet?.active),
13
- generateClass('bg', 'mobile', backgroundColor?.mobile?.active),
14
- generateClass('text', 'desktop', text?.desktop?.active),
15
- generateClass('text', 'tablet', text?.tablet?.active),
16
- generateClass('text', 'mobile', text?.mobile?.active)
6
+ generateClass('bg', backgroundColor?.active),
7
+ generateClass('text', text?.active)
17
8
  ].filter(Boolean).join(' ');
18
9
  return composeClasses(cls('gp-coupon', classes));
19
10
  };
@@ -12,21 +12,11 @@ const getButtonStyle = (style, styles)=>{
12
12
  ...makeStyleResponsive('ta', styles?.align)
13
13
  };
14
14
  };
15
- const getResponsiveSetting = (setting)=>{
16
- const desktop = setting.desktop;
17
- const tablet = setting.tablet ? setting.tablet : desktop;
18
- const mobile = setting.mobile ? setting.mobile : tablet;
19
- return {
20
- desktop,
21
- tablet,
22
- mobile
23
- };
24
- };
25
15
  const getInnerBorderCornerCss = (data)=>{
26
16
  const { uid, styles } = data;
27
- const borderBtnV2 = getResponsiveSetting(styles?.borderBtnV2 || {});
28
- const roundedBtnV2 = getResponsiveSetting(styles?.roundedBtnV2 || {});
29
- const boxShadowBtnV2 = getResponsiveSetting(styles?.boxShadowBtnV2 || {});
17
+ const borderBtnV2 = styles?.borderBtnV2;
18
+ const roundedBtnV2 = styles?.roundedBtnV2;
19
+ const boxShadowBtnV2 = styles?.boxShadowBtnV2;
30
20
  const getShadowValue = (value)=>value ? getStyleShadow({
31
21
  value,
32
22
  state: 'active',
@@ -44,14 +34,14 @@ const getInnerBorderCornerCss = (data)=>{
44
34
  return `
45
35
  ${mediaQuery}
46
36
  .gp-coupon[data-active="true"] .${uid}::before {
47
- ${composeBorderCss(borderBtnV2?.[device]?.active, {
37
+ ${composeBorderCss(borderBtnV2?.active, {
48
38
  important: true
49
39
  })};
50
- ${composeCornerCss(roundedBtnV2?.[device]?.active, true)};
51
- box-shadow: ${getShadowValue(boxShadowBtnV2?.[device]?.active)} !important;
40
+ ${composeCornerCss(roundedBtnV2?.active, true)};
41
+ box-shadow: ${getShadowValue(boxShadowBtnV2?.active ?? {})} !important;
52
42
  }
53
43
  .gp-coupon[data-active="true"] .${uid} {
54
- ${composeCornerCss(roundedBtnV2?.[device]?.active, true)};
44
+ ${composeCornerCss(roundedBtnV2?.active, true)};
55
45
  }
56
46
  ${closeMediaQuery}
57
47
  `;