@gem-sdk/components 2.0.0-dev.351 → 2.0.0-dev.353

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 (49) hide show
  1. package/dist/cjs/article/setting/configs/ArticleAuthor/uiV2.js +9 -2
  2. package/dist/cjs/article/setting/configs/ArticleDate/uiV2.js +13 -6
  3. package/dist/cjs/article/setting/configs/ArticleExcerpt/settings.js +1 -1
  4. package/dist/cjs/article/setting/configs/ArticleExcerpt/uiV2.js +11 -1
  5. package/dist/cjs/article/setting/configs/ArticleImage/presets.js +3 -3
  6. package/dist/cjs/article/setting/configs/ArticleReadMore/presets.js +9 -9
  7. package/dist/cjs/article/setting/configs/ArticleReadMore/settings.js +4 -4
  8. package/dist/cjs/article/setting/configs/ArticleReadMore/uiV2.js +16 -12
  9. package/dist/cjs/stock-counter/components/StockCounter.js +104 -112
  10. package/dist/cjs/stock-counter/components/StockCounter.liquid.js +116 -141
  11. package/dist/cjs/stock-counter/components/common/getAttrs.js +44 -0
  12. package/dist/cjs/stock-counter/components/common/getClasses.js +68 -0
  13. package/dist/cjs/stock-counter/components/common/getContent.js +71 -0
  14. package/dist/cjs/stock-counter/components/common/getInlineCss.js +39 -0
  15. package/dist/cjs/stock-counter/components/common/getStyles.js +73 -0
  16. package/dist/cjs/stock-counter/components/hook/useStockCounter.js +37 -0
  17. package/dist/cjs/stock-counter/const.js +0 -6
  18. package/dist/cjs/stock-counter/helpers.js +0 -14
  19. package/dist/cjs/stock-counter/index.js +3 -1
  20. package/dist/cjs/stock-counter/setting/StockCounter.js +2 -2
  21. package/dist/cjs/stock-counter/setting/configs/presets.js +3 -0
  22. package/dist/cjs/stock-counter/setting/configs/{settings.js → settingsV2.js} +211 -42
  23. package/dist/cjs/stock-counter/setting/configs/uiV2.js +228 -41
  24. package/dist/esm/article/setting/configs/ArticleAuthor/uiV2.js +9 -2
  25. package/dist/esm/article/setting/configs/ArticleDate/uiV2.js +13 -6
  26. package/dist/esm/article/setting/configs/ArticleExcerpt/settings.js +1 -1
  27. package/dist/esm/article/setting/configs/ArticleExcerpt/uiV2.js +11 -1
  28. package/dist/esm/article/setting/configs/ArticleImage/presets.js +3 -3
  29. package/dist/esm/article/setting/configs/ArticleReadMore/presets.js +9 -9
  30. package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +4 -4
  31. package/dist/esm/article/setting/configs/ArticleReadMore/uiV2.js +16 -12
  32. package/dist/esm/stock-counter/components/StockCounter.js +106 -114
  33. package/dist/esm/stock-counter/components/StockCounter.liquid.js +116 -141
  34. package/dist/esm/stock-counter/components/common/getAttrs.js +39 -0
  35. package/dist/esm/stock-counter/components/common/getClasses.js +60 -0
  36. package/dist/esm/stock-counter/components/common/getContent.js +68 -0
  37. package/dist/esm/stock-counter/components/common/getInlineCss.js +37 -0
  38. package/dist/esm/stock-counter/components/common/getStyles.js +67 -0
  39. package/dist/esm/stock-counter/components/hook/useStockCounter.js +35 -0
  40. package/dist/esm/stock-counter/const.js +1 -4
  41. package/dist/esm/stock-counter/helpers.js +1 -14
  42. package/dist/esm/stock-counter/index.js +3 -1
  43. package/dist/esm/stock-counter/setting/StockCounter.js +2 -2
  44. package/dist/esm/stock-counter/setting/configs/presets.js +3 -0
  45. package/dist/esm/stock-counter/setting/configs/settingsV2.js +438 -0
  46. package/dist/esm/stock-counter/setting/configs/uiV2.js +228 -41
  47. package/dist/types/index.d.ts +13 -5
  48. package/package.json +1 -1
  49. package/dist/esm/stock-counter/setting/configs/settings.js +0 -269
