react-intl 6.7.2 → 6.8.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.
- package/index.js +3 -3
- package/lib/src/components/injectIntl.js +4 -2
- package/lib/src/components/provider.d.ts +1 -1
- package/lib/src/types.d.ts +1 -1
- package/package.json +11 -11
- package/react-intl.iife.js +352 -294
- package/src/components/createFormattedComponent.js +3 -3
- package/src/components/injectIntl.js +5 -3
- package/src/components/provider.d.ts +1 -1
- package/src/components/useIntl.js +1 -1
- package/src/types.d.ts +1 -1
- package/src/utils.js +4 -4
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FormattedListParts = exports.FormattedNumberParts = void 0;
|
|
4
|
+
exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent;
|
|
5
|
+
exports.createFormattedComponent = createFormattedComponent;
|
|
4
6
|
var tslib_1 = require("tslib");
|
|
5
7
|
var React = tslib_1.__importStar(require("react"));
|
|
6
8
|
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
@@ -48,7 +50,6 @@ function createFormattedDateTimePartsComponent(name) {
|
|
|
48
50
|
ComponentParts.displayName = DisplayNameParts[name];
|
|
49
51
|
return ComponentParts;
|
|
50
52
|
}
|
|
51
|
-
exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent;
|
|
52
53
|
function createFormattedComponent(name) {
|
|
53
54
|
var Component = function (props) {
|
|
54
55
|
var intl = (0, useIntl_1.default)();
|
|
@@ -66,4 +67,3 @@ function createFormattedComponent(name) {
|
|
|
66
67
|
Component.displayName = DisplayName[name];
|
|
67
68
|
return Component;
|
|
68
69
|
}
|
|
69
|
-
exports.createFormattedComponent = createFormattedComponent;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Context = exports.Provider = void 0;
|
|
4
|
+
exports.default = injectIntl;
|
|
4
5
|
var tslib_1 = require("tslib");
|
|
5
|
-
var React = tslib_1.__importStar(require("react"));
|
|
6
6
|
var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
|
|
7
|
+
var React = tslib_1.__importStar(require("react"));
|
|
7
8
|
var utils_1 = require("../utils");
|
|
8
9
|
function getDisplayName(Component) {
|
|
9
10
|
return Component.displayName || Component.name || 'Component';
|
|
@@ -30,8 +31,9 @@ function injectIntl(WrappedComponent, options) {
|
|
|
30
31
|
WithIntl.displayName = "injectIntl(".concat(getDisplayName(WrappedComponent), ")");
|
|
31
32
|
WithIntl.WrappedComponent = WrappedComponent;
|
|
32
33
|
if (forwardRef) {
|
|
33
|
-
return (0, hoist_non_react_statics_1.default)(
|
|
34
|
+
return (0, hoist_non_react_statics_1.default)(
|
|
35
|
+
// @ts-expect-error
|
|
36
|
+
React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, tslib_1.__assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
|
|
34
37
|
}
|
|
35
38
|
return (0, hoist_non_react_statics_1.default)(WithIntl, WrappedComponent);
|
|
36
39
|
}
|
|
37
|
-
exports.default = injectIntl;
|
|
@@ -23,6 +23,6 @@ export default class IntlProvider extends React.PureComponent<React.PropsWithChi
|
|
|
23
23
|
private cache;
|
|
24
24
|
state: State;
|
|
25
25
|
static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
|
|
26
|
-
render(): JSX.Element;
|
|
26
|
+
render(): React.JSX.Element;
|
|
27
27
|
}
|
|
28
28
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = useIntl;
|
|
3
4
|
var tslib_1 = require("tslib");
|
|
4
5
|
var React = tslib_1.__importStar(require("react"));
|
|
5
6
|
var utils_1 = require("../utils");
|
|
@@ -9,4 +10,3 @@ function useIntl() {
|
|
|
9
10
|
(0, utils_1.invariantIntlContext)(intl);
|
|
10
11
|
return intl;
|
|
11
12
|
}
|
|
12
|
-
exports.default = useIntl;
|
package/src/types.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ResolvedIntlConfig as CoreResolvedIntlConfig, IntlFormatters, Formatter
|
|
|
3
3
|
import { DEFAULT_INTL_CONFIG } from './utils';
|
|
4
4
|
export type IntlConfig = Omit<ResolvedIntlConfig, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
|
|
5
5
|
export interface ResolvedIntlConfig extends CoreResolvedIntlConfig<React.ReactNode> {
|
|
6
|
-
textComponent?: React.ComponentType | keyof React.
|
|
6
|
+
textComponent?: React.ComponentType | keyof React.JSX.IntrinsicElements;
|
|
7
7
|
wrapRichTextChunksInFragment?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export interface IntlShape extends ResolvedIntlConfig, IntlFormatters<React.ReactNode> {
|
package/src/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.DEFAULT_INTL_CONFIG = void 0;
|
|
4
|
+
exports.invariantIntlContext = invariantIntlContext;
|
|
5
|
+
exports.assignUniqueKeysToParts = assignUniqueKeysToParts;
|
|
6
|
+
exports.shallowEqual = shallowEqual;
|
|
4
7
|
var tslib_1 = require("tslib");
|
|
5
8
|
var React = tslib_1.__importStar(require("react"));
|
|
6
9
|
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
@@ -9,7 +12,6 @@ function invariantIntlContext(intl) {
|
|
|
9
12
|
(0, ecma402_abstract_1.invariant)(intl, '[React Intl] Could not find required `intl` object. ' +
|
|
10
13
|
'<IntlProvider> needs to exist in the component ancestry.');
|
|
11
14
|
}
|
|
12
|
-
exports.invariantIntlContext = invariantIntlContext;
|
|
13
15
|
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|
|
14
16
|
/**
|
|
15
17
|
* Takes a `formatXMLElementFn`, and composes it in function, which passes
|
|
@@ -23,7 +25,6 @@ function assignUniqueKeysToParts(formatXMLElementFn) {
|
|
|
23
25
|
return formatXMLElementFn(React.Children.toArray(parts));
|
|
24
26
|
};
|
|
25
27
|
}
|
|
26
|
-
exports.assignUniqueKeysToParts = assignUniqueKeysToParts;
|
|
27
28
|
function shallowEqual(objA, objB) {
|
|
28
29
|
if (objA === objB) {
|
|
29
30
|
return true;
|
|
@@ -46,4 +47,3 @@ function shallowEqual(objA, objB) {
|
|
|
46
47
|
}
|
|
47
48
|
return true;
|
|
48
49
|
}
|
|
49
|
-
exports.shallowEqual = shallowEqual;
|