@docyrus/shadcn 1.2.0 → 1.3.0

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 (52) hide show
  1. package/dist/data-table-DWI8FPWh.d.ts +209 -0
  2. package/dist/hooks/index.d.ts +5 -0
  3. package/dist/hooks/index.js +300 -16
  4. package/dist/hooks/index.js.map +1 -1
  5. package/dist/hooks/use-data-table.d.ts +29 -0
  6. package/dist/hooks/use-data-table.js +322 -0
  7. package/dist/hooks/use-data-table.js.map +1 -0
  8. package/dist/index.d.ts +87 -25
  9. package/dist/index.js +2504 -1151
  10. package/dist/index.js.map +1 -1
  11. package/dist/lib/data-table.d.ts +4 -0
  12. package/dist/lib/data-table.js +100 -0
  13. package/dist/lib/data-table.js.map +1 -0
  14. package/dist/lib/index.d.ts +4 -0
  15. package/dist/lib/index.js +155 -1
  16. package/dist/lib/index.js.map +1 -1
  17. package/dist/lib/parsers.d.ts +4 -0
  18. package/dist/lib/parsers.js +94 -0
  19. package/dist/lib/parsers.js.map +1 -0
  20. package/dist/radix-vega/data-table-column-header.d.ts +13 -0
  21. package/dist/radix-vega/data-table-column-header.js +178 -0
  22. package/dist/radix-vega/data-table-column-header.js.map +1 -0
  23. package/dist/radix-vega/data-table-date-filter.d.ts +11 -0
  24. package/dist/radix-vega/data-table-date-filter.js +470 -0
  25. package/dist/radix-vega/data-table-date-filter.js.map +1 -0
  26. package/dist/radix-vega/data-table-faceted-filter.d.ts +166 -0
  27. package/dist/radix-vega/data-table-faceted-filter.js +468 -0
  28. package/dist/radix-vega/data-table-faceted-filter.js.map +1 -0
  29. package/dist/radix-vega/data-table-pagination.d.ts +10 -0
  30. package/dist/radix-vega/data-table-pagination.js +286 -0
  31. package/dist/radix-vega/data-table-pagination.js.map +1 -0
  32. package/dist/radix-vega/data-table-skeleton.d.ts +14 -0
  33. package/dist/radix-vega/data-table-skeleton.js +151 -0
  34. package/dist/radix-vega/data-table-skeleton.js.map +1 -0
  35. package/dist/radix-vega/data-table-slider-filter.d.ts +10 -0
  36. package/dist/radix-vega/data-table-slider-filter.js +387 -0
  37. package/dist/radix-vega/data-table-slider-filter.js.map +1 -0
  38. package/dist/radix-vega/data-table-toolbar.d.ts +10 -0
  39. package/dist/radix-vega/data-table-toolbar.js +1272 -0
  40. package/dist/radix-vega/data-table-toolbar.js.map +1 -0
  41. package/dist/radix-vega/data-table-view-options.d.ts +13 -0
  42. package/dist/radix-vega/data-table-view-options.js +314 -0
  43. package/dist/radix-vega/data-table-view-options.js.map +1 -0
  44. package/dist/radix-vega/data-table.d.ts +11 -0
  45. package/dist/radix-vega/data-table.js +429 -0
  46. package/dist/radix-vega/data-table.js.map +1 -0
  47. package/dist/radix-vega/index.d.ts +10 -0
  48. package/dist/radix-vega/index.js +2170 -1156
  49. package/dist/radix-vega/index.js.map +1 -1
  50. package/dist/radix-vega/relative-time-card.d.ts +2 -7
  51. package/dist/radix-vega/relative-time-card.js.map +1 -1
  52. package/package.json +18 -12
