@expcat/tigercat-core 1.0.7 → 1.1.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.
Files changed (107) hide show
  1. package/dist/datepicker-DXzS_8l8.d.cts +130 -0
  2. package/dist/datepicker-DXzS_8l8.d.ts +130 -0
  3. package/dist/datepicker-locales/en-US.cjs +23 -0
  4. package/dist/datepicker-locales/en-US.d.cts +6 -0
  5. package/dist/datepicker-locales/en-US.d.ts +6 -0
  6. package/dist/datepicker-locales/en-US.js +17 -0
  7. package/dist/datepicker-locales/id-ID.cjs +23 -0
  8. package/dist/datepicker-locales/id-ID.d.cts +6 -0
  9. package/dist/datepicker-locales/id-ID.d.ts +6 -0
  10. package/dist/datepicker-locales/id-ID.js +17 -0
  11. package/dist/datepicker-locales/ja-JP.cjs +23 -0
  12. package/dist/datepicker-locales/ja-JP.d.cts +6 -0
  13. package/dist/datepicker-locales/ja-JP.d.ts +6 -0
  14. package/dist/datepicker-locales/ja-JP.js +17 -0
  15. package/dist/datepicker-locales/ko-KR.cjs +23 -0
  16. package/dist/datepicker-locales/ko-KR.d.cts +6 -0
  17. package/dist/datepicker-locales/ko-KR.d.ts +6 -0
  18. package/dist/datepicker-locales/ko-KR.js +17 -0
  19. package/dist/datepicker-locales/th-TH.cjs +23 -0
  20. package/dist/datepicker-locales/th-TH.d.cts +6 -0
  21. package/dist/datepicker-locales/th-TH.d.ts +6 -0
  22. package/dist/datepicker-locales/th-TH.js +17 -0
  23. package/dist/datepicker-locales/vi-VN.cjs +23 -0
  24. package/dist/datepicker-locales/vi-VN.d.cts +6 -0
  25. package/dist/datepicker-locales/vi-VN.d.ts +6 -0
  26. package/dist/datepicker-locales/vi-VN.js +17 -0
  27. package/dist/datepicker-locales/zh-CN.cjs +23 -0
  28. package/dist/datepicker-locales/zh-CN.d.cts +6 -0
  29. package/dist/datepicker-locales/zh-CN.d.ts +6 -0
  30. package/dist/datepicker-locales/zh-CN.js +17 -0
  31. package/dist/datepicker-locales/zh-TW.cjs +23 -0
  32. package/dist/datepicker-locales/zh-TW.d.cts +6 -0
  33. package/dist/datepicker-locales/zh-TW.d.ts +6 -0
  34. package/dist/datepicker-locales/zh-TW.js +17 -0
  35. package/dist/icons/common.cjs +22 -0
  36. package/dist/icons/common.d.cts +20 -0
  37. package/dist/icons/common.d.ts +20 -0
  38. package/dist/icons/common.js +12 -0
  39. package/dist/icons/picker.cjs +36 -0
  40. package/dist/icons/picker.d.cts +53 -0
  41. package/dist/icons/picker.d.ts +53 -0
  42. package/dist/icons/picker.js +19 -0
  43. package/dist/icons/status.cjs +19 -0
  44. package/dist/icons/status.d.cts +13 -0
  45. package/dist/icons/status.d.ts +13 -0
  46. package/dist/icons/status.js +13 -0
  47. package/dist/icons/table.cjs +18 -0
  48. package/dist/icons/table.d.cts +25 -0
  49. package/dist/icons/table.d.ts +25 -0
  50. package/dist/icons/table.js +10 -0
  51. package/dist/index.cjs +4730 -3533
  52. package/dist/index.d.cts +1907 -1201
  53. package/dist/index.d.ts +1907 -1201
  54. package/dist/index.js +3231 -2196
  55. package/dist/locale-CEmE5uq-.d.cts +92 -0
  56. package/dist/locale-m1sF4KRO.d.ts +92 -0
  57. package/dist/locales/en-US.cjs +43 -0
  58. package/dist/locales/en-US.d.cts +10 -0
  59. package/dist/locales/en-US.d.ts +10 -0
  60. package/dist/locales/en-US.js +41 -0
  61. package/dist/locales/id-ID.cjs +43 -0
  62. package/dist/locales/id-ID.d.cts +10 -0
  63. package/dist/locales/id-ID.d.ts +10 -0
  64. package/dist/locales/id-ID.js +41 -0
  65. package/dist/locales/ja-JP.cjs +43 -0
  66. package/dist/locales/ja-JP.d.cts +10 -0
  67. package/dist/locales/ja-JP.d.ts +10 -0
  68. package/dist/locales/ja-JP.js +41 -0
  69. package/dist/locales/ko-KR.cjs +43 -0
  70. package/dist/locales/ko-KR.d.cts +10 -0
  71. package/dist/locales/ko-KR.d.ts +10 -0
  72. package/dist/locales/ko-KR.js +41 -0
  73. package/dist/locales/th-TH.cjs +43 -0
  74. package/dist/locales/th-TH.d.cts +10 -0
  75. package/dist/locales/th-TH.d.ts +10 -0
  76. package/dist/locales/th-TH.js +41 -0
  77. package/dist/locales/vi-VN.cjs +43 -0
  78. package/dist/locales/vi-VN.d.cts +10 -0
  79. package/dist/locales/vi-VN.d.ts +10 -0
  80. package/dist/locales/vi-VN.js +41 -0
  81. package/dist/locales/zh-CN.cjs +43 -0
  82. package/dist/locales/zh-CN.d.cts +10 -0
  83. package/dist/locales/zh-CN.d.ts +10 -0
  84. package/dist/locales/zh-CN.js +41 -0
  85. package/dist/locales/zh-TW.cjs +43 -0
  86. package/dist/locales/zh-TW.d.cts +10 -0
  87. package/dist/locales/zh-TW.d.ts +10 -0
  88. package/dist/locales/zh-TW.js +41 -0
  89. package/dist/table-export-Cy9DgTiO.d.cts +458 -0
  90. package/dist/table-export-Cy9DgTiO.d.ts +458 -0
  91. package/dist/tailwind/modern.cjs +290 -0
  92. package/dist/tailwind/modern.d.cts +6 -0
  93. package/dist/tailwind/modern.d.ts +6 -0
  94. package/dist/tailwind/modern.js +284 -0
  95. package/dist/tailwind-entry-2KPvkOin.d.ts +218 -0
  96. package/dist/tailwind-entry-CUaMC8Ma.d.cts +218 -0
  97. package/dist/tailwind.cjs +141 -0
  98. package/dist/tailwind.d.cts +3 -0
  99. package/dist/tailwind.d.ts +3 -0
  100. package/dist/tailwind.js +135 -0
  101. package/dist/types-CJYAW1ql.d-DDBFn6KB.d.cts +126 -0
  102. package/dist/types-CJYAW1ql.d-DDBFn6KB.d.ts +126 -0
  103. package/dist/utils/table-export.cjs +38 -0
  104. package/dist/utils/table-export.d.cts +1 -0
  105. package/dist/utils/table-export.d.ts +1 -0
  106. package/dist/utils/table-export.js +34 -0
  107. package/package.json +131 -7
