@coldsmirk/ledger-mantine 0.11.1 → 0.12.1

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
@@ -1646,6 +1646,67 @@ function ledgerCommands(meta) {
1646
1646
  return meta;
1647
1647
  }
1648
1648
  //#endregion
1649
+ //#region src/load-more-retry.ts
1650
+ /**
1651
+ * The retry of a next page that could not be read. Pressed, it is held — the row and its button
1652
+ * stay, the focus with them, and a press asks nothing — until the page is answered: `loadingMore`
1653
+ * said and unsaid, or, from a host that never says it, new `data` or a new `loadMoreError`. A host
1654
+ * may keep `loadMoreError` while it asks again or clear it; the row stays either way.
1655
+ */
1656
+ function useLoadMoreRetry({ data, loadingMore, loadMoreError, askAgain, viewportRef }) {
1657
+ const [asked, setAsked] = useState(null);
1658
+ if (asked) {
1659
+ if (loadingMore) {
1660
+ if (!asked.loadingSeen) setAsked({
1661
+ ...asked,
1662
+ loadingSeen: true
1663
+ });
1664
+ } else if (asked.loadingSeen || loadMoreError !== asked.loadMoreError || data !== asked.data) setAsked(null);
1665
+ }
1666
+ const held = asked !== null || loadingMore;
1667
+ const retry = useEventCallback(() => {
1668
+ if (held) return;
1669
+ setAsked({
1670
+ data,
1671
+ loadMoreError,
1672
+ loadingSeen: false
1673
+ });
1674
+ askAgain?.();
1675
+ });
1676
+ const [viewportHoldsHandedFocus, setViewportHoldsHandedFocus] = useState(false);
1677
+ const release = useEventCallback(() => setViewportHoldsHandedFocus(true));
1678
+ useLayoutEffect(() => {
1679
+ if (viewportHoldsHandedFocus) viewportRef.current?.focus({ preventScroll: true });
1680
+ }, [viewportHoldsHandedFocus, viewportRef]);
1681
+ const onViewportBlur = useEventCallback((event) => {
1682
+ if (event.target === event.currentTarget) setViewportHoldsHandedFocus(false);
1683
+ });
1684
+ const shown = asked !== null || Boolean(loadMoreError);
1685
+ const canRetry = askAgain !== void 0;
1686
+ return {
1687
+ row: useMemo(() => {
1688
+ if (shown) return {
1689
+ kind: "retry",
1690
+ failure: loadMoreError,
1691
+ held,
1692
+ retry: canRetry ? retry : void 0,
1693
+ release
1694
+ };
1695
+ return loadingMore ? { kind: "loading" } : null;
1696
+ }, [
1697
+ shown,
1698
+ loadMoreError,
1699
+ held,
1700
+ canRetry,
1701
+ retry,
1702
+ release,
1703
+ loadingMore
1704
+ ]),
1705
+ viewportHoldsHandedFocus,
1706
+ onViewportBlur
1707
+ };
1708
+ }
1709
+ //#endregion
1649
1710
  //#region src/pagination-bar.tsx
