@bytebrand/fe-ui-core-autobahn 1.0.210 → 1.0.212

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.
Files changed (45) hide show
  1. package/cards/CarCard.tsx +8 -1
  2. package/cards/CarCardSkeleton.tsx +103 -0
  3. package/cards/CarRow.tsx +5 -1
  4. package/cards/CarRowSkeleton.tsx +152 -0
  5. package/cards/cardParts.tsx +1368 -1363
  6. package/cards/index.ts +6 -0
  7. package/cards/types.ts +182 -182
  8. package/chrome/AccountMenuIcon.tsx +109 -0
  9. package/chrome/Footer.tsx +16 -3
  10. package/chrome/TopBar.tsx +139 -266
  11. package/compat/CookieModal/CookieModal.tsx +20 -6
  12. package/compat/CookieModal/Modal.tsx +6 -3
  13. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +43 -15
  14. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +4 -3
  15. package/compat/CookieModal/useModal.ts +5 -1
  16. package/compat/Loader/Loader.tsx +1 -7
  17. package/compat/MdField/MdField.tsx +28 -4
  18. package/compat/TimePicker/TimePicker.tsx +12 -2
  19. package/data/toAutobahnCar.ts +600 -586
  20. package/iconsvg/IconSVG.tsx +1 -5
  21. package/locales/de/autobahn.json +891 -857
  22. package/locales/en/autobahn.json +891 -857
  23. package/package.json +2 -2
  24. package/theme/md3.css +15678 -11743
  25. package/ui/CreditCostNotice.tsx +44 -44
  26. package/ui/CreditKeyFigures.tsx +244 -244
  27. package/ui/Dropdown.tsx +29 -10
  28. package/ui/FormCheckbox.tsx +22 -2
  29. package/ui/FormField.tsx +2 -1
  30. package/ui/Icon.tsx +6 -0
  31. package/ui/MfieldCheckIcon.tsx +13 -0
  32. package/ui/Modal.tsx +84 -6
  33. package/ui/Skeleton.tsx +79 -20
  34. package/ui/index.ts +96 -94
  35. package/ui/scrollFieldIntoView.ts +41 -0
  36. package/ui/usePortalMenuPosition.ts +27 -15
  37. package/utils/cookieConsent.ts +84 -0
  38. package/utils/index.ts +10 -0
  39. package/vdp/FinanceCalculator.tsx +1148 -1134
  40. package/vdp/VdpModules.tsx +3869 -4437
  41. package/vdp/index.ts +0 -3
  42. package/vdp/types.ts +7 -17
  43. package/vehiclesProps/accidentDisclosure.ts +25 -0
  44. package/vehiclesProps/decoratedLightProps.tsx +4 -0
  45. package/vehiclesProps/decoratedProps.tsx +4 -0
package/cards/CarCard.tsx CHANGED
@@ -38,6 +38,7 @@ import {
38
38
  GalleryActivityPill,
39
39
  cardSpec,
40
40
  PaymentMode,
41
+ startPaymentMode,
41
42
  callDealerSalesPhone,
42
43
  DEALER_SALES_PHONE,
43
44
  } from './cardParts';
@@ -98,6 +99,11 @@ export interface CarCardProps {
98
99
  * (still onOpenRateAdjust).
99
100
  */
100
101
  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;
101
107
  }
102
108
 
103
109
  const CarCard: React.FunctionComponent<CarCardProps> = ({
@@ -113,8 +119,9 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
113
119
  onCall,
114
120
  onOpenRateAdjust,
115
121
  onShowFinancingDetails,
122
+ initialMode,
116
123
  }) => {
117
- const [mode, setMode] = useState<PaymentMode>('financing');
124
+ const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
118
125
  const [photoIndex, setPhotoIndex] = useState(0);
119
126
  const [viewerOpen, setViewerOpen] = useState(false);
120
127
  const mediaRef = useRef<HTMLDivElement | null>(null);
@@ -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,6 +41,7 @@ import {
41
41
  ZeroDownChip,
42
42
  fmtKm,
43
43
  PaymentMode,
44
+ startPaymentMode,
44
45
  ratingTone,
45
46
  } from './cardParts';
46
47
  import { AutobahnCar } from './types';
@@ -80,6 +81,8 @@ export interface CarRowProps {
80
81
  * links render as plain text (see PricePaths' own fallback).
81
82
  */
82
83
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
84
+ /** Tab the mobile price tabs open on — see CarCard's identically-named prop. */
85
+ initialMode?: PaymentMode;
83
86
  }
84
87
 
85
88
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -92,8 +95,9 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
92
95
  t,
93
96
  adminAction,
94
97
  onShowFinancingDetails,
98
+ initialMode,
95
99
  }) => {
96
- const [mode, setMode] = useState<PaymentMode>('financing');
100
+ const [mode, setMode] = useState<PaymentMode>(() => startPaymentMode(car, initialMode));
97
101
  const [photoIndex, setPhotoIndex] = useState(0);
98
102
  const mediaRef = useRef<HTMLDivElement | null>(null);
99
103
  // 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;