@ebay/ebayui-core
Version:
Collection of core eBay components; considered to be the building blocks for all composite structures, pages & apps.
50 lines (49 loc) • 1.85 kB
TypeScript
import type { WithNormalizedProps } from "../../global";
import type { Input as ListboxButtonInput } from "../ebay-listbox-button/component";
import type { Input as TextboxInput } from "../ebay-textbox/component-browser";
import { type CountryInterface } from "../../common/countries";
export interface PhoneInputEvent {
originalEvent?: Event;
value?: string;
rawValue?: string;
callingCode?: string;
countryCode?: string;
}
interface PhoneInputInput extends Omit<Marko.HTML.Span, `on${string}`> {
disabled?: boolean;
"a11y-icon-prefix-text"?: ListboxButtonInput["a11y-icon-prefix-text"];
"floating-label"?: TextboxInput["floating-label"];
readonly?: TextboxInput["readonly"];
invalid?: ListboxButtonInput["invalid"];
"country-code"?: string;
value?: TextboxInput["value"];
locale?: string;
"on-keyup"?: (event: PhoneInputEvent) => void;
"on-keypress"?: (event: PhoneInputEvent) => void;
"on-keydown"?: (event: PhoneInputEvent) => void;
"on-focus"?: (event: PhoneInputEvent) => void;
"on-blur"?: (event: PhoneInputEvent) => void;
"on-collapse"?: (event: PhoneInputEvent) => void;
"on-expand"?: (event: PhoneInputEvent) => void;
"on-change"?: (event: PhoneInputEvent) => void;
}
export interface Input extends WithNormalizedProps<PhoneInputInput> {
}
export interface State {
index: number;
countryNames: [string, string][];
}
declare class PhoneInput extends Marko.Component<Input, State> {
mask: any;
locale: string;
onCreate(): void;
getSelectedCountry(): CountryInterface;
onInput(input: Input): void;
handleCountryChange(e: any): void;
forwardEvent(eventName: string, event: PhoneInputEvent): void;
_initializeMask(): void;
onMount(): void;
onUpdate(): void;
onDestroy(): void;
}
export default PhoneInput;