@gem-sdk/components 2.0.0-staging.146 → 2.0.0-staging.148
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/button/components/Button.liquid.js +12 -4
- package/dist/cjs/product/components/FileUpload/components/common/index.js +10 -0
- package/dist/cjs/product/components/FileUpload.js +2 -1
- package/dist/cjs/product/components/FileUpload.liquid.js +2 -1
- package/dist/cjs/product/setting/FileUpload.js +22 -7
- package/dist/esm/button/components/Button.liquid.js +14 -6
- package/dist/esm/product/components/FileUpload/components/common/index.js +8 -0
- package/dist/esm/product/components/FileUpload.js +2 -1
- package/dist/esm/product/components/FileUpload.liquid.js +2 -1
- package/dist/esm/product/setting/FileUpload.js +22 -7
- package/package.json +1 -1
|
@@ -78,10 +78,16 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
78
78
|
isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
|
|
79
79
|
translate
|
|
80
80
|
});
|
|
81
|
+
const isScrollToElement = ()=>{
|
|
82
|
+
return btnLink?.link?.startsWith('#') && btnLink?.target === '_self';
|
|
83
|
+
};
|
|
84
|
+
const WrapLink = isScrollToElement() ? 'button' : Wrap;
|
|
81
85
|
return core.template`
|
|
82
|
-
<gp-button
|
|
86
|
+
<gp-button gp-data='${core.dataStringify({
|
|
87
|
+
btnLink: setting?.btnLink
|
|
88
|
+
})}" style="${{
|
|
83
89
|
...wrapStyle
|
|
84
|
-
}}
|
|
90
|
+
}}'>
|
|
85
91
|
<div
|
|
86
92
|
style="${{
|
|
87
93
|
...restStyle,
|
|
@@ -90,7 +96,8 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
90
96
|
class="${core.cls(wrapClassName, className?.includes('gp-button-atc') ? '' : advanced?.cssClass)}"
|
|
91
97
|
>
|
|
92
98
|
<style>${innerBorderCss}</style>
|
|
93
|
-
|
|
99
|
+
${core.RenderIf(isScrollToElement(), `<a class="gp-trigger-button-link gp-hidden" href=${urlData.href} target=${urlData.target} ></a>`)}
|
|
100
|
+
<${WrapLink}
|
|
94
101
|
${{
|
|
95
102
|
...urlData,
|
|
96
103
|
'data-id': builderProps?.uidInteraction ?? (dataId || builderProps?.uid),
|
|
@@ -174,8 +181,9 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
174
181
|
</span>
|
|
175
182
|
</div>
|
|
176
183
|
${nodePrice ? nodePrice : ''}
|
|
177
|
-
</${
|
|
184
|
+
</${WrapLink}>
|
|
178
185
|
</div>
|
|
186
|
+
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-button.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
179
187
|
</gp-button>
|
|
180
188
|
`;
|
|
181
189
|
};
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
|
+
var index = require('./FileUpload/components/common/index.js');
|
|
8
9
|
|
|
9
10
|
const FileUpload = ({ setting, styles, builderProps })=>{
|
|
10
11
|
const appendTypoClass = core.composeTypographyClassName(styles?.typo);
|
|
@@ -104,7 +105,7 @@ const FileUpload = ({ setting, styles, builderProps })=>{
|
|
|
104
105
|
...core.getGlobalColorStateStyle('c', styles?.textColor),
|
|
105
106
|
...core.makeStyleResponsive('ta', styles?.textAlign)
|
|
106
107
|
},
|
|
107
|
-
children: setting?.textContent
|
|
108
|
+
children: index.getTextDropContent(setting?.textContent)
|
|
108
109
|
})
|
|
109
110
|
]
|
|
110
111
|
})
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
6
|
var helpers = require('../../helpers.js');
|
|
7
|
+
var index = require('./FileUpload/components/common/index.js');
|
|
7
8
|
|
|
8
9
|
const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
|
|
9
10
|
const appendTypoClass = core.composeTypographyClassName(styles?.typo);
|
|
@@ -11,7 +12,7 @@ const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
|
|
|
11
12
|
const composeGlobalSize = core.makeGlobalSize(setting?.size);
|
|
12
13
|
const composePaddingSize = core.makeGlobalSize(setting?.paddingSize);
|
|
13
14
|
const displayText = helpers.getDynamicSourceLocales({
|
|
14
|
-
val: setting?.textContent,
|
|
15
|
+
val: index.getTextDropContent(setting?.textContent),
|
|
15
16
|
uid: builderProps?.uid,
|
|
16
17
|
settingId: 'textContent',
|
|
17
18
|
pageContext,
|
|
@@ -19,8 +19,8 @@ const config = {
|
|
|
19
19
|
controls: [
|
|
20
20
|
{
|
|
21
21
|
id: 'textContent',
|
|
22
|
-
type: '
|
|
23
|
-
default: 'Click or drop your image to upload (Max
|
|
22
|
+
type: 'textarea',
|
|
23
|
+
default: 'Click or drop your image to upload (Max {max_size})'
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
id: 'translate',
|
|
@@ -865,14 +865,29 @@ const config = {
|
|
|
865
865
|
]
|
|
866
866
|
},
|
|
867
867
|
{
|
|
868
|
-
type: '
|
|
868
|
+
type: 'group',
|
|
869
869
|
label: {
|
|
870
870
|
en: 'Text'
|
|
871
871
|
},
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
872
|
+
controls: [
|
|
873
|
+
{
|
|
874
|
+
type: 'control',
|
|
875
|
+
label: {
|
|
876
|
+
en: 'Content'
|
|
877
|
+
},
|
|
878
|
+
layout: 'horizontal',
|
|
879
|
+
setting: {
|
|
880
|
+
id: 'textContent'
|
|
881
|
+
}
|
|
882
|
+
},
|
|
883
|
+
{
|
|
884
|
+
type: 'control',
|
|
885
|
+
setting: {
|
|
886
|
+
id: 'typo'
|
|
887
|
+
},
|
|
888
|
+
layout: 'vertical'
|
|
889
|
+
}
|
|
890
|
+
]
|
|
876
891
|
},
|
|
877
892
|
{
|
|
878
893
|
type: 'group',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { splitStyle, makeStyleResponsive, makeGlobalSize, composeTypographyClassName, composeTypographyStyle, composeBorderCss, composeCornerCss, getSingleColorVariable, template, cls, getGlobalColorStateClass, getGlobalColorStateStyle, composeRadius, getStyleShadowState, composeSize, getGradientBgrStyleForButton,
|
|
2
|
-
import { getInsertLinkData, getDynamicSourceLocales } from '../../helpers.js';
|
|
1
|
+
import { splitStyle, makeStyleResponsive, makeGlobalSize, composeTypographyClassName, composeTypographyStyle, composeBorderCss, composeCornerCss, getSingleColorVariable, template, dataStringify, cls, RenderIf, getGlobalColorStateClass, getGlobalColorStateStyle, composeRadius, getStyleShadowState, composeSize, getGradientBgrStyleForButton, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
|
+
import { getInsertLinkData, getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js';
|
|
3
3
|
|
|
4
4
|
const Button = ({ className, builderProps, customAttrs, pageContext, setting = {}, styles = {}, style, wrapClassName = '', advanced, nodePrice, dataId, isForceValue = false })=>{
|
|
5
5
|
const { align, size, backgroundColor, textColor, roundedBtn, iconSpacing, globalSize } = styles;
|
|
@@ -74,10 +74,16 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
74
74
|
isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
|
|
75
75
|
translate
|
|
76
76
|
});
|
|
77
|
+
const isScrollToElement = ()=>{
|
|
78
|
+
return btnLink?.link?.startsWith('#') && btnLink?.target === '_self';
|
|
79
|
+
};
|
|
80
|
+
const WrapLink = isScrollToElement() ? 'button' : Wrap;
|
|
77
81
|
return template`
|
|
78
|
-
<gp-button
|
|
82
|
+
<gp-button gp-data='${dataStringify({
|
|
83
|
+
btnLink: setting?.btnLink
|
|
84
|
+
})}" style="${{
|
|
79
85
|
...wrapStyle
|
|
80
|
-
}}
|
|
86
|
+
}}'>
|
|
81
87
|
<div
|
|
82
88
|
style="${{
|
|
83
89
|
...restStyle,
|
|
@@ -86,7 +92,8 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
86
92
|
class="${cls(wrapClassName, className?.includes('gp-button-atc') ? '' : advanced?.cssClass)}"
|
|
87
93
|
>
|
|
88
94
|
<style>${innerBorderCss}</style>
|
|
89
|
-
|
|
95
|
+
${RenderIf(isScrollToElement(), `<a class="gp-trigger-button-link gp-hidden" href=${urlData.href} target=${urlData.target} ></a>`)}
|
|
96
|
+
<${WrapLink}
|
|
90
97
|
${{
|
|
91
98
|
...urlData,
|
|
92
99
|
'data-id': builderProps?.uidInteraction ?? (dataId || builderProps?.uid),
|
|
@@ -170,8 +177,9 @@ const Button = ({ className, builderProps, customAttrs, pageContext, setting = {
|
|
|
170
177
|
</span>
|
|
171
178
|
</div>
|
|
172
179
|
${nodePrice ? nodePrice : ''}
|
|
173
|
-
</${
|
|
180
|
+
</${WrapLink}>
|
|
174
181
|
</div>
|
|
182
|
+
${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-button.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
175
183
|
</gp-button>
|
|
176
184
|
`;
|
|
177
185
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { composeTypographyClassName, composeTypographyStyle, makeGlobalSize, makeStyleResponsive, makeStyle, makeStyleState, composeRadius, handleConvertBorderWidth, handleConvertBorderStyle, handleConvertBorderColor, getStyleShadowState, cls, getGlobalColorStateStyle } from '@gem-sdk/core';
|
|
4
|
+
import { getTextDropContent } from './FileUpload/components/common/index.js';
|
|
4
5
|
|
|
5
6
|
const FileUpload = ({ setting, styles, builderProps })=>{
|
|
6
7
|
const appendTypoClass = composeTypographyClassName(styles?.typo);
|
|
@@ -100,7 +101,7 @@ const FileUpload = ({ setting, styles, builderProps })=>{
|
|
|
100
101
|
...getGlobalColorStateStyle('c', styles?.textColor),
|
|
101
102
|
...makeStyleResponsive('ta', styles?.textAlign)
|
|
102
103
|
},
|
|
103
|
-
children: setting?.textContent
|
|
104
|
+
children: getTextDropContent(setting?.textContent)
|
|
104
105
|
})
|
|
105
106
|
]
|
|
106
107
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { composeTypographyClassName, composeTypographyStyle, makeGlobalSize, template, makeStyleResponsive, makeStyle, makeStyleState, composeRadius, handleConvertBorderWidth, handleConvertBorderStyle, handleConvertBorderColor, getStyleShadowState, cls, getGlobalColorStateStyle, RenderIf, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import { getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js';
|
|
3
|
+
import { getTextDropContent } from './FileUpload/components/common/index.js';
|
|
3
4
|
|
|
4
5
|
const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
|
|
5
6
|
const appendTypoClass = composeTypographyClassName(styles?.typo);
|
|
@@ -7,7 +8,7 @@ const FileUpload = ({ setting, styles, builderProps, pageContext })=>{
|
|
|
7
8
|
const composeGlobalSize = makeGlobalSize(setting?.size);
|
|
8
9
|
const composePaddingSize = makeGlobalSize(setting?.paddingSize);
|
|
9
10
|
const displayText = getDynamicSourceLocales({
|
|
10
|
-
val: setting?.textContent,
|
|
11
|
+
val: getTextDropContent(setting?.textContent),
|
|
11
12
|
uid: builderProps?.uid,
|
|
12
13
|
settingId: 'textContent',
|
|
13
14
|
pageContext,
|
|
@@ -15,8 +15,8 @@ const config = {
|
|
|
15
15
|
controls: [
|
|
16
16
|
{
|
|
17
17
|
id: 'textContent',
|
|
18
|
-
type: '
|
|
19
|
-
default: 'Click or drop your image to upload (Max
|
|
18
|
+
type: 'textarea',
|
|
19
|
+
default: 'Click or drop your image to upload (Max {max_size})'
|
|
20
20
|
},
|
|
21
21
|
{
|
|
22
22
|
id: 'translate',
|
|
@@ -861,14 +861,29 @@ const config = {
|
|
|
861
861
|
]
|
|
862
862
|
},
|
|
863
863
|
{
|
|
864
|
-
type: '
|
|
864
|
+
type: 'group',
|
|
865
865
|
label: {
|
|
866
866
|
en: 'Text'
|
|
867
867
|
},
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
868
|
+
controls: [
|
|
869
|
+
{
|
|
870
|
+
type: 'control',
|
|
871
|
+
label: {
|
|
872
|
+
en: 'Content'
|
|
873
|
+
},
|
|
874
|
+
layout: 'horizontal',
|
|
875
|
+
setting: {
|
|
876
|
+
id: 'textContent'
|
|
877
|
+
}
|
|
878
|
+
},
|
|
879
|
+
{
|
|
880
|
+
type: 'control',
|
|
881
|
+
setting: {
|
|
882
|
+
id: 'typo'
|
|
883
|
+
},
|
|
884
|
+
layout: 'vertical'
|
|
885
|
+
}
|
|
886
|
+
]
|
|
872
887
|
},
|
|
873
888
|
{
|
|
874
889
|
type: 'group',
|