import { DisplayNames } from '@formatjs/intl-displaynames'; import { DisplayNamesOptions } from '@formatjs/intl-displaynames'; import { DisplayNamesOptions as DisplayNamesOptions_2 } from '@formatjs/intl-displaynames/lib'; import { FormatError } from 'intl-messageformat'; import { Formats } from 'intl-messageformat'; import { FormatXMLElementFn } from 'intl-messageformat'; import IntlListFormat from '@formatjs/intl-listformat'; import { IntlListFormatOptions } from '@formatjs/intl-listformat'; import IntlMessageFormat from 'intl-messageformat'; import IntlRelativeTimeFormat from '@formatjs/intl-relativetimeformat'; import { IntlRelativeTimeFormatOptions } from '@formatjs/intl-relativetimeformat'; import { MessageFormatElement } from 'intl-messageformat-parser'; import { PrimitiveType } from 'intl-messageformat'; import * as React_2 from 'react'; import { UnifiedNumberFormatOptions } from '@formatjs/intl-unified-numberformat'; import { Unit } from '@formatjs/intl-relativetimeformat'; /** * Create intl object * @param config intl config * @param cache cache for formatter instances to prevent memory leak */ export declare function createIntl(config: OptionalIntlConfig, cache?: IntlCache): IntlShape; export declare function createIntlCache(): IntlCache; export declare interface CustomFormatConfig { format?: string; } export declare interface CustomFormats extends Partial { relative?: Record; } declare const DEFAULT_INTL_CONFIG: Pick; export declare function defineMessage(msg: T): T; export declare function defineMessages>(msgs: U): U; export declare type FormatDateOptions = Exclude & CustomFormatConfig; export declare type FormatDisplayNameOptions = Exclude; export declare type FormatListOptions = Exclude; export declare type FormatNumberOptions = Exclude & CustomFormatConfig; export declare type FormatPluralOptions = Exclude & CustomFormatConfig; export declare type FormatRelativeTimeOptions = Exclude & CustomFormatConfig; export declare const FormattedDate: React_2.FC; export declare const FormattedDateParts: React_2.FC React_2.ReactElement React_2.Component)> | null) | (new (props: any) => React_2.Component)> | null; }>; export declare const FormattedDisplayName: React_2.FC; export declare const FormattedList: React_2.FC; export declare class FormattedMessage = Record>> extends React_2.Component> { static displayName: string; static defaultProps: { values: {}; }; shouldComponentUpdate(nextProps: Props_3): boolean; render(): JSX.Element; } export declare const FormattedNumber: React_2.FC; export declare const FormattedNumberParts: React_2.FC[0]; children(val: Intl.NumberFormatPart[]): React_2.ReactElement | null; }>; export declare const FormattedPlural: React_2.ForwardRefExoticComponent & { forwardedRef?: ((instance: any) => void) | React_2.RefObject | null | undefined; } & React_2.RefAttributes> & { WrappedComponent: React_2.ComponentType; }; export declare class FormattedRelativeTime extends React_2.PureComponent { _updateTimer: any; static displayName: string; static defaultProps: Pick; state: State_2; constructor(props: Props); scheduleNextUpdate({ updateIntervalInSeconds, unit }: Props, { currentValueInSeconds }: State_2): void; componentDidMount(): void; componentDidUpdate(): void; componentWillUnmount(): void; static getDerivedStateFromProps(props: Props, state: State_2): Partial | null; render(): JSX.Element; } export declare const FormattedTime: React_2.FC; export declare const FormattedTimeParts: React_2.FC React_2.ReactElement React_2.Component)> | null) | (new (props: any) => React_2.Component)> | null; }>; declare type Formatter = { formatDate: FormatDateOptions; formatTime: FormatDateOptions; formatNumber: FormatNumberOptions; formatList: FormatListOptions; formatDisplayName: FormatDisplayNameOptions; }; export declare interface Formatters { getDateTimeFormat(...args: ConstructorParameters): Intl.DateTimeFormat; getNumberFormat(...args: ConstructorParameters): Intl.NumberFormat; getMessageFormat(...args: ConstructorParameters): IntlMessageFormat; getRelativeTimeFormat(...args: ConstructorParameters): IntlRelativeTimeFormat; getPluralRules(...args: ConstructorParameters): Intl.PluralRules; getListFormat(...args: ConstructorParameters): IntlListFormat; getDisplayNames(...args: ConstructorParameters): DisplayNames; } export declare function injectIntl = WrappedComponentProps>(WrappedComponent: React_2.ComponentType

, options?: Opts): React_2.FC> & { WrappedComponent: React_2.ComponentType

; }; export declare function injectIntl = WrappedComponentProps, T extends React_2.ComponentType

