@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
50 lines (45 loc) • 1.74 kB
TypeScript
import { CountryCode } from 'libphonenumber-js';
import * as react from 'react';
import { HTMLAttributes } from 'react';
import { C as CombinedRefs$1 } from '../../../Select.types-Dk6vd0mL.js';
import '@radix-ui/react-select';
type CountryDetails = {
countryCode: CountryCode;
countryName: string;
flag: string;
prefix: string;
};
type PhoneNumber = {
number: string;
countryCode?: CountryCode | undefined;
};
type CombinedRefs = {
phone: HTMLInputElement | null;
prefix: CombinedRefs$1 | null;
searchPrefixInput: HTMLInputElement | null;
};
interface InputPhoneProps extends Omit<HTMLAttributes<HTMLDivElement>, 'defaultValue' | 'onChange' | 'placeholder'> {
autoFocus?: boolean;
defaultValue?: PhoneNumber;
description?: string;
disabled?: boolean;
emptyPrefixLabel?: string;
error?: string;
id?: string;
label?: string;
name?: string;
placeholder?: string;
readOnly?: boolean;
required?: boolean;
searchPlaceholder?: string;
success?: string;
updateOnInvalid?: boolean;
value?: PhoneNumber;
withPrefix?: boolean;
onChange?: (newPhoneNumber: PhoneNumber, isValid?: boolean) => void;
}
declare const DEFAULT_COUNTRY_CODE = "FR";
declare const countryByCountryCode: Record<string, CountryDetails>;
declare const supportedCountries: CountryDetails[];
declare const InputPhone: react.ForwardRefExoticComponent<InputPhoneProps & react.RefAttributes<CombinedRefs>>;
export { DEFAULT_COUNTRY_CODE as DEFAULT_INPUT_PHONE_COUNTRY_CODE, InputPhone, type InputPhoneProps, type CombinedRefs as InputPhoneRefs, type PhoneNumber, countryByCountryCode as inputPhoneCountryByCountryCode, supportedCountries as inputPhoneSupportedCountries };