import * as _angular_core from '@angular/core'; import { OnChanges, ElementRef, SimpleChanges } from '@angular/core'; import * as _siemens_element_translate_ng_translate from '@siemens/element-translate-ng/translate'; import * as _angular_cdk_overlay from '@angular/cdk/overlay'; import { ControlValueAccessor, Validator, AbstractControl, ValidationErrors } from '@angular/forms'; import { SiFormItemControl } from '@siemens/element-ng/form'; import { SiCustomSelectDirective, SelectOption } from '@siemens/element-ng/select'; /** * Copyright (c) Siemens 2016 - 2026 * SPDX-License-Identifier: MIT */ /** */ interface PhoneNumberModel { /** * Country code */ countryCode?: string; /** * Phone number */ phoneNumber?: string; } /** * Describes the country information of the phone number. */ interface CountryInfo { /** * The name of the country. **/ name: string; /** * The country dial code */ countryCode: number; /** * The country ISO code. */ isoCode: string; } /** * Describes the phone number, its validity and associated country information. */ interface PhoneDetails { /** * CountryInfo object containing name, countryCode and isoCode of the phone number. */ country?: CountryInfo; /** * Phone number entered by the user. */ phoneNumber?: string; /** * Confirms if the phone number is valid or not */ isValid: boolean; } declare class SiPhoneNumberInputComponent implements ControlValueAccessor, Validator, OnChanges, SiFormItemControl { private static idCounter; private phoneUtil; private translate; private locale; /** * Unique identifier. * * @defaultValue * ``` * `__si-phone-number-input-${SiPhoneNumberInputComponent.idCounter++}` * ``` */ readonly id: _angular_core.InputSignal; /** * ISO_3166-2 Code of the selected country. */ readonly country: _angular_core.ModelSignal; /** * ISO_3166-2 Code of the country which shall be used on form-control reset. */ readonly defaultCountry: _angular_core.InputSignal; /** * Optional CDK scroll strategy used for the country selection overlay. * * @defaultValue defaultConnectedOverlayScrollStrategy() */ readonly scrollStrategy: _angular_core.InputSignal<_angular_cdk_overlay.ScrollStrategy>; /** * Placeholder text for country search input. * * @defaultValue * ``` * t(() => $localize`:@@SI_PHONE_NUMBER_INPUT.SEARCH_PLACEHOLDER:Search`) * ``` */ readonly placeholderForSearch: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>; /** * Text shown when the country search returns no results. * * @defaultValue * ``` * t(() => $localize`:@@SI_PHONE_NUMBER_INPUT.SEARCH_NO-RESULTS_FOUND:No results found`) * ``` */ readonly searchNoResultsFoundLabel: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>; /** * Text for the country dropdown aria-label attribute. * * @defaultValue * ``` * t(() => $localize`:@@SI_PHONE_NUMBER_INPUT.SELECT_COUNTRY:Select country`) * ``` */ readonly selectCountryAriaLabel: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>; /** * Text for the phone number input aria-label attribute. * * @defaultValue * ``` * t(() => $localize`:@@SI_PHONE_NUMBER_INPUT.PHONE_NUMBER_INPUT_LABEL:Enter phone number`) * ``` */ readonly phoneNumberAriaLabel: _angular_core.InputSignal<_siemens_element_translate_ng_translate.TranslatableString>; /** * List of countries in ISO2 format, from which the user is allowed to select one. * If no values are provided, the dropdown will show all known countries. */ readonly supportedCountries: _angular_core.InputSignal; /** * ID of the element that labels the phone number input. * * @defaultValue * ``` * `${this.id()}-label` * ``` */ readonly labelledby: _angular_core.InputSignal; /** * Whether the input is disabled. * * @defaultValue false */ readonly disabledInput: _angular_core.InputSignalWithTransform; /** * Whether the input can be focused but not edited. * * @defaultValue false */ readonly readonly: _angular_core.InputSignalWithTransform; /** Emits the selected country, formatted phone number, and its validity when the value changes. */ readonly valueChange: _angular_core.OutputEmitterRef; /** * This ID will be bound to the `aria-describedby` attribute of the phone-number-input. * Use this to reference the element containing the error message(s) for the phone-number-input. * It will be picked by the {@link SiFormItemComponent} if the phone-number-input is used inside a form item. * * @defaultValue * ``` * `${this.id()}-errormessage` * ``` */ readonly errormessageId: _angular_core.InputSignal; protected readonly phoneInput: _angular_core.Signal>; protected readonly countrySelect: _angular_core.Signal>; protected readonly elementRef: ElementRef; protected readonly dropdownWidth: _angular_core.WritableSignal; protected readonly countryFocused: _angular_core.WritableSignal; protected readonly disabled: _angular_core.Signal; protected readonly phoneInputValue: _angular_core.WritableSignal; protected readonly countryList: _angular_core.Signal[]>; protected readonly selectedCountry: _angular_core.Signal; protected readonly placeholder: _angular_core.Signal; protected readonly icons: Record<"elementDown2", string>; private readonly allowedCountries; private readonly disabledNgControl; private isValidNumber; private readonly phoneNumber; private onChange; private onTouched; ngOnChanges(changes: SimpleChanges): void; /** @internal */ writeValue(value: string | undefined): void; /** @internal */ registerOnChange(fn: any): void; /** @internal */ registerOnTouched(fn: () => void): void; /** @internal */ setDisabledState(isDisabled: boolean): void; /** @internal */ validate(control: AbstractControl): ValidationErrors | null; protected input(event: Event): void; protected blur(): void; protected countryInput(num: CountryInfo): void; protected countrySelectOpenChange(open: boolean): void; private getCountryName; private parseNumber; /** * PhoneUtil does not resolve country code early enough when the national prefix is shared among other countries (+1 and +44). * This Method fakes a complete number to force PhoneUtil returning a proper region code. */ private getRegionCode; private formatPhoneNumber; private handleChange; /** * Format and update input text or clear input text if the input value is undefined. */ private writeValueToInput; private refreshValueAfterCountryChange; static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵcmp: _angular_core.ɵɵComponentDeclaration; } declare class SiPhoneNumberInputModule { static ɵfac: _angular_core.ɵɵFactoryDeclaration; static ɵmod: _angular_core.ɵɵNgModuleDeclaration; static ɵinj: _angular_core.ɵɵInjectorDeclaration; } export { SiPhoneNumberInputComponent, SiPhoneNumberInputModule }; export type { CountryInfo, PhoneDetails, PhoneNumberModel };