@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.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,
@@ -13878,7 +13890,7 @@ function useColumnResizeHandlers(columns, columnSizes, tableWidth, setResizedWid
13878
13890
  // src/components/Table/hooks/useScrollStorage.ts
13879
13891
  var import_react72 = require("react");
13880
13892
  function useScrollStorage(tableId, enabled = true) {
13881
- const storageKey = `scrollPosition_${window.location.pathname}_${tableId}`;
13893
+ const storageKey = `scrollPosition_${window.location.pathname}${window.location.search}_${tableId}`;
13882
13894
  return (0, import_react72.useMemo)(
13883
13895
  () => ({
13884
13896
  getScrollIndex: () => {
@@ -14260,7 +14272,7 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
14260
14272
  }
14261
14273
  );
14262
14274
  }
14263
- function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, _stickyOffset, infiniteScroll, _tableContainerRef, persistScrollPosition = true) {
14275
+ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, firstRowMessage, stickyHeader, xss, virtuosoRef, virtuosoRangeRef, tableHeadRows, _stickyOffset, infiniteScroll, _tableContainerRef, persistScrollPosition = infiniteScroll === void 0) {
14264
14276
  const { footerStyle, listStyle } = (0, import_react74.useMemo)(() => {
14265
14277
  const { paddingBottom, ...otherRootStyles } = style.rootCss ?? {};
14266
14278
  return { footerStyle: { paddingBottom }, listStyle: { ...style, rootCss: otherRootStyles } };
@@ -14269,13 +14281,14 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
14269
14281
  const { getScrollIndex, setScrollIndex } = useScrollStorage(id, persistScrollPosition);
14270
14282
  const savedScrollIndex = getScrollIndex();
14271
14283
  const topItemCount = stickyHeader ? tableHeadRows.length : 0;
14272
- const virtuosoKey = !!savedScrollIndex && visibleDataRows.length > 0 ? "with-data" : "virtuoso";
14284
+ const validatedScrollIndex = savedScrollIndex !== void 0 && savedScrollIndex < visibleDataRows.length ? savedScrollIndex : void 0;
14285
+ const virtuosoKey = !!validatedScrollIndex && visibleDataRows.length > 0 ? "with-data" : "virtuoso";
14273
14286
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14274
14287
  import_react_virtuoso2.Virtuoso,
14275
14288
  {
14276
14289
  overscan: 5,
14277
14290
  ref: virtuosoRef,
14278
- ...savedScrollIndex !== void 0 ? { initialTopMostItemIndex: savedScrollIndex } : {},
14291
+ ...validatedScrollIndex !== void 0 ? { initialTopMostItemIndex: validatedScrollIndex } : {},
14279
14292
  components: {
14280
14293
  // Applying a zIndex: 2 to ensure it stays on top of sticky columns
14281
14294
  TopItemList: import_react74.default.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
@@ -14314,7 +14327,7 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
14314
14327
  },
14315
14328
  rangeChanged: (newRange) => {
14316
14329
  virtuosoRangeRef.current = newRange;
14317
- if (!infiniteScroll) {
14330
+ if (!infiniteScroll && visibleDataRows.length > 0) {
14318
14331
  setScrollIndex(newRange.startIndex);
14319
14332
  }
14320
14333
  },