@gem-sdk/components 2.0.0-dev.491 → 2.0.0-dev.494

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/ArticleTag/presets.js +1 -1
  2. package/dist/cjs/dialog/setting/configs/settings.js +5 -2
  3. package/dist/cjs/icon-list/setting/IconList.js +34 -0
  4. package/dist/cjs/product/components/ProductButton/ProductButton.js +2 -1
  5. package/dist/cjs/product/components/ProductButton/hooks/useAddToCart.js +21 -0
  6. package/dist/cjs/sticky/components/Sticky.js +3 -2
  7. package/dist/cjs/sticky/components/hooks/useSticky.js +16 -1
  8. package/dist/cjs/stock-counter/components/StockCounter.js +1 -1
  9. package/dist/cjs/stock-counter/components/StockCounter.liquid.js +1 -1
  10. package/dist/cjs/stock-counter/components/common/getAttrs.js +4 -2
  11. package/dist/cjs/stock-counter/components/common/getStyles.js +2 -2
  12. package/dist/cjs/stock-counter/setting/configs/settingsV2.js +2 -0
  13. package/dist/esm/article/setting/configs/ArticleTag/presets.js +1 -1
  14. package/dist/esm/dialog/setting/configs/settings.js +5 -2
  15. package/dist/esm/icon-list/setting/IconList.js +34 -0
  16. package/dist/esm/product/components/ProductButton/ProductButton.js +2 -1
  17. package/dist/esm/product/components/ProductButton/hooks/useAddToCart.js +23 -2
  18. package/dist/esm/sticky/components/Sticky.js +3 -2
  19. package/dist/esm/sticky/components/hooks/useSticky.js +17 -2
  20. package/dist/esm/stock-counter/components/StockCounter.js +1 -1
  21. package/dist/esm/stock-counter/components/StockCounter.liquid.js +1 -1
  22. package/dist/esm/stock-counter/components/common/getAttrs.js +4 -2
  23. package/dist/esm/stock-counter/components/common/getStyles.js +3 -3
  24. package/dist/esm/stock-counter/setting/configs/settingsV2.js +2 -0
  25. package/package.json +1 -1
