@ceed/ads 1.4.5 → 1.4.7

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.
@@ -19,6 +19,7 @@ interface CurrencyInputProps {
19
19
  error?: boolean;
20
20
  helperText?: React.ReactNode;
21
21
  useMinorUnit?: boolean;
22
+ placeholder?: string;
22
23
  }
23
24
  declare const CurrencyInput: React.ForwardRefExoticComponent<Omit<CurrencyInputProps & Omit<InputProps, "defaultValue" | "onChange" | "value"> & MotionProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
24
25
  export { CurrencyInput };
@@ -1,4 +1,7 @@
1
- export declare const useCurrencySetting: (currencyCode?: "USD" | "KRW" | "BHD") => {
1
+ export declare const useCurrencySetting: (props: {
2
+ currency?: "USD" | "KRW" | "BHD" | undefined;
3
+ placeholder?: string | undefined;
4
+ }) => {
2
5
  symbol: string;
3
6
  thousandSeparator: string;
4
7
  decimalSeparator: string;
package/dist/index.cjs CHANGED
@@ -1921,16 +1921,17 @@ var CURRENCY_DECIMAL_MAP = {
1921
1921
  ZAR: 2,
1922
1922
  ZMW: 2
1923
1923
  };
1924
- var useCurrencySetting = (currencyCode = "USD") => {
1924
+ var useCurrencySetting = (props) => {
1925
+ const { currency = "USD", placeholder } = props;
1925
1926
  const [symbol, thousandSeparator, decimalSeparator, ...rest] = new import_intl_messageformat.default(
1926
- `{amount, number, ::currency/${currencyCode} unit-width-narrow}`
1927
+ `{amount, number, ::currency/${currency} unit-width-narrow}`
1927
1928
  ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1928
- const decimalScale = CURRENCY_DECIMAL_MAP[currencyCode];
1929
+ const decimalScale = CURRENCY_DECIMAL_MAP[currency];
1929
1930
  return {
1930
1931
  symbol: `${symbol} `,
1931
1932
  thousandSeparator,
1932
1933
  decimalSeparator,
1933
- placeholder: decimalSeparator ? `${symbol} 0${decimalSeparator}${Array.from(Array(decimalScale)).map(() => 0).join("")}` : `${symbol} 0`,
1934
+ placeholder: placeholder ? `${symbol} ${placeholder}` : decimalSeparator ? `${symbol} 0${decimalSeparator}${Array.from(Array(decimalScale)).map(() => 0).join("")}` : `${symbol} 0`,
1934
1935
  fixedDecimalScale: !!decimalSeparator,
1935
1936
  decimalScale
1936
1937
  };
@@ -1985,7 +1986,7 @@ var CurrencyInput = import_react17.default.forwardRef(function CurrencyInput2(in
1985
1986
  placeholder,
1986
1987
  fixedDecimalScale,
1987
1988
  decimalScale
1988
- } = useCurrencySetting(currency);
1989
+ } = useCurrencySetting(props);
1989
1990
  const [_value, setValue] = useControlledState(
1990
1991
  props.value,
1991
1992
  props.defaultValue,
package/dist/index.js CHANGED
@@ -1847,16 +1847,17 @@ var CURRENCY_DECIMAL_MAP = {
1847
1847
  ZAR: 2,
1848
1848
  ZMW: 2
1849
1849
  };
1850
- var useCurrencySetting = (currencyCode = "USD") => {
1850
+ var useCurrencySetting = (props) => {
1851
+ const { currency = "USD", placeholder } = props;
1851
1852
  const [symbol, thousandSeparator, decimalSeparator, ...rest] = new IntlMessageFormat(
1852
- `{amount, number, ::currency/${currencyCode} unit-width-narrow}`
1853
+ `{amount, number, ::currency/${currency} unit-width-narrow}`
1853
1854
  ).format({ amount: 1e3 }).toString().replace(/\d/g, "").split("");
1854
- const decimalScale = CURRENCY_DECIMAL_MAP[currencyCode];
1855
+ const decimalScale = CURRENCY_DECIMAL_MAP[currency];
1855
1856
  return {
1856
1857
  symbol: `${symbol} `,
1857
1858
  thousandSeparator,
1858
1859
  decimalSeparator,
1859
- placeholder: decimalSeparator ? `${symbol} 0${decimalSeparator}${Array.from(Array(decimalScale)).map(() => 0).join("")}` : `${symbol} 0`,
1860
+ placeholder: placeholder ? `${symbol} ${placeholder}` : decimalSeparator ? `${symbol} 0${decimalSeparator}${Array.from(Array(decimalScale)).map(() => 0).join("")}` : `${symbol} 0`,
1860
1861
  fixedDecimalScale: !!decimalSeparator,
1861
1862
  decimalScale
1862
1863
  };
@@ -1911,7 +1912,7 @@ var CurrencyInput = React15.forwardRef(function CurrencyInput2(inProps, ref) {
1911
1912
  placeholder,
1912
1913
  fixedDecimalScale,
1913
1914
  decimalScale
1914
- } = useCurrencySetting(currency);
1915
+ } = useCurrencySetting(props);
1915
1916
  const [_value, setValue] = useControlledState(
1916
1917
  props.value,
1917
1918
  props.defaultValue,