react-intl 10.1.15 → 10.1.17

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 CHANGED
@@ -2,7 +2,6 @@ import * as React from "react";
2
2
  import { CreateIntlFn, CustomFormatConfig, CustomFormatConfig as CustomFormatConfig$1, CustomFormats, FormatDateOptions, FormatDateOptions as FormatDateOptions$1, FormatDateTimeRangeOptions, FormatDisplayNameOptions, FormatDisplayNameOptions as FormatDisplayNameOptions$1, FormatListOptions, FormatListOptions as FormatListOptions$1, FormatNumberOptions, FormatNumberOptions as FormatNumberOptions$1, FormatPluralOptions, FormatPluralOptions as FormatPluralOptions$1, FormatRelativeTimeOptions, FormatRelativeTimeOptions as FormatRelativeTimeOptions$1, FormatTimeOptions, Formatters, Formatters as Formatters$1, IntlCache, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, IntlFormatters, IntlFormatters as IntlFormatters$1, InvalidConfigError, MessageDescriptor, MessageDescriptor as MessageDescriptor$1, MessageFormatError, MissingDataError, MissingTranslationError, ResolvedIntlConfig as ResolvedIntlConfig$1, UnsupportedFormatterError, createIntlCache } from "@formatjs/intl";
3
3
  import { FormatXMLElementFn, Options, PrimitiveType, PrimitiveType as PrimitiveType$1 } from "intl-messageformat";
4
4
  import { MessageFormatElement } from "@formatjs/icu-messageformat-parser";
5
-
6
5
  //#region packages/ecma402-abstract/types/number.d.ts
7
6
  type NumberFormatNotation = "standard" | "scientific" | "engineering" | "compact";
8
7
  type RoundingPriorityType = "auto" | "morePrecision" | "lessPrecision";
@@ -64,10 +63,10 @@ interface IntlShape extends ResolvedIntlConfig, IntlFormatters$1<React.ReactNode
64
63
  //#endregion
65
64
  //#region packages/react-intl/components/createIntl.d.ts
66
65
  /**
67
- * Create intl object
68
- * @param config intl config
69
- * @param cache cache for formatter instances to prevent memory leak
70
- */
66
+ * Create intl object
67
+ * @param config intl config
68
+ * @param cache cache for formatter instances to prevent memory leak
69
+ */
71
70
  declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
72
71
  //#endregion
73
72
  //#region packages/react-intl/components/context.d.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intl",
3
- "version": "10.1.15",
3
+ "version": "10.1.17",
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
  "format",
@@ -130,9 +130,9 @@
130
130
  "./server": "./server.js"
131
131
  },
132
132
  "dependencies": {
133
- "@formatjs/icu-messageformat-parser": "3.5.13",
134
- "@formatjs/intl": "4.1.15",
135
- "intl-messageformat": "11.2.10"
133
+ "@formatjs/icu-messageformat-parser": "3.5.15",
134
+ "@formatjs/intl": "4.1.17",
135
+ "intl-messageformat": "11.2.12"
136
136
  },
137
137
  "peerDependencies": {
138
138
  "@types/react": ">=18.0.0",
@@ -125,7 +125,7 @@ function parseDateTimeSkeleton(skeleton) {
125
125
  "long",
126
126
  "narrow",
127
127
  "short"
128
- ][len - 4];
128
+ ][len - 3];
129
129
  break;
130
130
  case "c":
131
131
  if (len < 4) throw new RangeError("`c..ccc` (weekday) patterns are not supported");
@@ -134,7 +134,7 @@ function parseDateTimeSkeleton(skeleton) {
134
134
  "long",
135
135
  "narrow",
136
136
  "short"
137
- ][len - 4];
137
+ ][len - 3];
138
138
  break;
139
139
  case "a":
140
140
  result.hour12 = true;
@@ -3093,10 +3093,11 @@ const DATE_TIME_FORMAT_OPTIONS = [
3093
3093
  ];
