@bytebrand/fe-ui-core-autobahn 1.0.137 → 1.0.138
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 +1 -1
- package/vdp/VdpModules.tsx +24 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bytebrand/fe-ui-core-autobahn",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.138",
|
|
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/vdp/VdpModules.tsx
CHANGED
|
@@ -2241,18 +2241,31 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
2241
2241
|
}, [open, initialShowBreakdown]);
|
|
2242
2242
|
// in-sheet "Finanzierungs-/Leasingdetails" toggle (mobile): expanding the breakdown alone left
|
|
2243
2243
|
// it below the fold — scroll the sheet body all the way down (same end state as opening via
|
|
2244
|
-
// the page's details link)
|
|
2245
|
-
//
|
|
2246
|
-
//
|
|
2244
|
+
// the page's details link) in one quick ~300ms ease-out. The click also skips
|
|
2245
|
+
// .fin-modal--expanded's 0.35s min-height transition (see the toggle's onClick): a scroll
|
|
2246
|
+
// running while the sheet is still growing gets clamped/retargeted every frame and stutters.
|
|
2247
|
+
// Hand-rolled rAF instead of scrollTo({behavior:'smooth'}) so the duration is ours, not the
|
|
2248
|
+
// browser's. Collapsing doesn't scroll.
|
|
2247
2249
|
const revealBreakdownRef = React.useRef(false);
|
|
2248
2250
|
React.useEffect(() => {
|
|
2249
2251
|
if (!showBreakdown || !revealBreakdownRef.current) return;
|
|
2250
2252
|
revealBreakdownRef.current = false;
|
|
2251
|
-
const
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2253
|
+
const body = mobileBreakdownRef.current?.closest('.fin-modal-body') as HTMLElement | null | undefined;
|
|
2254
|
+
if (!body) return;
|
|
2255
|
+
const from = body.scrollTop;
|
|
2256
|
+
const dist = body.scrollHeight - body.clientHeight - from;
|
|
2257
|
+
if (dist <= 0) return;
|
|
2258
|
+
const duration = 300;
|
|
2259
|
+
let start: number | null = null;
|
|
2260
|
+
let raf = 0;
|
|
2261
|
+
const step = (now: number): void => {
|
|
2262
|
+
if (start === null) start = now;
|
|
2263
|
+
const p = Math.min(1, (now - start) / duration);
|
|
2264
|
+
body.scrollTop = from + dist * (1 - Math.pow(1 - p, 3));
|
|
2265
|
+
if (p < 1) raf = window.requestAnimationFrame(step);
|
|
2266
|
+
};
|
|
2267
|
+
raf = window.requestAnimationFrame(step);
|
|
2268
|
+
return () => window.cancelAnimationFrame(raf);
|
|
2256
2269
|
}, [showBreakdown]);
|
|
2257
2270
|
|
|
2258
2271
|
// mobile-only: swipe-down-to-dismiss on the grabber/header (the mockup's drag handle).
|
|
@@ -3430,6 +3443,9 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
|
|
|
3430
3443
|
type="button"
|
|
3431
3444
|
onClick={() => {
|
|
3432
3445
|
revealBreakdownRef.current = !showBreakdown;
|
|
3446
|
+
// expanding: grow the sheet to full height at once (no min-height
|
|
3447
|
+
// transition) so the scroll-down above runs on a settled layout
|
|
3448
|
+
if (!showBreakdown && sheetRef.current) sheetRef.current.style.transition = 'none';
|
|
3433
3449
|
setShowBreakdown((v) => !v);
|
|
3434
3450
|
}}
|
|
3435
3451
|
style={{ ...expanderBtnStyle, justifyContent: 'center', padding: '2px 0 20px' }}>
|