@gem-sdk/components 2.0.0-dev.255 → 2.0.0-dev.259

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 (126) hide show
  1. package/dist/cjs/banner/components/HeroBannerItem.js +2 -2
  2. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
  3. package/dist/cjs/builder.js +3 -3
  4. package/dist/cjs/cart/components/CartList.js +2 -2
  5. package/dist/cjs/collection/components/CollectionBanner.js +2 -1
  6. package/dist/cjs/collection/components/CollectionBanner.liquid.js +2 -1
  7. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  8. package/dist/cjs/grid/col/Col.js +29 -0
  9. package/dist/cjs/grid/col/Col.liquid.js +25 -0
  10. package/dist/cjs/grid/col/common/getAttr.js +15 -0
  11. package/dist/cjs/grid/col/common/getClass.js +25 -0
  12. package/dist/cjs/grid/{components/Col.liquid.js → col/common/getStyles.js} +22 -16
  13. package/dist/cjs/grid/next.js +3 -3
  14. package/dist/cjs/grid/{components → row}/Row.js +44 -55
  15. package/dist/cjs/grid/row/Row.liquid.js +122 -0
  16. package/dist/cjs/grid/row/commons/common.js +35 -0
  17. package/dist/cjs/grid/row/commons/getAttr.js +20 -0
  18. package/dist/cjs/grid/row/commons/getClass.js +44 -0
  19. package/dist/cjs/grid/row/commons/getData.js +17 -0
  20. package/dist/cjs/grid/row/commons/getStyle.js +102 -0
  21. package/dist/cjs/grid/{components → row/commons}/helpers.js +4 -4
  22. package/dist/cjs/grid/row/hooks/useRowSetting.js +78 -0
  23. package/dist/cjs/grid/{setting/row → row/setting}/configs/uiV2.js +1 -1
  24. package/dist/cjs/grid/{components → section}/Section.js +1 -1
  25. package/dist/cjs/grid/{components → section}/Section.liquid.js +1 -1
  26. package/dist/cjs/grid/{setting → section/setting}/Section.js +4 -4
  27. package/dist/cjs/grid/setting/index.js +3 -3
  28. package/dist/cjs/index.js +3 -3
  29. package/dist/cjs/index.liquid.js +3 -3
  30. package/dist/cjs/post-purchase/button/setting/configs/settings.js +21 -3
  31. package/dist/cjs/post-purchase/button/setting/configs/uiV2.js +1 -1
  32. package/dist/cjs/post-purchase/callout-banner/components/CalloutBox.js +1 -1
  33. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-box/setting.js +24 -6
  34. package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
  35. package/dist/cjs/post-purchase/product/components/ProductOffer.js +3 -2
  36. package/dist/cjs/post-purchase/product/settings/accept-button/configs/settings.js +21 -3
  37. package/dist/cjs/post-purchase/product/settings/accept-button/configs/uiV2.js +1 -1
  38. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/settings.js +21 -3
  39. package/dist/cjs/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +1 -1
  40. package/dist/cjs/post-purchase/product/settings/product-quantity/configs/settings.js +22 -5
  41. package/dist/cjs/post-purchase/product/settings/product-quantity/configs/uiV2.js +6 -3
  42. package/dist/cjs/post-purchase/product/settings/product-variants/configs/uiV2.js +2 -1
  43. package/dist/cjs/post-purchase/product/settings/product-variants/settings/settingsV2.js +15 -3
  44. package/dist/cjs/post-purchase/utils/constants.js +20 -10
  45. package/dist/cjs/product/components/Product.js +2 -1
  46. package/dist/cjs/product/components/Product.liquid.js +2 -1
  47. package/dist/cjs/product/components/ProductList.js +1 -1
  48. package/dist/cjs/product/components/ProductList.liquid.js +1 -1
  49. package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +2 -2
  50. package/dist/cjs/sticky/components/Sticky.js +1 -1
  51. package/dist/esm/banner/components/HeroBannerItem.js +2 -2
  52. package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
  53. package/dist/esm/builder.js +3 -3
  54. package/dist/esm/cart/components/CartList.js +2 -2
  55. package/dist/esm/collection/components/CollectionBanner.js +2 -1
  56. package/dist/esm/collection/components/CollectionBanner.liquid.js +2 -1
  57. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  58. package/dist/esm/grid/col/Col.js +25 -0
  59. package/dist/esm/grid/col/Col.liquid.js +21 -0
  60. package/dist/esm/grid/col/common/getAttr.js +13 -0
  61. package/dist/esm/grid/col/common/getClass.js +23 -0
  62. package/dist/esm/grid/{components/Col.liquid.js → col/common/getStyles.js} +23 -15
  63. package/dist/esm/grid/next.js +3 -3
  64. package/dist/esm/grid/{components → row}/Row.js +41 -52
  65. package/dist/esm/grid/row/Row.liquid.js +118 -0
  66. package/dist/esm/grid/row/commons/common.js +31 -0
  67. package/dist/esm/grid/row/commons/getAttr.js +18 -0
  68. package/dist/esm/grid/row/commons/getClass.js +42 -0
  69. package/dist/esm/grid/row/commons/getData.js +15 -0
  70. package/dist/esm/grid/row/commons/getStyle.js +100 -0
  71. package/dist/esm/grid/{components → row/commons}/helpers.js +4 -4
  72. package/dist/esm/grid/row/hooks/useRowSetting.js +76 -0
  73. package/dist/esm/grid/{setting/row → row/setting}/configs/uiV2.js +1 -1
  74. package/dist/esm/grid/{components → section}/Section.js +1 -1
  75. package/dist/esm/grid/{components → section}/Section.liquid.js +1 -1
  76. package/dist/esm/grid/{setting → section/setting}/Section.js +4 -4
  77. package/dist/esm/grid/setting/index.js +3 -3
  78. package/dist/esm/index.js +3 -3
  79. package/dist/esm/index.liquid.js +3 -3
  80. package/dist/esm/post-purchase/button/setting/configs/settings.js +21 -3
  81. package/dist/esm/post-purchase/button/setting/configs/uiV2.js +1 -1
  82. package/dist/esm/post-purchase/callout-banner/components/CalloutBox.js +1 -1
  83. package/dist/esm/post-purchase/callout-banner/setting/config/callout-box/setting.js +24 -6
  84. package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/uiV2.js +1 -1
  85. package/dist/esm/post-purchase/product/components/ProductOffer.js +3 -2
  86. package/dist/esm/post-purchase/product/settings/accept-button/configs/settings.js +21 -3
  87. package/dist/esm/post-purchase/product/settings/accept-button/configs/uiV2.js +1 -1
  88. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/settings.js +21 -3
  89. package/dist/esm/post-purchase/product/settings/product-price-breakdown/configs/uiV2.js +1 -1
  90. package/dist/esm/post-purchase/product/settings/product-quantity/configs/settings.js +22 -5
  91. package/dist/esm/post-purchase/product/settings/product-quantity/configs/uiV2.js +6 -3
  92. package/dist/esm/post-purchase/product/settings/product-variants/configs/uiV2.js +2 -1
  93. package/dist/esm/post-purchase/product/settings/product-variants/settings/settingsV2.js +15 -3
  94. package/dist/esm/post-purchase/utils/constants.js +20 -10
  95. package/dist/esm/product/components/Product.js +2 -1
  96. package/dist/esm/product/components/Product.liquid.js +2 -1
  97. package/dist/esm/product/components/ProductList.js +1 -1
  98. package/dist/esm/product/components/ProductList.liquid.js +1 -1
  99. package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +2 -2
  100. package/dist/esm/sticky/components/Sticky.js +1 -1
  101. package/dist/types/index.d.ts +27 -42
  102. package/package.json +2 -2
  103. package/dist/cjs/grid/components/Col.js +0 -44
  104. package/dist/cjs/grid/components/Row.liquid.js +0 -141
  105. package/dist/cjs/grid/hooks/useRowStyles.js +0 -153
  106. package/dist/esm/grid/components/Col.js +0 -40
  107. package/dist/esm/grid/components/Row.liquid.js +0 -137
  108. package/dist/esm/grid/hooks/useRowStyles.js +0 -151
  109. /package/dist/cjs/grid/{setting → col/setting}/Col.js +0 -0
  110. /package/dist/cjs/grid/{hooks → row/commons}/getInnerRadius.js +0 -0
  111. /package/dist/cjs/grid/{setting/row → row/setting}/Row.js +0 -0
  112. /package/dist/cjs/grid/{setting/row → row/setting}/configs/presets.js +0 -0
  113. /package/dist/cjs/grid/{setting/row → row/setting}/configs/settings.js +0 -0
  114. /package/dist/cjs/grid/{setting/row → row/setting}/configs/uiV1.js +0 -0
  115. /package/dist/cjs/grid/{setting/section → section/setting}/configs/settings.js +0 -0
  116. /package/dist/cjs/grid/{setting/section → section/setting}/configs/uiV1.js +0 -0
  117. /package/dist/cjs/grid/{setting/section → section/setting}/configs/uiV2.js +0 -0
  118. /package/dist/esm/grid/{setting → col/setting}/Col.js +0 -0
  119. /package/dist/esm/grid/{hooks → row/commons}/getInnerRadius.js +0 -0
  120. /package/dist/esm/grid/{setting/row → row/setting}/Row.js +0 -0
  121. /package/dist/esm/grid/{setting/row → row/setting}/configs/presets.js +0 -0
  122. /package/dist/esm/grid/{setting/row → row/setting}/configs/settings.js +0 -0
  123. /package/dist/esm/grid/{setting/row → row/setting}/configs/uiV1.js +0 -0
  124. /package/dist/esm/grid/{setting/section → section/setting}/configs/settings.js +0 -0
  125. /package/dist/esm/grid/{setting/section → section/setting}/configs/uiV1.js +0 -0
  126. /package/dist/esm/grid/{setting/section → section/setting}/configs/uiV2.js +0 -0
