@onemrvapublic/design-system 20.6.3-develop.4 → 20.7.0

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.
Files changed (100) hide show
  1. package/fesm2022/onemrvapublic-design-system-flag-icon.mjs +3 -3
  2. package/fesm2022/onemrvapublic-design-system-flag-icon.mjs.map +1 -1
  3. package/fesm2022/onemrvapublic-design-system-jsonform-renderers.mjs +614 -0
  4. package/fesm2022/onemrvapublic-design-system-jsonform-renderers.mjs.map +1 -0
  5. package/fesm2022/onemrvapublic-design-system-layout.mjs +58 -58
  6. package/fesm2022/onemrvapublic-design-system-layout.mjs.map +1 -1
  7. package/fesm2022/onemrvapublic-design-system-mat-address.mjs +3 -3
  8. package/fesm2022/onemrvapublic-design-system-mat-address.mjs.map +1 -1
  9. package/fesm2022/onemrvapublic-design-system-mat-avatar.mjs +7 -7
  10. package/fesm2022/onemrvapublic-design-system-mat-avatar.mjs.map +1 -1
  11. package/fesm2022/onemrvapublic-design-system-mat-breadcrumb.mjs +10 -10
  12. package/fesm2022/onemrvapublic-design-system-mat-breadcrumb.mjs.map +1 -1
  13. package/fesm2022/onemrvapublic-design-system-mat-carousel.mjs +6 -6
  14. package/fesm2022/onemrvapublic-design-system-mat-carousel.mjs.map +1 -1
  15. package/fesm2022/onemrvapublic-design-system-mat-choice-chip.mjs +3 -3
  16. package/fesm2022/onemrvapublic-design-system-mat-choice-chip.mjs.map +1 -1
  17. package/fesm2022/onemrvapublic-design-system-mat-copy-to-clipboard.mjs +3 -3
  18. package/fesm2022/onemrvapublic-design-system-mat-copy-to-clipboard.mjs.map +1 -1
  19. package/fesm2022/onemrvapublic-design-system-mat-country-item.mjs +3 -3
  20. package/fesm2022/onemrvapublic-design-system-mat-country-item.mjs.map +1 -1
  21. package/fesm2022/onemrvapublic-design-system-mat-datepicker-header.mjs +3 -3
  22. package/fesm2022/onemrvapublic-design-system-mat-datepicker-header.mjs.map +1 -1
  23. package/fesm2022/onemrvapublic-design-system-mat-empty-row.mjs +3 -3
  24. package/fesm2022/onemrvapublic-design-system-mat-empty-row.mjs.map +1 -1
  25. package/fesm2022/onemrvapublic-design-system-mat-file-upload.mjs +19 -19
  26. package/fesm2022/onemrvapublic-design-system-mat-file-upload.mjs.map +1 -1
  27. package/fesm2022/onemrvapublic-design-system-mat-input-address.mjs +6 -6
  28. package/fesm2022/onemrvapublic-design-system-mat-input-address.mjs.map +1 -1
  29. package/fesm2022/onemrvapublic-design-system-mat-input-birthplace.mjs +4 -4
  30. package/fesm2022/onemrvapublic-design-system-mat-input-birthplace.mjs.map +1 -1
  31. package/fesm2022/onemrvapublic-design-system-mat-input-country.mjs +3 -3
  32. package/fesm2022/onemrvapublic-design-system-mat-input-country.mjs.map +1 -1
  33. package/fesm2022/onemrvapublic-design-system-mat-input-enterprise-number.mjs +4 -4
  34. package/fesm2022/onemrvapublic-design-system-mat-input-enterprise-number.mjs.map +1 -1
  35. package/fesm2022/onemrvapublic-design-system-mat-input-iban.mjs +54 -13
  36. package/fesm2022/onemrvapublic-design-system-mat-input-iban.mjs.map +1 -1
  37. package/fesm2022/onemrvapublic-design-system-mat-input-phone.mjs +288 -156
  38. package/fesm2022/onemrvapublic-design-system-mat-input-phone.mjs.map +1 -1
  39. package/fesm2022/onemrvapublic-design-system-mat-message-box.mjs +7 -7
  40. package/fesm2022/onemrvapublic-design-system-mat-message-box.mjs.map +1 -1
  41. package/fesm2022/onemrvapublic-design-system-mat-multi-select.mjs +7 -7
  42. package/fesm2022/onemrvapublic-design-system-mat-multi-select.mjs.map +1 -1
  43. package/fesm2022/onemrvapublic-design-system-mat-navigation.mjs +9 -9
  44. package/fesm2022/onemrvapublic-design-system-mat-navigation.mjs.map +1 -1
  45. package/fesm2022/onemrvapublic-design-system-mat-notification.mjs +3 -3
  46. package/fesm2022/onemrvapublic-design-system-mat-notification.mjs.map +1 -1
  47. package/fesm2022/onemrvapublic-design-system-mat-paginator.mjs +7 -7
  48. package/fesm2022/onemrvapublic-design-system-mat-paginator.mjs.map +1 -1
  49. package/fesm2022/onemrvapublic-design-system-mat-panel.mjs +23 -23
  50. package/fesm2022/onemrvapublic-design-system-mat-panel.mjs.map +1 -1
  51. package/fesm2022/onemrvapublic-design-system-mat-pop-over.mjs +13 -13
  52. package/fesm2022/onemrvapublic-design-system-mat-pop-over.mjs.map +1 -1
  53. package/fesm2022/onemrvapublic-design-system-mat-progress-bar.mjs +3 -3
  54. package/fesm2022/onemrvapublic-design-system-mat-progress-bar.mjs.map +1 -1
  55. package/fesm2022/onemrvapublic-design-system-mat-select-search.mjs +13 -13
  56. package/fesm2022/onemrvapublic-design-system-mat-select-search.mjs.map +1 -1
  57. package/fesm2022/onemrvapublic-design-system-mat-selectable-box.mjs +7 -7
  58. package/fesm2022/onemrvapublic-design-system-mat-selectable-box.mjs.map +1 -1
  59. package/fesm2022/onemrvapublic-design-system-mat-side-menu.mjs +7 -7
  60. package/fesm2022/onemrvapublic-design-system-mat-side-menu.mjs.map +1 -1
  61. package/fesm2022/onemrvapublic-design-system-mat-skeleton.mjs +7 -7
  62. package/fesm2022/onemrvapublic-design-system-mat-skeleton.mjs.map +1 -1
  63. package/fesm2022/onemrvapublic-design-system-mat-spinner.mjs +10 -10
  64. package/fesm2022/onemrvapublic-design-system-mat-spinner.mjs.map +1 -1
  65. package/fesm2022/onemrvapublic-design-system-mat-stepper.mjs +7 -7
  66. package/fesm2022/onemrvapublic-design-system-mat-stepper.mjs.map +1 -1
  67. package/fesm2022/onemrvapublic-design-system-mat-sticker.mjs +8 -8
  68. package/fesm2022/onemrvapublic-design-system-mat-sticker.mjs.map +1 -1
  69. package/fesm2022/onemrvapublic-design-system-mat-table-of-content.mjs +9 -9
  70. package/fesm2022/onemrvapublic-design-system-mat-table-of-content.mjs.map +1 -1
  71. package/fesm2022/onemrvapublic-design-system-mat-task-list.mjs +16 -16
  72. package/fesm2022/onemrvapublic-design-system-mat-task-list.mjs.map +1 -1
  73. package/fesm2022/onemrvapublic-design-system-mat-timepicker.mjs +22 -22
  74. package/fesm2022/onemrvapublic-design-system-mat-timepicker.mjs.map +1 -1
  75. package/fesm2022/onemrvapublic-design-system-mat-toast.mjs +7 -7
  76. package/fesm2022/onemrvapublic-design-system-mat-toast.mjs.map +1 -1
  77. package/fesm2022/onemrvapublic-design-system-mat-tooltip.mjs +10 -10
  78. package/fesm2022/onemrvapublic-design-system-mat-tooltip.mjs.map +1 -1
  79. package/fesm2022/onemrvapublic-design-system-page-error.mjs +6 -6
  80. package/fesm2022/onemrvapublic-design-system-page-error.mjs.map +1 -1
  81. package/fesm2022/onemrvapublic-design-system-page-not-found.mjs +16 -16
  82. package/fesm2022/onemrvapublic-design-system-page-not-found.mjs.map +1 -1
  83. package/fesm2022/onemrvapublic-design-system-shared.mjs +102 -91
  84. package/fesm2022/onemrvapublic-design-system-shared.mjs.map +1 -1
  85. package/fesm2022/onemrvapublic-design-system.mjs +1376 -606
  86. package/fesm2022/onemrvapublic-design-system.mjs.map +1 -1
  87. package/index.d.ts +175 -21
  88. package/jsonform-renderers/datepicker-renderer/datepicker-renderer.component.scss +22 -0
  89. package/jsonform-renderers/index.d.ts +123 -0
  90. package/jsonform-renderers/label-renderer/label-renderer.component.scss +0 -0
  91. package/jsonform-renderers/niss-renderer/niss-renderer.component.scss +0 -0
  92. package/jsonform-renderers/radio-button-renderer/radio-button.renderer.component.scss +5 -0
  93. package/jsonform-renderers/readonly-control-renderer/readonly-control-renderer.component.scss +4 -0
  94. package/jsonform-renderers/select-renderer/select-renderer.component.scss +0 -0
  95. package/mat-input-phone/index.d.ts +58 -20
  96. package/mat-input-phone/src/onemrva-mat-input-phone.component.scss +8 -26
  97. package/mat-panel/src/onemrva-mat-panel.component.scss +8 -17
  98. package/mat-sticker/src/onemrva-mat-sticker.component.scss +4 -5
  99. package/package.json +9 -5
  100. package/shared/index.d.ts +5 -3
