react-intl 5.20.11 → 5.21.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.
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createFormattedComponent = exports.createFormattedDateTimePartsComponent = exports.FormattedListParts = exports.FormattedNumberParts = void 0;
4
4
  var tslib_1 = require("tslib");
5
- var React = tslib_1.__importStar(require("react"));
6
- var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
5
+ var React = (0, tslib_1.__importStar)(require("react"));
6
+ var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
7
7
  var DisplayName;
8
8
  (function (DisplayName) {
9
9
  DisplayName["formatDate"] = "FormattedDate";
@@ -22,23 +22,23 @@ var DisplayNameParts;
22
22
  DisplayNameParts["formatList"] = "FormattedListParts";
23
23
  })(DisplayNameParts || (DisplayNameParts = {}));
24
24
  var FormattedNumberParts = function (props) {
25
- var intl = useIntl_1.default();
26
- var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
25
+ var intl = (0, useIntl_1.default)();
26
+ var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["value", "children"]);
27
27
  return children(intl.formatNumberToParts(value, formatProps));
28
28
  };
29
29
  exports.FormattedNumberParts = FormattedNumberParts;
30
30
  exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
31
31
  var FormattedListParts = function (props) {
32
- var intl = useIntl_1.default();
33
- var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
32
+ var intl = (0, useIntl_1.default)();
33
+ var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["value", "children"]);
34
34
  return children(intl.formatListToParts(value, formatProps));
35
35
  };
36
36
  exports.FormattedListParts = FormattedListParts;
37
37
  exports.FormattedNumberParts.displayName = 'FormattedNumberParts';
38
38
  function createFormattedDateTimePartsComponent(name) {
39
39
  var ComponentParts = function (props) {
40
- var intl = useIntl_1.default();
41
- var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]);
40
+ var intl = (0, useIntl_1.default)();
41
+ var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["value", "children"]);
42
42
  var date = typeof value === 'string' ? new Date(value || 0) : value;
43
43
  var formattedParts = name === 'formatDate'
44
44
  ? intl.formatDateToParts(date, formatProps)
@@ -51,8 +51,8 @@ function createFormattedDateTimePartsComponent(name) {
51
51
  exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent;
52
52
  function createFormattedComponent(name) {
53
53
  var Component = function (props) {
54
- var intl = useIntl_1.default();
55
- var value = props.value, children = props.children, formatProps = tslib_1.__rest(props
54
+ var intl = (0, useIntl_1.default)();
55
+ var value = props.value, children = props.children, formatProps = (0, tslib_1.__rest)(props
56
56
  // TODO: fix TS type definition for localeMatcher upstream
57
57
  , ["value", "children"]);
58
58
  // TODO: fix TS type definition for localeMatcher upstream
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var React = tslib_1.__importStar(require("react"));
5
- var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
4
+ var React = (0, tslib_1.__importStar)(require("react"));
5
+ var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
6
6
  var FormattedDateTimeRange = function (props) {
7
- var intl = useIntl_1.default();
8
- var from = props.from, to = props.to, children = props.children, formatProps = tslib_1.__rest(props, ["from", "to", "children"]);
7
+ var intl = (0, useIntl_1.default)();
8
+ var from = props.from, to = props.to, children = props.children, formatProps = (0, tslib_1.__rest)(props, ["from", "to", "children"]);
9
9
  var formattedValue = intl.formatDateTimeRange(from, to, formatProps);
10
10
  if (typeof children === 'function') {
11
11
  return children(formattedValue);
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Context = exports.Provider = void 0;
4
4
  var tslib_1 = require("tslib");
5
- var React = tslib_1.__importStar(require("react"));
6
- var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics"));
5
+ var React = (0, tslib_1.__importStar)(require("react"));
6
+ var hoist_non_react_statics_1 = (0, tslib_1.__importDefault)(require("hoist-non-react-statics"));
7
7
  var utils_1 = require("../utils");
8
8
  function getDisplayName(Component) {
9
9
  return Component.displayName || Component.name || 'Component';
@@ -18,16 +18,16 @@ function injectIntl(WrappedComponent, options) {
18
18
  var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) {
19
19
  var _a;
20
20
  if (enforceContext) {
21
- utils_1.invariantIntlContext(intl);
21
+ (0, utils_1.invariantIntlContext)(intl);
22
22
  }
23
23
  var intlProp = (_a = {}, _a[intlPropName] = intl, _a);
24
- return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
24
+ return (React.createElement(WrappedComponent, (0, tslib_1.__assign)({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null })));
25
25
  })); };
26
26
  WithIntl.displayName = "injectIntl(" + getDisplayName(WrappedComponent) + ")";
27
27
  WithIntl.WrappedComponent = WrappedComponent;
28
28
  if (forwardRef) {
29
- return hoist_non_react_statics_1.default(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, tslib_1.__assign({}, props, { forwardedRef: ref }))); }), WrappedComponent);
29
+ return (0, hoist_non_react_statics_1.default)(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, (0, tslib_1.__assign)({}, props, { forwardedRef: ref }))); }), WrappedComponent);
30
30
  }
