@gem-sdk/components 2.0.0-staging.139 → 2.0.0-staging.140
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/carousel/components/CarouselItem.js +6 -5
- package/dist/cjs/carousel/components/CarouselItem.liquid.js +6 -5
- package/dist/cjs/helpers.js +4 -1
- package/dist/cjs/icon-list-v2/components/IconList.liquid.js +3 -7
- package/dist/cjs/text/components/Text.liquid.js +3 -6
- package/dist/esm/carousel/components/CarouselItem.js +7 -6
- package/dist/esm/carousel/components/CarouselItem.liquid.js +7 -6
- package/dist/esm/helpers.js +4 -1
- package/dist/esm/icon-list-v2/components/IconList.liquid.js +4 -8
- package/dist/esm/text/components/Text.liquid.js +3 -6
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
|
@@ -42,6 +42,11 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
42
42
|
parentStyle,
|
|
43
43
|
passProps.style
|
|
44
44
|
]);
|
|
45
|
+
const itemShadowStyle = core.getStyleShadow({
|
|
46
|
+
value: parentStyle?.carouselShadow,
|
|
47
|
+
styleAppliedFor: 'box-shadow',
|
|
48
|
+
isEnableShadow: parentStyle?.hasActiveShadow
|
|
49
|
+
});
|
|
45
50
|
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
46
51
|
...builderAttrs,
|
|
47
52
|
...passProps,
|
|
@@ -68,11 +73,7 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
68
73
|
"aria-hidden": true,
|
|
69
74
|
children: /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
70
75
|
style: {
|
|
71
|
-
...
|
|
72
|
-
value: parentStyle?.carouselShadow,
|
|
73
|
-
styleAppliedFor: 'box-shadow',
|
|
74
|
-
isEnableShadow: parentStyle?.hasActiveShadow
|
|
75
|
-
})
|
|
76
|
+
...itemShadowStyle
|
|
76
77
|
},
|
|
77
78
|
children: core.isEmptyChildren(children) ? /*#__PURE__*/ jsxRuntime.jsx(ChildrenDroppable.default, {}) : children
|
|
78
79
|
})
|
|
@@ -31,6 +31,11 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
31
31
|
})
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
+
const itemShadowStyle = core.getStyleShadow({
|
|
35
|
+
value: parentStyle?.carouselShadow,
|
|
36
|
+
styleAppliedFor: 'box-shadow',
|
|
37
|
+
isEnableShadow: parentStyle?.hasActiveShadow
|
|
38
|
+
});
|
|
34
39
|
return core.template`
|
|
35
40
|
<div
|
|
36
41
|
media-type="{{media.media_type}}"
|
|
@@ -78,11 +83,7 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
78
83
|
>
|
|
79
84
|
<div
|
|
80
85
|
style="${{
|
|
81
|
-
...
|
|
82
|
-
value: parentStyle?.carouselShadow,
|
|
83
|
-
styleAppliedFor: 'box-shadow',
|
|
84
|
-
isEnableShadow: parentStyle?.hasActiveShadow
|
|
85
|
-
})
|
|
86
|
+
...itemShadowStyle
|
|
86
87
|
}}"
|
|
87
88
|
>
|
|
88
89
|
${children}
|
package/dist/cjs/helpers.js
CHANGED
|
@@ -34,7 +34,7 @@ const isHexTransparent = (hex)=>{
|
|
|
34
34
|
return Boolean(a);
|
|
35
35
|
};
|
|
36
36
|
const youtubeShortsRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([^"&?/\s]{11})$/i;
|
|
37
|
-
const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate })=>{
|
|
37
|
+
const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin })=>{
|
|
38
38
|
const hasLiquidInValue = new RegExp(/\{\{.*?\}\}|\{%.*?%\}/).test(val?.toString() ?? '');
|
|
39
39
|
const translateLimit = pageContext?.isTranslateWithLocale ? 1000 : 5000;
|
|
40
40
|
if (!translate || !val?.toString().trim() || val.toString().length > translateLimit || hasLiquidInValue || pageContext?.isPreviewing) return val ?? defaultVal;
|
|
@@ -43,6 +43,9 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, i
|
|
|
43
43
|
if (pageContext?.isTranslateWithLocale) {
|
|
44
44
|
locale = `'sections.${pageContext.sectionName}.${translateKey}_html' | t`;
|
|
45
45
|
}
|
|
46
|
+
if (isReplaceLocationOrigin) {
|
|
47
|
+
locale += ` | replace: '$locationOrigin', locationOrigin`;
|
|
48
|
+
}
|
|
46
49
|
if (isCapitalize) {
|
|
47
50
|
locale = `${locale} | downcase`;
|
|
48
51
|
}
|
|
@@ -44,18 +44,14 @@ const IconListV2 = ({ builderProps, style, setting, styles, advanced, pageContex
|
|
|
44
44
|
...core.makeStyleResponsive('rg', verticalSpacing)
|
|
45
45
|
}}">
|
|
46
46
|
${valueMap?.map((node, key)=>{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
val: value,
|
|
47
|
+
const textVal = helpers.getDynamicSourceLocales({
|
|
48
|
+
val: childItem?.[key],
|
|
50
49
|
uid: builderProps?.uid,
|
|
51
50
|
settingId: `childItem_${key}`,
|
|
52
51
|
pageContext,
|
|
53
52
|
translate,
|
|
54
|
-
|
|
53
|
+
isReplaceLocationOrigin: true
|
|
55
54
|
});
|
|
56
|
-
if (!pageContext?.isPreviewing) {
|
|
57
|
-
textVal = `{{ ${textVal} | replace: '$locationOrigin', locationOrigin }}`;
|
|
58
|
-
}
|
|
59
55
|
return core.template`
|
|
60
56
|
<div
|
|
61
57
|
class="gp-icon-list-wrapper gp-flex gp-child-item-${builderProps?.uid}"
|
|
@@ -22,22 +22,19 @@ const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, cl
|
|
|
22
22
|
'Heading',
|
|
23
23
|
'Text'
|
|
24
24
|
].includes(builderProps?.builderData?.tag ?? '') && !pageContext?.isPreviewing;
|
|
25
|
-
const renderText = helpers.replaceLinkData(text?.toString()
|
|
25
|
+
const renderText = helpers.replaceLinkData(text?.toString());
|
|
26
26
|
if (isForceValue) {
|
|
27
27
|
displayText = renderText;
|
|
28
28
|
} else if (setting?.translate) {
|
|
29
29
|
displayText = helpers.getDynamicSourceLocales({
|
|
30
|
-
val:
|
|
30
|
+
val: text,
|
|
31
31
|
uid: builderProps?.uid,
|
|
32
32
|
settingId: setting?.translate,
|
|
33
33
|
pageContext,
|
|
34
34
|
isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
|
|
35
35
|
translate: setting.translate,
|
|
36
|
-
|
|
36
|
+
isReplaceLocationOrigin: isViewliveHeadingOrTextComponent
|
|
37
37
|
});
|
|
38
|
-
if (isViewliveHeadingOrTextComponent) {
|
|
39
|
-
displayText = `{{ ${displayText} | replace: '$locationOrigin', locationOrigin }}`;
|
|
40
|
-
}
|
|
41
38
|
} else {
|
|
42
39
|
displayText = styles?.typo?.attrs?.transform === 'capitalize' ? renderText?.toString().toLocaleLowerCase() : renderText;
|
|
43
40
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { makeGlobalSize, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, cls, getStyleBackgroundByDevice,
|
|
3
|
+
import { makeGlobalSize, makeStyle, getSingleColorVariable, getRadiusStyleActiveState, getStyleShadow, cls, getStyleBackgroundByDevice, isEmptyChildren } from '@gem-sdk/core';
|
|
4
4
|
import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
|
|
5
5
|
import { useMemo } from 'react';
|
|
6
6
|
import { getInitialWidthForCarouselItem } from './common/carousel.js';
|
|
@@ -38,6 +38,11 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
38
38
|
parentStyle,
|
|
39
39
|
passProps.style
|
|
40
40
|
]);
|
|
41
|
+
const itemShadowStyle = getStyleShadow({
|
|
42
|
+
value: parentStyle?.carouselShadow,
|
|
43
|
+
styleAppliedFor: 'box-shadow',
|
|
44
|
+
isEnableShadow: parentStyle?.hasActiveShadow
|
|
45
|
+
});
|
|
41
46
|
return /*#__PURE__*/ jsx("div", {
|
|
42
47
|
...builderAttrs,
|
|
43
48
|
...passProps,
|
|
@@ -64,11 +69,7 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
64
69
|
"aria-hidden": true,
|
|
65
70
|
children: /*#__PURE__*/ jsx("div", {
|
|
66
71
|
style: {
|
|
67
|
-
...
|
|
68
|
-
value: parentStyle?.carouselShadow,
|
|
69
|
-
styleAppliedFor: 'box-shadow',
|
|
70
|
-
isEnableShadow: parentStyle?.hasActiveShadow
|
|
71
|
-
})
|
|
72
|
+
...itemShadowStyle
|
|
72
73
|
},
|
|
73
74
|
children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
|
|
74
75
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeGlobalSize, template, getStyleBackgroundByDevice, makeStyleResponsive, cls,
|
|
1
|
+
import { makeGlobalSize, getStyleShadow, template, getStyleBackgroundByDevice, makeStyleResponsive, cls, makeStyle, getSingleColorVariable, getRadiusStyleActiveState } from '@gem-sdk/core';
|
|
2
2
|
import { getInitialWidthForCarouselItem, getCarouselSneakPeakTranslate } from './common/carousel.js';
|
|
3
3
|
|
|
4
4
|
const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, builderProps, style, className, parentId, parentStyle, parentSettings, background, index, customStyle, parentUid, contentType = 'normalItem', ...passProps })=>{
|
|
@@ -27,6 +27,11 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
27
27
|
})
|
|
28
28
|
};
|
|
29
29
|
};
|
|
30
|
+
const itemShadowStyle = getStyleShadow({
|
|
31
|
+
value: parentStyle?.carouselShadow,
|
|
32
|
+
styleAppliedFor: 'box-shadow',
|
|
33
|
+
isEnableShadow: parentStyle?.hasActiveShadow
|
|
34
|
+
});
|
|
30
35
|
return template`
|
|
31
36
|
<div
|
|
32
37
|
media-type="{{media.media_type}}"
|
|
@@ -74,11 +79,7 @@ const CarouselItem = ({ children, builderAttrs, styles, advanced, setting, build
|
|
|
74
79
|
>
|
|
75
80
|
<div
|
|
76
81
|
style="${{
|
|
77
|
-
...
|
|
78
|
-
value: parentStyle?.carouselShadow,
|
|
79
|
-
styleAppliedFor: 'box-shadow',
|
|
80
|
-
isEnableShadow: parentStyle?.hasActiveShadow
|
|
81
|
-
})
|
|
82
|
+
...itemShadowStyle
|
|
82
83
|
}}"
|
|
83
84
|
>
|
|
84
85
|
${children}
|
package/dist/esm/helpers.js
CHANGED
|
@@ -32,7 +32,7 @@ const isHexTransparent = (hex)=>{
|
|
|
32
32
|
return Boolean(a);
|
|
33
33
|
};
|
|
34
34
|
const youtubeShortsRegex = /^(?:https?:\/\/)?(?:www\.)?youtube\.com\/shorts\/([^"&?/\s]{11})$/i;
|
|
35
|
-
const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate })=>{
|
|
35
|
+
const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal = '', translate, isReplaceLocationOrigin })=>{
|
|
36
36
|
const hasLiquidInValue = new RegExp(/\{\{.*?\}\}|\{%.*?%\}/).test(val?.toString() ?? '');
|
|
37
37
|
const translateLimit = pageContext?.isTranslateWithLocale ? 1000 : 5000;
|
|
38
38
|
if (!translate || !val?.toString().trim() || val.toString().length > translateLimit || hasLiquidInValue || pageContext?.isPreviewing) return val ?? defaultVal;
|
|
@@ -41,6 +41,9 @@ const getDynamicSourceLocales = ({ val, uid, settingId, isLiquid, pageContext, i
|
|
|
41
41
|
if (pageContext?.isTranslateWithLocale) {
|
|
42
42
|
locale = `'sections.${pageContext.sectionName}.${translateKey}_html' | t`;
|
|
43
43
|
}
|
|
44
|
+
if (isReplaceLocationOrigin) {
|
|
45
|
+
locale += ` | replace: '$locationOrigin', locationOrigin`;
|
|
46
|
+
}
|
|
44
47
|
if (isCapitalize) {
|
|
45
48
|
locale = `${locale} | downcase`;
|
|
46
49
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeGlobalSize, composeTypographyStyle, composeTypographyClassName, template, dataStringify, getStyleBackgroundByDevice, RenderIf, makeStyleResponsive, makeStyle, getSingleColorVariable, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
|
-
import { getStaticLocale,
|
|
2
|
+
import { getStaticLocale, getDynamicSourceLocales, getSettingPreloadData } from '../../helpers.js';
|
|
3
3
|
|
|
4
4
|
const IconListV2 = ({ builderProps, style, setting, styles, advanced, pageContext })=>{
|
|
5
5
|
const { childItem, childConfig, iconType, iconSvg, iconWidth, globalSize, textTypo, translate } = setting ?? {};
|
|
@@ -40,18 +40,14 @@ const IconListV2 = ({ builderProps, style, setting, styles, advanced, pageContex
|
|
|
40
40
|
...makeStyleResponsive('rg', verticalSpacing)
|
|
41
41
|
}}">
|
|
42
42
|
${valueMap?.map((node, key)=>{
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
val: value,
|
|
43
|
+
const textVal = getDynamicSourceLocales({
|
|
44
|
+
val: childItem?.[key],
|
|
46
45
|
uid: builderProps?.uid,
|
|
47
46
|
settingId: `childItem_${key}`,
|
|
48
47
|
pageContext,
|
|
49
48
|
translate,
|
|
50
|
-
|
|
49
|
+
isReplaceLocationOrigin: true
|
|
51
50
|
});
|
|
52
|
-
if (!pageContext?.isPreviewing) {
|
|
53
|
-
textVal = `{{ ${textVal} | replace: '$locationOrigin', locationOrigin }}`;
|
|
54
|
-
}
|
|
55
51
|
return template`
|
|
56
52
|
<div
|
|
57
53
|
class="gp-icon-list-wrapper gp-flex gp-child-item-${builderProps?.uid}"
|
|
@@ -18,22 +18,19 @@ const Text = ({ styles, builderAttrs, style, setting, advanced, builderProps, cl
|
|
|
18
18
|
'Heading',
|
|
19
19
|
'Text'
|
|
20
20
|
].includes(builderProps?.builderData?.tag ?? '') && !pageContext?.isPreviewing;
|
|
21
|
-
const renderText = replaceLinkData(text?.toString()
|
|
21
|
+
const renderText = replaceLinkData(text?.toString());
|
|
22
22
|
if (isForceValue) {
|
|
23
23
|
displayText = renderText;
|
|
24
24
|
} else if (setting?.translate) {
|
|
25
25
|
displayText = getDynamicSourceLocales({
|
|
26
|
-
val:
|
|
26
|
+
val: text,
|
|
27
27
|
uid: builderProps?.uid,
|
|
28
28
|
settingId: setting?.translate,
|
|
29
29
|
pageContext,
|
|
30
30
|
isCapitalize: styles?.typo?.attrs?.transform === 'capitalize',
|
|
31
31
|
translate: setting.translate,
|
|
32
|
-
|
|
32
|
+
isReplaceLocationOrigin: isViewliveHeadingOrTextComponent
|
|
33
33
|
});
|
|
34
|
-
if (isViewliveHeadingOrTextComponent) {
|
|
35
|
-
displayText = `{{ ${displayText} | replace: '$locationOrigin', locationOrigin }}`;
|
|
36
|
-
}
|
|
37
34
|
} else {
|
|
38
35
|
displayText = styles?.typo?.attrs?.transform === 'capitalize' ? renderText?.toString().toLocaleLowerCase() : renderText;
|
|
39
36
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -7831,12 +7831,13 @@ type DynamicSource = {
|
|
|
7831
7831
|
isCapitalize?: boolean;
|
|
7832
7832
|
defaultVal?: string;
|
|
7833
7833
|
translate?: string;
|
|
7834
|
+
isReplaceLocationOrigin?: boolean;
|
|
7834
7835
|
};
|
|
7835
7836
|
declare const isTransparentColor: (str?: string) => boolean;
|
|
7836
7837
|
declare const isTransparentRGBA: (rgbStr: string) => boolean;
|
|
7837
7838
|
declare const isHexTransparent: (hex: string) => boolean;
|
|
7838
7839
|
declare const youtubeShortsRegex: RegExp;
|
|
7839
|
-
declare const getDynamicSourceLocales: ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal, translate, }: DynamicSource) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
|
|
7840
|
+
declare const getDynamicSourceLocales: ({ val, uid, settingId, isLiquid, pageContext, isCapitalize, defaultVal, translate, isReplaceLocationOrigin, }: DynamicSource) => string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode>;
|
|
7840
7841
|
declare const getStaticLocale: (tag: string, key: string) => string;
|
|
7841
7842
|
declare const getSettingPreloadData: (disabledValue: string, enabledValue?: string) => string;
|
|
7842
7843
|
declare const getInsertLinkData: (defaultWrap: string, setting?: {
|