@gem-sdk/components 2.0.0-dev.358 → 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.
- package/dist/cjs/builder.js +14 -14
- package/dist/cjs/grid/row/setting/configs/uiV2.js +44 -0
- package/dist/cjs/grid/section/setting/configs/uiV2.js +44 -0
- package/dist/cjs/heading/setting/configs/settings.js +5 -2
- package/dist/cjs/index.js +40 -40
- package/dist/cjs/post-purchase/product/settings/product-image/setting-v2.js +5 -1
- package/dist/cjs/product/components/ProductQuantity/common/common.js +17 -0
- package/dist/cjs/product/components/ProductQuantity/hooks/index.js +68 -0
- package/dist/cjs/product/components/ProductQuantity/index.js +168 -0
- package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +2 -2
- package/dist/cjs/product/components/ProductVariants/common/dropdown/styles.js +2 -6
- package/dist/cjs/product/components/ProductVariants/components/dropdown-swatches/Dropdown.js +3 -3
- package/dist/cjs/product/components/ProductVariants/components/dropdown-swatches/Dropdown.liquid.js +2 -2
- package/dist/cjs/product/index.js +6 -6
- package/dist/cjs/product/next.js +1 -1
- package/dist/cjs/product/setting/product-quantity/configs/settings.js +1 -0
- package/dist/cjs/product/setting/product-quantity/configs/uiV2.js +13 -6
- package/dist/cjs/product/setting/product-variant/configs/settings.js +6 -3
- package/dist/cjs/product/setting/product-variant/configs/uiV2.js +107 -1
- package/dist/cjs/text/components/common/getStyle.js +1 -2
- package/dist/cjs/text/setting/configs/settings.js +5 -2
- package/dist/esm/builder.js +1 -1
- package/dist/esm/grid/row/setting/configs/uiV2.js +44 -0
- package/dist/esm/grid/section/setting/configs/uiV2.js +44 -0
- package/dist/esm/heading/setting/configs/settings.js +5 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/post-purchase/product/settings/product-image/setting-v2.js +5 -1
- package/dist/esm/product/components/ProductQuantity/common/common.js +17 -1
- package/dist/esm/product/components/ProductQuantity/hooks/index.js +66 -0
- package/dist/esm/product/components/ProductQuantity/index.js +164 -0
- package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +1 -1
- package/dist/esm/product/components/ProductVariants/common/dropdown/styles.js +2 -6
- package/dist/esm/product/components/ProductVariants/components/dropdown-swatches/Dropdown.js +3 -3
- package/dist/esm/product/components/ProductVariants/components/dropdown-swatches/Dropdown.liquid.js +2 -2
- package/dist/esm/product/next.js +1 -1
- package/dist/esm/product/setting/product-quantity/configs/settings.js +1 -0
- package/dist/esm/product/setting/product-quantity/configs/uiV2.js +13 -6
- package/dist/esm/product/setting/product-variant/configs/settings.js +6 -3
- package/dist/esm/product/setting/product-variant/configs/uiV2.js +107 -1
- package/dist/esm/text/components/common/getStyle.js +2 -3
- package/dist/esm/text/setting/configs/settings.js +5 -2
- package/dist/types/index.d.ts +3 -27
- package/package.json +2 -2
- package/dist/cjs/product/components/ProductQuantity.js +0 -273
- package/dist/esm/product/components/ProductQuantity.js +0 -269
package/dist/cjs/builder.js
CHANGED
|
@@ -223,15 +223,15 @@ var HextomFreeShippingBar = require('./third-party/components/HextomFreeShipping
|
|
|
223
223
|
var EcoboostifyShoppableReelUgc = require('./third-party/components/EcoboostifyShoppableReelUgc.js');
|
|
224
224
|
var Product = require('./product/components/ProductWrap/Product.js');
|
|
225
225
|
var index$4 = require('./product/components/ProductTitle/index.js');
|
|
226
|
-
var
|
|
227
|
-
var index$
|
|
228
|
-
var index$
|
|
226
|
+
var index$5 = require('./product/components/ProductQuantity/index.js');
|
|
227
|
+
var index$7 = require('./product/components/ProductDescription/index.js');
|
|
228
|
+
var index$6 = require('./product/components/ProductPrice/index.js');
|
|
229
229
|
var ProductButton = require('./product/components/ProductButton/ProductButton.js');
|
|
230
|
-
var index$
|
|
230
|
+
var index$8 = require('./product/components/ProductVariants/index.js');
|
|
231
231
|
var ProductImages = require('./product/components/ProductImages.js');
|
|
232
|
-
var index$
|
|
232
|
+
var index$9 = require('./product/components/ProductImagesV2/index.js');
|
|
233
233
|
var ProductProperties = require('./product/components/ProductProperties/ProductProperties.js');
|
|
234
|
-
var index$
|
|
234
|
+
var index$a = require('./product/components/ProductQuickView/index.js');
|
|
235
235
|
var ProductTag = require('./product/components/ProductTag/ProductTag.js');
|
|
236
236
|
var ProductList = require('./product/components/ProductList/ProductList.js');
|
|
237
237
|
var DynamicCheckout = require('./product/components/DynamicCheckout/DynamicCheckout.js');
|
|
@@ -239,7 +239,7 @@ var ProductBundleDiscount = require('./product/components/ProductBundle/componen
|
|
|
239
239
|
var Vendor = require('./product/components/ProductVendor/Vendor.js');
|
|
240
240
|
var Sku = require('./product/components/ProductSKU/Sku.js');
|
|
241
241
|
var ProductViewMore = require('./product/components/ProductViewMore/ProductViewMore.js');
|
|
242
|
-
var index$
|
|
242
|
+
var index$b = require('./product/components/ProductBadge/index.js');
|
|
243
243
|
var UploadFile = require('./product/components/FileUpload/components/UploadFile.js');
|
|
244
244
|
var ProductBundleDiscountItem = require('./product/components/ProductBundle/components/ProductBundleDiscountItem.js');
|
|
245
245
|
var Radio = require('./radio/Radio.js');
|
|
@@ -423,19 +423,19 @@ var builder = {
|
|
|
423
423
|
RechargeSubscriptions: RechargeSubscriptions.default,
|
|
424
424
|
Product: Product.default,
|
|
425
425
|
ProductTitle: index$4.default,
|
|
426
|
-
ProductQuantity:
|
|
427
|
-
ProductPrice: index$
|
|
426
|
+
ProductQuantity: index$5.default,
|
|
427
|
+
ProductPrice: index$6.default,
|
|
428
428
|
ProductSku: Sku.default,
|
|
429
429
|
FileUpload: UploadFile.default,
|
|
430
430
|
ProductBundleDiscount: ProductBundleDiscount.default,
|
|
431
431
|
ProductBundleDiscountItem: ProductBundleDiscountItem.default,
|
|
432
432
|
ProductButton: ProductButton.default,
|
|
433
|
-
ProductDescription: index$
|
|
434
|
-
ProductVariants: index$
|
|
433
|
+
ProductDescription: index$7.default,
|
|
434
|
+
ProductVariants: index$8.default,
|
|
435
435
|
ProductImages: ProductImages.default,
|
|
436
|
-
ProductImagesV2: index$
|
|
436
|
+
ProductImagesV2: index$9.default,
|
|
437
437
|
ProductProperties: ProductProperties.default,
|
|
438
|
-
ProductQuickView: index$
|
|
438
|
+
ProductQuickView: index$a.default,
|
|
439
439
|
ProductTag: ProductTag.default,
|
|
440
440
|
ProductList: ProductList.default,
|
|
441
441
|
Radio: Radio.default,
|
|
@@ -501,7 +501,7 @@ var builder = {
|
|
|
501
501
|
ProductVendor: Vendor.default,
|
|
502
502
|
KingProductOptions: KingProductOptions.default,
|
|
503
503
|
ProductViewMore: ProductViewMore.default,
|
|
504
|
-
ProductBadge: index$
|
|
504
|
+
ProductBadge: index$b.default,
|
|
505
505
|
HextomCountdownTimerBar: HextomCountdownTimerBar.default,
|
|
506
506
|
TrustBadgesBear: TrustBadgesBear.default,
|
|
507
507
|
TrustedsiteTrustBadges: TrustedsiteTrustBadges.default,
|
|
@@ -208,6 +208,50 @@ const SettingUIV2 = [
|
|
|
208
208
|
setting: {
|
|
209
209
|
id: 'boxShadow',
|
|
210
210
|
state: 'normal'
|
|
211
|
+
},
|
|
212
|
+
options: {
|
|
213
|
+
updateFields: [
|
|
214
|
+
{
|
|
215
|
+
field: 'enable',
|
|
216
|
+
settingId: 'advanced.hasBoxShadow',
|
|
217
|
+
state: 'normal'
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
controlChangeTrigger: {
|
|
222
|
+
settings: [
|
|
223
|
+
{
|
|
224
|
+
condition: `boxShadow.normal.enable === true`,
|
|
225
|
+
source: [
|
|
226
|
+
'boxShadow',
|
|
227
|
+
'hasBoxShadow'
|
|
228
|
+
],
|
|
229
|
+
action: {
|
|
230
|
+
controlId: 'hasBoxShadow',
|
|
231
|
+
groupType: 'advanced',
|
|
232
|
+
controlType: 'advanced',
|
|
233
|
+
state: 'normal',
|
|
234
|
+
newValue: true
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
condition: `boxShadow.normal.enable === false`,
|
|
239
|
+
source: [
|
|
240
|
+
'boxShadow',
|
|
241
|
+
'hasBoxShadow'
|
|
242
|
+
],
|
|
243
|
+
action: {
|
|
244
|
+
controlId: 'hasBoxShadow',
|
|
245
|
+
groupType: 'advanced',
|
|
246
|
+
controlType: 'advanced',
|
|
247
|
+
state: 'normal',
|
|
248
|
+
newValue: false
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
],
|
|
252
|
+
options: {
|
|
253
|
+
noRecordHistory: true
|
|
254
|
+
}
|
|
211
255
|
}
|
|
212
256
|
}
|
|
213
257
|
]
|
|
@@ -212,6 +212,50 @@ const SettingUIV2 = [
|
|
|
212
212
|
controlConfig: {
|
|
213
213
|
id: 'boxShadow',
|
|
214
214
|
type: 'shadow-v2'
|
|
215
|
+
},
|
|
216
|
+
options: {
|
|
217
|
+
updateFields: [
|
|
218
|
+
{
|
|
219
|
+
field: 'enable',
|
|
220
|
+
settingId: 'advanced.hasBoxShadow',
|
|
221
|
+
state: 'normal'
|
|
222
|
+
}
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
controlChangeTrigger: {
|
|
226
|
+
settings: [
|
|
227
|
+
{
|
|
228
|
+
condition: `boxShadow.normal.enable === true`,
|
|
229
|
+
source: [
|
|
230
|
+
'boxShadow',
|
|
231
|
+
'hasBoxShadow'
|
|
232
|
+
],
|
|
233
|
+
action: {
|
|
234
|
+
controlId: 'hasBoxShadow',
|
|
235
|
+
groupType: 'advanced',
|
|
236
|
+
controlType: 'advanced',
|
|
237
|
+
state: 'normal',
|
|
238
|
+
newValue: true
|
|
239
|
+
}
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
condition: `boxShadow.normal.enable === false`,
|
|
243
|
+
source: [
|
|
244
|
+
'boxShadow',
|
|
245
|
+
'hasBoxShadow'
|
|
246
|
+
],
|
|
247
|
+
action: {
|
|
248
|
+
controlId: 'hasBoxShadow',
|
|
249
|
+
groupType: 'advanced',
|
|
250
|
+
controlType: 'advanced',
|
|
251
|
+
state: 'normal',
|
|
252
|
+
newValue: false
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
],
|
|
256
|
+
options: {
|
|
257
|
+
noRecordHistory: true
|
|
258
|
+
}
|
|
215
259
|
}
|
|
216
260
|
}
|
|
217
261
|
]
|
|
@@ -318,7 +318,9 @@ const HeadingSettings = [
|
|
|
318
318
|
type: 'shadow-v2',
|
|
319
319
|
devices: {
|
|
320
320
|
desktop: {
|
|
321
|
-
default: {
|
|
321
|
+
default: {
|
|
322
|
+
enable: false
|
|
323
|
+
}
|
|
322
324
|
}
|
|
323
325
|
},
|
|
324
326
|
compoDefaultValue: {
|
|
@@ -329,7 +331,8 @@ const HeadingSettings = [
|
|
|
329
331
|
blur: '12px',
|
|
330
332
|
spread: '0px',
|
|
331
333
|
color: 'rgba(18, 18, 18, 0.2)',
|
|
332
|
-
angle: 45
|
|
334
|
+
angle: 45,
|
|
335
|
+
enable: true
|
|
333
336
|
}
|
|
334
337
|
}
|
|
335
338
|
}
|
package/dist/cjs/index.js
CHANGED
|
@@ -42,20 +42,20 @@ var index$C = require('./post-purchase/line/index.js');
|
|
|
42
42
|
var index$D = require('./post-purchase/link/index.js');
|
|
43
43
|
var index$E = require('./post-purchase/text/index.js');
|
|
44
44
|
var index$G = require('./post-purchase/product/index.js');
|
|
45
|
-
var index$
|
|
46
|
-
var index$
|
|
47
|
-
var index$
|
|
48
|
-
var index$
|
|
49
|
-
var index$
|
|
50
|
-
var index$
|
|
51
|
-
var index$
|
|
45
|
+
var index$P = require('./product/index.js');
|
|
46
|
+
var index$Q = require('./radio/index.js');
|
|
47
|
+
var index$R = require('./select/index.js');
|
|
48
|
+
var index$S = require('./tab/index.js');
|
|
49
|
+
var index$T = require('./text/index.js');
|
|
50
|
+
var index$U = require('./textarea/index.js');
|
|
51
|
+
var index$V = require('./video/index.js');
|
|
52
52
|
var useInView = require('./intersection-observer/useInView.js');
|
|
53
|
-
var index$
|
|
54
|
-
var index$
|
|
55
|
-
var index$
|
|
56
|
-
var index$
|
|
57
|
-
var index$
|
|
58
|
-
var index
|
|
53
|
+
var index$W = require('./third-party/index.js');
|
|
54
|
+
var index$X = require('./third-party-instant/index.js');
|
|
55
|
+
var index$Y = require('./stock-counter/index.js');
|
|
56
|
+
var index$Z = require('./third-party-slot/index.js');
|
|
57
|
+
var index$_ = require('./shop-pay-installment/index.js');
|
|
58
|
+
var index$$ = require('./sticky/index.js');
|
|
59
59
|
var next = require('./next.js');
|
|
60
60
|
var index_liquid = require('./index.liquid.js');
|
|
61
61
|
var builder = require('./builder.js');
|
|
@@ -170,21 +170,21 @@ var product2Col = require('./post-purchase/product/settings/presets-config/produ
|
|
|
170
170
|
var productDefault = require('./post-purchase/product/settings/presets-config/product-presets/product-default.js');
|
|
171
171
|
var Product = require('./product/components/ProductWrap/Product.js');
|
|
172
172
|
var index$H = require('./product/components/ProductTitle/index.js');
|
|
173
|
-
var
|
|
174
|
-
var index$
|
|
173
|
+
var index$I = require('./product/components/ProductQuantity/index.js');
|
|
174
|
+
var index$J = require('./product/components/ProductPrice/index.js');
|
|
175
175
|
var ProductButton = require('./product/components/ProductButton/ProductButton.js');
|
|
176
|
-
var index$
|
|
177
|
-
var index$
|
|
176
|
+
var index$K = require('./product/components/ProductDescription/index.js');
|
|
177
|
+
var index$L = require('./product/components/ProductVariants/index.js');
|
|
178
178
|
var ProductImages = require('./product/components/ProductImages.js');
|
|
179
|
-
var index$
|
|
179
|
+
var index$M = require('./product/components/ProductImagesV2/index.js');
|
|
180
180
|
var ProductProperties = require('./product/components/ProductProperties/ProductProperties.js');
|
|
181
|
-
var index$
|
|
181
|
+
var index$N = require('./product/components/ProductQuickView/index.js');
|
|
182
182
|
var ProductTag = require('./product/components/ProductTag/ProductTag.js');
|
|
183
183
|
var ProductList = require('./product/components/ProductList/ProductList.js');
|
|
184
184
|
var Vendor = require('./product/components/ProductVendor/Vendor.js');
|
|
185
185
|
var DynamicCheckout = require('./product/components/DynamicCheckout/DynamicCheckout.js');
|
|
186
186
|
var ProductViewMore = require('./product/components/ProductViewMore/ProductViewMore.js');
|
|
187
|
-
var index$
|
|
187
|
+
var index$O = require('./product/components/ProductBadge/index.js');
|
|
188
188
|
var ProductBundleDiscount = require('./product/components/ProductBundle/components/ProductBundleDiscount.js');
|
|
189
189
|
var ProductBundleDiscountItem = require('./product/components/ProductBundle/components/ProductBundleDiscountItem.js');
|
|
190
190
|
var Sku = require('./product/components/ProductSKU/Sku.js');
|
|
@@ -363,20 +363,20 @@ exports.postPurchaseLinkSetting = index$D.postPurchaseLinkSetting;
|
|
|
363
363
|
exports.PostPurchaseHeading = index$E.PostPurchaseHeading;
|
|
364
364
|
exports.postPurchaseTextSetting = index$E.postPurchaseTextSetting;
|
|
365
365
|
exports.postPurchaseProductSetting = index$G.postPurchaseProductSetting;
|
|
366
|
-
exports.productSetting = index$
|
|
367
|
-
exports.radioSetting = index$
|
|
368
|
-
exports.selectSetting = index$
|
|
369
|
-
exports.tabSetting = index$
|
|
370
|
-
exports.textSetting = index$
|
|
371
|
-
exports.textareaSetting = index$
|
|
372
|
-
exports.videoSetting = index$
|
|
366
|
+
exports.productSetting = index$P.productSetting;
|
|
367
|
+
exports.radioSetting = index$Q.radioSetting;
|
|
368
|
+
exports.selectSetting = index$R.selectSetting;
|
|
369
|
+
exports.tabSetting = index$S.tabSetting;
|
|
370
|
+
exports.textSetting = index$T.textSetting;
|
|
371
|
+
exports.textareaSetting = index$U.textareaSetting;
|
|
372
|
+
exports.videoSetting = index$V.videoSetting;
|
|
373
373
|
exports.useInView = useInView.useInView;
|
|
374
|
-
exports.thirdPartySetting = index$
|
|
375
|
-
exports.thirdPartyInstantSetting = index$
|
|
376
|
-
exports.stockCounterSetting = index$
|
|
377
|
-
exports.thirdPartySlotSetting = index$
|
|
378
|
-
exports.shopPayInstallmentSetting = index$
|
|
379
|
-
exports.stickySetting = index
|
|
374
|
+
exports.thirdPartySetting = index$W.thirdPartySetting;
|
|
375
|
+
exports.thirdPartyInstantSetting = index$X.thirdPartyInstantSetting;
|
|
376
|
+
exports.stockCounterSetting = index$Y.stockCounterSetting;
|
|
377
|
+
exports.thirdPartySlotSetting = index$Z.thirdPartySlotSetting;
|
|
378
|
+
exports.shopPayInstallmentSetting = index$_.shopPayInstallmentSetting;
|
|
379
|
+
exports.stickySetting = index$$.stickySetting;
|
|
380
380
|
exports.nextComponent = next.default;
|
|
381
381
|
exports.liquidComponents = index_liquid;
|
|
382
382
|
exports.builderComponent = builder.default;
|
|
@@ -501,21 +501,21 @@ exports.postPurchaseProduct2Col = product2Col.postPurchaseProduct2Col;
|
|
|
501
501
|
exports.postPurchaseProductDefault = productDefault.postPurchaseProductDefault;
|
|
502
502
|
exports.Product = Product.default;
|
|
503
503
|
exports.ProductTitle = index$H.default;
|
|
504
|
-
exports.ProductQuantity =
|
|
505
|
-
exports.ProductPrice = index$
|
|
504
|
+
exports.ProductQuantity = index$I.default;
|
|
505
|
+
exports.ProductPrice = index$J.default;
|
|
506
506
|
exports.ProductButton = ProductButton.default;
|
|
507
|
-
exports.ProductDescription = index$
|
|
508
|
-
exports.ProductVariants = index$
|
|
507
|
+
exports.ProductDescription = index$K.default;
|
|
508
|
+
exports.ProductVariants = index$L.default;
|
|
509
509
|
exports.ProductImages = ProductImages.default;
|
|
510
|
-
exports.ProductImagesV2 = index$
|
|
510
|
+
exports.ProductImagesV2 = index$M.default;
|
|
511
511
|
exports.ProductPropertyInput = ProductProperties.default;
|
|
512
|
-
exports.ProductQuickView = index$
|
|
512
|
+
exports.ProductQuickView = index$N.default;
|
|
513
513
|
exports.ProductTag = ProductTag.default;
|
|
514
514
|
exports.ProductList = ProductList.default;
|
|
515
515
|
exports.ProductVendor = Vendor.default;
|
|
516
516
|
exports.DynamicCheckout = DynamicCheckout.default;
|
|
517
517
|
exports.ProductViewMore = ProductViewMore.default;
|
|
518
|
-
exports.ProductBadge = index$
|
|
518
|
+
exports.ProductBadge = index$O.default;
|
|
519
519
|
exports.ProductBundleDiscount = ProductBundleDiscount.default;
|
|
520
520
|
exports.ProductBundleDiscountItem = ProductBundleDiscountItem.default;
|
|
521
521
|
exports.ProductSku = Sku.default;
|
|
@@ -13,6 +13,22 @@ const getPlusIcon = (plusIcon)=>{
|
|
|
13
13
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M18 12H6" />
|
|
14
14
|
</svg>`;
|
|
15
15
|
};
|
|
16
|
+
const getMinusIcon = (minusIcon)=>{
|
|
17
|
+
return minusIcon ?? `<svg
|
|
18
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
+
fill="none"
|
|
20
|
+
viewBox="0 0 24 24"
|
|
21
|
+
stroke="currentColor"
|
|
22
|
+
>
|
|
23
|
+
<path
|
|
24
|
+
strokeLinecap="round"
|
|
25
|
+
strokeLinejoin="round"
|
|
26
|
+
strokeWidth={2}
|
|
27
|
+
d="M12 6v6m0 0v6m0-6h6m-6 0H6"
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
`;
|
|
31
|
+
};
|
|
16
32
|
const getIconWidth = (iconSizeCustom)=>{
|
|
17
33
|
let check = true;
|
|
18
34
|
Object.keys(iconSizeCustom ?? {}).forEach((key)=>{
|
|
@@ -28,4 +44,5 @@ const getIconWidth = (iconSizeCustom)=>{
|
|
|
28
44
|
};
|
|
29
45
|
|
|
30
46
|
exports.getIconWidth = getIconWidth;
|
|
47
|
+
exports.getMinusIcon = getMinusIcon;
|
|
31
48
|
exports.getPlusIcon = getPlusIcon;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var core = require('@gem-sdk/core');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var common = require('../../ProductVariants/common/common.js');
|
|
6
|
+
|
|
7
|
+
const useProductQuantity = (props)=>{
|
|
8
|
+
const { setting = {}, advanced } = props;
|
|
9
|
+
const { updatePrice } = setting;
|
|
10
|
+
const { quantity, setQuantity, setUpdatePrice } = core.useQuantity();
|
|
11
|
+
const isInStock = core.useCurrentVariantInStock();
|
|
12
|
+
const product = core.useProduct();
|
|
13
|
+
const isSyncProduct = core.useIsSyncProduct();
|
|
14
|
+
const { trigger } = core.useInteraction();
|
|
15
|
+
const ref = React.useRef(null);
|
|
16
|
+
const defaultQty = setting.defaultQtyValue || 1;
|
|
17
|
+
React.useEffect(()=>{
|
|
18
|
+
setQuantity(parseFloat(`${defaultQty}`));
|
|
19
|
+
}, [
|
|
20
|
+
setQuantity,
|
|
21
|
+
defaultQty
|
|
22
|
+
]);
|
|
23
|
+
React.useEffect(()=>{
|
|
24
|
+
setUpdatePrice(updatePrice || false);
|
|
25
|
+
}, [
|
|
26
|
+
updatePrice,
|
|
27
|
+
setUpdatePrice
|
|
28
|
+
]);
|
|
29
|
+
const onHandleQuantity = (e)=>{
|
|
30
|
+
const event = e;
|
|
31
|
+
const data = event.detail;
|
|
32
|
+
const currentProductId = product?.id;
|
|
33
|
+
if (isSyncProduct && data && currentProductId == data.productId && quantity != data.quantity) {
|
|
34
|
+
dispatchInteractionChangeQuantity(data.quantity);
|
|
35
|
+
setQuantity(data.quantity);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
React.useEffect(()=>{
|
|
39
|
+
window.removeEventListener('set-product-quantity', onHandleQuantity);
|
|
40
|
+
window.addEventListener('set-product-quantity', onHandleQuantity);
|
|
41
|
+
});
|
|
42
|
+
common.useTransition((preQuantity)=>{
|
|
43
|
+
if (preQuantity !== quantity) {
|
|
44
|
+
dispatchInteractionChangeQuantity(quantity || 0);
|
|
45
|
+
}
|
|
46
|
+
}, [
|
|
47
|
+
quantity
|
|
48
|
+
]);
|
|
49
|
+
const dispatchInteractionChangeQuantity = (quantity)=>{
|
|
50
|
+
trigger({
|
|
51
|
+
event: 'gp:rollback:quantity-change',
|
|
52
|
+
selector: `[data-id="${advanced?.uid}"]`,
|
|
53
|
+
element: ref.current
|
|
54
|
+
});
|
|
55
|
+
trigger({
|
|
56
|
+
event: 'gp:quantity-change',
|
|
57
|
+
selector: `[data-id="${advanced?.uid}"]`,
|
|
58
|
+
data: quantity,
|
|
59
|
+
element: ref.current
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
return {
|
|
63
|
+
isInStock,
|
|
64
|
+
ref
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
exports.useProductQuantity = useProductQuantity;
|
|
@@ -0,0 +1,168 @@
|
|
|
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 system = require('@gem-sdk/system');
|
|
9
|
+
var index = require('./hooks/index.js');
|
|
10
|
+
var common = require('./common/common.js');
|
|
11
|
+
var getAttrs = require('./common/getAttrs.js');
|
|
12
|
+
var getClasses = require('./common/getClasses.js');
|
|
13
|
+
var getStyles = require('./common/getStyles.js');
|
|
14
|
+
|
|
15
|
+
const ProductQuantity = (props)=>{
|
|
16
|
+
const { setting = {}, styles = {}, builderProps, advanced } = props;
|
|
17
|
+
const currentVariant = core.useCurrentVariant();
|
|
18
|
+
const { quantity, increment, decrement, setQuantity } = core.useQuantity();
|
|
19
|
+
const { isInStock, ref } = index.useProductQuantity(props);
|
|
20
|
+
const { qtyStyle, plusIcon, minusIcon } = setting;
|
|
21
|
+
const defaultQty = setting.defaultQtyValue || 1;
|
|
22
|
+
const { inputHeight, buttonBackgroundColor, backgroundColor, iconColor, inputBackgroundColor, textColor, align, borderBtn, buttonWidth, iconSizeCustom, corner } = styles;
|
|
23
|
+
const containerAttrs = system.createAttr({
|
|
24
|
+
...getAttrs.getContainerAttrs({
|
|
25
|
+
isDisabled: !isInStock,
|
|
26
|
+
uid: builderProps?.uid || ''
|
|
27
|
+
})
|
|
28
|
+
});
|
|
29
|
+
const containerClasses = system.createClass({
|
|
30
|
+
...getClasses.getContainerClasses(advanced?.cssClass)
|
|
31
|
+
});
|
|
32
|
+
const containerStyles = system.createStyle({
|
|
33
|
+
...getStyles.getContainerStyles({
|
|
34
|
+
align,
|
|
35
|
+
inputHeight
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
const wrapperClasses = system.createClass({
|
|
39
|
+
...getClasses.getWrapperClasses()
|
|
40
|
+
});
|
|
41
|
+
const wrapperStyles = system.createStyle({
|
|
42
|
+
...getStyles.getWrapperStyles({
|
|
43
|
+
backgroundColor,
|
|
44
|
+
styles
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
const inputAttrs = system.createAttr({
|
|
48
|
+
...getAttrs.getInputAttr({
|
|
49
|
+
isDisabled: !isInStock,
|
|
50
|
+
qtyStyle,
|
|
51
|
+
quantity,
|
|
52
|
+
currentVariant,
|
|
53
|
+
defaultQty
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
const inputClass = system.createClass({
|
|
57
|
+
...getClasses.getInputClasses({
|
|
58
|
+
styles,
|
|
59
|
+
qtyStyle,
|
|
60
|
+
borderBtn,
|
|
61
|
+
inputBackgroundColor,
|
|
62
|
+
textColor
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
const inputStyle = system.createStyle({
|
|
66
|
+
...getStyles.getInputStyle(props)
|
|
67
|
+
});
|
|
68
|
+
const buttonLeftClass = system.createClass({
|
|
69
|
+
...getClasses.getButtonClass({
|
|
70
|
+
borderBtn,
|
|
71
|
+
buttonBackgroundColor,
|
|
72
|
+
iconColor,
|
|
73
|
+
buttonSide: 'left'
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
const buttonLeftStyle = system.createStyle({
|
|
77
|
+
...getStyles.getButtonStyle({
|
|
78
|
+
borderBtn,
|
|
79
|
+
buttonWidth,
|
|
80
|
+
buttonBackgroundColor,
|
|
81
|
+
iconColor,
|
|
82
|
+
corner,
|
|
83
|
+
buttonSide: 'left'
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
const buttonLeftAttrs = system.createAttr({
|
|
87
|
+
...getAttrs.getButtonAttrs({
|
|
88
|
+
isDisabled: !isInStock,
|
|
89
|
+
buttonSide: 'left'
|
|
90
|
+
})
|
|
91
|
+
});
|
|
92
|
+
const buttonRightClass = system.createClass({
|
|
93
|
+
...getClasses.getButtonClass({
|
|
94
|
+
borderBtn,
|
|
95
|
+
buttonBackgroundColor,
|
|
96
|
+
iconColor,
|
|
97
|
+
buttonSide: 'right'
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
const buttonRightStyle = system.createStyle({
|
|
101
|
+
...getStyles.getButtonStyle({
|
|
102
|
+
borderBtn,
|
|
103
|
+
buttonWidth,
|
|
104
|
+
buttonBackgroundColor,
|
|
105
|
+
iconColor,
|
|
106
|
+
corner,
|
|
107
|
+
buttonSide: 'right'
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
const buttonRightAttrs = system.createAttr({
|
|
111
|
+
...getAttrs.getButtonAttrs({
|
|
112
|
+
isDisabled: !isInStock,
|
|
113
|
+
buttonSide: 'right'
|
|
114
|
+
})
|
|
115
|
+
});
|
|
116
|
+
const iconWrapperClass = system.createClass({
|
|
117
|
+
...getClasses.getIconWrapperClasses()
|
|
118
|
+
});
|
|
119
|
+
const iconWidth = common.getIconWidth(iconSizeCustom);
|
|
120
|
+
return /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
121
|
+
ref: ref,
|
|
122
|
+
...containerAttrs,
|
|
123
|
+
className: containerClasses,
|
|
124
|
+
style: containerStyles,
|
|
125
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs("div", {
|
|
126
|
+
className: wrapperClasses,
|
|
127
|
+
style: wrapperStyles,
|
|
128
|
+
children: [
|
|
129
|
+
system.If(qtyStyle === 'standard', /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
130
|
+
...buttonLeftAttrs,
|
|
131
|
+
onClick: decrement,
|
|
132
|
+
className: buttonLeftClass,
|
|
133
|
+
style: buttonLeftStyle,
|
|
134
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
135
|
+
className: iconWrapperClass,
|
|
136
|
+
style: iconWidth,
|
|
137
|
+
dangerouslySetInnerHTML: {
|
|
138
|
+
__html: common.getPlusIcon(plusIcon)
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
})),
|
|
142
|
+
/*#__PURE__*/ jsxRuntime.jsx("input", {
|
|
143
|
+
...inputAttrs,
|
|
144
|
+
className: inputClass,
|
|
145
|
+
style: inputStyle,
|
|
146
|
+
onChange: (e)=>{
|
|
147
|
+
setQuantity(parseInt(e.target.value, 10));
|
|
148
|
+
}
|
|
149
|
+
}),
|
|
150
|
+
system.If(qtyStyle === 'standard', /*#__PURE__*/ jsxRuntime.jsx("button", {
|
|
151
|
+
...buttonRightAttrs,
|
|
152
|
+
onClick: increment,
|
|
153
|
+
className: buttonRightClass,
|
|
154
|
+
style: buttonRightStyle,
|
|
155
|
+
children: /*#__PURE__*/ jsxRuntime.jsx("span", {
|
|
156
|
+
className: iconWrapperClass,
|
|
157
|
+
style: iconWidth,
|
|
158
|
+
dangerouslySetInnerHTML: {
|
|
159
|
+
__html: common.getMinusIcon(minusIcon)
|
|
160
|
+
}
|
|
161
|
+
})
|
|
162
|
+
}))
|
|
163
|
+
]
|
|
164
|
+
})
|
|
165
|
+
});
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
exports.default = ProductQuantity;
|
|
@@ -13,7 +13,7 @@ require('../../../modal/components/confirm.js');
|
|
|
13
13
|
var ProductButton = require('../ProductButton/ProductButton.js');
|
|
14
14
|
var ProductImages = require('../ProductImages.js');
|
|
15
15
|
var index$1 = require('../ProductPrice/index.js');
|
|
16
|
-
var
|
|
16
|
+
var index$3 = require('../ProductQuantity/index.js');
|
|
17
17
|
var index = require('../ProductTitle/index.js');
|
|
18
18
|
var index$2 = require('../ProductVariants/index.js');
|
|
19
19
|
|
|
@@ -122,7 +122,7 @@ const ModalContent = ()=>{
|
|
|
122
122
|
]
|
|
123
123
|
}),
|
|
124
124
|
/*#__PURE__*/ jsxRuntime.jsx(index$2.default, {}),
|
|
125
|
-
/*#__PURE__*/ jsxRuntime.jsx(
|
|
125
|
+
/*#__PURE__*/ jsxRuntime.jsx(index$3.default, {}),
|
|
126
126
|
/*#__PURE__*/ jsxRuntime.jsx(ProductButton.default, {})
|
|
127
127
|
]
|
|
128
128
|
})
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var core = require('@gem-sdk/core');
|
|
4
4
|
var helpers = require('../../../../../helpers.js');
|
|
5
5
|
|
|
6
|
-
const getSelectStyle = ({ width, height, optionTypo, optionTypography, optionBgColor, optionTextColor, optionRounded, optionShadow, optionBorder, optionTransform })=>{
|
|
6
|
+
const getSelectStyle = ({ width, height, optionTypo, optionTypography, optionBgColor, optionTextColor, optionRounded, optionHasShadow, optionShadow, optionBorder, optionTransform })=>{
|
|
7
7
|
const appendTypoStyle = core.composeTypographyStyle(optionTypo, optionTypography);
|
|
8
8
|
const getCustomCSSActiveState = core.makeStyle({
|
|
9
9
|
bg: core.getSingleColorVariable(optionBgColor?.active),
|
|
@@ -16,11 +16,7 @@ const getSelectStyle = ({ width, height, optionTypo, optionTypography, optionBgC
|
|
|
16
16
|
...core.makeStyle({
|
|
17
17
|
h: height
|
|
18
18
|
}),
|
|
19
|
-
...core.getStyleShadowState(optionShadow, 'box-shadow',
|
|
20
|
-
normal: optionShadow?.normal?.type !== 'none',
|
|
21
|
-
hover: optionShadow?.hover?.type !== 'none',
|
|
22
|
-
active: optionShadow?.active?.type !== 'none'
|
|
23
|
-
}),
|
|
19
|
+
...core.getStyleShadowState(optionShadow, 'box-shadow', optionHasShadow),
|
|
24
20
|
...getCustomCSSActiveState,
|
|
25
21
|
...core.makeStyle({
|
|
26
22
|
tt: optionTransform
|
package/dist/cjs/product/components/ProductVariants/components/dropdown-swatches/Dropdown.js
CHANGED
|
@@ -14,15 +14,14 @@ var useDropdownSwatches = require('./hooks/useDropdownSwatches.js');
|
|
|
14
14
|
|
|
15
15
|
const DropdownVariant = (props)=>{
|
|
16
16
|
const { option, optionPosition, optionNumber, variantGroup, variants, price, blankText, swatchHeight, optionTypography, optionTransform, initValue, hasPreSelected, optionTypo, combineHeight, combineWidth, soldOutStyle } = props;
|
|
17
|
-
let { optionBgColor, optionTextColor, optionRounded, optionShadow,
|
|
18
|
-
optionBorder } = props;
|
|
17
|
+
let { optionBgColor, optionTextColor, optionRounded, optionShadow, optionHasShadow, optionBorder } = props;
|
|
19
18
|
const { value, preset, handleOnChangeSelect, checkVariantInStock } = useDropdownSwatches.useDropdownSwatches(props);
|
|
20
19
|
const isSoldOutMark = soldOutStyle === 'disable';
|
|
21
20
|
if (!variantGroup) {
|
|
22
21
|
optionBgColor = preset?.optionBgColor;
|
|
23
22
|
optionTextColor = preset?.optionTextColor;
|
|
24
23
|
optionBorder = preset?.optionBorder;
|
|
25
|
-
|
|
24
|
+
optionHasShadow = preset?.optionHasShadow;
|
|
26
25
|
optionShadow = preset?.optionShadow;
|
|
27
26
|
optionRounded = preset?.optionRounded;
|
|
28
27
|
}
|
|
@@ -42,6 +41,7 @@ const DropdownVariant = (props)=>{
|
|
|
42
41
|
optionTextColor,
|
|
43
42
|
optionRounded,
|
|
44
43
|
optionShadow,
|
|
44
|
+
optionHasShadow,
|
|
45
45
|
optionBorder,
|
|
46
46
|
optionTransform,
|
|
47
47
|
swatchHeight
|