react-intl 4.2.2 → 4.5.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/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/dist/components/createFormattedComponent.js +3 -1
- package/dist/components/injectIntl.js +2 -3
- package/dist/components/message.d.ts +1 -1
- package/dist/error.d.ts +4 -2
- package/dist/error.js +2 -1
- package/dist/formatters/message.js +4 -4
- package/dist/formatters/relativeTime.js +1 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/react-intl.api.md +42 -35
- package/dist/react-intl.d.ts +72 -59
- package/dist/react-intl.js +74 -31
- package/dist/react-intl.js.map +1 -1
- package/dist/react-intl.min.js +1 -1
- package/dist/react-intl.min.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/lib/components/createFormattedComponent.js +3 -1
- package/lib/components/injectIntl.js +2 -3
- package/lib/components/message.d.ts +1 -1
- package/lib/error.d.ts +4 -2
- package/lib/error.js +2 -1
- package/lib/formatters/message.js +4 -4
- package/lib/formatters/relativeTime.js +1 -4
- package/lib/index.d.ts +1 -0
- package/lib/index.js +3 -0
- package/lib/react-intl.d.ts +51 -47
- package/lib/tsdoc-metadata.json +1 -1
- package/lib/types.d.ts +2 -2
- package/package.json +32 -39
- package/src/components/createFormattedComponent.tsx +50 -48
- package/src/components/injectIntl.tsx +33 -34
- package/src/components/message.tsx +33 -32
- package/src/components/plural.tsx +22 -22
- package/src/components/provider.tsx +36 -36
- package/src/components/relative.tsx +70 -70
- package/src/components/useIntl.ts +7 -7
- package/src/error.ts +26 -13
- package/src/formatters/dateTime.ts +25 -33
- package/src/formatters/displayName.ts +11 -11
- package/src/formatters/list.ts +29 -29
- package/src/formatters/message.ts +47 -50
- package/src/formatters/number.ts +15 -15
- package/src/formatters/plural.ts +10 -10
- package/src/formatters/relativeTime.ts +18 -19
- package/src/index.ts +49 -36
- package/src/tsconfig.cjs.json +8 -8
- package/src/tsconfig.json +7 -7
- package/src/types.ts +59 -59
- package/src/utils.ts +29 -24
- package/src/vendor.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [4.5.0](https://github.com/formatjs/react-intl/compare/v4.4.0...v4.5.0) (2020-04-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* upgrade intl-messageformat & parser ([cbbd6cf](https://github.com/formatjs/react-intl/commit/cbbd6cf93ee6294bdfbc28af3e33227df0e621e4))
|
|
11
|
+
|
|
12
|
+
## [4.4.0](https://github.com/formatjs/react-intl/compare/v4.3.1...v4.4.0) (2020-04-14)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add `defineMessage` macro to tag single message ([8bd9ad8](https://github.com/formatjs/react-intl/commit/8bd9ad8ddf632f500f4b3e0e7786a48c227c9961))
|
|
18
|
+
|
|
19
|
+
### [4.3.1](https://github.com/formatjs/react-intl/compare/v4.3.0...v4.3.1) (2020-03-28)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* tweak FormatXMLElementFn ([a914dc0](https://github.com/formatjs/react-intl/commit/a914dc059cc8d0c04baec6a63513cb686ff6dad3))
|
|
25
|
+
|
|
26
|
+
## [4.3.0](https://github.com/formatjs/react-intl/compare/v4.2.2...v4.3.0) (2020-03-26)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Features
|
|
30
|
+
|
|
31
|
+
* **react-intl:** store original message descriptor in the error ([22531bd](https://github.com/formatjs/react-intl/commit/22531bde78e0f3846b583b5bf0e4115e872f9a54))
|
|
32
|
+
|
|
5
33
|
### [4.2.2](https://github.com/formatjs/react-intl/compare/v4.2.1...v4.2.2) (2020-03-21)
|
|
6
34
|
|
|
7
35
|
|
package/README.md
CHANGED
|
@@ -36,7 +36,7 @@ _(If you're looking for React Intl v1, you can find it [here][v1-docs].)_
|
|
|
36
36
|
|
|
37
37
|
There are several [runnable examples][examples] in this Git repo, but here's a Hello World one:
|
|
38
38
|
|
|
39
|
-
```
|
|
39
|
+
```tsx
|
|
40
40
|
import React, {Component} from 'react';
|
|
41
41
|
import ReactDOM from 'react-dom';
|
|
42
42
|
import {IntlProvider, FormattedMessage} from 'react-intl';
|
|
@@ -54,7 +54,9 @@ exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComp
|
|
|
54
54
|
function createFormattedComponent(name) {
|
|
55
55
|
var Component = function (props) { return (React.createElement(injectIntl_1.Context.Consumer, null, function (intl) {
|
|
56
56
|
utils_1.invariantIntlContext(intl);
|
|
57
|
-
var value = props.value, children = props.children, formatProps = __rest(props
|
|
57
|
+
var value = props.value, children = props.children, formatProps = __rest(props
|
|
58
|
+
// TODO: fix TS type definition for localeMatcher upstream
|
|
59
|
+
, ["value", "children"]);
|
|
58
60
|
// TODO: fix TS type definition for localeMatcher upstream
|
|
59
61
|
var formattedValue = intl[name](value, formatProps);
|
|
60
62
|
if (typeof children === 'function') {
|
|
@@ -34,9 +34,8 @@ function injectIntl(WrappedComponent, options) {
|
|
|
34
34
|
if (enforceContext) {
|
|
35
35
|
utils_1.invariantIntlContext(intl);
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
_a), { ref: forwardRef ? props.forwardedRef : null })));
|
|
37
|
+
var intlProp = (_a = {}, _a[intlPropName] = intl, _a);
|
|
38
|
+
return (React.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
|
|
40
39
|
})); };
|
|
41
40
|
WithIntl.displayName = "injectIntl(" + getDisplayName(WrappedComponent) + ")";
|
|
42
41
|
WithIntl.WrappedComponent = WrappedComponent;
|
|
@@ -6,7 +6,7 @@ export interface Props<V extends Record<string, any> = Record<string, React.Reac
|
|
|
6
6
|
tagName?: React.ElementType<any>;
|
|
7
7
|
children?(...nodes: React.ReactNodeArray): React.ReactNode;
|
|
8
8
|
}
|
|
9
|
-
declare class FormattedMessage<
|
|
9
|
+
declare class FormattedMessage<V extends Record<string, any> = Record<string, PrimitiveType | React.ReactElement | FormatXMLElementFn<React.ReactNode, React.ReactNode>>> extends React.Component<Props<V>> {
|
|
10
10
|
static displayName: string;
|
|
11
11
|
static defaultProps: {
|
|
12
12
|
values: {};
|
package/dist/error.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MessageDescriptor } from './types';
|
|
1
2
|
export declare const enum ReactIntlErrorCode {
|
|
2
3
|
FORMAT_ERROR = "FORMAT_ERROR",
|
|
3
4
|
UNSUPPORTED_FORMATTER = "UNSUPPORTED_FORMATTER",
|
|
@@ -6,6 +7,7 @@ export declare const enum ReactIntlErrorCode {
|
|
|
6
7
|
MISSING_TRANSLATION = "MISSING_TRANSLATION"
|
|
7
8
|
}
|
|
8
9
|
export declare class ReactIntlError extends Error {
|
|
9
|
-
code: ReactIntlErrorCode;
|
|
10
|
-
|
|
10
|
+
readonly code: ReactIntlErrorCode;
|
|
11
|
+
readonly descriptor?: MessageDescriptor;
|
|
12
|
+
constructor(code: ReactIntlErrorCode, message: string, descriptor?: MessageDescriptor, exception?: Error);
|
|
11
13
|
}
|
package/dist/error.js
CHANGED
|
@@ -23,9 +23,10 @@ var ReactIntlErrorCode;
|
|
|
23
23
|
})(ReactIntlErrorCode = exports.ReactIntlErrorCode || (exports.ReactIntlErrorCode = {}));
|
|
24
24
|
var ReactIntlError = /** @class */ (function (_super) {
|
|
25
25
|
__extends(ReactIntlError, _super);
|
|
26
|
-
function ReactIntlError(code, message, exception) {
|
|
26
|
+
function ReactIntlError(code, message, descriptor, exception) {
|
|
27
27
|
var _this = _super.call(this, "[React Intl Error " + code + "] " + message + " " + (exception ? "\n" + exception.stack : '')) || this;
|
|
28
28
|
_this.code = code;
|
|
29
|
+
_this.descriptor = descriptor;
|
|
29
30
|
if (typeof Error.captureStackTrace === 'function') {
|
|
30
31
|
Error.captureStackTrace(_this, ReactIntlError);
|
|
31
32
|
}
|
|
@@ -70,7 +70,7 @@ function formatMessage(_a, state, messageDescriptor, values) {
|
|
|
70
70
|
}
|
|
71
71
|
catch (e) {
|
|
72
72
|
onError(new error_1.ReactIntlError("FORMAT_ERROR" /* FORMAT_ERROR */, "Error formatting message: \"" + id + "\" for locale: \"" + locale + "\"" +
|
|
73
|
-
(defaultMessage ? ', using default message as fallback.' : ''), e));
|
|
73
|
+
(defaultMessage ? ', using default message as fallback.' : ''), messageDescriptor, e));
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
else if (!defaultMessage ||
|
|
@@ -79,7 +79,7 @@ function formatMessage(_a, state, messageDescriptor, values) {
|
|
|
79
79
|
// when no `messages` are passed into the <IntlProvider> for the
|
|
80
80
|
// default locale.
|
|
81
81
|
onError(new error_1.ReactIntlError("MISSING_TRANSLATION" /* MISSING_TRANSLATION */, "Missing message: \"" + id + "\" for locale: \"" + locale + "\"" +
|
|
82
|
-
(defaultMessage ? ', using default message as fallback.' : '')));
|
|
82
|
+
(defaultMessage ? ', using default message as fallback.' : ''), messageDescriptor));
|
|
83
83
|
}
|
|
84
84
|
if (!formattedMessageParts && defaultMessage) {
|
|
85
85
|
try {
|
|
@@ -87,12 +87,12 @@ function formatMessage(_a, state, messageDescriptor, values) {
|
|
|
87
87
|
formattedMessageParts = formatter.format(values);
|
|
88
88
|
}
|
|
89
89
|
catch (e) {
|
|
90
|
-
onError(new error_1.ReactIntlError("FORMAT_ERROR" /* FORMAT_ERROR */, "Error formatting the default message for: \"" + id + "\"", e));
|
|
90
|
+
onError(new error_1.ReactIntlError("FORMAT_ERROR" /* FORMAT_ERROR */, "Error formatting the default message for: \"" + id + "\"", messageDescriptor, e));
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
if (!formattedMessageParts) {
|
|
94
94
|
onError(new error_1.ReactIntlError("FORMAT_ERROR" /* FORMAT_ERROR */, "Cannot format message: \"" + id + "\", " +
|
|
95
|
-
("using message " + (message || defaultMessage ? 'source' : 'id') + " as fallback.")));
|
|
95
|
+
("using message " + (message || defaultMessage ? 'source' : 'id') + " as fallback."), messageDescriptor));
|
|
96
96
|
if (typeof message === 'string') {
|
|
97
97
|
return message || defaultMessage || String(id);
|
|
98
98
|
}
|
|
@@ -3,10 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
var utils_1 = require("../utils");
|
|
4
4
|
var intl_messageformat_1 = require("intl-messageformat");
|
|
5
5
|
var error_1 = require("../error");
|
|
6
|
-
var RELATIVE_TIME_FORMAT_OPTIONS = [
|
|
7
|
-
'numeric',
|
|
8
|
-
'style',
|
|
9
|
-
];
|
|
6
|
+
var RELATIVE_TIME_FORMAT_OPTIONS = ['numeric', 'style'];
|
|
10
7
|
function getFormatter(_a, getRelativeTimeFormat, options) {
|
|
11
8
|
var locale = _a.locale, formats = _a.formats, onError = _a.onError;
|
|
12
9
|
if (options === void 0) { options = {}; }
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export * from './types';
|
|
3
3
|
export declare function defineMessages<T, U extends Record<string, T>>(msgs: U): U;
|
|
4
|
+
export declare function defineMessage<T>(msg: T): T;
|
|
4
5
|
import { CustomFormatConfig } from './types';
|
|
5
6
|
import { UnifiedNumberFormatOptions } from '@formatjs/intl-unified-numberformat';
|
|
6
7
|
import { IntlListFormatOptions } from '@formatjs/intl-listformat';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,10 @@ function defineMessages(msgs) {
|
|
|
4
4
|
return msgs;
|
|
5
5
|
}
|
|
6
6
|
exports.defineMessages = defineMessages;
|
|
7
|
+
function defineMessage(msg) {
|
|
8
|
+
return msg;
|
|
9
|
+
}
|
|
10
|
+
exports.defineMessage = defineMessage;
|
|
7
11
|
var createFormattedComponent_1 = require("./components/createFormattedComponent");
|
|
8
12
|
var injectIntl_1 = require("./components/injectIntl");
|
|
9
13
|
exports.injectIntl = injectIntl_1.default;
|
package/dist/react-intl.api.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
|
-
import * as
|
|
7
|
+
import * as React_2 from 'react';
|
|
8
8
|
|
|
9
9
|
// Warning: (ae-forgotten-export) The symbol "OptionalIntlConfig" needs to be exported by the entry point index.d.ts
|
|
10
10
|
//
|
|
@@ -30,6 +30,9 @@ export interface CustomFormats extends Partial<Formats> {
|
|
|
30
30
|
relative?: Record<string, IntlRelativeTimeFormatOptions>;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
// @public (undocumented)
|
|
34
|
+
export function defineMessage<T>(msg: T): T;
|
|
35
|
+
|
|
33
36
|
// @public (undocumented)
|
|
34
37
|
export function defineMessages<T, U extends Record<string, T>>(msgs: U): U;
|
|
35
38
|
|
|
@@ -58,24 +61,24 @@ export type FormatPluralOptions = Exclude<Intl.PluralRulesOptions, 'localeMatche
|
|
|
58
61
|
export type FormatRelativeTimeOptions = Exclude<IntlRelativeTimeFormatOptions, 'localeMatcher'> & CustomFormatConfig;
|
|
59
62
|
|
|
60
63
|
// @public (undocumented)
|
|
61
|
-
export const FormattedDate:
|
|
64
|
+
export const FormattedDate: React_2.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
62
65
|
value: string | number | Date | undefined;
|
|
63
66
|
}>;
|
|
64
67
|
|
|
65
68
|
// @public (undocumented)
|
|
66
|
-
export const FormattedDateParts:
|
|
69
|
+
export const FormattedDateParts: React_2.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
67
70
|
value: string | number | Date | undefined;
|
|
68
|
-
children(val: Intl.DateTimeFormatPart[]):
|
|
71
|
+
children(val: Intl.DateTimeFormatPart[]): React_2.ReactElement<any, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | null;
|
|
69
72
|
}>;
|
|
70
73
|
|
|
71
74
|
// @public (undocumented)
|
|
72
|
-
export const FormattedDisplayName:
|
|
75
|
+
export const FormattedDisplayName: React_2.FC<DisplayNamesOptions & {
|
|
73
76
|
value: string | number | object;
|
|
74
77
|
}>;
|
|
75
78
|
|
|
76
79
|
// @public (undocumented)
|
|
77
|
-
export const FormattedList:
|
|
78
|
-
value:
|
|
80
|
+
export const FormattedList: React_2.FC<IntlListFormatOptions & {
|
|
81
|
+
value: React_2.ReactNode[];
|
|
79
82
|
}>;
|
|
80
83
|
|
|
81
84
|
// Warning: (ae-forgotten-export) The symbol "PrimitiveType" needs to be exported by the entry point index.d.ts
|
|
@@ -83,7 +86,7 @@ export const FormattedList: React.FC<IntlListFormatOptions & {
|
|
|
83
86
|
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
|
|
84
87
|
//
|
|
85
88
|
// @public (undocumented)
|
|
86
|
-
export class FormattedMessage<
|
|
89
|
+
export class FormattedMessage<V extends Record<string, any> = Record<string, PrimitiveType | React_2.ReactElement | FormatXMLElementFn<React_2.ReactNode, React_2.ReactNode>>> extends React_2.Component<Props_3<V>> {
|
|
87
90
|
// (undocumented)
|
|
88
91
|
static defaultProps: {
|
|
89
92
|
values: {};
|
|
@@ -97,32 +100,32 @@ export class FormattedMessage<T = React.ReactNode, V extends Record<string, any>
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
// @public (undocumented)
|
|
100
|
-
export const FormattedNumber:
|
|
103
|
+
export const FormattedNumber: React_2.FC<UnifiedNumberFormatOptions & CustomFormatConfig & {
|
|
101
104
|
value: number;
|
|
102
105
|
}>;
|
|
103
106
|
|
|
104
107
|
// Warning: (ae-forgotten-export) The symbol "Formatter" needs to be exported by the entry point index.d.ts
|
|
105
108
|
//
|
|
106
109
|
// @public (undocumented)
|
|
107
|
-
export const FormattedNumberParts:
|
|
110
|
+
export const FormattedNumberParts: React_2.FC<Formatter['formatNumber'] & {
|
|
108
111
|
value: Parameters<IntlShape['formatNumber']>[0];
|
|
109
|
-
children(val: Intl.NumberFormatPart[]):
|
|
112
|
+
children(val: Intl.NumberFormatPart[]): React_2.ReactElement | null;
|
|
110
113
|
}>;
|
|
111
114
|
|
|
112
115
|
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
|
|
113
116
|
//
|
|
114
117
|
// @public (undocumented)
|
|
115
|
-
export const FormattedPlural:
|
|
116
|
-
forwardedRef?: ((instance: any) => void) |
|
|
117
|
-
} &
|
|
118
|
-
WrappedComponent:
|
|
118
|
+
export const FormattedPlural: React_2.ForwardRefExoticComponent<Pick<Props_2, "children" | "other" | "zero" | "one" | "two" | "few" | "many" | "localeMatcher" | "format" | "type" | "value"> & {
|
|
119
|
+
forwardedRef?: ((instance: any) => void) | React_2.RefObject<any> | null | undefined;
|
|
120
|
+
} & React_2.RefAttributes<any>> & {
|
|
121
|
+
WrappedComponent: React_2.ComponentType<Props_2>;
|
|
119
122
|
};
|
|
120
123
|
|
|
121
124
|
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
|
|
122
125
|
// Warning: (ae-forgotten-export) The symbol "State" needs to be exported by the entry point index.d.ts
|
|
123
126
|
//
|
|
124
127
|
// @public (undocumented)
|
|
125
|
-
export class FormattedRelativeTime extends
|
|
128
|
+
export class FormattedRelativeTime extends React_2.PureComponent<Props, State_2> {
|
|
126
129
|
constructor(props: Props);
|
|
127
130
|
// (undocumented)
|
|
128
131
|
componentDidMount(): void;
|
|
@@ -147,14 +150,14 @@ export class FormattedRelativeTime extends React.PureComponent<Props, State_2> {
|
|
|
147
150
|
}
|
|
148
151
|
|
|
149
152
|
// @public (undocumented)
|
|
150
|
-
export const FormattedTime:
|
|
153
|
+
export const FormattedTime: React_2.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
151
154
|
value: string | number | Date | undefined;
|
|
152
155
|
}>;
|
|
153
156
|
|
|
154
157
|
// @public (undocumented)
|
|
155
|
-
export const FormattedTimeParts:
|
|
158
|
+
export const FormattedTimeParts: React_2.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
|
|
156
159
|
value: string | number | Date | undefined;
|
|
157
|
-
children(val: Intl.DateTimeFormatPart[]):
|
|
160
|
+
children(val: Intl.DateTimeFormatPart[]): React_2.ReactElement<any, string | ((props: any) => React_2.ReactElement<any, string | any | (new (props: any) => React_2.Component<any, any, any>)> | null) | (new (props: any) => React_2.Component<any, any, any>)> | null;
|
|
158
161
|
}>;
|
|
159
162
|
|
|
160
163
|
// @public (undocumented)
|
|
@@ -186,13 +189,13 @@ export interface Formatters {
|
|
|
186
189
|
// Warning: (ae-forgotten-export) The symbol "Opts" needs to be exported by the entry point index.d.ts
|
|
187
190
|
//
|
|
188
191
|
// @public (undocumented)
|
|
189
|
-
export function injectIntl<IntlPropName extends string, P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>>(WrappedComponent:
|
|
190
|
-
WrappedComponent:
|
|
192
|
+
export function injectIntl<IntlPropName extends string, P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>>(WrappedComponent: React_2.ComponentType<P>, options?: Opts<IntlPropName, false>): React_2.FC<WithIntlProps<P>> & {
|
|
193
|
+
WrappedComponent: React_2.ComponentType<P>;
|
|
191
194
|
};
|
|
192
195
|
|
|
193
196
|
// @public (undocumented)
|
|
194
|
-
export function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>, T extends
|
|
195
|
-
WrappedComponent:
|
|
197
|
+
export function injectIntl<IntlPropName extends string = 'intl', P extends WrappedComponentProps<IntlPropName> = WrappedComponentProps<any>, T extends React_2.ComponentType<P> = any>(WrappedComponent: React_2.ComponentType<P>, options?: Opts<IntlPropName, true>): React_2.ForwardRefExoticComponent<React_2.PropsWithoutRef<WithIntlProps<P>> & React_2.RefAttributes<T>> & {
|
|
198
|
+
WrappedComponent: React_2.ComponentType<P>;
|
|
196
199
|
};
|
|
197
200
|
|
|
198
201
|
// @public (undocumented)
|
|
@@ -232,7 +235,7 @@ export interface IntlConfig {
|
|
|
232
235
|
// (undocumented)
|
|
233
236
|
onError(err: ReactIntlError | FormatError): void;
|
|
234
237
|
// (undocumented)
|
|
235
|
-
textComponent?:
|
|
238
|
+
textComponent?: React_2.ComponentType | keyof React_2.ReactHTML;
|
|
236
239
|
// (undocumented)
|
|
237
240
|
timeZone?: string;
|
|
238
241
|
// (undocumented)
|
|
@@ -240,10 +243,10 @@ export interface IntlConfig {
|
|
|
240
243
|
}
|
|
241
244
|
|
|
242
245
|
// @public (undocumented)
|
|
243
|
-
export const IntlContext:
|
|
246
|
+
export const IntlContext: React_2.Context<IntlShape>;
|
|
244
247
|
|
|
245
248
|
// @public (undocumented)
|
|
246
|
-
export interface IntlFormatters<T =
|
|
249
|
+
export interface IntlFormatters<T = React_2.ReactNode, R = T> {
|
|
247
250
|
// (undocumented)
|
|
248
251
|
formatDate(value: Parameters<Intl.DateTimeFormat['format']>[0] | string, opts?: FormatDateOptions): string;
|
|
249
252
|
// (undocumented)
|
|
@@ -253,11 +256,11 @@ export interface IntlFormatters<T = React.ReactNode> {
|
|
|
253
256
|
// (undocumented)
|
|
254
257
|
formatList(values: Array<string>, opts?: FormatListOptions): string;
|
|
255
258
|
// (undocumented)
|
|
256
|
-
formatList(values: Array<string |
|
|
259
|
+
formatList(values: Array<string | React_2.ReactNode>, opts?: FormatListOptions): React_2.ReactNode;
|
|
257
260
|
// (undocumented)
|
|
258
261
|
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType>): string;
|
|
259
262
|
// (undocumented)
|
|
260
|
-
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType |
|
|
263
|
+
formatMessage(descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | React_2.ReactElement | FormatXMLElementFn<T, R>>): string | React_2.ReactNodeArray;
|
|
261
264
|
// (undocumented)
|
|
262
265
|
formatNumber(value: Parameters<Intl.NumberFormat['format']>[0], opts?: FormatNumberOptions): string;
|
|
263
266
|
// (undocumented)
|
|
@@ -275,7 +278,7 @@ export interface IntlFormatters<T = React.ReactNode> {
|
|
|
275
278
|
// Warning: (ae-forgotten-export) The symbol "State" needs to be exported by the entry point index.d.ts
|
|
276
279
|
//
|
|
277
280
|
// @public (undocumented)
|
|
278
|
-
export class IntlProvider extends
|
|
281
|
+
export class IntlProvider extends React_2.PureComponent<OptionalIntlConfig, State> {
|
|
279
282
|
// (undocumented)
|
|
280
283
|
static defaultProps: Pick<IntlConfig, "formats" | "messages" | "timeZone" | "textComponent" | "defaultLocale" | "defaultFormats" | "onError">;
|
|
281
284
|
// (undocumented)
|
|
@@ -305,16 +308,20 @@ export interface MessageDescriptor {
|
|
|
305
308
|
}
|
|
306
309
|
|
|
307
310
|
// @public (undocumented)
|
|
308
|
-
|
|
311
|
+
type Omit_2<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
|
312
|
+
|
|
313
|
+
export { Omit_2 as Omit }
|
|
309
314
|
|
|
310
315
|
// @public (undocumented)
|
|
311
|
-
export const RawIntlProvider:
|
|
316
|
+
export const RawIntlProvider: React_2.Provider<IntlShape>;
|
|
312
317
|
|
|
313
318
|
// @public (undocumented)
|
|
314
319
|
export class ReactIntlError extends Error {
|
|
315
|
-
constructor(code: ReactIntlErrorCode, message: string, exception?: Error);
|
|
320
|
+
constructor(code: ReactIntlErrorCode, message: string, descriptor?: MessageDescriptor, exception?: Error);
|
|
321
|
+
// (undocumented)
|
|
322
|
+
readonly code: ReactIntlErrorCode;
|
|
316
323
|
// (undocumented)
|
|
317
|
-
|
|
324
|
+
readonly descriptor?: MessageDescriptor;
|
|
318
325
|
}
|
|
319
326
|
|
|
320
327
|
// @public (undocumented)
|
|
@@ -335,8 +342,8 @@ export const enum ReactIntlErrorCode {
|
|
|
335
342
|
export function useIntl(): IntlShape;
|
|
336
343
|
|
|
337
344
|
// @public (undocumented)
|
|
338
|
-
export type WithIntlProps<P> =
|
|
339
|
-
forwardedRef?:
|
|
345
|
+
export type WithIntlProps<P> = Omit_2<P, keyof WrappedComponentProps> & {
|
|
346
|
+
forwardedRef?: React_2.Ref<any>;
|
|
340
347
|
};
|
|
341
348
|
|
|
342
349
|
// @public (undocumented)
|