@sero-ai/ui 0.4.0 → 0.4.1
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/.turbo/turbo-build.log +311 -324
- package/CHANGELOG.md +22 -2
- package/LICENSE +201 -0
- package/dist/components/dashboard/catalog.cjs +1 -322
- package/dist/components/dashboard/catalog.d.cts +1 -2
- package/dist/components/dashboard/catalog.d.ts +1 -2
- package/dist/components/dashboard/catalog.js +0 -322
- package/dist/components/dashboard/catalog.json +312 -0
- package/dist/components/dashboard/index.d.cts +1 -1
- package/dist/components/dashboard/index.d.ts +1 -1
- package/dist/components/dashboard/status.cjs +6 -2
- package/dist/components/dashboard/status.js +7 -3
- package/dist/components/dashboard/tone.cjs +9 -1
- package/dist/components/dashboard/tone.d.cts +7 -1
- package/dist/components/dashboard/tone.d.ts +7 -1
- package/dist/components/dashboard/tone.js +8 -0
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/reference.cjs +1251 -3
- package/dist/reference.d.cts +11 -5
- package/dist/reference.d.ts +11 -5
- package/dist/reference.js +1224 -6
- package/package.json +52 -69
- package/scripts/ensure-pnpm-publish.mjs +23 -0
- package/scripts/smoke-dist.mjs +68 -0
- package/src/components/dashboard/__tests__/catalog.test.ts +7 -2
- package/src/components/dashboard/__tests__/state.test.tsx +19 -2
- package/src/components/dashboard/catalog.json +312 -0
- package/src/components/dashboard/catalog.ts +6 -328
- package/src/components/dashboard/index.ts +2 -2
- package/src/components/dashboard/status.tsx +15 -2
- package/src/components/dashboard/tone.ts +13 -0
- package/src/index.ts +3 -1
- package/tsup.config.ts +13 -3
- package/tsup.reference.config.ts +15 -0
- package/dist/components/reference/ActivityExample.cjs +0 -47
- package/dist/components/reference/ActivityExample.d.cts +0 -5
- package/dist/components/reference/ActivityExample.d.ts +0 -5
- package/dist/components/reference/ActivityExample.js +0 -47
- package/dist/components/reference/ResourceExample.cjs +0 -54
- package/dist/components/reference/ResourceExample.d.cts +0 -5
- package/dist/components/reference/ResourceExample.d.ts +0 -5
- package/dist/components/reference/ResourceExample.js +0 -54
- package/dist/components/reference/SchedulerExample.cjs +0 -68
- package/dist/components/reference/SchedulerExample.d.cts +0 -5
- package/dist/components/reference/SchedulerExample.d.ts +0 -5
- package/dist/components/reference/SchedulerExample.js +0 -68
- package/dist/components/reference/StarterExample.cjs +0 -34
- package/dist/components/reference/StarterExample.d.cts +0 -5
- package/dist/components/reference/StarterExample.d.ts +0 -5
- package/dist/components/reference/StarterExample.js +0 -34
- package/dist/components/reference/index.cjs +0 -10
- package/dist/components/reference/index.d.cts +0 -5
- package/dist/components/reference/index.d.ts +0 -5
- package/dist/components/reference/index.js +0 -10
- package/dist/dashboard-catalog.cjs +0 -8
- package/dist/dashboard-catalog.d.cts +0 -1
- package/dist/dashboard-catalog.d.ts +0 -1
- package/dist/dashboard-catalog.js +0 -8
- package/src/dashboard-catalog.ts +0 -13
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// Dashboard component catalogue — the source of truth
|
|
1
|
+
// Dashboard component catalogue — type for the JSON source of truth.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
3
|
+
// The catalogue data lives in `catalog.json` (plain data, no compiler needed)
|
|
4
|
+
// and ships as `@sero-ai/ui/dashboard-catalog.json`. Tooling and the agent read
|
|
5
|
+
// that file directly; this module only provides the entry type so TypeScript
|
|
6
|
+
// callers can type the parsed JSON.
|
|
7
7
|
//
|
|
8
|
-
// Keep
|
|
8
|
+
// Keep `catalog.json` in step with the two readable views on release:
|
|
9
9
|
// - packages/templates/skills/sero-dashboard-ui/references/component-catalog.md
|
|
10
10
|
// - the docs-site dashboard component catalogue page
|
|
11
11
|
// (Generation + drift validation is a deferred follow-up.)
|
|
@@ -27,325 +27,3 @@ export interface DashboardComponentCatalogEntry {
|
|
|
27
27
|
status: "stable" | "experimental";
|
|
28
28
|
example?: string;
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
export const dashboardComponentCatalog: DashboardComponentCatalogEntry[] = [
|
|
32
|
-
// ── Layout and structure ──────────────────────────────────────
|
|
33
|
-
{
|
|
34
|
-
name: "WidgetContent",
|
|
35
|
-
category: "layout",
|
|
36
|
-
kind: "composite",
|
|
37
|
-
summary:
|
|
38
|
-
"Full-height widget frame with standard padding and a container-query boundary.",
|
|
39
|
-
useWhen: "As the outermost element of every dashboard widget.",
|
|
40
|
-
related: ["Stack", "Inline"],
|
|
41
|
-
status: "stable",
|
|
42
|
-
example: "<WidgetContent><Stack gap=\"sm\">…</Stack></WidgetContent>",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "Stack",
|
|
46
|
-
category: "layout",
|
|
47
|
-
kind: "composite",
|
|
48
|
-
summary: "Vertical layout with semantic spacing, alignment and optional scrolling.",
|
|
49
|
-
useWhen: "For the primary top-to-bottom content flow inside a widget.",
|
|
50
|
-
related: ["Inline", "WidgetContent"],
|
|
51
|
-
status: "stable",
|
|
52
|
-
example: "<Stack gap=\"sm\" scroll>…</Stack>",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
name: "Inline",
|
|
56
|
-
category: "layout",
|
|
57
|
-
kind: "composite",
|
|
58
|
-
summary: "Horizontal layout with spacing, alignment, wrap and justify.",
|
|
59
|
-
useWhen: "For a row of items such as a header with a trailing action.",
|
|
60
|
-
related: ["Stack"],
|
|
61
|
-
status: "stable",
|
|
62
|
-
example: "<Inline justify=\"between\" align=\"center\">…</Inline>",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: "Grid",
|
|
66
|
-
category: "layout",
|
|
67
|
-
kind: "composite",
|
|
68
|
-
summary: "Responsive grid with bounded columns and gap.",
|
|
69
|
-
useWhen: "For metric and summary layouts that reflow by width.",
|
|
70
|
-
related: ["MetricGroup"],
|
|
71
|
-
status: "stable",
|
|
72
|
-
example: "<Grid columns=\"auto\" minColumnWidth={120}>…</Grid>",
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
name: "Section",
|
|
76
|
-
category: "layout",
|
|
77
|
-
kind: "composite",
|
|
78
|
-
summary: "Compact section with optional heading, description and trailing action.",
|
|
79
|
-
useWhen: "To group related content under a labelled heading.",
|
|
80
|
-
related: ["Divider", "Heading"],
|
|
81
|
-
status: "stable",
|
|
82
|
-
example: "<Section heading=\"Summary\" action={…}>…</Section>",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
name: "Divider",
|
|
86
|
-
category: "layout",
|
|
87
|
-
kind: "composite",
|
|
88
|
-
summary: "Compact horizontal or vertical divider built on Separator.",
|
|
89
|
-
useWhen: "To separate sections without a heavy border.",
|
|
90
|
-
related: ["Section"],
|
|
91
|
-
status: "stable",
|
|
92
|
-
example: "<Divider spacing=\"sm\" />",
|
|
93
|
-
},
|
|
94
|
-
// ── Typography and media ──────────────────────────────────────
|
|
95
|
-
{
|
|
96
|
-
name: "Text",
|
|
97
|
-
category: "typography",
|
|
98
|
-
kind: "composite",
|
|
99
|
-
summary:
|
|
100
|
-
"Semantic text variants (body, label, supporting, muted, numeric) with truncation.",
|
|
101
|
-
useWhen: "For any text, instead of ad-hoc font-size utilities.",
|
|
102
|
-
related: ["Heading"],
|
|
103
|
-
status: "stable",
|
|
104
|
-
example: "<Text variant=\"label\">Jobs</Text>",
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: "Heading",
|
|
108
|
-
category: "typography",
|
|
109
|
-
kind: "composite",
|
|
110
|
-
summary: "Compact heading levels and sizes that keep correct HTML semantics.",
|
|
111
|
-
useWhen: "For section and view titles.",
|
|
112
|
-
related: ["Section", "Text"],
|
|
113
|
-
status: "stable",
|
|
114
|
-
example: "<Heading level={2} size=\"md\">Overview</Heading>",
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
name: "Icon",
|
|
118
|
-
category: "typography",
|
|
119
|
-
kind: "composite",
|
|
120
|
-
summary: "Consistent icon wrapper for size, tone and accessibility.",
|
|
121
|
-
useWhen: "To render an icon component with a shared size and tone.",
|
|
122
|
-
related: ["IconButton"],
|
|
123
|
-
status: "stable",
|
|
124
|
-
example: "<Icon icon={Clock} size=\"sm\" tone=\"warning\" />",
|
|
125
|
-
},
|
|
126
|
-
// ── Data display ──────────────────────────────────────────────
|
|
127
|
-
{
|
|
128
|
-
name: "Metric",
|
|
129
|
-
category: "data-display",
|
|
130
|
-
kind: "composite",
|
|
131
|
-
summary: "Label + value with optional icon, supporting text and trend.",
|
|
132
|
-
useWhen: "To show a single number inline.",
|
|
133
|
-
related: ["MetricCard", "MetricGroup"],
|
|
134
|
-
status: "stable",
|
|
135
|
-
example: "<Metric label=\"Jobs\" value={6} />",
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: "MetricCard",
|
|
139
|
-
category: "data-display",
|
|
140
|
-
kind: "composite",
|
|
141
|
-
summary: "A contained surface for a Metric or compact summary.",
|
|
142
|
-
useWhen: "To give a metric its own bounded card.",
|
|
143
|
-
related: ["Metric", "MetricGroup"],
|
|
144
|
-
status: "stable",
|
|
145
|
-
example: "<MetricCard><Metric label=\"Jobs\" value={6} /></MetricCard>",
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: "MetricGroup",
|
|
149
|
-
category: "data-display",
|
|
150
|
-
kind: "composite",
|
|
151
|
-
summary: "Arranges multiple metrics responsively in a bounded grid.",
|
|
152
|
-
useWhen: "To show several metrics that reflow by width.",
|
|
153
|
-
related: ["Metric", "Grid"],
|
|
154
|
-
status: "stable",
|
|
155
|
-
example: "<MetricGroup><Metric … /><Metric … /></MetricGroup>",
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
name: "Status",
|
|
159
|
-
category: "data-display",
|
|
160
|
-
kind: "composite",
|
|
161
|
-
summary: "Semantic status dot, label or pill with neutral/success/warning/error/info tones.",
|
|
162
|
-
useWhen: "To show a health or state indicator. Map domain status onto a tone.",
|
|
163
|
-
related: ["Badge"],
|
|
164
|
-
status: "stable",
|
|
165
|
-
example: "<Status tone=\"success\">Active</Status>",
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: "Badge",
|
|
169
|
-
category: "data-display",
|
|
170
|
-
kind: "primitive",
|
|
171
|
-
summary: "Existing badge primitive, extended with success/warning/info tones.",
|
|
172
|
-
useWhen: "For compact counts, tags and category labels.",
|
|
173
|
-
related: ["Status"],
|
|
174
|
-
status: "stable",
|
|
175
|
-
example: "<Badge variant=\"success\">Passed</Badge>",
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: "KeyValue",
|
|
179
|
-
category: "data-display",
|
|
180
|
-
kind: "composite",
|
|
181
|
-
summary: "A single label/value row with predictable alignment and truncation.",
|
|
182
|
-
useWhen: "For metadata, totals and configuration summaries.",
|
|
183
|
-
related: ["KeyValueList"],
|
|
184
|
-
status: "stable",
|
|
185
|
-
example: "<KeyValue label=\"Region\" value=\"eu-west-1\" mono />",
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: "KeyValueList",
|
|
189
|
-
category: "data-display",
|
|
190
|
-
kind: "composite",
|
|
191
|
-
summary: "A vertical list of KeyValue rows.",
|
|
192
|
-
useWhen: "For a block of metadata pairs.",
|
|
193
|
-
related: ["KeyValue"],
|
|
194
|
-
status: "stable",
|
|
195
|
-
example: "<KeyValueList><KeyValue … /></KeyValueList>",
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
name: "ItemList",
|
|
199
|
-
category: "data-display",
|
|
200
|
-
kind: "composite",
|
|
201
|
-
summary: "Compact rows with leading media, text, trailing metadata, actions and overflow.",
|
|
202
|
-
useWhen: "For entity lists (files, notes, results).",
|
|
203
|
-
related: ["ItemListItem", "ActivityList"],
|
|
204
|
-
status: "stable",
|
|
205
|
-
example: "<ItemList overflowCount={3}><ItemListItem … /></ItemList>",
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
name: "ItemListItem",
|
|
209
|
-
category: "data-display",
|
|
210
|
-
kind: "composite",
|
|
211
|
-
summary: "A single compact list row with media, primary/secondary text and actions.",
|
|
212
|
-
useWhen: "As the row inside an ItemList.",
|
|
213
|
-
related: ["ItemList"],
|
|
214
|
-
status: "stable",
|
|
215
|
-
example: "<ItemListItem primary=\"Report.pdf\" trailing=\"2h\" />",
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
name: "ActivityList",
|
|
219
|
-
category: "data-display",
|
|
220
|
-
kind: "composite",
|
|
221
|
-
summary: "A chronological list for recent events with a shared overflow footer.",
|
|
222
|
-
useWhen: "For time-ordered activity or upcoming events.",
|
|
223
|
-
related: ["ActivityListItem", "ItemList"],
|
|
224
|
-
status: "stable",
|
|
225
|
-
example: "<ActivityList><ActivityListItem … /></ActivityList>",
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: "ActivityListItem",
|
|
229
|
-
category: "data-display",
|
|
230
|
-
kind: "composite",
|
|
231
|
-
summary: "An event row with a status marker or icon, label, timestamp and detail.",
|
|
232
|
-
useWhen: "As the row inside an ActivityList.",
|
|
233
|
-
related: ["ActivityList", "Status"],
|
|
234
|
-
status: "stable",
|
|
235
|
-
example: "<ActivityListItem label=\"Backup\" timestamp=\"08:00\" tone=\"success\" />",
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
name: "ProgressRing",
|
|
239
|
-
category: "data-display",
|
|
240
|
-
kind: "composite",
|
|
241
|
-
summary: "Accessible circular progress / donut gauge, no charting dependency.",
|
|
242
|
-
useWhen: "For a bounded value such as a success rate or usage percentage.",
|
|
243
|
-
related: ["Metric"],
|
|
244
|
-
status: "stable",
|
|
245
|
-
example: "<ProgressRing value={75} label=\"Success rate\" tone=\"success\" />",
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
name: "StaleIndicator",
|
|
249
|
-
category: "data-display",
|
|
250
|
-
kind: "composite",
|
|
251
|
-
summary: "Compact hint that data may be out of date, with optional refresh action.",
|
|
252
|
-
useWhen: "When displayed data can lag its source.",
|
|
253
|
-
related: ["DataBoundary"],
|
|
254
|
-
status: "stable",
|
|
255
|
-
example: "<StaleIndicator lastUpdated=\"Updated 5m ago\" onRefresh={…} />",
|
|
256
|
-
},
|
|
257
|
-
// ── Runtime states and feedback ───────────────────────────────
|
|
258
|
-
{
|
|
259
|
-
name: "DataBoundary",
|
|
260
|
-
category: "state",
|
|
261
|
-
kind: "composite",
|
|
262
|
-
summary: "Selects presentation for loading / ready / empty / stale / error states.",
|
|
263
|
-
useWhen: "To switch a widget's content by data state without owning fetching.",
|
|
264
|
-
related: ["EmptyState", "MetricSkeleton", "StaleIndicator"],
|
|
265
|
-
status: "stable",
|
|
266
|
-
example: "<DataBoundary state={state} loading={…} empty={…} error={…}>…</DataBoundary>",
|
|
267
|
-
},
|
|
268
|
-
{
|
|
269
|
-
name: "EmptyState",
|
|
270
|
-
category: "state",
|
|
271
|
-
kind: "composite",
|
|
272
|
-
summary: "Compact empty state built on the Empty primitives.",
|
|
273
|
-
useWhen: "When there is nothing to show yet.",
|
|
274
|
-
related: ["DataBoundary"],
|
|
275
|
-
status: "stable",
|
|
276
|
-
example: "<EmptyState icon={Inbox} title=\"No activity yet\" />",
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
name: "Alert",
|
|
280
|
-
category: "state",
|
|
281
|
-
kind: "primitive",
|
|
282
|
-
summary: "Existing alert primitive for inline warnings and errors.",
|
|
283
|
-
useWhen: "For a persistent inline message inside a widget or view.",
|
|
284
|
-
related: ["DataBoundary"],
|
|
285
|
-
status: "stable",
|
|
286
|
-
example: "<Alert variant=\"destructive\">Failed to load</Alert>",
|
|
287
|
-
},
|
|
288
|
-
{
|
|
289
|
-
name: "MetricSkeleton",
|
|
290
|
-
category: "state",
|
|
291
|
-
kind: "composite",
|
|
292
|
-
summary: "Loading placeholder for a row of metrics.",
|
|
293
|
-
useWhen: "As the `loading` fallback for metric layouts.",
|
|
294
|
-
related: ["DataBoundary", "ListSkeleton"],
|
|
295
|
-
status: "stable",
|
|
296
|
-
example: "<MetricSkeleton count={3} />",
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
name: "ListSkeleton",
|
|
300
|
-
category: "state",
|
|
301
|
-
kind: "composite",
|
|
302
|
-
summary: "Loading placeholder for a list of rows.",
|
|
303
|
-
useWhen: "As the `loading` fallback for item lists.",
|
|
304
|
-
related: ["DataBoundary", "ItemList"],
|
|
305
|
-
status: "stable",
|
|
306
|
-
example: "<ListSkeleton count={4} />",
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
name: "ActivitySkeleton",
|
|
310
|
-
category: "state",
|
|
311
|
-
kind: "composite",
|
|
312
|
-
summary: "Loading placeholder for an activity list.",
|
|
313
|
-
useWhen: "As the `loading` fallback for activity feeds.",
|
|
314
|
-
related: ["DataBoundary", "ActivityList"],
|
|
315
|
-
status: "stable",
|
|
316
|
-
example: "<ActivitySkeleton count={4} />",
|
|
317
|
-
},
|
|
318
|
-
{
|
|
319
|
-
name: "Skeleton",
|
|
320
|
-
category: "state",
|
|
321
|
-
kind: "primitive",
|
|
322
|
-
summary: "Existing skeleton primitive for bespoke loading shapes.",
|
|
323
|
-
useWhen: "When the prebuilt skeleton patterns do not fit.",
|
|
324
|
-
related: ["MetricSkeleton", "ListSkeleton", "ActivitySkeleton"],
|
|
325
|
-
status: "stable",
|
|
326
|
-
example: "<Skeleton className=\"h-4 w-24\" />",
|
|
327
|
-
},
|
|
328
|
-
// ── Actions ───────────────────────────────────────────────────
|
|
329
|
-
{
|
|
330
|
-
name: "Button",
|
|
331
|
-
category: "action",
|
|
332
|
-
kind: "primitive",
|
|
333
|
-
summary: "Existing button primitive, the standard text-action control.",
|
|
334
|
-
useWhen: "For a labelled action.",
|
|
335
|
-
related: ["IconButton"],
|
|
336
|
-
status: "stable",
|
|
337
|
-
example: "<Button size=\"sm\">Open</Button>",
|
|
338
|
-
},
|
|
339
|
-
{
|
|
340
|
-
name: "IconButton",
|
|
341
|
-
category: "action",
|
|
342
|
-
kind: "composite",
|
|
343
|
-
summary: "Small icon-only button with a required accessible label.",
|
|
344
|
-
useWhen: "For a compact action such as refresh or dismiss.",
|
|
345
|
-
related: ["Button", "Icon"],
|
|
346
|
-
status: "stable",
|
|
347
|
-
example: "<IconButton icon={RotateCw} label=\"Refresh\" size=\"xs\" />",
|
|
348
|
-
},
|
|
349
|
-
];
|
|
350
|
-
|
|
351
|
-
export default dashboardComponentCatalog;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// @sero-ai/ui dashboard components — shared compact presentation for widgets
|
|
2
2
|
// and full plugin views. Import from the package root: `@sero-ai/ui`.
|
|
3
3
|
//
|
|
4
|
-
// The component catalogue (metadata for discovery tooling) is
|
|
5
|
-
//
|
|
4
|
+
// The component catalogue (metadata for discovery tooling) is plain data at
|
|
5
|
+
// `@sero-ai/ui/dashboard-catalog.json`, not exported from here.
|
|
6
6
|
|
|
7
7
|
export * from "./tone";
|
|
8
8
|
export * from "./spacing";
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
|
|
10
10
|
import { cn } from "../../lib/utils";
|
|
11
|
-
import { toneColor, toneDot, tonePill, type Tone } from "./tone";
|
|
11
|
+
import { toneColor, toneDot, toneLabel, tonePill, type Tone } from "./tone";
|
|
12
12
|
|
|
13
13
|
export interface StatusProps extends React.ComponentProps<"span"> {
|
|
14
14
|
tone?: Tone;
|
|
@@ -28,6 +28,16 @@ function Status({
|
|
|
28
28
|
...props
|
|
29
29
|
}: StatusProps) {
|
|
30
30
|
const hasLabel = children != null && children !== "";
|
|
31
|
+
const hasAccessibleName =
|
|
32
|
+
props["aria-label"] != null || props["aria-labelledby"] != null;
|
|
33
|
+
|
|
34
|
+
// A bare indicator (no visible children) is otherwise silent to assistive
|
|
35
|
+
// tech. Give it a text alternative — the caller's aria-label if provided,
|
|
36
|
+
// else the generic tone name — so its state is announced, not an empty region.
|
|
37
|
+
const hiddenLabel =
|
|
38
|
+
!hasLabel && !hasAccessibleName ? (
|
|
39
|
+
<span className="sr-only">{toneLabel[tone]}</span>
|
|
40
|
+
) : null;
|
|
31
41
|
|
|
32
42
|
if (variant === "pill") {
|
|
33
43
|
return (
|
|
@@ -43,6 +53,7 @@ function Status({
|
|
|
43
53
|
>
|
|
44
54
|
<span className={cn("size-1.5 shrink-0 rounded-full", toneDot[tone])} />
|
|
45
55
|
{children}
|
|
56
|
+
{hiddenLabel}
|
|
46
57
|
</span>
|
|
47
58
|
);
|
|
48
59
|
}
|
|
@@ -51,7 +62,8 @@ function Status({
|
|
|
51
62
|
<span
|
|
52
63
|
data-slot="status"
|
|
53
64
|
data-tone={tone}
|
|
54
|
-
// A bare dot carries no text, so
|
|
65
|
+
// A bare dot carries no visible text, so expose its state to assistive
|
|
66
|
+
// tech via role="status" plus the hidden label below.
|
|
55
67
|
role={hasLabel ? undefined : "status"}
|
|
56
68
|
className={cn(
|
|
57
69
|
"inline-flex items-center gap-1.5 text-xs font-medium text-[var(--text-secondary)]",
|
|
@@ -68,6 +80,7 @@ function Status({
|
|
|
68
80
|
)}
|
|
69
81
|
/>
|
|
70
82
|
{children}
|
|
83
|
+
{hiddenLabel}
|
|
71
84
|
</span>
|
|
72
85
|
);
|
|
73
86
|
}
|
|
@@ -25,6 +25,19 @@ export const toneDot: Record<Tone, string> = {
|
|
|
25
25
|
info: "bg-[var(--status-info)]",
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
/**
|
|
29
|
+
* Default accessible name for a tone, used as the text alternative when a
|
|
30
|
+
* status indicator carries no visible label. Generic by design — callers with
|
|
31
|
+
* a domain-specific meaning should pass their own `aria-label`.
|
|
32
|
+
*/
|
|
33
|
+
export const toneLabel: Record<Tone, string> = {
|
|
34
|
+
neutral: "Neutral",
|
|
35
|
+
success: "Success",
|
|
36
|
+
warning: "Warning",
|
|
37
|
+
error: "Error",
|
|
38
|
+
info: "Info",
|
|
39
|
+
};
|
|
40
|
+
|
|
28
41
|
/** Muted tinted background + matching text for a tone (pills, chips). */
|
|
29
42
|
export const tonePill: Record<Tone, string> = {
|
|
30
43
|
neutral: "bg-[var(--surface-flat)] text-[var(--text-secondary)]",
|
package/src/index.ts
CHANGED
|
@@ -133,8 +133,10 @@ export * from "./components/ai-elements/web-preview";
|
|
|
133
133
|
|
|
134
134
|
// ── Dashboard Components ──
|
|
135
135
|
// Compact presentation components for dashboard widgets and full plugin views.
|
|
136
|
-
// The discovery catalogue is
|
|
136
|
+
// The discovery catalogue is plain data at "@sero-ai/ui/dashboard-catalog.json";
|
|
137
|
+
// its entry type is re-exported here for callers that type the parsed JSON.
|
|
137
138
|
export * from "./components/dashboard";
|
|
139
|
+
export type { DashboardComponentCatalogEntry } from "./components/dashboard/catalog";
|
|
138
140
|
|
|
139
141
|
// ── Model Selection Components ──
|
|
140
142
|
export * from "./components/model-selection/available-model-picker";
|
package/tsup.config.ts
CHANGED
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
import { defineConfig } from "tsup";
|
|
2
2
|
import { cpSync } from "node:fs";
|
|
3
3
|
|
|
4
|
+
// Mirror the source tree 1:1 (bundle: false) so deep imports keep working.
|
|
5
|
+
// The reference entry is bundled separately in tsup.reference.config.ts, which
|
|
6
|
+
// the build script runs *after* this pass (this one cleans; that one does not).
|
|
4
7
|
export default defineConfig({
|
|
5
|
-
// Tells tsup to grab everything in your src directory, except tests.
|
|
6
8
|
entry: [
|
|
7
9
|
"src/**/*.{ts,tsx}",
|
|
8
10
|
"!src/**/*.test.{ts,tsx}",
|
|
9
11
|
"!src/**/__tests__/**",
|
|
12
|
+
"!src/reference.ts",
|
|
13
|
+
"!src/components/reference/**",
|
|
10
14
|
],
|
|
11
15
|
format: ["esm", "cjs"],
|
|
12
16
|
dts: true,
|
|
13
17
|
clean: true,
|
|
14
18
|
splitting: true,
|
|
15
|
-
|
|
16
|
-
// This is the golden key: it stops esbuild from merging everything
|
|
19
|
+
|
|
20
|
+
// This is the golden key: it stops esbuild from merging everything
|
|
17
21
|
// into index.js and forces it to mirror your exact folder structure.
|
|
18
22
|
bundle: false,
|
|
19
23
|
onSuccess: () => {
|
|
20
24
|
cpSync("src/styles", "dist/styles", { recursive: true });
|
|
25
|
+
// The catalogue is plain data served as @sero-ai/ui/dashboard-catalog.json;
|
|
26
|
+
// the mirror pass only emits .ts/.tsx, so copy the JSON across by hand.
|
|
27
|
+
cpSync(
|
|
28
|
+
"src/components/dashboard/catalog.json",
|
|
29
|
+
"dist/components/dashboard/catalog.json",
|
|
30
|
+
);
|
|
21
31
|
},
|
|
22
32
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
// Reference examples are a public entrypoint, so bundle them into a single
|
|
4
|
+
// self-contained file that resolves under Node ESM (the rest of the package is
|
|
5
|
+
// bundler-resolved). Runtime deps stay external; only local component code is
|
|
6
|
+
// inlined. Runs after the mirror pass (tsup.config.ts) with `clean: false`, so
|
|
7
|
+
// it adds dist/reference.* without wiping the mirrored output.
|
|
8
|
+
export default defineConfig({
|
|
9
|
+
entry: ["src/reference.ts"],
|
|
10
|
+
format: ["esm", "cjs"],
|
|
11
|
+
dts: true,
|
|
12
|
+
clean: false,
|
|
13
|
+
splitting: false,
|
|
14
|
+
bundle: true,
|
|
15
|
+
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
-
var _lucidereact = require('lucide-react');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
var _dashboard = require('../dashboard');
|
|
13
|
-
var _badge = require('../ui/badge');
|
|
14
|
-
const ITEMS = [
|
|
15
|
-
{ id: "1", title: "quarterly-report.pdf", meta: "2h", badge: "PDF" },
|
|
16
|
-
{ id: "2", title: "design-tokens.json", meta: "5h", badge: "JSON" },
|
|
17
|
-
{ id: "3", title: "release-notes.md", meta: "1d", badge: "MD" }
|
|
18
|
-
];
|
|
19
|
-
function ActivityExample() {
|
|
20
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.WidgetContent, { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "sm", fill: true, children: [
|
|
21
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Inline, { justify: "between", align: "center", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { gap: "xs", align: "center", children: [
|
|
22
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Text, { variant: "label", children: "Recent files" }),
|
|
23
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _badge.Badge, { variant: "info", children: ITEMS.length })
|
|
24
|
-
] }) }),
|
|
25
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Stack, { gap: "none", scroll: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.ItemList, { children: ITEMS.map((f) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
26
|
-
_dashboard.ItemListItem,
|
|
27
|
-
{
|
|
28
|
-
leading: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.FileText, { className: "size-4 text-[var(--text-muted)]" }),
|
|
29
|
-
primary: f.title,
|
|
30
|
-
trailing: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { gap: "xs", align: "center", children: [
|
|
31
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _badge.Badge, { variant: "secondary", children: f.badge }),
|
|
32
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: f.meta })
|
|
33
|
-
] })
|
|
34
|
-
},
|
|
35
|
-
f.id
|
|
36
|
-
)) }) }),
|
|
37
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Inline, { justify: "between", align: "center", children: [
|
|
38
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Status, { tone: "info", variant: "pill", children: "Synced" }),
|
|
39
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.StaleIndicator, { lastUpdated: "Synced 30s ago" })
|
|
40
|
-
] })
|
|
41
|
-
] }) });
|
|
42
|
-
}
|
|
43
|
-
var ActivityExample_default = ActivityExample;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
exports.ActivityExample = ActivityExample; exports.default = ActivityExample_default;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { FileText } from "lucide-react";
|
|
3
|
-
import {
|
|
4
|
-
Inline,
|
|
5
|
-
ItemList,
|
|
6
|
-
ItemListItem,
|
|
7
|
-
Stack,
|
|
8
|
-
StaleIndicator,
|
|
9
|
-
Status,
|
|
10
|
-
Text,
|
|
11
|
-
WidgetContent
|
|
12
|
-
} from "../dashboard";
|
|
13
|
-
import { Badge } from "../ui/badge";
|
|
14
|
-
const ITEMS = [
|
|
15
|
-
{ id: "1", title: "quarterly-report.pdf", meta: "2h", badge: "PDF" },
|
|
16
|
-
{ id: "2", title: "design-tokens.json", meta: "5h", badge: "JSON" },
|
|
17
|
-
{ id: "3", title: "release-notes.md", meta: "1d", badge: "MD" }
|
|
18
|
-
];
|
|
19
|
-
function ActivityExample() {
|
|
20
|
-
return /* @__PURE__ */ jsx(WidgetContent, { children: /* @__PURE__ */ jsxs(Stack, { gap: "sm", fill: true, children: [
|
|
21
|
-
/* @__PURE__ */ jsx(Inline, { justify: "between", align: "center", children: /* @__PURE__ */ jsxs(Inline, { gap: "xs", align: "center", children: [
|
|
22
|
-
/* @__PURE__ */ jsx(Text, { variant: "label", children: "Recent files" }),
|
|
23
|
-
/* @__PURE__ */ jsx(Badge, { variant: "info", children: ITEMS.length })
|
|
24
|
-
] }) }),
|
|
25
|
-
/* @__PURE__ */ jsx(Stack, { gap: "none", scroll: true, children: /* @__PURE__ */ jsx(ItemList, { children: ITEMS.map((f) => /* @__PURE__ */ jsx(
|
|
26
|
-
ItemListItem,
|
|
27
|
-
{
|
|
28
|
-
leading: /* @__PURE__ */ jsx(FileText, { className: "size-4 text-[var(--text-muted)]" }),
|
|
29
|
-
primary: f.title,
|
|
30
|
-
trailing: /* @__PURE__ */ jsxs(Inline, { gap: "xs", align: "center", children: [
|
|
31
|
-
/* @__PURE__ */ jsx(Badge, { variant: "secondary", children: f.badge }),
|
|
32
|
-
/* @__PURE__ */ jsx("span", { children: f.meta })
|
|
33
|
-
] })
|
|
34
|
-
},
|
|
35
|
-
f.id
|
|
36
|
-
)) }) }),
|
|
37
|
-
/* @__PURE__ */ jsxs(Inline, { justify: "between", align: "center", children: [
|
|
38
|
-
/* @__PURE__ */ jsx(Status, { tone: "info", variant: "pill", children: "Synced" }),
|
|
39
|
-
/* @__PURE__ */ jsx(StaleIndicator, { lastUpdated: "Synced 30s ago" })
|
|
40
|
-
] })
|
|
41
|
-
] }) });
|
|
42
|
-
}
|
|
43
|
-
var ActivityExample_default = ActivityExample;
|
|
44
|
-
export {
|
|
45
|
-
ActivityExample,
|
|
46
|
-
ActivityExample_default as default
|
|
47
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _jsxruntime = require('react/jsx-runtime');
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _dashboard = require('../dashboard');
|
|
17
|
-
function Ring({
|
|
18
|
-
value,
|
|
19
|
-
label,
|
|
20
|
-
tone
|
|
21
|
-
}) {
|
|
22
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "xs", align: "center", children: [
|
|
23
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.ProgressRing, { value, label, tone }),
|
|
24
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Text, { variant: "muted", children: label })
|
|
25
|
-
] });
|
|
26
|
-
}
|
|
27
|
-
function ResourceExample() {
|
|
28
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.WidgetContent, { scroll: true, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Stack, { gap: "sm", children: [
|
|
29
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Heading, { level: 2, size: "md", children: "Resources" }),
|
|
30
|
-
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.MetricGroup, { children: [
|
|
31
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "CPU", value: "42%", tone: "success" }),
|
|
32
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "Memory", value: "6.1 GB" }),
|
|
33
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Metric, { label: "Disk", value: "71%", tone: "warning" })
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Divider, {}),
|
|
36
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Section, { heading: "Usage", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.Grid, { columns: 3, gap: "sm", children: [
|
|
37
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ring, { value: 42, label: "CPU", tone: "success" }),
|
|
38
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ring, { value: 61, label: "Memory", tone: "info" }),
|
|
39
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, Ring, { value: 71, label: "Disk", tone: "warning" })
|
|
40
|
-
] }) }),
|
|
41
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Divider, {}),
|
|
42
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Section, { heading: "Host", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _dashboard.KeyValueList, { children: [
|
|
43
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Region", value: "eu-west-1", mono: true }),
|
|
44
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Instance", value: "c7g.xlarge", mono: true }),
|
|
45
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Uptime", value: "14d 6h", mono: true }),
|
|
46
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.KeyValue, { label: "Status", value: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _dashboard.Status, { tone: "success", children: "Healthy" }) })
|
|
47
|
-
] }) })
|
|
48
|
-
] }) });
|
|
49
|
-
}
|
|
50
|
-
var ResourceExample_default = ResourceExample;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
exports.ResourceExample = ResourceExample; exports.default = ResourceExample_default;
|