@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.7 kB
TypeScript
import type { WithNormalizedProps } from "../../global";
import type { Input as ListboxButton } from "../ebay-listbox-button/component";
import { type CountryInterface } from "../../common/countries";
import { AttrString } from "marko/tags-html";
export interface PhoneInputEvent {
originalEvent?: Event;
value?: string;
rawValue?: string;
callingCode?: string;
countryCode?: string;
}
interface PhoneInputInput extends Omit<ListboxButton, `on${string}`> {
disabled?: boolean;
"a11y-icon-prefix-text"?: AttrString;
"floating-label"?: AttrString;
readonly?: boolean;
invalid?: boolean;
"country-code"?: string;
value?: string;
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;