@snowpact/react-tanstack-query-table 1.1.1 → 1.1.2

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.d.ts CHANGED
@@ -60,7 +60,7 @@ export declare type BaseAction = {
60
60
  };
61
61
 
62
62
  /**
63
- * Base props shared between SnowClientTable and SnowServerTable
63
+ * Base props shared between SnowClientDataTable and SnowServerDataTable
64
64
  */
65
65
  export declare interface BaseSnowTableProps<T extends Record<string, unknown>, K> extends DataTableUIOptions<T> {
66
66
  queryKey: string[];
@@ -160,6 +160,7 @@ export declare type DataTableProps<T extends object> = {
160
160
  };
161
161
 
162
162
  declare interface DataTableStyles {
163
+ root: string;
163
164
  container: string;
164
165
  header: string;
165
166
  headerCell: string;
@@ -375,12 +376,12 @@ export declare interface SingleFilterDropdownProps<T extends object> {
375
376
  onFilterChange: (key: keyof T, selectedValues: string[]) => void;
376
377
  }
377
378
 
378
- export declare const SnowClientTable: <T extends Record<string, unknown>, K>({ queryKey, columnConfig, actions, filters, prefilters, prefilterFn, defaultSortBy, defaultSortOrder, defaultPageSize, persistState, fetchAllItemsEndpoint, ...restProps }: SnowClientTableProps<T, K>) => JSX.Element;
379
+ export declare const SnowClientDataTable: <T extends Record<string, unknown>, K>({ queryKey, columnConfig, actions, filters, prefilters, prefilterFn, defaultSortBy, defaultSortOrder, defaultPageSize, persistState, fetchAllItemsEndpoint, ...restProps }: SnowClientDataTableProps<T, K>) => JSX.Element;
379
380
 
380
381
  /**
381
- * Props for SnowClientTable component (client-side filtering/sorting)
382
+ * Props for SnowClientDataTable component (client-side filtering/sorting)
382
383
  */
383
- export declare interface SnowClientTableProps<T extends Record<string, unknown>, K> extends BaseSnowTableProps<T, K> {
384
+ export declare interface SnowClientDataTableProps<T extends Record<string, unknown>, K> extends BaseSnowTableProps<T, K> {
384
385
  fetchAllItemsEndpoint: () => Promise<T[]>;
385
386
  /** Optional function to filter items based on active prefilter */
386
387
  prefilterFn?: (item: T, prefilterId: string) => boolean;
@@ -396,12 +397,12 @@ export declare type SnowColumnConfig<T extends object> = {
396
397
  meta?: ColumnMeta<T, unknown>;
397
398
  };
398
399
 
399
- export declare const SnowServerTable: <T extends Record<string, unknown>, K>({ queryKey, columnConfig, actions, filters, prefilters, defaultSortBy, defaultSortOrder, defaultPageSize, persistState, fetchServerEndpoint, ...restProps }: SnowServerTableProps<T, K>) => JSX.Element;
400
+ export declare const SnowServerDataTable: <T extends Record<string, unknown>, K>({ queryKey, columnConfig, actions, filters, prefilters, defaultSortBy, defaultSortOrder, defaultPageSize, persistState, fetchServerEndpoint, ...restProps }: SnowServerDataTableProps<T, K>) => JSX.Element;
400
401
 
401
402
  /**
402
- * Props for SnowServerTable component (server-side pagination/filtering/sorting)
403
+ * Props for SnowServerDataTable component (server-side pagination/filtering/sorting)
403
404
  */
404
- export declare interface SnowServerTableProps<T extends Record<string, unknown>, K> extends BaseSnowTableProps<T, K> {
405
+ export declare interface SnowServerDataTableProps<T extends Record<string, unknown>, K> extends BaseSnowTableProps<T, K> {
405
406
  fetchServerEndpoint: (params: ServerFetchParams) => Promise<ServerPaginatedResponse<T>>;
406
407
  filters?: FilterConfig<Record<string, unknown>>[];
407
408
  }
@@ -442,7 +443,7 @@ declare interface UseConfirmReturn {
442
443
  }
443
444
 
444
445
  /**
445
- * Shared hook for building columns and handling actions in SnowClientTable and SnowServerTable.
446
+ * Shared hook for building columns and handling actions in SnowClientDataTable and SnowServerDataTable.
446
447
  *
447
448
  * Extracts the common logic for:
448
449
  * - Transforming SnowColumnConfig into TanStack Table ColumnDef
package/dist/index.js CHANGED
@@ -92,6 +92,7 @@ const na = (e) => {
92
92
  triggerActive: "data-[state=active]:bg-background data-[state=active]:text-foreground"
93
93
  },
94
94
  table: {
95
+ root: "w-full",
95
96
  container: "rounded-lg border",
96
97
  header: "bg-muted",
97
98
  headerCell: "text-muted-foreground",
@@ -5973,10 +5974,10 @@ function Cs({
5973
5974
  const Q = String(Y), ge = { ...U };
5974
5975
  J.length === 0 ? delete ge[Q] : ge[Q] = J, se(ge);
5975
5976
  }, Ps = d || I || c && c.length > 0 || T, go = Re(() => he ? e.length : _e.getRowModel().rows.length, [he, e.length, _e]), Is = Re(() => he && s !== void 0 ? s : _e.getFilteredRowModel().rows.length, [he, s, _e]);
5976
- return /* @__PURE__ */ F("div", { className: "relative flex flex-col flex-1", "data-testid": "datatable", children: [
5977
+ return /* @__PURE__ */ F("div", { className: X("relative flex flex-col flex-1", k.table.root), "data-testid": "datatable", children: [
5977
5978
  o && !n && /* @__PURE__ */ p("div", { className: X("absolute inset-0 z-10 pointer-events-none", k.table.loadingOverlay) }),
5978
5979
  Ps && /* @__PURE__ */ F("div", { className: "flex flex-col sm:flex-row sm:items-center sm:justify-between py-4 gap-4", children: [
5979
- /* @__PURE__ */ p("div", { className: "flex items-center gap-2 overflow-x-auto p-0.5 -m-0.5", children: w && w.length > 0 && v && /* @__PURE__ */ p(
5980
+ /* @__PURE__ */ p("div", { className: "flex items-center gap-2", children: w && w.length > 0 && v && /* @__PURE__ */ p(
5980
5981
  tp,
5981
5982
  {
5982
5983
  prefilters: w,
@@ -6431,8 +6432,8 @@ export {
6431
6432
  tp as PrefilterTabs,
6432
6433
  rp as SearchBar,
6433
6434
  ip as SingleFilterDropdown,
6434
- vp as SnowClientTable,
6435
- wp as SnowServerTable,
6435
+ vp as SnowClientDataTable,
6436
+ wp as SnowServerDataTable,
6436
6437
  sp as SortButton,
6437
6438
  mp as isSnowTableSetup,
6438
6439
  hp as redirectToPageWithParam,