@openconsole/shadcn 0.2.6 → 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,273 +0,0 @@
1
- "use client";
2
-
3
- import { Button } from "../ui/button";
4
- import { cn } from "../../lib/utils";
5
- import Ansi from "ansi-to-react";
6
- import { CheckIcon, CopyIcon, TerminalIcon, Trash2Icon } from "lucide-react";
7
- import type { ComponentProps, HTMLAttributes } from "react";
8
- import {
9
- createContext,
10
- useCallback,
11
- useContext,
12
- useEffect,
13
- useMemo,
14
- useRef,
15
- useState,
16
- } from "react";
17
-
18
- interface TerminalContextType {
19
- output: string;
20
- isStreaming: boolean;
21
- autoScroll: boolean;
22
- onClear?: () => void;
23
- }
24
-
25
- const TerminalContext = createContext<TerminalContextType>({
26
- autoScroll: true,
27
- isStreaming: false,
28
- output: "",
29
- });
30
-
31
- export type TerminalHeaderProps = HTMLAttributes<HTMLDivElement>;
32
-
33
- export const TerminalHeader = ({
34
- className,
35
- children,
36
- ...props
37
- }: TerminalHeaderProps) => (
38
- <div
39
- className={cn(
40
- "flex items-center justify-between border-zinc-800 border-b px-4 py-2",
41
- className
42
- )}
43
- {...props}
44
- >
45
- {children}
46
- </div>
47
- );
48
-
49
- export type TerminalTitleProps = HTMLAttributes<HTMLDivElement>;
50
-
51
- export const TerminalTitle = ({
52
- className,
53
- children,
54
- ...props
55
- }: TerminalTitleProps) => (
56
- <div
57
- className={cn("flex items-center gap-2 text-sm text-zinc-400", className)}
58
- {...props}
59
- >
60
- <TerminalIcon className="size-4" />
61
- {children ?? "Terminal"}
62
- </div>
63
- );
64
-
65
- export type TerminalStatusProps = HTMLAttributes<HTMLDivElement>;
66
-
67
- export const TerminalStatus = ({
68
- className,
69
- children,
70
- ...props
71
- }: TerminalStatusProps) => {
72
- const { isStreaming } = useContext(TerminalContext);
73
-
74
- if (!isStreaming) {
75
- return null;
76
- }
77
-
78
- return (
79
- <div
80
- className={cn("flex items-center gap-2 text-xs text-zinc-400", className)}
81
- {...props}
82
- >
83
- {children}
84
- </div>
85
- );
86
- };
87
-
88
- export type TerminalActionsProps = HTMLAttributes<HTMLDivElement>;
89
-
90
- export const TerminalActions = ({
91
- className,
92
- children,
93
- ...props
94
- }: TerminalActionsProps) => (
95
- <div className={cn("flex items-center gap-1", className)} {...props}>
96
- {children}
97
- </div>
98
- );
99
-
100
- export type TerminalCopyButtonProps = ComponentProps<typeof Button> & {
101
- onCopy?: () => void;
102
- onError?: (error: Error) => void;
103
- timeout?: number;
104
- };
105
-
106
- export const TerminalCopyButton = ({
107
- onCopy,
108
- onError,
109
- timeout = 2000,
110
- children,
111
- className,
112
- ...props
113
- }: TerminalCopyButtonProps) => {
114
- const [isCopied, setIsCopied] = useState(false);
115
- const timeoutRef = useRef<number>(0);
116
- const { output } = useContext(TerminalContext);
117
-
118
- const copyToClipboard = useCallback(async () => {
119
- if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
120
- onError?.(new Error("Clipboard API not available"));
121
- return;
122
- }
123
-
124
- try {
125
- await navigator.clipboard.writeText(output);
126
- setIsCopied(true);
127
- onCopy?.();
128
- timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
129
- } catch (error) {
130
- onError?.(error as Error);
131
- }
132
- }, [output, onCopy, onError, timeout]);
133
-
134
- useEffect(
135
- () => () => {
136
- window.clearTimeout(timeoutRef.current);
137
- },
138
- []
139
- );
140
-
141
- const Icon = isCopied ? CheckIcon : CopyIcon;
142
-
143
- return (
144
- <Button
145
- className={cn(
146
- "size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",
147
- className
148
- )}
149
- onClick={copyToClipboard}
150
- size="icon"
151
- variant="ghost"
152
- {...props}
153
- >
154
- {children ?? <Icon size={14} />}
155
- </Button>
156
- );
157
- };
158
-
159
- export type TerminalClearButtonProps = ComponentProps<typeof Button>;
160
-
161
- export const TerminalClearButton = ({
162
- children,
163
- className,
164
- ...props
165
- }: TerminalClearButtonProps) => {
166
- const { onClear } = useContext(TerminalContext);
167
-
168
- if (!onClear) {
169
- return null;
170
- }
171
-
172
- return (
173
- <Button
174
- className={cn(
175
- "size-7 shrink-0 text-zinc-400 hover:bg-zinc-800 hover:text-zinc-100",
176
- className
177
- )}
178
- onClick={onClear}
179
- size="icon"
180
- variant="ghost"
181
- {...props}
182
- >
183
- {children ?? <Trash2Icon size={14} />}
184
- </Button>
185
- );
186
- };
187
-
188
- export type TerminalContentProps = HTMLAttributes<HTMLDivElement>;
189
-
190
- export const TerminalContent = ({
191
- className,
192
- children,
193
- ...props
194
- }: TerminalContentProps) => {
195
- const { output, isStreaming, autoScroll } = useContext(TerminalContext);
196
- const containerRef = useRef<HTMLDivElement>(null);
197
-
198
- useEffect(() => {
199
- if (autoScroll && containerRef.current) {
200
- containerRef.current.scrollTop = containerRef.current.scrollHeight;
201
- }
202
- }, [output, autoScroll]);
203
-
204
- return (
205
- <div
206
- className={cn(
207
- "max-h-96 overflow-auto p-4 font-mono text-sm leading-relaxed",
208
- className
209
- )}
210
- ref={containerRef}
211
- {...props}
212
- >
213
- {children ?? (
214
- <pre className="whitespace-pre-wrap break-words">
215
- <Ansi>{output}</Ansi>
216
- {isStreaming && (
217
- <span className="ml-0.5 inline-block h-4 w-2 animate-pulse bg-zinc-100" />
218
- )}
219
- </pre>
220
- )}
221
- </div>
222
- );
223
- };
224
-
225
- export type TerminalProps = HTMLAttributes<HTMLDivElement> & {
226
- output: string;
227
- isStreaming?: boolean;
228
- autoScroll?: boolean;
229
- onClear?: () => void;
230
- };
231
-
232
- export const Terminal = ({
233
- output,
234
- isStreaming = false,
235
- autoScroll = true,
236
- onClear,
237
- className,
238
- children,
239
- ...props
240
- }: TerminalProps) => {
241
- const contextValue = useMemo(
242
- () => ({ autoScroll, isStreaming, onClear, output }),
243
- [autoScroll, isStreaming, onClear, output]
244
- );
245
-
246
- return (
247
- <TerminalContext.Provider value={contextValue}>
248
- <div
249
- className={cn(
250
- "flex flex-col overflow-hidden rounded-lg border bg-zinc-950 text-zinc-100",
251
- className
252
- )}
253
- {...props}
254
- >
255
- {children ?? (
256
- <>
257
- <TerminalHeader>
258
- <TerminalTitle />
259
- <div className="flex items-center gap-1">
260
- <TerminalStatus />
261
- <TerminalActions>
262
- <TerminalCopyButton />
263
- {onClear && <TerminalClearButton />}
264
- </TerminalActions>
265
- </div>
266
- </TerminalHeader>
267
- <TerminalContent />
268
- </>
269
- )}
270
- </div>
271
- </TerminalContext.Provider>
272
- );
273
- };