@gem-sdk/components 2.0.0-dev.447 → 2.0.0-dev.449
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/ArticleImage.liquid.js +2 -1
- package/dist/cjs/article/components/ArticleList.liquid.js +1 -1
- package/dist/cjs/article/components/ArticleTitle.liquid.js +1 -3
- package/dist/cjs/article/setting/configs/ArticleAuthor/uiV2.js +5 -0
- package/dist/cjs/article/setting/configs/ArticleCategory/uiV2.js +5 -0
- package/dist/cjs/article/setting/configs/ArticleContent/uiV2.js +5 -0
- package/dist/cjs/article/setting/configs/ArticleExcerpt/uiV2.js +5 -0
- package/dist/cjs/article/setting/configs/ArticleImage/presets.js +4 -5
- package/dist/cjs/article/setting/configs/ArticleImage/settings.js +70 -10
- package/dist/cjs/article/setting/configs/ArticleImage/uiV2.js +37 -0
- package/dist/cjs/article/setting/configs/ArticleReadMore/uiV2.js +5 -0
- package/dist/cjs/article/setting/configs/ArticleTag/uiV2.js +5 -15
- package/dist/cjs/article/setting/configs/ArticleTitle/settings.js +4 -0
- package/dist/cjs/article/setting/configs/ArticleTitle/uiV2.js +21 -16
- package/dist/cjs/product/components/ProductDiscountTag/common/getClasses.js +4 -2
- package/dist/cjs/product/components/ProductDiscountTag/common/getStyle.js +1 -2
- package/dist/cjs/product/components/ProductDiscountTag/index.liquid.js +3 -3
- package/dist/cjs/product/setting/ProductTag.js +0 -30
- package/dist/cjs/product/setting/product-price/configs/settings.js +1 -1
- package/dist/cjs/sticky/components/Sticky.js +8 -5
- package/dist/cjs/sticky/components/Sticky.liquid.js +6 -5
- package/dist/cjs/sticky/components/common/styles.js +55 -6
- package/dist/cjs/sticky/components/hooks/useSticky.js +2 -8
- package/dist/cjs/sticky/setting/configs/settingsV2.js +1 -1
- package/dist/esm/article/components/ArticleImage.liquid.js +2 -1
- package/dist/esm/article/components/ArticleList.liquid.js +1 -1
- package/dist/esm/article/components/ArticleTitle.liquid.js +1 -3
- package/dist/esm/article/setting/configs/ArticleAuthor/uiV2.js +5 -0
- package/dist/esm/article/setting/configs/ArticleCategory/uiV2.js +5 -0
- package/dist/esm/article/setting/configs/ArticleContent/uiV2.js +5 -0
- package/dist/esm/article/setting/configs/ArticleExcerpt/uiV2.js +5 -0
- package/dist/esm/article/setting/configs/ArticleImage/presets.js +4 -5
- package/dist/esm/article/setting/configs/ArticleImage/settings.js +70 -10
- package/dist/esm/article/setting/configs/ArticleImage/uiV2.js +37 -0
- package/dist/esm/article/setting/configs/ArticleReadMore/uiV2.js +5 -0
- package/dist/esm/article/setting/configs/ArticleTag/uiV2.js +5 -15
- package/dist/esm/article/setting/configs/ArticleTitle/settings.js +4 -0
- package/dist/esm/article/setting/configs/ArticleTitle/uiV2.js +21 -16
- package/dist/esm/product/components/ProductDiscountTag/common/getClasses.js +4 -2
- package/dist/esm/product/components/ProductDiscountTag/common/getStyle.js +2 -3
- package/dist/esm/product/components/ProductDiscountTag/index.liquid.js +3 -3
- package/dist/esm/product/setting/ProductTag.js +0 -30
- package/dist/esm/product/setting/product-price/configs/settings.js +1 -1
- package/dist/esm/sticky/components/Sticky.js +9 -6
- package/dist/esm/sticky/components/Sticky.liquid.js +8 -7
- package/dist/esm/sticky/components/common/styles.js +53 -8
- package/dist/esm/sticky/components/hooks/useSticky.js +2 -8
- package/dist/esm/sticky/setting/configs/settingsV2.js +1 -1
- package/dist/types/index.d.ts +4 -1
- package/package.json +1 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
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,
|
|
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
|
-
|
|
53
|
-
...
|
|
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 {
|
|
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,
|
|
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
|
-
|
|
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
|
|
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
|
|
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,
|
|
39
|
+
const { style, width, position, display } = args;
|
|
40
40
|
return {
|
|
41
41
|
margin: '0 auto',
|
|
42
|
-
...style,
|
|
43
|
-
...makeStyleResponsive('w',
|
|
44
|
-
...
|
|
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,
|
|
7
|
-
const
|
|
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)=>{
|
package/dist/types/index.d.ts
CHANGED
|
@@ -409,7 +409,10 @@ type ArticleImageProps = BaseProps<ImageProps['setting'] & {
|
|
|
409
409
|
};
|
|
410
410
|
enableLink?: boolean;
|
|
411
411
|
openNewTab?: boolean;
|
|
412
|
-
}, Pick<NonNullable<ImageProps['styles']>, 'opacity' | 'opacityColor' | 'shape' | 'objectFit' | 'align' | 'borderRadius' | 'wrapperBorder' | 'shadow'
|
|
412
|
+
}, Pick<NonNullable<ImageProps['styles']>, 'opacity' | 'opacityColor' | 'shape' | 'objectFit' | 'align' | 'borderRadius' | 'wrapperBorder' | 'shadow'> & {
|
|
413
|
+
qualityPercent?: ObjectDevices$1<number>;
|
|
414
|
+
qualityType?: ObjectDevices$1<QualityType$2>;
|
|
415
|
+
}> & {
|
|
413
416
|
className?: string;
|
|
414
417
|
style?: React.CSSProperties;
|
|
415
418
|
};
|