import * as yup from 'yup'; export { yup }; import { CountryCode } from 'libphonenumber-js/min'; export { CountryCode } from 'libphonenumber-js/min'; /** * Options for phone number validation */ interface PhoneNumberOptions { /** Default country code for parsing national numbers */ country?: CountryCode; /** Require the number to be valid (not just possible) */ strict?: boolean; /** Custom error message for invalid phone numbers */ message?: string; } /** * Output formats for phone number transformation */ type PhoneOutputFormat = 'e164' | 'national' | 'international' | 'digits' | 'raw'; declare module 'yup' { interface StringSchema { phone(options?: PhoneNumberOptions): StringSchema; phoneTransform(format?: PhoneOutputFormat, country?: CountryCode): StringSchema; } } /** * Create a phone number schema with preset options * * @example * ```typescript * import { yupPhone } from 'maskdial/yup' * * const schema = yup.object({ * phone: yupPhone({ country: 'US' }).required('Phone is required') * }) * ``` */ declare function yupPhone(options?: PhoneNumberOptions): yup.StringSchema; /** * Create a phone number schema for a specific country * * @example * ```typescript * import { yupPhoneForCountry } from 'maskdial/yup' * * const usPhone = yupPhoneForCountry('US') * const ukPhone = yupPhoneForCountry('GB') * * const schema = yup.object({ * homePhone: usPhone.required(), * workPhone: ukPhone.required() * }) * ``` */ declare function yupPhoneForCountry(country: CountryCode, options?: Omit): yup.StringSchema; /** * Create a phone schema that transforms output to E.164 format * * @example * ```typescript * import { yupPhoneE164 } from 'maskdial/yup' * * const schema = yup.object({ * phone: yupPhoneE164('US').required() * }) * * // Input: "(202) 555-1234" * // Output after validation: "+12025551234" * ``` */ declare function yupPhoneE164(country?: CountryCode, options?: PhoneNumberOptions): yup.StringSchema; /** * Validation test function for use with custom Yup schemas * * @example * ```typescript * import * as yup from 'yup' * import { isValidPhoneTest } from 'maskdial/yup' * * const schema = yup.object({ * phone: yup.string().test('phone', 'Invalid phone', isValidPhoneTest('US')) * }) * ``` */ declare function isValidPhoneTest(country?: CountryCode, strict?: boolean): (value: string | undefined) => boolean; export { type PhoneNumberOptions, type PhoneOutputFormat, yupPhone as default, isValidPhoneTest, yupPhone, yupPhoneE164, yupPhoneForCountry };