@ceed/cds 1.23.1 → 1.24.1-next.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.
package/dist/index.cjs CHANGED
@@ -1694,7 +1694,6 @@ Container.displayName = "Container";
1694
1694
 
1695
1695
  // src/components/CurrencyInput/CurrencyInput.tsx
1696
1696
  var import_react18 = __toESM(require("react"));
1697
- var import_intl_messageformat2 = require("intl-messageformat");
1698
1697
  var import_react_number_format = require("react-number-format");
1699
1698
 
1700
1699
  // src/components/Input/Input.tsx
@@ -1818,7 +1817,6 @@ var Input_default = Input;
1818
1817
  var import_joy24 = require("@mui/joy");
1819
1818
 
1820
1819
  // src/components/CurrencyInput/hooks/use-currency-setting.ts
1821
- var import_intl_messageformat = __toESM(require("intl-messageformat"));
1822
1820
  var CURRENCY_DECIMAL_MAP = {
1823
1821
  AED: 2,
1824
1822
  ALL: 2,
@@ -1963,9 +1961,10 @@ var CURRENCY_DECIMAL_MAP = {
1963
1961
  };
1964
1962
  var useCurrencySetting = (props) => {
1965
1963
  const { currency = "USD", placeholder } = props;
1966
- const [symbol, thousandSeparator, decimalSeparator, ...rest] = new import_intl_messageformat.default(
1967
- `{amount, number, ::currency/${currency} unit-width-narrow}`
1968
- ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1964
+ const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
1965
+ const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
1966
+ const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
1967
+ const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
1969
1968
  const decimalScale = CURRENCY_DECIMAL_MAP[currency];
1970
1969
  return {
1971
1970
  symbol: `${symbol} `,
@@ -2042,7 +2041,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
2042
2041
  setValue(void 0);
2043
2042
  return;
2044
2043
  }
2045
- const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
2044
+ const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
2046
2045
  if (!!max && Number(event.target.value) > max) {
2047
2046
  setIsOverLimit(true);
2048
2047
  } else {
@@ -2065,9 +2064,7 @@ var CurrencyInput = import_react18.default.forwardRef(function CurrencyInput2(in
2065
2064
  required,
2066
2065
  color: error || isOverLimit ? "danger" : props.color,
2067
2066
  label,
2068
- helperText: isOverLimit ? new import_intl_messageformat2.IntlMessageFormat(`limit: {amount, number, ::currency/${currency} unit-width-narrow}`).format({
2069
- amount: max
2070
- }) : helperText,
2067
+ helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
2071
2068
  slotProps: {
2072
2069
  input: {
2073
2070
  component: TextMaskAdapter,
package/dist/index.js CHANGED
@@ -1560,7 +1560,6 @@ Container.displayName = "Container";
1560
1560
 
1561
1561
  // src/components/CurrencyInput/CurrencyInput.tsx
1562
1562
  import React16, { useCallback as useCallback7, useMemo as useMemo5, useState as useState6 } from "react";
1563
- import { IntlMessageFormat as IntlMessageFormat2 } from "intl-messageformat";
1564
1563
  import { NumericFormat } from "react-number-format";
1565
1564
 
1566
1565
  // src/components/Input/Input.tsx
@@ -1684,7 +1683,6 @@ var Input_default = Input;
1684
1683
  import { styled as styled7, useThemeProps as useThemeProps3 } from "@mui/joy";
1685
1684
 
1686
1685
  // src/components/CurrencyInput/hooks/use-currency-setting.ts
1687
- import IntlMessageFormat from "intl-messageformat";
1688
1686
  var CURRENCY_DECIMAL_MAP = {
1689
1687
  AED: 2,
1690
1688
  ALL: 2,
@@ -1829,9 +1827,10 @@ var CURRENCY_DECIMAL_MAP = {
1829
1827
  };
1830
1828
  var useCurrencySetting = (props) => {
1831
1829
  const { currency = "USD", placeholder } = props;
1832
- const [symbol, thousandSeparator, decimalSeparator, ...rest] = new IntlMessageFormat(
1833
- `{amount, number, ::currency/${currency} unit-width-narrow}`
1834
- ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1830
+ const parts = new Intl.NumberFormat("en-US", { style: "currency", currency }).formatToParts(1000.01);
1831
+ const symbol = parts.find((p) => p.type === "currency")?.value ?? "$";
1832
+ const thousandSeparator = parts.find((p) => p.type === "group")?.value ?? ",";
1833
+ const decimalSeparator = parts.find((p) => p.type === "decimal")?.value;
1835
1834
  const decimalScale = CURRENCY_DECIMAL_MAP[currency];
1836
1835
  return {
1837
1836
  symbol: `${symbol} `,
@@ -1908,7 +1907,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
1908
1907
  setValue(void 0);
1909
1908
  return;
1910
1909
  }
1911
- const amount = useMinorUnit ? Number(event.target.value?.replace(decimalSeparator, "")) : Number(event.target.value);
1910
+ const amount = useMinorUnit ? Number(decimalSeparator ? event.target.value?.replace(decimalSeparator, "") : event.target.value) : Number(event.target.value);
1912
1911
  if (!!max && Number(event.target.value) > max) {
1913
1912
  setIsOverLimit(true);
1914
1913
  } else {
@@ -1931,9 +1930,7 @@ var CurrencyInput = React16.forwardRef(function CurrencyInput2(inProps, ref) {
1931
1930
  required,
1932
1931
  color: error || isOverLimit ? "danger" : props.color,
1933
1932
  label,
1934
- helperText: isOverLimit ? new IntlMessageFormat2(`limit: {amount, number, ::currency/${currency} unit-width-narrow}`).format({
1935
- amount: max
1936
- }) : helperText,
1933
+ helperText: isOverLimit ? `limit: ${new Intl.NumberFormat("en-US", { style: "currency", currency }).format(max)}` : helperText,
1937
1934
  slotProps: {
1938
1935
  input: {
1939
1936
  component: TextMaskAdapter,