@codrstudio/openclaude-chat 0.1.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.
Files changed (171) hide show
  1. package/dist/components/Chat.d.ts +23 -0
  2. package/dist/components/Chat.js +12 -0
  3. package/dist/components/ErrorNote.d.ts +6 -0
  4. package/dist/components/ErrorNote.js +6 -0
  5. package/dist/components/LazyRender.d.ts +8 -0
  6. package/dist/components/LazyRender.js +22 -0
  7. package/dist/components/Markdown.d.ts +5 -0
  8. package/dist/components/Markdown.js +65 -0
  9. package/dist/components/MessageBubble.d.ts +9 -0
  10. package/dist/components/MessageBubble.js +45 -0
  11. package/dist/components/MessageInput.d.ts +19 -0
  12. package/dist/components/MessageInput.js +214 -0
  13. package/dist/components/MessageList.d.ts +13 -0
  14. package/dist/components/MessageList.js +72 -0
  15. package/dist/components/StreamingIndicator.d.ts +1 -0
  16. package/dist/components/StreamingIndicator.js +9 -0
  17. package/dist/display/AlertRenderer.d.ts +2 -0
  18. package/dist/display/AlertRenderer.js +13 -0
  19. package/dist/display/CarouselRenderer.d.ts +2 -0
  20. package/dist/display/CarouselRenderer.js +41 -0
  21. package/dist/display/ChartRenderer.d.ts +2 -0
  22. package/dist/display/ChartRenderer.js +76 -0
  23. package/dist/display/ChoiceButtonsRenderer.d.ts +6 -0
  24. package/dist/display/ChoiceButtonsRenderer.js +23 -0
  25. package/dist/display/CodeBlockRenderer.d.ts +2 -0
  26. package/dist/display/CodeBlockRenderer.js +17 -0
  27. package/dist/display/ComparisonTableRenderer.d.ts +2 -0
  28. package/dist/display/ComparisonTableRenderer.js +26 -0
  29. package/dist/display/DataTableRenderer.d.ts +2 -0
  30. package/dist/display/DataTableRenderer.js +74 -0
  31. package/dist/display/DisplayReactRenderer.d.ts +26 -0
  32. package/dist/display/DisplayReactRenderer.js +192 -0
  33. package/dist/display/FileCardRenderer.d.ts +2 -0
  34. package/dist/display/FileCardRenderer.js +31 -0
  35. package/dist/display/GalleryRenderer.d.ts +2 -0
  36. package/dist/display/GalleryRenderer.js +11 -0
  37. package/dist/display/ImageViewerRenderer.d.ts +2 -0
  38. package/dist/display/ImageViewerRenderer.js +15 -0
  39. package/dist/display/LinkPreviewRenderer.d.ts +2 -0
  40. package/dist/display/LinkPreviewRenderer.js +20 -0
  41. package/dist/display/MapViewRenderer.d.ts +2 -0
  42. package/dist/display/MapViewRenderer.js +20 -0
  43. package/dist/display/MetricCardRenderer.d.ts +2 -0
  44. package/dist/display/MetricCardRenderer.js +12 -0
  45. package/dist/display/PriceHighlightRenderer.d.ts +2 -0
  46. package/dist/display/PriceHighlightRenderer.js +30 -0
  47. package/dist/display/ProductCardRenderer.d.ts +2 -0
  48. package/dist/display/ProductCardRenderer.js +23 -0
  49. package/dist/display/ProgressStepsRenderer.d.ts +2 -0
  50. package/dist/display/ProgressStepsRenderer.js +14 -0
  51. package/dist/display/SourcesListRenderer.d.ts +2 -0
  52. package/dist/display/SourcesListRenderer.js +5 -0
  53. package/dist/display/SpreadsheetRenderer.d.ts +2 -0
  54. package/dist/display/SpreadsheetRenderer.js +32 -0
  55. package/dist/display/StepTimelineRenderer.d.ts +2 -0
  56. package/dist/display/StepTimelineRenderer.js +21 -0
  57. package/dist/display/index.d.ts +21 -0
  58. package/dist/display/index.js +20 -0
  59. package/dist/display/react-sandbox/bootstrap.d.ts +1 -0
  60. package/dist/display/react-sandbox/bootstrap.js +154 -0
  61. package/dist/display/registry.d.ts +5 -0
  62. package/dist/display/registry.js +52 -0
  63. package/dist/display/sdk-types.d.ts +187 -0
  64. package/dist/display/sdk-types.js +4 -0
  65. package/dist/hooks/ChatProvider.d.ts +9 -0
  66. package/dist/hooks/ChatProvider.js +14 -0
  67. package/dist/hooks/useIsMobile.d.ts +1 -0
  68. package/dist/hooks/useIsMobile.js +12 -0
  69. package/dist/hooks/useOpenClaudeChat.d.ts +36 -0
  70. package/dist/hooks/useOpenClaudeChat.js +361 -0
  71. package/dist/index.d.ts +47 -0
  72. package/dist/index.js +42 -0
  73. package/dist/lib/utils.d.ts +2 -0
  74. package/dist/lib/utils.js +5 -0
  75. package/dist/parts/PartErrorBoundary.d.ts +21 -0
  76. package/dist/parts/PartErrorBoundary.js +27 -0
  77. package/dist/parts/PartRenderer.d.ts +8 -0
  78. package/dist/parts/PartRenderer.js +99 -0
  79. package/dist/parts/ReasoningBlock.d.ts +6 -0
  80. package/dist/parts/ReasoningBlock.js +18 -0
  81. package/dist/parts/ToolActivity.d.ts +11 -0
  82. package/dist/parts/ToolActivity.js +52 -0
  83. package/dist/parts/ToolResult.d.ts +7 -0
  84. package/dist/parts/ToolResult.js +38 -0
  85. package/dist/styles.css +2 -0
  86. package/dist/types.d.ts +40 -0
  87. package/dist/types.js +4 -0
  88. package/dist/ui/alert.d.ts +12 -0
  89. package/dist/ui/alert.js +28 -0
  90. package/dist/ui/badge.d.ts +9 -0
  91. package/dist/ui/badge.js +20 -0
  92. package/dist/ui/button.d.ts +11 -0
  93. package/dist/ui/button.js +31 -0
  94. package/dist/ui/card.d.ts +8 -0
  95. package/dist/ui/card.js +21 -0
  96. package/dist/ui/collapsible.d.ts +1 -0
  97. package/dist/ui/collapsible.js +2 -0
  98. package/dist/ui/dialog.d.ts +19 -0
  99. package/dist/ui/dialog.js +23 -0
  100. package/dist/ui/dropdown-menu.d.ts +11 -0
  101. package/dist/ui/dropdown-menu.js +15 -0
  102. package/dist/ui/input.d.ts +3 -0
  103. package/dist/ui/input.js +6 -0
  104. package/dist/ui/progress.d.ts +7 -0
  105. package/dist/ui/progress.js +9 -0
  106. package/dist/ui/scroll-area.d.ts +5 -0
  107. package/dist/ui/scroll-area.js +12 -0
  108. package/dist/ui/separator.d.ts +4 -0
  109. package/dist/ui/separator.js +8 -0
  110. package/dist/ui/skeleton.d.ts +3 -0
  111. package/dist/ui/skeleton.js +6 -0
  112. package/dist/ui/table.d.ts +10 -0
  113. package/dist/ui/table.js +27 -0
  114. package/package.json +61 -0
  115. package/src/components/Chat.tsx +107 -0
  116. package/src/components/ErrorNote.tsx +35 -0
  117. package/src/components/LazyRender.tsx +42 -0
  118. package/src/components/Markdown.tsx +114 -0
  119. package/src/components/MessageBubble.tsx +107 -0
  120. package/src/components/MessageInput.tsx +421 -0
  121. package/src/components/MessageList.tsx +153 -0
  122. package/src/components/StreamingIndicator.tsx +19 -0
  123. package/src/display/AlertRenderer.tsx +23 -0
  124. package/src/display/CarouselRenderer.tsx +141 -0
  125. package/src/display/ChartRenderer.tsx +195 -0
  126. package/src/display/ChoiceButtonsRenderer.tsx +114 -0
  127. package/src/display/CodeBlockRenderer.tsx +49 -0
  128. package/src/display/ComparisonTableRenderer.tsx +132 -0
  129. package/src/display/DataTableRenderer.tsx +144 -0
  130. package/src/display/DisplayReactRenderer.tsx +269 -0
  131. package/src/display/FileCardRenderer.tsx +55 -0
  132. package/src/display/GalleryRenderer.tsx +65 -0
  133. package/src/display/ImageViewerRenderer.tsx +114 -0
  134. package/src/display/LinkPreviewRenderer.tsx +74 -0
  135. package/src/display/MapViewRenderer.tsx +75 -0
  136. package/src/display/MetricCardRenderer.tsx +29 -0
  137. package/src/display/PriceHighlightRenderer.tsx +62 -0
  138. package/src/display/ProductCardRenderer.tsx +112 -0
  139. package/src/display/ProgressStepsRenderer.tsx +59 -0
  140. package/src/display/SourcesListRenderer.tsx +47 -0
  141. package/src/display/SpreadsheetRenderer.tsx +86 -0
  142. package/src/display/StepTimelineRenderer.tsx +75 -0
  143. package/src/display/index.ts +21 -0
  144. package/src/display/react-sandbox/bootstrap.ts +155 -0
  145. package/src/display/registry.ts +84 -0
  146. package/src/display/sdk-types.ts +217 -0
  147. package/src/hooks/ChatProvider.tsx +21 -0
  148. package/src/hooks/useIsMobile.ts +15 -0
  149. package/src/hooks/useOpenClaudeChat.ts +476 -0
  150. package/src/index.ts +76 -0
  151. package/src/lib/utils.ts +6 -0
  152. package/src/parts/PartErrorBoundary.tsx +51 -0
  153. package/src/parts/PartRenderer.tsx +145 -0
  154. package/src/parts/ReasoningBlock.tsx +41 -0
  155. package/src/parts/ToolActivity.tsx +78 -0
  156. package/src/parts/ToolResult.tsx +79 -0
  157. package/src/styles.css +2 -0
  158. package/src/types.ts +41 -0
  159. package/src/ui/alert.tsx +77 -0
  160. package/src/ui/badge.tsx +36 -0
  161. package/src/ui/button.tsx +54 -0
  162. package/src/ui/card.tsx +68 -0
  163. package/src/ui/collapsible.tsx +7 -0
  164. package/src/ui/dialog.tsx +122 -0
  165. package/src/ui/dropdown-menu.tsx +76 -0
  166. package/src/ui/input.tsx +24 -0
  167. package/src/ui/progress.tsx +36 -0
  168. package/src/ui/scroll-area.tsx +48 -0
  169. package/src/ui/separator.tsx +31 -0
  170. package/src/ui/skeleton.tsx +9 -0
  171. package/src/ui/table.tsx +114 -0
