@wlcm/angular 19.2.6 → 22.0.1
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 +37 -0
- package/button/fesm2022/wlcm-angular-button.mjs +25 -31
- package/button/fesm2022/wlcm-angular-button.mjs.map +1 -1
- package/button/package.json +25 -0
- package/button/types/wlcm-angular-button.d.ts +28 -0
- package/core/fesm2022/wlcm-angular-core.mjs +76 -92
- package/core/fesm2022/wlcm-angular-core.mjs.map +1 -1
- package/core/package.json +26 -0
- package/core/types/wlcm-angular-core.d.ts +102 -0
- package/datepicker/fesm2022/wlcm-angular-datepicker.mjs +329 -500
- package/datepicker/fesm2022/wlcm-angular-datepicker.mjs.map +1 -1
- package/datepicker/package.json +33 -0
- package/datepicker/types/wlcm-angular-datepicker.d.ts +285 -0
- package/filters/fesm2022/wlcm-angular-filters.mjs +32 -38
- package/filters/fesm2022/wlcm-angular-filters.mjs.map +1 -1
- package/filters/package.json +25 -0
- package/filters/types/wlcm-angular-filters.d.ts +81 -0
- package/forms/fesm2022/wlcm-angular-forms.mjs +375 -401
- package/forms/fesm2022/wlcm-angular-forms.mjs.map +1 -1
- package/forms/package.json +31 -0
- package/forms/types/wlcm-angular-forms.d.ts +365 -0
- package/package.json +27 -46
- package/phone-input/fesm2022/wlcm-angular-phone-input.mjs +67 -85
- package/phone-input/fesm2022/wlcm-angular-phone-input.mjs.map +1 -1
- package/phone-input/package.json +32 -0
- package/phone-input/types/wlcm-angular-phone-input.d.ts +81 -0
- package/search-field/fesm2022/wlcm-angular-search-field.mjs +25 -30
- package/search-field/fesm2022/wlcm-angular-search-field.mjs.map +1 -1
- package/search-field/package.json +28 -0
- package/search-field/types/wlcm-angular-search-field.d.ts +24 -0
- package/stepper/fesm2022/wlcm-angular-stepper.mjs +171 -294
- package/stepper/fesm2022/wlcm-angular-stepper.mjs.map +1 -1
- package/stepper/package.json +24 -0
- package/stepper/types/wlcm-angular-stepper.d.ts +114 -0
- package/styles/components/button/index.scss +25 -82
- package/styles/components/calendar/_calendar-header.scss +3 -6
- package/styles/components/calendar/_calendar.scss +10 -13
- package/styles/components/common/index.scss +4 -7
- package/styles/components/datepicker/_datepicker-input-container.scss +0 -3
- package/styles/components/datepicker/_datepicker-panel.scss +2 -5
- package/styles/components/datepicker/_datepicker-trigger.scss +0 -3
- package/styles/components/datepicker/date-range-picker/_date-range-picker-body.scss +0 -3
- package/styles/components/datepicker/date-range-picker/_date-range-picker-input.scss +4 -7
- package/styles/components/datepicker/date-range-picker/_date-range-picker-panel.scss +2 -5
- package/styles/components/forms/_autocomplete.scss +0 -3
- package/styles/components/forms/_checkbox-group.scss +0 -3
- package/styles/components/forms/_checkbox.scss +6 -8
- package/styles/components/forms/_error.scss +2 -13
- package/styles/components/forms/_form-field.scss +9 -10
- package/styles/components/forms/_label.scss +2 -11
- package/styles/components/forms/_radio.scss +13 -12
- package/styles/components/forms/_select.scss +5 -8
- package/styles/components/forms/partials/_dropdown-panel.scss +4 -6
- package/styles/components/loader/_loader.scss +5 -9
- package/styles/components/phone-input/_country-code-select.scss +0 -5
- package/styles/components/phone-input/_phone-input-container.scss +1 -6
- package/styles/components/search-field/index.scss +0 -4
- package/styles/components/stepper/_step-header.scss +8 -11
- package/styles/components/stepper/_step.scss +0 -5
- package/styles/components/stepper/_stepper-header.scss +0 -5
- package/styles/components/stepper/_stepper.scss +0 -4
- package/styles/components/table/_table-head-data.scss +6 -9
- package/styles/components/table/_table-head.scss +0 -5
- package/styles/components/table/_table-row-data.scss +2 -7
- package/styles/components/table/_table-row.scss +0 -5
- package/styles/components/table/_table.scss +0 -5
- package/styles/core/_all-theme.scss +8 -3
- package/styles/core/_tokens.scss +41 -0
- package/styles/core/_utils.scss +11 -44
- package/styles/wlcm.scss +1 -3
- package/table/fesm2022/wlcm-angular-table.mjs +130 -160
- package/table/fesm2022/wlcm-angular-table.mjs.map +1 -1
- package/table/package.json +27 -0
- package/table/types/wlcm-angular-table.d.ts +115 -0
- package/button/index.d.ts +0 -2
- package/button/lib/button.module.d.ts +0 -7
- package/button/lib/components/button/button.component.d.ts +0 -19
- package/button/lib/models/button.models.d.ts +0 -4
- package/core/index.d.ts +0 -11
- package/core/lib/components/default-loader/default-loader.component.d.ts +0 -5
- package/core/lib/components/icons/calendar-icon/calendar-icon.component.d.ts +0 -5
- package/core/lib/components/icons/chevron-down-icon/chevron-down-icon.component.d.ts +0 -5
- package/core/lib/components/icons/close-icon/close-icon.component.d.ts +0 -5
- package/core/lib/components/icons/search-icon/search-icon.component.d.ts +0 -5
- package/core/lib/components/loader/loader.component.d.ts +0 -11
- package/core/lib/constants/_index.d.ts +0 -2
- package/core/lib/constants/http.constants.d.ts +0 -2
- package/core/lib/constants/icon.contants.d.ts +0 -4
- package/core/lib/constants/loader.constants.d.ts +0 -2
- package/core/lib/directives/_index.d.ts +0 -1
- package/core/lib/directives/icon.directive.d.ts +0 -15
- package/core/lib/models/_index.d.ts +0 -2
- package/core/lib/models/icon.models.d.ts +0 -9
- package/core/lib/models/option.models.d.ts +0 -14
- package/core/lib/services/scroll-detection.api.d.ts +0 -10
- package/core/lib/utils/paginated-data-emulator.utils.d.ts +0 -9
- package/core/lib/utils/stream.utils.d.ts +0 -6
- package/datepicker/index.d.ts +0 -18
- package/datepicker/lib/components/calendar-header/calendar-header.component.d.ts +0 -24
- package/datepicker/lib/components/range/date-range-calendar-header/date-range-calendar-header.component.d.ts +0 -24
- package/datepicker/lib/components/range/date-range-picker-bottom-panel/date-range-picker-bottom-panel.component.d.ts +0 -8
- package/datepicker/lib/components/range/date-range-picker-input/date-range-picker-input.component.d.ts +0 -36
- package/datepicker/lib/components/range/double-calendar-range-picker/double-calendar-range-picker.component.d.ts +0 -37
- package/datepicker/lib/components/range/single-calendar-range-picker/single-calendar-range-picker.component.d.ts +0 -27
- package/datepicker/lib/components/single/datepicker-input-container/datepicker-input-container.component.d.ts +0 -30
- package/datepicker/lib/components/single/datepicker-panel/datepicker-panel.component.d.ts +0 -17
- package/datepicker/lib/constants/datepicker.constants.d.ts +0 -7
- package/datepicker/lib/constants/range/date-range-picker.constants.d.ts +0 -5
- package/datepicker/lib/constants/range/date-range-selection-model.constants.d.ts +0 -4
- package/datepicker/lib/constants/range/date-range-trigger-selection-model.constants.d.ts +0 -4
- package/datepicker/lib/datepicker.module.d.ts +0 -12
- package/datepicker/lib/directives/calendar.directive.d.ts +0 -5
- package/datepicker/lib/directives/datepicker-input.base.d.ts +0 -33
- package/datepicker/lib/directives/datepicker-trigger.base.d.ts +0 -33
- package/datepicker/lib/directives/ragne/date-range-picker-input-end.directive.d.ts +0 -20
- package/datepicker/lib/directives/ragne/date-range-picker-input-start.directive.d.ts +0 -20
- package/datepicker/lib/directives/ragne/date-range-picker-input.base.d.ts +0 -23
- package/datepicker/lib/directives/ragne/left-calendar.directive.d.ts +0 -17
- package/datepicker/lib/directives/ragne/right-calendar.directive.d.ts +0 -20
- package/datepicker/lib/directives/single/datepicker-input.directive.d.ts +0 -21
- package/datepicker/lib/models/date-picker.models.d.ts +0 -18
- package/datepicker/lib/models/range/data-range-calendar.models.d.ts +0 -25
- package/datepicker/lib/models/range/date-range-picker.models.d.ts +0 -19
- package/datepicker/lib/models/range/date-range-validation.models.d.ts +0 -3
- package/datepicker/lib/utils/range/date-range-input.validators.d.ts +0 -2
- package/datepicker/lib/utils/range/date-range-picker-errors.d.ts +0 -4
- package/filters/index.d.ts +0 -5
- package/filters/lib/components/filters-group/filters-group.component.d.ts +0 -6
- package/filters/lib/constants/filter.constants.d.ts +0 -3
- package/filters/lib/constants/index.d.ts +0 -1
- package/filters/lib/directives/filter.directive.d.ts +0 -5
- package/filters/lib/directives/index.d.ts +0 -1
- package/filters/lib/filters.module.d.ts +0 -9
- package/filters/lib/models/array-filter.models.d.ts +0 -19
- package/filters/lib/models/filter.models.d.ts +0 -19
- package/filters/lib/models/filters-group.models.d.ts +0 -22
- package/filters/lib/models/index.d.ts +0 -3
- package/forms/index.d.ts +0 -12
- package/forms/lib/forms/components/autocomplete/autocomplete.component.d.ts +0 -76
- package/forms/lib/forms/components/checkbox/checkbox.component.d.ts +0 -28
- package/forms/lib/forms/components/checkbox-group/checkbox-group.component.d.ts +0 -25
- package/forms/lib/forms/components/error/error.component.d.ts +0 -5
- package/forms/lib/forms/components/form-field/form-field.component.d.ts +0 -34
- package/forms/lib/forms/components/index.d.ts +0 -8
- package/forms/lib/forms/components/label/label.component.d.ts +0 -7
- package/forms/lib/forms/components/partials/autocomplete-suffix/autocomplete-suffix.component.d.ts +0 -10
- package/forms/lib/forms/components/partials/index.d.ts +0 -1
- package/forms/lib/forms/components/select/select.component.d.ts +0 -90
- package/forms/lib/forms/constants/form-elements.constants.d.ts +0 -6
- package/forms/lib/forms/constants/form-errors.constants.d.ts +0 -4
- package/forms/lib/forms/constants/form-field.constants.d.ts +0 -1
- package/forms/lib/forms/constants/form-state-handlers.constants.d.ts +0 -6
- package/forms/lib/forms/constants/index.d.ts +0 -5
- package/forms/lib/forms/constants/select.constants.d.ts +0 -3
- package/forms/lib/forms/directives/autocomplete.directive.d.ts +0 -16
- package/forms/lib/forms/directives/form-field-custom-container.directive.d.ts +0 -8
- package/forms/lib/forms/directives/form-field-hint.directive.d.ts +0 -5
- package/forms/lib/forms/directives/form-field-prefix.directive.d.ts +0 -6
- package/forms/lib/forms/directives/form-field-suffix.directive.d.ts +0 -5
- package/forms/lib/forms/directives/input.directive.d.ts +0 -14
- package/forms/lib/forms/directives/select-input-binder.directive.d.ts +0 -5
- package/forms/lib/forms/forms.module.d.ts +0 -19
- package/forms/lib/forms/models/_index.d.ts +0 -5
- package/forms/lib/forms/models/autocomplete.models.d.ts +0 -9
- package/forms/lib/forms/models/form-errors.models.d.ts +0 -5
- package/forms/lib/forms/models/form.models.d.ts +0 -11
- package/forms/lib/forms/models/input.models.d.ts +0 -13
- package/forms/lib/forms/models/select.models.d.ts +0 -9
- package/forms/lib/forms/pipes/errors-mapper.pipe.d.ts +0 -17
- package/forms/lib/forms/services/form-state-handler.service.d.ts +0 -10
- package/forms/lib/forms/services/index.d.ts +0 -2
- package/forms/lib/forms/services/places.api.d.ts +0 -11
- package/phone-input/index.d.ts +0 -4
- package/phone-input/lib/components/country-code-select/country-code-select.component.d.ts +0 -15
- package/phone-input/lib/components/phone-input-container/phone-input-container.component.d.ts +0 -30
- package/phone-input/lib/constants/country-code-options.constants.d.ts +0 -3
- package/phone-input/lib/constants/phone-adapter.constants.d.ts +0 -3
- package/phone-input/lib/directives/phone-input.directive.d.ts +0 -36
- package/phone-input/lib/models/country-code.models.d.ts +0 -7
- package/phone-input/lib/models/phone-adapter.models.d.ts +0 -10
- package/phone-input/lib/models/phone.models.d.ts +0 -3
- package/phone-input/lib/phone-input.module.d.ts +0 -9
- package/phone-input/lib/pipes/phone-code.pipe.d.ts +0 -8
- package/search-field/index.d.ts +0 -2
- package/search-field/lib/components/search-field/search-field.component.d.ts +0 -16
- package/search-field/lib/search-field.module.d.ts +0 -8
- package/stepper/index.d.ts +0 -10
- package/stepper/lib/components/step/step.component.d.ts +0 -16
- package/stepper/lib/components/step-header/step-header.component.d.ts +0 -20
- package/stepper/lib/components/stepper/stepper.component.d.ts +0 -6
- package/stepper/lib/components/stepper-header/stepper-header.component.d.ts +0 -8
- package/stepper/lib/constants/step.constants.d.ts +0 -4
- package/stepper/lib/constants/stepper.stepper.d.ts +0 -3
- package/stepper/lib/directives/load-on-active-step.directive.d.ts +0 -13
- package/stepper/lib/models/step.models.d.ts +0 -43
- package/stepper/lib/models/stepper.models.d.ts +0 -44
- package/stepper/lib/stepper.module.d.ts +0 -12
- package/styles/core/_core.scss +0 -10
- package/table/index.d.ts +0 -9
- package/table/lib/components/table/table.component.d.ts +0 -24
- package/table/lib/components/table-head/table-head.component.d.ts +0 -8
- package/table/lib/components/table-head-actions/table-head-actions.component.d.ts +0 -12
- package/table/lib/components/table-head-data/table-head-data.component.d.ts +0 -5
- package/table/lib/components/table-row/table-row.component.d.ts +0 -23
- package/table/lib/components/table-row-actions/table-row-actions.component.d.ts +0 -5
- package/table/lib/components/table-row-data/table-row-data.component.d.ts +0 -5
- package/table/lib/components/table-row-spacer/table-row-spacer.component.d.ts +0 -5
- package/table/lib/constants/table-row.constants.d.ts +0 -3
- package/table/lib/constants/table.constants.d.ts +0 -3
- package/table/lib/directives/scrollable-table-container.directive.d.ts +0 -13
- package/table/lib/models/table-config-manager.models.d.ts +0 -12
- package/table/lib/models/table-row.models.d.ts +0 -10
- package/table/lib/models/table-selection-model.d.ts +0 -25
- package/table/lib/models/table.models.d.ts +0 -4
- package/table/lib/pipes/table-row-injector.pipe.d.ts +0 -9
- package/table/lib/table.module.d.ts +0 -13
- package/table/lib/utils/table-errors.utils.d.ts +0 -3
|
@@ -1,39 +1,36 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, input,
|
|
2
|
+
import { InjectionToken, input, inject, ElementRef, effect, forwardRef, Directive, Pipe, output, viewChild, ChangeDetectionStrategy, Component, DestroyRef, contentChild, NgModule } from '@angular/core';
|
|
3
3
|
import { CommonModule } from '@angular/common';
|
|
4
|
-
import {
|
|
4
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
5
5
|
import * as i2 from '@angular/forms';
|
|
6
6
|
import { FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, ReactiveFormsModule } from '@angular/forms';
|
|
7
7
|
import IMask from 'imask';
|
|
8
8
|
import { isValidNumber, getExampleNumber, getCountries, getPhoneCode, AsYouType, parsePhoneNumber } from 'libphonenumber-js';
|
|
9
|
-
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
|
|
10
9
|
import examples from 'libphonenumber-js/mobile/examples';
|
|
11
10
|
import { Subject, fromEvent, takeUntil, merge, tap } from 'rxjs';
|
|
12
11
|
import * as i1 from '@wlcm/angular/forms';
|
|
13
|
-
import {
|
|
12
|
+
import { WlcmSelectComponent, WlcmFormsModule, WLCM_INPUT_BINDER } from '@wlcm/angular/forms';
|
|
14
13
|
import { WlcmOption } from '@wlcm/angular/core';
|
|
15
14
|
import { countries, getEmojiFlag, getCountryCode } from 'countries-list';
|
|
16
15
|
|
|
17
16
|
const WLCM_PHONE_ADAPTER = new InjectionToken('WLCM_PHONE_ADAPTER');
|
|
18
17
|
|
|
19
|
-
class WlcmPhoneAdapter {
|
|
20
|
-
}
|
|
21
|
-
|
|
22
18
|
var WlcmPhoneValidationErrorType;
|
|
23
19
|
(function (WlcmPhoneValidationErrorType) {
|
|
24
20
|
WlcmPhoneValidationErrorType["InvalidPhoneNumber"] = "InvalidPhoneNumber";
|
|
25
21
|
})(WlcmPhoneValidationErrorType || (WlcmPhoneValidationErrorType = {}));
|
|
26
22
|
|
|
27
|
-
|
|
23
|
+
class WlcmPhoneInputDirective {
|
|
28
24
|
handleBlur() {
|
|
29
25
|
this._touched?.();
|
|
30
26
|
}
|
|
31
|
-
constructor(
|
|
32
|
-
this._elementRef = _elementRef;
|
|
33
|
-
this.phoneAdapter = phoneAdapter;
|
|
27
|
+
constructor() {
|
|
34
28
|
this.control = new FormControl();
|
|
35
29
|
this.destroyInputObserver$ = new Subject();
|
|
36
|
-
this.applyMask = input(true
|
|
30
|
+
this.applyMask = input(true, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "applyMask" }] : /* istanbul ignore next */ []));
|
|
32
|
+
this._elementRef = inject(ElementRef);
|
|
33
|
+
this.phoneAdapter = inject(WLCM_PHONE_ADAPTER);
|
|
37
34
|
effect(() => {
|
|
38
35
|
if (this.applyMask()) {
|
|
39
36
|
if (!this._imaskRef)
|
|
@@ -132,38 +129,29 @@ let WlcmPhoneInputDirective = class WlcmPhoneInputDirective {
|
|
|
132
129
|
}
|
|
133
130
|
subscribeToPasteEvent() {
|
|
134
131
|
fromEvent(this.element, 'paste')
|
|
135
|
-
.pipe(
|
|
132
|
+
.pipe(takeUntilDestroyed())
|
|
136
133
|
.subscribe((event) => this.handlePaste(event));
|
|
137
134
|
}
|
|
138
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
139
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "
|
|
135
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
136
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: WlcmPhoneInputDirective, isStandalone: true, selector: "[wlcmPhoneInput]", inputs: { applyMask: { classPropertyName: "applyMask", publicName: "applyMask", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "blur": "handleBlur()" }, classAttribute: "wlcm-form-field-input" }, providers: [
|
|
140
137
|
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },
|
|
141
138
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },
|
|
142
139
|
], ngImport: i0 }); }
|
|
143
|
-
}
|
|
144
|
-
WlcmPhoneInputDirective
|
|
145
|
-
UntilDestroy(),
|
|
146
|
-
__metadata("design:paramtypes", [ElementRef,
|
|
147
|
-
WlcmPhoneAdapter])
|
|
148
|
-
], WlcmPhoneInputDirective);
|
|
149
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: WlcmPhoneInputDirective, decorators: [{
|
|
140
|
+
}
|
|
141
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputDirective, decorators: [{
|
|
150
142
|
type: Directive,
|
|
151
143
|
args: [{
|
|
152
144
|
selector: '[wlcmPhoneInput]',
|
|
153
|
-
host: {
|
|
154
|
-
|
|
145
|
+
host: {
|
|
146
|
+
class: 'wlcm-form-field-input',
|
|
147
|
+
'(blur)': 'handleBlur()',
|
|
148
|
+
},
|
|
155
149
|
providers: [
|
|
156
150
|
{ provide: NG_VALIDATORS, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },
|
|
157
151
|
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },
|
|
158
152
|
],
|
|
159
153
|
}]
|
|
160
|
-
}], ctorParameters: () => [{ type: i0.
|
|
161
|
-
type: Inject,
|
|
162
|
-
args: [WLCM_PHONE_ADAPTER]
|
|
163
|
-
}] }], propDecorators: { handleBlur: [{
|
|
164
|
-
type: HostListener,
|
|
165
|
-
args: ['blur', ['$event']]
|
|
166
|
-
}] } });
|
|
154
|
+
}], ctorParameters: () => [], propDecorators: { applyMask: [{ type: i0.Input, args: [{ isSignal: true, alias: "applyMask", required: false }] }] } });
|
|
167
155
|
|
|
168
156
|
class WlcmCountryCodeOption extends WlcmOption {
|
|
169
157
|
constructor(value, viewValue, emojiFlag) {
|
|
@@ -175,7 +163,7 @@ class WlcmCountryCodeOption extends WlcmOption {
|
|
|
175
163
|
}
|
|
176
164
|
|
|
177
165
|
const COUNTRIES_LIST = getCountries()
|
|
178
|
-
.filter((code) =>
|
|
166
|
+
.filter((code) => Object.prototype.hasOwnProperty.call(countries, code))
|
|
179
167
|
.map((code) => ({ ...countries[code], code }))
|
|
180
168
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
181
169
|
const WLCM_COUNTRY_CODE_OPTIONS = new InjectionToken('WLCM_COUNTRY_CODE_OPTIONS', {
|
|
@@ -194,47 +182,50 @@ class PhoneCodePipe {
|
|
|
194
182
|
transform(value) {
|
|
195
183
|
return value ? getPhoneCode(value) : '1';
|
|
196
184
|
}
|
|
197
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
198
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "
|
|
185
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PhoneCodePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
186
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "22.0.5", ngImport: i0, type: PhoneCodePipe, isStandalone: true, name: "phoneCode" }); }
|
|
199
187
|
}
|
|
200
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
188
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: PhoneCodePipe, decorators: [{
|
|
201
189
|
type: Pipe,
|
|
202
190
|
args: [{
|
|
203
191
|
name: 'phoneCode',
|
|
204
|
-
standalone: true,
|
|
205
192
|
}]
|
|
206
193
|
}] });
|
|
207
194
|
|
|
208
195
|
class WlcmCountryCodeSelectComponent {
|
|
209
|
-
constructor(
|
|
210
|
-
this.options = options;
|
|
196
|
+
constructor() {
|
|
211
197
|
this.changed = output();
|
|
212
|
-
this.control = input(new FormControl('US')
|
|
198
|
+
this.control = input(new FormControl('US'), /* @ts-ignore */
|
|
199
|
+
...(ngDevMode ? [{ debugName: "control" }] : /* istanbul ignore next */ []));
|
|
200
|
+
this.wlcmSelect = viewChild(WlcmSelectComponent, /* @ts-ignore */
|
|
201
|
+
...(ngDevMode ? [{ debugName: "wlcmSelect" }] : /* istanbul ignore next */ []));
|
|
202
|
+
this.options = inject(WLCM_COUNTRY_CODE_OPTIONS);
|
|
213
203
|
}
|
|
214
204
|
get selectComponent() {
|
|
215
|
-
|
|
205
|
+
// WlcmSelectComponent.matSelect is a viewChild() signal as of the forms
|
|
206
|
+
// signal migration (Phase B3); wlcmSelect is itself now a viewChild() signal,
|
|
207
|
+
// so it may be undefined before view init.
|
|
208
|
+
return this.wlcmSelect()?.matSelect();
|
|
216
209
|
}
|
|
217
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
218
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.
|
|
210
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmCountryCodeSelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
211
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: WlcmCountryCodeSelectComponent, isStandalone: true, selector: "wlcm-country-code-select", inputs: { control: { classPropertyName: "control", publicName: "control", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { changed: "changed" }, host: { classAttribute: "wlcm-country-code-select" }, viewQueries: [{ propertyName: "wlcmSelect", first: true, predicate: WlcmSelectComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<wlcm-select\n [options]=\"options\"\n [formControl]=\"control()\"\n [optionTemplate]=\"optionTemplate\"\n [triggerTemplate]=\"triggerTemplate\"\n (selectionChange)=\"changed.emit($event)\"\n></wlcm-select>\n\n<ng-template #optionTemplate let-option>\n <span class=\"emoji-flag\">{{ option.emojiFlag }}</span>\n\n {{ option.viewValue }}\n</ng-template>\n\n<ng-template #triggerTemplate let-selected>\n <div class=\"wlcm-country-code-select-trigger\">\n +{{ $safeNavigationMigration(selected?.value) | phoneCode }}\n </div>\n</ng-template>\n", styles: [".emoji-flag{font-size:20px;vertical-align:bottom;margin-right:8px}\n"], dependencies: [{ kind: "ngmodule", type: WlcmFormsModule }, { kind: "component", type: i1.WlcmSelectComponent, selector: "wlcm-select", inputs: ["multiple", "placeholder", "fetchPaginatedOptions", "canSelect", "queryParams", "paginated", "options", "selectOptionFormat", "optionTemplate", "triggerTemplate", "isOptionDisabled"], outputs: ["selectionChange", "opened", "closed"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "pipe", type: PhoneCodePipe, name: "phoneCode" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
219
212
|
}
|
|
220
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
213
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmCountryCodeSelectComponent, decorators: [{
|
|
221
214
|
type: Component,
|
|
222
|
-
args: [{ selector: 'wlcm-country-code-select', host: { class: 'wlcm-country-code-select' },
|
|
223
|
-
}],
|
|
224
|
-
type: Inject,
|
|
225
|
-
args: [WLCM_COUNTRY_CODE_OPTIONS]
|
|
226
|
-
}] }], propDecorators: { wlcmSelect: [{
|
|
227
|
-
type: ViewChild,
|
|
228
|
-
args: [WlcmSelectComponent]
|
|
229
|
-
}] } });
|
|
215
|
+
args: [{ selector: 'wlcm-country-code-select', host: { class: 'wlcm-country-code-select' }, imports: [WlcmFormsModule, ReactiveFormsModule, PhoneCodePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<wlcm-select\n [options]=\"options\"\n [formControl]=\"control()\"\n [optionTemplate]=\"optionTemplate\"\n [triggerTemplate]=\"triggerTemplate\"\n (selectionChange)=\"changed.emit($event)\"\n></wlcm-select>\n\n<ng-template #optionTemplate let-option>\n <span class=\"emoji-flag\">{{ option.emojiFlag }}</span>\n\n {{ option.viewValue }}\n</ng-template>\n\n<ng-template #triggerTemplate let-selected>\n <div class=\"wlcm-country-code-select-trigger\">\n +{{ $safeNavigationMigration(selected?.value) | phoneCode }}\n </div>\n</ng-template>\n", styles: [".emoji-flag{font-size:20px;vertical-align:bottom;margin-right:8px}\n"] }]
|
|
216
|
+
}], propDecorators: { changed: [{ type: i0.Output, args: ["changed"] }], control: [{ type: i0.Input, args: [{ isSignal: true, alias: "control", required: false }] }], wlcmSelect: [{ type: i0.ViewChild, args: [i0.forwardRef(() => WlcmSelectComponent), { isSignal: true }] }] } });
|
|
230
217
|
|
|
231
|
-
|
|
232
|
-
constructor(
|
|
233
|
-
this.
|
|
218
|
+
class WlcmPhoneInputContainerComponent {
|
|
219
|
+
constructor() {
|
|
220
|
+
this.destroyRef = inject(DestroyRef);
|
|
234
221
|
this._focusStream$ = new Subject();
|
|
235
222
|
this._blurStream$ = new Subject();
|
|
236
223
|
this.focus$ = this._focusStream$.asObservable();
|
|
237
224
|
this.blur$ = this._blurStream$.asObservable();
|
|
225
|
+
this.codeSelect = viewChild(WlcmCountryCodeSelectComponent, /* @ts-ignore */
|
|
226
|
+
...(ngDevMode ? [{ debugName: "codeSelect" }] : /* istanbul ignore next */ []));
|
|
227
|
+
this.phoneInput = contentChild(WlcmPhoneInputDirective, /* @ts-ignore */
|
|
228
|
+
...(ngDevMode ? [{ debugName: "phoneInput" }] : /* istanbul ignore next */ []));
|
|
238
229
|
this.control = new FormControl('US');
|
|
239
230
|
this._asYouType = new AsYouType('US');
|
|
240
231
|
this.parseValue = (value) => {
|
|
@@ -258,36 +249,37 @@ let WlcmPhoneInputContainerComponent = class WlcmPhoneInputContainerComponent {
|
|
|
258
249
|
};
|
|
259
250
|
}
|
|
260
251
|
ngAfterContentInit() {
|
|
261
|
-
if (!this.phoneInput) {
|
|
252
|
+
if (!this.phoneInput()) {
|
|
262
253
|
throw new Error('The [wlcmPhoneInput] directive must be provided.');
|
|
263
254
|
}
|
|
264
255
|
this.handleInputEvents();
|
|
265
256
|
}
|
|
266
257
|
isFocused() {
|
|
267
|
-
|
|
258
|
+
const panelOpen = this.codeSelect()?.selectComponent?.panelOpen ?? false;
|
|
259
|
+
return this.phoneInput().element === document.activeElement || panelOpen;
|
|
268
260
|
}
|
|
269
261
|
focus() {
|
|
270
|
-
this.phoneInput.element.focus();
|
|
262
|
+
this.phoneInput().element.focus();
|
|
271
263
|
}
|
|
272
264
|
getCurrentCountryCode() {
|
|
273
265
|
return this.control.value;
|
|
274
266
|
}
|
|
275
267
|
handleCountryChange() {
|
|
276
|
-
this.phoneInput
|
|
277
|
-
|
|
268
|
+
const phoneInput = this.phoneInput();
|
|
269
|
+
phoneInput._updateControl();
|
|
270
|
+
phoneInput._updateMaskByCountryCode();
|
|
278
271
|
}
|
|
279
272
|
get currentCallingCode() {
|
|
280
273
|
return getPhoneCode(this.control.value);
|
|
281
274
|
}
|
|
282
275
|
handleInputEvents() {
|
|
283
|
-
this.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
});
|
|
276
|
+
const element = this.phoneInput().element;
|
|
277
|
+
merge(fromEvent(element, 'focus').pipe(tap(() => this._focusStream$.next())), fromEvent(element, 'blur').pipe(tap(() => this._blurStream$.next())))
|
|
278
|
+
.pipe(takeUntilDestroyed(this.destroyRef))
|
|
279
|
+
.subscribe();
|
|
288
280
|
}
|
|
289
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
290
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "
|
|
281
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
282
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.0.5", type: WlcmPhoneInputContainerComponent, isStandalone: true, selector: "wlcm-phone-input-container", host: { classAttribute: "wlcm-phone-input-container" }, providers: [
|
|
291
283
|
{
|
|
292
284
|
provide: WLCM_INPUT_BINDER,
|
|
293
285
|
useFactory: () => {
|
|
@@ -296,15 +288,11 @@ let WlcmPhoneInputContainerComponent = class WlcmPhoneInputContainerComponent {
|
|
|
296
288
|
},
|
|
297
289
|
},
|
|
298
290
|
{ provide: WLCM_PHONE_ADAPTER, useExisting: forwardRef(() => WlcmPhoneInputContainerComponent) },
|
|
299
|
-
], queries: [{ propertyName: "phoneInput", first: true, predicate: WlcmPhoneInputDirective, descendants: true }], viewQueries: [{ propertyName: "codeSelect", first: true, predicate: WlcmCountryCodeSelectComponent, descendants: true }], ngImport: i0, template: "<wlcm-country-code-select\n [control]=\"control\"\n (changed)=\"handleCountryChange()\"\n (click)=\"$event.stopPropagation()\"\n></wlcm-country-code-select>\n\n<div class=\"wlcm-phone-input-container-divider\"></div>\n\n<ng-content select=\"[wlcmPhoneInput]\"></ng-content>\n", styles: [""], dependencies: [{ kind: "
|
|
300
|
-
}
|
|
301
|
-
WlcmPhoneInputContainerComponent
|
|
302
|
-
UntilDestroy(),
|
|
303
|
-
__metadata("design:paramtypes", [NgZone])
|
|
304
|
-
], WlcmPhoneInputContainerComponent);
|
|
305
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: WlcmPhoneInputContainerComponent, decorators: [{
|
|
291
|
+
], queries: [{ propertyName: "phoneInput", first: true, predicate: WlcmPhoneInputDirective, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "codeSelect", first: true, predicate: WlcmCountryCodeSelectComponent, descendants: true, isSignal: true }], ngImport: i0, template: "<wlcm-country-code-select\n [control]=\"control\"\n (changed)=\"handleCountryChange()\"\n (click)=\"$event.stopPropagation()\"\n></wlcm-country-code-select>\n\n<div class=\"wlcm-phone-input-container-divider\"></div>\n\n<ng-content select=\"[wlcmPhoneInput]\"></ng-content>\n", styles: [""], dependencies: [{ kind: "component", type: WlcmCountryCodeSelectComponent, selector: "wlcm-country-code-select", inputs: ["control"], outputs: ["changed"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
292
|
+
}
|
|
293
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputContainerComponent, decorators: [{
|
|
306
294
|
type: Component,
|
|
307
|
-
args: [{ selector: 'wlcm-phone-input-container', host: { class: 'wlcm-phone-input-container' },
|
|
295
|
+
args: [{ selector: 'wlcm-phone-input-container', host: { class: 'wlcm-phone-input-container' }, imports: [WlcmCountryCodeSelectComponent], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
308
296
|
{
|
|
309
297
|
provide: WLCM_INPUT_BINDER,
|
|
310
298
|
useFactory: () => {
|
|
@@ -314,22 +302,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImpor
|
|
|
314
302
|
},
|
|
315
303
|
{ provide: WLCM_PHONE_ADAPTER, useExisting: forwardRef(() => WlcmPhoneInputContainerComponent) },
|
|
316
304
|
], template: "<wlcm-country-code-select\n [control]=\"control\"\n (changed)=\"handleCountryChange()\"\n (click)=\"$event.stopPropagation()\"\n></wlcm-country-code-select>\n\n<div class=\"wlcm-phone-input-container-divider\"></div>\n\n<ng-content select=\"[wlcmPhoneInput]\"></ng-content>\n" }]
|
|
317
|
-
}],
|
|
318
|
-
type: ViewChild,
|
|
319
|
-
args: [WlcmCountryCodeSelectComponent]
|
|
320
|
-
}], phoneInput: [{
|
|
321
|
-
type: ContentChild,
|
|
322
|
-
args: [WlcmPhoneInputDirective]
|
|
323
|
-
}] } });
|
|
305
|
+
}], propDecorators: { codeSelect: [{ type: i0.ViewChild, args: [i0.forwardRef(() => WlcmCountryCodeSelectComponent), { isSignal: true }] }], phoneInput: [{ type: i0.ContentChild, args: [i0.forwardRef(() => WlcmPhoneInputDirective), { isSignal: true }] }] } });
|
|
324
306
|
|
|
325
307
|
const publicComponents = [WlcmPhoneInputContainerComponent];
|
|
326
308
|
const publicDirectives = [WlcmPhoneInputDirective];
|
|
327
309
|
class WlcmPhoneInputModule {
|
|
328
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
329
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
|
330
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "
|
|
310
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
311
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputModule, imports: [CommonModule, WlcmPhoneInputContainerComponent, WlcmPhoneInputDirective], exports: [WlcmPhoneInputContainerComponent, WlcmPhoneInputDirective] }); }
|
|
312
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputModule, imports: [CommonModule, publicComponents] }); }
|
|
331
313
|
}
|
|
332
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
314
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: WlcmPhoneInputModule, decorators: [{
|
|
333
315
|
type: NgModule,
|
|
334
316
|
args: [{
|
|
335
317
|
imports: [CommonModule, ...publicComponents, ...publicDirectives],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wlcm-angular-phone-input.mjs","sources":["../../../../modules/phone-input/src/lib/constants/phone-adapter.constants.ts","../../../../modules/phone-input/src/lib/models/phone-adapter.models.ts","../../../../modules/phone-input/src/lib/models/phone.models.ts","../../../../modules/phone-input/src/lib/directives/phone-input.directive.ts","../../../../modules/phone-input/src/lib/models/country-code.models.ts","../../../../modules/phone-input/src/lib/constants/country-code-options.constants.ts","../../../../modules/phone-input/src/lib/pipes/phone-code.pipe.ts","../../../../modules/phone-input/src/lib/components/country-code-select/country-code-select.component.ts","../../../../modules/phone-input/src/lib/components/country-code-select/country-code-select.component.html","../../../../modules/phone-input/src/lib/components/phone-input-container/phone-input-container.component.ts","../../../../modules/phone-input/src/lib/components/phone-input-container/phone-input-container.component.html","../../../../modules/phone-input/src/lib/phone-input.module.ts","../../../../modules/phone-input/src/wlcm-angular-phone-input.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { WlcmPhoneAdapter } from '../models/phone-adapter.models';\n\nexport const WLCM_PHONE_ADAPTER: InjectionToken<WlcmPhoneAdapter> = new InjectionToken('WLCM_PHONE_ADAPTER');\n","import { CountryCode } from 'libphonenumber-js';\n\nexport interface WlcmParsedPhone {\n countryCode: string;\n\n phoneNumber: string;\n}\n\nexport abstract class WlcmPhoneAdapter {\n abstract getCurrentCountryCode(): CountryCode;\n\n abstract parseValue(value: string): string;\n\n abstract formatValue(value: string): string;\n}\n","export enum WlcmPhoneValidationErrorType {\n InvalidPhoneNumber = 'InvalidPhoneNumber',\n}\n","import {\n Directive,\n ElementRef,\n HostListener,\n Inject,\n InputSignal,\n OnDestroy,\n effect,\n forwardRef,\n input,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n FormControl,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport IMask, { InputMask } from 'imask';\nimport { WLCM_PHONE_ADAPTER } from '../constants/phone-adapter.constants';\nimport { WlcmPhoneAdapter } from '../models/phone-adapter.models';\nimport { WlcmPhoneValidationErrorType } from '../models/phone.models';\nimport { isValidNumber, getExampleNumber, CountryCode } from 'libphonenumber-js';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport examples from 'libphonenumber-js/mobile/examples';\nimport { Subject, fromEvent, takeUntil } from 'rxjs';\n\n@UntilDestroy()\n@Directive({\n selector: '[wlcmPhoneInput]',\n host: { class: 'wlcm-form-field-input' },\n standalone: true,\n providers: [\n { provide: NG_VALIDATORS, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },\n ],\n})\nexport class WlcmPhoneInputDirective implements OnDestroy, ControlValueAccessor, Validator {\n readonly control: FormControl = new FormControl();\n\n private _changed?: (value: string) => void;\n\n private _touched?: () => void;\n\n private _validatorChanged?: () => void;\n\n private destroyInputObserver$: Subject<void> = new Subject();\n\n private _imaskRef?: InputMask;\n\n applyMask: InputSignal<boolean> = input(true);\n\n @HostListener('blur', ['$event']) handleBlur(): void {\n this._touched?.();\n }\n\n constructor(\n private _elementRef: ElementRef<HTMLInputElement>,\n @Inject(WLCM_PHONE_ADAPTER) private phoneAdapter: WlcmPhoneAdapter,\n ) {\n effect(() => {\n if (this.applyMask()) {\n if (!this._imaskRef) this.initializeMask();\n\n this._imaskRef!.mask = this.getMask();\n\n this._imaskRef!.updateControl();\n\n this._imaskRef!.on('accept', () => this.handleInput());\n\n this.destroyInputObserver$.next();\n } else {\n this.subscribeToInputEvent();\n }\n });\n\n this._updateMaskByCountryCode();\n\n this.subscribeToPasteEvent();\n }\n\n ngOnDestroy(): void {\n this.destroyInputObserver$.next();\n this.destroyInputObserver$.complete();\n }\n\n writeValue(value: string): void {\n const parsedValue: string = this.phoneAdapter.parseValue(value);\n\n this.updateValue(parsedValue);\n }\n\n registerOnChange(callback: (value: string) => void): void {\n this._changed = callback;\n }\n\n registerOnTouched(callback: () => void): void {\n this._touched = callback;\n }\n\n registerOnValidatorChange(callback: () => void): void {\n this._validatorChanged = callback;\n }\n\n validate(control: AbstractControl): ValidationErrors | null {\n const isValid: boolean = isValidNumber(control.value ?? '');\n\n if (!isValid) {\n return { [WlcmPhoneValidationErrorType.InvalidPhoneNumber]: true };\n }\n\n return null;\n }\n\n setDisabledState(isDisabled: boolean): void {\n if (isDisabled) {\n return this.control.disable();\n }\n\n this.control.enable();\n }\n\n _updateControl(): void {\n this.handleInput();\n }\n\n _updateMaskByCountryCode(): void {\n const code: CountryCode = this.phoneAdapter.getCurrentCountryCode();\n\n const nationalFormat = getExampleNumber(code, examples)?.formatNational();\n\n const mask: string = this.getMask(nationalFormat);\n\n if (this._imaskRef) {\n this._imaskRef.mask = mask;\n\n this._imaskRef.updateControl();\n }\n\n this.element.placeholder = mask;\n }\n\n get element(): HTMLInputElement {\n return this._elementRef.nativeElement;\n }\n\n private getMask(nationalFormat?: string): string {\n if (!nationalFormat) return '(000) 000-0000';\n\n return nationalFormat.replace(/\\d/g, '0');\n }\n\n private updateValue(parsedValue: string): void {\n if (this._imaskRef) {\n this._imaskRef.value = parsedValue;\n\n this._imaskRef.updateControl();\n } else {\n this.element.value = parsedValue;\n }\n }\n\n private handleInput(): void {\n const value: string = this.element.value;\n\n this._changed?.(this.phoneAdapter.formatValue(value));\n }\n\n private handlePaste(event: ClipboardEvent): void {\n event.preventDefault();\n\n const value: string = event.clipboardData?.getData('text') ?? '';\n\n const parsedValue: string = this.phoneAdapter.parseValue(value);\n\n this._updateMaskByCountryCode();\n\n this.updateValue(parsedValue);\n\n this.handleInput();\n }\n\n private initializeMask(): void {\n this._imaskRef = IMask(this.element, { mask: Number });\n }\n\n private subscribeToInputEvent(): void {\n fromEvent(this.element, 'input')\n .pipe(takeUntil(this.destroyInputObserver$))\n .subscribe(() => this.handleInput());\n }\n\n private subscribeToPasteEvent(): void {\n fromEvent<ClipboardEvent>(this.element, 'paste')\n .pipe(untilDestroyed(this))\n .subscribe((event: ClipboardEvent) => this.handlePaste(event));\n }\n}\n","import { WlcmOption } from '@wlcm/angular/core';\n\nexport class WlcmCountryCodeOption extends WlcmOption {\n constructor(public override value: string, public override viewValue: string, public emojiFlag: string) {\n super(value, viewValue);\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { WlcmCountryCodeOption } from '../models/country-code.models';\nimport { ICountry, TCountryCode, countries, getCountryCode, getEmojiFlag } from 'countries-list';\nimport { CountryCode, getCountries, getPhoneCode } from 'libphonenumber-js';\n\ninterface WlcmCountry extends ICountry {\n code: CountryCode;\n}\n\nconst COUNTRIES_LIST: WlcmCountry[] = getCountries()\n .filter((code: CountryCode) => countries.hasOwnProperty(code))\n .map((code: CountryCode) => ({ ...countries[code as TCountryCode], code }))\n .sort((a, b) => a.name.localeCompare(b.name));\n\nexport const WLCM_COUNTRY_CODE_OPTIONS: InjectionToken<WlcmCountryCodeOption[]> = new InjectionToken(\n 'WLCM_COUNTRY_CODE_OPTIONS',\n {\n providedIn: 'root',\n factory: (): WlcmCountryCodeOption[] => {\n return COUNTRIES_LIST.map((country: WlcmCountry) => {\n const phone: string = getPhoneCode(country.code);\n\n const viewValue: string = `${country.name} +${phone}`;\n\n const emojiFlag: string = getEmojiFlag(getCountryCode(country.name) as TCountryCode);\n\n return new WlcmCountryCodeOption(getCountryCode(country.name) as TCountryCode, viewValue, emojiFlag);\n });\n },\n }\n);\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { CountryCode, getPhoneCode } from 'libphonenumber-js';\n\n@Pipe({\n name: 'phoneCode',\n standalone: true,\n})\nexport class PhoneCodePipe implements PipeTransform {\n transform(value: CountryCode | null): string {\n return value ? getPhoneCode(value) : '1';\n }\n}\n","import { Component, Inject, InputSignal, OutputEmitterRef, ViewChild, input, output } from '@angular/core';\nimport { WlcmFormsModule, WlcmSelectComponent } from '@wlcm/angular/forms';\nimport { CommonModule } from '@angular/common';\n\nimport { WLCM_COUNTRY_CODE_OPTIONS } from '../../constants/country-code-options.constants';\nimport { WlcmCountryCodeOption } from '../../models/country-code.models';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { PhoneCodePipe } from '../../pipes/phone-code.pipe';\nimport { MatSelect } from '@angular/material/select';\n\n@Component({\n selector: 'wlcm-country-code-select',\n host: { class: 'wlcm-country-code-select' },\n standalone: true,\n imports: [CommonModule, WlcmFormsModule, ReactiveFormsModule, PhoneCodePipe],\n templateUrl: './country-code-select.component.html',\n styleUrl: './country-code-select.component.scss',\n})\nexport class WlcmCountryCodeSelectComponent {\n changed: OutputEmitterRef<any> = output();\n\n control: InputSignal<FormControl> = input(new FormControl('US'));\n\n @ViewChild(WlcmSelectComponent) private wlcmSelect!: WlcmSelectComponent;\n\n constructor(@Inject(WLCM_COUNTRY_CODE_OPTIONS) protected options: WlcmCountryCodeOption[]) {}\n\n get selectComponent(): MatSelect {\n return this.wlcmSelect.matSelect;\n }\n}\n","<wlcm-select\n [options]=\"options\"\n [formControl]=\"control()\"\n [optionTemplate]=\"optionTemplate\"\n [triggerTemplate]=\"triggerTemplate\"\n (selectionChange)=\"changed.emit($event)\"\n></wlcm-select>\n\n<ng-template #optionTemplate let-option>\n <span class=\"emoji-flag\">{{ option.emojiFlag }}</span>\n\n {{ option.viewValue }}\n</ng-template>\n\n<ng-template #triggerTemplate let-selected>\n <div class=\"wlcm-country-code-select-trigger\">\n +{{ selected?.value | phoneCode }}\n </div>\n</ng-template>\n","import { CommonModule } from '@angular/common';\nimport { AfterContentInit, Component, ContentChild, NgZone, ViewChild, forwardRef, inject } from '@angular/core';\nimport { WlcmPhoneInputDirective } from '../../directives/phone-input.directive';\nimport { WLCM_INPUT_BINDER, WlcmFormFieldInput } from '@wlcm/angular/forms';\nimport { WLCM_PHONE_ADAPTER } from '../../constants/phone-adapter.constants';\nimport { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';\nimport { Observable, Subject, fromEvent, merge, tap } from 'rxjs';\nimport { WlcmPhoneAdapter } from '../../models/phone-adapter.models';\nimport { AsYouType, CountryCode, PhoneNumber, getPhoneCode, isValidNumber, parsePhoneNumber } from 'libphonenumber-js';\nimport { WlcmCountryCodeSelectComponent } from '../country-code-select/country-code-select.component';\nimport { FormControl } from '@angular/forms';\n\n@UntilDestroy()\n@Component({\n selector: 'wlcm-phone-input-container',\n host: { class: 'wlcm-phone-input-container' },\n standalone: true,\n imports: [CommonModule, WlcmCountryCodeSelectComponent],\n templateUrl: './phone-input-container.component.html',\n styleUrl: './phone-input-container.component.scss',\n providers: [\n {\n provide: WLCM_INPUT_BINDER,\n useFactory: () => {\n const container: WlcmPhoneInputContainerComponent = inject(WlcmPhoneInputContainerComponent, { self: true });\n\n return { bind: () => container };\n },\n },\n { provide: WLCM_PHONE_ADAPTER, useExisting: forwardRef(() => WlcmPhoneInputContainerComponent) },\n ],\n})\nexport class WlcmPhoneInputContainerComponent implements AfterContentInit, WlcmFormFieldInput, WlcmPhoneAdapter {\n private readonly _focusStream$: Subject<void> = new Subject();\n\n private readonly _blurStream$: Subject<void> = new Subject();\n\n focus$: Observable<void> = this._focusStream$.asObservable();\n\n blur$: Observable<void> = this._blurStream$.asObservable();\n\n @ViewChild(WlcmCountryCodeSelectComponent) private codeSelect!: WlcmCountryCodeSelectComponent;\n\n @ContentChild(WlcmPhoneInputDirective) private phoneInput!: WlcmPhoneInputDirective;\n\n readonly control: FormControl = new FormControl('US');\n\n private _asYouType = new AsYouType('US');\n\n constructor(private _zone: NgZone) {}\n\n ngAfterContentInit(): void {\n if (!this.phoneInput) {\n throw new Error('The [wlcmPhoneInput] directive must be provided.');\n }\n\n this.handleInputEvents();\n }\n\n isFocused(): boolean {\n return this.phoneInput.element === document.activeElement || this.codeSelect?.selectComponent.panelOpen;\n }\n\n focus(): void {\n this.phoneInput.element.focus();\n }\n\n getCurrentCountryCode(): CountryCode {\n return this.control.value;\n }\n\n parseValue = (value: string): string => {\n if (!value || value.length === 0) return '';\n\n if (isValidNumber(value)) {\n const result: PhoneNumber = parsePhoneNumber(value, 'US');\n\n if (result.country) this.control.setValue(result.country);\n\n return result.nationalNumber;\n }\n\n return value;\n };\n\n formatValue = (value: string): string => {\n this._asYouType.reset();\n\n this._asYouType.input(`+${this.currentCallingCode}${value}`);\n\n const countryCode: CountryCode | undefined = this._asYouType.getCountry();\n\n if (countryCode) this.control.setValue(countryCode);\n\n return this._asYouType.getNumber()?.number ?? '';\n };\n\n handleCountryChange(): void {\n this.phoneInput._updateControl();\n\n this.phoneInput._updateMaskByCountryCode();\n }\n\n private get currentCallingCode(): string {\n return getPhoneCode(this.control.value);\n }\n\n private handleInputEvents(): void {\n this._zone.runOutsideAngular(() => {\n merge(\n fromEvent(this.phoneInput.element, 'focus').pipe(tap(() => this._focusStream$.next())),\n fromEvent(this.phoneInput.element, 'blur').pipe(tap(() => this._blurStream$.next())),\n )\n .pipe(untilDestroyed(this))\n .subscribe();\n });\n }\n}\n","<wlcm-country-code-select\n [control]=\"control\"\n (changed)=\"handleCountryChange()\"\n (click)=\"$event.stopPropagation()\"\n></wlcm-country-code-select>\n\n<div class=\"wlcm-phone-input-container-divider\"></div>\n\n<ng-content select=\"[wlcmPhoneInput]\"></ng-content>\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { WlcmPhoneInputContainerComponent } from './components/phone-input-container/phone-input-container.component';\nimport { WlcmPhoneInputDirective } from './directives/phone-input.directive';\n\nconst publicComponents: Type<unknown>[] = [WlcmPhoneInputContainerComponent];\n\nconst publicDirectives: Type<unknown>[] = [WlcmPhoneInputDirective];\n\n@NgModule({\n imports: [CommonModule, ...publicComponents, ...publicDirectives],\n exports: [...publicComponents, ...publicDirectives],\n})\nexport class WlcmPhoneInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAGO,MAAM,kBAAkB,GAAqC,IAAI,cAAc,CAAC,oBAAoB,CAAC;;MCKtF,gBAAgB,CAAA;AAMrC;;ICdW;AAAZ,CAAA,UAAY,4BAA4B,EAAA;AACtC,IAAA,4BAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC;AAC3C,CAAC,EAFW,4BAA4B,KAA5B,4BAA4B,GAEvC,EAAA,CAAA,CAAA;;ACqCY,IAAA,uBAAuB,GAA7B,MAAM,uBAAuB,CAAA;IAeA,UAAU,GAAA;AAC1C,QAAA,IAAI,CAAC,QAAQ,IAAI;;IAGnB,WACU,CAAA,WAAyC,EACb,YAA8B,EAAA;QAD1D,IAAW,CAAA,WAAA,GAAX,WAAW;QACiB,IAAY,CAAA,YAAA,GAAZ,YAAY;AApBzC,QAAA,IAAA,CAAA,OAAO,GAAgB,IAAI,WAAW,EAAE;AAQzC,QAAA,IAAA,CAAA,qBAAqB,GAAkB,IAAI,OAAO,EAAE;AAI5D,QAAA,IAAA,CAAA,SAAS,GAAyB,KAAK,CAAC,IAAI,CAAC;QAU3C,MAAM,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,"file":"wlcm-angular-phone-input.mjs","sources":["../../../../modules/phone-input/src/lib/constants/phone-adapter.constants.ts","../../../../modules/phone-input/src/lib/models/phone.models.ts","../../../../modules/phone-input/src/lib/directives/phone-input.directive.ts","../../../../modules/phone-input/src/lib/models/country-code.models.ts","../../../../modules/phone-input/src/lib/constants/country-code-options.constants.ts","../../../../modules/phone-input/src/lib/pipes/phone-code.pipe.ts","../../../../modules/phone-input/src/lib/components/country-code-select/country-code-select.component.ts","../../../../modules/phone-input/src/lib/components/country-code-select/country-code-select.component.html","../../../../modules/phone-input/src/lib/components/phone-input-container/phone-input-container.component.ts","../../../../modules/phone-input/src/lib/components/phone-input-container/phone-input-container.component.html","../../../../modules/phone-input/src/lib/phone-input.module.ts","../../../../modules/phone-input/src/wlcm-angular-phone-input.ts"],"sourcesContent":["import { InjectionToken } from '@angular/core';\nimport { WlcmPhoneAdapter } from '../models/phone-adapter.models';\n\nexport const WLCM_PHONE_ADAPTER: InjectionToken<WlcmPhoneAdapter> = new InjectionToken('WLCM_PHONE_ADAPTER');\n","export enum WlcmPhoneValidationErrorType {\n InvalidPhoneNumber = 'InvalidPhoneNumber',\n}\n","import {\n Directive,\n ElementRef,\n InputSignal,\n OnDestroy,\n effect,\n forwardRef,\n inject,\n input,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n FormControl,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\nimport IMask, { InputMask } from 'imask';\nimport { WLCM_PHONE_ADAPTER } from '../constants/phone-adapter.constants';\nimport { WlcmPhoneAdapter } from '../models/phone-adapter.models';\nimport { WlcmPhoneValidationErrorType } from '../models/phone.models';\nimport { isValidNumber, getExampleNumber, CountryCode } from 'libphonenumber-js';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport examples from 'libphonenumber-js/mobile/examples';\nimport { Subject, fromEvent, takeUntil } from 'rxjs';\n\n@Directive({\n selector: '[wlcmPhoneInput]',\n host: {\n class: 'wlcm-form-field-input',\n '(blur)': 'handleBlur()',\n },\n providers: [\n { provide: NG_VALIDATORS, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => WlcmPhoneInputDirective), multi: true },\n ],\n})\nexport class WlcmPhoneInputDirective implements OnDestroy, ControlValueAccessor, Validator {\n readonly control: FormControl = new FormControl();\n\n private _changed?: (value: string) => void;\n\n private _touched?: () => void;\n\n private _validatorChanged?: () => void;\n\n private destroyInputObserver$: Subject<void> = new Subject();\n\n private _imaskRef?: InputMask;\n\n applyMask: InputSignal<boolean> = input(true);\n\n private readonly _elementRef = inject<ElementRef<HTMLInputElement>>(ElementRef);\n\n private readonly phoneAdapter = inject<WlcmPhoneAdapter>(WLCM_PHONE_ADAPTER);\n\n handleBlur(): void {\n this._touched?.();\n }\n\n constructor() {\n effect(() => {\n if (this.applyMask()) {\n if (!this._imaskRef) this.initializeMask();\n\n this._imaskRef!.mask = this.getMask();\n\n this._imaskRef!.updateControl();\n\n this._imaskRef!.on('accept', () => this.handleInput());\n\n this.destroyInputObserver$.next();\n } else {\n this.subscribeToInputEvent();\n }\n });\n\n this._updateMaskByCountryCode();\n\n this.subscribeToPasteEvent();\n }\n\n ngOnDestroy(): void {\n this.destroyInputObserver$.next();\n this.destroyInputObserver$.complete();\n }\n\n writeValue(value: string): void {\n const parsedValue: string = this.phoneAdapter.parseValue(value);\n\n this.updateValue(parsedValue);\n }\n\n registerOnChange(callback: (value: string) => void): void {\n this._changed = callback;\n }\n\n registerOnTouched(callback: () => void): void {\n this._touched = callback;\n }\n\n registerOnValidatorChange(callback: () => void): void {\n this._validatorChanged = callback;\n }\n\n validate(control: AbstractControl): ValidationErrors | null {\n const isValid: boolean = isValidNumber(control.value ?? '');\n\n if (!isValid) {\n return { [WlcmPhoneValidationErrorType.InvalidPhoneNumber]: true };\n }\n\n return null;\n }\n\n setDisabledState(isDisabled: boolean): void {\n if (isDisabled) {\n return this.control.disable();\n }\n\n this.control.enable();\n }\n\n _updateControl(): void {\n this.handleInput();\n }\n\n _updateMaskByCountryCode(): void {\n const code: CountryCode = this.phoneAdapter.getCurrentCountryCode();\n\n const nationalFormat = getExampleNumber(code, examples)?.formatNational();\n\n const mask: string = this.getMask(nationalFormat);\n\n if (this._imaskRef) {\n this._imaskRef.mask = mask;\n\n this._imaskRef.updateControl();\n }\n\n this.element.placeholder = mask;\n }\n\n get element(): HTMLInputElement {\n return this._elementRef.nativeElement;\n }\n\n private getMask(nationalFormat?: string): string {\n if (!nationalFormat) return '(000) 000-0000';\n\n return nationalFormat.replace(/\\d/g, '0');\n }\n\n private updateValue(parsedValue: string): void {\n if (this._imaskRef) {\n this._imaskRef.value = parsedValue;\n\n this._imaskRef.updateControl();\n } else {\n this.element.value = parsedValue;\n }\n }\n\n private handleInput(): void {\n const value: string = this.element.value;\n\n this._changed?.(this.phoneAdapter.formatValue(value));\n }\n\n private handlePaste(event: ClipboardEvent): void {\n event.preventDefault();\n\n const value: string = event.clipboardData?.getData('text') ?? '';\n\n const parsedValue: string = this.phoneAdapter.parseValue(value);\n\n this._updateMaskByCountryCode();\n\n this.updateValue(parsedValue);\n\n this.handleInput();\n }\n\n private initializeMask(): void {\n this._imaskRef = IMask(this.element, { mask: Number });\n }\n\n private subscribeToInputEvent(): void {\n fromEvent(this.element, 'input')\n .pipe(takeUntil(this.destroyInputObserver$))\n .subscribe(() => this.handleInput());\n }\n\n private subscribeToPasteEvent(): void {\n fromEvent<ClipboardEvent>(this.element, 'paste')\n .pipe(takeUntilDestroyed())\n .subscribe((event: ClipboardEvent) => this.handlePaste(event));\n }\n}\n","import { WlcmOption } from '@wlcm/angular/core';\n\nexport class WlcmCountryCodeOption extends WlcmOption {\n constructor(public override value: string, public override viewValue: string, public emojiFlag: string) {\n super(value, viewValue);\n }\n}\n","import { InjectionToken } from '@angular/core';\nimport { WlcmCountryCodeOption } from '../models/country-code.models';\nimport { ICountry, TCountryCode, countries, getCountryCode, getEmojiFlag } from 'countries-list';\nimport { CountryCode, getCountries, getPhoneCode } from 'libphonenumber-js';\n\ninterface WlcmCountry extends ICountry {\n code: CountryCode;\n}\n\nconst COUNTRIES_LIST: WlcmCountry[] = getCountries()\n .filter((code: CountryCode) => Object.prototype.hasOwnProperty.call(countries, code))\n .map((code: CountryCode) => ({ ...countries[code as TCountryCode], code }))\n .sort((a, b) => a.name.localeCompare(b.name));\n\nexport const WLCM_COUNTRY_CODE_OPTIONS: InjectionToken<WlcmCountryCodeOption[]> = new InjectionToken(\n 'WLCM_COUNTRY_CODE_OPTIONS',\n {\n providedIn: 'root',\n factory: (): WlcmCountryCodeOption[] => {\n return COUNTRIES_LIST.map((country: WlcmCountry) => {\n const phone: string = getPhoneCode(country.code);\n\n const viewValue = `${country.name} +${phone}`;\n\n const emojiFlag: string = getEmojiFlag(getCountryCode(country.name) as TCountryCode);\n\n return new WlcmCountryCodeOption(getCountryCode(country.name) as TCountryCode, viewValue, emojiFlag);\n });\n },\n }\n);\n","import { Pipe, PipeTransform } from '@angular/core';\nimport { CountryCode, getPhoneCode } from 'libphonenumber-js';\n\n@Pipe({\n name: 'phoneCode',\n})\nexport class PhoneCodePipe implements PipeTransform {\n transform(value: CountryCode | null): string {\n return value ? getPhoneCode(value) : '1';\n }\n}\n","import {\n Component,\n InputSignal,\n OutputEmitterRef,\n input,\n output,\n ChangeDetectionStrategy,\n inject,\n viewChild,\n} from '@angular/core';\nimport { WlcmFormsModule, WlcmSelectComponent } from '@wlcm/angular/forms';\n\n\nimport { WLCM_COUNTRY_CODE_OPTIONS } from '../../constants/country-code-options.constants';\nimport { WlcmCountryCodeOption } from '../../models/country-code.models';\nimport { FormControl, ReactiveFormsModule } from '@angular/forms';\nimport { PhoneCodePipe } from '../../pipes/phone-code.pipe';\nimport { MatSelect } from '@angular/material/select';\n\n@Component({\n selector: 'wlcm-country-code-select',\n host: { class: 'wlcm-country-code-select' },\n imports: [WlcmFormsModule, ReactiveFormsModule, PhoneCodePipe],\n templateUrl: './country-code-select.component.html',\n changeDetection: ChangeDetectionStrategy.OnPush,\n styleUrl: './country-code-select.component.scss',\n})\nexport class WlcmCountryCodeSelectComponent {\n changed: OutputEmitterRef<any> = output();\n\n control: InputSignal<FormControl> = input(new FormControl('US'));\n\n private readonly wlcmSelect = viewChild(WlcmSelectComponent);\n\n protected readonly options = inject<WlcmCountryCodeOption[]>(WLCM_COUNTRY_CODE_OPTIONS);\n\n get selectComponent(): MatSelect | undefined {\n // WlcmSelectComponent.matSelect is a viewChild() signal as of the forms\n // signal migration (Phase B3); wlcmSelect is itself now a viewChild() signal,\n // so it may be undefined before view init.\n return this.wlcmSelect()?.matSelect();\n }\n}\n","<wlcm-select\n [options]=\"options\"\n [formControl]=\"control()\"\n [optionTemplate]=\"optionTemplate\"\n [triggerTemplate]=\"triggerTemplate\"\n (selectionChange)=\"changed.emit($event)\"\n></wlcm-select>\n\n<ng-template #optionTemplate let-option>\n <span class=\"emoji-flag\">{{ option.emojiFlag }}</span>\n\n {{ option.viewValue }}\n</ng-template>\n\n<ng-template #triggerTemplate let-selected>\n <div class=\"wlcm-country-code-select-trigger\">\n +{{ $safeNavigationMigration(selected?.value) | phoneCode }}\n </div>\n</ng-template>\n","import {\n AfterContentInit,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n contentChild,\n forwardRef,\n inject,\n viewChild,\n} from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { WlcmPhoneInputDirective } from '../../directives/phone-input.directive';\nimport { WLCM_INPUT_BINDER, WlcmFormFieldInput } from '@wlcm/angular/forms';\nimport { WLCM_PHONE_ADAPTER } from '../../constants/phone-adapter.constants';\nimport { Observable, Subject, fromEvent, merge, tap } from 'rxjs';\nimport { WlcmPhoneAdapter } from '../../models/phone-adapter.models';\nimport { AsYouType, CountryCode, PhoneNumber, getPhoneCode, isValidNumber, parsePhoneNumber } from 'libphonenumber-js';\nimport { WlcmCountryCodeSelectComponent } from '../country-code-select/country-code-select.component';\nimport { FormControl } from '@angular/forms';\n\n@Component({\n selector: 'wlcm-phone-input-container',\n host: { class: 'wlcm-phone-input-container' },\n imports: [WlcmCountryCodeSelectComponent],\n templateUrl: './phone-input-container.component.html',\n styleUrl: './phone-input-container.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: WLCM_INPUT_BINDER,\n useFactory: () => {\n const container: WlcmPhoneInputContainerComponent = inject(WlcmPhoneInputContainerComponent, { self: true });\n\n return { bind: () => container };\n },\n },\n { provide: WLCM_PHONE_ADAPTER, useExisting: forwardRef(() => WlcmPhoneInputContainerComponent) },\n ],\n})\nexport class WlcmPhoneInputContainerComponent implements AfterContentInit, WlcmFormFieldInput, WlcmPhoneAdapter {\n private readonly destroyRef = inject(DestroyRef);\n\n private readonly _focusStream$: Subject<void> = new Subject();\n\n private readonly _blurStream$: Subject<void> = new Subject();\n\n focus$: Observable<void> = this._focusStream$.asObservable();\n\n blur$: Observable<void> = this._blurStream$.asObservable();\n\n private readonly codeSelect = viewChild(WlcmCountryCodeSelectComponent);\n\n private readonly phoneInput = contentChild(WlcmPhoneInputDirective);\n\n readonly control: FormControl = new FormControl('US');\n\n private _asYouType = new AsYouType('US');\n\n ngAfterContentInit(): void {\n if (!this.phoneInput()) {\n throw new Error('The [wlcmPhoneInput] directive must be provided.');\n }\n\n this.handleInputEvents();\n }\n\n isFocused(): boolean {\n const panelOpen = this.codeSelect()?.selectComponent?.panelOpen ?? false;\n\n return this.phoneInput()!.element === document.activeElement || panelOpen;\n }\n\n focus(): void {\n this.phoneInput()!.element.focus();\n }\n\n getCurrentCountryCode(): CountryCode {\n return this.control.value;\n }\n\n parseValue = (value: string): string => {\n if (!value || value.length === 0) return '';\n\n if (isValidNumber(value)) {\n const result: PhoneNumber = parsePhoneNumber(value, 'US');\n\n if (result.country) this.control.setValue(result.country);\n\n return result.nationalNumber;\n }\n\n return value;\n };\n\n formatValue = (value: string): string => {\n this._asYouType.reset();\n\n this._asYouType.input(`+${this.currentCallingCode}${value}`);\n\n const countryCode: CountryCode | undefined = this._asYouType.getCountry();\n\n if (countryCode) this.control.setValue(countryCode);\n\n return this._asYouType.getNumber()?.number ?? '';\n };\n\n handleCountryChange(): void {\n const phoneInput = this.phoneInput()!;\n\n phoneInput._updateControl();\n\n phoneInput._updateMaskByCountryCode();\n }\n\n private get currentCallingCode(): string {\n return getPhoneCode(this.control.value);\n }\n\n private handleInputEvents(): void {\n const element = this.phoneInput()!.element;\n\n merge(\n fromEvent(element, 'focus').pipe(tap(() => this._focusStream$.next())),\n fromEvent(element, 'blur').pipe(tap(() => this._blurStream$.next())),\n )\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe();\n }\n}\n","<wlcm-country-code-select\n [control]=\"control\"\n (changed)=\"handleCountryChange()\"\n (click)=\"$event.stopPropagation()\"\n></wlcm-country-code-select>\n\n<div class=\"wlcm-phone-input-container-divider\"></div>\n\n<ng-content select=\"[wlcmPhoneInput]\"></ng-content>\n","import { NgModule, Type } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { WlcmPhoneInputContainerComponent } from './components/phone-input-container/phone-input-container.component';\nimport { WlcmPhoneInputDirective } from './directives/phone-input.directive';\n\nconst publicComponents: Type<unknown>[] = [WlcmPhoneInputContainerComponent];\n\nconst publicDirectives: Type<unknown>[] = [WlcmPhoneInputDirective];\n\n@NgModule({\n imports: [CommonModule, ...publicComponents, ...publicDirectives],\n exports: [...publicComponents, ...publicDirectives],\n})\nexport class WlcmPhoneInputModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAGO,MAAM,kBAAkB,GAAqC,IAAI,cAAc,CAAC,oBAAoB,CAAC;;ICHhG;AAAZ,CAAA,UAAY,4BAA4B,EAAA;AACtC,IAAA,4BAAA,CAAA,oBAAA,CAAA,GAAA,oBAAyC;AAC3C,CAAC,EAFW,4BAA4B,KAA5B,4BAA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A,CAAA;+GAMrD,oBAAoB,EAAA,OAAA,EAAA,CAHrB,YAAY,EAAK,gBAAgB,CAAA,EAAA,CAAA,CAAA;;2FAGhC,oBAAoB,EAAA,UAAA,EAAA,CAAA;kBAJhC,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;oBACR,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,CAAC;AACjE,oBAAA,OAAO,EAAE,CAAC,GAAG,gBAAgB,EAAE,GAAG,gBAAgB,CAAC;AACpD,iBAAA;;;ACZD;;AAEG;;;;"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@wlcm/angular/phone-input",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^22.0.0",
|
|
6
|
+
"@angular/core": "^22.0.0",
|
|
7
|
+
"@wlcm/angular/forms": "0.0.1",
|
|
8
|
+
"@angular/forms": "^22.0.0",
|
|
9
|
+
"@angular/material": "^22.0.0",
|
|
10
|
+
"rxjs": "~7.8.1",
|
|
11
|
+
"libphonenumber-js": "^1.11.18",
|
|
12
|
+
"countries-list": "^3.1.1",
|
|
13
|
+
"imask": "^7.6.1",
|
|
14
|
+
"@wlcm/angular/core": "0.0.1"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"tslib": "^2.3.0"
|
|
18
|
+
},
|
|
19
|
+
"sideEffects": false,
|
|
20
|
+
"module": "fesm2022/wlcm-angular-phone-input.mjs",
|
|
21
|
+
"typings": "types/wlcm-angular-phone-input.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
"./package.json": {
|
|
24
|
+
"default": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
".": {
|
|
27
|
+
"types": "./types/wlcm-angular-phone-input.d.ts",
|
|
28
|
+
"default": "./fesm2022/wlcm-angular-phone-input.mjs"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"type": "module"
|
|
32
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { AfterContentInit, OnDestroy, InputSignal } from '@angular/core';
|
|
3
|
+
import * as i1 from '@angular/common';
|
|
4
|
+
import { WlcmFormFieldInput } from '@wlcm/angular/forms';
|
|
5
|
+
import { Observable } from 'rxjs';
|
|
6
|
+
import { CountryCode } from 'libphonenumber-js';
|
|
7
|
+
import { FormControl, ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms';
|
|
8
|
+
|
|
9
|
+
declare abstract class WlcmPhoneAdapter {
|
|
10
|
+
abstract getCurrentCountryCode(): CountryCode;
|
|
11
|
+
abstract parseValue(value: string): string;
|
|
12
|
+
abstract formatValue(value: string): string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare class WlcmPhoneInputContainerComponent implements AfterContentInit, WlcmFormFieldInput, WlcmPhoneAdapter {
|
|
16
|
+
private readonly destroyRef;
|
|
17
|
+
private readonly _focusStream$;
|
|
18
|
+
private readonly _blurStream$;
|
|
19
|
+
focus$: Observable<void>;
|
|
20
|
+
blur$: Observable<void>;
|
|
21
|
+
private readonly codeSelect;
|
|
22
|
+
private readonly phoneInput;
|
|
23
|
+
readonly control: FormControl;
|
|
24
|
+
private _asYouType;
|
|
25
|
+
ngAfterContentInit(): void;
|
|
26
|
+
isFocused(): boolean;
|
|
27
|
+
focus(): void;
|
|
28
|
+
getCurrentCountryCode(): CountryCode;
|
|
29
|
+
parseValue: (value: string) => string;
|
|
30
|
+
formatValue: (value: string) => string;
|
|
31
|
+
handleCountryChange(): void;
|
|
32
|
+
private get currentCallingCode();
|
|
33
|
+
private handleInputEvents;
|
|
34
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WlcmPhoneInputContainerComponent, never>;
|
|
35
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<WlcmPhoneInputContainerComponent, "wlcm-phone-input-container", never, {}, {}, ["phoneInput"], ["[wlcmPhoneInput]"], true, never>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
declare class WlcmPhoneInputDirective implements OnDestroy, ControlValueAccessor, Validator {
|
|
39
|
+
readonly control: FormControl;
|
|
40
|
+
private _changed?;
|
|
41
|
+
private _touched?;
|
|
42
|
+
private _validatorChanged?;
|
|
43
|
+
private destroyInputObserver$;
|
|
44
|
+
private _imaskRef?;
|
|
45
|
+
applyMask: InputSignal<boolean>;
|
|
46
|
+
private readonly _elementRef;
|
|
47
|
+
private readonly phoneAdapter;
|
|
48
|
+
handleBlur(): void;
|
|
49
|
+
constructor();
|
|
50
|
+
ngOnDestroy(): void;
|
|
51
|
+
writeValue(value: string): void;
|
|
52
|
+
registerOnChange(callback: (value: string) => void): void;
|
|
53
|
+
registerOnTouched(callback: () => void): void;
|
|
54
|
+
registerOnValidatorChange(callback: () => void): void;
|
|
55
|
+
validate(control: AbstractControl): ValidationErrors | null;
|
|
56
|
+
setDisabledState(isDisabled: boolean): void;
|
|
57
|
+
_updateControl(): void;
|
|
58
|
+
_updateMaskByCountryCode(): void;
|
|
59
|
+
get element(): HTMLInputElement;
|
|
60
|
+
private getMask;
|
|
61
|
+
private updateValue;
|
|
62
|
+
private handleInput;
|
|
63
|
+
private handlePaste;
|
|
64
|
+
private initializeMask;
|
|
65
|
+
private subscribeToInputEvent;
|
|
66
|
+
private subscribeToPasteEvent;
|
|
67
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WlcmPhoneInputDirective, never>;
|
|
68
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<WlcmPhoneInputDirective, "[wlcmPhoneInput]", never, { "applyMask": { "alias": "applyMask"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declare class WlcmPhoneInputModule {
|
|
72
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<WlcmPhoneInputModule, never>;
|
|
73
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<WlcmPhoneInputModule, never, [typeof i1.CommonModule, typeof WlcmPhoneInputContainerComponent, typeof WlcmPhoneInputDirective], [typeof WlcmPhoneInputContainerComponent, typeof WlcmPhoneInputDirective]>;
|
|
74
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<WlcmPhoneInputModule>;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
declare enum WlcmPhoneValidationErrorType {
|
|
78
|
+
InvalidPhoneNumber = "InvalidPhoneNumber"
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export { WlcmPhoneInputContainerComponent, WlcmPhoneInputDirective, WlcmPhoneInputModule, WlcmPhoneValidationErrorType };
|