@@ -24,7 +24,7 @@ const ArticleTagPresets = [
24
24
  'spacing-setting': {
25
25
  desktop: {
26
26
  margin: {
27
- bottom: 'var(--g-s-s)'
27
+ bottom: 'var(--g-s-l)'
28
28
  }
29
29
  }
30
30
  }
@@ -203,8 +203,11 @@ const DialogSettings = [
203
203
  label: 'SVG Icon',
204
204
  type: 'icon',
205
205
  default: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
206
- <path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
207
- </svg>`
206
+ <path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
207
+ </svg>`,
208
+ compoDefaultValue: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
209
+ <path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
210
+ </svg>`
208
211
  },
209
212
  {
210
213
  id: 'btnWidth',
@@ -67,6 +67,23 @@ const config = {
67
67
  }
68
68
  },
69
69
  advanced: {
70
+ hasBoxShadow: {
71
+ desktop: {
72
+ normal: true
73
+ }
74
+ },
75
+ boxShadow: {
76
+ desktop: {
77
+ normal: {
78
+ type: 'shadow-1',
79
+ distance: '0px',
80
+ blur: '10px',
81
+ spread: '0px',
82
+ color: 'rgba(0, 0, 0, 0.1)',
83
+ angle: 90
84
+ }
85
+ }
86
+ },
70
87
  'spacing-setting': {
71
88
  desktop: {
72
89
  margin: {
@@ -112,6 +129,23 @@ const config = {
112
129
  presetId: 'icon-list-ver1-2-image'
113
130
  },
114
131
  advanced: {
132
+ hasBoxShadow: {
133
+ desktop: {
134
+ normal: true
135
+ }
136
+ },
137
+ boxShadow: {
138
+ desktop: {
139
+ normal: {
140
+ type: 'shadow-1',
141
+ distance: '0px',
142
+ blur: '10px',
143
+ spread: '0px',
144
+ color: 'rgba(0, 0, 0, 0.1)',
145
+ angle: 90
146
+ }
147
+ }
148
+ },
115
149
  'spacing-setting': {
116
150
  desktop: {
117
151
  margin: {
@@ -13,7 +13,7 @@ var AddToCartButton = require('./components/AddToCartButton.js');
13
13
  const ProductButton = (props)=>{
14
14
  const { setting, builderProps, style, styles: styles$1, children } = props;
15
15
  const { wrapStyle, restStyle } = styles.getSplitStyle(style);
16
- const { isLoading, isInStock, outOfStockLabel, notiComponent, addToCart } = useAddToCart.useBtnAddToCart({
16
+ const { isLoading, isInStock, outOfStockLabel, notiComponent, addToCart, addToCartRef } = useAddToCart.useBtnAddToCart({
17
17
  setting,
18
18
  styles: styles$1,
19
19
  builderProps
@@ -37,6 +37,7 @@ const ProductButton = (props)=>{
37
37
  };
38
38
  return /*#__PURE__*/ jsxRuntime.jsxs("div", {
39
39
  style: wrapStyle,
40
+ ref: addToCartRef,
40
41
  children: [
41
42
  system.If(isInStock, renderAddToCartButton(), renderSoldOutButton()),
42
43
  notiComponent
@@ -8,6 +8,7 @@ var useCartMessage = require('./useCartMessage.js');
8
8
  var useCartOperations = require('./useCartOperations.js');
9
9
 
10
10
  const useBtnAddToCart = ({ styles, setting, builderProps })=>{
11
+ const addToCartRef = React.useRef(null);
11
12
  const mode = core.useEditorMode();
12
13
  const product = core.useProduct();
13
14
  const { currency } = core.useCurrency();
@@ -15,6 +16,7 @@ const useBtnAddToCart = ({ styles, setting, builderProps })=>{
15
16
  const properties = core.useProductProperties();
16
17
  const currentVariant = core.useCurrentVariant();
17
18
  const { hasPreSelected } = core.useHasPreSelected();
19
+ const setStickyVisible = core.useStickyStore((s)=>s.setStickyVisible);
18
20
  const updateProductSubmit = core.useProductStore((s)=>s.updateIsSubmit);
19
21
  const dispatchEventAddToCart = useDispatchAfterSubmitEvent.useDispatchAfterSubmitEvent(builderProps?.uid);
20
22
  const { showMessage, notiComponent } = useCartMessage.useCartMessage(styles, setting);
@@ -27,6 +29,24 @@ const useBtnAddToCart = ({ styles, setting, builderProps })=>{
27
29
  onSuccess: handleSuccess,
28
30
  onError: handleError
29
31
  });
32
+ React.useEffect(()=>{
33
+ const observer = new IntersectionObserver((entries)=>{
34
+ const entry = entries[0];
35
+ setStickyVisible(entry?.isIntersecting);
36
+ }, {
37
+ threshold: 0.1
38
+ });
39
+ if (addToCartRef.current) {
40
+ observer.observe(addToCartRef.current);
41
+ }
42
+ return ()=>{
43
+ if (addToCartRef.current) {
44
+ observer.unobserve(addToCartRef.current);
45
+ }
46
+ };
47
+ }, [
48
+ setStickyVisible
49
+ ]);
30
50
  const addToCart = React.useCallback(()=>{
31
51
  if (!currentVariant?.baseID || !quantity || !product?.baseID || hasPreSelected !== undefined && !hasPreSelected || mode === 'edit') return;
32
52
  const checkInvalid = properties?.some((item)=>item.required && !item.value);
@@ -88,6 +108,7 @@ const useBtnAddToCart = ({ styles, setting, builderProps })=>{
88
108
  const isLoading = createCartLoading || addToCartLoading;
89
109
  const outOfStockLabel = !currentVariant ? 'Unavailable' : setting?.outOfStockLabel;
90
110
  return {
111
+ addToCartRef,
91
112
  isLoading,
92
113
  isInStock,
93
114
  notiComponent,
@@ -16,13 +16,14 @@ var classes = require('./common/classes.js');
16
16
 
17
17
  const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
18
18
  const { background, preloadBgImage, width, isScrollToTop } = setting ?? {};
19
- const { positionStyle, displayStyle } = useSticky.default(setting);
19
+ const { positionStyle, displayStyle, makeDisplaySettingStyles } = useSticky.default(setting);
20
20
  const computedContainerStyles = system.createStyle({
21
21
  margin: '0 auto',
22
22
  ...displayStyle,
23
23
  ...styles.getStylePadding(style),
24
24
  ...positionStyle,
25
- zIndex: _const.ELEMENT_Z_INDEX.STICKY
25
+ zIndex: _const.ELEMENT_Z_INDEX.STICKY,
26
+ ...makeDisplaySettingStyles
26
27
  });
27
28
  const computedContentStyles = system.createStyle(styles.getContentStyles({
28
29
  width,
@@ -7,6 +7,7 @@ var React = require('react');
7
7
 
8
8
  const useSticky = (setting)=>{
9
9
  const { width, position } = setting ?? {};
10
+ const isStickyVisible = core.useStickyStore((s)=>s.isStickyVisible);
10
11
  const w = core.makeStyleResponsive('w', width);
11
12
  const sidebarMode = core.usePageStore((s)=>s.sidebarMode === 'interaction');
12
13
  const currentDevice = core.useCurrentDevice();
@@ -37,6 +38,19 @@ const useSticky = (setting)=>{
37
38
  sidebarMode,
38
39
  position
39
40
  ]);
41
+ const makeDisplaySettingStyles = React.useMemo(()=>{
42
+ return {
43
+ '--d': setting?.display?.desktop === 'after-first-cart-button' && !isStickyVisible ? 'none' : 'block',
44
+ '--d-tablet': setting?.display?.tablet === 'after-first-cart-button' && !isStickyVisible ? 'none' : 'block',
45
+ '--d-mobile': setting?.display?.mobile === 'after-first-cart-button' && !isStickyVisible ? 'none' : 'block'
46
+ };
47
+ }, [
48
+ isStickyVisible,
49
+ setting?.display?.desktop,
50
+ setting?.display?.mobile,
51
+ setting?.display?.tablet
52
+ ]);
53
+ console.log('makeDisplaySettingStyles', makeDisplaySettingStyles);
40
54
  const displayStyle = React.useMemo(()=>{
41
55
  return {
42
56
  [`--top`]: gap ?? 'auto',
@@ -63,7 +77,8 @@ const useSticky = (setting)=>{
63
77
  w,
64
78
  displayStyle,
65
79
  positionStyle,
66
- getCSSAlign
80
+ getCSSAlign,
81
+ makeDisplaySettingStyles
67
82
  };
68
83
  };
69
84
 
@@ -54,7 +54,7 @@ const StockCounter = ({ setting, styles, builderProps })=>{
54
54
  });
55
55
  };
56
56
  const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
57
- return system.createStyle({
57
+ return system.createAttr({
58
58
  ...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
59
59
  });
60
60
  };
@@ -54,7 +54,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
54
54
  });
55
55
  };
56
56
  const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
57
- return system.createStyle({
57
+ return system.createAttr({
58
58
  ...getAttrs.getIconAttrs(isOutOfStockIcon, isVisible)
59
59
  });
60
60
  };
@@ -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 } = setting ?? {};
4
+ const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock, remaining, source } = setting ?? {};
5
5
  const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
6
6
  const mainColor = textColor || 'brand';
7
7
  const typoColor = typo?.attrs?.color;
@@ -20,7 +20,9 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
20
20
  color: mainColor,
21
21
  hiddenCounterWhenOutOfStock,
22
22
  oosTextColor,
23
- typoColor
23
+ typoColor,
24
+ remaining,
25
+ source
24
26
  }).replaceAll(`"`, '&#34;')
25
27
  };
26
28
  };