@@ -0,0 +1,209 @@
1
+ import { RowData, ColumnSort, Column, Row } from '@tanstack/react-table';
2
+ import * as nuqs_server from 'nuqs/server';
3
+ import { z } from 'zod';
4
+
5
+ declare const getSortingStateParser: <TData>(columnIds?: string[] | Set<string>) => nuqs_server.SingleParserBuilder<ExtendedColumnSort<TData>[]>;
6
+ declare const filterItemSchema: z.ZodObject<{
7
+ id: z.ZodString;
8
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
9
+ variant: z.ZodEnum<{
10
+ number: "number";
11
+ boolean: "boolean";
12
+ select: "select";
13
+ text: "text";
14
+ date: "date";
15
+ range: "range";
16
+ dateRange: "dateRange";
17
+ multiSelect: "multiSelect";
18
+ }>;
19
+ operator: z.ZodEnum<{
20
+ iLike: "iLike";
21
+ notILike: "notILike";
22
+ eq: "eq";
23
+ ne: "ne";
24
+ isEmpty: "isEmpty";
25
+ isNotEmpty: "isNotEmpty";
26
+ lt: "lt";
27
+ lte: "lte";
28
+ gt: "gt";
29
+ gte: "gte";
30
+ isBetween: "isBetween";
31
+ isRelativeToToday: "isRelativeToToday";
32
+ inArray: "inArray";
33
+ notInArray: "notInArray";
34
+ }>;
35
+ filterId: z.ZodString;
36
+ }, z.core.$strip>;
37
+ type FilterItemSchema = z.infer<typeof filterItemSchema>;
38
+ declare const getFiltersStateParser: <TData>(columnIds?: string[] | Set<string>) => nuqs_server.SingleParserBuilder<ExtendedColumnFilter<TData>[]>;
39
+
40
+ type DataTableConfig = typeof dataTableConfig;
41
+ declare function getColumnPinningStyle<TData>({ column, }: {
42
+ column: Column<TData>;
43
+ }): React.CSSProperties;
44
+ declare const dataTableConfig: {
45
+ textOperators: ({
46
+ label: string;
47
+ value: "iLike";
48
+ } | {
49
+ label: string;
50
+ value: "notILike";
51
+ } | {
52
+ label: string;
53
+ value: "eq";
54
+ } | {
55
+ label: string;
56
+ value: "ne";
57
+ } | {
58
+ label: string;
59
+ value: "isEmpty";
60
+ } | {
61
+ label: string;
62
+ value: "isNotEmpty";
63
+ })[];
64
+ numericOperators: ({
65
+ label: string;
66
+ value: "eq";
67
+ } | {
68
+ label: string;
69
+ value: "ne";
70
+ } | {
71
+ label: string;
72
+ value: "lt";
73
+ } | {
74
+ label: string;
75
+ value: "lte";
76
+ } | {
77
+ label: string;
78
+ value: "gt";
79
+ } | {
80
+ label: string;
81
+ value: "gte";
82
+ } | {
83
+ label: string;
84
+ value: "isBetween";
85
+ } | {
86
+ label: string;
87
+ value: "isEmpty";
88
+ } | {
89
+ label: string;
90
+ value: "isNotEmpty";
91
+ })[];
92
+ dateOperators: ({
93
+ label: string;
94
+ value: "eq";
95
+ } | {
96
+ label: string;
97
+ value: "ne";
98
+ } | {
99
+ label: string;
100
+ value: "lt";
101
+ } | {
102
+ label: string;
103
+ value: "gt";
104
+ } | {
105
+ label: string;
106
+ value: "lte";
107
+ } | {
108
+ label: string;
109
+ value: "gte";
110
+ } | {
111
+ label: string;
112
+ value: "isBetween";
113
+ } | {
114
+ label: string;
115
+ value: "isRelativeToToday";
116
+ } | {
117
+ label: string;
118
+ value: "isEmpty";
119
+ } | {
120
+ label: string;
121
+ value: "isNotEmpty";
122
+ })[];
123
+ selectOperators: ({
124
+ label: string;
125
+ value: "eq";
126
+ } | {
127
+ label: string;
128
+ value: "ne";
129
+ } | {
130
+ label: string;
131
+ value: "isEmpty";
132
+ } | {
133
+ label: string;
134
+ value: "isNotEmpty";
135
+ })[];
136
+ multiSelectOperators: ({
137
+ label: string;
138
+ value: "inArray";
139
+ } | {
140
+ label: string;
141
+ value: "notInArray";
142
+ } | {
143
+ label: string;
144
+ value: "isEmpty";
145
+ } | {
146
+ label: string;
147
+ value: "isNotEmpty";
148
+ })[];
149
+ booleanOperators: ({
150
+ label: string;
151
+ value: "eq";
152
+ } | {
153
+ label: string;
154
+ value: "ne";
155
+ })[];
156
+ sortOrders: ({
157
+ label: string;
158
+ value: "asc";
159
+ } | {
160
+ label: string;
161
+ value: "desc";
162
+ })[];
163
+ filterVariants: readonly ["text", "number", "range", "date", "dateRange", "boolean", "select", "multiSelect"];
164
+ operators: readonly ["iLike", "notILike", "eq", "ne", "inArray", "notInArray", "isEmpty", "isNotEmpty", "lt", "lte", "gt", "gte", "isBetween", "isRelativeToToday"];
165
+ joinOperators: readonly ["and", "or"];
166
+ };
167
+
168
+ declare module "@tanstack/react-table" {
169
+ interface TableMeta<TData extends RowData> {
170
+ queryKeys?: QueryKeys;
171
+ }
172
+ interface ColumnMeta<TData extends RowData, TValue> {
173
+ label?: string;
174
+ placeholder?: string;
175
+ variant?: FilterVariant;
176
+ options?: Option[];
177
+ range?: [number, number];
178
+ unit?: string;
179
+ icon?: React.FC<React.SVGProps<SVGSVGElement>>;
180
+ }
181
+ }
182
+ interface QueryKeys {
183
+ page: string;
184
+ perPage: string;
185
+ sort: string;
186
+ filters: string;
187
+ joinOperator: string;
188
+ }
189
+ interface Option {
190
+ label: string;
191
+ value: string;
192
+ count?: number;
193
+ icon?: React.FC<React.SVGProps<SVGSVGElement>>;
194
+ }
195
+ type FilterOperator = DataTableConfig["operators"][number];
196
+ type FilterVariant = DataTableConfig["filterVariants"][number];
197
+ type JoinOperator = DataTableConfig["joinOperators"][number];
198
+ interface ExtendedColumnSort<TData> extends Omit<ColumnSort, "id"> {
199
+ id: Extract<keyof TData, string>;
200
+ }
201
+ interface ExtendedColumnFilter<TData> extends FilterItemSchema {
202
+ id: Extract<keyof TData, string>;
203
+ }
204
+ interface DataTableRowAction<TData> {
205
+ row: Row<TData>;
206
+ variant: "update" | "delete";
207
+ }
208
+
209
+ export { type DataTableConfig as D, type ExtendedColumnSort as E, type FilterOperator as F, type JoinOperator as J, type Option as O, type QueryKeys as Q, type FilterVariant as a, type ExtendedColumnFilter as b, type DataTableRowAction as c, dataTableConfig as d, getSortingStateParser as e, type FilterItemSchema as f, getColumnPinningStyle as g, getFiltersStateParser as h };
@@ -1,8 +1,13 @@
1
1
  export { useAsRef } from './use-as-ref.js';
