@gem-sdk/components 2.1.3 → 2.1.5
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/ArticleDate.js +2 -2
- package/dist/cjs/article/components/ArticleDate.liquid.js +1 -1
- package/dist/cjs/article/components/ArticleList.js +1 -1
- package/dist/cjs/dialog/components/Dialog.js +1 -13
- package/dist/cjs/dialog/components/Dialog.liquid.js +1 -13
- package/dist/cjs/dialog/helpers/common.js +30 -0
- package/dist/cjs/stock-counter/components/StockCounter.liquid.js +1 -1
- package/dist/cjs/third-party/components/BoldSubscriptions.liquid.js +1 -1
- package/dist/esm/article/components/ArticleDate.js +2 -2
- package/dist/esm/article/components/ArticleDate.liquid.js +1 -1
- package/dist/esm/article/components/ArticleList.js +1 -1
- package/dist/esm/dialog/components/Dialog.js +2 -14
- package/dist/esm/dialog/components/Dialog.liquid.js +2 -14
- package/dist/esm/dialog/helpers/common.js +30 -1
- package/dist/esm/stock-counter/components/StockCounter.liquid.js +1 -1
- package/dist/esm/third-party/components/BoldSubscriptions.liquid.js +1 -1
- package/package.json +2 -2
|
@@ -18,11 +18,11 @@ const ArticleDate = ({ setting, builderProps, styles })=>{
|
|
|
18
18
|
}));
|
|
19
19
|
};
|
|
20
20
|
const formattedDate = React.useMemo(()=>{
|
|
21
|
-
const date = convertTZ(new Date(article.
|
|
21
|
+
const date = convertTZ(new Date(article.publishedAt), timezone ?? '');
|
|
22
22
|
const { locales, options } = JSON.parse(dateFormat ?? '{"locales":"en-US","options":{"month":"short","day":"2-digit","year":"numeric"}}');
|
|
23
23
|
return date.toLocaleDateString(locales, options);
|
|
24
24
|
}, [
|
|
25
|
-
article.
|
|
25
|
+
article.publishedAt,
|
|
26
26
|
timezone,
|
|
27
27
|
dateFormat
|
|
28
28
|
]);
|
|
@@ -20,7 +20,7 @@ const ArticleDate = ({ setting, styles, advanced, builderProps })=>{
|
|
|
20
20
|
styles: styles,
|
|
21
21
|
setting: {
|
|
22
22
|
...setting,
|
|
23
|
-
text: `{{ article.
|
|
23
|
+
text: `{{ article.published_at | date: '${FORMAT_MAP[dateFormat ?? '{"locales":"en-US","options":{"month":"short","day":"2-digit","year":"numeric"}}']}' }}`,
|
|
24
24
|
excludeFlex: true
|
|
25
25
|
},
|
|
26
26
|
advanced: advanced,
|
|
@@ -251,19 +251,7 @@ const Dialog = ({ setting, children, builderProps, builderAttrs, style })=>{
|
|
|
251
251
|
style
|
|
252
252
|
]);
|
|
253
253
|
const borderStyle = React.useMemo(()=>{
|
|
254
|
-
return Object.keys(style ?? {}).filter((key)=>
|
|
255
|
-
'--bw',
|
|
256
|
-
'--bw-mobile',
|
|
257
|
-
'--bw-tablet',
|
|
258
|
-
'--bc',
|
|
259
|
-
'--b',
|
|
260
|
-
'--bs',
|
|
261
|
-
'--radius',
|
|
262
|
-
'--bblr',
|
|
263
|
-
'--bbrr',
|
|
264
|
-
'--btlr',
|
|
265
|
-
'--btrr'
|
|
266
|
-
].includes(key)).reduce((curr, key)=>({
|
|
254
|
+
return Object.keys(style ?? {}).filter((key)=>common.advancedBorderStyle.includes(key)).reduce((curr, key)=>({
|
|
267
255
|
...curr,
|
|
268
256
|
[key]: style?.[key]
|
|
269
257
|
}), {});
|
|
@@ -28,19 +28,7 @@ const Dialog = ({ setting, children, builderProps, style, advanced })=>{
|
|
|
28
28
|
...curr,
|
|
29
29
|
[key]: style?.[key]
|
|
30
30
|
}), {});
|
|
31
|
-
const borderStyle = Object.keys(style ?? {}).filter((key)=>
|
|
32
|
-
'--bw',
|
|
33
|
-
'--bw-mobile',
|
|
34
|
-
'--bw-tablet',
|
|
35
|
-
'--bc',
|
|
36
|
-
'--b',
|
|
37
|
-
'--bs',
|
|
38
|
-
'--radius',
|
|
39
|
-
'--bblr',
|
|
40
|
-
'--bbrr',
|
|
41
|
-
'--btlr',
|
|
42
|
-
'--btrr'
|
|
43
|
-
].includes(key)).reduce((curr, key)=>({
|
|
31
|
+
const borderStyle = Object.keys(style ?? {}).filter((key)=>common.advancedBorderStyle.includes(key)).reduce((curr, key)=>({
|
|
44
32
|
...curr,
|
|
45
33
|
[key]: style?.[key]
|
|
46
34
|
}), {});
|
|
@@ -9,6 +9,35 @@ const isShowModal = (startDate, numberOfDay = 0)=>{
|
|
|
9
9
|
const diff = Math.abs(c / 24 / 60 / 60 / 1000);
|
|
10
10
|
return diff >= numberOfDay;
|
|
11
11
|
};
|
|
12
|
+
const advancedBorderStyle = [
|
|
13
|
+
'--bw',
|
|
14
|
+
'--bw-mobile',
|
|
15
|
+
'--bw-tablet',
|
|
16
|
+
'--bc',
|
|
17
|
+
'--bc-tablet',
|
|
18
|
+
'--bc-mobile',
|
|
19
|
+
'--b',
|
|
20
|
+
'--b-tablet',
|
|
21
|
+
'--b-mobile',
|
|
22
|
+
'--bs',
|
|
23
|
+
'--bs-tablet',
|
|
24
|
+
'--bs-mobile',
|
|
25
|
+
'--radius',
|
|
26
|
+
'--radius-tablet',
|
|
27
|
+
'--radius-mobile',
|
|
28
|
+
'--bblr',
|
|
29
|
+
'--bbrr',
|
|
30
|
+
'--btlr',
|
|
31
|
+
'--btrr',
|
|
32
|
+
'--bblr-tablet',
|
|
33
|
+
'--bbrr-tablet',
|
|
34
|
+
'--btlr-tablet',
|
|
35
|
+
'--btrr-tablet',
|
|
36
|
+
'--bblr-mobile',
|
|
37
|
+
'--bbrr-mobile',
|
|
38
|
+
'--btlr-mobile',
|
|
39
|
+
'--btrr-mobile'
|
|
40
|
+
];
|
|
12
41
|
const isMobile = (userAgent)=>{
|
|
13
42
|
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
|
|
14
43
|
return true;
|
|
@@ -46,6 +75,7 @@ const inheritStyleBody = {
|
|
|
46
75
|
};
|
|
47
76
|
const bodyDialogClass = 'gp-h-full gp-w-full gp-overflow-y-auto gp-overflow-x-hidden !gp-max-h-screen';
|
|
48
77
|
|
|
78
|
+
exports.advancedBorderStyle = advancedBorderStyle;
|
|
49
79
|
exports.bodyDialogClass = bodyDialogClass;
|
|
50
80
|
exports.getPropertyByDevice = getPropertyByDevice;
|
|
51
81
|
exports.heightStyle = heightStyle;
|
|
@@ -120,7 +120,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
120
120
|
class="${appendTypoClass} gp-stock-counter-mark"
|
|
121
121
|
style="${appendTypoStyle}"
|
|
122
122
|
>
|
|
123
|
-
{% if inventory_management == null
|
|
123
|
+
{% if inventory_management == null and inventory_quantity <= 0 %}
|
|
124
124
|
${helpers.transformHighlighTag(unlimitedQuantityMessage ?? helpers$1.getStaticLocale('StockCounter', 'let_buy_now'), mainColor)}
|
|
125
125
|
{% elsif available == false %}
|
|
126
126
|
${helpers.transformHighlighTag(outOfStockMessage || '', mainColor)}
|
|
@@ -19,7 +19,7 @@ const BoldSubscriptions = ({ setting, advanced })=>{
|
|
|
19
19
|
{% else %}
|
|
20
20
|
{% assign app_blocks = section.blocks | where: "type", "@app" %}
|
|
21
21
|
{% for block in app_blocks %}
|
|
22
|
-
{% if block.type == '@app' and block.id
|
|
22
|
+
{% if block.type == '@app' and block.id contains '${appBlockId}' %}
|
|
23
23
|
{% render block %}
|
|
24
24
|
{% endif %}
|
|
25
25
|
{% endfor %}
|
|
@@ -14,11 +14,11 @@ const ArticleDate = ({ setting, builderProps, styles })=>{
|
|
|
14
14
|
}));
|
|
15
15
|
};
|
|
16
16
|
const formattedDate = useMemo(()=>{
|
|
17
|
-
const date = convertTZ(new Date(article.
|
|
17
|
+
const date = convertTZ(new Date(article.publishedAt), timezone ?? '');
|
|
18
18
|
const { locales, options } = JSON.parse(dateFormat ?? '{"locales":"en-US","options":{"month":"short","day":"2-digit","year":"numeric"}}');
|
|
19
19
|
return date.toLocaleDateString(locales, options);
|
|
20
20
|
}, [
|
|
21
|
-
article.
|
|
21
|
+
article.publishedAt,
|
|
22
22
|
timezone,
|
|
23
23
|
dateFormat
|
|
24
24
|
]);
|
|
@@ -16,7 +16,7 @@ const ArticleDate = ({ setting, styles, advanced, builderProps })=>{
|
|
|
16
16
|
styles: styles,
|
|
17
17
|
setting: {
|
|
18
18
|
...setting,
|
|
19
|
-
text: `{{ article.
|
|
19
|
+
text: `{{ article.published_at | date: '${FORMAT_MAP[dateFormat ?? '{"locales":"en-US","options":{"month":"short","day":"2-digit","year":"numeric"}}']}' }}`,
|
|
20
20
|
excludeFlex: true
|
|
21
21
|
},
|
|
22
22
|
advanced: advanced,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { useModalStore, useEditorMode, useInteraction, globalEvent, makeWidth, cls, makeStyle, getGlobalColorResponsiveStyle, makeStyleResponsive, composeRadius, getStyleBackgroundByDevice, isEmptyChildren, filterToolbarPreview } from '@gem-sdk/core';
|
|
3
3
|
import { useMemo, useRef, useState, useCallback, useEffect } from 'react';
|
|
4
|
-
import { isShowModal, isMobile, heightStyle, removeHeightPercentForContent, inheritStyleBody, bodyDialogClass } from '../helpers/common.js';
|
|
4
|
+
import { isShowModal, isMobile, advancedBorderStyle, heightStyle, removeHeightPercentForContent, inheritStyleBody, bodyDialogClass } from '../helpers/common.js';
|
|
5
5
|
import { useScrollPercentage } from '../hooks/use-scroll-percentage.js';
|
|
6
6
|
import ChildrenDroppable from '../../grid/components/ChildrenDroppable.js';
|
|
7
7
|
import { ELEMENT_Z_INDEX } from '../../common/const.js';
|
|
@@ -247,19 +247,7 @@ const Dialog = ({ setting, children, builderProps, builderAttrs, style })=>{
|
|
|
247
247
|
style
|
|
248
248
|
]);
|
|
249
249
|
const borderStyle = useMemo(()=>{
|
|
250
|
-
return Object.keys(style ?? {}).filter((key)=>
|
|
251
|
-
'--bw',
|
|
252
|
-
'--bw-mobile',
|
|
253
|
-
'--bw-tablet',
|
|
254
|
-
'--bc',
|
|
255
|
-
'--b',
|
|
256
|
-
'--bs',
|
|
257
|
-
'--radius',
|
|
258
|
-
'--bblr',
|
|
259
|
-
'--bbrr',
|
|
260
|
-
'--btlr',
|
|
261
|
-
'--btrr'
|
|
262
|
-
].includes(key)).reduce((curr, key)=>({
|
|
250
|
+
return Object.keys(style ?? {}).filter((key)=>advancedBorderStyle.includes(key)).reduce((curr, key)=>({
|
|
263
251
|
...curr,
|
|
264
252
|
[key]: style?.[key]
|
|
265
253
|
}), {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { makeWidth, template, cls, RenderIf, makeStyle, getGlobalColorResponsiveStyle, makeStyleResponsive, composeRadius, getStyleBackgroundByDevice, isLocalEnv, baseAssetURL } from '@gem-sdk/core';
|
|
2
2
|
import { isTransparentColor } from '../../helpers.js';
|
|
3
|
-
import { heightStyle, removeHeightPercentForContent, inheritStyleBody, bodyDialogClass } from '../helpers/common.js';
|
|
3
|
+
import { advancedBorderStyle, heightStyle, removeHeightPercentForContent, inheritStyleBody, bodyDialogClass } from '../helpers/common.js';
|
|
4
4
|
import 'react/jsx-runtime';
|
|
5
5
|
import { ELEMENT_Z_INDEX } from '../../common/const.js';
|
|
6
6
|
|
|
@@ -24,19 +24,7 @@ const Dialog = ({ setting, children, builderProps, style, advanced })=>{
|
|
|
24
24
|
...curr,
|
|
25
25
|
[key]: style?.[key]
|
|
26
26
|
}), {});
|
|
27
|
-
const borderStyle = Object.keys(style ?? {}).filter((key)=>
|
|
28
|
-
'--bw',
|
|
29
|
-
'--bw-mobile',
|
|
30
|
-
'--bw-tablet',
|
|
31
|
-
'--bc',
|
|
32
|
-
'--b',
|
|
33
|
-
'--bs',
|
|
34
|
-
'--radius',
|
|
35
|
-
'--bblr',
|
|
36
|
-
'--bbrr',
|
|
37
|
-
'--btlr',
|
|
38
|
-
'--btrr'
|
|
39
|
-
].includes(key)).reduce((curr, key)=>({
|
|
27
|
+
const borderStyle = Object.keys(style ?? {}).filter((key)=>advancedBorderStyle.includes(key)).reduce((curr, key)=>({
|
|
40
28
|
...curr,
|
|
41
29
|
[key]: style?.[key]
|
|
42
30
|
}), {});
|
|
@@ -7,6 +7,35 @@ const isShowModal = (startDate, numberOfDay = 0)=>{
|
|
|
7
7
|
const diff = Math.abs(c / 24 / 60 / 60 / 1000);
|
|
8
8
|
return diff >= numberOfDay;
|
|
9
9
|
};
|
|
10
|
+
const advancedBorderStyle = [
|
|
11
|
+
'--bw',
|
|
12
|
+
'--bw-mobile',
|
|
13
|
+
'--bw-tablet',
|
|
14
|
+
'--bc',
|
|
15
|
+
'--bc-tablet',
|
|
16
|
+
'--bc-mobile',
|
|
17
|
+
'--b',
|
|
18
|
+
'--b-tablet',
|
|
19
|
+
'--b-mobile',
|
|
20
|
+
'--bs',
|
|
21
|
+
'--bs-tablet',
|
|
22
|
+
'--bs-mobile',
|
|
23
|
+
'--radius',
|
|
24
|
+
'--radius-tablet',
|
|
25
|
+
'--radius-mobile',
|
|
26
|
+
'--bblr',
|
|
27
|
+
'--bbrr',
|
|
28
|
+
'--btlr',
|
|
29
|
+
'--btrr',
|
|
30
|
+
'--bblr-tablet',
|
|
31
|
+
'--bbrr-tablet',
|
|
32
|
+
'--btlr-tablet',
|
|
33
|
+
'--btrr-tablet',
|
|
34
|
+
'--bblr-mobile',
|
|
35
|
+
'--bbrr-mobile',
|
|
36
|
+
'--btlr-mobile',
|
|
37
|
+
'--btrr-mobile'
|
|
38
|
+
];
|
|
10
39
|
const isMobile = (userAgent)=>{
|
|
11
40
|
if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(userAgent)) {
|
|
12
41
|
return true;
|
|
@@ -44,4 +73,4 @@ const inheritStyleBody = {
|
|
|
44
73
|
};
|
|
45
74
|
const bodyDialogClass = 'gp-h-full gp-w-full gp-overflow-y-auto gp-overflow-x-hidden !gp-max-h-screen';
|
|
46
75
|
|
|
47
|
-
export { bodyDialogClass, getPropertyByDevice, heightStyle, inheritStyleBody, isMobile, isShowModal, removeHeightPercentForContent };
|
|
76
|
+
export { advancedBorderStyle, bodyDialogClass, getPropertyByDevice, heightStyle, inheritStyleBody, isMobile, isShowModal, removeHeightPercentForContent };
|
|
@@ -116,7 +116,7 @@ const StockCounter = ({ setting, styles, style, advanced, builderProps })=>{
|
|
|
116
116
|
class="${appendTypoClass} gp-stock-counter-mark"
|
|
117
117
|
style="${appendTypoStyle}"
|
|
118
118
|
>
|
|
119
|
-
{% if inventory_management == null
|
|
119
|
+
{% if inventory_management == null and inventory_quantity <= 0 %}
|
|
120
120
|
${transformHighlighTag(unlimitedQuantityMessage ?? getStaticLocale('StockCounter', 'let_buy_now'), mainColor)}
|
|
121
121
|
{% elsif available == false %}
|
|
122
122
|
${transformHighlighTag(outOfStockMessage || '', mainColor)}
|
|
@@ -15,7 +15,7 @@ const BoldSubscriptions = ({ setting, advanced })=>{
|
|
|
15
15
|
{% else %}
|
|
16
16
|
{% assign app_blocks = section.blocks | where: "type", "@app" %}
|
|
17
17
|
{% for block in app_blocks %}
|
|
18
|
-
{% if block.type == '@app' and block.id
|
|
18
|
+
{% if block.type == '@app' and block.id contains '${appBlockId}' %}
|
|
19
19
|
{% render block %}
|
|
20
20
|
{% endif %}
|
|
21
21
|
{% endfor %}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"format": "prettier --write \"./src/**/*.{ts,tsx}\""
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@gem-sdk/core": "2.1.
|
|
24
|
+
"@gem-sdk/core": "2.1.4",
|
|
25
25
|
"@gem-sdk/styles": "2.1.0",
|
|
26
26
|
"@types/react-transition-group": "^4.4.5"
|
|
27
27
|
},
|