ngxsmk-tel-input 1.6.9 → 1.6.10

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 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/formatting.
4
- Wraps [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input) for the UI and [`libphonenumber-js`](https://github.com/catamphetamine/libphonenumber-js) for parsing/validation. Implements `ControlValueAccessor` so it plugs into Angular Forms.
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
- ## 🚀 Try it live on StackBlitz
8
+ ## Try it live on StackBlitz
9
9
 
10
10
  [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/~/github.com/toozuuu/ngxsmk-tel-input)
11
11
 
12
12
  ---
13
13
 
14
- ##Features
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**: Comprehensive theme system with automatic system preference detection
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
- ##Requirements
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
- ## 📦 Install
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
- ## 🚀 Quick start (Reactive Forms)
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
- ## 📝 Template‑driven usage
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
- ## 🈺 Localization & RTL
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
- ## ⚙️ API
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
- ## 🧠 Formatting & validity behavior
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
- ## 🎨 Theming
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
- ## ✔️ Validation patterns
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
- ## 🌐 SSR notes
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
- ## 🧪 Local development
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
- ## 🧯 Troubleshooting
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
- ## 📃 License
422
+ ## License
411
423
 
412
424
  [MIT](./LICENSE)
413
425
 
414
- ## 🙌 Credits
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: 2025-01-21
431
+ Last updated: 2026-05-01