2
2
  export { clearBadgeWidthCache, useBadgeOverflow } from './use-badge-overflow.js';
3
3
  export { useCallbackRef } from './use-callback-ref.js';
4
+ export { useDataTable } from './use-data-table.js';
4
5
  export { useDebouncedCallback } from './use-debounced-callback.js';
5
6
  export { useIsomorphicLayoutEffect } from './use-isomorphic-layout-effect.js';
6
7
  export { useLazyRef } from './use-lazy-ref.js';
7
8
  export { useIsMobile } from './use-mobile.js';
8
9
  import 'react';
10
+ import '@tanstack/react-table';
11
+ import '../data-table-DWI8FPWh.js';
12
+ import 'nuqs/server';
13
+ import 'zod';
@@ -1,11 +1,15 @@
1
- import * as React3 from 'react';
1
+ import * as React6 from 'react';
2
+ import { useReactTable, getFacetedMinMaxValues, getFacetedUniqueValues, getFacetedRowModel, getSortedRowModel, getPaginationRowModel, getFilteredRowModel, getCoreRowModel } from '@tanstack/react-table';
3
+ import { useQueryState, parseAsInteger, parseAsArrayOf, parseAsString, useQueryStates } from 'nuqs';
4
+ import { createParser } from 'nuqs/server';
5
+ import { z } from 'zod';
2
6
 