@@ -0,0 +1,458 @@
1
+ /**
2
+ * Table component types and interfaces
3
+ */
4
+ /**
5
+ * Table size types
6
+ */
7
+ type TableSize = 'sm' | 'md' | 'lg';
8
+ /**
9
+ * Sort direction
10
+ */
11
+ type SortDirection = 'asc' | 'desc' | null;
12
+ /**
13
+ * Sort state
14
+ */
15
+ interface SortState {
16
+ /**
17
+ * Column key to sort by
18
+ */
19
+ key: string | null;
20
+ /**
21
+ * Sort direction
22
+ */
23
+ direction: SortDirection;
24
+ }
25
+ /**
26
+ * Column alignment
27
+ */
28
+ type ColumnAlign = 'left' | 'center' | 'right';
29
+ /**
30
+ * Filter type
31
+ */
32
+ type FilterType = 'text' | 'select' | 'custom';
33
+ /**
34
+ * Filter option for select filter
35
+ */
36
+ interface FilterOption {
37
+ /**
38
+ * Option label
39
+ */
40
+ label: string;
41
+ /**
42
+ * Option value
43
+ */
44
+ value: string | number;
45
+ }
46
+ /**
47
+ * Column filter configuration
48
+ */
49
+ interface ColumnFilter {
50
+ /**
51
+ * Filter type
52
+ * @default 'text'
53
+ */
54
+ type?: FilterType;
55
+ /**
56
+ * Filter options (for select type)
57
+ */
58
+ options?: FilterOption[];
59
+ /**
60
+ * Placeholder text
61
+ */
62
+ placeholder?: string;
63
+ /**
64
+ * Custom filter function
65
+ * @param value - Cell value
66
+ * @param filterValue - Current filter value
67
+ * @returns Whether the row should be shown
68
+ */
69
+ filterFn?: (value: unknown, filterValue: unknown) => boolean;
70
+ }
71
+ /**
72
+ * Table column configuration
73
+ */
74
+ interface TableColumn<T = Record<string, unknown>> {
75
+ /**
76
+ * Column key (must be unique)
77
+ */
78
+ key: string;
79
+ /**
80
+ * Column title/header text
81
+ */
82
+ title: string;
83
+ /**
84
+ * Data key to access in row object
85
+ * If not provided, uses `key`
86
+ */
87
+ dataKey?: string;
88
+ /**
89
+ * Column width (CSS value)
90
+ */
91
+ width?: string | number;
92
+ /**
93
+ * Column alignment
94
+ * @default 'left'
95
+ */
96
+ align?: ColumnAlign;
97
+ /**
98
+ * Whether column is sortable
99
+ * @default false
100
+ */
101
+ sortable?: boolean;
102
+ /**
103
+ * Custom sort function
104
+ * @param a - First value
105
+ * @param b - Second value
106
+ * @returns Sort comparison result
107
+ */
108
+ sortFn?: (a: unknown, b: unknown) => number;
109
+ /**
110
+ * Column filter configuration
111
+ */
112
+ filter?: ColumnFilter;
113
+ /**
114
+ * Whether column is fixed
115
+ * @default false
116
+ */
117
+ fixed?: 'left' | 'right' | false;
118
+ /**
119
+ * Custom render function for cell content
120
+ * Framework-specific implementations will handle this differently
121
+ */
122
+ render?: (record: T, index: number) => unknown;
123
+ /**
124
+ * Custom render function for header
125
+ */
126
+ renderHeader?: () => unknown;
127
+ /**
128
+ * CSS class for column cells
129
+ */
130
+ className?: string;
131
+ /**
132
+ * CSS class for header cell
133
+ */
134
+ headerClassName?: string;
135
+ }
136
+ /**
137
+ * Pagination configuration
138
+ */
139
+ interface PaginationConfig {
140
+ /**
141
+ * Current page number (1-indexed)
142
+ * @default 1
143
+ */
144
+ current?: number;
145
+ /**
146
+ * Default current page number (1-indexed) for uncontrolled mode.
147
+ * Used when `current` is not provided.
148
+ * @default 1
149
+ */
150
+ defaultCurrent?: number;
151
+ /**
152
+ * Number of items per page
153
+ * @default 10
154
+ */
155
+ pageSize?: number;
156
+ /**
157
+ * Default page size for uncontrolled mode.
158
+ * Used when `pageSize` is not provided.
159
+ * @default 10
160
+ */
161
+ defaultPageSize?: number;
162
+ /**
163
+ * Total number of items
164
+ */
165
+ total?: number;
166
+ /**
167
+ * Available page size options
168
+ * @default [10, 20, 50, 100]
169
+ */
170
+ pageSizeOptions?: number[];
171
+ /**
172
+ * Whether to show page size selector
173
+ * @default true
174
+ */
175
+ showSizeChanger?: boolean;
176
+ /**
177
+ * Whether to show total count
178
+ * @default true
179
+ */
180
+ showTotal?: boolean;
181
+ /**
182
+ * Custom total text render function
183
+ */
184
+ totalText?: (total: number, range: [number, number]) => string;
185
+ }
186
+ /**
187
+ * Table row selection configuration
188
+ */
189
+ interface RowSelectionConfig<T = Record<string, unknown>> {
190
+ /**
191
+ * Selected row keys
192
+ */
193
+ selectedRowKeys?: (string | number)[];
194
+ /**
195
+ * Default selected row keys for uncontrolled mode.
196
+ * Used when `selectedRowKeys` is not provided.
197
+ */
198
+ defaultSelectedRowKeys?: (string | number)[];
199
+ /**
200
+ * Function to get row key
201
+ * @default (record) => record.id
202
+ */
203
+ getRowKey?: (record: T) => string | number;
204
+ /**
205
+ * Whether to show checkbox column
206
+ * @default true
207
+ */
208
+ showCheckbox?: boolean;
209
+ /**
210
+ * Selection type
211
+ * @default 'checkbox'
212
+ */
213
+ type?: 'checkbox' | 'radio';
214
+ /**
215
+ * Function to determine if row can be selected
216
+ */
217
+ getCheckboxProps?: (record: T) => {
218
+ disabled?: boolean;
219
+ };
220
+ }
221
+ /**
222
+ * Table row expansion configuration
223
+ */
224
+ interface ExpandableConfig<T = Record<string, unknown>> {
225
+ /**
226
+ * Currently expanded row keys (controlled mode).
227
+ * When provided, internal expand state will not be mutated.
228
+ */
229
+ expandedRowKeys?: (string | number)[];
230
+ /**
231
+ * Default expanded row keys for uncontrolled mode.
232
+ * Used when `expandedRowKeys` is not provided.
233
+ */
234
+ defaultExpandedRowKeys?: (string | number)[];
235
+ /**
236
+ * Render function for expanded row content.
237
+ * Framework-specific implementations may also support slots/children.
238
+ */
239
+ expandedRowRender?: (record: T, index: number) => unknown;
240
+ /**
241
+ * Determine whether a row is expandable.
242
+ * Return false to hide the expand icon for that row.
243
+ * @default () => true
244
+ */
245
+ rowExpandable?: (record: T) => boolean;
246
+ /**
247
+ * Whether clicking the entire row toggles expand state.
248
+ * When false, only clicking the expand icon triggers expansion.
249
+ * @default false
250
+ */
251
+ expandRowByClick?: boolean;
252
+ /**
253
+ * Position of the expand toggle column.
254
+ * @default 'start'
255
+ */
256
+ expandIconPosition?: 'start' | 'end';
257
+ }
258
+ /**
259
+ * Base table props interface
260
+ */
261
+ interface TableProps<T = Record<string, unknown>> {
262
+ /**
263
+ * Table columns configuration
264
+ */
265
+ columns: TableColumn<T>[];
266
+ /**
267
+ * Whether to show a lock button in each column header.
268
+ * Clicking the lock toggles the column fixed state.
269
+ * @default false
270
+ */
271
+ columnLockable?: boolean;
272
+ /**
273
+ * Table data source
274
+ * @default []
275
+ */
276
+ dataSource?: T[];
277
+ /**
278
+ * Controlled sort state.
279
+ * When provided, internal sort state will not be mutated.
280
+ */
281
+ sort?: SortState;
282
+ /**
283
+ * Default sort state for uncontrolled mode.
284
+ */
285
+ defaultSort?: SortState;
286
+ /**
287
+ * Controlled filters.
288
+ * When provided, internal filter state will not be mutated.
289
+ */
290
+ filters?: Record<string, unknown>;
291
+ /**
292
+ * Default filters for uncontrolled mode.
293
+ */
294
+ defaultFilters?: Record<string, unknown>;
295
+ /**
296
+ * Table size
297
+ * @default 'md'
298
+ */
299
+ size?: TableSize;
300
+ /**
301
+ * Whether to show border
302
+ * @default false
303
+ */
304
+ bordered?: boolean;
305
+ /**
306
+ * Whether to show striped rows
307
+ * @default false
308
+ */
309
+ striped?: boolean;
310
+ /**
311
+ * Whether to highlight row on hover
312
+ * @default true
313
+ */
314
+ hoverable?: boolean;
315
+ /**
316
+ * Loading state
317
+ * @default false
318
+ */
319
+ loading?: boolean;
320
+ /**
321
+ * Empty state text
322
+ * @default 'No data'
323
+ */
324
+ emptyText?: string;
325
+ /**
326
+ * Pagination configuration
327
+ * Set to false to disable pagination
328
+ */
329
+ pagination?: PaginationConfig | false;
330
+ /**
331
+ * Row selection configuration
332
+ */
333
+ rowSelection?: RowSelectionConfig<T>;
334
+ /**
335
+ * Row expansion configuration.
336
+ * Adds an expand toggle column and renders expanded content below each row.
337
+ */
338
+ expandable?: ExpandableConfig<T>;
339
+ /**
340
+ * Function to get row key
341
+ * @default (record) => record.id
342
+ */
343
+ rowKey?: string | ((record: T) => string | number);
344
+ /**
345
+ * Custom row class name
346
+ */
347
+ rowClassName?: string | ((record: T, index: number) => string);
348
+ /**
349
+ * Whether table head is sticky
350
+ * @default false
351
+ */
352
+ stickyHeader?: boolean;
353
+ /**
354
+ * Max height for scrollable table
355
+ */
356
+ maxHeight?: string | number;
357
+ /**
358
+ * Table layout algorithm
359
+ * @default 'auto'
360
+ */
361
+ tableLayout?: 'auto' | 'fixed';
362
+ /**
363
+ * Enable virtual scrolling for large datasets
364
+ * @default false
365
+ */
366
+ virtual?: boolean;
367
+ /**
368
+ * Virtual scroll viewport height (px)
369
+ * @default 400
370
+ */
371
+ virtualHeight?: number;
372
+ /**
373
+ * Virtual scroll row height (px)
374
+ * @default 40
375
+ */
376
+ virtualItemHeight?: number;
377
+ /**
378
+ * Row count at which Table marks virtual rendering as recommended.
379
+ * Table does not enable virtualization automatically; use this signal to
380
+ * switch to `virtual` or the dedicated `VirtualTable` component.
381
+ * @default 1000
382
+ */
383
+ virtualThreshold?: number;
384
+ /**
385
+ * Enable cell editing
386
+ * @default false
387
+ */
388
+ editable?: boolean;
389
+ /**
390
+ * Set of editable cells: Map<columnKey, Set<rowIndex>>
391
+ * If not provided and editable=true, all cells are editable
392
+ */
393
+ editableCells?: Map<string, Set<number>>;
394
+ /**
395
+ * Filter mode
396
+ * @default 'basic'
397
+ */
398
+ filterMode?: 'basic' | 'advanced';
399
+ /**
400
+ * Advanced filter rules (used when filterMode='advanced')
401
+ */
402
+ advancedFilterRules?: FilterRule[];
403
+ /**
404
+ * Enable column drag reorder
405
+ * @default false
406
+ */
407
+ columnDraggable?: boolean;
408
+ /**
409
+ * Summary row configuration
410
+ */
411
+ summaryRow?: {
412
+ show: boolean;
413
+ data: Record<string, unknown>;
414
+ };
415
+ /**
416
+ * Group rows by column key
417
+ */
418
+ groupBy?: string;
419
+ /**
420
+ * Enable CSV export
421
+ * @default false
422
+ */
423
+ exportable?: boolean;
424
+ /**
425
+ * Export filename (without extension)
426
+ * @default 'export'
427
+ */
428
+ exportFilename?: string;
429
+ }
430
+ /**
431
+ * Filter rule for advanced filtering
432
+ */
433
+ interface FilterRule {
434
+ column: string;
435
+ operator: 'equals' | 'contains' | 'gt' | 'lt' | 'between' | 'notEquals';
436
+ value: unknown;
437
+ valueTo?: unknown;
438
+ logic?: 'and' | 'or';
439
+ }
440
+
441
+ /**
442
+ * Table export utilities (CSV)
443
+ */
444
+
445
+ /**
446
+ * Export table data to CSV string
447
+ */
448
+ declare function exportTableToCsv<T>(columns: TableColumn<T>[], data: T[], _filename?: string): string;
449
+ /**
450
+ * Trigger a CSV file download in the browser
451
+ */
452
+ declare function downloadCsv(csvContent: string, filename?: string): void;
453
+ /**
454
+ * Get export button classes
455
+ */
456
+ declare const tableExportButtonClasses = "inline-flex items-center gap-1.5 px-3 py-1.5 text-sm font-medium rounded-[var(--tiger-radius-md,0.5rem)] border border-[var(--tiger-border,#e5e7eb)] text-[var(--tiger-text,#111827)] bg-[var(--tiger-surface,#ffffff)] hover:bg-[var(--tiger-surface-muted,#f9fafb)] transition-colors";
457
+
458
+ export { type ColumnAlign as C, type ExpandableConfig as E, type FilterOption as F, type PaginationConfig as P, type RowSelectionConfig as R, type SortDirection as S, type TableColumn as T, type TableSize as a, type TableProps as b, type FilterRule as c, type ColumnFilter as d, type SortState as e, exportTableToCsv as f, downloadCsv as g, type FilterType as h, tableExportButtonClasses as t };