@gem-sdk/components 2.0.0-dev.527 → 2.0.0-dev.529

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.
@@ -18,6 +18,7 @@ const getBreadcrumbChildItemStyles = (args)=>{
18
18
  ...core.makeStyle({
19
19
  c: core.getSingleColorVariable(isLastItem ? labelColor?.active : labelColor?.normal)
20
20
  }),
21
+ ...core.removeNullUndefined(index.makeStyleStateConditionActive('weight', fontWeight, isLastItem)),
21
22
  ...appendTypoStyle,
22
23
  ...isLastItem ? core.removeNullUndefined(index.makeStyleStateConditionActive('weight', fontWeight, isLastItem)) : {}
23
24
  };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const getLiquidTagAttrs = (builderProps, setting, styles)=>{
4
- const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock, remaining, source } = setting ?? {};
4
+ const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
5
5
  const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
6
6
  const mainColor = textColor || 'brand';
7
7
  const typoColor = typo?.attrs?.color;
@@ -20,9 +20,7 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
20
20
  color: mainColor,
21
21
  hiddenCounterWhenOutOfStock,
22
22
  oosTextColor,
23
- typoColor,
24
- remaining,
25
- source
23
+ typoColor
26
24
  }).replaceAll(`"`, '"')
27
25
  };
28
26
  };
@@ -5,7 +5,7 @@ var _const = require('../../const.js');
5
5
  var helpers = require('../../helpers.js');
6
6
 
7
7
  const getLiquidTextContent = (setting, styles)=>{
8
- const { template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, remaining = 16, source = 'custom' } = setting ?? {};
8
+ const { template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage } = setting ?? {};
9
9
  const { textColor } = styles ?? {};
10
10
  const mainColor = textColor || 'brand';
11
11
  return `{% if inventory_management == null or inventory_management != "shopify" and inventory_quantity <= 0 %}
@@ -15,7 +15,7 @@ const getLiquidTextContent = (setting, styles)=>{
15
15
  {% elsif available and inventory_policy == '${_const.CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}' and inventory_quantity <= 0 %}
16
16
  ${helpers.transformHighlighTag(continueSelling || '', mainColor)}
17
17
  {% else %}
18
- ${helpers.transformHighlighTag(helpers.transformNumberTag(templateString || '', mainColor, source === 'custom' ? remaining : `{{ inventory_quantity }}`), mainColor)}
18
+ ${helpers.transformHighlighTag(helpers.transformNumberTag(templateString || '', mainColor, `{{ inventory_quantity }}`), mainColor)}
19
19
  {% endif %}`;
20
20
  };
21
21
  const getLiquidInitData = (setting, styles)=>{
@@ -43,7 +43,9 @@ const getIconStyles = (styles, setting, isOutOfStock)=>{
43
43
  ...core.makeStyle({
44
44
  c: core.getSingleColorVariable(isOutOfStock ? oosIconColor : iconColor)
45
45
  }),
46
- ...core.makeStyleResponsive('w', core.makeWidth(iconSize), 'px')
46
+ ...core.makeStyleResponsive('w', core.makeWidth(iconSize || {
47
+ desktop: 16
48
+ }), 'px')
47
49
  };
48
50
  };
49
51
  const getTextStyles = (styles, isOutOfStock)=>{
@@ -6,7 +6,7 @@ var _const = require('../../const.js');
6
6
  var helpers = require('../../helpers.js');
7
7
 
8
8
  const useStockCounter = (setting, styles)=>{
9
- const { template, outOfStockMessage, continueSelling, unlimitedQuantityMessage, source = 'custom', remaining = 16 } = setting ?? {};
9
+ const { template, outOfStockMessage, continueSelling, unlimitedQuantityMessage } = setting ?? {};
10
10
  const { textColor } = styles ?? {};
11
11
  const mainColor = textColor || 'brand';
12
12
  const variant = core.useCurrentVariant();
@@ -24,8 +24,7 @@ const useStockCounter = (setting, styles)=>{
24
24
  if (isUnlimitedQuantity) return helpers.transformHighlighTag(unlimitedQuantityMessage, mainColor);
25
25
  if (isOutOfStock) return helpers.transformHighlighTag(outOfStockMessage || '', mainColor);
26
26
  if (isContinueShopping) return helpers.transformHighlighTag(continueSelling || '', mainColor);
27
- const quantity = source === 'custom' ? remaining : inventoryQuantity;
28
- return helpers.transformHighlighTag(helpers.transformNumberTag(template || '', mainColor, quantity), mainColor);
27
+ return helpers.transformHighlighTag(helpers.transformNumberTag(template || '', mainColor, inventoryQuantity), mainColor);
29
28
  }
30
29
  return {
31
30
  getMessage,
@@ -50,26 +50,6 @@ const StockCounterSettingsV2 = [
50
50
  ],
51
51
  default: 'full'
52
52
  },
53
- {
54
- id: 'source',
55
- type: 'option:value',
56
- options: [
57
- {
58
- value: 'built-in',
59
- label: 'Shopify'
60
- },
61
- {
62
- value: 'custom',
63
- label: 'Custom'
64
- }
65
- ],
66
- default: 'custom'
67
- },
68
- {
69
- id: 'remaining',
70
- type: 'input:stepper',
71
- default: 4
72
- },
73
53
  {
74
54
  id: 'displayCondition',
75
55
  label: 'Display Condition',
@@ -348,12 +328,14 @@ const StockCounterSettingsV2 = [
348
328
  {
349
329
  id: 'oosIconColor',
350
330
  label: 'Color',
351
- type: 'color-picker-v2'
331
+ type: 'color-picker-v2',
332
+ default: '#DDDDDD'
352
333
  },
353
334
  {
354
335
  id: 'oosTextColor',
355
336
  label: 'Color',
356
- type: 'color-picker-v2'
337
+ type: 'color-picker-v2',
338
+ default: '#DDDDDD'
357
339
  }
358
340
  ]
359
341
  },
@@ -69,32 +69,6 @@ const SettingUIV2 = [
69
69
  }
70
70
  ]
71
71
  },
