analytica-frontend-lib 1.2.19 → 1.2.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AlertManager/index.css +10 -0
- package/dist/AlertManager/index.css.map +1 -1
- package/dist/AlertManager/index.d.mts +2 -1
- package/dist/AlertManager/index.d.ts +2 -1
- package/dist/AlertManagerView/index.d.mts +2 -1
- package/dist/AlertManagerView/index.d.ts +2 -1
- package/dist/CheckBoxGroup-9n5C0OH4.d.mts +24 -0
- package/dist/CheckBoxGroup-9n5C0OH4.d.ts +24 -0
- package/dist/Radio/index.d.mts +1 -1
- package/dist/Radio/index.d.ts +1 -1
- package/dist/TableProvider/index.css +19143 -0
- package/dist/TableProvider/index.css.map +1 -0
- package/dist/TableProvider/index.d.mts +4 -0
- package/dist/TableProvider/index.d.ts +4 -0
- package/dist/TableProvider/index.js +5365 -0
- package/dist/TableProvider/index.js.map +1 -0
- package/dist/TableProvider/index.mjs +5387 -0
- package/dist/TableProvider/index.mjs.map +1 -0
- package/dist/TableProvider-CDcL1tDj.d.mts +192 -0
- package/dist/TableProvider-D4Ak7ofz.d.ts +192 -0
- package/dist/index.css +10 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +6 -43
- package/dist/index.d.ts +6 -43
- package/dist/index.js +1069 -780
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +988 -700
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +10 -0
- package/dist/styles.css.map +1 -1
- package/dist/{types-BXzeefgf.d.mts → types-DqZRjqxh.d.ts} +2 -23
- package/dist/{types-BXzeefgf.d.ts → types-pd3QVhSu.d.mts} +2 -23
- package/package.json +2 -1
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { C as CategoryConfig } from './CheckBoxGroup-9n5C0OH4.mjs';
|
|
4
|
+
|
|
5
|
+
type FilterConfig = {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
categories: CategoryConfig[];
|
|
9
|
+
};
|
|
10
|
+
type UseTableFilterOptions = {
|
|
11
|
+
syncWithUrl?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type UseTableFilterReturn = {
|
|
14
|
+
filterConfigs: FilterConfig[];
|
|
15
|
+
activeFilters: Record<string, string[]>;
|
|
16
|
+
hasActiveFilters: boolean;
|
|
17
|
+
updateFilters: (configs: FilterConfig[]) => void;
|
|
18
|
+
applyFilters: () => void;
|
|
19
|
+
clearFilters: () => void;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Hook for managing table filters with URL synchronization
|
|
23
|
+
*
|
|
24
|
+
* @param initialConfigs - Initial filter configurations
|
|
25
|
+
* @param options - Hook options including URL sync
|
|
26
|
+
* @returns Filter state and management functions
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { filterConfigs, activeFilters, updateFilters, applyFilters } = useTableFilter(
|
|
31
|
+
* [
|
|
32
|
+
* {
|
|
33
|
+
* key: 'academic',
|
|
34
|
+
* label: 'Dados Acadêmicos',
|
|
35
|
+
* categories: [...]
|
|
36
|
+
* }
|
|
37
|
+
* ],
|
|
38
|
+
* { syncWithUrl: true }
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const useTableFilter: (initialConfigs: FilterConfig[], options?: UseTableFilterOptions) => UseTableFilterReturn;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Column configuration with flexible rendering options
|
|
46
|
+
*/
|
|
47
|
+
interface ColumnConfig<T = Record<string, unknown>> {
|
|
48
|
+
/** Column key (must match data object key) */
|
|
49
|
+
key: string;
|
|
50
|
+
/** Column label - can be string or JSX */
|
|
51
|
+
label: string | ReactNode;
|
|
52
|
+
/** Enable sorting for this column */
|
|
53
|
+
sortable?: boolean;
|
|
54
|
+
/** Custom render function for cell content */
|
|
55
|
+
render?: (value: unknown, row: T, index: number) => ReactNode;
|
|
56
|
+
/** Column width */
|
|
57
|
+
width?: string;
|
|
58
|
+
/** Additional CSS classes */
|
|
59
|
+
className?: string;
|
|
60
|
+
/** Text alignment */
|
|
61
|
+
align?: 'left' | 'center' | 'right';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Combined parameters sent via onParamsChange
|
|
65
|
+
*/
|
|
66
|
+
interface TableParams {
|
|
67
|
+
/** Current page number */
|
|
68
|
+
page: number;
|
|
69
|
+
/** Items per page */
|
|
70
|
+
limit: number;
|
|
71
|
+
/** Search query */
|
|
72
|
+
search?: string;
|
|
73
|
+
/** Active filters (dynamic keys based on filter configs) */
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
/** Sort column */
|
|
76
|
+
sortBy?: string;
|
|
77
|
+
/** Sort direction */
|
|
78
|
+
sortOrder?: 'asc' | 'desc';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Pagination configuration
|
|
82
|
+
*/
|
|
83
|
+
interface PaginationConfig {
|
|
84
|
+
/** Label for items (e.g., "atividades") */
|
|
85
|
+
itemLabel?: string;
|
|
86
|
+
/** Items per page options */
|
|
87
|
+
itemsPerPageOptions?: number[];
|
|
88
|
+
/** Default items per page */
|
|
89
|
+
defaultItemsPerPage?: number;
|
|
90
|
+
/** Total items (for displaying pagination info) */
|
|
91
|
+
totalItems?: number;
|
|
92
|
+
/** Total pages (if known from backend) */
|
|
93
|
+
totalPages?: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Table components exposed via render prop
|
|
97
|
+
*/
|
|
98
|
+
interface TableComponents {
|
|
99
|
+
/** Search and filter controls */
|
|
100
|
+
controls: ReactNode;
|
|
101
|
+
/** Table with data */
|
|
102
|
+
table: ReactNode;
|
|
103
|
+
/** Pagination controls */
|
|
104
|
+
pagination: ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* TableProvider Props
|
|
108
|
+
*/
|
|
109
|
+
interface TableProviderProps<T = Record<string, unknown>> {
|
|
110
|
+
/** Data to display in the table */
|
|
111
|
+
readonly data: T[];
|
|
112
|
+
/** Column configurations */
|
|
113
|
+
readonly headers: ColumnConfig<T>[];
|
|
114
|
+
/** Loading state */
|
|
115
|
+
readonly loading?: boolean;
|
|
116
|
+
/** Table variant */
|
|
117
|
+
readonly variant?: 'default' | 'borderless';
|
|
118
|
+
/** Enable search functionality */
|
|
119
|
+
readonly enableSearch?: boolean;
|
|
120
|
+
/** Enable filters functionality */
|
|
121
|
+
readonly enableFilters?: boolean;
|
|
122
|
+
/** Enable table sorting */
|
|
123
|
+
readonly enableTableSort?: boolean;
|
|
124
|
+
/** Enable pagination */
|
|
125
|
+
readonly enablePagination?: boolean;
|
|
126
|
+
/** Enable row click functionality */
|
|
127
|
+
readonly enableRowClick?: boolean;
|
|
128
|
+
/** Initial filter configurations */
|
|
129
|
+
readonly initialFilters?: FilterConfig[];
|
|
130
|
+
/** Pagination configuration */
|
|
131
|
+
readonly paginationConfig?: PaginationConfig;
|
|
132
|
+
/** Search placeholder text */
|
|
133
|
+
readonly searchPlaceholder?: string;
|
|
134
|
+
/** Image for no search result state */
|
|
135
|
+
readonly noSearchResultImage?: string;
|
|
136
|
+
/** Key field name to use for unique row identification (recommended for better performance) */
|
|
137
|
+
readonly rowKey?: keyof T;
|
|
138
|
+
/** Callback when any parameter changes */
|
|
139
|
+
readonly onParamsChange?: (params: TableParams) => void;
|
|
140
|
+
/** Callback when row is clicked */
|
|
141
|
+
readonly onRowClick?: (row: T, index: number) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Render prop for custom layout control
|
|
144
|
+
* When provided, gives full control over component positioning
|
|
145
|
+
* @param components - Table components (controls, table, pagination)
|
|
146
|
+
* @returns Custom layout JSX
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* <TableProvider {...props}>
|
|
151
|
+
* {({ controls, table, pagination }) => (
|
|
152
|
+
* <>
|
|
153
|
+
* <div className="mb-4">{controls}</div>
|
|
154
|
+
* <div className="bg-white p-6">
|
|
155
|
+
* {table}
|
|
156
|
+
* {pagination}
|
|
157
|
+
* </div>
|
|
158
|
+
* </>
|
|
159
|
+
* )}
|
|
160
|
+
* </TableProvider>
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
readonly children?: (components: TableComponents) => ReactNode;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* TableProvider - Self-contained table component with search, filters, sorting, and pagination
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <TableProvider
|
|
171
|
+
* data={activities}
|
|
172
|
+
* headers={[
|
|
173
|
+
* { key: 'title', label: 'Título', sortable: true },
|
|
174
|
+
* { key: 'status', label: 'Status', render: (value) => <Badge>{value}</Badge> }
|
|
175
|
+
* ]}
|
|
176
|
+
* loading={loading}
|
|
177
|
+
* variant="borderless"
|
|
178
|
+
* enableSearch
|
|
179
|
+
* enableFilters
|
|
180
|
+
* enableTableSort
|
|
181
|
+
* enablePagination
|
|
182
|
+
* enableRowClick
|
|
183
|
+
* initialFilters={filterConfigs}
|
|
184
|
+
* paginationConfig={{ itemLabel: 'atividades' }}
|
|
185
|
+
* onParamsChange={handleParamsChange}
|
|
186
|
+
* onRowClick={handleRowClick}
|
|
187
|
+
* />
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
declare function TableProvider<T extends Record<string, unknown>>({ data, headers, loading, variant, enableSearch, enableFilters, enableTableSort, enablePagination, enableRowClick, initialFilters, paginationConfig, searchPlaceholder, noSearchResultImage, rowKey, onParamsChange, onRowClick, children, }: TableProviderProps<T>): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
export { type ColumnConfig as C, type FilterConfig as F, type PaginationConfig as P, TableProvider as T, type UseTableFilterOptions as U, type UseTableFilterReturn as a, type TableParams as b, type TableProviderProps as c, type TableComponents as d, useTableFilter as u };
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { C as CategoryConfig } from './CheckBoxGroup-9n5C0OH4.js';
|
|
4
|
+
|
|
5
|
+
type FilterConfig = {
|
|
6
|
+
key: string;
|
|
7
|
+
label: string;
|
|
8
|
+
categories: CategoryConfig[];
|
|
9
|
+
};
|
|
10
|
+
type UseTableFilterOptions = {
|
|
11
|
+
syncWithUrl?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type UseTableFilterReturn = {
|
|
14
|
+
filterConfigs: FilterConfig[];
|
|
15
|
+
activeFilters: Record<string, string[]>;
|
|
16
|
+
hasActiveFilters: boolean;
|
|
17
|
+
updateFilters: (configs: FilterConfig[]) => void;
|
|
18
|
+
applyFilters: () => void;
|
|
19
|
+
clearFilters: () => void;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Hook for managing table filters with URL synchronization
|
|
23
|
+
*
|
|
24
|
+
* @param initialConfigs - Initial filter configurations
|
|
25
|
+
* @param options - Hook options including URL sync
|
|
26
|
+
* @returns Filter state and management functions
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* const { filterConfigs, activeFilters, updateFilters, applyFilters } = useTableFilter(
|
|
31
|
+
* [
|
|
32
|
+
* {
|
|
33
|
+
* key: 'academic',
|
|
34
|
+
* label: 'Dados Acadêmicos',
|
|
35
|
+
* categories: [...]
|
|
36
|
+
* }
|
|
37
|
+
* ],
|
|
38
|
+
* { syncWithUrl: true }
|
|
39
|
+
* );
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
declare const useTableFilter: (initialConfigs: FilterConfig[], options?: UseTableFilterOptions) => UseTableFilterReturn;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Column configuration with flexible rendering options
|
|
46
|
+
*/
|
|
47
|
+
interface ColumnConfig<T = Record<string, unknown>> {
|
|
48
|
+
/** Column key (must match data object key) */
|
|
49
|
+
key: string;
|
|
50
|
+
/** Column label - can be string or JSX */
|
|
51
|
+
label: string | ReactNode;
|
|
52
|
+
/** Enable sorting for this column */
|
|
53
|
+
sortable?: boolean;
|
|
54
|
+
/** Custom render function for cell content */
|
|
55
|
+
render?: (value: unknown, row: T, index: number) => ReactNode;
|
|
56
|
+
/** Column width */
|
|
57
|
+
width?: string;
|
|
58
|
+
/** Additional CSS classes */
|
|
59
|
+
className?: string;
|
|
60
|
+
/** Text alignment */
|
|
61
|
+
align?: 'left' | 'center' | 'right';
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Combined parameters sent via onParamsChange
|
|
65
|
+
*/
|
|
66
|
+
interface TableParams {
|
|
67
|
+
/** Current page number */
|
|
68
|
+
page: number;
|
|
69
|
+
/** Items per page */
|
|
70
|
+
limit: number;
|
|
71
|
+
/** Search query */
|
|
72
|
+
search?: string;
|
|
73
|
+
/** Active filters (dynamic keys based on filter configs) */
|
|
74
|
+
[key: string]: unknown;
|
|
75
|
+
/** Sort column */
|
|
76
|
+
sortBy?: string;
|
|
77
|
+
/** Sort direction */
|
|
78
|
+
sortOrder?: 'asc' | 'desc';
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Pagination configuration
|
|
82
|
+
*/
|
|
83
|
+
interface PaginationConfig {
|
|
84
|
+
/** Label for items (e.g., "atividades") */
|
|
85
|
+
itemLabel?: string;
|
|
86
|
+
/** Items per page options */
|
|
87
|
+
itemsPerPageOptions?: number[];
|
|
88
|
+
/** Default items per page */
|
|
89
|
+
defaultItemsPerPage?: number;
|
|
90
|
+
/** Total items (for displaying pagination info) */
|
|
91
|
+
totalItems?: number;
|
|
92
|
+
/** Total pages (if known from backend) */
|
|
93
|
+
totalPages?: number;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Table components exposed via render prop
|
|
97
|
+
*/
|
|
98
|
+
interface TableComponents {
|
|
99
|
+
/** Search and filter controls */
|
|
100
|
+
controls: ReactNode;
|
|
101
|
+
/** Table with data */
|
|
102
|
+
table: ReactNode;
|
|
103
|
+
/** Pagination controls */
|
|
104
|
+
pagination: ReactNode;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* TableProvider Props
|
|
108
|
+
*/
|
|
109
|
+
interface TableProviderProps<T = Record<string, unknown>> {
|
|
110
|
+
/** Data to display in the table */
|
|
111
|
+
readonly data: T[];
|
|
112
|
+
/** Column configurations */
|
|
113
|
+
readonly headers: ColumnConfig<T>[];
|
|
114
|
+
/** Loading state */
|
|
115
|
+
readonly loading?: boolean;
|
|
116
|
+
/** Table variant */
|
|
117
|
+
readonly variant?: 'default' | 'borderless';
|
|
118
|
+
/** Enable search functionality */
|
|
119
|
+
readonly enableSearch?: boolean;
|
|
120
|
+
/** Enable filters functionality */
|
|
121
|
+
readonly enableFilters?: boolean;
|
|
122
|
+
/** Enable table sorting */
|
|
123
|
+
readonly enableTableSort?: boolean;
|
|
124
|
+
/** Enable pagination */
|
|
125
|
+
readonly enablePagination?: boolean;
|
|
126
|
+
/** Enable row click functionality */
|
|
127
|
+
readonly enableRowClick?: boolean;
|
|
128
|
+
/** Initial filter configurations */
|
|
129
|
+
readonly initialFilters?: FilterConfig[];
|
|
130
|
+
/** Pagination configuration */
|
|
131
|
+
readonly paginationConfig?: PaginationConfig;
|
|
132
|
+
/** Search placeholder text */
|
|
133
|
+
readonly searchPlaceholder?: string;
|
|
134
|
+
/** Image for no search result state */
|
|
135
|
+
readonly noSearchResultImage?: string;
|
|
136
|
+
/** Key field name to use for unique row identification (recommended for better performance) */
|
|
137
|
+
readonly rowKey?: keyof T;
|
|
138
|
+
/** Callback when any parameter changes */
|
|
139
|
+
readonly onParamsChange?: (params: TableParams) => void;
|
|
140
|
+
/** Callback when row is clicked */
|
|
141
|
+
readonly onRowClick?: (row: T, index: number) => void;
|
|
142
|
+
/**
|
|
143
|
+
* Render prop for custom layout control
|
|
144
|
+
* When provided, gives full control over component positioning
|
|
145
|
+
* @param components - Table components (controls, table, pagination)
|
|
146
|
+
* @returns Custom layout JSX
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```tsx
|
|
150
|
+
* <TableProvider {...props}>
|
|
151
|
+
* {({ controls, table, pagination }) => (
|
|
152
|
+
* <>
|
|
153
|
+
* <div className="mb-4">{controls}</div>
|
|
154
|
+
* <div className="bg-white p-6">
|
|
155
|
+
* {table}
|
|
156
|
+
* {pagination}
|
|
157
|
+
* </div>
|
|
158
|
+
* </>
|
|
159
|
+
* )}
|
|
160
|
+
* </TableProvider>
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
readonly children?: (components: TableComponents) => ReactNode;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* TableProvider - Self-contained table component with search, filters, sorting, and pagination
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```tsx
|
|
170
|
+
* <TableProvider
|
|
171
|
+
* data={activities}
|
|
172
|
+
* headers={[
|
|
173
|
+
* { key: 'title', label: 'Título', sortable: true },
|
|
174
|
+
* { key: 'status', label: 'Status', render: (value) => <Badge>{value}</Badge> }
|
|
175
|
+
* ]}
|
|
176
|
+
* loading={loading}
|
|
177
|
+
* variant="borderless"
|
|
178
|
+
* enableSearch
|
|
179
|
+
* enableFilters
|
|
180
|
+
* enableTableSort
|
|
181
|
+
* enablePagination
|
|
182
|
+
* enableRowClick
|
|
183
|
+
* initialFilters={filterConfigs}
|
|
184
|
+
* paginationConfig={{ itemLabel: 'atividades' }}
|
|
185
|
+
* onParamsChange={handleParamsChange}
|
|
186
|
+
* onRowClick={handleRowClick}
|
|
187
|
+
* />
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
declare function TableProvider<T extends Record<string, unknown>>({ data, headers, loading, variant, enableSearch, enableFilters, enableTableSort, enablePagination, enableRowClick, initialFilters, paginationConfig, searchPlaceholder, noSearchResultImage, rowKey, onParamsChange, onRowClick, children, }: TableProviderProps<T>): react_jsx_runtime.JSX.Element;
|
|
191
|
+
|
|
192
|
+
export { type ColumnConfig as C, type FilterConfig as F, type PaginationConfig as P, TableProvider as T, type UseTableFilterOptions as U, type UseTableFilterReturn as a, type TableParams as b, type TableProviderProps as c, type TableComponents as d, useTableFilter as u };
|
package/dist/index.css
CHANGED
|
@@ -2289,6 +2289,9 @@
|
|
|
2289
2289
|
.bg-blue-500 {
|
|
2290
2290
|
background-color: var(--color-blue-500);
|
|
2291
2291
|
}
|
|
2292
|
+
.bg-blue-600 {
|
|
2293
|
+
background-color: var(--color-blue-600);
|
|
2294
|
+
}
|
|
2292
2295
|
.bg-blue-700 {
|
|
2293
2296
|
background-color: var(--color-blue-700);
|
|
2294
2297
|
}
|
|
@@ -5021,6 +5024,13 @@
|
|
|
5021
5024
|
}
|
|
5022
5025
|
}
|
|
5023
5026
|
}
|
|
5027
|
+
.hover\:bg-blue-700 {
|
|
5028
|
+
&:hover {
|
|
5029
|
+
@media (hover: hover) {
|
|
5030
|
+
background-color: var(--color-blue-700);
|
|
5031
|
+
}
|
|
5032
|
+
}
|
|
5033
|
+
}
|
|
5024
5034
|
.hover\:bg-border-50 {
|
|
5025
5035
|
&:hover {
|
|
5026
5036
|
@media (hover: hover) {
|