@ai-matrx/design-system 0.20.9 → 0.20.10

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.
@@ -1362,6 +1362,35 @@ function useProgressiveTableRows({
1362
1362
  onPageAdvance(nextPage);
1363
1363
  }
1364
1364
  };
1365
+ const warnedUnderfill = useRef4(null);
1366
+ useEffect2(() => {
1367
+ if (!hasMore) return;
1368
+ const surfaces = containers.map((entry) => entry && "current" in entry ? entry.current : entry).filter((entry) => entry !== null);
1369
+ const fillViewport = () => {
1370
+ for (const surface of surfaces) {
1371
+ if (surface.clientHeight <= 0 || surface.getClientRects().length === 0) continue;
1372
+ const content = surface.querySelector("table") ?? surface.lastElementChild;
1373
+ if (!content) continue;
1374
+ const bounds = surface.getBoundingClientRect();
1375
+ const contentBottom = content.getBoundingClientRect().bottom - bounds.top + surface.scrollTop;
1376
+ if (contentBottom <= 0 || contentBottom >= surface.clientHeight - 1) continue;
1377
+ if (warnedUnderfill.current !== progressionKey) {
1378
+ warnedUnderfill.current = progressionKey;
1379
+ console.warn("[MatrxDataTable] The initial local batch leaves unused table height while more rows are already loaded. Revealing additional rows to fill the viewport; this is not a network fetch.");
1380
+ }
1381
+ setProgression((current) => {
1382
+ if (current.key !== progressionKey) return current;
1383
+ const nextCount = Math.min(rows.length, visibleCount + pageSize);
1384
+ return current.shownCount >= nextCount ? current : { ...current, shownCount: nextCount };
1385
+ });
1386
+ break;
1387
+ }
1388
+ };
1389
+ fillViewport();
1390
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(fillViewport);
1391
+ for (const surface of surfaces) observer?.observe(surface);
1392
+ return () => observer?.disconnect();
1393
+ }, [containers, hasMore, pageSize, progressionKey, rows.length, visibleCount]);
1365
1394
  const scroll = useScrollPagination({
1366
1395
  containers,
1367
1396
  queryKey: progressionKey,
@@ -1966,6 +1995,7 @@ function GenericTablePagination({
1966
1995
  const startItem = totalItems === 0 ? 0 : progressive ? 1 : (currentPage - 1) * effectiveItemsPerPage + 1;
1967
1996
  const endItem = Math.min(progressive?.shownCount ?? currentPage * effectiveItemsPerPage, totalItems);
1968
1997
  const defaultLabelFormat = (start, end, total) => {
1998
+ if (progressive) return `${end} shown / ${total} loaded`;
1969
1999
  return compact ? `${start}-${end} of ${total}` : `Showing ${start} to ${end} of ${total} entries`;
1970
2000
  };
1971
2001
  const formatLabel = labelFormat || defaultLabelFormat;
@@ -1995,7 +2025,7 @@ function GenericTablePagination({
1995
2025
  /* @__PURE__ */ jsx20(
1996
2026
  SelectTrigger,
1997
2027
  {
1998
- "aria-label": "Rows per page",
2028
+ "aria-label": progressive ? "Rows per batch" : "Rows per page",
1999
2029
  className: cn(
2000
2030
  "focus:ring-0",
2001
2031
  compact ? "h-11 min-w-20 rounded-md border border-border bg-card px-3 text-sm hover:bg-accent [&_svg]:size-5" : "h-8 w-[3.75rem] text-xs sm:w-36 sm:text-sm"
@@ -2017,13 +2047,7 @@ function GenericTablePagination({
2017
2047
  {
2018
2048
  className: cn("flex min-w-0 justify-center", infoContainerClassName),
2019
2049
  children: showPageInfo && !hideEntriesInfo && /* @__PURE__ */ jsxs13(Fragment, { children: [
2020
- /* @__PURE__ */ jsxs13("span", { className: "truncate text-xs tabular-nums text-muted-foreground sm:hidden", children: [
2021
- startItem,
2022
- "-",
2023
- endItem,
2024
- " / ",
2025
- totalItems
2026
- ] }),
2050
+ /* @__PURE__ */ jsx20("span", { className: "truncate text-xs tabular-nums text-muted-foreground sm:hidden", children: progressive ? `${endItem}/${totalItems} loaded` : `${startItem}-${endItem} / ${totalItems}` }),
2027
2051
  /* @__PURE__ */ jsx20(
2028
2052
  "span",
2029
2053
  {
@@ -10718,7 +10742,7 @@ function MatrxDataTableCore({
10718
10742
  onClick: appendQuery.pagination.retrySource ?? (appendQuery.pagination.hasNextPage ? appendQuery.pagination.loadNextPage : appendQuery.pagination.refresh),
10719
10743
  children: appendQuery.pagination.retrySource ? "Retry source" : appendQuery.pagination.hasNextPage ? "Retry" : "Reload rows"
10720
10744
  }
10721
- ) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ jsxs29("div", { className: "flex shrink-0 gap-0", children: [
10745
+ ) : appendQuery.pagination.hasNextPage || scrollPagination.error ? /* @__PURE__ */ jsxs29("div", { className: "flex min-w-0 max-w-full flex-wrap gap-0", children: [
10722
10746
  /* @__PURE__ */ jsx39(
10723
10747
  Button,
10724
10748
  {