react-intl 7.1.14 → 8.0.0

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.
Files changed (46) hide show
  1. package/index.d.ts +15 -15
  2. package/index.js +21 -46
  3. package/package.json +23 -21
  4. package/react-intl.iife.js +113 -111
  5. package/src/components/createFormattedComponent.d.ts +1 -1
  6. package/src/components/createFormattedComponent.js +17 -24
  7. package/src/components/createIntl.d.ts +1 -1
  8. package/src/components/createIntl.js +12 -16
  9. package/src/components/dateTimeRange.js +6 -8
  10. package/src/components/injectIntl.d.ts +1 -1
  11. package/src/components/injectIntl.js +14 -16
  12. package/src/components/message.js +10 -12
  13. package/src/components/plural.js +4 -7
  14. package/src/components/provider.d.ts +2 -2
  15. package/src/components/provider.js +15 -17
  16. package/src/components/relative.js +10 -12
  17. package/src/components/useIntl.d.ts +1 -1
  18. package/src/components/useIntl.js +6 -10
  19. package/src/types.d.ts +1 -1
  20. package/src/types.js +1 -2
  21. package/src/utils.d.ts +2 -1
  22. package/src/utils.js +21 -29
  23. package/lib/index.d.ts +0 -46
  24. package/lib/index.js +0 -26
  25. package/lib/src/components/createFormattedComponent.d.ts +0 -27
  26. package/lib/src/components/createFormattedComponent.js +0 -62
  27. package/lib/src/components/createIntl.d.ts +0 -9
  28. package/lib/src/components/createIntl.js +0 -58
  29. package/lib/src/components/dateTimeRange.d.ts +0 -9
  30. package/lib/src/components/dateTimeRange.js +0 -15
  31. package/lib/src/components/injectIntl.d.ts +0 -39
  32. package/lib/src/components/injectIntl.js +0 -35
  33. package/lib/src/components/message.d.ts +0 -11
  34. package/lib/src/components/message.js +0 -35
  35. package/lib/src/components/plural.d.ts +0 -14
  36. package/lib/src/components/plural.js +0 -23
  37. package/lib/src/components/provider.d.ts +0 -29
  38. package/lib/src/components/provider.js +0 -59
  39. package/lib/src/components/relative.d.ts +0 -10
  40. package/lib/src/components/relative.js +0 -125
  41. package/lib/src/components/useIntl.d.ts +0 -2
  42. package/lib/src/components/useIntl.js +0 -8
  43. package/lib/src/types.d.ts +0 -14
  44. package/lib/src/types.js +0 -1
  45. package/lib/src/utils.d.ts +0 -25
  46. package/lib/src/utils.js +0 -69
package/index.d.ts CHANGED
@@ -1,25 +1,25 @@
1
1
  import { NumberFormatOptions } from '@formatjs/ecma402-abstract';
2
- import { CustomFormatConfig, FormatDateOptions, MessageDescriptor } from '@formatjs/intl';
2
+ import { CustomFormatConfig, FormatDateOptions, FormatTimeOptions, MessageDescriptor } from '@formatjs/intl';
3
3
  import * as React from 'react';
4
- import { createIntl } from './src/components/createIntl';
5
- import FormattedDateTimeRange from './src/components/dateTimeRange';
6
- import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl';
7
- import FormattedMessage from './src/components/message';
8
- import FormattedPlural from './src/components/plural';
9
- import IntlProvider from './src/components/provider';
10
- import FormattedRelativeTime from './src/components/relative';
11
- import useIntl from './src/components/useIntl';
12
- import { IntlShape } from './src/types';
4
+ import { createIntl } from './src/components/createIntl.js';
5
+ import FormattedDateTimeRange from './src/components/dateTimeRange.js';
6
+ import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, WithIntlProps, WrappedComponentProps } from './src/components/injectIntl.js';
7
+ import FormattedMessage from './src/components/message.js';
8
+ import FormattedPlural from './src/components/plural.js';
9
+ import IntlProvider from './src/components/provider.js';
10
+ import FormattedRelativeTime from './src/components/relative.js';
11
+ import useIntl from './src/components/useIntl.js';
12
+ import { IntlShape } from './src/types.js';
13
13
  export { createIntlCache, CustomFormatConfig, CustomFormats, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPluralOptions, FormatRelativeTimeOptions, Formatters, IntlCache, IntlFormatters, InvalidConfigError, MessageDescriptor, MessageFormatError, MissingDataError, MissingTranslationError, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, UnsupportedFormatterError, } from '@formatjs/intl';
