@ticketboothapp/booking 1.2.38 → 1.2.39
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/package.json
CHANGED
|
@@ -1423,17 +1423,26 @@ export function BookingFlow({
|
|
|
1423
1423
|
return null;
|
|
1424
1424
|
};
|
|
1425
1425
|
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
const
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
}
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1426
|
+
const detectedScrollParent = findScrollParent(el);
|
|
1427
|
+
const explicitScrollContainer = contentRef?.current ?? null;
|
|
1428
|
+
const isElementScrollable = (node: HTMLElement | null): node is HTMLElement => {
|
|
1429
|
+
if (!node) return false;
|
|
1430
|
+
const style = getComputedStyle(node);
|
|
1431
|
+
const allowsScroll = style.overflowY === 'auto' || style.overflowY === 'scroll' || style.overflowY === 'overlay';
|
|
1432
|
+
return allowsScroll && node.scrollHeight > node.clientHeight + 1;
|
|
1433
|
+
};
|
|
1434
|
+
|
|
1435
|
+
// Deterministic host-aware choice:
|
|
1436
|
+
// 1) explicit contentRef when it is truly scrollable
|
|
1437
|
+
// 2) nearest detected scroll parent when it is truly scrollable
|
|
1438
|
+
// 3) window scroll
|
|
1439
|
+
const scrollParent =
|
|
1440
|
+
!useWindowScroll && isElementScrollable(explicitScrollContainer)
|
|
1441
|
+
? explicitScrollContainer
|
|
1442
|
+
: !useWindowScroll && isElementScrollable(detectedScrollParent)
|
|
1443
|
+
? detectedScrollParent
|
|
1444
|
+
: null;
|
|
1445
|
+
const scrollTarget = scrollParent ?? (typeof window !== 'undefined' ? window : null);
|
|
1437
1446
|
|
|
1438
1447
|
let ticking = false;
|
|
1439
1448
|
const COOLDOWN_MS = 600; // After a state change, ignore reverse changes for this long (covers 0.25s collapse animation + layout settle)
|
|
@@ -1447,7 +1456,7 @@ export function BookingFlow({
|
|
|
1447
1456
|
const wasSticky = isItineraryStickyRef.current;
|
|
1448
1457
|
|
|
1449
1458
|
const containerTop =
|
|
1450
|
-
|
|
1459
|
+
scrollParent && !useWindowScroll ? scrollParent.getBoundingClientRect().top : 0;
|
|
1451
1460
|
const topInset = Math.max(0, flowUi?.itineraryStickyTopOffsetPx ?? 0);
|
|
1452
1461
|
const stickLine = containerTop + topInset;
|
|
1453
1462
|
const enterStickyThreshold = stickLine + 1;
|
|
@@ -1475,16 +1484,13 @@ export function BookingFlow({
|
|
|
1475
1484
|
}
|
|
1476
1485
|
};
|
|
1477
1486
|
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
});
|
|
1486
|
-
};
|
|
1487
|
-
}, [selectedDate, selectedAvailability, useWindowScroll, flowUi?.itineraryStickyTopOffsetPx, contentRef]); // Re-check when itinerary / scroll mode / host chrome changes
|
|
1487
|
+
if (scrollTarget) {
|
|
1488
|
+
scrollTarget.addEventListener('scroll', handleScroll, { passive: true });
|
|
1489
|
+
updateStickyState();
|
|
1490
|
+
return () => scrollTarget.removeEventListener('scroll', handleScroll);
|
|
1491
|
+
}
|
|
1492
|
+
return undefined;
|
|
1493
|
+
}, [selectedDate, selectedAvailability, useWindowScroll, flowUi?.itineraryStickyTopOffsetPx]); // Re-check when itinerary / scroll mode / host chrome changes
|
|
1488
1494
|
|
|
1489
1495
|
// Find the earliest availability date - memoize with a stable reference
|
|
1490
1496
|
// Only recalculate if we don't have a cached value or if the new earliest is actually earlier
|