@bytebrand/fe-ui-core-autobahn 1.0.182 → 1.0.184

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/cards/CarCard.tsx CHANGED
@@ -38,7 +38,6 @@ import {
38
38
  GalleryActivityPill,
39
39
  cardSpec,
40
40
  PaymentMode,
41
- startPaymentMode,
42
41
  callDealerSalesPhone,
43
42
  DEALER_SALES_PHONE,
44
43
  } from './cardParts';
@@ -99,11 +98,6 @@ export interface CarCardProps {
99
98
  * (still onOpenRateAdjust).
100
99
  */
101
100
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
102
- /**
103
- * Tab the price block opens on (default Finanzierung) — e.g. the SRP's leasing-only results
104
- * open every card on Leasing. Ignored for a car without a lease rate (it has no Leasing tab).
105
- */
106
- initialMode?: PaymentMode;
107
101
  }
108
102
 
109
103
  const CarCard: React.FunctionComponent<CarCardProps> = ({
@@ -119,9 +113,8 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
119
113
  onCall,
120
114
  onOpenRateAdjust,
121
115
  onShowFinancingDetails,
122
- initialMode,
123
116
  }) => {
124
- const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
117
+ const [mode, setMode] = useState<PaymentMode>('financing');
125
118
  const [photoIndex, setPhotoIndex] = useState(0);
126
119
  const [viewerOpen, setViewerOpen] = useState(false);
127
120
  const mediaRef = useRef<HTMLDivElement | null>(null);
@@ -164,8 +157,6 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
164
157
  // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
165
158
  const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
166
159
  const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
167
- // tabs the price block can switch to (PriceTabs shows Leasing only when the car has a lease rate)
168
- const paymentModes: PaymentMode[] = car.lease != null ? ['financing', 'leasing', 'buy'] : ['financing', 'buy'];
169
160
  return (
170
161
  <article
171
162
  className="mcard mcard--interactive cc-card"
@@ -286,46 +277,18 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
286
277
  <div className="cc-price" style={{ marginTop: 0, borderTop: '1px solid var(--md-outline-variant)' }}>
287
278
  <PriceTabs car={car} mode={mode} onModeChange={setMode} t={t} />
288
279
  <div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 8, marginTop: 10 }}>
289
- {/* every tab's hero stacked in one grid cell (.cc-hero-stack), only the active one
290
- visible, bottom-aligned — Kaufen's struck list price sits on its own line above
291
- the price, so without this the row (and the card) grew/shrank by that line on
292
- every tab switch. Same trick as .cc-terms-stack below. */}
293
- <div className="cc-hero-stack">
294
- {paymentModes.map((m) => (
295
- <div
296
- key={m}
297
- className={'cc-hero-slot' + (m === mode ? '' : ' cc-hero-slot--hidden')}
298
- aria-hidden={m === mode ? undefined : true}
299
- >
300
- <PriceHero car={car} mode={m} t={t} alwaysShowUnit />
301
- </div>
302
- ))}
303
- </div>
280
+ <PriceHero car={car} mode={mode} t={t} alwaysShowUnit />
304
281
  <PriceEvalCol car={car} t={t} />
305
282
  </div>
306
283
  {/* same fallback CardCtaRow already uses below: pages that haven't wired a real
307
- "Rate anpassen" sheet yet still get a working "Details" link (opens the car).
308
- Every tab's terms line is rendered into the same grid cell (.cc-terms-stack) and
309
- only the active one is visible — the cell is as tall as the tallest line, so the
310
- card keeps one height across Finanzierung/Leasing/Kaufen (Leasing's longer line
311
- wraps to 2 lines on narrow phones). No change to the visible line itself. */}
312
- <div className="cc-terms-stack">
313
- {paymentModes.map((m) => (
314
- <div
315
- key={m}
316
- className={'cc-terms-slot' + (m === mode ? '' : ' cc-terms-slot--hidden')}
317
- aria-hidden={m === mode ? undefined : true}
318
- >
319
- <PriceTerms
320
- car={car}
321
- mode={m}
322
- onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
323
- onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, m) : undefined}
324
- t={t}
325
- />
326
- </div>
327
- ))}
328
- </div>
284
+ "Rate anpassen" sheet yet still get a working "Details" link (opens the car). */}
285
+ <PriceTerms
286
+ car={car}
287
+ mode={mode}
288
+ onOpenRateAdjust={onOpenRateAdjust || (() => onOpen(car))}
289
+ onShowDetails={onShowFinancingDetails ? () => onShowFinancingDetails(car, mode) : undefined}
290
+ t={t}
291
+ />
329
292
  </div>