@@ -0,0 +1,118 @@
1
+ import { template, WrapRenderChildren, RenderChildren, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
2
+ import { getSettingPreloadData } from '../../helpers.js';
3
+ import { getResponsiveSetting } from '../../banner/components/common/common.js';
4
+ import HTML5Embed from '../../video/components/HTML5Embed.liquid.js';
5
+ import { getRowStyle } from './commons/getStyle.js';
6
+ import { getClass } from './commons/getClass.js';
7
+ import { getAttr } from './commons/getAttr.js';
8
+ import { createClass, If } from '@gem-sdk/system';
9
+ import { getData } from './commons/getData.js';
10
+ import { checkHasBackgroundVideo, isRenderHtmlVideo, isRenderYoutubeVideo } from './commons/common.js';
11
+ import { getYoutubeVideoId } from '../../video/helpers/common.js';
12
+ import LiteYouTubeEmbed from '../../video/components/LiteYouTubeEmbed.liquid.js';
13
+
14
+ const Row = (props)=>{
15
+ const { styles, setting, rawChildren, builderProps } = props;
16
+ const { isSection } = setting ?? {};
17
+ const { background } = styles ?? {};
18
+ const elementTag = isSection ? 'section' : 'div';
19
+ const { stateData } = getData(props);
20
+ const { rowStyle, backgroundBoxStyle, embedVideoStyle, sectionStyle } = getRowStyle(props);
21
+ const { rowAttr, sectionAttr } = getAttr(props);
22
+ const { rowClass, backgroundBoxClass, backgroundBoxInnerClass, sectionClass, wrapperYoutubeClasses, iframeYoutubeClasses } = getClass(props);
23
+ const className = createClass({
24
+ [rowClass]: true
25
+ });
26
+ const embed = ()=>{
27
+ if (!checkHasBackgroundVideo(background)) return;
28
+ const backgroundResponsive = getResponsiveSetting(background || {});
29
+ if (isRenderHtmlVideo(background)) {
30
+ return HTML5Embed({
31
+ uid: builderProps?.uid,
32
+ muted: true,
33
+ loop: backgroundResponsive.desktop?.loop,
34
+ controls: false,
35
+ autoplay: true,
36
+ src: '',
37
+ title: 'Video',
38
+ className: 'gp-relative',
39
+ style: embedVideoStyle
40
+ });
41
+ }
42
+ if (isRenderYoutubeVideo(background)) {
43
+ const youtubeUrl = backgroundResponsive?.desktop?.video ?? '';
44
+ const videoId = getYoutubeVideoId(youtubeUrl) || '';
45
+ const isLoop = false;
46
+ const params = `&loop=${isLoop}&playlist=${videoId}&showinfo=0&rel=0&fs=0&enablejsapi=1`;
47
+ return LiteYouTubeEmbed({
48
+ uid: builderProps?.uid,
49
+ id: videoId,
50
+ isHeroBanner: true,
51
+ autoplay: true,
52
+ title: 'Video',
53
+ controls: false,
54
+ params: params,
55
+ adNetwork: false,
56
+ noCookie: true,
57
+ muted: true,
58
+ lazy: backgroundResponsive?.desktop?.lazyLoad ?? true,
59
+ preload: true,
60
+ style: embedVideoStyle,
61
+ wrapperClass: wrapperYoutubeClasses,
62
+ iframeClass: iframeYoutubeClasses
63
+ });
64
+ }
65
+ };
66
+ const renderComponentScript = ()=>{
67
+ if (!checkHasBackgroundVideo(background)) return;
68
+ return template`
69
+ ${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-row.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-row.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
70
+ `;
71
+ };
72
+ const element = template`
73
+ <gp-row gp-data='${stateData}' ${{
74
+ ...rowAttr
75
+ }} class="${className}" style="${rowStyle}">
76
+ ${If(!!embed(), template /* liquid */ `
77
+ <div class="${backgroundBoxClass}" style="${backgroundBoxStyle}">
78
+ <div class="${backgroundBoxInnerClass}">${embed()}</div>
79
+ </div>
80
+ `)}
81
+
82
+ ${WrapRenderChildren({
83
+ uid: builderProps?.uid || '',
84
+ customProps: rawChildren?.[0].customProps
85
+ }, rawChildren?.map((child)=>{
86
+ if (child) {
87
+ return RenderChildren({
88
+ ...child,
89
+ order: setting?.order,
90
+ layout: setting?.layout,
91
+ justifyContent: setting?.verticalAlign
92
+ });
93
+ }
94
+ }))}
95
+
96
+ ${renderComponentScript()}
97
+ </gp-row>
98
+ `;
99
+ return template`
100
+ ${RenderIf(!!styles?.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" />`)}`)}
101
+
102
+ ${RenderIf(!!isSection, `{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}`)}
103
+
104
+ ${If(isSection, template /* liquid */ `
105
+ <${elementTag}
106
+ ${{
107
+ ...sectionAttr
108
+ }}
109
+ class="${sectionClass} ${isSection ? getSettingPreloadData('gps-lazy') : ''}"
110
+ style="${sectionStyle}"
111
+ >
112
+ ${element}
113
+ </${elementTag}>
114
+ `, template /* liquid */ `${element}`)}
115
+ `;
116
+ };
117
+
118
+ export { Row as default };
@@ -0,0 +1,31 @@
1
+ import { getValueByDevice } from '@gem-sdk/core';
2
+ import { getResponsiveSetting } from '../../../carousel/components/common/arrow.js';
3
+
4
+ const checkHasBackgroundVideo = (background)=>{
5
+ const DEVICES = [
6
+ 'desktop',
7
+ 'tablet',
8
+ 'mobile'
9
+ ];
10
+ return DEVICES.some((item)=>{
11
+ const bg = getValueByDevice(background, item);
12
+ if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
13
+ return false;
14
+ });
15
+ };
16
+ const isRenderHtmlVideo = (background)=>{
17
+ const backgroundResponsive = getResponsiveSetting(background || {});
18
+ const videoType = backgroundResponsive.desktop?.videoType;
19
+ const videoTypeTablet = backgroundResponsive.tablet?.videoType;
20
+ const videoTypeMobile = backgroundResponsive.mobile?.videoType;
21
+ return videoType == 'html5' || videoTypeTablet == 'html5' || videoTypeMobile == 'html5';
22
+ };
23
+ const isRenderYoutubeVideo = (background)=>{
24
+ const backgroundResponsive = getResponsiveSetting(background || {});
25
+ const videoType = backgroundResponsive.desktop?.videoType;
26
+ const videoTypeTablet = backgroundResponsive.tablet?.videoType;
27
+ const videoTypeMobile = backgroundResponsive.mobile?.videoType;
28
+ return videoType == 'youtube' || videoTypeTablet == 'youtube' || videoTypeMobile == 'youtube';
29
+ };
30
+
31
+ export { checkHasBackgroundVideo, isRenderHtmlVideo, isRenderYoutubeVideo };
@@ -0,0 +1,18 @@
1
+ import { createAttr } from '@gem-sdk/system';
2
+
3
+ const getAttr = (props)=>{
4
+ const { builderProps, setting } = props;
5
+ const rowAttr = createAttr({
6
+ 'data-id': builderProps?.uidInteraction ?? builderProps?.uid ?? '',
7
+ id: builderProps?.uid ?? ''
8
+ });
9
+ const sectionAttr = createAttr({
10
+ 'data-same-height-display-contents': !!setting?.allowSameHeight
11
+ });
12
+ return {
13
+ rowAttr,
14
+ sectionAttr
15
+ };
16
+ };
17
+
18
+ export { getAttr };
@@ -0,0 +1,42 @@
1
+ import { createClass } from '@gem-sdk/system';
2
+
3
+ const getClass = (props)=>{
4
+ const { builderProps, advanced, className } = props;
5
+ const backgroundBoxClass = createClass({
6
+ 'gp-background-video gp-absolute gp-overflow-hidden gp-w-full gp-h-full left-0 top-0': true
7
+ });
8
+ const backgroundBoxInnerClass = createClass({
9
+ 'gp-bg-video gp-relative gp-h-full': true
10
+ });
11
+ const rowClass = createClass({
12
+ ...className && {
13
+ [className]: true
14
+ },
15
+ ...builderProps?.uid && {
16
+ [builderProps.uid]: true
17
+ },
18
+ 'gp-relative gp-mx-auto gp-mb-0 gp-grid gp-max-w-full gp-transition-colors gp-duration-200 gp-ease-in-out [&_*]:gp-max-w-full': true,
19
+ ...advanced?.cssClass && {
20
+ [advanced?.cssClass]: true
21
+ }
22
+ });
23
+ const sectionClass = createClass({
24
+ 'gp-mx-auto gp-max-w-full [&_*]:gp-max-w-full': true
25
+ });
26
+ const wrapperYoutubeClasses = createClass({
27
+ 'gp-pb-[56.25%] gp-h-full gp-w-full !gp-max-w-none': true
28
+ });
29
+ const iframeYoutubeClasses = createClass({
30
+ '!gp-w-[500%] !gp-ml-[-200%] !gp-h-full !gp-max-w-none gp-scale-[104%]': true
31
+ });
32
+ return {
33
+ rowClass,
34
+ backgroundBoxClass,
35
+ backgroundBoxInnerClass,
36
+ sectionClass,
37
+ wrapperYoutubeClasses,
38
+ iframeYoutubeClasses
39
+ };
40
+ };
41
+
42
+ export { getClass };
@@ -0,0 +1,15 @@
1
+ import { createStateOrContext } from '@gem-sdk/system';
2
+ import { dataStringify } from '@gem-sdk/core';
3
+
4
+ const getData = (props)=>{
5
+ const { styles, builderProps } = props;
6
+ const stateData = createStateOrContext({
7
+ background: styles?.background,
8
+ uid: builderProps?.uid
9
+ });
10
+ return {
11
+ stateData: dataStringify(stateData).replaceAll("'", '&#039;')
12
+ };
13
+ };
14
+
15
+ export { getData };
@@ -0,0 +1,100 @@
1
+ 'use client';
2
+ import { makeStyleResponsive, isEmptyChildren, splitStyle, composeGridLayout, makeStyle, getStyleBackgroundByDevice, getGradientBgrStyleByDevice, composeRadius } from '@gem-sdk/core';
3
+ import { getInnerRadiusExcludeBorder } from './getInnerRadius.js';
4
+ import { createStyle } from '@gem-sdk/system';
5
+ import { createStyleObject } from './helpers.js';
6
+
7
+ const getRowStyle = (rowProps)=>{
8
+ const { children, setting, builderProps, styles, style, advanced, isNotFullWidth } = rowProps;
9
+ const { isSection, layout, horizontalAlign, responsive, inlineAlignment } = setting ?? {};
10
+ const { width, columnGap, fullWidth, background, verticalGutter, verticalGutterMobile } = styles ?? {};
11
+ const innerRadius = getInnerRadiusExcludeBorder(advanced?.border, advanced?.rounded);
12
+ const childHasChildren = builderProps?.builderData?.childrens?.length;
13
+ const bgVideoAspectRatioStyle = {
14
+ ...makeStyleResponsive('aspect', {
15
+ desktop: '16/9'
16
+ })
17
+ };
18
+ const isRowEmpty = isEmptyChildren(children) || !childHasChildren;
19
+ const sizeStyles = createStyleObject(width, fullWidth);
20
+ const [wrapStyle, restStyle] = splitStyle([
21
+ 'pos',
22
+ 'top',
23
+ 'left',
24
+ 'bottom',
25
+ 'right',
26
+ 'z'
27
+ ], style);
28
+ const getGlobalStyles = ()=>{
29
+ return {
30
+ ...isSection ? restStyle : style,
31
+ ...makeStyleResponsive('cg', verticalGutter),
32
+ ...makeStyleResponsive('rg', verticalGutterMobile),
33
+ ...layout ? composeGridLayout(layout) : makeStyleResponsive('gtc', responsive),
34
+ ...makeStyleResponsive('w', sizeStyles.content)
35
+ };
36
+ };
37
+ const getPostPurchaseStyle = ()=>{
38
+ return {
39
+ '--mb': '0px',
40
+ '--mt': '0px',
41
+ ...makeStyleResponsive('cg', columnGap),
42
+ ...makeStyle({
43
+ pc: inlineAlignment
44
+ })
45
+ };
46
+ };
47
+ const getRowNormalStyle = (options)=>{
48
+ return {
49
+ ...getStyleBackgroundByDevice(background, options),
50
+ ...getGradientBgrStyleByDevice(background, {
51
+ desktop: true,
52
+ tablet: true,
53
+ mobile: true
54
+ }),
55
+ ...makeStyleResponsive('pc', horizontalAlign)
56
+ };
57
+ };
58
+ const getMarginByWidth = ()=>{
59
+ const isCustomizeMargin = isNotFullWidth && !isRowEmpty;
60
+ if (!isCustomizeMargin) return {};
61
+ return {
62
+ marginLeft: '0px',
63
+ marginRight: '0px'
64
+ };
65
+ };
66
+ const getRadiusStyleInner = ()=>{
67
+ return {
68
+ ...composeRadius(innerRadius)
69
+ };
70
+ };
71
+ const rowStyle = createStyle({
72
+ ...getGlobalStyles(),
73
+ ...getRowNormalStyle(),
74
+ ...getMarginByWidth(),
75
+ ...getPostPurchaseStyle()
76
+ });
77
+ const backgroundBoxStyle = createStyle({
78
+ ...getRadiusStyleInner()
79
+ });
80
+ const embedVideoStyle = createStyle({
81
+ ...bgVideoAspectRatioStyle,
82
+ pointerEvents: 'none',
83
+ transform: 'translateY(-50%)',
84
+ top: '50%'
85
+ });
86
+ const sectionStyle = createStyle({
87
+ ...wrapStyle,
88
+ ...makeStyleResponsive('w', sizeStyles.wrapper),
89
+ ...makeStyleResponsive('pl', sizeStyles.padding),
90
+ ...makeStyleResponsive('pr', sizeStyles.padding)
91
+ });
92
+ return {
93
+ embedVideoStyle,
94
+ backgroundBoxStyle,
95
+ rowStyle,
96
+ sectionStyle
97
+ };
98
+ };
99
+
100
+ export { getRowStyle };
@@ -30,7 +30,7 @@ const getStyleByDevice = (device, fullWidth, width)=>{
30
30
  };
