@gem-sdk/components 2.0.0-dev.392 → 2.0.0-dev.393
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/product/setting/product-badge/configs/settings.js +6 -0
- package/dist/cjs/product/setting/product-badge/configs/uiV2.js +14 -19
- package/dist/cjs/product/setting/product-vendor/configs/settings.js +12 -0
- package/dist/cjs/product/setting/product-vendor/configs/uiV2.js +1 -1
- package/dist/cjs/sticky/components/Sticky.js +4 -4
- package/dist/cjs/sticky/components/hooks/useSticky.js +19 -9
- package/dist/esm/product/setting/product-badge/configs/settings.js +6 -0
- package/dist/esm/product/setting/product-badge/configs/uiV2.js +14 -19
- package/dist/esm/product/setting/product-vendor/configs/settings.js +12 -0
- package/dist/esm/product/setting/product-vendor/configs/uiV2.js +1 -1
- package/dist/esm/sticky/components/Sticky.js +4 -4
- package/dist/esm/sticky/components/hooks/useSticky.js +20 -10
- package/dist/types/index.d.ts +1 -0
- package/package.json +2 -2
|
@@ -129,6 +129,12 @@ const ProductBadgeSettings = [
|
|
|
129
129
|
}
|
|
130
130
|
]
|
|
131
131
|
},
|
|
132
|
+
{
|
|
133
|
+
id: 'contentBanner',
|
|
134
|
+
type: 'banner',
|
|
135
|
+
message: `{inventory_quantity} Only work with product enable “Track inventory”`,
|
|
136
|
+
closable: true
|
|
137
|
+
},
|
|
132
138
|
{
|
|
133
139
|
id: 'contentType',
|
|
134
140
|
label: 'Shape',
|
|
@@ -95,6 +95,16 @@ const SettingUIV2 = [
|
|
|
95
95
|
setting: {
|
|
96
96
|
id: 'displayContent'
|
|
97
97
|
}
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
label: {
|
|
101
|
+
en: ''
|
|
102
|
+
},
|
|
103
|
+
layout: 'vertical',
|
|
104
|
+
setting: {
|
|
105
|
+
id: 'contentBanner'
|
|
106
|
+
},
|
|
107
|
+
conditionDisplay: 'displayContent.includes("{inventory_quantity}")'
|
|
98
108
|
}
|
|
99
109
|
]
|
|
100
110
|
},
|
|
@@ -349,26 +359,10 @@ const SettingUIV2 = [
|
|
|
349
359
|
},
|
|
350
360
|
controls: [
|
|
351
361
|
{
|
|
352
|
-
id: 'badge-position',
|
|
353
|
-
type: 'combo',
|
|
354
|
-
iconName: 'polaris-plus',
|
|
355
|
-
isHideClear: true,
|
|
356
|
-
fixedValue: 'Edit',
|
|
357
|
-
popoverLabel: {
|
|
358
|
-
en: 'Position'
|
|
359
|
-
},
|
|
360
|
-
label: {
|
|
361
|
-
en: 'Choose'
|
|
362
|
-
},
|
|
363
362
|
layout: 'vertical',
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
setting: {
|
|
368
|
-
id: 'position'
|
|
369
|
-
}
|
|
370
|
-
}
|
|
371
|
-
]
|
|
363
|
+
setting: {
|
|
364
|
+
id: 'position'
|
|
365
|
+
}
|
|
372
366
|
}
|
|
373
367
|
],
|
|
374
368
|
conditionDisplay: 'positionWithImage === "inside"'
|
|
@@ -391,6 +385,7 @@ const SettingUIV2 = [
|
|
|
391
385
|
en: 'Align'
|
|
392
386
|
},
|
|
393
387
|
conditionEnable: '!(parseInt(textSizeV2) >= 100 && textSizeV2?.includes("%"))',
|
|
388
|
+
conditionDisplay: 'positionWithImage === "outside"',
|
|
394
389
|
setting: {
|
|
395
390
|
id: 'align'
|
|
396
391
|
},
|
|
@@ -101,6 +101,18 @@ const ProductVendorSettings = [
|
|
|
101
101
|
},
|
|
102
102
|
ignoreReRender: true,
|
|
103
103
|
hiddenSetting: {
|
|
104
|
+
},
|
|
105
|
+
compoDefaultValue: {
|
|
106
|
+
custom: {
|
|
107
|
+
textShadow: {
|
|
108
|
+
angle: 145,
|
|
109
|
+
distance: '2px',
|
|
110
|
+
blur: '20px',
|
|
111
|
+
color: 'rgba(18, 18, 18, 0.2)',
|
|
112
|
+
type: 'custom',
|
|
113
|
+
enable: true
|
|
114
|
+
}
|
|
115
|
+
}
|
|
104
116
|
}
|
|
105
117
|
},
|
|
106
118
|
{
|
|
@@ -107,7 +107,7 @@ const SettingUIV2 = [
|
|
|
107
107
|
toggleStyle: 'switch'
|
|
108
108
|
},
|
|
109
109
|
help: {
|
|
110
|
-
content: `Click to open a collection page with all products from the same vendor.`
|
|
110
|
+
content: `Click to open a collection page with<br> all products from the same vendor.`
|
|
111
111
|
}
|
|
112
112
|
},
|
|
113
113
|
{
|
|
@@ -20,9 +20,9 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
|
20
20
|
...style,
|
|
21
21
|
...w,
|
|
22
22
|
...core.getStyleBackgroundByDevice(background),
|
|
23
|
-
...displayStyle
|
|
24
|
-
...positionStyle
|
|
25
|
-
...getCSSAlign
|
|
23
|
+
...displayStyle,
|
|
24
|
+
...positionStyle,
|
|
25
|
+
...getCSSAlign,
|
|
26
26
|
zIndex: _const.ELEMENT_Z_INDEX.STICKY
|
|
27
27
|
});
|
|
28
28
|
const computedMinimizeClasses = system.createClass(core.composeClasses('sticky-minimize gp-fixed gp-flex gp-h-[32px] gp-w-[76px] gp-cursor-pointer gp-items-center gp-gap-[4px] gp-border gp-border-[#D8E1FF] gp-bg-white hover:gp-bg-[#D8E1FF]'));
|
|
@@ -33,7 +33,7 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
|
33
33
|
"data-id": builderProps?.uid,
|
|
34
34
|
...builderAttrs,
|
|
35
35
|
style: {
|
|
36
|
-
...displayStyle
|
|
36
|
+
...displayStyle,
|
|
37
37
|
zIndex: _const.ELEMENT_Z_INDEX.STICKY
|
|
38
38
|
},
|
|
39
39
|
children: [
|
|
@@ -70,13 +70,17 @@ const useSticky = (setting)=>{
|
|
|
70
70
|
[`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
|
-
const getCSSAlign = ()=>{
|
|
73
|
+
const getCSSAlign = React.useMemo(()=>{
|
|
74
74
|
return {
|
|
75
75
|
...getCSSAlignByDevice(position?.desktop, ''),
|
|
76
76
|
...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
|
|
77
77
|
...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
|
|
78
78
|
};
|
|
79
|
-
}
|
|
79
|
+
}, [
|
|
80
|
+
position?.desktop,
|
|
81
|
+
position?.mobile,
|
|
82
|
+
position?.tablet
|
|
83
|
+
]);
|
|
80
84
|
const gap = React.useMemo(()=>{
|
|
81
85
|
if (sidebarMode && position?.[currentDevice] === 'top') {
|
|
82
86
|
return '40px';
|
|
@@ -87,26 +91,32 @@ const useSticky = (setting)=>{
|
|
|
87
91
|
sidebarMode,
|
|
88
92
|
position
|
|
89
93
|
]);
|
|
90
|
-
const displayStyle = React.
|
|
94
|
+
const displayStyle = React.useMemo(()=>{
|
|
91
95
|
return {
|
|
92
96
|
[`--top`]: gap ?? 'auto',
|
|
93
97
|
[`--top-tablet`]: gap ?? 'auto',
|
|
94
98
|
[`--top-mobile`]: gap ?? 'auto',
|
|
95
|
-
[`--${position?.desktop}`]: gap ??
|
|
96
|
-
[`--${position?.tablet ?? position?.desktop}-tablet`]: gap ??
|
|
97
|
-
[`--${position?.mobile ?? position?.desktop}-mobile`]: gap ??
|
|
99
|
+
[`--${position?.desktop}`]: gap ?? '0px',
|
|
100
|
+
[`--${position?.tablet ?? position?.desktop}-tablet`]: gap ?? '0px',
|
|
101
|
+
[`--${position?.mobile ?? position?.desktop}-mobile`]: gap ?? '0px'
|
|
98
102
|
};
|
|
99
103
|
}, [
|
|
100
104
|
gap,
|
|
101
|
-
position
|
|
105
|
+
position?.desktop,
|
|
106
|
+
position?.mobile,
|
|
107
|
+
position?.tablet
|
|
102
108
|
]);
|
|
103
|
-
const positionStyle = ()=>{
|
|
109
|
+
const positionStyle = React.useMemo(()=>{
|
|
104
110
|
return {
|
|
105
111
|
[`--pos`]: getCSSPosition(position?.desktop),
|
|
106
112
|
[`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
|
|
107
113
|
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
|
|
108
114
|
};
|
|
109
|
-
}
|
|
115
|
+
}, [
|
|
116
|
+
position?.desktop,
|
|
117
|
+
position?.mobile,
|
|
118
|
+
position?.tablet
|
|
119
|
+
]);
|
|
110
120
|
return {
|
|
111
121
|
w,
|
|
112
122
|
displayStyle,
|
|
@@ -127,6 +127,12 @@ const ProductBadgeSettings = [
|
|
|
127
127
|
}
|
|
128
128
|
]
|
|
129
129
|
},
|
|
130
|
+
{
|
|
131
|
+
id: 'contentBanner',
|
|
132
|
+
type: 'banner',
|
|
133
|
+
message: `{inventory_quantity} Only work with product enable “Track inventory”`,
|
|
134
|
+
closable: true
|
|
135
|
+
},
|
|
130
136
|
{
|
|
131
137
|
id: 'contentType',
|
|
132
138
|
label: 'Shape',
|
|
@@ -93,6 +93,16 @@ const SettingUIV2 = [
|
|
|
93
93
|
setting: {
|
|
94
94
|
id: 'displayContent'
|
|
95
95
|
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
label: {
|
|
99
|
+
en: ''
|
|
100
|
+
},
|
|
101
|
+
layout: 'vertical',
|
|
102
|
+
setting: {
|
|
103
|
+
id: 'contentBanner'
|
|
104
|
+
},
|
|
105
|
+
conditionDisplay: 'displayContent.includes("{inventory_quantity}")'
|
|
96
106
|
}
|
|
97
107
|
]
|
|
98
108
|
},
|
|
@@ -347,26 +357,10 @@ const SettingUIV2 = [
|
|
|
347
357
|
},
|
|
348
358
|
controls: [
|
|
349
359
|
{
|
|
350
|
-
id: 'badge-position',
|
|
351
|
-
type: 'combo',
|
|
352
|
-
iconName: 'polaris-plus',
|
|
353
|
-
isHideClear: true,
|
|
354
|
-
fixedValue: 'Edit',
|
|
355
|
-
popoverLabel: {
|
|
356
|
-
en: 'Position'
|
|
357
|
-
},
|
|
358
|
-
label: {
|
|
359
|
-
en: 'Choose'
|
|
360
|
-
},
|
|
361
360
|
layout: 'vertical',
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
setting: {
|
|
366
|
-
id: 'position'
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
]
|
|
361
|
+
setting: {
|
|
362
|
+
id: 'position'
|
|
363
|
+
}
|
|
370
364
|
}
|
|
371
365
|
],
|
|
372
366
|
conditionDisplay: 'positionWithImage === "inside"'
|
|
@@ -389,6 +383,7 @@ const SettingUIV2 = [
|
|
|
389
383
|
en: 'Align'
|
|
390
384
|
},
|
|
391
385
|
conditionEnable: '!(parseInt(textSizeV2) >= 100 && textSizeV2?.includes("%"))',
|
|
386
|
+
conditionDisplay: 'positionWithImage === "outside"',
|
|
392
387
|
setting: {
|
|
393
388
|
id: 'align'
|
|
394
389
|
},
|
|
@@ -99,6 +99,18 @@ const ProductVendorSettings = [
|
|
|
99
99
|
},
|
|
100
100
|
ignoreReRender: true,
|
|
101
101
|
hiddenSetting: {
|
|
102
|
+
},
|
|
103
|
+
compoDefaultValue: {
|
|
104
|
+
custom: {
|
|
105
|
+
textShadow: {
|
|
106
|
+
angle: 145,
|
|
107
|
+
distance: '2px',
|
|
108
|
+
blur: '20px',
|
|
109
|
+
color: 'rgba(18, 18, 18, 0.2)',
|
|
110
|
+
type: 'custom',
|
|
111
|
+
enable: true
|
|
112
|
+
}
|
|
113
|
+
}
|
|
102
114
|
}
|
|
103
115
|
},
|
|
104
116
|
{
|
|
@@ -105,7 +105,7 @@ const SettingUIV2 = [
|
|
|
105
105
|
toggleStyle: 'switch'
|
|
106
106
|
},
|
|
107
107
|
help: {
|
|
108
|
-
content: `Click to open a collection page with all products from the same vendor.`
|
|
108
|
+
content: `Click to open a collection page with<br> all products from the same vendor.`
|
|
109
109
|
}
|
|
110
110
|
},
|
|
111
111
|
{
|
|
@@ -16,9 +16,9 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
|
16
16
|
...style,
|
|
17
17
|
...w,
|
|
18
18
|
...getStyleBackgroundByDevice(background),
|
|
19
|
-
...displayStyle
|
|
20
|
-
...positionStyle
|
|
21
|
-
...getCSSAlign
|
|
19
|
+
...displayStyle,
|
|
20
|
+
...positionStyle,
|
|
21
|
+
...getCSSAlign,
|
|
22
22
|
zIndex: ELEMENT_Z_INDEX.STICKY
|
|
23
23
|
});
|
|
24
24
|
const computedMinimizeClasses = createClass(composeClasses('sticky-minimize gp-fixed gp-flex gp-h-[32px] gp-w-[76px] gp-cursor-pointer gp-items-center gp-gap-[4px] gp-border gp-border-[#D8E1FF] gp-bg-white hover:gp-bg-[#D8E1FF]'));
|
|
@@ -29,7 +29,7 @@ const Sticky = ({ children, builderAttrs, setting, style, builderProps })=>{
|
|
|
29
29
|
"data-id": builderProps?.uid,
|
|
30
30
|
...builderAttrs,
|
|
31
31
|
style: {
|
|
32
|
-
...displayStyle
|
|
32
|
+
...displayStyle,
|
|
33
33
|
zIndex: ELEMENT_Z_INDEX.STICKY
|
|
34
34
|
},
|
|
35
35
|
children: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { makeStyleResponsive, usePageStore, useCurrentDevice } from '@gem-sdk/core';
|
|
2
2
|
import { createStyleObject } from '../../../grid/row/commons/helpers.js';
|
|
3
|
-
import { useMemo
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
const minimizeSvg = ` <svg
|
|
6
6
|
className="gp-ml-[7px]"
|
|
@@ -66,13 +66,17 @@ const useSticky = (setting)=>{
|
|
|
66
66
|
[`--t${device}`]: position == 'top' ? 'unset' : 'translateX(-50%)'
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
|
-
const getCSSAlign = ()=>{
|
|
69
|
+
const getCSSAlign = useMemo(()=>{
|
|
70
70
|
return {
|
|
71
71
|
...getCSSAlignByDevice(position?.desktop, ''),
|
|
72
72
|
...getCSSAlignByDevice(position?.tablet ?? position?.desktop, '-tablet'),
|
|
73
73
|
...getCSSAlignByDevice(position?.mobile ?? position?.desktop, '-mobile')
|
|
74
74
|
};
|
|
75
|
-
}
|
|
75
|
+
}, [
|
|
76
|
+
position?.desktop,
|
|
77
|
+
position?.mobile,
|
|
78
|
+
position?.tablet
|
|
79
|
+
]);
|
|
76
80
|
const gap = useMemo(()=>{
|
|
77
81
|
if (sidebarMode && position?.[currentDevice] === 'top') {
|
|
78
82
|
return '40px';
|
|
@@ -83,26 +87,32 @@ const useSticky = (setting)=>{
|
|
|
83
87
|
sidebarMode,
|
|
84
88
|
position
|
|
85
89
|
]);
|
|
86
|
-
const displayStyle =
|
|
90
|
+
const displayStyle = useMemo(()=>{
|
|
87
91
|
return {
|
|
88
92
|
[`--top`]: gap ?? 'auto',
|
|
89
93
|
[`--top-tablet`]: gap ?? 'auto',
|
|
90
94
|
[`--top-mobile`]: gap ?? 'auto',
|
|
91
|
-
[`--${position?.desktop}`]: gap ??
|
|
92
|
-
[`--${position?.tablet ?? position?.desktop}-tablet`]: gap ??
|
|
93
|
-
[`--${position?.mobile ?? position?.desktop}-mobile`]: gap ??
|
|
95
|
+
[`--${position?.desktop}`]: gap ?? '0px',
|
|
96
|
+
[`--${position?.tablet ?? position?.desktop}-tablet`]: gap ?? '0px',
|
|
97
|
+
[`--${position?.mobile ?? position?.desktop}-mobile`]: gap ?? '0px'
|
|
94
98
|
};
|
|
95
99
|
}, [
|
|
96
100
|
gap,
|
|
97
|
-
position
|
|
101
|
+
position?.desktop,
|
|
102
|
+
position?.mobile,
|
|
103
|
+
position?.tablet
|
|
98
104
|
]);
|
|
99
|
-
const positionStyle = ()=>{
|
|
105
|
+
const positionStyle = useMemo(()=>{
|
|
100
106
|
return {
|
|
101
107
|
[`--pos`]: getCSSPosition(position?.desktop),
|
|
102
108
|
[`--pos-tablet`]: getCSSPosition(position?.tablet ?? position?.desktop),
|
|
103
109
|
[`--pos-mobile`]: getCSSPosition(position?.mobile ?? position?.desktop)
|
|
104
110
|
};
|
|
105
|
-
}
|
|
111
|
+
}, [
|
|
112
|
+
position?.desktop,
|
|
113
|
+
position?.mobile,
|
|
114
|
+
position?.tablet
|
|
115
|
+
]);
|
|
106
116
|
return {
|
|
107
117
|
w,
|
|
108
118
|
displayStyle,
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.393",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"relationship": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/get-control-relationship.js && node ./scripts/get-element-relationship.js"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
25
|
+
"@gem-sdk/core": "2.0.0-dev.393",
|
|
26
26
|
"@gem-sdk/styles": "2.0.0-dev.381",
|
|
27
27
|
"@gem-sdk/system": "2.0.0-dev.371",
|
|
28
28
|
"@types/react-transition-group": "^4.4.5"
|