@catalystsoftware/ui 1.0.5 → 1.0.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.
Files changed (155) hide show
  1. package/dist/data/data.tsx +29 -29
  2. package/dist/data/tailwind.config.js +3821 -261
  3. package/dist/data.tsx +29 -29
  4. package/package.json +4 -3
  5. package/components/catalyst-ui/buttons/burger.tsx +0 -207
  6. package/components/catalyst-ui/core/data-display/timeline.tsx +0 -210
  7. package/components/catalyst-ui/core/feedback/alert.tsx +0 -491
  8. package/components/catalyst-ui/core/feedback/spinner-1.tsx +0 -65
  9. package/components/catalyst-ui/core/feedback/toast.tsx +0 -1857
  10. package/components/catalyst-ui/core/navigation/menu.tsx +0 -164
  11. package/components/catalyst-ui/forms/toggle-class.tsx +0 -176
  12. package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +0 -419
  13. package/components/catalyst-ui/hooks/use-counter.tsx +0 -13
  14. package/components/catalyst-ui/hooks/use-event-listener.tsx +0 -23
  15. package/components/catalyst-ui/hooks/use-export-markdown.tsx +0 -47
  16. package/components/catalyst-ui/hooks/use-focus.tsx +0 -17
  17. package/components/catalyst-ui/hooks/use-interval.tsx +0 -23
  18. package/components/catalyst-ui/hooks/use-is-client.tsx +0 -16
  19. package/components/catalyst-ui/hooks/use-media-query.tsx +0 -19
  20. package/components/catalyst-ui/hooks/use-mobile.tsx +0 -19
  21. package/components/catalyst-ui/hooks/use-resize-observer.tsx +0 -81
  22. package/components/catalyst-ui/hooks/use-timeout.tsx +0 -21
  23. package/components/catalyst-ui/hooks/use-timer.tsx +0 -209
  24. package/components/catalyst-ui/hooks/use-toggle.tsx +0 -12
  25. package/components/catalyst-ui/media/image.tsx +0 -13
  26. package/components/catalyst-ui/overlays/dual-sidebar.tsx +0 -4142
  27. package/components/catalyst-ui/overlays/sidebar-original.tsx +0 -726
  28. package/components/catalyst-ui/primitives/accordion.tsx +0 -250
  29. package/components/catalyst-ui/primitives/alert-dialog.tsx +0 -126
  30. package/components/catalyst-ui/primitives/aspect-ratio.tsx +0 -9
  31. package/components/catalyst-ui/primitives/avatar.tsx +0 -296
  32. package/components/catalyst-ui/primitives/badge.tsx +0 -57
  33. package/components/catalyst-ui/primitives/breadcrumb.tsx +0 -101
  34. package/components/catalyst-ui/primitives/button.tsx +0 -265
  35. package/components/catalyst-ui/primitives/calendar-v4.tsx +0 -208
  36. package/components/catalyst-ui/primitives/calendar.tsx +0 -295
  37. package/components/catalyst-ui/primitives/card.tsx +0 -618
  38. package/components/catalyst-ui/primitives/carousel.tsx +0 -238
  39. package/components/catalyst-ui/primitives/chart.tsx +0 -347
  40. package/components/catalyst-ui/primitives/checkbox.tsx +0 -225
  41. package/components/catalyst-ui/primitives/collapsible.tsx +0 -212
  42. package/components/catalyst-ui/primitives/command.tsx +0 -393
  43. package/components/catalyst-ui/primitives/context-menu.tsx +0 -236
  44. package/components/catalyst-ui/primitives/dialog.tsx +0 -471
  45. package/components/catalyst-ui/primitives/drawer.tsx +0 -761
  46. package/components/catalyst-ui/primitives/dropdown-menu.tsx +0 -290
  47. package/components/catalyst-ui/primitives/empty.tsx +0 -104
  48. package/components/catalyst-ui/primitives/field.tsx +0 -244
  49. package/components/catalyst-ui/primitives/hover-card.tsx +0 -124
  50. package/components/catalyst-ui/primitives/input-otp.tsx +0 -76
  51. package/components/catalyst-ui/primitives/input.tsx +0 -64
  52. package/components/catalyst-ui/primitives/item.tsx +0 -196
  53. package/components/catalyst-ui/primitives/kbd.tsx +0 -75
  54. package/components/catalyst-ui/primitives/label.tsx +0 -24
  55. package/components/catalyst-ui/primitives/navigation-menu.tsx +0 -150
  56. package/components/catalyst-ui/primitives/pagination.tsx +0 -198
  57. package/components/catalyst-ui/primitives/popover.tsx +0 -232
  58. package/components/catalyst-ui/primitives/progress.tsx +0 -34
  59. package/components/catalyst-ui/primitives/radio-group.tsx +0 -43
  60. package/components/catalyst-ui/primitives/resizable.tsx +0 -56
  61. package/components/catalyst-ui/primitives/select.tsx +0 -155
  62. package/components/catalyst-ui/primitives/separator.tsx +0 -74
  63. package/components/catalyst-ui/primitives/sheet.tsx +0 -126
  64. package/components/catalyst-ui/primitives/skeleton.tsx +0 -15
  65. package/components/catalyst-ui/primitives/slider.tsx +0 -27
  66. package/components/catalyst-ui/primitives/switch.tsx +0 -187
  67. package/components/catalyst-ui/primitives/tabs.tsx +0 -335
  68. package/components/catalyst-ui/primitives/textarea.tsx +0 -24
  69. package/components/catalyst-ui/primitives/toggle-group.tsx +0 -55
  70. package/components/catalyst-ui/primitives/toggle.tsx +0 -42
  71. package/components/catalyst-ui/primitives/tooltip.tsx +0 -116
  72. package/components/catalyst-ui/utils/basic-auth.tsx +0 -40
  73. package/components/catalyst-ui/utils/context-storage.tsx +0 -19
  74. package/components/catalyst-ui/utils/cors-middleware.tsx +0 -71
  75. package/components/catalyst-ui/utils/deferred-content.tsx +0 -595
  76. package/components/catalyst-ui/utils/honeypot-middleware.tsx +0 -38
  77. package/components/catalyst-ui/utils/incId.tsx +0 -75
  78. package/components/catalyst-ui/utils/jwk-auth.tsx +0 -36
  79. package/components/catalyst-ui/utils/request-id.tsx +0 -14
  80. package/components/catalyst-ui/utils/secure-headers.tsx +0 -37
  81. package/components/catalyst-ui/utils/server-timing.tsx +0 -23
  82. package/components/catalyst-ui/utils/utils.ts +0 -43
  83. package/components/catalyst-ui/utils/with-cookie.tsx +0 -43
  84. package/components/catalyst-ui/x/accordian-x.tsx +0 -428
  85. package/components/catalyst-ui/x/alert-x.tsx +0 -413
  86. package/components/catalyst-ui/x/animated-text-x.tsx +0 -2242
  87. package/components/catalyst-ui/x/avatar-x.tsx +0 -515
  88. package/components/catalyst-ui/x/badge-x.tsx +0 -670
  89. package/components/catalyst-ui/x/button-X.tsx +0 -2857
  90. package/components/catalyst-ui/x/button-group-x.tsx +0 -847
  91. package/components/catalyst-ui/x/calendar-x.tsx +0 -1910
  92. package/components/catalyst-ui/x/card-x.tsx +0 -2597
  93. package/components/catalyst-ui/x/checkbox-x.tsx +0 -656
  94. package/components/catalyst-ui/x/collapsible-x.tsx +0 -1360
  95. package/components/catalyst-ui/x/combobox-x.tsx +0 -911
  96. package/components/catalyst-ui/x/data-table-x.tsx +0 -1753
  97. package/components/catalyst-ui/x/date-picker-x.tsx +0 -648
  98. package/components/catalyst-ui/x/dialog-x.tsx +0 -659
  99. package/components/catalyst-ui/x/dropdown-menu-x.tsx +0 -612
  100. package/components/catalyst-ui/x/hover-card-x.tsx +0 -375
  101. package/components/catalyst-ui/x/icon-x.tsx +0 -840
  102. package/components/catalyst-ui/x/input-mask-x.tsx +0 -981
  103. package/components/catalyst-ui/x/input-otp-x.tsx +0 -659
  104. package/components/catalyst-ui/x/loader-x.tsx +0 -1757
  105. package/components/catalyst-ui/x/pagination-x.tsx +0 -622
  106. package/components/catalyst-ui/x/popover-x.tsx +0 -744
  107. package/components/catalyst-ui/x/radio-group-x.tsx +0 -499
  108. package/components/catalyst-ui/x/select-x.tsx +0 -1127
  109. package/components/catalyst-ui/x/sheet-x.tsx +0 -668
  110. package/components/catalyst-ui/x/switch-x.tsx +0 -681
  111. package/components/catalyst-ui/x/table-x.tsx +0 -574
  112. package/components/catalyst-ui/x/tabs-x.tsx +0 -839
  113. package/components/catalyst-ui/x/textarea-x.tsx +0 -1263
  114. package/components/catalyst-ui/x/tooltip-x.tsx +0 -396
  115. package/components/catalyst-ui/x/tracker-x.tsx +0 -560
  116. package/data/bg-data.tsx +0 -901
  117. package/data/buttons-data.tsx +0 -2327
  118. package/data/charts-data.tsx +0 -102
  119. package/data/chat-data.tsx +0 -83
  120. package/data/code-data.tsx +0 -1040
  121. package/data/comboboxes-data.tsx +0 -1843
  122. package/data/command-data.tsx +0 -1381
  123. package/data/core-data.tsx +0 -15953
  124. package/data/crm-data.tsx +0 -47
  125. package/data/data.tsx +0 -159
  126. package/data/date-and-time-data.tsx +0 -554
  127. package/data/dependencies.tsx +0 -7
  128. package/data/ecommerce-data.tsx +0 -1387
  129. package/data/forms-data.tsx +0 -7890
  130. package/data/hooks-data.tsx +0 -5487
  131. package/data/index.ts +0 -34
  132. package/data/inputs-data.tsx +0 -557
  133. package/data/interactive-data.tsx +0 -5394
  134. package/data/lofi-data.tsx +0 -18295
  135. package/data/marketing-data.tsx +0 -2546
  136. package/data/media-data.tsx +0 -1510
  137. package/data/motion-data.tsx +0 -5801
  138. package/data/overlay-data.tsx +0 -4136
  139. package/data/pdf-data.tsx +0 -124
  140. package/data/pos-data.tsx +0 -213
  141. package/data/postcss.config.js +0 -6
  142. package/data/primitive-data.tsx +0 -5170
  143. package/data/prompt-data.tsx +0 -1226
  144. package/data/requiredLibs.ts +0 -4
  145. package/data/sandbox-data.tsx +0 -1
  146. package/data/sidebars-data.tsx +0 -5421
  147. package/data/stacks-data.tsx +0 -32
  148. package/data/table-data.tsx +0 -706
  149. package/data/tailwind.config.js +0 -270
  150. package/data/tailwind.config.ngin.js +0 -3830
  151. package/data/tailwind.css +0 -431
  152. package/data/tools-data.tsx +0 -6910
  153. package/data/typography-data.tsx +0 -2050
  154. package/data/utils-data.tsx +0 -6500
  155. package/data/x-data.tsx +0 -1171
