najm-kit 2.2.3 → 2.2.5

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.
Files changed (2) hide show
  1. package/dist/index.mjs +36 -6
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -12127,7 +12127,24 @@ var computeFlags = (state) => {
12127
12127
  const hasControls = Boolean(state.showColumnVisibility || state.showAddButton || state.showViewToggle);
12128
12128
  const isRefreshing = Boolean(state.isLoading) && hasData;
12129
12129
  const showContent = !state.error && !hasNoData && !isFilteredEmpty && (!state.isLoading || hasData);
12130
- return { hasData, hasNoData, isTableView, isCardView, isJsonView, isFilesView, isCustomMode, hasActions, hasControls, isRefreshing, showContent, showPagination: state.showPagination && showContent };
12130
+ return {
12131
+ hasData,
12132
+ hasNoData,
12133
+ isTableView,
12134
+ isCardView,
12135
+ isJsonView,
12136
+ isFilesView,
12137
+ isCustomMode,
12138
+ hasActions,
12139
+ hasControls,
12140
+ isRefreshing,
12141
+ showContent,
12142
+ // Rendered during a first load too, so the bar occupies its height while
12143
+ // the skeleton is up. Without it the body is one bar taller than it will be
12144
+ // once rows arrive, the measured page size is one row too many, and that
12145
+ // row is visibly removed the moment the table loads.
12146
+ showPagination: state.showPagination && (showContent || Boolean(state.isLoading))
12147
+ };
12131
12148
  };
12132
12149
  var createSelectors = (_store) => {
12133
12150
  const store = _store;
@@ -12729,11 +12746,12 @@ function useTable(effectiveViewModeOverride) {
12729
12746
  if (dynamicPageSizeTarget === storePagination.pageSize) return;
12730
12747
  const reported = reportedGeometryRef.current;
12731
12748
  if (reported?.key === geometryKey && reported.count >= MAX_PAGE_SIZE_REPORTS_PER_GEOMETRY) return;
12749
+ const delay = reported ? DYNAMIC_PAGE_SIZE_DEBOUNCE_MS : 0;
12732
12750
  const timer = setTimeout(() => {
12733
12751
  const current = reportedGeometryRef.current;
12734
12752
  reportedGeometryRef.current = current?.key === geometryKey ? { key: geometryKey, count: current.count + 1 } : { key: geometryKey, count: 1 };
12735
12753
  setPagination({ pageIndex: storePagination.pageIndex, pageSize: dynamicPageSizeTarget });
12736
- }, DYNAMIC_PAGE_SIZE_DEBOUNCE_MS);
12754
+ }, delay);
12737
12755
  return () => clearTimeout(timer);
12738
12756
  }, [
12739
12757
  manualPagination,
@@ -13210,6 +13228,7 @@ function NDataCardShell({ row, onClick, onContextMenu, actions, children, classN
13210
13228
  );
13211
13229
  }
13212
13230
  var DEFAULT_ROWS2 = 6;
13231
+ var UNMEASURED_DYNAMIC_ROWS = 32;
13213
13232
  var DEFAULT_CARD_COUNT = 48;
13214
13233
  function NTableCardSkeleton({ surface }) {
13215
13234
  return /* @__PURE__ */ jsx(
@@ -13356,7 +13375,7 @@ function NTableLoadingSkeleton({ rows }) {
13356
13375
  const userGetRowCanExpand = useTableStore.use.getRowCanExpand();
13357
13376
  const hasExpansion = Boolean(renderSubRow || userGetRowCanExpand);
13358
13377
  const loadingText = useTableStore.use.loadingText();
13359
- const rowCount = rows ?? (dynamicHeight && bodyHeight > 0 ? skeletonRowCount : DEFAULT_ROWS2);
13378
+ const rowCount = rows ?? (dynamicHeight ? bodyHeight > 0 ? skeletonRowCount : UNMEASURED_DYNAMIC_ROWS : DEFAULT_ROWS2);
13360
13379
  const renderHeaderLabel = (header) => typeof header === "string" ? header : null;
13361
13380
  return /* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 flex-col gap-2", children: [
13362
13381
  /* @__PURE__ */ jsx(NTableHeaderSkeleton, {}),
@@ -13840,7 +13859,7 @@ function CardLoadMorePagination({
13840
13859
  function NTablePagination() {
13841
13860
  const table = useTableStore.use.table();
13842
13861
  const showPagination = useTableStore.use.showPagination();
13843
- const showContent = useTableStore.use.showContent();
13862
+ useTableStore.use.showContent();
13844
13863
  const pageSizeOptions = useTableStore.use.pageSizeOptions();
13845
13864
  const classNames = useTableStore.use.classNames();
13846
13865
  const effectiveViewMode = useTableStore.use.effectiveViewMode();
@@ -13853,7 +13872,7 @@ function NTablePagination() {
13853
13872
  const setPagination = useTableStore.use.setPagination();
13854
13873
  const isPaginationControlled = useTableStore.use.isPaginationControlled();
13855
13874
  const bordered = useTableStore.use.bordered();
13856
- if (!table || !showContent || !showPagination || effectiveViewMode === "json" || effectiveViewMode === "files") return null;
13875
+ if (!table || !showPagination || effectiveViewMode === "json" || effectiveViewMode === "files") return null;
13857
13876
  if (cardPagination.mode === "all") return null;
13858
13877
  if (effectiveViewMode === "cards" && cardPagination.mode === "infinite") return null;
13859
13878
  if (effectiveViewMode === "cards" && cardPagination.mode === "load-more") {
@@ -14334,7 +14353,18 @@ function TableLayout(props) {
14334
14353
  ] })
14335
14354
  }
14336
14355
  ),
14337
- /* @__PURE__ */ jsx("div", { "data-ntable-pagination": true, className: "min-w-0 shrink-0 bg-background text-foreground", children: /* @__PURE__ */ jsx(NTablePagination, {}) })
14356
+ /* @__PURE__ */ jsx(
14357
+ "div",
14358
+ {
14359
+ "data-ntable-pagination": true,
14360
+ "aria-hidden": isLoading && !isRefreshing ? "true" : void 0,
14361
+ className: cn(
14362
+ "min-w-0 shrink-0 bg-background text-foreground",
14363
+ isLoading && !isRefreshing && "invisible"
14364
+ ),
14365
+ children: /* @__PURE__ */ jsx(NTablePagination, {})
14366
+ }
14367
+ )
14338
14368
  ] });
14339
14369
  }
14340
14370
  function NTable(props) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najm-kit",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Reusable React UI component package for Najm framework",