@gem-sdk/components 2.0.0-dev.558 → 2.0.0-dev.560
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/accordion/components/AccordionItem.liquid.js +3 -3
- package/dist/cjs/accordion/components/common/index.js +0 -4
- package/dist/cjs/accordion/components/common/styles.js +1 -1
- package/dist/cjs/accordion/setting/configs/uiV2.js +2 -1
- package/dist/cjs/image/components/common/styles.js +0 -1
- package/dist/cjs/sticky/components/hooks/useSticky.js +0 -1
- package/dist/cjs/stock-counter/components/StockCounter.js +3 -3
- package/dist/cjs/stock-counter/components/common/getClasses.js +2 -1
- package/dist/cjs/stock-counter/components/common/getStyles.js +1 -1
- package/dist/cjs/stock-counter/components/hook/useStockCounter.js +6 -1
- package/dist/esm/accordion/components/AccordionItem.liquid.js +4 -4
- package/dist/esm/accordion/components/common/index.js +1 -3
- package/dist/esm/accordion/components/common/styles.js +1 -1
- package/dist/esm/accordion/setting/configs/uiV2.js +2 -1
- package/dist/esm/image/components/common/styles.js +0 -1
- package/dist/esm/sticky/components/hooks/useSticky.js +0 -1
- package/dist/esm/stock-counter/components/StockCounter.js +3 -3
- package/dist/esm/stock-counter/components/common/getClasses.js +2 -1
- package/dist/esm/stock-counter/components/common/getStyles.js +1 -1
- package/dist/esm/stock-counter/components/hook/useStockCounter.js +6 -1
- package/package.json +2 -2
|
@@ -45,7 +45,7 @@ const AccordionItem = (props)=>{
|
|
|
45
45
|
hasTransitionedIn: false,
|
|
46
46
|
isMounted: false
|
|
47
47
|
}));
|
|
48
|
-
const composeRenderChildrenStyles = system.createStyle(styles.getRenderChildrenStyles(composeContentSizeStyle));
|
|
48
|
+
const composeRenderChildrenStyles = system.createStyle(styles.getRenderChildrenStyles(composeContentSizeStyle()));
|
|
49
49
|
const composeItemBodyClasses = system.createClass(core.composeClasses('gp-accordion-item_body-inner gp-transition-all gp-duration-500'));
|
|
50
50
|
const getChildForBody = ()=>{
|
|
51
51
|
if (rawChildren && rawChildren.length >= index.MINIMUM_CHILD) {
|
|
@@ -77,7 +77,7 @@ const AccordionItem = (props)=>{
|
|
|
77
77
|
<span
|
|
78
78
|
class="${composeLayoutTextClasses}"
|
|
79
79
|
style="${composeLayoutTextStyles}">
|
|
80
|
-
${childrenIcon ??
|
|
80
|
+
${childrenIcon ?? ''}</span>
|
|
81
81
|
</div>
|
|
82
82
|
`)}
|
|
83
83
|
${Text_liquid.default({
|
|
@@ -99,7 +99,7 @@ const AccordionItem = (props)=>{
|
|
|
99
99
|
<span
|
|
100
100
|
class="${composeLayoutTextClasses}"
|
|
101
101
|
style="${composeLayoutTextStyles}">
|
|
102
|
-
${childrenIcon ??
|
|
102
|
+
${childrenIcon ?? ''}</span>
|
|
103
103
|
</div>
|
|
104
104
|
`)}
|
|
105
105
|
</div>
|
|
@@ -4,8 +4,6 @@ var core = require('@gem-sdk/core');
|
|
|
4
4
|
|
|
5
5
|
const MINIMUM_CHILD = 1;
|
|
6
6
|
const BODY_CHILD_INDEX = 0;
|
|
7
|
-
const DEFAULT_BEFORE_ICON = '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';
|
|
8
|
-
const DEFAULT_AFTER_ICON = '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';
|
|
9
7
|
const getDataState = (props, rawChildren)=>{
|
|
10
8
|
const { setting = {}, styles = {}, builderProps } = props;
|
|
11
9
|
const { activeKey, iconSvg, expandItem, iconPosition, iconCollapseSize, iconGlobalSize, iconExpand, iconCollapse, layoutHeader, expandedMode, configIconSize } = setting;
|
|
@@ -125,8 +123,6 @@ const getSettingItemLiquid = (props)=>{
|
|
|
125
123
|
};
|
|
126
124
|
|
|
127
125
|
exports.BODY_CHILD_INDEX = BODY_CHILD_INDEX;
|
|
128
|
-
exports.DEFAULT_AFTER_ICON = DEFAULT_AFTER_ICON;
|
|
129
|
-
exports.DEFAULT_BEFORE_ICON = DEFAULT_BEFORE_ICON;
|
|
130
126
|
exports.MINIMUM_CHILD = MINIMUM_CHILD;
|
|
131
127
|
exports.getDataState = getDataState;
|
|
132
128
|
exports.getParentSettings = getParentSettings;
|
|
@@ -22,7 +22,7 @@ const getContainerStyles = (style, styles)=>{
|
|
|
22
22
|
...filterStyles(style),
|
|
23
23
|
...contentSizePaddingSize(styles).gap,
|
|
24
24
|
...core.getStyleBackgroundByDevice(style?.backgroundContent),
|
|
25
|
-
|
|
25
|
+
'border-radius': 'inherit'
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
const widthHeightSizeControl = (widthHeightSize)=>core.makeGlobalSize(widthHeightSize);
|
|
@@ -135,11 +135,12 @@ const SettingUIV2 = [
|
|
|
135
135
|
},
|
|
136
136
|
type: 'combo',
|
|
137
137
|
iconName: 'polaris-text-title',
|
|
138
|
-
fixedValue: 'Edit...',
|
|
139
138
|
isHideClear: true,
|
|
140
139
|
popoverLabel: {
|
|
141
140
|
en: 'Title'
|
|
142
141
|
},
|
|
142
|
+
getValueFromSettingID: 'titleTypo.type',
|
|
143
|
+
isTypoValue: true,
|
|
143
144
|
controls: [
|
|
144
145
|
{
|
|
145
146
|
setting: {
|
|
@@ -18,7 +18,7 @@ var useStockCounter = require('./hook/useStockCounter.js');
|
|
|
18
18
|
const StockCounter = ({ setting, styles, builderProps })=>{
|
|
19
19
|
const { displayProgressBar, borderRadius } = styles ?? {};
|
|
20
20
|
const { showIcon, icon, layout = 'full', oosIcon } = setting ?? {};
|
|
21
|
-
const {
|
|
21
|
+
const { outputMessage, isOutOfStock, inventoryQuantity } = useStockCounter.useStockCounter(setting, styles);
|
|
22
22
|
const elementRef = React.useRef(null);
|
|
23
23
|
const { dispatchStockCounterInteraction } = useStockCounterInteraction.useStockCounterInteraction({
|
|
24
24
|
element: elementRef,
|
|
@@ -117,13 +117,13 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
117
117
|
})),
|
|
118
118
|
showText && (isOutOfStock ? /*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
119
119
|
dangerouslySetInnerHTML: {
|
|
120
|
-
__html:
|
|
120
|
+
__html: outputMessage()
|
|
121
121
|
},
|
|
122
122
|
className: textClasses,
|
|
123
123
|
style: textStyles(true)
|
|
124
124
|
}) : /*#__PURE__*/ jsxRuntime.jsx("p", {
|
|
125
125
|
dangerouslySetInnerHTML: {
|
|
126
|
-
__html:
|
|
126
|
+
__html: outputMessage()
|
|
127
127
|
},
|
|
128
128
|
className: textClasses,
|
|
129
129
|
style: textStyles(false)
|
|
@@ -14,7 +14,7 @@ const getContainerClasses = (setting)=>{
|
|
|
14
14
|
const { progressBarPosition = 'bottom' } = setting ?? {};
|
|
15
15
|
const isProgressBarBottom = progressBarPosition === 'bottom';
|
|
16
16
|
return {
|
|
17
|
-
...core.composeClasses('gp-inline-block gp-flex gp-
|
|
17
|
+
...core.composeClasses('gp-inline-block gp-flex gp-gap-y-1.5'),
|
|
18
18
|
'gp-flex-col': isProgressBarBottom,
|
|
19
19
|
'gp-flex-col-reverse': !isProgressBarBottom
|
|
20
20
|
};
|
|
@@ -48,6 +48,7 @@ const getTextClasses = (styles)=>{
|
|
|
48
48
|
const getWrapperClasses = (setting, isOutOfStock)=>{
|
|
49
49
|
const { hiddenCounterWhenOutOfStock } = setting ?? {};
|
|
50
50
|
return {
|
|
51
|
+
...core.composeClasses('gp-flex'),
|
|
51
52
|
'gp-opacity-50': isOutOfStock && hiddenCounterWhenOutOfStock
|
|
52
53
|
};
|
|
53
54
|
};
|
|
@@ -33,7 +33,7 @@ const getContainerStyles = (styles)=>{
|
|
|
33
33
|
const getWrapperStyles = (styles)=>{
|
|
34
34
|
const { alignment } = styles ?? {};
|
|
35
35
|
return {
|
|
36
|
-
...core.makeStyleResponsive('
|
|
36
|
+
...core.makeStyleResponsive('jc', alignment)
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
39
|
const getIconStyles = (styles, setting, isOutOfStock)=>{
|
|
@@ -26,8 +26,13 @@ const useStockCounter = (setting, styles)=>{
|
|
|
26
26
|
if (isContinueShopping) return helpers.transformHighlighTag(continueSelling || '', mainColor);
|
|
27
27
|
return helpers.transformHighlighTag(helpers.transformNumberTag(template || '', mainColor, inventoryQuantity), mainColor);
|
|
28
28
|
}
|
|
29
|
+
const outputMessage = ()=>{
|
|
30
|
+
const isCapitalize = styles?.typo?.attrs?.transform === 'capitalize';
|
|
31
|
+
if (isCapitalize) return getMessage()?.toLocaleLowerCase();
|
|
32
|
+
return getMessage();
|
|
33
|
+
};
|
|
29
34
|
return {
|
|
30
|
-
|
|
35
|
+
outputMessage,
|
|
31
36
|
isOutOfStock,
|
|
32
37
|
inventoryQuantity
|
|
33
38
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { composeClasses, template, RenderChildren } from '@gem-sdk/core';
|
|
2
2
|
import Text from '../../text/components/Text.liquid.js';
|
|
3
|
-
import { getParentSettings, getSettingItemLiquid,
|
|
3
|
+
import { getParentSettings, getSettingItemLiquid, MINIMUM_CHILD, BODY_CHILD_INDEX } from './common/index.js';
|
|
4
4
|
import { createClass, createStyle, If } from '@gem-sdk/system';
|
|
5
5
|
import { getItemContainerClasses, getDropdownClasses, getIconClasses, getIconRotateClasses, getContentClasses, getGapClasses, getLayoutTextClasses, getRenderChildrenClasses } from './common/classes.js';
|
|
6
6
|
import { getIconGlobalSize, getItemContainerStyles, getDropdownStyles, getIconRotateStyles, getGapStyles, getLayoutTextStyles, getRenderChildrenStyles } from './common/styles.js';
|
|
@@ -41,7 +41,7 @@ const AccordionItem = (props)=>{
|
|
|
41
41
|
hasTransitionedIn: false,
|
|
42
42
|
isMounted: false
|
|
43
43
|
}));
|
|
44
|
-
const composeRenderChildrenStyles = createStyle(getRenderChildrenStyles(composeContentSizeStyle));
|
|
44
|
+
const composeRenderChildrenStyles = createStyle(getRenderChildrenStyles(composeContentSizeStyle()));
|
|
45
45
|
const composeItemBodyClasses = createClass(composeClasses('gp-accordion-item_body-inner gp-transition-all gp-duration-500'));
|
|
46
46
|
const getChildForBody = ()=>{
|
|
47
47
|
if (rawChildren && rawChildren.length >= MINIMUM_CHILD) {
|
|
@@ -73,7 +73,7 @@ const AccordionItem = (props)=>{
|
|
|
73
73
|
<span
|
|
74
74
|
class="${composeLayoutTextClasses}"
|
|
75
75
|
style="${composeLayoutTextStyles}">
|
|
76
|
-
${childrenIcon ??
|
|
76
|
+
${childrenIcon ?? ''}</span>
|
|
77
77
|
</div>
|
|
78
78
|
`)}
|
|
79
79
|
${Text({
|
|
@@ -95,7 +95,7 @@ const AccordionItem = (props)=>{
|
|
|
95
95
|
<span
|
|
96
96
|
class="${composeLayoutTextClasses}"
|
|
97
97
|
style="${composeLayoutTextStyles}">
|
|
98
|
-
${childrenIcon ??
|
|
98
|
+
${childrenIcon ?? ''}</span>
|
|
99
99
|
</div>
|
|
100
100
|
`)}
|
|
101
101
|
</div>
|
|
@@ -2,8 +2,6 @@ import { makeGlobalSize, composeSize, removePaddingYInStyle, makeStyle, getGloba
|
|
|
2
2
|
|
|
3
3
|
const MINIMUM_CHILD = 1;
|
|
4
4
|
const BODY_CHILD_INDEX = 0;
|
|
5
|
-
const DEFAULT_BEFORE_ICON = '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';
|
|
6
|
-
const DEFAULT_AFTER_ICON = '<svg height="100%" width="100%" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"><path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"></path></svg>';
|
|
7
5
|
const getDataState = (props, rawChildren)=>{
|
|
8
6
|
const { setting = {}, styles = {}, builderProps } = props;
|
|
9
7
|
const { activeKey, iconSvg, expandItem, iconPosition, iconCollapseSize, iconGlobalSize, iconExpand, iconCollapse, layoutHeader, expandedMode, configIconSize } = setting;
|
|
@@ -122,4 +120,4 @@ const getSettingItemLiquid = (props)=>{
|
|
|
122
120
|
};
|
|
123
121
|
};
|
|
124
122
|
|
|
125
|
-
export { BODY_CHILD_INDEX,
|
|
123
|
+
export { BODY_CHILD_INDEX, MINIMUM_CHILD, getDataState, getParentSettings, getSettingItemLiquid };
|
|
@@ -20,7 +20,7 @@ const getContainerStyles = (style, styles)=>{
|
|
|
20
20
|
...filterStyles(style),
|
|
21
21
|
...contentSizePaddingSize(styles).gap,
|
|
22
22
|
...getStyleBackgroundByDevice(style?.backgroundContent),
|
|
23
|
-
|
|
23
|
+
'border-radius': 'inherit'
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
26
|
const widthHeightSizeControl = (widthHeightSize)=>makeGlobalSize(widthHeightSize);
|
|
@@ -133,11 +133,12 @@ const SettingUIV2 = [
|
|
|
133
133
|
},
|
|
134
134
|
type: 'combo',
|
|
135
135
|
iconName: 'polaris-text-title',
|
|
136
|
-
fixedValue: 'Edit...',
|
|
137
136
|
isHideClear: true,
|
|
138
137
|
popoverLabel: {
|
|
139
138
|
en: 'Title'
|
|
140
139
|
},
|
|
140
|
+
getValueFromSettingID: 'titleTypo.type',
|
|
141
|
+
isTypoValue: true,
|
|
141
142
|
controls: [
|
|
142
143
|
{
|
|
143
144
|
setting: {
|
|
@@ -14,7 +14,7 @@ import { useStockCounter } from './hook/useStockCounter.js';
|
|
|
14
14
|
const StockCounter = ({ setting, styles, builderProps })=>{
|
|
15
15
|
const { displayProgressBar, borderRadius } = styles ?? {};
|
|
16
16
|
const { showIcon, icon, layout = 'full', oosIcon } = setting ?? {};
|
|
17
|
-
const {
|
|
17
|
+
const { outputMessage, isOutOfStock, inventoryQuantity } = useStockCounter(setting, styles);
|
|
18
18
|
const elementRef = useRef(null);
|
|
19
19
|
const { dispatchStockCounterInteraction } = useStockCounterInteraction({
|
|
20
20
|
element: elementRef,
|
|
@@ -113,13 +113,13 @@ const StockCounter = ({ setting, styles, builderProps })=>{
|
|
|
113
113
|
})),
|
|
114
114
|
showText && (isOutOfStock ? /*#__PURE__*/ jsx("p", {
|
|
115
115
|
dangerouslySetInnerHTML: {
|
|
116
|
-
__html:
|
|
116
|
+
__html: outputMessage()
|
|
117
117
|
},
|
|
118
118
|
className: textClasses,
|
|
119
119
|
style: textStyles(true)
|
|
120
120
|
}) : /*#__PURE__*/ jsx("p", {
|
|
121
121
|
dangerouslySetInnerHTML: {
|
|
122
|
-
__html:
|
|
122
|
+
__html: outputMessage()
|
|
123
123
|
},
|
|
124
124
|
className: textClasses,
|
|
125
125
|
style: textStyles(false)
|
|
@@ -12,7 +12,7 @@ const getContainerClasses = (setting)=>{
|
|
|
12
12
|
const { progressBarPosition = 'bottom' } = setting ?? {};
|
|
13
13
|
const isProgressBarBottom = progressBarPosition === 'bottom';
|
|
14
14
|
return {
|
|
15
|
-
...composeClasses('gp-inline-block gp-flex gp-
|
|
15
|
+
...composeClasses('gp-inline-block gp-flex gp-gap-y-1.5'),
|
|
16
16
|
'gp-flex-col': isProgressBarBottom,
|
|
17
17
|
'gp-flex-col-reverse': !isProgressBarBottom
|
|
18
18
|
};
|
|
@@ -46,6 +46,7 @@ const getTextClasses = (styles)=>{
|
|
|
46
46
|
const getWrapperClasses = (setting, isOutOfStock)=>{
|
|
47
47
|
const { hiddenCounterWhenOutOfStock } = setting ?? {};
|
|
48
48
|
return {
|
|
49
|
+
...composeClasses('gp-flex'),
|
|
49
50
|
'gp-opacity-50': isOutOfStock && hiddenCounterWhenOutOfStock
|
|
50
51
|
};
|
|
51
52
|
};
|
|
@@ -31,7 +31,7 @@ const getContainerStyles = (styles)=>{
|
|
|
31
31
|
const getWrapperStyles = (styles)=>{
|
|
32
32
|
const { alignment } = styles ?? {};
|
|
33
33
|
return {
|
|
34
|
-
...makeStyleResponsive('
|
|
34
|
+
...makeStyleResponsive('jc', alignment)
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
const getIconStyles = (styles, setting, isOutOfStock)=>{
|
|
@@ -24,8 +24,13 @@ const useStockCounter = (setting, styles)=>{
|
|
|
24
24
|
if (isContinueShopping) return transformHighlighTag(continueSelling || '', mainColor);
|
|
25
25
|
return transformHighlighTag(transformNumberTag(template || '', mainColor, inventoryQuantity), mainColor);
|
|
26
26
|
}
|
|
27
|
+
const outputMessage = ()=>{
|
|
28
|
+
const isCapitalize = styles?.typo?.attrs?.transform === 'capitalize';
|
|
29
|
+
if (isCapitalize) return getMessage()?.toLocaleLowerCase();
|
|
30
|
+
return getMessage();
|
|
31
|
+
};
|
|
27
32
|
return {
|
|
28
|
-
|
|
33
|
+
outputMessage,
|
|
29
34
|
isOutOfStock,
|
|
30
35
|
inventoryQuantity
|
|
31
36
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/components",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.560",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"update-img-src-3rd": "node ./scripts/update-img-src-3rd.js"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@gem-sdk/core": "2.0.0-dev.
|
|
26
|
+
"@gem-sdk/core": "2.0.0-dev.559",
|
|
27
27
|
"@gem-sdk/styles": "2.0.0-dev.535",
|
|
28
28
|
"@gem-sdk/system": "2.0.0-dev.504",
|
|
29
29
|
"@types/react-transition-group": "^4.4.5"
|