react-intl 5.20.12 → 5.21.2
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 +8 -7
- package/index.d.ts.map +1 -1
- package/index.js +26 -28
- package/lib/index.d.ts +8 -7
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -7
- package/lib/src/components/provider.d.ts +1 -1
- package/lib/src/components/provider.d.ts.map +1 -1
- package/lib/src/components/provider.js +2 -1
- package/lib/src/utils.d.ts +1 -1
- package/lib/src/utils.d.ts.map +1 -1
- package/package.json +8 -8
- package/react-intl.iife.js +77 -47
- package/src/components/createFormattedComponent.js +10 -10
- package/src/components/dateTimeRange.js +4 -4
- package/src/components/injectIntl.js +6 -6
- package/src/components/message.js +7 -7
- package/src/components/plural.js +3 -3
- package/src/components/provider.d.ts +1 -1
- package/src/components/provider.d.ts.map +1 -1
- package/src/components/provider.js +15 -14
- package/src/components/relative.js +7 -7
- package/src/components/useIntl.js +2 -2
- package/src/utils.d.ts +1 -1
- package/src/utils.d.ts.map +1 -1
- package/src/utils.js +3 -3
package/index.d.ts
CHANGED
|
@@ -3,13 +3,18 @@ import { MessageDescriptor, CustomFormatConfig, FormatDateOptions } from '@forma
|
|
|
3
3
|
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
|
|
4
4
|
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
|
|
5
5
|
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
6
|
+
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
|
|
7
|
+
import useIntl from './src/components/useIntl';
|
|
8
|
+
import IntlProvider, { createIntl } from './src/components/provider';
|
|
9
|
+
import FormattedRelativeTime from './src/components/relative';
|
|
10
|
+
import FormattedPlural from './src/components/plural';
|
|
11
|
+
import FormattedMessage from './src/components/message';
|
|
12
|
+
import FormattedDateTimeRange from './src/components/dateTimeRange';
|
|
13
|
+
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, WithIntlProps, WrappedComponentProps, createIntl, injectIntl, useIntl, };
|
|
6
14
|
export { IntlConfig, ResolvedIntlConfig, IntlShape } from './src/types';
|
|
7
15
|
export { createIntlCache, MessageDescriptor, IntlCache, Formatters, IntlFormatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
|
|
8
16
|
export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
|
|
9
17
|
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
|
|
10
|
-
export { default as injectIntl, Provider as RawIntlProvider, Context as IntlContext, WithIntlProps, WrappedComponentProps, } from './src/components/injectIntl';
|
|
11
|
-
export { default as useIntl } from './src/components/useIntl';
|
|
12
|
-
export { default as IntlProvider, createIntl } from './src/components/provider';
|
|
13
18
|
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
14
19
|
value: string | number | Date | undefined;
|
|
15
20
|
}>;
|
|
@@ -34,9 +39,5 @@ export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
|
|
|
34
39
|
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
|
|
35
40
|
}>;
|
|
36
41
|
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
|
|
37
|
-
export { default as FormattedRelativeTime } from './src/components/relative';
|
|
38
|
-
export { default as FormattedPlural } from './src/components/plural';
|
|
39
|
-
export { default as FormattedMessage } from './src/components/message';
|
|
40
|
-
export { default as FormattedDateTimeRange } from './src/components/dateTimeRange';
|
|
41
42
|
export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
|
|
42
43
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react-intl/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,aAAa,CAAA;AACrE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,IAAI,kBAAkB,EACnC,SAAS,IAAI,cAAc,GAC5B,MAAM,gBAAgB,CAAA;AAEvB,wBAAgB,cAAc,CAC5B,CAAC,SAAS,MAAM,GAAG,EACnB,CAAC,GAAG,iBAAiB,EACrB,CAAC,SAAS,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,EACrC,IAAI,EAAE,CAAC,GAAG,CAAC,CAEZ;AAED,wBAAgB,aAAa,CAAC,CAAC,SAAS,iBAAiB,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAEpE;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","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C,EAAE,CACvC,iBAAiB,GAAG;IAClB,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;IAC5D,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CACpE,CACoD,CAAA;AACvD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACvC,iBAAiB,GAAG;IAClB,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;IAC5D,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CACpE,CACoD,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,2CAA2C,CAAA;AAClD,YAAY,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA"}
|
package/index.js
CHANGED
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
3
|
+
exports.FormattedListParts = exports.FormattedNumberParts = exports.FormattedTimeParts = exports.FormattedDateParts = exports.FormattedDisplayName = exports.FormattedList = exports.FormattedNumber = exports.FormattedTime = exports.FormattedDate = exports.defineMessage = exports.defineMessages = exports.ReactIntlError = exports.ReactIntlErrorCode = exports.MissingTranslationError = exports.MessageFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.createIntlCache = exports.useIntl = exports.injectIntl = exports.createIntl = exports.RawIntlProvider = exports.IntlProvider = exports.IntlContext = exports.FormattedRelativeTime = exports.FormattedPlural = exports.FormattedMessage = exports.FormattedDateTimeRange = void 0;
|
|
4
|
+
var tslib_1 = require("tslib");
|
|
7
5
|
var createFormattedComponent_1 = require("./src/components/createFormattedComponent");
|
|
6
|
+
var injectIntl_1 = (0, tslib_1.__importStar)(require("./src/components/injectIntl"));
|
|
7
|
+
exports.injectIntl = injectIntl_1.default;
|
|
8
|
+
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
|
|
9
|
+
Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } });
|
|
10
|
+
var useIntl_1 = (0, tslib_1.__importDefault)(require("./src/components/useIntl"));
|
|
11
|
+
exports.useIntl = useIntl_1.default;
|
|
12
|
+
var provider_1 = (0, tslib_1.__importStar)(require("./src/components/provider"));
|
|
13
|
+
exports.IntlProvider = provider_1.default;
|
|
14
|
+
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return provider_1.createIntl; } });
|
|
15
|
+
var relative_1 = (0, tslib_1.__importDefault)(require("./src/components/relative"));
|
|
16
|
+
exports.FormattedRelativeTime = relative_1.default;
|
|
17
|
+
var plural_1 = (0, tslib_1.__importDefault)(require("./src/components/plural"));
|
|
18
|
+
exports.FormattedPlural = plural_1.default;
|
|
19
|
+
var message_1 = (0, tslib_1.__importDefault)(require("./src/components/message"));
|
|
20
|
+
exports.FormattedMessage = message_1.default;
|
|
21
|
+
var dateTimeRange_1 = (0, tslib_1.__importDefault)(require("./src/components/dateTimeRange"));
|
|
22
|
+
exports.FormattedDateTimeRange = dateTimeRange_1.default;
|
|
8
23
|
var intl_1 = require("@formatjs/intl");
|
|
9
24
|
Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } });
|
|
10
25
|
Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
|
|
@@ -22,32 +37,15 @@ function defineMessage(msg) {
|
|
|
22
37
|
return msg;
|
|
23
38
|
}
|
|
24
39
|
exports.defineMessage = defineMessage;
|
|
25
|
-
var injectIntl_1 = require("./src/components/injectIntl");
|
|
26
|
-
Object.defineProperty(exports, "injectIntl", { enumerable: true, get: function () { return __importDefault(injectIntl_1).default; } });
|
|
27
|
-
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
|
|
28
|
-
Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } });
|
|
29
|
-
var useIntl_1 = require("./src/components/useIntl");
|
|
30
|
-
Object.defineProperty(exports, "useIntl", { enumerable: true, get: function () { return __importDefault(useIntl_1).default; } });
|
|
31
|
-
var provider_1 = require("./src/components/provider");
|
|
32
|
-
Object.defineProperty(exports, "IntlProvider", { enumerable: true, get: function () { return __importDefault(provider_1).default; } });
|
|
33
|
-
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return provider_1.createIntl; } });
|
|
34
40
|
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
|
|
35
|
-
exports.FormattedDate = createFormattedComponent_1.createFormattedComponent('formatDate');
|
|
36
|
-
exports.FormattedTime = createFormattedComponent_1.createFormattedComponent('formatTime');
|
|
41
|
+
exports.FormattedDate = (0, createFormattedComponent_1.createFormattedComponent)('formatDate');
|
|
42
|
+
exports.FormattedTime = (0, createFormattedComponent_1.createFormattedComponent)('formatTime');
|
|
37
43
|
// @ts-ignore issue w/ TS Intl types
|
|
38
|
-
exports.FormattedNumber = createFormattedComponent_1.createFormattedComponent('formatNumber');
|
|
39
|
-
exports.FormattedList = createFormattedComponent_1.createFormattedComponent('formatList');
|
|
40
|
-
exports.FormattedDisplayName = createFormattedComponent_1.createFormattedComponent('formatDisplayName');
|
|
41
|
-
exports.FormattedDateParts = createFormattedComponent_1.createFormattedDateTimePartsComponent('formatDate');
|
|
42
|
-
exports.FormattedTimeParts = createFormattedComponent_1.createFormattedDateTimePartsComponent('formatTime');
|
|
44
|
+
exports.FormattedNumber = (0, createFormattedComponent_1.createFormattedComponent)('formatNumber');
|
|
45
|
+
exports.FormattedList = (0, createFormattedComponent_1.createFormattedComponent)('formatList');
|
|
46
|
+
exports.FormattedDisplayName = (0, createFormattedComponent_1.createFormattedComponent)('formatDisplayName');
|
|
47
|
+
exports.FormattedDateParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatDate');
|
|
48
|
+
exports.FormattedTimeParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatTime');
|
|
43
49
|
var createFormattedComponent_2 = require("./src/components/createFormattedComponent");
|
|
44
50
|
Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } });
|
|
45
51
|
Object.defineProperty(exports, "FormattedListParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedListParts; } });
|
|
46
|
-
var relative_1 = require("./src/components/relative");
|
|
47
|
-
Object.defineProperty(exports, "FormattedRelativeTime", { enumerable: true, get: function () { return __importDefault(relative_1).default; } });
|
|
48
|
-
var plural_1 = require("./src/components/plural");
|
|
49
|
-
Object.defineProperty(exports, "FormattedPlural", { enumerable: true, get: function () { return __importDefault(plural_1).default; } });
|
|
50
|
-
var message_1 = require("./src/components/message");
|
|
51
|
-
Object.defineProperty(exports, "FormattedMessage", { enumerable: true, get: function () { return __importDefault(message_1).default; } });
|
|
52
|
-
var dateTimeRange_1 = require("./src/components/dateTimeRange");
|
|
53
|
-
Object.defineProperty(exports, "FormattedDateTimeRange", { enumerable: true, get: function () { return __importDefault(dateTimeRange_1).default; } });
|
package/lib/index.d.ts
CHANGED
|
@@ -3,13 +3,18 @@ import { MessageDescriptor, CustomFormatConfig, FormatDateOptions } from '@forma
|
|
|
3
3
|
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
|
|
4
4
|
import { DisplayNamesOptions } from '@formatjs/intl-displaynames';
|
|
5
5
|
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
6
|
+
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
|
|
7
|
+
import useIntl from './src/components/useIntl';
|
|
8
|
+
import IntlProvider, { createIntl } from './src/components/provider';
|
|
9
|
+
import FormattedRelativeTime from './src/components/relative';
|
|
10
|
+
import FormattedPlural from './src/components/plural';
|
|
11
|
+
import FormattedMessage from './src/components/message';
|
|
12
|
+
import FormattedDateTimeRange from './src/components/dateTimeRange';
|
|
13
|
+
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, WithIntlProps, WrappedComponentProps, createIntl, injectIntl, useIntl, };
|
|
6
14
|
export { IntlConfig, ResolvedIntlConfig, IntlShape } from './src/types';
|
|
7
15
|
export { createIntlCache, MessageDescriptor, IntlCache, Formatters, IntlFormatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
|
|
8
16
|
export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
|
|
9
17
|
export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
|
|
10
|
-
export { default as injectIntl, Provider as RawIntlProvider, Context as IntlContext, WithIntlProps, WrappedComponentProps, } from './src/components/injectIntl';
|
|
11
|
-
export { default as useIntl } from './src/components/useIntl';
|
|
12
|
-
export { default as IntlProvider, createIntl } from './src/components/provider';
|
|
13
18
|
export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
14
19
|
value: string | number | Date | undefined;
|
|
15
20
|
}>;
|
|
@@ -34,9 +39,5 @@ export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
|
|
|
34
39
|
children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
|
|
35
40
|
}>;
|
|
36
41
|
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
|
|
37
|
-
export { default as FormattedRelativeTime } from './src/components/relative';
|
|
38
|
-
export { default as FormattedPlural } from './src/components/plural';
|
|
39
|
-
export { default as FormattedMessage } from './src/components/message';
|
|
40
|
-
export { default as FormattedDateTimeRange } from './src/components/dateTimeRange';
|
|
41
42
|
export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
|
|
42
43
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/react-intl/index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAC,qBAAqB,EAAC,MAAM,2BAA2B,CAAA;AAC/D,OAAO,EAAC,mBAAmB,EAAC,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAA;AAC9D,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAE,SAAS,EAAC,MAAM,aAAa,CAAA;AACrE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,UAAU,EACV,cAAc,EACd,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,IAAI,kBAAkB,EACnC,SAAS,IAAI,cAAc,GAC5B,MAAM,gBAAgB,CAAA;AAEvB,wB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AM,aAAa,EAAE,KAAK,CAAC,EAAE,CAClC,qBAAqB,GAAG;IACtB,KAAK,EAAE,SAAS,KAAK,CAAC,SAAS,EAAE,CAAA;CAClC,CACuC,CAAA;AAC1C,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CACzC,mBAAmB,GAAG;IACpB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjD,CAC8C,CAAA;AACjD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACvC,iBAAiB,GAAG;IAClB,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;IAC5D,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CACpE,CACoD,CAAA;AACvD,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CACvC,iBAAiB,GAAG;IAClB,KAAK,EAAE,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAA;IAC5D,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;CACpE,CACoD,CAAA;AAEvD,OAAO,EACL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,2CAA2C,CAAA;AAClD,YAAY,EAAC,oBAAoB,EAAC,MAAM,oCAAoC,CAAA"}
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
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, { createIntl } from './src/components/provider';
|
|
5
|
+
import FormattedRelativeTime from './src/components/relative';
|
|
6
|
+
import FormattedPlural from './src/components/plural';
|
|
7
|
+
import FormattedMessage from './src/components/message';
|
|
8
|
+
import FormattedDateTimeRange from './src/components/dateTimeRange';
|
|
9
|
+
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, createIntl, injectIntl, useIntl, };
|
|
2
10
|
export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl';
|
|
3
11
|
export function defineMessages(msgs) {
|
|
4
12
|
return msgs;
|
|
@@ -6,9 +14,6 @@ export function defineMessages(msgs) {
|
|
|
6
14
|
export function defineMessage(msg) {
|
|
7
15
|
return msg;
|
|
8
16
|
}
|
|
9
|
-
export { default as injectIntl, Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl';
|
|
10
|
-
export { default as useIntl } from './src/components/useIntl';
|
|
11
|
-
export { default as IntlProvider, createIntl } from './src/components/provider';
|
|
12
17
|
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
|
|
13
18
|
export var FormattedDate = createFormattedComponent('formatDate');
|
|
14
19
|
export var FormattedTime = createFormattedComponent('formatTime');
|
|
@@ -19,7 +24,3 @@ export var FormattedDisplayName = createFormattedComponent('formatDisplayName');
|
|
|
19
24
|
export var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');
|
|
20
25
|
export var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');
|
|
21
26
|
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent';
|
|
22
|
-
export { default as FormattedRelativeTime } from './src/components/relative';
|
|
23
|
-
export { default as FormattedPlural } from './src/components/plural';
|
|
24
|
-
export { default as FormattedMessage } from './src/components/message';
|
|
25
|
-
export { default as FormattedDateTimeRange } from './src/components/dateTimeRange';
|
|
@@ -25,7 +25,7 @@ interface State {
|
|
|
25
25
|
export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
|
|
26
26
|
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
|
|
27
27
|
static displayName: string;
|
|
28
|
-
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "onError" | "textComponent">;
|
|
28
|
+
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "onError" | "textComponent">;
|
|
29
29
|
private cache;
|
|
30
30
|
state: State;
|
|
31
31
|
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAkED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CA8BzE,CAAA;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAa,CAG3D,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EACnC,KAAK,CACN;IACC,MAAM,CAAC,WAAW,SAAiB;IACnC,MAAM,CAAC,YAAY,gLAAsB;IACzC,OAAO,CAAC,KAAK,CAA+B;IAC5C,KAAK,EAAE,KAAK,CAIX;IAED,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,KAAK,GACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAWxB,MAAM,IAAI,GAAG,CAAC,OAAO;CAItB"}
|
|
@@ -13,6 +13,7 @@ function processIntlConfig(config) {
|
|
|
13
13
|
return {
|
|
14
14
|
locale: config.locale,
|
|
15
15
|
timeZone: config.timeZone,
|
|
16
|
+
fallbackOnEmptyString: config.fallbackOnEmptyString,
|
|
16
17
|
formats: config.formats,
|
|
17
18
|
textComponent: config.textComponent,
|
|
18
19
|
messages: config.messages,
|
|
@@ -44,7 +45,7 @@ var formatMessage = function (config, formatters, descriptor, rawValues) {
|
|
|
44
45
|
var chunks = coreFormatMessage.apply(void 0, __spreadArray([config,
|
|
45
46
|
formatters,
|
|
46
47
|
descriptor,
|
|
47
|
-
values], rest));
|
|
48
|
+
values], rest, false));
|
|
48
49
|
if (Array.isArray(chunks)) {
|
|
49
50
|
return React.Children.toArray(chunks);
|
|
50
51
|
}
|
package/lib/src/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ResolvedIntlConfig } from './types';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { FormatXMLElementFn } from 'intl-messageformat';
|
|
4
4
|
export declare function invariantIntlContext(intl?: any): asserts intl;
|
|
5
|
-
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
5
|
+
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
6
6
|
/**
|
|
7
7
|
* Takes a `formatXMLElementFn`, and composes it in function, which passes
|
|
8
8
|
* argument `parts` through, assigning unique key to each part, to prevent
|
package/lib/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAA;AAKrD,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAM7D;AAED,eAAO,MAAM,mBAAmB,EAAE,IAAI,CACpC,kBAAkB,EAChB,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,SAAS,CAIZ,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,GACtD,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAKrC;AAED,wBAAgB,YAAY,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,WA6BnB"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAA;AAKrD,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAM7D;AAED,eAAO,MAAM,mBAAmB,EAAE,IAAI,CACpC,kBAAkB,EAChB,uBAAuB,GACvB,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,SAAS,CAIZ,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,GACtD,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAKrC;AAED,wBAAgB,YAAY,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,WA6BnB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.21.2",
|
|
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",
|
|
@@ -128,20 +128,20 @@
|
|
|
128
128
|
"types": "index.d.ts",
|
|
129
129
|
"sideEffects": false,
|
|
130
130
|
"dependencies": {
|
|
131
|
-
"@formatjs/ecma402-abstract": "1.
|
|
132
|
-
"@formatjs/icu-messageformat-parser": "2.0.
|
|
133
|
-
"@formatjs/intl": "1.
|
|
134
|
-
"@formatjs/intl-displaynames": "5.2.
|
|
135
|
-
"@formatjs/intl-listformat": "6.3.
|
|
131
|
+
"@formatjs/ecma402-abstract": "1.10.0",
|
|
132
|
+
"@formatjs/icu-messageformat-parser": "2.0.14",
|
|
133
|
+
"@formatjs/intl": "1.15.2",
|
|
134
|
+
"@formatjs/intl-displaynames": "5.2.5",
|
|
135
|
+
"@formatjs/intl-listformat": "6.3.5",
|
|
136
136
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
137
137
|
"@types/react": "16 || 17",
|
|
138
138
|
"hoist-non-react-statics": "^3.3.2",
|
|
139
|
-
"intl-messageformat": "9.9.
|
|
139
|
+
"intl-messageformat": "9.9.6",
|
|
140
140
|
"tslib": "^2.1.0"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
143
|
"react": "^16.3.0 || 17",
|
|
144
|
-
"typescript": "^4.
|
|
144
|
+
"typescript": "^4.4"
|
|
145
145
|
},
|
|
146
146
|
"peerDependenciesMeta": {
|
|
147
147
|
"typescript": {
|
package/react-intl.iife.js
CHANGED
|
@@ -8,9 +8,17 @@ var ReactIntl = (function() {
|
|
|
8
8
|
var __markAsModule = function(target) {
|
|
9
9
|
return __defProp(target, "__esModule", { value: true });
|
|
10
10
|
};
|
|
11
|
-
var __require =
|
|
11
|
+
var __require = /* @__PURE__ */ function(x) {
|
|
12
|
+
return typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
13
|
+
get: function(a, b) {
|
|
14
|
+
return (typeof require !== "undefined" ? require : a)[b];
|
|
15
|
+
}
|
|
16
|
+
}) : x;
|
|
17
|
+
}(function(x) {
|
|
18
|
+
if (typeof require !== "undefined")
|
|
19
|
+
return require.apply(this, arguments);
|
|
12
20
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
-
};
|
|
21
|
+
});
|
|
14
22
|
var __commonJS = function(cb, mod) {
|
|
15
23
|
return function __require2() {
|
|
16
24
|
return mod || (0, cb[Object.keys(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
@@ -350,7 +358,7 @@ var ReactIntl = (function() {
|
|
|
350
358
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
351
359
|
var locale = requestedLocales_1[_i];
|
|
352
360
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
353
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
361
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
354
362
|
if (availableLocale) {
|
|
355
363
|
result.locale = availableLocale;
|
|
356
364
|
if (locale !== noExtensionLocale) {
|
|
@@ -407,7 +415,7 @@ var ReactIntl = (function() {
|
|
|
407
415
|
foundLocale = minimizedRequestedLocale;
|
|
408
416
|
break;
|
|
409
417
|
}
|
|
410
|
-
foundLocale = BestAvailableLocale_1.BestAvailableLocale(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
418
|
+
foundLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(minimizedAvailableLocales, maximizedRequestedLocale);
|
|
411
419
|
}
|
|
412
420
|
return {
|
|
413
421
|
locale: foundLocale && minimizedAvailableLocaleMap[foundLocale] || getDefaultLocale()
|
|
@@ -425,7 +433,7 @@ var ReactIntl = (function() {
|
|
|
425
433
|
exports.UnicodeExtensionValue = void 0;
|
|
426
434
|
var utils_1 = require_utils();
|
|
427
435
|
function UnicodeExtensionValue(extension, key) {
|
|
428
|
-
utils_1.invariant(key.length === 2, "key must have 2 elements");
|
|
436
|
+
(0, utils_1.invariant)(key.length === 2, "key must have 2 elements");
|
|
429
437
|
var size = extension.length;
|
|
430
438
|
var searchValue = "-" + key + "-";
|
|
431
439
|
var pos = extension.indexOf(searchValue);
|
|
@@ -479,25 +487,25 @@ var ReactIntl = (function() {
|
|
|
479
487
|
var matcher = options.localeMatcher;
|
|
480
488
|
var r;
|
|
481
489
|
if (matcher === "lookup") {
|
|
482
|
-
r = LookupMatcher_1.LookupMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
490
|
+
r = (0, LookupMatcher_1.LookupMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
483
491
|
} else {
|
|
484
|
-
r = BestFitMatcher_1.BestFitMatcher(availableLocales, requestedLocales, getDefaultLocale);
|
|
492
|
+
r = (0, BestFitMatcher_1.BestFitMatcher)(availableLocales, requestedLocales, getDefaultLocale);
|
|
485
493
|
}
|
|
486
494
|
var foundLocale = r.locale;
|
|
487
495
|
var result = { locale: "", dataLocale: foundLocale };
|
|
488
496
|
var supportedExtension = "-u";
|
|
489
497
|
for (var _i = 0, relevantExtensionKeys_1 = relevantExtensionKeys; _i < relevantExtensionKeys_1.length; _i++) {
|
|
490
498
|
var key = relevantExtensionKeys_1[_i];
|
|
491
|
-
utils_1.invariant(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
499
|
+
(0, utils_1.invariant)(foundLocale in localeData, "Missing locale data for " + foundLocale);
|
|
492
500
|
var foundLocaleData = localeData[foundLocale];
|
|
493
|
-
utils_1.invariant(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
501
|
+
(0, utils_1.invariant)(typeof foundLocaleData === "object" && foundLocaleData !== null, "locale data " + key + " must be an object");
|
|
494
502
|
var keyLocaleData = foundLocaleData[key];
|
|
495
|
-
utils_1.invariant(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
503
|
+
(0, utils_1.invariant)(Array.isArray(keyLocaleData), "keyLocaleData for " + key + " must be an array");
|
|
496
504
|
var value = keyLocaleData[0];
|
|
497
|
-
utils_1.invariant(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
505
|
+
(0, utils_1.invariant)(typeof value === "string" || value === null, "value must be string or null but got " + typeof value + " in key " + key);
|
|
498
506
|
var supportedExtensionAddition = "";
|
|
499
507
|
if (r.extension) {
|
|
500
|
-
var requestedValue = UnicodeExtensionValue_1.UnicodeExtensionValue(r.extension, key);
|
|
508
|
+
var requestedValue = (0, UnicodeExtensionValue_1.UnicodeExtensionValue)(r.extension, key);
|
|
501
509
|
if (requestedValue !== void 0) {
|
|
502
510
|
if (requestedValue !== "") {
|
|
503
511
|
if (~keyLocaleData.indexOf(requestedValue)) {
|
|
@@ -512,7 +520,7 @@ var ReactIntl = (function() {
|
|
|
512
520
|
}
|
|
513
521
|
if (key in options) {
|
|
514
522
|
var optionsValue = options[key];
|
|
515
|
-
utils_1.invariant(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
523
|
+
(0, utils_1.invariant)(typeof optionsValue === "string" || typeof optionsValue === "undefined" || optionsValue === null, "optionsValue must be String, Undefined or Null");
|
|
516
524
|
if (~keyLocaleData.indexOf(optionsValue)) {
|
|
517
525
|
if (optionsValue !== value) {
|
|
518
526
|
value = optionsValue;
|
|
@@ -554,7 +562,7 @@ var ReactIntl = (function() {
|
|
|
554
562
|
for (var _i = 0, requestedLocales_1 = requestedLocales; _i < requestedLocales_1.length; _i++) {
|
|
555
563
|
var locale = requestedLocales_1[_i];
|
|
556
564
|
var noExtensionLocale = locale.replace(utils_1.UNICODE_EXTENSION_SEQUENCE_REGEX, "");
|
|
557
|
-
var availableLocale = BestAvailableLocale_1.BestAvailableLocale(availableLocales, noExtensionLocale);
|
|
565
|
+
var availableLocale = (0, BestAvailableLocale_1.BestAvailableLocale)(availableLocales, noExtensionLocale);
|
|
558
566
|
if (availableLocale) {
|
|
559
567
|
subset.push(availableLocale);
|
|
560
568
|
}
|
|
@@ -577,7 +585,7 @@ var ReactIntl = (function() {
|
|
|
577
585
|
all.add(l);
|
|
578
586
|
return all;
|
|
579
587
|
}, new Set());
|
|
580
|
-
return ResolveLocale_1.ResolveLocale(locales, requestedLocales, {
|
|
588
|
+
return (0, ResolveLocale_1.ResolveLocale)(locales, requestedLocales, {
|
|
581
589
|
localeMatcher: (opts === null || opts === void 0 ? void 0 : opts.algorithm) || "best fit"
|
|
582
590
|
}, [], {}, function() {
|
|
583
591
|
return defaultLocale;
|
|
@@ -744,17 +752,17 @@ var ReactIntl = (function() {
|
|
|
744
752
|
}
|
|
745
753
|
|
|
746
754
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/createFormattedComponent.js
|
|
747
|
-
var React4 = __toModule(
|
|
755
|
+
var React4 = __toModule(window.React);
|
|
748
756
|
|
|
749
757
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/useIntl.js
|
|
750
|
-
var React3 = __toModule(
|
|
758
|
+
var React3 = __toModule(window.React);
|
|
751
759
|
|
|
752
760
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/injectIntl.js
|
|
753
|
-
var React2 = __toModule(
|
|
761
|
+
var React2 = __toModule(window.React);
|
|
754
762
|
var import_hoist_non_react_statics = __toModule(require_hoist_non_react_statics_cjs());
|
|
755
763
|
|
|
756
764
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/utils.js
|
|
757
|
-
var React = __toModule(
|
|
765
|
+
var React = __toModule(window.React);
|
|
758
766
|
|
|
759
767
|
// bazel-out/darwin-fastbuild/bin/packages/ecma402-abstract/lib/262.js
|
|
760
768
|
var MINUTES_PER_HOUR = 60;
|
|
@@ -1076,11 +1084,16 @@ var ReactIntl = (function() {
|
|
|
1076
1084
|
return unit.replace(/^(.*?)-/, "");
|
|
1077
1085
|
}
|
|
1078
1086
|
var FRACTION_PRECISION_REGEX = /^\.(?:(0+)(\*)?|(#+)|(0+)(#+))$/g;
|
|
1079
|
-
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?$/g;
|
|
1087
|
+
var SIGNIFICANT_PRECISION_REGEX = /^(@+)?(\+|#+)?[rs]?$/g;
|
|
1080
1088
|
var INTEGER_WIDTH_REGEX = /(\*)(0+)|(#+)(0+)|(0+)/g;
|
|
1081
1089
|
var CONCISE_INTEGER_WIDTH_REGEX = /^(0+)$/;
|
|
1082
1090
|
function parseSignificantPrecision(str) {
|
|
1083
1091
|
var result = {};
|
|
1092
|
+
if (str[str.length - 1] === "r") {
|
|
1093
|
+
result.roundingPriority = "morePrecision";
|
|
1094
|
+
} else if (str[str.length - 1] === "s") {
|
|
1095
|
+
result.roundingPriority = "lessPrecision";
|
|
1096
|
+
}
|
|
1084
1097
|
str.replace(SIGNIFICANT_PRECISION_REGEX, function(_, g1, g2) {
|
|
1085
1098
|
if (typeof g2 !== "string") {
|
|
1086
1099
|
result.minimumSignificantDigits = g1.length;
|
|
@@ -1215,13 +1228,13 @@ var ReactIntl = (function() {
|
|
|
1215
1228
|
result.compactDisplay = "long";
|
|
1216
1229
|
continue;
|
|
1217
1230
|
case "scientific":
|
|
1218
|
-
result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all,
|
|
1219
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
1231
|
+
result = __assign(__assign(__assign({}, result), { notation: "scientific" }), token.options.reduce(function(all, opt2) {
|
|
1232
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
1220
1233
|
}, {}));
|
|
1221
1234
|
continue;
|
|
1222
1235
|
case "engineering":
|
|
1223
|
-
result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all,
|
|
1224
|
-
return __assign(__assign({}, all), parseNotationOptions(
|
|
1236
|
+
result = __assign(__assign(__assign({}, result), { notation: "engineering" }), token.options.reduce(function(all, opt2) {
|
|
1237
|
+
return __assign(__assign({}, all), parseNotationOptions(opt2));
|
|
1225
1238
|
}, {}));
|
|
1226
1239
|
continue;
|
|
1227
1240
|
case "notation-simple":
|
|
@@ -1283,8 +1296,11 @@ var ReactIntl = (function() {
|
|
|
1283
1296
|
}
|
|
1284
1297
|
return "";
|
|
1285
1298
|
});
|
|
1286
|
-
|
|
1287
|
-
|
|
1299
|
+
var opt = token.options[0];
|
|
1300
|
+
if (opt === "w") {
|
|
1301
|
+
result = __assign(__assign({}, result), { trailingZeroDisplay: "stripIfInteger" });
|
|
1302
|
+
} else if (opt) {
|
|
1303
|
+
result = __assign(__assign({}, result), parseSignificantPrecision(opt));
|
|
1288
1304
|
}
|
|
1289
1305
|
continue;
|
|
1290
1306
|
}
|
|
@@ -2399,7 +2415,7 @@ var ReactIntl = (function() {
|
|
|
2399
2415
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2400
2416
|
args[_i] = arguments[_i];
|
|
2401
2417
|
}
|
|
2402
|
-
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2418
|
+
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2403
2419
|
}, {
|
|
2404
2420
|
cache: createFastMemoizeCache(cache.number),
|
|
2405
2421
|
strategy: strategies.variadic
|
|
@@ -2410,7 +2426,7 @@ var ReactIntl = (function() {
|
|
|
2410
2426
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2411
2427
|
args[_i] = arguments[_i];
|
|
2412
2428
|
}
|
|
2413
|
-
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2429
|
+
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2414
2430
|
}, {
|
|
2415
2431
|
cache: createFastMemoizeCache(cache.dateTime),
|
|
2416
2432
|
strategy: strategies.variadic
|
|
@@ -2421,7 +2437,7 @@ var ReactIntl = (function() {
|
|
|
2421
2437
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2422
2438
|
args[_i] = arguments[_i];
|
|
2423
2439
|
}
|
|
2424
|
-
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2440
|
+
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2425
2441
|
}, {
|
|
2426
2442
|
cache: createFastMemoizeCache(cache.pluralRules),
|
|
2427
2443
|
strategy: strategies.variadic
|
|
@@ -2572,7 +2588,9 @@ var ReactIntl = (function() {
|
|
|
2572
2588
|
var IntlError = function(_super) {
|
|
2573
2589
|
__extends(IntlError2, _super);
|
|
2574
2590
|
function IntlError2(code, message, exception) {
|
|
2575
|
-
var _this =
|
|
2591
|
+
var _this = this;
|
|
2592
|
+
var err = exception ? exception instanceof Error ? exception : new Error(String(exception)) : void 0;
|
|
2593
|
+
_this = _super.call(this, "[@formatjs/intl Error " + code + "] " + message + " \n" + (err ? "\n" + err.message + "\n" + err.stack : "")) || this;
|
|
2576
2594
|
_this.code = code;
|
|
2577
2595
|
if (typeof Error.captureStackTrace === "function") {
|
|
2578
2596
|
Error.captureStackTrace(_this, IntlError2);
|
|
@@ -2602,15 +2620,22 @@ var ReactIntl = (function() {
|
|
|
2602
2620
|
}
|
|
2603
2621
|
return MissingDataError2;
|
|
2604
2622
|
}(IntlError);
|
|
2623
|
+
var IntlFormatError = function(_super) {
|
|
2624
|
+
__extends(IntlFormatError2, _super);
|
|
2625
|
+
function IntlFormatError2(message, locale, exception) {
|
|
2626
|
+
return _super.call(this, IntlErrorCode.FORMAT_ERROR, message + " \nLocale: " + locale + "\n", exception) || this;
|
|
2627
|
+
}
|
|
2628
|
+
return IntlFormatError2;
|
|
2629
|
+
}(IntlError);
|
|
2605
2630
|
var MessageFormatError = function(_super) {
|
|
2606
2631
|
__extends(MessageFormatError2, _super);
|
|
2607
2632
|
function MessageFormatError2(message, locale, descriptor, exception) {
|
|
2608
|
-
var _this = _super.call(this,
|
|
2633
|
+
var _this = _super.call(this, message + " \nMessageID: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.id) + "\nDefault Message: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.defaultMessage) + "\nDescription: " + (descriptor === null || descriptor === void 0 ? void 0 : descriptor.description) + " \n", locale, exception) || this;
|
|
2609
2634
|
_this.descriptor = descriptor;
|
|
2610
2635
|
return _this;
|
|
2611
2636
|
}
|
|
2612
2637
|
return MessageFormatError2;
|
|
2613
|
-
}(
|
|
2638
|
+
}(IntlFormatError);
|
|
2614
2639
|
var MissingTranslationError = function(_super) {
|
|
2615
2640
|
__extends(MissingTranslationError2, _super);
|
|
2616
2641
|
function MissingTranslationError2(descriptor, locale) {
|
|
@@ -2646,6 +2671,7 @@ var ReactIntl = (function() {
|
|
|
2646
2671
|
timeZone: void 0,
|
|
2647
2672
|
defaultLocale: "en",
|
|
2648
2673
|
defaultFormats: {},
|
|
2674
|
+
fallbackOnEmptyString: true,
|
|
2649
2675
|
onError: defaultErrorHandler
|
|
2650
2676
|
};
|
|
2651
2677
|
function createIntlCache() {
|
|
@@ -2686,7 +2712,7 @@ var ReactIntl = (function() {
|
|
|
2686
2712
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2687
2713
|
args[_i] = arguments[_i];
|
|
2688
2714
|
}
|
|
2689
|
-
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2715
|
+
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2690
2716
|
}, {
|
|
2691
2717
|
cache: createFastMemoizeCache2(cache.dateTime),
|
|
2692
2718
|
strategy: strategies.variadic
|
|
@@ -2697,7 +2723,7 @@ var ReactIntl = (function() {
|
|
|
2697
2723
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2698
2724
|
args[_i] = arguments[_i];
|
|
2699
2725
|
}
|
|
2700
|
-
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2726
|
+
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2701
2727
|
}, {
|
|
2702
2728
|
cache: createFastMemoizeCache2(cache.number),
|
|
2703
2729
|
strategy: strategies.variadic
|
|
@@ -2708,7 +2734,7 @@ var ReactIntl = (function() {
|
|
|
2708
2734
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2709
2735
|
args[_i] = arguments[_i];
|
|
2710
2736
|
}
|
|
2711
|
-
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args)))();
|
|
2737
|
+
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
2712
2738
|
}, {
|
|
2713
2739
|
cache: createFastMemoizeCache2(cache.pluralRules),
|
|
2714
2740
|
strategy: strategies.variadic
|
|
@@ -2731,7 +2757,7 @@ var ReactIntl = (function() {
|
|
|
2731
2757
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2732
2758
|
args[_i] = arguments[_i];
|
|
2733
2759
|
}
|
|
2734
|
-
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args)))();
|
|
2760
|
+
return new (RelativeTimeFormat.bind.apply(RelativeTimeFormat, __spreadArray([void 0], args, false)))();
|
|
2735
2761
|
}, {
|
|
2736
2762
|
cache: createFastMemoizeCache2(cache.relativeTime),
|
|
2737
2763
|
strategy: strategies.variadic
|
|
@@ -2742,7 +2768,7 @@ var ReactIntl = (function() {
|
|
|
2742
2768
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2743
2769
|
args[_i] = arguments[_i];
|
|
2744
2770
|
}
|
|
2745
|
-
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args)))();
|
|
2771
|
+
return new (ListFormat.bind.apply(ListFormat, __spreadArray([void 0], args, false)))();
|
|
2746
2772
|
}, {
|
|
2747
2773
|
cache: createFastMemoizeCache2(cache.list),
|
|
2748
2774
|
strategy: strategies.variadic
|
|
@@ -2752,7 +2778,7 @@ var ReactIntl = (function() {
|
|
|
2752
2778
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
2753
2779
|
args[_i] = arguments[_i];
|
|
2754
2780
|
}
|
|
2755
|
-
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args)))();
|
|
2781
|
+
return new (DisplayNames.bind.apply(DisplayNames, __spreadArray([void 0], args, false)))();
|
|
2756
2782
|
}, {
|
|
2757
2783
|
cache: createFastMemoizeCache2(cache.displayNames),
|
|
2758
2784
|
strategy: strategies.variadic
|
|
@@ -2793,7 +2819,7 @@ var ReactIntl = (function() {
|
|
|
2793
2819
|
return __assign(__assign(__assign({}, mfFormats), f1), { date: deepMergeOptions(setTimeZoneInOptions(mfFormats.date, timeZone), setTimeZoneInOptions(f1.date || {}, timeZone)), time: deepMergeOptions(setTimeZoneInOptions(mfFormats.time, timeZone), setTimeZoneInOptions(f1.time || {}, timeZone)) });
|
|
2794
2820
|
}
|
|
2795
2821
|
function formatMessage(_a2, state, messageDescriptor, values, opts) {
|
|
2796
|
-
var locale = _a2.locale, formats = _a2.formats, messages = _a2.messages, defaultLocale = _a2.defaultLocale, defaultFormats = _a2.defaultFormats, onError = _a2.onError, timeZone = _a2.timeZone, defaultRichTextElements = _a2.defaultRichTextElements;
|
|
2822
|
+
var locale = _a2.locale, formats = _a2.formats, messages = _a2.messages, defaultLocale = _a2.defaultLocale, defaultFormats = _a2.defaultFormats, fallbackOnEmptyString = _a2.fallbackOnEmptyString, onError = _a2.onError, timeZone = _a2.timeZone, defaultRichTextElements = _a2.defaultRichTextElements;
|
|
2797
2823
|
if (messageDescriptor === void 0) {
|
|
2798
2824
|
messageDescriptor = { id: "" };
|
|
2799
2825
|
}
|
|
@@ -2811,6 +2837,9 @@ var ReactIntl = (function() {
|
|
|
2811
2837
|
formats = deepMergeFormatsAndSetTimeZone(formats, timeZone);
|
|
2812
2838
|
defaultFormats = deepMergeFormatsAndSetTimeZone(defaultFormats, timeZone);
|
|
2813
2839
|
if (!message) {
|
|
2840
|
+
if (fallbackOnEmptyString === false && message === "") {
|
|
2841
|
+
return message;
|
|
2842
|
+
}
|
|
2814
2843
|
if (!defaultMessage || locale && locale.toLowerCase() !== defaultLocale.toLowerCase()) {
|
|
2815
2844
|
onError(new MissingTranslationError(messageDescriptor, locale));
|
|
2816
2845
|
}
|
|
@@ -3048,7 +3077,7 @@ var ReactIntl = (function() {
|
|
|
3048
3077
|
try {
|
|
3049
3078
|
return getPluralRules(locale, filteredOptions).select(value);
|
|
3050
3079
|
} catch (e) {
|
|
3051
|
-
onError(new
|
|
3080
|
+
onError(new IntlFormatError("Error formatting plural.", locale, e));
|
|
3052
3081
|
}
|
|
3053
3082
|
return "other";
|
|
3054
3083
|
}
|
|
@@ -3079,7 +3108,7 @@ var ReactIntl = (function() {
|
|
|
3079
3108
|
try {
|
|
3080
3109
|
return getFormatter2(config, getRelativeTimeFormat, options).format(value, unit);
|
|
3081
3110
|
} catch (e) {
|
|
3082
|
-
config.onError(new
|
|
3111
|
+
config.onError(new IntlFormatError("Error formatting relative time.", config.locale, e));
|
|
3083
3112
|
}
|
|
3084
3113
|
return String(value);
|
|
3085
3114
|
}
|
|
@@ -3293,11 +3322,12 @@ var ReactIntl = (function() {
|
|
|
3293
3322
|
}
|
|
3294
3323
|
|
|
3295
3324
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/provider.js
|
|
3296
|
-
var React5 = __toModule(
|
|
3325
|
+
var React5 = __toModule(window.React);
|
|
3297
3326
|
function processIntlConfig(config) {
|
|
3298
3327
|
return {
|
|
3299
3328
|
locale: config.locale,
|
|
3300
3329
|
timeZone: config.timeZone,
|
|
3330
|
+
fallbackOnEmptyString: config.fallbackOnEmptyString,
|
|
3301
3331
|
formats: config.formats,
|
|
3302
3332
|
textComponent: config.textComponent,
|
|
3303
3333
|
messages: config.messages,
|
|
@@ -3329,7 +3359,7 @@ var ReactIntl = (function() {
|
|
|
3329
3359
|
formatters,
|
|
3330
3360
|
descriptor,
|
|
3331
3361
|
values
|
|
3332
|
-
], rest));
|
|
3362
|
+
], rest, false));
|
|
3333
3363
|
if (Array.isArray(chunks)) {
|
|
3334
3364
|
return React5.Children.toArray(chunks);
|
|
3335
3365
|
}
|
|
@@ -3384,7 +3414,7 @@ var ReactIntl = (function() {
|
|
|
3384
3414
|
var provider_default = IntlProvider2;
|
|
3385
3415
|
|
|
3386
3416
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/relative.js
|
|
3387
|
-
var React6 = __toModule(
|
|
3417
|
+
var React6 = __toModule(window.React);
|
|
3388
3418
|
var MINUTE = 60;
|
|
3389
3419
|
var HOUR = 60 * 60;
|
|
3390
3420
|
var DAY = 60 * 60 * 24;
|
|
@@ -3503,7 +3533,7 @@ var ReactIntl = (function() {
|
|
|
3503
3533
|
var relative_default = FormattedRelativeTime;
|
|
3504
3534
|
|
|
3505
3535
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/plural.js
|
|
3506
|
-
var React7 = __toModule(
|
|
3536
|
+
var React7 = __toModule(window.React);
|
|
3507
3537
|
var FormattedPlural = function(props) {
|
|
3508
3538
|
var _a2 = useIntl(), formatPlural2 = _a2.formatPlural, Text = _a2.textComponent;
|
|
3509
3539
|
var value = props.value, other = props.other, children = props.children;
|
|
@@ -3524,7 +3554,7 @@ var ReactIntl = (function() {
|
|
|
3524
3554
|
var plural_default = FormattedPlural;
|
|
3525
3555
|
|
|
3526
3556
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/message.js
|
|
3527
|
-
var React8 = __toModule(
|
|
3557
|
+
var React8 = __toModule(window.React);
|
|
3528
3558
|
function areEqual(prevProps, nextProps) {
|
|
3529
3559
|
var values = prevProps.values, otherProps = __rest(prevProps, ["values"]);
|
|
3530
3560
|
var nextValues = nextProps.values, nextOtherProps = __rest(nextProps, ["values"]);
|
|
@@ -3552,7 +3582,7 @@ var ReactIntl = (function() {
|
|
|
3552
3582
|
var message_default = MemoizedFormattedMessage;
|
|
3553
3583
|
|
|
3554
3584
|
// bazel-out/darwin-fastbuild/bin/packages/react-intl/lib/src/components/dateTimeRange.js
|
|
3555
|
-
var React9 = __toModule(
|
|
3585
|
+
var React9 = __toModule(window.React);
|
|
3556
3586
|
var FormattedDateTimeRange = function(props) {
|
|
3557
3587
|
var intl = useIntl();
|
|
3558
3588
|
var from = props.from, to = props.to, children = props.children, formatProps = __rest(props, ["from", "to", "children"]);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFormattedComponent = exports.createFormattedDateTimePartsComponent = exports.FormattedListParts = exports.FormattedNumberParts = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var React = tslib_1.__importStar(require("react"));
|
|
6
|
-
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
5
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
|
|
7
7
|
var DisplayName;
|
|
8
8
|
(function (DisplayName) {
|
|
9
9
|
DisplayName["formatDate"] = "FormattedDate";
|
|
@@ -22,23 +22,23 @@ var DisplayNameParts;
|
|
|
22
22
|
DisplayNameParts["formatList"] = "FormattedListParts";
|
|
23
23
|
})(DisplayNameParts || (DisplayNameParts = {}));
|
|
24
24
|
var FormattedNumberParts = function (props) {
|
|
25
|
-
var intl = useIntl_1.default();
|
|
26
|
-
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
|
|
25
|
+
var intl = (0, useIntl_1.default)();
|
|
26
|
+
var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["value", "children"]);
|
|
27
27
|
return children(intl.formatNumberToParts(value, formatProps));
|
|
28
28
|
};
|
|
29
29
|
exports.FormattedNumberParts = FormattedNumberParts;
|
|
30
30
|
exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
|
|
31
31
|
var FormattedListParts = function (props) {
|
|
32
|
-
var intl = useIntl_1.default();
|
|
33
|
-
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
|
|
32
|
+
var intl = (0, useIntl_1.default)();
|
|
33
|
+
var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["value", "children"]);
|
|
34
34
|
return children(intl.formatListToParts(value, formatProps));
|
|
35
35
|
};
|
|
36
36
|
exports.FormattedListParts = FormattedListParts;
|
|
37
37
|
exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
|
|
38
38
|
function createFormattedDateTimePartsComponent(name) {
|
|
39
39
|
var ComponentParts = function (props) {
|
|
40
|
-
var intl = useIntl_1.default();
|
|
41
|
-
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
|
|
40
|
+
var intl = (0, useIntl_1.default)();
|
|
41
|
+
var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["value", "children"]);
|
|
42
42
|
var date = typeof value === 'string' ? new Date(value || 0) : value;
|
|
43
43
|
var formattedParts = name === 'formatDate'
|
|
44
44
|
? intl.formatDateToParts(date, formatProps)
|
|
@@ -51,8 +51,8 @@ function createFormattedDateTimePartsComponent(name) {
|
|
|
51
51
|
exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent;
|
|
52
52
|
function createFormattedComponent(name) {
|
|
53
53
|
var Component = function (props) {
|
|
54
|
-
var intl = useIntl_1.default();
|
|
55
|
-
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props
|
|
54
|
+
var intl = (0, useIntl_1.default)();
|
|
55
|
+
var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props
|
|
56
56
|
// TODO: fix TS type definition for localeMatcher upstream
|
|
57
57
|
, ["value", "children"]);
|
|
58
58
|
// TODO: fix TS type definition for localeMatcher upstream
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var React = tslib_1.__importStar(require("react"));
|
|
5
|
-
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
4
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
5
|
+
var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
|
|
6
6
|
var FormattedDateTimeRange = function (props) {
|
|
7
|
-
var intl = useIntl_1.default();
|
|
8
|
-
var from = props.from, to = props.to, children = props.children, formatProps = tslib_1.__rest(props, ["from", "to", "children"]);
|
|
7
|
+
var intl = (0, useIntl_1.default)();
|
|
8
|
+
var from = props.from, to = props.to, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["from", "to", "children"]);
|
|
9
9
|
var formattedValue = intl.formatDateTimeRange(from, to, formatProps);
|
|
10
10
|
if (typeof children === 'function') {
|
|
11
11
|
return children(formattedValue);
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Context = exports.Provider = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var React = tslib_1.__importStar(require("react"));
|
|
6
|
-
var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
|
|
5
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
6
|
+
var hoist_non_react_statics_1 = (0, tslib_1.__importDefault)(require("hoist-non-react-statics"));
|
|
7
7
|
var utils_1 = require("../utils");
|
|
8
8
|
function getDisplayName(Component) {
|
|
9
9
|
return Component.displayName || Component.name || 'Component';
|
|
@@ -18,16 +18,16 @@ function injectIntl(WrappedComponent, options) {
|
|
|
18
18
|
var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {
|
|
19
19
|
var _a;
|
|
20
20
|
if (enforceContext) {
|
|
21
|
-
utils_1.invariantIntlContext(intl);
|
|
21
|
+
(0, utils_1.invariantIntlContext)(intl);
|
|
22
22
|
}
|
|
23
23
|
var intlProp = (_a = {}, _a[intlPropName] = intl, _a);
|
|
24
|
-
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
|
|
24
|
+
return (React.createElement(WrappedComponent, (0, tslib_1.__assign)({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
|
|
25
25
|
})); };
|
|
26
26
|
WithIntl.displayName = "injectIntl(" + getDisplayName(WrappedComponent) + ")";
|
|
27
27
|
WithIntl.WrappedComponent = WrappedComponent;
|
|
28
28
|
if (forwardRef) {
|
|
29
|
-
return hoist_non_react_statics_1.default(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, tslib_1.__assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
|
|
29
|
+
return (0, hoist_non_react_statics_1.default)(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, (0, tslib_1.__assign)({}, props, { forwardedRef: ref }))); }), WrappedComponent);
|
|
30
30
|
}
|
|
31
|
-
return hoist_non_react_statics_1.default(WithIntl, WrappedComponent);
|
|
31
|
+
return (0, hoist_non_react_statics_1.default)(WithIntl, WrappedComponent);
|
|
32
32
|
}
|
|
33
33
|
exports.default = injectIntl;
|
|
@@ -6,17 +6,17 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
|
-
var React = tslib_1.__importStar(require("react"));
|
|
10
|
-
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
9
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
10
|
+
var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
|
|
11
11
|
var utils_1 = require("../utils");
|
|
12
12
|
function areEqual(prevProps, nextProps) {
|
|
13
|
-
var values = prevProps.values, otherProps = tslib_1.__rest(prevProps, ["values"]);
|
|
14
|
-
var nextValues = nextProps.values, nextOtherProps = tslib_1.__rest(nextProps, ["values"]);
|
|
15
|
-
return (utils_1.shallowEqual(nextValues, values) &&
|
|
16
|
-
utils_1.shallowEqual(otherProps, nextOtherProps));
|
|
13
|
+
var values = prevProps.values, otherProps = (0, tslib_1.__rest)(prevProps, ["values"]);
|
|
14
|
+
var nextValues = nextProps.values, nextOtherProps = (0, tslib_1.__rest)(nextProps, ["values"]);
|
|
15
|
+
return ((0, utils_1.shallowEqual)(nextValues, values) &&
|
|
16
|
+
(0, utils_1.shallowEqual)(otherProps, nextOtherProps));
|
|
17
17
|
}
|
|
18
18
|
function FormattedMessage(props) {
|
|
19
|
-
var intl = useIntl_1.default();
|
|
19
|
+
var intl = (0, useIntl_1.default)();
|
|
20
20
|
var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;
|
|
21
21
|
var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;
|
|
22
22
|
var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
|
package/src/components/plural.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
var tslib_1 = require("tslib");
|
|
9
|
-
var React = tslib_1.__importStar(require("react"));
|
|
10
|
-
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
9
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
10
|
+
var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
|
|
11
11
|
var FormattedPlural = function (props) {
|
|
12
|
-
var _a = useIntl_1.default(), formatPlural = _a.formatPlural, Text = _a.textComponent;
|
|
12
|
+
var _a = (0, useIntl_1.default)(), formatPlural = _a.formatPlural, Text = _a.textComponent;
|
|
13
13
|
var value = props.value, other = props.other, children = props.children;
|
|
14
14
|
var pluralCategory = formatPlural(value, props);
|
|
15
15
|
var formattedPlural = props[pluralCategory] || other;
|
|
@@ -25,7 +25,7 @@ interface State {
|
|
|
25
25
|
export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
|
|
26
26
|
export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
|
|
27
27
|
static displayName: string;
|
|
28
|
-
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "
|
|
28
|
+
static defaultProps: Pick<import("../types").ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
|
|
29
29
|
private cache;
|
|
30
30
|
state: State;
|
|
31
31
|
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAkED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CA8BzE,CAAA;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAa,CAG3D,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EACnC,KAAK,CACN;IACC,MAAM,CAAC,WAAW,SAAiB;IACnC,MAAM,CAAC,YAAY,gLAAsB;IACzC,OAAO,CAAC,KAAK,CAA+B;IAC5C,KAAK,EAAE,KAAK,CAIX;IAED,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,KAAK,GACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAWxB,MAAM,IAAI,GAAG,CAAC,OAAO;CAItB"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.createIntl = void 0;
|
|
9
9
|
var tslib_1 = require("tslib");
|
|
10
|
-
var React = tslib_1.__importStar(require("react"));
|
|
10
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
11
11
|
var injectIntl_1 = require("./injectIntl");
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
13
|
var intl_1 = require("@formatjs/intl");
|
|
@@ -16,6 +16,7 @@ function processIntlConfig(config) {
|
|
|
16
16
|
return {
|
|
17
17
|
locale: config.locale,
|
|
18
18
|
timeZone: config.timeZone,
|
|
19
|
+
fallbackOnEmptyString: config.fallbackOnEmptyString,
|
|
19
20
|
formats: config.formats,
|
|
20
21
|
textComponent: config.textComponent,
|
|
21
22
|
messages: config.messages,
|
|
@@ -32,8 +33,8 @@ function assignUniqueKeysToFormatXMLElementFnArgument(values) {
|
|
|
32
33
|
}
|
|
33
34
|
return Object.keys(values).reduce(function (acc, k) {
|
|
34
35
|
var v = values[k];
|
|
35
|
-
acc[k] = intl_messageformat_1.isFormatXMLElementFn(v)
|
|
36
|
-
? utils_1.assignUniqueKeysToParts(v)
|
|
36
|
+
acc[k] = (0, intl_messageformat_1.isFormatXMLElementFn)(v)
|
|
37
|
+
? (0, utils_1.assignUniqueKeysToParts)(v)
|
|
37
38
|
: v;
|
|
38
39
|
return acc;
|
|
39
40
|
}, {});
|
|
@@ -44,10 +45,10 @@ var formatMessage = function (config, formatters, descriptor, rawValues) {
|
|
|
44
45
|
rest[_i - 4] = arguments[_i];
|
|
45
46
|
}
|
|
46
47
|
var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);
|
|
47
|
-
var chunks = intl_1.formatMessage.apply(void 0, tslib_1.__spreadArray([config,
|
|
48
|
+
var chunks = intl_1.formatMessage.apply(void 0, (0, tslib_1.__spreadArray)([config,
|
|
48
49
|
formatters,
|
|
49
50
|
descriptor,
|
|
50
|
-
values], rest));
|
|
51
|
+
values], rest, false));
|
|
51
52
|
if (Array.isArray(chunks)) {
|
|
52
53
|
return React.Children.toArray(chunks);
|
|
53
54
|
}
|
|
@@ -59,10 +60,10 @@ var formatMessage = function (config, formatters, descriptor, rawValues) {
|
|
|
59
60
|
* @param cache cache for formatter instances to prevent memory leak
|
|
60
61
|
*/
|
|
61
62
|
var createIntl = function (_a, cache) {
|
|
62
|
-
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = tslib_1.__rest(_a, ["defaultRichTextElements"]);
|
|
63
|
+
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = (0, tslib_1.__rest)(_a, ["defaultRichTextElements"]);
|
|
63
64
|
var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
|
|
64
|
-
var coreIntl = intl_1.createIntl(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
|
|
65
|
-
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, {
|
|
65
|
+
var coreIntl = (0, intl_1.createIntl)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
|
|
66
|
+
return (0, tslib_1.__assign)((0, tslib_1.__assign)({}, coreIntl), { formatMessage: formatMessage.bind(null, {
|
|
66
67
|
locale: coreIntl.locale,
|
|
67
68
|
timeZone: coreIntl.timeZone,
|
|
68
69
|
formats: coreIntl.formats,
|
|
@@ -75,13 +76,13 @@ var createIntl = function (_a, cache) {
|
|
|
75
76
|
};
|
|
76
77
|
exports.createIntl = createIntl;
|
|
77
78
|
var IntlProvider = /** @class */ (function (_super) {
|
|
78
|
-
tslib_1.__extends(IntlProvider, _super);
|
|
79
|
+
(0, tslib_1.__extends)(IntlProvider, _super);
|
|
79
80
|
function IntlProvider() {
|
|
80
81
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
81
|
-
_this.cache = intl_1.createIntlCache();
|
|
82
|
+
_this.cache = (0, intl_1.createIntlCache)();
|
|
82
83
|
_this.state = {
|
|
83
84
|
cache: _this.cache,
|
|
84
|
-
intl: exports.createIntl(processIntlConfig(_this.props), _this.cache),
|
|
85
|
+
intl: (0, exports.createIntl)(processIntlConfig(_this.props), _this.cache),
|
|
85
86
|
prevConfig: processIntlConfig(_this.props),
|
|
86
87
|
};
|
|
87
88
|
return _this;
|
|
@@ -89,16 +90,16 @@ var IntlProvider = /** @class */ (function (_super) {
|
|
|
89
90
|
IntlProvider.getDerivedStateFromProps = function (props, _a) {
|
|
90
91
|
var prevConfig = _a.prevConfig, cache = _a.cache;
|
|
91
92
|
var config = processIntlConfig(props);
|
|
92
|
-
if (!utils_1.shallowEqual(prevConfig, config)) {
|
|
93
|
+
if (!(0, utils_1.shallowEqual)(prevConfig, config)) {
|
|
93
94
|
return {
|
|
94
|
-
intl: exports.createIntl(config, cache),
|
|
95
|
+
intl: (0, exports.createIntl)(config, cache),
|
|
95
96
|
prevConfig: config,
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
99
|
return null;
|
|
99
100
|
};
|
|
100
101
|
IntlProvider.prototype.render = function () {
|
|
101
|
-
utils_1.invariantIntlContext(this.state.intl);
|
|
102
|
+
(0, utils_1.invariantIntlContext)(this.state.intl);
|
|
102
103
|
return React.createElement(injectIntl_1.Provider, { value: this.state.intl }, this.props.children);
|
|
103
104
|
};
|
|
104
105
|
IntlProvider.displayName = 'IntlProvider';
|
|
@@ -6,9 +6,9 @@ var tslib_1 = require("tslib");
|
|
|
6
6
|
* Copyrights licensed under the New BSD License.
|
|
7
7
|
* See the accompanying LICENSE file for terms.
|
|
8
8
|
*/
|
|
9
|
-
var React = tslib_1.__importStar(require("react"));
|
|
9
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
10
10
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
11
|
-
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
11
|
+
var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
|
|
12
12
|
var MINUTE = 60;
|
|
13
13
|
var HOUR = 60 * 60;
|
|
14
14
|
var DAY = 60 * 60 * 24;
|
|
@@ -60,8 +60,8 @@ function canIncrement(unit) {
|
|
|
60
60
|
return INCREMENTABLE_UNITS.indexOf(unit) > -1;
|
|
61
61
|
}
|
|
62
62
|
var SimpleFormattedRelativeTime = function (props) {
|
|
63
|
-
var _a = useIntl_1.default(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
|
|
64
|
-
var children = props.children, value = props.value, unit = props.unit, otherProps = tslib_1.__rest(props, ["children", "value", "unit"]);
|
|
63
|
+
var _a = (0, useIntl_1.default)(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
|
|
64
|
+
var children = props.children, value = props.value, unit = props.unit, otherProps = (0, tslib_1.__rest)(props, ["children", "value", "unit"]);
|
|
65
65
|
var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);
|
|
66
66
|
if (typeof children === 'function') {
|
|
67
67
|
return children(formattedRelativeTime);
|
|
@@ -72,8 +72,8 @@ var SimpleFormattedRelativeTime = function (props) {
|
|
|
72
72
|
return React.createElement(React.Fragment, null, formattedRelativeTime);
|
|
73
73
|
};
|
|
74
74
|
var FormattedRelativeTime = function (_a) {
|
|
75
|
-
var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = tslib_1.__rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
|
|
76
|
-
ecma402_abstract_1.invariant(!updateIntervalInSeconds ||
|
|
75
|
+
var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = (0, tslib_1.__rest)(_a, ["value", "unit", "updateIntervalInSeconds"]);
|
|
76
|
+
(0, ecma402_abstract_1.invariant)(!updateIntervalInSeconds ||
|
|
77
77
|
!!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');
|
|
78
78
|
var _b = React.useState(), prevUnit = _b[0], setPrevUnit = _b[1];
|
|
79
79
|
var _c = React.useState(0), prevValue = _c[0], setPrevValue = _c[1];
|
|
@@ -121,7 +121,7 @@ var FormattedRelativeTime = function (_a) {
|
|
|
121
121
|
var unitDuration = getDurationInSeconds(currentUnit);
|
|
122
122
|
currentValue = Math.round(currentValueInSeconds / unitDuration);
|
|
123
123
|
}
|
|
124
|
-
return (React.createElement(SimpleFormattedRelativeTime, tslib_1.__assign({ value: currentValue, unit: currentUnit }, otherProps)));
|
|
124
|
+
return (React.createElement(SimpleFormattedRelativeTime, (0, tslib_1.__assign)({ value: currentValue, unit: currentUnit }, otherProps)));
|
|
125
125
|
};
|
|
126
126
|
FormattedRelativeTime.displayName = 'FormattedRelativeTime';
|
|
127
127
|
FormattedRelativeTime.defaultProps = {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
var tslib_1 = require("tslib");
|
|
4
|
-
var React = tslib_1.__importStar(require("react"));
|
|
4
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
5
5
|
var injectIntl_1 = require("./injectIntl");
|
|
6
6
|
var utils_1 = require("../utils");
|
|
7
7
|
function useIntl() {
|
|
8
8
|
var intl = React.useContext(injectIntl_1.Context);
|
|
9
|
-
utils_1.invariantIntlContext(intl);
|
|
9
|
+
(0, utils_1.invariantIntlContext)(intl);
|
|
10
10
|
return intl;
|
|
11
11
|
}
|
|
12
12
|
exports.default = useIntl;
|
package/src/utils.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ResolvedIntlConfig } from './types';
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { FormatXMLElementFn } from 'intl-messageformat';
|
|
4
4
|
export declare function invariantIntlContext(intl?: any): asserts intl;
|
|
5
|
-
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
5
|
+
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
6
6
|
/**
|
|
7
7
|
* Takes a `formatXMLElementFn`, and composes it in function, which passes
|
|
8
8
|
* argument `parts` through, assigning unique key to each part, to prevent
|
package/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/react-intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC1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S,CAAC,GACtD,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAKrC;AAED,wBAAgB,YAAY,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,WA6BnB"}
|
package/src/utils.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.shallowEqual = exports.assignUniqueKeysToParts = exports.DEFAULT_INTL_CONFIG = exports.invariantIntlContext = void 0;
|
|
4
4
|
var tslib_1 = require("tslib");
|
|
5
|
-
var React = tslib_1.__importStar(require("react"));
|
|
5
|
+
var React = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
7
7
|
var intl_1 = require("@formatjs/intl");
|
|
8
8
|
function invariantIntlContext(intl) {
|
|
9
|
-
ecma402_abstract_1.invariant(intl, '[React Intl] Could not find required `intl` object. ' +
|
|
9
|
+
(0, ecma402_abstract_1.invariant)(intl, '[React Intl] Could not find required `intl` object. ' +
|
|
10
10
|
'<IntlProvider> needs to exist in the component ancestry.');
|
|
11
11
|
}
|
|
12
12
|
exports.invariantIntlContext = invariantIntlContext;
|
|
13
|
-
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|
|
13
|
+
exports.DEFAULT_INTL_CONFIG = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|
|
14
14
|
/**
|
|
15
15
|
* Takes a `formatXMLElementFn`, and composes it in function, which passes
|
|
16
16
|
* argument `parts` through, assigning unique key to each part, to prevent
|