@bytebrand/fe-ui-core-autobahn 1.0.66 → 1.0.68

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.
@@ -475,6 +475,11 @@ export interface PriceHeroProps {
475
475
  car: AutobahnCar;
476
476
  mode: PaymentMode;
477
477
  t: TranslationFunction;
478
+ /** opt-in: render the "/mtl." unit next to the rate even without a struck old price to caption
479
+ * (default false keeps every existing caller's behavior — the unit only ever showed alongside
480
+ * the UVP-Rate/old-price group). The SRP desktop card wants the unit on every financing/leasing
481
+ * rate, discounted or not. */
482
+ alwaysShowUnit?: boolean;
478
483
  }
479
484
 
480
485
  /** footnote badge + click-to-open popover, shared by the Finanzierung/Leasing "UVP-Rate" (³) and
@@ -529,7 +534,7 @@ const UvpBadge: React.FunctionComponent<{
529
534
  * superscript footnote markers (¹ price, ² struck reference, ³ "/mtl.") match the Figma card —
530
535
  * their legal text lives in the page's own footnote block, not duplicated per-card.
531
536
  */
532
- export const PriceHero: React.FunctionComponent<PriceHeroProps> = ({ car, mode, t }) => {
537
+ export const PriceHero: React.FunctionComponent<PriceHeroProps> = ({ car, mode, t, alwaysShowUnit }) => {
533
538
  const [uvpTooltipOpen, setUvpTooltipOpen] = useState(false);
534
539
  const isMoney = mode === 'buy';
535
540
  const value = mode === 'financing' ? car.monthly : mode === 'leasing' ? (car.lease as number) : car.price;
@@ -578,6 +583,10 @@ export const PriceHero: React.FunctionComponent<PriceHeroProps> = ({ car, mode,
578
583
  <span className="pp-hero-unit">{t('autobahn:card.price.perMonth')}</span>
579
584
  </span>
580
585
  )}
586
+ {/* opt-in (alwaysShowUnit): no discount to caption, so just the plain unit next to the
587
+ rate instead of the full UVP-Rate/old-price group — existing callers that don't pass
588
+ this prop keep showing nothing here, exactly as before. */}
589
+ {!isMoney && !showOld && alwaysShowUnit && <span className="pp-hero-unit">{t('autobahn:card.price.perMonth')}</span>}
581
590
  {/* Kaufen: no rate/unit to caption, just the real list price struck through — same
582
591
  car.listPrice already used by DropChip/PpRow. */}
583
592
  {isMoney && showOld && (
@@ -858,40 +867,21 @@ export const PricePaths: React.FunctionComponent<PricePathsProps> = ({ car, t, c
858
867
  const leasMonths = car.leaseMonths ?? _leasPeriod;
859
868
  const hasLeasTerms = Boolean(leasMileage && leasMonths);
860
869
  const leasMileageStr = leasMileage ? Number(leasMileage).toLocaleString('de-DE') : '';
861
- // same real struck-through reference rate PriceHero shows for the financing tab (oldMonthly) —
862
- // shown here too now that both rows render at once instead of behind a tab.
863
- const showOldMonthly = car.oldMonthly != null && car.oldMonthly > car.monthly;
864
- // same digit-length shrink technique as PriceHero's own rateLenClass, so a long rate (e.g.
865
- // 1.612 €) doesn't overflow the desktop hero's much larger 65px base size.
866
- const rateDigits = String(Math.round(car.monthly)).length;
867
- const rateLenClass =
868
- rateDigits >= 6 ? ' pp-hero-val--len6' : rateDigits === 5 ? ' pp-hero-val--len5' : rateDigits === 4 ? ' pp-hero-val--len4' : '';
869
870
  return (
870
871
  <div className={'pricepaths' + (className ? ' ' + className : '')}>
871
- <div className="pp-hero">
872
- <div className="pp-eyebrow">{t('autobahn:card.price.financingFrom')}</div>
873
- <div className="pp-hero-rate">
874
- {showOldMonthly && (
875
- <span className="pp-hero-old">
876
- {(car.oldMonthly as number).toLocaleString('de-DE')} €<sup>2</sup>
877
- </span>
878
- )}
879
- <b className={'num pp-hero-val' + rateLenClass}>
880
- {fmtRate(car.monthly)} €<sup>1</sup>
881
- </b>
882
- <span className="pp-hero-unit">
883
- {t('autobahn:card.price.perMonth')}
884
- <sup>3</sup>
885
- </span>
886
- </div>
887
- <div className="pp-hero-terms">
888
- {t('autobahn:card.price.financeTerms', {
889
- firstInstallment: finFirstInstallment,
890
- months: finMonths,
891
- count: finMonths,
892
- })}{' '}
893
- · <span className="pp-details-link">{t('autobahn:card.price.details')}</span>
894
- </div>
872
+ <div className="pp-eyebrow">{t('autobahn:card.price.financingFrom')}</div>
873
+ {/* reuses PriceHero's own financing rendering — the exact same stacked "UVP-Rate ⓘ /
874
+ struck price / mtl." group beside the rate that .cc-price and mobile's tab switcher
875
+ already use, so the rate + unit never fight for room in one flat row (the earlier
876
+ hand-rolled version here put them side by side and wrapped for any 4+-digit rate). */}
877
+ <PriceHero car={car} mode="financing" t={t} alwaysShowUnit />
878
+ <div className="pp-hero-terms">
879
+ {t('autobahn:card.price.financeTerms', {
880
+ firstInstallment: finFirstInstallment,
881
+ months: finMonths,
882
+ count: finMonths,
883
+ })}{' '}
884
+ · <span className="pp-details-link">{t('autobahn:card.price.details')}</span>
895
885
  </div>
896
886
  {hasLease && (
897
887
  <div className="pp-lease-row">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.66",
3
+ "version": "1.0.68",
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
@@ -4040,6 +4040,11 @@ line-height: 31px;
4040
4040
  .md3 .specstrip > span:nth-child(1) { order: -3; }
4041
4041
  .md3 .specstrip > span:nth-child(2) { order: -2; }
4042
4042
  .md3 .specstrip > span:nth-child(4) { order: -1; }
4043
+ /* a little extra room on the right for the 65px hero rate + its stacked UVP/old-price/unit
4044
+ group — mobile keeps the symmetric 18px (its own hero is 32px, never this tight). */
4045
+ .md3 .listcard-price {
4046
+ padding-right: 6px;
4047
+ }
4043
4048
  }
4044
4049
  /* filter rail: collapsible sections */
4045
4050
  .md3 .frail-group {
@@ -4310,6 +4315,89 @@ line-height: 31px;
4310
4315
  transform: rotate(12.53deg);
4311
4316
  transform-origin: center;
4312
4317
  }
4318
+ /* keep the rate + its UVP/old-price/unit group on ONE line (matches .cc-price's own override) —
4319
+ without this the group wraps below the rate the moment the column runs a few px short. */
4320
+ .md3 .listcard-price .pricepaths .pp-hero-rate {
4321
+ align-items: center;
4322
+ flex-wrap: nowrap;
4323
+ gap: 4px;
4324
+ }
4325
+ /* nowrap on the row alone still lets the flex algorithm SHRINK the rate itself to make room,
4326
+ which wrapped "310 €" into "310" / "€" on two lines — pin both items to their natural size so
4327
+ the row overflows visibly (a signal to trim further) instead of mangling the price digits. */
4328
+ .md3 .listcard-price .pricepaths .pp-hero-val {
4329
+ white-space: nowrap;
4330
+ flex-shrink: 0;
4331
+ }
4332
+ .md3 .listcard-price .pricepaths .pp-hero-unit-group {
4333
+ flex-shrink: 0;
4334
+ }
4335
+ /* the UVP-Rate caption nested inside the hero's own unit-group (PriceHero) — NOT the outer
4336
+ "Finanzierung ab" eyebrow this card renders itself (that one stays at its own 11px above);
4337
+ shrunk to the same 8px .cc-price uses so the 3-line stack stays narrow enough to fit beside
4338
+ the rate without wrapping. The badge has NO base (unscoped) style at all otherwise — it would
4339
+ render as bare, unstyled "3" text without this. */
4340
+ .md3 .listcard-price .pricepaths .pp-hero-unit-group .pp-eyebrow {
4341
+ position: relative;
4342
+ font-size: 8px;
4343
+ font-weight: 400;
4344
+ line-height: 9px;
4345
+ letter-spacing: normal;
4346
+ text-transform: none;
4347
+ color: #0e2238;
4348
+ margin-bottom: 2px;
4349
+ }
4350
+ .md3 .listcard-price .pricepaths .pp-eyebrow-badge {
4351
+ display: inline-flex;
4352
+ align-items: center;
4353
+ justify-content: center;
4354
+ position: absolute;
4355
+ top: -5px;
4356
+ right: -8px;
4357
+ border-radius: 50%;
4358
+ width: 12px;
4359
+ height: 11px;
4360
+ background: rgba(255, 255, 255, 0.96);
4361
+ border: 0.5px solid #005cff;
4362
+ font-size: 8px;
4363
+ line-height: 9px;
4364
+ color: #0e2238;
4365
+ cursor: pointer;
4366
+ }
4367
+ .md3 .listcard-price .pricepaths .pp-hero-old .pp-eyebrow-badge {
4368
+ top: -7px;
4369
+ right: -12px;
4370
+ }
4371
+ .md3 .listcard-price .pricepaths .pp-uvp-tooltip {
4372
+ position: absolute;
4373
+ top: 6px;
4374
+ right: -18px;
4375
+ left: -18px;
4376
+ z-index: 20;
4377
+ padding: 10px 12px;
4378
+ border-radius: 15px;
4379
+ background: #c5c6d2;
4380
+ box-shadow: var(--md-e2, 0 4px 12px rgba(0, 0, 0, 0.15));
4381
+ white-space: normal;
4382
+ cursor: default;
4383
+ }
4384
+ .md3 .listcard-price .pricepaths .pp-uvp-tooltip-close {
4385
+ position: absolute;
4386
+ top: -38px;
4387
+ right: 0;
4388
+ display: flex;
4389
+ align-items: center;
4390
+ justify-content: center;
4391
+ width: 32px;
4392
+ height: 32px;
4393
+ border-radius: 50%;
4394
+ background: rgba(11, 19, 32, 0.35);
4395
+ border: 1.5px solid rgba(255, 255, 255, 0.25);
4396
+ padding: 0;
4397
+ cursor: pointer;
4398
+ }
4399
+ .md3 .listcard-price .pricepaths .pp-uvp-tooltip-close svg { width: 14px; height: 14px; }
4400
+ .md3 .listcard-price .pricepaths .pp-uvp-tooltip-body { font-size: 11px; line-height: 13px; color: #0e2238; }
4313
4401
  .md3 .pp-hero-terms { margin-top: 9px; font-size: 11.5px; color: var(--md-on-surface-variant); }
4314
4402
  /* "Details" link at the end of the financing/leasing terms lines (Figma "mcard") — quiet, same
4315
4403
  color as the rest of the terms line but underlined so it still reads as tappable. */