@lime-bundles/widget 2.2.1 → 2.3.0
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/index.cjs +64 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +66 -10
- package/dist/index.js.map +1 -1
- package/dist/lime-bundle.global.js +67 -29
- package/dist/lime-bundle.global.js.map +1 -1
- package/docs/css-variables.md +2 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -332,6 +332,11 @@ function renderProductRow(state, currency, qtyFor, onVariantChange) {
|
|
|
332
332
|
prices.appendChild(compare);
|
|
333
333
|
prices.appendChild(priceEl);
|
|
334
334
|
info.appendChild(prices);
|
|
335
|
+
const unitPriceEl = el("span", "lb-bundle-product-unit-price", {
|
|
336
|
+
"data-product-unit-price": ""
|
|
337
|
+
});
|
|
338
|
+
unitPriceEl.setAttribute("hidden", "");
|
|
339
|
+
info.appendChild(unitPriceEl);
|
|
335
340
|
const applyVariantToRow = (variant) => {
|
|
336
341
|
const unit = (0, import_core.parseCents)(variant.price.amount);
|
|
337
342
|
priceEl.textContent = (0, import_core.formatCents)(unit, currency);
|
|
@@ -346,6 +351,17 @@ function renderProductRow(state, currency, qtyFor, onVariantChange) {
|
|
|
346
351
|
} else {
|
|
347
352
|
compare.setAttribute("hidden", "");
|
|
348
353
|
}
|
|
354
|
+
const unitText = (0, import_core.formatUnitPrice)(
|
|
355
|
+
variant.unitPrice,
|
|
356
|
+
variant.unitPriceMeasurement,
|
|
357
|
+
currency
|
|
358
|
+
);
|
|
359
|
+
if (unitText) {
|
|
360
|
+
unitPriceEl.textContent = unitText;
|
|
361
|
+
unitPriceEl.removeAttribute("hidden");
|
|
362
|
+
} else {
|
|
363
|
+
unitPriceEl.setAttribute("hidden", "");
|
|
364
|
+
}
|
|
349
365
|
};
|
|
350
366
|
applyVariantToRow(state.selected);
|
|
351
367
|
if (state.eligibleVariants.length > 1) {
|
|
@@ -956,6 +972,19 @@ function renderModal(bundle, eligible, currency, handlers) {
|
|
|
956
972
|
const price = el("span", "lb-mix-match__modal-product-price");
|
|
957
973
|
price.textContent = (0, import_core.formatCents)((0, import_core.parseCents)(variant.price.amount), currency);
|
|
958
974
|
info.appendChild(price);
|
|
975
|
+
const unitPriceText = (0, import_core.formatUnitPrice)(
|
|
976
|
+
variant.unitPrice,
|
|
977
|
+
variant.unitPriceMeasurement,
|
|
978
|
+
currency
|
|
979
|
+
);
|
|
980
|
+
if (unitPriceText) {
|
|
981
|
+
const unitPrice = el(
|
|
982
|
+
"span",
|
|
983
|
+
"lb-mix-match__modal-product-unit-price lb-bundle-product-unit-price"
|
|
984
|
+
);
|
|
985
|
+
unitPrice.textContent = unitPriceText;
|
|
986
|
+
info.appendChild(unitPrice);
|
|
987
|
+
}
|
|
959
988
|
if (ep.isOos) {
|
|
960
989
|
const soldOut = el("span", "lb-mix-match__modal-sold-out-label");
|
|
961
990
|
soldOut.textContent = "Sold out";
|
|
@@ -1421,7 +1450,6 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1421
1450
|
|
|
1422
1451
|
.lb-bundle-widget {
|
|
1423
1452
|
/* Internal CSS-only vars (not merchant-configurable). */
|
|
1424
|
-
--lb-text-muted: #666666;
|
|
1425
1453
|
--lb-thumbnail-bg: #F0F0F0;
|
|
1426
1454
|
--lb-widget-pad: 20px;
|
|
1427
1455
|
--lb-progress-color: var(--lb-primary-color);
|
|
@@ -1444,7 +1472,7 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1444
1472
|
margin: 0 calc(-1 * var(--lb-widget-pad)) 20px;
|
|
1445
1473
|
padding: 12px 20px;
|
|
1446
1474
|
background: var(--lb-countdown-bg);
|
|
1447
|
-
border-top: 1px solid
|
|
1475
|
+
border-top: 1px solid color-mix(in srgb, var(--lb-text) 6%, transparent);
|
|
1448
1476
|
display: flex;
|
|
1449
1477
|
align-items: center;
|
|
1450
1478
|
justify-content: space-between;
|
|
@@ -1540,7 +1568,7 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1540
1568
|
font-size: 16px;
|
|
1541
1569
|
font-weight: 400;
|
|
1542
1570
|
line-height: 20px;
|
|
1543
|
-
color: var(--lb-text
|
|
1571
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
1544
1572
|
margin: 4px 0 0;
|
|
1545
1573
|
}
|
|
1546
1574
|
|
|
@@ -1609,7 +1637,7 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1609
1637
|
.lb-bundle-thumbnail svg {
|
|
1610
1638
|
width: 28px;
|
|
1611
1639
|
height: 28px;
|
|
1612
|
-
color:
|
|
1640
|
+
color: color-mix(in srgb, var(--lb-text) 35%, transparent);
|
|
1613
1641
|
}
|
|
1614
1642
|
|
|
1615
1643
|
.lb-bundle-product-info {
|
|
@@ -1664,6 +1692,22 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1664
1692
|
display: none;
|
|
1665
1693
|
}
|
|
1666
1694
|
|
|
1695
|
+
/* Unit price (e.g. "$0.50/100ml") \u2014 only rendered when the merchant has
|
|
1696
|
+
configured unit pricing on the variant in the Shopify admin. No merchant
|
|
1697
|
+
toggle: present in admin \u2192 shown; absent \u2192 hidden. Styled as muted
|
|
1698
|
+
secondary text beneath the price row so it doesn't compete visually. */
|
|
1699
|
+
.lb-bundle-product-unit-price {
|
|
1700
|
+
display: block;
|
|
1701
|
+
font-size: 11px;
|
|
1702
|
+
line-height: 16px;
|
|
1703
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
1704
|
+
margin-top: 2px;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
.lb-bundle-product-unit-price[hidden] {
|
|
1708
|
+
display: none;
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1667
1711
|
.lb-bundle-variant-badge {
|
|
1668
1712
|
display: inline-block;
|
|
1669
1713
|
border: var(--lb-variant-border-width) solid var(--lb-variant-border-color);
|
|
@@ -1671,14 +1715,14 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1671
1715
|
padding: 8px 12px;
|
|
1672
1716
|
font-size: 12px;
|
|
1673
1717
|
line-height: 16px;
|
|
1674
|
-
color: var(--lb-text
|
|
1718
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
1675
1719
|
margin-top: 8px;
|
|
1676
1720
|
}
|
|
1677
1721
|
|
|
1678
1722
|
.lb-bundle-quantity {
|
|
1679
1723
|
font-size: 12px;
|
|
1680
1724
|
line-height: 16px;
|
|
1681
|
-
color: var(--lb-text
|
|
1725
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
1682
1726
|
margin-left: 8px;
|
|
1683
1727
|
white-space: nowrap;
|
|
1684
1728
|
}
|
|
@@ -1733,7 +1777,7 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1733
1777
|
font-size: 16px;
|
|
1734
1778
|
font-weight: 600;
|
|
1735
1779
|
line-height: 20px;
|
|
1736
|
-
padding: 12px
|
|
1780
|
+
padding: 8px 12px;
|
|
1737
1781
|
border-radius: var(--lb-savings-bar-radius);
|
|
1738
1782
|
margin-bottom: 12px;
|
|
1739
1783
|
}
|
|
@@ -1878,7 +1922,7 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
|
|
|
1878
1922
|
.lb-bundle-placeholder-icon {
|
|
1879
1923
|
width: 28px;
|
|
1880
1924
|
height: 28px;
|
|
1881
|
-
stroke:
|
|
1925
|
+
stroke: color-mix(in srgb, var(--lb-text) 35%, transparent);
|
|
1882
1926
|
stroke-width: 1.5;
|
|
1883
1927
|
fill: none;
|
|
1884
1928
|
}
|
|
@@ -2295,7 +2339,7 @@ var BUNDLE_MIX_MATCH_CSS = `/* Lime Bundles \u2014 Mix & Match styles */
|
|
|
2295
2339
|
border: var(--lb-picker-product-border-width) solid var(--lb-picker-product-border-color);
|
|
2296
2340
|
box-sizing: border-box;
|
|
2297
2341
|
overflow: visible;
|
|
2298
|
-
background:
|
|
2342
|
+
background: var(--lb-thumbnail-bg);
|
|
2299
2343
|
}
|
|
2300
2344
|
|
|
2301
2345
|
/* Qty badge inside the picker modal inherits picker-product border (width + color) plus
|
|
@@ -2336,6 +2380,17 @@ var BUNDLE_MIX_MATCH_CSS = `/* Lime Bundles \u2014 Mix & Match styles */
|
|
|
2336
2380
|
margin: 4px 0 0;
|
|
2337
2381
|
}
|
|
2338
2382
|
|
|
2383
|
+
.lb-mix-match__modal-product-unit-price {
|
|
2384
|
+
font-size: 11px;
|
|
2385
|
+
line-height: 16px;
|
|
2386
|
+
color: color-mix(in srgb, var(--lb-text) 60%, transparent);
|
|
2387
|
+
margin: 2px 0 0;
|
|
2388
|
+
}
|
|
2389
|
+
|
|
2390
|
+
.lb-mix-match__modal-product-unit-price[hidden] {
|
|
2391
|
+
display: none;
|
|
2392
|
+
}
|
|
2393
|
+
|
|
2339
2394
|
.lb-mix-match__variant-select {
|
|
2340
2395
|
font-size: 12px;
|
|
2341
2396
|
margin: 4px 0 0;
|