31
- return hoist_non_react_statics_1.default(WithIntl, WrappedComponent);
31
+ return (0, hoist_non_react_statics_1.default)(WithIntl, WrappedComponent);
32
32
  }
33
33
  exports.default = injectIntl;
@@ -6,17 +6,17 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  var tslib_1 = require("tslib");
9
- var React = tslib_1.__importStar(require("react"));
10
- var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
9
+ var React = (0, tslib_1.__importStar)(require("react"));
10
+ var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
11
11
  var utils_1 = require("../utils");
12
12
  function areEqual(prevProps, nextProps) {
13
- var values = prevProps.values, otherProps = tslib_1.__rest(prevProps, ["values"]);
14
- var nextValues = nextProps.values, nextOtherProps = tslib_1.__rest(nextProps, ["values"]);
15
- return (utils_1.shallowEqual(nextValues, values) &&
16
- utils_1.shallowEqual(otherProps, nextOtherProps));
13
+ var values = prevProps.values, otherProps = (0, tslib_1.__rest)(prevProps, ["values"]);
14
+ var nextValues = nextProps.values, nextOtherProps = (0, tslib_1.__rest)(nextProps, ["values"]);
15
+ return ((0, utils_1.shallowEqual)(nextValues, values) &&
16
+ (0, utils_1.shallowEqual)(otherProps, nextOtherProps));
17
17
  }
