@swan-io/shared-business 2.7.23 → 2.7.25
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
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ForwardedRef } from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
1
3
|
import { CountryCCA3 } from "../constants/countries";
|
|
2
4
|
type Props<T extends CountryCCA3> = {
|
|
3
5
|
onValueChange: (country: T) => void;
|
|
@@ -10,5 +12,8 @@ type Props<T extends CountryCCA3> = {
|
|
|
10
12
|
disabled?: boolean;
|
|
11
13
|
hideErrors?: boolean;
|
|
12
14
|
};
|
|
13
|
-
|
|
15
|
+
declare const CountryPickerWithRef: <T extends "FRA" | "ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "DEU" | "DJI" | "DMA" | "ECU" | "EST" | "IRL" | "SLV" | "ESP" | "FLK" | "FJI" | "FRO" | "GAB" | "GMB" | "GHA" | "GIB" | "GRD" | "GLP" | "GUM" | "GTM" | "GGY" | "GNB" | "GNQ" | "GIN" | "GUY" | "GUF" | "HTI" | "HMD" | "HND" | "HRV" | "IDN" | "ISL" | "IMN" | "ITA" | "JAM" | "JEY" | "GRL" | "KHM" | "KAZ" | "KEN" | "KIR" | "CAF" | "COM" | "REU" | "LVA" | "LSO" | "LBR" | "LIE" | "LTU" | "LUX" | "MDG" | "HUN" | "MHL" | "MWI" | "MYS" | "MDV" | "MLI" | "MLT" | "MTQ" | "MUS" | "MYT" | "MEX" | "FSM" | "MOZ" | "MDA" | "MCO" | "MSR" | "NAM" | "NLD" | "BRN" | "NZL" | "NIC" | "NER" | "NGA" | "NIU" | "NFK" | "NOR" | "MNP" | "NCL" | "AUT" | "UZB" | "PAK" | "PLW" | "PAN" | "PNG" | "PRY" | "PER" | "PHL" | "PCN" | "POL" | "PYF" | "PRT" | "PRI" | "DOM" | "UNK" | "COD" | "COG" | "ROU" | "RWA" | "KNA" | "LCA" | "VCT" | "BLM" | "MAF" | "SPM" | "WSM" | "SMR" | "STP" | "CHE" | "SEN" | "SYC" | "ALB" | "SLE" | "SGP" | "SVN" | "SVK" | "SLB" | "SOM" | "ZAF" | "SGS" | "SSD" | "LKA" | "FIN" | "SUR" | "SWE" | "SWZ" | "TZA" | "TCD" | "ATF" | "TLS" | "TGO" | "TON" | "TTO" | "TUR" | "TKM" | "TCA" | "TUV" | "UGA" | "GBR" | "USA" | "UMI" | "VIR" | "URY" | "VUT" | "VAT" | "VEN" | "VNM" | "WLF" | "ZMB" | "ZWE" | "BTN" | "GRC" | "CYP" | "BLR" | "BGR" | "KGZ" | "MKD" | "MNG" | "RUS" | "SRB" | "TJK" | "UKR" | "MNE" | "ARM" | "ISR" | "AFG" | "JOR" | "DZA" | "SDN" | "ESH" | "IRQ" | "SAU" | "KWT" | "MAR" | "YEM" | "IRN" | "TUN" | "ARE" | "SYR" | "OMN" | "PSE" | "QAT" | "LBN" | "EGY" | "MRT" | "NPL" | "IND" | "THA" | "LAO" | "MMR" | "GEO" | "ETH" | "ERI" | "BHR" | "LBY" | "CHN" | "JPN" | "MAC" | "TWN" | "HKG" | "KOR" | "PRK">({ onValueChange, value, countries, readOnly, id, error, placeholder, disabled, hideErrors, }: Props<T>, forwardedRef: ForwardedRef<View>) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export declare const CountryPicker: <T extends "FRA" | "ALA" | "ASM" | "AND" | "AGO" | "AIA" | "ATA" | "ATG" | "ARG" | "ABW" | "AUS" | "AZE" | "BHS" | "BGD" | "BRB" | "BEL" | "BLZ" | "BEN" | "BMU" | "BOL" | "BES" | "BIH" | "BWA" | "BVT" | "BRA" | "VGB" | "BFA" | "BDI" | "CPV" | "CMR" | "CAN" | "CYM" | "CZE" | "CHL" | "CXR" | "CCK" | "COL" | "COK" | "CRI" | "CIV" | "CUB" | "CUW" | "DNK" | "DEU" | "DJI" | "DMA" | "ECU" | "EST" | "IRL" | "SLV" | "ESP" | "FLK" | "FJI" | "FRO" | "GAB" | "GMB" | "GHA" | "GIB" | "GRD" | "GLP" | "GUM" | "GTM" | "GGY" | "GNB" | "GNQ" | "GIN" | "GUY" | "GUF" | "HTI" | "HMD" | "HND" | "HRV" | "IDN" | "ISL" | "IMN" | "ITA" | "JAM" | "JEY" | "GRL" | "KHM" | "KAZ" | "KEN" | "KIR" | "CAF" | "COM" | "REU" | "LVA" | "LSO" | "LBR" | "LIE" | "LTU" | "LUX" | "MDG" | "HUN" | "MHL" | "MWI" | "MYS" | "MDV" | "MLI" | "MLT" | "MTQ" | "MUS" | "MYT" | "MEX" | "FSM" | "MOZ" | "MDA" | "MCO" | "MSR" | "NAM" | "NLD" | "BRN" | "NZL" | "NIC" | "NER" | "NGA" | "NIU" | "NFK" | "NOR" | "MNP" | "NCL" | "AUT" | "UZB" | "PAK" | "PLW" | "PAN" | "PNG" | "PRY" | "PER" | "PHL" | "PCN" | "POL" | "PYF" | "PRT" | "PRI" | "DOM" | "UNK" | "COD" | "COG" | "ROU" | "RWA" | "KNA" | "LCA" | "VCT" | "BLM" | "MAF" | "SPM" | "WSM" | "SMR" | "STP" | "CHE" | "SEN" | "SYC" | "ALB" | "SLE" | "SGP" | "SVN" | "SVK" | "SLB" | "SOM" | "ZAF" | "SGS" | "SSD" | "LKA" | "FIN" | "SUR" | "SWE" | "SWZ" | "TZA" | "TCD" | "ATF" | "TLS" | "TGO" | "TON" | "TTO" | "TUR" | "TKM" | "TCA" | "TUV" | "UGA" | "GBR" | "USA" | "UMI" | "VIR" | "URY" | "VUT" | "VAT" | "VEN" | "VNM" | "WLF" | "ZMB" | "ZWE" | "BTN" | "GRC" | "CYP" | "BLR" | "BGR" | "KGZ" | "MKD" | "MNG" | "RUS" | "SRB" | "TJK" | "UKR" | "MNE" | "ARM" | "ISR" | "AFG" | "JOR" | "DZA" | "SDN" | "ESH" | "IRQ" | "SAU" | "KWT" | "MAR" | "YEM" | "IRN" | "TUN" | "ARE" | "SYR" | "OMN" | "PSE" | "QAT" | "LBN" | "EGY" | "MRT" | "NPL" | "IND" | "THA" | "LAO" | "MMR" | "GEO" | "ETH" | "ERI" | "BHR" | "LBY" | "CHN" | "JPN" | "MAC" | "TWN" | "HKG" | "KOR" | "PRK">(props: Props<T> & {
|
|
17
|
+
ref?: ForwardedRef<View> | undefined;
|
|
18
|
+
}) => ReturnType<typeof CountryPickerWithRef>;
|
|
14
19
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Flag } from "@swan-io/lake/src/components/Flag";
|
|
3
3
|
import { LakeSelect } from "@swan-io/lake/src/components/LakeSelect";
|
|
4
|
-
import { useMemo } from "react";
|
|
4
|
+
import { forwardRef, useMemo } from "react";
|
|
5
5
|
import { getCountryName } from "../constants/countries";
|
|
6
|
-
|
|
6
|
+
const CountryPickerWithRef = ({ onValueChange, value, countries, readOnly, id, error, placeholder, disabled, hideErrors, }, forwardedRef) => {
|
|
7
7
|
const items = useMemo(() => {
|
|
8
8
|
return countries
|
|
9
9
|
.filter((item, index, array) => array.indexOf(item) === index) // deduplicate
|
|
@@ -14,5 +14,6 @@ export function CountryPicker({ onValueChange, value, countries, readOnly, id, e
|
|
|
14
14
|
}))
|
|
15
15
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
16
16
|
}, [countries]);
|
|
17
|
-
return (_jsx(LakeSelect, { readOnly: readOnly, id: id, error: error, items: items, placeholder: placeholder, value: value, onValueChange: onValueChange, disabled: disabled, hideErrors: hideErrors }));
|
|
18
|
-
}
|
|
17
|
+
return (_jsx(LakeSelect, { readOnly: readOnly, id: id, ref: forwardedRef, error: error, items: items, placeholder: placeholder, value: value, onValueChange: onValueChange, disabled: disabled, hideErrors: hideErrors }));
|
|
18
|
+
};
|
|
19
|
+
export const CountryPicker = forwardRef(CountryPickerWithRef);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TextInput } from "react-native";
|
|
1
3
|
import { AccountCountry } from "../utils/templateTranslations";
|
|
2
4
|
type Props = {
|
|
3
5
|
value: string;
|
|
@@ -11,5 +13,5 @@ type Props = {
|
|
|
11
13
|
required?: boolean;
|
|
12
14
|
label?: string;
|
|
13
15
|
};
|
|
14
|
-
export declare const TaxIdentificationNumberInput: (
|
|
16
|
+
export declare const TaxIdentificationNumberInput: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<TextInput | null>>;
|
|
15
17
|
export {};
|
|
@@ -4,13 +4,14 @@ import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
|
|
|
4
4
|
import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
|
|
5
5
|
import { LakeTooltip } from "@swan-io/lake/src/components/LakeTooltip";
|
|
6
6
|
import { colors } from "@swan-io/lake/src/constants/design";
|
|
7
|
+
import { forwardRef } from "react";
|
|
7
8
|
import { t } from "../utils/i18n";
|
|
8
9
|
import { getCompanyTaxNumberHelp, getCompanyTaxNumberPlaceholder, getIndividualTaxNumberHelp, getIndividualTaxNumberPlaceholder, getTaxNumberTooltip, } from "../utils/templateTranslations";
|
|
9
|
-
export const TaxIdentificationNumberInput = ({ value, error, valid, disabled, onChange, onBlur, accountCountry, isCompany, required, label = t("beneficiaryForm.beneficiary.taxIdentificationNumber"), }) => {
|
|
10
|
+
export const TaxIdentificationNumberInput = forwardRef(({ value, error, valid, disabled, onChange, onBlur, accountCountry, isCompany, required, label = t("beneficiaryForm.beneficiary.taxIdentificationNumber"), }, ref) => {
|
|
10
11
|
const tooltipContents = getTaxNumberTooltip(accountCountry);
|
|
11
|
-
return (_jsx(LakeLabel, { label: label, optionalLabel: required === true ? undefined : t("common.optional"), help: tooltipContents != null ? (_jsx(LakeTooltip, { content: tooltipContents, placement: "top", width: accountCountry === "DEU" ? 800 : undefined, children: _jsx(Icon, { name: "question-circle-regular", size: 16, color: colors.gray[600] }) })) : null, render: id => (_jsx(LakeTextInput, { id: id, placeholder: isCompany
|
|
12
|
+
return (_jsx(LakeLabel, { label: label, optionalLabel: required === true ? undefined : t("common.optional"), help: tooltipContents != null ? (_jsx(LakeTooltip, { content: tooltipContents, placement: "top", width: accountCountry === "DEU" ? 800 : undefined, children: _jsx(Icon, { name: "question-circle-regular", size: 16, color: colors.gray[600] }) })) : null, render: id => (_jsx(LakeTextInput, { id: id, ref: ref, placeholder: isCompany
|
|
12
13
|
? getCompanyTaxNumberPlaceholder(accountCountry)
|
|
13
14
|
: getIndividualTaxNumberPlaceholder(accountCountry), help: isCompany
|
|
14
15
|
? getCompanyTaxNumberHelp(accountCountry)
|
|
15
16
|
: getIndividualTaxNumberHelp(accountCountry), value: value, error: error, valid: valid, disabled: disabled, onChangeText: onChange, onBlur: onBlur })) }));
|
|
16
|
-
};
|
|
17
|
+
});
|