@lingui/react 4.0.0-next.5 → 4.0.0-next.6

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/dist/index.cjs CHANGED
@@ -89,6 +89,9 @@ function formatElements(value, elements = {}) {
89
89
  }
90
90
  element = React.createElement(React.Fragment);
91
91
  }
92
+ if (Array.isArray(element)) {
93
+ element = React.createElement(React.Fragment, {}, element);
94
+ }
92
95
  tree.push(
93
96
  React.cloneElement(
94
97
  element,
@@ -121,7 +124,8 @@ function Trans(props) {
121
124
  if (values) {
122
125
  Object.keys(values).forEach((key) => {
123
126
  const value = values[key];
124
- if (!React.isValidElement(value))
127
+ const valueIsReactEl = React.isValidElement(value) || Array.isArray(value) && value.every((el) => React.isValidElement(el));
128
+ if (!valueIsReactEl)
125
129
  return;
126
130
  const index = Object.keys(components).length;
127
131
  components[index] = value;
package/dist/index.mjs CHANGED
@@ -87,6 +87,9 @@ function formatElements(value, elements = {}) {
87
87
  }
88
88
  element = React.createElement(React.Fragment);
89
89
  }
90
+ if (Array.isArray(element)) {
91
+ element = React.createElement(React.Fragment, {}, element);
92
+ }
90
93
  tree.push(
91
94
  React.cloneElement(
92
95
  element,
@@ -119,7 +122,8 @@ function Trans(props) {
119
122
  if (values) {
120
123
  Object.keys(values).forEach((key) => {
121
124
  const value = values[key];
122
- if (!React.isValidElement(value))
125
+ const valueIsReactEl = React.isValidElement(value) || Array.isArray(value) && value.every((el) => React.isValidElement(el));
126
+ if (!valueIsReactEl)
123
127
  return;
124
128
  const index = Object.keys(components).length;
125
129
  components[index] = value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/react",
3
- "version": "4.0.0-next.5",
3
+ "version": "4.0.0-next.6",
4
4
  "sideEffects": false,
5
5
  "description": "React components for translations",
6
6
  "main": "./dist/index.cjs",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@babel/runtime": "^7.20.13",
61
- "@lingui/core": "^4.0.0-next.5"
61
+ "@lingui/core": "^4.0.0-next.6"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@lingui/jest-mocks": "^3.0.3",
@@ -67,5 +67,5 @@
67
67
  "react-dom": "^17.0.2",
68
68
  "unbuild": "^1.1.2"
69
69
  },
70
- "gitHead": "bdbd6cf310cbcf09e1fe288f20ef530c28de481d"
70
+ "gitHead": "d4d9e149b2419d1796e14176d53703a7cff4b82c"
71
71
  }