use-intl 2.13.0-beta.2 → 2.13.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 (93) hide show
  1. package/LICENSE +21 -0
  2. package/dist/core/{IntlConfiguration.d.ts → IntlConfig.d.ts} +12 -5
  3. package/dist/core/createBaseTranslator.d.ts +2 -2
  4. package/dist/core/createIntl.d.ts +1 -1
  5. package/dist/core/createTranslator.d.ts +3 -3
  6. package/dist/core/createTranslatorImpl.d.ts +2 -2
  7. package/dist/core/use-intl.esm.js +38 -11
  8. package/dist/core/use-intl.esm.js.map +1 -1
  9. package/dist/core/use-intl.esm2.js +38 -41
  10. package/dist/core/use-intl.esm2.js.map +1 -1
  11. package/dist/core/use-intl.esm3.js +151 -35
  12. package/dist/core/use-intl.esm3.js.map +1 -1
  13. package/dist/core/use-intl.esm4.js +8 -148
  14. package/dist/core/use-intl.esm4.js.map +1 -1
  15. package/dist/core/use-intl.esm5.js +56 -12
  16. package/dist/core/use-intl.esm5.js.map +1 -1
  17. package/dist/core/use-intl.esm6.js +12 -56
  18. package/dist/core/use-intl.esm6.js.map +1 -1
  19. package/dist/core/use-intl.esm7.js +2 -2
  20. package/dist/core/use-intl.esm7.js.map +1 -1
  21. package/dist/core/use-intl.esm9.js +1 -1
  22. package/dist/react/IntlContext.d.ts +2 -2
  23. package/dist/react/IntlProvider.d.ts +7 -2
  24. package/dist/react/getInitializedConfig.d.ts +5 -0
  25. package/dist/react/use-intl.esm.js +3 -3
  26. package/dist/react/use-intl.esm.js.map +1 -1
  27. package/dist/react/use-intl.esm10.js +1 -1
  28. package/dist/react/use-intl.esm2.js +21 -3
  29. package/dist/react/use-intl.esm2.js.map +1 -1
  30. package/dist/react/use-intl.esm3.js +3 -28
  31. package/dist/react/use-intl.esm3.js.map +1 -1
  32. package/dist/react/use-intl.esm5.js +3 -20
  33. package/dist/react/use-intl.esm5.js.map +1 -1
  34. package/dist/react/use-intl.esm6.js +19 -20
  35. package/dist/react/use-intl.esm6.js.map +1 -1
  36. package/dist/react/use-intl.esm7.js +28 -3
  37. package/dist/react/use-intl.esm7.js.map +1 -1
  38. package/dist/react/use-intl.esm8.js +3 -30
  39. package/dist/react/use-intl.esm8.js.map +1 -1
  40. package/dist/react/use-intl.esm9.js +30 -3
  41. package/dist/react/use-intl.esm9.js.map +1 -1
  42. package/dist/react/useFormatter.d.ts +1 -1
  43. package/dist/react/useIntl.d.ts +2 -2
  44. package/dist/react/useIntlContext.d.ts +1 -1
  45. package/dist/src/core/{IntlConfiguration.d.ts → IntlConfig.d.ts} +12 -5
  46. package/dist/src/core/IntlConfig.js +2 -0
  47. package/dist/src/core/IntlConfig.js.map +1 -0
  48. package/dist/src/core/createBaseTranslator.d.ts +2 -2
  49. package/dist/src/core/createBaseTranslator.js.map +1 -1
  50. package/dist/src/core/createTranslator.d.ts +3 -3
  51. package/dist/src/core/createTranslatorImpl.d.ts +2 -2
  52. package/dist/src/core/createTranslatorImpl.js.map +1 -1
  53. package/dist/src/react/IntlContext.d.ts +2 -2
  54. package/dist/src/react/IntlContext.js.map +1 -1
  55. package/dist/src/react/IntlProvider.d.ts +7 -2
  56. package/dist/src/react/IntlProvider.js +2 -2
  57. package/dist/src/react/IntlProvider.js.map +1 -1
  58. package/dist/src/react/getInitializedConfig.d.ts +5 -0
  59. package/dist/src/react/{getIntlContextValue.js → getInitializedConfig.js} +2 -2
  60. package/dist/src/react/getInitializedConfig.js.map +1 -0
  61. package/dist/src/react/useIntl.d.ts +1 -1
  62. package/dist/src/react/useIntl.js +1 -1
  63. package/dist/src/react/useIntl.js.map +1 -1
  64. package/dist/src/react/useIntlContext.d.ts +1 -1
  65. package/dist/use-intl.cjs.development.js +3 -3
  66. package/dist/use-intl.cjs.development.js.map +1 -1
  67. package/dist/use-intl.cjs.production.min.js.map +1 -1
  68. package/dist/use-intl.esm.js +9 -9
  69. package/package.json +3 -2
  70. package/src/core/{IntlConfiguration.tsx → IntlConfig.tsx} +14 -6
  71. package/src/core/createBaseTranslator.tsx +7 -8
  72. package/src/core/createTranslator.tsx +3 -3
  73. package/src/core/createTranslatorImpl.tsx +8 -6
  74. package/src/react/IntlContext.tsx +2 -2
  75. package/src/react/IntlProvider.tsx +9 -5
  76. package/src/react/{getIntlContextValue.tsx → getInitializedConfig.tsx} +9 -4
  77. package/src/react/useIntl.tsx +1 -1
  78. package/CHANGELOG.md +0 -542
  79. package/dist/react/IntlContextValue.d.ts +0 -19
  80. package/dist/react/IntlProviderProps.d.ts +0 -15
  81. package/dist/react/getIntlContextValue.d.ts +0 -13
  82. package/dist/src/core/IntlConfiguration.js +0 -2
  83. package/dist/src/core/IntlConfiguration.js.map +0 -1
  84. package/dist/src/react/IntlContextValue.d.ts +0 -19
  85. package/dist/src/react/IntlContextValue.js +0 -2
  86. package/dist/src/react/IntlContextValue.js.map +0 -1
  87. package/dist/src/react/IntlProviderProps.d.ts +0 -15
  88. package/dist/src/react/IntlProviderProps.js +0 -2
  89. package/dist/src/react/IntlProviderProps.js.map +0 -1
  90. package/dist/src/react/getIntlContextValue.d.ts +0 -13
  91. package/dist/src/react/getIntlContextValue.js.map +0 -1
  92. package/src/react/IntlContextValue.tsx +0 -21
  93. package/src/react/IntlProviderProps.tsx +0 -17
@@ -1,33 +1,8 @@
1
- import { useMemo } from 'react';
2
- import createIntl from '../core/use-intl.esm.js';
3
1
  import useIntlContext from './use-intl.esm10.js';
