@homebound/beam 2.415.3 → 2.415.4

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
@@ -12028,6 +12028,14 @@ function NumberField(props) {
12028
12028
  }, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
12029
12029
  const numberParser = (0, import_react57.useMemo)(() => new import_number.NumberParser(locale, formatOptions), [locale, formatOptions]);
12030
12030
  const valueRef = (0, import_react57.useRef)({ wip: false });
12031
+ const lastSentRef = (0, import_react57.useRef)(void 0);
12032
+ const propValue = value === void 0 ? Number.NaN : value / factor;
12033
+ if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
12034
+ const lastSentInternal = lastSentRef.current === void 0 ? Number.NaN : lastSentRef.current / factor;
12035
+ if (!Object.is(propValue, lastSentInternal)) {
12036
+ valueRef.current.value = propValue;
12037
+ }
12038
+ }
12031
12039
  const useProps = {
12032
12040
  locale,
12033
12041
  // We want percents && cents to be integers, useNumberFieldState excepts them as decimals
@@ -12038,9 +12046,11 @@ function NumberField(props) {
12038
12046
  },
12039
12047
  onFocus: () => {
12040
12048
  valueRef.current = { wip: true, value: value === void 0 ? Number.NaN : value / factor };
12049
+ lastSentRef.current = value;
12041
12050
  },
12042
12051
  onBlur: () => {
12043
12052
  valueRef.current = { wip: false };
12053
+ lastSentRef.current = void 0;
12044
12054
  },
12045
12055
  onKeyDown: (e) => {
12046
12056
  if (e.key === "Enter") {
@@ -12074,7 +12084,9 @@ function NumberField(props) {
12074
12084
  }),
12075
12085
  onChange: (rawInputValue) => {
12076
12086
  const parsedValue = numberParser.parse(rawInputValue || "");
12077
- onChange(formatValue(parsedValue, factor, numFractionDigits, numIntegerDigits, positiveOnly));
12087
+ const formatted = formatValue(parsedValue, factor, numFractionDigits, numIntegerDigits, positiveOnly);
12088
+ lastSentRef.current = formatted;
12089
+ onChange(formatted);
12078
12090
  },
12079
12091
  inputRef,
12080
12092
  onBlur,