orbital-ds 0.40.0 → 0.41.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/AGENTS.md +1 -1
- package/components.manifest.json +221 -1
- package/dist/hooks/use-ds-messages.d.ts +82 -0
- package/dist/lib/a2ui-catalog.d.ts +42 -0
- package/dist/lib/a2ui-catalog.js +558 -0
- package/dist/lib/a2ui.d.ts +289 -0
- package/dist/lib/a2ui.js +215 -0
- package/dist/lib/ai-events.d.ts +15 -0
- package/dist/lib/ai-events.js +202 -0
- package/dist/lib/auth-flow.d.ts +3 -1
- package/dist/lib/auth-flow.js +24 -3
- package/dist/lib/i18n.d.ts +82 -0
- package/dist/lib/i18n.js +246 -0
- package/dist/styles.css +23 -1
- package/dist/ui/a2ui-renderer.d.ts +33 -0
- package/dist/ui/a2ui-renderer.js +793 -0
- package/dist/ui/agent-events.d.ts +32 -0
- package/dist/ui/agent-events.js +108 -0
- package/dist/ui/alert.d.ts +1 -1
- package/dist/ui/attachment.d.ts +2 -2
- package/dist/ui/auth-form.d.ts +3 -1
- package/dist/ui/auth-form.js +34 -6
- package/dist/ui/badge.d.ts +1 -1
- package/dist/ui/banner.d.ts +1 -1
- package/dist/ui/bubble.d.ts +1 -1
- package/dist/ui/button-group.d.ts +1 -1
- package/dist/ui/button.d.ts +2 -2
- package/dist/ui/chain-of-thought.d.ts +19 -0
- package/dist/ui/chain-of-thought.js +90 -0
- package/dist/ui/chat-composer.d.ts +39 -0
- package/dist/ui/chat-composer.js +192 -0
- package/dist/ui/conversation-list.d.ts +24 -0
- package/dist/ui/conversation-list.js +141 -0
- package/dist/ui/empty.d.ts +1 -1
- package/dist/ui/field.d.ts +1 -1
- package/dist/ui/generated-image.d.ts +14 -0
- package/dist/ui/generated-image.js +65 -0
- package/dist/ui/generated-table.d.ts +11 -0
- package/dist/ui/generated-table.js +59 -0
- package/dist/ui/icon-tile.d.ts +2 -2
- package/dist/ui/item.d.ts +2 -2
- package/dist/ui/markdown.d.ts +14 -0
- package/dist/ui/markdown.js +123 -0
- package/dist/ui/marker.d.ts +1 -1
- package/dist/ui/message-actions.d.ts +12 -0
- package/dist/ui/message-actions.js +79 -0
- package/dist/ui/panel.d.ts +1 -1
- package/dist/ui/reasoning.d.ts +10 -0
- package/dist/ui/reasoning.js +62 -0
- package/dist/ui/sidebar.d.ts +1 -1
- package/dist/ui/sparkline.d.ts +1 -1
- package/dist/ui/stat.d.ts +1 -1
- package/dist/ui/status-badge.d.ts +3 -3
- package/dist/ui/suggestions.d.ts +8 -0
- package/dist/ui/suggestions.js +39 -0
- package/dist/ui/tabs.d.ts +1 -1
- package/dist/ui/toggle.d.ts +1 -1
- package/dist/ui/tool-call.d.ts +15 -0
- package/dist/ui/tool-call.js +74 -0
- package/dist/ui/workflow-run.d.ts +23 -0
- package/dist/ui/workflow-run.js +185 -0
- package/docs/designer/criterio.md +87 -87
- package/docs/designer/patrones.md +3 -1
- package/package.json +238 -228
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import {
|
|
5
|
+
AlertCircleIcon,
|
|
6
|
+
ArrowUpIcon,
|
|
7
|
+
CheckIcon,
|
|
8
|
+
FileIcon,
|
|
9
|
+
ImageIcon,
|
|
10
|
+
MicIcon,
|
|
11
|
+
PaperclipIcon,
|
|
12
|
+
SquareIcon,
|
|
13
|
+
XIcon
|
|
14
|
+
} from "lucide-react";
|
|
15
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
16
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
17
|
+
import { cn } from "../lib/utils.js";
|
|
18
|
+
import { InputGroup, InputGroupAddon, InputGroupButton, InputGroupTextarea } from "./input-group.js";
|
|
19
|
+
import { Spinner } from "./spinner.js";
|
|
20
|
+
const clock = (s) => `${Math.floor(s / 60)}:${String(Math.floor(s % 60)).padStart(2, "0")}`;
|
|
21
|
+
function ChatComposer({
|
|
22
|
+
value,
|
|
23
|
+
defaultValue = "",
|
|
24
|
+
onValueChange,
|
|
25
|
+
onSend,
|
|
26
|
+
onStop,
|
|
27
|
+
onAttach,
|
|
28
|
+
onFilesDrop,
|
|
29
|
+
attachments,
|
|
30
|
+
onRemoveAttachment,
|
|
31
|
+
voice,
|
|
32
|
+
maxLength,
|
|
33
|
+
streaming = false,
|
|
34
|
+
disabled,
|
|
35
|
+
placeholder,
|
|
36
|
+
className,
|
|
37
|
+
...props
|
|
38
|
+
}) {
|
|
39
|
+
const t = useDsMessages();
|
|
40
|
+
const [inner, setInner] = React.useState(defaultValue);
|
|
41
|
+
const [dragging, setDragging] = React.useState(false);
|
|
42
|
+
const text = value ?? inner;
|
|
43
|
+
const set = (v) => {
|
|
44
|
+
if (value === void 0) setInner(v);
|
|
45
|
+
onValueChange?.(v);
|
|
46
|
+
};
|
|
47
|
+
const busyFiles = attachments?.some((a) => a.status === "uploading") ?? false;
|
|
48
|
+
const recording = voice?.state === "recording";
|
|
49
|
+
const canSend = !disabled && !streaming && !busyFiles && (text.trim().length > 0 || (attachments?.length ?? 0) > 0);
|
|
50
|
+
const send = () => {
|
|
51
|
+
if (!canSend) return;
|
|
52
|
+
onSend?.(text.trim());
|
|
53
|
+
set("");
|
|
54
|
+
};
|
|
55
|
+
const nearLimit = maxLength !== void 0 && text.length >= maxLength * 0.8;
|
|
56
|
+
const status = voice?.state === "transcribing" ? t.voiceTranscribing : voice?.state === "error" ? t.voiceError : busyFiles ? t.composerUploading : "";
|
|
57
|
+
return /* @__PURE__ */ jsxs(
|
|
58
|
+
"div",
|
|
59
|
+
{
|
|
60
|
+
"data-slot": "chat-composer",
|
|
61
|
+
"data-streaming": streaming || void 0,
|
|
62
|
+
"data-voice": voice?.state && voice.state !== "idle" ? voice.state : void 0,
|
|
63
|
+
"data-dragging": dragging || void 0,
|
|
64
|
+
className: cn("relative w-full", className),
|
|
65
|
+
onDragOver: onFilesDrop ? (e) => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
setDragging(true);
|
|
68
|
+
} : void 0,
|
|
69
|
+
onDragLeave: onFilesDrop ? () => setDragging(false) : void 0,
|
|
70
|
+
onDrop: onFilesDrop ? (e) => {
|
|
71
|
+
e.preventDefault();
|
|
72
|
+
setDragging(false);
|
|
73
|
+
const files = Array.from(e.dataTransfer.files);
|
|
74
|
+
if (files.length) onFilesDrop(files);
|
|
75
|
+
} : void 0,
|
|
76
|
+
...props,
|
|
77
|
+
children: [
|
|
78
|
+
attachments?.length ? /* @__PURE__ */ jsx("ul", { className: "mb-2 flex flex-wrap gap-2", children: attachments.map((a) => {
|
|
79
|
+
const st = a.status ?? "ready";
|
|
80
|
+
return /* @__PURE__ */ jsxs(
|
|
81
|
+
"li",
|
|
82
|
+
{
|
|
83
|
+
"data-slot": "chat-composer-attachment",
|
|
84
|
+
"data-status": st,
|
|
85
|
+
className: cn(
|
|
86
|
+
"flex max-w-full items-center gap-2 rounded-control border border-border bg-card py-1 ps-2 pe-1 text-sm",
|
|
87
|
+
st === "error" && "border-danger text-danger"
|
|
88
|
+
),
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "shrink-0 text-muted-foreground [&_svg]:size-4", children: st === "uploading" ? /* @__PURE__ */ jsx(Spinner, { "aria-hidden": true, role: "presentation", className: "size-3.5" }) : st === "error" ? /* @__PURE__ */ jsx(AlertCircleIcon, { className: "text-danger" }) : a.type?.startsWith("image/") ? /* @__PURE__ */ jsx(ImageIcon, {}) : /* @__PURE__ */ jsx(FileIcon, {}) }),
|
|
91
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: a.name }),
|
|
92
|
+
st === "error" ? /* @__PURE__ */ jsx("span", { className: "sr-only", children: t.composerFileError }) : null,
|
|
93
|
+
onRemoveAttachment ? /* @__PURE__ */ jsx(
|
|
94
|
+
InputGroupButton,
|
|
95
|
+
{
|
|
96
|
+
size: "icon-xs",
|
|
97
|
+
"aria-label": dsFormat(t.composerRemoveFile, { name: a.name }),
|
|
98
|
+
onClick: () => onRemoveAttachment(a.id),
|
|
99
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
100
|
+
}
|
|
101
|
+
) : null
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
a.id
|
|
105
|
+
);
|
|
106
|
+
}) }) : null,
|
|
107
|
+
/* @__PURE__ */ jsxs(InputGroup, { className: cn(dragging && "border-primary ring-(length:--ds-ring-width) ring-(--ds-ring-color)"), children: [
|
|
108
|
+
recording ? /* @__PURE__ */ jsxs("div", { className: "flex min-h-(--ds-control-h-md) w-full items-center gap-3 px-3 text-sm", "data-slot": "chat-composer-voice", children: [
|
|
109
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": true, className: "size-2 shrink-0 animate-ds-ring-inner rounded-full bg-danger motion-reduce:animate-none" }),
|
|
110
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t.voiceRecording }),
|
|
111
|
+
/* @__PURE__ */ jsx("span", { className: "tabular-nums", children: clock(voice?.seconds ?? 0) })
|
|
112
|
+
] }) : /* @__PURE__ */ jsx(
|
|
113
|
+
InputGroupTextarea,
|
|
114
|
+
{
|
|
115
|
+
rows: 1,
|
|
116
|
+
value: text,
|
|
117
|
+
disabled,
|
|
118
|
+
maxLength,
|
|
119
|
+
placeholder: placeholder ?? t.composerPlaceholder,
|
|
120
|
+
"aria-label": placeholder ?? t.composerPlaceholder,
|
|
121
|
+
className: "max-h-40 min-h-(--ds-control-h-md) [field-sizing:content]",
|
|
122
|
+
onChange: (e) => set(e.target.value),
|
|
123
|
+
onKeyDown: (e) => {
|
|
124
|
+
if (e.key === "Enter" && !e.shiftKey && !e.nativeEvent.isComposing) {
|
|
125
|
+
e.preventDefault();
|
|
126
|
+
send();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
),
|
|
131
|
+
/* @__PURE__ */ jsx(InputGroupAddon, { align: "block-end", children: recording ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
132
|
+
/* @__PURE__ */ jsx(InputGroupButton, { size: "icon-sm", "aria-label": t.voiceCancel, onClick: voice?.onCancel, children: /* @__PURE__ */ jsx(XIcon, {}) }),
|
|
133
|
+
/* @__PURE__ */ jsx(InputGroupButton, { size: "icon-sm", variant: "default", className: "ms-auto", "aria-label": t.voiceConfirm, onClick: voice?.onConfirm, children: /* @__PURE__ */ jsx(CheckIcon, {}) })
|
|
134
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
135
|
+
onAttach ? /* @__PURE__ */ jsx(InputGroupButton, { size: "icon-sm", "aria-label": t.composerAttach, disabled, onClick: onAttach, children: /* @__PURE__ */ jsx(PaperclipIcon, {}) }) : null,
|
|
136
|
+
voice ? /* @__PURE__ */ jsx(
|
|
137
|
+
InputGroupButton,
|
|
138
|
+
{
|
|
139
|
+
size: "icon-sm",
|
|
140
|
+
"aria-label": voice.state === "error" ? t.voiceRetry : t.composerVoice,
|
|
141
|
+
disabled: disabled || voice.state === "transcribing",
|
|
142
|
+
onClick: voice.onStart,
|
|
143
|
+
children: voice.state === "transcribing" ? /* @__PURE__ */ jsx(Spinner, { "aria-hidden": true, role: "presentation" }) : /* @__PURE__ */ jsx(MicIcon, {})
|
|
144
|
+
}
|
|
145
|
+
) : null,
|
|
146
|
+
maxLength !== void 0 && nearLimit ? /* @__PURE__ */ jsx(
|
|
147
|
+
"span",
|
|
148
|
+
{
|
|
149
|
+
className: cn("ms-auto text-xs tabular-nums", text.length >= maxLength ? "text-danger" : "text-muted-foreground"),
|
|
150
|
+
children: dsFormat(t.composerCounter, { count: text.length, max: maxLength })
|
|
151
|
+
}
|
|
152
|
+
) : null,
|
|
153
|
+
streaming ? /* @__PURE__ */ jsx(
|
|
154
|
+
InputGroupButton,
|
|
155
|
+
{
|
|
156
|
+
size: "icon-sm",
|
|
157
|
+
variant: "default",
|
|
158
|
+
className: nearLimit ? void 0 : "ms-auto",
|
|
159
|
+
"aria-label": t.composerStop,
|
|
160
|
+
onClick: onStop,
|
|
161
|
+
children: /* @__PURE__ */ jsx(SquareIcon, {})
|
|
162
|
+
}
|
|
163
|
+
) : /* @__PURE__ */ jsx(
|
|
164
|
+
InputGroupButton,
|
|
165
|
+
{
|
|
166
|
+
size: "icon-sm",
|
|
167
|
+
variant: "default",
|
|
168
|
+
className: nearLimit ? void 0 : "ms-auto",
|
|
169
|
+
"aria-label": t.composerSend,
|
|
170
|
+
disabled: !canSend,
|
|
171
|
+
onClick: send,
|
|
172
|
+
children: /* @__PURE__ */ jsx(ArrowUpIcon, {})
|
|
173
|
+
}
|
|
174
|
+
)
|
|
175
|
+
] }) })
|
|
176
|
+
] }),
|
|
177
|
+
dragging ? /* @__PURE__ */ jsx(
|
|
178
|
+
"div",
|
|
179
|
+
{
|
|
180
|
+
"aria-hidden": true,
|
|
181
|
+
className: "pointer-events-none absolute inset-0 flex items-center justify-center rounded-control bg-background/80 text-sm font-(--ds-medium-weight)",
|
|
182
|
+
children: t.composerDrop
|
|
183
|
+
}
|
|
184
|
+
) : null,
|
|
185
|
+
/* @__PURE__ */ jsx("p", { role: "status", "aria-live": "polite", className: cn(status ? "mt-1 text-xs text-muted-foreground" : "sr-only"), children: status })
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
export {
|
|
191
|
+
ChatComposer
|
|
192
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface Conversation {
|
|
4
|
+
id: string;
|
|
5
|
+
title: string;
|
|
6
|
+
/** Última actividad; agrupa la lista (hoy, ayer, 7 días, anteriores). */
|
|
7
|
+
updatedAt: Date | string | number;
|
|
8
|
+
pinned?: boolean;
|
|
9
|
+
/** Tarea en curso (el agente está respondiendo): se marca con un punto que late. */
|
|
10
|
+
busy?: boolean;
|
|
11
|
+
}
|
|
12
|
+
declare function ConversationList({ items, activeId, onSelect, onNew, onRename, onDelete, onPin, now, searchable, className, ...props }: Omit<React.ComponentProps<"div">, "children" | "onSelect"> & {
|
|
13
|
+
items: Conversation[];
|
|
14
|
+
activeId?: string;
|
|
15
|
+
onSelect?: (id: string) => void;
|
|
16
|
+
onNew?: () => void;
|
|
17
|
+
onRename?: (id: string) => void;
|
|
18
|
+
onDelete?: (id: string) => void;
|
|
19
|
+
onPin?: (id: string, pinned: boolean) => void;
|
|
20
|
+
now?: Date;
|
|
21
|
+
searchable?: boolean;
|
|
22
|
+
}): React.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { type Conversation, ConversationList };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { MoreHorizontalIcon, PinIcon, PlusIcon, SearchIcon } from "lucide-react";
|
|
5
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
6
|
+
import { dsFormat } from "../lib/i18n.js";
|
|
7
|
+
import { cn } from "../lib/utils.js";
|
|
8
|
+
import { Button } from "./button.js";
|
|
9
|
+
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "./dropdown-menu.js";
|
|
10
|
+
import { Input } from "./input.js";
|
|
11
|
+
const day = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
12
|
+
function bucket(c, now) {
|
|
13
|
+
if (c.pinned) return "pinned";
|
|
14
|
+
const diff = Math.round((day(now) - day(new Date(c.updatedAt))) / 864e5);
|
|
15
|
+
if (diff <= 0) return "today";
|
|
16
|
+
if (diff === 1) return "yesterday";
|
|
17
|
+
if (diff <= 7) return "week";
|
|
18
|
+
return "older";
|
|
19
|
+
}
|
|
20
|
+
function ConversationList({
|
|
21
|
+
items,
|
|
22
|
+
activeId,
|
|
23
|
+
onSelect,
|
|
24
|
+
onNew,
|
|
25
|
+
onRename,
|
|
26
|
+
onDelete,
|
|
27
|
+
onPin,
|
|
28
|
+
now,
|
|
29
|
+
searchable = true,
|
|
30
|
+
className,
|
|
31
|
+
...props
|
|
32
|
+
}) {
|
|
33
|
+
const t = useDsMessages();
|
|
34
|
+
const [query, setQuery] = React.useState("");
|
|
35
|
+
const ref = now ?? /* @__PURE__ */ new Date();
|
|
36
|
+
const q = query.trim().toLowerCase();
|
|
37
|
+
const shown = items.filter((c) => !q || c.title.toLowerCase().includes(q)).sort((a, b) => +new Date(b.updatedAt) - +new Date(a.updatedAt));
|
|
38
|
+
const order = ["pinned", "today", "yesterday", "week", "older"];
|
|
39
|
+
const names = {
|
|
40
|
+
pinned: t.conversationPinned,
|
|
41
|
+
today: t.conversationToday,
|
|
42
|
+
yesterday: t.conversationYesterday,
|
|
43
|
+
week: t.conversationWeek,
|
|
44
|
+
older: t.conversationOlder
|
|
45
|
+
};
|
|
46
|
+
const hasMenu = Boolean(onPin || onRename || onDelete);
|
|
47
|
+
return /* @__PURE__ */ jsxs(
|
|
48
|
+
"div",
|
|
49
|
+
{
|
|
50
|
+
"data-slot": "conversation-list",
|
|
51
|
+
className: cn("flex min-h-0 w-full flex-col gap-3", className),
|
|
52
|
+
...props,
|
|
53
|
+
children: [
|
|
54
|
+
onNew ? /* @__PURE__ */ jsxs(Button, { variant: "outline", onClick: onNew, children: [
|
|
55
|
+
/* @__PURE__ */ jsx(PlusIcon, { "data-icon": "inline-start" }),
|
|
56
|
+
t.conversationNew
|
|
57
|
+
] }) : null,
|
|
58
|
+
searchable ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(SearchIcon, { "aria-hidden": true, className: "pointer-events-none absolute start-2.5 top-1/2 size-4 -translate-y-1/2 text-muted-foreground" }),
|
|
60
|
+
/* @__PURE__ */ jsx(
|
|
61
|
+
Input,
|
|
62
|
+
{
|
|
63
|
+
type: "search",
|
|
64
|
+
value: query,
|
|
65
|
+
onChange: (e) => setQuery(e.target.value),
|
|
66
|
+
placeholder: t.conversationSearch,
|
|
67
|
+
"aria-label": t.conversationSearch,
|
|
68
|
+
className: "ps-8"
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
] }) : null,
|
|
72
|
+
/* @__PURE__ */ jsx("nav", { "aria-label": t.conversationListLabel, className: "min-h-0 flex-1 overflow-y-auto", children: shown.length === 0 ? /* @__PURE__ */ jsx("p", { className: "px-2 py-6 text-center text-sm text-muted-foreground", children: q ? dsFormat(t.searchNoResults, { query }) : t.conversationEmpty }) : order.map((b) => {
|
|
73
|
+
const group = shown.filter((c) => bucket(c, ref) === b);
|
|
74
|
+
if (!group.length) return null;
|
|
75
|
+
return /* @__PURE__ */ jsxs("section", { "aria-label": names[b], className: "mb-3 last:mb-0", children: [
|
|
76
|
+
/* @__PURE__ */ jsxs("h3", { className: "flex items-center gap-1 px-2 pb-1 text-xs font-(--ds-medium-weight) text-muted-foreground", children: [
|
|
77
|
+
b === "pinned" ? /* @__PURE__ */ jsx(PinIcon, { "aria-hidden": true, className: "size-3" }) : null,
|
|
78
|
+
names[b]
|
|
79
|
+
] }),
|
|
80
|
+
/* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-0.5", children: group.map((c) => {
|
|
81
|
+
const active = c.id === activeId;
|
|
82
|
+
return /* @__PURE__ */ jsxs(
|
|
83
|
+
"li",
|
|
84
|
+
{
|
|
85
|
+
"data-slot": "conversation-item",
|
|
86
|
+
"data-active": active || void 0,
|
|
87
|
+
"data-busy": c.busy || void 0,
|
|
88
|
+
className: cn(
|
|
89
|
+
"group/conv relative flex items-center rounded-control hover:bg-(--ds-hover-bg)",
|
|
90
|
+
active && "bg-(--ds-active-bg)"
|
|
91
|
+
),
|
|
92
|
+
children: [
|
|
93
|
+
/* @__PURE__ */ jsxs(
|
|
94
|
+
"button",
|
|
95
|
+
{
|
|
96
|
+
type: "button",
|
|
97
|
+
"aria-current": active ? "page" : void 0,
|
|
98
|
+
onClick: () => onSelect?.(c.id),
|
|
99
|
+
className: "flex min-w-0 flex-1 items-center gap-2 rounded-control px-2 py-1.5 text-start text-sm outline-none focus-visible:ring-(length:--ds-ring-width) focus-visible:ring-(--ds-ring-color)",
|
|
100
|
+
children: [
|
|
101
|
+
c.busy ? /* @__PURE__ */ jsx(
|
|
102
|
+
"span",
|
|
103
|
+
{
|
|
104
|
+
"aria-hidden": true,
|
|
105
|
+
className: "size-(--ds-status-dot) shrink-0 animate-ds-ring-inner rounded-full bg-info motion-reduce:animate-none"
|
|
106
|
+
}
|
|
107
|
+
) : null,
|
|
108
|
+
/* @__PURE__ */ jsx("span", { className: cn("min-w-0 flex-1 truncate", active && "font-(--ds-medium-weight)"), children: c.title })
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
hasMenu ? /* @__PURE__ */ jsxs(DropdownMenu, { children: [
|
|
113
|
+
/* @__PURE__ */ jsx(
|
|
114
|
+
DropdownMenuTrigger,
|
|
115
|
+
{
|
|
116
|
+
render: /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-xs" }),
|
|
117
|
+
"aria-label": dsFormat(t.conversationActions, { name: c.title }),
|
|
118
|
+
className: "me-1 opacity-0 group-focus-within/conv:opacity-100 group-hover/conv:opacity-100 data-[popup-open]:opacity-100 max-md:opacity-100",
|
|
119
|
+
children: /* @__PURE__ */ jsx(MoreHorizontalIcon, {})
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ jsxs(DropdownMenuContent, { align: "end", children: [
|
|
123
|
+
onPin ? /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => onPin(c.id, !c.pinned), children: c.pinned ? t.conversationUnpin : t.conversationPin }) : null,
|
|
124
|
+
onRename ? /* @__PURE__ */ jsx(DropdownMenuItem, { onClick: () => onRename(c.id), children: t.conversationRename }) : null,
|
|
125
|
+
onDelete ? /* @__PURE__ */ jsx(DropdownMenuItem, { variant: "destructive", onClick: () => onDelete(c.id), children: t.conversationDelete }) : null
|
|
126
|
+
] })
|
|
127
|
+
] }) : null
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
c.id
|
|
131
|
+
);
|
|
132
|
+
}) })
|
|
133
|
+
] }, b);
|
|
134
|
+
}) })
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
export {
|
|
140
|
+
ConversationList
|
|
141
|
+
};
|
package/dist/ui/empty.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
5
5
|
declare function Empty({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
6
6
|
declare function EmptyHeader({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
7
7
|
declare const emptyMediaVariants: (props?: ({
|
|
8
|
-
variant?: "
|
|
8
|
+
variant?: "icon" | "default" | null | undefined;
|
|
9
9
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
10
|
declare function EmptyMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof emptyMediaVariants>): React$1.JSX.Element;
|
|
11
11
|
declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
package/dist/ui/field.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ declare function FieldLegend({ className, variant, ...props }: React.ComponentPr
|
|
|
9
9
|
}): React$1.JSX.Element;
|
|
10
10
|
declare function FieldGroup({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
11
11
|
declare const fieldVariants: (props?: ({
|
|
12
|
-
orientation?: "
|
|
12
|
+
orientation?: "vertical" | "horizontal" | "responsive" | null | undefined;
|
|
13
13
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
14
|
declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): React$1.JSX.Element;
|
|
15
15
|
declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): React$1.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare function GeneratedImage({ status, src, alt, prompt, ratio, downloadName, onRetry, className, style, ...props }: Omit<React.ComponentProps<"figure">, "children"> & {
|
|
4
|
+
status?: "loading" | "done" | "error";
|
|
5
|
+
src?: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
prompt?: string;
|
|
8
|
+
/** Proporción del hueco, p. ej. `"1/1"`, `"16/9"`. */
|
|
9
|
+
ratio?: string;
|
|
10
|
+
downloadName?: string;
|
|
11
|
+
onRetry?: () => void;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { GeneratedImage };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertCircleIcon, DownloadIcon, RefreshCwIcon } from "lucide-react";
|
|
4
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
import { Spinner } from "./spinner.js";
|
|
8
|
+
function GeneratedImage({
|
|
9
|
+
status = "done",
|
|
10
|
+
src,
|
|
11
|
+
alt,
|
|
12
|
+
prompt,
|
|
13
|
+
ratio = "1/1",
|
|
14
|
+
downloadName = "image.png",
|
|
15
|
+
onRetry,
|
|
16
|
+
className,
|
|
17
|
+
style,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
20
|
+
const t = useDsMessages();
|
|
21
|
+
const ready = status === "done" && Boolean(src);
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"figure",
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "generated-image",
|
|
26
|
+
"data-status": status,
|
|
27
|
+
className: cn("flex w-full max-w-md flex-col gap-2", className),
|
|
28
|
+
style,
|
|
29
|
+
...props,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsx("div", { className: "relative overflow-hidden rounded-lg border border-border bg-muted/40", style: { aspectRatio: ratio }, children: ready ? /* @__PURE__ */ jsx("img", { src, alt, className: "size-full object-cover" }) : status === "loading" ? /* @__PURE__ */ jsxs("div", { role: "status", className: "flex size-full flex-col items-center justify-center gap-2 text-sm text-muted-foreground", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(Spinner, { "aria-hidden": true, role: "presentation" }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "text-shimmer", children: t.imageGenerating })
|
|
34
|
+
] }) : /* @__PURE__ */ jsxs("div", { role: "alert", className: "flex size-full flex-col items-center justify-center gap-3 p-4 text-center text-sm text-danger", children: [
|
|
35
|
+
/* @__PURE__ */ jsx(AlertCircleIcon, { "aria-hidden": true, className: "size-5" }),
|
|
36
|
+
/* @__PURE__ */ jsx("span", { children: t.imageError }),
|
|
37
|
+
onRetry ? /* @__PURE__ */ jsxs(Button, { size: "sm", variant: "outline", onClick: onRetry, children: [
|
|
38
|
+
/* @__PURE__ */ jsx(RefreshCwIcon, { "data-icon": "inline-start" }),
|
|
39
|
+
t.messageRetry
|
|
40
|
+
] }) : null
|
|
41
|
+
] }) }),
|
|
42
|
+
prompt || ready ? /* @__PURE__ */ jsxs("figcaption", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: prompt }),
|
|
44
|
+
ready ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
|
+
onRetry ? /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "icon-xs", "aria-label": t.messageRetry, onClick: onRetry, children: /* @__PURE__ */ jsx(RefreshCwIcon, {}) }) : null,
|
|
46
|
+
/* @__PURE__ */ jsx(
|
|
47
|
+
Button,
|
|
48
|
+
{
|
|
49
|
+
variant: "ghost",
|
|
50
|
+
size: "icon-xs",
|
|
51
|
+
"aria-label": t.imageDownload,
|
|
52
|
+
render: /* @__PURE__ */ jsx("a", { href: src, download: downloadName }),
|
|
53
|
+
nativeButton: false,
|
|
54
|
+
children: /* @__PURE__ */ jsx(DownloadIcon, {})
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
] }) : null
|
|
58
|
+
] }) : null
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
export {
|
|
64
|
+
GeneratedImage
|
|
65
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
declare function GeneratedTable({ columns, rows, caption, downloadable, downloadName, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
|
|
4
|
+
columns: string[];
|
|
5
|
+
rows: Record<string, React.ReactNode>[];
|
|
6
|
+
caption?: React.ReactNode;
|
|
7
|
+
downloadable?: boolean;
|
|
8
|
+
downloadName?: string;
|
|
9
|
+
}): React.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { GeneratedTable };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { DownloadIcon } from "lucide-react";
|
|
5
|
+
import { useDsMessages } from "../hooks/use-ds-messages.js";
|
|
6
|
+
import { cn } from "../lib/utils.js";
|
|
7
|
+
import { Button } from "./button.js";
|
|
8
|
+
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "./table.js";
|
|
9
|
+
function csv(columns, rows) {
|
|
10
|
+
const cell = (v) => `"${String(v ?? "").replace(/"/g, '""')}"`;
|
|
11
|
+
return [columns.map(cell).join(","), ...rows.map((r) => columns.map((c) => cell(r[c])).join(","))].join("\n");
|
|
12
|
+
}
|
|
13
|
+
function GeneratedTable({
|
|
14
|
+
columns,
|
|
15
|
+
rows,
|
|
16
|
+
caption,
|
|
17
|
+
downloadable = false,
|
|
18
|
+
downloadName = "table.csv",
|
|
19
|
+
className,
|
|
20
|
+
...props
|
|
21
|
+
}) {
|
|
22
|
+
const t = useDsMessages();
|
|
23
|
+
const href = React.useMemo(
|
|
24
|
+
() => downloadable ? `data:text/csv;charset=utf-8,${encodeURIComponent(csv(columns, rows))}` : void 0,
|
|
25
|
+
[downloadable, columns, rows]
|
|
26
|
+
);
|
|
27
|
+
return /* @__PURE__ */ jsxs(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "generated-table",
|
|
31
|
+
className: cn("flex flex-col gap-2 rounded-lg border border-border bg-card p-2 text-card-foreground", className),
|
|
32
|
+
...props,
|
|
33
|
+
children: [
|
|
34
|
+
/* @__PURE__ */ jsxs(Table, { children: [
|
|
35
|
+
caption ? /* @__PURE__ */ jsx(TableCaption, { children: caption }) : null,
|
|
36
|
+
/* @__PURE__ */ jsx(TableHeader, { children: /* @__PURE__ */ jsx(TableRow, { children: columns.map((c) => /* @__PURE__ */ jsx(TableHead, { scope: "col", children: c }, c)) }) }),
|
|
37
|
+
/* @__PURE__ */ jsx(TableBody, { children: rows.length === 0 ? /* @__PURE__ */ jsx(TableRow, { children: /* @__PURE__ */ jsx(TableCell, { colSpan: Math.max(columns.length, 1), className: "text-center text-muted-foreground", children: t.tableEmpty }) }) : rows.map((r, i) => /* @__PURE__ */ jsx(TableRow, { children: columns.map((c) => /* @__PURE__ */ jsx(TableCell, { children: r[c] }, c)) }, i)) })
|
|
38
|
+
] }),
|
|
39
|
+
href && rows.length ? /* @__PURE__ */ jsx("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs(
|
|
40
|
+
Button,
|
|
41
|
+
{
|
|
42
|
+
variant: "ghost",
|
|
43
|
+
size: "sm",
|
|
44
|
+
"data-slot": "generated-table-download",
|
|
45
|
+
render: /* @__PURE__ */ jsx("a", { href, download: downloadName }),
|
|
46
|
+
nativeButton: false,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ jsx(DownloadIcon, { "data-icon": "inline-start" }),
|
|
49
|
+
t.tableDownload
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
) }) : null
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
GeneratedTable
|
|
59
|
+
};
|
package/dist/ui/icon-tile.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
|
|
5
5
|
declare const iconTileVariants: (props?: ({
|
|
6
|
-
tone?: "
|
|
7
|
-
size?: "sm" | "
|
|
6
|
+
tone?: "neutral" | "primary" | "info" | "success" | "warning" | "danger" | "accent" | null | undefined;
|
|
7
|
+
size?: "sm" | "md" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
declare function IconTile({ className, tone, size, ...props }: React.ComponentProps<"div"> & VariantProps<typeof iconTileVariants>): React.JSX.Element;
|
|
10
10
|
|
package/dist/ui/item.d.ts
CHANGED
|
@@ -8,12 +8,12 @@ import '@base-ui/react/separator';
|
|
|
8
8
|
declare function ItemGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
9
9
|
declare function ItemSeparator({ className, ...props }: React.ComponentProps<typeof Separator>): React.JSX.Element;
|
|
10
10
|
declare const itemVariants: (props?: ({
|
|
11
|
-
variant?: "
|
|
11
|
+
variant?: "outline" | "default" | "muted" | "card" | null | undefined;
|
|
12
12
|
size?: "default" | "xs" | "sm" | null | undefined;
|
|
13
13
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
14
14
|
declare function Item({ className, variant, size, render, ...props }: useRender.ComponentProps<"div"> & VariantProps<typeof itemVariants>): React.JSX.Element;
|
|
15
15
|
declare const itemMediaVariants: (props?: ({
|
|
16
|
-
variant?: "
|
|
16
|
+
variant?: "icon" | "default" | "image" | null | undefined;
|
|
17
17
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
18
18
|
declare function ItemMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof itemMediaVariants>): React.JSX.Element;
|
|
19
19
|
declare function ItemContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Cierra lo que un texto en streaming deja abierto (vallas de código, negrita, cursiva, tachado) para que se pinte
|
|
5
|
+
* bien mientras llega. Solo toca el final; el texto original no se modifica.
|
|
6
|
+
*/
|
|
7
|
+
declare function closeOpenMarkdown(text: string): string;
|
|
8
|
+
declare function Markdown({ children, streaming, className, ...props }: Omit<React.ComponentProps<"div">, "children"> & {
|
|
9
|
+
children: string;
|
|
10
|
+
/** Texto que aún está llegando: cierra lo que haya quedado abierto. */
|
|
11
|
+
streaming?: boolean;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { Markdown, closeOpenMarkdown };
|