330
293
  {/* Mobile-only row (CardCtaRow itself carries the show-mobile class) — always
331
294
  rendered, with real fallbacks the page can override once it wires its own
@@ -0,0 +1,103 @@
1
+ // Autobahn (auto.de redesign) — CarCard loading placeholder.
2
+ //
3
+ // The shape of a CarCard while its data is on the way: the same card chrome (.mcard
4
+ // .cc-card — border, 18px radius, shadow) and, inside it, the card's own parts as
5
+ // skeleton bars on the line boxes CarCard's CSS gives them, so a grid of these is as
6
+ // tall as the grid of cards that replaces it and nothing below jumps:
7
+ // - photo: 4:3 plus the carousel's 14px (that's how tall .cc-media really renders), on
8
+ // the lighter --md-sc-low so the big area stays calm and the text bars read as content
9
+ // - title 24/27 (+6), trim 13/17 (+6), spec line 11/15 (+10)
10
+ // - price block on its hairline: tabs (39, +12), rate + price rating (58), terms (2 × 17)
11
+ // - phones (≤600, .show-mobile): the CTA row (9 + 40)
12
+ // - eco line (8 + 3 × 11) pinned to the bottom, like the card's
13
+ // Measured against real cards at 1467 / 768 / 390 px (571 / 541 / 593 tall).
14
+ //
15
+ // Decorative only (aria-hidden): the grid that shows these says what is loading.
16
+ // Renders correctly only inside a `<div className="md3">` subtree.
17
+
18
+ import React from 'react';
19
+
20
+ import Skeleton, { injectStyles } from '../ui/Skeleton';
21
+
22
+ export interface CarCardSkeletonProps {
23
+ className?: string;
24
+ style?: React.CSSProperties;
25
+ }
26
+
27
+ const CARD_SKELETON_CSS = `
28
+ .md3 .cc-skel { display: flex; flex-direction: column; pointer-events: none; }
29
+ .md3 .cc-skel .cc-skel-photo { height: 0; padding-bottom: calc(75% + 14px); border-radius: 0; --mskeleton-base: var(--md-sc-low); }
30
+ .md3 .cc-skel .cc-skel-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; padding: 0 18px 8px; margin-top: -3px; }
31
+ .md3 .cc-skel .cc-skel-title { width: 62%; height: 20px; margin: 4px 0 9px; border-radius: var(--md-r-xs); }
32
+ .md3 .cc-skel .cc-skel-trim { width: 82%; height: 11px; margin: 3px 0 9px; border-radius: var(--md-r-full); }
33
+ .md3 .cc-skel .cc-skel-spec { width: 92%; height: 9px; margin: 3px 0 13px; border-radius: var(--md-r-full); }
34
+ .md3 .cc-skel .cc-skel-price { align-self: stretch; border-top: 1px solid var(--md-outline-variant); }
35
+ .md3 .cc-skel .cc-skel-tabs { display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; justify-items: center; height: 39px; margin-bottom: 12px; }
36
+ .md3 .cc-skel .cc-skel-tabs .mskeleton { width: 56%; height: 12px; border-radius: var(--md-r-full); }
37
+ .md3 .cc-skel .cc-skel-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
38
+ .md3 .cc-skel .cc-skel-rate { width: 46%; height: 42px; border-radius: var(--md-r-xs); }
39
+ .md3 .cc-skel .cc-skel-eval { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; width: 112px; flex: none; }
40
+ .md3 .cc-skel .cc-skel-eval .mskeleton:first-child { width: 72px; height: 12px; border-radius: var(--md-r-full); }
41
+ .md3 .cc-skel .cc-skel-eval .mskeleton:last-child { width: 100%; height: 7px; border-radius: var(--md-r-full); }
42
+ .md3 .cc-skel .cc-skel-terms,
43
+ .md3 .cc-skel .cc-skel-eco { display: flex; flex-direction: column; }
44
+ .md3 .cc-skel .cc-skel-terms .mskeleton { width: 94%; height: 9px; margin: 4px 0; border-radius: var(--md-r-full); }
45
+ .md3 .cc-skel .cc-skel-terms .mskeleton:last-child { width: 60%; }
46
+ .md3 .cc-skel .cc-skel-cta { align-self: stretch; gap: 6px; margin-top: 9px; }
47
+ .md3 .cc-skel .cc-skel-cta .mskeleton { flex: 1.3 1 0; height: 40px; border-radius: var(--md-r-full); }
48
+ .md3 .cc-skel .cc-skel-cta .mskeleton:nth-child(2) { flex: none; width: 40px; }
49
+ .md3 .cc-skel .cc-skel-cta .mskeleton:last-child { flex: 1 1 0; }
50
+ .md3 .cc-skel .cc-skel-eco { align-self: stretch; margin-top: auto; padding-top: 8px; }
51
+ .md3 .cc-skel .cc-skel-eco .mskeleton { height: 7px; margin: 2px 0; border-radius: var(--md-r-full); }
52
+ .md3 .cc-skel .cc-skel-eco .mskeleton:last-child { width: 66%; }
53
+ @media (max-width: 1024px) {
54
+ .md3 .cc-skel .cc-skel-tabs { height: 38px; }
55
+ }`;
56
+
57
+ const CARD_SKELETON_STYLE_ID = 'md3-card-skeleton-styles';
58
+
59
+ injectStyles(CARD_SKELETON_STYLE_ID, CARD_SKELETON_CSS);
60
+
61
+ const CarCardSkeleton: React.FunctionComponent<CarCardSkeletonProps> = ({ className, style }) => {
62
+ React.useEffect(() => { injectStyles(CARD_SKELETON_STYLE_ID, CARD_SKELETON_CSS); }, []);
63
+ return (
64
+ <div className={'mcard cc-card cc-skel' + (className ? ` ${className}` : '')} style={style} aria-hidden="true">
65
+ <Skeleton className="cc-skel-photo" />
66
+ <div className="cc-skel-body">
67
+ <Skeleton className="cc-skel-title" />
68
+ <Skeleton className="cc-skel-trim" />
69
+ <Skeleton className="cc-skel-spec" />
70
+ <div className="cc-skel-price">
71
+ <div className="cc-skel-tabs">
72
+ <Skeleton />
73
+ <Skeleton />
74
+ <Skeleton />
75
+ </div>
76
+ <div className="cc-skel-hero">
77
+ <Skeleton className="cc-skel-rate" />
78
+ <div className="cc-skel-eval">
79
+ <Skeleton />
80
+ <Skeleton />
81
+ </div>
82
+ </div>
83
+ <div className="cc-skel-terms">
84
+ <Skeleton />
85
+ <Skeleton />
86
+ </div>
87
+ </div>
88
+ <div className="cc-skel-cta show-mobile">
89
+ <Skeleton />
90
+ <Skeleton />
91
+ <Skeleton />
92
+ </div>
93
+ <div className="cc-skel-eco">
94
+ <Skeleton />
95
+ <Skeleton />
96
+ <Skeleton />
97
+ </div>
98
+ </div>
99
+ </div>
100
+ );
101
+ };
102
+
103
+ export default CarCardSkeleton;
package/cards/CarRow.tsx CHANGED
@@ -41,7 +41,6 @@ import {
41
41
  ZeroDownChip,
42
42
  fmtKm,
43
43
  PaymentMode,
44
- startPaymentMode,
45
44
  ratingTone,
46
45
  } from './cardParts';
47
46
  import { AutobahnCar } from './types';
@@ -81,8 +80,6 @@ export interface CarRowProps {
81
80
  * links render as plain text (see PricePaths' own fallback).
82
81
  */
83
82
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
84
- /** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
85
- initialMode?: PaymentMode;
86
83
  }
87
84
 
88
85
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -95,9 +92,8 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
95
92
  t,
96
93
  adminAction,
97
94
  onShowFinancingDetails,
98
- initialMode,
99
95
  }) => {
100
- const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
96
+ const [mode, setMode] = useState<PaymentMode>('financing');
101
97
  const [photoIndex, setPhotoIndex] = useState(0);
102
98
  const mediaRef = useRef<HTMLDivElement | null>(null);
103
99
  // always call the LATEST onMediaEnter without re-arming the observer on every render (the
@@ -0,0 +1,152 @@
1
+ // Autobahn (auto.de redesign) — CarRow (SRP list row) loading placeholder.
2
+ //
3
+ // Built on CarRow's own classes (.mcard .listcard / .listcard-info / .specstrip /
4
+ // .listcard-price), so the 320 | 1fr | 240 grid, the column paddings and gaps, the grey
5
+ // price column and the tablet re-flow (≤980: photo + info, price full width below) all
6
+ // come from the same CSS as the real row. Inside, the row's parts as skeleton bars on their
7
+ // line boxes (measured against real rows at 1467 px, 299 / 348 tall):
8
+ // - info: title 22 + trim 18 · spec panel (2 × 3 facts, 85) · feature chips (2 rows, 54)
9
+ // · eco line (3 × 14) at the bottom
10
+ // - price: "Finanzierung ab" + rate + terms (87) · Leasing (66, optional) · Kaufen,
11
+ // rating + meter, CTA (129) at the bottom
12
+ // `withLeasing` toggles the Leasing block, the one thing that changes a real row's height
13
+ // (348 with it, 299 without), so a list can mix both like real results do.
14
+ //
15
+ // Bars on the grey panels (spec strip, price column) use a darker base so they read on
16
+ // --md-sc-low. Decorative only (aria-hidden): the list showing these says what is loading.
17
+ // Renders correctly only inside a `<div className="md3">` subtree.
18
+
19
+ import React from 'react';
20
+
21
+ import Skeleton, { injectStyles } from '../ui/Skeleton';
22
+
23
+ export interface CarRowSkeletonProps {
24
+ /** show the Leasing block in the price column (a real row has it when the car can be leased). */
25
+ withLeasing?: boolean;
26
+ className?: string;
27
+ style?: React.CSSProperties;
28
+ }
29
+
30
+ const ROW_SKELETON_CSS = `
31
+ .md3 .lc-skel { pointer-events: none; background: var(--md-sc-lowest); }
32
+ .md3 .lc-skel .lc-skel-photo { position: absolute; inset: 0; border-radius: 0; --mskeleton-base: var(--md-sc-low); }
33
+ .md3 .lc-skel .specstrip .mskeleton,
34
+ .md3 .lc-skel .listcard-price .mskeleton { --mskeleton-base: var(--md-sc-highest); }
35
+ .md3 .lc-skel .lc-skel-head { display: flex; flex-direction: column; }
36
+ .md3 .lc-skel .lc-skel-title { width: 44%; height: 16px; margin: 3px 0; border-radius: var(--md-r-xs); }
37
+ .md3 .lc-skel .lc-skel-trim { width: 68%; height: 10px; margin: 4px 0; border-radius: var(--md-r-full); }
38
+ .md3 .lc-skel .lc-skel-fact { display: flex; align-items: center; gap: 7px; height: 15px; }
39
+ .md3 .lc-skel .lc-skel-fact .mskeleton:first-child { flex: none; width: 15px; height: 15px; border-radius: 50%; }
40
+ .md3 .lc-skel .lc-skel-fact .mskeleton:last-child { width: 62%; height: 8px; border-radius: var(--md-r-full); }
41
+ .md3 .lc-skel .lc-skel-fact:nth-child(3n + 2) .mskeleton:last-child { width: 48%; }
42
+ .md3 .lc-skel .lc-skel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
43
+ .md3 .lc-skel .lc-skel-chips .mskeleton { height: 24px; border-radius: 8px; }
44
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(1) { width: 118px; }
45
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(2) { width: 112px; }
46
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(3) { width: 80px; }
47
+ .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(4) { width: 86px; }
48
+ .md3 .lc-skel .lc-skel-spacer { flex: 1; }
49
+ .md3 .lc-skel .lc-skel-eco { display: flex; flex-direction: column; }
50
+ .md3 .lc-skel .lc-skel-eco .mskeleton { height: 7px; margin: 4px 0 3px; border-radius: var(--md-r-full); }
51
+ .md3 .lc-skel .lc-skel-eco .mskeleton:last-child { width: 55%; }
52
+ .md3 .lc-skel .lc-skel-paths { display: flex; flex-direction: column; align-items: flex-start; }
53
+ .md3 .lc-skel .lc-skel-eyebrow { width: 96px; height: 9px; margin: 2px 0; border-radius: var(--md-r-full); }
54
+ .md3 .lc-skel .lc-skel-rate { display: flex; align-items: center; gap: 8px; height: 49px; margin-top: 4px; }
55
+ .md3 .lc-skel .lc-skel-rate .mskeleton:first-child { width: 120px; height: 38px; border-radius: var(--md-r-xs); }
56
+ .md3 .lc-skel .lc-skel-rate .mskeleton:last-child { width: 28px; height: 9px; border-radius: var(--md-r-full); }
57
+ .md3 .lc-skel .lc-skel-terms { width: 170px; max-width: 100%; height: 8px; margin: 11px 0 2px; border-radius: var(--md-r-full); }
58
+ .md3 .lc-skel .lc-skel-lease,
59
+ .md3 .lc-skel .lc-skel-buy { display: flex; flex-direction: column; border-top: 1px solid var(--md-outline-variant); }
60
+ .md3 .lc-skel .lc-skel-lease { padding-top: 14px; }
61
+ .md3 .lc-skel .lc-skel-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 21px; }
62
+ .md3 .lc-skel .lc-skel-line .mskeleton:first-child { width: 56px; height: 9px; border-radius: var(--md-r-full); }
63
+ .md3 .lc-skel .lc-skel-line .mskeleton:last-child { width: 72px; height: 15px; border-radius: var(--md-r-xs); }
64
+ .md3 .lc-skel .lc-skel-lease-terms { display: flex; flex-direction: column; margin-top: 6px; }
65
+ .md3 .lc-skel .lc-skel-lease-terms .mskeleton { height: 7px; margin: 2px 0 3px; border-radius: var(--md-r-full); }
66
+ .md3 .lc-skel .lc-skel-lease-terms .mskeleton:last-child { width: 62%; }
67
+ .md3 .lc-skel .lc-skel-buy { margin-top: auto; padding-top: 9px; }
68
+ .md3 .lc-skel .lc-skel-buy .lc-skel-line { height: 22px; }
69
+ .md3 .lc-skel .lc-skel-eval { display: flex; align-items: center; gap: 10px; height: 24px; margin-top: 15px; }
70
+ .md3 .lc-skel .lc-skel-eval .mskeleton:first-child { flex: none; width: 84px; height: 24px; border-radius: 12px; }
71
+ .md3 .lc-skel .lc-skel-eval .mskeleton:last-child { flex: 1; height: 8px; border-radius: var(--md-r-full); }
72
+ .md3 .lc-skel .lc-skel-cta { height: 40px; margin-top: 18px; border-radius: var(--md-r-full); }`;
73
+
74
+ const ROW_SKELETON_STYLE_ID = 'md3-row-skeleton-styles';
75
+
76
+ injectStyles(ROW_SKELETON_STYLE_ID, ROW_SKELETON_CSS);
77
+
78
+ const FACTS = [0, 1, 2, 3, 4, 5];
79
+
80
+ const CarRowSkeleton: React.FunctionComponent<CarRowSkeletonProps> = ({ withLeasing = true, className, style }) => {
81
+ React.useEffect(() => { injectStyles(ROW_SKELETON_STYLE_ID, ROW_SKELETON_CSS); }, []);
82
+ return (
83
+ <div className={'mcard listcard lc-skel' + (className ? ` ${className}` : '')} style={style} aria-hidden="true">
84
+ <div className="listcard-media">
85
+ <Skeleton className="lc-skel-photo" />
86
+ </div>
87
+
88
+ <div className="listcard-info">
89
+ <div className="lc-skel-head">
90
+ <Skeleton className="lc-skel-title" />
91
+ <Skeleton className="lc-skel-trim" />
92
+ </div>
93
+ <div className="specstrip">
94
+ {FACTS.map((fact) => (
95
+ <div key={fact} className="lc-skel-fact">
96
+ <Skeleton />
97
+ <Skeleton />
98
+ </div>
99
+ ))}
100
+ </div>
101
+ <div className="lc-skel-chips">
102
+ <Skeleton />
103
+ <Skeleton />
104
+ <Skeleton />
105
+ <Skeleton />
106
+ </div>
107
+ <div className="lc-skel-spacer" />
108
+ <div className="lc-skel-eco">
109
+ <Skeleton />
110
+ <Skeleton />
111
+ <Skeleton />
112
+ </div>
113
+ </div>
114
+
115
+ <div className="listcard-price">
116
+ <div className="lc-skel-paths">
117
+ <Skeleton className="lc-skel-eyebrow" />
118
+ <div className="lc-skel-rate">
119
+ <Skeleton />
120
+ <Skeleton />
121
+ </div>
122
+ <Skeleton className="lc-skel-terms" />
123
+ </div>
124
+ {withLeasing && (
125
+ <div className="lc-skel-lease">
126
+ <div className="lc-skel-line">
127
+ <Skeleton />
128
+ <Skeleton />
129
+ </div>
130
+ <div className="lc-skel-lease-terms">
131
+ <Skeleton />
132
+ <Skeleton />
133
+ </div>
134
+ </div>
135
+ )}
136
+ <div className="lc-skel-buy">
137
+ <div className="lc-skel-line">
138
+ <Skeleton />
139
+ <Skeleton />
140
+ </div>
141
+ <div className="lc-skel-eval">
142
+ <Skeleton />
143
+ <Skeleton />
144
+ </div>
145
+ <Skeleton className="lc-skel-cta" />
146
+ </div>
147
+ </div>
148
+ </div>
149
+ );
150
+ };
151
+
152
+ export default CarRowSkeleton;
@@ -489,11 +489,6 @@ export const PriceEvalCol: React.FunctionComponent<{ car: AutobahnCar; t: Transl
489
489
 
490
490
  export type PaymentMode = 'financing' | 'leasing' | 'buy';
491
491
 
492
- /** The tab a card opens on: the requested one (default Finanzierung), but never Leasing for a car
493
- * without a lease rate — PriceTabs has no Leasing tab for it. */
494
- export const startPaymentMode = (car: AutobahnCar, requested?: PaymentMode): PaymentMode =>
495
- requested === 'leasing' && car.lease == null ? 'financing' : requested || 'financing';
496
-
497
492
  export interface PriceTabsProps {
498
493
  car: AutobahnCar;
499
494
  mode: PaymentMode;
@@ -715,12 +710,7 @@ export const PriceTerms: React.FunctionComponent<{
715
710
  onShowDetails?: () => void;
716
711
  t: TranslationFunction;
717
712
  }> = ({ car, mode, onOpenRateAdjust, onShowDetails, t }) => {
718
- // Kaufen (buy): a cash purchase has no financing terms/details link — used to `return null`
719
- // here, which collapsed .cc-terms to 0 height on that tab while Financing/Leasing rendered a
720
- // real line, jumping the price row (and everything below it: rating pill, CTA row) up/down on
721
- // every tab switch. Render an empty, still-present .cc-terms div instead — same fix as the VDP
722
- // FinanceCalculator's .fin-cond (md3.css), which reserves its line's height the same way.
723
- if (mode === 'buy') return <div className="cc-terms" />;
713
+ if (mode === 'buy') return null;
724
714
  const finFirstInstallment =
725
715
  car.finFirstInstallment != null ? car.finFirstInstallment.toLocaleString('de-DE') : _finFirstInstallment;
726
716
  const finMonths = car.finMonths ?? _finMonths;
package/cards/index.ts CHANGED
@@ -11,6 +11,12 @@ export type { CarCardProps } from './CarCard';
11
11
  export { default as CarRow } from './CarRow';
12
12
  export type { CarRowProps } from './CarRow';
13
13
 
14
+ export { default as CarCardSkeleton } from './CarCardSkeleton';
15
+ export type { CarCardSkeletonProps } from './CarCardSkeleton';
16
+
17
+ export { default as CarRowSkeleton } from './CarRowSkeleton';
18
+ export type { CarRowSkeletonProps } from './CarRowSkeleton';
19
+
14
20
  export {
15
21
  fmtKm,
16
22
  cardSpec,
package/constants/app.ts CHANGED
@@ -40,17 +40,7 @@ export const LOCAL_STORAGE_KEY = {
40
40
  i18n_KEY: 'i18nLanguage'
41
41
  };
42
42
 
43
- // ADV-284: evaluated at import time — with site storage blocked, reading localStorage throws a
44
- // SecurityError that took down the whole bundle. Blocked storage behaves like "nothing saved".
45
- const readStoredLang = (): string | null => {
46
- try {
47
- return localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY);
48
- } catch (e) {
49
- return null;
50
- }
51
- };
52
-
53
- export const DEFAULT_LANG: string = typeof window !== 'undefined' ? readStoredLang() : 'de';
43
+ export const DEFAULT_LANG: string = typeof window !== 'undefined' ? localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : 'de';
54
44
 
55
45
  // Default support contact phone
56
46
  export const CONTACT_PHONE: string = '+498004030182';
package/constants/core.ts CHANGED
@@ -35,18 +35,7 @@ export const LOCAL_STORAGE_KEY = {
35
35
  i18n_KEY: 'i18nLanguage'
36
36
  };
37
37
 
38
- // ADV-284: evaluated at import time — with site storage blocked, merely reading
39
- // window.localStorage throws a SecurityError, which took down the whole bundle (landing
40
- // page never rendered). Treat blocked storage like "no language saved".
41
- const readStoredLang = (): string | null => {
42
- try {
43
- return typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null;
44
- } catch (e) {
45
- return null;
46
- }
47
- };
48
-
49
- export const DEFAULT_LANG: string = readStoredLang() ?? 'de';
38
+ export const DEFAULT_LANG: string = (typeof window !== 'undefined' ? window.localStorage.getItem(LOCAL_STORAGE_KEY.i18n_KEY) : null) ?? 'de';
50
39
 
51
40
  export const ROW_STYLES = {
52
41
  marginBottom: 10
@@ -42,6 +42,20 @@ import { TIER_LABELS, RatingTier, CO2_CLASSES, Co2Class } from '../constants/aut
42
42
  export const PLACEHOLDER_IMAGE =
43
43
  'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
44
44
 
45
+ /**
46
+ * The app-wide no-image asset, set ONCE at app start (fe-main's index.tsx passes its
47
+ * PLACEHOLDER_IMAGE_LARGE_URL, built from config.imagesAPI.imgUrlBase) — so every card that
48
+ * maps a car without a photo shows the "noimage" picture, not the transparent data URI above,
49
+ * without each page having to remember `deps.placeholder` (most didn't: the home page, /search,
50
+ * favourites and the dashboard all rendered an empty white photo). `deps.placeholder` still
51
+ * wins per call; the data URI stays the last resort (tests, an app that never sets this).
52
+ */
53
+ let defaultPlaceholder: string = PLACEHOLDER_IMAGE;
54
+
55
+ export function setPlaceholderImage(url: string): void {
56
+ defaultPlaceholder = url || PLACEHOLDER_IMAGE;
57
+ }
58
+
45
59
  /**
46
60
  * Dependencies the SRP container injects. Everything here is what the mapper
47
61
  * needs from the outside world — keeping the function itself pure.
@@ -67,7 +81,7 @@ export interface ToAutobahnCarDeps {
67
81
  t?: (key: string, options?: object) => string;
68
82
  /** active UI language ('de' | 'en' …). Drives de-DE vs en-IN number grouping for the EnVKV line. */
69
83
  language?: string;
70
- /** placeholder image URL override (defaults to PLACEHOLDER_IMAGE). */
84
+ /** placeholder image URL override (defaults to the one set with setPlaceholderImage). */
71
85
  placeholder?: string;
72
86
  /**
73
87
  * Buyer-activity stats for this car — UserActionsAPI 'stats/viewers' response, loaded async and
@@ -272,7 +286,7 @@ function isPluginHybrid(fuel: any): boolean {
272
286
  * `sizeOverride` lets a caller ask for a different size than `deps.imageSize` (e.g. a full-res
273
287
  * set for a lightbox, while the card thumbnail itself stays on the smaller default). */
274
288
  function buildGallery(storeCar: any, deps: ToAutobahnCarDeps, sizeOverride?: 'small' | 'medium' | 'large'): string[] {
275
- const placeholder = deps.placeholder || PLACEHOLDER_IMAGE;
289
+ const placeholder = deps.placeholder || defaultPlaceholder;
276
290
  // Only 'small' and 'large' variants are pre-generated by image-generator; 'medium' has no cached file.
277
291
  const size = sizeOverride || deps.imageSize || 'small';
278
292
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.182",
3
+ "version": "1.0.184",
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
@@ -10100,8 +10100,7 @@ line-height: 31px;
10100
10100
  z-index: 71;
10101
10101
  background: var(--md-surface);
10102
10102
  border-radius: var(--md-r-xl) var(--md-r-xl) 0 0;
10103
- /* % of the fixed containing block, not vh/dvh: on iOS vh is the toolbars-collapsed height, and Chrome on iOS does not shrink dvh while its toolbars are shown either, so a 92vh/92dvh bottom sheet grew under the address bar and hid its own header (title, download, close). The fixed box itself always matches the visible area. */
10104
- max-height: 92%;
10103
+ max-height: 92vh;
10105
10104
  display: flex;
10106
10105
  flex-direction: column;
10107
10106
  box-shadow: 0 -8px 30px rgba(16, 22, 42, 0.22);
@@ -14259,8 +14258,7 @@ color: #005CFF;
14259
14258
  flex-direction: column;
14260
14259
  width: 100%;
14261
14260
  max-width: 560px;
14262
- /* % of the scrim (fixed, inset 0, 16px padding) instead of calc(100vh - 32px): see the iOS note on the mobile .mmodal below */
14263
- max-height: 100%;
14261
+ max-height: calc(100vh - 32px);
14264
14262
  background: var(--md-sc-lowest, #fff);
14265
14263
  color: var(--md-on-surface);
14266
14264
  border-radius: var(--md-r-lg);
@@ -14406,8 +14404,7 @@ color: #005CFF;
14406
14404
  }
14407
14405
  .md3 .mmodal {
14408
14406
  max-width: 100%;
14409
- /* % of the fixed containing block, not vh/dvh: on iOS vh is the toolbars-collapsed height, and Chrome on iOS does not shrink dvh while its toolbars are shown either, so a 92vh/92dvh bottom sheet grew under the address bar and hid its own header (title, download, close). The fixed box itself always matches the visible area. */
14410
- max-height: 92%;
14407
+ max-height: 92vh;
14411
14408
  border-radius: var(--md-r-lg) var(--md-r-lg) 0 0;
14412
14409
  border-bottom: 0;
14413
14410
  animation: mmodal-sheet-up 0.25s ease-out;
package/ui/Skeleton.tsx CHANGED
@@ -1,16 +1,31 @@
1
1
  // Autobahn (auto.de redesign) — md3 loading skeleton.
2
2
  //
3
- // md3.css ships no skeleton class, so this is the ONE addition covering every
4
- // legacy `Skeleton`/`SkeletonItem` (MUI) call site: a div with an animated
5
- // gradient shimmer built from --md surface tokens. Prop surface mirrors the
6
- // subset fe-main actually used (variant / width / height / className / style;
7
- // `animation` is accepted and ignored — the shimmer always runs).
3
+ // md3.css ships no skeleton class, so this component brings its own CSS. It is the ONE
4
+ // skeleton for every block (and every legacy `Skeleton`/`SkeletonItem` MUI call site):
5
+ // a block with a light passing over it, built from --md surface tokens. Prop surface
6
+ // mirrors the subset fe-main used (variant / width / height / className / style;
7
+ // `animation` is accepted and ignored — the sweep always runs) plus `tone`.
8
8
  // Renders correctly only inside a `<div className="md3">` subtree.
9
+ //
10
+ // - tone 'surface' (default): grey blocks on the light page surfaces.
11
+ // - tone 'inverse': white-alpha blocks for the brand/dark surfaces (the home hero's blue
12
+ // gradient, the label inside a filled button).
13
+ // - The base and the passing light are CSS custom properties (--mskeleton-base /
14
+ // --mskeleton-shine), so a block can retune both for its own background.
15
+ // - The light is a ::after band moved with transform only, so it runs on the compositor
16
+ // and stays smooth while the main thread is busy loading — exactly when skeletons show.
17
+ // The band is 60vw wide whatever the bar's width, so it travels at one speed: bars
18
+ // stacked on one left edge (a heading over copy lines) light up together.
19
+ // - prefers-reduced-motion: no sweep, a slow fade of the block instead.
20
+ // - Skeletons are aria-hidden; the region showing them carries aria-busy and a visually
21
+ // hidden `<span className="mskeleton-sr" role="status">…lädt…</span>` saying what loads.
9
22
 
10
23
  import React from 'react';
11
24
 
12
25
  export interface SkeletonProps {
13
26
  variant?: 'text' | 'rectangular' | 'circular';
27
+ /** 'surface' (default) on light surfaces, 'inverse' on the brand blue / dark surfaces. */
28
+ tone?: 'surface' | 'inverse';
14
29
  width?: number | string;
15
30
  height?: number | string;
16
31
  className?: string;
@@ -22,35 +37,78 @@ export interface SkeletonProps {
22
37
 
23
38
  const SKELETON_CSS = `
24
39
  .md3 .mskeleton {
40
+ --mskeleton-base: var(--md-sc);
41
+ --mskeleton-shine: rgba(255, 255, 255, .9);
42
+ position: relative;
25
43
  display: block;
26
- background: linear-gradient(90deg, var(--md-sc) 25%, var(--md-sc-high, var(--md-sc-lowest)) 37%, var(--md-sc) 63%);
27
- background-size: 400% 100%;
28
- animation: md3-skeleton-shimmer 1.4s ease infinite;
44
+ overflow: hidden;
29
45
  border-radius: var(--md-r-sm);
46
+ background-color: var(--mskeleton-base);
47
+ }
48
+ .md3 .mskeleton::after {
49
+ content: '';
50
+ position: absolute;
51
+ top: 0;
52
+ bottom: 0;
53
+ left: 0;
54
+ width: 60vw;
55
+ background: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, var(--mskeleton-shine) 50%, rgba(255, 255, 255, 0) 70%);
56
+ transform: translateX(-100%);
57
+ animation: md3-skeleton-sweep 1.8s cubic-bezier(.4, 0, .2, 1) infinite;
58
+ pointer-events: none;
59
+ }
60
+ .md3 .mskeleton--inverse {
61
+ --mskeleton-base: rgba(255, 255, 255, .14);
62
+ --mskeleton-shine: rgba(255, 255, 255, .26);
30
63
  }
31
64
  .md3 .mskeleton--text { border-radius: var(--md-r-xs, 4px); transform: scale(1, 0.7); }
65
+ .md3 .mskeleton-sr {
66
+ position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
67
+ overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
68
+ }
32
69
  .md3 .mskeleton--circular { border-radius: 50%; }
33
- @keyframes md3-skeleton-shimmer {
34
- 0% { background-position: 100% 50%; }
35
- 100% { background-position: 0 50%; }
70
+ @keyframes md3-skeleton-sweep {
71
+ 0% { transform: translateX(-100%); }
72
+ 70%, 100% { transform: translateX(100vw); }
73
+ }
74
+ @keyframes md3-skeleton-fade {
75
+ 50% { opacity: .55; }
76
+ }
77
+ @media (prefers-reduced-motion: reduce) {
78
+ .md3 .mskeleton::after { display: none; }
79
+ .md3 .mskeleton { animation: md3-skeleton-fade 2.4s ease-in-out infinite; }
36
80
  }`;
37
81
 
38
82
  const SKELETON_STYLE_ID = 'md3-skeleton-styles';
39
83
 
40
- // one <style id> in document.head no matter how many skeletons mount — the same
41
- // pattern fe-main's VehicleSmallCardMd3 uses. SSR-safe (guarded document access).
42
- function ensureStylesInjected(): void {
43
- if (typeof document === 'undefined' || document.getElementById(SKELETON_STYLE_ID)) {
84
+ /**
85
+ * One <style id> in document.head per stylesheet, no matter how many components mount.
86
+ * Called when a module loads (and again from the component), so the very first frame of a
87
+ * skeleton is already styled — an unstyled <span> would render as nothing for a frame and
88
+ * then pop in. A stale copy (an older bundle, hot reload) is overwritten. SSR-safe.
89
+ * Shared with the other skeleton shapes (e.g. cards/CarCardSkeleton).
90
+ */
91
+ export function injectStyles(id: string, css: string): void {
92
+ if (typeof document === 'undefined') {
44
93
  return;
45
94
  }
46
- const style = document.createElement('style');
47
- style.id = SKELETON_STYLE_ID;
48
- style.innerHTML = SKELETON_CSS;
49
- document.head.appendChild(style);
95
+ let style = document.getElementById(id);
96
+ if (!style) {
97
+ style = document.createElement('style');
98
+ style.id = id;
99
+ document.head.appendChild(style);
100
+ }
101
+ if (style.textContent !== css) {
102
+ style.textContent = css;
103
+ }
50
104
  }
51
105
 
106
+ const ensureStylesInjected = (): void => injectStyles(SKELETON_STYLE_ID, SKELETON_CSS);
107
+
108
+ ensureStylesInjected();
109
+
52
110
  const Skeleton: React.FunctionComponent<SkeletonProps> = ({
53
- variant = 'rectangular', width, height, className, style, children,
111
+ variant = 'rectangular', tone = 'surface', width, height, className, style, children,
54
112
  }) => {
55
113
  React.useEffect(() => { ensureStylesInjected(); }, []);
56
114
  const dims: React.CSSProperties = {};
@@ -62,6 +120,7 @@ const Skeleton: React.FunctionComponent<SkeletonProps> = ({
62
120
  className={
63
121
  'mskeleton' +
64
122
  (variant !== 'rectangular' ? ` mskeleton--${variant}` : '') +
123
+ (tone !== 'surface' ? ` mskeleton--${tone}` : '') +
65
124
  (className ? ` ${className}` : '')
66
125
  }
67
126
  style={{ ...dims, ...style }}