3
7
  // src/hooks/use-as-ref.ts
4
- var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React3.useLayoutEffect : React3.useEffect;
8
+ var useIsomorphicLayoutEffect = typeof window !== "undefined" ? React6.useLayoutEffect : React6.useEffect;
5
9
 
6
10
  // src/hooks/use-as-ref.ts
7
11
  function useAsRef(props) {
8
- const ref = React3.useRef(props);
12
+ const ref = React6.useRef(props);
9
13
  useIsomorphicLayoutEffect(() => {
10
14
  ref.current = props;
11
15
  });
@@ -64,8 +68,8 @@ function useBadgeOverflow({
64
68
  maxWidth,
65
69
  className
66
70
  }) {
67
- const [containerWidth, setContainerWidth] = React3.useState(0);
68
- React3.useEffect(() => {
71
+ const [containerWidth, setContainerWidth] = React6.useState(0);
72
+ React6.useEffect(() => {
69
73
  if (!containerRef.current) return;
70
74
  function measureWidth() {
71
75
  if (containerRef.current) {
@@ -80,7 +84,7 @@ function useBadgeOverflow({
80
84
  resizeObserver.disconnect();
81
85
  };
82
86
  }, [containerRef, containerPadding]);
83
- const result = React3.useMemo(() => {
87
+ const result = React6.useMemo(() => {
84
88
  if (!containerWidth || items.length === 0) {
85
89
  return { visibleItems: items, hiddenCount: 0, containerWidth };
86
90
  }
@@ -135,23 +139,23 @@ function clearBadgeWidthCache() {
135
139
  badgeWidthCache.clear();
136
140
  }
137
141
  function useCallbackRef(callback) {
138
- const callbackRef = React3.useRef(callback);
139
- React3.useEffect(() => {
142
+ const callbackRef = React6.useRef(callback);
143
+ React6.useEffect(() => {
140
144
  callbackRef.current = callback;
141
145
  });
142
- return React3.useMemo(
146
+ return React6.useMemo(
143
147
  () => ((...args) => callbackRef.current?.(...args)),
144
148
  []
145
149
  );
146
150
  }
147
151
  function useDebouncedCallback(callback, delay) {
148
152
  const handleCallback = useCallbackRef(callback);
149
- const debounceTimerRef = React3.useRef(0);
150
- React3.useEffect(
153
+ const debounceTimerRef = React6.useRef(0);
154
+ React6.useEffect(
151
155
  () => () => window.clearTimeout(debounceTimerRef.current),
152
156
  []
153
157
  );
154
- const setValue = React3.useCallback(
158
+ const setValue = React6.useCallback(
155
159
  (...args) => {
156
160
  window.clearTimeout(debounceTimerRef.current);
157
161
  debounceTimerRef.current = window.setTimeout(
@@ -163,8 +167,288 @@ function useDebouncedCallback(callback, delay) {
163
167
  );
164
168
  return setValue;
165
169
  }
170
+
171
+ // src/lib/data-table.ts
172
+ var dataTableConfig = {
173
+ filterVariants: [
174
+ "text",
175
+ "number",
176
+ "range",
177
+ "date",
178
+ "dateRange",
179
+ "boolean",
180
+ "select",
181
+ "multiSelect"
182
+ ],
183
+ operators: [
184
+ "iLike",
185
+ "notILike",
186
+ "eq",
187
+ "ne",
188
+ "inArray",
189
+ "notInArray",
190
+ "isEmpty",
191
+ "isNotEmpty",
192
+ "lt",
193
+ "lte",
194
+ "gt",
195
+ "gte",
196
+ "isBetween",
197
+ "isRelativeToToday"
198
+ ]};
199
+
200
+ // src/lib/parsers.ts
201
+ var sortingItemSchema = z.object({
202
+ id: z.string(),
203
+ desc: z.boolean()
204
+ });
205
+ var getSortingStateParser = (columnIds) => {
206
+ const validKeys = columnIds ? columnIds instanceof Set ? columnIds : new Set(columnIds) : null;
207
+ return createParser({
208
+ parse: (value) => {
209
+ try {
210
+ const parsed = JSON.parse(value);
211
+ const result = z.array(sortingItemSchema).safeParse(parsed);
212
+ if (!result.success) return null;
213
+ if (validKeys && result.data.some((item) => !validKeys.has(item.id))) {
214
+ return null;
215
+ }
216
+ return result.data;
217
+ } catch {
218
+ return null;
219
+ }
220
+ },
221
+ serialize: (value) => JSON.stringify(value),
222
+ eq: (a, b) => a.length === b.length && a.every(
223
+ (item, index) => item.id === b[index]?.id && item.desc === b[index]?.desc
224
+ )
225
+ });
226
+ };
227
+ z.object({
228
+ id: z.string(),
229
+ value: z.union([z.string(), z.array(z.string())]),
230
+ variant: z.enum(dataTableConfig.filterVariants),
231
+ operator: z.enum(dataTableConfig.operators),
232
+ filterId: z.string()
233
+ });
234
+
235
+ // src/hooks/use-data-table.ts
236
+ var PAGE_KEY = "page";
237
+ var PER_PAGE_KEY = "perPage";
238
+ var SORT_KEY = "sort";
239
+ var FILTERS_KEY = "filters";
240
+ var JOIN_OPERATOR_KEY = "joinOperator";
241
+ var ARRAY_SEPARATOR = ",";
242
+ var DEBOUNCE_MS = 300;
243
+ var THROTTLE_MS = 50;
244
+ function useDataTable(props) {
245
+ const {
246
+ columns,
247
+ pageCount = -1,
248
+ initialState,
249
+ queryKeys,
250
+ history = "replace",
251
+ debounceMs = DEBOUNCE_MS,
252
+ throttleMs = THROTTLE_MS,
253
+ clearOnDefault = false,
254
+ enableAdvancedFilter = false,
255
+ scroll = false,
256
+ shallow = true,
257
+ startTransition,
258
+ ...tableProps
259
+ } = props;
260
+ const pageKey = queryKeys?.page ?? PAGE_KEY;
261
+ const perPageKey = queryKeys?.perPage ?? PER_PAGE_KEY;
262
+ const sortKey = queryKeys?.sort ?? SORT_KEY;
263
+ const filtersKey = queryKeys?.filters ?? FILTERS_KEY;
264
+ const joinOperatorKey = queryKeys?.joinOperator ?? JOIN_OPERATOR_KEY;
265
+ const queryStateOptions = React6.useMemo(
266
+ () => ({
267
+ history,
268
+ scroll,
269
+ shallow,
270
+ throttleMs,
271
+ debounceMs,
272
+ clearOnDefault,
273
+ startTransition
274
+ }),
275
+ [
276
+ history,
277
+ scroll,
278
+ shallow,
279
+ throttleMs,
280
+ debounceMs,
281
+ clearOnDefault,
282
+ startTransition
283
+ ]
284
+ );
285
+ const [rowSelection, setRowSelection] = React6.useState(
286
+ initialState?.rowSelection ?? {}
287
+ );
288
+ const [columnVisibility, setColumnVisibility] = React6.useState(initialState?.columnVisibility ?? {});
289
+ const [page, setPage] = useQueryState(
290
+ pageKey,
291
+ parseAsInteger.withOptions(queryStateOptions).withDefault(1)
292
+ );
293
+ const [perPage, setPerPage] = useQueryState(
294
+ perPageKey,
295
+ parseAsInteger.withOptions(queryStateOptions).withDefault(initialState?.pagination?.pageSize ?? 10)
296
+ );
297
+ const pagination = React6.useMemo(() => {
298
+ return {
299
+ pageIndex: page - 1,
300
+ // zero-based index -> one-based index
301
+ pageSize: perPage
302
+ };
303
+ }, [page, perPage]);
304
+ const onPaginationChange = React6.useCallback(
305
+ (updaterOrValue) => {
306
+ if (typeof updaterOrValue === "function") {
307
+ const newPagination = updaterOrValue(pagination);
308
+ void setPage(newPagination.pageIndex + 1);
309
+ void setPerPage(newPagination.pageSize);
310
+ } else {
311
+ void setPage(updaterOrValue.pageIndex + 1);
312
+ void setPerPage(updaterOrValue.pageSize);
313
+ }
314
+ },
315
+ [pagination, setPage, setPerPage]
316
+ );
317
+ const columnIds = React6.useMemo(() => {
318
+ return new Set(
319
+ columns.map((column) => column.id).filter(Boolean)
320
+ );
321
+ }, [columns]);
322
+ const [sorting, setSorting] = useQueryState(
323
+ sortKey,
324
+ getSortingStateParser(columnIds).withOptions(queryStateOptions).withDefault(initialState?.sorting ?? [])
325
+ );
326
+ const onSortingChange = React6.useCallback(
327
+ (updaterOrValue) => {
328
+ if (typeof updaterOrValue === "function") {
329
+ const newSorting = updaterOrValue(sorting);
330
+ setSorting(newSorting);
331
+ } else {
332
+ setSorting(updaterOrValue);
333
+ }
334
+ },
335
+ [sorting, setSorting]
336
+ );
337
+ const filterableColumns = React6.useMemo(() => {
338
+ if (enableAdvancedFilter) return [];
339
+ return columns.filter((column) => column.enableColumnFilter);
340
+ }, [columns, enableAdvancedFilter]);
341
+ const filterParsers = React6.useMemo(() => {
342
+ if (enableAdvancedFilter) return {};
343
+ return filterableColumns.reduce((acc, column) => {
344
+ if (column.meta?.options) {
345
+ acc[column.id ?? ""] = parseAsArrayOf(
346
+ parseAsString,
347
+ ARRAY_SEPARATOR
348
+ ).withOptions(queryStateOptions);
349
+ } else {
350
+ acc[column.id ?? ""] = parseAsString.withOptions(queryStateOptions);
351
+ }
352
+ return acc;
353
+ }, {});
354
+ }, [filterableColumns, queryStateOptions, enableAdvancedFilter]);
355
+ const [filterValues, setFilterValues] = useQueryStates(filterParsers);
356
+ const debouncedSetFilterValues = useDebouncedCallback(
357
+ (values) => {
358
+ void setPage(1);
359
+ void setFilterValues(values);
360
+ },
361
+ debounceMs
362
+ );
363
+ const initialColumnFilters = React6.useMemo(() => {
364
+ if (enableAdvancedFilter) return [];
365
+ return Object.entries(filterValues).reduce(
366
+ (filters, [key, value]) => {
367
+ if (value !== null) {
368
+ const processedValue = Array.isArray(value) ? value : typeof value === "string" && /[^a-zA-Z0-9]/.test(value) ? value.split(/[^a-zA-Z0-9]+/).filter(Boolean) : [value];
369
+ filters.push({
370
+ id: key,
371
+ value: processedValue
372
+ });
373
+ }
374
+ return filters;
375
+ },
376
+ []
377
+ );
378
+ }, [filterValues, enableAdvancedFilter]);
379
+ const [columnFilters, setColumnFilters] = React6.useState(initialColumnFilters);
380
+ const onColumnFiltersChange = React6.useCallback(
381
+ (updaterOrValue) => {
382
+ if (enableAdvancedFilter) return;
383
+ setColumnFilters((prev) => {
384
+ const next = typeof updaterOrValue === "function" ? updaterOrValue(prev) : updaterOrValue;
385
+ const filterUpdates = next.reduce((acc, filter) => {
386
+ if (filterableColumns.find((column) => column.id === filter.id)) {
387
+ acc[filter.id] = filter.value;
388
+ }
389
+ return acc;
390
+ }, {});
391
+ for (const prevFilter of prev) {
392
+ if (!next.some((filter) => filter.id === prevFilter.id)) {
393
+ filterUpdates[prevFilter.id] = null;
394
+ }
395
+ }
396
+ debouncedSetFilterValues(filterUpdates);
397
+ return next;
398
+ });
399
+ },
400
+ [debouncedSetFilterValues, filterableColumns, enableAdvancedFilter]
401
+ );
402
+ const table = useReactTable({
403
+ ...tableProps,
404
+ columns,
405
+ initialState,
406
+ pageCount,
407
+ state: {
408
+ pagination,
409
+ sorting,
410
+ columnVisibility,
411
+ rowSelection,
412
+ columnFilters
413
+ },
414
+ defaultColumn: {
415
+ ...tableProps.defaultColumn,
416
+ enableColumnFilter: false
417
+ },
418
+ enableRowSelection: true,
419
+ onRowSelectionChange: setRowSelection,
420
+ onPaginationChange,
421
+ onSortingChange,
422
+ onColumnFiltersChange,
423
+ onColumnVisibilityChange: setColumnVisibility,
424
+ getCoreRowModel: getCoreRowModel(),
425
+ getFilteredRowModel: getFilteredRowModel(),
426
+ getPaginationRowModel: getPaginationRowModel(),
427
+ getSortedRowModel: getSortedRowModel(),
428
+ getFacetedRowModel: getFacetedRowModel(),
429
+ getFacetedUniqueValues: getFacetedUniqueValues(),
430
+ getFacetedMinMaxValues: getFacetedMinMaxValues(),
431
+ manualPagination: true,
432
+ manualSorting: true,
433
+ manualFiltering: true,
434
+ meta: {
435
+ ...tableProps.meta,
436
+ queryKeys: {
437
+ page: pageKey,
438
+ perPage: perPageKey,
439
+ sort: sortKey,
440
+ filters: filtersKey,
441
+ joinOperator: joinOperatorKey
442
+ }
443
+ }
444
+ });
445
+ return React6.useMemo(
446
+ () => ({ table, shallow, debounceMs, throttleMs }),
447
+ [table, shallow, debounceMs, throttleMs]
448
+ );
449
+ }
166
450
  function useLazyRef(fn) {
167
- const ref = React3.useRef(null);
451
+ const ref = React6.useRef(null);
168
452
  if (ref.current === null) {
169
453
  ref.current = fn();
170
454
  }
@@ -172,10 +456,10 @@ function useLazyRef(fn) {
172
456
  }
173
457
  var MOBILE_BREAKPOINT = 768;
174
458
  function useIsMobile(breakpoint = MOBILE_BREAKPOINT) {
175
- const [isMobile, setIsMobile] = React3.useState(
459
+ const [isMobile, setIsMobile] = React6.useState(
176
460
  void 0
177
461
  );
178
- React3.useEffect(() => {
462
+ React6.useEffect(() => {
179
463
  const mql = window.matchMedia(`(max-width: ${breakpoint - 1}px)`);
180
464
  const onChange = () => {
181
465
  setIsMobile(window.innerWidth < breakpoint);
@@ -187,6 +471,6 @@ function useIsMobile(breakpoint = MOBILE_BREAKPOINT) {
187
471
  return !!isMobile;
188
472
  }
189
473
 
190
- export { clearBadgeWidthCache, useAsRef, useBadgeOverflow, useCallbackRef, useDebouncedCallback, useIsMobile, useIsomorphicLayoutEffect, useLazyRef };
474
+ export { clearBadgeWidthCache, useAsRef, useBadgeOverflow, useCallbackRef, useDataTable, useDebouncedCallback, useIsMobile, useIsomorphicLayoutEffect, useLazyRef };
191
475
  //# sourceMappingURL=index.js.map
192
476
  //# sourceMappingURL=index.js.map