astryx-dracula 0.1.3 → 0.2.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/BRAND.md +1 -1
- package/README.md +2 -0
- package/USAGE.md +13 -0
- package/astryx-dracula.js +4 -4
- package/astryx.integration.mjs +3 -0
- package/package.json +4 -2
- package/templates/ai-chat-landing.template.mjs +6 -0
- package/templates/ai-chat-landing.tsx +476 -0
- package/templates/ai-chat.template.mjs +6 -0
- package/templates/ai-chat.tsx +762 -0
- package/templates/blank.template.mjs +6 -0
- package/templates/blank.tsx +16 -0
- package/templates/centered-hero.template.mjs +6 -0
- package/templates/centered-hero.tsx +188 -0
- package/templates/classic-gallery.template.mjs +6 -0
- package/templates/classic-gallery.tsx +181 -0
- package/templates/contact-form.template.mjs +6 -0
- package/templates/contact-form.tsx +292 -0
- package/templates/dashboard-portfolio.template.mjs +6 -0
- package/templates/dashboard-portfolio.tsx +800 -0
- package/templates/dashboard.template.mjs +6 -0
- package/templates/dashboard.tsx +774 -0
- package/templates/detail-page.template.mjs +6 -0
- package/templates/detail-page.tsx +695 -0
- package/templates/documentation-design.template.mjs +6 -0
- package/templates/documentation-design.tsx +751 -0
- package/templates/documentation-technical.template.mjs +6 -0
- package/templates/documentation-technical.tsx +292 -0
- package/templates/documentation.template.mjs +6 -0
- package/templates/documentation.tsx +347 -0
- package/templates/editor.template.mjs +6 -0
- package/templates/editor.tsx +959 -0
- package/templates/file-explorer.template.mjs +6 -0
- package/templates/file-explorer.tsx +577 -0
- package/templates/form-two-column.template.mjs +6 -0
- package/templates/form-two-column.tsx +314 -0
- package/templates/gallery-hero.template.mjs +6 -0
- package/templates/gallery-hero.tsx +287 -0
- package/templates/ide.template.mjs +6 -0
- package/templates/ide.tsx +533 -0
- package/templates/incident-console.template.mjs +6 -0
- package/templates/incident-console.tsx +584 -0
- package/templates/kanban-board.template.mjs +6 -0
- package/templates/kanban-board.tsx +746 -0
- package/templates/library.template.mjs +6 -0
- package/templates/library.tsx +489 -0
- package/templates/login-card.template.mjs +6 -0
- package/templates/login-card.tsx +200 -0
- package/templates/login-split.template.mjs +6 -0
- package/templates/login-split.tsx +318 -0
- package/templates/login-sso.template.mjs +6 -0
- package/templates/login-sso.tsx +277 -0
- package/templates/login.template.mjs +6 -0
- package/templates/login.tsx +98 -0
- package/templates/messaging-shell.template.mjs +6 -0
- package/templates/messaging-shell.tsx +675 -0
- package/templates/mixed-gallery.template.mjs +6 -0
- package/templates/mixed-gallery.tsx +190 -0
- package/templates/payment-form.template.mjs +6 -0
- package/templates/payment-form.tsx +990 -0
- package/templates/product-detail.template.mjs +6 -0
- package/templates/product-detail.tsx +366 -0
- package/templates/product-gallery.template.mjs +6 -0
- package/templates/product-gallery.tsx +173 -0
- package/templates/settings-dialog.template.mjs +6 -0
- package/templates/settings-dialog.tsx +920 -0
- package/templates/settings-sidebar.template.mjs +6 -0
- package/templates/settings-sidebar.tsx +952 -0
- package/templates/settings.template.mjs +6 -0
- package/templates/settings.tsx +235 -0
- package/templates/shell-nav.template.mjs +6 -0
- package/templates/shell-nav.tsx +306 -0
- package/templates/shell-side-nav.template.mjs +6 -0
- package/templates/shell-side-nav.tsx +238 -0
- package/templates/shell-top-nav.template.mjs +6 -0
- package/templates/shell-top-nav.tsx +243 -0
- package/templates/side-gallery.template.mjs +6 -0
- package/templates/side-gallery.tsx +179 -0
- package/templates/table-grouped.template.mjs +6 -0
- package/templates/table-grouped.tsx +1174 -0
- package/templates/table-page-chart.template.mjs +6 -0
- package/templates/table-page-chart.tsx +693 -0
- package/templates/table-page-heatmap-status.template.mjs +6 -0
- package/templates/table-page-heatmap-status.tsx +547 -0
- package/templates/table-page-shoe-store-heatmap.template.mjs +6 -0
- package/templates/table-page-shoe-store-heatmap.tsx +1038 -0
- package/templates/table-page.template.mjs +6 -0
- package/templates/table-page.tsx +445 -0
- package/templates/table.template.mjs +6 -0
- package/templates/table.tsx +84 -0
- package/templates/theme-showcase.template.mjs +6 -0
- package/templates/theme-showcase.tsx +1282 -0
- package/theme.css +4 -4
- package/tokens.css +4 -4
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import {useState, useMemo} from 'react';
|
|
4
|
+
import {
|
|
5
|
+
VStack,
|
|
6
|
+
HStack,
|
|
7
|
+
StackItem,
|
|
8
|
+
Layout,
|
|
9
|
+
LayoutContent,
|
|
10
|
+
LayoutHeader,
|
|
11
|
+
} from '@astryxdesign/core/Layout';
|
|
12
|
+
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
13
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
14
|
+
import {IconButton} from '@astryxdesign/core/IconButton';
|
|
15
|
+
import {Icon} from '@astryxdesign/core/Icon';
|
|
16
|
+
import {Avatar} from '@astryxdesign/core/Avatar';
|
|
17
|
+
import {
|
|
18
|
+
PowerSearch,
|
|
19
|
+
usePowerSearchConfig,
|
|
20
|
+
} from '@astryxdesign/core/PowerSearch';
|
|
21
|
+
import type {PowerSearchFilter} from '@astryxdesign/core/PowerSearch';
|
|
22
|
+
import {Table, proportional, pixel} from '@astryxdesign/core/Table';
|
|
23
|
+
import type {TableColumn} from '@astryxdesign/core/Table';
|
|
24
|
+
import {
|
|
25
|
+
Filter,
|
|
26
|
+
Download,
|
|
27
|
+
Plus,
|
|
28
|
+
} from 'lucide-react';
|
|
29
|
+
|
|
30
|
+
interface FamiliarRow extends Record<string, unknown> {
|
|
31
|
+
id: string;
|
|
32
|
+
name: string;
|
|
33
|
+
kind: string;
|
|
34
|
+
biography: string;
|
|
35
|
+
age: number;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const allFamiliars: FamiliarRow[] = [
|
|
39
|
+
{
|
|
40
|
+
id: '1',
|
|
41
|
+
name: 'Vlad',
|
|
42
|
+
kind: 'Vampire Bat',
|
|
43
|
+
biography:
|
|
44
|
+
'I love brooding in the belfry and hate garlic bread — you might wonder how well those things mix and the answer is "not that well."',
|
|
45
|
+
age: 17,
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: '2',
|
|
49
|
+
name: 'Alucard',
|
|
50
|
+
kind: 'Black Cat',
|
|
51
|
+
biography: 'This is a black cat summoned by crossing the lobby at midnight',
|
|
52
|
+
age: 2,
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: '3',
|
|
56
|
+
name: 'Archer',
|
|
57
|
+
kind: 'Hellhound',
|
|
58
|
+
biography:
|
|
59
|
+
"I'm an 8 year old direwolf and I haunt the moors with my mom and dad.",
|
|
60
|
+
age: 9,
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: '4',
|
|
64
|
+
name: 'Archie',
|
|
65
|
+
kind: 'Raven',
|
|
66
|
+
biography: 'Carrion crow at heart, raven by trade.',
|
|
67
|
+
age: 5,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: '5',
|
|
71
|
+
name: 'Argos',
|
|
72
|
+
kind: 'Bloodhound',
|
|
73
|
+
biography: 'Faithful hellhound who never gives up the scent.',
|
|
74
|
+
age: 23,
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
id: '6',
|
|
78
|
+
name: 'Banjo',
|
|
79
|
+
kind: 'Imp',
|
|
80
|
+
biography:
|
|
81
|
+
"Banjo was rescued from a cursed carnival in Concord, CA. He's a mischievous imp that loves to juggle skulls on the beach.",
|
|
82
|
+
age: 9,
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
id: '7',
|
|
86
|
+
name: 'Barley',
|
|
87
|
+
kind: 'Wisp',
|
|
88
|
+
biography: 'Teacup-sized wisp with a full-sized haunting.',
|
|
89
|
+
age: 4,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: '8',
|
|
93
|
+
name: 'Beast',
|
|
94
|
+
kind: 'Iron Boar',
|
|
95
|
+
biography: 'Summers in Transylvania, winters in the crypt.',
|
|
96
|
+
age: 14,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: '9',
|
|
100
|
+
name: 'Belki',
|
|
101
|
+
kind: 'Mist Ferret',
|
|
102
|
+
biography: 'Belki is actually three bats in an overcoat.',
|
|
103
|
+
age: 6,
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: '10',
|
|
107
|
+
name: 'Bella',
|
|
108
|
+
kind: 'Obsidian Panther',
|
|
109
|
+
biography: 'Shadow panther by day, lap cat by night.',
|
|
110
|
+
age: 10,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
id: '11',
|
|
114
|
+
name: 'Brienne',
|
|
115
|
+
kind: 'Thorn Hedgehog',
|
|
116
|
+
biography: 'Brienne of Bark, the cream mini hedgehog.',
|
|
117
|
+
age: 7,
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: '12',
|
|
121
|
+
name: 'Bruno',
|
|
122
|
+
kind: 'Gargoyle',
|
|
123
|
+
biography:
|
|
124
|
+
"Bruno is a gargoyle. He's a stony fellow — I never needed more than a day to teach him to scowl.",
|
|
125
|
+
age: 5,
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
id: '13',
|
|
129
|
+
name: 'Cabo',
|
|
130
|
+
kind: 'Swamp Rat',
|
|
131
|
+
biography:
|
|
132
|
+
'Cabo is a mix of swamp rat, imp, and unknown. Fat and grumpy but lovable.',
|
|
133
|
+
age: 9,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: '14',
|
|
137
|
+
name: 'Chai',
|
|
138
|
+
kind: 'Moon Moth',
|
|
139
|
+
biography: 'Moonlight and graveyards are the only two things that matter.',
|
|
140
|
+
age: 1,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: '15',
|
|
144
|
+
name: 'Charlie',
|
|
145
|
+
kind: 'Direwolf',
|
|
146
|
+
biography: 'The goodest boy in the whole haunted wood.',
|
|
147
|
+
age: 3,
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: '16',
|
|
151
|
+
name: 'Coco',
|
|
152
|
+
kind: 'Coffin Beetle',
|
|
153
|
+
biography: 'Loves coffins and crumbs more than anything.',
|
|
154
|
+
age: 6,
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
id: '17',
|
|
158
|
+
name: 'Daisy',
|
|
159
|
+
kind: 'Bloodhound',
|
|
160
|
+
biography: 'Will follow any blood trail anywhere, anytime.',
|
|
161
|
+
age: 8,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
id: '18',
|
|
165
|
+
name: 'Duke',
|
|
166
|
+
kind: 'Hellhound',
|
|
167
|
+
biography: 'Guard hound by day, couch potato by night.',
|
|
168
|
+
age: 11,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
id: '19',
|
|
172
|
+
name: 'Ella',
|
|
173
|
+
kind: 'Nightmare Mare',
|
|
174
|
+
biography: 'Short legs, big nightmares, endless midnight gallops.',
|
|
175
|
+
age: 4,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
id: '20',
|
|
179
|
+
name: 'Finn',
|
|
180
|
+
kind: 'Frost Lynx',
|
|
181
|
+
biography: 'Loves snowstorms and howling at the blood moon.',
|
|
182
|
+
age: 7,
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
id: '21',
|
|
186
|
+
name: 'Ginger',
|
|
187
|
+
kind: 'Ember Salamander',
|
|
188
|
+
biography: 'Red and rambunctious with boundless hellfire.',
|
|
189
|
+
age: 5,
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: '22',
|
|
193
|
+
name: 'Hank',
|
|
194
|
+
kind: 'Grave Toad',
|
|
195
|
+
biography: 'Warts for days and a croak that never quits.',
|
|
196
|
+
age: 9,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: '23',
|
|
200
|
+
name: 'Izzy',
|
|
201
|
+
kind: 'Shadow Fox',
|
|
202
|
+
biography: 'Smarter than most necromancers I know.',
|
|
203
|
+
age: 3,
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
id: '24',
|
|
207
|
+
name: 'Jax',
|
|
208
|
+
kind: 'Iron Boar',
|
|
209
|
+
biography: 'Gentle giant who loves kids and belly scratches.',
|
|
210
|
+
age: 6,
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: '25',
|
|
214
|
+
name: 'Koda',
|
|
215
|
+
kind: 'Obsidian Panther',
|
|
216
|
+
biography: 'Loyal, fluffy, and fiercely protective of the crypt.',
|
|
217
|
+
age: 8,
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
id: '26',
|
|
221
|
+
name: 'Luna',
|
|
222
|
+
kind: 'Night Owl',
|
|
223
|
+
biography: 'A cloud on silent wings with a permanent stare.',
|
|
224
|
+
age: 2,
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: '27',
|
|
228
|
+
name: 'Max',
|
|
229
|
+
kind: 'Gargoyle',
|
|
230
|
+
biography: 'Looks tough, but melts for ear scratches.',
|
|
231
|
+
age: 10,
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: '28',
|
|
235
|
+
name: 'Nala',
|
|
236
|
+
kind: 'Sable Marten',
|
|
237
|
+
biography: 'Hypoallergenic and proud of it.',
|
|
238
|
+
age: 4,
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
id: '29',
|
|
242
|
+
name: 'Oscar',
|
|
243
|
+
kind: 'Cave Eel',
|
|
244
|
+
biography: 'Long boy of the underground rivers with big dreams.',
|
|
245
|
+
age: 12,
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
id: '30',
|
|
249
|
+
name: 'Penny',
|
|
250
|
+
kind: 'Moon Moth',
|
|
251
|
+
biography: 'Lap moth extraordinaire and candle connoisseur.',
|
|
252
|
+
age: 7,
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
id: '31',
|
|
256
|
+
name: 'Rex',
|
|
257
|
+
kind: 'Hellhound',
|
|
258
|
+
biography: 'Fast, fearless, and first to the blood bowl.',
|
|
259
|
+
age: 5,
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: '32',
|
|
263
|
+
name: 'Sadie',
|
|
264
|
+
kind: 'Direwolf',
|
|
265
|
+
biography: 'Herds everything, including the ghosts.',
|
|
266
|
+
age: 3,
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
id: '33',
|
|
270
|
+
name: 'Tucker',
|
|
271
|
+
kind: 'Bloodhound',
|
|
272
|
+
biography: 'Tennis ball enthusiast and professional fetcher of bones.',
|
|
273
|
+
age: 6,
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
id: '34',
|
|
277
|
+
name: 'Willow',
|
|
278
|
+
kind: 'Nightmare Mare',
|
|
279
|
+
biography: 'Retired racer, full-time lounger in the mist.',
|
|
280
|
+
age: 8,
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
id: '35',
|
|
284
|
+
name: 'Zeus',
|
|
285
|
+
kind: 'Gargoyle',
|
|
286
|
+
biography: 'Thinks he is a lap gargoyle despite weighing 150 lbs.',
|
|
287
|
+
age: 4,
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
id: '36',
|
|
291
|
+
name: 'Rosie',
|
|
292
|
+
kind: 'Imp',
|
|
293
|
+
biography: 'Tiny but mighty with a cackle bigger than her bite.',
|
|
294
|
+
age: 2,
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
id: '37',
|
|
298
|
+
name: 'Scout',
|
|
299
|
+
kind: 'Raven',
|
|
300
|
+
biography: 'Adventure buddy who never says no to a midnight flight.',
|
|
301
|
+
age: 5,
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
id: '38',
|
|
305
|
+
name: 'Teddy',
|
|
306
|
+
kind: 'Albino Crocodile',
|
|
307
|
+
biography: 'Gentle giant of the castle moat.',
|
|
308
|
+
age: 7,
|
|
309
|
+
},
|
|
310
|
+
];
|
|
311
|
+
|
|
312
|
+
const kindValues = [
|
|
313
|
+
{value: 'Vampire Bat', label: 'Vampire Bat'},
|
|
314
|
+
{value: 'Black Cat', label: 'Black Cat'},
|
|
315
|
+
{value: 'Hellhound', label: 'Hellhound'},
|
|
316
|
+
{value: 'Raven', label: 'Raven'},
|
|
317
|
+
{value: 'Bloodhound', label: 'Bloodhound'},
|
|
318
|
+
{value: 'Imp', label: 'Imp'},
|
|
319
|
+
{value: 'Wisp', label: 'Wisp'},
|
|
320
|
+
{value: 'Iron Boar', label: 'Iron Boar'},
|
|
321
|
+
{value: 'Mist Ferret', label: 'Mist Ferret'},
|
|
322
|
+
{value: 'Obsidian Panther', label: 'Obsidian Panther'},
|
|
323
|
+
{value: 'Thorn Hedgehog', label: 'Thorn Hedgehog'},
|
|
324
|
+
{value: 'Gargoyle', label: 'Gargoyle'},
|
|
325
|
+
{value: 'Swamp Rat', label: 'Swamp Rat'},
|
|
326
|
+
{value: 'Moon Moth', label: 'Moon Moth'},
|
|
327
|
+
{value: 'Direwolf', label: 'Direwolf'},
|
|
328
|
+
{value: 'Coffin Beetle', label: 'Coffin Beetle'},
|
|
329
|
+
{value: 'Nightmare Mare', label: 'Nightmare Mare'},
|
|
330
|
+
{value: 'Frost Lynx', label: 'Frost Lynx'},
|
|
331
|
+
{value: 'Ember Salamander', label: 'Ember Salamander'},
|
|
332
|
+
{value: 'Grave Toad', label: 'Grave Toad'},
|
|
333
|
+
{value: 'Shadow Fox', label: 'Shadow Fox'},
|
|
334
|
+
{value: 'Night Owl', label: 'Night Owl'},
|
|
335
|
+
{value: 'Sable Marten', label: 'Sable Marten'},
|
|
336
|
+
{value: 'Cave Eel', label: 'Cave Eel'},
|
|
337
|
+
{value: 'Albino Crocodile', label: 'Albino Crocodile'},
|
|
338
|
+
{value: 'Crypt Spider', label: 'Crypt Spider'},
|
|
339
|
+
{value: 'Carrion Crow', label: 'Carrion Crow'},
|
|
340
|
+
{value: 'Bone Vulture', label: 'Bone Vulture'},
|
|
341
|
+
{value: 'Albino Python', label: 'Albino Python'},
|
|
342
|
+
];
|
|
343
|
+
|
|
344
|
+
const fieldDefs = [
|
|
345
|
+
{key: 'name', type: 'string', label: 'Name'},
|
|
346
|
+
{key: 'kind', type: 'enum', label: 'Kind', enumValues: kindValues},
|
|
347
|
+
{key: 'biography', type: 'string', label: 'Biography'},
|
|
348
|
+
] as const;
|
|
349
|
+
|
|
350
|
+
const columns: TableColumn<FamiliarRow>[] = [
|
|
351
|
+
{
|
|
352
|
+
key: 'name',
|
|
353
|
+
header: 'Name',
|
|
354
|
+
width: proportional(2),
|
|
355
|
+
renderCell: (item: FamiliarRow) => (
|
|
356
|
+
<HStack gap={3} vAlign="center">
|
|
357
|
+
<Avatar name={item.name} size="md" />
|
|
358
|
+
<StackItem size="fill">
|
|
359
|
+
<VStack gap={0}>
|
|
360
|
+
<Text type="body" maxLines={1}>
|
|
361
|
+
{item.name}
|
|
362
|
+
</Text>
|
|
363
|
+
<Text type="supporting" color="secondary" maxLines={1}>
|
|
364
|
+
{item.kind}
|
|
365
|
+
</Text>
|
|
366
|
+
</VStack>
|
|
367
|
+
</StackItem>
|
|
368
|
+
</HStack>
|
|
369
|
+
),
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
key: 'biography',
|
|
373
|
+
header: 'Biography',
|
|
374
|
+
width: proportional(5),
|
|
375
|
+
renderCell: (item: FamiliarRow) => <Text type="body">{item.biography}</Text>,
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
key: 'age',
|
|
379
|
+
header: 'Age',
|
|
380
|
+
width: pixel(80),
|
|
381
|
+
renderCell: (item: FamiliarRow) => (
|
|
382
|
+
<Text type="body" hasTabularNumbers>
|
|
383
|
+
{item.age}
|
|
384
|
+
</Text>
|
|
385
|
+
),
|
|
386
|
+
},
|
|
387
|
+
];
|
|
388
|
+
|
|
389
|
+
export default function TablePage() {
|
|
390
|
+
const [filters, setFilters] = useState<PowerSearchFilter[]>([]);
|
|
391
|
+
const {config, applyFilters} = usePowerSearchConfig(fieldDefs, 'Familiars');
|
|
392
|
+
|
|
393
|
+
const filtered = useMemo(() => {
|
|
394
|
+
return applyFilters(filters, allFamiliars);
|
|
395
|
+
}, [filters, applyFilters]);
|
|
396
|
+
|
|
397
|
+
return (
|
|
398
|
+
<Layout
|
|
399
|
+
height="fill"
|
|
400
|
+
header={
|
|
401
|
+
<LayoutHeader hasDivider>
|
|
402
|
+
<HStack gap={2} vAlign="center">
|
|
403
|
+
<StackItem size="fill">
|
|
404
|
+
<Heading level={1}>Familiars</Heading>
|
|
405
|
+
</StackItem>
|
|
406
|
+
<IconButton
|
|
407
|
+
label="Filter"
|
|
408
|
+
icon={<Icon icon={Filter} size="sm" />}
|
|
409
|
+
variant="ghost"
|
|
410
|
+
/>
|
|
411
|
+
<IconButton
|
|
412
|
+
label="Download"
|
|
413
|
+
icon={<Icon icon={Download} size="sm" />}
|
|
414
|
+
variant="ghost"
|
|
415
|
+
/>
|
|
416
|
+
<Button label="Add" icon={<Icon icon={Plus} size="sm" />} />
|
|
417
|
+
</HStack>
|
|
418
|
+
</LayoutHeader>
|
|
419
|
+
}
|
|
420
|
+
content={
|
|
421
|
+
<LayoutContent padding={3}>
|
|
422
|
+
<VStack gap={4}>
|
|
423
|
+
<PowerSearch
|
|
424
|
+
config={config}
|
|
425
|
+
filters={filters}
|
|
426
|
+
onChange={newFilters => {
|
|
427
|
+
setFilters([...newFilters]);
|
|
428
|
+
}}
|
|
429
|
+
placeholder="Search familiars..."
|
|
430
|
+
resultCount={filtered.length}
|
|
431
|
+
/>
|
|
432
|
+
<Table<FamiliarRow>
|
|
433
|
+
data={filtered}
|
|
434
|
+
columns={columns}
|
|
435
|
+
idKey="id"
|
|
436
|
+
density="balanced"
|
|
437
|
+
dividers="rows"
|
|
438
|
+
hasHover
|
|
439
|
+
/>
|
|
440
|
+
</VStack>
|
|
441
|
+
</LayoutContent>
|
|
442
|
+
}
|
|
443
|
+
/>
|
|
444
|
+
);
|
|
445
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import {useState} from 'react';
|
|
4
|
+
import {Layout, LayoutHeader, LayoutContent, HStack} from '@astryxdesign/core/Layout';
|
|
5
|
+
import {Text, Heading} from '@astryxdesign/core/Text';
|
|
6
|
+
import {Button} from '@astryxdesign/core/Button';
|
|
7
|
+
import {Table} from '@astryxdesign/core/Table';
|
|
8
|
+
import {Badge} from '@astryxdesign/core/Badge';
|
|
9
|
+
import type {TableColumn} from '@astryxdesign/core/Table';
|
|
10
|
+
|
|
11
|
+
type Relic = {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
status: 'active' | 'inactive';
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const SAMPLE_DATA: Relic[] = [
|
|
19
|
+
{id: '1', name: 'Blood Vial', status: 'active', updatedAt: '2025-01-15'},
|
|
20
|
+
{id: '2', name: 'Garlic Charm', status: 'inactive', updatedAt: '2025-01-14'},
|
|
21
|
+
{id: '3', name: 'Silver Stake', status: 'active', updatedAt: '2025-01-13'},
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const columns: TableColumn<Relic>[] = [
|
|
25
|
+
{
|
|
26
|
+
key: 'name',
|
|
27
|
+
header: 'Name',
|
|
28
|
+
renderCell: (item: Relic) => (
|
|
29
|
+
<Text type="body" weight="semibold">
|
|
30
|
+
{item.name}
|
|
31
|
+
</Text>
|
|
32
|
+
),
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
key: 'status',
|
|
36
|
+
header: 'Status',
|
|
37
|
+
renderCell: (item: Relic) => (
|
|
38
|
+
<Badge
|
|
39
|
+
variant={item.status === 'active' ? 'success' : 'neutral'}
|
|
40
|
+
label={item.status.charAt(0).toUpperCase() + item.status.slice(1)}
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
key: 'updatedAt',
|
|
46
|
+
header: 'Updated',
|
|
47
|
+
renderCell: (item: Relic) => (
|
|
48
|
+
<Text type="body" color="secondary" hasTabularNumbers>
|
|
49
|
+
{item.updatedAt}
|
|
50
|
+
</Text>
|
|
51
|
+
),
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
key: 'actions',
|
|
55
|
+
header: 'Actions',
|
|
56
|
+
renderCell: (item: Relic) => (
|
|
57
|
+
<Button label={`Edit ${item.name}`} variant="secondary" size="sm">
|
|
58
|
+
Edit
|
|
59
|
+
</Button>
|
|
60
|
+
),
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
|
|
64
|
+
export default function SimpleTable() {
|
|
65
|
+
const [data] = useState<Relic[]>(SAMPLE_DATA);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Layout
|
|
69
|
+
header={
|
|
70
|
+
<LayoutHeader hasDivider>
|
|
71
|
+
<HStack vAlign="center" hAlign="between">
|
|
72
|
+
<Heading level={1}>Artifacts</Heading>
|
|
73
|
+
<Button label="Add artifact" variant="primary" />
|
|
74
|
+
</HStack>
|
|
75
|
+
</LayoutHeader>
|
|
76
|
+
}
|
|
77
|
+
content={
|
|
78
|
+
<LayoutContent>
|
|
79
|
+
<Table<Relic> data={data} columns={columns} idKey="id" hasHover />
|
|
80
|
+
</LayoutContent>
|
|
81
|
+
}
|
|
82
|
+
/>
|
|
83
|
+
);
|
|
84
|
+
}
|