14
- export { IntlConfig, IntlShape, ResolvedIntlConfig } from './src/types';
14
+ export { IntlConfig, IntlShape, ResolvedIntlConfig } from './src/types.js';
15
15
  export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, WithIntlProps, WrappedComponentProps, };
16
16
  export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
17
17
  export declare function defineMessage<T extends MessageDescriptor>(msg: T): T;
18
- export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
18
+ export declare const FormattedDate: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig<'date'> & {
19
19
  value: string | number | Date | undefined;
20
20
  children?(formattedDate: string): React.ReactElement | null;
21
21
  }>;
22
- export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig & {
22
+ export declare const FormattedTime: React.FC<Intl.DateTimeFormatOptions & CustomFormatConfig<'time'> & {
23
23
  value: string | number | Date | undefined;
24
24
  children?(formattedTime: string): React.ReactElement | null;
25
25
  }>;
@@ -37,10 +37,10 @@ export declare const FormattedDateParts: React.FC<FormatDateOptions & {
37
37
  value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
38
38
  children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
39
39
  }>;
40
- export declare const FormattedTimeParts: React.FC<FormatDateOptions & {
40
+ export declare const FormattedTimeParts: React.FC<FormatTimeOptions & {
41
41
  value: Parameters<Intl.DateTimeFormat['format']>[0] | string;
42
42
  children(val: Intl.DateTimeFormatPart[]): React.ReactElement | null;
43
43
  }>;
44
44
  export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
45
45
  export type { PrimitiveType } from 'intl-messageformat';
46
- export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent';
46
+ export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent.js';
package/index.js CHANGED
@@ -1,51 +1,26 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FormattedNumberParts = exports.FormattedListParts = exports.FormattedTimeParts = exports.FormattedDateParts = exports.FormattedDisplayName = exports.FormattedList = exports.FormattedNumber = exports.FormattedTime = exports.FormattedDate = exports.useIntl = exports.RawIntlProvider = exports.IntlProvider = exports.IntlContext = exports.injectIntl = exports.FormattedRelativeTime = exports.FormattedPlural = exports.FormattedMessage = exports.FormattedDateTimeRange = exports.createIntl = exports.UnsupportedFormatterError = exports.ReactIntlErrorCode = exports.ReactIntlError = exports.MissingTranslationError = exports.MissingDataError = exports.MessageFormatError = exports.InvalidConfigError = exports.createIntlCache = void 0;
4
- exports.defineMessages = defineMessages;
5
- exports.defineMessage = defineMessage;
6
- var tslib_1 = require("tslib");
7
- var createFormattedComponent_1 = require("./src/components/createFormattedComponent");
8
- var createIntl_1 = require("./src/components/createIntl");
9
- Object.defineProperty(exports, "createIntl", { enumerable: true, get: function () { return createIntl_1.createIntl; } });
10
- var dateTimeRange_1 = tslib_1.__importDefault(require("./src/components/dateTimeRange"));
11
- exports.FormattedDateTimeRange = dateTimeRange_1.default;
12
- var injectIntl_1 = tslib_1.__importStar(require("./src/components/injectIntl"));
13
- exports.injectIntl = injectIntl_1.default;
14
- Object.defineProperty(exports, "IntlContext", { enumerable: true, get: function () { return injectIntl_1.Context; } });
15
- Object.defineProperty(exports, "RawIntlProvider", { enumerable: true, get: function () { return injectIntl_1.Provider; } });
16
- var message_1 = tslib_1.__importDefault(require("./src/components/message"));
17
- exports.FormattedMessage = message_1.default;
18
- var plural_1 = tslib_1.__importDefault(require("./src/components/plural"));
19
- exports.FormattedPlural = plural_1.default;
20
- var provider_1 = tslib_1.__importDefault(require("./src/components/provider"));
21
- exports.IntlProvider = provider_1.default;
22
- var relative_1 = tslib_1.__importDefault(require("./src/components/relative"));
23
- exports.FormattedRelativeTime = relative_1.default;
24
- var useIntl_1 = tslib_1.__importDefault(require("./src/components/useIntl"));
25
- exports.useIntl = useIntl_1.default;
26
- var intl_1 = require("@formatjs/intl");
27
- Object.defineProperty(exports, "createIntlCache", { enumerable: true, get: function () { return intl_1.createIntlCache; } });
28
- Object.defineProperty(exports, "InvalidConfigError", { enumerable: true, get: function () { return intl_1.InvalidConfigError; } });
29
- Object.defineProperty(exports, "MessageFormatError", { enumerable: true, get: function () { return intl_1.MessageFormatError; } });
30
- Object.defineProperty(exports, "MissingDataError", { enumerable: true, get: function () { return intl_1.MissingDataError; } });
31
- Object.defineProperty(exports, "MissingTranslationError", { enumerable: true, get: function () { return intl_1.MissingTranslationError; } });
32
- Object.defineProperty(exports, "ReactIntlError", { enumerable: true, get: function () { return intl_1.IntlError; } });
33
- Object.defineProperty(exports, "ReactIntlErrorCode", { enumerable: true, get: function () { return intl_1.IntlErrorCode; } });
34
- Object.defineProperty(exports, "UnsupportedFormatterError", { enumerable: true, get: function () { return intl_1.UnsupportedFormatterError; } });
35
- function defineMessages(msgs) {
1
+ import { createFormattedComponent, createFormattedDateTimePartsComponent, } from './src/components/createFormattedComponent.js';
2
+ import { createIntl } from './src/components/createIntl.js';
3
+ import FormattedDateTimeRange from './src/components/dateTimeRange.js';
4
+ import injectIntl, { Context as IntlContext, Provider as RawIntlProvider, } from './src/components/injectIntl.js';
5
+ import FormattedMessage from './src/components/message.js';
6
+ import FormattedPlural from './src/components/plural.js';
7
+ import IntlProvider from './src/components/provider.js';
8
+ import FormattedRelativeTime from './src/components/relative.js';
9
+ import useIntl from './src/components/useIntl.js';
10
+ export { createIntlCache, InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, IntlError as ReactIntlError, IntlErrorCode as ReactIntlErrorCode, UnsupportedFormatterError, } from '@formatjs/intl';
11
+ export { createIntl, FormattedDateTimeRange, FormattedMessage, FormattedPlural, FormattedRelativeTime, injectIntl, IntlContext, IntlProvider, RawIntlProvider, useIntl, };
12
+ export function defineMessages(msgs) {
36
13
  return msgs;
37
14
  }
38
- function defineMessage(msg) {
15
+ export function defineMessage(msg) {
39
16
  return msg;
40
17
  }
41
18
  // IMPORTANT: Explicit here to prevent api-extractor from outputing `import('./src/types').CustomFormatConfig`
42
- exports.FormattedDate = (0, createFormattedComponent_1.createFormattedComponent)('formatDate');
43
- exports.FormattedTime = (0, createFormattedComponent_1.createFormattedComponent)('formatTime');
44
- exports.FormattedNumber = (0, createFormattedComponent_1.createFormattedComponent)('formatNumber');
45
- exports.FormattedList = (0, createFormattedComponent_1.createFormattedComponent)('formatList');
46
- exports.FormattedDisplayName = (0, createFormattedComponent_1.createFormattedComponent)('formatDisplayName');
47
- exports.FormattedDateParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatDate');
48
- exports.FormattedTimeParts = (0, createFormattedComponent_1.createFormattedDateTimePartsComponent)('formatTime');
49
- var createFormattedComponent_2 = require("./src/components/createFormattedComponent");
50
- Object.defineProperty(exports, "FormattedListParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedListParts; } });
51
- Object.defineProperty(exports, "FormattedNumberParts", { enumerable: true, get: function () { return createFormattedComponent_2.FormattedNumberParts; } });
19
+ export var FormattedDate = createFormattedComponent('formatDate');
20
+ export var FormattedTime = createFormattedComponent('formatTime');
21
+ export var FormattedNumber = createFormattedComponent('formatNumber');
22
+ export var FormattedList = createFormattedComponent('formatList');
23
+ export var FormattedDisplayName = createFormattedComponent('formatDisplayName');
24
+ export var FormattedDateParts = createFormattedDateTimePartsComponent('formatDate');
25
+ export var FormattedTimeParts = createFormattedDateTimePartsComponent('formatTime');
26
+ export { FormattedListParts, FormattedNumberParts, } from './src/components/createFormattedComponent.js';
package/package.json CHANGED
@@ -1,25 +1,8 @@
1
1
  {
2
2
  "name": "react-intl",
3
3
  "description": "Internationalize React apps. This library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations.",
4
- "version": "7.1.14",
5
- "license": "BSD-3-Clause",
4
+ "version": "8.0.0",
6
5
  "author": "Eric Ferraiuolo <edf@ericf.me>",
7
- "sideEffects": false,
8
- "types": "index.d.ts",
9
- "dependencies": {
10
- "@types/hoist-non-react-statics": "^3.3.1",
11
- "@types/react": "16 || 17 || 18 || 19",
12
- "hoist-non-react-statics": "^3.3.2",
13
- "tslib": "^2.8.0",
14
- "@formatjs/ecma402-abstract": "2.3.6",
15
- "@formatjs/icu-messageformat-parser": "2.11.4",
16
- "@formatjs/intl": "3.1.8",
17
- "intl-messageformat": "10.7.18"
18
- },
19
- "peerDependencies": {
20
- "react": "16 || 17 || 18 || 19",
21
- "typescript": "^5.6.0"
22
- },
23
6
  "browserslist": [
24
7
  "ie 11"
25
8
  ],
@@ -122,6 +105,18 @@
122
105
  "Yang Su <yang@quip.com>",
123
106
  "zouxuoz <zouxuoz@gmail.com>"
124
107
  ],
108
+ "dependencies": {
109
+ "@formatjs/ecma402-abstract": "3.0.0",
110
+ "@formatjs/icu-messageformat-parser": "3.0.0",
111
+ "@formatjs/intl": "4.0.0",
112
+ "@types/hoist-non-react-statics": "^3.3.1",
113
+ "hoist-non-react-statics": "^3.3.2",
114
+ "intl-messageformat": "11.0.0",
115
+ "tslib": "^2.8.0"
116
+ },
117
+ "exports": {
118
+ ".": "./index.js"
119
+ },
125
120
  "gitHead": "773d6ebf881357f6e4c2dd7e8984b1bd0f69b4ca",
126
121
  "homepage": "https://formatjs.github.io/docs/react-intl",
127
122
  "keywords": [
@@ -138,12 +133,19 @@
138
133
  "translate",
139
134
  "translation"
140
135
  ],
141
- "main": "index.js",
142
- "module": "lib/index.js",
136
+ "license": "BSD-3-Clause",
137
+ "peerDependencies": {
138
+ "@types/react": "19",
139
+ "react": "19",
140
+ "typescript": "5.8.3"
141
+ },
143
142
  "peerDependenciesMeta": {
144
143
  "typescript": {
145
144
  "optional": true
146
145
  }
147
146
  },
148
- "repository": "git@github.com:formatjs/formatjs.git"
147
+ "repository": "git@github.com:formatjs/formatjs.git",
148
+ "sideEffects": false,
149
+ "type": "module",
150
+ "types": "index.d.ts"
149
151
  }