react-intl 7.1.11 → 7.1.13
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/src/utils.js +4 -5
- package/package.json +5 -5
- package/react-intl.iife.js +5 -6
- package/src/utils.js +4 -5
package/lib/src/utils.js
CHANGED
|
@@ -12,10 +12,9 @@ export function invariantIntlContext(intl) {
|
|
|
12
12
|
'<IntlProvider> needs to exist in the component ancestry.');
|
|
13
13
|
}
|
|
14
14
|
export var DEFAULT_INTL_CONFIG = __assign(__assign({}, CORE_DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|
|
15
|
-
var
|
|
16
|
-
var toArbitrarilyKeyedReactNode = function (reactNode) {
|
|
15
|
+
var toKeyedReactNode = function (reactNode, key) {
|
|
17
16
|
return React.isValidElement(reactNode)
|
|
18
|
-
? React.
|
|
17
|
+
? React.cloneElement(reactNode, { key: key })
|
|
19
18
|
: reactNode;
|
|
20
19
|
};
|
|
21
20
|
/**
|
|
@@ -33,7 +32,7 @@ export var toKeyedReactNodeArray = function (children) { var _a;
|
|
|
33
32
|
* every key anyway, so the auto-injected one doesn't even have to be unique.
|
|
34
33
|
* This basically just tells React that it's explicit/intentional.
|
|
35
34
|
*/
|
|
36
|
-
return (_a = React.Children.map(children,
|
|
35
|
+
return (_a = React.Children.map(children, toKeyedReactNode)) !== null && _a !== void 0 ? _a : []; };
|
|
37
36
|
/**
|
|
38
37
|
* Takes a `formatXMLElementFn`, and composes it in function, which passes
|
|
39
38
|
* argument `parts` through, assigning unique key to each part, to prevent
|
|
@@ -43,7 +42,7 @@ return (_a = React.Children.map(children, toArbitrarilyKeyedReactNode)) !== null
|
|
|
43
42
|
export function assignUniqueKeysToParts(formatXMLElementFn) {
|
|
44
43
|
return function (parts) {
|
|
45
44
|
// eslint-disable-next-line prefer-rest-params
|
|
46
|
-
return formatXMLElementFn(
|
|
45
|
+
return formatXMLElementFn(toKeyedReactNodeArray(parts));
|
|
47
46
|
};
|
|
48
47
|
}
|
|
49
48
|
export function shallowEqual(objA, objB) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
3
|
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
|
|
4
|
-
"version": "7.1.
|
|
4
|
+
"version": "7.1.13",
|
|
5
5
|
"license": "BSD-3-Clause",
|
|
6
6
|
"author": "Eric Ferraiuolo <edf@ericf.me>",
|
|
7
7
|
"sideEffects": false,
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
"@types/react": "16 || 17 || 18 || 19",
|
|
12
12
|
"hoist-non-react-statics": "^3.3.2",
|
|
13
13
|
"tslib": "^2.8.0",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"@formatjs/intl": "3.1.
|
|
17
|
-
"@formatjs/
|
|
14
|
+
"@formatjs/ecma402-abstract": "2.3.5",
|
|
15
|
+
"intl-messageformat": "10.7.17",
|
|
16
|
+
"@formatjs/intl": "3.1.7",
|
|
17
|
+
"@formatjs/icu-messageformat-parser": "2.11.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "16 || 17 || 18 || 19",
|
package/react-intl.iife.js
CHANGED
|
@@ -4224,8 +4224,8 @@ var ReactIntl = (() => {
|
|
|
4224
4224
|
var filteredOptions = filterProps(options, LIST_FORMAT_OPTIONS);
|
|
4225
4225
|
try {
|
|
4226
4226
|
var richValues_1 = {};
|
|
4227
|
-
var serializedValues = values.map(function(v, i) {
|
|
4228
|
-
if (typeof v === "object") {
|
|
4227
|
+
var serializedValues = Array.from(values).map(function(v, i) {
|
|
4228
|
+
if (typeof v === "object" && v !== null) {
|
|
4229
4229
|
var id = generateToken(i);
|
|
4230
4230
|
richValues_1[id] = v;
|
|
4231
4231
|
return id;
|
|
@@ -4394,8 +4394,7 @@ var ReactIntl = (() => {
|
|
|
4394
4394
|
var DEFAULT_INTL_CONFIG2 = __spreadProps(__spreadValues({}, DEFAULT_INTL_CONFIG), {
|
|
4395
4395
|
textComponent: React.Fragment
|
|
4396
4396
|
});
|
|
4397
|
-
var
|
|
4398
|
-
var toArbitrarilyKeyedReactNode = (reactNode) => React.isValidElement(reactNode) ? React.createElement(React.Fragment, arbitraryKeyProps, reactNode) : reactNode;
|
|
4397
|
+
var toKeyedReactNode = (reactNode, key) => React.isValidElement(reactNode) ? React.cloneElement(reactNode, { key }) : reactNode;
|
|
4399
4398
|
var toKeyedReactNodeArray = (children) => {
|
|
4400
4399
|
var _a2;
|
|
4401
4400
|
return (
|
|
@@ -4404,12 +4403,12 @@ var ReactIntl = (() => {
|
|
|
4404
4403
|
* every key anyway, so the auto-injected one doesn't even have to be unique.
|
|
4405
4404
|
* This basically just tells React that it's explicit/intentional.
|
|
4406
4405
|
*/
|
|
4407
|
-
(_a2 = React.Children.map(children,
|
|
4406
|
+
(_a2 = React.Children.map(children, toKeyedReactNode)) != null ? _a2 : []
|
|
4408
4407
|
);
|
|
4409
4408
|
};
|
|
4410
4409
|
function assignUniqueKeysToParts(formatXMLElementFn) {
|
|
4411
4410
|
return function(parts) {
|
|
4412
|
-
return formatXMLElementFn(
|
|
4411
|
+
return formatXMLElementFn(toKeyedReactNodeArray(parts));
|
|
4413
4412
|
};
|
|
4414
4413
|
}
|
|
4415
4414
|
function shallowEqual(objA, objB) {
|
package/src/utils.js
CHANGED
|
@@ -19,10 +19,9 @@ function invariantIntlContext(intl) {
|
|
|
19
19
|
'<IntlProvider> needs to exist in the component ancestry.');
|
|
20
20
|
}
|
|
21
21
|
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|
|
22
|
-
var
|
|
23
|
-
var toArbitrarilyKeyedReactNode = function (reactNode) {
|
|
22
|
+
var toKeyedReactNode = function (reactNode, key) {
|
|
24
23
|
return React.isValidElement(reactNode)
|
|
25
|
-
? React.
|
|
24
|
+
? React.cloneElement(reactNode, { key: key })
|
|
26
25
|
: reactNode;
|
|
27
26
|
};
|
|
28
27
|
/**
|
|
@@ -40,7 +39,7 @@ var toKeyedReactNodeArray = function (children) { var _a;
|
|
|
40
39
|
* every key anyway, so the auto-injected one doesn't even have to be unique.
|
|
41
40
|
* This basically just tells React that it's explicit/intentional.
|
|
42
41
|
*/
|
|
43
|
-
return (_a = React.Children.map(children,
|
|
42
|
+
return (_a = React.Children.map(children, toKeyedReactNode)) !== null && _a !== void 0 ? _a : []; };
|
|
44
43
|
exports.toKeyedReactNodeArray = toKeyedReactNodeArray;
|
|
45
44
|
/**
|
|
46
45
|
* Takes a `formatXMLElementFn`, and composes it in function, which passes
|
|
@@ -51,7 +50,7 @@ exports.toKeyedReactNodeArray = toKeyedReactNodeArray;
|
|
|
51
50
|
function assignUniqueKeysToParts(formatXMLElementFn) {
|
|
52
51
|
return function (parts) {
|
|
53
52
|
// eslint-disable-next-line prefer-rest-params
|
|
54
|
-
return formatXMLElementFn(
|
|
53
|
+
return formatXMLElementFn((0, exports.toKeyedReactNodeArray)(parts));
|
|
55
54
|
};
|
|
56
55
|
}
|
|
57
56
|
function shallowEqual(objA, objB) {
|