react-intl 8.0.10 → 8.1.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.
@@ -1,18 +1,25 @@
1
+ /*
2
+ * Copyright 2015, Yahoo Inc.
3
+ * Copyrights licensed under the New BSD License.
4
+ * See the accompanying LICENSE file for terms.
5
+ */
6
+ import * as React from "react";
7
+ import "@formatjs/intl";
8
+ import useIntl from "./useIntl.js";
1
9
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import useIntl from './useIntl.js';
3
- var FormattedPlural = function (props) {
4
- var _a = useIntl(), formatPlural = _a.formatPlural, Text = _a.textComponent;
5
- var value = props.value, other = props.other, children = props.children;
6
- var pluralCategory = formatPlural(value, props);
7
- var formattedPlural = props[pluralCategory] || other;
8
- if (typeof children === 'function') {
9
- return children(formattedPlural);
10
- }
11
- if (Text) {
12
- return _jsx(Text, { children: formattedPlural });
13
- }
14
- // Work around @types/react where React.FC cannot return string
15
- return formattedPlural;
10
+ const FormattedPlural = (props) => {
11
+ const { formatPlural, textComponent: Text } = useIntl();
12
+ const { value, other, children } = props;
13
+ const pluralCategory = formatPlural(value, props);
14
+ const formattedPlural = props[pluralCategory] || other;
15
+ if (typeof children === "function") {
16
+ return children(formattedPlural);
17
+ }
18
+ if (Text) {
19
+ return /* @__PURE__ */ _jsx(Text, { children: formattedPlural });
20
+ }
21
+ // Work around @types/react where React.FC cannot return string
22
+ return formattedPlural;
16
23
  };
17
- FormattedPlural.displayName = 'FormattedPlural';
24
+ FormattedPlural.displayName = "FormattedPlural";
18
25
  export default FormattedPlural;
@@ -1,29 +1,28 @@
1
- import { IntlCache } from '@formatjs/intl';
2
- import * as React from 'react';
3
- import type { IntlConfig, IntlShape } from '../types.js';
4
- import { DefaultIntlConfig } from '../utils.js';
1
+ import { type IntlCache } from "@formatjs/intl";
2
+ import * as React from "react";
3
+ import type { IntlConfig, IntlShape } from "../types.js";
4
+ import { type DefaultIntlConfig } from "../utils.js";
5
5
  interface State {
6
- /**
7
- * Explicit intl cache to prevent memory leaks
8
- */
9
- cache: IntlCache;
10
- /**
11
- * Intl object we created
12
- */
13
- intl?: IntlShape;
14
- /**
15
- * list of memoized config we care about.
16
- * This is important since creating intl is
17
- * very expensive
18
- */
19
- prevConfig: IntlConfig;
6
+ /**
7
+ * Explicit intl cache to prevent memory leaks
8
+ */
9
+ cache: IntlCache;
10
+ /**
11
+ * Intl object we created
12
+ */
13
+ intl?: IntlShape;
14
+ /**
15
+ * list of memoized config we care about.
16
+ * This is important since creating intl is
17
+ * very expensive
18
+ */
19
+ prevConfig: IntlConfig;
20
20
  }
21
21
  export default class IntlProvider extends React.PureComponent<React.PropsWithChildren<IntlConfig>, State> {
22
- static displayName: string;
23
- static defaultProps: DefaultIntlConfig;
24
- private cache;
25
- state: State;
26
- static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
27
- render(): React.JSX.Element;
22
+ static displayName: string;
23
+ static defaultProps: DefaultIntlConfig;
24
+ private cache;
25
+ state: State;
26
+ static getDerivedStateFromProps(props: Readonly<IntlConfig>, { prevConfig, cache }: State): Partial<State> | null;
27
+ render(): React.JSX.Element;
28
28
  }
29
- export {};
@@ -1,60 +1,54 @@
1
- import { __extends } from "tslib";
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
1
  /*
4
- * Copyright 2015, Yahoo Inc.
5
- * Copyrights licensed under the New BSD License.
6
- * See the accompanying LICENSE file for terms.
7
- */
8
- import { createIntlCache } from '@formatjs/intl';
9
- import * as React from 'react';
10
- import { DEFAULT_INTL_CONFIG, invariantIntlContext, shallowEqual, } from '../utils.js';
11
- import { createIntl } from './createIntl.js';
12
- import { Provider } from './injectIntl.js';
2
+ * Copyright 2015, Yahoo Inc.
3
+ * Copyrights licensed under the New BSD License.
4
+ * See the accompanying LICENSE file for terms.
5
+ */
6
+ import { createIntlCache } from "@formatjs/intl";
7
+ import * as React from "react";
8
+ import { DEFAULT_INTL_CONFIG, invariantIntlContext, shallowEqual } from "../utils.js";
9
+ import { createIntl } from "./createIntl.js";
10
+ import { Provider } from "./injectIntl.js";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
13
12
  function processIntlConfig(config) {
14
- return {
15
- locale: config.locale,
16
- timeZone: config.timeZone,
17
- fallbackOnEmptyString: config.fallbackOnEmptyString,
18
- formats: config.formats,
19
- textComponent: config.textComponent,
20
- messages: config.messages,
21
- defaultLocale: config.defaultLocale,
22
- defaultFormats: config.defaultFormats,
23
- onError: config.onError,
24
- onWarn: config.onWarn,
25
- wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,
26
- defaultRichTextElements: config.defaultRichTextElements,
27
- };
13
+ return {
14
+ locale: config.locale,
15
+ timeZone: config.timeZone,
16
+ fallbackOnEmptyString: config.fallbackOnEmptyString,
17
+ formats: config.formats,
18
+ textComponent: config.textComponent,
19
+ messages: config.messages,
20
+ defaultLocale: config.defaultLocale,
21
+ defaultFormats: config.defaultFormats,
22
+ onError: config.onError,
23
+ onWarn: config.onWarn,
24
+ wrapRichTextChunksInFragment: config.wrapRichTextChunksInFragment,
25
+ defaultRichTextElements: config.defaultRichTextElements
26
+ };
27
+ }
28
+ export default class IntlProvider extends React.PureComponent {
29
+ static displayName = "IntlProvider";
30
+ static defaultProps = DEFAULT_INTL_CONFIG;
31
+ cache = createIntlCache();
32
+ state = {
33
+ cache: this.cache,
34
+ intl: createIntl(processIntlConfig(this.props), this.cache),
35
+ prevConfig: processIntlConfig(this.props)
36
+ };
37
+ static getDerivedStateFromProps(props, { prevConfig, cache }) {
38
+ const config = processIntlConfig(props);
39
+ if (!shallowEqual(prevConfig, config)) {
40
+ return {
41
+ intl: createIntl(config, cache),
42
+ prevConfig: config
43
+ };
44
+ }
45
+ return null;
46
+ }
47
+ render() {
48
+ invariantIntlContext(this.state.intl);
49
+ return /* @__PURE__ */ _jsx(Provider, {
50
+ value: this.state.intl,
51
+ children: this.props.children
52
+ });
53
+ }
28
54
  }
29
- var IntlProvider = /** @class */ (function (_super) {
30
- __extends(IntlProvider, _super);
31
- function IntlProvider() {
32
- var _this = _super !== null && _super.apply(this, arguments) || this;
33
- _this.cache = createIntlCache();
34
- _this.state = {
35
- cache: _this.cache,
36
- intl: createIntl(processIntlConfig(_this.props), _this.cache),
37
- prevConfig: processIntlConfig(_this.props),
38
- };
39
- return _this;
40
- }
41
- IntlProvider.getDerivedStateFromProps = function (props, _a) {
42
- var prevConfig = _a.prevConfig, cache = _a.cache;
43
- var config = processIntlConfig(props);
44
- if (!shallowEqual(prevConfig, config)) {
45
- return {
46
- intl: createIntl(config, cache),
47
- prevConfig: config,
48
- };
49
- }
50
- return null;
51
- };
52
- IntlProvider.prototype.render = function () {
53
- invariantIntlContext(this.state.intl);
54
- return _jsx(Provider, { value: this.state.intl, children: this.props.children });
55
- };
56
- IntlProvider.displayName = 'IntlProvider';
57
- IntlProvider.defaultProps = DEFAULT_INTL_CONFIG;
58
- return IntlProvider;
59
- }(React.PureComponent));
60
- export default IntlProvider;
@@ -1,10 +1,10 @@
1
- import * as React from 'react';
2
- import { FormatRelativeTimeOptions } from '@formatjs/intl';
1
+ import * as React from "react";
2
+ import { type FormatRelativeTimeOptions } from "@formatjs/intl";
3
3
  export interface Props extends FormatRelativeTimeOptions {
4
- value?: number;
5
- unit?: Intl.RelativeTimeFormatUnit;
6
- updateIntervalInSeconds?: number;
7
- children?(value: string): React.ReactElement | null;
4
+ value?: number;
5
+ unit?: Intl.RelativeTimeFormatUnit;
6
+ updateIntervalInSeconds?: number;
7
+ children?(value: string): React.ReactElement | null;
8
8
  }
9
9
  declare const FormattedRelativeTime: React.FC<Props>;
10
10
  export default FormattedRelativeTime;
@@ -1,126 +1,120 @@
1
- import { __assign, __rest } from "tslib";
2
- import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
3
1
  /*
4
- * Copyright 2015, Yahoo Inc.
5
- * Copyrights licensed under the New BSD License.
6
- * See the accompanying LICENSE file for terms.
7
- */
8
- import * as React from 'react';
9
- import { invariant } from '../utils.js';
10
- import useIntl from './useIntl.js';
11
- var MINUTE = 60;
12
- var HOUR = 60 * 60;
13
- var DAY = 60 * 60 * 24;
2
+ * Copyright 2015, Yahoo Inc.
3
+ * Copyrights licensed under the New BSD License.
4
+ * See the accompanying LICENSE file for terms.
5
+ */
6
+ import * as React from "react";
7
+ import "@formatjs/intl";
8
+ import { invariant } from "../utils.js";
9
+ import useIntl from "./useIntl.js";
10
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
11
+ const MINUTE = 60;
12
+ const HOUR = 60 * 60;
13
+ const DAY = 60 * 60 * 24;
14
14
  function selectUnit(seconds) {
15
- var absValue = Math.abs(seconds);
16
- if (absValue < MINUTE) {
17
- return 'second';
18
- }
19
- if (absValue < HOUR) {
20
- return 'minute';
21
- }
22
- if (absValue < DAY) {
23
- return 'hour';
24
- }
25
- return 'day';
15
+ const absValue = Math.abs(seconds);
16
+ if (absValue < MINUTE) {
17
+ return "second";
18
+ }
19
+ if (absValue < HOUR) {
20
+ return "minute";
21
+ }
22
+ if (absValue < DAY) {
23
+ return "hour";
24
+ }
25
+ return "day";
26
26
  }
27
27
  function getDurationInSeconds(unit) {
28
- switch (unit) {
29
- case 'second':
30
- return 1;
31
- case 'minute':
32
- return MINUTE;
33
- case 'hour':
34
- return HOUR;
35
- default:
36
- return DAY;
37
- }
28
+ switch (unit) {
29
+ case "second": return 1;
30
+ case "minute": return MINUTE;
31
+ case "hour": return HOUR;
32
+ default: return DAY;
33
+ }
38
34
  }
39
35
  function valueToSeconds(value, unit) {
40
- if (!value) {
41
- return 0;
42
- }
43
- switch (unit) {
44
- case 'second':
45
- return value;
46
- case 'minute':
47
- return value * MINUTE;
48
- default:
49
- return value * HOUR;
50
- }
36
+ if (!value) {
37
+ return 0;
38
+ }
39
+ switch (unit) {
40
+ case "second": return value;
41
+ case "minute": return value * MINUTE;
42
+ default: return value * HOUR;
43
+ }
51
44
  }
52
- var INCREMENTABLE_UNITS = [
53
- 'second',
54
- 'minute',
55
- 'hour',
45
+ const INCREMENTABLE_UNITS = [
46
+ "second",
47
+ "minute",
48
+ "hour"
56
49
  ];
57
- function canIncrement(unit) {
58
- if (unit === void 0) { unit = 'second'; }
59
- return INCREMENTABLE_UNITS.indexOf(unit) > -1;
50
+ function canIncrement(unit = "second") {
51
+ return INCREMENTABLE_UNITS.indexOf(unit) > -1;
60
52
  }
61
- var SimpleFormattedRelativeTime = function (props) {
62
- var _a = useIntl(), formatRelativeTime = _a.formatRelativeTime, Text = _a.textComponent;
63
- var children = props.children, value = props.value, unit = props.unit, otherProps = __rest(props, ["children", "value", "unit"]);
64
- var formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);
65
- if (typeof children === 'function') {
66
- return children(formattedRelativeTime);
67
- }
68
- if (Text) {
69
- return _jsx(Text, { children: formattedRelativeTime });
70
- }
71
- return _jsx(_Fragment, { children: formattedRelativeTime });
53
+ const SimpleFormattedRelativeTime = (props) => {
54
+ const { formatRelativeTime, textComponent: Text } = useIntl();
55
+ const { children, value, unit, ...otherProps } = props;
56
+ const formattedRelativeTime = formatRelativeTime(value || 0, unit, otherProps);
57
+ if (typeof children === "function") {
58
+ return children(formattedRelativeTime);
59
+ }
60
+ if (Text) {
61
+ return /* @__PURE__ */ _jsx(Text, { children: formattedRelativeTime });
62
+ }
63
+ return /* @__PURE__ */ _jsx(_Fragment, { children: formattedRelativeTime });
72
64
  };
73
- var FormattedRelativeTime = function (_a) {
74
- var _b = _a.value, value = _b === void 0 ? 0 : _b, _c = _a.unit, unit = _c === void 0 ? 'second' : _c, updateIntervalInSeconds = _a.updateIntervalInSeconds, otherProps = __rest(_a, ["value", "unit", "updateIntervalInSeconds"]);
75
- invariant(!updateIntervalInSeconds ||
76
- !!(updateIntervalInSeconds && canIncrement(unit)), 'Cannot schedule update with unit longer than hour');
77
- var _d = React.useState(), prevUnit = _d[0], setPrevUnit = _d[1];
78
- var _e = React.useState(0), prevValue = _e[0], setPrevValue = _e[1];
79
- var _f = React.useState(0), currentValueInSeconds = _f[0], setCurrentValueInSeconds = _f[1];
80
- var updateTimer;
81
- if (unit !== prevUnit || value !== prevValue) {
82
- setPrevValue(value || 0);
83
- setPrevUnit(unit);
84
- setCurrentValueInSeconds(canIncrement(unit) ? valueToSeconds(value, unit) : 0);
85
- }
86
- React.useEffect(function () {
87
- function clearUpdateTimer() {
88
- clearTimeout(updateTimer);
89
- }
90
- clearUpdateTimer();
91
- // If there's no interval and we cannot increment this unit, do nothing
92
- if (!updateIntervalInSeconds || !canIncrement(unit)) {
93
- return clearUpdateTimer;
94
- }
95
- // Figure out the next interesting time
96
- var nextValueInSeconds = currentValueInSeconds - updateIntervalInSeconds;
97
- var nextUnit = selectUnit(nextValueInSeconds);
98
- // We've reached the max auto incrementable unit, don't schedule another update
99
- if (nextUnit === 'day') {
100
- return clearUpdateTimer;
101
- }
102
- var unitDuration = getDurationInSeconds(nextUnit);
103
- var remainder = nextValueInSeconds % unitDuration;
104
- var prevInterestingValueInSeconds = nextValueInSeconds - remainder;
105
- var nextInterestingValueInSeconds = prevInterestingValueInSeconds >= currentValueInSeconds
106
- ? prevInterestingValueInSeconds - unitDuration
107
- : prevInterestingValueInSeconds;
108
- var delayInSeconds = Math.abs(nextInterestingValueInSeconds - currentValueInSeconds);
109
- if (currentValueInSeconds !== nextInterestingValueInSeconds) {
110
- updateTimer = setTimeout(function () { return setCurrentValueInSeconds(nextInterestingValueInSeconds); }, delayInSeconds * 1e3);
111
- }
112
- return clearUpdateTimer;
113
- }, [currentValueInSeconds, updateIntervalInSeconds, unit]);
114
- var currentValue = value || 0;
115
- var currentUnit = unit;
116
- if (canIncrement(unit) &&
117
- typeof currentValueInSeconds === 'number' &&
118
- updateIntervalInSeconds) {
119
- currentUnit = selectUnit(currentValueInSeconds);
120
- var unitDuration = getDurationInSeconds(currentUnit);
121
- currentValue = Math.round(currentValueInSeconds / unitDuration);
122
- }
123
- return (_jsx(SimpleFormattedRelativeTime, __assign({ value: currentValue, unit: currentUnit }, otherProps)));
65
+ const FormattedRelativeTime = ({ value = 0, unit = "second", updateIntervalInSeconds, ...otherProps }) => {
66
+ invariant(!updateIntervalInSeconds || !!(updateIntervalInSeconds && canIncrement(unit)), "Cannot schedule update with unit longer than hour");
67
+ const [prevUnit, setPrevUnit] = React.useState();
68
+ const [prevValue, setPrevValue] = React.useState(0);
69
+ const [currentValueInSeconds, setCurrentValueInSeconds] = React.useState(0);
70
+ const updateTimer = React.useRef(undefined);
71
+ if (unit !== prevUnit || value !== prevValue) {
72
+ setPrevValue(value || 0);
73
+ setPrevUnit(unit);
74
+ setCurrentValueInSeconds(canIncrement(unit) ? valueToSeconds(value, unit) : 0);
75
+ }
76
+ React.useEffect(() => {
77
+ function clearUpdateTimer() {
78
+ clearTimeout(updateTimer.current);
79
+ }
80
+ clearUpdateTimer();
81
+ // If there's no interval and we cannot increment this unit, do nothing
82
+ if (!updateIntervalInSeconds || !canIncrement(unit)) {
83
+ return clearUpdateTimer;
84
+ }
85
+ // Figure out the next interesting time
86
+ const nextValueInSeconds = currentValueInSeconds - updateIntervalInSeconds;
87
+ const nextUnit = selectUnit(nextValueInSeconds);
88
+ // We've reached the max auto incrementable unit, don't schedule another update
89
+ if (nextUnit === "day") {
90
+ return clearUpdateTimer;
91
+ }
92
+ const unitDuration = getDurationInSeconds(nextUnit);
93
+ const remainder = nextValueInSeconds % unitDuration;
94
+ const prevInterestingValueInSeconds = nextValueInSeconds - remainder;
95
+ const nextInterestingValueInSeconds = prevInterestingValueInSeconds >= currentValueInSeconds ? prevInterestingValueInSeconds - unitDuration : prevInterestingValueInSeconds;
96
+ const delayInSeconds = Math.abs(nextInterestingValueInSeconds - currentValueInSeconds);
97
+ if (currentValueInSeconds !== nextInterestingValueInSeconds) {
98
+ updateTimer.current = setTimeout(() => setCurrentValueInSeconds(nextInterestingValueInSeconds), delayInSeconds * 1e3);
99
+ }
100
+ return clearUpdateTimer;
101
+ }, [
102
+ currentValueInSeconds,
103
+ updateIntervalInSeconds,
104
+ unit
105
+ ]);
106
+ let currentValue = value || 0;
107
+ let currentUnit = unit;
108
+ if (canIncrement(unit) && typeof currentValueInSeconds === "number" && updateIntervalInSeconds) {
109
+ currentUnit = selectUnit(currentValueInSeconds);
110
+ const unitDuration = getDurationInSeconds(currentUnit);
111
+ currentValue = Math.round(currentValueInSeconds / unitDuration);
112
+ }
113
+ return /* @__PURE__ */ _jsx(SimpleFormattedRelativeTime, {
114
+ value: currentValue,
115
+ unit: currentUnit,
116
+ ...otherProps
117
+ });
124
118
  };
125
- FormattedRelativeTime.displayName = 'FormattedRelativeTime';
119
+ FormattedRelativeTime.displayName = "FormattedRelativeTime";
126
120
  export default FormattedRelativeTime;
@@ -1,2 +1,2 @@
1
- import { IntlShape } from '../types.js';
1
+ import { type IntlShape } from "../types.js";
2
2
  export default function useIntl(this: void): IntlShape;
@@ -1,8 +1,9 @@
1
- import * as React from 'react';
2
- import { invariantIntlContext } from '../utils.js';
3
- import { Context } from './injectIntl.js';
1
+ import * as React from "react";
2
+ import "../types.js";
3
+ import { invariantIntlContext } from "../utils.js";
4
+ import { Context } from "./injectIntl.js";
4
5
  export default function useIntl() {
5
- var intl = React.useContext(Context);
6
- invariantIntlContext(intl);
7
- return intl;
6
+ const intl = React.useContext(Context);
7
+ invariantIntlContext(intl);
8
+ return intl;
8
9
  }
package/src/types.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- import { ResolvedIntlConfig as CoreResolvedIntlConfig, Formatters, IntlFormatters, MessageDescriptor } from '@formatjs/intl';
2
- import { FormatXMLElementFn, Options as IntlMessageFormatOptions, PrimitiveType } from 'intl-messageformat';
3
- import * as React from 'react';
4
- import { DEFAULT_INTL_CONFIG } from './utils.js';
1
+ import { type ResolvedIntlConfig as CoreResolvedIntlConfig, type Formatters, type IntlFormatters, type MessageDescriptor } from "@formatjs/intl";
2
+ import { type FormatXMLElementFn, type Options as IntlMessageFormatOptions, type PrimitiveType } from "intl-messageformat";
3
+ import * as React from "react";
4
+ import type { DEFAULT_INTL_CONFIG } from "./utils.js";
5
5
  export type IntlConfig = Omit<ResolvedIntlConfig, keyof typeof DEFAULT_INTL_CONFIG> & Partial<typeof DEFAULT_INTL_CONFIG>;
6
6
  export interface ResolvedIntlConfig extends CoreResolvedIntlConfig<React.ReactNode> {
7
- textComponent?: React.ComponentType | keyof React.JSX.IntrinsicElements;
8
- wrapRichTextChunksInFragment?: boolean;
7
+ textComponent?: React.ComponentType | keyof React.JSX.IntrinsicElements;
8
+ wrapRichTextChunksInFragment?: boolean;
9
9
  }
10
10
  export interface IntlShape extends ResolvedIntlConfig, IntlFormatters<React.ReactNode> {
11
- formatMessage(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>, opts?: IntlMessageFormatOptions): string;
12
- formatMessage(this: void, descriptor: MessageDescriptor, values?: Record<string, React.ReactNode | PrimitiveType | FormatXMLElementFn<string, React.ReactNode>>, opts?: IntlMessageFormatOptions): Array<React.ReactNode>;
13
- formatters: Formatters;
11
+ formatMessage(this: void, descriptor: MessageDescriptor, values?: Record<string, PrimitiveType | FormatXMLElementFn<string, string>>, opts?: IntlMessageFormatOptions): string;
12
+ formatMessage(this: void, descriptor: MessageDescriptor, values?: Record<string, React.ReactNode | PrimitiveType | FormatXMLElementFn<string, React.ReactNode>>, opts?: IntlMessageFormatOptions): Array<React.ReactNode>;
13
+ formatters: Formatters;
14
14
  }
package/src/types.js CHANGED
@@ -1 +1,8 @@
1
- export {};
1
+ /*
2
+ * Copyright 2015, Yahoo Inc.
3
+ * Copyrights licensed under the New BSD License.
4
+ * See the accompanying LICENSE file for terms.
5
+ */
6
+ import "@formatjs/intl";
7
+ import "intl-messageformat";
8
+ import * as React from "react";
package/src/utils.d.ts CHANGED
@@ -1,26 +1,26 @@
1
- import { FormatXMLElementFn } from 'intl-messageformat';
2
- import * as React from 'react';
3
- import { ResolvedIntlConfig } from './types.js';
1
+ import { type FormatXMLElementFn } from "intl-messageformat";
2
+ import * as React from "react";
3
+ import { type ResolvedIntlConfig } from "./types.js";
4
4
  export declare function invariant(condition: boolean, message: string, Err?: any): asserts condition;
5
5
  export declare function invariantIntlContext(intl?: any): asserts intl;
6
- export type DefaultIntlConfig = Pick<ResolvedIntlConfig, 'fallbackOnEmptyString' | 'formats' | 'messages' | 'timeZone' | 'textComponent' | 'defaultLocale' | 'defaultFormats' | 'onError'>;
6
+ export type DefaultIntlConfig = Pick<ResolvedIntlConfig, "fallbackOnEmptyString" | "formats" | "messages" | "timeZone" | "textComponent" | "defaultLocale" | "defaultFormats" | "onError">;
7
7
  export declare const DEFAULT_INTL_CONFIG: DefaultIntlConfig;
8
8
  /**
9
- * Builds an array of {@link React.ReactNode}s with index-based keys, similar to
10
- * {@link React.Children.toArray}. However, this function tells React that it
11
- * was intentional, so they won't produce a bunch of warnings about it.
12
- *
13
- * React doesn't recommend doing this because it makes reordering inefficient,
14
- * but we mostly need this for message chunks, which don't tend to reorder to
15
- * begin with.
16
- *
17
- */
9
+ * Builds an array of {@link React.ReactNode}s with index-based keys, similar to
10
+ * {@link React.Children.toArray}. However, this function tells React that it
11
+ * was intentional, so they won't produce a bunch of warnings about it.
12
+ *
13
+ * React doesn't recommend doing this because it makes reordering inefficient,
14
+ * but we mostly need this for message chunks, which don't tend to reorder to
15
+ * begin with.
16
+ *
17
+ */
18
18
  export declare const toKeyedReactNodeArray: typeof React.Children.toArray;
19
19
  /**
20
- * Takes a `formatXMLElementFn`, and composes it in function, which passes
21
- * argument `parts` through, assigning unique key to each part, to prevent
22
- * "Each child in a list should have a unique "key"" React error.
23
- * @param formatXMLElementFn
24
- */
20
+ * Takes a `formatXMLElementFn`, and composes it in function, which passes
21
+ * argument `parts` through, assigning unique key to each part, to prevent
22
+ * "Each child in a list should have a unique "key"" React error.
23
+ * @param formatXMLElementFn
24
+ */
25
25
  export declare function assignUniqueKeysToParts(formatXMLElementFn: FormatXMLElementFn<React.ReactNode>): FormatXMLElementFn<React.ReactNode>;
26
26
  export declare function shallowEqual<T extends Record<string, unknown> = Record<string, unknown>>(objA?: T, objB?: T): boolean;