ngxsmk-tel-input 1.0.7 → 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 CHANGED
@@ -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 { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
94
- import { NgxsmkTelInputComponent } from 'ngxsmk-tel-input';
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 = this.fb.group({ phone: ['', Validators.required] });
121
- constructor(private readonly fb: FormBuilder) {}
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,6 +1,6 @@
1
1
  {
2
2
  "name": "ngxsmk-tel-input",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Angular international telephone input with country flag dropdown, formatting & validation (intl-tel-input + libphonenumber). ControlValueAccessor. Supports Angular 17–19.",
5
5
  "keywords": [
6
6
  "angular",
@@ -32,12 +32,12 @@ type IntlTelInstance = any;
32
32
  standalone: true,
33
33
  imports: [],
34
34
  template: `
35
- <div class="ngx-tel" [class.disabled]="disabled" [attr.data-size]="size" [attr.data-variant]="variant">
35
+ <div class="ngxsmk-tel" [class.disabled]="disabled" [attr.data-size]="size" [attr.data-variant]="variant">
36
36
  @if (label) {
37
- <label class="ngx-tel__label" [for]="resolvedId">{{ label }}</label>
37
+ <label class="ngxsmk-tel__label" [for]="resolvedId">{{ label }}</label>
38
38
  }
39
39
 
40
- <div class="ngx-tel__wrap" [class.has-error]="showError">
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="ngx-tel__clear"
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="ngx-tel__hint">{{ hint }}</div>
69
+ <div class="ngxsmk-tel__hint">{{ hint }}</div>
70
70
  }
71
71
 
72
72
  @if (showError) {
73
- <div class="ngx-tel__error">{{ errorText || 'Please enter a valid phone number.' }}</div>
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
- .ngx-tel {
122
+ .ngxsmk-tel {
123
123
  width: 100%;
124
124
  color: var(--tel-fg);
125
125
  }
126
126
 
127
- .ngx-tel.disabled {
127
+ .ngxsmk-tel.disabled {
128
128
  opacity: .7;
129
129
  cursor: not-allowed;
130
130
  }
131
131
 
132
- .ngx-tel__label {
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
- .ngx-tel__wrap {
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
- .ngx-tel__clear {
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
- .ngx-tel__clear:hover {
344
+ .ngxsmk-tel__clear:hover {
345
345
  background: rgba(148, 163, 184, .15);
346
346
  }
347
347
 
348
348
  /* Hint & Error */
349
- .ngx-tel__hint {
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
- .ngx-tel__error {
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
- .ngx-tel__wrap.has-error .ngxsmk-tel-input__control {
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
  }