@vllnt/ui 0.3.0-canary.a42d8f4 → 0.3.0-canary.f3cafe8
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/CHANGELOG.md +2 -0
- package/dist/components/activity-log/activity-log.js +5 -5
- package/dist/components/agent-activity/agent-activity.js +11 -5
- package/dist/components/ai-artifact/ai-artifact.js +23 -6
- package/dist/components/ai-chat-input/ai-chat-input.js +3 -1
- package/dist/components/ai-message-bubble/ai-message-bubble.js +1 -1
- package/dist/components/ai-sidebar/ai-sidebar.js +1 -0
- package/dist/components/auto-reload/auto-reload.js +28 -4
- package/dist/components/blog-card/blog-card.js +1 -1
- package/dist/components/candlestick-chart/candlestick-chart.js +7 -7
- package/dist/components/canvas-shell/canvas-foundation-demo.js +8 -8
- package/dist/components/canvas-view/canvas-view.js +71 -28
- package/dist/components/choropleth-map/choropleth-map.js +6 -1
- package/dist/components/chronological-timeline/chronological-timeline.js +1 -1
- package/dist/components/civilization-card/civilization-card.js +18 -1
- package/dist/components/combobox/combobox.js +2 -2
- package/dist/components/countdown-timer/countdown-timer.js +1 -1
- package/dist/components/data-table/data-table.js +4 -4
- package/dist/components/date-picker/date-picker.js +2 -2
- package/dist/components/era-comparison/era-comparison.js +40 -22
- package/dist/components/flashcard/flashcard.js +8 -2
- package/dist/components/geography-quiz-map/geography-quiz-map.js +6 -5
- package/dist/components/historic-timeline/historic-timeline.js +2 -2
- package/dist/components/interactive-timeline/interactive-timeline.js +15 -2
- package/dist/components/kbd/kbd.js +17 -9
- package/dist/components/knowledge-check/knowledge-check.js +42 -17
- package/dist/components/live-feed/live-feed.js +1 -1
- package/dist/components/map-timeline/map-timeline.js +1 -1
- package/dist/components/metric-gauge/metric-gauge.js +1 -1
- package/dist/components/model-comparison/model-comparison.js +25 -6
- package/dist/components/model-selector/model-selector.js +5 -5
- package/dist/components/multi-select/multi-select.js +3 -3
- package/dist/components/navbar-saas/navbar-saas.js +2 -2
- package/dist/components/newsletter-signup/newsletter-signup.js +2 -2
- package/dist/components/object-card/object-card.js +1 -1
- package/dist/components/parallel-timeline/parallel-timeline.js +2 -2
- package/dist/components/pricing-table/pricing-table.js +55 -18
- package/dist/components/progress-card/progress-card.js +1 -1
- package/dist/components/progress-tracker/progress-tracker.js +3 -3
- package/dist/components/prompt-templates/prompt-templates.js +15 -23
- package/dist/components/scope-selector/scope-selector.js +5 -5
- package/dist/components/search-dialog/search-dialog.js +1 -1
- package/dist/components/sparkline-grid/sparkline-grid.js +3 -2
- package/dist/components/static-code/static-code-copy.js +5 -10
- package/dist/components/status-board/status-board.js +1 -1
- package/dist/components/tour/tour.js +8 -2
- package/dist/components/transaction-list/transaction-list.js +13 -7
- package/dist/components/tutorial-card/tutorial-card.js +1 -1
- package/dist/components/tutorial-complete/tutorial-complete.js +2 -2
- package/dist/components/tutorial-mdx/tutorial-mdx.js +14 -14
- package/dist/components/usage-breakdown/usage-breakdown.js +1 -1
- package/dist/index.d.ts +75 -18
- package/dist/index.js +6 -0
- package/dist/lib/use-theme-preset.js +1 -0
- package/package.json +3 -3
|
@@ -12,15 +12,15 @@ import {
|
|
|
12
12
|
import { ArrowDown, ArrowUp, ArrowUpDown } from "lucide-react";
|
|
13
13
|
import { cn } from "../../lib/utils";
|
|
14
14
|
import { Button } from "../button/button";
|
|
15
|
-
import { Checkbox } from "../checkbox";
|
|
16
|
-
import { Input } from "../input";
|
|
15
|
+
import { Checkbox } from "../checkbox/checkbox";
|
|
16
|
+
import { Input } from "../input/input";
|
|
17
17
|
import {
|
|
18
18
|
Select,
|
|
19
19
|
SelectContent,
|
|
20
20
|
SelectItem,
|
|
21
21
|
SelectTrigger,
|
|
22
22
|
SelectValue
|
|
23
|
-
} from "../select";
|
|
23
|
+
} from "../select/select";
|
|
24
24
|
import {
|
|
25
25
|
Table,
|
|
26
26
|
TableBody,
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
TableHead,
|
|
29
29
|
TableHeader,
|
|
30
30
|
TableRow
|
|
31
|
-
} from "../table";
|
|
31
|
+
} from "../table/table";
|
|
32
32
|
function SortIcon({ direction }) {
|
|
33
33
|
if (direction === "asc") {
|
|
34
34
|
return /* @__PURE__ */ jsx(ArrowUp, { className: "size-4" });
|
|
@@ -4,8 +4,8 @@ import * as React from "react";
|
|
|
4
4
|
import { CalendarIcon } from "lucide-react";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
import { Button } from "../button/button";
|
|
7
|
-
import { Calendar } from "../calendar";
|
|
8
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
|
|
7
|
+
import { Calendar } from "../calendar/calendar";
|
|
8
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover/popover";
|
|
9
9
|
const defaultDateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
10
10
|
day: "numeric",
|
|
11
11
|
month: "long",
|
|
@@ -7,6 +7,13 @@ import {
|
|
|
7
7
|
useMemo
|
|
8
8
|
} from "react";
|
|
9
9
|
import { cn } from "../../lib/utils";
|
|
10
|
+
function assignRef(ref, node) {
|
|
11
|
+
if (typeof ref === "function") {
|
|
12
|
+
ref(node);
|
|
13
|
+
} else if (ref) {
|
|
14
|
+
ref.current = node;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
10
17
|
const ERA_PALETTE = {
|
|
11
18
|
amber: {
|
|
12
19
|
accent: "bg-amber-500",
|
|
@@ -163,30 +170,41 @@ const EraHighlight = forwardRef(
|
|
|
163
170
|
}
|
|
164
171
|
);
|
|
165
172
|
EraHighlight.displayName = "EraHighlight";
|
|
166
|
-
const EraFigure = forwardRef(
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
const EraFigure = forwardRef((props, ref) => {
|
|
174
|
+
const { anchorProps, className, href, name, ...rest } = props;
|
|
175
|
+
const color = useEraColumnColor();
|
|
176
|
+
const palette = ERA_PALETTE[color];
|
|
177
|
+
const baseClass = cn(
|
|
178
|
+
"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",
|
|
179
|
+
palette.chip,
|
|
180
|
+
className
|
|
181
|
+
);
|
|
182
|
+
if (href) {
|
|
183
|
+
return /* @__PURE__ */ jsx(
|
|
184
|
+
"a",
|
|
185
|
+
{
|
|
186
|
+
className: cn(baseClass, "underline-offset-4 hover:underline"),
|
|
187
|
+
href,
|
|
188
|
+
ref: (node) => {
|
|
189
|
+
assignRef(ref, node);
|
|
190
|
+
},
|
|
191
|
+
...anchorProps,
|
|
192
|
+
children: name
|
|
193
|
+
}
|
|
175
194
|
);
|
|
176
|
-
if (href) {
|
|
177
|
-
return /* @__PURE__ */ jsx(
|
|
178
|
-
"a",
|
|
179
|
-
{
|
|
180
|
-
className: cn(baseClass, "underline-offset-4 hover:underline"),
|
|
181
|
-
href,
|
|
182
|
-
...anchorProps,
|
|
183
|
-
children: name
|
|
184
|
-
}
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
return /* @__PURE__ */ jsx("span", { className: baseClass, ref, ...rest, children: name });
|
|
188
195
|
}
|
|
189
|
-
|
|
196
|
+
return /* @__PURE__ */ jsx(
|
|
197
|
+
"span",
|
|
198
|
+
{
|
|
199
|
+
className: baseClass,
|
|
200
|
+
ref: (node) => {
|
|
201
|
+
assignRef(ref, node);
|
|
202
|
+
},
|
|
203
|
+
...rest,
|
|
204
|
+
children: name
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
});
|
|
190
208
|
EraFigure.displayName = "EraFigure";
|
|
191
209
|
export {
|
|
192
210
|
EraColumn,
|
|
@@ -4,8 +4,14 @@ import { useState } from "react";
|
|
|
4
4
|
import { RefreshCcw } from "lucide-react";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
import { Badge } from "../badge/badge";
|
|
7
|
-
import { Button } from "../button";
|
|
8
|
-
import {
|
|
7
|
+
import { Button } from "../button/button";
|
|
8
|
+
import {
|
|
9
|
+
Card,
|
|
10
|
+
CardContent,
|
|
11
|
+
CardFooter,
|
|
12
|
+
CardHeader,
|
|
13
|
+
CardTitle
|
|
14
|
+
} from "../card/card";
|
|
9
15
|
function Flashcard({
|
|
10
16
|
answer,
|
|
11
17
|
category,
|
|
@@ -46,23 +46,24 @@ function RegionShape({
|
|
|
46
46
|
region,
|
|
47
47
|
showAnswerFlash
|
|
48
48
|
}) {
|
|
49
|
-
let
|
|
50
|
-
if (isSelected && feedback === "correct")
|
|
51
|
-
else if (isSelected && feedback === "incorrect")
|
|
49
|
+
let fillClass = "fill-muted";
|
|
50
|
+
if (isSelected && feedback === "correct") fillClass = "fill-emerald-500";
|
|
51
|
+
else if (isSelected && feedback === "incorrect")
|
|
52
|
+
fillClass = "fill-destructive";
|
|
52
53
|
else if (showAnswerFlash && isAnswerForCurrent && !isSelected)
|
|
53
|
-
|
|
54
|
+
fillClass = "fill-emerald-500/40";
|
|
54
55
|
return /* @__PURE__ */ jsx(
|
|
55
56
|
"path",
|
|
56
57
|
{
|
|
57
58
|
"aria-label": region.name,
|
|
58
59
|
className: cn(
|
|
60
|
+
fillClass,
|
|
59
61
|
"stroke-background outline-none transition-colors",
|
|
60
62
|
disabled ? "cursor-not-allowed" : "cursor-pointer hover:opacity-90 focus-visible:opacity-90"
|
|
61
63
|
),
|
|
62
64
|
d: regionPath(region),
|
|
63
65
|
"data-region-id": region.id,
|
|
64
66
|
"data-state": isSelected ? feedback === "correct" ? "correct" : "incorrect" : showAnswerFlash && isAnswerForCurrent ? "answer" : void 0,
|
|
65
|
-
fill,
|
|
66
67
|
onClick: () => {
|
|
67
68
|
if (!disabled) onSelect(region.id);
|
|
68
69
|
},
|
|
@@ -82,14 +82,14 @@ function Axis({ ticks }) {
|
|
|
82
82
|
{
|
|
83
83
|
"aria-hidden": "true",
|
|
84
84
|
className: "relative h-7 border-b border-border text-[10px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
85
|
-
children: ticks.map((tick) => /* @__PURE__ */ jsx(
|
|
85
|
+
children: ticks.map((tick, index) => /* @__PURE__ */ jsx(
|
|
86
86
|
"span",
|
|
87
87
|
{
|
|
88
88
|
className: "absolute top-1 -translate-x-1/2",
|
|
89
89
|
style: { left: `${tick.offset.toString()}%` },
|
|
90
90
|
children: tick.label
|
|
91
91
|
},
|
|
92
|
-
tick.label
|
|
92
|
+
`${tick.label}-${index.toString()}`
|
|
93
93
|
))
|
|
94
94
|
}
|
|
95
95
|
);
|
|
@@ -361,17 +361,28 @@ function ScrollArea({
|
|
|
361
361
|
endTime,
|
|
362
362
|
events,
|
|
363
363
|
onSelect,
|
|
364
|
+
scrollerId,
|
|
364
365
|
selectedId,
|
|
365
366
|
startTime,
|
|
366
367
|
tracks,
|
|
367
368
|
zoom
|
|
368
369
|
}) {
|
|
369
370
|
const ref = useRef(null);
|
|
371
|
+
const observerRef = useRef(null);
|
|
370
372
|
const [containerWidth, setContainerWidth] = useState(800);
|
|
371
373
|
const dragHandlers = useScrollDrag(ref);
|
|
372
374
|
const handleRef = useCallback((node) => {
|
|
373
375
|
ref.current = node;
|
|
374
|
-
|
|
376
|
+
observerRef.current?.disconnect();
|
|
377
|
+
observerRef.current = null;
|
|
378
|
+
if (!node) return;
|
|
379
|
+
setContainerWidth(node.clientWidth);
|
|
380
|
+
if (typeof ResizeObserver === "undefined") return;
|
|
381
|
+
const observer = new ResizeObserver(() => {
|
|
382
|
+
setContainerWidth(node.clientWidth);
|
|
383
|
+
});
|
|
384
|
+
observer.observe(node);
|
|
385
|
+
observerRef.current = observer;
|
|
375
386
|
}, []);
|
|
376
387
|
const innerWidth = `${(zoom * 100).toString()}%`;
|
|
377
388
|
const ticks = useMemo(
|
|
@@ -382,6 +393,7 @@ function ScrollArea({
|
|
|
382
393
|
"div",
|
|
383
394
|
{
|
|
384
395
|
className: "relative w-full cursor-grab overflow-x-auto active:cursor-grabbing",
|
|
396
|
+
"data-scroller-id": scrollerId,
|
|
385
397
|
"data-zoom": zoom,
|
|
386
398
|
ref: handleRef,
|
|
387
399
|
...dragHandlers,
|
|
@@ -683,13 +695,14 @@ const InteractiveTimeline = forwardRef((props, ref) => {
|
|
|
683
695
|
...rest,
|
|
684
696
|
children: [
|
|
685
697
|
children,
|
|
686
|
-
/* @__PURE__ */ jsx("div", {
|
|
698
|
+
/* @__PURE__ */ jsx("div", { id: scrollerId, children: /* @__PURE__ */ jsx(
|
|
687
699
|
ScrollArea,
|
|
688
700
|
{
|
|
689
701
|
categories,
|
|
690
702
|
endTime,
|
|
691
703
|
events: filteredEvents,
|
|
692
704
|
onSelect: handleSelect,
|
|
705
|
+
scrollerId,
|
|
693
706
|
selectedId,
|
|
694
707
|
startTime,
|
|
695
708
|
tracks,
|
|
@@ -89,16 +89,24 @@ const Kbd = forwardRef(
|
|
|
89
89
|
if (shortcut) {
|
|
90
90
|
const tokens = shortcut.split(SHORTCUT_SEPARATOR).filter(Boolean);
|
|
91
91
|
const ariaLabel = tokens.map((token) => formatToken(token, isMac)).join(" + ");
|
|
92
|
-
return /* @__PURE__ */ jsx(
|
|
93
|
-
"
|
|
92
|
+
return /* @__PURE__ */ jsx(
|
|
93
|
+
"span",
|
|
94
94
|
{
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
children:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
95
|
+
"aria-label": ariaLabel,
|
|
96
|
+
className: "inline-flex items-center gap-1",
|
|
97
|
+
role: "img",
|
|
98
|
+
children: tokens.map((token, index) => /* @__PURE__ */ jsx(
|
|
99
|
+
"kbd",
|
|
100
|
+
{
|
|
101
|
+
className: cn(kbdVariants({ size }), className),
|
|
102
|
+
ref: index === 0 ? ref : void 0,
|
|
103
|
+
...index === 0 ? rest : {},
|
|
104
|
+
children: formatToken(token, isMac)
|
|
105
|
+
},
|
|
106
|
+
`${token}-${index.toString()}`
|
|
107
|
+
))
|
|
108
|
+
}
|
|
109
|
+
);
|
|
102
110
|
}
|
|
103
111
|
return /* @__PURE__ */ jsx(
|
|
104
112
|
"kbd",
|
|
@@ -166,6 +166,7 @@ function MultipleChoiceOption({
|
|
|
166
166
|
}
|
|
167
167
|
function MultipleChoiceField({
|
|
168
168
|
groupName,
|
|
169
|
+
labelId,
|
|
169
170
|
onChange,
|
|
170
171
|
options,
|
|
171
172
|
value
|
|
@@ -176,20 +177,28 @@ function MultipleChoiceField({
|
|
|
176
177
|
},
|
|
177
178
|
[onChange]
|
|
178
179
|
);
|
|
179
|
-
return /* @__PURE__ */ jsx(
|
|
180
|
-
|
|
180
|
+
return /* @__PURE__ */ jsx(
|
|
181
|
+
"div",
|
|
181
182
|
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
183
|
+
"aria-labelledby": labelId,
|
|
184
|
+
className: "flex flex-col gap-1.5",
|
|
185
|
+
role: "radiogroup",
|
|
186
|
+
children: options.map((option) => /* @__PURE__ */ jsx(
|
|
187
|
+
MultipleChoiceOption,
|
|
188
|
+
{
|
|
189
|
+
groupName,
|
|
190
|
+
onChange: handleSelect,
|
|
191
|
+
option,
|
|
192
|
+
value
|
|
193
|
+
},
|
|
194
|
+
option.value
|
|
195
|
+
))
|
|
196
|
+
}
|
|
197
|
+
);
|
|
189
198
|
}
|
|
190
199
|
function TrueFalseField({
|
|
191
200
|
falseLabel,
|
|
192
|
-
|
|
201
|
+
labelId,
|
|
193
202
|
onChange,
|
|
194
203
|
trueLabel,
|
|
195
204
|
value
|
|
@@ -203,9 +212,9 @@ function TrueFalseField({
|
|
|
203
212
|
return /* @__PURE__ */ jsxs(
|
|
204
213
|
"div",
|
|
205
214
|
{
|
|
206
|
-
"aria-
|
|
215
|
+
"aria-labelledby": labelId,
|
|
207
216
|
className: "flex flex-wrap gap-2",
|
|
208
|
-
role: "
|
|
217
|
+
role: "group",
|
|
209
218
|
children: [
|
|
210
219
|
/* @__PURE__ */ jsx(
|
|
211
220
|
Button,
|
|
@@ -235,6 +244,7 @@ function TrueFalseField({
|
|
|
235
244
|
}
|
|
236
245
|
function FillBlankField({
|
|
237
246
|
inputId,
|
|
247
|
+
labelId,
|
|
238
248
|
onChange,
|
|
239
249
|
value
|
|
240
250
|
}) {
|
|
@@ -244,7 +254,15 @@ function FillBlankField({
|
|
|
244
254
|
},
|
|
245
255
|
[onChange]
|
|
246
256
|
);
|
|
247
|
-
return /* @__PURE__ */ jsx(
|
|
257
|
+
return /* @__PURE__ */ jsx(
|
|
258
|
+
Input,
|
|
259
|
+
{
|
|
260
|
+
"aria-labelledby": labelId,
|
|
261
|
+
id: inputId,
|
|
262
|
+
onChange: handleBlankValueChange,
|
|
263
|
+
value
|
|
264
|
+
}
|
|
265
|
+
);
|
|
248
266
|
}
|
|
249
267
|
function QuestionField({
|
|
250
268
|
groupName,
|
|
@@ -252,6 +270,7 @@ function QuestionField({
|
|
|
252
270
|
labels,
|
|
253
271
|
onResponse,
|
|
254
272
|
question,
|
|
273
|
+
questionTextId,
|
|
255
274
|
response
|
|
256
275
|
}) {
|
|
257
276
|
switch (question.type) {
|
|
@@ -260,6 +279,7 @@ function QuestionField({
|
|
|
260
279
|
FillBlankField,
|
|
261
280
|
{
|
|
262
281
|
inputId,
|
|
282
|
+
labelId: questionTextId,
|
|
263
283
|
onChange: onResponse,
|
|
264
284
|
value: typeof response === "string" ? response : ""
|
|
265
285
|
}
|
|
@@ -269,6 +289,7 @@ function QuestionField({
|
|
|
269
289
|
MultipleChoiceField,
|
|
270
290
|
{
|
|
271
291
|
groupName,
|
|
292
|
+
labelId: questionTextId,
|
|
272
293
|
onChange: onResponse,
|
|
273
294
|
options: question.options,
|
|
274
295
|
value: typeof response === "string" ? response : void 0
|
|
@@ -279,7 +300,7 @@ function QuestionField({
|
|
|
279
300
|
TrueFalseField,
|
|
280
301
|
{
|
|
281
302
|
falseLabel: labels.falseOption,
|
|
282
|
-
|
|
303
|
+
labelId: questionTextId,
|
|
283
304
|
onChange: onResponse,
|
|
284
305
|
trueLabel: labels.trueOption,
|
|
285
306
|
value: typeof response === "boolean" ? response : void 0
|
|
@@ -312,7 +333,8 @@ function QuestionPane({
|
|
|
312
333
|
groupName,
|
|
313
334
|
inputId,
|
|
314
335
|
labels,
|
|
315
|
-
questions
|
|
336
|
+
questions,
|
|
337
|
+
questionTextId
|
|
316
338
|
}) {
|
|
317
339
|
const question = controller.current;
|
|
318
340
|
const response = controller.responses[question.id];
|
|
@@ -325,7 +347,7 @@ function QuestionPane({
|
|
|
325
347
|
);
|
|
326
348
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
327
349
|
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: `${(controller.index + 1).toString()} ${labels.outOf} ${questions.length.toString()}` }),
|
|
328
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", children: question.question }),
|
|
350
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-foreground", id: questionTextId, children: question.question }),
|
|
329
351
|
/* @__PURE__ */ jsx(
|
|
330
352
|
QuestionField,
|
|
331
353
|
{
|
|
@@ -334,6 +356,7 @@ function QuestionPane({
|
|
|
334
356
|
labels,
|
|
335
357
|
onResponse: handleResponse,
|
|
336
358
|
question,
|
|
359
|
+
questionTextId,
|
|
337
360
|
response
|
|
338
361
|
}
|
|
339
362
|
),
|
|
@@ -404,6 +427,7 @@ const KnowledgeCheck = forwardRef(
|
|
|
404
427
|
);
|
|
405
428
|
const groupName = useId();
|
|
406
429
|
const inputId = useId();
|
|
430
|
+
const questionTextId = useId();
|
|
407
431
|
const controller = useKnowledgeCheckController({
|
|
408
432
|
onAnswer,
|
|
409
433
|
onComplete,
|
|
@@ -434,7 +458,8 @@ const KnowledgeCheck = forwardRef(
|
|
|
434
458
|
groupName,
|
|
435
459
|
inputId,
|
|
436
460
|
labels: resolvedLabels,
|
|
437
|
-
questions
|
|
461
|
+
questions,
|
|
462
|
+
questionTextId
|
|
438
463
|
}
|
|
439
464
|
)
|
|
440
465
|
]
|
|
@@ -169,7 +169,7 @@ const MapTimelineEvent = forwardRef(
|
|
|
169
169
|
className: cn("stroke-background", palette.dot),
|
|
170
170
|
r: "6",
|
|
171
171
|
strokeWidth: "2",
|
|
172
|
-
children: title ? /* @__PURE__ */ jsx("title", { children:
|
|
172
|
+
children: title ? /* @__PURE__ */ jsx("title", { children: title }) : null
|
|
173
173
|
}
|
|
174
174
|
),
|
|
175
175
|
title ? /* @__PURE__ */ jsx(
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
CardDescription,
|
|
9
9
|
CardHeader,
|
|
10
10
|
CardTitle
|
|
11
|
-
} from "../card";
|
|
11
|
+
} from "../card/card";
|
|
12
12
|
const DEFAULT_THRESHOLDS = [
|
|
13
13
|
{ colorClassName: "text-emerald-500", label: "Nominal", value: 60 },
|
|
14
14
|
{ colorClassName: "text-amber-500", label: "Elevated", value: 85 },
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
useContext,
|
|
8
8
|
useId,
|
|
9
9
|
useMemo,
|
|
10
|
+
useRef,
|
|
10
11
|
useState
|
|
11
12
|
} from "react";
|
|
12
13
|
import { Eye, EyeOff } from "lucide-react";
|
|
@@ -14,6 +15,11 @@ import { cn } from "../../lib/utils";
|
|
|
14
15
|
import { Badge } from "../badge/badge";
|
|
15
16
|
import { Button } from "../button/button";
|
|
16
17
|
const HIDDEN_LABEL_PREFIX = "Model";
|
|
18
|
+
const ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
19
|
+
function blindLabelForIndex(index) {
|
|
20
|
+
const suffix = index < ALPHABET.length ? ALPHABET[index] : (index + 1).toString();
|
|
21
|
+
return `${HIDDEN_LABEL_PREFIX} ${suffix}`;
|
|
22
|
+
}
|
|
17
23
|
const DEFAULT_LABELS = {
|
|
18
24
|
cost: "Cost",
|
|
19
25
|
hide: "Hide models",
|
|
@@ -26,7 +32,8 @@ const DEFAULT_LABELS = {
|
|
|
26
32
|
};
|
|
27
33
|
const DEFAULT_CONTEXT = {
|
|
28
34
|
blind: false,
|
|
29
|
-
labels: DEFAULT_LABELS
|
|
35
|
+
labels: DEFAULT_LABELS,
|
|
36
|
+
registerColumn: () => 0
|
|
30
37
|
};
|
|
31
38
|
const ModelComparisonContext = createContext(DEFAULT_CONTEXT);
|
|
32
39
|
function ComparisonHeader({
|
|
@@ -77,9 +84,17 @@ const ModelComparison = forwardRef(
|
|
|
77
84
|
[labels]
|
|
78
85
|
);
|
|
79
86
|
const [blind, setBlind] = useState(blindDefault);
|
|
87
|
+
const columnIndexRef = useRef(/* @__PURE__ */ new Map());
|
|
88
|
+
const registerColumn = useCallback((id) => {
|
|
89
|
+
const existing = columnIndexRef.current.get(id);
|
|
90
|
+
if (existing !== void 0) return existing;
|
|
91
|
+
const next = columnIndexRef.current.size;
|
|
92
|
+
columnIndexRef.current.set(id, next);
|
|
93
|
+
return next;
|
|
94
|
+
}, []);
|
|
80
95
|
const contextValue = useMemo(
|
|
81
|
-
() => ({ blind, labels: resolvedLabels }),
|
|
82
|
-
[blind, resolvedLabels]
|
|
96
|
+
() => ({ blind, labels: resolvedLabels, registerColumn }),
|
|
97
|
+
[blind, registerColumn, resolvedLabels]
|
|
83
98
|
);
|
|
84
99
|
const handleToggleBlind = useCallback(() => {
|
|
85
100
|
setBlind((value) => !value);
|
|
@@ -114,8 +129,9 @@ ModelComparison.displayName = "ModelComparison";
|
|
|
114
129
|
const ModelComparisonColumn = forwardRef((props, ref) => {
|
|
115
130
|
const { badge, children, className, label, model, ...rest } = props;
|
|
116
131
|
const id = useId();
|
|
117
|
-
const { blind } = useContext(ModelComparisonContext);
|
|
118
|
-
const
|
|
132
|
+
const { blind, registerColumn } = useContext(ModelComparisonContext);
|
|
133
|
+
const columnIndex = registerColumn(id);
|
|
134
|
+
const displayLabel = blind ? blindLabelForIndex(columnIndex) : label ?? model;
|
|
119
135
|
return /* @__PURE__ */ jsxs(
|
|
120
136
|
"article",
|
|
121
137
|
{
|
|
@@ -188,7 +204,10 @@ const ModelComparisonVote = forwardRef((props, ref) => {
|
|
|
188
204
|
return /* @__PURE__ */ jsxs(
|
|
189
205
|
"div",
|
|
190
206
|
{
|
|
191
|
-
className: cn(
|
|
207
|
+
className: cn(
|
|
208
|
+
"col-span-full flex flex-col items-center gap-2",
|
|
209
|
+
className
|
|
210
|
+
),
|
|
192
211
|
ref,
|
|
193
212
|
...rest,
|
|
194
213
|
children: [
|
|
@@ -4,21 +4,21 @@ import { useMemo, useRef, useState } from "react";
|
|
|
4
4
|
import { ArrowUpDown, Filter } from "lucide-react";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
import { Badge } from "../badge/badge";
|
|
7
|
-
import { Button } from "../button";
|
|
7
|
+
import { Button } from "../button/button";
|
|
8
8
|
import {
|
|
9
9
|
Command,
|
|
10
10
|
CommandEmpty,
|
|
11
11
|
CommandGroup,
|
|
12
12
|
CommandItem,
|
|
13
13
|
CommandList
|
|
14
|
-
} from "../command";
|
|
14
|
+
} from "../command/command";
|
|
15
15
|
import {
|
|
16
16
|
Dialog,
|
|
17
17
|
DialogContent,
|
|
18
18
|
DialogDescription,
|
|
19
19
|
DialogHeader,
|
|
20
20
|
DialogTitle
|
|
21
|
-
} from "../dialog";
|
|
21
|
+
} from "../dialog/dialog";
|
|
22
22
|
import {
|
|
23
23
|
DropdownMenu,
|
|
24
24
|
DropdownMenuContent,
|
|
@@ -27,8 +27,8 @@ import {
|
|
|
27
27
|
DropdownMenuRadioItem,
|
|
28
28
|
DropdownMenuSeparator,
|
|
29
29
|
DropdownMenuTrigger
|
|
30
|
-
} from "../dropdown-menu";
|
|
31
|
-
import { Input } from "../input";
|
|
30
|
+
} from "../dropdown-menu/dropdown-menu";
|
|
31
|
+
import { Input } from "../input/input";
|
|
32
32
|
function getProvider(modelId) {
|
|
33
33
|
const parts = modelId.split("/");
|
|
34
34
|
return parts[0] || "unknown";
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Check, ChevronDown } from "lucide-react";
|
|
5
5
|
import { cn } from "../../lib/utils";
|
|
6
6
|
import { Badge } from "../badge/badge";
|
|
7
|
-
import { Button } from "../button";
|
|
7
|
+
import { Button } from "../button/button";
|
|
8
8
|
import {
|
|
9
9
|
Command,
|
|
10
10
|
CommandEmpty,
|
|
@@ -12,8 +12,8 @@ import {
|
|
|
12
12
|
CommandInput,
|
|
13
13
|
CommandItem,
|
|
14
14
|
CommandList
|
|
15
|
-
} from "../command";
|
|
16
|
-
import { Popover, PopoverContent, PopoverTrigger } from "../popover";
|
|
15
|
+
} from "../command/command";
|
|
16
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../popover/popover";
|
|
17
17
|
function getUniqueValues(values) {
|
|
18
18
|
return values.filter((value, index) => values.indexOf(value) === index);
|
|
19
19
|
}
|
|
@@ -5,8 +5,8 @@ import Link from "next/link";
|
|
|
5
5
|
import { usePathname } from "next/navigation";
|
|
6
6
|
import { cn } from "../../lib/utils";
|
|
7
7
|
import { Button } from "../button/button";
|
|
8
|
-
import { useSidebar } from "../sidebar-provider";
|
|
9
|
-
import { ThemeToggle } from "../theme-toggle";
|
|
8
|
+
import { useSidebar } from "../sidebar-provider/sidebar-provider";
|
|
9
|
+
import { ThemeToggle } from "../theme-toggle/theme-toggle";
|
|
10
10
|
const EMPTY_NAV_ITEMS = [];
|
|
11
11
|
function NavbarSaas({
|
|
12
12
|
brand,
|
|
@@ -250,10 +250,10 @@ function FormBody({
|
|
|
250
250
|
/* @__PURE__ */ jsx(
|
|
251
251
|
"p",
|
|
252
252
|
{
|
|
253
|
-
"aria-live": "
|
|
253
|
+
"aria-live": "assertive",
|
|
254
254
|
className: cn("text-xs", message ? "text-destructive" : "sr-only"),
|
|
255
255
|
id: errorId,
|
|
256
|
-
role:
|
|
256
|
+
role: "alert",
|
|
257
257
|
children: message ?? ""
|
|
258
258
|
}
|
|
259
259
|
)
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { cn } from "../../lib/utils";
|
|
4
4
|
import { Badge } from "../badge/badge";
|
|
5
|
-
import { Button } from "../button";
|
|
5
|
+
import { Button } from "../button/button";
|
|
6
6
|
const stateClasses = {
|
|
7
7
|
blocked: "border-amber-500/30 bg-amber-500/10 text-amber-700 dark:text-amber-300",
|
|
8
8
|
complete: "border-emerald-500/30 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
|
@@ -77,14 +77,14 @@ function Axis({ ticks }) {
|
|
|
77
77
|
{
|
|
78
78
|
"aria-hidden": "true",
|
|
79
79
|
className: "relative h-7 border-b border-border text-[10px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
80
|
-
children: ticks.map((tick) => /* @__PURE__ */ jsx(
|
|
80
|
+
children: ticks.map((tick, index) => /* @__PURE__ */ jsx(
|
|
81
81
|
"span",
|
|
82
82
|
{
|
|
83
83
|
className: "absolute top-1 -translate-x-1/2",
|
|
84
84
|
style: { left: `${tick.offset.toString()}%` },
|
|
85
85
|
children: tick.label
|
|
86
86
|
},
|
|
87
|
-
tick.label
|
|
87
|
+
`${tick.label}-${index.toString()}`
|
|
88
88
|
))
|
|
89
89
|
}
|
|
90
90
|
);
|