/** * PXM Phone Input Component * * A logic-only phone input component that provides international phone number validation and formatting. * This component provides structure and behavior only - all styling is controlled by your CSS. * * Features: * - International phone number validation using intl-tel-input * - Country code detection and selection * - Format-as-you-type functionality * - Accessible keyboard navigation * - Dynamic validation with error messaging * - Hidden input for full international number * - Custom validation support * * Basic Usage: * ```html * * * * ``` * * Dynamic Content: * ```javascript * const phoneInput = document.querySelector('pxm-phone-input'); * phoneInput.setAttribute('initial-country', 'UK'); * phoneInput.setError('Custom error message'); * ``` * * Consumer Styling Examples: * ```css * /\* Style the component container *\/ * pxm-phone-input { * display: block; * margin-bottom: 1rem; * } * * /\* Style the input *\/ * pxm-phone-input input { * width: 100%; * padding: 0.5rem; * border: 1px solid #ccc; * } * * /\* Style validation states *\/ * pxm-phone-input[aria-invalid="true"] input { * border-color: #dc3545; * } * * /\* Style error messages *\/ * pxm-phone-input [data-pxm-phone-error] { * color: #dc3545; * font-size: 0.875rem; * margin-top: 0.25rem; * } * * /\* Style ITI components *\/ * pxm-phone-input .iti { * width: 100%; * } * ``` * * Events: * - `pxm:phone-input:change` - Fired when the phone number changes * - `pxm:phone-input:validation` - Fired when validation state changes * - `pxm:phone-input:country-change` - Fired when country selection changes * * Accessibility: * This component manages essential ARIA attributes for validation states. * Additional ARIA attributes, labels, and descriptions should be added by the consumer as needed. */ export interface PhoneInputEventDetail { value: string; formattedNumber: string; isValid: boolean; country?: string; element: HTMLElement; } export interface PhoneInputValidationDetail { isValid: boolean; error?: string; element: HTMLElement; } export interface PhoneInputCountryDetail { countryCode: string; countryName: string; dialCode: string; element: HTMLElement; } export declare class PxmPhoneInput extends HTMLElement { private config; private state; private input?; private hiddenInput?; private errorElement?; private itiInstance; private customValidation?; static get observedAttributes(): string[]; constructor(); connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(_: string, oldValue: string, newValue: string): void; private initializeComponent; private createHiddenInput; private createErrorElement; private initializeITI; private applyConfiguration; private updateConfiguration; private setupEventListeners; private handleInput; private handleBlur; private handleCountryChange; private validateInput; private updateValidationState; /** * Get the full international phone number */ getFormattedNumber(): string; /** * Get the national format phone number */ getNationalNumber(): string; /** * Check if the current phone number is valid */ isValid(): boolean; /** * Set a custom error message */ setError(message: string): void; /** * Clear the error message */ clearError(): void; /** * Focus the input element */ focus(): void; /** * Blur the input element */ blur(): void; /** * Set the country */ setCountry(countryCode: string): void; /** * Get the selected country data */ getSelectedCountryData(): any; /** * Set custom validation function */ setCustomValidation(validator: (value: string) => string | null): void; /** * Get the current input value */ getValue(): string; /** * Set the input value */ setValue(value: string): void; }