@ceed/ads 1.24.1 → 1.25.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.
- package/dist/components/CurrencyInput/CurrencyInput.d.ts +1 -1
- package/dist/components/CurrencyInput/hooks/use-currency-setting.d.ts +2 -2
- package/dist/index.browser.js +12 -14
- package/dist/index.browser.js.map +4 -4
- package/dist/index.cjs +6 -9
- package/dist/index.js +6 -9
- package/framer/index.js +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1692,7 +1692,6 @@ Container.displayName = "Container";
|
|
|
1692
1692
|
|
|
1693
1693
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1694
1694
|
var import_react18 = __toESM(require("react"));
|
|
1695
|
-
var import_intl_messageformat2 = require("intl-messageformat");
|
|
1696
1695
|
var import_react_number_format = require("react-number-format");
|
|
1697
1696
|
|
|
1698
1697
|
// src/components/Input/Input.tsx
|
|
@@ -1816,7 +1815,6 @@ var Input_default = Input;
|
|
|
1816
1815
|
var import_joy24 = require("@mui/joy");
|
|
1817
1816
|
|
|
1818
1817
|
// src/components/CurrencyInput/hooks/use-currency-setting.ts
|
|
1819
|
-
var import_intl_messageformat = __toESM(require("intl-messageformat"));
|
|
1820
1818
|
var CURRENCY_DECIMAL_MAP = {
|
|
1821
1819
|
AED: 2,
|
|
1822
1820
|
ALL: 2,
|
|
@@ -1961,9 +1959,10 @@ var CURRENCY_DECIMAL_MAP = {
|
|
|
1961
1959
|
};
|
|
1962
1960
|
var useCurrencySetting = (props) => {
|
|
1963
1961
|
const { currency = "USD", placeholder } = props;
|
|
1964
|
-
const
|
|
1965
|
-
|
|
1966
|
-
|
|
1962
|
+
const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
|
|
1963
|
+
const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
|
|
1964
|
+
const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1965
|
+
const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1967
1966
|
const decimalScale = CURRENCY_DECIMAL_MAP[currency];
|
|
1968
1967
|
return {
|
|
1969
1968
|
symbol: `${symbol} `,
|
|
@@ -2040,7 +2039,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
|
|
|
2040
2039
|
setValue(void 0);
|
|
2041
2040
|
return;
|
|
2042
2041
|
}
|
|
2043
|
-
const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
|
|
2042
|
+
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
2044
2043
|
if (!!max && Number(event.target.value) > max) {
|
|
2045
2044
|
setIsOverLimit(true);
|
|
2046
2045
|
} else {
|
|
@@ -2063,9 +2062,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
|
|
|
2063
2062
|
required,
|
|
2064
2063
|
color: error || isOverLimit ? "danger" : props.color,
|
|
2065
2064
|
label,
|
|
2066
|
-
helperText: isOverLimit ?
|
|
2067
|
-
amount: max
|
|
2068
|
-
}) : helperText,
|
|
2065
|
+
helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
|
|
2069
2066
|
slotProps: {
|
|
2070
2067
|
input: {
|
|
2071
2068
|
component: TextMaskAdapter,
|
package/dist/index.js
CHANGED
|
@@ -1550,7 +1550,6 @@ Container.displayName = "Container";
|
|
|
1550
1550
|
|
|
1551
1551
|
// src/components/CurrencyInput/CurrencyInput.tsx
|
|
1552
1552
|
import React16, { useCallback as useCallback7, useMemo as useMemo5, useState as useState6 } from "react";
|
|
1553
|
-
import { IntlMessageFormat as IntlMessageFormat2 } from "intl-messageformat";
|
|
1554
1553
|
import { NumericFormat } from "react-number-format";
|
|
1555
1554
|
|
|
1556
1555
|
// src/components/Input/Input.tsx
|
|
@@ -1674,7 +1673,6 @@ var Input_default = Input;
|
|
|
1674
1673
|
import { styled as styled7, useThemeProps as useThemeProps3 } from "@mui/joy";
|
|
1675
1674
|
|
|
1676
1675
|
// src/components/CurrencyInput/hooks/use-currency-setting.ts
|
|
1677
|
-
import IntlMessageFormat from "intl-messageformat";
|
|
1678
1676
|
var CURRENCY_DECIMAL_MAP = {
|
|
1679
1677
|
AED: 2,
|
|
1680
1678
|
ALL: 2,
|
|
@@ -1819,9 +1817,10 @@ var CURRENCY_DECIMAL_MAP = {
|
|
|
1819
1817
|
};
|
|
1820
1818
|
var useCurrencySetting = (props) => {
|
|
1821
1819
|
const { currency = "USD", placeholder } = props;
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1824
|
-
|
|
1820
|
+
const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
|
|
1821
|
+
const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
|
|
1822
|
+
const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
|
|
1823
|
+
const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
|
|
1825
1824
|
const decimalScale = CURRENCY_DECIMAL_MAP[currency];
|
|
1826
1825
|
return {
|
|
1827
1826
|
symbol: `${symbol} `,
|
|
@@ -1898,7 +1897,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1898
1897
|
setValue(void 0);
|
|
1899
1898
|
return;
|
|
1900
1899
|
}
|
|
1901
|
-
const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
|
|
1900
|
+
const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
|
|
1902
1901
|
if (!!max && Number(event.target.value) > max) {
|
|
1903
1902
|
setIsOverLimit(true);
|
|
1904
1903
|
} else {
|
|
@@ -1921,9 +1920,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
|
|
|
1921
1920
|
required,
|
|
1922
1921
|
color: error || isOverLimit ? "danger" : props.color,
|
|
1923
1922
|
label,
|
|
1924
|
-
helperText: isOverLimit ?
|
|
1925
|
-
amount: max
|
|
1926
|
-
}) : helperText,
|
|
1923
|
+
helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
|
|
1927
1924
|
slotProps: {
|
|
1928
1925
|
input: {
|
|
1929
1926
|
component: TextMaskAdapter,
|