@homebound/beam 2.415.2 → 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,
@@ -13519,7 +13531,7 @@ function useColumnResizeHandlers(columns, columnSizes, tableWidth, setResizedWid
13519
13531
  // src/components/Table/hooks/useScrollStorage.ts
13520
13532
  import { useMemo as useMemo23 } from "react";
13521
13533
  function useScrollStorage(tableId, enabled = true) {
13522
- const storageKey = `scrollPosition_${window.location.pathname}_${tableId}`;
13534
+ const storageKey = `scrollPosition_${window.location.pathname}${window.location.search}_${tableId}`;
13523
13535
  return useMemo23(
13524
13536
  () => ({
13525
13537
  getScrollIndex: () => {
@@ -13901,7 +13913,7 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
13901
13913
  }
13902
13914
  );
13903
13915
  }
13904
- function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, _stickyOffset, infiniteScroll, _tableContainerRef, persistScrollPosition = true) {
13916
+ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, _stickyOffset, infiniteScroll, _tableContainerRef, persistScrollPosition = infiniteScroll === void 0) {
13905
13917
  const { footerStyle, listStyle } = useMemo24(() => {
13906
13918
  const { paddingBottom, ...otherRootStyles } = style.rootCss ?? {};
13907
13919
  return { footerStyle: { paddingBottom }, listStyle: { ...style, rootCss: otherRootStyles } };
@@ -13910,13 +13922,14 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
13910
13922
  const { getScrollIndex, setScrollIndex } = useScrollStorage(id, persistScrollPosition);
13911
13923
  const savedScrollIndex = getScrollIndex();
13912
13924
  const topItemCount = stickyHeader ? tableHeadRows.length : 0;
13913
- const virtuosoKey = !!savedScrollIndex && visibleDataRows.length > 0 ? "with-data" : "virtuoso";
13925
+ const validatedScrollIndex = savedScrollIndex !== void 0 && savedScrollIndex < visibleDataRows.length ? savedScrollIndex : void 0;
13926
+ const virtuosoKey = !!validatedScrollIndex && visibleDataRows.length > 0 ? "with-data" : "virtuoso";
13914
13927
  return /* @__PURE__ */ jsx81(
13915
13928
  Virtuoso2,
13916
13929
  {
13917
13930
  overscan: 5,
13918
13931
  ref: virtuosoRef,
13919
- ...savedScrollIndex !== void 0 ? { initialTopMostItemIndex: savedScrollIndex } : {},
13932
+ ...validatedScrollIndex !== void 0 ? { initialTopMostItemIndex: validatedScrollIndex } : {},
13920
13933
  components: {
13921
13934
  // Applying a zIndex: 2 to ensure it stays on top of sticky columns
13922
13935
  TopItemList: React13.forwardRef((props, ref) => /* @__PURE__ */ jsx81(
@@ -13955,7 +13968,7 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
13955
13968
  },
13956
13969
  rangeChanged: (newRange) => {
13957
13970
  virtuosoRangeRef.current = newRange;
13958
- if (!infiniteScroll) {
13971
+ if (!infiniteScroll && visibleDataRows.length > 0) {
13959
13972
  setScrollIndex(newRange.startIndex);
13960
13973
  }
13961
13974
  },