@stella-source/stellasource-dsl 1.3.2 → 1.4.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/cjs/index.js CHANGED
@@ -17331,7 +17331,13 @@ const PasswordInput = ({ id, className, htmlProps, label, placeholder = "Enter P
17331
17331
  const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
17332
17332
  const onlyDigitNum = num.toString().replace(/[^\d.-]/g, "");
17333
17333
  const decimalEnding = onlyDigitNum.endsWith(".");
17334
- const decimalZero = onlyDigitNum.includes(".") && onlyDigitNum.endsWith("0");
17334
+ const zeroEnding = onlyDigitNum.includes(".") && onlyDigitNum.endsWith("0");
17335
+ let decimalTrailingZeros = "";
17336
+ if (zeroEnding) {
17337
+ const match = onlyDigitNum.match(/0+$/);
17338
+ decimalTrailingZeros = match ? match[0] : "";
17339
+ }
17340
+ const decimalZero = onlyDigitNum.endsWith(`.${decimalTrailingZeros.length > 0 ? decimalTrailingZeros : "0"}`);
17335
17341
  if (onlyDigitNum === "" || onlyDigitNum === "-" || onlyDigitNum === ".") {
17336
17342
  return onlyDigitNum;
17337
17343
  }
@@ -17342,7 +17348,7 @@ const formatDynamicNumbersWithCommas = (num, decimalPlaces) => {
17342
17348
  ? `${Number(onlyDigitNum).toLocaleString("en-US", {
17343
17349
  minimumFractionDigits: 0,
17344
17350
  maximumFractionDigits: decimalPlaces,
17345
- })}${decimalEnding ? "." : ""}${decimalZero ? "0" : ""}`
17351
+ })}${decimalEnding ? "." : ""}${decimalZero ? "." : ""}${zeroEnding ? `${decimalTrailingZeros}` : ""}`
17346
17352
  : "";
17347
17353
  };
17348
17354