@bytebrand/fe-ui-core-autobahn 1.0.208 → 1.0.210
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 +1 -8
- package/cards/CarRow.tsx +1 -5
- package/cards/cardParts.tsx +1363 -1368
- package/cards/index.ts +0 -6
- package/cards/types.ts +182 -182
- package/chrome/Footer.tsx +3 -16
- package/chrome/TopBar.tsx +266 -139
- package/compat/CookieModal/CookieModal.tsx +6 -20
- package/compat/CookieModal/Modal.tsx +3 -6
- package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
- package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
- package/compat/CookieModal/useModal.ts +1 -5
- package/compat/Loader/Loader.tsx +7 -1
- package/compat/MdField/MdField.tsx +4 -28
- package/compat/TimePicker/TimePicker.tsx +2 -12
- package/data/toAutobahnCar.ts +586 -600
- package/iconsvg/IconSVG.tsx +5 -1
- package/locales/de/autobahn.json +857 -891
- package/locales/en/autobahn.json +857 -891
- package/package.json +2 -2
- package/theme/md3.css +11743 -15678
- package/ui/CreditCostNotice.tsx +44 -44
- package/ui/CreditKeyFigures.tsx +244 -244
- package/ui/Dropdown.tsx +10 -29
- package/ui/FormCheckbox.tsx +2 -22
- package/ui/FormField.tsx +1 -2
- package/ui/Icon.tsx +0 -6
- package/ui/Modal.tsx +6 -84
- package/ui/Skeleton.tsx +20 -79
- package/ui/index.ts +94 -96
- package/ui/usePortalMenuPosition.ts +15 -27
- package/utils/index.ts +0 -10
- package/vdp/FinanceCalculator.tsx +1134 -1148
- package/vdp/VdpModules.tsx +4437 -3869
- package/vdp/index.ts +3 -0
- package/vdp/types.ts +17 -7
- package/vehiclesProps/decoratedLightProps.tsx +0 -4
- package/vehiclesProps/decoratedProps.tsx +0 -4
- package/cards/CarCardSkeleton.tsx +0 -103
- package/cards/CarRowSkeleton.tsx +0 -152
- package/chrome/AccountMenuIcon.tsx +0 -109
- package/ui/MfieldCheckIcon.tsx +0 -13
- package/ui/scrollFieldIntoView.ts +0 -41
- package/utils/cookieConsent.ts +0 -84
- package/vehiclesProps/accidentDisclosure.ts +0 -25
package/ui/index.ts
CHANGED
|
@@ -1,96 +1,94 @@
|
|
|
1
|
-
// Autobahn (auto.de redesign) — presentational UI primitives.
|
|
2
|
-
//
|
|
3
|
-
// Typed, pure React 18 + TS port of the design kit's primitives from
|
|
4
|
-
// docs/redesign/design-source/ui_kits/website/ui.jsx. The original kit exported
|
|
5
|
-
// everything via `Object.assign(window, {...})`; here each primitive is a real
|
|
6
|
-
// ES module with an explicit props interface, re-exported below.
|
|
7
|
-
//
|
|
8
|
-
// SCOPING — IMPORTANT:
|
|
9
|
-
// These components rely on the scoped CSS layer at
|
|
10
|
-
// services/fe-main/source/theme/autobahn/ (md3.css)
|
|
11
|
-
// where EVERY utility class is scoped under `.md3` (e.g. `.md3 .mbtn`,
|
|
12
|
-
// `.md3 .chip`, `.md3 .statchip--good`, `.md3 .segmented .on`, `.md3 .mfield`,
|
|
13
|
-
// `.md3 .num`, `.md3 .car-arrow`, `.md3 .imglabel`, `.md3 .md-title`, …).
|
|
14
|
-
// They therefore ONLY render correctly inside a `<div className="md3">` subtree.
|
|
15
|
-
//
|
|
16
|
-
// All components are pure/presentational: no store, no API, no window access.
|
|
17
|
-
|
|
18
|
-
export { default as Icon } from './Icon';
|
|
19
|
-
export type { IconProps } from './Icon';
|
|
20
|
-
|
|
21
|
-
export { default as Button } from './Button';
|
|
22
|
-
export type { ButtonProps, ButtonVariant, ButtonSize } from './Button';
|
|
23
|
-
|
|
24
|
-
export { default as IconButton } from './IconButton';
|
|
25
|
-
export type { IconButtonProps } from './IconButton';
|
|
26
|
-
|
|
27
|
-
export { default as Chip } from './Chip';
|
|
28
|
-
export type { ChipProps } from './Chip';
|
|
29
|
-
|
|
30
|
-
export { default as StatChip } from './StatChip';
|
|
31
|
-
export type { StatChipProps, StatChipTone } from './StatChip';
|
|
32
|
-
|
|
33
|
-
export { default as CreditCostNotice, CREDIT_COST_WARNING_DE } from './CreditCostNotice';
|
|
34
|
-
export type { CreditCostNoticeProps, CreditCostNoticeTone, CreditCostNoticeSize } from './CreditCostNotice';
|
|
35
|
-
|
|
36
|
-
export { default as CreditKeyFigures, creditKeyFigureLines, hasCreditKeyFigures, leasingKeyFigures } from './CreditKeyFigures';
|
|
37
|
-
export type { CreditKeyFiguresProps, CreditKeyFiguresData, LeasingKeyFigureInputs } from './CreditKeyFigures';
|
|
38
|
-
|
|
39
|
-
export { default as Segmented } from './Segmented';
|
|
40
|
-
export type { SegmentedProps, SegmentedOption } from './Segmented';
|
|
41
|
-
|
|
42
|
-
export { default as FormField } from './FormField';
|
|
43
|
-
export type { FormFieldProps } from './FormField';
|
|
44
|
-
|
|
45
|
-
export { default as Dropdown } from './Dropdown';
|
|
46
|
-
export type { DropdownProps, DropdownOption } from './Dropdown';
|
|
47
|
-
|
|
48
|
-
export {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
export
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
export
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
export
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
export { default as
|
|
70
|
-
export type {
|
|
71
|
-
export { default as
|
|
72
|
-
export type {
|
|
73
|
-
export { default as
|
|
74
|
-
export type {
|
|
75
|
-
export { default as
|
|
76
|
-
export type {
|
|
77
|
-
export { default as
|
|
78
|
-
export type {
|
|
79
|
-
export { default as
|
|
80
|
-
export type {
|
|
81
|
-
export { default as
|
|
82
|
-
export type {
|
|
83
|
-
export { default as
|
|
84
|
-
export type {
|
|
85
|
-
export { default as
|
|
86
|
-
export type {
|
|
87
|
-
export { default as
|
|
88
|
-
export type {
|
|
89
|
-
export { default as
|
|
90
|
-
export type {
|
|
91
|
-
export { default as
|
|
92
|
-
export type {
|
|
93
|
-
export { default as
|
|
94
|
-
export type {
|
|
95
|
-
export { default as Skeleton } from './Skeleton';
|
|
96
|
-
export type { SkeletonProps } from './Skeleton';
|
|
1
|
+
// Autobahn (auto.de redesign) — presentational UI primitives.
|
|
2
|
+
//
|
|
3
|
+
// Typed, pure React 18 + TS port of the design kit's primitives from
|
|
4
|
+
// docs/redesign/design-source/ui_kits/website/ui.jsx. The original kit exported
|
|
5
|
+
// everything via `Object.assign(window, {...})`; here each primitive is a real
|
|
6
|
+
// ES module with an explicit props interface, re-exported below.
|
|
7
|
+
//
|
|
8
|
+
// SCOPING — IMPORTANT:
|
|
9
|
+
// These components rely on the scoped CSS layer at
|
|
10
|
+
// services/fe-main/source/theme/autobahn/ (md3.css)
|
|
11
|
+
// where EVERY utility class is scoped under `.md3` (e.g. `.md3 .mbtn`,
|
|
12
|
+
// `.md3 .chip`, `.md3 .statchip--good`, `.md3 .segmented .on`, `.md3 .mfield`,
|
|
13
|
+
// `.md3 .num`, `.md3 .car-arrow`, `.md3 .imglabel`, `.md3 .md-title`, …).
|
|
14
|
+
// They therefore ONLY render correctly inside a `<div className="md3">` subtree.
|
|
15
|
+
//
|
|
16
|
+
// All components are pure/presentational: no store, no API, no window access.
|
|
17
|
+
|
|
18
|
+
export { default as Icon } from './Icon';
|
|
19
|
+
export type { IconProps } from './Icon';
|
|
20
|
+
|
|
21
|
+
export { default as Button } from './Button';
|
|
22
|
+
export type { ButtonProps, ButtonVariant, ButtonSize } from './Button';
|
|
23
|
+
|
|
24
|
+
export { default as IconButton } from './IconButton';
|
|
25
|
+
export type { IconButtonProps } from './IconButton';
|
|
26
|
+
|
|
27
|
+
export { default as Chip } from './Chip';
|
|
28
|
+
export type { ChipProps } from './Chip';
|
|
29
|
+
|
|
30
|
+
export { default as StatChip } from './StatChip';
|
|
31
|
+
export type { StatChipProps, StatChipTone } from './StatChip';
|
|
32
|
+
|
|
33
|
+
export { default as CreditCostNotice, CREDIT_COST_WARNING_DE } from './CreditCostNotice';
|
|
34
|
+
export type { CreditCostNoticeProps, CreditCostNoticeTone, CreditCostNoticeSize } from './CreditCostNotice';
|
|
35
|
+
|
|
36
|
+
export { default as CreditKeyFigures, creditKeyFigureLines, hasCreditKeyFigures, leasingKeyFigures } from './CreditKeyFigures';
|
|
37
|
+
export type { CreditKeyFiguresProps, CreditKeyFiguresData, LeasingKeyFigureInputs } from './CreditKeyFigures';
|
|
38
|
+
|
|
39
|
+
export { default as Segmented } from './Segmented';
|
|
40
|
+
export type { SegmentedProps, SegmentedOption } from './Segmented';
|
|
41
|
+
|
|
42
|
+
export { default as FormField } from './FormField';
|
|
43
|
+
export type { FormFieldProps } from './FormField';
|
|
44
|
+
|
|
45
|
+
export { default as Dropdown } from './Dropdown';
|
|
46
|
+
export type { DropdownProps, DropdownOption } from './Dropdown';
|
|
47
|
+
|
|
48
|
+
export { default as Spec } from './Spec';
|
|
49
|
+
export type { SpecProps } from './Spec';
|
|
50
|
+
|
|
51
|
+
export { default as Price } from './Price';
|
|
52
|
+
export type { PriceProps } from './Price';
|
|
53
|
+
|
|
54
|
+
export { default as Stars } from './Stars';
|
|
55
|
+
export type { StarsProps } from './Stars';
|
|
56
|
+
|
|
57
|
+
export { default as PriceEvalBar } from './PriceEvalBar';
|
|
58
|
+
export type { PriceEvalBarProps } from './PriceEvalBar';
|
|
59
|
+
|
|
60
|
+
export { default as SaveChip } from './SaveChip';
|
|
61
|
+
export type { SaveChipProps } from './SaveChip';
|
|
62
|
+
|
|
63
|
+
export { default as CardCarousel } from './CardCarousel';
|
|
64
|
+
export type { CardCarouselProps } from './CardCarousel';
|
|
65
|
+
|
|
66
|
+
// ── md3 kit (Group-B in-place rebuild) — form-bound + layout + overlay primitives ──
|
|
67
|
+
export { default as FormDropdown } from './FormDropdown';
|
|
68
|
+
export type { FormDropdownProps } from './FormDropdown';
|
|
69
|
+
export { default as FormCheckbox } from './FormCheckbox';
|
|
70
|
+
export type { FormCheckboxProps } from './FormCheckbox';
|
|
71
|
+
export { default as FormRadioGroup } from './FormRadioGroup';
|
|
72
|
+
export type { FormRadioGroupProps } from './FormRadioGroup';
|
|
73
|
+
export { default as FormRadio } from './FormRadio';
|
|
74
|
+
export type { FormRadioProps } from './FormRadio';
|
|
75
|
+
export { default as Accordion } from './Accordion';
|
|
76
|
+
export type { AccordionProps } from './Accordion';
|
|
77
|
+
export { default as Modal } from './Modal';
|
|
78
|
+
export type { ModalProps, ModalSize } from './Modal';
|
|
79
|
+
export { default as DatePicker } from './DatePicker';
|
|
80
|
+
export type { DatePickerProps } from './DatePicker';
|
|
81
|
+
export { default as Table, Thead, Tbody, Tr, Th, Td } from './Table';
|
|
82
|
+
export type { TableProps, TheadProps, TbodyProps, TrProps, ThProps, TdProps, TableAlign } from './Table';
|
|
83
|
+
export { default as Switch } from './Switch';
|
|
84
|
+
export type { SwitchProps } from './Switch';
|
|
85
|
+
export { default as Textarea } from './Textarea';
|
|
86
|
+
export type { TextareaProps } from './Textarea';
|
|
87
|
+
export { default as Pagination } from './Pagination';
|
|
88
|
+
export type { PaginationProps } from './Pagination';
|
|
89
|
+
export { default as Stepper } from './Stepper';
|
|
90
|
+
export type { StepperProps, StepperStep, StepStatus } from './Stepper';
|
|
91
|
+
export { default as FileUpload } from './FileUpload';
|
|
92
|
+
export type { FileUploadProps } from './FileUpload';
|
|
93
|
+
export { default as Skeleton } from './Skeleton';
|
|
94
|
+
export type { SkeletonProps } from './Skeleton';
|
|
@@ -45,11 +45,6 @@ export interface UsePortalMenuPositionArgs {
|
|
|
45
45
|
/** the trigger's wrapping element — always rendered (regardless of `open`), measured for position. */
|
|
46
46
|
rootRef: React.RefObject<HTMLElement>;
|
|
47
47
|
menuAlign?: 'left' | 'right';
|
|
48
|
-
/** 'auto' (default): flips ABOVE the trigger when there isn't room below (see ESTIMATED_MENU_HEIGHT
|
|
49
|
-
* below). 'down': always opens below, never flips — for a trigger where the caller knows the
|
|
50
|
-
* page has room below and an upward flip would overlap unrelated content above it (e.g. a
|
|
51
|
-
* trigger sitting right under a sticky/close heading). */
|
|
52
|
-
openDirection?: 'auto' | 'down';
|
|
53
48
|
/** called when the trigger scrolls out of view entirely, or a real user scroll happens after
|
|
54
49
|
* the post-open grace window — the menu has nothing sensible left to anchor to or chase. */
|
|
55
50
|
onCloseAway: () => void;
|
|
@@ -76,32 +71,14 @@ export interface UsePortalMenuPositionResult<TMenuEl extends HTMLElement = HTMLD
|
|
|
76
71
|
// reasonable estimate; it decides whether to flip ABOVE the trigger. The real size is then
|
|
77
72
|
// clamped to the space actually available (see `maxHeight` above), not just guessed at.
|
|
78
73
|
const ESTIMATED_MENU_HEIGHT = 300;
|
|
79
|
-
// .mselect-menu's own padding + border (6px*2 + 1px*2) — the consumers add it back on top of
|
|
80
|
-
// `maxHeight` for the box, so the space it fits into has to leave room for it.
|
|
81
|
-
const MENU_CHROME = 14;
|
|
82
74
|
// a scroll within this window of opening REPOSITIONS instead of closing — see the effect below.
|
|
83
75
|
const SELF_SCROLL_GRACE_MS = 500;
|
|
84
76
|
|
|
85
|
-
// Module-level (not hook-local) so Dropdown.tsx's own searchable-open scroll effect can reuse the
|
|
86
|
-
// exact same measurement — the sticky app header (.topbar, position:sticky/top:0) sits over the
|
|
87
|
-
// top of the viewport on every page that uses it (TopBar's autoHideOnScroll is opt-in, off by
|
|
88
|
-
// default — most pages keep it permanently docked), so anything that scrolls/positions content
|
|
89
|
-
// near the top of the viewport needs to stop at its live bottom edge, not y=0. Reading the
|
|
90
|
-
// header's live bottom edge (0 when absent, e.g. inside a modal, or when autoHideOnScroll has slid
|
|
91
|
-
// it away) gives a correct boundary without hardcoding a pixel height that could drift from the
|
|
92
|
-
// header's own CSS.
|
|
93
|
-
export const getSafeTop = (): number => {
|
|
94
|
-
if (typeof document === 'undefined') return 0;
|
|
95
|
-
const header = document.querySelector('.topbar');
|
|
96
|
-
return header ? Math.max(0, header.getBoundingClientRect().bottom) : 0;
|
|
97
|
-
};
|
|
98
|
-
|
|
99
77
|
export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivElement>({
|
|
100
78
|
enabled,
|
|
101
79
|
open,
|
|
102
80
|
rootRef,
|
|
103
81
|
menuAlign = 'left',
|
|
104
|
-
openDirection = 'auto',
|
|
105
82
|
onCloseAway,
|
|
106
83
|
}: UsePortalMenuPositionArgs): UsePortalMenuPositionResult<TMenuEl> {
|
|
107
84
|
const menuElRef = React.useRef<TMenuEl | null>(null);
|
|
@@ -138,6 +115,18 @@ export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivEleme
|
|
|
138
115
|
};
|
|
139
116
|
}, [enabled, open, portalRoot]);
|
|
140
117
|
|
|
118
|
+
// the portal menu's z-index (1400, .mselect-menu--portal) is intentionally higher than every
|
|
119
|
+
// other fixed overlay it must paint over (checkout sheets/modals) — which also means it would
|
|
120
|
+
// paint over the sticky app header (.topbar, position:sticky/top:0/z-index:50) if left
|
|
121
|
+
// unconstrained. Reading the header's live bottom edge (0 when absent, e.g. inside a modal, or
|
|
122
|
+
// when TopBar's autoHideOnScroll has slid it away) gives a correct top boundary without
|
|
123
|
+
// hardcoding a pixel height that could drift from the header's own CSS.
|
|
124
|
+
const getSafeTop = (): number => {
|
|
125
|
+
if (typeof document === 'undefined') return 0;
|
|
126
|
+
const header = document.querySelector('.topbar');
|
|
127
|
+
return header ? Math.max(0, header.getBoundingClientRect().bottom) : 0;
|
|
128
|
+
};
|
|
129
|
+
|
|
141
130
|
const [menuPos, setMenuPos] = React.useState<PortalMenuPos | null>(null);
|
|
142
131
|
|
|
143
132
|
const positionMenu = React.useCallback(() => {
|
|
@@ -155,14 +144,13 @@ export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivEleme
|
|
|
155
144
|
}
|
|
156
145
|
const spaceBelow = window.innerHeight - rect.bottom - GAP;
|
|
157
146
|
const spaceAbove = rect.top - safeTop - GAP;
|
|
158
|
-
const openAbove =
|
|
147
|
+
const openAbove = spaceBelow < ESTIMATED_MENU_HEIGHT && spaceAbove > spaceBelow;
|
|
159
148
|
// cap the menu to the space it ACTUALLY has in whichever direction it opens, instead of
|
|
160
149
|
// trusting a static CSS max-height on its own — near the header or viewport edge that static
|
|
161
150
|
// cap can still be taller than what's really available, which is what let the menu paint over
|
|
162
151
|
// the header in the first place. The consumer's own overflow-y:auto takes it from there once
|
|
163
152
|
// content exceeds this.
|
|
164
|
-
|
|
165
|
-
const available = Math.max(120, Math.min(ESTIMATED_MENU_HEIGHT - 12, (openAbove ? spaceAbove : spaceBelow) - MENU_CHROME));
|
|
153
|
+
const available = Math.max(120, Math.min(ESTIMATED_MENU_HEIGHT - 12, openAbove ? spaceAbove : spaceBelow));
|
|
166
154
|
setMenuPos({
|
|
167
155
|
width: rect.width,
|
|
168
156
|
left: menuAlign === 'right' ? 'auto' : rect.left,
|
|
@@ -171,7 +159,7 @@ export function usePortalMenuPosition<TMenuEl extends HTMLElement = HTMLDivEleme
|
|
|
171
159
|
bottom: openAbove ? window.innerHeight - rect.top + GAP : 'auto',
|
|
172
160
|
maxHeight: available,
|
|
173
161
|
});
|
|
174
|
-
}, [enabled, menuAlign,
|
|
162
|
+
}, [enabled, menuAlign, onCloseAway, rootRef]);
|
|
175
163
|
|
|
176
164
|
// Synchronous (pre-paint) position computation. useLayoutEffect — not useEffect — matters here:
|
|
177
165
|
// it runs right after the DOM mutation that mounted the portal but BEFORE the browser paints, so
|
package/utils/index.ts
CHANGED
|
@@ -62,14 +62,6 @@ export {
|
|
|
62
62
|
updateCookieList
|
|
63
63
|
} from './CommonUtils';
|
|
64
64
|
|
|
65
|
-
export {
|
|
66
|
-
COOKIE_CONSENT_CHANGE_EVENT,
|
|
67
|
-
getCookieConsentState,
|
|
68
|
-
openCookieSettings,
|
|
69
|
-
saveCookieConfig
|
|
70
|
-
} from './cookieConsent';
|
|
71
|
-
export type { CookieCategoryState, ICookieConsentState } from './cookieConsent';
|
|
72
|
-
|
|
73
65
|
export { getEquipment, getEquipmentCount } from '../vehiclesProps/equipment';
|
|
74
66
|
|
|
75
67
|
export type { IDecoratedProps, IEquipmentProps, ICarPropElement } from '../types/types';
|
|
@@ -91,5 +83,3 @@ export type { IValues, IFilters, IQuery } from './query';
|
|
|
91
83
|
// Decorated car props (renders React UI; lives in vehiclesProps/ with its
|
|
92
84
|
// IconContainer + Co2Widget dependencies under compat/).
|
|
93
85
|
export { default as getDecoratedProps } from '../vehiclesProps/decoratedProps';
|
|
94
|
-
export { setStrictConditionOwners, isStrictConditionOwner, strictAccidentStatus } from '../vehiclesProps/accidentDisclosure';
|
|
95
|
-
export type { AccidentStatus } from '../vehiclesProps/accidentDisclosure';
|