react-simple-phone-input 4.6.8 → 5.0.1
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 +131 -10
- package/dist/{style.css → cjs/index.css} +0 -0
- package/dist/esm/index.css +162 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
React Simple Phone Input
|
|
2
2
|
==========
|
|
3
3
|
|
|
4
|
-
A simple and customizable react phone number dropdown component. It can
|
|
4
|
+
A simple and customizable react phone number dropdown component. It can mix up with your designed theme and give a fluent vibe able dropdown area in your next project.
|
|
5
5
|
|
|
6
6
|
[](https://www.npmjs.com/package/react-simple-phone-input)
|
|
7
7
|
[](https://www.npmjs.com/package/react-simple-phone-input)
|
|
8
8
|
[](https://github.com/siamahnaf198/react-simple-phone-input)
|
|
9
9
|
[](https://github.com/siamahnaf198/react-simple-phone-input/blob/main/LICENSE)
|
|
10
10
|
|
|
11
|
-
- SSR
|
|
11
|
+
- SSR Friendly
|
|
12
12
|
- Customizable
|
|
13
13
|
- Multi Design
|
|
14
|
-
- Search
|
|
14
|
+
- Search Country
|
|
15
|
+
- Smallest Bundle Size (About 98kb)
|
|
16
|
+
- Typescript support
|
|
15
17
|
|
|
16
18
|
## Installation
|
|
17
19
|
|
|
@@ -19,16 +21,16 @@ A simple and customizable react phone number dropdown component. It can mixed up
|
|
|
19
21
|
$ npm i react-simple-phone-input --save
|
|
20
22
|
```
|
|
21
23
|
|
|
22
|
-
##
|
|
24
|
+
## Usage
|
|
23
25
|
|
|
24
26
|
```jsx
|
|
25
|
-
import { PhoneInput } from "react-simple-phone-input";
|
|
27
|
+
import { PhoneInput, PhoneInputResponseType } from "react-simple-phone-input";
|
|
26
28
|
import "react-simple-phone-input/dist/style.css";
|
|
27
29
|
|
|
28
30
|
<PhoneInput
|
|
29
31
|
country="US"
|
|
30
32
|
placeholder="Add your phone"
|
|
31
|
-
onChange={(data) => console.log(data)}
|
|
33
|
+
onChange={(data: PhoneInputResponseType) => console.log(data)}
|
|
32
34
|
/>
|
|
33
35
|
```
|
|
34
36
|
#### [See Demo](https://react-simple-phone-input.vercel.app/)
|
|
@@ -69,7 +71,7 @@ import "react-simple-phone-input/dist/style.css";
|
|
|
69
71
|
<td> ReactNode </td>
|
|
70
72
|
<td> Dropdown Icon component for changing default icon </td>
|
|
71
73
|
<td> optional </td>
|
|
72
|
-
<td><code> <Icon icon="icon-name" /> </
|
|
74
|
+
<td><code> <Icon icon="icon-name" /> </code></td>
|
|
73
75
|
</tr>
|
|
74
76
|
|
|
75
77
|
<tr>
|
|
@@ -117,7 +119,7 @@ import "react-simple-phone-input/dist/style.css";
|
|
|
117
119
|
<td> ReactNode </td>
|
|
118
120
|
<td> If <code>search</code> enabled, custom search icon to show on search bar </td>
|
|
119
121
|
<td> optional </td>
|
|
120
|
-
<td><code> <Icon icon="icon-name" /> </
|
|
122
|
+
<td><code> <Icon icon="icon-name" /> </code></td>
|
|
121
123
|
</tr>
|
|
122
124
|
|
|
123
125
|
<tr>
|
|
@@ -165,6 +167,16 @@ import "react-simple-phone-input/dist/style.css";
|
|
|
165
167
|
<td> true </td>
|
|
166
168
|
<td> Show or Hide search icon </td>
|
|
167
169
|
</tr>
|
|
170
|
+
<tr>
|
|
171
|
+
<td> disableDropdownOnly </td>
|
|
172
|
+
<td> false </td>
|
|
173
|
+
<td> Disable dropdown menu list </td>
|
|
174
|
+
</tr>
|
|
175
|
+
<tr>
|
|
176
|
+
<td> disableInput </td>
|
|
177
|
+
<td> false </td>
|
|
178
|
+
<td> Disable input field </td>
|
|
179
|
+
</tr>
|
|
168
180
|
</table>
|
|
169
181
|
|
|
170
182
|
## Event
|
|
@@ -177,11 +189,120 @@ import "react-simple-phone-input/dist/style.css";
|
|
|
177
189
|
</tr>
|
|
178
190
|
<tr>
|
|
179
191
|
<td> onChange </td>
|
|
180
|
-
<td> To get the value from component
|
|
181
|
-
|
|
192
|
+
<td> To get the value from component. You get following field
|
|
193
|
+
<ul>
|
|
194
|
+
<li><code>country</code></li>
|
|
195
|
+
<li><code>code</code></li>
|
|
196
|
+
<li><code>dialCode</code></li>
|
|
197
|
+
<li><code>value</code></li>
|
|
198
|
+
<li><code>valueWithoutPlus</code></li>
|
|
199
|
+
</ul>
|
|
200
|
+
</td>
|
|
201
|
+
<td> <code>onChange={(data: PhoneInputResponseType) => console.log(data)}</code> </td>
|
|
202
|
+
</tr>
|
|
203
|
+
</table>
|
|
204
|
+
|
|
205
|
+
## ClassName
|
|
206
|
+
|
|
207
|
+
<table>
|
|
208
|
+
<tr>
|
|
209
|
+
<th> Name </th>
|
|
210
|
+
<th> Type </th>
|
|
211
|
+
<th> Description </th>
|
|
212
|
+
</tr>
|
|
213
|
+
<tr>
|
|
214
|
+
<td> containerClass </td>
|
|
215
|
+
<td> string </td>
|
|
216
|
+
<td> class name for container </td>
|
|
217
|
+
</tr>
|
|
218
|
+
<tr>
|
|
219
|
+
<td> buttonClass </td>
|
|
220
|
+
<td> string </td>
|
|
221
|
+
<td> class name for dropdown button </td>
|
|
222
|
+
</tr>
|
|
223
|
+
<tr>
|
|
224
|
+
<td> dropdownClass </td>
|
|
225
|
+
<td> string </td>
|
|
226
|
+
<td> class name for dropdown area/menu </td>
|
|
227
|
+
</tr>
|
|
228
|
+
<tr>
|
|
229
|
+
<td> dropdownListClass </td>
|
|
230
|
+
<td> string </td>
|
|
231
|
+
<td> class name for dropdown list </td>
|
|
232
|
+
</tr>
|
|
233
|
+
<tr>
|
|
234
|
+
<td> dropdownIconClass </td>
|
|
235
|
+
<td> string </td>
|
|
236
|
+
<td> class name for dropdown icon </td>
|
|
237
|
+
</tr><tr>
|
|
238
|
+
<td> searchContainerClass </td>
|
|
239
|
+
<td> string </td>
|
|
240
|
+
<td> class name for search bar container </td>
|
|
241
|
+
</tr>
|
|
242
|
+
<tr>
|
|
243
|
+
<td> searchInputClass </td>
|
|
244
|
+
<td> string </td>
|
|
245
|
+
<td> class name for search input field </td>
|
|
246
|
+
</tr>
|
|
247
|
+
<tr>
|
|
248
|
+
<td> searchIconClass </td>
|
|
249
|
+
<td> string </td>
|
|
250
|
+
<td> class name for search icon </td>
|
|
251
|
+
</tr>
|
|
252
|
+
<tr>
|
|
253
|
+
<td> inputClass </td>
|
|
254
|
+
<td> string </td>
|
|
255
|
+
<td> class name for search icon </td>
|
|
256
|
+
</tr>
|
|
257
|
+
</table>
|
|
258
|
+
|
|
259
|
+
## Customize styles
|
|
260
|
+
|
|
261
|
+
<table>
|
|
262
|
+
<tr>
|
|
263
|
+
<th> Name </th>
|
|
264
|
+
<th> Description </th>
|
|
265
|
+
</tr>
|
|
266
|
+
<tr>
|
|
267
|
+
<td> containerStyle </td>
|
|
268
|
+
<td> phone Input Container style </td>
|
|
269
|
+
</tr>
|
|
270
|
+
<tr>
|
|
271
|
+
<td> buttonStyle </td>
|
|
272
|
+
<td> style for dropdown button </td>
|
|
273
|
+
</tr>
|
|
274
|
+
<tr>
|
|
275
|
+
<td> dropdownStyle </td>
|
|
276
|
+
<td> style for dropdown menu/area </td>
|
|
277
|
+
</tr>
|
|
278
|
+
<tr>
|
|
279
|
+
<td> dropdownListStyle </td>
|
|
280
|
+
<td> style for dropdown list </td>
|
|
281
|
+
</tr>
|
|
282
|
+
<tr>
|
|
283
|
+
<td> dropdownIconStyle </td>
|
|
284
|
+
<td> style for dropdown icon </td>
|
|
285
|
+
</tr>
|
|
286
|
+
<tr>
|
|
287
|
+
<td> searchContainerStyle </td>
|
|
288
|
+
<td> search container style </td>
|
|
289
|
+
</tr>
|
|
290
|
+
<tr>
|
|
291
|
+
<td> searchInputStyle </td>
|
|
292
|
+
<td> search input field style </td>
|
|
293
|
+
</tr>
|
|
294
|
+
<tr>
|
|
295
|
+
<td> searchIconStyle </td>
|
|
296
|
+
<td> search icon style </td>
|
|
297
|
+
</tr>
|
|
298
|
+
<tr>
|
|
299
|
+
<td> inputStyle </td>
|
|
300
|
+
<td> input field style </td>
|
|
182
301
|
</tr>
|
|
183
302
|
</table>
|
|
184
303
|
|
|
304
|
+
`note:` version 5 released. see the [changelogs](https://github.com/siamahnaf198/react-simple-phone-input/releases/tag/v5.0.0)
|
|
305
|
+
|
|
185
306
|
## Contributing
|
|
186
307
|
- Code style changes not allowed
|
|
187
308
|
- Do not create issues about incorrect or missing country data
|
|
File without changes
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
.simple-phone-input-sri198-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.simple-phone-input-sri198-container:focus,
|
|
6
|
+
.simple-phone-input-sri198-container:focus-visible,
|
|
7
|
+
.simple-phone-input-sri198-container:focus-within {
|
|
8
|
+
outline: none;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.simple-phone-input-sri198-main {
|
|
12
|
+
display: flex;
|
|
13
|
+
border: 1px solid rgb(203 203 203);
|
|
14
|
+
user-select: none;
|
|
15
|
+
border-radius: 3px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.simple-phone-input-sri198-dropdown-container {
|
|
19
|
+
cursor: pointer;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
background: rgb(231 231 231);
|
|
23
|
+
border-right: 1px solid rgb(203 203 203);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.simple-phone-input-sri198-dropdown-container img {
|
|
27
|
+
margin-right: 6px;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.simple-phone-input-sri198-dropdown {
|
|
31
|
+
background: white;
|
|
32
|
+
list-style: none;
|
|
33
|
+
padding: 0;
|
|
34
|
+
margin: 0;
|
|
35
|
+
position: absolute;
|
|
36
|
+
top: 110%;
|
|
37
|
+
left: 0;
|
|
38
|
+
right: 0;
|
|
39
|
+
height: 250px;
|
|
40
|
+
overflow-y: auto;
|
|
41
|
+
box-shadow: 0px 4px 15px rgb(163 163 163);
|
|
42
|
+
border-radius: 3px;
|
|
43
|
+
transition: 0.3s ease;
|
|
44
|
+
transform: translateY(-5px);
|
|
45
|
+
opacity: 0;
|
|
46
|
+
visibility: hidden;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.simple-phone-input-sri198-dropdown.active {
|
|
50
|
+
transform: translateY(0px);
|
|
51
|
+
opacity: 1;
|
|
52
|
+
visibility: visible;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.simple-phone-input-sri198-dropdown li {
|
|
56
|
+
margin: 3px 0;
|
|
57
|
+
padding: 3px 8px;
|
|
58
|
+
display: flex;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.simple-phone-input-sri198-dropdown li.active {
|
|
62
|
+
background: rgba(0, 0, 0, 0.116);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.simple-phone-input-sri198-dropdown li:hover {
|
|
66
|
+
background: rgba(0, 0, 0, 0.116);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.simple-phone-input-sri198-dropdown li img {
|
|
70
|
+
margin-right: 6px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.simple-phone-input-sri198-dropdown-container-button {
|
|
74
|
+
display: flex;
|
|
75
|
+
flex: 1;
|
|
76
|
+
width: 92px;
|
|
77
|
+
padding: 7px 2px 7px 7px;
|
|
78
|
+
align-items: center;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.simple-phone-input-sri198-dropdown-container-button.dial {
|
|
82
|
+
width: unset;
|
|
83
|
+
padding: 8px 3px 8px 8px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.simple-phone-input-sri198-dropdown-text {
|
|
87
|
+
font-size: 15px;
|
|
88
|
+
flex: 1;
|
|
89
|
+
margin-top: 3px;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.simple-phone-input-sri198-dropdown-country-code {
|
|
93
|
+
opacity: 0.6;
|
|
94
|
+
margin-top: 3px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.simple-phone-input-sri198-dropdown-icon {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: center;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.simple-phone-input-sri198-dropdown-icon svg {
|
|
104
|
+
transition: 0.3s ease;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.simple-phone-input-sri198-dropdown-icon.active svg {
|
|
108
|
+
transform: rotate(-180deg)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.simple-phone-input-sri198-selected-code {
|
|
112
|
+
flex: 1;
|
|
113
|
+
font-size: 14px;
|
|
114
|
+
margin-top: 2px;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.simple-phone-input-sri198-input {
|
|
118
|
+
width: 100%;
|
|
119
|
+
border: none;
|
|
120
|
+
padding: 0 10px;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.simple-phone-input-sri198-input:focus {
|
|
124
|
+
outline: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.simple-phone-input-sri198-search-container {
|
|
128
|
+
padding: 5px;
|
|
129
|
+
position: relative;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.simple-phone-input-sri198-search-container input {
|
|
133
|
+
border: 1px solid rgba(0, 0, 0, 0.116);
|
|
134
|
+
padding: 8px 10px;
|
|
135
|
+
width: 100%;
|
|
136
|
+
font-size: 15px;
|
|
137
|
+
border-radius: 2px;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.simple-phone-input-sri198-search-icon {
|
|
141
|
+
position: absolute;
|
|
142
|
+
right: 10px;
|
|
143
|
+
top: 50%;
|
|
144
|
+
transform: translateY(-50%);
|
|
145
|
+
display: flex;
|
|
146
|
+
pointer-events: none;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.simple-phone-input-sri198-search-icon svg {
|
|
150
|
+
font-size: 20px;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.simple-phone-input-sri198-not-found {
|
|
154
|
+
text-align: center;
|
|
155
|
+
margin-top: 10px;
|
|
156
|
+
font-size: 15px;
|
|
157
|
+
color: #f73131;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.simple-phone-input-sri198-search-container input:focus {
|
|
161
|
+
outline: none;
|
|
162
|
+
}
|
package/package.json
CHANGED