@openconsole/shadcn 0.2.5 → 0.2.7

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 (113) hide show
  1. package/components/index.ts +1 -2
  2. package/components/ui/accordion.tsx +66 -66
  3. package/components/ui/alert-dialog.tsx +196 -196
  4. package/components/ui/alert.tsx +66 -66
  5. package/components/ui/aspect-ratio.tsx +11 -11
  6. package/components/ui/avatar.tsx +53 -53
  7. package/components/ui/badge.tsx +46 -46
  8. package/components/ui/breadcrumb.tsx +109 -109
  9. package/components/ui/button-group.tsx +83 -83
  10. package/components/ui/button.tsx +60 -60
  11. package/components/ui/calendar.tsx +219 -219
  12. package/components/ui/card.tsx +92 -92
  13. package/components/ui/carousel.tsx +241 -241
  14. package/components/ui/chart.tsx +374 -374
  15. package/components/ui/checkbox.tsx +32 -32
  16. package/components/ui/collapsible.tsx +33 -33
  17. package/components/ui/command.tsx +184 -184
  18. package/components/ui/context-menu.tsx +252 -252
  19. package/components/ui/dialog.tsx +143 -143
  20. package/components/ui/direction.tsx +22 -22
  21. package/components/ui/drawer.tsx +135 -135
  22. package/components/ui/dropdown-menu.tsx +257 -257
  23. package/components/ui/empty.tsx +104 -104
  24. package/components/ui/field.tsx +248 -248
  25. package/components/ui/form.tsx +167 -167
  26. package/components/ui/hover-card.tsx +44 -44
  27. package/components/ui/index.ts +59 -59
  28. package/components/ui/input-group.tsx +170 -170
  29. package/components/ui/input-otp.tsx +77 -77
  30. package/components/ui/input.tsx +21 -21
  31. package/components/ui/item.tsx +193 -193
  32. package/components/ui/kbd.tsx +28 -28
  33. package/components/ui/label.tsx +24 -24
  34. package/components/ui/menubar.tsx +276 -276
  35. package/components/ui/native-select.tsx +62 -62
  36. package/components/ui/navigation-menu.tsx +168 -168
  37. package/components/ui/pagination.tsx +127 -127
  38. package/components/ui/popover.tsx +89 -89
  39. package/components/ui/progress.tsx +31 -31
  40. package/components/ui/radio-group.tsx +45 -45
  41. package/components/ui/resizable.tsx +53 -53
  42. package/components/ui/scroll-area.tsx +58 -58
  43. package/components/ui/select.tsx +187 -187
  44. package/components/ui/separator.tsx +28 -28
  45. package/components/ui/sheet.tsx +139 -139
  46. package/components/ui/sidebar.tsx +724 -724
  47. package/components/ui/skeleton.tsx +13 -13
  48. package/components/ui/slider.tsx +63 -63
  49. package/components/ui/sonner.tsx +40 -40
  50. package/components/ui/spinner.tsx +16 -16
  51. package/components/ui/switch.tsx +35 -35
  52. package/components/ui/table.tsx +116 -116
  53. package/components/ui/tabs.tsx +66 -66
  54. package/components/ui/textarea.tsx +18 -18
  55. package/components/ui/toggle-group.tsx +83 -83
  56. package/components/ui/toggle.tsx +47 -47
  57. package/components/ui/tooltip.tsx +61 -61
  58. package/hooks/index.ts +1 -1
  59. package/hooks/use-mobile.ts +19 -19
  60. package/index.ts +3 -3
  61. package/lib/index.ts +1 -1
  62. package/lib/utils.ts +6 -6
  63. package/package.json +1 -1
  64. package/styles.css +124 -124
  65. package/components/ai-elements/agent.tsx +0 -141
  66. package/components/ai-elements/artifact.tsx +0 -148
  67. package/components/ai-elements/attachments.tsx +0 -426
  68. package/components/ai-elements/audio-player.tsx +0 -231
  69. package/components/ai-elements/canvas.tsx +0 -26
  70. package/components/ai-elements/chain-of-thought.tsx +0 -222
  71. package/components/ai-elements/checkpoint.tsx +0 -71
  72. package/components/ai-elements/code-block.tsx +0 -562
  73. package/components/ai-elements/commit.tsx +0 -458
  74. package/components/ai-elements/confirmation.tsx +0 -174
  75. package/components/ai-elements/connection.tsx +0 -28
  76. package/components/ai-elements/context.tsx +0 -409
  77. package/components/ai-elements/controls.tsx +0 -18
  78. package/components/ai-elements/conversation.tsx +0 -168
  79. package/components/ai-elements/edge.tsx +0 -143
  80. package/components/ai-elements/environment-variables.tsx +0 -324
  81. package/components/ai-elements/file-tree.tsx +0 -304
  82. package/components/ai-elements/image.tsx +0 -24
  83. package/components/ai-elements/index.ts +0 -51
  84. package/components/ai-elements/inline-citation.tsx +0 -296
  85. package/components/ai-elements/jsx-preview.tsx +0 -310
  86. package/components/ai-elements/message.tsx +0 -360
  87. package/components/ai-elements/mic-selector.tsx +0 -375
  88. package/components/ai-elements/model-selector.tsx +0 -213
  89. package/components/ai-elements/node.tsx +0 -71
  90. package/components/ai-elements/open-in-chat.tsx +0 -370
  91. package/components/ai-elements/package-info.tsx +0 -239
  92. package/components/ai-elements/panel.tsx +0 -15
  93. package/components/ai-elements/persona.tsx +0 -306
  94. package/components/ai-elements/plan.tsx +0 -147
  95. package/components/ai-elements/prompt-input.tsx +0 -1463
  96. package/components/ai-elements/queue.tsx +0 -274
  97. package/components/ai-elements/reasoning.tsx +0 -228
  98. package/components/ai-elements/sandbox.tsx +0 -132
  99. package/components/ai-elements/schema-display.tsx +0 -471
  100. package/components/ai-elements/shimmer.tsx +0 -77
  101. package/components/ai-elements/snippet.tsx +0 -145
  102. package/components/ai-elements/sources.tsx +0 -77
  103. package/components/ai-elements/speech-input.tsx +0 -323
  104. package/components/ai-elements/stack-trace.tsx +0 -528
  105. package/components/ai-elements/suggestion.tsx +0 -57
  106. package/components/ai-elements/task.tsx +0 -87
  107. package/components/ai-elements/terminal.tsx +0 -273
  108. package/components/ai-elements/test-results.tsx +0 -496
  109. package/components/ai-elements/tool.tsx +0 -173
  110. package/components/ai-elements/toolbar.tsx +0 -16
  111. package/components/ai-elements/transcription.tsx +0 -125
  112. package/components/ai-elements/voice-selector.tsx +0 -524
  113. package/components/ai-elements/web-preview.tsx +0 -281
