@vvedantb/ui 0.1.1 → 0.1.2

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 (74) hide show
  1. package/LICENSE +21 -21
  2. package/package.json +3 -2
  3. package/src/ai-elements/artifact.tsx +99 -99
  4. package/src/ai-elements/attachments.tsx +366 -366
  5. package/src/ai-elements/chain-of-thought.tsx +212 -212
  6. package/src/ai-elements/code-block.tsx +478 -478
  7. package/src/ai-elements/conversation.tsx +157 -157
  8. package/src/ai-elements/image.tsx +25 -25
  9. package/src/ai-elements/inline-citation.tsx +252 -252
  10. package/src/ai-elements/message.tsx +269 -269
  11. package/src/ai-elements/model-selector.tsx +211 -211
  12. package/src/ai-elements/prompt-input.tsx +1018 -1018
  13. package/src/ai-elements/queue.tsx +251 -251
  14. package/src/ai-elements/reasoning.tsx +178 -178
  15. package/src/ai-elements/shimmer.tsx +56 -56
  16. package/src/ai-elements/sources.tsx +77 -77
  17. package/src/ai-elements/speech-input.tsx +290 -290
  18. package/src/ai-elements/suggestion.tsx +191 -191
  19. package/src/css.d.ts +2 -2
  20. package/src/index.ts +96 -96
  21. package/src/motion/presets.ts +35 -35
  22. package/src/motion/presets.vibot.ts +105 -105
  23. package/src/ui/_menu-classes.ts +30 -30
  24. package/src/ui/_menu-classes.vibot.ts +33 -33
  25. package/src/ui/accordion.tsx +81 -81
  26. package/src/ui/accordion.verve.tsx +56 -56
  27. package/src/ui/badge.tsx +34 -34
  28. package/src/ui/breadcrumb.tsx +83 -83
  29. package/src/ui/button-group.tsx +84 -84
  30. package/src/ui/button.tsx +57 -57
  31. package/src/ui/card.tsx +27 -27
  32. package/src/ui/carousel.tsx +211 -211
  33. package/src/ui/checkbox.tsx +27 -27
  34. package/src/ui/clear-input.tsx +170 -170
  35. package/src/ui/clear-input.vibot.tsx +76 -76
  36. package/src/ui/clearInputDissolve.ts +214 -214
  37. package/src/ui/collapsible.tsx +7 -7
  38. package/src/ui/command.tsx +148 -148
  39. package/src/ui/context-menu.tsx +173 -173
  40. package/src/ui/dialog.tsx +149 -149
  41. package/src/ui/dropdown-menu.tsx +178 -178
  42. package/src/ui/hover-card.tsx +31 -31
  43. package/src/ui/input-group.tsx +162 -162
  44. package/src/ui/input-group.verve.tsx +150 -150
  45. package/src/ui/input.tsx +21 -21
  46. package/src/ui/kbd.tsx +18 -18
  47. package/src/ui/label.tsx +20 -20
  48. package/src/ui/labeled-switch-row.tsx +53 -53
  49. package/src/ui/modalTransition.ts +85 -85
  50. package/src/ui/pagination.tsx +47 -47
  51. package/src/ui/popover.tsx +33 -33
  52. package/src/ui/progress.tsx +25 -25
  53. package/src/ui/radix-select.tsx +202 -202
  54. package/src/ui/scroll-area.tsx +55 -55
  55. package/src/ui/scroll-area.verve.tsx +43 -43
  56. package/src/ui/search-input.tsx +29 -29
  57. package/src/ui/select.tsx +163 -163
  58. package/src/ui/separator.tsx +28 -28
  59. package/src/ui/sheet.tsx +87 -87
  60. package/src/ui/skeleton.tsx +18 -18
  61. package/src/ui/sonner.css +16 -16
  62. package/src/ui/sonner.tsx +47 -47
  63. package/src/ui/spinner.tsx +27 -27
  64. package/src/ui/surface-classes.ts +55 -55
  65. package/src/ui/switch.tsx +26 -26
  66. package/src/ui/table.tsx +123 -123
  67. package/src/ui/tabs.tsx +140 -140
  68. package/src/ui/tabsSliding.ts +56 -56
  69. package/src/ui/textarea.tsx +21 -21
  70. package/src/ui/time-picker.tsx +170 -170
  71. package/src/ui/tooltip.tsx +25 -25
  72. package/src/ui/visually-hidden.tsx +3 -3
  73. package/src/utils/cn.ts +16 -16
  74. package/src/utils/ref.ts +10 -10
