@swan-io/shared-business 8.14.2 → 8.14.4
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/src/components/BirthdatePicker.d.ts +7 -0
- package/src/components/BirthdatePicker.js +113 -0
- package/src/locales/de.json +7 -1
- package/src/locales/en.json +2 -1
- package/src/locales/es.json +7 -1
- package/src/locales/fi.json +7 -1
- package/src/locales/fr.json +7 -1
- package/src/locales/it.json +7 -1
- package/src/locales/nl.json +7 -1
- package/src/locales/pt.json +7 -1
- package/src/components/InlineDatePicker.d.ts +0 -9
- package/src/components/InlineDatePicker.js +0 -79
package/package.json
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type BirthdatePickerProps = {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string | undefined;
|
|
4
|
+
error?: string;
|
|
5
|
+
onValueChange: (value: string | undefined) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const BirthdatePicker: ({ value, label, onValueChange, error: externalError, }: BirthdatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
|
+
import { InputError } from "@swan-io/lake/src/components/InputError";
|
|
4
|
+
import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
|
|
5
|
+
import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
|
|
6
|
+
import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
|
|
7
|
+
import { Stack } from "@swan-io/lake/src/components/Stack";
|
|
8
|
+
import { breakpoints, colors } from "@swan-io/lake/src/constants/design";
|
|
9
|
+
import { useResponsive } from "@swan-io/lake/src/hooks/useResponsive";
|
|
10
|
+
import { isEmpty, isNotNullish, isNullish } from "@swan-io/lake/src/utils/nullish";
|
|
11
|
+
import { useForm } from "@swan-io/use-form";
|
|
12
|
+
import { StyleSheet, View } from "react-native";
|
|
13
|
+
import { match } from "ts-pattern";
|
|
14
|
+
import { extractDate, formatExtractedDate } from "../utils/date";
|
|
15
|
+
import { getCountry, t } from "../utils/i18n";
|
|
16
|
+
import { validateBirthdate } from "../utils/validation";
|
|
17
|
+
const months = [
|
|
18
|
+
{ value: "01", name: t("datePicker.month.january") },
|
|
19
|
+
{ value: "02", name: t("datePicker.month.february") },
|
|
20
|
+
{ value: "03", name: t("datePicker.month.march") },
|
|
21
|
+
{ value: "04", name: t("datePicker.month.april") },
|
|
22
|
+
{ value: "05", name: t("datePicker.month.may") },
|
|
23
|
+
{ value: "06", name: t("datePicker.month.june") },
|
|
24
|
+
{ value: "07", name: t("datePicker.month.july") },
|
|
25
|
+
{ value: "08", name: t("datePicker.month.august") },
|
|
26
|
+
{ value: "09", name: t("datePicker.month.september") },
|
|
27
|
+
{ value: "10", name: t("datePicker.month.october") },
|
|
28
|
+
{ value: "11", name: t("datePicker.month.november") },
|
|
29
|
+
{ value: "12", name: t("datePicker.month.december") },
|
|
30
|
+
];
|
|
31
|
+
const styles = StyleSheet.create({
|
|
32
|
+
dayMobile: {
|
|
33
|
+
maxWidth: 70,
|
|
34
|
+
flexGrow: 0,
|
|
35
|
+
},
|
|
36
|
+
day: {
|
|
37
|
+
maxWidth: 90,
|
|
38
|
+
flexGrow: 0,
|
|
39
|
+
},
|
|
40
|
+
yearMobile: {
|
|
41
|
+
maxWidth: 80,
|
|
42
|
+
flexGrow: 0,
|
|
43
|
+
},
|
|
44
|
+
year: {
|
|
45
|
+
maxWidth: 120,
|
|
46
|
+
flexGrow: 0,
|
|
47
|
+
},
|
|
48
|
+
error: {
|
|
49
|
+
borderColor: colors.negative[400],
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
// https://en.wikipedia.org/wiki/List_of_date_formats_by_country
|
|
53
|
+
const order = match(getCountry().cca2)
|
|
54
|
+
.returnType()
|
|
55
|
+
.with("US", () => "MDY")
|
|
56
|
+
.with("CN", "JP", "KR", "KP", "TW", "HU", "MN", "LT", "BT", () => "YMD")
|
|
57
|
+
.otherwise(() => "DMY");
|
|
58
|
+
export const BirthdatePicker = ({ value, label, onValueChange, error: externalError, }) => {
|
|
59
|
+
const { desktop } = useResponsive(breakpoints.small);
|
|
60
|
+
const { Field } = useForm({
|
|
61
|
+
birthdate: {
|
|
62
|
+
initialValue: isNotNullish(value) ? extractDate(value) : undefined,
|
|
63
|
+
sanitize: date => isNotNullish(date)
|
|
64
|
+
? {
|
|
65
|
+
day: date.day.trim(),
|
|
66
|
+
month: date.month.trim(),
|
|
67
|
+
year: date.year.trim(),
|
|
68
|
+
}
|
|
69
|
+
: undefined,
|
|
70
|
+
strategy: "onBlur",
|
|
71
|
+
validate: date => {
|
|
72
|
+
const errorMessage = isNullish(date) || Object.values(date).some(isEmpty)
|
|
73
|
+
? t("datePicker.error.incomplete")
|
|
74
|
+
: validateBirthdate(date);
|
|
75
|
+
if (isNullish(errorMessage) && isNotNullish(date)) {
|
|
76
|
+
return onValueChange(formatExtractedDate(date));
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
onValueChange(undefined);
|
|
80
|
+
return errorMessage;
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
return (_jsx(Field, { name: "birthdate", children: ({ error, onBlur, onChange, value }) => (_jsx(LakeLabel, { label: label, render: id => {
|
|
86
|
+
var _a;
|
|
87
|
+
const day = (_jsx(View, { style: desktop ? styles.day : styles.dayMobile, children: _jsx(LakeTextInput, { id: id, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, placeholder: t("datePicker.day"), value: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : undefined, onBlur: onBlur, hideErrors: true, onChangeText: day => {
|
|
88
|
+
var _a, _b;
|
|
89
|
+
onChange({
|
|
90
|
+
day,
|
|
91
|
+
month: (_a = value === null || value === void 0 ? void 0 : value.month) !== null && _a !== void 0 ? _a : "",
|
|
92
|
+
year: (_b = value === null || value === void 0 ? void 0 : value.year) !== null && _b !== void 0 ? _b : "",
|
|
93
|
+
});
|
|
94
|
+
}, pattern: "[0-9]", maxLength: 2, autoComplete: "bday-day" }) }));
|
|
95
|
+
const month = (_jsx(LakeSelect, { value: (value === null || value === void 0 ? void 0 : value.month) === "" ? undefined : value === null || value === void 0 ? void 0 : value.month, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, placeholder: t("datePicker.month"), hideErrors: true, items: months, onValueChange: month => {
|
|
96
|
+
var _a, _b;
|
|
97
|
+
onChange({
|
|
98
|
+
day: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : "",
|
|
99
|
+
month,
|
|
100
|
+
year: (_b = value === null || value === void 0 ? void 0 : value.year) !== null && _b !== void 0 ? _b : "",
|
|
101
|
+
});
|
|
102
|
+
} }));
|
|
103
|
+
const year = (_jsx(View, { style: desktop ? styles.year : styles.yearMobile, children: _jsx(LakeTextInput, { value: value === null || value === void 0 ? void 0 : value.year, style: (isNotNullish(error) || isNotNullish(externalError)) && styles.error, placeholder: t("datePicker.year"), onBlur: onBlur, hideErrors: true, onChangeText: year => {
|
|
104
|
+
var _a, _b;
|
|
105
|
+
return onChange({
|
|
106
|
+
day: (_a = value === null || value === void 0 ? void 0 : value.day) !== null && _a !== void 0 ? _a : "",
|
|
107
|
+
month: (_b = value === null || value === void 0 ? void 0 : value.month) !== null && _b !== void 0 ? _b : "",
|
|
108
|
+
year,
|
|
109
|
+
});
|
|
110
|
+
}, pattern: "[0-9]", maxLength: 4, autoComplete: "bday-year" }) }));
|
|
111
|
+
return (_jsxs(Box, { children: [order === "DMY" ? (_jsxs(Stack, { direction: "row", space: 4, children: [day, " ", month, " ", year] })) : (_jsxs(Stack, { direction: "row", space: 4, children: [month, " ", day, " ", year] })), _jsx(InputError, { message: error !== null && error !== void 0 ? error : externalError })] }));
|
|
112
|
+
} })) }));
|
|
113
|
+
};
|
package/src/locales/de.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Zum Inhalt springen",
|
|
41
41
|
"copyButton.copiedTooltip": "In die Zwischenablage kopiert",
|
|
42
42
|
"copyButton.copyTooltip": "Zum Kopieren anklicken",
|
|
43
|
+
"datePicker.day": "Tag",
|
|
43
44
|
"datePicker.day.friday": "Freitag",
|
|
44
45
|
"datePicker.day.monday": "Montag",
|
|
45
46
|
"datePicker.day.saturday": "Samstag",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Donnerstag",
|
|
48
49
|
"datePicker.day.tuesday": "Dienstag",
|
|
49
50
|
"datePicker.day.wednesday": "Mittwoch",
|
|
51
|
+
"datePicker.error.incomplete": "Bitte geben Sie Ihr gültiges Geburtsdatum ein: Monat, Tag und Jahr.",
|
|
52
|
+
"datePicker.month": "Monat",
|
|
50
53
|
"datePicker.month.april": "April",
|
|
51
54
|
"datePicker.month.august": "August",
|
|
52
55
|
"datePicker.month.december": "Dezember",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Oktober",
|
|
62
65
|
"datePicker.month.previous": "Vorheriger Monat",
|
|
63
66
|
"datePicker.month.september": "September",
|
|
67
|
+
"datePicker.year": "Jahr",
|
|
64
68
|
"error.generic": "Ein Fehler ist aufgetreten",
|
|
65
69
|
"error.iban.invalid": "Diese IBAN sieht nicht korrekt aus. Bitte versuchen Sie es erneut.",
|
|
66
70
|
"error.network.500": "Interner Serverfehler",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Informationen des Gläubigers",
|
|
294
298
|
"transactionStatement.title.debtor": "Informationen des Schuldners",
|
|
295
299
|
"transactionStatement.title.document": "Transaktionsbestätigung",
|
|
296
|
-
"transactionStatement.title.information": "Informationen"
|
|
300
|
+
"transactionStatement.title.information": "Informationen",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "Geburtsdatum kann nicht in der Zukunft liegen.",
|
|
302
|
+
"validation.invalidBirthDate": "Bitte geben Sie Ihr gültiges Geburtsdatum ein."
|
|
297
303
|
}
|
package/src/locales/en.json
CHANGED
|
@@ -63,6 +63,7 @@
|
|
|
63
63
|
"datePicker.month.october": "October",
|
|
64
64
|
"datePicker.month.previous": "Previous month",
|
|
65
65
|
"datePicker.month.september": "September",
|
|
66
|
+
"datePicker.error.incomplete": "Please enter your valid birth date: month, day, and year.",
|
|
66
67
|
"datePicker.year": "Year",
|
|
67
68
|
"error.generic": "An error occurred",
|
|
68
69
|
"error.iban.invalid": "This IBAN doesn't look right. Trying entering it again.",
|
|
@@ -297,6 +298,6 @@
|
|
|
297
298
|
"transactionStatement.title.debtor": "Debtor information",
|
|
298
299
|
"transactionStatement.title.document": "Transaction confirmation",
|
|
299
300
|
"transactionStatement.title.information": "Information",
|
|
300
|
-
"validation.invalidBirthDate": "Please enter your
|
|
301
|
+
"validation.invalidBirthDate": "Please enter your valid birth date.",
|
|
301
302
|
"validation.birthdateCannotBeFuture": "Birthdate cannot be in the future"
|
|
302
303
|
}
|
package/src/locales/es.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Saltar al contenido",
|
|
41
41
|
"copyButton.copiedTooltip": "Copiado al portapapeles",
|
|
42
42
|
"copyButton.copyTooltip": "Haz clic para copiar",
|
|
43
|
+
"datePicker.day": "Día",
|
|
43
44
|
"datePicker.day.friday": "Viernes",
|
|
44
45
|
"datePicker.day.monday": "Lunes",
|
|
45
46
|
"datePicker.day.saturday": "Sábado",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Jueves",
|
|
48
49
|
"datePicker.day.tuesday": "Martes",
|
|
49
50
|
"datePicker.day.wednesday": "Miércoles",
|
|
51
|
+
"datePicker.error.incomplete": "Por favor, introduce tu fecha de nacimiento válida: mes, día y año.",
|
|
52
|
+
"datePicker.month": "Mes",
|
|
50
53
|
"datePicker.month.april": "Abril",
|
|
51
54
|
"datePicker.month.august": "Agosto",
|
|
52
55
|
"datePicker.month.december": "Diciembre",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Octubre",
|
|
62
65
|
"datePicker.month.previous": "Mes anterior",
|
|
63
66
|
"datePicker.month.september": "Septiembre",
|
|
67
|
+
"datePicker.year": "Año",
|
|
64
68
|
"error.generic": "Ha ocurrido un error",
|
|
65
69
|
"error.iban.invalid": "El IBAN no es correcto. Vuelve a intentarlo.",
|
|
66
70
|
"error.network.500": "Error de servidor interno",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Información del acreedor",
|
|
294
298
|
"transactionStatement.title.debtor": "Información del deudor",
|
|
295
299
|
"transactionStatement.title.document": "Confirmación de la transacción",
|
|
296
|
-
"transactionStatement.title.information": "Información"
|
|
300
|
+
"transactionStatement.title.information": "Información",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "La fecha de nacimiento no puede estar en el futuro",
|
|
302
|
+
"validation.invalidBirthDate": "Por favor, introduce tu fecha de nacimiento válida."
|
|
297
303
|
}
|
package/src/locales/fi.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Ohita ja siirry sisältöön",
|
|
41
41
|
"copyButton.copiedTooltip": "Kopioitu leikepöydälle",
|
|
42
42
|
"copyButton.copyTooltip": "Kopioi napsauttamalla",
|
|
43
|
+
"datePicker.day": "Päivä",
|
|
43
44
|
"datePicker.day.friday": "Perjantai",
|
|
44
45
|
"datePicker.day.monday": "Maanantai",
|
|
45
46
|
"datePicker.day.saturday": "Lauantai",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Torstai",
|
|
48
49
|
"datePicker.day.tuesday": "Tiistai",
|
|
49
50
|
"datePicker.day.wednesday": "Keskiviikko",
|
|
51
|
+
"datePicker.error.incomplete": "Syötä kelvollinen syntymäaikasi: kuukausi, päivä ja vuosi.",
|
|
52
|
+
"datePicker.month": "Kuukausi",
|
|
50
53
|
"datePicker.month.april": "Huhtikuu",
|
|
51
54
|
"datePicker.month.august": "Elokuu",
|
|
52
55
|
"datePicker.month.december": "Joulukuu",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Lokakuu",
|
|
62
65
|
"datePicker.month.previous": "Edellinen kuukausi",
|
|
63
66
|
"datePicker.month.september": "Syyskuu",
|
|
67
|
+
"datePicker.year": "Vuosi",
|
|
64
68
|
"error.generic": "Virhe tapahtui",
|
|
65
69
|
"error.iban.invalid": "IBAN-tilinumero ei näytä olevan oikein. Yritä syöttää se uudelleen.",
|
|
66
70
|
"error.network.500": "Sisäinen palvelinvirhe",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Velkojan tiedot",
|
|
294
298
|
"transactionStatement.title.debtor": "Velallisen tiedot",
|
|
295
299
|
"transactionStatement.title.document": "Maksuvahvistus",
|
|
296
|
-
"transactionStatement.title.information": "Tiedot"
|
|
300
|
+
"transactionStatement.title.information": "Tiedot",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "Syntymäaika ei voi olla tulevaisuudessa",
|
|
302
|
+
"validation.invalidBirthDate": "Syötä kelvollinen syntymäaika."
|
|
297
303
|
}
|
package/src/locales/fr.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Aller au contenu",
|
|
41
41
|
"copyButton.copiedTooltip": "Copié dans le presse-papier",
|
|
42
42
|
"copyButton.copyTooltip": "Cliquez pour copier",
|
|
43
|
+
"datePicker.day": "Jour",
|
|
43
44
|
"datePicker.day.friday": "Vendredi",
|
|
44
45
|
"datePicker.day.monday": "Lundi",
|
|
45
46
|
"datePicker.day.saturday": "Samedi",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Jeudi",
|
|
48
49
|
"datePicker.day.tuesday": "Mardi",
|
|
49
50
|
"datePicker.day.wednesday": "Mercredi",
|
|
51
|
+
"datePicker.error.incomplete": "Veuillez saisir votre date de naissance valide : mois, jour et année.",
|
|
52
|
+
"datePicker.month": "Mois",
|
|
50
53
|
"datePicker.month.april": "Avril",
|
|
51
54
|
"datePicker.month.august": "Août",
|
|
52
55
|
"datePicker.month.december": "Décembre",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Octobre",
|
|
62
65
|
"datePicker.month.previous": "Mois précédent",
|
|
63
66
|
"datePicker.month.september": "Septembre",
|
|
67
|
+
"datePicker.year": "Année",
|
|
64
68
|
"error.generic": "Une erreur est survenue",
|
|
65
69
|
"error.iban.invalid": "Cet IBAN semble incorrect. Veuillez le ressaisir.",
|
|
66
70
|
"error.network.500": "Erreur de serveur interne",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Informations du créancier",
|
|
294
298
|
"transactionStatement.title.debtor": "Informations du débiteur",
|
|
295
299
|
"transactionStatement.title.document": "Confirmation de transaction",
|
|
296
|
-
"transactionStatement.title.information": "Informations"
|
|
300
|
+
"transactionStatement.title.information": "Informations",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "La date de naissance ne peut pas être future",
|
|
302
|
+
"validation.invalidBirthDate": "Veuillez saisir votre date de naissance valide."
|
|
297
303
|
}
|
package/src/locales/it.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Salta al contenuto",
|
|
41
41
|
"copyButton.copiedTooltip": "Copiato negli appunti",
|
|
42
42
|
"copyButton.copyTooltip": "Clicca per copiare",
|
|
43
|
+
"datePicker.day": "Giorno",
|
|
43
44
|
"datePicker.day.friday": "Venerdì",
|
|
44
45
|
"datePicker.day.monday": "Lunedì",
|
|
45
46
|
"datePicker.day.saturday": "Sabato",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Giovedì",
|
|
48
49
|
"datePicker.day.tuesday": "Martedì",
|
|
49
50
|
"datePicker.day.wednesday": "Mercoledì",
|
|
51
|
+
"datePicker.error.incomplete": "Inserisci la tua data di nascita valida: mese, giorno e anno.",
|
|
52
|
+
"datePicker.month": "Mese",
|
|
50
53
|
"datePicker.month.april": "Aprile",
|
|
51
54
|
"datePicker.month.august": "Agosto",
|
|
52
55
|
"datePicker.month.december": "Dicembre",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Ottobre",
|
|
62
65
|
"datePicker.month.previous": "Mese precedente",
|
|
63
66
|
"datePicker.month.september": "Settembre",
|
|
67
|
+
"datePicker.year": "Anno",
|
|
64
68
|
"error.generic": "Si è verificato un errore",
|
|
65
69
|
"error.iban.invalid": "L'IBAN non è corretto. Provi a inserirlo di nuovo.",
|
|
66
70
|
"error.network.500": "Errore interno del server",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Informazioni creditore",
|
|
294
298
|
"transactionStatement.title.debtor": "Informazioni debitore",
|
|
295
299
|
"transactionStatement.title.document": "Conferma transazione",
|
|
296
|
-
"transactionStatement.title.information": "Informazioni"
|
|
300
|
+
"transactionStatement.title.information": "Informazioni",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "La data di nascita non può essere nel futuro",
|
|
302
|
+
"validation.invalidBirthDate": "Inserisci la tua data di nascita valida."
|
|
297
303
|
}
|
package/src/locales/nl.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Doorgaan naar artikel",
|
|
41
41
|
"copyButton.copiedTooltip": "Gekopieerd naar klembord",
|
|
42
42
|
"copyButton.copyTooltip": "Klik om te kopiëren",
|
|
43
|
+
"datePicker.day": "Dag",
|
|
43
44
|
"datePicker.day.friday": "Vrijdag",
|
|
44
45
|
"datePicker.day.monday": "Maandag",
|
|
45
46
|
"datePicker.day.saturday": "Zaterdag",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Donderdag",
|
|
48
49
|
"datePicker.day.tuesday": "Dinsdag",
|
|
49
50
|
"datePicker.day.wednesday": "Woensdag",
|
|
51
|
+
"datePicker.error.incomplete": "Voer alstublieft uw geldige geboortedatum in: maand, dag en jaar.",
|
|
52
|
+
"datePicker.month": "Maand",
|
|
50
53
|
"datePicker.month.april": "April",
|
|
51
54
|
"datePicker.month.august": "Augustus",
|
|
52
55
|
"datePicker.month.december": "December",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Oktober",
|
|
62
65
|
"datePicker.month.previous": "Vorige maand",
|
|
63
66
|
"datePicker.month.september": "September",
|
|
67
|
+
"datePicker.year": "Jaar",
|
|
64
68
|
"error.generic": "Er is een fout opgetreden",
|
|
65
69
|
"error.iban.invalid": "Dit IBAN nummer lijkt niet juist. Probeer het nog eens.",
|
|
66
70
|
"error.network.500": "Interne Server Fout",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Crediteur informatie",
|
|
294
298
|
"transactionStatement.title.debtor": "Debiteur informatie",
|
|
295
299
|
"transactionStatement.title.document": "Transactiebevestiging",
|
|
296
|
-
"transactionStatement.title.information": "Informatie"
|
|
300
|
+
"transactionStatement.title.information": "Informatie",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "Geboortedatum kan niet in de toekomst liggen",
|
|
302
|
+
"validation.invalidBirthDate": "Voer alstublieft uw geldige geboortedatum in."
|
|
297
303
|
}
|
package/src/locales/pt.json
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"common.skipToContent": "Saltar para o conteúdo",
|
|
41
41
|
"copyButton.copiedTooltip": "Copiado para a área de transferência",
|
|
42
42
|
"copyButton.copyTooltip": "Clique para copiar",
|
|
43
|
+
"datePicker.day": "Dia",
|
|
43
44
|
"datePicker.day.friday": "Sexta-feira",
|
|
44
45
|
"datePicker.day.monday": "Segunda-feira",
|
|
45
46
|
"datePicker.day.saturday": "Sábado",
|
|
@@ -47,6 +48,8 @@
|
|
|
47
48
|
"datePicker.day.thursday": "Quinta-feira",
|
|
48
49
|
"datePicker.day.tuesday": "Terça-feira",
|
|
49
50
|
"datePicker.day.wednesday": "Quarta-feira",
|
|
51
|
+
"datePicker.error.incomplete": "Por favor, insira a sua data de nascimento válida: mês, dia e ano.",
|
|
52
|
+
"datePicker.month": "Mês",
|
|
50
53
|
"datePicker.month.april": "Abril",
|
|
51
54
|
"datePicker.month.august": "Agosto",
|
|
52
55
|
"datePicker.month.december": "Dezembro",
|
|
@@ -61,6 +64,7 @@
|
|
|
61
64
|
"datePicker.month.october": "Outubro",
|
|
62
65
|
"datePicker.month.previous": "Mês anterior",
|
|
63
66
|
"datePicker.month.september": "Setembro",
|
|
67
|
+
"datePicker.year": "Ano",
|
|
64
68
|
"error.generic": "Ocorreu um erro",
|
|
65
69
|
"error.iban.invalid": "Este IBAN não parece correto. Tente inserir novamente.",
|
|
66
70
|
"error.network.500": "Erro interno do servidor",
|
|
@@ -293,5 +297,7 @@
|
|
|
293
297
|
"transactionStatement.title.creditor": "Informações do credor",
|
|
294
298
|
"transactionStatement.title.debtor": "Informações do devedor",
|
|
295
299
|
"transactionStatement.title.document": "Confirmação da transação",
|
|
296
|
-
"transactionStatement.title.information": "Informações"
|
|
300
|
+
"transactionStatement.title.information": "Informações",
|
|
301
|
+
"validation.birthdateCannotBeFuture": "A data de nascimento não pode estar no futuro",
|
|
302
|
+
"validation.invalidBirthDate": "Por favor, insira a sua data de nascimento válida."
|
|
297
303
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ExtractedDate } from "../utils/date";
|
|
2
|
-
export type InlineDatePickerProps = {
|
|
3
|
-
label: string;
|
|
4
|
-
value: ExtractedDate | undefined;
|
|
5
|
-
onValueChange: (value: ExtractedDate) => void;
|
|
6
|
-
error?: string;
|
|
7
|
-
onBlur?: () => void;
|
|
8
|
-
};
|
|
9
|
-
export declare const InlineDatePicker: ({ value, label, onValueChange, error, onBlur, }: InlineDatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box } from "@swan-io/lake/src/components/Box";
|
|
3
|
-
import { InputError } from "@swan-io/lake/src/components/InputError";
|
|
4
|
-
import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
|
|
5
|
-
import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
|
|
6
|
-
import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
|
|
7
|
-
import { Stack } from "@swan-io/lake/src/components/Stack";
|
|
8
|
-
import { breakpoints, colors } from "@swan-io/lake/src/constants/design";
|
|
9
|
-
import { useResponsive } from "@swan-io/lake/src/hooks/useResponsive";
|
|
10
|
-
import { isNotNullish } from "@swan-io/lake/src/utils/nullish";
|
|
11
|
-
import { StyleSheet, View } from "react-native";
|
|
12
|
-
import { match } from "ts-pattern";
|
|
13
|
-
import { getCountry, t } from "../utils/i18n";
|
|
14
|
-
const months = [
|
|
15
|
-
{ value: "01", name: t("datePicker.month.january") },
|
|
16
|
-
{ value: "02", name: t("datePicker.month.february") },
|
|
17
|
-
{ value: "03", name: t("datePicker.month.march") },
|
|
18
|
-
{ value: "04", name: t("datePicker.month.april") },
|
|
19
|
-
{ value: "05", name: t("datePicker.month.may") },
|
|
20
|
-
{ value: "06", name: t("datePicker.month.june") },
|
|
21
|
-
{ value: "07", name: t("datePicker.month.july") },
|
|
22
|
-
{ value: "08", name: t("datePicker.month.august") },
|
|
23
|
-
{ value: "09", name: t("datePicker.month.september") },
|
|
24
|
-
{ value: "10", name: t("datePicker.month.october") },
|
|
25
|
-
{ value: "11", name: t("datePicker.month.november") },
|
|
26
|
-
{ value: "12", name: t("datePicker.month.december") },
|
|
27
|
-
];
|
|
28
|
-
const styles = StyleSheet.create({
|
|
29
|
-
dayMobile: {
|
|
30
|
-
maxWidth: 70,
|
|
31
|
-
flexGrow: 0,
|
|
32
|
-
},
|
|
33
|
-
day: {
|
|
34
|
-
maxWidth: 90,
|
|
35
|
-
flexGrow: 0,
|
|
36
|
-
},
|
|
37
|
-
yearMobile: {
|
|
38
|
-
maxWidth: 80,
|
|
39
|
-
flexGrow: 0,
|
|
40
|
-
},
|
|
41
|
-
year: {
|
|
42
|
-
maxWidth: 120,
|
|
43
|
-
flexGrow: 0,
|
|
44
|
-
},
|
|
45
|
-
error: {
|
|
46
|
-
borderColor: colors.negative[400],
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
// https://en.wikipedia.org/wiki/List_of_date_formats_by_country
|
|
50
|
-
const order = match(getCountry().cca2)
|
|
51
|
-
.returnType()
|
|
52
|
-
.with("US", () => "MDY")
|
|
53
|
-
.with("CN", "JP", "KR", "KP", "TW", "HU", "MN", "LT", "BT", () => "YMD")
|
|
54
|
-
.otherwise(() => "DMY");
|
|
55
|
-
export const InlineDatePicker = ({ value = { day: "", month: "", year: "" }, label, onValueChange, error, onBlur, }) => {
|
|
56
|
-
const { desktop } = useResponsive(breakpoints.small);
|
|
57
|
-
return (_jsx(LakeLabel, { label: label, render: id => {
|
|
58
|
-
const day = (_jsx(View, { style: desktop ? styles.day : styles.dayMobile, children: _jsx(LakeTextInput, { id: id, style: isNotNullish(error) && styles.error, placeholder: t("datePicker.day"), value: value.day, onBlur: onBlur, hideErrors: true, onChangeText: day => {
|
|
59
|
-
onValueChange({
|
|
60
|
-
day,
|
|
61
|
-
month: value.month,
|
|
62
|
-
year: value.year,
|
|
63
|
-
});
|
|
64
|
-
}, pattern: "[0-9]", maxLength: 2, autoComplete: "bday-day" }) }));
|
|
65
|
-
const month = (_jsx(LakeSelect, { value: value.month === "" ? undefined : value.month, style: isNotNullish(error) && styles.error, placeholder: t("datePicker.month"), hideErrors: true, items: months, onValueChange: month => {
|
|
66
|
-
onValueChange({
|
|
67
|
-
day: value.day,
|
|
68
|
-
month,
|
|
69
|
-
year: value.year,
|
|
70
|
-
});
|
|
71
|
-
} }));
|
|
72
|
-
const year = (_jsx(View, { style: desktop ? styles.year : styles.yearMobile, children: _jsx(LakeTextInput, { value: value.year, style: isNotNullish(error) && styles.error, placeholder: t("datePicker.year"), onBlur: onBlur, hideErrors: true, onChangeText: year => onValueChange({
|
|
73
|
-
day: value.day,
|
|
74
|
-
month: value.month,
|
|
75
|
-
year,
|
|
76
|
-
}), pattern: "[0-9]", maxLength: 4, autoComplete: "bday-year" }) }));
|
|
77
|
-
return (_jsxs(Box, { children: [order === "DMY" ? (_jsxs(Stack, { direction: "row", space: 4, children: [day, " ", month, " ", year] })) : (_jsxs(Stack, { direction: "row", space: 4, children: [month, " ", day, " ", year] })), _jsx(InputError, { message: error })] }));
|
|
78
|
-
} }));
|
|
79
|
-
};
|