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