@@ -1,88 +1,67 @@
1
1
  import * as i5 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { HostListener, Directive, EventEmitter, inject, ViewChild, Output, Input, ViewEncapsulation, Component } from '@angular/core';
4
+ import { inject, EventEmitter, ElementRef, ChangeDetectorRef, Input, Output, ViewChild, ViewEncapsulation, Component, HostListener, Directive } from '@angular/core';
5
5
  import * as i4 from '@angular/forms';
6
- import { FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
7
- import { MatFormFieldModule } from '@angular/material/form-field';
6
+ import { FormControl, FormBuilder, NgControl, Validators, ReactiveFormsModule } from '@angular/forms';
7
+ import { MatFormFieldModule, MatFormFieldControl } from '@angular/material/form-field';
8
8
  import * as i1 from '@angular/material/input';
9
9
  import { MatInputModule } from '@angular/material/input';
10
10
  import * as i2 from '@angular/material/select';
11
11
  import { MatSelectModule } from '@angular/material/select';
12
- import * as i6 from '@ngx-translate/core';
13
12
  import { TranslateModule } from '@ngx-translate/core';
14
- import { Subject, debounceTime, startWith, combineLatestWith, map, takeUntil, zip } from 'rxjs';
13
+ import { Subject, debounceTime, startWith, combineLatestWith, takeUntil, zip } from 'rxjs';
15
14
  import * as i3 from '@onemrvapublic/design-system/mat-select-search';
16
15
  import { MatSelectSearchModule } from '@onemrvapublic/design-system/mat-select-search';
17
- import parsePhoneNumber from 'libphonenumber-js';
18
- import { FlagIconComponent } from '@onemrvapublic/design-system/flag-icon';
19
16
  import { OnemRvaCDNCountryService } from '@onemrvapublic/design-system/shared';
20
-
21
- class PhoneNumberDirective {
22
- onKeyDown(event) {
23
- const e = event;
24
- const allowedKey = [
25
- '0',
26
- '1',
27
- '2',
28
- '3',
29
- '4',
30
- '5',
31
- '6',
32
- '7',
33
- '8',
34
- '9',
35
- ' ',
36
- 'Backspace',
37
- 'Delete',
38
- 'Tab',
39
- '+',
40
- '-',
41
- 'Enter',
42
- 'ArrowLeft',
43
- 'ArrowRight',
44
- 'ArrowUp',
45
- 'ArrowDown',
46
- 'Home',
47
- 'End',
48
- ];
49
- if (allowedKey.indexOf(e.key) >= 0)
50
- return;
51
- const allowedCtrlShortcuts = ['a', 'c', 'x', 'v'];
52
- if (e.ctrlKey && allowedCtrlShortcuts.indexOf(e.key) >= 0)
53
- return;
54
- e.preventDefault();
55
- }
56
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: PhoneNumberDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
57
- static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.1.7", type: PhoneNumberDirective, isStandalone: true, selector: "[phoneNumber]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 }); }
58
- }
59
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: PhoneNumberDirective, decorators: [{
60
- type: Directive,
61
- args: [{
62
- selector: '[phoneNumber]',
63
- standalone: true,
64
- }]
65
- }], propDecorators: { onKeyDown: [{
66
- type: HostListener,
67
- args: ['keydown', ['$event']]
68
- }] } });
17
+ import { map } from 'rxjs/operators';
18
+ import { coerceBooleanProperty } from '@angular/cdk/coercion';
19
+ import { FocusMonitor } from '@angular/cdk/a11y';
20
+ import { FlagIconComponent } from '@onemrvapublic/design-system/flag-icon';
21
+ import parsePhoneNumber from 'libphonenumber-js';
69
22
 
