@@ -14,7 +14,19 @@ import {
1414import { createControlledHandler , exportToCSV } from "./utils" ;
1515import { TableAdapterProps , TableExportOptions , TableServer } from "./types" ;
1616
17- // Custom hook for managed table state with controlled/uncontrolled pattern
17+ // For the custom hooks
18+ /**
19+ * Custom hook for managing table state with controlled/uncontrolled pattern
20+ *
21+ * Handles all table state (sorting, pagination, filtering, etc.) and
22+ * properly manages the controlled vs. uncontrolled state.
23+ *
24+ * @template TData - The type of data being displayed in the table
25+ * @template TValue - The type of values in the table cells
26+ *
27+ * @param props - The TableAdapter props
28+ * @returns Object containing current state values and handler functions
29+ */
1830export function useTableState < TData extends object , TValue = unknown > (
1931 props : TableAdapterProps < TData , TValue >
2032) {
@@ -271,7 +283,19 @@ export function useTableState<TData extends object, TValue = unknown>(
271283 } ;
272284}
273285
274- // Custom hook for server-side data fetching
286+ /**
287+ * Custom hook for server-side data fetching
288+ *
289+ * Manages loading states, error handling, and data fetching based on
290+ * table state changes (pagination, sorting, filtering).
291+ *
292+ * @template TData - The type of data being displayed in the table
293+ *
294+ * @param table - The TanStack Table instance
295+ * @param serverOptions - Server-side options for data fetching
296+ * @param onError - Optional error handler
297+ * @returns Object containing loading state, data, and error information
298+ */
275299export function useServerSideData < TData extends object > (
276300 table : Table < TData > ,
277301 serverOptions ?: TableServer ,
@@ -358,7 +382,19 @@ export function useServerSideData<TData extends object>(
358382 } ;
359383}
360384
361- // Custom hook for CSV/Excel export functionality
385+ /**
386+ * Custom hook for CSV/Excel/JSON export functionality
387+ *
388+ * Provides methods to export table data in various formats.
389+ *
390+ * @template TData - The type of data being displayed in the table
391+ * @template TValue - The type of values in the table cells
392+ *
393+ * @param data - The data to export
394+ * @param columns - The table columns
395+ * @param options - Export options (format, filename, etc.)
396+ * @returns Object containing export functions
397+ */
362398export function useTableExport < TData extends object , TValue = unknown > (
363399 data : TData [ ] ,
364400 columns : ColumnDef < TData , TValue > [ ] ,
@@ -433,7 +469,18 @@ export function useTableExport<TData extends object, TValue = unknown>(
433469 } ;
434470}
435471
436- // Custom hook for form integration
472+ /**
473+ * Custom hook for form integration with tables
474+ *
475+ * Enables editing table data with validation and form submission.
476+ *
477+ * @template TData - The type of data being displayed in the table
478+ *
479+ * @param initialData - The initial form data
480+ * @param onSubmit - Form submission handler
481+ * @param validationRules - Validation rules for form fields
482+ * @returns Object containing form state and handlers
483+ */
437484export function useTableForm < TData extends object > (
438485 initialData : TData [ ] ,
439486 onSubmit ?: ( data : TData [ ] ) => void ,
0 commit comments