@@ -1,409 +0,0 @@
1
- "use client";
2
-
3
- import { Button } from "../ui/button";
4
- import {
5
- HoverCard,
6
- HoverCardContent,
7
- HoverCardTrigger,
8
- } from "../ui/hover-card";
9
- import { Progress } from "../ui/progress";
10
- import { cn } from "../../lib/utils";
11
- import type { LanguageModelUsage } from "ai";
12
- import type { ComponentProps } from "react";
13
- import { createContext, useContext, useMemo } from "react";
14
- import { getUsage } from "tokenlens";
15
-
16
- const PERCENT_MAX = 100;
17
- const ICON_RADIUS = 10;
18
- const ICON_VIEWBOX = 24;
19
- const ICON_CENTER = 12;
20
- const ICON_STROKE_WIDTH = 2;
21
-
22
- type ModelId = string;
23
-
24
- interface ContextSchema {
25
- usedTokens: number;
26
- maxTokens: number;
27
- usage?: LanguageModelUsage;
28
- modelId?: ModelId;
29
- }
30
-
31
- const ContextContext = createContext<ContextSchema | null>(null);
32
-
33
- const useContextValue = () => {
34
- const context = useContext(ContextContext);
35
-
36
- if (!context) {
37
- throw new Error("Context components must be used within Context");
38
- }
39
-
40
- return context;
41
- };
42
-
43
- export type ContextProps = ComponentProps<typeof HoverCard> & ContextSchema;
44
-
45
- export const Context = ({
46
- usedTokens,
47
- maxTokens,
48
- usage,
49
- modelId,
50
- ...props
51
- }: ContextProps) => {
52
- const contextValue = useMemo(
53
- () => ({ maxTokens, modelId, usage, usedTokens }),
54
- [maxTokens, modelId, usage, usedTokens]
55
- );
56
-
57
- return (
58
- <ContextContext.Provider value={contextValue}>
59
- <HoverCard closeDelay={0} openDelay={0} {...props} />
60
- </ContextContext.Provider>
61
- );
62
- };
63
-
64
- const ContextIcon = () => {
65
- const { usedTokens, maxTokens } = useContextValue();
66
- const circumference = 2 * Math.PI * ICON_RADIUS;
67
- const usedPercent = usedTokens / maxTokens;
68
- const dashOffset = circumference * (1 - usedPercent);
69
-
70
- return (
71
- <svg
72
- aria-label="Model context usage"
73
- height="20"
74
- role="img"
75
- style={{ color: "currentcolor" }}
76
- viewBox={`0 0 ${ICON_VIEWBOX} ${ICON_VIEWBOX}`}
77
- width="20"
78
- >
79
- <circle
80
- cx={ICON_CENTER}
81
- cy={ICON_CENTER}
82
- fill="none"
83
- opacity="0.25"
84
- r={ICON_RADIUS}
85
- stroke="currentColor"
86
- strokeWidth={ICON_STROKE_WIDTH}
87
- />
88
- <circle
89
- cx={ICON_CENTER}
90
- cy={ICON_CENTER}
91
- fill="none"
92
- opacity="0.7"
93
- r={ICON_RADIUS}
94
- stroke="currentColor"
95
- strokeDasharray={`${circumference} ${circumference}`}
96
- strokeDashoffset={dashOffset}
97
- strokeLinecap="round"
98
- strokeWidth={ICON_STROKE_WIDTH}
99
- style={{ transform: "rotate(-90deg)", transformOrigin: "center" }}
100
- />
101
- </svg>
102
- );
103
- };
104
-
105
- export type ContextTriggerProps = ComponentProps<typeof Button>;
106
-
107
- export const ContextTrigger = ({ children, ...props }: ContextTriggerProps) => {
108
- const { usedTokens, maxTokens } = useContextValue();
109
- const usedPercent = usedTokens / maxTokens;
110
- const renderedPercent = new Intl.NumberFormat("en-US", {
111
- maximumFractionDigits: 1,
112
- style: "percent",
113
- }).format(usedPercent);
114
-
115
- return (
116
- <HoverCardTrigger asChild>
117
- {children ?? (
118
- <Button type="button" variant="ghost" {...props}>
119
- <span className="font-medium text-muted-foreground">
120
- {renderedPercent}
121
- </span>
122
- <ContextIcon />
123
- </Button>
124
- )}
125
- </HoverCardTrigger>
126
- );
127
- };
128
-
129
- export type ContextContentProps = ComponentProps<typeof HoverCardContent>;
130
-
131
- export const ContextContent = ({
132
- className,
133
- ...props
134
- }: ContextContentProps) => (
135
- <HoverCardContent
136
- className={cn("min-w-60 divide-y overflow-hidden p-0", className)}
137
- {...props}
138
- />
139
- );
140
-
141
- export type ContextContentHeaderProps = ComponentProps<"div">;
142
-
143
- export const ContextContentHeader = ({
144
- children,
145
- className,
146
- ...props
147
- }: ContextContentHeaderProps) => {
148
- const { usedTokens, maxTokens } = useContextValue();
149
- const usedPercent = usedTokens / maxTokens;
150
- const displayPct = new Intl.NumberFormat("en-US", {
151
- maximumFractionDigits: 1,
152
- style: "percent",
153
- }).format(usedPercent);
154
- const used = new Intl.NumberFormat("en-US", {
155
- notation: "compact",
156
- }).format(usedTokens);
157
- const total = new Intl.NumberFormat("en-US", {
158
- notation: "compact",
159
- }).format(maxTokens);
160
-
161
- return (
162
- <div className={cn("w-full space-y-2 p-3", className)} {...props}>
163
- {children ?? (
164
- <>
165
- <div className="flex items-center justify-between gap-3 text-xs">
166
- <p>{displayPct}</p>
167
- <p className="font-mono text-muted-foreground">
168
- {used} / {total}
169
- </p>
170
- </div>
171
- <div className="space-y-2">
172
- <Progress className="bg-muted" value={usedPercent * PERCENT_MAX} />
173
- </div>
174
- </>
175
- )}
176
- </div>
177
- );
178
- };
179
-
180
- export type ContextContentBodyProps = ComponentProps<"div">;
181
-
182
- export const ContextContentBody = ({
183
- children,
184
- className,
185
- ...props
186
- }: ContextContentBodyProps) => (
187
- <div className={cn("w-full p-3", className)} {...props}>
188
- {children}
189
- </div>
190
- );
191
-
192
- export type ContextContentFooterProps = ComponentProps<"div">;
193
-
194
- export const ContextContentFooter = ({
195
- children,
196
- className,
197
- ...props
198
- }: ContextContentFooterProps) => {
199
- const { modelId, usage } = useContextValue();
200
- const costUSD = modelId
201
- ? getUsage({
202
- modelId,
203
- usage: {
204
- input: usage?.inputTokens ?? 0,
205
- output: usage?.outputTokens ?? 0,
206
- },
207
- }).costUSD?.totalUSD
208
- : undefined;
209
- const totalCost = new Intl.NumberFormat("en-US", {
210
- currency: "USD",
211
- style: "currency",
212
- }).format(costUSD ?? 0);
213
-
214
- return (
215
- <div
216
- className={cn(
217
- "flex w-full items-center justify-between gap-3 bg-secondary p-3 text-xs",
218
- className
219
- )}
220
- {...props}
221
- >
222
- {children ?? (
223
- <>
224
- <span className="text-muted-foreground">Total cost</span>
225
- <span>{totalCost}</span>
226
- </>
227
- )}
228
- </div>
229
- );
230
- };
231
-
232
- const TokensWithCost = ({
233
- tokens,
234
- costText,
235
- }: {
236
- tokens?: number;
237
- costText?: string;
238
- }) => (
239
- <span>
240
- {tokens === undefined
241
- ? "—"
242
- : new Intl.NumberFormat("en-US", {
243
- notation: "compact",
244
- }).format(tokens)}
245
- {costText ? (
246
- <span className="ml-2 text-muted-foreground">• {costText}</span>
247
- ) : null}
248
- </span>
249
- );
250
-
251
- export type ContextInputUsageProps = ComponentProps<"div">;
252
-
253
- export const ContextInputUsage = ({
254
- className,
255
- children,
256
- ...props
257
- }: ContextInputUsageProps) => {
258
- const { usage, modelId } = useContextValue();
259
- const inputTokens = usage?.inputTokens ?? 0;
260
-
261
- if (children) {
262
- return children;
263
- }
264
-
265
- if (!inputTokens) {
266
- return null;
267
- }
268
-
269
- const inputCost = modelId
270
- ? getUsage({
271
- modelId,
272
- usage: { input: inputTokens, output: 0 },
273
- }).costUSD?.totalUSD
274
- : undefined;
275
- const inputCostText = new Intl.NumberFormat("en-US", {
276
- currency: "USD",
277
- style: "currency",
278
- }).format(inputCost ?? 0);
279
-
280
- return (
281
- <div
282
- className={cn("flex items-center justify-between text-xs", className)}
283
- {...props}
284
- >
285
- <span className="text-muted-foreground">Input</span>
286
- <TokensWithCost costText={inputCostText} tokens={inputTokens} />
287
- </div>
288
- );
289
- };
290
-
291
- export type ContextOutputUsageProps = ComponentProps<"div">;
292
-
293
- export const ContextOutputUsage = ({
294
- className,
295
- children,
296
- ...props
297
- }: ContextOutputUsageProps) => {
298
- const { usage, modelId } = useContextValue();
299
- const outputTokens = usage?.outputTokens ?? 0;
300
-
301
- if (children) {
302
- return children;
303
- }
304
-
305
- if (!outputTokens) {
306
- return null;
307
- }
308
-
309
- const outputCost = modelId
310
- ? getUsage({
311
- modelId,
312
- usage: { input: 0, output: outputTokens },
313
- }).costUSD?.totalUSD
314
- : undefined;
315
- const outputCostText = new Intl.NumberFormat("en-US", {
316
- currency: "USD",
317
- style: "currency",
318
- }).format(outputCost ?? 0);
319
-
320
- return (
321
- <div
322
- className={cn("flex items-center justify-between text-xs", className)}
323
- {...props}
324
- >
325
- <span className="text-muted-foreground">Output</span>
326
- <TokensWithCost costText={outputCostText} tokens={outputTokens} />
327
- </div>
328
- );
329
- };
330
-
331
- export type ContextReasoningUsageProps = ComponentProps<"div">;
332
-
333
- export const ContextReasoningUsage = ({
334
- className,
335
- children,
336
- ...props
337
- }: ContextReasoningUsageProps) => {
338
- const { usage, modelId } = useContextValue();
339
- const reasoningTokens = usage?.reasoningTokens ?? 0;
340
-
341
- if (children) {
342
- return children;
343
- }
344
-
345
- if (!reasoningTokens) {
346
- return null;
347
- }
348
-
349
- const reasoningCost = modelId
350
- ? getUsage({
351
- modelId,
352
- usage: { reasoningTokens },
353
- }).costUSD?.totalUSD
354
- : undefined;
355
- const reasoningCostText = new Intl.NumberFormat("en-US", {
356
- currency: "USD",
357
- style: "currency",
358
- }).format(reasoningCost ?? 0);
359
-
360
- return (
361
- <div
362
- className={cn("flex items-center justify-between text-xs", className)}
363
- {...props}
364
- >
365
- <span className="text-muted-foreground">Reasoning</span>
366
- <TokensWithCost costText={reasoningCostText} tokens={reasoningTokens} />
367
- </div>
368
- );
369
- };
370
-
371
- export type ContextCacheUsageProps = ComponentProps<"div">;
372
-
373
- export const ContextCacheUsage = ({
374
- className,
375
- children,
376
- ...props
377
- }: ContextCacheUsageProps) => {
378
- const { usage, modelId } = useContextValue();
379
- const cacheTokens = usage?.cachedInputTokens ?? 0;
380
-
381
- if (children) {
382
- return children;
383
- }
384
-
385
- if (!cacheTokens) {
386
- return null;
387
- }
388
-
389
- const cacheCost = modelId
390
- ? getUsage({
391
- modelId,
392
- usage: { cacheReads: cacheTokens, input: 0, output: 0 },
393
- }).costUSD?.totalUSD
394
- : undefined;
395
- const cacheCostText = new Intl.NumberFormat("en-US", {
396
- currency: "USD",
397
- style: "currency",
398
- }).format(cacheCost ?? 0);
399
-
400
- return (
401
- <div
402
- className={cn("flex items-center justify-between text-xs", className)}
403
- {...props}
404
- >
405
- <span className="text-muted-foreground">Cache</span>
406
- <TokensWithCost costText={cacheCostText} tokens={cacheTokens} />
407
- </div>
408
- );
409
- };
@@ -1,18 +0,0 @@
1
- "use client";
2
-
3
- import { cn } from "../../lib/utils";
4
- import { Controls as ControlsPrimitive } from "@xyflow/react";
5
- import type { ComponentProps } from "react";
6
-
7
- export type ControlsProps = ComponentProps<typeof ControlsPrimitive>;
8
-
9
- export const Controls = ({ className, ...props }: ControlsProps) => (
10
- <ControlsPrimitive
11
- className={cn(
12
- "gap-px overflow-hidden rounded-md border bg-card p-1 shadow-none!",
13
- "[&>button]:rounded-md [&>button]:border-none! [&>button]:bg-transparent! [&>button]:hover:bg-secondary!",
14
- className
15
- )}
16
- {...props}
17
- />
18
- );
@@ -1,168 +0,0 @@
1
- "use client";
2
-
3
- import { Button } from "../ui/button";
4
- import { cn } from "../../lib/utils";
5
- import type { UIMessage } from "ai";
6
- import { ArrowDownIcon, DownloadIcon } from "lucide-react";
7
- import type { ComponentProps } from "react";
8
- import { useCallback } from "react";
9
- import { StickToBottom, useStickToBottomContext } from "use-stick-to-bottom";
10
-
11
- export type ConversationProps = ComponentProps<typeof StickToBottom>;
12
-
13
- export const Conversation = ({ className, ...props }: ConversationProps) => (
14
- <StickToBottom
15
- className={cn("relative flex-1 overflow-y-hidden", className)}
16
- initial="smooth"
17
- resize="smooth"
18
- role="log"
19
- {...props}
20
- />
21
- );
22
-
23
- export type ConversationContentProps = ComponentProps<
24
- typeof StickToBottom.Content
25
- >;
26
-
27
- export const ConversationContent = ({
28
- className,
29
- ...props
30
- }: ConversationContentProps) => (
31
- <StickToBottom.Content
32
- className={cn("flex flex-col gap-8 p-4", className)}
33
- {...props}
34
- />
35
- );
36
-
37
- export type ConversationEmptyStateProps = ComponentProps<"div"> & {
38
- title?: string;
39
- description?: string;
40
- icon?: React.ReactNode;
41
- };
42
-
43
- export const ConversationEmptyState = ({
44
- className,
45
- title = "No messages yet",
46
- description = "Start a conversation to see messages here",
47
- icon,
48
- children,
49
- ...props
50
- }: ConversationEmptyStateProps) => (
51
- <div
52
- className={cn(
53
- "flex size-full flex-col items-center justify-center gap-3 p-8 text-center",
54
- className
55
- )}
56
- {...props}
57
- >
58
- {children ?? (
59
- <>
60
- {icon && <div className="text-muted-foreground">{icon}</div>}
61
- <div className="space-y-1">
62
- <h3 className="font-medium text-sm">{title}</h3>
63
- {description && (
64
- <p className="text-muted-foreground text-sm">{description}</p>
65
- )}
66
- </div>
67
- </>
68
- )}
69
- </div>
70
- );
71
-
72
- export type ConversationScrollButtonProps = ComponentProps<typeof Button>;
73
-
74
- export const ConversationScrollButton = ({
75
- className,
76
- ...props
77
- }: ConversationScrollButtonProps) => {
78
- const { isAtBottom, scrollToBottom } = useStickToBottomContext();
79
-
80
- const handleScrollToBottom = useCallback(() => {
81
- scrollToBottom();
82
- }, [scrollToBottom]);
83
-
84
- return (
85
- !isAtBottom && (
86
- <Button
87
- className={cn(
88
- "absolute bottom-4 left-[50%] translate-x-[-50%] rounded-full dark:bg-background dark:hover:bg-muted",
89
- className
90
- )}
91
- onClick={handleScrollToBottom}
92
- size="icon"
93
- type="button"
94
- variant="outline"
95
- {...props}
96
- >
97
- <ArrowDownIcon className="size-4" />
98
- </Button>
99
- )
100
- );
101
- };
102
-
103
- const getMessageText = (message: UIMessage): string =>
104
- message.parts
105
- .filter((part) => part.type === "text")
106
- .map((part) => part.text)
107
- .join("");
108
-
109
- export type ConversationDownloadProps = Omit<
110
- ComponentProps<typeof Button>,
111
- "onClick"
112
- > & {
113
- messages: UIMessage[];
114
- filename?: string;
115
- formatMessage?: (message: UIMessage, index: number) => string;
116
- };
117
-
118
- const defaultFormatMessage = (message: UIMessage): string => {
119
- const roleLabel =
120
- message.role.charAt(0).toUpperCase() + message.role.slice(1);
121
- return `**${roleLabel}:** ${getMessageText(message)}`;
122
- };
123
-
124
- export const messagesToMarkdown = (
125
- messages: UIMessage[],
126
- formatMessage: (
127
- message: UIMessage,
128
- index: number
129
- ) => string = defaultFormatMessage
130
- ): string => messages.map((msg, i) => formatMessage(msg, i)).join("\n\n");
131
-
132
- export const ConversationDownload = ({
133
- messages,
134
- filename = "conversation.md",
135
- formatMessage = defaultFormatMessage,
136
- className,
137
- children,
138
- ...props
139
- }: ConversationDownloadProps) => {
140
- const handleDownload = useCallback(() => {
141
- const markdown = messagesToMarkdown(messages, formatMessage);
142
- const blob = new Blob([markdown], { type: "text/markdown" });
143
- const url = URL.createObjectURL(blob);
144
- const link = document.createElement("a");
145
- link.href = url;
146
- link.download = filename;
147
- document.body.append(link);
148
- link.click();
149
- link.remove();
150
- URL.revokeObjectURL(url);
151
- }, [messages, filename, formatMessage]);
152
-
153
- return (
154
- <Button
155
- className={cn(
156
- "absolute top-4 right-4 rounded-full dark:bg-background dark:hover:bg-muted",
157
- className
158
- )}
159
- onClick={handleDownload}
160
- size="icon"
161
- type="button"
162
- variant="outline"
163
- {...props}
164
- >
165
- {children ?? <DownloadIcon className="size-4" />}
166
- </Button>
167
- );
168
- };