@lingui/react
Advanced tools
Comparing version 4.0.0-next.1 to 4.0.0-next.2
'use strict'; | ||
var _extends = require('@babel/runtime/helpers/extends'); | ||
var React = require('react'); | ||
@@ -16,19 +15,2 @@ | ||
} | ||
function withI18n(o) { | ||
return WrappedComponent => { | ||
return props => { | ||
if (process.env.NODE_ENV !== "production") { | ||
if (typeof o === "function" || /*#__PURE__*/React.isValidElement(o)) { | ||
throw new Error("withI18n([options]) takes options as a first argument, " + "but received React component itself. Without options, the Component " + "should be wrapped as withI18n()(Component), not withI18n(Component)."); | ||
} | ||
} | ||
const { | ||
i18n | ||
} = useLingui(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, { | ||
i18n: i18n | ||
})); | ||
}; | ||
}; | ||
} | ||
const I18nProvider = _ref => { | ||
@@ -197,6 +179,6 @@ let { | ||
const values = { | ||
...props.values | ||
...(props.values || {}) | ||
}; | ||
const components = { | ||
...props.components | ||
...(props.components || {}) | ||
}; | ||
@@ -264,6 +246,2 @@ if (values) { | ||
} | ||
Trans.defaultProps = { | ||
values: {}, | ||
components: {} | ||
}; | ||
@@ -273,3 +251,2 @@ exports.I18nProvider = I18nProvider; | ||
exports.useLingui = useLingui; | ||
exports.withI18n = withI18n; | ||
//# sourceMappingURL=index.js.map |
'use strict'; | ||
var _extends = require('@babel/runtime/helpers/extends'); | ||
var React = require('react'); | ||
@@ -16,19 +15,2 @@ | ||
} | ||
function withI18n(o) { | ||
return WrappedComponent => { | ||
return props => { | ||
if (process.env.NODE_ENV !== "production") { | ||
if (typeof o === "function" || /*#__PURE__*/React.isValidElement(o)) { | ||
throw new Error("withI18n([options]) takes options as a first argument, " + "but received React component itself. Without options, the Component " + "should be wrapped as withI18n()(Component), not withI18n(Component)."); | ||
} | ||
} | ||
const { | ||
i18n | ||
} = useLingui(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, { | ||
i18n: i18n | ||
})); | ||
}; | ||
}; | ||
} | ||
const I18nProvider = _ref => { | ||
@@ -197,6 +179,6 @@ let { | ||
const values = { | ||
...props.values | ||
...(props.values || {}) | ||
}; | ||
const components = { | ||
...props.components | ||
...(props.components || {}) | ||
}; | ||
@@ -264,6 +246,2 @@ if (values) { | ||
} | ||
Trans.defaultProps = { | ||
values: {}, | ||
components: {} | ||
}; | ||
@@ -273,3 +251,2 @@ exports.I18nProvider = I18nProvider; | ||
exports.useLingui = useLingui; | ||
exports.withI18n = withI18n; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,1 @@ | ||
import _extends from '@babel/runtime/helpers/extends'; | ||
import React from 'react'; | ||
@@ -14,19 +13,2 @@ | ||
} | ||
function withI18n(o) { | ||
return WrappedComponent => { | ||
return props => { | ||
if (process.env.NODE_ENV !== "production") { | ||
if (typeof o === "function" || /*#__PURE__*/React.isValidElement(o)) { | ||
throw new Error("withI18n([options]) takes options as a first argument, " + "but received React component itself. Without options, the Component " + "should be wrapped as withI18n()(Component), not withI18n(Component)."); | ||
} | ||
} | ||
const { | ||
i18n | ||
} = useLingui(); | ||
return /*#__PURE__*/React.createElement(WrappedComponent, _extends({}, props, { | ||
i18n: i18n | ||
})); | ||
}; | ||
}; | ||
} | ||
const I18nProvider = _ref => { | ||
@@ -195,6 +177,6 @@ let { | ||
const values = { | ||
...props.values | ||
...(props.values || {}) | ||
}; | ||
const components = { | ||
...props.components | ||
...(props.components || {}) | ||
}; | ||
@@ -262,8 +244,4 @@ if (values) { | ||
} | ||
Trans.defaultProps = { | ||
values: {}, | ||
components: {} | ||
}; | ||
export { I18nProvider, Trans, useLingui, withI18n }; | ||
export { I18nProvider, Trans, useLingui }; | ||
//# sourceMappingURL=index.js.map |
@@ -14,4 +14,4 @@ import React, { ComponentType, FunctionComponent } from 'react'; | ||
message?: string; | ||
values: Record<string, unknown>; | ||
components: { | ||
values?: Record<string, unknown>; | ||
components?: { | ||
[key: string]: React.ElementType | any; | ||
@@ -25,8 +25,2 @@ }; | ||
declare function Trans(props: TransProps): React.ReactElement<any, any> | null; | ||
declare namespace Trans { | ||
var defaultProps: { | ||
values: {}; | ||
components: {}; | ||
}; | ||
} | ||
@@ -37,5 +31,2 @@ type I18nContext = { | ||
}; | ||
type withI18nProps = { | ||
i18n: I18n; | ||
}; | ||
type I18nProviderProps = I18nContext & { | ||
@@ -46,5 +37,4 @@ forceRenderOnLocaleChange?: boolean; | ||
declare function useLingui(): I18nContext; | ||
declare function withI18n(o?: object): <P extends withI18nProps>(Component: ComponentType<P>) => React.ComponentType<Omit<P, "i18n">>; | ||
declare const I18nProvider: FunctionComponent<I18nProviderProps>; | ||
export { I18nContext, I18nProvider, I18nProviderProps, Trans, TransProps, TransRenderProps, useLingui, withI18n, withI18nProps }; | ||
export { I18nContext, I18nProvider, I18nProviderProps, Trans, TransProps, TransRenderProps, useLingui }; |
{ | ||
"name": "@lingui/react", | ||
"version": "4.0.0-next.1", | ||
"version": "4.0.0-next.2", | ||
"sideEffects": false, | ||
@@ -57,3 +57,3 @@ "description": "React components for translations", | ||
"@babel/runtime": "^7.20.13", | ||
"@lingui/core": "^4.0.0-next.1" | ||
"@lingui/core": "^4.0.0-next.2" | ||
}, | ||
@@ -63,3 +63,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "27ee8e213ff6d0c7a0cd2b21c573d7f6da43fd85" | ||
"gitHead": "556ab57e20c2ac9d384a22424c6a90c2ba0dd133" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3
68031
727
Updated@lingui/core@^4.0.0-next.2