@gem-sdk/components 2.0.0-dev.416 → 2.0.0-dev.417
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/product/components/ProductQuantity/common/getAttrs.js +2 -4
- package/dist/cjs/product/components/ProductQuantity/common/getClasses.js +1 -1
- package/dist/cjs/product/components/ProductQuantity/index.js +3 -3
- package/dist/cjs/product/components/ProductQuantity/index.liquid.js +5 -4
- package/dist/esm/product/components/ProductQuantity/common/getAttrs.js +2 -4
- package/dist/esm/product/components/ProductQuantity/common/getClasses.js +1 -1
- package/dist/esm/product/components/ProductQuantity/index.js +3 -3
- package/dist/esm/product/components/ProductQuantity/index.liquid.js +5 -4
- package/package.json +1 -1
|
@@ -6,18 +6,16 @@ const getContainerAttrs = ({ uid, isDisabled = true, isDisableByLiquid })=>{
|
|
|
6
6
|
'data-disabled': isDisableByLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled
|
|
7
7
|
};
|
|
8
8
|
};
|
|
9
|
-
const getButtonAttrs = ({
|
|
9
|
+
const getButtonAttrs = ({ buttonSide })=>{
|
|
10
10
|
return {
|
|
11
|
-
disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
|
|
12
11
|
title: buttonSide === 'left' ? 'Decrement' : 'Increment',
|
|
13
12
|
'aria-label': buttonSide === 'left' ? 'decrement' : 'increment'
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
|
-
const getInputAttr = ({
|
|
15
|
+
const getInputAttr = ({ isLiquid, qtyStyle, quantity, currentVariant, defaultQty })=>{
|
|
17
16
|
const attrs = {};
|
|
18
17
|
if (currentVariant?.manageInventory) attrs['max'] = isLiquid ? '{{ current_variant.quantity_rule.max }}' : currentVariant?.inventoryQuantity ?? 1;
|
|
19
18
|
return {
|
|
20
|
-
disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
|
|
21
19
|
type: qtyStyle === 'standard' ? 'text' : 'number',
|
|
22
20
|
name: 'quantity',
|
|
23
21
|
step: 1,
|
|
@@ -17,7 +17,7 @@ const getInputClasses = ({ styles, borderBtn, inputBackgroundColor, textColor })
|
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
19
|
const getButtonClass = ({ borderBtn, buttonBackgroundColor, iconColor, buttonSide })=>{
|
|
20
|
-
let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0' : '!gp-border-l-0'} `;
|
|
20
|
+
let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0 gp-minus' : '!gp-border-l-0 gp-plus'} `;
|
|
21
21
|
const buttonColor = core.handleConvertClassColor(borderBtn);
|
|
22
22
|
const buttonBgColor = core.getGlobalColorStateClass('bg', buttonBackgroundColor);
|
|
23
23
|
const iconColorStateClass = core.getGlobalColorStateClass('text', iconColor);
|
|
@@ -46,7 +46,6 @@ const ProductQuantity = (props)=>{
|
|
|
46
46
|
});
|
|
47
47
|
const inputAttrs = system.createAttr({
|
|
48
48
|
...getAttrs.getInputAttr({
|
|
49
|
-
isDisabled: !isInStock,
|
|
50
49
|
qtyStyle,
|
|
51
50
|
quantity,
|
|
52
51
|
currentVariant,
|
|
@@ -85,7 +84,6 @@ const ProductQuantity = (props)=>{
|
|
|
85
84
|
});
|
|
86
85
|
const buttonLeftAttrs = system.createAttr({
|
|
87
86
|
...getAttrs.getButtonAttrs({
|
|
88
|
-
isDisabled: !isInStock,
|
|
89
87
|
buttonSide: 'left'
|
|
90
88
|
})
|
|
91
89
|
});
|
|
@@ -110,7 +108,6 @@ const ProductQuantity = (props)=>{
|
|
|
110
108
|
});
|
|
111
109
|
const buttonRightAttrs = system.createAttr({
|
|
112
110
|
...getAttrs.getButtonAttrs({
|
|
113
|
-
isDisabled: !isInStock,
|
|
114
111
|
buttonSide: 'right'
|
|
115
112
|
})
|
|
116
113
|
});
|
|
@@ -128,6 +125,7 @@ const ProductQuantity = (props)=>{
|
|
|
128
125
|
style: wrapperStyles,
|
|
129
126
|
children: [
|
|
130
127
|
system.If(qtyStyle === 'standard', /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
128
|
+
disabled: !isInStock,
|
|
131
129
|
...buttonLeftAttrs,
|
|
132
130
|
onClick: decrement,
|
|
133
131
|
className: buttonLeftClass,
|
|
@@ -141,6 +139,7 @@ const ProductQuantity = (props)=>{
|
|
|
141
139
|
})
|
|
142
140
|
})),
|
|
143
141
|
/*#__PURE__*/ jsxRuntime.jsx("input", {
|
|
142
|
+
disabled: !isInStock,
|
|
144
143
|
...inputAttrs,
|
|
145
144
|
className: inputClass,
|
|
146
145
|
style: inputStyle,
|
|
@@ -149,6 +148,7 @@ const ProductQuantity = (props)=>{
|
|
|
149
148
|
}
|
|
150
149
|
}),
|
|
151
150
|
system.If(qtyStyle === 'standard', /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
151
|
+
disabled: !isInStock,
|
|
152
152
|
...buttonRightAttrs,
|
|
153
153
|
onClick: increment,
|
|
154
154
|
className: buttonRightClass,
|
|
@@ -86,7 +86,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
86
86
|
});
|
|
87
87
|
const buttonLeftAttrs = system.createAttr({
|
|
88
88
|
...getAttrs.getButtonAttrs({
|
|
89
|
-
isLiquid: true,
|
|
90
89
|
buttonSide: 'left'
|
|
91
90
|
})
|
|
92
91
|
});
|
|
@@ -110,7 +109,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
110
109
|
});
|
|
111
110
|
const buttonRightAttrs = system.createAttr({
|
|
112
111
|
...getAttrs.getButtonAttrs({
|
|
113
|
-
isLiquid: true,
|
|
114
112
|
buttonSide: 'right'
|
|
115
113
|
})
|
|
116
114
|
});
|
|
@@ -134,6 +132,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
134
132
|
<div class="${wrapperClasses}" style="${wrapperStyles}">
|
|
135
133
|
${core.RenderIf(qtyStyle === 'standard', core.template /* liquid */ `
|
|
136
134
|
<button
|
|
135
|
+
{% if available == false %} disabled {% endif %}
|
|
137
136
|
${{
|
|
138
137
|
...buttonLeftAttrs
|
|
139
138
|
}}
|
|
@@ -142,11 +141,12 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
142
141
|
>
|
|
143
142
|
<span class="${iconWrapperClass}" style="${iconWidth}"
|
|
144
143
|
>
|
|
145
|
-
${common.getPlusIcon(
|
|
144
|
+
${common.getPlusIcon(minusIcon)}
|
|
146
145
|
</span>
|
|
147
146
|
</button>
|
|
148
147
|
`)}
|
|
149
148
|
<input
|
|
149
|
+
{% if available == false %} disabled {% endif %}
|
|
150
150
|
${{
|
|
151
151
|
...inputAttrs
|
|
152
152
|
}}
|
|
@@ -157,6 +157,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
157
157
|
|
|
158
158
|
${core.RenderIf(qtyStyle === 'standard', core.template /* liquid */ `
|
|
159
159
|
<button
|
|
160
|
+
{% if available == false %} disabled {% endif %}
|
|
160
161
|
${{
|
|
161
162
|
...buttonRightAttrs
|
|
162
163
|
}}
|
|
@@ -164,7 +165,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
164
165
|
style="${buttonRightStyle}"
|
|
165
166
|
>
|
|
166
167
|
<span class="${iconWrapperClass}" style="${iconWidth}">
|
|
167
|
-
${common.getPlusIcon(
|
|
168
|
+
${common.getPlusIcon(plusIcon)}
|
|
168
169
|
</span>
|
|
169
170
|
</button>
|
|
170
171
|
`)}
|
|
@@ -4,18 +4,16 @@ const getContainerAttrs = ({ uid, isDisabled = true, isDisableByLiquid })=>{
|
|
|
4
4
|
'data-disabled': isDisableByLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled
|
|
5
5
|
};
|
|
6
6
|
};
|
|
7
|
-
const getButtonAttrs = ({
|
|
7
|
+
const getButtonAttrs = ({ buttonSide })=>{
|
|
8
8
|
return {
|
|
9
|
-
disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
|
|
10
9
|
title: buttonSide === 'left' ? 'Decrement' : 'Increment',
|
|
11
10
|
'aria-label': buttonSide === 'left' ? 'decrement' : 'increment'
|
|
12
11
|
};
|
|
13
12
|
};
|
|
14
|
-
const getInputAttr = ({
|
|
13
|
+
const getInputAttr = ({ isLiquid, qtyStyle, quantity, currentVariant, defaultQty })=>{
|
|
15
14
|
const attrs = {};
|
|
16
15
|
if (currentVariant?.manageInventory) attrs['max'] = isLiquid ? '{{ current_variant.quantity_rule.max }}' : currentVariant?.inventoryQuantity ?? 1;
|
|
17
16
|
return {
|
|
18
|
-
disabled: isLiquid ? '{%- if available -%} false {%- else -%} true {%- endif -%}' : isDisabled,
|
|
19
17
|
type: qtyStyle === 'standard' ? 'text' : 'number',
|
|
20
18
|
name: 'quantity',
|
|
21
19
|
step: 1,
|
|
@@ -15,7 +15,7 @@ const getInputClasses = ({ styles, borderBtn, inputBackgroundColor, textColor })
|
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
17
|
const getButtonClass = ({ borderBtn, buttonBackgroundColor, iconColor, buttonSide })=>{
|
|
18
|
-
let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0' : '!gp-border-l-0'} `;
|
|
18
|
+
let classList = `gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${buttonSide === 'left' ? '!gp-border-r-0 gp-minus' : '!gp-border-l-0 gp-plus'} `;
|
|
19
19
|
const buttonColor = handleConvertClassColor(borderBtn);
|
|
20
20
|
const buttonBgColor = getGlobalColorStateClass('bg', buttonBackgroundColor);
|
|
21
21
|
const iconColorStateClass = getGlobalColorStateClass('text', iconColor);
|
|
@@ -42,7 +42,6 @@ const ProductQuantity = (props)=>{
|
|
|
42
42
|
});
|
|
43
43
|
const inputAttrs = createAttr({
|
|
44
44
|
...getInputAttr({
|
|
45
|
-
isDisabled: !isInStock,
|
|
46
45
|
qtyStyle,
|
|
47
46
|
quantity,
|
|
48
47
|
currentVariant,
|
|
@@ -81,7 +80,6 @@ const ProductQuantity = (props)=>{
|
|
|
81
80
|
});
|
|
82
81
|
const buttonLeftAttrs = createAttr({
|
|
83
82
|
...getButtonAttrs({
|
|
84
|
-
isDisabled: !isInStock,
|
|
85
83
|
buttonSide: 'left'
|
|
86
84
|
})
|
|
87
85
|
});
|
|
@@ -106,7 +104,6 @@ const ProductQuantity = (props)=>{
|
|
|
106
104
|
});
|
|
107
105
|
const buttonRightAttrs = createAttr({
|
|
108
106
|
...getButtonAttrs({
|
|
109
|
-
isDisabled: !isInStock,
|
|
110
107
|
buttonSide: 'right'
|
|
111
108
|
})
|
|
112
109
|
});
|
|
@@ -124,6 +121,7 @@ const ProductQuantity = (props)=>{
|
|
|
124
121
|
style: wrapperStyles,
|
|
125
122
|
children: [
|
|
126
123
|
If(qtyStyle === 'standard', /*#__PURE__*/ jsx("button", {
|
|
124
|
+
disabled: !isInStock,
|
|
127
125
|
...buttonLeftAttrs,
|
|
128
126
|
onClick: decrement,
|
|
129
127
|
className: buttonLeftClass,
|
|
@@ -137,6 +135,7 @@ const ProductQuantity = (props)=>{
|
|
|
137
135
|
})
|
|
138
136
|
})),
|
|
139
137
|
/*#__PURE__*/ jsx("input", {
|
|
138
|
+
disabled: !isInStock,
|
|
140
139
|
...inputAttrs,
|
|
141
140
|
className: inputClass,
|
|
142
141
|
style: inputStyle,
|
|
@@ -145,6 +144,7 @@ const ProductQuantity = (props)=>{
|
|
|
145
144
|
}
|
|
146
145
|
}),
|
|
147
146
|
If(qtyStyle === 'standard', /*#__PURE__*/ jsx("button", {
|
|
147
|
+
disabled: !isInStock,
|
|
148
148
|
...buttonRightAttrs,
|
|
149
149
|
onClick: increment,
|
|
150
150
|
className: buttonRightClass,
|
|
@@ -82,7 +82,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
82
82
|
});
|
|
83
83
|
const buttonLeftAttrs = createAttr({
|
|
84
84
|
...getButtonAttrs({
|
|
85
|
-
isLiquid: true,
|
|
86
85
|
buttonSide: 'left'
|
|
87
86
|
})
|
|
88
87
|
});
|
|
@@ -106,7 +105,6 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
106
105
|
});
|
|
107
106
|
const buttonRightAttrs = createAttr({
|
|
108
107
|
...getButtonAttrs({
|
|
109
|
-
isLiquid: true,
|
|
110
108
|
buttonSide: 'right'
|
|
111
109
|
})
|
|
112
110
|
});
|
|
@@ -130,6 +128,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
130
128
|
<div class="${wrapperClasses}" style="${wrapperStyles}">
|
|
131
129
|
${RenderIf(qtyStyle === 'standard', template /* liquid */ `
|
|
132
130
|
<button
|
|
131
|
+
{% if available == false %} disabled {% endif %}
|
|
133
132
|
${{
|
|
134
133
|
...buttonLeftAttrs
|
|
135
134
|
}}
|
|
@@ -138,11 +137,12 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
138
137
|
>
|
|
139
138
|
<span class="${iconWrapperClass}" style="${iconWidth}"
|
|
140
139
|
>
|
|
141
|
-
${getPlusIcon(
|
|
140
|
+
${getPlusIcon(minusIcon)}
|
|
142
141
|
</span>
|
|
143
142
|
</button>
|
|
144
143
|
`)}
|
|
145
144
|
<input
|
|
145
|
+
{% if available == false %} disabled {% endif %}
|
|
146
146
|
${{
|
|
147
147
|
...inputAttrs
|
|
148
148
|
}}
|
|
@@ -153,6 +153,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
153
153
|
|
|
154
154
|
${RenderIf(qtyStyle === 'standard', template /* liquid */ `
|
|
155
155
|
<button
|
|
156
|
+
{% if available == false %} disabled {% endif %}
|
|
156
157
|
${{
|
|
157
158
|
...buttonRightAttrs
|
|
158
159
|
}}
|
|
@@ -160,7 +161,7 @@ const ProductQuantity = ({ setting = {}, styles = {}, advanced, builderProps })=
|
|
|
160
161
|
style="${buttonRightStyle}"
|
|
161
162
|
>
|
|
162
163
|
<span class="${iconWrapperClass}" style="${iconWidth}">
|
|
163
|
-
${getPlusIcon(
|
|
164
|
+
${getPlusIcon(plusIcon)}
|
|
164
165
|
</span>
|
|
165
166
|
</button>
|
|
166
167
|
`)}
|