react-intl 6.5.1 → 6.5.3
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/lib/index.js +45 -20
- package/lib/src/components/createFormattedComponent.js +24 -17
- package/lib/src/components/dateTimeRange.js +8 -6
- package/lib/src/components/injectIntl.js +15 -11
- package/lib/src/components/message.js +12 -10
- package/lib/src/components/plural.js +7 -4
- package/lib/src/components/provider.d.ts +2 -2
- package/lib/src/components/provider.js +27 -23
- package/lib/src/components/relative.js +12 -10
- package/lib/src/components/useIntl.js +10 -6
- package/lib/src/types.js +2 -1
- package/lib/src/utils.js +15 -9
- package/package.json +9 -9
- package/react-intl.iife.js +12427 -4398
- package/src/components/provider.d.ts +2 -2
- package/src/components/provider.js +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { CreateIntlFn, IntlCache } from '@formatjs/intl';
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import type { IntlConfig, IntlShape, ResolvedIntlConfig } from '../types';
|
|
3
|
-
import { IntlCache, CreateIntlFn } from '@formatjs/intl';
|
|
4
4
|
interface State {
|
|
5
5
|
/**
|
|
6
6
|
* Explicit intl cache to prevent memory leaks
|
|
@@ -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<ResolvedIntlConfig, "
|
|
28
|
+
static defaultProps: Pick<ResolvedIntlConfig, "timeZone" | "onError" | "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;
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.createIntl = void 0;
|
|
9
9
|
var tslib_1 = require("tslib");
|
|
10
|
+
var intl_1 = require("@formatjs/intl");
|
|
10
11
|
var React = tslib_1.__importStar(require("react"));
|
|
11
|
-
var injectIntl_1 = require("./injectIntl");
|
|
12
12
|
var utils_1 = require("../utils");
|
|
13
|
-
var
|
|
13
|
+
var injectIntl_1 = require("./injectIntl");
|
|
14
14
|
var intl_messageformat_1 = require("intl-messageformat");
|
|
15
15
|
function processIntlConfig(config) {
|
|
16
16
|
return {
|
|
@@ -75,9 +75,9 @@ var createIntl = function (_a, cache) {
|
|
|
75
75
|
onError: coreIntl.onError,
|
|
76
76
|
defaultRichTextElements: defaultRichTextElements,
|
|
77
77
|
};
|
|
78
|
-
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), {
|
|
78
|
+
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
|
|
79
79
|
// @ts-expect-error fix this
|
|
80
|
-
|
|
80
|
+
coreIntl.formatters),
|
|
81
81
|
// @ts-expect-error fix this
|
|
82
82
|
$t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
|
|
83
83
|
};
|