You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 KiB

API Report File for "react-intl"

Do not edit this file. It is a report generated by API Extractor.


import { DisplayNames } from '@formatjs/intl-displaynames';
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
import { DisplayNamesOptions as DisplayNamesOptions_2 } from '@formatjs/intl-displaynames/lib';
import * as React from 'react';

// Warning: (ae-forgotten-export) The symbol "OptionalIntlConfig" needs to be exported by the entry point index.d.ts
//
// @public
export function createIntl(config: OptionalIntlConfig, cache?: IntlCache): IntlShape;

// @public (undocumented)
export function createIntlCache(): IntlCache;

// @public (undocumented)
export interface CustomFormatConfig {
    // (undocumented)
    format?: string;
}

// Warning: (ae-forgotten-export) The symbol "Formats" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export interface CustomFormats extends Partial<Formats> {
    // Warning: (ae-forgotten-export) The symbol "IntlRelativeTimeFormatOptions" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    relative?: Record<string, IntlRelativeTimeFormatOptions>;
}

// @public (undocumented)
export function defineMessages<T, U extends Record<string, T>>(msgs: U): U;

// @public (undocumented)
export type FormatDateOptions = Exclude<Intl.DateTimeFormatOptions, 'localeMatcher'> & CustomFormatConfig;

// @public (undocumented)
export type FormatDisplayNameOptions = Exclude<DisplayNamesOptions, 'localeMatcher'>;

// Warning: (ae-forgotten-export) The symbol "IntlListFormatOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type FormatListOptions = Exclude<IntlListFormatOptions, 'localeMatcher'>;

// Warning: (ae-forgotten-export) The symbol "UnifiedNumberFormatOptions" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export type FormatNumberOptions = Exclude<UnifiedNumberFormatOptions, 'localeMatcher'> & CustomFormatConfig;

// @public (undocumented)
export type FormatPluralOptions = Exclude<Intl.PluralRulesOptions, 'localeMatcher'> & CustomFormatConfig;

// @public (undocumented)
export type FormatRelativeTimeOptions = Exclude<IntlRelativeTimeFormatOptions, 'localeMatcher'> & CustomFormatConfig;

// @public (undocumented)
export const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
    value: string | number | Date | undefined;
}>;

// @public (undocumented)
export const FormattedDateParts: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
    value: string | number | Date | undefined;
    children(val: Intl.DateTimeFormatPart[]): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
}>;

// @public (undocumented)
export const FormattedDisplayName: React.FC<DisplayNamesOptions_2 & {
    value: string | number | object;
}>;

// Warning: (ae-forgotten-export) The symbol "PrimitiveType" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class FormattedHTMLMessage extends FormattedMessage<Record<string, PrimitiveType>> {
    // (undocumented)
    static defaultProps: {
        tagName: "span";
        values: {};
    };
    // (undocumented)
    static displayName: string;
    // (undocumented)
    render(): JSX.Element;
}

// @public (undocumented)
export const FormattedList: React.FC<IntlListFormatOptions & {
    value: React.ReactNode[];
}>;

// Warning: (ae-forgotten-export) The symbol "FormatXMLElementFn" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class FormattedMessage<V extends Record<string, any> = Record<string, PrimitiveType | React.ReactElement | FormatXMLElementFn>> extends React.Component<Props_3<V>> {
    // (undocumented)
    static defaultProps: {
        values: {};
    };
    // (undocumented)
    static displayName: string;
    // (undocumented)
    render(): JSX.Element;
    // (undocumented)
    shouldComponentUpdate(nextProps: Props_3<V>): boolean;
}

// @public (undocumented)
export const FormattedNumber: React.FC<UnifiedNumberFormatOptions & CustomFormatConfig & {
    value: number;
}>;

// Warning: (ae-forgotten-export) The symbol "Formatter" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const FormattedNumberParts: React.FC<Formatter['formatNumber'] & {
    value: Parameters<IntlShape['formatNumber']>[0];
    children(val: Intl.NumberFormatPart[]): React.ReactElement | null;
}>;

// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export const FormattedPlural: React.ForwardRefExoticComponent<Pick<Props_2, "children" | "other" | "zero" | "one" | "two" | "few" | "many" | "format" | "localeMatcher" | "type" | "value"> & {
    forwardedRef?: ((instance: any) => void) | React.RefObject<any> | null | undefined;
} & React.RefAttributes<any>> & {
    WrappedComponent: React.ComponentType<Props_2>;
};

// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "State" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class FormattedRelativeTime extends React.PureComponent<Props, State_2> {
    constructor(props: Props);
    // (undocumented)
    componentDidMount(): void;
    // (undocumented)
    componentDidUpdate(): void;
    // (undocumented)
    componentWillUnmount(): void;
    // (undocumented)
    static defaultProps: Pick<Props, 'unit' | 'value'>;
    // (undocumented)
    static displayName: string;
    // (undocumented)
    static getDerivedStateFromProps(props: Props, state: State_2): Partial<State_2> | null;
    // (undocumented)
    render(): JSX.Element;
    // (undocumented)
    scheduleNextUpdate({ updateIntervalInSeconds, unit }: Props, { currentValueInSeconds }: State_2): void;
    // (undocumented)
    state: State_2;
    // (undocumented)
    _updateTimer: any;
}

// @public (undocumented)
export const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
    value: string | number | Date | undefined;
}>;

// @public (undocumented)
export const FormattedTimeParts: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
    value: string | number | Date | undefined;
    children(val: Intl.DateTimeFormatPart[]): React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)> | null;
}>;

// @public (undocumented)
export interface Formatters {
    // (undocumented)
    getDateTimeFormat(...args: ConstructorParameters<typeof Intl.DateTimeFormat>): Intl.DateTimeFormat;
    // (undocumented)
    getDisplayNames(...args: ConstructorParameters<typeof DisplayNames>): DisplayNames;
    // Warning: (ae-forgotten-export) The symbol "ListFormat" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    getListFormat(...args: ConstructorParameters<typeof ListFormat>): ListFormat;
    // Warning: (ae-forgotten-export) The symbol "IntlMessageFormat" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    getMessageFormat(...args: ConstructorParameters<typeof IntlMessageFormat>): IntlMessageFormat;
    // (undocumented)
    getNumberFormat(...args: ConstructorParameters<typeof Intl.NumberFormat>): Intl.NumberFormat;
    // (undocumented)
    getPluralRules(...args: ConstructorParameters<typeof Intl.PluralRules>): Intl.PluralRules;
    // Warning: (ae-forgotten-export) The symbol "RelativeTimeFormat" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    getRelativeTimeFormat(...args: ConstructorParameters<typeof RelativeTimeFormat>): RelativeTimeFormat;
}

// Warning: (ae-forgotten-export) The symbol "Opts" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export function injectIntl<IntlPropName extends string, P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, false>): React.FC<WithIntlProps<P>> & {
    WrappedComponent: React.ComponentType<P>;
};

// @public (undocumented)
export function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>, T extends React.ComponentType<P> = any>(WrappedComponent: React.ComponentType<P>, options?: Opts<IntlPropName, true>): React.ForwardRefExoticComponent<React.PropsWithoutRef<WithIntlProps<P>> & React.RefAttributes<T>> & {
    WrappedComponent: React.ComponentType<P>;
};

// @public (undocumented)
export interface IntlCache {
    // (undocumented)
    dateTime: Record<string, Intl.DateTimeFormat>;
    // (undocumented)
    displayNames: Record<string, DisplayNames>;
    // (undocumented)
    list: Record<string, ListFormat>;
    // (undocumented)
    message: Record<string, IntlMessageFormat>;
    // (undocumented)
    number: Record<string, Intl.NumberFormat>;
    // (undocumented)
    pluralRules: Record<string, Intl.PluralRules>;
    // (undocumented)
    relativeTime: Record<string, RelativeTimeFormat>;
}

