From 93f2fa070c36d8ac1ffab429f007f26cbe3a165d Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Wed, 2 Dec 2020 17:31:02 -0300 Subject: [PATCH 01/11] Fix to enable autocomplete or paste when countryCodeEditable is false --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 6ebfc56a..9db28d9f 100644 --- a/src/index.js +++ b/src/index.js @@ -513,8 +513,9 @@ class PhoneInput extends React.Component { this.state.onlyCountries.find(o => o.iso2 === newSelectedCountry.iso2 && o.mainCode).dialCode : newSelectedCountry.dialCode; + const valueWithPrefix = prefix+value; const updatedInput = prefix+mainCode; - if (value.slice(0, updatedInput.length) !== updatedInput) return; + if (value.slice(0, updatedInput.length) !== updatedInput && valueWithPrefix.slice(0, updatedInput.length) !== updatedInput) return; } if (value === prefix) { From 8c176da15139f05f6305a6a44eb593cb89305ff6 Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Mon, 25 Jan 2021 11:11:58 -0300 Subject: [PATCH 02/11] Added demo for autocomplete or paste when countryCodeEditable is false --- test/dev:js/demo.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/dev:js/demo.js b/test/dev:js/demo.js index 30e975ba..077f3f16 100644 --- a/test/dev:js/demo.js +++ b/test/dev:js/demo.js @@ -62,6 +62,17 @@ class Demo extends React.Component { country='it' preferredCountries={['it', 'se']} /> +

Autocomplete

+
+ +
From f7fe6c1f068fb811d6fecccb07f36debcc7cac6a Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Mon, 25 Jan 2021 11:24:53 -0300 Subject: [PATCH 03/11] Removed extra div --- test/dev:js/demo.js | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/test/dev:js/demo.js b/test/dev:js/demo.js index 077f3f16..8b9d86ad 100644 --- a/test/dev:js/demo.js +++ b/test/dev:js/demo.js @@ -63,16 +63,14 @@ class Demo extends React.Component { preferredCountries={['it', 'se']} />

Autocomplete

-
- -
+
From 12915ab62badfe6b955066cc0d30813e6b69c9fe Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Mon, 25 Jan 2021 21:07:58 -0300 Subject: [PATCH 04/11] Changed package for own fork --- package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 4fcb3c22..095602bf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { - "name": "react-phone-input-2", - "version": "2.13.9", - "description": "A react component to format phone numbers", + "name": "@jonathancalb/react-phone-input-2", + "version": "2.13.10", + "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", "scripts": { @@ -16,7 +16,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/bl00mber/react-phone-input-2.git" + "url": "git+https://github.com/jonathancalb/react-phone-input-2" }, "keywords": [ "react", From 645d87e1e6c090c3c93cbba2c065093fe971ee42 Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Mon, 25 Jan 2021 21:17:47 -0300 Subject: [PATCH 05/11] version upgrade --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 095602bf..7bda9e27 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jonathancalb/react-phone-input-2", - "version": "2.13.10", + "version": "2.13.11", "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", From 97602e9fc23756b478597b5c71e756221b6c70e5 Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Mon, 25 Jan 2021 21:18:29 -0300 Subject: [PATCH 06/11] v2.13.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7bda9e27..ecf92c4b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jonathancalb/react-phone-input-2", - "version": "2.13.11", + "version": "2.13.12", "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", From 3f9fb31b02d63a9968dd5e7f9147e8089dc6b5dd Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Mon, 25 Jan 2021 21:21:37 -0300 Subject: [PATCH 07/11] v2.13.13 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ecf92c4b..e11dffad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jonathancalb/react-phone-input-2", - "version": "2.13.12", + "version": "2.13.13", "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", From 19bd3f50ca40bc6d357575df2c6e5317356ce25f Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Tue, 26 Jan 2021 09:14:30 -0300 Subject: [PATCH 08/11] v2.13.14 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e11dffad..55f6e0dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jonathancalb/react-phone-input-2", - "version": "2.13.13", + "version": "2.13.14", "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", From 13569091014c86020c1257805965d3a254ed04d7 Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Tue, 26 Jan 2021 09:15:16 -0300 Subject: [PATCH 09/11] Module name fix --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index 133bd3cb..07f7a181 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -declare module "react-phone-input-2" { +declare module "@jonathancalb/react-phone-input-2" { import React from "react"; interface CountryData { From 35b40a57e0dc5835975db9e79ad63c07fcbd569d Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Tue, 26 Jan 2021 10:05:46 -0300 Subject: [PATCH 10/11] Version update --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 55f6e0dd..5a04edd1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@jonathancalb/react-phone-input-2", - "version": "2.13.14", + "version": "2.13.15", "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", From 23b73b6bf91c17a51ac078aa25d2a408fe4a1193 Mon Sep 17 00:00:00 2001 From: Jonathan Calb Date: Tue, 26 Jan 2021 16:01:23 -0300 Subject: [PATCH 11/11] Documentation fixes after publish --- LICENSE | 1 + README.md | 26 +++++++++++++------------- index.d.ts | 2 +- package.json | 17 +++++++++++------ test/dev:css/demo.js | 4 ++-- test/dev:js/demo.js | 2 +- 6 files changed, 29 insertions(+), 23 deletions(-) diff --git a/LICENSE b/LICENSE index 0f649d3d..6371c51a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,6 @@ The MIT License (MIT) +Copyright (c) 2020-2021 Jonathan Calb (https://github.com/jonathancalb) Copyright (c) 2017-2020 Nick Reiley (https://github.com/bl00mber) Copyright (c) 2015-2017 Raza Gill (https://github.com/razagill) diff --git a/README.md b/README.md index a04103cc..a90aed6a 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,22 @@ -# React-Phone-Input-2 +# React-Phone-Input-International Highly customizable phone input component with auto formatting. -[![npm version](https://img.shields.io/npm/v/react-phone-input-2.svg?style=flat)](https://www.npmjs.com/package/react-phone-input-2) -[![npm downloads](https://img.shields.io/npm/dm/react-phone-input-2.svg?style=flat)](https://www.npmjs.com/package/react-phone-input-2) -[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/bl00mber/react-phone-input-2#contributing) -[![travis build](https://travis-ci.org/bl00mber/react-phone-input-2.svg?branch=master)](https://travis-ci.org/bl00mber/react-phone-input-2) +[![npm version](https://img.shields.io/npm/v/react-phone-input-international.svg?style=flat)](https://www.npmjs.com/package/react-phone-input-international) +[![npm downloads](https://img.shields.io/npm/dm/react-phone-input-international.svg?style=flat)](https://www.npmjs.com/package/react-phone-input-international) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/bl00mber/react-phone-input-international#contributing) +[![travis build](https://travis-ci.org/bl00mber/react-phone-input-international.svg?branch=master)](https://travis-ci.org/bl00mber/react-phone-input-international) ![animation](https://media.giphy.com/media/xiORAWnqoTJDsH0UOI/giphy.gif) ## Installation ```shell-script -npm install react-phone-input-2 --save +npm install react-phone-input-international --save ``` ## Usage ```jsx -import PhoneInput from 'react-phone-input-2' -import 'react-phone-input-2/lib/style.css' +import PhoneInput from 'react-phone-input-international' +import 'react-phone-input-international/lib/style.css' @@ -302,7 +302,7 @@ Country data object not returns from onKeyDown event `ir` Iranian, `ar` Arabic, `tr` Turkish, `id` Indonesian ```jsx -import es from 'react-phone-input-2/lang/es.json' +import es from 'react-phone-input-international/lang/es.json' + ``` ## Contributing @@ -479,7 +479,7 @@ To clear `country`, pass `null` as `value`. - Do not send new languages ## License -[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bl00mber/react-phone-input-2/blob/master/LICENSE) +[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bl00mber/react-phone-input-international/blob/master/LICENSE) Based on [react-phone-input](https://github.com/razagill/react-phone-input) diff --git a/index.d.ts b/index.d.ts index 07f7a181..3117c907 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,4 +1,4 @@ -declare module "@jonathancalb/react-phone-input-2" { +declare module "react-phone-input-international" { import React from "react"; interface CountryData { diff --git a/package.json b/package.json index 5a04edd1..d0668a79 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "@jonathancalb/react-phone-input-2", - "version": "2.13.15", + "name": "react-phone-input-international", + "version": "2.14.1", "description": "A react component to format phone numbers. Fork from https://github.com/bl00mber/react-phone-input-2", "main": "lib/lib.js", "typings": "index.d.ts", @@ -16,7 +16,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/jonathancalb/react-phone-input-2" + "url": "git+https://github.com/jonathancalb/react-phone-input-international.git" }, "keywords": [ "react", @@ -40,15 +40,16 @@ "README.md", "index.d.ts" ], - "author": "Nick Reiley (https://github.com/bl00mber)", + "author": "Jonathan Calb (https://github.com/jonathancalb)", "contributors": [ + "Nick Reiley (https://github.com/bl00mber)", "Raza Gill (https://github.com/razagill)" ], "license": "MIT", "bugs": { - "url": "https://github.com/bl00mber/react-phone-input-2/issues" + "url": "https://github.com/jonathancalb/react-phone-input-international/issues" }, - "homepage": "https://github.com/bl00mber/react-phone-input-2", + "homepage": "https://github.com/jonathancalb/react-phone-input-international", "jest": { "moduleNameMapper": { "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)$": "/test/__mocks__/fileMock.js", @@ -91,5 +92,9 @@ "lodash.reduce": "^4.6.0", "lodash.startswith": "^4.2.1", "prop-types": "^15.7.2" + }, + "directories": { + "lib": "lib", + "test": "test" } } diff --git a/test/dev:css/demo.js b/test/dev:css/demo.js index 6258aa24..6928e9f0 100644 --- a/test/dev:css/demo.js +++ b/test/dev:css/demo.js @@ -57,7 +57,7 @@ class Demo extends React.Component { `}} />

Created by Nick Reiley

+ href="https://github.com/bl00mber/react-phone-input-international">Jonathan Calb

style

-

{"import 'react-phone-input-2/lib/"+currentStyle+".css'"}

+

{"import 'react-phone-input-international/lib/"+currentStyle+".css'"}

) diff --git a/test/dev:js/demo.js b/test/dev:js/demo.js index 8b9d86ad..e131ad9b 100644 --- a/test/dev:js/demo.js +++ b/test/dev:js/demo.js @@ -44,7 +44,7 @@ class Demo extends React.Component { } `}} />

Created by Nick Reiley

+ href="https://github.com/bl00mber/react-phone-input-2">Jonathan Calb

Exclude countries (usa, canada)