@gem-sdk/components 2.0.0-dev.274 → 2.0.0-dev.277

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.
Files changed (148) hide show
  1. package/dist/cjs/article/components/ArticleReadMore.js +2 -4
  2. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +5 -5
  3. package/dist/cjs/builder.js +17 -21
  4. package/dist/cjs/button/components/Button.js +111 -184
  5. package/dist/cjs/button/components/Button.liquid.js +108 -171
  6. package/dist/cjs/button/components/ButtonIcon.js +17 -0
  7. package/dist/cjs/button/components/ButtonIcon.liquid.js +16 -0
  8. package/dist/cjs/button/components/ButtonLabel.js +18 -0
  9. package/dist/cjs/button/components/ButtonLabel.liquid.js +15 -0
  10. package/dist/cjs/button/components/ButtonLoadingIndicator.liquid.js +12 -0
  11. package/dist/cjs/button/components/common/attributes.js +15 -0
  12. package/dist/cjs/button/components/common/classes.js +55 -0
  13. package/dist/cjs/button/components/common/constants.js +26 -0
  14. package/dist/cjs/button/components/common/data.js +76 -0
  15. package/dist/cjs/button/components/common/helpers.js +131 -0
  16. package/dist/cjs/button/components/common/styles.js +157 -0
  17. package/dist/cjs/button/next.js +2 -6
  18. package/dist/cjs/button/setting/configs/settings.js +5 -1
  19. package/dist/cjs/cart/components/CheckoutNow.js +0 -2
  20. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.js +70 -0
  21. package/dist/cjs/cart/components/ShopPayButton/ShopPayButton.liquid.js +71 -0
  22. package/dist/cjs/cart/components/ShopPayButton/common/classes.js +18 -0
  23. package/dist/cjs/cart/components/ShopPayButton/common/helpers.js +31 -0
  24. package/dist/cjs/cart/components/ShopPayButton/common/styles.js +12 -0
  25. package/dist/cjs/cart/components/ShopPayButton/hooks/useShopPayButton.js +70 -0
  26. package/dist/cjs/cart/next.js +1 -1
  27. package/dist/cjs/coupon/components/Coupon.js +1 -3
  28. package/dist/cjs/dialog/setting/Dialog.js +7 -580
  29. package/dist/cjs/dialog/setting/configs/settings.js +325 -0
  30. package/dist/cjs/dialog/setting/configs/uiV1.js +288 -0
  31. package/dist/cjs/dialog/setting/configs/uiV2.js +258 -0
  32. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +4 -4
  33. package/dist/cjs/form/components/submit-button/SubmitButton.js +0 -4
  34. package/dist/cjs/header/components/kind/basic/index.js +1 -1
  35. package/dist/cjs/header/components/kind/modern/index.js +1 -1
  36. package/dist/cjs/index.js +41 -43
  37. package/dist/cjs/index.liquid.js +10 -12
  38. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.js +25 -0
  39. package/dist/cjs/product/components/DynamicCheckout/DynamicCheckout.liquid.js +23 -0
  40. package/dist/cjs/product/components/DynamicCheckout/common/classes.js +32 -0
  41. package/dist/cjs/product/components/DynamicCheckout/common/styles.js +181 -0
  42. package/dist/cjs/product/components/DynamicCheckout/components/Button.liquid.js +58 -0
  43. package/dist/cjs/product/components/DynamicCheckout.js +2 -5
  44. package/dist/cjs/product/components/FileUpload/components/common/index.js +2 -2
  45. package/dist/cjs/product/components/ProductButton.js +2 -3
  46. package/dist/cjs/product/components/ProductButton.liquid.js +3 -3
  47. package/dist/cjs/product/components/ProductDescription/common/const.js +9 -0
  48. package/dist/cjs/product/components/ProductDescription/common/getClasses.js +30 -0
  49. package/dist/cjs/product/components/ProductDescription/common/getStyle.js +81 -0
  50. package/dist/cjs/product/components/ProductDescription/hooks/useGpDescription.js +90 -0
  51. package/dist/cjs/product/components/ProductDescription/index.js +115 -0
  52. package/dist/cjs/product/components/ProductDescription/index.liquid.js +85 -0
  53. package/dist/cjs/product/components/ProductViewMore.js +2 -5
  54. package/dist/cjs/product/components/ProductViewMore.liquid.js +2 -2
  55. package/dist/cjs/product/next.js +1 -1
  56. package/dist/cjs/setting.js +3 -3
  57. package/dist/cjs/text/components/common/getClasses.js +1 -1
  58. package/dist/cjs/third-party/components/PushOwl.js +0 -5
  59. package/dist/esm/article/components/ArticleReadMore.js +1 -3
  60. package/dist/esm/banner/components/HeroBannerItem.liquid.js +5 -5
  61. package/dist/esm/builder.js +4 -8
  62. package/dist/esm/button/components/Button.js +113 -186
  63. package/dist/esm/button/components/Button.liquid.js +109 -172
  64. package/dist/esm/button/components/ButtonIcon.js +13 -0
  65. package/dist/esm/button/components/ButtonIcon.liquid.js +12 -0
  66. package/dist/esm/button/components/ButtonLabel.js +14 -0
  67. package/dist/esm/button/components/ButtonLabel.liquid.js +11 -0
  68. package/dist/esm/button/components/ButtonLoadingIndicator.liquid.js +8 -0
  69. package/dist/esm/button/components/common/attributes.js +13 -0
  70. package/dist/esm/button/components/common/classes.js +49 -0
  71. package/dist/esm/button/components/common/constants.js +24 -0
  72. package/dist/esm/button/components/common/data.js +74 -0
  73. package/dist/esm/button/components/common/helpers.js +118 -0
  74. package/dist/esm/button/components/common/styles.js +148 -0
  75. package/dist/esm/button/next.js +2 -6
  76. package/dist/esm/button/setting/configs/settings.js +5 -1
  77. package/dist/esm/cart/components/CheckoutNow.js +0 -2
  78. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.js +66 -0
  79. package/dist/esm/cart/components/ShopPayButton/ShopPayButton.liquid.js +67 -0
  80. package/dist/esm/cart/components/ShopPayButton/common/classes.js +15 -0
  81. package/dist/esm/cart/components/ShopPayButton/common/helpers.js +27 -0
  82. package/dist/esm/cart/components/ShopPayButton/common/styles.js +10 -0
  83. package/dist/esm/cart/components/ShopPayButton/hooks/useShopPayButton.js +68 -0
  84. package/dist/esm/cart/next.js +1 -1
  85. package/dist/esm/coupon/components/Coupon.js +1 -3
  86. package/dist/esm/dialog/setting/Dialog.js +7 -580
  87. package/dist/esm/dialog/setting/configs/settings.js +323 -0
  88. package/dist/esm/dialog/setting/configs/uiV1.js +286 -0
  89. package/dist/esm/dialog/setting/configs/uiV2.js +256 -0
  90. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +4 -4
  91. package/dist/esm/form/components/submit-button/SubmitButton.js +0 -4
  92. package/dist/esm/header/components/kind/basic/index.js +1 -1
  93. package/dist/esm/header/components/kind/modern/index.js +1 -1
  94. package/dist/esm/index.js +4 -5
  95. package/dist/esm/index.liquid.js +4 -5
  96. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.js +21 -0
  97. package/dist/esm/product/components/DynamicCheckout/DynamicCheckout.liquid.js +19 -0
  98. package/dist/esm/product/components/DynamicCheckout/common/classes.js +30 -0
  99. package/dist/esm/product/components/DynamicCheckout/common/styles.js +179 -0
  100. package/dist/esm/product/components/DynamicCheckout/components/Button.liquid.js +54 -0
  101. package/dist/esm/product/components/DynamicCheckout.js +1 -4
  102. package/dist/esm/product/components/FileUpload/components/common/index.js +2 -2
  103. package/dist/esm/product/components/ProductButton.js +1 -2
  104. package/dist/esm/product/components/ProductButton.liquid.js +1 -1
  105. package/dist/esm/product/components/ProductDescription/common/const.js +6 -0
  106. package/dist/esm/product/components/ProductDescription/common/getClasses.js +27 -0
  107. package/dist/esm/product/components/ProductDescription/common/getStyle.js +77 -0
  108. package/dist/esm/product/components/ProductDescription/hooks/useGpDescription.js +88 -0
  109. package/dist/esm/product/components/ProductDescription/index.js +111 -0
  110. package/dist/esm/product/components/ProductDescription/index.liquid.js +81 -0
  111. package/dist/esm/product/components/ProductViewMore.js +1 -4
  112. package/dist/esm/product/components/ProductViewMore.liquid.js +1 -1
  113. package/dist/esm/product/next.js +1 -1
  114. package/dist/esm/setting.js +3 -3
  115. package/dist/esm/text/components/common/getClasses.js +1 -1
  116. package/dist/esm/third-party/components/PushOwl.js +0 -5
  117. package/dist/types/index.d.ts +200 -360
  118. package/package.json +2 -2
  119. package/dist/cjs/button/components/v2/ButtonIcon.js +0 -18
  120. package/dist/cjs/button/components/v2/ButtonLabel.js +0 -25
  121. package/dist/cjs/button/components/v2/ButtonV2.js +0 -140
  122. package/dist/cjs/button/components/v2/ButtonV2.liquid.js +0 -181
  123. package/dist/cjs/button/hooks/useButtonCustomCss.js +0 -88
  124. package/dist/cjs/button/hooks/useButtonStyles.js +0 -93
  125. package/dist/cjs/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -20
  126. package/dist/cjs/cart/components/ShopPayButton/index.js +0 -113
  127. package/dist/cjs/cart/components/ShopPayButton/index.liquid.js +0 -51
  128. package/dist/cjs/product/components/DynamicCheckout.liquid.js +0 -250
  129. package/dist/cjs/product/components/ProductDescription/const.js +0 -5
  130. package/dist/cjs/product/components/ProductDescription.js +0 -172
  131. package/dist/cjs/product/components/ProductDescription.liquid.js +0 -120
  132. package/dist/esm/button/components/v2/ButtonIcon.js +0 -14
  133. package/dist/esm/button/components/v2/ButtonLabel.js +0 -21
  134. package/dist/esm/button/components/v2/ButtonV2.js +0 -136
  135. package/dist/esm/button/components/v2/ButtonV2.liquid.js +0 -177
  136. package/dist/esm/button/hooks/useButtonCustomCss.js +0 -84
  137. package/dist/esm/button/hooks/useButtonStyles.js +0 -91
  138. package/dist/esm/cart/components/ShopPayButton/ShopPayButtonCommon.js +0 -17
  139. package/dist/esm/cart/components/ShopPayButton/index.js +0 -109
  140. package/dist/esm/cart/components/ShopPayButton/index.liquid.js +0 -47
  141. package/dist/esm/product/components/DynamicCheckout.liquid.js +0 -246
  142. package/dist/esm/product/components/ProductDescription/const.js +0 -3
  143. package/dist/esm/product/components/ProductDescription.js +0 -168
  144. package/dist/esm/product/components/ProductDescription.liquid.js +0 -116
  145. /package/dist/cjs/button/components/{v2/ButtonLoadingIndicator.js → ButtonLoadingIndicator.js} +0 -0
  146. /package/dist/cjs/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
  147. /package/dist/esm/button/components/{v2/ButtonLoadingIndicator.js → ButtonLoadingIndicator.js} +0 -0
  148. /package/dist/esm/product/components/ProductDescription/{common.js → common/getMaxHeight.js} +0 -0
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+
5
+ const getBaseClasses = (uid)=>({
6
+ 'gp-block': true,
7
+ [`wrap__button--unbranded__${uid}`]: true,
8
+ [String.raw`[&_.shopify-payment-button\_\_button--unbranded]:gp-min-h-fit`]: true,
9
+ [String.raw`disabled:[&_.shopify-payment-button\_\_button--unbranded]:gp-pointer-events-none`]: true
10
+ });
11
+ const getTypographyClass = (typoType)=>{
12
+ if (!typoType) return {};
13
+ return {
14
+ [String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${core.genTypoClass(typoType)}`]: true
15
+ };
16
+ };
17
+ const getSpacingClass = (spacingType)=>{
18
+ if (!spacingType) return {};
19
+ return {
20
+ [String.raw`[&_.shopify-payment-button\_\_button--unbranded]:!${core.genSizeClass(spacingType)}`]: true
21
+ };
22
+ };
23
+ const getButtonClasses = ({ uid = '', styles })=>{
24
+ return {
25
+ ...getBaseClasses(uid),
26
+ ...getTypographyClass(styles?.typo?.type),
27
+ ...getSpacingClass(styles?.btnSpacing?.type),
28
+ [core.getGlobalColorStateClassDynamicBtn('text', styles?.textColor)]: true
29
+ };
30
+ };
31
+
32
+ exports.getButtonClasses = getButtonClasses;
@@ -0,0 +1,181 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+
5
+ const composeSize = (width, height, important = true)=>{
6
+ return `
7
+ ${width ? `width: ${width}${important ? '!important;' : ''};` : ''}
8
+ ${height ? `height: ${height}${important ? '!important;' : ''};` : ''}
9
+ `;
10
+ };
11
+ const composeSpacing = (device, padding)=>{
12
+ const suffix = device && device !== 'desktop' ? `-${device}` : '';
13
+ const spacingDevice = {
14
+ top: padding[`--pt${suffix}`],
15
+ bottom: padding[`--pb${suffix}`],
16
+ left: padding[`--pl${suffix}`],
17
+ right: padding[`--pr${suffix}`]
18
+ };
19
+ return `
20
+ padding-top: ${spacingDevice.top ? `${spacingDevice.top} !important;` : ''};
21
+ padding-bottom: ${spacingDevice.bottom ? `${spacingDevice.bottom} !important;` : ''};
22
+ padding-left: ${spacingDevice.left ? `${spacingDevice.left} !important;` : ''};
23
+ padding-right: ${spacingDevice.right ? `${spacingDevice.right} !important;` : ''};
24
+ `;
25
+ };
26
+ const composeFontSize = (fontSize)=>{
27
+ return fontSize ? `font-size: ${fontSize} !important;` : '';
28
+ };
29
+ const composeLineHeight = (lineHeight)=>{
30
+ return lineHeight ? `line-height: ${lineHeight} !important;` : '';
31
+ };
32
+ const composeTextAlign = (align)=>{
33
+ return `${align ? `text-align: ${align} !important;` : ''}`;
34
+ };
35
+ const getDeviceStyles = ({ uid, device, styles, composeGlobalSize })=>{
36
+ return `
37
+ .wrap__button--unbranded__${uid} {
38
+ ${composeTextAlign(styles?.align?.[device])}
39
+ }
40
+
41
+ .wrap__button--unbranded__${uid} .shopify-payment-button {
42
+ ${composeSize(composeGlobalSize.width[device], composeGlobalSize.height[device], device !== 'desktop')}
43
+ }
44
+
45
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
46
+ width: 100%;
47
+ ${device !== 'desktop' ? `
48
+ ${composeLineHeight(styles?.typo?.custom?.lineHeight?.[device])}
49
+ ${composeFontSize(styles?.typo?.custom?.fontSize?.[device])}
50
+ ` : ''}
51
+ ${composeSpacing(device, composeGlobalSize.padding)}
52
+ ${composeSize(composeGlobalSize.width[device] ?? 'auto', composeGlobalSize.height[device] ?? 'auto', false)}
53
+ ${core.composeShadowCss({
54
+ boxShadowValue: styles?.boxShadowBtnV2?.[device]?.normal,
55
+ hasBoxShadow: styles?.boxShadowBtnV2?.[device]?.normal?.type !== 'none'
56
+ })}
57
+ ${core.composeCornerCss(styles?.roundedBtnV2?.[device]?.normal, true)}
58
+ ${device === 'desktop' ? core.composeTypographyV2Css(styles?.typo, true) : ''}
59
+ }
60
+
61
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover {
62
+ ${core.composeShadowCss({
63
+ boxShadowValue: styles?.boxShadowBtnV2?.[device]?.hover,
64
+ hasBoxShadow: styles?.boxShadowBtnV2?.[device]?.hover?.type !== 'none',
65
+ important: true
66
+ })}
67
+ ${core.composeTextHoverColorCss(device, styles?.textColorHover, true)}
68
+ }
69
+
70
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
71
+ ${core.composeBorderCss(styles?.borderBtnV2?.[device]?.normal)}
72
+ ${core.composeCornerCss(styles?.roundedBtnV2?.[device]?.normal)}
73
+ ${core.composeBackgroundImageCss(styles?.backgroundImage, {
74
+ device,
75
+ state: 'normal'
76
+ })}
77
+ ${core.composeBackgroundCss(styles?.backgroundColorV2?.[device]?.normal)}
78
+ }
79
+
80
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded:hover::before {
81
+ ${core.composeBorderCss(styles?.borderBtnV2?.[device]?.hover)}
82
+ ${core.composeCornerCss(styles?.roundedBtnV2?.[device]?.hover)}
83
+ ${core.composeBackgroundCss(styles?.backgroundColorV2?.[device]?.hover)}
84
+ }
85
+ `;
86
+ };
87
+ const getButtonStyles = ({ styles, uid })=>{
88
+ const composeGlobalSize = {
89
+ width: core.getWidthHeightGlobalSize('width', styles?.globalSize),
90
+ height: core.getWidthHeightGlobalSize('height', styles?.globalSize),
91
+ padding: core.getPaddingGlobalSize(styles?.globalSize)
92
+ };
93
+ const baseStyles = `
94
+ .wrap__button--unbranded__${uid} .shopify-payment-button {
95
+ display: inline-block;
96
+ min-height: unset !important;
97
+ }
98
+
99
+ .wrap__button--unbranded__${uid} .shopify-payment-button div {
100
+ width: 100%;
101
+ margin-top: 0px !important;
102
+ }
103
+
104
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__more-options {
105
+ display: none;
106
+ }
107
+
108
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded {
109
+ max-width: 100%;
110
+ min-width: unset;
111
+ min-height: unset !important;
112
+ background-color: unset !important;
113
+ position: relative;
114
+ border: none !important;
115
+ margin: 0;
116
+ z-index: 0;
117
+ border-radius: unset;
118
+ width: 100%;
119
+ display: inline-flex;
120
+ justify-content: center;
121
+ align-items: center;
122
+ }
123
+
124
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::before {
125
+ content: "";
126
+ height: 100%;
127
+ width: 100%;
128
+ position: absolute;
129
+ top: 0;
130
+ left: 0;
131
+ pointer-events: none;
132
+ z-index: -1;
133
+ }
134
+
135
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::after {
136
+ border-radius: 0;
137
+ box-shadow: none;
138
+ }
139
+
140
+ .wrap__button--unbranded__${uid} .shopify-payment-button .shopify-payment-button__button--unbranded::after:hover {
141
+ border-radius: 0;
142
+ box-shadow: none;
143
+ }
144
+
145
+ .wrap__button--unbranded__${uid} .shopify-payment-button > div {
146
+ max-width: 100%;
147
+ }
148
+
149
+ .wrap__button--unbranded__${uid} .shopify-payment-button > div > div {
150
+ max-width: 100%;
151
+ }
152
+
153
+ ${getDeviceStyles({
154
+ device: 'desktop',
155
+ uid,
156
+ styles,
157
+ composeGlobalSize
158
+ })}
159
+
160
+ @media only screen and (max-width: 1024px) and (min-width: 768px) {
161
+ ${getDeviceStyles({
162
+ device: 'tablet',
163
+ uid,
164
+ styles,
165
+ composeGlobalSize
166
+ })}
167
+ }
168
+
169
+ @media only screen and (max-width: 767px) {
170
+ ${getDeviceStyles({
171
+ device: 'mobile',
172
+ uid,
173
+ styles,
174
+ composeGlobalSize
175
+ })}
176
+ }
177
+ `;
178
+ return baseStyles;
179
+ };
180
+
181
+ exports.getButtonStyles = getButtonStyles;
@@ -0,0 +1,58 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@gem-sdk/core');
6
+ var system = require('@gem-sdk/system');
7
+ var helpers = require('../../../../helpers.js');
8
+ var classes = require('../common/classes.js');
9
+ var styles = require('../common/styles.js');
10
+
11
+ const Button = ({ setting, advanced, styles: styles$1, pageContext, builderProps, className = '' })=>{
12
+ const translatedLabel = helpers.getDynamicSourceLocales({
13
+ pageContext,
14
+ settingId: 'label',
15
+ val: setting?.label,
16
+ uid: builderProps?.uid,
17
+ translate: setting?.translate
18
+ });
19
+ const buttonClass = system.createClass({
20
+ ...!!className && {
21
+ [className]: true
22
+ },
23
+ ...classes.getButtonClasses({
24
+ styles: styles$1,
25
+ uid: builderProps?.uid
26
+ })
27
+ });
28
+ const buttonStyles = styles.getButtonStyles({
29
+ styles: styles$1,
30
+ uid: builderProps?.uid
31
+ });
32
+ const buttonState = system.createStateOrContext({
33
+ setting: {
34
+ label: setting?.label
35
+ },
36
+ totalVariant: '{{product.variants.size}}'
37
+ });
38
+ return core.template`
39
+ ${system.Liquid(`
40
+ {%- liquid
41
+ assign inventory_quantity = variant.inventory_quantity | default: 0
42
+ assign supported_payment_methods = shop.enabled_payment_types
43
+ -%}
44
+ `)}
45
+ <gp-product-dynamic data-id="${builderProps?.uid}" data-translate-label="${translatedLabel}" class="${advanced?.cssClass}" gp-data='${JSON.stringify(buttonState).replaceAll("'", '&#039;')}
46
+ '>
47
+ <div class="${buttonClass}">
48
+ {{ form | payment_button }}
49
+ </div>
50
+ {% style %}
51
+ ${buttonStyles}
52
+ {% endstyle %}
53
+ </gp-product-dynamic>
54
+ ${system.If(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-product-dynamic.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-product-dynamic.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
55
+ `;
56
+ };
57
+
58
+ exports.default = Button;
@@ -4,16 +4,13 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
- var ButtonV2 = require('../../button/components/v2/ButtonV2.js');
8
- require('@gem-sdk/core');
9
- require('next/link');
10
- require('react');
7
+ var Button = require('../../button/components/Button.js');
11
8
 
12
9
  const DynamicCheckout = ({ builderProps, builderAttrs, style, styles, advanced, setting })=>{
13
10
  const { ...buttonStyles } = styles ?? {};
14
11
  const label = setting?.label || 'Buy it now';
15
12
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
16
- children: /*#__PURE__*/ jsxRuntime.jsx(ButtonV2.default, {
13
+ children: /*#__PURE__*/ jsxRuntime.jsx(Button.default, {
17
14
  builderProps: builderProps,
18
15
  builderAttrs: builderAttrs,
19
16
  className: "shopify-payment-button__button",
@@ -6,14 +6,14 @@ require('react');
6
6
  require('@gem-sdk/core');
7
7
  require('@gem-sdk/system');
8
8
  var helpers = require('../../../../../helpers.js');
9
- require('next/head');
10
9
  require('next/link');
11
10
  require('@gem-sdk/keen-slider/react');
12
11
  require('../../../ProductVariants/variants/index.js');
12
+ require('next/head');
13
13
  require('next/image');
14
14
  require('react-youtube');
15
15
  require('../../../../../image/components/AdaptiveImage.js');
16
- require('../../../../../cart/components/ShopPayButton/index.js');
16
+ require('../../../../../cart/components/ShopPayButton/ShopPayButton.js');
17
17
  require('../../../../../countdown-timer/setting/configs/settings.js');
18
18
  require('../../../../../header/components/Header.js');
19
19
  require('../../../../../header/components/kind/basic/index.js');
@@ -6,8 +6,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  var core = require('@gem-sdk/core');
8
8
  var React = require('react');
9
- var ButtonV2 = require('../../button/components/v2/ButtonV2.js');
10
- require('next/link');
9
+ var Button = require('../../button/components/Button.js');
11
10
  var useNotification = require('../../notification/hooks/use-notification.js');
12
11
  require('../../notification/components/Notice.js');
13
12
  var Text = require('../../text/components/Text.js');
@@ -477,7 +476,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
477
476
  ]);
478
477
  return /*#__PURE__*/ jsxRuntime.jsxs(jsxRuntime.Fragment, {
479
478
  children: [
480
- /*#__PURE__*/ jsxRuntime.jsxs(ButtonV2.default, {
479
+ /*#__PURE__*/ jsxRuntime.jsxs(Button.default, {
481
480
  className: core.cls({
482
481
  'gp-cursor-default gp-opacity-30': isDisable
483
482
  }),
@@ -3,8 +3,8 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var core = require('@gem-sdk/core');
6
+ var Button_liquid = require('../../button/components/Button.liquid.js');
6
7
  var helpers = require('../../helpers.js');
7
- var ButtonV2_liquid = require('../../button/components/v2/ButtonV2.liquid.js');
8
8
  var ProductPrice_liquid = require('./ProductPrice.liquid.js');
9
9
 
10
10
  const NODE_PRICE_EMPTY = null;
@@ -304,7 +304,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
304
304
  gp-href="${urlData.href}"
305
305
  data-variant-selection-required-message="${pageContext?.isPreviewing ? variantSelectionRequiredMessage : `{{${variantSelectionRequiredMessage}}}`}"
306
306
  >
307
- ${ButtonV2_liquid.default({
307
+ ${Button_liquid.default({
308
308
  className: 'gp-button-atc tcustomizer-submit-button',
309
309
  wrapClassName: `{% unless variant.available %} !gp-hidden {% endunless %}`,
310
310
  advanced: advanced,
@@ -338,7 +338,7 @@ const ProductButton = ({ setting, builderProps, builderAttrs, style, styles, adv
338
338
  pageContext,
339
339
  nodePrice: composeNodePrice()
340
340
  })}
341
- ${ButtonV2_liquid.default({
341
+ ${Button_liquid.default({
342
342
  className: 'gp-button-sold-out btn-disabled gp-opacity-30 gp-cursor-default',
343
343
  wrapClassName: `{% if variant.available %} !gp-hidden {% endif %}`,
344
344
  advanced: advanced,
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ const DESCRIPTION_LINE_HEIGHT_DEFAULT = 21;
4
+ const ICON_SVG = `<svg height="1em" width="1em" viewBox="0 0 22 12" fill="none" xmlns="http://www.w3.org/2000/svg" ><path d="M1.70711 0.292893C1.31658 -0.0976311 0.683417 -0.0976311 0.292893 0.292893C-0.0976311 0.683417 -0.0976311 1.31658 0.292893 1.70711L1.70711 0.292893ZM11 11L10.2929 11.7071C10.6834 12.0976 11.3166 12.0976 11.7071 11.7071L11 11ZM21.7071 1.70711C22.0976 1.31658 22.0976 0.683417 21.7071 0.292893C21.3166 -0.0976311 20.6834 -0.0976311 20.2929 0.292893L21.7071 1.70711ZM0.292893 1.70711L10.2929 11.7071L11.7071 10.2929L1.70711 0.292893L0.292893 1.70711ZM11.7071 11.7071L21.7071 1.70711L20.2929 0.292893L10.2929 10.2929L11.7071 11.7071Z"
5
+ fill="currentColor"/>
6
+ </svg>`;
7
+
8
+ exports.DESCRIPTION_LINE_HEIGHT_DEFAULT = DESCRIPTION_LINE_HEIGHT_DEFAULT;
9
+ exports.ICON_SVG = ICON_SVG;
@@ -0,0 +1,30 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+
5
+ const getClasses = ({ setting })=>{
6
+ const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
7
+ const globalColorClass = core.getGlobalColorClass('text', setting?.color);
8
+ return {
9
+ 'gp-relative p-description-wrapper gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre': true,
10
+ ...appendTypoClass && {
11
+ [appendTypoClass]: true
12
+ },
13
+ [globalColorClass]: true,
14
+ "data-[browser=safari]:after:gp-content-[' '] data-[browser=safari]:after:gp-absolute data-[browser=safari]:after:gp-left-0 data-[browser=safari]:after:gp-right-0 data-[browser=safari]:after:gp-bottom-0 data-[browser=safari]:after:gp-w-full data-[browser=safari]:after:gp-h-1/2 data-[browser=safari]:after:gp-bg-gradient-to-t data-[browser=safari]:after:gp-from-white": true
15
+ };
16
+ };
17
+ const getButtonClasses = ({ setting })=>{
18
+ const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
19
+ const globalColorClass = core.getGlobalColorClass('text', setting?.showMoreColor);
20
+ return {
21
+ 'p-description-show-more gp-items-center gp-mt-4 gp-w-full gp-transition-all hover:gp-opacity-80': true,
22
+ ...appendTypoClass && {
23
+ [appendTypoClass]: true
24
+ },
25
+ [globalColorClass]: true
26
+ };
27
+ };
28
+
29
+ exports.getButtonClasses = getButtonClasses;
30
+ exports.getClasses = getClasses;
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ var core = require('@gem-sdk/core');
4
+ var getMaxHeight = require('./getMaxHeight.js');
5
+
6
+ const devices = [
7
+ 'desktop',
8
+ 'mobile',
9
+ 'tablet'
10
+ ];
11
+ const getDisplayStyle = (fnCondition, defaultValue)=>{
12
+ let result = {};
13
+ devices.forEach((device)=>{
14
+ result = {
15
+ ...result,
16
+ [`--d${device === 'desktop' ? '' : `-${device}`}`]: `${fnCondition(device) ? 'none' : defaultValue}`
17
+ };
18
+ });
19
+ return result;
20
+ };
21
+ const getTextStyle = ({ setting, renderMaxHeight })=>{
22
+ const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
23
+ const composeStyles = {
24
+ ...core.getStyleShadow({
25
+ value: setting?.typo?.custom?.textShadow,
26
+ styleAppliedFor: 'text-shadow',
27
+ isEnableShadow: setting?.typo?.custom?.textShadow?.type !== 'none'
28
+ }),
29
+ ...core.makeStyleResponsive('ta', setting?.textAlign),
30
+ ...core.getGlobalColorStyle(setting?.color),
31
+ ...core.makeStyle({
32
+ tt: setting?.transform
33
+ }),
34
+ ...appendTypoStyle,
35
+ ...renderMaxHeight && getMaxHeight.getMaxHeightStyleDefault(setting)
36
+ };
37
+ return core.filterTruthyStyles(composeStyles);
38
+ };
39
+ const getButtonStyle = ({ setting })=>{
40
+ const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
41
+ const getDisplayCollapse = ()=>{
42
+ return getDisplayStyle((device)=>!!setting?.hasLineClamp && setting.hasLineClamp[device] !== undefined && !setting.hasLineClamp[device], 'inline-flex');
43
+ };
44
+ const composeStyles = {
45
+ ...core.makeStyleResponsive('jc', setting?.textAlign),
46
+ ...core.makeStyle({
47
+ tt: setting?.transform
48
+ }),
49
+ ...appendTypoStyle,
50
+ ...core.getGlobalColorStyle(setting?.showMoreColor),
51
+ ...getDisplayCollapse()
52
+ };
53
+ return core.filterTruthyStyles(composeStyles);
54
+ };
55
+ const getStaticCss = ()=>{
56
+ const gpDescriptionCss = `
57
+ .gp-p-description-text > *:not(ol):not(ul):not(table):not(div):not(style):not(script) {
58
+ display: inline !important;
59
+ }
60
+ .gp-p-description-text > *:not(ol):not(ul):not(table):not(div):not(style):not(script)::after {
61
+ content: "\\A";
62
+ white-space: pre;
63
+ }
64
+ .gp-p-description-text > table {
65
+ box-shadow: none;
66
+ }
67
+ `;
68
+ const textDescriptionCss = `
69
+ .p-description-wrapper.gp-p-description-text * {
70
+ color: inherit;
71
+ line-height: inherit !important;
72
+ }`;
73
+ return {
74
+ gpDescriptionCss,
75
+ textDescriptionCss
76
+ };
77
+ };
78
+
79
+ exports.getButtonStyle = getButtonStyle;
80
+ exports.getStaticCss = getStaticCss;
81
+ exports.getTextStyle = getTextStyle;
@@ -0,0 +1,90 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var _const = require('../common/const.js');
5
+ var core = require('@gem-sdk/core');
6
+
7
+ const useGpDescription = (setting)=>{
8
+ const ref = React.useRef(null);
9
+ const [open, setOpen] = React.useState(false);
10
+ const [isShowViewMore, setIsShowViewMore] = React.useState(false);
11
+ const product = core.useProduct();
12
+ const currentDevice = core.useCurrentDevice();
13
+ const hasLineClamp = core.getResponsiveValueByScreen(setting?.hasLineClamp, currentDevice);
14
+ const lineClamp = core.getResponsiveValueByScreen(setting?.lineClamp, currentDevice);
15
+ const { redirectProductShopifyLink } = core.useProductShopifyEditLink();
16
+ const mode = core.useEditorMode();
17
+ const getLineHeightFromDom = React.useCallback(()=>{
18
+ if (!ref.current) return _const.DESCRIPTION_LINE_HEIGHT_DEFAULT;
19
+ const lineHeight = window.getComputedStyle(ref.current).getPropertyValue('line-height');
20
+ return Math.ceil(parseFloat(lineHeight));
21
+ }, []);
22
+ const getMaxHeight = React.useCallback((lineHeight)=>{
23
+ if (!hasLineClamp || !lineClamp) return 'auto';
24
+ if (lineHeight) return `${lineClamp * lineHeight}px`;
25
+ return 'auto';
26
+ }, [
27
+ hasLineClamp,
28
+ lineClamp
29
+ ]);
30
+ const handleToggleShowMore = ()=>{
31
+ if (!ref.current) return;
32
+ const lineHeight = getLineHeightFromDom();
33
+ if (open) {
34
+ ref.current.style.maxHeight = getMaxHeight(lineHeight);
35
+ } else {
36
+ ref.current.style.maxHeight = 'none';
37
+ }
38
+ setOpen((prev)=>!prev);
39
+ };
40
+ React.useEffect(()=>{
41
+ const lineHeight = getLineHeightFromDom();
42
+ getMaxHeight(lineHeight);
43
+ }, [
44
+ setting?.typo?.custom,
45
+ getMaxHeight,
46
+ getLineHeightFromDom
47
+ ]);
48
+ React.useEffect(()=>{
49
+ const dom = ref.current;
50
+ setOpen(false);
51
+ if (!dom) return;
52
+ const enableShowMore = hasLineClamp && product?.descriptionHtml;
53
+ if (!enableShowMore) dom.style.maxHeight = 'none';
54
+ else {
55
+ const value = lineClamp;
56
+ setTimeout(()=>{
57
+ const scrollHeight = dom?.scrollHeight ?? 0;
58
+ const clientHeight = dom?.clientHeight ?? 0;
59
+ const lineHeight = getLineHeightFromDom();
60
+ const lineText = Math.round((scrollHeight ?? 0) / lineHeight);
61
+ dom.style.maxHeight = getMaxHeight(lineHeight);
62
+ const conditionCheckLine = value && value < lineText || clientHeight < scrollHeight;
63
+ if (value && conditionCheckLine) {
64
+ setIsShowViewMore(()=>true);
65
+ } else {
66
+ setIsShowViewMore(()=>false);
67
+ }
68
+ }, 100);
69
+ }
70
+ }, [
71
+ hasLineClamp,
72
+ lineClamp,
73
+ product?.description,
74
+ product?.descriptionHtml,
75
+ getLineHeightFromDom,
76
+ getMaxHeight,
77
+ setOpen,
78
+ setIsShowViewMore
79
+ ]);
80
+ return {
81
+ ref,
82
+ open,
83
+ isShowViewMore,
84
+ handleToggleShowMore,
85
+ mode,
86
+ redirectProductShopifyLink
87
+ };
88
+ };
89
+
90
+ exports.useGpDescription = useGpDescription;