70
23
  class OnemrvaMatInputPhoneComponent {
24
+ static { this.nextId = 0; }
25
+ get numberField() {
26
+ return this.parts.get('number');
27
+ }
28
+ get countryCodeField() {
29
+ return this.parts.get('countryCode');
30
+ }
71
31
  constructor() {
72
- this.readonly = false;
73
- this.label = 'Phone number';
32
+ this.cdn = inject(OnemRvaCDNCountryService);
33
+ this.countries$ = this.cdn.getCountries();
74
34
  this.noEntriesFoundLabel = 'Not found';
75
- this.placeholder = '+32 475 12 34 56';
76
35
  this.placeholderLabel = 'Search';
36
+ this.searchAriaLabel = 'Search';
37
+ this.label = 'Phone number';
77
38
  this.defaultPrefix = '+32';
78
- this.searchAriaLabel = '';
79
- this.hint = '';
80
39
  this.getCountry = new EventEmitter();
81
- this.countryCode = new FormControl('');
82
40
  this.filterCtrl = new FormControl('');
83
41
  this.destroyNotifier$ = new Subject();
84
- this.cdn = inject(OnemRvaCDNCountryService);
85
- this.countries$ = this.cdn.getCountries();
42
+ this.controlType = 'phone-input';
43
+ this.stateChanges = new Subject();
44
+ this.focused = false;
45
+ this.id = `phone-input-${OnemrvaMatInputPhoneComponent.nextId++}`;
46
+ this.touched = false;
47
+ this.focusMonitor = inject(FocusMonitor);
48
+ this.elementRef = inject((ElementRef));
49
+ this.cd = inject(ChangeDetectorRef);
50
+ this.formBuilder = inject(FormBuilder);
51
+ this.ngControl = inject(NgControl, { optional: true });
52
+ this.onChange = (_) => {
53
+ //console.log('---');
54
+ };
55
+ this.onTouched = () => {
56
+ if (!this.touched) {
57
+ this.touched = true;
58
+ this.stateChanges.next();
59
+ }
60
+ };
61
+ this.readonly = false;
62
+ this._disabled = false;
63
+ this._placeholder = '';
64
+ this._required = false;
86
65
  this.filteredCountries$ = this.filterCtrl.valueChanges.pipe(debounceTime(400), startWith(''), // Explicitly define type
87
66
  combineLatestWith(this.countries$), // Ensure correct tuple structure
88
67
  map(([search, countries]) => {
@@ -93,17 +72,122 @@ class OnemrvaMatInputPhoneComponent {
93
72
  return country.name?.toLowerCase().includes(search.toLowerCase());
94
73
  });
95
74
  }));
75
+ if (this.ngControl) {
76
+ this.ngControl.valueAccessor = this; // ✅ Only assign if ngControl exists
77
+ }
78
+ this.parts = this.formBuilder.group({
79
+ countryCode: ['', [Validators.maxLength(2)]],
80
+ number: ['', []],
81
+ });
82
+ }
83
+ errors() {
84
+ return this.parts.errors;
85
+ }
86
+ get errorState() {
87
+ const control = this.ngControl?.control;
88
+ const externalErrors = !!(control &&
89
+ control.invalid &&
90
+ (control.dirty || control.touched));
91
+ // Also check internal form errors
92
+ const internalErrors = !!(this.parts &&
93
+ this.parts.invalid &&
94
+ (this.parts.dirty || this.parts.touched));
95
+ return externalErrors || internalErrors;
96
96
  }
