@skyux/phone-field 5.5.0 → 5.6.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"phone-field-input.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field-input.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,OAAO,EAGL,iBAAiB,EACjB,aAAa,GAGd,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;;;;AAI5E,sDAAsD;AACtD,MAAM,8BAA8B,GAAG;IACrC,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,yBAAyB,GAAG;IAChC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AACF,gBAAgB;AAEhB;;;;;;;;;;;;GAYG;AAKH,MAAM,OAAO,2BAA2B;IA2DtC,YACU,cAAiC,EACjC,KAAiB,EACL,cAA2C,EAC3C,mBAA2C;QAHvD,mBAAc,GAAd,cAAc,CAAmB;QACjC,UAAK,GAAL,KAAK,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;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,SAAS,EAAE,CAAC,8BAA8B,EAAE,yBAAyB,CAAC;iBACvE;;0BA+DI,QAAQ;;0BACR,QAAQ;4CAvDA,QAAQ;sBADlB,KAAK;gBAmBC,uBAAuB;sBAD7B,KAAK;gBA2FC,aAAa;sBADnB,YAAY;uBAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBAa3B,WAAW;sBADjB,YAAY;uBAAC,MAAM;gBAMb,aAAa;sBADnB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n forwardRef,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n} from '@angular/core';\n\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALUE_ACCESSOR,\n NG_VALIDATORS,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\n\nimport { BehaviorSubject, Subject } from 'rxjs';\n\nimport { debounceTime, takeUntil } from 'rxjs/operators';\n\nimport { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';\n\nimport { SkyPhoneFieldComponent } from './phone-field.component';\n\nimport { SkyPhoneFieldAdapterService } from './phone-field-adapter.service';\n\nimport { SkyPhoneFieldCountry } from './types/country';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_PHONE_FIELD_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyPhoneFieldInputDirective),\n multi: true,\n};\n\nconst SKY_PHONE_FIELD_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyPhoneFieldInputDirective),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Creates a button, search input, and text input for entering and validating\n * international phone numbers. Place this attribute on an `input` element, and wrap\n * that element in a `sky-phone-field` component. By default, the country selector\n * button displays a flag icon for the default country, and the phone number input\n * displays a sample of the correct phone number format. When users select the country\n * selector button, they expose the country search input, which is\n * [an autocomplete input](https://developer.blackbaud.com/skyux/components/autocomplete)\n * that allows them to select different countries. When users enter `+` followed by an\n * international dial code in the phone number input, the country automatically switches\n * to the country associated with the dial code.\n * @required\n */\n@Directive({\n selector: '[skyPhoneFieldInput]',\n providers: [SKY_PHONE_FIELD_VALUE_ACCESSOR, SKY_PHONE_FIELD_VALIDATOR],\n})\nexport class SkyPhoneFieldInputDirective\n implements OnInit, OnDestroy, AfterViewInit, ControlValueAccessor, Validator\n{\n /**\n * Indicates whether to disable the phone field.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this.phoneFieldComponent.countrySelectDisabled = value;\n this.adapterService.setElementDisabledState(this.elRef, value);\n this._disabled = value;\n }\n\n public get disabled(): boolean {\n return this._disabled || false;\n }\n\n /**\n * Indicates whether to prevent validation on the phone number input. For validation,\n * phone numbers are driven through the `ngModel` attribute that you specify on an\n * `input` element or on a `FormControl` in a reactive form. To prevent validation,\n * set this property to `true`.\n * @default false\n */\n @Input()\n public skyPhoneFieldNoValidate: boolean = false;\n\n private set modelValue(value: string) {\n this._modelValue = value;\n\n this.adapterService.setElementValue(this.elRef, value);\n\n if (value) {\n let formattedValue = this.formatNumber(value.toString());\n\n this.onChange(formattedValue);\n } else {\n this.onChange(value);\n }\n this.validatorChange();\n }\n\n private get modelValue(): string {\n return this._modelValue;\n }\n\n private control: AbstractControl;\n\n private textChanges: BehaviorSubject<string>;\n\n private ngUnsubscribe = new Subject();\n\n private phoneUtils = PhoneNumberUtil.getInstance();\n\n private _disabled: boolean;\n\n private _modelValue: string;\n\n public constructor(\n private changeDetector: ChangeDetectorRef,\n private elRef: ElementRef,\n @Optional() private adapterService: SkyPhoneFieldAdapterService,\n @Optional() private phoneFieldComponent: SkyPhoneFieldComponent\n ) {}\n\n public ngOnInit(): void {\n if (!this.phoneFieldComponent) {\n throw new Error(\n 'You must wrap the `skyPhoneFieldInput` directive within a ' +\n '`<sky-phone-field>` component!'\n );\n }\n\n this.adapterService.setElementType(this.elRef);\n this.adapterService.addElementClass(this.elRef, 'sky-form-control');\n if (this.phoneFieldComponent.selectedCountry) {\n this.adapterService.setElementPlaceholder(\n this.elRef,\n this.phoneFieldComponent.selectedCountry.exampleNumber\n );\n }\n\n this.adapterService.setAriaLabel(this.elRef);\n }\n\n public ngAfterViewInit(): void {\n this.phoneFieldComponent.selectedCountryChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((country: SkyPhoneFieldCountry) => {\n this.modelValue = this.elRef.nativeElement.value;\n this.adapterService.setElementPlaceholder(\n this.elRef,\n country.exampleNumber\n );\n });\n\n // This is needed to address a bug in Angular 4, where the value is not changed on the view.\n // See: https://github.com/angular/angular/issues/13792\n /* istanbul ignore else */\n if (this.control && this.modelValue) {\n this.control.setValue(this.modelValue, { emitEvent: false });\n this.changeDetector.detectChanges();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n /**\n * Writes the new value for reactive forms on change events on the input element\n * @param event The change event that was received\n */\n @HostListener('change', ['$event'])\n public onInputChange(event: any): void {\n if (!this.textChanges) {\n this.setupTextChangeSubscription(event.target.value);\n } else {\n this.textChanges.next(event.target.value);\n }\n }\n\n /**\n * Marks reactive form controls as touched on input blur events\n */\n @HostListener('blur')\n public onInputBlur(): void {\n this.onTouched();\n }\n\n @HostListener('input', ['$event'])\n public onInputTyping(event: any): void {\n if (!this.textChanges) {\n this.setupTextChangeSubscription(event.target.value);\n } else {\n this.textChanges.next(event.target.value);\n }\n }\n\n /**\n * Writes the new value for reactive forms\n * @param value The new value for the input\n */\n public writeValue(value: string): void {\n this.phoneFieldComponent.setCountryByDialCode(value);\n\n this.modelValue = value;\n }\n\n public registerOnChange(fn: (value: any) => any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => any): void {\n this.onTouched = fn;\n }\n\n public registerOnValidatorChange(fn: () => void): void {\n this.validatorChange = fn;\n }\n\n /**\n * Sets the disabled state on the input\n * @param isDisabled the new value of the input's disabled state\n */\n public setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * Validate's the form control's current value\n * @param control the form control for the input\n */\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (this.skyPhoneFieldNoValidate) {\n return;\n }\n\n const value = control.value;\n\n if (!value) {\n return;\n }\n\n if (\n this.phoneFieldComponent.selectedCountry &&\n !this.validateNumber(value)\n ) {\n if (!this.textChanges) {\n // Mark the invalid control as touched so that the input's invalid CSS styles appear.\n // (This is only required when the invalid value is set by the FormControl constructor.)\n // We don't do this if the input is the active element so that we don't show validation\n // errors unless it is invalid on initialization or the input has been blurred.\n control.markAsTouched();\n }\n\n return {\n skyPhoneField: {\n invalid: value,\n },\n };\n }\n }\n\n private setupTextChangeSubscription(text: string) {\n this.textChanges = new BehaviorSubject(text);\n\n this.textChanges\n .pipe(debounceTime(500), takeUntil(this.ngUnsubscribe))\n .subscribe((newValue) => {\n this.writeValue(newValue);\n });\n }\n\n private validateNumber(phoneNumber: string): boolean {\n try {\n const numberObj = this.phoneUtils.parseAndKeepRawInput(\n phoneNumber,\n this.phoneFieldComponent.selectedCountry.iso2\n );\n\n if (\n !this.phoneFieldComponent.allowExtensions &&\n numberObj.getExtension()\n ) {\n return false;\n }\n\n return this.phoneUtils.isValidNumber(numberObj);\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Format's the given phone number based on the currently selected country.\n * @param phoneNumber The number to format\n */\n private formatNumber(phoneNumber: string): string {\n try {\n const numberObj = this.phoneUtils.parseAndKeepRawInput(\n phoneNumber,\n this.phoneFieldComponent.selectedCountry.iso2\n );\n if (this.phoneUtils.isPossibleNumber(numberObj)) {\n switch (this.phoneFieldComponent.returnFormat) {\n case 'international':\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.INTERNATIONAL\n );\n case 'national':\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.NATIONAL\n );\n case 'default':\n default:\n if (\n this.phoneFieldComponent.selectedCountry.iso2 !==\n this.phoneFieldComponent.defaultCountry\n ) {\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.INTERNATIONAL\n );\n } else {\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.NATIONAL\n );\n }\n }\n } else {\n return phoneNumber;\n }\n } catch (e) {\n /* sanity check */\n /* istanbul ignore next */\n return phoneNumber;\n }\n }\n\n private onChange = (_: any) => {};\n\n /* istanbul ignore next */\n private onTouched = () => {};\n\n /* istanbul ignore next */\n private validatorChange = () => {};\n}\n"]}
1
+ {"version":3,"file":"phone-field-input.directive.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field-input.directive.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,UAAU,GACX,MAAM,eAAe,CAAC;AACvB,OAAO,EAGL,aAAa,EACb,iBAAiB,GAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;;;;AAGjE,sDAAsD;AACtD,MAAM,8BAA8B,GAAG;IACrC,OAAO,EAAE,iBAAiB;IAC1B,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BAA2B,CAAC;IAC1D,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,yBAAyB,GAAG;IAChC,OAAO,EAAE,aAAa;IACtB,WAAW,EAAE,UAAU,CAAC,GAAG,EAAE,CAAC,2BA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AM;gBACL,OAAO,WAAW,CAAC;aACpB;SACF;QAAC,OAAO,CAAC,EAAE;YACV,kBAAkB;YAClB,0BAA0B;YAC1B,OAAO,WAAW,CAAC;SACpB;IACH,CAAC;;yHA/RU,2BAA2B;6GAA3B,2BAA2B,4PAF3B,CAAC,8BAA8B,EAAE,yBAAyB,CAAC;4FAE3D,2BAA2B;kBAJvC,SAAS;mBAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,SAAS,EAAE,CAAC,8BAA8B,EAAE,yBAAyB,CAAC;iBACvE;;0BA+DI,QAAQ;;0BACR,QAAQ;4CAvDA,QAAQ;sBADlB,KAAK;gBAmBC,uBAAuB;sBAD7B,KAAK;gBA2FC,aAAa;sBADnB,YAAY;uBAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC;gBAa3B,WAAW;sBADjB,YAAY;uBAAC,MAAM;gBAMb,aAAa;sBADnB,YAAY;uBAAC,OAAO,EAAE,CAAC,QAAQ,CAAC","sourcesContent":["import {\n AfterViewInit,\n ChangeDetectorRef,\n Directive,\n ElementRef,\n HostListener,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n forwardRef,\n} from '@angular/core';\nimport {\n AbstractControl,\n ControlValueAccessor,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n ValidationErrors,\n Validator,\n} from '@angular/forms';\n\nimport { PhoneNumberFormat, PhoneNumberUtil } from 'google-libphonenumber';\nimport { BehaviorSubject, Subject } from 'rxjs';\nimport { debounceTime, takeUntil } from 'rxjs/operators';\n\nimport { SkyPhoneFieldAdapterService } from './phone-field-adapter.service';\nimport { SkyPhoneFieldComponent } from './phone-field.component';\nimport { SkyPhoneFieldCountry } from './types/country';\n\n// tslint:disable:no-forward-ref no-use-before-declare\nconst SKY_PHONE_FIELD_VALUE_ACCESSOR = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => SkyPhoneFieldInputDirective),\n multi: true,\n};\n\nconst SKY_PHONE_FIELD_VALIDATOR = {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => SkyPhoneFieldInputDirective),\n multi: true,\n};\n// tslint:enable\n\n/**\n * Creates a button, search input, and text input for entering and validating\n * international phone numbers. Place this attribute on an `input` element, and wrap\n * that element in a `sky-phone-field` component. By default, the country selector\n * button displays a flag icon for the default country, and the phone number input\n * displays a sample of the correct phone number format. When users select the country\n * selector button, they expose the country search input, which is\n * [an autocomplete input](https://developer.blackbaud.com/skyux/components/autocomplete)\n * that allows them to select different countries. When users enter `+` followed by an\n * international dial code in the phone number input, the country automatically switches\n * to the country associated with the dial code.\n * @required\n */\n@Directive({\n selector: '[skyPhoneFieldInput]',\n providers: [SKY_PHONE_FIELD_VALUE_ACCESSOR, SKY_PHONE_FIELD_VALIDATOR],\n})\nexport class SkyPhoneFieldInputDirective\n implements OnInit, OnDestroy, AfterViewInit, ControlValueAccessor, Validator\n{\n /**\n * Indicates whether to disable the phone field.\n * @default false\n */\n @Input()\n public set disabled(value: boolean) {\n this.phoneFieldComponent.countrySelectDisabled = value;\n this.adapterService.setElementDisabledState(this.elRef, value);\n this._disabled = value;\n }\n\n public get disabled(): boolean {\n return this._disabled || false;\n }\n\n /**\n * Indicates whether to prevent validation on the phone number input. For validation,\n * phone numbers are driven through the `ngModel` attribute that you specify on an\n * `input` element or on a `FormControl` in a reactive form. To prevent validation,\n * set this property to `true`.\n * @default false\n */\n @Input()\n public skyPhoneFieldNoValidate = false;\n\n private set modelValue(value: string) {\n this._modelValue = value;\n\n this.adapterService.setElementValue(this.elRef, value);\n\n if (value) {\n const formattedValue = this.formatNumber(value.toString());\n\n this.onChange(formattedValue);\n } else {\n this.onChange(value);\n }\n this.validatorChange();\n }\n\n private get modelValue(): string {\n return this._modelValue;\n }\n\n private control: AbstractControl;\n\n private textChanges: BehaviorSubject<string>;\n\n private ngUnsubscribe = new Subject();\n\n private phoneUtils = PhoneNumberUtil.getInstance();\n\n private _disabled: boolean;\n\n private _modelValue: string;\n\n public constructor(\n private changeDetector: ChangeDetectorRef,\n private elRef: ElementRef,\n @Optional() private adapterService: SkyPhoneFieldAdapterService,\n @Optional() private phoneFieldComponent: SkyPhoneFieldComponent\n ) {}\n\n public ngOnInit(): void {\n if (!this.phoneFieldComponent) {\n throw new Error(\n 'You must wrap the `skyPhoneFieldInput` directive within a ' +\n '`<sky-phone-field>` component!'\n );\n }\n\n this.adapterService.setElementType(this.elRef);\n this.adapterService.addElementClass(this.elRef, 'sky-form-control');\n if (this.phoneFieldComponent.selectedCountry) {\n this.adapterService.setElementPlaceholder(\n this.elRef,\n this.phoneFieldComponent.selectedCountry.exampleNumber\n );\n }\n\n this.adapterService.setAriaLabel(this.elRef);\n }\n\n public ngAfterViewInit(): void {\n this.phoneFieldComponent.selectedCountryChange\n .pipe(takeUntil(this.ngUnsubscribe))\n .subscribe((country: SkyPhoneFieldCountry) => {\n this.modelValue = this.elRef.nativeElement.value;\n this.adapterService.setElementPlaceholder(\n this.elRef,\n country.exampleNumber\n );\n });\n\n // This is needed to address a bug in Angular 4, where the value is not changed on the view.\n // See: https://github.com/angular/angular/issues/13792\n /* istanbul ignore else */\n if (this.control && this.modelValue) {\n this.control.setValue(this.modelValue, { emitEvent: false });\n this.changeDetector.detectChanges();\n }\n }\n\n public ngOnDestroy(): void {\n this.ngUnsubscribe.next();\n this.ngUnsubscribe.complete();\n }\n\n /**\n * Writes the new value for reactive forms on change events on the input element\n * @param event The change event that was received\n */\n @HostListener('change', ['$event'])\n public onInputChange(event: any): void {\n if (!this.textChanges) {\n this.setupTextChangeSubscription(event.target.value);\n } else {\n this.textChanges.next(event.target.value);\n }\n }\n\n /**\n * Marks reactive form controls as touched on input blur events\n */\n @HostListener('blur')\n public onInputBlur(): void {\n this.onTouched();\n }\n\n @HostListener('input', ['$event'])\n public onInputTyping(event: any): void {\n if (!this.textChanges) {\n this.setupTextChangeSubscription(event.target.value);\n } else {\n this.textChanges.next(event.target.value);\n }\n }\n\n /**\n * Writes the new value for reactive forms\n * @param value The new value for the input\n */\n public writeValue(value: string): void {\n this.phoneFieldComponent.setCountryByDialCode(value);\n\n this.modelValue = value;\n }\n\n public registerOnChange(fn: (value: any) => any): void {\n this.onChange = fn;\n }\n\n public registerOnTouched(fn: () => any): void {\n this.onTouched = fn;\n }\n\n public registerOnValidatorChange(fn: () => void): void {\n this.validatorChange = fn;\n }\n\n /**\n * Sets the disabled state on the input\n * @param isDisabled the new value of the input's disabled state\n */\n public setDisabledState(isDisabled: boolean): void {\n this.disabled = isDisabled;\n }\n\n /**\n * Validate's the form control's current value\n * @param control the form control for the input\n */\n public validate(control: AbstractControl): ValidationErrors {\n if (!this.control) {\n this.control = control;\n }\n\n if (this.skyPhoneFieldNoValidate) {\n return;\n }\n\n const value = control.value;\n\n if (!value) {\n return;\n }\n\n if (\n this.phoneFieldComponent.selectedCountry &&\n !this.validateNumber(value)\n ) {\n if (!this.textChanges) {\n // Mark the invalid control as touched so that the input's invalid CSS styles appear.\n // (This is only required when the invalid value is set by the FormControl constructor.)\n // We don't do this if the input is the active element so that we don't show validation\n // errors unless it is invalid on initialization or the input has been blurred.\n control.markAsTouched();\n }\n\n return {\n skyPhoneField: {\n invalid: value,\n },\n };\n }\n }\n\n private setupTextChangeSubscription(text: string) {\n this.textChanges = new BehaviorSubject(text);\n\n this.textChanges\n .pipe(debounceTime(500), takeUntil(this.ngUnsubscribe))\n .subscribe((newValue) => {\n this.writeValue(newValue);\n });\n }\n\n private validateNumber(phoneNumber: string): boolean {\n try {\n const numberObj = this.phoneUtils.parseAndKeepRawInput(\n phoneNumber,\n this.phoneFieldComponent.selectedCountry.iso2\n );\n\n if (\n !this.phoneFieldComponent.allowExtensions &&\n numberObj.getExtension()\n ) {\n return false;\n }\n\n return this.phoneUtils.isValidNumber(numberObj);\n } catch (e) {\n return false;\n }\n }\n\n /**\n * Format's the given phone number based on the currently selected country.\n * @param phoneNumber The number to format\n */\n private formatNumber(phoneNumber: string): string {\n try {\n const numberObj = this.phoneUtils.parseAndKeepRawInput(\n phoneNumber,\n this.phoneFieldComponent.selectedCountry.iso2\n );\n if (this.phoneUtils.isPossibleNumber(numberObj)) {\n switch (this.phoneFieldComponent.returnFormat) {\n case 'international':\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.INTERNATIONAL\n );\n case 'national':\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.NATIONAL\n );\n case 'default':\n default:\n if (\n this.phoneFieldComponent.selectedCountry.iso2 !==\n this.phoneFieldComponent.defaultCountry\n ) {\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.INTERNATIONAL\n );\n } else {\n return this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.NATIONAL\n );\n }\n }\n } else {\n return phoneNumber;\n }\n } catch (e) {\n /* sanity check */\n /* istanbul ignore next */\n return phoneNumber;\n }\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onChange = (_: any) => {};\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private onTouched = () => {};\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n private validatorChange = () => {};\n}\n"]}
@@ -55,7 +55,7 @@ export class SkyPhoneFieldComponent {
55
55
  * to the main window object.
56
56
  */
57
57
  this.countries = JSON.parse(JSON.stringify(window.intlTelInputGlobals.getCountryData()));
58
- for (let country of this.countries) {
58
+ for (const country of this.countries) {
59
59
  country.dialCode = '+' + country.dialCode;
60
60
  if (country.dialCode.length > this.longestDialCodeLength) {
61
61
  this.longestDialCodeLength = country.dialCode.length;
@@ -178,7 +178,7 @@ export class SkyPhoneFieldComponent {
178
178
  }
179
179
  let newCountry;
180
180
  for (let i = 1; i < this.longestDialCodeLength + 1; i++) {
181
- let dialCode = phoneNumber.substring(0, i);
181
+ const dialCode = phoneNumber.substring(0, i);
182
182
  let foundCountry = this.countries.find((country) => country.dialCode === dialCode && country.priority === 0);
183
183
  if (foundCountry) {
184
184
  // Ensure that the country that was found is one of the supported countries
@@ -1 +1 @@
1
- {"version":3,"file":"phone-field.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field.component.ts","../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field.component.html"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EAEP,KAAK,EACL,UAAU,EACV,OAAO,GACR,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,KAAK,EAGL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,WAAW,EACX,SAAS,EACT,iBAAiB,GAClB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAa,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAItD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,gBAAgB,CAAC;AAExB,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;;;;;;;;;;AAM5E,sFAAsF;AACtF,kFAAkF;AAClF,0IAA0I;AAkE1I,MAAM,OAAO,sBAAsB;IA6HjC,YACU,WAAwB,EACxB,cAA2C,EAC3C,cAAiC,EACtB,QAA0B,EACd,eAAwC;QAJ/D,gBAAW,GAAX,WAAW,CAAa;QACxB,mBAAc,GAAd,cAAc,CAA6B;QAC3C,mBAAc,GAAd,cAAc,CAAmB;QACtB,aAAQ,GAAR,QAAQ,CAAkB;QACd,oBAAe,GAAf,eAAe,CAAyB;QAjIzE;;;WAGG;QAEI,oBAAe,GAAY,IAAI,CAAC;QAwBvC;;;;WAIG;QAEI,iBAAY,GAAoC,SAAS,CAAC;QASjE;;;WAGG;QAGI,0BAAqB,GAAG,IAAI,YAAY,EAAwB,CAAC;QAIjE,0BAAqB,GAAG,KAAK,CAAC;QAE9B,uBAAkB,GAAG,KAAK,CA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CACX,CAAC,CACH;6BACF,CAAC;4BACF,UAAU,CAAC,QAAQ,EAAE;gCACnB,OAAO,CACL,eAAe,EACf,KAAK,CAAC;oCACJ,OAAO,EAAE,CAAC;iCACX,CAAC,CACH;6BACF,CAAC;yBACH,CAAC;qBACH;iBACF;;0BAkII,QAAQ;;0BACR,QAAQ;;0BAAI,QAAQ;4CA5HhB,eAAe;sBADrB,KAAK;gBAWK,cAAc;sBADxB,KAAK;gBAqBC,YAAY;sBADlB,KAAK;gBAQC,oBAAoB;sBAD1B,KAAK;gBASC,qBAAqB;sBAD3B,MAAM;gBAiBI,eAAe;sBADzB,KAAK;gBAiCE,gBAAgB;sBAJvB,SAAS;uBAAC,kBAAkB,EAAE;wBAC7B,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb;gBAOO,qBAAqB;sBAJ5B,SAAS;uBAAC,uBAAuB,EAAE;wBAClC,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb;gBAOO,uBAAuB;sBAJ9B,SAAS;uBAAC,yBAAyB,EAAE;wBACpC,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import {\n animate,\n AnimationEvent,\n style,\n transition,\n trigger,\n} from '@angular/animations';\n\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n SkipSelf,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\n\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\n\nimport { SkyInputBoxHostService } from '@skyux/forms';\n\nimport { SkyCountryFieldCountry } from '@skyux/lookup';\n\nimport { SkyThemeService } from '@skyux/theme';\n\nimport {\n PhoneNumberFormat,\n PhoneNumberType,\n PhoneNumberUtil,\n} from 'google-libphonenumber';\n\nimport 'intl-tel-input';\n\nimport { SkyPhoneFieldAdapterService } from './phone-field-adapter.service';\n\nimport { SkyPhoneFieldCountry } from './types/country';\n\nimport { SkyPhoneFieldNumberReturnFormat } from './types/number-return-format';\n\n// NOTE: The no-op animation is here in order to block the input's \"fade in\" animation\n// from firing on initial load. For more information on this technique you can see\n// https://www.bennadel.com/blog/3417-using-no-op-transitions-to-prevent-animation-during-the-initial-render-of-ngfor-in-angular-5-2-6.htm\n@Component({\n selector: 'sky-phone-field',\n templateUrl: './phone-field.component.html',\n styleUrls: ['./phone-field.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n SkyPhoneFieldAdapterService,\n // Prevents the embedded country field component from changing its behavior based on\n // being inside an input box. The phone field itself will handle the required changes\n // for input box.\n {\n provide: SkyInputBoxHostService,\n useValue: undefined,\n },\n ],\n animations: [\n trigger('blockAnimationOnLoad', [transition(':enter', [])]),\n trigger('countrySearchAnimation', [\n transition(':enter', [\n style({\n opacity: 0,\n width: 0,\n }),\n animate(\n '200ms ease-in',\n style({\n opacity: 1,\n width: '*',\n })\n ),\n ]),\n transition(':leave', [\n animate(\n '200ms ease-in',\n style({\n opacity: 0,\n width: 0,\n })\n ),\n ]),\n ]),\n trigger('phoneInputAnimation', [\n transition(':enter', [\n style({\n opacity: 0,\n }),\n animate(\n '150ms ease-in',\n style({\n opacity: 1,\n })\n ),\n ]),\n transition(':leave', [\n animate(\n '150ms ease-in',\n style({\n opacity: 0,\n })\n ),\n ]),\n ]),\n ],\n})\nexport class SkyPhoneFieldComponent implements OnDestroy, OnInit {\n /**\n * Indicates whether or not phone number extensions are allowed.\n * @default true\n */\n @Input()\n public allowExtensions: boolean = true;\n\n /**\n * Specifies the\n * [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)\n * country code for the default country. The country selector button displays a flag\n * icon for this default country until users select a different country.\n * @default \"us\"\n */\n @Input()\n public set defaultCountry(value: string) {\n if (value && value !== this._defaultCountry) {\n this._defaultCountry = value.toLowerCase();\n\n this.defaultCountryData = this.countries.find(\n (country) => country.iso2 === this._defaultCountry\n );\n }\n }\n\n public get defaultCountry(): string {\n return this._defaultCountry;\n }\n\n /**\n * Specifies the format for validated phone numbers.\n * Options include: `\"default\"`, `\"international\"`, and `\"national\"`.\n * @default \"default\"\n */\n @Input()\n public returnFormat: SkyPhoneFieldNumberReturnFormat = 'default';\n\n /**\n * Specifies the [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)\n * country codes for the countries that users can select. By default, all countries are available.\n */\n @Input()\n public supportedCountryISOs: string[];\n\n /**\n * Emits a `SkyPhoneFieldCountry` object when the selected country in the country search\n * input changes.\n */\n\n @Output()\n public selectedCountryChange = new EventEmitter<SkyPhoneFieldCountry>();\n\n public countries: SkyPhoneFieldCountry[];\n\n public countrySelectDisabled = false;\n\n public countrySearchShown = false;\n\n public phoneInputShown = true;\n\n public countrySearchForm: FormGroup;\n\n /**\n * Specifies the currently selected country to validate against.\n */\n @Input()\n public set selectedCountry(newCountry: SkyPhoneFieldCountry) {\n if (\n newCountry &&\n (!this._selectedCountry || this._selectedCountry.iso2 !== newCountry.iso2)\n ) {\n this._selectedCountry = this.countries.find(\n (country) => country.iso2 === newCountry.iso2\n );\n\n if (!this._selectedCountry.exampleNumber) {\n const numberObj = this.phoneUtils.getExampleNumberForType(\n newCountry.iso2,\n PhoneNumberType.FIXED_LINE\n );\n this._selectedCountry.exampleNumber = this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.NATIONAL\n );\n }\n\n this.selectedCountryChange.emit(this._selectedCountry);\n }\n }\n\n public get selectedCountry(): SkyPhoneFieldCountry {\n return this._selectedCountry;\n }\n\n @ViewChild('inputTemplateRef', {\n read: TemplateRef,\n static: true,\n })\n private inputTemplateRef: TemplateRef<any>;\n\n @ViewChild('countryBtnTemplateRef', {\n read: TemplateRef,\n static: true,\n })\n private countryBtnTemplateRef: TemplateRef<any>;\n\n @ViewChild('buttonsInsetTemplateRef', {\n read: TemplateRef,\n static: true,\n })\n private buttonsInsetTemplateRef: TemplateRef<any>;\n\n private defaultCountryData: SkyPhoneFieldCountry;\n\n private phoneInputAnimationTriggered = false;\n\n private phoneUtils = PhoneNumberUtil.getInstance();\n\n private longestDialCodeLength = 0;\n\n private _defaultCountry: string;\n\n private _selectedCountry: SkyPhoneFieldCountry;\n\n constructor(\n private formBuilder: FormBuilder,\n private adapterService: SkyPhoneFieldAdapterService,\n private changeDetector: ChangeDetectorRef,\n @Optional() public themeSvc?: SkyThemeService,\n @Optional() @SkipSelf() public inputBoxHostSvc?: SkyInputBoxHostService\n ) {\n /**\n * The json functions here ensures that we get a copy of the array and not the global original.\n * This ensures that multiple instances of the component don't overwrite the original data.\n *\n * We must type the window object as any here as the intl-tel-input library adds its object\n * to the main window object.\n */\n this.countries = JSON.parse(\n JSON.stringify((window as any).intlTelInputGlobals.getCountryData())\n );\n for (let country of this.countries) {\n country.dialCode = '+' + country.dialCode;\n\n if (country.dialCode.length > this.longestDialCodeLength) {\n this.longestDialCodeLength = country.dialCode.length;\n }\n }\n\n this.countrySearchForm = this.formBuilder.group({\n countrySearch: new FormControl(),\n });\n }\n\n public ngOnInit(): void {\n // The timeout here is needed to avoid a change before checked error when a user specifies\n // a selected country on initialization of the component.\n setTimeout(() => {\n if (this.inputBoxHostSvc) {\n this.inputBoxHostSvc.populate({\n inputTemplate: this.inputTemplateRef,\n buttonsInsetTemplate: this.buttonsInsetTemplateRef,\n buttonsLeftTemplate: this.countryBtnTemplateRef,\n });\n }\n\n if (!this.defaultCountry) {\n this.defaultCountry = 'us';\n }\n\n if (!this.selectedCountry) {\n this.selectedCountry = this.defaultCountryData;\n }\n this.changeDetector.markForCheck();\n }, 0);\n\n this.countrySearchForm\n .get('countrySearch')\n .valueChanges.subscribe((newValue: SkyCountryFieldCountry) => {\n if (newValue && newValue.iso2 !== this.selectedCountry.iso2) {\n this.selectedCountry = newValue;\n }\n });\n }\n\n public ngOnDestroy(): void {\n this.selectedCountryChange.complete();\n }\n\n /**\n * Sets the country to validate against based on the county's iso2 code.\n * @param countryCode The International Organization for Standardization's two-letter code\n * for the default country.\n * @internal\n */\n public onCountrySelected(newCountry: SkyCountryFieldCountry): void {\n if (newCountry) {\n this.selectedCountry = this.countries.find(\n (countryInfo) => countryInfo.iso2 === newCountry.iso2\n );\n this.toggleCountrySearch(false);\n }\n }\n\n public toggleCountrySearch(showSearch: boolean): void {\n this.phoneInputAnimationTriggered = true;\n\n if (showSearch) {\n this.phoneInputShown = false;\n } else {\n this.countrySearchShown = false;\n\n this.countrySearchForm.get('countrySearch').setValue(undefined);\n }\n\n this.changeDetector.markForCheck();\n }\n\n public countrySearchAnimationEnd(e: AnimationEvent) {\n if (!this.countrySearchShown) {\n this.phoneInputShown = true;\n } else {\n this.adapterService.focusCountrySearchElement(e.element);\n }\n\n this.changeDetector.markForCheck();\n }\n\n public phoneInputAnimationEnd(e: AnimationEvent) {\n if (!this.phoneInputShown) {\n this.countrySearchShown = true;\n } else {\n if (this.phoneInputAnimationTriggered) {\n this.adapterService.focusPhoneInput(e.element);\n this.phoneInputAnimationTriggered = false;\n }\n }\n\n this.changeDetector.markForCheck();\n }\n\n public setCountryByDialCode(phoneNumber: string): boolean {\n if (!phoneNumber || !phoneNumber.startsWith('+')) {\n return false;\n }\n\n let newCountry: SkyPhoneFieldCountry;\n\n for (let i = 1; i < this.longestDialCodeLength + 1; i++) {\n let dialCode = phoneNumber.substring(0, i);\n\n let foundCountry = this.countries.find(\n (country) => country.dialCode === dialCode && country.priority === 0\n );\n\n if (foundCountry) {\n // Ensure that the country that was found is one of the supported countries\n if (\n this.supportedCountryISOs &&\n this.supportedCountryISOs.findIndex(\n (isoCode) =>\n isoCode.toUpperCase() === foundCountry.iso2.toUpperCase()\n ) < 0\n ) {\n foundCountry = undefined;\n }\n\n if (foundCountry !== this.selectedCountry) {\n newCountry = foundCountry;\n }\n }\n }\n\n if (newCountry) {\n this.selectedCountry = newCountry;\n this.changeDetector.markForCheck();\n return true;\n }\n\n return false;\n }\n}\n","<ng-container *ngIf=\"!inputBoxHostSvc\">\n <div class=\"sky-input-group sky-phone-field\" [@blockAnimationOnLoad]>\n <ng-container *ngTemplateOutlet=\"countryBtnTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplateRef\"></ng-container>\n </div>\n</ng-container>\n\n<ng-template #countryBtnTemplateRef>\n <div\n class=\"sky-input-group-btn sky-phone-field-country-btn\"\n [attr.data-sky-test-iso2]=\"selectedCountry?.iso2\"\n [attr.data-sky-test-name]=\"selectedCountry?.name\"\n >\n <button\n aria-live=\"polite\"\n class=\"sky-btn sky-btn-default\"\n type=\"button\"\n [attr.title]=\"\n ('skyux_phone_field_country_select_label' | skyLibResources) +\n ' ' +\n ('skyux_phone_field_country_selected_label'\n | skyLibResources: selectedCountry?.name)\n \"\n [attr.aria-label]=\"\n ('skyux_phone_field_country_select_label' | skyLibResources) +\n ' ' +\n ('skyux_phone_field_country_selected_label'\n | skyLibResources: selectedCountry?.name)\n \"\n [disabled]=\"countrySelectDisabled\"\n (click)=\"toggleCountrySearch(true)\"\n >\n <div\n class=\"sky-phone-field-flag iti-flag\"\n [ngClass]=\"selectedCountry?.iso2\"\n ></div>\n </button>\n </div>\n</ng-template>\n\n<ng-template #inputTemplateRef>\n <span\n *ngIf=\"phoneInputShown\"\n class=\"sky-phone-field-container\"\n [@.disabled]=\"\n inputBoxHostSvc &&\n (themeSvc?.settingsChange | async)?.currentSettings?.theme?.name ===\n 'modern'\n \"\n [@phoneInputAnimation]=\"phoneInputShown ? 'open' : 'closed'\"\n (@phoneInputAnimation.done)=\"phoneInputAnimationEnd($event)\"\n >\n <ng-content></ng-content>\n </span>\n <span\n *ngIf=\"countrySearchShown\"\n class=\"sky-phone-field-container\"\n [@.disabled]=\"\n inputBoxHostSvc &&\n (themeSvc?.settingsChange | async)?.currentSettings?.theme?.name ===\n 'modern'\n \"\n [@countrySearchAnimation]=\"countrySearchShown ? 'open' : 'closed'\"\n (@countrySearchAnimation.done)=\"countrySearchAnimationEnd($event)\"\n >\n <div class=\"sky-phone-field-country-search\" [formGroup]=\"countrySearchForm\">\n <sky-country-field\n formControlName=\"countrySearch\"\n [defaultCountry]=\"defaultCountry\"\n [hideSelectedCountryFlag]=\"true\"\n [includePhoneInfo]=\"true\"\n [supportedCountryISOs]=\"supportedCountryISOs\"\n (selectedCountryChange)=\"onCountrySelected($event)\"\n >\n </sky-country-field>\n </div>\n </span>\n</ng-template>\n\n<ng-template #buttonsInsetTemplateRef>\n <div\n *ngIf=\"countrySearchShown\"\n class=\"sky-input-group-btn sky-input-box-btn-inset sky-search-item-dismiss\"\n >\n <button\n class=\"sky-btn sky-phone-field-search-btn-dismiss\"\n type=\"button\"\n [attr.title]=\"\n 'skyux_phone_field_country_search_dismiss' | skyLibResources\n \"\n [ngClass]=\"{\n 'sky-btn-default':\n (themeSvc?.settingsChange | async)?.currentSettings?.theme?.name ===\n 'modern'\n }\"\n (click)=\"toggleCountrySearch(false)\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-circle-left\" size=\"lg\">\n </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"double-chevron-left\"\n iconType=\"skyux\"\n size=\"2x\"\n >\n </sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template let-item=\"item\" #countrySearchResultTemplate>\n <div class=\"sky-phone-field-search-result\">\n <i\n aria-hidden=\"true\"\n [className]=\"'sky-phone-field-flag iti-flag ' + item.iso2\"\n ></i>\n {{ item.name }}\n <span class=\"sky-deemphasized\">{{ item.dialCode }}</span>\n </div>\n</ng-template>\n"]}
1
+ {"version":3,"file":"phone-field.component.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field.component.ts","../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field.component.html"],"names":[],"mappings":"AAAA,OAAO,EAEL,OAAO,EACP,KAAK,EACL,UAAU,EACV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;qBACH;iBACF;;0BAkII,QAAQ;;0BACR,QAAQ;;0BAAI,QAAQ;4CA5HhB,eAAe;sBADrB,KAAK;gBAWK,cAAc;sBADxB,KAAK;gBAqBC,YAAY;sBADlB,KAAK;gBAQC,oBAAoB;sBAD1B,KAAK;gBASC,qBAAqB;sBAD3B,MAAM;gBAiBI,eAAe;sBADzB,KAAK;gBAiCE,gBAAgB;sBAJvB,SAAS;uBAAC,kBAAkB,EAAE;wBAC7B,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb;gBAOO,qBAAqB;sBAJ5B,SAAS;uBAAC,uBAAuB,EAAE;wBAClC,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb;gBAOO,uBAAuB;sBAJ9B,SAAS;uBAAC,yBAAyB,EAAE;wBACpC,IAAI,EAAE,WAAW;wBACjB,MAAM,EAAE,IAAI;qBACb","sourcesContent":["import {\n AnimationEvent,\n animate,\n style,\n transition,\n trigger,\n} from '@angular/animations';\nimport {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n EventEmitter,\n Input,\n OnDestroy,\n OnInit,\n Optional,\n Output,\n SkipSelf,\n TemplateRef,\n ViewChild,\n ViewEncapsulation,\n} from '@angular/core';\nimport { FormBuilder, FormControl, FormGroup } from '@angular/forms';\nimport { SkyInputBoxHostService } from '@skyux/forms';\nimport { SkyCountryFieldCountry } from '@skyux/lookup';\nimport { SkyThemeService } from '@skyux/theme';\n\nimport {\n PhoneNumberFormat,\n PhoneNumberType,\n PhoneNumberUtil,\n} from 'google-libphonenumber';\nimport 'intl-tel-input';\n\nimport { SkyPhoneFieldAdapterService } from './phone-field-adapter.service';\nimport { SkyPhoneFieldCountry } from './types/country';\nimport { SkyPhoneFieldNumberReturnFormat } from './types/number-return-format';\n\n// NOTE: The no-op animation is here in order to block the input's \"fade in\" animation\n// from firing on initial load. For more information on this technique you can see\n// https://www.bennadel.com/blog/3417-using-no-op-transitions-to-prevent-animation-during-the-initial-render-of-ngfor-in-angular-5-2-6.htm\n@Component({\n selector: 'sky-phone-field',\n templateUrl: './phone-field.component.html',\n styleUrls: ['./phone-field.component.scss'],\n encapsulation: ViewEncapsulation.None,\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n SkyPhoneFieldAdapterService,\n // Prevents the embedded country field component from changing its behavior based on\n // being inside an input box. The phone field itself will handle the required changes\n // for input box.\n {\n provide: SkyInputBoxHostService,\n useValue: undefined,\n },\n ],\n animations: [\n trigger('blockAnimationOnLoad', [transition(':enter', [])]),\n trigger('countrySearchAnimation', [\n transition(':enter', [\n style({\n opacity: 0,\n width: 0,\n }),\n animate(\n '200ms ease-in',\n style({\n opacity: 1,\n width: '*',\n })\n ),\n ]),\n transition(':leave', [\n animate(\n '200ms ease-in',\n style({\n opacity: 0,\n width: 0,\n })\n ),\n ]),\n ]),\n trigger('phoneInputAnimation', [\n transition(':enter', [\n style({\n opacity: 0,\n }),\n animate(\n '150ms ease-in',\n style({\n opacity: 1,\n })\n ),\n ]),\n transition(':leave', [\n animate(\n '150ms ease-in',\n style({\n opacity: 0,\n })\n ),\n ]),\n ]),\n ],\n})\nexport class SkyPhoneFieldComponent implements OnDestroy, OnInit {\n /**\n * Indicates whether or not phone number extensions are allowed.\n * @default true\n */\n @Input()\n public allowExtensions = true;\n\n /**\n * Specifies the\n * [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)\n * country code for the default country. The country selector button displays a flag\n * icon for this default country until users select a different country.\n * @default \"us\"\n */\n @Input()\n public set defaultCountry(value: string) {\n if (value && value !== this._defaultCountry) {\n this._defaultCountry = value.toLowerCase();\n\n this.defaultCountryData = this.countries.find(\n (country) => country.iso2 === this._defaultCountry\n );\n }\n }\n\n public get defaultCountry(): string {\n return this._defaultCountry;\n }\n\n /**\n * Specifies the format for validated phone numbers.\n * Options include: `\"default\"`, `\"international\"`, and `\"national\"`.\n * @default \"default\"\n */\n @Input()\n public returnFormat: SkyPhoneFieldNumberReturnFormat = 'default';\n\n /**\n * Specifies the [International Organization for Standardization Alpha 2](https://www.nationsonline.org/oneworld/country_code_list.htm)\n * country codes for the countries that users can select. By default, all countries are available.\n */\n @Input()\n public supportedCountryISOs: string[];\n\n /**\n * Emits a `SkyPhoneFieldCountry` object when the selected country in the country search\n * input changes.\n */\n\n @Output()\n public selectedCountryChange = new EventEmitter<SkyPhoneFieldCountry>();\n\n public countries: SkyPhoneFieldCountry[];\n\n public countrySelectDisabled = false;\n\n public countrySearchShown = false;\n\n public phoneInputShown = true;\n\n public countrySearchForm: FormGroup;\n\n /**\n * Specifies the currently selected country to validate against.\n */\n @Input()\n public set selectedCountry(newCountry: SkyPhoneFieldCountry) {\n if (\n newCountry &&\n (!this._selectedCountry || this._selectedCountry.iso2 !== newCountry.iso2)\n ) {\n this._selectedCountry = this.countries.find(\n (country) => country.iso2 === newCountry.iso2\n );\n\n if (!this._selectedCountry.exampleNumber) {\n const numberObj = this.phoneUtils.getExampleNumberForType(\n newCountry.iso2,\n PhoneNumberType.FIXED_LINE\n );\n this._selectedCountry.exampleNumber = this.phoneUtils.format(\n numberObj,\n PhoneNumberFormat.NATIONAL\n );\n }\n\n this.selectedCountryChange.emit(this._selectedCountry);\n }\n }\n\n public get selectedCountry(): SkyPhoneFieldCountry {\n return this._selectedCountry;\n }\n\n @ViewChild('inputTemplateRef', {\n read: TemplateRef,\n static: true,\n })\n private inputTemplateRef: TemplateRef<any>;\n\n @ViewChild('countryBtnTemplateRef', {\n read: TemplateRef,\n static: true,\n })\n private countryBtnTemplateRef: TemplateRef<any>;\n\n @ViewChild('buttonsInsetTemplateRef', {\n read: TemplateRef,\n static: true,\n })\n private buttonsInsetTemplateRef: TemplateRef<any>;\n\n private defaultCountryData: SkyPhoneFieldCountry;\n\n private phoneInputAnimationTriggered = false;\n\n private phoneUtils = PhoneNumberUtil.getInstance();\n\n private longestDialCodeLength = 0;\n\n private _defaultCountry: string;\n\n private _selectedCountry: SkyPhoneFieldCountry;\n\n constructor(\n private formBuilder: FormBuilder,\n private adapterService: SkyPhoneFieldAdapterService,\n private changeDetector: ChangeDetectorRef,\n @Optional() public themeSvc?: SkyThemeService,\n @Optional() @SkipSelf() public inputBoxHostSvc?: SkyInputBoxHostService\n ) {\n /**\n * The json functions here ensures that we get a copy of the array and not the global original.\n * This ensures that multiple instances of the component don't overwrite the original data.\n *\n * We must type the window object as any here as the intl-tel-input library adds its object\n * to the main window object.\n */\n this.countries = JSON.parse(\n JSON.stringify((window as any).intlTelInputGlobals.getCountryData())\n );\n for (const country of this.countries) {\n country.dialCode = '+' + country.dialCode;\n\n if (country.dialCode.length > this.longestDialCodeLength) {\n this.longestDialCodeLength = country.dialCode.length;\n }\n }\n\n this.countrySearchForm = this.formBuilder.group({\n countrySearch: new FormControl(),\n });\n }\n\n public ngOnInit(): void {\n // The timeout here is needed to avoid a change before checked error when a user specifies\n // a selected country on initialization of the component.\n setTimeout(() => {\n if (this.inputBoxHostSvc) {\n this.inputBoxHostSvc.populate({\n inputTemplate: this.inputTemplateRef,\n buttonsInsetTemplate: this.buttonsInsetTemplateRef,\n buttonsLeftTemplate: this.countryBtnTemplateRef,\n });\n }\n\n if (!this.defaultCountry) {\n this.defaultCountry = 'us';\n }\n\n if (!this.selectedCountry) {\n this.selectedCountry = this.defaultCountryData;\n }\n this.changeDetector.markForCheck();\n }, 0);\n\n this.countrySearchForm\n .get('countrySearch')\n .valueChanges.subscribe((newValue: SkyCountryFieldCountry) => {\n if (newValue && newValue.iso2 !== this.selectedCountry.iso2) {\n this.selectedCountry = newValue;\n }\n });\n }\n\n public ngOnDestroy(): void {\n this.selectedCountryChange.complete();\n }\n\n /**\n * Sets the country to validate against based on the county's iso2 code.\n * @param countryCode The International Organization for Standardization's two-letter code\n * for the default country.\n * @internal\n */\n public onCountrySelected(newCountry: SkyCountryFieldCountry): void {\n if (newCountry) {\n this.selectedCountry = this.countries.find(\n (countryInfo) => countryInfo.iso2 === newCountry.iso2\n );\n this.toggleCountrySearch(false);\n }\n }\n\n public toggleCountrySearch(showSearch: boolean): void {\n this.phoneInputAnimationTriggered = true;\n\n if (showSearch) {\n this.phoneInputShown = false;\n } else {\n this.countrySearchShown = false;\n\n this.countrySearchForm.get('countrySearch').setValue(undefined);\n }\n\n this.changeDetector.markForCheck();\n }\n\n public countrySearchAnimationEnd(e: AnimationEvent) {\n if (!this.countrySearchShown) {\n this.phoneInputShown = true;\n } else {\n this.adapterService.focusCountrySearchElement(e.element);\n }\n\n this.changeDetector.markForCheck();\n }\n\n public phoneInputAnimationEnd(e: AnimationEvent) {\n if (!this.phoneInputShown) {\n this.countrySearchShown = true;\n } else {\n if (this.phoneInputAnimationTriggered) {\n this.adapterService.focusPhoneInput(e.element);\n this.phoneInputAnimationTriggered = false;\n }\n }\n\n this.changeDetector.markForCheck();\n }\n\n public setCountryByDialCode(phoneNumber: string): boolean {\n if (!phoneNumber || !phoneNumber.startsWith('+')) {\n return false;\n }\n\n let newCountry: SkyPhoneFieldCountry;\n\n for (let i = 1; i < this.longestDialCodeLength + 1; i++) {\n const dialCode = phoneNumber.substring(0, i);\n\n let foundCountry = this.countries.find(\n (country) => country.dialCode === dialCode && country.priority === 0\n );\n\n if (foundCountry) {\n // Ensure that the country that was found is one of the supported countries\n if (\n this.supportedCountryISOs &&\n this.supportedCountryISOs.findIndex(\n (isoCode) =>\n isoCode.toUpperCase() === foundCountry.iso2.toUpperCase()\n ) < 0\n ) {\n foundCountry = undefined;\n }\n\n if (foundCountry !== this.selectedCountry) {\n newCountry = foundCountry;\n }\n }\n }\n\n if (newCountry) {\n this.selectedCountry = newCountry;\n this.changeDetector.markForCheck();\n return true;\n }\n\n return false;\n }\n}\n","<ng-container *ngIf=\"!inputBoxHostSvc\">\n <div class=\"sky-input-group sky-phone-field\" [@blockAnimationOnLoad]>\n <ng-container *ngTemplateOutlet=\"countryBtnTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"inputTemplateRef\"></ng-container>\n <ng-container *ngTemplateOutlet=\"buttonsInsetTemplateRef\"></ng-container>\n </div>\n</ng-container>\n\n<ng-template #countryBtnTemplateRef>\n <div\n class=\"sky-input-group-btn sky-phone-field-country-btn\"\n [attr.data-sky-test-iso2]=\"selectedCountry?.iso2\"\n [attr.data-sky-test-name]=\"selectedCountry?.name\"\n >\n <button\n aria-live=\"polite\"\n class=\"sky-btn sky-btn-default\"\n type=\"button\"\n [attr.title]=\"\n ('skyux_phone_field_country_select_label' | skyLibResources) +\n ' ' +\n ('skyux_phone_field_country_selected_label'\n | skyLibResources: selectedCountry?.name)\n \"\n [attr.aria-label]=\"\n ('skyux_phone_field_country_select_label' | skyLibResources) +\n ' ' +\n ('skyux_phone_field_country_selected_label'\n | skyLibResources: selectedCountry?.name)\n \"\n [disabled]=\"countrySelectDisabled\"\n (click)=\"toggleCountrySearch(true)\"\n >\n <div\n class=\"sky-phone-field-flag iti-flag\"\n [ngClass]=\"selectedCountry?.iso2\"\n ></div>\n </button>\n </div>\n</ng-template>\n\n<ng-template #inputTemplateRef>\n <span\n *ngIf=\"phoneInputShown\"\n class=\"sky-phone-field-container\"\n [@.disabled]=\"\n inputBoxHostSvc &&\n (themeSvc?.settingsChange | async)?.currentSettings?.theme?.name ===\n 'modern'\n \"\n [@phoneInputAnimation]=\"phoneInputShown ? 'open' : 'closed'\"\n (@phoneInputAnimation.done)=\"phoneInputAnimationEnd($event)\"\n >\n <ng-content></ng-content>\n </span>\n <span\n *ngIf=\"countrySearchShown\"\n class=\"sky-phone-field-container\"\n [@.disabled]=\"\n inputBoxHostSvc &&\n (themeSvc?.settingsChange | async)?.currentSettings?.theme?.name ===\n 'modern'\n \"\n [@countrySearchAnimation]=\"countrySearchShown ? 'open' : 'closed'\"\n (@countrySearchAnimation.done)=\"countrySearchAnimationEnd($event)\"\n >\n <div class=\"sky-phone-field-country-search\" [formGroup]=\"countrySearchForm\">\n <sky-country-field\n formControlName=\"countrySearch\"\n [defaultCountry]=\"defaultCountry\"\n [hideSelectedCountryFlag]=\"true\"\n [includePhoneInfo]=\"true\"\n [supportedCountryISOs]=\"supportedCountryISOs\"\n (selectedCountryChange)=\"onCountrySelected($event)\"\n >\n </sky-country-field>\n </div>\n </span>\n</ng-template>\n\n<ng-template #buttonsInsetTemplateRef>\n <div\n *ngIf=\"countrySearchShown\"\n class=\"sky-input-group-btn sky-input-box-btn-inset sky-search-item-dismiss\"\n >\n <button\n class=\"sky-btn sky-phone-field-search-btn-dismiss\"\n type=\"button\"\n [attr.title]=\"\n 'skyux_phone_field_country_search_dismiss' | skyLibResources\n \"\n [ngClass]=\"{\n 'sky-btn-default':\n (themeSvc?.settingsChange | async)?.currentSettings?.theme?.name ===\n 'modern'\n }\"\n (click)=\"toggleCountrySearch(false)\"\n >\n <sky-icon *skyThemeIf=\"'default'\" icon=\"chevron-circle-left\" size=\"lg\">\n </sky-icon>\n <sky-icon\n *skyThemeIf=\"'modern'\"\n icon=\"double-chevron-left\"\n iconType=\"skyux\"\n size=\"2x\"\n >\n </sky-icon>\n </button>\n </div>\n</ng-template>\n\n<ng-template let-item=\"item\" #countrySearchResultTemplate>\n <div class=\"sky-phone-field-search-result\">\n <i\n aria-hidden=\"true\"\n [className]=\"'sky-phone-field-flag iti-flag ' + item.iso2\"\n ></i>\n {{ item.name }}\n <span class=\"sky-deemphasized\">{{ item.dialCode }}</span>\n </div>\n</ng-template>\n"]}
@@ -1,13 +1,13 @@
1
- import { NgModule } from '@angular/core';
2
1
  import { CommonModule } from '@angular/common';
2
+ import { NgModule } from '@angular/core';
3
3
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
4
- import { SkyIconModule } from '@skyux/indicators';
5
4
  import { SkyI18nModule } from '@skyux/i18n';
5
+ import { SkyIconModule } from '@skyux/indicators';
6
6
  import { SkyCountryFieldModule } from '@skyux/lookup';
7
7
  import { SkyThemeModule } from '@skyux/theme';
8
8
  import { SkyPhoneFieldResourcesModule } from '../shared/sky-phone-field-resources.module';
9
- import { SkyPhoneFieldComponent } from './phone-field.component';
10
9
  import { SkyPhoneFieldInputDirective } from './phone-field-input.directive';
10
+ import { SkyPhoneFieldComponent } from './phone-field.component';
11
11
  import * as i0 from "@angular/core";
12
12
  export class SkyPhoneFieldModule {
13
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"phone-field.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;;AAgB5E,MAAM,OAAO,mBAAmB;;iHAAnB,mBAAmB;kHAAnB,mBAAmB,iBAbf,sBAAsB,EAAE,2BAA2B,aAEhE,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,qBAAqB;QACrB,aAAa;QACb,aAAa;QACb,4BAA4B;QAC5B,cAAc,aAEN,sBAAsB,EAAE,2BAA2B;kHAElD,mBAAmB,YAZrB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,qBAAqB;YACrB,aAAa;YACb,aAAa;YACb,4BAA4B;YAC5B,cAAc;SACf;4FAGU,mBAAmB;kBAd/B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;oBACnE,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,qBAAqB;wBACrB,aAAa;wBACb,aAAa;wBACb,4BAA4B;wBAC5B,cAAc;qBACf;oBACD,OAAO,EAAE,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;iBAC/D","sourcesContent":["import { NgModule } from '@angular/core';\n\nimport { CommonModule } from '@angular/common';\n\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\n\nimport { SkyIconModule } from '@skyux/indicators';\n\nimport { SkyI18nModule } from '@skyux/i18n';\n\nimport { SkyCountryFieldModule } from '@skyux/lookup';\n\nimport { SkyThemeModule } from '@skyux/theme';\n\nimport { SkyPhoneFieldResourcesModule } from '../shared/sky-phone-field-resources.module';\n\nimport { SkyPhoneFieldComponent } from './phone-field.component';\n\nimport { SkyPhoneFieldInputDirective } from './phone-field-input.directive';\n\n@NgModule({\n declarations: [SkyPhoneFieldComponent, SkyPhoneFieldInputDirective],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n SkyCountryFieldModule,\n SkyI18nModule,\n SkyIconModule,\n SkyPhoneFieldResourcesModule,\n SkyThemeModule,\n ],\n exports: [SkyPhoneFieldComponent, SkyPhoneFieldInputDirective],\n})\nexport class SkyPhoneFieldModule {}\n"]}
1
+ {"version":3,"file":"phone-field.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/phone-field/phone-field.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAE1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;;AAgBjE,MAAM,OAAO,mBAAmB;;iHAAnB,mBAAmB;kHAAnB,mBAAmB,iBAbf,sBAAsB,EAAE,2BAA2B,aAEhE,YAAY;QACZ,WAAW;QACX,mBAAmB;QACnB,qBAAqB;QACrB,aAAa;QACb,aAAa;QACb,4BAA4B;QAC5B,cAAc,aAEN,sBAAsB,EAAE,2BAA2B;kHAElD,mBAAmB,YAZrB;YACP,YAAY;YACZ,WAAW;YACX,mBAAmB;YACnB,qBAAqB;YACrB,aAAa;YACb,aAAa;YACb,4BAA4B;YAC5B,cAAc;SACf;4FAGU,mBAAmB;kBAd/B,QAAQ;mBAAC;oBACR,YAAY,EAAE,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;oBACnE,OAAO,EAAE;wBACP,YAAY;wBACZ,WAAW;wBACX,mBAAmB;wBACnB,qBAAqB;wBACrB,aAAa;wBACb,aAAa;wBACb,4BAA4B;wBAC5B,cAAc;qBACf;oBACD,OAAO,EAAE,CAAC,sBAAsB,EAAE,2BAA2B,CAAC;iBAC/D","sourcesContent":["import { CommonModule } from '@angular/common';\nimport { NgModule } from '@angular/core';\nimport { FormsModule, ReactiveFormsModule } from '@angular/forms';\nimport { SkyI18nModule } from '@skyux/i18n';\nimport { SkyIconModule } from '@skyux/indicators';\nimport { SkyCountryFieldModule } from '@skyux/lookup';\nimport { SkyThemeModule } from '@skyux/theme';\n\nimport { SkyPhoneFieldResourcesModule } from '../shared/sky-phone-field-resources.module';\n\nimport { SkyPhoneFieldInputDirective } from './phone-field-input.directive';\nimport { SkyPhoneFieldComponent } from './phone-field.component';\n\n@NgModule({\n declarations: [SkyPhoneFieldComponent, SkyPhoneFieldInputDirective],\n imports: [\n CommonModule,\n FormsModule,\n ReactiveFormsModule,\n SkyCountryFieldModule,\n SkyI18nModule,\n SkyIconModule,\n SkyPhoneFieldResourcesModule,\n SkyThemeModule,\n ],\n exports: [SkyPhoneFieldComponent, SkyPhoneFieldInputDirective],\n})\nexport class SkyPhoneFieldModule {}\n"]}
@@ -5,7 +5,7 @@
5
5
  * To update this file, simply rerun the command.
6
6
  */
7
7
  import { NgModule } from '@angular/core';
8
- import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS, } from '@skyux/i18n';
8
+ import { SKY_LIB_RESOURCES_PROVIDERS, SkyI18nModule, getLibStringForLocale, } from '@skyux/i18n';
9
9
  import * as i0 from "@angular/core";
10
10
  const RESOURCES = {
11
11
  'EN-US': {
@@ -1 +1 @@
1
- {"version":3,"file":"sky-phone-field-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/shared/sky-phone-field-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,qBAAqB,EAErB,aAAa,EAGb,2BAA2B,GAC5B,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,+BAA+B,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;QAC5D,wCAAwC,EAAE;YACxC,OAAO,EAAE,wBAAwB;SAClC;QACD,sCAAsC,EAAE;YACtC,OAAO,EAAE,wBAAwB;SAClC;QACD,4CAA4C,EAAE;YAC5C,OAAO,EAAE,sBAAsB;SAChC;QACD,sCAAsC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE;QACtE,wCAAwC,EAAE;YACxC,OAAO,EAAE,4BAA4B;SACtC;KACF;CACF,CAAC;AAEF,MAAM,OAAO,8BAA8B;IAClC,SAAS,CAAC,UAA4B,EAAE,IAAY;QACzD,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,4BAA4B;;0HAA5B,4BAA4B;2HAA5B,4BAA4B,YAT7B,aAAa;2HASZ,4BAA4B,aAR5B;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,8BAA8B;YACxC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,4BAA4B;kBAVxC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,8BAA8B;4BACxC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-phone-field' schematic.\n * To update this file, simply rerun the command.\n */\n\nimport { NgModule } from '@angular/core';\nimport {\n getLibStringForLocale,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n SKY_LIB_RESOURCES_PROVIDERS,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_phone_field_default_label: { message: 'Phone number' },\n skyux_phone_field_country_search_dismiss: {\n message: 'Dismiss country search',\n },\n skyux_phone_field_country_search_label: {\n message: 'Dismiss country search',\n },\n skyux_phone_field_country_search_placeholder: {\n message: 'Search for a country',\n },\n skyux_phone_field_country_select_label: { message: 'Choose country.' },\n skyux_phone_field_country_selected_label: {\n message: '{0} is currently selected.',\n },\n },\n};\n\nexport class SkyPhoneFieldResourcesProvider implements SkyLibResourcesProvider {\n public getString(localeInfo: SkyAppLocaleInfo, name: string): string {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyPhoneFieldResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyPhoneFieldResourcesModule {}\n"]}
1
+ {"version":3,"file":"sky-phone-field-resources.module.js","sourceRoot":"","sources":["../../../../../../../../libs/components/phone-field/src/lib/modules/shared/sky-phone-field-resources.module.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EACL,2BAA2B,EAE3B,aAAa,EAGb,qBAAqB,GACtB,MAAM,aAAa,CAAC;;AAErB,MAAM,SAAS,GAA0C;IACvD,OAAO,EAAE;QACP,+BAA+B,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE;QAC5D,wCAAwC,EAAE;YACxC,OAAO,EAAE,wBAAwB;SAClC;QACD,sCAAsC,EAAE;YACtC,OAAO,EAAE,wBAAwB;SAClC;QACD,4CAA4C,EAAE;YAC5C,OAAO,EAAE,sBAAsB;SAChC;QACD,sCAAsC,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE;QACtE,wCAAwC,EAAE;YACxC,OAAO,EAAE,4BAA4B;SACtC;KACF;CACF,CAAC;AAEF,MAAM,OAAO,8BAA8B;IAClC,SAAS,CAAC,UAA4B,EAAE,IAAY;QACzD,OAAO,qBAAqB,CAAC,SAAS,EAAE,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACnE,CAAC;CACF;AAED;;GAEG;AAWH,MAAM,OAAO,4BAA4B;;0HAA5B,4BAA4B;2HAA5B,4BAA4B,YAT7B,aAAa;2HASZ,4BAA4B,aAR5B;QACT;YACE,OAAO,EAAE,2BAA2B;YACpC,QAAQ,EAAE,8BAA8B;YACxC,KAAK,EAAE,IAAI;SACZ;KACF,YAPS,aAAa;4FASZ,4BAA4B;kBAVxC,QAAQ;mBAAC;oBACR,OAAO,EAAE,CAAC,aAAa,CAAC;oBACxB,SAAS,EAAE;wBACT;4BACE,OAAO,EAAE,2BAA2B;4BACpC,QAAQ,EAAE,8BAA8B;4BACxC,KAAK,EAAE,IAAI;yBACZ;qBACF;iBACF","sourcesContent":["/**\n * NOTICE: DO NOT MODIFY THIS FILE!\n * The contents of this file were automatically generated by\n * the 'ng generate @skyux/i18n:lib-resources-module modules/shared/sky-phone-field' schematic.\n * To update this file, simply rerun the command.\n */\nimport { NgModule } from '@angular/core';\nimport {\n SKY_LIB_RESOURCES_PROVIDERS,\n SkyAppLocaleInfo,\n SkyI18nModule,\n SkyLibResources,\n SkyLibResourcesProvider,\n getLibStringForLocale,\n} from '@skyux/i18n';\n\nconst RESOURCES: { [locale: string]: SkyLibResources } = {\n 'EN-US': {\n skyux_phone_field_default_label: { message: 'Phone number' },\n skyux_phone_field_country_search_dismiss: {\n message: 'Dismiss country search',\n },\n skyux_phone_field_country_search_label: {\n message: 'Dismiss country search',\n },\n skyux_phone_field_country_search_placeholder: {\n message: 'Search for a country',\n },\n skyux_phone_field_country_select_label: { message: 'Choose country.' },\n skyux_phone_field_country_selected_label: {\n message: '{0} is currently selected.',\n },\n },\n};\n\nexport class SkyPhoneFieldResourcesProvider implements SkyLibResourcesProvider {\n public getString(localeInfo: SkyAppLocaleInfo, name: string): string {\n return getLibStringForLocale(RESOURCES, localeInfo.locale, name);\n }\n}\n\n/**\n * Import into any component library module that needs to use resource strings.\n */\n@NgModule({\n exports: [SkyI18nModule],\n providers: [\n {\n provide: SKY_LIB_RESOURCES_PROVIDERS,\n useClass: SkyPhoneFieldResourcesProvider,\n multi: true,\n },\n ],\n})\nexport class SkyPhoneFieldResourcesModule {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"phone-field-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-fixture.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAE/C,OAAO,EAAE,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,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACxC,CAAC;KAAA;IAEO,YAAY,CAAC,OAAoB,EAAE,SAAiB;QAC1D,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;IAEa,uBAAuB;;YACnC,qDAAqD;YACrD,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAEhC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACnC,CAAC;KAAA;IAED;;OAEG;IACW,cAAc;;YAC1B,4EAA4E;YAC5E,6EAA6E;YAC7E,mFAAmF;YACnF,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACxE,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC5E,OAAO,SAAS,IAAI,WAAW,CAAC;QAClC,CAAC;KAAA;IAEO,qBAAqB,CAAC,KAAU;QACtC,4CAA4C;QAC5C,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,KAAK,OAAO,CAAC;IACjD,CAAC;CACF","sourcesContent":["import { DebugElement } from '@angular/core';\n\nimport { ComponentFixture } from '@angular/core/testing';\n\nimport { By } from '@angular/platform-browser';\n\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyCountryFieldFixture } from '@skyux/lookup/testing';\n\n/**\n * Provides information for and interaction with a SKY UX phone field component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPhoneFieldFixture {\n /**\n * The value of the input field for the phone field.\n */\n public get inputText(): string {\n return this.phoneFieldInput.value;\n }\n\n /**\n * This property is lazy loaded and should be accessed via the private countryFixture property.\n */\n private _countryFixture: SkyCountryFieldFixture;\n\n private _debugEl: DebugElement;\n\n constructor(\n private fixture: ComponentFixture<any>,\n private skyTestId: string\n ) {\n this._debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-phone-field'\n );\n\n // The country selector needs extra time to initialize.\n // Consumers shouldn't need to work around this so we do an extra detect here\n fixture.detectChanges();\n }\n\n /**\n * Blurs the phone field input and returns a promise that indicates when the action is complete.\n */\n public async blur(): Promise<void> {\n SkyAppTestUtility.fireDomEvent(this.phoneFieldInput, 'blur');\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns the selected country iso2 code.\n */\n public async getSelectedCountryIso2(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-iso2');\n }\n\n /**\n * Returns the selected country name.\n */\n public async getSelectedCountryName(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-name');\n }\n\n /**\n * Sets the value of the input field for the phone field.\n */\n public async setInputText(inputText: string): Promise<void> {\n const inputEl = this.phoneFieldInput;\n inputEl.value = inputText;\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'input');\n this.fixture.detectChanges();\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'change');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Opens the country selector, peforms a search, but makes no selection.\n * @param searchText The name of the country to select.\n * @returns The list of country names matching the search text.\n */\n public async searchCountry(searchText: string): Promise<string[]> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n const results = await countryFixture.search(searchText);\n\n await this.waitForCountrySelection();\n return results;\n }\n\n /**\n * Opens the country selector, performs a search, and selects the first result (if any).\n * @param searchText The name of the country to select.\n */\n public async selectCountry(searchText: string): Promise<void> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n await countryFixture.searchAndSelectFirstResult(searchText);\n\n return this.waitForCountrySelection();\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is disabled.\n */\n public async isDisabled(): Promise<boolean> {\n const disabled = this.phoneFieldInput.getAttribute('disabled');\n return this.coerceBooleanProperty(await disabled);\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is valid.\n */\n public async isValid(): Promise<boolean> {\n if (!(await this.hasFormControl())) {\n throw new Error(`Form control not found.`);\n }\n return this.phoneFieldInput.classList.contains('ng-valid');\n }\n\n private get countryElement(): HTMLInputElement {\n return this._debugEl.query(By.css('sky-country-field')).nativeElement;\n }\n\n private get countryFlagButtonContainer(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn'))\n .nativeElement;\n }\n\n private get countryFlagButton(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn .sky-btn'))\n .nativeElement;\n }\n\n private get phoneFieldInput(): HTMLInputElement {\n return this._debugEl.query(By.css('input[skyPhoneFieldInput]'))\n .nativeElement;\n }\n\n /**\n * The country-field can take a really long time to initialize. Since we can't perform an await\n * in our constructor, it's safest to do a lazy load of the country field to avoid any race\n * conditions where a test tries to access the sky-country-field element too quickly.\n */\n private async getCountryFixture(): Promise<SkyCountryFieldFixture> {\n if (this._countryFixture === undefined) {\n // tag the country field with a sky test id\n const countrySkyTestId = `${this.skyTestId}-country`;\n this.setSkyTestId(this.countryElement, countrySkyTestId);\n\n // initialize the country fixture\n this._countryFixture = new SkyCountryFieldFixture(\n this.fixture,\n countrySkyTestId\n );\n\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n }\n\n return this._countryFixture;\n }\n\n private async openCountrySelection(): Promise<void> {\n this.countryFlagButton.click();\n return this.waitForCountrySelection();\n }\n\n private setSkyTestId(element: HTMLElement, skyTestId: string): void {\n element.setAttribute('data-sky-id', skyTestId);\n }\n\n private async waitForCountrySelection(): Promise<void> {\n // any country selection needs extra time to complete\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Checks whether the form-field control has set up a form control.\n */\n private async hasFormControl(): Promise<boolean> {\n // If no form \"NgControl\" is bound to the form-field control, the form-field\n // is not able to forward any control status classes. Therefore if either the\n // \"ng-touched\" or \"ng-untouched\" class is set, we know that it has a form control.\n const isTouched = this.phoneFieldInput.classList.contains('ng-touched');\n const isUntouched = this.phoneFieldInput.classList.contains('ng-untouched');\n return isTouched || isUntouched;\n }\n\n private coerceBooleanProperty(value: any): boolean {\n // tslint:disable-next-line: no-null-keyword\n return value != null && `${value}` !== 'false';\n }\n}\n"]}
1
+ {"version":3,"file":"phone-field-fixture.js","sourceRoot":"","sources":["../../../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-fixture.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,2BAA2B,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAe/B,YACU,OAA8B,EAC9B,SAAiB;QADjB,YAAO,GAAP,OAAO,CAAuB;QAC9B,cAAS,GAAT,SAAS,CAAQ;QAEzB,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,uBAAuB,CACvD,OAAO,EACP,SAAS,EACT,iBAAiB,CAClB,CAAC;QAEF,uDAAuD;QACvD,6EAA6E;QAC7E,OAAO,CAAC,aAAa,EAAE,CAAC;IAC1B,CAAC;IA3BD;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;IACpC,CAAC;IAwBD;;OAEG;IACU,IAAI;;YACf,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YAC7D,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YA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,cAAc,CAAC,CAAC;YAC5E,OAAO,SAAS,IAAI,WAAW,CAAC;QAClC,CAAC;KAAA;IAEO,qBAAqB,CAAC,KAAU;QACtC,4CAA4C;QAC5C,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,KAAK,OAAO,CAAC;IACjD,CAAC;CACF","sourcesContent":["import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\nimport { SkyCountryFieldFixture } from '@skyux/lookup/testing';\n\n/**\n * Provides information for and interaction with a SKY UX phone field component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPhoneFieldFixture {\n /**\n * The value of the input field for the phone field.\n */\n public get inputText(): string {\n return this.phoneFieldInput.value;\n }\n\n /**\n * This property is lazy loaded and should be accessed via the private countryFixture property.\n */\n private _countryFixture: SkyCountryFieldFixture;\n\n private _debugEl: DebugElement;\n\n constructor(\n private fixture: ComponentFixture<any>,\n private skyTestId: string\n ) {\n this._debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-phone-field'\n );\n\n // The country selector needs extra time to initialize.\n // Consumers shouldn't need to work around this so we do an extra detect here\n fixture.detectChanges();\n }\n\n /**\n * Blurs the phone field input and returns a promise that indicates when the action is complete.\n */\n public async blur(): Promise<void> {\n SkyAppTestUtility.fireDomEvent(this.phoneFieldInput, 'blur');\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns the selected country iso2 code.\n */\n public async getSelectedCountryIso2(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-iso2');\n }\n\n /**\n * Returns the selected country name.\n */\n public async getSelectedCountryName(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-name');\n }\n\n /**\n * Sets the value of the input field for the phone field.\n */\n public async setInputText(inputText: string): Promise<void> {\n const inputEl = this.phoneFieldInput;\n inputEl.value = inputText;\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'input');\n this.fixture.detectChanges();\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'change');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Opens the country selector, peforms a search, but makes no selection.\n * @param searchText The name of the country to select.\n * @returns The list of country names matching the search text.\n */\n public async searchCountry(searchText: string): Promise<string[]> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n const results = await countryFixture.search(searchText);\n\n await this.waitForCountrySelection();\n return results;\n }\n\n /**\n * Opens the country selector, performs a search, and selects the first result (if any).\n * @param searchText The name of the country to select.\n */\n public async selectCountry(searchText: string): Promise<void> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n await countryFixture.searchAndSelectFirstResult(searchText);\n\n return this.waitForCountrySelection();\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is disabled.\n */\n public async isDisabled(): Promise<boolean> {\n const disabled = this.phoneFieldInput.getAttribute('disabled');\n return this.coerceBooleanProperty(await disabled);\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is valid.\n */\n public async isValid(): Promise<boolean> {\n if (!(await this.hasFormControl())) {\n throw new Error(`Form control not found.`);\n }\n return this.phoneFieldInput.classList.contains('ng-valid');\n }\n\n private get countryElement(): HTMLInputElement {\n return this._debugEl.query(By.css('sky-country-field')).nativeElement;\n }\n\n private get countryFlagButtonContainer(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn'))\n .nativeElement;\n }\n\n private get countryFlagButton(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn .sky-btn'))\n .nativeElement;\n }\n\n private get phoneFieldInput(): HTMLInputElement {\n return this._debugEl.query(By.css('input[skyPhoneFieldInput]'))\n .nativeElement;\n }\n\n /**\n * The country-field can take a really long time to initialize. Since we can't perform an await\n * in our constructor, it's safest to do a lazy load of the country field to avoid any race\n * conditions where a test tries to access the sky-country-field element too quickly.\n */\n private async getCountryFixture(): Promise<SkyCountryFieldFixture> {\n if (this._countryFixture === undefined) {\n // tag the country field with a sky test id\n const countrySkyTestId = `${this.skyTestId}-country`;\n this.setSkyTestId(this.countryElement, countrySkyTestId);\n\n // initialize the country fixture\n this._countryFixture = new SkyCountryFieldFixture(\n this.fixture,\n countrySkyTestId\n );\n\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n }\n\n return this._countryFixture;\n }\n\n private async openCountrySelection(): Promise<void> {\n this.countryFlagButton.click();\n return this.waitForCountrySelection();\n }\n\n private setSkyTestId(element: HTMLElement, skyTestId: string): void {\n element.setAttribute('data-sky-id', skyTestId);\n }\n\n private async waitForCountrySelection(): Promise<void> {\n // any country selection needs extra time to complete\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Checks whether the form-field control has set up a form control.\n */\n private async hasFormControl(): Promise<boolean> {\n // If no form \"NgControl\" is bound to the form-field control, the form-field\n // is not able to forward any control status classes. Therefore if either the\n // \"ng-touched\" or \"ng-untouched\" class is set, we know that it has a form control.\n const isTouched = this.phoneFieldInput.classList.contains('ng-touched');\n const isUntouched = this.phoneFieldInput.classList.contains('ng-untouched');\n return isTouched || isUntouched;\n }\n\n private coerceBooleanProperty(value: any): boolean {\n // tslint:disable-next-line: no-null-keyword\n return value != null && `${value}` !== 'false';\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"phone-field-testing.module.js","sourceRoot":"","sources":["../../../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-testing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAE5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;;AAWzD,MAAM,OAAO,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,YAPnC,mBAAmB;QAEnB,8DAA8D;QAC9D,4DAA4D;QAC5D,oBAAoB;yHAGX,0BAA0B,YAPnC,mBAAmB;QAEnB,8DAA8D;QAC9D,4DAA4D;QAC5D,oBAAoB;4FAGX,0BAA0B;kBATtC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,mBAAmB;wBAEnB,8DAA8D;wBAC9D,4DAA4D;wBAC5D,oBAAoB;qBACrB;iBACF","sourcesContent":["import { NgModule } from '@angular/core';\n\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\n\nimport { SkyPhoneFieldModule } from '@skyux/phone-field';\n\n@NgModule({\n exports: [\n SkyPhoneFieldModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n})\nexport class SkyPhoneFieldTestingModule {}\n"]}
1
+ {"version":3,"file":"phone-field-testing.module.js","sourceRoot":"","sources":["../../../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-testing.module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;;AAWzD,MAAM,OAAO,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,YAPnC,mBAAmB;QAEnB,8DAA8D;QAC9D,4DAA4D;QAC5D,oBAAoB;yHAGX,0BAA0B,YAPnC,mBAAmB;QAEnB,8DAA8D;QAC9D,4DAA4D;QAC5D,oBAAoB;4FAGX,0BAA0B;kBATtC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,mBAAmB;wBAEnB,8DAA8D;wBAC9D,4DAA4D;wBAC5D,oBAAoB;qBACrB;iBACF","sourcesContent":["import { NgModule } from '@angular/core';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyPhoneFieldModule } from '@skyux/phone-field';\n\n@NgModule({\n exports: [\n SkyPhoneFieldModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n})\nexport class SkyPhoneFieldTestingModule {}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"skyux-phone-field-testing.js","sources":["../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-testing.module.ts","../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-fixture.ts","../../../../../libs/components/phone-field/testing/src/skyux-phone-field-testing.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\n\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\n\nimport { SkyPhoneFieldModule } from '@skyux/phone-field';\n\n@NgModule({\n exports: [\n SkyPhoneFieldModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n})\nexport class SkyPhoneFieldTestingModule {}\n","import { DebugElement } from '@angular/core';\n\nimport { ComponentFixture } from '@angular/core/testing';\n\nimport { By } from '@angular/platform-browser';\n\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\n\nimport { SkyCountryFieldFixture } from '@skyux/lookup/testing';\n\n/**\n * Provides information for and interaction with a SKY UX phone field component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPhoneFieldFixture {\n /**\n * The value of the input field for the phone field.\n */\n public get inputText(): string {\n return this.phoneFieldInput.value;\n }\n\n /**\n * This property is lazy loaded and should be accessed via the private countryFixture property.\n */\n private _countryFixture: SkyCountryFieldFixture;\n\n private _debugEl: DebugElement;\n\n constructor(\n private fixture: ComponentFixture<any>,\n private skyTestId: string\n ) {\n this._debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-phone-field'\n );\n\n // The country selector needs extra time to initialize.\n // Consumers shouldn't need to work around this so we do an extra detect here\n fixture.detectChanges();\n }\n\n /**\n * Blurs the phone field input and returns a promise that indicates when the action is complete.\n */\n public async blur(): Promise<void> {\n SkyAppTestUtility.fireDomEvent(this.phoneFieldInput, 'blur');\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns the selected country iso2 code.\n */\n public async getSelectedCountryIso2(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-iso2');\n }\n\n /**\n * Returns the selected country name.\n */\n public async getSelectedCountryName(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-name');\n }\n\n /**\n * Sets the value of the input field for the phone field.\n */\n public async setInputText(inputText: string): Promise<void> {\n const inputEl = this.phoneFieldInput;\n inputEl.value = inputText;\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'input');\n this.fixture.detectChanges();\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'change');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Opens the country selector, peforms a search, but makes no selection.\n * @param searchText The name of the country to select.\n * @returns The list of country names matching the search text.\n */\n public async searchCountry(searchText: string): Promise<string[]> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n const results = await countryFixture.search(searchText);\n\n await this.waitForCountrySelection();\n return results;\n }\n\n /**\n * Opens the country selector, performs a search, and selects the first result (if any).\n * @param searchText The name of the country to select.\n */\n public async selectCountry(searchText: string): Promise<void> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n await countryFixture.searchAndSelectFirstResult(searchText);\n\n return this.waitForCountrySelection();\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is disabled.\n */\n public async isDisabled(): Promise<boolean> {\n const disabled = this.phoneFieldInput.getAttribute('disabled');\n return this.coerceBooleanProperty(await disabled);\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is valid.\n */\n public async isValid(): Promise<boolean> {\n if (!(await this.hasFormControl())) {\n throw new Error(`Form control not found.`);\n }\n return this.phoneFieldInput.classList.contains('ng-valid');\n }\n\n private get countryElement(): HTMLInputElement {\n return this._debugEl.query(By.css('sky-country-field')).nativeElement;\n }\n\n private get countryFlagButtonContainer(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn'))\n .nativeElement;\n }\n\n private get countryFlagButton(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn .sky-btn'))\n .nativeElement;\n }\n\n private get phoneFieldInput(): HTMLInputElement {\n return this._debugEl.query(By.css('input[skyPhoneFieldInput]'))\n .nativeElement;\n }\n\n /**\n * The country-field can take a really long time to initialize. Since we can't perform an await\n * in our constructor, it's safest to do a lazy load of the country field to avoid any race\n * conditions where a test tries to access the sky-country-field element too quickly.\n */\n private async getCountryFixture(): Promise<SkyCountryFieldFixture> {\n if (this._countryFixture === undefined) {\n // tag the country field with a sky test id\n const countrySkyTestId = `${this.skyTestId}-country`;\n this.setSkyTestId(this.countryElement, countrySkyTestId);\n\n // initialize the country fixture\n this._countryFixture = new SkyCountryFieldFixture(\n this.fixture,\n countrySkyTestId\n );\n\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n }\n\n return this._countryFixture;\n }\n\n private async openCountrySelection(): Promise<void> {\n this.countryFlagButton.click();\n return this.waitForCountrySelection();\n }\n\n private setSkyTestId(element: HTMLElement, skyTestId: string): void {\n element.setAttribute('data-sky-id', skyTestId);\n }\n\n private async waitForCountrySelection(): Promise<void> {\n // any country selection needs extra time to complete\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Checks whether the form-field control has set up a form control.\n */\n private async hasFormControl(): Promise<boolean> {\n // If no form \"NgControl\" is bound to the form-field control, the form-field\n // is not able to forward any control status classes. Therefore if either the\n // \"ng-touched\" or \"ng-untouched\" class is set, we know that it has a form control.\n const isTouched = this.phoneFieldInput.classList.contains('ng-touched');\n const isUntouched = this.phoneFieldInput.classList.contains('ng-untouched');\n return isTouched || isUntouched;\n }\n\n private coerceBooleanProperty(value: any): boolean {\n // tslint:disable-next-line: no-null-keyword\n return value != null && `${value}` !== 'false';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAea,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,YAPnC,mBAAmB;;;QAInB,oBAAoB;yHAGX,0BAA0B,YAPnC,mBAAmB;;;QAInB,oBAAoB;4FAGX,0BAA0B;kBATtC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,mBAAmB;;;wBAInB,oBAAoB;qBACrB;iBACF;;;ACJD;;;;;MAKa,oBAAoB;IAe/B,YACU,OAA8B,EAC9B,SAAiB;QADjB,YAAO,GAAP,OAAO,CAAuB;QAC9B,cAAS,GAAT,SAAS,CAAQ;QAEzB,IAAI,CAAC,QAAQ,GAAG,iBAAiB,CAAC,uBAAuB,CACvD,OAAO,EACP,SAAS,EACT,iBAAiB,CAClB,CAAC;;;QAIF,OAAO,CAAC,aAAa,EAAE,CAAC;KACzB;;;;IAxBD,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;KACnC;;;;IA2BY,IAAI;;YACf,iBAAiB,CAAC,YAAY,CAAC,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;YAC7D,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAClC;KAAA;;;;IAKY,sBAAsB;;;YAEjC,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC,0BAA0B,CAAC,YAAY,CAAC,oBAAoB,CAAC,CAAC;SAC3E;KAAA;;;;IAKY,sBAAsB;;;YAEj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jC;YAED,OAAO,IAAI,CAAC,eAAe,CAAC;SAC7B;KAAA;IAEa,oBAAoB;;YAChC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;YAC/B,OAAO,IAAI,CAAC,uBAAuB,EAAE,CAAC;SACvC;KAAA;IAEO,YAAY,CAAC,OAAoB,EAAE,SAAiB;QAC1D,OAAO,CAAC,YAAY,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;KAChD;IAEa,uBAAuB;;;YAEnC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAEhC,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;SAClC;KAAA;;;;IAKa,cAAc;;;;;YAI1B,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACxE,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC5E,OAAO,SAAS,IAAI,WAAW,CAAC;SACjC;KAAA;IAEO,qBAAqB,CAAC,KAAU;;QAEtC,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,KAAK,OAAO,CAAC;KAChD;;;AClNH;;;;;;"}
1
+ {"version":3,"file":"skyux-phone-field-testing.js","sources":["../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-testing.module.ts","../../../../../libs/components/phone-field/testing/src/phonefield/phone-field-fixture.ts","../../../../../libs/components/phone-field/testing/src/skyux-phone-field-testing.ts"],"sourcesContent":["import { NgModule } from '@angular/core';\nimport { NoopAnimationsModule } from '@angular/platform-browser/animations';\nimport { SkyPhoneFieldModule } from '@skyux/phone-field';\n\n@NgModule({\n exports: [\n SkyPhoneFieldModule,\n\n // The noop animations module needs to be loaded last to avoid\n // subsequent modules adding animations and overriding this.\n NoopAnimationsModule,\n ],\n})\nexport class SkyPhoneFieldTestingModule {}\n","import { DebugElement } from '@angular/core';\nimport { ComponentFixture } from '@angular/core/testing';\nimport { By } from '@angular/platform-browser';\nimport { SkyAppTestUtility } from '@skyux-sdk/testing';\nimport { SkyCountryFieldFixture } from '@skyux/lookup/testing';\n\n/**\n * Provides information for and interaction with a SKY UX phone field component.\n * By using the fixture API, a test insulates itself against updates to the internals\n * of a component, such as changing its DOM structure.\n */\nexport class SkyPhoneFieldFixture {\n /**\n * The value of the input field for the phone field.\n */\n public get inputText(): string {\n return this.phoneFieldInput.value;\n }\n\n /**\n * This property is lazy loaded and should be accessed via the private countryFixture property.\n */\n private _countryFixture: SkyCountryFieldFixture;\n\n private _debugEl: DebugElement;\n\n constructor(\n private fixture: ComponentFixture<any>,\n private skyTestId: string\n ) {\n this._debugEl = SkyAppTestUtility.getDebugElementByTestId(\n fixture,\n skyTestId,\n 'sky-phone-field'\n );\n\n // The country selector needs extra time to initialize.\n // Consumers shouldn't need to work around this so we do an extra detect here\n fixture.detectChanges();\n }\n\n /**\n * Blurs the phone field input and returns a promise that indicates when the action is complete.\n */\n public async blur(): Promise<void> {\n SkyAppTestUtility.fireDomEvent(this.phoneFieldInput, 'blur');\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Returns the selected country iso2 code.\n */\n public async getSelectedCountryIso2(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-iso2');\n }\n\n /**\n * Returns the selected country name.\n */\n public async getSelectedCountryName(): Promise<string> {\n // Wait for the country field to initialize.\n await this.fixture.whenStable();\n return this.countryFlagButtonContainer.getAttribute('data-sky-test-name');\n }\n\n /**\n * Sets the value of the input field for the phone field.\n */\n public async setInputText(inputText: string): Promise<void> {\n const inputEl = this.phoneFieldInput;\n inputEl.value = inputText;\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'input');\n this.fixture.detectChanges();\n\n SkyAppTestUtility.fireDomEvent(inputEl, 'change');\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Opens the country selector, peforms a search, but makes no selection.\n * @param searchText The name of the country to select.\n * @returns The list of country names matching the search text.\n */\n public async searchCountry(searchText: string): Promise<string[]> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n const results = await countryFixture.search(searchText);\n\n await this.waitForCountrySelection();\n return results;\n }\n\n /**\n * Opens the country selector, performs a search, and selects the first result (if any).\n * @param searchText The name of the country to select.\n */\n public async selectCountry(searchText: string): Promise<void> {\n await this.openCountrySelection();\n\n const countryFixture = await this.getCountryFixture();\n await countryFixture.searchAndSelectFirstResult(searchText);\n\n return this.waitForCountrySelection();\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is disabled.\n */\n public async isDisabled(): Promise<boolean> {\n const disabled = this.phoneFieldInput.getAttribute('disabled');\n return this.coerceBooleanProperty(await disabled);\n }\n\n /**\n * Gets a boolean promise indicating if the phone field is valid.\n */\n public async isValid(): Promise<boolean> {\n if (!(await this.hasFormControl())) {\n throw new Error(`Form control not found.`);\n }\n return this.phoneFieldInput.classList.contains('ng-valid');\n }\n\n private get countryElement(): HTMLInputElement {\n return this._debugEl.query(By.css('sky-country-field')).nativeElement;\n }\n\n private get countryFlagButtonContainer(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn'))\n .nativeElement;\n }\n\n private get countryFlagButton(): HTMLInputElement {\n return this._debugEl.query(By.css('.sky-phone-field-country-btn .sky-btn'))\n .nativeElement;\n }\n\n private get phoneFieldInput(): HTMLInputElement {\n return this._debugEl.query(By.css('input[skyPhoneFieldInput]'))\n .nativeElement;\n }\n\n /**\n * The country-field can take a really long time to initialize. Since we can't perform an await\n * in our constructor, it's safest to do a lazy load of the country field to avoid any race\n * conditions where a test tries to access the sky-country-field element too quickly.\n */\n private async getCountryFixture(): Promise<SkyCountryFieldFixture> {\n if (this._countryFixture === undefined) {\n // tag the country field with a sky test id\n const countrySkyTestId = `${this.skyTestId}-country`;\n this.setSkyTestId(this.countryElement, countrySkyTestId);\n\n // initialize the country fixture\n this._countryFixture = new SkyCountryFieldFixture(\n this.fixture,\n countrySkyTestId\n );\n\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n }\n\n return this._countryFixture;\n }\n\n private async openCountrySelection(): Promise<void> {\n this.countryFlagButton.click();\n return this.waitForCountrySelection();\n }\n\n private setSkyTestId(element: HTMLElement, skyTestId: string): void {\n element.setAttribute('data-sky-id', skyTestId);\n }\n\n private async waitForCountrySelection(): Promise<void> {\n // any country selection needs extra time to complete\n this.fixture.detectChanges();\n await this.fixture.whenStable();\n\n this.fixture.detectChanges();\n return this.fixture.whenStable();\n }\n\n /**\n * Checks whether the form-field control has set up a form control.\n */\n private async hasFormControl(): Promise<boolean> {\n // If no form \"NgControl\" is bound to the form-field control, the form-field\n // is not able to forward any control status classes. Therefore if either the\n // \"ng-touched\" or \"ng-untouched\" class is set, we know that it has a form control.\n const isTouched = this.phoneFieldInput.classList.contains('ng-touched');\n const isUntouched = this.phoneFieldInput.classList.contains('ng-untouched');\n return isTouched || isUntouched;\n }\n\n private coerceBooleanProperty(value: any): boolean {\n // tslint:disable-next-line: no-null-keyword\n return value != null && `${value}` !== 'false';\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;MAaa,0BAA0B;;wHAA1B,0BAA0B;yHAA1B,0BAA0B,YAPnC,mBAAmB;;;QAInB,oBAAoB;yHAGX,0BAA0B,YAPnC,mBAAmB;;;QAInB,oBAAoB;4FAGX,0BAA0B;kBATtC,QAAQ;mBAAC;oBACR,OAAO,EAAE;wBACP,mBAAmB;;;wBAInB,oBAAoB;qBACrB;iBACF;;;ACND;;;;;MAKa,oBAAoB;IAe/B,YACU,OAA8B,EAC9B,SAAiB;QADjB,YAAO,GAAP,OAAO,CAAuB;QAC9B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C,SAAS,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;YACxE,MAAM,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAC5E,OAAO,SAAS,IAAI,WAAW,CAAC;SACjC;KAAA;IAEO,qBAAqB,CAAC,KAAU;;QAEtC,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,KAAK,OAAO,CAAC;KAChD;;;AC9MH;;;;;;"}
@@ -1,24 +1,24 @@
1
- import * as i0 from '@angular/core';
2
- import { NgModule, Injectable, EventEmitter, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, SkipSelf, Input, Output, ViewChild, forwardRef, Directive, HostListener } from '@angular/core';
3
1
  import * as i7 from '@angular/common';
4
2
  import { CommonModule } from '@angular/common';
3
+ import * as i0 from '@angular/core';
4
+ import { NgModule, Injectable, EventEmitter, TemplateRef, Component, ViewEncapsulation, ChangeDetectionStrategy, Optional, SkipSelf, Input, Output, ViewChild, forwardRef, Directive, HostListener } from '@angular/core';
5
5
  import * as i1$1 from '@angular/forms';
6
6
  import { FormControl, NG_VALUE_ACCESSOR, NG_VALIDATORS, FormsModule, ReactiveFormsModule } from '@angular/forms';
7
- import * as i6 from '@skyux/indicators';
8
- import { SkyIconModule } from '@skyux/indicators';
9
7
  import * as i1 from '@skyux/i18n';
10
8
  import { getLibStringForLocale, SkyI18nModule, SKY_LIB_RESOURCES_PROVIDERS } from '@skyux/i18n';
9
+ import * as i6 from '@skyux/indicators';
10
+ import { SkyIconModule } from '@skyux/indicators';
11
11
  import * as i5 from '@skyux/lookup';
12
12
  import { SkyCountryFieldModule } from '@skyux/lookup';
13
13
  import * as i3 from '@skyux/theme';
14
14
  import { SkyThemeModule } from '@skyux/theme';
15
+ import { PhoneNumberUtil, PhoneNumberType, PhoneNumberFormat } from 'google-libphonenumber';
16
+ import { Subject, BehaviorSubject } from 'rxjs';
17
+ import { takeUntil, debounceTime } from 'rxjs/operators';
15
18
  import { trigger, transition, style, animate } from '@angular/animations';
16
19
  import * as i4 from '@skyux/forms';
17
20
  import { SkyInputBoxHostService } from '@skyux/forms';
18
- import { PhoneNumberUtil, PhoneNumberType, PhoneNumberFormat } from 'google-libphonenumber';
19
21
  import 'intl-tel-input';
20
- import { Subject, BehaviorSubject } from 'rxjs';
21
- import { takeUntil, debounceTime } from 'rxjs/operators';
22
22
 
23
23
  /**
24
24
  * NOTICE: DO NOT MODIFY THIS FILE!
@@ -175,7 +175,7 @@ class SkyPhoneFieldComponent {
175
175
  * to the main window object.
176
176
  */
177
177
  this.countries = JSON.parse(JSON.stringify(window.intlTelInputGlobals.getCountryData()));
178
- for (let country of this.countries) {
178
+ for (const country of this.countries) {
179
179
  country.dialCode = '+' + country.dialCode;
180
180
  if (country.dialCode.length > this.longestDialCodeLength) {
181
181
  this.longestDialCodeLength = country.dialCode.length;
@@ -298,7 +298,7 @@ class SkyPhoneFieldComponent {
298
298
  }
299
299
  let newCountry;
300
300
  for (let i = 1; i < this.longestDialCodeLength + 1; i++) {
301
- let dialCode = phoneNumber.substring(0, i);
301
+ const dialCode = phoneNumber.substring(0, i);
302
302
  let foundCountry = this.countries.find((country) => country.dialCode === dialCode && country.priority === 0);
303
303
  if (foundCountry) {
304
304
  // Ensure that the country that was found is one of the supported countries
@@ -499,10 +499,11 @@ class SkyPhoneFieldInputDirective {
499
499
  this.skyPhoneFieldNoValidate = false;
500
500
  this.ngUnsubscribe = new Subject();
501
501
  this.phoneUtils = PhoneNumberUtil.getInstance();
502
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
502
503
  this.onChange = (_) => { };
503
- /* istanbul ignore next */
504
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
504
505
  this.onTouched = () => { };
505
- /* istanbul ignore next */
506
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
506
507
  this.validatorChange = () => { };
507
508
  }
508
509
  /**
@@ -521,7 +522,7 @@ class SkyPhoneFieldInputDirective {
521
522
  this._modelValue = value;
522
523
  this.adapterService.setElementValue(this.elRef, value);
523
524
  if (value) {
524
- let formattedValue = this.formatNumber(value.toString());
525
+ const formattedValue = this.formatNumber(value.toString());
525
526
  this.onChange(formattedValue);
526
527
  }
527
528
  else {