@@ -1,212 +1,212 @@
1
- "use client";
2
- import type { TablerIcon } from "@tabler/icons-react";
3
- import type { ComponentProps, ReactNode } from "react";
4
- import { useControllableState } from "@radix-ui/react-use-controllable-state";
5
- import {
6
- IconBrain,
7
- IconChevronDown,
8
- IconPointFilled,
9
- } from "@tabler/icons-react";
10
- import { Badge } from "../ui/badge";
11
- import {
12
- Collapsible,
13
- CollapsibleContent,
14
- CollapsibleTrigger,
15
- } from "../ui/collapsible";
16
- import { cn } from "../utils/cn";
17
- import { flatPanelSubtleClass } from "../ui/surface-classes";
18
- import { createContext, useContext } from "react";
19
- interface ChainOfThoughtContextValue {
20
- isOpen: boolean;
21
- setIsOpen: (open: boolean) => void;
22
- }
23
- const ChainOfThoughtContext = createContext<ChainOfThoughtContextValue | null>(
24
- null,
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
- export type ChainOfThoughtProps = ComponentProps<"div"> & {
36
- open?: boolean;
37
- defaultOpen?: boolean;
38
- onOpenChange?: (open: boolean) => void;
39
- };
40
- export function ChainOfThought({
41
- className,
42
- open,
43
- defaultOpen = false,
44
- onOpenChange,
45
- children,
46
- ...props
47
- }: ChainOfThoughtProps) {
48
- const [isOpen, setIsOpen] = useControllableState({
49
- defaultProp: defaultOpen,
50
- onChange: onOpenChange,
51
- prop: open,
52
- });
53
- const chainOfThoughtContext = { isOpen, setIsOpen };
54
- return (
55
- <ChainOfThoughtContext.Provider value={chainOfThoughtContext}>
56
- <div className={cn("not-prose w-full space-y-4", className)} {...props}>
57
- {children}
58
- </div>
59
- </ChainOfThoughtContext.Provider>
60
- );
61
- }
62
- export type ChainOfThoughtHeaderProps = ComponentProps<
63
- typeof CollapsibleTrigger
64
- > & {
65
- icon?: ReactNode;
66
- };
67
- export function ChainOfThoughtHeader({
68
- className,
69
- children,
70
- icon,
71
- ...props
72
- }: ChainOfThoughtHeaderProps) {
73
- const { isOpen, setIsOpen } = useChainOfThought();
74
- return (
75
- <Collapsible onOpenChange={setIsOpen} open={isOpen}>
76
- <CollapsibleTrigger
77
- className={cn(
78
- "flex w-full items-center gap-2 text-muted text-sm transition-[color,transform] duration-150 ease-out active:scale-[0.99] hover:text-foreground",
79
- className,
80
- )}
81
- {...props}
82
- >
83
- {icon ?? <IconBrain className="size-4" />}
84
- <span className="flex-1 text-left">
85
- {children ?? "Chain of Thought"}
86
- </span>
87
- <IconChevronDown
88
- className={cn(
89
- "size-4 transition-transform duration-150 ease-out",
90
- isOpen ? "rotate-180" : "rotate-0",
91
- )}
92
- />
93
- </CollapsibleTrigger>
94
- </Collapsible>
95
- );
96
- }
97
- export type ChainOfThoughtStepProps = ComponentProps<"div"> & {
98
- icon?: TablerIcon;
99
- label: ReactNode;
100
- description?: ReactNode;
101
- status?: "complete" | "active" | "pending";
102
- };
103
- const stepStatusStyles = {
104
- active: "text-foreground",
105
- complete: "text-muted",
106
- pending: "text-muted/50",
107
- };
108
- export function ChainOfThoughtStep({
109
- className,
110
- icon: Icon = IconPointFilled,
111
- label,
112
- description,
113
- status = "complete",
114
- children,
115
- ...props
116
- }: ChainOfThoughtStepProps) {
117
- return (
118
- <div
119
- className={cn(
120
- "flex gap-2 text-sm",
121
- stepStatusStyles[status],
122
- "fade-in-0 slide-in-from-top-2 animate-in duration-200 ease-[cubic-bezier(0.32,0.72,0,1)]",
123
- className,
124
- )}
125
- {...props}
126
- >
127
- <div className="relative mt-0.5">
128
- <Icon className="size-4" />
129
- <div className="absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-separator" />
130
- </div>
131
- <div className="flex-1 space-y-2 overflow-hidden">
132
- <div>{label}</div>
133
- {description && <div className="text-muted text-xs">{description}</div>}
134
- {children}
135
- </div>
136
- </div>
137
- );
138
- }
139
- export type ChainOfThoughtSearchResultsProps = ComponentProps<"div">;
140
- export function ChainOfThoughtSearchResults({
141
- className,
142
- ...props
143
- }: ChainOfThoughtSearchResultsProps) {
144
- return (
145
- <div
146
- className={cn("flex flex-wrap items-center gap-2", className)}
147
- {...props}
148
- />
149
- );
150
- }
151
- export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
152
- export function ChainOfThoughtSearchResult({
153
- className,
154
- children,
155
- ...props
156
- }: ChainOfThoughtSearchResultProps) {
157
- return (
158
- <Badge
159
- className={cn("gap-1 px-2 py-0.5 font-normal text-xs", className)}
160
- variant="secondary"
161
- {...props}
162
- >
163
- {children}
164
- </Badge>
165
- );
166
- }
167
- export type ChainOfThoughtContentProps = ComponentProps<
168
- typeof CollapsibleContent
169
- >;
170
- export function ChainOfThoughtContent({
171
- className,
172
- children,
173
- ...props
174
- }: ChainOfThoughtContentProps) {
175
- const { isOpen } = useChainOfThought();
176
- return (
177
- <Collapsible open={isOpen}>
178
- <CollapsibleContent
179
- className={cn(
180
- "mt-2 space-y-3 text-foreground outline-hidden",
181
- className,
182
- )}
183
- {...props}
184
- >
185
- {children}
186
- </CollapsibleContent>
187
- </Collapsible>
188
- );
189
- }
190
- export type ChainOfThoughtImageProps = ComponentProps<"div"> & {
191
- caption?: string;
192
- };
193
- export function ChainOfThoughtImage({
194
- className,
195
- children,
196
- caption,
197
- ...props
198
- }: ChainOfThoughtImageProps) {
199
- return (
200
- <div className={cn("mt-2 space-y-2", className)} {...props}>
201
- <div
202
- className={cn(
203
- flatPanelSubtleClass,
204
- "relative flex max-h-88 items-center justify-center overflow-hidden rounded-lg p-3",
205
- )}
206
- >
207
- {children}
208
- </div>
209
- {caption && <p className="text-muted text-xs">{caption}</p>}
210
- </div>
211
- );
212
- }
1
+ "use client";
2
+ import type { TablerIcon } from "@tabler/icons-react";
3
+ import type { ComponentProps, ReactNode } from "react";
4
+ import { useControllableState } from "@radix-ui/react-use-controllable-state";
5
+ import {
6
+ IconBrain,
7
+ IconChevronDown,
8
+ IconPointFilled,
9
+ } from "@tabler/icons-react";
10
+ import { Badge } from "../ui/badge";
11
+ import {
12
+ Collapsible,
13
+ CollapsibleContent,
14
+ CollapsibleTrigger,
15
+ } from "../ui/collapsible";
16
+ import { cn } from "../utils/cn";
17
+ import { flatPanelSubtleClass } from "../ui/surface-classes";
18
+ import { createContext, useContext } from "react";
19
+ interface ChainOfThoughtContextValue {
20
+ isOpen: boolean;
21
+ setIsOpen: (open: boolean) => void;
22
+ }
23
+ const ChainOfThoughtContext = createContext<ChainOfThoughtContextValue | null>(
24
+ null,
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
+ export type ChainOfThoughtProps = ComponentProps<"div"> & {
36
+ open?: boolean;
37
+ defaultOpen?: boolean;
38
+ onOpenChange?: (open: boolean) => void;
39
+ };
40
+ export function ChainOfThought({
41
+ className,
42
+ open,
43
+ defaultOpen = false,
44
+ onOpenChange,
45
+ children,
46
+ ...props
47
+ }: ChainOfThoughtProps) {
48
+ const [isOpen, setIsOpen] = useControllableState({
49
+ defaultProp: defaultOpen,
50
+ onChange: onOpenChange,
51
+ prop: open,
52
+ });
53
+ const chainOfThoughtContext = { isOpen, setIsOpen };
54
+ return (
55
+ <ChainOfThoughtContext.Provider value={chainOfThoughtContext}>
56
+ <div className={cn("not-prose w-full space-y-4", className)} {...props}>
57
+ {children}
58
+ </div>
59
+ </ChainOfThoughtContext.Provider>
60
+ );
61
+ }
62
+ export type ChainOfThoughtHeaderProps = ComponentProps<
63
+ typeof CollapsibleTrigger
64
+ > & {
65
+ icon?: ReactNode;
66
+ };
67
+ export function ChainOfThoughtHeader({
68
+ className,
69
+ children,
70
+ icon,
71
+ ...props
72
+ }: ChainOfThoughtHeaderProps) {
73
+ const { isOpen, setIsOpen } = useChainOfThought();
74
+ return (
75
+ <Collapsible onOpenChange={setIsOpen} open={isOpen}>
76
+ <CollapsibleTrigger
77
+ className={cn(
78
+ "flex w-full items-center gap-2 text-muted text-sm transition-[color,transform] duration-150 ease-out active:scale-[0.99] hover:text-foreground",
79
+ className,
80
+ )}
81
+ {...props}
82
+ >
83
+ {icon ?? <IconBrain className="size-4" />}
84
+ <span className="flex-1 text-left">
85
+ {children ?? "Chain of Thought"}
86
+ </span>
87
+ <IconChevronDown
88
+ className={cn(
89
+ "size-4 transition-transform duration-150 ease-out",
90
+ isOpen ? "rotate-180" : "rotate-0",
91
+ )}
92
+ />
93
+ </CollapsibleTrigger>
94
+ </Collapsible>
95
+ );
96
+ }
97
+ export type ChainOfThoughtStepProps = ComponentProps<"div"> & {
98
+ icon?: TablerIcon;
99
+ label: ReactNode;
100
+ description?: ReactNode;
101
+ status?: "complete" | "active" | "pending";
102
+ };
103
+ const stepStatusStyles = {
104
+ active: "text-foreground",
105
+ complete: "text-muted",
106
+ pending: "text-muted/50",
107
+ };
108
+ export function ChainOfThoughtStep({
109
+ className,
110
+ icon: Icon = IconPointFilled,
111
+ label,
112
+ description,
113
+ status = "complete",
114
+ children,
115
+ ...props
116
+ }: ChainOfThoughtStepProps) {
117
+ return (
118
+ <div
119
+ className={cn(
120
+ "flex gap-2 text-sm",
121
+ stepStatusStyles[status],
122
+ "fade-in-0 slide-in-from-top-2 animate-in duration-200 ease-[cubic-bezier(0.32,0.72,0,1)]",
123
+ className,
124
+ )}
125
+ {...props}
126
+ >
127
+ <div className="relative mt-0.5">
128
+ <Icon className="size-4" />
129
+ <div className="absolute top-7 bottom-0 left-1/2 -mx-px w-px bg-separator" />
130
+ </div>
131
+ <div className="flex-1 space-y-2 overflow-hidden">
132
+ <div>{label}</div>
133
+ {description && <div className="text-muted text-xs">{description}</div>}
134
+ {children}
135
+ </div>
136
+ </div>
137
+ );
138
+ }
139
+ export type ChainOfThoughtSearchResultsProps = ComponentProps<"div">;
140
+ export function ChainOfThoughtSearchResults({
141
+ className,
142
+ ...props
143
+ }: ChainOfThoughtSearchResultsProps) {
144
+ return (
145
+ <div
146
+ className={cn("flex flex-wrap items-center gap-2", className)}
147
+ {...props}
148
+ />
149
+ );
150
+ }
151
+ export type ChainOfThoughtSearchResultProps = ComponentProps<typeof Badge>;
152
+ export function ChainOfThoughtSearchResult({
153
+ className,
154
+ children,
155
+ ...props
156
+ }: ChainOfThoughtSearchResultProps) {
157
+ return (
158
+ <Badge
159
+ className={cn("gap-1 px-2 py-0.5 font-normal text-xs", className)}
160
+ variant="secondary"
161
+ {...props}
162
+ >
163
+ {children}
164
+ </Badge>
165
+ );
166
+ }
167
+ export type ChainOfThoughtContentProps = ComponentProps<
168
+ typeof CollapsibleContent
169
+ >;
170
+ export function ChainOfThoughtContent({
171
+ className,
172
+ children,
173
+ ...props
174
+ }: ChainOfThoughtContentProps) {
175
+ const { isOpen } = useChainOfThought();
176
+ return (
177
+ <Collapsible open={isOpen}>
178
+ <CollapsibleContent
179
+ className={cn(
180
+ "mt-2 space-y-3 text-foreground outline-hidden",
181
+ className,
182
+ )}
183
+ {...props}
184
+ >
185
+ {children}
186
+ </CollapsibleContent>
187
+ </Collapsible>
188
+ );
189
+ }
190
+ export type ChainOfThoughtImageProps = ComponentProps<"div"> & {
191
+ caption?: string;
192
+ };
193
+ export function ChainOfThoughtImage({
194
+ className,
195
+ children,
196
+ caption,
197
+ ...props
198
+ }: ChainOfThoughtImageProps) {
199
+ return (
200
+ <div className={cn("mt-2 space-y-2", className)} {...props}>
201
+ <div
202
+ className={cn(
203
+ flatPanelSubtleClass,
204
+ "relative flex max-h-88 items-center justify-center overflow-hidden rounded-lg p-3",
205
+ )}
206
+ >
207
+ {children}
208
+ </div>
209
+ {caption && <p className="text-muted text-xs">{caption}</p>}
210
+ </div>
211
+ );
212
+ }