@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
|
@@ -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.
|
|
@@ -41,17 +41,9 @@ const TimePicker = ({
|
|
|
41
41
|
|
|
42
42
|
const endOfTheDayTime = currentDay > 5 || currentDay < 1 ? '17:30:00' : '19:30:00';
|
|
43
43
|
const startOfTheDayTime = currentDay > 5 || currentDay < 1 ? '09:00:00' : '08:30:00';
|
|
44
|
+
const setNewDay = new Date(`${date.toDateString()} ${endOfTheDayTime}`) > date ? 0 : 86400000;
|
|
44
45
|
const interval = 30 * 60 * 1000;
|
|
45
46
|
const roundedTime = new Date(Math.ceil(date / interval) * interval);
|
|
46
|
-
// Today is open while a slot is left: the next half hour must not be past the last one (16:30 on
|
|
47
|
-
// weekends, 19:30 on weekdays). Weekends 16:31–17:29 were still before closing but had no slot
|
|
48
|
-
// left, which crashed the picker on an empty list. A closed today is left out of the dates, as
|
|
49
|
-
// after hours. Today's own weekday decides, not the selected day's.
|
|
50
|
-
const isTodayWeekend = date.getDay() > 5 || date.getDay() < 1;
|
|
51
|
-
const todayEnd = new Date(`${date.toDateString()} ${isTodayWeekend ? '17:30:00' : '19:30:00'}`);
|
|
52
|
-
const todayLastSlot = new Date(`${date.toDateString()} ${isTodayWeekend ? '16:30:00' : '19:30:00'}`);
|
|
53
|
-
const isTodayOpen = todayEnd > date && roundedTime <= todayLastSlot;
|
|
54
|
-
const setNewDay = isTodayOpen ? 0 : 86400000;
|
|
55
47
|
const nextWeekDays = [...Array(7).keys()].map((days, index) => (
|
|
56
48
|
{
|
|
57
49
|
value: index,
|
|
@@ -95,9 +87,7 @@ const TimePicker = ({
|
|
|
95
87
|
dayRanges.push({ time, value: dayRanges.length, label: `${time} - ${rangeTime}` });
|
|
96
88
|
} // time ranges for full day
|
|
97
89
|
|
|
98
|
-
|
|
99
|
-
const isTodaySelected = new Date(nextWeekDaysFull[day]).toDateString() === new Date().toDateString();
|
|
100
|
-
return isTodaySelected && isWorkingHours() ? currentDayRanges : dayRanges;
|
|
90
|
+
return currentDay === new Date().getDay() && isWorkingHours() ? currentDayRanges : dayRanges;
|
|
101
91
|
};
|
|
102
92
|
|
|
103
93
|
useEffect(
|