@lime-bundles/widget 2.2.0 → 2.2.1

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.js CHANGED
@@ -16,6 +16,11 @@ import {
16
16
  applyABVariantB
17
17
  } from "@lime-bundles/core";
18
18
 
19
+ // src/renderers/fixed.ts
20
+ import {
21
+ resolveBundleQty
22
+ } from "@lime-bundles/core";
23
+
19
24
  // src/renderers/pricing.ts
20
25
  import {
21
26
  parseCents,
@@ -121,11 +126,7 @@ var PLACEHOLDER_THUMB_SVG = `
121
126
  </svg>`;
122
127
  function renderFixedBundle(container, bundle, onAddToCart, onCleanup) {
123
128
  const wc = bundle.widgetConfig;
124
- const qtyFor = (productId, variantId) => {
125
- const vq = bundle.variantQuantities[variantId];
126
- if (vq !== void 0) return vq;
127
- return bundle.productQuantities[productId] ?? 1;
128
- };
129
+ const qtyFor = (productId, variantId) => resolveBundleQty(bundle, productId, variantId);
129
130
  const rows = [];
130
131
  let oosCount = 0;
131
132
  bundle.products.forEach((product, idx) => {
@@ -216,9 +217,7 @@ function buildRowState(bundle, product, productIndex) {
216
217
  const eligibleVariants = selectedVariantIds && selectedVariantIds.length > 0 ? available.filter((v) => selectedVariantIds.includes(v.id)) : available;
217
218
  const isOos = eligibleVariants.length === 0;
218
219
  const selected = eligibleVariants[0] ?? null;
219
- const productQty = bundle.productQuantities[product.id] ?? 1;
220
- const variantQty = selected ? bundle.variantQuantities[selected.id] : void 0;
221
- const qty = variantQty ?? productQty;
220
+ const qty = selected ? resolveBundleQty(bundle, product.id, selected.id) : 1;
222
221
  return { product, eligibleVariants, selected, qty, isOos };
223
222
  }
224
223
  function renderHeader(bundle, currency) {
@@ -1485,11 +1484,20 @@ var BUNDLE_BASE_CSS = `/* Lime Bundles \u2014 shared base styles for all bundle
1485
1484
  display: none;
1486
1485
  }
1487
1486
 
1488
- /* Adjacent widget spacing \u2014 separates multiple bundles on the same product page */
1489
- .lb-bundle-widget + .lb-bundle-widget {
1487
+ /* Sibling widget spacing \u2014 separates multiple bundles on the same product page.
1488
+ Uses \`~\` (general sibling) rather than \`+\` (adjacent) because each Liquid
1489
+ loop iteration emits a {% style %} block before its widget div, so the
1490
+ rendered DOM alternates <style><widget><style><widget>. The \`+\` combinator
1491
+ requires immediate adjacency and would match nothing; \`~\` matches every
1492
+ widget after the first regardless of elements between. Single-widget pages
1493
+ stay unaffected (no prior \`.lb-bundle-widget\` sibling to match against).
1494
+ Only \`margin-top\` \u2014 do NOT override \`padding-top\` here. The gradient header
1495
+ uses \`margin-top: calc(-1 * var(--lb-widget-pad))\` to reach the widget's
1496
+ inner border edge, assuming padding-top == --lb-widget-pad. Changing
1497
+ padding-top on the subsequent widget breaks that math and leaves a visible
1498
+ gap above the header. */
1499
+ .lb-bundle-widget ~ .lb-bundle-widget {
1490
1500
  margin-top: 24px;
1491
- padding-top: 24px;
1492
- border-top: 1px solid var(--lb-border);
1493
1501
  }
1494
1502
 
1495
1503
  /* Header \u2014 gradient banner with title + savings badge */