tcce-design-system 0.1.22 → 0.1.24
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.
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { AnchorHTMLAttributes } from 'react';
|
|
2
2
|
import { ButtonHTMLAttributes } from 'react';
|
|
3
|
+
import { Cell } from '@tanstack/react-table';
|
|
3
4
|
import { ChangeEvent } from 'react';
|
|
4
5
|
import { ClipboardEvent as ClipboardEvent_2 } from 'react';
|
|
6
|
+
import { Column } from '@tanstack/react-table';
|
|
7
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
5
8
|
import { Component } from 'react';
|
|
6
9
|
import { Context } from 'react';
|
|
10
|
+
import { createColumnHelper } from '@tanstack/react-table';
|
|
7
11
|
import { CSSProperties } from 'react';
|
|
8
|
-
import { default as default_2 } from 'react';
|
|
9
12
|
import { DetailedHTMLProps } from 'react';
|
|
10
13
|
import { Dispatch } from 'react';
|
|
11
14
|
import { FastOmit } from 'styled-components';
|
|
12
15
|
import { ForwardRefComponent } from 'motion/react';
|
|
13
16
|
import { ForwardRefExoticComponent } from 'react';
|
|
17
|
+
import { Header as Header_2 } from '@tanstack/react-table';
|
|
18
|
+
import { HeaderGroup } from '@tanstack/react-table';
|
|
14
19
|
import { HTMLAttributeAnchorTarget } from 'react';
|
|
15
20
|
import { HTMLAttributes } from 'react';
|
|
16
21
|
import { HTMLMotionProps } from 'motion/react';
|
|
@@ -19,19 +24,24 @@ import { IStyledComponentBase } from 'styled-components/dist/types';
|
|
|
19
24
|
import { JSX } from 'react/jsx-runtime';
|
|
20
25
|
import { KeyboardEvent as KeyboardEvent_2 } from 'react';
|
|
21
26
|
import { LabelHTMLAttributes } from 'react';
|
|
27
|
+
import { MemoExoticComponent } from 'react';
|
|
22
28
|
import { MouseEventHandler } from 'react';
|
|
23
29
|
import { PropsWithChildren } from 'react';
|
|
24
30
|
import { ReactNode } from 'react';
|
|
25
31
|
import { RefAttributes } from 'react';
|
|
26
32
|
import { RefObject } from 'react';
|
|
27
33
|
import { RemixiconComponentType } from '@remixicon/react';
|
|
34
|
+
import { Row } from '@tanstack/react-table';
|
|
28
35
|
import { RuleSet } from 'styled-components';
|
|
29
36
|
import { SelectHTMLAttributes } from 'react';
|
|
30
37
|
import { SetStateAction } from 'react';
|
|
38
|
+
import { SortingState } from '@tanstack/react-table';
|
|
31
39
|
import { Substitute } from 'styled-components/dist/types';
|
|
40
|
+
import { Table as TanStackTableType } from '@tanstack/react-table';
|
|
32
41
|
import { TextareaHTMLAttributes } from 'react';
|
|
33
42
|
import { toast } from 'sonner';
|
|
34
43
|
import { ToasterProps } from 'sonner';
|
|
44
|
+
import { Updater } from '@tanstack/react-table';
|
|
35
45
|
|
|
36
46
|
/**
|
|
37
47
|
* Valid input types supported by the FormField component
|
|
@@ -90,8 +100,6 @@ declare type BadgeSize = 'sm' | 'md' | 'lg';
|
|
|
90
100
|
*/
|
|
91
101
|
declare type BadgeVariant = 'primary' | 'secondary' | 'success' | 'warning' | 'danger' | 'neutral' | 'outline';
|
|
92
102
|
|
|
93
|
-
export declare const baseContentTableStyles: RuleSet<object>;
|
|
94
|
-
|
|
95
103
|
export declare const baseFieldStyles: RuleSet<object>;
|
|
96
104
|
|
|
97
105
|
export declare interface BaseFormFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'size'> {
|
|
@@ -127,7 +135,7 @@ export declare interface BaseLabelProps extends LabelHTMLAttributes<HTMLLabelEle
|
|
|
127
135
|
* @property {string} [title] - Optional title for accessibility.
|
|
128
136
|
* @property {Variant} [variant] - Animation variant of the spinner.
|
|
129
137
|
*/
|
|
130
|
-
declare interface BaseSpinnerProps {
|
|
138
|
+
export declare interface BaseSpinnerProps {
|
|
131
139
|
size?: Size;
|
|
132
140
|
color?: ColorKey;
|
|
133
141
|
centered?: boolean;
|
|
@@ -136,12 +144,6 @@ declare interface BaseSpinnerProps {
|
|
|
136
144
|
variant?: Variant;
|
|
137
145
|
}
|
|
138
146
|
|
|
139
|
-
export declare const baseTableCellsSizes: {
|
|
140
|
-
sm: RuleSet<object>;
|
|
141
|
-
md: RuleSet<object>;
|
|
142
|
-
lg: RuleSet<object>;
|
|
143
|
-
};
|
|
144
|
-
|
|
145
147
|
export declare const bodyTextStyles: {
|
|
146
148
|
80: RuleSet<object>;
|
|
147
149
|
60: RuleSet<object>;
|
|
@@ -195,6 +197,8 @@ export declare type CardSize = 'sm' | 'md' | 'lg';
|
|
|
195
197
|
|
|
196
198
|
export declare type CardVariant = 'elevated' | 'flat' | 'info';
|
|
197
199
|
|
|
200
|
+
export declare type CellAlignment = 'left' | 'center' | 'right';
|
|
201
|
+
|
|
198
202
|
export declare const Checkbox: ForwardRefExoticComponent<CheckboxProps & RefAttributes<HTMLInputElement>>;
|
|
199
203
|
|
|
200
204
|
export declare const CheckboxInput: ForwardRefExoticComponent<CheckboxInputProps & RefAttributes<HTMLInputElement>>;
|
|
@@ -233,10 +237,58 @@ export declare interface CheckboxSpecificProps {
|
|
|
233
237
|
*/
|
|
234
238
|
export declare const CloseOpenButton: IStyledComponentBase<"web", FastOmit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, never>> & string;
|
|
235
239
|
|
|
236
|
-
declare type ColorKey = 'primary' | 'orange' | 'white' | 'gray';
|
|
240
|
+
export declare type ColorKey = 'primary' | 'orange' | 'white' | 'gray';
|
|
237
241
|
|
|
238
242
|
declare type ColorKey_2 = 'primary' | 'orange' | 'white' | 'gray';
|
|
239
243
|
|
|
244
|
+
export { Column }
|
|
245
|
+
|
|
246
|
+
export { ColumnDef }
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
*
|
|
250
|
+
* Column metadata for additional configurations
|
|
251
|
+
* Includes alignment, size, sortable, filterable, truncate, variant, and width
|
|
252
|
+
*/
|
|
253
|
+
export declare interface ColumnMeta {
|
|
254
|
+
align?: CellAlignment;
|
|
255
|
+
size?: TableCellSize;
|
|
256
|
+
sortable?: boolean;
|
|
257
|
+
filterable?: boolean;
|
|
258
|
+
ellipsis?: boolean;
|
|
259
|
+
variant?: 'default' | 'numeric';
|
|
260
|
+
width?: string | number;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Creates URLSearchParams for backend pagination with sorting
|
|
265
|
+
* Compatible with Laravel PaginateHelper
|
|
266
|
+
*
|
|
267
|
+
* @param options - Pagination and sorting options
|
|
268
|
+
* @returns URLSearchParams ready to append to API request
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```ts
|
|
272
|
+
* const params = createBackendParams({
|
|
273
|
+
* sorting: [{ id: 'name', desc: false }],
|
|
274
|
+
* perPage: 20,
|
|
275
|
+
* genericSearch: 'john',
|
|
276
|
+
* filters: { role: 'admin', status: 'active' }
|
|
277
|
+
* });
|
|
278
|
+
*
|
|
279
|
+
* fetch(`/api/users?${params.toString()}`);
|
|
280
|
+
* // Result: /api/users?sorts={"name":"asc"}&perPage=20&genericSearch=john&filters={"role":"admin","status":"active"}
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
export declare function createBackendParams(options: {
|
|
284
|
+
sorting?: SortingState;
|
|
285
|
+
perPage?: number;
|
|
286
|
+
genericSearch?: string;
|
|
287
|
+
filters?: Record<string, unknown>;
|
|
288
|
+
}): URLSearchParams;
|
|
289
|
+
|
|
290
|
+
export { createColumnHelper }
|
|
291
|
+
|
|
240
292
|
/**
|
|
241
293
|
* Helper to create field configurations for common patterns
|
|
242
294
|
*/
|
|
@@ -515,6 +567,27 @@ export declare type FormFieldSize = 'sm' | 'md' | 'lg';
|
|
|
515
567
|
|
|
516
568
|
export declare type FormFieldState = 'default' | 'hover' | 'focus' | 'error' | 'disabled';
|
|
517
569
|
|
|
570
|
+
/**
|
|
571
|
+
* FullScreenSpinner Component
|
|
572
|
+
* Renders a full-screen spinner with an optional message.
|
|
573
|
+
* @param {FullScreenSpinnerProps} props - Props for the FullScreenSpinner component see in Spinner.types.ts .
|
|
574
|
+
* @returns JSX.Element The rendered FullScreenSpinner component.
|
|
575
|
+
*/
|
|
576
|
+
export declare const FullScreenSpinner: ({ message, color, variant, }: FullScreenSpinnerProps) => JSX.Element;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Props for the FullScreenSpinner component.
|
|
580
|
+
* @interface FullScreenSpinnerProps
|
|
581
|
+
* @property {string} [message] - Optional message to display with the spinner.
|
|
582
|
+
* @property {ColorKey} [color] - Color variant of the spinner.
|
|
583
|
+
* @property {Variant} [variant] - Animation variant of the spinner.
|
|
584
|
+
*/
|
|
585
|
+
export declare interface FullScreenSpinnerProps {
|
|
586
|
+
message?: string;
|
|
587
|
+
color?: ColorKey;
|
|
588
|
+
variant?: Variant;
|
|
589
|
+
}
|
|
590
|
+
|
|
518
591
|
/**
|
|
519
592
|
* Retrieves the value of a cookie by name
|
|
520
593
|
* @param name - The name of the cookie to retrieve
|
|
@@ -1076,6 +1149,8 @@ export declare interface RadioSpecificProps {
|
|
|
1076
1149
|
onRadioChange?: (event: ChangeEvent<HTMLInputElement>) => void;
|
|
1077
1150
|
}
|
|
1078
1151
|
|
|
1152
|
+
export { Row }
|
|
1153
|
+
|
|
1079
1154
|
export declare const SearchInput: ({ size, leftIcon, rightIcon, iconSize, iconColor, placeholder, onSearch, className, ...props }: SearchInputProps) => JSX.Element;
|
|
1080
1155
|
|
|
1081
1156
|
export declare interface SearchInputProps extends BaseInputProps {
|
|
@@ -1089,6 +1164,27 @@ export declare interface SearchSpecificProps {
|
|
|
1089
1164
|
onSearch?: (value: string) => void;
|
|
1090
1165
|
}
|
|
1091
1166
|
|
|
1167
|
+
/**
|
|
1168
|
+
* SectionSpinner Component
|
|
1169
|
+
* Renders a spinner suitable for section loading states with an optional message.
|
|
1170
|
+
* @param {SectionSpinnerProps} props - Props for the SectionSpinner component see in Spinner.types.ts .
|
|
1171
|
+
* @returns JSX.Element The rendered SectionSpinner component.
|
|
1172
|
+
*/
|
|
1173
|
+
export declare const SectionSpinner: ({ message, color, variant, }: SectionSpinnerProps) => JSX.Element;
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* Props for the SectionSpinner component
|
|
1177
|
+
* @interface SectionSpinnerProps
|
|
1178
|
+
* @property {string} [message] - Optional message to display with the spinner.
|
|
1179
|
+
* @property {ColorKey} [color] - Color variant of the spinner.
|
|
1180
|
+
* @property {Variant} [variant] - Animation variant of the spinner.
|
|
1181
|
+
*/
|
|
1182
|
+
export declare interface SectionSpinnerProps {
|
|
1183
|
+
message?: string;
|
|
1184
|
+
color?: ColorKey;
|
|
1185
|
+
variant?: Variant;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1092
1188
|
export declare const SelectInput: ForwardRefExoticComponent<SelectInputProps & RefAttributes<HTMLButtonElement>>;
|
|
1093
1189
|
|
|
1094
1190
|
export declare interface SelectInputProps extends Omit<SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
|
@@ -1196,7 +1292,7 @@ export declare const SidebarProvider: ({ children }: PropsWithChildren) => JSX.E
|
|
|
1196
1292
|
* Animation variant options for the Spinner component.
|
|
1197
1293
|
* typedef {('rotate' | 'sweep')} Variant
|
|
1198
1294
|
*/
|
|
1199
|
-
declare type Size = 'sm' | 'md' | 'lg' | 'xl';
|
|
1295
|
+
export declare type Size = 'sm' | 'md' | 'lg' | 'xl';
|
|
1200
1296
|
|
|
1201
1297
|
export declare const sizeStyles: {
|
|
1202
1298
|
sm: RuleSet<object>;
|
|
@@ -1321,10 +1417,71 @@ export declare const smartAnimation: {
|
|
|
1321
1417
|
|
|
1322
1418
|
export declare type SortDirection = 'asc' | 'desc' | 'none';
|
|
1323
1419
|
|
|
1324
|
-
export
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1420
|
+
export { SortingState }
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Converts SortingState to JSON string ready to send to Laravel backend
|
|
1424
|
+
* This is a convenience function for API calls
|
|
1425
|
+
*
|
|
1426
|
+
* @param sortingState - TanStack sorting state array
|
|
1427
|
+
* @returns JSON string representation of sort record
|
|
1428
|
+
*
|
|
1429
|
+
* @example
|
|
1430
|
+
* ```ts
|
|
1431
|
+
* const sortingState = [{ id: 'name', desc: false }];
|
|
1432
|
+
* const sortsParam = sortingStateToJsonString(sortingState);
|
|
1433
|
+
* // Result: '{"name":"asc"}'
|
|
1434
|
+
*
|
|
1435
|
+
* // Use in API call:
|
|
1436
|
+
* fetch(`/api/users?sorts=${sortsParam}`);
|
|
1437
|
+
* ```
|
|
1438
|
+
*/
|
|
1439
|
+
export declare function sortingStateToJsonString(sortingState: SortingState): string;
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* Converts TanStack Table SortingState to backend-friendly record format
|
|
1443
|
+
*
|
|
1444
|
+
* @param sortingState - TanStack sorting state array
|
|
1445
|
+
* @returns Object with field names as keys and 'asc'/'desc' as values
|
|
1446
|
+
*
|
|
1447
|
+
* @example
|
|
1448
|
+
* ```ts
|
|
1449
|
+
* const sortingState = [
|
|
1450
|
+
* { id: 'name', desc: false },
|
|
1451
|
+
* { id: 'created_at', desc: true }
|
|
1452
|
+
* ];
|
|
1453
|
+
*
|
|
1454
|
+
* const sortRecord = sortingStateToRecord(sortingState);
|
|
1455
|
+
* // Result: { name: 'asc', created_at: 'desc' }
|
|
1456
|
+
* ```
|
|
1457
|
+
*/
|
|
1458
|
+
export declare function sortingStateToRecord(sortingState: SortingState): SortRecord;
|
|
1459
|
+
|
|
1460
|
+
/**
|
|
1461
|
+
* Backend sorting format - object representation
|
|
1462
|
+
* Example: { name: 'asc', created_at: 'desc' }
|
|
1463
|
+
*/
|
|
1464
|
+
export declare type SortRecord = Record<string, 'asc' | 'desc'>;
|
|
1465
|
+
|
|
1466
|
+
/**
|
|
1467
|
+
* Converts backend sort record to TanStack Table SortingState
|
|
1468
|
+
* Useful for initializing sorting state from backend response
|
|
1469
|
+
*
|
|
1470
|
+
* @param sortRecord - Object with field names and sort directions
|
|
1471
|
+
* @returns TanStack sorting state array
|
|
1472
|
+
*
|
|
1473
|
+
* @example
|
|
1474
|
+
* ```ts
|
|
1475
|
+
* const sortRecord = { name: 'asc', created_at: 'desc' };
|
|
1476
|
+
*
|
|
1477
|
+
* const sortingState = sortRecordToSortingState(sortRecord);
|
|
1478
|
+
* // Result: [
|
|
1479
|
+
* // { id: 'name', desc: false },
|
|
1480
|
+
* // { id: 'created_at', desc: true }
|
|
1481
|
+
* // ]
|
|
1482
|
+
* ```
|
|
1483
|
+
*/
|
|
1484
|
+
export declare function sortRecordToSortingState(sortRecord: SortRecord): SortingState;
|
|
1328
1485
|
|
|
1329
1486
|
/**
|
|
1330
1487
|
* Spinner Component
|
|
@@ -1403,117 +1560,146 @@ export declare const submenuAnimationTopDown: {
|
|
|
1403
1560
|
};
|
|
1404
1561
|
|
|
1405
1562
|
/**
|
|
1406
|
-
* Table component
|
|
1407
|
-
*
|
|
1408
|
-
*
|
|
1409
|
-
* @param columns - Array of column definitions.
|
|
1410
|
-
* @param rows - Array of row data.
|
|
1411
|
-
* @param size - Table size variant ('sm', 'md', 'lg'). Default is 'md'.
|
|
1412
|
-
* @param variant - Table visual variant. Default is 'default'.
|
|
1413
|
-
* @param className - Optional CSS class for the table.
|
|
1414
|
-
* @param stickyHeader - Enables sticky table headers.
|
|
1415
|
-
* @param onSortChange - Callback for sort direction changes.
|
|
1563
|
+
* Main Table component
|
|
1564
|
+
* Uses TanStack Table v8 as headless layer
|
|
1416
1565
|
*/
|
|
1417
1566
|
export declare const Table: {
|
|
1418
|
-
({
|
|
1567
|
+
<T extends Record<string, unknown>>({ data, columns, size, variant, stickyHeader, maxHeight, sorting, defaultSorting, onSortingChange, onRowClick, className, emptyMessage, enableSorting, manualSorting, isLoading, }: TableProps<T>): JSX.Element;
|
|
1419
1568
|
displayName: string;
|
|
1420
1569
|
};
|
|
1421
1570
|
|
|
1571
|
+
export declare const TableBody: <T extends Record<string, unknown>>({ rows }: TableBodyProps<T>) => JSX.Element;
|
|
1572
|
+
|
|
1573
|
+
declare interface TableBodyProps<T> {
|
|
1574
|
+
rows: Row<T>[];
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
export declare const TableCell: <T extends Record<string, unknown>>({ cell }: TableCellProps<T>) => JSX.Element;
|
|
1578
|
+
|
|
1579
|
+
declare interface TableCellProps<T> {
|
|
1580
|
+
cell: Cell<T, unknown>;
|
|
1581
|
+
}
|
|
1582
|
+
|
|
1583
|
+
export declare type TableCellSize = 'sm' | 'md' | 'lg';
|
|
1584
|
+
|
|
1422
1585
|
/**
|
|
1423
|
-
*
|
|
1424
|
-
*
|
|
1425
|
-
* @param {TableCellProps} props - Props for the TableCell component you can see them in @components/tables/types/table.types.ts.
|
|
1426
|
-
* @returns {JSX.Element} The rendered table cell.
|
|
1586
|
+
* Extended ColumnDef type that includes metadata
|
|
1427
1587
|
*/
|
|
1428
|
-
export declare
|
|
1588
|
+
export declare type TableColumnDef<T> = ColumnDef<T, unknown> & {
|
|
1589
|
+
meta?: ColumnMeta;
|
|
1590
|
+
};
|
|
1429
1591
|
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1592
|
+
/**
|
|
1593
|
+
* Table context to share state between components
|
|
1594
|
+
*/
|
|
1595
|
+
export declare interface TableContextType<T> {
|
|
1596
|
+
size: TableCellSize;
|
|
1597
|
+
variant: TableVariant;
|
|
1598
|
+
sorting: SortingState;
|
|
1599
|
+
setSorting: (state: SortingState) => void;
|
|
1600
|
+
onRowClick?: (row: T) => void;
|
|
1438
1601
|
}
|
|
1439
1602
|
|
|
1440
|
-
export declare
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
variant?: 'default' | 'numeric';
|
|
1603
|
+
export declare const TableHeader: <T extends Record<string, unknown>>({ headerGroups, stickyHeader, }: TableHeadProps<T>) => JSX.Element;
|
|
1604
|
+
|
|
1605
|
+
export declare const TableHeaderCell: <T extends Record<string, unknown>>({ header, }: TableHeaderCellProps<T>) => JSX.Element;
|
|
1606
|
+
|
|
1607
|
+
declare interface TableHeaderCellProps<T> {
|
|
1608
|
+
header: Header_2<T, unknown>;
|
|
1447
1609
|
}
|
|
1448
1610
|
|
|
1449
|
-
export declare
|
|
1611
|
+
export declare const TableHeaderRow: <T extends Record<string, unknown>>({ headerGroup, }: TableHeaderRowProps<T>) => JSX.Element;
|
|
1450
1612
|
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
fixed?: 'left' | 'right';
|
|
1613
|
+
declare interface TableHeaderRowProps<T> {
|
|
1614
|
+
headerGroup: HeaderGroup<T>;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
declare interface TableHeadProps<T> {
|
|
1618
|
+
headerGroups: HeaderGroup<T>[];
|
|
1458
1619
|
stickyHeader?: boolean;
|
|
1459
|
-
onSort?: (direction: SortDirection) => void;
|
|
1460
1620
|
}
|
|
1461
1621
|
|
|
1462
1622
|
/**
|
|
1463
|
-
* TableHeaderCell component for rendering a table header cell with optional sorting and icons.
|
|
1464
1623
|
*
|
|
1465
|
-
*
|
|
1466
|
-
* @
|
|
1624
|
+
* TablePagination component for paginating table data
|
|
1625
|
+
* @params TablePaginationProps
|
|
1626
|
+
* @returns JSX.Element
|
|
1467
1627
|
*/
|
|
1468
|
-
export declare const
|
|
1628
|
+
export declare const TablePagination: ({ onPageChange, onPerPageChange, perPage, page, totalPages, totalRecords, rowsPerPageOptions, }: TablePaginationProps) => JSX.Element;
|
|
1469
1629
|
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1630
|
+
/**
|
|
1631
|
+
* Props for TablePagination component
|
|
1632
|
+
* @prop onPageChange - Callback when page changes
|
|
1633
|
+
* @prop onPerPageChange - Callback when rows per page changes
|
|
1634
|
+
* @prop perPage - Current rows per page
|
|
1635
|
+
* @prop page - Current active page
|
|
1636
|
+
* @prop totalPages - Total number of pages
|
|
1637
|
+
* @prop totalRecords - (Optional) Total number of records
|
|
1638
|
+
* @prop rowsPerPageOptions - (Optional) Options for rows per page selection
|
|
1639
|
+
*/
|
|
1640
|
+
export declare interface TablePaginationProps {
|
|
1641
|
+
onPageChange: (newPage: number) => void;
|
|
1642
|
+
onPerPageChange: (newPerPage: number) => void;
|
|
1643
|
+
perPage: number;
|
|
1644
|
+
page: number;
|
|
1645
|
+
totalPages: number;
|
|
1646
|
+
totalRecords?: number;
|
|
1647
|
+
rowsPerPageOptions?: SelectOption[];
|
|
1480
1648
|
}
|
|
1481
1649
|
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1650
|
+
/**
|
|
1651
|
+
* Main Table component props
|
|
1652
|
+
*/
|
|
1653
|
+
export declare interface TableProps<T = unknown> {
|
|
1654
|
+
data: T[];
|
|
1487
1655
|
columns: TableColumnDef<T>[];
|
|
1488
|
-
rows: TableRowData<T>[];
|
|
1489
1656
|
size?: TableCellSize;
|
|
1490
1657
|
variant?: TableVariant;
|
|
1491
|
-
|
|
1492
|
-
tableClassName?: string;
|
|
1658
|
+
isLoading?: boolean;
|
|
1493
1659
|
stickyHeader?: boolean;
|
|
1494
|
-
|
|
1495
|
-
|
|
1660
|
+
maxHeight?: string | number;
|
|
1661
|
+
/**
|
|
1662
|
+
* Controlled sorting state
|
|
1663
|
+
* When provided, the table operates in controlled mode
|
|
1664
|
+
*/
|
|
1665
|
+
sorting?: SortingState;
|
|
1666
|
+
/**
|
|
1667
|
+
* Default sorting for uncontrolled mode
|
|
1668
|
+
* @default []
|
|
1669
|
+
*/
|
|
1670
|
+
defaultSorting?: SortingState;
|
|
1671
|
+
/**
|
|
1672
|
+
* Callback fired when sorting changes
|
|
1673
|
+
* Required for controlled mode, optional for uncontrolled
|
|
1674
|
+
*/
|
|
1675
|
+
onSortingChange?: (state: SortingState) => void;
|
|
1676
|
+
/**
|
|
1677
|
+
* Enable/disable sorting functionality
|
|
1678
|
+
* @default true
|
|
1679
|
+
*/
|
|
1680
|
+
enableSorting?: boolean;
|
|
1681
|
+
/**
|
|
1682
|
+
* Enable manual sorting mode (sorting handled by backend)
|
|
1683
|
+
* When true, the table will not sort data locally.
|
|
1684
|
+
* Data must be pre-sorted by the backend and passed via the 'data' prop.
|
|
1685
|
+
* The table will maintain sorting UI state and fire onSortingChange callbacks.
|
|
1686
|
+
* @default false
|
|
1687
|
+
*/
|
|
1688
|
+
manualSorting?: boolean;
|
|
1689
|
+
onRowClick?: (row: T) => void;
|
|
1690
|
+
className?: string;
|
|
1691
|
+
emptyMessage?: ReactNode;
|
|
1496
1692
|
}
|
|
1497
1693
|
|
|
1498
|
-
export declare const
|
|
1694
|
+
export declare const TableRow: MemoExoticComponent<(<T extends Record<string, unknown>>({ row, }: TableRowProps<T>) => JSX.Element)>;
|
|
1499
1695
|
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
cells?: TableCellData<T>[];
|
|
1503
|
-
size?: TableCellSize;
|
|
1504
|
-
align?: 'left' | 'center' | 'right';
|
|
1505
|
-
width?: string | number;
|
|
1506
|
-
truncate?: boolean;
|
|
1507
|
-
variant?: 'default' | 'numeric';
|
|
1508
|
-
className?: string;
|
|
1696
|
+
declare interface TableRowProps<T> {
|
|
1697
|
+
row: Row<T>;
|
|
1509
1698
|
}
|
|
1510
1699
|
|
|
1511
1700
|
export declare type TableVariant = 'default' | 'striped';
|
|
1512
1701
|
|
|
1513
|
-
export
|
|
1514
|
-
default: RuleSet<object>;
|
|
1515
|
-
striped: RuleSet<object>;
|
|
1516
|
-
};
|
|
1702
|
+
export { TanStackTableType }
|
|
1517
1703
|
|
|
1518
1704
|
export declare const TermsAndConditions: ({ isOpen, onAccept, onCancel, title, subtitle, content, bodyFooter, confirmationLabel, acceptLabel, cancelLabel, size, fullScreen, showCloseButton, closeOnBackdropClick, containerClassName, headerClassName, bodyClassName, footerClassName, initiallyConfirmed, onConfirmChange, }: TermsAndConditionsProps) => JSX.Element;
|
|
1519
1705
|
|
|
@@ -1640,6 +1826,67 @@ export declare interface UserProfileProps {
|
|
|
1640
1826
|
|
|
1641
1827
|
export declare const useSidebar: () => SidebarContextValue;
|
|
1642
1828
|
|
|
1829
|
+
export declare const useTableContext: <T extends Record<string, unknown>>() => TableContextType<T>;
|
|
1830
|
+
|
|
1831
|
+
/**
|
|
1832
|
+
* Hook to manage table sorting state (controlled or uncontrolled)
|
|
1833
|
+
*
|
|
1834
|
+
* @example Uncontrolled mode
|
|
1835
|
+
* ```tsx
|
|
1836
|
+
* const { sortingState, handleSortingChange } = useTableSorting({
|
|
1837
|
+
* defaultSorting: [{ id: 'name', desc: false }],
|
|
1838
|
+
* onSortingChange: (state) => console.log(state)
|
|
1839
|
+
* });
|
|
1840
|
+
* ```
|
|
1841
|
+
*
|
|
1842
|
+
* @example Controlled mode
|
|
1843
|
+
* ```tsx
|
|
1844
|
+
* const [sorting, setSorting] = useState<SortingState>([]);
|
|
1845
|
+
* const { sortingState, handleSortingChange } = useTableSorting({
|
|
1846
|
+
* sorting,
|
|
1847
|
+
* onSortingChange: setSorting
|
|
1848
|
+
* });
|
|
1849
|
+
* ```
|
|
1850
|
+
*/
|
|
1851
|
+
export declare const useTableSorting: ({ sorting: controlledSorting, defaultSorting, onSortingChange, }: UseTableSortingProps) => UseTableSortingReturn;
|
|
1852
|
+
|
|
1853
|
+
export declare interface UseTableSortingProps {
|
|
1854
|
+
/**
|
|
1855
|
+
* Controlled sorting state (optional)
|
|
1856
|
+
* If provided, the component operates in controlled mode
|
|
1857
|
+
*/
|
|
1858
|
+
sorting?: SortingState;
|
|
1859
|
+
/**
|
|
1860
|
+
* Default sorting state for uncontrolled mode
|
|
1861
|
+
* @default []
|
|
1862
|
+
*/
|
|
1863
|
+
defaultSorting?: SortingState;
|
|
1864
|
+
/**
|
|
1865
|
+
* Callback fired when sorting changes
|
|
1866
|
+
* Required for controlled mode, optional for uncontrolled
|
|
1867
|
+
*/
|
|
1868
|
+
onSortingChange?: (sorting: SortingState) => void;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
export declare interface UseTableSortingReturn {
|
|
1872
|
+
/**
|
|
1873
|
+
* Current sorting state (controlled or internal)
|
|
1874
|
+
*/
|
|
1875
|
+
sortingState: SortingState;
|
|
1876
|
+
/**
|
|
1877
|
+
* Handler for TanStack Table's onSortingChange
|
|
1878
|
+
*/
|
|
1879
|
+
handleSortingChange: (updater: Updater<SortingState>) => void;
|
|
1880
|
+
/**
|
|
1881
|
+
* Whether the component is in controlled mode
|
|
1882
|
+
*/
|
|
1883
|
+
isControlled: boolean;
|
|
1884
|
+
/**
|
|
1885
|
+
* Manual setter for uncontrolled mode (useful for imperative actions)
|
|
1886
|
+
*/
|
|
1887
|
+
setSorting: (sorting: SortingState) => void;
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1643
1890
|
/**
|
|
1644
1891
|
* Validates if a complete code meets certain criteria
|
|
1645
1892
|
*
|
|
@@ -1650,7 +1897,7 @@ export declare const useSidebar: () => SidebarContextValue;
|
|
|
1650
1897
|
*/
|
|
1651
1898
|
export declare const validateCode: (code: string, length: number, type?: "text" | "number") => boolean;
|
|
1652
1899
|
|
|
1653
|
-
declare type Variant = 'rotate' | 'sweep';
|
|
1900
|
+
export declare type Variant = 'rotate' | 'sweep';
|
|
1654
1901
|
|
|
1655
1902
|
/**
|
|
1656
1903
|
* Interfaz base para componentes que soportan iconos a la izquierda y derecha
|