97
- get number() {
98
- return this.phoneNumber;
97
+ get shouldLabelFloat() {
98
+ return this.focused || !this.empty;
99
+ }
100
+ get empty() {
101
+ const { value: { countryCode, number }, } = this.parts;
102
+ // Consider empty if both fields are truly empty or just contain whitespace
103
+ const countryCodeEmpty = !countryCode || countryCode.trim() === '';
104
+ const numberEmpty = !number || number.trim() === '';
105
+ return countryCodeEmpty && numberEmpty;
106
+ }
107
+ get value() {
108
+ const { value: { countryCode, number }, } = this.parts;
109
+ // Return empty string if both are empty
110
+ if ((!countryCode || countryCode.trim() === '') &&
111
+ (!number || number.trim() === '')) {
112
+ return '';
113
+ }
114
+ // Return the number as is (since it should already contain the full international number)
115
+ return number || '';
116
+ }
117
+ set value(phoneNumber) {
118
+ // If empty, clear both fields
119
+ if (!phoneNumber || phoneNumber.trim() === '') {
120
+ this.parts.setValue({
121
+ countryCode: null,
122
+ number: null,
123
+ });
124
+ }
125
+ else {
126
+ // Keep existing logic for parsing the phone number
127
+ this.parts.setValue({
128
+ countryCode: this.countryCodeField.getRawValue() || null,
129
+ number: phoneNumber || null,
130
+ });
131
+ }
132
+ this.stateChanges.next();
133
+ }
134
+ get disabled() {
135
+ return this._disabled;
136
+ }
137
+ set disabled(value) {
138
+ this._disabled = coerceBooleanProperty(value);
139
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
140
+ this._disabled ? this.parts.disable() : this.parts.enable();
141
+ this.stateChanges.next();
142
+ }
143
+ setDisabledState(isDisabled) {
144
+ this.disabled = isDisabled;
145
+ this.stateChanges.next();
146
+ }
147
+ get placeholder() {
148
+ return this._placeholder;
149
+ }
150
+ set placeholder(value) {
151
+ this._placeholder = value;
152
+ this.stateChanges.next();
153
+ }
154
+ get required() {
155
+ return this._required;
156
+ }
157
+ set required(value) {
158
+ this._required = coerceBooleanProperty(value);
159
+ this.stateChanges.next();
99
160
  }
100
161
  ngOnInit() {
101
- this.number.valueChanges
102
- .pipe(startWith(this.number.getRawValue()), takeUntil(this.destroyNotifier$))
162
+ // Add focus monitoring
163
+ this.focusMonitor.monitor(this.elementRef, true).subscribe(origin => {
164
+ this.focused = !!origin;
165
+ if (!this.focused && !this.touched) {
166
+ this.touched = true;
167
+ this.onTouched();
168
+ }
169
+ this.stateChanges.next();
170
+ });
171
+ // Monitor internal form changes and notify parent form
172
+ this.parts.valueChanges
173
+ .pipe(takeUntil(this.destroyNotifier$))
174
+ .subscribe(() => {
175
+ this.onChange(this.value);
176
+ this.stateChanges.next();
177
+ });
178
+ this.focusMonitor.monitor(this.elementRef, true).subscribe(origin => {
179
+ this.focused = !!origin;
180
+ if (!this.focused) {
181
+ this.onTouched();
182
+ }
183
+ this.stateChanges.next();
184
+ });
185
+ this.numberField.valueChanges
186
+ .pipe(startWith(this.numberField.getRawValue()), takeUntil(this.destroyNotifier$))
103
187
  .subscribe(number => {
104
- if (number !== '') {
188
+ if (number && number !== '') {
105
189
  if (number.substring(0, 1) !== '+')
106
- this.countryCode.setValue('', { emitEvent: false });
190
+ this.countryCodeField.setValue('', { emitEvent: false });
107
191
  if (number === '0') {
108
192
  this.cdn
109
193
  .findCountryFromPrefix(this.defaultPrefix)
@@ -111,13 +195,15 @@ class OnemrvaMatInputPhoneComponent {
111
195
  .subscribe(country => {
112
196
  if (country) {
113
197
  //this.getCountry.next(country);
114
- this.number.setValue(this.defaultPrefix, {
198
+ this.numberField.setValue(this.defaultPrefix, {
199
+ emitEvent: false,
200
+ });
201
+ this.countryCodeField.setValue(country.code, {
115
202
  emitEvent: false,
116
203
  });
117
- this.countryCode.setValue(country.code, { emitEvent: false });
118
204
  }
119
205
  else {
120
- this.countryCode.setValue('');
206
+ this.countryCodeField.setValue('');
121
207
  }
122
208
  this.formatPhoneNumber();
123
209
  });
@@ -129,20 +215,20 @@ class OnemrvaMatInputPhoneComponent {
129
215
  .subscribe(country => {
130
216
  if (country) {
131
217
  //this.getCountry.next(country);
132
- this.countryCode.setValue(country.code);
218
+ this.countryCodeField.setValue(country.code);
133
219
  }
134
220
  else {
135
- this.countryCode.setValue('');
221
+ this.countryCodeField.setValue('');
136
222
  }
137
223
  this.formatPhoneNumber();
138
224
  });
139
225
  }
140
226
  }
141
227
  });
142
- this.countryCode.valueChanges
228
+ this.countryCodeField.valueChanges
143
229
  .pipe(takeUntil(this.destroyNotifier$))
144
230
  .subscribe(value => {
145
- let number = this.number.getRawValue();
231
+ let number = this.numberField.getRawValue() ?? '';
146
232
  zip(this.cdn.findCountryFromPrefix(number), this.cdn.findCountryFromCode(value)).subscribe(([countryFromVies, countryFromCode]) => {
147
233
  // Perform your action here using countryFromVies and countryFromCode
148
234
  if (countryFromVies) {
@@ -154,11 +240,11 @@ class OnemrvaMatInputPhoneComponent {
154
240
  number = number.replace('+', '');
155
241
  }
156
242
  number = countryFromCode.dial_code + number;
157
- this.number.setValue(number, { emitEvent: false });
243
+ this.numberField.setValue(number, { emitEvent: false });
158
244
  this.formatPhoneNumber();
159
245
  }
160
246
  setTimeout(() => {
161
- this.numberInput.nativeElement.focus();
247
+ this.number.nativeElement.focus();
162
248
  }, 200);
163
249
  });
164
250
  });
@@ -166,81 +252,74 @@ class OnemrvaMatInputPhoneComponent {
166
252
  handleClick(e) {
167
253
  e.stopPropagation();
168
254
  }
169
- clearValidators() {
170
- let required = false;
171
- if (this.number.hasValidator(Validators.required)) {
172
- required = true;
255
+ ngOnDestroy() {
256
+ this.destroyNotifier$.next();
257
+ this.destroyNotifier$.complete();
258
+ }
259
+ autoFocusNext(control, nextElement) {
260
+ if (!control.errors && nextElement) {
261
+ this.focusMonitor.focusVia(nextElement, 'program');
173
262
  }
174
- this.number.clearValidators();
175
- if (required) {
176
- this.number.addValidators(Validators.required);
263
+ }
264
+ onContainerClick(event) {
265
+ if (event.target.tagName.toLowerCase() != 'input') {
266
+ this.elementRef.nativeElement.querySelector('input')?.focus();
177
267
  }
178
268
  }
179
- formatPhoneNumber() {
180
- this.clearValidators();
181
- if (this.countryCode.getRawValue() !== '') {
182
- this.number.addValidators([
183
- this.phoneNumberValidator(this.countryCode.getRawValue()),
184
- ]);
269
+ setDescribedByIds(ids) {
270
+ const controlElement = this.elementRef.nativeElement.querySelector('.phone-fields');
271
+ controlElement.setAttribute('aria-describedby', ids.join(' '));
272
+ }
273
+ registerOnChange(fn) {
274
+ this.onChange = fn;
275
+ }
276
+ registerOnTouched(fn) {
277
+ this.onTouched = fn;
278
+ }
279
+ writeValue(number) {
280
+ this.value = number;
281
+ }
282
+ _handleInput(control, nextElement) {
283
+ this.autoFocusNext(control, nextElement);
284
+ this.onChange(this.value);
285
+ // Mark as touched when user interacts
286
+ if (!this.touched) {
287
+ this.touched = true;
288
+ this.onTouched();
185
289
  }
290
+ this.stateChanges.next();
291
+ }
292
+ formatPhoneNumber() {
186
293
  try {
187
- const parsedPhone = parsePhoneNumber(this.number.getRawValue());
294
+ const parsedPhone = parsePhoneNumber(this.numberField.getRawValue());
188
295
  const code = parsedPhone?.country;
189
296
  if (code) {
190
- this.countryCode.setValue(code, { emitEvent: false });
191
- this.clearValidators();
192
- this.number.addValidators([this.phoneNumberValidator(code)]);
193
- this.number.setValue(parsedPhone?.format('INTERNATIONAL'), {
297
+ this.countryCodeField.setValue(code, { emitEvent: false });
298
+ this.numberField.setValue(parsedPhone?.format('INTERNATIONAL'), {
194
299
  emitEvent: false,
195
300
  });
196
301
  }
197
- else {
198
- this.number.addValidators([genericValidator('input.phone.invalid')]);
199
- }
200
302
  }
201
303
  catch (e) {
202
- this.number.addValidators([genericValidator(e.message)]);
304
+ console.warn(e);
203
305
  }
204
306
  }
205
- ngOnDestroy() {
206
- this.destroyNotifier$.next();
207
- this.destroyNotifier$.complete();
208
- }
209
- errors() {
210
- for (const k in this.number.errors) {
211
- if (k === 'required') {
212
- return 'input.phone.required';
213
- }
214
- else {
215
- return 'input.phone.invalid';
216
- }
307
+ onKeyup(event) {
308
+ // Clear country when backspace on empty number
309
+ if (this.numberField.value === '' && event.key === 'Backspace') {
310
+ this.countryCodeField.setValue(null);
311
+ // this.parts.clearValidators();
217
312
  }
218
- return 'input.phone.unknown.error';
219
313
  }
220
- phoneNumberValidator(code) {
221
- return (_control) => {
222
- let number = code + _control.getRawValue();
223
- if (number === '') {
224
- return null;
225
- }
226
- try {
227
- number = number.replace(code, '');
228
- const parsedNumber = parsePhoneNumber(number);
229
- if (parsedNumber?.isValid()) {
230
- return null;
231
- }
232
- }
233
- catch (e) {
234
- console.warn(e.message);
235
- return { phoneNumber: { value: 'input.phone.invalid' } };
236
- }
237
- return { phoneNumber: { value: 'input.phone.invalid' } };
238
- };
239
- }
240
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: OnemrvaMatInputPhoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
241
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.7", type: OnemrvaMatInputPhoneComponent, isStandalone: true, selector: "onemrva-mat-input-phone", inputs: { readonly: "readonly", phoneNumber: "phoneNumber", label: "label", noEntriesFoundLabel: "noEntriesFoundLabel", placeholder: "placeholder", placeholderLabel: "placeholderLabel", defaultPrefix: "defaultPrefix", searchAriaLabel: "searchAriaLabel", hint: "hint" }, outputs: { getCountry: "getCountry" }, viewQueries: [{ propertyName: "numberInput", first: true, predicate: ["numberInput"], descendants: true }], ngImport: i0, template: "<ng-container>\n <mat-form-field class=\"onemrva-input-phone-number\">\n <mat-label>{{ label }}</mat-label>\n\n <input\n (click)=\"handleClick($event)\"\n type=\"tel\"\n matInput\n phoneNumber\n #numberInput\n [placeholder]=\"placeholder\"\n [formControl]=\"phoneNumber\"\n class=\"onemrva-text-number\"\n [readOnly]=\"readonly\"\n />\n <mat-select\n matTextPrefix\n class=\"onemrva-phone-number-select\"\n [formControl]=\"countryCode\"\n >\n <mat-select-trigger>\n <flag-icon [countryCode]=\"countryCode.getRawValue()\" />\n </mat-select-trigger>\n <mat-option>\n <mat-select-search\n [formControl]=\"filterCtrl\"\n [ariaLabel]=\"searchAriaLabel\"\n [noEntriesFoundLabel]=\"noEntriesFoundLabel\"\n [placeholderLabel]=\"placeholderLabel\"\n ></mat-select-search>\n </mat-option>\n @for (country of filteredCountries$ | async; track country.code) {\n <mat-option [value]=\"country.code\">\n <flag-icon [countryCode]=\"country.code\" />\n &nbsp;&nbsp;&nbsp;\n {{ country.name }}\n &nbsp;&nbsp;&nbsp;\n <span class=\"dialcode\">\n {{ country.dial_code }}\n </span>\n </mat-option>\n }\n </mat-select>\n @if (hint !== '') {\n <mat-hint>{{ hint }}</mat-hint>\n }\n @if (number.invalid) {\n <mat-error>{{ errors() | translate }}</mat-error>\n }\n </mat-form-field>\n</ng-container>\n", styles: [".onemrva-input-phone-number mat-select .mat-mdc-select-placeholder{width:1em!important;display:block!important}.onemrva-input-phone-number mat-select .mat-mdc-select-placeholder:before{width:1em!important;height:1em!important;background:#eee!important;visibility:visible!important;margin:10px 0!important}.onemrva-input-phone-number mat-select .mat-mdc-select-value{padding-right:8px}.onemrva-input-phone-number .onemrva-text-number{padding-left:12px!important;vertical-align:middle}.onemrva-input-phone-number .mat-mdc-form-field-text-prefix mat-select{line-height:14px!important}.onemrva-input-phone-number span.dialcode{color:#acaab2}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "component", type: i1.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i1.MatLabel, selector: "mat-label" }, { kind: "directive", type: i1.MatHint, selector: "mat-hint", inputs: ["align", "id"] }, { kind: "directive", type: i1.MatError, selector: "mat-error, [matError]", inputs: ["id"] }, { kind: "directive", type: i1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i2.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatSelectSearchModule }, { kind: "component", type: i3.MatSelectSearchComponent, selector: "mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti"], outputs: ["toggleAll"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "directive", type: PhoneNumberDirective, selector: "[phoneNumber]" }, { kind: "component", type: FlagIconComponent, selector: "flag-icon", inputs: ["countryCode", "mode", "width"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }, { kind: "pipe", type: i6.TranslatePipe, name: "translate" }], encapsulation: i0.ViewEncapsulation.None }); }
314
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: OnemrvaMatInputPhoneComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
315
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.4", type: OnemrvaMatInputPhoneComponent, isStandalone: true, selector: "onemrva-mat-input-phone", inputs: { noEntriesFoundLabel: "noEntriesFoundLabel", placeholderLabel: "placeholderLabel", searchAriaLabel: "searchAriaLabel", label: "label", defaultPrefix: "defaultPrefix", value: "value", readonly: "readonly", disabled: "disabled", placeholder: "placeholder", required: "required" }, outputs: { getCountry: "getCountry" }, providers: [
316
+ {
317
+ provide: MatFormFieldControl,
318
+ useExisting: OnemrvaMatInputPhoneComponent,
319
+ },
320
+ ], viewQueries: [{ propertyName: "countryCode", first: true, predicate: ["countryCode"], descendants: true }, { propertyName: "number", first: true, predicate: ["number"], descendants: true }], ngImport: i0, template: "<ng-container [formGroup]=\"parts\">\n <div class=\"phone-fields\">\n <div class=\"phone-prefix\">\n <mat-select\n #countryCode\n matTextPrefix\n class=\"onemrva-phone-number-select\"\n [formControl]=\"countryCodeField\"\n >\n <mat-select-trigger>\n <flag-icon [countryCode]=\"countryCodeField.getRawValue()\" />\n </mat-select-trigger>\n <mat-option>\n <mat-select-search\n [formControl]=\"filterCtrl\"\n [ariaLabel]=\"searchAriaLabel\"\n [noEntriesFoundLabel]=\"noEntriesFoundLabel\"\n [placeholderLabel]=\"placeholderLabel\"\n ></mat-select-search>\n </mat-option>\n @for (country of filteredCountries$ | async; track $index) {\n <mat-option [value]=\"country.code\">\n <flag-icon [countryCode]=\"country.code\" />\n &nbsp;&nbsp;&nbsp;\n {{ country.name }}\n &nbsp;&nbsp;&nbsp;\n <span class=\"dialcode\">\n {{ country.dial_code }}\n </span>\n </mat-option>\n }\n </mat-select>\n </div>\n <input\n (click)=\"handleClick($event)\"\n type=\"tel\"\n matInput\n #number\n [placeholder]=\"placeholder\"\n [formControl]=\"numberField\"\n class=\"onemrva-text-number\"\n [readOnly]=\"readonly\"\n />\n </div>\n</ng-container>\n", styles: ["onemrva-mat-input-phone{width:100%}onemrva-mat-input-phone .phone-fields{display:flex}onemrva-mat-input-phone .phone-fields .phone-prefix{width:48px;margin-right:8px}onemrva-mat-input-phone span.dialcode{color:var(--mat-sys-outline-variant)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i1.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly", "disabledInteractive"], exportAs: ["matInput"] }, { kind: "directive", type: i1.MatPrefix, selector: "[matPrefix], [matIconPrefix], [matTextPrefix]", inputs: ["matTextPrefix"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i2.MatSelect, selector: "mat-select", inputs: ["aria-describedby", "panelClass", "disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator", "placeholder", "required", "multiple", "disableOptionCentering", "compareWith", "value", "aria-label", "aria-labelledby", "errorStateMatcher", "typeaheadDebounceInterval", "sortComparator", "id", "panelWidth", "canSelectNullableOptions"], outputs: ["openedChange", "opened", "closed", "selectionChange", "valueChange"], exportAs: ["matSelect"] }, { kind: "directive", type: i2.MatSelectTrigger, selector: "mat-select-trigger" }, { kind: "component", type: i2.MatOption, selector: "mat-option", inputs: ["value", "id", "disabled"], outputs: ["onSelectionChange"], exportAs: ["matOption"] }, { kind: "ngmodule", type: MatSelectSearchModule }, { kind: "component", type: i3.MatSelectSearchComponent, selector: "mat-select-search", inputs: ["placeholderLabel", "type", "closeIcon", "closeSvgIcon", "noEntriesFoundLabel", "clearSearchInput", "searching", "disableInitialFocus", "enableClearOnEscapePressed", "preventHomeEndKeyPropagation", "disableScrollToActiveOnOptionsChanged", "ariaLabel", "showToggleAllCheckbox", "toggleAllCheckboxChecked", "toggleAllCheckboxIndeterminate", "toggleAllCheckboxTooltipMessage", "toggleAllCheckboxTooltipPosition", "hideClearSearchButton", "alwaysRestoreSelectedOptionsMulti"], outputs: ["toggleAll"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i4.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i4.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: TranslateModule }, { kind: "component", type: FlagIconComponent, selector: "flag-icon", inputs: ["countryCode", "mode", "width"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], encapsulation: i0.ViewEncapsulation.None }); }
242
321
  }
243
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImport: i0, type: OnemrvaMatInputPhoneComponent, decorators: [{
322
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: OnemrvaMatInputPhoneComponent, decorators: [{
244
323
  type: Component,
245
324
  args: [{ selector: 'onemrva-mat-input-phone', standalone: true, imports: [
246
325
  CommonModule,
@@ -250,38 +329,91 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.7", ngImpor
250
329
  MatSelectSearchModule,
251
330
  ReactiveFormsModule,
252
331
  TranslateModule,
253
- PhoneNumberDirective,
254
332
  FlagIconComponent,
255
- ], encapsulation: ViewEncapsulation.None, template: "<ng-container>\n <mat-form-field class=\"onemrva-input-phone-number\">\n <mat-label>{{ label }}</mat-label>\n\n <input\n (click)=\"handleClick($event)\"\n type=\"tel\"\n matInput\n phoneNumber\n #numberInput\n [placeholder]=\"placeholder\"\n [formControl]=\"phoneNumber\"\n class=\"onemrva-text-number\"\n [readOnly]=\"readonly\"\n />\n <mat-select\n matTextPrefix\n class=\"onemrva-phone-number-select\"\n [formControl]=\"countryCode\"\n >\n <mat-select-trigger>\n <flag-icon [countryCode]=\"countryCode.getRawValue()\" />\n </mat-select-trigger>\n <mat-option>\n <mat-select-search\n [formControl]=\"filterCtrl\"\n [ariaLabel]=\"searchAriaLabel\"\n [noEntriesFoundLabel]=\"noEntriesFoundLabel\"\n [placeholderLabel]=\"placeholderLabel\"\n ></mat-select-search>\n </mat-option>\n @for (country of filteredCountries$ | async; track country.code) {\n <mat-option [value]=\"country.code\">\n <flag-icon [countryCode]=\"country.code\" />\n &nbsp;&nbsp;&nbsp;\n {{ country.name }}\n &nbsp;&nbsp;&nbsp;\n <span class=\"dialcode\">\n {{ country.dial_code }}\n </span>\n </mat-option>\n }\n </mat-select>\n @if (hint !== '') {\n <mat-hint>{{ hint }}</mat-hint>\n }\n @if (number.invalid) {\n <mat-error>{{ errors() | translate }}</mat-error>\n }\n </mat-form-field>\n</ng-container>\n", styles: [".onemrva-input-phone-number mat-select .mat-mdc-select-placeholder{width:1em!important;display:block!important}.onemrva-input-phone-number mat-select .mat-mdc-select-placeholder:before{width:1em!important;height:1em!important;background:#eee!important;visibility:visible!important;margin:10px 0!important}.onemrva-input-phone-number mat-select .mat-mdc-select-value{padding-right:8px}.onemrva-input-phone-number .onemrva-text-number{padding-left:12px!important;vertical-align:middle}.onemrva-input-phone-number .mat-mdc-form-field-text-prefix mat-select{line-height:14px!important}.onemrva-input-phone-number span.dialcode{color:#acaab2}\n"] }]
256
- }], ctorParameters: () => [], propDecorators: { readonly: [{
333
+ ], encapsulation: ViewEncapsulation.None, providers: [
334
+ {
335
+ provide: MatFormFieldControl,
336
+ useExisting: OnemrvaMatInputPhoneComponent,
337
+ },
338
+ ], template: "<ng-container [formGroup]=\"parts\">\n <div class=\"phone-fields\">\n <div class=\"phone-prefix\">\n <mat-select\n #countryCode\n matTextPrefix\n class=\"onemrva-phone-number-select\"\n [formControl]=\"countryCodeField\"\n >\n <mat-select-trigger>\n <flag-icon [countryCode]=\"countryCodeField.getRawValue()\" />\n </mat-select-trigger>\n <mat-option>\n <mat-select-search\n [formControl]=\"filterCtrl\"\n [ariaLabel]=\"searchAriaLabel\"\n [noEntriesFoundLabel]=\"noEntriesFoundLabel\"\n [placeholderLabel]=\"placeholderLabel\"\n ></mat-select-search>\n </mat-option>\n @for (country of filteredCountries$ | async; track $index) {\n <mat-option [value]=\"country.code\">\n <flag-icon [countryCode]=\"country.code\" />\n &nbsp;&nbsp;&nbsp;\n {{ country.name }}\n &nbsp;&nbsp;&nbsp;\n <span class=\"dialcode\">\n {{ country.dial_code }}\n </span>\n </mat-option>\n }\n </mat-select>\n </div>\n <input\n (click)=\"handleClick($event)\"\n type=\"tel\"\n matInput\n #number\n [placeholder]=\"placeholder\"\n [formControl]=\"numberField\"\n class=\"onemrva-text-number\"\n [readOnly]=\"readonly\"\n />\n </div>\n</ng-container>\n", styles: ["onemrva-mat-input-phone{width:100%}onemrva-mat-input-phone .phone-fields{display:flex}onemrva-mat-input-phone .phone-fields .phone-prefix{width:48px;margin-right:8px}onemrva-mat-input-phone span.dialcode{color:var(--mat-sys-outline-variant)}\n"] }]
339
+ }], ctorParameters: () => [], propDecorators: { countryCode: [{
340
+ type: ViewChild,
341
+ args: ['countryCode']
342
+ }], number: [{
343
+ type: ViewChild,
344
+ args: ['number']
345
+ }], noEntriesFoundLabel: [{
257
346
  type: Input
258
- }], phoneNumber: [{
347
+ }], placeholderLabel: [{
348
+ type: Input
349
+ }], searchAriaLabel: [{
259
350
  type: Input
260
351
  }], label: [{
261
352
  type: Input
262
- }], noEntriesFoundLabel: [{
353
+ }], defaultPrefix: [{
263
354
  type: Input
264
- }], placeholder: [{
355
+ }], getCountry: [{
356
+ type: Output
357
+ }], value: [{
265
358
  type: Input
266
- }], placeholderLabel: [{
359
+ }], readonly: [{
267
360
  type: Input
268
- }], defaultPrefix: [{
361
+ }], disabled: [{
269
362
  type: Input
270
- }], searchAriaLabel: [{
363
+ }], placeholder: [{
271
364
  type: Input
272
- }], hint: [{
365
+ }], required: [{
273
366
  type: Input
274
- }], getCountry: [{
275
- type: Output
276
- }], numberInput: [{
277
- type: ViewChild,
278
- args: ['numberInput']
279
367
  }] } });
280
- function genericValidator(message) {
281
- return (_control) => {
282
- return { phoneNumber: { value: message } };
283
- };
368
+
369
+ class PhoneNumberDirective {
370
+ onKeyDown(event) {
371
+ const e = event;
372
+ const allowedKey = [
373
+ '0',
374
+ '1',
375
+ '2',
376
+ '3',
377
+ '4',
378
+ '5',
379
+ '6',
380
+ '7',
381
+ '8',
382
+ '9',
383
+ ' ',
384
+ 'Backspace',
385
+ 'Delete',
386
+ 'Tab',
387
+ '+',
388
+ '-',
389
+ 'Enter',
390
+ 'ArrowLeft',
391
+ 'ArrowRight',
392
+ 'ArrowUp',
393
+ 'ArrowDown',
394
+ 'Home',
395
+ 'End',
396
+ ];
397
+ if (allowedKey.indexOf(e.key) >= 0)
398
+ return;
399
+ const allowedCtrlShortcuts = ['a', 'c', 'x', 'v'];
400
+ if (e.ctrlKey && allowedCtrlShortcuts.indexOf(e.key) >= 0)
401
+ return;
402
+ e.preventDefault();
403
+ }
404
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PhoneNumberDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
405
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "20.3.4", type: PhoneNumberDirective, isStandalone: true, selector: "[phoneNumber]", host: { listeners: { "keydown": "onKeyDown($event)" } }, ngImport: i0 }); }
284
406
  }
407
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.4", ngImport: i0, type: PhoneNumberDirective, decorators: [{
408
+ type: Directive,
409
+ args: [{
410
+ selector: '[phoneNumber]',
411
+ standalone: true,
412
+ }]
413
+ }], propDecorators: { onKeyDown: [{
414
+ type: HostListener,
415
+ args: ['keydown', ['$event']]
416
+ }] } });
285
417
 
286
418
  /*
287
419
  * Public API Surface of mat-bank-account-input