@bytebrand/fe-ui-core-autobahn 1.0.179 → 1.0.181
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 +0 -5
- 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/iconsvg/IconSVG.tsx +5 -1
- package/locales/de/autobahn.json +5 -37
- package/locales/en/autobahn.json +4 -36
- package/package.json +1 -1
- package/theme/md3.css +1235 -5352
- 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/index.ts +0 -2
- package/ui/usePortalMenuPosition.ts +15 -27
- package/utils/index.ts +0 -10
- package/vdp/FinanceCalculator.tsx +5 -19
- package/vdp/VdpModules.tsx +6 -36
- package/vdp/types.ts +5 -5
- package/vehiclesProps/decoratedLightProps.tsx +0 -4
- package/vehiclesProps/decoratedProps.tsx +0 -4
- 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
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react';
|
|
2
2
|
import useModal from './useModal';
|
|
3
3
|
import { updateCookieList } from '../../utils/CommonUtils';
|
|
4
|
-
import { OPEN_COOKIE_SETTINGS_EVENT } from '../../utils/cookieConsent';
|
|
5
4
|
import Modal from './Modal';
|
|
6
|
-
import { TranslationFunction } from '../../types';
|
|
7
5
|
|
|
8
6
|
export interface ICookieModal {
|
|
9
7
|
handleSentryInit?: () => void;
|
|
10
|
-
/** the host's `t` with the `autobahn` namespace (`cookieModal.*`); without it the dialog is German */
|
|
11
|
-
t?: TranslationFunction;
|
|
12
8
|
}
|
|
13
9
|
|
|
14
|
-
const CookieModal = ({ handleSentryInit
|
|
15
|
-
const { isVisible, toggleModal
|
|
10
|
+
const CookieModal = ({ handleSentryInit }: ICookieModal) => {
|
|
11
|
+
const { isVisible, toggleModal } = useModal();
|
|
16
12
|
const [modal, setModal] = useState('');
|
|
17
13
|
|
|
18
14
|
useEffect(
|
|
@@ -26,19 +22,6 @@ const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
|
|
|
26
22
|
[]
|
|
27
23
|
);
|
|
28
24
|
|
|
29
|
-
// ADV-268: "Cookie-Einstellungen ändern" (account page) reopens the settings dialog
|
|
30
|
-
useEffect(
|
|
31
|
-
() => {
|
|
32
|
-
const onOpenSettings = () => {
|
|
33
|
-
setModal('MANAGE_COOKIE_MODAL');
|
|
34
|
-
openModal();
|
|
35
|
-
};
|
|
36
|
-
window.addEventListener(OPEN_COOKIE_SETTINGS_EVENT, onOpenSettings);
|
|
37
|
-
return () => window.removeEventListener(OPEN_COOKIE_SETTINGS_EVENT, onOpenSettings);
|
|
38
|
-
},
|
|
39
|
-
[]
|
|
40
|
-
);
|
|
41
|
-
|
|
42
25
|
useEffect(
|
|
43
26
|
() => {
|
|
44
27
|
if (!isVisible) return undefined;
|
|
@@ -62,7 +45,6 @@ const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
|
|
|
62
45
|
? <Modal
|
|
63
46
|
isVisible={isVisible}
|
|
64
47
|
handleSentryInit={handleSentryInit}
|
|
65
|
-
t={t}
|
|
66
48
|
toggleModal={toggleModal}
|
|
67
49
|
name={modal}
|
|
68
50
|
modalProps={modalProps}
|
|
@@ -70,4 +52,8 @@ const CookieModal = ({ handleSentryInit = () => {}, t }: ICookieModal) => {
|
|
|
70
52
|
: <></>;
|
|
71
53
|
};
|
|
72
54
|
|
|
55
|
+
CookieModal.defaultProps = {
|
|
56
|
+
handleSentryInit: () => {}
|
|
57
|
+
};
|
|
58
|
+
|
|
73
59
|
export default CookieModal;
|
|
@@ -16,7 +16,6 @@ import * as React from 'react';
|
|
|
16
16
|
import * as ReactDOM from 'react-dom';
|
|
17
17
|
|
|
18
18
|
import ModalsConfig from './ModalsConfig';
|
|
19
|
-
import { TranslationFunction } from '../../types';
|
|
20
19
|
import styles from './Modal.styl';
|
|
21
20
|
|
|
22
21
|
interface IBasicModal {
|
|
@@ -25,7 +24,6 @@ interface IBasicModal {
|
|
|
25
24
|
handleSentryInit?: () => void;
|
|
26
25
|
name: string;
|
|
27
26
|
modalProps?: any;
|
|
28
|
-
t?: TranslationFunction;
|
|
29
27
|
}
|
|
30
28
|
|
|
31
29
|
const OVERLAY: React.CSSProperties = {
|
|
@@ -42,17 +40,16 @@ const SURFACE: React.CSSProperties = {
|
|
|
42
40
|
maxWidth: 640, width: '100%', maxHeight: '92vh', overflowY: 'auto'
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit
|
|
43
|
+
const BasicModal = ({ isVisible, toggleModal, name, modalProps, handleSentryInit }: IBasicModal) => {
|
|
46
44
|
if (!isVisible || typeof document === 'undefined') return null;
|
|
47
|
-
const label = t ? t('autobahn:cookieModal.dialogLabel') : '';
|
|
48
45
|
return ReactDOM.createPortal(
|
|
49
46
|
// wrapped in .md3: autobahn.css scopes every token/utility class (incl.
|
|
50
47
|
// .mbtn used by the modal buttons) under `.md3` and intentionally does
|
|
51
48
|
// nothing outside it — a bare document.body portal loses the theme.
|
|
52
49
|
<div className='md3'>
|
|
53
|
-
<div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label=
|
|
50
|
+
<div className={styles.overlay} style={OVERLAY} role='dialog' aria-modal='true' aria-label='Cookie-Einstellungen'>
|
|
54
51
|
<div className={styles.surface} style={SURFACE}>
|
|
55
|
-
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit
|
|
52
|
+
{ModalsConfig[name] && ModalsConfig[name]({ ...modalProps, toggleModal, handleSentryInit })}
|
|
56
53
|
</div>
|
|
57
54
|
</div>
|
|
58
55
|
</div>,
|
|
@@ -8,43 +8,19 @@ import MaterialAccordionGroup from '../../../MdAccordionGroup/MdAccordionGroup';
|
|
|
8
8
|
import MaterialSwitch from '../../../MdSwitch/MdSwitch';
|
|
9
9
|
import { COOKIE_SCHEMA, COOKIE_SCHEMA_LINKS } from '../../../../constants/common';
|
|
10
10
|
import { updateCookieList } from '../../../../utils/CommonUtils';
|
|
11
|
-
import { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
12
|
-
import { TranslationFunction } from '../../../../types';
|
|
13
11
|
|
|
14
12
|
import styles from './ManageCookieModal.styl';
|
|
15
13
|
|
|
16
14
|
interface IManageCookieModal {
|
|
17
15
|
toggleModal: () => void;
|
|
18
16
|
handleSentryInit?: () => void;
|
|
19
|
-
/** the host's `t` with the `autobahn` namespace loaded; without it the dialog stays German (fe-landing) */
|
|
20
|
-
t?: TranslationFunction;
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
interface IMarketingSwitches {
|
|
24
20
|
[key: string]: any;
|
|
25
21
|
}
|
|
26
22
|
|
|
27
|
-
|
|
28
|
-
const DE: Record<string, string> = {
|
|
29
|
-
title: 'Nach den Cookies geht die Fahrt weiter.',
|
|
30
|
-
manageText: 'Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.',
|
|
31
|
-
'necessary.title': 'Notwendig',
|
|
32
|
-
'necessary.text': 'Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.',
|
|
33
|
-
'analytics.title': 'Analytisch',
|
|
34
|
-
'analytics.text': 'Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.',
|
|
35
|
-
'marketing.title': 'Marketing',
|
|
36
|
-
'marketing.text': 'Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.',
|
|
37
|
-
privacyPolicy: 'Datenschutzbestimmungen',
|
|
38
|
-
saveSelection: 'Auswahl speichern',
|
|
39
|
-
acceptAll: 'Alles akzeptieren'
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieModal) => {
|
|
43
|
-
// a key the host can't resolve (namespace not loaded) comes back as the key itself
|
|
44
|
-
const tr = (key: string) => {
|
|
45
|
-
const text = t ? t(`autobahn:cookieModal.${key}`) : '';
|
|
46
|
-
return text && !text.endsWith(`cookieModal.${key}`) ? text : DE[key];
|
|
47
|
-
};
|
|
23
|
+
const ManageCookieModal = ({ toggleModal, handleSentryInit } : IManageCookieModal) => {
|
|
48
24
|
const [analytcisMasterSwitch, setAnalyticsMasterSwitch] = useState(false);
|
|
49
25
|
const [marketingMasterSwitch, setMarketingMasterSwitch] = useState(false);
|
|
50
26
|
const [analyticsSwitches, setAnalyticsSwitches] = useState<IMarketingSwitches>({});
|
|
@@ -68,10 +44,6 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
68
44
|
.reduce((acc, item) => ({ ...acc, [item]: !!savedConfig && !savedDisabledMarketing.includes(item) }), {});
|
|
69
45
|
setAnalyticsSwitches(newAnalyticsSwitches);
|
|
70
46
|
setMarketingSwitches(newMarketingSwitches);
|
|
71
|
-
// ADV-268: reopened from the account page, a category whose cookies are all allowed shows
|
|
72
|
-
// its master switch on (it always started off)
|
|
73
|
-
setAnalyticsMasterSwitch(Object.values(newAnalyticsSwitches).every(Boolean));
|
|
74
|
-
setMarketingMasterSwitch(Object.values(newMarketingSwitches).every(Boolean));
|
|
75
47
|
},
|
|
76
48
|
[]
|
|
77
49
|
);
|
|
@@ -114,7 +86,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
114
86
|
marketing: Object.keys(marketingSwitches).filter(i => !marketingSwitches[i]) || [],
|
|
115
87
|
analytics: Object.keys(analyticsSwitches).filter(i => !analyticsSwitches[i]) || []
|
|
116
88
|
};
|
|
117
|
-
|
|
89
|
+
localStorage.setItem('cookieConfig', JSON.stringify(cookieConfig));
|
|
118
90
|
updateCookieList(handleSentryInit);
|
|
119
91
|
toggleModal();
|
|
120
92
|
};
|
|
@@ -138,34 +110,34 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
138
110
|
return (
|
|
139
111
|
<div className={styles.modalWrapper}>
|
|
140
112
|
<IconSVG name='autodeLogo' customDimensions />
|
|
141
|
-
<div className={styles.modalTitle}>
|
|
142
|
-
<div className={styles.modalContent}>
|
|
113
|
+
<div className={styles.modalTitle}>Nach den Cookies geht die Fahrt weiter.</div>
|
|
114
|
+
<div className={styles.modalContent}>Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.</div>
|
|
143
115
|
<div className={styles.accordions}>
|
|
144
116
|
<MaterialAccordionGroup
|
|
145
|
-
title=
|
|
117
|
+
title='Notwendig'
|
|
146
118
|
// tooltipText='Notwendig'
|
|
147
119
|
withSwitch
|
|
148
120
|
switchProps={necessarySwitchProps}
|
|
149
121
|
>
|
|
150
|
-
<span className={styles.accordionDescription}>
|
|
122
|
+
<span className={styles.accordionDescription}>Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen.</span>
|
|
151
123
|
{Object.keys(COOKIE_SCHEMA.necessary).map(cookie => {
|
|
152
124
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
153
125
|
return (
|
|
154
126
|
<div className={styles.switchBlock} key={cookie} >
|
|
155
127
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
156
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
128
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
|
|
157
129
|
<MaterialSwitch sx={{ marginLeft: 'auto' }} disabled={true} value={true} onChange={() => {}} />
|
|
158
130
|
</div>
|
|
159
131
|
);
|
|
160
132
|
})}
|
|
161
133
|
</MaterialAccordionGroup>
|
|
162
134
|
<MaterialAccordionGroup
|
|
163
|
-
title=
|
|
135
|
+
title='Analytisch'
|
|
164
136
|
withSwitch
|
|
165
137
|
// tooltipText='Analytisch'
|
|
166
138
|
switchProps={analyticsSwitchProps}
|
|
167
139
|
>
|
|
168
|
-
<span className={styles.accordionDescription}>
|
|
140
|
+
<span className={styles.accordionDescription}>Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können.</span>
|
|
169
141
|
{Object.keys(COOKIE_SCHEMA.analytics).map(cookie => {
|
|
170
142
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `analytics['${cookie}']`, null);
|
|
171
143
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -173,7 +145,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
173
145
|
return (
|
|
174
146
|
<div className={styles.switchBlock} key={cookie} >
|
|
175
147
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
176
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
148
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
|
|
177
149
|
<MaterialSwitch
|
|
178
150
|
sx={{ marginLeft: 'auto' }}
|
|
179
151
|
value={isChecked}
|
|
@@ -184,12 +156,12 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
184
156
|
})}
|
|
185
157
|
</MaterialAccordionGroup>
|
|
186
158
|
<MaterialAccordionGroup
|
|
187
|
-
title=
|
|
159
|
+
title='Marketing'
|
|
188
160
|
withSwitch
|
|
189
161
|
// tooltipText='Marketing'
|
|
190
162
|
switchProps={marketingSwitchProps}
|
|
191
163
|
>
|
|
192
|
-
<span className={styles.accordionDescription}>
|
|
164
|
+
<span className={styles.accordionDescription}>Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen.</span>
|
|
193
165
|
{Object.keys(COOKIE_SCHEMA.marketing).map(cookie => {
|
|
194
166
|
const getItemsFromCategory = _get(COOKIE_SCHEMA, `marketing['${cookie}']`, null);
|
|
195
167
|
const getLinkFromCategory = _get(COOKIE_SCHEMA_LINKS, [cookie], '');
|
|
@@ -197,7 +169,7 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
197
169
|
return (
|
|
198
170
|
<div className={styles.switchBlock} key={cookie} >
|
|
199
171
|
<span className={styles.switchBlockTitle}>{cookie}</span>
|
|
200
|
-
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>
|
|
172
|
+
<a className={styles.switchBlockLink} href={getLinkFromCategory} target='_blank'>Datenschutzbestimmungen</a>
|
|
201
173
|
<MaterialSwitch
|
|
202
174
|
sx={{ marginLeft: 'auto' }}
|
|
203
175
|
value={isChecked}
|
|
@@ -209,8 +181,8 @@ const ManageCookieModal = ({ toggleModal, handleSentryInit, t } : IManageCookieM
|
|
|
209
181
|
</MaterialAccordionGroup>
|
|
210
182
|
</div>
|
|
211
183
|
<div className={styles.buttonsContainer}>
|
|
212
|
-
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >
|
|
213
|
-
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>
|
|
184
|
+
<Button onClick={() => onAccept()} className={classNames(styles.modalBtn, styles.outlinedBtn, styles.zustimmenBtn)} >Auswahl speichern</Button>
|
|
185
|
+
<Button onClick={() => onAccept({ marketing: [], analytics: [] })} className={classNames(styles.modalBtn, styles.zustimmenBtn)}>Alles akzeptieren</Button>
|
|
214
186
|
</div>
|
|
215
187
|
</div>
|
|
216
188
|
);
|
|
@@ -3,7 +3,6 @@ import IconSVG from '../../../../iconsvg/IconSVG';
|
|
|
3
3
|
import Button from '../../../Button/Button';
|
|
4
4
|
import styles from './PreviewCookieModal.styl';
|
|
5
5
|
import { updateCookieList } from '../../../../utils/CommonUtils';
|
|
6
|
-
import { saveCookieConfig } from '../../../../utils/cookieConsent';
|
|
7
6
|
import { COOKIE_SCHEMA } from '../../../../constants/common';
|
|
8
7
|
|
|
9
8
|
interface IPreviewCookieModal {
|
|
@@ -15,16 +14,16 @@ interface IPreviewCookieModal {
|
|
|
15
14
|
const PreviewCookieModal = ({ toggleModal, setModal, handleSentryInit } : IPreviewCookieModal) => {
|
|
16
15
|
const environment = window.location.origin;
|
|
17
16
|
const onAcceptAll = () => {
|
|
18
|
-
|
|
17
|
+
localStorage.setItem('cookieConfig', JSON.stringify({ marketing: [], analytics: [] }));
|
|
19
18
|
updateCookieList(handleSentryInit);
|
|
20
19
|
toggleModal();
|
|
21
20
|
};
|
|
22
21
|
|
|
23
22
|
const onDisableAll = () => {
|
|
24
|
-
|
|
23
|
+
localStorage.setItem('cookieConfig', JSON.stringify({
|
|
25
24
|
marketing: Object.values(COOKIE_SCHEMA.marketing).reduce((acc: string[], val: string[]) => acc.concat(val), []),
|
|
26
25
|
analytics: Object.values(COOKIE_SCHEMA.analytics).reduce((acc: string[], val: string[]) => acc.concat(val), [])
|
|
27
|
-
});
|
|
26
|
+
}));
|
|
28
27
|
updateCookieList(handleSentryInit);
|
|
29
28
|
toggleModal();
|
|
30
29
|
};
|
package/compat/Loader/Loader.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export interface ILoaderProps {
|
|
|
10
10
|
fluid?: boolean;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
-
const Loader: React.FC<ILoaderProps> = ({ className
|
|
13
|
+
const Loader: React.FC<ILoaderProps> = ({ className, size, fluid }) => {
|
|
14
14
|
const classNames = classnames(
|
|
15
15
|
styles.loader,
|
|
16
16
|
{ [styles[size]]: !fluid },
|
|
@@ -23,4 +23,10 @@ const Loader: React.FC<ILoaderProps> = ({ className = '', size = 'medium', fluid
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
Loader.defaultProps = {
|
|
27
|
+
className: '',
|
|
28
|
+
size: 'medium',
|
|
29
|
+
fluid: false
|
|
30
|
+
};
|
|
31
|
+
|
|
26
32
|
export default Loader;
|
|
@@ -8,7 +8,6 @@ import * as React from 'react';
|
|
|
8
8
|
import classnames from 'classnames';
|
|
9
9
|
|
|
10
10
|
import Icon from '../../ui/Icon';
|
|
11
|
-
import MfieldCheckIcon from '../../ui/MfieldCheckIcon';
|
|
12
11
|
|
|
13
12
|
export interface MdFieldProps {
|
|
14
13
|
className?: string;
|
|
@@ -33,21 +32,12 @@ export interface MdFieldProps {
|
|
|
33
32
|
* when empty and unfocused, then floats up to the normal small-label spot on focus
|
|
34
33
|
* or once a value is typed. Defaults to false — the static above-field label. */
|
|
35
34
|
floatingLabel?: boolean;
|
|
36
|
-
/** opt-in: show a green check + green border when the field is filled and valid (checkout).
|
|
37
|
-
* Same contract/markup as FormField's own showValid (.mfield--valid/.mfield-ok, md3.css). */
|
|
38
|
-
showValid?: boolean;
|
|
39
35
|
onChange: (value: string, name?: string, event?: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
40
|
-
/** fires after the field's own internal blur handling (floating-label state). Callers use
|
|
41
|
-
* this to trigger `field.validate()` (mobx-react-form) on blur — this component only owns
|
|
42
|
-
* the `error` prop's display, not when validation actually runs, so without a caller wiring
|
|
43
|
-
* this in, `field.error` never populates from blur and a required-but-empty field never
|
|
44
|
-
* shows its error text/red border until some other validate() call happens to run. */
|
|
45
|
-
onBlur?: () => void;
|
|
46
36
|
}
|
|
47
37
|
|
|
48
38
|
const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
49
39
|
className, error, sx, required, disabled, multiline, autoComplete,
|
|
50
|
-
value, type, name, rows, label, placeholder, floatingLabel, maxLength,
|
|
40
|
+
value, type, name, rows, label, placeholder, floatingLabel, maxLength, onChange
|
|
51
41
|
}) => {
|
|
52
42
|
const [reveal, setReveal] = React.useState(false);
|
|
53
43
|
const [focused, setFocused] = React.useState(false);
|
|
@@ -64,7 +54,6 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
64
54
|
// a value is typed, the real <label> appears in its normal static spot above the
|
|
65
55
|
// field and the native placeholder goes quiet — the two never show at the same time.
|
|
66
56
|
const hasValue = value != null && value !== '';
|
|
67
|
-
const isValid = !!showValid && !disabled && !isPassword && !hasError && hasValue;
|
|
68
57
|
const resting = !!floatingLabel && !focused && !hasValue;
|
|
69
58
|
const effectivePlaceholder = floatingLabel ? (resting ? (label || placeholder || '') : '') : (placeholder || '');
|
|
70
59
|
// The real <label> is skipped entirely while resting (see above), leaving the input with
|
|
@@ -82,9 +71,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
82
71
|
|
|
83
72
|
return (
|
|
84
73
|
<div className={classnames('mfield-group', className)} style={sx as React.CSSProperties}>
|
|
85
|
-
{
|
|
86
|
-
plain label-above-the-box row — unchanged, still a .mfield-group flex child. */}
|
|
87
|
-
{label && !resting && !floatingLabel ? (
|
|
74
|
+
{label && !resting ? (
|
|
88
75
|
<label className='md-label-sm mfield-label' htmlFor={generatedId}>
|
|
89
76
|
{label}{required ? ' *' : ''}
|
|
90
77
|
</label>
|
|
@@ -100,18 +87,8 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
100
87
|
+ (hasError ? ' mfield--error' : '')
|
|
101
88
|
+ (disabled ? ' mfield--disabled' : '')
|
|
102
89
|
+ (floatingLabel ? ' mfield--floating' : '')
|
|
103
|
-
+ (isValid ? ' mfield--valid' : '')
|
|
104
90
|
}
|
|
105
91
|
>
|
|
106
|
-
{/* floatingLabel + floated (focused or has a value): the Material "notched outline"
|
|
107
|
-
treatment — label sits ON the border line, not stacked above it in its own row.
|
|
108
|
-
Lives INSIDE .mfield (not .mfield-group) so it can position against .mfield's own
|
|
109
|
-
edge (.mfield is position:relative already, md3.css) via .mfield-label--notch. */}
|
|
110
|
-
{label && !resting && floatingLabel ? (
|
|
111
|
-
<label className='md-label-sm mfield-label mfield-label--notch' htmlFor={generatedId}>
|
|
112
|
-
{label}{required ? ' *' : ''}
|
|
113
|
-
</label>
|
|
114
|
-
) : null}
|
|
115
92
|
{multiline ? (
|
|
116
93
|
<textarea
|
|
117
94
|
id={generatedId}
|
|
@@ -119,7 +96,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
119
96
|
value={value == null ? '' : value}
|
|
120
97
|
onChange={handleChange}
|
|
121
98
|
onFocus={() => setFocused(true)}
|
|
122
|
-
onBlur={() =>
|
|
99
|
+
onBlur={() => setFocused(false)}
|
|
123
100
|
disabled={disabled}
|
|
124
101
|
rows={rows || 3}
|
|
125
102
|
maxLength={maxLength}
|
|
@@ -138,7 +115,7 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
138
115
|
value={value == null ? '' : value}
|
|
139
116
|
onChange={handleChange}
|
|
140
117
|
onFocus={() => setFocused(true)}
|
|
141
|
-
onBlur={() =>
|
|
118
|
+
onBlur={() => setFocused(false)}
|
|
142
119
|
disabled={disabled}
|
|
143
120
|
maxLength={maxLength}
|
|
144
121
|
placeholder={effectivePlaceholder}
|
|
@@ -160,7 +137,6 @@ const MdField: React.FunctionComponent<MdFieldProps> = ({
|
|
|
160
137
|
<Icon name={reveal ? 'eye-off' : 'eye'} size={18} />
|
|
161
138
|
</button>
|
|
162
139
|
) : null}
|
|
163
|
-
{isValid ? <span className="mfield-ok"><MfieldCheckIcon /></span> : null}
|
|
164
140
|
</div>
|
|
165
141
|
{hasError ? (
|
|
166
142
|
// role="alert" announces this to screen readers the moment it enters the DOM (e.g.
|
package/iconsvg/IconSVG.tsx
CHANGED
|
@@ -7,7 +7,7 @@ type TIconSVG = {
|
|
|
7
7
|
customDimensions?: boolean;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions
|
|
10
|
+
const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions, ...props }: TIconSVG) => {
|
|
11
11
|
if (!name) return null;
|
|
12
12
|
|
|
13
13
|
const Component: any = components[name.toString()];
|
|
@@ -23,4 +23,8 @@ const IconSVG: React.FC<TIconSVG> = ({ name, isWarrantyActive, customDimensions
|
|
|
23
23
|
);
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
IconSVG.defaultProps = {
|
|
27
|
+
customDimensions: false
|
|
28
|
+
};
|
|
29
|
+
|
|
26
30
|
export default IconSVG;
|
package/locales/de/autobahn.json
CHANGED
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"finance": {
|
|
68
68
|
"termSelection": "Laufzeit",
|
|
69
69
|
"termSelectionMonths": "Laufzeit (Monate)",
|
|
70
|
-
"change": "Ändern",
|
|
71
70
|
"headerTitle": "Dein Angebot",
|
|
72
71
|
"adjustRate": "Rate anpassen",
|
|
73
72
|
"secureOffer": "Angebot anfragen",
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
"detailsShow": "Details anzeigen",
|
|
89
88
|
"paymentLabel": "Zahlung",
|
|
90
89
|
"paymentValue": "Überweisung",
|
|
91
|
-
"warrantyLabel": "
|
|
90
|
+
"warrantyLabel": "Garantie",
|
|
92
91
|
"warrantyValue": "1 Jahr inklusive",
|
|
93
92
|
"deliveryLabel": "Lieferung",
|
|
94
93
|
"deliveryValue": "ca. 7–14 Tage · oder Abholung",
|
|
@@ -277,16 +276,7 @@
|
|
|
277
276
|
"myDealers": "Meine Händler",
|
|
278
277
|
"dashboard": "Dashboard",
|
|
279
278
|
"dealerDashboard": "Händler-Dashboard",
|
|
280
|
-
"imageSettings": "Bildeinstellungen"
|
|
281
|
-
"acct": {
|
|
282
|
-
"overview": "Übersicht",
|
|
283
|
-
"myOrder": "Meine Bestellung",
|
|
284
|
-
"savedSearches": "Gespeicherte Suchen",
|
|
285
|
-
"favorites": "Favoriten",
|
|
286
|
-
"compare": "Fahrzeuge vergleichen",
|
|
287
|
-
"profile": "Profil",
|
|
288
|
-
"support": "Support & Rückruf"
|
|
289
|
-
}
|
|
279
|
+
"imageSettings": "Bildeinstellungen"
|
|
290
280
|
},
|
|
291
281
|
"srp": {
|
|
292
282
|
"trust": {
|
|
@@ -494,8 +484,7 @@
|
|
|
494
484
|
"ratings": "Bewertungen"
|
|
495
485
|
},
|
|
496
486
|
"section": {
|
|
497
|
-
"similar": "Ähnliche Fahrzeuge"
|
|
498
|
-
"unavailableSimilar": "Ähnliche / vergleichbare Fahrzeuge"
|
|
487
|
+
"similar": "Ähnliche Fahrzeuge"
|
|
499
488
|
},
|
|
500
489
|
"breadcrumb": {
|
|
501
490
|
"home": "Start",
|
|
@@ -711,7 +700,7 @@
|
|
|
711
700
|
},
|
|
712
701
|
"modal": {
|
|
713
702
|
"leasingDetails": "Leasingdetails",
|
|
714
|
-
"financingDetails": "
|
|
703
|
+
"financingDetails": "Finanzierungs-Details",
|
|
715
704
|
"close": "Schließen",
|
|
716
705
|
"vehiclePrice": "Fahrzeugpreis ggf. inkl. MwSt.",
|
|
717
706
|
"leasingAmount": "Leasingbetrag",
|
|
@@ -806,8 +795,7 @@
|
|
|
806
795
|
"serviceHistory": "Scheckheft",
|
|
807
796
|
"warranty": "Garantie",
|
|
808
797
|
"yes": "Ja",
|
|
809
|
-
"no": "Nein"
|
|
810
|
-
"notSpecified": "keine Angabe"
|
|
798
|
+
"no": "Nein"
|
|
811
799
|
},
|
|
812
800
|
"common": {
|
|
813
801
|
"needsData": "Daten folgt"
|
|
@@ -855,25 +843,5 @@
|
|
|
855
843
|
"captionSlices": "Scheiben",
|
|
856
844
|
"captionSteeringWheel": "Lenkrad",
|
|
857
845
|
"captionWheelsLandingGear": "Räder | Fahrwerk"
|
|
858
|
-
},
|
|
859
|
-
"cookieModal": {
|
|
860
|
-
"dialogLabel": "Cookie-Einstellungen",
|
|
861
|
-
"title": "Nach den Cookies geht die Fahrt weiter.",
|
|
862
|
-
"manageText": "Für ein bestmögliches Nutzererlebnis setzen wir Cookies und andere Technologien ein. Diese können Sie hier verwalten.",
|
|
863
|
-
"necessary": {
|
|
864
|
-
"title": "Notwendig",
|
|
865
|
-
"text": "Wir verwenden Browser-Cookies, die notwendig sind, damit die Website wie vorgesehen funktioniert. Beispiel: Wir speichern Ihre Präferenzen bei der Datenerfassung auf der Website, damit wir sie berücksichtigen können, wenn Sie auf unsere Website zurückkehren. Sie können diese Cookies in den Einstellungen Ihres Browsers deaktivieren, aber wenn Sie dies tun, funktioniert die Website möglicherweise nicht wie vorgesehen."
|
|
866
|
-
},
|
|
867
|
-
"analytics": {
|
|
868
|
-
"title": "Analytisch",
|
|
869
|
-
"text": "Um das Nutzerverhalten zu verstehen und Ihnen ein relevanteres Surferlebnis zu bieten oder den Inhalt unserer Website zu personalisieren. Beispiel: Wir sammeln Informationen darüber, welche Seiten Sie besuchen, damit wir Ihnen relevantere Informationen präsentieren können."
|
|
870
|
-
},
|
|
871
|
-
"marketing": {
|
|
872
|
-
"title": "Marketing",
|
|
873
|
-
"text": "Zur Personalisierung und Messung der Effektivität von Werbung auf unserer Website und anderen Websites. Beispiel: Wir können Ihnen eine personalisierte Werbung auf der Grundlage der von Ihnen besuchten Seiten auf unserer Website anzeigen."
|
|
874
|
-
},
|
|
875
|
-
"privacyPolicy": "Datenschutzbestimmungen",
|
|
876
|
-
"saveSelection": "Auswahl speichern",
|
|
877
|
-
"acceptAll": "Alles akzeptieren"
|
|
878
846
|
}
|
|
879
847
|
}
|
package/locales/en/autobahn.json
CHANGED
|
@@ -67,7 +67,6 @@
|
|
|
67
67
|
"finance": {
|
|
68
68
|
"termSelection": "Term",
|
|
69
69
|
"termSelectionMonths": "Term (months)",
|
|
70
|
-
"change": "Change",
|
|
71
70
|
"headerTitle": "Your offer",
|
|
72
71
|
"adjustRate": "Adjust rate",
|
|
73
72
|
"secureOffer": "Request offer",
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
"detailsShow": "Show details",
|
|
89
88
|
"paymentLabel": "Payment",
|
|
90
89
|
"paymentValue": "Bank transfer",
|
|
91
|
-
"warrantyLabel": "
|
|
90
|
+
"warrantyLabel": "Warranty",
|
|
92
91
|
"warrantyValue": "1 year included",
|
|
93
92
|
"deliveryLabel": "Delivery",
|
|
94
93
|
"deliveryValue": "approx. 7–14 days · or collection",
|
|
@@ -277,16 +276,7 @@
|
|
|
277
276
|
"myDealers": "My dealers",
|
|
278
277
|
"dashboard": "Dashboard",
|
|
279
278
|
"dealerDashboard": "Dealer dashboard",
|
|
280
|
-
"imageSettings": "Image settings"
|
|
281
|
-
"acct": {
|
|
282
|
-
"overview": "Overview",
|
|
283
|
-
"myOrder": "My order",
|
|
284
|
-
"savedSearches": "Saved searches",
|
|
285
|
-
"favorites": "Favorites",
|
|
286
|
-
"compare": "Compare vehicles",
|
|
287
|
-
"profile": "Profile",
|
|
288
|
-
"support": "Support & callback"
|
|
289
|
-
}
|
|
279
|
+
"imageSettings": "Image settings"
|
|
290
280
|
},
|
|
291
281
|
"srp": {
|
|
292
282
|
"trust": {
|
|
@@ -494,8 +484,7 @@
|
|
|
494
484
|
"ratings": "Ratings"
|
|
495
485
|
},
|
|
496
486
|
"section": {
|
|
497
|
-
"similar": "Similar vehicles"
|
|
498
|
-
"unavailableSimilar": "Similar / comparable vehicles"
|
|
487
|
+
"similar": "Similar vehicles"
|
|
499
488
|
},
|
|
500
489
|
"breadcrumb": {
|
|
501
490
|
"home": "Home",
|
|
@@ -806,8 +795,7 @@
|
|
|
806
795
|
"serviceHistory": "Full service history",
|
|
807
796
|
"warranty": "Warranty",
|
|
808
797
|
"yes": "Yes",
|
|
809
|
-
"no": "No"
|
|
810
|
-
"notSpecified": "not specified"
|
|
798
|
+
"no": "No"
|
|
811
799
|
},
|
|
812
800
|
"common": {
|
|
813
801
|
"needsData": "Data coming soon"
|
|
@@ -855,25 +843,5 @@
|
|
|
855
843
|
"captionSlices": "Slices",
|
|
856
844
|
"captionSteeringWheel": "Steering wheel",
|
|
857
845
|
"captionWheelsLandingGear": "Wheels | landing gear"
|
|
858
|
-
},
|
|
859
|
-
"cookieModal": {
|
|
860
|
-
"dialogLabel": "Cookie settings",
|
|
861
|
-
"title": "Cookies first, then we are back on the road.",
|
|
862
|
-
"manageText": "We use cookies and other technologies to give you the best possible experience. You can manage them here.",
|
|
863
|
-
"necessary": {
|
|
864
|
-
"title": "Necessary",
|
|
865
|
-
"text": "We use browser cookies that are necessary for the website to work as intended. Example: we store your data collection preferences on the website so that we can respect them when you return to our website. You can disable these cookies in your browser settings, but if you do, the website may not work as intended."
|
|
866
|
-
},
|
|
867
|
-
"analytics": {
|
|
868
|
-
"title": "Analytics",
|
|
869
|
-
"text": "To understand user behaviour and give you a more relevant browsing experience or personalise the content of our website. Example: we collect information about which pages you visit so that we can show you more relevant information."
|
|
870
|
-
},
|
|
871
|
-
"marketing": {
|
|
872
|
-
"title": "Marketing",
|
|
873
|
-
"text": "To personalise advertising and measure its effectiveness on our website and other websites. Example: we may show you personalised advertising based on the pages you have visited on our website."
|
|
874
|
-
},
|
|
875
|
-
"privacyPolicy": "Privacy policy",
|
|
876
|
-
"saveSelection": "Save selection",
|
|
877
|
-
"acceptAll": "Accept all"
|
|
878
846
|
}
|
|
879
847
|
}
|
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.181",
|
|
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",
|