72
- {
73
- label: {
74
- en: 'Stock'
75
- },
76
- controls: [
77
- {
78
- label: {
79
- en: 'Source'
80
- },
81
- setting: {
82
- id: 'source'
83
- },
84
- layout: 'horizontal'
85
- },
86
- {
87
- conditionDisplay: 'source === "custom"',
88
- label: {
89
- en: 'Remaining'
90
- },
91
- setting: {
92
- id: 'remaining'
93
- },
94
- layout: 'horizontal'
95
- }
96
- ]
97
- },
98
72
  {
99
73
  controls: [
100
74
  {
@@ -16,6 +16,7 @@ const getBreadcrumbChildItemStyles = (args)=>{
16
16
  ...makeStyle({
17
17
  c: getSingleColorVariable(isLastItem ? labelColor?.active : labelColor?.normal)
18
18
  }),
19
+ ...removeNullUndefined(makeStyleStateConditionActive('weight', fontWeight, isLastItem)),
19
20
  ...appendTypoStyle,
20
21
  ...isLastItem ? removeNullUndefined(makeStyleStateConditionActive('weight', fontWeight, isLastItem)) : {}
21
22
  };
@@ -1,5 +1,5 @@
1
1
  const getLiquidTagAttrs = (builderProps, setting, styles)=>{
2
- const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock, remaining, source } = setting ?? {};
2
+ const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
3
3
  const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
4
4
  const mainColor = textColor || 'brand';
5
5
  const typoColor = typo?.attrs?.color;
@@ -18,9 +18,7 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
18
18
  color: mainColor,
19
19
  hiddenCounterWhenOutOfStock,
20
20
  oosTextColor,
21
- typoColor,
22
- remaining,
23
- source
21
+ typoColor
24
22
  }).replaceAll(`"`, '&#34;')
25
23
  };
26
24
  };
@@ -3,7 +3,7 @@ import { CONTINUE_SELLING_WHEN_OUT_OF_STOCK } from '../../const.js';
3
3
  import { transformHighlighTag, transformNumberTag } from '../../helpers.js';
4
4
 
5
5
  const getLiquidTextContent = (setting, styles)=>{
6
- const { template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, remaining = 16, source = 'custom' } = setting ?? {};
6
+ const { template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage } = setting ?? {};
7
7
  const { textColor } = styles ?? {};
8
8
  const mainColor = textColor || 'brand';
9
9
  return `{% if inventory_management == null or inventory_management != "shopify" and inventory_quantity <= 0 %}
@@ -13,7 +13,7 @@ const getLiquidTextContent = (setting, styles)=>{
13
13
  {% elsif available and inventory_policy == '${CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}' and inventory_quantity <= 0 %}
14
14
  ${transformHighlighTag(continueSelling || '', mainColor)}
15
15
  {% else %}
16
- ${transformHighlighTag(transformNumberTag(templateString || '', mainColor, source === 'custom' ? remaining : `{{ inventory_quantity }}`), mainColor)}
16
+ ${transformHighlighTag(transformNumberTag(templateString || '', mainColor, `{{ inventory_quantity }}`), mainColor)}
17
17
  {% endif %}`;
18
18
  };
