@nadicodeai/ui 0.7.0 → 0.9.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 +13 -0
- package/README.md +1 -0
- package/dist/components/action-status.d.ts +11 -0
- package/dist/components/action-status.d.ts.map +1 -0
- package/dist/components/action-status.js +6 -0
- package/dist/components/agent-avatar.d.ts +7 -0
- package/dist/components/agent-avatar.d.ts.map +1 -0
- package/dist/components/agent-avatar.js +6 -0
- package/dist/components/agent-message.d.ts.map +1 -1
- package/dist/components/agent-message.js +10 -6
- package/dist/components/agent-thread.js +1 -1
- package/dist/components/agent-tool-approval.d.ts +5 -10
- package/dist/components/agent-tool-approval.d.ts.map +1 -1
- package/dist/components/agent-tool-approval.js +9 -30
- package/dist/components/artifact-panel.d.ts +1 -2
- package/dist/components/artifact-panel.d.ts.map +1 -1
- package/dist/components/artifact-panel.js +12 -13
- package/dist/components/attachment.d.ts +24 -0
- package/dist/components/attachment.d.ts.map +1 -0
- package/dist/components/attachment.js +68 -0
- package/dist/components/bubble.d.ts +17 -0
- package/dist/components/bubble.d.ts.map +1 -0
- package/dist/components/bubble.js +59 -0
- package/dist/components/confirm-dialog.d.ts +16 -0
- package/dist/components/confirm-dialog.d.ts.map +1 -0
- package/dist/components/confirm-dialog.js +18 -0
- package/dist/components/diff-count.d.ts +7 -0
- package/dist/components/diff-count.d.ts.map +1 -0
- package/dist/components/diff-count.js +18 -0
- package/dist/components/disclosure-row.d.ts +12 -0
- package/dist/components/disclosure-row.d.ts.map +1 -0
- package/dist/components/disclosure-row.js +11 -0
- package/dist/components/expandable-block.d.ts +10 -0
- package/dist/components/expandable-block.d.ts.map +1 -0
- package/dist/components/expandable-block.js +22 -0
- package/dist/components/file-type-icon.d.ts +8 -0
- package/dist/components/file-type-icon.d.ts.map +1 -0
- package/dist/components/file-type-icon.js +90 -0
- package/dist/components/glyph-spinner.d.ts +10 -0
- package/dist/components/glyph-spinner.d.ts.map +1 -0
- package/dist/components/glyph-spinner.js +101 -0
- package/dist/components/handoff-banner.d.ts +9 -0
- package/dist/components/handoff-banner.d.ts.map +1 -0
- package/dist/components/handoff-banner.js +6 -0
- package/dist/components/marker.d.ts +11 -0
- package/dist/components/marker.d.ts.map +1 -0
- package/dist/components/marker.js +34 -0
- package/dist/components/memory-item.d.ts +9 -0
- package/dist/components/memory-item.d.ts.map +1 -0
- package/dist/components/memory-item.js +6 -0
- package/dist/components/message-scroller.d.ts +17 -0
- package/dist/components/message-scroller.d.ts.map +1 -0
- package/dist/components/message-scroller.js +29 -0
- package/dist/components/message.d.ts +11 -0
- package/dist/components/message.d.ts.map +1 -0
- package/dist/components/message.js +21 -0
- package/dist/components/run-timeline.d.ts +16 -0
- package/dist/components/run-timeline.d.ts.map +1 -0
- package/dist/components/run-timeline.js +9 -0
- package/dist/components/status-dot.d.ts +9 -0
- package/dist/components/status-dot.d.ts.map +1 -0
- package/dist/components/status-dot.js +12 -0
- package/dist/components/status-row.d.ts +18 -0
- package/dist/components/status-row.d.ts.map +1 -0
- package/dist/components/status-row.js +21 -0
- package/dist/components/toast.d.ts +3 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +4 -0
- package/dist/components/tool-icon.d.ts +8 -0
- package/dist/components/tool-icon.d.ts.map +1 -0
- package/dist/components/tool-icon.js +23 -0
- package/dist/components/usage-meter.d.ts +9 -0
- package/dist/components/usage-meter.d.ts.map +1 -0
- package/dist/components/usage-meter.js +10 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +4 -0
- package/dist/hooks/use-below-breakpoint.d.ts +3 -0
- package/dist/hooks/use-below-breakpoint.d.ts.map +1 -0
- package/dist/hooks/use-below-breakpoint.js +20 -0
- package/dist/hooks/use-confirm-action.d.ts +17 -0
- package/dist/hooks/use-confirm-action.d.ts.map +1 -0
- package/dist/hooks/use-confirm-action.js +59 -0
- package/dist/index.d.ts +27 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -7
- package/dist/lib/agent-contracts.d.ts +132 -0
- package/dist/lib/agent-contracts.d.ts.map +1 -0
- package/dist/lib/agent-contracts.js +6 -0
- package/dist/lib/agent-state.d.ts +22 -0
- package/dist/lib/agent-state.d.ts.map +1 -0
- package/dist/lib/agent-state.js +96 -0
- package/dist/lib/message-scroller-primitive/components.d.ts +17 -0
- package/dist/lib/message-scroller-primitive/components.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/components.js +204 -0
- package/dist/lib/message-scroller-primitive/geometry.d.ts +55 -0
- package/dist/lib/message-scroller-primitive/geometry.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/geometry.js +199 -0
- package/dist/lib/message-scroller-primitive/index.d.ts +12 -0
- package/dist/lib/message-scroller-primitive/index.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/index.js +12 -0
- package/dist/lib/message-scroller-primitive/stores.d.ts +7 -0
- package/dist/lib/message-scroller-primitive/stores.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/stores.js +53 -0
- package/dist/lib/message-scroller-primitive/types.d.ts +89 -0
- package/dist/lib/message-scroller-primitive/types.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/types.js +40 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-commands.d.ts +19 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-commands.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-commands.js +188 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-controller.d.ts +7 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-controller.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-controller.js +506 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-refs.d.ts +49 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-refs.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/use-message-scroller-refs.js +90 -0
- package/dist/lib/message-scroller-primitive/use-render.d.ts +22 -0
- package/dist/lib/message-scroller-primitive/use-render.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/use-render.js +113 -0
- package/dist/lib/message-scroller-primitive/utils.d.ts +4 -0
- package/dist/lib/message-scroller-primitive/utils.d.ts.map +1 -0
- package/dist/lib/message-scroller-primitive/utils.js +9 -0
- package/dist/styles/globals.css +29 -17
- package/docs/agent-work-surfaces.md +36 -3
- package/docs/agents/nadicodeai-ui.md +1 -0
- package/docs/consuming-cross-repo.md +72 -0
- package/docs/migration/ai-elements-vendoring.md +29 -0
- package/docs/migration/nadia-consumer-readiness.md +100 -0
- package/llms.txt +1 -0
- package/package.json +14 -2
package/AGENTS.md
CHANGED
|
@@ -32,6 +32,18 @@ skills.
|
|
|
32
32
|
- **Brand renderers live here for React consumers.** `BrandMark` is the logo mark, and `BrandWordmark` is the text-only wordmark. A full lockup is exactly one `BrandMark` followed by one `BrandWordmark`; compact mark-only usage uses `BrandMark` alone. These adapters are the only place React code imports the raw `@nadicodeai/design-system/assets/*` logo SVG exports. Website, portal, and sibling routes use these adapters instead of importing logo assets directly, drawing brand SVG inline, masking/recoloring assets, or embedding the mark inside the wordmark.
|
|
33
33
|
- **No fake proof APIs.** Components may support future testimonials, logos, stats, and proof slots, but they must render nothing public when the proof is absent. Do not ship placeholder customer names, metrics, or logos.
|
|
34
34
|
|
|
35
|
+
## Component Admission
|
|
36
|
+
|
|
37
|
+
Agent work surfaces — chat, composer, tool approval, artifacts, threads,
|
|
38
|
+
diffs, terminal/file preview, and the underlying agent state models — are
|
|
39
|
+
NadicodeAI core domain. They belong in this package outright, not behind a
|
|
40
|
+
named consumer. Any other new product composition (a shell, a settings
|
|
41
|
+
surface, a generic section) is admitted only with a named consuming surface
|
|
42
|
+
landing in the same change. Genuinely app-bespoke UI — window chrome,
|
|
43
|
+
boot/install overlays, mascots, PTY/xterm embeds — stays in the consuming
|
|
44
|
+
app; it never becomes a package abstraction. A component left unconsumed
|
|
45
|
+
after its target migration ships gets removed.
|
|
46
|
+
|
|
35
47
|
## Reusable Section Vocabulary
|
|
36
48
|
|
|
37
49
|
The soft-launch homepage relies on this reusable vocabulary, and future reusable
|
|
@@ -103,6 +115,7 @@ Use public component subpaths for product UI:
|
|
|
103
115
|
- `@nadicodeai/ui/components/chart-kpi-stat`
|
|
104
116
|
- `@nadicodeai/ui/components/chart-sparkline`
|
|
105
117
|
- `@nadicodeai/ui/components/chart-time-series`
|
|
118
|
+
- `@nadicodeai/ui/components/confirm-dialog`
|
|
106
119
|
- `@nadicodeai/ui/components/dashboard-shell`
|
|
107
120
|
- `@nadicodeai/ui/components/desktop-shell`
|
|
108
121
|
- `@nadicodeai/ui/components/feedback-state`
|
package/README.md
CHANGED
|
@@ -142,6 +142,7 @@ Current product subpaths:
|
|
|
142
142
|
- `@nadicodeai/ui/components/chart-kpi-stat`
|
|
143
143
|
- `@nadicodeai/ui/components/chart-sparkline`
|
|
144
144
|
- `@nadicodeai/ui/components/chart-time-series`
|
|
145
|
+
- `@nadicodeai/ui/components/confirm-dialog`
|
|
145
146
|
- `@nadicodeai/ui/components/dashboard-shell`
|
|
146
147
|
- `@nadicodeai/ui/components/desktop-shell`
|
|
147
148
|
- `@nadicodeai/ui/components/feedback-state`
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
interface ActionStatusProps {
|
|
3
|
+
state: "done" | "idle" | "saving";
|
|
4
|
+
idle: string;
|
|
5
|
+
busy: string;
|
|
6
|
+
done: string;
|
|
7
|
+
idleIcon?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare function ActionStatus({ state, idle, busy, done, idleIcon }: ActionStatusProps): import("react").JSX.Element;
|
|
10
|
+
export { ActionStatus };
|
|
11
|
+
//# sourceMappingURL=action-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-status.d.ts","sourceRoot":"","sources":["../../src/components/action-status.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,iBAAiB;IACzB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AACD,iBAAS,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAe,EAAE,EAAE,iBAAiB,+BAapF;AACD,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CheckIcon, Loader2Icon } from "lucide-react";
|
|
3
|
+
function ActionStatus({ state, idle, busy, done, idleIcon = null }) {
|
|
4
|
+
return (_jsxs(_Fragment, { children: [state === "saving" ? (_jsx(Loader2Icon, { "aria-hidden": "true", className: "animate-spin", "data-icon": "inline-start" })) : state === "done" ? (_jsx(CheckIcon, { "aria-hidden": "true", "data-icon": "inline-start" })) : (idleIcon), state === "saving" ? busy : state === "done" ? done : idle] }));
|
|
5
|
+
}
|
|
6
|
+
export { ActionStatus };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type AgentAvatarAccent = "green" | "cyan" | "amber" | "ink" | "red";
|
|
3
|
+
declare function AgentAvatar({ className, accent, children, ...props }: React.ComponentProps<"span"> & {
|
|
4
|
+
accent?: AgentAvatarAccent;
|
|
5
|
+
}): React.JSX.Element;
|
|
6
|
+
export { AgentAvatar };
|
|
7
|
+
//# sourceMappingURL=agent-avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-avatar.d.ts","sourceRoot":"","sources":["../../src/components/agent-avatar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,CAAC;AAE3E,iBAAS,WAAW,CAAC,EACnB,SAAS,EACT,MAAM,EACN,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,iBAAiB,CAAA;CAAE,qBAW/D;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
|
+
function AgentAvatar({ className, accent, children, ...props }) {
|
|
4
|
+
return (_jsx("span", { "data-slot": "agent-avatar", "data-accent": accent, className: cn("nc-agent-avatar", className), ...props, children: children }));
|
|
5
|
+
}
|
|
6
|
+
export { AgentAvatar };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-message.d.ts","sourceRoot":"","sources":["../../src/components/agent-message.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAqB/B,OAAO,EAKL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGhF,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE/D,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAEvF,MAAM,MAAM,0BAA0B,GAAG;IACv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pB,YAAY,EACZ,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,GACd,CAAC"}
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { BotIcon, InfoIcon, UserIcon } from "lucide-react";
|
|
4
4
|
import { Attachment, AttachmentInfo, AttachmentPreview, Attachments, } from "./ai-elements/attachments.js";
|
|
5
|
-
import { Message,
|
|
5
|
+
import { Message, MessageResponse } from "./ai-elements/message.js";
|
|
6
6
|
import { Reasoning, ReasoningContent, ReasoningTrigger } from "./ai-elements/reasoning.js";
|
|
7
7
|
import { Source, Sources, SourcesContent, SourcesTrigger } from "./ai-elements/sources.js";
|
|
8
|
-
import {
|
|
8
|
+
import { ToolContent, ToolHeader, ToolInput, ToolOutput, } from "./ai-elements/tool.js";
|
|
9
|
+
import { Collapsible } from "./collapsible.js";
|
|
9
10
|
import { ArtifactPanel, RedactedNotice, StackTraceDisclosure, getAgentRedactionText, } from "./artifact-panel.js";
|
|
10
11
|
import { AgentToolApproval, } from "./agent-tool-approval.js";
|
|
11
12
|
import { Badge } from "./badge.js";
|
|
@@ -57,16 +58,19 @@ function AgentReasoningBlock({ reasoning }) {
|
|
|
57
58
|
}
|
|
58
59
|
function AgentToolCall({ toolCall, actions, onApprovalChoice, }) {
|
|
59
60
|
const state = toolStatusToAiState[toolCall.status];
|
|
60
|
-
return (_jsxs(
|
|
61
|
+
return (_jsxs(Collapsible, { "data-slot": "agent-tool-call", "data-tool-status": toolCall.status, className: "group not-prose w-full rounded-md border", defaultOpen: true, children: [_jsx(ToolHeader, { className: "nc-tool-call-trace", type: `tool-${toolCall.name}`, state: state, title: toolCall.title ?? toolCall.name }), _jsxs(ToolContent, { children: [toolCall.approval && (_jsx(AgentToolApproval, { request: toolCall.approval, disabled: !onApprovalChoice, onChoice: onApprovalChoice
|
|
61
62
|
? (choice, request) => onApprovalChoice(choice, request, toolCall)
|
|
62
63
|
: undefined })), toolCall.redaction ? (_jsx(RedactedNotice, { redaction: toolCall.redaction })) : (_jsxs(_Fragment, { children: [toolCall.input !== undefined && (_jsx(ToolInput, { input: toolCall.input })), (toolCall.output !== undefined || toolCall.error) && (_jsx(ToolOutput, { output: toolCall.output, errorText: toolCall.error }))] })), !toolCall.redaction && toolCall.trace && _jsx(StackTraceDisclosure, { trace: toolCall.trace }), actions] })] }));
|
|
63
64
|
}
|
|
64
|
-
function AgentMessagePartView({ part, toolActions, onToolApprovalChoice, }) {
|
|
65
|
+
function AgentMessagePartView({ part, role, toolActions, onToolApprovalChoice, }) {
|
|
65
66
|
if (part.type === "text") {
|
|
66
67
|
if (part.redaction) {
|
|
67
68
|
return _jsx(RedactedNotice, { redaction: part.redaction });
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
if (role === "system") {
|
|
71
|
+
return _jsx(MessageResponse, { children: part.text });
|
|
72
|
+
}
|
|
73
|
+
return (_jsx("div", { "data-slot": "agent-message-bubble", className: role === "user" ? "nc-chat-bubble-user" : "nc-chat-bubble-agent", children: _jsx(MessageResponse, { children: part.text }) }));
|
|
70
74
|
}
|
|
71
75
|
if (part.type === "reasoning") {
|
|
72
76
|
return _jsx(AgentReasoningBlock, { reasoning: part.reasoning });
|
|
@@ -90,6 +94,6 @@ function AgentMessageMeta({ role, metadata, state, }) {
|
|
|
90
94
|
function AgentMessage({ message, toolActions, retryAction, onToolApprovalChoice, className, ...props }) {
|
|
91
95
|
const parts = message.parts ?? (message.content ? [{ text: message.content, type: "text" }] : []);
|
|
92
96
|
const aiRole = message.role === "user" ? "user" : "assistant";
|
|
93
|
-
return (_jsx("article", { "data-slot": "agent-message", "data-message-role": message.role, "data-agent-state": message.state, className: className, ...props, children: _jsxs(Message, { from: aiRole, className: cn("max-w-full", message.role === "system" && "mx-auto border-y bg-muted/20 px-4 py-3"), children: [_jsx(AgentMessageMeta, { role: message.role, metadata: message.metadata, state: message.state }), _jsxs(
|
|
97
|
+
return (_jsx("article", { "data-slot": "agent-message", "data-message-role": message.role, "data-agent-state": message.state, className: className, ...props, children: _jsxs(Message, { from: aiRole, className: cn("max-w-full", message.role === "system" && "mx-auto border-y bg-muted/20 px-4 py-3"), children: [_jsx(AgentMessageMeta, { role: message.role, metadata: message.metadata, state: message.state }), _jsxs("div", { "data-slot": "agent-message-content", className: cn("flex w-full min-w-0 flex-col gap-2 text-sm", message.role === "system" && "text-muted-foreground"), children: [_jsx(AgentAttachmentsList, { attachments: message.attachments }), message.redaction ? (_jsx(RedactedNotice, { redaction: message.redaction })) : (parts.map((part, index) => (_jsx(AgentMessagePartView, { part: part, role: message.role, toolActions: toolActions, onToolApprovalChoice: onToolApprovalChoice }, `${message.id}-${part.type}-${index}`)))), _jsx(AgentSourcesList, { sources: message.sources }), message.state && message.state !== "idle" && message.state !== "streaming" && (_jsx(AgentMessageStateNotice, { state: message.state, actions: message.state === "retryable" ? retryAction : undefined }))] })] }) }));
|
|
94
98
|
}
|
|
95
99
|
export { AgentAttachmentsList, AgentMessage, AgentMessageStateNotice, AgentSourcesList, AgentToolCall, };
|
|
@@ -58,6 +58,6 @@ function AgentThread({ messages, state = "idle", stateCopy, emptyState, toolActi
|
|
|
58
58
|
const stateForRender = nonIdleState && nonIdleState !== "empty" ? nonIdleState : undefined;
|
|
59
59
|
const stateProps = nonIdleState ? stateCopy?.[nonIdleState] : undefined;
|
|
60
60
|
const stateActions = stateForRender === "retryable" ? (retryAction ?? stateProps?.actions) : stateProps?.actions;
|
|
61
|
-
return (_jsx(Conversation, { "data-slot": "agent-thread", "data-agent-state": state, className: cn("min-h-0
|
|
61
|
+
return (_jsx(Conversation, { "data-slot": "agent-thread", "data-agent-state": state, className: cn("nc-chat-thread min-h-0", className), ...props, children: _jsxs(ConversationContent, { className: cn("nc-chat-thread-body", contentClassName), children: [stateForRender && (_jsx(AgentThreadStateBanner, { state: stateForRender, actions: stateActions, title: stateProps?.title, description: stateProps?.description })), omittedMessages > 0 && _jsx(AgentThreadOverflowSummary, { omittedMessages: omittedMessages }), !hasMessages ? (_jsx(AgentThreadEmptyState, { ...(stateProps ?? emptyState ?? {}) })) : (visibleMessages.map((message) => (_jsx(AgentMessage, { message: message, toolActions: toolActions, retryAction: retryAction, onToolApprovalChoice: onToolApprovalChoice }, message.id)))), children] }) }));
|
|
62
62
|
}
|
|
63
63
|
export { AgentThread, AgentThreadEmptyState, AgentThreadStateBanner };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Card } from "./card";
|
|
3
|
-
|
|
4
|
-
export type AgentApprovalAlias
|
|
2
|
+
import type { Card } from "./card";
|
|
3
|
+
import type { AgentApprovalChoice } from "../lib/agent-contracts";
|
|
4
|
+
export type { AgentApprovalAlias, AgentApprovalChoice } from "../lib/agent-contracts";
|
|
5
|
+
export { agentApprovalAliases } from "../lib/agent-contracts";
|
|
5
6
|
export type AgentApprovalRisk = "low" | "review" | "elevated" | "blocked";
|
|
6
7
|
export type AgentToolApprovalRequest = {
|
|
7
8
|
id: string;
|
|
@@ -12,13 +13,7 @@ export type AgentToolApprovalRequest = {
|
|
|
12
13
|
risk?: AgentApprovalRisk;
|
|
13
14
|
choices?: AgentApprovalChoice[];
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
readonly always: "approve-always";
|
|
17
|
-
readonly deny: "reject";
|
|
18
|
-
readonly run: "approve-once";
|
|
19
|
-
readonly session: "approve-session";
|
|
20
|
-
};
|
|
21
|
-
declare function AgentToolApproval({ request, title, description, choices, choiceLabels, onChoice, disabled, footer, className, ...props }: Omit<React.ComponentProps<typeof Card>, "children" | "title"> & {
|
|
16
|
+
declare function AgentToolApproval({ request, title, description, choices, choiceLabels, onChoice, disabled, footer, size, className, ...props }: Omit<React.ComponentProps<typeof Card>, "children" | "title"> & {
|
|
22
17
|
request: AgentToolApprovalRequest;
|
|
23
18
|
title?: React.ReactNode;
|
|
24
19
|
description?: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-tool-approval.d.ts","sourceRoot":"","sources":["../../src/components/agent-tool-approval.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"agent-tool-approval.d.ts","sourceRoot":"","sources":["../../src/components/agent-tool-approval.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAIjE,YAAY,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACjC,CAAC;AAgCF,iBAAS,iBAAiB,CAAC,EACzB,OAAO,EACP,KAAK,EACL,WAAW,EACX,OAAiE,EACjE,YAAY,EACZ,QAAQ,EACR,QAAgB,EAChB,MAAM,EACN,IAAI,EACJ,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,GAAG;IACjE,OAAO,EAAE,wBAAwB,CAAC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;IACrE,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,OAAO,EAAE,wBAAwB,KAAK,IAAI,CAAC;IACpF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC1B,qBAgDA;AAED,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { BanIcon, CheckIcon, ClockIcon, ShieldCheckIcon } from "lucide-react";
|
|
4
|
-
import {
|
|
5
|
-
import { Button } from "./button.js";
|
|
6
|
-
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./card.js";
|
|
4
|
+
import { agentApprovalAliases } from "../lib/agent-contracts.js";
|
|
7
5
|
import { cn } from "../lib/utils.js";
|
|
8
|
-
export
|
|
9
|
-
always: "approve-always",
|
|
10
|
-
deny: "reject",
|
|
11
|
-
run: "approve-once",
|
|
12
|
-
session: "approve-session",
|
|
13
|
-
};
|
|
6
|
+
export { agentApprovalAliases } from "../lib/agent-contracts.js";
|
|
14
7
|
const approvalChoiceDefaults = {
|
|
15
8
|
always: {
|
|
16
9
|
icon: ShieldCheckIcon,
|
|
@@ -39,26 +32,12 @@ const approvalRiskLabels = {
|
|
|
39
32
|
low: "Low risk",
|
|
40
33
|
review: "Review",
|
|
41
34
|
};
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
if (choice === "deny") {
|
|
50
|
-
return "text-[var(--nc-tool-approval-deny)]";
|
|
51
|
-
}
|
|
52
|
-
if (choice === "session") {
|
|
53
|
-
return "text-[var(--nc-tool-approval-session)]";
|
|
54
|
-
}
|
|
55
|
-
return "text-[var(--nc-tool-approval-always)]";
|
|
56
|
-
}
|
|
57
|
-
function AgentToolApproval({ request, title, description, choices = request.choices ?? ["run", "deny", "session", "always"], choiceLabels, onChoice, disabled = false, footer, className, ...props }) {
|
|
58
|
-
return (_jsxs(Card, { "data-slot": "agent-tool-approval", "data-tool-name": request.toolName, "data-risk": request.risk, className: cn("gap-4 border-dashed bg-muted/20 shadow-none", className), ...props, children: [_jsxs(CardHeader, { className: "gap-2", children: [_jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [request.risk && _jsx(Badge, { variant: "outline", children: approvalRiskLabels[request.risk] }), _jsx(Badge, { variant: "secondary", children: request.toolName })] }), _jsx(CardTitle, { children: title ?? request.title ?? "Approval required" }), (description ?? request.description) && (_jsx(CardDescription, { children: description ?? request.description })), request.scope && (_jsx(CardDescription, { "data-slot": "agent-tool-approval-scope", children: request.scope }))] }), _jsx(CardContent, { children: _jsx("div", { "data-slot": "agent-tool-approval-choices", className: "flex flex-wrap gap-2", children: choices.map((choice) => {
|
|
59
|
-
const defaults = approvalChoiceDefaults[choice];
|
|
60
|
-
const Icon = defaults.icon;
|
|
61
|
-
return (_jsxs(Button, { type: "button", variant: defaults.variant, disabled: disabled, "data-approval-choice": choice, "data-approval-alias": agentApprovalAliases[choice], className: cn(getApprovalChoiceClass(choice, defaults.variant)), onClick: () => onChoice?.(choice, request), children: [_jsx(Icon, { className: "size-4", "data-icon": true }), choiceLabels?.[choice] ?? defaults.label] }, choice));
|
|
62
|
-
}) }) }), footer && _jsx(CardFooter, { children: footer })] }));
|
|
35
|
+
function AgentToolApproval({ request, title, description, choices = request.choices ?? ["run", "deny", "session", "always"], choiceLabels, onChoice, disabled = false, footer, size, className, ...props }) {
|
|
36
|
+
return (_jsxs("div", { "data-slot": "agent-tool-approval", "data-tool-name": request.toolName, "data-risk": request.risk, "data-size": size, className: cn("nc-approval-gate", className), ...props, children: [_jsx("span", { className: "nc-approval-gate-label", children: request.risk
|
|
37
|
+
? `${approvalRiskLabels[request.risk]} · ${request.toolName}`
|
|
38
|
+
: request.toolName }), _jsx("span", { className: "nc-approval-gate-title", children: title ?? request.title ?? "Approval required" }), (description ?? request.description) && (_jsx("span", { className: "nc-approval-gate-copy", children: description ?? request.description })), request.scope && (_jsx("span", { "data-slot": "agent-tool-approval-scope", className: "nc-approval-gate-copy", children: request.scope })), _jsx("div", { "data-slot": "agent-tool-approval-choices", className: "nc-approval-gate-actions", children: choices.map((choice) => {
|
|
39
|
+
const defaults = approvalChoiceDefaults[choice];
|
|
40
|
+
return (_jsx("button", { type: "button", disabled: disabled, "data-approval-choice": choice, "data-approval-alias": agentApprovalAliases[choice], "data-variant": defaults.variant, onClick: () => onChoice?.(choice, request), children: choiceLabels?.[choice] ?? defaults.label }, choice));
|
|
41
|
+
}) }), footer] }));
|
|
63
42
|
}
|
|
64
43
|
export { AgentToolApproval };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { BundledLanguage } from "shiki";
|
|
3
|
-
import { Artifact } from "./ai-elements/artifact";
|
|
4
3
|
export type AgentRedactionCategory = "secret" | "environment" | "terminal-output" | "user-memory" | "private-reasoning";
|
|
5
4
|
export type AgentRedactionRule = {
|
|
6
5
|
redacted: true;
|
|
@@ -121,7 +120,7 @@ declare function StackTraceDisclosure({ trace, className }: {
|
|
|
121
120
|
declare function TestResultsPanel({ results }: {
|
|
122
121
|
results: AgentTestResultsModel;
|
|
123
122
|
}): React.JSX.Element;
|
|
124
|
-
declare function ArtifactPanel({ artifact, actions, renderLimits, children, className, ...props }: Omit<React.ComponentProps<
|
|
123
|
+
declare function ArtifactPanel({ artifact, actions, renderLimits, children, className, ...props }: Omit<React.ComponentProps<"div">, "children" | "title"> & {
|
|
125
124
|
artifact: AgentArtifactModel;
|
|
126
125
|
actions?: React.ReactNode;
|
|
127
126
|
renderLimits?: Partial<AgentArtifactRenderLimits>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact-panel.d.ts","sourceRoot":"","sources":["../../src/components/artifact-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"artifact-panel.d.ts","sourceRoot":"","sources":["../../src/components/artifact-panel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AA2C7C,MAAM,MAAM,sBAAsB,GAC9B,QAAQ,GACR,aAAa,GACb,iBAAiB,GACjB,aAAa,GACb,mBAAmB,CAAC;AAExB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,EAAE,IAAI,CAAC;IACf,QAAQ,EAAE,sBAAsB,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;CAM0B,CAAC;AAE5D,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,kBAAkB,sBAMnE;AAED,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,SAAS,GACT,UAAU,GACV,QAAQ,GACR,aAAa,GACb,mBAAmB,GACnB,UAAU,CAAC;AAEf,MAAM,MAAM,iBAAiB,GACzB,MAAM,GACN,MAAM,GACN,MAAM,GACN,UAAU,GACV,SAAS,GACT,cAAc,GACd,aAAa,GACb,QAAQ,CAAC;AAEb,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzE,MAAM,MAAM,aAAa,GAAG;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,iBAAiB,CAAC;IACx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CAAC,CAAC;IAClD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,qBA8BA;AAED,OAAO,EACL,aAAa,EACb,UAAU,EACV,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,gBAAgB,GACjB,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { AlertTriangleIcon, Code2Icon, FileTextIcon, GlobeIcon, TerminalIcon } from "lucide-react";
|
|
4
|
-
import { Artifact, ArtifactActions, ArtifactContent, ArtifactDescription, ArtifactHeader, ArtifactTitle, } from "./ai-elements/artifact.js";
|
|
5
3
|
import { CodeBlock } from "./ai-elements/code-block.js";
|
|
6
4
|
import { StackTrace, StackTraceContent, StackTraceError, StackTraceErrorMessage, StackTraceErrorType, StackTraceExpandButton, StackTraceFrames, StackTraceHeader, } from "./ai-elements/stack-trace.js";
|
|
7
5
|
import { Terminal, TerminalActions, TerminalContent, TerminalHeader, TerminalTitle, } from "./ai-elements/terminal.js";
|
|
@@ -24,15 +22,17 @@ export function getAgentRedactionText(redaction) {
|
|
|
24
22
|
return redaction.replacement ?? redaction.label ?? agentRedactionLabels[redaction.category];
|
|
25
23
|
}
|
|
26
24
|
const defaultCodeLanguage = "plaintext";
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
25
|
+
// Map the rich artifact kinds onto the design-system `artifact-preview`
|
|
26
|
+
// `[data-kind]` glyph vocabulary (doc/sheet/code/pdf/report); doc is the default.
|
|
27
|
+
const artifactPreviewKinds = {
|
|
28
|
+
code: "code",
|
|
29
|
+
custom: "doc",
|
|
30
|
+
diff: "code",
|
|
31
|
+
preview: "doc",
|
|
32
|
+
"stack-trace": "doc",
|
|
33
|
+
terminal: "code",
|
|
34
|
+
"test-results": "report",
|
|
35
|
+
text: "doc",
|
|
36
36
|
};
|
|
37
37
|
const artifactStatusLabels = {
|
|
38
38
|
complete: "Complete",
|
|
@@ -175,7 +175,6 @@ function ArtifactBody({ artifact, renderLimits, children, }) {
|
|
|
175
175
|
return (_jsx(FeedbackState, { status: "empty", title: "No artifact content", compact: true, className: "rounded-md border-0 bg-transparent" }));
|
|
176
176
|
}
|
|
177
177
|
function ArtifactPanel({ artifact, actions, renderLimits, children, className, ...props }) {
|
|
178
|
-
|
|
179
|
-
return (_jsxs(Artifact, { "data-slot": "artifact-panel", "data-artifact-kind": artifact.kind, "data-artifact-status": artifact.status, className: className, ...props, children: [_jsxs(ArtifactHeader, { children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-1", children: [_jsxs(ArtifactTitle, { className: "flex items-center gap-2", children: [_jsx(Icon, { className: "size-4 text-muted-foreground" }), _jsx("span", { className: "truncate", children: artifact.title }), artifact.status && (_jsx(Badge, { variant: "secondary", children: artifactStatusLabels[artifact.status] }))] }), (artifact.description || artifact.path) && (_jsx(ArtifactDescription, { children: artifact.description ?? artifact.path }))] }), actions && _jsx(ArtifactActions, { children: actions })] }), _jsx(ArtifactContent, { children: _jsx(ArtifactBody, { artifact: artifact, renderLimits: renderLimits, children: children }) })] }));
|
|
178
|
+
return (_jsxs("div", { "data-slot": "artifact-panel", "data-artifact-kind": artifact.kind, "data-artifact-status": artifact.status, "data-kind": artifactPreviewKinds[artifact.kind], className: cn("nc-artifact-preview", className), ...props, children: [_jsxs("div", { className: "nc-artifact-preview-header", children: [_jsx("span", { className: "nc-artifact-preview-title", children: artifact.title }), artifact.status && (_jsx(Badge, { variant: "secondary", children: artifactStatusLabels[artifact.status] })), _jsx("span", { className: "nc-artifact-preview-kind", children: artifact.kind }), actions && _jsx("div", { className: "ml-2 flex items-center gap-1", children: actions })] }), _jsxs("div", { className: "nc-artifact-preview-body", children: [(artifact.description || artifact.path) && (_jsx("div", { "data-slot": "artifact-panel-subtitle", className: "mb-2 text-muted-foreground text-xs", children: artifact.description ?? artifact.path })), _jsx(ArtifactBody, { artifact: artifact, renderLimits: renderLimits, children: children })] })] }));
|
|
180
179
|
}
|
|
181
180
|
export { ArtifactPanel, DiffViewer, PreviewPane, RedactedNotice, StackTraceDisclosure, TerminalPanel, TestResultsPanel, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
import { Button } from "./button";
|
|
5
|
+
declare const attachmentVariants: (props?: ({
|
|
6
|
+
size?: "default" | "xs" | "sm" | null | undefined;
|
|
7
|
+
orientation?: "horizontal" | "vertical" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
declare function Attachment({ className, state, size, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentVariants> & {
|
|
10
|
+
state?: "idle" | "uploading" | "processing" | "error" | "done";
|
|
11
|
+
}): React.JSX.Element;
|
|
12
|
+
declare const attachmentMediaVariants: (props?: ({
|
|
13
|
+
variant?: "image" | "icon" | null | undefined;
|
|
14
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
15
|
+
declare function AttachmentMedia({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof attachmentMediaVariants>): React.JSX.Element;
|
|
16
|
+
declare function AttachmentContent({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
17
|
+
declare function AttachmentTitle({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
18
|
+
declare function AttachmentDescription({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
19
|
+
declare function AttachmentActions({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
20
|
+
declare function AttachmentAction({ className, variant, size, ...props }: React.ComponentProps<typeof Button>): React.JSX.Element;
|
|
21
|
+
declare function AttachmentTrigger({ className, render, type, ...props }: useRender.ComponentProps<"button">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
22
|
+
declare function AttachmentGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
23
|
+
export { Attachment, AttachmentGroup, AttachmentMedia, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentActions, AttachmentAction, AttachmentTrigger, };
|
|
24
|
+
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../src/components/attachment.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,QAAA,MAAM,kBAAkB;;;8EAgBvB,CAAC;AAEF,iBAAS,UAAU,CAAC,EAClB,SAAS,EACT,KAAc,EACd,IAAgB,EAChB,WAA0B,EAC1B,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAC5B,YAAY,CAAC,OAAO,kBAAkB,CAAC,GAAG;IACxC,KAAK,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,OAAO,GAAG,MAAM,CAAC;CAChE,qBAWF;AAED,QAAA,MAAM,uBAAuB;;8EAc5B,CAAC;AAEF,iBAAS,eAAe,CAAC,EACvB,SAAS,EACT,OAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,OAAO,uBAAuB,CAAC,qBAS5E;AAED,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW9E;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAW7E;AAED,iBAAS,qBAAqB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAYnF;AAED,iBAAS,iBAAiB,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW9E;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,OAAO,EACP,IAAgB,EAChB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,MAAM,CAAC,qBAUrC;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,MAAM,EACN,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,0EAepC;AAED,iBAAS,eAAe,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW5E;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
import { Button } from "./button.js";
|
|
7
|
+
const attachmentVariants = cva("group/attachment relative flex w-fit max-w-full min-w-0 shrink-0 flex-wrap rounded-xl border bg-card text-card-foreground transition-colors focus-within:ring-1 focus-within:ring-ring/50 has-[>a,>button]:hover:bg-muted/50 data-[state=error]:border-destructive/30 data-[state=idle]:border-dashed", {
|
|
8
|
+
variants: {
|
|
9
|
+
size: {
|
|
10
|
+
default: "gap-2 text-sm has-data-[slot=attachment-content]:px-2.5 has-data-[slot=attachment-content]:py-2 has-data-[slot=attachment-media]:p-2",
|
|
11
|
+
sm: "gap-2.5 text-xs has-data-[slot=attachment-content]:px-2 has-data-[slot=attachment-content]:py-1.5 has-data-[slot=attachment-media]:p-1.5",
|
|
12
|
+
xs: "gap-1.5 rounded-lg text-xs has-data-[slot=attachment-content]:px-1.5 has-data-[slot=attachment-content]:py-1 has-data-[slot=attachment-media]:p-1",
|
|
13
|
+
},
|
|
14
|
+
orientation: {
|
|
15
|
+
horizontal: "min-w-40 items-center",
|
|
16
|
+
vertical: "w-24 flex-col has-data-[slot=attachment-content]:w-30",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
function Attachment({ className, state = "done", size = "default", orientation = "horizontal", ...props }) {
|
|
21
|
+
return (_jsx("div", { "data-slot": "attachment", "data-state": state, "data-size": size, "data-orientation": orientation, className: cn(attachmentVariants({ size, orientation }), className), ...props }));
|
|
22
|
+
}
|
|
23
|
+
const attachmentMediaVariants = cva("relative flex aspect-square w-10 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted text-foreground group-data-[orientation=vertical]/attachment:w-full group-data-[size=sm]/attachment:w-8 group-data-[size=xs]/attachment:w-7 group-data-[size=xs]/attachment:rounded-md group-data-[state=error]/attachment:bg-destructive/10 group-data-[state=error]/attachment:text-destructive group-data-[orientation=vertical]/attachment:*:data-[slot=spinner]:size-6! [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 group-data-[orientation=vertical]/attachment:[&_svg:not([class*='size-'])]:size-6 group-data-[size=xs]/attachment:[&_svg:not([class*='size-'])]:size-3.5", {
|
|
24
|
+
variants: {
|
|
25
|
+
variant: {
|
|
26
|
+
icon: "",
|
|
27
|
+
image: "opacity-60 group-data-[state=done]/attachment:opacity-100 group-data-[state=idle]/attachment:opacity-100 *:[img]:aspect-square *:[img]:w-full *:[img]:object-cover",
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
variant: "icon",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
function AttachmentMedia({ className, variant = "icon", ...props }) {
|
|
35
|
+
return (_jsx("div", { "data-slot": "attachment-media", "data-variant": variant, className: cn(attachmentMediaVariants({ variant }), className), ...props }));
|
|
36
|
+
}
|
|
37
|
+
function AttachmentContent({ className, ...props }) {
|
|
38
|
+
return (_jsx("div", { "data-slot": "attachment-content", className: cn("max-w-full min-w-0 flex-1 leading-tight group-data-[orientation=vertical]/attachment:px-1", className), ...props }));
|
|
39
|
+
}
|
|
40
|
+
function AttachmentTitle({ className, ...props }) {
|
|
41
|
+
return (_jsx("span", { "data-slot": "attachment-title", className: cn("block max-w-full min-w-0 truncate font-medium group-data-[state=processing]/attachment:shimmer group-data-[state=uploading]/attachment:shimmer", className), ...props }));
|
|
42
|
+
}
|
|
43
|
+
function AttachmentDescription({ className, ...props }) {
|
|
44
|
+
return (_jsx("span", { "data-slot": "attachment-description", className: cn("mt-0.5 block min-w-0 truncate text-xs text-muted-foreground group-data-[state=error]/attachment:text-destructive/80", "max-w-full", className), ...props }));
|
|
45
|
+
}
|
|
46
|
+
function AttachmentActions({ className, ...props }) {
|
|
47
|
+
return (_jsx("div", { "data-slot": "attachment-actions", className: cn("relative z-20 flex shrink-0 items-center group-data-[orientation=vertical]/attachment:absolute group-data-[orientation=vertical]/attachment:top-3 group-data-[orientation=vertical]/attachment:right-3 group-data-[orientation=vertical]/attachment:gap-1", className), ...props }));
|
|
48
|
+
}
|
|
49
|
+
function AttachmentAction({ className, variant, size = "icon-xs", ...props }) {
|
|
50
|
+
return (_jsx(Button, { "data-slot": "attachment-action", variant: variant ?? "ghost", size: size, className: cn(className), ...props }));
|
|
51
|
+
}
|
|
52
|
+
function AttachmentTrigger({ className, render, type, ...props }) {
|
|
53
|
+
return useRender({
|
|
54
|
+
defaultTagName: "button",
|
|
55
|
+
props: mergeProps({
|
|
56
|
+
type: type ?? "button",
|
|
57
|
+
className: cn("absolute inset-0 z-10 outline-none", className),
|
|
58
|
+
}, props),
|
|
59
|
+
render,
|
|
60
|
+
state: {
|
|
61
|
+
slot: "attachment-trigger",
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function AttachmentGroup({ className, ...props }) {
|
|
66
|
+
return (_jsx("div", { "data-slot": "attachment-group", className: cn("flex min-w-0 scroll-fade-x snap-x snap-mandatory scroll-px-1 no-scrollbar gap-3 overflow-x-auto overscroll-x-contain py-1 *:data-[slot=attachment]:flex-none *:data-[slot=attachment]:snap-start", className), ...props }));
|
|
67
|
+
}
|
|
68
|
+
export { Attachment, AttachmentGroup, AttachmentMedia, AttachmentContent, AttachmentTitle, AttachmentDescription, AttachmentActions, AttachmentAction, AttachmentTrigger, };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3
|
+
import { type VariantProps } from "class-variance-authority";
|
|
4
|
+
declare function BubbleGroup({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
|
|
5
|
+
declare const bubbleVariants: (props?: ({
|
|
6
|
+
variant?: "default" | "secondary" | "destructive" | "outline" | "ghost" | "muted" | "tinted" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
declare function Bubble({ variant, align, className, ...props }: React.ComponentProps<"div"> & VariantProps<typeof bubbleVariants> & {
|
|
9
|
+
align?: "start" | "end";
|
|
10
|
+
}): React.JSX.Element;
|
|
11
|
+
declare function BubbleContent({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
12
|
+
declare function BubbleReactions({ side, align, className, ...props }: React.ComponentProps<"div"> & {
|
|
13
|
+
align?: "start" | "end";
|
|
14
|
+
side?: "top" | "bottom";
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
export { BubbleGroup, Bubble, BubbleContent, BubbleReactions };
|
|
17
|
+
//# sourceMappingURL=bubble.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bubble.d.ts","sourceRoot":"","sources":["../../src/components/bubble.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAIlE,iBAAS,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAQxE;AAED,QAAA,MAAM,cAAc;;8EAyBnB,CAAC;AAEF,iBAAS,MAAM,CAAC,EACd,OAAmB,EACnB,KAAe,EACf,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAC5B,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;CACzB,qBAUF;AAED,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,CAAC,cAAc,CAAC,KAAK,CAAC,0EAiBtF;AAsBD,iBAAS,eAAe,CAAC,EACvB,IAAe,EACf,KAAa,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,KAAK,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IACxB,IAAI,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CACzB,qBAUA;AAED,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { mergeProps } from "@base-ui/react/merge-props";
|
|
3
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
|
+
function BubbleGroup({ className, ...props }) {
|
|
7
|
+
return (_jsx("div", { "data-slot": "bubble-group", className: cn("flex min-w-0 flex-col gap-2", className), ...props }));
|
|
8
|
+
}
|
|
9
|
+
const bubbleVariants = cva("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full", {
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
default: "*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary-hover",
|
|
13
|
+
secondary: "*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-secondary/80",
|
|
14
|
+
muted: "*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/80",
|
|
15
|
+
tinted: "*:data-[slot=bubble-content]:bg-accent *:data-[slot=bubble-content]:text-accent-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-accent/80",
|
|
16
|
+
outline: "*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground",
|
|
17
|
+
ghost: "border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground",
|
|
18
|
+
destructive: "*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20",
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: {
|
|
22
|
+
variant: "default",
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
function Bubble({ variant = "default", align = "start", className, ...props }) {
|
|
26
|
+
return (_jsx("div", { "data-slot": "bubble", "data-variant": variant, "data-align": align, className: cn(bubbleVariants({ variant }), className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
function BubbleContent({ className, render, ...props }) {
|
|
29
|
+
return useRender({
|
|
30
|
+
defaultTagName: "div",
|
|
31
|
+
props: mergeProps({
|
|
32
|
+
className: cn("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50", className),
|
|
33
|
+
}, props),
|
|
34
|
+
render,
|
|
35
|
+
state: {
|
|
36
|
+
slot: "bubble-content",
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
const bubbleReactionsVariants = cva("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0", {
|
|
41
|
+
variants: {
|
|
42
|
+
side: {
|
|
43
|
+
top: "top-0 -translate-y-3/4",
|
|
44
|
+
bottom: "bottom-0 translate-y-3/4",
|
|
45
|
+
},
|
|
46
|
+
align: {
|
|
47
|
+
start: "left-3",
|
|
48
|
+
end: "right-3",
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
defaultVariants: {
|
|
52
|
+
side: "bottom",
|
|
53
|
+
align: "end",
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
function BubbleReactions({ side = "bottom", align = "end", className, ...props }) {
|
|
57
|
+
return (_jsx("div", { "data-slot": "bubble-reactions", "data-align": align, "data-side": side, className: cn(bubbleReactionsVariants({ side, align }), className), ...props }));
|
|
58
|
+
}
|
|
59
|
+
export { BubbleGroup, Bubble, BubbleContent, BubbleReactions };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
interface ConfirmDialogProps {
|
|
3
|
+
open: boolean;
|
|
4
|
+
onConfirm: () => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
title: React.ReactNode;
|
|
7
|
+
description?: React.ReactNode;
|
|
8
|
+
confirmLabel?: React.ReactNode;
|
|
9
|
+
cancelLabel?: React.ReactNode;
|
|
10
|
+
destructive?: boolean;
|
|
11
|
+
loading?: boolean;
|
|
12
|
+
}
|
|
13
|
+
declare function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel, cancelLabel, destructive, loading, }: ConfirmDialogProps): React.JSX.Element;
|
|
14
|
+
export { ConfirmDialog };
|
|
15
|
+
export type { ConfirmDialogProps };
|
|
16
|
+
//# sourceMappingURL=confirm-dialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm-dialog.d.ts","sourceRoot":"","sources":["../../src/components/confirm-dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAapC,UAAU,kBAAkB;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAOD,iBAAS,aAAa,CAAC,EACrB,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,KAAK,EACL,WAAW,EACX,YAAwB,EACxB,WAAsB,EACtB,WAAmB,EACnB,OAAe,GAChB,EAAE,kBAAkB,qBA+BpB;AAED,OAAO,EAAE,aAAa,EAAE,CAAC;AACzB,YAAY,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AlertDialog, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "./alert-dialog.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { Spinner } from "./spinner.js";
|
|
6
|
+
// Fully controlled confirm dialog over the registry AlertDialog parts. The
|
|
7
|
+
// confirm action is a plain Button (not AlertDialogAction) so a failed confirm
|
|
8
|
+
// can keep the dialog open; the only closing gesture is Escape (alert dialogs
|
|
9
|
+
// take no backdrop dismissal), which routes through onCancel, and loading
|
|
10
|
+
// disables both buttons while the action runs.
|
|
11
|
+
function ConfirmDialog({ open, onConfirm, onCancel, title, description, confirmLabel = "Confirm", cancelLabel = "Cancel", destructive = false, loading = false, }) {
|
|
12
|
+
return (_jsx(AlertDialog, { open: open, onOpenChange: (nextOpen) => {
|
|
13
|
+
if (!nextOpen) {
|
|
14
|
+
onCancel();
|
|
15
|
+
}
|
|
16
|
+
}, children: _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: title }), description ? _jsx(AlertDialogDescription, { children: description }) : null] }), _jsxs(AlertDialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: onCancel, disabled: loading, children: cancelLabel }), _jsxs(Button, { variant: destructive ? "destructive" : "default", onClick: onConfirm, disabled: loading, children: [loading ? _jsx(Spinner, {}) : null, confirmLabel] })] })] }) }));
|
|
17
|
+
}
|
|
18
|
+
export { ConfirmDialog };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface DiffCountProps extends React.ComponentProps<"span"> {
|
|
2
|
+
added: number;
|
|
3
|
+
removed: number;
|
|
4
|
+
}
|
|
5
|
+
declare function DiffCount({ added, removed, className, ...props }: DiffCountProps): import("react").JSX.Element | null;
|
|
6
|
+
export { DiffCount };
|
|
7
|
+
//# sourceMappingURL=diff-count.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"diff-count.d.ts","sourceRoot":"","sources":["../../src/components/diff-count.tsx"],"names":[],"mappings":"AAgBA,UAAU,cAAe,SAAQ,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;IAC3D,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,iBAAS,SAAS,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,cAAc,sCAoBzE;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|