react-intl 5.24.8 → 6.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.
@@ -1,12 +1,12 @@
1
1
  import * as React from 'react';
2
- import type { Options as IntlMessageFormatOptions } from 'intl-messageformat';
2
+ import type { FormatXMLElementFn, Options as IntlMessageFormatOptions, PrimitiveType } from 'intl-messageformat';
3
3
  import { MessageDescriptor } from '@formatjs/intl';
4
- export interface Props<V extends Record<string, any> = Record<string, React.ReactNode>> extends MessageDescriptor {
4
+ export interface Props<V extends Record<string, any> = Record<string, React.ReactNode | PrimitiveType | FormatXMLElementFn<React.ReactNode, React.ReactNode>>> extends MessageDescriptor {
5
5
  values?: V;
6
6
  tagName?: React.ElementType<any>;
7
- children?(nodes: React.ReactNodeArray): React.ReactElement | null;
7
+ children?(nodes: React.ReactNode[]): React.ReactElement | null;
8
8
  ignoreTag?: IntlMessageFormatOptions['ignoreTag'];
9
9
  }
10
- declare const MemoizedFormattedMessage: React.NamedExoticComponent<Props<Record<string, React.ReactNode>>>;
10
+ declare const MemoizedFormattedMessage: React.NamedExoticComponent<Props<Record<string, string | number | boolean | Date | React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactFragment | React.ReactPortal | FormatXMLElementFn<React.ReactNode, React.ReactNode> | null | undefined>>>;
11
11
  export default MemoizedFormattedMessage;
12
12
  //# sourceMappingURL=message.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/message.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAC,OAAO,IAAI,wBAAwB,EAAC,MAAM,oBAAoB,CAAA;AAE3E,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAIhD,MAAM,WAAW,KAAK,CACpB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAC/D,SAAQ,iBAAiB;IACzB,MAAM,CAAC,EAAE,CAAC,CAAA;IACV,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAChC,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;IACjE,SAAS,CAAC,EAAE,wBAAwB,CAAC,WAAW,CAAC,CAAA;CAClD;AAwCD,QAAA,MAAM,wBAAwB,oEAAgD,CAAA;AAG9E,eAAe,wBAAwB,CAAA"}
1
+ {"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/message.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,kBAAkB,EAClB,OAAO,IAAI,wBAAwB,EACnC,aAAa,EACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAA;AAIhD,MAAM,WAAW,KAAK,CACpB,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CACpC,MAAM,EACJ,KAAK,CAAC,SAAS,GACf,aAAa,GACb,kBAAkB,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CACvD,CACD,SAAQ,iBAAiB;IACzB,MAAM,CAAC,EAAE,CAAC,CAAA;IACV,OAAO,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,CAAA;IAChC,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA;IAC9D,SAAS,CAAC,EAAE,wBAAwB,CAAC,WAAW,CAAC,CAAA;CAClD;AAwCD,QAAA,MAAM,wBAAwB,8QAAgD,CAAA;AAG9E,eAAe,wBAAwB,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { IntlConfig, IntlShape } from '../types';
2
+ import type { IntlConfig, IntlShape, ResolvedIntlConfig } from '../types';
3
3
  import { IntlCache, CreateIntlFn } from '@formatjs/intl';
4
4
  interface State {
5
5
  /**
@@ -25,7 +25,7 @@ interface State {
25
25
  export declare const createIntl: CreateIntlFn<React.ReactNode, IntlConfig, IntlShape>;
26
26
  export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
27
27
  static displayName: string;
28
- static defaultProps: Pick<import("../types").ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
28
+ static defaultProps: Pick<ResolvedIntlConfig, "onError" | "timeZone" | "fallbackOnEmptyString" | "formats" | "messages" | "defaultLocale" | "defaultFormats" | "textComponent">;
29
29
  private cache;
30
30
  state: State;
31
31
  static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,UAAU,CAAA;AAC9C,OAAO,EAEL,SAAS,EAET,YAAY,EAEb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAkED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CACnC,KAAK,CAAC,SAAS,EACf,UAAU,EACV,SAAS,CAmCV,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAa,CAG3D,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EACnC,KAAK,CACN;IACC,MAAM,CAAC,WAAW,SAAiB;IACnC,MAAM,CAAC,YAAY,gLAAsB;IACzC,OAAO,CAAC,KAAK,CAA+B;IAC5C,KAAK,EAAE,KAAK,CAIX;IAED,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,KAAK,GACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAWxB,MAAM,IAAI,GAAG,CAAC,OAAO;CAItB"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react-intl/src/components/provider.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAQ9B,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAE,kBAAkB,EAAC,MAAM,UAAU,CAAA;AACvE,OAAO,EAEL,SAAS,EAET,YAAY,EAGb,MAAM,gBAAgB,CAAA;AAQvB,UAAU,KAAK;IACb;;OAEG;IACH,KAAK,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;OAIG;IACH,UAAU,EAAE,UAAU,CAAA;CACvB;AAmED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,YAAY,CACnC,KAAK,CAAC,SAAS,EACf,UAAU,EACV,SAAS,CAsCV,CAAA;AAED,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,KAAK,CAAC,aAAa,CAG3D,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,EACnC,KAAK,CACN;IACC,MAAM,CAAC,WAAW,SAAiB;IACnC,MAAM,CAAC,YAAY,6JAAsB;IACzC,OAAO,CAAC,KAAK,CAA+B;IAC5C,KAAK,EAAE,KAAK,CAIX;IAED,MAAM,CAAC,wBAAwB,CAC7B,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,EAC3B,EAAC,UAAU,EAAE,KAAK,EAAC,EAAE,KAAK,GACzB,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI;IAWxB,MAAM,IAAI,GAAG,CAAC,OAAO;CAItB"}
@@ -23,6 +23,7 @@ function processIntlConfig(config) {
23
23
  defaultLocale: config.defaultLocale,
24
24
  defaultFormats: config.defaultFormats,
25
25
  onError: config.onError,
26
+ onWarn: config.onWarn,
26
27
  wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,
27
28
  defaultRichTextElements: config.defaultRichTextElements,
28
29
  };
@@ -63,17 +64,18 @@ var createIntl = function (_a, cache) {
63
64
  var rawDefaultRichTextElements = _a.defaultRichTextElements, config = (0, tslib_1.__rest)(_a, ["defaultRichTextElements"]);
64
65
  var defaultRichTextElements = assignUniqueKeysToFormatXMLElementFnArgument(rawDefaultRichTextElements);
65
66
  var coreIntl = (0, intl_1.createIntl)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, utils_1.DEFAULT_INTL_CONFIG), config), { defaultRichTextElements: defaultRichTextElements }), cache);
66
- return (0, tslib_1.__assign)((0, tslib_1.__assign)({}, coreIntl), { formatMessage: formatMessage.bind(null, {
67
- locale: coreIntl.locale,
68
- timeZone: coreIntl.timeZone,
69
- fallbackOnEmptyString: coreIntl.fallbackOnEmptyString,
70
- formats: coreIntl.formats,
71
- defaultLocale: coreIntl.defaultLocale,
72
- defaultFormats: coreIntl.defaultFormats,
73
- messages: coreIntl.messages,
74
- onError: coreIntl.onError,
75
- defaultRichTextElements: defaultRichTextElements,
76
- }, coreIntl.formatters) });
67
+ var resolvedConfig = {
68
+ locale: coreIntl.locale,
69
+ timeZone: coreIntl.timeZone,
70
+ fallbackOnEmptyString: coreIntl.fallbackOnEmptyString,
71
+ formats: coreIntl.formats,
72
+ defaultLocale: coreIntl.defaultLocale,
73
+ defaultFormats: coreIntl.defaultFormats,
74
+ messages: coreIntl.messages,
75
+ onError: coreIntl.onError,
76
+ defaultRichTextElements: defaultRichTextElements,
77
+ };
78
+ return (0, tslib_1.__assign)((0, tslib_1.__assign)({}, coreIntl), { formatMessage: formatMessage.bind(null, resolvedConfig, coreIntl.formatters), $t: formatMessage.bind(null, resolvedConfig, coreIntl.formatters) });
77
79
  };
78
80
  exports.createIntl = createIntl;
79
81
  var IntlProvider = /** @class */ (function (_super) {