31
31
  } else {
32
32
  return {
33
- contentWidth: `var(--g-ct-w, ${defaultWidth[device]})`,
33
+ contentWidth: undefined,
34
34
  wrapperWidth: `calc(var(--g-ct-w, ${defaultWidth[device]}) + 2 * var(--g-ct-p, 15px))`,
35
35
  wrapperPadding: 'var(--g-ct-p, 15px)'
36
36
  };
@@ -42,9 +42,9 @@ const createStyleObject = (width, fullWidth)=>{
42
42
  const mobileStyle = getStyleByDevice('mobile', fullWidth, width);
43
43
  return {
44
44
  content: {
45
- desktop: desktopStyle.contentWidth || '100%',
46
- tablet: tabletStyle.contentWidth || '100%',
47
- mobile: mobileStyle.contentWidth || '100%'
45
+ desktop: desktopStyle.contentWidth,
46
+ tablet: tabletStyle.contentWidth,
47
+ mobile: mobileStyle.contentWidth
48
48
  },
49
49
  wrapper: {
50
50
  desktop: desktopStyle.wrapperWidth,
@@ -0,0 +1,76 @@
1
+ import { useState, useMemo } from 'react';
2
+ import { useCurrentDevice, useEditorMode, usePageType, getValueByDevice, isEmptyChildren, getResponsiveValue } from '@gem-sdk/core';
3
+ import { createClass } from '@gem-sdk/system';
4
+ import { useInView } from '../../../intersection-observer/useInView.js';
5
+
6
+ const useRowSettings = (rowProps)=>{
7
+ const { setting, styles, children, maxWidthWithEmptyChildren, builderAttrs } = rowProps;
8
+ const { isSection, lazy, layout, blockAlignment } = setting ?? {};
9
+ const { background } = styles ?? {};
10
+ const currentDevice = useCurrentDevice();
11
+ const [cacheHeightOutViewport, setCacheHeightOutViewport] = useState(500);
12
+ const mode = useEditorMode();
13
+ const pageType = usePageType();
14
+ const bgVideo = getValueByDevice(background, currentDevice);
15
+ const isRowEmpty = useMemo(()=>{
16
+ return isEmptyChildren(children);
17
+ }, [
18
+ children
19
+ ]);
20
+ const [ref, inView] = useInView({
21
+ initialInView: !lazy,
22
+ triggerOnce: true,
23
+ skip: !isSection,
24
+ onChange: (inView, node)=>{
25
+ if (mode == 'edit' && !inView && node) {
26
+ const computedStyle = getComputedStyle(node);
27
+ let height = node?.getBoundingClientRect().height;
28
+ height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
29
+ setCacheHeightOutViewport(height ?? 500);
30
+ }
31
+ }
32
+ });
33
+ const isRenderPlaceholderViewBox = useMemo(()=>!inView && mode == 'edit', [
34
+ inView,
35
+ mode
36
+ ]);
37
+ const isVisibilityContent = useMemo(()=>mode !== 'edit' && lazy && !inView, [
38
+ inView,
39
+ lazy,
40
+ mode
41
+ ]);
42
+ const getWidthForEmptyChildren = ()=>{
43
+ const isCustomizeWidth = maxWidthWithEmptyChildren && isRowEmpty && mode === 'edit';
44
+ if (!isCustomizeWidth) return {};
45
+ const display = getResponsiveValue(layout, 'display');
46
+ const displayByDevice = display[currentDevice];
47
+ return {
48
+ width: displayByDevice === 'fit' ? 'fit-content' : '400px'
49
+ };
50
+ };
51
+ const rowClassEditorOnly = createClass({
52
+ ...getWidthForEmptyChildren,
53
+ 'gp-content-visibility-hidden': isVisibilityContent
54
+ });
55
+ const postPurchaseVerticalAlign = ()=>{
56
+ return {
57
+ desktop: blockAlignment,
58
+ tablet: blockAlignment,
59
+ mobile: blockAlignment
60
+ };
61
+ };
62
+ return {
63
+ ref,
64
+ isRowEmpty,
65
+ cacheHeightOutViewport,
66
+ bgVideo,
67
+ rowClassEditorOnly,
68
+ isRenderPlaceholderViewBox,
69
+ builderAttrs,
70
+ children,
71
+ isPostPurchase: pageType === 'POST_PURCHASE',
72
+ postPurchaseVerticalAlign
73
+ };
74
+ };
75
+
76
+ export { useRowSettings };
@@ -27,7 +27,7 @@ const SettingUIV2 = [
27
27
  },
28
28
  {
29
29
  label: {
30
- en: 'Column Spacing'
30
+ en: 'Column spacing'
31
31
  },
32
32
  conditionDisplay: `pageType !== "POST_PURCHASE" && childrens > 1`,
33
33
  controls: [
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import { jsx } from 'react/jsx-runtime';
3
- import Row from './Row.js';
3
+ import Row from '../row/Row.js';
4
4
  import Loading from '../../common/components/Loading.js';
5
5
  import { useMemo } from 'react';
6
6
 
@@ -1,4 +1,4 @@
1
- import Row from './Row.liquid.js';
1
+ import Row from '../row/Row.liquid.js';
2
2
 
3
3
  const Section = (props)=>{
4
4
  return Row({
@@ -1,7 +1,7 @@
1
- import config$1 from './row/Row.js';
2
- import { SectionSettings } from './section/configs/settings.js';
3
- import { SettingUIV1 } from './section/configs/uiV1.js';
4
- import { SettingUIV2 } from './section/configs/uiV2.js';
1
+ import config$1 from '../../row/setting/Row.js';
2
+ import { SectionSettings } from './configs/settings.js';
3
+ import { SettingUIV1 } from './configs/uiV1.js';
4
+ import { SettingUIV2 } from './configs/uiV2.js';
5
5
 
6
6
  const config = {
7
7
  ...config$1,
@@ -1,7 +1,7 @@
1
1
  import config from './Root.js';
2
- import config$1 from './Section.js';
3
- import config$2 from './Col.js';
4
- import config$3 from './row/Row.js';
2
+ import config$1 from '../section/setting/Section.js';
3
+ import config$3 from '../row/setting/Row.js';
4
+ import config$2 from '../col/setting/Col.js';
5
5
 
6
6
  var gridSetting = {
7
7
  Root: config,
package/dist/esm/index.js CHANGED
@@ -36,9 +36,9 @@ export { default as CollectionPaginator } from './collection/components/Collecti
36
36
  export { default as countdownSetting } from './countdown-timer/setting/index.js';
37
37
  export { default as Countdown } from './countdown-timer/components/Countdown.js';
38
38
  export { default as gridSetting } from './grid/setting/index.js';
39
- export { default as Col } from './grid/components/Col.js';
40
- export { default as Row } from './grid/components/Row.js';
41
- export { default as Section } from './grid/components/Section.js';
39
+ export { default as Col } from './grid/col/Col.js';
40
+ export { default as Row } from './grid/row/Row.js';
41
+ export { default as Section } from './grid/section/Section.js';
42
42
  export { default as Root } from './grid/components/Root.js';
43
43
  export { default as headingSetting } from './heading/setting/index.js';
44
44
  export { default as Heading } from './heading/Heading.js';
@@ -2,9 +2,9 @@
2
2
  export { default as ButtonV1 } from './button/components/Button.liquid.js';
3
3
  export { default as Button } from './button/components/v2/ButtonV2.liquid.js';
4
4
  export { default as Coupon } from './coupon/components/Coupon.liquid.js';
5
- export { default as Col } from './grid/components/Col.liquid.js';
6
- export { default as Row } from './grid/components/Row.liquid.js';
7
- export { default as Section } from './grid/components/Section.liquid.js';
5
+ export { default as Col } from './grid/col/Col.liquid.js';
6
+ export { default as Row } from './grid/row/Row.liquid.js';
7
+ export { default as Section } from './grid/section/Section.liquid.js';
8
8
  export { default as Root } from './grid/components/Root.liquid.js';
9
9
  export { default as Icon } from './icon/components/Icon.liquid.js';
10
10
  export { default as Text } from './text/components/Text.liquid.js';
@@ -47,13 +47,14 @@ const DeclineButtonSettings = [
47
47
  controls: [
48
48
  {
49
49
  id: 'width',
50
- type: 'input:unit-width',
50
+ type: 'dropdown:input',
51
51
  label: 'Width',
52
- min: 0,
52
+ inputType: 'number',
53
53
  units: [
54
54
  'px',
55
55
  '%'
56
56
  ],
57
+ hideUnit: false,
57
58
  devices: {
58
59
  desktop: {
59
60
  default: '100%'
@@ -64,7 +65,24 @@ const DeclineButtonSettings = [
64
65
  mobile: {
65
66
  default: '100%'
66
67
  }
67
- }
68
+ },
69
+ displayOptions: [
70
+ {
71
+ label: 'Fit content',
72
+ value: 'Auto',
73
+ showValue: true
74
+ },
75
+ {
76
+ label: 'Full',
77
+ value: '100%',
78
+ showValue: true
79
+ },
80
+ {
81
+ label: 'Default',
82
+ value: 'default',
83
+ showValue: true
84
+ }
85
+ ]
68
86
  },
69
87
  {
70
88
  id: 'typo',
@@ -66,7 +66,7 @@ const SettingUIV2 = [
66
66
  options: {
67
67
  labelVariant: 'primary',
68
68
  fullWidth: true,
69
- disableMessage: 'This option is disabled because the width is set to 100%'
69
+ disableMessage: 'Horizontal alignment is disabled when the width is set to 100% or greater'
70
70
  },
71
71
  layout: 'horizontal'
72
72
  }
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
3
3
  import { createClass, createStyle } from '@gem-sdk/system';
4
4
  import '@gem-sdk/core';
5
5
  import 'react';
6
- import Row from '../../../grid/components/Row.js';
6
+ import Row from '../../../grid/row/Row.js';
7
7
  import { getCalloutBoxWrapperClasses } from './common/getClasses.js';
8
8
  import { getCalloutBoxContainerStyles } from './common/getStyles.js';
9
9
 
@@ -227,24 +227,42 @@ const CalloutBoxSettings = [
227
227
  },
228
228
  {
229
229
  id: 'width',
230
- type: 'input:unit-width',
230
+ type: 'dropdown:input',
231
231
  label: 'Width',
232
- min: 0,
232
+ inputType: 'number',
233
233
  units: [
234
234
  'px',
235
235
  '%'
236
236
  ],
237
+ hideUnit: false,
237
238
  devices: {
238
239
  desktop: {
239
- default: undefined
240
+ default: '100%'
240
241
  },
241
242
  tablet: {
242
- default: undefined
243
+ default: '100%'
243
244
  },
244
245
  mobile: {
245
- default: undefined
246
+ default: '100%'
246
247
  }
247
- }
248
+ },
249
+ displayOptions: [
250
+ {
251
+ label: 'Fit content',
252
+ value: 'Auto',
253
+ showValue: true
254
+ },
255
+ {
256
+ label: 'Full',
257
+ value: '100%',
258
+ showValue: true
259
+ },
260
+ {
261
+ label: 'Default',
262
+ value: 'default',
263
+ showValue: true
264
+ }
265
+ ]
248
266
  },
249
267
  {
250
268
  id: 'verticalGutter',
@@ -109,7 +109,7 @@ const SettingUIV2 = [
109
109
  options: {
110
110
  labelVariant: 'primary',
111
111
  fullWidth: true,
112
- disableMessage: `This option is disabled because the width is set to 100%`
112
+ disableMessage: `Horizontal alignment is disabled when the width is set to 100% or greater`
113
113
  },
114
114
  setting: {
115
115
  id: 'align'
@@ -2,9 +2,10 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { useEditorMode, usePageStore, useProductsQuery, flattenConnection, cls, makeStyle, ProductProvider, isEmptyChildren, makeStyleResponsive, makeWidth } from '@gem-sdk/core';
4
4
  import ChildrenDroppable from '../../../grid/components/ChildrenDroppable.js';
5
- import { useMemo } from 'react';
6
- import Row from '../../../grid/components/Row.js';
5
+ import '@gem-sdk/system';
6
+ import Row from '../../../grid/row/Row.js';
7
7
  import Loading from '../../../common/components/Loading.js';
8
+ import { useMemo } from 'react';
8
9
  import { postPurchaseViewSpacing } from '../../utils/helper.js';
9
10
  import { hasPublicStoreFrontData, createStoreFrontFetcher } from '../helpers/index.js';
10
11
  import { productOfferPlaceholder } from '../constants/ProductOfferPlaceholder.js';