@sero-ai/ui 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 (113) hide show
  1. package/.turbo/turbo-typecheck.log +4 -0
  2. package/components.json +18 -0
  3. package/package.json +70 -0
  4. package/src/components/ai-elements/agent.tsx +142 -0
  5. package/src/components/ai-elements/artifact.tsx +149 -0
  6. package/src/components/ai-elements/attachments.tsx +427 -0
  7. package/src/components/ai-elements/audio-player.tsx +232 -0
  8. package/src/components/ai-elements/canvas.tsx +26 -0
  9. package/src/components/ai-elements/chain-of-thought.tsx +223 -0
  10. package/src/components/ai-elements/checkpoint.tsx +72 -0
  11. package/src/components/ai-elements/code-block.tsx +555 -0
  12. package/src/components/ai-elements/commit.tsx +449 -0
  13. package/src/components/ai-elements/confirmation.tsx +173 -0
  14. package/src/components/ai-elements/connection.tsx +28 -0
  15. package/src/components/ai-elements/context.tsx +410 -0
  16. package/src/components/ai-elements/controls.tsx +19 -0
  17. package/src/components/ai-elements/conversation.tsx +167 -0
  18. package/src/components/ai-elements/edge.tsx +144 -0
  19. package/src/components/ai-elements/environment-variables.tsx +325 -0
  20. package/src/components/ai-elements/file-tree.tsx +298 -0
  21. package/src/components/ai-elements/image.tsx +25 -0
  22. package/src/components/ai-elements/inline-citation.tsx +294 -0
  23. package/src/components/ai-elements/jsx-preview.tsx +250 -0
  24. package/src/components/ai-elements/message.tsx +359 -0
  25. package/src/components/ai-elements/mic-selector.tsx +372 -0
  26. package/src/components/ai-elements/model-selector.tsx +214 -0
  27. package/src/components/ai-elements/node.tsx +72 -0
  28. package/src/components/ai-elements/open-in-chat.tsx +367 -0
  29. package/src/components/ai-elements/package-info.tsx +235 -0
  30. package/src/components/ai-elements/panel.tsx +16 -0
  31. package/src/components/ai-elements/persona.tsx +280 -0
  32. package/src/components/ai-elements/plan.tsx +144 -0
  33. package/src/components/ai-elements/prompt-input.tsx +1341 -0
  34. package/src/components/ai-elements/queue.tsx +275 -0
  35. package/src/components/ai-elements/reasoning.tsx +229 -0
  36. package/src/components/ai-elements/sandbox.tsx +133 -0
  37. package/src/components/ai-elements/schema-display.tsx +473 -0
  38. package/src/components/ai-elements/shimmer.tsx +78 -0
  39. package/src/components/ai-elements/snippet.tsx +141 -0
  40. package/src/components/ai-elements/sources.tsx +78 -0
  41. package/src/components/ai-elements/speech-input.tsx +324 -0
  42. package/src/components/ai-elements/stack-trace.tsx +531 -0
  43. package/src/components/ai-elements/suggestion.tsx +58 -0
  44. package/src/components/ai-elements/task.tsx +88 -0
  45. package/src/components/ai-elements/terminal.tsx +277 -0
  46. package/src/components/ai-elements/test-results.tsx +497 -0
  47. package/src/components/ai-elements/tool.tsx +174 -0
  48. package/src/components/ai-elements/toolbar.tsx +17 -0
  49. package/src/components/ai-elements/transcription.tsx +126 -0
  50. package/src/components/ai-elements/voice-selector.tsx +525 -0
  51. package/src/components/ai-elements/web-preview.tsx +282 -0
  52. package/src/components/ui/accordion.tsx +64 -0
  53. package/src/components/ui/alert-dialog.tsx +196 -0
  54. package/src/components/ui/alert.tsx +66 -0
  55. package/src/components/ui/aspect-ratio.tsx +11 -0
  56. package/src/components/ui/avatar.tsx +107 -0
  57. package/src/components/ui/badge.tsx +48 -0
  58. package/src/components/ui/breadcrumb.tsx +109 -0
  59. package/src/components/ui/button-group.tsx +83 -0
  60. package/src/components/ui/button.tsx +64 -0
  61. package/src/components/ui/calendar.tsx +218 -0
  62. package/src/components/ui/card.tsx +92 -0
  63. package/src/components/ui/carousel.tsx +239 -0
  64. package/src/components/ui/chart.tsx +355 -0
  65. package/src/components/ui/checkbox.tsx +32 -0
  66. package/src/components/ui/collapsible.tsx +31 -0
  67. package/src/components/ui/combobox.tsx +310 -0
  68. package/src/components/ui/command.tsx +184 -0
  69. package/src/components/ui/context-menu.tsx +252 -0
  70. package/src/components/ui/dialog.tsx +158 -0
  71. package/src/components/ui/direction.tsx +22 -0
  72. package/src/components/ui/drawer.tsx +133 -0
  73. package/src/components/ui/dropdown-menu.tsx +257 -0
  74. package/src/components/ui/empty.tsx +104 -0
  75. package/src/components/ui/field.tsx +248 -0
  76. package/src/components/ui/form.tsx +165 -0
  77. package/src/components/ui/hover-card.tsx +42 -0
  78. package/src/components/ui/input-group.tsx +168 -0
  79. package/src/components/ui/input-otp.tsx +77 -0
  80. package/src/components/ui/input.tsx +21 -0
  81. package/src/components/ui/item.tsx +193 -0
  82. package/src/components/ui/kbd.tsx +28 -0
  83. package/src/components/ui/label.tsx +22 -0
  84. package/src/components/ui/menubar.tsx +276 -0
  85. package/src/components/ui/native-select.tsx +53 -0
  86. package/src/components/ui/navigation-menu.tsx +168 -0
  87. package/src/components/ui/pagination.tsx +127 -0
  88. package/src/components/ui/popover.tsx +87 -0
  89. package/src/components/ui/progress.tsx +31 -0
  90. package/src/components/ui/radio-group.tsx +43 -0
  91. package/src/components/ui/resizable.tsx +53 -0
  92. package/src/components/ui/scroll-area.tsx +56 -0
  93. package/src/components/ui/select.tsx +190 -0
  94. package/src/components/ui/separator.tsx +28 -0
  95. package/src/components/ui/sheet.tsx +145 -0
  96. package/src/components/ui/sidebar.tsx +724 -0
  97. package/src/components/ui/skeleton.tsx +13 -0
  98. package/src/components/ui/slider.tsx +61 -0
  99. package/src/components/ui/sonner.tsx +40 -0
  100. package/src/components/ui/spinner.tsx +16 -0
  101. package/src/components/ui/switch.tsx +33 -0
  102. package/src/components/ui/table.tsx +116 -0
  103. package/src/components/ui/tabs.tsx +91 -0
  104. package/src/components/ui/textarea.tsx +18 -0
  105. package/src/components/ui/toggle-group.tsx +83 -0
  106. package/src/components/ui/toggle.tsx +47 -0
  107. package/src/components/ui/tooltip.tsx +57 -0
  108. package/src/components/ui/tree.tsx +207 -0
  109. package/src/hooks/use-mobile.ts +17 -0
  110. package/src/index.ts +16 -0
  111. package/src/lib/utils.ts +6 -0
  112. package/src/styles/globals.css +373 -0
  113. package/tsconfig.json +18 -0
