@gem-sdk/components 2.0.0-dev.486 → 2.0.0-dev.488

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 (25) hide show
  1. package/dist/cjs/article/setting/configs/ArticleContent/settings.js +1 -1
  2. package/dist/cjs/article/setting/configs/ArticleDate/settings.js +1 -1
  3. package/dist/cjs/article/setting/configs/ArticleDate/uiV2.js +5 -0
  4. package/dist/cjs/article/setting/configs/ArticleExcerpt/settings.js +1 -1
  5. package/dist/cjs/article/setting/configs/ArticleList/presets.js +4 -4
  6. package/dist/cjs/article/setting/configs/ArticleTag/settings.js +1 -1
  7. package/dist/cjs/article/setting/configs/ArticleTitle/settings.js +1 -1
  8. package/dist/cjs/stock-counter/components/StockCounter.js +13 -0
  9. package/dist/cjs/stock-counter/components/StockCounter.liquid.js +43 -5
  10. package/dist/cjs/stock-counter/components/common/getAttrs.js +7 -0
  11. package/dist/cjs/stock-counter/components/common/getContent.js +2 -0
  12. package/dist/cjs/tab/components/common/getClasses.js +1 -1
  13. package/dist/esm/article/setting/configs/ArticleContent/settings.js +1 -1
  14. package/dist/esm/article/setting/configs/ArticleDate/settings.js +1 -1
  15. package/dist/esm/article/setting/configs/ArticleDate/uiV2.js +5 -0
  16. package/dist/esm/article/setting/configs/ArticleExcerpt/settings.js +1 -1
  17. package/dist/esm/article/setting/configs/ArticleList/presets.js +4 -4
  18. package/dist/esm/article/setting/configs/ArticleTag/settings.js +1 -1
  19. package/dist/esm/article/setting/configs/ArticleTitle/settings.js +1 -1
  20. package/dist/esm/stock-counter/components/StockCounter.js +14 -1
  21. package/dist/esm/stock-counter/components/StockCounter.liquid.js +45 -7
  22. package/dist/esm/stock-counter/components/common/getAttrs.js +7 -1
  23. package/dist/esm/stock-counter/components/common/getContent.js +2 -0
  24. package/dist/esm/tab/components/common/getClasses.js +1 -1
  25. package/package.json +1 -1