@@ -0,0 +1,99 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { memo, useState } from "react";
3
+ import { Paperclip, ChevronDown } from "lucide-react";
4
+ import { Markdown } from "../components/Markdown.js";
5
+ import { ReasoningBlock } from "./ReasoningBlock.js";
6
+ import { ToolActivity } from "./ToolActivity.js";
7
+ import { ToolResult } from "./ToolResult.js";
8
+ import { resolveDisplayRenderer } from "../display/registry.js";
9
+ import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "../ui/collapsible.js";
10
+ import { cn } from "../lib/utils.js";
11
+ const HEAVY_RENDERERS = new Set([
12
+ "chart", "map", "table",
13
+ "spreadsheet", "gallery", "image",
14
+ ]);
15
+ // ─── Attachment sub-components ────────────────────────────────────────────────
16
+ function AttachmentTextBlock({ filename, content }) {
17
+ const [open, setOpen] = useState(false);
18
+ const lines = content.split("\n");
19
+ const preview = lines.slice(0, 3).join("\n") + (lines.length > 3 && !open ? "\n…" : "");
20
+ return (_jsxs(Collapsible, { open: open, onOpenChange: setOpen, className: "rounded-lg border text-xs overflow-hidden", children: [_jsxs("div", { className: "flex items-center gap-2 px-3 py-2 bg-muted/50 border-b", children: [_jsx(Paperclip, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }), _jsx("span", { className: "flex-1 truncate font-medium", children: filename }), _jsx(CollapsibleTrigger, { asChild: true, children: _jsx("button", { type: "button", className: "text-muted-foreground hover:text-foreground transition-colors", "aria-label": open ? "Recolher" : "Expandir", children: _jsx(ChevronDown, { className: cn("h-3.5 w-3.5 transition-transform", open && "rotate-180") }) }) })] }), _jsx("pre", { className: "px-3 py-2 text-muted-foreground whitespace-pre-wrap break-words", children: preview }), _jsx(CollapsibleContent, { children: _jsx("pre", { className: "px-3 py-2 max-h-40 overflow-auto whitespace-pre-wrap break-words border-t", children: content }) })] }));
21
+ }
22
+ // ─── Main renderer ────────────────────────────────────────────────────────────
23
+ export const PartRenderer = memo(function PartRenderer({ part, isStreaming, displayRenderers }) {
24
+ switch (part.type) {
25
+ case "text": {
26
+ const p = part;
27
+ if (p.text.startsWith("[📎")) {
28
+ const firstNewline = p.text.indexOf("\n");
29
+ const header = firstNewline >= 0 ? p.text.slice(0, firstNewline) : p.text;
30
+ const body = firstNewline >= 0 ? p.text.slice(firstNewline + 1) : "";
31
+ const match = header.match(/^\[📎\s+(.+?)\]?$/);
32
+ const filename = match?.[1] ?? header;
33
+ return _jsx(AttachmentTextBlock, { filename: filename, content: body });
34
+ }
35
+ return _jsx(Markdown, { children: p.text });
36
+ }
37
+ case "reasoning": {
38
+ const p = part;
39
+ return _jsx(ReasoningBlock, { content: p.reasoning, isStreaming: isStreaming });
40
+ }
41
+ case "tool-invocation": {
42
+ const { toolInvocation } = part;
43
+ // O openclaude-sdk entrega os display tools como meta-tools MCP com
44
+ // prefixo `mcp__display__display_*` (ex: mcp__display__display_highlight).
45
+ // O tipo especifico do widget vem no campo `action` do input/args
46
+ // (ex: {action: "metric", label: "...", value: "..."}).
47
+ //
48
+ // Alem disso aceitamos a forma "legada" direta `display_*` (compat).
49
+ const name = toolInvocation.toolName;
50
+ const isMcpDisplay = /^mcp__display__display_(highlight|collection|card|visual)$/.test(name);
51
+ const isLegacyDisplay = name.startsWith("display_");
52
+ const isDisplay = isMcpDisplay || isLegacyDisplay;
53
+ if (isDisplay) {
54
+ // IMPORTANTE: para display tools, o `args` (input) contem a definicao
55
+ // COMPLETA do widget. O `result` (tool_result) e apenas uma confirmacao
56
+ // minima (`{action: "metric"}`). Sempre preferimos args aqui.
57
+ const payload = toolInvocation.args;
58
+ // Para meta-tools MCP, a action vem no payload.
59
+ // Para display_* legado, a action e o sufixo do toolName.
60
+ const action = isMcpDisplay
61
+ ? payload?.action
62
+ : name.replace(/^display_/, "");
63
+ const Renderer = action ? resolveDisplayRenderer(action, displayRenderers) : null;
64
+ if (payload && Renderer && action) {
65
+ // Alguns campos complexos (ex: trend, data) podem chegar serializados
66
+ // como JSON string se o modelo nao souber passar objetos. Tentamos
67
+ // parsear string → objeto antes de spreadar no renderer.
68
+ const normalized = {};
69
+ for (const [k, v] of Object.entries(payload)) {
70
+ if (typeof v === "string" && (v.startsWith("{") || v.startsWith("["))) {
71
+ try {
72
+ normalized[k] = JSON.parse(v);
73
+ }
74
+ catch {
75
+ normalized[k] = v;
76
+ }
77
+ }
78
+ else {
79
+ normalized[k] = v;
80
+ }
81
+ }
82
+ // key by toolCallId so iframe-based renderers (DisplayReactRenderer)
83
+ // unmount/remount cleanly when a new tool_use block arrives.
84
+ const rendered = _jsx(Renderer, { ...normalized }, toolInvocation.toolCallId);
85
+ // NOTE: LazyRender via IntersectionObserver nao funciona bem dentro
86
+ // do virtualized MessageList (itens ficam position:absolute e o
87
+ // observer nao dispara consistente). Renderizamos direto.
88
+ return rendered;
89
+ }
90
+ }
91
+ if (toolInvocation.state === "result") {
92
+ return (_jsx(ToolResult, { toolName: toolInvocation.toolName, result: toolInvocation.result, isError: toolInvocation.isError }));
93
+ }
94
+ return (_jsx(ToolActivity, { toolName: toolInvocation.toolName, state: toolInvocation.state, args: toolInvocation.args }));
95
+ }
96
+ default:
97
+ return null;
98
+ }
99
+ });
@@ -0,0 +1,6 @@
1
+ export interface ReasoningBlockProps {
2
+ content: string;
3
+ isStreaming?: boolean;
4
+ className?: string;
5
+ }
6
+ export declare function ReasoningBlock({ content, isStreaming, className }: ReasoningBlockProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { Brain, ChevronDown, ChevronRight } from "lucide-react";
4
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
5
+ export function ReasoningBlock({ content, isStreaming = false, className }) {
6
+ const [expanded, setExpanded] = useState(isStreaming);
7
+ useEffect(() => {
8
+ if (isStreaming) {
9
+ setExpanded(true);
10
+ }
11
+ else {
12
+ setExpanded(false);
13
+ }
14
+ }, [isStreaming]);
15
+ return (_jsx(Collapsible, { open: expanded, onOpenChange: setExpanded, className: className, children: _jsxs("div", { className: "border border-border bg-muted/30 rounded-md text-sm overflow-hidden", children: [_jsxs(CollapsibleTrigger, { className: "flex items-center gap-2 px-3 py-2 w-full text-left font-medium text-muted-foreground hover:bg-muted/60 cursor-pointer", children: [_jsx(Brain, { className: "h-3.5 w-3.5", "aria-hidden": "true" }), _jsx("span", { className: "font-mono text-xs", children: "reasoning" }), expanded
16
+ ? _jsx(ChevronDown, { className: "h-3.5 w-3.5 ml-auto", "aria-hidden": "true" })
17
+ : _jsx(ChevronRight, { className: "h-3.5 w-3.5 ml-auto", "aria-hidden": "true" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "max-h-96 overflow-y-auto px-3 py-3 text-muted-foreground whitespace-pre-wrap break-words border-t border-border text-xs", children: content }) })] }) }));
18
+ }
@@ -0,0 +1,11 @@
1
+ import { type LucideIcon } from "lucide-react";
2
+ export type ToolActivityState = "call" | "partial-call" | "result";
3
+ export interface ToolActivityProps {
4
+ toolName: string;
5
+ state: ToolActivityState;
6
+ args?: Record<string, unknown>;
7
+ className?: string;
8
+ iconMap?: Partial<Record<string, LucideIcon>>;
9
+ }
10
+ export declare const defaultToolIconMap: Record<string, LucideIcon>;
11
+ export declare function ToolActivity({ toolName, state, args, className, iconMap }: ToolActivityProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,52 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check, Download, FileText, FilePlus, FolderSearch, Globe, Loader2, Pencil, Search, Terminal, Wrench } from "lucide-react";
3
+ import { cn } from "../lib/utils.js";
4
+ export const defaultToolIconMap = {
5
+ WebSearch: Globe,
6
+ Bash: Terminal,
7
+ Read: FileText,
8
+ Edit: Pencil,
9
+ Write: FilePlus,
10
+ Grep: Search,
11
+ Glob: FolderSearch,
12
+ WebFetch: Download,
13
+ ListDir: FolderSearch,
14
+ };
15
+ function formatToolName(name) {
16
+ return name
17
+ .replace(/_/g, " ")
18
+ .replace(/([a-z])([A-Z])/g, "$1 $2")
19
+ .replace(/\b\w/g, (c) => c.toUpperCase());
20
+ }
21
+ function resolveIcon(toolName, iconMap) {
22
+ return iconMap[toolName] ?? Wrench;
23
+ }
24
+ function formatArgs(toolName, args) {
25
+ if (!args)
26
+ return null;
27
+ if (toolName === "Bash" && args.command)
28
+ return String(args.command);
29
+ if (toolName === "Read" && args.path)
30
+ return String(args.path);
31
+ if (toolName === "Edit" && args.file_path)
32
+ return String(args.file_path);
33
+ if (toolName === "Write" && args.file_path)
34
+ return String(args.file_path);
35
+ if (toolName === "Grep" && args.pattern)
36
+ return String(args.pattern);
37
+ if (toolName === "Glob" && args.pattern)
38
+ return String(args.pattern);
39
+ if (toolName === "WebSearch" && args.query)
40
+ return String(args.query);
41
+ if (toolName === "ListDir" && args.path)
42
+ return String(args.path);
43
+ return null;
44
+ }
45
+ export function ToolActivity({ toolName, state, args, className, iconMap }) {
46
+ const mergedIconMap = iconMap ? { ...defaultToolIconMap, ...iconMap } : defaultToolIconMap;
47
+ const Icon = resolveIcon(toolName, mergedIconMap);
48
+ const isActive = state === "call" || state === "partial-call";
49
+ const displayName = formatToolName(toolName);
50
+ const argsPreview = formatArgs(toolName, args);
51
+ return (_jsxs("div", { className: cn("flex items-center gap-2 rounded-md border border-border bg-muted/40 px-3 py-2 text-sm", className), children: [_jsx("span", { className: "text-muted-foreground shrink-0", "aria-hidden": "true", children: _jsx(Icon, { size: 14 }) }), _jsx("span", { className: "font-medium font-mono text-foreground", children: displayName }), argsPreview && (_jsx("span", { className: "truncate text-xs text-muted-foreground font-mono max-w-[300px]", children: argsPreview })), _jsx("span", { className: "ml-auto text-muted-foreground", children: isActive ? (_jsx(Loader2, { size: 14, className: "animate-spin", "aria-label": "Executando..." })) : (_jsx(Check, { size: 14, "aria-label": "Concluido" })) })] }));
52
+ }
@@ -0,0 +1,7 @@
1
+ export interface ToolResultProps {
2
+ toolName: string;
3
+ result: unknown;
4
+ isError?: boolean;
5
+ className?: string;
6
+ }
7
+ export declare function ToolResult({ toolName, result, isError, className }: ToolResultProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { AlertCircle, CheckCircle, ChevronDown, ChevronRight } from "lucide-react";
3
+ import { useState } from "react";
4
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
5
+ import { cn } from "../lib/utils.js";
6
+ function serializeResult(result) {
7
+ try {
8
+ if (typeof result === "object" && result !== null && "value" in result) {
9
+ return String(result.value);
10
+ }
11
+ return JSON.stringify(result, null, 2);
12
+ }
13
+ catch {
14
+ return String(result);
15
+ }
16
+ }
17
+ function extractPreview(result) {
18
+ if (typeof result === "string")
19
+ return result.length > 120 ? result.slice(0, 120) + "..." : result;
20
+ if (typeof result === "object" && result !== null) {
21
+ const r = result;
22
+ if (typeof r.value === "string") {
23
+ const v = r.value;
24
+ return v.length > 120 ? v.slice(0, 120) + "..." : v;
25
+ }
26
+ }
27
+ return null;
28
+ }
29
+ export function ToolResult({ toolName, result, isError = false, className }) {
30
+ const [expanded, setExpanded] = useState(false);
31
+ const serialized = serializeResult(result);
32
+ const preview = extractPreview(result);
33
+ return (_jsx(Collapsible, { open: expanded, onOpenChange: setExpanded, className: className, children: _jsxs("div", { className: cn("rounded-md border text-sm overflow-hidden", isError
34
+ ? "border-destructive/40 bg-destructive/5"
35
+ : "border-border bg-muted/40"), children: [_jsxs(CollapsibleTrigger, { className: cn("flex items-center gap-2 w-full px-3 py-2 text-left font-medium hover:bg-muted/60 cursor-pointer"), "aria-expanded": expanded, children: [isError ? (_jsx(AlertCircle, { className: "h-3.5 w-3.5 shrink-0 text-destructive", "aria-hidden": "true" })) : (_jsx(CheckCircle, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground", "aria-hidden": "true" })), _jsx("span", { className: cn("font-mono text-xs", isError ? "text-destructive" : "text-foreground"), children: isError ? `${toolName} erro` : `${toolName} ok` }), !expanded && preview && (_jsx("span", { className: "truncate text-xs text-muted-foreground font-mono max-w-[400px] ml-1", children: preview })), expanded
36
+ ? _jsx(ChevronDown, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground ml-auto", "aria-hidden": "true" })
37
+ : _jsx(ChevronRight, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground ml-auto", "aria-hidden": "true" })] }), _jsx(CollapsibleContent, { children: _jsx("pre", { className: "max-h-80 overflow-y-auto p-3 font-mono text-xs whitespace-pre-wrap break-all bg-muted/30 border-t border-border", children: serialized }) })] }) }));
38
+ }
@@ -0,0 +1,2 @@
1
+ /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
2
+ @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-duration:initial}}}@layer utilities{.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.top-\[50\%\]{top:50%}.bottom-full{bottom:100%}.left-\[50\%\]{left:50%}.z-10{z-index:10}.z-30{z-index:30}.z-50{z-index:50}.ml-auto{margin-left:auto}.line-clamp-2{-webkit-line-clamp:2;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.table{display:table}.table-caption{display:table-caption}.table-cell{display:table-cell}.table-row{display:table-row}.aspect-square{aspect-ratio:1}.h-\[1px\]{height:1px}.h-full{height:100%}.h-px{height:1px}.max-h-\[80vh\]{max-height:80vh}.min-h-\[44px\]{min-height:44px}.min-h-\[56px\]{min-height:56px}.min-h-\[200px\]{min-height:200px}.min-h-svh{min-height:100svh}.w-\[1px\]{width:1px}.w-fit{width:fit-content}.w-full{width:100%}.w-px{width:1px}.max-w-\[80\%\]{max-width:80%}.max-w-\[120px\]{max-width:120px}.max-w-\[300px\]{max-width:300px}.max-w-\[400px\]{max-width:400px}.max-w-\[425px\]{max-width:425px}.max-w-full{max-width:100%}.min-w-\[8rem\]{min-width:8rem}.min-w-\[160px\]{min-width:160px}.flex-1{flex:1}.flex-\[0_0_80\%\]{flex:0 0 80%}.flex-shrink-0,.shrink-0{flex-shrink:0}.caption-bottom{caption-side:bottom}.border-collapse{border-collapse:collapse}.translate-x-\[-50\%\]{--tw-translate-x:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.translate-y-\[-50\%\]{--tw-translate-y:-50%;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[streaming-bounce_1\.2s_ease-in-out_infinite_0ms\]{animation:1.2s ease-in-out infinite streaming-bounce}.animate-\[streaming-bounce_1\.2s_ease-in-out_infinite_150ms\]{animation:1.2s ease-in-out .15s infinite streaming-bounce}.animate-\[streaming-bounce_1\.2s_ease-in-out_infinite_300ms\]{animation:1.2s ease-in-out .3s infinite streaming-bounce}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize-none{resize:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-row{flex-direction:row}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-end{align-items:flex-end}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.justify-start{justify-content:flex-start}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.rounded-\[inherit\]{border-radius:inherit}.rounded-\[min\(var\(--radius-md\)\,10px\)\]{border-radius:min(var(--radius-md), 10px)}.rounded-\[min\(var\(--radius-md\)\,12px\)\]{border-radius:min(var(--radius-md), 12px)}.rounded-full{border-radius:3.40282e38px}.border{border-style:var(--tw-border-style);border-width:1px}.border-0{border-style:var(--tw-border-style);border-width:0}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-\[3px\]{border-left-style:var(--tw-border-style);border-left-width:3px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-transparent{background-color:#0000}.bg-clip-padding{background-clip:padding-box}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-\[1px\]{padding:1px}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.align-middle{vertical-align:middle}.text-\[0\.8rem\]{font-size:.8rem}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-none{--tw-leading:1;line-height:1}.text-balance{text-wrap:balance}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-inherit{color:inherit}.uppercase{text-transform:uppercase}.italic{font-style:italic}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.underline-offset-4{text-underline-offset:4px}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.ring,.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-\[border-radius\]{transition-property:border-radius;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-\[margin-left\]{transition-property:margin-left;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-\[width\]{transition-property:width;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,ease);transition-duration:var(--tw-duration,0s)}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *),.group-hover\/bubble\:opacity-100:is(:where(.group\/bubble):hover *){opacity:1}}.group-has-\[\>svg\]\/alert\:col-start-2:is(:where(.group\/alert):has(>svg) *){grid-column-start:2}.file\:border-0::file-selector-button{border-style:var(--tw-border-style);border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}@media (hover:hover){.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-80:hover{opacity:.8}.hover\:opacity-100:hover{opacity:1}}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-1:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-3:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.active\:scale-\[0\.98\]:active{scale:.98}.active\:not-aria-\[haspopup\]\:translate-y-px:active:not([aria-haspopup]){--tw-translate-y:1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.has-data-\[slot\=alert-action\]\:relative:has([data-slot=alert-action]){position:relative}.has-\[\>svg\]\:grid-cols-\[auto_1fr\]:has(>svg){grid-template-columns:auto 1fr}.aria-invalid\:ring-3[aria-invalid=true]{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.\[\&_a\]\:underline a{text-decoration-line:underline}.\[\&_a\]\:underline-offset-3 a{text-underline-offset:3px}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\]\:border-b tr{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-style:var(--tw-border-style);border-width:0}:is(.\*\:\[svg\]\:row-span-2>*):is(svg){grid-row:span 2/span 2}:is(.\*\:\[svg\]\:text-current>*):is(svg){color:currentColor}.\[\&\>tr\]\:last\:border-b-0>tr:last-child{border-bottom-style:var(--tw-border-style);border-bottom-width:0}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-duration{syntax:"*";inherits:false}
@@ -0,0 +1,40 @@
1
+ export type TextPart = {
2
+ type: "text";
3
+ text: string;
4
+ };
5
+ export type ReasoningPart = {
6
+ type: "reasoning";
7
+ reasoning: string;
8
+ };
9
+ export type ToolInvocationState = "call" | "partial-call" | "result";
10
+ export type ToolInvocationPart = {
11
+ type: "tool-invocation";
12
+ toolInvocation: {
13
+ toolName: string;
14
+ toolCallId: string;
15
+ state: ToolInvocationState;
16
+ args?: Record<string, unknown>;
17
+ result?: unknown;
18
+ isError?: boolean;
19
+ };
20
+ };
21
+ export type ImageAttachmentPart = {
22
+ type: "image";
23
+ _ref?: string;
24
+ mimeType?: string;
25
+ };
26
+ export type FileAttachmentPart = {
27
+ type: "file";
28
+ _ref?: string;
29
+ mimeType?: string;
30
+ };
31
+ export type MessagePart = TextPart | ReasoningPart | ToolInvocationPart | ImageAttachmentPart | FileAttachmentPart | {
32
+ type: string;
33
+ };
34
+ export type MessageRole = "user" | "assistant";
35
+ export interface Message {
36
+ id: string;
37
+ role: MessageRole;
38
+ content: string;
39
+ parts: MessagePart[];
40
+ }
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ // Tipos locais usados pelo @codrstudio/openclaude-chat.
2
+ // Nao depende de @ai-sdk/react. Modelo inspirado nos "parts" do ai-sdk,
3
+ // mas alimentado a partir de SDKMessage do @codrstudio/openclaude-sdk.
4
+ export {};
@@ -0,0 +1,12 @@
1
+ import * as React from "react";
2
+ import { type VariantProps } from "class-variance-authority";
3
+ declare const alertVariants: (props?: {
4
+ variant?: "default" | "destructive";
5
+ } & import("class-variance-authority/types").ClassProp) => string;
6
+ declare function Alert({ className, variant, ...props }: React.ComponentProps<"div"> & VariantProps<typeof alertVariants>): import("react/jsx-runtime").JSX.Element;
7
+ declare function AlertTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
8
+ declare function AlertDescription({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
9
+ declare function AlertAction({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
10
+ export { Alert, AlertTitle, AlertDescription, AlertAction };
11
+ export type { VariantProps };
12
+ export { alertVariants };
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "../lib/utils.js";
4
+ const alertVariants = cva("group/alert relative grid w-full gap-0.5 rounded-lg border px-2.5 py-2 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-2 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg]:text-current *:[svg:not([class*='size-'])]:size-4", {
5
+ variants: {
6
+ variant: {
7
+ default: "bg-card text-card-foreground",
8
+ destructive: "bg-card text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current",
9
+ },
10
+ },
11
+ defaultVariants: {
12
+ variant: "default",
13
+ },
14
+ });
15
+ function Alert({ className, variant, ...props }) {
16
+ return (_jsx("div", { "data-slot": "alert", role: "alert", className: cn(alertVariants({ variant }), className), ...props }));
17
+ }
18
+ function AlertTitle({ className, ...props }) {
19
+ return (_jsx("div", { "data-slot": "alert-title", className: cn("font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground", className), ...props }));
20
+ }
21
+ function AlertDescription({ className, ...props }) {
22
+ return (_jsx("div", { "data-slot": "alert-description", className: cn("text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4", className), ...props }));
23
+ }
24
+ function AlertAction({ className, ...props }) {
25
+ return (_jsx("div", { "data-slot": "alert-action", className: cn("absolute top-2 right-2", className), ...props }));
26
+ }
27
+ export { Alert, AlertTitle, AlertDescription, AlertAction };
28
+ export { alertVariants };
@@ -0,0 +1,9 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import * as React from "react";
3
+ declare const badgeVariants: (props?: {
4
+ variant?: "default" | "destructive" | "secondary" | "outline";
5
+ } & import("class-variance-authority/types").ClassProp) => string;
6
+ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
7
+ }
8
+ declare function Badge({ className, variant, ...props }: BadgeProps): import("react/jsx-runtime").JSX.Element;
9
+ export { Badge, badgeVariants };
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { cn } from "../lib/utils";
4
+ const badgeVariants = cva("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", {
5
+ variants: {
6
+ variant: {
7
+ default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
8
+ secondary: "border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
9
+ destructive: "border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",
10
+ outline: "text-foreground",
11
+ },
12
+ },
13
+ defaultVariants: {
14
+ variant: "default",
15
+ },
16
+ });
17
+ function Badge({ className, variant, ...props }) {
18
+ return (_jsx("div", { className: cn(badgeVariants({ variant }), className), ...props }));
19
+ }
20
+ export { Badge, badgeVariants };
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from "class-variance-authority";
2
+ import * as React from "react";
3
+ declare const buttonVariants: (props?: {
4
+ variant?: "link" | "default" | "destructive" | "secondary" | "outline" | "ghost";
5
+ size?: "default" | "sm" | "lg" | "icon";
6
+ } & import("class-variance-authority/types").ClassProp) => string;
7
+ export interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
8
+ asChild?: boolean;
9
+ }
10
+ declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement>>;
11
+ export { Button, buttonVariants };
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import * as React from "react";
4
+ import { cn } from "../lib/utils";
5
+ const buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50", {
6
+ variants: {
7
+ variant: {
8
+ default: "bg-primary text-primary-foreground hover:bg-primary/90",
9
+ destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
10
+ outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
11
+ secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
12
+ ghost: "hover:bg-accent hover:text-accent-foreground",
13
+ link: "text-primary underline-offset-4 hover:underline",
14
+ },
15
+ size: {
16
+ default: "h-10 px-4 py-2",
17
+ sm: "h-9 rounded-md px-3",
18
+ lg: "h-11 rounded-md px-8",
19
+ icon: "h-10 w-10",
20
+ },
21
+ },
22
+ defaultVariants: {
23
+ variant: "default",
24
+ size: "default",
25
+ },
26
+ });
27
+ const Button = React.forwardRef(({ className, variant, size, asChild = false, ...props }, ref) => {
28
+ return (_jsx("button", { className: cn(buttonVariants({ variant, size, className })), ref: ref, ...props }));
29
+ });
30
+ Button.displayName = "Button";
31
+ export { Button, buttonVariants };
@@ -0,0 +1,8 @@
1
+ import * as React from "react";
2
+ declare function Card({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
3
+ declare function CardHeader({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
4
+ declare function CardTitle({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
5
+ declare function CardDescription({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
6
+ declare function CardContent({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
7
+ declare function CardFooter({ className, ...props }: React.ComponentProps<"div">): import("react/jsx-runtime").JSX.Element;
8
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from "../lib/utils";
3
+ function Card({ className, ...props }) {
4
+ return (_jsx("div", { "data-slot": "card", className: cn("rounded-xl border bg-card text-card-foreground shadow", className), ...props }));
5
+ }
6
+ function CardHeader({ className, ...props }) {
7
+ return (_jsx("div", { "data-slot": "card-header", className: cn("flex flex-col space-y-1.5 p-6", className), ...props }));
8
+ }
9
+ function CardTitle({ className, ...props }) {
10
+ return (_jsx("div", { "data-slot": "card-title", className: cn("font-semibold leading-none tracking-tight", className), ...props }));
11
+ }
12
+ function CardDescription({ className, ...props }) {
13
+ return (_jsx("div", { "data-slot": "card-description", className: cn("text-sm text-muted-foreground", className), ...props }));
14
+ }
15
+ function CardContent({ className, ...props }) {
16
+ return (_jsx("div", { "data-slot": "card-content", className: cn("p-6 pt-0", className), ...props }));
17
+ }
18
+ function CardFooter({ className, ...props }) {
19
+ return (_jsx("div", { "data-slot": "card-footer", className: cn("flex items-center p-6 pt-0", className), ...props }));
20
+ }
21
+ export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent };
@@ -0,0 +1 @@
1
+ export { Root as Collapsible, Trigger as CollapsibleTrigger, Content as CollapsibleContent, } from "@radix-ui/react-collapsible";
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ export { Root as Collapsible, Trigger as CollapsibleTrigger, Content as CollapsibleContent, } from "@radix-ui/react-collapsible";
@@ -0,0 +1,19 @@
1
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
2
+ import * as React from "react";
3
+ declare const Dialog: React.FC<DialogPrimitive.DialogProps>;
4
+ declare const DialogTrigger: React.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const DialogPortal: React.FC<DialogPrimitive.DialogPortalProps>;
6
+ declare const DialogClose: React.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & React.RefAttributes<HTMLButtonElement>>;
7
+ declare const DialogOverlay: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
8
+ declare const DialogContent: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
9
+ declare const DialogHeader: {
10
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
11
+ displayName: string;
12
+ };
13
+ declare const DialogFooter: {
14
+ ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
15
+ displayName: string;
16
+ };
17
+ declare const DialogTitle: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogTitleProps & React.RefAttributes<HTMLHeadingElement>, "ref"> & React.RefAttributes<HTMLHeadingElement>>;
18
+ declare const DialogDescription: React.ForwardRefExoticComponent<Omit<DialogPrimitive.DialogDescriptionProps & React.RefAttributes<HTMLParagraphElement>, "ref"> & React.RefAttributes<HTMLParagraphElement>>;
19
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as DialogPrimitive from "@radix-ui/react-dialog";
4
+ import { X } from "lucide-react";
5
+ import * as React from "react";
6
+ import { cn } from "../lib/utils";
7
+ const Dialog = DialogPrimitive.Root;
8
+ const DialogTrigger = DialogPrimitive.Trigger;
9
+ const DialogPortal = DialogPrimitive.Portal;
10
+ const DialogClose = DialogPrimitive.Close;
11
+ const DialogOverlay = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", className), ...props })));
12
+ DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
13
+ const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg", className), ...props, children: [children, _jsxs(DialogPrimitive.Close, { className: "absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] })));
14
+ DialogContent.displayName = DialogPrimitive.Content.displayName;
15
+ const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col space-y-1.5 text-center sm:text-left", className), ...props }));
16
+ DialogHeader.displayName = "DialogHeader";
17
+ const DialogFooter = ({ className, ...props }) => (_jsx("div", { className: cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className), ...props }));
18
+ DialogFooter.displayName = "DialogFooter";
19
+ const DialogTitle = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Title, { ref: ref, className: cn("text-lg font-semibold leading-none tracking-tight", className), ...props })));
20
+ DialogTitle.displayName = DialogPrimitive.Title.displayName;
21
+ const DialogDescription = React.forwardRef(({ className, ...props }, ref) => (_jsx(DialogPrimitive.Description, { ref: ref, className: cn("text-sm text-muted-foreground", className), ...props })));
22
+ DialogDescription.displayName = DialogPrimitive.Description.displayName;
23
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
@@ -0,0 +1,11 @@
1
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
2
+ import * as React from "react";
3
+ declare const DropdownMenu: React.FC<DropdownMenuPrimitive.DropdownMenuProps>;
4
+ declare const DropdownMenuTrigger: React.ForwardRefExoticComponent<DropdownMenuPrimitive.DropdownMenuTriggerProps & React.RefAttributes<HTMLButtonElement>>;
5
+ declare const DropdownMenuPortal: React.FC<DropdownMenuPrimitive.DropdownMenuPortalProps>;
6
+ declare const DropdownMenuContent: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
+ declare const DropdownMenuItem: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & {
8
+ inset?: boolean;
9
+ } & React.RefAttributes<HTMLDivElement>>;
10
+ declare const DropdownMenuSeparator: React.ForwardRefExoticComponent<Omit<DropdownMenuPrimitive.DropdownMenuSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
11
+ export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, };
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
4
+ import * as React from "react";
5
+ import { cn } from "../lib/utils";
6
+ const DropdownMenu = DropdownMenuPrimitive.Root;
7
+ const DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
8
+ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
9
+ const DropdownMenuContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (_jsx(DropdownMenuPortal, { children: _jsx(DropdownMenuPrimitive.Content, { ref: ref, sideOffset: sideOffset, className: cn("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md", "data-[state=open]:animate-in data-[state=closed]:animate-out", "data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95", "data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2", "data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2", className), ...props }) })));
10
+ DropdownMenuContent.displayName = DropdownMenuPrimitive.Content.displayName;
11
+ const DropdownMenuItem = React.forwardRef(({ className, inset, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Item, { ref: ref, className: cn("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors", "focus:bg-accent focus:text-accent-foreground", "data-[disabled]:pointer-events-none data-[disabled]:opacity-50", inset && "pl-8", className), ...props })));
12
+ DropdownMenuItem.displayName = DropdownMenuPrimitive.Item.displayName;
13
+ const DropdownMenuSeparator = React.forwardRef(({ className, ...props }, ref) => (_jsx(DropdownMenuPrimitive.Separator, { ref: ref, className: cn("-mx-1 my-1 h-px bg-muted", className), ...props })));
14
+ DropdownMenuSeparator.displayName = DropdownMenuPrimitive.Separator.displayName;
15
+ export { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuPortal, DropdownMenuSeparator, DropdownMenuTrigger, };
@@ -0,0 +1,3 @@
1
+ import * as React from "react";
2
+ declare const Input: React.ForwardRefExoticComponent<React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
3
+ export { Input };
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../lib/utils";
4
+ const Input = React.forwardRef(({ className, type, ...props }, ref) => (_jsx("input", { type: type, className: cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors", "file:border-0 file:bg-transparent file:text-sm file:font-medium", "placeholder:text-muted-foreground", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props })));
5
+ Input.displayName = "Input";
6
+ export { Input };
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ interface ProgressProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ value?: number;
4
+ max?: number;
5
+ }
6
+ declare const Progress: React.ForwardRefExoticComponent<ProgressProps & React.RefAttributes<HTMLDivElement>>;
7
+ export { Progress };
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import * as React from "react";
3
+ import { cn } from "../lib/utils.js";
4
+ const Progress = React.forwardRef(({ className, value = 0, max = 100, ...props }, ref) => {
5
+ const percentage = Math.min(Math.max((value / max) * 100, 0), 100);
6
+ return (_jsx("div", { ref: ref, role: "progressbar", "aria-valuenow": value, "aria-valuemin": 0, "aria-valuemax": max, className: cn("relative h-2 w-full overflow-hidden rounded-full bg-secondary", className), ...props, children: _jsx("div", { className: "h-full bg-primary transition-all", style: { width: `${percentage}%` } }) }));
7
+ });
8
+ Progress.displayName = "Progress";
9
+ export { Progress };
@@ -0,0 +1,5 @@
1
+ import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
2
+ import * as React from "react";
3
+ declare const ScrollArea: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
4
+ declare const ScrollBar: React.ForwardRefExoticComponent<Omit<ScrollAreaPrimitive.ScrollAreaScrollbarProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
+ export { ScrollArea, ScrollBar };