@gem-sdk/components 2.0.0-dev.374 → 2.0.0-dev.376
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,7 +18,6 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
18
18
|
style,
|
|
19
19
|
display
|
|
20
20
|
}));
|
|
21
|
-
const computedContainerClasses = system.createClass(core.composeClasses(`${builderProps?.uid} ${helpers.getSettingPreloadData('gps-lazy')} ${advanced?.cssClass} ${isScrollToTop ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : ''}`));
|
|
22
21
|
const createDataState = system.createStateOrContext({
|
|
23
22
|
uid: builderProps?.uid,
|
|
24
23
|
setting: {
|
|
@@ -31,10 +30,11 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
31
30
|
return core.template`
|
|
32
31
|
${core.RenderIf(!!preloadBgImage, `${core.RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${core.RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${core.RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
|
|
33
32
|
<gp-sticky
|
|
33
|
+
data-id="${builderProps?.uid}"
|
|
34
34
|
gp-data='${JSON.stringify(createDataState)}'
|
|
35
35
|
id="${builderProps?.uid}"
|
|
36
36
|
data-id="${builderProps?.uid}"
|
|
37
|
-
class="${
|
|
37
|
+
class="${builderProps?.uid} ${helpers.getSettingPreloadData('gps-lazy')} ${advanced?.cssClass} ${isScrollToTop ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : ''}"
|
|
38
38
|
style="${computedContainerStyles}"
|
|
39
39
|
>
|
|
40
40
|
<div ${{
|
|
@@ -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
|
-
...
|
|
25
|
-
...
|
|
26
|
-
...
|
|
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,6 +1,6 @@
|
|
|
1
|
-
import { makeWidth,
|
|
1
|
+
import { makeWidth, template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import { getSettingPreloadData } from '../../helpers.js';
|
|
3
|
-
import { createStyle,
|
|
3
|
+
import { createStyle, createStateOrContext } from '@gem-sdk/system';
|
|
4
4
|
import { getContainerStyles } from './common/styles.js';
|
|
5
5
|
|
|
6
6
|
const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
|
|
@@ -14,7 +14,6 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
14
14
|
style,
|
|
15
15
|
display
|
|
16
16
|
}));
|
|
17
|
-
const computedContainerClasses = createClass(composeClasses(`${builderProps?.uid} ${getSettingPreloadData('gps-lazy')} ${advanced?.cssClass} ${isScrollToTop ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : ''}`));
|
|
18
17
|
const createDataState = createStateOrContext({
|
|
19
18
|
uid: builderProps?.uid,
|
|
20
19
|
setting: {
|
|
@@ -27,10 +26,11 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
|
|
|
27
26
|
return template`
|
|
28
27
|
${RenderIf(!!preloadBgImage, `${RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
|
|
29
28
|
<gp-sticky
|
|
29
|
+
data-id="${builderProps?.uid}"
|
|
30
30
|
gp-data='${JSON.stringify(createDataState)}'
|
|
31
31
|
id="${builderProps?.uid}"
|
|
32
32
|
data-id="${builderProps?.uid}"
|
|
33
|
-
class="${
|
|
33
|
+
class="${builderProps?.uid} ${getSettingPreloadData('gps-lazy')} ${advanced?.cssClass} ${isScrollToTop ? '!gp-pointer-events-none [&_gp-button_a]:!gp-pointer-events-auto' : ''}"
|
|
34
34
|
style="${computedContainerStyles}"
|
|
35
35
|
>
|
|
36
36
|
<div ${{
|
|
@@ -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
|
};
|