ngxsmk-tel-input 0.0.3 → 0.0.5
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/.editorconfig +17 -0
- package/.vscode/extensions.json +4 -0
- package/.vscode/launch.json +20 -0
- package/.vscode/tasks.json +42 -0
- package/README.md +264 -32
- package/angular.json +40 -0
- package/package.json +68 -23
- package/projects/ngxsmk-tel-input/README.md +63 -0
- package/projects/ngxsmk-tel-input/dist/README.md +63 -0
- package/projects/ngxsmk-tel-input/dist/fesm2022/ngxsmk-tel-input.mjs.map +1 -0
- package/projects/ngxsmk-tel-input/ng-package.json +5 -0
- package/projects/ngxsmk-tel-input/package.json +22 -0
- package/projects/ngxsmk-tel-input/src/lib/ngxsmk-tel-input.component.spec.ts +23 -0
- package/projects/ngxsmk-tel-input/src/lib/ngxsmk-tel-input.component.ts +279 -0
- package/projects/ngxsmk-tel-input/src/lib/ngxsmk-tel-input.service.spec.ts +16 -0
- package/projects/ngxsmk-tel-input/src/lib/ngxsmk-tel-input.service.ts +116 -0
- package/projects/ngxsmk-tel-input/src/public-api.ts +6 -0
- package/projects/ngxsmk-tel-input/tsconfig.lib.json +13 -0
- package/projects/ngxsmk-tel-input/tsconfig.lib.prod.json +9 -0
- package/projects/ngxsmk-tel-input/tsconfig.spec.json +13 -0
- package/tsconfig.json +30 -0
- package/fesm2022/ngxsmk-tel-input.mjs.map +0 -1
- /package/{fesm2022 → projects/ngxsmk-tel-input/dist/fesm2022}/ngxsmk-tel-input.mjs +0 -0
- /package/{index.d.ts → projects/ngxsmk-tel-input/dist/index.d.ts} +0 -0
- /package/{lib → projects/ngxsmk-tel-input/dist/lib}/ngxsmk-tel-input.component.d.ts +0 -0
- /package/{lib → projects/ngxsmk-tel-input/dist/lib}/ngxsmk-tel-input.service.d.ts +0 -0
- /package/{public-api.d.ts → projects/ngxsmk-tel-input/dist/public-api.d.ts} +0 -0
package/.editorconfig
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Editor configuration, see https://editorconfig.org
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
indent_style = space
|
|
7
|
+
indent_size = 2
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = true
|
|
10
|
+
|
|
11
|
+
[*.ts]
|
|
12
|
+
quote_type = single
|
|
13
|
+
ij_typescript_use_double_quotes = false
|
|
14
|
+
|
|
15
|
+
[*.md]
|
|
16
|
+
max_line_length = off
|
|
17
|
+
trim_trailing_whitespace = false
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"configurations": [
|
|
5
|
+
{
|
|
6
|
+
"name": "ng serve",
|
|
7
|
+
"type": "chrome",
|
|
8
|
+
"request": "launch",
|
|
9
|
+
"preLaunchTask": "npm: start",
|
|
10
|
+
"url": "http://localhost:4200/"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"name": "ng test",
|
|
14
|
+
"type": "chrome",
|
|
15
|
+
"request": "launch",
|
|
16
|
+
"preLaunchTask": "npm: test",
|
|
17
|
+
"url": "http://localhost:9876/debug.html"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"tasks": [
|
|
5
|
+
{
|
|
6
|
+
"type": "npm",
|
|
7
|
+
"script": "start",
|
|
8
|
+
"isBackground": true,
|
|
9
|
+
"problemMatcher": {
|
|
10
|
+
"owner": "typescript",
|
|
11
|
+
"pattern": "$tsc",
|
|
12
|
+
"background": {
|
|
13
|
+
"activeOnStart": true,
|
|
14
|
+
"beginsPattern": {
|
|
15
|
+
"regexp": "(.*?)"
|
|
16
|
+
},
|
|
17
|
+
"endsPattern": {
|
|
18
|
+
"regexp": "bundle generation complete"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "npm",
|
|
25
|
+
"script": "test",
|
|
26
|
+
"isBackground": true,
|
|
27
|
+
"problemMatcher": {
|
|
28
|
+
"owner": "typescript",
|
|
29
|
+
"pattern": "$tsc",
|
|
30
|
+
"background": {
|
|
31
|
+
"activeOnStart": true,
|
|
32
|
+
"beginsPattern": {
|
|
33
|
+
"regexp": "(.*?)"
|
|
34
|
+
},
|
|
35
|
+
"endsPattern": {
|
|
36
|
+
"regexp": "bundle generation complete"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
package/README.md
CHANGED
|
@@ -1,63 +1,295 @@
|
|
|
1
|
-
#
|
|
1
|
+
# ngxsmk-tel-input
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
An Angular **telephone input** component with country dropdown, flag icons, and robust validation/formatting.
|
|
4
|
+
Wraps [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input) for UI and uses [`libphonenumber-js`](https://github.com/catamphetamine/libphonenumber-js) for parsing & validation. Implements `ControlValueAccessor` so it plugs right into Angular Forms.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
> Emits E.164 numbers by default (e.g., `+14155550123`). SSR-safe via lazy imports.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
* ✅ Country dropdown with flags
|
|
13
|
+
* ✅ E.164 output (configurable for national numbers)
|
|
14
|
+
* ✅ Works with Reactive/Template-driven Forms (`ControlValueAccessor`)
|
|
15
|
+
* ✅ Built-in validation (uses `libphonenumber-js`)
|
|
16
|
+
* ✅ SSR-friendly (lazy `intl-tel-input` import)
|
|
17
|
+
* ✅ Tiny API surface, easy to theme
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
22
|
+
|
|
23
|
+
* Angular **17+**
|
|
24
|
+
* Node **18+** / **20+**
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Install
|
|
8
29
|
|
|
9
30
|
```bash
|
|
10
|
-
|
|
31
|
+
# your app
|
|
32
|
+
npm i ngxsmk-tel-input intl-tel-input libphonenumber-js
|
|
11
33
|
```
|
|
12
34
|
|
|
13
|
-
|
|
35
|
+
### Add styles & assets
|
|
14
36
|
|
|
15
|
-
|
|
16
|
-
|
|
37
|
+
`intl-tel-input` ships its own CSS and flag images. Add them to your app’s `angular.json`:
|
|
38
|
+
|
|
39
|
+
```jsonc
|
|
40
|
+
{
|
|
41
|
+
"projects": {
|
|
42
|
+
"your-app": {
|
|
43
|
+
"architect": {
|
|
44
|
+
"build": {
|
|
45
|
+
"options": {
|
|
46
|
+
"styles": [
|
|
47
|
+
"node_modules/intl-tel-input/build/css/intlTelInput.css"
|
|
48
|
+
],
|
|
49
|
+
"assets": [
|
|
50
|
+
{
|
|
51
|
+
"glob": "**/*",
|
|
52
|
+
"input": "node_modules/intl-tel-input/build/img",
|
|
53
|
+
"output": "assets/intl-tel-input/img"
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
17
62
|
```
|
|
18
63
|
|
|
19
|
-
|
|
64
|
+
> If you use a custom builder, copy the flags folder to `/assets/intl-tel-input/img`.
|
|
20
65
|
|
|
21
|
-
|
|
66
|
+
---
|
|
22
67
|
|
|
23
|
-
|
|
24
|
-
|
|
68
|
+
## Quick start (Reactive Forms)
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
// app.component.ts
|
|
72
|
+
import { Component } from '@angular/core';
|
|
73
|
+
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
74
|
+
import { TelInputComponent } from 'ngxsmk-tel-input';
|
|
75
|
+
|
|
76
|
+
@Component({
|
|
77
|
+
selector: 'app-root',
|
|
78
|
+
standalone: true,
|
|
79
|
+
imports: [ReactiveFormsModule, TelInputComponent],
|
|
80
|
+
template: `
|
|
81
|
+
<form [formGroup]="fg" class="space-y-3">
|
|
82
|
+
<label for="phone">Phone</label>
|
|
83
|
+
<ngxsmk-tel-input
|
|
84
|
+
id="phone"
|
|
85
|
+
formControlName="phone"
|
|
86
|
+
[initialCountry]="'US'"
|
|
87
|
+
[preferredCountries]="['US','GB','AU']"
|
|
88
|
+
(countryChange)="onCountry($event)">
|
|
89
|
+
</ngxsmk-tel-input>
|
|
90
|
+
|
|
91
|
+
<p *ngIf="fg.get('phone')?.hasError('phoneInvalid') && fg.get('phone')?.touched">
|
|
92
|
+
Please enter a valid phone number.
|
|
93
|
+
</p>
|
|
94
|
+
|
|
95
|
+
<pre>Value: {{ fg.value | json }}</pre>
|
|
96
|
+
</form>
|
|
97
|
+
`
|
|
98
|
+
})
|
|
99
|
+
export class AppComponent {
|
|
100
|
+
fg = this.fb.group({
|
|
101
|
+
phone: ['', Validators.required] // control value will be E.164 string or null
|
|
102
|
+
});
|
|
103
|
+
constructor(private fb: FormBuilder) {}
|
|
104
|
+
onCountry(e: { iso2: any }) { console.log('Country changed:', e.iso2); }
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Result:** `form.get('phone')?.value` → `'+14155550123'` (E.164) when valid, or `null` while empty/invalid.
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Template-driven usage
|
|
113
|
+
|
|
114
|
+
```html
|
|
115
|
+
<form #f="ngForm">
|
|
116
|
+
<ngxsmk-tel-input name="phone" [(ngModel)]="phone"></ngxsmk-tel-input>
|
|
117
|
+
</form>
|
|
118
|
+
|
|
119
|
+
<!-- phone is a string (E.164) or null -->
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## API
|
|
125
|
+
|
|
126
|
+
### Inputs
|
|
127
|
+
|
|
128
|
+
| Name | Type | Default | Description |
|
|
129
|
+
| -------------------- | ----------------------- | ---------------------- | --------------------------------------------------- |
|
|
130
|
+
| `initialCountry` | `CountryCode \| 'auto'` | `'auto'` | Starting country. `'auto'` uses the plugin default. |
|
|
131
|
+
| `preferredCountries` | `CountryCode[]` | `['US','GB']` | Pinned countries at the top. |
|
|
132
|
+
| `onlyCountries` | `CountryCode[]` | `undefined` | Restrict selectable countries. |
|
|
133
|
+
| `nationalMode` | `boolean` | `false` | If `true`, emits national numbers; otherwise E.164. |
|
|
134
|
+
| `placeholder` | `string` | `'Enter phone number'` | Input placeholder. |
|
|
135
|
+
| `autocomplete` | `string` | `'tel'` | Native autocomplete attribute. |
|
|
136
|
+
| `disabled` | `boolean` | `false` | Disables the input. |
|
|
137
|
+
|
|
138
|
+
> `CountryCode` is the ISO-2 uppercase code from `libphonenumber-js` (e.g., `US`, `GB`, `AU`).
|
|
139
|
+
|
|
140
|
+
### Outputs
|
|
141
|
+
|
|
142
|
+
| Event | Payload | Description |
|
|
143
|
+
| --------------- | ----------------------- | ---------------------------------------- |
|
|
144
|
+
| `countryChange` | `{ iso2: CountryCode }` | Fires when the selected country changes. |
|
|
145
|
+
|
|
146
|
+
### Value semantics
|
|
147
|
+
|
|
148
|
+
* **When valid:** emits **E.164** string (e.g., `+33123456789`) unless `nationalMode` is `true`.
|
|
149
|
+
* **When empty or invalid:** emits `null`.
|
|
150
|
+
* **Validation:** adds `phoneInvalid` error key when the input cannot be parsed as a valid number for the selected country.
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Validation examples
|
|
155
|
+
|
|
156
|
+
```html
|
|
157
|
+
<ngxsmk-tel-input formControlName="phone"></ngxsmk-tel-input>
|
|
158
|
+
|
|
159
|
+
<div class="error" *ngIf="fg.get('phone')?.hasError('required')">
|
|
160
|
+
Phone is required
|
|
161
|
+
</div>
|
|
162
|
+
<div class="error" *ngIf="fg.get('phone')?.hasError('phoneInvalid')">
|
|
163
|
+
Please enter a valid phone number
|
|
164
|
+
</div>
|
|
25
165
|
```
|
|
26
166
|
|
|
27
|
-
|
|
167
|
+
---
|
|
28
168
|
|
|
29
|
-
|
|
169
|
+
## Accessibility
|
|
30
170
|
|
|
31
|
-
|
|
171
|
+
* Pair with a `<label for="phone">` or wrap the input and label together.
|
|
172
|
+
* The country dropdown is keyboard navigable (via `intl-tel-input`).
|
|
173
|
+
* Consider additional ARIA attributes if you customize the template.
|
|
32
174
|
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
cd dist/ngxsmk-tel-input
|
|
36
|
-
```
|
|
175
|
+
---
|
|
37
176
|
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm publish
|
|
41
|
-
```
|
|
177
|
+
## Theming
|
|
42
178
|
|
|
43
|
-
|
|
179
|
+
The component applies a minimal class to the input: `.ngxsmk-tel-input`.
|
|
180
|
+
You can style it or the `intl-tel-input` container globally:
|
|
44
181
|
|
|
45
|
-
|
|
182
|
+
```css
|
|
183
|
+
.ngxsmk-tel-input {
|
|
184
|
+
width: 100%;
|
|
185
|
+
padding: 0.5rem 0.75rem;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.iti {
|
|
189
|
+
width: 100%; /* make dropdown stretch */
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
---
|
|
194
|
+
|
|
195
|
+
## SSR notes
|
|
196
|
+
|
|
197
|
+
This library lazily imports `intl-tel-input` **only in the browser**.
|
|
198
|
+
No special setup required for Angular Universal. If you still see SSR errors, ensure you’re not referencing `window` in your own wrappers.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Troubleshooting
|
|
203
|
+
|
|
204
|
+
* **No flags / broken images**
|
|
205
|
+
Ensure `angular.json` asset mapping is present and that the output path matches your app’s `/assets` directory.
|
|
206
|
+
|
|
207
|
+
* **Styles not applied**
|
|
208
|
+
Add `"node_modules/intl-tel-input/build/css/intlTelInput.css"` to the `styles` array in `angular.json`.
|
|
209
|
+
|
|
210
|
+
* **Form value doesn’t update**
|
|
211
|
+
Use Angular Forms APIs (Reactive or Template-driven). For Reactive Forms, confirm the control is bound via `formControlName` and that `ReactiveFormsModule` is imported.
|
|
212
|
+
|
|
213
|
+
* **Always invalid**
|
|
214
|
+
Some numbers are only valid with the correct country selected. Try typing with the `+` international prefix or set `initialCountry` appropriately.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Example: national mode
|
|
219
|
+
|
|
220
|
+
```html
|
|
221
|
+
<ngxsmk-tel-input formControlName="phone" [nationalMode]="true" [initialCountry]="'GB'"></ngxsmk-tel-input>
|
|
222
|
+
<!-- Value will be a national format string like '020 7946 0958' with validation tied to the selected country -->
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
> When using `nationalMode=true`, you’ll typically store the country code alongside the value, using `(countryChange)`.
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Development
|
|
230
|
+
|
|
231
|
+
This repo is structured as an Angular workspace with a library:
|
|
46
232
|
|
|
47
233
|
```bash
|
|
48
|
-
|
|
234
|
+
# Build the library
|
|
235
|
+
ng build ngxsmk-tel-input
|
|
236
|
+
|
|
237
|
+
# (Optional) create a demo app and try it locally
|
|
238
|
+
ng g application demo
|
|
239
|
+
# import TelInputComponent in your demo app and test
|
|
49
240
|
```
|
|
50
241
|
|
|
51
|
-
|
|
242
|
+
---
|
|
52
243
|
|
|
53
|
-
|
|
244
|
+
## Publish
|
|
54
245
|
|
|
55
246
|
```bash
|
|
56
|
-
|
|
247
|
+
# Bump version, then:
|
|
248
|
+
ng build ngxsmk-tel-input
|
|
249
|
+
cd dist/ngxsmk-tel-input
|
|
250
|
+
npm publish --access public
|
|
57
251
|
```
|
|
58
252
|
|
|
59
|
-
|
|
253
|
+
> Ensure `peerDependencies` in the library’s `package.json` reflect your Angular support range.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Contributing
|
|
258
|
+
|
|
259
|
+
PRs welcome! Please:
|
|
260
|
+
|
|
261
|
+
1. Run `npm ci` and `ng build`.
|
|
262
|
+
2. Add/adjust unit or e2e tests if you change behavior.
|
|
263
|
+
3. Update this README for any API changes.
|
|
60
264
|
|
|
61
|
-
|
|
265
|
+
---
|
|
62
266
|
|
|
63
|
-
|
|
267
|
+
## License
|
|
268
|
+
|
|
269
|
+
[MIT](./LICENSE)
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Credits
|
|
274
|
+
|
|
275
|
+
* UI powered by [`intl-tel-input`](https://github.com/jackocnr/intl-tel-input)
|
|
276
|
+
* Parsing/validation by [`libphonenumber-js`](https://github.com/catamphetamine/libphonenumber-js)
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
### Appendix: `angular.json` snippet (copy-paste)
|
|
281
|
+
|
|
282
|
+
```jsonc
|
|
283
|
+
{
|
|
284
|
+
"styles": [
|
|
285
|
+
"node_modules/intl-tel-input/build/css/intlTelInput.css"
|
|
286
|
+
],
|
|
287
|
+
"assets": [
|
|
288
|
+
{
|
|
289
|
+
"glob": "**/*",
|
|
290
|
+
"input": "node_modules/intl-tel-input/build/img",
|
|
291
|
+
"output": "assets/intl-tel-input/img"
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
}
|
|
295
|
+
```
|
package/angular.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"newProjectRoot": "projects",
|
|
5
|
+
"projects": {
|
|
6
|
+
"ngxsmk-tel-input": {
|
|
7
|
+
"projectType": "library",
|
|
8
|
+
"root": "projects/ngxsmk-tel-input",
|
|
9
|
+
"sourceRoot": "projects/ngxsmk-tel-input/src",
|
|
10
|
+
"prefix": "lib",
|
|
11
|
+
"architect": {
|
|
12
|
+
"build": {
|
|
13
|
+
"builder": "@angular-devkit/build-angular:ng-packagr",
|
|
14
|
+
"options": {
|
|
15
|
+
"project": "projects/ngxsmk-tel-input/ng-package.json"
|
|
16
|
+
},
|
|
17
|
+
"configurations": {
|
|
18
|
+
"production": {
|
|
19
|
+
"tsConfig": "projects/ngxsmk-tel-input/tsconfig.lib.prod.json"
|
|
20
|
+
},
|
|
21
|
+
"development": {
|
|
22
|
+
"tsConfig": "projects/ngxsmk-tel-input/tsconfig.lib.json"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"defaultConfiguration": "production"
|
|
26
|
+
},
|
|
27
|
+
"test": {
|
|
28
|
+
"builder": "@angular-devkit/build-angular:karma",
|
|
29
|
+
"options": {
|
|
30
|
+
"tsConfig": "projects/ngxsmk-tel-input/tsconfig.spec.json",
|
|
31
|
+
"polyfills": [
|
|
32
|
+
"zone.js",
|
|
33
|
+
"zone.js/testing"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,23 +1,68 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "ngxsmk-tel-input",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
},
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "ngxsmk-tel-input",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "Angular telephone input with intl-tel-input + libphonenumber-js",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Sachin Dilshan",
|
|
8
|
+
"email": "sachindilshan040@gmail.com",
|
|
9
|
+
"url": "https://github.com/toozuuu"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"angular",
|
|
13
|
+
"telephone",
|
|
14
|
+
"phone",
|
|
15
|
+
"intl-tel-input",
|
|
16
|
+
"libphonenumber",
|
|
17
|
+
"forms",
|
|
18
|
+
"controlvalueaccessor"
|
|
19
|
+
],
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/toozuuu/ngxsmk-tel-input.git"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/toozuuu/ngxsmk-tel-input/issues"
|
|
26
|
+
},
|
|
27
|
+
"homepage": "https://github.com/toozuuu/ngxsmk-tel-input#readme",
|
|
28
|
+
"private": false,
|
|
29
|
+
"sideEffects": false,
|
|
30
|
+
"publishConfig": { "access": "public" },
|
|
31
|
+
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@angular/core": ">=17",
|
|
34
|
+
"@angular/common": ">=17",
|
|
35
|
+
"@angular/forms": ">=17",
|
|
36
|
+
"rxjs": ">=7.8.0"
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"intl-tel-input": "^25.3.2",
|
|
41
|
+
"libphonenumber-js": "^1.12.10",
|
|
42
|
+
"tslib": "^2.3.0"
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@angular-devkit/build-angular": "^19.2.15",
|
|
47
|
+
"@angular/cli": "^19.2.8",
|
|
48
|
+
"@angular/compiler": "^19.2.0",
|
|
49
|
+
"@angular/compiler-cli": "^19.2.0",
|
|
50
|
+
"@types/intl-tel-input": "^18.1.4",
|
|
51
|
+
"ng-packagr": "^19.2.0",
|
|
52
|
+
"typescript": "~5.7.2",
|
|
53
|
+
"zone.js": "~0.15.0",
|
|
54
|
+
"@types/jasmine": "~5.1.0",
|
|
55
|
+
"jasmine-core": "~5.6.0",
|
|
56
|
+
"karma": "~6.4.0",
|
|
57
|
+
"karma-chrome-launcher": "~3.2.0",
|
|
58
|
+
"karma-coverage": "~2.2.0",
|
|
59
|
+
"karma-jasmine": "~5.1.0",
|
|
60
|
+
"karma-jasmine-html-reporter": "~2.1.0"
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "ng build ngxsmk-tel-input",
|
|
65
|
+
"watch": "ng build ngxsmk-tel-input --watch --configuration development",
|
|
66
|
+
"test": "ng test"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# ngxsmkTelInput
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build ngxsmk-tel-input
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/ngxsmk-tel-input
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# ngxsmkTelInput
|
|
2
|
+
|
|
3
|
+
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 19.2.0.
|
|
4
|
+
|
|
5
|
+
## Code scaffolding
|
|
6
|
+
|
|
7
|
+
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
ng generate component component-name
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
ng generate --help
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Building
|
|
20
|
+
|
|
21
|
+
To build the library, run:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
ng build ngxsmk-tel-input
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This command will compile your project, and the build artifacts will be placed in the `dist/` directory.
|
|
28
|
+
|
|
29
|
+
### Publishing the Library
|
|
30
|
+
|
|
31
|
+
Once the project is built, you can publish your library by following these steps:
|
|
32
|
+
|
|
33
|
+
1. Navigate to the `dist` directory:
|
|
34
|
+
```bash
|
|
35
|
+
cd dist/ngxsmk-tel-input
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
2. Run the `npm publish` command to publish your library to the npm registry:
|
|
39
|
+
```bash
|
|
40
|
+
npm publish
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Running unit tests
|
|
44
|
+
|
|
45
|
+
To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
ng test
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Running end-to-end tests
|
|
52
|
+
|
|
53
|
+
For end-to-end (e2e) testing, run:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
ng e2e
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
|
|
60
|
+
|
|
61
|
+
## Additional Resources
|
|
62
|
+
|
|
63
|
+
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
|