@gem-sdk/components 2.0.0-dev.393 → 2.0.0-dev.395

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 (43) hide show
  1. package/dist/cjs/builder.js +4 -4
  2. package/dist/cjs/index.js +30 -30
  3. package/dist/cjs/index.liquid.js +4 -4
  4. package/dist/cjs/product/components/ProductBundle/common/styles.js +22 -6
  5. package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +2 -1
  6. package/dist/cjs/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +1 -1
  7. package/dist/cjs/product/components/ProductBundle/setting/ProductBundleDiscount.js +47 -415
  8. package/dist/cjs/product/components/ProductBundle/setting/uiV1.js +404 -0
  9. package/dist/cjs/product/components/ProductBundle/setting/uiV2.js +728 -0
  10. package/dist/cjs/product/components/ProductDiscountTag/common/getClasses.js +38 -0
  11. package/dist/cjs/product/components/ProductDiscountTag/common/getStyle.js +42 -0
  12. package/dist/cjs/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +108 -0
  13. package/dist/cjs/product/components/ProductDiscountTag/index.js +110 -0
  14. package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +91 -0
  15. package/dist/cjs/product/index.js +4 -4
  16. package/dist/cjs/product/next.js +1 -1
  17. package/dist/cjs/product/setting/ProductTag.js +7 -299
  18. package/dist/cjs/product/setting/product-discount-tag/configs/settings.js +191 -0
  19. package/dist/cjs/product/setting/product-discount-tag/configs/uiV2.js +190 -0
  20. package/dist/esm/builder.js +1 -1
  21. package/dist/esm/index.js +1 -1
  22. package/dist/esm/index.liquid.js +1 -1
  23. package/dist/esm/product/components/ProductBundle/common/styles.js +23 -7
  24. package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.js +2 -1
  25. package/dist/esm/product/components/ProductBundle/components/ProductBundleDiscountChildrenItem.liquid.js +1 -1
  26. package/dist/esm/product/components/ProductBundle/setting/ProductBundleDiscount.js +47 -415
  27. package/dist/esm/product/components/ProductBundle/setting/uiV1.js +400 -0
  28. package/dist/esm/product/components/ProductBundle/setting/uiV2.js +724 -0
  29. package/dist/esm/product/components/ProductDiscountTag/common/getClasses.js +33 -0
  30. package/dist/esm/product/components/ProductDiscountTag/common/getStyle.js +38 -0
  31. package/dist/esm/product/components/ProductDiscountTag/hooks/useGpDiscountTag.js +106 -0
  32. package/dist/esm/product/components/ProductDiscountTag/index.js +106 -0
  33. package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +87 -0
  34. package/dist/esm/product/next.js +1 -1
  35. package/dist/esm/product/setting/ProductTag.js +7 -299
  36. package/dist/esm/product/setting/product-discount-tag/configs/settings.js +189 -0
  37. package/dist/esm/product/setting/product-discount-tag/configs/uiV2.js +188 -0
  38. package/dist/types/index.d.ts +2 -0
  39. package/package.json +1 -1
  40. package/dist/cjs/product/components/ProductTag/ProductTag.js +0 -200
  41. package/dist/cjs/product/components/ProductTag/ProductTag.liquid.js +0 -107
  42. package/dist/esm/product/components/ProductTag/ProductTag.js +0 -196
  43. package/dist/esm/product/components/ProductTag/ProductTag.liquid.js +0 -103
