@gem-sdk/components 2.0.0-dev.359 → 2.0.0-dev.360

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.
Files changed (39) hide show
  1. package/dist/cjs/builder.js +14 -14
  2. package/dist/cjs/grid/row/setting/configs/uiV2.js +44 -0
  3. package/dist/cjs/grid/section/setting/configs/uiV2.js +44 -0
  4. package/dist/cjs/heading/setting/configs/settings.js +5 -2
  5. package/dist/cjs/index.js +40 -40
  6. package/dist/cjs/product/components/ProductQuantity/common/common.js +17 -0
  7. package/dist/cjs/product/components/ProductQuantity/hooks/index.js +68 -0
  8. package/dist/cjs/product/components/ProductQuantity/index.js +168 -0
  9. package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +2 -2
  10. package/dist/cjs/product/components/ProductVariants/common/dropdown/styles.js +2 -6
  11. package/dist/cjs/product/components/ProductVariants/components/dropdown-swatches/Dropdown.js +3 -3
  12. package/dist/cjs/product/components/ProductVariants/components/dropdown-swatches/Dropdown.liquid.js +2 -2
  13. package/dist/cjs/product/index.js +6 -6
  14. package/dist/cjs/product/next.js +1 -1
  15. package/dist/cjs/product/setting/product-variant/configs/settings.js +6 -3
  16. package/dist/cjs/product/setting/product-variant/configs/uiV2.js +107 -1
  17. package/dist/cjs/text/components/common/getStyle.js +1 -2
  18. package/dist/cjs/text/setting/configs/settings.js +5 -2
  19. package/dist/esm/builder.js +1 -1
  20. package/dist/esm/grid/row/setting/configs/uiV2.js +44 -0
  21. package/dist/esm/grid/section/setting/configs/uiV2.js +44 -0
  22. package/dist/esm/heading/setting/configs/settings.js +5 -2
  23. package/dist/esm/index.js +1 -1
  24. package/dist/esm/product/components/ProductQuantity/common/common.js +17 -1
  25. package/dist/esm/product/components/ProductQuantity/hooks/index.js +66 -0
  26. package/dist/esm/product/components/ProductQuantity/index.js +164 -0
  27. package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +1 -1
  28. package/dist/esm/product/components/ProductVariants/common/dropdown/styles.js +2 -6
  29. package/dist/esm/product/components/ProductVariants/components/dropdown-swatches/Dropdown.js +3 -3
  30. package/dist/esm/product/components/ProductVariants/components/dropdown-swatches/Dropdown.liquid.js +2 -2
  31. package/dist/esm/product/next.js +1 -1
  32. package/dist/esm/product/setting/product-variant/configs/settings.js +6 -3
  33. package/dist/esm/product/setting/product-variant/configs/uiV2.js +107 -1
  34. package/dist/esm/text/components/common/getStyle.js +2 -3
  35. package/dist/esm/text/setting/configs/settings.js +5 -2
  36. package/dist/types/index.d.ts +3 -27
  37. package/package.json +2 -2
  38. package/dist/cjs/product/components/ProductQuantity.js +0 -273
  39. package/dist/esm/product/components/ProductQuantity.js +0 -269
