@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,85 +1,85 @@
1
- const closeTimers = new WeakMap<HTMLElement, ReturnType<typeof setTimeout>>();
2
-
3
- function readModalCloseMs(): number {
4
- const raw = getComputedStyle(document.documentElement).getPropertyValue(
5
- "--modal-close-dur",
6
- );
7
- const parsed = parseFloat(raw);
8
- return Number.isFinite(parsed) ? parsed : 150;
9
- }
10
-
11
- function clearCloseTimer(el: HTMLElement): void {
12
- const timer = closeTimers.get(el);
13
- if (timer !== undefined) {
14
- clearTimeout(timer);
15
- closeTimers.delete(el);
16
- }
17
- }
18
-
19
- // open: scales up from, modal, scale clears any in, flight close cleanup
20
- function openModalSurface(el: HTMLElement): void {
21
- clearCloseTimer(el);
22
- el.classList.remove("is-closing");
23
- el.classList.add("is-open");
24
- }
25
-
26
- // close: swap to is, closing, remove after, modal, close, dur
27
- function closeModalSurface(el: HTMLElement): void {
28
- clearCloseTimer(el);
29
- el.classList.remove("is-open");
30
- el.classList.add("is-closing");
31
- const closeMs = readModalCloseMs();
32
- const timer = setTimeout(() => {
33
- el.classList.remove("is-closing");
34
- closeTimers.delete(el);
35
- }, closeMs);
36
- closeTimers.set(el, timer);
37
- }
38
-
39
- // first paint entrance, start at resting scale, then open on next frame
40
- function primeModalSurface(el: HTMLElement): void {
41
- clearCloseTimer(el);
42
- el.classList.remove("is-open", "is-closing");
43
- requestAnimationFrame(() => {
44
- openModalSurface(el);
45
- });
46
- }
47
-
48
- // sync is, open / is, closing with radix data, state on the same node
49
- function syncModalSurfaceFromDataState(el: HTMLElement): void {
50
- const state = el.getAttribute("data-state");
51
- if (state === "open") {
52
- if (!el.classList.contains("is-open")) {
53
- primeModalSurface(el);
54
- } else {
55
- clearCloseTimer(el);
56
- el.classList.remove("is-closing");
57
- }
58
- return;
59
- }
60
- if (state === "closed" && el.classList.contains("is-open")) {
61
- closeModalSurface(el);
62
- }
63
- }
64
-
65
- function disconnectModalSurface(el: HTMLElement): void {
66
- clearCloseTimer(el);
67
- }
68
-
69
- // wire radix data, state → is, open / is, closing on the dialog surface
70
- // call from the content ref callback so portal, mounted nodes are never missed
71
- export function connectModalSurface(el: HTMLElement): () => void {
72
- if (el.getAttribute("data-state") === "open") {
73
- primeModalSurface(el);
74
- }
75
-
76
- const observer = new MutationObserver(() => {
77
- syncModalSurfaceFromDataState(el);
78
- });
79
- observer.observe(el, { attributes: true, attributeFilter: ["data-state"] });
80
-
81
- return () => {
82
- observer.disconnect();
83
- disconnectModalSurface(el);
84
- };
85
- }
1
+ const closeTimers = new WeakMap<HTMLElement, ReturnType<typeof setTimeout>>();
2
+
3
+ function readModalCloseMs(): number {
4
+ const raw = getComputedStyle(document.documentElement).getPropertyValue(
5
+ "--modal-close-dur",
6
+ );
7
+ const parsed = parseFloat(raw);
8
+ return Number.isFinite(parsed) ? parsed : 150;
9
+ }
10
+
11
+ function clearCloseTimer(el: HTMLElement): void {
12
+ const timer = closeTimers.get(el);
13
+ if (timer !== undefined) {
14
+ clearTimeout(timer);
15
+ closeTimers.delete(el);
16
+ }
17
+ }
18
+
19
+ // open: scales up from, modal, scale clears any in, flight close cleanup
20
+ function openModalSurface(el: HTMLElement): void {
21
+ clearCloseTimer(el);
22
+ el.classList.remove("is-closing");
23
+ el.classList.add("is-open");
24
+ }
25
+
26
+ // close: swap to is, closing, remove after, modal, close, dur
27
+ function closeModalSurface(el: HTMLElement): void {
28
+ clearCloseTimer(el);
29
+ el.classList.remove("is-open");
30
+ el.classList.add("is-closing");
31
+ const closeMs = readModalCloseMs();
32
+ const timer = setTimeout(() => {
33
+ el.classList.remove("is-closing");
34
+ closeTimers.delete(el);
35
+ }, closeMs);
36
+ closeTimers.set(el, timer);
37
+ }
38
+
39
+ // first paint entrance, start at resting scale, then open on next frame
40
+ function primeModalSurface(el: HTMLElement): void {
41
+ clearCloseTimer(el);
42
+ el.classList.remove("is-open", "is-closing");
43
+ requestAnimationFrame(() => {
44
+ openModalSurface(el);
45
+ });
46
+ }
47
+
48
+ // sync is, open / is, closing with radix data, state on the same node
49
+ function syncModalSurfaceFromDataState(el: HTMLElement): void {
50
+ const state = el.getAttribute("data-state");
51
+ if (state === "open") {
52
+ if (!el.classList.contains("is-open")) {
53
+ primeModalSurface(el);
54
+ } else {
55
+ clearCloseTimer(el);
56
+ el.classList.remove("is-closing");
57
+ }
58
+ return;
59
+ }
60
+ if (state === "closed" && el.classList.contains("is-open")) {
61
+ closeModalSurface(el);
62
+ }
63
+ }
64
+
65
+ function disconnectModalSurface(el: HTMLElement): void {
66
+ clearCloseTimer(el);
67
+ }
68
+
69
+ // wire radix data, state → is, open / is, closing on the dialog surface
70
+ // call from the content ref callback so portal, mounted nodes are never missed
71
+ export function connectModalSurface(el: HTMLElement): () => void {
72
+ if (el.getAttribute("data-state") === "open") {
73
+ primeModalSurface(el);
74
+ }
75
+
76
+ const observer = new MutationObserver(() => {
77
+ syncModalSurfaceFromDataState(el);
78
+ });
79
+ observer.observe(el, { attributes: true, attributeFilter: ["data-state"] });
80
+
81
+ return () => {
82
+ observer.disconnect();
83
+ disconnectModalSurface(el);
84
+ };
85
+ }
@@ -1,47 +1,47 @@
1
- import * as React from "react";
2
- import { cn } from "../utils/cn";
3
- import { Button } from "./button";
4
-
5
- interface PaginationProps {
6
- total: number;
7
- page: number;
8
- onChange: (page: number) => void;
9
- className?: string;
10
- }
11
-
12
- function Pagination({ total, page, onChange, className }: PaginationProps) {
13
- if (total <= 1) return null;
14
-
15
- return (
16
- <nav className={cn("flex items-center justify-center gap-1", className)}>
17
- <Button
18
- variant="outline"
19
- size="sm"
20
- onClick={() => onChange(Math.max(1, page - 1))}
21
- disabled={page <= 1}
22
- >
23
- Previous
24
- </Button>
25
- {Array.from({ length: total }, (_, i) => i + 1).map((p) => (
26
- <Button
27
- key={p}
28
- variant={p === page ? "default" : "outline"}
29
- size="sm"
30
- onClick={() => onChange(p)}
31
- >
32
- {p}
33
- </Button>
34
- ))}
35
- <Button
36
- variant="outline"
37
- size="sm"
38
- onClick={() => onChange(Math.min(total, page + 1))}
39
- disabled={page >= total}
40
- >
41
- Next
42
- </Button>
43
- </nav>
44
- );
45
- }
46
-
47
- export { Pagination, type PaginationProps };
1
+ import * as React from "react";
2
+ import { cn } from "../utils/cn";
3
+ import { Button } from "./button";
4
+
5
+ interface PaginationProps {
6
+ total: number;
7
+ page: number;
8
+ onChange: (page: number) => void;
9
+ className?: string;
10
+ }
11
+
12
+ function Pagination({ total, page, onChange, className }: PaginationProps) {
13
+ if (total <= 1) return null;
14
+
15
+ return (
16
+ <nav className={cn("flex items-center justify-center gap-1", className)}>
17
+ <Button
18
+ variant="outline"
19
+ size="sm"
20
+ onClick={() => onChange(Math.max(1, page - 1))}
21
+ disabled={page <= 1}
22
+ >
23
+ Previous
24
+ </Button>
25
+ {Array.from({ length: total }, (_, i) => i + 1).map((p) => (
26
+ <Button
27
+ key={p}
28
+ variant={p === page ? "default" : "outline"}
29
+ size="sm"
30
+ onClick={() => onChange(p)}
31
+ >
32
+ {p}
33
+ </Button>
34
+ ))}
35
+ <Button
36
+ variant="outline"
37
+ size="sm"
38
+ onClick={() => onChange(Math.min(total, page + 1))}
39
+ disabled={page >= total}
40
+ >
41
+ Next
42
+ </Button>
43
+ </nav>
44
+ );
45
+ }
46
+
47
+ export { Pagination, type PaginationProps };
@@ -1,33 +1,33 @@
1
- import * as React from "react";
2
- import * as PopoverPrimitive from "@radix-ui/react-popover";
3
- import { cn } from "../utils/cn";
4
- import {
5
- floatingSurfaceAnimateClass,
6
- floatingSurfaceClass,
7
- } from "./_menu-classes";
8
-
9
- const Popover = PopoverPrimitive.Root;
10
- const PopoverTrigger = PopoverPrimitive.Trigger;
11
-
12
- const PopoverContent = React.forwardRef<
13
- React.ComponentRef<typeof PopoverPrimitive.Content>,
14
- React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
- >(({ className, align = "center", sideOffset = 6, ...props }, ref) => (
16
- <PopoverPrimitive.Portal>
17
- <PopoverPrimitive.Content
18
- ref={ref}
19
- align={align}
20
- sideOffset={sideOffset}
21
- className={cn(
22
- "z-50 w-72 max-sm:max-w-[calc(100vw-2rem)] max-sm:max-h-[85dvh] max-sm:overflow-y-auto p-4 outline-none",
23
- floatingSurfaceClass,
24
- floatingSurfaceAnimateClass,
25
- className,
26
- )}
27
- {...props}
28
- />
29
- </PopoverPrimitive.Portal>
30
- ));
31
- PopoverContent.displayName = PopoverPrimitive.Content.displayName;
32
-
33
- export { Popover, PopoverTrigger, PopoverContent };
1
+ import * as React from "react";
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+ import { cn } from "../utils/cn";
4
+ import {
5
+ floatingSurfaceAnimateClass,
6
+ floatingSurfaceClass,
7
+ } from "./_menu-classes";
8
+
9
+ const Popover = PopoverPrimitive.Root;
10
+ const PopoverTrigger = PopoverPrimitive.Trigger;
11
+
12
+ const PopoverContent = React.forwardRef<
13
+ React.ComponentRef<typeof PopoverPrimitive.Content>,
14
+ React.ComponentPropsWithoutRef<typeof PopoverPrimitive.Content>
15
+ >(({ className, align = "center", sideOffset = 6, ...props }, ref) => (
16
+ <PopoverPrimitive.Portal>
17
+ <PopoverPrimitive.Content
18
+ ref={ref}
19
+ align={align}
20
+ sideOffset={sideOffset}
21
+ className={cn(
22
+ "z-50 w-72 max-sm:max-w-[calc(100vw-2rem)] max-sm:max-h-[85dvh] max-sm:overflow-y-auto p-4 outline-none",
23
+ floatingSurfaceClass,
24
+ floatingSurfaceAnimateClass,
25
+ className,
26
+ )}
27
+ {...props}
28
+ />
29
+ </PopoverPrimitive.Portal>
30
+ ));
31
+ PopoverContent.displayName = PopoverPrimitive.Content.displayName;
32
+
33
+ export { Popover, PopoverTrigger, PopoverContent };
@@ -1,25 +1,25 @@
1
- import * as React from "react";
2
- import * as ProgressPrimitive from "@radix-ui/react-progress";
3
- import { cn } from "../utils/cn";
4
-
5
- const Progress = React.forwardRef<
6
- React.ComponentRef<typeof ProgressPrimitive.Root>,
7
- React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
8
- >(({ className, value, ...props }, ref) => (
9
- <ProgressPrimitive.Root
10
- ref={ref}
11
- className={cn(
12
- "relative h-2.5 w-full overflow-hidden rounded-full bg-default/85",
13
- className,
14
- )}
15
- {...props}
16
- >
17
- <ProgressPrimitive.Indicator
18
- className="h-full w-full flex-1 rounded-full bg-accent transition-transform duration-300 ease-smooth"
19
- style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}
20
- />
21
- </ProgressPrimitive.Root>
22
- ));
23
- Progress.displayName = ProgressPrimitive.Root.displayName;
24
-
25
- export { Progress };
1
+ import * as React from "react";
2
+ import * as ProgressPrimitive from "@radix-ui/react-progress";
3
+ import { cn } from "../utils/cn";
4
+
5
+ const Progress = React.forwardRef<
6
+ React.ComponentRef<typeof ProgressPrimitive.Root>,
7
+ React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
8
+ >(({ className, value, ...props }, ref) => (
9
+ <ProgressPrimitive.Root
10
+ ref={ref}
11
+ className={cn(
12
+ "relative h-2.5 w-full overflow-hidden rounded-full bg-default/85",
13
+ className,
14
+ )}
15
+ {...props}
16
+ >
17
+ <ProgressPrimitive.Indicator
18
+ className="h-full w-full flex-1 rounded-full bg-accent transition-transform duration-300 ease-smooth"
19
+ style={{ transform: `translateX(-${100 - (value ?? 0)}%)` }}
20
+ />
21
+ </ProgressPrimitive.Root>
22
+ ));
23
+ Progress.displayName = ProgressPrimitive.Root.displayName;
24
+
25
+ export { Progress };