@rafal.lemieszewski/tide-ui 0.83.0 → 0.84.3
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/README.md +20 -8
- package/dist/cjs/components/core-index.cjs +1 -0
- package/dist/cjs/components/fundamental/accordion.cjs +1 -0
- package/dist/cjs/components/fundamental/alert-dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/alert.cjs +1 -0
- package/dist/cjs/components/fundamental/autocomplete-search.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar-group.cjs +1 -0
- package/dist/cjs/components/fundamental/avatar.cjs +1 -0
- package/dist/cjs/components/fundamental/badge.cjs +1 -0
- package/dist/cjs/components/fundamental/breadcrumb.cjs +1 -0
- package/dist/cjs/components/fundamental/button-group.cjs +1 -0
- package/dist/cjs/components/fundamental/button.cjs +1 -0
- package/dist/cjs/components/fundamental/calendar.cjs +1 -0
- package/dist/cjs/components/fundamental/card.cjs +1 -0
- package/dist/cjs/components/fundamental/chart.cjs +1 -0
- package/dist/cjs/components/fundamental/checkbox.cjs +1 -0
- package/dist/cjs/components/fundamental/collapsible.cjs +1 -0
- package/dist/cjs/components/fundamental/combobox.cjs +1 -0
- package/dist/cjs/components/fundamental/command.cjs +1 -0
- package/dist/cjs/components/fundamental/country-dropdown.cjs +1 -0
- package/dist/cjs/components/fundamental/custom-icons.cjs +1 -0
- package/dist/cjs/components/fundamental/date-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/dialog.cjs +1 -0
- package/dist/cjs/components/fundamental/drawer.cjs +1 -0
- package/dist/cjs/components/fundamental/dropdown-menu.cjs +1 -0
- package/dist/cjs/components/fundamental/editable.cjs +1 -0
- package/dist/cjs/components/fundamental/empty.cjs +1 -0
- package/dist/cjs/components/fundamental/file-upload.cjs +1 -0
- package/dist/cjs/components/fundamental/flag.cjs +1 -0
- package/dist/cjs/components/fundamental/form-field.cjs +1 -0
- package/dist/cjs/components/fundamental/hover-card.cjs +1 -0
- package/dist/cjs/components/fundamental/icon.cjs +1 -0
- package/dist/cjs/components/fundamental/input-group.cjs +1 -0
- package/dist/cjs/components/fundamental/input.cjs +1 -0
- package/dist/cjs/components/fundamental/kbd.cjs +1 -0
- package/dist/cjs/components/fundamental/label.cjs +1 -0
- package/dist/cjs/components/fundamental/month-picker.cjs +1 -0
- package/dist/cjs/components/fundamental/pagination.cjs +1 -0
- package/dist/cjs/components/fundamental/popover.cjs +1 -0
- package/dist/cjs/components/fundamental/progress.cjs +1 -0
- package/dist/cjs/components/fundamental/radio-group.cjs +1 -0
- package/dist/cjs/components/fundamental/resizable.cjs +1 -0
- package/dist/cjs/components/fundamental/scroll-area.cjs +1 -0
- package/dist/cjs/components/fundamental/select.cjs +1 -0
- package/dist/cjs/components/fundamental/separator.cjs +1 -0
- package/dist/cjs/components/fundamental/sheet.cjs +1 -0
- package/dist/cjs/components/fundamental/sidebar.cjs +1 -0
- package/dist/cjs/components/fundamental/skeleton.cjs +1 -0
- package/dist/cjs/components/fundamental/slider.cjs +1 -0
- package/dist/cjs/components/fundamental/spinner.cjs +1 -0
- package/dist/cjs/components/fundamental/switch.cjs +1 -0
- package/dist/cjs/components/fundamental/table.cjs +1 -0
- package/dist/cjs/components/fundamental/tabs.cjs +1 -0
- package/dist/cjs/components/fundamental/tag.cjs +27 -0
- package/dist/cjs/components/fundamental/text-link.cjs +1 -0
- package/dist/cjs/components/fundamental/textarea.cjs +1 -0
- package/dist/cjs/components/fundamental/toast.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle-group.cjs +1 -0
- package/dist/cjs/components/fundamental/toggle.cjs +1 -0
- package/dist/cjs/components/fundamental/tooltip.cjs +1 -0
- package/dist/cjs/components/fundamental/tree.cjs +1 -0
- package/dist/cjs/components/product/activity-log.cjs +1 -0
- package/dist/cjs/components/product/app-frame.cjs +1 -0
- package/dist/cjs/components/product/attributes-list.cjs +1 -0
- package/dist/cjs/components/product/bookmarks.cjs +1 -0
- package/dist/cjs/components/product/data-table-settings-menu.cjs +1 -0
- package/dist/cjs/components/product/data-table.cjs +1 -0
- package/dist/cjs/components/product/filters.cjs +1 -0
- package/dist/cjs/components/product/fixture-status.cjs +1 -0
- package/dist/cjs/components/product/linked-chart.cjs +1 -0
- package/dist/cjs/components/product/view-mode-menu.cjs +1 -0
- package/dist/cjs/lib/date-utils.cjs +1 -0
- package/dist/cjs/lib/hooks.cjs +1 -0
- package/dist/cjs/lib/index.cjs +1 -0
- package/dist/cjs/lib/utils.cjs +1 -0
- package/dist/es/components/core-index.js +37 -0
- package/dist/es/components/fundamental/accordion.js +60 -0
- package/dist/es/components/fundamental/alert-dialog.js +116 -0
- package/dist/es/components/fundamental/alert.js +65 -0
- package/dist/es/components/fundamental/autocomplete-search.js +139 -0
- package/dist/es/components/fundamental/avatar-group.js +51 -0
- package/dist/es/components/fundamental/avatar.js +165 -0
- package/dist/es/components/fundamental/badge.js +157 -0
- package/dist/es/components/fundamental/breadcrumb.js +142 -0
- package/dist/es/components/fundamental/button-group.js +86 -0
- package/dist/es/components/fundamental/button.js +186 -0
- package/dist/es/components/fundamental/calendar.js +130 -0
- package/dist/es/components/fundamental/card.js +68 -0
- package/dist/es/components/fundamental/chart.js +1006 -0
- package/dist/es/components/fundamental/checkbox.js +51 -0
- package/dist/es/components/fundamental/collapsible.js +55 -0
- package/dist/es/components/fundamental/combobox.js +229 -0
- package/dist/es/components/fundamental/command.js +155 -0
- package/dist/es/components/fundamental/country-dropdown.js +215 -0
- package/dist/es/components/fundamental/custom-icons.js +876 -0
- package/dist/es/components/fundamental/date-picker.js +119 -0
- package/dist/es/components/fundamental/dialog.js +106 -0
- package/dist/es/components/fundamental/drawer.js +93 -0
- package/dist/es/components/fundamental/dropdown-menu.js +600 -0
- package/dist/es/components/fundamental/editable.js +123 -0
- package/dist/es/components/fundamental/empty.js +152 -0
- package/dist/es/components/fundamental/file-upload.js +289 -0
- package/dist/es/components/fundamental/flag.js +60 -0
- package/dist/es/components/fundamental/form-field.js +352 -0
- package/dist/es/components/fundamental/hover-card.js +23 -0
- package/dist/es/components/fundamental/icon.js +200 -0
- package/dist/es/components/fundamental/input-group.js +135 -0
- package/dist/es/components/fundamental/input.js +78 -0
- package/dist/es/components/fundamental/kbd.js +57 -0
- package/dist/es/components/fundamental/label.js +54 -0
- package/dist/es/components/fundamental/month-picker.js +161 -0
- package/dist/es/components/fundamental/pagination.js +109 -0
- package/dist/es/components/fundamental/popover.js +24 -0
- package/dist/es/components/fundamental/progress.js +66 -0
- package/dist/es/components/fundamental/radio-group.js +64 -0
- package/dist/es/components/fundamental/resizable.js +43 -0
- package/dist/es/components/fundamental/scroll-area.js +38 -0
- package/dist/es/components/fundamental/select.js +136 -0
- package/dist/es/components/fundamental/separator.js +47 -0
- package/dist/es/components/fundamental/sheet.js +134 -0
- package/dist/es/components/fundamental/sidebar.js +709 -0
- package/dist/es/components/fundamental/skeleton.js +158 -0
- package/dist/es/components/fundamental/slider.js +35 -0
- package/dist/es/components/fundamental/spinner.js +225 -0
- package/dist/es/components/fundamental/switch.js +27 -0
- package/dist/es/components/fundamental/table.js +263 -0
- package/dist/es/components/fundamental/tabs.js +170 -0
- package/dist/es/components/fundamental/tag.js +295 -0
- package/dist/es/components/fundamental/text-link.js +105 -0
- package/dist/es/components/fundamental/textarea.js +47 -0
- package/dist/es/components/fundamental/toast.js +108 -0
- package/dist/es/components/fundamental/toggle-group.js +37 -0
- package/dist/es/components/fundamental/toggle.js +51 -0
- package/dist/es/components/fundamental/tooltip.js +26 -0
- package/dist/es/components/fundamental/tree.js +161 -0
- package/dist/es/components/product/activity-log.js +231 -0
- package/dist/es/components/product/app-frame.js +985 -0
- package/dist/es/components/product/attributes-list.js +351 -0
- package/dist/es/components/product/bookmarks.js +833 -0
- package/dist/es/components/product/data-table-settings-menu.js +169 -0
- package/dist/es/components/product/data-table.js +2473 -0
- package/dist/es/components/product/filters.js +1041 -0
- package/dist/es/components/product/fixture-status.js +178 -0
- package/dist/es/components/product/linked-chart.js +179 -0
- package/dist/es/components/product/view-mode-menu.js +353 -0
- package/dist/es/lib/date-utils.js +151 -0
- package/dist/es/lib/hooks.js +29 -0
- package/dist/es/lib/index.js +348 -0
- package/dist/es/lib/utils.js +8 -0
- package/dist/es/style.css +1 -0
- package/dist/types/bookmarks.d.ts +2 -0
- package/dist/types/calendar.d.ts +2 -0
- package/dist/types/chart.d.ts +2 -0
- package/dist/types/components/core-index.d.cts +135 -0
- package/dist/types/components/core-index.d.ts +135 -0
- package/dist/{components → types/components}/fundamental/avatar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/badge.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button-group.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/button.d.ts +1 -1
- package/dist/types/components/fundamental/calendar.d.ts +7 -0
- package/dist/types/components/fundamental/chart.d.ts +95 -0
- package/dist/{components → types/components}/fundamental/command.d.ts +2 -2
- package/dist/types/components/fundamental/country-dropdown.d.ts +34 -0
- package/dist/types/components/fundamental/date-picker.d.ts +30 -0
- package/dist/{components → types/components}/fundamental/file-upload.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/form-field.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/form.d.ts +2 -2
- package/dist/{components → types/components}/fundamental/icon.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/input-group.d.ts +1 -1
- package/dist/types/components/fundamental/resizable.d.cts +23 -0
- package/dist/{components → types/components}/fundamental/resizable.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/sidebar.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/spinner.d.ts +1 -1
- package/dist/{components → types/components}/fundamental/table.d.ts +3 -3
- package/dist/{components → types/components}/fundamental/text-link.d.ts +1 -1
- package/dist/{components → types/components}/index.d.ts +118 -118
- package/dist/{components → types/components}/product/activity-log.d.ts +1 -1
- package/dist/{components → types/components}/product/attributes-list.d.ts +1 -1
- package/dist/types/components/product/bookmarks.d.cts +90 -0
- package/dist/{components → types/components}/product/bookmarks.d.ts +1 -1
- package/dist/types/components/product/data-table.d.ts +802 -0
- package/dist/types/components/product/filters.d.ts +124 -0
- package/dist/{components → types/components}/product/fixture-status.d.ts +1 -1
- package/dist/types/components/product/linked-chart.d.cts +22 -0
- package/dist/{components → types/components}/product/linked-chart.d.ts +1 -1
- package/dist/types/country-dropdown.d.ts +2 -0
- package/dist/types/data-table.d.ts +2 -0
- package/dist/types/date-picker.d.ts +2 -0
- package/dist/types/filters.d.ts +2 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lib/index.d.cts +104 -0
- package/dist/types/lib/index.d.ts +104 -0
- package/dist/types/linked-chart.d.ts +2 -0
- package/dist/types/resizable.d.ts +2 -0
- package/package.json +191 -31
- package/dist/index.cjs.js +0 -144
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.es.js +0 -87768
- package/dist/index.es.js.map +0 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/style.css +0 -1
- /package/dist/{components → types/components}/fundamental/accordion.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert-dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/alert.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/autocomplete-search.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/avatar-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/breadcrumb.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/button.test.d.ts +0 -0
- /package/dist/{components/fundamental/calendar.d.ts → types/components/fundamental/calendar.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/card.d.ts +0 -0
- /package/dist/{components/fundamental/chart.d.ts → types/components/fundamental/chart.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/checkbox.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/collapsible.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/combobox.d.ts +0 -0
- /package/dist/{components/fundamental/country-dropdown.d.ts → types/components/fundamental/country-dropdown.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/custom-icons.d.ts +0 -0
- /package/dist/{components/fundamental/date-picker.d.ts → types/components/fundamental/date-picker.d.cts} +0 -0
- /package/dist/{components → types/components}/fundamental/dialog.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/drawer.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/dropdown-menu.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/editable.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/empty.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/flag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/hover-card.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/input.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/kbd.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/label.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/month-picker.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/pagination.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/popover.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/progress.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/radio-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/scroll-area.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/select.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/separator.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/sheet.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/skeleton.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/slider.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/switch.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tabs.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tag.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/textarea.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toast.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle-group.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/toggle.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tooltip.d.ts +0 -0
- /package/dist/{components → types/components}/fundamental/tree.d.ts +0 -0
- /package/dist/{components → types/components}/product/app-frame.d.ts +0 -0
- /package/dist/{components → types/components}/product/data-table-settings-menu.d.ts +0 -0
- /package/dist/{components/product/data-table.d.ts → types/components/product/data-table.d.cts} +0 -0
- /package/dist/{components/product/filters.d.ts → types/components/product/filters.d.cts} +0 -0
- /package/dist/{components → types/components}/product/view-mode-menu.d.ts +0 -0
- /package/dist/{lib → types/lib}/date-utils.d.ts +0 -0
- /package/dist/{lib → types/lib}/hooks.d.ts +0 -0
- /package/dist/{lib → types/lib}/utils.d.ts +0 -0
|
@@ -0,0 +1,802 @@
|
|
|
1
|
+
import { ColumnDef, SortingState, VisibilityState, ExpandedState, GroupingState, ColumnOrderState, PaginationState, Row, FilterFn, ColumnResizeMode } from '@tanstack/react-table';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type FilterVariant = "text" | "select" | "multiselect" | "number" | "date" | "boolean";
|
|
4
|
+
export interface NestedHeaderConfig {
|
|
5
|
+
id: string;
|
|
6
|
+
header: string | React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
columns: ColumnDef<any, any>[];
|
|
10
|
+
}
|
|
11
|
+
export type AggregationType = 'range' | 'average' | 'sum' | 'count' | 'uniqueCount' | 'mostCommon' | 'dateRange' | false | ((rows: any[], accessor: any) => string);
|
|
12
|
+
export interface ColumnMeta {
|
|
13
|
+
label?: string;
|
|
14
|
+
filterVariant?: FilterVariant;
|
|
15
|
+
filterOptions?: Array<{
|
|
16
|
+
label: string;
|
|
17
|
+
value: string;
|
|
18
|
+
icon?: React.ComponentType<any>;
|
|
19
|
+
}>;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
icon?: React.ComponentType<any>;
|
|
22
|
+
renderInGroupedRows?: boolean;
|
|
23
|
+
aggregation?: AggregationType;
|
|
24
|
+
align?: 'left' | 'right';
|
|
25
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
26
|
+
truncate?: boolean;
|
|
27
|
+
}
|
|
28
|
+
declare module '@tanstack/react-table' {
|
|
29
|
+
interface ColumnMeta<TData extends unknown, TValue> {
|
|
30
|
+
label?: string;
|
|
31
|
+
filterVariant?: FilterVariant;
|
|
32
|
+
filterOptions?: Array<{
|
|
33
|
+
label: string;
|
|
34
|
+
value: string;
|
|
35
|
+
icon?: React.ComponentType<any>;
|
|
36
|
+
}>;
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
icon?: React.ComponentType<any>;
|
|
39
|
+
renderInGroupedRows?: boolean;
|
|
40
|
+
aggregation?: AggregationType;
|
|
41
|
+
align?: 'left' | 'right';
|
|
42
|
+
verticalAlign?: 'top' | 'middle' | 'bottom';
|
|
43
|
+
truncate?: boolean;
|
|
44
|
+
}
|
|
45
|
+
interface ColumnDefBase<TData extends unknown, TValue = unknown> {
|
|
46
|
+
/**
|
|
47
|
+
* Custom cell renderer for section header rows.
|
|
48
|
+
* Similar to aggregatedCell for grouped rows, this allows rendering
|
|
49
|
+
* custom content for rows that act as section headers.
|
|
50
|
+
*
|
|
51
|
+
* When this returns non-null content, the row is treated as a section header:
|
|
52
|
+
* - The cell spans the full table width (colSpan = all columns)
|
|
53
|
+
* - Appropriate section header styling is applied
|
|
54
|
+
* - Other cells in the row are not rendered
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* {
|
|
58
|
+
* id: 'broker',
|
|
59
|
+
* accessorKey: 'broker',
|
|
60
|
+
* sectionHeaderCell: ({ row }) => {
|
|
61
|
+
* if (row.original.isSectionHeader) {
|
|
62
|
+
* return <div>Section: {row.original.name}</div>
|
|
63
|
+
* }
|
|
64
|
+
* return null
|
|
65
|
+
* }
|
|
66
|
+
* }
|
|
67
|
+
*/
|
|
68
|
+
sectionHeaderCell?: (info: any) => React.ReactNode;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
declare const fuzzyFilter: FilterFn<any>;
|
|
72
|
+
declare const multiSelectFilter: FilterFn<any>;
|
|
73
|
+
declare const groupPreservingGlobalFilter: FilterFn<any>;
|
|
74
|
+
interface DataTableSkeletonProps {
|
|
75
|
+
columns: number;
|
|
76
|
+
rows: number;
|
|
77
|
+
showRowBorder?: boolean;
|
|
78
|
+
showCellBorder?: boolean;
|
|
79
|
+
skipHeader?: boolean;
|
|
80
|
+
enableResponsiveWrapper?: boolean;
|
|
81
|
+
}
|
|
82
|
+
declare function DataTableSkeleton({ columns, rows, showRowBorder, showCellBorder, skipHeader, enableResponsiveWrapper }: DataTableSkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
export interface DataTableEmptyStateProps {
|
|
84
|
+
title?: string;
|
|
85
|
+
description?: string;
|
|
86
|
+
action?: {
|
|
87
|
+
label: string;
|
|
88
|
+
onClick: () => void;
|
|
89
|
+
};
|
|
90
|
+
customContent?: React.ReactNode;
|
|
91
|
+
}
|
|
92
|
+
export interface DataTableNoResultsStateProps {
|
|
93
|
+
title?: string;
|
|
94
|
+
description?: string;
|
|
95
|
+
action?: {
|
|
96
|
+
label: string;
|
|
97
|
+
onClick: () => void;
|
|
98
|
+
};
|
|
99
|
+
customContent?: React.ReactNode;
|
|
100
|
+
}
|
|
101
|
+
export interface DataTableErrorStateProps {
|
|
102
|
+
error: Error | null;
|
|
103
|
+
onRetry?: () => void;
|
|
104
|
+
customContent?: React.ReactNode;
|
|
105
|
+
}
|
|
106
|
+
interface DataTableToolbarProps<_TData = any> {
|
|
107
|
+
table: any;
|
|
108
|
+
searchKey?: string;
|
|
109
|
+
searchPlaceholder?: string;
|
|
110
|
+
enableGlobalSearch?: boolean;
|
|
111
|
+
globalSearchPlaceholder?: string;
|
|
112
|
+
globalFilter?: string;
|
|
113
|
+
onGlobalFilterChange?: (value: string) => void;
|
|
114
|
+
enableGlobalFaceting?: boolean;
|
|
115
|
+
enableGrouping?: boolean;
|
|
116
|
+
showSettingsMenu?: boolean;
|
|
117
|
+
enableAutocomplete?: boolean;
|
|
118
|
+
autocompleteSuggestions?: string[];
|
|
119
|
+
autocompleteMinCharacters?: number;
|
|
120
|
+
}
|
|
121
|
+
declare const DataTableToolbar: <TData>(props: DataTableToolbarProps<TData>) => React.ReactElement;
|
|
122
|
+
interface DataTableFilterProps {
|
|
123
|
+
column: any;
|
|
124
|
+
}
|
|
125
|
+
declare const DataTableFilter: React.NamedExoticComponent<DataTableFilterProps>;
|
|
126
|
+
interface DataTableColumnHeaderProps<_TData = any, _TValue = any> extends React.HTMLAttributes<HTMLDivElement> {
|
|
127
|
+
column: any;
|
|
128
|
+
title: string;
|
|
129
|
+
}
|
|
130
|
+
declare const DataTableColumnHeader: <TData, TValue>(props: DataTableColumnHeaderProps<TData, TValue>) => React.ReactElement;
|
|
131
|
+
interface DataTablePaginationProps<_TData = any> {
|
|
132
|
+
table: any;
|
|
133
|
+
enableGrouping?: boolean;
|
|
134
|
+
hideChildrenForSingleItemGroups?: Record<string, boolean>;
|
|
135
|
+
footerLabel?: React.ReactNode;
|
|
136
|
+
onNextPageHover?: () => void;
|
|
137
|
+
onPreviousPageHover?: () => void;
|
|
138
|
+
paginationVariant?: "default" | "full";
|
|
139
|
+
pageSizeOptions?: number[];
|
|
140
|
+
}
|
|
141
|
+
declare const DataTablePagination: <TData>(props: DataTablePaginationProps<TData>) => React.ReactElement;
|
|
142
|
+
export type BorderStyle = "vertical" | "horizontal" | "both" | "none";
|
|
143
|
+
/**
|
|
144
|
+
* Row state for color configuration
|
|
145
|
+
*/
|
|
146
|
+
export type RowState = 'expanded' | 'collapsed' | 'leaf';
|
|
147
|
+
/**
|
|
148
|
+
* Color configuration for a specific depth level with state-aware overrides
|
|
149
|
+
*/
|
|
150
|
+
export interface DepthColorConfig {
|
|
151
|
+
/**
|
|
152
|
+
* Default color for this depth level (used when no state-specific color matches)
|
|
153
|
+
*/
|
|
154
|
+
default: string;
|
|
155
|
+
/**
|
|
156
|
+
* Optional state-specific color overrides
|
|
157
|
+
*/
|
|
158
|
+
expanded?: string;
|
|
159
|
+
collapsed?: string;
|
|
160
|
+
leaf?: string;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Granular color configuration by depth level
|
|
164
|
+
* Can be specified as:
|
|
165
|
+
* 1. Simple string (applies to all states at that depth)
|
|
166
|
+
* 2. DepthColorConfig object (state-aware colors for that depth)
|
|
167
|
+
*/
|
|
168
|
+
export type DepthColors = Record<number, string | DepthColorConfig>;
|
|
169
|
+
/**
|
|
170
|
+
* Height configuration by depth level
|
|
171
|
+
* Supports CSS height values: "40px", "48px", "2.5rem", etc.
|
|
172
|
+
*/
|
|
173
|
+
export type DepthHeights = Record<number, string>;
|
|
174
|
+
/**
|
|
175
|
+
* Comprehensive nested row styling configuration
|
|
176
|
+
*/
|
|
177
|
+
export interface NestedRowStyling {
|
|
178
|
+
/**
|
|
179
|
+
* Granular color configuration by depth level
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* // Simple: same color for all states at each depth
|
|
183
|
+
* colors: {
|
|
184
|
+
* 0: 'var(--blue-50)',
|
|
185
|
+
* 1: 'var(--blue-25)',
|
|
186
|
+
* 2: 'var(--grey-25)'
|
|
187
|
+
* }
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* // Advanced: state-specific colors per depth
|
|
191
|
+
* colors: {
|
|
192
|
+
* 0: {
|
|
193
|
+
* default: 'var(--blue-50)',
|
|
194
|
+
* expanded: 'var(--blue-100)',
|
|
195
|
+
* collapsed: 'var(--blue-50)',
|
|
196
|
+
* leaf: 'var(--grey-25)'
|
|
197
|
+
* },
|
|
198
|
+
* 1: 'var(--blue-25)', // Simple string for depth 1
|
|
199
|
+
* 2: {
|
|
200
|
+
* default: 'var(--grey-25)',
|
|
201
|
+
* expanded: 'var(--grey-50)'
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
*/
|
|
205
|
+
colors?: DepthColors;
|
|
206
|
+
/**
|
|
207
|
+
* Height configuration by depth level
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* heights: {
|
|
211
|
+
* 0: '48px', // Parent rows
|
|
212
|
+
* 1: '40px', // First level children
|
|
213
|
+
* 2: '36px' // Second level children
|
|
214
|
+
* }
|
|
215
|
+
*/
|
|
216
|
+
heights?: DepthHeights;
|
|
217
|
+
/**
|
|
218
|
+
* Default height for depths not explicitly specified
|
|
219
|
+
* Falls back to table size if not provided
|
|
220
|
+
*/
|
|
221
|
+
defaultHeight?: string;
|
|
222
|
+
}
|
|
223
|
+
export interface DataTableProps<TData, TValue> {
|
|
224
|
+
columns: ColumnDef<TData, TValue>[];
|
|
225
|
+
data: TData[];
|
|
226
|
+
searchKey?: string;
|
|
227
|
+
searchPlaceholder?: string;
|
|
228
|
+
title?: string;
|
|
229
|
+
/**
|
|
230
|
+
* Accessible caption/description for the table.
|
|
231
|
+
* Rendered as a visually hidden caption for screen readers.
|
|
232
|
+
* If not provided, falls back to `title` prop.
|
|
233
|
+
* @example "Product inventory listing with 50 items"
|
|
234
|
+
*/
|
|
235
|
+
caption?: string;
|
|
236
|
+
className?: string;
|
|
237
|
+
stickyHeader?: boolean;
|
|
238
|
+
stickyFirstColumn?: boolean;
|
|
239
|
+
stickyLeftColumns?: number;
|
|
240
|
+
stickyRightColumns?: number;
|
|
241
|
+
enableResponsiveWrapper?: boolean;
|
|
242
|
+
showScrollIndicators?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Minimum width for the table when responsive wrapper is enabled.
|
|
245
|
+
* This determines when horizontal scrolling triggers on smaller screens.
|
|
246
|
+
* @default "900px"
|
|
247
|
+
* @example "1200px" - For tables with many columns
|
|
248
|
+
* @example "100%" - To prevent horizontal scrolling
|
|
249
|
+
*/
|
|
250
|
+
minTableWidth?: string;
|
|
251
|
+
isLoading?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* Controls how the table displays during loading.
|
|
254
|
+
* - 'replace': Full skeleton replaces table content (default)
|
|
255
|
+
* - 'preserve': Keep existing data visible while loading
|
|
256
|
+
*/
|
|
257
|
+
loadingBehavior?: 'replace' | 'preserve';
|
|
258
|
+
loadingRowCount?: number;
|
|
259
|
+
borderStyle?: BorderStyle;
|
|
260
|
+
/** Global default vertical alignment for all table cells. Can be overridden per column via column meta. */
|
|
261
|
+
defaultVerticalAlign?: 'top' | 'middle' | 'bottom';
|
|
262
|
+
enableGlobalSearch?: boolean;
|
|
263
|
+
globalSearchPlaceholder?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Enable autocomplete for global search.
|
|
266
|
+
* When enabled, shows suggestions as user types.
|
|
267
|
+
*/
|
|
268
|
+
enableAutocomplete?: boolean;
|
|
269
|
+
/**
|
|
270
|
+
* Column keys to extract autocomplete suggestions from.
|
|
271
|
+
* If not provided, suggestions will be extracted from all columns.
|
|
272
|
+
* @example ['name', 'email', 'company']
|
|
273
|
+
*/
|
|
274
|
+
globalSearchColumns?: string[];
|
|
275
|
+
/**
|
|
276
|
+
* Minimum characters required before showing autocomplete suggestions.
|
|
277
|
+
* @default 2
|
|
278
|
+
*/
|
|
279
|
+
autocompleteMinCharacters?: number;
|
|
280
|
+
enableGlobalFaceting?: boolean;
|
|
281
|
+
enableColumnResizing?: boolean;
|
|
282
|
+
columnResizeMode?: ColumnResizeMode;
|
|
283
|
+
enableColumnResizePersistence?: boolean;
|
|
284
|
+
enablePaginationPersistence?: boolean;
|
|
285
|
+
storageKey?: string;
|
|
286
|
+
enableExpanding?: boolean;
|
|
287
|
+
getSubRows?: (row: TData) => TData[] | undefined;
|
|
288
|
+
/**
|
|
289
|
+
* DEPRECATED: Use nestedRowStyling.colors instead.
|
|
290
|
+
* Custom color overrides for expanding rows at different depths and states.
|
|
291
|
+
* If not provided, uses smart context-aware defaults that match grouping colors.
|
|
292
|
+
*
|
|
293
|
+
* This prop is maintained for backward compatibility but will be overridden
|
|
294
|
+
* by nestedRowStyling.colors if both are provided.
|
|
295
|
+
*
|
|
296
|
+
* @deprecated Use nestedRowStyling for granular control
|
|
297
|
+
* @example
|
|
298
|
+
* expandingRowColors={{
|
|
299
|
+
* expandedParent: 'var(--blue-50)',
|
|
300
|
+
* collapsedParent: 'var(--color-background-neutral-subtlest)',
|
|
301
|
+
* children: 'var(--blue-25)'
|
|
302
|
+
* }}
|
|
303
|
+
*/
|
|
304
|
+
expandingRowColors?: {
|
|
305
|
+
expandedParent?: string;
|
|
306
|
+
collapsedParent?: string;
|
|
307
|
+
children?: string;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Granular styling configuration for nested rows (expanding and grouped).
|
|
311
|
+
* Provides depth-specific colors and heights with state-aware overrides.
|
|
312
|
+
*
|
|
313
|
+
* Priority: nestedRowStyling > expandingRowColors > default colors
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* nestedRowStyling={{
|
|
317
|
+
* colors: {
|
|
318
|
+
* 0: { default: 'var(--blue-100)', expanded: 'var(--blue-150)' },
|
|
319
|
+
* 1: 'var(--blue-50)',
|
|
320
|
+
* 2: 'var(--blue-25)'
|
|
321
|
+
* },
|
|
322
|
+
* heights: {
|
|
323
|
+
* 0: '48px',
|
|
324
|
+
* 1: '40px'
|
|
325
|
+
* },
|
|
326
|
+
* defaultHeight: '36px'
|
|
327
|
+
* }}
|
|
328
|
+
*/
|
|
329
|
+
nestedRowStyling?: NestedRowStyling;
|
|
330
|
+
enableGrouping?: boolean;
|
|
331
|
+
groupedColumnMode?: 'reorder' | 'remove' | false;
|
|
332
|
+
enableManualGrouping?: boolean;
|
|
333
|
+
/**
|
|
334
|
+
* When grouping is enabled, specifies which column should be used to
|
|
335
|
+
* render the parent/group rows instead of the grouped column itself.
|
|
336
|
+
*
|
|
337
|
+
* Use case: Group by one field (e.g., "fixtureId") but display another
|
|
338
|
+
* field's aggregatedCell in parent rows (e.g., "orderId").
|
|
339
|
+
*
|
|
340
|
+
* The specified column should define an aggregatedCell in its columnDef
|
|
341
|
+
* to customize how the group header is rendered. If no aggregatedCell is
|
|
342
|
+
* defined, it will fall back to showing the value from the first row.
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* grouping={["fixtureId"]}
|
|
346
|
+
* groupDisplayColumn="orderId"
|
|
347
|
+
* columnVisibility={{ fixtureId: false }}
|
|
348
|
+
*/
|
|
349
|
+
groupDisplayColumn?: string;
|
|
350
|
+
/**
|
|
351
|
+
* When grouping is enabled, hides child rows for groups that contain
|
|
352
|
+
* only a single item. This flattens single-item groups to show only
|
|
353
|
+
* the parent row, reducing visual redundancy.
|
|
354
|
+
*
|
|
355
|
+
* Per-column configuration using column ID as key:
|
|
356
|
+
* - Groups with 1 item: Only parent row shown (not expandable)
|
|
357
|
+
* - Groups with 2+ items: Parent + expandable children shown normally
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* hideChildrenForSingleItemGroups={{ category: true, status: false }}
|
|
361
|
+
*/
|
|
362
|
+
hideChildrenForSingleItemGroups?: Record<string, boolean>;
|
|
363
|
+
/**
|
|
364
|
+
* When both this and hideChildrenForSingleItemGroups are enabled for a column,
|
|
365
|
+
* removes the expander button spacer for groups without expandable children.
|
|
366
|
+
* This eliminates the left padding for single-item groups, improving visual alignment.
|
|
367
|
+
*
|
|
368
|
+
* Per-column configuration using column ID as key.
|
|
369
|
+
* Only takes effect when hideChildrenForSingleItemGroups is also enabled for that column.
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* hideChildrenForSingleItemGroups={{ category: true, status: true }}
|
|
373
|
+
* hideExpanderForSingleItemGroups={{ category: true, status: true }}
|
|
374
|
+
*/
|
|
375
|
+
hideExpanderForSingleItemGroups?: Record<string, boolean>;
|
|
376
|
+
enableRowPinning?: boolean;
|
|
377
|
+
keepPinnedRows?: boolean;
|
|
378
|
+
enableVirtualization?: boolean;
|
|
379
|
+
virtualContainerHeight?: number;
|
|
380
|
+
virtualRowHeight?: number;
|
|
381
|
+
virtualOverscan?: number;
|
|
382
|
+
nestedHeaders?: NestedHeaderConfig[];
|
|
383
|
+
enableNestedHeaders?: boolean;
|
|
384
|
+
enableColumnOrdering?: boolean;
|
|
385
|
+
enableRowSelection?: boolean;
|
|
386
|
+
showHeader?: boolean;
|
|
387
|
+
showPagination?: boolean;
|
|
388
|
+
/** Pagination variant. "full" shows first/last/prev/next buttons, "default" shows only prev/next. Default: "full" */
|
|
389
|
+
paginationVariant?: "default" | "full";
|
|
390
|
+
/** Page size options shown in the pagination dropdown. Default: [10, 25, 50, 100] */
|
|
391
|
+
pageSizeOptions?: number[];
|
|
392
|
+
/** Custom content to display in the table footer, useful for showing filtered item counts or other status information */
|
|
393
|
+
footerLabel?: React.ReactNode;
|
|
394
|
+
onTableReady?: (table: any) => void;
|
|
395
|
+
initialState?: {
|
|
396
|
+
grouping?: GroupingState;
|
|
397
|
+
expanded?: ExpandedState;
|
|
398
|
+
columnSizing?: Record<string, number>;
|
|
399
|
+
rowPinning?: {
|
|
400
|
+
top?: string[];
|
|
401
|
+
bottom?: string[];
|
|
402
|
+
};
|
|
403
|
+
pagination?: {
|
|
404
|
+
pageIndex: number;
|
|
405
|
+
pageSize: number;
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
sorting?: SortingState;
|
|
409
|
+
onSortingChange?: (updaterOrValue: SortingState | ((old: SortingState) => SortingState)) => void;
|
|
410
|
+
columnVisibility?: VisibilityState;
|
|
411
|
+
onColumnVisibilityChange?: (updaterOrValue: VisibilityState | ((old: VisibilityState) => VisibilityState)) => void;
|
|
412
|
+
grouping?: GroupingState;
|
|
413
|
+
onGroupingChange?: (updaterOrValue: GroupingState | ((old: GroupingState) => GroupingState)) => void;
|
|
414
|
+
columnOrder?: ColumnOrderState;
|
|
415
|
+
onColumnOrderChange?: (updaterOrValue: ColumnOrderState | ((old: ColumnOrderState) => ColumnOrderState)) => void;
|
|
416
|
+
columnSizing?: Record<string, number>;
|
|
417
|
+
onColumnSizingChange?: (updaterOrValue: Record<string, number> | ((old: Record<string, number>) => Record<string, number>)) => void;
|
|
418
|
+
pagination?: PaginationState;
|
|
419
|
+
onPaginationChange?: (updaterOrValue: PaginationState | ((old: PaginationState) => PaginationState)) => void;
|
|
420
|
+
/**
|
|
421
|
+
* Controlled expanded state. When provided, the component operates in controlled mode.
|
|
422
|
+
* Use with onExpandedChange to manage expansion state externally.
|
|
423
|
+
* Set to `true` to expand all rows, or an object mapping row IDs to booleans.
|
|
424
|
+
*
|
|
425
|
+
* @example
|
|
426
|
+
* // Expand specific rows
|
|
427
|
+
* expanded={{ 'row-1': true, 'row-2': true }}
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* // Expand all rows
|
|
431
|
+
* expanded={true}
|
|
432
|
+
*/
|
|
433
|
+
expanded?: ExpandedState;
|
|
434
|
+
/**
|
|
435
|
+
* Callback when expanded state changes (controlled mode).
|
|
436
|
+
* Receives the new expanded state or an updater function.
|
|
437
|
+
* Use with `expanded` prop for controlled expansion state.
|
|
438
|
+
*
|
|
439
|
+
* @example
|
|
440
|
+
* const [expanded, setExpanded] = useState<ExpandedState>({})
|
|
441
|
+
* <DataTable expanded={expanded} onExpandedChange={setExpanded} />
|
|
442
|
+
*/
|
|
443
|
+
onExpandedChange?: (updaterOrValue: ExpandedState | ((old: ExpandedState) => ExpandedState)) => void;
|
|
444
|
+
renderSectionHeaderRow?: (row: any) => React.ReactNode | null;
|
|
445
|
+
/**
|
|
446
|
+
* Custom renderer for expanded row content.
|
|
447
|
+
* When provided and a row is expanded, renders this content as a full-width row
|
|
448
|
+
* below the parent row. Receives the React Table row object.
|
|
449
|
+
*
|
|
450
|
+
* @example
|
|
451
|
+
* renderSubComponent={(row) => (
|
|
452
|
+
* <Card>
|
|
453
|
+
* <CardContent>Details for {row.original.name}</CardContent>
|
|
454
|
+
* </Card>
|
|
455
|
+
* )}
|
|
456
|
+
*/
|
|
457
|
+
renderSubComponent?: (row: any) => React.ReactNode;
|
|
458
|
+
/**
|
|
459
|
+
* Custom function to determine if a row can be expanded.
|
|
460
|
+
* Overrides the default TanStack Table logic which checks for sub-rows.
|
|
461
|
+
* Useful when using renderSubComponent without hierarchical data.
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* // Make all rows expandable
|
|
465
|
+
* getRowCanExpand={() => true}
|
|
466
|
+
*
|
|
467
|
+
* @example
|
|
468
|
+
* // Make rows expandable based on a property
|
|
469
|
+
* getRowCanExpand={(row) => row.original.hasDetails}
|
|
470
|
+
*/
|
|
471
|
+
getRowCanExpand?: (row: any) => boolean;
|
|
472
|
+
autoExpandChildren?: boolean;
|
|
473
|
+
/**
|
|
474
|
+
* Callback fired when a row is clicked.
|
|
475
|
+
* Receives the row object from @tanstack/react-table and the click event.
|
|
476
|
+
* Use row.original to access the underlying data.
|
|
477
|
+
*
|
|
478
|
+
* By default, only leaf rows and single-item groups are clickable.
|
|
479
|
+
* Use isRowClickable to customize which rows can be clicked.
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* onRowClick={(row, event) => {
|
|
483
|
+
* console.log('Clicked data:', row.original);
|
|
484
|
+
* setSelectedItem(row.original);
|
|
485
|
+
* }}
|
|
486
|
+
*/
|
|
487
|
+
onRowClick?: (row: any, event: React.MouseEvent<HTMLTableRowElement>) => void;
|
|
488
|
+
/**
|
|
489
|
+
* Filter which rows should be clickable.
|
|
490
|
+
* Return false to prevent row from being clickable.
|
|
491
|
+
*
|
|
492
|
+
* By default, leaf rows and single-item groups are clickable.
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* // Only allow leaf rows to be clicked
|
|
496
|
+
* isRowClickable={(row) => !row.getIsGrouped()}
|
|
497
|
+
*
|
|
498
|
+
* @example
|
|
499
|
+
* // Allow all rows including parent groups
|
|
500
|
+
* isRowClickable={(row) => true}
|
|
501
|
+
*/
|
|
502
|
+
isRowClickable?: (row: any) => boolean;
|
|
503
|
+
/**
|
|
504
|
+
* CSS class name to apply to clickable rows.
|
|
505
|
+
* Default: applies cursor-pointer and hover background if onRowClick is provided
|
|
506
|
+
*/
|
|
507
|
+
clickableRowClassName?: string;
|
|
508
|
+
/**
|
|
509
|
+
* When enabled with grouping, preserves entire groups during global search.
|
|
510
|
+
* If any row in a group matches, the entire group is shown and auto-expanded.
|
|
511
|
+
* Also enables highlighting of matched search terms.
|
|
512
|
+
*/
|
|
513
|
+
groupPreservingSearch?: boolean;
|
|
514
|
+
/**
|
|
515
|
+
* ID of the currently active row (e.g., for detail view or navigation).
|
|
516
|
+
* When set, displays a left border indicator (3px solid brand color) on the matching row.
|
|
517
|
+
* Works independently from checkbox selection - both can be active simultaneously.
|
|
518
|
+
*
|
|
519
|
+
* @example
|
|
520
|
+
* // Basic usage with state
|
|
521
|
+
* const [activeRowId, setActiveRowId] = useState<string>()
|
|
522
|
+
* <DataTable
|
|
523
|
+
* activeRowId={activeRowId}
|
|
524
|
+
* onRowClick={(row) => setActiveRowId(row.id)}
|
|
525
|
+
* />
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* // With routing (URL-based selection)
|
|
529
|
+
* const activeRowId = params.get('selectedId')
|
|
530
|
+
* <DataTable activeRowId={activeRowId} />
|
|
531
|
+
*/
|
|
532
|
+
activeRowId?: string | number;
|
|
533
|
+
/**
|
|
534
|
+
* Custom CSS class name for styling the active row.
|
|
535
|
+
* When not provided, uses default styling: 3px left border with brand color.
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* activeRowClassName="border-l-4 border-[var(--color-border-success)]"
|
|
539
|
+
*/
|
|
540
|
+
activeRowClassName?: string;
|
|
541
|
+
/**
|
|
542
|
+
* Function to derive a unique row ID from row data.
|
|
543
|
+
* When provided, TanStack Table uses this instead of the default index-based ID.
|
|
544
|
+
* Useful when your data uses a different identifier field (e.g., clearanceId, userId).
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* // Data with custom ID field
|
|
548
|
+
* getRowId={(row) => row.clearanceId}
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* // Composite key
|
|
552
|
+
* getRowId={(row) => `${row.type}-${row.id}`}
|
|
553
|
+
*/
|
|
554
|
+
getRowId?: (originalRow: TData, index: number, parent?: Row<TData>) => string;
|
|
555
|
+
/**
|
|
556
|
+
* Callback when active row changes.
|
|
557
|
+
* Useful for analytics, logging, or side effects when the highlighted row changes.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* onActiveRowChange={(rowId) => console.log('Active row:', rowId)}
|
|
561
|
+
*/
|
|
562
|
+
onActiveRowChange?: (rowId: string | number | undefined) => void;
|
|
563
|
+
/**
|
|
564
|
+
* Callback when row selection changes.
|
|
565
|
+
* Called with the current selection state (map of row IDs to boolean).
|
|
566
|
+
* Enables external tracking of selection for bulk actions, analytics, etc.
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* onRowSelectionChange={(selection) => {
|
|
570
|
+
* const selectedIds = Object.keys(selection).filter(id => selection[id])
|
|
571
|
+
* console.log('Selected rows:', selectedIds)
|
|
572
|
+
* }}
|
|
573
|
+
*/
|
|
574
|
+
onRowSelectionChange?: (selection: Record<string, boolean>) => void;
|
|
575
|
+
/**
|
|
576
|
+
* Callback when user hovers over the next page button.
|
|
577
|
+
* Use for prefetching next page data (SWR pattern).
|
|
578
|
+
*
|
|
579
|
+
* @example
|
|
580
|
+
* onNextPageHover={() => prefetchNextPage()}
|
|
581
|
+
*/
|
|
582
|
+
onNextPageHover?: () => void;
|
|
583
|
+
/**
|
|
584
|
+
* Callback when user hovers over the previous page button.
|
|
585
|
+
* Use for prefetching previous page data.
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* onPreviousPageHover={() => prefetchPreviousPage()}
|
|
589
|
+
*/
|
|
590
|
+
onPreviousPageHover?: () => void;
|
|
591
|
+
/**
|
|
592
|
+
* Callback when a row's data is updated (e.g., via inline editing).
|
|
593
|
+
* Use for optimistic updates in custom cell renderers.
|
|
594
|
+
*
|
|
595
|
+
* @param rowId - The ID of the updated row
|
|
596
|
+
* @param columnId - The ID of the updated column
|
|
597
|
+
* @param value - The new value
|
|
598
|
+
* @param previousValue - The previous value (for rollback)
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* onRowUpdate={(rowId, columnId, value, previousValue) => {
|
|
602
|
+
* updateData(rowId, columnId, value)
|
|
603
|
+
* .catch(() => rollback(rowId, columnId, previousValue))
|
|
604
|
+
* }}
|
|
605
|
+
*/
|
|
606
|
+
onRowUpdate?: (rowId: string, columnId: string, value: unknown, previousValue: unknown) => void | Promise<void>;
|
|
607
|
+
/**
|
|
608
|
+
* Callback when user approaches the end of the data.
|
|
609
|
+
* Use for infinite scroll implementations.
|
|
610
|
+
*
|
|
611
|
+
* @param currentPage - Current page index (0-based)
|
|
612
|
+
*
|
|
613
|
+
* @example
|
|
614
|
+
* onLoadMore={(page) => fetchMoreData(page + 1)}
|
|
615
|
+
*/
|
|
616
|
+
onLoadMore?: (currentPage: number) => void;
|
|
617
|
+
/**
|
|
618
|
+
* Whether more data is available to load.
|
|
619
|
+
* When false, onLoadMore won't be triggered.
|
|
620
|
+
*/
|
|
621
|
+
hasMoreData?: boolean;
|
|
622
|
+
/**
|
|
623
|
+
* Whether data is currently being loaded.
|
|
624
|
+
* Shows loading indicator at bottom when true.
|
|
625
|
+
*/
|
|
626
|
+
isLoadingMore?: boolean;
|
|
627
|
+
/**
|
|
628
|
+
* Error object when data fetching fails.
|
|
629
|
+
* Displays error state UI with optional retry action.
|
|
630
|
+
*/
|
|
631
|
+
error?: Error | null;
|
|
632
|
+
/**
|
|
633
|
+
* Callback when user clicks retry in error state.
|
|
634
|
+
* If not provided, retry button is hidden.
|
|
635
|
+
*/
|
|
636
|
+
onRetry?: () => void;
|
|
637
|
+
/**
|
|
638
|
+
* Custom error component to replace default error UI.
|
|
639
|
+
*/
|
|
640
|
+
errorComponent?: React.ReactNode;
|
|
641
|
+
/**
|
|
642
|
+
* Custom empty state when data array is empty AND no filters applied.
|
|
643
|
+
* Use for "no data exists yet" scenarios.
|
|
644
|
+
*/
|
|
645
|
+
emptyState?: React.ReactNode;
|
|
646
|
+
/**
|
|
647
|
+
* Title for default empty state UI.
|
|
648
|
+
* @default "No data"
|
|
649
|
+
*/
|
|
650
|
+
emptyStateTitle?: string;
|
|
651
|
+
/**
|
|
652
|
+
* Description for default empty state UI.
|
|
653
|
+
* @default "No items to display"
|
|
654
|
+
*/
|
|
655
|
+
emptyStateDescription?: string;
|
|
656
|
+
/**
|
|
657
|
+
* Action button for empty state (e.g., "Add first item").
|
|
658
|
+
*/
|
|
659
|
+
emptyStateAction?: {
|
|
660
|
+
label: string;
|
|
661
|
+
onClick: () => void;
|
|
662
|
+
};
|
|
663
|
+
/**
|
|
664
|
+
* Custom state when filters/search return no results.
|
|
665
|
+
* Distinct from emptyState - used when data exists but is filtered out.
|
|
666
|
+
*/
|
|
667
|
+
noResultsState?: React.ReactNode;
|
|
668
|
+
/**
|
|
669
|
+
* Title for default no results UI.
|
|
670
|
+
* @default "No results found"
|
|
671
|
+
*/
|
|
672
|
+
noResultsTitle?: string;
|
|
673
|
+
/**
|
|
674
|
+
* Description for default no results UI.
|
|
675
|
+
* @default "Try adjusting your search or filters"
|
|
676
|
+
*/
|
|
677
|
+
noResultsDescription?: string;
|
|
678
|
+
/**
|
|
679
|
+
* Action for no results state (e.g., "Clear filters").
|
|
680
|
+
*/
|
|
681
|
+
noResultsAction?: {
|
|
682
|
+
label: string;
|
|
683
|
+
onClick: () => void;
|
|
684
|
+
};
|
|
685
|
+
/**
|
|
686
|
+
* Indicates background refetch in progress.
|
|
687
|
+
* Shows subtle indicator instead of full skeleton.
|
|
688
|
+
* Keeps existing data visible during refetch.
|
|
689
|
+
*/
|
|
690
|
+
isRefetching?: boolean;
|
|
691
|
+
/**
|
|
692
|
+
* Enable server-side sorting. When true:
|
|
693
|
+
* - Client-side sorting is disabled
|
|
694
|
+
* - onSortingChange is called when user sorts
|
|
695
|
+
* - Consumer fetches sorted data from server
|
|
696
|
+
*/
|
|
697
|
+
manualSorting?: boolean;
|
|
698
|
+
/**
|
|
699
|
+
* Enable server-side filtering. When true:
|
|
700
|
+
* - Client-side filtering is disabled
|
|
701
|
+
* - Filter change callbacks are called when filters change
|
|
702
|
+
* - Consumer fetches filtered data from server
|
|
703
|
+
*/
|
|
704
|
+
manualFiltering?: boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Enable server-side pagination. When true:
|
|
707
|
+
* - Client-side pagination is disabled
|
|
708
|
+
* - onPaginationChange called when page changes
|
|
709
|
+
* - Requires rowCount prop for total pages
|
|
710
|
+
*/
|
|
711
|
+
manualPagination?: boolean;
|
|
712
|
+
/**
|
|
713
|
+
* Total row count from server (required for server-side pagination).
|
|
714
|
+
* Without this, pagination cannot calculate total pages.
|
|
715
|
+
*/
|
|
716
|
+
rowCount?: number;
|
|
717
|
+
/**
|
|
718
|
+
* Enable server-side expansion. When true:
|
|
719
|
+
* - onLoadChildren is called when a row is expanded
|
|
720
|
+
* - Consumer fetches child data from server
|
|
721
|
+
* - Use with expandingRowsLoading for loading indicators
|
|
722
|
+
*/
|
|
723
|
+
manualExpanding?: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* Callback when a row is expanded and children need to be loaded.
|
|
726
|
+
* Called only for rows that don't already have children loaded.
|
|
727
|
+
*
|
|
728
|
+
* @param row - The TanStack Table row being expanded
|
|
729
|
+
*
|
|
730
|
+
* @example
|
|
731
|
+
* onLoadChildren={async (row) => {
|
|
732
|
+
* const children = await fetchGroupChildren(row.original.id)
|
|
733
|
+
* setData(prev => mergeChildren(prev, row.id, children))
|
|
734
|
+
* }}
|
|
735
|
+
*/
|
|
736
|
+
onLoadChildren?: (row: any) => void | Promise<void>;
|
|
737
|
+
/**
|
|
738
|
+
* Map of row IDs to their loading state.
|
|
739
|
+
* Shows loading indicator while children are being fetched.
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* expandingRowsLoading={{ 'row-1': true, 'row-2': false }}
|
|
743
|
+
*/
|
|
744
|
+
expandingRowsLoading?: Record<string, boolean>;
|
|
745
|
+
/**
|
|
746
|
+
* Loading state for expanded row content (renderSubComponent).
|
|
747
|
+
* Map of row IDs to boolean indicating if sub-component data is loading.
|
|
748
|
+
*
|
|
749
|
+
* @example
|
|
750
|
+
* subComponentLoading={{ 'row-1': true }}
|
|
751
|
+
*/
|
|
752
|
+
subComponentLoading?: Record<string, boolean>;
|
|
753
|
+
/**
|
|
754
|
+
* Callback when a row is expanded and needs sub-component data loaded.
|
|
755
|
+
* Use with renderSubComponent for async detail loading.
|
|
756
|
+
*
|
|
757
|
+
* @param row - The row being expanded
|
|
758
|
+
*
|
|
759
|
+
* @example
|
|
760
|
+
* onSubComponentLoad={async (row) => {
|
|
761
|
+
* const details = await fetchRowDetails(row.original.id)
|
|
762
|
+
* setDetails(prev => ({ ...prev, [row.id]: details }))
|
|
763
|
+
* }}
|
|
764
|
+
*/
|
|
765
|
+
onSubComponentLoad?: (row: any) => void | Promise<void>;
|
|
766
|
+
/**
|
|
767
|
+
* Map of row IDs to error states for child loading failures.
|
|
768
|
+
* When set, shows error message with retry option instead of children.
|
|
769
|
+
*
|
|
770
|
+
* @example
|
|
771
|
+
* expandingRowsError={{ 'row-1': new Error('Failed to load') }}
|
|
772
|
+
*/
|
|
773
|
+
expandingRowsError?: Record<string, Error | null>;
|
|
774
|
+
/**
|
|
775
|
+
* Map of row IDs to error states for sub-component loading failures.
|
|
776
|
+
* When set, shows error message instead of sub-component content.
|
|
777
|
+
*
|
|
778
|
+
* @example
|
|
779
|
+
* subComponentError={{ 'row-1': new Error('Failed to load details') }}
|
|
780
|
+
*/
|
|
781
|
+
subComponentError?: Record<string, Error | null>;
|
|
782
|
+
/**
|
|
783
|
+
* Callback when expansion fails (either children or sub-component loading).
|
|
784
|
+
* Use this to set error state and handle retries.
|
|
785
|
+
*
|
|
786
|
+
* @param row - The row that failed to expand
|
|
787
|
+
* @param error - The error that occurred
|
|
788
|
+
* @param type - Whether it was 'children' or 'subComponent' that failed
|
|
789
|
+
*
|
|
790
|
+
* @example
|
|
791
|
+
* onExpandError={(row, error, type) => {
|
|
792
|
+
* if (type === 'children') {
|
|
793
|
+
* setExpandingRowsError(prev => ({ ...prev, [row.id]: error }))
|
|
794
|
+
* }
|
|
795
|
+
* }}
|
|
796
|
+
*/
|
|
797
|
+
onExpandError?: (row: any, error: Error, type: 'children' | 'subComponent') => void;
|
|
798
|
+
}
|
|
799
|
+
export declare function DataTable<TData, TValue>({ columns, data, searchKey, searchPlaceholder, title, caption, className, stickyHeader, stickyFirstColumn, stickyLeftColumns, stickyRightColumns, enableResponsiveWrapper, showScrollIndicators, minTableWidth, isLoading, loadingBehavior, loadingRowCount, borderStyle, defaultVerticalAlign, enableGlobalSearch, globalSearchPlaceholder, enableAutocomplete, globalSearchColumns, autocompleteMinCharacters, enableGlobalFaceting, enableColumnResizing, columnResizeMode, enableColumnResizePersistence, enablePaginationPersistence, storageKey, enableExpanding, getSubRows, expandingRowColors, nestedRowStyling, enableGrouping, groupedColumnMode, enableManualGrouping, groupDisplayColumn, hideChildrenForSingleItemGroups, hideExpanderForSingleItemGroups, enableRowPinning, keepPinnedRows, enableVirtualization, nestedHeaders, enableNestedHeaders, enableColumnOrdering, enableRowSelection, showHeader, showPagination, paginationVariant, pageSizeOptions, footerLabel, onTableReady, initialState, sorting: controlledSorting, onSortingChange: onControlledSortingChange, columnVisibility: controlledColumnVisibility, onColumnVisibilityChange: onControlledColumnVisibilityChange, grouping: controlledGrouping, onGroupingChange: onControlledGroupingChange, columnOrder: controlledColumnOrder, onColumnOrderChange: onControlledColumnOrderChange, columnSizing: controlledColumnSizing, onColumnSizingChange: onControlledColumnSizingChange, pagination: controlledPagination, onPaginationChange: onControlledPaginationChange, expanded: controlledExpanded, onExpandedChange: onControlledExpandedChange, renderSectionHeaderRow, renderSubComponent, getRowCanExpand, autoExpandChildren, onRowClick, isRowClickable, clickableRowClassName, groupPreservingSearch, activeRowId, activeRowClassName, getRowId, onActiveRowChange, onRowSelectionChange, onNextPageHover, onPreviousPageHover, onRowUpdate, onLoadMore, hasMoreData, isLoadingMore, error, onRetry, errorComponent, emptyState, emptyStateTitle, emptyStateDescription, emptyStateAction, noResultsState, noResultsTitle, noResultsDescription, noResultsAction, isRefetching, manualSorting, manualFiltering, manualPagination, rowCount, manualExpanding, onLoadChildren, expandingRowsLoading, subComponentLoading, onSubComponentLoad, expandingRowsError, subComponentError, onExpandError, }: DataTableProps<TData, TValue>): import("react/jsx-runtime").JSX.Element;
|
|
800
|
+
export { DataTableColumnHeader, DataTableFilter, DataTableToolbar, DataTablePagination, DataTableSkeleton, fuzzyFilter, multiSelectFilter, groupPreservingGlobalFilter };
|
|
801
|
+
export { useReactTable } from '@tanstack/react-table';
|
|
802
|
+
export type { SortingState, ColumnFiltersState, VisibilityState, ExpandedState, GroupingState, ColumnOrderState, FilterFn, ColumnResizeMode, } from '@tanstack/react-table';
|