react-intl
Advanced tools
Comparing version 6.5.3 to 6.5.4
@@ -1,50 +0,25 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FormattedListParts = exports.FormattedNumberParts = exports.FormattedTimeParts = exports.FormattedDateParts = exports.FormattedDisplayName = exports.FormattedList = exports.FormattedNumber = exports.FormattedTime = exports.FormattedDate = exports.defineMessage = exports.defineMessages = exports.ReactIntlError = exports.ReactIntlErrorCode = exports.MissingTranslationError = exports.MessageFormatError = exports.MissingDataError = exports.InvalidConfigError = exports.UnsupportedFormatterError = exports.createIntlCache = exports.useIntl = exports.injectIntl = exports.createIntl = exports.RawIntlProvider = exports.IntlProvider = exports.IntlContext = exports.FormattedRelativeTime = exports.FormattedPlural = exports.FormattedMessage = exports.FormattedDateTimeRange = void 0; | ||
var tslib_1 = require("tslib"); | ||
var createFormattedComponent_1 = require("./src/components/createFormattedComponent"); | ||
var injectIntl_1 = tslib_1.__importStar(require("./src/components/injectIntl")); | ||
exports.injectIntl = injectIntl_1.default; | ||
Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } }); | ||
Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } }); | ||
var useIntl_1 = tslib_1.__importDefault(require("./src/components/useIntl")); | ||
exports.useIntl = useIntl_1.default; | ||
var provider_1 = tslib_1.__importStar(require("./src/components/provider")); | ||
exports.IntlProvider = provider_1.default; | ||
Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return provider_1.createIntl; } }); | ||
var relative_1 = tslib_1.__importDefault(require("./src/components/relative")); | ||
exports.FormattedRelativeTime = relative_1.default; | ||
var plural_1 = tslib_1.__importDefault(require("./src/components/plural")); | ||
exports.FormattedPlural = plural_1.default; | ||
var message_1 = tslib_1.__importDefault(require("./src/components/message")); | ||
exports.FormattedMessage = message_1.default; | ||
var dateTimeRange_1 = tslib_1.__importDefault(require("./src/components/dateTimeRange")); | ||
exports.FormattedDateTimeRange = dateTimeRange_1.default; | ||
var intl_1 = require("@formatjs/intl"); | ||
Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } }); | ||
Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } }); | ||
Object.defineProperty(exports, "InvalidConfigError", { enumerable: true, get: function () { return intl_1.InvalidConfigError; } }); | ||
Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } }); | ||
Object.defineProperty(exports, "MessageFormatError", { enumerable: true, get: function () { return intl_1.MessageFormatError; } }); | ||
Object.defineProperty(exports, "MissingTranslationError", { enumerable: true, get: function () { return intl_1.MissingTranslationError; } }); | ||
Object.defineProperty(exports, "ReactIntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } }); | ||
Object.defineProperty(exports, "ReactIntlError", { enumerable: true, get: function () { return intl_1.IntlError; } }); | ||
function defineMessages(msgs) { | ||
import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent'; | ||
import injectIntl, { Provider as RawIntlProvider, Context as IntlContext, } from './src/components/injectIntl'; | ||
import useIntl from './src/components/useIntl'; | ||
import IntlProvider, { createIntl } from './src/components/provider'; | ||
import FormattedRelativeTime from './src/components/relative'; | ||
import FormattedPlural from './src/components/plural'; | ||
import FormattedMessage from './src/components/message'; | ||
import FormattedDateTimeRange from './src/components/dateTimeRange'; | ||
export { FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, IntlContext, IntlProvider, RawIntlProvider, createIntl, injectIntl, useIntl, }; | ||
export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode as ReactIntlErrorCode, IntlError as ReactIntlError, } from '@formatjs/intl'; | ||
export function defineMessages(msgs) { | ||
return msgs; | ||
} | ||
exports.defineMessages = defineMessages; | ||
function defineMessage(msg) { | ||
export function defineMessage(msg) { | ||
return msg; | ||
} | ||
exports.defineMessage = defineMessage; | ||
// IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig` | ||
exports.FormattedDate = (0, createFormattedComponent_1.createFormattedComponent)('formatDate'); | ||
exports.FormattedTime = (0, createFormattedComponent_1.createFormattedComponent)('formatTime'); | ||
exports.FormattedNumber = (0, createFormattedComponent_1.createFormattedComponent)('formatNumber'); | ||
exports.FormattedList = (0, createFormattedComponent_1.createFormattedComponent)('formatList'); | ||
exports.FormattedDisplayName = (0, createFormattedComponent_1.createFormattedComponent)('formatDisplayName'); | ||
exports.FormattedDateParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatDate'); | ||
exports.FormattedTimeParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatTime'); | ||
var createFormattedComponent_2 = require("./src/components/createFormattedComponent"); | ||
Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } }); | ||
Object.defineProperty(exports, "FormattedListParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedListParts; } }); | ||
export var FormattedDate = createFormattedComponent('formatDate'); | ||
export var FormattedTime = createFormattedComponent('formatTime'); | ||
export var FormattedNumber = createFormattedComponent('formatNumber'); | ||
export var FormattedList = createFormattedComponent('formatList'); | ||
export var FormattedDisplayName = createFormattedComponent('formatDisplayName'); | ||
export var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate'); | ||
export var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime'); | ||
export { FormattedNumberParts, FormattedListParts, } from './src/components/createFormattedComponent'; |
@@ -1,7 +0,4 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createFormattedComponent = exports.createFormattedDateTimePartsComponent = exports.FormattedListParts = exports.FormattedNumberParts = void 0; | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var useIntl_1 = tslib_1.__importDefault(require("./useIntl")); | ||
import { __rest } from "tslib"; | ||
import * as React from 'react'; | ||
import useIntl from './useIntl'; | ||
var DisplayName; | ||
@@ -24,20 +21,18 @@ (function (DisplayName) { | ||
})(DisplayNameParts || (DisplayNameParts = {})); | ||
var FormattedNumberParts = function (props) { | ||
var intl = (0, useIntl_1.default)(); | ||
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]); | ||
export var FormattedNumberParts = function (props) { | ||
var intl = useIntl(); | ||
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]); | ||
return children(intl.formatNumberToParts(value, formatProps)); | ||
}; | ||
exports.FormattedNumberParts = FormattedNumberParts; | ||
exports.FormattedNumberParts.displayName = 'FormattedNumberParts'; | ||
var FormattedListParts = function (props) { | ||
var intl = (0, useIntl_1.default)(); | ||
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]); | ||
FormattedNumberParts.displayName = 'FormattedNumberParts'; | ||
export var FormattedListParts = function (props) { | ||
var intl = useIntl(); | ||
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]); | ||
return children(intl.formatListToParts(value, formatProps)); | ||
}; | ||
exports.FormattedListParts = FormattedListParts; | ||
exports.FormattedNumberParts.displayName = 'FormattedNumberParts'; | ||
function createFormattedDateTimePartsComponent(name) { | ||
FormattedNumberParts.displayName = 'FormattedNumberParts'; | ||
export function createFormattedDateTimePartsComponent(name) { | ||
var ComponentParts = function (props) { | ||
var intl = (0, useIntl_1.default)(); | ||
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props, ["value", "children"]); | ||
var intl = useIntl(); | ||
var value = props.value, children = props.children, formatProps = __rest(props, ["value", "children"]); | ||
var date = typeof value === 'string' ? new Date(value || 0) : value; | ||
@@ -52,7 +47,6 @@ var formattedParts = name === 'formatDate' | ||
} | ||
exports.createFormattedDateTimePartsComponent = createFormattedDateTimePartsComponent; | ||
function createFormattedComponent(name) { | ||
export function createFormattedComponent(name) { | ||
var Component = function (props) { | ||
var intl = (0, useIntl_1.default)(); | ||
var value = props.value, children = props.children, formatProps = tslib_1.__rest(props | ||
var intl = useIntl(); | ||
var value = props.value, children = props.children, formatProps = __rest(props | ||
// TODO: fix TS type definition for localeMatcher upstream | ||
@@ -71,2 +65,1 @@ , ["value", "children"]); | ||
} | ||
exports.createFormattedComponent = createFormattedComponent; |
@@ -1,9 +0,7 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var useIntl_1 = tslib_1.__importDefault(require("./useIntl")); | ||
import { __rest } from "tslib"; | ||
import * as React from 'react'; | ||
import useIntl from './useIntl'; | ||
var FormattedDateTimeRange = function (props) { | ||
var intl = (0, useIntl_1.default)(); | ||
var from = props.from, to = props.to, children = props.children, formatProps = tslib_1.__rest(props, ["from", "to", "children"]); | ||
var intl = useIntl(); | ||
var from = props.from, to = props.to, children = props.children, formatProps = __rest(props, ["from", "to", "children"]); | ||
var formattedValue = intl.formatDateTimeRange(from, to, formatProps); | ||
@@ -17,2 +15,2 @@ if (typeof children === 'function') { | ||
FormattedDateTimeRange.displayName = 'FormattedDateTimeRange'; | ||
exports.default = FormattedDateTimeRange; | ||
export default FormattedDateTimeRange; |
@@ -1,8 +0,5 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Context = exports.Provider = void 0; | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var hoist_non_react_statics_1 = tslib_1.__importDefault(require("hoist-non-react-statics")); | ||
var utils_1 = require("../utils"); | ||
import { __assign } from "tslib"; | ||
import * as React from 'react'; | ||
import hoistNonReactStatics from 'hoist-non-react-statics'; | ||
import { invariantIntlContext } from '../utils'; | ||
function getDisplayName(Component) { | ||
@@ -18,5 +15,5 @@ return Component.displayName || Component.name || 'Component'; | ||
var IntlConsumer = IntlContext.Consumer, IntlProvider = IntlContext.Provider; | ||
exports.Provider = IntlProvider; | ||
exports.Context = IntlContext; | ||
function injectIntl(WrappedComponent, options) { | ||
export var Provider = IntlProvider; | ||
export var Context = IntlContext; | ||
export default function injectIntl(WrappedComponent, options) { | ||
var _a = options || {}, _b = _a.intlPropName, intlPropName = _b === void 0 ? 'intl' : _b, _c = _a.forwardRef, forwardRef = _c === void 0 ? false : _c, _d = _a.enforceContext, enforceContext = _d === void 0 ? true : _d; | ||
@@ -26,6 +23,6 @@ var WithIntl = function (props) { return (React.createElement(IntlConsumer, null, function (intl) { | ||
if (enforceContext) { | ||
(0, utils_1.invariantIntlContext)(intl); | ||
invariantIntlContext(intl); | ||
} | ||
var intlProp = (_a = {}, _a[intlPropName] = intl, _a); | ||
return (React.createElement(WrappedComponent, tslib_1.__assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null }))); | ||
return (React.createElement(WrappedComponent, __assign({}, props, intlProp, { ref: forwardRef ? props.forwardedRef : null }))); | ||
})); }; | ||
@@ -35,6 +32,5 @@ WithIntl.displayName = "injectIntl(".concat(getDisplayName(WrappedComponent), ")"); | ||
if (forwardRef) { | ||
return (0, hoist_non_react_statics_1.default)(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, tslib_1.__assign({}, props, { forwardedRef: ref }))); }), WrappedComponent); | ||
return hoistNonReactStatics(React.forwardRef(function (props, ref) { return (React.createElement(WithIntl, __assign({}, props, { forwardedRef: ref }))); }), WrappedComponent); | ||
} | ||
return (0, hoist_non_react_statics_1.default)(WithIntl, WrappedComponent); | ||
return hoistNonReactStatics(WithIntl, WrappedComponent); | ||
} | ||
exports.default = injectIntl; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/* | ||
@@ -7,15 +6,14 @@ * Copyright 2015, Yahoo Inc. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var useIntl_1 = tslib_1.__importDefault(require("./useIntl")); | ||
var utils_1 = require("../utils"); | ||
import { __rest } from "tslib"; | ||
import * as React from 'react'; | ||
import useIntl from './useIntl'; | ||
import { shallowEqual } from '../utils'; | ||
function areEqual(prevProps, nextProps) { | ||
var values = prevProps.values, otherProps = tslib_1.__rest(prevProps, ["values"]); | ||
var nextValues = nextProps.values, nextOtherProps = tslib_1.__rest(nextProps, ["values"]); | ||
return ((0, utils_1.shallowEqual)(nextValues, values) && | ||
(0, utils_1.shallowEqual)(otherProps, nextOtherProps)); | ||
var values = prevProps.values, otherProps = __rest(prevProps, ["values"]); | ||
var nextValues = nextProps.values, nextOtherProps = __rest(nextProps, ["values"]); | ||
return (shallowEqual(nextValues, values) && | ||
shallowEqual(otherProps, nextOtherProps)); | ||
} | ||
function FormattedMessage(props) { | ||
var intl = (0, useIntl_1.default)(); | ||
var intl = useIntl(); | ||
var formatMessage = intl.formatMessage, _a = intl.textComponent, Text = _a === void 0 ? React.Fragment : _a; | ||
@@ -38,2 +36,2 @@ 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; | ||
MemoizedFormattedMessage.displayName = 'MemoizedFormattedMessage'; | ||
exports.default = MemoizedFormattedMessage; | ||
export default MemoizedFormattedMessage; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/* | ||
@@ -7,8 +6,6 @@ * Copyright 2015, Yahoo Inc. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var useIntl_1 = tslib_1.__importDefault(require("./useIntl")); | ||
import * as React from 'react'; | ||
import useIntl from './useIntl'; | ||
var FormattedPlural = function (props) { | ||
var _a = (0, useIntl_1.default)(), formatPlural = _a.formatPlural, Text = _a.textComponent; | ||
var _a = useIntl(), formatPlural = _a.formatPlural, Text = _a.textComponent; | ||
var value = props.value, other = props.other, children = props.children; | ||
@@ -30,2 +27,2 @@ var pluralCategory = formatPlural(value, props); | ||
FormattedPlural.displayName = 'FormattedPlural'; | ||
exports.default = FormattedPlural; | ||
export default FormattedPlural; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
/* | ||
@@ -7,10 +6,8 @@ * Copyright 2015, Yahoo Inc. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createIntl = void 0; | ||
var tslib_1 = require("tslib"); | ||
var intl_1 = require("@formatjs/intl"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var utils_1 = require("../utils"); | ||
var injectIntl_1 = require("./injectIntl"); | ||
var intl_messageformat_1 = require("intl-messageformat"); | ||
import { __assign, __extends, __rest, __spreadArray } from "tslib"; | ||
import { createIntl as coreCreateIntl, formatMessage as coreFormatMessage, createIntlCache, } from '@formatjs/intl'; | ||
import * as React from 'react'; | ||
import { DEFAULT_INTL_CONFIG, assignUniqueKeysToParts, invariantIntlContext, shallowEqual, } from '../utils'; | ||
import { Provider } from './injectIntl'; | ||
import { isFormatXMLElementFn, } from 'intl-messageformat'; | ||
function processIntlConfig(config) { | ||
@@ -38,4 +35,4 @@ return { | ||
var v = values[k]; | ||
acc[k] = (0, intl_messageformat_1.isFormatXMLElementFn)(v) | ||
? (0, utils_1.assignUniqueKeysToParts)(v) | ||
acc[k] = isFormatXMLElementFn(v) | ||
? assignUniqueKeysToParts(v) | ||
: v; | ||
@@ -51,3 +48,3 @@ return acc; | ||
var values = assignUniqueKeysToFormatXMLElementFnArgument(rawValues); | ||
var chunks = intl_1.formatMessage.apply(void 0, tslib_1.__spreadArray([config, | ||
var chunks = coreFormatMessage.apply(void 0, __spreadArray([config, | ||
formatters, | ||
@@ -66,6 +63,6 @@ descriptor, | ||
*/ | ||
var createIntl = function (_a, cache) { | ||
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = tslib_1.__rest(_a, ["defaultRichTextElements"]); | ||
export var createIntl = function (_a, cache) { | ||
var rawDefaultRichTextElements = _a.defaultRichTextElements, config = __rest(_a, ["defaultRichTextElements"]); | ||
var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements); | ||
var coreIntl = (0, intl_1.createIntl)(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache); | ||
var coreIntl = coreCreateIntl(__assign(__assign(__assign({}, DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache); | ||
var resolvedConfig = { | ||
@@ -82,3 +79,3 @@ locale: coreIntl.locale, | ||
}; | ||
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig, | ||
return __assign(__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig, | ||
// @ts-expect-error fix this | ||
@@ -89,11 +86,10 @@ coreIntl.formatters), | ||
}; | ||
exports.createIntl = createIntl; | ||
var IntlProvider = /** @class */ (function (_super) { | ||
tslib_1.__extends(IntlProvider, _super); | ||
__extends(IntlProvider, _super); | ||
function IntlProvider() { | ||
var _this = _super !== null && _super.apply(this, arguments) || this; | ||
_this.cache = (0, intl_1.createIntlCache)(); | ||
_this.cache = createIntlCache(); | ||
_this.state = { | ||
cache: _this.cache, | ||
intl: (0, exports.createIntl)(processIntlConfig(_this.props), _this.cache), | ||
intl: createIntl(processIntlConfig(_this.props), _this.cache), | ||
prevConfig: processIntlConfig(_this.props), | ||
@@ -106,5 +102,5 @@ }; | ||
var config = processIntlConfig(props); | ||
if (!(0, utils_1.shallowEqual)(prevConfig, config)) { | ||
if (!shallowEqual(prevConfig, config)) { | ||
return { | ||
intl: (0, exports.createIntl)(config, cache), | ||
intl: createIntl(config, cache), | ||
prevConfig: config, | ||
@@ -116,9 +112,9 @@ }; | ||
IntlProvider.prototype.render = function () { | ||
(0, utils_1.invariantIntlContext)(this.state.intl); | ||
return React.createElement(injectIntl_1.Provider, { value: this.state.intl }, this.props.children); | ||
invariantIntlContext(this.state.intl); | ||
return React.createElement(Provider, { value: this.state.intl }, this.props.children); | ||
}; | ||
IntlProvider.displayName = 'IntlProvider'; | ||
IntlProvider.defaultProps = utils_1.DEFAULT_INTL_CONFIG; | ||
IntlProvider.defaultProps = DEFAULT_INTL_CONFIG; | ||
return IntlProvider; | ||
}(React.PureComponent)); | ||
exports.default = IntlProvider; | ||
export default IntlProvider; |
@@ -1,4 +0,2 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
import { __assign, __rest } from "tslib"; | ||
/* | ||
@@ -9,5 +7,5 @@ * Copyright 2015, Yahoo Inc. | ||
*/ | ||
var React = tslib_1.__importStar(require("react")); | ||
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract"); | ||
var useIntl_1 = tslib_1.__importDefault(require("./useIntl")); | ||
import * as React from 'react'; | ||
import { invariant, } from '@formatjs/ecma402-abstract'; | ||
import useIntl from './useIntl'; | ||
var MINUTE = 60; | ||
@@ -64,4 +62,4 @@ var HOUR = 60 * 60; | ||
var SimpleFormattedRelativeTime = function (props) { | ||
var _a = (0, useIntl_1.default)(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent; | ||
var children = props.children, value = props.value, unit = props.unit, otherProps = tslib_1.__rest(props, ["children", "value", "unit"]); | ||
var _a = useIntl(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent; | ||
var children = props.children, value = props.value, unit = props.unit, otherProps = __rest(props, ["children", "value", "unit"]); | ||
var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps); | ||
@@ -77,4 +75,4 @@ if (typeof children === 'function') { | ||
var FormattedRelativeTime = function (_a) { | ||
var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = tslib_1.__rest(_a, ["value", "unit", "updateIntervalInSeconds"]); | ||
(0, ecma402_abstract_1.invariant)(!updateIntervalInSeconds || | ||
var value = _a.value, unit = _a.unit, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = __rest(_a, ["value", "unit", "updateIntervalInSeconds"]); | ||
invariant(!updateIntervalInSeconds || | ||
!!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour'); | ||
@@ -127,3 +125,3 @@ var _b = React.useState(), prevUnit = _b[0], setPrevUnit = _b[1]; | ||
} | ||
return (React.createElement(SimpleFormattedRelativeTime, tslib_1.__assign({ value: currentValue, unit: currentUnit }, otherProps))); | ||
return (React.createElement(SimpleFormattedRelativeTime, __assign({ value: currentValue, unit: currentUnit }, otherProps))); | ||
}; | ||
@@ -135,2 +133,2 @@ FormattedRelativeTime.displayName = 'FormattedRelativeTime'; | ||
}; | ||
exports.default = FormattedRelativeTime; | ||
export default FormattedRelativeTime; |
@@ -1,12 +0,8 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var injectIntl_1 = require("./injectIntl"); | ||
var utils_1 = require("../utils"); | ||
function useIntl() { | ||
var intl = React.useContext(injectIntl_1.Context); | ||
(0, utils_1.invariantIntlContext)(intl); | ||
import * as React from 'react'; | ||
import { Context } from './injectIntl'; | ||
import { invariantIntlContext } from '../utils'; | ||
export default function useIntl() { | ||
var intl = React.useContext(Context); | ||
invariantIntlContext(intl); | ||
return intl; | ||
} | ||
exports.default = useIntl; |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
export {}; |
@@ -1,14 +0,10 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.shallowEqual = exports.assignUniqueKeysToParts = exports.DEFAULT_INTL_CONFIG = exports.invariantIntlContext = void 0; | ||
var tslib_1 = require("tslib"); | ||
var React = tslib_1.__importStar(require("react")); | ||
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract"); | ||
var intl_1 = require("@formatjs/intl"); | ||
function invariantIntlContext(intl) { | ||
(0, ecma402_abstract_1.invariant)(intl, '[React Intl] Could not find required `intl` object. ' + | ||
import { __assign } from "tslib"; | ||
import * as React from 'react'; | ||
import { invariant } from '@formatjs/ecma402-abstract'; | ||
import { DEFAULT_INTL_CONFIG as CORE_DEFAULT_INTL_CONFIG } from '@formatjs/intl'; | ||
export function invariantIntlContext(intl) { | ||
invariant(intl, '[React Intl] Could not find required `intl` object. ' + | ||
'<IntlProvider> needs to exist in the component ancestry.'); | ||
} | ||
exports.invariantIntlContext = invariantIntlContext; | ||
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment }); | ||
export var DEFAULT_INTL_CONFIG = __assign(__assign({}, CORE_DEFAULT_INTL_CONFIG), { textComponent: React.Fragment }); | ||
/** | ||
@@ -20,3 +16,3 @@ * Takes a `formatXMLElementFn`, and composes it in function, which passes | ||
*/ | ||
function assignUniqueKeysToParts(formatXMLElementFn) { | ||
export function assignUniqueKeysToParts(formatXMLElementFn) { | ||
return function (parts) { | ||
@@ -27,4 +23,3 @@ // eslint-disable-next-line prefer-rest-params | ||
} | ||
exports.assignUniqueKeysToParts = assignUniqueKeysToParts; | ||
function shallowEqual(objA, objB) { | ||
export function shallowEqual(objA, objB) { | ||
if (objA === objB) { | ||
@@ -51,2 +46,1 @@ return true; | ||
} | ||
exports.shallowEqual = shallowEqual; |
{ | ||
"name": "react-intl", | ||
"version": "6.5.3", | ||
"version": "6.5.4", | ||
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.", | ||
@@ -136,7 +136,7 @@ "keywords": [ | ||
"@formatjs/intl-displaynames": "6.6.3", | ||
"@formatjs/intl": "2.9.8", | ||
"@formatjs/icu-messageformat-parser": "2.7.2", | ||
"@formatjs/ecma402-abstract": "1.17.4", | ||
"@formatjs/intl": "2.9.7", | ||
"@formatjs/icu-messageformat-parser": "2.7.2", | ||
"@formatjs/intl-listformat": "7.5.2", | ||
"intl-messageformat": "10.5.6" | ||
"intl-messageformat": "10.5.7" | ||
}, | ||
@@ -143,0 +143,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
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
10
3
23
239753
6329
+ Added@formatjs/intl@2.9.8(transitive)
+ Addedintl-messageformat@10.5.7(transitive)
- Removed@formatjs/intl@2.9.7(transitive)
- Removedintl-messageformat@10.5.6(transitive)
Updated@formatjs/intl@2.9.8
Updatedintl-messageformat@10.5.7