// @public (undocumented)
export interface IntlConfig {
    // (undocumented)
    defaultFormats: CustomFormats;
    // (undocumented)
    defaultLocale: string;
    // (undocumented)
    formats: CustomFormats;
    // (undocumented)
    locale: string;
    // Warning: (ae-forgotten-export) The symbol "MessageFormatElement" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    messages: Record<string, string> | Record<string, MessageFormatElement[]>;
    // (undocumented)
    onError(err: string): void;
    // (undocumented)
    textComponent?: React.ComponentType | keyof React.ReactHTML;
    // (undocumented)
    timeZone?: string;
}

// @public (undocumented)
export const IntlContext: React.Context<IntlShape>;

// @public (undocumented)
export interface IntlFormatters {
    // (undocumented)
    formatDate(value: Parameters<Intl.DateTimeFormat['format']>[0] | string, opts?: FormatDateOptions): string;
    // (undocumented)
    formatDateToParts(value: Parameters<Intl.DateTimeFormat['format']>[0] | string, opts?: FormatDateOptions): Intl.DateTimeFormatPart[];
    // (undocumented)
    formatDisplayName(value: Parameters<DisplayNames['of']>[0], opts?: FormatDisplayNameOptions): string | undefined;
    // (undocumented)
    formatHTMLMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): React.ReactNode;
    // (undocumented)
    formatList(values: Array<string>, opts?: FormatListOptions): string;
    // (undocumented)
    formatList(values: Array<string | React.ReactNode>, opts?: FormatListOptions): React.ReactNode;
    // (undocumented)
    formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): string;
    // (undocumented)
    formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | React.ReactElement | FormatXMLElementFn>): string | React.ReactNodeArray;
    // (undocumented)
    formatNumber(value: Parameters<Intl.NumberFormat['format']>[0], opts?: FormatNumberOptions): string;
    // (undocumented)
    formatNumberToParts(value: Parameters<Intl.NumberFormat['format']>[0], opts?: FormatNumberOptions): Intl.NumberFormatPart[];
    // (undocumented)
    formatPlural(value: Parameters<Intl.PluralRules['select']>[0], opts?: FormatPluralOptions): ReturnType<Intl.PluralRules['select']>;
    // (undocumented)
    formatRelativeTime(value: Parameters<RelativeTimeFormat['format']>[0], unit?: Parameters<RelativeTimeFormat['format']>[1], opts?: FormatRelativeTimeOptions): string;
    // (undocumented)
    formatTime(value: Parameters<Intl.DateTimeFormat['format']>[0] | string, opts?: FormatDateOptions): string;
    // (undocumented)
    formatTimeToParts(value: Parameters<Intl.DateTimeFormat['format']>[0] | string, opts?: FormatDateOptions): Intl.DateTimeFormatPart[];
}

// Warning: (ae-forgotten-export) The symbol "State" needs to be exported by the entry point index.d.ts
//
// @public (undocumented)
export class IntlProvider extends React.PureComponent<OptionalIntlConfig, State> {
    // (undocumented)
    static defaultProps: Pick<IntlConfig, "formats" | "messages" | "timeZone" | "textComponent" | "defaultLocale" | "defaultFormats" | "onError">;
    // (undocumented)
    static displayName: string;
    // (undocumented)
    static getDerivedStateFromProps(props: OptionalIntlConfig, { prevConfig, cache }: State): Partial<State> | null;
    // (undocumented)
    render(): JSX.Element;
    // (undocumented)
    state: State;
}

// @public (undocumented)
export interface IntlShape extends IntlConfig, IntlFormatters {
    // (undocumented)
    formatters: Formatters;
}

// @public (undocumented)
export interface MessageDescriptor {
    // (undocumented)
    defaultMessage?: string;
    // (undocumented)
    description?: string | object;
    // (undocumented)
    id?: string | number;
}

// @public (undocumented)
export type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;

// @public (undocumented)
export const RawIntlProvider: React.Provider<IntlShape>;

// @public (undocumented)
export function useIntl(): IntlShape;

// @public (undocumented)
export type WithIntlProps<P> = Omit<P, keyof WrappedComponentProps> & {
    forwardedRef?: React.Ref<any>;
};

// @public (undocumented)
export type WrappedComponentProps<IntlPropName extends string = 'intl'> = {
    [k in IntlPropName]: IntlShape;
};


// (No @packageDocumentation comment for this package)