3094
3094
  function getFormatter$2({ locale, formats, onError, timeZone }, type, getDateTimeFormat, options = {}) {
3095
3095
  const { format } = options;
3096
- let filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, {
3096
+ const defaults = {
3097
3097
  ...timeZone && { timeZone },
3098
3098
  ...format && getNamedFormat(formats, type, format, onError)
3099
- });
3099
+ };
3100
+ let filteredOptions = filterProps(options, DATE_TIME_FORMAT_OPTIONS, defaults);
3100
3101
  if (type === "time" && !filteredOptions.hour && !filteredOptions.minute && !filteredOptions.second && !filteredOptions.timeStyle && !filteredOptions.dateStyle) filteredOptions = {
3101
3102
  ...filteredOptions,
3102
3103
  hour: "numeric",
@@ -3222,7 +3223,8 @@ Try polyfilling it using "@formatjs/intl-pluralrules"
3222
3223
  const RELATIVE_TIME_FORMAT_OPTIONS = ["numeric", "style"];
3223
3224
  function getFormatter$1({ locale, formats, onError }, getRelativeTimeFormat, options = {}) {
3224
3225
  const { format } = options;
3225
- return getRelativeTimeFormat(locale, filterProps(options, RELATIVE_TIME_FORMAT_OPTIONS, !!format && getNamedFormat(formats, "relative", format, onError) || {}));
3226
+ const defaults = !!format && getNamedFormat(formats, "relative", format, onError) || {};
3227
+ return getRelativeTimeFormat(locale, filterProps(options, RELATIVE_TIME_FORMAT_OPTIONS, defaults));
3226
3228
  }
3227
3229
  function formatRelativeTime(config, getRelativeTimeFormat, value, unit, options = {}) {
3228
3230
  if (!unit) unit = "second";
@@ -3262,7 +3264,8 @@ const NUMBER_FORMAT_OPTIONS = [
3262
3264
  ];
3263
3265
  function getFormatter({ locale, formats, onError }, getNumberFormat, options = {}) {
3264
3266
  const { format } = options;
3265
- return getNumberFormat(locale, filterProps(options, NUMBER_FORMAT_OPTIONS, format && getNamedFormat(formats, "number", format, onError) || {}));
3267
+ const defaults = format && getNamedFormat(formats, "number", format, onError) || {};
3268
+ return getNumberFormat(locale, filterProps(options, NUMBER_FORMAT_OPTIONS, defaults));
3266
3269
  }
3267
3270
  function formatNumber(config, getNumberFormat, value, options = {}) {
3268
3271
  try {
package/server.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { CreateIntlFn, Formatters, IntlCache, IntlFormatters, MessageDescriptor, MessageDescriptor as MessageDescriptor$1, ResolvedIntlConfig as ResolvedIntlConfig$1, createIntlCache } from "@formatjs/intl";
2
2
  import { FormatXMLElementFn, Options, PrimitiveType } from "intl-messageformat";
3
3
  import * as React from "react";
4
-
5
4
  //#region packages/react-intl/utils.d.ts
6
5
  type DefaultIntlConfig = Pick<ResolvedIntlConfig, "fallbackOnEmptyString" | "formats" | "messages" | "timeZone" | "textComponent" | "defaultLocale" | "defaultFormats" | "onError">;
7
6
  declare const DEFAULT_INTL_CONFIG$1: DefaultIntlConfig;
@@ -20,10 +19,10 @@ interface IntlShape extends ResolvedIntlConfig, IntlFormatters<React.ReactNode>
20
19
  //#endregion
21
20
  //#region packages/react-intl/components/createIntl.d.ts
22
21
  /**
23
- * Create intl object
24
- * @param config intl config
25
- * @param cache cache for formatter instances to prevent memory leak
26
- */
22
+ * Create intl object
23
+ * @param config intl config
24
+ * @param cache cache for formatter instances to prevent memory leak
25
+ */
27
26
  declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
28
27
  //#endregion
29
28
  //#region packages/react-intl/server.d.ts