@wix/form-public 0.218.0 → 0.220.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/index.cjs CHANGED
@@ -26398,6 +26398,14 @@ var addFieldToSchema = (form, field, layout) => {
26398
26398
  steps: newSteps || form.steps
26399
26399
  };
26400
26400
  };
26401
+ var BiContext = /* @__PURE__ */ React42.createContext(void 0);
26402
+ function useBi() {
26403
+ const context = React42.useContext(BiContext);
26404
+ if (context === void 0) {
26405
+ throw new Error("useBi must be used within a BiProvider");
26406
+ }
26407
+ return context;
26408
+ }
26401
26409
 
26402
26410
  // ../form-fields/dist/esm/ui/shared/numeric-input-utils.js
26403
26411
  var getPattern = (multipleOf) => {
@@ -26655,12 +26663,13 @@ function formatCurrency(_temp) {
26655
26663
  } = _temp === void 0 ? {} : _temp;
26656
26664
  const amountNumber = Number(amount);
26657
26665
  if (currency) {
26666
+ const fractionDigits = decimalCount ?? getDisplayPrecision(amountNumber);
26658
26667
  return Intl.NumberFormat(locale, {
26659
26668
  style: "currency",
26660
26669
  unitDisplay: "narrow",
26661
26670
  currency,
26662
- minimumFractionDigits: decimalCount,
26663
- maximumFractionDigits: decimalCount ?? getPrecision(amountNumber)
26671
+ minimumFractionDigits: fractionDigits,
26672
+ maximumFractionDigits: fractionDigits
26664
26673
  }).format(amountNumber);
26665
26674
  }
26666
26675
  if (decimalCount) {
@@ -26668,9 +26677,8 @@ function formatCurrency(_temp) {
26668
26677
  }
26669
26678
  return String(amount);
26670
26679
  }
26671
- function getPrecision(amount) {
26672
- var _amount$toString$spli;
26673
- return ((_amount$toString$spli = amount.toString().split(".")[1]) == null ? void 0 : _amount$toString$spli.length) || 0;
26680
+ function getDisplayPrecision(amount) {
26681
+ return Number.isInteger(amount) ? 0 : 2;
26674
26682
  }
26675
26683
 
26676
26684
  // ../../node_modules/libphonenumber-js/metadata.min.json.js
@@ -26739,14 +26747,6 @@ function usePanorama() {
26739
26747
  })
26740
26748
  };
26741
26749
  }
26742
- var BiContext = /* @__PURE__ */ React42.createContext(void 0);
26743
- function useBi() {
26744
- const context = React42.useContext(BiContext);
26745
- if (context === void 0) {
26746
- throw new Error("useBi must be used within a BiProvider");
26747
- }
26748
- return context;
26749
- }
26750
26750
  var ForcedState = /* @__PURE__ */ (function(ForcedState2) {
26751
26751
  ForcedState2["BUTTONS_HOVER"] = "BUTTONS_HOVER";
26752
26752
  ForcedState2["NEXT_BUTTON_HOVER"] = "NEXT_BUTTON_HOVER";