@true-tech-team/react-components 0.0.4 → 0.0.6

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 (213) hide show
  1. package/index.css +1 -1
  2. package/index.d.ts +10 -0
  3. package/index.js +1 -1
  4. package/index.mjs +15961 -6871
  5. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroup.d.ts +79 -0
  6. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupContext.d.ts +38 -0
  7. package/lib/components/buttons/ButtonToggleGroup/ButtonToggleGroupItem.d.ts +37 -0
  8. package/lib/components/buttons/ButtonToggleGroup/index.d.ts +7 -0
  9. package/lib/components/buttons/ToggleButton/ToggleButton.d.ts +96 -0
  10. package/lib/components/buttons/ToggleButton/index.d.ts +3 -0
  11. package/lib/components/display/Icon/icons/BookmarkFilled.d.ts +3 -0
  12. package/lib/components/display/Icon/icons/ChevronsLeft.d.ts +3 -0
  13. package/lib/components/display/Icon/icons/ChevronsRight.d.ts +3 -0
  14. package/lib/components/display/Icon/icons/HeartFilled.d.ts +3 -0
  15. package/lib/components/display/Icon/icons/More.d.ts +3 -0
  16. package/lib/components/display/Icon/icons/StarFilled.d.ts +3 -0
  17. package/lib/components/display/Icon/icons/ThumbsUpFilled.d.ts +3 -0
  18. package/lib/components/display/Icon/icons/index.d.ts +15 -1
  19. package/lib/components/display/List/List.d.ts +6 -0
  20. package/lib/components/display/List/ListContext.d.ts +15 -0
  21. package/lib/components/display/List/ListEmpty.d.ts +25 -0
  22. package/lib/components/display/List/ListGroup.d.ts +36 -0
  23. package/lib/components/display/List/ListHeader.d.ts +62 -0
  24. package/lib/components/display/List/ListItem.d.ts +19 -0
  25. package/lib/components/display/List/ListSearch.d.ts +32 -0
  26. package/lib/components/display/List/ListSkeleton.d.ts +27 -0
  27. package/lib/components/display/List/hooks/index.d.ts +5 -0
  28. package/lib/components/display/List/hooks/useListExpand.d.ts +6 -0
  29. package/lib/components/display/List/hooks/useListFilter.d.ts +6 -0
  30. package/lib/components/display/List/hooks/useListGroups.d.ts +6 -0
  31. package/lib/components/display/List/hooks/useListKeyboardNav.d.ts +6 -0
  32. package/lib/components/display/List/hooks/useListSelection.d.ts +6 -0
  33. package/lib/components/display/List/index.d.ts +11 -0
  34. package/lib/components/display/List/types.d.ts +485 -0
  35. package/lib/components/display/List/utils.d.ts +47 -0
  36. package/lib/components/display/OverflowText/OverflowText.d.ts +81 -0
  37. package/lib/components/display/OverflowText/index.d.ts +2 -0
  38. package/lib/components/display/ScrollArea/ScrollArea.d.ts +112 -0
  39. package/lib/components/display/ScrollArea/index.d.ts +3 -0
  40. package/lib/components/display/Table/Table.d.ts +6 -0
  41. package/lib/components/display/Table/TableBody.d.ts +4 -0
  42. package/lib/components/display/Table/TableCell.d.ts +12 -0
  43. package/lib/components/display/Table/TableContext.d.ts +10 -0
  44. package/lib/components/display/Table/TableHeader.d.ts +4 -0
  45. package/lib/components/display/Table/TableRow.d.ts +9 -0
  46. package/lib/components/display/Table/TableSearch.d.ts +32 -0
  47. package/lib/components/display/Table/TableSkeleton.d.ts +12 -0
  48. package/lib/components/display/Table/hooks/index.d.ts +10 -0
  49. package/lib/components/display/Table/hooks/useInfiniteScroll.d.ts +11 -0
  50. package/lib/components/display/Table/hooks/useTableExpand.d.ts +10 -0
  51. package/lib/components/display/Table/hooks/useTableFilter.d.ts +22 -0
  52. package/lib/components/display/Table/hooks/useTableSelection.d.ts +16 -0
  53. package/lib/components/display/Table/hooks/useTableSort.d.ts +11 -0
  54. package/lib/components/display/Table/index.d.ts +13 -0
  55. package/lib/components/display/Table/types.d.ts +295 -0
  56. package/lib/components/display/Table/utils.d.ts +37 -0
  57. package/lib/components/display/Tabs/Tab.d.ts +41 -0
  58. package/lib/components/display/Tabs/TabList.d.ts +27 -0
  59. package/lib/components/display/Tabs/TabPanel.d.ts +31 -0
  60. package/lib/components/display/Tabs/Tabs.d.ts +90 -0
  61. package/lib/components/display/Tabs/TabsContext.d.ts +63 -0
  62. package/lib/components/display/Tabs/index.d.ts +11 -0
  63. package/lib/components/display/TruncatedList/TruncatedList.d.ts +69 -0
  64. package/lib/components/display/TruncatedList/index.d.ts +2 -0
  65. package/lib/components/display/index.d.ts +4 -0
  66. package/lib/components/dnd/DndProvider/DndContext.d.ts +91 -0
  67. package/lib/components/dnd/DndProvider/DndProvider.d.ts +37 -0
  68. package/lib/components/dnd/DndProvider/index.d.ts +3 -0
  69. package/lib/components/dnd/DragHandle/DragHandle.d.ts +41 -0
  70. package/lib/components/dnd/DragHandle/index.d.ts +2 -0
  71. package/lib/components/dnd/DragOverlay/DragOverlay.d.ts +39 -0
  72. package/lib/components/dnd/DragOverlay/index.d.ts +2 -0
  73. package/lib/components/dnd/KanbanBoard/KanbanBoard.d.ts +126 -0
  74. package/lib/components/dnd/KanbanBoard/KanbanBoardContext.d.ts +62 -0
  75. package/lib/components/dnd/KanbanBoard/KanbanCard.d.ts +76 -0
  76. package/lib/components/dnd/KanbanBoard/KanbanColumn.d.ts +43 -0
  77. package/lib/components/dnd/KanbanBoard/index.d.ts +5 -0
  78. package/lib/components/dnd/ResizablePanels/ResizablePanel.d.ts +53 -0
  79. package/lib/components/dnd/ResizablePanels/ResizablePanels.d.ts +43 -0
  80. package/lib/components/dnd/ResizablePanels/ResizablePanelsContext.d.ts +64 -0
  81. package/lib/components/dnd/ResizablePanels/ResizeHandle.d.ts +28 -0
  82. package/lib/components/dnd/ResizablePanels/index.d.ts +5 -0
  83. package/lib/components/dnd/SortableGrid/SortableGrid.d.ts +76 -0
  84. package/lib/components/dnd/SortableGrid/SortableGridItem.d.ts +47 -0
  85. package/lib/components/dnd/SortableGrid/index.d.ts +3 -0
  86. package/lib/components/dnd/SortableList/SortableItem.d.ts +76 -0
  87. package/lib/components/dnd/SortableList/SortableList.d.ts +98 -0
  88. package/lib/components/dnd/SortableList/SortableListContext.d.ts +42 -0
  89. package/lib/components/dnd/SortableList/index.d.ts +4 -0
  90. package/lib/components/dnd/hooks/index.d.ts +3 -0
  91. package/lib/components/dnd/hooks/useDraggable.d.ts +66 -0
  92. package/lib/components/dnd/hooks/useDroppable.d.ts +73 -0
  93. package/lib/components/dnd/hooks/useSortable.d.ts +94 -0
  94. package/lib/components/dnd/index.d.ts +8 -0
  95. package/lib/components/filters/FilterContext.d.ts +34 -0
  96. package/lib/components/filters/core/ActiveFilters/ActiveFilters.d.ts +16 -0
  97. package/lib/components/filters/core/ActiveFilters/index.d.ts +2 -0
  98. package/lib/components/filters/core/FilterField/FilterField.d.ts +17 -0
  99. package/lib/components/filters/core/FilterField/index.d.ts +2 -0
  100. package/lib/components/filters/core/FilterProvider/FilterProvider.d.ts +4 -0
  101. package/lib/components/filters/core/FilterProvider/index.d.ts +2 -0
  102. package/lib/components/filters/core/FilterSection/FilterSection.d.ts +16 -0
  103. package/lib/components/filters/core/FilterSection/index.d.ts +2 -0
  104. package/lib/components/filters/core/index.d.ts +7 -0
  105. package/lib/components/filters/fields/CheckboxFilter.d.ts +17 -0
  106. package/lib/components/filters/fields/DateFilter.d.ts +21 -0
  107. package/lib/components/filters/fields/DateRangeFilter.d.ts +19 -0
  108. package/lib/components/filters/fields/ListSelectFilter.d.ts +19 -0
  109. package/lib/components/filters/fields/MultiSelectFilter.d.ts +19 -0
  110. package/lib/components/filters/fields/NumberFilter.d.ts +19 -0
  111. package/lib/components/filters/fields/NumberRangeFilter.d.ts +19 -0
  112. package/lib/components/filters/fields/RatingFilter.d.ts +19 -0
  113. package/lib/components/filters/fields/SelectFilter.d.ts +21 -0
  114. package/lib/components/filters/fields/TextFilter.d.ts +21 -0
  115. package/lib/components/filters/fields/ToggleFilter.d.ts +17 -0
  116. package/lib/components/filters/fields/index.d.ts +25 -0
  117. package/lib/components/filters/hooks/index.d.ts +9 -0
  118. package/lib/components/filters/hooks/useFilter.d.ts +57 -0
  119. package/lib/components/filters/hooks/useFilterDependencies.d.ts +40 -0
  120. package/lib/components/filters/hooks/useFilterOptions.d.ts +70 -0
  121. package/lib/components/filters/index.d.ts +43 -0
  122. package/lib/components/filters/layouts/FilterAccordion/FilterAccordion.d.ts +15 -0
  123. package/lib/components/filters/layouts/FilterAccordion/index.d.ts +2 -0
  124. package/lib/components/filters/layouts/FilterBar/FilterBar.d.ts +18 -0
  125. package/lib/components/filters/layouts/FilterBar/index.d.ts +2 -0
  126. package/lib/components/filters/layouts/FilterModal/FilterModal.d.ts +24 -0
  127. package/lib/components/filters/layouts/FilterModal/index.d.ts +2 -0
  128. package/lib/components/filters/layouts/FilterPopover/FilterPopover.d.ts +19 -0
  129. package/lib/components/filters/layouts/FilterPopover/index.d.ts +2 -0
  130. package/lib/components/filters/layouts/FilterSidebar/FilterSidebar.d.ts +20 -0
  131. package/lib/components/filters/layouts/FilterSidebar/index.d.ts +2 -0
  132. package/lib/components/filters/layouts/index.d.ts +8 -0
  133. package/lib/components/filters/types.d.ts +937 -0
  134. package/lib/components/index.d.ts +52 -0
  135. package/lib/components/inputs/Checkbox/Checkbox.d.ts +2 -2
  136. package/lib/components/inputs/CheckboxGroup/CheckboxGroup.d.ts +122 -0
  137. package/lib/components/inputs/CheckboxGroup/CheckboxGroupContext.d.ts +42 -0
  138. package/lib/components/inputs/CheckboxGroup/CheckboxGroupItem.d.ts +50 -0
  139. package/lib/components/inputs/CheckboxGroup/index.d.ts +7 -0
  140. package/lib/components/inputs/NumberInput/NumberInput.d.ts +3 -1
  141. package/lib/components/layout/AdaptiveGrid/AdaptiveGrid.d.ts +100 -0
  142. package/lib/components/layout/AdaptiveGrid/index.d.ts +2 -0
  143. package/lib/components/layout/MasonryLayout/MasonryLayout.d.ts +74 -0
  144. package/lib/components/layout/MasonryLayout/index.d.ts +2 -0
  145. package/lib/components/layout/Panes/Pane.d.ts +72 -0
  146. package/lib/components/layout/Panes/Panes.d.ts +75 -0
  147. package/lib/components/layout/Panes/PanesContext.d.ts +60 -0
  148. package/lib/components/layout/Panes/index.d.ts +6 -0
  149. package/lib/components/layout/ResponsiveStack/ResponsiveStack.d.ts +99 -0
  150. package/lib/components/layout/ResponsiveStack/index.d.ts +2 -0
  151. package/lib/components/layout/index.d.ts +4 -0
  152. package/lib/components/navigation/BottomNavigation/BottomNavigation.d.ts +53 -0
  153. package/lib/components/navigation/BottomNavigation/BottomNavigationContext.d.ts +27 -0
  154. package/lib/components/navigation/BottomNavigation/BottomNavigationItem.d.ts +59 -0
  155. package/lib/components/navigation/BottomNavigation/index.d.ts +7 -0
  156. package/lib/components/navigation/Breadcrumbs/BreadcrumbItem.d.ts +37 -0
  157. package/lib/components/navigation/Breadcrumbs/BreadcrumbSeparator.d.ts +22 -0
  158. package/lib/components/navigation/Breadcrumbs/Breadcrumbs.d.ts +96 -0
  159. package/lib/components/navigation/Breadcrumbs/index.d.ts +9 -0
  160. package/lib/components/navigation/Breadcrumbs/useBreadcrumbsFromPath.d.ts +73 -0
  161. package/lib/components/navigation/CollapsibleSidebar/CollapsibleSidebar.d.ts +113 -0
  162. package/lib/components/navigation/CollapsibleSidebar/index.d.ts +2 -0
  163. package/lib/components/navigation/NavLink/NavLink.d.ts +74 -0
  164. package/lib/components/navigation/NavLink/index.d.ts +3 -0
  165. package/lib/components/navigation/Navbar/Navbar.d.ts +81 -0
  166. package/lib/components/navigation/Navbar/NavbarActions.d.ts +21 -0
  167. package/lib/components/navigation/Navbar/NavbarBrand.d.ts +29 -0
  168. package/lib/components/navigation/Navbar/NavbarCollapse.d.ts +26 -0
  169. package/lib/components/navigation/Navbar/NavbarContext.d.ts +50 -0
  170. package/lib/components/navigation/Navbar/NavbarNav.d.ts +22 -0
  171. package/lib/components/navigation/Navbar/NavbarToggle.d.ts +21 -0
  172. package/lib/components/navigation/Navbar/index.d.ts +15 -0
  173. package/lib/components/navigation/Pagination/Pagination.d.ts +99 -0
  174. package/lib/components/navigation/Pagination/index.d.ts +3 -0
  175. package/lib/components/navigation/SideNav/SideNav.d.ts +89 -0
  176. package/lib/components/navigation/SideNav/SideNavContext.d.ts +43 -0
  177. package/lib/components/navigation/SideNav/SideNavDivider.d.ts +22 -0
  178. package/lib/components/navigation/SideNav/SideNavGroup.d.ts +44 -0
  179. package/lib/components/navigation/SideNav/SideNavItem.d.ts +71 -0
  180. package/lib/components/navigation/SideNav/index.d.ts +11 -0
  181. package/lib/components/navigation/Stepper/Step.d.ts +57 -0
  182. package/lib/components/navigation/Stepper/Stepper.d.ts +80 -0
  183. package/lib/components/navigation/Stepper/StepperContext.d.ts +58 -0
  184. package/lib/components/navigation/Stepper/index.d.ts +7 -0
  185. package/lib/components/navigation/index.d.ts +16 -0
  186. package/lib/components/overlays/Alert/Alert.d.ts +102 -0
  187. package/lib/components/overlays/Alert/AlertContext.d.ts +94 -0
  188. package/lib/components/overlays/Alert/AlertPresets.d.ts +42 -0
  189. package/lib/components/overlays/Alert/AlertProvider.d.ts +40 -0
  190. package/lib/components/overlays/Alert/index.d.ts +11 -0
  191. package/lib/components/overlays/Dialog/Dialog.d.ts +197 -0
  192. package/lib/components/overlays/Dialog/DialogContext.d.ts +75 -0
  193. package/lib/components/overlays/Dialog/DialogProvider.d.ts +30 -0
  194. package/lib/components/overlays/Dialog/index.d.ts +9 -0
  195. package/lib/components/overlays/Toast/Toast.d.ts +103 -0
  196. package/lib/components/overlays/Toast/ToastContainer.d.ts +37 -0
  197. package/lib/components/overlays/Toast/ToastContext.d.ts +126 -0
  198. package/lib/components/overlays/Toast/ToastProvider.d.ts +71 -0
  199. package/lib/components/overlays/Toast/index.d.ts +11 -0
  200. package/lib/hooks/index.d.ts +10 -0
  201. package/lib/hooks/useAlert/index.d.ts +2 -0
  202. package/lib/hooks/useAlert/useAlert.d.ts +99 -0
  203. package/lib/hooks/useAsyncToast/index.d.ts +2 -0
  204. package/lib/hooks/useAsyncToast/useAsyncToast.d.ts +93 -0
  205. package/lib/hooks/useDialog/index.d.ts +2 -0
  206. package/lib/hooks/useDialog/useDialog.d.ts +58 -0
  207. package/lib/hooks/useResizeObserver/index.d.ts +2 -0
  208. package/lib/hooks/useResizeObserver/useResizeObserver.d.ts +69 -0
  209. package/lib/hooks/useToast/index.d.ts +2 -0
  210. package/lib/hooks/useToast/useToast.d.ts +97 -0
  211. package/lib/providers/GlobalProvider/GlobalProvider.d.ts +16 -1
  212. package/package.json +1 -1
  213. package/README.md +0 -688
