@prediktif/ui 0.1.18 → 0.1.19

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.mts CHANGED
@@ -1,5 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentProps } from 'react';
3
+ import * as _tanstack_react_table from '@tanstack/react-table';
4
+ import { RowData, Table, ColumnDef, ColumnFiltersState, Row, SortingState, ColumnVisibilityState } from '@tanstack/react-table';
5
+ export { ColumnDef, ColumnFiltersState, ColumnVisibilityState, FilterFn, Row, RowData, SortingState, Table, flexRender, useTable } from '@tanstack/react-table';
3
6
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
7
  import { Button as Button$1 } from '@base-ui/react/button';
5
8
  import { VariantProps } from 'class-variance-authority';
@@ -38,6 +41,273 @@ interface AppSidebarProps {
38
41
  }
39
42
  declare const AppSidebar: react.NamedExoticComponent<AppSidebarProps>;
40
43
 
44
+ declare const buttonVariants: (props?: ({
45
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
46
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
47
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
48
+ declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
49
+
50
+ /**
51
+ * Configure TanStack Table features used by DataTable.
52
+ * Enables column/global filtering, visibility toggling, pagination, row selection, and sorting.
53
+ */
54
+ declare const features: {
55
+ columnFilteringFeature: _tanstack_react_table.TableFeature;
56
+ globalFilteringFeature: _tanstack_react_table.TableFeature;
57
+ columnVisibilityFeature: _tanstack_react_table.TableFeature;
58
+ rowSelectionFeature: _tanstack_react_table.TableFeature;
59
+ rowPaginationFeature: _tanstack_react_table.TableFeature;
60
+ rowSortingFeature: _tanstack_react_table.TableFeature;
61
+ filteredRowModel: (table: _tanstack_react_table.Table<any, any>) => () => _tanstack_react_table.RowModel<any, any>;
62
+ paginatedRowModel: (table: _tanstack_react_table.Table<any, any>) => () => _tanstack_react_table.RowModel<any, any>;
63
+ sortedRowModel: (table: _tanstack_react_table.Table<any, any>) => () => _tanstack_react_table.RowModel<any, any>;
64
+ filterFns: {
65
+ includesString: _tanstack_react_table.CreatedFilterFn<any, any>;
66
+ };
67
+ sortFns: {
68
+ alphanumeric: _tanstack_react_table.CreatedSortFn<any, any>;
69
+ text: _tanstack_react_table.CreatedSortFn<any, any>;
70
+ };
71
+ };
72
+ type DataTableFeatures = typeof features;
73
+
74
+ /**
75
+ * Item definition for row actions dropdown menu.
76
+ */
77
+ interface RowActionItem {
78
+ /** Label text displayed in the menu item */
79
+ label: string;
80
+ /** Icon element displayed to the left of the label */
81
+ icon?: ReactNode;
82
+ /** Callback triggered on item click */
83
+ onClick?: () => void;
84
+ /** Variant for styling ('default' | 'destructive') */
85
+ variant?: "default" | "destructive";
86
+ /** Optional custom CSS classes */
87
+ className?: string;
88
+ /** Optional unique ID for key prop */
89
+ id?: string;
90
+ /** Disable the item if true */
91
+ disabled?: boolean;
92
+ /** Hide the item conditionally if true */
93
+ hidden?: boolean;
94
+ /** Render a separator line before this item */
95
+ separatorBefore?: boolean;
96
+ /** Render a separator line after this item */
97
+ separatorAfter?: boolean;
98
+ }
99
+ /**
100
+ * Props for the `RowActions` component.
101
+ */
102
+ interface RowActionsProps {
103
+ /** Header label text shown inside the dropdown menu (default: "Actions") */
104
+ label?: string;
105
+ /** List of menu items to render */
106
+ items?: RowActionItem[];
107
+ /** Custom trigger icon element (defaults to <MoreHorizontal />) */
108
+ triggerIcon?: ReactNode;
109
+ /** Accessibility aria-label for the trigger button */
110
+ triggerLabel?: string;
111
+ /** Alignment of the dropdown menu content relative to trigger button */
112
+ align?: "start" | "center" | "end";
113
+ /** Custom class name for the wrapper div container */
114
+ containerClassName?: string;
115
+ /** Custom class name for the dropdown menu content */
116
+ contentClassName?: string;
117
+ }
118
+ /**
119
+ * Universal Action Menu component for table rows.
120
+ * Renders a compact trigger button that opens a customizable dropdown menu.
121
+ */
122
+ declare function RowActions({ label, items, triggerIcon, triggerLabel, align, containerClassName, contentClassName, }: RowActionsProps): react.JSX.Element | null;
123
+
124
+ type ExportRow = Record<string, unknown>;
125
+ /**
126
+ * Export data as an XLSX file using SheetJS.
127
+ */
128
+ declare function exportToXLSX(rows: ExportRow[], filename?: string): void;
129
+ /**
130
+ * Export data as a CSV file using SheetJS with UTF-8 BOM.
131
+ */
132
+ declare function exportToCSV(rows: ExportRow[], filename?: string): void;
133
+ /**
134
+ * Print or export as PDF by opening a styled print window.
135
+ */
136
+ declare function printTable(headers: string[], rows: string[][], title?: string): void;
137
+
138
+ interface DataTableContentBodyProps<TData extends RowData> {
139
+ table: Table<DataTableFeatures, TData>;
140
+ columns: ColumnDef<DataTableFeatures, TData>[];
141
+ isLoading?: boolean;
142
+ }
143
+ declare function DataTableContentBody<TData extends RowData>({ table, columns, isLoading, }: DataTableContentBodyProps<TData>): react.JSX.Element;
144
+
145
+ interface DataTableContentHeaderProps<TData extends RowData> {
146
+ table: Table<DataTableFeatures, TData>;
147
+ }
148
+ declare function DataTableContentHeader<TData extends RowData>({ table, }: DataTableContentHeaderProps<TData>): react.JSX.Element;
149
+
150
+ interface DataTableFooterEntriesProps<TData extends RowData> {
151
+ table: Table<DataTableFeatures, TData>;
152
+ }
153
+ declare function DataTableFooterEntries<TData extends RowData>({ table, }: DataTableFooterEntriesProps<TData>): react.JSX.Element;
154
+
155
+ interface DataTableFooterPaginationProps<TData extends RowData> {
156
+ table: Table<DataTableFeatures, TData>;
157
+ }
158
+ declare function DataTableFooterPagination<TData extends RowData>({ table, }: DataTableFooterPaginationProps<TData>): react.JSX.Element;
159
+
160
+ interface DataTableHeaderAddProps {
161
+ onAdd: () => void;
162
+ addLabel?: string;
163
+ }
164
+ declare function DataTableHeaderAdd({ onAdd, addLabel, }: DataTableHeaderAddProps): react.JSX.Element;
165
+
166
+ declare function getTableExportData<TData extends RowData>(table: Table<DataTableFeatures, TData>): {
167
+ headers: string[];
168
+ rows: string[][];
169
+ rowObjects: Record<string, string>[];
170
+ };
171
+ interface DataTableHeaderDownloadProps<TData extends RowData> {
172
+ table: Table<DataTableFeatures, TData>;
173
+ exportFilename: string;
174
+ onDownload?: () => void;
175
+ }
176
+ declare function DataTableHeaderDownload<TData extends RowData>({ table, exportFilename, onDownload, }: DataTableHeaderDownloadProps<TData>): react.JSX.Element;
177
+
178
+ /**
179
+ * Supported filter variants for custom column filtering.
180
+ * - `text`: Standard substring text matching (default)
181
+ * - `boolean`: Dropdown select with True / False options
182
+ * - `date`: Calendar popover date picker (matches yyyy-MM-dd / ISO dates)
183
+ * - `select`: Dropdown select menu for categorical options (auto-detected if unique values <= 20)
184
+ */
185
+ type FilterVariant = "text" | "boolean" | "date" | "select";
186
+ /**
187
+ * Option item structure for select dropdown filters.
188
+ */
189
+ interface FilterSelectOption {
190
+ label: string;
191
+ value: string;
192
+ }
193
+ /**
194
+ * Custom metadata interface attached to TanStack Table column definitions (`columnDef.meta`).
195
+ * Allows explicit configuration of column filter behavior.
196
+ *
197
+ * @example
198
+ * ```ts
199
+ * {
200
+ * accessorKey: "role",
201
+ * header: "Role",
202
+ * meta: {
203
+ * filterVariant: "select",
204
+ * selectOptions: [
205
+ * { label: "Admin", value: "admin" },
206
+ * { label: "User", value: "user" },
207
+ * ],
208
+ * } satisfies ColumnMetaCustom,
209
+ * }
210
+ * ```
211
+ */
212
+ interface ColumnMetaCustom {
213
+ filterVariant?: FilterVariant;
214
+ selectOptions?: FilterSelectOption[];
215
+ }
216
+ interface DataTableHeaderFilterProps<TData extends RowData> {
217
+ table: Table<DataTableFeatures, TData>;
218
+ columnFilters: ColumnFiltersState;
219
+ }
220
+ /**
221
+ * Universal smart filter function for TanStack Table.
222
+ * Seamlessly handles boolean, date (yyyy-MM-dd / ISO / Date objects), select options, arrays, objects, and text.
223
+ */
224
+ declare function smartFilterFn<TData extends RowData>(row: Row<DataTableFeatures, TData>, columnId: string, filterValue: unknown): boolean;
225
+ declare function DataTableHeaderFilter<TData extends RowData>({ table, columnFilters, }: DataTableHeaderFilterProps<TData>): react.JSX.Element | null;
226
+
227
+ interface DataTableHeaderRefreshProps {
228
+ onRefresh?: () => void;
229
+ }
230
+ declare function DataTableHeaderRefresh({ onRefresh, }: DataTableHeaderRefreshProps): react.JSX.Element;
231
+
232
+ interface DataTableHeaderSearchProps {
233
+ value: string;
234
+ onChange: (value: string) => void;
235
+ placeholder?: string;
236
+ }
237
+ declare function DataTableHeaderSearch({ value, onChange, placeholder, }: DataTableHeaderSearchProps): react.JSX.Element;
238
+
239
+ interface DataTableHeaderSortProps<TData extends RowData> {
240
+ table: Table<DataTableFeatures, TData>;
241
+ sorting: SortingState;
242
+ }
243
+ declare function DataTableHeaderSort<TData extends RowData>({ table, sorting, }: DataTableHeaderSortProps<TData>): react.JSX.Element;
244
+
245
+ interface DataTableHeaderToggleProps<TData extends RowData> {
246
+ table: Table<DataTableFeatures, TData>;
247
+ }
248
+ declare function DataTableHeaderToggle<TData extends RowData>({ table, }: DataTableHeaderToggleProps<TData>): react.JSX.Element;
249
+
250
+ interface DataTableProps<TData extends RowData> {
251
+ /** Column definitions for the table */
252
+ columns: ColumnDef<DataTableFeatures, TData>[];
253
+ /** Array of data rows to display */
254
+ data: TData[];
255
+ /** Initial column visibility state */
256
+ initialColumnVisibility?: ColumnVisibilityState;
257
+ /** Render function for custom create/add modal dialog */
258
+ renderCreateDialog?: (open: boolean, onOpenChange: (open: boolean) => void) => ReactNode;
259
+ /** Label text for the add button (defaults to "Add") */
260
+ addLabel?: string;
261
+ /** Callback triggered when user clicks the refresh button */
262
+ onRefresh?: () => void;
263
+ /** Callback triggered when user downloads data */
264
+ onDownload?: () => void;
265
+ /** Base filename used when exporting data (defaults to "data-export") */
266
+ exportFilename?: string;
267
+ /** Loading state indicator */
268
+ isLoading?: boolean;
269
+ /** Placeholder text for search bar (defaults to "Search...") */
270
+ searchPlaceholder?: string;
271
+ /** Toggle visibility of search input (default: true) */
272
+ showSearchInput?: boolean;
273
+ /** Toggle visibility of refresh button (default: true) */
274
+ showRefreshButton?: boolean;
275
+ /** Toggle visibility of sort button (default: true) */
276
+ showSortButton?: boolean;
277
+ /** Toggle visibility of filter button (default: true) */
278
+ showFilterButton?: boolean;
279
+ /** Toggle visibility of download/export button (default: true) */
280
+ showDownloadButton?: boolean;
281
+ /** Toggle visibility of column toggle button (default: true) */
282
+ showColumnToggleButton?: boolean;
283
+ /** Toggle visibility of add/create button (default: true) */
284
+ showAddButton?: boolean;
285
+ /** Custom icon for empty state */
286
+ emptyIcon?: React.ComponentType<{
287
+ className?: string;
288
+ }> | ReactNode;
289
+ /** Custom title for empty state */
290
+ emptyTitle?: ReactNode;
291
+ /** Custom description for empty state */
292
+ emptyDescription?: ReactNode;
293
+ /** Custom button text for empty state action */
294
+ emptyButtonText?: string;
295
+ /** Custom render prop for empty state action button */
296
+ emptyRender?: ComponentProps<typeof Button>["render"];
297
+ /** Callback for empty state action button click */
298
+ onEmptyAction?: () => void;
299
+ /** Custom render function to completely override the empty state */
300
+ renderEmptyState?: () => ReactNode;
301
+ }
302
+ /**
303
+ * Universal Data Table component built with TanStack Table and Shadcn UI.
304
+ * Provides out-of-the-box features: global search, smart multi-type column filtering,
305
+ * column sorting, column visibility toggle, data export (PDF, Excel, CSV, Print),
306
+ * data refresh, pagination, row actions, add/create modal dialog binding,
307
+ * loading skeletons, and integrated empty states via StateEmpty.
308
+ */
309
+ declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onRefresh, onDownload, exportFilename, isLoading, searchPlaceholder, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, emptyIcon, emptyTitle, emptyDescription, emptyButtonText, emptyRender, onEmptyAction, renderEmptyState, }: DataTableProps<TData>): react.JSX.Element;
310
+
41
311
  interface HeaderTabItem {
42
312
  title: string;
43
313
  url: string;
@@ -61,21 +331,16 @@ interface HeaderTitleProps {
61
331
  }
62
332
  declare const HeaderTitle: react.NamedExoticComponent<HeaderTitleProps>;
63
333
 
64
- declare const buttonVariants: (props?: ({
65
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
66
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
67
- } & class_variance_authority_types.ClassProp) | undefined) => string;
68
- declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
69
-
70
334
  interface StateEmptyProps {
71
335
  icon: React.ComponentType<{
72
336
  className?: string;
73
337
  }> | ReactNode;
74
338
  title: ReactNode;
75
339
  description: ReactNode;
76
- buttonText: string;
340
+ buttonText?: string;
341
+ onClick?: () => void;
77
342
  render?: ComponentProps<typeof Button>["render"];
78
343
  }
79
344
  declare const StateEmpty: react.NamedExoticComponent<StateEmptyProps>;
80
345
 
81
- export { AppSidebar, type AppSidebarProps, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, StateEmpty, type StateEmptyProps };
346
+ export { AppSidebar, type AppSidebarProps, type ColumnMetaCustom, DataTable, DataTableContentBody, type DataTableContentBodyProps, DataTableContentHeader, type DataTableContentHeaderProps, type DataTableFeatures, DataTableFooterEntries, type DataTableFooterEntriesProps, DataTableFooterPagination, type DataTableFooterPaginationProps, DataTableHeaderAdd, type DataTableHeaderAddProps, DataTableHeaderDownload, type DataTableHeaderDownloadProps, DataTableHeaderFilter, type DataTableHeaderFilterProps, DataTableHeaderRefresh, type DataTableHeaderRefreshProps, DataTableHeaderSearch, type DataTableHeaderSearchProps, DataTableHeaderSort, type DataTableHeaderSortProps, DataTableHeaderToggle, type DataTableHeaderToggleProps, type DataTableProps, type FilterSelectOption, type FilterVariant, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, type RowActionItem, RowActions, type RowActionsProps, StateEmpty, type StateEmptyProps, exportToCSV, exportToXLSX, features, getTableExportData, printTable, smartFilterFn };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ComponentProps } from 'react';
3
+ import * as _tanstack_react_table from '@tanstack/react-table';
4
+ import { RowData, Table, ColumnDef, ColumnFiltersState, Row, SortingState, ColumnVisibilityState } from '@tanstack/react-table';
5
+ export { ColumnDef, ColumnFiltersState, ColumnVisibilityState, FilterFn, Row, RowData, SortingState, Table, flexRender, useTable } from '@tanstack/react-table';
3
6
  import * as class_variance_authority_types from 'class-variance-authority/types';
4
7
  import { Button as Button$1 } from '@base-ui/react/button';
5
8
  import { VariantProps } from 'class-variance-authority';
@@ -38,6 +41,273 @@ interface AppSidebarProps {
38
41
  }
39
42
  declare const AppSidebar: react.NamedExoticComponent<AppSidebarProps>;
40
43
 
44
+ declare const buttonVariants: (props?: ({
45
+ variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
46
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
47
+ } & class_variance_authority_types.ClassProp) | undefined) => string;
48
+ declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
49
+
50
+ /**
51
+ * Configure TanStack Table features used by DataTable.
52
+ * Enables column/global filtering, visibility toggling, pagination, row selection, and sorting.
53
+ */
54
+ declare const features: {
55
+ columnFilteringFeature: _tanstack_react_table.TableFeature;
56
+ globalFilteringFeature: _tanstack_react_table.TableFeature;
57
+ columnVisibilityFeature: _tanstack_react_table.TableFeature;
58
+ rowSelectionFeature: _tanstack_react_table.TableFeature;
59
+ rowPaginationFeature: _tanstack_react_table.TableFeature;
60
+ rowSortingFeature: _tanstack_react_table.TableFeature;
61
+ filteredRowModel: (table: _tanstack_react_table.Table<any, any>) => () => _tanstack_react_table.RowModel<any, any>;
62
+ paginatedRowModel: (table: _tanstack_react_table.Table<any, any>) => () => _tanstack_react_table.RowModel<any, any>;
63
+ sortedRowModel: (table: _tanstack_react_table.Table<any, any>) => () => _tanstack_react_table.RowModel<any, any>;
64
+ filterFns: {
65
+ includesString: _tanstack_react_table.CreatedFilterFn<any, any>;
66
+ };
67
+ sortFns: {
68
+ alphanumeric: _tanstack_react_table.CreatedSortFn<any, any>;
69
+ text: _tanstack_react_table.CreatedSortFn<any, any>;
70
+ };
71
+ };
72
+ type DataTableFeatures = typeof features;
73
+
74
+ /**
75
+ * Item definition for row actions dropdown menu.
76
+ */
77
+ interface RowActionItem {
78
+ /** Label text displayed in the menu item */
79
+ label: string;
80
+ /** Icon element displayed to the left of the label */
81
+ icon?: ReactNode;
82
+ /** Callback triggered on item click */
83
+ onClick?: () => void;
84
+ /** Variant for styling ('default' | 'destructive') */
85
+ variant?: "default" | "destructive";
86
+ /** Optional custom CSS classes */
87
+ className?: string;
88
+ /** Optional unique ID for key prop */
89
+ id?: string;
90
+ /** Disable the item if true */
91
+ disabled?: boolean;
92
+ /** Hide the item conditionally if true */
93
+ hidden?: boolean;
94
+ /** Render a separator line before this item */
95
+ separatorBefore?: boolean;
96
+ /** Render a separator line after this item */
97
+ separatorAfter?: boolean;
98
+ }
99
+ /**
100
+ * Props for the `RowActions` component.
101
+ */
102
+ interface RowActionsProps {
103
+ /** Header label text shown inside the dropdown menu (default: "Actions") */
104
+ label?: string;
105
+ /** List of menu items to render */
106
+ items?: RowActionItem[];
107
+ /** Custom trigger icon element (defaults to <MoreHorizontal />) */
108
+ triggerIcon?: ReactNode;
109
+ /** Accessibility aria-label for the trigger button */
110
+ triggerLabel?: string;
111
+ /** Alignment of the dropdown menu content relative to trigger button */
112
+ align?: "start" | "center" | "end";
113
+ /** Custom class name for the wrapper div container */
114
+ containerClassName?: string;
115
+ /** Custom class name for the dropdown menu content */
116
+ contentClassName?: string;
117
+ }
118
+ /**
119
+ * Universal Action Menu component for table rows.
120
+ * Renders a compact trigger button that opens a customizable dropdown menu.
121
+ */
122
+ declare function RowActions({ label, items, triggerIcon, triggerLabel, align, containerClassName, contentClassName, }: RowActionsProps): react.JSX.Element | null;
123
+
124
+ type ExportRow = Record<string, unknown>;
125
+ /**
126
+ * Export data as an XLSX file using SheetJS.
127
+ */
128
+ declare function exportToXLSX(rows: ExportRow[], filename?: string): void;
129
+ /**
130
+ * Export data as a CSV file using SheetJS with UTF-8 BOM.
131
+ */
132
+ declare function exportToCSV(rows: ExportRow[], filename?: string): void;
133
+ /**
134
+ * Print or export as PDF by opening a styled print window.
135
+ */
136
+ declare function printTable(headers: string[], rows: string[][], title?: string): void;
137
+
138
+ interface DataTableContentBodyProps<TData extends RowData> {
139
+ table: Table<DataTableFeatures, TData>;
140
+ columns: ColumnDef<DataTableFeatures, TData>[];
141
+ isLoading?: boolean;
142
+ }
143
+ declare function DataTableContentBody<TData extends RowData>({ table, columns, isLoading, }: DataTableContentBodyProps<TData>): react.JSX.Element;
144
+
145
+ interface DataTableContentHeaderProps<TData extends RowData> {
146
+ table: Table<DataTableFeatures, TData>;
147
+ }
148
+ declare function DataTableContentHeader<TData extends RowData>({ table, }: DataTableContentHeaderProps<TData>): react.JSX.Element;
149
+
150
+ interface DataTableFooterEntriesProps<TData extends RowData> {
151
+ table: Table<DataTableFeatures, TData>;
152
+ }
153
+ declare function DataTableFooterEntries<TData extends RowData>({ table, }: DataTableFooterEntriesProps<TData>): react.JSX.Element;
154
+
155
+ interface DataTableFooterPaginationProps<TData extends RowData> {
156
+ table: Table<DataTableFeatures, TData>;
157
+ }
158
+ declare function DataTableFooterPagination<TData extends RowData>({ table, }: DataTableFooterPaginationProps<TData>): react.JSX.Element;
159
+
160
+ interface DataTableHeaderAddProps {
161
+ onAdd: () => void;
162
+ addLabel?: string;
163
+ }
164
+ declare function DataTableHeaderAdd({ onAdd, addLabel, }: DataTableHeaderAddProps): react.JSX.Element;
165
+
166
+ declare function getTableExportData<TData extends RowData>(table: Table<DataTableFeatures, TData>): {
167
+ headers: string[];
168
+ rows: string[][];
169
+ rowObjects: Record<string, string>[];
170
+ };
171
+ interface DataTableHeaderDownloadProps<TData extends RowData> {
172
+ table: Table<DataTableFeatures, TData>;
173
+ exportFilename: string;
174
+ onDownload?: () => void;
175
+ }
176
+ declare function DataTableHeaderDownload<TData extends RowData>({ table, exportFilename, onDownload, }: DataTableHeaderDownloadProps<TData>): react.JSX.Element;
177
+
178
+ /**
179
+ * Supported filter variants for custom column filtering.
180
+ * - `text`: Standard substring text matching (default)
181
+ * - `boolean`: Dropdown select with True / False options
182
+ * - `date`: Calendar popover date picker (matches yyyy-MM-dd / ISO dates)
183
+ * - `select`: Dropdown select menu for categorical options (auto-detected if unique values <= 20)
184
+ */
185
+ type FilterVariant = "text" | "boolean" | "date" | "select";
186
+ /**
187
+ * Option item structure for select dropdown filters.
188
+ */
189
+ interface FilterSelectOption {
190
+ label: string;
191
+ value: string;
192
+ }
193
+ /**
194
+ * Custom metadata interface attached to TanStack Table column definitions (`columnDef.meta`).
195
+ * Allows explicit configuration of column filter behavior.
196
+ *
197
+ * @example
198
+ * ```ts
199
+ * {
200
+ * accessorKey: "role",
201
+ * header: "Role",
202
+ * meta: {
203
+ * filterVariant: "select",
204
+ * selectOptions: [
205
+ * { label: "Admin", value: "admin" },
206
+ * { label: "User", value: "user" },
207
+ * ],
208
+ * } satisfies ColumnMetaCustom,
209
+ * }
210
+ * ```
211
+ */
212
+ interface ColumnMetaCustom {
213
+ filterVariant?: FilterVariant;
214
+ selectOptions?: FilterSelectOption[];
215
+ }
216
+ interface DataTableHeaderFilterProps<TData extends RowData> {
217
+ table: Table<DataTableFeatures, TData>;
218
+ columnFilters: ColumnFiltersState;
219
+ }
220
+ /**
221
+ * Universal smart filter function for TanStack Table.
222
+ * Seamlessly handles boolean, date (yyyy-MM-dd / ISO / Date objects), select options, arrays, objects, and text.
223
+ */
224
+ declare function smartFilterFn<TData extends RowData>(row: Row<DataTableFeatures, TData>, columnId: string, filterValue: unknown): boolean;
225
+ declare function DataTableHeaderFilter<TData extends RowData>({ table, columnFilters, }: DataTableHeaderFilterProps<TData>): react.JSX.Element | null;
226
+
227
+ interface DataTableHeaderRefreshProps {
228
+ onRefresh?: () => void;
229
+ }
230
+ declare function DataTableHeaderRefresh({ onRefresh, }: DataTableHeaderRefreshProps): react.JSX.Element;
231
+
232
+ interface DataTableHeaderSearchProps {
233
+ value: string;
234
+ onChange: (value: string) => void;
235
+ placeholder?: string;
236
+ }
237
+ declare function DataTableHeaderSearch({ value, onChange, placeholder, }: DataTableHeaderSearchProps): react.JSX.Element;
238
+
239
+ interface DataTableHeaderSortProps<TData extends RowData> {
240
+ table: Table<DataTableFeatures, TData>;
241
+ sorting: SortingState;
242
+ }
243
+ declare function DataTableHeaderSort<TData extends RowData>({ table, sorting, }: DataTableHeaderSortProps<TData>): react.JSX.Element;
244
+
245
+ interface DataTableHeaderToggleProps<TData extends RowData> {
246
+ table: Table<DataTableFeatures, TData>;
247
+ }
248
+ declare function DataTableHeaderToggle<TData extends RowData>({ table, }: DataTableHeaderToggleProps<TData>): react.JSX.Element;
249
+
250
+ interface DataTableProps<TData extends RowData> {
251
+ /** Column definitions for the table */
252
+ columns: ColumnDef<DataTableFeatures, TData>[];
253
+ /** Array of data rows to display */
254
+ data: TData[];
255
+ /** Initial column visibility state */
256
+ initialColumnVisibility?: ColumnVisibilityState;
257
+ /** Render function for custom create/add modal dialog */
258
+ renderCreateDialog?: (open: boolean, onOpenChange: (open: boolean) => void) => ReactNode;
259
+ /** Label text for the add button (defaults to "Add") */
260
+ addLabel?: string;
261
+ /** Callback triggered when user clicks the refresh button */
262
+ onRefresh?: () => void;
263
+ /** Callback triggered when user downloads data */
264
+ onDownload?: () => void;
265
+ /** Base filename used when exporting data (defaults to "data-export") */
266
+ exportFilename?: string;
267
+ /** Loading state indicator */
268
+ isLoading?: boolean;
269
+ /** Placeholder text for search bar (defaults to "Search...") */
270
+ searchPlaceholder?: string;
271
+ /** Toggle visibility of search input (default: true) */
272
+ showSearchInput?: boolean;
273
+ /** Toggle visibility of refresh button (default: true) */
274
+ showRefreshButton?: boolean;
275
+ /** Toggle visibility of sort button (default: true) */
276
+ showSortButton?: boolean;
277
+ /** Toggle visibility of filter button (default: true) */
278
+ showFilterButton?: boolean;
279
+ /** Toggle visibility of download/export button (default: true) */
280
+ showDownloadButton?: boolean;
281
+ /** Toggle visibility of column toggle button (default: true) */
282
+ showColumnToggleButton?: boolean;
283
+ /** Toggle visibility of add/create button (default: true) */
284
+ showAddButton?: boolean;
285
+ /** Custom icon for empty state */
286
+ emptyIcon?: React.ComponentType<{
287
+ className?: string;
288
+ }> | ReactNode;
289
+ /** Custom title for empty state */
290
+ emptyTitle?: ReactNode;
291
+ /** Custom description for empty state */
292
+ emptyDescription?: ReactNode;
293
+ /** Custom button text for empty state action */
294
+ emptyButtonText?: string;
295
+ /** Custom render prop for empty state action button */
296
+ emptyRender?: ComponentProps<typeof Button>["render"];
297
+ /** Callback for empty state action button click */
298
+ onEmptyAction?: () => void;
299
+ /** Custom render function to completely override the empty state */
300
+ renderEmptyState?: () => ReactNode;
301
+ }
302
+ /**
303
+ * Universal Data Table component built with TanStack Table and Shadcn UI.
304
+ * Provides out-of-the-box features: global search, smart multi-type column filtering,
305
+ * column sorting, column visibility toggle, data export (PDF, Excel, CSV, Print),
306
+ * data refresh, pagination, row actions, add/create modal dialog binding,
307
+ * loading skeletons, and integrated empty states via StateEmpty.
308
+ */
309
+ declare function DataTable<TData extends RowData>({ columns, data, initialColumnVisibility, renderCreateDialog, addLabel, onRefresh, onDownload, exportFilename, isLoading, searchPlaceholder, showSearchInput, showRefreshButton, showSortButton, showFilterButton, showDownloadButton, showColumnToggleButton, showAddButton, emptyIcon, emptyTitle, emptyDescription, emptyButtonText, emptyRender, onEmptyAction, renderEmptyState, }: DataTableProps<TData>): react.JSX.Element;
310
+
41
311
  interface HeaderTabItem {
42
312
  title: string;
43
313
  url: string;
@@ -61,21 +331,16 @@ interface HeaderTitleProps {
61
331
  }
62
332
  declare const HeaderTitle: react.NamedExoticComponent<HeaderTitleProps>;
63
333
 
64
- declare const buttonVariants: (props?: ({
65
- variant?: "default" | "outline" | "secondary" | "ghost" | "destructive" | "link" | null | undefined;
66
- size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
67
- } & class_variance_authority_types.ClassProp) | undefined) => string;
68
- declare function Button({ className, variant, size, ...props }: Button$1.Props & VariantProps<typeof buttonVariants>): react.JSX.Element;
69
-
70
334
  interface StateEmptyProps {
71
335
  icon: React.ComponentType<{
72
336
  className?: string;
73
337
  }> | ReactNode;
74
338
  title: ReactNode;
75
339
  description: ReactNode;
76
- buttonText: string;
340
+ buttonText?: string;
341
+ onClick?: () => void;
77
342
  render?: ComponentProps<typeof Button>["render"];
78
343
  }
79
344
  declare const StateEmpty: react.NamedExoticComponent<StateEmptyProps>;
80
345
 
81
- export { AppSidebar, type AppSidebarProps, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, StateEmpty, type StateEmptyProps };
346
+ export { AppSidebar, type AppSidebarProps, type ColumnMetaCustom, DataTable, DataTableContentBody, type DataTableContentBodyProps, DataTableContentHeader, type DataTableContentHeaderProps, type DataTableFeatures, DataTableFooterEntries, type DataTableFooterEntriesProps, DataTableFooterPagination, type DataTableFooterPaginationProps, DataTableHeaderAdd, type DataTableHeaderAddProps, DataTableHeaderDownload, type DataTableHeaderDownloadProps, DataTableHeaderFilter, type DataTableHeaderFilterProps, DataTableHeaderRefresh, type DataTableHeaderRefreshProps, DataTableHeaderSearch, type DataTableHeaderSearchProps, DataTableHeaderSort, type DataTableHeaderSortProps, DataTableHeaderToggle, type DataTableHeaderToggleProps, type DataTableProps, type FilterSelectOption, type FilterVariant, type HeaderTabItem, HeaderTabs, type HeaderTabsProps, HeaderTitle, type HeaderTitleProps, type NavItem, type OrganizationItem, type RowActionItem, RowActions, type RowActionsProps, StateEmpty, type StateEmptyProps, exportToCSV, exportToXLSX, features, getTableExportData, printTable, smartFilterFn };