@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,211 +1,211 @@
1
- "use client";
2
- import * as React from "react";
3
- import useEmblaCarousel, {
4
- type UseEmblaCarouselType,
5
- } from "embla-carousel-react";
6
- import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
7
- import { cn } from "../utils/cn";
8
- import { Button } from "./button";
9
- type CarouselApi = UseEmblaCarouselType[1];
10
- type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
11
- type CarouselOptions = UseCarouselParameters[0];
12
- type CarouselPlugin = UseCarouselParameters[1];
13
- type CarouselProps = {
14
- opts?: CarouselOptions;
15
- plugins?: CarouselPlugin;
16
- orientation?: "horizontal" | "vertical";
17
- setApi?: (api: CarouselApi) => void;
18
- };
19
- type CarouselContextProps = {
20
- carouselRef: ReturnType<typeof useEmblaCarousel>[0];
21
- api: ReturnType<typeof useEmblaCarousel>[1];
22
- scrollPrev: () => void;
23
- scrollNext: () => void;
24
- canScrollPrev: boolean;
25
- canScrollNext: boolean;
26
- } & CarouselProps;
27
- const CarouselContext = React.createContext<CarouselContextProps | null>(null);
28
- function useCarousel() {
29
- const context = React.useContext(CarouselContext);
30
- if (!context) {
31
- throw new Error("useCarousel must be used within a <Carousel />");
32
- }
33
- return context;
34
- }
35
- function Carousel({
36
- orientation = "horizontal",
37
- opts,
38
- setApi,
39
- plugins,
40
- className,
41
- children,
42
- ...props
43
- }: React.ComponentProps<"div"> & CarouselProps) {
44
- const [carouselRef, api] = useEmblaCarousel(
45
- {
46
- ...opts,
47
- axis: orientation === "horizontal" ? "x" : "y",
48
- },
49
- plugins,
50
- );
51
- const [canScrollPrev, setCanScrollPrev] = React.useState(false);
52
- const [canScrollNext, setCanScrollNext] = React.useState(false);
53
- const onSelect = (api: CarouselApi) => {
54
- if (!api) return;
55
- setCanScrollPrev(api.canScrollPrev());
56
- setCanScrollNext(api.canScrollNext());
57
- };
58
- const scrollPrev = () => {
59
- api?.scrollPrev();
60
- };
61
- const scrollNext = () => {
62
- api?.scrollNext();
63
- };
64
- const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
65
- if (event.key === "ArrowLeft") {
66
- event.preventDefault();
67
- scrollPrev();
68
- } else if (event.key === "ArrowRight") {
69
- event.preventDefault();
70
- scrollNext();
71
- }
72
- };
73
- React.useEffect(() => {
74
- if (!api || !setApi) return;
75
- setApi(api);
76
- }, [api, setApi]);
77
- React.useEffect(() => {
78
- if (!api) return;
79
- onSelect(api);
80
- api.on("reInit", onSelect);
81
- api.on("select", onSelect);
82
- return () => {
83
- api?.off("select", onSelect);
84
- };
85
- }, [api, onSelect]);
86
- return (
87
- <CarouselContext.Provider
88
- value={{
89
- carouselRef,
90
- api: api,
91
- opts,
92
- orientation:
93
- orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
94
- scrollPrev,
95
- scrollNext,
96
- canScrollPrev,
97
- canScrollNext,
98
- }}
99
- >
100
- <div
101
- onKeyDownCapture={handleKeyDown}
102
- className={cn("relative", className)}
103
- role="region"
104
- aria-roledescription="carousel"
105
- data-slot="carousel"
106
- {...props}
107
- >
108
- {children}
109
- </div>
110
- </CarouselContext.Provider>
111
- );
112
- }
113
- function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
114
- const { carouselRef, orientation } = useCarousel();
115
- return (
116
- <div
117
- ref={carouselRef}
118
- className="overflow-hidden"
119
- data-slot="carousel-content"
120
- >
121
- <div
122
- className={cn(
123
- "flex",
124
- orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
125
- className,
126
- )}
127
- {...props}
128
- />
129
- </div>
130
- );
131
- }
132
- function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
133
- const { orientation } = useCarousel();
134
- return (
135
- <div
136
- role="group"
137
- aria-roledescription="slide"
138
- data-slot="carousel-item"
139
- className={cn(
140
- "min-w-0 shrink-0 grow-0 basis-full",
141
- orientation === "horizontal" ? "pl-4" : "pt-4",
142
- className,
143
- )}
144
- {...props}
145
- />
146
- );
147
- }
148
- function CarouselPrevious({
149
- className,
150
- variant = "outline",
151
- size = "icon",
152
- ...props
153
- }: React.ComponentProps<typeof Button>) {
154
- const { orientation, scrollPrev, canScrollPrev } = useCarousel();
155
- return (
156
- <Button
157
- data-slot="carousel-previous"
158
- variant={variant}
159
- size={size}
160
- className={cn(
161
- "absolute size-8 rounded-full",
162
- orientation === "horizontal"
163
- ? "top-1/2 -left-12 -translate-y-1/2"
164
- : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
165
- className,
166
- )}
167
- disabled={!canScrollPrev}
168
- onClick={scrollPrev}
169
- {...props}
170
- >
171
- <IconChevronLeft />
172
- <span className="sr-only">Previous slide</span>
173
- </Button>
174
- );
175
- }
176
- function CarouselNext({
177
- className,
178
- variant = "outline",
179
- size = "icon",
180
- ...props
181
- }: React.ComponentProps<typeof Button>) {
182
- const { orientation, scrollNext, canScrollNext } = useCarousel();
183
- return (
184
- <Button
185
- data-slot="carousel-next"
186
- variant={variant}
187
- size={size}
188
- className={cn(
189
- "absolute size-8 rounded-full",
190
- orientation === "horizontal"
191
- ? "top-1/2 -right-12 -translate-y-1/2"
192
- : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
193
- className,
194
- )}
195
- disabled={!canScrollNext}
196
- onClick={scrollNext}
197
- {...props}
198
- >
199
- <IconChevronRight />
200
- <span className="sr-only">Next slide</span>
201
- </Button>
202
- );
203
- }
204
- export {
205
- type CarouselApi,
206
- Carousel,
207
- CarouselContent,
208
- CarouselItem,
209
- CarouselPrevious,
210
- CarouselNext,
211
- };
1
+ "use client";
2
+ import * as React from "react";
3
+ import useEmblaCarousel, {
4
+ type UseEmblaCarouselType,
5
+ } from "embla-carousel-react";
6
+ import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react";
7
+ import { cn } from "../utils/cn";
8
+ import { Button } from "./button";
9
+ type CarouselApi = UseEmblaCarouselType[1];
10
+ type UseCarouselParameters = Parameters<typeof useEmblaCarousel>;
11
+ type CarouselOptions = UseCarouselParameters[0];
12
+ type CarouselPlugin = UseCarouselParameters[1];
13
+ type CarouselProps = {
14
+ opts?: CarouselOptions;
15
+ plugins?: CarouselPlugin;
16
+ orientation?: "horizontal" | "vertical";
17
+ setApi?: (api: CarouselApi) => void;
18
+ };
19
+ type CarouselContextProps = {
20
+ carouselRef: ReturnType<typeof useEmblaCarousel>[0];
21
+ api: ReturnType<typeof useEmblaCarousel>[1];
22
+ scrollPrev: () => void;
23
+ scrollNext: () => void;
24
+ canScrollPrev: boolean;
25
+ canScrollNext: boolean;
26
+ } & CarouselProps;
27
+ const CarouselContext = React.createContext<CarouselContextProps | null>(null);
28
+ function useCarousel() {
29
+ const context = React.useContext(CarouselContext);
30
+ if (!context) {
31
+ throw new Error("useCarousel must be used within a <Carousel />");
32
+ }
33
+ return context;
34
+ }
35
+ function Carousel({
36
+ orientation = "horizontal",
37
+ opts,
38
+ setApi,
39
+ plugins,
40
+ className,
41
+ children,
42
+ ...props
43
+ }: React.ComponentProps<"div"> & CarouselProps) {
44
+ const [carouselRef, api] = useEmblaCarousel(
45
+ {
46
+ ...opts,
47
+ axis: orientation === "horizontal" ? "x" : "y",
48
+ },
49
+ plugins,
50
+ );
51
+ const [canScrollPrev, setCanScrollPrev] = React.useState(false);
52
+ const [canScrollNext, setCanScrollNext] = React.useState(false);
53
+ const onSelect = (api: CarouselApi) => {
54
+ if (!api) return;
55
+ setCanScrollPrev(api.canScrollPrev());
56
+ setCanScrollNext(api.canScrollNext());
57
+ };
58
+ const scrollPrev = () => {
59
+ api?.scrollPrev();
60
+ };
61
+ const scrollNext = () => {
62
+ api?.scrollNext();
63
+ };
64
+ const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
65
+ if (event.key === "ArrowLeft") {
66
+ event.preventDefault();
67
+ scrollPrev();
68
+ } else if (event.key === "ArrowRight") {
69
+ event.preventDefault();
70
+ scrollNext();
71
+ }
72
+ };
73
+ React.useEffect(() => {
74
+ if (!api || !setApi) return;
75
+ setApi(api);
76
+ }, [api, setApi]);
77
+ React.useEffect(() => {
78
+ if (!api) return;
79
+ onSelect(api);
80
+ api.on("reInit", onSelect);
81
+ api.on("select", onSelect);
82
+ return () => {
83
+ api?.off("select", onSelect);
84
+ };
85
+ }, [api, onSelect]);
86
+ return (
87
+ <CarouselContext.Provider
88
+ value={{
89
+ carouselRef,
90
+ api: api,
91
+ opts,
92
+ orientation:
93
+ orientation || (opts?.axis === "y" ? "vertical" : "horizontal"),
94
+ scrollPrev,
95
+ scrollNext,
96
+ canScrollPrev,
97
+ canScrollNext,
98
+ }}
99
+ >
100
+ <div
101
+ onKeyDownCapture={handleKeyDown}
102
+ className={cn("relative", className)}
103
+ role="region"
104
+ aria-roledescription="carousel"
105
+ data-slot="carousel"
106
+ {...props}
107
+ >
108
+ {children}
109
+ </div>
110
+ </CarouselContext.Provider>
111
+ );
112
+ }
113
+ function CarouselContent({ className, ...props }: React.ComponentProps<"div">) {
114
+ const { carouselRef, orientation } = useCarousel();
115
+ return (
116
+ <div
117
+ ref={carouselRef}
118
+ className="overflow-hidden"
119
+ data-slot="carousel-content"
120
+ >
121
+ <div
122
+ className={cn(
123
+ "flex",
124
+ orientation === "horizontal" ? "-ml-4" : "-mt-4 flex-col",
125
+ className,
126
+ )}
127
+ {...props}
128
+ />
129
+ </div>
130
+ );
131
+ }
132
+ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
133
+ const { orientation } = useCarousel();
134
+ return (
135
+ <div
136
+ role="group"
137
+ aria-roledescription="slide"
138
+ data-slot="carousel-item"
139
+ className={cn(
140
+ "min-w-0 shrink-0 grow-0 basis-full",
141
+ orientation === "horizontal" ? "pl-4" : "pt-4",
142
+ className,
143
+ )}
144
+ {...props}
145
+ />
146
+ );
147
+ }
148
+ function CarouselPrevious({
149
+ className,
150
+ variant = "outline",
151
+ size = "icon",
152
+ ...props
153
+ }: React.ComponentProps<typeof Button>) {
154
+ const { orientation, scrollPrev, canScrollPrev } = useCarousel();
155
+ return (
156
+ <Button
157
+ data-slot="carousel-previous"
158
+ variant={variant}
159
+ size={size}
160
+ className={cn(
161
+ "absolute size-8 rounded-full",
162
+ orientation === "horizontal"
163
+ ? "top-1/2 -left-12 -translate-y-1/2"
164
+ : "-top-12 left-1/2 -translate-x-1/2 rotate-90",
165
+ className,
166
+ )}
167
+ disabled={!canScrollPrev}
168
+ onClick={scrollPrev}
169
+ {...props}
170
+ >
171
+ <IconChevronLeft />
172
+ <span className="sr-only">Previous slide</span>
173
+ </Button>
174
+ );
175
+ }
176
+ function CarouselNext({
177
+ className,
178
+ variant = "outline",
179
+ size = "icon",
180
+ ...props
181
+ }: React.ComponentProps<typeof Button>) {
182
+ const { orientation, scrollNext, canScrollNext } = useCarousel();
183
+ return (
184
+ <Button
185
+ data-slot="carousel-next"
186
+ variant={variant}
187
+ size={size}
188
+ className={cn(
189
+ "absolute size-8 rounded-full",
190
+ orientation === "horizontal"
191
+ ? "top-1/2 -right-12 -translate-y-1/2"
192
+ : "-bottom-12 left-1/2 -translate-x-1/2 rotate-90",
193
+ className,
194
+ )}
195
+ disabled={!canScrollNext}
196
+ onClick={scrollNext}
197
+ {...props}
198
+ >
199
+ <IconChevronRight />
200
+ <span className="sr-only">Next slide</span>
201
+ </Button>
202
+ );
203
+ }
204
+ export {
205
+ type CarouselApi,
206
+ Carousel,
207
+ CarouselContent,
208
+ CarouselItem,
209
+ CarouselPrevious,
210
+ CarouselNext,
211
+ };
@@ -1,27 +1,27 @@
1
- import * as React from "react";
2
- import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
- import { IconCheck } from "@tabler/icons-react";
4
- import { cn } from "../utils/cn";
5
-
6
- const Checkbox = React.forwardRef<
7
- React.ComponentRef<typeof CheckboxPrimitive.Root>,
8
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
9
- >(({ className, ...props }, ref) => (
10
- <CheckboxPrimitive.Root
11
- ref={ref}
12
- className={cn(
13
- "peer relative h-4 w-4 shrink-0 rounded-md border border-border bg-field-background transition-[background-color,border-color] duration-200 ease-smooth focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-accent data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground before:absolute before:inset-[-12px] before:content-['']",
14
- className,
15
- )}
16
- {...props}
17
- >
18
- <CheckboxPrimitive.Indicator
19
- className={cn("flex items-center justify-center text-current")}
20
- >
21
- <IconCheck className="h-3.5 w-3.5" />
22
- </CheckboxPrimitive.Indicator>
23
- </CheckboxPrimitive.Root>
24
- ));
25
- Checkbox.displayName = CheckboxPrimitive.Root.displayName;
26
-
27
- export { Checkbox };
1
+ import * as React from "react";
2
+ import * as CheckboxPrimitive from "@radix-ui/react-checkbox";
3
+ import { IconCheck } from "@tabler/icons-react";
4
+ import { cn } from "../utils/cn";
5
+
6
+ const Checkbox = React.forwardRef<
7
+ React.ComponentRef<typeof CheckboxPrimitive.Root>,
8
+ React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
9
+ >(({ className, ...props }, ref) => (
10
+ <CheckboxPrimitive.Root
11
+ ref={ref}
12
+ className={cn(
13
+ "peer relative h-4 w-4 shrink-0 rounded-md border border-border bg-field-background transition-[background-color,border-color] duration-200 ease-smooth focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:border-accent data-[state=checked]:bg-accent data-[state=checked]:text-accent-foreground before:absolute before:inset-[-12px] before:content-['']",
14
+ className,
15
+ )}
16
+ {...props}
17
+ >
18
+ <CheckboxPrimitive.Indicator
19
+ className={cn("flex items-center justify-center text-current")}
20
+ >
21
+ <IconCheck className="h-3.5 w-3.5" />
22
+ </CheckboxPrimitive.Indicator>
23
+ </CheckboxPrimitive.Root>
24
+ ));
25
+ Checkbox.displayName = CheckboxPrimitive.Root.displayName;
26
+
27
+ export { Checkbox };