@lion/ui
Version:
A package of extendable web components
181 lines • 6.96 kB
TypeScript
declare const LionInputTel_base: typeof LionInput & import("@open-wc/dedupe-mixin").Constructor<import("../../localize/types/LocalizeMixinTypes.js").LocalizeMixinHost> & Pick<typeof import("../../localize/types/LocalizeMixinTypes.js").LocalizeMixinHost, "prototype" | "localizeNamespaces" | "waitForLocalizeNamespaces"> & Pick<typeof import("lit-element").LitElement, typeof Symbol.metadata | "prototype" | "_$litElement$" | "enabledWarnings" | "enableWarning" | "disableWarning" | "addInitializer" | "_initializers" | "elementProperties" | "properties" | "elementStyles" | "styles" | "observedAttributes" | "createProperty" | "getPropertyOptions" | "shadowRootOptions">;
/**
* @typedef {import('../types/index.js').RegionCode} RegionCode
* @typedef {import('awesome-phonenumber').PhoneNumberFormat} PhoneNumberFormat
* @typedef {import('awesome-phonenumber').PhoneNumberTypes} PhoneNumberTypes
* @typedef {import('../../form-core/types/FormatMixinTypes.js').FormatOptions} FormatOptions
* @typedef {* & import('awesome-phonenumber')} AwesomePhoneNumber
* @typedef {FormatOptions & {regionCode: RegionCode; formatStrategy: PhoneNumberFormat; formatCountryCodeStyle: string;}} FormatOptionsTel
*/
/**
* @customElement lion-input-tel
*/
export class LionInputTel extends LionInputTel_base {
/**
* @configure LitElement
*/
static properties: {
allowedRegions: {
type: ArrayConstructor;
};
formatStrategy: {
type: StringConstructor;
attribute: string;
};
formatCountryCodeStyle: {
type: StringConstructor;
attribute: string;
};
activeRegion: {
type: StringConstructor;
};
preferredRegions: {
type: ArrayConstructor;
};
_phoneUtil: {
type: ObjectConstructor;
state: boolean;
};
};
static localizeNamespaces: import("../../localize/types/LocalizeMixinTypes.js").NamespaceObject[];
readonly set activeRegion(arg: import("../types/index.js").RegionCode | undefined);
/**
* Currently active region based on:
* 1. allowed regions: get the region from configured allowed regions (if one entry)
* 2. user input: try to derive active region from user input
* 3. locale: try to get the region from locale (`html[lang]` attribute)
* @readonly
* @property {RegionCode|undefined}activeRegion
*/
readonly get activeRegion(): import("../types/index.js").RegionCode | undefined;
readonly set activePhoneNumberType(arg: any);
/**
* Type of phone number, derived from textbox value. Enum with values:
* -'fixed-line'
* -'fixed-line-or-mobile'
* -'mobile'
* -'pager'
* -'personal-number'
* -'premium-rate'
* -'shared-cost'
* -'toll-free'
* -'uan'
* -'voip'
* -'unknown'
* See https://www.npmjs.com/package/awesome-phonenumber
* @readonly
* @property {PhoneNumberTypes|undefined} activePhoneNumberTypes
*/
readonly get activePhoneNumberType(): any;
/**
* Protected setter for activeRegion, only meant for subclassers
* @protected
* @param {RegionCode|undefined} newValue
*/
protected _setActiveRegion(newValue: RegionCode | undefined): void;
__activeRegion: import("../types/index.js").RegionCode | undefined;
/**
* Used for rendering the region/country list
* @property _allowedOrAllRegions
* @type {RegionCode[]}
*/
get _allowedOrAllRegions(): import("../types/index.js").RegionCode[];
/**
* @property _phoneUtilLoadComplete
* @protected
* @type {Promise<PhoneNumber>}
*/
protected get _phoneUtilLoadComplete(): Promise<PhoneNumber>;
/**
* Set a default name for this field, so that validation feedback will be always
* accessible and linguistically correct
* @configure FormControlMixin
*/
get fieldName(): string;
/**
* Determines what the formatter output should look like.
* Formatting strategies as provided by google-libphonenumber
* See: https://www.npmjs.com/package/google-libphonenumber
* @type {PhoneNumberFormat}
*/
formatStrategy: PhoneNumberFormat;
/**
* Extra styling of the format strategy
* default | parentheses
* @type {string}
*/
formatCountryCodeStyle: string;
/**
* The regions that should be considered when international phone numbers are detected.
* (when not configured, all regions worldwide will be considered)
* @type {RegionCode[]}
*/
allowedRegions: RegionCode[];
/**
* Regions that will be shown on top of the dropdown
* @type {RegionCode[]}
*/
preferredRegions: RegionCode[];
/** @private */
private __isPhoneNumberValidatorInstance;
/**
* @protected
* @type {AwesomePhoneNumber|null}
*/
protected _phoneUtil: AwesomePhoneNumber | null;
__isUpdatingRegionWhileFocused: boolean | undefined;
/**
* @protected
* @type {RegionCode}
*/
protected _langIso: import("../types/index.js").RegionCode | undefined;
/**
* @configure FormatMixin
* @param {string} modelValue
* @returns {string}
*/
formatter(modelValue: string): string;
/**
* @configure FormatMixin
* @param {string} viewValue a phone number without (or with) country code, like '06 12345678'
* @returns {string} a trimmed phone number with country code, like '+31612345678'
*/
parser(viewValue: string): string;
/**
* @configure FormatMixin
* @param {string} viewValue
* @param {object} options
* @param {string} options.prevViewValue
* @param {number} options.currentCaretIndex
* @returns {{ viewValue: string; caretIndex: number; } | undefined }
*/
preprocessor(viewValue: string, { currentCaretIndex, prevViewValue }: {
prevViewValue: string;
currentCaretIndex: number;
}): {
viewValue: string;
caretIndex: number;
} | undefined;
/**
* @protected
*/
protected _onPhoneNumberUtilReady(): void;
/**
* @private
*/
private __calculateActiveRegion;
}
export type RegionCode = import('../types/index.js').RegionCode;
export type PhoneNumberFormat = import('awesome-phonenumber').PhoneNumberFormat;
export type PhoneNumberTypes = import('awesome-phonenumber').PhoneNumberTypes;
export type FormatOptions = import('../../form-core/types/FormatMixinTypes.js').FormatOptions;
export type AwesomePhoneNumber = any & typeof import("awesome-phonenumber");
export type FormatOptionsTel = FormatOptions & {
regionCode: RegionCode;
formatStrategy: PhoneNumberFormat;
formatCountryCodeStyle: string;
};
import { LionInput } from "../../../exports/input.js";
import { PhoneNumber } from "./validators.js";
export {};
//# sourceMappingURL=LionInputTel.d.ts.map