@snowball-tech/fractal
Version:
Fractal's (Snowball's design system) React component library based on RadixUI and PandaCSS
47 lines (44 loc) • 1.33 kB
TypeScript
import { CountryCode } from 'libphonenumber-js';
import { HTMLAttributes } from 'react';
import { CombinedRefs as CombinedRefs$1 } from '../Select/Select.types.js';
import '@radix-ui/react-select';
type CountryDetails = {
countryCode: CountryCode;
countryName: string;
flag: string;
prefix: string;
};
type PhoneNumber = {
number: string;
countryCode?: CountryCode | undefined;
};
type Prefix = {
prefix: 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;
}
export type { CombinedRefs, CountryDetails, InputPhoneProps, PhoneNumber, Prefix };