4
2
 
5
- var hasWarned = false;
6
- /** @deprecated Switch to `useFormatter` */
7
-
8
- function useIntl() {
9
- var _useIntlContext = useIntlContext(),
10
- formats = _useIntlContext.formats,
11
- locale = _useIntlContext.locale,
12
- globalNow = _useIntlContext.now,
13
- onError = _useIntlContext.onError,
14
- timeZone = _useIntlContext.timeZone;
15
-
16
- if (!hasWarned) {
17
- hasWarned = true;
18
- console.warn('`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.');
19
- }
20
-
21
- return useMemo(function () {
22
- return createIntl({
23
- formats: formats,
24
- locale: locale,
25
- now: globalNow,
26
- onError: onError,
27
- timeZone: timeZone
28
- });
29
- }, [formats, globalNow, locale, onError, timeZone]);
3
+ function useLocale() {
4
+ return useIntlContext().locale;
30
5
  }
31
6
 
32
- export { useIntl as default };
7
+ export { useLocale as default };
33
8
  //# sourceMappingURL=use-intl.esm3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm3.js","sources":["../../src/react/useIntl.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createIntl from '../core/createIntl';\nimport useIntlContext from './useIntlContext';\n\nlet hasWarned = false;\n\n/** @deprecated Switch to `useFormatter` */\nexport default function useIntl() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n if (!hasWarned) {\n hasWarned = true;\n console.warn(\n '`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.'\n );\n }\n\n return useMemo(\n () =>\n createIntl({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["hasWarned","useIntl","useIntlContext","formats","locale","globalNow","now","onError","timeZone","console","warn","useMemo","createIntl"],"mappings":";;;;AAIA,IAAIA,SAAS,GAAG,KAAhB,CAAA;AAEA;;AACc,SAAUC,OAAV,GAAiB;AAC7B,EAAA,IAAA,eAAA,GAA6DC,cAAc,EAA3E;AAAA,MAAOC,OAAP,mBAAOA,OAAP;AAAA,MAAgBC,MAAhB,mBAAgBA,MAAhB;AAAA,MAA6BC,SAA7B,mBAAwBC,GAAxB;AAAA,MAAwCC,OAAxC,mBAAwCA,OAAxC;AAAA,MAAiDC,QAAjD,mBAAiDA,QAAjD,CAAA;;AAEA,EAAI,IAAA,CAACR,SAAL,EAAgB;AACdA,IAAAA,SAAS,GAAG,IAAZ,CAAA;AACAS,IAAAA,OAAO,CAACC,IAAR,CACE,6GADF,CAAA,CAAA;AAGD,GAAA;;AAED,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,UAAU,CAAC;AACTT,MAAAA,OAAO,EAAPA,OADS;AAETC,MAAAA,MAAM,EAANA,MAFS;AAGTE,MAAAA,GAAG,EAAED,SAHI;AAITE,MAAAA,OAAO,EAAPA,OAJS;AAKTC,MAAAA,QAAQ,EAARA,QAAAA;AALS,KAAD,CADZ,CAAA;AAAA,GADY,EASZ,CAACL,OAAD,EAAUE,SAAV,EAAqBD,MAArB,EAA6BG,OAA7B,EAAsCC,QAAtC,CATY,CAAd,CAAA;AAWD;;;;"}
1
+ {"version":3,"file":"use-intl.esm3.js","sources":["../../src/react/useLocale.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useLocale() {\n return useIntlContext().locale;\n}\n"],"names":["useLocale","useIntlContext","locale"],"mappings":";;AAEc,SAAUA,SAAV,GAAmB;AAC/B,EAAOC,OAAAA,cAAc,GAAGC,MAAxB,CAAA;AACD;;;;"}
@@ -1,25 +1,8 @@
1
- import { useMemo } from 'react';
2
- import createFormatter from '../core/use-intl.esm4.js';
3
1
  import useIntlContext from './use-intl.esm10.js';
4
2
 
5
- function useFormatter() {
6
- var _useIntlContext = useIntlContext(),
7
- formats = _useIntlContext.formats,
8
- locale = _useIntlContext.locale,
9
- globalNow = _useIntlContext.now,
10
- onError = _useIntlContext.onError,
11
- timeZone = _useIntlContext.timeZone;
12
-
13
- return useMemo(function () {
14
- return createFormatter({
15
- formats: formats,
16
- locale: locale,
17
- now: globalNow,
18
- onError: onError,
19
- timeZone: timeZone
20
- });
21
- }, [formats, globalNow, locale, onError, timeZone]);
3
+ function useTimeZone() {
4
+ return useIntlContext().timeZone;
22
5
  }
23
6
 
24
- export { useFormatter as default };
7
+ export { useTimeZone as default };
25
8
  //# sourceMappingURL=use-intl.esm5.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm5.js","sources":["../../src/react/useFormatter.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createFormatter from '../core/createFormatter';\nimport useIntlContext from './useIntlContext';\n\nexport default function useFormatter() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n return useMemo(\n () =>\n createFormatter({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["useFormatter","useIntlContext","formats","locale","globalNow","now","onError","timeZone","useMemo","createFormatter"],"mappings":";;;;AAIc,SAAUA,YAAV,GAAsB;AAClC,EAAA,IAAA,eAAA,GAA6DC,cAAc,EAA3E;AAAA,MAAOC,OAAP,mBAAOA,OAAP;AAAA,MAAgBC,MAAhB,mBAAgBA,MAAhB;AAAA,MAA6BC,SAA7B,mBAAwBC,GAAxB;AAAA,MAAwCC,OAAxC,mBAAwCA,OAAxC;AAAA,MAAiDC,QAAjD,mBAAiDA,QAAjD,CAAA;;AAEA,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,eAAe,CAAC;AACdP,MAAAA,OAAO,EAAPA,OADc;AAEdC,MAAAA,MAAM,EAANA,MAFc;AAGdE,MAAAA,GAAG,EAAED,SAHS;AAIdE,MAAAA,OAAO,EAAPA,OAJc;AAKdC,MAAAA,QAAQ,EAARA,QAAAA;AALc,KAAD,CADjB,CAAA;AAAA,GADY,EASZ,CAACL,OAAD,EAAUE,SAAV,EAAqBD,MAArB,EAA6BG,OAA7B,EAAsCC,QAAtC,CATY,CAAd,CAAA;AAWD;;;;"}
1
+ {"version":3,"file":"use-intl.esm5.js","sources":["../../src/react/useTimeZone.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useTimeZone() {\n return useIntlContext().timeZone;\n}\n"],"names":["useTimeZone","useIntlContext","timeZone"],"mappings":";;AAEc,SAAUA,WAAV,GAAqB;AACjC,EAAOC,OAAAA,cAAc,GAAGC,QAAxB,CAAA;AACD;;;;"}
@@ -1,26 +1,25 @@
1
+ import { useMemo } from 'react';
2
+ import createFormatter from '../core/use-intl.esm3.js';
1
3
  import useIntlContext from './use-intl.esm10.js';
2
- import useTranslationsImpl from './use-intl.esm11.js';
3
4
 
4
- /**
5
- * Translates messages from the given namespace by using the ICU syntax.
6
- * See https://formatjs.io/docs/core-concepts/icu-syntax.
7
- *
8
- * If no namespace is provided, all available messages are returned.
9
- * The namespace can also indicate nesting by using a dot
10
- * (e.g. `namespace.Component`).
11
- */
5
+ function useFormatter() {
6
+ var _useIntlContext = useIntlContext(),
7
+ formats = _useIntlContext.formats,
8
+ locale = _useIntlContext.locale,
9
+ globalNow = _useIntlContext.now,
10
+ onError = _useIntlContext.onError,
11
+ timeZone = _useIntlContext.timeZone;
12
12
 
13
- function useTranslations(namespace) {
14
- var context = useIntlContext();
15
- var messages = context.messages; // We have to wrap the actual hook so the type inference for the optional
16
- // namespace works correctly. See https://stackoverflow.com/a/71529575/343045
17
- // The prefix ("!") is arbitrary.
18
-
19
- return useTranslationsImpl({
20
- '!': messages
21
- }, // @ts-ignore
22
- namespace ? "!." + namespace : '!', '!');
13
+ return useMemo(function () {
14
+ return createFormatter({
15
+ formats: formats,
16
+ locale: locale,
17
+ now: globalNow,
18
+ onError: onError,
19
+ timeZone: timeZone
20
+ });
21
+ }, [formats, globalNow, locale, onError, timeZone]);
23
22
  }
24
23
 
25
- export { useTranslations as default };
24
+ export { useFormatter as default };
26
25
  //# sourceMappingURL=use-intl.esm6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm6.js","sources":["../../src/react/useTranslations.tsx"],"sourcesContent":["import {ReactElement, ReactNodeArray} from 'react';\nimport Formats from '../core/Formats';\nimport TranslationValues, {\n RichTranslationValues\n} from '../core/TranslationValues';\nimport MessageKeys from '../core/utils/MessageKeys';\nimport NamespaceKeys from '../core/utils/NamespaceKeys';\nimport NestedKeyOf from '../core/utils/NestedKeyOf';\nimport NestedValueOf from '../core/utils/NestedValueOf';\nimport useIntlContext from './useIntlContext';\nimport useTranslationsImpl from './useTranslationsImpl';\n\n/**\n * Translates messages from the given namespace by using the ICU syntax.\n * See https://formatjs.io/docs/core-concepts/icu-syntax.\n *\n * If no namespace is provided, all available messages are returned.\n * The namespace can also indicate nesting by using a dot\n * (e.g. `namespace.Component`).\n */\nexport default function useTranslations<\n NestedKey extends NamespaceKeys<\n IntlMessages,\n NestedKeyOf<IntlMessages>\n > = never\n>(\n namespace?: NestedKey\n): // Explicitly defining the return type is necessary as TypeScript would get it wrong\n{\n // Default invocation\n <\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey,\n values?: TranslationValues,\n formats?: Partial<Formats>\n ): string;\n\n // `rich`\n rich<\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey,\n values?: RichTranslationValues,\n formats?: Partial<Formats>\n ): string | ReactElement | ReactNodeArray;\n\n // `raw`\n raw<\n TargetKey extends MessageKeys<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >,\n NestedKeyOf<\n NestedValueOf<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >\n >\n >\n >(\n key: TargetKey\n ): any;\n} {\n const context = useIntlContext();\n const messages = context.messages as IntlMessages;\n\n // We have to wrap the actual hook so the type inference for the optional\n // namespace works correctly. See https://stackoverflow.com/a/71529575/343045\n // The prefix (\"!\") is arbitrary.\n return useTranslationsImpl<\n {'!': IntlMessages},\n [NestedKey] extends [never] ? '!' : `!.${NestedKey}`\n >(\n {'!': messages},\n // @ts-ignore\n namespace ? `!.${namespace}` : '!',\n '!'\n );\n}\n"],"names":["useTranslations","namespace","context","useIntlContext","messages","useTranslationsImpl"],"mappings":";;;AAYA;;;;;;;AAOG;;AACqB,SAAAA,eAAA,CAMtBC,SANsB,EAMD;AA6DrB,EAAMC,IAAAA,OAAO,GAAGC,cAAc,EAA9B,CAAA;AACA,EAAA,IAAMC,QAAQ,GAAGF,OAAO,CAACE,QAAzB,CA9DqB;AAiErB;AACA;;AACA,EAAA,OAAOC,mBAAmB,CAIxB;AAAC,IAAKD,GAAAA,EAAAA,QAAAA;AAAN,GAJwB;AAMxBH,EAAAA,SAAS,GAAQA,IAAAA,GAAAA,SAAR,GAAsB,GANP,EAOxB,GAPwB,CAA1B,CAAA;AASD;;;;"}
1
+ {"version":3,"file":"use-intl.esm6.js","sources":["../../src/react/useFormatter.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createFormatter from '../core/createFormatter';\nimport useIntlContext from './useIntlContext';\n\nexport default function useFormatter() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n return useMemo(\n () =>\n createFormatter({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["useFormatter","useIntlContext","formats","locale","globalNow","now","onError","timeZone","useMemo","createFormatter"],"mappings":";;;;AAIc,SAAUA,YAAV,GAAsB;AAClC,EAAA,IAAA,eAAA,GAA6DC,cAAc,EAA3E;AAAA,MAAOC,OAAP,mBAAOA,OAAP;AAAA,MAAgBC,MAAhB,mBAAgBA,MAAhB;AAAA,MAA6BC,SAA7B,mBAAwBC,GAAxB;AAAA,MAAwCC,OAAxC,mBAAwCA,OAAxC;AAAA,MAAiDC,QAAjD,mBAAiDA,QAAjD,CAAA;;AAEA,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,eAAe,CAAC;AACdP,MAAAA,OAAO,EAAPA,OADc;AAEdC,MAAAA,MAAM,EAANA,MAFc;AAGdE,MAAAA,GAAG,EAAED,SAHS;AAIdE,MAAAA,OAAO,EAAPA,OAJc;AAKdC,MAAAA,QAAQ,EAARA,QAAAA;AALc,KAAD,CADjB,CAAA;AAAA,GADY,EASZ,CAACL,OAAD,EAAUE,SAAV,EAAqBD,MAArB,EAA6BG,OAA7B,EAAsCC,QAAtC,CATY,CAAd,CAAA;AAWD;;;;"}
@@ -1,8 +1,33 @@
1
+ import { useMemo } from 'react';
2
+ import createIntl from '../core/use-intl.esm4.js';
1
3
  import useIntlContext from './use-intl.esm10.js';
2
4
 
3
- function useTimeZone() {
4
- return useIntlContext().timeZone;
5
+ var hasWarned = false;
6
+ /** @deprecated Switch to `useFormatter` instead. */
7
+
8
+ function useIntl() {
9
+ var _useIntlContext = useIntlContext(),
10
+ formats = _useIntlContext.formats,
11
+ locale = _useIntlContext.locale,
12
+ globalNow = _useIntlContext.now,
13
+ onError = _useIntlContext.onError,
14
+ timeZone = _useIntlContext.timeZone;
15
+
16
+ if (!hasWarned) {
17
+ hasWarned = true;
18
+ console.warn('`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.');
19
+ }
20
+
21
+ return useMemo(function () {
22
+ return createIntl({
23
+ formats: formats,
24
+ locale: locale,
25
+ now: globalNow,
26
+ onError: onError,
27
+ timeZone: timeZone
28
+ });
29
+ }, [formats, globalNow, locale, onError, timeZone]);
5
30
  }
6
31
 
7
- export { useTimeZone as default };
32
+ export { useIntl as default };
8
33
  //# sourceMappingURL=use-intl.esm7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm7.js","sources":["../../src/react/useTimeZone.tsx"],"sourcesContent":["import useIntlContext from './useIntlContext';\n\nexport default function useTimeZone() {\n return useIntlContext().timeZone;\n}\n"],"names":["useTimeZone","useIntlContext","timeZone"],"mappings":";;AAEc,SAAUA,WAAV,GAAqB;AACjC,EAAOC,OAAAA,cAAc,GAAGC,QAAxB,CAAA;AACD;;;;"}
1
+ {"version":3,"file":"use-intl.esm7.js","sources":["../../src/react/useIntl.tsx"],"sourcesContent":["import {useMemo} from 'react';\nimport createIntl from '../core/createIntl';\nimport useIntlContext from './useIntlContext';\n\nlet hasWarned = false;\n\n/** @deprecated Switch to `useFormatter` instead. */\nexport default function useIntl() {\n const {formats, locale, now: globalNow, onError, timeZone} = useIntlContext();\n\n if (!hasWarned) {\n hasWarned = true;\n console.warn(\n '`useIntl()` is deprecated and will be removed in the next major version. Please switch to `useFormatter()`.'\n );\n }\n\n return useMemo(\n () =>\n createIntl({\n formats,\n locale,\n now: globalNow,\n onError,\n timeZone\n }),\n [formats, globalNow, locale, onError, timeZone]\n );\n}\n"],"names":["hasWarned","useIntl","useIntlContext","formats","locale","globalNow","now","onError","timeZone","console","warn","useMemo","createIntl"],"mappings":";;;;AAIA,IAAIA,SAAS,GAAG,KAAhB,CAAA;AAEA;;AACc,SAAUC,OAAV,GAAiB;AAC7B,EAAA,IAAA,eAAA,GAA6DC,cAAc,EAA3E;AAAA,MAAOC,OAAP,mBAAOA,OAAP;AAAA,MAAgBC,MAAhB,mBAAgBA,MAAhB;AAAA,MAA6BC,SAA7B,mBAAwBC,GAAxB;AAAA,MAAwCC,OAAxC,mBAAwCA,OAAxC;AAAA,MAAiDC,QAAjD,mBAAiDA,QAAjD,CAAA;;AAEA,EAAI,IAAA,CAACR,SAAL,EAAgB;AACdA,IAAAA,SAAS,GAAG,IAAZ,CAAA;AACAS,IAAAA,OAAO,CAACC,IAAR,CACE,6GADF,CAAA,CAAA;AAGD,GAAA;;AAED,EAAA,OAAOC,OAAO,CACZ,YAAA;AAAA,IAAA,OACEC,UAAU,CAAC;AACTT,MAAAA,OAAO,EAAPA,OADS;AAETC,MAAAA,MAAM,EAANA,MAFS;AAGTE,MAAAA,GAAG,EAAED,SAHI;AAITE,MAAAA,OAAO,EAAPA,OAJS;AAKTC,MAAAA,QAAQ,EAARA,QAAAA;AALS,KAAD,CADZ,CAAA;AAAA,GADY,EASZ,CAACL,OAAD,EAAUE,SAAV,EAAqBD,MAArB,EAA6BG,OAA7B,EAAsCC,QAAtC,CATY,CAAd,CAAA;AAWD;;;;"}
@@ -1,33 +1,6 @@
1
- import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/use-intl.esm.js';
2
- import { defaultOnError, defaultGetMessageFallback } from '../core/use-intl.esm5.js';
3
- import validateMessages from '../core/use-intl.esm9.js';
1
+ import { createContext } from 'react';
4
2
 
5
- var _excluded = ["getMessageFallback", "messages", "onError"];
6
- /**
7
- * Enhances the incoming props with defaults.
8
- */
3
+ var IntlContext = /*#__PURE__*/createContext(undefined);
9
4
 
10
- function getIntlContextValue(_ref) {
11
- var getMessageFallback = _ref.getMessageFallback,
12
- messages = _ref.messages,
13
- onError = _ref.onError,
14
- rest = _objectWithoutPropertiesLoose(_ref, _excluded);
15
-
16
- var finalOnError = onError || defaultOnError;
17
- var finalGetMessageFallback = getMessageFallback || defaultGetMessageFallback;
18
-
19
- if (process.env.NODE_ENV !== 'production') {
20
- if (messages) {
21
- validateMessages(messages, finalOnError);
22
- }
23
- }
24
-
25
- return _extends({}, rest, {
26
- messages: messages,
27
- onError: finalOnError,
28
- getMessageFallback: finalGetMessageFallback
29
- });
30
- }
31
-
32
- export { getIntlContextValue as default };
5
+ export { IntlContext as default };
33
6
  //# sourceMappingURL=use-intl.esm8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm8.js","sources":["../../src/react/getIntlContextValue.tsx"],"sourcesContent":["import {defaultGetMessageFallback, defaultOnError} from '../core/defaults';\nimport validateMessages from '../core/validateMessages';\nimport IntlProviderProps from './IntlProviderProps';\n\n/**\n * Enhances the incoming props with defaults.\n */\nexport default function getIntlContextValue<\n // This is a generic to allow for stricter typing. E.g.\n // the RSC integration always provides a `now` value.\n Props extends Omit<IntlProviderProps, 'children'>\n>({getMessageFallback, messages, onError, ...rest}: Props) {\n const finalOnError = onError || defaultOnError;\n const finalGetMessageFallback =\n getMessageFallback || defaultGetMessageFallback;\n\n if (process.env.NODE_ENV !== 'production') {\n if (messages) {\n validateMessages(messages, finalOnError);\n }\n }\n\n return {\n ...rest,\n messages,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback\n };\n}\n"],"names":["getIntlContextValue","getMessageFallback","messages","onError","rest","finalOnError","defaultOnError","finalGetMessageFallback","defaultGetMessageFallback","process","env","NODE_ENV","validateMessages"],"mappings":";;;;;AAIA;;AAEG;;AACqB,SAAAA,mBAAA,CAIiC,IAAA,EAAA;AAAA,EAAtDC,IAAAA,kBAAsD,QAAtDA,kBAAsD;AAAA,MAAlCC,QAAkC,QAAlCA,QAAkC;AAAA,MAAxBC,OAAwB,QAAxBA,OAAwB;AAAA,MAAZC,IAAY,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AACvD,EAAA,IAAMC,YAAY,GAAGF,OAAO,IAAIG,cAAhC,CAAA;AACA,EAAA,IAAMC,uBAAuB,GAC3BN,kBAAkB,IAAIO,yBADxB,CAAA;;AAGA,EAAA,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,IAAA,IAAIT,QAAJ,EAAc;AACZU,MAAAA,gBAAgB,CAACV,QAAD,EAAWG,YAAX,CAAhB,CAAA;AACD,KAAA;AACF,GAAA;;AAED,EAAA,OAAA,QAAA,CAAA,EAAA,EACKD,IADL,EAAA;AAEEF,IAAAA,QAAQ,EAARA,QAFF;AAGEC,IAAAA,OAAO,EAAEE,YAHX;AAIEJ,IAAAA,kBAAkB,EAAEM,uBAAAA;AAJtB,GAAA,CAAA,CAAA;AAMD;;;;"}
1
+ {"version":3,"file":"use-intl.esm8.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport {InitializedIntlConfig} from '../core/IntlConfig';\n\nconst IntlContext = createContext<InitializedIntlConfig | undefined>(undefined);\n\nexport default IntlContext;\n"],"names":["IntlContext","createContext","undefined"],"mappings":";;AAGA,IAAMA,WAAW,gBAAGC,aAAa,CAAoCC,SAApC;;;;"}
@@ -1,6 +1,33 @@
1
- import { createContext } from 'react';
1
+ import { objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, extends as _extends } from '../_virtual/use-intl.esm.js';
2
+ import { defaultOnError, defaultGetMessageFallback } from '../core/use-intl.esm6.js';
3
+ import validateMessages from '../core/use-intl.esm9.js';
2
4
 
3
- var IntlContext = /*#__PURE__*/createContext(undefined);
5
+ var _excluded = ["getMessageFallback", "messages", "onError"];
6
+ /**
7
+ * Enhances the incoming props with defaults.
8
+ */
4
9
 
5
- export { IntlContext as default };
10
+ function getInitializedConfig(_ref) {
11
+ var getMessageFallback = _ref.getMessageFallback,
12
+ messages = _ref.messages,
13
+ onError = _ref.onError,
14
+ rest = _objectWithoutPropertiesLoose(_ref, _excluded);
15
+
16
+ var finalOnError = onError || defaultOnError;
17
+ var finalGetMessageFallback = getMessageFallback || defaultGetMessageFallback;
18
+
19
+ if (process.env.NODE_ENV !== 'production') {
20
+ if (messages) {
21
+ validateMessages(messages, finalOnError);
22
+ }
23
+ }
24
+
25
+ return _extends({}, rest, {
26
+ messages: messages,
27
+ onError: finalOnError,
28
+ getMessageFallback: finalGetMessageFallback
29
+ });
30
+ }
31
+
32
+ export { getInitializedConfig as default };
6
33
  //# sourceMappingURL=use-intl.esm9.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-intl.esm9.js","sources":["../../src/react/IntlContext.tsx"],"sourcesContent":["import {createContext} from 'react';\nimport IntlContextValue from './IntlContextValue';\n\nconst IntlContext = createContext<IntlContextValue | undefined>(undefined);\n\nexport default IntlContext;\n"],"names":["IntlContext","createContext","undefined"],"mappings":";;AAGA,IAAMA,WAAW,gBAAGC,aAAa,CAA+BC,SAA/B;;;;"}
1
+ {"version":3,"file":"use-intl.esm9.js","sources":["../../src/react/getInitializedConfig.tsx"],"sourcesContent":["import IntlConfig, {InitializedIntlConfig} from '../core/IntlConfig';\nimport {defaultGetMessageFallback, defaultOnError} from '../core/defaults';\nimport validateMessages from '../core/validateMessages';\n\n/**\n * Enhances the incoming props with defaults.\n */\nexport default function getInitializedConfig<\n // This is a generic to allow for stricter typing. E.g.\n // the RSC integration always provides a `now` value.\n Props extends Omit<IntlConfig, 'children'>\n>({\n getMessageFallback,\n messages,\n onError,\n ...rest\n}: Props): InitializedIntlConfig {\n const finalOnError = onError || defaultOnError;\n const finalGetMessageFallback =\n getMessageFallback || defaultGetMessageFallback;\n\n if (process.env.NODE_ENV !== 'production') {\n if (messages) {\n validateMessages(messages, finalOnError);\n }\n }\n\n return {\n ...rest,\n messages,\n onError: finalOnError,\n getMessageFallback: finalGetMessageFallback\n };\n}\n"],"names":["getInitializedConfig","getMessageFallback","messages","onError","rest","finalOnError","defaultOnError","finalGetMessageFallback","defaultGetMessageFallback","process","env","NODE_ENV","validateMessages"],"mappings":";;;;;AAIA;;AAEG;;AACqB,SAAAA,oBAAA,CAShB,IAAA,EAAA;AAAA,EAJNC,IAAAA,kBAIM,QAJNA,kBAIM;AAAA,MAHNC,QAGM,QAHNA,QAGM;AAAA,MAFNC,OAEM,QAFNA,OAEM;AAAA,MADHC,IACG,GAAA,6BAAA,CAAA,IAAA,EAAA,SAAA,CAAA,CAAA;;AACN,EAAA,IAAMC,YAAY,GAAGF,OAAO,IAAIG,cAAhC,CAAA;AACA,EAAA,IAAMC,uBAAuB,GAC3BN,kBAAkB,IAAIO,yBADxB,CAAA;;AAGA,EAAA,IAAIC,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;AACzC,IAAA,IAAIT,QAAJ,EAAc;AACZU,MAAAA,gBAAgB,CAACV,QAAD,EAAWG,YAAX,CAAhB,CAAA;AACD,KAAA;AACF,GAAA;;AAED,EAAA,OAAA,QAAA,CAAA,EAAA,EACKD,IADL,EAAA;AAEEF,IAAAA,QAAQ,EAARA,QAFF;AAGEC,IAAAA,OAAO,EAAEE,YAHX;AAIEJ,IAAAA,kBAAkB,EAAEM,uBAAAA;AAJtB,GAAA,CAAA,CAAA;AAMD;;;;"}
@@ -1,5 +1,5 @@
1
1
  export default function useFormatter(): {
2
2
  dateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
3
- number: (value: number, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
3
+ number: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
4
4
  relativeTime: (date: number | Date, now?: number | Date | undefined) => string;
5
5
  };
@@ -1,6 +1,6 @@
1
- /** @deprecated Switch to `useFormatter` */
1
+ /** @deprecated Switch to `useFormatter` instead. */
2
2
  export default function useIntl(): {
3
3
  formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
4
- formatNumber: (value: number, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
4
+ formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
5
5
  formatRelativeTime: (date: number | Date, now?: number | Date | undefined) => string;
6
6
  };
@@ -1 +1 @@
1
- export default function useIntlContext(): import("./IntlContextValue").default;
1
+ export default function useIntlContext(): import("../core/IntlConfig").InitializedIntlConfig<import("../core/AbstractIntlMessages").default>;
@@ -1,9 +1,10 @@
1
1
  import Formats from './Formats';
2
2
  import IntlError from './IntlError';
3
+ import { AbstractIntlMessages, RichTranslationValues } from '.';
3
4
  /**
4
5
  * Should be used for entry points that configure the library.
5
6
  */
6
- declare type IntlConfiguration = {
7
+ declare type IntlConfig<Messages = AbstractIntlMessages> = {
7
8
  /** A valid Unicode locale tag (e.g. "en" or "en-GB"). */
8
9
  locale: string;
9
10
  /** Global formats can be provided to achieve consistent
@@ -34,13 +35,19 @@ declare type IntlConfiguration = {
34
35
  * afterwards the current date will be returned continuously.
35
36
  */
36
37
  now?: Date;
38
+ /** All messages that will be available. */
39
+ messages?: Messages;
40
+ /** Global default values for translation values and rich text elements.
41
+ * Can be used for consistent usage or styling of rich text elements.
42
+ * Defaults will be overidden by locally provided values. */
43
+ defaultTranslationValues?: RichTranslationValues;
37
44
  };
38
45
  /**
39
46
  * A stricter set of the configuration that should be used internally
40
47
  * once defaults are assigned to `IntlConfiguration`.
41
48
  */
42
- export declare type InitializedIntlConfiguration = IntlConfiguration & {
43
- onError: NonNullable<IntlConfiguration['onError']>;
44
- getMessageFallback: NonNullable<IntlConfiguration['getMessageFallback']>;
49
+ export declare type InitializedIntlConfig<Messages = AbstractIntlMessages> = IntlConfig<Messages> & {
50
+ onError: NonNullable<IntlConfig<Messages>['onError']>;
51
+ getMessageFallback: NonNullable<IntlConfig<Messages>['getMessageFallback']>;
45
52
  };
46
- export default IntlConfiguration;
53
+ export default IntlConfig;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=IntlConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IntlConfig.js","sourceRoot":"","sources":["../../../src/core/IntlConfig.tsx"],"names":[],"mappings":""}
@@ -2,7 +2,7 @@ import IntlMessageFormat from 'intl-messageformat';
2
2
  import { ReactElement, ReactNodeArray } from 'react';
3
3
  import AbstractIntlMessages from './AbstractIntlMessages';
4
4
  import Formats from './Formats';
5
- import { InitializedIntlConfiguration } from './IntlConfiguration';
5
+ import { InitializedIntlConfig } from './IntlConfig';
6
6
  import IntlError from './IntlError';
7
7
  import TranslationValues, { RichTranslationValues } from './TranslationValues';
8
8
  import MessageKeys from './utils/MessageKeys';
@@ -13,7 +13,7 @@ export declare function getMessagesOrError<Messages extends AbstractIntlMessages
13
13
  namespace?: string;
14
14
  onError?(error: IntlError): void;
15
15
  }): AbstractIntlMessages | IntlError;
16
- export declare type CreateBaseTranslatorProps<Messages> = InitializedIntlConfiguration & {
16
+ export declare type CreateBaseTranslatorProps<Messages> = InitializedIntlConfig & {
17
17
  cachedFormatsByLocale?: Record<string, Record<string, IntlMessageFormat>>;
18
18
  defaultTranslationValues?: RichTranslationValues;
19
19
  namespace?: string;
@@ -1 +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AAC,iBAAiB,GAAG,SAClB,SAAS,CAAC,CAAC,CAAC,eAAe,SAAS,IAAI,CAAC,CAAC,CAAC,UAC7C,uFAAuF;gBACzF,CAAC,CAAC,SAAS,CACd,CAAC;SACH;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,IAAI,GAAG,eAAe,CAAC;IAEnC,WAAW,CAAC,GAAG,GAAG;IAChB,+EAA+E;IAC/E,GAAW,EACN,EAAE;QACP,IAAI,eAAe,YAAY,SAAS,EAAE;YACxC,kDAAkD;YAClD,OAAO,kBAAkB,CAAC;gBACxB,KAAK,EAAE,eAAe;gBACtB,GAAG;gBACH,SAAS;aACV,CAAC,CAAC;SACJ;QACD,MAAM,QAAQ,GAAG,eAAe,CAAC;QAEjC,IAAI;YACF,OAAO,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;SAC9C;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,6BAA6B,CAClC,GAAG,EACH,aAAa,CAAC,eAAe,EAC5B,KAAe,CAAC,OAAO,CACzB,CAAC;SACH;IACH,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC"}
1
+ {"version":3,"file":"createBaseTranslator.js","sourceRoot":"","sources":["../../../src/core/createBaseTranslator.tsx"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,OAAO,iBAAiB,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,YAAY,EACZ,cAAc,EAIf,MAAM,OAAO,CAAC;AAIf,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAErD,OAAO,iCAAiC,MAAM,qCAAqC,CAAC;AACpF,OAAO,EAAC,yBAAyB,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAKrE,SAAS,WAAW,CAClB,QAA0C,EAC1C,GAAW,EACX,SAAkB;IAElB,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,IAAI,KAAK,CACb,OAAO,CAAC,GAAG,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CAAC,QAAQ,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;SAC9C;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,6BAA6B,CAClC,GAAG,EACH,aAAa,CAAC,eAAe,EAC5B,KAAe,CAAC,OAAO,CACzB,CAAC;SACH;IACH,CAAC,CAAC;IAEF,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import Formats from './Formats';
2
- import IntlConfiguration from './IntlConfiguration';
2
+ import IntlConfig from './IntlConfig';
3
3
  import TranslationValues from './TranslationValues';
4
4
  import { CoreRichTranslationValues } from './createTranslatorImpl';
5
5
  import MessageKeys from './utils/MessageKeys';
@@ -14,8 +14,8 @@ import NestedValueOf from './utils/NestedValueOf';
14
14
  * The namespace can also indicate nesting by using a dot
15
15
  * (e.g. `namespace.Component`).
16
16
  */
17
- export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ onError, getMessageFallback, messages, namespace, ...rest }: IntlConfiguration & {
18
- messages: IntlMessages;
17
+ export default function createTranslator<NestedKey extends NamespaceKeys<IntlMessages, NestedKeyOf<IntlMessages>> = never>({ onError, getMessageFallback, messages, namespace, ...rest }: Omit<IntlConfig<IntlMessages>, 'defaultTranslationValues' | 'messages'> & {
18
+ messages: NonNullable<IntlConfig<IntlMessages>['messages']>;
19
19
  namespace?: NestedKey;
20
20
  }): {
21
21
  <TargetKey extends MessageKeys<NestedValueOf<{
@@ -1,9 +1,9 @@
1
1
  import AbstractIntlMessages from './AbstractIntlMessages';
2
- import { InitializedIntlConfiguration } from './IntlConfiguration';
2
+ import { InitializedIntlConfig } from './IntlConfig';
3
3
  import { TranslationValue } from './TranslationValues';
4
4
  import NestedKeyOf from './utils/NestedKeyOf';
5
5
  export declare type CoreRichTranslationValues = Record<string, TranslationValue | ((chunks: string) => string)>;
6
- export declare type CreateTranslatorImplProps<Messages> = InitializedIntlConfiguration & {
6
+ export declare type CreateTranslatorImplProps<Messages> = Omit<InitializedIntlConfig, 'messages'> & {
7
7
  namespace: string;
8
8
  messages: Messages;
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"createTranslatorImpl.js","sourceRoot":"","sources":["../../../src/core/createTranslatorImpl.tsx"],"names":[],"mappings":"AAEA,OAAO,SAAS,EAAE,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAErD,OAAO,oBAAoB,EAAE,EAAC,kBAAkB,EAAC,MAAM,wBAAwB,CAAC;AAChF,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAclD,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAI1C,EACE,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,OAAO,EACP,GAAG,IAAI,EAC6B,EACtC,eAAuB;IAEvB,oDAAoD;IACpD,8CAA8C;IAC9C,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAa,CAAC;IACjD,SAAS,GAAG,gBAAgB,CAAC,SAAS,EAAE,eAAe,CAAc,CAAC;IAEtE,MAAM,UAAU,GAAG,oBAAoB,CAAsB;QAC3D,GAAG,IAAI;QACP,OAAO;QACP,kBAAkB;QAClB,eAAe,EAAE,kBAAkB,CAAC;YAClC,QAAQ;YACR,SAAS;YACT,OAAO;SACR,CAAyB;KAC3B,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,UAAU,CAAC,IAAI,CAAC;IAErC,SAAS,IAAI,CAAC,GAAG,IAAmC;QAClD,OAAO,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,2CAA2C;IAC3C,IAAI,CAAC,IAAI,GAAG,CACV,GAAuC;IACvC,kEAAkE;IAClE,MAAiC,EACjC,OAA4C,EACpC,EAAE;QACV,yDAAyD;QACzD,kDAAkD;QAClD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,MAA+B,EAAE,OAAO,CAAC,CAAC;QAE3E,4FAA4F;QAC5F,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,MAA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AO,UAAU,CAAC,GAAG,IAAI,CAAC,CAAC;IAC7B,CAAC;IAED,2CAA2C;IAC3C,IAAI,CAAC,IAAI,GAAG,CACV,GAAuC;IACvC,kEAAkE;IAClE,MAAiC,EACjC,OAA4C,EACpC,EAAE;QACV,yDAAyD;QACzD,kDAAkD;QAClD,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,MAA+B,EAAE,OAAO,CAAC,CAAC;QAE3E,4FAA4F;QAC5F,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;YAC9B,MAAM,KAAK,GAAG,IAAI,SAAS,CACzB,aAAa,CAAC,gBAAgB,EAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;gBACnC,CAAC,CAAC,iKAAiK;gBACnK,CAAC,CAAC,SAAS,CACd,CAAC;YAEF,OAAO,CAAC,KAAK,CAAC,CAAC;YACf,OAAO,kBAAkB,CAAC,EAAC,KAAK,EAAE,GAAG,EAAE,SAAS,EAAC,CAAC,CAAC;SACpD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,GAAG,CAAC;IAE1B,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,4 +1,4 @@
1
1
  /// <reference types="react" />
2
- import IntlContextValue from './IntlContextValue';
3
- declare const IntlContext: import("react").Context<IntlContextValue | undefined>;
2
+ import { InitializedIntlConfig } from '../core/IntlConfig';
3
+ declare const IntlContext: import("react").Context<InitializedIntlConfig<import("../core/AbstractIntlMessages").default> | undefined>;
4
4
  export default IntlContext;
@@ -1 +1 @@
1
- {"version":3,"file":"IntlContext.js","sourceRoot":"","sources":["../../../src/react/IntlContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAGpC,MAAM,WAAW,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAE3E,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"IntlContext.js","sourceRoot":"","sources":["../../../src/react/IntlContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAGpC,MAAM,WAAW,GAAG,aAAa,CAAoC,SAAS,CAAC,CAAC;AAEhF,eAAe,WAAW,CAAC"}
@@ -1,2 +1,7 @@
1
- import IntlProviderProps from './IntlProviderProps';
2
- export default function IntlProvider({ children, ...props }: IntlProviderProps): JSX.Element;
1
+ import { ReactNode } from 'react';
2
+ import IntlConfig from '../core/IntlConfig';
3
+ declare type Props = IntlConfig & {
4
+ children: ReactNode;
5
+ };
6
+ export default function IntlProvider({ children, ...props }: Props): JSX.Element;
7
+ export {};
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import IntlContext from './IntlContext';
3
- import getIntlContextValue from './getIntlContextValue';
3
+ import getInitializedConfig from './getInitializedConfig';
4
4
  export default function IntlProvider({ children, ...props }) {
5
- return (React.createElement(IntlContext.Provider, { value: getIntlContextValue(props) }, children));
5
+ return (React.createElement(IntlContext.Provider, { value: getInitializedConfig(props) }, children));
6
6
  }
7
7
  //# sourceMappingURL=IntlProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntlProvider.js","sourceRoot":"","sources":["../../../src/react/IntlProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AAExD,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAoB;IAC1E,OAAO,CACL,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,IACpD,QAAQ,CACY,CACxB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"IntlProvider.js","sourceRoot":"","sources":["../../../src/react/IntlProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAM1D,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAC,QAAQ,EAAE,GAAG,KAAK,EAAQ;IAC9D,OAAO,CACL,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,IACrD,QAAQ,CACY,CACxB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,5 @@
1
+ import IntlConfig, { InitializedIntlConfig } from '../core/IntlConfig';
2
+ /**
3
+ * Enhances the incoming props with defaults.
4
+ */
5
+ export default function getInitializedConfig<Props extends Omit<IntlConfig, 'children'>>({ getMessageFallback, messages, onError, ...rest }: Props): InitializedIntlConfig;
@@ -3,7 +3,7 @@ import validateMessages from '../core/validateMessages';
3
3
  /**
4
4
  * Enhances the incoming props with defaults.
5
5
  */
6
- export default function getIntlContextValue({ getMessageFallback, messages, onError, ...rest }) {
6
+ export default function getInitializedConfig({ getMessageFallback, messages, onError, ...rest }) {
7
7
  const finalOnError = onError || defaultOnError;
8
8
  const finalGetMessageFallback = getMessageFallback || defaultGetMessageFallback;
9
9
  if (process.env.NODE_ENV !== 'production') {
@@ -18,4 +18,4 @@ export default function getIntlContextValue({ getMessageFallback, messages, onEr
18
18
  getMessageFallback: finalGetMessageFallback
19
19
  };
20
20
  }
21
- //# sourceMappingURL=getIntlContextValue.js.map
21
+ //# sourceMappingURL=getInitializedConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getInitializedConfig.js","sourceRoot":"","sources":["../../../src/react/getInitializedConfig.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,yBAAyB,EAAE,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC3E,OAAO,gBAAgB,MAAM,0BAA0B,CAAC;AAExD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAI1C,EACA,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,GAAG,IAAI,EACD;IACN,MAAM,YAAY,GAAG,OAAO,IAAI,cAAc,CAAC;IAC/C,MAAM,uBAAuB,GAC3B,kBAAkB,IAAI,yBAAyB,CAAC;IAElD,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,IAAI,QAAQ,EAAE;YACZ,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;SAC1C;KACF;IAED,OAAO;QACL,GAAG,IAAI;QACP,QAAQ;QACR,OAAO,EAAE,YAAY;QACrB,kBAAkB,EAAE,uBAAuB;KAC5C,CAAC;AACJ,CAAC"}
@@ -1,4 +1,4 @@
1
- /** @deprecated Switch to `useFormatter` */
1
+ /** @deprecated Switch to `useFormatter` instead. */
2
2
  export default function useIntl(): {
3
3
  formatDateTime: (value: number | Date, formatOrOptions?: string | import("../core/DateTimeFormatOptions").default | undefined) => string;
4
4
  formatNumber: (value: number | bigint, formatOrOptions?: string | import("@formatjs/ecma402-abstract").NumberFormatOptions | undefined) => string;
@@ -2,7 +2,7 @@ import { useMemo } from 'react';
2
2
  import createIntl from '../core/createIntl';
3
3
  import useIntlContext from './useIntlContext';
4
4
  let hasWarned = false;
5
- /** @deprecated Switch to `useFormatter` */
5
+ /** @deprecated Switch to `useFormatter` instead. */
6
6
  export default function useIntl() {
7
7
  const { formats, locale, now: globalNow, onError, timeZone } = useIntlContext();
8
8
  if (!hasWarned) {
@@ -1 +1 @@
1
- {"version":3,"file":"useIntl.js","sourceRoot":"","sources":["../../../src/react/useIntl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,4CAA4C;AAC5C,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,cAAc,EAAE,CAAC;IAE9E,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,IAAI,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,6GAA6G,CAC9G,CAAC;KACH;IAED,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,UAAU,CAAC;QACT,OAAO;QACP,MAAM;QACN,GAAG,EAAE,SAAS;QACd,OAAO;QACP,QAAQ;KACT,CAAC,EACJ,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAChD,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"useIntl.js","sourceRoot":"","sources":["../../../src/react/useIntl.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAE9C,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,oDAAoD;AACpD,MAAM,CAAC,OAAO,UAAU,OAAO;IAC7B,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAC,GAAG,cAAc,EAAE,CAAC;IAE9E,IAAI,CAAC,SAAS,EAAE;QACd,SAAS,GAAG,IAAI,CAAC;QACjB,OAAO,CAAC,IAAI,CACV,6GAA6G,CAC9G,CAAC;KACH;IAED,OAAO,OAAO,CACZ,GAAG,EAAE,CACH,UAAU,CAAC;QACT,OAAO;QACP,MAAM;QACN,GAAG,EAAE,SAAS;QACd,OAAO;QACP,QAAQ;KACT,CAAC,EACJ,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAChD,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- export default function useIntlContext(): import("./IntlContextValue").default;
1
+ export default function useIntlContext(): import("../core/IntlConfig").InitializedIntlConfig<import("../core/AbstractIntlMessages").default>;
@@ -707,7 +707,7 @@ var _excluded$1 = ["getMessageFallback", "messages", "onError"];
707
707
  * Enhances the incoming props with defaults.
708
708
  */
709
709
 
710
- function getIntlContextValue(_ref) {
710
+ function getInitializedConfig(_ref) {
711
711
  var getMessageFallback = _ref.getMessageFallback,
712
712
  messages = _ref.messages,
713
713
  onError = _ref.onError,
@@ -735,7 +735,7 @@ function IntlProvider(_ref) {
735
735
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
736
736
 
737
737
  return React__default["default"].createElement(IntlContext.Provider, {
738
- value: getIntlContextValue(props)
738
+ value: getInitializedConfig(props)
739
739
  }, children);
740
740
  }
741
741
 
@@ -880,7 +880,7 @@ function useFormatter() {
880
880
  }
881
881
 
882
882
  var hasWarned = false;
883
- /** @deprecated Switch to `useFormatter` */
883
+ /** @deprecated Switch to `useFormatter` instead. */
884
884
 
885
885
  function useIntl() {
886
886
  var _useIntlContext = useIntlContext(),