@gem-sdk/components 2.0.0-dev.275 → 2.0.0-dev.278
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/ArticleReadMore.js +2 -4
- package/dist/cjs/banner/components/HeroBannerItem.liquid.js +4 -4
- package/dist/cjs/builder.js +4 -8
- package/dist/cjs/button/components/Button.js +111 -184
- package/dist/cjs/button/components/Button.liquid.js +108 -171
- package/dist/cjs/button/components/ButtonIcon.js +17 -0
- package/dist/cjs/button/components/ButtonIcon.liquid.js +16 -0
- package/dist/cjs/button/components/ButtonLabel.js +18 -0
- package/dist/cjs/button/components/ButtonLabel.liquid.js +15 -0
- package/dist/cjs/button/components/ButtonLoadingIndicator.liquid.js +12 -0
- package/dist/cjs/button/components/common/attributes.js +15 -0
- package/dist/cjs/button/components/common/classes.js +55 -0
- package/dist/cjs/button/components/common/constants.js +26 -0
- package/dist/cjs/button/components/common/data.js +76 -0
- package/dist/cjs/button/components/common/helpers.js +131 -0
- package/dist/cjs/button/components/common/styles.js +157 -0
- package/dist/cjs/button/next.js +2 -6
- package/dist/cjs/button/setting/configs/settings.js +5 -1
- package/dist/cjs/cart/components/CheckoutNow.js +0 -2
- package/dist/cjs/coupon/components/Coupon.js +1 -3
- package/dist/cjs/dialog/setting/Dialog.js +7 -580
- package/dist/cjs/dialog/setting/configs/settings.js +325 -0
- package/dist/cjs/dialog/setting/configs/uiV1.js +288 -0
- package/dist/cjs/dialog/setting/configs/uiV2.js +258 -0
- package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +3 -3
- package/dist/cjs/form/components/submit-button/SubmitButton.js +0 -4
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.liquid.js +1 -3
- package/dist/cjs/post-purchase/callout-banner/components/CalloutText.js +1 -2
- package/dist/cjs/post-purchase/callout-banner/components/common/getClasses.js +2 -5
- package/dist/cjs/post-purchase/callout-banner/components/common/getStyles.js +4 -2
- package/dist/cjs/post-purchase/callout-banner/setting/config/callout-text/setting.js +11 -1
- package/dist/cjs/post-purchase/product/hooks/product-image/useListCarousel.js +1 -1
- package/dist/cjs/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +4 -1
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +15 -2
- package/dist/cjs/post-purchase/product/settings/product-image/uiV2.js +3 -1
- package/dist/cjs/post-purchase/utils/constants.js +1 -1
- package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.js +2 -5
- package/dist/cjs/product/components/DynamicCheckout.js +2 -5
- package/dist/cjs/product/components/FileUpload/components/common/index.js +1 -1
- package/dist/cjs/product/components/ProductButton.js +2 -3
- package/dist/cjs/product/components/ProductButton.liquid.js +3 -3
- package/dist/cjs/product/components/ProductDescription/index.liquid.js +1 -2
- package/dist/cjs/product/components/ProductViewMore.js +2 -5
- package/dist/cjs/product/components/ProductViewMore.liquid.js +2 -2
- package/dist/cjs/setting.js +2 -2
- package/dist/cjs/text/components/common/getClasses.js +1 -1
- package/dist/cjs/third-party/components/PushOwl.js +0 -5
- package/dist/esm/article/components/ArticleReadMore.js +1 -3
- package/dist/esm/banner/components/HeroBannerItem.liquid.js +4 -4
- package/dist/esm/builder.js +1 -5
- package/dist/esm/button/components/Button.js +113 -186
- package/dist/esm/button/components/Button.liquid.js +109 -172
- package/dist/esm/button/components/ButtonIcon.js +13 -0
- package/dist/esm/button/components/ButtonIcon.liquid.js +12 -0
- package/dist/esm/button/components/ButtonLabel.js +14 -0
- package/dist/esm/button/components/ButtonLabel.liquid.js +11 -0
- package/dist/esm/button/components/ButtonLoadingIndicator.liquid.js +8 -0
- package/dist/esm/button/components/common/attributes.js +13 -0
- package/dist/esm/button/components/common/classes.js +49 -0
- package/dist/esm/button/components/common/constants.js +24 -0
- package/dist/esm/button/components/common/data.js +74 -0
- package/dist/esm/button/components/common/helpers.js +118 -0
- package/dist/esm/button/components/common/styles.js +148 -0
- package/dist/esm/button/next.js +2 -6
- package/dist/esm/button/setting/configs/settings.js +5 -1
- package/dist/esm/cart/components/CheckoutNow.js +0 -2
- package/dist/esm/coupon/components/Coupon.js +1 -3
- package/dist/esm/dialog/setting/Dialog.js +7 -580
- package/dist/esm/dialog/setting/configs/settings.js +323 -0
- package/dist/esm/dialog/setting/configs/uiV1.js +286 -0
- package/dist/esm/dialog/setting/configs/uiV2.js +256 -0
- package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +3 -3
- package/dist/esm/form/components/submit-button/SubmitButton.js +0 -4
- package/dist/esm/index.js +1 -2
- package/dist/esm/index.liquid.js +1 -2
- package/dist/esm/post-purchase/callout-banner/components/CalloutText.js +1 -2
- package/dist/esm/post-purchase/callout-banner/components/common/getClasses.js +2 -5
- package/dist/esm/post-purchase/callout-banner/components/common/getStyles.js +4 -2
- package/dist/esm/post-purchase/callout-banner/setting/config/callout-text/setting.js +11 -1
- package/dist/esm/post-purchase/product/hooks/product-image/useListCarousel.js +1 -1
- package/dist/esm/post-purchase/product/hooks/product-image/useProductImagePostPurchase.js +4 -1
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +15 -2
- package/dist/esm/post-purchase/product/settings/product-image/uiV2.js +3 -1
- package/dist/esm/post-purchase/utils/constants.js +1 -1
- package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.js +1 -4
- package/dist/esm/product/components/DynamicCheckout.js +1 -4
- package/dist/esm/product/components/FileUpload/components/common/index.js +1 -1
- package/dist/esm/product/components/ProductButton.js +1 -2
- package/dist/esm/product/components/ProductButton.liquid.js +1 -1
- package/dist/esm/product/components/ProductDescription/index.liquid.js +3 -4
- package/dist/esm/product/components/ProductViewMore.js +1 -4
- package/dist/esm/product/components/ProductViewMore.liquid.js +1 -1
- package/dist/esm/setting.js +2 -2
- package/dist/esm/text/components/common/getClasses.js +1 -1
- package/dist/esm/third-party/components/PushOwl.js +0 -5
- package/dist/types/index.d.ts +175 -267
- package/package.json +2 -2
- package/dist/cjs/button/components/v2/ButtonIcon.js +0 -18
- package/dist/cjs/button/components/v2/ButtonLabel.js +0 -25
- package/dist/cjs/button/components/v2/ButtonV2.js +0 -140
- package/dist/cjs/button/components/v2/ButtonV2.liquid.js +0 -181
- package/dist/cjs/button/hooks/useButtonCustomCss.js +0 -88
- package/dist/cjs/button/hooks/useButtonStyles.js +0 -93
- package/dist/esm/button/components/v2/ButtonIcon.js +0 -14
- package/dist/esm/button/components/v2/ButtonLabel.js +0 -21
- package/dist/esm/button/components/v2/ButtonV2.js +0 -136
- package/dist/esm/button/components/v2/ButtonV2.liquid.js +0 -177
- package/dist/esm/button/hooks/useButtonCustomCss.js +0 -84
- package/dist/esm/button/hooks/useButtonStyles.js +0 -91
- /package/dist/cjs/button/components/{v2/ButtonLoadingIndicator.js → ButtonLoadingIndicator.js} +0 -0
- /package/dist/esm/button/components/{v2/ButtonLoadingIndicator.js → ButtonLoadingIndicator.js} +0 -0
|
@@ -3,184 +3,121 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
-
var
|
|
6
|
+
var system = require('@gem-sdk/system');
|
|
7
|
+
var attributes = require('./common/attributes.js');
|
|
8
|
+
var styles = require('./common/styles.js');
|
|
9
|
+
var classes = require('./common/classes.js');
|
|
10
|
+
var helpers$1 = require('../../helpers.js');
|
|
11
|
+
var ButtonIcon_liquid = require('./ButtonIcon.liquid.js');
|
|
12
|
+
var ButtonLabel_liquid = require('./ButtonLabel.liquid.js');
|
|
13
|
+
var ButtonLoadingIndicator_liquid = require('./ButtonLoadingIndicator.liquid.js');
|
|
14
|
+
var data = require('./common/data.js');
|
|
15
|
+
var helpers = require('./common/helpers.js');
|
|
7
16
|
|
|
8
|
-
const Button = (
|
|
9
|
-
const {
|
|
10
|
-
const {
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
'
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
${core.composeBorderCss(styles?.borderBtn?.normal)}
|
|
41
|
-
${core.composeCornerCss(styles?.roundedBtn?.normal)}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.${builderProps?.uid}:hover::before {
|
|
45
|
-
${core.composeBorderCss(styles?.borderBtn?.hover)}
|
|
46
|
-
${core.composeCornerCss(styles?.roundedBtn?.hover)}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.${builderProps?.uid}:hover .gp-button-icon {
|
|
50
|
-
color: ${core.getSingleColorVariable(styles?.textColor?.hover)};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.${builderProps?.uid} .gp-button-icon {
|
|
54
|
-
color: ${core.getSingleColorVariable(styles?.textColor?.normal)};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.${builderProps?.uid}:hover .gp-button-price {
|
|
58
|
-
color: ${core.getSingleColorVariable(styles?.textColor?.hover)};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.${builderProps?.uid} .gp-button-price {
|
|
62
|
-
color: ${core.getSingleColorVariable(styles?.textColor?.normal)};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.${builderProps?.uid} .gp-product-dot-price {
|
|
66
|
-
color: ${core.getSingleColorVariable(styles?.textColor?.normal)};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.${builderProps?.uid}:hover .gp-product-dot-price {
|
|
70
|
-
color: ${core.getSingleColorVariable(styles?.textColor?.hover)};
|
|
71
|
-
}
|
|
72
|
-
`;
|
|
73
|
-
const labelValDisplay = isForceValue ? label : helpers.getDynamicSourceLocales({
|
|
74
|
-
val: label,
|
|
75
|
-
uid: builderProps?.uidTranslate ?? builderProps?.uid,
|
|
76
|
-
settingId: translate ?? 'label',
|
|
77
|
-
pageContext,
|
|
78
|
-
isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
|
|
79
|
-
translate
|
|
17
|
+
const Button = (props)=>{
|
|
18
|
+
const { advanced, className, nodePrice, customAttrs, styles: styles$1 = {}, setting = {}, builderProps, wrapClassName = '' } = props;
|
|
19
|
+
const { iconSvg, loading, btnLink, htmlType, disabled, shouldClearSpace } = setting;
|
|
20
|
+
const { customCss, wrapStyle, restStyle, dataState, dataIdAttr, isShowIcon, isScrollToElement, getArialLabel, getLabelToDisplay, checkIsShowLabel, checkIsEditableLabel } = data.getData(props);
|
|
21
|
+
const { HTMLTag, urlData, shouldRenderLink } = helpers.getInsertLinkData({
|
|
22
|
+
htmlType,
|
|
23
|
+
setting: btnLink,
|
|
24
|
+
defaultTag: 'button',
|
|
25
|
+
isLiquid: true
|
|
26
|
+
});
|
|
27
|
+
const ButtonWrapper = helpers.getButtonWrapper(HTMLTag, isScrollToElement);
|
|
28
|
+
const buttonStyles = system.createStyle({
|
|
29
|
+
...styles.getButtonStyles(styles$1, nodePrice)
|
|
30
|
+
});
|
|
31
|
+
const buttonIconStyles = system.createStyle({
|
|
32
|
+
...styles.getButtonIconStyles(styles$1, setting)
|
|
33
|
+
});
|
|
34
|
+
const buttonWrapperStyles = system.createStyle({
|
|
35
|
+
...styles.getButtonWrapperStyles(restStyle, styles$1)
|
|
36
|
+
});
|
|
37
|
+
const buttonClasses = system.createClass({
|
|
38
|
+
...classes.getButtonClasses({
|
|
39
|
+
styles: styles$1,
|
|
40
|
+
className,
|
|
41
|
+
shouldRenderLink,
|
|
42
|
+
uid: builderProps?.uid
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
const buttonIconClasses = system.createClass({
|
|
46
|
+
...classes.getButtonIconClasses(getLabelToDisplay({
|
|
47
|
+
isLiquid: true
|
|
48
|
+
}), shouldClearSpace)
|
|
80
49
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
...
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
50
|
+
const buttonLabelClasses = system.createClass({
|
|
51
|
+
...classes.getButtonLabelClasses(styles$1, checkIsEditableLabel({
|
|
52
|
+
isLiquid: true
|
|
53
|
+
}))
|
|
54
|
+
});
|
|
55
|
+
const buttonWrapperClasses = system.createClass({
|
|
56
|
+
...classes.getButtonWrapperClasses(wrapClassName, className, advanced?.cssClass)
|
|
57
|
+
});
|
|
58
|
+
const buttonContentWrapperClasses = system.createClass({
|
|
59
|
+
...classes.getButtonContentWrapperClasses(setting)
|
|
60
|
+
});
|
|
61
|
+
const buttonWrapperAttrs = system.createAttr({
|
|
62
|
+
...attributes.getButtonAttributes({
|
|
63
|
+
urlData,
|
|
64
|
+
disabled,
|
|
65
|
+
dataState,
|
|
66
|
+
dataId: dataIdAttr,
|
|
67
|
+
arialLabel: getArialLabel({
|
|
68
|
+
isLiquid: true
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
});
|
|
72
|
+
const buttonState = system.createStateOrContext({
|
|
73
|
+
btnLink: setting?.btnLink
|
|
74
|
+
});
|
|
75
|
+
return system.Liquid(core.template`
|
|
76
|
+
<gp-button
|
|
77
|
+
gp-data='${core.dataStringify(buttonState)}'
|
|
78
|
+
style="${{
|
|
79
|
+
wrapStyle
|
|
80
|
+
}}"
|
|
81
|
+
>
|
|
82
|
+
<div style="${buttonWrapperStyles}" class="${buttonWrapperClasses}">
|
|
83
|
+
<style>${customCss}</style>
|
|
84
|
+
${system.If(isScrollToElement, `<a
|
|
85
|
+
class="gp-trigger-button-link gp-hidden"
|
|
86
|
+
href=${urlData.href}
|
|
87
|
+
target=${urlData.target}
|
|
88
|
+
></a>`)}
|
|
89
|
+
<${ButtonWrapper}
|
|
90
|
+
${{
|
|
91
|
+
...buttonWrapperAttrs
|
|
101
92
|
}}
|
|
102
|
-
|
|
93
|
+
${{
|
|
103
94
|
...customAttrs
|
|
104
95
|
}}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
'gp-animate-bounce': styles?.animation?.normal === 'bounce',
|
|
108
|
-
'hover:gp-animate-bounce': styles?.animation?.hover === 'bounce',
|
|
109
|
-
'gp-scale-[1.1]': styles?.animation?.normal === 'grow',
|
|
110
|
-
'hover:gp-scale-[1.1]': styles?.animation?.hover === 'grow',
|
|
111
|
-
'gp-text-center': shouldRenderLink
|
|
112
|
-
}, className, className?.includes('gp-button-atc') && advanced ? advanced?.cssClass : '', !nodePrice ? appendTypoClass : {})}"
|
|
113
|
-
style="${{
|
|
114
|
-
...core.getGlobalColorStateStyle('bg', backgroundColor),
|
|
115
|
-
...core.composeRadius(roundedBtn),
|
|
116
|
-
...core.getStyleShadowState(styles?.boxShadowBtn, 'box-shadow', {
|
|
117
|
-
normal: styles?.boxShadowBtn?.normal?.type !== 'none',
|
|
118
|
-
hover: styles?.boxShadowBtn?.hover?.type !== 'none'
|
|
119
|
-
}),
|
|
120
|
-
...!styles?.btnSpacing?.type ? core.composeSize(styles?.btnSpacing?.custom) : {},
|
|
121
|
-
...composeGlobalSize.width,
|
|
122
|
-
...composeGlobalSize.height,
|
|
123
|
-
...composeGlobalSize.padding,
|
|
124
|
-
...core.getGradientBgrStyleForButton(backgroundColor),
|
|
125
|
-
...core.getGlobalColorStateStyle('c', textColor),
|
|
126
|
-
'--size': appendTypoStyle['--size'],
|
|
127
|
-
'--size-tablet': appendTypoStyle['--size-tablet'],
|
|
128
|
-
'--size-mobile': appendTypoStyle['--size-mobile'],
|
|
129
|
-
...!nodePrice ? appendTypoStyle : {}
|
|
130
|
-
}}"
|
|
131
|
-
>
|
|
132
|
-
${!disabledLoading ? ` <svg
|
|
133
|
-
class="gp-invisible gp-absolute gp-h-5 gp-w-5 group-data-[state=loading]:gp-animate-spin group-data-[state=loading]:gp-visible"
|
|
134
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
135
|
-
fill="none"
|
|
136
|
-
viewBox="0 0 24 24"
|
|
96
|
+
style="${buttonStyles}"
|
|
97
|
+
class="${buttonClasses}"
|
|
137
98
|
>
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
${core.RenderIf(!!iconSvg && iconVisible, core.template`<span
|
|
157
|
-
class="${`gp-inline-flex gp-button-icon gp-transition-colors gp-duration-300 gp-shrink-0 gp-items-center gp-justify-center group-data-[state=loading]:gp-invisible gp-z-1 [&>svg]:!gp-h-[var(--height-desktop)] [&>svg]:!gp-w-auto tablet:[&>svg]:!gp-h-[var(--height-tablet)] mobile:[&>svg]:!gp-h-[var(--height-mobile)]`}"
|
|
158
|
-
style="${{
|
|
159
|
-
...label ? iconSpacingStyle : {},
|
|
160
|
-
'--height-desktop': `${size?.desktop}`,
|
|
161
|
-
'--height-tablet': `${size?.desktop ?? size?.tablet}`,
|
|
162
|
-
'--height-mobile': `${size?.mobile ?? size?.tablet ?? size?.desktop}`
|
|
163
|
-
}}"
|
|
164
|
-
>${iconSvg}</span>`)}
|
|
165
|
-
<span
|
|
166
|
-
data-gp-text
|
|
167
|
-
class="${`gp-content-product-button gp-button-text-only gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${nodePrice ? appendTypoClass : ''}
|
|
168
|
-
${styles?.typo?.attrs?.italic ? '[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]' : ''}`}"
|
|
169
|
-
style="${{
|
|
170
|
-
...nodePrice && appendTypoStyle,
|
|
171
|
-
'--size': appendTypoStyle['--size'],
|
|
172
|
-
'--size-tablet': appendTypoStyle['--size-tablet'],
|
|
173
|
-
'--size-mobile': appendTypoStyle['--size-mobile']
|
|
174
|
-
}}"
|
|
175
|
-
>
|
|
176
|
-
${labelValDisplay}
|
|
177
|
-
</span>
|
|
99
|
+
${system.If(loading, ButtonLoadingIndicator_liquid.default, '')}
|
|
100
|
+
<div class="${buttonContentWrapperClasses}">
|
|
101
|
+
${system.If(isShowIcon, ButtonIcon_liquid.default({
|
|
102
|
+
iconSvg: iconSvg ?? '',
|
|
103
|
+
styles: buttonIconStyles,
|
|
104
|
+
classes: buttonIconClasses
|
|
105
|
+
}))}
|
|
106
|
+
${system.If(checkIsShowLabel({
|
|
107
|
+
isLiquid: true
|
|
108
|
+
}), ButtonLabel_liquid.default({
|
|
109
|
+
label: getLabelToDisplay({
|
|
110
|
+
isLiquid: true
|
|
111
|
+
}),
|
|
112
|
+
classes: buttonLabelClasses
|
|
113
|
+
}))}
|
|
114
|
+
</div>
|
|
115
|
+
${system.If(!!nodePrice, nodePrice?.toString() ?? '', '')}
|
|
116
|
+
</${ButtonWrapper}>
|
|
178
117
|
</div>
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
</gp-button>
|
|
183
|
-
`;
|
|
118
|
+
${system.If(core.isLocalEnv, `<script ${helpers$1.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-button.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers$1.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-button.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
119
|
+
</gp-button>
|
|
120
|
+
`);
|
|
184
121
|
};
|
|
185
122
|
|
|
186
123
|
exports.default = Button;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
|
|
7
|
+
const ButtonIcon = ({ iconSvg, classes, styles })=>{
|
|
8
|
+
return /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
9
|
+
className: classes,
|
|
10
|
+
style: styles,
|
|
11
|
+
dangerouslySetInnerHTML: {
|
|
12
|
+
__html: iconSvg
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.default = ButtonIcon;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const ButtonIcon = ({ iconSvg, classes, styles })=>{
|
|
6
|
+
return `
|
|
7
|
+
<span
|
|
8
|
+
style="${styles}"
|
|
9
|
+
class="${classes}"
|
|
10
|
+
>
|
|
11
|
+
${iconSvg}
|
|
12
|
+
</span>
|
|
13
|
+
`;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.default = ButtonIcon;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
require('react');
|
|
7
|
+
|
|
8
|
+
const ButtonLabel = ({ label, classes })=>{
|
|
9
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
10
|
+
"data-gp-text": true,
|
|
11
|
+
className: classes,
|
|
12
|
+
dangerouslySetInnerHTML: {
|
|
13
|
+
__html: label
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
exports.default = ButtonLabel;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const ButtonLabel = ({ label, classes })=>{
|
|
6
|
+
return `
|
|
7
|
+
<span
|
|
8
|
+
data-gp-text
|
|
9
|
+
class="${classes}"
|
|
10
|
+
>
|
|
11
|
+
${label}
|
|
12
|
+
</span>`;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.default = ButtonLabel;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var core = require('@gem-sdk/core');
|
|
6
|
+
var constants = require('./common/constants.js');
|
|
7
|
+
|
|
8
|
+
const ButtonLoadingIndicator = ()=>{
|
|
9
|
+
return core.template`${constants.LOADING_INDICATOR}`;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.default = ButtonLoadingIndicator;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const getButtonAttributes = ({ dataId, disabled, urlData, dataState, arialLabel })=>{
|
|
4
|
+
return {
|
|
5
|
+
...urlData,
|
|
6
|
+
...disabled !== undefined && {
|
|
7
|
+
disabled: disabled
|
|
8
|
+
},
|
|
9
|
+
'data-id': dataId,
|
|
10
|
+
'data-state': dataState,
|
|
11
|
+
'aria-label': arialLabel
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.getButtonAttributes = getButtonAttributes;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
|
|
5
|
+
const getButtonClasses = ({ uid, styles, className, shouldRenderLink })=>{
|
|
6
|
+
return {
|
|
7
|
+
...className && {
|
|
8
|
+
[className]: true
|
|
9
|
+
},
|
|
10
|
+
...uid && {
|
|
11
|
+
[uid]: true
|
|
12
|
+
},
|
|
13
|
+
'gp-text-center': shouldRenderLink,
|
|
14
|
+
'gp-max-w-full': styles?.textOverFlow || false,
|
|
15
|
+
'gp-scale-[1.1]': styles?.animation?.normal === 'grow',
|
|
16
|
+
'gp-animate-bounce': styles?.animation?.normal === 'bounce',
|
|
17
|
+
'hover:gp-scale-[1.1]': styles?.animation?.hover === 'grow',
|
|
18
|
+
'hover:gp-animate-bounce': styles?.animation?.hover === 'bounce',
|
|
19
|
+
'gp-button-base gp-group gp-relative gp-inline-flex gp-max-w-full gp-items-center gp-justify-center gp-no-underline gp-transition-colors gp-duration-300 disabled:gp-btn-disabled disabled:gp-opacity-30': true,
|
|
20
|
+
[core.getGlobalColorStateClass('text', styles?.textColor)]: true
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
const getButtonWrapperClasses = (wrapClassName, className, advancedCssClass)=>{
|
|
24
|
+
return {
|
|
25
|
+
[wrapClassName]: true,
|
|
26
|
+
...className?.includes('gp-button-atc') && advancedCssClass && {
|
|
27
|
+
[advancedCssClass]: true
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
const getButtonContentWrapperClasses = (setting)=>{
|
|
32
|
+
return {
|
|
33
|
+
'gp-inline-flex': true,
|
|
34
|
+
'gp-flex-row-reverse': setting?.iconAlign === 'right'
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const getButtonLabelClasses = (styles, isEditable)=>{
|
|
38
|
+
return {
|
|
39
|
+
'gp-relative gp-flex gp-h-full gp-items-center gp-overflow-hidden gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line': true,
|
|
40
|
+
'[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]': styles?.typo?.attrs?.italic,
|
|
41
|
+
'gp-text button-text': isEditable
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const getButtonIconClasses = (label, shouldClearSpace)=>{
|
|
45
|
+
return {
|
|
46
|
+
'!gp-m-0': shouldClearSpace && !label,
|
|
47
|
+
'gp-button-icon gp-transition-colors gp-duration-300 gp-z-1 gp-inline-flex gp-shrink-0 gp-items-center gp-justify-center group-data-[state=loading]:gp-invisible [&>svg]:!gp-h-[var(--height-desktop)] [&>svg]:!gp-w-auto tablet:[&>svg]:!gp-h-[var(--height-tablet)] mobile:[&>svg]:!gp-h-[var(--height-mobile)]': true
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
exports.getButtonClasses = getButtonClasses;
|
|
52
|
+
exports.getButtonContentWrapperClasses = getButtonContentWrapperClasses;
|
|
53
|
+
exports.getButtonIconClasses = getButtonIconClasses;
|
|
54
|
+
exports.getButtonLabelClasses = getButtonLabelClasses;
|
|
55
|
+
exports.getButtonWrapperClasses = getButtonWrapperClasses;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const LOADING_INDICATOR = `
|
|
4
|
+
<svg
|
|
5
|
+
class="gp-invisible gp-absolute gp-h-5 gp-w-5 group-data-[state=loading]:gp-animate-spin group-data-[state=loading]:gp-visible"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
fill="none"
|
|
8
|
+
viewBox="0 0 24 24"
|
|
9
|
+
>
|
|
10
|
+
<circle
|
|
11
|
+
class="gp-opacity-25"
|
|
12
|
+
cx="12"
|
|
13
|
+
cy="12"
|
|
14
|
+
r="10"
|
|
15
|
+
stroke="currentColor"
|
|
16
|
+
stroke-width="4"
|
|
17
|
+
></circle>
|
|
18
|
+
<path
|
|
19
|
+
class="gp-opacity-75"
|
|
20
|
+
fill="currentColor"
|
|
21
|
+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
22
|
+
></path>
|
|
23
|
+
</svg>
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
exports.LOADING_INDICATOR = LOADING_INDICATOR;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var helpers = require('./helpers.js');
|
|
4
|
+
var styles = require('./styles.js');
|
|
5
|
+
|
|
6
|
+
const getData = (props)=>{
|
|
7
|
+
const { style, dataId, pageContext, styles: styles$1 = {}, setting = {}, builderProps, isForceValue = false } = props;
|
|
8
|
+
const { label, iconSvg, btnLink, loading, options, disabled, translate, iconVisible, shouldClearSpace } = setting;
|
|
9
|
+
const [wrapStyle, restStyle] = helpers.getSplitStyles(style);
|
|
10
|
+
const cleanedStyles = helpers.getCleanedStyles(styles$1, disabled);
|
|
11
|
+
const customCss = styles.getCustomCssStyles({
|
|
12
|
+
styles: styles$1,
|
|
13
|
+
uid: builderProps?.uid
|
|
14
|
+
});
|
|
15
|
+
const dataState = helpers.getDataState(loading);
|
|
16
|
+
const dataIdAttr = helpers.getDataId(builderProps?.uidInteraction, dataId, builderProps?.uid);
|
|
17
|
+
const getArialLabel = (props)=>{
|
|
18
|
+
const { isLiquid } = props ?? {};
|
|
19
|
+
return helpers.handleGetArialLabel({
|
|
20
|
+
label,
|
|
21
|
+
isLiquid
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const getLabelToDisplay = (props)=>{
|
|
25
|
+
const { isLiquid } = props ?? {};
|
|
26
|
+
return helpers.handleGetLabelToDisplay({
|
|
27
|
+
label,
|
|
28
|
+
builderProps,
|
|
29
|
+
styles: cleanedStyles,
|
|
30
|
+
isLiquid,
|
|
31
|
+
...isLiquid && {
|
|
32
|
+
translate
|
|
33
|
+
},
|
|
34
|
+
...isLiquid && {
|
|
35
|
+
pageContext
|
|
36
|
+
},
|
|
37
|
+
...isLiquid && {
|
|
38
|
+
isForceValue
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
const checkIsShowLabel = (props)=>{
|
|
43
|
+
const { isLiquid } = props ?? {};
|
|
44
|
+
const labelToDisplay = getLabelToDisplay({
|
|
45
|
+
isLiquid
|
|
46
|
+
});
|
|
47
|
+
return helpers.handleCheckIsShowLabel(labelToDisplay, shouldClearSpace);
|
|
48
|
+
};
|
|
49
|
+
const checkIsEditableLabel = (props)=>{
|
|
50
|
+
const { isLiquid, mode } = props ?? {};
|
|
51
|
+
return helpers.handleCheckIsEditableLabel({
|
|
52
|
+
options,
|
|
53
|
+
isLiquid,
|
|
54
|
+
...!isLiquid && mode && {
|
|
55
|
+
mode
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const isShowIcon = helpers.checkIsShowIcon(iconSvg, iconVisible);
|
|
60
|
+
const isScrollToElement = helpers.checkIsScrollToElement(btnLink);
|
|
61
|
+
return {
|
|
62
|
+
customCss,
|
|
63
|
+
wrapStyle,
|
|
64
|
+
restStyle,
|
|
65
|
+
dataState,
|
|
66
|
+
dataIdAttr,
|
|
67
|
+
isShowIcon,
|
|
68
|
+
isScrollToElement,
|
|
69
|
+
getArialLabel,
|
|
70
|
+
getLabelToDisplay,
|
|
71
|
+
checkIsShowLabel,
|
|
72
|
+
checkIsEditableLabel
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
exports.getData = getData;
|