= any>(WrappedComponent: React_2.ComponentType

, options?: Opts): React_2.ForwardRefExoticComponent> & React_2.RefAttributes> & { WrappedComponent: React_2.ComponentType

; }; export declare interface IntlCache { dateTime: Record; number: Record; message: Record; relativeTime: Record; pluralRules: Record; list: Record; displayNames: Record; } export declare interface IntlConfig { locale: string; timeZone?: string; formats: CustomFormats; textComponent?: React_2.ComponentType | keyof React_2.ReactHTML; messages: Record | Record; defaultLocale: string; defaultFormats: CustomFormats; wrapRichTextChunksInFragment?: boolean; onError(err: ReactIntlError | FormatError): void; } export declare const IntlContext: React_2.Context; export declare interface IntlFormatters { formatDate(value: Parameters[0] | string, opts?: FormatDateOptions): string; formatTime(value: Parameters[0] | string, opts?: FormatDateOptions): string; formatDateToParts(value: Parameters[0] | string, opts?: FormatDateOptions): Intl.DateTimeFormatPart[]; formatTimeToParts(value: Parameters[0] | string, opts?: FormatDateOptions): Intl.DateTimeFormatPart[]; formatRelativeTime(value: Parameters[0], unit?: Parameters[1], opts?: FormatRelativeTimeOptions): string; formatNumber(value: Parameters[0], opts?: FormatNumberOptions): string; formatNumberToParts(value: Parameters[0], opts?: FormatNumberOptions): Intl.NumberFormatPart[]; formatPlural(value: Parameters[0], opts?: FormatPluralOptions): ReturnType; formatMessage(descriptor: MessageDescriptor, values?: Record): string; formatMessage(descriptor: MessageDescriptor, values?: Record>): string | React_2.ReactNodeArray; formatList(values: Array, opts?: FormatListOptions): string; formatList(values: Array, opts?: FormatListOptions): React_2.ReactNode; formatDisplayName(value: Parameters[0], opts?: FormatDisplayNameOptions): string | undefined; } export declare class IntlProvider extends React_2.PureComponent { static displayName: string; static defaultProps: Pick; private cache; state: State; static getDerivedStateFromProps(props: OptionalIntlConfig, { prevConfig, cache }: State): Partial | null; render(): JSX.Element; } export declare interface IntlShape extends IntlConfig, IntlFormatters { formatters: Formatters; } export declare interface MessageDescriptor { id?: string | number; description?: string | object; defaultMessage?: string; } declare type Omit_2 = Pick>; export { Omit_2 as Omit } declare type OptionalIntlConfig = Omit_2 & Partial; declare interface Opts { intlPropName?: IntlPropName; forwardRef?: ForwardRef; enforceContext?: boolean; } declare interface Props extends FormatRelativeTimeOptions { value?: number; unit?: Unit; updateIntervalInSeconds?: number; children?(value: string): React_2.ReactChild; } declare interface Props_2 extends FormatPluralOptions { value: number; intl: IntlShape; other: React_2.ReactNode; zero?: React_2.ReactNode; one?: React_2.ReactNode; two?: React_2.ReactNode; few?: React_2.ReactNode; many?: React_2.ReactNode; children?(value: React_2.ReactNode): React_2.ReactElement | null; } declare interface Props_3 = Record> extends MessageDescriptor { values?: V; tagName?: React_2.ElementType; children?(...nodes: React_2.ReactNodeArray): React_2.ReactNode; } export declare const RawIntlProvider: React_2.Provider; export declare class ReactIntlError extends Error { readonly code: ReactIntlErrorCode; readonly descriptor?: MessageDescriptor; constructor(code: ReactIntlErrorCode, message: string, descriptor?: MessageDescriptor, exception?: Error); } export declare const enum ReactIntlErrorCode { FORMAT_ERROR = "FORMAT_ERROR", UNSUPPORTED_FORMATTER = "UNSUPPORTED_FORMATTER", INVALID_CONFIG = "INVALID_CONFIG", MISSING_DATA = "MISSING_DATA", MISSING_TRANSLATION = "MISSING_TRANSLATION" } declare interface State { /** * Explicit intl cache to prevent memory leaks */ cache: IntlCache; /** * Intl object we created */ intl?: IntlShape; /** * list of memoized config we care about. * This is important since creating intl is * very expensive */ prevConfig: OptionalIntlConfig; } declare interface State_2 { prevUnit?: Unit; prevValue?: number; currentValueInSeconds: number; } export declare function useIntl(): IntlShape; export declare type WithIntlProps

= Omit_2 & { forwardedRef?: React_2.Ref; }; export declare type WrappedComponentProps = { [k in IntlPropName]: IntlShape; }; export { }