luxtable 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EXAMPLE.md +348 -348
- package/README.md +178 -40
- package/USAGE.md +823 -631
- package/dist/index.d.mts +156 -23
- package/dist/index.d.ts +156 -23
- package/dist/index.js +1608 -729
- package/dist/index.mjs +1528 -652
- package/package.json +5 -2
- package/src/styles/README.md +141 -0
- package/src/styles/variables.css +283 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ColumnDef, SortingState, RowSelectionState, Column, Table as Table$1, HeaderContext
|
|
2
|
+
import { CellContext, ColumnDef, SortingState, RowSelectionState, Column, Table as Table$1, HeaderContext } from '@tanstack/react-table';
|
|
3
3
|
export { ColumnDef, RowSelectionState, SortingState, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -12,6 +12,133 @@ import * as SelectPrimitive from '@radix-ui/react-select';
|
|
|
12
12
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
13
13
|
import { ClassValue } from 'clsx';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Cell renderer tipi
|
|
17
|
+
*/
|
|
18
|
+
type CellRendererType = "status" | "progress" | "boolean" | "date" | "currency" | "copyable" | "custom";
|
|
19
|
+
/**
|
|
20
|
+
* Status cell config
|
|
21
|
+
*/
|
|
22
|
+
interface StatusCellConfig {
|
|
23
|
+
type: "status";
|
|
24
|
+
/** Custom status colors - default status'leri override eder veya üzerine ekler */
|
|
25
|
+
colors?: Record<string, {
|
|
26
|
+
bg: string;
|
|
27
|
+
text: string;
|
|
28
|
+
darkBg?: string;
|
|
29
|
+
darkText?: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Progress cell config
|
|
34
|
+
*/
|
|
35
|
+
interface ProgressCellConfig {
|
|
36
|
+
type: "progress";
|
|
37
|
+
/** Bar color */
|
|
38
|
+
barColor?: string;
|
|
39
|
+
/** Show percentage label */
|
|
40
|
+
showLabel?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Boolean cell config
|
|
44
|
+
*/
|
|
45
|
+
interface BooleanCellConfig {
|
|
46
|
+
type: "boolean";
|
|
47
|
+
/** True label */
|
|
48
|
+
trueLabel?: string;
|
|
49
|
+
/** False label */
|
|
50
|
+
falseLabel?: string;
|
|
51
|
+
/** True color classes */
|
|
52
|
+
trueColor?: string;
|
|
53
|
+
/** False color classes */
|
|
54
|
+
falseColor?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Date cell config
|
|
58
|
+
*/
|
|
59
|
+
interface DateCellConfig {
|
|
60
|
+
type: "date";
|
|
61
|
+
/** Date format */
|
|
62
|
+
format?: "short" | "long" | "relative";
|
|
63
|
+
/** Locale */
|
|
64
|
+
locale?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Currency cell config
|
|
68
|
+
*/
|
|
69
|
+
interface CurrencyCellConfig {
|
|
70
|
+
type: "currency";
|
|
71
|
+
/** Currency code (e.g., "USD", "EUR") */
|
|
72
|
+
currency?: string;
|
|
73
|
+
/** Locale */
|
|
74
|
+
locale?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Copyable cell config
|
|
78
|
+
*/
|
|
79
|
+
interface CopyableCellConfig {
|
|
80
|
+
type: "copyable";
|
|
81
|
+
/** Always show icon */
|
|
82
|
+
alwaysShowIcon?: boolean;
|
|
83
|
+
/** Tooltip text */
|
|
84
|
+
tooltip?: string;
|
|
85
|
+
/** Callback called after copying */
|
|
86
|
+
onCopy?: (value: string) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Custom cell config
|
|
90
|
+
*/
|
|
91
|
+
interface CustomCellConfig {
|
|
92
|
+
type: "custom";
|
|
93
|
+
/** Custom renderer function */
|
|
94
|
+
render: (context: CellContext<any, unknown>) => React$1.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Field cell config - her field için cell renderer tanımı
|
|
98
|
+
*/
|
|
99
|
+
type FieldCellConfig = StatusCellConfig | ProgressCellConfig | BooleanCellConfig | DateCellConfig | CurrencyCellConfig | CopyableCellConfig | CustomCellConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Global cell config - field bazlı cell renderer'ları tanımlar
|
|
102
|
+
*/
|
|
103
|
+
interface GlobalCellConfig {
|
|
104
|
+
/** Field bazlı cell config'leri - field adı -> config */
|
|
105
|
+
fields?: Record<string, FieldCellConfig>;
|
|
106
|
+
/** Default status colors - tüm status field'ları için geçerli */
|
|
107
|
+
defaultStatusColors?: Record<string, {
|
|
108
|
+
bg: string;
|
|
109
|
+
text: string;
|
|
110
|
+
darkBg?: string;
|
|
111
|
+
darkText?: string;
|
|
112
|
+
}>;
|
|
113
|
+
/** Auto-detect field types from field names and values (default: true) */
|
|
114
|
+
autoDetect?: boolean;
|
|
115
|
+
/** Field name patterns for auto-detection */
|
|
116
|
+
patterns?: {
|
|
117
|
+
/** Field names that should be treated as status (default: ['status', 'state', 'stage']) */
|
|
118
|
+
status?: string[];
|
|
119
|
+
/** Field names that should be treated as date (default: ['date', 'createdAt', 'updatedAt', 'joinDate', 'startDate', 'endDate']) */
|
|
120
|
+
date?: string[];
|
|
121
|
+
/** Field names that should be treated as currency (default: ['price', 'amount', 'salary', 'cost', 'revenue', 'total']) */
|
|
122
|
+
currency?: string[];
|
|
123
|
+
/** Field names that should be treated as boolean (default: ['isActive', 'isVerified', 'isEnabled', 'isDeleted']) */
|
|
124
|
+
boolean?: string[];
|
|
125
|
+
/** Field names that should be treated as copyable (default: ['id', 'email', 'phone', 'code', 'token']) */
|
|
126
|
+
copyable?: string[];
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get field config with auto-detection
|
|
131
|
+
*/
|
|
132
|
+
declare function getFieldConfig(fieldName: string, value: unknown, config?: GlobalCellConfig): FieldCellConfig | null;
|
|
133
|
+
/**
|
|
134
|
+
* Default global cell config
|
|
135
|
+
*/
|
|
136
|
+
declare const defaultGlobalCellConfig: GlobalCellConfig;
|
|
137
|
+
/**
|
|
138
|
+
* Cell renderer'ı çalıştırır
|
|
139
|
+
*/
|
|
140
|
+
declare function renderCell<TData>(context: CellContext<TData, unknown>, fieldName: string, config?: GlobalCellConfig): React$1.ReactNode;
|
|
141
|
+
|
|
15
142
|
/**
|
|
16
143
|
* All type definitions for LuxTable
|
|
17
144
|
*/
|
|
@@ -22,6 +149,10 @@ interface LuxTableOptions {
|
|
|
22
149
|
pageSize?: number;
|
|
23
150
|
/** Sorting feature (default: true) */
|
|
24
151
|
sorting?: boolean;
|
|
152
|
+
/** Multi-column sorting - hold Shift and click to sort by multiple columns (default: true) */
|
|
153
|
+
multiSort?: boolean;
|
|
154
|
+
/** Maximum number of columns that can be sorted at once (default: unlimited) */
|
|
155
|
+
maxMultiSortColCount?: number;
|
|
25
156
|
/** Column filtering feature (default: false) */
|
|
26
157
|
filtering?: boolean;
|
|
27
158
|
/** Row selection mode - "single": single select, "multiple": multi-select, "none": disabled */
|
|
@@ -36,14 +167,16 @@ interface LuxTableOptions {
|
|
|
36
167
|
showColumnVisibility?: boolean;
|
|
37
168
|
}
|
|
38
169
|
interface LuxTableProps<TData> {
|
|
39
|
-
/** Column definitions */
|
|
40
|
-
columns
|
|
170
|
+
/** Column definitions - if not provided, columns will be auto-generated from data */
|
|
171
|
+
columns?: ColumnDef<TData, any>[];
|
|
41
172
|
/** Table data */
|
|
42
173
|
data: TData[];
|
|
43
174
|
/** Additional CSS classes */
|
|
44
175
|
className?: string;
|
|
45
176
|
/** Table options */
|
|
46
177
|
options?: LuxTableOptions;
|
|
178
|
+
/** Global cell config - field bazlı otomatik cell renderer'ları tanımlar */
|
|
179
|
+
cellConfig?: GlobalCellConfig;
|
|
47
180
|
/** Controlled sorting state */
|
|
48
181
|
sorting?: SortingState;
|
|
49
182
|
/** Called when sorting changes */
|
|
@@ -62,8 +195,8 @@ interface LuxTableProps<TData> {
|
|
|
62
195
|
* Can be used in the meta field in column definitions
|
|
63
196
|
*/
|
|
64
197
|
interface ColumnMeta {
|
|
65
|
-
/** Filter type: text or
|
|
66
|
-
filterVariant?: "text" | "select";
|
|
198
|
+
/** Filter type: text, select, date, slider, or status */
|
|
199
|
+
filterVariant?: "text" | "select" | "date" | "slider" | "status";
|
|
67
200
|
}
|
|
68
201
|
/**
|
|
69
202
|
* Pagination information
|
|
@@ -107,21 +240,22 @@ interface PaginationInfo {
|
|
|
107
240
|
* />
|
|
108
241
|
* ```
|
|
109
242
|
*/
|
|
110
|
-
declare function LuxTable<TData>({ columns, data, className, options, sorting: controlledSorting, onSortingChange, rowSelection: controlledRowSelection, onRowSelectionChange, onSelectedRowsChange, getRowId, }: LuxTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
243
|
+
declare function LuxTable<TData>({ columns, data, className, options, cellConfig, sorting: controlledSorting, onSortingChange, rowSelection: controlledRowSelection, onRowSelectionChange, onSelectedRowsChange, getRowId, }: LuxTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
111
244
|
|
|
112
245
|
interface ColumnFilterProps<TData, TValue> {
|
|
113
246
|
column: Column<TData, TValue>;
|
|
247
|
+
data?: TData[];
|
|
114
248
|
}
|
|
115
249
|
/**
|
|
116
250
|
* Column filter component
|
|
117
|
-
*
|
|
251
|
+
* Supports multiple filter types: text, select, date, slider, status
|
|
118
252
|
*
|
|
119
253
|
* @example
|
|
120
254
|
* ```tsx
|
|
121
|
-
* <ColumnFilter column={column} />
|
|
255
|
+
* <ColumnFilter column={column} data={data} />
|
|
122
256
|
* ```
|
|
123
257
|
*/
|
|
124
|
-
declare function ColumnFilter<TData, TValue>({ column }: ColumnFilterProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
258
|
+
declare function ColumnFilter<TData, TValue>({ column, data }: ColumnFilterProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
125
259
|
|
|
126
260
|
interface TablePaginationProps<TData> {
|
|
127
261
|
table: Table$1<TData>;
|
|
@@ -162,6 +296,9 @@ interface LuxDataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttribu
|
|
|
162
296
|
column: Column<TData, TValue>;
|
|
163
297
|
title: string;
|
|
164
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Column header component with sort indicator and actions menu
|
|
301
|
+
*/
|
|
165
302
|
declare function LuxDataTableColumnHeader<TData, TValue>({ column, title, className, }: LuxDataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
166
303
|
|
|
167
304
|
declare const Table: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableElement> & React$1.RefAttributes<HTMLTableElement>>;
|
|
@@ -184,15 +321,6 @@ interface SortIconProps {
|
|
|
184
321
|
*/
|
|
185
322
|
declare function SortIcon({ direction }: SortIconProps): react_jsx_runtime.JSX.Element;
|
|
186
323
|
|
|
187
|
-
/**
|
|
188
|
-
* Default colors for Status Cell
|
|
189
|
-
*
|
|
190
|
-
* 4 values are defined for each status:
|
|
191
|
-
* - bg: Light theme background color
|
|
192
|
-
* - text: Light theme text color
|
|
193
|
-
* - darkBg: Dark theme background color
|
|
194
|
-
* - darkText: Dark theme text color
|
|
195
|
-
*/
|
|
196
324
|
declare const defaultStatusColors: Record<string, {
|
|
197
325
|
bg: string;
|
|
198
326
|
text: string;
|
|
@@ -206,10 +334,13 @@ interface StatusCellProps {
|
|
|
206
334
|
* Custom color definitions
|
|
207
335
|
* Used to override default colors or add new colors
|
|
208
336
|
*
|
|
337
|
+
* Note: CSS variables automatically handle dark mode, so darkBg and darkText are optional.
|
|
338
|
+
* You can use CSS variables like: bg-[hsl(var(--lux-status-active-bg))] or custom colors.
|
|
339
|
+
*
|
|
209
340
|
* @example
|
|
210
341
|
* ```tsx
|
|
211
342
|
* colors={{
|
|
212
|
-
* Custom: { bg: "bg-
|
|
343
|
+
* Custom: { bg: "bg-[hsl(var(--lux-status-active-bg))]", text: "text-[hsl(var(--lux-status-active-text))]" }
|
|
213
344
|
* }}
|
|
214
345
|
* ```
|
|
215
346
|
*/
|
|
@@ -343,12 +474,12 @@ interface BooleanCellProps {
|
|
|
343
474
|
falseLabel?: string;
|
|
344
475
|
/**
|
|
345
476
|
* True değeri için renk sınıfları
|
|
346
|
-
* @default
|
|
477
|
+
* @default Uses CSS variable: text-[hsl(var(--lux-boolean-true))]
|
|
347
478
|
*/
|
|
348
479
|
trueColor?: string;
|
|
349
480
|
/**
|
|
350
481
|
* False değeri için renk sınıfları
|
|
351
|
-
* @default
|
|
482
|
+
* @default Uses CSS variable: text-[hsl(var(--lux-boolean-false))]
|
|
352
483
|
*/
|
|
353
484
|
falseColor?: string;
|
|
354
485
|
}
|
|
@@ -638,7 +769,7 @@ declare function createCopyableCell(value: string | number, options?: Omit<Copya
|
|
|
638
769
|
|
|
639
770
|
declare const buttonVariants: (props?: ({
|
|
640
771
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
641
|
-
size?: "default" | "
|
|
772
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
642
773
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
643
774
|
declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
644
775
|
asChild?: boolean;
|
|
@@ -699,6 +830,8 @@ interface ColumnOptions<TData, TValue> {
|
|
|
699
830
|
id?: string;
|
|
700
831
|
header?: string | ((context: HeaderContext<TData, TValue>) => React$1.ReactNode);
|
|
701
832
|
cell?: (info: CellContext<TData, TValue>) => React$1.ReactNode;
|
|
833
|
+
/** Column width/size */
|
|
834
|
+
size?: number;
|
|
702
835
|
enableSorting?: boolean;
|
|
703
836
|
/** Column meta information (e.g. filterVariant) */
|
|
704
837
|
meta?: {
|
|
@@ -787,4 +920,4 @@ declare function createColumnsFromData<TData extends Record<string, unknown>>(da
|
|
|
787
920
|
cells?: Partial<Record<keyof TData, (info: CellContext<TData, unknown>) => React$1.ReactNode>>;
|
|
788
921
|
}): ColumnDef<TData, unknown>[];
|
|
789
922
|
|
|
790
|
-
export { BooleanCell, type BooleanCellProps, Button, Checkbox, ColumnFilter, type ColumnMeta, type ColumnOptions, type ColumnType, CopyableCell, type CopyableCellProps, CurrencyCell, type CurrencyCellProps, DateCell, type DateCellProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Label, LuxDataTableColumnHeader, LuxTable, type LuxTableOptions, type LuxTableProps, type PaginationInfo, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressCell, type ProgressCellProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, type SmartColumnOptions, SortIcon, type SortIconProps, StatusCell, type StatusCellProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, TableToolbar, buttonVariants, cn, createColumnHelper, createColumnsFromData, createCopyableCell, defaultStatusColors };
|
|
923
|
+
export { BooleanCell, type BooleanCellConfig, type BooleanCellProps, Button, type CellRendererType, Checkbox, ColumnFilter, type ColumnMeta, type ColumnOptions, type ColumnType, CopyableCell, type CopyableCellConfig, type CopyableCellProps, CurrencyCell, type CurrencyCellConfig, type CurrencyCellProps, type CustomCellConfig, DateCell, type DateCellConfig, type DateCellProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type FieldCellConfig, type GlobalCellConfig, Input, Label, LuxDataTableColumnHeader, LuxTable, type LuxTableOptions, type LuxTableProps, type PaginationInfo, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressCell, type ProgressCellConfig, type ProgressCellProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, type SmartColumnOptions, SortIcon, type SortIconProps, StatusCell, type StatusCellConfig, type StatusCellProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, TableToolbar, buttonVariants, cn, createColumnHelper, createColumnsFromData, createCopyableCell, defaultGlobalCellConfig, defaultStatusColors, getFieldConfig, renderCell };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ColumnDef, SortingState, RowSelectionState, Column, Table as Table$1, HeaderContext
|
|
2
|
+
import { CellContext, ColumnDef, SortingState, RowSelectionState, Column, Table as Table$1, HeaderContext } from '@tanstack/react-table';
|
|
3
3
|
export { ColumnDef, RowSelectionState, SortingState, flexRender, getCoreRowModel, getFilteredRowModel, getPaginationRowModel, getSortedRowModel } from '@tanstack/react-table';
|
|
4
4
|
import * as React$1 from 'react';
|
|
5
5
|
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
@@ -12,6 +12,133 @@ import * as SelectPrimitive from '@radix-ui/react-select';
|
|
|
12
12
|
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
13
13
|
import { ClassValue } from 'clsx';
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Cell renderer tipi
|
|
17
|
+
*/
|
|
18
|
+
type CellRendererType = "status" | "progress" | "boolean" | "date" | "currency" | "copyable" | "custom";
|
|
19
|
+
/**
|
|
20
|
+
* Status cell config
|
|
21
|
+
*/
|
|
22
|
+
interface StatusCellConfig {
|
|
23
|
+
type: "status";
|
|
24
|
+
/** Custom status colors - default status'leri override eder veya üzerine ekler */
|
|
25
|
+
colors?: Record<string, {
|
|
26
|
+
bg: string;
|
|
27
|
+
text: string;
|
|
28
|
+
darkBg?: string;
|
|
29
|
+
darkText?: string;
|
|
30
|
+
}>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Progress cell config
|
|
34
|
+
*/
|
|
35
|
+
interface ProgressCellConfig {
|
|
36
|
+
type: "progress";
|
|
37
|
+
/** Bar color */
|
|
38
|
+
barColor?: string;
|
|
39
|
+
/** Show percentage label */
|
|
40
|
+
showLabel?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Boolean cell config
|
|
44
|
+
*/
|
|
45
|
+
interface BooleanCellConfig {
|
|
46
|
+
type: "boolean";
|
|
47
|
+
/** True label */
|
|
48
|
+
trueLabel?: string;
|
|
49
|
+
/** False label */
|
|
50
|
+
falseLabel?: string;
|
|
51
|
+
/** True color classes */
|
|
52
|
+
trueColor?: string;
|
|
53
|
+
/** False color classes */
|
|
54
|
+
falseColor?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Date cell config
|
|
58
|
+
*/
|
|
59
|
+
interface DateCellConfig {
|
|
60
|
+
type: "date";
|
|
61
|
+
/** Date format */
|
|
62
|
+
format?: "short" | "long" | "relative";
|
|
63
|
+
/** Locale */
|
|
64
|
+
locale?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Currency cell config
|
|
68
|
+
*/
|
|
69
|
+
interface CurrencyCellConfig {
|
|
70
|
+
type: "currency";
|
|
71
|
+
/** Currency code (e.g., "USD", "EUR") */
|
|
72
|
+
currency?: string;
|
|
73
|
+
/** Locale */
|
|
74
|
+
locale?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Copyable cell config
|
|
78
|
+
*/
|
|
79
|
+
interface CopyableCellConfig {
|
|
80
|
+
type: "copyable";
|
|
81
|
+
/** Always show icon */
|
|
82
|
+
alwaysShowIcon?: boolean;
|
|
83
|
+
/** Tooltip text */
|
|
84
|
+
tooltip?: string;
|
|
85
|
+
/** Callback called after copying */
|
|
86
|
+
onCopy?: (value: string) => void;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Custom cell config
|
|
90
|
+
*/
|
|
91
|
+
interface CustomCellConfig {
|
|
92
|
+
type: "custom";
|
|
93
|
+
/** Custom renderer function */
|
|
94
|
+
render: (context: CellContext<any, unknown>) => React$1.ReactNode;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Field cell config - her field için cell renderer tanımı
|
|
98
|
+
*/
|
|
99
|
+
type FieldCellConfig = StatusCellConfig | ProgressCellConfig | BooleanCellConfig | DateCellConfig | CurrencyCellConfig | CopyableCellConfig | CustomCellConfig;
|
|
100
|
+
/**
|
|
101
|
+
* Global cell config - field bazlı cell renderer'ları tanımlar
|
|
102
|
+
*/
|
|
103
|
+
interface GlobalCellConfig {
|
|
104
|
+
/** Field bazlı cell config'leri - field adı -> config */
|
|
105
|
+
fields?: Record<string, FieldCellConfig>;
|
|
106
|
+
/** Default status colors - tüm status field'ları için geçerli */
|
|
107
|
+
defaultStatusColors?: Record<string, {
|
|
108
|
+
bg: string;
|
|
109
|
+
text: string;
|
|
110
|
+
darkBg?: string;
|
|
111
|
+
darkText?: string;
|
|
112
|
+
}>;
|
|
113
|
+
/** Auto-detect field types from field names and values (default: true) */
|
|
114
|
+
autoDetect?: boolean;
|
|
115
|
+
/** Field name patterns for auto-detection */
|
|
116
|
+
patterns?: {
|
|
117
|
+
/** Field names that should be treated as status (default: ['status', 'state', 'stage']) */
|
|
118
|
+
status?: string[];
|
|
119
|
+
/** Field names that should be treated as date (default: ['date', 'createdAt', 'updatedAt', 'joinDate', 'startDate', 'endDate']) */
|
|
120
|
+
date?: string[];
|
|
121
|
+
/** Field names that should be treated as currency (default: ['price', 'amount', 'salary', 'cost', 'revenue', 'total']) */
|
|
122
|
+
currency?: string[];
|
|
123
|
+
/** Field names that should be treated as boolean (default: ['isActive', 'isVerified', 'isEnabled', 'isDeleted']) */
|
|
124
|
+
boolean?: string[];
|
|
125
|
+
/** Field names that should be treated as copyable (default: ['id', 'email', 'phone', 'code', 'token']) */
|
|
126
|
+
copyable?: string[];
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Get field config with auto-detection
|
|
131
|
+
*/
|
|
132
|
+
declare function getFieldConfig(fieldName: string, value: unknown, config?: GlobalCellConfig): FieldCellConfig | null;
|
|
133
|
+
/**
|
|
134
|
+
* Default global cell config
|
|
135
|
+
*/
|
|
136
|
+
declare const defaultGlobalCellConfig: GlobalCellConfig;
|
|
137
|
+
/**
|
|
138
|
+
* Cell renderer'ı çalıştırır
|
|
139
|
+
*/
|
|
140
|
+
declare function renderCell<TData>(context: CellContext<TData, unknown>, fieldName: string, config?: GlobalCellConfig): React$1.ReactNode;
|
|
141
|
+
|
|
15
142
|
/**
|
|
16
143
|
* All type definitions for LuxTable
|
|
17
144
|
*/
|
|
@@ -22,6 +149,10 @@ interface LuxTableOptions {
|
|
|
22
149
|
pageSize?: number;
|
|
23
150
|
/** Sorting feature (default: true) */
|
|
24
151
|
sorting?: boolean;
|
|
152
|
+
/** Multi-column sorting - hold Shift and click to sort by multiple columns (default: true) */
|
|
153
|
+
multiSort?: boolean;
|
|
154
|
+
/** Maximum number of columns that can be sorted at once (default: unlimited) */
|
|
155
|
+
maxMultiSortColCount?: number;
|
|
25
156
|
/** Column filtering feature (default: false) */
|
|
26
157
|
filtering?: boolean;
|
|
27
158
|
/** Row selection mode - "single": single select, "multiple": multi-select, "none": disabled */
|
|
@@ -36,14 +167,16 @@ interface LuxTableOptions {
|
|
|
36
167
|
showColumnVisibility?: boolean;
|
|
37
168
|
}
|
|
38
169
|
interface LuxTableProps<TData> {
|
|
39
|
-
/** Column definitions */
|
|
40
|
-
columns
|
|
170
|
+
/** Column definitions - if not provided, columns will be auto-generated from data */
|
|
171
|
+
columns?: ColumnDef<TData, any>[];
|
|
41
172
|
/** Table data */
|
|
42
173
|
data: TData[];
|
|
43
174
|
/** Additional CSS classes */
|
|
44
175
|
className?: string;
|
|
45
176
|
/** Table options */
|
|
46
177
|
options?: LuxTableOptions;
|
|
178
|
+
/** Global cell config - field bazlı otomatik cell renderer'ları tanımlar */
|
|
179
|
+
cellConfig?: GlobalCellConfig;
|
|
47
180
|
/** Controlled sorting state */
|
|
48
181
|
sorting?: SortingState;
|
|
49
182
|
/** Called when sorting changes */
|
|
@@ -62,8 +195,8 @@ interface LuxTableProps<TData> {
|
|
|
62
195
|
* Can be used in the meta field in column definitions
|
|
63
196
|
*/
|
|
64
197
|
interface ColumnMeta {
|
|
65
|
-
/** Filter type: text or
|
|
66
|
-
filterVariant?: "text" | "select";
|
|
198
|
+
/** Filter type: text, select, date, slider, or status */
|
|
199
|
+
filterVariant?: "text" | "select" | "date" | "slider" | "status";
|
|
67
200
|
}
|
|
68
201
|
/**
|
|
69
202
|
* Pagination information
|
|
@@ -107,21 +240,22 @@ interface PaginationInfo {
|
|
|
107
240
|
* />
|
|
108
241
|
* ```
|
|
109
242
|
*/
|
|
110
|
-
declare function LuxTable<TData>({ columns, data, className, options, sorting: controlledSorting, onSortingChange, rowSelection: controlledRowSelection, onRowSelectionChange, onSelectedRowsChange, getRowId, }: LuxTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
243
|
+
declare function LuxTable<TData>({ columns, data, className, options, cellConfig, sorting: controlledSorting, onSortingChange, rowSelection: controlledRowSelection, onRowSelectionChange, onSelectedRowsChange, getRowId, }: LuxTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
111
244
|
|
|
112
245
|
interface ColumnFilterProps<TData, TValue> {
|
|
113
246
|
column: Column<TData, TValue>;
|
|
247
|
+
data?: TData[];
|
|
114
248
|
}
|
|
115
249
|
/**
|
|
116
250
|
* Column filter component
|
|
117
|
-
*
|
|
251
|
+
* Supports multiple filter types: text, select, date, slider, status
|
|
118
252
|
*
|
|
119
253
|
* @example
|
|
120
254
|
* ```tsx
|
|
121
|
-
* <ColumnFilter column={column} />
|
|
255
|
+
* <ColumnFilter column={column} data={data} />
|
|
122
256
|
* ```
|
|
123
257
|
*/
|
|
124
|
-
declare function ColumnFilter<TData, TValue>({ column }: ColumnFilterProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
258
|
+
declare function ColumnFilter<TData, TValue>({ column, data }: ColumnFilterProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
125
259
|
|
|
126
260
|
interface TablePaginationProps<TData> {
|
|
127
261
|
table: Table$1<TData>;
|
|
@@ -162,6 +296,9 @@ interface LuxDataTableColumnHeaderProps<TData, TValue> extends React.HTMLAttribu
|
|
|
162
296
|
column: Column<TData, TValue>;
|
|
163
297
|
title: string;
|
|
164
298
|
}
|
|
299
|
+
/**
|
|
300
|
+
* Column header component with sort indicator and actions menu
|
|
301
|
+
*/
|
|
165
302
|
declare function LuxDataTableColumnHeader<TData, TValue>({ column, title, className, }: LuxDataTableColumnHeaderProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
166
303
|
|
|
167
304
|
declare const Table: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLTableElement> & React$1.RefAttributes<HTMLTableElement>>;
|
|
@@ -184,15 +321,6 @@ interface SortIconProps {
|
|
|
184
321
|
*/
|
|
185
322
|
declare function SortIcon({ direction }: SortIconProps): react_jsx_runtime.JSX.Element;
|
|
186
323
|
|
|
187
|
-
/**
|
|
188
|
-
* Default colors for Status Cell
|
|
189
|
-
*
|
|
190
|
-
* 4 values are defined for each status:
|
|
191
|
-
* - bg: Light theme background color
|
|
192
|
-
* - text: Light theme text color
|
|
193
|
-
* - darkBg: Dark theme background color
|
|
194
|
-
* - darkText: Dark theme text color
|
|
195
|
-
*/
|
|
196
324
|
declare const defaultStatusColors: Record<string, {
|
|
197
325
|
bg: string;
|
|
198
326
|
text: string;
|
|
@@ -206,10 +334,13 @@ interface StatusCellProps {
|
|
|
206
334
|
* Custom color definitions
|
|
207
335
|
* Used to override default colors or add new colors
|
|
208
336
|
*
|
|
337
|
+
* Note: CSS variables automatically handle dark mode, so darkBg and darkText are optional.
|
|
338
|
+
* You can use CSS variables like: bg-[hsl(var(--lux-status-active-bg))] or custom colors.
|
|
339
|
+
*
|
|
209
340
|
* @example
|
|
210
341
|
* ```tsx
|
|
211
342
|
* colors={{
|
|
212
|
-
* Custom: { bg: "bg-
|
|
343
|
+
* Custom: { bg: "bg-[hsl(var(--lux-status-active-bg))]", text: "text-[hsl(var(--lux-status-active-text))]" }
|
|
213
344
|
* }}
|
|
214
345
|
* ```
|
|
215
346
|
*/
|
|
@@ -343,12 +474,12 @@ interface BooleanCellProps {
|
|
|
343
474
|
falseLabel?: string;
|
|
344
475
|
/**
|
|
345
476
|
* True değeri için renk sınıfları
|
|
346
|
-
* @default
|
|
477
|
+
* @default Uses CSS variable: text-[hsl(var(--lux-boolean-true))]
|
|
347
478
|
*/
|
|
348
479
|
trueColor?: string;
|
|
349
480
|
/**
|
|
350
481
|
* False değeri için renk sınıfları
|
|
351
|
-
* @default
|
|
482
|
+
* @default Uses CSS variable: text-[hsl(var(--lux-boolean-false))]
|
|
352
483
|
*/
|
|
353
484
|
falseColor?: string;
|
|
354
485
|
}
|
|
@@ -638,7 +769,7 @@ declare function createCopyableCell(value: string | number, options?: Omit<Copya
|
|
|
638
769
|
|
|
639
770
|
declare const buttonVariants: (props?: ({
|
|
640
771
|
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
641
|
-
size?: "default" | "
|
|
772
|
+
size?: "default" | "icon" | "sm" | "lg" | "icon-sm" | "icon-lg" | null | undefined;
|
|
642
773
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
643
774
|
declare function Button({ className, variant, size, asChild, ...props }: React$1.ComponentProps<"button"> & VariantProps<typeof buttonVariants> & {
|
|
644
775
|
asChild?: boolean;
|
|
@@ -699,6 +830,8 @@ interface ColumnOptions<TData, TValue> {
|
|
|
699
830
|
id?: string;
|
|
700
831
|
header?: string | ((context: HeaderContext<TData, TValue>) => React$1.ReactNode);
|
|
701
832
|
cell?: (info: CellContext<TData, TValue>) => React$1.ReactNode;
|
|
833
|
+
/** Column width/size */
|
|
834
|
+
size?: number;
|
|
702
835
|
enableSorting?: boolean;
|
|
703
836
|
/** Column meta information (e.g. filterVariant) */
|
|
704
837
|
meta?: {
|
|
@@ -787,4 +920,4 @@ declare function createColumnsFromData<TData extends Record<string, unknown>>(da
|
|
|
787
920
|
cells?: Partial<Record<keyof TData, (info: CellContext<TData, unknown>) => React$1.ReactNode>>;
|
|
788
921
|
}): ColumnDef<TData, unknown>[];
|
|
789
922
|
|
|
790
|
-
export { BooleanCell, type BooleanCellProps, Button, Checkbox, ColumnFilter, type ColumnMeta, type ColumnOptions, type ColumnType, CopyableCell, type CopyableCellProps, CurrencyCell, type CurrencyCellProps, DateCell, type DateCellProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Label, LuxDataTableColumnHeader, LuxTable, type LuxTableOptions, type LuxTableProps, type PaginationInfo, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressCell, type ProgressCellProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, type SmartColumnOptions, SortIcon, type SortIconProps, StatusCell, type StatusCellProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, TableToolbar, buttonVariants, cn, createColumnHelper, createColumnsFromData, createCopyableCell, defaultStatusColors };
|
|
923
|
+
export { BooleanCell, type BooleanCellConfig, type BooleanCellProps, Button, type CellRendererType, Checkbox, ColumnFilter, type ColumnMeta, type ColumnOptions, type ColumnType, CopyableCell, type CopyableCellConfig, type CopyableCellProps, CurrencyCell, type CurrencyCellConfig, type CurrencyCellProps, type CustomCellConfig, DateCell, type DateCellConfig, type DateCellProps, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, type FieldCellConfig, type GlobalCellConfig, Input, Label, LuxDataTableColumnHeader, LuxTable, type LuxTableOptions, type LuxTableProps, type PaginationInfo, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, ProgressCell, type ProgressCellConfig, type ProgressCellProps, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, type SmartColumnOptions, SortIcon, type SortIconProps, StatusCell, type StatusCellConfig, type StatusCellProps, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TablePagination, TableRow, TableToolbar, buttonVariants, cn, createColumnHelper, createColumnsFromData, createCopyableCell, defaultGlobalCellConfig, defaultStatusColors, getFieldConfig, renderCell };
|