18
18
  function FormattedMessage(props) {
19
- var intl = useIntl_1.default();
19
+ var intl = (0, useIntl_1.default)();
20
20
  var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a;
21
21
  var id = props.id, description = props.description, defaultMessage = props.defaultMessage, values = props.values, children = props.children, _b = props.tagName, Component = _b === void 0 ? Text : _b, ignoreTag = props.ignoreTag;
22
22
  var descriptor = { id: id, description: description, defaultMessage: defaultMessage };
@@ -6,10 +6,10 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  var tslib_1 = require("tslib");
9
- var React = tslib_1.__importStar(require("react"));
10
- var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
9
+ var React = (0, tslib_1.__importStar)(require("react"));
10
+ var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
11
11
  var FormattedPlural = function (props) {
12
- var _a = useIntl_1.default(), formatPlural = _a.formatPlural, Text = _a.textComponent;
12
+ var _a = (0, useIntl_1.default)(), formatPlural = _a.formatPlural, Text = _a.textComponent;
13
13
  var value = props.value, other = props.other, children = props.children;
14
14
  var pluralCategory = formatPlural(value, props);
15
15
  var formattedPlural = props[pluralCategory] || other;
@@ -25,7 +25,7 @@ interface State {
25
25
  export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
26
26
  export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
27
27
  static displayName: string;
28
- static defaultProps: Pick<import("../types").ResolvedIntlConfig, "timeZone" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "onError" | "textComponent">;
28
+ static defaultProps: Pick<import("../types").ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
29
29
  private cache;
30
30
  state: State;
31
31
  static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAiED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CA8BzE,CAAA;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAa,CAG3D,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EACnC,KAAK,CACN;IACC,MAAM,CAAC,WAAW,SAAiB;IACnC,MAAM,CAAC,YAAY,sJAAsB;IACzC,OAAO,CAAC,KAAK,CAA+B;IAC5C,KAAK,EAAE,KAAK,CAIX;IAED,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,KAAK,GACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAWxB,MAAM,IAAI,GAAG,CAAC,OAAO;CAItB"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAkED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CAAC,KAAK,CAAC,SAAS,EAAE,UAAU,EAAE,SAAS,CA8BzE,CAAA;AAEH,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAa,CAG3D,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EACnC,KAAK,CACN;IACC,MAAM,CAAC,WAAW,SAAiB;IACnC,MAAM,CAAC,YAAY,gLAAsB;IACzC,OAAO,CAAC,KAAK,CAA+B;IAC5C,KAAK,EAAE,KAAK,CAIX;IAED,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,KAAK,GACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAWxB,MAAM,IAAI,GAAG,CAAC,OAAO;CAItB"}
@@ -7,7 +7,7 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.createIntl = void 0;
9
9
  var tslib_1 = require("tslib");
10
- var React = tslib_1.__importStar(require("react"));
10
+ var React = (0, tslib_1.__importStar)(require("react"));
11
11
  var injectIntl_1 = require("./injectIntl");
12
12
  var utils_1 = require("../utils");
13
13
  var intl_1 = require("@formatjs/intl");
@@ -16,6 +16,7 @@ function processIntlConfig(config) {
16
16
  return {
17
17
  locale: config.locale,
18
18
  timeZone: config.timeZone,
19
+ fallbackOnEmptyString: config.fallbackOnEmptyString,
19
20
  formats: config.formats,
20
21
  textComponent: config.textComponent,
21
22
  messages: config.messages,
@@ -32,8 +33,8 @@ function assignUniqueKeysToFormatXMLElementFnArgument(values) {
32
33
  }
33
34
  return Object.keys(values).reduce(function (acc, k) {
34
35
  var v = values[k];
35
- acc[k] = intl_messageformat_1.isFormatXMLElementFn(v)
36
- ? utils_1.assignUniqueKeysToParts(v)
36
+ acc[k] = (0, intl_messageformat_1.isFormatXMLElementFn)(v)
37
+ ? (0, utils_1.assignUniqueKeysToParts)(v)
37
38
  : v;
38
39
  return acc;
39
40
  }, {});
@@ -44,10 +45,10 @@ var formatMessage = function (config, formatters, descriptor, rawValues) {
44
45
  rest[_i - 4] = arguments[_i];
45
46
  }
46
47
  var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues);
47
- var chunks = intl_1.formatMessage.apply(void 0, tslib_1.__spreadArray([config,
48
+ var chunks = intl_1.formatMessage.apply(void 0, (0, tslib_1.__spreadArray)([config,
48
49
  formatters,
49
50
  descriptor,
50
- values], rest));
51
+ values], rest, false));
51
52
  if (Array.isArray(chunks)) {
52
53
  return React.Children.toArray(chunks);
53
54
  }
@@ -59,10 +60,10 @@ var formatMessage = function (config, formatters, descriptor, rawValues) {
59
60
  * @param cache cache for formatter instances to prevent memory leak
60
61
  */
61
62
  var createIntl = function (_a, cache) {
62
- var rawDefaultRichTextElements = _a.defaultRichTextElements, config = tslib_1.__rest(_a, ["defaultRichTextElements"]);
63
+ var rawDefaultRichTextElements = _a.defaultRichTextElements, config = (0, tslib_1.__rest)(_a, ["defaultRichTextElements"]);
63
64
  var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
64
- var coreIntl = intl_1.createIntl(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
65
- return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, {
65
+ var coreIntl = (0, intl_1.createIntl)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
66
+ return (0, tslib_1.__assign)((0, tslib_1.__assign)({}, coreIntl), { formatMessage: formatMessage.bind(null, {
66
67
  locale: coreIntl.locale,
67
68
  timeZone: coreIntl.timeZone,
68
69
  formats: coreIntl.formats,
@@ -75,13 +76,13 @@ var createIntl = function (_a, cache) {
75
76
  };
76
77
  exports.createIntl = createIntl;
77
78
  var IntlProvider = /** @class */ (function (_super) {
78
- tslib_1.__extends(IntlProvider, _super);
79
+ (0, tslib_1.__extends)(IntlProvider, _super);
79
80
  function IntlProvider() {
80
81
  var _this = _super !== null && _super.apply(this, arguments) || this;
81
- _this.cache = intl_1.createIntlCache();
82
+ _this.cache = (0, intl_1.createIntlCache)();
82
83
  _this.state = {
83
84
  cache: _this.cache,
84
- intl: exports.createIntl(processIntlConfig(_this.props), _this.cache),
85
+ intl: (0, exports.createIntl)(processIntlConfig(_this.props), _this.cache),
85
86
  prevConfig: processIntlConfig(_this.props),
86
87
  };
87
88
  return _this;
@@ -89,16 +90,16 @@ var IntlProvider = /** @class */ (function (_super) {
89
90
  IntlProvider.getDerivedStateFromProps = function (props, _a) {
90
91
  var prevConfig = _a.prevConfig, cache = _a.cache;
91
92
  var config = processIntlConfig(props);
92
- if (!utils_1.shallowEqual(prevConfig, config)) {
93
+ if (!(0, utils_1.shallowEqual)(prevConfig, config)) {
93
94
  return {
94
- intl: exports.createIntl(config, cache),
95
+ intl: (0, exports.createIntl)(config, cache),
95
96
  prevConfig: config,
96
97
  };
97
98
  }
98
99
  return null;
99
100
  };
100
101
  IntlProvider.prototype.render = function () {
101
- utils_1.invariantIntlContext(this.state.intl);
102
+ (0, utils_1.invariantIntlContext)(this.state.intl);
102
103
  return React.createElement(injectIntl_1.Provider, { value: this.state.intl }, this.props.children);
103
104
  };
104
105
  IntlProvider.displayName = 'IntlProvider';
@@ -6,9 +6,9 @@ var tslib_1 = require("tslib");
6
6
  * Copyrights licensed under the New BSD License.
7
7
  * See the accompanying LICENSE file for terms.
8
8
  */
9
- var React = tslib_1.__importStar(require("react"));
9
+ var React = (0, tslib_1.__importStar)(require("react"));
10
10
  var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
11
- var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
11
+ var useIntl_1 = (0, tslib_1.__importDefault)(require("./useIntl"));
12
12
  var MINUTE = 60;
13
13
  var HOUR = 60 * 60;
14
14
  var DAY = 60 * 60 * 24;
@@ -57,11 +57,11 @@ var INCREMENTABLE_UNITS = [
57
57
  ];
58
58
  function canIncrement(unit) {
59
59
  if (unit === void 0) { unit = 'second'; }
60
- return INCREMENTABLE_UNITS.includes(unit);
60
+ return INCREMENTABLE_UNITS.indexOf(unit) > -1;
61
61
  }
62
62
  var SimpleFormattedRelativeTime = function (props) {
63
- var _a = useIntl_1.default(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
64
- var children = props.children, value = props.value, unit = props.unit, otherProps = tslib_1.__rest(props, ["children", "value", "unit"]);
63
+ var _a = (0, useIntl_1.default)(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
64
+ var children = props.children, value = props.value, unit = props.unit, otherProps = (0, tslib_1.__rest)(props, ["children", "value", "unit"]);
65
65
  var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);
66
66
  if (typeof children === 'function') {
67
67
  return children(formattedRelativeTime);
@@ -72,8 +72,8 @@ var SimpleFormattedRelativeTime = function (props) {
72
72
  return React.createElement(React.Fragment, null, formattedRelativeTime);
73
73
  };
74
74
  var FormattedRelativeTime = function (_a) {
75
- var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = tslib_1.__rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
76
- ecma402_abstract_1.invariant(!updateIntervalInSeconds ||
75
+ var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = (0, tslib_1.__rest)(_a, ["value", "unit", "updateIntervalInSeconds"]);
76
+ (0, ecma402_abstract_1.invariant)(!updateIntervalInSeconds ||
77
77
  !!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');
78
78
  var _b = React.useState(), prevUnit = _b[0], setPrevUnit = _b[1];
79
79
  var _c = React.useState(0), prevValue = _c[0], setPrevValue = _c[1];
@@ -121,7 +121,7 @@ var FormattedRelativeTime = function (_a) {
121
121
  var unitDuration = getDurationInSeconds(currentUnit);
122
122
  currentValue = Math.round(currentValueInSeconds / unitDuration);
123
123
  }
124
- return (React.createElement(SimpleFormattedRelativeTime, tslib_1.__assign({ value: currentValue, unit: currentUnit }, otherProps)));
124
+ return (React.createElement(SimpleFormattedRelativeTime, (0, tslib_1.__assign)({ value: currentValue, unit: currentUnit }, otherProps)));
125
125
  };
126
126
  FormattedRelativeTime.displayName = 'FormattedRelativeTime';
127
127
  FormattedRelativeTime.defaultProps = {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var tslib_1 = require("tslib");
4
- var React = tslib_1.__importStar(require("react"));
4
+ var React = (0, tslib_1.__importStar)(require("react"));
5
5
  var injectIntl_1 = require("./injectIntl");
6
6
  var utils_1 = require("../utils");
7
7
  function useIntl() {
8
8
  var intl = React.useContext(injectIntl_1.Context);
9
- utils_1.invariantIntlContext(intl);
9
+ (0, utils_1.invariantIntlContext)(intl);
10
10
  return intl;
11
11
  }
12
12
  exports.default = useIntl;
package/src/utils.d.ts CHANGED
@@ -2,7 +2,7 @@ import { ResolvedIntlConfig } from './types';
2
2
  import * as React from 'react';
3
3
  import { FormatXMLElementFn } from 'intl-messageformat';
4
4
  export declare function invariantIntlContext(intl?: any): asserts intl;
5
- export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
5
+ export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
6
6
  /**
7
7
  * Takes a `formatXMLElementFn`, and composes it in function, which passes
8
8
  * argument `parts` through, assigning unique key to each part, to prevent
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/react-intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAA;AAKrD,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAM7D;AAED,eAAO,MAAM,mBAAmB,EAAE,IAAI,CACpC,kBAAkB,EAChB,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,SAAS,CAIZ,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,GACtD,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAKrC;AAED,wBAAgB,YAAY,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,WA6BnB"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../packages/react-intl/src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,SAAS,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAA;AAKrD,wBAAgB,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAM7D;AAED,eAAO,MAAM,mBAAmB,EAAE,IAAI,CACpC,kBAAkB,EAChB,uBAAuB,GACvB,SAAS,GACT,UAAU,GACV,UAAU,GACV,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,SAAS,CAIZ,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,kBAAkB,EAAE,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,GACtD,kBAAkB,CAAC,KAAK,CAAC,SAAS,CAAC,CAKrC;AAED,wBAAgB,YAAY,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3D,IAAI,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,CAAC,WA6BnB"}
package/src/utils.js CHANGED
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.shallowEqual = exports.assignUniqueKeysToParts = exports.DEFAULT_INTL_CONFIG = exports.invariantIntlContext = void 0;
4
4
  var tslib_1 = require("tslib");
5
- var React = tslib_1.__importStar(require("react"));
5
+ var React = (0, tslib_1.__importStar)(require("react"));
6
6
  var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
7
7
  var intl_1 = require("@formatjs/intl");
8
8
  function invariantIntlContext(intl) {
9
- ecma402_abstract_1.invariant(intl, '[React Intl] Could not find required `intl` object. ' +
9
+ (0, ecma402_abstract_1.invariant)(intl, '[React Intl] Could not find required `intl` object. ' +
10
10
  '<IntlProvider> needs to exist in the component ancestry.');
11
11
  }
12
12
  exports.invariantIntlContext = invariantIntlContext;
13
- exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
13
+ exports.DEFAULT_INTL_CONFIG = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
14
14
  /**
15
15
  * Takes a `formatXMLElementFn`, and composes it in function, which passes
16
16
  * argument `parts` through, assigning unique key to each part, to prevent