@vvedantb/ui 0.1.1 → 0.1.3

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 +100 -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,252 +1,252 @@
1
- "use client";
2
- import type { CarouselApi } from "../ui/carousel";
3
- import type { ComponentProps } from "react";
4
- import { Badge } from "../ui/badge";
5
- import { Carousel, CarouselContent, CarouselItem } from "../ui/carousel";
6
- import {
7
- HoverCard,
8
- HoverCardContent,
9
- HoverCardTrigger,
10
- } from "../ui/hover-card";
11
- import { cn } from "../utils/cn";
12
- import { flatPanelSubtleClass } from "../ui/surface-classes";
13
- import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
14
- import { createContext, useContext, useEffect, useState } from "react";
15
- export type InlineCitationProps = ComponentProps<"span">;
16
- export const InlineCitation = ({
17
- className,
18
- ...props
19
- }: InlineCitationProps) => (
20
- <span
21
- className={cn("group inline items-center gap-1", className)}
22
- {...props}
23
- />
24
- );
25
- export type InlineCitationTextProps = ComponentProps<"span">;
26
- export const InlineCitationText = ({
27
- className,
28
- ...props
29
- }: InlineCitationTextProps) => (
30
- <span
31
- className={cn(
32
- "transition-colors group-hover:bg-surface-secondary",
33
- className,
34
- )}
35
- {...props}
36
- />
37
- );
38
- export type InlineCitationCardProps = ComponentProps<typeof HoverCard>;
39
- export const InlineCitationCard = (props: InlineCitationCardProps) => (
40
- <HoverCard closeDelay={0} openDelay={0} {...props} />
41
- );
42
- export type InlineCitationCardTriggerProps = ComponentProps<typeof Badge> & {
43
- sources: string[];
44
- };
45
- export const InlineCitationCardTrigger = ({
46
- sources,
47
- className,
48
- ...props
49
- }: InlineCitationCardTriggerProps) => (
50
- <HoverCardTrigger asChild>
51
- <Badge
52
- className={cn("ml-1 rounded-full", className)}
53
- variant="secondary"
54
- {...props}
55
- >
56
- {sources[0] ? (
57
- <>
58
- {new URL(sources[0]).hostname}{" "}
59
- {sources.length > 1 && `+${sources.length - 1}`}
60
- </>
61
- ) : (
62
- "unknown"
63
- )}
64
- </Badge>
65
- </HoverCardTrigger>
66
- );
67
- export type InlineCitationCardBodyProps = ComponentProps<"div">;
68
- export const InlineCitationCardBody = ({
69
- className,
70
- ...props
71
- }: InlineCitationCardBodyProps) => (
72
- <HoverCardContent className={cn("relative w-80 p-0", className)} {...props} />
73
- );
74
- const CarouselApiContext = createContext<CarouselApi | undefined>(undefined);
75
- const useCarouselApi = () => {
76
- const context = useContext(CarouselApiContext);
77
- return context;
78
- };
79
- export type InlineCitationCarouselProps = ComponentProps<typeof Carousel>;
80
- export const InlineCitationCarousel = ({
81
- className,
82
- children,
83
- ...props
84
- }: InlineCitationCarouselProps) => {
85
- const [api, setApi] = useState<CarouselApi>();
86
- return (
87
- <CarouselApiContext.Provider value={api}>
88
- <Carousel className={cn("w-full", className)} setApi={setApi} {...props}>
89
- {children}
90
- </Carousel>
91
- </CarouselApiContext.Provider>
92
- );
93
- };
94
- export type InlineCitationCarouselContentProps = ComponentProps<"div">;
95
- export const InlineCitationCarouselContent = (
96
- props: InlineCitationCarouselContentProps,
97
- ) => <CarouselContent {...props} />;
98
- export type InlineCitationCarouselItemProps = ComponentProps<"div">;
99
- export const InlineCitationCarouselItem = ({
100
- className,
101
- ...props
102
- }: InlineCitationCarouselItemProps) => (
103
- <CarouselItem
104
- className={cn("w-full space-y-2 p-4 pl-8", className)}
105
- {...props}
106
- />
107
- );
108
- export type InlineCitationCarouselHeaderProps = ComponentProps<"div">;
109
- export const InlineCitationCarouselHeader = ({
110
- className,
111
- ...props
112
- }: InlineCitationCarouselHeaderProps) => (
113
- <div
114
- className={cn(
115
- cn(
116
- flatPanelSubtleClass,
117
- "flex items-center justify-between gap-2 rounded-t-md p-2",
118
- ),
119
- className,
120
- )}
121
- {...props}
122
- />
123
- );
124
- export type InlineCitationCarouselIndexProps = ComponentProps<"div">;
125
- export const InlineCitationCarouselIndex = ({
126
- children,
127
- className,
128
- ...props
129
- }: InlineCitationCarouselIndexProps) => {
130
- const api = useCarouselApi();
131
- const [current, setCurrent] = useState(0);
132
- const [count, setCount] = useState(0);
133
- useEffect(() => {
134
- if (!api) {
135
- return;
136
- }
137
- setCount(api.scrollSnapList().length);
138
- setCurrent(api.selectedScrollSnap() + 1);
139
- const handleSelect = () => {
140
- setCurrent(api.selectedScrollSnap() + 1);
141
- };
142
- api.on("select", handleSelect);
143
- return () => {
144
- api.off("select", handleSelect);
145
- };
146
- }, [api]);
147
- return (
148
- <div
149
- className={cn(
150
- "flex flex-1 items-center justify-end px-3 py-1 text-muted text-xs",
151
- className,
152
- )}
153
- {...props}
154
- >
155
- {children ?? `${current}/${count}`}
156
- </div>
157
- );
158
- };
159
- export type InlineCitationCarouselPrevProps = ComponentProps<"button">;
160
- export const InlineCitationCarouselPrev = ({
161
- className,
162
- ...props
163
- }: InlineCitationCarouselPrevProps) => {
164
- const api = useCarouselApi();
165
- const handleClick = () => {
166
- if (api) {
167
- api.scrollPrev();
168
- }
169
- };
170
- return (
171
- <button
172
- aria-label="Previous"
173
- className={cn(
174
- "shrink-0 rounded-md p-0.5 transition-[background-color,transform] duration-150 ease-out active:scale-[0.97] hover:bg-surface-secondary",
175
- className,
176
- )}
177
- onClick={handleClick}
178
- type="button"
179
- {...props}
180
- >
181
- <IconArrowLeft className="size-4 text-muted" />
182
- </button>
183
- );
184
- };
185
- export type InlineCitationCarouselNextProps = ComponentProps<"button">;
186
- export const InlineCitationCarouselNext = ({
187
- className,
188
- ...props
189
- }: InlineCitationCarouselNextProps) => {
190
- const api = useCarouselApi();
191
- const handleClick = () => {
192
- if (api) {
193
- api.scrollNext();
194
- }
195
- };
196
- return (
197
- <button
198
- aria-label="Next"
199
- className={cn(
200
- "shrink-0 rounded-md p-0.5 transition-[background-color,transform] duration-150 ease-out active:scale-[0.97] hover:bg-surface-secondary",
201
- className,
202
- )}
203
- onClick={handleClick}
204
- type="button"
205
- {...props}
206
- >
207
- <IconArrowRight className="size-4 text-muted" />
208
- </button>
209
- );
210
- };
211
- export type InlineCitationSourceProps = ComponentProps<"div"> & {
212
- title?: string;
213
- url?: string;
214
- description?: string;
215
- };
216
- export const InlineCitationSource = ({
217
- title,
218
- url,
219
- description,
220
- className,
221
- children,
222
- ...props
223
- }: InlineCitationSourceProps) => (
224
- <div className={cn("space-y-1", className)} {...props}>
225
- {title && (
226
- <h4 className="truncate font-medium text-sm leading-tight">{title}</h4>
227
- )}
228
- {url && <p className="truncate break-all text-muted text-xs">{url}</p>}
229
- {description && (
230
- <p className="line-clamp-3 text-muted text-sm leading-relaxed">
231
- {description}
232
- </p>
233
- )}
234
- {children}
235
- </div>
236
- );
237
- export type InlineCitationQuoteProps = ComponentProps<"blockquote">;
238
- export const InlineCitationQuote = ({
239
- children,
240
- className,
241
- ...props
242
- }: InlineCitationQuoteProps) => (
243
- <blockquote
244
- className={cn(
245
- "border-l-2 border-separator pl-3 text-muted text-sm italic",
246
- className,
247
- )}
248
- {...props}
249
- >
250
- {children}
251
- </blockquote>
252
- );
1
+ "use client";
2
+ import type { CarouselApi } from "../ui/carousel";
3
+ import type { ComponentProps } from "react";
4
+ import { Badge } from "../ui/badge";
5
+ import { Carousel, CarouselContent, CarouselItem } from "../ui/carousel";
6
+ import {
7
+ HoverCard,
8
+ HoverCardContent,
9
+ HoverCardTrigger,
10
+ } from "../ui/hover-card";
11
+ import { cn } from "../utils/cn";
12
+ import { flatPanelSubtleClass } from "../ui/surface-classes";
13
+ import { IconArrowLeft, IconArrowRight } from "@tabler/icons-react";
14
+ import { createContext, useContext, useEffect, useState } from "react";
15
+ export type InlineCitationProps = ComponentProps<"span">;
16
+ export const InlineCitation = ({
17
+ className,
18
+ ...props
19
+ }: InlineCitationProps) => (
20
+ <span
21
+ className={cn("group inline items-center gap-1", className)}
22
+ {...props}
23
+ />
24
+ );
25
+ export type InlineCitationTextProps = ComponentProps<"span">;
26
+ export const InlineCitationText = ({
27
+ className,
28
+ ...props
29
+ }: InlineCitationTextProps) => (
30
+ <span
31
+ className={cn(
32
+ "transition-colors group-hover:bg-surface-secondary",
33
+ className,
34
+ )}
35
+ {...props}
36
+ />
37
+ );
38
+ export type InlineCitationCardProps = ComponentProps<typeof HoverCard>;
39
+ export const InlineCitationCard = (props: InlineCitationCardProps) => (
40
+ <HoverCard closeDelay={0} openDelay={0} {...props} />
41
+ );
42
+ export type InlineCitationCardTriggerProps = ComponentProps<typeof Badge> & {
43
+ sources: string[];
44
+ };
45
+ export const InlineCitationCardTrigger = ({
46
+ sources,
47
+ className,
48
+ ...props
49
+ }: InlineCitationCardTriggerProps) => (
50
+ <HoverCardTrigger asChild>
51
+ <Badge
52
+ className={cn("ml-1 rounded-full", className)}
53
+ variant="secondary"
54
+ {...props}
55
+ >
56
+ {sources[0] ? (
57
+ <>
58
+ {new URL(sources[0]).hostname}{" "}
59
+ {sources.length > 1 && `+${sources.length - 1}`}
60
+ </>
61
+ ) : (
62
+ "unknown"
63
+ )}
64
+ </Badge>
65
+ </HoverCardTrigger>
66
+ );
67
+ export type InlineCitationCardBodyProps = ComponentProps<"div">;
68
+ export const InlineCitationCardBody = ({
69
+ className,
70
+ ...props
71
+ }: InlineCitationCardBodyProps) => (
72
+ <HoverCardContent className={cn("relative w-80 p-0", className)} {...props} />
73
+ );
74
+ const CarouselApiContext = createContext<CarouselApi | undefined>(undefined);
75
+ const useCarouselApi = () => {
76
+ const context = useContext(CarouselApiContext);
77
+ return context;
78
+ };
79
+ export type InlineCitationCarouselProps = ComponentProps<typeof Carousel>;
80
+ export const InlineCitationCarousel = ({
81
+ className,
82
+ children,
83
+ ...props
84
+ }: InlineCitationCarouselProps) => {
85
+ const [api, setApi] = useState<CarouselApi>();
86
+ return (
87
+ <CarouselApiContext.Provider value={api}>
88
+ <Carousel className={cn("w-full", className)} setApi={setApi} {...props}>
89
+ {children}
90
+ </Carousel>
91
+ </CarouselApiContext.Provider>
92
+ );
93
+ };
94
+ export type InlineCitationCarouselContentProps = ComponentProps<"div">;
95
+ export const InlineCitationCarouselContent = (
96
+ props: InlineCitationCarouselContentProps,
97
+ ) => <CarouselContent {...props} />;
98
+ export type InlineCitationCarouselItemProps = ComponentProps<"div">;
99
+ export const InlineCitationCarouselItem = ({
100
+ className,
101
+ ...props
102
+ }: InlineCitationCarouselItemProps) => (
103
+ <CarouselItem
104
+ className={cn("w-full space-y-2 p-4 pl-8", className)}
105
+ {...props}
106
+ />
107
+ );
108
+ export type InlineCitationCarouselHeaderProps = ComponentProps<"div">;
109
+ export const InlineCitationCarouselHeader = ({
110
+ className,
111
+ ...props
112
+ }: InlineCitationCarouselHeaderProps) => (
113
+ <div
114
+ className={cn(
115
+ cn(
116
+ flatPanelSubtleClass,
117
+ "flex items-center justify-between gap-2 rounded-t-md p-2",
118
+ ),
119
+ className,
120
+ )}
121
+ {...props}
122
+ />
123
+ );
124
+ export type InlineCitationCarouselIndexProps = ComponentProps<"div">;
125
+ export const InlineCitationCarouselIndex = ({
126
+ children,
127
+ className,
128
+ ...props
129
+ }: InlineCitationCarouselIndexProps) => {
130
+ const api = useCarouselApi();
131
+ const [current, setCurrent] = useState(0);
132
+ const [count, setCount] = useState(0);
133
+ useEffect(() => {
134
+ if (!api) {
135
+ return;
136
+ }
137
+ setCount(api.scrollSnapList().length);
138
+ setCurrent(api.selectedScrollSnap() + 1);
139
+ const handleSelect = () => {
140
+ setCurrent(api.selectedScrollSnap() + 1);
141
+ };
142
+ api.on("select", handleSelect);
143
+ return () => {
144
+ api.off("select", handleSelect);
145
+ };
146
+ }, [api]);
147
+ return (
148
+ <div
149
+ className={cn(
150
+ "flex flex-1 items-center justify-end px-3 py-1 text-muted text-xs",
151
+ className,
152
+ )}
153
+ {...props}
154
+ >
155
+ {children ?? `${current}/${count}`}
156
+ </div>
157
+ );
158
+ };
159
+ export type InlineCitationCarouselPrevProps = ComponentProps<"button">;
160
+ export const InlineCitationCarouselPrev = ({
161
+ className,
162
+ ...props
163
+ }: InlineCitationCarouselPrevProps) => {
164
+ const api = useCarouselApi();
165
+ const handleClick = () => {
166
+ if (api) {
167
+ api.scrollPrev();
168
+ }
169
+ };
170
+ return (
171
+ <button
172
+ aria-label="Previous"
173
+ className={cn(
174
+ "shrink-0 rounded-md p-0.5 transition-[background-color,transform] duration-150 ease-out active:scale-[0.97] hover:bg-surface-secondary",
175
+ className,
176
+ )}
177
+ onClick={handleClick}
178
+ type="button"
179
+ {...props}
180
+ >
181
+ <IconArrowLeft className="size-4 text-muted" />
182
+ </button>
183
+ );
184
+ };
185
+ export type InlineCitationCarouselNextProps = ComponentProps<"button">;
186
+ export const InlineCitationCarouselNext = ({
187
+ className,
188
+ ...props
189
+ }: InlineCitationCarouselNextProps) => {
190
+ const api = useCarouselApi();
191
+ const handleClick = () => {
192
+ if (api) {
193
+ api.scrollNext();
194
+ }
195
+ };
196
+ return (
197
+ <button
198
+ aria-label="Next"
199
+ className={cn(
200
+ "shrink-0 rounded-md p-0.5 transition-[background-color,transform] duration-150 ease-out active:scale-[0.97] hover:bg-surface-secondary",
201
+ className,
202
+ )}
203
+ onClick={handleClick}
204
+ type="button"
205
+ {...props}
206
+ >
207
+ <IconArrowRight className="size-4 text-muted" />
208
+ </button>
209
+ );
210
+ };
211
+ export type InlineCitationSourceProps = ComponentProps<"div"> & {
212
+ title?: string;
213
+ url?: string;
214
+ description?: string;
215
+ };
216
+ export const InlineCitationSource = ({
217
+ title,
218
+ url,
219
+ description,
220
+ className,
221
+ children,
222
+ ...props
223
+ }: InlineCitationSourceProps) => (
224
+ <div className={cn("space-y-1", className)} {...props}>
225
+ {title && (
226
+ <h4 className="truncate font-medium text-sm leading-tight">{title}</h4>
227
+ )}
228
+ {url && <p className="truncate break-all text-muted text-xs">{url}</p>}
229
+ {description && (
230
+ <p className="line-clamp-3 text-muted text-sm leading-relaxed">
231
+ {description}
232
+ </p>
233
+ )}
234
+ {children}
235
+ </div>
236
+ );
237
+ export type InlineCitationQuoteProps = ComponentProps<"blockquote">;
238
+ export const InlineCitationQuote = ({
239
+ children,
240
+ className,
241
+ ...props
242
+ }: InlineCitationQuoteProps) => (
243
+ <blockquote
244
+ className={cn(
245
+ "border-l-2 border-separator pl-3 text-muted text-sm italic",
246
+ className,
247
+ )}
248
+ {...props}
249
+ >
250
+ {children}
251
+ </blockquote>
252
+ );