@@ -0,0 +1,6 @@
1
+ import { UseListFilterOptions, UseListFilterReturn } from '../types';
2
+ /**
3
+ * Hook for filtering list items with optional debounce
4
+ * Supports controlled/uncontrolled patterns and custom filter functions
5
+ */
6
+ export declare function useListFilter<T extends Record<string, unknown>>({ data, searchQuery: controlledQuery, defaultSearchQuery, onSearchChange, searchFields, searchFn, debounceMs, }: UseListFilterOptions<T>): UseListFilterReturn<T>;
@@ -0,0 +1,6 @@
1
+ import { UseListGroupsOptions, UseListGroupsReturn } from '../types';
2
+ /**
3
+ * Hook for grouping list items with collapsible support
4
+ * Supports controlled/uncontrolled patterns for collapsed state
5
+ */
6
+ export declare function useListGroups<T extends Record<string, unknown>>({ data, groupBy, collapsedGroups: controlledCollapsed, defaultCollapsedGroups, onCollapsedGroupsChange, }: UseListGroupsOptions<T>): UseListGroupsReturn<T>;
@@ -0,0 +1,6 @@
1
+ import { UseListKeyboardNavOptions, UseListKeyboardNavReturn } from '../types';
2
+ /**
3
+ * Hook for keyboard navigation in lists
4
+ * Supports vertical, horizontal, and grid navigation patterns
5
+ */
6
+ export declare function useListKeyboardNav({ itemCount, onItemAction, onEscape, loop, orientation, columns, disabled, }: UseListKeyboardNavOptions): UseListKeyboardNavReturn;
@@ -0,0 +1,6 @@
1
+ import { UseListSelectionOptions, UseListSelectionReturn } from '../types';
2
+ /**
3
+ * Hook for managing list item selection
4
+ * Supports single and multiple selection modes with controlled/uncontrolled patterns
5
+ */
6
+ export declare function useListSelection({ selectionMode, selectedKeys: controlledKeys, defaultSelectedKeys, onSelectionChange, allItemKeys, }: UseListSelectionOptions): UseListSelectionReturn;
@@ -0,0 +1,11 @@
1
+ export { List, default } from './List';
2
+ export { ListItem } from './ListItem';
3
+ export { ListHeader } from './ListHeader';
4
+ export { ListGroup } from './ListGroup';
5
+ export { ListSearch } from './ListSearch';
6
+ export { ListSkeleton } from './ListSkeleton';
7
+ export { ListEmpty } from './ListEmpty';
8
+ export { ListContext, useListContext, useListContextStrict } from './ListContext';
9
+ export { useListSelection, useListExpand, useListFilter, useListKeyboardNav, useListGroups, } from './hooks';
10
+ export type { ListProps, ListItemRenderContext, ListContextValue, SelectionMode, SelectionState, BulkAction, ItemAction, ListInfiniteScrollConfig, ListSkeletonConfig, ResponsiveColumns, UseListSelectionOptions, UseListSelectionReturn, UseListExpandOptions, UseListExpandReturn, UseListFilterOptions, UseListFilterReturn, UseListKeyboardNavOptions, UseListKeyboardNavReturn, UseListGroupsOptions, UseListGroupsReturn, ListGroup as ListGroupType, } from './types';
11
+ export { getNestedValue, formatValue, generateItemKey, searchItems, groupItems, sortItems, } from './utils';
@@ -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,81 @@
1
+ import { default as React } from 'react';
2
+ import { PopoverPosition } from '../../../utils/positioning';
3
+ import { BaseComponentProps } from '../../../types';
4
+ /**
5
+ * Props for the OverflowText component
6
+ */
7
+ export interface OverflowTextProps extends Omit<BaseComponentProps, 'children'> {
8
+ /**
9
+ * Text content to display
10
+ */
11
+ children: string;
12
+ /**
13
+ * Maximum number of lines before truncation
14
+ * @default 1
15
+ */
16
+ lines?: number;
17
+ /**
18
+ * Position of the tooltip
19
+ * @default 'top'
20
+ */
21
+ tooltipPosition?: PopoverPosition;
22
+ /**
23
+ * Delay before showing tooltip (ms)
24
+ * @default 200
25
+ */
26
+ tooltipDelay?: number;
27
+ /**
28
+ * Whether to disable the tooltip (always truncate, never show full text)
29
+ * @default false
30
+ */
31
+ disableTooltip?: boolean;
32
+ /**
33
+ * Custom tooltip content (defaults to full text)
34
+ */
35
+ tooltipContent?: React.ReactNode;
36
+ /**
37
+ * Maximum width of the tooltip
38
+ * @default 300
39
+ */
40
+ tooltipMaxWidth?: number;
41
+ /**
42
+ * HTML element to render
43
+ * @default 'span'
44
+ */
45
+ as?: 'span' | 'p' | 'div';
46
+ /**
47
+ * Callback when text overflow state changes
48
+ * @param isOverflowing - Whether text is currently overflowing
49
+ */
50
+ onOverflowChange?: (isOverflowing: boolean) => void;
51
+ }
52
+ /**
53
+ * OverflowText - Text that truncates with ellipsis and shows full content in tooltip
54
+ *
55
+ * @example
56
+ * Single line truncation:
57
+ * ```tsx
58
+ * <OverflowText>
59
+ * This is a very long text that will be truncated with ellipsis
60
+ * </OverflowText>
61
+ * ```
62
+ *
63
+ * @example
64
+ * Multi-line truncation:
65
+ * ```tsx
66
+ * <OverflowText lines={2}>
67
+ * This is a very long text that spans multiple lines and will be
68
+ * truncated after the second line with an ellipsis.
69
+ * </OverflowText>
70
+ * ```
71
+ *
72
+ * @example
73
+ * With custom tooltip position:
74
+ * ```tsx
75
+ * <OverflowText tooltipPosition="bottom" tooltipDelay={500}>
76
+ * Hover to see the full text in a tooltip at the bottom
77
+ * </OverflowText>
78
+ * ```
79
+ */
80
+ export declare const OverflowText: React.ForwardRefExoticComponent<OverflowTextProps & React.RefAttributes<HTMLElement>>;
81
+ export default OverflowText;
@@ -0,0 +1,2 @@
1
+ export { OverflowText } from './OverflowText';
2
+ export type { OverflowTextProps } from './OverflowText';