@jacksonavila/phone-lib 2.0.1 → 2.0.2
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 +262 -227
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,42 +1,51 @@
|
|
|
1
1
|
# PhoneLib 📱
|
|
2
2
|
|
|
3
|
+
Modern JavaScript library to easily integrate a phone input with country selector, flags, and phone number validation. **Compatible with Vanilla JavaScript and React**.
|
|
4
|
+
|
|
3
5
|
Librería JavaScript moderna para integrar fácilmente un input de teléfono con selector de país, banderas y validación de números telefónicos. **Compatible con Vanilla JavaScript y React**.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@jacksonavila/phone-lib)
|
|
6
8
|
[](https://opensource.org/licenses/MIT)
|
|
7
9
|
|
|
8
|
-
|
|
10
|
+
---
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- ✅ **
|
|
13
|
-
- ✅ **
|
|
14
|
-
- ✅ **
|
|
15
|
-
- ✅ **
|
|
16
|
-
- ✅ **
|
|
17
|
-
- ✅ **
|
|
18
|
-
- ✅ **
|
|
19
|
-
- ✅ **
|
|
20
|
-
- ✅ **
|
|
21
|
-
- ✅ **
|
|
22
|
-
- ✅ **
|
|
12
|
+
## ✨ Features / Características
|
|
13
|
+
|
|
14
|
+
- ✅ **Country dropdown** / **Dropdown de países** showing name, ISO2 code, dial code, and flag
|
|
15
|
+
- ✅ **Tel input** / **Input tipo tel** with automatic formatting based on selected country
|
|
16
|
+
- ✅ **Phone number validation** / **Validación de números** using `libphonenumber-js`
|
|
17
|
+
- ✅ **Complete public API** / **API pública completa** with methods to get number information
|
|
18
|
+
- ✅ **Vanilla JavaScript and React support** / **Soporte para Vanilla JavaScript y React**
|
|
19
|
+
- ✅ **Two layouts available** / **Dos layouts disponibles**: integrated and separated
|
|
20
|
+
- ✅ **Customizable events and callbacks** / **Eventos y callbacks** personalizables
|
|
21
|
+
- ✅ **Full programmatic control** / **Control programático** completo
|
|
22
|
+
- ✅ **Automatic country detection** / **Detección automática** de país
|
|
23
|
+
- ✅ **Country filtering** / **Filtrado de países** (include/exclude/disable)
|
|
24
|
+
- ✅ **Readonly/disabled mode** / **Modo readonly/disabled**
|
|
25
|
+
- ✅ **Modern responsive CSS** / **Estilos CSS modernos** y responsivos
|
|
26
|
+
- ✅ **Improved accessibility** / **Accesibilidad mejorada** (ARIA labels, keyboard navigation)
|
|
23
27
|
|
|
24
|
-
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 📦 Installation / Instalación
|
|
25
31
|
|
|
26
32
|
```bash
|
|
27
33
|
npm install @jacksonavila/phone-lib
|
|
28
34
|
```
|
|
29
35
|
|
|
30
|
-
### Dependencias
|
|
36
|
+
### Dependencies / Dependencias
|
|
31
37
|
|
|
32
38
|
```bash
|
|
33
|
-
# Para proyectos React
|
|
39
|
+
# For React projects / Para proyectos React
|
|
34
40
|
npm install react react-dom
|
|
35
41
|
|
|
36
|
-
#
|
|
42
|
+
# libphonenumber-js is installed automatically
|
|
43
|
+
# libphonenumber-js se instala automáticamente
|
|
37
44
|
```
|
|
38
45
|
|
|
39
|
-
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## 🚀 Quick Start / Inicio Rápido
|
|
40
49
|
|
|
41
50
|
### Vanilla JavaScript
|
|
42
51
|
|
|
@@ -58,7 +67,7 @@ npm install react react-dom
|
|
|
58
67
|
showDialCode: true
|
|
59
68
|
});
|
|
60
69
|
|
|
61
|
-
// Obtener información del número
|
|
70
|
+
// Get number information / Obtener información del número
|
|
62
71
|
const info = phoneLib.getInfo();
|
|
63
72
|
console.log(info);
|
|
64
73
|
</script>
|
|
@@ -86,11 +95,13 @@ function App() {
|
|
|
86
95
|
export default App;
|
|
87
96
|
```
|
|
88
97
|
|
|
89
|
-
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## 📖 Complete Usage Guide / Guía de Uso Completa
|
|
90
101
|
|
|
91
102
|
### Vanilla JavaScript
|
|
92
103
|
|
|
93
|
-
#### Ejemplo Básico
|
|
104
|
+
#### Basic Example / Ejemplo Básico
|
|
94
105
|
|
|
95
106
|
```javascript
|
|
96
107
|
import PhoneLib from '@jacksonavila/phone-lib';
|
|
@@ -105,7 +116,7 @@ const phoneLib = new PhoneLib('#phone-container', {
|
|
|
105
116
|
});
|
|
106
117
|
```
|
|
107
118
|
|
|
108
|
-
#### Con Eventos y Callbacks
|
|
119
|
+
#### With Events and Callbacks / Con Eventos y Callbacks
|
|
109
120
|
|
|
110
121
|
```javascript
|
|
111
122
|
import PhoneLib from '@jacksonavila/phone-lib';
|
|
@@ -116,59 +127,59 @@ const phoneLib = new PhoneLib('#phone-container', {
|
|
|
116
127
|
|
|
117
128
|
// Callbacks
|
|
118
129
|
onCountryChange: (country, dialCode, countryName) => {
|
|
119
|
-
console.log('País cambiado:', country, dialCode, countryName);
|
|
130
|
+
console.log('Country changed / País cambiado:', country, dialCode, countryName);
|
|
120
131
|
},
|
|
121
132
|
|
|
122
133
|
onPhoneChange: (phoneNumber, isValid, country) => {
|
|
123
|
-
console.log('Número:', phoneNumber, 'Válido:', isValid);
|
|
134
|
+
console.log('Number / Número:', phoneNumber, 'Valid / Válido:', isValid);
|
|
124
135
|
if (isValid) {
|
|
125
136
|
const info = phoneLib.getInfo();
|
|
126
|
-
console.log('Información completa:', info);
|
|
137
|
+
console.log('Complete info / Información completa:', info);
|
|
127
138
|
}
|
|
128
139
|
},
|
|
129
140
|
|
|
130
141
|
onValidationChange: (isValid, phoneNumber) => {
|
|
131
|
-
console.log('Validación:', isValid ? 'Válido' : 'Inválido');
|
|
142
|
+
console.log('Validation / Validación:', isValid ? 'Valid / Válido' : 'Invalid / Inválido');
|
|
132
143
|
},
|
|
133
144
|
|
|
134
|
-
onFocus: () => console.log('Input enfocado'),
|
|
135
|
-
onBlur: () => console.log('Input perdió foco')
|
|
145
|
+
onFocus: () => console.log('Input focused / Input enfocado'),
|
|
146
|
+
onBlur: () => console.log('Input blurred / Input perdió foco')
|
|
136
147
|
});
|
|
137
148
|
|
|
138
|
-
// Escuchar eventos DOM personalizados
|
|
149
|
+
// Listen to custom DOM events / Escuchar eventos DOM personalizados
|
|
139
150
|
document.getElementById('phone-container').addEventListener('phoneLib:countryChange', (e) => {
|
|
140
|
-
console.log('Evento DOM:', e.detail);
|
|
151
|
+
console.log('DOM event / Evento DOM:', e.detail);
|
|
141
152
|
});
|
|
142
153
|
```
|
|
143
154
|
|
|
144
|
-
#### Control Programático
|
|
155
|
+
#### Programmatic Control / Control Programático
|
|
145
156
|
|
|
146
157
|
```javascript
|
|
147
|
-
// Establecer valores
|
|
158
|
+
// Set values / Establecer valores
|
|
148
159
|
phoneLib.setCountry('ES');
|
|
149
160
|
phoneLib.setPhoneNumber('+34600123456');
|
|
150
161
|
phoneLib.setValue('US', '5551234567');
|
|
151
162
|
|
|
152
|
-
// Controlar estado
|
|
163
|
+
// Control state / Controlar estado
|
|
153
164
|
phoneLib.enable();
|
|
154
165
|
phoneLib.disable();
|
|
155
166
|
phoneLib.reset();
|
|
156
167
|
|
|
157
|
-
// Obtener información
|
|
168
|
+
// Get information / Obtener información
|
|
158
169
|
const country = phoneLib.getCountry(); // 'CO'
|
|
159
170
|
const dialCode = phoneLib.getDialCode(); // '+57'
|
|
160
171
|
const raw = phoneLib.getRaw(); // '3001234567'
|
|
161
172
|
const e164 = phoneLib.getE164(); // '+573001234567'
|
|
162
173
|
const isValid = phoneLib.isValid(); // true/false
|
|
163
|
-
const info = phoneLib.getInfo(); // Objeto completo
|
|
174
|
+
const info = phoneLib.getInfo(); // Complete object / Objeto completo
|
|
164
175
|
```
|
|
165
176
|
|
|
166
|
-
#### Integración con Formularios
|
|
177
|
+
#### Form Integration / Integración con Formularios
|
|
167
178
|
|
|
168
179
|
```html
|
|
169
180
|
<form id="contact-form">
|
|
170
181
|
<div id="phone-container"></div>
|
|
171
|
-
<button type="submit">Enviar</button>
|
|
182
|
+
<button type="submit">Submit / Enviar</button>
|
|
172
183
|
</form>
|
|
173
184
|
|
|
174
185
|
<script type="module">
|
|
@@ -186,25 +197,25 @@ const info = phoneLib.getInfo(); // Objeto completo
|
|
|
186
197
|
const phoneInfo = phoneLib.getInfo();
|
|
187
198
|
|
|
188
199
|
if (!phoneInfo.isValid) {
|
|
189
|
-
alert('Por favor ingrese un número válido');
|
|
200
|
+
alert('Please enter a valid number / Por favor ingrese un número válido');
|
|
190
201
|
return;
|
|
191
202
|
}
|
|
192
203
|
|
|
193
|
-
// Enviar datos
|
|
204
|
+
// Send data / Enviar datos
|
|
194
205
|
const formData = {
|
|
195
206
|
phone: phoneInfo.e164,
|
|
196
207
|
country: phoneInfo.country,
|
|
197
|
-
// ... otros campos
|
|
208
|
+
// ... other fields / otros campos
|
|
198
209
|
};
|
|
199
210
|
|
|
200
|
-
console.log('Enviando:', formData);
|
|
211
|
+
console.log('Sending / Enviando:', formData);
|
|
201
212
|
});
|
|
202
213
|
</script>
|
|
203
214
|
```
|
|
204
215
|
|
|
205
216
|
### React
|
|
206
217
|
|
|
207
|
-
#### Ejemplo Básico
|
|
218
|
+
#### Basic Example / Ejemplo Básico
|
|
208
219
|
|
|
209
220
|
```jsx
|
|
210
221
|
import React from 'react';
|
|
@@ -224,7 +235,7 @@ function App() {
|
|
|
224
235
|
export default App;
|
|
225
236
|
```
|
|
226
237
|
|
|
227
|
-
#### Con Ref y Métodos
|
|
238
|
+
#### With Ref and Methods / Con Ref y Métodos
|
|
228
239
|
|
|
229
240
|
```jsx
|
|
230
241
|
import React, { useRef } from 'react';
|
|
@@ -238,11 +249,11 @@ function App() {
|
|
|
238
249
|
const info = phoneLibRef.current.getInfo();
|
|
239
250
|
|
|
240
251
|
if (!info.isValid) {
|
|
241
|
-
alert('Número inválido');
|
|
252
|
+
alert('Invalid number / Número inválido');
|
|
242
253
|
return;
|
|
243
254
|
}
|
|
244
255
|
|
|
245
|
-
console.log('Enviar:', info.e164);
|
|
256
|
+
console.log('Send / Enviar:', info.e164);
|
|
246
257
|
};
|
|
247
258
|
|
|
248
259
|
return (
|
|
@@ -252,16 +263,16 @@ function App() {
|
|
|
252
263
|
initialCountry="CO"
|
|
253
264
|
layout="integrated"
|
|
254
265
|
onPhoneChange={(phone, isValid) => {
|
|
255
|
-
console.log('Número:', phone, 'Válido:', isValid);
|
|
266
|
+
console.log('Number / Número:', phone, 'Valid / Válido:', isValid);
|
|
256
267
|
}}
|
|
257
268
|
/>
|
|
258
|
-
<button onClick={handleSubmit}>Enviar</button>
|
|
269
|
+
<button onClick={handleSubmit}>Submit / Enviar</button>
|
|
259
270
|
</div>
|
|
260
271
|
);
|
|
261
272
|
}
|
|
262
273
|
```
|
|
263
274
|
|
|
264
|
-
#### Con Estado de React
|
|
275
|
+
#### With React State / Con Estado de React
|
|
265
276
|
|
|
266
277
|
```jsx
|
|
267
278
|
import React, { useState, useRef } from 'react';
|
|
@@ -292,9 +303,9 @@ function PhoneForm() {
|
|
|
292
303
|
|
|
293
304
|
{phoneData && (
|
|
294
305
|
<div>
|
|
295
|
-
<p>País: {phoneData.country}</p>
|
|
296
|
-
<p>Número: {phoneData.e164}</p>
|
|
297
|
-
<p>Válido: {phoneData.isValid ? 'Sí' : 'No'}</p>
|
|
306
|
+
<p>Country / País: {phoneData.country}</p>
|
|
307
|
+
<p>Number / Número: {phoneData.e164}</p>
|
|
308
|
+
<p>Valid / Válido: {phoneData.isValid ? 'Yes / Sí' : 'No'}</p>
|
|
298
309
|
</div>
|
|
299
310
|
)}
|
|
300
311
|
</div>
|
|
@@ -302,7 +313,7 @@ function PhoneForm() {
|
|
|
302
313
|
}
|
|
303
314
|
```
|
|
304
315
|
|
|
305
|
-
#### Integración con Formularios React
|
|
316
|
+
#### React Form Integration / Integración con Formularios React
|
|
306
317
|
|
|
307
318
|
```jsx
|
|
308
319
|
import React, { useRef } from 'react';
|
|
@@ -319,7 +330,7 @@ function ContactForm() {
|
|
|
319
330
|
const phoneInfo = phoneLibRef.current.getInfo();
|
|
320
331
|
|
|
321
332
|
if (!phoneInfo.isValid) {
|
|
322
|
-
alert('Por favor ingrese un número válido');
|
|
333
|
+
alert('Please enter a valid number / Por favor ingrese un número válido');
|
|
323
334
|
return;
|
|
324
335
|
}
|
|
325
336
|
|
|
@@ -330,7 +341,7 @@ function ContactForm() {
|
|
|
330
341
|
country: phoneInfo.country
|
|
331
342
|
};
|
|
332
343
|
|
|
333
|
-
// Enviar datos
|
|
344
|
+
// Send data / Enviar datos
|
|
334
345
|
fetch('/api/contact', {
|
|
335
346
|
method: 'POST',
|
|
336
347
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -340,7 +351,7 @@ function ContactForm() {
|
|
|
340
351
|
|
|
341
352
|
return (
|
|
342
353
|
<form ref={formRef} onSubmit={handleSubmit}>
|
|
343
|
-
<input name="name" placeholder="Nombre" required />
|
|
354
|
+
<input name="name" placeholder="Name / Nombre" required />
|
|
344
355
|
<input name="email" type="email" placeholder="Email" required />
|
|
345
356
|
|
|
346
357
|
<PhoneLibReact
|
|
@@ -349,107 +360,111 @@ function ContactForm() {
|
|
|
349
360
|
validateOnInput={true}
|
|
350
361
|
/>
|
|
351
362
|
|
|
352
|
-
<button type="submit">Enviar</button>
|
|
363
|
+
<button type="submit">Submit / Enviar</button>
|
|
353
364
|
</form>
|
|
354
365
|
);
|
|
355
366
|
}
|
|
356
367
|
```
|
|
357
368
|
|
|
358
|
-
|
|
369
|
+
---
|
|
359
370
|
|
|
360
|
-
|
|
371
|
+
## 🎨 Available Layouts / Layouts Disponibles
|
|
361
372
|
|
|
362
|
-
|
|
373
|
+
### Integrated Layout / Layout Integrado (Default)
|
|
374
|
+
|
|
375
|
+
The country selector and input are on the same line / El selector de país y el input están en la misma línea:
|
|
363
376
|
|
|
364
377
|
```javascript
|
|
365
378
|
const phoneLib = new PhoneLib('#container', {
|
|
366
379
|
layout: 'integrated',
|
|
367
|
-
showDialCode: true // Muestra +57 en el botón
|
|
380
|
+
showDialCode: true // Shows +57 in button / Muestra +57 en el botón
|
|
368
381
|
});
|
|
369
382
|
```
|
|
370
383
|
|
|
371
|
-
**Con código visible:**
|
|
372
|
-
- Muestra: `[🇨🇴 +57 ▼] [300 123 4567]`
|
|
384
|
+
**With code visible / Con código visible:**
|
|
385
|
+
- Shows / Muestra: `[🇨🇴 +57 ▼] [300 123 4567]`
|
|
373
386
|
|
|
374
|
-
**Sin código visible:**
|
|
387
|
+
**Without code visible / Sin código visible:**
|
|
375
388
|
```javascript
|
|
376
389
|
const phoneLib = new PhoneLib('#container', {
|
|
377
390
|
layout: 'integrated',
|
|
378
|
-
showDialCode: false // Solo muestra la bandera
|
|
391
|
+
showDialCode: false // Only shows flag / Solo muestra la bandera
|
|
379
392
|
});
|
|
380
393
|
```
|
|
381
|
-
- Muestra: `[🇨🇴 ▼] [300 123 4567]`
|
|
394
|
+
- Shows / Muestra: `[🇨🇴 ▼] [300 123 4567]`
|
|
382
395
|
|
|
383
|
-
### Layout Separado
|
|
396
|
+
### Separated Layout / Layout Separado
|
|
384
397
|
|
|
385
|
-
Los campos están separados en una fila:
|
|
398
|
+
Fields are separated in a row / Los campos están separados en una fila:
|
|
386
399
|
|
|
387
400
|
```javascript
|
|
388
401
|
const phoneLib = new PhoneLib('#container', {
|
|
389
402
|
layout: 'separated',
|
|
390
|
-
showDialCode: true // Muestra campo "Código" separado
|
|
403
|
+
showDialCode: true // Shows separate "Code" field / Muestra campo "Código" separado
|
|
391
404
|
});
|
|
392
405
|
```
|
|
393
406
|
|
|
394
|
-
**Con código visible:**
|
|
395
|
-
- Muestra: `[País: 🇨🇴 Colombia ▼] [Código: +57] [Número: 300 123 4567]`
|
|
407
|
+
**With code visible / Con código visible:**
|
|
408
|
+
- Shows / Muestra: `[Country / País: 🇨🇴 Colombia ▼] [Code / Código: +57] [Number / Número: 300 123 4567]`
|
|
396
409
|
|
|
397
|
-
**Sin código visible:**
|
|
410
|
+
**Without code visible / Sin código visible:**
|
|
398
411
|
```javascript
|
|
399
412
|
const phoneLib = new PhoneLib('#container', {
|
|
400
413
|
layout: 'separated',
|
|
401
|
-
showDialCode: false // Solo muestra País y Número
|
|
414
|
+
showDialCode: false // Only shows Country and Number / Solo muestra País y Número
|
|
402
415
|
});
|
|
403
416
|
```
|
|
404
|
-
- Muestra: `[País: 🇨🇴 Colombia ▼] [Número: 300 123 4567]`
|
|
417
|
+
- Shows / Muestra: `[Country / País: 🇨🇴 Colombia ▼] [Number / Número: 300 123 4567]`
|
|
418
|
+
|
|
419
|
+
---
|
|
405
420
|
|
|
406
|
-
## ⚙️ Opciones de Configuración
|
|
421
|
+
## ⚙️ Configuration Options / Opciones de Configuración
|
|
407
422
|
|
|
408
|
-
### Opciones Básicas
|
|
423
|
+
### Basic Options / Opciones Básicas
|
|
409
424
|
|
|
410
425
|
```javascript
|
|
411
426
|
{
|
|
412
|
-
initialCountry: 'CO', // País inicial (ISO2)
|
|
413
|
-
preferredCountries: ['CO', 'US'], // Países que aparecen primero
|
|
414
|
-
showHint: true,
|
|
415
|
-
layout: 'integrated',
|
|
416
|
-
showDialCode: true
|
|
427
|
+
initialCountry: 'CO', // Initial country / País inicial (ISO2)
|
|
428
|
+
preferredCountries: ['CO', 'US'], // Countries that appear first / Países que aparecen primero
|
|
429
|
+
showHint: true, // Show validation hint / Mostrar hint de validación
|
|
430
|
+
layout: 'integrated', // 'integrated' or 'separated' / 'integrated' o 'separated'
|
|
431
|
+
showDialCode: true // Show dial code / Mostrar código de marcación
|
|
417
432
|
}
|
|
418
433
|
```
|
|
419
434
|
|
|
420
|
-
### Opciones Avanzadas
|
|
435
|
+
### Advanced Options / Opciones Avanzadas
|
|
421
436
|
|
|
422
437
|
```javascript
|
|
423
438
|
{
|
|
424
|
-
// Detección y validación
|
|
425
|
-
autoDetectCountry: true, // Detectar país automáticamente
|
|
426
|
-
validateOnInput: false, // Validar mientras se escribe
|
|
439
|
+
// Detection and validation / Detección y validación
|
|
440
|
+
autoDetectCountry: true, // Auto-detect country / Detectar país automáticamente
|
|
441
|
+
validateOnInput: false, // Validate while typing / Validar mientras se escribe
|
|
427
442
|
|
|
428
|
-
// Filtrado de países
|
|
429
|
-
onlyCountries: ['CO', 'US', 'ES'], // Solo estos países
|
|
430
|
-
disabledCountries: ['CU', 'KP'], // Deshabilitar estos
|
|
431
|
-
excludeCountries: ['XX'], // Excluir estos
|
|
443
|
+
// Country filtering / Filtrado de países
|
|
444
|
+
onlyCountries: ['CO', 'US', 'ES'], // Only these countries / Solo estos países
|
|
445
|
+
disabledCountries: ['CU', 'KP'], // Disable these / Deshabilitar estos
|
|
446
|
+
excludeCountries: ['XX'], // Exclude these / Excluir estos
|
|
432
447
|
|
|
433
|
-
// Estados
|
|
434
|
-
readonly: false,
|
|
435
|
-
disabled: false,
|
|
448
|
+
// States / Estados
|
|
449
|
+
readonly: false, // Read-only mode / Modo solo lectura
|
|
450
|
+
disabled: false, // Disabled component / Componente deshabilitado
|
|
436
451
|
|
|
437
|
-
// Personalización
|
|
438
|
-
placeholder: '
|
|
439
|
-
countryLabel: '
|
|
440
|
-
dialCodeLabel: '
|
|
441
|
-
phoneLabel: '
|
|
452
|
+
// Customization / Personalización
|
|
453
|
+
placeholder: 'Enter your number', // Custom placeholder / Placeholder personalizado
|
|
454
|
+
countryLabel: 'Country', // Label for selector / Label para selector
|
|
455
|
+
dialCodeLabel: 'Code', // Label for code / Label para código
|
|
456
|
+
phoneLabel: 'Phone number', // Label for number / Label para número
|
|
442
457
|
|
|
443
|
-
// Mensajes
|
|
458
|
+
// Messages / Mensajes
|
|
444
459
|
messages: {
|
|
445
|
-
invalid: '
|
|
446
|
-
valid: '✓
|
|
460
|
+
invalid: 'Invalid number',
|
|
461
|
+
valid: '✓ Valid number'
|
|
447
462
|
},
|
|
448
463
|
|
|
449
|
-
// Estilos
|
|
464
|
+
// Styles / Estilos
|
|
450
465
|
customClasses: {
|
|
451
|
-
wrapper: '
|
|
452
|
-
input: '
|
|
466
|
+
wrapper: 'my-class',
|
|
467
|
+
input: 'my-input'
|
|
453
468
|
},
|
|
454
469
|
customStyles: {
|
|
455
470
|
input: {
|
|
@@ -459,97 +474,99 @@ const phoneLib = new PhoneLib('#container', {
|
|
|
459
474
|
}
|
|
460
475
|
```
|
|
461
476
|
|
|
462
|
-
### Callbacks y Eventos
|
|
477
|
+
### Callbacks and Events / Callbacks y Eventos
|
|
463
478
|
|
|
464
479
|
```javascript
|
|
465
480
|
{
|
|
466
481
|
onCountryChange: (country, dialCode, countryName) => {
|
|
467
|
-
// País cambiado
|
|
482
|
+
// Country changed / País cambiado
|
|
468
483
|
},
|
|
469
484
|
onPhoneChange: (phoneNumber, isValid, country) => {
|
|
470
|
-
// Número cambiado
|
|
485
|
+
// Number changed / Número cambiado
|
|
471
486
|
},
|
|
472
487
|
onValidationChange: (isValid, phoneNumber) => {
|
|
473
|
-
// Validación cambiada
|
|
488
|
+
// Validation changed / Validación cambiada
|
|
474
489
|
},
|
|
475
490
|
onFocus: () => {
|
|
476
|
-
// Input enfocado
|
|
491
|
+
// Input focused / Input enfocado
|
|
477
492
|
},
|
|
478
493
|
onBlur: () => {
|
|
479
|
-
// Input perdió foco
|
|
494
|
+
// Input blurred / Input perdió foco
|
|
480
495
|
}
|
|
481
496
|
}
|
|
482
497
|
```
|
|
483
498
|
|
|
484
|
-
|
|
499
|
+
---
|
|
500
|
+
|
|
501
|
+
## 📚 Public API
|
|
485
502
|
|
|
486
|
-
### Métodos de Lectura
|
|
503
|
+
### Reading Methods / Métodos de Lectura
|
|
487
504
|
|
|
488
505
|
#### `getCountry()`
|
|
489
|
-
Devuelve el código ISO2 del país seleccionado.
|
|
506
|
+
Returns the ISO2 code of the selected country / Devuelve el código ISO2 del país seleccionado.
|
|
490
507
|
|
|
491
508
|
```javascript
|
|
492
509
|
const country = phoneLib.getCountry(); // 'CO'
|
|
493
510
|
```
|
|
494
511
|
|
|
495
512
|
#### `getDialCode()`
|
|
496
|
-
Devuelve el código de marcación del país seleccionado.
|
|
513
|
+
Returns the dial code of the selected country / Devuelve el código de marcación del país seleccionado.
|
|
497
514
|
|
|
498
515
|
```javascript
|
|
499
516
|
const dialCode = phoneLib.getDialCode(); // '+57'
|
|
500
517
|
```
|
|
501
518
|
|
|
502
519
|
#### `getRaw()`
|
|
503
|
-
Devuelve el número ingresado sin formato (solo dígitos).
|
|
520
|
+
Returns the entered number without formatting (digits only) / Devuelve el número ingresado sin formato (solo dígitos).
|
|
504
521
|
|
|
505
522
|
```javascript
|
|
506
523
|
const raw = phoneLib.getRaw(); // '3001234567'
|
|
507
524
|
```
|
|
508
525
|
|
|
509
526
|
#### `getE164()`
|
|
510
|
-
Devuelve el número en formato E.164.
|
|
527
|
+
Returns the number in E.164 format / Devuelve el número en formato E.164.
|
|
511
528
|
|
|
512
529
|
```javascript
|
|
513
530
|
const e164 = phoneLib.getE164(); // '+573001234567'
|
|
514
531
|
```
|
|
515
532
|
|
|
516
533
|
#### `isValid()`
|
|
517
|
-
Devuelve `true` si el número es válido, `false` en caso contrario.
|
|
534
|
+
Returns `true` if the number is valid, `false` otherwise / Devuelve `true` si el número es válido, `false` en caso contrario.
|
|
518
535
|
|
|
519
536
|
```javascript
|
|
520
537
|
const isValid = phoneLib.isValid(); // true o false
|
|
521
538
|
```
|
|
522
539
|
|
|
523
540
|
#### `formatInternational()`
|
|
524
|
-
Devuelve el número en formato internacional.
|
|
541
|
+
Returns the number in international format / Devuelve el número en formato internacional.
|
|
525
542
|
|
|
526
543
|
```javascript
|
|
527
544
|
const international = phoneLib.formatInternational(); // '+57 300 123 4567'
|
|
528
545
|
```
|
|
529
546
|
|
|
530
547
|
#### `formatNational()`
|
|
531
|
-
Devuelve el número en formato nacional.
|
|
548
|
+
Returns the number in national format / Devuelve el número en formato nacional.
|
|
532
549
|
|
|
533
550
|
```javascript
|
|
534
551
|
const national = phoneLib.formatNational(); // '300 123 4567'
|
|
535
552
|
```
|
|
536
553
|
|
|
537
554
|
#### `formatRFC3966()`
|
|
538
|
-
Devuelve el número en formato RFC3966.
|
|
555
|
+
Returns the number in RFC3966 format / Devuelve el número en formato RFC3966.
|
|
539
556
|
|
|
540
557
|
```javascript
|
|
541
558
|
const rfc3966 = phoneLib.formatRFC3966(); // 'tel:+57-300-123-4567'
|
|
542
559
|
```
|
|
543
560
|
|
|
544
561
|
#### `getNumberType()`
|
|
545
|
-
Devuelve el tipo de número (MOBILE, FIXED_LINE, etc.).
|
|
562
|
+
Returns the number type (MOBILE, FIXED_LINE, etc.) / Devuelve el tipo de número (MOBILE, FIXED_LINE, etc.).
|
|
546
563
|
|
|
547
564
|
```javascript
|
|
548
565
|
const type = phoneLib.getNumberType(); // 'MOBILE' o null
|
|
549
566
|
```
|
|
550
567
|
|
|
551
568
|
#### `getInfo()`
|
|
552
|
-
Devuelve un objeto con toda la información del número.
|
|
569
|
+
Returns an object with all number information / Devuelve un objeto con toda la información del número.
|
|
553
570
|
|
|
554
571
|
```javascript
|
|
555
572
|
const info = phoneLib.getInfo();
|
|
@@ -568,7 +585,7 @@ const info = phoneLib.getInfo();
|
|
|
568
585
|
```
|
|
569
586
|
|
|
570
587
|
#### `getCountryMetadata()`
|
|
571
|
-
Devuelve información completa del país seleccionado.
|
|
588
|
+
Returns complete information about the selected country / Devuelve información completa del país seleccionado.
|
|
572
589
|
|
|
573
590
|
```javascript
|
|
574
591
|
const metadata = phoneLib.getCountryMetadata();
|
|
@@ -580,31 +597,31 @@ const metadata = phoneLib.getCountryMetadata();
|
|
|
580
597
|
// }
|
|
581
598
|
```
|
|
582
599
|
|
|
583
|
-
### Métodos de Control
|
|
600
|
+
### Control Methods / Métodos de Control
|
|
584
601
|
|
|
585
602
|
#### `setCountry(iso2)`
|
|
586
|
-
Establece el país programáticamente.
|
|
603
|
+
Sets the country programmatically / Establece el país programáticamente.
|
|
587
604
|
|
|
588
605
|
```javascript
|
|
589
606
|
phoneLib.setCountry('ES');
|
|
590
607
|
```
|
|
591
608
|
|
|
592
609
|
#### `setPhoneNumber(number)`
|
|
593
|
-
Establece el número telefónico programáticamente.
|
|
610
|
+
Sets the phone number programmatically / Establece el número telefónico programáticamente.
|
|
594
611
|
|
|
595
612
|
```javascript
|
|
596
613
|
phoneLib.setPhoneNumber('+34600123456');
|
|
597
614
|
```
|
|
598
615
|
|
|
599
616
|
#### `setValue(country, number)`
|
|
600
|
-
Establece país y número juntos.
|
|
617
|
+
Sets both country and number / Establece país y número juntos.
|
|
601
618
|
|
|
602
619
|
```javascript
|
|
603
620
|
phoneLib.setValue('ES', '600123456');
|
|
604
621
|
```
|
|
605
622
|
|
|
606
623
|
#### `enable()` / `disable()`
|
|
607
|
-
Habilita o deshabilita el componente.
|
|
624
|
+
Enables or disables the component / Habilita o deshabilita el componente.
|
|
608
625
|
|
|
609
626
|
```javascript
|
|
610
627
|
phoneLib.enable();
|
|
@@ -612,21 +629,21 @@ phoneLib.disable();
|
|
|
612
629
|
```
|
|
613
630
|
|
|
614
631
|
#### `reset()`
|
|
615
|
-
Resetea el componente a valores iniciales.
|
|
632
|
+
Resets the component to initial values / Resetea el componente a valores iniciales.
|
|
616
633
|
|
|
617
634
|
```javascript
|
|
618
635
|
phoneLib.reset();
|
|
619
636
|
```
|
|
620
637
|
|
|
621
638
|
#### `destroy()`
|
|
622
|
-
Destruye la instancia y limpia recursos.
|
|
639
|
+
Destroys the instance and cleans up resources / Destruye la instancia y limpia recursos.
|
|
623
640
|
|
|
624
641
|
```javascript
|
|
625
642
|
phoneLib.destroy();
|
|
626
643
|
```
|
|
627
644
|
|
|
628
645
|
#### `updateOptions(newOptions)`
|
|
629
|
-
Actualiza opciones dinámicamente.
|
|
646
|
+
Updates options dynamically / Actualiza opciones dinámicamente.
|
|
630
647
|
|
|
631
648
|
```javascript
|
|
632
649
|
phoneLib.updateOptions({
|
|
@@ -634,21 +651,23 @@ phoneLib.updateOptions({
|
|
|
634
651
|
});
|
|
635
652
|
```
|
|
636
653
|
|
|
637
|
-
|
|
654
|
+
---
|
|
655
|
+
|
|
656
|
+
## 🎨 Custom Styling / Estilos Personalizados
|
|
638
657
|
|
|
639
|
-
### Con Clases CSS
|
|
658
|
+
### With CSS Classes / Con Clases CSS
|
|
640
659
|
|
|
641
660
|
```javascript
|
|
642
661
|
const phoneLib = new PhoneLib('#container', {
|
|
643
662
|
customClasses: {
|
|
644
|
-
wrapper: '
|
|
645
|
-
dropdownButton: '
|
|
646
|
-
input: '
|
|
663
|
+
wrapper: 'my-custom-class',
|
|
664
|
+
dropdownButton: 'my-custom-button',
|
|
665
|
+
input: 'my-custom-input'
|
|
647
666
|
}
|
|
648
667
|
});
|
|
649
668
|
```
|
|
650
669
|
|
|
651
|
-
### Con Estilos Inline
|
|
670
|
+
### With Inline Styles / Con Estilos Inline
|
|
652
671
|
|
|
653
672
|
```javascript
|
|
654
673
|
const phoneLib = new PhoneLib('#container', {
|
|
@@ -666,177 +685,193 @@ const phoneLib = new PhoneLib('#container', {
|
|
|
666
685
|
});
|
|
667
686
|
```
|
|
668
687
|
|
|
669
|
-
### Elementos Personalizables
|
|
688
|
+
### Customizable Elements / Elementos Personalizables
|
|
689
|
+
|
|
690
|
+
- `wrapper` - Main container / Contenedor principal
|
|
691
|
+
- `dropdownButton` - Country selector button / Botón del selector de país
|
|
692
|
+
- `input` - Phone input field / Campo de entrada de teléfono
|
|
693
|
+
- `dialCodeInput` - Dial code field (separated layout only) / Campo de código (solo layout separado)
|
|
694
|
+
- `row` - Grid row (separated layout only) / Fila del grid (solo layout separado)
|
|
670
695
|
|
|
671
|
-
|
|
672
|
-
- `dropdownButton` - Botón del selector de país
|
|
673
|
-
- `input` - Campo de entrada de teléfono
|
|
674
|
-
- `dialCodeInput` - Campo de código (solo layout separado)
|
|
675
|
-
- `row` - Fila del grid (solo layout separado)
|
|
696
|
+
---
|
|
676
697
|
|
|
677
|
-
## 🔧 Ejemplos Avanzados
|
|
698
|
+
## 🔧 Advanced Examples / Ejemplos Avanzados
|
|
678
699
|
|
|
679
|
-
### Detección Automática de País
|
|
700
|
+
### Automatic Country Detection / Detección Automática de País
|
|
680
701
|
|
|
681
702
|
```javascript
|
|
682
703
|
const phoneLib = new PhoneLib('#container', {
|
|
683
|
-
autoDetectCountry: true // Detecta país al ingresar +34...
|
|
704
|
+
autoDetectCountry: true // Detects country when entering +34... / Detecta país al ingresar +34...
|
|
684
705
|
});
|
|
685
706
|
|
|
686
|
-
//
|
|
687
|
-
// Automáticamente cambia a España
|
|
707
|
+
// User types / Usuario escribe: +34 600 123 456
|
|
708
|
+
// Automatically changes to Spain / Automáticamente cambia a España
|
|
688
709
|
```
|
|
689
710
|
|
|
690
|
-
### Filtrado de Países
|
|
711
|
+
### Country Filtering / Filtrado de Países
|
|
691
712
|
|
|
692
713
|
```javascript
|
|
693
714
|
const phoneLib = new PhoneLib('#container', {
|
|
694
|
-
// Solo mostrar estos países
|
|
715
|
+
// Only show these countries / Solo mostrar estos países
|
|
695
716
|
onlyCountries: ['CO', 'US', 'ES', 'MX'],
|
|
696
717
|
|
|
697
|
-
//
|
|
718
|
+
// Disable these countries (appear but can't be selected) / Deshabilitar estos países
|
|
698
719
|
disabledCountries: ['CU', 'KP'],
|
|
699
720
|
|
|
700
|
-
//
|
|
721
|
+
// Exclude these countries (don't appear in list) / Excluir estos países
|
|
701
722
|
excludeCountries: ['XX']
|
|
702
723
|
});
|
|
703
724
|
```
|
|
704
725
|
|
|
705
|
-
### Validación en Tiempo Real
|
|
726
|
+
### Real-time Validation / Validación en Tiempo Real
|
|
706
727
|
|
|
707
728
|
```javascript
|
|
708
729
|
const phoneLib = new PhoneLib('#container', {
|
|
709
|
-
validateOnInput: true, // Valida mientras el usuario escribe
|
|
730
|
+
validateOnInput: true, // Validate while user types / Valida mientras el usuario escribe
|
|
710
731
|
|
|
711
732
|
onValidationChange: (isValid) => {
|
|
712
733
|
if (isValid) {
|
|
713
|
-
console.log('Número válido!');
|
|
734
|
+
console.log('Valid number! / ¡Número válido!');
|
|
714
735
|
}
|
|
715
736
|
}
|
|
716
737
|
});
|
|
717
738
|
```
|
|
718
739
|
|
|
719
|
-
### Modo Readonly/Disabled
|
|
740
|
+
### Readonly/Disabled Mode / Modo Readonly/Disabled
|
|
720
741
|
|
|
721
742
|
```javascript
|
|
722
|
-
// Solo lectura
|
|
743
|
+
// Read-only / Solo lectura
|
|
723
744
|
const phoneLib = new PhoneLib('#container', {
|
|
724
745
|
readonly: true
|
|
725
746
|
});
|
|
726
747
|
|
|
727
|
-
// Deshabilitado
|
|
748
|
+
// Disabled / Deshabilitado
|
|
728
749
|
const phoneLib = new PhoneLib('#container', {
|
|
729
750
|
disabled: true
|
|
730
751
|
});
|
|
731
752
|
```
|
|
732
753
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
|
738
|
-
|
|
739
|
-
| `
|
|
740
|
-
| `
|
|
741
|
-
| `
|
|
742
|
-
| `
|
|
743
|
-
| `
|
|
744
|
-
| `
|
|
745
|
-
| `
|
|
746
|
-
| `
|
|
747
|
-
| `
|
|
748
|
-
| `
|
|
749
|
-
| `
|
|
750
|
-
| `
|
|
751
|
-
| `
|
|
752
|
-
| `
|
|
753
|
-
| `
|
|
754
|
-
| `
|
|
755
|
-
| `
|
|
756
|
-
| `
|
|
757
|
-
| `
|
|
758
|
-
| `
|
|
759
|
-
| `
|
|
760
|
-
| `
|
|
761
|
-
| `
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
754
|
+
---
|
|
755
|
+
|
|
756
|
+
## 📱 React Component Props
|
|
757
|
+
|
|
758
|
+
| Prop | Type | Default | Description / Descripción |
|
|
759
|
+
|------|------|---------|--------------------------|
|
|
760
|
+
| `initialCountry` | string | `'US'` | Initial country (ISO2) / País inicial (ISO2) |
|
|
761
|
+
| `preferredCountries` | array | `[]` | Preferred countries / Países preferidos |
|
|
762
|
+
| `showHint` | boolean | `true` | Show validation hint / Mostrar hint de validación |
|
|
763
|
+
| `layout` | string | `'integrated'` | `'integrated'` or `'separated'` / `'integrated'` o `'separated'` |
|
|
764
|
+
| `showDialCode` | boolean | `true` | Show dial code / Mostrar código de marcación |
|
|
765
|
+
| `autoDetectCountry` | boolean | `false` | Auto-detect country / Detectar país automáticamente |
|
|
766
|
+
| `validateOnInput` | boolean | `false` | Validate while typing / Validar mientras se escribe |
|
|
767
|
+
| `disabledCountries` | array | `[]` | Disabled countries / Países deshabilitados |
|
|
768
|
+
| `onlyCountries` | array | `[]` | Only these countries / Solo estos países |
|
|
769
|
+
| `excludeCountries` | array | `[]` | Exclude these countries / Excluir estos países |
|
|
770
|
+
| `readonly` | boolean | `false` | Read-only mode / Modo solo lectura |
|
|
771
|
+
| `disabled` | boolean | `false` | Disabled component / Componente deshabilitado |
|
|
772
|
+
| `placeholder` | string | `null` | Custom placeholder / Placeholder personalizado |
|
|
773
|
+
| `countryLabel` | string | `'Country'` / `'País'` | Label for selector / Label para selector |
|
|
774
|
+
| `dialCodeLabel` | string | `'Code'` / `'Código'` | Label for code / Label para código |
|
|
775
|
+
| `phoneLabel` | string | `'Phone number'` / `'Número de teléfono'` | Label for number / Label para número |
|
|
776
|
+
| `customClasses` | object | `{}` | Custom CSS classes / Clases CSS personalizadas |
|
|
777
|
+
| `customStyles` | object | `{}` | Inline styles / Estilos inline personalizados |
|
|
778
|
+
| `messages` | object | `{}` | Custom messages / Mensajes personalizables |
|
|
779
|
+
| `ariaLabels` | object | `{}` | ARIA labels / Labels ARIA personalizables |
|
|
780
|
+
| `onCountryChange` | function | `null` | Callback when country changes / Callback cuando cambia el país |
|
|
781
|
+
| `onPhoneChange` | function | `null` | Callback when number changes / Callback cuando cambia el número |
|
|
782
|
+
| `onValidationChange` | function | `null` | Callback when validation changes / Callback cuando cambia la validación |
|
|
783
|
+
| `onFocus` | function | `null` | Callback when focused / Callback cuando se enfoca |
|
|
784
|
+
| `onBlur` | function | `null` | Callback when blurred / Callback cuando pierde foco |
|
|
785
|
+
|
|
786
|
+
---
|
|
787
|
+
|
|
788
|
+
## 🧪 Development and Testing / Desarrollo y Pruebas
|
|
789
|
+
|
|
790
|
+
### Run Demos Locally / Ejecutar Demos Localmente
|
|
766
791
|
|
|
767
792
|
```bash
|
|
768
|
-
# Instalar dependencias
|
|
793
|
+
# Install dependencies / Instalar dependencias
|
|
769
794
|
npm install
|
|
770
795
|
|
|
771
|
-
# Iniciar servidor de desarrollo
|
|
796
|
+
# Start development server / Iniciar servidor de desarrollo
|
|
772
797
|
npm run serve
|
|
773
798
|
```
|
|
774
799
|
|
|
775
|
-
Esto abrirá `http://localhost:3004` con todos los demos disponibles.
|
|
800
|
+
This will open `http://localhost:3004` with all available demos / Esto abrirá `http://localhost:3004` con todos los demos disponibles.
|
|
776
801
|
|
|
777
|
-
### Archivos de Demo
|
|
802
|
+
### Demo Files / Archivos de Demo
|
|
778
803
|
|
|
779
|
-
- `demo.html` - Layout integrado básico
|
|
780
|
-
- `demo-separated.html` - Layout separado
|
|
781
|
-
- `demo-all-layouts.html` - Comparación de todos los layouts
|
|
782
|
-
- `demo-features.html` - Todas las características
|
|
783
|
-
- `demo-react.html` - Ejemplo con React
|
|
804
|
+
- `demo.html` - Basic integrated layout / Layout integrado básico
|
|
805
|
+
- `demo-separated.html` - Separated layout / Layout separado
|
|
806
|
+
- `demo-all-layouts.html` - All layouts comparison / Comparación de todos los layouts
|
|
807
|
+
- `demo-features.html` - All features / Todas las características
|
|
808
|
+
- `demo-react.html` - React example / Ejemplo con React
|
|
809
|
+
|
|
810
|
+
---
|
|
784
811
|
|
|
785
|
-
## 📦 Estructura del Paquete
|
|
812
|
+
## 📦 Package Structure / Estructura del Paquete
|
|
786
813
|
|
|
787
814
|
```
|
|
788
815
|
@jacksonavila/phone-lib/
|
|
789
|
-
├── phone-lib.js # Código principal (Vanilla JS)
|
|
790
|
-
├── phone-lib.css # Estilos CSS
|
|
791
|
-
├── phone-lib-react.jsx # Componente React
|
|
792
|
-
├── phone-lib-react.js # Versión CommonJS/ESM React
|
|
793
|
-
└── README.md # Documentación
|
|
816
|
+
├── phone-lib.js # Main code (Vanilla JS) / Código principal (Vanilla JS)
|
|
817
|
+
├── phone-lib.css # CSS styles / Estilos CSS
|
|
818
|
+
├── phone-lib-react.jsx # React component / Componente React
|
|
819
|
+
├── phone-lib-react.js # CommonJS/ESM React version / Versión CommonJS/ESM React
|
|
820
|
+
└── README.md # Documentation / Documentación
|
|
794
821
|
```
|
|
795
822
|
|
|
796
|
-
### Rutas de Importación
|
|
823
|
+
### Import Paths / Rutas de Importación
|
|
797
824
|
|
|
798
825
|
```javascript
|
|
799
|
-
// Librería principal (Vanilla JS)
|
|
826
|
+
// Main library (Vanilla JS) / Librería principal (Vanilla JS)
|
|
800
827
|
import PhoneLib from '@jacksonavila/phone-lib';
|
|
801
828
|
|
|
802
|
-
// Componente React
|
|
829
|
+
// React component / Componente React
|
|
803
830
|
import PhoneLibReact from '@jacksonavila/phone-lib/react';
|
|
804
831
|
|
|
805
|
-
// Estilos CSS
|
|
832
|
+
// CSS styles / Estilos CSS
|
|
806
833
|
import '@jacksonavila/phone-lib/css';
|
|
807
834
|
|
|
808
|
-
// O con rutas completas
|
|
835
|
+
// Or with full paths / O con rutas completas
|
|
809
836
|
import PhoneLib from '@jacksonavila/phone-lib/phone-lib.js';
|
|
810
837
|
import PhoneLibReact from '@jacksonavila/phone-lib/phone-lib-react.jsx';
|
|
811
838
|
import '@jacksonavila/phone-lib/phone-lib.css';
|
|
812
839
|
```
|
|
813
840
|
|
|
814
|
-
|
|
841
|
+
---
|
|
842
|
+
|
|
843
|
+
## 🤝 Contributing / Contribuir
|
|
844
|
+
|
|
845
|
+
Contributions are welcome / Las contribuciones son bienvenidas. Please / Por favor:
|
|
846
|
+
|
|
847
|
+
1. Fork the project / Haz fork del proyecto
|
|
848
|
+
2. Create a feature branch / Crea una rama para tu feature (`git checkout -b feature/AmazingFeature`)
|
|
849
|
+
3. Commit your changes / Commit tus cambios (`git commit -m 'Add some AmazingFeature'`)
|
|
850
|
+
4. Push to the branch / Push a la rama (`git push origin feature/AmazingFeature`)
|
|
851
|
+
5. Open a Pull Request / Abre un Pull Request
|
|
815
852
|
|
|
816
|
-
|
|
853
|
+
---
|
|
854
|
+
|
|
855
|
+
## 📄 License / Licencia
|
|
817
856
|
|
|
818
|
-
|
|
819
|
-
2. Crea una rama para tu feature (`git checkout -b feature/AmazingFeature`)
|
|
820
|
-
3. Commit tus cambios (`git commit -m 'Add some AmazingFeature'`)
|
|
821
|
-
4. Push a la rama (`git push origin feature/AmazingFeature`)
|
|
822
|
-
5. Abre un Pull Request
|
|
857
|
+
This project is licensed under the MIT License / Este proyecto está bajo la Licencia MIT - see the [LICENSE](LICENSE) file for details / ver el archivo [LICENSE](LICENSE) para más detalles.
|
|
823
858
|
|
|
824
|
-
|
|
859
|
+
---
|
|
825
860
|
|
|
826
|
-
|
|
861
|
+
## 🙏 Acknowledgments / Agradecimientos
|
|
827
862
|
|
|
828
|
-
|
|
863
|
+
- [libphonenumber-js](https://github.com/catamphetamine/libphonenumber-js) - For phone number validation and formatting / Para validación y formato de números telefónicos
|
|
829
864
|
|
|
830
|
-
|
|
865
|
+
---
|
|
831
866
|
|
|
832
|
-
## 📞 Soporte
|
|
867
|
+
## 📞 Support / Soporte
|
|
833
868
|
|
|
834
|
-
Si tienes preguntas o encuentras algún problema:
|
|
869
|
+
If you have questions or find any issues / Si tienes preguntas o encuentras algún problema:
|
|
835
870
|
|
|
836
|
-
-
|
|
837
|
-
- Consulta la [documentación completa](./USAGE.md)
|
|
838
|
-
- Revisa los [ejemplos](./demo.html)
|
|
871
|
+
- Open an [issue](https://github.com/tu-usuario/phone-lib/issues) on GitHub
|
|
872
|
+
- Check the [complete documentation](./USAGE.md) / Consulta la [documentación completa](./USAGE.md)
|
|
873
|
+
- Review the [examples](./demo.html) / Revisa los [ejemplos](./demo.html)
|
|
839
874
|
|
|
840
875
|
---
|
|
841
876
|
|
|
842
|
-
**Hecho con ❤️ para la comunidad de desarrolladores**
|
|
877
|
+
**Made with ❤️ for the developer community / Hecho con ❤️ para la comunidad de desarrolladores**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jacksonavila/phone-lib",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "Librería JavaScript para input de teléfono con selector de país y banderas - Compatible con Vanilla JS y React",
|
|
5
5
|
"main": "phone-lib.js",
|
|
6
6
|
"module": "phone-lib.js",
|
|
@@ -71,4 +71,4 @@
|
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=14.0.0"
|
|
73
73
|
}
|
|
74
|
-
}
|
|
74
|
+
}
|