ngxsmk-tel-input 1.0.6 → 1.0.8
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 +15 -12
- package/package.json +36 -3
- package/src/lib/ngxsmk-tel-input.component.ts +15 -15
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/ng-package.json +0 -16
- package/tsconfig.lib.json +0 -13
- package/tsconfig.lib.prod.json +0 -9
- package/tsconfig.spec.json +0 -13
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ An Angular component for entering and validating **international telephone numbe
|
|
|
18
18
|
## Screenshots
|
|
19
19
|
|
|
20
20
|
<p align="left">
|
|
21
|
-
<img src="https://unpkg.com/ngxsmk-tel-input@1.0.4/docs/valid.png" alt="
|
|
21
|
+
<img src="https://unpkg.com/ngxsmk-tel-input@1.0.4/docs/valid.png" alt="Angular international phone input - valid" width="420" />
|
|
22
22
|
|
|
23
|
-
<img src="https://unpkg.com/ngxsmk-tel-input@1.0.4/docs/invalid.png" alt="
|
|
23
|
+
<img src="https://unpkg.com/ngxsmk-tel-input@1.0.4/docs/invalid.png" alt="Angular international phone input - Invalid" width="420" />
|
|
24
24
|
</p>
|
|
25
25
|
|
|
26
26
|
---
|
|
@@ -90,13 +90,14 @@ Restart your dev server after editing `angular.json`.
|
|
|
90
90
|
```ts
|
|
91
91
|
// app.component.ts
|
|
92
92
|
import { Component } from '@angular/core';
|
|
93
|
-
import {
|
|
94
|
-
import {
|
|
93
|
+
import { ReactiveFormsModule, FormBuilder, Validators, FormGroup } from '@angular/forms';
|
|
94
|
+
import { CommonModule } from '@angular/common';
|
|
95
|
+
import { NgxsmkTelInputComponent } from '../../../ngxsmk-tel-input/src/lib/ngxsmk-tel-input.component';
|
|
95
96
|
|
|
96
97
|
@Component({
|
|
97
98
|
selector: 'app-root',
|
|
98
99
|
standalone: true,
|
|
99
|
-
imports: [ReactiveFormsModule, NgxsmkTelInputComponent],
|
|
100
|
+
imports: [ReactiveFormsModule, CommonModule, NgxsmkTelInputComponent],
|
|
100
101
|
template: `
|
|
101
102
|
<form [formGroup]="fg" style="max-width:420px;display:grid;gap:12px">
|
|
102
103
|
<ngxsmk-tel-input
|
|
@@ -107,19 +108,21 @@ import { NgxsmkTelInputComponent } from 'ngxsmk-tel-input';
|
|
|
107
108
|
[preferredCountries]="['US','GB','AU']"
|
|
108
109
|
(countryChange)="onCountry($event)">
|
|
109
110
|
</ngxsmk-tel-input>
|
|
110
|
-
|
|
111
|
-
<p *ngIf="fg.get('phone')?.hasError('phoneInvalid') && fg.get('phone')?.touched">
|
|
112
|
-
Please enter a valid phone number.
|
|
113
|
-
</p>
|
|
114
|
-
|
|
115
111
|
<pre>Value: {{ fg.value | json }}</pre>
|
|
116
112
|
</form>
|
|
117
113
|
`
|
|
118
114
|
})
|
|
119
115
|
export class AppComponent {
|
|
120
|
-
fg
|
|
121
|
-
|
|
116
|
+
fg: FormGroup;
|
|
117
|
+
|
|
118
|
+
constructor(private readonly fb: FormBuilder) {
|
|
119
|
+
this.fg = this.fb.group({
|
|
120
|
+
phone: ['', Validators.required]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
122
124
|
onCountry(e: { iso2: any }) { console.log('Country changed:', e.iso2); }
|
|
125
|
+
|
|
123
126
|
}
|
|
124
127
|
```
|
|
125
128
|
|
package/package.json
CHANGED
|
@@ -1,18 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ngxsmk-tel-input",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
|
+
"description": "Angular international telephone input with country flag dropdown, formatting & validation (intl-tel-input + libphonenumber). ControlValueAccessor. Supports Angular 17–19.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"angular",
|
|
7
|
+
"angular-forms",
|
|
8
|
+
"controlvalueaccessor",
|
|
9
|
+
"phone-input",
|
|
10
|
+
"telephone",
|
|
11
|
+
"tel-input",
|
|
12
|
+
"international",
|
|
13
|
+
"intl-tel-input",
|
|
14
|
+
"libphonenumber",
|
|
15
|
+
"e164",
|
|
16
|
+
"phone-number-validation",
|
|
17
|
+
"country-flag"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https://github.com/toozuuu/ngxsmk-tel-input#readme",
|
|
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
|
+
},
|
|
4
27
|
"author": {
|
|
5
|
-
"email": "sachindilshan040@gmail.com",
|
|
6
28
|
"name": "Sachin Dilshan",
|
|
29
|
+
"email": "sachindilshan040@gmail.com",
|
|
7
30
|
"url": "https://www.linkedin.com/in/sachindilshan"
|
|
8
31
|
},
|
|
9
|
-
"description": "Angular telephone input with intl-tel-input + libphonenumber-js",
|
|
10
32
|
"license": "MIT",
|
|
11
33
|
"private": false,
|
|
12
34
|
"sideEffects": false,
|
|
13
35
|
"publishConfig": {
|
|
14
36
|
"access": "public"
|
|
15
37
|
},
|
|
38
|
+
"files": [
|
|
39
|
+
"bundles/",
|
|
40
|
+
"fesm*",
|
|
41
|
+
"esm*",
|
|
42
|
+
"schematics/",
|
|
43
|
+
"migrations/",
|
|
44
|
+
"src/",
|
|
45
|
+
"README.md",
|
|
46
|
+
"LICENSE",
|
|
47
|
+
"docs/"
|
|
48
|
+
],
|
|
16
49
|
"peerDependencies": {
|
|
17
50
|
"@angular/common": ">=17",
|
|
18
51
|
"@angular/core": ">=17",
|
|
@@ -32,12 +32,12 @@ type IntlTelInstance = any;
|
|
|
32
32
|
standalone: true,
|
|
33
33
|
imports: [],
|
|
34
34
|
template: `
|
|
35
|
-
<div class="
|
|
35
|
+
<div class="ngxsmk-tel" [class.disabled]="disabled" [attr.data-size]="size" [attr.data-variant]="variant">
|
|
36
36
|
@if (label) {
|
|
37
|
-
<label class="
|
|
37
|
+
<label class="ngxsmk-tel__label" [for]="resolvedId">{{ label }}</label>
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
<div class="
|
|
40
|
+
<div class="ngxsmk-tel__wrap" [class.has-error]="showError">
|
|
41
41
|
<div class="ngxsmk-tel-input__wrapper">
|
|
42
42
|
<input
|
|
43
43
|
#telInput
|
|
@@ -56,7 +56,7 @@ type IntlTelInstance = any;
|
|
|
56
56
|
|
|
57
57
|
@if (showClear && currentRaw()) {
|
|
58
58
|
<button type="button"
|
|
59
|
-
class="
|
|
59
|
+
class="ngxsmk-tel__clear"
|
|
60
60
|
(click)="clearInput()"
|
|
61
61
|
[attr.aria-label]="'Clear phone number'">
|
|
62
62
|
×
|
|
@@ -66,11 +66,11 @@ type IntlTelInstance = any;
|
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
68
|
@if (hint && !showError) {
|
|
69
|
-
<div class="
|
|
69
|
+
<div class="ngxsmk-tel__hint">{{ hint }}</div>
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
@if (showError) {
|
|
73
|
-
<div class="
|
|
73
|
+
<div class="ngxsmk-tel__error">{{ errorText || 'Please enter a valid phone number.' }}</div>
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
</div>
|
|
@@ -119,24 +119,24 @@ type IntlTelInstance = any;
|
|
|
119
119
|
}
|
|
120
120
|
|
|
121
121
|
/* ---------- Structure ---------- */
|
|
122
|
-
.
|
|
122
|
+
.ngxsmk-tel {
|
|
123
123
|
width: 100%;
|
|
124
124
|
color: var(--tel-fg);
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.
|
|
127
|
+
.ngxsmk-tel.disabled {
|
|
128
128
|
opacity: .7;
|
|
129
129
|
cursor: not-allowed;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
.
|
|
132
|
+
.ngxsmk-tel__label {
|
|
133
133
|
display: inline-block;
|
|
134
134
|
margin-bottom: 6px;
|
|
135
135
|
font-size: .875rem;
|
|
136
136
|
font-weight: 500;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
.
|
|
139
|
+
.ngxsmk-tel__wrap {
|
|
140
140
|
position: relative;
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -325,7 +325,7 @@ type IntlTelInstance = any;
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
/* Clear button */
|
|
328
|
-
.
|
|
328
|
+
.ngxsmk-tel__clear {
|
|
329
329
|
position: absolute;
|
|
330
330
|
right: 8px;
|
|
331
331
|
top: 50%;
|
|
@@ -341,24 +341,24 @@ type IntlTelInstance = any;
|
|
|
341
341
|
color: var(--tel-placeholder);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
.
|
|
344
|
+
.ngxsmk-tel__clear:hover {
|
|
345
345
|
background: rgba(148, 163, 184, .15);
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
/* Hint & Error */
|
|
349
|
-
.
|
|
349
|
+
.ngxsmk-tel__hint {
|
|
350
350
|
margin-top: 6px;
|
|
351
351
|
font-size: 12px;
|
|
352
352
|
color: var(--tel-placeholder);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
.
|
|
355
|
+
.ngxsmk-tel__error {
|
|
356
356
|
margin-top: 6px;
|
|
357
357
|
font-size: 12px;
|
|
358
358
|
color: var(--tel-error);
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
.
|
|
361
|
+
.ngxsmk-tel__wrap.has-error .ngxsmk-tel-input__control {
|
|
362
362
|
border-color: var(--tel-error);
|
|
363
363
|
box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
|
|
364
364
|
}
|
package/.changeset/README.md
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# Changesets
|
|
2
|
-
|
|
3
|
-
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
|
|
4
|
-
with multi-package repos, or single-package repos to help you version and publish your code. You can
|
|
5
|
-
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
|
|
6
|
-
|
|
7
|
-
We have a quick list of common questions to get you started engaging with this project in
|
|
8
|
-
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
|
package/.changeset/config.json
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
|
|
3
|
-
"changelog": "@changesets/cli/changelog",
|
|
4
|
-
"commit": false,
|
|
5
|
-
"fixed": [],
|
|
6
|
-
"linked": [],
|
|
7
|
-
"access": "restricted",
|
|
8
|
-
"baseBranch": "main",
|
|
9
|
-
"updateInternalDependencies": "patch",
|
|
10
|
-
"ignore": []
|
|
11
|
-
}
|
package/ng-package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
|
|
3
|
-
"dest": "../../dist/ngxsmk-tel-input",
|
|
4
|
-
"lib": {
|
|
5
|
-
"entryFile": "src/public-api.ts"
|
|
6
|
-
},
|
|
7
|
-
"allowedNonPeerDependencies": [
|
|
8
|
-
"intl-tel-input",
|
|
9
|
-
"libphonenumber-js"
|
|
10
|
-
],
|
|
11
|
-
"assets": [
|
|
12
|
-
"README.md",
|
|
13
|
-
"LICENSE",
|
|
14
|
-
"docs"
|
|
15
|
-
]
|
|
16
|
-
}
|
package/tsconfig.lib.json
DELETED
package/tsconfig.lib.prod.json
DELETED