import{type PropertyValues,type TemplateResult}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraSize}from'../../../internal/variants.js';import type{LyraSelectionDirection}from'../../../internal/shared-unions.js';export type LyraPhoneNumberStatus='empty'|'incomplete'|'invalid'|'valid';export type LyraPhoneInputSelectionDirection=LyraSelectionDirection;export interface LyraPhoneCountry{ /** ISO 3166-1 alpha-2 region code. */ readonly code:string; /** International calling code without a leading plus sign. */ readonly callingCode:string; /** Optional display-name override. `Intl.DisplayNames` is used when omitted. */ readonly label?:string;}interface LyraPhoneNumberParseMetadata{ /** Best-effort display text, normally national formatting for the selected country. */ formatted?:string; /** Detected ISO 3166-1 alpha-2 region code. */ country?:string;} /** Exhaustive adapter result. Only the `valid` branch can carry a canonical form value. */ export type LyraPhoneNumberParseResult=({status:'empty';}&LyraPhoneNumberParseMetadata)|({status:'incomplete';}&LyraPhoneNumberParseMetadata)|({status:'invalid';}&LyraPhoneNumberParseMetadata)|({status:'valid';e164:string;}&LyraPhoneNumberParseMetadata); /** * Synchronous formatting seam for a numbering-plan implementation. The base * component deliberately includes no country metadata. An adapter can be * supplied directly, or created lazily with `loadLibphonenumberAdapter()`. */ export interface LyraPhoneNumberAdapter{readonly countries?:readonly LyraPhoneCountry[];parse(input:string,country?:string):LyraPhoneNumberParseResult;}interface LibphonenumberPhoneLike{number:string;country?:string;isValid():boolean;isPossible():boolean;formatNational():string;formatInternational():string;} /** Structural subset implemented by `libphonenumber-js` entry points. */ export interface LibphonenumberModuleLike{getCountries():CountryCode[];getCountryCallingCode(country:CountryCode):string;parsePhoneNumberFromString(input:string,defaultCountry?:CountryCode):LibphonenumberPhoneLike|undefined;validatePhoneNumberLength?(input:string,defaultCountry?:CountryCode):string|undefined;} /** * Lazily creates an adapter from a `libphonenumber-js`-compatible module. * Keeping the loader consumer-supplied avoids a static import, so neither the * dependency nor its numbering metadata enters Lyra's base bundle. * * Accepts either the module namespace directly (named exports, as `libphonenumber-js`'s own type * declarations describe it) or a `{ default: {...} }`-wrapped namespace, since some bundler/CJS * interop configurations resolve it that way -- the same normalization `map-loader.ts` and * `spreadsheet-loader.ts` apply to their own optional peers. Rejects (with a descriptive `TypeError` * naming the missing capability, not an incidental "not a function" deep inside this function) a * resolved value that has neither shape, or is missing a required method, rather than silently * calling into `undefined`. * * @example * `el.adapter = await loadLibphonenumberAdapter(() => import('libphonenumber-js/min'))` */ export declare function loadLibphonenumberAdapter(loader:()=>Promise):Promise;export interface LyraPhoneInputEventDetail{ /** Canonical E.164 value, or an empty string until the current input is valid. */ value:string; /** The editable, best-effort formatted text shown to the user. */ inputValue:string;country:string;valid:boolean;status:LyraPhoneNumberStatus;}export interface LyraPhoneInputEventMap{'lr-invalid':CustomEvent;input:InputEvent;change:Event;focus:FocusEvent;blur:FocusEvent;'lr-input':CustomEvent;'lr-change':CustomEvent;}declare class LyraPhoneInputBase extends LyraElement{}declare const LyraPhoneInput_base:typeof LyraPhoneInputBase&(new(...args:any[])=>import("../../../lyra.js").FormAssociatedInterface &import("../../../internal/form-associated.js").FormAssociatedSubclassInterface); /** * `` — a country-aware telephone field whose form value is * canonical E.164. National formatting and numbering-plan validation are * supplied through `adapter`; without one, already-international E.164 input * remains useful and national input stays editable with `incomplete` validity. * Adapter results and country metadata are validated at the runtime boundary: only the exhaustive * result discriminator is accepted, `valid` requires E.164, malformed or hostile country rows are * skipped, and malformed parser output fails closed to `invalid`. * * Each text edit emits native `input` then `lr-input`; a text commit emits native `change` then * `lr-change`, and a country pick emits both pairs in that order. The aliases expose both the * canonical `value` and editable `inputValue`; programmatic property changes are silent. * Phone-number text is deliberately LTR while * the form chrome and country selector follow the inherited direction. A host * `aria-label` names the internal telephone input and wins over every derived * or component-specific fallback; `phone-label`, `label` and `placeholder` follow in that order, * and a field left with none of them still lands on a localized generic name rather than reaching * the accessibility tree unnamed. Pressing Enter performs the implicit form submission a native * `` would (see `internal/submit-on-enter.ts` — the internal input is in a * shadow root and has no form owner, so the platform can never do it here). * * The country selector keeps the real, fully accessible native ``'s own `spellcheck`. Defaults to `true`, matching the * native element's own default. Uses {@link spellcheckConverter} rather than Lit's default * presence-based boolean converter so an explicit `spellcheck="false"` attribute is honored; a * `.spellcheck=${false}` property binding can still turn this off directly. */ spellcheck:boolean; /** Forwarded to the internal ``'s own `autocapitalize`. Empty string omits the attribute, * leaving the browser's own default behavior. */ autocapitalize:string; /** Forwarded to the internal ``'s own `autocorrect` (Safari/WebKit-specific). Empty * string omits the attribute. Named `autoCorrect` (capital `C`), not `autocorrect`, purely to * dodge a TS `lib.dom.d.ts` collision: newer DOM typings declare a `boolean`-typed * `HTMLElement.autocorrect` IDL member, which would conflict with this `string`-typed reactive * property; the explicit `attribute: 'autocorrect'` mapping preserves the standard lowercase * `autocorrect` wire name in both Lit and the rendered attribute. */ autoCorrect:string;private inputElement?;private editableValue;private status;private touched;private hasLabelSlot;private hasHintSlot;private hasErrorSlot;private hasCountryPrefixSlot;private inputId;private hintId;private errorId;private explicitCountry; /** Currently selected ISO 3166-1 alpha-2 country code. */ get country():string;set country(next:string); /** The underlying telephone input for platform-specific integrations. */ get input():HTMLInputElement|undefined; /** Editable display text, including a partial or invalid number. */ get inputValue():string; /** Current parse/validation state. */ get phoneStatus():LyraPhoneNumberStatus;get selectionStart():number|null;set selectionStart(value:number|null);get selectionEnd():number|null;set selectionEnd(value:number|null);get selectionDirection():LyraPhoneInputSelectionDirection|null;set selectionDirection(value:LyraPhoneInputSelectionDirection|null);get value():string;set value(next:string);private get availableCountries();private resolveCountry;private parse;private reconcileCountryCatalog;private applyParsed; /** Reassigns `input.value` to the just-reformatted `editableValue`, restoring the caret to the * same *digit* offset it held before reformatting -- assigning `.value` unconditionally moves * the caret to the end (native `` behavior), which makes mid-string edits impossible * once an adapter reformats the text differently from what was typed. A no-op (no reassignment, * no selection change) when the reformat didn't actually change the string, which keeps the * no-adapter path exactly as before. */ private syncFormattedValue;private get eventDetail();static get observedAttributes():string[];attributeChangedCallback(name:string,oldValue:string|null,newValue:string|null):void;private get effectiveCountryLabel(); /** The telephone input's accessible name. Every consumer-supplied source wins, in the precedence * order this component documents; a bare `` with none of them set still lands on * a localized generic name rather than shipping an unnamed field to the accessibility tree, the * same last-resort every sibling text-entry primitive has (`lr-input`, `lr-time-input`, * `lr-otp-input`, `lr-locale-picker`). A rendered label names the native input through its * `for` association; the generic fallback is needed only while that label is hidden. * * Deliberately its own `phoneInputLabel` key rather than borrowing `lr-contact-viewer`'s * identically-worded one: the two read the same in English today, but a locale re-wording * contact-viewer's field label would otherwise silently re-label this control too. */ private effectivePhoneLabel;private get incompleteMessage();private get invalidMessage();private countryName; /** * Maps the parsed phone `status` onto the element's validity. A control barred from constraint * validation (own `disabled`, a `
` ancestor, any platform condition * `willValidate` folds in) reports no violation at all, exactly like the base mixin and every * native control: without this guard a `` kept `valueMissing` * raised and published `:state(invalid)`/`:state(user-invalid)`, painting every disabled field * with the documented `:state(user-invalid)` error styling. */ protected updateValidity():void;adoptedCallback():void;disconnectedCallback():void;private externalDescriptionLease?;private syncExternalDescription;private releaseExternalDescription;connectedCallback():void;protected willUpdate(changed:PropertyValues):void;protected updated(changed:PropertyValues):void;private onInput;private onChange;private onCountryChange; /** * Implicit form submission, through the shared gate in `internal/submit-on-enter.ts` — the * internal telephone input lives in a shadow root and has no form owner, so the platform can * never run its own. A modifier-held or IME-composition Enter is ignored there, which matters * more here than elsewhere: this field's `inputmode="tel"` keyboards are exactly the ones an IME * candidate list sits on top of. */ private onKeyDown;private onFocus;private onBlur;private onLabelSlotChange;private onHintSlotChange;private onErrorSlotChange;private onCountryPrefixSlotChange; /** Reads both component state and the UA's synchronous fieldset cascade before public actions. */ private get liveDisabled(); /** Activate the internal telephone input unless the form control is effectively disabled. */ click():void; /** Focus the internal telephone input unless the form control is effectively disabled. */ focus(options?:FocusOptions):void; /** Blur the internal telephone input. */ blur():void; /** Select all editable telephone text. */ select():void; /** Set the selection range in the editable telephone text. */ setSelectionRange(start:number|null,end:number|null,direction?:LyraPhoneInputSelectionDirection):void;setRangeText(replacement:string):void;setRangeText(replacement:string,start:number,end:number,selectMode?:SelectionMode):void;formResetCallback():void;render():TemplateResult;}declare global{interface HTMLElementTagNameMap{'lr-phone-input':LyraPhoneInput;}}export{};