react-intl 6.8.8 → 7.0.0
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/README.md +1 -1
- package/index.d.ts +15 -17
- package/index.js +16 -17
- package/lib/index.d.ts +15 -17
- package/lib/index.js +9 -10
- package/lib/src/components/createFormattedComponent.d.ts +2 -3
- package/lib/src/components/createFormattedComponent.js +0 -1
- package/lib/src/components/createIntl.js +0 -1
- package/lib/src/components/dateTimeRange.js +0 -1
- package/lib/src/components/injectIntl.js +0 -1
- package/lib/src/components/message.js +0 -1
- package/lib/src/components/plural.js +0 -1
- package/lib/src/components/provider.d.ts +1 -1
- package/lib/src/components/provider.js +0 -1
- package/lib/src/components/relative.js +0 -1
- package/lib/src/components/useIntl.js +0 -1
- package/lib/src/types.js +0 -1
- package/lib/src/utils.js +0 -1
- package/package.json +7 -13
- package/react-intl.iife.js +88 -90
- package/src/components/createFormattedComponent.d.ts +2 -3
- package/src/components/createFormattedComponent.js +0 -1
- package/src/components/createIntl.js +0 -1
- package/src/components/dateTimeRange.js +0 -1
- package/src/components/injectIntl.js +0 -1
- package/src/components/message.js +0 -1
- package/src/components/plural.js +0 -1
- package/src/components/provider.d.ts +1 -1
- package/src/components/provider.js +0 -1
- package/src/components/relative.js +0 -1
- package/src/components/useIntl.js +0 -1
- package/src/types.js +0 -1
- package/src/utils.js +0 -1
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { MessageDescriptor, CustomFormatConfig, FormatDateOptions } from '@formatjs/intl';
|
|
3
|
-
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
|
|
4
|
-
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
|
|
5
1
|
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import IntlProvider from './src/components/provider';
|
|
2
|
+
import { CustomFormatConfig, FormatDateOptions, MessageDescriptor } from '@formatjs/intl';
|
|
3
|
+
import * as React from 'react';
|
|
9
4
|
import { createIntl } from './src/components/createIntl';
|
|
10
|
-
import FormattedRelativeTime from './src/components/relative';
|
|
11
|
-
import FormattedPlural from './src/components/plural';
|
|
12
|
-
import FormattedMessage from './src/components/message';
|
|
13
5
|
import FormattedDateTimeRange from './src/components/dateTimeRange';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
|
|
7
|
+
import FormattedMessage from './src/components/message';
|
|
8
|
+
import FormattedPlural from './src/components/plural';
|
|
9
|
+
import IntlProvider from './src/components/provider';
|
|
10
|
+
import FormattedRelativeTime from './src/components/relative';
|
|
11
|
+
import useIntl from './src/components/useIntl';
|
|
12
|
+
export { 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';
|
|
13
|
+
export { IntlConfig, IntlShape, ResolvedIntlConfig } from './src/types';
|
|
14
|
+
export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, WithIntlProps, WrappedComponentProps, };
|
|
17
15
|
export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
|
|
18
16
|
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
|
|
19
17
|
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
@@ -28,11 +26,11 @@ export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'locale
|
|
|
28
26
|
value: number;
|
|
29
27
|
children?(formattedNumber: string): React.ReactElement | null;
|
|
30
28
|
}>;
|
|
31
|
-
export declare const FormattedList: React.FC<
|
|
29
|
+
export declare const FormattedList: React.FC<Intl.ListFormatOptions & {
|
|
32
30
|
value: readonly React.ReactNode[];
|
|
33
31
|
}>;
|
|
34
|
-
export declare const FormattedDisplayName: React.FC<DisplayNamesOptions & {
|
|
35
|
-
value: string
|
|
32
|
+
export declare const FormattedDisplayName: React.FC<Intl.DisplayNamesOptions & {
|
|
33
|
+
value: string;
|
|
36
34
|
}>;
|
|
37
35
|
export declare const FormattedDateParts: React.FC<FormatDateOptions & {
|
|
38
36
|
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
|
|
@@ -42,6 +40,6 @@ export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
|
|
|
42
40
|
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
|
|
43
41
|
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
|
|
44
42
|
}>;
|
|
45
|
-
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
|
|
46
43
|
export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
|
|
47
44
|
export type { PrimitiveType } from 'intl-messageformat';
|
|
45
|
+
export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent';
|
package/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FormattedNumberParts = exports.FormattedListParts = exports.FormattedTimeParts = exports.FormattedDateParts = exports.FormattedDisplayName = exports.FormattedList = exports.FormattedNumber = exports.FormattedTime = exports.FormattedDate = exports.useIntl = exports.RawIntlProvider = exports.IntlProvider = exports.IntlContext = exports.injectIntl = exports.FormattedRelativeTime = exports.FormattedPlural = exports.FormattedMessage = exports.FormattedDateTimeRange = exports.createIntl = exports.UnsupportedFormatterError = exports.ReactIntlErrorCode = exports.ReactIntlError = exports.MissingTranslationError = exports.MissingDataError = exports.MessageFormatError = exports.InvalidConfigError = exports.createIntlCache = void 0;
|
|
4
4
|
exports.defineMessages = defineMessages;
|
|
5
5
|
exports.defineMessage = defineMessage;
|
|
6
6
|
var tslib_1 = require("tslib");
|
|
7
7
|
var createFormattedComponent_1 = require("./src/components/createFormattedComponent");
|
|
8
|
+
var createIntl_1 = require("./src/components/createIntl");
|
|
9
|
+
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return createIntl_1.createIntl; } });
|
|
10
|
+
var dateTimeRange_1 = tslib_1.__importDefault(require("./src/components/dateTimeRange"));
|
|
11
|
+
exports.FormattedDateTimeRange = dateTimeRange_1.default;
|
|
8
12
|
var injectIntl_1 = tslib_1.__importStar(require("./src/components/injectIntl"));
|
|
9
13
|
exports.injectIntl = injectIntl_1.default;
|
|
10
|
-
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
|
|
11
14
|
Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } });
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
|
|
16
|
+
var message_1 = tslib_1.__importDefault(require("./src/components/message"));
|
|
17
|
+
exports.FormattedMessage = message_1.default;
|
|
18
|
+
var plural_1 = tslib_1.__importDefault(require("./src/components/plural"));
|
|
19
|
+
exports.FormattedPlural = plural_1.default;
|
|
14
20
|
var provider_1 = tslib_1.__importDefault(require("./src/components/provider"));
|
|
15
21
|
exports.IntlProvider = provider_1.default;
|
|
16
|
-
var createIntl_1 = require("./src/components/createIntl");
|
|
17
|
-
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return createIntl_1.createIntl; } });
|
|
18
22
|
var relative_1 = tslib_1.__importDefault(require("./src/components/relative"));
|
|
19
23
|
exports.FormattedRelativeTime = relative_1.default;
|
|
20
|
-
var
|
|
21
|
-
exports.
|
|
22
|
-
var message_1 = tslib_1.__importDefault(require("./src/components/message"));
|
|
23
|
-
exports.FormattedMessage = message_1.default;
|
|
24
|
-
var dateTimeRange_1 = tslib_1.__importDefault(require("./src/components/dateTimeRange"));
|
|
25
|
-
exports.FormattedDateTimeRange = dateTimeRange_1.default;
|
|
24
|
+
var useIntl_1 = tslib_1.__importDefault(require("./src/components/useIntl"));
|
|
25
|
+
exports.useIntl = useIntl_1.default;
|
|
26
26
|
var intl_1 = require("@formatjs/intl");
|
|
27
27
|
Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } });
|
|
28
|
-
Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
|
|
29
28
|
Object.defineProperty(exports, "InvalidConfigError", { enumerable: true, get: function () { return intl_1.InvalidConfigError; } });
|
|
30
|
-
Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } });
|
|
31
29
|
Object.defineProperty(exports, "MessageFormatError", { enumerable: true, get: function () { return intl_1.MessageFormatError; } });
|
|
30
|
+
Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } });
|
|
32
31
|
Object.defineProperty(exports, "MissingTranslationError", { enumerable: true, get: function () { return intl_1.MissingTranslationError; } });
|
|
33
|
-
Object.defineProperty(exports, "ReactIntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } });
|
|
34
32
|
Object.defineProperty(exports, "ReactIntlError", { enumerable: true, get: function () { return intl_1.IntlError; } });
|
|
33
|
+
Object.defineProperty(exports, "ReactIntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } });
|
|
34
|
+
Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
|
|
35
35
|
function defineMessages(msgs) {
|
|
36
36
|
return msgs;
|
|
37
37
|
}
|
|
@@ -47,6 +47,5 @@ exports.FormattedDisplayName = (0, createFormattedComponent_1.createFormattedCom
|
|
|
47
47
|
exports.FormattedDateParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatDate');
|
|
48
48
|
exports.FormattedTimeParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatTime');
|
|
49
49
|
var createFormattedComponent_2 = require("./src/components/createFormattedComponent");
|
|
50
|
-
Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } });
|
|
51
50
|
Object.defineProperty(exports, "FormattedListParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedListParts; } });
|
|
52
|
-
|
|
51
|
+
Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } });
|
package/lib/index.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { MessageDescriptor, CustomFormatConfig, FormatDateOptions } from '@formatjs/intl';
|
|
3
|
-
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
|
|
4
|
-
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
|
|
5
1
|
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import IntlProvider from './src/components/provider';
|
|
2
|
+
import { CustomFormatConfig, FormatDateOptions, MessageDescriptor } from '@formatjs/intl';
|
|
3
|
+
import * as React from 'react';
|
|
9
4
|
import { createIntl } from './src/components/createIntl';
|
|
10
|
-
import FormattedRelativeTime from './src/components/relative';
|
|
11
|
-
import FormattedPlural from './src/components/plural';
|
|
12
|
-
import FormattedMessage from './src/components/message';
|
|
13
5
|
import FormattedDateTimeRange from './src/components/dateTimeRange';
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
|
|
7
|
+
import FormattedMessage from './src/components/message';
|
|
8
|
+
import FormattedPlural from './src/components/plural';
|
|
9
|
+
import IntlProvider from './src/components/provider';
|
|
10
|
+
import FormattedRelativeTime from './src/components/relative';
|
|
11
|
+
import useIntl from './src/components/useIntl';
|
|
12
|
+
export { 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';
|
|
13
|
+
export { IntlConfig, IntlShape, ResolvedIntlConfig } from './src/types';
|
|
14
|
+
export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, WithIntlProps, WrappedComponentProps, };
|
|
17
15
|
export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
|
|
18
16
|
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
|
|
19
17
|
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
@@ -28,11 +26,11 @@ export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'locale
|
|
|
28
26
|
value: number;
|
|
29
27
|
children?(formattedNumber: string): React.ReactElement | null;
|
|
30
28
|
}>;
|
|
31
|
-
export declare const FormattedList: React.FC<
|
|
29
|
+
export declare const FormattedList: React.FC<Intl.ListFormatOptions & {
|
|
32
30
|
value: readonly React.ReactNode[];
|
|
33
31
|
}>;
|
|
34
|
-
export declare const FormattedDisplayName: React.FC<DisplayNamesOptions & {
|
|
35
|
-
value: string
|
|
32
|
+
export declare const FormattedDisplayName: React.FC<Intl.DisplayNamesOptions & {
|
|
33
|
+
value: string;
|
|
36
34
|
}>;
|
|
37
35
|
export declare const FormattedDateParts: React.FC<FormatDateOptions & {
|
|
38
36
|
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
|
|
@@ -42,6 +40,6 @@ export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
|
|
|
42
40
|
value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
|
|
43
41
|
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
|
|
44
42
|
}>;
|
|
45
|
-
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
|
|
46
43
|
export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
|
|
47
44
|
export type { PrimitiveType } from 'intl-messageformat';
|
|
45
|
+
export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent';
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent';
|
|
2
|
-
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl';
|
|
3
|
-
import useIntl from './src/components/useIntl';
|
|
4
|
-
import IntlProvider from './src/components/provider';
|
|
5
2
|
import { createIntl } from './src/components/createIntl';
|
|
6
|
-
import FormattedRelativeTime from './src/components/relative';
|
|
7
|
-
import FormattedPlural from './src/components/plural';
|
|
8
|
-
import FormattedMessage from './src/components/message';
|
|
9
3
|
import FormattedDateTimeRange from './src/components/dateTimeRange';
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, } from './src/components/injectIntl';
|
|
5
|
+
import FormattedMessage from './src/components/message';
|
|
6
|
+
import FormattedPlural from './src/components/plural';
|
|
7
|
+
import IntlProvider from './src/components/provider';
|
|
8
|
+
import FormattedRelativeTime from './src/components/relative';
|
|
9
|
+
import useIntl from './src/components/useIntl';
|
|
10
|
+
export { createIntlCache, InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, UnsupportedFormatterError, } from '@formatjs/intl';
|
|
11
|
+
export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, };
|
|
12
12
|
export function defineMessages(msgs) {
|
|
13
13
|
return msgs;
|
|
14
14
|
}
|
|
@@ -23,5 +23,4 @@ export var FormattedList = createFormattedComponent('formatList');
|
|
|
23
23
|
export var FormattedDisplayName = createFormattedComponent('formatDisplayName');
|
|
24
24
|
export var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');
|
|
25
25
|
export var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');
|
|
26
|
-
export {
|
|
27
|
-
//# sourceMappingURL=index.js.map
|
|
26
|
+
export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions } from '@formatjs/intl';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { FormatDateOptions, FormatNumberOptions, FormatListOptions, FormatDisplayNameOptions } from '@formatjs/intl';
|
|
3
3
|
import { IntlShape } from '../types';
|
|
4
|
-
import { Part } from '@formatjs/intl-listformat';
|
|
5
4
|
type Formatter = {
|
|
6
5
|
formatDate: FormatDateOptions;
|
|
7
6
|
formatTime: FormatDateOptions;
|
|
@@ -15,7 +14,7 @@ export declare const FormattedNumberParts: React.FC<Formatter['formatNumber'] &
|
|
|
15
14
|
}>;
|
|
16
15
|
export declare const FormattedListParts: React.FC<Formatter['formatList'] & {
|
|
17
16
|
value: Parameters<IntlShape['formatList']>[0];
|
|
18
|
-
children(val:
|
|
17
|
+
children(val: ReturnType<Intl.ListFormat['formatToParts']>): React.ReactElement | null;
|
|
19
18
|
}>;
|
|
20
19
|
export declare function createFormattedDateTimePartsComponent<Name extends 'formatDate' | 'formatTime'>(name: Name): React.FC<Formatter[Name] & {
|
|
21
20
|
value: Parameters<IntlShape[Name]>[0];
|
|
@@ -33,4 +33,3 @@ FormattedMessage.displayName = 'FormattedMessage';
|
|
|
33
33
|
var MemoizedFormattedMessage = React.memo(FormattedMessage, areEqual);
|
|
34
34
|
MemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';
|
|
35
35
|
export default MemoizedFormattedMessage;
|
|
36
|
-
//# sourceMappingURL=message.js.map
|
|
@@ -19,7 +19,7 @@ interface State {
|
|
|
19
19
|
}
|
|
20
20
|
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
|
|
21
21
|
static displayName: string;
|
|
22
|
-
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "
|
|
22
|
+
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "onError" | "textComponent">;
|
|
23
23
|
private cache;
|
|
24
24
|
state: State;
|
|
25
25
|
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
|
package/lib/src/types.js
CHANGED
package/lib/src/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"zouxuoz <zouxuoz@gmail.com>"
|
|
116
116
|
],
|
|
117
117
|
"license": "BSD-3-Clause",
|
|
118
|
-
"homepage": "https://formatjs.io/docs/react-intl",
|
|
118
|
+
"homepage": "https://formatjs.github.io/docs/react-intl",
|
|
119
119
|
"bugs": {
|
|
120
120
|
"url": "https://github.com/formatjs/formatjs/issues"
|
|
121
121
|
},
|
|
@@ -132,20 +132,14 @@
|
|
|
132
132
|
"@types/react": "16 || 17 || 18",
|
|
133
133
|
"hoist-non-react-statics": "3",
|
|
134
134
|
"tslib": "2",
|
|
135
|
-
"
|
|
136
|
-
"@formatjs/
|
|
137
|
-
"
|
|
138
|
-
"@formatjs/ecma402-abstract": "2.2.
|
|
139
|
-
"@formatjs/intl": "2.10.14",
|
|
140
|
-
"@formatjs/intl-displaynames": "6.8.4"
|
|
141
|
-
},
|
|
142
|
-
"devDependencies": {
|
|
143
|
-
"@formatjs/intl-numberformat": "8.14.4",
|
|
144
|
-
"@formatjs/intl-relativetimeformat": "11.4.4"
|
|
135
|
+
"intl-messageformat": "10.7.7",
|
|
136
|
+
"@formatjs/intl": "3.0.0",
|
|
137
|
+
"@formatjs/icu-messageformat-parser": "2.9.4",
|
|
138
|
+
"@formatjs/ecma402-abstract": "2.2.4"
|
|
145
139
|
},
|
|
146
140
|
"peerDependencies": {
|
|
147
141
|
"react": "^16.6.0 || 17 || 18",
|
|
148
|
-
"typescript": "
|
|
142
|
+
"typescript": "5"
|
|
149
143
|
},
|
|
150
144
|
"peerDependenciesMeta": {
|
|
151
145
|
"typescript": {
|
package/react-intl.iife.js
CHANGED
|
@@ -4133,7 +4133,7 @@ var ReactIntl = (() => {
|
|
|
4133
4133
|
messageDescriptor = { id: "" };
|
|
4134
4134
|
}
|
|
4135
4135
|
var msgId = messageDescriptor.id, defaultMessage = messageDescriptor.defaultMessage;
|
|
4136
|
-
invariant(!!msgId, "[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
|
|
4136
|
+
invariant(!!msgId, "[@formatjs/intl] An `id` must be provided to format a message. You can either:\n1. Configure your build toolchain with [babel-plugin-formatjs](https://formatjs.github.io/docs/tooling/babel-plugin)\nor [@formatjs/ts-transformer](https://formatjs.github.io/docs/tooling/ts-transformer) OR\n2. Configure your `eslint` config to include [eslint-plugin-formatjs](https://formatjs.github.io/docs/tooling/linter#enforce-id)\nto autofix this issue");
|
|
4137
4137
|
var id = String(msgId);
|
|
4138
4138
|
var message = (
|
|
4139
4139
|
// In case messages is Object.create(null)
|
|
@@ -4491,7 +4491,7 @@ var ReactIntl = (() => {
|
|
|
4491
4491
|
}
|
|
4492
4492
|
function verifyConfigMessages(config) {
|
|
4493
4493
|
if (config.onWarn && config.defaultRichTextElements && messagesContainString(config.messages || {})) {
|
|
4494
|
-
config.onWarn('[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled. \nPlease consider using "@formatjs/cli" to pre-compile your messages for performance.\nFor more details see https://formatjs.io/docs/getting-started/message-distribution');
|
|
4494
|
+
config.onWarn('[@formatjs/intl] "defaultRichTextElements" was specified but "message" was not pre-compiled. \nPlease consider using "@formatjs/cli" to pre-compile your messages for performance.\nFor more details see https://formatjs.github.io/docs/getting-started/message-distribution');
|
|
4495
4495
|
}
|
|
4496
4496
|
}
|
|
4497
4497
|
function createIntl(config, cache) {
|
|
@@ -4500,13 +4500,13 @@ var ReactIntl = (() => {
|
|
|
4500
4500
|
var locale = resolvedConfig.locale, defaultLocale = resolvedConfig.defaultLocale, onError = resolvedConfig.onError;
|
|
4501
4501
|
if (!locale) {
|
|
4502
4502
|
if (onError) {
|
|
4503
|
-
onError(new InvalidConfigError('"locale" was not configured, using "'.concat(defaultLocale, '" as fallback. See https://formatjs.io/docs/react-intl/api#intlshape for more details')));
|
|
4503
|
+
onError(new InvalidConfigError('"locale" was not configured, using "'.concat(defaultLocale, '" as fallback. See https://formatjs.github.io/docs/react-intl/api#intlshape for more details')));
|
|
4504
4504
|
}
|
|
4505
4505
|
resolvedConfig.locale = resolvedConfig.defaultLocale || "en";
|
|
4506
4506
|
} else if (!Intl.NumberFormat.supportedLocalesOf(locale).length && onError) {
|
|
4507
|
-
onError(new MissingDataError('Missing locale data for locale: "'.concat(locale, '" in Intl.NumberFormat. Using default locale: "').concat(defaultLocale, '" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details')));
|
|
4507
|
+
onError(new MissingDataError('Missing locale data for locale: "'.concat(locale, '" in Intl.NumberFormat. Using default locale: "').concat(defaultLocale, '" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details')));
|
|
4508
4508
|
} else if (!Intl.DateTimeFormat.supportedLocalesOf(locale).length && onError) {
|
|
4509
|
-
onError(new MissingDataError('Missing locale data for locale: "'.concat(locale, '" in Intl.DateTimeFormat. Using default locale: "').concat(defaultLocale, '" as fallback. See https://formatjs.io/docs/react-intl#runtime-requirements for more details')));
|
|
4509
|
+
onError(new MissingDataError('Missing locale data for locale: "'.concat(locale, '" in Intl.DateTimeFormat. Using default locale: "').concat(defaultLocale, '" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details')));
|
|
4510
4510
|
}
|
|
4511
4511
|
verifyConfigMessages(resolvedConfig);
|
|
4512
4512
|
return __assign(__assign({}, resolvedConfig), {
|
|
@@ -4670,9 +4670,6 @@ var ReactIntl = (() => {
|
|
|
4670
4670
|
return Component;
|
|
4671
4671
|
}
|
|
4672
4672
|
|
|
4673
|
-
// packages/react-intl/src/components/provider.tsx
|
|
4674
|
-
var React6 = __toESM(window.React);
|
|
4675
|
-
|
|
4676
4673
|
// packages/react-intl/src/components/createIntl.ts
|
|
4677
4674
|
var React5 = __toESM(window.React);
|
|
4678
4675
|
function assignUniqueKeysToFormatXMLElementFnArgument(values) {
|
|
@@ -4733,7 +4730,80 @@ var ReactIntl = (() => {
|
|
|
4733
4730
|
});
|
|
4734
4731
|
};
|
|
4735
4732
|
|
|
4733
|
+
// packages/react-intl/src/components/dateTimeRange.tsx
|
|
4734
|
+
var React6 = __toESM(window.React);
|
|
4735
|
+
var FormattedDateTimeRange = (props) => {
|
|
4736
|
+
const intl = useIntl();
|
|
4737
|
+
const _a2 = props, { from, to, children } = _a2, formatProps = __objRest(_a2, ["from", "to", "children"]);
|
|
4738
|
+
const formattedValue = intl.formatDateTimeRange(from, to, formatProps);
|
|
4739
|
+
if (typeof children === "function") {
|
|
4740
|
+
return children(formattedValue);
|
|
4741
|
+
}
|
|
4742
|
+
const Text = intl.textComponent || React6.Fragment;
|
|
4743
|
+
return React6.createElement(Text, null, formattedValue);
|
|
4744
|
+
};
|
|
4745
|
+
FormattedDateTimeRange.displayName = "FormattedDateTimeRange";
|
|
4746
|
+
var dateTimeRange_default = FormattedDateTimeRange;
|
|
4747
|
+
|
|
4748
|
+
// packages/react-intl/src/components/message.tsx
|
|
4749
|
+
var React7 = __toESM(window.React);
|
|
4750
|
+
function areEqual(prevProps, nextProps) {
|
|
4751
|
+
const _a2 = prevProps, { values } = _a2, otherProps = __objRest(_a2, ["values"]);
|
|
4752
|
+
const _b = nextProps, { values: nextValues } = _b, nextOtherProps = __objRest(_b, ["values"]);
|
|
4753
|
+
return shallowEqual(nextValues, values) && shallowEqual(otherProps, nextOtherProps);
|
|
4754
|
+
}
|
|
4755
|
+
function FormattedMessage(props) {
|
|
4756
|
+
const intl = useIntl();
|
|
4757
|
+
const { formatMessage: formatMessage3, textComponent: Text = React7.Fragment } = intl;
|
|
4758
|
+
const {
|
|
4759
|
+
id,
|
|
4760
|
+
description,
|
|
4761
|
+
defaultMessage,
|
|
4762
|
+
values,
|
|
4763
|
+
children,
|
|
4764
|
+
tagName: Component = Text,
|
|
4765
|
+
ignoreTag
|
|
4766
|
+
} = props;
|
|
4767
|
+
const descriptor = { id, description, defaultMessage };
|
|
4768
|
+
let nodes = formatMessage3(descriptor, values, {
|
|
4769
|
+
ignoreTag
|
|
4770
|
+
});
|
|
4771
|
+
if (typeof children === "function") {
|
|
4772
|
+
return children(Array.isArray(nodes) ? nodes : [nodes]);
|
|
4773
|
+
}
|
|
4774
|
+
if (Component) {
|
|
4775
|
+
return React7.createElement(Component, null, React7.Children.toArray(nodes));
|
|
4776
|
+
}
|
|
4777
|
+
return React7.createElement(React7.Fragment, null, nodes);
|
|
4778
|
+
}
|
|
4779
|
+
FormattedMessage.displayName = "FormattedMessage";
|
|
4780
|
+
var MemoizedFormattedMessage = React7.memo(
|
|
4781
|
+
FormattedMessage,
|
|
4782
|
+
areEqual
|
|
4783
|
+
);
|
|
4784
|
+
MemoizedFormattedMessage.displayName = "MemoizedFormattedMessage";
|
|
4785
|
+
var message_default = MemoizedFormattedMessage;
|
|
4786
|
+
|
|
4787
|
+
// packages/react-intl/src/components/plural.tsx
|
|
4788
|
+
var React8 = __toESM(window.React);
|
|
4789
|
+
var FormattedPlural = (props) => {
|
|
4790
|
+
const { formatPlural: formatPlural2, textComponent: Text } = useIntl();
|
|
4791
|
+
const { value, other, children } = props;
|
|
4792
|
+
const pluralCategory = formatPlural2(value, props);
|
|
4793
|
+
const formattedPlural = props[pluralCategory] || other;
|
|
4794
|
+
if (typeof children === "function") {
|
|
4795
|
+
return children(formattedPlural);
|
|
4796
|
+
}
|
|
4797
|
+
if (Text) {
|
|
4798
|
+
return React8.createElement(Text, null, formattedPlural);
|
|
4799
|
+
}
|
|
4800
|
+
return formattedPlural;
|
|
4801
|
+
};
|
|
4802
|
+
FormattedPlural.displayName = "FormattedPlural";
|
|
4803
|
+
var plural_default = FormattedPlural;
|
|
4804
|
+
|
|
4736
4805
|
// packages/react-intl/src/components/provider.tsx
|
|
4806
|
+
var React9 = __toESM(window.React);
|
|
4737
4807
|
function processIntlConfig(config) {
|
|
4738
4808
|
return {
|
|
4739
4809
|
locale: config.locale,
|
|
@@ -4750,7 +4820,7 @@ var ReactIntl = (() => {
|
|
|
4750
4820
|
defaultRichTextElements: config.defaultRichTextElements
|
|
4751
4821
|
};
|
|
4752
4822
|
}
|
|
4753
|
-
var IntlProvider2 = class extends
|
|
4823
|
+
var IntlProvider2 = class extends React9.PureComponent {
|
|
4754
4824
|
constructor() {
|
|
4755
4825
|
super(...arguments);
|
|
4756
4826
|
__publicField(this, "cache", createIntlCache());
|
|
@@ -4772,14 +4842,14 @@ var ReactIntl = (() => {
|
|
|
4772
4842
|
}
|
|
4773
4843
|
render() {
|
|
4774
4844
|
invariantIntlContext(this.state.intl);
|
|
4775
|
-
return
|
|
4845
|
+
return React9.createElement(Provider, { value: this.state.intl }, this.props.children);
|
|
4776
4846
|
}
|
|
4777
4847
|
};
|
|
4778
4848
|
__publicField(IntlProvider2, "displayName", "IntlProvider");
|
|
4779
4849
|
__publicField(IntlProvider2, "defaultProps", DEFAULT_INTL_CONFIG2);
|
|
4780
4850
|
|
|
4781
4851
|
// packages/react-intl/src/components/relative.tsx
|
|
4782
|
-
var
|
|
4852
|
+
var React10 = __toESM(window.React);
|
|
4783
4853
|
var MINUTE = 60;
|
|
4784
4854
|
var HOUR = 60 * 60;
|
|
4785
4855
|
var DAY = 60 * 60 * 24;
|
|
@@ -4837,9 +4907,9 @@ var ReactIntl = (() => {
|
|
|
4837
4907
|
return children(formattedRelativeTime);
|
|
4838
4908
|
}
|
|
4839
4909
|
if (Text) {
|
|
4840
|
-
return
|
|
4910
|
+
return React10.createElement(Text, null, formattedRelativeTime);
|
|
4841
4911
|
}
|
|
4842
|
-
return
|
|
4912
|
+
return React10.createElement(React10.Fragment, null, formattedRelativeTime);
|
|
4843
4913
|
};
|
|
4844
4914
|
var FormattedRelativeTime = (_a2) => {
|
|
4845
4915
|
var _b = _a2, {
|
|
@@ -4855,9 +4925,9 @@ var ReactIntl = (() => {
|
|
|
4855
4925
|
!updateIntervalInSeconds || !!(updateIntervalInSeconds && canIncrement(unit)),
|
|
4856
4926
|
"Cannot schedule update with unit longer than hour"
|
|
4857
4927
|
);
|
|
4858
|
-
const [prevUnit, setPrevUnit] =
|
|
4859
|
-
const [prevValue, setPrevValue] =
|
|
4860
|
-
const [currentValueInSeconds, setCurrentValueInSeconds] =
|
|
4928
|
+
const [prevUnit, setPrevUnit] = React10.useState();
|
|
4929
|
+
const [prevValue, setPrevValue] = React10.useState(0);
|
|
4930
|
+
const [currentValueInSeconds, setCurrentValueInSeconds] = React10.useState(0);
|
|
4861
4931
|
let updateTimer;
|
|
4862
4932
|
if (unit !== prevUnit || value !== prevValue) {
|
|
4863
4933
|
setPrevValue(value || 0);
|
|
@@ -4866,7 +4936,7 @@ var ReactIntl = (() => {
|
|
|
4866
4936
|
canIncrement(unit) ? valueToSeconds(value, unit) : 0
|
|
4867
4937
|
);
|
|
4868
4938
|
}
|
|
4869
|
-
|
|
4939
|
+
React10.useEffect(() => {
|
|
4870
4940
|
function clearUpdateTimer() {
|
|
4871
4941
|
clearTimeout(updateTimer);
|
|
4872
4942
|
}
|
|
@@ -4901,7 +4971,7 @@ var ReactIntl = (() => {
|
|
|
4901
4971
|
const unitDuration = getDurationInSeconds(currentUnit);
|
|
4902
4972
|
currentValue = Math.round(currentValueInSeconds / unitDuration);
|
|
4903
4973
|
}
|
|
4904
|
-
return
|
|
4974
|
+
return React10.createElement(
|
|
4905
4975
|
SimpleFormattedRelativeTime,
|
|
4906
4976
|
__spreadValues({
|
|
4907
4977
|
value: currentValue,
|
|
@@ -4912,78 +4982,6 @@ var ReactIntl = (() => {
|
|
|
4912
4982
|
FormattedRelativeTime.displayName = "FormattedRelativeTime";
|
|
4913
4983
|
var relative_default = FormattedRelativeTime;
|
|
4914
4984
|
|
|
4915
|
-
// packages/react-intl/src/components/plural.tsx
|
|
4916
|
-
var React8 = __toESM(window.React);
|
|
4917
|
-
var FormattedPlural = (props) => {
|
|
4918
|
-
const { formatPlural: formatPlural2, textComponent: Text } = useIntl();
|
|
4919
|
-
const { value, other, children } = props;
|
|
4920
|
-
const pluralCategory = formatPlural2(value, props);
|
|
4921
|
-
const formattedPlural = props[pluralCategory] || other;
|
|
4922
|
-
if (typeof children === "function") {
|
|
4923
|
-
return children(formattedPlural);
|
|
4924
|
-
}
|
|
4925
|
-
if (Text) {
|
|
4926
|
-
return React8.createElement(Text, null, formattedPlural);
|
|
4927
|
-
}
|
|
4928
|
-
return formattedPlural;
|
|
4929
|
-
};
|
|
4930
|
-
FormattedPlural.displayName = "FormattedPlural";
|
|
4931
|
-
var plural_default = FormattedPlural;
|
|
4932
|
-
|
|
4933
|
-
// packages/react-intl/src/components/message.tsx
|
|
4934
|
-
var React9 = __toESM(window.React);
|
|
4935
|
-
function areEqual(prevProps, nextProps) {
|
|
4936
|
-
const _a2 = prevProps, { values } = _a2, otherProps = __objRest(_a2, ["values"]);
|
|
4937
|
-
const _b = nextProps, { values: nextValues } = _b, nextOtherProps = __objRest(_b, ["values"]);
|
|
4938
|
-
return shallowEqual(nextValues, values) && shallowEqual(otherProps, nextOtherProps);
|
|
4939
|
-
}
|
|
4940
|
-
function FormattedMessage(props) {
|
|
4941
|
-
const intl = useIntl();
|
|
4942
|
-
const { formatMessage: formatMessage3, textComponent: Text = React9.Fragment } = intl;
|
|
4943
|
-
const {
|
|
4944
|
-
id,
|
|
4945
|
-
description,
|
|
4946
|
-
defaultMessage,
|
|
4947
|
-
values,
|
|
4948
|
-
children,
|
|
4949
|
-
tagName: Component = Text,
|
|
4950
|
-
ignoreTag
|
|
4951
|
-
} = props;
|
|
4952
|
-
const descriptor = { id, description, defaultMessage };
|
|
4953
|
-
let nodes = formatMessage3(descriptor, values, {
|
|
4954
|
-
ignoreTag
|
|
4955
|
-
});
|
|
4956
|
-
if (typeof children === "function") {
|
|
4957
|
-
return children(Array.isArray(nodes) ? nodes : [nodes]);
|
|
4958
|
-
}
|
|
4959
|
-
if (Component) {
|
|
4960
|
-
return React9.createElement(Component, null, React9.Children.toArray(nodes));
|
|
4961
|
-
}
|
|
4962
|
-
return React9.createElement(React9.Fragment, null, nodes);
|
|
4963
|
-
}
|
|
4964
|
-
FormattedMessage.displayName = "FormattedMessage";
|
|
4965
|
-
var MemoizedFormattedMessage = React9.memo(
|
|
4966
|
-
FormattedMessage,
|
|
4967
|
-
areEqual
|
|
4968
|
-
);
|
|
4969
|
-
MemoizedFormattedMessage.displayName = "MemoizedFormattedMessage";
|
|
4970
|
-
var message_default = MemoizedFormattedMessage;
|
|
4971
|
-
|
|
4972
|
-
// packages/react-intl/src/components/dateTimeRange.tsx
|
|
4973
|
-
var React10 = __toESM(window.React);
|
|
4974
|
-
var FormattedDateTimeRange = (props) => {
|
|
4975
|
-
const intl = useIntl();
|
|
4976
|
-
const _a2 = props, { from, to, children } = _a2, formatProps = __objRest(_a2, ["from", "to", "children"]);
|
|
4977
|
-
const formattedValue = intl.formatDateTimeRange(from, to, formatProps);
|
|
4978
|
-
if (typeof children === "function") {
|
|
4979
|
-
return children(formattedValue);
|
|
4980
|
-
}
|
|
4981
|
-
const Text = intl.textComponent || React10.Fragment;
|
|
4982
|
-
return React10.createElement(Text, null, formattedValue);
|
|
4983
|
-
};
|
|
4984
|
-
FormattedDateTimeRange.displayName = "FormattedDateTimeRange";
|
|
4985
|
-
var dateTimeRange_default = FormattedDateTimeRange;
|
|
4986
|
-
|
|
4987
4985
|
// packages/react-intl/index.ts
|
|
4988
4986
|
function defineMessages(msgs) {
|
|
4989
4987
|
return msgs;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions } from '@formatjs/intl';
|
|
1
2
|
import * as React from 'react';
|
|
2
|
-
import { FormatDateOptions, FormatNumberOptions, FormatListOptions, FormatDisplayNameOptions } from '@formatjs/intl';
|
|
3
3
|
import { IntlShape } from '../types';
|
|
4
|
-
import { Part } from '@formatjs/intl-listformat';
|
|
5
4
|
type Formatter = {
|
|
6
5
|
formatDate: FormatDateOptions;
|
|
7
6
|
formatTime: FormatDateOptions;
|
|
@@ -15,7 +14,7 @@ export declare const FormattedNumberParts: React.FC<Formatter['formatNumber'] &
|
|
|
15
14
|
}>;
|
|
16
15
|
export declare const FormattedListParts: React.FC<Formatter['formatList'] & {
|
|
17
16
|
value: Parameters<IntlShape['formatList']>[0];
|
|
18
|
-
children(val:
|
|
17
|
+
children(val: ReturnType<Intl.ListFormat['formatToParts']>): React.ReactElement | null;
|
|
19
18
|
}>;
|
|
20
19
|
export declare function createFormattedDateTimePartsComponent<Name extends 'formatDate' | 'formatTime'>(name: Name): React.FC<Formatter[Name] & {
|
|
21
20
|
value: Parameters<IntlShape[Name]>[0];
|
|
@@ -35,4 +35,3 @@ FormattedMessage.displayName = 'FormattedMessage';
|
|
|
35
35
|
var MemoizedFormattedMessage = React.memo(FormattedMessage, areEqual);
|
|
36
36
|
MemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage';
|
|
37
37
|
exports.default = MemoizedFormattedMessage;
|
|
38
|
-
//# sourceMappingURL=message.js.map
|
package/src/components/plural.js
CHANGED
|
@@ -19,7 +19,7 @@ interface State {
|
|
|
19
19
|
}
|
|
20
20
|
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
|
|
21
21
|
static displayName: string;
|
|
22
|
-
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "
|
|
22
|
+
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "onError" | "textComponent">;
|
|
23
23
|
private cache;
|
|
24
24
|
state: State;
|
|
25
25
|
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
|
package/src/types.js
CHANGED
package/src/utils.js
CHANGED