@@ -0,0 +1,223 @@
1
+ "use client";
2
+
3
+ import type { LucideIcon } from "lucide-react";
4
+ import type { ComponentProps, ReactNode } from "react";
5
+
6
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
7
+ import { Badge } from "../ui/badge";
8
+ import {
9
+ Collapsible,
10
+ CollapsibleContent,
11
+ CollapsibleTrigger,
12
+ } from "../ui/collapsible";
13
+ import { cn } from "../../lib/utils";
14
+ import { BrainIcon, ChevronDownIcon, DotIcon } from "lucide-react";
15
+ import { createContext, memo, useContext, useMemo } from "react";
16
+
17
+ interface ChainOfThoughtContextValue {
18
+ isOpen: boolean;
19
+ setIsOpen: (open: boolean) => void;
20
+ }
21
+
22
+ const ChainOfThoughtContext = createContext<ChainOfThoughtContextValue | null>(
23
+ null
24
+ );
25
+
26
+ const useChainOfThought = () => {
27
+ const context = useContext(ChainOfThoughtContext);
28
+ if (!context) {
29
+ throw new Error(
30
+ "ChainOfThought components must be used within ChainOfThought"
31
+ );
32
+ }
33
+ return context;
34
+ };
35
+
36
+ export type ChainOfThoughtProps = ComponentProps<"div"> & {
37
+ open?: boolean;
38
+ defaultOpen?: boolean;
39
+ onOpenChange?: (open: boolean) => void;
40
+ };
41
+
42
+ export const ChainOfThought = memo(
43
+ ({
44
+ className,
45
+ open,
46
+ defaultOpen = false,
47
+ onOpenChange,
48
+ children,
49
+ ...props
50
+ }: ChainOfThoughtProps) => {
51
+ const [isOpen, setIsOpen] = useControllableState({
52
+ defaultProp: defaultOpen,
53
+ onChange: onOpenChange,
54
+ prop: open,
55
+ });
56
+
57
+ const chainOfThoughtContext = useMemo(
58
+ () => ({ isOpen, setIsOpen }),
59
+ [isOpen, setIsOpen]
60
+ );
61
+
62
+ return (
63
+ <ChainOfThoughtContext.Provider value={chainOfThoughtContext}>
64
+ <div className={cn("not-prose w-full space-y-4", className)} {...props}>
65
+ {children}
66
+ </div>
67
+ </ChainOfThoughtContext.Provider>
68
+ );
69
+ }
70
+ );
71
+
72
+ export type ChainOfThoughtHeaderProps = ComponentProps<
73
+ typeof CollapsibleTrigger
74
+ >;
75
+
76
+ export const ChainOfThoughtHeader = memo(
77
+ ({ className, children, ...props }: ChainOfThoughtHeaderProps) => {
78
+ const { isOpen, setIsOpen } = useChainOfThought();
79
+
80
+ return (
81
+ <Collapsible onOpenChange={setIsOpen} open={isOpen}>
82
+ <CollapsibleTrigger
83
+ className={cn(
84
+ "flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground",
85
+ className
86
+ )}
87
+ {...props}
88
+ >
89
+ <BrainIcon className="size-4" />
90
+ <span className="flex-1 text-left">
91
+ {children ?? "Chain of Thought"}
92
+ </span>
93
+ <ChevronDownIcon
94
+ className={cn(
95
+ "size-4 transition-transform",
96
+ isOpen ? "rotate-180" : "rotate-0"
97
+ )}
98
+ />
99
+ </CollapsibleTrigger>
100
+ </Collapsible>
101
+ );
102
+ }
103
+ );
104
+
105
+ export type ChainOfThoughtStepProps = ComponentProps<"div"> & {
106
+ icon?: LucideIcon;
107
+ label: ReactNode;
108
+ description?: ReactNode;
109
+ status?: "complete" | "active" | "pending";
110
+ };
111
+
112
+ const stepStatusStyles = {
113
+ active: "text-foreground",
114
+ complete: "text-muted-foreground",
115
+ pending: "text-muted-foreground/50",
116
+ };
117
+
118
+ export const ChainOfThoughtStep = memo(
119
+ ({
120
+ className,
121
+ icon: Icon = DotIcon,
122
+ label,
123
+ description,
124
+ status = "complete",
125
+ children,
126
+ ...props
127
+ }: ChainOfThoughtStepProps) => (
128
+ <div
129
+ className={cn(
130
+ "flex gap-2 text-sm",
131
+ stepStatusStyles[status],
132
+ "fade-in-0 slide-in-from-top-2 animate-in",
133
+ className
134
+ )}
135
+ {...props}
136
+ >
137
+ <div className="relative mt-0.5">
138
+ <Icon className="size-4" />
139
+ <div className="absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-border" />
140
+ </div>
141
+ <div className="flex-1 space-y-2 overflow-hidden">
142
+ <div>{label}</div>
143
+ {description && (
144
+ <div className="text-muted-foreground text-xs">{description}</div>
145
+ )}
146
+ {children}
147
+ </div>
148
+ </div>
149
+ )
150
+ );
151
+
152
+ export type ChainOfThoughtSearchResultsProps = ComponentProps<"div">;
153
+
154
+ export const ChainOfThoughtSearchResults = memo(
155
+ ({ className, ...props }: ChainOfThoughtSearchResultsProps) => (
156
+ <div
157
+ className={cn("flex flex-wrap items-center gap-2", className)}
158
+ {...props}
159
+ />
160
+ )
161
+ );
162
+
163
+ export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
164
+
165
+ export const ChainOfThoughtSearchResult = memo(
166
+ ({ className, children, ...props }: ChainOfThoughtSearchResultProps) => (
167
+ <Badge
168
+ className={cn("gap-1 px-2 py-0.5 font-normal text-xs", className)}
169
+ variant="secondary"
170
+ {...props}
171
+ >
172
+ {children}
173
+ </Badge>
174
+ )
175
+ );
176
+
177
+ export type ChainOfThoughtContentProps = ComponentProps<
178
+ typeof CollapsibleContent
179
+ >;
180
+
181
+ export const ChainOfThoughtContent = memo(
182
+ ({ className, children, ...props }: ChainOfThoughtContentProps) => {
183
+ const { isOpen } = useChainOfThought();
184
+
185
+ return (
186
+ <Collapsible open={isOpen}>
187
+ <CollapsibleContent
188
+ className={cn(
189
+ "mt-2 space-y-3",
190
+ "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in",
191
+ className
192
+ )}
193
+ {...props}
194
+ >
195
+ {children}
196
+ </CollapsibleContent>
197
+ </Collapsible>
198
+ );
199
+ }
200
+ );
201
+
202
+ export type ChainOfThoughtImageProps = ComponentProps<"div"> & {
203
+ caption?: string;
204
+ };
205
+
206
+ export const ChainOfThoughtImage = memo(
207
+ ({ className, children, caption, ...props }: ChainOfThoughtImageProps) => (
208
+ <div className={cn("mt-2 space-y-2", className)} {...props}>
209
+ <div className="relative flex max-h-[22rem] items-center justify-center overflow-hidden rounded-lg bg-muted p-3">
210
+ {children}
211
+ </div>
212
+ {caption && <p className="text-muted-foreground text-xs">{caption}</p>}
213
+ </div>
214
+ )
215
+ );
216
+
217
+ ChainOfThought.displayName = "ChainOfThought";
218
+ ChainOfThoughtHeader.displayName = "ChainOfThoughtHeader";
219
+ ChainOfThoughtStep.displayName = "ChainOfThoughtStep";
220
+ ChainOfThoughtSearchResults.displayName = "ChainOfThoughtSearchResults";
221
+ ChainOfThoughtSearchResult.displayName = "ChainOfThoughtSearchResult";
222
+ ChainOfThoughtContent.displayName = "ChainOfThoughtContent";
223
+ ChainOfThoughtImage.displayName = "ChainOfThoughtImage";
@@ -0,0 +1,72 @@
1
+ "use client";
2
+
3
+ import type { LucideProps } from "lucide-react";
4
+ import type { ComponentProps, HTMLAttributes } from "react";
5
+
6
+ import { Button } from "../ui/button";
7
+ import { Separator } from "../ui/separator";
8
+ import {
9
+ Tooltip,
10
+ TooltipContent,
11
+ TooltipTrigger,
12
+ } from "../ui/tooltip";
13
+ import { cn } from "../../lib/utils";
14
+ import { BookmarkIcon } from "lucide-react";
15
+
16
+ export type CheckpointProps = HTMLAttributes<HTMLDivElement>;
17
+
18
+ export const Checkpoint = ({
19
+ className,
20
+ children,
21
+ ...props
22
+ }: CheckpointProps) => (
23
+ <div
24
+ className={cn(
25
+ "flex items-center gap-0.5 overflow-hidden text-muted-foreground",
26
+ className
27
+ )}
28
+ {...props}
29
+ >
30
+ {children}
31
+ <Separator />
32
+ </div>
33
+ );
34
+
35
+ export type CheckpointIconProps = LucideProps;
36
+
37
+ export const CheckpointIcon = ({
38
+ className,
39
+ children,
40
+ ...props
41
+ }: CheckpointIconProps) =>
42
+ children ?? (
43
+ <BookmarkIcon className={cn("size-4 shrink-0", className)} {...props} />
44
+ );
45
+
46
+ export type CheckpointTriggerProps = ComponentProps<typeof Button> & {
47
+ tooltip?: string;
48
+ };
49
+
50
+ export const CheckpointTrigger = ({
51
+ children,
52
+ variant = "ghost",
53
+ size = "sm",
54
+ tooltip,
55
+ ...props
56
+ }: CheckpointTriggerProps) =>
57
+ tooltip ? (
58
+ <Tooltip>
59
+ <TooltipTrigger asChild>
60
+ <Button size={size} type="button" variant={variant} {...props}>
61
+ {children}
62
+ </Button>
63
+ </TooltipTrigger>
64
+ <TooltipContent align="start" side="bottom">
65
+ {tooltip}
66
+ </TooltipContent>
67
+ </Tooltip>
68
+ ) : (
69
+ <Button size={size} type="button" variant={variant} {...props}>
70
+ {children}
71
+ </Button>
72
+ );