@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
package/src/ui/tabs.tsx CHANGED
@@ -1,140 +1,140 @@
1
- import * as React from "react";
2
- import * as TabsPrimitive from "@radix-ui/react-tabs";
3
- import { cn } from "../utils/cn";
4
- import { assignRef } from "../utils/ref";
5
- import { syncTabsPill } from "./tabsSliding";
6
-
7
- const Tabs = TabsPrimitive.Root;
8
-
9
- // `pills` (default): isolated rounded pills with a gap, no shared track.
10
- // `segmented`: connected bar with a sliding pill, kept for marketing surfaces.
11
- type TabsListVariant = "pills" | "segmented";
12
-
13
- const TabsList = React.forwardRef<
14
- React.ComponentRef<typeof TabsPrimitive.List>,
15
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
16
- variant?: TabsListVariant;
17
- }
18
- >(({ className, children, variant = "pills", ...props }, ref) => {
19
- const listRef = React.useRef<React.ComponentRef<
20
- typeof TabsPrimitive.List
21
- > | null>(null);
22
- const pillRef = React.useRef<HTMLSpanElement>(null);
23
- const pillReadyRef = React.useRef(false);
24
-
25
- const mergedRef = React.useCallback(
26
- (node: React.ComponentRef<typeof TabsPrimitive.List> | null) => {
27
- listRef.current = node;
28
- assignRef(ref, node);
29
- },
30
- [ref],
31
- );
32
-
33
- React.useLayoutEffect(() => {
34
- const list = listRef.current;
35
- const pill = pillRef.current;
36
- if (!list || !pill) {
37
- return;
38
- }
39
-
40
- const snap = () => {
41
- syncTabsPill(list, pill, false);
42
- };
43
-
44
- const animate = () => {
45
- syncTabsPill(list, pill, true);
46
- };
47
-
48
- snap();
49
-
50
- requestAnimationFrame(() => {
51
- pillReadyRef.current = true;
52
- });
53
-
54
- const onWindowResize = () => {
55
- snap();
56
- };
57
- window.addEventListener("resize", onWindowResize);
58
-
59
- const resizeObserver = new ResizeObserver(() => {
60
- snap();
61
- });
62
- resizeObserver.observe(list);
63
-
64
- const mutationObserver = new MutationObserver(() => {
65
- if (pillReadyRef.current) {
66
- animate();
67
- } else {
68
- snap();
69
- }
70
- });
71
- mutationObserver.observe(list, {
72
- subtree: true,
73
- attributes: true,
74
- attributeFilter: ["data-state", "aria-selected"],
75
- });
76
-
77
- return () => {
78
- window.removeEventListener("resize", onWindowResize);
79
- resizeObserver.disconnect();
80
- mutationObserver.disconnect();
81
- };
82
- }, [variant]);
83
-
84
- return (
85
- <TabsPrimitive.List
86
- ref={mergedRef}
87
- className={cn(
88
- "t-tabs max-sm:max-w-full max-sm:justify-center-safe max-sm:overflow-x-auto max-sm:scrollbar-none",
89
- variant === "segmented" ? "t-tabs--segmented" : "t-tabs--pills",
90
- className,
91
- )}
92
- data-variant={variant}
93
- {...props}
94
- >
95
- {variant === "segmented" ? (
96
- <span ref={pillRef} className="t-tabs-pill" aria-hidden="true" />
97
- ) : null}
98
- {children}
99
- </TabsPrimitive.List>
100
- );
101
- });
102
- TabsList.displayName = TabsPrimitive.List.displayName;
103
-
104
- const TabsTrigger = React.forwardRef<
105
- React.ComponentRef<typeof TabsPrimitive.Trigger>,
106
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
107
- >(({ className, ...props }, ref) => (
108
- <TabsPrimitive.Trigger
109
- ref={ref}
110
- className={cn(
111
- "t-tab inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
112
- className,
113
- )}
114
- {...props}
115
- />
116
- ));
117
- TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
118
-
119
- const TabsContent = React.forwardRef<
120
- React.ComponentRef<typeof TabsPrimitive.Content>,
121
- React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
122
- >(({ className, ...props }, ref) => (
123
- <TabsPrimitive.Content
124
- ref={ref}
125
- className={cn(
126
- "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2",
127
- className,
128
- )}
129
- {...props}
130
- />
131
- ));
132
- TabsContent.displayName = TabsPrimitive.Content.displayName;
133
-
134
- // raw radix primitives, use these when you need a tabs layout that the
135
- // styled `tabs`/`tabslist`/`tabstrigger`/`tabscontent` defaults don't fit
136
- // (e.g a vertical sidebar of tabs inside a popover) the styled exports
137
- // above are tuned for horizontal pill, style tab bars
138
- export { TabsPrimitive };
139
-
140
- export { Tabs, TabsList, TabsTrigger, TabsContent };
1
+ import * as React from "react";
2
+ import * as TabsPrimitive from "@radix-ui/react-tabs";
3
+ import { cn } from "../utils/cn";
4
+ import { assignRef } from "../utils/ref";
5
+ import { syncTabsPill } from "./tabsSliding";
6
+
7
+ const Tabs = TabsPrimitive.Root;
8
+
9
+ // `pills` (default): isolated rounded pills with a gap, no shared track.
10
+ // `segmented`: connected bar with a sliding pill, kept for marketing surfaces.
11
+ type TabsListVariant = "pills" | "segmented";
12
+
13
+ const TabsList = React.forwardRef<
14
+ React.ComponentRef<typeof TabsPrimitive.List>,
15
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
16
+ variant?: TabsListVariant;
17
+ }
18
+ >(({ className, children, variant = "pills", ...props }, ref) => {
19
+ const listRef = React.useRef<React.ComponentRef<
20
+ typeof TabsPrimitive.List
21
+ > | null>(null);
22
+ const pillRef = React.useRef<HTMLSpanElement>(null);
23
+ const pillReadyRef = React.useRef(false);
24
+
25
+ const mergedRef = React.useCallback(
26
+ (node: React.ComponentRef<typeof TabsPrimitive.List> | null) => {
27
+ listRef.current = node;
28
+ assignRef(ref, node);
29
+ },
30
+ [ref],
31
+ );
32
+
33
+ React.useLayoutEffect(() => {
34
+ const list = listRef.current;
35
+ const pill = pillRef.current;
36
+ if (!list || !pill) {
37
+ return;
38
+ }
39
+
40
+ const snap = () => {
41
+ syncTabsPill(list, pill, false);
42
+ };
43
+
44
+ const animate = () => {
45
+ syncTabsPill(list, pill, true);
46
+ };
47
+
48
+ snap();
49
+
50
+ requestAnimationFrame(() => {
51
+ pillReadyRef.current = true;
52
+ });
53
+
54
+ const onWindowResize = () => {
55
+ snap();
56
+ };
57
+ window.addEventListener("resize", onWindowResize);
58
+
59
+ const resizeObserver = new ResizeObserver(() => {
60
+ snap();
61
+ });
62
+ resizeObserver.observe(list);
63
+
64
+ const mutationObserver = new MutationObserver(() => {
65
+ if (pillReadyRef.current) {
66
+ animate();
67
+ } else {
68
+ snap();
69
+ }
70
+ });
71
+ mutationObserver.observe(list, {
72
+ subtree: true,
73
+ attributes: true,
74
+ attributeFilter: ["data-state", "aria-selected"],
75
+ });
76
+
77
+ return () => {
78
+ window.removeEventListener("resize", onWindowResize);
79
+ resizeObserver.disconnect();
80
+ mutationObserver.disconnect();
81
+ };
82
+ }, [variant]);
83
+
84
+ return (
85
+ <TabsPrimitive.List
86
+ ref={mergedRef}
87
+ className={cn(
88
+ "t-tabs max-sm:max-w-full max-sm:justify-center-safe max-sm:overflow-x-auto max-sm:scrollbar-none",
89
+ variant === "segmented" ? "t-tabs--segmented" : "t-tabs--pills",
90
+ className,
91
+ )}
92
+ data-variant={variant}
93
+ {...props}
94
+ >
95
+ {variant === "segmented" ? (
96
+ <span ref={pillRef} className="t-tabs-pill" aria-hidden="true" />
97
+ ) : null}
98
+ {children}
99
+ </TabsPrimitive.List>
100
+ );
101
+ });
102
+ TabsList.displayName = TabsPrimitive.List.displayName;
103
+
104
+ const TabsTrigger = React.forwardRef<
105
+ React.ComponentRef<typeof TabsPrimitive.Trigger>,
106
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>
107
+ >(({ className, ...props }, ref) => (
108
+ <TabsPrimitive.Trigger
109
+ ref={ref}
110
+ className={cn(
111
+ "t-tab inline-flex items-center justify-center gap-1.5 whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
112
+ className,
113
+ )}
114
+ {...props}
115
+ />
116
+ ));
117
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
118
+
119
+ const TabsContent = React.forwardRef<
120
+ React.ComponentRef<typeof TabsPrimitive.Content>,
121
+ React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>
122
+ >(({ className, ...props }, ref) => (
123
+ <TabsPrimitive.Content
124
+ ref={ref}
125
+ className={cn(
126
+ "mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring focus-visible:ring-offset-2",
127
+ className,
128
+ )}
129
+ {...props}
130
+ />
131
+ ));
132
+ TabsContent.displayName = TabsPrimitive.Content.displayName;
133
+
134
+ // raw radix primitives, use these when you need a tabs layout that the
135
+ // styled `tabs`/`tabslist`/`tabstrigger`/`tabscontent` defaults don't fit
136
+ // (e.g a vertical sidebar of tabs inside a popover) the styled exports
137
+ // above are tuned for horizontal pill, style tab bars
138
+ export { TabsPrimitive };
139
+
140
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -1,56 +1,56 @@
1
- // transitions.dev tabs sliding, see 16, tabs, sliding.md
2
-
3
- function findActiveTab(list: HTMLElement): HTMLElement | null {
4
- const tabs = list.querySelectorAll<HTMLElement>(".t-tab");
5
- for (const tab of tabs) {
6
- if (
7
- tab.getAttribute("aria-selected") === "true" ||
8
- tab.getAttribute("data-state") === "active"
9
- ) {
10
- return tab;
11
- }
12
- }
13
- if (tabs.length === 0) {
14
- return null;
15
- }
16
- return tabs[0] ?? null;
17
- }
18
-
19
- function moveTabsPill(
20
- pill: HTMLElement,
21
- tab: HTMLElement,
22
- animate: boolean,
23
- ): void {
24
- const left = tab.offsetLeft;
25
- const width = tab.offsetWidth;
26
- const top = tab.offsetTop;
27
- const height = tab.offsetHeight;
28
-
29
- if (!animate) {
30
- const previousTransition = pill.style.transition;
31
- pill.style.transition = "none";
32
- pill.style.transform = `translateX(${left}px)`;
33
- pill.style.width = `${width}px`;
34
- pill.style.top = `${top}px`;
35
- pill.style.height = `${height}px`;
36
- void pill.offsetWidth;
37
- pill.style.transition = previousTransition;
38
- return;
39
- }
40
-
41
- pill.style.transform = `translateX(${left}px)`;
42
- pill.style.width = `${width}px`;
43
- pill.style.top = `${top}px`;
44
- pill.style.height = `${height}px`;
45
- }
46
-
47
- export function syncTabsPill(
48
- list: HTMLElement,
49
- pill: HTMLElement,
50
- animate: boolean,
51
- ): void {
52
- const tab = findActiveTab(list);
53
- if (tab) {
54
- moveTabsPill(pill, tab, animate);
55
- }
56
- }
1
+ // transitions.dev tabs sliding, see 16, tabs, sliding.md
2
+
3
+ function findActiveTab(list: HTMLElement): HTMLElement | null {
4
+ const tabs = list.querySelectorAll<HTMLElement>(".t-tab");
5
+ for (const tab of tabs) {
6
+ if (
7
+ tab.getAttribute("aria-selected") === "true" ||
8
+ tab.getAttribute("data-state") === "active"
9
+ ) {
10
+ return tab;
11
+ }
12
+ }
13
+ if (tabs.length === 0) {
14
+ return null;
15
+ }
16
+ return tabs[0] ?? null;
17
+ }
18
+
19
+ function moveTabsPill(
20
+ pill: HTMLElement,
21
+ tab: HTMLElement,
22
+ animate: boolean,
23
+ ): void {
24
+ const left = tab.offsetLeft;
25
+ const width = tab.offsetWidth;
26
+ const top = tab.offsetTop;
27
+ const height = tab.offsetHeight;
28
+
29
+ if (!animate) {
30
+ const previousTransition = pill.style.transition;
31
+ pill.style.transition = "none";
32
+ pill.style.transform = `translateX(${left}px)`;
33
+ pill.style.width = `${width}px`;
34
+ pill.style.top = `${top}px`;
35
+ pill.style.height = `${height}px`;
36
+ void pill.offsetWidth;
37
+ pill.style.transition = previousTransition;
38
+ return;
39
+ }
40
+
41
+ pill.style.transform = `translateX(${left}px)`;
42
+ pill.style.width = `${width}px`;
43
+ pill.style.top = `${top}px`;
44
+ pill.style.height = `${height}px`;
45
+ }
46
+
47
+ export function syncTabsPill(
48
+ list: HTMLElement,
49
+ pill: HTMLElement,
50
+ animate: boolean,
51
+ ): void {
52
+ const tab = findActiveTab(list);
53
+ if (tab) {
54
+ moveTabsPill(pill, tab, animate);
55
+ }
56
+ }
@@ -1,21 +1,21 @@
1
- import * as React from "react";
2
- import { cn } from "../utils/cn";
3
-
4
- const Textarea = React.forwardRef<
5
- HTMLTextAreaElement,
6
- React.ComponentProps<"textarea">
7
- >(({ className, ...props }, ref) => {
8
- return (
9
- <textarea
10
- className={cn(
11
- "flex min-h-20 w-full max-sm:min-w-0 rounded-none border border-border bg-field-background px-3.5 py-2.5 text-base sm:text-sm placeholder:text-field-placeholder focus-visible:border-focus-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50",
12
- className,
13
- )}
14
- ref={ref}
15
- {...props}
16
- />
17
- );
18
- });
19
- Textarea.displayName = "Textarea";
20
-
21
- export { Textarea };
1
+ import * as React from "react";
2
+ import { cn } from "../utils/cn";
3
+
4
+ const Textarea = React.forwardRef<
5
+ HTMLTextAreaElement,
6
+ React.ComponentProps<"textarea">
7
+ >(({ className, ...props }, ref) => {
8
+ return (
9
+ <textarea
10
+ className={cn(
11
+ "flex min-h-20 w-full max-sm:min-w-0 rounded-field border border-border bg-field-background px-3.5 py-2.5 text-base sm:text-sm placeholder:text-field-placeholder focus-visible:border-focus-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring disabled:cursor-not-allowed disabled:opacity-50",
12
+ className,
13
+ )}
14
+ ref={ref}
15
+ {...props}
16
+ />
17
+ );
18
+ });
19
+ Textarea.displayName = "Textarea";
20
+
21
+ export { Textarea };