@moontra/moonui-pro 2.8.3 → 2.8.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/dist/index.mjs
CHANGED
|
@@ -60992,6 +60992,8 @@ var countries = [
|
|
|
60992
60992
|
{ code: "FI", name: "Finland", dialCode: "+358", flag: "\u{1F1EB}\u{1F1EE}", format: "xx xxxxxxx" }
|
|
60993
60993
|
];
|
|
60994
60994
|
function formatPhoneNumber(number, format3) {
|
|
60995
|
+
if (!number || !format3)
|
|
60996
|
+
return "";
|
|
60995
60997
|
const cleaned = number.replace(/\D/g, "");
|
|
60996
60998
|
let formatted = "";
|
|
60997
60999
|
let digitIndex = 0;
|
|
@@ -61006,6 +61008,8 @@ function formatPhoneNumber(number, format3) {
|
|
|
61006
61008
|
return formatted;
|
|
61007
61009
|
}
|
|
61008
61010
|
function validatePhoneNumber(number, countryCode) {
|
|
61011
|
+
if (!number || !countryCode)
|
|
61012
|
+
return false;
|
|
61009
61013
|
const cleaned = number.replace(/\D/g, "");
|
|
61010
61014
|
const country = countries.find((c2) => c2.code === countryCode);
|
|
61011
61015
|
if (!country)
|
|
@@ -61014,6 +61018,8 @@ function validatePhoneNumber(number, countryCode) {
|
|
|
61014
61018
|
return cleaned.length === expectedLength;
|
|
61015
61019
|
}
|
|
61016
61020
|
function toInternationalFormat(countryCode, phoneNumber) {
|
|
61021
|
+
if (!countryCode || !phoneNumber)
|
|
61022
|
+
return "";
|
|
61017
61023
|
const country = countries.find((c2) => c2.code === countryCode);
|
|
61018
61024
|
if (!country)
|
|
61019
61025
|
return phoneNumber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moontra/moonui-pro",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.4",
|
|
4
4
|
"description": "Premium React components for MoonUI - Advanced UI library with 50+ pro components including performance, interactive, and gesture components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.mjs",
|
|
@@ -59,6 +59,7 @@ export interface PhoneNumberInputProps extends Omit<React.InputHTMLAttributes<HT
|
|
|
59
59
|
|
|
60
60
|
// Telefon numarası formatlama
|
|
61
61
|
function formatPhoneNumber(number: string, format: string): string {
|
|
62
|
+
if (!number || !format) return ''
|
|
62
63
|
const cleaned = number.replace(/\D/g, '')
|
|
63
64
|
let formatted = ''
|
|
64
65
|
let digitIndex = 0
|
|
@@ -77,6 +78,7 @@ function formatPhoneNumber(number: string, format: string): string {
|
|
|
77
78
|
|
|
78
79
|
// Telefon numarası doğrulama
|
|
79
80
|
function validatePhoneNumber(number: string, countryCode: string): boolean {
|
|
81
|
+
if (!number || !countryCode) return false
|
|
80
82
|
const cleaned = number.replace(/\D/g, '')
|
|
81
83
|
const country = countries.find(c => c.code === countryCode)
|
|
82
84
|
|
|
@@ -90,6 +92,7 @@ function validatePhoneNumber(number: string, countryCode: string): boolean {
|
|
|
90
92
|
|
|
91
93
|
// Uluslararası format dönüştürme
|
|
92
94
|
function toInternationalFormat(countryCode: string, phoneNumber: string): string {
|
|
95
|
+
if (!countryCode || !phoneNumber) return ''
|
|
93
96
|
const country = countries.find(c => c.code === countryCode)
|
|
94
97
|
if (!country) return phoneNumber
|
|
95
98
|
|