react-intl 7.0.0 → 7.0.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.d.ts +1 -2
- package/lib/index.d.ts +1 -2
- package/lib/src/components/createIntl.js +2 -6
- package/lib/src/components/dateTimeRange.d.ts +3 -4
- package/lib/src/components/relative.d.ts +1 -2
- package/lib/src/components/relative.js +1 -1
- package/lib/src/utils.d.ts +3 -2
- package/lib/src/utils.js +6 -1
- package/package.json +2 -3
- package/react-intl.iife.js +27 -177
- package/src/components/createIntl.js +2 -6
- package/src/components/dateTimeRange.d.ts +3 -4
- package/src/components/relative.d.ts +1 -2
- package/src/components/relative.js +2 -2
- package/src/utils.d.ts +3 -2
- package/src/utils.js +8 -2
package/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
2
1
|
import { CustomFormatConfig, FormatDateOptions, MessageDescriptor } from '@formatjs/intl';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { createIntl } from './src/components/createIntl';
|
|
@@ -22,7 +21,7 @@ export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & Custom
|
|
|
22
21
|
value: string | number | Date | undefined;
|
|
23
22
|
children?(formattedTime: string): React.ReactElement | null;
|
|
24
23
|
}>;
|
|
25
|
-
export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
|
|
24
|
+
export declare const FormattedNumber: React.FC<Omit<Intl.NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
|
|
26
25
|
value: number;
|
|
27
26
|
children?(formattedNumber: string): React.ReactElement | null;
|
|
28
27
|
}>;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
|
|
2
1
|
import { CustomFormatConfig, FormatDateOptions, MessageDescriptor } from '@formatjs/intl';
|
|
3
2
|
import * as React from 'react';
|
|
4
3
|
import { createIntl } from './src/components/createIntl';
|
|
@@ -22,7 +21,7 @@ export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & Custom
|
|
|
22
21
|
value: string | number | Date | undefined;
|
|
23
22
|
children?(formattedTime: string): React.ReactElement | null;
|
|
24
23
|
}>;
|
|
25
|
-
export declare const FormattedNumber: React.FC<Omit<NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
|
|
24
|
+
export declare const FormattedNumber: React.FC<Omit<Intl.NumberFormatOptions, 'localeMatcher'> & CustomFormatConfig<'number'> & {
|
|
26
25
|
value: number;
|
|
27
26
|
children?(formattedNumber: string): React.ReactElement | null;
|
|
28
27
|
}>;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { __assign, __rest, __spreadArray } from "tslib";
|
|
7
7
|
import { createIntl as coreCreateIntl, formatMessage as coreFormatMessage, } from '@formatjs/intl';
|
|
8
|
+
import { isFormatXMLElementFn, } from 'intl-messageformat';
|
|
8
9
|
import * as React from 'react';
|
|
9
10
|
import { DEFAULT_INTL_CONFIG, assignUniqueKeysToParts } from '../utils';
|
|
10
|
-
import { isFormatXMLElementFn, } from 'intl-messageformat';
|
|
11
11
|
function assignUniqueKeysToFormatXMLElementFnArgument(values) {
|
|
12
12
|
if (!values) {
|
|
13
13
|
return values;
|
|
@@ -55,9 +55,5 @@ export var createIntl = function (_a, cache) {
|
|
|
55
55
|
onError: coreIntl.onError,
|
|
56
56
|
defaultRichTextElements: defaultRichTextElements,
|
|
57
57
|
};
|
|
58
|
-
return __assign(__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
|
|
59
|
-
// @ts-expect-error fix this
|
|
60
|
-
coreIntl.formatters),
|
|
61
|
-
// @ts-expect-error fix this
|
|
62
|
-
$t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
|
|
58
|
+
return __assign(__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig, coreIntl.formatters), $t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
|
|
63
59
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { FormatDateOptions } from '@formatjs/intl';
|
|
3
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
4
3
|
interface Props extends FormatDateOptions {
|
|
5
|
-
from: Parameters<DateTimeFormat['formatRange']>[0];
|
|
6
|
-
to: Parameters<DateTimeFormat['formatRange']>[1];
|
|
4
|
+
from: Parameters<Intl.DateTimeFormat['formatRange']>[0];
|
|
5
|
+
to: Parameters<Intl.DateTimeFormat['formatRange']>[1];
|
|
7
6
|
children?(value: React.ReactNode): React.ReactElement | null;
|
|
8
7
|
}
|
|
9
8
|
declare const FormattedDateTimeRange: React.FC<Props>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { RelativeTimeFormatSingularUnit } from '@formatjs/ecma402-abstract';
|
|
3
2
|
import { FormatRelativeTimeOptions } from '@formatjs/intl';
|
|
4
3
|
export interface Props extends FormatRelativeTimeOptions {
|
|
5
4
|
value?: number;
|
|
6
|
-
unit?:
|
|
5
|
+
unit?: Intl.RelativeTimeFormatUnit;
|
|
7
6
|
updateIntervalInSeconds?: number;
|
|
8
7
|
children?(value: string): React.ReactElement | null;
|
|
9
8
|
}
|
|
@@ -5,7 +5,7 @@ import { __assign, __rest } from "tslib";
|
|
|
5
5
|
* See the accompanying LICENSE file for terms.
|
|
6
6
|
*/
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { invariant
|
|
8
|
+
import { invariant } from '../utils';
|
|
9
9
|
import useIntl from './useIntl';
|
|
10
10
|
var MINUTE = 60;
|
|
11
11
|
var HOUR = 60 * 60;
|
package/lib/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ResolvedIntlConfig } from './types';
|
|
2
|
-
import * as React from 'react';
|
|
3
1
|
import { FormatXMLElementFn } from 'intl-messageformat';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ResolvedIntlConfig } from './types';
|
|
4
|
+
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
|
|
4
5
|
export declare function invariantIntlContext(intl?: any): asserts intl;
|
|
5
6
|
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
6
7
|
/**
|
package/lib/src/utils.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { __assign } from "tslib";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { invariant } from '@formatjs/ecma402-abstract';
|
|
4
3
|
import { DEFAULT_INTL_CONFIG as CORE_DEFAULT_INTL_CONFIG } from '@formatjs/intl';
|
|
4
|
+
export function invariant(condition, message, Err) {
|
|
5
|
+
if (Err === void 0) { Err = Error; }
|
|
6
|
+
if (!condition) {
|
|
7
|
+
throw new Err(message);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
5
10
|
export function invariantIntlContext(intl) {
|
|
6
11
|
invariant(intl, '[React Intl] Could not find required `intl` object. ' +
|
|
7
12
|
'<IntlProvider> needs to exist in the component ancestry.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intl",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"intl",
|
|
@@ -133,9 +133,8 @@
|
|
|
133
133
|
"hoist-non-react-statics": "3",
|
|
134
134
|
"tslib": "2",
|
|
135
135
|
"intl-messageformat": "10.7.7",
|
|
136
|
-
"@formatjs/intl": "3.0.0",
|
|
137
136
|
"@formatjs/icu-messageformat-parser": "2.9.4",
|
|
138
|
-
"@formatjs/
|
|
137
|
+
"@formatjs/intl": "3.0.1"
|
|
139
138
|
},
|
|
140
139
|
"peerDependencies": {
|
|
141
140
|
"react": "^16.6.0 || 17 || 18",
|
package/react-intl.iife.js
CHANGED
|
@@ -288,7 +288,7 @@ var ReactIntl = (() => {
|
|
|
288
288
|
}
|
|
289
289
|
return TYPE_STATICS[component["$$typeof"]] || REACT_STATICS;
|
|
290
290
|
}
|
|
291
|
-
var
|
|
291
|
+
var defineProperty = Object.defineProperty;
|
|
292
292
|
var getOwnPropertyNames = Object.getOwnPropertyNames;
|
|
293
293
|
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
|
294
294
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
@@ -313,7 +313,7 @@ var ReactIntl = (() => {
|
|
|
313
313
|
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
|
|
314
314
|
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
|
|
315
315
|
try {
|
|
316
|
-
|
|
316
|
+
defineProperty(targetComponent, key, descriptor);
|
|
317
317
|
} catch (e) {
|
|
318
318
|
}
|
|
319
319
|
}
|
|
@@ -368,64 +368,6 @@ var ReactIntl = (() => {
|
|
|
368
368
|
// packages/react-intl/src/utils.ts
|
|
369
369
|
var React = __toESM(window.React);
|
|
370
370
|
|
|
371
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/262.js
|
|
372
|
-
var MINUTES_PER_HOUR = 60;
|
|
373
|
-
var SECONDS_PER_MINUTE = 60;
|
|
374
|
-
var MS_PER_SECOND = 1e3;
|
|
375
|
-
var MS_PER_MINUTE = MS_PER_SECOND * SECONDS_PER_MINUTE;
|
|
376
|
-
var MS_PER_HOUR = MS_PER_MINUTE * MINUTES_PER_HOUR;
|
|
377
|
-
|
|
378
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/IsSanctionedSimpleUnitIdentifier.js
|
|
379
|
-
var SANCTIONED_UNITS = [
|
|
380
|
-
"angle-degree",
|
|
381
|
-
"area-acre",
|
|
382
|
-
"area-hectare",
|
|
383
|
-
"concentr-percent",
|
|
384
|
-
"digital-bit",
|
|
385
|
-
"digital-byte",
|
|
386
|
-
"digital-gigabit",
|
|
387
|
-
"digital-gigabyte",
|
|
388
|
-
"digital-kilobit",
|
|
389
|
-
"digital-kilobyte",
|
|
390
|
-
"digital-megabit",
|
|
391
|
-
"digital-megabyte",
|
|
392
|
-
"digital-petabyte",
|
|
393
|
-
"digital-terabit",
|
|
394
|
-
"digital-terabyte",
|
|
395
|
-
"duration-day",
|
|
396
|
-
"duration-hour",
|
|
397
|
-
"duration-millisecond",
|
|
398
|
-
"duration-minute",
|
|
399
|
-
"duration-month",
|
|
400
|
-
"duration-second",
|
|
401
|
-
"duration-week",
|
|
402
|
-
"duration-year",
|
|
403
|
-
"length-centimeter",
|
|
404
|
-
"length-foot",
|
|
405
|
-
"length-inch",
|
|
406
|
-
"length-kilometer",
|
|
407
|
-
"length-meter",
|
|
408
|
-
"length-mile-scandinavian",
|
|
409
|
-
"length-mile",
|
|
410
|
-
"length-millimeter",
|
|
411
|
-
"length-yard",
|
|
412
|
-
"mass-gram",
|
|
413
|
-
"mass-kilogram",
|
|
414
|
-
"mass-ounce",
|
|
415
|
-
"mass-pound",
|
|
416
|
-
"mass-stone",
|
|
417
|
-
"temperature-celsius",
|
|
418
|
-
"temperature-fahrenheit",
|
|
419
|
-
"volume-fluid-ounce",
|
|
420
|
-
"volume-gallon",
|
|
421
|
-
"volume-liter",
|
|
422
|
-
"volume-milliliter"
|
|
423
|
-
];
|
|
424
|
-
function removeUnitNamespace(unit) {
|
|
425
|
-
return unit.slice(unit.indexOf("-") + 1);
|
|
426
|
-
}
|
|
427
|
-
var SIMPLE_UNITS = SANCTIONED_UNITS.map(removeUnitNamespace);
|
|
428
|
-
|
|
429
371
|
// node_modules/.aspect_rules_js/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
|
|
430
372
|
var extendStatics = function(d, b) {
|
|
431
373
|
extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
|
|
@@ -549,95 +491,6 @@ var ReactIntl = (() => {
|
|
|
549
491
|
monadic: strategyMonadic
|
|
550
492
|
};
|
|
551
493
|
|
|
552
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/utils.js
|
|
553
|
-
function invariant(condition, message, Err) {
|
|
554
|
-
if (Err === void 0) {
|
|
555
|
-
Err = Error;
|
|
556
|
-
}
|
|
557
|
-
if (!condition) {
|
|
558
|
-
throw new Err(message);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
var createMemoizedNumberFormat = memoize(function() {
|
|
562
|
-
var _a2;
|
|
563
|
-
var args = [];
|
|
564
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
565
|
-
args[_i] = arguments[_i];
|
|
566
|
-
}
|
|
567
|
-
return new ((_a2 = Intl.NumberFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
568
|
-
}, {
|
|
569
|
-
strategy: strategies.variadic
|
|
570
|
-
});
|
|
571
|
-
var createMemoizedDateTimeFormat = memoize(function() {
|
|
572
|
-
var _a2;
|
|
573
|
-
var args = [];
|
|
574
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
575
|
-
args[_i] = arguments[_i];
|
|
576
|
-
}
|
|
577
|
-
return new ((_a2 = Intl.DateTimeFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
578
|
-
}, {
|
|
579
|
-
strategy: strategies.variadic
|
|
580
|
-
});
|
|
581
|
-
var createMemoizedPluralRules = memoize(function() {
|
|
582
|
-
var _a2;
|
|
583
|
-
var args = [];
|
|
584
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
585
|
-
args[_i] = arguments[_i];
|
|
586
|
-
}
|
|
587
|
-
return new ((_a2 = Intl.PluralRules).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
588
|
-
}, {
|
|
589
|
-
strategy: strategies.variadic
|
|
590
|
-
});
|
|
591
|
-
var createMemoizedLocale = memoize(function() {
|
|
592
|
-
var _a2;
|
|
593
|
-
var args = [];
|
|
594
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
595
|
-
args[_i] = arguments[_i];
|
|
596
|
-
}
|
|
597
|
-
return new ((_a2 = Intl.Locale).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
598
|
-
}, {
|
|
599
|
-
strategy: strategies.variadic
|
|
600
|
-
});
|
|
601
|
-
var createMemoizedListFormat = memoize(function() {
|
|
602
|
-
var _a2;
|
|
603
|
-
var args = [];
|
|
604
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
605
|
-
args[_i] = arguments[_i];
|
|
606
|
-
}
|
|
607
|
-
return new ((_a2 = Intl.ListFormat).bind.apply(_a2, __spreadArray([void 0], args, false)))();
|
|
608
|
-
}, {
|
|
609
|
-
strategy: strategies.variadic
|
|
610
|
-
});
|
|
611
|
-
|
|
612
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/regex.generated.js
|
|
613
|
-
var S_UNICODE_REGEX = /[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20BF\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC1\uFDFC\uFDFD\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDE8\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEE0-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF73\uDF80-\uDFD8\uDFE0-\uDFEB]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDD78\uDD7A-\uDDCB\uDDCD-\uDE53\uDE60-\uDE6D\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6\uDF00-\uDF92\uDF94-\uDFCA]/;
|
|
614
|
-
|
|
615
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/NumberFormat/format_to_parts.js
|
|
616
|
-
var CARET_S_UNICODE_REGEX = new RegExp("^".concat(S_UNICODE_REGEX.source));
|
|
617
|
-
var S_DOLLAR_UNICODE_REGEX = new RegExp("".concat(S_UNICODE_REGEX.source, "$"));
|
|
618
|
-
|
|
619
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/data.js
|
|
620
|
-
var MissingLocaleDataError = (
|
|
621
|
-
/** @class */
|
|
622
|
-
function(_super) {
|
|
623
|
-
__extends(MissingLocaleDataError2, _super);
|
|
624
|
-
function MissingLocaleDataError2() {
|
|
625
|
-
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
626
|
-
_this.type = "MISSING_LOCALE_DATA";
|
|
627
|
-
return _this;
|
|
628
|
-
}
|
|
629
|
-
return MissingLocaleDataError2;
|
|
630
|
-
}(Error)
|
|
631
|
-
);
|
|
632
|
-
|
|
633
|
-
// node_modules/.aspect_rules_js/@formatjs+ecma402-abstract@0.0.0/node_modules/@formatjs/ecma402-abstract/lib/types/date-time.js
|
|
634
|
-
var RangePatternType;
|
|
635
|
-
(function(RangePatternType2) {
|
|
636
|
-
RangePatternType2["startRange"] = "startRange";
|
|
637
|
-
RangePatternType2["shared"] = "shared";
|
|
638
|
-
RangePatternType2["endRange"] = "endRange";
|
|
639
|
-
})(RangePatternType || (RangePatternType = {}));
|
|
640
|
-
|
|
641
494
|
// node_modules/.aspect_rules_js/@formatjs+icu-messageformat-parser@0.0.0/node_modules/@formatjs/icu-messageformat-parser/lib/error.js
|
|
642
495
|
var ErrorKind;
|
|
643
496
|
(function(ErrorKind2) {
|
|
@@ -3512,7 +3365,7 @@ var ReactIntl = (() => {
|
|
|
3512
3365
|
function isFormatXMLElementFn(el) {
|
|
3513
3366
|
return typeof el === "function";
|
|
3514
3367
|
}
|
|
3515
|
-
function
|
|
3368
|
+
function formatToParts(els, locales, formatters, formats, values, currentPluralValue, originalMessage) {
|
|
3516
3369
|
if (els.length === 1 && isLiteralElement(els[0])) {
|
|
3517
3370
|
return [
|
|
3518
3371
|
{
|
|
@@ -3588,7 +3441,7 @@ var ReactIntl = (() => {
|
|
|
3588
3441
|
if (!isFormatXMLElementFn(formatFn)) {
|
|
3589
3442
|
throw new InvalidValueTypeError(value_1, "function", originalMessage);
|
|
3590
3443
|
}
|
|
3591
|
-
var parts =
|
|
3444
|
+
var parts = formatToParts(children, locales, formatters, formats, values, currentPluralValue);
|
|
3592
3445
|
var chunks = formatFn(parts.map(function(p) {
|
|
3593
3446
|
return p.value;
|
|
3594
3447
|
}));
|
|
@@ -3607,7 +3460,7 @@ var ReactIntl = (() => {
|
|
|
3607
3460
|
if (!opt) {
|
|
3608
3461
|
throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
3609
3462
|
}
|
|
3610
|
-
result.push.apply(result,
|
|
3463
|
+
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values));
|
|
3611
3464
|
continue;
|
|
3612
3465
|
}
|
|
3613
3466
|
if (isPluralElement(el)) {
|
|
@@ -3622,7 +3475,7 @@ var ReactIntl = (() => {
|
|
|
3622
3475
|
if (!opt) {
|
|
3623
3476
|
throw new InvalidValueError(el.value, value, Object.keys(el.options), originalMessage);
|
|
3624
3477
|
}
|
|
3625
|
-
result.push.apply(result,
|
|
3478
|
+
result.push.apply(result, formatToParts(opt.value, locales, formatters, formats, values, value - (el.offset || 0)));
|
|
3626
3479
|
continue;
|
|
3627
3480
|
}
|
|
3628
3481
|
}
|
|
@@ -3738,7 +3591,7 @@ var ReactIntl = (() => {
|
|
|
3738
3591
|
return result;
|
|
3739
3592
|
};
|
|
3740
3593
|
this.formatToParts = function(values) {
|
|
3741
|
-
return
|
|
3594
|
+
return formatToParts(_this.ast, _this.locales, _this.formatters, _this.formats, values, void 0, _this.message);
|
|
3742
3595
|
};
|
|
3743
3596
|
this.resolvedOptions = function() {
|
|
3744
3597
|
var _a3;
|
|
@@ -3950,6 +3803,14 @@ var ReactIntl = (() => {
|
|
|
3950
3803
|
);
|
|
3951
3804
|
|
|
3952
3805
|
// node_modules/.aspect_rules_js/@formatjs+intl@0.0.0/node_modules/@formatjs/intl/lib/src/utils.js
|
|
3806
|
+
function invariant(condition, message, Err) {
|
|
3807
|
+
if (Err === void 0) {
|
|
3808
|
+
Err = Error;
|
|
3809
|
+
}
|
|
3810
|
+
if (!condition) {
|
|
3811
|
+
throw new Err(message);
|
|
3812
|
+
}
|
|
3813
|
+
}
|
|
3953
3814
|
function filterProps(props, allowlist, defaults) {
|
|
3954
3815
|
if (defaults === void 0) {
|
|
3955
3816
|
defaults = {};
|
|
@@ -4446,9 +4307,13 @@ var ReactIntl = (() => {
|
|
|
4446
4307
|
"unitDisplay",
|
|
4447
4308
|
"numberingSystem",
|
|
4448
4309
|
// ES2023 NumberFormat
|
|
4310
|
+
// @ts-expect-error: TypeScript doesn't know about this yet
|
|
4449
4311
|
"trailingZeroDisplay",
|
|
4312
|
+
// @ts-expect-error: TypeScript doesn't know about this yet
|
|
4450
4313
|
"roundingPriority",
|
|
4314
|
+
// @ts-expect-error: TypeScript doesn't know about this yet
|
|
4451
4315
|
"roundingIncrement",
|
|
4316
|
+
// @ts-expect-error: TypeScript doesn't know about this yet
|
|
4452
4317
|
"roundingMode"
|
|
4453
4318
|
];
|
|
4454
4319
|
function getFormatter3(_a2, getNumberFormat, options) {
|
|
@@ -4509,30 +4374,17 @@ var ReactIntl = (() => {
|
|
|
4509
4374
|
onError(new MissingDataError('Missing locale data for locale: "'.concat(locale, '" in Intl.DateTimeFormat. Using default locale: "').concat(defaultLocale, '" as fallback. See https://formatjs.github.io/docs/react-intl#runtime-requirements for more details')));
|
|
4510
4375
|
}
|
|
4511
4376
|
verifyConfigMessages(resolvedConfig);
|
|
4512
|
-
return __assign(__assign({}, resolvedConfig), {
|
|
4513
|
-
formatters,
|
|
4514
|
-
formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat),
|
|
4515
|
-
formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat),
|
|
4516
|
-
formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat),
|
|
4517
|
-
formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat),
|
|
4518
|
-
formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat),
|
|
4519
|
-
formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat),
|
|
4520
|
-
formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat),
|
|
4521
|
-
formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat),
|
|
4522
|
-
formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules),
|
|
4523
|
-
// @ts-expect-error TODO: will get to this later
|
|
4524
|
-
formatMessage: formatMessage.bind(null, resolvedConfig, formatters),
|
|
4525
|
-
// @ts-expect-error TODO: will get to this later
|
|
4526
|
-
$t: formatMessage.bind(null, resolvedConfig, formatters),
|
|
4527
|
-
formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat),
|
|
4528
|
-
formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat),
|
|
4529
|
-
formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames)
|
|
4530
|
-
});
|
|
4377
|
+
return __assign(__assign({}, resolvedConfig), { formatters, formatNumber: formatNumber.bind(null, resolvedConfig, formatters.getNumberFormat), formatNumberToParts: formatNumberToParts.bind(null, resolvedConfig, formatters.getNumberFormat), formatRelativeTime: formatRelativeTime.bind(null, resolvedConfig, formatters.getRelativeTimeFormat), formatDate: formatDate.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateToParts: formatDateToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTime: formatTime.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatDateTimeRange: formatDateTimeRange.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatTimeToParts: formatTimeToParts.bind(null, resolvedConfig, formatters.getDateTimeFormat), formatPlural: formatPlural.bind(null, resolvedConfig, formatters.getPluralRules), formatMessage: formatMessage.bind(null, resolvedConfig, formatters), $t: formatMessage.bind(null, resolvedConfig, formatters), formatList: formatList.bind(null, resolvedConfig, formatters.getListFormat), formatListToParts: formatListToParts.bind(null, resolvedConfig, formatters.getListFormat), formatDisplayName: formatDisplayName.bind(null, resolvedConfig, formatters.getDisplayNames) });
|
|
4531
4378
|
}
|
|
4532
4379
|
|
|
4533
4380
|
// packages/react-intl/src/utils.ts
|
|
4381
|
+
function invariant2(condition, message, Err = Error) {
|
|
4382
|
+
if (!condition) {
|
|
4383
|
+
throw new Err(message);
|
|
4384
|
+
}
|
|
4385
|
+
}
|
|
4534
4386
|
function invariantIntlContext(intl) {
|
|
4535
|
-
|
|
4387
|
+
invariant2(
|
|
4536
4388
|
intl,
|
|
4537
4389
|
"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry."
|
|
4538
4390
|
);
|
|
@@ -4722,10 +4574,8 @@ var ReactIntl = (() => {
|
|
|
4722
4574
|
formatMessage: formatMessage2.bind(
|
|
4723
4575
|
null,
|
|
4724
4576
|
resolvedConfig,
|
|
4725
|
-
// @ts-expect-error fix this
|
|
4726
4577
|
coreIntl.formatters
|
|
4727
4578
|
),
|
|
4728
|
-
// @ts-expect-error fix this
|
|
4729
4579
|
$t: formatMessage2.bind(null, resolvedConfig, coreIntl.formatters)
|
|
4730
4580
|
});
|
|
4731
4581
|
};
|
|
@@ -4921,7 +4771,7 @@ var ReactIntl = (() => {
|
|
|
4921
4771
|
"unit",
|
|
4922
4772
|
"updateIntervalInSeconds"
|
|
4923
4773
|
]);
|
|
4924
|
-
|
|
4774
|
+
invariant2(
|
|
4925
4775
|
!updateIntervalInSeconds || !!(updateIntervalInSeconds && canIncrement(unit)),
|
|
4926
4776
|
"Cannot schedule update with unit longer than hour"
|
|
4927
4777
|
);
|
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
exports.createIntl = void 0;
|
|
9
9
|
var tslib_1 = require("tslib");
|
|
10
10
|
var intl_1 = require("@formatjs/intl");
|
|
11
|
+
var intl_messageformat_1 = require("intl-messageformat");
|
|
11
12
|
var React = tslib_1.__importStar(require("react"));
|
|
12
13
|
var utils_1 = require("../utils");
|
|
13
|
-
var intl_messageformat_1 = require("intl-messageformat");
|
|
14
14
|
function assignUniqueKeysToFormatXMLElementFnArgument(values) {
|
|
15
15
|
if (!values) {
|
|
16
16
|
return values;
|
|
@@ -58,10 +58,6 @@ var createIntl = function (_a, cache) {
|
|
|
58
58
|
onError: coreIntl.onError,
|
|
59
59
|
defaultRichTextElements: defaultRichTextElements,
|
|
60
60
|
};
|
|
61
|
-
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig,
|
|
62
|
-
// @ts-expect-error fix this
|
|
63
|
-
coreIntl.formatters),
|
|
64
|
-
// @ts-expect-error fix this
|
|
65
|
-
$t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
|
|
61
|
+
return tslib_1.__assign(tslib_1.__assign({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig, coreIntl.formatters), $t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
|
|
66
62
|
};
|
|
67
63
|
exports.createIntl = createIntl;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { FormatDateOptions } from '@formatjs/intl';
|
|
3
|
-
import
|
|
2
|
+
import * as React from 'react';
|
|
4
3
|
interface Props extends FormatDateOptions {
|
|
5
|
-
from: Parameters<DateTimeFormat['formatRange']>[0];
|
|
6
|
-
to: Parameters<DateTimeFormat['formatRange']>[1];
|
|
4
|
+
from: Parameters<Intl.DateTimeFormat['formatRange']>[0];
|
|
5
|
+
to: Parameters<Intl.DateTimeFormat['formatRange']>[1];
|
|
7
6
|
children?(value: React.ReactNode): React.ReactElement | null;
|
|
8
7
|
}
|
|
9
8
|
declare const FormattedDateTimeRange: React.FC<Props>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { RelativeTimeFormatSingularUnit } from '@formatjs/ecma402-abstract';
|
|
3
2
|
import { FormatRelativeTimeOptions } from '@formatjs/intl';
|
|
4
3
|
export interface Props extends FormatRelativeTimeOptions {
|
|
5
4
|
value?: number;
|
|
6
|
-
unit?:
|
|
5
|
+
unit?: Intl.RelativeTimeFormatUnit;
|
|
7
6
|
updateIntervalInSeconds?: number;
|
|
8
7
|
children?(value: string): React.ReactElement | null;
|
|
9
8
|
}
|
|
@@ -7,7 +7,7 @@ var tslib_1 = require("tslib");
|
|
|
7
7
|
* See the accompanying LICENSE file for terms.
|
|
8
8
|
*/
|
|
9
9
|
var React = tslib_1.__importStar(require("react"));
|
|
10
|
-
var
|
|
10
|
+
var utils_1 = require("../utils");
|
|
11
11
|
var useIntl_1 = tslib_1.__importDefault(require("./useIntl"));
|
|
12
12
|
var MINUTE = 60;
|
|
13
13
|
var HOUR = 60 * 60;
|
|
@@ -73,7 +73,7 @@ var SimpleFormattedRelativeTime = function (props) {
|
|
|
73
73
|
};
|
|
74
74
|
var FormattedRelativeTime = function (_a) {
|
|
75
75
|
var _b = _a.value, value = _b === void 0 ? 0 : _b, _c = _a.unit, unit = _c === void 0 ? 'second' : _c, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = tslib_1.__rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
|
|
76
|
-
(0,
|
|
76
|
+
(0, utils_1.invariant)(!updateIntervalInSeconds ||
|
|
77
77
|
!!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');
|
|
78
78
|
var _d = React.useState(), prevUnit = _d[0], setPrevUnit = _d[1];
|
|
79
79
|
var _e = React.useState(0), prevValue = _e[0], setPrevValue = _e[1];
|
package/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { ResolvedIntlConfig } from './types';
|
|
2
|
-
import * as React from 'react';
|
|
3
1
|
import { FormatXMLElementFn } from 'intl-messageformat';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ResolvedIntlConfig } from './types';
|
|
4
|
+
export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
|
|
4
5
|
export declare function invariantIntlContext(intl?: any): asserts intl;
|
|
5
6
|
export declare const DEFAULT_INTL_CONFIG: Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
|
|
6
7
|
/**
|
package/src/utils.js
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_INTL_CONFIG = void 0;
|
|
4
|
+
exports.invariant = invariant;
|
|
4
5
|
exports.invariantIntlContext = invariantIntlContext;
|
|
5
6
|
exports.assignUniqueKeysToParts = assignUniqueKeysToParts;
|
|
6
7
|
exports.shallowEqual = shallowEqual;
|
|
7
8
|
var tslib_1 = require("tslib");
|
|
8
9
|
var React = tslib_1.__importStar(require("react"));
|
|
9
|
-
var ecma402_abstract_1 = require("@formatjs/ecma402-abstract");
|
|
10
10
|
var intl_1 = require("@formatjs/intl");
|
|
11
|
+
function invariant(condition, message, Err) {
|
|
12
|
+
if (Err === void 0) { Err = Error; }
|
|
13
|
+
if (!condition) {
|
|
14
|
+
throw new Err(message);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
11
17
|
function invariantIntlContext(intl) {
|
|
12
|
-
|
|
18
|
+
invariant(intl, '[React Intl] Could not find required `intl` object. ' +
|
|
13
19
|
'<IntlProvider> needs to exist in the component ancestry.');
|
|
14
20
|
}
|
|
15
21
|
exports.DEFAULT_INTL_CONFIG = tslib_1.__assign(tslib_1.__assign({}, intl_1.DEFAULT_INTL_CONFIG), { textComponent: React.Fragment });
|