import React from 'react'; import './PhoneInput.less'; /** 国家/地区配置(后端返回格式) */ export interface CountryOption { /** 国家/地区名称 */ name: string; /** 国家/地区代码 */ code: string; /** 区号(不带+号) */ calling_code: string; /** 货币代码 */ currency_code: string; } /** 手机号对象格式 */ export interface PhoneValueObject { /** 手机号(不含区号) */ phone: string; /** 国家区号(不带+号) */ country_calling_code: string; } /** 值格式类型 */ export declare type ValueFormat = 'string' | 'object'; /** 手机号输入组件属性 */ export interface PhoneInputProps { /** 完整的手机号值(包含区号),格式:+86138****,或 +1555****(字符串模式) */ value?: string | PhoneValueObject; /** 值变化回调 */ onChange?: (value: string | PhoneValueObject) => void; /** Placeholder */ placeholder?: string; /** 大小 */ size?: 'large' | 'middle' | 'small'; /** 是否禁用 */ disabled?: boolean; /** 自定义类名 */ className?: string; /** 可用的国家/地区列表 */ countries?: CountryOption[]; /** 默认国家/地区代码 */ defaultCountry?: string; /** 值格式:'string' 返回 "+8613800138000",'object' 返回 { phone: "13800138000", country_calling_code: "86" } */ valueFormat?: ValueFormat; /** 键盘按键事件回调 */ onKeyDown?: (e: React.KeyboardEvent) => void; } /** * 手机号输入组件 * * 支持国际区号选择和手机号输入 * 值格式:+区号+手机号,例如:+8613800138000 或 +15551234567 */ declare function PhoneInput({ value, onChange, placeholder, onKeyDown, size, disabled, className, countries, defaultCountry, valueFormat, }: PhoneInputProps): React.JSX.Element; export default PhoneInput;