@gem-sdk/components 2.0.0-dev.729 → 2.0.0-dev.730

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.
@@ -5,11 +5,14 @@ require('react/jsx-runtime');
5
5
  require('react');
6
6
  var _const = require('../../../common/const.js');
7
7
 
8
+ const getCSSPosition = (position)=>{
9
+ return position == 'top' ? 'sticky' : 'fixed';
10
+ };
8
11
  const getDisplayStyle = (device, display, position)=>{
9
12
  const style = {
10
13
  [`--top${device}`]: 'auto',
11
14
  [`--${position + device}`]: '0',
12
- [`--pos${device}`]: 'fixed'
15
+ [`--pos${device}`]: getCSSPosition(position)
13
16
  };
14
17
  if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
15
18
  return style;
@@ -65,13 +65,16 @@ const useSticky = (setting)=>{
65
65
  position?.mobile,
66
66
  position?.tablet
67
67
  ]);
68
- const positionStyle = React.useMemo(()=>{
68
+ const getCSSPosition = (position)=>{
69
+ return position == 'top' ? 'sticky' : 'fixed';
70
+ };
71
+ const positionStyle = ()=>{
69
72
  return {
70
- [`--pos`]: 'fixed',
71
- [`--pos-tablet`]: 'fixed',
72
- [`--pos-mobile`]: 'fixed'
73
+ [`--pos`]: getCSSPosition(position?.desktop),
74
+ [`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
75
+ [`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
73
76
  };
74
- }, []);
77
+ };
75
78
  return {
76
79
  w,
77
80
  displayStyle,
@@ -3,11 +3,14 @@ import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import { ELEMENT_Z_INDEX } from '../../../common/const.js';
5
5
 
6
+ const getCSSPosition = (position)=>{
7
+ return position == 'top' ? 'sticky' : 'fixed';
8
+ };
6
9
  const getDisplayStyle = (device, display, position)=>{
7
10
  const style = {
8
11
  [`--top${device}`]: 'auto',
9
12
  [`--${position + device}`]: '0',
10
- [`--pos${device}`]: 'fixed'
13
+ [`--pos${device}`]: getCSSPosition(position)
11
14
  };
12
15
  if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
13
16
  return style;
@@ -61,13 +61,16 @@ const useSticky = (setting)=>{
61
61
  position?.mobile,
62
62
  position?.tablet
63
63
  ]);
64
- const positionStyle = useMemo(()=>{
64
+ const getCSSPosition = (position)=>{
65
+ return position == 'top' ? 'sticky' : 'fixed';
66
+ };
67
+ const positionStyle = ()=>{
65
68
  return {
66
- [`--pos`]: 'fixed',
67
- [`--pos-tablet`]: 'fixed',
68
- [`--pos-mobile`]: 'fixed'
69
+ [`--pos`]: getCSSPosition(position?.desktop),
70
+ [`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
71
+ [`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
69
72
  };
70
- }, []);
73
+ };
71
74
  return {
72
75
  w,
73
76
  displayStyle,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.729",
3
+ "version": "2.0.0-dev.730",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",