@gem-sdk/components 2.0.0-dev.480 → 2.0.0-dev.482
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.
- package/dist/cjs/article/components/ArticleList.js +1 -2
- package/dist/cjs/article/components/ArticleList.liquid.js +1 -1
- package/dist/cjs/article/setting/ArticleList.js +7 -591
- package/dist/cjs/article/setting/configs/ArticleList/presets.js +346 -0
- package/dist/cjs/article/setting/configs/ArticleList/settings.js +315 -0
- package/dist/cjs/article/setting/configs/ArticleList/uiV2.js +201 -0
- package/dist/cjs/article/setting/configs/ArticleReadMore/settings.js +1 -1
- package/dist/cjs/banner/components/HeroBanner.liquid.js +2 -2
- package/dist/cjs/banner/components/HeroBannerItem.js +15 -7
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +13 -11
- package/dist/cjs/banner/components/common/common.js +13 -29
- package/dist/cjs/banner/components/common/getClasses.js +2 -1
- package/dist/cjs/banner/components/common/getStyle.js +2 -0
- package/dist/cjs/banner/components/hooks/useHeroBanner.js +2 -7
- package/dist/cjs/banner/setting/setting.js +12 -0
- package/dist/cjs/banner/setting/uiV2.js +28 -6
- package/dist/cjs/countdown-timer/setting/configs/settings.js +51 -6
- package/dist/cjs/countdown-timer/setting/configs/uiV2.js +177 -100
- package/dist/cjs/dialog/setting/configs/settings.js +2 -2
- package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +3 -2
- package/dist/cjs/product/components/ProductSKU/Sku.liquid.js +3 -2
- package/dist/cjs/product/setting/product-price/configs/uiV2.js +1 -1
- package/dist/cjs/sticky/components/Sticky.liquid.js +6 -0
- package/dist/cjs/stock-counter/setting/configs/settingsV2.js +7 -6
- package/dist/cjs/stock-counter/setting/configs/uiV2.js +36 -6
- package/dist/esm/article/components/ArticleList.js +1 -2
- package/dist/esm/article/components/ArticleList.liquid.js +1 -1
- package/dist/esm/article/setting/ArticleList.js +7 -591
- package/dist/esm/article/setting/configs/ArticleList/presets.js +344 -0
- package/dist/esm/article/setting/configs/ArticleList/settings.js +313 -0
- package/dist/esm/article/setting/configs/ArticleList/uiV2.js +199 -0
- package/dist/esm/article/setting/configs/ArticleReadMore/settings.js +1 -1
- package/dist/esm/banner/components/HeroBanner.liquid.js +2 -2
- package/dist/esm/banner/components/HeroBannerItem.js +16 -8
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +12 -10
- package/dist/esm/banner/components/common/common.js +15 -30
- package/dist/esm/banner/components/common/getClasses.js +2 -1
- package/dist/esm/banner/components/common/getStyle.js +2 -0
- package/dist/esm/banner/components/hooks/useHeroBanner.js +4 -9
- package/dist/esm/banner/setting/setting.js +12 -0
- package/dist/esm/banner/setting/uiV2.js +28 -6
- package/dist/esm/countdown-timer/setting/configs/settings.js +51 -6
- package/dist/esm/countdown-timer/setting/configs/uiV2.js +177 -100
- package/dist/esm/dialog/setting/configs/settings.js +2 -2
- package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +3 -2
- package/dist/esm/product/components/ProductSKU/Sku.liquid.js +4 -3
- package/dist/esm/product/setting/product-price/configs/uiV2.js +1 -1
- package/dist/esm/sticky/components/Sticky.liquid.js +6 -0
- package/dist/esm/stock-counter/setting/configs/settingsV2.js +8 -7
- package/dist/esm/stock-counter/setting/configs/uiV2.js +36 -6
- package/dist/types/index.d.ts +6 -0
- package/package.json +2 -2
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
const uiV2 = [
|
|
2
|
+
{
|
|
3
|
+
label: {
|
|
4
|
+
en: 'Article source'
|
|
5
|
+
},
|
|
6
|
+
controls: [
|
|
7
|
+
{
|
|
8
|
+
setting: {
|
|
9
|
+
id: 'articleSetting'
|
|
10
|
+
},
|
|
11
|
+
layout: 'vertical'
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
label: {
|
|
17
|
+
en: 'Display'
|
|
18
|
+
},
|
|
19
|
+
controls: [
|
|
20
|
+
{
|
|
21
|
+
label: {
|
|
22
|
+
en: 'Columns'
|
|
23
|
+
},
|
|
24
|
+
setting: {
|
|
25
|
+
id: 'slideToShow'
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
label: {
|
|
32
|
+
en: 'Grid'
|
|
33
|
+
},
|
|
34
|
+
controls: [
|
|
35
|
+
{
|
|
36
|
+
label: {
|
|
37
|
+
en: 'Columns gap'
|
|
38
|
+
},
|
|
39
|
+
setting: {
|
|
40
|
+
id: 'verticalGutter'
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: {
|
|
45
|
+
en: 'Rows gap'
|
|
46
|
+
},
|
|
47
|
+
setting: {
|
|
48
|
+
id: 'horizontalGutter'
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
label: {
|
|
55
|
+
en: 'Size'
|
|
56
|
+
},
|
|
57
|
+
controls: [
|
|
58
|
+
{
|
|
59
|
+
id: 'Width',
|
|
60
|
+
label: {
|
|
61
|
+
en: 'Width'
|
|
62
|
+
},
|
|
63
|
+
controlConfig: {
|
|
64
|
+
id: 'width',
|
|
65
|
+
type: 'dropdown:input',
|
|
66
|
+
label: 'Width',
|
|
67
|
+
inputType: 'number',
|
|
68
|
+
units: [
|
|
69
|
+
'px',
|
|
70
|
+
'%'
|
|
71
|
+
],
|
|
72
|
+
hideUnit: false,
|
|
73
|
+
linkWithSetting: {
|
|
74
|
+
name: 'width'
|
|
75
|
+
},
|
|
76
|
+
displayOptions: [
|
|
77
|
+
{
|
|
78
|
+
label: 'Full',
|
|
79
|
+
value: '100%',
|
|
80
|
+
showValue: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: 'Default',
|
|
84
|
+
value: 'default',
|
|
85
|
+
showValue: true
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
},
|
|
89
|
+
layout: 'horizontal'
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
label: {
|
|
93
|
+
en: 'Padding'
|
|
94
|
+
},
|
|
95
|
+
controlConfig: {
|
|
96
|
+
id: 'padding',
|
|
97
|
+
type: 'padding-v2',
|
|
98
|
+
linkWithSetting: {
|
|
99
|
+
name: 'spacing-setting',
|
|
100
|
+
field: 'padding'
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
label: {
|
|
108
|
+
en: 'Background'
|
|
109
|
+
},
|
|
110
|
+
controls: [
|
|
111
|
+
{
|
|
112
|
+
setting: {
|
|
113
|
+
id: 'background'
|
|
114
|
+
},
|
|
115
|
+
layout: 'vertical'
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: {
|
|
121
|
+
en: 'Shape'
|
|
122
|
+
},
|
|
123
|
+
controls: [
|
|
124
|
+
{
|
|
125
|
+
label: {
|
|
126
|
+
en: 'Border'
|
|
127
|
+
},
|
|
128
|
+
setting: {
|
|
129
|
+
id: 'border',
|
|
130
|
+
state: 'normal'
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
label: {
|
|
135
|
+
en: 'Corner'
|
|
136
|
+
},
|
|
137
|
+
setting: {
|
|
138
|
+
id: 'rounded',
|
|
139
|
+
state: 'normal'
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
label: {
|
|
144
|
+
en: 'Shadow'
|
|
145
|
+
},
|
|
146
|
+
setting: {
|
|
147
|
+
id: 'boxShadow',
|
|
148
|
+
state: 'normal'
|
|
149
|
+
},
|
|
150
|
+
options: {
|
|
151
|
+
updateFields: [
|
|
152
|
+
{
|
|
153
|
+
field: 'enable',
|
|
154
|
+
settingId: 'advanced.hasBoxShadow',
|
|
155
|
+
state: 'normal'
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
controlChangeTrigger: {
|
|
160
|
+
settings: [
|
|
161
|
+
{
|
|
162
|
+
condition: `boxShadow.normal.enable === true`,
|
|
163
|
+
source: [
|
|
164
|
+
'boxShadow',
|
|
165
|
+
'hasBoxShadow'
|
|
166
|
+
],
|
|
167
|
+
action: {
|
|
168
|
+
controlId: 'hasBoxShadow',
|
|
169
|
+
groupType: 'advanced',
|
|
170
|
+
controlType: 'advanced',
|
|
171
|
+
state: 'normal',
|
|
172
|
+
newValue: true
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
condition: `boxShadow.normal.enable === false`,
|
|
177
|
+
source: [
|
|
178
|
+
'boxShadow',
|
|
179
|
+
'hasBoxShadow'
|
|
180
|
+
],
|
|
181
|
+
action: {
|
|
182
|
+
controlId: 'hasBoxShadow',
|
|
183
|
+
groupType: 'advanced',
|
|
184
|
+
controlType: 'advanced',
|
|
185
|
+
state: 'normal',
|
|
186
|
+
newValue: false
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
],
|
|
190
|
+
options: {
|
|
191
|
+
noRecordHistory: true
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
];
|
|
198
|
+
|
|
199
|
+
export { uiV2 };
|
|
@@ -3,9 +3,9 @@ import { getAttr, getAttrLink } from './common/getAttr.js';
|
|
|
3
3
|
import { getStyle } from './common/getStyle.js';
|
|
4
4
|
import { getClasses, getLinkClasses } from './common/getClasses.js';
|
|
5
5
|
import { createStateOrContext, createAttr, createStyle, createClass, If } from '@gem-sdk/system';
|
|
6
|
-
import { cleanUnusedData, getResponsiveSetting } from './common/common.js';
|
|
7
6
|
import { template, dataStringify, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
8
7
|
import { getInsertLinkData, getSettingPreloadData } from '../../helpers.js';
|
|
8
|
+
import { getResponsiveSetting } from './common/common.js';
|
|
9
9
|
|
|
10
10
|
const HeroBanner = (props)=>{
|
|
11
11
|
const { builderAttrs, builderProps, setting, styles, style, children, advanced, enableLazyloadImage = true } = props;
|
|
@@ -13,7 +13,7 @@ const HeroBanner = (props)=>{
|
|
|
13
13
|
const { cssClass } = advanced ?? {};
|
|
14
14
|
const { urlData } = getInsertLinkData('', link);
|
|
15
15
|
const stateDataHeroBanner = createStateOrContext({
|
|
16
|
-
background:
|
|
16
|
+
background: getResponsiveSetting(styles?.background || {}),
|
|
17
17
|
uid: builderProps?.uid,
|
|
18
18
|
enableParallax: Number(setting?.speedParallax || 0) > 0,
|
|
19
19
|
speedParallax: Number(setting?.speedParallax) || 0,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import Row from '../../grid/row/Row.js';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { useEditorMode, filterToolbarPreview, getAspectRatioGlobalSize } from '@gem-sdk/core';
|
|
5
|
+
import { useEditorMode, getGradientBgrStyleByDevice, filterToolbarPreview, getAspectRatioGlobalSize } from '@gem-sdk/core';
|
|
6
6
|
import { createStyle, createClass } from '@gem-sdk/system';
|
|
7
7
|
import AdaptiveImage from '../../image/components/AdaptiveImage.js';
|
|
8
8
|
import HTML5Embed from '../../video/components/HTML5Embed.js';
|
|
@@ -52,6 +52,11 @@ const HeroBannerItem = (props)=>{
|
|
|
52
52
|
});
|
|
53
53
|
const backgroundStyle = createStyle({
|
|
54
54
|
...getBackgroundStyle(styles, Number(speedParallax || 0) > 0 || false, transform),
|
|
55
|
+
...getGradientBgrStyleByDevice(background, {
|
|
56
|
+
desktop: true,
|
|
57
|
+
tablet: true,
|
|
58
|
+
mobile: true
|
|
59
|
+
}),
|
|
55
60
|
...getBackgroundImageHeroBanner(background, enableLazyImage, isNotLiquid)
|
|
56
61
|
});
|
|
57
62
|
const containBackgroundClasses = createClass({
|
|
@@ -76,23 +81,26 @@ const HeroBannerItem = (props)=>{
|
|
|
76
81
|
...getIframeYoutubeClasses()
|
|
77
82
|
});
|
|
78
83
|
const embed = useMemo(()=>{
|
|
79
|
-
if (showVideoType(background))
|
|
84
|
+
if (!showVideoType(background)) return;
|
|
85
|
+
if (dataVideo?.videoType === 'html5' && !dataVideo.videoHtml5) return null;
|
|
86
|
+
if (dataVideo?.videoType === 'youtube' && !dataVideo.video) return null;
|
|
87
|
+
if (dataVideo?.videoType === 'html5' && dataVideo?.videoHtml5) {
|
|
80
88
|
return /*#__PURE__*/ jsx(HTML5Embed, {
|
|
81
89
|
muted: true,
|
|
82
|
-
loop: dataVideo?.
|
|
90
|
+
loop: dataVideo?.loop,
|
|
83
91
|
controls: false,
|
|
84
92
|
autoplay: true,
|
|
85
|
-
src: dataVideo?.
|
|
93
|
+
src: dataVideo?.videoHtml5 || '',
|
|
86
94
|
title: "Video",
|
|
87
95
|
style: html5VideoStyle,
|
|
88
96
|
className: html5VideoClasses
|
|
89
97
|
});
|
|
90
98
|
}
|
|
91
|
-
const youtubeUrl = dataVideo?.
|
|
99
|
+
const youtubeUrl = dataVideo?.video ?? '';
|
|
92
100
|
const videoId = getYoutubeVideoId(youtubeUrl);
|
|
93
|
-
const isLoop = dataVideo?.
|
|
101
|
+
const isLoop = dataVideo?.loop ? 1 : 0;
|
|
94
102
|
const params = `&loop=${isLoop}&playlist=${videoId}&showinfo=0&rel=0&fs=0&enablejsapi=1`;
|
|
95
|
-
if (dataVideo?.
|
|
103
|
+
if (dataVideo?.videoType === 'youtube' && videoId && youtubeVideoRegex.test(youtubeUrl)) {
|
|
96
104
|
return /*#__PURE__*/ jsx(LiteYouTubeEmbed, {
|
|
97
105
|
id: videoId,
|
|
98
106
|
isHeroBanner: true,
|
|
@@ -103,7 +111,7 @@ const HeroBannerItem = (props)=>{
|
|
|
103
111
|
adNetwork: false,
|
|
104
112
|
noCookie: true,
|
|
105
113
|
muted: true,
|
|
106
|
-
lazy: dataVideo?.
|
|
114
|
+
lazy: dataVideo?.lazyLoad ?? true,
|
|
107
115
|
style: youtubeIframeStyle,
|
|
108
116
|
wrapperClass: wrapperYoutubeClasses,
|
|
109
117
|
iframeClass: iframeYoutubeClasses
|
|
@@ -5,11 +5,12 @@ import AdaptiveImage from '../../image/components/AdaptiveImage.liquid.js';
|
|
|
5
5
|
import HTML5Embed from '../../video/components/HTML5Embed.liquid.js';
|
|
6
6
|
import { getContainerStyle, getOverlayStyle, getRowStyle, getAdaptiveStyle, getBackgroundStyle, getContainBackgroundStyle, getYoutubeIframeStyle, getHtml5VideoStyle } from './common/getStyle.js';
|
|
7
7
|
import { getContainerClasses, getOverlayClasses, getRowClasses, getAdaptivePictureClasses, getAdaptiveClasses, getBackgroundClasses, getContainBackgroundClasses, getHtml5VideoClasses, getWrapperYoutubeClasses, getIframeYoutubeClasses, getLazyBackgroundClasses } from './common/getClasses.js';
|
|
8
|
-
import { getAspectRatioSettings, getBackgroundImageHeroBanner, horizontalAlign, getWidth, getBgImage, getEnableBgImageByDevice, showVideoType,
|
|
8
|
+
import { getAspectRatioSettings, getBackgroundImageHeroBanner, horizontalAlign, getWidth, getBgImage, getEnableBgImageByDevice, showVideoType, getResponsiveSetting } from './common/common.js';
|
|
9
9
|
import { DEVICES, getImageSrc } from '../../image/helpers/getSrcSet.js';
|
|
10
10
|
import NextImage from '../../image/components/NextImage.liquid.js';
|
|
11
11
|
import LiteYouTubeEmbed from '../../video/components/LiteYouTubeEmbed.liquid.js';
|
|
12
12
|
import { getYoutubeVideoId, youtubeVideoRegex } from '../../video/helpers/common.js';
|
|
13
|
+
import { isRenderHtmlVideo } from '../../grid/row/commons/common.js';
|
|
13
14
|
|
|
14
15
|
const HeroBannerItem = (props)=>{
|
|
15
16
|
const { enableLazyloadImage, setting, styles, children, builderProps, rawChildren } = props;
|
|
@@ -19,12 +20,12 @@ const HeroBannerItem = (props)=>{
|
|
|
19
20
|
const enableLazyImage = setting?.preload || !enableLazyloadImage;
|
|
20
21
|
const isNotLiquid = false;
|
|
21
22
|
const aspectRatio = getAspectRatioSettings(setting?.ratioOptions, setting?.aspectRatio);
|
|
22
|
-
const dataVideo =
|
|
23
|
+
const dataVideo = getResponsiveSetting(background || {}).desktop;
|
|
23
24
|
const containerStyle = createStyle({
|
|
24
25
|
...getContainerStyle(styles, setting)
|
|
25
26
|
});
|
|
26
27
|
const containerClasses = createClass({
|
|
27
|
-
...getContainerClasses(setting)
|
|
28
|
+
...getContainerClasses(setting, styles)
|
|
28
29
|
});
|
|
29
30
|
const overlayStyle = createStyle({
|
|
30
31
|
...getOverlayStyle(styles)
|
|
@@ -91,24 +92,25 @@ const HeroBannerItem = (props)=>{
|
|
|
91
92
|
}).join('');
|
|
92
93
|
};
|
|
93
94
|
const embed = ()=>{
|
|
94
|
-
if (showVideoType(background))
|
|
95
|
+
if (!showVideoType(background)) return;
|
|
96
|
+
if (isRenderHtmlVideo(background)) {
|
|
95
97
|
return HTML5Embed({
|
|
96
98
|
uid: builderProps?.uid,
|
|
97
99
|
muted: true,
|
|
98
|
-
loop: dataVideo?.
|
|
100
|
+
loop: dataVideo?.loop,
|
|
99
101
|
controls: false,
|
|
100
102
|
autoplay: true,
|
|
101
|
-
src: dataVideo?.
|
|
103
|
+
src: dataVideo?.videoHtml5 || '',
|
|
102
104
|
title: 'Video',
|
|
103
105
|
style: html5VideoStyle,
|
|
104
106
|
className: html5VideoClasses
|
|
105
107
|
});
|
|
106
108
|
}
|
|
107
|
-
const youtubeUrl = dataVideo?.
|
|
109
|
+
const youtubeUrl = dataVideo?.video ?? '';
|
|
108
110
|
const videoId = getYoutubeVideoId(youtubeUrl);
|
|
109
111
|
const isLoop = false;
|
|
110
112
|
const params = `&loop=${isLoop}&playlist=${videoId}&showinfo=0&rel=0&fs=0&enablejsapi=1`;
|
|
111
|
-
if (dataVideo?.
|
|
113
|
+
if (dataVideo?.videoType === 'youtube' && videoId && youtubeVideoRegex.test(youtubeUrl)) {
|
|
112
114
|
return LiteYouTubeEmbed({
|
|
113
115
|
uid: builderProps?.uid,
|
|
114
116
|
id: videoId,
|
|
@@ -120,7 +122,7 @@ const HeroBannerItem = (props)=>{
|
|
|
120
122
|
adNetwork: false,
|
|
121
123
|
noCookie: true,
|
|
122
124
|
muted: true,
|
|
123
|
-
lazy: dataVideo?.
|
|
125
|
+
lazy: dataVideo?.lazyLoad ?? true,
|
|
124
126
|
preload: true,
|
|
125
127
|
style: youtubeIframeStyle,
|
|
126
128
|
wrapperClass: wrapperYoutubeClasses,
|
|
@@ -141,7 +143,7 @@ const HeroBannerItem = (props)=>{
|
|
|
141
143
|
${backgroundImageLazyload()}
|
|
142
144
|
${embed()}
|
|
143
145
|
</div>
|
|
144
|
-
${If(!!overlayColor, template`<div aria-label="Overlay" role="banner" class="${overlayClasses}" style="${overlayStyle}"
|
|
146
|
+
${If(!!overlayColor, template`<div aria-label="Overlay" role="banner" class="${overlayClasses}" style="${overlayStyle}"> </div>`)}
|
|
145
147
|
</div>
|
|
146
148
|
${Row({
|
|
147
149
|
className: rowClasses,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getResponsiveValueByScreen, getAspectRatioGlobalSize, makeStyleResponsive, cls } from '@gem-sdk/core';
|
|
1
|
+
import { getResponsiveValueByScreen, getAspectRatioGlobalSize, makeStyleResponsive, getValueByDevice, cls } from '@gem-sdk/core';
|
|
2
2
|
import { getImageSrc } from '../../../image/helpers/getSrcSet.js';
|
|
3
3
|
|
|
4
4
|
const imagePlaceholder = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
|
@@ -60,9 +60,9 @@ const getBgImage = (background)=>{
|
|
|
60
60
|
const getBackgroundImageHeroBanner = (background, enableLazyImage = false, isNotLiquid = false)=>{
|
|
61
61
|
const srcSet = getBgImage(background);
|
|
62
62
|
return makeStyleResponsive('bgi', {
|
|
63
|
-
desktop: `url('${
|
|
64
|
-
tablet: `url('${
|
|
65
|
-
mobile: `url('${
|
|
63
|
+
desktop: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'desktop'), 'desktop', isNotLiquid) : imagePlaceholder}')`,
|
|
64
|
+
tablet: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'tablet'), 'tablet', isNotLiquid) : imagePlaceholder}')`,
|
|
65
|
+
mobile: `url('${!enableLazyImage ? getImageSrc(getResponsiveValueByScreen(srcSet, 'mobile'), 'mobile', isNotLiquid) : imagePlaceholder}')`
|
|
66
66
|
});
|
|
67
67
|
};
|
|
68
68
|
const getAttachmentDevice = (background)=>{
|
|
@@ -211,26 +211,6 @@ const getDisplayStyleByFitContent = (globalSize, background)=>{
|
|
|
211
211
|
});
|
|
212
212
|
return makeStyleResponsive('d', result);
|
|
213
213
|
};
|
|
214
|
-
const cleanUnusedData = (background)=>{
|
|
215
|
-
for(const device in background){
|
|
216
|
-
const data = background?.[device];
|
|
217
|
-
if (!data) return;
|
|
218
|
-
if (data.type !== 'video') {
|
|
219
|
-
delete data.video;
|
|
220
|
-
delete data.videoType;
|
|
221
|
-
delete data.videoHtml5;
|
|
222
|
-
delete data.loop;
|
|
223
|
-
} else if (data.videoType === 'youtube') {
|
|
224
|
-
delete data.videoHtml5;
|
|
225
|
-
} else if (data.videoType === 'html5') {
|
|
226
|
-
delete data.video;
|
|
227
|
-
}
|
|
228
|
-
if (data.type !== 'image') {
|
|
229
|
-
delete data.image;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return background;
|
|
233
|
-
};
|
|
234
214
|
const getWidth = (width)=>{
|
|
235
215
|
let result = {};
|
|
236
216
|
const DEVICES = [
|
|
@@ -455,11 +435,16 @@ const getResponsiveSetting = (setting)=>{
|
|
|
455
435
|
};
|
|
456
436
|
};
|
|
457
437
|
const showVideoType = (background)=>{
|
|
458
|
-
const
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
438
|
+
const DEVICES = [
|
|
439
|
+
'desktop',
|
|
440
|
+
'tablet',
|
|
441
|
+
'mobile'
|
|
442
|
+
];
|
|
443
|
+
return DEVICES.some((item)=>{
|
|
444
|
+
const bg = getValueByDevice(background, item);
|
|
445
|
+
if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
|
|
446
|
+
return false;
|
|
447
|
+
});
|
|
463
448
|
};
|
|
464
449
|
function debounce(func, wait) {
|
|
465
450
|
let timeout;
|
|
@@ -469,4 +454,4 @@ function debounce(func, wait) {
|
|
|
469
454
|
};
|
|
470
455
|
}
|
|
471
456
|
|
|
472
|
-
export { bgiEnableByDevice,
|
|
457
|
+
export { bgiEnableByDevice, debounce, getAspectRatioSettings, getAttachmentDevice, getBackgroundImageHeroBanner, getBgImage, getClassAlignBanner, getClassContentPosition, getClassForContentByFitContent, getClassForStretchContent, getClassSpaceBetween, getClipPath, getContentPosition, getDataVideoHeroBannerResponsive, getDisplayStyleByFitContent, getEnableBgImageByDevice, getPercentageVisible, getResponsiveSetting, getStyleAspectRatioHeroBannerCustom, getStyleHeroBannerBg, getVisibilityStyle, getWidth, horizontalAlign, imagePlaceholder, isScaleImage, mapContentPositionToHorizontal, scrollToContentBanner, showVideoType };
|
|
@@ -33,7 +33,8 @@ const getContainerClasses = (setting, styles)=>{
|
|
|
33
33
|
};
|
|
34
34
|
const getOverlayClasses = (styles)=>{
|
|
35
35
|
const { overlayColor } = styles ?? {};
|
|
36
|
-
let classList = 'gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-z-1 gp-transition-all gp-duration-300
|
|
36
|
+
let classList = 'gp-absolute gp-inset-0 gp-left-[var(--left)] gp-top-[var(--top)] gp-z-1 gp-transition-all gp-duration-300 ';
|
|
37
|
+
if (overlayColor?.hover) classList += ` group-hover/hero:gp-bg-[color:var(--hvr-bgc,_var(--bgc))] group-hover/hero:gp-opacity-[var(--hvr-op,_var(--op))]`;
|
|
37
38
|
if (getGlobalColorStateClass('bg', overlayColor)) classList += ` ${getGlobalColorStateClass('bg', overlayColor)}`;
|
|
38
39
|
return composeClasses(classList);
|
|
39
40
|
};
|
|
@@ -48,6 +48,8 @@ const getContainerStyle = (styles, setting)=>{
|
|
|
48
48
|
};
|
|
49
49
|
const getOverlayStyle = (styles)=>{
|
|
50
50
|
const { overlayColor, overlayOpacity } = styles ?? {};
|
|
51
|
+
console.log('111', getGlobalColorStateStyle('bgc', overlayColor));
|
|
52
|
+
console.log('22', makeStyleState('op', overlayOpacity));
|
|
51
53
|
const composeStyles = {
|
|
52
54
|
...getGlobalColorStateStyle('bgc', overlayColor),
|
|
53
55
|
...makeStyleState('op', overlayOpacity),
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
+
import { getResponsiveValueByScreen, getBgVideoByDevice } from '@gem-sdk/core';
|
|
4
4
|
import { useTranslateValue } from './useTranslateValue.js';
|
|
5
5
|
import useIntersectionObserver from './useIntersectionObserver.js';
|
|
6
|
-
import {
|
|
6
|
+
import { getResponsiveSetting } from '../common/common.js';
|
|
7
7
|
|
|
8
8
|
const useHeroBanner = (styles, setting, currentDevice)=>{
|
|
9
9
|
const { hoverEffect, hoverEffectScale, background } = styles || {};
|
|
@@ -65,14 +65,9 @@ const useHeroBanner = (styles, setting, currentDevice)=>{
|
|
|
65
65
|
elementRef,
|
|
66
66
|
bgRef
|
|
67
67
|
]);
|
|
68
|
-
const dataVideo =
|
|
69
|
-
return getDataVideoHeroBannerResponsive(currentDevice, background);
|
|
70
|
-
}, [
|
|
71
|
-
background,
|
|
72
|
-
currentDevice
|
|
73
|
-
]);
|
|
68
|
+
const dataVideo = getBgVideoByDevice(background, currentDevice);
|
|
74
69
|
const isShowVideoHtml5 = useMemo(()=>{
|
|
75
|
-
return Boolean(dataVideo?.
|
|
70
|
+
return Boolean(dataVideo?.videoHtml5 && dataVideo.videoType === 'html5');
|
|
76
71
|
}, [
|
|
77
72
|
dataVideo
|
|
78
73
|
]);
|
|
@@ -139,6 +139,12 @@ const SettingsV2 = [
|
|
|
139
139
|
label: 'Preload',
|
|
140
140
|
default: false
|
|
141
141
|
},
|
|
142
|
+
{
|
|
143
|
+
id: 'enableLink',
|
|
144
|
+
label: '',
|
|
145
|
+
type: 'toggle',
|
|
146
|
+
default: true
|
|
147
|
+
},
|
|
142
148
|
{
|
|
143
149
|
id: 'link',
|
|
144
150
|
type: 'pick-link',
|
|
@@ -350,6 +356,12 @@ const SettingsV2 = [
|
|
|
350
356
|
default: 'auto'
|
|
351
357
|
}
|
|
352
358
|
}
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
id: 'contentBanner',
|
|
362
|
+
type: 'banner',
|
|
363
|
+
message: `The background image should be taller than the Hero Banner`,
|
|
364
|
+
closable: true
|
|
353
365
|
}
|
|
354
366
|
]
|
|
355
367
|
},
|
|
@@ -310,14 +310,26 @@ const SettingUIV2 = [
|
|
|
310
310
|
},
|
|
311
311
|
{
|
|
312
312
|
type: 'combo',
|
|
313
|
+
fixedValue: 'Enabled',
|
|
314
|
+
iconName: 'polaris-parallax-effect',
|
|
313
315
|
label: {
|
|
314
316
|
en: 'Parallax scroll'
|
|
315
317
|
},
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
318
|
+
setting: {
|
|
319
|
+
id: 'enableParallax'
|
|
320
|
+
},
|
|
321
|
+
defaultValueWhenClear: false,
|
|
319
322
|
controls: [
|
|
320
323
|
{
|
|
324
|
+
setting: {
|
|
325
|
+
id: 'contentBanner'
|
|
326
|
+
},
|
|
327
|
+
layout: 'vertical'
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
label: {
|
|
331
|
+
en: 'Speed'
|
|
332
|
+
},
|
|
321
333
|
layout: 'vertical',
|
|
322
334
|
setting: {
|
|
323
335
|
id: 'speedParallax'
|
|
@@ -328,11 +340,21 @@ const SettingUIV2 = [
|
|
|
328
340
|
]
|
|
329
341
|
},
|
|
330
342
|
{
|
|
331
|
-
label: {
|
|
332
|
-
en: 'Link'
|
|
333
|
-
},
|
|
334
343
|
controls: [
|
|
335
344
|
{
|
|
345
|
+
label: {
|
|
346
|
+
en: 'Link'
|
|
347
|
+
},
|
|
348
|
+
setting: {
|
|
349
|
+
id: 'enableLink'
|
|
350
|
+
},
|
|
351
|
+
options: {
|
|
352
|
+
labelVariant: 'primary',
|
|
353
|
+
toggleStyle: 'switch'
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
conditionDisplay: 'enableLink == true',
|
|
336
358
|
setting: {
|
|
337
359
|
id: 'link'
|
|
338
360
|
},
|
|
@@ -17,7 +17,7 @@ const CountdownSettings = [
|
|
|
17
17
|
id: 'behaviour',
|
|
18
18
|
label: 'Type',
|
|
19
19
|
type: 'select',
|
|
20
|
-
default: '
|
|
20
|
+
default: 'evergreen',
|
|
21
21
|
options: [
|
|
22
22
|
{
|
|
23
23
|
label: 'To specific date',
|
|
@@ -378,6 +378,18 @@ const CountdownSettings = [
|
|
|
378
378
|
{
|
|
379
379
|
id: 'style',
|
|
380
380
|
controls: [
|
|
381
|
+
{
|
|
382
|
+
id: 'enableLabelTextStyle',
|
|
383
|
+
label: '',
|
|
384
|
+
type: 'toggle',
|
|
385
|
+
default: true
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
id: 'enableNumberTextStyle',
|
|
389
|
+
label: '',
|
|
390
|
+
type: 'toggle',
|
|
391
|
+
default: true
|
|
392
|
+
},
|
|
381
393
|
{
|
|
382
394
|
id: 'textNumberGroup',
|
|
383
395
|
label: 'Text Number',
|
|
@@ -470,6 +482,36 @@ const CountdownSettings = [
|
|
|
470
482
|
}
|
|
471
483
|
}
|
|
472
484
|
},
|
|
485
|
+
{
|
|
486
|
+
id: 'padding',
|
|
487
|
+
type: 'padding-v2',
|
|
488
|
+
devices: {
|
|
489
|
+
desktop: {
|
|
490
|
+
default: {
|
|
491
|
+
padding: {
|
|
492
|
+
type: 'custom',
|
|
493
|
+
top: '12px',
|
|
494
|
+
left: '24px',
|
|
495
|
+
bottom: '12px',
|
|
496
|
+
right: '24px'
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
},
|
|
501
|
+
compoDefaultValue: {
|
|
502
|
+
desktop: {
|
|
503
|
+
default: {
|
|
504
|
+
padding: {
|
|
505
|
+
type: 'custom',
|
|
506
|
+
top: '12px',
|
|
507
|
+
left: '24px',
|
|
508
|
+
bottom: '12px',
|
|
509
|
+
right: '24px'
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
},
|
|
473
515
|
{
|
|
474
516
|
id: 'itemSettingGroup',
|
|
475
517
|
type: 'group',
|
|
@@ -484,7 +526,9 @@ const CountdownSettings = [
|
|
|
484
526
|
{
|
|
485
527
|
id: 'verticalGap',
|
|
486
528
|
label: 'Vertical Gap',
|
|
487
|
-
type: 'input:
|
|
529
|
+
type: 'input:slider',
|
|
530
|
+
min: 0,
|
|
531
|
+
max: 120,
|
|
488
532
|
units: [
|
|
489
533
|
'px'
|
|
490
534
|
],
|
|
@@ -494,17 +538,18 @@ const CountdownSettings = [
|
|
|
494
538
|
{
|
|
495
539
|
id: 'horizontalGap',
|
|
496
540
|
label: 'Horizontal Gap',
|
|
497
|
-
type: 'input:
|
|
541
|
+
type: 'input:slider',
|
|
542
|
+
min: 0,
|
|
543
|
+
max: 120,
|
|
498
544
|
units: [
|
|
499
545
|
'px'
|
|
500
546
|
],
|
|
501
|
-
default: '8px'
|
|
502
|
-
placeholder: 'Auto'
|
|
547
|
+
default: '8px'
|
|
503
548
|
},
|
|
504
549
|
{
|
|
505
550
|
id: 'itemPadding',
|
|
506
551
|
label: 'Padding',
|
|
507
|
-
type: '
|
|
552
|
+
type: 'padding-v2',
|
|
508
553
|
default: {
|
|
509
554
|
type: 'medium'
|
|
510
555
|
},
|