@gem-sdk/components 2.1.15 → 2.1.17
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/builder.js +25 -1
- package/dist/cjs/collection/components/CollectionDescription.js +101 -7
- package/dist/cjs/collection/components/CollectionDescription.liquid.js +102 -9
- package/dist/cjs/collection/setting/CollectionDescription.js +128 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/index.liquid.js +24 -0
- package/dist/cjs/product/components/ProductDescription/common.js +28 -0
- package/dist/cjs/product/components/ProductDescription/const.js +5 -0
- package/dist/cjs/product/components/ProductDescription.js +38 -10
- package/dist/cjs/product/components/ProductDescription.liquid.js +3 -1
- package/dist/cjs/third-party/components/AlsoBoughtCbb.js +32 -0
- package/dist/cjs/third-party/components/AlsoBoughtCbb.liquid.js +21 -0
- package/dist/cjs/third-party/components/BfSizeChartSizeGuide.js +32 -0
- package/dist/cjs/third-party/components/BfSizeChartSizeGuide.liquid.js +12 -0
- package/dist/cjs/third-party/components/EssentialAnnouncementBar.js +32 -0
- package/dist/cjs/third-party/components/EssentialAnnouncementBar.liquid.js +12 -0
- package/dist/cjs/third-party/components/EssentialCountdownTimerBar.js +32 -0
- package/dist/cjs/third-party/components/EssentialCountdownTimerBar.liquid.js +12 -0
- package/dist/cjs/third-party/components/EstimatedDeliveryDatePlus.js +32 -0
- package/dist/cjs/third-party/components/EstimatedDeliveryDatePlus.liquid.js +12 -0
- package/dist/cjs/third-party/components/GloColorSwatchvariantImage.js +32 -0
- package/dist/cjs/third-party/components/GloColorSwatchvariantImage.liquid.js +12 -0
- package/dist/cjs/third-party/components/HextomCountdownTimerBar.js +32 -0
- package/dist/cjs/third-party/components/HextomCountdownTimerBar.liquid.js +12 -0
- package/dist/cjs/third-party/components/HextomFreeShippingBar.js +32 -0
- package/dist/cjs/third-party/components/HextomFreeShippingBar.liquid.js +12 -0
- package/dist/cjs/third-party/components/OkendoReviewsLoyalty.js +32 -0
- package/dist/cjs/third-party/components/OkendoReviewsLoyalty.liquid.js +12 -0
- package/dist/cjs/third-party/components/StellarDeliveryDatePickup.js +32 -0
- package/dist/cjs/third-party/components/StellarDeliveryDatePickup.liquid.js +21 -0
- package/dist/cjs/third-party/components/TrustBadgesBear.js +32 -0
- package/dist/cjs/third-party/components/TrustBadgesBear.liquid.js +12 -0
- package/dist/cjs/third-party/components/TrustedsiteTrustBadges.js +32 -0
- package/dist/cjs/third-party/components/TrustedsiteTrustBadges.liquid.js +12 -0
- package/dist/cjs/third-party/configs/AlsoBoughtCbb.js +12 -0
- package/dist/cjs/third-party/configs/BfSizeChartSizeGuide.js +12 -0
- package/dist/cjs/third-party/configs/EssentialAnnouncementBar.js +12 -0
- package/dist/cjs/third-party/configs/EssentialCountdownTimerBar.js +12 -0
- package/dist/cjs/third-party/configs/EstimatedDeliveryDatePlus.js +12 -0
- package/dist/cjs/third-party/configs/GloColorSwatchvariantImage.js +12 -0
- package/dist/cjs/third-party/configs/HextomCountdownTimerBar.js +12 -0
- package/dist/cjs/third-party/configs/HextomFreeShippingBar.js +12 -0
- package/dist/cjs/third-party/configs/OkendoReviewsLoyalty.js +12 -0
- package/dist/cjs/third-party/configs/StellarDeliveryDatePickup.js +12 -0
- package/dist/cjs/third-party/configs/TrustBadgesBear.js +12 -0
- package/dist/cjs/third-party/configs/TrustedsiteTrustBadges.js +12 -0
- package/dist/cjs/third-party/helpers/thirdParty.js +1 -1
- package/dist/cjs/third-party/next.js +61 -1
- package/dist/cjs/third-party/setting/AlsoBoughtCbb.js +127 -0
- package/dist/cjs/third-party/setting/BfSizeChartSizeGuide.js +131 -0
- package/dist/cjs/third-party/setting/EssentialAnnouncementBar.js +142 -0
- package/dist/cjs/third-party/setting/EssentialCountdownTimerBar.js +142 -0
- package/dist/cjs/third-party/setting/EstimatedDeliveryDatePlus.js +128 -0
- package/dist/cjs/third-party/setting/GloColorSwatchvariantImage.js +152 -0
- package/dist/cjs/third-party/setting/HextomCountdownTimerBar.js +128 -0
- package/dist/cjs/third-party/setting/HextomFreeShippingBar.js +128 -0
- package/dist/cjs/third-party/setting/OkendoReviewsLoyalty.js +171 -0
- package/dist/cjs/third-party/setting/StellarDeliveryDatePickup.js +127 -0
- package/dist/cjs/third-party/setting/TrustBadgesBear.js +128 -0
- package/dist/cjs/third-party/setting/TrustedsiteTrustBadges.js +177 -0
- package/dist/cjs/third-party/setting/index.js +25 -1
- package/dist/esm/builder.js +25 -1
- package/dist/esm/collection/components/CollectionDescription.js +103 -9
- package/dist/esm/collection/components/CollectionDescription.liquid.js +103 -10
- package/dist/esm/collection/setting/CollectionDescription.js +128 -0
- package/dist/esm/index.js +12 -0
- package/dist/esm/index.liquid.js +12 -0
- package/dist/esm/product/components/ProductDescription/common.js +26 -0
- package/dist/esm/product/components/ProductDescription/const.js +3 -0
- package/dist/esm/product/components/ProductDescription.js +38 -10
- package/dist/esm/product/components/ProductDescription.liquid.js +3 -1
- package/dist/esm/third-party/components/AlsoBoughtCbb.js +28 -0
- package/dist/esm/third-party/components/AlsoBoughtCbb.liquid.js +17 -0
- package/dist/esm/third-party/components/BfSizeChartSizeGuide.js +28 -0
- package/dist/esm/third-party/components/BfSizeChartSizeGuide.liquid.js +8 -0
- package/dist/esm/third-party/components/EssentialAnnouncementBar.js +28 -0
- package/dist/esm/third-party/components/EssentialAnnouncementBar.liquid.js +8 -0
- package/dist/esm/third-party/components/EssentialCountdownTimerBar.js +28 -0
- package/dist/esm/third-party/components/EssentialCountdownTimerBar.liquid.js +8 -0
- package/dist/esm/third-party/components/EstimatedDeliveryDatePlus.js +28 -0
- package/dist/esm/third-party/components/EstimatedDeliveryDatePlus.liquid.js +8 -0
- package/dist/esm/third-party/components/GloColorSwatchvariantImage.js +28 -0
- package/dist/esm/third-party/components/GloColorSwatchvariantImage.liquid.js +8 -0
- package/dist/esm/third-party/components/HextomCountdownTimerBar.js +28 -0
- package/dist/esm/third-party/components/HextomCountdownTimerBar.liquid.js +8 -0
- package/dist/esm/third-party/components/HextomFreeShippingBar.js +28 -0
- package/dist/esm/third-party/components/HextomFreeShippingBar.liquid.js +8 -0
- package/dist/esm/third-party/components/OkendoReviewsLoyalty.js +28 -0
- package/dist/esm/third-party/components/OkendoReviewsLoyalty.liquid.js +8 -0
- package/dist/esm/third-party/components/StellarDeliveryDatePickup.js +28 -0
- package/dist/esm/third-party/components/StellarDeliveryDatePickup.liquid.js +17 -0
- package/dist/esm/third-party/components/TrustBadgesBear.js +28 -0
- package/dist/esm/third-party/components/TrustBadgesBear.liquid.js +8 -0
- package/dist/esm/third-party/components/TrustedsiteTrustBadges.js +28 -0
- package/dist/esm/third-party/components/TrustedsiteTrustBadges.liquid.js +8 -0
- package/dist/esm/third-party/configs/AlsoBoughtCbb.js +8 -0
- package/dist/esm/third-party/configs/BfSizeChartSizeGuide.js +8 -0
- package/dist/esm/third-party/configs/EssentialAnnouncementBar.js +8 -0
- package/dist/esm/third-party/configs/EssentialCountdownTimerBar.js +8 -0
- package/dist/esm/third-party/configs/EstimatedDeliveryDatePlus.js +8 -0
- package/dist/esm/third-party/configs/GloColorSwatchvariantImage.js +8 -0
- package/dist/esm/third-party/configs/HextomCountdownTimerBar.js +8 -0
- package/dist/esm/third-party/configs/HextomFreeShippingBar.js +8 -0
- package/dist/esm/third-party/configs/OkendoReviewsLoyalty.js +8 -0
- package/dist/esm/third-party/configs/StellarDeliveryDatePickup.js +8 -0
- package/dist/esm/third-party/configs/TrustBadgesBear.js +8 -0
- package/dist/esm/third-party/configs/TrustedsiteTrustBadges.js +8 -0
- package/dist/esm/third-party/helpers/thirdParty.js +1 -1
- package/dist/esm/third-party/next.js +61 -1
- package/dist/esm/third-party/setting/AlsoBoughtCbb.js +123 -0
- package/dist/esm/third-party/setting/BfSizeChartSizeGuide.js +127 -0
- package/dist/esm/third-party/setting/EssentialAnnouncementBar.js +138 -0
- package/dist/esm/third-party/setting/EssentialCountdownTimerBar.js +138 -0
- package/dist/esm/third-party/setting/EstimatedDeliveryDatePlus.js +124 -0
- package/dist/esm/third-party/setting/GloColorSwatchvariantImage.js +148 -0
- package/dist/esm/third-party/setting/HextomCountdownTimerBar.js +124 -0
- package/dist/esm/third-party/setting/HextomFreeShippingBar.js +124 -0
- package/dist/esm/third-party/setting/OkendoReviewsLoyalty.js +167 -0
- package/dist/esm/third-party/setting/StellarDeliveryDatePickup.js +123 -0
- package/dist/esm/third-party/setting/TrustBadgesBear.js +124 -0
- package/dist/esm/third-party/setting/TrustedsiteTrustBadges.js +173 -0
- package/dist/esm/third-party/setting/index.js +226 -202
- package/dist/types/index.d.ts +204 -2
- package/package.json +2 -2
package/dist/cjs/builder.js
CHANGED
|
@@ -111,6 +111,18 @@ var TrustreviewsProductReviews = require('./third-party/components/TrustreviewsP
|
|
|
111
111
|
var MyappgurusProductReviews = require('./third-party/components/MyappgurusProductReviews.js');
|
|
112
112
|
var HulkProductOptions = require('./third-party/components/HulkProductOptions.js');
|
|
113
113
|
var TrustshopProductReviews = require('./third-party/components/TrustshopProductReviews.js');
|
|
114
|
+
var StellarDeliveryDatePickup = require('./third-party/components/StellarDeliveryDatePickup.js');
|
|
115
|
+
var EssentialCountdownTimerBar = require('./third-party/components/EssentialCountdownTimerBar.js');
|
|
116
|
+
var EssentialAnnouncementBar = require('./third-party/components/EssentialAnnouncementBar.js');
|
|
117
|
+
var OkendoReviewsLoyalty = require('./third-party/components/OkendoReviewsLoyalty.js');
|
|
118
|
+
var EstimatedDeliveryDatePlus = require('./third-party/components/EstimatedDeliveryDatePlus.js');
|
|
119
|
+
var HextomCountdownTimerBar = require('./third-party/components/HextomCountdownTimerBar.js');
|
|
120
|
+
var TrustBadgesBear = require('./third-party/components/TrustBadgesBear.js');
|
|
121
|
+
var TrustedsiteTrustBadges = require('./third-party/components/TrustedsiteTrustBadges.js');
|
|
122
|
+
var GloColorSwatchvariantImage = require('./third-party/components/GloColorSwatchvariantImage.js');
|
|
123
|
+
var BfSizeChartSizeGuide = require('./third-party/components/BfSizeChartSizeGuide.js');
|
|
124
|
+
var AlsoBoughtCbb = require('./third-party/components/AlsoBoughtCbb.js');
|
|
125
|
+
var HextomFreeShippingBar = require('./third-party/components/HextomFreeShippingBar.js');
|
|
114
126
|
var CartLineVariant = require('./cart/components/CartLineVariant.js');
|
|
115
127
|
var Cart = require('./cart/components/Cart.js');
|
|
116
128
|
var CartList = require('./cart/components/CartList.js');
|
|
@@ -245,6 +257,11 @@ var PostPurchaseCountdownTimer = require('./post-purchase/countdown-timer/compon
|
|
|
245
257
|
var Text$1 = require('./post-purchase/text/Text.js');
|
|
246
258
|
|
|
247
259
|
var builder = {
|
|
260
|
+
EstimatedDeliveryDatePlus: EstimatedDeliveryDatePlus.default,
|
|
261
|
+
OkendoReviewsLoyalty: OkendoReviewsLoyalty.default,
|
|
262
|
+
EssentialAnnouncementBar: EssentialAnnouncementBar.default,
|
|
263
|
+
EssentialCountdownTimerBar: EssentialCountdownTimerBar.default,
|
|
264
|
+
StellarDeliveryDatePickup: StellarDeliveryDatePickup.default,
|
|
248
265
|
TrustshopProductReviews: TrustshopProductReviews.default,
|
|
249
266
|
HulkProductOptions: HulkProductOptions.default,
|
|
250
267
|
TrustreviewsProductReviews: TrustreviewsProductReviews.default,
|
|
@@ -479,7 +496,14 @@ var builder = {
|
|
|
479
496
|
ArticleReadMore: ArticleReadMore.default,
|
|
480
497
|
Marquee: Marquee.default,
|
|
481
498
|
MarqueeItem: MarqueeItem.default,
|
|
482
|
-
ProductBadge: index$8.default
|
|
499
|
+
ProductBadge: index$8.default,
|
|
500
|
+
HextomCountdownTimerBar: HextomCountdownTimerBar.default,
|
|
501
|
+
TrustBadgesBear: TrustBadgesBear.default,
|
|
502
|
+
TrustedsiteTrustBadges: TrustedsiteTrustBadges.default,
|
|
503
|
+
GloColorSwatchvariantImage: GloColorSwatchvariantImage.default,
|
|
504
|
+
BfSizeChartSizeGuide: BfSizeChartSizeGuide.default,
|
|
505
|
+
AlsoBoughtCbb: AlsoBoughtCbb.default,
|
|
506
|
+
HextomFreeShippingBar: HextomFreeShippingBar.default
|
|
483
507
|
};
|
|
484
508
|
|
|
485
509
|
exports.default = builder;
|
|
@@ -4,16 +4,110 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
|
-
var
|
|
7
|
+
var React = require('react');
|
|
8
8
|
|
|
9
|
-
const CollectionDescription = ({ setting })=>{
|
|
9
|
+
const CollectionDescription = ({ setting, builderProps })=>{
|
|
10
|
+
const [open, setOpen] = React.useState(false);
|
|
11
|
+
const [isShowViewMore, allowShowViewMore] = React.useState(false);
|
|
12
|
+
const ref = React.useRef(null);
|
|
13
|
+
const currentDevice = core.useCurrentDevice();
|
|
10
14
|
const collection = core.useCollection();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const hasLineClamp = core.getResponsiveValueByScreen(setting?.hasLineClamp, currentDevice);
|
|
16
|
+
const lineClamp = core.getResponsiveValueByScreen(setting?.lineClamp, currentDevice);
|
|
17
|
+
const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
|
|
18
|
+
const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
|
|
19
|
+
React.useEffect(()=>{
|
|
20
|
+
const dom = ref.current;
|
|
21
|
+
setOpen(false);
|
|
22
|
+
if (dom && hasLineClamp && collection?.description) {
|
|
23
|
+
const value = lineClamp;
|
|
24
|
+
setTimeout(()=>{
|
|
25
|
+
const scrollHeight = dom?.scrollHeight ?? 0;
|
|
26
|
+
const clientHeight = dom?.clientHeight ?? 0;
|
|
27
|
+
const lineHeight = window.getComputedStyle(dom).getPropertyValue('line-height');
|
|
28
|
+
const lineText = Math.round((scrollHeight ?? 0) / parseInt(lineHeight));
|
|
29
|
+
const conditionCheckLine = core.isSafari() ? value && value < lineText : clientHeight < scrollHeight;
|
|
30
|
+
if (value && conditionCheckLine) {
|
|
31
|
+
allowShowViewMore(()=>true);
|
|
32
|
+
} else {
|
|
33
|
+
allowShowViewMore(()=>false);
|
|
34
|
+
}
|
|
35
|
+
}, 100);
|
|
16
36
|
}
|
|
37
|
+
}, [
|
|
38
|
+
hasLineClamp,
|
|
39
|
+
lineClamp,
|
|
40
|
+
collection?.description
|
|
41
|
+
]);
|
|
42
|
+
const css = `
|
|
43
|
+
.gp-p-description-text > *:not(ol):not(ul):not(table):not(div) {
|
|
44
|
+
display: inline !important;
|
|
45
|
+
}
|
|
46
|
+
.gp-p-description-text > *:not(ol):not(ul):not(table):not(div)::after {
|
|
47
|
+
content: "\\A";
|
|
48
|
+
white-space: pre;
|
|
49
|
+
}
|
|
50
|
+
.gp-p-description-text > table {
|
|
51
|
+
box-shadow: none;
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
const hasDescription = collection?.description && collection.description?.trim() != '';
|
|
55
|
+
return /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
56
|
+
"data-id": builderProps?.uid,
|
|
57
|
+
children: [
|
|
58
|
+
!core.isSafari() && /*#__PURE__*/ jsxRuntime.jsx("style", {
|
|
59
|
+
children: css
|
|
60
|
+
}),
|
|
61
|
+
/*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
62
|
+
ref: ref,
|
|
63
|
+
"data-gp-text": true,
|
|
64
|
+
className: core.cls('gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre', appendTypoClass, !hasDescription ? 'gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500 gp-py-2 !gp-text-center' : '', core.getGlobalColorClass('text', setting?.color)),
|
|
65
|
+
style: {
|
|
66
|
+
...core.getStyleShadow({
|
|
67
|
+
styleAppliedFor: 'text-shadow'
|
|
68
|
+
}),
|
|
69
|
+
...core.makeStyleResponsive('ta', setting?.textAlign),
|
|
70
|
+
...hasLineClamp && !open ? core.makeStyleResponsive('line-clamp', setting?.lineClamp) : {},
|
|
71
|
+
...core.makeStyle({
|
|
72
|
+
tt: setting?.transform
|
|
73
|
+
}),
|
|
74
|
+
...appendTypoStyle
|
|
75
|
+
},
|
|
76
|
+
dangerouslySetInnerHTML: {
|
|
77
|
+
__html: collection?.descriptionHtml && hasDescription ? collection.descriptionHtml : ``
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
hasLineClamp && isShowViewMore && /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
81
|
+
className: core.cls(appendTypoClass, core.getGlobalColorClass('text', setting?.showMoreColor), 'gp-mt-4 gp-w-full gp-transition-all hover:gp-opacity-80'),
|
|
82
|
+
style: {
|
|
83
|
+
...core.makeStyleResponsive('ta', setting?.textAlign),
|
|
84
|
+
...core.makeStyle({
|
|
85
|
+
tt: setting?.transform
|
|
86
|
+
}),
|
|
87
|
+
...appendTypoStyle,
|
|
88
|
+
...core.getGlobalColorStyle(setting?.showMoreColor)
|
|
89
|
+
},
|
|
90
|
+
onClick: ()=>setOpen((prev)=>!prev),
|
|
91
|
+
children: [
|
|
92
|
+
!open ? setting?.viewMoreText : setting?.viewLessText,
|
|
93
|
+
setting?.enableViewMoreIcon && /*#__PURE__*/ jsxRuntime.jsx("svg", {
|
|
94
|
+
className: "gp-ml-1 gp-inline-block",
|
|
95
|
+
height: "1em",
|
|
96
|
+
width: "1em",
|
|
97
|
+
viewBox: "0 0 22 12",
|
|
98
|
+
fill: "none",
|
|
99
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
100
|
+
children: !open ? /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
101
|
+
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",
|
|
102
|
+
fill: "currentColor"
|
|
103
|
+
}) : /*#__PURE__*/ jsxRuntime.jsx("path", {
|
|
104
|
+
d: "M0.292893 10.2929C-0.0976311 10.6834 -0.0976311 11.3166 0.292893 11.7071C0.683417 12.0976 1.31658 12.0976 1.70711 11.7071L0.292893 10.2929ZM11 1L11.7071 0.292893C11.3166 -0.0976311 10.6834 -0.0976311 10.2929 0.292893L11 1ZM20.2929 11.7071C20.6834 12.0976 21.3166 12.0976 21.7071 11.7071C22.0976 11.3166 22.0976 10.6834 21.7071 10.2929L20.2929 11.7071ZM1.70711 11.7071L11.7071 1.70711L10.2929 0.292893L0.292893 10.2929L1.70711 11.7071ZM10.2929 1.70711L20.2929 11.7071L21.7071 10.2929L11.7071 0.292893L10.2929 1.70711Z",
|
|
105
|
+
fill: "currentColor"
|
|
106
|
+
})
|
|
107
|
+
})
|
|
108
|
+
]
|
|
109
|
+
})
|
|
110
|
+
]
|
|
17
111
|
});
|
|
18
112
|
};
|
|
19
113
|
|
|
@@ -3,18 +3,111 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var core = require('@gem-sdk/core');
|
|
6
|
-
var
|
|
6
|
+
var helpers = require('../../helpers.js');
|
|
7
|
+
var common = require('../../product/components/ProductImages/common/common.js');
|
|
7
8
|
|
|
8
|
-
const CollectionDescription = ({ setting })=>{
|
|
9
|
+
const CollectionDescription = ({ setting, advanced, builderProps, pageContext })=>{
|
|
10
|
+
const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
|
|
11
|
+
const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
|
|
12
|
+
const defaultStyle = {
|
|
13
|
+
...core.getStyleShadow({
|
|
14
|
+
styleAppliedFor: 'text-shadow'
|
|
15
|
+
}),
|
|
16
|
+
...core.makeStyleResponsive('ta', setting?.textAlign),
|
|
17
|
+
...core.getGlobalColorStyle(setting?.color),
|
|
18
|
+
...core.makeStyle({
|
|
19
|
+
tt: setting?.transform
|
|
20
|
+
}),
|
|
21
|
+
...appendTypoStyle
|
|
22
|
+
};
|
|
23
|
+
const collapseStyle = {
|
|
24
|
+
...defaultStyle,
|
|
25
|
+
...core.makeStyleResponsive('line-clamp', core.makeLineClamp(setting?.lineClamp, setting?.hasLineClamp))
|
|
26
|
+
};
|
|
27
|
+
const getDisplayCollapse = ()=>{
|
|
28
|
+
return common.getDisplayStyle((device)=>!!setting?.hasLineClamp && setting.hasLineClamp[device] !== undefined && !setting.hasLineClamp[device], 'block');
|
|
29
|
+
};
|
|
30
|
+
const moreIcon = `<svg
|
|
31
|
+
class="gp-ml-1 gp-inline-block"
|
|
32
|
+
style="display: inline-block; margin-left: 1px;"
|
|
33
|
+
height="1em"
|
|
34
|
+
width="1em"
|
|
35
|
+
viewBox="0 0 22 12"
|
|
36
|
+
fill="none"
|
|
37
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
38
|
+
>
|
|
39
|
+
<path
|
|
40
|
+
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"
|
|
41
|
+
fill="currentColor"
|
|
42
|
+
/>
|
|
43
|
+
</svg>`;
|
|
44
|
+
const viewMoreTextTranslate = helpers.getDynamicSourceLocales({
|
|
45
|
+
val: setting?.viewMoreText,
|
|
46
|
+
uid: builderProps?.uid,
|
|
47
|
+
settingId: 'viewMoreText',
|
|
48
|
+
isLiquid: true,
|
|
49
|
+
pageContext,
|
|
50
|
+
translate: setting?.translate
|
|
51
|
+
});
|
|
52
|
+
const viewLessTextTranslate = helpers.getDynamicSourceLocales({
|
|
53
|
+
val: setting?.viewLessText,
|
|
54
|
+
uid: builderProps?.uid,
|
|
55
|
+
settingId: 'viewLessText',
|
|
56
|
+
isLiquid: true,
|
|
57
|
+
pageContext,
|
|
58
|
+
translate: setting?.translate
|
|
59
|
+
});
|
|
9
60
|
return core.template`
|
|
10
|
-
|
|
11
|
-
styles: setting,
|
|
61
|
+
<gp-collection-description data-id="${builderProps?.uid}" class="${advanced?.cssClass} gp-collection-description" gp-data='${JSON.stringify({
|
|
12
62
|
setting: {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
63
|
+
lineClamp: setting?.lineClamp,
|
|
64
|
+
hasLineClamp: setting?.hasLineClamp,
|
|
65
|
+
viewMoreText: viewMoreTextTranslate,
|
|
66
|
+
viewLessText: viewLessTextTranslate,
|
|
67
|
+
enableViewMoreIcon: setting?.enableViewMoreIcon
|
|
68
|
+
},
|
|
69
|
+
defaultStyle,
|
|
70
|
+
collapseStyle
|
|
71
|
+
}).replaceAll("'", ''')}'
|
|
72
|
+
view-more-text="${pageContext?.isPreviewing ? viewMoreTextTranslate : `{{${viewMoreTextTranslate}}}`}"
|
|
73
|
+
view-less-text="${pageContext?.isPreviewing ? viewLessTextTranslate : `{{${viewLessTextTranslate}}}`}"
|
|
74
|
+
>
|
|
75
|
+
<div></div>
|
|
76
|
+
<div
|
|
77
|
+
data-gp-text
|
|
78
|
+
class="${core.cls('gp-relative p-description-wrapper gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre', appendTypoClass, core.getGlobalColorClass('text', setting?.color), "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")}"
|
|
79
|
+
data-gp-text
|
|
80
|
+
style="${collapseStyle}"
|
|
81
|
+
>
|
|
82
|
+
{{collection.description}}
|
|
83
|
+
</div>
|
|
84
|
+
{% if collection.description != blank -%}
|
|
85
|
+
<button
|
|
86
|
+
type="button"
|
|
87
|
+
class="p-description-show-more ${core.cls(appendTypoClass, core.getGlobalColorClass('text', setting?.showMoreColor), 'gp-mt-4 hover:gp-opacity-80 gp-transition-all gp-w-full')}"
|
|
88
|
+
style="${{
|
|
89
|
+
...core.makeStyle({
|
|
90
|
+
tt: setting?.transform
|
|
91
|
+
}),
|
|
92
|
+
...core.makeStyleResponsive('ta', setting?.textAlign),
|
|
93
|
+
...appendTypoStyle,
|
|
94
|
+
...core.getGlobalColorStyle(setting?.showMoreColor),
|
|
95
|
+
...getDisplayCollapse(),
|
|
96
|
+
position: 'absolute',
|
|
97
|
+
visibility: 'hidden'
|
|
98
|
+
}}"
|
|
99
|
+
>
|
|
100
|
+
${pageContext?.isPreviewing ? viewMoreTextTranslate : `{{${viewMoreTextTranslate}}}`}
|
|
101
|
+
${setting?.enableViewMoreIcon ? moreIcon : ''}
|
|
102
|
+
</button>
|
|
103
|
+
{%- endif -%}
|
|
104
|
+
{% style %}
|
|
105
|
+
.p-description-wrapper.gp-p-description-text * {
|
|
106
|
+
color: inherit
|
|
107
|
+
}
|
|
108
|
+
{% endstyle %}
|
|
109
|
+
</gp-collection-description>
|
|
110
|
+
${core.RenderIf(core.isLocalEnv, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-collection-description.js' | asset_url }}" defer="defer"></script>`, `<script ${helpers.getSettingPreloadData('class="gps-link" delay', 'src')}="${core.baseAssetURL}/assets-v2/gp-collection-description.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
|
|
18
111
|
`;
|
|
19
112
|
};
|
|
20
113
|
|
|
@@ -39,6 +39,59 @@ const config = {
|
|
|
39
39
|
}
|
|
40
40
|
]
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
id: 'hasLineClamp',
|
|
44
|
+
label: 'Enable View More',
|
|
45
|
+
type: 'toggle',
|
|
46
|
+
devices: {
|
|
47
|
+
desktop: {
|
|
48
|
+
default: true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'lineClamp',
|
|
54
|
+
label: 'Maximum Row(s) To Show',
|
|
55
|
+
type: 'input:number',
|
|
56
|
+
min: 1,
|
|
57
|
+
hide: true,
|
|
58
|
+
devices: {
|
|
59
|
+
desktop: {
|
|
60
|
+
default: 12
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: 'viewMoreText',
|
|
66
|
+
label: 'View More Text',
|
|
67
|
+
type: 'input',
|
|
68
|
+
default: 'Show more',
|
|
69
|
+
hide: true
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
id: 'showMoreColor',
|
|
73
|
+
type: 'colorpicker',
|
|
74
|
+
default: 'text-1'
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: 'viewLessText',
|
|
78
|
+
label: 'View Less Text',
|
|
79
|
+
type: 'input',
|
|
80
|
+
default: 'Show less',
|
|
81
|
+
hide: true
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: 'enableViewMoreIcon',
|
|
85
|
+
label: 'Enable Icon',
|
|
86
|
+
type: 'toggle',
|
|
87
|
+
default: true,
|
|
88
|
+
hide: true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'translate',
|
|
92
|
+
type: 'input',
|
|
93
|
+
default: 'viewLessText,viewMoreText'
|
|
94
|
+
},
|
|
42
95
|
{
|
|
43
96
|
id: 'textAlign',
|
|
44
97
|
label: 'Align',
|
|
@@ -74,11 +127,86 @@ const config = {
|
|
|
74
127
|
default: 'center'
|
|
75
128
|
}
|
|
76
129
|
}
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
id: 'color',
|
|
133
|
+
type: 'colorpicker',
|
|
134
|
+
default: 'text-1'
|
|
77
135
|
}
|
|
78
136
|
]
|
|
79
137
|
}
|
|
80
138
|
],
|
|
81
139
|
ui: [
|
|
140
|
+
{
|
|
141
|
+
type: 'group',
|
|
142
|
+
label: {
|
|
143
|
+
en: ''
|
|
144
|
+
},
|
|
145
|
+
controls: [
|
|
146
|
+
{
|
|
147
|
+
type: 'control',
|
|
148
|
+
label: {
|
|
149
|
+
en: 'Show more'
|
|
150
|
+
},
|
|
151
|
+
options: {
|
|
152
|
+
label: 'large'
|
|
153
|
+
},
|
|
154
|
+
setting: {
|
|
155
|
+
id: 'hasLineClamp'
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
type: 'control',
|
|
160
|
+
label: {
|
|
161
|
+
en: 'Text color'
|
|
162
|
+
},
|
|
163
|
+
setting: {
|
|
164
|
+
id: 'showMoreColor'
|
|
165
|
+
},
|
|
166
|
+
condition: 'hasLineClamp == true'
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
type: 'control',
|
|
170
|
+
label: {
|
|
171
|
+
en: 'Max lines'
|
|
172
|
+
},
|
|
173
|
+
setting: {
|
|
174
|
+
id: 'lineClamp'
|
|
175
|
+
},
|
|
176
|
+
condition: 'hasLineClamp == true'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
type: 'control',
|
|
180
|
+
label: {
|
|
181
|
+
en: 'Show more label'
|
|
182
|
+
},
|
|
183
|
+
setting: {
|
|
184
|
+
id: 'viewMoreText'
|
|
185
|
+
},
|
|
186
|
+
condition: 'hasLineClamp == true'
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
type: 'control',
|
|
190
|
+
label: {
|
|
191
|
+
en: 'Show less label'
|
|
192
|
+
},
|
|
193
|
+
setting: {
|
|
194
|
+
id: 'viewLessText'
|
|
195
|
+
},
|
|
196
|
+
condition: 'hasLineClamp == true'
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
type: 'control',
|
|
200
|
+
label: {
|
|
201
|
+
en: 'Icon'
|
|
202
|
+
},
|
|
203
|
+
setting: {
|
|
204
|
+
id: 'enableViewMoreIcon'
|
|
205
|
+
},
|
|
206
|
+
condition: 'hasLineClamp == true'
|
|
207
|
+
}
|
|
208
|
+
]
|
|
209
|
+
},
|
|
82
210
|
{
|
|
83
211
|
label: {
|
|
84
212
|
en: 'Text'
|
package/dist/cjs/index.js
CHANGED
|
@@ -207,6 +207,18 @@ var TrustreviewsProductReviews = require('./third-party/components/TrustreviewsP
|
|
|
207
207
|
var MyappgurusProductReviews = require('./third-party/components/MyappgurusProductReviews.js');
|
|
208
208
|
var HulkProductOptions = require('./third-party/components/HulkProductOptions.js');
|
|
209
209
|
var TrustshopProductReviews = require('./third-party/components/TrustshopProductReviews.js');
|
|
210
|
+
var StellarDeliveryDatePickup = require('./third-party/components/StellarDeliveryDatePickup.js');
|
|
211
|
+
var EssentialCountdownTimerBar = require('./third-party/components/EssentialCountdownTimerBar.js');
|
|
212
|
+
var EssentialAnnouncementBar = require('./third-party/components/EssentialAnnouncementBar.js');
|
|
213
|
+
var OkendoReviewsLoyalty = require('./third-party/components/OkendoReviewsLoyalty.js');
|
|
214
|
+
var EstimatedDeliveryDatePlus = require('./third-party/components/EstimatedDeliveryDatePlus.js');
|
|
215
|
+
var HextomCountdownTimerBar = require('./third-party/components/HextomCountdownTimerBar.js');
|
|
216
|
+
var TrustBadgesBear = require('./third-party/components/TrustBadgesBear.js');
|
|
217
|
+
var TrustedsiteTrustBadges = require('./third-party/components/TrustedsiteTrustBadges.js');
|
|
218
|
+
var GloColorSwatchvariantImage = require('./third-party/components/GloColorSwatchvariantImage.js');
|
|
219
|
+
var BfSizeChartSizeGuide = require('./third-party/components/BfSizeChartSizeGuide.js');
|
|
220
|
+
var AlsoBoughtCbb = require('./third-party/components/AlsoBoughtCbb.js');
|
|
221
|
+
var HextomFreeShippingBar = require('./third-party/components/HextomFreeShippingBar.js');
|
|
210
222
|
var index$x = require('./third-party-instant/setting/index.js');
|
|
211
223
|
var InstantJudgemeReviews = require('./third-party-instant/components/InstantJudgemeReviews.js');
|
|
212
224
|
var InstantLooxReviews = require('./third-party-instant/components/InstantLooxReviews.js');
|
|
@@ -509,6 +521,18 @@ exports.TrustreviewsProductReviews = TrustreviewsProductReviews.default;
|
|
|
509
521
|
exports.MyappgurusProductReviews = MyappgurusProductReviews.default;
|
|
510
522
|
exports.HulkProductOptions = HulkProductOptions.default;
|
|
511
523
|
exports.TrustshopProductReviews = TrustshopProductReviews.default;
|
|
524
|
+
exports.StellarDeliveryDatePickup = StellarDeliveryDatePickup.default;
|
|
525
|
+
exports.EssentialCountdownTimerBar = EssentialCountdownTimerBar.default;
|
|
526
|
+
exports.EssentialAnnouncementBar = EssentialAnnouncementBar.default;
|
|
527
|
+
exports.OkendoReviewsLoyalty = OkendoReviewsLoyalty.default;
|
|
528
|
+
exports.EstimatedDeliveryDatePlus = EstimatedDeliveryDatePlus.default;
|
|
529
|
+
exports.HextomCountdownTimerBar = HextomCountdownTimerBar.default;
|
|
530
|
+
exports.TrustBadgesBear = TrustBadgesBear.default;
|
|
531
|
+
exports.TrustedsiteTrustBadges = TrustedsiteTrustBadges.default;
|
|
532
|
+
exports.GloColorSwatchvariantImage = GloColorSwatchvariantImage.default;
|
|
533
|
+
exports.BfSizeChartSizeGuide = BfSizeChartSizeGuide.default;
|
|
534
|
+
exports.AlsoBoughtCbb = AlsoBoughtCbb.default;
|
|
535
|
+
exports.HextomFreeShippingBar = HextomFreeShippingBar.default;
|
|
512
536
|
exports.thirdPartyInstantSetting = index$x.default;
|
|
513
537
|
exports.InstantJudgemeReviews = InstantJudgemeReviews.default;
|
|
514
538
|
exports.InstantLooxReviews = InstantLooxReviews.default;
|
package/dist/cjs/index.liquid.js
CHANGED
|
@@ -162,6 +162,18 @@ var TrustreviewsProductReviews_liquid = require('./third-party/components/Trustr
|
|
|
162
162
|
var MyappgurusProductReviews_liquid = require('./third-party/components/MyappgurusProductReviews.liquid.js');
|
|
163
163
|
var HulkProductOptions_liquid = require('./third-party/components/HulkProductOptions.liquid.js');
|
|
164
164
|
var TrustshopProductReviews_liquid = require('./third-party/components/TrustshopProductReviews.liquid.js');
|
|
165
|
+
var StellarDeliveryDatePickup_liquid = require('./third-party/components/StellarDeliveryDatePickup.liquid.js');
|
|
166
|
+
var EssentialCountdownTimerBar_liquid = require('./third-party/components/EssentialCountdownTimerBar.liquid.js');
|
|
167
|
+
var EssentialAnnouncementBar_liquid = require('./third-party/components/EssentialAnnouncementBar.liquid.js');
|
|
168
|
+
var OkendoReviewsLoyalty_liquid = require('./third-party/components/OkendoReviewsLoyalty.liquid.js');
|
|
169
|
+
var EstimatedDeliveryDatePlus_liquid = require('./third-party/components/EstimatedDeliveryDatePlus.liquid.js');
|
|
170
|
+
var HextomCountdownTimerBar_liquid = require('./third-party/components/HextomCountdownTimerBar.liquid.js');
|
|
171
|
+
var TrustBadgesBear_liquid = require('./third-party/components/TrustBadgesBear.liquid.js');
|
|
172
|
+
var TrustedsiteTrustBadges_liquid = require('./third-party/components/TrustedsiteTrustBadges.liquid.js');
|
|
173
|
+
var GloColorSwatchvariantImage_liquid = require('./third-party/components/GloColorSwatchvariantImage.liquid.js');
|
|
174
|
+
var BfSizeChartSizeGuide_liquid = require('./third-party/components/BfSizeChartSizeGuide.liquid.js');
|
|
175
|
+
var AlsoBoughtCbb_liquid = require('./third-party/components/AlsoBoughtCbb.liquid.js');
|
|
176
|
+
var HextomFreeShippingBar_liquid = require('./third-party/components/HextomFreeShippingBar.liquid.js');
|
|
165
177
|
var ImageComparison_liquid = require('./image-comparison/components/ImageComparison.liquid.js');
|
|
166
178
|
var ThirdPartySlot_liquid = require('./third-party-slot/components/ThirdPartySlot.liquid.js');
|
|
167
179
|
var Sticky_liquid = require('./sticky/components/Sticky.liquid.js');
|
|
@@ -346,6 +358,18 @@ exports.TrustreviewsProductReviews = TrustreviewsProductReviews_liquid.default;
|
|
|
346
358
|
exports.MyappgurusProductReviews = MyappgurusProductReviews_liquid.default;
|
|
347
359
|
exports.HulkProductOptions = HulkProductOptions_liquid.default;
|
|
348
360
|
exports.TrustshopProductReviews = TrustshopProductReviews_liquid.default;
|
|
361
|
+
exports.StellarDeliveryDatePickup = StellarDeliveryDatePickup_liquid.default;
|
|
362
|
+
exports.EssentialCountdownTimerBar = EssentialCountdownTimerBar_liquid.default;
|
|
363
|
+
exports.EssentialAnnouncementBar = EssentialAnnouncementBar_liquid.default;
|
|
364
|
+
exports.OkendoReviewsLoyalty = OkendoReviewsLoyalty_liquid.default;
|
|
365
|
+
exports.EstimatedDeliveryDatePlus = EstimatedDeliveryDatePlus_liquid.default;
|
|
366
|
+
exports.HextomCountdownTimerBar = HextomCountdownTimerBar_liquid.default;
|
|
367
|
+
exports.TrustBadgesBear = TrustBadgesBear_liquid.default;
|
|
368
|
+
exports.TrustedsiteTrustBadges = TrustedsiteTrustBadges_liquid.default;
|
|
369
|
+
exports.GloColorSwatchvariantImage = GloColorSwatchvariantImage_liquid.default;
|
|
370
|
+
exports.BfSizeChartSizeGuide = BfSizeChartSizeGuide_liquid.default;
|
|
371
|
+
exports.AlsoBoughtCbb = AlsoBoughtCbb_liquid.default;
|
|
372
|
+
exports.HextomFreeShippingBar = HextomFreeShippingBar_liquid.default;
|
|
349
373
|
exports.ImageComparison = ImageComparison_liquid.default;
|
|
350
374
|
exports.ThirdPartySlot = ThirdPartySlot_liquid.default;
|
|
351
375
|
exports.Sticky = Sticky_liquid.default;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var _const = require('./const.js');
|
|
5
|
+
|
|
6
|
+
const getMaxHeightStyleDefault = (setting)=>{
|
|
7
|
+
let result = {
|
|
8
|
+
desktop: 'none'
|
|
9
|
+
};
|
|
10
|
+
const devices = [
|
|
11
|
+
'desktop',
|
|
12
|
+
'mobile',
|
|
13
|
+
'tablet'
|
|
14
|
+
];
|
|
15
|
+
devices.forEach((device)=>{
|
|
16
|
+
const lineClamp = core.getResponsiveValueByScreen(setting?.lineClamp, device);
|
|
17
|
+
const hasLineClamp = core.getResponsiveValueByScreen(setting?.hasLineClamp, device);
|
|
18
|
+
const maxHeight = hasLineClamp && lineClamp ? `${lineClamp * _const.DESCRIPTION_LINE_HEIGHT_DEFAULT}px` : 'none';
|
|
19
|
+
result = {
|
|
20
|
+
...result,
|
|
21
|
+
[device]: maxHeight
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
const style = core.makeStyleResponsive('maxh', result);
|
|
25
|
+
return style;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
exports.getMaxHeightStyleDefault = getMaxHeightStyleDefault;
|
|
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var core = require('@gem-sdk/core');
|
|
7
7
|
var React = require('react');
|
|
8
|
+
var common = require('./ProductDescription/common.js');
|
|
9
|
+
var _const = require('./ProductDescription/const.js');
|
|
8
10
|
|
|
9
11
|
const ProductDescription = ({ setting, builderProps })=>{
|
|
10
12
|
const [open, setOpen] = React.useState(false);
|
|
@@ -18,14 +20,18 @@ const ProductDescription = ({ setting, builderProps })=>{
|
|
|
18
20
|
React.useEffect(()=>{
|
|
19
21
|
const dom = ref.current;
|
|
20
22
|
setOpen(false);
|
|
21
|
-
if (dom
|
|
23
|
+
if (!dom) return;
|
|
24
|
+
const enableShowMore = hasLineClamp && product?.descriptionHtml;
|
|
25
|
+
if (!enableShowMore) dom.style.maxHeight = 'none';
|
|
26
|
+
else {
|
|
22
27
|
const value = lineClamp;
|
|
23
28
|
setTimeout(()=>{
|
|
24
29
|
const scrollHeight = dom?.scrollHeight ?? 0;
|
|
25
30
|
const clientHeight = dom?.clientHeight ?? 0;
|
|
26
|
-
const lineHeight =
|
|
27
|
-
const lineText = Math.round((scrollHeight ?? 0) /
|
|
28
|
-
|
|
31
|
+
const lineHeight = getLineHeightFromDom();
|
|
32
|
+
const lineText = Math.round((scrollHeight ?? 0) / lineHeight);
|
|
33
|
+
dom.style.maxHeight = getMaxHeight(lineHeight);
|
|
34
|
+
const conditionCheckLine = value && value < lineText || clientHeight < scrollHeight;
|
|
29
35
|
if (value && conditionCheckLine) {
|
|
30
36
|
allowShowViewMore(()=>true);
|
|
31
37
|
} else {
|
|
@@ -36,8 +42,19 @@ const ProductDescription = ({ setting, builderProps })=>{
|
|
|
36
42
|
}, [
|
|
37
43
|
hasLineClamp,
|
|
38
44
|
lineClamp,
|
|
39
|
-
product?.description
|
|
45
|
+
product?.description,
|
|
46
|
+
core.isSafari
|
|
40
47
|
]);
|
|
48
|
+
const getLineHeightFromDom = ()=>{
|
|
49
|
+
if (!ref.current) return _const.DESCRIPTION_LINE_HEIGHT_DEFAULT;
|
|
50
|
+
const lineHeight = window.getComputedStyle(ref.current).getPropertyValue('line-height');
|
|
51
|
+
return parseInt(lineHeight);
|
|
52
|
+
};
|
|
53
|
+
const getMaxHeight = (lineHeight)=>{
|
|
54
|
+
if (!hasLineClamp || !lineClamp) return 'auto';
|
|
55
|
+
if (lineHeight) return `${lineClamp * lineHeight}px`;
|
|
56
|
+
return 'auto';
|
|
57
|
+
};
|
|
41
58
|
const Tag = htmlTag === 'html' ? 'div' : 'p';
|
|
42
59
|
const appendTypoClass = core.composeTypographyClassName(setting?.typo, setting?.typography);
|
|
43
60
|
const appendTypoStyle = core.composeTypographyStyle(setting?.typo, setting?.typography);
|
|
@@ -54,7 +71,17 @@ const ProductDescription = ({ setting, builderProps })=>{
|
|
|
54
71
|
}
|
|
55
72
|
`;
|
|
56
73
|
const DescriptionNotFoundString = 'This product does not have a description';
|
|
57
|
-
const
|
|
74
|
+
const noDescriptionHtml = !product?.descriptionHtml;
|
|
75
|
+
const handleToggleShowMore = ()=>{
|
|
76
|
+
if (!ref.current) return;
|
|
77
|
+
const lineHeight = getLineHeightFromDom();
|
|
78
|
+
if (open) {
|
|
79
|
+
ref.current.style.maxHeight = getMaxHeight(lineHeight);
|
|
80
|
+
} else {
|
|
81
|
+
ref.current.style.maxHeight = 'none';
|
|
82
|
+
}
|
|
83
|
+
setOpen((prev)=>!prev);
|
|
84
|
+
};
|
|
58
85
|
return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
59
86
|
children: !product ? null : /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
60
87
|
"data-id": builderProps?.uid,
|
|
@@ -65,7 +92,7 @@ const ProductDescription = ({ setting, builderProps })=>{
|
|
|
65
92
|
/*#__PURE__*/ jsxRuntime.jsx(Tag, {
|
|
66
93
|
ref: ref,
|
|
67
94
|
"data-gp-text": true,
|
|
68
|
-
className: core.cls('gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre', appendTypoClass,
|
|
95
|
+
className: core.cls('gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre', appendTypoClass, noDescriptionHtml ? 'gp-p-2 gp-text-center gp-text-sm gp-font-semibold gp-text-gray-500 gp-py-2 !gp-text-center' : '', core.getGlobalColorClass('text', setting?.color)),
|
|
69
96
|
style: {
|
|
70
97
|
...core.getStyleShadow({
|
|
71
98
|
value: setting?.textShadow,
|
|
@@ -77,10 +104,11 @@ const ProductDescription = ({ setting, builderProps })=>{
|
|
|
77
104
|
...core.makeStyle({
|
|
78
105
|
tt: setting?.transform
|
|
79
106
|
}),
|
|
80
|
-
...appendTypoStyle
|
|
107
|
+
...appendTypoStyle,
|
|
108
|
+
...common.getMaxHeightStyleDefault(setting)
|
|
81
109
|
},
|
|
82
110
|
dangerouslySetInnerHTML: {
|
|
83
|
-
__html: product?.descriptionHtml
|
|
111
|
+
__html: product?.descriptionHtml || `${DescriptionNotFoundString}`
|
|
84
112
|
}
|
|
85
113
|
}),
|
|
86
114
|
hasLineClamp && isShowViewMore && /*#__PURE__*/ jsxRuntime.jsxs("button", {
|
|
@@ -93,7 +121,7 @@ const ProductDescription = ({ setting, builderProps })=>{
|
|
|
93
121
|
...appendTypoStyle,
|
|
94
122
|
...core.getGlobalColorStyle(setting?.showMoreColor)
|
|
95
123
|
},
|
|
96
|
-
onClick:
|
|
124
|
+
onClick: handleToggleShowMore,
|
|
97
125
|
children: [
|
|
98
126
|
!open ? setting?.viewMoreText : setting?.viewLessText,
|
|
99
127
|
setting?.enableViewMoreIcon && /*#__PURE__*/ jsxRuntime.jsx("svg", {
|