@@ -13,7 +13,7 @@ const getProgressBarStyles = (styles, setting)=>{
13
13
  ]));
14
14
  }
15
15
  return {
16
- ...core.makeStyleResponsive('h', convertedProgressBarHeight, 'px'),
16
+ ...core.makeStyleResponsive('h', core.makeWidth(convertedProgressBarHeight), 'px'),
17
17
  ...core.makeStyle({
18
18
  bg: 'linear-gradient(90deg, #eee 50%, transparent 50%)',
19
19
  bgc: core.getSingleColorVariable(color),
@@ -43,7 +43,7 @@ const getIconStyles = (styles, setting, isOutOfStock)=>{
43
43
  ...core.makeStyle({
44
44
  c: core.getSingleColorVariable(isOutOfStock ? oosIconColor : iconColor)
45
45
  }),
46
- ...core.makeStyleResponsive('w', iconSize, 'px')
46
+ ...core.makeStyleResponsive('w', core.makeWidth(iconSize), 'px')
47
47
  };
48
48
  };
49
49
  const getTextStyles = (styles, isOutOfStock)=>{
@@ -233,6 +233,8 @@ const StockCounterSettingsV2 = [
233
233
  units: [
234
234
  '%'
235
235
  ],
236
+ showDefaultUnit: true,
237
+ isNumber: true,
236
238
  useOnlyUnitInit: true
237
239
  }
238
240
  ]
@@ -22,7 +22,7 @@ const ArticleTagPresets = [
22
22
  'spacing-setting': {
23
23
  desktop: {
24
24
  margin: {
25
- bottom: 'var(--g-s-s)'
25
+ bottom: 'var(--g-s-l)'
26
26
  }
27
27
  }
28
28
  }
@@ -201,8 +201,11 @@ const DialogSettings = [
201
201
  label: 'SVG Icon',
202
202
  type: 'icon',
203
203
  default: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
204
- <path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
205
- </svg>`
204
+ <path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
205
+ </svg>`,
206
+ compoDefaultValue: `<svg height="20" width="20" data-name="x-bold" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817606065848680">
207
+ <path fill="currentColor" stroke-linecap="round" stroke-linejoin="round" d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"/>
208
+ </svg>`
206
209
  },
207
210
  {
208
211
  id: 'btnWidth',
@@ -63,6 +63,23 @@ const config = {
63
63
  }
64
64
  },
65
65
  advanced: {
66
+ hasBoxShadow: {
67
+ desktop: {
68
+ normal: true
69
+ }
70
+ },
71
+ boxShadow: {
72
+ desktop: {
73
+ normal: {
74
+ type: 'shadow-1',
75
+ distance: '0px',
76
+ blur: '10px',
77
+ spread: '0px',
78
+ color: 'rgba(0, 0, 0, 0.1)',
79
+ angle: 90
80
+ }
81
+ }
82
+ },
66
83
  'spacing-setting': {
67
84
  desktop: {
68
85
  margin: {
@@ -108,6 +125,23 @@ const config = {
108
125
  presetId: 'icon-list-ver1-2-image'
109
126
  },
110
127
  advanced: {
128
+ hasBoxShadow: {
129
+ desktop: {
130
+ normal: true
131
+ }
132
+ },
133
+ boxShadow: {
134
+ desktop: {
135
+ normal: {
136
+ type: 'shadow-1',
137
+ distance: '0px',
138
+ blur: '10px',
139
+ spread: '0px',
140
+ color: 'rgba(0, 0, 0, 0.1)',
141
+ angle: 90
142
+ }
143
+ }
144
+ },
111
145
  'spacing-setting': {
112
146
  desktop: {
113
147
  margin: {
@@ -9,7 +9,7 @@ import AddToCartButton from './components/AddToCartButton.js';
9
9
  const ProductButton = (props)=>{
10
10
  const { setting, builderProps, style, styles, children } = props;
11
11
  const { wrapStyle, restStyle } = getSplitStyle(style);
12
- const { isLoading, isInStock, outOfStockLabel, notiComponent, addToCart } = useBtnAddToCart({
12
+ const { isLoading, isInStock, outOfStockLabel, notiComponent, addToCart, addToCartRef } = useBtnAddToCart({
13
13
  setting,
14
14
  styles,
15
15
  builderProps
@@ -33,6 +33,7 @@ const ProductButton = (props)=>{
33
33
  };
34
34
  return /*#__PURE__*/ jsxs("div", {
35
35
  style: wrapStyle,
36
+ ref: addToCartRef,
36
37
  children: [
37
38
  If(isInStock, renderAddToCartButton(), renderSoldOutButton()),
38
39
  notiComponent
@@ -1,11 +1,12 @@
1
- import { useEditorMode, useProduct, useCurrency, useQuantity, useProductProperties, useCurrentVariant, useHasPreSelected, useProductStore, useCreateCart, useAddToCart, useCurrentVariantInStock } from '@gem-sdk/core';
2
- import { useCallback } from 'react';
1
+ import { useEditorMode, useProduct, useCurrency, useQuantity, useProductProperties, useCurrentVariant, useHasPreSelected, useStickyStore, useProductStore, useCreateCart, useAddToCart, useCurrentVariantInStock } from '@gem-sdk/core';
2
+ import { useRef, useEffect, useCallback } from 'react';
3
3
  import { addToCartTracking } from '../../../helpers/tracking.js';
4
4
  import { useDispatchAfterSubmitEvent } from './useDispatchAfterSubmitEvent.js';
5
5
  import { useCartMessage } from './useCartMessage.js';
6
6
  import { useCartOperations } from './useCartOperations.js';
7
7
 
8
8
  const useBtnAddToCart = ({ styles, setting, builderProps })=>{
9
+ const addToCartRef = useRef(null);
9
10
  const mode = useEditorMode();
10
11
  const product = useProduct();
11
12
  const { currency } = useCurrency();
@@ -13,6 +14,7 @@ const useBtnAddToCart = ({ styles, setting, builderProps })=>{
13
14
  const properties = useProductProperties();
14
15
  const currentVariant = useCurrentVariant();
15
16
  const { hasPreSelected } = useHasPreSelected();
17
+ const setStickyVisible = useStickyStore((s)=>s.setStickyVisible);
16
18
  const updateProductSubmit = useProductStore((s)=>s.updateIsSubmit);
17
19
  const dispatchEventAddToCart = useDispatchAfterSubmitEvent(builderProps?.uid);
18
20
  const { showMessage, notiComponent } = useCartMessage(styles, setting);
@@ -25,6 +27,24 @@ const useBtnAddToCart = ({ styles, setting, builderProps })=>{
25
27
  onSuccess: handleSuccess,
26
28
  onError: handleError
27
29
  });
30
+ useEffect(()=>{
31
+ const observer = new IntersectionObserver((entries)=>{
32
+ const entry = entries[0];
33
+ setStickyVisible(entry?.isIntersecting);
34
+ }, {
35
+ threshold: 0.1
36
+ });
37
+ if (addToCartRef.current) {
38
+ observer.observe(addToCartRef.current);
39
+ }
40
+ return ()=>{
41
+ if (addToCartRef.current) {
42
+ observer.unobserve(addToCartRef.current);
43
+ }
44
+ };
45
+ }, [
46
+ setStickyVisible
47
+ ]);
28
48
  const addToCart = useCallback(()=>{
29
49
  if (!currentVariant?.baseID || !quantity || !product?.baseID || hasPreSelected !== undefined && !hasPreSelected || mode === 'edit') return;
30
50
  const checkInvalid = properties?.some((item)=>item.required && !item.value);
@@ -86,6 +106,7 @@ const useBtnAddToCart = ({ styles, setting, builderProps })=>{
86
106
  const isLoading = createCartLoading || addToCartLoading;
87
107
  const outOfStockLabel = !currentVariant ? 'Unavailable' : setting?.outOfStockLabel;
88
108
  return {
109
+ addToCartRef,
89
110
  isLoading,
90
111
  isInStock,
91
112
  notiComponent,
@@ -12,13 +12,14 @@ import { getContainerClasses } from './common/classes.js';
12
12
 
13
13
  const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
14
14
  const { background, preloadBgImage, width, isScrollToTop } = setting ?? {};
15
- const { positionStyle, displayStyle } = useSticky(setting);
15
+ const { positionStyle, displayStyle, makeDisplaySettingStyles } = useSticky(setting);
16
16
  const computedContainerStyles = createStyle({
17
17
  margin: '0 auto',
18
18
  ...displayStyle,
19
19
  ...getStylePadding(style),
20
20
  ...positionStyle,
21
- zIndex: ELEMENT_Z_INDEX.STICKY
21
+ zIndex: ELEMENT_Z_INDEX.STICKY,
22
+ ...makeDisplaySettingStyles
22
23
  });
23
24
  const computedContentStyles = createStyle(getContentStyles({
24
25
  width,
@@ -1,8 +1,9 @@
1
- import { makeStyleResponsive, usePageStore, useCurrentDevice } from '@gem-sdk/core';
1
+ import { useStickyStore, makeStyleResponsive, usePageStore, useCurrentDevice } from '@gem-sdk/core';
2
2
  import { useMemo } from 'react';
3
3
 
4
4
  const useSticky = (setting)=>{
5
5
  const { width, position } = setting ?? {};
6
+ const isStickyVisible = useStickyStore((s)=>s.isStickyVisible);
6
7
  const w = makeStyleResponsive('w', width);
7
8
  const sidebarMode = usePageStore((s)=>s.sidebarMode === 'interaction');
8
9
  const currentDevice = useCurrentDevice();
@@ -33,6 +34,19 @@ const useSticky = (setting)=>{
33
34
  sidebarMode,
34
35
  position
35
36
  ]);
37
+ const makeDisplaySettingStyles = useMemo(()=>{
38
+ return {
39
+ '--d': setting?.display?.desktop === 'after-first-cart-button' && !isStickyVisible ? 'none' : 'block',
40
+ '--d-tablet': setting?.display?.tablet === 'after-first-cart-button' && !isStickyVisible ? 'none' : 'block',
41
+ '--d-mobile': setting?.display?.mobile === 'after-first-cart-button' && !isStickyVisible ? 'none' : 'block'
42
+ };
43
+ }, [
44
+ isStickyVisible,
45
+ setting?.display?.desktop,
46
+ setting?.display?.mobile,
47
+ setting?.display?.tablet
48
+ ]);
49
+ console.log('makeDisplaySettingStyles', makeDisplaySettingStyles);
36
50
  const displayStyle = useMemo(()=>{
37
51
  return {
38
52
  [`--top`]: gap ?? 'auto',
@@ -59,7 +73,8 @@ const useSticky = (setting)=>{
59
73
  w,
60
74
  displayStyle,
61
75
  positionStyle,
62
- getCSSAlign
76
+ getCSSAlign,
77
+ makeDisplaySettingStyles
63
78
  };
64
79
  };
65
80
 
@@ -50,7 +50,7 @@ const StockCounter = ({ setting, styles, builderProps })=>{
50
50
  });
51
51
  };
52
52
  const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
53
- return createStyle({
53
+ return createAttr({
54
54
  ...getIconAttrs(isOutOfStockIcon, isVisible)
55
55
  });
56
56
  };
@@ -50,7 +50,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
50
50
  });
51
51
  };
52
52
  const iconAttrs = ({ isOutOfStockIcon, isVisible })=>{
53
- return createStyle({
53
+ return createAttr({
54
54
  ...getIconAttrs(isOutOfStockIcon, isVisible)
55
55
  });
56
56
  };
@@ -1,5 +1,5 @@
1
1
  const getLiquidTagAttrs = (builderProps, setting, styles)=>{
2
- const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock } = setting ?? {};
2
+ const { displayByDefault, scarcityThreshold = 0, template: templateString, outOfStockMessage, continueSelling, unlimitedQuantityMessage, hiddenCounterWhenOutOfStock, remaining, source } = setting ?? {};
3
3
  const { displayProgressBar, textColor, oosTextColor, typo } = styles ?? {};
4
4
  const mainColor = textColor || 'brand';
5
5
  const typoColor = typo?.attrs?.color;
@@ -18,7 +18,9 @@ const getLiquidTagAttrs = (builderProps, setting, styles)=>{
18
18
  color: mainColor,
19
19
  hiddenCounterWhenOutOfStock,
20
20
  oosTextColor,
21
- typoColor
21
+ typoColor,
22
+ remaining,
23
+ source
22
24
  }).replaceAll(`"`, '&#34;')
23
25
  };
24
26
  };
@@ -1,4 +1,4 @@
1
- import { makeStyleResponsive, makeStyle, getSingleColorVariable, makeWidth, composeTypographyStyle, getStyleShadow } from '@gem-sdk/core';
1
+ import { makeStyleResponsive, makeWidth, makeStyle, getSingleColorVariable, composeTypographyStyle, getStyleShadow } from '@gem-sdk/core';
2
2
 
3
3
  const getProgressBarStyles = (styles, setting)=>{
4
4
  const { progressBarHeight, color } = styles ?? {};
@@ -11,7 +11,7 @@ const getProgressBarStyles = (styles, setting)=>{
11
11
  ]));
12
12
  }
13
13
  return {
14
- ...makeStyleResponsive('h', convertedProgressBarHeight, 'px'),
14
+ ...makeStyleResponsive('h', makeWidth(convertedProgressBarHeight), 'px'),
15
15
  ...makeStyle({
16
16
  bg: 'linear-gradient(90deg, #eee 50%, transparent 50%)',
17
17
  bgc: getSingleColorVariable(color),
@@ -41,7 +41,7 @@ const getIconStyles = (styles, setting, isOutOfStock)=>{
41
41
  ...makeStyle({
42
42
  c: getSingleColorVariable(isOutOfStock ? oosIconColor : iconColor)
43
43
  }),
44
- ...makeStyleResponsive('w', iconSize, 'px')
44
+ ...makeStyleResponsive('w', makeWidth(iconSize), 'px')
45
45
  };
46
46
  };
47
47
  const getTextStyles = (styles, isOutOfStock)=>{
@@ -231,6 +231,8 @@ const StockCounterSettingsV2 = [
231
231
  units: [
232
232
  '%'
233
233
  ],
234
+ showDefaultUnit: true,
235
+ isNumber: true,
234
236
  useOnlyUnitInit: true
235
237
  }
236
238
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.491",
3
+ "version": "2.0.0-dev.494",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",