@true-tech-team/react-components 0.0.5 → 0.0.7

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 (111) hide show
  1. package/index.css +1 -1
  2. package/index.js +1 -1
  3. package/index.mjs +14032 -8735
  4. package/lib/components/display/List/List.d.ts +6 -0
  5. package/lib/components/display/List/ListContext.d.ts +15 -0
  6. package/lib/components/display/List/ListEmpty.d.ts +25 -0
  7. package/lib/components/display/List/ListGroup.d.ts +36 -0
  8. package/lib/components/display/List/ListHeader.d.ts +62 -0
  9. package/lib/components/display/List/ListItem.d.ts +19 -0
  10. package/lib/components/display/List/ListSearch.d.ts +32 -0
  11. package/lib/components/display/List/ListSkeleton.d.ts +27 -0
  12. package/lib/components/display/List/hooks/index.d.ts +5 -0
  13. package/lib/components/display/List/hooks/useListExpand.d.ts +6 -0
  14. package/lib/components/display/List/hooks/useListFilter.d.ts +6 -0
  15. package/lib/components/display/List/hooks/useListGroups.d.ts +6 -0
  16. package/lib/components/display/List/hooks/useListKeyboardNav.d.ts +6 -0
  17. package/lib/components/display/List/hooks/useListSelection.d.ts +6 -0
  18. package/lib/components/display/List/index.d.ts +11 -0
  19. package/lib/components/display/List/types.d.ts +485 -0
  20. package/lib/components/display/List/utils.d.ts +47 -0
  21. package/lib/components/display/Table/Table.d.ts +6 -0
  22. package/lib/components/display/Table/TableBody.d.ts +4 -0
  23. package/lib/components/display/Table/TableCell.d.ts +12 -0
  24. package/lib/components/display/Table/TableContext.d.ts +10 -0
  25. package/lib/components/display/Table/TableHeader.d.ts +4 -0
  26. package/lib/components/display/Table/TableRow.d.ts +9 -0
  27. package/lib/components/display/Table/TableSearch.d.ts +32 -0
  28. package/lib/components/display/Table/TableSkeleton.d.ts +12 -0
  29. package/lib/components/display/Table/hooks/index.d.ts +10 -0
  30. package/lib/components/display/Table/hooks/useInfiniteScroll.d.ts +11 -0
  31. package/lib/components/display/Table/hooks/useTableExpand.d.ts +10 -0
  32. package/lib/components/display/Table/hooks/useTableFilter.d.ts +22 -0
  33. package/lib/components/display/Table/hooks/useTableSelection.d.ts +16 -0
  34. package/lib/components/display/Table/hooks/useTableSort.d.ts +11 -0
  35. package/lib/components/display/Table/index.d.ts +13 -0
  36. package/lib/components/display/Table/types.d.ts +295 -0
  37. package/lib/components/display/Table/utils.d.ts +37 -0
  38. package/lib/components/display/index.d.ts +1 -0
  39. package/lib/components/dnd/DndProvider/DndContext.d.ts +91 -0
  40. package/lib/components/dnd/DndProvider/DndProvider.d.ts +37 -0
  41. package/lib/components/dnd/DndProvider/index.d.ts +3 -0
  42. package/lib/components/dnd/DragHandle/DragHandle.d.ts +41 -0
  43. package/lib/components/dnd/DragHandle/index.d.ts +2 -0
  44. package/lib/components/dnd/DragOverlay/DragOverlay.d.ts +39 -0
  45. package/lib/components/dnd/DragOverlay/index.d.ts +2 -0
  46. package/lib/components/dnd/KanbanBoard/KanbanBoard.d.ts +126 -0
  47. package/lib/components/dnd/KanbanBoard/KanbanBoardContext.d.ts +62 -0
  48. package/lib/components/dnd/KanbanBoard/KanbanCard.d.ts +76 -0
  49. package/lib/components/dnd/KanbanBoard/KanbanColumn.d.ts +43 -0
  50. package/lib/components/dnd/KanbanBoard/index.d.ts +5 -0
  51. package/lib/components/dnd/ResizablePanels/ResizablePanel.d.ts +53 -0
  52. package/lib/components/dnd/ResizablePanels/ResizablePanels.d.ts +43 -0
  53. package/lib/components/dnd/ResizablePanels/ResizablePanelsContext.d.ts +64 -0
  54. package/lib/components/dnd/ResizablePanels/ResizeHandle.d.ts +28 -0
  55. package/lib/components/dnd/ResizablePanels/index.d.ts +5 -0
  56. package/lib/components/dnd/SortableGrid/SortableGrid.d.ts +76 -0
  57. package/lib/components/dnd/SortableGrid/SortableGridItem.d.ts +47 -0
  58. package/lib/components/dnd/SortableGrid/index.d.ts +3 -0
  59. package/lib/components/dnd/SortableList/SortableItem.d.ts +76 -0
  60. package/lib/components/dnd/SortableList/SortableList.d.ts +98 -0
  61. package/lib/components/dnd/SortableList/SortableListContext.d.ts +42 -0
  62. package/lib/components/dnd/SortableList/index.d.ts +4 -0
  63. package/lib/components/dnd/hooks/index.d.ts +3 -0
  64. package/lib/components/dnd/hooks/useDraggable.d.ts +66 -0
  65. package/lib/components/dnd/hooks/useDroppable.d.ts +73 -0
  66. package/lib/components/dnd/hooks/useSortable.d.ts +94 -0
  67. package/lib/components/dnd/index.d.ts +8 -0
  68. package/lib/components/filters/FilterContext.d.ts +34 -0
  69. package/lib/components/filters/core/ActiveFilters/ActiveFilters.d.ts +16 -0
  70. package/lib/components/filters/core/ActiveFilters/index.d.ts +2 -0
  71. package/lib/components/filters/core/FilterField/FilterField.d.ts +17 -0
  72. package/lib/components/filters/core/FilterField/index.d.ts +2 -0
  73. package/lib/components/filters/core/FilterProvider/FilterProvider.d.ts +4 -0
  74. package/lib/components/filters/core/FilterProvider/index.d.ts +2 -0
  75. package/lib/components/filters/core/FilterSection/FilterSection.d.ts +16 -0
  76. package/lib/components/filters/core/FilterSection/index.d.ts +2 -0
  77. package/lib/components/filters/core/index.d.ts +7 -0
  78. package/lib/components/filters/fields/CheckboxFilter.d.ts +17 -0
  79. package/lib/components/filters/fields/DateFilter.d.ts +21 -0
  80. package/lib/components/filters/fields/DateRangeFilter.d.ts +19 -0
  81. package/lib/components/filters/fields/ListSelectFilter.d.ts +19 -0
  82. package/lib/components/filters/fields/MultiSelectFilter.d.ts +19 -0
  83. package/lib/components/filters/fields/NumberFilter.d.ts +19 -0
  84. package/lib/components/filters/fields/NumberRangeFilter.d.ts +19 -0
  85. package/lib/components/filters/fields/RatingFilter.d.ts +19 -0
  86. package/lib/components/filters/fields/SelectFilter.d.ts +21 -0
  87. package/lib/components/filters/fields/TextFilter.d.ts +21 -0
  88. package/lib/components/filters/fields/ToggleFilter.d.ts +17 -0
  89. package/lib/components/filters/fields/index.d.ts +25 -0
  90. package/lib/components/filters/hooks/index.d.ts +9 -0
  91. package/lib/components/filters/hooks/useFilter.d.ts +57 -0
  92. package/lib/components/filters/hooks/useFilterDependencies.d.ts +40 -0
  93. package/lib/components/filters/hooks/useFilterOptions.d.ts +70 -0
  94. package/lib/components/filters/index.d.ts +43 -0
  95. package/lib/components/filters/layouts/FilterAccordion/FilterAccordion.d.ts +15 -0
  96. package/lib/components/filters/layouts/FilterAccordion/index.d.ts +2 -0
  97. package/lib/components/filters/layouts/FilterBar/FilterBar.d.ts +18 -0
  98. package/lib/components/filters/layouts/FilterBar/index.d.ts +2 -0
  99. package/lib/components/filters/layouts/FilterModal/FilterModal.d.ts +24 -0
  100. package/lib/components/filters/layouts/FilterModal/index.d.ts +2 -0
  101. package/lib/components/filters/layouts/FilterPopover/FilterPopover.d.ts +19 -0
  102. package/lib/components/filters/layouts/FilterPopover/index.d.ts +2 -0
  103. package/lib/components/filters/layouts/FilterSidebar/FilterSidebar.d.ts +20 -0
  104. package/lib/components/filters/layouts/FilterSidebar/index.d.ts +2 -0
  105. package/lib/components/filters/layouts/index.d.ts +8 -0
  106. package/lib/components/filters/types.d.ts +937 -0
  107. package/lib/components/index.d.ts +8 -0
  108. package/lib/components/inputs/Checkbox/Checkbox.d.ts +2 -2
  109. package/lib/components/inputs/NumberInput/NumberInput.d.ts +3 -1
  110. package/package.json +1 -2
  111. package/README.md +0 -826