@@ -90,7 +90,7 @@ const ArticleContentSettings = [
90
90
  label: 'Text Color',
91
91
  type: 'colorpicker',
92
92
  default: {
93
- normal: 'text-2'
93
+ normal: 'text-1'
94
94
  },
95
95
  state: {
96
96
  normal: true,
@@ -137,7 +137,7 @@ const ArticleDateSettings = [
137
137
  label: 'Text Color',
138
138
  type: 'colorpicker',
139
139
  default: {
140
- normal: 'text-2'
140
+ normal: 'text-1'
141
141
  },
142
142
  state: {
143
143
  normal: true,
@@ -18,6 +18,11 @@ const uiV2 = [
18
18
  hideLabel: true,
19
19
  fullWidth: true,
20
20
  updateFields: [
21
+ {
22
+ field: 'attrs.color',
23
+ settingId: 'color',
24
+ state: 'normal'
25
+ },
21
26
  {
22
27
  field: 'attrs.textAlign',
23
28
  settingId: 'textAlign'
@@ -127,7 +127,7 @@ const ArticleExcerptSettings = [
127
127
  label: 'Text Color',
128
128
  type: 'colorpicker',
129
129
  default: {
130
- normal: 'text-2'
130
+ normal: 'text-1'
131
131
  },
132
132
  state: {
133
133
  normal: true,
@@ -154,7 +154,7 @@ const ArticleListPresets = [
154
154
  }
155
155
  },
156
156
  color: {
157
- normal: 'text-2'
157
+ normal: 'text-1'
158
158
  }
159
159
  },
160
160
  advanced: {
@@ -206,7 +206,7 @@ const ArticleListPresets = [
206
206
  }
207
207
  },
208
208
  color: {
209
- normal: 'text-2'
209
+ normal: 'text-1'
210
210
  }
211
211
  },
212
212
  advanced: {
@@ -258,7 +258,7 @@ const ArticleListPresets = [
258
258
  }
259
259
  },
260
260
  color: {
261
- normal: 'text-2'
261
+ normal: 'text-1'
262
262
  }
263
263
  }
264
264
  }
@@ -280,7 +280,7 @@ const ArticleListPresets = [
280
280
  }
281
281
  },
282
282
  color: {
283
- normal: 'text-2'
283
+ normal: 'text-1'
284
284
  },
285
285
  textAlign: {
286
286
  desktop: 'left'
@@ -104,7 +104,7 @@ const ArticleTagSettings = [
104
104
  label: 'Text Color',
105
105
  type: 'colorpicker',
106
106
  default: {
107
- normal: 'text-2'
107
+ normal: 'text-1'
108
108
  },
109
109
  state: {
110
110
  normal: true,
@@ -184,7 +184,7 @@ const ArticleTitleSettings = [
184
184
  label: 'Text Color',
185
185
  type: 'color-picker-v2',
186
186
  default: {
187
- normal: 'text-2'
187
+ normal: 'text-1'
188
188
  },
189
189
  state: {
190
190
  normal: true,
@@ -53,6 +53,11 @@ const StockCounter = ({ setting, styles, builderProps })=>{
53
53
  ...getStyles.getIconStyles(styles, setting, isOutOfStock)
54
54
  });
55
55
  };
56
+ const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
57
+ return system.createStyle({
58
+ ...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
59
+ });
60
+ };
56
61
  const textClasses = (isOutOfStock)=>{
57
62
  return system.createClass({
58
63
  ...getClasses.getTextClasses(styles, isOutOfStock)
@@ -92,12 +97,20 @@ const StockCounter = ({ setting, styles, builderProps })=>{
92
97
  className: wrapperIconClasses,
93
98
  children: [
94
99
  showIcon && (isOutOfStock ? /*#__PURE__*/ jsxRuntime.jsx("div", {
100
+ ...iconAttrs({
101
+ isOutOfStockIcon: isOutOfStock,
102
+ isVisible: isOutOfStock
103
+ }),
95
104
  dangerouslySetInnerHTML: {
96
105
  __html: oosIcon || ''
97
106
  },
98
107
  className: iconClasses,
99
108
  style: iconStyles(true)
100
109
  }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
110
+ ...iconAttrs({
111
+ isOutOfStockIcon: !isOutOfStock,
112
+ isVisible: !isOutOfStock
113
+ }),
101
114
  dangerouslySetInnerHTML: {
102
115
  __html: icon || ''
103
116
  },
@@ -45,7 +45,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
45
45
  ...getClasses.getWrapperIconClasses(setting)
46
46
  });
47
47
  const iconClasses = system.createClass({
48
- ...core.composeClasses('gp-stock-counter-icon'),
48
+ ...core.composeClasses('gp-stock-counter-icon data-[visible=true]:gp-block data-[visible=false]:gp-hidden'),
49
49
  ...getClasses.getIconClasses()
50
50
  });
51
51
  const iconStyles = (isOutOfStock)=>{
@@ -53,6 +53,11 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
53
53
  ...getStyles.getIconStyles(styles, setting, isOutOfStock)
54
54
  });
55
55
  };
56
+ const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
57
+ return system.createStyle({
58
+ ...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
59
+ });
60
+ };
56
61
  const progressBarAttrs = system.createAttr({
57
62
  ...getAttrs.getLiquidProgressBarAttrs()
58
63
  });
@@ -83,21 +88,54 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
83
88
  >
84
89
  <div class="${wrapperIconClasses}">
85
90
  ${core.RenderIf(showIcon, core.template /* liquid */ `
86
- {% if is_out_of_stock %}
91
+ ${(system.LiquidIf('is_out_of_stock', core.template`<div
92
+ ${{
93
+ ...iconAttrs({
94
+ isOutOfStockIcon: true,
95
+ isVisible: true
96
+ })
97
+ }}
98
+ class="${iconClasses}"
99
+ style="${iconStyles(true)}"
100
+ >
101
+ ${oosIcon}
102
+ </div>
87
103
  <div
104
+ ${{
105
+ ...iconAttrs({
106
+ isOutOfStockIcon: false,
107
+ isVisible: false
108
+ })
109
+ }}
110
+ data-slot-type="false"
111
+ class="${iconClasses}"
112
+ style="${iconStyles(false)}"
113
+ >
114
+ ${icon}
115
+ </div>`), core.template` <div
116
+ ${{
117
+ ...iconAttrs({
118
+ isOutOfStockIcon: true,
119
+ isVisible: false
120
+ })
121
+ }}
88
122
  class="${iconClasses}"
89
123
  style="${iconStyles(true)}"
90
124
  >
91
125
  ${oosIcon}
92
126
  </div>
93
- {% else %}
94
127
  <div
128
+ ${{
129
+ ...iconAttrs({
130
+ isOutOfStockIcon: false,
131
+ isVisible: true
132
+ })
133
+ }}
95
134
  class="${iconClasses}"
96
135
  style="${iconStyles(false)}"
97
136
  >
98
137
  ${icon}
99
- </div>
100
- {% endif %}
138
+ </div>`)}
101
139
  `)}
102
140
  ${core.RenderIf(showText, core.template`
103
141
  {% if is_out_of_stock %}
@@ -37,7 +37,14 @@ const getWrapperAttrs = (builderProps)=>{
37
37
  'data-id': builderProps?.uid ?? ''
38
38
  };
39
39
  };
40
+ const getIconAttrs = (isOutOfStockIcon, isVisible)=>{
41
+ return {
42
+ 'data-slot-type': isOutOfStockIcon ? 'oos-icon' : 'has-stock-icon',
43
+ 'data-visible': isVisible ? 'true' : 'false'
44
+ };
45
+ };
40
46
 
47
+ exports.getIconAttrs = getIconAttrs;
41
48
  exports.getLiquidProgressBarAttrs = getLiquidProgressBarAttrs;
42
49
  exports.getLiquidTagAttrs = getLiquidTagAttrs;
43
50
  exports.getLiquidTextAttrs = getLiquidTextAttrs;
@@ -37,6 +37,8 @@ const getLiquidInitData = (setting, styles)=>{
37
37
 
38
38
  if inventory_management != null and available == false and inventory_quantity <= 0 and inventory_policy != '${_const.CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}'
39
39
  assign is_out_of_stock = true
40
+ else
41
+ assign is_out_of_stock = false
40
42
  endif
41
43
 
42
44
  if check_display == true
@@ -30,7 +30,7 @@ const getTabListClasses = ({ setting, ulClass })=>{
30
30
  };
31
31
  const getItemClasses = ({ setting, isNotLiquid, isActive, currentDevice })=>{
32
32
  const { labelBgColor, labelColor, position } = setting ?? {};
33
- let classList = 'gp-navs-tab gp-flex gp-flex-1 gp-cursor-pointer gp-py-2 gp-px-4 gp-whitespace-nowrap';
33
+ let classList = 'gp-tab-item gp-flex gp-flex-1 gp-cursor-pointer gp-py-2 gp-px-4 gp-whitespace-nowrap';
34
34
  if (isNotLiquid) {
35
35
  if (isActive) {
36
36
  classList += ` ${core.getGlobalColorClass('bg', labelBgColor?.active)} ${core.getGlobalColorClass('text', labelColor?.active)}`;
@@ -88,7 +88,7 @@ const ArticleContentSettings = [
88
88
  label: 'Text Color',
89
89
  type: 'colorpicker',
90
90
  default: {
91
- normal: 'text-2'
91
+ normal: 'text-1'
92
92
  },
93
93
  state: {
94
94
  normal: true,
@@ -135,7 +135,7 @@ const ArticleDateSettings = [
135
135
  label: 'Text Color',
136
136
  type: 'colorpicker',
137
137
  default: {
138
- normal: 'text-2'
138
+ normal: 'text-1'
139
139
  },
140
140
  state: {
141
141
  normal: true,
@@ -16,6 +16,11 @@ const uiV2 = [
16
16
  hideLabel: true,
17
17
  fullWidth: true,
18
18
  updateFields: [
19
+ {
20
+ field: 'attrs.color',
21
+ settingId: 'color',
22
+ state: 'normal'
23
+ },
19
24
  {
20
25
  field: 'attrs.textAlign',
21
26
  settingId: 'textAlign'
@@ -125,7 +125,7 @@ const ArticleExcerptSettings = [
125
125
  label: 'Text Color',
126
126
  type: 'colorpicker',
127
127
  default: {
128
- normal: 'text-2'
128
+ normal: 'text-1'
129
129
  },
130
130
  state: {
131
131
  normal: true,
@@ -152,7 +152,7 @@ const ArticleListPresets = [
152
152
  }
153
153
  },
154
154
  color: {
155
- normal: 'text-2'
155
+ normal: 'text-1'
156
156
  }
157
157
  },
158
158
  advanced: {
@@ -204,7 +204,7 @@ const ArticleListPresets = [
204
204
  }
205
205
  },
206
206
  color: {
207
- normal: 'text-2'
207
+ normal: 'text-1'
208
208
  }
209
209
  },
210
210
  advanced: {
@@ -256,7 +256,7 @@ const ArticleListPresets = [
256
256
  }
257
257
  },
258
258
  color: {
259
- normal: 'text-2'
259
+ normal: 'text-1'
260
260
  }
261
261
  }
262
262
  }
@@ -278,7 +278,7 @@ const ArticleListPresets = [
278
278
  }
279
279
  },
280
280
  color: {
281
- normal: 'text-2'
281
+ normal: 'text-1'
282
282
  },
283
283
  textAlign: {
284
284
  desktop: 'left'
@@ -102,7 +102,7 @@ const ArticleTagSettings = [
102
102
  label: 'Text Color',
103
103
  type: 'colorpicker',
104
104
  default: {
105
- normal: 'text-2'
105
+ normal: 'text-1'
106
106
  },
107
107
  state: {
108
108
  normal: true,
@@ -182,7 +182,7 @@ const ArticleTitleSettings = [
182
182
  label: 'Text Color',
183
183
  type: 'color-picker-v2',
184
184
  default: {
185
- normal: 'text-2'
185
+ normal: 'text-1'
186
186
  },
187
187
  state: {
188
188
  normal: true,
@@ -7,7 +7,7 @@ import { getProgressBarClasses, getContainerClasses, getWrapperIconClasses, getI
7
7
  import { getProgressBarStyles, getContainerStyles, getWrapperStyles, getIconStyles, getTextStyles } from './common/getStyles.js';
8
8
  import 'next/link';
9
9
  import '@gem-sdk/core';
10
- import { getWrapperAttrs } from './common/getAttrs.js';
10
+ import { getWrapperAttrs, getIconAttrs } from './common/getAttrs.js';
11
11
  import { createClass, createStyle, createAttr } from '@gem-sdk/system';
12
12
  import { useStockCounter } from './hook/useStockCounter.js';
13
13
 
@@ -49,6 +49,11 @@ const StockCounter = ({ setting, styles, builderProps })=>{
49
49
  ...getIconStyles(styles, setting, isOutOfStock)
50
50
  });
51
51
  };
52
+ const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
53
+ return createStyle({
54
+ ...getIconAttrs(isOutOfStockIcon, isVisible)
55
+ });
56
+ };
52
57
  const textClasses = (isOutOfStock)=>{
53
58
  return createClass({
54
59
  ...getTextClasses(styles, isOutOfStock)
@@ -88,12 +93,20 @@ const StockCounter = ({ setting, styles, builderProps })=>{
88
93
  className: wrapperIconClasses,
89
94
  children: [
90
95
  showIcon && (isOutOfStock ? /*#__PURE__*/ jsx("div", {
96
+ ...iconAttrs({
97
+ isOutOfStockIcon: isOutOfStock,
98
+ isVisible: isOutOfStock
99
+ }),
91
100
  dangerouslySetInnerHTML: {
92
101
  __html: oosIcon || ''
93
102
  },
94
103
  className: iconClasses,
95
104
  style: iconStyles(true)
96
105
  }) : /*#__PURE__*/ jsx("div", {
106
+ ...iconAttrs({
107
+ isOutOfStockIcon: !isOutOfStock,
108
+ isVisible: !isOutOfStock
109
+ }),
97
110
  dangerouslySetInnerHTML: {
98
111
  __html: icon || ''
99
112
  },
@@ -4,8 +4,8 @@ import { getInlineCss } from './common/getInlineCss.js';
4
4
  import { getProgressBarClasses, getContainerClasses, getLiquidTagClasses, getWrapperIconClasses, getIconClasses, getTextClasses } from './common/getClasses.js';
5
5
  import { getProgressBarStyles, getContainerStyles, getWrapperStyles, getIconStyles, getTextStyles } from './common/getStyles.js';
6
6
  import { getLiquidTextContent, getLiquidInitData } from './common/getContent.js';
7
- import { getLiquidTagAttrs, getLiquidProgressBarAttrs, getLiquidTextAttrs } from './common/getAttrs.js';
8
- import { createAttr, createClass, createStyle } from '@gem-sdk/system';
7
+ import { getLiquidTagAttrs, getLiquidProgressBarAttrs, getLiquidTextAttrs, getIconAttrs } from './common/getAttrs.js';
8
+ import { createAttr, createClass, createStyle, LiquidIf } from '@gem-sdk/system';
9
9
 
10
10
  const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
11
11
  const { borderRadius } = styles ?? {};
@@ -41,7 +41,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
41
41
  ...getWrapperIconClasses(setting)
42
42
  });
43
43
  const iconClasses = createClass({
44
- ...composeClasses('gp-stock-counter-icon'),
44
+ ...composeClasses('gp-stock-counter-icon data-[visible=true]:gp-block data-[visible=false]:gp-hidden'),
45
45
  ...getIconClasses()
46
46
  });
47
47
  const iconStyles = (isOutOfStock)=>{
@@ -49,6 +49,11 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
49
49
  ...getIconStyles(styles, setting, isOutOfStock)
50
50
  });
51
51
  };
52
+ const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
53
+ return createStyle({
54
+ ...getIconAttrs(isOutOfStockIcon, isVisible)
55
+ });
56
+ };
52
57
  const progressBarAttrs = createAttr({
53
58
  ...getLiquidProgressBarAttrs()
54
59
  });
@@ -79,21 +84,54 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
79
84
  >
80
85
  <div class="${wrapperIconClasses}">
81
86
  ${RenderIf(showIcon, template /* liquid */ `
82
- {% if is_out_of_stock %}
87
+ ${(LiquidIf('is_out_of_stock', template`<div
88
+ ${{
89
+ ...iconAttrs({
90
+ isOutOfStockIcon: true,
91
+ isVisible: true
92
+ })
93
+ }}
94
+ class="${iconClasses}"
95
+ style="${iconStyles(true)}"
96
+ >
97
+ ${oosIcon}
98
+ </div>
83
99
  <div
100
+ ${{
101
+ ...iconAttrs({
102
+ isOutOfStockIcon: false,
103
+ isVisible: false
104
+ })
105
+ }}
106
+ data-slot-type="false"
107
+ class="${iconClasses}"
108
+ style="${iconStyles(false)}"
109
+ >
110
+ ${icon}
111
+ </div>`), template` <div
112
+ ${{
113
+ ...iconAttrs({
114
+ isOutOfStockIcon: true,
115
+ isVisible: false
116
+ })
117
+ }}
84
118
  class="${iconClasses}"
85
119
  style="${iconStyles(true)}"
86
120
  >
87
121
  ${oosIcon}
88
122
  </div>
89
- {% else %}
90
123
  <div
124
+ ${{
125
+ ...iconAttrs({
126
+ isOutOfStockIcon: false,
127
+ isVisible: true
128
+ })
129
+ }}
91
130
  class="${iconClasses}"
92
131
  style="${iconStyles(false)}"
93
132
  >
94
133
  ${icon}
95
- </div>
96
- {% endif %}
134
+ </div>`)}
97
135
  `)}
98
136
  ${RenderIf(showText, template`
99
137
  {% if is_out_of_stock %}
@@ -35,5 +35,11 @@ const getWrapperAttrs = (builderProps)=>{
35
35
  'data-id': builderProps?.uid ?? ''
36
36
  };
37
37
  };
38
+ const getIconAttrs = (isOutOfStockIcon, isVisible)=>{
39
+ return {
40
+ 'data-slot-type': isOutOfStockIcon ? 'oos-icon' : 'has-stock-icon',
41
+ 'data-visible': isVisible ? 'true' : 'false'
42
+ };
43
+ };
38
44
 
39
- export { getLiquidProgressBarAttrs, getLiquidTagAttrs, getLiquidTextAttrs, getWrapperAttrs };
45
+ export { getIconAttrs, getLiquidProgressBarAttrs, getLiquidTagAttrs, getLiquidTextAttrs, getWrapperAttrs };
@@ -35,6 +35,8 @@ const getLiquidInitData = (setting, styles)=>{
35
35
 
36
36
  if inventory_management != null and available == false and inventory_quantity <= 0 and inventory_policy != '${CONTINUE_SELLING_WHEN_OUT_OF_STOCK.toLowerCase()}'
37
37
  assign is_out_of_stock = true
38
+ else
39
+ assign is_out_of_stock = false
38
40
  endif
39
41
 
40
42
  if check_display == true
@@ -28,7 +28,7 @@ const getTabListClasses = ({ setting, ulClass })=>{
28
28
  };
29
29
  const getItemClasses = ({ setting, isNotLiquid, isActive, currentDevice })=>{
30
30
  const { labelBgColor, labelColor, position } = setting ?? {};
31
- let classList = 'gp-navs-tab gp-flex gp-flex-1 gp-cursor-pointer gp-py-2 gp-px-4 gp-whitespace-nowrap';
31
+ let classList = 'gp-tab-item gp-flex gp-flex-1 gp-cursor-pointer gp-py-2 gp-px-4 gp-whitespace-nowrap';
32
32
  if (isNotLiquid) {
33
33
  if (isActive) {
34
34
  classList += ` ${getGlobalColorClass('bg', labelBgColor?.active)} ${getGlobalColorClass('text', labelColor?.active)}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.486",
3
+ "version": "2.0.0-dev.488",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",