ngxsmk-tel-input 1.6.9 → 1.6.11
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/LICENSE +21 -0
- package/README.md +32 -20
- package/fesm2022/ngxsmk-tel-input.mjs +287 -223
- package/fesm2022/ngxsmk-tel-input.mjs.map +1 -1
- package/lib/ngxsmk-tel-input.component.d.ts +24 -14
- package/lib/ngxsmk-tel-input.component.d.ts.map +1 -1
- package/lib/phone-intelligence.service.d.ts.map +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sachin Dilshan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# ngxsmk-tel-input
|
|
2
2
|
|
|
3
|
-
An Angular **telephone input** component with country dropdown, flags, and robust validation
|
|
4
|
-
|
|
3
|
+
An Angular **phone input / telephone input** component with country dropdown, flags, international formatting, and robust validation.
|
|
4
|
+
Built on top of [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input) + [`libphonenumber-js`](https://github.com/catamphetamine/libphonenumber-js), and fully compatible with Angular Reactive Forms and template-driven forms through `ControlValueAccessor`.
|
|
5
5
|
|
|
6
6
|
> Emits **E.164** by default (e.g. `+14155550123`). SSR‑safe via lazy browser‑only import.
|
|
7
7
|
|
|
8
|
-
##
|
|
8
|
+
## Try it live on StackBlitz
|
|
9
9
|
|
|
10
10
|
[](https://stackblitz.com/~/github.com/toozuuu/ngxsmk-tel-input)
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
##
|
|
14
|
+
## Features
|
|
15
15
|
|
|
16
16
|
* Country dropdown with flags
|
|
17
17
|
* E.164 output (display can be national with `nationalMode`)
|
|
@@ -19,7 +19,7 @@ Wraps [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input) for the UI
|
|
|
19
19
|
* Built‑in validation using libphonenumber‑js
|
|
20
20
|
* **Enhanced validation**: Detects invalid country codes (like "11", "99") and shows appropriate error states
|
|
21
21
|
* **Mobile responsive**: Optimized for touch devices with proper tap targets, prevents iOS zoom, and responsive dropdown
|
|
22
|
-
* **Dark & Light themes**:
|
|
22
|
+
* **Dark & Light themes**: Improved dark-mode contrast, consistent code/readout colors, and automatic system preference detection
|
|
23
23
|
* **Accessibility**: Full ARIA support, screen reader compatibility, keyboard navigation
|
|
24
24
|
* SSR‑friendly (no `window` on the server)
|
|
25
25
|
* Easy theming via CSS variables
|
|
@@ -27,9 +27,18 @@ Wraps [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input) for the UI
|
|
|
27
27
|
* Masking & caret-friendly as-you-type formatting (optional)
|
|
28
28
|
* Format only when valid (formatWhenValid) and lock once valid (lockWhenValid) to prevent extra digits
|
|
29
29
|
|
|
30
|
+
### Demo app highlights
|
|
31
|
+
|
|
32
|
+
The workspace demo (`ng serve demo`) now includes:
|
|
33
|
+
|
|
34
|
+
* polished documentation-style layout with improved spacing and visual hierarchy
|
|
35
|
+
* responsive sidebar/header behavior for mobile and desktop
|
|
36
|
+
* cleaner dark-mode palette with better text/background contrast
|
|
37
|
+
* improved focus states and reduced-motion support for accessibility
|
|
38
|
+
|
|
30
39
|
---
|
|
31
40
|
|
|
32
|
-
##
|
|
41
|
+
## Requirements
|
|
33
42
|
|
|
34
43
|
* Angular **17+** (17, 18, 19, 20, 21+)
|
|
35
44
|
* Node **18** or **20**
|
|
@@ -38,7 +47,7 @@ Wraps [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input) for the UI
|
|
|
38
47
|
|
|
39
48
|
---
|
|
40
49
|
|
|
41
|
-
##
|
|
50
|
+
## Install
|
|
42
51
|
|
|
43
52
|
```bash
|
|
44
53
|
npm i ngxsmk-tel-input intl-tel-input libphonenumber-js
|
|
@@ -82,7 +91,7 @@ Restart the dev server after changes.
|
|
|
82
91
|
|
|
83
92
|
---
|
|
84
93
|
|
|
85
|
-
##
|
|
94
|
+
## Quick start (Reactive Forms)
|
|
86
95
|
|
|
87
96
|
```ts
|
|
88
97
|
// app.component.ts
|
|
@@ -143,7 +152,7 @@ export class AppComponent {
|
|
|
143
152
|
|
|
144
153
|
---
|
|
145
154
|
|
|
146
|
-
##
|
|
155
|
+
## Template‑driven usage
|
|
147
156
|
|
|
148
157
|
```html
|
|
149
158
|
<form #f="ngForm">
|
|
@@ -154,7 +163,7 @@ export class AppComponent {
|
|
|
154
163
|
|
|
155
164
|
---
|
|
156
165
|
|
|
157
|
-
##
|
|
166
|
+
## Localization & RTL
|
|
158
167
|
|
|
159
168
|
You can localize the dropdown/search labels and override country names.
|
|
160
169
|
|
|
@@ -204,7 +213,7 @@ Arabic + RTL example
|
|
|
204
213
|
```
|
|
205
214
|
|
|
206
215
|
|
|
207
|
-
##
|
|
216
|
+
## ️ API
|
|
208
217
|
|
|
209
218
|
### Inputs
|
|
210
219
|
|
|
@@ -250,15 +259,18 @@ Arabic + RTL example
|
|
|
250
259
|
| `countryChange` | `{ iso2: CountryCode }` | Fired when selected country changes. |
|
|
251
260
|
| `validityChange` | `boolean` | Fired when validity flips. |
|
|
252
261
|
| `inputChange` | `{ raw: string; e164: string \| null; iso2: CountryCode }` | Emitted on every keystroke. |
|
|
262
|
+
| `ready` | `void` | Emitted after plugin + listeners finish wiring (including each re-init cycle). |
|
|
253
263
|
|
|
254
264
|
### Public methods
|
|
255
265
|
|
|
256
266
|
* `focus(): void`
|
|
257
267
|
* `selectCountry(iso2: CountryCode): void`
|
|
258
268
|
|
|
269
|
+
For deterministic first render behavior, prefer setting `[initialCountry]` directly. If you call imperative APIs like `selectCountry(...)` immediately after mount, wait for `(ready)` first.
|
|
270
|
+
|
|
259
271
|
---
|
|
260
272
|
|
|
261
|
-
##
|
|
273
|
+
## Formatting & validity behavior
|
|
262
274
|
|
|
263
275
|
* No formatting while invalid. As-you-type masking only starts when the digits form a valid number for the selected country.
|
|
264
276
|
|
|
@@ -270,7 +282,7 @@ For rare patterns not covered by libphonenumber-js, the control falls back to ra
|
|
|
270
282
|
|
|
271
283
|
---
|
|
272
284
|
|
|
273
|
-
##
|
|
285
|
+
## Theming
|
|
274
286
|
|
|
275
287
|
### CSS Variables
|
|
276
288
|
|
|
@@ -324,7 +336,7 @@ Dark mode: wrap in a `.dark` parent or use `[theme]="'dark'"` — tokens adapt a
|
|
|
324
336
|
|
|
325
337
|
---
|
|
326
338
|
|
|
327
|
-
##
|
|
339
|
+
## ️ Validation patterns
|
|
328
340
|
|
|
329
341
|
```html
|
|
330
342
|
<ngxsmk-tel-input formControlName="phone"></ngxsmk-tel-input>
|
|
@@ -360,14 +372,14 @@ The component now includes enhanced validation that detects and handles various
|
|
|
360
372
|
|
|
361
373
|
---
|
|
362
374
|
|
|
363
|
-
##
|
|
375
|
+
## SSR notes
|
|
364
376
|
|
|
365
377
|
* The library lazy‑imports `intl-tel-input` only in the **browser** (guards with `isPlatformBrowser`).
|
|
366
378
|
* No `window`/`document` usage on the server path.
|
|
367
379
|
|
|
368
380
|
---
|
|
369
381
|
|
|
370
|
-
##
|
|
382
|
+
## Local development
|
|
371
383
|
|
|
372
384
|
This repo is an Angular workspace with a library.
|
|
373
385
|
|
|
@@ -388,7 +400,7 @@ npm i ../path-to-workspace/dist/ngxsmk-tel-input/ngxsmk-tel-input-<version>.tgz
|
|
|
388
400
|
|
|
389
401
|
---
|
|
390
402
|
|
|
391
|
-
##
|
|
403
|
+
## Troubleshooting
|
|
392
404
|
|
|
393
405
|
**UI looks unstyled / bullets in dropdown**
|
|
394
406
|
Add the CSS and assets in `angular.json` (see Install). Restart the dev server.
|
|
@@ -407,13 +419,13 @@ Clear `.angular/cache`, rebuild the lib, and restart `ng serve`.
|
|
|
407
419
|
|
|
408
420
|
---
|
|
409
421
|
|
|
410
|
-
##
|
|
422
|
+
## License
|
|
411
423
|
|
|
412
424
|
[MIT](./LICENSE)
|
|
413
425
|
|
|
414
|
-
##
|
|
426
|
+
## Credits
|
|
415
427
|
|
|
416
428
|
* UI powered by [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input)
|
|
417
429
|
* Parsing & validation by [`libphonenumber-js`](https://github.com/catamphetamine/libphonenumber-js)
|
|
418
430
|
|
|
419
|
-
Last updated:
|
|
431
|
+
Last updated: 2026-05-01
|