use-intl 3.16.0-canary.4 → 3.16.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.
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var initializeConfig = require('./initializeConfig-BnOiVylt.js');
6
- var createFormatter = require('./createFormatter-07msF6R0.js');
6
+ var createFormatter = require('./createFormatter-ZTUVkKlh.js');
7
7
  require('intl-messageformat');
8
8
  require('react');
9
9
 
@@ -425,7 +425,9 @@ function createFormatter(_ref) {
425
425
  }, () => [dateTime(start), dateTime(end)].join(' – '));
426
426
  }
427
427
  function number(value, formatOrOptions) {
428
- return getFormattedValue(formatOrOptions, formats === null || formats === void 0 ? void 0 : formats.number, options => new Intl.NumberFormat(locale, options).format(value), () => String(value));
428
+ return getFormattedValue(formatOrOptions, formats === null || formats === void 0 ? void 0 : formats.number, options => new Intl.NumberFormat(locale,
429
+ // @ts-expect-error -- TS is currently lacking support for ECMA-402 10.0 (`useGrouping: 'auto'`, see https://github.com/microsoft/TypeScript/issues/56269)
430
+ options).format(value), () => String(value));
429
431
  }
430
432
  function getGlobalNow() {
431
433
  if (globalNow) {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var initializeConfig = require('./initializeConfig-BnOiVylt.js');
6
6
  var core = require('./core.js');
7
- var createFormatter = require('./createFormatter-07msF6R0.js');
7
+ var createFormatter = require('./createFormatter-ZTUVkKlh.js');
8
8
  var _IntlProvider = require('./_IntlProvider.js');
9
9
  var react = require('./react.js');
10
10
  var _useLocale = require('./_useLocale-0Rl9uR82.js');
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _IntlProvider = require('./_IntlProvider.js');
6
6
  var _useLocale = require('./_useLocale-0Rl9uR82.js');
7
7
  var React = require('react');
8
- var createFormatter = require('./createFormatter-07msF6R0.js');
8
+ var createFormatter = require('./createFormatter-ZTUVkKlh.js');
9
9
  var initializeConfig = require('./initializeConfig-BnOiVylt.js');
10
10
  require('./IntlContext-BKfsnzBx.js');
11
11
  require('intl-messageformat');
@@ -1,2 +1,3 @@
1
- import type { NumberFormatOptions } from '@formatjs/ecma402-abstract/types/number';
1
+ import { Formats } from 'intl-messageformat';
2
+ type NumberFormatOptions = Formats['number'][string];
2
3
  export default NumberFormatOptions;
@@ -16,7 +16,7 @@ export default function createFormatter({ formats, locale, now: globalNow, onErr
16
16
  dateTime: (value: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
17
17
  number: (value: number | bigint, formatOrOptions?: string | NumberFormatOptions) => string;
18
18
  relativeTime: (date: number | Date, nowOrOptions?: RelativeTimeFormatOptions['now'] | RelativeTimeFormatOptions) => string;
19
- list: <Value extends string | ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, formatOrOptions?: string | Intl.ListFormatOptions) => Value extends string ? string : Iterable<ReactElement<any, string | import("react").JSXElementConstructor<any>>>;
19
+ list: <Value extends string | ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, formatOrOptions?: string | Intl.ListFormatOptions) => Value extends string ? string : Iterable<ReactElement>;
20
20
  dateTimeRange: (start: Date | number, end: Date | number, formatOrOptions?: string | DateTimeFormatOptions) => string;
21
21
  };
22
22
  export {};
@@ -9,7 +9,7 @@ export type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'm
9
9
  messageFormatCache?: MessageFormatCache;
10
10
  };
11
11
  export default function createTranslatorImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>({ getMessageFallback, messages, namespace, onError, ...rest }: CreateTranslatorImplProps<Messages>, namespacePrefix: string): {
12
- <TargetKey extends import("./utils/MessageKeys").default<import("./utils/NestedValueOf").default<Messages, NestedKey>, NestedKeyOf<import("./utils/NestedValueOf").default<Messages, NestedKey>>>>(key: TargetKey, values?: import("./TranslationValues").default | undefined, formats?: Partial<import("./Formats").default> | undefined): string;
12
+ <TargetKey extends import(".").MessageKeys<import(".").NestedValueOf<Messages, NestedKey>, NestedKeyOf<import(".").NestedValueOf<Messages, NestedKey>>>>(key: TargetKey, values?: import("./TranslationValues").default | undefined, formats?: Partial<import("./Formats").default> | undefined): string;
13
13
  rich: (key: string, values?: import("./TranslationValues").RichTranslationValues | undefined, formats?: Partial<import("./Formats").default> | undefined) => string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
14
14
  markup(key: string, values: import("./TranslationValues").MarkupTranslationValues, formats?: Partial<import("./Formats").default> | undefined): string;
15
15
  raw(key: string): any;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import MessageFormatCache from '../core/MessageFormatCache';
3
- declare const IntlContext: import("react").Context<(import("../core/IntlConfig").default<import("../core/AbstractIntlMessages").default> & {
3
+ declare const IntlContext: import("react").Context<(import("../core/IntlConfig").default<import("..").AbstractIntlMessages> & {
4
4
  onError: (error: import("..").IntlError) => void;
5
5
  getMessageFallback: (info: {
6
6
  error: import("..").IntlError;
@@ -1,8 +1,2 @@
1
- /// <reference types="react" />
2
- export default function useFormatter(): {
3
- dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
4
- number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract/types/number").NumberFormatOptions | undefined) => string;
5
- relativeTime: (date: number | Date, nowOrOptions?: number | Date | import("../core/RelativeTimeFormatOptions").default | undefined) => string;
6
- list: <Value extends string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>>(value: Iterable<Value>, formatOrOptions?: string | Intl.ListFormatOptions | undefined) => Value extends string ? string : Iterable<import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>>;
7
- dateTimeRange: (start: number | Date, end: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
8
- };
1
+ import createFormatter from '../core/createFormatter';
2
+ export default function useFormatter(): ReturnType<typeof createFormatter>;
@@ -1,4 +1,4 @@
1
- export default function useIntlContext(): import("../core/IntlConfig").default<import("../core/AbstractIntlMessages").default> & {
1
+ export default function useIntlContext(): import("..").IntlConfig<import("..").AbstractIntlMessages> & {
2
2
  onError: (error: import("..").IntlError) => void;
3
3
  getMessageFallback: (info: {
4
4
  error: import("..").IntlError;
@@ -2,8 +2,8 @@
2
2
  import AbstractIntlMessages from '../core/AbstractIntlMessages';
3
3
  import NestedKeyOf from '../core/utils/NestedKeyOf';
4
4
  export default function useTranslationsImpl<Messages extends AbstractIntlMessages, NestedKey extends NestedKeyOf<Messages>>(allMessages: Messages, namespace: NestedKey, namespacePrefix: string): {
5
- <TargetKey extends unknown>(key: TargetKey, values?: import("../core/TranslationValues").default | undefined, formats?: Partial<import("../core/Formats").default> | undefined): string;
6
- rich: (key: string, values?: import("../core").RichTranslationValues | undefined, formats?: Partial<import("../core/Formats").default> | undefined) => string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
7
- markup(key: string, values: import("../core").MarkupTranslationValues, formats?: Partial<import("../core/Formats").default> | undefined): string;
5
+ <TargetKey extends unknown>(key: TargetKey, values?: import("../core").TranslationValues | undefined, formats?: Partial<import("../core").Formats> | undefined): string;
6
+ rich: (key: string, values?: import("../core").RichTranslationValues | undefined, formats?: Partial<import("../core").Formats> | undefined) => string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactNodeArray;
7
+ markup(key: string, values: import("../core").MarkupTranslationValues, formats?: Partial<import("../core").Formats> | undefined): string;
8
8
  raw(key: string): any;
9
9
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "use-intl",
3
- "version": "3.16.0-canary.4",
3
+ "version": "3.16.0",
4
4
  "sideEffects": false,
5
5
  "author": "Jan Amann <jan@amann.work>",
6
6
  "description": "Internationalization (i18n) for React",
@@ -63,8 +63,7 @@
63
63
  "formatting"
64
64
  ],
65
65
  "dependencies": {
66
- "@formatjs/ecma402-abstract": "^1.11.4",
67
- "intl-messageformat": "^10.5.11"
66
+ "intl-messageformat": "^10.5.14"
68
67
  },
69
68
  "peerDependencies": {
70
69
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
@@ -72,8 +71,8 @@
72
71
  "size-limit": [
73
72
  {
74
73
  "path": "dist/production/index.js",
75
- "limit": "15.26 kB"
74
+ "limit": "15.28 kB"
76
75
  }
77
76
  ],
78
- "gitHead": "ded7274dae09cd291c527abe88608e6617ff0cda"
77
+ "gitHead": "44a87a4ff07e779df8ac929c0edcf22fb398f576"
79
78
  }
File without changes