react-intl 8.0.9 → 8.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +44 -34
- package/index.js +30 -21
- package/package.json +5 -5
- package/react-intl.iife.js +7328 -1961
- package/src/components/createFormattedComponent.d.ts +19 -19
- package/src/components/createFormattedComponent.js +54 -56
- package/src/components/createIntl.d.ts +12 -7
- package/src/components/createIntl.js +50 -52
- package/src/components/dateTimeRange.d.ts +5 -5
- package/src/components/dateTimeRange.js +14 -13
- package/src/components/injectIntl.d.ts +43 -29
- package/src/components/injectIntl.js +36 -31
- package/src/components/message.d.ts +12 -7
- package/src/components/message.js +27 -30
- package/src/components/plural.d.ts +15 -10
- package/src/components/plural.js +22 -20
- package/src/components/provider.d.ts +29 -25
- package/src/components/provider.js +51 -56
- package/src/components/relative.d.ts +11 -6
- package/src/components/relative.js +108 -113
- package/src/components/useIntl.d.ts +1 -1
- package/src/components/useIntl.js +7 -6
- package/src/types.d.ts +14 -9
- package/src/types.js +8 -1
- package/src/utils.d.ts +18 -18
- package/src/utils.js +61 -59
package/index.d.ts
CHANGED
|
@@ -1,46 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015, Yahoo Inc.
|
|
3
|
+
* Copyrights licensed under the New BSD License.
|
|
4
|
+
* See the accompanying LICENSE file for terms.
|
|
5
|
+
*/
|
|
6
|
+
import { type NumberFormatOptions } from "@formatjs/ecma402-abstract";
|
|
7
|
+
import { type CustomFormatConfig, type FormatDateOptions, type FormatTimeOptions, type MessageDescriptor } from "@formatjs/intl";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { createIntl } from "./src/components/createIntl.js";
|
|
10
|
+
import FormattedDateTimeRange from "./src/components/dateTimeRange.js";
|
|
11
|
+
import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, type WithIntlProps, type WrappedComponentProps } from "./src/components/injectIntl.js";
|
|
12
|
+
import FormattedMessage from "./src/components/message.js";
|
|
13
|
+
import FormattedPlural from "./src/components/plural.js";
|
|
14
|
+
import IntlProvider from "./src/components/provider.js";
|
|
15
|
+
import FormattedRelativeTime from "./src/components/relative.js";
|
|
16
|
+
import useIntl from "./src/components/useIntl.js";
|
|
17
|
+
import { type IntlShape } from "./src/types.js";
|
|
18
|
+
export { createIntlCache, type CustomFormatConfig, type CustomFormats, type FormatDateOptions, type FormatDisplayNameOptions, type FormatListOptions, type FormatNumberOptions, type FormatPluralOptions, type FormatRelativeTimeOptions, type Formatters, type IntlCache, type IntlFormatters, InvalidConfigError, type MessageDescriptor, MessageFormatError, MissingDataError, MissingTranslationError, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, UnsupportedFormatterError } from "@formatjs/intl";
|
|
19
|
+
export { type IntlConfig, type IntlShape, type ResolvedIntlConfig } from "./src/types.js";
|
|
20
|
+
export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, type WithIntlProps, type WrappedComponentProps };
|
|
21
|
+
export declare function defineMessages<
|
|
22
|
+
K extends keyof any,
|
|
23
|
+
T = MessageDescriptor,
|
|
24
|
+
U extends Record<K, T> = Record<K, T>
|
|
25
|
+
>(msgs: U): U;
|
|
17
26
|
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
|
|
28
|
+
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig<"date"> & {
|
|
29
|
+
value: string | number | Date | undefined;
|
|
30
|
+
children?(formattedDate: string): React.ReactElement | null;
|
|
21
31
|
}>;
|
|
22
|
-
export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig<
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig<"time"> & {
|
|
33
|
+
value: string | number | Date | undefined;
|
|
34
|
+
children?(formattedTime: string): React.ReactElement | null;
|
|
25
35
|
}>;
|
|
26
|
-
export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions,
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, "localeMatcher"> & CustomFormatConfig<"number"> & {
|
|
37
|
+
value: Parameters<IntlShape["formatNumber"]>[0];
|
|
38
|
+
children?(formattedNumber: string): React.ReactElement | null;
|
|
29
39
|
}>;
|
|
30
40
|
export declare const FormattedList: React.FC<Intl.ListFormatOptions & {
|
|
31
|
-
|
|
41
|
+
value: readonly React.ReactNode[];
|
|
32
42
|
}>;
|
|
33
43
|
export declare const FormattedDisplayName: React.FC<Intl.DisplayNamesOptions & {
|
|
34
|
-
|
|
44
|
+
value: string;
|
|
35
45
|
}>;
|
|
36
46
|
export declare const FormattedDateParts: React.FC<FormatDateOptions & {
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
value: Parameters<Intl.DateTimeFormat["format"]>[0] | string;
|
|
48
|
+
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
|
|
39
49
|
}>;
|
|
40
50
|
export declare const FormattedTimeParts: React.FC<FormatTimeOptions & {
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
value: Parameters<Intl.DateTimeFormat["format"]>[0] | string;
|
|
52
|
+
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
|
|
43
53
|
}>;
|
|
44
|
-
export type { MessageFormatElement } from
|
|
45
|
-
export type { PrimitiveType } from
|
|
46
|
-
export { FormattedListParts, FormattedNumberParts
|
|
54
|
+
export type { MessageFormatElement } from "@formatjs/icu-messageformat-parser";
|
|
55
|
+
export type { PrimitiveType } from "intl-messageformat";
|
|
56
|
+
export { FormattedListParts, FormattedNumberParts } from "./src/components/createFormattedComponent.js";
|
package/index.js
CHANGED
|
@@ -1,26 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2015, Yahoo Inc.
|
|
3
|
+
* Copyrights licensed under the New BSD License.
|
|
4
|
+
* See the accompanying LICENSE file for terms.
|
|
5
|
+
*/
|
|
6
|
+
import "@formatjs/ecma402-abstract";
|
|
7
|
+
import "@formatjs/intl";
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { createFormattedComponent, createFormattedDateTimePartsComponent } from "./src/components/createFormattedComponent.js";
|
|
10
|
+
import { createIntl } from "./src/components/createIntl.js";
|
|
11
|
+
import FormattedDateTimeRange from "./src/components/dateTimeRange.js";
|
|
12
|
+
import injectIntl, { Context as IntlContext, Provider as RawIntlProvider } from "./src/components/injectIntl.js";
|
|
13
|
+
import FormattedMessage from "./src/components/message.js";
|
|
14
|
+
import FormattedPlural from "./src/components/plural.js";
|
|
15
|
+
import IntlProvider from "./src/components/provider.js";
|
|
16
|
+
import FormattedRelativeTime from "./src/components/relative.js";
|
|
17
|
+
import useIntl from "./src/components/useIntl.js";
|
|
18
|
+
import "./src/types.js";
|
|
19
|
+
export { createIntlCache, InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, UnsupportedFormatterError } from "@formatjs/intl";
|
|
20
|
+
export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl };
|
|
12
21
|
export function defineMessages(msgs) {
|
|
13
|
-
|
|
22
|
+
return msgs;
|
|
14
23
|
}
|
|
15
24
|
export function defineMessage(msg) {
|
|
16
|
-
|
|
25
|
+
return msg;
|
|
17
26
|
}
|
|
18
27
|
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export { FormattedListParts, FormattedNumberParts
|
|
28
|
+
export const FormattedDate = createFormattedComponent("formatDate");
|
|
29
|
+
export const FormattedTime = createFormattedComponent("formatTime");
|
|
30
|
+
export const FormattedNumber = createFormattedComponent("formatNumber");
|
|
31
|
+
export const FormattedList = createFormattedComponent("formatList");
|
|
32
|
+
export const FormattedDisplayName = createFormattedComponent("formatDisplayName");
|
|
33
|
+
export const FormattedDateParts = createFormattedDateTimePartsComponent("formatDate");
|
|
34
|
+
export const FormattedTimeParts = createFormattedDateTimePartsComponent("formatTime");
|
|
35
|
+
export { FormattedListParts, FormattedNumberParts } from "./src/components/createFormattedComponent.js";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
3
|
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
|
|
4
|
-
"version": "8.0.
|
|
4
|
+
"version": "8.0.11",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Eric Ferraiuolo <edf@ericf.me>",
|
|
7
7
|
"type": "module",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
15
15
|
"hoist-non-react-statics": "^3.3.2",
|
|
16
16
|
"tslib": "^2.8.0",
|
|
17
|
-
"@formatjs/ecma402-abstract": "3.0.
|
|
18
|
-
"@formatjs/icu-messageformat-parser": "3.
|
|
19
|
-
"
|
|
20
|
-
"intl
|
|
17
|
+
"@formatjs/ecma402-abstract": "3.0.8",
|
|
18
|
+
"@formatjs/icu-messageformat-parser": "3.3.0",
|
|
19
|
+
"intl-messageformat": "11.0.9",
|
|
20
|
+
"@formatjs/intl": "4.0.9"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@types/react": "19",
|