@@ -1,306 +1,14 @@
1
+ import { SettingUIV2 } from './product-discount-tag/configs/uiV2.js';
2
+ import { ProductDiscountTagSettings } from './product-discount-tag/configs/settings.js';
3
+ import { SettingUIV1 } from './product/configs/uiV1.js';
4
+
1
5
  const config = {
2
6
  tag: 'ProductTag',
3
7
  label: 'Discount Tag',
4
8
  icon: `<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M19.75 2A2.25 2.25 0 0 1 22 4.25v5.462a3.25 3.25 0 0 1-.952 2.298l-8.5 8.503a3.255 3.255 0 0 1-4.597.001L3.489 16.06a3.25 3.25 0 0 1-.003-4.596l8.5-8.51A3.25 3.25 0 0 1 14.284 2h5.465Zm0 1.5h-5.465c-.465 0-.91.185-1.239.513l-8.512 8.523a1.75 1.75 0 0 0 .015 2.462l4.461 4.454a1.755 1.755 0 0 0 2.477 0l8.5-8.503a1.75 1.75 0 0 0 .513-1.237V4.25a.75.75 0 0 0-.75-.75ZM17 5.502a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z"/></svg>`,
5
- settings: [
6
- {
7
- id: 'setting',
8
- // note: 'Product Tag won’t display on live page if Compare at price field is empty or lower than Price.',
9
- controls: [
10
- {
11
- id: 'customContent',
12
- label: 'Custom Content',
13
- type: 'custom-content',
14
- default: {
15
- prefix: 'SALE',
16
- suffix: 'OFF',
17
- unit: 'percentage'
18
- }
19
- },
20
- {
21
- id: 'translate',
22
- type: 'input',
23
- default: 'customContent'
24
- }
25
- ]
26
- },
27
- {
28
- id: 'style',
29
- controls: [
30
- {
31
- id: 'size',
32
- type: 'size-setting',
33
- devices: {
34
- desktop: {
35
- default: {
36
- width: 'Auto',
37
- height: 'Auto',
38
- padding: {
39
- type: 'small',
40
- top: '4px',
41
- left: '16px',
42
- bottom: '4px',
43
- right: '16px'
44
- }
45
- }
46
- }
47
- },
48
- settingConfig: {
49
- width: {
50
- displayOptions: [
51
- 'full',
52
- 'auto',
53
- 'default'
54
- ]
55
- },
56
- padding: {
57
- paddingConfig: {
58
- small: {
59
- vertical: '4px',
60
- horizontal: '16px'
61
- },
62
- medium: {
63
- vertical: '8px',
64
- horizontal: '24px'
65
- },
66
- large: {
67
- vertical: '16px',
68
- horizontal: '32px'
69
- },
70
- custom: {
71
- vertical: '0px',
72
- horizontal: '0px'
73
- }
74
- }
75
- }
76
- },
77
- hiddenSettings: [
78
- 'shape',
79
- 'gap'
80
- ]
81
- },
82
- {
83
- id: 'textContentAlign',
84
- label: 'Alignment',
85
- type: 'segment',
86
- options: [
87
- {
88
- label: 'Left',
89
- value: 'left',
90
- type: 'text',
91
- tooltip: 'Align left'
92
- },
93
- {
94
- label: 'Center',
95
- value: 'center',
96
- type: 'text',
97
- tooltip: 'Align center'
98
- },
99
- {
100
- label: 'Right',
101
- value: 'right',
102
- type: 'text',
103
- tooltip: 'Align right'
104
- },
105
- {
106
- label: 'Justify',
107
- value: 'justify',
108
- type: 'text',
109
- tooltip: 'Align justify'
110
- }
111
- ],
112
- devices: {
113
- desktop: {
114
- default: 'center'
115
- }
116
- }
117
- },
118
- {
119
- id: 'backgroundColor',
120
- type: 'colorpicker',
121
- label: 'Background Color',
122
- default: '#3C67FF'
123
- },
124
- {
125
- id: 'borderTag',
126
- type: 'border',
127
- label: 'Border',
128
- default: {
129
- borderType: 'none',
130
- border: 'none',
131
- borderWidth: '1px',
132
- width: '1px 1px 1px 1px',
133
- color: '#000000',
134
- isCustom: false
135
- }
136
- },
137
- {
138
- id: 'roundedTag',
139
- type: 'radius-preset',
140
- label: 'Border Radius',
141
- default: {
142
- radiusType: 'large'
143
- }
144
- },
145
- {
146
- id: 'textAlign',
147
- label: 'Alignment',
148
- type: 'segment',
149
- options: [
150
- {
151
- label: 'Left',
152
- value: 'left',
153
- type: 'align',
154
- tooltip: 'Align left'
155
- },
156
- {
157
- label: 'Center',
158
- value: 'center',
159
- type: 'align',
160
- tooltip: 'Align center'
161
- },
162
- {
163
- label: 'Right',
164
- value: 'right',
165
- type: 'align',
166
- tooltip: 'Align right'
167
- }
168
- ],
169
- devices: {
170
- desktop: {
171
- default: 'left'
172
- }
173
- }
174
- },
175
- {
176
- id: 'typo',
177
- type: 'typography-v2',
178
- default: {
179
- type: 'subheading-2',
180
- attrs: {
181
- color: '#FFFFFF'
182
- }
183
- },
184
- ignoreReRender: true
185
- }
186
- ]
187
- }
188
- ],
189
- ui: [
190
- {
191
- type: 'group',
192
- controls: [
193
- {
194
- type: 'control',
195
- label: {
196
- en: 'Tag'
197
- },
198
- options: {
199
- label: 'large'
200
- },
201
- setting: {
202
- id: 'customContent'
203
- },
204
- layout: 'vertical'
205
- }
206
- ]
207
- },
208
- {
209
- type: 'group',
210
- label: {
211
- en: 'Size'
212
- },
213
- controls: [
214
- {
215
- type: 'control',
216
- setting: {
217
- id: 'size'
218
- },
219
- layout: 'vertical'
220
- }
221
- ]
222
- },
223
- {
224
- type: 'control',
225
- label: {
226
- en: 'Text align'
227
- },
228
- setting: {
229
- id: 'textContentAlign'
230
- }
231
- },
232
- {
233
- type: 'control',
234
- label: {
235
- en: 'Background color'
236
- },
237
- options: {
238
- label: 'large'
239
- },
240
- setting: {
241
- id: 'backgroundColor'
242
- }
243
- },
244
- {
245
- type: 'group',
246
- options: {
247
- labelPosition: 'start'
248
- },
249
- label: {
250
- en: 'Border'
251
- },
252
- controls: [
253
- {
254
- type: 'control',
255
- options: {
256
- labelPosition: 'start'
257
- },
258
- label: {
259
- en: 'Border'
260
- },
261
- setting: {
262
- id: 'borderTag'
263
- }
264
- },
265
- {
266
- type: 'control',
267
- label: {
268
- en: 'Corner'
269
- },
270
- setting: {
271
- id: 'roundedTag'
272
- }
273
- }
274
- ]
275
- },
276
- {
277
- type: 'group',
278
- label: {
279
- en: 'Text'
280
- },
281
- controls: [
282
- {
283
- type: 'control',
284
- setting: {
285
- id: 'typo'
286
- },
287
- layout: 'vertical'
288
- }
289
- ]
290
- },
291
- {
292
- type: 'control',
293
- label: {
294
- en: 'Align'
295
- },
296
- options: {
297
- label: 'large'
298
- },
299
- setting: {
300
- id: 'textAlign'
301
- }
302
- }
303
- ],
9
+ settings: ProductDiscountTagSettings,
10
+ ui: SettingUIV1,
11
+ uiV2: SettingUIV2,
304
12
  presets: [
305
13
  {
306
14
  id: 'product-tag',
@@ -0,0 +1,189 @@
1
+ const ProductDiscountTagSettings = [
2
+ {
3
+ id: 'setting',
4
+ // note: 'Product Tag won’t display on live page if Compare at price field is empty or lower than Price.',
5
+ controls: [
6
+ {
7
+ id: 'customContent',
8
+ label: 'Custom Content',
9
+ type: 'custom-content',
10
+ default: {
11
+ prefix: 'SALE',
12
+ suffix: 'OFF',
13
+ unit: 'percentage'
14
+ }
15
+ },
16
+ {
17
+ id: 'translate',
18
+ type: 'input',
19
+ default: 'customContent'
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ id: 'style',
25
+ controls: [
26
+ {
27
+ id: 'size',
28
+ type: 'size-setting',
29
+ devices: {
30
+ desktop: {
31
+ default: {
32
+ width: 'Auto',
33
+ height: 'Auto',
34
+ padding: {
35
+ type: 'small',
36
+ top: '4px',
37
+ left: '16px',
38
+ bottom: '4px',
39
+ right: '16px'
40
+ }
41
+ }
42
+ }
43
+ },
44
+ settingConfig: {
45
+ width: {
46
+ displayOptions: [
47
+ 'full',
48
+ 'auto',
49
+ 'default'
50
+ ]
51
+ },
52
+ padding: {
53
+ paddingConfig: {
54
+ small: {
55
+ vertical: '4px',
56
+ horizontal: '16px'
57
+ },
58
+ medium: {
59
+ vertical: '8px',
60
+ horizontal: '24px'
61
+ },
62
+ large: {
63
+ vertical: '16px',
64
+ horizontal: '32px'
65
+ },
66
+ custom: {
67
+ vertical: '0px',
68
+ horizontal: '0px'
69
+ }
70
+ }
71
+ }
72
+ },
73
+ hiddenSettings: [
74
+ 'shape',
75
+ 'gap'
76
+ ]
77
+ },
78
+ {
79
+ id: 'textContentAlign',
80
+ label: 'Alignment',
81
+ type: 'option:value',
82
+ options: [
83
+ {
84
+ label: 'Left',
85
+ value: 'left',
86
+ type: 'text',
87
+ tooltip: 'Align left'
88
+ },
89
+ {
90
+ label: 'Center',
91
+ value: 'center',
92
+ type: 'text',
93
+ tooltip: 'Align center'
94
+ },
95
+ {
96
+ label: 'Right',
97
+ value: 'right',
98
+ type: 'text',
99
+ tooltip: 'Align right'
100
+ },
101
+ {
102
+ label: 'Justify',
103
+ value: 'justify',
104
+ type: 'text',
105
+ tooltip: 'Align justify'
106
+ }
107
+ ],
108
+ devices: {
109
+ desktop: {
110
+ default: 'center'
111
+ }
112
+ }
113
+ },
114
+ {
115
+ id: 'backgroundColor',
116
+ type: 'color-picker-v2',
117
+ label: 'Background Color',
118
+ default: '#3C67FF'
119
+ },
120
+ {
121
+ id: 'borderTag',
122
+ type: 'border',
123
+ label: 'Border',
124
+ default: {
125
+ borderType: 'none',
126
+ border: 'none',
127
+ borderWidth: '1px',
128
+ width: '1px 1px 1px 1px',
129
+ color: '#000000',
130
+ isCustom: false
131
+ }
132
+ },
133
+ {
134
+ id: 'roundedTag',
135
+ type: 'radius-preset',
136
+ label: 'Border Radius',
137
+ default: {
138
+ radiusType: 'large'
139
+ }
140
+ },
141
+ {
142
+ id: 'textAlign',
143
+ label: 'Alignment',
144
+ type: 'option:value',
145
+ options: [
146
+ {
147
+ label: 'Left',
148
+ value: 'left',
149
+ type: 'align',
150
+ tooltip: 'Align left',
151
+ iconName: 'gp-align-left'
152
+ },
153
+ {
154
+ label: 'Center',
155
+ value: 'center',
156
+ type: 'align',
157
+ tooltip: 'Align center',
158
+ iconName: 'gp-align-center'
159
+ },
160
+ {
161
+ label: 'Right',
162
+ value: 'right',
163
+ type: 'align',
164
+ tooltip: 'Align right',
165
+ iconName: 'gp-align-right'
166
+ }
167
+ ],
168
+ devices: {
169
+ desktop: {
170
+ default: 'left'
171
+ }
172
+ }
173
+ },
174
+ {
175
+ id: 'typo',
176
+ type: 'typography-v2',
177
+ default: {
178
+ type: 'subheading-2',
179
+ attrs: {
180
+ color: '#FFFFFF'
181
+ }
182
+ },
183
+ ignoreReRender: true
184
+ }
185
+ ]
186
+ }
187
+ ];
188
+
189
+ export { ProductDiscountTagSettings };
@@ -0,0 +1,188 @@
1
+ const SettingUIV2 = [
2
+ {
3
+ controls: [
4
+ {
5
+ label: {
6
+ en: 'Tag'
7
+ },
8
+ setting: {
9
+ id: 'customContent'
10
+ },
11
+ layout: 'vertical',
12
+ options: {
13
+ labelVariant: 'primary'
14
+ }
15
+ }
16
+ ]
17
+ },
18
+ {
19
+ label: {
20
+ en: 'Size'
21
+ },
22
+ controls: [
23
+ {
24
+ label: {
25
+ en: 'Width'
26
+ },
27
+ controlConfig: {
28
+ id: 'width',
29
+ type: 'dropdown:input',
30
+ units: [
31
+ 'px',
32
+ '%'
33
+ ],
34
+ linkWithSetting: {
35
+ name: 'size',
36
+ field: 'width'
37
+ },
38
+ displayOptions: [
39
+ {
40
+ label: 'Fit content',
41
+ value: 'Auto',
42
+ showValue: true
43
+ },
44
+ {
45
+ label: 'Full',
46
+ value: '100%',
47
+ showValue: true
48
+ },
49
+ {
50
+ label: 'Default',
51
+ value: 'default',
52
+ showValue: true
53
+ }
54
+ ]
55
+ }
56
+ },
57
+ {
58
+ id: 'height',
59
+ label: {
60
+ en: 'Height'
61
+ },
62
+ controlConfig: {
63
+ id: 'height',
64
+ type: 'dropdown:input',
65
+ label: 'Height',
66
+ units: [
67
+ 'px',
68
+ '%'
69
+ ],
70
+ linkWithSetting: {
71
+ name: 'size',
72
+ field: 'height'
73
+ }
74
+ },
75
+ layout: 'horizontal'
76
+ },
77
+ {
78
+ label: {
79
+ en: 'Padding'
80
+ },
81
+ controlConfig: {
82
+ id: 'padding',
83
+ type: 'padding-v2',
84
+ linkWithSetting: {
85
+ name: 'size',
86
+ field: 'padding'
87
+ }
88
+ }
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ label: {
94
+ en: 'Background'
95
+ },
96
+ controls: [
97
+ {
98
+ label: {
99
+ en: 'Color'
100
+ },
101
+ setting: {
102
+ id: 'backgroundColor'
103
+ }
104
+ }
105
+ ]
106
+ },
107
+ {
108
+ label: {
109
+ en: 'Shape'
110
+ },
111
+ controls: [
112
+ {
113
+ label: {
114
+ en: 'Border'
115
+ },
116
+ setting: {
117
+ id: 'borderTag'
118
+ }
119
+ },
120
+ {
121
+ label: {
122
+ en: 'Corner'
123
+ },
124
+ setting: {
125
+ id: 'roundedTag'
126
+ }
127
+ }
128
+ ]
129
+ },
130
+ {
131
+ label: {
132
+ en: 'Text style'
133
+ },
134
+ controls: [
135
+ {
136
+ setting: {
137
+ id: 'typo'
138
+ },
139
+ layout: 'vertical',
140
+ options: {
141
+ hideLabel: true,
142
+ fullWidth: true,
143
+ updateFields: [
144
+ {
145
+ field: 'attrs.textAlign',
146
+ settingId: 'textContentAlign'
147
+ }
148
+ ]
149
+ },
150
+ controlChangeTrigger: {
151
+ settings: [
152
+ {
153
+ action: {
154
+ controlId: 'textContentAlign',
155
+ valueFromField: 'attrs.textAlign',
156
+ groupType: 'style',
157
+ controlType: 'style'
158
+ }
159
+ }
160
+ ],
161
+ options: {
162
+ noRecordHistory: true
163
+ }
164
+ }
165
+ }
166
+ ]
167
+ },
168
+ {
169
+ controls: [
170
+ {
171
+ label: {
172
+ en: 'Align'
173
+ },
174
+ setting: {
175
+ id: 'textAlign'
176
+ },
177
+ conditionEnable: '!(parseInt(size.width) >= 100 && size.width?.includes("%"))',
178
+ options: {
179
+ labelVariant: 'primary',
180
+ fullWidth: true,
181
+ disableMessage: `Align is not supported when width is 100%`
182
+ }
183
+ }
184
+ ]
185
+ }
186
+ ];
187
+
188
+ export { SettingUIV2 };
@@ -3968,6 +3968,7 @@ type ProductBundleDiscountProps = BasePropsWrap<{
3968
3968
  iconSpacing?: Property.Padding;
3969
3969
  bundleItems?: bundleItem[];
3970
3970
  useProductCompareAtPrice?: boolean;
3971
+ iconItemColor?: ColorValueType$1;
3971
3972
  }, {
3972
3973
  size?: ObjectDevices$1<SizeSettingGlobal>;
3973
3974
  backgroundColor?: StateProp<ColorValueType$1>;
@@ -3977,6 +3978,7 @@ type ProductBundleDiscountProps = BasePropsWrap<{
3977
3978
  borderBundle?: StateProp<Border>;
3978
3979
  roundedBundle?: StateProp<CornerRadius>;
3979
3980
  align?: string;
3981
+ itemSpacing?: Property.Padding;
3980
3982
  }> & {
3981
3983
  children: React.ReactNode[];
3982
3984
  rawChildren?: any[];