@@ -1,273 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- Object.defineProperty(exports, '__esModule', { value: true });
5
-
6
- var jsxRuntime = require('react/jsx-runtime');
7
- var core = require('@gem-sdk/core');
8
- var React = require('react');
9
- var common = require('./ProductVariants/common/common.js');
10
-
11
- const ProductQuantity = ({ setting = {}, styles = {}, builderProps })=>{
12
- const ref = React.useRef(null);
13
- const product = core.useProduct();
14
- const currentVariant = core.useCurrentVariant();
15
- const isSyncProduct = core.useIsSyncProduct();
16
- const { quantity, increment, decrement, setQuantity, setUpdatePrice } = core.useQuantity();
17
- const { qtyStyle, updatePrice } = setting;
18
- const defaultQty = setting.defaultQtyValue || 1;
19
- const { inputWidth, fullWidth, inputHeight, buttonBackgroundColor, iconColor, inputBackgroundColor, textColor, align, lineSeparated, borderBtn, buttonWidth, iconSizeCustom, corner } = styles;
20
- const { trigger } = core.useInteraction();
21
- React.useEffect(()=>{
22
- setQuantity(parseFloat(`${defaultQty}`));
23
- }, [
24
- setQuantity,
25
- defaultQty
26
- ]);
27
- React.useEffect(()=>{
28
- setUpdatePrice(updatePrice || false);
29
- }, [
30
- updatePrice,
31
- setUpdatePrice
32
- ]);
33
- const styleDisableBorderSeparate = (buttonSide)=>{
34
- const classes = [];
35
- if (!lineSeparated) {
36
- classes.push(buttonSide === 'left' ? '!gp-border-r-0' : '!gp-border-l-0');
37
- }
38
- return classes.join(' ');
39
- };
40
- const typeCheck = (iconSizeCustom)=>{
41
- let check = true;
42
- Object.keys(iconSizeCustom ?? {}).forEach((key)=>{
43
- if (typeof (iconSizeCustom ?? {})[key] != 'string' && typeof (iconSizeCustom ?? {})[key] != 'number') {
44
- check = false;
45
- }
46
- });
47
- return check ? core.makeStyleResponsive('w', iconSizeCustom) : core.makeStyleResponsive('w', {
48
- desktop: (iconSizeCustom?.['desktop'])?.width,
49
- tablet: (iconSizeCustom?.['tablet'])?.width,
50
- mobile: (iconSizeCustom?.['mobile'])?.width
51
- });
52
- };
53
- const iconWidth = typeCheck(iconSizeCustom);
54
- const qtyInputWidth = core.makeStyleResponsive('maxw', core.makeWidth(inputWidth, fullWidth));
55
- const isInStock = core.useCurrentVariantInStock();
56
- const appendTypoClass = core.composeTypographyClassName(styles.typo, styles.typography);
57
- const appendTypoStyle = core.composeTypographyStyle(styles.typo, styles.typography);
58
- const onHandleQuantity = (e)=>{
59
- const event = e;
60
- const data = event.detail;
61
- const currentProductId = product?.id;
62
- if (isSyncProduct && data && currentProductId == data.productId && quantity != data.quantity) {
63
- dispatchInteractionChangeQuantity(data.quantity);
64
- setQuantity(data.quantity);
65
- }
66
- };
67
- React.useEffect(()=>{
68
- window.removeEventListener('set-product-quantity', onHandleQuantity);
69
- window.addEventListener('set-product-quantity', onHandleQuantity);
70
- });
71
- common.useTransition((preQuantity)=>{
72
- if (preQuantity !== quantity) {
73
- dispatchInteractionChangeQuantity(quantity || 0);
74
- }
75
- }, [
76
- quantity
77
- ]);
78
- const dispatchInteractionChangeQuantity = (quantity)=>{
79
- trigger({
80
- event: 'gp:rollback:quantity-change',
81
- selector: `[data-id="${builderProps?.uid}"]`,
82
- element: ref.current
83
- });
84
- trigger({
85
- event: 'gp:quantity-change',
86
- selector: `[data-id="${builderProps?.uid}"]`,
87
- data: quantity,
88
- element: ref.current
89
- });
90
- };
91
- return /*#__PURE__*/ jsxRuntime.jsxs("div", {
92
- ref: ref,
93
- "data-id": builderProps?.uid,
94
- "data-disabled": !isInStock,
95
- className: "gp-relative gp-inline-flex gp-h-12 gp-w-full gp-bg-transparent gp-transition-all gp-duration-150 data-[disabled=true]:gp-opacity-60",
96
- style: {
97
- ...core.makeStyleResponsive('h', inputHeight),
98
- ...core.makeStyleResponsive('jc', align)
99
- },
100
- children: [
101
- qtyStyle === 'standard' && /*#__PURE__*/ jsxRuntime.jsx("button", {
102
- disabled: !isInStock,
103
- title: "Decrement",
104
- "aria-label": "decrement",
105
- onClick: decrement,
106
- className: core.cls(core.handleConvertClassColor(borderBtn), styleDisableBorderSeparate('left'), core.getGlobalColorStateClass('text', iconColor), core.getGlobalColorStateClass('bg', buttonBackgroundColor), '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'),
107
- style: {
108
- ...core.makeStyleResponsive('w', buttonWidth),
109
- ...core.getGlobalColorStateStyle('bg', buttonBackgroundColor),
110
- ...core.getGlobalColorStateStyle('c', iconColor),
111
- ...core.handleConvertBorderStyle(borderBtn),
112
- ...core.handleConvertBorderWidth(borderBtn),
113
- ...core.handleConvertBorderColor(borderBtn),
114
- ...core.composeRadius({
115
- desktop: {
116
- normal: {
117
- btlr: corner?.desktop?.normal?.btlr,
118
- bblr: corner?.desktop?.normal?.bblr,
119
- radiusType: corner?.desktop?.normal?.radiusType ?? 'custom'
120
- },
121
- hover: {
122
- btlr: corner?.desktop?.hover?.btlr,
123
- bblr: corner?.desktop?.hover?.bblr,
124
- radiusType: corner?.desktop?.hover?.radiusType ?? 'custom'
125
- }
126
- },
127
- tablet: {
128
- normal: {
129
- btlr: corner?.tablet?.normal?.btlr,
130
- bblr: corner?.tablet?.normal?.bblr,
131
- radiusType: corner?.tablet?.normal?.radiusType ?? 'custom'
132
- },
133
- hover: {
134
- btlr: corner?.tablet?.hover?.btlr,
135
- bblr: corner?.tablet?.hover?.bblr,
136
- radiusType: corner?.tablet?.hover?.radiusType ?? 'custom'
137
- }
138
- },
139
- mobile: {
140
- normal: {
141
- btlr: corner?.mobile?.normal?.btlr,
142
- bblr: corner?.mobile?.normal?.bblr,
143
- radiusType: corner?.mobile?.normal?.radiusType ?? 'custom'
144
- },
145
- hover: {
146
- btlr: corner?.mobile?.hover?.btlr,
147
- bblr: corner?.mobile?.hover?.bblr,
148
- radiusType: corner?.mobile?.hover?.radiusType ?? 'custom'
149
- }
150
- }
151
- })
152
- },
153
- children: /*#__PURE__*/ jsxRuntime.jsx("span", {
154
- className: "gp-inline-flex gp-items-center gp-justify-center",
155
- style: iconWidth,
156
- children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
157
- xmlns: "http://www.w3.org/2000/svg",
158
- className: "gp-h-full gp-w-full",
159
- fill: "none",
160
- viewBox: "0 0 24 24",
161
- stroke: "currentColor",
162
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
163
- strokeLinecap: "round",
164
- strokeLinejoin: "round",
165
- strokeWidth: 2,
166
- d: "M18 12H6"
167
- })
168
- })
169
- })
170
- }),
171
- /*#__PURE__*/ jsxRuntime.jsx("input", {
172
- disabled: !isInStock,
173
- type: qtyStyle === 'standard' ? 'text' : 'number',
174
- name: "quantity",
175
- className: core.cls(core.handleConvertClassColor(borderBtn), core.getGlobalColorStateClass('bg', inputBackgroundColor), core.getGlobalColorStateClass('text', textColor), appendTypoClass, qtyStyle === 'standard' ? '!gp-border-x-0' : '', {
176
- 'gp-px-4': qtyStyle === 'standard',
177
- 'gp-px-1': qtyStyle === 'minimalist'
178
- }, 'gp-flex gp-w-full gp-min-w-[45px] gp-shrink-[99999] gp-appearance-none gp-items-center gp-border-y gp-text-center gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed'),
179
- style: {
180
- ...qtyInputWidth,
181
- ...core.makeStyle({}),
182
- ...appendTypoStyle,
183
- ...core.getGlobalColorStateStyle('bg', inputBackgroundColor),
184
- ...core.getGlobalColorStateStyle('c', textColor),
185
- ...core.handleConvertBorderStyle(borderBtn),
186
- ...core.handleConvertBorderWidth(borderBtn),
187
- ...core.handleConvertBorderColor(borderBtn)
188
- },
189
- value: quantity,
190
- onChange: (e)=>{
191
- setQuantity(parseInt(e.target.value, 10));
192
- },
193
- step: 1,
194
- min: 1,
195
- "aria-label": "quantity",
196
- max: currentVariant?.manageInventory ? currentVariant?.inventoryQuantity ?? 1 : undefined,
197
- inputMode: "numeric"
198
- }),
199
- qtyStyle === 'standard' && /*#__PURE__*/ jsxRuntime.jsx("button", {
200
- disabled: !isInStock,
201
- "aria-label": "increment",
202
- title: "Increment",
203
- onClick: increment,
204
- className: core.cls(styleDisableBorderSeparate('right'), core.handleConvertClassColor(borderBtn), core.getGlobalColorStateClass('text', iconColor), core.getGlobalColorStateClass('bg', buttonBackgroundColor), 'gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none gp-transition-all gp-duration-150 disabled:gp-cursor-not-allowed'),
205
- style: {
206
- ...core.makeStyleResponsive('w', buttonWidth),
207
- ...core.getGlobalColorStateStyle('bg', buttonBackgroundColor),
208
- ...core.getGlobalColorStateStyle('c', iconColor),
209
- ...core.handleConvertBorderStyle(borderBtn),
210
- ...core.handleConvertBorderWidth(borderBtn),
211
- ...core.handleConvertBorderColor(borderBtn),
212
- ...core.composeRadius({
213
- desktop: {
214
- normal: {
215
- btrr: corner?.desktop?.normal?.btrr,
216
- bbrr: corner?.desktop?.normal?.bbrr,
217
- radiusType: corner?.desktop?.normal?.radiusType ?? 'custom'
218
- },
219
- hover: {
220
- btrr: corner?.desktop?.hover?.btrr,
221
- bbrr: corner?.desktop?.hover?.bbrr,
222
- radiusType: corner?.desktop?.hover?.radiusType ?? 'custom'
223
- }
224
- },
225
- tablet: {
226
- normal: {
227
- btrr: corner?.tablet?.normal?.btrr,
228
- bbrr: corner?.tablet?.normal?.bbrr,
229
- radiusType: corner?.tablet?.normal?.radiusType ?? 'custom'
230
- },
231
- hover: {
232
- btrr: corner?.tablet?.hover?.btrr,
233
- bbrr: corner?.tablet?.hover?.bbrr,
234
- radiusType: corner?.tablet?.hover?.radiusType ?? 'custom'
235
- }
236
- },
237
- mobile: {
238
- normal: {
239
- btrr: corner?.mobile?.normal?.btrr,
240
- bbrr: corner?.mobile?.normal?.bbrr,
241
- radiusType: corner?.mobile?.normal?.radiusType ?? 'custom'
242
- },
243
- hover: {
244
- btrr: corner?.mobile?.hover?.btrr,
245
- bbrr: corner?.mobile?.hover?.bbrr,
246
- radiusType: corner?.mobile?.hover?.radiusType ?? 'custom'
247
- }
248
- }
249
- })
250
- },
251
- children: /*#__PURE__*/ jsxRuntime.jsx("span", {
252
- className: "gp-inline-flex gp-items-center gp-justify-center",
253
- style: iconWidth,
254
- children: /*#__PURE__*/ jsxRuntime.jsx("svg", {
255
- xmlns: "http://www.w3.org/2000/svg",
256
- className: "gp-h-full gp-w-full",
257
- fill: "none",
258
- viewBox: "0 0 24 24",
259
- stroke: "currentColor",
260
- children: /*#__PURE__*/ jsxRuntime.jsx("path", {
261
- strokeLinecap: "round",
262
- strokeLinejoin: "round",
263
- strokeWidth: 2,
264
- d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
265
- })
266
- })
267
- })
268
- })
269
- ]
270
- });
271
- };
272
-
273
- exports.default = ProductQuantity;
@@ -1,269 +0,0 @@
1
- 'use client';
2
- import { jsxs, jsx } from 'react/jsx-runtime';
3
- import { useProduct, useCurrentVariant, useIsSyncProduct, useQuantity, useInteraction, makeStyleResponsive, makeWidth, useCurrentVariantInStock, composeTypographyClassName, composeTypographyStyle, cls, handleConvertClassColor, getGlobalColorStateClass, getGlobalColorStateStyle, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor, composeRadius, makeStyle } from '@gem-sdk/core';
4
- import { useRef, useEffect } from 'react';
5
- import { useTransition } from './ProductVariants/common/common.js';
6
-
7
- const ProductQuantity = ({ setting = {}, styles = {}, builderProps })=>{
8
- const ref = useRef(null);
9
- const product = useProduct();
10
- const currentVariant = useCurrentVariant();
11
- const isSyncProduct = useIsSyncProduct();
12
- const { quantity, increment, decrement, setQuantity, setUpdatePrice } = useQuantity();
13
- const { qtyStyle, updatePrice } = setting;
14
- const defaultQty = setting.defaultQtyValue || 1;
15
- const { inputWidth, fullWidth, inputHeight, buttonBackgroundColor, iconColor, inputBackgroundColor, textColor, align, lineSeparated, borderBtn, buttonWidth, iconSizeCustom, corner } = styles;
16
- const { trigger } = useInteraction();
17
- useEffect(()=>{
18
- setQuantity(parseFloat(`${defaultQty}`));
19
- }, [
20
- setQuantity,
21
- defaultQty
22
- ]);
23
- useEffect(()=>{
24
- setUpdatePrice(updatePrice || false);
25
- }, [
26
- updatePrice,
27
- setUpdatePrice
28
- ]);
29
- const styleDisableBorderSeparate = (buttonSide)=>{
30
- const classes = [];
31
- if (!lineSeparated) {
32
- classes.push(buttonSide === 'left' ? '!gp-border-r-0' : '!gp-border-l-0');
33
- }
34
- return classes.join(' ');
35
- };
36
- const typeCheck = (iconSizeCustom)=>{
37
- let check = true;
38
- Object.keys(iconSizeCustom ?? {}).forEach((key)=>{
39
- if (typeof (iconSizeCustom ?? {})[key] != 'string' && typeof (iconSizeCustom ?? {})[key] != 'number') {
40
- check = false;
41
- }
42
- });
43
- return check ? makeStyleResponsive('w', iconSizeCustom) : makeStyleResponsive('w', {
44
- desktop: (iconSizeCustom?.['desktop'])?.width,
45
- tablet: (iconSizeCustom?.['tablet'])?.width,
46
- mobile: (iconSizeCustom?.['mobile'])?.width
47
- });
48
- };
49
- const iconWidth = typeCheck(iconSizeCustom);
50
- const qtyInputWidth = makeStyleResponsive('maxw', makeWidth(inputWidth, fullWidth));
51
- const isInStock = useCurrentVariantInStock();
52
- const appendTypoClass = composeTypographyClassName(styles.typo, styles.typography);
53
- const appendTypoStyle = composeTypographyStyle(styles.typo, styles.typography);
54
- const onHandleQuantity = (e)=>{
55
- const event = e;
56
- const data = event.detail;
57
- const currentProductId = product?.id;
58
- if (isSyncProduct && data && currentProductId == data.productId && quantity != data.quantity) {
59
- dispatchInteractionChangeQuantity(data.quantity);
60
- setQuantity(data.quantity);
61
- }
62
- };
63
- useEffect(()=>{
64
- window.removeEventListener('set-product-quantity', onHandleQuantity);
65
- window.addEventListener('set-product-quantity', onHandleQuantity);
66
- });
67
- useTransition((preQuantity)=>{
68
- if (preQuantity !== quantity) {
69
- dispatchInteractionChangeQuantity(quantity || 0);
70
- }
71
- }, [
72
- quantity
73
- ]);
74
- const dispatchInteractionChangeQuantity = (quantity)=>{
75
- trigger({
76
- event: 'gp:rollback:quantity-change',
77
- selector: `[data-id="${builderProps?.uid}"]`,
78
- element: ref.current
79
- });
80
- trigger({
81
- event: 'gp:quantity-change',
82
- selector: `[data-id="${builderProps?.uid}"]`,
83
- data: quantity,
84
- element: ref.current
85
- });
86
- };
87
- return /*#__PURE__*/ jsxs("div", {
88
- ref: ref,
89
- "data-id": builderProps?.uid,
90
- "data-disabled": !isInStock,
91
- className: "gp-relative gp-inline-flex gp-h-12 gp-w-full gp-bg-transparent gp-transition-all gp-duration-150 data-[disabled=true]:gp-opacity-60",
92
- style: {
93
- ...makeStyleResponsive('h', inputHeight),
94
- ...makeStyleResponsive('jc', align)
95
- },
96
- children: [
97
- qtyStyle === 'standard' && /*#__PURE__*/ jsx("button", {
98
- disabled: !isInStock,
99
- title: "Decrement",
100
- "aria-label": "decrement",
101
- onClick: decrement,
102
- className: cls(handleConvertClassColor(borderBtn), styleDisableBorderSeparate('left'), getGlobalColorStateClass('text', iconColor), getGlobalColorStateClass('bg', buttonBackgroundColor), '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'),
103
- style: {
104
- ...makeStyleResponsive('w', buttonWidth),
105
- ...getGlobalColorStateStyle('bg', buttonBackgroundColor),
106
- ...getGlobalColorStateStyle('c', iconColor),
107
- ...handleConvertBorderStyle(borderBtn),
108
- ...handleConvertBorderWidth(borderBtn),
109
- ...handleConvertBorderColor(borderBtn),
110
- ...composeRadius({
111
- desktop: {
112
- normal: {
113
- btlr: corner?.desktop?.normal?.btlr,
114
- bblr: corner?.desktop?.normal?.bblr,
115
- radiusType: corner?.desktop?.normal?.radiusType ?? 'custom'
116
- },
117
- hover: {
118
- btlr: corner?.desktop?.hover?.btlr,
119
- bblr: corner?.desktop?.hover?.bblr,
120
- radiusType: corner?.desktop?.hover?.radiusType ?? 'custom'
121
- }
122
- },
123
- tablet: {
124
- normal: {
125
- btlr: corner?.tablet?.normal?.btlr,
126
- bblr: corner?.tablet?.normal?.bblr,
127
- radiusType: corner?.tablet?.normal?.radiusType ?? 'custom'
128
- },
129
- hover: {
130
- btlr: corner?.tablet?.hover?.btlr,
131
- bblr: corner?.tablet?.hover?.bblr,
132
- radiusType: corner?.tablet?.hover?.radiusType ?? 'custom'
133
- }
134
- },
135
- mobile: {
136
- normal: {
137
- btlr: corner?.mobile?.normal?.btlr,
138
- bblr: corner?.mobile?.normal?.bblr,
139
- radiusType: corner?.mobile?.normal?.radiusType ?? 'custom'
140
- },
141
- hover: {
142
- btlr: corner?.mobile?.hover?.btlr,
143
- bblr: corner?.mobile?.hover?.bblr,
144
- radiusType: corner?.mobile?.hover?.radiusType ?? 'custom'
145
- }
146
- }
147
- })
148
- },
149
- children: /*#__PURE__*/ jsx("span", {
150
- className: "gp-inline-flex gp-items-center gp-justify-center",
151
- style: iconWidth,
152
- children: /*#__PURE__*/ jsx("svg", {
153
- xmlns: "http://www.w3.org/2000/svg",
154
- className: "gp-h-full gp-w-full",
155
- fill: "none",
156
- viewBox: "0 0 24 24",
157
- stroke: "currentColor",
158
- children: /*#__PURE__*/ jsx("path", {
159
- strokeLinecap: "round",
160
- strokeLinejoin: "round",
161
- strokeWidth: 2,
162
- d: "M18 12H6"
163
- })
164
- })
165
- })
166
- }),
167
- /*#__PURE__*/ jsx("input", {
168
- disabled: !isInStock,
169
- type: qtyStyle === 'standard' ? 'text' : 'number',
170
- name: "quantity",
171
- className: cls(handleConvertClassColor(borderBtn), getGlobalColorStateClass('bg', inputBackgroundColor), getGlobalColorStateClass('text', textColor), appendTypoClass, qtyStyle === 'standard' ? '!gp-border-x-0' : '', {
172
- 'gp-px-4': qtyStyle === 'standard',
173
- 'gp-px-1': qtyStyle === 'minimalist'
174
- }, 'gp-flex gp-w-full gp-min-w-[45px] gp-shrink-[99999] gp-appearance-none gp-items-center gp-border-y gp-text-center gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed'),
175
- style: {
176
- ...qtyInputWidth,
177
- ...makeStyle({}),
178
- ...appendTypoStyle,
179
- ...getGlobalColorStateStyle('bg', inputBackgroundColor),
180
- ...getGlobalColorStateStyle('c', textColor),
181
- ...handleConvertBorderStyle(borderBtn),
182
- ...handleConvertBorderWidth(borderBtn),
183
- ...handleConvertBorderColor(borderBtn)
184
- },
185
- value: quantity,
186
- onChange: (e)=>{
187
- setQuantity(parseInt(e.target.value, 10));
188
- },
189
- step: 1,
190
- min: 1,
191
- "aria-label": "quantity",
192
- max: currentVariant?.manageInventory ? currentVariant?.inventoryQuantity ?? 1 : undefined,
193
- inputMode: "numeric"
194
- }),
195
- qtyStyle === 'standard' && /*#__PURE__*/ jsx("button", {
196
- disabled: !isInStock,
197
- "aria-label": "increment",
198
- title: "Increment",
199
- onClick: increment,
200
- className: cls(styleDisableBorderSeparate('right'), handleConvertClassColor(borderBtn), getGlobalColorStateClass('text', iconColor), getGlobalColorStateClass('bg', buttonBackgroundColor), 'gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none gp-transition-all gp-duration-150 disabled:gp-cursor-not-allowed'),
201
- style: {
202
- ...makeStyleResponsive('w', buttonWidth),
203
- ...getGlobalColorStateStyle('bg', buttonBackgroundColor),
204
- ...getGlobalColorStateStyle('c', iconColor),
205
- ...handleConvertBorderStyle(borderBtn),
206
- ...handleConvertBorderWidth(borderBtn),
207
- ...handleConvertBorderColor(borderBtn),
208
- ...composeRadius({
209
- desktop: {
210
- normal: {
211
- btrr: corner?.desktop?.normal?.btrr,
212
- bbrr: corner?.desktop?.normal?.bbrr,
213
- radiusType: corner?.desktop?.normal?.radiusType ?? 'custom'
214
- },
215
- hover: {
216
- btrr: corner?.desktop?.hover?.btrr,
217
- bbrr: corner?.desktop?.hover?.bbrr,
218
- radiusType: corner?.desktop?.hover?.radiusType ?? 'custom'
219
- }
220
- },
221
- tablet: {
222
- normal: {
223
- btrr: corner?.tablet?.normal?.btrr,
224
- bbrr: corner?.tablet?.normal?.bbrr,
225
- radiusType: corner?.tablet?.normal?.radiusType ?? 'custom'
226
- },
227
- hover: {
228
- btrr: corner?.tablet?.hover?.btrr,
229
- bbrr: corner?.tablet?.hover?.bbrr,
230
- radiusType: corner?.tablet?.hover?.radiusType ?? 'custom'
231
- }
232
- },
233
- mobile: {
234
- normal: {
235
- btrr: corner?.mobile?.normal?.btrr,
236
- bbrr: corner?.mobile?.normal?.bbrr,
237
- radiusType: corner?.mobile?.normal?.radiusType ?? 'custom'
238
- },
239
- hover: {
240
- btrr: corner?.mobile?.hover?.btrr,
241
- bbrr: corner?.mobile?.hover?.bbrr,
242
- radiusType: corner?.mobile?.hover?.radiusType ?? 'custom'
243
- }
244
- }
245
- })
246
- },
247
- children: /*#__PURE__*/ jsx("span", {
248
- className: "gp-inline-flex gp-items-center gp-justify-center",
249
- style: iconWidth,
250
- children: /*#__PURE__*/ jsx("svg", {
251
- xmlns: "http://www.w3.org/2000/svg",
252
- className: "gp-h-full gp-w-full",
253
- fill: "none",
254
- viewBox: "0 0 24 24",
255
- stroke: "currentColor",
256
- children: /*#__PURE__*/ jsx("path", {
257
- strokeLinecap: "round",
258
- strokeLinejoin: "round",
259
- strokeWidth: 2,
260
- d: "M12 6v6m0 0v6m0-6h6m-6 0H6"
261
- })
262
- })
263
- })
264
- })
265
- ]
266
- });
267
- };
268
-
269
- export { ProductQuantity as default };