@catalystsoftware/ui 1.0.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.
- package/README.md +7 -0
- package/components/catalyst-ui/buttons/burger.tsx +207 -0
- package/components/catalyst-ui/core/data-display/timeline.tsx +210 -0
- package/components/catalyst-ui/core/feedback/alert.tsx +491 -0
- package/components/catalyst-ui/core/feedback/spinner-1.tsx +65 -0
- package/components/catalyst-ui/core/feedback/toast.tsx +1857 -0
- package/components/catalyst-ui/core/navigation/menu.tsx +164 -0
- package/components/catalyst-ui/forms/toggle-class.tsx +176 -0
- package/components/catalyst-ui/hooks/use-copy-to-clipboard.tsx +419 -0
- package/components/catalyst-ui/hooks/use-counter.tsx +13 -0
- package/components/catalyst-ui/hooks/use-event-listener.tsx +23 -0
- package/components/catalyst-ui/hooks/use-export-markdown.tsx +47 -0
- package/components/catalyst-ui/hooks/use-focus.tsx +17 -0
- package/components/catalyst-ui/hooks/use-interval.tsx +23 -0
- package/components/catalyst-ui/hooks/use-is-client.tsx +16 -0
- package/components/catalyst-ui/hooks/use-media-query.tsx +19 -0
- package/components/catalyst-ui/hooks/use-mobile.tsx +19 -0
- package/components/catalyst-ui/hooks/use-resize-observer.tsx +81 -0
- package/components/catalyst-ui/hooks/use-timeout.tsx +21 -0
- package/components/catalyst-ui/hooks/use-timer.tsx +209 -0
- package/components/catalyst-ui/hooks/use-toggle.tsx +12 -0
- package/components/catalyst-ui/media/image.tsx +13 -0
- package/components/catalyst-ui/overlays/dual-sidebar.tsx +4142 -0
- package/components/catalyst-ui/overlays/sidebar-original.tsx +726 -0
- package/components/catalyst-ui/primitives/accordion.tsx +250 -0
- package/components/catalyst-ui/primitives/alert-dialog.tsx +126 -0
- package/components/catalyst-ui/primitives/aspect-ratio.tsx +9 -0
- package/components/catalyst-ui/primitives/avatar.tsx +296 -0
- package/components/catalyst-ui/primitives/badge.tsx +57 -0
- package/components/catalyst-ui/primitives/breadcrumb.tsx +101 -0
- package/components/catalyst-ui/primitives/button.tsx +265 -0
- package/components/catalyst-ui/primitives/calendar-v4.tsx +208 -0
- package/components/catalyst-ui/primitives/calendar.tsx +295 -0
- package/components/catalyst-ui/primitives/card.tsx +618 -0
- package/components/catalyst-ui/primitives/carousel.tsx +238 -0
- package/components/catalyst-ui/primitives/chart.tsx +347 -0
- package/components/catalyst-ui/primitives/checkbox.tsx +225 -0
- package/components/catalyst-ui/primitives/collapsible.tsx +212 -0
- package/components/catalyst-ui/primitives/command.tsx +393 -0
- package/components/catalyst-ui/primitives/context-menu.tsx +236 -0
- package/components/catalyst-ui/primitives/dialog.tsx +471 -0
- package/components/catalyst-ui/primitives/drawer.tsx +761 -0
- package/components/catalyst-ui/primitives/dropdown-menu.tsx +290 -0
- package/components/catalyst-ui/primitives/empty.tsx +104 -0
- package/components/catalyst-ui/primitives/field.tsx +244 -0
- package/components/catalyst-ui/primitives/hover-card.tsx +124 -0
- package/components/catalyst-ui/primitives/input-otp.tsx +76 -0
- package/components/catalyst-ui/primitives/input.tsx +64 -0
- package/components/catalyst-ui/primitives/item.tsx +196 -0
- package/components/catalyst-ui/primitives/kbd.tsx +75 -0
- package/components/catalyst-ui/primitives/label.tsx +24 -0
- package/components/catalyst-ui/primitives/navigation-menu.tsx +150 -0
- package/components/catalyst-ui/primitives/pagination.tsx +198 -0
- package/components/catalyst-ui/primitives/popover.tsx +232 -0
- package/components/catalyst-ui/primitives/progress.tsx +34 -0
- package/components/catalyst-ui/primitives/radio-group.tsx +43 -0
- package/components/catalyst-ui/primitives/resizable.tsx +56 -0
- package/components/catalyst-ui/primitives/select.tsx +155 -0
- package/components/catalyst-ui/primitives/separator.tsx +74 -0
- package/components/catalyst-ui/primitives/sheet.tsx +126 -0
- package/components/catalyst-ui/primitives/skeleton.tsx +15 -0
- package/components/catalyst-ui/primitives/slider.tsx +27 -0
- package/components/catalyst-ui/primitives/switch.tsx +187 -0
- package/components/catalyst-ui/primitives/tabs.tsx +335 -0
- package/components/catalyst-ui/primitives/textarea.tsx +24 -0
- package/components/catalyst-ui/primitives/toggle-group.tsx +55 -0
- package/components/catalyst-ui/primitives/toggle.tsx +42 -0
- package/components/catalyst-ui/primitives/tooltip.tsx +116 -0
- package/components/catalyst-ui/utils/basic-auth.tsx +40 -0
- package/components/catalyst-ui/utils/context-storage.tsx +19 -0
- package/components/catalyst-ui/utils/cors-middleware.tsx +71 -0
- package/components/catalyst-ui/utils/deferred-content.tsx +595 -0
- package/components/catalyst-ui/utils/honeypot-middleware.tsx +38 -0
- package/components/catalyst-ui/utils/incId.tsx +75 -0
- package/components/catalyst-ui/utils/jwk-auth.tsx +36 -0
- package/components/catalyst-ui/utils/request-id.tsx +14 -0
- package/components/catalyst-ui/utils/secure-headers.tsx +37 -0
- package/components/catalyst-ui/utils/server-timing.tsx +23 -0
- package/components/catalyst-ui/utils/utils.ts +43 -0
- package/components/catalyst-ui/utils/with-cookie.tsx +43 -0
- package/components/catalyst-ui/x/accordian-x.tsx +428 -0
- package/components/catalyst-ui/x/alert-x.tsx +413 -0
- package/components/catalyst-ui/x/animated-text-x.tsx +2242 -0
- package/components/catalyst-ui/x/avatar-x.tsx +515 -0
- package/components/catalyst-ui/x/badge-x.tsx +670 -0
- package/components/catalyst-ui/x/button-X.tsx +2857 -0
- package/components/catalyst-ui/x/button-group-x.tsx +847 -0
- package/components/catalyst-ui/x/calendar-x.tsx +1910 -0
- package/components/catalyst-ui/x/card-x.tsx +2597 -0
- package/components/catalyst-ui/x/checkbox-x.tsx +656 -0
- package/components/catalyst-ui/x/collapsible-x.tsx +1360 -0
- package/components/catalyst-ui/x/combobox-x.tsx +911 -0
- package/components/catalyst-ui/x/data-table-x.tsx +1753 -0
- package/components/catalyst-ui/x/date-picker-x.tsx +648 -0
- package/components/catalyst-ui/x/dialog-x.tsx +659 -0
- package/components/catalyst-ui/x/dropdown-menu-x.tsx +612 -0
- package/components/catalyst-ui/x/hover-card-x.tsx +375 -0
- package/components/catalyst-ui/x/icon-x.tsx +840 -0
- package/components/catalyst-ui/x/input-mask-x.tsx +981 -0
- package/components/catalyst-ui/x/input-otp-x.tsx +659 -0
- package/components/catalyst-ui/x/loader-x.tsx +1757 -0
- package/components/catalyst-ui/x/pagination-x.tsx +622 -0
- package/components/catalyst-ui/x/popover-x.tsx +744 -0
- package/components/catalyst-ui/x/radio-group-x.tsx +499 -0
- package/components/catalyst-ui/x/select-x.tsx +1127 -0
- package/components/catalyst-ui/x/sheet-x.tsx +668 -0
- package/components/catalyst-ui/x/switch-x.tsx +681 -0
- package/components/catalyst-ui/x/table-x.tsx +574 -0
- package/components/catalyst-ui/x/tabs-x.tsx +839 -0
- package/components/catalyst-ui/x/textarea-x.tsx +1263 -0
- package/components/catalyst-ui/x/tooltip-x.tsx +396 -0
- package/components/catalyst-ui/x/tracker-x.tsx +560 -0
- package/data/bg-data.tsx +901 -0
- package/data/buttons-data.tsx +2327 -0
- package/data/charts-data.tsx +102 -0
- package/data/chat-data.tsx +83 -0
- package/data/code-data.tsx +1040 -0
- package/data/comboboxes-data.tsx +1843 -0
- package/data/command-data.tsx +1381 -0
- package/data/core-data.tsx +15953 -0
- package/data/crm-data.tsx +47 -0
- package/data/data.tsx +159 -0
- package/data/date-and-time-data.tsx +554 -0
- package/data/dependencies.tsx +7 -0
- package/data/ecommerce-data.tsx +1387 -0
- package/data/forms-data.tsx +7890 -0
- package/data/hooks-data.tsx +5487 -0
- package/data/index.ts +34 -0
- package/data/inputs-data.tsx +557 -0
- package/data/interactive-data.tsx +5394 -0
- package/data/lofi-data.tsx +18295 -0
- package/data/marketing-data.tsx +2546 -0
- package/data/media-data.tsx +1510 -0
- package/data/motion-data.tsx +5801 -0
- package/data/overlay-data.tsx +4136 -0
- package/data/pdf-data.tsx +124 -0
- package/data/pos-data.tsx +213 -0
- package/data/postcss.config.js +6 -0
- package/data/primitive-data.tsx +5170 -0
- package/data/prompt-data.tsx +1226 -0
- package/data/requiredLibs.ts +4 -0
- package/data/sandbox-data.tsx +1 -0
- package/data/sidebars-data.tsx +5421 -0
- package/data/stacks-data.tsx +32 -0
- package/data/table-data.tsx +706 -0
- package/data/tailwind.config.js +3830 -0
- package/data/tailwind.config.ngin.js +3830 -0
- package/data/tailwind.css +431 -0
- package/data/tools-data.tsx +6910 -0
- package/data/typography-data.tsx +2050 -0
- package/data/utils-data.tsx +6500 -0
- package/data/x-data.tsx +1171 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30245 -0
- package/dist/index.js.map +362 -0
- package/package.json +50 -0
|
@@ -0,0 +1,706 @@
|
|
|
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
|
+
];
|