@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,143 +0,0 @@
1
- import type { EdgeProps, InternalNode, Node } from "@xyflow/react";
2
- import {
3
- BaseEdge,
4
- getBezierPath,
5
- getSimpleBezierPath,
6
- Position,
7
- useInternalNode,
8
- } from "@xyflow/react";
9
-
10
- const Temporary = ({
11
- id,
12
- sourceX,
13
- sourceY,
14
- targetX,
15
- targetY,
16
- sourcePosition,
17
- targetPosition,
18
- }: EdgeProps) => {
19
- const [edgePath] = getSimpleBezierPath({
20
- sourcePosition,
21
- sourceX,
22
- sourceY,
23
- targetPosition,
24
- targetX,
25
- targetY,
26
- });
27
-
28
- return (
29
- <BaseEdge
30
- className="stroke-1 stroke-ring"
31
- id={id}
32
- path={edgePath}
33
- style={{
34
- strokeDasharray: "5, 5",
35
- }}
36
- />
37
- );
38
- };
39
-
40
- const getHandleCoordsByPosition = (
41
- node: InternalNode<Node>,
42
- handlePosition: Position
43
- ) => {
44
- // Choose the handle type based on position - Left is for target, Right is for source
45
- const handleType = handlePosition === Position.Left ? "target" : "source";
46
-
47
- const handle = node.internals.handleBounds?.[handleType]?.find(
48
- (h) => h.position === handlePosition
49
- );
50
-
51
- if (!handle) {
52
- return [0, 0] as const;
53
- }
54
-
55
- let offsetX = handle.width / 2;
56
- let offsetY = handle.height / 2;
57
-
58
- // this is a tiny detail to make the markerEnd of an edge visible.
59
- // The handle position that gets calculated has the origin top-left, so depending which side we are using, we add a little offset
60
- // when the handlePosition is Position.Right for example, we need to add an offset as big as the handle itself in order to get the correct position
61
- switch (handlePosition) {
62
- case Position.Left: {
63
- offsetX = 0;
64
- break;
65
- }
66
- case Position.Right: {
67
- offsetX = handle.width;
68
- break;
69
- }
70
- case Position.Top: {
71
- offsetY = 0;
72
- break;
73
- }
74
- case Position.Bottom: {
75
- offsetY = handle.height;
76
- break;
77
- }
78
- default: {
79
- throw new Error(`Invalid handle position: ${handlePosition}`);
80
- }
81
- }
82
-
83
- const x = node.internals.positionAbsolute.x + handle.x + offsetX;
84
- const y = node.internals.positionAbsolute.y + handle.y + offsetY;
85
-
86
- return [x, y] as const;
87
- };
88
-
89
- const getEdgeParams = (
90
- source: InternalNode<Node>,
91
- target: InternalNode<Node>
92
- ) => {
93
- const sourcePos = Position.Right;
94
- const [sx, sy] = getHandleCoordsByPosition(source, sourcePos);
95
- const targetPos = Position.Left;
96
- const [tx, ty] = getHandleCoordsByPosition(target, targetPos);
97
-
98
- return {
99
- sourcePos,
100
- sx,
101
- sy,
102
- targetPos,
103
- tx,
104
- ty,
105
- };
106
- };
107
-
108
- const Animated = ({ id, source, target, markerEnd, style }: EdgeProps) => {
109
- const sourceNode = useInternalNode(source);
110
- const targetNode = useInternalNode(target);
111
-
112
- if (!(sourceNode && targetNode)) {
113
- return null;
114
- }
115
-
116
- const { sx, sy, tx, ty, sourcePos, targetPos } = getEdgeParams(
117
- sourceNode,
118
- targetNode
119
- );
120
-
121
- const [edgePath] = getBezierPath({
122
- sourcePosition: sourcePos,
123
- sourceX: sx,
124
- sourceY: sy,
125
- targetPosition: targetPos,
126
- targetX: tx,
127
- targetY: ty,
128
- });
129
-
130
- return (
131
- <>
132
- <BaseEdge id={id} markerEnd={markerEnd} path={edgePath} style={style} />
133
- <circle fill="var(--primary)" r="4">
134
- <animateMotion dur="2s" path={edgePath} repeatCount="indefinite" />
135
- </circle>
136
- </>
137
- );
138
- };
139
-
140
- export const Edge = {
141
- Animated,
142
- Temporary,
143
- };
@@ -1,324 +0,0 @@
1
- "use client";
2
-
3
- import { Badge } from "../ui/badge";
4
- import { Button } from "../ui/button";
5
- import { Switch } from "../ui/switch";
6
- import { cn } from "../../lib/utils";
7
- import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "lucide-react";
8
- import type { ComponentProps, HTMLAttributes } from "react";
9
- import {
10
- createContext,
11
- useCallback,
12
- useContext,
13
- useEffect,
14
- useMemo,
15
- useRef,
16
- useState,
17
- } from "react";
18
-
19
- interface EnvironmentVariablesContextType {
20
- showValues: boolean;
21
- setShowValues: (show: boolean) => void;
22
- }
23
-
24
- // Default noop for context default value
25
- // oxlint-disable-next-line eslint(no-empty-function)
26
- const noop = () => {};
27
-
28
- const EnvironmentVariablesContext =
29
- createContext<EnvironmentVariablesContextType>({
30
- setShowValues: noop,
31
- showValues: false,
32
- });
33
-
34
- export type EnvironmentVariablesProps = HTMLAttributes<HTMLDivElement> & {
35
- showValues?: boolean;
36
- defaultShowValues?: boolean;
37
- onShowValuesChange?: (show: boolean) => void;
38
- };
39
-
40
- export const EnvironmentVariables = ({
41
- showValues: controlledShowValues,
42
- defaultShowValues = false,
43
- onShowValuesChange,
44
- className,
45
- children,
46
- ...props
47
- }: EnvironmentVariablesProps) => {
48
- const [internalShowValues, setInternalShowValues] =
49
- useState(defaultShowValues);
50
- const showValues = controlledShowValues ?? internalShowValues;
51
-
52
- const setShowValues = useCallback(
53
- (show: boolean) => {
54
- setInternalShowValues(show);
55
- onShowValuesChange?.(show);
56
- },
57
- [onShowValuesChange]
58
- );
59
-
60
- const contextValue = useMemo(
61
- () => ({ setShowValues, showValues }),
62
- [setShowValues, showValues]
63
- );
64
-
65
- return (
66
- <EnvironmentVariablesContext.Provider value={contextValue}>
67
- <div
68
- className={cn("rounded-lg border bg-background", className)}
69
- {...props}
70
- >
71
- {children}
72
- </div>
73
- </EnvironmentVariablesContext.Provider>
74
- );
75
- };
76
-
77
- export type EnvironmentVariablesHeaderProps = HTMLAttributes<HTMLDivElement>;
78
-
79
- export const EnvironmentVariablesHeader = ({
80
- className,
81
- children,
82
- ...props
83
- }: EnvironmentVariablesHeaderProps) => (
84
- <div
85
- className={cn(
86
- "flex items-center justify-between border-b px-4 py-3",
87
- className
88
- )}
89
- {...props}
90
- >
91
- {children}
92
- </div>
93
- );
94
-
95
- export type EnvironmentVariablesTitleProps = HTMLAttributes<HTMLHeadingElement>;
96
-
97
- export const EnvironmentVariablesTitle = ({
98
- className,
99
- children,
100
- ...props
101
- }: EnvironmentVariablesTitleProps) => (
102
- <h3 className={cn("font-medium text-sm", className)} {...props}>
103
- {children ?? "Environment Variables"}
104
- </h3>
105
- );
106
-
107
- export type EnvironmentVariablesToggleProps = ComponentProps<typeof Switch>;
108
-
109
- export const EnvironmentVariablesToggle = ({
110
- className,
111
- ...props
112
- }: EnvironmentVariablesToggleProps) => {
113
- const { showValues, setShowValues } = useContext(EnvironmentVariablesContext);
114
-
115
- return (
116
- <div className={cn("flex items-center gap-2", className)}>
117
- <span className="text-muted-foreground text-xs">
118
- {showValues ? <EyeIcon size={14} /> : <EyeOffIcon size={14} />}
119
- </span>
120
- <Switch
121
- aria-label="Toggle value visibility"
122
- checked={showValues}
123
- onCheckedChange={setShowValues}
124
- {...props}
125
- />
126
- </div>
127
- );
128
- };
129
-
130
- export type EnvironmentVariablesContentProps = HTMLAttributes<HTMLDivElement>;
131
-
132
- export const EnvironmentVariablesContent = ({
133
- className,
134
- children,
135
- ...props
136
- }: EnvironmentVariablesContentProps) => (
137
- <div className={cn("divide-y", className)} {...props}>
138
- {children}
139
- </div>
140
- );
141
-
142
- interface EnvironmentVariableContextType {
143
- name: string;
144
- value: string;
145
- }
146
-
147
- const EnvironmentVariableContext =
148
- createContext<EnvironmentVariableContextType>({
149
- name: "",
150
- value: "",
151
- });
152
-
153
- export type EnvironmentVariableGroupProps = HTMLAttributes<HTMLDivElement>;
154
-
155
- export const EnvironmentVariableGroup = ({
156
- className,
157
- children,
158
- ...props
159
- }: EnvironmentVariableGroupProps) => (
160
- <div className={cn("flex items-center gap-2", className)} {...props}>
161
- {children}
162
- </div>
163
- );
164
-
165
- export type EnvironmentVariableNameProps = HTMLAttributes<HTMLSpanElement>;
166
-
167
- export const EnvironmentVariableName = ({
168
- className,
169
- children,
170
- ...props
171
- }: EnvironmentVariableNameProps) => {
172
- const { name } = useContext(EnvironmentVariableContext);
173
-
174
- return (
175
- <span className={cn("font-mono text-sm", className)} {...props}>
176
- {children ?? name}
177
- </span>
178
- );
179
- };
180
-
181
- export type EnvironmentVariableValueProps = HTMLAttributes<HTMLSpanElement>;
182
-
183
- export const EnvironmentVariableValue = ({
184
- className,
185
- children,
186
- ...props
187
- }: EnvironmentVariableValueProps) => {
188
- const { value } = useContext(EnvironmentVariableContext);
189
- const { showValues } = useContext(EnvironmentVariablesContext);
190
-
191
- const displayValue = showValues
192
- ? value
193
- : "•".repeat(Math.min(value.length, 20));
194
-
195
- return (
196
- <span
197
- className={cn(
198
- "font-mono text-muted-foreground text-sm",
199
- !showValues && "select-none",
200
- className
201
- )}
202
- {...props}
203
- >
204
- {children ?? displayValue}
205
- </span>
206
- );
207
- };
208
-
209
- export type EnvironmentVariableProps = HTMLAttributes<HTMLDivElement> & {
210
- name: string;
211
- value: string;
212
- };
213
-
214
- export const EnvironmentVariable = ({
215
- name,
216
- value,
217
- className,
218
- children,
219
- ...props
220
- }: EnvironmentVariableProps) => {
221
- const envVarContextValue = useMemo(() => ({ name, value }), [name, value]);
222
-
223
- return (
224
- <EnvironmentVariableContext.Provider value={envVarContextValue}>
225
- <div
226
- className={cn(
227
- "flex items-center justify-between gap-4 px-4 py-3",
228
- className
229
- )}
230
- {...props}
231
- >
232
- {children ?? (
233
- <>
234
- <div className="flex items-center gap-2">
235
- <EnvironmentVariableName />
236
- </div>
237
- <EnvironmentVariableValue />
238
- </>
239
- )}
240
- </div>
241
- </EnvironmentVariableContext.Provider>
242
- );
243
- };
244
-
245
- export type EnvironmentVariableCopyButtonProps = ComponentProps<
246
- typeof Button
247
- > & {
248
- onCopy?: () => void;
249
- onError?: (error: Error) => void;
250
- timeout?: number;
251
- copyFormat?: "name" | "value" | "export";
252
- };
253
-
254
- export const EnvironmentVariableCopyButton = ({
255
- onCopy,
256
- onError,
257
- timeout = 2000,
258
- copyFormat = "value",
259
- children,
260
- className,
261
- ...props
262
- }: EnvironmentVariableCopyButtonProps) => {
263
- const [isCopied, setIsCopied] = useState(false);
264
- const timeoutRef = useRef<number>(0);
265
- const { name, value } = useContext(EnvironmentVariableContext);
266
-
267
- const getTextToCopy = useCallback((): string => {
268
- const formatMap = {
269
- export: () => `export ${name}="${value}"`,
270
- name: () => name,
271
- value: () => value,
272
- };
273
- return formatMap[copyFormat]();
274
- }, [name, value, copyFormat]);
275
-
276
- const copyToClipboard = useCallback(async () => {
277
- if (typeof window === "undefined" || !navigator?.clipboard?.writeText) {
278
- onError?.(new Error("Clipboard API not available"));
279
- return;
280
- }
281
-
282
- try {
283
- await navigator.clipboard.writeText(getTextToCopy());
284
- setIsCopied(true);
285
- onCopy?.();
286
- timeoutRef.current = window.setTimeout(() => setIsCopied(false), timeout);
287
- } catch (error) {
288
- onError?.(error as Error);
289
- }
290
- }, [getTextToCopy, onCopy, onError, timeout]);
291
-
292
- useEffect(
293
- () => () => {
294
- window.clearTimeout(timeoutRef.current);
295
- },
296
- []
297
- );
298
-
299
- const Icon = isCopied ? CheckIcon : CopyIcon;
300
-
301
- return (
302
- <Button
303
- className={cn("size-6 shrink-0", className)}
304
- onClick={copyToClipboard}
305
- size="icon"
306
- variant="ghost"
307
- {...props}
308
- >
309
- {children ?? <Icon size={12} />}
310
- </Button>
311
- );
312
- };
313
-
314
- export type EnvironmentVariableRequiredProps = ComponentProps<typeof Badge>;
315
-
316
- export const EnvironmentVariableRequired = ({
317
- className,
318
- children,
319
- ...props
320
- }: EnvironmentVariableRequiredProps) => (
321
- <Badge className={cn("text-xs", className)} variant="secondary" {...props}>
322
- {children ?? "Required"}
323
- </Badge>
324
- );