@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.js CHANGED
@@ -11669,6 +11669,14 @@ function NumberField(props) {
11669
11669
  }, [type, numberFormatOptions, defaultFormatOptions, numFractionDigits]);
11670
11670
  const numberParser = useMemo18(() => new NumberParser(locale, formatOptions), [locale, formatOptions]);
11671
11671
  const valueRef = useRef29({ wip: false });
11672
+ const lastSentRef = useRef29(void 0);
11673
+ const propValue = value === void 0 ? Number.NaN : value / factor;
11674
+ if (valueRef.current.wip && !Object.is(valueRef.current.value, propValue)) {
11675
+ const lastSentInternal = lastSentRef.current === void 0 ? Number.NaN : lastSentRef.current / factor;
11676
+ if (!Object.is(propValue, lastSentInternal)) {
11677
+ valueRef.current.value = propValue;
11678
+ }
11679
+ }
11672
11680
  const useProps = {
11673
11681
  locale,
11674
11682
  // We want percents && cents to be integers, useNumberFieldState excepts them as decimals
@@ -11679,9 +11687,11 @@ function NumberField(props) {
11679
11687
  },
11680
11688
  onFocus: () => {
11681
11689
  valueRef.current = { wip: true, value: value === void 0 ? Number.NaN : value / factor };
11690
+ lastSentRef.current = value;
11682
11691
  },
11683
11692
  onBlur: () => {
11684
11693
  valueRef.current = { wip: false };
11694
+ lastSentRef.current = void 0;
11685
11695
  },
11686
11696
  onKeyDown: (e) => {
11687
11697
  if (e.key === "Enter") {
@@ -11715,7 +11725,9 @@ function NumberField(props) {
11715
11725
  }),
11716
11726
  onChange: (rawInputValue) => {
11717
11727
  const parsedValue = numberParser.parse(rawInputValue || "");
11718
- onChange(formatValue(parsedValue, factor, numFractionDigits, numIntegerDigits, positiveOnly));
11728
+ const formatted = formatValue(parsedValue, factor, numFractionDigits, numIntegerDigits, positiveOnly);
11729
+ lastSentRef.current = formatted;
11730
+ onChange(formatted);
11719
11731
  },
11720
11732
  inputRef,
11721
11733
  onBlur,