@gem-sdk/components 2.0.0-dev.355 → 2.0.0-dev.357
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.
- package/dist/cjs/article/next.js +41 -31
- package/dist/cjs/builder.js +1 -1
- package/dist/cjs/button/components/Button.js +5 -3
- package/dist/cjs/button/components/Button.liquid.js +7 -3
- package/dist/cjs/button/components/common/attributes.js +1 -2
- package/dist/cjs/button/components/common/helpers.js +2 -2
- package/dist/cjs/button/components/common/styles.js +29 -1
- package/dist/cjs/button/setting/configs/settings.js +24 -4
- package/dist/cjs/button/setting/configs/uiV2.js +46 -8
- package/dist/cjs/image/setting/configs/uiV2.js +5 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
- package/dist/cjs/post-purchase/product/components/product-offer/common/attrs.js +14 -0
- package/dist/cjs/post-purchase/product/components/product-offer/common/classes.js +29 -0
- package/dist/cjs/post-purchase/product/components/product-offer/common/styles.js +27 -0
- package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOffer.js +53 -0
- package/dist/cjs/post-purchase/product/components/product-offer/components/ProductOfferItem.js +45 -0
- package/dist/cjs/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +57 -0
- package/dist/cjs/post-purchase/product/index.js +2 -2
- package/dist/cjs/post-purchase/product/next.js +1 -1
- package/dist/cjs/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
- package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV1.js +140 -0
- package/dist/cjs/post-purchase/product/settings/product-offer/ui/uiV2.js +141 -0
- package/dist/cjs/post-purchase/utils/constants.js +6 -0
- package/dist/cjs/product/components/ProductViewMore/ProductViewMore.js +17 -18
- package/dist/cjs/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
- package/dist/cjs/product/components/ProductViewMore/common/data.js +26 -0
- package/dist/cjs/product/components/ProductViewMore/common/styles.js +12 -0
- package/dist/cjs/product/setting/dynamic-checkout/configs/settings.js +9 -5
- package/dist/cjs/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
- package/dist/cjs/product/setting/product-button/configs/settings.js +1 -0
- package/dist/cjs/product/setting/product-button/configs/uiV2.js +1 -1
- package/dist/cjs/product/setting/product-view-more/configs/settings.js +17 -16
- package/dist/cjs/product/setting/product-view-more/configs/uiV2.js +45 -45
- package/dist/esm/article/next.js +41 -31
- package/dist/esm/builder.js +1 -1
- package/dist/esm/button/components/Button.js +5 -3
- package/dist/esm/button/components/Button.liquid.js +7 -3
- package/dist/esm/button/components/common/attributes.js +1 -2
- package/dist/esm/button/components/common/helpers.js +2 -2
- package/dist/esm/button/components/common/styles.js +29 -3
- package/dist/esm/button/setting/configs/settings.js +24 -4
- package/dist/esm/button/setting/configs/uiV2.js +46 -8
- package/dist/esm/image/setting/configs/uiV2.js +5 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +4 -3
- package/dist/esm/post-purchase/product/components/product-offer/common/attrs.js +12 -0
- package/dist/esm/post-purchase/product/components/product-offer/common/classes.js +25 -0
- package/dist/esm/post-purchase/product/components/product-offer/common/styles.js +24 -0
- package/dist/esm/post-purchase/product/components/product-offer/components/ProductOffer.js +49 -0
- package/dist/esm/post-purchase/product/components/product-offer/components/ProductOfferItem.js +43 -0
- package/dist/esm/post-purchase/product/components/product-offer/hooks/useProductOfferData.js +55 -0
- package/dist/esm/post-purchase/product/index.js +1 -1
- package/dist/esm/post-purchase/product/next.js +1 -1
- package/dist/esm/post-purchase/product/settings/{ProductOffer.js → product-offer/index.js} +23 -143
- package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV1.js +138 -0
- package/dist/esm/post-purchase/product/settings/product-offer/ui/uiV2.js +139 -0
- package/dist/esm/post-purchase/utils/constants.js +6 -1
- package/dist/esm/product/components/ProductViewMore/ProductViewMore.js +17 -18
- package/dist/esm/product/components/ProductViewMore/ProductViewMore.liquid.js +14 -21
- package/dist/esm/product/components/ProductViewMore/common/data.js +23 -0
- package/dist/esm/product/components/ProductViewMore/common/styles.js +10 -0
- package/dist/esm/product/setting/dynamic-checkout/configs/settings.js +9 -5
- package/dist/esm/product/setting/dynamic-checkout/configs/uiV2.js +10 -10
- package/dist/esm/product/setting/product-button/configs/settings.js +1 -0
- package/dist/esm/product/setting/product-button/configs/uiV2.js +1 -1
- package/dist/esm/product/setting/product-view-more/configs/settings.js +17 -16
- package/dist/esm/product/setting/product-view-more/configs/uiV2.js +45 -45
- package/dist/types/index.d.ts +42 -8
- package/package.json +2 -2
- package/dist/cjs/post-purchase/product/components/ProductOffer.js +0 -138
- package/dist/esm/post-purchase/product/components/ProductOffer.js +0 -133
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getButtonSettings = (setting)=>{
|
|
4
|
+
const { label, iconSvg, iconAlign, iconVisible, shouldClearSpace } = setting ?? {};
|
|
5
|
+
return {
|
|
6
|
+
label,
|
|
7
|
+
iconSvg,
|
|
8
|
+
iconAlign,
|
|
9
|
+
iconVisible,
|
|
10
|
+
shouldClearSpace,
|
|
11
|
+
htmlType: 'submit'
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const getButtonLiquidSettings = (setting)=>{
|
|
15
|
+
const { translate, redirectNewTab } = setting ?? {};
|
|
16
|
+
return {
|
|
17
|
+
translate,
|
|
18
|
+
btnLink: {
|
|
19
|
+
link: '{{ product.url }}',
|
|
20
|
+
target: redirectNewTab ? '_blank' : '_self'
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.getButtonLiquidSettings = getButtonLiquidSettings;
|
|
26
|
+
exports.getButtonSettings = getButtonSettings;
|
|
@@ -24,7 +24,7 @@ const DynamicCheckoutSettings = [
|
|
|
24
24
|
default: {
|
|
25
25
|
type: 'paragraph-1',
|
|
26
26
|
attrs: {
|
|
27
|
-
color: 'text-
|
|
27
|
+
color: 'text-1'
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
30
|
hiddenSetting: {
|
|
@@ -358,7 +358,7 @@ const DynamicCheckoutSettings = [
|
|
|
358
358
|
],
|
|
359
359
|
devices: {
|
|
360
360
|
desktop: {
|
|
361
|
-
default: '
|
|
361
|
+
default: 'left'
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
},
|
|
@@ -410,12 +410,16 @@ const DynamicCheckoutSettings = [
|
|
|
410
410
|
type: 'color-picker-v2',
|
|
411
411
|
devices: {
|
|
412
412
|
desktop: {
|
|
413
|
-
default: {
|
|
413
|
+
default: {
|
|
414
|
+
hover: 'text-3'
|
|
415
|
+
}
|
|
414
416
|
}
|
|
415
417
|
},
|
|
416
418
|
compoDefaultValue: {
|
|
417
419
|
desktop: {
|
|
418
|
-
default: {
|
|
420
|
+
default: {
|
|
421
|
+
hover: 'text-3'
|
|
422
|
+
}
|
|
419
423
|
}
|
|
420
424
|
},
|
|
421
425
|
enableGradient: true
|
|
@@ -426,7 +430,7 @@ const DynamicCheckoutSettings = [
|
|
|
426
430
|
devices: {
|
|
427
431
|
desktop: {
|
|
428
432
|
default: {
|
|
429
|
-
width: '
|
|
433
|
+
width: '100%',
|
|
430
434
|
height: 'Auto',
|
|
431
435
|
padding: {
|
|
432
436
|
type: 'medium',
|
|
@@ -288,15 +288,15 @@ const SettingUIV2 = [
|
|
|
288
288
|
state: 'hover'
|
|
289
289
|
}
|
|
290
290
|
},
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
291
|
+
{
|
|
292
|
+
label: {
|
|
293
|
+
en: 'Image'
|
|
294
|
+
},
|
|
295
|
+
setting: {
|
|
296
|
+
id: 'backgroundImage',
|
|
297
|
+
state: 'hover'
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
300
|
{
|
|
301
301
|
label: {
|
|
302
302
|
en: 'Text color'
|
|
@@ -366,7 +366,7 @@ const SettingUIV2 = [
|
|
|
366
366
|
options: {
|
|
367
367
|
labelVariant: 'primary',
|
|
368
368
|
fullWidth: true,
|
|
369
|
-
disableMessage: `
|
|
369
|
+
disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
372
|
]
|
|
@@ -550,7 +550,7 @@ const SettingUIV2 = [
|
|
|
550
550
|
options: {
|
|
551
551
|
labelVariant: 'primary',
|
|
552
552
|
fullWidth: true,
|
|
553
|
-
disableMessage: `
|
|
553
|
+
disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
|
|
554
554
|
}
|
|
555
555
|
}
|
|
556
556
|
]
|
|
@@ -55,19 +55,9 @@ const ProductViewMoreSettings = [
|
|
|
55
55
|
default: false
|
|
56
56
|
},
|
|
57
57
|
{
|
|
58
|
-
id: '
|
|
59
|
-
type: '
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
label: 'Current',
|
|
63
|
-
value: 'current'
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
label: 'New Tab',
|
|
67
|
-
value: 'new-tab'
|
|
68
|
-
}
|
|
69
|
-
],
|
|
70
|
-
default: 'current'
|
|
58
|
+
id: 'redirectNewTab',
|
|
59
|
+
type: 'toggle',
|
|
60
|
+
default: false
|
|
71
61
|
}
|
|
72
62
|
]
|
|
73
63
|
},
|
|
@@ -385,16 +375,25 @@ const ProductViewMoreSettings = [
|
|
|
385
375
|
],
|
|
386
376
|
devices: {
|
|
387
377
|
desktop: {
|
|
388
|
-
default: '
|
|
378
|
+
default: 'left'
|
|
389
379
|
}
|
|
390
380
|
}
|
|
391
381
|
},
|
|
382
|
+
{
|
|
383
|
+
id: 'enableTextStyle',
|
|
384
|
+
label: '',
|
|
385
|
+
type: 'toggle',
|
|
386
|
+
default: true
|
|
387
|
+
},
|
|
392
388
|
{
|
|
393
389
|
id: 'typo',
|
|
394
390
|
type: 'typography-v2',
|
|
395
391
|
label: 'Typography',
|
|
396
392
|
default: {
|
|
397
|
-
type: 'paragraph-1'
|
|
393
|
+
type: 'paragraph-1',
|
|
394
|
+
attrs: {
|
|
395
|
+
color: 'text-1'
|
|
396
|
+
}
|
|
398
397
|
},
|
|
399
398
|
hiddenSetting: {
|
|
400
399
|
textAlign: true
|
|
@@ -512,10 +511,12 @@ const ProductViewMoreSettings = [
|
|
|
512
511
|
},
|
|
513
512
|
{
|
|
514
513
|
id: 'iconSpacing',
|
|
515
|
-
type: 'input:
|
|
514
|
+
type: 'input:slider',
|
|
516
515
|
units: [
|
|
517
516
|
'px'
|
|
518
517
|
],
|
|
518
|
+
step: 1,
|
|
519
|
+
max: 40,
|
|
519
520
|
devices: {
|
|
520
521
|
desktop: {
|
|
521
522
|
default: '8px'
|
|
@@ -190,28 +190,27 @@ const SettingUIV2 = [
|
|
|
190
190
|
]
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
|
-
label: {
|
|
194
|
-
en: 'Icon'
|
|
195
|
-
},
|
|
196
193
|
controls: [
|
|
197
194
|
{
|
|
195
|
+
label: {
|
|
196
|
+
en: 'Icon'
|
|
197
|
+
},
|
|
198
198
|
setting: {
|
|
199
199
|
id: 'iconVisible'
|
|
200
|
+
},
|
|
201
|
+
options: {
|
|
202
|
+
labelVariant: 'primary',
|
|
203
|
+
toggleStyle: 'switch'
|
|
200
204
|
}
|
|
201
|
-
}
|
|
202
|
-
]
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
conditionDisplay: 'iconVisible == true',
|
|
206
|
-
controls: [
|
|
205
|
+
},
|
|
207
206
|
{
|
|
208
|
-
type: 'control',
|
|
209
207
|
label: {
|
|
210
|
-
en: '
|
|
208
|
+
en: 'Icon'
|
|
211
209
|
},
|
|
212
210
|
setting: {
|
|
213
211
|
id: 'iconSvg'
|
|
214
|
-
}
|
|
212
|
+
},
|
|
213
|
+
conditionDisplay: 'iconVisible == true'
|
|
215
214
|
},
|
|
216
215
|
{
|
|
217
216
|
type: 'control',
|
|
@@ -220,24 +219,35 @@ const SettingUIV2 = [
|
|
|
220
219
|
},
|
|
221
220
|
setting: {
|
|
222
221
|
id: 'iconAlign'
|
|
223
|
-
}
|
|
222
|
+
},
|
|
223
|
+
conditionDisplay: 'iconVisible == true'
|
|
224
224
|
},
|
|
225
225
|
{
|
|
226
226
|
type: 'control',
|
|
227
227
|
label: {
|
|
228
|
-
en: '
|
|
228
|
+
en: 'Text & icon gap'
|
|
229
229
|
},
|
|
230
230
|
setting: {
|
|
231
231
|
id: 'iconSpacing'
|
|
232
|
-
}
|
|
232
|
+
},
|
|
233
|
+
conditionDisplay: 'iconVisible == true'
|
|
233
234
|
}
|
|
234
235
|
]
|
|
235
236
|
},
|
|
236
237
|
{
|
|
237
|
-
label: {
|
|
238
|
-
en: 'Text style'
|
|
239
|
-
},
|
|
240
238
|
controls: [
|
|
239
|
+
{
|
|
240
|
+
label: {
|
|
241
|
+
en: 'Text'
|
|
242
|
+
},
|
|
243
|
+
setting: {
|
|
244
|
+
id: 'enableTextStyle'
|
|
245
|
+
},
|
|
246
|
+
options: {
|
|
247
|
+
labelVariant: 'primary',
|
|
248
|
+
toggleStyle: 'switch'
|
|
249
|
+
}
|
|
250
|
+
},
|
|
241
251
|
{
|
|
242
252
|
id: 'typo',
|
|
243
253
|
label: {
|
|
@@ -246,6 +256,7 @@ const SettingUIV2 = [
|
|
|
246
256
|
setting: {
|
|
247
257
|
id: 'typo'
|
|
248
258
|
},
|
|
259
|
+
conditionDisplay: 'enableTextStyle == true',
|
|
249
260
|
options: {
|
|
250
261
|
hideLabel: true,
|
|
251
262
|
fullWidth: true,
|
|
@@ -283,22 +294,22 @@ const SettingUIV2 = [
|
|
|
283
294
|
controls: [
|
|
284
295
|
{
|
|
285
296
|
label: {
|
|
286
|
-
en: '
|
|
297
|
+
en: 'Color'
|
|
287
298
|
},
|
|
288
299
|
setting: {
|
|
289
300
|
id: 'backgroundColorV2',
|
|
290
301
|
state: 'hover'
|
|
291
302
|
}
|
|
292
303
|
},
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
304
|
+
{
|
|
305
|
+
label: {
|
|
306
|
+
en: 'Image'
|
|
307
|
+
},
|
|
308
|
+
setting: {
|
|
309
|
+
id: 'backgroundImage',
|
|
310
|
+
state: 'hover'
|
|
311
|
+
}
|
|
312
|
+
},
|
|
302
313
|
{
|
|
303
314
|
label: {
|
|
304
315
|
en: 'Text color'
|
|
@@ -341,28 +352,17 @@ const SettingUIV2 = [
|
|
|
341
352
|
}
|
|
342
353
|
]
|
|
343
354
|
},
|
|
344
|
-
// {
|
|
345
|
-
// label: {
|
|
346
|
-
// en: 'Link',
|
|
347
|
-
// },
|
|
348
|
-
// controls: [
|
|
349
|
-
// {
|
|
350
|
-
// type: 'control',
|
|
351
|
-
// layout: 'vertical',
|
|
352
|
-
// setting: {
|
|
353
|
-
// id: 'btnLink',
|
|
354
|
-
// },
|
|
355
|
-
// },
|
|
356
|
-
// ],
|
|
357
|
-
// },
|
|
358
355
|
{
|
|
359
356
|
label: {
|
|
360
|
-
en: '
|
|
357
|
+
en: 'Redirect to'
|
|
361
358
|
},
|
|
362
359
|
controls: [
|
|
363
360
|
{
|
|
361
|
+
label: {
|
|
362
|
+
en: 'New tab'
|
|
363
|
+
},
|
|
364
364
|
setting: {
|
|
365
|
-
id: '
|
|
365
|
+
id: 'redirectNewTab'
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
368
|
]
|
|
@@ -380,7 +380,7 @@ const SettingUIV2 = [
|
|
|
380
380
|
options: {
|
|
381
381
|
labelVariant: 'primary',
|
|
382
382
|
fullWidth: true,
|
|
383
|
-
disableMessage: `
|
|
383
|
+
disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
]
|
package/dist/esm/article/next.js
CHANGED
|
@@ -7,38 +7,48 @@ import '@gem-sdk/core';
|
|
|
7
7
|
const ArticleList = dynamic(()=>import('./components/ArticleList.js'), {
|
|
8
8
|
loading: Loading
|
|
9
9
|
});
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
10
|
+
const ArticleTitle = dynamic(()=>import('./components/ArticleTitle.js'), {
|
|
11
|
+
loading: Loading
|
|
12
|
+
});
|
|
13
|
+
const ArticleExcerpt = dynamic(()=>import('./components/ArticleExcerpt.js'), {
|
|
14
|
+
loading: Loading
|
|
15
|
+
});
|
|
16
|
+
const ArticleContent = dynamic(()=>import('./components/ArticleContent.js'), {
|
|
17
|
+
loading: Loading
|
|
18
|
+
});
|
|
19
|
+
const ArticleImage = dynamic(()=>import('./components/ArticleImage.js'), {
|
|
20
|
+
loading: Loading
|
|
21
|
+
});
|
|
22
|
+
const ArticlePagination = dynamic(()=>import('./components/ArticlePagination.js'), {
|
|
23
|
+
loading: Loading
|
|
24
|
+
});
|
|
25
|
+
const ArticleAuthor = dynamic(()=>import('./components/ArticleAuthor.js'), {
|
|
26
|
+
loading: Loading
|
|
27
|
+
});
|
|
28
|
+
const ArticleTag = dynamic(()=>import('./components/ArticleTag.js'), {
|
|
29
|
+
loading: Loading
|
|
30
|
+
});
|
|
31
|
+
const ArticleCategory = dynamic(()=>import('./components/ArticleCategory.js'), {
|
|
32
|
+
loading: Loading
|
|
33
|
+
});
|
|
34
|
+
const ArticleDate = dynamic(()=>import('./components/ArticleDate.js'), {
|
|
35
|
+
loading: Loading
|
|
36
|
+
});
|
|
37
|
+
const ArticleReadMore = dynamic(()=>import('./components/ArticleReadMore.js'), {
|
|
38
|
+
loading: Loading
|
|
39
|
+
});
|
|
40
40
|
var article = {
|
|
41
|
-
ArticleList
|
|
41
|
+
ArticleList,
|
|
42
|
+
ArticleTitle,
|
|
43
|
+
ArticleExcerpt,
|
|
44
|
+
ArticleContent,
|
|
45
|
+
ArticleImage,
|
|
46
|
+
ArticlePagination,
|
|
47
|
+
ArticleAuthor,
|
|
48
|
+
ArticleTag,
|
|
49
|
+
ArticleCategory,
|
|
50
|
+
ArticleDate,
|
|
51
|
+
ArticleReadMore
|
|
42
52
|
};
|
|
43
53
|
|
|
44
54
|
export { article as default };
|
package/dist/esm/builder.js
CHANGED
|
@@ -100,7 +100,7 @@ import PostPurchaseProductPrice from './post-purchase/product/components/Product
|
|
|
100
100
|
import PostPurchaseProductVariants from './post-purchase/product/components/product-variant/components/ProductVariant.js';
|
|
101
101
|
import PostPurchaseAcceptButton from './post-purchase/product/components/AcceptButton.js';
|
|
102
102
|
import PostPurchaseProductQuantity from './post-purchase/product/components/ProductQuantity.js';
|
|
103
|
-
import PostPurchaseProductOffer from './post-purchase/product/components/ProductOffer.js';
|
|
103
|
+
import PostPurchaseProductOffer from './post-purchase/product/components/product-offer/components/ProductOffer.js';
|
|
104
104
|
import PostPurchaseProductPriceBreakdown from './post-purchase/product/components/ProductPriceBreakdown.js';
|
|
105
105
|
import PostPurchaseProductDiscountTag from './post-purchase/product/components/ProductDiscountTag.js';
|
|
106
106
|
import PostPurchaseProductImages from './post-purchase/product/components/product-image/index.js';
|
|
@@ -13,10 +13,12 @@ import { getInsertLinkData, getButtonWrapper } from './common/helpers.js';
|
|
|
13
13
|
|
|
14
14
|
const Button = (props)=>{
|
|
15
15
|
const { children, advanced, className, nodePrice, customAttrs, styles = {}, setting = {}, builderProps, builderAttrs, wrapClassName = '', onClick } = props;
|
|
16
|
-
const { iconSvg, btnLink, htmlType, loading, disabled, shouldClearSpace } = setting;
|
|
16
|
+
const { iconSvg, btnLink, htmlType, loading, disabled, shouldClearSpace, enableBtnLink } = setting;
|
|
17
|
+
const { enableTextStyle = true } = styles;
|
|
17
18
|
const mode = useEditorMode();
|
|
18
19
|
const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = getData(props);
|
|
19
20
|
const { HTMLTag, urlData, shouldRenderLink } = getInsertLinkData({
|
|
21
|
+
enableBtnLink,
|
|
20
22
|
htmlType,
|
|
21
23
|
setting: btnLink,
|
|
22
24
|
defaultTag: 'button'
|
|
@@ -55,7 +57,6 @@ const Button = (props)=>{
|
|
|
55
57
|
});
|
|
56
58
|
const buttonWrapperAttrs = createAttr({
|
|
57
59
|
...getButtonAttributes({
|
|
58
|
-
urlData,
|
|
59
60
|
disabled,
|
|
60
61
|
dataState,
|
|
61
62
|
dataId: dataIdAttr,
|
|
@@ -89,6 +90,7 @@ const Button = (props)=>{
|
|
|
89
90
|
/*#__PURE__*/ jsxs(ButtonWrapper, {
|
|
90
91
|
...buttonWrapperAttrs,
|
|
91
92
|
...customAttrs,
|
|
93
|
+
setting: urlData,
|
|
92
94
|
style: buttonStyles,
|
|
93
95
|
className: buttonClasses,
|
|
94
96
|
onClick: handleClick,
|
|
@@ -102,7 +104,7 @@ const Button = (props)=>{
|
|
|
102
104
|
styles: buttonIconStyles,
|
|
103
105
|
classes: buttonIconClasses
|
|
104
106
|
})),
|
|
105
|
-
If(checkIsShowLabel(), /*#__PURE__*/ jsx(ButtonLabel, {
|
|
107
|
+
If(enableTextStyle && checkIsShowLabel(), /*#__PURE__*/ jsx(ButtonLabel, {
|
|
106
108
|
label: getLabelToDisplay(),
|
|
107
109
|
classes: buttonLabelClasses
|
|
108
110
|
}))
|
|
@@ -12,9 +12,11 @@ import { getInsertLinkData, getButtonWrapper } from './common/helpers.js';
|
|
|
12
12
|
|
|
13
13
|
const Button = (props)=>{
|
|
14
14
|
const { advanced, className, nodePrice, customAttrs, styles = {}, setting = {}, builderProps, wrapClassName = '' } = props;
|
|
15
|
-
const { iconSvg, loading, btnLink, htmlType, disabled, shouldClearSpace } = setting;
|
|
15
|
+
const { iconSvg, loading, btnLink, htmlType, disabled, shouldClearSpace, enableBtnLink } = setting;
|
|
16
|
+
const { enableTextStyle = true } = styles;
|
|
16
17
|
const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = getData(props);
|
|
17
18
|
const { HTMLTag, urlData, shouldRenderLink } = getInsertLinkData({
|
|
19
|
+
enableBtnLink,
|
|
18
20
|
htmlType,
|
|
19
21
|
setting: btnLink,
|
|
20
22
|
defaultTag: 'button',
|
|
@@ -56,7 +58,6 @@ const Button = (props)=>{
|
|
|
56
58
|
});
|
|
57
59
|
const buttonWrapperAttrs = createAttr({
|
|
58
60
|
...getButtonAttributes({
|
|
59
|
-
urlData,
|
|
60
61
|
disabled,
|
|
61
62
|
dataState,
|
|
62
63
|
dataId: dataIdAttr,
|
|
@@ -88,6 +89,9 @@ const Button = (props)=>{
|
|
|
88
89
|
}}
|
|
89
90
|
${{
|
|
90
91
|
...customAttrs
|
|
92
|
+
}}
|
|
93
|
+
${{
|
|
94
|
+
...urlData
|
|
91
95
|
}}
|
|
92
96
|
style="${buttonStyles}"
|
|
93
97
|
class="${buttonClasses}"
|
|
@@ -99,7 +103,7 @@ const Button = (props)=>{
|
|
|
99
103
|
styles: buttonIconStyles,
|
|
100
104
|
classes: buttonIconClasses
|
|
101
105
|
}))}
|
|
102
|
-
${If(checkIsShowLabel({
|
|
106
|
+
${If(enableTextStyle && checkIsShowLabel({
|
|
103
107
|
isLiquid: true
|
|
104
108
|
}), ButtonLabel({
|
|
105
109
|
label: getLabelToDisplay({
|
|
@@ -68,7 +68,7 @@ const getDataId = (uidInteraction, dataId, uid)=>{
|
|
|
68
68
|
const handleGetArialLabel = ({ label, isLiquid = false })=>{
|
|
69
69
|
return isLiquid ? label?.toString().replaceAll("'", ''').replaceAll('"', "'") ?? '' : label?.toString() ?? '';
|
|
70
70
|
};
|
|
71
|
-
const getInsertLinkData = ({ setting, htmlType, defaultTag, isLiquid = false })=>{
|
|
71
|
+
const getInsertLinkData = ({ setting, htmlType, defaultTag, enableBtnLink, isLiquid = false })=>{
|
|
72
72
|
const URL_INCLUDES = [
|
|
73
73
|
'product.url'
|
|
74
74
|
];
|
|
@@ -89,7 +89,7 @@ const getInsertLinkData = ({ setting, htmlType, defaultTag, isLiquid = false })=
|
|
|
89
89
|
if (URL_START_WITH.find((el)=>urlHref.startsWith(el))) return true;
|
|
90
90
|
return false;
|
|
91
91
|
};
|
|
92
|
-
const shouldRenderLink = isDomain || isShopifyDomain || isLink() || isHomePageHref;
|
|
92
|
+
const shouldRenderLink = enableBtnLink ? isDomain || isShopifyDomain || isLink() || isHomePageHref : false;
|
|
93
93
|
let transformedUrl = urlHref;
|
|
94
94
|
if (isLiquid && (isShopifyDomain || isHomePageHref)) {
|
|
95
95
|
transformedUrl = setting?.isTranslate ? '$locationOrigin' + urlHref : "{{ request.origin }}{{ routes.root_url | split: '/' | join: '/' }}" + urlHref;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyleResponsive, getStyleShadowState, composeRadius, makeGlobalSize, makeStyleResponsiveState, composeTypographyStyle, getStyleShadow, getStyleBackgroundImageByDevice, getGlobalColorStateResponsiveStyle, composeBorderCss, composeCornerCss } from '@gem-sdk/core';
|
|
1
|
+
import { makeStyleResponsive, getStyleShadowState, composeRadius, makeGlobalSize, makeStyleResponsiveState, composeTypographyStyle, getStyleShadow, getStyleBackgroundImageByDevice, getGlobalColorStateResponsiveStyle, getSingleColorVariable, composeBorderCss, composeCornerCss } from '@gem-sdk/core';
|
|
2
2
|
|
|
3
3
|
const MEDIA_QUERIES = {
|
|
4
4
|
TABLET: '@media only screen and (max-width: 1024px) and (min-width: 768px)',
|
|
@@ -52,7 +52,7 @@ const getSizeStyles = (styles)=>{
|
|
|
52
52
|
};
|
|
53
53
|
const getTypoStyles = (styles)=>{
|
|
54
54
|
return {
|
|
55
|
-
...makeStyleResponsiveState('c', styles?.textColorHover),
|
|
55
|
+
...makeStyleResponsiveState('c', processResponsiveHoverColors(styles?.textColorHover)),
|
|
56
56
|
...composeTypographyStyle(styles?.typo, styles?.typography),
|
|
57
57
|
...getStyleShadow({
|
|
58
58
|
styleAppliedFor: 'text-shadow',
|
|
@@ -61,6 +61,32 @@ const getTypoStyles = (styles)=>{
|
|
|
61
61
|
})
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Process hover color for a single device
|
|
66
|
+
*/ const processDeviceHoverColor = (deviceStyle)=>{
|
|
67
|
+
if (!deviceStyle?.hover) return deviceStyle;
|
|
68
|
+
return {
|
|
69
|
+
...deviceStyle,
|
|
70
|
+
hover: getSingleColorVariable(deviceStyle.hover)
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Process hover colors for all responsive devices
|
|
75
|
+
*/ const processResponsiveHoverColors = (responsiveStyle)=>{
|
|
76
|
+
if (!responsiveStyle) return {};
|
|
77
|
+
const devices = [
|
|
78
|
+
'desktop',
|
|
79
|
+
'tablet',
|
|
80
|
+
'mobile'
|
|
81
|
+
];
|
|
82
|
+
return devices.reduce((acc, device)=>{
|
|
83
|
+
const processedStyle = processDeviceHoverColor(responsiveStyle[device]);
|
|
84
|
+
if (processedStyle) {
|
|
85
|
+
acc[device] = processedStyle;
|
|
86
|
+
}
|
|
87
|
+
return acc;
|
|
88
|
+
}, {});
|
|
89
|
+
};
|
|
64
90
|
const getBackgroundStyles = (styles)=>{
|
|
65
91
|
return {
|
|
66
92
|
...getStyleBackgroundImageByDevice(styles?.backgroundImage),
|
|
@@ -143,4 +169,4 @@ const generateBorderCornerStyles = ({ uid, device, borderBtn, roundedBtn, builde
|
|
|
143
169
|
};
|
|
144
170
|
};
|
|
145
171
|
|
|
146
|
-
export { generateBorderCornerStyles, getButtonIconStyles, getButtonStyles, getButtonWrapperStyles, getCustomCssStyles, getRadiusStyles, getShadowStyles };
|
|
172
|
+
export { generateBorderCornerStyles, getButtonIconStyles, getButtonStyles, getButtonWrapperStyles, getCustomCssStyles, getRadiusStyles, getShadowStyles, processDeviceHoverColor, processResponsiveHoverColors };
|