@@ -1,706 +0,0 @@
1
- export const componentsTable = [
2
- {
3
- name: "filter - TanStack Table, default column header",
4
- value: "filter",
5
- importPath: "~/components/catalyst-ui/table/filter-column",
6
- path: "/components/catalyst-ui/components/table/filter-column.tsx",
7
- premium: true,
8
- source: null,
9
- basicusage: `
10
- meta: {
11
- filterVariant: "datalist", // range, select, datalist, search, number, textInput, p
12
- placeholder: "Min Quantity",
13
- className: "text-center max-w-[250px]",
14
- },
15
- `,
16
- usage: `
17
- // need to replace tablehead with the following in your table, then use as the axample below
18
- <TableHead key={header.id} className="[&:has([role=checkbox])]:pl-3">
19
- {header.isPlaceholder ? null : (
20
- <>
21
- {header.column.getCanFilter() ? (
22
- <div>
23
- <Filter column={header.column} table={table} />
24
- </div>
25
- ) : null}
26
- </>
27
- )}
28
- </TableHead>
29
-
30
- {
31
- accessorKey: "dealerId",
32
- enableSorting: false,
33
- enableHiding: false,
34
- cell: ({ row }) => {
35
- const data = row.original;
36
- return (
37
- <div className="flex justify-center">
38
- <NavButton className="w-auto bg-transparent border-transparent text-center text-foreground" to=''>
39
- {data.dealerId}
40
- </NavButton>
41
- </div>
42
- );
43
- },
44
- meta: {
45
- filterVariant: "datalist", // range, select, datalist, search, number, textInput, p
46
- placeholder: "Min Quantity",
47
- className: "text-center max-w-[250px]",
48
- },
49
- },
50
-
51
- `,
52
- usagePath: null,
53
- category: "Table",
54
- tags: ["ui", "components", "interactive"],
55
- features: ["Responsive", "TypeScript", "Accessible"],
56
- dependencies: ["@radix-ui/react-aspect-ratio"],
57
- props: {
58
- "Filter": [
59
- { name: "column", type: "Column<any, unknown>", default: "null", required: true },
60
- { name: "table", type: "Table<any>", default: "null", required: true },
61
- ],
62
- "meta": [
63
- { name: "filterVariant", type: "range | select | datalist | search | number | textInput | p | datalist", default: "null", required: false },
64
- { name: "placeholder", type: "string", default: "null", required: false },
65
- { name: "className", type: "string", default: "null", required: false },
66
- ],
67
- },
68
- desc: "Clearly over engineered for optimal laziness, never having to open the filter component in order to achieve the level of customization needed for each of the columns you create. Each header can be built with a range selector, select, datalist select, search input, number filter and finishing a with p ( text ) for the headers that do not need any time of functionality. Under meta ( example use will be included ) declare the filterVariant, placeholder, and className. As a default if the column id is a single word it will capatalize that word, if its two words you may want to use the placeholder variable. The default header is the p variant, so if you don't put any values, your text column header will have the following className, text-center text-muted-foreground max-w-[250px] w-full. Thus leaving you with the perfect default, only to be changed at your discretion.",
69
- status: null,
70
- lastUpdated: null
71
- },
72
- {
73
- name: 'D Table',
74
- value: 'd-table',
75
- importPath: '~/components/catalyst-ui/table/d-table',
76
- multiImport: 'CatalystTable, DraggableTableHeader',
77
- basicusage: `<CatalystTable
78
- data={data}
79
- columns={columns}
80
- />
81
-
82
- <CatalystTable
83
- data={data}
84
- columns={columns}
85
- tableId="unique-table-id"
86
- options={{
87
- enableGlobalFilter: true,
88
- enableSorting: true,
89
- enableFiltering: true,
90
- enableRowSelection: false,
91
- enableExpanding: false,
92
- enablePagination: true,
93
- enableColumnResizing: false,
94
- enableColumnReordering: false,
95
- enableHeaderGroups: false,
96
- pageSize: 10,
97
- }}
98
- toolbarRight={<Button>Action</Button>}
99
- renderSubComponent={({ row }) => <div>Details</div>}
100
- className=""
101
- />`,
102
- path: '/components/catalyst-ui/components/table/d-table.tsx',
103
- source: null,
104
- usagePath: null,
105
- usage: `
106
- // Sample data types
107
- interface Task {
108
- id: string;
109
- title: string;
110
- status: 'backlog' | 'todo' | 'in progress' | 'done' | 'canceled';
111
- priority: 'low' | 'medium' | 'high';
112
- label: 'bug' | 'feature' | 'documentation';
113
- assignee: string;
114
- dueDate: string;
115
- estimatedHours: number;
116
- subRows?: Task[]; // For expandable rows
117
- }
118
-
119
- const sampleData: Task[] = [
120
- {
121
- id: '1',
122
- title: 'Fix login page styling',
123
- status: 'in progress',
124
- priority: 'high',
125
- label: 'bug',
126
- assignee: 'Alice Johnson',
127
- dueDate: '2024-01-15',
128
- estimatedHours: 4,
129
- },
130
- {
131
- id: '2',
132
- title: 'Add dark mode support',
133
- status: 'todo',
134
- priority: 'medium',
135
- label: 'feature',
136
- assignee: 'Bob Smith',
137
- dueDate: '2024-01-20',
138
- estimatedHours: 8,
139
- },
140
- {
141
- id: '3',
142
- title: 'Update API documentation',
143
- status: 'done',
144
- priority: 'low',
145
- label: 'documentation',
146
- assignee: 'Carol Davis',
147
- dueDate: '2024-01-10',
148
- estimatedHours: 6,
149
- },
150
- {
151
- id: '4',
152
- title: 'Implement user profile page',
153
- status: 'in progress',
154
- priority: 'high',
155
- label: 'feature',
156
- assignee: 'David Wilson',
157
- dueDate: '2024-01-18',
158
- estimatedHours: 12,
159
- subRows: [
160
- {
161
- id: '4-1',
162
- title: 'Design profile layout',
163
- status: 'done',
164
- priority: 'medium',
165
- label: 'feature',
166
- assignee: 'David Wilson',
167
- dueDate: '2024-01-12',
168
- estimatedHours: 4,
169
- },
170
- {
171
- id: '4-2',
172
- title: 'Implement backend API',
173
- status: 'in progress',
174
- priority: 'high',
175
- label: 'feature',
176
- assignee: 'David Wilson',
177
- dueDate: '2024-01-16',
178
- estimatedHours: 8,
179
- },
180
- ],
181
- },
182
- {
183
- id: '5',
184
- title: 'Fix mobile responsive issues',
185
- status: 'backlog',
186
- priority: 'medium',
187
- label: 'bug',
188
- assignee: 'Eva Brown',
189
- dueDate: '2024-01-25',
190
- estimatedHours: 10,
191
- },
192
- ];
193
-
194
- const statusOptions = [
195
- {
196
- value: 'backlog',
197
- label: 'Backlog',
198
- icon: QuestionMarkCircle,
199
- },
200
- {
201
- value: 'todo',
202
- label: 'Todo',
203
- icon: Circle,
204
- },
205
- {
206
- value: 'in progress',
207
- label: 'In Progress',
208
- icon: Stopwatch,
209
- },
210
- {
211
- value: 'done',
212
- label: 'Done',
213
- icon: CheckCircle,
214
- },
215
- {
216
- value: 'canceled',
217
- label: 'Canceled',
218
- icon: XCircle,
219
- },
220
- ];
221
-
222
- const priorityOptions = [
223
- {
224
- label: 'Low',
225
- value: 'low',
226
- icon: ArrowDown,
227
- },
228
- {
229
- label: 'Medium',
230
- value: 'medium',
231
- icon: ArrowRightIcon,
232
- },
233
- {
234
- label: 'High',
235
- value: 'high',
236
- icon: ArrowUp,
237
- },
238
- ];
239
-
240
- const labelOptions = [
241
- {
242
- value: 'bug',
243
- label: 'Bug',
244
- },
245
- {
246
- value: 'feature',
247
- label: 'Feature',
248
- },
249
- {
250
- value: 'documentation',
251
- label: 'Documentation',
252
- },
253
- ];
254
-
255
- export function CatalystTableDemo() {
256
- const [data, setData] = useState<Task[]>(sampleData);
257
- const [selectedRows, setSelectedRows] = useState({});
258
-
259
- // Define columns with all features
260
- const columns = useMemo(() => [
261
- // Row selection column
262
- {
263
- id: 'select',
264
- header: ({ table }) => (
265
- <Checkbox
266
- checked={table.getIsAllPageRowsSelected()}
267
- onCheckedChange={(value) => table.toggleAllPageRowsSelected(!!value)}
268
- aria-label="Select all"
269
- />
270
- ),
271
- cell: ({ row }) => (
272
- <Checkbox
273
- checked={row.getIsSelected()}
274
- onCheckedChange={(value) => row.toggleSelected(!!value)}
275
- aria-label="Select row"
276
- />
277
- ),
278
- enableSorting: false,
279
- enableHiding: false,
280
- size: 40,
281
- },
282
- // Expandable row column
283
- {
284
- id: 'expander',
285
- header: () => null,
286
- cell: ({ row }) => {
287
- return row.getCanExpand() ? (
288
- <Button
289
- variant="ghost"
290
- size="sm"
291
- onClick={row.getToggleExpandedHandler()}
292
- >
293
- {row.getIsExpanded() ? '👇' : '👉'}
294
- </Button>
295
- ) : null;
296
- },
297
- size: 40,
298
- },
299
- // Title with sorting and filtering
300
- {
301
- accessorKey: 'title',
302
- header: ({ column }) => (
303
- <DataTableColumnHeader column={column} title="Title" />
304
- ),
305
- cell: ({ row }) => <div className="font-medium">{row.getValue('title')}</div>,
306
- enableSorting: true,
307
- enableColumnFilter: true,
308
- filterFn: 'includesString',
309
- size: 250,
310
- },
311
- // Status with faceted filter
312
- {
313
- accessorKey: 'status',
314
- header: ({ column }) => (
315
- <DataTableColumnHeader column={column} title="Status" />
316
- ),
317
- cell: ({ row }) => {
318
- const status = statusOptions.find(s => s.value === row.getValue('status'));
319
- const Icon = status?.icon;
320
- return (
321
- <div className="flex items-center gap-2">
322
- {Icon && <Icon className="h-4 w-4" />}
323
- <span className="capitalize">{row.getValue('status')}</span>
324
- </div>
325
- );
326
- },
327
- filterFn: 'arrIncludesSome',
328
- enableSorting: true,
329
- enableColumnFilter: true,
330
- size: 150,
331
- },
332
- // Priority with faceted filter
333
- {
334
- accessorKey: 'priority',
335
- header: ({ column }) => (
336
- <DataTableColumnHeader column={column} title="Priority" />
337
- ),
338
- cell: ({ row }) => {
339
- const priority = priorityOptions.find(p => p.value === row.getValue('priority'));
340
- const Icon = priority?.icon;
341
- return (
342
- <div className="flex items-center gap-2">
343
- {Icon && <Icon className="h-4 w-4" />}
344
- <span className="capitalize">{row.getValue('priority')}</span>
345
- </div>
346
- );
347
- },
348
- filterFn: 'arrIncludesSome',
349
- enableSorting: true,
350
- enableColumnFilter: true,
351
- size: 120,
352
- },
353
- // Label with faceted filter
354
- {
355
- accessorKey: 'label',
356
- header: ({ column }) => (
357
- <DataTableColumnHeader column={column} title="Label" />
358
- ),
359
- cell: ({ row }) => (
360
- <span className="capitalize">{row.getValue('label')}</span>
361
- ),
362
- filterFn: 'arrIncludesSome',
363
- enableSorting: true,
364
- enableColumnFilter: true,
365
- size: 120,
366
- },
367
- // Assignee with text filtering
368
- {
369
- accessorKey: 'assignee',
370
- header: ({ column }) => (
371
- <DataTableColumnHeader column={column} title="Assignee" />
372
- ),
373
- cell: ({ row }) => row.getValue('assignee'),
374
- enableSorting: true,
375
- enableColumnFilter: true,
376
- size: 150,
377
- },
378
- // Due date with sorting
379
- {
380
- accessorKey: 'dueDate',
381
- header: ({ column }) => (
382
- <DataTableColumnHeader column={column} title="Due Date" />
383
- ),
384
- cell: ({ row }) => new Date(row.getValue('dueDate')).toLocaleDateString(),
385
- enableSorting: true,
386
- size: 120,
387
- },
388
- // Estimated hours with numeric sorting
389
- {
390
- accessorKey: 'estimatedHours',
391
- header: ({ column }) => (
392
- <DataTableColumnHeader column={column} title="Est. Hours" />
393
- ),
394
- cell: ({ row }) => \`\${row.getValue('estimatedHours')}h\`,
395
- enableSorting: true,
396
- size: 100,
397
- },
398
- // Actions column
399
- {
400
- id: 'actions',
401
- cell: ({ row }) => <DataTableRowActions row={row} />,
402
- size: 60,
403
- },
404
- ], []);
405
-
406
- // Custom toolbar component
407
- const toolbarRight = (
408
- <div className="flex items-center gap-2">
409
- <DataTableFacetedFilter
410
- column={undefined} // Global filter
411
- title="Status"
412
- options={statusOptions}
413
- />
414
- <DataTableFacetedFilter
415
- column={undefined} // Global filter
416
- title="Priority"
417
- options={priorityOptions}
418
- />
419
- <Button variant="outline" size="sm">
420
- <Plus className="h-4 w-4 mr-2" />
421
- New Task
422
- </Button>
423
- </div>
424
- );
425
-
426
- // Sub-component for expanded rows
427
- const renderSubComponent = ({ row }) => {
428
- const subRows = row.original.subRows || [];
429
- return (
430
- <div className="p-4 bg-muted/50 rounded-lg">
431
- <h4 className="font-semibold mb-2">Sub-tasks:</h4>
432
- {subRows.map((subTask) => (
433
- <div key={subTask.id} className="flex items-center justify-between py-2 border-b last:border-b-0">
434
- <span>{subTask.title}</span>
435
- <span className="text-sm text-muted-foreground capitalize">
436
- {subTask.status} • {subTask.priority} priority
437
- </span>
438
- </div>
439
- ))}
440
- </div>
441
- );
442
- };
443
-
444
- return (
445
- <div className="p-6 space-y-6">
446
- <div>
447
- <h1 className="text-3xl font-bold mb-2">Advanced Data Table Demo</h1>
448
- <p className="text-muted-foreground">
449
- Showcasing all features: sorting, filtering, pagination, row selection,
450
- expandable rows, column reordering, resizing, and more.
451
- </p>
452
- </div>
453
-
454
- {/* Demo 1: Full-featured table */}
455
- <div>
456
- <h2 className="text-xl font-semibold mb-4">1. Full Featured Table</h2>
457
- <CatalystTable
458
- data={data}
459
- columns={columns}
460
- tableId="full-featured-demo"
461
- toolbarRight={toolbarRight}
462
- renderSubComponent={renderSubComponent}
463
- options={{
464
- enableGlobalFilter: true,
465
- enableSorting: true,
466
- enableFiltering: true,
467
- enableRowSelection: true,
468
- enableExpanding: true,
469
- enablePagination: true,
470
- enableColumnResizing: true,
471
- enableColumnReordering: true,
472
- pageSize: 10,
473
- }}
474
- />
475
- </div>
476
-
477
- {/* Demo 2: Minimal table */}
478
- <div>
479
- <h2 className="text-xl font-semibold mb-4">2. Minimal Table (Basic Features)</h2>
480
- <CatalystTable
481
- data={data}
482
- columns={columns.filter(col =>
483
- !['select', 'expander', 'actions'].includes(col.id as string)
484
- )}
485
- options={{
486
- enableGlobalFilter: false,
487
- enableSorting: true,
488
- enableFiltering: false,
489
- enableRowSelection: false,
490
- enableExpanding: false,
491
- enablePagination: true,
492
- enableColumnResizing: false,
493
- enableColumnReordering: false,
494
- pageSize: 5,
495
- }}
496
- />
497
- </div>
498
-
499
- {/* Demo 3: Custom configuration */}
500
- <div>
501
- <h2 className="text-xl font-semibold mb-4">3. Custom Configuration (No Pagination)</h2>
502
- <CatalystTable
503
- data={data}
504
- columns={columns.filter(col =>
505
- ['title', 'status', 'priority', 'assignee'].includes(col.accessorKey as string)
506
- )}
507
- options={{
508
- enableGlobalFilter: true,
509
- enableSorting: true,
510
- enableFiltering: true,
511
- enableRowSelection: false,
512
- enableExpanding: false,
513
- enablePagination: false, // No pagination
514
- enableColumnResizing: true,
515
- enableColumnReordering: true,
516
- }}
517
- className="max-w-4xl"
518
- />
519
- </div>
520
-
521
- {/* Demo 4: Row selection with actions */}
522
- <div>
523
- <h2 className="text-xl font-semibold mb-4">4. Row Selection with Bulk Actions</h2>
524
- <CatalystTable
525
- data={data}
526
- columns={columns.filter(col =>
527
- !['expander'].includes(col.id as string)
528
- )}
529
- options={{
530
- enableGlobalFilter: true,
531
- enableSorting: true,
532
- enableFiltering: true,
533
- enableRowSelection: true,
534
- enableExpanding: false,
535
- enablePagination: true,
536
- enableColumnResizing: false,
537
- enableColumnReordering: false,
538
- pageSize: 10,
539
- }}
540
- />
541
- </div>
542
- </div>
543
- );
544
- }`,
545
- premium: true,
546
- category: "Table",
547
- tags: ['data', 'table', 'tanstack', 'filtering', 'sorting', 'pagination', 'drag-drop', 'resizing'],
548
- features: [
549
- 'Responsive',
550
- 'TypeScript',
551
- 'Accessible',
552
- 'Column Resizing',
553
- 'Column Reordering',
554
- 'Persistent Layout',
555
- 'Sub Components',
556
- 'Global Search',
557
- ],
558
- dependencies: [
559
- '@tanstack/react-table',
560
- '@dnd-kit/core',
561
- '@dnd-kit/sortable',
562
- '@dnd-kit/utilities',
563
- 'lucide-react',
564
- 'react',
565
- 'class-variance-authority',
566
- ],
567
- props: {
568
- CatalystTable: [
569
- { name: 'data', type: 'any[]', default: 'null' },
570
- { name: 'columns', type: 'ColumnDef<any>[]', default: 'null' },
571
- { name: 'tableId', type: 'string', default: 'null' },
572
- { name: 'options', type: 'object', default: '{}' },
573
- { name: 'options.enableGlobalFilter', type: 'boolean', default: 'true' },
574
- { name: 'options.enableSorting', type: 'boolean', default: 'true' },
575
- { name: 'options.enableFiltering', type: 'boolean', default: 'true' },
576
- { name: 'options.enableRowSelection', type: 'boolean', default: 'false' },
577
- { name: 'options.enableExpanding', type: 'boolean', default: 'false' },
578
- { name: 'options.enablePagination', type: 'boolean', default: 'true' },
579
- { name: 'options.enableColumnResizing', type: 'boolean', default: 'false' },
580
- { name: 'options.enableColumnReordering', type: 'boolean', default: 'false' },
581
- { name: 'options.enableHeaderGroups', type: 'boolean', default: 'false' },
582
- { name: 'options.pageSize', type: 'number', default: '10' },
583
- { name: 'toolbarRight', type: 'React.ReactNode', default: 'null' },
584
- { name: 'renderSubComponent', type: 'function', default: 'null' },
585
- { name: 'className', type: 'string', default: 'null' },
586
- ],
587
- "DataTableFacetedFilter": [
588
- { name: "column", type: "Column<TData, TValue>", default: "null", desc: "Table column to filter" },
589
- { name: "title", type: "string", default: "null", desc: "Title for the filter dropdown" },
590
- { name: "options", type: "{ label: string; value: string; icon?: ComponentType }[]", default: "[]", desc: "Filter options with labels, values, and optional icons" },
591
- ],
592
- "DataTableColumnHeader": [
593
- { name: "column", type: "Column<TData, TValue>", default: "null", required: true, desc: "Table column" },
594
- { name: "title", type: "string", default: "null", required: true, desc: "Column header title" },
595
- { name: "className", type: "string", default: "null", desc: "Additional CSS classes" },
596
- ],
597
- "DataTableRowActions": [
598
- { name: "row", type: "any", default: "null", required: true, desc: "Table row data" },
599
- ],
600
- "DraggableTableHeader": [
601
- { name: "header", type: "any", default: "null", required: true, desc: "Table header object" },
602
- { name: "children", type: "React.ReactNode", default: "null", required: true, desc: "Header content" },
603
- ],
604
- },
605
- desc: null,
606
- status: null,
607
- lastUpdated: null
608
- },
609
- {
610
- name: "Props Table",
611
- value: "props-table",
612
- importPath: "~/components/catalyst-ui/components/utility/props-table",
613
- multiImport: null,
614
- basicusage: `
615
- const simpleProps: PropDefinition[] = [
616
- {
617
- name: "className",
618
- type: "string",
619
- default: "''",
620
- description: "Additional CSS classes",
621
- required: false
622
- },
623
- {
624
- name: "variant",
625
- type: "'default' | 'outline' | 'ghost'",
626
- default: "'default'",
627
- description: "Button style variant",
628
- required: false
629
- },
630
- {
631
- name: "size",
632
- type: "'sm' | 'md' | 'lg'",
633
- default: "'md'",
634
- description: "Button size",
635
- required: true
636
- },
637
- ]
638
- <PropsTable props={propsArray} />`,
639
- path: "/components/catalyst-ui/components/utility/props-table.tsx",
640
- source: null,
641
- usagePath: null,
642
- usage: `
643
- export function PropsTableDemo() {
644
- const simpleProps: PropDefinition[] = [
645
- {
646
- name: "className",
647
- type: "string",
648
- default: "''",
649
- description: "Additional CSS classes",
650
- required: false
651
- },
652
- {
653
- name: "variant",
654
- type: "'default' | 'outline' | 'ghost'",
655
- default: "'default'",
656
- description: "Button style variant",
657
- required: false
658
- },
659
- {
660
- name: "size",
661
- type: "'sm' | 'md' | 'lg'",
662
- default: "'md'",
663
- description: "Button size",
664
- required: true
665
- },
666
- ]
667
-
668
- const multiComponentProps: Record<string, PropDefinition[]> = {
669
- Button: [
670
- { name: "className", type: "string", default: "''", description: "Additional CSS classes" },
671
- { name: "variant", type: "'default' | 'outline'", default: "'default'", description: "Style variant" },
672
- ],
673
- Input: [
674
- { name: "className", type: "string", default: "''", description: "Additional CSS classes" },
675
- { name: "type", type: "string", default: "'text'", description: "Input type" },
676
- ],
677
- }
678
-
679
- return (
680
- <div className="space-y-8 p-6 max-w-4xl mx-auto">
681
- <div>
682
- <h2 className="text-2xl font-bold mb-4">Simple Props Table</h2>
683
- <PropsTable props={simpleProps} />
684
- </div>
685
-
686
- <div>
687
- <h2 className="text-2xl font-bold mb-4">Multi-Component Props Table</h2>
688
- <PropsTable props={multiComponentProps} />
689
- </div>
690
- </div>
691
- )
692
- }
693
- `,
694
- premium: true,
695
- category: "Table",
696
- tags: ["utility", "documentation", "table"],
697
- features: ["Responsive", "TypeScript", "Copy to Clipboard"],
698
- dependencies: ["lucide-react", "react"],
699
- props: [
700
- { name: "props", type: "PropDefinition[] | Record<string, PropDefinition[]> | null", default: "null", description: "Props data to display in table format", required: true },
701
- ],
702
- desc: null,
703
- status: null,
704
- lastUpdated: null
705
- },
706
- ];