better-table 1.1.0 → 1.3.0
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 +187 -18
- package/dist/better-table.cjs.js +1 -1
- package/dist/better-table.cjs.js.map +1 -1
- package/dist/better-table.css +1 -1
- package/dist/better-table.es.js +2225 -980
- package/dist/better-table.es.js.map +1 -1
- package/dist/components/BetterTable/__tests__/helpers/test-data.d.ts +125 -0
- package/dist/components/BetterTable/components/TableActionOverflow.d.ts +16 -0
- package/dist/components/BetterTable/components/TableColumnVisibility.d.ts +4 -0
- package/dist/components/BetterTable/components/TableExpandedRow.d.ts +8 -0
- package/dist/components/BetterTable/components/TableFilterPanel.d.ts +7 -0
- package/dist/components/BetterTable/components/TableFloatingFilter.d.ts +8 -0
- package/dist/components/BetterTable/components/TableRow.d.ts +2 -1
- package/dist/components/BetterTable/components/TableVirtualBody.d.ts +10 -0
- package/dist/components/BetterTable/components/index.d.ts +6 -0
- package/dist/components/BetterTable/constants.d.ts +20 -0
- package/dist/components/BetterTable/context/TableContext.d.ts +15 -65
- package/dist/components/BetterTable/context/TableDataContext.d.ts +18 -0
- package/dist/components/BetterTable/context/TableFilterContext.d.ts +17 -0
- package/dist/components/BetterTable/context/TablePaginationContext.d.ts +19 -0
- package/dist/components/BetterTable/context/TableSelectionContext.d.ts +15 -0
- package/dist/components/BetterTable/context/TableSortContext.d.ts +10 -0
- package/dist/components/BetterTable/context/TableUIContext.d.ts +33 -0
- package/dist/components/BetterTable/context/index.d.ts +14 -2
- package/dist/components/BetterTable/hooks/index.d.ts +6 -0
- package/dist/components/BetterTable/hooks/useColumnResize.d.ts +23 -0
- package/dist/components/BetterTable/hooks/useColumnVisibility.d.ts +24 -0
- package/dist/components/BetterTable/hooks/useExpandableRows.d.ts +19 -0
- package/dist/components/BetterTable/hooks/useFocusTrap.d.ts +6 -0
- package/dist/components/BetterTable/hooks/useMediaQuery.d.ts +8 -0
- package/dist/components/BetterTable/hooks/useTableFilter.d.ts +5 -3
- package/dist/components/BetterTable/hooks/useTablePagination.d.ts +3 -1
- package/dist/components/BetterTable/hooks/useTableSearch.d.ts +3 -1
- package/dist/components/BetterTable/hooks/useTableSort.d.ts +14 -2
- package/dist/components/BetterTable/hooks/useVirtualization.d.ts +25 -0
- package/dist/components/BetterTable/index.d.ts +5 -4
- package/dist/components/BetterTable/types.d.ts +178 -5
- package/dist/components/BetterTable/utils/sortData.d.ts +8 -1
- package/dist/index.d.ts +6 -5
- package/package.json +24 -15
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { Column } from '../../types';
|
|
2
|
+
export interface User {
|
|
3
|
+
[key: string]: unknown;
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
email: string;
|
|
7
|
+
age?: number;
|
|
8
|
+
isActive?: boolean;
|
|
9
|
+
role?: string;
|
|
10
|
+
department?: {
|
|
11
|
+
name: string;
|
|
12
|
+
floor: number;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const mockUsers: User[];
|
|
16
|
+
export declare const fewUsers: User[];
|
|
17
|
+
export declare const manyUsers: User[];
|
|
18
|
+
export declare const userColumns: Column<User>[];
|
|
19
|
+
/**
|
|
20
|
+
* Helper para obtener el elemento de la tabla tradicional (no cards)
|
|
21
|
+
* Útil porque ahora ambos (tabla y cards) renderizan los datos
|
|
22
|
+
*/
|
|
23
|
+
export declare const getTable: (container: HTMLElement) => HTMLElement;
|
|
24
|
+
/**
|
|
25
|
+
* Helper para buscar dentro de la tabla tradicional
|
|
26
|
+
*/
|
|
27
|
+
export declare const withinTable: (container: HTMLElement) => {
|
|
28
|
+
getByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByText<T>>;
|
|
29
|
+
getAllByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByText<T>>;
|
|
30
|
+
queryByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByText<T>>;
|
|
31
|
+
queryAllByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByText<T>>;
|
|
32
|
+
findByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByText<T>>;
|
|
33
|
+
findAllByLabelText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByText<T>>;
|
|
34
|
+
getByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByBoundAttribute<T>>;
|
|
35
|
+
getAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
36
|
+
queryByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByBoundAttribute<T>>;
|
|
37
|
+
queryAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
38
|
+
findByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByBoundAttribute<T>>;
|
|
39
|
+
findAllByPlaceholderText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByBoundAttribute<T>>;
|
|
40
|
+
getByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByText<T>>;
|
|
41
|
+
getAllByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByText<T>>;
|
|
42
|
+
queryByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByText<T>>;
|
|
43
|
+
queryAllByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByText<T>>;
|
|
44
|
+
findByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByText<T>>;
|
|
45
|
+
findAllByText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByText<T>>;
|
|
46
|
+
getByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByBoundAttribute<T>>;
|
|
47
|
+
getAllByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
48
|
+
queryByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByBoundAttribute<T>>;
|
|
49
|
+
queryAllByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
50
|
+
findByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByBoundAttribute<T>>;
|
|
51
|
+
findAllByAltText<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByBoundAttribute<T>>;
|
|
52
|
+
getByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByBoundAttribute<T>>;
|
|
53
|
+
getAllByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
54
|
+
queryByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByBoundAttribute<T>>;
|
|
55
|
+
queryAllByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
56
|
+
findByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByBoundAttribute<T>>;
|
|
57
|
+
findAllByTitle<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByBoundAttribute<T>>;
|
|
58
|
+
getByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByBoundAttribute<T>>;
|
|
59
|
+
getAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
60
|
+
queryByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByBoundAttribute<T>>;
|
|
61
|
+
queryAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
62
|
+
findByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByBoundAttribute<T>>;
|
|
63
|
+
findAllByDisplayValue<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByBoundAttribute<T>>;
|
|
64
|
+
getByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined): ReturnType<import('@testing-library/react').GetByRole<T>>;
|
|
65
|
+
getAllByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined): ReturnType<import('@testing-library/react').AllByRole<T>>;
|
|
66
|
+
queryByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined): ReturnType<import('@testing-library/react').QueryByRole<T>>;
|
|
67
|
+
queryAllByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined): ReturnType<import('@testing-library/react').AllByRole<T>>;
|
|
68
|
+
findByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByRole<T>>;
|
|
69
|
+
findAllByRole<T extends HTMLElement = HTMLElement>(role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByRole<T>>;
|
|
70
|
+
getByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').GetByBoundAttribute<T>>;
|
|
71
|
+
getAllByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
72
|
+
queryByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').QueryByBoundAttribute<T>>;
|
|
73
|
+
queryAllByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined): ReturnType<import('@testing-library/react').AllByBoundAttribute<T>>;
|
|
74
|
+
findByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindByBoundAttribute<T>>;
|
|
75
|
+
findAllByTestId<T extends HTMLElement = HTMLElement>(id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined): ReturnType<import('@testing-library/react').FindAllByBoundAttribute<T>>;
|
|
76
|
+
} & {
|
|
77
|
+
getByLabelText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement;
|
|
78
|
+
getAllByLabelText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
79
|
+
queryByLabelText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
80
|
+
queryAllByLabelText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
81
|
+
findByLabelText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
82
|
+
findAllByLabelText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
83
|
+
getByPlaceholderText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement;
|
|
84
|
+
getAllByPlaceholderText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
85
|
+
queryByPlaceholderText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement | null;
|
|
86
|
+
queryAllByPlaceholderText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
87
|
+
findByPlaceholderText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
88
|
+
findAllByPlaceholderText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
89
|
+
getByText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement;
|
|
90
|
+
getAllByText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
91
|
+
queryByText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
92
|
+
queryAllByText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
93
|
+
findByText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
94
|
+
findAllByText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').SelectorMatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
95
|
+
getByAltText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement;
|
|
96
|
+
getAllByAltText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
97
|
+
queryByAltText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement | null;
|
|
98
|
+
queryAllByAltText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
99
|
+
findByAltText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
100
|
+
findAllByAltText: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
101
|
+
getByTitle: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement;
|
|
102
|
+
getAllByTitle: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
103
|
+
queryByTitle: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement | null;
|
|
104
|
+
queryAllByTitle: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
105
|
+
findByTitle: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
106
|
+
findAllByTitle: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
107
|
+
getByDisplayValue: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement;
|
|
108
|
+
getAllByDisplayValue: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
109
|
+
queryByDisplayValue: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement | null;
|
|
110
|
+
queryAllByDisplayValue: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
111
|
+
findByDisplayValue: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
112
|
+
findAllByDisplayValue: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
113
|
+
getByRole: (role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined) => HTMLElement;
|
|
114
|
+
getAllByRole: (role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined) => HTMLElement[];
|
|
115
|
+
queryByRole: (role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined) => HTMLElement | null;
|
|
116
|
+
queryAllByRole: (role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined) => HTMLElement[];
|
|
117
|
+
findByRole: (role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
118
|
+
findAllByRole: (role: import('@testing-library/react').ByRoleMatcher, options?: import('@testing-library/react').ByRoleOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
119
|
+
getByTestId: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement;
|
|
120
|
+
getAllByTestId: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
121
|
+
queryByTestId: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement | null;
|
|
122
|
+
queryAllByTestId: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined) => HTMLElement[];
|
|
123
|
+
findByTestId: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement>;
|
|
124
|
+
findAllByTestId: (id: import('@testing-library/react').Matcher, options?: import('@testing-library/react').MatcherOptions | undefined, waitForElementOptions?: import('@testing-library/react').waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
125
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TableData, RowAction } from '../types';
|
|
2
|
+
interface TableActionOverflowProps<T extends TableData> {
|
|
3
|
+
/** Actions to show in the dropdown */
|
|
4
|
+
actions: RowAction<T>[];
|
|
5
|
+
/** Row data */
|
|
6
|
+
row: T;
|
|
7
|
+
/** Row index */
|
|
8
|
+
rowIndex: number;
|
|
9
|
+
/** Handler for action clicks */
|
|
10
|
+
onActionClick: (action: RowAction<T>) => void;
|
|
11
|
+
/** Direction the menu opens */
|
|
12
|
+
direction?: 'up' | 'down';
|
|
13
|
+
}
|
|
14
|
+
declare function TableActionOverflowInner<T extends TableData>({ actions, row, rowIndex: _rowIndex, onActionClick, direction, }: TableActionOverflowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const TableActionOverflow: typeof TableActionOverflowInner;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TableData } from '../types';
|
|
2
|
+
interface TableExpandedRowProps<T extends TableData> {
|
|
3
|
+
row: T;
|
|
4
|
+
rowIndex: number;
|
|
5
|
+
}
|
|
6
|
+
declare function TableExpandedRowInner<T extends TableData>({ row, rowIndex }: TableExpandedRowProps<T>): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const TableExpandedRow: typeof TableExpandedRowInner;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TableData } from '../types';
|
|
2
|
+
interface TableFilterPanelProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
}
|
|
5
|
+
declare function TableFilterPanelInner<T extends TableData>({ open, }: TableFilterPanelProps): import("react/jsx-runtime").JSX.Element | null;
|
|
6
|
+
export declare const TableFilterPanel: typeof TableFilterPanelInner;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TableData } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Floating filter row rendered inside <thead> — one input per filterable column.
|
|
4
|
+
* Reads and writes to the same filterValues state as the FilterPanel.
|
|
5
|
+
*/
|
|
6
|
+
declare function TableFloatingFilterInner<T extends TableData>(): import("react/jsx-runtime").JSX.Element | null;
|
|
7
|
+
export declare const TableFloatingFilter: typeof TableFloatingFilterInner;
|
|
8
|
+
export {};
|
|
@@ -2,7 +2,8 @@ import { TableData } from '../types';
|
|
|
2
2
|
interface TableRowProps<T extends TableData> {
|
|
3
3
|
row: T;
|
|
4
4
|
rowIndex: number;
|
|
5
|
+
rowKey: string;
|
|
5
6
|
}
|
|
6
|
-
declare function TableRowInner<T extends TableData>({ row, rowIndex }: TableRowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function TableRowInner<T extends TableData>({ row, rowIndex, rowKey }: TableRowProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
export declare const TableRow: typeof TableRowInner;
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TableData } from '../types';
|
|
2
|
+
interface TableVirtualBodyProps {
|
|
3
|
+
startIndex: number;
|
|
4
|
+
endIndex: number;
|
|
5
|
+
totalHeight: number;
|
|
6
|
+
offsetTop: number;
|
|
7
|
+
}
|
|
8
|
+
declare function TableVirtualBodyInner<T extends TableData>({ startIndex, endIndex, totalHeight, offsetTop, }: TableVirtualBodyProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare const TableVirtualBody: typeof TableVirtualBodyInner;
|
|
10
|
+
export {};
|
|
@@ -6,9 +6,15 @@ export { TableCell } from './TableCell';
|
|
|
6
6
|
export { TableCard } from './TableCard';
|
|
7
7
|
export { TableCards } from './TableCards';
|
|
8
8
|
export { TableActions } from './TableActions';
|
|
9
|
+
export { TableActionOverflow } from './TableActionOverflow';
|
|
10
|
+
export { TableFilterPanel } from './TableFilterPanel';
|
|
11
|
+
export { TableFloatingFilter } from './TableFloatingFilter';
|
|
12
|
+
export { TableColumnVisibility } from './TableColumnVisibility';
|
|
9
13
|
export { TablePagination } from './TablePagination';
|
|
10
14
|
export { TableToolbar } from './TableToolbar';
|
|
11
15
|
export { TableEmpty } from './TableEmpty';
|
|
12
16
|
export { TableLoading, TableLoadingOverlay } from './TableLoading';
|
|
13
17
|
export { TableModal } from './TableModal';
|
|
18
|
+
export { TableVirtualBody } from './TableVirtualBody';
|
|
19
|
+
export { TableExpandedRow } from './TableExpandedRow';
|
|
14
20
|
export { BetterTable, default } from './Table';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Virtualization constants
|
|
3
|
+
*
|
|
4
|
+
* VIRTUALIZATION_THRESHOLD: Minimum number of rows to auto-enable virtualization
|
|
5
|
+
* when pagination is disabled. Below this threshold, all rows render normally.
|
|
6
|
+
* Above it, only visible rows + buffer are rendered for performance.
|
|
7
|
+
*
|
|
8
|
+
* To change this value, update it here — it's the single source of truth.
|
|
9
|
+
*/
|
|
10
|
+
export declare const VIRTUALIZATION_THRESHOLD = 500;
|
|
11
|
+
/**
|
|
12
|
+
* Default fixed row height in pixels for virtualized rendering.
|
|
13
|
+
* Assumes uniform row height (variable height is not supported yet).
|
|
14
|
+
*/
|
|
15
|
+
export declare const DEFAULT_ROW_HEIGHT = 48;
|
|
16
|
+
/**
|
|
17
|
+
* Number of extra rows rendered above and below the visible viewport
|
|
18
|
+
* to prevent flicker during fast scrolling.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_VIRTUAL_BUFFER = 5;
|
|
@@ -1,68 +1,18 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { TableData
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
handleSearch: (value: string) => void;
|
|
17
|
-
clearSearch: () => void;
|
|
18
|
-
searchable: boolean;
|
|
19
|
-
selectedRows: T[];
|
|
20
|
-
isSelected: (row: T, index: number) => boolean;
|
|
21
|
-
toggleRow: (row: T, index: number) => void;
|
|
22
|
-
selectAll: () => void;
|
|
23
|
-
deselectAll: () => void;
|
|
24
|
-
isAllSelected: boolean;
|
|
25
|
-
isPartiallySelected: boolean;
|
|
26
|
-
selectedCount: number;
|
|
27
|
-
selectable: boolean;
|
|
28
|
-
selectionMode: 'single' | 'multiple';
|
|
29
|
-
page: number;
|
|
30
|
-
pageSize: number;
|
|
31
|
-
totalPages: number;
|
|
32
|
-
totalItems: number;
|
|
33
|
-
goToPage: (page: number) => void;
|
|
34
|
-
nextPage: () => void;
|
|
35
|
-
prevPage: () => void;
|
|
36
|
-
changePageSize: (size: number) => void;
|
|
37
|
-
hasNextPage: boolean;
|
|
38
|
-
hasPrevPage: boolean;
|
|
39
|
-
startIndex: number;
|
|
40
|
-
endIndex: number;
|
|
41
|
-
paginationEnabled: boolean;
|
|
42
|
-
pageSizeOptions: number[];
|
|
43
|
-
showSizeChanger: boolean;
|
|
44
|
-
loading: boolean;
|
|
45
|
-
loadingComponent?: ReactNode;
|
|
46
|
-
emptyComponent?: ReactNode;
|
|
47
|
-
locale: TableLocale;
|
|
48
|
-
classNames: TableClassNames;
|
|
49
|
-
size: 'small' | 'medium' | 'large';
|
|
50
|
-
bordered: boolean;
|
|
51
|
-
striped: boolean;
|
|
52
|
-
hoverable: boolean;
|
|
53
|
-
stickyHeader: boolean;
|
|
54
|
-
onRowClick?: (row: T, rowIndex: number) => void;
|
|
55
|
-
onRowDoubleClick?: (row: T, rowIndex: number) => void;
|
|
56
|
-
openModal: (content: ReactNode) => void;
|
|
57
|
-
closeModal: () => void;
|
|
58
|
-
modalContent: ReactNode | null;
|
|
59
|
-
isModalOpen: boolean;
|
|
60
|
-
}
|
|
61
|
-
export declare function useTableContext<T extends TableData>(): TableContextValue<T>;
|
|
62
|
-
interface TableProviderProps<T extends TableData> {
|
|
63
|
-
value: TableContextValue<T>;
|
|
2
|
+
import { TableData } from '../types';
|
|
3
|
+
import { TableDataContextValue } from './TableDataContext';
|
|
4
|
+
import { TableSortContextValue } from './TableSortContext';
|
|
5
|
+
import { TableFilterContextValue } from './TableFilterContext';
|
|
6
|
+
import { TableSelectionContextValue } from './TableSelectionContext';
|
|
7
|
+
import { TablePaginationContextValue } from './TablePaginationContext';
|
|
8
|
+
import { TableUIContextValue } from './TableUIContext';
|
|
9
|
+
export interface TableProviderProps<T extends TableData = TableData> {
|
|
10
|
+
data: TableDataContextValue<T>;
|
|
11
|
+
sort: TableSortContextValue;
|
|
12
|
+
filter: TableFilterContextValue;
|
|
13
|
+
selection: TableSelectionContextValue<T>;
|
|
14
|
+
pagination: TablePaginationContextValue;
|
|
15
|
+
ui: TableUIContextValue<T>;
|
|
64
16
|
children: ReactNode;
|
|
65
17
|
}
|
|
66
|
-
export declare function TableProvider<T extends TableData>({
|
|
67
|
-
export declare const defaultTableContext: Partial<TableContextValue>;
|
|
68
|
-
export {};
|
|
18
|
+
export declare function TableProvider<T extends TableData>({ data, sort, filter, selection, pagination, ui, children, }: TableProviderProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TableData, Column, RowAction, GlobalAction } from '../types';
|
|
3
|
+
export interface TableDataContextValue<T extends TableData = TableData> {
|
|
4
|
+
data: T[];
|
|
5
|
+
processedData: T[];
|
|
6
|
+
columns: Column<T>[];
|
|
7
|
+
visibleColumns: Column<T>[];
|
|
8
|
+
rowKey: keyof T | ((row: T, index: number) => string);
|
|
9
|
+
rowActions?: RowAction<T>[];
|
|
10
|
+
globalActions?: GlobalAction<T>[];
|
|
11
|
+
maxVisibleActions: number;
|
|
12
|
+
expandableRender?: (row: T, rowIndex: number) => ReactNode;
|
|
13
|
+
isExpanded: (rowKey: string) => boolean;
|
|
14
|
+
toggleExpand: (rowKey: string) => void;
|
|
15
|
+
expandableEnabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function useTableData<T extends TableData>(): TableDataContextValue<T>;
|
|
18
|
+
export declare const TableDataProvider: import('react').Provider<TableDataContextValue<TableData> | null>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FilterState, DateFilterRange } from '../types';
|
|
2
|
+
export interface TableFilterContextValue {
|
|
3
|
+
filters: FilterState;
|
|
4
|
+
setFilter: (columnId: string, value: string | number | boolean | DateFilterRange | null) => void;
|
|
5
|
+
clearFilter: (columnId: string) => void;
|
|
6
|
+
clearFilters: () => void;
|
|
7
|
+
searchValue: string;
|
|
8
|
+
handleSearch: (value: string) => void;
|
|
9
|
+
clearSearch: () => void;
|
|
10
|
+
searchable: boolean;
|
|
11
|
+
filterPanelOpen: boolean;
|
|
12
|
+
toggleFilterPanel: () => void;
|
|
13
|
+
hasFilterableColumns: boolean;
|
|
14
|
+
filterMode: 'floating' | 'panel' | 'both';
|
|
15
|
+
}
|
|
16
|
+
export declare function useTableFilterContext(): TableFilterContextValue;
|
|
17
|
+
export declare const TableFilterProvider: import('react').Provider<TableFilterContextValue | null>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface TablePaginationContextValue {
|
|
2
|
+
page: number;
|
|
3
|
+
pageSize: number;
|
|
4
|
+
totalPages: number;
|
|
5
|
+
totalItems: number;
|
|
6
|
+
goToPage: (page: number) => void;
|
|
7
|
+
nextPage: () => void;
|
|
8
|
+
prevPage: () => void;
|
|
9
|
+
changePageSize: (size: number) => void;
|
|
10
|
+
hasNextPage: boolean;
|
|
11
|
+
hasPrevPage: boolean;
|
|
12
|
+
startIndex: number;
|
|
13
|
+
endIndex: number;
|
|
14
|
+
paginationEnabled: boolean;
|
|
15
|
+
pageSizeOptions: number[];
|
|
16
|
+
showSizeChanger: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function useTablePaginationContext(): TablePaginationContextValue;
|
|
19
|
+
export declare const TablePaginationProvider: import('react').Provider<TablePaginationContextValue | null>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TableData } from '../types';
|
|
2
|
+
export interface TableSelectionContextValue<T extends TableData = TableData> {
|
|
3
|
+
selectedRows: T[];
|
|
4
|
+
isSelected: (row: T, index: number) => boolean;
|
|
5
|
+
toggleRow: (row: T, index: number) => void;
|
|
6
|
+
selectAll: () => void;
|
|
7
|
+
deselectAll: () => void;
|
|
8
|
+
isAllSelected: boolean;
|
|
9
|
+
isPartiallySelected: boolean;
|
|
10
|
+
selectedCount: number;
|
|
11
|
+
selectable: boolean;
|
|
12
|
+
selectionMode: 'single' | 'multiple';
|
|
13
|
+
}
|
|
14
|
+
export declare function useTableSelectionContext<T extends TableData>(): TableSelectionContextValue<T>;
|
|
15
|
+
export declare const TableSelectionProvider: import('react').Provider<TableSelectionContextValue<TableData> | null>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SortState, MultiSortState } from '../types';
|
|
2
|
+
export interface TableSortContextValue {
|
|
3
|
+
sortState: SortState;
|
|
4
|
+
handleSort: (columnId: string) => void;
|
|
5
|
+
multiSortState: MultiSortState;
|
|
6
|
+
isMultiSort: boolean;
|
|
7
|
+
clearSort: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useTableSortContext(): TableSortContextValue;
|
|
10
|
+
export declare const TableSortProvider: import('react').Provider<TableSortContextValue | null>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TableData, TableLocale, TableClassNames, Column } from '../types';
|
|
3
|
+
export interface TableUIContextValue<T extends TableData = TableData> {
|
|
4
|
+
locale: TableLocale;
|
|
5
|
+
classNames: TableClassNames;
|
|
6
|
+
size: 'small' | 'medium' | 'large';
|
|
7
|
+
bordered: boolean;
|
|
8
|
+
striped: boolean;
|
|
9
|
+
hoverable: boolean;
|
|
10
|
+
stickyHeader: boolean;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
loadingComponent?: ReactNode;
|
|
13
|
+
emptyComponent?: ReactNode;
|
|
14
|
+
onRowClick?: (row: T, rowIndex: number) => void;
|
|
15
|
+
onRowDoubleClick?: (row: T, rowIndex: number) => void;
|
|
16
|
+
openModal: (content: ReactNode) => void;
|
|
17
|
+
closeModal: () => void;
|
|
18
|
+
modalContent: ReactNode | null;
|
|
19
|
+
isModalOpen: boolean;
|
|
20
|
+
columnVisibilityEnabled: boolean;
|
|
21
|
+
hiddenColumnIds: Set<string>;
|
|
22
|
+
toggleColumn: (columnId: string) => void;
|
|
23
|
+
showAllColumns: () => void;
|
|
24
|
+
isColumnVisible: (columnId: string) => boolean;
|
|
25
|
+
columns: Column<T>[];
|
|
26
|
+
resizable: boolean;
|
|
27
|
+
columnWidths: Record<string, number>;
|
|
28
|
+
isResizing: boolean;
|
|
29
|
+
startResize: (columnId: string, startX: number) => void;
|
|
30
|
+
getColumnWidth: (columnId: string) => number | undefined;
|
|
31
|
+
}
|
|
32
|
+
export declare function useTableUI<T extends TableData>(): TableUIContextValue<T>;
|
|
33
|
+
export declare const TableUIProvider: import('react').Provider<TableUIContextValue<TableData> | null>;
|
|
@@ -1,2 +1,14 @@
|
|
|
1
|
-
export { TableProvider
|
|
2
|
-
export type {
|
|
1
|
+
export { TableProvider } from './TableContext';
|
|
2
|
+
export type { TableProviderProps } from './TableContext';
|
|
3
|
+
export { useTableData } from './TableDataContext';
|
|
4
|
+
export type { TableDataContextValue } from './TableDataContext';
|
|
5
|
+
export { useTableSortContext } from './TableSortContext';
|
|
6
|
+
export type { TableSortContextValue } from './TableSortContext';
|
|
7
|
+
export { useTableFilterContext } from './TableFilterContext';
|
|
8
|
+
export type { TableFilterContextValue } from './TableFilterContext';
|
|
9
|
+
export { useTableSelectionContext } from './TableSelectionContext';
|
|
10
|
+
export type { TableSelectionContextValue } from './TableSelectionContext';
|
|
11
|
+
export { useTablePaginationContext } from './TablePaginationContext';
|
|
12
|
+
export type { TablePaginationContextValue } from './TablePaginationContext';
|
|
13
|
+
export { useTableUI } from './TableUIContext';
|
|
14
|
+
export type { TableUIContextValue } from './TableUIContext';
|
|
@@ -3,3 +3,9 @@ export { useTableFilter } from './useTableFilter';
|
|
|
3
3
|
export { useTablePagination } from './useTablePagination';
|
|
4
4
|
export { useTableSelection } from './useTableSelection';
|
|
5
5
|
export { useTableSearch } from './useTableSearch';
|
|
6
|
+
export { useColumnVisibility } from './useColumnVisibility';
|
|
7
|
+
export { useColumnResize } from './useColumnResize';
|
|
8
|
+
export { useMediaQuery } from './useMediaQuery';
|
|
9
|
+
export { useFocusTrap } from './useFocusTrap';
|
|
10
|
+
export { useVirtualization } from './useVirtualization';
|
|
11
|
+
export { useExpandableRows } from './useExpandableRows';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Column, TableData } from '../types';
|
|
2
|
+
interface UseColumnResizeOptions<T extends TableData> {
|
|
3
|
+
columns: Column<T>[];
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
minWidth?: number;
|
|
6
|
+
maxWidth?: number;
|
|
7
|
+
onColumnResize?: (columnId: string, width: number) => void;
|
|
8
|
+
tableRef: React.RefObject<HTMLTableElement | null>;
|
|
9
|
+
}
|
|
10
|
+
interface UseColumnResizeReturn {
|
|
11
|
+
/** Current column widths (only populated for resized columns) */
|
|
12
|
+
columnWidths: Record<string, number>;
|
|
13
|
+
/** Whether a resize is currently in progress */
|
|
14
|
+
isResizing: boolean;
|
|
15
|
+
/** Start resizing a column */
|
|
16
|
+
startResize: (columnId: string, startX: number) => void;
|
|
17
|
+
/** Get effective width for a column (resized width or initial width) */
|
|
18
|
+
getColumnWidth: (columnId: string) => number | undefined;
|
|
19
|
+
/** Reset all column widths to initial */
|
|
20
|
+
resetColumnWidths: () => void;
|
|
21
|
+
}
|
|
22
|
+
export declare function useColumnResize<T extends TableData>({ columns, enabled, minWidth, maxWidth, onColumnResize, tableRef, }: UseColumnResizeOptions<T>): UseColumnResizeReturn;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Column, TableData } from '../types';
|
|
2
|
+
interface UseColumnVisibilityOptions<T extends TableData> {
|
|
3
|
+
columns: Column<T>[];
|
|
4
|
+
/** Controlled hidden column IDs */
|
|
5
|
+
controlledHiddenColumns?: string[];
|
|
6
|
+
/** Callback when visibility changes */
|
|
7
|
+
onColumnVisibilityChange?: (hiddenColumns: string[]) => void;
|
|
8
|
+
}
|
|
9
|
+
interface UseColumnVisibilityReturn<T extends TableData> {
|
|
10
|
+
/** Columns filtered by visibility */
|
|
11
|
+
visibleColumns: Column<T>[];
|
|
12
|
+
/** Set of hidden column IDs */
|
|
13
|
+
hiddenColumnIds: Set<string>;
|
|
14
|
+
/** Toggle a column's visibility */
|
|
15
|
+
toggleColumn: (columnId: string) => void;
|
|
16
|
+
/** Show all columns */
|
|
17
|
+
showAllColumns: () => void;
|
|
18
|
+
/** Check if a column is visible */
|
|
19
|
+
isColumnVisible: (columnId: string) => boolean;
|
|
20
|
+
/** Array of hidden column IDs (for serialization) */
|
|
21
|
+
hiddenColumns: string[];
|
|
22
|
+
}
|
|
23
|
+
export declare function useColumnVisibility<T extends TableData>({ columns, controlledHiddenColumns, onColumnVisibilityChange, }: UseColumnVisibilityOptions<T>): UseColumnVisibilityReturn<T>;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface UseExpandableRowsOptions {
|
|
2
|
+
/** Controlled expanded row keys */
|
|
3
|
+
controlledExpandedRows?: string[];
|
|
4
|
+
/** Callback when expanded rows change */
|
|
5
|
+
onExpandChange?: (expandedRows: string[]) => void;
|
|
6
|
+
/** Only allow one row expanded at a time */
|
|
7
|
+
accordion?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface UseExpandableRowsReturn {
|
|
10
|
+
/** Set of currently expanded row keys */
|
|
11
|
+
expandedRowKeys: Set<string>;
|
|
12
|
+
/** Check if a row is expanded */
|
|
13
|
+
isExpanded: (rowKey: string) => boolean;
|
|
14
|
+
/** Toggle a row's expanded state */
|
|
15
|
+
toggleExpand: (rowKey: string) => void;
|
|
16
|
+
/** Collapse all rows */
|
|
17
|
+
collapseAll: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function useExpandableRows({ controlledExpandedRows, onExpandChange, accordion, }: UseExpandableRowsOptions): UseExpandableRowsReturn;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Traps focus within a container element while active.
|
|
3
|
+
* On activate: stores previously focused element and focuses first focusable child.
|
|
4
|
+
* On deactivate: restores focus to the previously focused element.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useFocusTrap(containerRef: React.RefObject<HTMLElement | null>, isActive: boolean): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that tracks a CSS media query match state.
|
|
3
|
+
* SSR-safe: returns `false` during server rendering and hydrates on mount.
|
|
4
|
+
*
|
|
5
|
+
* @param query - CSS media query string, e.g. `'(max-width: 640px)'`
|
|
6
|
+
* @returns `true` when the viewport matches the query
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { FilterState, TableData, Column } from '../types';
|
|
1
|
+
import { FilterState, TableData, Column, DateFilterRange } from '../types';
|
|
2
2
|
interface UseTableFilterOptions<T extends TableData> {
|
|
3
3
|
data: T[];
|
|
4
4
|
columns: Column<T>[];
|
|
5
5
|
initialFilters?: FilterState;
|
|
6
6
|
controlledFilters?: FilterState;
|
|
7
7
|
onFilterChange?: (filters: FilterState) => void;
|
|
8
|
+
/** When true, skip client-side filtering — data is returned as-is */
|
|
9
|
+
manual?: boolean;
|
|
8
10
|
}
|
|
9
11
|
interface UseTableFilterReturn<T extends TableData> {
|
|
10
12
|
filteredData: T[];
|
|
11
13
|
filters: FilterState;
|
|
12
|
-
setFilter: (columnId: string, value: string | number | boolean | null) => void;
|
|
14
|
+
setFilter: (columnId: string, value: string | number | boolean | DateFilterRange | null) => void;
|
|
13
15
|
clearFilters: () => void;
|
|
14
16
|
clearFilter: (columnId: string) => void;
|
|
15
17
|
}
|
|
16
|
-
export declare function useTableFilter<T extends TableData>({ data, columns, initialFilters, controlledFilters, onFilterChange, }: UseTableFilterOptions<T>): UseTableFilterReturn<T>;
|
|
18
|
+
export declare function useTableFilter<T extends TableData>({ data, columns, initialFilters, controlledFilters, onFilterChange, manual, }: UseTableFilterOptions<T>): UseTableFilterReturn<T>;
|
|
17
19
|
export {};
|