@dnb/eufemia
Version:
DNB Eufemia Design System UI Library
41 lines (40 loc) • 2.08 kB
TypeScript
import type { ReactNode, RefObject } from 'react';
import type { InputMaskedProps } from '../../../../components/InputMasked';
import type { CountryType } from '../../constants/countries';
import type { FieldStringProps as StringFieldProps } from '../String';
import type { FieldPropsWithExtraValue } from '../../types';
import type { CountryFilterSet } from '../SelectCountry';
export type AdditionalArgs = {
phoneNumber: string;
countryCode: string;
iso?: string;
};
export type FieldPhoneNumberProps = Omit<FieldPropsWithExtraValue<string, AdditionalArgs, undefined | string>, 'layout' | 'layoutOptions' | 'labelSize' | 'onBlurValidator'> & {
onBlurValidator?: FieldPropsWithExtraValue<string, AdditionalArgs, undefined | string>['onBlurValidator'] | false;
countryCodeFieldClassName?: string;
numberFieldClassName?: string;
countryCodePlaceholder?: string;
countryCodeLabel?: ReactNode | false;
numberLabel?: ReactNode | false;
numberMask?: InputMaskedProps['mask'];
pattern?: StringFieldProps['pattern'];
width?: 'large' | 'stretch';
inputRef?: RefObject<HTMLInputElement>;
omitCountryCodeField?: boolean;
onCountryCodeChange?: (value: string | undefined) => void;
onNumberChange?: (value: string | undefined) => void;
/**
* List only a certain set of countries: `Scandinavia`, `Nordic`, `Europe` or `Prioritized` (all countries [sorted by priority](/uilib/extensions/forms/feature-fields/SelectCountry/#filter-or-prioritize-country-listing)). Defaults to `Prioritized`.
*/
countries?: CountryFilterSet;
/**
* Use this property to filter out certain countries. The function receives the country object and should return a boolean. Returning `false` will omit the country.
*/
filterCountries?: (country: CountryType) => boolean;
/**
* For internal testing purposes
*/
noAnimation?: boolean;
} & Pick<StringFieldProps, 'size'>;
declare function PhoneNumber(props?: FieldPhoneNumberProps): import("react/jsx-runtime").JSX.Element;
export default PhoneNumber;