@@ -0,0 +1,485 @@
1
+ import { ReactNode, MouseEvent, KeyboardEvent } from 'react';
2
+ import { BaseComponentProps, ComponentSize } from '../../../types';
3
+ export type SelectionMode = 'none' | 'single' | 'multiple';
4
+ export interface SelectionState {
5
+ selectedKeys: Set<string>;
6
+ isAllSelected: boolean;
7
+ isIndeterminate: boolean;
8
+ }
9
+ export interface ListInfiniteScrollConfig {
10
+ /**
11
+ * Callback to load more data
12
+ */
13
+ onLoadMore: () => void;
14
+ /**
15
+ * Whether there is more data to load
16
+ */
17
+ hasMore: boolean;
18
+ /**
19
+ * Whether currently loading more data
20
+ * @default false
21
+ */
22
+ loading?: boolean;
23
+ /**
24
+ * Intersection observer threshold (0-1)
25
+ * @default 0.1
26
+ */
27
+ threshold?: number;
28
+ /**
29
+ * Root margin for intersection observer
30
+ * @default '100px'
31
+ */
32
+ rootMargin?: string;
33
+ }
34
+ export interface BulkAction<T = Record<string, unknown>> {
35
+ /**
36
+ * Unique identifier for the action
37
+ */
38
+ id: string;
39
+ /**
40
+ * Label displayed in the action button/menu
41
+ */
42
+ label: ReactNode;
43
+ /**
44
+ * Icon to display (optional)
45
+ */
46
+ icon?: ReactNode;
47
+ /**
48
+ * Action handler - receives selected items
49
+ */
50
+ onAction: (selectedItems: T[], selectedKeys: string[]) => void;
51
+ /**
52
+ * Whether action is disabled
53
+ */
54
+ disabled?: boolean | ((selectedItems: T[]) => boolean);
55
+ /**
56
+ * Variant for styling (affects button appearance)
57
+ * @default 'default'
58
+ */
59
+ variant?: 'default' | 'danger' | 'primary';
60
+ }
61
+ export interface ItemAction<T = Record<string, unknown>> {
62
+ /**
63
+ * Unique identifier for the action
64
+ */
65
+ id: string;
66
+ /**
67
+ * Label displayed in the action menu
68
+ */
69
+ label: ReactNode;
70
+ /**
71
+ * Icon to display (optional)
72
+ */
73
+ icon?: ReactNode;
74
+ /**
75
+ * Action handler - receives the item and its index
76
+ */
77
+ onAction: (item: T, index: number) => void;
78
+ /**
79
+ * Whether action is disabled
80
+ */
81
+ disabled?: boolean | ((item: T) => boolean);
82
+ /**
83
+ * Variant for styling
84
+ * @default 'default'
85
+ */
86
+ variant?: 'default' | 'danger';
87
+ /**
88
+ * Show divider before this action
89
+ * @default false
90
+ */
91
+ divider?: boolean;
92
+ }
93
+ export interface ListSkeletonConfig {
94
+ /**
95
+ * Enable skeleton loading state
96
+ * @default false
97
+ */
98
+ enabled?: boolean;
99
+ /**
100
+ * Number of skeleton rows to display
101
+ * @default 5
102
+ */
103
+ rows?: number;
104
+ }
105
+ export interface ListItemRenderContext {
106
+ /**
107
+ * Whether item is currently selected
108
+ */
109
+ isSelected: boolean;
110
+ /**
111
+ * Whether item is disabled
112
+ */
113
+ isDisabled: boolean;
114
+ /**
115
+ * Whether item has keyboard focus
116
+ */
117
+ isFocused: boolean;
118
+ /**
119
+ * Whether item is expanded
120
+ */
121
+ isExpanded: boolean;
122
+ /**
123
+ * Toggle selection for this item
124
+ */
125
+ toggleSelection: () => void;
126
+ /**
127
+ * Toggle expansion for this item
128
+ */
129
+ toggleExpand: () => void;
130
+ /**
131
+ * The item's unique key
132
+ */
133
+ itemKey: string;
134
+ }
135
+ export interface ResponsiveColumns {
136
+ sm?: number;
137
+ md?: number;
138
+ lg?: number;
139
+ xl?: number;
140
+ }
141
+ export interface ListProps<T extends Record<string, unknown> = Record<string, unknown>> extends Omit<BaseComponentProps, 'children'> {
142
+ /**
143
+ * Array of items to display
144
+ */
145
+ data: T[];
146
+ /**
147
+ * Unique key for each item. Can be a key from the item object or a function.
148
+ * @default 'id'
149
+ */
150
+ itemKey?: keyof T | ((item: T, index: number) => string);
151
+ /**
152
+ * Function to determine if an item is disabled
153
+ */
154
+ isItemDisabled?: (item: T, index: number) => boolean;
155
+ /**
156
+ * Custom render function for each item.
157
+ * If not provided, uses default rendering based on primaryTextField/secondaryTextField.
158
+ */
159
+ renderItem?: (item: T, index: number, context: ListItemRenderContext) => ReactNode;
160
+ /**
161
+ * Key from item to use as primary text (for default rendering)
162
+ */
163
+ primaryTextField?: keyof T;
164
+ /**
165
+ * Key from item to use as secondary text (for default rendering)
166
+ */
167
+ secondaryTextField?: keyof T;
168
+ /**
169
+ * Key from item to use for avatar/icon (for default rendering)
170
+ */
171
+ avatarField?: keyof T;
172
+ /**
173
+ * List size variant
174
+ * @default 'md'
175
+ */
176
+ size?: ComponentSize;
177
+ /**
178
+ * Visual variant
179
+ * @default 'default'
180
+ */
181
+ variant?: 'default' | 'bordered' | 'card' | 'flush';
182
+ /**
183
+ * Spacing between items
184
+ * @default 'md'
185
+ */
186
+ spacing?: 'none' | 'sm' | 'md' | 'lg';
187
+ /**
188
+ * Selection mode
189
+ * @default 'none'
190
+ */
191
+ selectionMode?: SelectionMode;
192
+ /**
193
+ * Selected item keys (controlled)
194
+ */
195
+ selectedKeys?: string[];
196
+ /**
197
+ * Default selected keys (uncontrolled)
198
+ */
199
+ defaultSelectedKeys?: string[];
200
+ /**
201
+ * Callback when selection changes
202
+ */
203
+ onSelectionChange?: (selectedKeys: string[]) => void;
204
+ /**
205
+ * Whether to show selection controls (checkbox/radio)
206
+ * @default true when selectionMode !== 'none'
207
+ */
208
+ showSelectionControls?: boolean;
209
+ /**
210
+ * Position of selection controls
211
+ * @default 'start'
212
+ */
213
+ selectionControlPosition?: 'start' | 'end';
214
+ /**
215
+ * Bulk actions configuration.
216
+ * Only shown when selectionMode is 'multiple' and items are selected.
217
+ */
218
+ bulkActions?: Array<BulkAction<T>>;
219
+ /**
220
+ * Position of bulk actions bar
221
+ * @default 'top'
222
+ */
223
+ bulkActionsPosition?: 'top' | 'bottom' | 'sticky-top' | 'sticky-bottom';
224
+ /**
225
+ * Custom render for bulk actions bar
226
+ */
227
+ renderBulkActions?: (selectedItems: T[], selectedKeys: string[], actions: Array<BulkAction<T>>) => ReactNode;
228
+ /**
229
+ * Actions available per item (shown in dropdown menu)
230
+ */
231
+ itemActions?: Array<ItemAction<T>>;
232
+ /**
233
+ * Position of item action button
234
+ * @default 'end'
235
+ */
236
+ itemActionsPosition?: 'start' | 'end';
237
+ /**
238
+ * When to show item actions
239
+ * @default 'hover'
240
+ */
241
+ itemActionsTrigger?: 'hover' | 'always';
242
+ /**
243
+ * Group items by a field or custom function
244
+ */
245
+ groupBy?: keyof T | ((item: T) => string);
246
+ /**
247
+ * Custom group header renderer
248
+ */
249
+ renderGroupHeader?: (groupKey: string, itemCount: number, isCollapsed: boolean) => ReactNode;
250
+ /**
251
+ * Whether groups are collapsible
252
+ * @default false
253
+ */
254
+ collapsibleGroups?: boolean;
255
+ /**
256
+ * Default collapsed group keys (uncontrolled)
257
+ */
258
+ defaultCollapsedGroups?: string[];
259
+ /**
260
+ * Collapsed group keys (controlled)
261
+ */
262
+ collapsedGroups?: string[];
263
+ /**
264
+ * Callback when group collapse state changes
265
+ */
266
+ onCollapsedGroupsChange?: (collapsedGroups: string[]) => void;
267
+ /**
268
+ * Render function for expanded item content
269
+ */
270
+ renderExpandedContent?: (item: T, index: number) => ReactNode;
271
+ /**
272
+ * Expanded item keys (controlled)
273
+ */
274
+ expandedKeys?: string[];
275
+ /**
276
+ * Default expanded item keys (uncontrolled)
277
+ */
278
+ defaultExpandedKeys?: string[];
279
+ /**
280
+ * Callback when expansion changes
281
+ */
282
+ onExpandChange?: (expandedKeys: string[]) => void;
283
+ /**
284
+ * How to trigger expansion
285
+ * @default 'icon'
286
+ */
287
+ expandTrigger?: 'click' | 'icon';
288
+ /**
289
+ * Enable built-in search
290
+ * @default false
291
+ */
292
+ searchable?: boolean;
293
+ /**
294
+ * Search placeholder text
295
+ * @default 'Search...'
296
+ */
297
+ searchPlaceholder?: string;
298
+ /**
299
+ * Fields to search (for default search behavior)
300
+ */
301
+ searchFields?: Array<keyof T>;
302
+ /**
303
+ * Custom search function
304
+ */
305
+ searchFn?: (item: T, query: string) => boolean;
306
+ /**
307
+ * Search query (controlled)
308
+ */
309
+ searchQuery?: string;
310
+ /**
311
+ * Callback when search changes
312
+ */
313
+ onSearchChange?: (query: string) => void;
314
+ /**
315
+ * Debounce delay for search in milliseconds
316
+ * @default 300
317
+ */
318
+ searchDebounce?: number;
319
+ /**
320
+ * Infinite scroll configuration
321
+ */
322
+ infiniteScroll?: ListInfiniteScrollConfig;
323
+ /**
324
+ * Callback when item is clicked
325
+ */
326
+ onItemClick?: (item: T, index: number, event: MouseEvent) => void;
327
+ /**
328
+ * Callback when item receives keyboard action (Enter/Space)
329
+ */
330
+ onItemAction?: (item: T, index: number, event: KeyboardEvent) => void;
331
+ /**
332
+ * Enable keyboard navigation
333
+ * @default true
334
+ */
335
+ keyboardNavigation?: boolean;
336
+ /**
337
+ * Loading state
338
+ * @default false
339
+ */
340
+ loading?: boolean;
341
+ /**
342
+ * Custom loading content
343
+ */
344
+ loadingContent?: ReactNode;
345
+ /**
346
+ * Skeleton configuration
347
+ */
348
+ skeleton?: ListSkeletonConfig;
349
+ /**
350
+ * Empty state content
351
+ * @default 'No items to display'
352
+ */
353
+ emptyContent?: ReactNode;
354
+ /**
355
+ * Custom empty state render
356
+ */
357
+ renderEmpty?: () => ReactNode;
358
+ /**
359
+ * Maximum height (enables scrolling)
360
+ */
361
+ maxHeight?: string | number;
362
+ /**
363
+ * Number of columns for responsive grid layout
364
+ * @default 1
365
+ */
366
+ columns?: number | ResponsiveColumns;
367
+ /**
368
+ * ARIA role for the list
369
+ * @default 'list' or 'listbox' when selectable
370
+ */
371
+ role?: 'list' | 'listbox' | 'menu' | 'grid';
372
+ /**
373
+ * ID of element that labels this list
374
+ */
375
+ 'aria-labelledby'?: string;
376
+ }
377
+ export interface ListContextValue<T = Record<string, unknown>> {
378
+ data: T[];
379
+ filteredData: T[];
380
+ getItemKey: (item: T, index: number) => string;
381
+ isItemDisabled: (item: T, index: number) => boolean;
382
+ size: ComponentSize;
383
+ variant: 'default' | 'bordered' | 'card' | 'flush';
384
+ spacing: 'none' | 'sm' | 'md' | 'lg';
385
+ selectionMode: SelectionMode;
386
+ selectedKeys: Set<string>;
387
+ onSelectItem: (key: string, selected: boolean) => void;
388
+ onSelectAll: (selected: boolean) => void;
389
+ isAllSelected: boolean;
390
+ isIndeterminate: boolean;
391
+ showSelectionControls: boolean;
392
+ selectionControlPosition: 'start' | 'end';
393
+ expandedKeys: Set<string>;
394
+ onExpandItem: (key: string) => void;
395
+ renderExpandedContent?: (item: T, index: number) => ReactNode;
396
+ expandTrigger: 'click' | 'icon';
397
+ itemActions?: Array<ItemAction<T>>;
398
+ itemActionsPosition: 'start' | 'end';
399
+ itemActionsTrigger: 'hover' | 'always';
400
+ focusedIndex: number;
401
+ setFocusedIndex: (index: number) => void;
402
+ onItemClick?: (item: T, index: number, event: MouseEvent) => void;
403
+ onItemAction?: (item: T, index: number, event: KeyboardEvent) => void;
404
+ renderItem?: (item: T, index: number, context: ListItemRenderContext) => ReactNode;
405
+ primaryTextField?: keyof T;
406
+ secondaryTextField?: keyof T;
407
+ avatarField?: keyof T;
408
+ groupBy?: keyof T | ((item: T) => string);
409
+ collapsedGroups: Set<string>;
410
+ onToggleGroup: (groupKey: string) => void;
411
+ collapsibleGroups: boolean;
412
+ renderGroupHeader?: (groupKey: string, itemCount: number, isCollapsed: boolean) => ReactNode;
413
+ listId: string;
414
+ }
415
+ export interface UseListSelectionOptions {
416
+ selectionMode: SelectionMode;
417
+ selectedKeys?: string[];
418
+ defaultSelectedKeys?: string[];
419
+ onSelectionChange?: (keys: string[]) => void;
420
+ allItemKeys: string[];
421
+ }
422
+ export interface UseListSelectionReturn {
423
+ selectedKeys: Set<string>;
424
+ onSelectItem: (key: string, selected: boolean) => void;
425
+ onSelectAll: (selected: boolean) => void;
426
+ isAllSelected: boolean;
427
+ isIndeterminate: boolean;
428
+ }
429
+ export interface UseListExpandOptions {
430
+ expandedKeys?: string[];
431
+ defaultExpandedKeys?: string[];
432
+ onExpandChange?: (keys: string[]) => void;
433
+ }
434
+ export interface UseListExpandReturn {
435
+ expandedKeys: Set<string>;
436
+ onExpandItem: (key: string) => void;
437
+ isExpanded: (key: string) => boolean;
438
+ }
439
+ export interface UseListFilterOptions<T> {
440
+ data: T[];
441
+ searchQuery?: string;
442
+ defaultSearchQuery?: string;
443
+ onSearchChange?: (query: string) => void;
444
+ searchFields?: Array<keyof T>;
445
+ searchFn?: (item: T, query: string) => boolean;
446
+ debounceMs?: number;
447
+ }
448
+ export interface UseListFilterReturn<T> {
449
+ filteredData: T[];
450
+ searchQuery: string;
451
+ setSearchQuery: (query: string) => void;
452
+ isFiltering: boolean;
453
+ }
454
+ export interface UseListKeyboardNavOptions {
455
+ itemCount: number;
456
+ onItemAction?: (index: number) => void;
457
+ onEscape?: () => void;
458
+ loop?: boolean;
459
+ orientation?: 'vertical' | 'horizontal' | 'grid';
460
+ columns?: number;
461
+ disabled?: boolean;
462
+ }
463
+ export interface UseListKeyboardNavReturn {
464
+ focusedIndex: number;
465
+ setFocusedIndex: (index: number) => void;
466
+ handleKeyDown: (event: KeyboardEvent) => void;
467
+ getItemTabIndex: (index: number) => 0 | -1;
468
+ }
469
+ export interface UseListGroupsOptions<T> {
470
+ data: T[];
471
+ groupBy?: keyof T | ((item: T) => string);
472
+ collapsedGroups?: string[];
473
+ defaultCollapsedGroups?: string[];
474
+ onCollapsedGroupsChange?: (collapsedGroups: string[]) => void;
475
+ }
476
+ export interface ListGroup<T> {
477
+ key: string;
478
+ items: T[];
479
+ }
480
+ export interface UseListGroupsReturn<T> {
481
+ groups: Array<ListGroup<T>>;
482
+ collapsedGroups: Set<string>;
483
+ onToggleGroup: (groupKey: string) => void;
484
+ isGroupCollapsed: (groupKey: string) => boolean;
485
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Utility functions for the List component
3
+ */
4
+ /**
5
+ * Get a nested property value from an object using dot notation
6
+ * @param obj - The object to get the value from
7
+ * @param path - The path to the property (e.g., 'user.name')
8
+ * @returns The value at the path, or undefined if not found
9
+ */
10
+ export declare function getNestedValue<T>(obj: T, path: string): unknown;
11
+ /**
12
+ * Format a value for display
13
+ * @param value - The value to format
14
+ * @returns A string representation of the value
15
+ */
16
+ export declare function formatValue(value: unknown): string;
17
+ /**
18
+ * Generate a stable key from an item
19
+ * @param item - The item to generate a key for
20
+ * @param index - The index of the item
21
+ * @param keyField - Optional field to use as the key
22
+ * @returns A stable key string
23
+ */
24
+ export declare function generateItemKey<T extends Record<string, unknown>>(item: T, index: number, keyField?: keyof T): string;
25
+ /**
26
+ * Search items using a simple text match
27
+ * @param items - The items to search
28
+ * @param query - The search query
29
+ * @param fields - Fields to search in
30
+ * @returns Filtered items
31
+ */
32
+ export declare function searchItems<T extends Record<string, unknown>>(items: T[], query: string, fields?: Array<keyof T>): T[];
33
+ /**
34
+ * Group items by a key or function
35
+ * @param items - The items to group
36
+ * @param groupBy - The field or function to group by
37
+ * @returns Map of group key to items
38
+ */
39
+ export declare function groupItems<T extends Record<string, unknown>>(items: T[], groupBy: keyof T | ((item: T) => string)): Map<string, T[]>;
40
+ /**
41
+ * Sort items by a key
42
+ * @param items - The items to sort
43
+ * @param sortKey - The key to sort by
44
+ * @param direction - Sort direction ('asc' or 'desc')
45
+ * @returns Sorted items
46
+ */
47
+ export declare function sortItems<T extends Record<string, unknown>>(items: T[], sortKey: keyof T, direction?: 'asc' | 'desc'): T[];
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { TableProps } from './types';
3
+ export declare const Table: <T extends Record<string, unknown> = Record<string, unknown>>(props: TableProps<T> & {
4
+ ref?: React.ForwardedRef<HTMLDivElement>;
5
+ }) => React.ReactElement;
6
+ export default Table;
@@ -0,0 +1,4 @@
1
+ export declare function TableBody(): import("react/jsx-runtime").JSX.Element;
2
+ export declare namespace TableBody {
3
+ var displayName: string;
4
+ }
@@ -0,0 +1,12 @@
1
+ import { ColumnConfig } from './types';
2
+ interface TableCellProps<T = Record<string, unknown>> {
3
+ column: ColumnConfig<T>;
4
+ row: T;
5
+ rowIndex: number;
6
+ isFirstColumn: boolean;
7
+ }
8
+ export declare function TableCell<T extends Record<string, unknown>>({ column, row, rowIndex, isFirstColumn, }: TableCellProps<T>): import("react/jsx-runtime").JSX.Element;
9
+ export declare namespace TableCell {
10
+ var displayName: string;
11
+ }
12
+ export {};
@@ -0,0 +1,10 @@
1
+ import { TableContextValue } from './types';
2
+ export declare const TableContext: import('react').Context<TableContextValue<Record<string, unknown>> | null>;
3
+ /**
4
+ * Hook to optionally access Table context
5
+ */
6
+ export declare function useTableContext<T = Record<string, unknown>>(): TableContextValue<T> | null;
7
+ /**
8
+ * Hook that throws if not within Table
9
+ */
10
+ export declare function useTableContextStrict<T = Record<string, unknown>>(): TableContextValue<T>;
@@ -0,0 +1,4 @@
1
+ export declare function TableHeader(): import("react/jsx-runtime").JSX.Element;
2
+ export declare namespace TableHeader {
3
+ var displayName: string;
4
+ }
@@ -0,0 +1,9 @@
1
+ interface TableRowProps<T = Record<string, unknown>> {
2
+ row: T;
3
+ rowIndex: number;
4
+ }
5
+ export declare function TableRow<T extends Record<string, unknown>>({ row, rowIndex, }: TableRowProps<T>): import("react/jsx-runtime").JSX.Element;
6
+ export declare namespace TableRow {
7
+ var displayName: string;
8
+ }
9
+ export {};
@@ -0,0 +1,32 @@
1
+ export interface TableSearchProps {
2
+ /**
3
+ * Current search query
4
+ */
5
+ value: string;
6
+ /**
7
+ * Callback when search query changes
8
+ */
9
+ onChange: (value: string) => void;
10
+ /**
11
+ * Placeholder text
12
+ * @default 'Search...'
13
+ */
14
+ placeholder?: string;
15
+ /**
16
+ * Whether the search is currently filtering (debounce active)
17
+ */
18
+ isFiltering?: boolean;
19
+ /**
20
+ * Auto focus the input on mount
21
+ */
22
+ autoFocus?: boolean;
23
+ /**
24
+ * Callback when input is cleared
25
+ */
26
+ onClear?: () => void;
27
+ }
28
+ export declare function TableSearch({ value, onChange, placeholder, isFiltering, autoFocus, onClear, }: TableSearchProps): import("react/jsx-runtime").JSX.Element;
29
+ export declare namespace TableSearch {
30
+ var displayName: string;
31
+ }
32
+ export default TableSearch;
@@ -0,0 +1,12 @@
1
+ import { ColumnConfig } from './types';
2
+ interface TableSkeletonProps {
3
+ rows: number;
4
+ columns: Array<ColumnConfig<any>>;
5
+ hasExpandColumn?: boolean;
6
+ hasSelectionColumn?: boolean;
7
+ }
8
+ export declare function TableSkeleton({ rows, columns, hasExpandColumn, hasSelectionColumn, }: TableSkeletonProps): import("react/jsx-runtime").JSX.Element;
9
+ export declare namespace TableSkeleton {
10
+ var displayName: string;
11
+ }
12
+ export {};
@@ -0,0 +1,10 @@
1
+ export { useTableSelection } from './useTableSelection';
2
+ export type { UseTableSelectionOptions, UseTableSelectionReturn } from './useTableSelection';
3
+ export { useTableSort } from './useTableSort';
4
+ export type { UseTableSortOptions, UseTableSortReturn } from './useTableSort';
5
+ export { useTableExpand } from './useTableExpand';
6
+ export type { UseTableExpandOptions, UseTableExpandReturn } from './useTableExpand';
7
+ export { useInfiniteScroll } from './useInfiniteScroll';
8
+ export type { UseInfiniteScrollOptions, UseInfiniteScrollReturn } from './useInfiniteScroll';
9
+ export { useTableFilter } from './useTableFilter';
10
+ export type { UseTableFilterOptions, UseTableFilterReturn } from './useTableFilter';
@@ -0,0 +1,11 @@
1
+ export interface UseInfiniteScrollOptions {
2
+ onLoadMore: () => void;
3
+ hasMore: boolean;
4
+ loading?: boolean;
5
+ threshold?: number;
6
+ rootMargin?: string;
7
+ }
8
+ export interface UseInfiniteScrollReturn {
9
+ sentinelRef: React.RefObject<HTMLDivElement>;
10
+ }
11
+ export declare function useInfiniteScroll({ onLoadMore, hasMore, loading, threshold, rootMargin, }: UseInfiniteScrollOptions): UseInfiniteScrollReturn;
@@ -0,0 +1,10 @@
1
+ export interface UseTableExpandOptions {
2
+ expandedKeys?: string[];
3
+ defaultExpandedKeys?: string[];
4
+ onExpandChange?: (keys: string[]) => void;
5
+ }
6
+ export interface UseTableExpandReturn {
7
+ expandedKeys: Set<string>;
8
+ onExpand: (key: string, expanded: boolean) => void;
9
+ }
10
+ export declare function useTableExpand({ expandedKeys: controlledKeys, defaultExpandedKeys, onExpandChange, }: UseTableExpandOptions): UseTableExpandReturn;
@@ -0,0 +1,22 @@
1
+ import { ColumnConfig } from '../types';
2
+ export interface UseTableFilterOptions<T> {
3
+ data: T[];
4
+ columns: Array<ColumnConfig<T>>;
5
+ searchQuery?: string;
6
+ defaultSearchQuery?: string;
7
+ onSearchChange?: (query: string) => void;
8
+ searchFields?: Array<keyof T>;
9
+ searchFn?: (item: T, query: string) => boolean;
10
+ debounceMs?: number;
11
+ }
12
+ export interface UseTableFilterReturn<T> {
13
+ filteredData: T[];
14
+ searchQuery: string;
15
+ setSearchQuery: (query: string) => void;
16
+ isFiltering: boolean;
17
+ }
18
+ /**
19
+ * Hook for filtering table data with optional debounce
20
+ * Supports controlled/uncontrolled patterns and custom filter functions
21
+ */
22
+ export declare function useTableFilter<T extends Record<string, unknown>>({ data, columns, searchQuery: controlledQuery, defaultSearchQuery, onSearchChange, searchFields, searchFn, debounceMs, }: UseTableFilterOptions<T>): UseTableFilterReturn<T>;