@uxf/localize 10.0.0-beta.43 → 10.0.0-beta.44
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.
package/package.json
CHANGED
|
@@ -8,9 +8,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const context_1 = require("../context/context");
|
|
9
9
|
const format_datetime_1 = require("../format-datetime/format-datetime");
|
|
10
10
|
function createFormatDatetimeComponent(localizeConfigs) {
|
|
11
|
-
const Component = (
|
|
11
|
+
const Component = (props) => {
|
|
12
12
|
const locale = (0, context_1._useLocalizeContext)();
|
|
13
|
-
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_datetime_1.createFormatDatetime)(localizeConfigs)(locale, value, format));
|
|
13
|
+
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_datetime_1.createFormatDatetime)(localizeConfigs)(locale, props.value, props.format));
|
|
14
14
|
};
|
|
15
15
|
return Component;
|
|
16
16
|
}
|
|
@@ -8,9 +8,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const context_1 = require("../context/context");
|
|
9
9
|
const format_money_1 = require("../format-money/format-money");
|
|
10
10
|
function createFormatMoneyComponent(localizeConfigs) {
|
|
11
|
-
const Component = (
|
|
11
|
+
const Component = (props) => {
|
|
12
12
|
const locale = (0, context_1._useLocalizeContext)();
|
|
13
|
-
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_money_1.createFormatMoney)(localizeConfigs)(locale, money, options));
|
|
13
|
+
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_money_1.createFormatMoney)(localizeConfigs)(locale, props.money, props.options));
|
|
14
14
|
};
|
|
15
15
|
return Component;
|
|
16
16
|
}
|
|
@@ -8,9 +8,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const context_1 = require("../context/context");
|
|
9
9
|
const format_number_1 = require("../format-number/format-number");
|
|
10
10
|
function createFormatNumberComponent(localizeConfigs) {
|
|
11
|
-
const Component = (
|
|
11
|
+
const Component = (props) => {
|
|
12
12
|
const locale = (0, context_1._useLocalizeContext)();
|
|
13
|
-
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_number_1.createFormatNumber)(localizeConfigs)(locale, value, options));
|
|
13
|
+
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_number_1.createFormatNumber)(localizeConfigs)(locale, props.value, props.options));
|
|
14
14
|
};
|
|
15
15
|
return Component;
|
|
16
16
|
}
|
|
@@ -8,9 +8,9 @@ const react_1 = __importDefault(require("react"));
|
|
|
8
8
|
const context_1 = require("../context/context");
|
|
9
9
|
const format_percentage_1 = require("../format-percentage/format-percentage");
|
|
10
10
|
function createFormatPercentageComponent(localizeConfigs) {
|
|
11
|
-
const Component = (
|
|
11
|
+
const Component = (props) => {
|
|
12
12
|
const locale = (0, context_1._useLocalizeContext)();
|
|
13
|
-
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_percentage_1.createFormatPercentage)(localizeConfigs)(locale, value, roundingType, options));
|
|
13
|
+
return react_1.default.createElement(react_1.default.Fragment, null, (0, format_percentage_1.createFormatPercentage)(localizeConfigs)(locale, props.value, props.roundingType, props.options));
|
|
14
14
|
};
|
|
15
15
|
return Component;
|
|
16
16
|
}
|
package/src/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CURRENCIES } from "./utils/data";
|
|
2
|
-
import {
|
|
2
|
+
import { FC, Provider } from "react";
|
|
3
3
|
export type DateTimes = "timeShort" | "timeFull" | "dateShort" | "dateMedium" | "dateLong" | "dateShortNoYear" | "dateLongNoYear" | "dateTimeShort" | "dateTimeMedium" | "dateTimeLong";
|
|
4
4
|
export type LocalizeConfig<DT extends DateTimes> = {
|
|
5
5
|
number: {
|
|
@@ -23,16 +23,29 @@ export type Money = {
|
|
|
23
23
|
};
|
|
24
24
|
export type FormatNumberFunction<Locales extends string> = (locale: Locales, value: number, options?: FormatNumberOptions) => string;
|
|
25
25
|
export type UseFormatNumberFunction = () => (value: number, options?: FormatNumberOptions) => string;
|
|
26
|
-
export type FormatNumberComponent =
|
|
26
|
+
export type FormatNumberComponent = FC<{
|
|
27
|
+
value: number;
|
|
28
|
+
options?: FormatNumberOptions;
|
|
29
|
+
}>;
|
|
27
30
|
export type FormatMoneyFunction<Locales extends string> = (locale: Locales, money: Money, options?: FormatMoneyOptions) => string;
|
|
28
31
|
export type UseFormatMoneyFunction = () => (money: Money, options?: FormatMoneyOptions) => string;
|
|
29
|
-
export type FormatMoneyComponent =
|
|
32
|
+
export type FormatMoneyComponent = FC<{
|
|
33
|
+
money: Money;
|
|
34
|
+
options?: FormatMoneyOptions;
|
|
35
|
+
}>;
|
|
30
36
|
export type FormatPercentageFunction<Locales extends string> = (locale: Locales, value: number, roundingType?: RoundingType | null, options?: FormatPercentageOptions) => string;
|
|
31
37
|
export type UseFormatPercentageFunction = () => (value: number, roundingType?: RoundingType | null, options?: FormatPercentageOptions) => string;
|
|
32
|
-
export type FormatPercentageComponent =
|
|
38
|
+
export type FormatPercentageComponent = FC<{
|
|
39
|
+
value: number;
|
|
40
|
+
roundingType?: RoundingType | null;
|
|
41
|
+
options?: FormatPercentageOptions;
|
|
42
|
+
}>;
|
|
33
43
|
export type FormatDatetimeFunction<DT extends DateTimes, Locales extends string> = (locale: Locales, value: Date, format: DT) => string;
|
|
34
44
|
export type UseFormatDatetimeFunction<DT extends DateTimes> = () => (value: Date, format: DT) => string;
|
|
35
|
-
export type FormatDatetimeComponent<DT extends DateTimes> =
|
|
45
|
+
export type FormatDatetimeComponent<DT extends DateTimes> = FC<{
|
|
46
|
+
value: Date;
|
|
47
|
+
format: DT;
|
|
48
|
+
}>;
|
|
36
49
|
export type CreateLocalizeReturn<DT extends DateTimes, Locales extends string> = {
|
|
37
50
|
LocalizeProvider: LocalizeProviderType;
|
|
38
51
|
useLocaleConfig: UseLocaleConfigType<DT>;
|