19
19
  const getLiquidInitData = (setting, styles)=>{
@@ -41,7 +41,9 @@ const getIconStyles = (styles, setting, isOutOfStock)=>{
41
41
  ...makeStyle({
42
42
  c: getSingleColorVariable(isOutOfStock ? oosIconColor : iconColor)
43
43
  }),
44
- ...makeStyleResponsive('w', makeWidth(iconSize), 'px')
44
+ ...makeStyleResponsive('w', makeWidth(iconSize || {
45
+ desktop: 16
46
+ }), 'px')
45
47
  };
46
48
  };
47
49
  const getTextStyles = (styles, isOutOfStock)=>{
@@ -4,7 +4,7 @@ import { NO_PRODUCT_LEFT, CONTINUE_SELLING_WHEN_OUT_OF_STOCK } from '../../const
4
4
  import { transformHighlighTag, transformNumberTag } from '../../helpers.js';
5
5
 
6
6
  const useStockCounter = (setting, styles)=>{
7
- const { template, outOfStockMessage, continueSelling, unlimitedQuantityMessage, source = 'custom', remaining = 16 } = setting ?? {};
7
+ const { template, outOfStockMessage, continueSelling, unlimitedQuantityMessage } = setting ?? {};
8
8
  const { textColor } = styles ?? {};
9
9
  const mainColor = textColor || 'brand';
10
10
  const variant = useCurrentVariant();
@@ -22,8 +22,7 @@ const useStockCounter = (setting, styles)=>{
22
22
  if (isUnlimitedQuantity) return transformHighlighTag(unlimitedQuantityMessage, mainColor);
23
23
  if (isOutOfStock) return transformHighlighTag(outOfStockMessage || '', mainColor);
24
24
  if (isContinueShopping) return transformHighlighTag(continueSelling || '', mainColor);
25
- const quantity = source === 'custom' ? remaining : inventoryQuantity;
26
- return transformHighlighTag(transformNumberTag(template || '', mainColor, quantity), mainColor);
25
+ return transformHighlighTag(transformNumberTag(template || '', mainColor, inventoryQuantity), mainColor);
27
26
  }
28
27
  return {
29
28
  getMessage,
@@ -48,26 +48,6 @@ const StockCounterSettingsV2 = [
48
48
  ],
49
49
  default: 'full'
50
50
  },
51
- {
52
- id: 'source',
53
- type: 'option:value',
54
- options: [
55
- {
56
- value: 'built-in',
57
- label: 'Shopify'
58
- },
59
- {
60
- value: 'custom',
61
- label: 'Custom'
62
- }
63
- ],
64
- default: 'custom'
65
- },
66
- {
67
- id: 'remaining',
68
- type: 'input:stepper',
69
- default: 4
70
- },
71
51
  {
72
52
  id: 'displayCondition',
73
53
  label: 'Display Condition',
@@ -346,12 +326,14 @@ const StockCounterSettingsV2 = [
346
326
  {
347
327
  id: 'oosIconColor',
348
328
  label: 'Color',
349
- type: 'color-picker-v2'
329
+ type: 'color-picker-v2',
330
+ default: '#DDDDDD'
350
331
  },
351
332
  {
352
333
  id: 'oosTextColor',
353
334
  label: 'Color',
354
- type: 'color-picker-v2'
335
+ type: 'color-picker-v2',
336
+ default: '#DDDDDD'
355
337
  }
356
338
  ]
357
339
  },
@@ -67,32 +67,6 @@ const SettingUIV2 = [
67
67
  }
68
68
  ]
69
69
  },
70
- {
71
- label: {
72
- en: 'Stock'
73
- },
74
- controls: [
75
- {
76
- label: {
77
- en: 'Source'
78
- },
79
- setting: {
80
- id: 'source'
81
- },
82
- layout: 'horizontal'
83
- },
84
- {
85
- conditionDisplay: 'source === "custom"',
86
- label: {
87
- en: 'Remaining'
88
- },
89
- setting: {
90
- id: 'remaining'
91
- },
92
- layout: 'horizontal'
93
- }
94
- ]
95
- },
96
70
  {
97
71
  controls: [
98
72
  {
@@ -5587,8 +5587,6 @@ type StockCounterSettings = {
5587
5587
  unlimitedQuantityMessage?: string;
5588
5588
  translate?: string;
5589
5589
  layout?: 'full' | 'text-and-progress-bar' | 'icon-and-text' | 'progress-bar' | 'text-only';
5590
- source?: 'custom' | 'built-in';
5591
- remaining?: number;
5592
5590
  oosIcon?: string;
5593
5591
  progressBarPosition?: 'top' | 'bottom';
5594
5592
  iconPosition?: 'left' | 'right';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.527",
3
+ "version": "2.0.0-dev.529",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",