@bytebrand/fe-ui-core-autobahn 1.0.142 → 1.0.144

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.
@@ -710,7 +710,12 @@ export const PriceTerms: React.FunctionComponent<{
710
710
  onShowDetails?: () => void;
711
711
  t: TranslationFunction;
712
712
  }> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
713
- if (mode === 'buy') return null;
713
+ // Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
714
+ // here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
715
+ // real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
716
+ // every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
717
+ // FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
718
+ if (mode === 'buy') return <div className="cc-terms" />;
714
719
  const finFirstInstallment =
715
720
  car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
716
721
  const finMonths = car.finMonths ?? _finMonths;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.142",
3
+ "version": "1.0.144",
4
4
  "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
5
  "main": "index.ts",
6
6
  "license": "UNLICENSED",
package/theme/md3.css CHANGED
@@ -5552,6 +5552,10 @@ line-height: 31px;
5552
5552
  .md3 .cc-terms {
5553
5553
  margin-top: 9px;
5554
5554
  margin-bottom: 10px;
5555
+ /* Kaufen renders this div empty (cardParts.tsx's PriceTerms) — min-height keeps its line's
5556
+ height reserved so the price row/rating pill/CTA row below don't jump up when switching to
5557
+ that tab (an empty block's own top/bottom margins would otherwise collapse together). */
5558
+ min-height: 14px;
5555
5559
  font-family: Arial, Helvetica, Arimo, sans-serif;
5556
5560
  font-style: normal;
5557
5561
  font-weight: 400;
@@ -2226,17 +2226,23 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2226
2226
  const desktopBreakdownRef = React.useRef<HTMLDivElement | null>(null);
2227
2227
  const mobileBreakdownRef = React.useRef<HTMLDivElement | null>(null);
2228
2228
  // mobile (ADV-276): revealing the breakdown scrolls the sheet body until the "Repräsentatives
2229
- // Beispiel" headline sits at its top — not all the way down to the CTA row under the breakdown.
2229
+ // Beispiel" headline sits at its top — but never so far that the CTA row under the breakdown
2230
+ // comes into view (on tall screens the breakdown is shorter than the sheet, so the headline
2231
+ // then stops lower, with the bottom CTA row still just below the fold).
2230
2232
  // The sheet keeps its fixed height (see .fin-modal in md3.css), so nothing jumps; only the
2231
2233
  // body scrolls. Hand-rolled rAF ease-out so the duration is ours, not the browser's.
2234
+ const mobileBottomCtaRef = React.useRef<HTMLDivElement | null>(null);
2232
2235
  const breakdownScrollRaf = React.useRef(0);
2233
2236
  const scrollSheetToBreakdown = React.useCallback((): void => {
2234
2237
  const el = mobileBreakdownRef.current;
2235
2238
  const body = el?.closest('.fin-modal-body') as HTMLElement | null | undefined;
2236
2239
  if (!el || !body) return;
2237
2240
  const from = body.scrollTop;
2238
- const headlineTop = el.getBoundingClientRect().top - body.getBoundingClientRect().top + from;
2239
- const to = Math.max(0, Math.min(headlineTop - 8, body.scrollHeight - body.clientHeight));
2241
+ const bodyTop = body.getBoundingClientRect().top;
2242
+ const headlineTop = el.getBoundingClientRect().top - bodyTop + from;
2243
+ const cta = mobileBottomCtaRef.current;
2244
+ const ctaLimit = cta ? cta.getBoundingClientRect().top - bodyTop + from - body.clientHeight : Infinity;
2245
+ const to = Math.max(0, Math.min(headlineTop - 8, ctaLimit, body.scrollHeight - body.clientHeight));
2240
2246
  if (to === from) return;
2241
2247
  window.cancelAnimationFrame(breakdownScrollRaf.current);
2242
2248
  const duration = 400;
@@ -3464,11 +3470,16 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
3464
3470
  {isLease ? t('autobahn:modal.leasingDetails') : t('autobahn:modal.financingDetails')}
3465
3471
  </span>
3466
3472
  </button>
3467
- {/* mobile "Finanzierungsdetails" toggle reveals the same row-by-row breakdown
3468
- table as desktop (breakdownRows, built once above). */}
3469
- {showBreakdown && (
3470
- <>
3471
- <div ref={mobileBreakdownRef} style={{ marginBottom: 5 }}>
3473
+ {/* mobile "Finanzierungsdetails" toggle scrolls the sheet body down to this same
3474
+ row-by-row breakdown table (breakdownRows, built once above) — always
3475
+ rendered now, not gated behind showBreakdown, so a visitor who scrolls the
3476
+ sheet by hand (no tap on the toggle) reaches it too. The collapsed look on
3477
+ open is unaffected: .fin-modal-body's own fixed height + overflow already
3478
+ clip this below the fold until scrolled, exactly as when it was conditionally
3479
+ mounted — only the toggle's click-triggered auto-scroll (scrollSheetToBreakdown,
3480
+ the effect above) actually depended on showBreakdown, and still does. */}
3481
+ <>
3482
+ <div ref={mobileBreakdownRef} style={{ marginBottom: 5 }}>
3472
3483
  <p
3473
3484
  style={{
3474
3485
  fontFamily: 'Arial, Helvetica, Arimo, sans-serif',
@@ -3687,7 +3698,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
3687
3698
  </p>
3688
3699
  </>
3689
3700
  )}
3690
- <div className="fin-sheet-cta-row" style={{ display: 'flex', gap: 7, paddingBottom: 15 }}>
3701
+ <div ref={mobileBottomCtaRef} className="fin-sheet-cta-row" style={{ display: 'flex', gap: 7, paddingBottom: 15 }}>
3691
3702
  <Button
3692
3703
  variant="filled"
3693
3704
  size="lg"
@@ -3732,7 +3743,6 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
3732
3743
  />
3733
3744
  </div>
3734
3745
  </>
3735
- )}
3736
3746
  </>
3737
3747
  )}
3738
3748
  </div>