@@ -0,0 +1,438 @@
1
+ import { DEFAULT_SCARCITY_THRESHOLD, DEFAULT_HIGHLIGHT_TAG, DEFAULT_QUANTITY_TEMPLATE, DEFAULT_REMAINING_PERCENT, MIN_REMAINING_PERCENT, MAX_REMAINING_PERCENT, DEFAULT_RANGE_STEP } from '../../const.js';
2
+
3
+ const StockCounterSettingsV2 = [
4
+ {
5
+ id: 'setting',
6
+ controls: [
7
+ {
8
+ id: 'layout',
9
+ label: 'layout',
10
+ type: 'layout-selector',
11
+ iconViewBox: '0 0 72 72',
12
+ enableItemBackground: true,
13
+ itemPerRow: 2,
14
+ itemSpacing: 'large',
15
+ popoverLabel: 'Type',
16
+ options: [
17
+ {
18
+ label: 'Full',
19
+ value: 'full',
20
+ type: 'p-image-layout',
21
+ iconName: 'gp-stock-counter-full'
22
+ },
23
+ {
24
+ label: 'Text & progress bar',
25
+ value: 'text-and-progress-bar',
26
+ type: 'p-image-layout',
27
+ iconName: 'gp-stock-counter-text-and-progress-bar'
28
+ },
29
+ {
30
+ label: 'Icon & Text',
31
+ value: 'icon-and-text',
32
+ type: 'p-image-layout',
33
+ iconName: 'gp-stock-counter-icon-and-text'
34
+ },
35
+ {
36
+ label: 'Text only',
37
+ value: 'text-only',
38
+ type: 'p-image-layout',
39
+ iconName: 'gp-stock-counter-text-only'
40
+ },
41
+ {
42
+ label: 'Progress bar only',
43
+ value: 'progress-bar',
44
+ type: 'p-image-layout',
45
+ iconName: 'gp-stock-counter-progress-bar'
46
+ }
47
+ ],
48
+ default: 'full'
49
+ },
50
+ {
51
+ id: 'source',
52
+ type: 'option:value',
53
+ options: [
54
+ {
55
+ value: 'built-in',
56
+ label: 'Shopify'
57
+ },
58
+ {
59
+ value: 'custom',
60
+ label: 'Custom'
61
+ }
62
+ ],
63
+ default: 'custom'
64
+ },
65
+ {
66
+ id: 'remaining',
67
+ type: 'input:number',
68
+ default: 16
69
+ },
70
+ {
71
+ id: 'displayCondition',
72
+ label: 'Display Condition',
73
+ type: 'group',
74
+ controls: [
75
+ {
76
+ id: 'displayByDefault',
77
+ label: 'Display By Default',
78
+ type: 'select',
79
+ options: [
80
+ {
81
+ label: 'Always show',
82
+ value: true
83
+ },
84
+ {
85
+ label: 'Show if under',
86
+ value: false
87
+ }
88
+ ],
89
+ default: true
90
+ },
91
+ {
92
+ id: 'scarcityThreshold',
93
+ label: 'Scarcity Threshold',
94
+ type: 'input:stepper',
95
+ default: DEFAULT_SCARCITY_THRESHOLD,
96
+ info: 'Only show if inventory quantity less than or equal to the above number.'
97
+ }
98
+ ]
99
+ },
100
+ {
101
+ id: 'oosIcon',
102
+ label: '',
103
+ type: 'icon',
104
+ default: `<svg width="100%" height="100%" viewBox="0 0 16 16" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> <path d="M7.75193 0.0658784C7.90565 -0.0219595 8.09435 -0.0219595 8.24807 0.0658784L11.9981 2.20874C12.1539 2.29776 12.25 2.46343 12.25 2.64286V6.63841L15.7481 8.63731C15.9039 8.72633 16 8.892 16 9.07143V13.3571C16 13.5366 15.9039 13.7022 15.7481 13.7913L11.9981 15.9341C11.8444 16.022 11.6556 16.022 11.5019 15.9341L8 13.933L4.49807 15.9341C4.34435 16.022 4.15565 16.022 4.00193 15.9341L0.25193 13.7913C0.096143 13.7022 0 13.5366 0 13.3571V9.07143C0 8.892 0.096143 8.72633 0.251931 8.63731L3.75 6.63841V2.64286C3.75 2.46343 3.84614 2.29776 4.00193 2.20874L7.75193 0.0658784ZM4.25 7.50445L1.50778 9.07143L4.25 10.6384L6.99222 9.07143L4.25 7.50445ZM7.5 9.93302L4.75 11.5044V14.6384L7.5 13.067V9.93302ZM8.5 13.067L11.25 14.6384V11.5044L8.5 9.93302V13.067ZM9.00778 9.07143L11.75 10.6384L14.4922 9.07143L11.75 7.50445L9.00778 9.07143ZM11.25 6.63841V3.50445L8.5 5.07588V8.20984L11.25 6.63841ZM7.5 8.20984V5.07588L4.75 3.50445V6.63841L7.5 8.20984ZM5.25778 2.64286L8 4.20984L10.7422 2.64286L8 1.07588L5.25778 2.64286ZM15 9.93302L12.25 11.5044V14.6384L15 13.067V9.93302ZM3.75 14.6384V11.5044L1 9.93302V13.067L3.75 14.6384Z" fill="currentColor"/> </svg>`
105
+ },
106
+ {
107
+ id: 'hiddenCounterWhenOutOfStock',
108
+ type: 'select',
109
+ options: [
110
+ {
111
+ value: false,
112
+ label: 'Show message'
113
+ },
114
+ {
115
+ value: true,
116
+ label: 'Hide counter'
117
+ }
118
+ ],
119
+ default: false
120
+ },
121
+ {
122
+ id: 'message',
123
+ label: 'Message',
124
+ type: 'group',
125
+ controls: [
126
+ {
127
+ id: 'template',
128
+ label: 'Template',
129
+ type: 'textarea',
130
+ autoHeight: true,
131
+ showPlusBtn: true,
132
+ default: `<${DEFAULT_HIGHLIGHT_TAG}>HURRY!</${DEFAULT_HIGHLIGHT_TAG}> ONLY ${DEFAULT_QUANTITY_TEMPLATE} LEFT`,
133
+ info: `Use ${DEFAULT_QUANTITY_TEMPLATE} to represent remaining number`,
134
+ suggestContents: [
135
+ {
136
+ message: '%number%',
137
+ eg: ' Only 2 left'
138
+ }
139
+ ]
140
+ },
141
+ {
142
+ id: 'outOfStockMessage',
143
+ label: 'Out Of Stock Message',
144
+ type: 'input',
145
+ default: 'OUT OF STOCK'
146
+ },
147
+ {
148
+ id: 'continueSelling',
149
+ label: 'Continue Selling When Out Of Stock Message',
150
+ type: 'textarea',
151
+ autoHeight: true,
152
+ default: '<mark>Restock soon!</mark> PREORDER NOW',
153
+ info: 'Turn out-of-stock productions into pre-orders'
154
+ },
155
+ {
156
+ id: 'unlimitedQuantityMessage',
157
+ label: 'Unlimited Quantity Message',
158
+ type: 'textarea',
159
+ autoHeight: true,
160
+ default: '<mark>HURRY!</mark> LET BUY NOW'
161
+ }
162
+ ]
163
+ },
164
+ {
165
+ id: 'icon',
166
+ label: 'Icon',
167
+ type: 'group',
168
+ controls: [
169
+ {
170
+ id: 'showIcon',
171
+ label: 'Show Icon',
172
+ type: 'toggle',
173
+ default: true
174
+ },
175
+ {
176
+ id: 'icon',
177
+ label: '',
178
+ type: 'icon',
179
+ default: `<svg style="width: 100%; height: 100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"> <path fill="currentColor" strokeLinecap="round" strokeLinejoin="round" fill="currentColor" d="M176.64 11.488A16 16 0 0 1 192 0h128a16 16 0 0 1 15.168 21.056L278.208 192H400a16 16 0 0 1 12.64 25.824l-224 288a16 16 0 0 1 -27.936 -14.528L218.336 304H112a16 16 0 0 1 -15.36 -20.512l80 -272z" /></svg>`
180
+ }
181
+ ]
182
+ },
183
+ {
184
+ id: 'progressBarPosition',
185
+ type: 'option:value',
186
+ options: [
187
+ {
188
+ value: 'top',
189
+ label: 'Top'
190
+ },
191
+ {
192
+ value: 'bottom',
193
+ label: 'Bottom'
194
+ }
195
+ ],
196
+ default: 'bottom'
197
+ },
198
+ {
199
+ id: 'iconPosition',
200
+ type: 'option:value',
201
+ options: [
202
+ {
203
+ value: 'left',
204
+ label: 'Left'
205
+ },
206
+ {
207
+ value: 'right',
208
+ label: 'Right'
209
+ }
210
+ ],
211
+ default: 'left'
212
+ },
213
+ {
214
+ id: 'iconSize',
215
+ type: 'input:stepper',
216
+ devices: {
217
+ desktop: {
218
+ default: 16
219
+ }
220
+ }
221
+ },
222
+ {
223
+ id: 'remainingPercentage',
224
+ label: 'Remaining Percentage (%)',
225
+ type: 'input:slider',
226
+ default: DEFAULT_REMAINING_PERCENT,
227
+ min: MIN_REMAINING_PERCENT,
228
+ max: MAX_REMAINING_PERCENT,
229
+ step: DEFAULT_RANGE_STEP,
230
+ units: [
231
+ '%'
232
+ ],
233
+ useOnlyUnitInit: true
234
+ }
235
+ ]
236
+ },
237
+ {
238
+ id: 'style',
239
+ controls: [
240
+ {
241
+ id: 'dimension',
242
+ label: 'Dimension',
243
+ type: 'group',
244
+ controls: [
245
+ {
246
+ id: 'fullWidth',
247
+ label: 'Full width',
248
+ type: 'toggle',
249
+ devices: {
250
+ desktop: {
251
+ default: true
252
+ }
253
+ }
254
+ },
255
+ {
256
+ id: 'width',
257
+ label: 'Width',
258
+ type: 'input:unit',
259
+ units: [
260
+ 'px',
261
+ '%'
262
+ ],
263
+ devices: {
264
+ desktop: {
265
+ default: '100%'
266
+ }
267
+ }
268
+ },
269
+ {
270
+ id: 'alignment',
271
+ label: 'Alignment',
272
+ type: 'option:value',
273
+ options: [
274
+ {
275
+ label: 'Left',
276
+ value: 'left',
277
+ type: 'align',
278
+ tooltip: 'Align left',
279
+ iconName: 'gp-align-left'
280
+ },
281
+ {
282
+ label: 'Center',
283
+ value: 'center',
284
+ type: 'align',
285
+ tooltip: 'Align center',
286
+ iconName: 'gp-align-center'
287
+ },
288
+ {
289
+ label: 'Right',
290
+ value: 'right',
291
+ type: 'align',
292
+ tooltip: 'Align right',
293
+ iconName: 'gp-align-right'
294
+ }
295
+ ],
296
+ devices: {
297
+ desktop: {
298
+ default: 'left'
299
+ }
300
+ }
301
+ }
302
+ ]
303
+ },
304
+ {
305
+ id: 'display',
306
+ label: 'Display',
307
+ type: 'group',
308
+ controls: [
309
+ {
310
+ id: 'typo',
311
+ type: 'typography-v2',
312
+ label: 'Typography',
313
+ default: {
314
+ type: 'paragraph-1',
315
+ attrs: {
316
+ color: 'text-1'
317
+ }
318
+ },
319
+ ignoreReRender: true,
320
+ hiddenSetting: {
321
+ textAlign: true
322
+ }
323
+ },
324
+ {
325
+ id: 'textColor',
326
+ label: 'Text Color',
327
+ type: 'color-picker-v2',
328
+ default: 'text-1'
329
+ },
330
+ {
331
+ id: 'color',
332
+ label: 'Color',
333
+ type: 'color-picker-v2',
334
+ default: 'line-3'
335
+ },
336
+ {
337
+ id: 'iconColor',
338
+ label: 'Color',
339
+ type: 'color-picker-v2',
340
+ default: 'text-2'
341
+ },
342
+ {
343
+ id: 'oosIconColor',
344
+ label: 'Color',
345
+ type: 'color-picker-v2'
346
+ },
347
+ {
348
+ id: 'oosTextColor',
349
+ label: 'Color',
350
+ type: 'color-picker-v2'
351
+ }
352
+ ]
353
+ },
354
+ {
355
+ id: 'progressBar',
356
+ label: 'Progress Bar',
357
+ type: 'group',
358
+ controls: [
359
+ {
360
+ id: 'displayProgressBar',
361
+ label: 'Display',
362
+ type: 'toggle',
363
+ default: true
364
+ },
365
+ {
366
+ id: 'progressBarHeight',
367
+ type: 'input:stepper',
368
+ min: 5,
369
+ max: 20,
370
+ devices: {
371
+ desktop: {
372
+ default: 10
373
+ }
374
+ }
375
+ },
376
+ {
377
+ id: 'roundedBorder',
378
+ label: 'Rounded Border',
379
+ type: 'toggle',
380
+ default: true
381
+ },
382
+ {
383
+ id: 'effect',
384
+ label: 'Effect',
385
+ type: 'toggle',
386
+ default: true
387
+ }
388
+ ]
389
+ },
390
+ {
391
+ id: 'borderRadius',
392
+ type: 'corner-v2',
393
+ devices: {
394
+ desktop: {
395
+ default: {
396
+ btrr: '99999px',
397
+ bblr: '99999px',
398
+ bbrr: '99999px',
399
+ btlr: '99999px',
400
+ radiusType: 'circle'
401
+ }
402
+ },
403
+ tablet: {
404
+ default: {
405
+ btrr: '99999px',
406
+ bblr: '99999px',
407
+ bbrr: '99999px',
408
+ btlr: '99999px',
409
+ radiusType: 'circle'
410
+ }
411
+ },
412
+ mobile: {
413
+ default: {
414
+ btrr: '99999px',
415
+ bblr: '99999px',
416
+ bbrr: '99999px',
417
+ btlr: '99999px',
418
+ radiusType: 'circle'
419
+ }
420
+ }
421
+ },
422
+ compoDefaultValue: {
423
+ desktop: {
424
+ default: {
425
+ btrr: '99999px',
426
+ bblr: '99999px',
427
+ bbrr: '99999px',
428
+ btlr: '99999px',
429
+ radiusType: 'circle'
430
+ }
431
+ }
432
+ }
433
+ }
434
+ ]
435
+ }
436
+ ];
437
+
438
+ export { StockCounterSettingsV2 };