@lingui/react 5.8.0 → 5.9.1

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.
@@ -1,12 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  const server = require('./server.cjs');
4
- const TransNoContext = require('./shared/react.6e08509a.cjs');
5
- const React = require('react');
6
-
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
8
-
9
- const React__default = /*#__PURE__*/_interopDefaultCompat(React);
4
+ const jsxRuntime = require('react/jsx-runtime');
5
+ const TransNoContext = require('./shared/react.90cde280.cjs');
6
+ require('react');
10
7
 
11
8
  function TransRsc(props) {
12
9
  const ctx = server.getI18n();
@@ -15,7 +12,7 @@ function TransRsc(props) {
15
12
  "You tried to use `Trans` in Server Component, but i18n instance for RSC hasn't been setup.\nMake sure to call `setI18n` in the root of your page."
16
13
  );
17
14
  }
18
- return /* @__PURE__ */ React__default.createElement(TransNoContext.TransNoContext, { ...props, lingui: ctx });
15
+ return /* @__PURE__ */ jsxRuntime.jsx(TransNoContext.TransNoContext, { ...props, lingui: ctx });
19
16
  }
20
17
 
21
18
  function useLingui() {
@@ -1,6 +1,7 @@
1
- import { T as TransProps, b as I18nContext } from './shared/react.34bf68ab.cjs';
2
- export { d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.34bf68ab.cjs';
3
- import React from 'react';
1
+ import { T as TransProps, b as I18nContext } from './shared/react.05772d3b.cjs';
2
+ export { d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.05772d3b.cjs';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import '@lingui/core';
5
6
 
6
7
  declare function TransRsc(props: TransProps): React.ReactElement<any, any> | null;
@@ -1,6 +1,7 @@
1
- import { T as TransProps, b as I18nContext } from './shared/react.34bf68ab.mjs';
2
- export { d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.34bf68ab.mjs';
3
- import React from 'react';
1
+ import { T as TransProps, b as I18nContext } from './shared/react.05772d3b.mjs';
2
+ export { d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.05772d3b.mjs';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import '@lingui/core';
5
6
 
6
7
  declare function TransRsc(props: TransProps): React.ReactElement<any, any> | null;
@@ -1,6 +1,7 @@
1
- import { T as TransProps, b as I18nContext } from './shared/react.34bf68ab.js';
2
- export { d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.34bf68ab.js';
3
- import React from 'react';
1
+ import { T as TransProps, b as I18nContext } from './shared/react.05772d3b.js';
2
+ export { d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.05772d3b.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import '@lingui/core';
5
6
 
6
7
  declare function TransRsc(props: TransProps): React.ReactElement<any, any> | null;
@@ -1,6 +1,7 @@
1
1
  import { getI18n } from './server.mjs';
2
- import { T as TransNoContext } from './shared/react.3519b71e.mjs';
3
- import React from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { T as TransNoContext } from './shared/react.8970326b.mjs';
4
+ import 'react';
4
5
 
5
6
  function TransRsc(props) {
6
7
  const ctx = getI18n();
@@ -9,7 +10,7 @@ function TransRsc(props) {
9
10
  "You tried to use `Trans` in Server Component, but i18n instance for RSC hasn't been setup.\nMake sure to call `setI18n` in the root of your page."
10
11
  );
11
12
  }
12
- return /* @__PURE__ */ React.createElement(TransNoContext, { ...props, lingui: ctx });
13
+ return /* @__PURE__ */ jsx(TransNoContext, { ...props, lingui: ctx });
13
14
  }
14
15
 
15
16
  function useLingui() {
package/dist/index.cjs CHANGED
@@ -1,16 +1,13 @@
1
1
  'use client';
2
2
  'use strict';
3
3
 
4
+ const jsxRuntime = require('react/jsx-runtime');
4
5
  const React = require('react');
5
- const TransNoContext = require('./shared/react.6e08509a.cjs');
6
+ const TransNoContext = require('./shared/react.90cde280.cjs');
6
7
 
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
8
-
9
- const React__default = /*#__PURE__*/_interopDefaultCompat(React);
10
-
11
- const LinguiContext = React__default.createContext(null);
8
+ const LinguiContext = React.createContext(null);
12
9
  const useLinguiInternal = (devErrorMessage) => {
13
- const context = React__default.useContext(LinguiContext);
10
+ const context = React.useContext(LinguiContext);
14
11
  if (process.env.NODE_ENV !== "production") {
15
12
  if (context == null) {
16
13
  throw new Error(
@@ -23,13 +20,13 @@ const useLinguiInternal = (devErrorMessage) => {
23
20
  function useLingui() {
24
21
  return useLinguiInternal();
25
22
  }
26
- function I18nProvider({
23
+ const I18nProvider = ({
27
24
  i18n,
28
25
  defaultComponent,
29
26
  children
30
- }) {
31
- const latestKnownLocale = React__default.useRef(i18n.locale);
32
- const makeContext = React__default.useCallback(
27
+ }) => {
28
+ const latestKnownLocale = React.useRef(i18n.locale);
29
+ const makeContext = React.useCallback(
33
30
  () => ({
34
31
  i18n,
35
32
  defaultComponent,
@@ -37,8 +34,8 @@ function I18nProvider({
37
34
  }),
38
35
  [i18n, defaultComponent]
39
36
  );
40
- const [context, setContext] = React__default.useState(makeContext());
41
- React__default.useEffect(() => {
37
+ const [context, setContext] = React.useState(makeContext());
38
+ React.useEffect(() => {
42
39
  const updateContext = () => {
43
40
  latestKnownLocale.current = i18n.locale;
44
41
  setContext(makeContext());
@@ -55,8 +52,8 @@ function I18nProvider({
55
52
  );
56
53
  return null;
57
54
  }
58
- return /* @__PURE__ */ React__default.createElement(LinguiContext.Provider, { value: context }, children);
59
- }
55
+ return /* @__PURE__ */ jsxRuntime.jsx(LinguiContext.Provider, { value: context, children });
56
+ };
60
57
 
61
58
  function Trans(props) {
62
59
  let errMessage = void 0;
@@ -65,7 +62,7 @@ function Trans(props) {
65
62
  Attempted to render message: ${props.message} id: ${props.id}. Make sure this component is rendered inside a I18nProvider.`;
66
63
  }
67
64
  const lingui = useLinguiInternal(errMessage);
68
- return React__default.createElement(TransNoContext.TransNoContext, { ...props, lingui });
65
+ return /* @__PURE__ */ jsxRuntime.jsx(TransNoContext.TransNoContext, { ...props, lingui });
69
66
  }
70
67
 
71
68
  exports.I18nProvider = I18nProvider;
package/dist/index.d.cts CHANGED
@@ -1,6 +1,7 @@
1
- import { T as TransProps } from './shared/react.34bf68ab.cjs';
2
- export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, d as TransRenderCallbackOrComponent, c as TransRenderProps, u as useLingui } from './shared/react.34bf68ab.cjs';
3
- import React from 'react';
1
+ import { T as TransProps } from './shared/react.05772d3b.cjs';
2
+ export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, d as TransRenderCallbackOrComponent, c as TransRenderProps, u as useLingui } from './shared/react.05772d3b.cjs';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import '@lingui/core';
5
6
 
6
7
  declare function Trans(props: TransProps): React.ReactElement<any, any> | null;
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- import { T as TransProps } from './shared/react.34bf68ab.mjs';
2
- export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, d as TransRenderCallbackOrComponent, c as TransRenderProps, u as useLingui } from './shared/react.34bf68ab.mjs';
3
- import React from 'react';
1
+ import { T as TransProps } from './shared/react.05772d3b.mjs';
2
+ export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, d as TransRenderCallbackOrComponent, c as TransRenderProps, u as useLingui } from './shared/react.05772d3b.mjs';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import '@lingui/core';
5
6
 
6
7
  declare function Trans(props: TransProps): React.ReactElement<any, any> | null;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { T as TransProps } from './shared/react.34bf68ab.js';
2
- export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, d as TransRenderCallbackOrComponent, c as TransRenderProps, u as useLingui } from './shared/react.34bf68ab.js';
3
- import React from 'react';
1
+ import { T as TransProps } from './shared/react.05772d3b.js';
2
+ export { b as I18nContext, I as I18nProvider, a as I18nProviderProps, L as LinguiContext, d as TransRenderCallbackOrComponent, c as TransRenderProps, u as useLingui } from './shared/react.05772d3b.js';
3
+ import 'react/jsx-runtime';
4
+ import 'react';
4
5
  import '@lingui/core';
5
6
 
6
7
  declare function Trans(props: TransProps): React.ReactElement<any, any> | null;
package/dist/index.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  'use client';
2
- import React from 'react';
3
- import { T as TransNoContext } from './shared/react.3519b71e.mjs';
2
+ import { jsx } from 'react/jsx-runtime';
3
+ import { createContext, useRef, useCallback, useState, useEffect, useContext } from 'react';
4
+ import { T as TransNoContext } from './shared/react.8970326b.mjs';
4
5
 
5
- const LinguiContext = React.createContext(null);
6
+ const LinguiContext = createContext(null);
6
7
  const useLinguiInternal = (devErrorMessage) => {
7
- const context = React.useContext(LinguiContext);
8
+ const context = useContext(LinguiContext);
8
9
  if (process.env.NODE_ENV !== "production") {
9
10
  if (context == null) {
10
11
  throw new Error(
@@ -17,13 +18,13 @@ const useLinguiInternal = (devErrorMessage) => {
17
18
  function useLingui() {
18
19
  return useLinguiInternal();
19
20
  }
20
- function I18nProvider({
21
+ const I18nProvider = ({
21
22
  i18n,
22
23
  defaultComponent,
23
24
  children
24
- }) {
25
- const latestKnownLocale = React.useRef(i18n.locale);
26
- const makeContext = React.useCallback(
25
+ }) => {
26
+ const latestKnownLocale = useRef(i18n.locale);
27
+ const makeContext = useCallback(
27
28
  () => ({
28
29
  i18n,
29
30
  defaultComponent,
@@ -31,8 +32,8 @@ function I18nProvider({
31
32
  }),
32
33
  [i18n, defaultComponent]
33
34
  );
34
- const [context, setContext] = React.useState(makeContext());
35
- React.useEffect(() => {
35
+ const [context, setContext] = useState(makeContext());
36
+ useEffect(() => {
36
37
  const updateContext = () => {
37
38
  latestKnownLocale.current = i18n.locale;
38
39
  setContext(makeContext());
@@ -49,8 +50,8 @@ function I18nProvider({
49
50
  );
50
51
  return null;
51
52
  }
52
- return /* @__PURE__ */ React.createElement(LinguiContext.Provider, { value: context }, children);
53
- }
53
+ return /* @__PURE__ */ jsx(LinguiContext.Provider, { value: context, children });
54
+ };
54
55
 
55
56
  function Trans(props) {
56
57
  let errMessage = void 0;
@@ -59,7 +60,7 @@ function Trans(props) {
59
60
  Attempted to render message: ${props.message} id: ${props.id}. Make sure this component is rendered inside a I18nProvider.`;
60
61
  }
61
62
  const lingui = useLinguiInternal(errMessage);
62
- return React.createElement(TransNoContext, { ...props, lingui });
63
+ return /* @__PURE__ */ jsx(TransNoContext, { ...props, lingui });
63
64
  }
64
65
 
65
66
  export { I18nProvider, LinguiContext, Trans, useLingui };
package/dist/server.cjs CHANGED
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const TransNoContext = require('./shared/react.6e08509a.cjs');
3
+ const TransNoContext = require('./shared/react.90cde280.cjs');
4
4
  const React = require('react');
5
+ require('react/jsx-runtime');
5
6
 
6
7
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
7
8
 
package/dist/server.d.cts CHANGED
@@ -1,6 +1,7 @@
1
- import { b as I18nContext } from './shared/react.34bf68ab.cjs';
2
- export { e as TransNoContext, T as TransProps, d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.34bf68ab.cjs';
1
+ import { b as I18nContext } from './shared/react.05772d3b.cjs';
2
+ export { e as TransNoContext, T as TransProps, d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.05772d3b.cjs';
3
3
  import { I18n } from '@lingui/core';
4
+ import 'react/jsx-runtime';
4
5
  import 'react';
5
6
 
6
7
  /**
package/dist/server.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- import { b as I18nContext } from './shared/react.34bf68ab.mjs';
2
- export { e as TransNoContext, T as TransProps, d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.34bf68ab.mjs';
1
+ import { b as I18nContext } from './shared/react.05772d3b.mjs';
2
+ export { e as TransNoContext, T as TransProps, d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.05772d3b.mjs';
3
3
  import { I18n } from '@lingui/core';
4
+ import 'react/jsx-runtime';
4
5
  import 'react';
5
6
 
6
7
  /**
package/dist/server.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- import { b as I18nContext } from './shared/react.34bf68ab.js';
2
- export { e as TransNoContext, T as TransProps, d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.34bf68ab.js';
1
+ import { b as I18nContext } from './shared/react.05772d3b.js';
2
+ export { e as TransNoContext, T as TransProps, d as TransRenderCallbackOrComponent, c as TransRenderProps } from './shared/react.05772d3b.js';
3
3
  import { I18n } from '@lingui/core';
4
+ import 'react/jsx-runtime';
4
5
  import 'react';
5
6
 
6
7
  /**
package/dist/server.mjs CHANGED
@@ -1,5 +1,6 @@
1
- export { T as TransNoContext } from './shared/react.3519b71e.mjs';
1
+ export { T as TransNoContext } from './shared/react.8970326b.mjs';
2
2
  import React from 'react';
3
+ import 'react/jsx-runtime';
3
4
 
4
5
  let cache = null;
5
6
  const getLinguiCache = () => {
@@ -1,4 +1,5 @@
1
- import React, { ComponentType } from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
  import { MessageOptions, I18n } from '@lingui/core';
3
4
 
4
5
  type TransRenderProps = {
@@ -8,11 +9,11 @@ type TransRenderProps = {
8
9
  message?: string | null;
9
10
  };
10
11
  type TransRenderCallbackOrComponent = {
11
- component?: undefined;
12
+ component?: never;
12
13
  render?: ((props: TransRenderProps) => React.ReactElement<any, any>) | null;
13
14
  } | {
14
15
  component?: React.ComponentType<TransRenderProps> | null;
15
- render?: undefined;
16
+ render?: never;
16
17
  };
17
18
  type TransProps = {
18
19
  id: string;
@@ -33,20 +34,20 @@ type TransProps = {
33
34
  declare function TransNoContext(props: TransProps & {
34
35
  lingui: {
35
36
  i18n: I18n;
36
- defaultComponent?: ComponentType<TransRenderProps>;
37
+ defaultComponent?: React.ComponentType<TransRenderProps>;
37
38
  };
38
39
  }): React.ReactElement<any, any> | null;
39
40
 
40
41
  type I18nContext = {
41
42
  i18n: I18n;
42
43
  _: I18n["_"];
43
- defaultComponent?: ComponentType<TransRenderProps>;
44
+ defaultComponent?: React.ComponentType<TransRenderProps>;
44
45
  };
45
46
  type I18nProviderProps = Omit<I18nContext, "_"> & {
46
47
  children?: React.ReactNode;
47
48
  };
48
- declare const LinguiContext: React.Context<I18nContext | null>;
49
+ declare const LinguiContext: react.Context<I18nContext | null>;
49
50
  declare function useLingui(): I18nContext;
50
- declare function I18nProvider({ i18n, defaultComponent, children, }: I18nProviderProps): React.JSX.Element | null;
51
+ declare const I18nProvider: ({ i18n, defaultComponent, children, }: I18nProviderProps) => react_jsx_runtime.JSX.Element | null;
51
52
 
52
53
  export { I18nProvider as I, LinguiContext as L, type TransProps as T, type I18nProviderProps as a, type I18nContext as b, type TransRenderProps as c, type TransRenderCallbackOrComponent as d, TransNoContext as e, useLingui as u };
@@ -1,4 +1,5 @@
1
- import React, { ComponentType } from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
  import { MessageOptions, I18n } from '@lingui/core';
3
4
 
4
5
  type TransRenderProps = {
@@ -8,11 +9,11 @@ type TransRenderProps = {
8
9
  message?: string | null;
9
10
  };
10
11
  type TransRenderCallbackOrComponent = {
11
- component?: undefined;
12
+ component?: never;
12
13
  render?: ((props: TransRenderProps) => React.ReactElement<any, any>) | null;
13
14
  } | {
14
15
  component?: React.ComponentType<TransRenderProps> | null;
15
- render?: undefined;
16
+ render?: never;
16
17
  };
17
18
  type TransProps = {
18
19
  id: string;
@@ -33,20 +34,20 @@ type TransProps = {
33
34
  declare function TransNoContext(props: TransProps & {
34
35
  lingui: {
35
36
  i18n: I18n;
36
- defaultComponent?: ComponentType<TransRenderProps>;
37
+ defaultComponent?: React.ComponentType<TransRenderProps>;
37
38
  };
38
39
  }): React.ReactElement<any, any> | null;
39
40
 
40
41
  type I18nContext = {
41
42
  i18n: I18n;
42
43
  _: I18n["_"];
43
- defaultComponent?: ComponentType<TransRenderProps>;
44
+ defaultComponent?: React.ComponentType<TransRenderProps>;
44
45
  };
45
46
  type I18nProviderProps = Omit<I18nContext, "_"> & {
46
47
  children?: React.ReactNode;
47
48
  };
48
- declare const LinguiContext: React.Context<I18nContext | null>;
49
+ declare const LinguiContext: react.Context<I18nContext | null>;
49
50
  declare function useLingui(): I18nContext;
50
- declare function I18nProvider({ i18n, defaultComponent, children, }: I18nProviderProps): React.JSX.Element | null;
51
+ declare const I18nProvider: ({ i18n, defaultComponent, children, }: I18nProviderProps) => react_jsx_runtime.JSX.Element | null;
51
52
 
52
53
  export { I18nProvider as I, LinguiContext as L, type TransProps as T, type I18nProviderProps as a, type I18nContext as b, type TransRenderProps as c, type TransRenderCallbackOrComponent as d, TransNoContext as e, useLingui as u };
@@ -1,4 +1,5 @@
1
- import React, { ComponentType } from 'react';
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as react from 'react';
2
3
  import { MessageOptions, I18n } from '@lingui/core';
3
4
 
4
5
  type TransRenderProps = {
@@ -8,11 +9,11 @@ type TransRenderProps = {
8
9
  message?: string | null;
9
10
  };
10
11
  type TransRenderCallbackOrComponent = {
11
- component?: undefined;
12
+ component?: never;
12
13
  render?: ((props: TransRenderProps) => React.ReactElement<any, any>) | null;
13
14
  } | {
14
15
  component?: React.ComponentType<TransRenderProps> | null;
15
- render?: undefined;
16
+ render?: never;
16
17
  };
17
18
  type TransProps = {
18
19
  id: string;
@@ -33,20 +34,20 @@ type TransProps = {
33
34
  declare function TransNoContext(props: TransProps & {
34
35
  lingui: {
35
36
  i18n: I18n;
36
- defaultComponent?: ComponentType<TransRenderProps>;
37
+ defaultComponent?: React.ComponentType<TransRenderProps>;
37
38
  };
38
39
  }): React.ReactElement<any, any> | null;
39
40
 
40
41
  type I18nContext = {
41
42
  i18n: I18n;
42
43
  _: I18n["_"];
43
- defaultComponent?: ComponentType<TransRenderProps>;
44
+ defaultComponent?: React.ComponentType<TransRenderProps>;
44
45
  };
45
46
  type I18nProviderProps = Omit<I18nContext, "_"> & {
46
47
  children?: React.ReactNode;
47
48
  };
48
- declare const LinguiContext: React.Context<I18nContext | null>;
49
+ declare const LinguiContext: react.Context<I18nContext | null>;
49
50
  declare function useLingui(): I18nContext;
50
- declare function I18nProvider({ i18n, defaultComponent, children, }: I18nProviderProps): React.JSX.Element | null;
51
+ declare const I18nProvider: ({ i18n, defaultComponent, children, }: I18nProviderProps) => react_jsx_runtime.JSX.Element | null;
51
52
 
52
53
  export { I18nProvider as I, LinguiContext as L, type TransProps as T, type I18nProviderProps as a, type I18nContext as b, type TransRenderProps as c, type TransRenderCallbackOrComponent as d, TransNoContext as e, useLingui as u };
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
2
+ import { cloneElement } from 'react';
2
3
 
3
4
  const tagRe = /<([a-zA-Z0-9]+)>([\s\S]*?)<\/\1>|<([a-zA-Z0-9]+)\/>/;
4
5
  const voidElementTags = {
@@ -40,13 +41,13 @@ function formatElements(value, elements = {}) {
40
41
  `${element.type} is a void element tag therefore it must have no children`
41
42
  );
42
43
  }
43
- element = React.createElement(React.Fragment);
44
+ element = /* @__PURE__ */ jsx(Fragment, {});
44
45
  }
45
46
  if (Array.isArray(element)) {
46
- element = React.createElement(React.Fragment, {}, element);
47
+ element = /* @__PURE__ */ jsx(Fragment, { children: element });
47
48
  }
48
49
  tree.push(
49
- React.cloneElement(
50
+ cloneElement(
50
51
  element,
51
52
  { key: uniqueId() },
52
53
  // format children for pair tags
@@ -83,7 +84,7 @@ function TransNoContext(props) {
83
84
  if (render === null || component === null) {
84
85
  return translation;
85
86
  }
86
- const FallbackComponent = defaultComponent || RenderFragment;
87
+ const FallbackComponent = defaultComponent || RenderChildren;
87
88
  const i18nProps = {
88
89
  id,
89
90
  message,
@@ -103,16 +104,16 @@ function TransNoContext(props) {
103
104
  console.error(
104
105
  `Invalid value supplied to prop \`component\`. It must be a React component, provided ${component}`
105
106
  );
106
- return React.createElement(FallbackComponent, i18nProps, translation);
107
+ return /* @__PURE__ */ jsx(FallbackComponent, { ...i18nProps, children: translation });
107
108
  }
108
109
  if (typeof render === "function") {
109
110
  return render(i18nProps);
110
111
  }
111
112
  const Component = component || FallbackComponent;
112
- return React.createElement(Component, i18nProps, translation);
113
+ return /* @__PURE__ */ jsx(Component, { ...i18nProps, children: translation });
113
114
  }
114
- const RenderFragment = ({ children }) => {
115
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
115
+ const RenderChildren = ({ children }) => {
116
+ return children;
116
117
  };
117
118
  const getInterpolationValuesAndComponents = (props) => {
118
119
  if (!props.values) {
@@ -128,7 +129,7 @@ const getInterpolationValuesAndComponents = (props) => {
128
129
  return;
129
130
  }
130
131
  const index = Object.keys(components).length;
131
- components[index] = /* @__PURE__ */ React.createElement(React.Fragment, null, valueForKey);
132
+ components[index] = /* @__PURE__ */ jsx(Fragment, { children: valueForKey });
132
133
  values[key] = `<${index}/>`;
133
134
  });
134
135
  return { values, components };
@@ -1,11 +1,8 @@
1
1
  'use strict';
2
2
 
3
+ const jsxRuntime = require('react/jsx-runtime');
3
4
  const React = require('react');
4
5
 
5
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
6
-
7
- const React__default = /*#__PURE__*/_interopDefaultCompat(React);
8
-
9
6
  const tagRe = /<([a-zA-Z0-9]+)>([\s\S]*?)<\/\1>|<([a-zA-Z0-9]+)\/>/;
10
7
  const voidElementTags = {
11
8
  area: true,
@@ -46,13 +43,13 @@ function formatElements(value, elements = {}) {
46
43
  `${element.type} is a void element tag therefore it must have no children`
47
44
  );
48
45
  }
49
- element = React__default.createElement(React__default.Fragment);
46
+ element = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
50
47
  }
51
48
  if (Array.isArray(element)) {
52
- element = React__default.createElement(React__default.Fragment, {}, element);
49
+ element = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: element });
53
50
  }
54
51
  tree.push(
55
- React__default.cloneElement(
52
+ React.cloneElement(
56
53
  element,
57
54
  { key: uniqueId() },
58
55
  // format children for pair tags
@@ -89,7 +86,7 @@ function TransNoContext(props) {
89
86
  if (render === null || component === null) {
90
87
  return translation;
91
88
  }
92
- const FallbackComponent = defaultComponent || RenderFragment;
89
+ const FallbackComponent = defaultComponent || RenderChildren;
93
90
  const i18nProps = {
94
91
  id,
95
92
  message,
@@ -109,16 +106,16 @@ function TransNoContext(props) {
109
106
  console.error(
110
107
  `Invalid value supplied to prop \`component\`. It must be a React component, provided ${component}`
111
108
  );
112
- return React__default.createElement(FallbackComponent, i18nProps, translation);
109
+ return /* @__PURE__ */ jsxRuntime.jsx(FallbackComponent, { ...i18nProps, children: translation });
113
110
  }
114
111
  if (typeof render === "function") {
115
112
  return render(i18nProps);
116
113
  }
117
114
  const Component = component || FallbackComponent;
118
- return React__default.createElement(Component, i18nProps, translation);
115
+ return /* @__PURE__ */ jsxRuntime.jsx(Component, { ...i18nProps, children: translation });
119
116
  }
120
- const RenderFragment = ({ children }) => {
121
- return /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, children);
117
+ const RenderChildren = ({ children }) => {
118
+ return children;
122
119
  };
123
120
  const getInterpolationValuesAndComponents = (props) => {
124
121
  if (!props.values) {
@@ -134,7 +131,7 @@ const getInterpolationValuesAndComponents = (props) => {
134
131
  return;
135
132
  }
136
133
  const index = Object.keys(components).length;
137
- components[index] = /* @__PURE__ */ React__default.createElement(React__default.Fragment, null, valueForKey);
134
+ components[index] = /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: valueForKey });
138
135
  values[key] = `<${index}/>`;
139
136
  });
140
137
  return { values, components };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingui/react",
3
- "version": "5.8.0",
3
+ "version": "5.9.1",
4
4
  "sideEffects": false,
5
5
  "description": "React components for translations",
6
6
  "main": "./dist/index.cjs",
@@ -79,9 +79,9 @@
79
79
  "macro/index.js"
80
80
  ],
81
81
  "peerDependencies": {
82
- "@lingui/babel-plugin-lingui-macro": "5.8.0",
82
+ "@lingui/babel-plugin-lingui-macro": "5.9.1",
83
83
  "babel-plugin-macros": "2 || 3",
84
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
84
+ "react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
85
85
  },
86
86
  "peerDependenciesMeta": {
87
87
  "@lingui/babel-plugin-lingui-macro": {
@@ -93,7 +93,7 @@
93
93
  },
94
94
  "dependencies": {
95
95
  "@babel/runtime": "^7.20.13",
96
- "@lingui/core": "5.8.0"
96
+ "@lingui/core": "5.9.1"
97
97
  },
98
98
  "devDependencies": {
99
99
  "@lingui/jest-mocks": "*",
@@ -105,5 +105,5 @@
105
105
  "react-dom": "^18.2.0",
106
106
  "unbuild": "2.0.0"
107
107
  },
108
- "gitHead": "83d0513bdda9ff14003a05d376c7fedf860dd7ee"
108
+ "gitHead": "4abb5a8fff1e1936a83a7d1ae602092607c520a1"
109
109
  }