1650
1711
  /**
1651
1712
  * The pagination bar: summary on the start side, rows-per-page and page controls on the end
@@ -1749,6 +1810,125 @@ function DataTablePagination(props) {
1749
1810
  });
1750
1811
  }
1751
1812
  //#endregion
1813
+ //#region src/scroll-snapshot.ts
1814
+ /**
1815
+ * Opaque scroll-restoration snapshots (`docs/virtualization.md#restoring-scroll-position`).
1816
+ *
1817
+ * A snapshot captures plain, JSON-serializable scroll geometry — the viewport's offsets, its last
1818
+ * known dimensions, and TanStack Virtual's measured row heights (`takeSnapshot()`) — tagged with a
1819
+ * shape version so storage/history payloads from another version of ledger fail validation instead
1820
+ * of restoring corrupt numbers.
1821
+ */
1822
+ const SCROLL_SNAPSHOT_VERSION = 1;
1823
+ function isRecord$1(value) {
1824
+ return typeof value === "object" && value !== null && !Array.isArray(value);
1825
+ }
1826
+ function isFiniteNumber$1(value) {
1827
+ return typeof value === "number" && Number.isFinite(value);
1828
+ }
1829
+ function isNonNegativeFinite(value) {
1830
+ return isFiniteNumber$1(value) && value >= 0;
1831
+ }
1832
+ function isNonNegativeInteger(value) {
1833
+ return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
1834
+ }
1835
+ function isViewportRect(value) {
1836
+ if (!isRecord$1(value)) return false;
1837
+ return isNonNegativeFinite(value.width) && isNonNegativeFinite(value.height);
1838
+ }
1839
+ function isSerializedVirtualItem(value) {
1840
+ if (!isRecord$1(value)) return false;
1841
+ const validKey = typeof value.key === "string" || isFiniteNumber$1(value.key);
1842
+ return isNonNegativeInteger(value.index) && validKey && isFiniteNumber$1(value.start) && isNonNegativeFinite(value.size) && isFiniteNumber$1(value.end) && isNonNegativeInteger(value.lane);
1843
+ }
1844
+ /**
1845
+ * Validates an unknown value — such as one read back from `sessionStorage` or router history
1846
+ * state — as a {@link DataTableScrollSnapshot} written by this version of ledger.
1847
+ */
1848
+ function isDataTableScrollSnapshot(value) {
1849
+ if (!isRecord$1(value) || value.version !== SCROLL_SNAPSHOT_VERSION) return false;
1850
+ if (!isNonNegativeFinite(value.scrollTop) || !isFiniteNumber$1(value.scrollLeft)) return false;
1851
+ if (value.viewport !== null && !isViewportRect(value.viewport)) return false;
1852
+ return value.measurements === null || Array.isArray(value.measurements) && value.measurements.every(isSerializedVirtualItem);
1853
+ }
1854
+ /**
1855
+ * Validates and unwraps a snapshot at the component boundary. Invalid or mismatched-version
1856
+ * payloads degrade to `null` instead of throwing.
1857
+ */
1858
+ function readScrollSnapshot(value) {
1859
+ if (!isDataTableScrollSnapshot(value)) return null;
1860
+ return value;
1861
+ }
1862
+ function readViewportRect(viewport, virtualizer) {
1863
+ const virtualRect = virtualizer?.scrollRect;
1864
+ if (virtualRect && virtualRect.width > 0 && virtualRect.height > 0) return {
1865
+ width: Math.round(virtualRect.width),
1866
+ height: Math.round(virtualRect.height)
1867
+ };
1868
+ const width = Math.round(viewport.offsetWidth);
1869
+ const height = Math.round(viewport.offsetHeight);
1870
+ if (width > 0 && height > 0) return {
1871
+ width,
1872
+ height
1873
+ };
1874
+ return null;
1875
+ }
1876
+ function serializeVirtualMeasurements(virtualizer) {
1877
+ const items = [];
1878
+ for (const item of virtualizer.takeSnapshot()) {
1879
+ if (typeof item.key !== "string" && !(typeof item.key === "number" && Number.isFinite(item.key))) continue;
1880
+ items.push({
1881
+ index: item.index,
1882
+ key: item.key,
1883
+ start: item.start,
1884
+ size: item.size,
1885
+ end: item.end,
1886
+ lane: item.lane
1887
+ });
1888
+ }
1889
+ return items;
1890
+ }
1891
+ /**
1892
+ * Captures the viewport's current scroll offsets, dimensions, and measured virtualizer row heights
1893
+ * as an opaque plain-data snapshot. Returns `null` while the viewport is not mounted.
1894
+ */
1895
+ function captureScrollSnapshot(viewport, virtualizer) {
1896
+ if (!viewport) return null;
1897
+ const rawTop = Number.isFinite(viewport.scrollTop) ? viewport.scrollTop : 0;
1898
+ const scrollTop = Math.max(0, rawTop);
1899
+ const scrollLeft = Number.isFinite(viewport.scrollLeft) ? viewport.scrollLeft : 0;
1900
+ return {
1901
+ version: SCROLL_SNAPSHOT_VERSION,
1902
+ scrollTop,
1903
+ scrollLeft,
1904
+ viewport: readViewportRect(viewport, virtualizer),
1905
+ measurements: virtualizer === null ? null : serializeVirtualMeasurements(virtualizer)
1906
+ };
1907
+ }
1908
+ /**
1909
+ * Resolves a validated snapshot into the mount-only options TanStack Virtual expects, clamped to
1910
+ * the rows the table mounts with so a snapshot taken on a longer table lands at the end instead of
1911
+ * past it. Returns `null` when there is no snapshot or no rows to restore into.
1912
+ */
1913
+ function resolveInitialVirtualRestore(snapshot, rowKeys, estimateHeight) {
1914
+ if (snapshot === null || rowKeys.length === 0) return null;
1915
+ const measurements = [];
1916
+ const sizeByKey = /* @__PURE__ */ new Map();
1917
+ if (snapshot.measurements !== null) for (const item of snapshot.measurements) {
1918
+ sizeByKey.set(item.key, item.size);
1919
+ measurements.push({ ...item });
1920
+ }
1921
+ let totalHeight = 0;
1922
+ for (const key of rowKeys) totalHeight += sizeByKey.get(key) ?? estimateHeight;
1923
+ const viewportHeight = snapshot.viewport?.height ?? 0;
1924
+ const maxOffset = viewportHeight > 0 ? Math.max(0, totalHeight - viewportHeight) : totalHeight;
1925
+ return {
1926
+ offset: Math.min(snapshot.scrollTop, maxOffset),
1927
+ measurements,
1928
+ rect: snapshot.viewport ? { ...snapshot.viewport } : void 0
1929
+ };
1930
+ }
1931
+ //#endregion
1752
1932
  //#region src/search.tsx
