@gem-sdk/components 2.0.0-dev.374 → 2.0.0-dev.375

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.
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var core = require('@gem-sdk/core');
4
- var helpers = require('../../../helpers.js');
5
4
  require('react/jsx-runtime');
6
5
  require('react');
7
6
  var _const = require('../../../common/const.js');
@@ -19,11 +18,23 @@ const getCSSAlign = (position)=>{
19
18
  ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
20
19
  };
21
20
  };
21
+ const getDisplayStyle = (device, display, position)=>{
22
+ const style = {
23
+ [`--top${device}`]: 'auto',
24
+ [`--${position + device}`]: '0',
25
+ [`--pos${device}`]: getCSSPosition(position)
26
+ };
27
+ if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
28
+ return style;
29
+ };
30
+ const getCSSPosition = (position)=>{
31
+ return position == 'top' ? 'sticky' : 'fixed';
32
+ };
22
33
  const displayStyle = (display, position)=>{
23
34
  return {
24
- ...helpers.getDisplayStyle('', display?.desktop),
25
- ...helpers.getDisplayStyle('-tablet', display?.tablet ?? display?.desktop),
26
- ...helpers.getDisplayStyle('-mobile', display?.mobile ?? display?.desktop)
35
+ ...getDisplayStyle('', display?.desktop, position?.desktop),
36
+ ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop, position?.tablet ?? position?.desktop),
37
+ ...getDisplayStyle('-mobile', display?.mobile ?? display?.desktop, position?.mobile ?? position?.desktop)
27
38
  };
28
39
  };
29
40
  const getContainerStyles = (args)=>{
@@ -33,7 +44,7 @@ const getContainerStyles = (args)=>{
33
44
  ...style,
34
45
  ...core.makeStyleResponsive('w', w),
35
46
  ...core.getStyleBackgroundByDevice(background),
36
- ...displayStyle(display),
47
+ ...displayStyle(display, position),
37
48
  ...getCSSAlign(position),
38
49
  'z-index': _const.ELEMENT_Z_INDEX.STICKY
39
50
  };
@@ -1,5 +1,4 @@
1
1
  import { makeStyleResponsive, getStyleBackgroundByDevice } from '@gem-sdk/core';
2
- import { getDisplayStyle } from '../../../helpers.js';
3
2
  import 'react/jsx-runtime';
4
3
  import 'react';
5
4
  import { ELEMENT_Z_INDEX } from '../../../common/const.js';
@@ -17,11 +16,23 @@ const getCSSAlign = (position)=>{
17
16
  ...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
18
17
  };
19
18
  };
19
+ const getDisplayStyle = (device, display, position)=>{
20
+ const style = {
21
+ [`--top${device}`]: 'auto',
22
+ [`--${position + device}`]: '0',
23
+ [`--pos${device}`]: getCSSPosition(position)
24
+ };
25
+ if (display === 'after-first-cart-button') style[`--d${device}`] = 'none';
26
+ return style;
27
+ };
28
+ const getCSSPosition = (position)=>{
29
+ return position == 'top' ? 'sticky' : 'fixed';
30
+ };
20
31
  const displayStyle = (display, position)=>{
21
32
  return {
22
- ...getDisplayStyle('', display?.desktop),
23
- ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop),
24
- ...getDisplayStyle('-mobile', display?.mobile ?? display?.desktop)
33
+ ...getDisplayStyle('', display?.desktop, position?.desktop),
34
+ ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop, position?.tablet ?? position?.desktop),
35
+ ...getDisplayStyle('-mobile', display?.mobile ?? display?.desktop, position?.mobile ?? position?.desktop)
25
36
  };
26
37
  };
27
38
  const getContainerStyles = (args)=>{
@@ -31,7 +42,7 @@ const getContainerStyles = (args)=>{
31
42
  ...style,
32
43
  ...makeStyleResponsive('w', w),
33
44
  ...getStyleBackgroundByDevice(background),
34
- ...displayStyle(display),
45
+ ...displayStyle(display, position),
35
46
  ...getCSSAlign(position),
36
47
  'z-index': ELEMENT_Z_INDEX.STICKY
37
48
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.374",
3
+ "version": "2.0.0-dev.375",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",