UNPKG

3.22 kBTypeScriptView Raw
1import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
2import { CustomFormatConfig, FormatDateOptions, MessageDescriptor } from '@formatjs/intl';
3import * as React from 'react';
4import { createIntl } from './src/components/createIntl';
5import FormattedDateTimeRange from './src/components/dateTimeRange';
6import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
7import FormattedMessage from './src/components/message';
8import FormattedPlural from './src/components/plural';
9import IntlProvider from './src/components/provider';
10import FormattedRelativeTime from './src/components/relative';
11import useIntl from './src/components/useIntl';
12export { createIntlCache, CustomFormatConfig, CustomFormats, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPluralOptions, FormatRelativeTimeOptions, Formatters, IntlCache, IntlFormatters, InvalidConfigError, MessageDescriptor, MessageFormatError, MissingDataError, MissingTranslationError, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, UnsupportedFormatterError, } from '@formatjs/intl';
13export { IntlConfig, IntlShape, ResolvedIntlConfig } from './src/types';
14export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, WithIntlProps, WrappedComponentProps, };
15export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
16export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
17export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
18 value: string | number | Date | undefined;
19 children?(formattedDate: string): React.ReactElement | null;
20}>;
21export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
22 value: string | number | Date | undefined;
23 children?(formattedTime: string): React.ReactElement | null;
24}>;
25export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
26 value: number;
27 children?(formattedNumber: string): React.ReactElement | null;
28}>;
29export declare const FormattedList: React.FC<Intl.ListFormatOptions & {
30 value: readonly React.ReactNode[];
31}>;
32export declare const FormattedDisplayName: React.FC<Intl.DisplayNamesOptions & {
33 value: string;
34}>;
35export declare const FormattedDateParts: React.FC<FormatDateOptions & {
36 value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
37 children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
38}>;
39export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
40 value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
41 children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
42}>;
43export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
44export type { PrimitiveType } from 'intl-messageformat';
45export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent';