@gem-sdk/components 2.0.0-dev.446 → 2.0.0-dev.448

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,7 @@ const HeroBanner = (props)=>{
18
18
  const { link } = setting ?? {};
19
19
  const { cssClass } = advanced ?? {};
20
20
  const currentDevice = core.useCurrentDevice();
21
- const { elementRef, transform, onMouseEnterParallax, onMouseLeaveParallax, dataVideo, bgRef, isShowVideoHtml5, openLinkBanner } = useHeroBanner.useHeroBanner(styles, setting, currentDevice);
21
+ const { elementRef, transform, onMouseEnterParallax, onMouseLeaveParallax, dataVideo, bgRef, isShowVideoHtml5, openLinkBanner, layoutResponsive } = useHeroBanner.useHeroBanner(styles, setting, currentDevice);
22
22
  const hasLinkCover = !!link?.link && mode !== 'edit';
23
23
  const attrs = system.createAttr({
24
24
  ...getAttr.getAttr({
@@ -52,6 +52,7 @@ const HeroBanner = (props)=>{
52
52
  elementRef: elementRef,
53
53
  transform: transform,
54
54
  dataVideo: dataVideo,
55
+ layoutResponsive: layoutResponsive,
55
56
  bgRef: bgRef,
56
57
  isShowVideoHtml5: isShowVideoHtml5
57
58
  });
@@ -18,7 +18,7 @@ var common$1 = require('../../video/helpers/common.js');
18
18
 
19
19
  const HeroBannerItem = (props)=>{
20
20
  const mode = core.useEditorMode();
21
- const { enableLazyloadImage, setting, styles, children, elementRef, transform, dataVideo, bgRef, isShowVideoHtml5 } = props;
21
+ const { enableLazyloadImage, setting, styles, children, elementRef, transform, dataVideo, bgRef, isShowVideoHtml5, layoutResponsive } = props;
22
22
  const { layout, verticalAlign, speedParallax, alt, title } = setting ?? {};
23
23
  const { background, overlayColor, verticalGutter, sizeSetting, contentWidth, hoverEffect, contentPosition1Col, contentPosition2Col } = styles ?? {};
24
24
  const enableLazyImage = (setting?.preload || !enableLazyloadImage) && mode !== 'edit';
@@ -164,6 +164,7 @@ const HeroBannerItem = (props)=>{
164
164
  mobile: false
165
165
  }
166
166
  },
167
+ hiddenEmptyCol: layoutResponsive?.cols?.length === 1,
167
168
  onBlur: (e)=>common.scrollToContentBanner(e),
168
169
  children: core.filterToolbarPreview(children)
169
170
  }),
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
6
  var AnimationManager = require('../parallax/AnimationManager.js');
7
+ var core = require('@gem-sdk/core');
7
8
  var useTranslateValue = require('./useTranslateValue.js');
8
9
  var useIntersectionObserver = require('./useIntersectionObserver.js');
9
10
  var common = require('../common/common.js');
@@ -23,6 +24,7 @@ const useHeroBanner = (styles, setting, currentDevice)=>{
23
24
  backgroundBoundingClientRect,
24
25
  speed: speedParallax
25
26
  });
27
+ const layoutResponsive = core.getResponsiveValueByScreen(setting?.layout, currentDevice);
26
28
  const backgroundResponsive = common.getResponsiveSetting(background || {});
27
29
  const enableParallax = Number(setting?.speedParallax || 0) > 0 && backgroundResponsive[currentDevice]?.type === 'image' || false;
28
30
  const onMouseEnterParallax = ()=>{
@@ -102,7 +104,8 @@ const useHeroBanner = (styles, setting, currentDevice)=>{
102
104
  elementRef,
103
105
  dataVideo,
104
106
  isShowVideoHtml5,
105
- openLinkBanner
107
+ openLinkBanner,
108
+ layoutResponsive
106
109
  };
107
110
  };
108
111
 
@@ -167,9 +167,7 @@ const SettingsV2 = [
167
167
  isNumber: true,
168
168
  min: 0,
169
169
  max: 1,
170
- step: 0.1,
171
- default: 0.6,
172
- compoDefaultValue: 0.6
170
+ step: 0.1
173
171
  },
174
172
  {
175
173
  id: 'alignBanner',
@@ -700,15 +698,7 @@ const SettingsV2 = [
700
698
  {
701
699
  id: 'shadowBg',
702
700
  type: 'shadow-v2',
703
- label: 'Button Shadow',
704
- default: {
705
- type: 'shadow-1',
706
- distance: '4px',
707
- blur: '12px',
708
- spread: '0px',
709
- color: '#121212',
710
- angle: 90
711
- }
701
+ label: 'Button Shadow'
712
702
  },
713
703
  {
714
704
  id: 'contentPadding',
@@ -317,7 +317,7 @@ const SettingUIV2 = [
317
317
  },
318
318
  iconName: 'polaris-parallax-effect',
319
319
  getValueFromSettingID: 'speedParallax',
320
- defaultValueWhenClear: 0,
320
+ compoDefaultValue: 0.6,
321
321
  controls: [
322
322
  {
323
323
  layout: 'vertical',
@@ -22,7 +22,7 @@ const Column = (props)=>{
22
22
  ...colAttr,
23
23
  style: colStyle,
24
24
  className: colClass,
25
- children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : children
25
+ children: core.isEmptyChildren(children) ? props.hiddenEmptyCol ? null : /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : children
26
26
  });
27
27
  };
28
28
 
@@ -21,7 +21,11 @@ const getStyles = (props, isPostPurchase)=>{
21
21
  displayByBreakpointIfChildrenEmpty[device] = core.getResponsiveValueByScreen(display, device) === 'fit' || !!layout && core.isColumnDirectionExist(layout, device) || REMOVE_SPACING_COMPONENT_TAG.includes(parentTag || '') ? 'none' : styles?.display?.[device];
22
22
  }
23
23
  const orderRender = ()=>{
24
- const od = order ?? styles?.order;
24
+ const stringifiedOrder = Object.fromEntries(Object.entries(styles?.order ?? {}).map(([key, value])=>[
25
+ key,
26
+ String(value)
27
+ ]));
28
+ const od = order ?? stringifiedOrder;
25
29
  if (isPostPurchase) {
26
30
  return {
27
31
  desktop: od?.desktop,
@@ -91,6 +91,7 @@ const Row = (props)=>{
91
91
  }) : /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
92
92
  children: isRowEmpty ? /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : React.Children.map(children, (el)=>{
93
93
  if (/*#__PURE__*/ React.isValidElement(el)) return /*#__PURE__*/ React.createElement(el.type, {
94
+ hiddenEmptyCol: props.hiddenEmptyCol,
94
95
  ...el.props,
95
96
  key: el.key,
96
97
  order: setting?.order,
@@ -11,16 +11,18 @@ require('react');
11
11
  var _const = require('../../common/const.js');
12
12
  var useSticky = require('./hooks/useSticky.js');
13
13
  var system = require('@gem-sdk/system');
14
+ var styles = require('./common/styles.js');
14
15
 
15
16
  const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
17
+ const mode = core.useEditorMode();
16
18
  const { background, preloadBgImage } = setting ?? {};
17
- const { w, displayStyle, positionStyle, getCSSAlign } = useSticky.default(setting);
19
+ const { w, positionStyle, displayStyle, getCSSAlign } = useSticky.default(setting);
18
20
  const computedContainerStyles = system.createStyle({
19
21
  margin: '0 auto',
20
- ...style,
21
22
  ...w,
22
- ...core.getStyleBackgroundByDevice(background),
23
23
  ...displayStyle,
24
+ ...styles.getStylePadding(style),
25
+ ...mode !== 'edit' && setting?.isScrollToTop ? styles.displayConditionStyle(setting?.display, setting?.position) : {},
24
26
  ...positionStyle,
25
27
  ...getCSSAlign,
26
28
  zIndex: _const.ELEMENT_Z_INDEX.STICKY
@@ -53,8 +55,9 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
53
55
  children: /*#__PURE__*/ jsxRuntime.jsx("div", {
54
56
  ...builderAttrs,
55
57
  "data-id": builderProps?.uid,
56
- "data-width": {
57
- ...w
58
+ style: {
59
+ ...styles.filterStyles(style),
60
+ ...core.getStyleBackgroundByDevice(background)
58
61
  },
59
62
  children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : children
60
63
  })
@@ -8,12 +8,10 @@ var system = require('@gem-sdk/system');
8
8
  var styles = require('./common/styles.js');
9
9
 
10
10
  const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
11
- const { width, fullWidth, position, background, display, preloadBgImage, isScrollToTop } = setting ?? {};
11
+ const { width, position, display, preloadBgImage, background, isScrollToTop } = setting ?? {};
12
12
  const advancedDisplay = advanced?.d;
13
- const w = core.makeWidth(width, fullWidth);
14
13
  const computedContainerStyles = system.createStyle(styles.getContainerStyles({
15
- w,
16
- background,
14
+ width,
17
15
  position,
18
16
  style,
19
17
  display
@@ -40,7 +38,10 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
40
38
  >
41
39
  <div ${{
42
40
  ...builderAttrs
43
- }}>
41
+ }} style="${{
42
+ ...styles.filterStyles(style),
43
+ ...core.getStyleBackgroundByDevice(background)
44
+ }}">
44
45
  ${children}
45
46
  </div>
46
47
  </gp-sticky>
@@ -30,7 +30,7 @@ const getDisplayStyle = (device, display, position)=>{
30
30
  const getCSSPosition = (position)=>{
31
31
  return position == 'top' ? 'sticky' : 'fixed';
32
32
  };
33
- const displayStyle = (display, position)=>{
33
+ const displayConditionStyle = (display, position)=>{
34
34
  return {
35
35
  ...getDisplayStyle('', display?.desktop, position?.desktop),
36
36
  ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop, position?.tablet ?? position?.desktop),
@@ -38,16 +38,65 @@ const displayStyle = (display, position)=>{
38
38
  };
39
39
  };
40
40
  const getContainerStyles = (args)=>{
41
- const { style, w, background, position, display } = args;
41
+ const { style, width, position, display } = args;
42
42
  return {
43
43
  margin: '0 auto',
44
- ...style,
45
- ...core.makeStyleResponsive('w', w),
46
- ...core.getStyleBackgroundByDevice(background),
47
- ...displayStyle(display, position),
44
+ ...getStylePadding(style),
45
+ ...core.makeStyleResponsive('w', width),
46
+ ...displayConditionStyle(display, position),
48
47
  ...getCSSAlign(position),
49
48
  'z-index': _const.ELEMENT_Z_INDEX.STICKY
50
49
  };
51
50
  };
51
+ const getStylePadding = (style)=>{
52
+ const keepList = [
53
+ '--pt',
54
+ '--pb',
55
+ '--pr',
56
+ '--pl',
57
+ '--pt-mobile',
58
+ '--pb-mobile',
59
+ '--pr-mobile',
60
+ '--pl-mobile',
61
+ '--pt-tablet',
62
+ '--pb-tablet',
63
+ '--pr-tablet',
64
+ '--pl-tablet'
65
+ ];
66
+ const keepStyles = {};
67
+ keepList.forEach((element)=>{
68
+ if (style?.[element]) {
69
+ keepStyles[element] = style[element];
70
+ }
71
+ });
72
+ return keepStyles;
73
+ };
74
+ const filterStyles = (style)=>{
75
+ const cloneStyle = {
76
+ ...style
77
+ };
78
+ const delList = [
79
+ '--pt',
80
+ '--pb',
81
+ '--pr',
82
+ '--pl',
83
+ '--pt-mobile',
84
+ '--pb-mobile',
85
+ '--pr-mobile',
86
+ '--pl-mobile',
87
+ '--pt-tablet',
88
+ '--pb-tablet',
89
+ '--pr-tablet',
90
+ '--pl-tablet'
91
+ ];
92
+ delList.forEach((element)=>{
93
+ delete cloneStyle?.[element];
94
+ });
95
+ return cloneStyle;
96
+ };
52
97
 
98
+ exports.displayConditionStyle = displayConditionStyle;
99
+ exports.filterStyles = filterStyles;
53
100
  exports.getContainerStyles = getContainerStyles;
101
+ exports.getDisplayStyle = getDisplayStyle;
102
+ exports.getStylePadding = getStylePadding;
@@ -3,17 +3,11 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@gem-sdk/core');
6
- var helpers = require('../../../grid/row/commons/helpers.js');
7
6
  var React = require('react');
8
7
 
9
8
  const useSticky = (setting)=>{
10
- const { width, fullWidth, position } = setting ?? {};
11
- const styleObject = helpers.createStyleObject(width, fullWidth ?? {
12
- desktop: false,
13
- tablet: false,
14
- mobile: false
15
- });
16
- const w = core.makeStyleResponsive('w', styleObject.content);
9
+ const { width, position } = setting ?? {};
10
+ const w = core.makeStyleResponsive('w', width);
17
11
  const sidebarMode = core.usePageStore((s)=>s.sidebarMode === 'interaction');
18
12
  const currentDevice = core.useCurrentDevice();
19
13
  const getCSSPosition = (position)=>{
@@ -44,7 +44,7 @@ const StickySettingsV2 = [
44
44
  },
45
45
  {
46
46
  label: 'Default',
47
- value: 'default',
47
+ value: '1200px',
48
48
  showValue: true
49
49
  }
50
50
  ]
@@ -14,7 +14,7 @@ const HeroBanner = (props)=>{
14
14
  const { link } = setting ?? {};
15
15
  const { cssClass } = advanced ?? {};
16
16
  const currentDevice = useCurrentDevice();
17
- const { elementRef, transform, onMouseEnterParallax, onMouseLeaveParallax, dataVideo, bgRef, isShowVideoHtml5, openLinkBanner } = useHeroBanner(styles, setting, currentDevice);
17
+ const { elementRef, transform, onMouseEnterParallax, onMouseLeaveParallax, dataVideo, bgRef, isShowVideoHtml5, openLinkBanner, layoutResponsive } = useHeroBanner(styles, setting, currentDevice);
18
18
  const hasLinkCover = !!link?.link && mode !== 'edit';
19
19
  const attrs = createAttr({
20
20
  ...getAttr({
@@ -48,6 +48,7 @@ const HeroBanner = (props)=>{
48
48
  elementRef: elementRef,
49
49
  transform: transform,
50
50
  dataVideo: dataVideo,
51
+ layoutResponsive: layoutResponsive,
51
52
  bgRef: bgRef,
52
53
  isShowVideoHtml5: isShowVideoHtml5
53
54
  });
@@ -14,7 +14,7 @@ import { getYoutubeVideoId, youtubeVideoRegex } from '../../video/helpers/common
14
14
 
15
15
  const HeroBannerItem = (props)=>{
16
16
  const mode = useEditorMode();
17
- const { enableLazyloadImage, setting, styles, children, elementRef, transform, dataVideo, bgRef, isShowVideoHtml5 } = props;
17
+ const { enableLazyloadImage, setting, styles, children, elementRef, transform, dataVideo, bgRef, isShowVideoHtml5, layoutResponsive } = props;
18
18
  const { layout, verticalAlign, speedParallax, alt, title } = setting ?? {};
19
19
  const { background, overlayColor, verticalGutter, sizeSetting, contentWidth, hoverEffect, contentPosition1Col, contentPosition2Col } = styles ?? {};
20
20
  const enableLazyImage = (setting?.preload || !enableLazyloadImage) && mode !== 'edit';
@@ -160,6 +160,7 @@ const HeroBannerItem = (props)=>{
160
160
  mobile: false
161
161
  }
162
162
  },
163
+ hiddenEmptyCol: layoutResponsive?.cols?.length === 1,
163
164
  onBlur: (e)=>scrollToContentBanner(e),
164
165
  children: filterToolbarPreview(children)
165
166
  }),
@@ -1,5 +1,6 @@
1
1
  import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
2
2
  import AnimationManager from '../parallax/AnimationManager.js';
3
+ import { getResponsiveValueByScreen } from '@gem-sdk/core';
3
4
  import { useTranslateValue } from './useTranslateValue.js';
4
5
  import useIntersectionObserver from './useIntersectionObserver.js';
5
6
  import { getDataVideoHeroBannerResponsive, getResponsiveSetting } from '../common/common.js';
@@ -19,6 +20,7 @@ const useHeroBanner = (styles, setting, currentDevice)=>{
19
20
  backgroundBoundingClientRect,
20
21
  speed: speedParallax
21
22
  });
23
+ const layoutResponsive = getResponsiveValueByScreen(setting?.layout, currentDevice);
22
24
  const backgroundResponsive = getResponsiveSetting(background || {});
23
25
  const enableParallax = Number(setting?.speedParallax || 0) > 0 && backgroundResponsive[currentDevice]?.type === 'image' || false;
24
26
  const onMouseEnterParallax = ()=>{
@@ -98,7 +100,8 @@ const useHeroBanner = (styles, setting, currentDevice)=>{
98
100
  elementRef,
99
101
  dataVideo,
100
102
  isShowVideoHtml5,
101
- openLinkBanner
103
+ openLinkBanner,
104
+ layoutResponsive
102
105
  };
103
106
  };
104
107
 
@@ -165,9 +165,7 @@ const SettingsV2 = [
165
165
  isNumber: true,
166
166
  min: 0,
167
167
  max: 1,
168
- step: 0.1,
169
- default: 0.6,
170
- compoDefaultValue: 0.6
168
+ step: 0.1
171
169
  },
172
170
  {
173
171
  id: 'alignBanner',
@@ -698,15 +696,7 @@ const SettingsV2 = [
698
696
  {
699
697
  id: 'shadowBg',
700
698
  type: 'shadow-v2',
701
- label: 'Button Shadow',
702
- default: {
703
- type: 'shadow-1',
704
- distance: '4px',
705
- blur: '12px',
706
- spread: '0px',
707
- color: '#121212',
708
- angle: 90
709
- }
699
+ label: 'Button Shadow'
710
700
  },
711
701
  {
712
702
  id: 'contentPadding',
@@ -315,7 +315,7 @@ const SettingUIV2 = [
315
315
  },
316
316
  iconName: 'polaris-parallax-effect',
317
317
  getValueFromSettingID: 'speedParallax',
318
- defaultValueWhenClear: 0,
318
+ compoDefaultValue: 0.6,
319
319
  controls: [
320
320
  {
321
321
  layout: 'vertical',
@@ -18,7 +18,7 @@ const Column = (props)=>{
18
18
  ...colAttr,
19
19
  style: colStyle,
20
20
  className: colClass,
21
- children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
21
+ children: isEmptyChildren(children) ? props.hiddenEmptyCol ? null : /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
22
22
  });
23
23
  };
24
24
 
@@ -19,7 +19,11 @@ const getStyles = (props, isPostPurchase)=>{
19
19
  displayByBreakpointIfChildrenEmpty[device] = getResponsiveValueByScreen(display, device) === 'fit' || !!layout && isColumnDirectionExist(layout, device) || REMOVE_SPACING_COMPONENT_TAG.includes(parentTag || '') ? 'none' : styles?.display?.[device];
20
20
  }
21
21
  const orderRender = ()=>{
22
- const od = order ?? styles?.order;
22
+ const stringifiedOrder = Object.fromEntries(Object.entries(styles?.order ?? {}).map(([key, value])=>[
23
+ key,
24
+ String(value)
25
+ ]));
26
+ const od = order ?? stringifiedOrder;
23
27
  if (isPostPurchase) {
24
28
  return {
25
29
  desktop: od?.desktop,
@@ -87,6 +87,7 @@ const Row = (props)=>{
87
87
  }) : /*#__PURE__*/ jsx(Fragment, {
88
88
  children: isRowEmpty ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : Children.map(children, (el)=>{
89
89
  if (/*#__PURE__*/ isValidElement(el)) return /*#__PURE__*/ createElement(el.type, {
90
+ hiddenEmptyCol: props.hiddenEmptyCol,
90
91
  ...el.props,
91
92
  key: el.key,
92
93
  order: setting?.order,
@@ -1,22 +1,24 @@
1
1
  'use client';
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
- import { getStyleBackgroundByDevice, cls, isEmptyChildren } from '@gem-sdk/core';
3
+ import { useEditorMode, cls, getStyleBackgroundByDevice, isEmptyChildren } from '@gem-sdk/core';
4
4
  import Head from 'next/head';
5
5
  import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
6
6
  import 'react';
7
7
  import { ELEMENT_Z_INDEX } from '../../common/const.js';
8
8
  import useSticky from './hooks/useSticky.js';
9
9
  import { createStyle } from '@gem-sdk/system';
10
+ import { getStylePadding, displayConditionStyle, filterStyles } from './common/styles.js';
10
11
 
11
12
  const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
13
+ const mode = useEditorMode();
12
14
  const { background, preloadBgImage } = setting ?? {};
13
- const { w, displayStyle, positionStyle, getCSSAlign } = useSticky(setting);
15
+ const { w, positionStyle, displayStyle, getCSSAlign } = useSticky(setting);
14
16
  const computedContainerStyles = createStyle({
15
17
  margin: '0 auto',
16
- ...style,
17
18
  ...w,
18
- ...getStyleBackgroundByDevice(background),
19
19
  ...displayStyle,
20
+ ...getStylePadding(style),
21
+ ...mode !== 'edit' && setting?.isScrollToTop ? displayConditionStyle(setting?.display, setting?.position) : {},
20
22
  ...positionStyle,
21
23
  ...getCSSAlign,
22
24
  zIndex: ELEMENT_Z_INDEX.STICKY
@@ -49,8 +51,9 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
49
51
  children: /*#__PURE__*/ jsx("div", {
50
52
  ...builderAttrs,
51
53
  "data-id": builderProps?.uid,
52
- "data-width": {
53
- ...w
54
+ style: {
55
+ ...filterStyles(style),
56
+ ...getStyleBackgroundByDevice(background)
54
57
  },
55
58
  children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
56
59
  })
@@ -1,15 +1,13 @@
1
- import { makeWidth, template, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
1
+ import { template, RenderIf, getStyleBackgroundByDevice, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
2
  import { getSettingPreloadData } from '../../helpers.js';
3
3
  import { createStyle, createStateOrContext } from '@gem-sdk/system';
4
- import { getContainerStyles } from './common/styles.js';
4
+ import { getContainerStyles, filterStyles } from './common/styles.js';
5
5
 
6
6
  const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced })=>{
7
- const { width, fullWidth, position, background, display, preloadBgImage, isScrollToTop } = setting ?? {};
7
+ const { width, position, display, preloadBgImage, background, isScrollToTop } = setting ?? {};
8
8
  const advancedDisplay = advanced?.d;
9
- const w = makeWidth(width, fullWidth);
10
9
  const computedContainerStyles = createStyle(getContainerStyles({
11
- w,
12
- background,
10
+ width,
13
11
  position,
14
12
  style,
15
13
  display
@@ -36,7 +34,10 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps, advanced
36
34
  >
37
35
  <div ${{
38
36
  ...builderAttrs
39
- }}>
37
+ }} style="${{
38
+ ...filterStyles(style),
39
+ ...getStyleBackgroundByDevice(background)
40
+ }}">
40
41
  ${children}
41
42
  </div>
42
43
  </gp-sticky>
@@ -1,4 +1,4 @@
1
- import { makeStyleResponsive, getStyleBackgroundByDevice } from '@gem-sdk/core';
1
+ import { makeStyleResponsive } from '@gem-sdk/core';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import { ELEMENT_Z_INDEX } from '../../../common/const.js';
@@ -28,7 +28,7 @@ const getDisplayStyle = (device, display, position)=>{
28
28
  const getCSSPosition = (position)=>{
29
29
  return position == 'top' ? 'sticky' : 'fixed';
30
30
  };
31
- const displayStyle = (display, position)=>{
31
+ const displayConditionStyle = (display, position)=>{
32
32
  return {
33
33
  ...getDisplayStyle('', display?.desktop, position?.desktop),
34
34
  ...getDisplayStyle('-tablet', display?.tablet ?? display?.desktop, position?.tablet ?? position?.desktop),
@@ -36,16 +36,61 @@ const displayStyle = (display, position)=>{
36
36
  };
37
37
  };
38
38
  const getContainerStyles = (args)=>{
39
- const { style, w, background, position, display } = args;
39
+ const { style, width, position, display } = args;
40
40
  return {
41
41
  margin: '0 auto',
42
- ...style,
43
- ...makeStyleResponsive('w', w),
44
- ...getStyleBackgroundByDevice(background),
45
- ...displayStyle(display, position),
42
+ ...getStylePadding(style),
43
+ ...makeStyleResponsive('w', width),
44
+ ...displayConditionStyle(display, position),
46
45
  ...getCSSAlign(position),
47
46
  'z-index': ELEMENT_Z_INDEX.STICKY
48
47
  };
49
48
  };
49
+ const getStylePadding = (style)=>{
50
+ const keepList = [
51
+ '--pt',
52
+ '--pb',
53
+ '--pr',
54
+ '--pl',
55
+ '--pt-mobile',
56
+ '--pb-mobile',
57
+ '--pr-mobile',
58
+ '--pl-mobile',
59
+ '--pt-tablet',
60
+ '--pb-tablet',
61
+ '--pr-tablet',
62
+ '--pl-tablet'
63
+ ];
64
+ const keepStyles = {};
65
+ keepList.forEach((element)=>{
66
+ if (style?.[element]) {
67
+ keepStyles[element] = style[element];
68
+ }
69
+ });
70
+ return keepStyles;
71
+ };
72
+ const filterStyles = (style)=>{
73
+ const cloneStyle = {
74
+ ...style
75
+ };
76
+ const delList = [
77
+ '--pt',
78
+ '--pb',
79
+ '--pr',
80
+ '--pl',
81
+ '--pt-mobile',
82
+ '--pb-mobile',
83
+ '--pr-mobile',
84
+ '--pl-mobile',
85
+ '--pt-tablet',
86
+ '--pb-tablet',
87
+ '--pr-tablet',
88
+ '--pl-tablet'
89
+ ];
90
+ delList.forEach((element)=>{
91
+ delete cloneStyle?.[element];
92
+ });
93
+ return cloneStyle;
94
+ };
50
95
 
51
- export { getContainerStyles };
96
+ export { displayConditionStyle, filterStyles, getContainerStyles, getDisplayStyle, getStylePadding };
@@ -1,15 +1,9 @@
1
1
  import { makeStyleResponsive, usePageStore, useCurrentDevice } from '@gem-sdk/core';
2
- import { createStyleObject } from '../../../grid/row/commons/helpers.js';
3
2
  import { useMemo } from 'react';
4
3
 
5
4
  const useSticky = (setting)=>{
6
- const { width, fullWidth, position } = setting ?? {};
7
- const styleObject = createStyleObject(width, fullWidth ?? {
8
- desktop: false,
9
- tablet: false,
10
- mobile: false
11
- });
12
- const w = makeStyleResponsive('w', styleObject.content);
5
+ const { width, position } = setting ?? {};
6
+ const w = makeStyleResponsive('w', width);
13
7
  const sidebarMode = usePageStore((s)=>s.sidebarMode === 'interaction');
14
8
  const currentDevice = useCurrentDevice();
15
9
  const getCSSPosition = (position)=>{
@@ -42,7 +42,7 @@ const StickySettingsV2 = [
42
42
  },
43
43
  {
44
44
  label: 'Default',
45
- value: 'default',
45
+ value: '1200px',
46
46
  showValue: true
47
47
  }
48
48
  ]
@@ -511,6 +511,7 @@ type RowProps = BaseProps<RowSettingsType, RowStylesType> & BasePropsWrap<{
511
511
  maxWidthWithEmptyChildren?: string | number;
512
512
  isNotFullWidth?: boolean;
513
513
  rawChildren?: any[];
514
+ hiddenEmptyCol?: boolean;
514
515
  };
515
516
 
516
517
  type ColProps = BasePropsWrap<{
@@ -531,6 +532,7 @@ type ColProps = BasePropsWrap<{
531
532
  layout?: ObjectDevices$1<ObjectLayoutValue>;
532
533
  parentTag?: string;
533
534
  rawChildren?: any[];
535
+ hiddenEmptyCol?: boolean;
534
536
  } & {
535
537
  advanced?: any;
536
538
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.446",
3
+ "version": "2.0.0-dev.448",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",