@true-engineering/true-react-common-ui-kit 3.45.4 → 3.45.6
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/README.md +14 -0
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.styles.d.ts +1 -1
- package/dist/true-react-common-ui-kit.js +29 -57
- package/dist/true-react-common-ui-kit.js.map +1 -1
- package/dist/true-react-common-ui-kit.umd.cjs +28 -56
- package/dist/true-react-common-ui-kit.umd.cjs.map +1 -1
- package/package.json +1 -1
- package/src/components/PhoneInput/PhoneInput.stories.tsx +1 -1
- package/src/components/PhoneInput/PhoneInput.tsx +4 -1
- package/src/components/Tooltip/Tooltip.styles.ts +2 -0
- package/src/components/Tooltip/Tooltip.tsx +1 -1
- package/src/constants/phone-info.ts +7 -37
- package/src/helpers/phone.ts +19 -15
|
@@ -1989,15 +1989,11 @@
|
|
|
1989
1989
|
countryEn: "Abkhazia",
|
|
1990
1990
|
countryRu: "Абхазия",
|
|
1991
1991
|
countryCode: "AB",
|
|
1992
|
-
phoneMask: "999 999-99-99",
|
|
1992
|
+
phoneMask: "(999) 999-99-99",
|
|
1993
1993
|
dialCode: "7",
|
|
1994
|
-
|
|
1995
|
-
"840",
|
|
1996
|
-
"940"
|
|
1997
|
-
],
|
|
1994
|
+
dialCodePriority: 1,
|
|
1998
1995
|
fullCodes: [
|
|
1999
|
-
"
|
|
2000
|
-
"7940"
|
|
1996
|
+
"7"
|
|
2001
1997
|
]
|
|
2002
1998
|
},
|
|
2003
1999
|
{
|
|
@@ -2996,39 +2992,10 @@
|
|
|
2996
2992
|
countryRu: "Казахстан",
|
|
2997
2993
|
countryCode: "KZ",
|
|
2998
2994
|
dialCode: "7",
|
|
2999
|
-
phoneMask: "999 999-99-99",
|
|
2995
|
+
phoneMask: "(999) 999-99-99",
|
|
3000
2996
|
dialCodePriority: 1,
|
|
3001
|
-
areaCodes: [
|
|
3002
|
-
"310",
|
|
3003
|
-
"311",
|
|
3004
|
-
"312",
|
|
3005
|
-
"313",
|
|
3006
|
-
"315",
|
|
3007
|
-
"318",
|
|
3008
|
-
"321",
|
|
3009
|
-
"324",
|
|
3010
|
-
"325",
|
|
3011
|
-
"326",
|
|
3012
|
-
"327",
|
|
3013
|
-
"336",
|
|
3014
|
-
"7172",
|
|
3015
|
-
"73622"
|
|
3016
|
-
],
|
|
3017
2997
|
fullCodes: [
|
|
3018
|
-
"
|
|
3019
|
-
"7311",
|
|
3020
|
-
"7312",
|
|
3021
|
-
"7313",
|
|
3022
|
-
"7315",
|
|
3023
|
-
"7318",
|
|
3024
|
-
"7321",
|
|
3025
|
-
"7324",
|
|
3026
|
-
"7325",
|
|
3027
|
-
"7326",
|
|
3028
|
-
"7327",
|
|
3029
|
-
"7336",
|
|
3030
|
-
"77172",
|
|
3031
|
-
"773622"
|
|
2998
|
+
"7"
|
|
3032
2999
|
]
|
|
3033
3000
|
},
|
|
3034
3001
|
{
|
|
@@ -3801,8 +3768,9 @@
|
|
|
3801
3768
|
countryCode: "OS",
|
|
3802
3769
|
countryEn: "South Ossetia",
|
|
3803
3770
|
countryRu: "Южная Осетия",
|
|
3804
|
-
phoneMask: "999 999-99-99",
|
|
3771
|
+
phoneMask: "(999) 999-99-99",
|
|
3805
3772
|
dialCode: "7",
|
|
3773
|
+
dialCodePriority: 1,
|
|
3806
3774
|
fullCodes: [
|
|
3807
3775
|
"7"
|
|
3808
3776
|
]
|
|
@@ -4764,22 +4732,25 @@
|
|
|
4764
4732
|
return ((_phone_dialCode = phone === null || phone === void 0 ? void 0 : phone.dialCode) !== null && _phone_dialCode !== void 0 ? _phone_dialCode : "") + ((_phone_phoneNumber = phone === null || phone === void 0 ? void 0 : phone.phoneNumber) !== null && _phone_phoneNumber !== void 0 ? _phone_phoneNumber : "");
|
|
4765
4733
|
};
|
|
4766
4734
|
var getCountryCodeFromPhone = function(phoneWithCode) {
|
|
4767
|
-
var
|
|
4768
|
-
|
|
4769
|
-
return
|
|
4770
|
-
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
}
|
|
4782
|
-
|
|
4735
|
+
var _highestPriorityCountries_at;
|
|
4736
|
+
if (trueReactPlatformHelpers.isStringEmpty(phoneWithCode)) {
|
|
4737
|
+
return;
|
|
4738
|
+
}
|
|
4739
|
+
var matchedCountries = phoneInfo.filter(function(info) {
|
|
4740
|
+
return info.fullCodes.some(function(fullCode) {
|
|
4741
|
+
return phoneWithCode.startsWith(fullCode);
|
|
4742
|
+
});
|
|
4743
|
+
});
|
|
4744
|
+
if (matchedCountries.length === 1) {
|
|
4745
|
+
return matchedCountries[0].countryCode;
|
|
4746
|
+
}
|
|
4747
|
+
var highestPriorityCountries = phoneInfo.filter(function(info) {
|
|
4748
|
+
return phoneWithCode.startsWith(info.dialCode);
|
|
4749
|
+
}).sort(function(a, b) {
|
|
4750
|
+
var _a_dialCodePriority, _b_dialCodePriority;
|
|
4751
|
+
return ((_a_dialCodePriority = a.dialCodePriority) !== null && _a_dialCodePriority !== void 0 ? _a_dialCodePriority : 1e3) - ((_b_dialCodePriority = b.dialCodePriority) !== null && _b_dialCodePriority !== void 0 ? _b_dialCodePriority : 1e3);
|
|
4752
|
+
});
|
|
4753
|
+
return (_highestPriorityCountries_at = highestPriorityCountries.at(0)) === null || _highestPriorityCountries_at === void 0 ? void 0 : _highestPriorityCountries_at.countryCode;
|
|
4783
4754
|
};
|
|
4784
4755
|
var getPhoneObjFromString = function(fullPhone, countryCode) {
|
|
4785
4756
|
var _findCountryByCode;
|
|
@@ -13441,6 +13412,7 @@
|
|
|
13441
13412
|
color: colors.CLASSIC_WHITE,
|
|
13442
13413
|
letterSpacing: 0.2
|
|
13443
13414
|
},
|
|
13415
|
+
custom: {},
|
|
13444
13416
|
info: {},
|
|
13445
13417
|
error: {
|
|
13446
13418
|
"&$tooltip": {
|
|
@@ -28794,7 +28766,7 @@
|
|
|
28794
28766
|
var handleSelect = function(newPhoneInfo, event) {
|
|
28795
28767
|
if (newPhoneInfo.countryCode !== countryCode) {
|
|
28796
28768
|
onChange({
|
|
28797
|
-
phoneNumber: "",
|
|
28769
|
+
phoneNumber: newPhoneInfo.dialCode !== value.dialCode ? "" : getPhoneObjFromString(phoneWithCode).phoneNumber,
|
|
28798
28770
|
dialCode: newPhoneInfo.dialCode,
|
|
28799
28771
|
countryCode: newPhoneInfo.countryCode
|
|
28800
28772
|
}, event);
|