1753
1933
  /**
1754
1934
  * `DataTable.Search` — the global-filter input, debounced. A standalone compound: takes the
@@ -2867,11 +3047,19 @@ function LoaderRow({ colSpan, ariaRowIndex }) {
2867
3047
  })
2868
3048
  });
2869
3049
  }
2870
- function LoadMoreErrorRow({ colSpan, message, ariaRowIndex, onRetry }) {
3050
+ function LoadMoreRetryRow({ colSpan, ariaRowIndex, failure, held, retry, release }) {
2871
3051
  const { getStyles, labels, icons } = useDataTableContext();
3052
+ const retryButton = useRef(null);
3053
+ useLayoutEffect(() => {
3054
+ const button = retryButton.current;
3055
+ return () => {
3056
+ if (button && button.ownerDocument.activeElement === button) release();
3057
+ };
3058
+ }, [release]);
2872
3059
  return /* @__PURE__ */ jsx(Table.Tr, {
2873
- "data-error": true,
2874
3060
  "aria-rowindex": ariaRowIndex,
3061
+ "data-error": !held || void 0,
3062
+ "data-pending": held || void 0,
2875
3063
  role: "row",
2876
3064
  ...getStyles("loaderRow"),
2877
3065
  children: /* @__PURE__ */ jsx(Table.Td, {
@@ -2880,22 +3068,34 @@ function LoadMoreErrorRow({ colSpan, message, ariaRowIndex, onRetry }) {
2880
3068
  role: "cell",
2881
3069
  children: /* @__PURE__ */ jsxs("div", {
2882
3070
  ...getStyles("loaderRowContent"),
2883
- children: [/* @__PURE__ */ jsx("span", {
3071
+ children: [/* @__PURE__ */ jsxs("span", { children: [/* @__PURE__ */ jsx("span", {
3072
+ role: "status",
3073
+ children: held && labels.loadingMore
3074
+ }), !held && /* @__PURE__ */ jsx("span", {
2884
3075
  role: "alert",
2885
- children: message === true ? labels.loadMoreError : message
2886
- }), onRetry && /* @__PURE__ */ jsx(Button, {
3076
+ children: failure === true ? labels.loadMoreError : failure
3077
+ })] }), retry && /* @__PURE__ */ jsx(Button, {
3078
+ ref: retryButton,
3079
+ ...getStyles("loaderRowRetry"),
3080
+ "aria-busy": held || void 0,
3081
+ "aria-disabled": held || void 0,
2887
3082
  color: "gray",
2888
- leftSection: /* @__PURE__ */ jsx(icons.retry, { size: 14 }),
3083
+ "data-disabled": held || void 0,
2889
3084
  size: "compact-xs",
2890
3085
  variant: "subtle",
2891
- onClick: onRetry,
3086
+ leftSection: held ? /* @__PURE__ */ jsx(Loader, {
3087
+ "aria-hidden": true,
3088
+ color: "var(--button-color)",
3089
+ size: 14
3090
+ }) : /* @__PURE__ */ jsx(icons.retry, { size: 14 }),
3091
+ onClick: retry,
2892
3092
  children: labels.retry
2893
3093
  })]
2894
3094
  })
2895
3095
  })
2896
3096
  });
2897
3097
  }
2898
- function TableBody({ table, virtualization, columnWindow, filler, viewportRef, loading, loadingMore, loadMoreError, onLoadMoreRetry, reorderSourceId, reorderTarget, skeletonRowCount, onVirtualizerChange }) {
3098
+ function TableBody({ table, virtualization, initialScroll, columnWindow, filler, viewportRef, loading, loadMoreRow, reorderSourceId, reorderTarget, skeletonRowCount, onVirtualizerChange }) {
2899
3099
  const { getStyles, withColumnHeaders } = useDataTableContext();
2900
3100
  const ledger = table.options.meta?.ledger;
2901
3101
  const withDetailPanels = Boolean(ledger?.renderDetailPanel);
@@ -2923,18 +3123,24 @@ function TableBody({ table, virtualization, columnWindow, filler, viewportRef, l
2923
3123
  const getItemKey = useCallback((index) => centerDisplayRows[index]?.key ?? index, [centerDisplayRows]);
2924
3124
  const estimateHeight = virtualization?.estimateHeight ?? DEFAULT_ESTIMATED_ROW_HEIGHT;
2925
3125
  const estimateSize = useCallback(() => estimateHeight, [estimateHeight]);
3126
+ const [initialRestore] = useState(() => virtualization === null ? null : resolveInitialVirtualRestore(initialScroll, centerDisplayRows.map((row) => row.key), estimateHeight));
2926
3127
  const virtualizer = useVirtualizer({
2927
3128
  count: centerDisplayRows.length,
2928
3129
  enabled: virtualization !== null,
2929
3130
  estimateSize,
2930
3131
  getItemKey,
2931
3132
  getScrollElement: () => viewportRef.current,
3133
+ ...initialRestore !== null && {
3134
+ initialMeasurementsCache: initialRestore.measurements,
3135
+ initialOffset: initialRestore.offset,
3136
+ ...initialRestore.rect !== void 0 && { initialRect: initialRestore.rect }
3137
+ },
2932
3138
  measureElement: measureRow,
2933
3139
  overscan: virtualization?.overscan ?? DEFAULT_OVERSCAN,
2934
3140
  useFlushSync: false
2935
3141
  });
2936
3142
  const virtualEnabled = virtualization !== null;
2937
- useEffect(() => {
3143
+ useLayoutEffect(() => {
2938
3144
  onVirtualizerChange(virtualEnabled ? virtualizer : null);
2939
3145
  return () => onVirtualizerChange(null);
2940
3146
  }, [
@@ -2981,7 +3187,7 @@ function TableBody({ table, virtualization, columnWindow, filler, viewportRef, l
2981
3187
  const editingCell = ledger?.editing.cell ?? null;
2982
3188
  const editingRowId = ledger?.editing.mode === "row" ? ledger.editing.row.id : null;
2983
3189
  const activeRowId = ledger?.activeRow.enabled ? ledger.activeRow.id : null;
2984
- const trailingRowCount = loadMoreError || loadingMore ? 1 : 0;
3190
+ const trailingRowCount = loadMoreRow ? 1 : 0;
2985
3191
  const zoneRows = {
2986
3192
  top: topDisplayRows,
2987
3193
  center: centerDisplayRows,
@@ -3084,12 +3290,14 @@ function TableBody({ table, virtualization, columnWindow, filler, viewportRef, l
3084
3290
  pinnedOffset: pinnedRowOffsets.offsets.bottom[displayIndex],
3085
3291
  pinnedPosition: "bottom"
3086
3292
  })),
3087
- loadMoreError ? /* @__PURE__ */ jsx(LoadMoreErrorRow, {
3293
+ loadMoreRow?.kind === "retry" ? /* @__PURE__ */ jsx(LoadMoreRetryRow, {
3088
3294
  ariaRowIndex: virtualEnabled ? headerRowCount + totalDisplayRowCount + 1 : void 0,
3089
3295
  colSpan: fullWidthColSpan,
3090
- message: loadMoreError,
3091
- onRetry: onLoadMoreRetry
3092
- }) : loadingMore && /* @__PURE__ */ jsx(LoaderRow, {
3296
+ failure: loadMoreRow.failure,
3297
+ held: loadMoreRow.held,
3298
+ release: loadMoreRow.release,
3299
+ retry: loadMoreRow.retry
3300
+ }) : loadMoreRow?.kind === "loading" && /* @__PURE__ */ jsx(LoaderRow, {
3093
3301
  ariaRowIndex: virtualEnabled ? headerRowCount + totalDisplayRowCount + 1 : void 0,
3094
3302
  colSpan: fullWidthColSpan
3095
3303
  })
@@ -7005,6 +7213,7 @@ const classes = {
7005
7213
  empty: "ledger-empty",
7006
7214
  loaderRow: "ledger-loader-row",
7007
7215
  loaderRowContent: "ledger-loader-row-content",
7216
+ loaderRowRetry: "ledger-loader-row-retry",
7008
7217
  paginationBar: "ledger-pagination-bar"
7009
7218
  };
7010
7219
  /**
@@ -7169,7 +7378,7 @@ function DataTableFromOptions({ props }) {
7169
7378
  });
7170
7379
  }
7171
7380
  function DataTableCore({ presentation, stylesProps, table }) {
7172
- const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, size: sizeProp, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, columnMinSizeFromHeader, virtualizedRows, virtualizedColumns, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
7381
+ const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, size: sizeProp, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, columnMinSizeFromHeader, virtualizedRows, virtualizedColumns, initialScroll, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
7173
7382
  const getStyles = useStyles({
7174
7383
  name: "DataTable",
7175
7384
  classes,
@@ -7242,6 +7451,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7242
7451
  tableMinWidth,
7243
7452
  viewport
7244
7453
  });
7454
+ const [initialScrollData] = useState(() => readScrollSnapshot(initialScroll));
7245
7455
  const virtualization = virtualizedRows ? {
7246
7456
  estimateHeight: typeof virtualizedRows === "object" && virtualizedRows.estimateHeight !== void 0 ? virtualizedRows.estimateHeight : scale.rowHeight,
7247
7457
  overscan: typeof virtualizedRows === "object" && virtualizedRows.overscan !== void 0 ? virtualizedRows.overscan : 8
@@ -7384,10 +7594,17 @@ function DataTableCore({ presentation, stylesProps, table }) {
7384
7594
  hasEndReachedHandler,
7385
7595
  maybeFireEndReached
7386
7596
  ]);
7387
- const retryLoadMore = useEventCallback(() => {
7597
+ const askForMoreAgain = useEventCallback(() => {
7388
7598
  lastEndReachedData.current = null;
7389
7599
  onEndReached?.();
7390
7600
  });
7601
+ const loadMoreRetry = useLoadMoreRetry({
7602
+ data: currentData,
7603
+ loadingMore: loadingMore === true,
7604
+ loadMoreError: loadMoreError ?? false,
7605
+ askAgain: onEndReached ? askForMoreAgain : void 0,
7606
+ viewportRef
7607
+ });
7391
7608
  const [scrollEdges, setScrollEdges] = useState({
7392
7609
  start: false,
7393
7610
  end: false
@@ -7455,7 +7672,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7455
7672
  rowPinningActive,
7456
7673
  withDetailPanels
7457
7674
  ]);
7458
- const bodyAriaRowCount = loading && logicalDisplayRowCount === 0 ? skeletonRowCount : logicalDisplayRowCount + (loadMoreError || loadingMore ? 1 : 0) + (isEmpty || errorActive ? 1 : 0);
7675
+ const bodyAriaRowCount = loading && logicalDisplayRowCount === 0 ? skeletonRowCount : logicalDisplayRowCount + (loadMoreRetry.row ? 1 : 0) + (isEmpty || errorActive ? 1 : 0);
7459
7676
  const footerRowCount = visibleFooterGroups(table).length;
7460
7677
  const ariaRowCount = headerRowCount + bodyAriaRowCount + footerRowCount;
7461
7678
  const footerAriaRowIndexStart = headerRowCount + bodyAriaRowCount + 1;
@@ -7464,6 +7681,19 @@ function DataTableCore({ presentation, stylesProps, table }) {
7464
7681
  if (!element) return;
7465
7682
  for (const mirror of [headerViewportRef.current, footerViewportRef.current]) if (mirror && mirror.scrollLeft !== element.scrollLeft) mirror.scrollLeft = element.scrollLeft;
7466
7683
  });
7684
+ const initialScrollApplied = useRef(false);
7685
+ useLayoutEffect(() => {
7686
+ if (initialScrollApplied.current || initialScrollData === null) return;
7687
+ const element = viewportRef.current;
7688
+ if (!element) return;
7689
+ initialScrollApplied.current = true;
7690
+ if (!virtualEnabled && initialScrollData.scrollTop > 0 && rowsLength > 0) element.scrollTop = initialScrollData.scrollTop;
7691
+ if (initialScrollData.scrollLeft !== 0) {
7692
+ element.scrollLeft = initialScrollData.scrollLeft;
7693
+ mirrorBodyScrollLeft();
7694
+ updateScrollEdges();
7695
+ }
7696
+ }, []);
7467
7697
  useEffect(() => {
7468
7698
  updateScrollEdges();
7469
7699
  mirrorBodyScrollLeft();
@@ -7559,6 +7789,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7559
7789
  left: rtl ? -target : target
7560
7790
  });
7561
7791
  });
7792
+ const getScrollSnapshot = useCallback(() => captureScrollSnapshot(viewportRef.current, virtualizerRef.current), []);
7562
7793
  useImperativeHandle(handleRef, () => {
7563
7794
  return {
7564
7795
  table,
@@ -7568,6 +7799,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7568
7799
  scrollToRow: scrollRowIntoView,
7569
7800
  scrollToIndex: scrollIndexIntoView,
7570
7801
  scrollToColumn: scrollColumnIntoView,
7802
+ getScrollSnapshot,
7571
7803
  startEditing: (rowId, columnId) => {
7572
7804
  const editing = table.options.meta?.ledger?.editing;
7573
7805
  if (!editing) return;
@@ -7588,7 +7820,8 @@ function DataTableCore({ presentation, stylesProps, table }) {
7588
7820
  table,
7589
7821
  scrollRowIntoView,
7590
7822
  scrollIndexIntoView,
7591
- scrollColumnIntoView
7823
+ scrollColumnIntoView,
7824
+ getScrollSnapshot
7592
7825
  ]);
7593
7826
  const activeRowAnnouncer = useRef(null);
7594
7827
  const rowNavigationHintId = `${instanceId}-row-navigation`;
@@ -7844,9 +8077,10 @@ function DataTableCore({ presentation, stylesProps, table }) {
7844
8077
  overscrollBehaviorY: viewportFit.overflowsY ? "none" : "auto"
7845
8078
  },
7846
8079
  role: "rowgroup",
7847
- "aria-label": viewportProps?.["aria-label"] ?? (viewportFocusStop ? labels.rows : void 0),
8080
+ "aria-label": viewportProps?.["aria-label"] ?? (viewportFocusStop || loadMoreRetry.viewportHoldsHandedFocus ? labels.rows : void 0),
7848
8081
  "aria-describedby": viewportDescribedBy,
7849
- tabIndex: viewportFocusStop ? 0 : void 0,
8082
+ tabIndex: viewportFocusStop ? 0 : loadMoreRetry.viewportHoldsHandedFocus ? -1 : void 0,
8083
+ onBlur: loadMoreRetry.onViewportBlur,
7850
8084
  ...activeRowEnabled && { onKeyDown: handleActiveRowKeyDown }
7851
8085
  }),
7852
8086
  onScrollPositionChange: handleScrollPositionChange,
@@ -7857,16 +8091,15 @@ function DataTableCore({ presentation, stylesProps, table }) {
7857
8091
  children: [/* @__PURE__ */ jsx("colgroup", { children: colElements }), /* @__PURE__ */ jsx(TableBody, {
7858
8092
  columnWindow,
7859
8093
  filler,
8094
+ initialScroll: initialScrollData,
7860
8095
  loading: loading === true,
7861
- loadingMore: loadingMore === true,
7862
- loadMoreError: loadMoreError ?? false,
8096
+ loadMoreRow: loadMoreRetry.row,
7863
8097
  reorderSourceId: rowOrderingEnabled ? rowReorder.sourceId : null,
7864
8098
  reorderTarget: rowOrderingEnabled ? rowReorder.target : null,
7865
8099
  skeletonRowCount,
7866
8100
  table: erasedTable,
7867
8101
  viewportRef,
7868
8102
  virtualization,
7869
- onLoadMoreRetry: onEndReached ? retryLoadMore : void 0,
7870
8103
  onVirtualizerChange: handleVirtualizerChange
7871
8104
  })]
7872
8105
  }),
@@ -8047,6 +8280,6 @@ function checkboxEditor() {
8047
8280
  return renderCheckboxEditor;
8048
8281
  }
8049
8282
  //#endregion
8050
- export { DataTable, DataTableColumnsPanel, DataTablePagination, DataTableSearch, DataTableSelectionBar, checkboxEditor, createColumnHelper, defaultIcons, defaultLabels, flexRender, numberEditor, selectEditor, textEditor, toCsv, useDataTable };
8283
+ export { DataTable, DataTableColumnsPanel, DataTablePagination, DataTableSearch, DataTableSelectionBar, checkboxEditor, createColumnHelper, defaultIcons, defaultLabels, flexRender, isDataTableScrollSnapshot, numberEditor, selectEditor, textEditor, toCsv, useDataTable };
8051
8284
 
8052
8285
  //# sourceMappingURL=index.js.map